Coverage Report

Created: 2026-09-28 10:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svl/itempool.hxx
Line
Count
Source
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
#pragma once
21
22
#include <config_options.h>
23
#include <rtl/ref.hxx>
24
#include <svl/poolitem.hxx>
25
#include <svl/svldllapi.h>
26
#include <svl/typedwhich.hxx>
27
#include <svl/whichranges.hxx>
28
#include <memory>
29
#include <vector>
30
#include <unordered_set>
31
#include <unordered_map>
32
#include <salhelper/simplereferenceobject.hxx>
33
#include <svl/SfxBroadcaster.hxx>
34
35
// flag definitions to be used for _nItemInfoFlags
36
// in SfxItemInfo
37
#define SFX_ITEMINFOFLAG_NONE               0x0000
38
39
// Defines if this Item needs to be registered at the pool
40
// to make it accessible for the GetItemSurrogates call. It
41
// will not be included when this flag is not set, but also
42
// needs no registration. There are SAL_INFO calls in the
43
// GetItemSurrogates impl that will mention that
44
1.51G
#define SFX_ITEMINFOFLAG_SUPPORT_SURROGATE  0x0001
45
46
class SfxItemSet;
47
48
class SVL_DLLPUBLIC ItemInfo
49
{
50
    sal_uInt16          m_nWhich;
51
    sal_uInt16          m_nSlotID;
52
    sal_uInt16          m_nItemInfoFlags;
53
54
public:
55
    ItemInfo(sal_uInt16 nWhich, sal_uInt16 nSlotID, sal_uInt16 nItemInfoFlags)
56
7.65k
    : m_nWhich(nWhich), m_nSlotID(nSlotID), m_nItemInfoFlags(nItemInfoFlags) {}
57
5.08M
    ItemInfo(const ItemInfo& rIemInfo) = default;
58
5.09M
    virtual ~ItemInfo() = default;
59
60
2.81M
    sal_uInt16 getWhich() const { return m_nWhich; }
61
    virtual const SfxPoolItem* getItem() const = 0;
62
2.56M
    sal_uInt16 getSlotID() const { return m_nSlotID; }
63
1.51G
    sal_uInt16 getItemInfoFlags() const { return m_nItemInfoFlags; }
64
};
65
66
class SVL_DLLPUBLIC ItemInfoStatic final : public ItemInfo
67
{
68
    friend class ItemInfoPackage;
69
    void setItem(SfxPoolItem* pItem)
70
189
    {
71
189
        if (nullptr != pItem)
72
189
            pItem->setStaticDefault();
73
189
        m_pItem.reset(pItem);
74
189
    }
75
76
    std::unique_ptr<const SfxPoolItem> m_pItem;
77
78
public:
79
    ItemInfoStatic(sal_uInt16 nWhich, SfxPoolItem* pItem, sal_uInt16 nSlotID, sal_uInt16 nItemInfoFlags)
80
7.65k
    : ItemInfo(nWhich, nSlotID, nItemInfoFlags)
81
7.65k
    , m_pItem(pItem) { if(nullptr != pItem) pItem->setStaticDefault(); }
82
83
804M
    virtual const SfxPoolItem* getItem() const override { return m_pItem.get(); }
84
};
85
86
class SVL_DLLPUBLIC ItemInfoDynamic final : public ItemInfo
87
{
88
    std::unique_ptr<const SfxPoolItem> m_pItem;
89
90
public:
91
    ItemInfoDynamic(const ItemInfo& rItemInfo, SfxPoolItem* pItem)
92
990k
    : ItemInfo(rItemInfo)
93
990k
    , m_pItem(pItem) { if(nullptr != pItem) pItem->setDynamicDefault(); }
94
95
9.70M
    virtual const SfxPoolItem* getItem() const override { return m_pItem.get(); }
96
};
97
98
class UNLESS_MERGELIBS(SVL_DLLPUBLIC) ItemInfoUser final : public ItemInfo
99
{
100
    const SfxPoolItem* m_pItem;
101
102
public:
103
    ItemInfoUser(const ItemInfo& rItemInfo, const SfxItemPool& rItemPool, const SfxPoolItem& rItem, bool bPassingOwnership = false);
104
    virtual ~ItemInfoUser();
105
106
133M
    virtual const SfxPoolItem* getItem() const override { return m_pItem; }
107
};
108
109
typedef std::unordered_map<sal_uInt16, sal_uInt16> SlotIDToWhichIDMap;
110
111
class SVL_DLLPUBLIC ItemInfoPackage
112
{
113
protected:
114
    // this is needed for on-demand creation of static entries in constructors
115
    // derived from ItemInfoPackage or implementations of ::getItemInfo(). This
116
    // takes ownership of the item
117
189
    static void setItemAtItemInfoStatic(SfxPoolItem* pItem, ItemInfoStatic& rItemInfo) { rItemInfo.setItem(pItem); }
118
119
private:
120
    // mechanism for buffered SlotIDToWhichIDMap
121
    virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const = 0;
122
    mutable SlotIDToWhichIDMap maSlotIDToWhichIDMap;
123
124
public:
125
82
    ItemInfoPackage() = default;
126
82
    virtual ~ItemInfoPackage() = default;
127
128
    virtual size_t size() const = 0;
129
    virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& rPool) = 0;
130
    virtual const ItemInfo& getExistingItemInfo(size_t /*nIndex*/);
131
    const SlotIDToWhichIDMap& getSlotIDToWhichIDMap() const;
132
};
133
134
typedef std::unordered_set<SfxItemSet*> registeredSfxItemSets;
135
class SfxPoolItemHolder;
136
typedef std::unordered_set<SfxPoolItemHolder*> registeredSfxPoolItemHolders;
137
typedef std::vector<const SfxPoolItem*> ItemSurrogates;
138
typedef std::unordered_map<sal_uInt16, const ItemInfo*> userItemInfos;
139
typedef std::vector<const ItemInfo*> itemInfoVector;
140
typedef std::unordered_map<const SfxPoolItem*, sal_uInt32> NameOrIndexContent;
141
typedef std::unordered_map<SfxItemType, NameOrIndexContent> registeredNameOrIndex;
142
143
/** Base class for providers of defaults of SfxPoolItems.
144
 *
145
 * The derived classes hold the concrete (const) instances which are referenced in several places
146
 * (usually within a single document).
147
 * This helps to lower the amount of calls to lifecycle methods, speeds up comparisons within a document
148
 * and facilitates loading and saving of attributes.
149
 */
150
class SVL_DLLPUBLIC SfxItemPool : public salhelper::SimpleReferenceObject
151
{
152
    friend class SfxItemSet;
153
    friend class SfxPoolItemHolder;
154
    friend class SfxAllItemSet;
155
156
    // allow ItemSetTooling to access
157
    friend SfxPoolItem const* implCreateItemEntry(const SfxItemPool&, SfxPoolItem const*, bool);
158
    friend void implCleanupItemEntry(SfxPoolItem const*);
159
160
    SfxBroadcaster                  aBC;
161
    OUString                        aName;
162
    SfxItemPool*                    mpMaster;
163
    rtl::Reference<SfxItemPool>     mpSecondary;
164
    mutable WhichRangesContainer    maPoolRanges;
165
    sal_uInt16                      mnStart;
166
    sal_uInt16                      mnEnd;
167
    MapUnit                         eDefMetric;
168
169
    registeredSfxItemSets maRegisteredSfxItemSets;
170
    registeredSfxPoolItemHolders maRegisteredSfxPoolItemHolders;
171
172
    // place to register all NameOrIndex Items that are either set in an
173
    // SfxItemSet or SfxPolItemHolder for this Model/Pool
174
    registeredNameOrIndex maRegisteredNameOrIndex;
175
176
    bool mbShutdownHintSent;
177
178
    itemInfoVector maItemInfos;
179
    userItemInfos maUserItemInfos;
180
    const SlotIDToWhichIDMap* mpSlotIDToWhichIDMap;
181
182
public:
183
    void registerItemInfoPackage(
184
        ItemInfoPackage& rPackage,
185
        const std::function<SfxPoolItem*(sal_uInt16)>& rCallback = std::function<SfxPoolItem*(sal_uInt16)>());
186
protected:
187
    const ItemInfo* impCheckItemInfoForClone(const ItemInfo* pInfo);
188
    void impClearUserDefault(const userItemInfos::iterator& rHit);
189
    void impCreateUserDefault(const SfxPoolItem& rItem);
190
private:
191
    void cleanupItemInfos();
192
193
private:
194
    sal_uInt16 GetIndex_Impl(sal_uInt16 nWhich) const
195
2.26G
    {
196
2.26G
        if (IsInRange(nWhich))
197
2.26G
            return nWhich - mnStart;
198
2.26G
        assert(false && "missing bounds check before use");
199
0
        return 0;
200
2.26G
    }
201
    SfxItemPool* getTargetPool(sal_uInt16 nWhich) const;
202
203
    // moved to private: use the access methods, e.g. NeedsSurrogateSupport
204
    SVL_DLLPRIVATE bool CheckItemInfoFlag(sal_uInt16 nWhich, sal_uInt16 nMask) const;
205
    SVL_DLLPRIVATE bool CheckItemInfoFlag_Impl(sal_uInt16 nPos, sal_uInt16 nMask) const
206
0
        { return maItemInfos[nPos]->getItemInfoFlags() & nMask; }
207
208
    void registerItemSet(SfxItemSet& rSet);
209
    void unregisterItemSet(SfxItemSet& rSet);
210
211
    void registerPoolItemHolder(SfxPoolItemHolder& rHolder);
212
    void unregisterPoolItemHolder(SfxPoolItemHolder& rHolder);
213
214
    void registerNameOrIndex(const SfxPoolItem& rItem);
215
    void unregisterNameOrIndex(const SfxPoolItem& rItem);
216
217
public:
218
    // for default SfxItemSet::CTOR, set default WhichRanges
219
    const WhichRangesContainer& GetMergedIdRanges() const;
220
221
protected:
222
    static inline void              AddRef(const SfxPoolItem& rItem);
223
    static inline sal_uInt32        ReleaseRef(const SfxPoolItem& rItem, sal_uInt32 n = 1);
224
225
public:
226
    SfxItemPool(const SfxItemPool &rPool);
227
    SfxItemPool(const OUString &rName);
228
    virtual ~SfxItemPool();
229
230
    SfxBroadcaster&                 BC();
231
232
    // UserDefaults: Every PoolDefault can be 'overloaded' with a user-defined
233
    // default. This is then owned by the pool. The read access is limited
234
    // to check the UserDefaults, so it *will* return nullptr if none is set
235
    void                            SetUserDefaultItem( const SfxPoolItem& );
236
    const SfxPoolItem*              GetUserDefaultItem( sal_uInt16 nWhich ) const;
237
    template<class T> const T*      GetUserDefaultItem( TypedWhichId<T> nWhich ) const
238
172k
    { return static_cast<const T*>(GetUserDefaultItem(sal_uInt16(nWhich))); }
SvxFontHeightItem const* SfxItemPool::GetUserDefaultItem<SvxFontHeightItem>(TypedWhichId<SvxFontHeightItem>) const
Line
Count
Source
238
109k
    { return static_cast<const T*>(GetUserDefaultItem(sal_uInt16(nWhich))); }
SvxNumBulletItem const* SfxItemPool::GetUserDefaultItem<SvxNumBulletItem>(TypedWhichId<SvxNumBulletItem>) const
Line
Count
Source
238
50.0k
    { return static_cast<const T*>(GetUserDefaultItem(sal_uInt16(nWhich))); }
Unexecuted instantiation: SvxFontItem const* SfxItemPool::GetUserDefaultItem<SvxFontItem>(TypedWhichId<SvxFontItem>) const
Unexecuted instantiation: SvxColorItem const* SfxItemPool::GetUserDefaultItem<SvxColorItem>(TypedWhichId<SvxColorItem>) const
Unexecuted instantiation: SvxBrushItem const* SfxItemPool::GetUserDefaultItem<SvxBrushItem>(TypedWhichId<SvxBrushItem>) const
Unexecuted instantiation: SvxShadowItem const* SfxItemPool::GetUserDefaultItem<SvxShadowItem>(TypedWhichId<SvxShadowItem>) const
Unexecuted instantiation: SvxBoxItem const* SfxItemPool::GetUserDefaultItem<SvxBoxItem>(TypedWhichId<SvxBoxItem>) const
SvxTabStopItem const* SfxItemPool::GetUserDefaultItem<SvxTabStopItem>(TypedWhichId<SvxTabStopItem>) const
Line
Count
Source
238
533
    { return static_cast<const T*>(GetUserDefaultItem(sal_uInt16(nWhich))); }
SvxFrameDirectionItem const* SfxItemPool::GetUserDefaultItem<SvxFrameDirectionItem>(TypedWhichId<SvxFrameDirectionItem>) const
Line
Count
Source
238
12.6k
    { return static_cast<const T*>(GetUserDefaultItem(sal_uInt16(nWhich))); }
239
    void                            ResetUserDefaultItem( sal_uInt16 nWhich );
240
241
    // PoolDefaults: Owned by the pool. The read access will only return
242
    // nullptr if the WhichID asked for is not in the range of the pool,
243
    // making the request invalid.
244
    const SfxPoolItem *             GetPoolDefaultItem(sal_uInt16 nWhich) const;
245
    template<class T> const T*      GetPoolDefaultItem( TypedWhichId<T> nWhich ) const
246
    { return static_cast<const T*>(GetPoolDefaultItem(sal_uInt16(nWhich))); }
247
248
    // UserOrPoolDefaults: Combination of UserDefaults and PoolDefaults.
249
    // UserDefaults will be preferred. If none is set for that WhichID,
250
    // the PoolDefault will be returned.
251
    // Note that read access will return a reference, but this will lead
252
    // to an asserted error when the given WhichID is not in the range of
253
    // the pool.
254
    const SfxPoolItem&              GetUserOrPoolDefaultItem( sal_uInt16 nWhich ) const;
255
    template<class T> const T&      GetUserOrPoolDefaultItem( TypedWhichId<T> nWhich ) const
256
165k
    { return static_cast<const T&>(GetUserOrPoolDefaultItem(sal_uInt16(nWhich))); }
Unexecuted instantiation: ScMergeAttr const& SfxItemPool::GetUserOrPoolDefaultItem<ScMergeAttr>(TypedWhichId<ScMergeAttr>) const
SvxFontItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxFontItem>(TypedWhichId<SvxFontItem>) const
Line
Count
Source
256
85.4k
    { return static_cast<const T&>(GetUserOrPoolDefaultItem(sal_uInt16(nWhich))); }
SvxFontHeightItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxFontHeightItem>(TypedWhichId<SvxFontHeightItem>) const
Line
Count
Source
256
9
    { return static_cast<const T&>(GetUserOrPoolDefaultItem(sal_uInt16(nWhich))); }
SvxWeightItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxWeightItem>(TypedWhichId<SvxWeightItem>) const
Line
Count
Source
256
9
    { return static_cast<const T&>(GetUserOrPoolDefaultItem(sal_uInt16(nWhich))); }
Unexecuted instantiation: SvxColorItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxColorItem>(TypedWhichId<SvxColorItem>) const
Unexecuted instantiation: SvxBrushItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxBrushItem>(TypedWhichId<SvxBrushItem>) const
Unexecuted instantiation: SvxUnderlineItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxUnderlineItem>(TypedWhichId<SvxUnderlineItem>) const
Unexecuted instantiation: SvxOverlineItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxOverlineItem>(TypedWhichId<SvxOverlineItem>) const
SvxSetItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxSetItem>(TypedWhichId<SvxSetItem>) const
Line
Count
Source
256
59.9k
    { return static_cast<const T&>(GetUserOrPoolDefaultItem(sal_uInt16(nWhich))); }
SfxUInt16Item const& SfxItemPool::GetUserOrPoolDefaultItem<SfxUInt16Item>(TypedWhichId<SfxUInt16Item>) const
Line
Count
Source
256
1.92k
    { return static_cast<const T&>(GetUserOrPoolDefaultItem(sal_uInt16(nWhich))); }
ScPageScaleToItem const& SfxItemPool::GetUserOrPoolDefaultItem<ScPageScaleToItem>(TypedWhichId<ScPageScaleToItem>) const
Line
Count
Source
256
964
    { return static_cast<const T&>(GetUserOrPoolDefaultItem(sal_uInt16(nWhich))); }
Unexecuted instantiation: ScMergeFlagAttr const& SfxItemPool::GetUserOrPoolDefaultItem<ScMergeFlagAttr>(TypedWhichId<ScMergeFlagAttr>) const
Unexecuted instantiation: SvxShadowItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxShadowItem>(TypedWhichId<SvxShadowItem>) const
Unexecuted instantiation: SvxNumBulletItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxNumBulletItem>(TypedWhichId<SvxNumBulletItem>) const
Unexecuted instantiation: SvxPostureItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxPostureItem>(TypedWhichId<SvxPostureItem>) const
Unexecuted instantiation: SvxCrossedOutItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxCrossedOutItem>(TypedWhichId<SvxCrossedOutItem>) const
Unexecuted instantiation: SvxWordLineModeItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxWordLineModeItem>(TypedWhichId<SvxWordLineModeItem>) const
Unexecuted instantiation: XFillBmpTileItem const& SfxItemPool::GetUserOrPoolDefaultItem<XFillBmpTileItem>(TypedWhichId<XFillBmpTileItem>) const
XFillBmpStretchItem const& SfxItemPool::GetUserOrPoolDefaultItem<XFillBmpStretchItem>(TypedWhichId<XFillBmpStretchItem>) const
Line
Count
Source
256
45
    { return static_cast<const T&>(GetUserOrPoolDefaultItem(sal_uInt16(nWhich))); }
Unexecuted instantiation: SfxUInt32Item const& SfxItemPool::GetUserOrPoolDefaultItem<SfxUInt32Item>(TypedWhichId<SfxUInt32Item>) const
Unexecuted instantiation: SvxFrameDirectionItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxFrameDirectionItem>(TypedWhichId<SvxFrameDirectionItem>) const
SvxTabStopItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxTabStopItem>(TypedWhichId<SvxTabStopItem>) const
Line
Count
Source
256
17.4k
    { return static_cast<const T&>(GetUserOrPoolDefaultItem(sal_uInt16(nWhich))); }
Unexecuted instantiation: SvxLanguageItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxLanguageItem>(TypedWhichId<SvxLanguageItem>) const
Unexecuted instantiation: SvxAdjustItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxAdjustItem>(TypedWhichId<SvxAdjustItem>) const
Unexecuted instantiation: SvxEscapementItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxEscapementItem>(TypedWhichId<SvxEscapementItem>) const
Unexecuted instantiation: SvxLineSpacingItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxLineSpacingItem>(TypedWhichId<SvxLineSpacingItem>) const
Unexecuted instantiation: SvxCaseMapItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxCaseMapItem>(TypedWhichId<SvxCaseMapItem>) const
Unexecuted instantiation: SvxShadowedItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxShadowedItem>(TypedWhichId<SvxShadowedItem>) const
Unexecuted instantiation: SvxEmphasisMarkItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxEmphasisMarkItem>(TypedWhichId<SvxEmphasisMarkItem>) const
Unexecuted instantiation: SvxCharReliefItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxCharReliefItem>(TypedWhichId<SvxCharReliefItem>) const
Unexecuted instantiation: SvxContourItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxContourItem>(TypedWhichId<SvxContourItem>) const
Unexecuted instantiation: SvxNoHyphenItem const& SfxItemPool::GetUserOrPoolDefaultItem<SvxNoHyphenItem>(TypedWhichId<SvxNoHyphenItem>) const
257
258
    virtual MapUnit                 GetMetric( sal_uInt16 nWhich ) const;
259
    void                            SetDefaultMetric( MapUnit eNewMetric );
260
261
    /** Request string representation of pool items.
262
263
        This virtual function produces a string representation
264
        from the respective SfxItemPool subclass' known SfxPoolItems.
265
266
        Subclasses, please override this method, and handle
267
        SfxPoolItems that don't return useful/complete information on
268
        SfxPoolItem::GetPresentation()
269
270
        This baseclass yields the unmodified string representation of
271
        rItem.
272
273
        @param[in] rItem
274
        SfxPoolItem to query the string representation of
275
276
        @param[in] ePresent
277
        requested kind of representation - see SfxItemPresentation
278
279
        @param[in] eMetric
280
        requested unit of measure of the representation
281
282
        @param[out] rText
283
        string representation of 'rItem'
284
285
        @return true if it has a valid string representation
286
    */
287
    virtual bool                    GetPresentation( const SfxPoolItem& rItem,
288
                                                     MapUnit ePresentationMetric,
289
                                                     OUString& rText,
290
                                                     const IntlWrapper& rIntlWrapper ) const;
291
    virtual rtl::Reference<SfxItemPool> Clone() const;
292
0
    const OUString& GetName() const { return aName; }
293
294
public:
295
    // SurrogateData callback helper for iterateItemSurrogates
296
    class SurrogateData
297
    {
298
    public:
299
0
        virtual ~SurrogateData() = default;
300
0
        SurrogateData(const SurrogateData&) = default;
301
0
        SurrogateData() = default;
302
303
        // read-access to Item
304
        virtual const SfxPoolItem& getItem() const = 0;
305
306
        // write-access when Item needs to be modified
307
        virtual const SfxPoolItem* setItem(std::unique_ptr<SfxPoolItem>) = 0;
308
    };
309
310
    // Iterate using a lambda/callback with read/write access to registered SfxPoolItems.
311
    // If you use this (look for current usages) inside the callback you may
312
    //   return true; // to continue callback (like 'continue')
313
    //   return false; // to end callbacks (like 'break')
314
    void iterateItemSurrogates(
315
        sal_uInt16 nWhich,
316
        const std::function<bool(SfxItemPool::SurrogateData& rData)>& rItemCallback) const;
317
318
    // Read-only access to registered SfxPoolItems
319
    // NOTE: In *no* case use const_cast and change those Items (!)
320
    // Read commit text for more information
321
    ItemSurrogates GetItemSurrogates(sal_uInt16 nWhich) const;
322
323
    // special version for read-only itemSurrogates for NameOrIndex Items
324
    ItemSurrogates GetItemSurrogatesForItem(const SfxPoolItem& rItem) const;
325
    ItemSurrogates GetItemSurrogatesForItem(SfxItemType eItemType) const;
326
327
0
    sal_uInt16 GetFirstWhich() const { return mnStart; }
328
0
    sal_uInt16 GetLastWhich() const { return mnEnd; }
329
5.20G
    bool IsInRange( sal_uInt16 nWhich ) const { return nWhich >= mnStart && nWhich <= mnEnd; }
330
331
    void                            SetSecondaryPool( SfxItemPool *pPool );
332
3.34M
    SfxItemPool* GetSecondaryPool() const { return mpSecondary.get(); }
333
    /* get the last pool by following the GetSecondaryPool chain */
334
    SfxItemPool*                    GetLastPoolInChain();
335
858M
    SfxItemPool* GetMasterPool() const { return mpMaster; }
336
    void sendShutdownHint();
337
338
    // syntactical sugar: direct call to not have to use the flag define
339
    // and make the intention clearer
340
    bool NeedsSurrogateSupport(sal_uInt16 nWhich) const
341
1.51G
        { return CheckItemInfoFlag(nWhich, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE); }
342
343
    // tries to translate back from SlotID to WhichID.
344
    // If none is defined, return nSlot.
345
    // If nSlot is not a SlotID, return nSlot.
346
    sal_uInt16 GetWhichIDFromSlotID(sal_uInt16 nSlot, bool bDeep = true) const;
347
    template<class T> TypedWhichId<T> GetWhichIDFromSlotID(TypedWhichId<T> nSlot, bool bDeep = true) const
348
0
     { return TypedWhichId<T>(GetWhichIDFromSlotID(sal_uInt16(nSlot), bDeep)); }
Unexecuted instantiation: TypedWhichId<SvxLanguageItem> SfxItemPool::GetWhichIDFromSlotID<SvxLanguageItem>(TypedWhichId<SvxLanguageItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxMacroItem> SfxItemPool::GetWhichIDFromSlotID<SvxMacroItem>(TypedWhichId<SvxMacroItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxFontItem> SfxItemPool::GetWhichIDFromSlotID<SvxFontItem>(TypedWhichId<SvxFontItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxBrushItem> SfxItemPool::GetWhichIDFromSlotID<SvxBrushItem>(TypedWhichId<SvxBrushItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxPageModelItem> SfxItemPool::GetWhichIDFromSlotID<SvxPageModelItem>(TypedWhichId<SvxPageModelItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxFormatKeepItem> SfxItemPool::GetWhichIDFromSlotID<SvxFormatKeepItem>(TypedWhichId<SvxFormatKeepItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxKerningItem> SfxItemPool::GetWhichIDFromSlotID<SvxKerningItem>(TypedWhichId<SvxKerningItem>, bool) const
Unexecuted instantiation: TypedWhichId<SfxStringItem> SfxItemPool::GetWhichIDFromSlotID<SfxStringItem>(TypedWhichId<SfxStringItem>, bool) const
Unexecuted instantiation: TypedWhichId<SwPaMItem> SfxItemPool::GetWhichIDFromSlotID<SwPaMItem>(TypedWhichId<SwPaMItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxColorItem> SfxItemPool::GetWhichIDFromSlotID<SvxColorItem>(TypedWhichId<SvxColorItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxSizeItem> SfxItemPool::GetWhichIDFromSlotID<SvxSizeItem>(TypedWhichId<SvxSizeItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxShadowItem> SfxItemPool::GetWhichIDFromSlotID<SvxShadowItem>(TypedWhichId<SvxShadowItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxFormatBreakItem> SfxItemPool::GetWhichIDFromSlotID<SvxFormatBreakItem>(TypedWhichId<SvxFormatBreakItem>, bool) const
Unexecuted instantiation: TypedWhichId<SwFormatPageDesc> SfxItemPool::GetWhichIDFromSlotID<SwFormatPageDesc>(TypedWhichId<SwFormatPageDesc>, bool) const
Unexecuted instantiation: TypedWhichId<SwFormatLayoutSplit> SfxItemPool::GetWhichIDFromSlotID<SwFormatLayoutSplit>(TypedWhichId<SwFormatLayoutSplit>, bool) const
Unexecuted instantiation: TypedWhichId<SvxFrameDirectionItem> SfxItemPool::GetWhichIDFromSlotID<SvxFrameDirectionItem>(TypedWhichId<SvxFrameDirectionItem>, bool) const
Unexecuted instantiation: TypedWhichId<SfxUInt32Item> SfxItemPool::GetWhichIDFromSlotID<SfxUInt32Item>(TypedWhichId<SfxUInt32Item>, bool) const
Unexecuted instantiation: TypedWhichId<SvxNumBulletItem> SfxItemPool::GetWhichIDFromSlotID<SvxNumBulletItem>(TypedWhichId<SvxNumBulletItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxLineSpacingItem> SfxItemPool::GetWhichIDFromSlotID<SvxLineSpacingItem>(TypedWhichId<SvxLineSpacingItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxLRSpaceItem> SfxItemPool::GetWhichIDFromSlotID<SvxLRSpaceItem>(TypedWhichId<SvxLRSpaceItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxULSpaceItem> SfxItemPool::GetWhichIDFromSlotID<SvxULSpaceItem>(TypedWhichId<SvxULSpaceItem>, bool) const
Unexecuted instantiation: TypedWhichId<SfxBoolItem> SfxItemPool::GetWhichIDFromSlotID<SfxBoolItem>(TypedWhichId<SfxBoolItem>, bool) const
Unexecuted instantiation: TypedWhichId<SvxPaperBinItem> SfxItemPool::GetWhichIDFromSlotID<SvxPaperBinItem>(TypedWhichId<SvxPaperBinItem>, bool) const
349
350
    // get SlotID that may be registered in the SfxItemInfo for
351
    // the given WhichID.
352
    // If none is defined, return nWhich.
353
    // If nWhich is not a WhichID, return nWhich.
354
    sal_uInt16 GetSlotId( sal_uInt16 nWhich ) const;
355
356
    // same as GetWhichIDFromSlotID, but returns 0 in error cases, so:
357
    // If none is defined, return 0.
358
    // If nSlot is not a SlotID, return 0.
359
    sal_uInt16 GetTrueWhichIDFromSlotID( sal_uInt16 nSlot, bool bDeep = true ) const;
360
361
    // same as GetSlotId, but returns 0 in error cases, so:
362
    // If none is defined, return 0.
363
    // If nWhich is not a WhichID, return 0.
364
    sal_uInt16 GetTrueSlotId( sal_uInt16 nWhich ) const;
365
366
117M
    static bool IsWhich(sal_uInt16 nId) { return nId && nId <= SFX_WHICH_MAX; }
367
3.32G
    static bool IsSlot(sal_uInt16 nId) { return nId && nId > SFX_WHICH_MAX; }
368
369
private:
370
    const SfxItemPool& operator=(const SfxItemPool &) = delete;
371
372
     //IDs below or equal are Which IDs, IDs above slot IDs
373
    static const sal_uInt16 SFX_WHICH_MAX = 4999;
374
};
375
376
// only the pool may manipulate the reference counts
377
inline void SfxItemPool::AddRef(const SfxPoolItem& rItem)
378
0
{
379
0
    rItem.AddRef();
380
0
}
381
382
// only the pool may manipulate the reference counts
383
inline sal_uInt32 SfxItemPool::ReleaseRef(const SfxPoolItem& rItem, sal_uInt32 n)
384
0
{
385
0
    return rItem.ReleaseRef(n);
386
0
}
387
388
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */