LibreOffice Module svx (master) 1
defaultproperties.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_DEFAULTPROPERTIES_HXX
21#define INCLUDED_SVX_SDR_PROPERTIES_DEFAULTPROPERTIES_HXX
22
23#include <sal/config.h>
24
25#include <optional>
26
28#include <svx/svxdllapi.h>
29#include <svl/itemset.hxx>
30#include <o3tl/span.hxx>
31
32struct _xmlTextWriter;
33typedef struct _xmlTextWriter* xmlTextWriterPtr;
34
35namespace sdr::properties
36 {
38 {
39 protected:
40 // the to be used ItemSet
41 mutable std::optional<SfxItemSet> mxItemSet;
42
43 // create a new object specific itemset with object specific ranges.
44 virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override;
45
46 // Test changeability for a single item. If an implementation wants to prevent
47 // changing an item it should override this method.
48 virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) const;
49
50 // Do the internal ItemChange. If only nWhich is given, the item needs to be cleared.
51 // Also needs to handle if nWhich and pNewItem is 0, which means to clear all items.
52 virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr);
53
54 // Called after ItemChange() is done for all items. Allows local reactions on
55 // specific item changes
56 virtual void PostItemChange(const sal_uInt16 nWhich);
57
58 // Internally react on ItemSet changes. The given span contains changed items.
59 // If nDeletedWhich is not 0, it indicates a deleted item.
60 virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich);
61
62 // check if SfxItemSet exists
63 bool HasSfxItemSet() const { return bool(mxItemSet); }
64
65 public:
66 // basic constructor
67 explicit DefaultProperties(SdrObject& rObj);
68
69 // constructor for copying, but using new object
70 DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj);
71
72 // destructor
73 virtual ~DefaultProperties() override;
74
75 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
76
77 // Clone() operator, normally just calls the local copy constructor
78 virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override;
79
80 // get itemset
81 virtual const SfxItemSet& GetObjectItemSet() const override;
82
83 // set single item
84 virtual void SetObjectItem(const SfxPoolItem& rItem) override;
85
86 // set single item direct, do not do any notifies or things like that
87 virtual void SetObjectItemDirect(const SfxPoolItem& rItem) override;
88
89 // clear single item
90 virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) override;
91
92 // clear single item direct, do not do any notifies or things like that.
93 // Also supports complete deletion of items when default parameter 0 is used.
94 virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) override;
95
96 // set complete item set
97 virtual void SetObjectItemSet(const SfxItemSet& rSet) override;
98
99 // set a new StyleSheet and broadcast
100 virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
101 bool bBroadcast) override;
102
103 // get the installed StyleSheet
104 virtual SfxStyleSheet* GetStyleSheet() const override;
105
106 // force default attributes for a specific object type, called from
107 // DefaultProperties::GetObjectItemSet() if a new ItemSet is created.
108 // Default implementation does nothing.
109 virtual void ForceDefaultAttributes();
110 };
111
112} // end of namespace sdr::properties
113
114#endif // INCLUDED_SVX_SDR_PROPERTIES_DEFAULTPROPERTIES_HXX
115
116/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Abstract DrawObject.
Definition: svdobj.hxx:260
std::optional< SfxItemSet > mxItemSet
struct _xmlTextWriter * xmlTextWriterPtr
struct _xmlTextWriter * xmlTextWriterPtr
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35