summaryrefslogtreecommitdiff
path: root/editeng/inc/ItemList.hxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-12-22 20:24:37 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-12-29 07:29:12 +0100
commit985b6c4a7fd00d1859ce3a32ab141d94526e989c (patch)
treef51d7d8aa8e024d0f0cf56c0b676a438fe409873 /editeng/inc/ItemList.hxx
parent27afa3fa1321bc55d6063115c4ad3558d68eb76e (diff)
editeng: ItemList - prefix members, move methods in class
- Move methods into class def. as the class is simple enough. - Prefix member variables. - Remove unneeded includes. Change-Id: Ide567c64dad3606f1a9faf837571ae2a5c3d69ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161352 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'editeng/inc/ItemList.hxx')
-rw-r--r--editeng/inc/ItemList.hxx53
1 files changed, 29 insertions, 24 deletions
diff --git a/editeng/inc/ItemList.hxx b/editeng/inc/ItemList.hxx
index 29c2b0dcddd2..a060fc6e29e7 100644
--- a/editeng/inc/ItemList.hxx
+++ b/editeng/inc/ItemList.hxx
@@ -19,38 +19,43 @@
#pragma once
-#include "editattr.hxx"
-#include "edtspell.hxx"
-#include "eerdll2.hxx"
-#include <editeng/svxfont.hxx>
-#include <editeng/EPaM.hxx>
-#include <svl/itemset.hxx>
-#include <svl/style.hxx>
#include <svl/itempool.hxx>
-#include <svl/languageoptions.hxx>
-#include <tools/lineend.hxx>
-#include <o3tl/typed_flags_set.hxx>
-#include "TextPortion.hxx"
-
-#include <cstddef>
-#include <memory>
-#include <string_view>
#include <vector>
class ItemList
{
private:
- typedef std::vector<const SfxPoolItem*> DummyItemList;
- DummyItemList aItemPool;
- sal_Int32 CurrentItem;
+ std::vector<const SfxPoolItem*> maItemPool;
+ sal_Int32 maCurrentItem = 0;
public:
- ItemList();
- const SfxPoolItem* First();
- const SfxPoolItem* Next();
- sal_Int32 Count() const { return aItemPool.size(); };
- void Insert(const SfxPoolItem* pItem);
- void Clear() { aItemPool.clear(); };
+ ItemList() = default;
+
+ const SfxPoolItem* First()
+ {
+ maCurrentItem = 0;
+ return maItemPool.empty() ? nullptr : maItemPool[0];
+ }
+
+ const SfxPoolItem* Next()
+ {
+ if (maCurrentItem + 1 < sal_Int32(maItemPool.size()))
+ {
+ ++maCurrentItem;
+ return maItemPool[maCurrentItem];
+ }
+ return nullptr;
+ }
+
+ sal_Int32 Count() const { return maItemPool.size(); }
+
+ void Insert(const SfxPoolItem* pItem)
+ {
+ maItemPool.push_back(pItem);
+ maCurrentItem = maItemPool.size() - 1;
+ }
+
+ void Clear() { maItemPool.clear(); }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */