[Libreoffice-commits] core.git: solenv/sanitizers sw/inc sw/source sw/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 14 20:26:52 UTC 2020


 solenv/sanitizers/ui/modules/swriter.suppr          |   11 
 sw/inc/PageMarginPopup.hxx                          |    1 
 sw/source/uibase/sidebar/PageMarginControl.cxx      |  244 +++++++++-----------
 sw/source/uibase/sidebar/PageMarginControl.hxx      |   51 +---
 sw/source/uibase/sidebar/PageMarginPopup.cxx        |   14 -
 sw/source/uibase/sidebar/PageOrientationControl.cxx |    1 
 sw/uiconfig/swriter/ui/pagemargincontrol.ui         |  105 +++++---
 7 files changed, 219 insertions(+), 208 deletions(-)

New commits:
commit 0b87cacaedf47c49065df284f8d10d40d664f9bd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 14 16:33:52 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 14 21:26:21 2020 +0100

    weld PageMarginControl
    
    Change-Id: Ie0af7bf21a8804620746fe42ad009717db65bf24
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86783
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/solenv/sanitizers/ui/modules/swriter.suppr b/solenv/sanitizers/ui/modules/swriter.suppr
index 661023b6ce0e..119f86201364 100644
--- a/solenv/sanitizers/ui/modules/swriter.suppr
+++ b/solenv/sanitizers/ui/modules/swriter.suppr
@@ -171,16 +171,7 @@ sw/uiconfig/swriter/ui/notebookbar_groups.ui://GtkLabel[@id='formatgrouplabel']
 sw/uiconfig/swriter/ui/notebookbar_groups.ui://GtkLabel[@id='insertgrouplabel'] orphan-label
 sw/uiconfig/swriter/ui/notebookbar_groups.ui://GtkLabel[@id='tablegrouplabel'] orphan-label
 sw/uiconfig/swriter/ui/notebookbar_groups.ui://GtkLabel[@id='imagegrouplabel'] orphan-label
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkLabel[@id='label4'] orphan-label
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkLabel[@id='label5'] orphan-label
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkLabel[@id='leftLabel'] orphan-label
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkLabel[@id='innerLabel'] orphan-label
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkLabel[@id='rightLabel'] orphan-label
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkLabel[@id='outerLabel'] orphan-label
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkSpinButton[@id='left:0cm'] no-labelled-by
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkSpinButton[@id='right:0cm'] no-labelled-by
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkSpinButton[@id='top:0cm'] no-labelled-by
-sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkSpinButton[@id='bottom:0cm'] no-labelled-by
+sw/uiconfig/swriter/ui/pagemargincontrol.ui://GtkSpinButton[@id='hidden'] no-labelled-by
 sw/uiconfig/swriter/ui/pagesizecontrol.ui://GtkSpinButton[@id='metric'] no-labelled-by
 sw/uiconfig/swriter/ui/printmonitordialog.ui://GtkLabel[@id='docname'] orphan-label
 sw/uiconfig/swriter/ui/printmonitordialog.ui://GtkLabel[@id='printing'] orphan-label
diff --git a/sw/inc/PageMarginPopup.hxx b/sw/inc/PageMarginPopup.hxx
index 3a31544b74a1..c4ec2e634066 100644
--- a/sw/inc/PageMarginPopup.hxx
+++ b/sw/inc/PageMarginPopup.hxx
@@ -28,6 +28,7 @@ public:
     PageMarginPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext);
     virtual ~PageMarginPopup() override;
 
+    virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
     using svt::ToolboxController::createPopupWindow;
     virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
 
diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx
index 587f0262ff13..0241e034989a 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.cxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.cxx
@@ -94,8 +94,18 @@ namespace
 
 namespace sw { namespace sidebar {
 
-PageMarginControl::PageMarginControl(PageMarginPopup* pControl, vcl::Window* pParent)
-    : ToolbarPopup(pControl->getFrameInterface(), pParent, "PageMarginControl", "modules/swriter/ui/pagemargincontrol.ui")
+PageMarginControl::PageMarginControl(PageMarginPopup* pControl, weld::Widget* pParent)
+    : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "modules/swriter/ui/pagemargincontrol.ui", "PageMarginControl")
+    , m_xLeft(m_xBuilder->weld_label("leftLabel"))
+    , m_xRight(m_xBuilder->weld_label("rightLabel"))
+    , m_xInner(m_xBuilder->weld_label("innerLabel"))
+    , m_xOuter(m_xBuilder->weld_label("outerLabel"))
+    , m_xLeftMarginEdit(m_xBuilder->weld_metric_spin_button("left", FieldUnit::CM))
+    , m_xRightMarginEdit(m_xBuilder->weld_metric_spin_button("right", FieldUnit::CM))
+    , m_xTopMarginEdit(m_xBuilder->weld_metric_spin_button("top", FieldUnit::CM))
+    , m_xBottomMarginEdit(m_xBuilder->weld_metric_spin_button("bottom", FieldUnit::CM))
+    , m_xWidthHeightField(m_xBuilder->weld_metric_spin_button("hidden", FieldUnit::CM))
+    , m_xControl(pControl)
     , m_nPageLeftMargin(0)
     , m_nPageRightMargin(0)
     , m_nPageTopMargin(0)
@@ -110,6 +120,12 @@ PageMarginControl::PageMarginControl(PageMarginPopup* pControl, vcl::Window* pPa
     , m_bUserCustomMirrored( false )
     , m_bCustomValuesUsed( false )
 {
+    m_xWidthHeightField->set_unit(FieldUnit::CM);
+    m_xWidthHeightField->set_range(0, 9999, FieldUnit::NONE);
+    m_xWidthHeightField->set_digits(2);
+    m_xWidthHeightField->set_increments(10, 100, FieldUnit::NONE);
+    SetFieldUnit( *m_xWidthHeightField, lcl_GetFieldUnit() );
+
     bool bLandscape = false;
     const SfxPoolItem* pItem;
     const SvxSizeItem* pSize = nullptr;
@@ -142,148 +158,108 @@ PageMarginControl::PageMarginControl(PageMarginPopup* pControl, vcl::Window* pPa
 
     if ( bLandscape )
     {
-        get( m_pNarrow, "narrowL" );
-        get( m_pNormal, "normalL" );
-        get( m_pWide, "wideL" );
-        get( m_pMirrored, "mirroredL" );
-        get( m_pLast, "lastL" );
+        m_xNarrow = m_xBuilder->weld_button("narrowL");
+        m_xNormal = m_xBuilder->weld_button("normalL");
+        m_xWide = m_xBuilder->weld_button("wideL");
+        m_xMirrored = m_xBuilder->weld_button("mirroredL");
+        m_xLast = m_xBuilder->weld_button("lastL");
     }
     else
     {
-        get( m_pNarrow, "narrow" );
-        get( m_pNormal, "normal" );
-        get( m_pWide, "wide" );
-        get( m_pMirrored, "mirrored" );
-        get( m_pLast, "last" );
+        m_xNarrow = m_xBuilder->weld_button("narrow");
+        m_xNormal = m_xBuilder->weld_button("normal");
+        m_xWide = m_xBuilder->weld_button("wide");
+        m_xMirrored = m_xBuilder->weld_button("mirrored");
+        m_xLast = m_xBuilder->weld_button("last");
     }
 
-    m_pNarrow->Show();
-    m_pNormal->Show();
-    m_pWide->Show();
-    m_pMirrored->Show();
-    m_pLast->Show();
-
-    m_pNarrow->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
-    m_pNormal->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
-    m_pWide->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
-    m_pMirrored->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
-    m_pLast->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
-
-    get( m_pContainer, "container" );
-    m_pWidthHeightField = VclPtr<MetricField>::Create( m_pContainer.get(), WinBits(0) );
-    m_pWidthHeightField->Hide();
-    m_pWidthHeightField->SetUnit( FieldUnit::CM );
-    m_pWidthHeightField->SetMax( 9999 );
-    m_pWidthHeightField->SetDecimalDigits( 2 );
-    m_pWidthHeightField->SetSpinSize( 10 );
-    m_pWidthHeightField->SetLast( 9999 );
-    SetFieldUnit( *m_pWidthHeightField.get(), lcl_GetFieldUnit() );
+    m_xNarrow->show();
+    m_xNormal->show();
+    m_xWide->show();
+    m_xMirrored->show();
+    m_xLast->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_bUserCustomValuesAvailable = GetUserCustomValues();
 
     FillHelpText( m_bUserCustomValuesAvailable );
 
-    get( m_pLeftMarginEdit, "left" );
-    get( m_pRightMarginEdit, "right" );
-    get( m_pTopMarginEdit, "top" );
-    get( m_pBottomMarginEdit, "bottom" );
-
-    Link<Edit&,void> aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
-    m_pLeftMarginEdit->SetModifyHdl( aLinkLR );
-    SetMetricValue( *m_pLeftMarginEdit.get(), m_nPageLeftMargin, m_eUnit );
-    SetFieldUnit( *m_pLeftMarginEdit.get(), lcl_GetFieldUnit() );
+    Link<weld::MetricSpinButton&,void> aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
+    m_xLeftMarginEdit->connect_value_changed( aLinkLR );
+    SetMetricValue( *m_xLeftMarginEdit, m_nPageLeftMargin, m_eUnit );
+    SetFieldUnit( *m_xLeftMarginEdit, lcl_GetFieldUnit() );
 
-    m_pRightMarginEdit->SetModifyHdl( aLinkLR );
-    SetMetricValue( *m_pRightMarginEdit.get(), m_nPageRightMargin, m_eUnit );
-    SetFieldUnit( *m_pRightMarginEdit.get(), lcl_GetFieldUnit() );
+    m_xRightMarginEdit->connect_value_changed( aLinkLR );
+    SetMetricValue( *m_xRightMarginEdit, m_nPageRightMargin, m_eUnit );
+    SetFieldUnit( *m_xRightMarginEdit, lcl_GetFieldUnit() );
 
-    Link<Edit&,void> aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl );
-    m_pTopMarginEdit->SetModifyHdl( aLinkUL );
-    SetMetricValue( *m_pTopMarginEdit.get(), m_nPageTopMargin, m_eUnit );
-    SetFieldUnit( *m_pTopMarginEdit.get(), lcl_GetFieldUnit() );
+    Link<weld::MetricSpinButton&,void> aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl );
+    m_xTopMarginEdit->connect_value_changed( aLinkUL );
+    SetMetricValue( *m_xTopMarginEdit, m_nPageTopMargin, m_eUnit );
+    SetFieldUnit( *m_xTopMarginEdit, lcl_GetFieldUnit() );
 
-    m_pBottomMarginEdit->SetModifyHdl( aLinkUL );
-    SetMetricValue( *m_pBottomMarginEdit.get(), m_nPageBottomMargin, m_eUnit );
-    SetFieldUnit( *m_pBottomMarginEdit.get(), lcl_GetFieldUnit() );
+    m_xBottomMarginEdit->connect_value_changed( aLinkUL );
+    SetMetricValue( *m_xBottomMarginEdit, m_nPageBottomMargin, m_eUnit );
+    SetFieldUnit( *m_xBottomMarginEdit, lcl_GetFieldUnit() );
 
     m_aPageSize = pSize->GetSize();
     SetMetricFieldMaxValues( m_aPageSize );
 
-    get( m_pLeft, "leftLabel" );
-    get( m_pRight, "rightLabel" );
-    get( m_pInner, "innerLabel" );
-    get( m_pOuter, "outerLabel" );
-
     if ( m_bMirrored )
     {
-        m_pLeft->Hide();
-        m_pRight->Hide();
-        m_pInner->Show();
-        m_pOuter->Show();
+        m_xLeft->hide();
+        m_xRight->hide();
+        m_xInner->show();
+        m_xOuter->show();
     }
     else
     {
-        m_pLeft->Show();
-        m_pRight->Show();
-        m_pInner->Hide();
-        m_pOuter->Hide();
+        m_xLeft->show();
+        m_xRight->show();
+        m_xInner->hide();
+        m_xOuter->hide();
     }
 }
 
-PageMarginControl::~PageMarginControl()
+void PageMarginControl::GrabFocus()
 {
-    disposeOnce();
+    m_xNarrow->grab_focus();
 }
 
-void PageMarginControl::dispose()
+PageMarginControl::~PageMarginControl()
 {
-    StoreUserCustomValues();
-
-    m_pLeft.disposeAndClear();
-    m_pRight.disposeAndClear();
-    m_pInner.disposeAndClear();
-    m_pOuter.disposeAndClear();
-    m_pLeftMarginEdit.disposeAndClear();
-    m_pRightMarginEdit.disposeAndClear();
-    m_pTopMarginEdit.disposeAndClear();
-    m_pBottomMarginEdit.disposeAndClear();
-    m_pNarrow.disposeAndClear();
-    m_pNormal.disposeAndClear();
-    m_pWide.disposeAndClear();
-    m_pMirrored.disposeAndClear();
-    m_pLast.disposeAndClear();
-
-    m_pWidthHeightField.disposeAndClear();
-    m_pContainer.disposeAndClear();
-
-    ToolbarPopup::dispose();
 }
 
 void PageMarginControl::SetMetricFieldMaxValues( const Size& rPageSize )
 {
-    const long nML = m_pLeftMarginEdit->Denormalize( m_pLeftMarginEdit->GetValue( FieldUnit::TWIP ) );
-    const long nMR = m_pRightMarginEdit->Denormalize( m_pRightMarginEdit->GetValue( FieldUnit::TWIP ) );
-    const long nMT = m_pTopMarginEdit->Denormalize( m_pTopMarginEdit->GetValue( FieldUnit::TWIP ) );
-    const long nMB = m_pBottomMarginEdit->Denormalize( m_pBottomMarginEdit->GetValue( FieldUnit::TWIP ) );
+    const long nML = m_xLeftMarginEdit->denormalize( m_xLeftMarginEdit->get_value( FieldUnit::TWIP ) );
+    const long nMR = m_xRightMarginEdit->denormalize( m_xRightMarginEdit->get_value( FieldUnit::TWIP ) );
+    const long nMT = m_xTopMarginEdit->denormalize( m_xTopMarginEdit->get_value( FieldUnit::TWIP ) );
+    const long nMB = m_xBottomMarginEdit->denormalize( m_xBottomMarginEdit->get_value( FieldUnit::TWIP ) );
 
-    const long nPH  = LogicToLogic( rPageSize.Height(), m_eUnit, MapUnit::MapTwip );
-    const long nPW  = LogicToLogic( rPageSize.Width(),  m_eUnit, MapUnit::MapTwip );
+    const long nPH  = OutputDevice::LogicToLogic( rPageSize.Height(), m_eUnit, MapUnit::MapTwip );
+    const long nPW  = OutputDevice::LogicToLogic( rPageSize.Width(),  m_eUnit, MapUnit::MapTwip );
 
     // Left
     long nMax = nPW - nMR - MINBODY;
-    m_pLeftMarginEdit->SetMax( m_pLeftMarginEdit->Normalize( nMax ), FieldUnit::TWIP );
+    m_xLeftMarginEdit->set_max( m_xLeftMarginEdit->normalize( nMax ), FieldUnit::TWIP );
 
     // Right
     nMax = nPW - nML - MINBODY;
-    m_pRightMarginEdit->SetMax( m_pRightMarginEdit->Normalize( nMax ), FieldUnit::TWIP );
+    m_xRightMarginEdit->set_max( m_xRightMarginEdit->normalize( nMax ), FieldUnit::TWIP );
 
     //Top
     nMax = nPH - nMB - MINBODY;
-    m_pTopMarginEdit->SetMax( m_pTopMarginEdit->Normalize( nMax ), FieldUnit::TWIP );
+    m_xTopMarginEdit->set_max( m_xTopMarginEdit->normalize( nMax ), FieldUnit::TWIP );
 
     //Bottom
     nMax = nPH - nMT -  MINBODY;
-    m_pBottomMarginEdit->SetMax( m_pTopMarginEdit->Normalize( nMax ), FieldUnit::TWIP );
+    m_xBottomMarginEdit->set_max( m_xTopMarginEdit->normalize( nMax ), FieldUnit::TWIP );
 }
 
 void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable )
@@ -293,8 +269,8 @@ void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable )
     const OUString aTop = SwResId( STR_MARGIN_TOOLTIP_TOP );
     const OUString aBottom = SwResId( STR_MARGIN_TOOLTIP_BOT );
 
-    SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_NARROW_VALUE, m_eUnit );
-    const OUString aNarrowValText = m_pWidthHeightField->GetText();
+    SetMetricValue( *m_xWidthHeightField, SWPAGE_NARROW_VALUE, m_eUnit );
+    const OUString aNarrowValText = m_xWidthHeightField->get_text();
     OUString aHelpText = aLeft +
         aNarrowValText +
         aRight +
@@ -303,10 +279,10 @@ void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable )
         aNarrowValText +
         aBottom +
         aNarrowValText;
-    m_pNarrow->SetQuickHelpText( aHelpText );
+    m_xNarrow->set_tooltip_text( aHelpText );
 
-    SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_NORMAL_VALUE, m_eUnit );
-    const OUString aNormalValText = m_pWidthHeightField->GetText();
+    SetMetricValue( *m_xWidthHeightField, SWPAGE_NORMAL_VALUE, m_eUnit );
+    const OUString aNormalValText = m_xWidthHeightField->get_text();
     aHelpText = aLeft +
         aNormalValText +
         aRight +
@@ -315,12 +291,12 @@ void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable )
         aNormalValText +
         aBottom +
         aNormalValText;
-    m_pNormal->SetQuickHelpText( aHelpText );
+    m_xNormal->set_tooltip_text( aHelpText );
 
-    SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_WIDE_VALUE1, m_eUnit );
-    const OUString aWide1ValText = m_pWidthHeightField->GetText();
-    SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_WIDE_VALUE2, m_eUnit );
-    const OUString aWide2ValText = m_pWidthHeightField->GetText();
+    SetMetricValue( *m_xWidthHeightField, SWPAGE_WIDE_VALUE1, m_eUnit );
+    const OUString aWide1ValText = m_xWidthHeightField->get_text();
+    SetMetricValue( *m_xWidthHeightField, SWPAGE_WIDE_VALUE2, m_eUnit );
+    const OUString aWide2ValText = m_xWidthHeightField->get_text();
     aHelpText = aLeft +
         aWide2ValText +
         aRight +
@@ -329,13 +305,13 @@ void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable )
         aWide1ValText +
         aBottom +
         aWide1ValText;
-    m_pWide->SetQuickHelpText( aHelpText );
+    m_xWide->set_tooltip_text( aHelpText );
 
     const OUString aInner = SwResId( STR_MARGIN_TOOLTIP_INNER );
     const OUString aOuter = SwResId( STR_MARGIN_TOOLTIP_OUTER );
 
-    SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_WIDE_VALUE3, m_eUnit );
-    const OUString aWide3ValText = m_pWidthHeightField->GetText();
+    SetMetricValue( *m_xWidthHeightField, SWPAGE_WIDE_VALUE3, m_eUnit );
+    const OUString aWide3ValText = m_xWidthHeightField->get_text();
     aHelpText = aInner +
         aWide3ValText +
         aOuter +
@@ -344,35 +320,35 @@ void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable )
         aWide1ValText +
         aBottom +
         aWide1ValText;
-    m_pMirrored->SetQuickHelpText( aHelpText );
+    m_xMirrored->set_tooltip_text( aHelpText );
 
     if ( bUserCustomValuesAvailable )
     {
         aHelpText = m_bUserCustomMirrored ? aInner : aLeft;
-        SetMetricValue( *m_pWidthHeightField.get(), m_nUserCustomPageLeftMargin, m_eUnit );
-        aHelpText += m_pWidthHeightField->GetText();
+        SetMetricValue( *m_xWidthHeightField, m_nUserCustomPageLeftMargin, m_eUnit );
+        aHelpText += m_xWidthHeightField->get_text();
         aHelpText += m_bUserCustomMirrored ? aOuter : aRight;
-        SetMetricValue( *m_pWidthHeightField.get(), m_nUserCustomPageRightMargin, m_eUnit );
-        aHelpText += m_pWidthHeightField->GetText();
+        SetMetricValue( *m_xWidthHeightField, m_nUserCustomPageRightMargin, m_eUnit );
+        aHelpText += m_xWidthHeightField->get_text();
         aHelpText += aTop;
-        SetMetricValue( *m_pWidthHeightField.get(), m_nUserCustomPageTopMargin, m_eUnit );
-        aHelpText += m_pWidthHeightField->GetText();
+        SetMetricValue( *m_xWidthHeightField, m_nUserCustomPageTopMargin, m_eUnit );
+        aHelpText += m_xWidthHeightField->get_text();
         aHelpText += aBottom;
-        SetMetricValue( *m_pWidthHeightField.get(), m_nUserCustomPageBottomMargin, m_eUnit );
-        aHelpText += m_pWidthHeightField->GetText();
+        SetMetricValue( *m_xWidthHeightField, m_nUserCustomPageBottomMargin, m_eUnit );
+        aHelpText += m_xWidthHeightField->get_text();
     }
     else
     {
         aHelpText.clear();
     }
-    m_pLast->SetQuickHelpText( aHelpText );
+    m_xLast->set_tooltip_text( aHelpText );
 }
 
-IMPL_LINK( PageMarginControl, SelectMarginHdl, Button*, pControl, void )
+IMPL_LINK( PageMarginControl, SelectMarginHdl, weld::Button&, rControl, void )
 {
     bool bMirrored = false;
     bool bApplyNewPageMargins = true;
-    if( pControl == m_pNarrow.get() )
+    if( &rControl == m_xNarrow.get() )
     {
         m_nPageLeftMargin = SWPAGE_NARROW_VALUE;
         m_nPageRightMargin = SWPAGE_NARROW_VALUE;
@@ -380,7 +356,7 @@ IMPL_LINK( PageMarginControl, SelectMarginHdl, Button*, pControl, void )
         m_nPageBottomMargin = SWPAGE_NARROW_VALUE;
         bMirrored = false;
     }
-    if( pControl == m_pNormal.get() )
+    if( &rControl == m_xNormal.get() )
     {
         m_nPageLeftMargin = SWPAGE_NORMAL_VALUE;
         m_nPageRightMargin = SWPAGE_NORMAL_VALUE;
@@ -388,7 +364,7 @@ IMPL_LINK( PageMarginControl, SelectMarginHdl, Button*, pControl, void )
         m_nPageBottomMargin = SWPAGE_NORMAL_VALUE;
         bMirrored = false;
     }
-    if( pControl == m_pWide.get() )
+    if( &rControl == m_xWide.get() )
     {
         m_nPageLeftMargin = SWPAGE_WIDE_VALUE2;
         m_nPageRightMargin = SWPAGE_WIDE_VALUE2;
@@ -396,7 +372,7 @@ IMPL_LINK( PageMarginControl, SelectMarginHdl, Button*, pControl, void )
         m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
         bMirrored = false;
     }
-    if( pControl == m_pMirrored.get() )
+    if( &rControl == m_xMirrored.get() )
     {
         m_nPageLeftMargin = SWPAGE_WIDE_VALUE3;
         m_nPageRightMargin = SWPAGE_WIDE_VALUE1;
@@ -404,7 +380,7 @@ IMPL_LINK( PageMarginControl, SelectMarginHdl, Button*, pControl, void )
         m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
         bMirrored = true;
     }
-    if( pControl == m_pLast.get() )
+    if( &rControl == m_xLast.get() )
     {
         if ( m_bUserCustomValuesAvailable )
         {
@@ -438,7 +414,7 @@ IMPL_LINK( PageMarginControl, SelectMarginHdl, Button*, pControl, void )
             xUndoManager->leaveUndoContext();
 
         m_bCustomValuesUsed = false;
-        EndPopupMode();
+        m_xControl->EndPopupMode();
     }
 }
 
@@ -484,19 +460,19 @@ void PageMarginControl::ExecutePageLayoutChange( const bool bMirrored )
     }
 }
 
-IMPL_LINK_NOARG( PageMarginControl, ModifyLRMarginHdl, Edit&, void )
+IMPL_LINK_NOARG( PageMarginControl, ModifyLRMarginHdl, weld::MetricSpinButton&, void )
 {
-    m_nPageLeftMargin = GetCoreValue( *m_pLeftMarginEdit.get(), m_eUnit );
-    m_nPageRightMargin = GetCoreValue( *m_pRightMarginEdit.get(), m_eUnit );
+    m_nPageLeftMargin = GetCoreValue( *m_xLeftMarginEdit, m_eUnit );
+    m_nPageRightMargin = GetCoreValue( *m_xRightMarginEdit, m_eUnit );
     ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin );
     SetMetricFieldMaxValues( m_aPageSize );
     m_bCustomValuesUsed = true;
 }
 
-IMPL_LINK_NOARG( PageMarginControl, ModifyULMarginHdl, Edit&, void )
+IMPL_LINK_NOARG( PageMarginControl, ModifyULMarginHdl, weld::MetricSpinButton&, void )
 {
-    m_nPageTopMargin = GetCoreValue( *m_pTopMarginEdit.get(), m_eUnit );
-    m_nPageBottomMargin = GetCoreValue( *m_pBottomMarginEdit.get(), m_eUnit );
+    m_nPageTopMargin = GetCoreValue( *m_xTopMarginEdit, m_eUnit );
+    m_nPageBottomMargin = GetCoreValue( *m_xBottomMarginEdit, m_eUnit );
     ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin );
     SetMetricFieldMaxValues( m_aPageSize );
     m_bCustomValuesUsed = true;
diff --git a/sw/source/uibase/sidebar/PageMarginControl.hxx b/sw/source/uibase/sidebar/PageMarginControl.hxx
index 77f4cdb01593..83b98c0e244c 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.hxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.hxx
@@ -20,9 +20,6 @@
 #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINCONTROL_HXX
 
 #include <svtools/toolbarmenu.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/field.hxx>
-#include <vcl/layout.hxx>
 
 #define SWPAGE_NARROW_VALUE    720
 #define SWPAGE_NORMAL_VALUE    1136
@@ -37,34 +34,34 @@ class PageMarginPopup;
 
 namespace sw { namespace sidebar {
 
-class PageMarginControl final : public svtools::ToolbarPopup
+class PageMarginControl final : public WeldToolbarPopup
 {
 public:
-    explicit PageMarginControl(PageMarginPopup* pControl, vcl::Window* pParent);
+    explicit PageMarginControl(PageMarginPopup* pControl, weld::Widget* pParent);
+    virtual void GrabFocus() override;
     virtual ~PageMarginControl() override;
-    virtual void dispose() override;
 
 private:
-    VclPtr<PushButton> m_pNarrow;
-    VclPtr<PushButton> m_pNormal;
-    VclPtr<PushButton> m_pWide;
-    VclPtr<PushButton> m_pMirrored;
-    VclPtr<PushButton> m_pLast;
-
-    VclPtr<FixedText> m_pLeft;
-    VclPtr<FixedText> m_pRight;
-    VclPtr<FixedText> m_pInner;
-    VclPtr<FixedText> m_pOuter;
-
-    VclPtr<VclVBox> m_pContainer;
-
-    VclPtr<MetricField> m_pLeftMarginEdit;
-    VclPtr<MetricField> m_pRightMarginEdit;
-    VclPtr<MetricField> m_pTopMarginEdit;
-    VclPtr<MetricField> m_pBottomMarginEdit;
+    std::unique_ptr<weld::Button> m_xNarrow;
+    std::unique_ptr<weld::Button> m_xNormal;
+    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::Label> m_xLeft;
+    std::unique_ptr<weld::Label> m_xRight;
+    std::unique_ptr<weld::Label> m_xInner;
+    std::unique_ptr<weld::Label> m_xOuter;
+
+    std::unique_ptr<weld::MetricSpinButton> m_xLeftMarginEdit;
+    std::unique_ptr<weld::MetricSpinButton> m_xRightMarginEdit;
+    std::unique_ptr<weld::MetricSpinButton> m_xTopMarginEdit;
+    std::unique_ptr<weld::MetricSpinButton> m_xBottomMarginEdit;
 
     // hidden metric field
-    VclPtr<MetricField> m_pWidthHeightField;
+    std::unique_ptr<weld::MetricSpinButton> m_xWidthHeightField;
+
+    rtl::Reference<PageMarginPopup> m_xControl;
 
     long m_nPageLeftMargin;
     long m_nPageRightMargin;
@@ -85,9 +82,9 @@ private:
 
     bool m_bCustomValuesUsed;
 
-    DECL_LINK( SelectMarginHdl, Button*, void );
-    DECL_LINK( ModifyLRMarginHdl, Edit&, void );
-    DECL_LINK( ModifyULMarginHdl, Edit&, void );
+    DECL_LINK( SelectMarginHdl, weld::Button&, void );
+    DECL_LINK( ModifyLRMarginHdl, weld::MetricSpinButton&, void );
+    DECL_LINK( ModifyULMarginHdl, weld::MetricSpinButton&, void );
 
     static void ExecuteMarginLRChange(
         const long nPageLeftMargin,
diff --git a/sw/source/uibase/sidebar/PageMarginPopup.cxx b/sw/source/uibase/sidebar/PageMarginPopup.cxx
index f22604a70a08..d71aa8c6f09f 100644
--- a/sw/source/uibase/sidebar/PageMarginPopup.cxx
+++ b/sw/source/uibase/sidebar/PageMarginPopup.cxx
@@ -39,9 +39,19 @@ PageMarginPopup::~PageMarginPopup()
 {
 }
 
-VclPtr<vcl::Window> PageMarginPopup::createPopupWindow(vcl::Window* pParent)
+std::unique_ptr<WeldToolbarPopup> PageMarginPopup::weldPopupWindow()
 {
-    return VclPtr<sw::sidebar::PageMarginControl>::Create(this, pParent);
+    return std::make_unique<sw::sidebar::PageMarginControl>(this, m_pToolbar);
+}
+
+VclPtr<vcl::Window> PageMarginPopup::createPopupWindow( vcl::Window* pParent )
+{
+    mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent,
+        std::make_unique<sw::sidebar::PageMarginControl>(this, pParent->GetFrameWeld()));
+
+    mxInterimPopover->Show();
+
+    return mxInterimPopover;
 }
 
 OUString PageMarginPopup::getImplementationName()
diff --git a/sw/source/uibase/sidebar/PageOrientationControl.cxx b/sw/source/uibase/sidebar/PageOrientationControl.cxx
index 14403f660a80..dcf7ffa862b4 100644
--- a/sw/source/uibase/sidebar/PageOrientationControl.cxx
+++ b/sw/source/uibase/sidebar/PageOrientationControl.cxx
@@ -26,6 +26,7 @@
 #include <sfx2/viewsh.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/viewfrm.hxx>
+#include <vcl/button.hxx>
 #include <cmdid.h>
 
 namespace {
diff --git a/sw/uiconfig/swriter/ui/pagemargincontrol.ui b/sw/uiconfig/swriter/ui/pagemargincontrol.ui
index e11f95d5b896..176c81abc412 100644
--- a/sw/uiconfig/swriter/ui/pagemargincontrol.ui
+++ b/sw/uiconfig/swriter/ui/pagemargincontrol.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkAdjustment" id="adjustment1">
@@ -7,71 +7,84 @@
     <property name="step_increment">0.10000000000000001</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">9999</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment3">
+    <property name="upper">9999</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment4">
+    <property name="upper">9999</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment5">
+    <property name="upper">9999</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkImage" id="lastImg">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_copy_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/format_L_copy_24x24.png</property>
   </object>
   <object class="GtkImage" id="lastLImg">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/formatcopy_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/formatcopy_24x24.png</property>
   </object>
   <object class="GtkImage" id="mirrore">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png</property>
   </object>
   <object class="GtkImage" id="mirroredLImg">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/formatmirror_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/formatmirror_24x24.png</property>
   </object>
   <object class="GtkImage" id="narrowImg">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png</property>
   </object>
   <object class="GtkImage" id="narrowLImg">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/formatnarrow_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/formatnarrow_24x24.png</property>
   </object>
   <object class="GtkImage" id="normalImg">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png</property>
   </object>
   <object class="GtkImage" id="normalLImg">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/formatnormal_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/formatnormal_24x24.png</property>
   </object>
   <object class="GtkImage" id="wideImg">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_wide_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/format_L_wide_24x24.png</property>
   </object>
   <object class="GtkImage" id="wideLImg">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">sw/res/sidebar/pageproppanel/formatwide_24x24.png</property>
+    <property name="icon_name">sw/res/sidebar/pageproppanel/formatwide_24x24.png</property>
   </object>
-  <object class="GtkWindow" id="PageMarginControl">
+  <object class="GtkPopover" id="PageMarginControl">
     <property name="can_focus">False</property>
-    <property name="hexpand">True</property>
-    <property name="vexpand">True</property>
+    <property name="no_show_all">True</property>
     <property name="border_width">4</property>
-    <property name="resizable">False</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">popup-menu</property>
-    <property name="skip_pager_hint">True</property>
-    <property name="deletable">False</property>
     <child>
-      <object class="GtkBox" id="box">
+      <object class="GtkBox" id="container">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="margin_right">6</property>
         <property name="hexpand">True</property>
         <property name="vexpand">True</property>
         <property name="orientation">vertical</property>
@@ -83,7 +96,9 @@
             <property name="receives_default">True</property>
             <property name="image">narrowImg</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -98,6 +113,7 @@
             <property name="receives_default">True</property>
             <property name="image">normalImg</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
             <property name="always_show_image">True</property>
           </object>
@@ -114,7 +130,9 @@
             <property name="receives_default">True</property>
             <property name="image">wideImg</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -129,7 +147,9 @@
             <property name="receives_default">True</property>
             <property name="image">mirrore</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -144,7 +164,9 @@
             <property name="receives_default">True</property>
             <property name="image">lastImg</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -159,7 +181,9 @@
             <property name="receives_default">True</property>
             <property name="image">narrowLImg</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -174,6 +198,7 @@
             <property name="receives_default">True</property>
             <property name="image">normalLImg</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
             <property name="always_show_image">True</property>
           </object>
@@ -190,7 +215,9 @@
             <property name="receives_default">True</property>
             <property name="image">wideLImg</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -205,7 +232,9 @@
             <property name="receives_default">True</property>
             <property name="image">mirroredLImg</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -220,7 +249,9 @@
             <property name="receives_default">True</property>
             <property name="image">lastLImg</property>
             <property name="relief">none</property>
+            <property name="use_underline">True</property>
             <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -251,6 +282,7 @@
                         <property name="can_focus">False</property>
                         <property name="label" translatable="yes" context="pagemargincontrol|label4">_Top</property>
                         <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">top</property>
                         <property name="xalign">0</property>
                       </object>
                       <packing>
@@ -264,6 +296,7 @@
                         <property name="can_focus">False</property>
                         <property name="label" translatable="yes" context="pagemargincontrol|label5">_Bottom</property>
                         <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">bottom</property>
                         <property name="xalign">0</property>
                       </object>
                       <packing>
@@ -281,6 +314,7 @@
                             <property name="can_focus">False</property>
                             <property name="label" translatable="yes" context="pagemargincontrol|leftLabel">_Left</property>
                             <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">left</property>
                             <property name="xalign">0</property>
                           </object>
                           <packing>
@@ -319,6 +353,7 @@
                             <property name="can_focus">False</property>
                             <property name="label" translatable="yes" context="pagemargincontrol|rightLabel">_Right</property>
                             <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">right</property>
                             <property name="xalign">0</property>
                           </object>
                           <packing>
@@ -333,6 +368,7 @@
                             <property name="can_focus">False</property>
                             <property name="label" translatable="yes" context="pagemargincontrol|outerLabel">O_uter</property>
                             <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">right</property>
                             <property name="xalign">0</property>
                           </object>
                           <packing>
@@ -348,7 +384,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton" id="left:0cm">
+                      <object class="GtkSpinButton" id="left">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
@@ -361,11 +397,11 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton" id="right:0cm">
+                      <object class="GtkSpinButton" id="right">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
-                        <property name="adjustment">adjustment1</property>
+                        <property name="adjustment">adjustment2</property>
                         <property name="digits">2</property>
                       </object>
                       <packing>
@@ -374,11 +410,11 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton" id="top:0cm">
+                      <object class="GtkSpinButton" id="top">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
-                        <property name="adjustment">adjustment1</property>
+                        <property name="adjustment">adjustment2</property>
                         <property name="digits">2</property>
                       </object>
                       <packing>
@@ -387,11 +423,11 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton" id="bottom:0cm">
+                      <object class="GtkSpinButton" id="bottom">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
-                        <property name="adjustment">adjustment1</property>
+                        <property name="adjustment">adjustment4</property>
                         <property name="digits">2</property>
                       </object>
                       <packing>
@@ -418,13 +454,12 @@
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="container">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <child>
-              <placeholder/>
-            </child>
+          <object class="GtkSpinButton" id="hidden">
+            <property name="can_focus">True</property>
+            <property name="no_show_all">True</property>
+            <property name="hexpand">True</property>
+            <property name="adjustment">adjustment5</property>
+            <property name="digits">2</property>
           </object>
           <packing>
             <property name="expand">False</property>


More information about the Libreoffice-commits mailing list