diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/svl/itemiter.hxx | 32 | ||||
-rw-r--r-- | include/svl/itemset.hxx | 10 |
2 files changed, 25 insertions, 17 deletions
diff --git a/include/svl/itemiter.hxx b/include/svl/itemiter.hxx index b68730f245d6..30b6bd13d00d 100644 --- a/include/svl/itemiter.hxx +++ b/include/svl/itemiter.hxx @@ -21,7 +21,6 @@ #include <svl/svldllapi.h> #include <svl/itemset.hxx> -#include <vector> class SfxPoolItem; class SfxItemSet; @@ -29,23 +28,32 @@ class SfxItemPool; class SVL_DLLPUBLIC SfxItemIter { - const SfxItemSet& m_rSet; - std::vector<sal_uInt16> m_keys; - std::vector<sal_uInt16>::const_iterator m_iter; + const SfxItemSet& m_rSet; + sal_uInt16 m_nStart; + sal_uInt16 m_nEnd; + sal_uInt16 m_nCurrent; public: SfxItemIter( const SfxItemSet& rSet ); ~SfxItemIter(); /// get item, or null if no items - SfxPoolItem const * FirstItem(); - SfxPoolItem const * GetCurItem(); - SfxPoolItem const * NextItem(); - - bool IsAtEnd() const; - sal_uInt16 GetCurWhich() const { return *m_iter; } - sal_uInt16 GetFirstWhich() const { return *m_keys.begin(); } - sal_uInt16 GetLastWhich() const { return *m_keys.rbegin(); } + const SfxPoolItem* FirstItem() + { + m_nCurrent = m_nStart; + return m_rSet.m_nCount ? *(m_rSet.m_pItems + m_nCurrent) : nullptr; + } + const SfxPoolItem* GetCurItem() + { + return m_rSet.m_nCount ? *(m_rSet.m_pItems + m_nCurrent) : nullptr; + } + const SfxPoolItem* NextItem(); + + bool IsAtEnd() const { return m_nCurrent == m_nEnd; } + + sal_uInt16 GetCurPos() const { return m_nCurrent; } + sal_uInt16 GetFirstPos() const { return m_nStart; } + sal_uInt16 GetLastPos() const { return m_nEnd; } }; #endif diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index 8c1ebd5b8109..dccebd2b23b3 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -23,13 +23,12 @@ #include <cstdarg> #include <svl/poolitem.hxx> -#include <map> class SfxItemPool; class SfxPoolItem; class SvStream; -typedef std::map<sal_uInt16, SfxPoolItem const *> SfxItemMap; +typedef SfxPoolItem const** SfxItemArray; class SAL_WARN_UNUSED SVL_DLLPUBLIC SfxItemSet { @@ -37,8 +36,9 @@ class SAL_WARN_UNUSED SVL_DLLPUBLIC SfxItemSet SfxItemPool* m_pPool; ///< pool that stores the items const SfxItemSet* m_pParent; ///< derivation - SfxItemMap m_aItems; ///< array of items + SfxItemArray m_pItems; ///< array of items sal_uInt16* m_pWhichRanges; ///< array of Which Ranges + sal_uInt16 m_nCount; ///< number of items friend class SfxItemPoolCache; friend class SfxAllItemSet; @@ -50,7 +50,7 @@ private: SVL_DLLPRIVATE void InitRanges_Impl(sal_uInt16 nWh1, sal_uInt16 nWh2); public: - SfxItemMap const & GetItems_Impl() const { return m_aItems; } + SfxItemArray GetItems_Impl() const { return m_pItems; } private: const SfxItemSet& operator=(const SfxItemSet &) = delete; @@ -73,7 +73,7 @@ public: virtual SfxItemSet * Clone(bool bItems = true, SfxItemPool *pToPool = nullptr) const; // Get number of items - sal_uInt16 Count() const { return m_aItems.size(); } + sal_uInt16 Count() const { return m_nCount; } sal_uInt16 TotalCount() const; const SfxPoolItem& Get( sal_uInt16 nWhich, bool bSrchInParent = true ) const; |