[Libreoffice-commits] core.git: sw/inc sw/qa sw/source sw/uiconfig xmloff/source

Bernhard Widl bernhard.widl at cib.de
Fri Jul 6 08:22:16 UTC 2018


 sw/inc/IMark.hxx                         |    4 
 sw/inc/cmdid.h                           |    2 
 sw/inc/crsrsh.hxx                        |    5 
 sw/inc/strings.hrc                       |    2 
 sw/inc/unoprnms.hxx                      |    2 
 sw/qa/uitest/writer_tests2/bookmark.py   |    2 
 sw/source/core/crsr/bookmrk.cxx          |    1 
 sw/source/core/crsr/crbm.cxx             |   25 +++
 sw/source/core/inc/bookmrk.hxx           |   10 +
 sw/source/core/unocore/unobkm.cxx        |   72 +++++++++
 sw/source/core/unocore/unomap1.cxx       |    2 
 sw/source/ui/misc/bookmark.cxx           |   37 ++++-
 sw/source/uibase/inc/bookmark.hxx        |    5 
 sw/uiconfig/swriter/ui/insertbookmark.ui |  224 +++++++++++++++++--------------
 xmloff/source/text/txtparae.cxx          |   24 +++
 15 files changed, 310 insertions(+), 107 deletions(-)

New commits:
commit 7a586a9c6bf28088c72f163d724d1cb3259e7920
Author: Bernhard Widl <bernhard.widl at cib.de>
Date:   Wed Nov 15 19:30:28 2017 +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>

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_tests2/bookmark.py b/sw/qa/uitest/writer_tests2/bookmark.py
index 33f88d594c7a..9cbf82c29b41 100644
--- a/sw/qa/uitest/writer_tests2/bookmark.py
+++ b/sw/qa/uitest/writer_tests2/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 10365bd83082..6716483ea1a8 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 1b9395d4c1f7..f2eb26d68384 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -209,7 +209,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())
@@ -218,6 +218,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())
@@ -303,6 +310,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);
 
@@ -314,6 +324,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();
@@ -341,35 +352,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
     {
@@ -390,8 +409,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);


More information about the Libreoffice-commits mailing list