/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ #pragma once
SfxItemPool* m_pPool; ///< pool that stores the items const SfxItemSet* m_pParent; ///< derivation
sal_uInt16 m_nRegister; ///< number of items with NeedsSurrogateSupport
virtual std::unique_ptr<SfxItemSet> Clone(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 it's subclasses. */
SfxItemSet CloneAsValue(bool bItems = true, SfxItemPool *pToPool = nullptr) const;
// Get number of items
sal_uInt16 Count() const { return m_aPoolItemMap.size(); }
sal_uInt16 TotalCount() const { return m_aWhichRanges.TotalCount(); }
/** This method eases accessing single Items in the SfxItemSet.
@param nId SlotId or the Item's WhichId @param bSearchInParent also search in parent ItemSets @returns 0 if the ItemSet does not contain an Item with the Id 'nWhich'
*/ const SfxPoolItem* GetItem(sal_uInt16 nWhich, bool bSearchInParent = true) const;
/// Templatized version of GetItem() to directly return the correct type. template<class T> const T* GetItem(sal_uInt16 nWhich, bool bSearchInParent = true) const
{ const SfxPoolItem* pItem = GetItem(nWhich, bSearchInParent); const T* pCastedItem = dynamic_cast<const T*>(pItem);
assert(!pItem || pCastedItem); // if it exists, must have the correct type return pCastedItem;
} template<class T> const T* GetItem( TypedWhichId<T> nWhich, bool bSearchInParent = true ) const
{ return GetItem<T>(sal_uInt16(nWhich), bSearchInParent);
}
/// Templatized static version of GetItem() to directly return the correct type if the SfxItemSet is available. template<class T> staticconst T* GetItem(const SfxItemSet* pItemSet, sal_uInt16 nWhich, bool bSearchInParent)
{ if (pItemSet) return pItemSet->GetItem<T>(nWhich, bSearchInParent);
This can be used to compare the content of two SfxItemSet even if they don't share the same pool. EditTextObject::Equals(...,false) uses this which is needed in ScGlobal::EETextObjEqual() for ScPageHFItem::operator==()
@param bComparePool if <FALSE/> ignore SfxItemPool pointer, if <TRUE/> compare also SfxItemPool pointer (identical to operator==())
*/ bool Equals(const SfxItemSet &, bool bComparePool) const;
void dumpAsXml(xmlTextWriterPtr pWriter) const;
private: // split version(s) of ClearSingleItemImpl for input type WhichID
sal_uInt16 ClearSingleItem_ForWhichID( sal_uInt16 nWhich ); void ClearSingleItem_PrepareRemove(const SfxPoolItem* pItem);
// cleanup all Items, but do not reset/change m_ppItems array. That is // responsibility of the caller & allows specific resets
sal_uInt16 ClearAllItemsImpl();
// Merge two given Item(entries) void MergeItem_Impl(sal_uInt16 nWhich, const SfxPoolItem *pFnd2, bool bIgnoreDefaults);
// InvalidateItem/DisableItem for input types WhichID and Offset void DisableOrInvalidateItem_ForWhichID(bool bDsiable, sal_uInt16 nWhich);
// GetItemStateImpl for input type WhichID
SfxItemState GetItemState_ForWhichID( SfxItemState eState, sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem) const;
// GetItemStateImpl for iterator in m_aPoolItemMap static SfxItemState GetItemState_ForIter(PoolItemMap::const_iterator aHit, const SfxPoolItem **ppItem);
};
// Handles all Ranges. Ranges are automatically modified by putting items. class SVL_DLLPUBLIC SfxAllItemSet final : public SfxItemSet
{ public:
SfxAllItemSet( SfxItemPool &rPool );
SfxAllItemSet( const SfxItemSet & );
SfxAllItemSet( const SfxAllItemSet & );
// Was: Allocate the items array inside the object, to reduce allocation cost. // NOTE: No longer needed with unordered_set, but there are 560+ places to // replace/adapt, so keep it for now. // To adapt, there is the static makeFixedSfxItemSet member in SfxItemSet. Did // that in one place to check functionality (easy hack...?) template<sal_uInt16... WIDs> class SfxItemSetFixed final : public SfxItemSet
{ public:
SfxItemSetFixed( SfxItemPool& rPool)
: SfxItemSet(rPool, WhichRangesContainer(svl::Items_t<WIDs...>{})){}//,
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.