sw/source/core/text/porlay.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
New commits: commit 60c58d5b8df00815c238c6a95978a0517751efd4 Author: Serge Krot <serge.k...@cib.de> AuthorDate: Mon Jun 8 12:43:53 2020 +0200 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Wed Jun 10 23:49:52 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.behr...@cib.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96015 Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index d7dc2f10838d..92184de27fd4 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -51,9 +51,11 @@ #include <section.hxx> #include <calbck.hxx> #include <doc.hxx> +#include <calc.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentContentOperations.hxx> +#include <IDocumentFieldsAccess.hxx> #include <IMark.hxx> using namespace ::com::sun::star; @@ -2270,7 +2272,29 @@ 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits