83 template<sal_uInt16... WIDs>
89 virtual std::unique_ptr<SfxItemSet>
Clone(
bool bItems =
true,
SfxItemPool *pToPool =
nullptr)
const;
98 const SfxPoolItem&
Get( sal_uInt16 nWhich,
bool bSrchInParent =
true )
const;
102 return static_cast<const T&
>(
Get(sal_uInt16(nWhich), bSrchInParent));
114 template<
class T>
const T*
GetItem(sal_uInt16 nWhich,
bool bSearchInParent =
true)
const
117 const T* pCastedItem =
dynamic_cast<const T*
>(pItem);
119 assert(!pItem || pCastedItem);
124 return GetItem<T>(sal_uInt16(nWhich), bSearchInParent);
129 template<
class T>
static const T*
GetItem(
const SfxItemSet* pItemSet, sal_uInt16 nWhich,
bool bSearchInParent)
132 return pItemSet->
GetItem<T>(nWhich, bSearchInParent);
138 bool bSearchInParent)
140 return GetItem<T>(pItemSet,
static_cast<sal_uInt16
>(nWhich), bSearchInParent);
146 bool bSrchInParent =
true,
151 bool bSrchInParent =
true,
152 const T **ppItem =
nullptr )
const
158 bool bSrchInParent =
true )
const
162 return static_cast<const T*
>(pItem);
169 {
return HasItem(sal_uInt16(nWhich),
reinterpret_cast<const SfxPoolItem**
>(ppItem)); }
173 sal_uInt16
ClearItem( sal_uInt16 nWhich = 0);
182 {
return PutImpl(rItem, nWhich,
false); }
184 {
return PutImpl(*xItem.release(), nWhich,
true); }
186 {
return Put(rItem, rItem.
Which()); }
188 {
auto nWhich = xItem->
Which();
return Put(std::move(xItem), nWhich); }
190 bool bInvalidAsDefault =
true );
206 void MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo );
227 sal_uInt16
ClearSingleItemImpl( sal_uInt16 nWhich, std::optional<sal_uInt16> oItemOffsetHint );
232 std::optional<sal_uInt16> oItemsOffsetHint)
const;
250 virtual std::unique_ptr<SfxItemSet>
Clone(
bool bItems =
true,
SfxItemPool *pToPool =
nullptr )
const override;
262template <sal_uInt16 WID1, sal_uInt16 WID2, sal_uInt16... Rest>
265 sal_uInt16 nCapacity =
rangeSize(WID1, WID2);
266 if constexpr (
sizeof...(Rest) > 0)
273template<sal_uInt16... WIDs>
virtual const SfxPoolItem * PutImpl(const SfxPoolItem &, sal_uInt16 nWhich, bool bPassingOwnership) override
Putting with automatic extension of the WhichId with the ID of the Item.
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const override
Base class for providers of defaults of SfxPoolItems.
static constexpr sal_uInt16 NITEMS
const SfxPoolItem * m_aItems[NITEMS]
SfxItemSetFixed(SfxItemPool &rPool)
virtual void Changed(const SfxPoolItem &rOld, const SfxPoolItem &rNew)
Notification callback.
void MergeValues(const SfxItemSet &rSet)
SfxItemPool * m_pPool
pool that stores the items
SfxItemSet(SfxItemPool &, SfxAllItemSetFlag)
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
sal_uInt16 ClearAllItemsImpl()
void SetParent(const SfxItemSet *pNew)
void dumpAsXml(xmlTextWriterPtr pWriter) const
static const T * GetItem(const SfxItemSet *pItemSet, sal_uInt16 nWhich, bool bSearchInParent)
Templatized static version of GetItem() to directly return the correct type if the SfxItemSet is avai...
bool m_bItemsFixed
true if this is a SfxItemSetFixed object
void PutExtended(const SfxItemSet &, SfxItemState eDontCareAs, SfxItemState eDefaultAs)
This method takes the Items from the 'rSet' and adds to '*this'.
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Templatized version of GetItemState() to directly return the correct type.
static const T * GetItem(const SfxItemSet *pItemSet, TypedWhichId< T > nWhich, bool bSearchInParent)
const SfxPoolItem * Put(std::unique_ptr< SfxPoolItem > xItem, sal_uInt16 nWhich)
const SfxItemSet * GetParent() const
sal_uInt16 ClearSingleItemImpl(sal_uInt16 nWhich, std::optional< sal_uInt16 > oItemOffsetHint)
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
Delete single Items or all Items (nWhich == 0)
void InvalidateAllItems()
const SfxItemSet * m_pParent
derivation
const SfxItemSet & operator=(const SfxItemSet &)=delete
SfxPoolItem const ** GetItems_Impl() const
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
void MergeValue(const SfxPoolItem &rItem, bool bOverwriteDefaults=false)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
This method eases accessing single Items in the SfxItemSet.
void PutDirect(const SfxPoolItem &rItem)
sal_uInt16 TotalCount() const
SfxItemSet(SfxItemPool &pool, svl::Items_t< WIDs... > wids)
SfxItemState GetItemState(TypedWhichId< T > nWhich, bool bSrchInParent=true, const T **ppItem=nullptr) const
bool HasItem(TypedWhichId< T > nWhich, const T **ppItem=nullptr) const
SfxItemSet CloneAsValue(bool bItems=true, SfxItemPool *pToPool=nullptr) const
note that this only works if you know for sure that you are dealing with an SfxItemSet and not one of...
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SfxItemState GetItemStateImpl(sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem, std::optional< sal_uInt16 > oItemsOffsetHint) const
SfxAllItemSetFlag
special constructor for SfxAllItemSet
void Intersect(const SfxItemSet &rSet)
Only retain the Items that are also present in rSet (nevermind their value).
WhichRangesContainer m_pWhichRanges
array of Which Ranges
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool Set(const SfxItemSet &, bool bDeep=true)
The SfxItemSet takes over exactly those SfxPoolItems that are set in rSet and are in their own Which ...
const T * GetItem(TypedWhichId< T > nWhich, bool bSearchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
Disable Item Using a VoidItem with Which value 0.
void SetRanges(const WhichRangesContainer &)
Modifies the ranges of settable items.
const SfxPoolItem * Put(std::unique_ptr< SfxPoolItem > xItem)
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const
SfxPoolItem const ** m_ppItems
pointer to array of items, we allocate and free this unless m_bItemsFixed==true
const T * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
Templatized version of GetItem() to directly return the correct type.
virtual const SfxPoolItem * PutImpl(const SfxPoolItem &, sal_uInt16 nWhich, bool bPassingOwnership)
SVL_DLLPRIVATE void RecreateRanges_Impl(const WhichRangesContainer &pNewRanges)
const SfxPoolItem * Put(const SfxPoolItem &rItem)
friend class SfxAllItemSet
sal_uInt16 m_nCount
number of items
void Differentiate(const SfxItemSet &rSet)
void MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo)
Expands the ranges of settable items by 'nFrom' to 'nTo'.
bool Equals(const SfxItemSet &, bool bComparePool) const
Compare possibly ignoring SfxItemPool pointer.
void InvalidateItem(sal_uInt16 nWhich)
const T & Get(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Iterates over the which ids and the pool items arrays together (which are stored in parallel arrays).
A very thin wrapper around the sal_uInt16 WhichId whose purpose is mostly to carry type information,...
struct _xmlTextWriter * xmlTextWriterPtr
static constexpr sal_uInt16 CountRanges1()
Determines the number of sal_uInt16s in a container of pairs of sal_uInt16s, each representing a rang...
constexpr std::size_t rangeSize(sal_uInt16 wid1, sal_uInt16 wid2)
SfxItemState
These values have to match the values in the css::frame::status::ItemState IDL to be found at offapi/...
@ SET
The property has been explicitly set to a given value hence we know we are not taking the default val...
Most of the time, the which ranges we point at are a compile-time literal.
constexpr bool operator==(TypedWhichId< T > const &lhs, TypedWhichId< T > rhs)