diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-12-27 21:09:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-12-29 20:39:01 +0100 |
commit | e02003390208ac80e1404a95a6c09e06bb84848f (patch) | |
tree | 51212a7e8c66284db2934ad3866c77e710ad59bd | |
parent | 5155f1a6f54705b3dae6c7af53dc5c0c1418a46b (diff) |
pass in a awt::XWindow in the first place
Change-Id: Ie94ba063b6f2ad98019bad21259125aabd16d93b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85879
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/sfx2/sidebar/ControllerFactory.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/ControllerFactory.cxx | 33 |
2 files changed, 23 insertions, 12 deletions
diff --git a/include/sfx2/sidebar/ControllerFactory.hxx b/include/sfx2/sidebar/ControllerFactory.hxx index c54de67b5545..e84b139563a4 100644 --- a/include/sfx2/sidebar/ControllerFactory.hxx +++ b/include/sfx2/sidebar/ControllerFactory.hxx @@ -54,7 +54,7 @@ public: private: static css::uno::Reference<css::frame::XToolbarController> CreateToolBarController( - ToolBox* pToolBox, + const css::uno::Reference<css::awt::XWindow>& rToolbar, const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame, const css::uno::Reference<css::frame::XController>& rxController, diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx index edb29abd5280..61ed92452c54 100644 --- a/sfx2/source/sidebar/ControllerFactory.cxx +++ b/sfx2/source/sidebar/ControllerFactory.cxx @@ -27,6 +27,7 @@ #include <framework/sfxhelperfunctions.hxx> #include <vcl/commandinfoprovider.hxx> +#include <vcl/weldutils.hxx> #include <svtools/generictoolboxcontroller.hxx> #include <comphelper/processfactory.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -47,7 +48,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController( { Reference<frame::XToolbarController> xController ( CreateToolBarController( - pToolBox, + VCLUnoHelper::GetInterface(pToolBox), rsCommandName, rxFrame, rxController, nWidth)); @@ -142,15 +143,25 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController( const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame) { - Reference<frame::XToolbarController> xController; + css::uno::Reference<css::awt::XWindow> xWidget(new weld::TransportAsXWindow(&rToolbar)); - xController.set( - static_cast<XWeak*>(new svt::GenericToolboxController( - ::comphelper::getProcessComponentContext(), - rxFrame, - rToolbar, - rsCommandName)), - UNO_QUERY); + Reference<frame::XToolbarController> xController( + CreateToolBarController( + xWidget, + rsCommandName, + rxFrame, rxFrame->getController(), + -1)); + + if (!xController.is()) + { + xController.set( + static_cast<XWeak*>(new svt::GenericToolboxController( + ::comphelper::getProcessComponentContext(), + rxFrame, + rToolbar, + rsCommandName)), + UNO_QUERY); + } // Initialize the controller with eg a service factory. Reference<lang::XInitialization> xInitialization (xController, UNO_QUERY); @@ -187,7 +198,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController( Reference<frame::XToolbarController> ControllerFactory::CreateToolBarController( - ToolBox* pToolBox, + const Reference<awt::XWindow>& rxToolbar, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame, const Reference<frame::XController>& rxController, @@ -217,7 +228,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBarController( aPropertyVector.push_back( makeAny( aPropValue )); aPropValue.Name = "ParentWindow"; - aPropValue.Value <<= VCLUnoHelper::GetInterface(pToolBox); + aPropValue.Value <<= rxToolbar; aPropertyVector.push_back( makeAny( aPropValue )); if (nWidth > 0) |