editeng/inc/ItemList.hxx | 53 ++++++++++++++++++++----------------- editeng/source/editeng/editdoc.cxx | 28 ------------------- 2 files changed, 29 insertions(+), 52 deletions(-)
New commits: commit 985b6c4a7fd00d1859ce3a32ab141d94526e989c Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Dec 22 20:24:37 2023 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Fri Dec 29 07:29:12 2023 +0100 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 <qui...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> 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()),