sw/source/uibase/sidebar/PageMarginControl.cxx |   13 ++++++++++++-
 sw/source/uibase/sidebar/PageMarginControl.hxx |    2 ++
 sw/uiconfig/swriter/ui/pagemargincontrol.ui    |   17 +++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit f7f96175d37d87b266e85726ae01877a39251f16
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Thu Jun 29 11:27:36 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Fri Jun 30 19:14:30 2023 +0200

    tdf#141720 sw pagemargincontrol: add more options
    
    There are advanced gutter controls available,
    so lets just add more options to this one as well.
    
    It already exists for Page Size and Page Columns.
    
    Change-Id: I5a94044fd18b57962272d8099cf17fdb71e83d1c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153775
    Tested-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx 
b/sw/source/uibase/sidebar/PageMarginControl.cxx
index 217c6f7d7fa7..ffeebc15d140 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.cxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.cxx
@@ -91,6 +91,7 @@ namespace sw::sidebar {
 
 PageMarginControl::PageMarginControl(PageMarginPopup* pControl, weld::Widget* 
pParent)
     : WeldToolbarPopup(pControl->getFrameInterface(), pParent, 
"modules/swriter/ui/pagemargincontrol.ui", "PageMarginControl")
+    , m_xMoreButton(m_xBuilder->weld_button("moreoptions"))
     , m_xLeft(m_xBuilder->weld_label("leftLabel"))
     , m_xRight(m_xBuilder->weld_label("rightLabel"))
     , m_xInner(m_xBuilder->weld_label("innerLabel"))
@@ -170,12 +171,14 @@ PageMarginControl::PageMarginControl(PageMarginPopup* 
pControl, weld::Widget* pP
     m_xWide->show();
     m_xMirrored->show();
     m_xLast->show();
+    m_xMoreButton->show();
 
     m_xNarrow->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl 
) );
     m_xNormal->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl 
) );
     m_xWide->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) 
);
     m_xMirrored->connect_clicked( LINK( this, PageMarginControl, 
SelectMarginHdl ) );
     m_xLast->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) 
);
+    m_xMoreButton->connect_clicked( LINK(this, PageMarginControl, 
MoreButtonClickHdl_Impl));
 
     m_bUserCustomValuesAvailable = GetUserCustomValues();
 
@@ -223,7 +226,7 @@ PageMarginControl::PageMarginControl(PageMarginPopup* 
pControl, weld::Widget* pP
 
 void PageMarginControl::GrabFocus()
 {
-    m_xNarrow->grab_focus();
+    m_xMoreButton->grab_focus();
 }
 
 PageMarginControl::~PageMarginControl()
@@ -470,6 +473,14 @@ IMPL_LINK_NOARG( PageMarginControl, ModifyULMarginHdl, 
weld::MetricSpinButton&,
     m_bCustomValuesUsed = true;
 }
 
+IMPL_LINK_NOARG(PageMarginControl, MoreButtonClickHdl_Impl, weld::Button&, 
void)
+{
+    if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+        
pViewFrm->GetBindings().GetDispatcher()->Execute(FN_FORMAT_PAGE_SETTING_DLG,
+                                                         
SfxCallMode::ASYNCHRON);
+    m_xControl->EndPopupMode();
+}
+
 bool PageMarginControl::GetUserCustomValues()
 {
     bool bUserCustomValuesAvailable = false;
diff --git a/sw/source/uibase/sidebar/PageMarginControl.hxx 
b/sw/source/uibase/sidebar/PageMarginControl.hxx
index aa199dd4adde..6cfb7b05bf7c 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.hxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.hxx
@@ -50,6 +50,7 @@ private:
     std::unique_ptr<weld::Button> m_xWide;
     std::unique_ptr<weld::Button> m_xMirrored;
     std::unique_ptr<weld::Button> m_xLast;
+    std::unique_ptr<weld::Button> m_xMoreButton;
 
     std::unique_ptr<weld::Label> m_xLeft;
     std::unique_ptr<weld::Label> m_xRight;
@@ -88,6 +89,7 @@ private:
     DECL_LINK( SelectMarginHdl, weld::Button&, void );
     DECL_LINK( ModifyLRMarginHdl, weld::MetricSpinButton&, void );
     DECL_LINK( ModifyULMarginHdl, weld::MetricSpinButton&, void );
+    DECL_LINK(MoreButtonClickHdl_Impl, weld::Button&, void);
 
     static void ExecuteMarginLRChange(
         const tools::Long nPageLeftMargin,
diff --git a/sw/uiconfig/swriter/ui/pagemargincontrol.ui 
b/sw/uiconfig/swriter/ui/pagemargincontrol.ui
index 242eeb106acc..e83cd135a997 100644
--- a/sw/uiconfig/swriter/ui/pagemargincontrol.ui
+++ b/sw/uiconfig/swriter/ui/pagemargincontrol.ui
@@ -469,6 +469,23 @@
             <property name="position">11</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkButton" id="moreoptions">
+            <property name="label" translatable="yes" 
context="pagemargincontrol|moreoptions">_More Options</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="tooltip_text" translatable="yes" 
context="pagemargincontrol|moreoptions|tooltip_text">More Options</property>
+            <property name="relief">none</property>
+            <property name="use_underline">True</property>
+            <property name="always_show_image">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">12</property>
+          </packing>
+        </child>
       </object>
     </child>
   </object>

Reply via email to