summaryrefslogtreecommitdiff
path: root/include/svl
diff options
context:
space:
mode:
Diffstat (limited to 'include/svl')
-rw-r--r--include/svl/itemiter.hxx32
-rw-r--r--include/svl/itemset.hxx10
2 files changed, 17 insertions, 25 deletions
diff --git a/include/svl/itemiter.hxx b/include/svl/itemiter.hxx
index 30b6bd13d00d..b68730f245d6 100644
--- a/include/svl/itemiter.hxx
+++ b/include/svl/itemiter.hxx
@@ -21,6 +21,7 @@
#include <svl/svldllapi.h>
#include <svl/itemset.hxx>
+#include <vector>
class SfxPoolItem;
class SfxItemSet;
@@ -28,32 +29,23 @@ class SfxItemPool;
class SVL_DLLPUBLIC SfxItemIter
{
- const SfxItemSet& m_rSet;
- sal_uInt16 m_nStart;
- sal_uInt16 m_nEnd;
- sal_uInt16 m_nCurrent;
+ const SfxItemSet& m_rSet;
+ std::vector<sal_uInt16> m_keys;
+ std::vector<sal_uInt16>::const_iterator m_iter;
public:
SfxItemIter( const SfxItemSet& rSet );
~SfxItemIter();
/// get item, or null if no items
- 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; }
+ 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(); }
};
#endif
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
index f327f92792eb..502c0ebc2c99 100644
--- a/include/svl/itemset.hxx
+++ b/include/svl/itemset.hxx
@@ -23,12 +23,13 @@
#include <cstdarg>
#include <svl/poolitem.hxx>
+#include <map>
class SfxItemPool;
class SfxPoolItem;
class SvStream;
-typedef SfxPoolItem const** SfxItemArray;
+typedef std::map<sal_uInt16, SfxPoolItem const *> SfxItemMap;
class SVL_DLLPUBLIC SfxItemSet
{
@@ -36,9 +37,8 @@ class SVL_DLLPUBLIC SfxItemSet
SfxItemPool* m_pPool; ///< pool that stores the items
const SfxItemSet* m_pParent; ///< derivation
- SfxItemArray m_pItems; ///< array of items
+ SfxItemMap m_aItems; ///< 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:
- SfxItemArray GetItems_Impl() const { return m_pItems; }
+ SfxItemMap const & GetItems_Impl() const { return m_aItems; }
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_nCount; }
+ sal_uInt16 Count() const { return m_aItems.size(); }
sal_uInt16 TotalCount() const;
const SfxPoolItem& Get( sal_uInt16 nWhich, bool bSrchInParent = true ) const;