[Libreoffice-commits] core.git: 2 commits - officecfg/registry sw/inc sw/source sw/uiconfig sw/util
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 14 20:27:24 UTC 2020
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 11 ++
sw/inc/PageOrientationPopup.hxx | 20 ++--
sw/source/uibase/app/swmodule.cxx | 1
sw/source/uibase/sidebar/PageOrientationControl.cxx | 37 ++-----
sw/source/uibase/sidebar/PageOrientationControl.hxx | 17 +--
sw/source/uibase/sidebar/PageOrientationPopup.cxx | 48 ++++++++--
sw/uiconfig/swriter/ui/pagemargincontrol.ui | 1
sw/uiconfig/swriter/ui/pageorientationcontrol.ui | 38 +++----
sw/util/sw.component | 4
9 files changed, 108 insertions(+), 69 deletions(-)
New commits:
commit 22bf6e323465bd38b38fc026d801bb470e3f9d5c
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 14 17:00:02 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 14 21:27:04 2020 +0100
weld PageOrientationControl
Change-Id: I4b8b5e9a467396a97531c915613d84a361163775
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86789
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
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>
commit 74a6e101927d97aa216b1b1a6d395c56c65cfd32
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 14 16:47:45 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 14 21:26:49 2020 +0100
rework PageOrientationPopup to be a PopupWindowController
Change-Id: I5930d6e16b99754a60e3bb22a70fadfc5d673aa5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86786
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
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"/>
More information about the Libreoffice-commits
mailing list