From 7a586a9c6bf28088c72f163d724d1cb3259e7920 Mon Sep 17 00:00:00 2001 From: Bernhard Widl Date: Wed, 15 Nov 2017 19:30:28 +0100 Subject: tdf#101856 create bookmarks w/ new hidden/cond attrs, save as odt Committer's note: this is forward ported from 5.2+backports branch, with numerous conflicts. tdf#101856 add new checkbox/editfield for hidden/condition attrs Conflicts: sw/uiconfig/swriter/ui/insertbookmark.ui Author: Bernhard Widl (cherry picked from commit c347e00821791377731ab32acd103ea006f3cc1b) tdf#101856 Fix crash in Insert Bookmark dialog Author: Serge Krot Reviewed-on: https://gerrit.libreoffice.org/50616 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens (cherry picked from commit bcc16920eec647f2a3753d60c4d969862f272942) Change-Id: Ib1df7a4c1477693aa2d0ec067635cdcbd393cebd Reviewed-on: https://gerrit.libreoffice.org/46820 Tested-by: Jenkins Reviewed-by: Michael Stahl --- xmloff/source/text/txtparae.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'xmloff/source/text') diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 36c161abc79c..099a7385c1cf 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2495,6 +2495,30 @@ void XMLTextParagraphExport::exportTextMark( GetExport().AddAttributesRDFa(xTextContent); } + // bookmark-start: add attributes hidden and condition + if (nElement == 1) + { + Reference bkmkProps(rPropSet->getPropertyValue(rProperty), UNO_QUERY); + Reference bkmkPropInfo(bkmkProps->getPropertySetInfo(), UNO_QUERY); + OUString sHidden("BookmarkHidden"); + if (bkmkPropInfo->hasPropertyByName(sHidden)) + { + bool bHidden = false; + bkmkProps->getPropertyValue(sHidden) >>= bHidden; + if (bHidden) + { + GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "hidden", "true"); + OUString sCondition("BookmarkCondition"); + if (bkmkPropInfo->hasPropertyByName(sCondition)) + { + OUString sBookmarkCondition; + bkmkProps->getPropertyValue(sCondition) >>= sBookmarkCondition; + GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "condition", sBookmarkCondition); + } + } + } + } + // export element assert(pElements != nullptr); assert(0 <= nElement && nElement <= 2); -- cgit