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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 4 14:58:44 UTC 2020


 solenv/sanitizers/ui/modules/swriter.suppr      |    8 +
 sw/UIConfig_swriter.mk                          |    5 -
 sw/inc/strings.hrc                              |    2 
 sw/source/uibase/docvw/FrameControlsManager.cxx |   22 ++++-
 sw/source/uibase/docvw/HeaderFooterWin.cxx      |   90 ++++++++++++----------
 sw/source/uibase/docvw/PageBreakWin.cxx         |   69 ++++++-----------
 sw/source/uibase/docvw/UnfloatTableButton.cxx   |   43 +++++++---
 sw/source/uibase/inc/FrameControl.hxx           |   15 ++-
 sw/source/uibase/inc/HeaderFooterWin.hxx        |   15 +--
 sw/source/uibase/inc/PageBreakWin.hxx           |   15 +--
 sw/source/uibase/inc/UnfloatTableButton.hxx     |    6 +
 sw/uiconfig/swriter/ui/headerfootermenu.ui      |   47 -----------
 sw/uiconfig/swriter/ui/hfmenubutton.ui          |   97 ++++++++++++++++++++++++
 sw/uiconfig/swriter/ui/pagebreakmenu.ui         |   25 ------
 sw/uiconfig/swriter/ui/pbmenubutton.ui          |   59 ++++++++++++++
 sw/uiconfig/swriter/ui/unfloatbutton.ui         |   28 ++++++
 16 files changed, 351 insertions(+), 195 deletions(-)

New commits:
commit 51379fb3d46e5891bdaea0122bd62b0753663da3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Dec 3 15:54:45 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Dec 4 15:57:41 2020 +0100

    weld writer's FrameControl MenuButtons
    
    Change-Id: I507b043672ffd102f85110bed221a05b756500db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107174
    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 5eec1594569b..922203ebcc9d 100644
--- a/solenv/sanitizers/ui/modules/swriter.suppr
+++ b/solenv/sanitizers/ui/modules/swriter.suppr
@@ -58,8 +58,10 @@ sw/uiconfig/swriter/ui/frmtypepage.ui://GtkCheckButton[@id='relheight'] missing-
 sw/uiconfig/swriter/ui/gotopagedialog.ui://GtkLabel[@id='page_count'] orphan-label
 sw/uiconfig/swriter/ui/gotopagedialog.ui://GtkEntry[@id='page'] no-labelled-by
 sw/uiconfig/swriter/ui/gotopagedialog.ui://GtkLabel[@id='page_label'] orphan-label
-sw/uiconfig/swriter/ui/headerfootermenu.ui://GtkMenuItem[@id='edit'] button-no-label
-sw/uiconfig/swriter/ui/headerfootermenu.ui://GtkMenuItem[@id='delete'] button-no-label
+sw/uiconfig/swriter/ui/hfmenubutton.ui://GtkMenuItem[@id='edit'] button-no-label
+sw/uiconfig/swriter/ui/hfmenubutton.ui://GtkMenuItem[@id='delete'] button-no-label
+sw/uiconfig/swriter/ui/hfmenubutton.ui://GtkButton[@id='button'] button-no-label
+sw/uiconfig/swriter/ui/hfmenubutton.ui://GtkMenuButton[@id='menubutton'] button-no-label
 sw/uiconfig/swriter/ui/inputeditbox.ui://GtkEntry[@id='entry'] no-labelled-by
 sw/uiconfig/swriter/ui/insertbookmark.ui://GtkLabel[@id='lbForbiddenChars'] orphan-label
 sw/uiconfig/swriter/ui/insertbreak.ui://GtkSpinButton[@id='pagenumsb'] missing-label-for
@@ -84,6 +86,7 @@ sw/uiconfig/swriter/ui/opttablepage.ui://GtkLabel[@id='label13'] orphan-label
 sw/uiconfig/swriter/ui/opttablepage.ui://GtkLabel[@id='label4'] orphan-label
 sw/uiconfig/swriter/ui/opttablepage.ui://GtkLabel[@id='label14'] orphan-label
 sw/uiconfig/swriter/ui/outlinenumberingpage.ui://GtkDrawingArea[@id='preview'] no-labelled-by
+sw/uiconfig/swriter/ui/pbmenubutton.ui://GtkMenuButton[@id='menubutton'] button-no-label
 sw/uiconfig/swriter/ui/poseditbox.ui://GtkEntry[@id='entry'] no-labelled-by
 sw/uiconfig/swriter/ui/mailmerge.ui://GtkLabel[@id='fieldlabel'] orphan-label
 sw/uiconfig/swriter/ui/mailmerge.ui://GtkLabel[@id='mailformatlabel'] orphan-label
@@ -177,6 +180,7 @@ sw/uiconfig/swriter/ui/tokenwidget.ui://GtkButton[@id='left'] button-no-label
 sw/uiconfig/swriter/ui/tokenwidget.ui://GtkButton[@id='right'] button-no-label
 sw/uiconfig/swriter/ui/toxbuttonwidget.ui://GtkToggleButton[@id='button'] button-no-label
 sw/uiconfig/swriter/ui/toxentrywidget.ui://GtkEntry[@id='entry'] no-labelled-by
+sw/uiconfig/swriter/ui/unfloatbutton.ui://GtkButton[@id='button'] button-no-label
 sw/uiconfig/swriter/ui/viewoptionspage.ui://GtkLabel[@id='measureunitlabel'] orphan-label
 sw/uiconfig/swriter/ui/watermarkdialog.ui://GtkLabel[@id='TextLabel'] orphan-label
 sw/uiconfig/swriter/ui/watermarkdialog.ui://GtkLabel[@id='FontLabel'] orphan-label
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 33074fc8f76e..71a0632d6979 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -161,7 +161,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/frmtypepage \
 	sw/uiconfig/swriter/ui/frmurlpage \
 	sw/uiconfig/swriter/ui/gotopagedialog \
-	sw/uiconfig/swriter/ui/headerfootermenu \
+	sw/uiconfig/swriter/ui/hfmenubutton \
 	sw/uiconfig/swriter/ui/indexentry \
 	sw/uiconfig/swriter/ui/inputfielddialog \
 	sw/uiconfig/swriter/ui/inputwinmenu \
@@ -204,6 +204,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/outlinenumbering \
 	sw/uiconfig/swriter/ui/outlinenumberingpage \
 	sw/uiconfig/swriter/ui/outlinepositionpage \
+	sw/uiconfig/swriter/ui/pbmenubutton \
 	sw/uiconfig/swriter/ui/querycontinuebegindialog \
 	sw/uiconfig/swriter/ui/querycontinueenddialog \
 	sw/uiconfig/swriter/ui/querydefaultcompatdialog \
@@ -232,7 +233,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/notebookbar_groups \
 	sw/uiconfig/swriter/ui/notebookbar_groupedbar_full \
 	sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact \
-	sw/uiconfig/swriter/ui/pagebreakmenu \
 	sw/uiconfig/swriter/ui/pagecolumncontrol \
 	sw/uiconfig/swriter/ui/pagemargincontrol \
 	sw/uiconfig/swriter/ui/pageorientationcontrol \
@@ -295,6 +295,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/tokenwidget \
 	sw/uiconfig/swriter/ui/toxentrywidget \
 	sw/uiconfig/swriter/ui/toxbuttonwidget \
+	sw/uiconfig/swriter/ui/unfloatbutton \
 	sw/uiconfig/swriter/ui/viewoptionspage \
 	sw/uiconfig/swriter/ui/warndatasourcedialog \
 	sw/uiconfig/swriter/ui/warnemaildialog \
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index e5f20d867d2d..dacf67d6543c 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1229,6 +1229,8 @@
 
 #define STR_UNFLOAT_TABLE                       NC_("STR_UNFLOAT_TABLE", "Un-float Table")
 
+#define STR_PAGE_BREAK_BUTTON                   NC_("STR_PAGE_BREAK_BUTTON", "Edit page break")
+
 #define STR_GRFILTER_OPENERROR                  NC_("STR_GRFILTER_OPENERROR", "Image file cannot be opened")
 #define STR_GRFILTER_IOERROR                    NC_("STR_GRFILTER_IOERROR", "Image file cannot be read")
 #define STR_GRFILTER_FORMATERROR                NC_("STR_GRFILTER_FORMATERROR", "Unknown image format")
diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx
index 576033398827..2232ca7ed869 100644
--- a/sw/source/uibase/docvw/FrameControlsManager.cxx
+++ b/sw/source/uibase/docvw/FrameControlsManager.cxx
@@ -21,6 +21,8 @@
 #include <OutlineContentVisibilityWin.hxx>
 #include <ndtxt.hxx>
 #include <IDocumentOutlineNodes.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
 
 using namespace std;
 
@@ -177,10 +179,11 @@ void SwFrameControlsManager::SetUnfloatTableButton( const SwFlyFrame* pFlyFrame,
     pControl->ShowAll( bShow );
 }
 
-SwFrameMenuButtonBase::SwFrameMenuButtonBase( SwEditWin* pEditWin, const SwFrame* pFrame ) :
-    MenuButton( pEditWin, WB_DIALOGCONTROL ),
-    m_pEditWin( pEditWin ),
-    m_pFrame( pFrame )
+SwFrameMenuButtonBase::SwFrameMenuButtonBase(SwEditWin* pEditWin, const SwFrame* pFrame,
+                                             const OUString& rUIXMLDescription, const OString& rID)
+    : InterimItemWindow(pEditWin, rUIXMLDescription, rID)
+    , m_pEditWin(pEditWin)
+    , m_pFrame(pFrame)
 {
 }
 
@@ -302,7 +305,16 @@ void SwFrameMenuButtonBase::dispose()
 {
     m_pEditWin.clear();
     m_pFrame = nullptr;
-    MenuButton::dispose();
+    m_xVirDev.disposeAndClear();
+    InterimItemWindow::dispose();
+}
+
+void SwFrameMenuButtonBase::SetVirDevFont()
+{
+    // Get the font and configure it
+    vcl::Font aFont = Application::GetSettings().GetStyleSettings().GetToolFont();
+    if (vcl::Window* pDefaultDevice = dynamic_cast<vcl::Window*>(Application::GetDefaultDevice()))
+        pDefaultDevice->SetPointFont(*m_xVirDev, aFont);
 }
 
 SwFrameControl::SwFrameControl( const VclPtr<vcl::Window> &pWindow )
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 7305a440d29a..0c4ed113f6c7 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -46,9 +46,9 @@
 #include <vcl/canvastools.hxx>
 #include <vcl/menu.hxx>
 #include <vcl/metric.hxx>
-#include <vcl/menubtn.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/virdev.hxx>
 #include <memory>
 
 #define TEXT_PADDING 5
@@ -162,20 +162,20 @@ void SwFrameButtonPainter::PaintButton(drawinglayer::primitive2d::Primitive2DCon
 }
 
 SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwFrame *pFrame, bool bHeader ) :
-    SwFrameMenuButtonBase( pEditWin, pFrame ),
-    m_aBuilder(nullptr, AllSettings::GetUIRootDir(), "modules/swriter/ui/headerfootermenu.ui", ""),
+    SwFrameMenuButtonBase(pEditWin, pFrame, "modules/swriter/ui/hfmenubutton.ui", "HFMenuButton"),
+    m_xMenuButton(m_xBuilder->weld_menu_button("menubutton")),
+    m_xPushButton(m_xBuilder->weld_button("button")),
     m_bIsHeader( bHeader ),
-    m_pPopupMenu(m_aBuilder.get_menu("menu")),
     m_pLine( nullptr ),
     m_bIsAppearing( false ),
     m_nFadeRate( 100 ),
     m_aFadeTimer( )
 {
-    //FIXME RenderContext
+    m_xVirDev = m_xMenuButton->create_virtual_device();
+    SetVirDevFont();
 
-    // Get the font and configure it
-    vcl::Font aFont = Application::GetSettings().GetStyleSettings().GetToolFont();
-    SetZoomedPointFont(*this, aFont);
+    m_xPushButton->connect_clicked(LINK(this, SwHeaderFooterWin, ClickHdl));
+    m_xMenuButton->connect_selected(LINK(this, SwHeaderFooterWin, SelectHdl));
 
     // Create the line control
     m_pLine = VclPtr<SwDashedLine>::Create(GetEditWin(), &SwViewOption::GetHeaderFooterMarkColor);
@@ -185,17 +185,15 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwFrame *pFrame
     // Rewrite the menu entries' text
     if (m_bIsHeader)
     {
-        m_pPopupMenu->SetItemText(m_pPopupMenu->GetItemId("edit"), SwResId(STR_FORMAT_HEADER));
-        m_pPopupMenu->SetItemText(m_pPopupMenu->GetItemId("delete"), SwResId(STR_DELETE_HEADER));
+        m_xMenuButton->set_item_label("edit", SwResId(STR_FORMAT_HEADER));
+        m_xMenuButton->set_item_label("delete", SwResId(STR_DELETE_HEADER));
     }
     else
     {
-        m_pPopupMenu->SetItemText(m_pPopupMenu->GetItemId("edit"), SwResId(STR_FORMAT_FOOTER));
-        m_pPopupMenu->SetItemText(m_pPopupMenu->GetItemId("delete"), SwResId(STR_DELETE_FOOTER));
+        m_xMenuButton->set_item_label("edit", SwResId(STR_FORMAT_FOOTER));
+        m_xMenuButton->set_item_label("delete", SwResId(STR_DELETE_FOOTER));
     }
 
-    SetPopupMenu(m_pPopupMenu);
-
     m_aFadeTimer.SetTimeout(50);
     m_aFadeTimer.SetInvokeHandler(LINK(this, SwHeaderFooterWin, FadeHandler));
 }
@@ -207,9 +205,9 @@ SwHeaderFooterWin::~SwHeaderFooterWin( )
 
 void SwHeaderFooterWin::dispose()
 {
-    m_pPopupMenu.clear();
-    m_aBuilder.disposeBuilder();
     m_pLine.disposeAndClear();
+    m_xPushButton.reset();
+    m_xMenuButton.reset();
     SwFrameMenuButtonBase::dispose();
 }
 
@@ -234,12 +232,13 @@ void SwHeaderFooterWin::SetOffset(Point aOffset, tools::Long nXLineStart, tools:
 
     sal_Int32 nPos = m_sLabel.lastIndexOf("%1");
     m_sLabel = m_sLabel.replaceAt(nPos, 2, pDesc->GetName());
+    m_xMenuButton->set_accessible_name(m_sLabel);
 
     // Compute the text size and get the box position & size from it
     ::tools::Rectangle aTextRect;
-    GetTextBoundRect(aTextRect, m_sLabel);
-    ::tools::Rectangle aTextPxRect = LogicToPixel(aTextRect);
-    FontMetric aFontMetric = GetFontMetric(GetFont());
+    m_xVirDev->GetTextBoundRect(aTextRect, m_sLabel);
+    ::tools::Rectangle aTextPxRect = m_xVirDev->LogicToPixel(aTextRect);
+    FontMetric aFontMetric = m_xVirDev->GetFontMetric(m_xVirDev->GetFont());
     Size aBoxSize (aTextPxRect.GetWidth() + BUTTON_WIDTH + TEXT_PADDING * 2,
                    aFontMetric.GetLineHeight() + TEXT_PADDING  * 2 );
 
@@ -258,6 +257,9 @@ void SwHeaderFooterWin::SetOffset(Point aOffset, tools::Long nXLineStart, tools:
     // Set the position & Size of the window
     SetPosSizePixel(aBoxPos, aBoxSize);
 
+    m_xVirDev->SetOutputSizePixel(aBoxSize);
+    PaintButton();
+
     double nYLinePos = aBoxPos.Y();
     if (!m_bIsHeader)
         nYLinePos += aBoxSize.Height();
@@ -268,6 +270,10 @@ void SwHeaderFooterWin::SetOffset(Point aOffset, tools::Long nXLineStart, tools:
 
 void SwHeaderFooterWin::ShowAll(bool bShow)
 {
+    bool bIsEmptyHeaderFooter = IsEmptyHeaderFooter();
+    m_xMenuButton->set_visible(!bIsEmptyHeaderFooter);
+    m_xPushButton->set_visible(bIsEmptyHeaderFooter);
+
     if (!PopupMenu::IsInExecute())
     {
         m_bIsAppearing = bShow;
@@ -288,21 +294,24 @@ bool SwHeaderFooterWin::Contains( const Point &rDocPt ) const
     return aLineRect.IsInside(rDocPt);
 }
 
-void SwHeaderFooterWin::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
+void SwHeaderFooterWin::PaintButton()
 {
+    if (!m_xVirDev)
+        return;
+
     // Use pixels for the rest of the drawing
     SetMapMode(MapMode(MapUnit::MapPixel));
     drawinglayer::primitive2d::Primitive2DContainer aSeq;
-    const ::tools::Rectangle aRect(::tools::Rectangle(Point(0, 0), rRenderContext.PixelToLogic(GetSizePixel())));
+    const ::tools::Rectangle aRect(::tools::Rectangle(Point(0, 0), m_xVirDev->PixelToLogic(GetSizePixel())));
 
     SwFrameButtonPainter::PaintButton(aSeq, aRect, m_bIsHeader);
 
     // Create the text primitive
     basegfx::BColor aLineColor = SwViewOption::GetHeaderFooterMarkColor().getBColor();
     B2DVector aFontSize;
-    FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, rRenderContext.GetFont(), false, false);
+    FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_xVirDev->GetFont(), false, false);
 
-    FontMetric aFontMetric = rRenderContext.GetFontMetric(rRenderContext.GetFont());
+    FontMetric aFontMetric = m_xVirDev->GetFontMetric(m_xVirDev->GetFont());
     double nTextOffsetY = aFontMetric.GetAscent() + TEXT_PADDING;
     Point aTextPos(TEXT_PADDING, nTextOffsetY);
 
@@ -320,7 +329,8 @@ void SwHeaderFooterWin::Paint(vcl::RenderContext& rRenderContext, const ::tools:
                            B2DSize(aRect.Right(), aRect.getHeight()));
 
     B2DPolygon aSign;
-    if (IsEmptyHeaderFooter())
+    bool bIsEmptyHeaderFooter = IsEmptyHeaderFooter();
+    if (bIsEmptyHeaderFooter)
     {
         // Create the + polygon
         double nLeft = aSignArea.getMinX() + TEXT_PADDING;
@@ -367,7 +377,7 @@ void SwHeaderFooterWin::Paint(vcl::RenderContext& rRenderContext, const ::tools:
     // Create the processor and process the primitives
     const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
     std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
-        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aNewViewInfos));
+        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(*m_xVirDev, aNewViewInfos));
 
     // TODO Ghost it all if needed
     drawinglayer::primitive2d::Primitive2DContainer aGhostedSeq(1);
@@ -381,6 +391,11 @@ void SwHeaderFooterWin::Paint(vcl::RenderContext& rRenderContext, const ::tools:
                         new drawinglayer::primitive2d::ModifiedColorPrimitive2D(aSeq, aBColorModifier));
 
     pProcessor->process(aGhostedSeq);
+
+    if (bIsEmptyHeaderFooter)
+        m_xPushButton->set_custom_button(m_xVirDev.get());
+    else
+        m_xMenuButton->set_custom_button(m_xVirDev.get());
 }
 
 bool SwHeaderFooterWin::IsEmptyHeaderFooter( ) const
@@ -476,23 +491,22 @@ void SwHeaderFooterWin::SetReadonly( bool bReadonly )
     ShowAll( !bReadonly );
 }
 
-void SwHeaderFooterWin::MouseButtonDown( const MouseEvent& rMEvt )
+IMPL_LINK_NOARG(SwHeaderFooterWin, ClickHdl, weld::Button&, void)
 {
-    if (IsEmptyHeaderFooter())
-    {
-        SwView& rView = GetEditWin()->GetView();
-        SwWrtShell& rSh = rView.GetWrtShell();
+    SwView& rView = GetEditWin()->GetView();
+    SwWrtShell& rSh = rView.GetWrtShell();
 
-        const OUString& rStyleName = GetPageFrame()->GetPageDesc()->GetName();
-        rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false );
-    }
-    else
-        MenuButton::MouseButtonDown( rMEvt );
+    const OUString& rStyleName = GetPageFrame()->GetPageDesc()->GetName();
+    rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false );
+
+    m_xPushButton->hide();
+    m_xMenuButton->show();
+    PaintButton();
 }
 
-void SwHeaderFooterWin::Select()
+IMPL_LINK(SwHeaderFooterWin, SelectHdl, const OString&, rIdent, void)
 {
-    ExecuteCommand(GetCurItemIdent());
+    ExecuteCommand(rIdent);
 }
 
 IMPL_LINK_NOARG(SwHeaderFooterWin, FadeHandler, Timer *, void)
@@ -513,7 +527,7 @@ IMPL_LINK_NOARG(SwHeaderFooterWin, FadeHandler, Timer *, void)
         m_pLine->Show(false);
     }
     else
-        Invalidate();
+        PaintButton();
 
     if (IsVisible() && m_nFadeRate > 0 && m_nFadeRate < 100)
         m_aFadeTimer.Start();
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index 651ae3283df4..6167369ba219 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -24,6 +24,7 @@
 #include <pagefrm.hxx>
 #include <PostItMgr.hxx>
 #include <FrameControlsManager.hxx>
+#include <strings.hrc>
 #include <uiitems.hxx>
 #include <view.hxx>
 #include <viewopt.hxx>
@@ -95,25 +96,27 @@ namespace
 }
 
 SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwFrame *pFrame ) :
-    SwFrameMenuButtonBase( pEditWin, pFrame ),
-    m_aBuilder(nullptr, AllSettings::GetUIRootDir(), "modules/swriter/ui/pagebreakmenu.ui", ""),
-    m_pPopupMenu(m_aBuilder.get_menu("menu")),
+    SwFrameMenuButtonBase(pEditWin, pFrame, "modules/swriter/ui/pbmenubutton.ui", "PBMenuButton"),
+    m_xMenuButton(m_xBuilder->weld_menu_button("menubutton")),
     m_pLine( nullptr ),
     m_bIsAppearing( false ),
     m_nFadeRate( 100 ),
     m_nDelayAppearing( 0 ),
     m_bDestroyed( false )
 {
+    m_xMenuButton->connect_toggled(LINK(this, SwPageBreakWin, ToggleHdl));
+    m_xMenuButton->connect_selected(LINK(this, SwPageBreakWin, SelectHdl));
+    m_xMenuButton->set_accessible_name(SwResId(STR_PAGE_BREAK_BUTTON));
+
+    m_xVirDev = m_xMenuButton->create_virtual_device();
+    SetVirDevFont();
+
     // Use pixels for the rest of the drawing
-    SetMapMode( MapMode ( MapUnit::MapPixel ) );
+    m_xVirDev->SetMapMode( MapMode ( MapUnit::MapPixel ) );
 
     // Create the line control
     m_pLine = VclPtr<SwBreakDashedLine>::Create( GetEditWin(), &SwViewOption::GetPageBreakColor, this );
 
-    // Set the popup menu
-    m_pPopupMenu->SetDeactivateHdl( LINK( this, SwPageBreakWin, HideHandler ) );
-    SetPopupMenu(m_pPopupMenu);
-
     m_aFadeTimer.SetTimeout( 50 );
     m_aFadeTimer.SetInvokeHandler( LINK( this, SwPageBreakWin, FadeHandler ) );
 }
@@ -129,15 +132,17 @@ void SwPageBreakWin::dispose()
     m_aFadeTimer.Stop();
 
     m_pLine.disposeAndClear();
-    m_pPopupMenu.clear();
-    m_aBuilder.disposeBuilder();
 
+    m_xMenuButton.reset();
     SwFrameMenuButtonBase::dispose();
 }
 
-void SwPageBreakWin::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
+void SwPageBreakWin::PaintButton()
 {
-    const ::tools::Rectangle aRect(::tools::Rectangle(Point(0, 0), rRenderContext.PixelToLogic(GetSizePixel())));
+    if (!m_xVirDev)
+        return;
+
+    const ::tools::Rectangle aRect(::tools::Rectangle(Point(0, 0), m_xVirDev->PixelToLogic(GetSizePixel())));
 
     // Properly paint the control
     BColor aColor = SwViewOption::GetPageBreakColor().getBColor();
@@ -209,17 +214,18 @@ void SwPageBreakWin::Paint(vcl::RenderContext& rRenderContext, const ::tools::Re
     // Create the processor and process the primitives
     const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
     std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
-        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aNewViewInfos));
+        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(*m_xVirDev, aNewViewInfos));
 
     pProcessor->process(aGhostedSeq);
+
+    m_xMenuButton->set_custom_button(m_xVirDev.get());
 }
 
-void SwPageBreakWin::Select()
+IMPL_LINK(SwPageBreakWin, SelectHdl, const OString&, rIdent, void)
 {
     SwFrameControlPtr pThis = GetEditWin()->GetFrameControlsManager( ).GetControl( FrameControlType::PageBreak, GetFrame() );
 
-    OString sIdent = GetCurItemIdent();
-    if (sIdent == "edit")
+    if (rIdent == "edit")
     {
         const SwLayoutFrame* pBodyFrame = static_cast< const SwLayoutFrame* >( GetPageFrame()->Lower() );
         while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
@@ -271,7 +277,7 @@ void SwPageBreakWin::Select()
             pEditWin->GrabFocus( );
         }
     }
-    else if (sIdent == "delete")
+    else if (rIdent == "delete")
     {
         const SwLayoutFrame* pBodyFrame = static_cast< const SwLayoutFrame* >( GetPageFrame()->Lower() );
         while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
@@ -307,25 +313,6 @@ void SwPageBreakWin::Select()
         Fade( false );
 }
 
-void SwPageBreakWin::MouseMove( const MouseEvent& rMEvt )
-{
-    if ( rMEvt.IsLeaveWindow() )
-    {
-        // don't fade if we just move to the 'line', or the popup menu is open
-        Point aEventPos( rMEvt.GetPosPixel() + rMEvt.GetPosPixel() );
-        if ( !Contains( aEventPos ) && !PopupMenu::IsInExecute() )
-            Fade( false );
-    }
-    else if ( !IsVisible() )
-        Fade( true );
-}
-
-void SwPageBreakWin::Activate( )
-{
-    Fade( true );
-    MenuButton::Activate();
-}
-
 void SwPageBreakWin::UpdatePosition(const std::optional<Point>& xEvtPt)
 {
     if ( xEvtPt )
@@ -390,6 +377,7 @@ void SwPageBreakWin::UpdatePosition(const std::optional<Point>& xEvtPt)
     // Set the button position
     Point aBtnPos( nBtnLeft, nYLineOffset - BUTTON_HEIGHT / 2 );
     SetPosSizePixel( aBtnPos, aBtnSize );
+    m_xVirDev->SetOutputSizePixel(aBtnSize);
 
     // Set the line position
     Point aLinePos( nLineLeft, nYLineOffset - 5 );
@@ -429,11 +417,10 @@ void SwPageBreakWin::Fade( bool bFadeIn )
         m_aFadeTimer.Start( );
 }
 
-IMPL_LINK_NOARG(SwPageBreakWin, HideHandler, Menu *, bool)
+IMPL_LINK(SwPageBreakWin, ToggleHdl, weld::ToggleButton&, rMenuButton, void)
 {
-    Fade( false );
-
-    return false;
+    // hide on dropdown, draw fully unfaded if dropdown before fully faded in
+    Fade(rMenuButton.get_active());
 }
 
 IMPL_LINK_NOARG(SwPageBreakWin, FadeHandler, Timer *, void)
@@ -458,7 +445,7 @@ IMPL_LINK_NOARG(SwPageBreakWin, FadeHandler, Timer *, void)
     else
     {
         UpdatePosition();
-        Invalidate();
+        PaintButton();
     }
 
     if (IsVisible( ) && m_nFadeRate > 0 && m_nFadeRate < 100)
diff --git a/sw/source/uibase/docvw/UnfloatTableButton.cxx b/sw/source/uibase/docvw/UnfloatTableButton.cxx
index 4f7bda6566f6..24e6780e1ed2 100644
--- a/sw/source/uibase/docvw/UnfloatTableButton.cxx
+++ b/sw/source/uibase/docvw/UnfloatTableButton.cxx
@@ -46,20 +46,31 @@
 #define BUTTON_WIDTH 12
 
 UnfloatTableButton::UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFrame)
-    : SwFrameMenuButtonBase(pEditWin, pFrame)
+    : SwFrameMenuButtonBase(pEditWin, pFrame, "modules/swriter/ui/unfloatbutton.ui",
+                            "UnfloatButton")
+    , m_xPushButton(m_xBuilder->weld_button("button"))
     , m_sLabel(SwResId(STR_UNFLOAT_TABLE))
 {
+    m_xPushButton->set_accessible_name(m_sLabel);
+    m_xVirDev = m_xPushButton->create_virtual_device();
+    SetVirDevFont();
 }
 
 UnfloatTableButton::~UnfloatTableButton() { disposeOnce(); }
 
+void UnfloatTableButton::dispose()
+{
+    m_xPushButton.reset();
+    SwFrameMenuButtonBase::dispose();
+}
+
 void UnfloatTableButton::SetOffset(Point aTopRightPixel)
 {
     // Compute the text size and get the box position & size from it
     tools::Rectangle aTextRect;
-    GetTextBoundRect(aTextRect, m_sLabel);
-    tools::Rectangle aTextPxRect = LogicToPixel(aTextRect);
-    FontMetric aFontMetric = GetFontMetric(GetFont());
+    m_xVirDev->GetTextBoundRect(aTextRect, m_sLabel);
+    tools::Rectangle aTextPxRect = m_xVirDev->LogicToPixel(aTextRect);
+    FontMetric aFontMetric = m_xVirDev->GetFontMetric(m_xVirDev->GetFont());
     Size aBoxSize(aTextPxRect.GetWidth() + BUTTON_WIDTH + TEXT_PADDING * 2,
                   aFontMetric.GetLineHeight() + TEXT_PADDING * 2);
 
@@ -72,6 +83,9 @@ void UnfloatTableButton::SetOffset(Point aTopRightPixel)
 
     // Set the position & Size of the window
     SetPosSizePixel(aBoxPos, aBoxSize);
+    m_xVirDev->SetOutputSizePixel(aBoxSize);
+
+    PaintButton();
 }
 
 void UnfloatTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/)
@@ -177,12 +191,15 @@ void UnfloatTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/)
     }
 }
 
-void UnfloatTableButton::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+void UnfloatTableButton::PaintButton()
 {
-    SetMapMode(MapMode(MapUnit::MapPixel));
+    if (!m_xVirDev)
+        return;
+
+    m_xVirDev->SetMapMode(MapMode(MapUnit::MapPixel));
     drawinglayer::primitive2d::Primitive2DContainer aSeq;
     const ::tools::Rectangle aRect(
-        ::tools::Rectangle(Point(0, 0), rRenderContext.PixelToLogic(GetSizePixel())));
+        ::tools::Rectangle(Point(0, 0), m_xVirDev->PixelToLogic(GetSizePixel())));
 
     // Create button
     SwFrameButtonPainter::PaintButton(aSeq, aRect, true);
@@ -191,12 +208,12 @@ void UnfloatTableButton::Paint(vcl::RenderContext& rRenderContext, const tools::
     basegfx::BColor aLineColor = SwViewOption::GetHeaderFooterMarkColor().getBColor();
     basegfx::B2DVector aFontSize;
     drawinglayer::attribute::FontAttribute aFontAttr
-        = drawinglayer::primitive2d::getFontAttributeFromVclFont(
-            aFontSize, rRenderContext.GetFont(), false, false);
+        = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_xVirDev->GetFont(),
+                                                                 false, false);
 
-    FontMetric aFontMetric = rRenderContext.GetFontMetric(rRenderContext.GetFont());
+    FontMetric aFontMetric = m_xVirDev->GetFontMetric(m_xVirDev->GetFont());
     double nTextOffsetY = aFontMetric.GetAscent() + TEXT_PADDING;
-    double nTextOffsetX = std::abs(aRect.GetWidth() - rRenderContext.GetTextWidth(m_sLabel)) / 2.0;
+    double nTextOffsetX = std::abs(aRect.GetWidth() - m_xVirDev->GetTextWidth(m_sLabel)) / 2.0;
     Point aTextPos(nTextOffsetX, nTextOffsetY);
 
     basegfx::B2DHomMatrix aTextMatrix(basegfx::utils::createScaleTranslateB2DHomMatrix(
@@ -211,10 +228,12 @@ void UnfloatTableButton::Paint(vcl::RenderContext& rRenderContext, const tools::
     // Create the processor and process the primitives
     const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
     std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
-        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext,
+        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(*m_xVirDev,
                                                                          aNewViewInfos));
 
     pProcessor->process(aSeq);
+
+    m_xPushButton->set_custom_button(m_xVirDev.get());
 }
 
 void UnfloatTableButton::ShowAll(bool bShow) { Show(bShow); }
diff --git a/sw/source/uibase/inc/FrameControl.hxx b/sw/source/uibase/inc/FrameControl.hxx
index e3c98ca57e8a..a2cc7e9edf21 100644
--- a/sw/source/uibase/inc/FrameControl.hxx
+++ b/sw/source/uibase/inc/FrameControl.hxx
@@ -9,7 +9,8 @@
 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_FRAMECONTROL_HXX
 #define INCLUDED_SW_SOURCE_UIBASE_INC_FRAMECONTROL_HXX
 
-#include <vcl/menubtn.hxx>
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/virdev.hxx>
 
 #include "edtwin.hxx"
 
@@ -54,8 +55,11 @@ public:
 
 /** Class sharing some MenuButton code
   */
-class SwFrameMenuButtonBase : public MenuButton, public ISwFrameControl
+class SwFrameMenuButtonBase : public InterimItemWindow, public ISwFrameControl
 {
+protected:
+    VclPtr<VirtualDevice> m_xVirDev;
+private:
     VclPtr<SwEditWin>     m_pEditWin;
     const SwFrame*          m_pFrame;
 
@@ -63,12 +67,15 @@ protected:
     virtual ~SwFrameMenuButtonBase() override { disposeOnce(); }
     virtual void dispose() override;
 
+    void SetVirDevFont();
+
 public:
-    SwFrameMenuButtonBase( SwEditWin* pEditWin, const SwFrame* pFrame );
+    SwFrameMenuButtonBase(SwEditWin* pEditWin, const SwFrame* pFrame,
+                          const OUString& rUIXMLDescription, const OString& rID);
 
     virtual const SwFrame* GetFrame()   override { return m_pFrame; }
     virtual SwEditWin*   GetEditWin() override { return m_pEditWin; }
-    virtual bool IsFocused() const override { return HasFocus(); }
+    virtual bool IsFocused() const override { return ControlHasFocus(); }
     const SwPageFrame*     GetPageFrame() const;
 };
 
diff --git a/sw/source/uibase/inc/HeaderFooterWin.hxx b/sw/source/uibase/inc/HeaderFooterWin.hxx
index f92d45f858fc..5b83bbc79548 100644
--- a/sw/source/uibase/inc/HeaderFooterWin.hxx
+++ b/sw/source/uibase/inc/HeaderFooterWin.hxx
@@ -11,8 +11,8 @@
 
 #include "edtwin.hxx"
 #include "FrameControl.hxx"
-#include <vcl/builder.hxx>
 #include <vcl/timer.hxx>
+#include <vcl/virdev.hxx>
 #include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
 
 /**
@@ -34,10 +34,10 @@ public:
   */
 class SwHeaderFooterWin : public SwFrameMenuButtonBase
 {
-    VclBuilder            m_aBuilder;
+    std::unique_ptr<weld::MenuButton> m_xMenuButton;
+    std::unique_ptr<weld::Button> m_xPushButton;
     OUString              m_sLabel;
     bool                  m_bIsHeader;
-    VclPtr<PopupMenu>     m_pPopupMenu;
     VclPtr<vcl::Window>   m_pLine;
     bool                  m_bIsAppearing;
     int                   m_nFadeRate;
@@ -50,10 +50,6 @@ public:
 
     void SetOffset( Point aOffset, tools::Long nXLineStart, tools::Long nXLineEnd );
 
-    virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
-    virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
-    virtual void Select( ) override;
-
     virtual void ShowAll( bool bShow ) override;
     virtual bool Contains( const Point &rDocPt ) const override;
 
@@ -65,7 +61,10 @@ public:
     void SetReadonly( bool bReadonly ) override;
 
 private:
-    DECL_LINK( FadeHandler, Timer *, void );
+    DECL_LINK(FadeHandler, Timer *, void);
+    DECL_LINK(ClickHdl, weld::Button&, void);
+    DECL_LINK(SelectHdl, const OString&, void);
+    void PaintButton();
 };
 
 #endif
diff --git a/sw/source/uibase/inc/PageBreakWin.hxx b/sw/source/uibase/inc/PageBreakWin.hxx
index 982c81e157a4..90f0d9afe562 100644
--- a/sw/source/uibase/inc/PageBreakWin.hxx
+++ b/sw/source/uibase/inc/PageBreakWin.hxx
@@ -11,7 +11,6 @@
 
 #include "edtwin.hxx"
 #include "FrameControl.hxx"
-#include <vcl/builder.hxx>
 #include <vcl/timer.hxx>
 #include <optional>
 
@@ -25,8 +24,7 @@ class SwPageFrame;
   */
 class SwPageBreakWin : public SwFrameMenuButtonBase
 {
-    VclBuilder            m_aBuilder;
-    VclPtr<PopupMenu>     m_pPopupMenu;
+    std::unique_ptr<weld::MenuButton> m_xMenuButton;
     VclPtr<vcl::Window>   m_pLine;
     bool                  m_bIsAppearing;
     int                   m_nFadeRate;
@@ -41,11 +39,6 @@ public:
     virtual ~SwPageBreakWin() override;
     virtual void dispose() override;
 
-    virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect ) override;
-    virtual void Select( ) override;
-    virtual void MouseMove( const MouseEvent& rMEvt ) override;
-    virtual void Activate( ) override;
-
     void UpdatePosition(const std::optional<Point>& xEvtPt = std::optional<Point>());
 
     virtual void ShowAll( bool bShow ) override;
@@ -56,9 +49,11 @@ public:
     void Fade( bool bFadeIn );
 
 private:
-    /// Hide the button (used when the popup menu is closed by clicking outside)
-    DECL_LINK( HideHandler, Menu *, bool );
     DECL_LINK( FadeHandler, Timer *, void );
+    /// Hide the button when the menu is toggled closed, e.g by clicking outside
+    DECL_LINK(ToggleHdl, weld::ToggleButton&, void);
+    DECL_LINK(SelectHdl, const OString&, void);
+    void PaintButton();
 };
 
 #endif
diff --git a/sw/source/uibase/inc/UnfloatTableButton.hxx b/sw/source/uibase/inc/UnfloatTableButton.hxx
index 701c824b814e..99598bcc2a15 100644
--- a/sw/source/uibase/inc/UnfloatTableButton.hxx
+++ b/sw/source/uibase/inc/UnfloatTableButton.hxx
@@ -24,21 +24,25 @@
  */
 class UnfloatTableButton : public SwFrameMenuButtonBase
 {
+    std::unique_ptr<weld::Button> m_xPushButton;
     OUString m_sLabel;
 
 public:
     UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFrame);
+    virtual void dispose() override;
     virtual ~UnfloatTableButton() override;
 
     void SetOffset(Point aTopRightPixel);
 
     virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
-    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
 
     virtual void ShowAll(bool bShow) override;
     virtual bool Contains(const Point& rDocPt) const override;
 
     virtual void SetReadonly(bool bReadonly) override;
+
+private:
+    void PaintButton();
 };
 
 #endif
diff --git a/sw/uiconfig/swriter/ui/headerfootermenu.ui b/sw/uiconfig/swriter/ui/headerfootermenu.ui
deleted file mode 100644
index 6f154886d753..000000000000
--- a/sw/uiconfig/swriter/ui/headerfootermenu.ui
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
-<interface domain="sw">
-  <requires lib="gtk+" version="3.20"/>
-  <object class="GtkMenu" id="menu">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkMenuItem" id="edit">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="borderback">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes" context="headerfootermenu|borderback">Border and Background...</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="delete">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="insert_pagenumber">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes" context="headerfootermenu|insert_pagenumber">Insert Page Number</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="insert_pagecount">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes" context="headerfootermenu|insert_pagecount">Insert Page Count</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-  </object>
-</interface>
diff --git a/sw/uiconfig/swriter/ui/hfmenubutton.ui b/sw/uiconfig/swriter/ui/hfmenubutton.ui
new file mode 100644
index 000000000000..a41efba005ec
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/hfmenubutton.ui
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkImage" id="image7">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <property name="icon_size">2</property>
+  </object>
+  <object class="GtkMenu" id="menu">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <child>
+      <object class="GtkMenuItem" id="edit">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="use-underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="borderback">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="label" translatable="yes" context="headerfootermenu|borderback">Border and Background...</property>
+        <property name="use-underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="delete">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="use-underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="insert_pagenumber">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="label" translatable="yes" context="headerfootermenu|insert_pagenumber">Insert Page Number</property>
+        <property name="use-underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="insert_pagecount">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="label" translatable="yes" context="headerfootermenu|insert_pagecount">Insert Page Count</property>
+        <property name="use-underline">True</property>
+      </object>
+    </child>
+  </object>
+  <object class="GtkBox" id="HFMenuButton">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkMenuButton" id="menubutton">
+        <property name="visible">True</property>
+        <property name="can-focus">True</property>
+        <property name="focus-on-click">False</property>
+        <property name="receives-default">True</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="image">image7</property>
+        <property name="relief">none</property>
+        <property name="always-show-image">True</property>
+        <property name="popup">menu</property>
+        <style>
+          <class name="small-button"/>
+        </style>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButton" id="button">
+        <property name="can-focus">True</property>
+        <property name="receives-default">True</property>
+        <property name="no-show-all">True</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="relief">none</property>
+        <property name="always-show-image">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sw/uiconfig/swriter/ui/pagebreakmenu.ui b/sw/uiconfig/swriter/ui/pagebreakmenu.ui
deleted file mode 100644
index 022dadc01045..000000000000
--- a/sw/uiconfig/swriter/ui/pagebreakmenu.ui
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
-<interface domain="sw">
-  <requires lib="gtk+" version="3.20"/>
-  <object class="GtkMenu" id="menu">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkMenuItem" id="edit">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes" context="pagebreakmenu|edit">Edit Page Break...</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="delete">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes" context="pagebreakmenu|delete">Delete Page Break</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-  </object>
-</interface>
diff --git a/sw/uiconfig/swriter/ui/pbmenubutton.ui b/sw/uiconfig/swriter/ui/pbmenubutton.ui
new file mode 100644
index 000000000000..463d325f6e63
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/pbmenubutton.ui
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkImage" id="image7">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <property name="icon_size">2</property>
+  </object>
+  <object class="GtkMenu" id="menu">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkMenuItem" id="edit">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes" context="pagebreakmenu|edit">Edit Page Break...</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="delete">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes" context="pagebreakmenu|delete">Delete Page Break</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
+  <object class="GtkBox" id="PBMenuButton">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkMenuButton" id="menubutton">
+        <property name="visible">True</property>
+        <property name="can-focus">True</property>
+        <property name="focus-on-click">False</property>
+        <property name="receives-default">True</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="image">image7</property>
+        <property name="relief">none</property>
+        <property name="always-show-image">True</property>
+        <property name="popup">menu</property>
+        <style>
+          <class name="small-button"/>
+        </style>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sw/uiconfig/swriter/ui/unfloatbutton.ui b/sw/uiconfig/swriter/ui/unfloatbutton.ui
new file mode 100644
index 000000000000..693307661a35
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/unfloatbutton.ui
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkBox" id="UnfloatButton">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkButton" id="button">
+        <property name="visible">True</property>
+        <property name="can-focus">True</property>
+        <property name="receives-default">True</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="relief">none</property>
+        <property name="always-show-image">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list