summaryrefslogtreecommitdiff
path: root/sw/source/uibase/sidebar
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/sidebar')
-rw-r--r--sw/source/uibase/sidebar/PageMarginControl.cxx7
-rw-r--r--sw/source/uibase/sidebar/PageMarginControl.hxx8
-rw-r--r--sw/source/uibase/sidebar/PageMarginPopup.cxx38
3 files changed, 38 insertions, 15 deletions
diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx
index 69aa012d7340..587f0262ff13 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.cxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.cxx
@@ -37,6 +37,7 @@
#include <swtypes.hxx>
#include <cmdid.h>
+#include <PageMarginPopup.hxx>
#include <com/sun/star/document/XUndoManagerSupplier.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -93,8 +94,8 @@ namespace
namespace sw { namespace sidebar {
-PageMarginControl::PageMarginControl( sal_uInt16 nId, vcl::Window* pParent )
- : SfxPopupWindow( nId, pParent, "PageMarginControl", "modules/swriter/ui/pagemargincontrol.ui" )
+PageMarginControl::PageMarginControl(PageMarginPopup* pControl, vcl::Window* pParent)
+ : ToolbarPopup(pControl->getFrameInterface(), pParent, "PageMarginControl", "modules/swriter/ui/pagemargincontrol.ui")
, m_nPageLeftMargin(0)
, m_nPageRightMargin(0)
, m_nPageTopMargin(0)
@@ -255,7 +256,7 @@ void PageMarginControl::dispose()
m_pWidthHeightField.disposeAndClear();
m_pContainer.disposeAndClear();
- SfxPopupWindow::dispose();
+ ToolbarPopup::dispose();
}
void PageMarginControl::SetMetricFieldMaxValues( const Size& rPageSize )
diff --git a/sw/source/uibase/sidebar/PageMarginControl.hxx b/sw/source/uibase/sidebar/PageMarginControl.hxx
index fe54b4ecf7dd..77f4cdb01593 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.hxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.hxx
@@ -19,7 +19,7 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINCONTROL_HXX
#define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINCONTROL_HXX
-#include <sfx2/tbxctrl.hxx>
+#include <svtools/toolbarmenu.hxx>
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <vcl/layout.hxx>
@@ -33,12 +33,14 @@
// #i19922# - tdf#126051 see cui/source/tabpages/page.cxx and svx/source/dialog/hdft.cxx
static const long MINBODY = 56; // 1mm in twips rounded
+class PageMarginPopup;
+
namespace sw { namespace sidebar {
-class PageMarginControl : public SfxPopupWindow
+class PageMarginControl final : public svtools::ToolbarPopup
{
public:
- explicit PageMarginControl( sal_uInt16 nId, vcl::Window* pParent );
+ explicit PageMarginControl(PageMarginPopup* pControl, vcl::Window* pParent);
virtual ~PageMarginControl() override;
virtual void dispose() override;
diff --git a/sw/source/uibase/sidebar/PageMarginPopup.cxx b/sw/source/uibase/sidebar/PageMarginPopup.cxx
index 29a27c3106d8..f22604a70a08 100644
--- a/sw/source/uibase/sidebar/PageMarginPopup.cxx
+++ b/sw/source/uibase/sidebar/PageMarginPopup.cxx
@@ -20,26 +20,46 @@
#include "PageMarginControl.hxx"
#include <vcl/toolbox.hxx>
-SFX_IMPL_TOOLBOX_CONTROL(PageMarginPopup, SfxVoidItem);
+PageMarginPopup::PageMarginPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext)
+ : PopupWindowController(rContext, nullptr, OUString())
+{
+}
-PageMarginPopup::PageMarginPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
- : SfxToolBoxControl(nSlotId, nId, rTbx)
+void PageMarginPopup::initialize( const css::uno::Sequence< css::uno::Any >& rArguments )
{
- rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits(nId));
+ PopupWindowController::initialize(rArguments);
+
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL)
+ pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId));
}
PageMarginPopup::~PageMarginPopup()
{
}
-VclPtr<SfxPopupWindow> PageMarginPopup::CreatePopupWindow()
+VclPtr<vcl::Window> PageMarginPopup::createPopupWindow(vcl::Window* pParent)
+{
+ return VclPtr<sw::sidebar::PageMarginControl>::Create(this, pParent);
+}
+
+OUString PageMarginPopup::getImplementationName()
{
- VclPtr<sw::sidebar::PageMarginControl> pControl = VclPtr<sw::sidebar::PageMarginControl>::Create(GetSlotId(), &GetToolBox());
- pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
- SetPopupWindow(pControl);
+ return "lo.writer.PageMarginToolBoxControl";
+}
- return pControl;
+css::uno::Sequence<OUString> PageMarginPopup::getSupportedServiceNames()
+{
+ return { "com.sun.star.frame.ToolbarController" };
}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
+lo_writer_PageMarginToolBoxControl_get_implementation(
+ css::uno::XComponentContext* rContext,
+ css::uno::Sequence<css::uno::Any> const & )
+{
+ return cppu::acquire(new PageMarginPopup(rContext));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */