editeng/inc/ParagraphPortionList.hxx |   14 +++++++++++++-
 editeng/source/editeng/impedit3.cxx  |    3 +--
 2 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit e7e7449729fe2b750506b4b165c4be993834fd16
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Jan 1 14:34:04 2024 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Jan 2 04:12:51 2024 +0100

    editeng: add begin, end, MarkAllSelectionsInvalid to ParaPortionList
    
    begin, end to make iteration work with range for
    
    Change-Id: Ia64d4f8102485b257e190fc702e4aa734a81d866
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161530
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/editeng/inc/ParagraphPortionList.hxx 
b/editeng/inc/ParagraphPortionList.hxx
index 23654adc5e43..aa7862afa8d7 100644
--- a/editeng/inc/ParagraphPortionList.hxx
+++ b/editeng/inc/ParagraphPortionList.hxx
@@ -28,7 +28,8 @@ class EditDoc;
 class ParaPortionList
 {
     mutable sal_Int32 nLastCache = 0;
-    std::vector<std::unique_ptr<ParaPortion>> maPortions;
+    typedef std::vector<std::unique_ptr<ParaPortion>> ParaPortionContainerType;
+    ParaPortionContainerType maPortions;
 
 public:
     ParaPortionList() = default;
@@ -50,6 +51,17 @@ public:
     void Append(std::unique_ptr<ParaPortion> p);
     sal_Int32 Count() const;
 
+    ParaPortionContainerType::iterator begin() { return maPortions.begin(); }
+    ParaPortionContainerType::iterator end() { return maPortions.end(); }
+    ParaPortionContainerType::const_iterator cbegin() const { return 
maPortions.cbegin(); }
+    ParaPortionContainerType::const_iterator cend() const { return 
maPortions.cend(); }
+
+    void MarkAllSelectionsInvalid(sal_Int32 nStart)
+    {
+        for (auto& pParaPortion : maPortions)
+            pParaPortion->MarkSelectionInvalid(nStart);
+    }
+
 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
     // temporary:
     static void DbgCheck(ParaPortionList const&, EditDoc const& rDoc);
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index a4e0a54aaa0d..d50c2eb1338e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -393,8 +393,7 @@ bool ImpEditEngine::IsPageOverflow( ) const
 
 void ImpEditEngine::FormatFullDoc()
 {
-    for ( sal_Int32 nPortion = 0; nPortion < GetParaPortions().Count(); 
nPortion++ )
-        GetParaPortions()[nPortion]->MarkSelectionInvalid( 0 );
+    GetParaPortions().MarkAllSelectionsInvalid(0);
     FormatDoc();
 }
 

Reply via email to