sw/source/ui/misc/bookmark.cxx           |   20 ++++++--
 sw/uiconfig/swriter/ui/insertbookmark.ui |   74 ++++++++++++++++---------------
 2 files changed, 56 insertions(+), 38 deletions(-)

New commits:
commit ad1da9345b75dbe3ed9c503916c83c38d8a2e22f
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Fri Dec 17 09:02:54 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Jan 31 12:22:49 2022 +0100

    Resolves tdf#146261 - Remember size of bookmark dialog
    
    Change-Id: I0c6f20692af88c603106d76c45c722cdb7deb118
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126993
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 77ff0b3bbd49..90c905d7a408 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -20,6 +20,7 @@
 #include <rtl/ustrbuf.hxx>
 #include <sfx2/request.hxx>
 #include <svl/stritem.hxx>
+#include <unotools/viewoptions.hxx>
 #include <vcl/weld.hxx>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/text/XBookmarksSupplier.hpp>
@@ -349,6 +350,20 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg(weld::Window* 
pParent, SwWrtShell& rS)
     // disabled until "Hide" flag is not checked
     m_xConditionED->set_sensitive(false);
     m_xConditionFT->set_sensitive(false);
+
+    // restore dialog size
+    SvtViewOptions aDlgOpt(EViewType::Dialog, "BookmarkDialog");
+    if (aDlgOpt.Exists())
+        m_xDialog->set_window_state(aDlgOpt.GetWindowState().toUtf8());
+}
+
+SwInsertBookmarkDlg::~SwInsertBookmarkDlg()
+{
+    // tdf#146261 - Remember size of bookmark dialog
+    SvtViewOptions aDlgOpt(EViewType::Dialog, "BookmarkDialog");
+    OString sWindowState
+        = m_xDialog->get_window_state(WindowStateMask::Pos | 
WindowStateMask::Size);
+    aDlgOpt.SetWindowState(OUString::fromUtf8(sWindowState));
 }
 
 IMPL_LINK(SwInsertBookmarkDlg, HeaderBarClick, int, nColumn, void)
@@ -382,13 +397,10 @@ IMPL_LINK(SwInsertBookmarkDlg, HeaderBarClick, int, 
nColumn, void)
     }
 }
 
-SwInsertBookmarkDlg::~SwInsertBookmarkDlg() {}
-
 BookmarkTable::BookmarkTable(std::unique_ptr<weld::TreeView> xControl)
     : m_xControl(std::move(xControl))
 {
-    m_xControl->set_size_request(450, 250);
-    m_xControl->set_column_fixed_widths({ 40, 110, 150, 160 });
+    m_xControl->set_size_request(-1, m_xControl->get_height_rows(8));
     m_xControl->set_selection_mode(SelectionMode::Multiple);
 }
 
diff --git a/sw/uiconfig/swriter/ui/insertbookmark.ui 
b/sw/uiconfig/swriter/ui/insertbookmark.ui
index e8e4aebacd7e..0cd5225733f0 100644
--- a/sw/uiconfig/swriter/ui/insertbookmark.ui
+++ b/sw/uiconfig/swriter/ui/insertbookmark.ui
@@ -74,11 +74,10 @@
           </packing>
         </child>
         <child>
-          <!-- n-columns=3 n-rows=5 -->
+          <!-- n-columns=3 n-rows=4 -->
           <object class="GtkGrid">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
-            <property name="vexpand">True</property>
             <property name="row-spacing">6</property>
             <property name="column-spacing">6</property>
             <child>
@@ -122,6 +121,7 @@
                 <property name="can-default">True</property>
                 <property name="has-default">True</property>
                 <property name="receives-default">True</property>
+                <property name="halign">end</property>
               </object>
               <packing>
                 <property name="left-attach">2</property>
@@ -186,25 +186,36 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="lbBookmarks">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
-                <property name="halign">start</property>
-                <property name="valign">start</property>
-                <property name="vexpand">True</property>
-                <property name="label" translatable="yes" 
context="insertbookmark|bookmarks">_Bookmarks:</property>
-                <property name="use-underline">True</property>
-                <property name="mnemonic-widget">bookmarks</property>
-              </object>
-              <packing>
-                <property name="left-attach">0</property>
-                <property name="top-attach">4</property>
-              </packing>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="label-xalign">0</property>
+            <property name="shadow-type">none</property>
             <child>
               <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
+                <property name="margin-start">12</property>
+                <property name="margin-top">6</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
                 <property name="shadow-type">in</property>
@@ -219,7 +230,7 @@
                     <property name="search-column">0</property>
                     <property name="show-expanders">False</property>
                     <child internal-child="selection">
-                      <object class="GtkTreeSelection" id="Macro Library 
List-selection2"/>
+                      <object class="GtkTreeSelection"/>
                     </child>
                     <child>
                       <object class="GtkTreeViewColumn" id="treeviewcolumn0">
@@ -294,27 +305,22 @@
                   </object>
                 </child>
               </object>
-              <packing>
-                <property name="left-attach">1</property>
-                <property name="top-attach">4</property>
-                <property name="width">2</property>
-              </packing>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
             </child>
-            <child>
-              <placeholder/>
+            <child type="label">
+              <object class="GtkLabel" id="lbBookmarks">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="label" translatable="yes" 
context="insertbookmark|bookmarks">_Bookmarks:</property>
+                <property name="use-underline">True</property>
+                <property name="mnemonic-widget">bookmarks</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
             </child>
           </object>
           <packing>
-            <property name="expand">False</property>
+            <property name="expand">True</property>
             <property name="fill">True</property>
             <property name="position">1</property>
           </packing>

Reply via email to