summaryrefslogtreecommitdiff
path: root/include/svl/poolitem.hxx
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2024-01-12 18:40:24 +0100
committerArmin Le Grand <Armin.Le.Grand@me.com>2024-01-14 21:02:46 +0100
commit845d92e1f30eef5745480604fb9f6e4c3e3b7284 (patch)
tree7499b058845fbd7317469332e7c0b7414da9f1c6 /include/svl/poolitem.hxx
parent04777d49b17834a5edf0063e89b968afae457191 (diff)
ITEM: Move Shareable ItemFlag to SfxPolItem
Currently a Pool-Attribute (in SfxItemInfo), but should be a SfxPoolItem property. Originally 'moved' from old 'poolable' used as hint. I identified needs more general and moved it to where it belongs. Also reworked SfxItemInfo to no longer have/support single bollean flags, but a FlagVariable and defined SFX_ITEMINFOFLAG_* entries to access these, that will make future changes easier without having to change all palces where these get defined over and over again. Added CheckItemInfoFlag for gereral access to that flag and e.g. NeedsSurrogateSupport to directly check for the SFX_ITEMINFOFLAG_SUPPORT_SURROGATE flag as syntactical sugar, that makes the intention clear. Change-Id: I09c238c7c5b7f721b657d7b0a44dbc8d14e02528 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161982 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'include/svl/poolitem.hxx')
-rw-r--r--include/svl/poolitem.hxx25
1 files changed, 23 insertions, 2 deletions
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index d2165a49a446..f1825831c442 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -129,16 +129,35 @@ class SVL_DLLPUBLIC SfxPoolItem
sal_uInt32 m_nSerialNumber;
#endif
- // bitfield for flags (instead of SfxItemKind)
+ // bitfield for Item attributes that are Item-Dpendent
+
+ // Item is a SfxVoidItem (used for SfxItemState::DISABLED,
+ // but unfortunately also for some slot stuff with
+ // Which != 0) -> needs cleanup
bool m_bIsVoidItem : 1; // bit 0
+
+ // Item is registered at some Pool as default.
+ // m_bStaticDefault: direct Pool Item (CAUTION:
+ // thetse are not really 'static', but should be)
+ // -> needs cleanup
+ // m_bPoolDefault: set by user using SetPoolDefaultItem
+ // tho should be better called 'UserDefault'
bool m_bStaticDefault : 1; // bit 1
bool m_bPoolDefault : 1; // bit 2
+
+ // Item is derived from SfxSetItem -> is Pool-dependent
bool m_bIsSetItem : 1; // bit 3
+ // Defines if the Item can be shared/RefCounted else it will be cloned.
+ // Default is true - as it should be for all Items. It is needed by some
+ // SW items, so protected to let them set it in constructor. If this could
+ // be fixed at that Items we may remove this again.
+ bool m_bShareable : 1; // bit 4
+
protected:
#ifdef DBG_UTIL
// this flag will make debugging item stuff much simpler
- bool m_bDeleted : 1; // bit 4
+ bool m_bDeleted : 1; // bit 5
#endif
private:
@@ -153,6 +172,7 @@ protected:
void setStaticDefault() { m_bStaticDefault = true; }
void setPoolDefault() { m_bPoolDefault = true; }
void setIsSetItem() { m_bIsSetItem = true; }
+ void setNonShareable() { m_bShareable = false; }
public:
inline void AddRef(sal_uInt32 n = 1) const
@@ -170,6 +190,7 @@ public:
bool isStaticDefault() const { return m_bStaticDefault; }
bool isPoolDefault() const { return m_bPoolDefault; }
bool isSetItem() const { return m_bIsSetItem; }
+ bool isShareable() const { return m_bShareable; }
// version that allows nullptrs
static bool areSame(const SfxPoolItem* pItem1, const SfxPoolItem* pItem2);