[Libreoffice-commits] core.git: extras/source sfx2/source sw/source sw/uiconfig

Caolán McNamara caolanm at redhat.com
Thu Apr 26 10:37:41 UTC 2018


 extras/source/glade/libreoffice-catalog.xml.in |    3 
 sfx2/source/dialog/tabdlg.cxx                  |    4 
 sw/source/ui/envelp/label1.cxx                 |   32 +-
 sw/source/ui/envelp/labfmt.cxx                 |  371 +++++++++----------------
 sw/source/ui/envelp/labfmt.hxx                 |   67 ++--
 sw/source/uibase/inc/labimp.hxx                |   10 
 sw/source/uibase/inc/uitool.hxx                |    1 
 sw/source/uibase/utlui/uitool.cxx              |    8 
 sw/uiconfig/swriter/ui/labelformatpage.ui      |   82 +++--
 sw/uiconfig/swriter/ui/labeloptionspage.ui     |    4 
 10 files changed, 268 insertions(+), 314 deletions(-)

New commits:
commit ea1dde9e899dc26f0b877ff5fc5f8d027769521b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 23 13:25:02 2018 +0100

    weld SwLabPreview
    
    Change-Id: I710eacd28f3b6c38890145cf82eeca8bec6ae1f6
    Reviewed-on: https://gerrit.libreoffice.org/53328
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 5770537a83ad..48e7f9cbdb67 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -422,9 +422,6 @@
     <glade-widget-class title="NUP Preview" name="vcllo-ShowNupOrderWindow"
                         generic-name="NUP Preview" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="Label Preview" name="swuilo-SwLabPreview"
-                        generic-name="Label Preview" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
     <glade-widget-class title="Envelope Preview" name="swuilo-SwEnvPreview"
                         generic-name="Envelope Preview" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index afc827db416d..dfca78c96d7f 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -166,12 +166,12 @@ SfxTabPage::SfxTabPage(vcl::Window *pParent, const OString& rID, const OUString&
 }
 
 SfxTabPage::SfxTabPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet *rAttrSet)
-    : TabPage(Application::GetDefDialogParent()) //just drag this along hidden in this scenario
+    : TabPage(pParent.pPage ? Application::GetDefDialogParent() : pParent.pParent.get()) //just drag this along hidden in this scenario
     , pSet                ( rAttrSet )
     , bHasExchangeSupport ( false )
     , pImpl               ( new TabPageImpl )
     , m_xBuilder(pParent.pPage ? Application::CreateBuilder(pParent.pPage, rUIXMLDescription)
-                               : Application::CreateInterimBuilder(pParent.pParent, rUIXMLDescription))
+                               : Application::CreateInterimBuilder(this, rUIXMLDescription))
     , m_xContainer(m_xBuilder->weld_container(rID))
 {
 }
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 6ff18b882716..e3537834932f 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -272,21 +272,6 @@ SwLabPage::SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet)
     m_pTypeBox->SetSelectHdl(LINK(this, SwLabPage, TypeHdl         ));
 
     InitDatabaseBox();
-
-    size_t nLstGroup = 0;
-
-    const size_t nCount = GetParentSwLabDlg()->Makes().size();
-    for(size_t i = 0; i < nCount; ++i)
-    {
-        OUString& rStr = GetParentSwLabDlg()->Makes()[i];
-        m_pMakeBox->InsertEntry( rStr );
-
-        if ( rStr == aItem.m_aLstMake)
-            nLstGroup = i;
-    }
-
-    m_pMakeBox->SelectEntryPos( nLstGroup );
-    m_pMakeBox->GetSelectHdl().Call(*m_pMakeBox);
 }
 
 SwLabPage::~SwLabPage()
@@ -526,6 +511,23 @@ bool SwLabPage::FillItemSet(SfxItemSet* rSet)
 
 void SwLabPage::Reset(const SfxItemSet* rSet)
 {
+    m_pMakeBox->Clear();
+
+    size_t nLstGroup = 0;
+
+    const size_t nCount = GetParentSwLabDlg()->Makes().size();
+    for(size_t i = 0; i < nCount; ++i)
+    {
+        OUString& rStr = GetParentSwLabDlg()->Makes()[i];
+        m_pMakeBox->InsertEntry( rStr );
+
+        if ( rStr == aItem.m_aLstMake)
+            nLstGroup = i;
+    }
+
+    m_pMakeBox->SelectEntryPos( nLstGroup );
+    m_pMakeBox->GetSelectHdl().Call(*m_pMakeBox);
+
     aItem = static_cast<const SwLabItem&>( rSet->Get(FN_LABEL));
     OUString sDBName  = aItem.m_sDBName;
 
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
index 97f43d9c0447..8c4d038aed5f 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -97,8 +97,8 @@ void DrawArrow(vcl::RenderContext& rRenderContext, const Point &rP1, const Point
 
 }
 
-SwLabPreview::SwLabPreview(vcl::Window* pParent)
-    : Window(pParent, 0)
+SwLabPreview::SwLabPreview(weld::DrawingArea* pWidget)
+    : m_xDrawingArea(pWidget)
     , m_aGrayColor(COL_LIGHTGRAY)
     , m_aHDistStr(SwResId(STR_HDIST))
     , m_aVDistStr(SwResId(STR_VDIST))
@@ -109,42 +109,33 @@ SwLabPreview::SwLabPreview(vcl::Window* pParent)
     , m_aColsStr(SwResId(STR_COLS))
     , m_aRowsStr(SwResId(STR_ROWS))
 {
-    SetMapMode(MapMode(MapUnit::MapPixel));
-
-    // FIXME RenderContext
-
-    const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-    const Color& rWinColor = rStyleSettings.GetWindowColor();
-    SetBackground(Wallpaper(rWinColor));
-
-    vcl::Font aFont = GetFont();
-    aFont.SetTransparent(true);
-    aFont.SetWeight(WEIGHT_NORMAL);
-    SetFont(aFont);
-
-    m_lHDistWidth  = GetTextWidth(m_aHDistStr );
-    m_lVDistWidth  = GetTextWidth(m_aVDistStr );
-    m_lHeightWidth = GetTextWidth(m_aHeightStr);
-    m_lLeftWidth   = GetTextWidth(m_aLeftStr  );
-    m_lUpperWidth  = GetTextWidth(m_aUpperStr );
-    m_lColsWidth   = GetTextWidth(m_aColsStr  );
-    m_lXHeight = GetTextHeight();
-    m_lXWidth  = GetTextWidth(OUString('X'));
+    pWidget->set_size_request(pWidget->get_approximate_digit_width() * 54,
+                              pWidget->get_text_height() * 15);
+
+    m_xDrawingArea->connect_size_allocate(LINK(this, SwLabPreview, DoResize));
+    m_xDrawingArea->connect_draw(LINK(this, SwLabPreview, DoPaint));
+
+    m_lHDistWidth  = pWidget->get_pixel_size(m_aHDistStr).Width();
+    m_lVDistWidth  = pWidget->get_pixel_size(m_aVDistStr).Width();
+    m_lHeightWidth = pWidget->get_pixel_size(m_aHeightStr).Width();
+    m_lLeftWidth   = pWidget->get_pixel_size(m_aLeftStr).Width();
+    m_lUpperWidth  = pWidget->get_pixel_size(m_aUpperStr).Width();
+    m_lColsWidth   = pWidget->get_pixel_size(m_aColsStr).Width();
+    m_lXHeight = pWidget->get_text_height();
+    m_lXWidth  = pWidget->get_pixel_size(OUString('X')).Width();
 }
 
-Size SwLabPreview::GetOptimalSize() const
+IMPL_LINK(SwLabPreview, DoResize, const Size&, rSize, void)
 {
-    return LogicToPixel(Size(146 , 161), MapMode(MapUnit::MapAppFont));
+    m_aSize = rSize;
 }
 
-VCL_BUILDER_FACTORY(SwLabPreview)
-
-void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+IMPL_LINK(SwLabPreview, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
 {
-    const Size aSz(GetOutputSizePixel());
+    vcl::RenderContext& rRenderContext = aPayload.first;
 
-    const long lOutWPix = aSz.Width ();
-    const long lOutHPix = aSz.Height();
+    const long lOutWPix = m_aSize.Width();
+    const long lOutHPix = m_aSize.Height();
 
     // Scale factor
     const double fxpix = double(lOutWPix - (2 * (m_lLeftWidth + 15))) / double(lOutWPix);
@@ -283,70 +274,57 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
 void SwLabPreview::UpdateItem(const SwLabItem& rItem)
 {
     m_aItem = rItem;
-    Invalidate();
+    m_xDrawingArea->queue_draw();
 }
 
-SwLabFormatPage::SwLabFormatPage(vcl::Window* pParent, const SfxItemSet& rSet)
-    : SfxTabPage(pParent, "LabelFormatPage",
-        "modules/swriter/ui/labelformatpage.ui", &rSet)
+SwLabFormatPage::SwLabFormatPage(TabPageParent pParent, const SfxItemSet& rSet)
+    : SfxTabPage(pParent, "modules/swriter/ui/labelformatpage.ui", "LabelFormatPage", &rSet)
     , aPreviewIdle("SwLabFormatPage Preview")
-    , bModified(false)
     , aItem(static_cast<const SwLabItem&>( rSet.Get(FN_LABEL) ))
+    , bModified(false)
+    , m_xMakeFI(m_xBuilder->weld_label("make"))
+    , m_xTypeFI(m_xBuilder->weld_label("type"))
+    , m_xPreview(new SwLabPreview(m_xBuilder->weld_drawing_area("preview")))
+    , m_xHDistField(m_xBuilder->weld_metric_spin_button("hori", FUNIT_CM))
+    , m_xVDistField(m_xBuilder->weld_metric_spin_button("vert", FUNIT_CM))
+    , m_xWidthField(m_xBuilder->weld_metric_spin_button("width", FUNIT_CM))
+    , m_xHeightField(m_xBuilder->weld_metric_spin_button("height", FUNIT_CM))
+    , m_xLeftField(m_xBuilder->weld_metric_spin_button("left", FUNIT_CM))
+    , m_xUpperField(m_xBuilder->weld_metric_spin_button("top", FUNIT_CM))
+    , m_xColsField(m_xBuilder->weld_spin_button("cols"))
+    , m_xRowsField(m_xBuilder->weld_spin_button("rows"))
+    , m_xPWidthField(m_xBuilder->weld_metric_spin_button("pagewidth", FUNIT_CM))
+    , m_xPHeightField(m_xBuilder->weld_metric_spin_button("pageheight", FUNIT_CM))
+    , m_xSavePB(m_xBuilder->weld_button("save"))
 {
     SetExchangeSupport();
 
-    get(m_pMakeFI, "make");
-    get(m_pTypeFI, "type");
-    get(m_pPreview, "preview");
-    get(m_pHDistField, "hori");
-    get(m_pVDistField, "vert");
-    get(m_pWidthField, "width");
-    get(m_pHeightField, "height");
-    get(m_pLeftField, "left");
-    get(m_pUpperField, "top");
-    get(m_pColsField, "cols");
-    get(m_pRowsField, "rows");
-    get(m_pPWidthField, "pagewidth");
-    get(m_pPHeightField, "pageheight");
-    get(m_pSavePB, "save");
-
     // Metrics
     FieldUnit aMetric = ::GetDfltMetric(false);
-    SetMetric(*m_pHDistField, aMetric);
-    SetMetric(*m_pVDistField , aMetric);
-    SetMetric(*m_pWidthField , aMetric);
-    SetMetric(*m_pHeightField, aMetric);
-    SetMetric(*m_pLeftField  , aMetric);
-    SetMetric(*m_pUpperField , aMetric);
-    SetMetric(*m_pPWidthField , aMetric);
-    SetMetric(*m_pPHeightField, aMetric);
+    SetMetric(*m_xHDistField, aMetric);
+    SetMetric(*m_xVDistField , aMetric);
+    SetMetric(*m_xWidthField , aMetric);
+    SetMetric(*m_xHeightField, aMetric);
+    SetMetric(*m_xLeftField  , aMetric);
+    SetMetric(*m_xUpperField , aMetric);
+    SetMetric(*m_xPWidthField , aMetric);
+    SetMetric(*m_xPHeightField, aMetric);
 
     // Install handlers
-    Link<Edit&,void> aLk = LINK(this, SwLabFormatPage, ModifyHdl);
-    m_pHDistField->SetModifyHdl( aLk );
-    m_pVDistField->SetModifyHdl( aLk );
-    m_pWidthField->SetModifyHdl( aLk );
-    m_pHeightField->SetModifyHdl( aLk );
-    m_pLeftField->SetModifyHdl( aLk );
-    m_pUpperField->SetModifyHdl( aLk );
-    m_pColsField->SetModifyHdl( aLk );
-    m_pRowsField->SetModifyHdl( aLk );
-    m_pPWidthField->SetModifyHdl( aLk );
-    m_pPHeightField->SetModifyHdl( aLk );
-
-    Link<Control&,void> aLk2 = LINK(this, SwLabFormatPage, LoseFocusHdl);
-    m_pHDistField->SetLoseFocusHdl( aLk2 );
-    m_pVDistField->SetLoseFocusHdl( aLk2 );
-    m_pWidthField->SetLoseFocusHdl( aLk2 );
-    m_pHeightField->SetLoseFocusHdl( aLk2 );
-    m_pLeftField->SetLoseFocusHdl( aLk2 );
-    m_pUpperField->SetLoseFocusHdl( aLk2 );
-    m_pColsField->SetLoseFocusHdl( aLk2 );
-    m_pRowsField->SetLoseFocusHdl( aLk2 );
-    m_pPWidthField->SetLoseFocusHdl( aLk2 );
-    m_pPHeightField->SetLoseFocusHdl( aLk2 );
-
-    m_pSavePB->SetClickHdl( LINK (this, SwLabFormatPage, SaveHdl));
+    Link<weld::MetricSpinButton&,void> aLk = LINK(this, SwLabFormatPage, MetricModifyHdl);
+    m_xHDistField->connect_value_changed( aLk );
+    m_xVDistField->connect_value_changed( aLk );
+    m_xWidthField->connect_value_changed( aLk );
+    m_xHeightField->connect_value_changed( aLk );
+    m_xLeftField->connect_value_changed( aLk );
+    m_xUpperField->connect_value_changed( aLk );
+    m_xPWidthField->connect_value_changed( aLk );
+    m_xPHeightField->connect_value_changed( aLk );
+
+    m_xColsField->connect_value_changed(LINK(this, SwLabFormatPage, ModifyHdl));
+    m_xRowsField->connect_value_changed(LINK(this, SwLabFormatPage, ModifyHdl));
+
+    m_xSavePB->connect_clicked( LINK (this, SwLabFormatPage, SaveHdl));
     // Set timer
     aPreviewIdle.SetPriority(TaskPriority::LOWEST);
     aPreviewIdle.SetInvokeHandler(LINK(this, SwLabFormatPage, PreviewHdl));
@@ -354,31 +332,16 @@ SwLabFormatPage::SwLabFormatPage(vcl::Window* pParent, const SfxItemSet& rSet)
 
 SwLabFormatPage::~SwLabFormatPage()
 {
-    disposeOnce();
 }
 
-void SwLabFormatPage::dispose()
+// Modify-handler of MetricFields. start preview timer
+IMPL_LINK_NOARG(SwLabFormatPage, MetricModifyHdl, weld::MetricSpinButton&, void)
 {
-    m_pMakeFI.clear();
-    m_pTypeFI.clear();
-    m_pPreview.clear();
-    m_pHDistField.clear();
-    m_pVDistField.clear();
-    m_pWidthField.clear();
-    m_pHeightField.clear();
-    m_pLeftField.clear();
-    m_pUpperField.clear();
-    m_pColsField.clear();
-    m_pRowsField.clear();
-    m_pPWidthField.clear();
-    m_pPHeightField.clear();
-    m_pSavePB.clear();
-    SfxTabPage::dispose();
+    bModified = true;
+    aPreviewIdle.Start();
 }
 
-
-// Modify-handler of MetricFields. start preview timer
-IMPL_LINK_NOARG(SwLabFormatPage, ModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(SwLabFormatPage, ModifyHdl, weld::SpinButton&, void)
 {
     bModified = true;
     aPreviewIdle.Start();
@@ -390,14 +353,7 @@ IMPL_LINK_NOARG(SwLabFormatPage, PreviewHdl, Timer *, void)
     aPreviewIdle.Stop();
     ChangeMinMax();
     FillItem( aItem );
-    m_pPreview->UpdateItem( aItem );
-}
-
-// LoseFocus-Handler: Update on change
-IMPL_LINK( SwLabFormatPage, LoseFocusHdl, Control&, rControl, void )
-{
-    if (static_cast<Edit*>( &rControl)->IsModified())
-        PreviewHdl(nullptr);
+    m_xPreview->UpdateItem( aItem );
 }
 
 void SwLabFormatPage::ChangeMinMax()
@@ -407,81 +363,42 @@ void SwLabFormatPage::ChangeMinMax()
 
     // Min and Max
 
-    int nCols   = m_pColsField->GetValue(),
-        nRows   = m_pRowsField->GetValue();
-    long lLeft   = static_cast< long >(GETFLDVAL(*m_pLeftField )),
-         lUpper  = static_cast< long >(GETFLDVAL(*m_pUpperField)),
-         lHDist  = static_cast< long >(GETFLDVAL(*m_pHDistField)),
-         lVDist  = static_cast< long >(GETFLDVAL(*m_pVDistField)),
-         lWidth  = static_cast< long >(GETFLDVAL(*m_pWidthField)),
-         lHeight = static_cast< long >(GETFLDVAL(*m_pHeightField)),
+    int nCols   = m_xColsField->get_value(),
+        nRows   = m_xRowsField->get_value();
+    long lLeft   = static_cast< long >(getfldval(*m_xLeftField )),
+         lUpper  = static_cast< long >(getfldval(*m_xUpperField)),
+         lHDist  = static_cast< long >(getfldval(*m_xHDistField)),
+         lVDist  = static_cast< long >(getfldval(*m_xVDistField)),
+         lWidth  = static_cast< long >(getfldval(*m_xWidthField)),
+         lHeight = static_cast< long >(getfldval(*m_xHeightField)),
          lMinPWidth  = lLeft  + (nCols - 1) * lHDist + lWidth,
          lMinPHeight = lUpper + (nRows - 1) * lVDist + lHeight;
 
-    m_pHDistField->SetMin(nMinSize, FUNIT_CM);
-    m_pVDistField->SetMin(nMinSize, FUNIT_CM);
-
-    m_pHDistField->SetMax(long(100) * ((lMax - lLeft ) / std::max(1L, static_cast<long>(nCols))), FUNIT_TWIP);
-    m_pVDistField->SetMax(long(100) * ((lMax - lUpper) / std::max(1L, static_cast<long>(nRows))), FUNIT_TWIP);
-
-    m_pWidthField->SetMin(nMinSize, FUNIT_CM);
-    m_pHeightField->SetMin(nMinSize, FUNIT_CM);
-
-    m_pWidthField->SetMax(long(100) * lHDist, FUNIT_TWIP);
-    m_pHeightField->SetMax(long(100) * lVDist, FUNIT_TWIP);
-
-    m_pLeftField->SetMax(long(100) * (lMax - nCols * lHDist), FUNIT_TWIP);
-    m_pUpperField->SetMax(long(100) * (lMax - nRows * lVDist), FUNIT_TWIP);
-
-    m_pColsField->SetMin( 1 );
-    m_pRowsField->SetMin( 1 );
-
-    m_pColsField->SetMax((lMax - lLeft ) / std::max(1L, lHDist));
-    m_pRowsField->SetMax((lMax - lUpper) / std::max(1L, lVDist));
-    m_pPWidthField->SetMin( long(100) * lMinPWidth,  FUNIT_TWIP );
-    m_pPHeightField->SetMin( long(100) * lMinPHeight, FUNIT_TWIP );
-
-    m_pPWidthField->SetMax( long(100) * lMax, FUNIT_TWIP);
-    m_pPHeightField->SetMax( long(100) * lMax, FUNIT_TWIP);
-    // First and Last
-
-    m_pHDistField->SetFirst(m_pHDistField->GetMin());
-    m_pVDistField->SetFirst(m_pVDistField->GetMin());
+    m_xHDistField->set_min(nMinSize, FUNIT_CM);
+    m_xVDistField->set_min(nMinSize, FUNIT_CM);
 
-    m_pHDistField->SetLast (m_pHDistField->GetMax());
-    m_pVDistField->SetLast (m_pVDistField->GetMax());
+    m_xHDistField->set_max(long(100) * ((lMax - lLeft ) / std::max(1L, static_cast<long>(nCols))), FUNIT_TWIP);
+    m_xVDistField->set_max(long(100) * ((lMax - lUpper) / std::max(1L, static_cast<long>(nRows))), FUNIT_TWIP);
 
-    m_pWidthField->SetFirst(m_pWidthField->GetMin());
-    m_pHeightField->SetFirst(m_pHeightField->GetMin());
+    m_xWidthField->set_min(nMinSize, FUNIT_CM);
+    m_xHeightField->set_min(nMinSize, FUNIT_CM);
 
-    m_pWidthField->SetLast (m_pWidthField->GetMax());
-    m_pHeightField->SetLast (m_pHeightField->GetMax());
+    m_xWidthField->set_max(long(100) * lHDist, FUNIT_TWIP);
+    m_xHeightField->set_max(long(100) * lVDist, FUNIT_TWIP);
 
-    m_pLeftField->SetLast (m_pLeftField->GetMax());
-    m_pUpperField->SetLast (m_pUpperField->GetMax());
+    m_xLeftField->set_max(long(100) * (lMax - nCols * lHDist), FUNIT_TWIP);
+    m_xUpperField->set_max(long(100) * (lMax - nRows * lVDist), FUNIT_TWIP);
 
-    m_pColsField->SetLast (m_pColsField->GetMax());
-    m_pRowsField->SetLast (m_pRowsField->GetMax());
-    m_pPWidthField->SetFirst(m_pPWidthField->GetMin());
-    m_pPHeightField->SetFirst(m_pPHeightField->GetMin());
+    m_xColsField->set_range(1, (lMax - lLeft ) / std::max(1L, lHDist));
+    m_xRowsField->set_range(1, (lMax - lUpper) / std::max(1L, lVDist));
 
-    m_pPWidthField->SetLast (m_pPWidthField->GetMax());
-    m_pPHeightField->SetLast (m_pPHeightField->GetMax());
-    m_pHDistField->Reformat();
-    m_pVDistField->Reformat();
-    m_pWidthField->Reformat();
-    m_pHeightField->Reformat();
-    m_pLeftField->Reformat();
-    m_pUpperField->Reformat();
-    m_pColsField->Reformat();
-    m_pRowsField->Reformat();
-    m_pPWidthField->Reformat();
-    m_pPHeightField->Reformat();
+    m_xPWidthField->set_range(long(100) * lMinPWidth, long(100) * lMax, FUNIT_TWIP);
+    m_xPHeightField->set_range(long(100) * lMinPHeight, long(100) * lMax, FUNIT_TWIP);
 }
 
 VclPtr<SfxTabPage> SwLabFormatPage::Create(TabPageParent pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SwLabFormatPage>::Create(pParent.pParent, *rSet);
+    return VclPtr<SwLabFormatPage>::Create(pParent, *rSet);
 }
 
 void SwLabFormatPage::ActivatePage(const SfxItemSet& rSet)
@@ -506,16 +423,16 @@ void SwLabFormatPage::FillItem(SwLabItem& rItem)
     rItem.m_aMake = rItem.m_aType = SwResId(STR_CUSTOM_LABEL);
 
     SwLabRec& rRec = *GetParentSwLabDlg()->Recs()[0];
-    rItem.m_lHDist  = rRec.m_nHDist  = static_cast< long >(GETFLDVAL(*m_pHDistField ));
-    rItem.m_lVDist  = rRec.m_nVDist  = static_cast< long >(GETFLDVAL(*m_pVDistField ));
-    rItem.m_lWidth  = rRec.m_nWidth  = static_cast< long >(GETFLDVAL(*m_pWidthField ));
-    rItem.m_lHeight = rRec.m_nHeight = static_cast< long >(GETFLDVAL(*m_pHeightField));
-    rItem.m_lLeft   = rRec.m_nLeft   = static_cast< long >(GETFLDVAL(*m_pLeftField  ));
-    rItem.m_lUpper  = rRec.m_nUpper  = static_cast< long >(GETFLDVAL(*m_pUpperField ));
-    rItem.m_nCols   = rRec.m_nCols   = static_cast< sal_Int32 >(m_pColsField->GetValue());
-    rItem.m_nRows   = rRec.m_nRows   = static_cast< sal_Int32 >(m_pRowsField->GetValue());
-    rItem.m_lPWidth  = rRec.m_nPWidth  = static_cast< long >(GETFLDVAL(*m_pPWidthField ));
-    rItem.m_lPHeight = rRec.m_nPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField));
+    rItem.m_lHDist  = rRec.m_nHDist  = static_cast< long >(getfldval(*m_xHDistField ));
+    rItem.m_lVDist  = rRec.m_nVDist  = static_cast< long >(getfldval(*m_xVDistField ));
+    rItem.m_lWidth  = rRec.m_nWidth  = static_cast< long >(getfldval(*m_xWidthField ));
+    rItem.m_lHeight = rRec.m_nHeight = static_cast< long >(getfldval(*m_xHeightField));
+    rItem.m_lLeft   = rRec.m_nLeft   = static_cast< long >(getfldval(*m_xLeftField  ));
+    rItem.m_lUpper  = rRec.m_nUpper  = static_cast< long >(getfldval(*m_xUpperField ));
+    rItem.m_nCols   = rRec.m_nCols   = static_cast< sal_Int32 >(m_xColsField->get_value());
+    rItem.m_nRows   = rRec.m_nRows   = static_cast< sal_Int32 >(m_xRowsField->get_value());
+    rItem.m_lPWidth  = rRec.m_nPWidth  = static_cast< long >(getfldval(*m_xPWidthField ));
+    rItem.m_lPHeight = rRec.m_nPHeight = static_cast< long >(getfldval(*m_xPHeightField));
 
 }
 
@@ -532,49 +449,49 @@ void SwLabFormatPage::Reset(const SfxItemSet* )
     // Initialise fields
     GetParentSwLabDlg()->GetLabItem(aItem);
 
-    m_pHDistField->SetMax(100 * aItem.m_lHDist , FUNIT_TWIP);
-    m_pVDistField->SetMax(100 * aItem.m_lVDist , FUNIT_TWIP);
-    m_pWidthField->SetMax(100 * aItem.m_lWidth , FUNIT_TWIP);
-    m_pHeightField->SetMax(100 * aItem.m_lHeight, FUNIT_TWIP);
-    m_pLeftField->SetMax(100 * aItem.m_lLeft  , FUNIT_TWIP);
-    m_pUpperField->SetMax(100 * aItem.m_lUpper , FUNIT_TWIP);
-    m_pPWidthField->SetMax(100 * aItem.m_lPWidth , FUNIT_TWIP);
-    m_pPHeightField->SetMax(100 * aItem.m_lPHeight, FUNIT_TWIP);
-
-    SETFLDVAL(*m_pHDistField, aItem.m_lHDist );
-    SETFLDVAL(*m_pVDistField , aItem.m_lVDist );
-    SETFLDVAL(*m_pWidthField , aItem.m_lWidth );
-    SETFLDVAL(*m_pHeightField, aItem.m_lHeight);
-    SETFLDVAL(*m_pLeftField  , aItem.m_lLeft  );
-    SETFLDVAL(*m_pUpperField , aItem.m_lUpper );
-    SETFLDVAL(*m_pPWidthField , aItem.m_lPWidth );
-    SETFLDVAL(*m_pPHeightField, aItem.m_lPHeight);
-
-    m_pColsField->SetMax(aItem.m_nCols);
-    m_pRowsField->SetMax(aItem.m_nRows);
-
-    m_pColsField->SetValue(aItem.m_nCols);
-    m_pRowsField->SetValue(aItem.m_nRows);
-    m_pMakeFI->SetText(aItem.m_aMake);
-    m_pTypeFI->SetText(aItem.m_aType);
+    m_xHDistField->set_max(100 * aItem.m_lHDist , FUNIT_TWIP);
+    m_xVDistField->set_max(100 * aItem.m_lVDist , FUNIT_TWIP);
+    m_xWidthField->set_max(100 * aItem.m_lWidth , FUNIT_TWIP);
+    m_xHeightField->set_max(100 * aItem.m_lHeight, FUNIT_TWIP);
+    m_xLeftField->set_max(100 * aItem.m_lLeft  , FUNIT_TWIP);
+    m_xUpperField->set_max(100 * aItem.m_lUpper , FUNIT_TWIP);
+    m_xPWidthField->set_max(100 * aItem.m_lPWidth , FUNIT_TWIP);
+    m_xPHeightField->set_max(100 * aItem.m_lPHeight, FUNIT_TWIP);
+
+    setfldval(*m_xHDistField, aItem.m_lHDist );
+    setfldval(*m_xVDistField , aItem.m_lVDist );
+    setfldval(*m_xWidthField , aItem.m_lWidth );
+    setfldval(*m_xHeightField, aItem.m_lHeight);
+    setfldval(*m_xLeftField  , aItem.m_lLeft  );
+    setfldval(*m_xUpperField , aItem.m_lUpper );
+    setfldval(*m_xPWidthField , aItem.m_lPWidth );
+    setfldval(*m_xPHeightField, aItem.m_lPHeight);
+
+    m_xColsField->set_max(aItem.m_nCols);
+    m_xRowsField->set_max(aItem.m_nRows);
+
+    m_xColsField->set_value(aItem.m_nCols);
+    m_xRowsField->set_value(aItem.m_nRows);
+    m_xMakeFI->set_label(aItem.m_aMake);
+    m_xTypeFI->set_label(aItem.m_aType);
     PreviewHdl(nullptr);
 }
 
-IMPL_LINK_NOARG(SwLabFormatPage, SaveHdl, Button*, void)
+IMPL_LINK_NOARG(SwLabFormatPage, SaveHdl, weld::Button&, void)
 {
     SwLabRec aRec;
-    aRec.m_nHDist  = static_cast< long >(GETFLDVAL(*m_pHDistField));
-    aRec.m_nVDist  = static_cast< long >(GETFLDVAL(*m_pVDistField ));
-    aRec.m_nWidth  = static_cast< long >(GETFLDVAL(*m_pWidthField ));
-    aRec.m_nHeight = static_cast< long >(GETFLDVAL(*m_pHeightField));
-    aRec.m_nLeft   = static_cast< long >(GETFLDVAL(*m_pLeftField  ));
-    aRec.m_nUpper  = static_cast< long >(GETFLDVAL(*m_pUpperField ));
-    aRec.m_nCols   = static_cast< sal_Int32 >(m_pColsField->GetValue());
-    aRec.m_nRows   = static_cast< sal_Int32 >(m_pRowsField->GetValue());
-    aRec.m_nPWidth  = static_cast< long >(GETFLDVAL(*m_pPWidthField ));
-    aRec.m_nPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField));
+    aRec.m_nHDist  = static_cast< long >(getfldval(*m_xHDistField));
+    aRec.m_nVDist  = static_cast< long >(getfldval(*m_xVDistField ));
+    aRec.m_nWidth  = static_cast< long >(getfldval(*m_xWidthField ));
+    aRec.m_nHeight = static_cast< long >(getfldval(*m_xHeightField));
+    aRec.m_nLeft   = static_cast< long >(getfldval(*m_xLeftField  ));
+    aRec.m_nUpper  = static_cast< long >(getfldval(*m_xUpperField ));
+    aRec.m_nCols   = static_cast< sal_Int32 >(m_xColsField->get_value());
+    aRec.m_nRows   = static_cast< sal_Int32 >(m_xRowsField->get_value());
+    aRec.m_nPWidth  = static_cast< long >(getfldval(*m_xPWidthField ));
+    aRec.m_nPHeight = static_cast< long >(getfldval(*m_xPHeightField));
     aRec.m_bCont = aItem.m_bCont;
-    SwSaveLabelDlg aSaveDlg(this, aRec);
+    SwSaveLabelDlg aSaveDlg(GetParentSwLabDlg(), aRec);
     aSaveDlg.SetLabel(aItem.m_aLstMake, aItem.m_aLstType);
     aSaveDlg.run();
     if (aSaveDlg.GetLabel(aItem))
@@ -586,15 +503,15 @@ IMPL_LINK_NOARG(SwLabFormatPage, SaveHdl, Button*, void)
         {
             rMakes = rMan;
         }
-        m_pMakeFI->SetText(aItem.m_aMake);
-        m_pTypeFI->SetText(aItem.m_aType);
+        m_xMakeFI->set_label(aItem.m_aMake);
+        m_xTypeFI->set_label(aItem.m_aType);
     }
 }
 
-SwSaveLabelDlg::SwSaveLabelDlg(SwLabFormatPage* pParent, SwLabRec& rRec)
+SwSaveLabelDlg::SwSaveLabelDlg(SwLabDlg* pParent, SwLabRec& rRec)
     : GenericDialogController(pParent->GetFrameWeld(), "modules/swriter/ui/savelabeldialog.ui", "SaveLabelDialog")
     , bSuccess(false)
-    , pLabPage(pParent)
+    , m_pLabDialog(pParent)
     , rLabRec(rRec)
     , m_xMakeCB(m_xBuilder->weld_combo_box_text("brand"))
     , m_xTypeED(m_xBuilder->weld_entry("type"))
@@ -604,7 +521,7 @@ SwSaveLabelDlg::SwSaveLabelDlg(SwLabFormatPage* pParent, SwLabRec& rRec)
     m_xMakeCB->connect_changed(LINK(this, SwSaveLabelDlg, ModifyComboHdl));
     m_xTypeED->connect_changed(LINK(this, SwSaveLabelDlg, ModifyEntryHdl));
 
-    SwLabelConfig& rCfg = pLabPage->GetParentSwLabDlg()->GetLabelsConfig();
+    SwLabelConfig& rCfg = m_pLabDialog->GetLabelsConfig();
     const std::vector<OUString>& rMan = rCfg.GetManufacturers();
     for (const auto & i : rMan)
     {
@@ -618,7 +535,7 @@ SwSaveLabelDlg::~SwSaveLabelDlg()
 
 IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl, weld::Button&, void)
 {
-    SwLabelConfig& rCfg = pLabPage->GetParentSwLabDlg()->GetLabelsConfig();
+    SwLabelConfig& rCfg = m_pLabDialog->GetLabelsConfig();
     OUString sMake(m_xMakeCB->get_active_text());
     OUString sType(m_xTypeED->get_text());
     if(rCfg.HasLabel(sMake, sType))
diff --git a/sw/source/ui/envelp/labfmt.hxx b/sw/source/ui/envelp/labfmt.hxx
index ddbb559cbd8b..81e79351ce16 100644
--- a/sw/source/ui/envelp/labfmt.hxx
+++ b/sw/source/ui/envelp/labfmt.hxx
@@ -26,8 +26,11 @@
 
 class SwLabFormatPage;
 
-class SwLabPreview : public vcl::Window
+class SwLabPreview
 {
+    std::unique_ptr<weld::DrawingArea> m_xDrawingArea;
+
+    Size m_aSize;
     Color m_aGrayColor;
 
     OUString m_aHDistStr;
@@ -51,43 +54,42 @@ class SwLabPreview : public vcl::Window
 
     SwLabItem m_aItem;
 
-    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
-
-    virtual Size GetOptimalSize() const override;
+    DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
+    DECL_LINK(DoResize, const Size& rSize, void);
 
 public:
 
-    explicit SwLabPreview(vcl::Window* pParent);
+    explicit SwLabPreview(weld::DrawingArea* pDrawingArea);
 
     void UpdateItem(const SwLabItem& rItem);
 };
 
 class SwLabFormatPage : public SfxTabPage
 {
-    VclPtr<FixedText>    m_pMakeFI;
-    VclPtr<FixedText>    m_pTypeFI;
-    VclPtr<SwLabPreview> m_pPreview;
-    VclPtr<MetricField>  m_pHDistField;
-    VclPtr<MetricField>  m_pVDistField;
-    VclPtr<MetricField>  m_pWidthField;
-    VclPtr<MetricField>  m_pHeightField;
-    VclPtr<MetricField>  m_pLeftField;
-    VclPtr<MetricField>  m_pUpperField;
-    VclPtr<NumericField> m_pColsField;
-    VclPtr<NumericField> m_pRowsField;
-    VclPtr<MetricField>  m_pPWidthField;
-    VclPtr<MetricField>  m_pPHeightField;
-    VclPtr<PushButton>   m_pSavePB;
-
     Idle aPreviewIdle;
-    bool  bModified;
-
-    SwLabItem    aItem;
-
-    DECL_LINK( ModifyHdl, Edit&, void );
+    SwLabItem aItem;
+    bool bModified;
+
+    std::unique_ptr<weld::Label>  m_xMakeFI;
+    std::unique_ptr<weld::Label>  m_xTypeFI;
+    std::unique_ptr<SwLabPreview> m_xPreview;
+    std::unique_ptr<weld::MetricSpinButton>  m_xHDistField;
+    std::unique_ptr<weld::MetricSpinButton>  m_xVDistField;
+    std::unique_ptr<weld::MetricSpinButton>  m_xWidthField;
+    std::unique_ptr<weld::MetricSpinButton>  m_xHeightField;
+    std::unique_ptr<weld::MetricSpinButton>  m_xLeftField;
+    std::unique_ptr<weld::MetricSpinButton>  m_xUpperField;
+    std::unique_ptr<weld::SpinButton> m_xColsField;
+    std::unique_ptr<weld::SpinButton> m_xRowsField;
+    std::unique_ptr<weld::MetricSpinButton>  m_xPWidthField;
+    std::unique_ptr<weld::MetricSpinButton>  m_xPHeightField;
+    std::unique_ptr<weld::Button> m_xSavePB;
+
+
+    DECL_LINK( ModifyHdl, weld::SpinButton&, void );
+    DECL_LINK( MetricModifyHdl, weld::MetricSpinButton&, void );
     DECL_LINK( PreviewHdl, Timer *, void );
-    DECL_LINK( LoseFocusHdl, Control&, void );
-    DECL_LINK( SaveHdl, Button*, void );
+    DECL_LINK( SaveHdl, weld::Button&, void );
 
     void ChangeMinMax();
 
@@ -95,9 +97,8 @@ class SwLabFormatPage : public SfxTabPage
     using TabPage::DeactivatePage;
 
 public:
-    SwLabFormatPage(vcl::Window* pParent, const SfxItemSet& rSet);
+    SwLabFormatPage(TabPageParent pParent, const SfxItemSet& rSet);
     virtual ~SwLabFormatPage() override;
-    virtual void dispose() override;
 
     static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rSet);
 
@@ -107,14 +108,14 @@ public:
     virtual bool FillItemSet(SfxItemSet* rSet) override;
     virtual void Reset(const SfxItemSet* rSet) override;
 
-    SwLabDlg* GetParentSwLabDlg() {return static_cast<SwLabDlg*>(GetParentDialog());}
+    SwLabDlg* GetParentSwLabDlg() {return static_cast<SwLabDlg*>(GetTabDialog());}
 };
 
 class SwSaveLabelDlg : public weld::GenericDialogController
 {
     bool        bSuccess;
-    VclPtr<SwLabFormatPage>   pLabPage;
-    SwLabRec&       rLabRec;
+    VclPtr<SwLabDlg> m_pLabDialog;
+    SwLabRec&   rLabRec;
 
     std::unique_ptr<weld::ComboBoxText> m_xMakeCB;
     std::unique_ptr<weld::Entry>        m_xTypeED;
@@ -127,7 +128,7 @@ class SwSaveLabelDlg : public weld::GenericDialogController
     void Modify();
 
 public:
-    SwSaveLabelDlg(SwLabFormatPage* pParent, SwLabRec& rRec);
+    SwSaveLabelDlg(SwLabDlg* pParent, SwLabRec& rRec);
     virtual ~SwSaveLabelDlg() override;
 
     void SetLabel(const OUString& rMake, const OUString& rType)
diff --git a/sw/source/uibase/inc/labimp.hxx b/sw/source/uibase/inc/labimp.hxx
index b6034827efd7..2cd379e45950 100644
--- a/sw/source/uibase/inc/labimp.hxx
+++ b/sw/source/uibase/inc/labimp.hxx
@@ -31,6 +31,16 @@
 #define GETFLDVAL(rField)         (rField).Denormalize((rField).GetValue(FUNIT_TWIP))
 #define SETFLDVAL(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
 
+inline int getfldval(weld::MetricSpinButton& rField)
+{
+    return rField.denormalize(rField.get_value(FUNIT_TWIP));
+}
+
+inline void setfldval(weld::MetricSpinButton& rField, int lValue)
+{
+    rField.set_value(rField.normalize(lValue), FUNIT_TWIP);
+}
+
 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_LABIMP_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/uitool.hxx b/sw/source/uibase/inc/uitool.hxx
index 54f2268a7cfe..51d3c9faa0f7 100644
--- a/sw/source/uibase/inc/uitool.hxx
+++ b/sw/source/uibase/inc/uitool.hxx
@@ -40,6 +40,7 @@ class SfxViewFrame;
 
 // switch a metric
 SW_DLLPUBLIC void SetMetric(MetricFormatter& rCtrl, FieldUnit eUnit);
+SW_DLLPUBLIC void SetMetric(weld::MetricSpinButton& rCtrl, FieldUnit eUnit);
 
 // fill BoxInfo attribute
 SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh);
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index 2bac72c751fc..a29449286634 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -96,6 +96,14 @@ void SetMetric(MetricFormatter& rCtrl, FieldUnit eUnit)
     rCtrl.SetMax(nMax, FUNIT_TWIP);
 }
 
+void SetMetric(weld::MetricSpinButton& rCtrl, FieldUnit eUnit)
+{
+    int nMin, nMax;
+    rCtrl.get_range(nMin, nMax, FUNIT_TWIP);
+    rCtrl.set_unit(eUnit);
+    rCtrl.set_range(nMin, nMax, FUNIT_TWIP);
+}
+
 // Set boxinfo attribute
 
 void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh)
diff --git a/sw/uiconfig/swriter/ui/labelformatpage.ui b/sw/uiconfig/swriter/ui/labelformatpage.ui
index 7b3b34037aa1..e3a9608dff30 100644
--- a/sw/uiconfig/swriter/ui/labelformatpage.ui
+++ b/sw/uiconfig/swriter/ui/labelformatpage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <requires lib="LibreOffice" version="1.0"/>
@@ -10,6 +10,12 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="lower">1</property>
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkBox" id="LabelFormatPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -25,10 +31,10 @@
           <object class="GtkLabel" id="label1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label1">Hori_zontal pitch:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">hori:0.00cm</property>
+            <property name="mnemonic_widget">hori</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -39,10 +45,10 @@
           <object class="GtkLabel" id="label2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label2">_Vertical pitch:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">vert:0.00cm</property>
+            <property name="mnemonic_widget">vert</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -53,10 +59,10 @@
           <object class="GtkLabel" id="label3">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label3">_Width:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">width:0.00cm</property>
+            <property name="mnemonic_widget">width</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -67,10 +73,10 @@
           <object class="GtkLabel" id="label4">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label4">_Height:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">height:0.00cm</property>
+            <property name="mnemonic_widget">height</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -81,10 +87,10 @@
           <object class="GtkLabel" id="label5">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label5">_Left margin:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">left:0.00cm</property>
+            <property name="mnemonic_widget">left</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -95,10 +101,10 @@
           <object class="GtkLabel" id="label6">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label6">_Top margin:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">top:0.00cm</property>
+            <property name="mnemonic_widget">top</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -109,10 +115,10 @@
           <object class="GtkLabel" id="label7">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label7">_Columns:</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">cols</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -123,10 +129,10 @@
           <object class="GtkLabel" id="label8">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label8">R_ows:</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">rows</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -137,10 +143,10 @@
           <object class="GtkLabel" id="label9">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label9">P_age width:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">pagewidth:0.00cm</property>
+            <property name="mnemonic_widget">pagewidth</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -151,10 +157,10 @@
           <object class="GtkLabel" id="label10">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="labelformatpage|label10">Pa_ge height:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">pageheight:0.00cm</property>
+            <property name="mnemonic_widget">pageheight</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -177,9 +183,10 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="hori:0.00cm">
+          <object class="GtkSpinButton" id="hori">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="activates_default">True</property>
             <property name="digits">2</property>
           </object>
           <packing>
@@ -188,9 +195,10 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="vert:0.00cm">
+          <object class="GtkSpinButton" id="vert">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="activates_default">True</property>
             <property name="digits">2</property>
           </object>
           <packing>
@@ -199,9 +207,10 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="width:0.00cm">
+          <object class="GtkSpinButton" id="width">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="activates_default">True</property>
             <property name="digits">2</property>
           </object>
           <packing>
@@ -210,9 +219,10 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="height:0.00cm">
+          <object class="GtkSpinButton" id="height">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="activates_default">True</property>
             <property name="digits">2</property>
           </object>
           <packing>
@@ -221,9 +231,10 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="left:0.00cm">
+          <object class="GtkSpinButton" id="left">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="activates_default">True</property>
             <property name="digits">2</property>
           </object>
           <packing>
@@ -232,9 +243,10 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="top:0.00cm">
+          <object class="GtkSpinButton" id="top">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="activates_default">True</property>
             <property name="digits">2</property>
           </object>
           <packing>
@@ -246,6 +258,7 @@
           <object class="GtkSpinButton" id="cols">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="activates_default">True</property>
             <property name="adjustment">adjustment1</property>
           </object>
           <packing>
@@ -257,7 +270,8 @@
           <object class="GtkSpinButton" id="rows">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="adjustment">adjustment1</property>
+            <property name="activates_default">True</property>
+            <property name="adjustment">adjustment2</property>
           </object>
           <packing>
             <property name="left_attach">1</property>
@@ -265,9 +279,10 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="pagewidth:0.00cm">
+          <object class="GtkSpinButton" id="pagewidth">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="activates_default">True</property>
             <property name="digits">2</property>
           </object>
           <packing>
@@ -276,9 +291,10 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="pageheight:0.00cm">
+          <object class="GtkSpinButton" id="pageheight">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="activates_default">True</property>
             <property name="digits">2</property>
           </object>
           <packing>
@@ -301,7 +317,7 @@
         <property name="vexpand">True</property>
         <property name="column_spacing">12</property>
         <child>
-          <object class="swuilo-SwLabPreview" id="preview">
+          <object class="GtkDrawingArea" id="preview">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="hexpand">True</property>
@@ -317,10 +333,10 @@
           <object class="GtkLabel" id="make">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">top:0.00cm</property>
+            <property name="mnemonic_widget">top</property>
             <property name="max_width_chars">32</property>
+            <property name="xalign">0</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -331,10 +347,10 @@
           <object class="GtkLabel" id="type">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">top:0.00cm</property>
+            <property name="mnemonic_widget">top</property>
             <property name="max_width_chars">32</property>
+            <property name="xalign">0</property>
           </object>
           <packing>
             <property name="left_attach">1</property>
diff --git a/sw/uiconfig/swriter/ui/labeloptionspage.ui b/sw/uiconfig/swriter/ui/labeloptionspage.ui
index f9cb8ec893dd..c9e4d27fbb24 100644
--- a/sw/uiconfig/swriter/ui/labeloptionspage.ui
+++ b/sw/uiconfig/swriter/ui/labeloptionspage.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Generated with glade 3.20.4 -->
 <interface domain="sw">
-  <requires lib="gtk+" version="3.0"/>
+  <requires lib="gtk+" version="3.18"/>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="lower">1</property>
     <property name="upper">100</property>
@@ -101,6 +101,7 @@
                           <object class="GtkSpinButton" id="cols">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="activates_default">True</property>
                             <property name="adjustment">adjustment1</property>
                           </object>
                           <packing>
@@ -137,6 +138,7 @@
                           <object class="GtkSpinButton" id="rows">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="activates_default">True</property>
                             <property name="adjustment">adjustment2</property>
                           </object>
                           <packing>


More information about the Libreoffice-commits mailing list