LibreOffice Module svx (master) 1
properties.hxx
Go to the documentation of this file.
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_SDR_PROPERTIES_PROPERTIES_HXX
21#define INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX
22
23#include <sal/config.h>
24
25#include <memory>
26
27#include <sal/types.h>
28#include <svx/svxdllapi.h>
29#include <svl/typedwhich.hxx>
30
31struct _xmlTextWriter;
32typedef struct _xmlTextWriter* xmlTextWriterPtr;
33class SdrObject;
34class SfxItemSet;
35class SfxPoolItem;
36class SfxStyleSheet;
37class Fraction;
38class SfxItemPool;
39class SdrModel;
40
41namespace sdr::properties
42{
43 class ItemChangeBroadcaster;
44}
45
46
48//
49// BaseProperties
50// DefaultProperties ->SfxItemSet
51// AttributeProperties ->SfxStyleSheet
52// E3dProperties
53// E3dCompoundProperties
54// E3dExtrudeProperties
55// E3dLatheProperties
56// E3dSphereProperties
57// E3dSceneProperties
58// TextProperties ->maVersion
59// ConnectorProperties
60// CustomShapeProperties
61// MeasureProperties
62// RectangleProperties
63// CaptionProperties
64// CircleProperties
65// GraphicProperties
66// OleProperties
67// CellProperties
68// TableProperties
69// GroupProperties
70// EmptyProperties
71// PageProperties
72
73namespace sdr::properties
74 {
76 {
77 private:
78 // the owner of this Properties. Set from constructor and not
79 // to be changed in any way.
81
82 protected:
83 // internal access to SdrObject
84 const SdrObject& GetSdrObject() const;
85
86 SdrObject& GetSdrObject();
87
88 public:
89 // basic constructor, used from SdrObject.
90 explicit BaseProperties(SdrObject& rObj);
91
92 // destructor
93 virtual ~BaseProperties();
94
96
97 // Clone() operator, normally just calls the local copy constructor,
98 // see above.
99 virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const = 0;
100
101 // Get the local ItemSet. This directly returns the local ItemSet of the object. No
102 // merging of ItemSets is done for e.g. Group objects.
103 virtual const SfxItemSet& GetObjectItemSet() const = 0;
104
105 // get merged ItemSet. Normally, this maps directly to GetObjectItemSet(), but may
106 // be overridden e.g for group objects to return a merged ItemSet of the object.
107 // When using this method the returned ItemSet may contain items in the state
108 // SfxItemState::DONTCARE which means there were several such items with different
109 // values.
110 virtual const SfxItemSet& GetMergedItemSet() const;
111
112 // Sets all items which are on state SfxItemState::SET in rSet at the local ItemSet.
113 // Uses AllowItemChange(), ItemChange(), PostItemChange() and ItemSetChanged() calls.
114 virtual void SetObjectItemSet(const SfxItemSet& rSet) = 0;
115
116 // Set merged ItemSet. Normally, this maps to SetObjectItemSet().
117 virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false);
118
119 // Set single item at the local ItemSet. Uses AllowItemChange(),
120 // ItemChange(), PostItemChange() and ItemSetChanged() calls.
121 virtual void SetObjectItem(const SfxPoolItem& rItem) = 0;
122
123 // Set a single item direct. Only uses AllowItemChange() and ItemChange(),
124 // but not PostItemChange() and ItemSetChanged() calls.
125 virtual void SetObjectItemDirect(const SfxPoolItem& rItem) = 0;
126
127 // Clear a single local item. Uses AllowItemChange(),
128 // ItemChange(), PostItemChange() and ItemSetChanged() calls.
129 virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) = 0;
130
131 // Set a single item, iterate over hierarchies if necessary. Default
132 // Implementation falls back to ClearObjectItem().
133 virtual void SetMergedItem(const SfxPoolItem& rItem);
134
135 // Clear a single item, iterate over hierarchies if necessary. Default
136 // Implementation falls back to ClearObjectItem().
137 virtual void ClearMergedItem(const sal_uInt16 nWhich);
138
139 // Clear single item direct. Only uses AllowItemChange() and ItemChange(),
140 // but not PostItemChange() and ItemSetChanged() calls.
141 // Also supports complete deletion of items when default parameter 0 is used.
142 virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) = 0;
143
144 // Set a new StyleSheet. Registers as listener at the StyleSheet to get knowledge
145 // of StyleSheet changes.
146 virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
147 bool bBroadcast) = 0;
148
149 // Get the installed StyleSheet.
150 virtual SfxStyleSheet* GetStyleSheet() const = 0;
151
152 // force all attributes which come from styles to hard attributes
153 // to be able to live without the style.
154 virtual void ForceStyleToHardAttributes();
155
156 // syntactical sugar for ItemSet accesses. Broadcasts before and after the changes
157 // to invalidate views in old and new BoundRects. As soon as the repaint mechanism
158 // will be changed these broadcasts will no longer be needed.
159 //void SetItemAndBroadcast(const SfxPoolItem& rItem);
160 //void ClearItemAndBroadcast(const sal_uInt16 nWhich = 0);
161 void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false);
162
163 // Just a convenient shortcut for GetObjectItemSet().Get(nWhich).
164 const SfxPoolItem& GetItem(const sal_uInt16 nWhich) const;
165 template<class T> const T& GetItem(TypedWhichId<T> nWhich) const
166 {
167 return static_cast<const T&>(GetItem(sal_uInt16(nWhich)));
168 }
169
170 // support for convenient broadcasting. Used from SetMergedItemAndBroadcast(),
171 // ClearItemAndBroadcast() and SetItemSetAndBroadcast(), see above.
172 // But also from inside SdrObjects.
173 void BroadcastItemChange(const ItemChangeBroadcaster& rChange);
174
175 // #i101556# add versioning mechanism; used from e.g. text attribute set to
176 // allow detection of e.g. style sheet or single text attribute changes. The
177 // default implementation returns 0 (zero)
178 virtual sal_uInt32 getVersion() const;
179
180 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
181 };
182
183 // checks the FillStyle item and removes unneeded Gradient, FillBitmap and Hatch items
185
186} // end of namespace sdr::properties
187
188#endif // INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX
189
190/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Abstract DrawObject.
Definition: svdobj.hxx:257
virtual void SetObjectItemSet(const SfxItemSet &rSet)=0
virtual void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast)=0
const T & GetItem(TypedWhichId< T > nWhich) const
Definition: properties.hxx:165
virtual std::unique_ptr< BaseProperties > Clone(SdrObject &rObj) const =0
virtual void ClearObjectItemDirect(const sal_uInt16 nWhich)=0
virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool &pPool)=0
virtual void SetObjectItem(const SfxPoolItem &rItem)=0
virtual void SetObjectItemDirect(const SfxPoolItem &rItem)=0
virtual void ClearObjectItem(const sal_uInt16 nWhich=0)=0
virtual const SfxItemSet & GetObjectItemSet() const =0
virtual SfxStyleSheet * GetStyleSheet() const =0
struct _xmlTextWriter * xmlTextWriterPtr
const SfxPoolItem * GetItem(const SwTextAttr &rAttr, sal_uInt16 nWhich)
void CleanupFillProperties(SfxItemSet &rItemSet)
Definition: properties.cxx:148
struct _xmlTextWriter * xmlTextWriterPtr
Definition: properties.hxx:32
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35