summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-07-12 21:11:17 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2015-07-13 12:09:52 +0000
commit2aea9e37d697ce51efc5fb37ba50f1bf177e0445 (patch)
treec6564f6cc7a61c497be13b146ed00615652b85dc /framework
parent9c2a8065add0da1e649633efa0795beddfa68eed (diff)
Introduce generic sub toolbar controller
Currently many toolbar controllers are basically doing the same thing - show some docked toolbar. So the idea here is to have one generic controller that will handle all these cases in a unified way. It will get the name of the toolbar that it's supposed to show from the configuration, based on the command it was registered for. Right now it can handle both simple (i.e. with DROPDOWNONLY bits) and split (i.e. with DROPDOWN bits) scenarios, where for split kind it replaces the function (and the image) of the main part of the button, with the last selected function, for easy reusing. A button is considered to be a split one, if the name of the initial default command was passed along with the sub toolbar name, otherwise it will be a simple button. The core change is in framework/. Other parts are a usage example, in form of converting the custom shapes buttons to this new controller. Change-Id: I087cc58c3db1889ca69a26546d4f00fe07e2a58d Reviewed-on: https://gerrit.libreoffice.org/16967 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/Library_fwk.mk1
-rw-r--r--framework/inc/uifactory/factoryconfiguration.hxx4
-rw-r--r--framework/source/uielement/subtoolbarcontroller.cxx458
-rw-r--r--framework/source/uifactory/factoryconfiguration.cxx8
-rw-r--r--framework/source/uifactory/uicontrollerfactory.cxx18
-rw-r--r--framework/util/fwk.component4
6 files changed, 474 insertions, 19 deletions
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index 74e72a9cf136..197910160c33 100644
--- a/framework/Library_fwk.mk
+++ b/framework/Library_fwk.mk
@@ -151,6 +151,7 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/uielement/statusbarmerger \
framework/source/uielement/statusbarwrapper \
framework/source/uielement/statusindicatorinterfacewrapper \
+ framework/source/uielement/subtoolbarcontroller \
framework/source/uielement/togglebuttontoolbarcontroller \
framework/source/uielement/toolbarmanager \
framework/source/uielement/toolbarmerger \
diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx
index d2313f4e750f..d63bdc201882 100644
--- a/framework/inc/uifactory/factoryconfiguration.hxx
+++ b/framework/inc/uifactory/factoryconfiguration.hxx
@@ -46,7 +46,7 @@ class ConfigurationAccess_ControllerFactory : // interfaces
public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
{
public:
- ConfigurationAccess_ControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const OUString& _sRoot,bool _bAskValue = false );
+ ConfigurationAccess_ControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const OUString& _sRoot );
virtual ~ConfigurationAccess_ControllerFactory();
void readConfigurationData();
@@ -56,7 +56,6 @@ public:
OUString getValueFromCommandModule( const OUString& rCommandURL, const OUString& rModule ) const;
void addServiceToCommandModule( const OUString& rCommandURL, const OUString& rModule, const OUString& rServiceSpecifier );
void removeServiceFromCommandModule( const OUString& rCommandURL, const OUString& rModule );
- inline bool hasValue() const { return m_bAskValue; }
// container.XContainerListener
virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -98,7 +97,6 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess;
::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xConfigAccessListener;
bool m_bConfigAccessInitialized;
- bool m_bAskValue;
};
} // namespace framework
diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx
new file mode 100644
index 000000000000..2b6e307f5b31
--- /dev/null
+++ b/framework/source/uielement/subtoolbarcontroller.cxx
@@ -0,0 +1,458 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <comphelper/propertysequence.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <framework/imageproducer.hxx>
+#include <svtools/toolboxcontroller.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/gen.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/toolbox.hxx>
+
+#include <com/sun/star/awt/XDockableWindow.hpp>
+#include <com/sun/star/frame/XSubToolbarController.hpp>
+#include <com/sun/star/frame/status/ItemStatus.hpp>
+#include <com/sun/star/frame/status/Visibility.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ui/theUIElementFactoryManager.hpp>
+
+typedef cppu::ImplInheritanceHelper< svt::ToolboxController,
+ css::frame::XSubToolbarController,
+ css::awt::XDockableWindowListener,
+ css::lang::XServiceInfo > ToolBarBase;
+
+class SubToolBarController : public ToolBarBase
+{
+ OUString m_aSubTbName;
+ OUString m_aLastCommand;
+ css::uno::Reference< css::ui::XUIElement > m_xUIElement;
+ void disposeUIElement();
+public:
+ explicit SubToolBarController( const css::uno::Sequence< css::uno::Any >& rxArgs );
+ virtual ~SubToolBarController();
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 nKeyModifier ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+ // XSubToolbarController
+ virtual sal_Bool SAL_CALL opensSubToolbar() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual OUString SAL_CALL getSubToolbarName() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual void SAL_CALL functionSelected( const OUString& rCommand ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual void SAL_CALL updateImage() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+ // XDockableWindowListener
+ virtual void SAL_CALL startDocking( const css::awt::DockingEvent& e ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual css::awt::DockingData SAL_CALL docking( const css::awt::DockingEvent& e ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual void SAL_CALL endDocking( const css::awt::EndDockingEvent& e ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual sal_Bool SAL_CALL prepareToggleFloatingMode( const css::lang::EventObject& e ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual void SAL_CALL toggleFloatingMode( const css::lang::EventObject& e ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual void SAL_CALL closed( const css::lang::EventObject& e ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual void SAL_CALL endPopupMode( const css::awt::EndPopupModeEvent& e ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& e ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+ // XUpdatable
+ virtual void SAL_CALL update() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw ( css::uno::RuntimeException ) SAL_OVERRIDE;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw ( css::uno::RuntimeException ) SAL_OVERRIDE;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw ( css::uno::RuntimeException ) SAL_OVERRIDE;
+};
+
+SubToolBarController::SubToolBarController( const css::uno::Sequence< css::uno::Any >& rxArgs )
+{
+ css::beans::PropertyValue aPropValue;
+ for ( sal_Int32 i = 0; i < rxArgs.getLength(); ++i )
+ {
+ rxArgs[i] >>= aPropValue;
+ if ( aPropValue.Name == "Value" )
+ {
+ OUString aValue;
+ aPropValue.Value >>= aValue;
+ m_aSubTbName = aValue.getToken(0, ';');
+ m_aLastCommand = aValue.getToken(1, ';');
+ break;
+ }
+ }
+}
+
+SubToolBarController::~SubToolBarController()
+{
+ disposeUIElement();
+ m_xUIElement = 0;
+}
+
+void SubToolBarController::disposeUIElement()
+{
+ if ( m_xUIElement.is() )
+ {
+ css::uno::Reference< css::lang::XComponent > xComponent( m_xUIElement, css::uno::UNO_QUERY );
+ xComponent->dispose();
+ }
+}
+
+void SubToolBarController::statusChanged( const css::frame::FeatureStateEvent& Event )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ SolarMutexGuard aSolarMutexGuard;
+
+ if ( m_bDisposed )
+ return;
+
+ ToolBox* pToolBox = 0;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ {
+ pToolBox->EnableItem( nId, Event.IsEnabled );
+ ToolBoxItemBits nItemBits = pToolBox->GetItemBits( nId );
+ nItemBits &= ~ToolBoxItemBits::CHECKABLE;
+ TriState eTri = TRISTATE_FALSE;
+
+ bool bValue;
+ OUString aStrValue;
+ css::frame::status::ItemStatus aItemState;
+ css::frame::status::Visibility aItemVisibility;
+
+ if ( Event.State >>= bValue )
+ {
+ // Boolean, treat it as checked/unchecked
+ pToolBox->SetItemBits( nId, nItemBits );
+ pToolBox->CheckItem( nId, bValue );
+ if ( bValue )
+ eTri = TRISTATE_TRUE;
+ nItemBits |= ToolBoxItemBits::CHECKABLE;
+ }
+ else if ( Event.State >>= aStrValue )
+ {
+ pToolBox->SetItemText( nId, aStrValue );
+ }
+ else if ( Event.State >>= aItemState )
+ {
+ eTri = TRISTATE_INDET;
+ nItemBits |= ToolBoxItemBits::CHECKABLE;
+ }
+ else if ( Event.State >>= aItemVisibility )
+ {
+ pToolBox->ShowItem( nId, aItemVisibility.bVisible );
+ }
+
+ pToolBox->SetItemState( nId, eTri );
+ pToolBox->SetItemBits( nId, nItemBits );
+ }
+}
+
+void SubToolBarController::execute( sal_Int16 nKeyModifier )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ if ( !m_aLastCommand.isEmpty() )
+ {
+ auto aArgs( comphelper::InitPropertySequence( {
+ { "KeyModifier", css::uno::makeAny( nKeyModifier ) }
+ } ) );
+ dispatchCommand( m_aLastCommand, aArgs );
+ }
+}
+
+css::uno::Reference< css::awt::XWindow > SubToolBarController::createPopupWindow()
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ SolarMutexGuard aGuard;
+
+ ToolBox* pToolBox = 0;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ {
+ css::uno::Reference< css::frame::XFrame > xFrame ( getFrameInterface() );
+
+ // create element with factory
+ static css::uno::WeakReference< css::ui::XUIElementFactoryManager > xWeakUIElementFactory;
+ css::uno::Reference< css::ui::XUIElement > xUIElement;
+ css::uno::Reference< css::ui::XUIElementFactoryManager > xUIElementFactory;
+
+ xUIElementFactory = xWeakUIElementFactory;
+ if ( !xUIElementFactory.is() )
+ {
+ xUIElementFactory = css::ui::theUIElementFactoryManager::get( m_xContext );
+ xWeakUIElementFactory = xUIElementFactory;
+ }
+
+ auto aPropSeq( comphelper::InitPropertySequence( {
+ { "Frame", css::uno::makeAny( xFrame ) },
+ { "Persistent", css::uno::makeAny( false ) },
+ { "PopupMode", css::uno::makeAny( true ) }
+ } ) );
+
+ try
+ {
+ xUIElement = xUIElementFactory->createUIElement( "private:resource/toolbar/" + m_aSubTbName, aPropSeq );
+ }
+ catch ( css::container::NoSuchElementException& )
+ {}
+ catch ( css::lang::IllegalArgumentException& )
+ {}
+
+ if ( xUIElement.is() )
+ {
+ css::uno::Reference< css::awt::XWindow > xParent = xFrame->getContainerWindow();
+ css::uno::Reference< css::awt::XWindow > xSubToolBar( xUIElement->getRealInterface(), css::uno::UNO_QUERY );
+ if ( xSubToolBar.is() )
+ {
+ css::uno::Reference< css::awt::XDockableWindow > xDockWindow( xSubToolBar, css::uno::UNO_QUERY );
+ xDockWindow->addDockableWindowListener( css::uno::Reference< css::awt::XDockableWindowListener >(
+ static_cast< OWeakObject * >( this ), css::uno::UNO_QUERY ) );
+ xDockWindow->enableDocking( sal_True );
+
+ // keep reference to UIElement to avoid its destruction
+ disposeUIElement();
+ m_xUIElement = xUIElement;
+
+ vcl::Window* pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar );
+ if ( pTbxWindow && pTbxWindow->GetType() == WINDOW_TOOLBOX )
+ {
+ ToolBox* pToolBar = static_cast< ToolBox* >( pTbxWindow );
+ pToolBar->SetParent( pToolBox );
+ // calc and set size for popup mode
+ Size aSize = pToolBar->CalcPopupWindowSizePixel();
+ pToolBar->SetSizePixel( aSize );
+ // open subtoolbox in popup mode
+ vcl::Window::GetDockingManager()->StartPopupMode( pToolBox, pToolBar );
+ }
+ }
+ }
+ }
+ return css::uno::Reference< css::awt::XWindow >();
+}
+
+sal_Bool SubToolBarController::opensSubToolbar()
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ return sal_True;
+}
+
+OUString SubToolBarController::getSubToolbarName()
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ return m_aSubTbName;
+}
+
+void SubToolBarController::functionSelected( const OUString& rCommand )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ if ( !m_aLastCommand.isEmpty() )
+ {
+ m_aLastCommand = rCommand;
+ updateImage();
+ }
+}
+
+void SubToolBarController::updateImage()
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ SolarMutexGuard aGuard;
+ if ( !m_aLastCommand.isEmpty() )
+ {
+ ToolBox* pToolBox = 0;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ {
+ Image aImage = framework::GetImageFromURL( getFrameInterface(), m_aLastCommand, pToolBox->GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE );
+ if ( !!aImage )
+ pToolBox->SetItemImage( nId, aImage );
+ }
+ }
+}
+
+void SubToolBarController::startDocking( const css::awt::DockingEvent& )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+}
+
+css::awt::DockingData SubToolBarController::docking( const css::awt::DockingEvent& )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ return css::awt::DockingData();
+}
+
+void SubToolBarController::endDocking( const css::awt::EndDockingEvent& )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+}
+
+sal_Bool SubToolBarController::prepareToggleFloatingMode( const css::lang::EventObject& )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ return sal_False;
+}
+
+void SubToolBarController::toggleFloatingMode( const css::lang::EventObject& )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+}
+
+void SubToolBarController::closed( const css::lang::EventObject& )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+}
+
+void SubToolBarController::endPopupMode( const css::awt::EndPopupModeEvent& e )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ SolarMutexGuard aGuard;
+
+ OUString aSubToolBarResName;
+ if ( m_xUIElement.is() )
+ {
+ css::uno::Reference< css::beans::XPropertySet > xPropSet( m_xUIElement, css::uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ try
+ {
+ xPropSet->getPropertyValue("ResourceURL") >>= aSubToolBarResName;
+ }
+ catch ( css::beans::UnknownPropertyException& )
+ {}
+ catch ( css::lang::WrappedTargetException& )
+ {}
+ }
+ disposeUIElement();
+ }
+ m_xUIElement = 0;
+
+ // if the toolbar was teared-off recreate it and place it at the given position
+ if( e.bTearoff )
+ {
+ css::uno::Reference< css::ui::XUIElement > xUIElement;
+ css::uno::Reference< css::frame::XLayoutManager > xLayoutManager = getLayoutManager();
+
+ if ( !xLayoutManager.is() )
+ return;
+
+ xLayoutManager->createElement( aSubToolBarResName );
+ xUIElement = xLayoutManager->getElement( aSubToolBarResName );
+ if ( xUIElement.is() )
+ {
+ css::uno::Reference< css::awt::XWindow > xParent = getFrameInterface()->getContainerWindow();
+ css::uno::Reference< css::awt::XWindow > xSubToolBar( xUIElement->getRealInterface(), css::uno::UNO_QUERY );
+ css::uno::Reference< css::beans::XPropertySet > xProp( xUIElement, css::uno::UNO_QUERY );
+ if ( xSubToolBar.is() && xProp.is() )
+ {
+ OUString aPersistentString( "Persistent" );
+ try
+ {
+ vcl::Window* pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar );
+ if ( pTbxWindow && pTbxWindow->GetType() == WINDOW_TOOLBOX )
+ {
+ css::uno::Any a = xProp->getPropertyValue( aPersistentString );
+ xProp->setPropertyValue( aPersistentString, css::uno::makeAny( false ) );
+
+ xLayoutManager->hideElement( aSubToolBarResName );
+ xLayoutManager->floatWindow( aSubToolBarResName );
+
+ xLayoutManager->setElementPos( aSubToolBarResName, e.FloatingPosition );
+ xLayoutManager->showElement( aSubToolBarResName );
+
+ xProp->setPropertyValue("Persistent", a );
+ }
+ }
+ catch ( css::uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( css::uno::Exception& )
+ {}
+ }
+ }
+ }
+}
+
+void SubToolBarController::disposing( const css::lang::EventObject& e )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ svt::ToolboxController::disposing( e );
+}
+
+void SubToolBarController::update()
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ svt::ToolboxController::update();
+
+ ToolBox* pToolBox = 0;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ {
+ if ( m_aLastCommand.isEmpty() )
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
+ else
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWN );
+ }
+ updateImage();
+}
+
+void SubToolBarController::dispose()
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ if ( m_bDisposed )
+ return;
+
+ svt::ToolboxController::dispose();
+ disposeUIElement();
+ m_xUIElement = 0;
+}
+
+OUString SubToolBarController::getImplementationName()
+ throw ( css::uno::RuntimeException )
+{
+ return OUString( "com.sun.star.comp.framework.SubToolBarController" );
+}
+
+sal_Bool SubToolBarController::supportsService( const OUString& rServiceName )
+ throw ( css::uno::RuntimeException )
+{
+ return cppu::supportsService( this, rServiceName );
+}
+
+css::uno::Sequence< OUString > SubToolBarController::getSupportedServiceNames()
+ throw ( css::uno::RuntimeException )
+{
+ css::uno::Sequence< OUString > aRet( 1 );
+ aRet[0] = "com.sun.star.frame.ToolbarController";
+ return aRet;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_SubToolBarController_get_implementation(
+ css::uno::XComponentContext*,
+ css::uno::Sequence<css::uno::Any>& rxArgs )
+{
+ return cppu::acquire( new SubToolBarController( rxArgs ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx
index 3f69ae5b299e..ca432e11e303 100644
--- a/framework/source/uifactory/factoryconfiguration.cxx
+++ b/framework/source/uifactory/factoryconfiguration.cxx
@@ -54,14 +54,13 @@ OUString getHashKeyFromStrings( const OUString& aCommandURL, const OUString& aMo
// XInterface, XTypeProvider
-ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( const Reference< XComponentContext >& rxContext, const OUString& _sRoot,bool _bAskValue ) :
+ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( const Reference< XComponentContext >& rxContext, const OUString& _sRoot ) :
m_aPropCommand( "Command" ),
m_aPropModule( "Module" ),
m_aPropController( "Controller" ),
m_aPropValue( "Value" ),
m_sRoot(_sRoot),
- m_bConfigAccessInitialized( false ),
- m_bAskValue(_bAskValue)
+ m_bConfigAccessInitialized( false )
{
m_xConfigProvider = configuration::theDefaultProvider::get( rxContext );
}
@@ -276,8 +275,7 @@ bool ConfigurationAccess_ControllerFactory::impl_getElementProps( const Any& aEl
xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
- if ( m_bAskValue )
- xPropertySet->getPropertyValue( m_aPropValue ) >>= aValue;
+ xPropertySet->getPropertyValue( m_aPropValue ) >>= aValue;
}
catch ( const com::sun::star::beans::UnknownPropertyException& )
{
diff --git a/framework/source/uifactory/uicontrollerfactory.cxx b/framework/source/uifactory/uicontrollerfactory.cxx
index 7ff63a55e24a..c962987aa069 100644
--- a/framework/source/uifactory/uicontrollerfactory.cxx
+++ b/framework/source/uifactory/uicontrollerfactory.cxx
@@ -147,8 +147,7 @@ throw (Exception, RuntimeException, std::exception)
Sequence< Any > aNewArgs( Arguments );
sal_Int32 nAppendIndex = aNewArgs.getLength();
- bool bHasValue = m_pConfigAccess->hasValue();
- aNewArgs.realloc( aNewArgs.getLength() + (bHasValue ? 2 : 1) );
+ aNewArgs.realloc( aNewArgs.getLength() + 2 );
// Append the command URL to the Arguments sequence so that one controller can be
// used for more than one command URL.
@@ -156,15 +155,12 @@ throw (Exception, RuntimeException, std::exception)
aPropValue.Value <<= ServiceSpecifier;
aNewArgs[nAppendIndex] <<= aPropValue;
- if ( bHasValue )
- {
- // Append the optional value argument. It's an empty string if no additional info
- // is provided to the controller.
- OUString aValue = m_pConfigAccess->getValueFromCommandModule( ServiceSpecifier, aPropName );
- aPropValue.Name = aPropValueName;
- aPropValue.Value <<= aValue;
- aNewArgs[nAppendIndex+1] <<= aPropValue;
- }
+ // Append the optional value argument. It's an empty string if no additional info
+ // is provided to the controller.
+ OUString aValue = m_pConfigAccess->getValueFromCommandModule( ServiceSpecifier, aPropName );
+ aPropValue.Name = aPropValueName;
+ aPropValue.Value <<= aValue;
+ aNewArgs[nAppendIndex+1] <<= aPropValue;
{
OUString aServiceName;
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 6541f1406f3f..477d524cac34 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -196,4 +196,8 @@
constructor="org_apache_openoffice_comp_framework_WizardsToolbarController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
+ <implementation name="com.sun.star.comp.framework.SubToolBarController"
+ constructor="com_sun_star_comp_framework_SubToolBarController_get_implementation">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
</component>