LibreOffice Module svl (master) 1
|
Base class for providers of defaults of SfxPoolItems. More...
#include <itempool.hxx>
Classes | |
struct | Item2Range |
Public Member Functions | |
void | FillItemIdRanges_Impl (WhichRangesContainer &pWhichRanges) const |
const WhichRangesContainer & | GetFrozenIdRanges () const |
SfxItemPool (const SfxItemPool &rPool, bool bCloneStaticDefaults=false) | |
Copy ctor. More... | |
SfxItemPool (const OUString &rName, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxItemInfo *pItemInfos, std::vector< SfxPoolItem * > *pDefaults=nullptr) | |
This is the regular ctor to be used for this class. More... | |
virtual | ~SfxItemPool () |
SfxBroadcaster & | BC () |
void | SetPoolDefaultItem (const SfxPoolItem &) |
const SfxPoolItem * | GetPoolDefaultItem (sal_uInt16 nWhich) const |
template<class T > | |
const T * | GetPoolDefaultItem (TypedWhichId< T > nWhich) const |
void | ResetPoolDefaultItem (sal_uInt16 nWhich) |
Resets the default of the given WhichId back to the static Default. More... | |
void | SetDefaults (std::vector< SfxPoolItem * > *pDefaults) |
void | ClearDefaults () |
void | ReleaseDefaults (bool bDelete=false) |
Frees the static Defaults of the corresponding SfxItemPool instance and deletes them if specified. More... | |
virtual MapUnit | GetMetric (sal_uInt16 nWhich) const |
void | SetDefaultMetric (MapUnit eNewMetric) |
MapUnit | GetDefaultMetric () const |
virtual bool | GetPresentation (const SfxPoolItem &rItem, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const |
Request string representation of pool items. More... | |
virtual rtl::Reference< SfxItemPool > | Clone () const |
const OUString & | GetName () const |
template<class T > | |
const T & | Put (std::unique_ptr< T > xItem, sal_uInt16 nWhich=0) |
template<class T > | |
const T & | Put (const T &rItem, sal_uInt16 nWhich=0) |
void | Remove (const SfxPoolItem &) |
const SfxPoolItem & | GetDefaultItem (sal_uInt16 nWhich) const |
template<class T > | |
const T & | GetDefaultItem (TypedWhichId< T > nWhich) const |
bool | CheckItemInPool (const SfxPoolItem *) const |
const SfxPoolItem * | GetItem2Default (sal_uInt16 nWhich) const |
template<class T > | |
const T * | GetItem2Default (TypedWhichId< T > nWhich) const |
sal_uInt32 | GetItemCount2 (sal_uInt16 nWhich) const |
Item2Range | GetItemSurrogates (sal_uInt16 nWhich) const |
std::vector< const SfxPoolItem * > | FindItemSurrogate (sal_uInt16 nWhich, SfxPoolItem const &rNeedle) const |
sal_uInt16 | GetFirstWhich () const |
sal_uInt16 | GetLastWhich () const |
bool | IsInRange (sal_uInt16 nWhich) const |
void | SetSecondaryPool (SfxItemPool *pPool) |
SfxItemPool * | GetSecondaryPool () const |
SfxItemPool * | GetLastPoolInChain () |
SfxItemPool * | GetMasterPool () const |
void | FreezeIdRanges () |
This method should be called at the master pool, when all secondary pools are appended to it. More... | |
void | Delete () |
bool | IsItemPoolable (sal_uInt16 nWhich) const |
bool | IsItemPoolable (const SfxPoolItem &rItem) const |
void | SetItemInfos (const SfxItemInfo *pInfos) |
sal_uInt16 | GetWhich (sal_uInt16 nSlot, bool bDeep=true) const |
template<class T > | |
TypedWhichId< T > | GetWhich (TypedWhichId< T > nSlot, bool bDeep=true) const |
sal_uInt16 | GetSlotId (sal_uInt16 nWhich) const |
sal_uInt16 | GetTrueWhich (sal_uInt16 nSlot, bool bDeep=true) const |
sal_uInt16 | GetTrueSlotId (sal_uInt16 nWhich) const |
void | dumpAsXml (xmlTextWriterPtr pWriter) const |
Public Member Functions inherited from salhelper::SimpleReferenceObject | |
SimpleReferenceObject () | |
void | acquire () |
void | release () |
Static Public Member Functions | |
static void | ReleaseDefaults (std::vector< SfxPoolItem * > *pDefaults, bool bDelete=false) |
Frees the specified static Defaults and also deletes them, if so specified. More... | |
static bool | IsWhich (sal_uInt16 nId) |
static bool | IsSlot (sal_uInt16 nId) |
Static Public Member Functions inherited from salhelper::SimpleReferenceObject | |
static void * | operator new (std::size_t nSize) |
static void * | operator new (std::size_t nSize, std::nothrow_t const &rNothrow) |
static void | operator delete (void *pPtr) |
static void | operator delete (void *pPtr, std::nothrow_t const &rNothrow) |
Protected Member Functions | |
virtual const SfxPoolItem & | PutImpl (const SfxPoolItem &, sal_uInt16 nWhich=0, bool bPassingOwnership=false) |
Protected Member Functions inherited from salhelper::SimpleReferenceObject | |
virtual | ~SimpleReferenceObject () COVERITY_NOEXCEPT_FALSE |
Static Protected Member Functions | |
static void | ClearRefCount (SfxPoolItem &rItem) |
static void | AddRef (const SfxPoolItem &rItem) |
static sal_uInt32 | ReleaseRef (const SfxPoolItem &rItem, sal_uInt32 n=1) |
Private Member Functions | |
sal_uInt16 | GetIndex_Impl (sal_uInt16 nWhich) const |
sal_uInt16 | GetSize_Impl () const |
SVL_DLLPRIVATE bool | IsItemPoolable_Impl (sal_uInt16 nWhich) const |
const SfxItemPool & | operator= (const SfxItemPool &)=delete |
Private Attributes | |
const SfxItemInfo * | pItemInfos |
std::unique_ptr< SfxItemPool_Impl > | pImpl |
Static Private Attributes | |
static const sal_uInt16 | SFX_WHICH_MAX = 4999 |
Friends | |
struct | SfxItemPool_Impl |
class | SfxItemSet |
class | SfxAllItemSet |
Additional Inherited Members | |
Protected Attributes inherited from salhelper::SimpleReferenceObject | |
oslInterlockedCount | m_nCount |
Base class for providers of defaults of SfxPoolItems.
The derived classes hold the concrete (const) instances which are referenced in several places (usually within a single document). This helps to lower the amount of calls to lifecycle methods, speeds up comparisons within a document and facilitates loading and saving of attributes.
Definition at line 50 of file itempool.hxx.
SfxItemPool::SfxItemPool | ( | const SfxItemPool & | rPool, |
bool | bCloneStaticDefaults = false |
||
) |
Copy ctor.
Definition at line 262 of file itempool.cxx.
References aName, Clone(), mnEnd, mnStart, n, pImpl, PoolDefault, SetDefaults(), SetSecondaryPool(), and StaticDefault.
Referenced by Clone().
SfxItemPool::SfxItemPool | ( | const OUString & | rName, |
sal_uInt16 | nStartWhich, | ||
sal_uInt16 | nEndWhich, | ||
const SfxItemInfo * | pInfo, | ||
std::vector< SfxPoolItem * > * | pDefaults = nullptr |
||
) |
This is the regular ctor to be used for this class.
An SfxItemPool instance is initialized, which can manage Items in the range from 'nStartWhich' to 'nEndWhich'.
For every one of these WhichIds a static Default must be present in the 'pDefaults' array. They start with an SfxPoolItem (with the WhichId 'nStartWhich'), are sorted by WhichId and consecutively stored.
'pItemInfos' is a USHORT array arranged in the same way, which holds SlotIds and Flags. These SlotIds can be 0, if the affected Items are exclusively used in the Core. The flags allow for e.g. enabling value sharing (poolable).
If the Pool is supposed to hold SfxSetItems, the ctor cannot yet contain static Defaults. This needs to be done afterwards, using
Definition at line 218 of file itempool.cxx.
References p, pImpl, pItemInfos, SAL_WARN, and SetDefaults().
|
virtual |
Definition at line 401 of file itempool.cxx.
References DBG_ASSERT, Delete(), and pImpl.
|
inlinestaticprotected |
Definition at line 217 of file itempool.hxx.
References SfxPoolItem::AddRef().
Referenced by PutImpl().
SfxBroadcaster & SfxItemPool::BC | ( | ) |
Definition at line 190 of file itempool.cxx.
References pImpl.
bool SfxItemPool::CheckItemInPool | ( | const SfxPoolItem * | pItem | ) | const |
Definition at line 128 of file itempool.cxx.
References DBG_ASSERT, GetIndex_Impl(), IsInRange(), IsInvalidItem(), IsPoolDefaultItem(), IsStaticDefaultItem(), p, pImpl, SAL_WARN, and SfxPoolItem::Which().
Referenced by SfxItemSet::PutDirect().
void SfxItemPool::ClearDefaults | ( | ) |
Definition at line 327 of file itempool.cxx.
References pImpl.
|
inlinestaticprotected |
Definition at line 211 of file itempool.hxx.
References SfxPoolItem::SetRefCount().
Referenced by Delete().
|
virtual |
void SfxItemPool::Delete | ( | ) |
Definition at line 515 of file itempool.cxx.
References ClearRefCount(), Dying, GetSize_Impl(), n, pImpl, and ReleaseRef().
Referenced by ~SfxItemPool().
void SfxItemPool::dumpAsXml | ( | xmlTextWriterPtr | pWriter | ) | const |
Definition at line 1003 of file itempool.cxx.
References pImpl.
void SfxItemPool::FillItemIdRanges_Impl | ( | WhichRangesContainer & | pWhichRanges | ) | const |
Definition at line 866 of file itempool.cxx.
References DBG_ASSERT, WhichRangesContainer::MergeRange(), pImpl, and WhichRangesContainer::reset().
Referenced by FreezeIdRanges().
std::vector< const SfxPoolItem * > SfxItemPool::FindItemSurrogate | ( | sal_uInt16 | nWhich, |
SfxPoolItem const & | rNeedle | ||
) | const |
Definition at line 911 of file itempool.cxx.
References SfxPoolItemArray_Impl::findSurrogateRange(), GetIndex_Impl(), IsInRange(), and pImpl.
void SfxItemPool::FreezeIdRanges | ( | ) |
This method should be called at the master pool, when all secondary pools are appended to it.
It calculates the ranges of 'which-ids' for fast construction of item-sets, which contains all 'which-ids'.
Definition at line 859 of file itempool.cxx.
References FillItemIdRanges_Impl(), and pImpl.
const SfxPoolItem & SfxItemPool::GetDefaultItem | ( | sal_uInt16 | nWhich | ) | const |
Definition at line 816 of file itempool.cxx.
References DBG_ASSERT, GetIndex_Impl(), IsInRange(), nPos, and pImpl.
Referenced by SfxItemSet::ClearAllItemsImpl(), SfxItemSet::ClearSingleItemImpl(), SfxItemSet::Differentiate(), SfxItemSet::Get(), SfxItemSet::GetItem(), SfxItemSet::Intersect(), MergeItem_Impl(), SfxItemSet::MergeValues(), SfxItemSet::PutExtended(), SfxItemSet::PutImpl(), and PutImpl().
|
inline |
Definition at line 145 of file itempool.hxx.
MapUnit SfxItemPool::GetDefaultMetric | ( | ) | const |
Definition at line 485 of file itempool.cxx.
References pImpl.
sal_uInt16 SfxItemPool::GetFirstWhich | ( | ) | const |
const WhichRangesContainer & SfxItemPool::GetFrozenIdRanges | ( | ) | const |
Definition at line 877 of file itempool.cxx.
References pImpl.
|
private |
Definition at line 112 of file itempool.cxx.
References mnStart, and pImpl.
Referenced by CheckItemInPool(), FindItemSurrogate(), GetDefaultItem(), GetItem2Default(), GetItemCount2(), GetItemSurrogates(), GetPoolDefaultItem(), PutImpl(), Remove(), ResetPoolDefaultItem(), and SetPoolDefaultItem().
const SfxPoolItem * SfxItemPool::GetItem2Default | ( | sal_uInt16 | nWhich | ) | const |
Definition at line 882 of file itempool.cxx.
References GetIndex_Impl(), IsInRange(), and pImpl.
|
inline |
Definition at line 158 of file itempool.hxx.
sal_uInt32 SfxItemPool::GetItemCount2 | ( | sal_uInt16 | nWhich | ) | const |
Definition at line 925 of file itempool.cxx.
References GetIndex_Impl(), IsInRange(), pImpl, and SfxPoolItemArray_Impl::size().
SfxItemPool::Item2Range SfxItemPool::GetItemSurrogates | ( | sal_uInt16 | nWhich | ) | const |
Definition at line 894 of file itempool.cxx.
References SfxPoolItemArray_Impl::begin(), EMPTY, SfxPoolItemArray_Impl::end(), GetIndex_Impl(), IsInRange(), and pImpl.
SfxItemPool * SfxItemPool::GetLastPoolInChain | ( | ) |
Definition at line 839 of file itempool.cxx.
References GetSecondaryPool().
sal_uInt16 SfxItemPool::GetLastWhich | ( | ) | const |
SfxItemPool * SfxItemPool::GetMasterPool | ( | ) | const |
|
virtual |
const OUString & SfxItemPool::GetName | ( | ) | const |
const SfxPoolItem * SfxItemPool::GetPoolDefaultItem | ( | sal_uInt16 | nWhich | ) | const |
Definition at line 156 of file itempool.cxx.
References GetIndex_Impl(), IsInRange(), and pImpl.
|
inline |
Definition at line 91 of file itempool.hxx.
|
virtual |
Request string representation of pool items.
This virtual function produces a string representation from the respective SfxItemPool subclass' known SfxPoolItems.
Subclasses, please override this method, and handle SfxPoolItems that don't return useful/complete information on SfxPoolItem::GetPresentation()
This baseclass yields the unmodified string representation of rItem.
[in] | rItem | SfxPoolItem to query the string representation of |
[in] | ePresent | requested kind of representation - see SfxItemPresentation |
[in] | eMetric | requested unit of measure of the representation |
[out] | rText | string representation of 'rItem' |
Definition at line 496 of file itempool.cxx.
References Complete, GetMetric(), SfxPoolItem::GetPresentation(), and SfxPoolItem::Which().
Referenced by SfxStyleSheetBase::GetDescription().
SfxItemPool * SfxItemPool::GetSecondaryPool | ( | ) | const |
|
private |
sal_uInt16 SfxItemPool::GetSlotId | ( | sal_uInt16 | nWhich | ) | const |
Definition at line 955 of file itempool.cxx.
References SfxItemInfo::_nSID, IsInRange(), IsWhich(), pImpl, and pItemInfos.
sal_uInt16 SfxItemPool::GetTrueSlotId | ( | sal_uInt16 | nWhich | ) | const |
Definition at line 988 of file itempool.cxx.
References SfxItemInfo::_nSID, IsInRange(), IsWhich(), pImpl, and pItemInfos.
sal_uInt16 SfxItemPool::GetTrueWhich | ( | sal_uInt16 | nSlot, |
bool | bDeep = true |
||
) | const |
Definition at line 973 of file itempool.cxx.
References IsSlot(), nCount, pImpl, and pItemInfos.
sal_uInt16 SfxItemPool::GetWhich | ( | sal_uInt16 | nSlot, |
bool | bDeep = true |
||
) | const |
Definition at line 940 of file itempool.cxx.
References IsSlot(), nCount, pImpl, and pItemInfos.
Referenced by SfxItemSet::GetItem().
|
inline |
Definition at line 188 of file itempool.hxx.
References GetWhich.
bool SfxItemPool::IsInRange | ( | sal_uInt16 | nWhich | ) | const |
Definition at line 107 of file itempool.cxx.
References pImpl.
Referenced by CheckItemInPool(), FindItemSurrogate(), GetDefaultItem(), GetItem2Default(), GetItemCount2(), GetItemSurrogates(), GetPoolDefaultItem(), GetSlotId(), GetTrueSlotId(), PutImpl(), Remove(), ResetPoolDefaultItem(), and SetPoolDefaultItem().
|
inline |
Definition at line 183 of file itempool.hxx.
References SfxPoolItem::Which().
bool SfxItemPool::IsItemPoolable | ( | sal_uInt16 | nWhich | ) | const |
Definition at line 178 of file itempool.cxx.
References DBG_ASSERT, IsWhich(), and pImpl.
Referenced by SfxItemSet::Equals(), StylePoolImpl::insertItemSet(), SfxItemSet::PutImpl(), PutImpl(), and SfxItemSet::SfxItemSet().
|
private |
Definition at line 172 of file itempool.cxx.
References SfxItemInfo::_bPoolable, nPos, and pItemInfos.
Referenced by PutImpl().
|
inlinestatic |
Definition at line 196 of file itempool.hxx.
References nId.
Referenced by GetTrueWhich(), GetWhich(), PutImpl(), and Remove().
|
inlinestatic |
Definition at line 194 of file itempool.hxx.
References nId.
Referenced by SfxItemSet::ClearAllItemsImpl(), SfxItemSet::ClearSingleItemImpl(), SfxItemSet::Differentiate(), SfxItemSet::GetItem(), GetSlotId(), GetTrueSlotId(), SfxItemSet::Intersect(), IsItemPoolable(), and SfxItemSet::PutImpl().
|
privatedelete |
|
inline |
Definition at line 140 of file itempool.hxx.
References SfxAllItemSet::PutImpl().
|
inline |
Definition at line 138 of file itempool.hxx.
References SfxAllItemSet::PutImpl().
Referenced by SfxItemPoolCache::ApplyTo(), MergeItem_Impl(), SfxItemSet::PutDirect(), and SfxItemSet::SfxItemSet().
|
protectedvirtual |
Definition at line 635 of file itempool.cxx.
References AddRef(), SfxPoolItemArray_Impl::begin(), SfxPoolItem::Clone(), DeleteOnIdle, SfxPoolItemArray_Impl::end(), SfxPoolItemArray_Impl::find(), SfxPoolItemArray_Impl::findByLessThan(), GetDefaultItem(), GetIndex_Impl(), SfxPoolItem::GetKind(), SfxPoolItem::HasLookup(), SfxPoolItemArray_Impl::insert(), IsDefaultItem(), IsInRange(), IsItemPoolable(), IsItemPoolable_Impl(), IsPooledItem(), IsSlot(), SfxPoolItem::IsSortable(), SfxPoolItem::Lookup(), nIndex, pImpl, SfxPoolItem::SetWhich(), and SfxPoolItem::Which().
Referenced by SfxItemSet::PutImpl().
void SfxItemPool::ReleaseDefaults | ( | bool | bDelete = false | ) |
Frees the static Defaults of the corresponding SfxItemPool instance and deletes them if specified.
The SfxItemPool instance MUST NOT BE USED after this function has been called; only the dtor must be called.
Definition at line 339 of file itempool.cxx.
References DBG_ASSERT, pImpl, and ReleaseDefaults().
Referenced by ReleaseDefaults().
|
static |
Frees the specified static Defaults and also deletes them, if so specified.
This method MUST be called AFTER all SfxItemPool instances (which use the specified static Defaults 'pDefault') have been destroyed.
Definition at line 366 of file itempool.cxx.
References DBG_ASSERT, and IsStaticDefaultItem().
|
inlinestaticprotected |
Definition at line 223 of file itempool.hxx.
References n, and SfxPoolItem::ReleaseRef().
void SfxItemPool::Remove | ( | const SfxPoolItem & | rItem | ) |
Definition at line 751 of file itempool.cxx.
References SfxPoolItemArray_Impl::end(), SfxPoolItemArray_Impl::erase(), SfxPoolItemArray_Impl::find(), GetIndex_Impl(), SfxPoolItem::GetRefCount(), IsDefaultItem(), IsInRange(), IsPoolDefaultItem(), IsSlot(), IsStaticDefaultItem(), nIndex, pImpl, ReleaseRef(), and SfxPoolItem::Which().
Referenced by SfxItemSet::ClearAllItemsImpl(), SfxItemSet::ClearSingleItemImpl(), SfxItemSet::Differentiate(), SfxItemSet::Intersect(), SfxItemSet::InvalidateItem(), MergeItem_Impl(), SfxItemSet::PutDirect(), SfxItemSet::PutImpl(), SfxItemSet::RecreateRanges_Impl(), SfxItemPoolCache::~SfxItemPoolCache(), and SfxItemSet::~SfxItemSet().
void SfxItemPool::ResetPoolDefaultItem | ( | sal_uInt16 | nWhichId | ) |
Resets the default of the given WhichId back to the static Default.
If a pool default exists, it is removed.
Definition at line 613 of file itempool.cxx.
References GetIndex_Impl(), IsInRange(), and pImpl.
void SfxItemPool::SetDefaultMetric | ( | MapUnit | eNewMetric | ) |
Definition at line 479 of file itempool.cxx.
References pImpl.
void SfxItemPool::SetDefaults | ( | std::vector< SfxPoolItem * > * | pDefaults | ) |
if ((*mpStaticDefaults)->GetKind() != SfxItemKind::StaticDefault) FIXME: Probably doesn't work with SetItems at the end
Definition at line 305 of file itempool.cxx.
References DBG_ASSERT, IsDefaultItem(), n, pImpl, and StaticDefault.
Referenced by SfxItemPool().
void SfxItemPool::SetItemInfos | ( | const SfxItemInfo * | pInfos | ) |
Definition at line 466 of file itempool.cxx.
References CHECK_SLOTS, and pItemInfos.
void SfxItemPool::SetPoolDefaultItem | ( | const SfxPoolItem & | rItem | ) |
Definition at line 585 of file itempool.cxx.
References SfxPoolItem::Clone(), GetIndex_Impl(), IsInRange(), pImpl, PoolDefault, SfxPoolItem::SetKind(), and SfxPoolItem::Which().
void SfxItemPool::SetSecondaryPool | ( | SfxItemPool * | pPool | ) |
Definition at line 418 of file itempool.cxx.
References CHECK_SLOTS, DBG_ASSERT, GetMasterPool(), i, p, pImpl, and SAL_WARN.
Referenced by SfxItemPool().
|
friend |
Definition at line 54 of file itempool.hxx.
|
friend |
Definition at line 52 of file itempool.hxx.
|
friend |
Definition at line 53 of file itempool.hxx.
|
private |
Definition at line 57 of file itempool.hxx.
Referenced by BC(), CheckItemInPool(), ClearDefaults(), Delete(), dumpAsXml(), FillItemIdRanges_Impl(), FindItemSurrogate(), FreezeIdRanges(), GetDefaultItem(), GetDefaultMetric(), GetFirstWhich(), GetFrozenIdRanges(), SfxItemPool_Impl::GetImpl(), GetIndex_Impl(), GetItem2Default(), GetItemCount2(), GetItemSurrogates(), GetLastWhich(), GetMasterPool(), GetMetric(), GetName(), GetPoolDefaultItem(), GetSecondaryPool(), GetSize_Impl(), GetSlotId(), GetTrueSlotId(), GetTrueWhich(), GetWhich(), IsInRange(), IsItemPoolable(), PutImpl(), ReleaseDefaults(), Remove(), ResetPoolDefaultItem(), SetDefaultMetric(), SetDefaults(), SetPoolDefaultItem(), SetSecondaryPool(), SfxItemPool(), and ~SfxItemPool().
|
private |
Definition at line 56 of file itempool.hxx.
Referenced by GetSlotId(), GetTrueSlotId(), GetTrueWhich(), GetWhich(), IsItemPoolable_Impl(), SetItemInfos(), and SfxItemPool().
|
staticprivate |
Definition at line 207 of file itempool.hxx.