[Libreoffice-commits] core.git: sw/source

Serge Krot (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 9 14:36:52 UTC 2020


 sw/source/core/text/porlay.cxx |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit dadba793c107cbf2ccadfbd7b41b6187ff06d4b8
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Mon Jun 8 12:43:53 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Jun 9 16:36:14 2020 +0200

    tdf#101856 evaluate condition to expand / collapse bookmarks
    
    Change-Id: I7c135eab0feeca0ede794f6c88a2b06e339d6a14
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95795
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 499dac050009..b9ed4ec5a393 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -48,9 +48,11 @@
 #include <doc.hxx>
 #include <swscanner.hxx>
 #include <txatbase.hxx>
+#include <calc.hxx>
 #include <IDocumentRedlineAccess.hxx>
 #include <IDocumentSettingAccess.hxx>
 #include <IDocumentContentOperations.hxx>
+#include <IDocumentFieldsAccess.hxx>
 #include <IMark.hxx>
 
 using namespace ::com::sun::star;
@@ -2515,7 +2517,29 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTextNode& rNode,
                 pBookmarks->emplace_back(pBookmark, MarkKind::End);
             }
         }
+
+        bool bHide = false;
         if (pBookmark && pBookmark->IsHidden())
+        {
+            // bookmark is marked as hidden
+            bHide = true;
+
+            // bookmark is marked as hidden with conditions
+            if (!pBookmark->GetHideCondition().isEmpty())
+            {
+                SwDoc& rDoc = *const_cast<SwDoc*>(rNode.GetDoc());
+                SwCalc aCalc(rDoc);
+                rDoc.getIDocumentFieldsAccess().FieldsToCalc(aCalc, rNode.GetIndex(), USHRT_MAX);
+
+                SwSbxValue aValue = aCalc.Calculate(pBookmark->GetHideCondition());
+                if(!aValue.IsVoidValue())
+                {
+                    bHide = aValue.GetBool();
+                }
+            }
+        }
+
+        if (bHide)
         {
             // intersect bookmark range with textnode range and add the intersection to rHiddenMulti
 


More information about the Libreoffice-commits mailing list