1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SDR_PROPERTIES_ATTRIBUTEPROPERTIES_HXX
21 #define INCLUDED_SVX_SDR_PROPERTIES_ATTRIBUTEPROPERTIES_HXX
23 #include <svl/lstner.hxx>
24 #include <svl/stylesheetuser.hxx>
25 #include <svx/sdr/properties/defaultproperties.hxx>
28 namespace sdr::properties
30 class AttributeProperties
: public DefaultProperties
, public SfxListener
, public svl::StyleSheetUser
32 // core to set parent at SfxItemSet and to execute the hard attribute computations
33 void ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr
);
35 // add style sheet, do all the necessary handling
36 void ImpAddStyleSheet(SfxStyleSheet
* pNewStyleSheet
, bool bDontRemoveHardAttr
);
38 // remove StyleSheet, do all the necessary handling
39 void ImpRemoveStyleSheet();
42 // create a new itemset
43 virtual SfxItemSet
CreateObjectSpecificItemSet(SfxItemPool
& pPool
) override
;
45 // Do the ItemChange, may do special handling
46 virtual void ItemChange(const sal_uInt16 nWhich
, const SfxPoolItem
* pNewItem
= nullptr) override
;
48 // react on ItemSet changes
49 virtual void ItemSetChanged(std::span
< const SfxPoolItem
* const > aChangedItems
, sal_uInt16 nDeletedWhich
, bool bAdjustTextFrameWidthAndHeight
= true) override
;
51 // apply the correct SfyStyleSheet from SdrObject's SdrModel
52 virtual void applyDefaultStyleSheetFromSdrModel();
55 explicit AttributeProperties(SdrObject
& rObj
);
57 // constructor for copying, but using new object
58 AttributeProperties(const AttributeProperties
& rProps
, SdrObject
& rObj
);
61 // Clone() operator, normally just calls the local copy constructor
62 virtual std::unique_ptr
<BaseProperties
> Clone(SdrObject
& rObj
) const override
;
64 // Get the local ItemSet. This directly returns the local ItemSet of the object. No
65 // merging of ItemSets is done for e.g. Group objects.
66 virtual const SfxItemSet
& GetObjectItemSet() const override
;
69 virtual ~AttributeProperties() override
;
71 // set a new StyleSheet and broadcast
72 virtual void SetStyleSheet(SfxStyleSheet
* pNewStyleSheet
, bool bDontRemoveHardAttr
,
73 bool bBroadcast
, bool bAdjustTextFrameWidthAndHeight
= true) override
;
75 // get the installed StyleSheet
76 virtual SfxStyleSheet
* GetStyleSheet() const override
;
78 // force all attributes which come from styles to hard attributes
79 // to be able to live without the style.
80 virtual void ForceStyleToHardAttributes() override
;
82 // This is the Notify(...) from 2nd base class SfxListener
83 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
85 virtual bool isUsedByModel() const override
;
87 // the StyleSheet of this object
88 SfxStyleSheet
* mpStyleSheet
;
91 } // end of namespace sdr::properties
94 #endif // INCLUDED_SVX_SDR_PROPERTIES_ATTRIBUTEPROPERTIES_HXX
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */