diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-12-22 20:24:37 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-12-29 07:29:12 +0100 |
commit | 985b6c4a7fd00d1859ce3a32ab141d94526e989c (patch) | |
tree | f51d7d8aa8e024d0f0cf56c0b676a438fe409873 /editeng | |
parent | 27afa3fa1321bc55d6063115c4ad3558d68eb76e (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')
-rw-r--r-- | editeng/inc/ItemList.hxx | 53 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 28 |
2 files changed, 29 insertions, 52 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: */ diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 0856a594f7ae..b28773e71977 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1862,34 +1862,6 @@ void ContentAttribs::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } - -ItemList::ItemList() : CurrentItem( 0 ) -{ -} - -const SfxPoolItem* ItemList::First() -{ - CurrentItem = 0; - return aItemPool.empty() ? nullptr : aItemPool[ 0 ]; -} - -const SfxPoolItem* ItemList::Next() -{ - if ( CurrentItem + 1 < static_cast<sal_Int32>(aItemPool.size()) ) - { - ++CurrentItem; - return aItemPool[ CurrentItem ]; - } - return nullptr; -} - -void ItemList::Insert( const SfxPoolItem* pItem ) -{ - aItemPool.push_back( pItem ); - CurrentItem = aItemPool.size() - 1; -} - - EditDoc::EditDoc( SfxItemPool* pPool ) : nLastCache(0), pItemPool(pPool ? pPool : new EditEngineItemPool()), |