summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-07-08 15:05:56 +0200
committerNoel Grandin <noel@peralex.com>2013-07-23 10:05:42 +0200
commit9c41a60c0d802c618ac414822615a5c9e9e92f9f (patch)
tree3582b3afa7427489391cb9fece6154b64042c310 /framework
parentadjust for upstreaming of warn_unused attribute (diff)
downloadcore-9c41a60c0d802c618ac414822615a5c9e9e92f9f.tar.gz
core-9c41a60c0d802c618ac414822615a5c9e9e92f9f.zip
fdo#46808, Convert ui::ModuleUIConfigurationManager service to new style
.. and convert it to WeakImplHelper at the same time. Change-Id: I20549f5cc6efb60c5210d3f9b6ecf3ade7e4a75a
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/services.h2
-rw-r--r--framework/inc/uiconfiguration/moduleuicfgsupplier.hxx3
-rw-r--r--framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx24
-rw-r--r--framework/source/uiconfiguration/moduleuicfgsupplier.cxx21
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx109
5 files changed, 66 insertions, 93 deletions
diff --git a/framework/inc/services.h b/framework/inc/services.h
index f59f952c0692..b7fa4ca479fe 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -37,7 +37,6 @@ namespace framework{
#define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" )
#define SERVICENAME_POPUPMENUCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.PopupMenuControllerFactory" )
#define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" )
-#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" )
#define SERVICENAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.ui.ToolBarFactory" )
@@ -83,7 +82,6 @@ namespace framework{
#define IMPLEMENTATIONNAME_UIELEMENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.comp.framework.UIElementFactoryManager" )
#define IMPLEMENTATIONNAME_MODULEMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ModuleManager" )
#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" )
#define IMPLEMENTATIONNAME_STARTMODULE DECLARE_ASCII("com.sun.star.comp.framework.BackingComp" )
#define IMPLEMENTATIONNAME_WINDOWSTATECONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.WindowStateConfiguration" )
diff --git a/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx b/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx
index 47d1d910c728..a23b8745cb71 100644
--- a/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx
+++ b/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx
@@ -40,6 +40,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManager2.hpp>
#include <com/sun/star/frame/XModuleManager2.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
@@ -80,7 +81,7 @@ namespace framework
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
private:
- typedef ::boost::unordered_map< OUString, com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >, OUStringHash, ::std::equal_to< OUString > > ModuleToModuleCfgMgr;
+ typedef ::boost::unordered_map< OUString, com::sun::star::uno::Reference< ::com::sun::star::ui::XModuleUIConfigurationManager2 >, OUStringHash, ::std::equal_to< OUString > > ModuleToModuleCfgMgr;
//TODO_AS void impl_initStorages();
diff --git a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx
index efa56ec0a3ab..532c3addf401 100644
--- a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx
+++ b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx
@@ -41,37 +41,29 @@
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-#include <com/sun/star/ui/XUIConfiguration.hpp>
-#include <com/sun/star/ui/XUIConfigurationManager.hpp>
-#include <com/sun/star/ui/XModuleUIConfigurationManager.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManager2.hpp>
#include <com/sun/star/ui/UIElementType.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/ui/ConfigurationEvent.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
- class ModuleUIConfigurationManager : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::lang::XComponent ,
- public com::sun::star::lang::XInitialization ,
- public ::com::sun::star::ui::XUIConfiguration ,
- public ::com::sun::star::ui::XUIConfigurationManager ,
- public ::com::sun::star::ui::XModuleUIConfigurationManager ,
- public ::com::sun::star::ui::XUIConfigurationPersistence ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+ class ModuleUIConfigurationManager : private ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
+ cppu::WeakImplHelper4<
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::lang::XComponent,
+ com::sun::star::lang::XInitialization,
+ com::sun::star::ui::XModuleUIConfigurationManager2 >
{
public:
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
ModuleUIConfigurationManager( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xServiceManager );
diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
index c891fd38d1b8..6ed1210a52d9 100644
--- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
+++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/embed/XPackageStructureCreator.hpp>
+#include <com/sun/star/ui/ModuleUIConfigurationManager.hpp>
#include <rtl/logfile.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -113,7 +114,7 @@ ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons
const Sequence< OUString > aNameSeq = xNameAccess->getElementNames();
const OUString* pNameSeq = aNameSeq.getConstArray();
for ( sal_Int32 n = 0; n < aNameSeq.getLength(); n++ )
- m_aModuleToModuleUICfgMgrMap.insert( ModuleToModuleCfgMgr::value_type( pNameSeq[n], Reference< XUIConfigurationManager >() ));
+ m_aModuleToModuleUICfgMgrMap.insert( ModuleToModuleCfgMgr::value_type( pNameSeq[n], Reference< XModuleUIConfigurationManager2 >() ));
}
catch(...)
{
@@ -175,7 +176,7 @@ throw ( RuntimeException )
}
// XModuleUIConfigurationManagerSupplier
-Reference< XUIConfigurationManager > SAL_CALL ModuleUIConfigurationManagerSupplier::getUIConfigurationManager( const OUString& ModuleIdentifier )
+Reference< XUIConfigurationManager > SAL_CALL ModuleUIConfigurationManagerSupplier::getUIConfigurationManager( const OUString& sModuleIdentifier )
throw ( NoSuchElementException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::getUIConfigurationManager" );
@@ -185,7 +186,7 @@ throw ( NoSuchElementException, RuntimeException)
if ( m_bDisposed )
throw DisposedException();
- ModuleToModuleCfgMgr::iterator pIter = m_aModuleToModuleUICfgMgrMap.find( ModuleIdentifier );
+ ModuleToModuleCfgMgr::iterator pIter = m_aModuleToModuleUICfgMgrMap.find( sModuleIdentifier );
if ( pIter == m_aModuleToModuleUICfgMgrMap.end() )
throw NoSuchElementException();
//TODO_AS impl_initStorages();
@@ -198,7 +199,7 @@ throw ( NoSuchElementException, RuntimeException)
{
Sequence< PropertyValue > lProps;
Reference< XNameAccess > xCont(m_xModuleMgr, UNO_QUERY);
- xCont->getByName(ModuleIdentifier) >>= lProps;
+ xCont->getByName(sModuleIdentifier) >>= lProps;
for (sal_Int32 i=0; i<lProps.getLength(); ++i)
{
if ( lProps[i].Name == "ooSetupFactoryShortName" )
@@ -215,16 +216,8 @@ throw ( NoSuchElementException, RuntimeException)
if (sShort.isEmpty())
throw NoSuchElementException();
- PropertyValue aArg;
- Sequence< Any > aArgs( 2 );
- aArg.Name = OUString( "ModuleShortName" );
- aArg.Value <<= sShort;
- aArgs[0] <<= aArg;
- aArg.Name = OUString( "ModuleIdentifier" );
- aArg.Value <<= ModuleIdentifier;
- aArgs[1] <<= aArg;
-
- pIter->second.set( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(SERVICENAME_MODULEUICONFIGURATIONMANAGER, aArgs, m_xContext ),UNO_QUERY );
+
+ pIter->second = css::ui::ModuleUIConfigurationManager::createDefault(m_xContext, sShort, sModuleIdentifier);
}
return pIter->second;
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index dfadbe57429a..eaadaa583df0 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -56,31 +56,12 @@ using namespace ::com::sun::star::ui;
namespace framework
{
+#define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" )
+#define IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ModuleUIConfigurationManager" )
+
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_8 ( ModuleUIConfigurationManager ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( css::lang::XComponent ),
- DIRECT_INTERFACE( css::lang::XInitialization ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfiguration ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationManager ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XModuleUIConfigurationManager ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationPersistence )
- )
-
-DEFINE_XTYPEPROVIDER_8 ( ModuleUIConfigurationManager ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::lang::XComponent ,
- css::lang::XInitialization ,
- ::com::sun::star::ui::XUIConfiguration ,
- ::com::sun::star::ui::XUIConfigurationManager ,
- ::com::sun::star::ui::XModuleUIConfigurationManager ,
- ::com::sun::star::ui::XUIConfigurationPersistence
- )
DEFINE_XSERVICEINFO_MULTISERVICE_2 ( ModuleUIConfigurationManager ,
::cppu::OWeakObject ,
@@ -807,56 +788,64 @@ void SAL_CALL ModuleUIConfigurationManager::initialize( const Sequence< Any >& a
{
ResetableGuard aLock( m_aLock );
- if ( !m_bInitialized )
+ if( m_bInitialized )
+ {
+ return;
+ }
+
+ if( aArguments.getLength() == 2 && (aArguments[0] >>= m_aModuleShortName) && (aArguments[1] >>= m_aModuleIdentifier))
+ {
+ }
+ else
{
::comphelper::SequenceAsHashMap lArgs(aArguments);
- m_aModuleIdentifier = lArgs.getUnpackedValueOrDefault("ModuleIdentifier", OUString());
m_aModuleShortName = lArgs.getUnpackedValueOrDefault("ModuleShortName", OUString());
+ m_aModuleIdentifier = lArgs.getUnpackedValueOrDefault("ModuleIdentifier", OUString());
+ }
- for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ OUString aResourceType;
+ if ( i == ::com::sun::star::ui::UIElementType::MENUBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_MENUBAR();
+ else if ( i == ::com::sun::star::ui::UIElementType::TOOLBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_TOOLBAR();
+ else if ( i == ::com::sun::star::ui::UIElementType::STATUSBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_STATUSBAR();
+
+ if ( !aResourceType.isEmpty() )
{
- OUString aResourceType;
- if ( i == ::com::sun::star::ui::UIElementType::MENUBAR )
- aResourceType = PresetHandler::RESOURCETYPE_MENUBAR();
- else if ( i == ::com::sun::star::ui::UIElementType::TOOLBAR )
- aResourceType = PresetHandler::RESOURCETYPE_TOOLBAR();
- else if ( i == ::com::sun::star::ui::UIElementType::STATUSBAR )
- aResourceType = PresetHandler::RESOURCETYPE_STATUSBAR();
-
- if ( !aResourceType.isEmpty() )
- {
- m_pStorageHandler[i] = new PresetHandler( m_xContext );
- m_pStorageHandler[i]->connectToResource( PresetHandler::E_MODULES,
- aResourceType, // this path wont be used later ... seee next lines!
- m_aModuleShortName,
- css::uno::Reference< css::embed::XStorage >()); // no document root used here!
- }
+ m_pStorageHandler[i] = new PresetHandler( m_xContext );
+ m_pStorageHandler[i]->connectToResource( PresetHandler::E_MODULES,
+ aResourceType, // this path wont be used later ... seee next lines!
+ m_aModuleShortName,
+ css::uno::Reference< css::embed::XStorage >()); // no document root used here!
}
+ }
- // initialize root storages for all resource types
- m_xUserRootCommit = css::uno::Reference< css::embed::XTransactedObject >(
- m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getOrCreateRootStorageUser(), css::uno::UNO_QUERY); // can be empty
- m_xDefaultConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageShare(
- m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageShare());
- m_xUserConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageUser(
- m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageUser());
+ // initialize root storages for all resource types
+ m_xUserRootCommit = css::uno::Reference< css::embed::XTransactedObject >(
+ m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getOrCreateRootStorageUser(), css::uno::UNO_QUERY); // can be empty
+ m_xDefaultConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageShare(
+ m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageShare());
+ m_xUserConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageUser(
+ m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageUser());
- if ( m_xUserConfigStorage.is() )
+ if ( m_xUserConfigStorage.is() )
+ {
+ Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
+ if ( xPropSet.is() )
{
- Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
- if ( xPropSet.is() )
- {
- long nOpenMode = 0;
- Any a = xPropSet->getPropertyValue("OpenMode");
- if ( a >>= nOpenMode )
- m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
- }
+ long nOpenMode = 0;
+ Any a = xPropSet->getPropertyValue("OpenMode");
+ if ( a >>= nOpenMode )
+ m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
}
+ }
- impl_Initialize();
+ impl_Initialize();
- m_bInitialized = true;
- }
+ m_bInitialized = true;
}
// XUIConfiguration