sw/inc/doc.hxx             |    2 +-
 sw/source/core/doc/doc.cxx |   19 ++++++++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit a32c551d75fadfdfcbf4299320b88264123d6805
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Sep 21 16:15:40 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Sep 24 16:52:26 2024 +0200

    fixes for "dont use GetItemSurrogates for gathering SvxTabStopItem"
    
    improvements to commit 01ab23b13297c9d7b091dfbe2850cd343fcd3e0e,
    thanks to vmiklos for review
    
    Change-Id: I2d4c5fb07405988b56156370db2e73ba0a24fa36
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173763
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 6e037f3878c9..776120717e73 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1463,7 +1463,7 @@ public:
     SW_DLLPUBLIC void ForEachTxtAtrContainerItem(const 
std::function<bool(const SvXMLAttrContainerItem&)>&  ) const;
 
     /// Iterate over all RES_PARATR_TABSTOP SvxTabStopItem, if the function 
returns false, iteration is stopped
-    SW_DLLPUBLIC void ForEachParaAtrTabStopItem(const std::function<bool(const 
SvxTabStopItem&)>&  ) const;
+    SW_DLLPUBLIC void ForEachParaAtrTabStopItem(const std::function<bool(const 
SvxTabStopItem&)>&  );
 
     /// Iterate over all RES_UNKNOWNATR_CONTAINER SvXMLAttrContainerItem, if 
the function returns false, iteration is stopped
     SW_DLLPUBLIC void ForEachUnknownAtrContainerItem(const 
std::function<bool(const SvXMLAttrContainerItem&)>&  ) const;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index f9ab83b6522f..2724ccb0fb7c 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1566,10 +1566,23 @@ void 
SwDoc::ForEachCharacterFontItem(TypedWhichId<SvxFontItem> nWhich, bool bIgn
     }
 }
 
-/// Iterate over all RES_PARATR_TABSTOP SvXMLAttrContainerItem, if the 
function returns false, iteration is stopped
-void SwDoc::ForEachParaAtrTabStopItem(const std::function<bool(const 
SvxTabStopItem&)>& rFunc ) const
+/// Iterate over all RES_PARATR_TABSTOP SvxTabStopItem, if the function 
returns false, iteration is stopped
+void SwDoc::ForEachParaAtrTabStopItem(const std::function<bool(const 
SvxTabStopItem&)>& rFunc )
 {
-    for(SwCharFormat* pFormat : *GetCharFormats())
+    SwNodeOffset nCount = GetNodes().Count();
+    for (SwNodeOffset i(0); i < nCount; ++i)
+    {
+        const SwNode* pNode = GetNodes()[i];
+        if (pNode->IsContentNode())
+        {
+            const SwContentNode* pTextNode = pNode->GetContentNode();
+            if (pTextNode->HasSwAttrSet())
+                if (const SvxTabStopItem* pItem = 
pTextNode->GetSwAttrSet().GetItemIfSet(RES_PARATR_TABSTOP))
+                    if (!rFunc(*pItem))
+                        return;
+        }
+    }
+    for(const SwTextFormatColl* pFormat : *GetTextFormatColls())
     {
         const SwAttrSet& rAttrSet = pFormat->GetAttrSet();
         if (const SvxTabStopItem* pItem = 
rAttrSet.GetItemIfSet(RES_PARATR_TABSTOP))

Reply via email to