summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2020-06-08 12:43:53 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-06-10 23:53:16 +0200
commit4b3f9c6a06650532df34af6388fa62d659eabd90 (patch)
treee7e5e359fedf59765cb0d6222ee2cec8624dcf4f /sw/source
parentf54c4876f47cae7582f0756a15fe7faf69ba7771 (diff)
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@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96003 Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/text/porlay.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index d9406a4e28c1..2bb9e87bd2c9 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -54,9 +54,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;
@@ -2283,8 +2285,30 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTextNode& rNode, MultiSelect
{
const sw::mark::IMark* pMark = pIndex->GetMark();
const sw::mark::IBookmark* pBookmark = dynamic_cast<const sw::mark::IBookmark*>(pMark);
+
+ 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
const sal_Int32 nSt = pBookmark->GetMarkStart().nContent.GetIndex();