1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SVX_INC_SDR_PROPERTIES_GROUPPROPERTIES_HXX
21 #define INCLUDED_SVX_INC_SDR_PROPERTIES_GROUPPROPERTIES_HXX
22 
23 #include <svx/sdr/properties/defaultproperties.hxx>
24 
25 
26 namespace sdr::properties
27     {
28         class GroupProperties final : public DefaultProperties
29         {
30             // create a new itemset
31             virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override;
32 
33             // test changeability for a single item
34             virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) const override;
35 
36             // Do the ItemChange, may do special handling
37             virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override;
38 
39             // Called after ItemChange() is done for all items.
40             virtual void PostItemChange(const sal_uInt16 nWhich) override;
41 
42             // react on ItemSet changes
43             virtual void ItemSetChanged(const SfxItemSet& rSet) override;
44 
45         public:
46             // basic constructor
47             explicit GroupProperties(SdrObject& rObj);
48 
49             // copy constructor
50             GroupProperties(const GroupProperties& rProps, SdrObject& rObj);
51 
52             // destructor
53             virtual ~GroupProperties() override;
54 
55             // Clone() operator, normally just calls the local copy constructor
56             virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override;
57 
58             // get itemset
59             virtual const SfxItemSet& GetObjectItemSet() const override;
60 
61             // get merged ItemSet. Normally, this maps directly to GetObjectItemSet(), but may
62             // be overridden e.g for group objects to return a merged ItemSet of the object.
63             // When using this method the returned ItemSet may contain items in the state
64             // SfxItemState::DONTCARE which means there were several such items with different
65             // values.
66             virtual const SfxItemSet& GetMergedItemSet() const override;
67 
68             // Set merged ItemSet. Normally, this maps to SetObjectItemSet().
69             virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false) override;
70 
71             // set single item
72             virtual void SetObjectItem(const SfxPoolItem& rItem) override;
73 
74             // set single item direct, do not do any notifies or things like that
75             virtual void SetObjectItemDirect(const SfxPoolItem& rItem) override;
76 
77             // clear single item
78             virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) override;
79 
80             // clear single item direct, do not do any notifies or things like that.
81             // Also supports complete deletion of items when default parameter 0 is used.
82             virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) override;
83 
84             // Set a single item, iterate over hierarchies if necessary.
85             virtual void SetMergedItem(const SfxPoolItem& rItem) override;
86 
87             // Clear a single item, iterate over hierarchies if necessary.
88             virtual void ClearMergedItem(const sal_uInt16 nWhich) override;
89 
90             // set complete item set
91             virtual void SetObjectItemSet(const SfxItemSet& rSet) override;
92 
93             // set a new StyleSheet
94             virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) override;
95 
96             // get the local StyleSheet
97             virtual SfxStyleSheet* GetStyleSheet() const override;
98 
99             // force default attributes for a specific object type, called from
100             // DefaultProperties::GetObjectItemSet() if a new ItemSet is created
101             virtual void ForceDefaultAttributes() override;
102 
103             // force all attributes which come from styles to hard attributes
104             // to be able to live without the style.
105             virtual void ForceStyleToHardAttributes() override;
106         };
107 } // end of namespace sdr::properties
108 
109 
110 #endif // INCLUDED_SVX_INC_SDR_PROPERTIES_GROUPPROPERTIES_HXX
111 
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
113