[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - 74 commits - canvas/source chart2/qa comphelper/Library_comphelper.mk comphelper/source configure.ac cui/source cui/uiconfig dbaccess/source desktop/win32 dtrans/source editeng/source external/libepubgen extras/source forms/source helpcontent2 include/comphelper include/editeng include/oox include/sfx2 include/svl include/svx include/unotools include/vcl include/xmloff io/source offapi/com oox/inc oox/source readlicense_oo/license reportdesign/source schema/libreoffice sc/inc sc/sdi sc/source sc/uiconfig sd/qa sd/source sfx2/source solenv/clang-format solenv/sanitizers sot/source svtools/uiconfig svx/source sw/inc sw/qa sw/source sw/uiconfig test/source translations unodevtools/source unotools/source vcl/inc vcl/opengl vcl/source vcl/unx vcl/win winaccessibility/source wizards/com writerfilter/source xmloff/source xmlsecurity/inc xmlsecurity/Library_xmlsecurity.mk xmlsecurity/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 16 00:47:31 UTC 2018


Rebased ref, commits from common ancestor:
commit e3ca70e96372ab235101f590c65e3f911f0c802d
Author:     Ilhan Yesil <ilhanyesil at gmx.de>
AuthorDate: Mon Oct 29 12:33:25 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Nov 16 01:46:39 2018 +0100

    tdf#121013 External tool opens it's own dialog to update input fields
    
    Instead calling function SwWrtShell::UpdateInputFields directly, use
    an UNO command, so an external tool can catch the UNO call.
    
    Change-Id: I978487e94b6f82a75b008bfcdc20bb025dc610f7
    Reviewed-on: https://gerrit.libreoffice.org/62502
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit b8e260a9372de9ee1186e1f78ade29717e9b8026)
    Reviewed-on: https://gerrit.libreoffice.org/62542
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 804e358418ef..b63d52828ef9 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -94,6 +94,7 @@
 #include <com/sun/star/sdbc/XDataSource.hpp>
 #include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
 #include <swabstdlg.hxx>
+#include <comphelper/dispatchcommand.hxx>
 
 #include <vcl/status.hxx>
 
@@ -864,7 +865,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
                         bUpdateFields = false;
                     if(bUpdateFields)
                     {
-                        pWrtSh->UpdateInputFields();
+                        comphelper::dispatchCommand(".uno:UpdateInputFields", {});
 
                         // Are database fields contained?
                         // Get all used databases for the first time
commit 7f63525b88a8d988ea67d2c295102634425d465e
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Nov 12 14:56:38 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Nov 16 01:01:52 2018 +0100

    tdf#118568 Use custom image for signing signature line
    
    Reviewed-on: https://gerrit.libreoffice.org/63325
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit ba4390968a6df9a3598d9d5b70b84dfc634ee31b)
    
    Conflicts:
            cui/source/dialogs/SignSignatureLineDialog.cxx
            solenv/sanitizers/ui/cui.suppr
    
    Change-Id: Ib3c4d2301bf5e68b7c02590a8947ea3a502e7087

diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx
index e1d3d90fe4b3..45bd02b81072 100644
--- a/cui/source/dialogs/SignSignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignSignatureLineDialog.cxx
@@ -9,21 +9,27 @@
 
 #include <SignSignatureLineDialog.hxx>
 
+#include <sal/log.hxx>
 #include <sal/types.h>
 
 #include <dialmgr.hxx>
 #include <strings.hrc>
 
+#include <comphelper/graphicmimetype.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/xmltools.hxx>
 #include <comphelper/xmlsechelper.hxx>
-#include <tools/stream.hxx>
-#include <unotools/streamwrap.hxx>
-#include <vcl/weld.hxx>
+#include <osl/file.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/docfilt.hxx>
 #include <sfx2/objsh.hxx>
+#include <svx/xoutbmp.hxx>
+#include <tools/stream.hxx>
+#include <unotools/streamwrap.hxx>
+#include <utility>
+#include <vcl/graph.hxx>
+#include <vcl/weld.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
@@ -39,6 +45,9 @@
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/text/XTextContent.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/ui/dialogs/FilePicker.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
 
 using namespace comphelper;
 using namespace css;
@@ -52,12 +61,15 @@ using namespace css::text;
 using namespace css::drawing;
 using namespace css::graphic;
 using namespace css::security;
+using namespace css::ui::dialogs;
 
 SignSignatureLineDialog::SignSignatureLineDialog(weld::Widget* pParent, Reference<XModel> xModel)
     : SignatureLineDialogBase(pParent, xModel, "cui/ui/signsignatureline.ui",
                               "SignSignatureLineDialog")
     , m_xEditName(m_xBuilder->weld_entry("edit_name"))
     , m_xEditComment(m_xBuilder->weld_text_view("edit_comment"))
+    , m_xBtnLoadImage(m_xBuilder->weld_button("btn_load_image"))
+    , m_xBtnClearImage(m_xBuilder->weld_button("btn_clear_image"))
     , m_xBtnChooseCertificate(m_xBuilder->weld_button("btn_select_certificate"))
     , m_xBtnSign(m_xBuilder->weld_button("ok"))
     , m_xLabelHint(m_xBuilder->weld_label("label_hint"))
@@ -77,6 +89,8 @@ SignSignatureLineDialog::SignSignatureLineDialog(weld::Widget* pParent, Referenc
         return;
     }
 
+    m_xBtnLoadImage->connect_clicked(LINK(this, SignSignatureLineDialog, loadImage));
+    m_xBtnClearImage->connect_clicked(LINK(this, SignSignatureLineDialog, clearImage));
     m_xBtnChooseCertificate->connect_clicked(
         LINK(this, SignSignatureLineDialog, chooseCertificate));
     m_xEditName->connect_changed(LINK(this, SignSignatureLineDialog, entryChanged));
@@ -119,6 +133,38 @@ SignSignatureLineDialog::SignSignatureLineDialog(weld::Widget* pParent, Referenc
     ValidateFields();
 }
 
+IMPL_LINK_NOARG(SignSignatureLineDialog, loadImage, weld::Button&, void)
+{
+    Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
+    Reference<XFilePicker3> xFilePicker
+        = FilePicker::createWithMode(xContext, TemplateDescription::FILEOPEN_PREVIEW);
+    if (xFilePicker->execute())
+    {
+        Sequence<OUString> aSelectedFiles = xFilePicker->getSelectedFiles();
+        if (aSelectedFiles.getLength() < 1)
+            return;
+
+        Reference<XGraphicProvider> xProvider = GraphicProvider::create(xContext);
+        Sequence<PropertyValue> aMediaProperties(1);
+        aMediaProperties[0].Name = "URL";
+        aMediaProperties[0].Value <<= aSelectedFiles[0];
+        m_xSignatureImage = xProvider->queryGraphic(aMediaProperties);
+        m_sOriginalImageBtnLabel = m_xBtnLoadImage->get_label();
+
+        INetURLObject aObj(aSelectedFiles[0]);
+        m_xBtnLoadImage->set_label(aObj.GetLastName());
+
+        ValidateFields();
+    }
+}
+
+IMPL_LINK_NOARG(SignSignatureLineDialog, clearImage, weld::Button&, void)
+{
+    m_xSignatureImage.set(nullptr);
+    m_xBtnLoadImage->set_label(m_sOriginalImageBtnLabel);
+    ValidateFields();
+}
+
 IMPL_LINK_NOARG(SignSignatureLineDialog, chooseCertificate, weld::Button&, void)
 {
     // Document needs to be saved before selecting a certificate
@@ -149,8 +195,13 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, entryChanged, weld::Entry&, void) { Val
 
 void SignSignatureLineDialog::ValidateFields()
 {
-    bool bEnable = m_xSelectedCertifate.is() && !m_xEditName->get_text().isEmpty();
-    m_xBtnSign->set_sensitive(bEnable);
+    bool bEnableSignBtn = m_xSelectedCertifate.is()
+                          && (!m_xEditName->get_text().isEmpty() || m_xSignatureImage.is());
+    m_xBtnSign->set_sensitive(bEnableSignBtn);
+
+    m_xEditName->set_sensitive(!m_xSignatureImage.is());
+    m_xBtnLoadImage->set_sensitive(m_xEditName->get_text().isEmpty());
+    m_xBtnClearImage->set_sensitive(m_xSignatureImage.is());
 }
 
 void SignSignatureLineDialog::Apply()
@@ -176,7 +227,6 @@ SignSignatureLineDialog::getSignedGraphic(bool bValid)
     aSvgImage = aSvgImage.replaceAll("[SIGNER_NAME]", getCDataString(m_aSuggestedSignerName));
     aSvgImage = aSvgImage.replaceAll("[SIGNER_TITLE]", getCDataString(m_aSuggestedSignerTitle));
 
-    aSvgImage = aSvgImage.replaceAll("[SIGNATURE]", getCDataString(m_xEditName->get_text()));
     OUString aIssuerLine
         = CuiResId(RID_SVXSTR_SIGNATURELINE_SIGNED_BY)
               .replaceFirst("%1", xmlsec::GetContentPart(m_xSelectedCertifate->getSubjectName()));
@@ -194,6 +244,31 @@ SignSignatureLineDialog::getSignedGraphic(bool bValid)
     }
     aSvgImage = aSvgImage.replaceAll("[DATE]", aDate);
 
+    // Custom signature image
+    if (m_xSignatureImage.is())
+    {
+        OUString aGraphicInBase64;
+        Graphic aGraphic(m_xSignatureImage);
+        if (!XOutBitmap::GraphicToBase64(aGraphic, aGraphicInBase64, false))
+            SAL_WARN("cui.dialogs", "Could not convert graphic to base64");
+
+        OUString aImagePart = "<image y=\"825\" x=\"1300\" "
+                              "xlink:href=\"data:[MIMETYPE];base64,[BASE64_IMG]>\" "
+                              "preserveAspectRatio=\"xMidYMid\" height=\"1520\" "
+                              "width=\"7600\" />";
+        aImagePart = aImagePart.replaceAll(
+            "[MIMETYPE]", GraphicMimeTypeHelper::GetMimeTypeForXGraphic(m_xSignatureImage));
+        aImagePart = aImagePart.replaceAll("[BASE64_IMG]", aGraphicInBase64);
+        aSvgImage = aSvgImage.replaceAll("[SIGNATURE_IMAGE]", aImagePart);
+
+        aSvgImage = aSvgImage.replaceAll("[SIGNATURE]", "");
+    }
+    else
+    {
+        aSvgImage = aSvgImage.replaceAll("[SIGNATURE_IMAGE]", "");
+        aSvgImage = aSvgImage.replaceAll("[SIGNATURE]", getCDataString(m_xEditName->get_text()));
+    }
+
     // Create graphic
     SvMemoryStream aSvgStream(4096, 4096);
     aSvgStream.WriteOString(OUStringToOString(aSvgImage, RTL_TEXTENCODING_UTF8));
diff --git a/cui/source/dialogs/SignatureLineDialogBase.cxx b/cui/source/dialogs/SignatureLineDialogBase.cxx
index 3028d2941a37..089a277b8371 100644
--- a/cui/source/dialogs/SignatureLineDialogBase.cxx
+++ b/cui/source/dialogs/SignatureLineDialogBase.cxx
@@ -212,7 +212,8 @@ OUString SignatureLineDialogBase::getSignatureImage()
         "XTEXT_EOC</desc><desc id=\"desc550\">512: XTEXT_EOC</desc><desc id=\"desc552\">512: "
         "XTEXT_EOW</desc><desc id=\"desc554\">512: XTEXT_EOL</desc><desc id=\"desc556\">512: "
         "XTEXT_EOP</desc><desc id=\"desc558\">512: "
-        "XTEXT_PAINTSHAPE_END</desc></tspan></tspan></text></g></g></g></g></g></g></g></svg>");
+        "XTEXT_PAINTSHAPE_END</desc></tspan></tspan></text></g></g></g></g></g></"
+        "g>[SIGNATURE_IMAGE]</g></svg>");
     return svg;
 }
 
diff --git a/cui/source/inc/SignSignatureLineDialog.hxx b/cui/source/inc/SignSignatureLineDialog.hxx
index a78124bc2679..a12343c4ecd8 100644
--- a/cui/source/inc/SignSignatureLineDialog.hxx
+++ b/cui/source/inc/SignSignatureLineDialog.hxx
@@ -24,6 +24,8 @@ public:
 private:
     std::unique_ptr<weld::Entry> m_xEditName;
     std::unique_ptr<weld::TextView> m_xEditComment;
+    std::unique_ptr<weld::Button> m_xBtnLoadImage;
+    std::unique_ptr<weld::Button> m_xBtnClearImage;
     std::unique_ptr<weld::Button> m_xBtnChooseCertificate;
     std::unique_ptr<weld::Button> m_xBtnSign;
     std::unique_ptr<weld::Label> m_xLabelHint;
@@ -32,15 +34,19 @@ private:
 
     css::uno::Reference<css::beans::XPropertySet> m_xShapeProperties;
     css::uno::Reference<css::security::XCertificate> m_xSelectedCertifate;
+    css::uno::Reference<css::graphic::XGraphic> m_xSignatureImage;
     OUString m_aSignatureLineId;
     OUString m_aSuggestedSignerName;
     OUString m_aSuggestedSignerTitle;
     bool m_bShowSignDate;
+    OUString m_sOriginalImageBtnLabel;
 
     void ValidateFields();
     const css::uno::Reference<css::graphic::XGraphic> getSignedGraphic(bool bValid);
     virtual void Apply() override;
 
+    DECL_LINK(clearImage, weld::Button&, void);
+    DECL_LINK(loadImage, weld::Button&, void);
     DECL_LINK(chooseCertificate, weld::Button&, void);
     DECL_LINK(entryChanged, weld::Entry&, void);
 };
diff --git a/cui/uiconfig/ui/signsignatureline.ui b/cui/uiconfig/ui/signsignatureline.ui
index 33891a7d343a..709f13c31e5c 100644
--- a/cui/uiconfig/ui/signsignatureline.ui
+++ b/cui/uiconfig/ui/signsignatureline.ui
@@ -142,7 +142,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
+                            <property name="top_attach">2</property>
                           </packing>
                         </child>
                         <child>
@@ -154,9 +154,78 @@
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
+                            <property name="top_attach">2</property>
+                            <property name="width">4</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_or">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="halign">start</property>
+                            <property name="label" translatable="yes" context="signsignatureline|label_name" comments="Name of the signer">or</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="btn_load_image">
+                            <property name="label" translatable="yes" context="signsignatureline|btn_load_image">Use Signature Image</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <accessibility>
+                              <relation type="labelled-by" target="label_image_dimensions"/>
+                            </accessibility>
+                          </object>
+                          <packing>
+                            <property name="left_attach">3</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="btn_clear_image">
+                            <property name="label" translatable="yes" context="signsignatureline|btn_clear_image">Clear</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">4</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_image_dimensions">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="halign">start</property>
+                            <property name="margin_bottom">6</property>
+                            <property name="label" translatable="yes" context="signsignatureline|label_image_dimensions">Best image size: 600 x 100 px</property>
+                            <attributes>
+                              <attribute name="style" value="italic"/>
+                            </attributes>
+                            <accessibility>
+                              <relation type="label-for" target="btn_load_image"/>
+                            </accessibility>
+                          </object>
+                          <packing>
+                            <property name="left_attach">3</property>
                             <property name="top_attach">1</property>
+                            <property name="width">2</property>
                           </packing>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </object>
                     </child>
                   </object>
@@ -293,9 +362,9 @@
       </object>
     </child>
     <action-widgets>
+      <action-widget response="-11">help</action-widget>
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-5">ok</action-widget>
-      <action-widget response="-11">help</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index 4ad3ff4d457d..f8a87eded4b1 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -134,6 +134,7 @@ cui/uiconfig/ui/shadowtabpage.ui://GtkLabel[@id='FT_DISTANCE'] orphan-label
 cui/uiconfig/ui/shadowtabpage.ui://GtkLabel[@id='FT_TRANSPARENT'] orphan-label
 cui/uiconfig/ui/shadowtabpage.ui://GtkLabel[@id='FT_SHADOW_COLOR'] orphan-label
 cui/uiconfig/ui/signsignatureline.ui://GtkTextView[@id='edit_comment'] duplicate-mnemonic
+cui/uiconfig/ui/signsignatureline.ui://GtkLabel[@id='label_or'] orphan-label
 cui/uiconfig/ui/thesaurus.ui://GtkButton[@id='left'] button-no-label
 cui/uiconfig/ui/wordcompletionpage.ui://GtkSpinButton[@id='maxentries'] duplicate-mnemonic
 cui/uiconfig/ui/wordcompletionpage.ui://GtkSpinButton[@id='minwordlen'] no-labelled-by
commit 92fb5b598872870b457069aec4fd91c6a5cdcf6d
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Nov 12 08:30:46 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Nov 16 01:00:38 2018 +0100

    Related tdf#118581 Use subject name, not issuer name for signature line
    
    And map the gpg user also the the subject name
    
    Change-Id: I1db7b93b6bfc82304924d6ef90db18ff4f97e13c
    Reviewed-on: https://gerrit.libreoffice.org/63278
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit b7d0b49f5708b55e24aabb719e26ce5ec8628161)

diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx
index e29eb3d41f89..e1d3d90fe4b3 100644
--- a/cui/source/dialogs/SignSignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignSignatureLineDialog.cxx
@@ -140,7 +140,7 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, chooseCertificate, weld::Button&, void)
     {
         m_xSelectedCertifate = xSignCertificate;
         m_xBtnChooseCertificate->set_label(
-            xmlsec::GetContentPart(xSignCertificate->getIssuerName()));
+            xmlsec::GetContentPart(xSignCertificate->getSubjectName()));
     }
     ValidateFields();
 }
@@ -179,7 +179,7 @@ SignSignatureLineDialog::getSignedGraphic(bool bValid)
     aSvgImage = aSvgImage.replaceAll("[SIGNATURE]", getCDataString(m_xEditName->get_text()));
     OUString aIssuerLine
         = CuiResId(RID_SVXSTR_SIGNATURELINE_SIGNED_BY)
-              .replaceFirst("%1", xmlsec::GetContentPart(m_xSelectedCertifate->getIssuerName()));
+              .replaceFirst("%1", xmlsec::GetContentPart(m_xSelectedCertifate->getSubjectName()));
     aSvgImage = aSvgImage.replaceAll("[SIGNED_BY]", getCDataString(aIssuerLine));
     if (bValid)
         aSvgImage = aSvgImage.replaceAll("[INVALID_SIGNATURE]", "");
diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx
index 4a2934a9779c..72fed74b949e 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.cxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.cxx
@@ -61,8 +61,8 @@ OUString SAL_CALL CertificateImpl::getIssuerName()
 
 OUString SAL_CALL CertificateImpl::getSubjectName()
 {
-    // Empty for gpg
-    return OUString();
+    // Samue as issuer name (user ID)
+    return getIssuerName();
 }
 
 namespace {
commit b2acb2801dbd38ee62ae2259a67906628826e09a
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri Nov 9 16:42:16 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Nov 16 01:00:03 2018 +0100

    tdf#118581 Correctly display issuer name in signature line
    
    Move the xmlsec helper methods to comphelper so that we can use them in cui
    
    Reviewed-on: https://gerrit.libreoffice.org/63198
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 9c5d3e5c59a9d0ffcb5fd99f5d4c98b0f6b5560e)
    
    Conflicts:
            cui/source/dialogs/SignSignatureLineDialog.cxx
            unotools/source/misc/datetime.cxx
            xmlsecurity/source/dialogs/certificatechooser.cxx
            xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
            xmlsecurity/source/dialogs/macrosecurity.cxx
    
    Change-Id: If9b10cfff5f5abd6b16e48f043af7959edbb1142

diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 4a24d65da15c..3d0eb522c5dd 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -141,6 +141,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
     comphelper/source/misc/types \
     comphelper/source/misc/weak \
     comphelper/source/misc/weakeventlistener \
+    comphelper/source/misc/xmlsechelper \
     comphelper/source/officeinstdir/officeinstallationdirectories \
     comphelper/source/processfactory/processfactory \
     comphelper/source/property/ChainablePropertySet \
diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/comphelper/source/misc/xmlsechelper.cxx
similarity index 94%
rename from xmlsecurity/source/dialogs/resourcemanager.cxx
rename to comphelper/source/misc/xmlsechelper.cxx
index 102466a8159f..4b07cd145b08 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.cxx
+++ b/comphelper/source/misc/xmlsechelper.cxx
@@ -18,7 +18,7 @@
  */
 
 
-#include <resourcemanager.hxx>
+#include <comphelper/xmlsechelper.hxx>
 
 #include <vcl/svapp.hxx>
 #include <vcl/fixed.hxx>
@@ -30,34 +30,10 @@
 
 using namespace std;
 
-namespace XmlSec
+namespace comphelper
+{
+namespace xmlsec
 {
-    const LocaleDataWrapper&    GetLocaleData()
-    {
-        static SvtSysLocale ourSysLocale;
-
-        return ourSysLocale.GetLocaleData();
-    }
-
-    DateTime GetDateTime( const css::util::DateTime& _rDT )
-    {
-        return DateTime(_rDT);
-    }
-
-    OUString GetDateTimeString( const css::util::DateTime& _rDT )
-    {
-        // String with date and time information (#i20172#)
-        DateTime aDT( GetDateTime( _rDT ) );
-        const LocaleDataWrapper& rLoDa = GetLocaleData();
-
-        return  rLoDa.getDate( aDT ) + " " + rLoDa.getTime( aDT );
-    }
-
-    OUString GetDateString( const css::util::DateTime& _rDT )
-    {
-        return GetLocaleData().getDate( GetDateTime( _rDT ) );
-    }
-
     OUString GetCertificateKind( const css::security::CertificateKind &rKind )
     {
         switch (rKind)
@@ -360,5 +336,6 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
         return aStr.makeStringAndClear();
     }
 }
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx
index e5b48e9607cb..e29eb3d41f89 100644
--- a/cui/source/dialogs/SignSignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignSignatureLineDialog.cxx
@@ -17,6 +17,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/xmltools.hxx>
+#include <comphelper/xmlsechelper.hxx>
 #include <tools/stream.hxx>
 #include <unotools/streamwrap.hxx>
 #include <vcl/weld.hxx>
@@ -39,6 +40,7 @@
 #include <com/sun/star/text/XTextContent.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
 
+using namespace comphelper;
 using namespace css;
 using namespace css::uno;
 using namespace css::beans;
@@ -137,7 +139,8 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, chooseCertificate, weld::Button&, void)
     if (xSignCertificate.is())
     {
         m_xSelectedCertifate = xSignCertificate;
-        m_xBtnChooseCertificate->set_label(xSignCertificate->getIssuerName());
+        m_xBtnChooseCertificate->set_label(
+            xmlsec::GetContentPart(xSignCertificate->getIssuerName()));
     }
     ValidateFields();
 }
@@ -174,8 +177,9 @@ SignSignatureLineDialog::getSignedGraphic(bool bValid)
     aSvgImage = aSvgImage.replaceAll("[SIGNER_TITLE]", getCDataString(m_aSuggestedSignerTitle));
 
     aSvgImage = aSvgImage.replaceAll("[SIGNATURE]", getCDataString(m_xEditName->get_text()));
-    OUString aIssuerLine = CuiResId(RID_SVXSTR_SIGNATURELINE_SIGNED_BY)
-                               .replaceFirst("%1", m_xSelectedCertifate->getIssuerName());
+    OUString aIssuerLine
+        = CuiResId(RID_SVXSTR_SIGNATURELINE_SIGNED_BY)
+              .replaceFirst("%1", xmlsec::GetContentPart(m_xSelectedCertifate->getIssuerName()));
     aSvgImage = aSvgImage.replaceAll("[SIGNED_BY]", getCDataString(aIssuerLine));
     if (bValid)
         aSvgImage = aSvgImage.replaceAll("[INVALID_SIGNATURE]", "");
diff --git a/include/comphelper/xmlsechelper.hxx b/include/comphelper/xmlsechelper.hxx
new file mode 100644
index 000000000000..ba702fa683c6
--- /dev/null
+++ b/include/comphelper/xmlsechelper.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_XMLSECHELPER_HXX
+#define INCLUDED_COMPHELPER_XMLSECHELPER_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/security/CertificateKind.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vector>
+
+namespace comphelper
+{
+namespace xmlsec
+{
+COMPHELPER_DLLPUBLIC OUString GetCertificateKind(const css::security::CertificateKind& rKind);
+
+COMPHELPER_DLLPUBLIC std::vector<std::pair<OUString, OUString>> parseDN(const OUString& rRawString);
+COMPHELPER_DLLPUBLIC std::pair<OUString, OUString>
+GetDNForCertDetailsView(const OUString& rRawString);
+COMPHELPER_DLLPUBLIC OUString GetContentPart(const OUString& _rRawString);
+
+COMPHELPER_DLLPUBLIC OUString GetHexString(const css::uno::Sequence<sal_Int8>& _rSeq,
+                                           const char* _pSep, sal_uInt16 _nLineBreak = 0xFFFF);
+}
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/datetime.hxx b/include/unotools/datetime.hxx
index fd35a31d231f..d9f89bb56c1a 100644
--- a/include/unotools/datetime.hxx
+++ b/include/unotools/datetime.hxx
@@ -30,9 +30,14 @@
 class Date;
 namespace tools { class Time; }
 class DateTime;
+class LocaleDataWrapper;
 
 namespace utl
 {
+    UNOTOOLS_DLLPUBLIC const LocaleDataWrapper& GetLocaleData();
+    UNOTOOLS_DLLPUBLIC DateTime GetDateTime(const css::util::DateTime& _rDT);
+    UNOTOOLS_DLLPUBLIC OUString GetDateTimeString(const css::util::DateTime& _rDT);
+    UNOTOOLS_DLLPUBLIC OUString GetDateString(const css::util::DateTime& _rDT);
 
     UNOTOOLS_DLLPUBLIC void typeConvert(const Date& _rDate, css::util::Date& _rOut);
     UNOTOOLS_DLLPUBLIC void typeConvert(const css::util::Date& _rDate, Date& _rOut);
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index ebf7c2ed369a..2441ba0c5154 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -1674,6 +1674,7 @@ comphelper/source/misc/threadpool.cxx
 comphelper/source/misc/types.cxx
 comphelper/source/misc/weak.cxx
 comphelper/source/misc/weakeventlistener.cxx
+comphelper/source/misc/xmlsechelper.cxx
 comphelper/source/officeinstdir/officeinstallationdirectories.cxx
 comphelper/source/officeinstdir/officeinstallationdirectories.hxx
 comphelper/source/processfactory/processfactory.cxx
@@ -19531,7 +19532,6 @@ xmlsecurity/inc/pch/precompiled_xsec_gpg.cxx
 xmlsecurity/inc/pch/precompiled_xsec_gpg.hxx
 xmlsecurity/inc/pch/precompiled_xsec_xmlsec.cxx
 xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx
-xmlsecurity/inc/resourcemanager.hxx
 xmlsecurity/inc/xmlsec-wrapper.h
 xmlsecurity/inc/xmlsec/errorcallback.hxx
 xmlsecurity/inc/xmlsec/saxhelper.hxx
@@ -19556,7 +19556,6 @@ xmlsecurity/source/dialogs/certificatechooser.cxx
 xmlsecurity/source/dialogs/certificateviewer.cxx
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
 xmlsecurity/source/dialogs/macrosecurity.cxx
-xmlsecurity/source/dialogs/resourcemanager.cxx
 xmlsecurity/source/framework/buffernode.cxx
 xmlsecurity/source/framework/buffernode.hxx
 xmlsecurity/source/framework/elementcollector.cxx
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx
index 6a10c1e6f1ac..5a67a6858ed5 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -18,12 +18,15 @@
  */
 
 #include <unotools/datetime.hxx>
+#include <unotools/syslocale.hxx>
 #include <tools/date.hxx>
 #include <tools/time.hxx>
 #include <tools/datetime.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/math.hxx>
 #include <osl/diagnose.h>
+#include <vcl/svapp.hxx>
+#include <sstream>
 
 namespace
 {
@@ -192,6 +195,27 @@ namespace
 
 namespace utl
 {
+const LocaleDataWrapper& GetLocaleData()
+{
+    static SvtSysLocale ourSysLocale;
+    return ourSysLocale.GetLocaleData();
+}
+
+DateTime GetDateTime(const css::util::DateTime& _rDT) { return DateTime(_rDT); }
+
+OUString GetDateTimeString(const css::util::DateTime& _rDT)
+{
+    // String with date and time information (#i20172#)
+    DateTime aDT(GetDateTime(_rDT));
+    const LocaleDataWrapper& rLoDa = GetLocaleData();
+
+    return rLoDa.getDate(aDT) + " " + rLoDa.getTime(aDT);
+}
+
+OUString GetDateString(const css::util::DateTime& _rDT)
+{
+    return GetLocaleData().getDate(GetDateTime(_rDT));
+}
 
 void typeConvert(const Date& _rDate, css::util::Date& _rOut)
 {
diff --git a/xmlsecurity/Library_xmlsecurity.mk b/xmlsecurity/Library_xmlsecurity.mk
index a6f4e09d0c45..9a65dd2152a9 100644
--- a/xmlsecurity/Library_xmlsecurity.mk
+++ b/xmlsecurity/Library_xmlsecurity.mk
@@ -51,7 +51,6 @@ $(eval $(call gb_Library_add_exception_objects,xmlsecurity,\
 	xmlsecurity/source/dialogs/certificateviewer \
 	xmlsecurity/source/dialogs/digitalsignaturesdialog \
 	xmlsecurity/source/dialogs/macrosecurity \
-	xmlsecurity/source/dialogs/resourcemanager \
 	xmlsecurity/source/framework/buffernode \
 	xmlsecurity/source/framework/elementcollector \
 	xmlsecurity/source/framework/elementmark \
diff --git a/xmlsecurity/inc/resourcemanager.hxx b/xmlsecurity/inc/resourcemanager.hxx
index d621c4bc7328..3640db40a63f 100644
--- a/xmlsecurity/inc/resourcemanager.hxx
+++ b/xmlsecurity/inc/resourcemanager.hxx
@@ -21,38 +21,8 @@
 #define INCLUDED_XMLSECURITY_SOURCE_DIALOGS_RESOURCEMANAGER_HXX
 
 #include <unotools/resmgr.hxx>
-#include <tools/datetime.hxx>
-#include <com/sun/star/security/CertificateKind.hpp>
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
 
-#include <vector>
-
-class FixedImage;
-class Control;
-class LocaleDataWrapper;
-
-namespace XmlSec
-{
-    const LocaleDataWrapper&    GetLocaleData();
-    DateTime        GetDateTime( const css::util::DateTime& _rDT );
-    OUString        GetDateTimeString( const css::util::DateTime& _rDT );
-    OUString        GetDateString( const css::util::DateTime& _rDT );
-    OUString        GetCertificateKind( const css::security::CertificateKind& rKind );
-
-    std::vector< std::pair< OUString, OUString> >
-        parseDN(const OUString& rRawString);
-    std::pair< OUString, OUString> GetDNForCertDetailsView(
-        const OUString & rRawString);
-    OUString        GetContentPart( const OUString& _rRawString );
-
-    OUString        GetHexString( const css::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep, sal_uInt16 _nLineBreak = 0xFFFF );
-}
-
-inline OUString XsResId(const char* pId)
-{
-    return Translate::get(pId, Translate::Create("xsc"));
-}
+inline OUString XsResId(const char* pId) { return Translate::get(pId, Translate::Create("xsc")); }
 
 #endif
 
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index fa099be79b7c..49a131a020cc 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -46,6 +46,7 @@
 #include <comphelper/documentconstants.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/xmlsechelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 4900a8710d1f..347b4fdde11b 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -23,14 +23,16 @@
 #include <biginteger.hxx>
 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
 #include <comphelper/sequence.hxx>
+#include <comphelper/xmlsechelper.hxx>
 
 #include <com/sun/star/security/NoPasswordException.hpp>
 #include <com/sun/star/security/CertificateCharacters.hpp>
 
-#include <resourcemanager.hxx>
 #include <svtools/treelistentry.hxx>
+#include <unotools/datetime.hxx>
 #include <unotools/useroptions.hxx>
 
+using namespace comphelper;
 using namespace css;
 
 CertificateChooser::CertificateChooser(vcl::Window* _pParent,
@@ -229,11 +231,11 @@ void CertificateChooser::ImplInitialize()
             userData->xSecurityEnvironment = secEnvironment;
             mvUserData.push_back(userData);
 
-            OUString sIssuer = XmlSec::GetContentPart( xCerts[ nC ]->getIssuerName() );
-            SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( XmlSec::GetContentPart( xCerts[ nC ]->getSubjectName() )
+            OUString sIssuer = xmlsec::GetContentPart( xCerts[ nC ]->getIssuerName() );
+            SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( xmlsec::GetContentPart( xCerts[ nC ]->getSubjectName() )
                 + "\t" + sIssuer
-                + "\t" + XmlSec::GetCertificateKind( xCerts[ nC ]->getCertificateKind() )
-                + "\t" + XmlSec::GetDateString( xCerts[ nC ]->getNotValidAfter() )
+                + "\t" + xmlsec::GetCertificateKind( xCerts[ nC ]->getCertificateKind() )
+                + "\t" + utl::GetDateString( xCerts[ nC ]->getNotValidAfter() )
                 + "\t" + UsageInClearText( xCerts[ nC ]->getCertificateUsage() ) );
             pEntry->SetUserData( userData.get() );
 
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 0f2d0a399c60..599efa2fbfd6 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -31,11 +31,14 @@
 
 #include <strings.hrc>
 #include <resourcemanager.hxx>
+#include <comphelper/xmlsechelper.hxx>
 #include <svtools/controldims.hxx>
+#include <tools/datetime.hxx>
 #include <bitmaps.hlst>
 
 #include <vcl/settings.hxx>
 
+using namespace comphelper;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
@@ -128,12 +131,12 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( vcl::Window* _pParent, C
     // insert data
     css::uno::Reference< css::security::XCertificate > xCert = mpDlg->mxCert;
 
-    OUString sSubjectName(XmlSec::GetContentPart(xCert->getSubjectName()));
+    OUString sSubjectName(xmlsec::GetContentPart(xCert->getSubjectName()));
     if (!sSubjectName.isEmpty())
         m_pIssuedToFT->SetText(sSubjectName);
     else
         m_pIssuedToLabelFT->Hide();
-    OUString sIssuerName(XmlSec::GetContentPart(xCert->getIssuerName()));
+    OUString sIssuerName(xmlsec::GetContentPart(xCert->getIssuerName()));
     if (!sIssuerName.isEmpty())
         m_pIssuedByFT->SetText(sIssuerName);
     else
@@ -263,12 +266,12 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
     aLBEntry = "V" + OUString::number( xCert->getVersion() + 1 );
     InsertElement( XsResId( STR_VERSION ), aLBEntry, aLBEntry );
     Sequence< sal_Int8 >    aSeq = xCert->getSerialNumber();
-    aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
-    aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
+    aLBEntry = xmlsec::GetHexString( aSeq, pHexSep );
+    aDetails = xmlsec::GetHexString( aSeq, pHexSep, nLineBreak );
     InsertElement( XsResId( STR_SERIALNUM ), aLBEntry, aDetails, true );
 
     std::pair< OUString, OUString> pairIssuer =
-        XmlSec::GetDNForCertDetailsView(xCert->getIssuerName());
+        xmlsec::GetDNForCertDetailsView(xCert->getIssuerName());
     aLBEntry = pairIssuer.first;
     aDetails = pairIssuer.second;
     InsertElement( XsResId( STR_ISSUER ), aLBEntry, aDetails );
@@ -286,7 +289,7 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
     InsertElement( XsResId( STR_VALIDTO ), aLBEntry, aLBEntry );
 
     std::pair< OUString, OUString > pairSubject =
-        XmlSec::GetDNForCertDetailsView(xCert->getSubjectName());
+        xmlsec::GetDNForCertDetailsView(xCert->getSubjectName());
     aLBEntry = pairSubject.first;
     aDetails = pairSubject.second;
     InsertElement( XsResId( STR_SUBJECT ), aLBEntry, aDetails );
@@ -294,8 +297,8 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
     aLBEntry = aDetails = xCert->getSubjectPublicKeyAlgorithm();
     InsertElement( XsResId( STR_SUBJECT_PUBKEY_ALGO ), aLBEntry, aDetails );
     aSeq = xCert->getSubjectPublicKeyValue();
-    aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
-    aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
+    aLBEntry = xmlsec::GetHexString( aSeq, pHexSep );
+    aDetails = xmlsec::GetHexString( aSeq, pHexSep, nLineBreak );
     InsertElement( XsResId( STR_SUBJECT_PUBKEY_VAL ), aLBEntry, aDetails, true );
 
     aLBEntry = aDetails = xCert->getSignatureAlgorithm();
@@ -309,13 +312,13 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
     }
 
     aSeq = xCert->getSHA1Thumbprint();
-    aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
-    aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
+    aLBEntry = xmlsec::GetHexString( aSeq, pHexSep );
+    aDetails = xmlsec::GetHexString( aSeq, pHexSep, nLineBreak );
     InsertElement( XsResId( STR_THUMBPRINT_SHA1 ), aLBEntry, aDetails, true );
 
     aSeq = xCert->getMD5Thumbprint();
-    aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
-    aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
+    aLBEntry = xmlsec::GetHexString( aSeq, pHexSep );
+    aDetails = xmlsec::GetHexString( aSeq, pHexSep, nLineBreak );
     InsertElement( XsResId( STR_THUMBPRINT_MD5 ), aLBEntry, aDetails, true );
 
     m_pElementsLB->SetSelectHdl( LINK( this, CertificateViewerDetailsTP, ElementSelectHdl ) );
@@ -426,7 +429,7 @@ void CertificateViewerCertPathTP::ActivatePage()
         for (i = nCnt-1; i >= 0; i--)
         {
             const Reference< security::XCertificate > rCert = pCertPath[ i ];
-            OUString sName = XmlSec::GetContentPart( rCert->getSubjectName() );
+            OUString sName = xmlsec::GetContentPart( rCert->getSubjectName() );
             //Verify the certificate
             sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert,
                  Sequence<Reference<css::security::XCertificate> >());
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index bd2e2dedb3d9..88caf75eb0e6 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -48,14 +48,17 @@
 #include <tools/date.hxx>
 #include <tools/time.hxx>
 #include <svtools/treelistentry.hxx>
+#include <unotools/datetime.hxx>
 
 #include <strings.hrc>
 #include <resourcemanager.hxx>
+#include <comphelper/xmlsechelper.hxx>
 
 #include <vcl/weld.hxx>
 #include <unotools/configitem.hxx>
 #include <comphelper/storagehelper.hxx>
 
+using namespace comphelper;
 using namespace css::security;
 using namespace css::uno;
 using namespace css;
@@ -589,8 +592,8 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
                     bCertValid = false;
                 }
 
-                aSubject = XmlSec::GetContentPart( xCert->getSubjectName() );
-                aIssuer = XmlSec::GetContentPart( xCert->getIssuerName() );
+                aSubject = xmlsec::GetContentPart( xCert->getSubjectName() );
+                aIssuer = xmlsec::GetContentPart( xCert->getIssuerName() );
             }
             else if (!rInfo.ouGpgCertificate.isEmpty())
             {
@@ -598,7 +601,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
                 aIssuer = rInfo.ouGpgOwner;
             }
 
-            aDateTimeStr = XmlSec::GetDateTimeString( rInfo.stDateTime );
+            aDateTimeStr = utl::GetDateTimeString( rInfo.stDateTime );
             aDescription = rInfo.ouDescription;
 
             // Decide type string.
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index 91f14846d37f..b7805cd180ec 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -32,16 +32,18 @@
 #include <comphelper/sequence.hxx>
 #include <sfx2/filedlghelper.hxx>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/xmlsechelper.hxx>
 #include <com/sun/star/uno/Exception.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/ui/dialogs/FolderPicker.hpp>
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
 #include <tools/urlobj.hxx>
 #include <svtools/treelistentry.hxx>
+#include <unotools/datetime.hxx>
 
 #include <strings.hrc>
-#include <resourcemanager.hxx>
 
+using namespace comphelper;
 using namespace ::com::sun::star;
 
 
@@ -327,9 +329,9 @@ void MacroSecurityTrustedSourcesTP::FillCertLB()
             // create from RawData
             xCert = mpDlg->mxSecurityEnvironment->createCertificateFromAscii( rEntry[ 2 ] );
 
-            SvTreeListEntry*    pLBEntry = m_pTrustCertLB->InsertEntry( XmlSec::GetContentPart( xCert->getSubjectName() ) );
-            m_pTrustCertLB->SetEntryText( XmlSec::GetContentPart( xCert->getIssuerName() ), pLBEntry, 1 );
-            m_pTrustCertLB->SetEntryText( XmlSec::GetDateTimeString( xCert->getNotValidAfter() ), pLBEntry, 2 );
+            SvTreeListEntry*    pLBEntry = m_pTrustCertLB->InsertEntry( xmlsec::GetContentPart( xCert->getSubjectName() ) );
+            m_pTrustCertLB->SetEntryText( xmlsec::GetContentPart( xCert->getIssuerName() ), pLBEntry, 1 );
+            m_pTrustCertLB->SetEntryText( utl::GetDateTimeString( xCert->getNotValidAfter() ), pLBEntry, 2 );
             pLBEntry->SetUserData( reinterpret_cast<void*>(nEntry) );      // misuse user data as index
         }
     }
commit b610a63f27ef0e8bc0c43f6fc17bc8ab54993bf3
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jul 4 12:53:56 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Nov 15 17:48:03 2018 +0100

    tdf#101856 sw: hidden bookmark portions in SwTextFormatter::NewTextPortion()
    
    All other hidden-text features already have a AUTOFMT hint or a TXTFIELD
    hint, so the SwAttrIter already creates new portions for them.
    
    The bookmarks aren't considered by SwTextFormatter currently, but
    SwScriptInfo already has all of the required info.
    
    Change-Id: I451ce331110aa58df8955e1a3ffa339e6f905b22
    Reviewed-on: https://gerrit.libreoffice.org/56959
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit bf4d4a9cad6664bd5772618e31e998942caef77e)

diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index e3d64b1627f3..40d4fbcb8372 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -178,6 +178,7 @@ public:
         assert(nCnt < m_HiddenChg.size());
         return m_HiddenChg[ nCnt ];
     }
+    TextFrameIndex NextHiddenChg(TextFrameIndex nPos) const;
     static void CalcHiddenRanges(const SwTextNode& rNode, MultiSelection& rHiddenMulti);
     static void selectHiddenTextProperty(const SwTextNode& rNode, MultiSelection &rHiddenMulti);
     static void selectRedLineDeleted(const SwTextNode& rNode, MultiSelection &rHiddenMulti, bool bSelect=true);
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 10aa3be6ff72..8fd49e76158c 100755
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -958,6 +958,10 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
     const TextFrameIndex nNextDir = m_pScriptInfo->NextDirChg(rInf.GetIdx());
     nNextChg = std::min( nNextChg, nNextDir );
 
+    // hidden change (potentially via bookmark):
+    const TextFrameIndex nNextHidden = m_pScriptInfo->NextHiddenChg(rInf.GetIdx());
+    nNextChg = std::min( nNextChg, nNextHidden );
+
     // Turbo boost:
     // We assume that font characters are not larger than twice
     // as wide as height.
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 9361a9210388..6e0ddeaf3e16 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1450,6 +1450,18 @@ sal_uInt8 SwScriptInfo::DirType(const TextFrameIndex nPos) const
     return 0;
 }
 
+TextFrameIndex SwScriptInfo::NextHiddenChg(TextFrameIndex const nPos) const
+{
+    for (auto const it : m_HiddenChg)
+    {
+        if (nPos < it)
+        {
+            return it;
+        }
+    }
+    return TextFrameIndex(COMPLETE_STRING);
+}
+
 // Takes a string and replaced the hidden ranges with cChar.
 sal_Int32 SwScriptInfo::MaskHiddenRanges( const SwTextNode& rNode, OUStringBuffer & rText,
                                        const sal_Int32 nStt, const sal_Int32 nEnd,
commit 95b472b194ff2e7d95e68e360205664483281806
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Mon Feb 12 10:19:10 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Nov 15 17:48:03 2018 +0100

    tdf#101856: Use bookmark attributes at load
    
    Conflicts:
            sw/source/core/text/porlay.cxx
    
    Change-Id: I935c50f8b3a1d7179121b9230a7f7f25fa6aea22
    (cherry picked from commit f8afdb8ba99074a85b331065b4642081467557ec)
    Reviewed-on: https://gerrit.libreoffice.org/49578
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 97de51107824b5b3452e5343672c838da4b04b84)

diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 11e78a915433..9361a9210388 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -54,6 +54,7 @@
 #include <IDocumentRedlineAccess.hxx>
 #include <IDocumentSettingAccess.hxx>
 #include <IDocumentContentOperations.hxx>
+#include <IMark.hxx>
 
 using namespace ::com::sun::star;
 using namespace i18n::ScriptType;
@@ -2251,6 +2252,25 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTextNode& rNode, MultiSelect
             }
         }
     }
+
+    for (const SwIndex* pIndex = rNode.GetFirstIndex(); pIndex; pIndex = pIndex->GetNext())
+    {
+        const sw::mark::IMark* pMark = pIndex->GetMark();
+        const sw::mark::IBookmark* pBookmark = dynamic_cast<const sw::mark::IBookmark*>(pMark);
+        if (pBookmark && pBookmark->IsHidden())
+        {
+            // intersect bookmark range with textnode range and add the intersection to rHiddenMulti
+
+            const sal_Int32 nSt =  pBookmark->GetMarkStart().nContent.GetIndex();
+            const sal_Int32 nEnd = pBookmark->GetMarkEnd().nContent.GetIndex();
+
+            if( nEnd > nSt )
+            {
+                Range aTmp( nSt, nEnd - 1 );
+                rHiddenMulti.Select(aTmp, true);
+            }
+        }
+    }
 }
 
 void SwScriptInfo::selectRedLineDeleted(const SwTextNode& rNode, MultiSelection &rHiddenMulti, bool bSelect)
commit e9f38761cf082c7ae11ebd4fec231e7baee5cd75
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Thu Feb 8 13:19:01 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Nov 15 17:48:03 2018 +0100

    tdf#101856 odt: write/read new bookmark attributes: unit test
    
    (cherry picked from commit 61150f1c37744457e7a1a1c1e684612b6adf0298)
    Reviewed-on: https://gerrit.libreoffice.org/49424
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 8c2545153572b32ecba202e52aade84b188dac73)
    
    Conflicts:
            schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
            sw/qa/extras/odfexport/odfexport.cxx
    
    Change-Id: I094f91c2af2d171067e3c37a8d52276835d36e9c

diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index 76e6184886c7..031383cf2423 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -18048,6 +18048,21 @@
       <rng:value>bottom</rng:value>
     </rng:choice>
   </rng:define>
+
+  <!-- TODO no proposal -->
+  <rng:define name="text-bookmark-start-attlist" combine="interleave">
+    <rng:optional>
+      <rng:attribute name="loext:hidden">
+        <rng:ref name="boolean"/>
+      </rng:attribute>
+      <rng:optional>
+        <rng:attribute name="loext:condition">
+          <rng:ref name="string"/>
+        </rng:attribute>
+      </rng:optional>
+    </rng:optional>
+  </rng:define>
+
   <rng:define name="xforms-bind-attlist">
     <rng:optional>
       <rng:attribute name="xforms:bind">
diff --git a/sw/qa/extras/odfexport/data/tdf101856.odt b/sw/qa/extras/odfexport/data/tdf101856.odt
new file mode 100755
index 000000000000..bddd1502281c
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf101856.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 01327898daa0..4307aa68da23 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2062,6 +2062,52 @@ DECLARE_ODFEXPORT_TEST(tdf118502, "tdf118502.odt")
     CPPUNIT_ASSERT(xReplacementGraphic.is());
 }
 
+// MAILMERGE Add conditional to expand / collapse bookmarks
+DECLARE_ODFEXPORT_TEST(tdf101856, "tdf101856.odt")
+{
+    // get bookmark interface
+    uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+    uno::Reference<container::XNameAccess> xBookmarksByName(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+
+    // check: we have 2 bookmarks
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5), xBookmarksByIdx->getCount());
+    CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkVisible"));
+    CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkHidden"));
+    CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkVisibleWithCondition"));
+    CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkNotHiddenWithCondition"));
+    CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkHiddenWithCondition"));
+
+    // <text:bookmark-start text:name="BookmarkVisible"/>
+    uno::Reference<beans::XPropertySet> xBookmark1(xBookmarksByName->getByName("BookmarkVisible"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xBookmark1, UNO_NAME_BOOKMARK_CONDITION));
+    CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xBookmark1, UNO_NAME_BOOKMARK_HIDDEN));
+
+    // <text:bookmark-start text:name="BookmarkHidden" loext:condition="" loext:hidden="true"/>
+    uno::Reference<beans::XPropertySet> xBookmark2(xBookmarksByName->getByName("BookmarkHidden"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xBookmark2, UNO_NAME_BOOKMARK_CONDITION));
+    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xBookmark2, UNO_NAME_BOOKMARK_HIDDEN));
+
+    // <text:bookmark-start text:name="BookmarkVisibleWithCondition" loext:condition="0==1" loext:hidden="true"/>
+    uno::Reference<beans::XPropertySet> xBookmark3(xBookmarksByName->getByName("BookmarkVisibleWithCondition"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString("0==1"), getProperty<OUString>(xBookmark3, UNO_NAME_BOOKMARK_CONDITION));
+    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xBookmark3, UNO_NAME_BOOKMARK_HIDDEN));
+
+    // <text:bookmark-start text:name="BookmarkNotHiddenWithCondition" loext:condition="1==1" loext:hidden="false"/>
+    //
+    // The following test doesn't work, while during output in the case of loext:hidden="false".
+    // no additional parameters are written. Implementation should be reviewed.
+    //
+//    uno::Reference<beans::XPropertySet> xBookmark4(xBookmarksByName->getByName("BookmarkNotHiddenWithCondition"), uno::UNO_QUERY);
+//    CPPUNIT_ASSERT_EQUAL(OUString("1==1"), getProperty<OUString>(xBookmark4, UNO_NAME_BOOKMARK_CONDITION));
+//    CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xBookmark4, UNO_NAME_BOOKMARK_HIDDEN));
+
+    // <text:bookmark-start text:name="BookmarkHiddenWithCondition" loext:condition="1==1" loext:hidden="true"/>
+    uno::Reference<beans::XPropertySet> xBookmark5(xBookmarksByName->getByName("BookmarkHiddenWithCondition"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString("1==1"), getProperty<OUString>(xBookmark5, UNO_NAME_BOOKMARK_CONDITION));
+    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xBookmark5, UNO_NAME_BOOKMARK_HIDDEN));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit fcaafd92c015d87f6912553872cebb77bf7dfbae
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Thu Mar 1 13:00:33 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Nov 15 17:48:03 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>
    (cherry picked from commit 412b1f8d2b03687a13784e3055c5b0f2507dfef2)

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 )
 {
commit 0cb0026206d401c58165b7ad3ade90ead090a2d2
Author:     Bernhard Widl <bernhard.widl at cib.de>
AuthorDate: Wed Nov 15 19:30:28 2017 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Nov 15 17:48:02 2018 +0100

    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 <bernhard.widl at cib.de>
    (cherry picked from commit c347e00821791377731ab32acd103ea006f3cc1b)
    
    tdf#101856 Fix crash in Insert Bookmark dialog
    Author: Serge Krot <Serge.Krot at cib.de>
    Reviewed-on: https://gerrit.libreoffice.org/50616
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit bcc16920eec647f2a3753d60c4d969862f272942)
    
    Change-Id: Ib1df7a4c1477693aa2d0ec067635cdcbd393cebd
    Reviewed-on: https://gerrit.libreoffice.org/46820
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 7a586a9c6bf28088c72f163d724d1cb3259e7920)

diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx
index 39ff1d7108eb..3761b0ea08fb 100644
--- a/sw/inc/IMark.hxx
+++ b/sw/inc/IMark.hxx
@@ -90,6 +90,10 @@ namespace sw { namespace mark
             virtual const vcl::KeyCode& GetKeyCode() const =0;
             virtual void SetShortName(const OUString&) =0;
             virtual void SetKeyCode(const vcl::KeyCode&) =0;
+            virtual bool IsHidden() const =0;
+            virtual const OUString& GetHideCondition() const =0;
+            virtual void Hide(bool hide) =0;
+            virtual void SetHideCondition(const OUString&) =0;
         private:
             IBookmark(IBookmark&) = delete;
             IBookmark &operator =(IBookmark const&) = delete;
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index fccfd6c87bb9..377cae2b4121 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -781,6 +781,8 @@
 #define FN_SHAPE_ENDPOSITION_IN_HORI_L2R   (FN_PARAM2+26)
 #define FN_PARAM_PAM                    (FN_PARAM2+27) /* Point and Mark */
 #define FN_TEXT_BOX                     (FN_PARAM2+28) /* TextBox Property*/
+#define FN_BOOKMARK_HIDDEN              (FN_PARAM2+29) /* Hidden Property of bookmarks*/
+#define FN_BOOKMARK_CONDITION           (FN_PARAM2+30) /* Condition Property of bookmarks*/
 
 // Status: not more than 19!
 #define FN_STAT_PAGE                (FN_STAT + 1)
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 531452561fe9..e57153609256 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -533,6 +533,11 @@ public:
         const vcl::KeyCode&,
         const OUString& rName,
         IDocumentMarkAccess::MarkType eMark = IDocumentMarkAccess::MarkType::BOOKMARK);
+    ::sw::mark::IMark* SetBookmark2(
+        const vcl::KeyCode&,
+        const OUString& rName,
+        bool bHide,
+        const OUString& rCondition);
     bool GotoMark( const ::sw::mark::IMark* const pMark );    // sets CurrentCursor.SPoint
     bool GotoMark( const ::sw::mark::IMark* const pMark, bool bAtStart );
     bool GoNextBookmark(); // true, if there was one
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index fef14dcc9307..9be1de51bfe9 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -236,6 +236,8 @@
 #define STR_BOOKMARK_DEF_NAME                   NC_("STR_BOOKMARK_DEF_NAME", "Bookmark")
 #define STR_BOOKMARK_NAME                       NC_("STR_BOOKMARK_NAME", "Name")
 #define STR_BOOKMARK_TEXT                       NC_("STR_BOOKMARK_TEXT", "Text")
+#define STR_BOOKMARK_HIDDEN                     NC_("STR_BOOKMARK_HIDDEN", "Hidden")
+#define STR_BOOKMARK_CONDITION                  NC_("STR_BOOKMARK_CONDITION", "Condition")
 #define SW_STR_NONE                             NC_("SW_STR_NONE", "[None]")
 #define STR_CAPTION_BEGINNING                   NC_("STR_CAPTION_BEGINNING", "Start")
 #define STR_CAPTION_END                         NC_("STR_CAPTION_END", "End")
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 714d221d3712..a168bbc38498 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -343,6 +343,8 @@
 #define UNO_NAME_IS_GLOBAL_DOCUMENT_SECTION "IsGlobalDocumentSection"
 #define UNO_NAME_TEXT_FIELD "TextField"
 #define UNO_NAME_BOOKMARK "Bookmark"
+#define UNO_NAME_BOOKMARK_HIDDEN "BookmarkHidden"
+#define UNO_NAME_BOOKMARK_CONDITION "BookmarkCondition"
 #define UNO_NAME_TEXT_TABLE "TextTable"
 #define UNO_NAME_CELL "Cell"
 #define UNO_NAME_TEXT_FRAME "TextFrame"
diff --git a/sw/qa/uitest/writer_tests/bookmark.py b/sw/qa/uitest/writer_tests/bookmark.py
index 33f88d594c7a..9cbf82c29b41 100644
--- a/sw/qa/uitest/writer_tests/bookmark.py
+++ b/sw/qa/uitest/writer_tests/bookmark.py
@@ -94,7 +94,7 @@ class bookmarkDialog(UITestCase):
         x1stListEntry = xBmk.getChild("O") #  select first bookmark - name "newname"
         x1stListEntry.executeAction("SELECT", tuple())
 
-        self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tnewname\t")  #check the new name "newname"
+        self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tnewname\t\tNo\t")  #check the new name "newname"
 
         xCloseBtn = xBookDlg.getChild("close")
         self.ui_test.close_dialog_through_button(xCloseBtn)
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 8ea7445ea676..05b999ac8e20 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -287,6 +287,7 @@ namespace sw { namespace mark
         : DdeBookmark(aPaM)
         , ::sfx2::Metadatable()
         , m_aCode(rCode)
+        , m_bHidden(false)
     {
         m_aName = rName;
     }
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
index cae3a0b17fca..7a7f9186ac18 100644
--- a/sw/source/core/crsr/crbm.cxx
+++ b/sw/source/core/crsr/crbm.cxx
@@ -98,6 +98,31 @@ namespace
 }
 // set CurrentCursor.SPoint
 
+// at CurrentCursor.SPoint
+::sw::mark::IMark* SwCursorShell::SetBookmark2(
+    const vcl::KeyCode& rCode,
+    const OUString& rName,
+    bool bHide,
+    const OUString& rCondition)
+{
+    StartAction();
+    ::sw::mark::IMark* pMark = getIDocumentMarkAccess()->makeMark(
+        *GetCursor(),
+        rName,
+        IDocumentMarkAccess::MarkType::BOOKMARK, sw::mark::InsertMode::New);
+    ::sw::mark::IBookmark* pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pMark);
+    if (pBookmark)
+    {
+        pBookmark->SetKeyCode(rCode);
+        pBookmark->SetShortName(OUString());
+        pBookmark->Hide(bHide);
+        pBookmark->SetHideCondition(rCondition);
+    }
+    EndAction();
+    return pMark;
+}
+// set CurrentCursor.SPoint
+
 bool SwCursorShell::GotoMark(const ::sw::mark::IMark* const pMark, bool bAtStart)
 {
     // watch Cursor-Moves
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index 4fa2ef87c772..001f8561b012 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -175,6 +175,14 @@ namespace sw {
                 { m_sShortName = rShortName; }
             virtual void SetKeyCode(const vcl::KeyCode& rCode) override
                 { m_aCode = rCode; }
+            virtual bool IsHidden() const override
+                { return m_bHidden; }
+            virtual const OUString& GetHideCondition() const override
+                { return m_sHideCondition; }
+            virtual void Hide(bool rHide) override
+                { m_bHidden = rHide; }
+            virtual void SetHideCondition(const OUString& rHideCondition) override
+                { m_sHideCondition = rHideCondition; }
 
             // ::sfx2::Metadatable
             virtual ::sfx2::IXmlIdRegistry& GetRegistry() override;
@@ -186,6 +194,8 @@ namespace sw {
         private:
             vcl::KeyCode m_aCode;
             OUString m_sShortName;
+            bool m_bHidden;
+            OUString m_sHideCondition;
         };
 
         class Fieldmark
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 2149ba0614f6..a66247f33fe1 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -56,11 +56,14 @@ public:
     SwDoc* m_pDoc;
     ::sw::mark::IMark* m_pRegisteredBookmark;
     OUString m_sMarkName;
+    bool m_bHidden;
+    OUString m_HideCondition;
 
     Impl( SwDoc *const pDoc )
         : m_EventListeners(m_Mutex)
         , m_pDoc(pDoc)
         , m_pRegisteredBookmark(nullptr)
+        , m_bHidden(false)
     {
         // DO NOT registerInMark here! (because SetXBookmark would delete rThis)
     }
@@ -105,6 +108,14 @@ void SwXBookmark::Impl::registerInMark(SwXBookmark& rThis,
     else if (m_pRegisteredBookmark)
     {
         m_sMarkName = m_pRegisteredBookmark->GetName();
+
+        // the following applies only to bookmarks (not to fieldmarks)
+        IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pRegisteredBookmark);
+        if (pBookmark)
+        {
+            m_bHidden = pBookmark->IsHidden();
+            m_HideCondition = pBookmark->GetHideCondition();
+        }
         EndListeningAll();
     }
     m_pRegisteredBookmark = pBkmk;
@@ -394,8 +405,43 @@ SwXBookmark::getPropertySetInfo()
 
 void SAL_CALL
 SwXBookmark::setPropertyValue(const OUString& PropertyName,
-        const uno::Any& /*rValue*/)
+        const uno::Any& rValue)
 {
+    if (PropertyName == UNO_NAME_BOOKMARK_HIDDEN)
+    {
+        bool bNewValue = false;
+        if (!(rValue >>= bNewValue))
+            throw lang::IllegalArgumentException("Property BookmarkHidden requires value of type boolean", nullptr, 0);
+
+        IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pImpl->m_pRegisteredBookmark);
+        if (pBookmark)
+        {
+            pBookmark->Hide(bNewValue);
+        }
+        else
+        {
+            m_pImpl->m_bHidden = bNewValue;
+        }
+        return;
+    }
+    else if (PropertyName == UNO_NAME_BOOKMARK_CONDITION)
+    {
+        OUString newValue;
+        if (!(rValue >>= newValue))
+            throw lang::IllegalArgumentException("Property BookmarkCondition requires value of type string", nullptr, 0);
+
+        IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pImpl->m_pRegisteredBookmark);
+        if (pBookmark)
+        {
+            pBookmark->SetHideCondition(newValue);
+        }
+        else
+        {
+            m_pImpl->m_HideCondition = newValue;
+        }
+        return;
+    }
+
     // nothing to set here
     throw lang::IllegalArgumentException("Property is read-only: "
             + PropertyName, static_cast< cppu::OWeakObject * >(this), 0 );
@@ -412,6 +458,30 @@ uno::Any SAL_CALL SwXBookmark::getPropertyValue(const OUString& rPropertyName)
         {
             aRet <<= getName();
         }
+        else if (rPropertyName == UNO_NAME_BOOKMARK_HIDDEN)
+        {
+            IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pImpl->m_pRegisteredBookmark);
+            if (pBookmark)
+            {
+                aRet <<= pBookmark->IsHidden();
+            }
+            else
+            {
+                aRet <<= m_pImpl->m_bHidden;
+            }
+        }
+        else if (rPropertyName == UNO_NAME_BOOKMARK_CONDITION)
+        {
+            IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pImpl->m_pRegisteredBookmark);
+            if (pBookmark)
+            {
+                aRet <<= pBookmark->GetHideCondition();
+            }
+            else
+            {
+                aRet <<= m_pImpl->m_HideCondition;
+            }
+        }
     }
     return aRet;
 }
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 273edc7c4dab..de331a18cbf8 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -988,6 +988,8 @@ const SfxItemPropertyMapEntry*  SwUnoPropertyMapProvider::GetBookmarkPropertyMap
     {
         { OUString(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME,  cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0xbf},
         COMMON_TEXT_CONTENT_PROPERTIES
+        { OUString(UNO_NAME_BOOKMARK_HIDDEN), FN_BOOKMARK_HIDDEN,  cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 },
+        { OUString(UNO_NAME_BOOKMARK_CONDITION), FN_BOOKMARK_CONDITION,  cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0 },
         { OUString(), 0, css::uno::Type(), 0, 0 }
     };
 
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 309892627b47..758b85ff73e2 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -211,7 +211,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, RenameHdl, Button*, void)
 IMPL_LINK_NOARG(SwInsertBookmarkDlg, InsertHdl, Button*, void)
 {
     OUString sBookmark = m_pEditBox->GetText();
-    rSh.SetBookmark(vcl::KeyCode(), sBookmark);
+    rSh.SetBookmark2(vcl::KeyCode(), sBookmark, m_pHideCB->IsChecked(), m_pConditionED->GetText());
     rReq.AppendItem(SfxStringItem(FN_INSERT_BOOKMARK, sBookmark));
     rReq.Done();
     if (!rReq.IsDone())
@@ -220,6 +220,13 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, InsertHdl, Button*, void)
     EndDialog(RET_OK);
 }
 
+IMPL_LINK(SwInsertBookmarkDlg, ChangeHideHdl, Button *, pBox, void)
+{
+    bool bHide = static_cast<CheckBox*>(pBox)->IsChecked();
+    m_pConditionED->Enable(bHide);
+    m_pConditionFT->Enable(bHide);
+}
+
 void SwInsertBookmarkDlg::GotoSelectedBookmark()
 {
     if (!ValidateBookmarks())
@@ -305,6 +312,9 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg(vcl::Window* pParent, SwWrtShell& rS, S
     get(m_pDeleteBtn, "delete");
     get(m_pGotoBtn, "goto");
     get(m_pRenameBtn, "rename");
+    get(m_pHideCB, "hide");
+    get(m_pConditionFT, "condlabel");
+    get(m_pConditionED, "withcond");
 
     m_pBookmarksBox = VclPtr<BookmarkTable>::Create(*m_pBookmarksContainer);
 
@@ -316,6 +326,7 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg(vcl::Window* pParent, SwWrtShell& rS, S
     m_pDeleteBtn->SetClickHdl(LINK(this, SwInsertBookmarkDlg, DeleteHdl));
     m_pGotoBtn->SetClickHdl(LINK(this, SwInsertBookmarkDlg, GotoHdl));
     m_pRenameBtn->SetClickHdl(LINK(this, SwInsertBookmarkDlg, RenameHdl));
+    m_pHideCB->SetClickHdl(LINK(this, SwInsertBookmarkDlg, ChangeHideHdl));
 
     m_pDeleteBtn->Disable();
     m_pGotoBtn->Disable();
@@ -343,35 +354,43 @@ void SwInsertBookmarkDlg::dispose()
     m_pGotoBtn.clear();
     m_pEditBox.clear();
     m_pRenameBtn.clear();
+    m_pHideCB.clear();
+    m_pConditionFT.clear();
+    m_pConditionED.clear();
     SvxStandardDialog::dispose();
 }
 
 BookmarkTable::BookmarkTable(SvSimpleTableContainer& rParent) :
     SvSimpleTable(rParent, 0)
 {
-    static long nTabs[] = {0, 40, 150};
+    static long nTabs[] = { 0, 40, 150, 300, 340 };
 
     SetTabs(SAL_N_ELEMENTS(nTabs), nTabs, MapUnit::MapPixel);
     SetSelectionMode(SelectionMode::Multiple);
     InsertHeaderEntry(SwResId(STR_PAGE));
     InsertHeaderEntry(SwResId(STR_BOOKMARK_NAME));
     InsertHeaderEntry(SwResId(STR_BOOKMARK_TEXT));
+    InsertHeaderEntry(SwResId(STR_BOOKMARK_HIDDEN));
+    InsertHeaderEntry(SwResId(STR_BOOKMARK_CONDITION));
 
     rParent.SetTable(this);
 }
 
 void BookmarkTable::InsertBookmark(sw::mark::IMark* pMark)
 {
-    OUString sBookmarkNodeText = pMark->GetMarkStart().nNode.GetNode().GetTextNode()->GetText();
-    sal_Int32 nBookmarkNodeTextPos = pMark->GetMarkStart().nContent.GetIndex();
+    sw::mark::IBookmark* pBookmark = dynamic_cast<sw::mark::IBookmark*>(pMark);
+    assert(pBookmark);
+
+    OUString sBookmarkNodeText = pBookmark->GetMarkStart().nNode.GetNode().GetTextNode()->GetText();
+    sal_Int32 nBookmarkNodeTextPos = pBookmark->GetMarkStart().nContent.GetIndex();
     sal_Int32 nBookmarkTextLen = 0;
     bool bPulledAll = false;
     bool bPulling = false;
     static const sal_Int32 nMaxTextLen = 50;
 
-    if (pMark->IsExpanded())
+    if (pBookmark->IsExpanded())
     {
-        nBookmarkTextLen = pMark->GetMarkEnd().nContent.GetIndex() - nBookmarkNodeTextPos;
+        nBookmarkTextLen = pBookmark->GetMarkEnd().nContent.GetIndex() - nBookmarkNodeTextPos;
     }
     else
     {
@@ -392,8 +411,12 @@ void BookmarkTable::InsertBookmark(sw::mark::IMark* pMark)
     else if (bPulling && !bPulledAll)
         sBookmarkNodeText = "..." + sBookmarkNodeText;
 
+    OUString sHidden = "No";
+    if (pBookmark->IsHidden())
+        sHidden = "Yes";
+    OUString sHideCondition = pBookmark->GetHideCondition();
     OUString sPageNum = OUString::number(SwPaM(pMark->GetMarkStart()).GetPageNum());
-    OUString sColumnData = sPageNum + "\t" + pMark->GetName() + "\t" + sBookmarkNodeText;
+    OUString sColumnData = sPageNum + "\t" + pBookmark->GetName() + "\t" + sBookmarkNodeText + "\t" + sHidden + "\t" + sHideCondition;
     InsertEntryToColumn(sColumnData, TREELIST_APPEND, 0xffff, pMark);
 }
 
diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/uibase/inc/bookmark.hxx
index e8554052b9aa..98682a941ffe 100644
--- a/sw/source/uibase/inc/bookmark.hxx
+++ b/sw/source/uibase/inc/bookmark.hxx
@@ -24,6 +24,7 @@
 #include <ndtxt.hxx>
 
 #include <vcl/button.hxx>
+#include "condedit.hxx"
 #include <svtools/simptabl.hxx>
 #include <pam.hxx>
 
@@ -55,6 +56,9 @@ class SwInsertBookmarkDlg: public SvxStandardDialog
     VclPtr<PushButton>                  m_pDeleteBtn;
     VclPtr<PushButton>                  m_pGotoBtn;
     VclPtr<PushButton>                  m_pRenameBtn;
+    VclPtr<CheckBox>                    m_pHideCB;
+    VclPtr<FixedText>                   m_pConditionFT;
+    VclPtr<ConditionEdit>               m_pConditionED;
     OUString                            sRemoveWarning;
     SwWrtShell&                         rSh;
     SfxRequest&                         rReq;
@@ -68,6 +72,7 @@ class SwInsertBookmarkDlg: public SvxStandardDialog
     DECL_LINK(GotoHdl, Button*, void);
     DECL_LINK(SelectionChangedHdl, SvTreeListBox*, void);
     DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
+    DECL_LINK(ChangeHideHdl, Button *, void);
 
     // Fill table with bookmarks
     void PopulateTable();
diff --git a/sw/uiconfig/swriter/ui/insertbookmark.ui b/sw/uiconfig/swriter/ui/insertbookmark.ui
index 17c0633459c0..6079aefe7a88 100644
--- a/sw/uiconfig/swriter/ui/insertbookmark.ui
+++ b/sw/uiconfig/swriter/ui/insertbookmark.ui
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.0 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
+  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkDialog" id="InsertBookmarkDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
@@ -26,30 +27,17 @@
               <packing>
                 <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="pack_type">start</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButtonBox" id="box5">
+              <object class="GtkButton" id="insert">
+                <property name="label" translatable="yes" context="insertbookmark|insert">Insert</property>
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkButton" id="insert">
-                    <property name="label" translatable="yes" context="insertbookmark|insert">Insert</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="can_default">True</property>
-                    <property name="has_default">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -66,16 +54,70 @@
           </packing>
         </child>
         <child>
+          <object class="GtkCheckButton" id="hide">
+            <property name="label" translatable="yes" context="insertbookmark|hide">H_ide</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="halign">start</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkLabel" id="condlabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes" context="insertbookmark|condlabel">_With condition</property>
+                <property name="mnemonic_widget">withcond</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="swlo-ConditionEdit" id="withcond">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
           <object class="svtlo-SvSimpleTableContainer" id="bookmarks">
             <property name="width_request">350</property>
             <property name="height_request">250</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <child internal-child="selection">
+              <object class="GtkTreeSelection"/>
+            </child>
           </object>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">3</property>
           </packing>
         </child>
         <child>
@@ -84,92 +126,25 @@
             <property name="can_focus">False</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkButtonBox" id="box4">
+              <object class="GtkButton" id="goto">
+                <property name="label" translatable="yes" context="insertbookmark|goto">Go to</property>
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkButton" id="help">
-                    <property name="label">gtk-help</property>
-                    <property name="width_request">75</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_stock">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="pack_type">start</property>
+                <property name="pack_type">end</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButtonBox" id="box4">
+              <object class="GtkButton" id="delete">
+                <property name="label" translatable="yes" context="insertbookmark|delete">Delete</property>
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="homogeneous">True</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkButton" id="rename">
-                    <property name="label" translatable="yes" context="insertbookmark|rename">Rename</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="delete">
-                    <property name="label" translatable="yes" context="insertbookmark|delete">Delete</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="goto">
-                    <property name="label" translatable="yes" context="insertbookmark|goto">Go to</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="close">
-                    <property name="label">gtk-close</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_stock">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">3</property>
-                  </packing>
-                </child>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -178,11 +153,64 @@
                 <property name="position">1</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkButton" id="rename">
+                <property name="label" translatable="yes" context="insertbookmark|rename">Rename</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="pack_type">end</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">2</property>
+            <property name="position">4</property>
+          </packing>
+        </child>
+        <child internal-child="action_area" id="dialog-action_area1">
+          <object class="GtkButtonBox">
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="close">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">5</property>
           </packing>
         </child>
       </object>
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<XPropertySet> bkmkProps(rPropSet->getPropertyValue(rProperty), UNO_QUERY);
+            Reference<XPropertySetInfo> 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);
commit 102651c266989a898b6e69c3f7ee6c1ae7ec110b
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Tue Nov 6 10:16:25 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Nov 15 17:48:02 2018 +0100

    tdf#118582 Disable signature line signing once it is signed
    
    Change-Id: I720d7d4920ae9c2f5d74ad827e1e214a62fe81a9
    Reviewed-on: https://gerrit.libreoffice.org/62947
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 7b6f477799d55d80775b6120ba0b5ce1bb45fb3c)

diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 8ac52ede237f..67ccc1975329 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -175,6 +175,7 @@
 #define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE "SignatureLineShowSignDate"
 #define UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT "SignatureLineCanAddComment"
 #define UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE "SignatureLineUnsignedImage"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_IS_SIGNED "SignatureLineIsSigned"
 
 #define UNO_NAME_OLE2_METAFILE                  "MetaFile"
 #define UNO_NAME_OLE2_PERSISTNAME               "PersistName"
diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc
index 1945323042b5..b783e898964d 100644
--- a/include/svl/solar.hrc
+++ b/include/svl/solar.hrc
@@ -23,7 +23,7 @@
 // defines ------------------------------------------------------------------
 
 #define OWN_ATTR_VALUE_START                    3900
-#define OWN_ATTR_VALUE_END                      4002
+#define OWN_ATTR_VALUE_END                      4003
 
 #define RID_LIB_START               10000
 #define RID_LIB_END                 19999
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 1718b967a4c3..46b413596d90 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -112,6 +112,7 @@ private:
     OUString maSignatureLineSigningInstructions;
     bool mbIsSignatureLineShowSignDate;
     bool mbIsSignatureLineCanAddComment;
+    bool mbSignatureLineIsSigned;
     css::uno::Reference<css::graphic::XGraphic> mpSignatureLineUnsignedGraphic;
 
     void                    ImpRegisterLink();
@@ -283,6 +284,8 @@ public:
     {
         mpSignatureLineUnsignedGraphic = rGraphic;
     };
+    bool isSignatureLineSigned() const { return mbSignatureLineIsSigned; };
+    void setSignatureLineIsSigned(bool bIsSigned) { mbSignatureLineIsSigned = bIsSigned; }
 };
 
 #endif // INCLUDED_SVX_SVDOGRAF_HXX
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 6341c37f3dc6..0ac66b706ebd 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -190,7 +190,8 @@
 #define OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE   (OWN_ATTR_VALUE_START+100)
 #define OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT  (OWN_ATTR_VALUE_START+101)
 #define OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE   (OWN_ATTR_VALUE_START+102)
-// ATTENTION: maximum is OWN_ATTR_VALUE_START+102 svx, see include/svl/solar.hrc
+#define OWN_ATTR_SIGNATURELINE_IS_SIGNED        (OWN_ATTR_VALUE_START+103)
+// ATTENTION: maximum is OWN_ATTR_VALUE_START+103 svx, see include/svl/solar.hrc
 
 // #FontWork#
 #define FONTWORK_PROPERTIES \
@@ -440,7 +441,8 @@
     { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_SIGNING_INSTRUCTIONS), OWN_ATTR_SIGNATURELINE_SIGNING_INSTRUCTIONS, cppu::UnoType<OUString>::get(), 0, 0}, \
     { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE), OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE, cppu::UnoType<bool>::get(), 0, 0}, \
     { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT), OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT, cppu::UnoType<bool>::get(), 0, 0}, \
-    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE), OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0},
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE), OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_IS_SIGNED), OWN_ATTR_SIGNATURELINE_IS_SIGNED, cppu::UnoType<bool>::get(), 0, 0},
 
 #define SPECIAL_3DSCENEOBJECT_PROPERTIES_DEFAULTS \
     { OUString(UNO_NAME_3D_SCENE_AMBIENTCOLOR),     SDRATTR_3DSCENE_AMBIENTCOLOR   , ::cppu::UnoType<sal_Int32>::get(),   0,  0}, \
diff --git a/offapi/com/sun/star/drawing/GraphicObjectShape.idl b/offapi/com/sun/star/drawing/GraphicObjectShape.idl
index 2c319ccf8de5..defad53e97e0 100644
--- a/offapi/com/sun/star/drawing/GraphicObjectShape.idl
+++ b/offapi/com/sun/star/drawing/GraphicObjectShape.idl
@@ -151,6 +151,9 @@ published service GraphicObjectShape
      *  (you can get the matching signature with the SignatureLineId property).
      */
     [optional, property] com::sun::star::graphic::XGraphic SignatureLineUnsignedImage;
+
+    /// Whether the signature line is signed using a digital signature
+    [optional, property] boolean SignatureLineIsSigned;
 };
 
 
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 40a547a2efe2..a333baff4ac4 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1248,6 +1248,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
     if( getShapeModel().mbIsSignatureLine )
     {
         uno::Reference<graphic::XGraphic> xGraphic;
+        bool bIsSigned(false);
         try
         {
             // Get the document signatures
@@ -1271,6 +1272,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list