[Libreoffice-commits] core.git: include/xmloff xmloff/source

Serge Krot Serge.Krot at cib.de
Fri Jul 6 08:22:52 UTC 2018


 include/xmloff/txtimp.hxx                       |    5 +++++
 include/xmloff/txtparae.hxx                     |    2 ++
 xmloff/source/text/XMLTextMarkImportContext.cxx |   13 +++++++++++++
 xmloff/source/text/txtimp.cxx                   |   20 ++++++++++++++++++++
 xmloff/source/text/txtparae.cxx                 |    2 ++
 5 files changed, 42 insertions(+)

New commits:
commit 412b1f8d2b03687a13784e3055c5b0f2507dfef2
Author: Serge Krot <Serge.Krot at cib.de>
Date:   Thu Mar 1 13:00:33 2018 +0100

    tdf#101856 Backport parsing of bookmark properties
    
    Change-Id: I7654aa93d4d86a5d36201832ac3609b9f4c30e03
    Reviewed-on: https://gerrit.libreoffice.org/50565
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 88b6b1a8c149163d226eb3295930e3407bcb8b5b)
    Reviewed-on: https://gerrit.libreoffice.org/56958
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index 287413ba7f5c..c8e060f15d9c 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -711,6 +711,11 @@ public:
 
     void AddCrossRefHeadingMapping(OUString const& rFrom, OUString const& rTo);
     void MapCrossRefHeadingFieldsHorribly();
+
+    void setBookmarkAttributes(bool hidden, OUString const& condition);
+    bool getBookmarkHidden();
+    const OUString& getBookmarkCondition();
+
 };
 
 #endif
diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
index 8fb299cae511..d06a335f1f83 100644
--- a/include/xmloff/txtparae.hxx
+++ b/include/xmloff/txtparae.hxx
@@ -204,6 +204,8 @@ private:
     const OUString sTextFieldStart;
     const OUString sTextFieldEnd;
     const OUString sTextFieldStartEnd;
+    const OUString m_sBookmarkHidden;
+    const OUString m_sBookmarkCondition;
 
 protected:
     const OUString sFrameStyleName;
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 3854f6c7e2da..62695a15c2f1 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -170,6 +170,13 @@ void XMLTextMarkImportContext::StartElement(
         }
         m_rHelper.pushFieldCtx( m_sBookmarkName, m_sFieldName );
     }
+
+    if (IsXMLToken(GetLocalName(), XML_BOOKMARK_START))
+    {
+        OUString sHidden = xAttrList->getValueByName("loext:hidden");
+        OUString sCondition = xAttrList->getValueByName("loext:condition");
+        m_rHelper.setBookmarkAttributes(sHidden == "true", sCondition);
+    }
 }
 
 void XMLTextMarkImportContext::EndElement()
@@ -346,6 +353,12 @@ void XMLTextMarkImportContext::EndElement()
                                     GetImport().GetRDFaImportHelper().AddRDFa(
                                         xMeta, xRDFaAttributes);
                                 }
+                                const Reference<XPropertySet> xPropertySet(xContent, UNO_QUERY);
+                                if (xPropertySet.is())
+                                {
+                                    xPropertySet->setPropertyValue("BookmarkHidden",    uno::Any(m_rHelper.getBookmarkHidden()));
+                                    xPropertySet->setPropertyValue("BookmarkCondition", uno::Any(m_rHelper.getBookmarkCondition()));
+                                }
                             }
 
                             if (nTmp==TypeFieldmarkEnd) {
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 7dadde85e2a2..bc5aba285195 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -547,6 +547,9 @@ struct XMLTextImportHelper::Impl
     // Used for frame deduplication, the name of the last frame imported directly before the current one
     OUString msLastImportedFrameName;
 
+    bool m_bBookmarkHidden;
+    OUString m_sBookmarkCondition;
+
     uno::Reference<text::XText> m_xText;
     uno::Reference<text::XTextCursor> m_xCursor;
     uno::Reference<text::XTextRange> m_xCursorAsRange;
@@ -592,6 +595,7 @@ struct XMLTextImportHelper::Impl
                 bool const bProgress, bool const bBlockMode,
                 bool const bOrganizerMode)
         :   m_xTextListsHelper( new XMLTextListsHelper() )
+        ,   m_bBookmarkHidden( false )
         // XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)
         ,   m_xServiceFactory( rModel, UNO_QUERY )
         ,   m_rSvXMLImport( rImport )
@@ -2951,4 +2955,20 @@ void XMLTextImportHelper::MapCrossRefHeadingFieldsHorribly()
     }
 }
 
+void XMLTextImportHelper::setBookmarkAttributes(bool hidden, OUString const& condition)
+{
+    m_xImpl->m_bBookmarkHidden = hidden;
+    m_xImpl->m_sBookmarkCondition = condition;
+}
+
+bool XMLTextImportHelper::getBookmarkHidden()
+{
+    return m_xImpl->m_bBookmarkHidden;
+}
+
+const OUString& XMLTextImportHelper::getBookmarkCondition()
+{
+    return m_xImpl->m_sBookmarkCondition;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 099a7385c1cf..d039682eb856 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -1248,6 +1248,8 @@ XMLTextParagraphExport::XMLTextParagraphExport(
     sTextFieldStart( "TextFieldStart"  ),
     sTextFieldEnd( "TextFieldEnd"  ),
     sTextFieldStartEnd( "TextFieldStartEnd"  ),
+    m_sBookmarkHidden("BookmarkHidden"),
+    m_sBookmarkCondition("BookmarkCondition"),
     sFrameStyleName("FrameStyleName"),
     aCharStyleNamesPropInfoCache( sCharStyleNames )
 {


More information about the Libreoffice-commits mailing list