diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-26 16:24:53 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-03-07 08:23:38 +0200 |
commit | cd8ea20aa4b85128956a79c80f7953d30e99e802 (patch) | |
tree | 2ec962196db84427e97bbc9bb73f9566d70b6fd1 | |
parent | 1b4b53a2ecd7f2283a2c86b2c474786918cbfbf2 (diff) |
fdo#46808, Convert ui::UIConfigurationManager to new-style
Change-Id: I62c37eb6d0e0b2a681a84e1fa0067d0a9f967cf2
-rw-r--r-- | cui/source/customize/acccfg.cxx | 40 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 55 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.hxx | 11 | ||||
-rw-r--r-- | desktop/source/migration/migration.cxx | 11 | ||||
-rw-r--r-- | framework/inc/framework/configimporter.hxx | 4 | ||||
-rw-r--r-- | framework/inc/services.h | 2 | ||||
-rw-r--r-- | framework/inc/uiconfiguration/uiconfigurationmanager.hxx | 12 | ||||
-rw-r--r-- | framework/source/fwe/helper/configimporter.cxx | 2 | ||||
-rw-r--r-- | framework/source/uiconfiguration/uiconfigurationmanager.cxx | 39 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/ui/UIConfigurationManager.idl | 38 | ||||
-rw-r--r-- | offapi/com/sun/star/ui/XUIConfigurationManager2.idl | 70 | ||||
-rw-r--r-- | reportdesign/inc/ReportDefinition.hxx | 3 | ||||
-rw-r--r-- | reportdesign/source/core/api/ReportDefinition.cxx | 21 | ||||
-rw-r--r-- | sfx2/inc/sfx2/sfxbasemodel.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 148 |
16 files changed, 247 insertions, 214 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index fb313b74a0f0..d2aa51208406 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -31,9 +31,6 @@ #include <sfx2/sfxresid.hxx> #include <svl/stritem.hxx> #include "svtools/treelistentry.hxx" -#include <com/sun/star/embed/StorageFactory.hpp> -#include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp> #include <sal/macros.h> @@ -44,20 +41,23 @@ //----------------------------------------------- // include interface declarations +#include <com/sun/star/awt/KeyModifier.hpp> +#include <com/sun/star/embed/StorageFactory.hpp> +#include <com/sun/star/embed/XTransactedObject.hpp> +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/form/XReset.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/form/XReset.hpp> -#include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/UICommandDescription.hpp> +#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp> +#include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/UIConfigurationManager.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> -#include <com/sun/star/awt/KeyModifier.hpp> -#include <com/sun/star/embed/XTransactedObject.hpp> -#include <com/sun/star/embed/ElementModes.hpp> - #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> //----------------------------------------------- @@ -77,7 +77,6 @@ using namespace com::sun::star; //----------------------------------------------- -static OUString SERVICE_UICONFIGMGR ("com.sun.star.ui.UIConfigurationManager" ); static OUString MODULEPROP_SHORTNAME ("ooSetupFactoryShortName" ); static OUString MODULEPROP_UINAME ("ooSetupFactoryUIName" ); @@ -1215,7 +1214,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, LoadHdl) GetTabDialog()->EnterWait(); css::uno::Reference< css::frame::XModel > xDoc ; - css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; + css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; css::uno::Reference< css::embed::XStorage > xRootStorage; // we must hold the root storage alive, if xCfgMgr is used! try @@ -1241,9 +1240,9 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, LoadHdl) css::uno::Reference< css::embed::XStorage > xUIConfig = xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::READ); if (xUIConfig.is()) { - xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationStorage > xCfgMgrStore(xCfgMgr, css::uno::UNO_QUERY_THROW); - xCfgMgrStore->setStorage(xUIConfig); + css::uno::Reference< css::ui::XUIConfigurationManager2 > xCfgMgr2 = css::ui::UIConfigurationManager::create( comphelper::getComponentContext(m_xSMGR) ); + xCfgMgr2->setStorage(xUIConfig); + xCfgMgr.set( xCfgMgr2, css::uno::UNO_QUERY_THROW ); } } @@ -1299,7 +1298,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SaveHdl) GetTabDialog()->EnterWait(); css::uno::Reference< css::frame::XModel > xDoc ; - css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; + css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; css::uno::Reference< css::embed::XStorage > xRootStorage; try @@ -1337,9 +1336,9 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SaveHdl) if (sMediaType.isEmpty()) xUIConfigProps->setPropertyValue(MEDIATYPE_PROPNAME, css::uno::makeAny(MEDIATYPE_UICONFIG)); - xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationStorage > xUICfgStore(xCfgMgr, css::uno::UNO_QUERY_THROW); - xUICfgStore->setStorage(xUIConfig); + css::uno::Reference< css::ui::XUIConfigurationManager2 > xCfgMgr2 = css::ui::UIConfigurationManager::create( comphelper::getComponentContext(m_xSMGR) ); + xCfgMgr2->setStorage(xUIConfig); + xCfgMgr.set( xCfgMgr2, css::uno::UNO_QUERY_THROW ); } if (xCfgMgr.is()) @@ -1367,11 +1366,10 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SaveHdl) if (xRootStorage.is()) { - css::uno::Reference< css::lang::XComponent > xComponent; - xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY); + css::uno::Reference< css::lang::XComponent > xComponent(xCfgMgr, css::uno::UNO_QUERY); if (xComponent.is()) xComponent->dispose(); - xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY); + xComponent.set(xRootStorage, css::uno::UNO_QUERY); if (xComponent.is()) xComponent->dispose(); } diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 45af1b04e5b9..a230856224fa 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -46,17 +46,18 @@ #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/script/provider/XScriptProviderFactory.hpp> +#include <com/sun/star/sdb/DatabaseContext.hpp> +#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp> #include <com/sun/star/task/ErrorCodeIOException.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> +#include <com/sun/star/ucb/XContent.hpp> +#include <com/sun/star/ui/UIConfigurationManager.hpp> #include <com/sun/star/ui/XUIConfigurationStorage.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/xml/sax/Writer.hpp> -#include <com/sun/star/ucb/XContent.hpp> -#include <com/sun/star/sdb/DatabaseContext.hpp> -#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp> #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> #include <com/sun/star/awt/XControl.hpp> @@ -1689,37 +1690,39 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r Reference< XUIConfigurationManager > SAL_CALL ODatabaseDocument::getUIConfigurationManager( ) throw (RuntimeException) { + return Reference< XUIConfigurationManager >( getUIConfigurationManager2(), UNO_QUERY_THROW ); +} + +Reference< XUIConfigurationManager2 > ODatabaseDocument::getUIConfigurationManager2( ) throw (RuntimeException) +{ DocumentGuard aGuard( *this ); if ( !m_xUIConfigurationManager.is() ) { - m_pImpl->m_aContext.createComponent( "com.sun.star.ui.UIConfigurationManager", m_xUIConfigurationManager ); - Reference< XUIConfigurationStorage > xUIConfigStorage( m_xUIConfigurationManager, UNO_QUERY ); - if ( xUIConfigStorage.is() ) - { - OUString aUIConfigFolderName( "Configurations2" ); - Reference< XStorage > xConfigStorage; + m_xUIConfigurationManager = UIConfigurationManager::create( m_pImpl->m_aContext.getUNOContext() ); - // First try to open with READWRITE and then READ - xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, ElementModes::READWRITE ); - if ( xConfigStorage.is() ) + OUString aUIConfigFolderName( "Configurations2" ); + Reference< XStorage > xConfigStorage; + + // First try to open with READWRITE and then READ + xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, ElementModes::READWRITE ); + if ( xConfigStorage.is() ) + { + OUString aUIConfigMediaType( "application/vnd.sun.xml.ui.configuration" ); + OUString aMediaType; + Reference< XPropertySet > xPropSet( xConfigStorage, UNO_QUERY ); + Any a = xPropSet->getPropertyValue( INFO_MEDIATYPE ); + if ( !( a >>= aMediaType ) || aMediaType.isEmpty() ) { - OUString aUIConfigMediaType( "application/vnd.sun.xml.ui.configuration" ); - OUString aMediaType; - Reference< XPropertySet > xPropSet( xConfigStorage, UNO_QUERY ); - Any a = xPropSet->getPropertyValue( INFO_MEDIATYPE ); - if ( !( a >>= aMediaType ) || aMediaType.isEmpty() ) - { - a <<= aUIConfigMediaType; - xPropSet->setPropertyValue( INFO_MEDIATYPE, a ); - } + a <<= aUIConfigMediaType; + xPropSet->setPropertyValue( INFO_MEDIATYPE, a ); } - else - xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, ElementModes::READ ); - - // initialize ui configuration manager with document substorage - xUIConfigStorage->setStorage( xConfigStorage ); } + else + xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, ElementModes::READ ); + + // initialize ui configuration manager with document substorage + m_xUIConfigurationManager->setStorage( xConfigStorage ); } return m_xUIConfigurationManager; diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 2ff9ec6cc895..56d111149470 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -22,17 +22,14 @@ #include "ModelImpl.hxx" #include "documenteventnotifier.hxx" -#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp> #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> #include <com/sun/star/frame/XUntitledNumbers.hpp> -#include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/sdb/XReportDocumentsSupplier.hpp> #include <com/sun/star/sdb/XFormDocumentsSupplier.hpp> -#include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/view/XPrintable.hpp> #include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -49,6 +46,10 @@ #include <com/sun/star/document/XEventBroadcaster.hpp> #include <com/sun/star/document/XDocumentEventBroadcaster.hpp> #include <com/sun/star/document/XDocumentRecovery.hpp> +#include <com/sun/star/ui/XUIConfigurationManager2.hpp> +#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/util/XModifiable.hpp> #ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_17 #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_17 @@ -171,7 +172,7 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe }; DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::Reference< ::com::sun::star::frame::XUntitledNumbers >,TNumberedController); - ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager> m_xUIConfigurationManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager2> m_xUIConfigurationManager; ::cppu::OInterfaceContainerHelper m_aModifyListeners; ::cppu::OInterfaceContainerHelper m_aCloseListener; @@ -480,6 +481,8 @@ public: } private: + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager2 > getUIConfigurationManager2() throw (::com::sun::star::uno::RuntimeException); + /** returns whether the model is currently being initialized */ bool impl_isInitializing() const { return m_eInitState == Initializing; } diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 61c57c1c9b75..56400e0b81a6 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -55,6 +55,7 @@ #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/frame/UICommandDescription.hpp> +#include <com/sun/star/ui/UIConfigurationManager.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> #include <com/sun/star/ui/XUIConfigurationStorage.hpp> #include <com/sun/star/ui/XUIConfigurationPersistence.hpp> @@ -267,14 +268,12 @@ sal_Bool MigrationImpl::doMigration() uno::Reference< uno::XComponentContext > xContext(comphelper::getProcessComponentContext()); uno::Reference< lang::XSingleServiceFactory > xStorageFactory(embed::FileSystemStorageFactory::create(xContext)); uno::Reference< embed::XStorage > xModules(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); - uno::Reference< ui::XUIConfigurationManager > xOldCfgManager(xContext->getServiceManager()->createInstanceWithContext("com.sun.star.ui.UIConfigurationManager", xContext), uno::UNO_QUERY ); - uno::Reference< ui::XUIConfigurationStorage > xOldCfgStorage( xOldCfgManager, uno::UNO_QUERY ); - uno::Reference< ui::XUIConfigurationPersistence > xOldCfgPersistence( xOldCfgManager, uno::UNO_QUERY ); + uno::Reference< ui::XUIConfigurationManager2 > xOldCfgManager = ui::UIConfigurationManager::create(xContext); - if ( xOldCfgStorage.is() && xOldCfgPersistence.is() && xModules.is() ) + if ( xModules.is() ) { - xOldCfgStorage->setStorage( xModules ); - xOldCfgPersistence->reload(); + xOldCfgManager->setStorage( xModules ); + xOldCfgManager->reload(); } uno::Reference< ui::XUIConfigurationManager > xCfgManager = aNewVersionUIInfo.getConfigManager(vModulesInfo[i].sModuleShortName); diff --git a/framework/inc/framework/configimporter.hxx b/framework/inc/framework/configimporter.hxx index ab151ee8d059..06b6467f6c2a 100644 --- a/framework/inc/framework/configimporter.hxx +++ b/framework/inc/framework/configimporter.hxx @@ -22,7 +22,7 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/embed/XStorage.hpp> -#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManager2.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <rtl/ustring.hxx> @@ -34,7 +34,7 @@ namespace framework { public: static sal_Bool ImportCustomToolbars( - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >& rContainerFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager2 >& rContainerFactory, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > >& rSeqContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rToolbarStorage ); diff --git a/framework/inc/services.h b/framework/inc/services.h index 6fb4b45c723e..956568db3721 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -41,7 +41,6 @@ namespace framework{ #define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" ) #define SERVICENAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.frame.LayoutManager" ) #define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" ) -#define SERVICENAME_UICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.UIConfigurationManager" ) #define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" ) #define SERVICENAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.ui.UIElementFactory" ) #define SERVICENAME_FRAMECONTROLLER DECLARE_ASCII("com.sun.star.frame.Controller" ) @@ -94,7 +93,6 @@ namespace framework{ #define IMPLEMENTATIONNAME_UICOMMANDDESCRIPTION DECLARE_ASCII("com.sun.star.comp.framework.UICommandDescription" ) #define IMPLEMENTATIONNAME_UIELEMENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.comp.framework.UIElementFactoryManager" ) #define IMPLEMENTATIONNAME_MODULEMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ModuleManager" ) -#define IMPLEMENTATIONNAME_UICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.comp.framework.UIConfigurationManager" ) #define IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGERSUPPLIER DECLARE_ASCII("com.sun.star.comp.framework.ModuleUIConfigurationManagerSupplier" ) #define IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ModuleUIConfigurationManager" ) #define IMPLEMENTATIONNAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.MenuBarFactory" ) diff --git a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx index 6d93a74430a2..68d301453197 100644 --- a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx +++ b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx @@ -39,11 +39,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/ui/XUIConfiguration.hpp> -#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> - -#include <com/sun/star/ui/XUIConfigurationStorage.hpp> -#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManager2.hpp> #include <com/sun/star/ui/ConfigurationEvent.hpp> #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/container/XIndexContainer.hpp> @@ -57,11 +53,7 @@ namespace framework { class UIConfigurationManager : public com::sun::star::lang::XTypeProvider , public com::sun::star::lang::XServiceInfo , - public com::sun::star::lang::XComponent , - public ::com::sun::star::ui::XUIConfiguration , - public ::com::sun::star::ui::XUIConfigurationManager , - public ::com::sun::star::ui::XUIConfigurationPersistence , - public ::com::sun::star::ui::XUIConfigurationStorage , + public com::sun::star::ui::XUIConfigurationManager2 , private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. public ::cppu::OWeakObject { diff --git a/framework/source/fwe/helper/configimporter.cxx b/framework/source/fwe/helper/configimporter.cxx index 47983fc49b22..57a98f5134a8 100644 --- a/framework/source/fwe/helper/configimporter.cxx +++ b/framework/source/fwe/helper/configimporter.cxx @@ -30,7 +30,7 @@ namespace framework { sal_Bool UIConfigurationImporterOOo1x::ImportCustomToolbars( - const uno::Reference< ui::XUIConfigurationManager >& rContainerFactory, + const uno::Reference< ui::XUIConfigurationManager2 >& rContainerFactory, uno::Sequence< uno::Reference< container::XIndexContainer > >& rSeqContainer, const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< embed::XStorage >& rToolbarStorage ) diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 8f3224f65f63..e19585ab094d 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -28,15 +28,16 @@ #include <framework/statusbarconfiguration.hxx> -#include <com/sun/star/ui/UIElementType.hpp> -#include <com/sun/star/ui/ConfigurationEvent.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/ui/UIElementType.hpp> +#include <com/sun/star/ui/ConfigurationEvent.hpp> +#include <com/sun/star/ui/ConfigurationEvent.hpp> #include <comphelper/componentcontext.hxx> #include <vcl/svapp.hxx> @@ -60,31 +61,33 @@ namespace framework //***************************************************************************************************************** // XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XINTERFACE_7 ( UIConfigurationManager , +DEFINE_XINTERFACE_8 ( UIConfigurationManager , OWeakObject , DIRECT_INTERFACE( css::lang::XTypeProvider ), DIRECT_INTERFACE( css::lang::XServiceInfo ), DIRECT_INTERFACE( css::lang::XComponent ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfiguration ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationManager ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationPersistence ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationStorage ) + DIRECT_INTERFACE( css::ui::XUIConfiguration ), + DIRECT_INTERFACE( css::ui::XUIConfigurationManager ), + DIRECT_INTERFACE( css::ui::XUIConfigurationManager2 ), + DIRECT_INTERFACE( css::ui::XUIConfigurationPersistence ), + DIRECT_INTERFACE( css::ui::XUIConfigurationStorage ) ) -DEFINE_XTYPEPROVIDER_7 ( UIConfigurationManager , +DEFINE_XTYPEPROVIDER_8 ( UIConfigurationManager , css::lang::XTypeProvider , css::lang::XServiceInfo , css::lang::XComponent , - ::com::sun::star::ui::XUIConfiguration , - ::com::sun::star::ui::XUIConfigurationManager , - ::com::sun::star::ui::XUIConfigurationPersistence , - ::com::sun::star::ui::XUIConfigurationStorage + css::ui::XUIConfiguration , + css::ui::XUIConfigurationManager , + css::ui::XUIConfigurationManager2 , + css::ui::XUIConfigurationPersistence , + css::ui::XUIConfigurationStorage ) DEFINE_XSERVICEINFO_MULTISERVICE_2 ( UIConfigurationManager , ::cppu::OWeakObject , - SERVICENAME_UICONFIGURATIONMANAGER , - IMPLEMENTATIONNAME_UICONFIGURATIONMANAGER + OUString("com.sun.star.ui.UIConfigurationManager"), + OUString("com.sun.star.comp.framework.UIConfigurationManager") ) DEFINE_INIT_SERVICE ( UIConfigurationManager, {} ) diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 0f91b61ed048..d42358832600 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -348,6 +348,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\ AddressBookSourceDialog \ GlobalAcceleratorConfiguration \ ModuleUIConfigurationManagerSupplier \ + UIConfigurationManager \ UIElementFactoryManager \ WindowContentFactory \ WindowContentFactoryManager \ @@ -1484,7 +1485,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui,\ ModuleUIConfigurationManager \ ModuleWindowStateConfiguration \ UICategoryDescription \ - UIConfigurationManager \ UIElement \ UIElementFactory \ UIElementSettings \ @@ -3905,6 +3905,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ui,\ XUIConfiguration \ XUIConfigurationListener \ XUIConfigurationManager \ + XUIConfigurationManager2 \ XUIConfigurationManagerSupplier \ XUIConfigurationPersistence \ XUIConfigurationStorage \ diff --git a/offapi/com/sun/star/ui/UIConfigurationManager.idl b/offapi/com/sun/star/ui/UIConfigurationManager.idl index 1e581c4fde96..9b5fa98240af 100644 --- a/offapi/com/sun/star/ui/UIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/UIConfigurationManager.idl @@ -19,11 +19,7 @@ #ifndef __com_sun_star_ui_UIConfigurationManager_idl__ #define __com_sun_star_ui_UIConfigurationManager_idl__ -#include <com/sun/star/lang/XComponent.idl> -#include <com/sun/star/ui/XUIConfiguration.idl> -#include <com/sun/star/ui/XUIConfigurationManager.idl> -#include <com/sun/star/ui/XUIConfigurationPersistence.idl> -#include <com/sun/star/ui/XUIConfigurationStorage.idl> +#include <com/sun/star/ui/XUIConfigurationManager2.idl> module com { module sun { module star { module ui { @@ -33,37 +29,7 @@ module com { module sun { module star { module ui { @since OOo 2.0 */ -service UIConfigurationManager -{ - /** provides access to set a storage and to check if a storage has been - associated to the user interface configuration manager. - */ - interface com::sun::star::ui::XUIConfigurationStorage; - - /** provides access to persistence functions to load/store user interface configuration - data from a storage. - */ - interface com::sun::star::ui::XUIConfigurationPersistence; - - /** provides functions to change, insert and remove user interface elements - from a user interface configuration manager. - */ - interface com::sun::star::ui::XUIConfigurationManager; - - /** provides functions to add and remove listeners for changes within a user - interface configuration manager. - */ - interface com::sun::star::ui::XUIConfiguration; - - /** allows controlling or observing the lifetime of a user interface configuration manager - instance. - - <p>The owner of the object may dispose of this object using - <member scope="com::sun::star::lang">XComponent::dispose()</member>. - </p> - */ - interface ::com::sun::star::lang::XComponent; -}; +service UIConfigurationManager : XUIConfigurationManager2; }; }; }; }; diff --git a/offapi/com/sun/star/ui/XUIConfigurationManager2.idl b/offapi/com/sun/star/ui/XUIConfigurationManager2.idl new file mode 100644 index 000000000000..f116eec0f53a --- /dev/null +++ b/offapi/com/sun/star/ui/XUIConfigurationManager2.idl @@ -0,0 +1,70 @@ +/* -*- 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 . + */ +#ifndef __com_sun_star_ui_XUIConfigurationManager2_idl__ +#define __com_sun_star_ui_XUIConfigurationManager2_idl__ + +#include <com/sun/star/lang/XComponent.idl> +#include <com/sun/star/ui/XUIConfiguration.idl> +#include <com/sun/star/ui/XUIConfigurationManager.idl> +#include <com/sun/star/ui/XUIConfigurationPersistence.idl> +#include <com/sun/star/ui/XUIConfigurationStorage.idl> + +module com { module sun { module star { module ui { + +/** + @since LibreOffice 4.1 +*/ +interface XUIConfigurationManager2 +{ + /** provides access to set a storage and to check if a storage has been + associated to the user interface configuration manager. + */ + interface com::sun::star::ui::XUIConfigurationStorage; + + /** provides access to persistence functions to load/store user interface configuration + data from a storage. + */ + interface com::sun::star::ui::XUIConfigurationPersistence; + + /** provides functions to change, insert and remove user interface elements + from a user interface configuration manager. + */ + interface com::sun::star::ui::XUIConfigurationManager; + + /** provides functions to add and remove listeners for changes within a user + interface configuration manager. + */ + interface com::sun::star::ui::XUIConfiguration; + + /** allows controlling or observing the lifetime of a user interface configuration manager + instance. + + <p>The owner of the object may dispose of this object using + <member scope="com::sun::star::lang">XComponent::dispose()</member>. + </p> + */ + interface ::com::sun::star::lang::XComponent; +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx index caa054e392df..c923f1d940a9 100644 --- a/reportdesign/inc/ReportDefinition.hxx +++ b/reportdesign/inc/ReportDefinition.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/report/XReportDefinition.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/ui/XUIConfigurationManager2.hpp> #include <comphelper/embeddedobjectcontainer.hxx> #include <comphelper/uno3.hxx> @@ -395,6 +396,8 @@ namespace reportdesign virtual bool isEnableSetModified() const; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const; + + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager2 > getUIConfigurationManager2( ) throw (::com::sun::star::uno::RuntimeException); }; // ============================================================================= } // namespace reportdesign diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index d5abf5202343..09bf83fbdc74 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -74,6 +74,7 @@ #include <com/sun/star/task/ErrorCodeIOException.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <com/sun/star/ui/UIConfigurationManager.hpp> #include <com/sun/star/ui/XUIConfigurationStorage.hpp> #include <com/sun/star/util/NumberFormatsSupplier.hpp> #include <com/sun/star/xml/AttributeData.hpp> @@ -573,7 +574,7 @@ struct OReportDefinitionImpl uno::Reference< container::XNameAccess> m_xDashTable; uno::Reference< container::XNameAccess> m_xMarkerTable; uno::Reference< report::XFunctions > m_xFunctions; - uno::Reference< ui::XUIConfigurationManager> m_xUIConfigurationManager; + uno::Reference< ui::XUIConfigurationManager2> m_xUIConfigurationManager; uno::Reference< util::XNumberFormatsSupplier> m_xNumberFormatsSupplier; uno::Reference< sdbc::XConnection> m_xActiveConnection; uno::Reference< frame::XTitle > m_xTitleHelper; @@ -2071,21 +2072,21 @@ uno::Reference< report::XFunctions > SAL_CALL OReportDefinition::getFunctions() // ----------------------------------------------------------------------------- uno::Reference< ui::XUIConfigurationManager > SAL_CALL OReportDefinition::getUIConfigurationManager( ) throw (uno::RuntimeException) { + return uno::Reference< ui::XUIConfigurationManager >( getUIConfigurationManager2(), uno::UNO_QUERY_THROW ); +} +// ----------------------------------------------------------------------------- +uno::Reference< ui::XUIConfigurationManager2 > OReportDefinition::getUIConfigurationManager2( ) throw (uno::RuntimeException) +{ ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); if ( !m_pImpl->m_xUIConfigurationManager.is() ) { - m_pImpl->m_xUIConfigurationManager.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager")),m_aProps->m_xContext), - uno::UNO_QUERY); + m_pImpl->m_xUIConfigurationManager = ui::UIConfigurationManager::create(m_aProps->m_xContext); - uno::Reference< ui::XUIConfigurationStorage > xUIConfigStorage( m_pImpl->m_xUIConfigurationManager, uno::UNO_QUERY ); - if ( xUIConfigStorage.is() ) - { - uno::Reference< embed::XStorage > xConfigStorage; - // initialize ui configuration manager with document substorage - xUIConfigStorage->setStorage( xConfigStorage ); - } + uno::Reference< embed::XStorage > xConfigStorage; + // initialize ui configuration manager with document substorage + m_pImpl->m_xUIConfigurationManager->setStorage( xConfigStorage ); } return m_pImpl->m_xUIConfigurationManager; diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 66b9c9c20445..e0ac759e38b4 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -68,6 +68,7 @@ #include <com/sun/star/lang/EventObject.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp> #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> +#include <com/sun/star/ui/XUIConfigurationManager2.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/embed/XVisualObject.hpp> #include <com/sun/star/uno/Sequence.hxx> @@ -1503,6 +1504,7 @@ private: @onerror - */ + css::uno::Reference< css::ui::XUIConfigurationManager2 > getUIConfigurationManager2() throw ( RUNTIMEEXCEPTION ); bool impl_getPrintHelper(); SAL_DLLPRIVATE void ListenForStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); SAL_DLLPRIVATE ::rtl::OUString GetMediumFilterName_Impl(); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 06f496294f65..e62cb4a71953 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -41,8 +41,7 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/script/provider/XScriptProviderFactory.hpp> #include <com/sun/star/script/provider/XScriptProvider.hpp> -#include <com/sun/star/ui/XUIConfigurationStorage.hpp> -#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> +#include <com/sun/star/ui/UIConfigurationManager.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/Aspects.hpp> #include <com/sun/star/document/DocumentProperties.hpp> @@ -204,7 +203,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument sal_Bool m_bModifiedSinceLastSave; uno::Reference< com::sun::star::view::XPrintable> m_xPrintable ; uno::Reference< script::provider::XScriptProvider > m_xScriptProvider; - uno::Reference< ui::XUIConfigurationManager > m_xUIConfigurationManager; + uno::Reference< ui::XUIConfigurationManager2 > m_xUIConfigurationManager; ::rtl::Reference< ::sfx2::DocumentStorageModifyListener > m_pStorageModifyListen; ::rtl::OUString m_sModuleIdentifier; css::uno::Reference< css::frame::XTitle > m_xTitleHelper; @@ -2767,8 +2766,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , if ( xConfigStorage.is() || !m_pData->m_pObjectShell->GetStorage()->hasByName( aUIConfigFolderName ) ) { // the storage is different, since otherwise it could not be opened, so it must be exchanged - Reference< ui::XUIConfigurationStorage > xUIConfigStorage( m_pData->m_xUIConfigurationManager, uno::UNO_QUERY ); - xUIConfigStorage->setStorage( xConfigStorage ); + m_pData->m_xUIConfigurationManager->setStorage( xConfigStorage ); } else { @@ -3498,95 +3496,94 @@ static void ConvertSlotsToCommands( SfxObjectShell* pDoc, uno::Reference< contai uno::Reference< ui::XUIConfigurationManager > SAL_CALL SfxBaseModel::getUIConfigurationManager() throw ( uno::RuntimeException ) { + return uno::Reference< ui::XUIConfigurationManager >( getUIConfigurationManager2(), UNO_QUERY_THROW ); +} + +uno::Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManager2() + throw ( uno::RuntimeException ) +{ SfxModelGuard aGuard( *this ); if ( !m_pData->m_xUIConfigurationManager.is() ) { - uno::Reference< ui::XUIConfigurationManager > xNewUIConfMan( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString("com.sun.star.ui.UIConfigurationManager")), - uno::UNO_QUERY ); + uno::Reference< ui::XUIConfigurationManager2 > xNewUIConfMan = + ui::UIConfigurationManager::create( comphelper::getProcessComponentContext() ); - Reference< ui::XUIConfigurationStorage > xUIConfigStorage( xNewUIConfMan, uno::UNO_QUERY ); - if ( xUIConfigStorage.is() ) - { - uno::Reference< XSTORAGE > xConfigStorage; + uno::Reference< XSTORAGE > xConfigStorage; - rtl::OUString aUIConfigFolderName( "Configurations2" ); - // First try to open with READWRITE and then READ - xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, embed::ElementModes::READWRITE ); - if ( xConfigStorage.is() ) + rtl::OUString aUIConfigFolderName( "Configurations2" ); + // First try to open with READWRITE and then READ + xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, embed::ElementModes::READWRITE ); + if ( xConfigStorage.is() ) + { + rtl::OUString aMediaTypeProp( "MediaType" ); + rtl::OUString aUIConfigMediaType( + "application/vnd.sun.xml.ui.configuration" ); + rtl::OUString aMediaType; + uno::Reference< beans::XPropertySet > xPropSet( xConfigStorage, uno::UNO_QUERY ); + Any a = xPropSet->getPropertyValue( aMediaTypeProp ); + if ( !( a >>= aMediaType ) || aMediaType.isEmpty()) { - rtl::OUString aMediaTypeProp( "MediaType" ); - rtl::OUString aUIConfigMediaType( - "application/vnd.sun.xml.ui.configuration" ); - rtl::OUString aMediaType; - uno::Reference< beans::XPropertySet > xPropSet( xConfigStorage, uno::UNO_QUERY ); - Any a = xPropSet->getPropertyValue( aMediaTypeProp ); - if ( !( a >>= aMediaType ) || aMediaType.isEmpty()) - { - a <<= aUIConfigMediaType; - xPropSet->setPropertyValue( aMediaTypeProp, a ); - } + a <<= aUIConfigMediaType; + xPropSet->setPropertyValue( aMediaTypeProp, a ); } - else - xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, embed::ElementModes::READ ); + } + else + xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, embed::ElementModes::READ ); - // initialize ui configuration manager with document substorage - xUIConfigStorage->setStorage( xConfigStorage ); + // initialize ui configuration manager with document substorage + xNewUIConfMan->setStorage( xConfigStorage ); - // embedded objects did not support local configuration data until OOo 3.0, so there's nothing to - // migrate - if ( m_pData->m_pObjectShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + // embedded objects did not support local configuration data until OOo 3.0, so there's nothing to + // migrate + if ( m_pData->m_pObjectShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + { + // Import old UI configuration from OOo 1.x + uno::Reference< XSTORAGE > xOOo1ConfigStorage; + rtl::OUString aOOo1UIConfigFolderName( "Configurations" ); + + // Try to open with READ + xOOo1ConfigStorage = getDocumentSubStorage( aOOo1UIConfigFolderName, embed::ElementModes::READ ); + if ( xOOo1ConfigStorage.is() ) { - // Import old UI configuration from OOo 1.x - uno::Reference< XSTORAGE > xOOo1ConfigStorage; - rtl::OUString aOOo1UIConfigFolderName( "Configurations" ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Sequence< uno::Reference< container::XIndexContainer > > rToolbars; - // Try to open with READ - xOOo1ConfigStorage = getDocumentSubStorage( aOOo1UIConfigFolderName, embed::ElementModes::READ ); - if ( xOOo1ConfigStorage.is() ) + sal_Bool bImported = framework::UIConfigurationImporterOOo1x::ImportCustomToolbars( + xNewUIConfMan, rToolbars, xContext, xOOo1ConfigStorage ); + if ( bImported ) { - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - uno::Sequence< uno::Reference< container::XIndexContainer > > rToolbars; + SfxObjectShell* pObjShell = SfxBaseModel::GetObjectShell(); - sal_Bool bImported = framework::UIConfigurationImporterOOo1x::ImportCustomToolbars( - xNewUIConfMan, rToolbars, xContext, xOOo1ConfigStorage ); - if ( bImported ) + rtl::OUString aNum( "private:resource/toolbar/custom_OOo1x_" ); + rtl::OUString aTitle( "Toolbar " ); + for ( sal_Int32 i = 0; i < rToolbars.getLength(); i++ ) { - SfxObjectShell* pObjShell = SfxBaseModel::GetObjectShell(); + rtl::OUString aCustomTbxName = aNum + rtl::OUString::valueOf( i + 1 ); + rtl::OUString aCustomTbxTitle = aTitle + rtl::OUString::valueOf( i + 1 ); - rtl::OUString aNum( "private:resource/toolbar/custom_OOo1x_" ); - rtl::OUString aTitle( "Toolbar " ); - for ( sal_Int32 i = 0; i < rToolbars.getLength(); i++ ) + uno::Reference< container::XIndexContainer > xToolbar = rToolbars[i]; + ConvertSlotsToCommands( pObjShell, xToolbar ); + if ( !xNewUIConfMan->hasSettings( aCustomTbxName )) { - rtl::OUString aCustomTbxName = aNum + rtl::OUString::valueOf( i + 1 ); - rtl::OUString aCustomTbxTitle = aTitle + rtl::OUString::valueOf( i + 1 ); - - uno::Reference< container::XIndexContainer > xToolbar = rToolbars[i]; - ConvertSlotsToCommands( pObjShell, xToolbar ); - if ( !xNewUIConfMan->hasSettings( aCustomTbxName )) + // Set UIName for the toolbar with container property + uno::Reference< beans::XPropertySet > xPropSet( xToolbar, UNO_QUERY ); + if ( xPropSet.is() ) { - // Set UIName for the toolbar with container property - uno::Reference< beans::XPropertySet > xPropSet( xToolbar, UNO_QUERY ); - if ( xPropSet.is() ) + try + { + rtl::OUString aPropName( "UIName" ); + Any aAny( aCustomTbxTitle ); + xPropSet->setPropertyValue( aPropName, aAny ); + } + catch ( beans::UnknownPropertyException& ) { - try - { - rtl::OUString aPropName( "UIName" ); - Any aAny( aCustomTbxTitle ); - xPropSet->setPropertyValue( aPropName, aAny ); - } - catch ( beans::UnknownPropertyException& ) - { - } } - - uno::Reference< container::XIndexAccess > xToolbarData( xToolbar, uno::UNO_QUERY ); - xNewUIConfMan->insertSettings( aCustomTbxName, xToolbarData ); - uno::Reference< ui::XUIConfigurationPersistence > xPersist( xNewUIConfMan, uno::UNO_QUERY ); - xPersist->store(); } + + uno::Reference< container::XIndexAccess > xToolbarData( xToolbar, uno::UNO_QUERY ); + xNewUIConfMan->insertSettings( aCustomTbxName, xToolbarData ); + xNewUIConfMan->store(); } } } @@ -3814,9 +3811,7 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x else { // UICfgMgr has a reference to the old storage, update it - uno::Reference< ui::XUIConfigurationStorage > xUICfgMgrStorage( getUIConfigurationManager(), uno::UNO_QUERY ); - if ( xUICfgMgrStorage.is() ) - xUICfgMgrStorage->setStorage( xStorage ); + getUIConfigurationManager2()->setStorage( xStorage ); } } m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = sal_False; @@ -3900,7 +3895,6 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () if ( ! m_pData->m_xTitleHelper.is ()) { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XUntitledNumbers > xDesktop( css::frame::Desktop::create(xContext), css::uno::UNO_QUERY_THROW); css::uno::Reference< css::frame::XModel > xThis (static_cast< css::frame::XModel* >(this), css::uno::UNO_QUERY_THROW); |