summaryrefslogtreecommitdiff
path: root/framework/source
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2022-07-17 15:43:17 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2022-07-17 22:36:53 +0200
commitf87c7018fa5641eeecd788907ea66892514255a6 (patch)
tree5ff236b2bc84f9f0f0fe7695c06133346b4018cf /framework/source
parent7077e688408210b32596cbac2f2202610094ddf3 (diff)
No need for SfxWeldToolBoxControllerFactory
sfx2::sidebar::ControllerFactory::CreateToolBoxController only supports creating controllers using the uno factory, or GenericToolbarController as a fallback. Given that we already handle the uno factory case in ToolBarManager::CreateControllers, all this complexity is really just for creating GenericToolbarController with a different ctor, which we can do locally as well. Change-Id: I3a5a3cda95a6c5db97615286e93630214f76cbfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137149 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework/source')
-rw-r--r--framework/source/fwe/classes/sfxhelperfunctions.cxx23
-rw-r--r--framework/source/uielement/toolbarmanager.cxx42
2 files changed, 10 insertions, 55 deletions
diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx b/framework/source/fwe/classes/sfxhelperfunctions.cxx
index 170f3e7156bb..5a1cc0d716d5 100644
--- a/framework/source/fwe/classes/sfxhelperfunctions.cxx
+++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx
@@ -24,7 +24,6 @@
#include <svtools/statusbarcontroller.hxx>
static pfunc_setToolBoxControllerCreator pToolBoxControllerCreator = nullptr;
-static pfunc_setWeldToolBoxControllerCreator pWeldToolBoxControllerCreator = nullptr;
static pfunc_setStatusBarControllerCreator pStatusBarControllerCreator = nullptr;
static pfunc_getRefreshToolbars pRefreshToolbars = nullptr;
static pfunc_createDockingWindow pCreateDockingWindow = nullptr;
@@ -58,28 +57,6 @@ rtl::Reference<svt::ToolboxController> CreateToolBoxController( const Reference<
return nullptr;
}
-pfunc_setWeldToolBoxControllerCreator SetWeldToolBoxControllerCreator( pfunc_setWeldToolBoxControllerCreator pSetWeldToolBoxControllerCreator )
-{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- pfunc_setWeldToolBoxControllerCreator pOldSetToolBoxControllerCreator = pWeldToolBoxControllerCreator;
- pWeldToolBoxControllerCreator = pSetWeldToolBoxControllerCreator;
- return pOldSetToolBoxControllerCreator;
-}
-
-css::uno::Reference<css::frame::XToolbarController> CreateWeldToolBoxController( const Reference< XFrame >& rFrame, weld::Toolbar* pToolbar, weld::Builder* pBuilder, const OUString& aCommandURL )
-{
- pfunc_setWeldToolBoxControllerCreator pFactory = nullptr;
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- pFactory = pWeldToolBoxControllerCreator;
- }
-
- if ( pFactory )
- return (*pFactory)( rFrame, pToolbar, pBuilder, aCommandURL );
- else
- return nullptr;
-}
-
pfunc_setStatusBarControllerCreator SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index a632828b5c8c..587cd8b61ad8 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -200,19 +200,6 @@ public:
return VCLUnoHelper::GetInterface(m_pToolBar);
}
- virtual css::uno::Reference<css::frame::XStatusListener> CreateToolBoxController(
- const css::uno::Reference<css::frame::XFrame>& rFrame,
- ToolBoxItemId nId,
- const OUString& rCommandURL ) override
- {
- rtl::Reference<svt::ToolboxController> pController
- = ::framework::CreateToolBoxController( rFrame, m_pToolBar, nId, rCommandURL );
- css::uno::Reference<css::frame::XStatusListener> xListener;
- if (pController)
- xListener = pController;
- return xListener;
- }
-
virtual void ConnectCallbacks(ToolBarManager* pManager) override
{
m_pManager = pManager;
@@ -422,20 +409,7 @@ public:
virtual css::uno::Reference<css::awt::XWindow> GetInterface() override
{
- return new weld::TransportAsXWindow(m_pWeldedToolBar);
- }
-
- virtual css::uno::Reference<css::frame::XStatusListener> CreateToolBoxController(
- const css::uno::Reference<css::frame::XFrame>& rFrame,
- ToolBoxItemId /*nId*/,
- const OUString& rCommandURL ) override
- {
- css::uno::Reference<css::frame::XToolbarController> xController
- = ::framework::CreateWeldToolBoxController(rFrame, m_pWeldedToolBar, m_pBuilder, rCommandURL);
- css::uno::Reference<css::frame::XStatusListener> xListener;
- if (xController.is())
- xListener = css::uno::Reference<css::frame::XStatusListener>( xController, UNO_QUERY );
- return xListener;
+ return new weld::TransportAsXWindow(m_pWeldedToolBar, m_pBuilder);
}
virtual void ConnectCallbacks(ToolBarManager* pManager) override
@@ -583,6 +557,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext,
m_nContextMinPos(0),
m_pImpl( new VclToolBarManager( pToolBar ) ),
m_pToolBar( pToolBar ),
+ m_pWeldedToolBar( nullptr ),
m_aResourceName(std::move( aResourceName )),
m_xFrame( rFrame ),
m_xContext( rxContext ),
@@ -603,7 +578,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext,
m_eSymbolSize( SvtMiscOptions().GetCurrentSymbolsSize() ),
m_nContextMinPos(0),
m_pImpl( new WeldToolBarManager( pToolBar, pBuilder ) ),
- m_pToolBar( nullptr ),
+ m_pWeldedToolBar( pToolBar ),
m_aResourceName(std::move( aResourceName )),
m_xFrame( rFrame ),
m_xContext( rxContext ),
@@ -1134,7 +1109,8 @@ void ToolBarManager::CreateControllers()
if ( !xController.is() && bCreate )
{
- xController = m_pImpl->CreateToolBoxController( m_xFrame, nId, aCommandURL );
+ if ( m_pToolBar )
+ xController = CreateToolBoxController( m_xFrame, m_pToolBar, nId, aCommandURL );
if ( !xController )
{
if ( aCommandURL.startsWith( ".uno:StyleApply?" ) )
@@ -1164,10 +1140,12 @@ void ToolBarManager::CreateControllers()
xController = xStatusListener;
}
- else if (m_pToolBar)
+ else
{
- xController.set(
- new GenericToolbarController( m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL ));
+ if ( m_pToolBar )
+ xController.set( new GenericToolbarController( m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL ));
+ else
+ xController.set( new GenericToolbarController( m_xContext, m_xFrame, *m_pWeldedToolBar, aCommandURL ));
// Accessibility support: Set toggle button role for specific commands
sal_Int32 nProps = vcl::CommandInfoProvider::GetPropertiesForCommand(aCommandURL, m_aModuleIdentifier);