diff options
-rw-r--r-- | sw/inc/PageOrientationPopup.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/PageOrientationControl.cxx | 36 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/PageOrientationControl.hxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/PageOrientationPopup.cxx | 14 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/pagemargincontrol.ui | 1 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/pageorientationcontrol.ui | 38 |
6 files changed, 51 insertions, 53 deletions
diff --git a/sw/inc/PageOrientationPopup.hxx b/sw/inc/PageOrientationPopup.hxx index 5b0f3927b950..2b97bba36352 100644 --- a/sw/inc/PageOrientationPopup.hxx +++ b/sw/inc/PageOrientationPopup.hxx @@ -28,6 +28,7 @@ public: PageOrientationPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext); virtual ~PageOrientationPopup() override; + virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override; using svt::ToolboxController::createPopupWindow; virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override; diff --git a/sw/source/uibase/sidebar/PageOrientationControl.cxx b/sw/source/uibase/sidebar/PageOrientationControl.cxx index f002a3bd9e40..b52b789c1c15 100644 --- a/sw/source/uibase/sidebar/PageOrientationControl.cxx +++ b/sw/source/uibase/sidebar/PageOrientationControl.cxx @@ -27,7 +27,6 @@ #include <sfx2/viewsh.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/viewfrm.hxx> -#include <vcl/button.hxx> #include <cmdid.h> namespace { @@ -50,36 +49,27 @@ namespace { namespace sw { namespace sidebar { -PageOrientationControl::PageOrientationControl(PageOrientationPopup* pControl, vcl::Window* pParent) - : ToolbarPopup(pControl->getFrameInterface(), pParent, "PageOrientationControl", "modules/swriter/ui/pageorientationcontrol.ui" ) +PageOrientationControl::PageOrientationControl(PageOrientationPopup* pControl, weld::Widget* pParent) + : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "modules/swriter/ui/pageorientationcontrol.ui", "PageOrientationControl") + , m_xPortrait(m_xBuilder->weld_button("portrait")) + , m_xLandscape(m_xBuilder->weld_button("landscape")) + , m_xControl(pControl) , mpPageItem( new SvxPageItem(SID_ATTR_PAGE) ) , mpPageSizeItem( new SvxSizeItem(SID_ATTR_PAGE_SIZE) ) , mpPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) ) , mpPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) ) { - get(m_pPortrait, "portrait"); - get(m_pLandscape, "landscape"); - - m_pPortrait->SetClickHdl( LINK( this, PageOrientationControl,ImplOrientationHdl ) ); - m_pLandscape->SetClickHdl( LINK( this, PageOrientationControl,ImplOrientationHdl ) ); + m_xPortrait->connect_clicked( LINK( this, PageOrientationControl,ImplOrientationHdl ) ); + m_xLandscape->connect_clicked( LINK( this, PageOrientationControl,ImplOrientationHdl ) ); } -PageOrientationControl::~PageOrientationControl() +void PageOrientationControl::GrabFocus() { - disposeOnce(); + m_xPortrait->grab_focus(); } -void PageOrientationControl::dispose() +PageOrientationControl::~PageOrientationControl() { - m_pPortrait.disposeAndClear(); - m_pLandscape.disposeAndClear(); - - mpPageItem.reset(); - mpPageLRMarginItem.reset(); - mpPageULMarginItem.reset(); - mpPageSizeItem.reset(); - - ToolbarPopup::dispose(); } void PageOrientationControl::ExecuteMarginLRChange( @@ -189,14 +179,14 @@ void PageOrientationControl::ExecuteOrientationChange( const bool bLandscape ) mxUndoManager->leaveUndoContext(); } -IMPL_LINK(PageOrientationControl, ImplOrientationHdl, Button*, pControl, void) +IMPL_LINK(PageOrientationControl, ImplOrientationHdl, weld::Button&, rControl, void) { - if ( pControl == m_pPortrait.get() ) + if (&rControl == m_xPortrait.get()) ExecuteOrientationChange( false ); else ExecuteOrientationChange( true ); - EndPopupMode(); + m_xControl->EndPopupMode(); } } } // end of namespace sw::sidebar diff --git a/sw/source/uibase/sidebar/PageOrientationControl.hxx b/sw/source/uibase/sidebar/PageOrientationControl.hxx index af844bbc8e5b..206242de77f5 100644 --- a/sw/source/uibase/sidebar/PageOrientationControl.hxx +++ b/sw/source/uibase/sidebar/PageOrientationControl.hxx @@ -25,21 +25,21 @@ #include <svx/rulritem.hxx> #include <editeng/sizeitem.hxx> -class Button; class PageOrientationPopup; namespace sw { namespace sidebar { -class PageOrientationControl final : public svtools::ToolbarPopup +class PageOrientationControl final : public WeldToolbarPopup { public: - explicit PageOrientationControl(PageOrientationPopup* pControl, vcl::Window* pParent); + explicit PageOrientationControl(PageOrientationPopup* pControl, weld::Widget* pParent); + virtual void GrabFocus() override; virtual ~PageOrientationControl() override; - virtual void dispose() override; private: - VclPtr<PushButton> m_pPortrait; - VclPtr<PushButton> m_pLandscape; + std::unique_ptr<weld::Button> m_xPortrait; + std::unique_ptr<weld::Button> m_xLandscape; + rtl::Reference<PageOrientationPopup> m_xControl; std::unique_ptr<SvxPageItem> mpPageItem; std::unique_ptr<SvxSizeItem> mpPageSizeItem; @@ -50,7 +50,7 @@ private: void ExecuteMarginLRChange(const long nPageLeftMargin, const long nPageRightMargin); void ExecuteOrientationChange(const bool bLandscape); - DECL_LINK(ImplOrientationHdl, Button*, void); + DECL_LINK(ImplOrientationHdl, weld::Button&, void); }; } } // end of namespace sw::sidebar diff --git a/sw/source/uibase/sidebar/PageOrientationPopup.cxx b/sw/source/uibase/sidebar/PageOrientationPopup.cxx index 0816d03afbc8..1fddd83b9d29 100644 --- a/sw/source/uibase/sidebar/PageOrientationPopup.cxx +++ b/sw/source/uibase/sidebar/PageOrientationPopup.cxx @@ -40,9 +40,19 @@ PageOrientationPopup::~PageOrientationPopup() { } -VclPtr<vcl::Window> PageOrientationPopup::createPopupWindow(vcl::Window* pParent) +std::unique_ptr<WeldToolbarPopup> PageOrientationPopup::weldPopupWindow() { - return VclPtr<sw::sidebar::PageOrientationControl>::Create(this, pParent); + return std::make_unique<sw::sidebar::PageOrientationControl>(this, m_pToolbar); +} + +VclPtr<vcl::Window> PageOrientationPopup::createPopupWindow( vcl::Window* pParent ) +{ + mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, + std::make_unique<sw::sidebar::PageOrientationControl>(this, pParent->GetFrameWeld())); + + mxInterimPopover->Show(); + + return mxInterimPopover; } OUString PageOrientationPopup::getImplementationName() diff --git a/sw/uiconfig/swriter/ui/pagemargincontrol.ui b/sw/uiconfig/swriter/ui/pagemargincontrol.ui index 176c81abc412..1360d9c4a90e 100644 --- a/sw/uiconfig/swriter/ui/pagemargincontrol.ui +++ b/sw/uiconfig/swriter/ui/pagemargincontrol.ui @@ -329,6 +329,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="pagemargincontrol|innerLabel">I_nner</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">left</property> <property name="xalign">0</property> </object> <packing> diff --git a/sw/uiconfig/swriter/ui/pageorientationcontrol.ui b/sw/uiconfig/swriter/ui/pageorientationcontrol.ui index d9a3a80faaf1..7de8ac5557df 100644 --- a/sw/uiconfig/swriter/ui/pageorientationcontrol.ui +++ b/sw/uiconfig/swriter/ui/pageorientationcontrol.ui @@ -1,32 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> - <object class="GtkImage" id="image_landscape"> - <property name="visible">True</property> + <object class="GtkPopover" id="PageOrientationControl"> <property name="can_focus">False</property> - <property name="pixbuf">sw/res/sidebar/pageproppanel/Landscapecopy_24x24.png</property> - </object> - <object class="GtkImage" id="image_portrait"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">cmd/lc_orientation.png</property> - </object> - <object class="GtkWindow" id="PageOrientationControl"> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> + <property name="no_show_all">True</property> <property name="border_width">4</property> - <property name="resizable">False</property> - <property name="destroy_with_parent">True</property> - <property name="type_hint">popup-menu</property> - <property name="skip_pager_hint">True</property> - <property name="deletable">False</property> <child> - <object class="GtkBox" id="box"> + <object class="GtkBox" id="container"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_right">6</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="orientation">vertical</property> @@ -39,7 +22,9 @@ <property name="receives_default">True</property> <property name="image">image_portrait</property> <property name="relief">none</property> + <property name="use_underline">True</property> <property name="xalign">0</property> + <property name="always_show_image">True</property> </object> <packing> <property name="expand">False</property> @@ -55,6 +40,7 @@ <property name="receives_default">True</property> <property name="image">image_landscape</property> <property name="relief">none</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="always_show_image">True</property> </object> @@ -67,4 +53,14 @@ </object> </child> </object> + <object class="GtkImage" id="image_landscape"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">sw/res/sidebar/pageproppanel/Landscapecopy_24x24.png</property> + </object> + <object class="GtkImage" id="image_portrait"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">cmd/lc_orientation.png</property> + </object> </interface> |