diff options
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 11 | ||||
-rw-r--r-- | sw/inc/PageOrientationPopup.hxx | 19 | ||||
-rw-r--r-- | sw/source/uibase/app/swmodule.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/PageOrientationControl.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/PageOrientationControl.hxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/PageOrientationPopup.cxx | 38 | ||||
-rw-r--r-- | sw/util/sw.component | 4 |
7 files changed, 64 insertions, 23 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index e2b1a8c9382d..924de434b281 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -1217,6 +1217,17 @@ <value>lo.writer.PageMarginToolBoxControl</value> </prop> </node> + <node oor:name="PageOrientationToolBoxControl" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:Orientation</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>lo.writer.PageOrientationToolBoxControl</value> + </prop> + </node> <node oor:name="com.sun.star.svx.FindTextToolboxController" oor:op="replace"> <prop oor:name="Command"> <value>.uno:FindText</value> diff --git a/sw/inc/PageOrientationPopup.hxx b/sw/inc/PageOrientationPopup.hxx index b1390e5b544d..5b0f3927b950 100644 --- a/sw/inc/PageOrientationPopup.hxx +++ b/sw/inc/PageOrientationPopup.hxx @@ -19,21 +19,26 @@ #ifndef INCLUDED_SW_INC_PAGEORIENTATIONPOPUP_HXX #define INCLUDED_SW_INC_PAGEORIENTATIONPOPUP_HXX -#include <sfx2/tbxctrl.hxx> +#include <svtools/popupwindowcontroller.hxx> #include "swdllapi.h" -class PageOrientationPopup final : public SfxToolBoxControl +class PageOrientationPopup final : public svt::PopupWindowController { public: - SFX_DECL_TOOLBOX_CONTROL(); - - PageOrientationPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + PageOrientationPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext); virtual ~PageOrientationPopup() override; - virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override; + using svt::ToolboxController::createPopupWindow; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override; }; #endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 88a0a53fdf39..936370d89bb8 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -279,7 +279,6 @@ void SwDLL::RegisterControls() svx::ParaLeftSpacingControl::RegisterControl(SID_ATTR_PARA_LEFTSPACE, pMod); svx::ParaRightSpacingControl::RegisterControl(SID_ATTR_PARA_RIGHTSPACE, pMod); svx::ParaFirstLineSpacingControl::RegisterControl(SID_ATTR_PARA_FIRSTLINESPACE, pMod); - PageOrientationPopup::RegisterControl(SID_ATTR_PAGE_ORIENTATION, pMod); SvxClipBoardControl::RegisterControl(SID_PASTE, pMod ); SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod ); diff --git a/sw/source/uibase/sidebar/PageOrientationControl.cxx b/sw/source/uibase/sidebar/PageOrientationControl.cxx index dcf7ffa862b4..f002a3bd9e40 100644 --- a/sw/source/uibase/sidebar/PageOrientationControl.cxx +++ b/sw/source/uibase/sidebar/PageOrientationControl.cxx @@ -19,6 +19,7 @@ #include "PageOrientationControl.hxx" #include "PageMarginControl.hxx" +#include <PageOrientationPopup.hxx> #include <com/sun/star/document/XUndoManager.hpp> #include <com/sun/star/document/XUndoManagerSupplier.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -49,8 +50,8 @@ namespace { namespace sw { namespace sidebar { -PageOrientationControl::PageOrientationControl( sal_uInt16 nId, vcl::Window* pParent ) - : SfxPopupWindow( nId, pParent, "PageOrientationControl", "modules/swriter/ui/pageorientationcontrol.ui" ) +PageOrientationControl::PageOrientationControl(PageOrientationPopup* pControl, vcl::Window* pParent) + : ToolbarPopup(pControl->getFrameInterface(), pParent, "PageOrientationControl", "modules/swriter/ui/pageorientationcontrol.ui" ) , mpPageItem( new SvxPageItem(SID_ATTR_PAGE) ) , mpPageSizeItem( new SvxSizeItem(SID_ATTR_PAGE_SIZE) ) , mpPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) ) @@ -78,7 +79,7 @@ void PageOrientationControl::dispose() mpPageULMarginItem.reset(); mpPageSizeItem.reset(); - SfxPopupWindow::dispose(); + ToolbarPopup::dispose(); } void PageOrientationControl::ExecuteMarginLRChange( diff --git a/sw/source/uibase/sidebar/PageOrientationControl.hxx b/sw/source/uibase/sidebar/PageOrientationControl.hxx index 1e34a62bc1ab..af844bbc8e5b 100644 --- a/sw/source/uibase/sidebar/PageOrientationControl.hxx +++ b/sw/source/uibase/sidebar/PageOrientationControl.hxx @@ -20,19 +20,20 @@ #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEORIENTATIONCONTROL_HXX #include <memory> -#include <sfx2/tbxctrl.hxx> +#include <svtools/toolbarmenu.hxx> #include <svx/pageitem.hxx> #include <svx/rulritem.hxx> #include <editeng/sizeitem.hxx> class Button; +class PageOrientationPopup; namespace sw { namespace sidebar { -class PageOrientationControl : public SfxPopupWindow +class PageOrientationControl final : public svtools::ToolbarPopup { public: - explicit PageOrientationControl(sal_uInt16 nId, vcl::Window* pParent); + explicit PageOrientationControl(PageOrientationPopup* pControl, vcl::Window* pParent); virtual ~PageOrientationControl() override; virtual void dispose() override; diff --git a/sw/source/uibase/sidebar/PageOrientationPopup.cxx b/sw/source/uibase/sidebar/PageOrientationPopup.cxx index 9b4f3fcb0f22..0816d03afbc8 100644 --- a/sw/source/uibase/sidebar/PageOrientationPopup.cxx +++ b/sw/source/uibase/sidebar/PageOrientationPopup.cxx @@ -21,26 +21,46 @@ #include <svx/pageitem.hxx> #include <vcl/toolbox.hxx> -SFX_IMPL_TOOLBOX_CONTROL(PageOrientationPopup, SvxPageItem); +PageOrientationPopup::PageOrientationPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext) + : PopupWindowController(rContext, nullptr, OUString()) +{ +} -PageOrientationPopup::PageOrientationPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) - : SfxToolBoxControl(nSlotId, nId, rTbx) +void PageOrientationPopup::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)); } PageOrientationPopup::~PageOrientationPopup() { } -VclPtr<SfxPopupWindow> PageOrientationPopup::CreatePopupWindow() +VclPtr<vcl::Window> PageOrientationPopup::createPopupWindow(vcl::Window* pParent) +{ + return VclPtr<sw::sidebar::PageOrientationControl>::Create(this, pParent); +} + +OUString PageOrientationPopup::getImplementationName() { - VclPtr<sw::sidebar::PageOrientationControl> pControl = VclPtr<sw::sidebar::PageOrientationControl>::Create(GetSlotId(), &GetToolBox()); - pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus); - SetPopupWindow(pControl); + return "lo.writer.PageOrientationToolBoxControl"; +} - return pControl; +css::uno::Sequence<OUString> PageOrientationPopup::getSupportedServiceNames() +{ + return { "com.sun.star.frame.ToolbarController" }; } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * +lo_writer_PageOrientationToolBoxControl_get_implementation( + css::uno::XComponentContext* rContext, + css::uno::Sequence<css::uno::Any> const & ) +{ + return cppu::acquire(new PageOrientationPopup(rContext)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/util/sw.component b/sw/util/sw.component index 18cbdc07a5e9..8d988dc93503 100644 --- a/sw/util/sw.component +++ b/sw/util/sw.component @@ -59,6 +59,10 @@ constructor="lo_writer_PageMarginToolBoxControl_get_implementation"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> + <implementation name="lo.writer.PageOrientationToolBoxControl" + constructor="lo_writer_PageOrientationToolBoxControl_get_implementation"> + <service name="com.sun.star.frame.ToolbarController"/> + </implementation> <implementation name="SwXModule" constructor="SwXModule_get_implementation"> <service name="com.sun.star.text.GlobalSettings"/> |