diff options
author | Andras Timar <atimar@suse.com> | 2012-11-11 18:24:14 +0100 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-11-11 18:24:14 +0100 |
commit | 06ec1c089519ef3249464aa09eadf03a8db93a39 (patch) | |
tree | 85b2eb6d8ba6ca95e18e1ff82151224cb14106f6 /framework | |
parent | 8e0d67bed54633d555a4601a5d79e2d5ba7ab2bb (diff) | |
parent | 3f899eae02eaad0b967de749fe09b869ba93ad6d (diff) |
Merge branch 'master' into feature/killsdf
Conflicts:
Repository.mk
RepositoryFixes.mk
connectivity/prj/build.lst
extensions/prj/build.lst
filter/prj/build.lst
fpicker/prj/build.lst
l10ntools/StaticLibrary_transex.mk
saxon/build.xml
shell/prj/build.lst
solenv/gbuild/AllLangResTarget.mk
solenv/gbuild/Configuration.mk
solenv/gbuild/UI.mk
ucb/source/ucp/webdav/webdavcontent.cxx
Diffstat (limited to 'framework')
99 files changed, 685 insertions, 794 deletions
diff --git a/framework/inc/dispatch/mailtodispatcher.hxx b/framework/inc/dispatch/mailtodispatcher.hxx index 91acd5b837de..72ad6396795e 100644 --- a/framework/inc/dispatch/mailtodispatcher.hxx +++ b/framework/inc/dispatch/mailtodispatcher.hxx @@ -76,14 +76,14 @@ class MailToDispatcher : // interfaces private: /// reference to global uno service manager which had created us - css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /* interface */ public: // ctor/dtor - MailToDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); - virtual ~MailToDispatcher( ); + MailToDispatcher( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~MailToDispatcher( ); // XInterface, XTypeProvider, XServiceInfo FWK_DECLARE_XINTERFACE diff --git a/framework/inc/dispatch/popupmenudispatcher.hxx b/framework/inc/dispatch/popupmenudispatcher.hxx index b534a0797d13..f1ee756e09cc 100644 --- a/framework/inc/dispatch/popupmenudispatcher.hxx +++ b/framework/inc/dispatch/popupmenudispatcher.hxx @@ -94,7 +94,7 @@ class PopupMenuDispatcher : // interfaces public: // constructor / destructor - PopupMenuDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + PopupMenuDispatcher( const css::uno::Reference< css::uno::XComponentContext >& xContext ); // XInterface, XTypeProvider, XServiceInfo FWK_DECLARE_XINTERFACE @@ -146,7 +146,7 @@ class PopupMenuDispatcher : // interfaces css::uno::WeakReference< css::frame::XFrame > m_xWeakFrame ; /// css::uno::WeakReference to frame (Don't use a hard css::uno::Reference. Owner can't delete us then!) css::uno::Reference< css::container::XNameAccess > m_xPopupCtrlQuery ; /// reference to query for popup controller css::uno::Reference< css::uri::XUriReferenceFactory > m_xUriRefFactory ; /// reference to the uri reference factory - css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// factory shared with our owner to create new services! + css::uno::Reference< css::uno::XComponentContext > m_xContext ; /// factory shared with our owner to create new services! IMPL_ListenerHashContainer m_aListenerContainer; /// hash table for listener at specified URLs sal_Bool m_bAlreadyDisposed ; /// Protection against multiple disposing calls. sal_Bool m_bActivateListener ; /// dispatcher is listener for frame activation diff --git a/framework/inc/dispatch/systemexec.hxx b/framework/inc/dispatch/systemexec.hxx index 3469e42a6b76..c0e2b641c7dc 100644 --- a/framework/inc/dispatch/systemexec.hxx +++ b/framework/inc/dispatch/systemexec.hxx @@ -78,13 +78,13 @@ class SystemExec : // interfaces private: /// reference to global uno service manager which had created us - css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /* interface */ public: // ctor/dtor - SystemExec( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + SystemExec( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); virtual ~SystemExec( ); // XInterface, XTypeProvider, XServiceInfo diff --git a/framework/inc/framework/statusbarconfiguration.hxx b/framework/inc/framework/statusbarconfiguration.hxx index 2c405c797573..5204e670d43b 100644 --- a/framework/inc/framework/statusbarconfiguration.hxx +++ b/framework/inc/framework/statusbarconfiguration.hxx @@ -50,7 +50,7 @@ class FWE_DLLPUBLIC StatusBarConfiguration const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rStatusbarConfiguration ); static sal_Bool StoreStatusBar( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusbarConfiguration ); }; diff --git a/framework/inc/framework/titlehelper.hxx b/framework/inc/framework/titlehelper.hxx index 959810b1d7c5..79e78077058e 100644 --- a/framework/inc/framework/titlehelper.hxx +++ b/framework/inc/framework/titlehelper.hxx @@ -31,6 +31,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/frame/XUntitledNumbers.hpp> #include <com/sun/star/frame/XTitle.hpp> @@ -75,7 +76,7 @@ class FWE_DLLPUBLIC TitleHelper : private ::cppu::BaseMutex //--------------------------------------- /** @short lightweight constructor. */ - TitleHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext); //--------------------------------------- /** @short free all internaly used resources. @@ -182,7 +183,7 @@ class FWE_DLLPUBLIC TitleHelper : private ::cppu::BaseMutex private: /** points to the global uno service manager. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext> m_xContext; /** reference to the outside UNO class using this helper. */ css::uno::WeakReference< css::uno::XInterface > m_xOwner; diff --git a/framework/inc/framework/toolboxconfiguration.hxx b/framework/inc/framework/toolboxconfiguration.hxx index 1e31bbb8dbac..b8282bc0b99f 100644 --- a/framework/inc/framework/toolboxconfiguration.hxx +++ b/framework/inc/framework/toolboxconfiguration.hxx @@ -42,7 +42,7 @@ class FWE_DLLPUBLIC ToolBoxConfiguration const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rToolbarConfiguration ); static sal_Bool StoreToolBox( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rToolbarConfiguration ); }; diff --git a/framework/inc/general.h b/framework/inc/general.h index f131eacbb15b..3ab1556ed864 100644 --- a/framework/inc/general.h +++ b/framework/inc/general.h @@ -48,25 +48,6 @@ */ namespace css = ::com::sun::star; -namespace framework { - -//----------------------------------------------------------------------------- -/** Those macro is used to make it more clear where a synchronized block will start. - Because normal documentation code wont be recognized by some developers to be real - I need something where they are thinking about. - - At least this macro will do nothing ... it's empty. - But it should make the code more clear .-)) -*/ -#define SYNCHRONIZED_START - -//----------------------------------------------------------------------------- -/** Same then SYNCHRONIZED_START ... but instead it mark the end of such code block. -*/ -#define SYNCHRONIZED_END - -} // namespace framework - #endif // #ifndef __FRAMEWORK_GENERAL_H_ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/persistentwindowstate.hxx b/framework/inc/helper/persistentwindowstate.hxx index 86f63abeb17e..d9e1ae2fdfd5 100644 --- a/framework/inc/helper/persistentwindowstate.hxx +++ b/framework/inc/helper/persistentwindowstate.hxx @@ -117,7 +117,7 @@ class PersistentWindowState : // interfaces /** @short identify the application module, which is used behind the component of our frame. - @param xSMGR + @param rxContext needed to create needed uno resources. @param xFrame @@ -126,13 +126,13 @@ class PersistentWindowState : // interfaces @return [string] a module identifier for the current frame component. */ - static ::rtl::OUString implst_identifyModule(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + static ::rtl::OUString implst_identifyModule(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& xFrame); //____________________________ /** @short retrieve the window state from the configuration. - @param xSMGR + @param rxContext needed to create the configuration access. @param sModuleName @@ -142,8 +142,8 @@ class PersistentWindowState : // interfaces @return [string] contains the information about position and size. */ - static ::rtl::OUString implst_getWindowStateFromConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const ::rtl::OUString& sModuleName); + static ::rtl::OUString implst_getWindowStateFromConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext , + const ::rtl::OUString& sModuleName); //____________________________ /** @short retrieve the window state from the container window. @@ -161,7 +161,7 @@ class PersistentWindowState : // interfaces //____________________________ /** @short restore the position and size on the container window. - @param xSMGR + @param rxContext needed to create the configuration access. @param sModuleName @@ -171,9 +171,9 @@ class PersistentWindowState : // interfaces @param sWindowState contains the information about position and size. */ - static void implst_setWindowStateOnConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const ::rtl::OUString& sModuleName , - const ::rtl::OUString& sWindowState ); + static void implst_setWindowStateOnConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const ::rtl::OUString& sModuleName , + const ::rtl::OUString& sWindowState ); //____________________________ /** @short restore the position and size on the container window. diff --git a/framework/inc/jobs/configaccess.hxx b/framework/inc/jobs/configaccess.hxx index 30ef4f2a47d8..dd9386a19630 100644 --- a/framework/inc/jobs/configaccess.hxx +++ b/framework/inc/jobs/configaccess.hxx @@ -25,6 +25,7 @@ #include <general.h> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <rtl/ustring.hxx> #include <fwidllapi.h> @@ -65,7 +66,7 @@ class FWI_DLLPUBLIC ConfigAccess : public ThreadHelpBase reference to the uno service manager It's neccessary to instanciate own needed services. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /** hold an opened configuration alive */ css::uno::Reference< css::uno::XInterface > m_xConfig; @@ -81,8 +82,8 @@ class FWI_DLLPUBLIC ConfigAccess : public ThreadHelpBase public: - ConfigAccess( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const ::rtl::OUString& sRoot ); + ConfigAccess( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const ::rtl::OUString& sRoot ); virtual ~ConfigAccess(); virtual void open ( EOpenMode eMode ); diff --git a/framework/inc/jobs/helponstartup.hxx b/framework/inc/jobs/helponstartup.hxx index 86967201db69..4111c98bbae0 100644 --- a/framework/inc/jobs/helponstartup.hxx +++ b/framework/inc/jobs/helponstartup.hxx @@ -31,7 +31,7 @@ #include <com/sun/star/task/XJob.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> namespace framework{ @@ -57,7 +57,7 @@ class HelpOnStartup : private ThreadHelpBase //....................................... /** @short such module manager is used to classify new opened documents. */ - css::uno::Reference< css::frame::XModuleManager > m_xModuleManager; + css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager; //....................................... /** @short is needed to locate a might open help frame. */ diff --git a/framework/inc/jobs/jobdata.hxx b/framework/inc/jobs/jobdata.hxx index acb107d9d8ac..5ca4691abb12 100644 --- a/framework/inc/jobs/jobdata.hxx +++ b/framework/inc/jobs/jobdata.hxx @@ -28,6 +28,7 @@ #include <general.h> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/frame/DispatchResultEvent.hpp> @@ -152,7 +153,7 @@ class JobData : private ThreadHelpBase We need it for creating of own uno services ... e.g. for opening the configuration. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /** An instance of this class can be used in two different modes: @@ -224,7 +225,7 @@ class JobData : private ThreadHelpBase public: - JobData( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + JobData( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); JobData( const JobData& rCopy ); virtual ~JobData( ); @@ -250,10 +251,10 @@ class JobData : private ThreadHelpBase void setResult ( const JobResult& aResult ); void disableJob ( ); - static css::uno::Sequence< ::rtl::OUString > getEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const ::rtl::OUString& sEvent ); + static css::uno::Sequence< ::rtl::OUString > getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const ::rtl::OUString& sEvent ); - static void appendEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + static void appendEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const ::rtl::OUString& sEvent , ::comphelper::SequenceAsVector< JobData::TJob2DocEventBinding >& lJobs ); diff --git a/framework/inc/jobs/jobexecutor.hxx b/framework/inc/jobs/jobexecutor.hxx index a0ab8f387fac..4b0f70f149c1 100644 --- a/framework/inc/jobs/jobexecutor.hxx +++ b/framework/inc/jobs/jobexecutor.hxx @@ -44,7 +44,7 @@ #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/document/XEventListener.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> @@ -77,7 +77,7 @@ class JobExecutor : public css::lang::XTypeProvider css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; /** reference to the module info service */ - css::uno::Reference< css::frame::XModuleManager > m_xModuleManager; + css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager; /** cached list of all registered event names of cfg for call optimization. */ OUStringList m_lEvents; diff --git a/framework/inc/macros/xserviceinfo.hxx b/framework/inc/macros/xserviceinfo.hxx index bcca5c25f6a0..6197bd3cec98 100644 --- a/framework/inc/macros/xserviceinfo.hxx +++ b/framework/inc/macros/xserviceinfo.hxx @@ -225,6 +225,10 @@ ________________________________________________________________________________ PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ PRIVATE_DEFINE_SINGLEFACTORY( CLASS ) +#define DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS ) + //***************************************************************************************************************** // public // implementation of service initialize! diff --git a/framework/inc/services.h b/framework/inc/services.h index 70956ec6d9e4..e32de32c1ed3 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -34,34 +34,23 @@ namespace framework{ #define SERVICENAME_FRAMELOADERFACTORY DECLARE_ASCII("com.sun.star.frame.FrameLoaderFactory" ) #define SERVICENAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.document.FilterFactory" ) #define SERVICENAME_PLUGINFRAME DECLARE_ASCII("com.sun.star.mozilla.Plugin" ) -#define SERVICENAME_BRIDGEFACTORY DECLARE_ASCII("com.sun.star.bridge.BridgeFactory" ) -#define SERVICENAME_MEDIATYPEDETECTIONHELPER DECLARE_ASCII("com.sun.star.frame.MediaTypeDetectionHelper" ) #define SERVICENAME_LOGINDIALOG DECLARE_ASCII("com.sun.star.framework.LoginDialog" ) #define SERVICENAME_CONFIGURATION DECLARE_ASCII("com.sun.star.configuration.ConfigurationRegistry" ) -#define SERVICENAME_VCLTOOLKIT DECLARE_ASCII("com.sun.star.awt.Toolkit" ) #define SERVICENAME_SIMPLEREGISTRY DECLARE_ASCII("com.sun.star.registry.SimpleRegistry" ) #define SERVICENAME_NESTEDREGISTRY DECLARE_ASCII("com.sun.star.registry.NestedRegistry" ) #define SERVICENAME_GENERICFRAMELOADER DECLARE_ASCII("com.sun.star.comp.office.FilterDetect" ) #define SERVICENAME_TYPEDETECTION DECLARE_ASCII("com.sun.star.document.TypeDetection" ) -#define SERVICENAME_DOCUMENTPROPERTIES DECLARE_ASCII("com.sun.star.document.DocumentProperties" ) #define SERVICENAME_CFGREGISTRY DECLARE_ASCII("com.sun.star.configuration.ConfigurationRegistry" ) // describe simple registry service for read access to configuration -#define SERVICENAME_CFGPROVIDER DECLARE_ASCII("com.sun.star.configuration.ConfigurationProvider" ) // describe cfg-provider service for fatoffice, network installation #define SERVICENAME_ADMINPROVIDER DECLARE_ASCII("com.sun.star.configuration.AdministrationProvider" ) // describe cfg-provider service for sun webtop #define SERVICENAME_CFGUPDATEACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationUpdateAccess") // provides read/write access to the configuration #define SERVICENAME_CFGREADACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationAccess" ) // provides readonly access to the configuration #define SERVICENAME_CONTENTHANDLER DECLARE_ASCII("com.sun.star.frame.ContentHandler" ) #define SERVICENAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.frame.ContentHandlerFactory" ) #define SERVICENAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.task.StatusIndicatorFactory" ) -#define SERVICENAME_UIINTERACTIONHANDLER DECLARE_ASCII("com.sun.star.task.InteractionHandler" ) -#define SERVICENAME_JOBEXECUTOR DECLARE_ASCII("com.sun.star.task.JobExecutor" ) #define SERVICENAME_JOB DECLARE_ASCII("com.sun.star.task.Job" ) -#define SERVICENAME_DISPATCHRECORDERSUPPLIER DECLARE_ASCII("com.sun.star.frame.DispatchRecorderSupplier" ) #define SERVICENAME_DISPATCHRECORDER DECLARE_ASCII("com.sun.star.frame.DispatchRecorder" ) -#define SERVICENAME_SYSTEMSHELLEXECUTE DECLARE_ASCII("com.sun.star.system.SystemShellExecute" ) #define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" ) -#define SERVICENAME_SUBSTITUTEPATHVARIABLES DECLARE_ASCII("com.sun.star.util.PathSubstitution" ) #define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" ) -#define SERVICENAME_DISPATCHHELPER DECLARE_ASCII("com.sun.star.frame.DispatchHelper" ) #define SERVICENAME_DETECTORFACTORY DECLARE_ASCII("com.sun.star.document.ExtendedTypeDetectionFactory" ) #define SERVICENAME_SCRIPTCONVERTER DECLARE_ASCII("com.sun.star.script.Converter" ) #define SERVICENAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.frame.LayoutManager" ) @@ -69,7 +58,6 @@ namespace framework{ #define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" ) #define SERVICENAME_UICOMMANDDESCRIPTION DECLARE_ASCII("com.sun.star.frame.UICommandDescription" ) #define SERVICENAME_UIELEMENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.UIElementFactoryManager" ) -#define SERVICENAME_MODULEMANAGER DECLARE_ASCII("com.sun.star.frame.ModuleManager" ) #define SERVICENAME_UICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.UIConfigurationManager" ) #define SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) #define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" ) @@ -80,16 +68,12 @@ namespace framework{ #define SERVICENAME_GLOBALACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.GlobalAcceleratorConfiguration") #define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration") #define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration") -#define SERVICENAME_SAXWRITER DECLARE_ASCII("com.sun.star.xml.sax.Writer" ) #define SERVICENAME_STORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.StorageFactory" ) #define SERVICENAME_FILESYSTEMSTORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.FileSystemStorageFactory" ) -#define SERVICENAME_TEMPFILE DECLARE_ASCII("com.sun.star.io.TempFile" ) #define SERVICENAME_PACKAGESTRUCTURECREATOR DECLARE_ASCII("com.sun.star.embed.PackageStructureCreator" ) #define SERVICENAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.ui.ToolBarFactory" ) #define SERVICENAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.ToolBarControllerFactory" ) #define SERVICENAME_LICENSE SERVICENAME_JOB -#define SERVICENAME_AUTORECOVERY DECLARE_ASCII("com.sun.star.frame.AutoRecovery" ) -#define SERVICENAME_GLOBALEVENTBROADCASTER DECLARE_ASCII("com.sun.star.frame.GlobalEventBroadcaster" ) #define SERVICENAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.ui.StatusBarFactory" ) #define SERVICENAME_UICATEGORYDESCRIPTION DECLARE_ASCII("com.sun.star.ui.UICategoryDescription" ) #define SERVICENAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.StatusbarControllerFactory" ) diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx index 9f7c61c681c8..94347a0050ab 100644 --- a/framework/inc/services/autorecovery.hxx +++ b/framework/inc/services/autorecovery.hxx @@ -40,6 +40,7 @@ #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/GlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/document/XEventListener.hpp> @@ -344,7 +345,7 @@ class AutoRecovery : public css::lang::XTypeProvider /** @short holds the global event broadcaster alive, where we listen for new created documents. */ - css::uno::Reference< css::document::XEventBroadcaster > m_xNewDocBroadcaster; + css::uno::Reference< css::frame::XGlobalEventBroadcaster > m_xNewDocBroadcaster; //--------------------------------------- /** @short proxy weak binding to forward Events to ourself without diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index a757f261410c..3ff6ea106a9b 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -56,7 +56,7 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/frame/XFrameActionListener.hpp> #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/util/XURLTransformer.hpp> @@ -325,7 +325,7 @@ namespace framework UIElement m_aStatusBarElement; UIElement m_aProgressBarElement; com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xProgressBarBackup; - css::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + css::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; css::uno::Reference< ::com::sun::star::ui::XUIElementFactory > m_xUIElementFactoryManager; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowStateSupplier; diff --git a/framework/inc/services/license.hxx b/framework/inc/services/license.hxx index b0bb81f11f06..399b07ce6e24 100644 --- a/framework/inc/services/license.hxx +++ b/framework/inc/services/license.hxx @@ -69,10 +69,10 @@ namespace framework public ::cppu::OWeakObject // => XWeak, XInterface { private: - css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + css::uno::Reference< css::uno::XComponentContext > m_xContext; sal_Bool m_bTerminate; public: - License( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMGR ); + License( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); virtual ~License(); /** declaration of XInterface, XTypeProvider, XServiceInfo */ diff --git a/framework/inc/tabwin/tabwinfactory.hxx b/framework/inc/tabwin/tabwinfactory.hxx index a594b2a548a3..fb08f20aafbb 100644 --- a/framework/inc/tabwin/tabwinfactory.hxx +++ b/framework/inc/tabwin/tabwinfactory.hxx @@ -33,7 +33,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleComponentFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/XToolkit2.hpp> #include <cppuhelper/implbase2.hxx> #include <rtl/ustring.hxx> @@ -57,7 +57,7 @@ class TabWinFactory : protected ThreadHelpBase private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > m_xToolkit; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit2 > m_xToolkit; }; } diff --git a/framework/inc/uiconfiguration/globalsettings.hxx b/framework/inc/uiconfiguration/globalsettings.hxx index 49f39b1f3ca7..3b253d8100f0 100644 --- a/framework/inc/uiconfiguration/globalsettings.hxx +++ b/framework/inc/uiconfiguration/globalsettings.hxx @@ -47,7 +47,7 @@ namespace framework class GlobalSettings { public: - GlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSrvMgr ); + GlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); ~GlobalSettings(); enum UIElementType @@ -72,7 +72,7 @@ class GlobalSettings GlobalSettings(const GlobalSettings&); GlobalSettings& operator=(const GlobalSettings& ); - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSrvMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; }; } // namespace framework diff --git a/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx b/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx index 208c6308669d..4961ca8ad812 100644 --- a/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx +++ b/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx @@ -49,7 +49,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/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> @@ -102,7 +102,7 @@ namespace framework com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDefaultCfgRootStorage; com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserCfgRootStorage; com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit; - com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleMgr; + com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleMgr; com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener }; diff --git a/framework/inc/uiconfiguration/uicategorydescription.hxx b/framework/inc/uiconfiguration/uicategorydescription.hxx index 028452fb300b..bb3e73660f5b 100644 --- a/framework/inc/uiconfiguration/uicategorydescription.hxx +++ b/framework/inc/uiconfiguration/uicategorydescription.hxx @@ -43,7 +43,7 @@ namespace framework class UICategoryDescription : public UICommandDescription { public: - UICategoryDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + UICategoryDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~UICategoryDescription(); DECLARE_XSERVICEINFO diff --git a/framework/inc/uiconfiguration/windowstateconfiguration.hxx b/framework/inc/uiconfiguration/windowstateconfiguration.hxx index fbf1b20e6a75..d254d8d4005d 100644 --- a/framework/inc/uiconfiguration/windowstateconfiguration.hxx +++ b/framework/inc/uiconfiguration/windowstateconfiguration.hxx @@ -46,7 +46,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <cppuhelper/implbase2.hxx> #include <rtl/ustring.hxx> @@ -75,7 +75,7 @@ class WindowStateConfiguration : private ThreadHelpBase public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess, css::lang::XServiceInfo> { public: - WindowStateConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + WindowStateConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~WindowStateConfiguration(); // XInterface, XTypeProvider, XServiceInfo @@ -110,10 +110,10 @@ class WindowStateConfiguration : private ThreadHelpBase ::std::equal_to< ::rtl::OUString > > ModuleToWindowStateConfigHashMap; private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext; ModuleToWindowStateFileMap m_aModuleToFileHashMap; ModuleToWindowStateConfigHashMap m_aModuleToWindowStateHashMap; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; }; } // namespace framework diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx index 8c5984ecc057..9f14a97c1875 100644 --- a/framework/inc/uielement/uicommanddescription.hxx +++ b/framework/inc/uielement/uicommanddescription.hxx @@ -45,8 +45,9 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <cppuhelper/implbase2.hxx> #include <rtl/ustring.hxx> @@ -58,7 +59,7 @@ class UICommandDescription : private ThreadHelpBase , com::sun::star::container::XNameAccess > { public: - UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~UICommandDescription(); // XInterface, XTypeProvider, XServiceInfo @@ -92,16 +93,16 @@ public: ::std::equal_to< ::rtl::OUString > > UICommandsHashMap; protected: - UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); + UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& rxContext, bool ); virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > impl_createConfigAccess(const ::rtl::OUString& _sName); void impl_fillElements(const sal_Char* _pName); sal_Bool m_bConfigRead; rtl::OUString m_aPrivateResourceURL; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ModuleToCommandFileMap m_aModuleToCommandFileMap; UICommandsHashMap m_aUICommandsHashMap; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xGenericUICommands; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; }; } // namespace framework diff --git a/framework/inc/uifactory/addonstoolboxfactory.hxx b/framework/inc/uifactory/addonstoolboxfactory.hxx index 43097aa46119..d05f11c17c5f 100644 --- a/framework/inc/uifactory/addonstoolboxfactory.hxx +++ b/framework/inc/uifactory/addonstoolboxfactory.hxx @@ -33,7 +33,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -62,7 +62,7 @@ class AddonsToolBoxFactory : protected ThreadHelpBase private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; }; } diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx index d055fd6ee87e..9a2658c93cde 100644 --- a/framework/inc/uifactory/factoryconfiguration.hxx +++ b/framework/inc/uifactory/factoryconfiguration.hxx @@ -60,7 +60,7 @@ class ConfigurationAccess_ControllerFactory : // interfaces public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener> { public: - ConfigurationAccess_ControllerFactory( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue = false ); + ConfigurationAccess_ControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::rtl::OUString& _sRoot,bool _bAskValue = false ); virtual ~ConfigurationAccess_ControllerFactory(); void readConfigurationData(); @@ -107,7 +107,6 @@ private: rtl::OUString m_aPropValue; rtl::OUString m_sRoot; MenuControllerMap m_aMenuControllerMap; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess; ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xConfigAccessListener; diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx index 135e6bad6c3f..d34025eb99fe 100644 --- a/framework/inc/uifactory/menubarfactory.hxx +++ b/framework/inc/uifactory/menubarfactory.hxx @@ -32,7 +32,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/implbase2.hxx> @@ -59,14 +59,14 @@ namespace framework ,const char* _pExtraMode ,const char* _pAsciiName ,const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar - ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager >& _xModuleManager + ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager); protected: MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; }; } diff --git a/framework/inc/uifactory/uielementfactorymanager.hxx b/framework/inc/uifactory/uielementfactorymanager.hxx index 99dc12f2a525..1f403e88e8b2 100644 --- a/framework/inc/uifactory/uielementfactorymanager.hxx +++ b/framework/inc/uifactory/uielementfactorymanager.hxx @@ -47,7 +47,7 @@ #include <com/sun/star/ui/XUIElementFactoryRegistration.hpp> #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include "com/sun/star/frame/XModuleManager.hpp" +#include "com/sun/star/frame/XModuleManager2.hpp" #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase3.hxx> @@ -63,7 +63,7 @@ namespace framework public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener> { public: - ConfigurationAccess_FactoryManager( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot ); + ConfigurationAccess_FactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& rxContext, const ::rtl::OUString& _sRoot ); virtual ~ConfigurationAccess_FactoryManager(); void readConfigurationData(); @@ -101,7 +101,6 @@ namespace framework rtl::OUString m_aPropFactory; ::rtl::OUString m_sRoot; FactoryManagerMap m_aFactoryManagerMap; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess; ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xConfigListener; @@ -115,7 +114,7 @@ class UIElementFactoryManager : private ThreadHelpBase ::com::sun::star::ui::XUIElementFactoryRegistration> { public: - UIElementFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + UIElementFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~UIElementFactoryManager(); // XInterface, XTypeProvider, XServiceInfo @@ -133,8 +132,8 @@ class UIElementFactoryManager : private ThreadHelpBase private: sal_Bool m_bConfigRead; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; ConfigurationAccess_FactoryManager* m_pConfigAccess; }; diff --git a/framework/inc/uifactory/windowcontentfactorymanager.hxx b/framework/inc/uifactory/windowcontentfactorymanager.hxx index 4711c1fa9120..c189218a32a3 100644 --- a/framework/inc/uifactory/windowcontentfactorymanager.hxx +++ b/framework/inc/uifactory/windowcontentfactorymanager.hxx @@ -35,7 +35,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include "com/sun/star/frame/XModuleManager.hpp" +#include "com/sun/star/frame/XModuleManager2.hpp" #include <cppuhelper/implbase2.hxx> #include <rtl/ustring.hxx> @@ -49,7 +49,7 @@ class WindowContentFactoryManager : private ThreadHelpBase com::sun::star::lang::XSingleComponentFactory> { public: - WindowContentFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + WindowContentFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& rxContext ); virtual ~WindowContentFactoryManager(); // XInterface, XTypeProvider, XServiceInfo @@ -63,8 +63,7 @@ class WindowContentFactoryManager : private ThreadHelpBase private: sal_Bool m_bConfigRead; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; ConfigurationAccess_FactoryManager* m_pConfigAccess; }; diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx index eda31f41571b..d08c3b1cd585 100644 --- a/framework/inc/xml/imagesconfiguration.hxx +++ b/framework/inc/xml/imagesconfiguration.hxx @@ -106,7 +106,7 @@ class ImagesConfiguration ImageListsDescriptor& rItems ); static sal_Bool StoreImages( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, const ImageListsDescriptor& rItems ); }; diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index fa010e7d55bb..7ed41e9fd57e 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/xml/sax/Parser.hpp> #include <com/sun/star/xml/sax/InputSource.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/io/XSeekable.hpp> @@ -562,12 +563,12 @@ void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< c xSeek->seek(0); // combine writer/cache/stream etcpp. - css::uno::Reference< css::xml::sax::XDocumentHandler > xWriter (xSMGR->createInstance(SERVICENAME_SAXWRITER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::io::XActiveDataSource> xDataSource(xWriter , css::uno::UNO_QUERY_THROW); - xDataSource->setOutputStream(xStream); + css::uno::Reference< css::xml::sax::XWriter > xWriter = css::xml::sax::Writer::create(comphelper::getComponentContext(xSMGR)); + xWriter->setOutputStream(xStream); // write into the stream - AcceleratorConfigurationWriter aWriter(aCache, xWriter); + css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler(xWriter, css::uno::UNO_QUERY_THROW); + AcceleratorConfigurationWriter aWriter(aCache, xHandler); aWriter.flush(); // take over all changes into the original container @@ -623,7 +624,7 @@ AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteA aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, + css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig( comphelper::getComponentContext(xSMGR), "/org.openoffice.Setup", "L10N", fpc::ConfigurationHelper::E_READONLY); css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW); ::rtl::OUString sISOLocale; @@ -670,7 +671,7 @@ XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::un { const ::rtl::OUString CFG_ENTRY_ACCELERATORS("org.openoffice.Office.Accelerators"); m_xCfg = css::uno::Reference< css::container::XNameAccess > ( - ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), + ::comphelper::ConfigurationHelper::openConfig( comphelper::getComponentContext(m_xSMGR), CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), css::uno::UNO_QUERY ); } @@ -1111,12 +1112,12 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::R if (xSeek.is()) xSeek->seek(0); - css::uno::Reference< css::xml::sax::XDocumentHandler > xWriter (m_xSMGR->createInstance(SERVICENAME_SAXWRITER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::io::XActiveDataSource> xDataSource(xWriter , css::uno::UNO_QUERY_THROW); - xDataSource->setOutputStream(xOut); + css::uno::Reference< css::xml::sax::XWriter > xWriter = css::xml::sax::Writer::create(comphelper::getComponentContext(m_xSMGR)); + xWriter->setOutputStream(xOut); // write into the stream - AcceleratorConfigurationWriter aWriter(aCache, xWriter); + css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler(xWriter, css::uno::UNO_QUERY_THROW); + AcceleratorConfigurationWriter aWriter(aCache, xHandler); aWriter.flush(); } @@ -1172,14 +1173,14 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::reset() if ( sConfig == "Global" ) { m_xCfg = css::uno::Reference< css::container::XNameAccess > ( - ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_GLOBAL, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), + ::comphelper::ConfigurationHelper::openConfig( comphelper::getComponentContext(m_xSMGR), CFG_ENTRY_GLOBAL, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), css::uno::UNO_QUERY ); XCUBasedAcceleratorConfiguration::reload(); } else if ( sConfig == "Modules" ) { m_xCfg = css::uno::Reference< css::container::XNameAccess > ( - ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_MODULES, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), + ::comphelper::ConfigurationHelper::openConfig( comphelper::getComponentContext(m_xSMGR), CFG_ENTRY_MODULES, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), css::uno::UNO_QUERY ); XCUBasedAcceleratorConfiguration::reload(); } @@ -1662,7 +1663,7 @@ AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPrefer aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, + css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig( comphelper::getComponentContext(xSMGR), "/org.openoffice.Setup", "L10N", fpc::ConfigurationHelper::E_READONLY); css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW); ::rtl::OUString sISOLocale; diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx index 147f5f4eeb50..c7d8689a6023 100644 --- a/framework/source/classes/taskcreator.cxx +++ b/framework/source/classes/taskcreator.cxx @@ -85,7 +85,8 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const ::rtl:: ( TargetHelper::matchSpecialTarget(sName, TargetHelper::E_DEFAULT) ) ) { - ::comphelper::ConfigurationHelper::readDirectKey(xSMGR, + ::comphelper::ConfigurationHelper::readDirectKey( + comphelper::getComponentContext(xSMGR), "org.openoffice.Office.TabBrowse", "TaskCreatorService", "ImplementationName", diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx index f570dd239d19..ebb0099f79c1 100644 --- a/framework/source/dispatch/dispatchprovider.cxx +++ b/framework/source/dispatch/dispatchprovider.cxx @@ -230,8 +230,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryDeskt // I.II) "_default" // This is a combination of search an empty task for recycling - or create a new one. //----------------------------------------------------------------------------------------------------- - else - if (sTargetFrameName==SPECIALTARGET_DEFAULT) + else if (sTargetFrameName==SPECIALTARGET_DEFAULT) { if (implts_isLoadableContent(aURL)) xDispatcher = implts_getOrCreateDispatchHelper( E_DEFAULTDISPATCHER, xDesktop ); @@ -246,12 +245,11 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryDeskt // Why is "top" here handled too? Because the desktop is the topest frame. Normaly it's superflous // to use this target - but we can handle it in the same manner then "_self". //----------------------------------------------------------------------------------------------------- - else - if ( - (sTargetFrameName==SPECIALTARGET_SELF) || - (sTargetFrameName==SPECIALTARGET_TOP ) || - (sTargetFrameName.isEmpty()) - ) + else if ( + (sTargetFrameName==SPECIALTARGET_SELF) || + (sTargetFrameName==SPECIALTARGET_TOP ) || + (sTargetFrameName.isEmpty()) + ) { xDispatcher = implts_searchProtocolHandler(aURL); } @@ -274,10 +272,9 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryDeskt css::uno::Reference< css::frame::XDispatchProvider > xProvider( xFoundFrame, css::uno::UNO_QUERY ); xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_SELF,0); } - else // if it couldn't be found - but creation was allowed // use special dispatcher for creatio or froward it to the browser - if (nSearchFlags & css::frame::FrameSearchFlag::CREATE) + else if (nSearchFlags & css::frame::FrameSearchFlag::CREATE) xDispatcher = implts_getOrCreateDispatchHelper( E_CREATEDISPATCHER, xDesktop, sTargetFrameName, nSearchFlags ); } @@ -324,8 +321,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrame // I.II) "_menubar" // Special mode on frame or task to receive the local menu. Not supported by findFrame() //----------------------------------------------------------------------------------------------------- - else - if (sTargetName==SPECIALTARGET_MENUBAR) + else if (sTargetName==SPECIALTARGET_MENUBAR) { xDispatcher = implts_getOrCreateDispatchHelper( E_MENUDISPATCHER, xFrame ); } @@ -335,8 +331,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrame // Special sub frame of a top frame only. Search or create it. ... OK it's currently a little bit HACKI. // Only the sfx (means the controller) can create it it. //----------------------------------------------------------------------------------------------------- - else - if (sTargetName==SPECIALTARGET_BEAMER) + else if (sTargetName==SPECIALTARGET_BEAMER) { css::uno::Reference< css::frame::XDispatchProvider > xBeamer( xFrame->findFrame( SPECIALTARGET_BEAMER, css::frame::FrameSearchFlag::CHILDREN | css::frame::FrameSearchFlag::SELF ), css::uno::UNO_QUERY ); if (xBeamer.is()) @@ -357,8 +352,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrame // I.V) "_parent" // Our parent frame (if it exist) should handle this URL. //----------------------------------------------------------------------------------------------------- - else - if (sTargetName==SPECIALTARGET_PARENT) + else if (sTargetName==SPECIALTARGET_PARENT) { css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY ); if (xParent.is()) @@ -371,8 +365,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrame // This request must be forwarded to any parent frame, till we reach a top frame. // If no parent exist, we can handle itself. //----------------------------------------------------------------------------------------------------- - else - if (sTargetName==SPECIALTARGET_TOP) + else if (sTargetName==SPECIALTARGET_TOP) { if (xFrame->isTop()) { @@ -398,11 +391,10 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrame // protocol handler. If this failed too - we check for a loadable content and in case of true // we load it into the frame by returning specilized dispatch object. //----------------------------------------------------------------------------------------------------- - else - if ( - (sTargetName==SPECIALTARGET_SELF) || - (sTargetName.isEmpty()) - ) + else if ( + (sTargetName==SPECIALTARGET_SELF) || + (sTargetName.isEmpty()) + ) { // There exist a hard coded interception for special URLs. if ( aURL.Complete == ".uno:CloseDoc" || aURL.Complete == ".uno:CloseWin" ) diff --git a/framework/source/dispatch/mailtodispatcher.cxx b/framework/source/dispatch/mailtodispatcher.cxx index 903e33ce695c..6555f3a885d5 100644 --- a/framework/source/dispatch/mailtodispatcher.cxx +++ b/framework/source/dispatch/mailtodispatcher.cxx @@ -31,7 +31,7 @@ #include <general.h> #include <services.h> -#include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> @@ -60,7 +60,7 @@ DEFINE_XTYPEPROVIDER_5(MailToDispatcher , css::frame::XNotifyingDispatch, css::frame::XDispatch ) -DEFINE_XSERVICEINFO_MULTISERVICE(MailToDispatcher , +DEFINE_XSERVICEINFO_MULTISERVICE_2(MailToDispatcher , ::cppu::OWeakObject , SERVICENAME_PROTOCOLHANDLER , IMPLEMENTATIONNAME_MAILTODISPATCHER) @@ -81,15 +81,15 @@ DEFINE_INIT_SERVICE(MailToDispatcher, @short standard ctor @descr These initialize a new instance of ths class with needed informations for work. - @param xFactory + @param rxContext reference to uno servicemanager for creation of new services */ -MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ) +MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) // Init baseclasses first : ThreadHelpBase( &Application::GetSolarMutex() ) , OWeakObject ( ) // Init member - , m_xFactory ( xFactory ) + , m_xContext ( rxContext ) { } @@ -101,7 +101,7 @@ MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::lang::XMulti */ MailToDispatcher::~MailToDispatcher() { - m_xFactory = NULL; + m_xContext = NULL; } //_________________________________________________________________________________________________________________ @@ -228,29 +228,27 @@ sal_Bool MailToDispatcher::implts_dispatch( const css::util::URL& { sal_Bool bSuccess = sal_False; - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory; + css::uno::Reference< css::uno::XComponentContext > xContext; /* SAFE */{ ReadGuard aReadLock( m_aLock ); - xFactory = m_xFactory; + xContext = m_xContext; /* SAFE */} - css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute( xFactory->createInstance(SERVICENAME_SYSTEMSHELLEXECUTE), css::uno::UNO_QUERY ); - if (xSystemShellExecute.is()) + css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute = css::system::SystemShellExecute::create( xContext ); + + try + { + // start mail client + // Because there is no notofocation about success - we use case of + // no detected exception as SUCCESS - FAILED otherwhise. + xSystemShellExecute->execute( aURL.Complete, ::rtl::OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY ); + bSuccess = sal_True; + } + catch (const css::lang::IllegalArgumentException&) + { + } + catch (const css::system::SystemShellExecuteException&) { - try - { - // start mail client - // Because there is no notofocation about success - we use case of - // no detected exception as SUCCESS - FAILED otherwhise. - xSystemShellExecute->execute( aURL.Complete, ::rtl::OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY ); - bSuccess = sal_True; - } - catch (const css::lang::IllegalArgumentException&) - { - } - catch (const css::system::SystemShellExecuteException&) - { - } } return bSuccess; diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx index f5661d4ed4d7..f13af3d85765 100644 --- a/framework/source/dispatch/menudispatcher.cxx +++ b/framework/source/dispatch/menudispatcher.cxx @@ -33,7 +33,6 @@ #include <services.h> #include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/awt/XToolkit.hpp> #include <com/sun/star/awt/WindowAttribute.hpp> #include <com/sun/star/awt/WindowDescriptor.hpp> #include <com/sun/star/awt/PosSize.hpp> diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx index 9e7b210900fc..37132b424b6f 100644 --- a/framework/source/dispatch/popupmenudispatcher.cxx +++ b/framework/source/dispatch/popupmenudispatcher.cxx @@ -34,7 +34,6 @@ #include <properties.h> #include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/awt/XToolkit.hpp> #include <com/sun/star/awt/WindowAttribute.hpp> #include <com/sun/star/awt/WindowDescriptor.hpp> #include <com/sun/star/awt/PosSize.hpp> @@ -43,7 +42,9 @@ #include <com/sun/star/lang/WrappedTargetException.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <comphelper/componentcontext.hxx> #include <ucbhelper/content.hxx> #include <osl/mutex.hxx> #include <rtl/ustrbuf.hxx> @@ -70,12 +71,12 @@ const sal_Int32 PROTOCOL_LENGTH = 19; // constructor //***************************************************************************************************************** PopupMenuDispatcher::PopupMenuDispatcher( - const uno::Reference< XMultiServiceFactory >& xFactory ) + const uno::Reference< XComponentContext >& xContext ) // Init baseclasses first : ThreadHelpBase ( &Application::GetSolarMutex() ) , OWeakObject ( ) // Init member - , m_xFactory ( xFactory ) + , m_xContext ( xContext ) , m_aListenerContainer ( m_aLock.getShareableOslMutex() ) , m_bAlreadyDisposed ( sal_False ) , m_bActivateListener ( sal_False ) @@ -116,10 +117,61 @@ DEFINE_XTYPEPROVIDER_7 ( PopupMenuDispatcher , XFrameActionListener ) -DEFINE_XSERVICEINFO_MULTISERVICE( PopupMenuDispatcher , - ::cppu::OWeakObject , - SERVICENAME_PROTOCOLHANDLER , - IMPLEMENTATIONNAME_POPUPMENUDISPATCHER ) +::rtl::OUString SAL_CALL PopupMenuDispatcher::getImplementationName() throw( css::uno::RuntimeException ) +{ + return impl_getStaticImplementationName(); +} + +sal_Bool SAL_CALL PopupMenuDispatcher::supportsService( const ::rtl::OUString& sServiceName ) + throw( css::uno::RuntimeException ) +{ + return ::comphelper::findValue(getSupportedServiceNames(), sServiceName, sal_True).getLength() != 0; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL PopupMenuDispatcher::getSupportedServiceNames() + throw( css::uno::RuntimeException ) +{ + return impl_getStaticSupportedServiceNames(); +} + +css::uno::Sequence< ::rtl::OUString > PopupMenuDispatcher::impl_getStaticSupportedServiceNames() +{ + css::uno::Sequence< ::rtl::OUString > seqServiceNames( 1 ); + seqServiceNames.getArray() [0] = SERVICENAME_PROTOCOLHANDLER; + return seqServiceNames; +} + +::rtl::OUString PopupMenuDispatcher::impl_getStaticImplementationName() +{ + return IMPLEMENTATIONNAME_POPUPMENUDISPATCHER; +} + +css::uno::Reference< css::uno::XInterface > +SAL_CALL PopupMenuDispatcher::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) +throw( css::uno::Exception ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework","Ocke.Janssen@sun.com",U2B(IMPLEMENTATIONNAME_POPUPMENUDISPATCHER).getStr()); + /* create new instance of service */ + PopupMenuDispatcher* pClass = new PopupMenuDispatcher( comphelper::getComponentContext(xServiceManager) ); + /* hold it alive by increasing his ref count!!! */ + css::uno::Reference< css::uno::XInterface > xService( static_cast< ::cppu::OWeakObject* >(pClass), css::uno::UNO_QUERY ); + /* initialize new service instance ... he can use his own refcount ... we hold it! */ + pClass->impl_initService(); + /* return new created service as reference */ + return xService; +} + +css::uno::Reference< css::lang::XSingleServiceFactory > +PopupMenuDispatcher::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) +{ + css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( + cppu::createSingleFactory ( xServiceManager, + PopupMenuDispatcher::impl_getStaticImplementationName() , + PopupMenuDispatcher::impl_createInstance , + PopupMenuDispatcher::impl_getStaticSupportedServiceNames() ) + ); + return xReturn; +} DEFINE_INIT_SERVICE(PopupMenuDispatcher, { @@ -333,7 +385,7 @@ SAL_CALL PopupMenuDispatcher::disposing( const EventObject& ) throw( RuntimeExce } // Forget our factory. - m_xFactory = uno::Reference< XMultiServiceFactory >(); + m_xContext = uno::Reference< XComponentContext >(); } } @@ -379,13 +431,7 @@ void PopupMenuDispatcher::impl_CreateUriRefFactory() { if ( !m_xUriRefFactory.is() ) { - rtl::OUString aUriRefFactoryService( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uri.UriReferenceFactory" )); - - m_xUriRefFactory = css::uno::Reference< css::uri::XUriReferenceFactory >( - m_xFactory->createInstance( aUriRefFactoryService ), - css::uno::UNO_QUERY); - + m_xUriRefFactory = css::uri::UriReferenceFactory::create( m_xContext ); } } diff --git a/framework/source/dispatch/systemexec.cxx b/framework/source/dispatch/systemexec.cxx index 4d67609b1406..1934552af98e 100644 --- a/framework/source/dispatch/systemexec.cxx +++ b/framework/source/dispatch/systemexec.cxx @@ -31,7 +31,7 @@ #include <general.h> #include <services.h> -#include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/util/PathSubstitution.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> @@ -63,7 +63,7 @@ DEFINE_XTYPEPROVIDER_5(SystemExec , css::frame::XNotifyingDispatch, css::frame::XDispatch ) -DEFINE_XSERVICEINFO_MULTISERVICE(SystemExec , +DEFINE_XSERVICEINFO_MULTISERVICE_2(SystemExec , ::cppu::OWeakObject , SERVICENAME_PROTOCOLHANDLER , IMPLEMENTATIONNAME_SYSTEMEXEC) @@ -80,12 +80,12 @@ DEFINE_INIT_SERVICE(SystemExec, //_________________________________________________________________________________________________________________ -SystemExec::SystemExec( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ) +SystemExec::SystemExec( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) // Init baseclasses first : ThreadHelpBase( &Application::GetSolarMutex() ) , OWeakObject ( ) // Init member - , m_xFactory ( xFactory ) + , m_xContext ( rxContext ) { } @@ -93,7 +93,7 @@ SystemExec::SystemExec( const css::uno::Reference< css::lang::XMultiServiceFacto SystemExec::~SystemExec() { - m_xFactory = NULL; + m_xContext = NULL; } //_________________________________________________________________________________________________________________ @@ -149,7 +149,7 @@ void SAL_CALL SystemExec::dispatchWithNotification( const css::util::URL& // SAFE -> ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE @@ -157,14 +157,11 @@ void SAL_CALL SystemExec::dispatchWithNotification( const css::util::URL& try { - css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getComponentContext(xFactory) ); css::uno::Reference< css::util::XStringSubstitution > xPathSubst( css::util::PathSubstitution::create(xContext) ); ::rtl::OUString sSystemURL = xPathSubst->substituteVariables(sSystemURLWithVariables, sal_True); // sal_True force an exception if unknown variables exists ! - css::uno::Reference< css::system::XSystemShellExecute > xShell( - xFactory->createInstance(SERVICENAME_SYSTEMSHELLEXECUTE), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::system::XSystemShellExecute > xShell = css::system::SystemShellExecute::create( xContext ); xShell->execute(sSystemURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY); impl_notifyResultListener(xListener, css::frame::DispatchResultState::SUCCESS); diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx index 5aee045c1de8..e22af2127f5f 100644 --- a/framework/source/fwe/classes/framelistanalyzer.cxx +++ b/framework/source/fwe/classes/framelistanalyzer.cxx @@ -36,7 +36,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <comphelper/processfactory.hxx> #include <vcl/svapp.hxx> @@ -132,10 +132,10 @@ void FrameListAnalyzer::impl_analyze() { try { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::frame::XModuleManager > xModuleMgr(xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext); ::rtl::OUString sModule = xModuleMgr->identify(m_xReferenceFrame); - m_bReferenceIsBacking = (sModule.equals(SERVICENAME_STARTMODULE)); + m_bReferenceIsBacking = sModule.equals(SERVICENAME_STARTMODULE); } catch(const css::frame::UnknownModuleException&) { @@ -207,8 +207,8 @@ void FrameListAnalyzer::impl_analyze() { try { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::frame::XModuleManager > xModuleMgr(xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext); ::rtl::OUString sModule = xModuleMgr->identify(xFrame); if (sModule.equals(SERVICENAME_STARTMODULE)) { diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index 1782d3404a86..03aedbde529e 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -32,7 +32,7 @@ #include <com/sun/star/frame/UntitledNumbersConst.hpp> #include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/document/XEventBroadcaster.hpp> #include <com/sun/star/beans/XMaterialHolder.hpp> @@ -50,9 +50,9 @@ namespace framework{ namespace css = ::com::sun::star; //----------------------------------------------- -TitleHelper::TitleHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +TitleHelper::TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext) : ::cppu::BaseMutex () - , m_xSMGR (xSMGR) + , m_xContext (rxContext) , m_xOwner () , m_xUntitledNumbers() , m_xSubTitle () @@ -558,24 +558,19 @@ void TitleHelper::impl_appendModuleName (::rtl::OUStringBuffer& sTitle) // SYNCHRONIZED -> ::osl::ResettableMutexGuard aLock(m_aMutex); - css::uno::Reference< css::uno::XInterface > xOwner = m_xOwner.get(); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XInterface > xOwner = m_xOwner.get(); + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aLock.clear (); // <- SYNCHRONIZED try { - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::container::XNameAccess > xConfig( - xModuleManager, - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create(xContext); const ::rtl::OUString sID = xModuleManager->identify(xOwner); - ::comphelper::SequenceAsHashMap lProps = xConfig->getByName (sID); + ::comphelper::SequenceAsHashMap lProps = xModuleManager->getByName (sID); const ::rtl::OUString sUIName = lProps.getUnpackedValueOrDefault (OFFICEFACTORY_PROPNAME_UINAME, ::rtl::OUString()); // An UIname property is an optional value ! diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx index c47e52d226aa..e5a59220ae61 100644 --- a/framework/source/fwe/xml/menuconfiguration.cxx +++ b/framework/source/fwe/xml/menuconfiguration.cxx @@ -37,6 +37,7 @@ #include <uielement/rootitemcontainer.hxx> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <comphelper/processfactory.hxx> @@ -129,17 +130,13 @@ void MenuConfiguration::StoreMenuBarConfigurationToXML( Reference< XOutputStream >& rOutputStream ) throw ( WrappedTargetException ) { - Reference< XDocumentHandler > xWriter; - - xWriter = Reference< XDocumentHandler >( m_rxServiceManager->createInstance( - SERVICENAME_SAXWRITER), UNO_QUERY) ; - - Reference< XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); - xDataSource->setOutputStream( rOutputStream ); + Reference< XWriter > xWriter = Writer::create(comphelper::getComponentContext(m_rxServiceManager)); + xWriter->setOutputStream( rOutputStream ); try { - OWriteMenuDocumentHandler aWriteMenuDocumentHandler( rMenuBarConfiguration, xWriter ); + Reference< XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW); + OWriteMenuDocumentHandler aWriteMenuDocumentHandler( rMenuBarConfiguration, xHandler ); aWriteMenuDocumentHandler.WriteMenuDocument(); } catch ( const RuntimeException& e ) diff --git a/framework/source/fwe/xml/statusbarconfiguration.cxx b/framework/source/fwe/xml/statusbarconfiguration.cxx index 2b24554f4485..521ad095eb6e 100644 --- a/framework/source/fwe/xml/statusbarconfiguration.cxx +++ b/framework/source/fwe/xml/statusbarconfiguration.cxx @@ -33,6 +33,7 @@ #include <services.h> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -50,26 +51,12 @@ using namespace ::com::sun::star::container; namespace framework { -static Reference< XParser > GetSaxParser( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext - ) -{ - return Parser::create( xContext ); -} - -static Reference< XDocumentHandler > GetSaxWriter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory - ) -{ - return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ; -} - sal_Bool StatusBarConfiguration::LoadStatusBar( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& xInputStream, const Reference< XIndexContainer >& rStatusbarConfiguration ) { - Reference< XParser > xParser( GetSaxParser( rxContext ) ); + Reference< XParser > xParser = Parser::create(rxContext); // connect stream to input stream to the parser InputSource aInputSource; @@ -102,17 +89,17 @@ sal_Bool StatusBarConfiguration::LoadStatusBar( } sal_Bool StatusBarConfiguration::StoreStatusBar( - const Reference< XMultiServiceFactory >& xServiceFactory, + const Reference< XComponentContext >& rxContext, const Reference< XOutputStream >& xOutputStream, const Reference< XIndexAccess >& rStatusbarConfiguration ) { - Reference< XDocumentHandler > xWriter( GetSaxWriter( xServiceFactory ) ); - Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); - xDataSource->setOutputStream( xOutputStream ); + Reference< XWriter > xWriter = Writer::create( rxContext ); + xWriter->setOutputStream( xOutputStream ); try { - OWriteStatusBarDocumentHandler aWriteStatusBarDocumentHandler( rStatusbarConfiguration, xWriter ); + Reference< XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW); + OWriteStatusBarDocumentHandler aWriteStatusBarDocumentHandler( rStatusbarConfiguration, xHandler ); aWriteStatusBarDocumentHandler.WriteStatusBarDocument(); return sal_True; } diff --git a/framework/source/fwe/xml/toolboxconfiguration.cxx b/framework/source/fwe/xml/toolboxconfiguration.cxx index dcc7d48d1c51..1fe48cb7b06e 100644 --- a/framework/source/fwe/xml/toolboxconfiguration.cxx +++ b/framework/source/fwe/xml/toolboxconfiguration.cxx @@ -33,6 +33,7 @@ #include <services.h> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -50,26 +51,12 @@ using namespace ::com::sun::star::container; namespace framework { -static Reference< XParser > GetSaxParser( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext - ) -{ - return Parser::create(rxContext); -} - -static Reference< XDocumentHandler > GetSaxWriter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory - ) -{ - return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ; -} - sal_Bool ToolBoxConfiguration::LoadToolBox( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rToolbarConfiguration ) { - Reference< XParser > xParser( GetSaxParser( rxContext ) ); + Reference< XParser > xParser = Parser::create(rxContext); // connect stream to input stream to the parser InputSource aInputSource; @@ -104,18 +91,17 @@ sal_Bool ToolBoxConfiguration::LoadToolBox( sal_Bool ToolBoxConfiguration::StoreToolBox( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rToolbarConfiguration ) { - Reference< XDocumentHandler > xWriter( GetSaxWriter( xServiceFactory ) ); - - Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); - xDataSource->setOutputStream( rOutputStream ); + Reference< XWriter > xWriter = Writer::create(rxContext); + xWriter->setOutputStream( rOutputStream ); try { - OWriteToolBoxDocumentHandler aWriteToolBoxDocumentHandler( rToolbarConfiguration, xWriter ); + Reference< XDocumentHandler > xHandler( xWriter, UNO_QUERY_THROW ); + OWriteToolBoxDocumentHandler aWriteToolBoxDocumentHandler( rToolbarConfiguration, xHandler ); aWriteToolBoxDocumentHandler.WriteToolBoxDocument(); return sal_True; } diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx index 3964826af56c..1706bd1e0863 100644 --- a/framework/source/fwi/helper/mischelper.cxx +++ b/framework/source/fwi/helper/mischelper.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/document/XDocumentLanguages.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <tools/debug.hxx> @@ -94,7 +94,7 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues if ( !_rIni ) { _rIni = sal_True; - Reference< XModuleManager > xModuleManager( _xServiceFactory->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(_xServiceFactory) ); try { diff --git a/framework/source/fwi/jobs/configaccess.cxx b/framework/source/fwi/jobs/configaccess.cxx index 1e23ed32e243..14d6e762b64c 100644 --- a/framework/source/fwi/jobs/configaccess.cxx +++ b/framework/source/fwi/jobs/configaccess.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XMultiHierarchicalPropertySet.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/util/XChangesBatch.hpp> @@ -55,10 +56,10 @@ namespace framework{ @param eMode force opening of the configuration access in readonly or in read/write mode */ -ConfigAccess::ConfigAccess( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - /*IN*/ const ::rtl::OUString& sRoot ) +ConfigAccess::ConfigAccess( /*IN*/ const css::uno::Reference< css::uno::XComponentContext >& rxContext, + /*IN*/ const ::rtl::OUString& sRoot ) : ThreadHelpBase( ) - , m_xSMGR ( xSMGR ) + , m_xContext ( rxContext) , m_sRoot ( sRoot ) , m_eMode ( E_CLOSED ) { @@ -129,35 +130,32 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) close(); // create the configuration provider, which provides sub access points - css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider(m_xSMGR->createInstance(SERVICENAME_CFGPROVIDER), css::uno::UNO_QUERY); - if (xConfigProvider.is()) + css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider = css::configuration::theDefaultProvider::get(m_xContext); + css::beans::PropertyValue aParam; + aParam.Name = DECLARE_ASCII("nodepath"); + aParam.Value <<= m_sRoot; + + css::uno::Sequence< css::uno::Any > lParams(1); + lParams[0] <<= aParam; + + // open it + try { - css::beans::PropertyValue aParam; - aParam.Name = DECLARE_ASCII("nodepath"); - aParam.Value <<= m_sRoot; - - css::uno::Sequence< css::uno::Any > lParams(1); - lParams[0] <<= aParam; - - // open it - try - { - if (eMode==E_READONLY) - m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS , lParams); - else - if (eMode==E_READWRITE) - m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGUPDATEACCESS, lParams); - } - catch(const css::uno::Exception& ex) - { - (void) ex; // avoid warning - LOG_WARNING("open config ...", U2B(ex.Message)) - } - - m_eMode = E_CLOSED; - if (m_xConfig.is()) - m_eMode = eMode; + if (eMode==E_READONLY) + m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS , lParams); + else + if (eMode==E_READWRITE) + m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGUPDATEACCESS, lParams); } + catch(const css::uno::Exception& ex) + { + (void) ex; // avoid warning + LOG_WARNING("open config ...", U2B(ex.Message)) + } + + m_eMode = E_CLOSED; + if (m_xConfig.is()) + m_eMode = eMode; } aWriteLock.unlock(); diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index 206deaa1187b..26d6c2d121fe 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -37,8 +37,9 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> +#include <comphelper/processfactory.hxx> #include <comphelper/configurationhelper.hxx> #include <vcl/window.hxx> #include <vcl/syswin.hxx> @@ -118,7 +119,7 @@ void SAL_CALL PersistentWindowState::frameAction(const css::frame::FrameActionEv { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR ; + css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getComponentContext(m_xSMGR); css::uno::Reference< css::frame::XFrame > xFrame(m_xFrame.get(), css::uno::UNO_QUERY); sal_Bool bRestoreWindowState = !m_bWindowStateAlreadySet; aReadLock.unlock(); @@ -134,7 +135,7 @@ void SAL_CALL PersistentWindowState::frameAction(const css::frame::FrameActionEv return; // unknown module -> no configuration available! - ::rtl::OUString sModuleName = PersistentWindowState::implst_identifyModule(xSMGR, xFrame); + ::rtl::OUString sModuleName = PersistentWindowState::implst_identifyModule(xContext, xFrame); if (sModuleName.isEmpty()) return; @@ -144,7 +145,7 @@ void SAL_CALL PersistentWindowState::frameAction(const css::frame::FrameActionEv { if (bRestoreWindowState) { - ::rtl::OUString sWindowState = PersistentWindowState::implst_getWindowStateFromConfig(xSMGR, sModuleName); + ::rtl::OUString sWindowState = PersistentWindowState::implst_getWindowStateFromConfig(xContext, sModuleName); PersistentWindowState::implst_setWindowStateOnWindow(xWindow,sWindowState); // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); @@ -165,7 +166,7 @@ void SAL_CALL PersistentWindowState::frameAction(const css::frame::FrameActionEv case css::frame::FrameAction_COMPONENT_DETACHING : { ::rtl::OUString sWindowState = PersistentWindowState::implst_getWindowStateFromWindow(xWindow); - PersistentWindowState::implst_setWindowStateOnConfig(xSMGR, sModuleName, sWindowState); + PersistentWindowState::implst_setWindowStateOnConfig(xContext, sModuleName, sWindowState); } break; default: @@ -181,14 +182,13 @@ void SAL_CALL PersistentWindowState::disposing(const css::lang::EventObject&) } //***************************************************************************************************************** -::rtl::OUString PersistentWindowState::implst_identifyModule(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , +::rtl::OUString PersistentWindowState::implst_identifyModule(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& xFrame) { ::rtl::OUString sModuleName; - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create( rxContext ); try { @@ -203,8 +203,8 @@ void SAL_CALL PersistentWindowState::disposing(const css::lang::EventObject&) } //***************************************************************************************************************** -::rtl::OUString PersistentWindowState::implst_getWindowStateFromConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const ::rtl::OUString& sModuleName) +::rtl::OUString PersistentWindowState::implst_getWindowStateFromConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const ::rtl::OUString& sModuleName) { ::rtl::OUString sWindowState; @@ -219,7 +219,7 @@ void SAL_CALL PersistentWindowState::disposing(const css::lang::EventObject&) try { - ::comphelper::ConfigurationHelper::readDirectKey(xSMGR, + ::comphelper::ConfigurationHelper::readDirectKey(rxContext, sPackage, sRelPath, sKey, @@ -234,9 +234,9 @@ void SAL_CALL PersistentWindowState::disposing(const css::lang::EventObject&) } //***************************************************************************************************************** -void PersistentWindowState::implst_setWindowStateOnConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const ::rtl::OUString& sModuleName , - const ::rtl::OUString& sWindowState) +void PersistentWindowState::implst_setWindowStateOnConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const ::rtl::OUString& sModuleName , + const ::rtl::OUString& sWindowState) { ::rtl::OUStringBuffer sRelPathBuf(256); sRelPathBuf.appendAscii("Office/Factories/*[\""); @@ -249,7 +249,7 @@ void PersistentWindowState::implst_setWindowStateOnConfig(const css::uno::Refere try { - ::comphelper::ConfigurationHelper::writeDirectKey(xSMGR, + ::comphelper::ConfigurationHelper::writeDirectKey(rxContext, sPackage, sRelPath, sKey, diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index c24aabf68113..5a1ba9d822a9 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -420,7 +420,7 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed() { bool bForceFrontAndFocus(false); ::comphelper::ConfigurationHelper::readDirectKey( - xSMGR, + comphelper::getComponentContext(xSMGR), ::rtl::OUString("org.openoffice.Office.Common/View"), ::rtl::OUString("NewDocumentHandling"), ::rtl::OUString("ForceFocusAndToFront"), @@ -452,8 +452,7 @@ void StatusIndicatorFactory::impl_createProgress() VCLStatusIndicator* pVCLProgress = new VCLStatusIndicator(xSMGR, xWindow); xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pVCLProgress), css::uno::UNO_QUERY); } - else - if (xFrame.is()) + else if (xFrame.is()) { // use frame layouted progress implementation css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY); diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx index 2264a82ed545..9e702b002fb1 100644 --- a/framework/source/helper/titlebarupdate.cxx +++ b/framework/source/helper/titlebarupdate.cxx @@ -38,13 +38,14 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XMaterialHolder.hpp> #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> #include <unotools/configmgr.hxx> #include <unotools/bootstrap.hxx> @@ -175,13 +176,8 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr aReadLock.unlock(); // <- SYNCHRONIZED - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::container::XNameAccess > xConfig( - xModuleManager, - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create( comphelper::getComponentContext(xSMGR) ); rtl::OUString aModuleId = xModuleManager->identify(xFrame); rtl::OUString sDesktopName; @@ -248,16 +244,11 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr try { - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::container::XNameAccess > xConfig( - xModuleManager, - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create( comphelper::getComponentContext(xSMGR) ); - rInfo.sID = xModuleManager->identify(xFrame); - ::comphelper::SequenceAsHashMap lProps = xConfig->getByName (rInfo.sID); + rInfo.sID = xModuleManager->identify(xFrame); + ::comphelper::SequenceAsHashMap lProps = xModuleManager->getByName (rInfo.sID); rInfo.sUIName = lProps.getUnpackedValueOrDefault (OFFICEFACTORY_PROPNAME_UINAME, ::rtl::OUString()); rInfo.nIcon = lProps.getUnpackedValueOrDefault (OFFICEFACTORY_PROPNAME_ICON , INVALID_ICON_ID ); diff --git a/framework/source/inc/pattern/configuration.hxx b/framework/source/inc/pattern/configuration.hxx index f39d5922328b..3b346a3693f3 100644 --- a/framework/source/inc/pattern/configuration.hxx +++ b/framework/source/inc/pattern/configuration.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -80,7 +81,7 @@ class ConfigurationHelper @descr TODO - @param xSMGR + @param rxContext this method need an uno service manager for internal work. @param sPackage @@ -100,7 +101,7 @@ class ConfigurationHelper force opening of the configuration access in special mode. see enum EOpenMode for further informations. */ - static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const ::rtl::OUString& sPackage , const ::rtl::OUString& sRelPath , sal_Int32 nOpenFlags) @@ -109,8 +110,8 @@ class ConfigurationHelper try { - css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( - xSMGR->createInstance(SERVICENAME_CFGPROVIDER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider = + css::configuration::theDefaultProvider::get( rxContext ); ::rtl::OUStringBuffer sPath(1024); sPath.append(sPackage ); diff --git a/framework/source/jobs/helponstartup.cxx b/framework/source/jobs/helponstartup.cxx index 017cc4a140d9..a803db41a62b 100644 --- a/framework/source/jobs/helponstartup.cxx +++ b/framework/source/jobs/helponstartup.cxx @@ -46,6 +46,7 @@ //_______________________________________________ // include interfaces #include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/XDesktop.hpp> @@ -90,9 +91,8 @@ DEFINE_INIT_SERVICE(HelpOnStartup, see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations! */ // create some needed uno services and cache it - m_xModuleManager = css::uno::Reference< css::frame::XModuleManager >( - m_xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getComponentContext(m_xSMGR); + m_xModuleManager = css::frame::ModuleManager::create( xContext ); m_xDesktop = css::uno::Reference< css::frame::XFrame >( m_xSMGR->createInstance(SERVICENAME_DESKTOP), @@ -100,14 +100,14 @@ DEFINE_INIT_SERVICE(HelpOnStartup, m_xConfig = css::uno::Reference< css::container::XNameAccess >( ::comphelper::ConfigurationHelper::openConfig( - m_xSMGR, + xContext, CFG_PACKAGE_MODULES, ::comphelper::ConfigurationHelper::E_READONLY), css::uno::UNO_QUERY_THROW); // ask for office locale ::comphelper::ConfigurationHelper::readDirectKey( - m_xSMGR, + xContext, CFG_PACKAGE_SETUP, CFG_PATH_L10N, CFG_KEY_LOCALE, @@ -115,7 +115,7 @@ DEFINE_INIT_SERVICE(HelpOnStartup, // detect system ::comphelper::ConfigurationHelper::readDirectKey( - m_xSMGR, + xContext, CFG_PACKAGE_COMMON, CFG_PATH_HELP, CFG_KEY_HELPSYSTEM, @@ -252,13 +252,10 @@ void SAL_CALL HelpOnStartup::disposing(const css::lang::EventObject& aEvent) // Classify it. // SAFE -> ResetableGuard aLock(m_aLock); - css::uno::Reference< css::frame::XModuleManager > xModuleManager = m_xModuleManager; + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); // <- SAFE - if (!xModuleManager.is()) - return ::rtl::OUString(); - ::rtl::OUString sModuleId; try { diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx index cc881a4d424d..4c6bfee6f01f 100644 --- a/framework/source/jobs/job.cxx +++ b/framework/source/jobs/job.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <comphelper/processfactory.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/svapp.hxx> @@ -76,7 +77,7 @@ Job::Job( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& x /*IN*/ const css::uno::Reference< css::frame::XFrame >& xFrame ) : ThreadHelpBase (&Application::GetSolarMutex()) , ::cppu::OWeakObject ( ) - , m_aJobCfg (xSMGR ) + , m_aJobCfg (comphelper::getComponentContext(xSMGR)) , m_xSMGR (xSMGR ) , m_xFrame (xFrame ) , m_bListenOnDesktop (sal_False ) @@ -106,7 +107,7 @@ Job::Job( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& x /*IN*/ const css::uno::Reference< css::frame::XModel >& xModel ) : ThreadHelpBase (&Application::GetSolarMutex()) , ::cppu::OWeakObject ( ) - , m_aJobCfg (xSMGR ) + , m_aJobCfg (comphelper::getComponentContext(xSMGR)) , m_xSMGR (xSMGR ) , m_xModel (xModel ) , m_bListenOnDesktop (sal_False ) diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index 6195d0c18b31..fe1b1bd4e895 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -79,12 +79,12 @@ const sal_Char* JobData::PROP_CONTEXT = "Context" But for real working it's neccessary to call setAlias() or setService() later. Because we need the job data ... - @param xSMGR + @param rxContext reference to the uno service manager */ -JobData::JobData( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ) +JobData::JobData( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) : ThreadHelpBase(&Application::GetSolarMutex()) - , m_xSMGR (xSMGR ) + , m_xContext (rxContext ) { // share code for member initialization with defaults! impl_reset(); @@ -170,7 +170,7 @@ void JobData::setAlias( const ::rtl::OUString& sAlias ) ::rtl::OUString sKey(::rtl::OUString::createFromAscii(JOBCFG_ROOT)); sKey += ::utl::wrapConfigurationElementName(m_sAlias); - ConfigAccess aConfig(m_xSMGR, sKey); + ConfigAccess aConfig(m_xContext, sKey); aConfig.open(ConfigAccess::E_READONLY); if (aConfig.getMode()==ConfigAccess::E_CLOSED) { @@ -304,7 +304,7 @@ void JobData::setJobConfig( const css::uno::Sequence< css::beans::NamedValue >& ::rtl::OUString sKey(::rtl::OUString::createFromAscii(JOBCFG_ROOT)); sKey += ::utl::wrapConfigurationElementName(m_sAlias); - ConfigAccess aConfig(m_xSMGR, sKey); + ConfigAccess aConfig(m_xContext, sKey); aConfig.open(ConfigAccess::E_READWRITE); if (aConfig.getMode()==ConfigAccess::E_CLOSED) return; @@ -537,7 +537,7 @@ void JobData::disableJob() sKey.appendAscii("/" ); sKey.append (::utl::wrapConfigurationElementName(m_sAlias)); - ConfigAccess aConfig(m_xSMGR, sKey.makeStringAndClear()); + ConfigAccess aConfig(m_xContext, sKey.makeStringAndClear()); aConfig.open(ConfigAccess::E_READWRITE); if (aConfig.getMode()==ConfigAccess::E_CLOSED) return; @@ -585,11 +585,11 @@ sal_Bool isEnabled( const ::rtl::OUString& sAdminTime , //________________________________ /** */ -void JobData::appendEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , +void JobData::appendEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const ::rtl::OUString& sEvent , ::comphelper::SequenceAsVector< JobData::TJob2DocEventBinding >& lJobs ) { - css::uno::Sequence< ::rtl::OUString > lAdditionalJobs = JobData::getEnabledJobsForEvent(xSMGR, sEvent); + css::uno::Sequence< ::rtl::OUString > lAdditionalJobs = JobData::getEnabledJobsForEvent(rxContext, sEvent); sal_Int32 c = lAdditionalJobs.getLength(); sal_Int32 i = 0; @@ -627,8 +627,8 @@ sal_Bool JobData::hasCorrectContext(const ::rtl::OUString& rModuleIdent) const //________________________________ /** */ -css::uno::Sequence< ::rtl::OUString > JobData::getEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const ::rtl::OUString& sEvent ) +css::uno::Sequence< ::rtl::OUString > JobData::getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const ::rtl::OUString& sEvent ) { // these static values may perform following loop for reading time stamp values ... static ::rtl::OUString ADMINTIME = ::rtl::OUString::createFromAscii(JobData::EVENTCFG_PROP_ADMINTIME); @@ -637,7 +637,7 @@ css::uno::Sequence< ::rtl::OUString > JobData::getEnabledJobsForEvent( const css static ::rtl::OUString JOBLIST = ::rtl::OUString::createFromAscii(JobData::EVENTCFG_PATH_JOBLIST ); // create a config access to "/org.openoffice.Office.Jobs/Events" - ConfigAccess aConfig(xSMGR,ROOT); + ConfigAccess aConfig(rxContext,ROOT); aConfig.open(ConfigAccess::E_READONLY); if (aConfig.getMode()==ConfigAccess::E_CLOSED) return css::uno::Sequence< ::rtl::OUString >(); diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx index fd0b5eee53fd..03aeca373d91 100644 --- a/framework/source/jobs/jobdispatch.cxx +++ b/framework/source/jobs/jobdispatch.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <rtl/ustrbuf.hxx> #include <vcl/svapp.hxx> @@ -129,10 +129,8 @@ void SAL_CALL JobDispatch::initialize( const css::uno::Sequence< css::uno::Any > { lArguments[a] >>= m_xFrame; - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - m_xSMGR->createInstance( - SERVICENAME_MODULEMANAGER ), - css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create(comphelper::getComponentContext(m_xSMGR)); try { m_sModuleIdentifier = xModuleManager->identify( m_xFrame ); @@ -273,7 +271,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const ::rtl::OUString& // filter disabled jobs using it's time stamp values. /* SAFE { */ ReadGuard aReadLock(m_aLock); - css::uno::Sequence< ::rtl::OUString > lJobs = JobData::getEnabledJobsForEvent(m_xSMGR, sEvent); + css::uno::Sequence< ::rtl::OUString > lJobs = JobData::getEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), sEvent); aReadLock.unlock(); /* } SAFE */ @@ -290,7 +288,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const ::rtl::OUString& /* SAFE { */ aReadLock.lock(); - JobData aCfg(m_xSMGR); + JobData aCfg(comphelper::getComponentContext(m_xSMGR)); aCfg.setEvent(sEvent, lJobs[j]); aCfg.setEnvironment(JobData::E_DISPATCH); const bool bIsEnabled=aCfg.hasCorrectContext(m_sModuleIdentifier); @@ -354,7 +352,7 @@ void JobDispatch::impl_dispatchService( /*IN*/ const ::rtl::OUString& /* SAFE { */ ReadGuard aReadLock(m_aLock); - JobData aCfg(m_xSMGR); + JobData aCfg(comphelper::getComponentContext(m_xSMGR)); aCfg.setService(sService); aCfg.setEnvironment(JobData::E_DISPATCH); @@ -405,7 +403,7 @@ void JobDispatch::impl_dispatchAlias( /*IN*/ const ::rtl::OUString& /* SAFE { */ ReadGuard aReadLock(m_aLock); - JobData aCfg(m_xSMGR); + JobData aCfg(comphelper::getComponentContext(m_xSMGR)); aCfg.setAlias(sAlias); aCfg.setEnvironment(JobData::E_DISPATCH); diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx index 0963d58c50b7..e3e6c58c800b 100644 --- a/framework/source/jobs/jobexecutor.cxx +++ b/framework/source/jobs/jobexecutor.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <unotools/configpaths.hxx> #include <rtl/ustrbuf.hxx> @@ -72,16 +73,13 @@ DEFINE_XTYPEPROVIDER_6( JobExecutor , DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( JobExecutor , ::cppu::OWeakObject , - SERVICENAME_JOBEXECUTOR , + "com.sun.star.task.JobExecutor", IMPLEMENTATIONNAME_JOBEXECUTOR ) DEFINE_INIT_SERVICE( JobExecutor, { - m_xModuleManager = css::uno::Reference< css::frame::XModuleManager >( - m_xSMGR->createInstance( - SERVICENAME_MODULEMANAGER ), - css::uno::UNO_QUERY_THROW ); + m_xModuleManager = css::frame::ModuleManager::create( comphelper::getComponentContext(m_xSMGR) ); /*Attention I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance() @@ -128,7 +126,7 @@ JobExecutor::JobExecutor( /*IN*/ const css::uno::Reference< css::lang::XMultiSer , ::cppu::OWeakObject ( ) , m_xSMGR (xSMGR ) , m_xModuleManager ( ) - , m_aConfig (xSMGR, ::rtl::OUString::createFromAscii(JobData::EVENTCFG_ROOT) ) + , m_aConfig (comphelper::getComponentContext(xSMGR), ::rtl::OUString::createFromAscii(JobData::EVENTCFG_ROOT) ) { // Don't do any reference related code here! Do it inside special // impl_ method() ... see DEFINE_INIT_SERVICE() macro for further informations. @@ -168,7 +166,7 @@ void SAL_CALL JobExecutor::trigger( const ::rtl::OUString& sEvent ) throw(css::u // get list of all enabled jobs // The called static helper methods read it from the configuration and // filter disabled jobs using it's time stamp values. - css::uno::Sequence< ::rtl::OUString > lJobs = JobData::getEnabledJobsForEvent(m_xSMGR, sEvent); + css::uno::Sequence< ::rtl::OUString > lJobs = JobData::getEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), sEvent); aReadLock.unlock(); /* } SAFE */ @@ -180,7 +178,7 @@ void SAL_CALL JobExecutor::trigger( const ::rtl::OUString& sEvent ) throw(css::u /* SAFE { */ aReadLock.lock(); - JobData aCfg(m_xSMGR); + JobData aCfg(comphelper::getComponentContext(m_xSMGR)); aCfg.setEvent(sEvent, lJobs[j]); aCfg.setEnvironment(JobData::E_EXECUTION); @@ -237,7 +235,7 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent ) { if (m_lEvents.find(EVENT_ON_DOCUMENT_OPENED) != m_lEvents.end()) - JobData::appendEnabledJobsForEvent(m_xSMGR, EVENT_ON_DOCUMENT_OPENED, lJobs); + JobData::appendEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), EVENT_ON_DOCUMENT_OPENED, lJobs); } // Special feature: If the events "OnCreate" or "OnLoadFinished" occures - we generate our own event "onDocumentAdded". @@ -247,12 +245,12 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent ) { if (m_lEvents.find(EVENT_ON_DOCUMENT_ADDED) != m_lEvents.end()) - JobData::appendEnabledJobsForEvent(m_xSMGR, EVENT_ON_DOCUMENT_ADDED, lJobs); + JobData::appendEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), EVENT_ON_DOCUMENT_ADDED, lJobs); } // Add all jobs for "real" notified event too .-) if (m_lEvents.find(aEvent.EventName) != m_lEvents.end()) - JobData::appendEnabledJobsForEvent(m_xSMGR, aEvent.EventName, lJobs); + JobData::appendEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), aEvent.EventName, lJobs); aReadLock.unlock(); /* } SAFE */ @@ -268,7 +266,7 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent const JobData::TJob2DocEventBinding& rBinding = *pIt; - JobData aCfg(m_xSMGR); + JobData aCfg(comphelper::getComponentContext(m_xSMGR)); aCfg.setEvent(rBinding.m_sDocEvent, rBinding.m_sJobName); aCfg.setEnvironment(JobData::E_DOCUMENTEVENT); diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index 1f9a03742686..a954551c6db5 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -31,13 +31,15 @@ #include <services.h> #include <com/sun/star/ui/DockingArea.hpp> +#include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/XTopWindow.hpp> -#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/frame/DispatchHelper.hpp> #include <com/sun/star/awt/XDockableWindow.hpp> #include <com/sun/star/awt/XDockableWindowListener.hpp> #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/ui/XUIElement.hpp> +#include <comphelper/processfactory.hxx> #include <comphelper/mediadescriptor.hxx> #include <vcl/svapp.hxx> #include <toolkit/unohlp.hxx> @@ -169,29 +171,21 @@ bool lcl_checkUIElement(const uno::Reference< ui::XUIElement >& xUIElement, awt: return bRet; } -uno::Reference< awt::XWindowPeer > createToolkitWindow( const uno::Reference< lang::XMultiServiceFactory >& rFactory, const uno::Reference< awt::XWindowPeer >& rParent, const char* pService ) +uno::Reference< awt::XWindowPeer > createToolkitWindow( const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< awt::XWindowPeer >& rParent, const char* pService ) { - const rtl::OUString aAWTToolkit( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" )); + uno::Reference< awt::XToolkit2 > xToolkit = awt::Toolkit::create( rxContext ); - uno::Reference< awt::XWindowPeer > xPeer; - if ( rFactory.is() ) - { - uno::Reference< awt::XToolkit > xToolkit( rFactory->createInstance( aAWTToolkit ), uno::UNO_QUERY_THROW ); - if ( xToolkit.is() ) - { - // describe window properties. - css::awt::WindowDescriptor aDescriptor; - aDescriptor.Type = awt::WindowClass_SIMPLE; - aDescriptor.WindowServiceName = ::rtl::OUString::createFromAscii( pService ); - aDescriptor.ParentIndex = -1; - aDescriptor.Parent = uno::Reference< awt::XWindowPeer >( rParent, uno::UNO_QUERY ); - aDescriptor.Bounds = awt::Rectangle(0,0,0,0); - aDescriptor.WindowAttributes = 0; - - // create a awt window - xPeer = xToolkit->createWindow( aDescriptor ); - } - } + // describe window properties. + css::awt::WindowDescriptor aDescriptor; + aDescriptor.Type = awt::WindowClass_SIMPLE; + aDescriptor.WindowServiceName = ::rtl::OUString::createFromAscii( pService ); + aDescriptor.ParentIndex = -1; + aDescriptor.Parent = uno::Reference< awt::XWindowPeer >( rParent, uno::UNO_QUERY ); + aDescriptor.Bounds = awt::Rectangle(0,0,0,0); + aDescriptor.WindowAttributes = 0; + + // create a awt window + uno::Reference< awt::XWindowPeer > xPeer = xToolkit->createWindow( aDescriptor ); return xPeer; } @@ -314,10 +308,9 @@ sal_Bool implts_isFrameOrWindowTop( const uno::Reference< frame::XFrame >& xFram return sal_False; } -void impl_setDockingWindowVisibility( const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMGR, const css::uno::Reference< css::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ) +void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ) { const ::rtl::OUString aDockWinPrefixCommand( RTL_CONSTASCII_USTRINGPARAM( "DockingWindow" )); - css::uno::WeakReference< css::frame::XDispatchHelper > xDispatchHelper; sal_Int32 nID = rDockingWindowName.toInt32(); sal_Int32 nIndex = nID - DOCKWIN_ID_BASE; @@ -334,12 +327,7 @@ void impl_setDockingWindowVisibility( const css::uno::Reference< css::lang::XMul aArgs[0].Name = aDockWinArgName; aArgs[0].Value = css::uno::makeAny( bVisible ); - css::uno::Reference< css::frame::XDispatchHelper > xDispatcher( xDispatchHelper ); - if ( !xDispatcher.is()) - { - xDispatcher = css::uno::Reference< css::frame::XDispatchHelper >( - rSMGR->createInstance(SERVICENAME_DISPATCHHELPER), css::uno::UNO_QUERY_THROW); - } + css::uno::Reference< css::frame::XDispatchHelper > xDispatcher = css::frame::DispatchHelper::create( rxContext ); aDockWinCommand = aDockWinCommand + aDockWinArgName; xDispatcher->executeDispatch( diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx index 3d11ee5bc19f..e2e667c073f9 100644 --- a/framework/source/layoutmanager/helpers.hxx +++ b/framework/source/layoutmanager/helpers.hxx @@ -34,6 +34,8 @@ #include <properties.h> #include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/awt/XToolkit2.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/ui/XUIElement.hpp> @@ -66,7 +68,7 @@ SystemWindow* getTopSystemWindow( const ::com::sun::star::uno::Reference< ::com: bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectangle& rRect2 ); void setZeroRectangle( ::Rectangle& rRect ); bool lcl_checkUIElement(const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement,::com::sun::star::awt::Rectangle& _rPosSize, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xWindow); -::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rFactory, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent, const char* pService ); +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent, const char* pService ); WindowAlign ImplConvertAlignment( sal_Int16 aAlignment ); ::rtl::OUString getElementTypeFromResourceURL( const ::rtl::OUString& aResourceURL ); void parseResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName ); @@ -75,9 +77,9 @@ void parseResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aElemen ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > impl_getModelFromFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); sal_Bool implts_isPreviewModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); sal_Bool implts_isFrameOrWindowTop( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); -void impl_setDockingWindowVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& rSMGR, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ); +void impl_setDockingWindowVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ); void impl_addWindowListeners( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xThis, const ::com::sun::star::uno::Reference< css::ui::XUIElement >& xUIElement ); -::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > implts_createToolkitWindow( const css::uno::Reference< ::com::sun::star::awt::XToolkit >& rToolkit, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent ); +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > implts_createToolkitWindow( const css::uno::Reference< ::com::sun::star::awt::XToolkit2 >& rToolkit, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent ); } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 10094d988a33..b29960cca32d 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/FrameAction.hpp> #include <com/sun/star/frame/XUIControllerRegistration.hpp> @@ -62,7 +63,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/frame/LayoutManagerEvents.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/frame/DispatchHelper.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/util/URLTransformer.hpp> @@ -137,7 +138,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM , m_bPreserveContentSize( false ) , m_bMenuBarCloser( false ) , m_pInplaceMenuBar( NULL ) - , m_xModuleManager( Reference< XModuleManager >( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )) + , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) )) , m_xUIElementFactoryManager( Reference< ui::XUIElementFactory >( xServiceManager->createInstance( SERVICENAME_UIELEMENTFACTORYMANAGER ), UNO_QUERY )) , m_xPersistentWindowStateSupplier( Reference< XNameAccess >( @@ -163,7 +164,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM m_aStatusBarElement.m_aType = rtl::OUString( "statusbar" ); m_aStatusBarElement.m_aName = m_aStatusBarAlias; - m_pToolbarManager = new ToolbarLayoutManager( xServiceManager, m_xUIElementFactoryManager, this ); + m_pToolbarManager = new ToolbarLayoutManager( comphelper::getComponentContext(xServiceManager), m_xUIElementFactoryManager, this ); m_xToolbarManager = uno::Reference< ui::XUIConfigurationListener >( static_cast< OWeakObject* >( m_pToolbarManager ), uno::UNO_QUERY ); Application::AddEventListener( LINK( this, LayoutManager, SettingsChanged ) ); @@ -516,7 +517,7 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName, GlobalSettings* pGlobalSettings( 0 ); if ( m_pGlobalSettings == 0 ) { - m_pGlobalSettings = new GlobalSettings( m_xSMGR ); + m_pGlobalSettings = new GlobalSettings( comphelper::getComponentContext(m_xSMGR) ); bGetSettingsState = sal_True; } pGlobalSettings = m_pGlobalSettings; @@ -1638,7 +1639,7 @@ throw (RuntimeException) uno::Reference< lang::XMultiServiceFactory > xSMGR( m_xSMGR ); aWriteLock.unlock(); - impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false ); + impl_setDockingWindowVisibility( comphelper::getComponentContext(xSMGR), xFrame, aElementName, false ); bMustBeLayouted = false; bNotify = false; } @@ -1859,7 +1860,7 @@ throw (RuntimeException) uno::Reference< lang::XMultiServiceFactory > xSMGR( m_xSMGR ); aReadGuard.unlock(); - impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, true ); + impl_setDockingWindowVisibility( comphelper::getComponentContext(xSMGR), xFrame, aElementName, true ); } else if ( aElementType.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("toolpanel"))) { @@ -1949,7 +1950,7 @@ throw (RuntimeException) uno::Reference< lang::XMultiServiceFactory > xSMGR( m_xSMGR ); aReadGuard.unlock(); - impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false ); + impl_setDockingWindowVisibility( comphelper::getComponentContext(xSMGR), xFrame, aElementName, false ); } if ( bMustLayout ) @@ -2669,8 +2670,7 @@ IMPL_LINK_NOARG(LayoutManager, MenuBarClose) if ( !xProvider.is()) return 0; - uno::Reference< frame::XDispatchHelper > xDispatcher( - xSMGR->createInstance(SERVICENAME_DISPATCHHELPER), uno::UNO_QUERY_THROW); + uno::Reference< frame::XDispatchHelper > xDispatcher = frame::DispatchHelper::create( comphelper::getComponentContext( xSMGR ) ); xDispatcher->executeDispatch( xProvider, diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 179725afd338..2bb41fe93235 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -34,6 +34,7 @@ #include <uiconfiguration/windowstateconfiguration.hxx> #include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/container/XNameReplace.hpp> @@ -55,11 +56,11 @@ namespace framework { ToolbarLayoutManager::ToolbarLayoutManager( - const uno::Reference< lang::XMultiServiceFactory >& xSMGR, + const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< ui::XUIElementFactory >& xUIElementFactory, ILayoutNotifications* pParentLayouter ) : ThreadHelpBase( &Application::GetSolarMutex() ), - m_xSMGR( xSMGR ), + m_xContext( rxContext), m_xUIElementFactoryManager( xUIElementFactory ), m_pParentLayouter( pParentLayouter ), m_eDockOperation( DOCKOP_ON_COLROW ), @@ -82,7 +83,7 @@ ToolbarLayoutManager::ToolbarLayoutManager( setZeroRectangle( m_aDockingArea ); // create toolkit object - m_xToolkit = uno::Reference< awt::XToolkit >( m_xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), uno::UNO_QUERY ); + m_xToolkit = awt::Toolkit::create( m_xContext ); } ToolbarLayoutManager::~ToolbarLayoutManager() @@ -912,10 +913,10 @@ void ToolbarLayoutManager::setParentWindow( { static const char DOCKINGAREASTRING[] = "dockingarea"; - uno::Reference< awt::XWindow > xTopDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); - uno::Reference< awt::XWindow > xLeftDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); - uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); - uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xTopDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xLeftDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); WriteGuard aWriteLock( m_aLock ); m_xContainerWindow = uno::Reference< awt::XWindow2 >( xParentWindow, uno::UNO_QUERY ); @@ -1581,7 +1582,7 @@ sal_Bool ToolbarLayoutManager::implts_readWindowStateData( const rtl::OUString& GlobalSettings* pGlobalSettings( 0 ); if ( m_pGlobalSettings.get() == 0 ) { - m_pGlobalSettings.reset( new GlobalSettings( m_xSMGR ) ); + m_pGlobalSettings.reset( new GlobalSettings( m_xContext ) ); bGetSettingsState = true; } pGlobalSettings = m_pGlobalSettings.get(); diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx index 0f4d2b7ac212..1237c147de4b 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx @@ -63,6 +63,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> #include <com/sun/star/ui/DockingArea.hpp> +#include <com/sun/star/awt/XToolkit2.hpp> #include <com/sun/star/awt/XTopWindow2.hpp> #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/awt/XDockableWindow.hpp> @@ -89,7 +90,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a PREVIEWFRAME_YES }; - ToolbarLayoutManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMGR, + ToolbarLayoutManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElementFactory >& xUIElementFactory, ILayoutNotifications* pParentLayouter ); virtual ~ToolbarLayoutManager(); @@ -298,14 +299,14 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a //--------------------------------------------------------------------------------------------------------- // members //--------------------------------------------------------------------------------------------------------- - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::frame::XFrame > m_xFrame; css::uno::Reference< css::awt::XWindow2 > m_xContainerWindow; css::uno::Reference< css::awt::XWindow > m_xDockAreaWindows[DOCKINGAREAS_COUNT]; css::uno::Reference< ::com::sun::star::ui::XUIElementFactory > m_xUIElementFactoryManager; css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr; css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr; - css::uno::Reference< ::com::sun::star::awt::XToolkit > m_xToolkit; + css::uno::Reference< ::com::sun::star::awt::XToolkit2 > m_xToolkit; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; ILayoutNotifications* m_pParentLayouter; diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 799a48ddb587..fc5581312e04 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -952,7 +952,7 @@ sal_Bool LoadEnv::impl_furtherDocsAllowed() try { css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey( - xSMGR, + comphelper::getComponentContext(xSMGR), ::rtl::OUString("org.openoffice.Office.Common/"), ::rtl::OUString("Misc"), ::rtl::OUString("MaxOpenDocuments"), @@ -1690,7 +1690,7 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X { css::uno::Any const a = ::comphelper::ConfigurationHelper::readDirectKey( - xSMGR, + comphelper::getComponentContext(xSMGR), ::rtl::OUString("org.openoffice.Office.Common/View"), ::rtl::OUString("NewDocumentHandling"), ::rtl::OUString("ForceFocusAndToFront"), @@ -1770,7 +1770,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw // get access to the configuration of this office module css::uno::Reference< css::container::XNameAccess > xModuleCfg(::comphelper::ConfigurationHelper::openConfig( - xSMGR, + comphelper::getComponentContext(xSMGR), PACKAGE_SETUP_MODULES, ::comphelper::ConfigurationHelper::E_READONLY), css::uno::UNO_QUERY_THROW); diff --git a/framework/source/recording/dispatchrecordersupplier.cxx b/framework/source/recording/dispatchrecordersupplier.cxx index 164b6370b7c1..1fd5dedf0677 100644 --- a/framework/source/recording/dispatchrecordersupplier.cxx +++ b/framework/source/recording/dispatchrecordersupplier.cxx @@ -47,7 +47,7 @@ DEFINE_XTYPEPROVIDER_3( DEFINE_XSERVICEINFO_MULTISERVICE( DispatchRecorderSupplier, ::cppu::OWeakObject, - SERVICENAME_DISPATCHRECORDERSUPPLIER, + "com.sun.star.frame.DispatchRecorderSupplier", IMPLEMENTATIONNAME_DISPATCHRECORDERSUPPLIER) DEFINE_INIT_SERVICE( diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 43fd47c26b03..2e3b2649886d 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -45,9 +45,10 @@ #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/GlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XModel2.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -111,6 +112,7 @@ using ::com::sun::star::uno::Any; using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::container::XEnumeration; using ::com::sun::star::document::XDocumentRecovery; +using ::com::sun::star::frame::ModuleManager; using ::com::sun::star::frame::XModel2; using ::com::sun::star::frame::XModel; using ::com::sun::star::frame::XFrame; @@ -425,7 +427,7 @@ DEFINE_XTYPEPROVIDER_6(AutoRecovery , //----------------------------------------------- DEFINE_XSERVICEINFO_ONEINSTANCESERVICE(AutoRecovery , ::cppu::OWeakObject , - SERVICENAME_AUTORECOVERY , + "com.sun.star.frame.AutoRecovery", IMPLEMENTATIONNAME_AUTORECOVERY) //----------------------------------------------- @@ -930,7 +932,7 @@ css::uno::Reference< css::container::XNameAccess > AutoRecovery::implts_openConf if (m_xRecoveryCFG.is()) return m_xRecoveryCFG; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getComponentContext(m_xSMGR); aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -938,7 +940,7 @@ css::uno::Reference< css::container::XNameAccess > AutoRecovery::implts_openConf rtl::OUString sCFG_PACKAGE_RECOVERY(RTL_CONSTASCII_USTRINGPARAM(CFG_PACKAGE_RECOVERY)); // throws a RuntimeException if an error occure! css::uno::Reference< css::container::XNameAccess > xCFG( - ::comphelper::ConfigurationHelper::openConfig(xSMGR, sCFG_PACKAGE_RECOVERY, ::comphelper::ConfigurationHelper::E_STANDARD), + ::comphelper::ConfigurationHelper::openConfig(xContext, sCFG_PACKAGE_RECOVERY, ::comphelper::ConfigurationHelper::E_STANDARD), css::uno::UNO_QUERY); sal_Int32 nMinSpaceDocSave = MIN_DISCSPACE_DOCSAVE; @@ -947,13 +949,13 @@ css::uno::Reference< css::container::XNameAccess > AutoRecovery::implts_openConf try { rtl::OUString sCFG_PATH_AUTOSAVE(CFG_PATH_AUTOSAVE); - ::comphelper::ConfigurationHelper::readDirectKey(xSMGR, + ::comphelper::ConfigurationHelper::readDirectKey(xContext, sCFG_PACKAGE_RECOVERY, sCFG_PATH_AUTOSAVE, rtl::OUString(CFG_ENTRY_MINSPACE_DOCSAVE), ::comphelper::ConfigurationHelper::E_STANDARD) >>= nMinSpaceDocSave; - ::comphelper::ConfigurationHelper::readDirectKey(xSMGR, + ::comphelper::ConfigurationHelper::readDirectKey(xContext, sCFG_PACKAGE_RECOVERY, sCFG_PATH_AUTOSAVE, rtl::OUString(CFG_ENTRY_MINSPACE_CONFIGSAVE), @@ -1128,7 +1130,7 @@ void AutoRecovery::implts_specifyDefaultFilterAndExtension(AutoRecovery::TDocume { // open module config on demand and cache the update access xCFG = css::uno::Reference< css::container::XNameAccess >( - ::comphelper::ConfigurationHelper::openConfig(xSMGR, rtl::OUString(CFG_PACKAGE_MODULES), + ::comphelper::ConfigurationHelper::openConfig(comphelper::getComponentContext(xSMGR), rtl::OUString(CFG_PACKAGE_MODULES), ::comphelper::ConfigurationHelper::E_STANDARD), css::uno::UNO_QUERY_THROW); @@ -1181,13 +1183,12 @@ void AutoRecovery::implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XModuleManager > xManager (xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::container::XNameAccess > xModuleConfig(xManager , css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xManager = ModuleManager::create( comphelper::getComponentContext(xSMGR) ); if (rInfo.AppModule.isEmpty()) rInfo.AppModule = xManager->identify(rInfo.Document); - ::comphelper::SequenceAsHashMap lModuleDescription(xModuleConfig->getByName(rInfo.AppModule)); + ::comphelper::SequenceAsHashMap lModuleDescription(xManager->getByName(rInfo.AppModule)); lModuleDescription[rtl::OUString(CFG_ENTRY_PROP_EMPTYDOCUMENTURL)] >>= rInfo.FactoryURL; lModuleDescription[rtl::OUString(CFG_ENTRY_PROP_FACTORYSERVICE)] >>= rInfo.FactoryService; } @@ -1365,7 +1366,7 @@ void AutoRecovery::implts_startListening() ReadGuard aReadLock(m_aLock); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; css::uno::Reference< css::util::XChangesNotifier > xCFG (m_xRecoveryCFG, css::uno::UNO_QUERY); - css::uno::Reference< css::document::XEventBroadcaster > xBroadcaster = m_xNewDocBroadcaster; + css::uno::Reference< css::frame::XGlobalEventBroadcaster > xBroadcaster = m_xNewDocBroadcaster; sal_Bool bListenForDocEvents = m_bListenForDocEvents; aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -1382,7 +1383,7 @@ void AutoRecovery::implts_startListening() if (!xBroadcaster.is()) { - xBroadcaster = css::uno::Reference< css::document::XEventBroadcaster >(xSMGR->createInstance(SERVICENAME_GLOBALEVENTBROADCASTER), css::uno::UNO_QUERY_THROW); + xBroadcaster = css::frame::GlobalEventBroadcaster::create( comphelper::getComponentContext(xSMGR) ); // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); m_xNewDocBroadcaster = xBroadcaster; @@ -2534,8 +2535,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa rInfo.DocumentState |= AutoRecovery::E_TRY_LOAD_BACKUP; lDescriptor[::comphelper::MediaDescriptor::PROP_SALVAGEDFILE()] <<= sLoadOriginalURL; } - else - if (!sLoadOriginalURL.isEmpty()) + else if (!sLoadOriginalURL.isEmpty()) { sURL = sLoadOriginalURL; rInfo.DocumentState |= AutoRecovery::E_TRY_LOAD_ORIGINAL; @@ -2780,8 +2780,7 @@ void AutoRecovery::implts_generateNewTempURL(const ::rtl::OUString& xParser->parseStrict(aURL); sUniqueName.append(aURL.Name); } - else - if (!rInfo.FactoryURL.isEmpty()) + else if (!rInfo.FactoryURL.isEmpty()) sUniqueName.appendAscii("untitled"); sUniqueName.appendAscii("_"); @@ -2975,7 +2974,7 @@ void AutoRecovery::implts_doEmergencySave(const DispatchParams& aParams) // the error report tool is started too in case no recovery // documents exists and was saved. ::comphelper::ConfigurationHelper::writeDirectKey( - m_xSMGR, + comphelper::getComponentContext(m_xSMGR), rtl::OUString(CFG_PACKAGE_RECOVERY), rtl::OUString(CFG_PATH_RECOVERYINFO), rtl::OUString(CFG_ENTRY_CRASHED), @@ -3036,7 +3035,7 @@ void AutoRecovery::implts_doRecovery(const DispatchParams& aParams) // Reset the configuration hint "we was crashed"! ::comphelper::ConfigurationHelper::writeDirectKey( - m_xSMGR, + comphelper::getComponentContext(m_xSMGR), rtl::OUString(CFG_PACKAGE_RECOVERY), rtl::OUString(CFG_PATH_RECOVERYINFO), rtl::OUString(CFG_ENTRY_CRASHED), @@ -3103,7 +3102,7 @@ void AutoRecovery::implts_doSessionQuietQuit(const DispatchParams& /*aParams*/) // Write a hint for "stored session data" into the configuration, so // the on next startup we know what's happen last time ::comphelper::ConfigurationHelper::writeDirectKey( - m_xSMGR, + comphelper::getComponentContext(m_xSMGR), rtl::OUString(CFG_PACKAGE_RECOVERY), rtl::OUString(CFG_PATH_RECOVERYINFO), rtl::OUString(CFG_ENTRY_SESSIONDATA), @@ -3140,7 +3139,7 @@ void AutoRecovery::implts_doSessionRestore(const DispatchParams& aParams) // Reset the configuration hint for "session save"! LOG_RECOVERY("... reset config key 'SessionData'") ::comphelper::ConfigurationHelper::writeDirectKey( - m_xSMGR, + comphelper::getComponentContext(m_xSMGR), rtl::OUString(CFG_PACKAGE_RECOVERY), rtl::OUString(CFG_PATH_RECOVERYINFO), rtl::OUString(CFG_ENTRY_SESSIONDATA), @@ -3168,11 +3167,9 @@ void AutoRecovery::implts_backupWorkingEntry(const DispatchParams& aParams) // Prefer temp file. It contains the changes against the original document! if (!rInfo.OldTempURL.isEmpty()) sSourceURL = rInfo.OldTempURL; - else - if (!rInfo.NewTempURL.isEmpty()) + else if (!rInfo.NewTempURL.isEmpty()) sSourceURL = rInfo.NewTempURL; - else - if (!rInfo.OrgURL.isEmpty()) + else if (!rInfo.OrgURL.isEmpty()) sSourceURL = rInfo.OrgURL; else continue; // nothing real to save! An unmodified but new created document. @@ -3279,7 +3276,7 @@ void SAL_CALL AutoRecovery::getFastPropertyValue(css::uno::Any& aValue , { sal_Bool bSessionData = sal_False; ::comphelper::ConfigurationHelper::readDirectKey( - m_xSMGR, + comphelper::getComponentContext(m_xSMGR), rtl::OUString(CFG_PACKAGE_RECOVERY), rtl::OUString(CFG_PATH_RECOVERYINFO), rtl::OUString(CFG_ENTRY_SESSIONDATA), @@ -3298,7 +3295,7 @@ void SAL_CALL AutoRecovery::getFastPropertyValue(css::uno::Any& aValue , case AUTORECOVERY_PROPHANDLE_CRASHED : aValue = ::comphelper::ConfigurationHelper::readDirectKey( - m_xSMGR, + comphelper::getComponentContext(m_xSMGR), rtl::OUString(CFG_PACKAGE_RECOVERY), rtl::OUString(CFG_PATH_RECOVERYINFO), rtl::OUString(CFG_ENTRY_CRASHED), @@ -3307,7 +3304,7 @@ void SAL_CALL AutoRecovery::getFastPropertyValue(css::uno::Any& aValue , case AUTORECOVERY_PROPHANDLE_EXISTS_SESSIONDATA : aValue = ::comphelper::ConfigurationHelper::readDirectKey( - m_xSMGR, + comphelper::getComponentContext(m_xSMGR), rtl::OUString(CFG_PACKAGE_RECOVERY), rtl::OUString(CFG_PATH_RECOVERYINFO), rtl::OUString(CFG_ENTRY_SESSIONDATA), diff --git a/framework/source/services/backingcomp.cxx b/framework/source/services/backingcomp.cxx index 9058790ef086..a411b4b9575d 100644 --- a/framework/source/services/backingcomp.cxx +++ b/framework/source/services/backingcomp.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/XDataTransferProviderAccess.hpp> #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> #include <com/sun/star/awt/KeyEvent.hpp> @@ -471,15 +472,12 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f ::framework::DropTargetListener* pDropListener = new ::framework::DropTargetListener(m_xSMGR, m_xFrame); m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >(static_cast< ::cppu::OWeakObject* >(pDropListener), css::uno::UNO_QUERY); - css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer(m_xSMGR->createInstance(SERVICENAME_VCLTOOLKIT), css::uno::UNO_QUERY); - if (xTransfer.is()) + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(m_xSMGR) ); + css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget(m_xWindow); + if (xDropTarget.is()) { - css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget(m_xWindow); - if (xDropTarget.is()) - { - xDropTarget->addDropTargetListener(m_xDropTargetListener); - xDropTarget->setActive(sal_True); - } + xDropTarget->addDropTargetListener(m_xDropTargetListener); + xDropTarget->setActive(sal_True); } // initialize the component and it's parent window @@ -690,15 +688,12 @@ void SAL_CALL BackingComp::dispose() // deregister drag&drop helper if (m_xDropTargetListener.is()) { - css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer(m_xSMGR->createInstance(SERVICENAME_VCLTOOLKIT), css::uno::UNO_QUERY); - if (xTransfer.is()) + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(m_xSMGR) ); + css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget(m_xWindow); + if (xDropTarget.is()) { - css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget(m_xWindow); - if (xDropTarget.is()) - { - xDropTarget->removeDropTargetListener(m_xDropTargetListener); - xDropTarget->setActive(sal_False); - } + xDropTarget->removeDropTargetListener(m_xDropTargetListener); + xDropTarget->setActive(sal_False); } m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >(); } diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 34c2585e22f9..765c46575c3b 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -62,6 +62,7 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/configuration/theDefaultProvider.hpp" #include "com/sun/star/system/SystemShellExecute.hpp" #include "com/sun/star/system/SystemShellExecuteFlags.hpp" #include "com/sun/star/task/XJobExecutor.hpp" @@ -163,23 +164,20 @@ BackingWindow::BackingWindow( Window* i_pParent ) : try { - Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY); - if( xConfig.is() ) + Reference<lang::XMultiServiceFactory> xConfig = configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ); + Sequence<Any> args(1); + PropertyValue val( + rtl::OUString( "nodepath" ), + 0, + Any(rtl::OUString( "/org.openoffice.Office.Common/Help/StartCenter")), + PropertyState_DIRECT_VALUE); + args.getArray()[0] <<= val; + Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY); + if( xNameAccess.is() ) { - Sequence<Any> args(1); - PropertyValue val( - rtl::OUString( "nodepath" ), - 0, - Any(rtl::OUString( "/org.openoffice.Office.Common/Help/StartCenter")), - PropertyState_DIRECT_VALUE); - args.getArray()[0] <<= val; - Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY); - if( xNameAccess.is() ) - { - //throws css::container::NoSuchElementException, css::lang::WrappedTargetException - Any value( xNameAccess->getByName(rtl::OUString("StartCenterHideExternalLinks")) ); - mnHideExternalLinks = value.get<sal_Int32>(); - } + //throws css::container::NoSuchElementException, css::lang::WrappedTargetException + Any value( xNameAccess->getByName(rtl::OUString("StartCenterHideExternalLinks")) ); + mnHideExternalLinks = value.get<sal_Int32>(); } } catch (const Exception&) @@ -886,30 +884,27 @@ IMPL_LINK_NOARG(BackingWindow, ToolboxHdl) { try { - Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY); - if( xConfig.is() ) + Reference<lang::XMultiServiceFactory> xConfig = configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ); + Sequence<Any> args(1); + PropertyValue val( + rtl::OUString( "nodepath" ), + 0, + Any(rtl::OUString::createFromAscii(pNodePath)), + PropertyState_DIRECT_VALUE); + args.getArray()[0] <<= val; + Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY); + if( xNameAccess.is() ) { - Sequence<Any> args(1); - PropertyValue val( - rtl::OUString( "nodepath" ), - 0, - Any(rtl::OUString::createFromAscii(pNodePath)), - PropertyState_DIRECT_VALUE); - args.getArray()[0] <<= val; - Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY); - if( xNameAccess.is() ) - { - rtl::OUString sURL; - //throws css::container::NoSuchElementException, css::lang::WrappedTargetException - Any value( xNameAccess->getByName(rtl::OUString::createFromAscii(pNode)) ); - sURL = value.get<rtl::OUString> (); - localizeWebserviceURI(sURL); - - Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( - com::sun::star::system::SystemShellExecute::create(comphelper::getProcessComponentContext())); - //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException - xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY); - } + rtl::OUString sURL; + //throws css::container::NoSuchElementException, css::lang::WrappedTargetException + Any value( xNameAccess->getByName(rtl::OUString::createFromAscii(pNode)) ); + sURL = value.get<rtl::OUString> (); + localizeWebserviceURI(sURL); + + Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( + com::sun::star::system::SystemShellExecute::create(comphelper::getProcessComponentContext())); + //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException + xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY); } } catch (const Exception&) diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 713ad4ad93e1..bd281a361e7b 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -48,7 +48,6 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/awt/XToolkit.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> #include <com/sun/star/awt/WindowDescriptor.hpp> @@ -272,19 +271,17 @@ sal_Bool SAL_CALL Desktop::terminate() { TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); - SYNCHRONIZED_START - ReadGuard aReadLock( m_aLock ); + ReadGuard aReadLock( m_aLock ); // start synchronize - css::uno::Reference< css::frame::XTerminateListener > xPipeTerminator = m_xPipeTerminator; - css::uno::Reference< css::frame::XTerminateListener > xQuickLauncher = m_xQuickLauncher; - css::uno::Reference< css::frame::XTerminateListener > xSWThreadManager = m_xSWThreadManager; - css::uno::Reference< css::frame::XTerminateListener > xSfxTerminator = m_xSfxTerminator; + css::uno::Reference< css::frame::XTerminateListener > xPipeTerminator = m_xPipeTerminator; + css::uno::Reference< css::frame::XTerminateListener > xQuickLauncher = m_xQuickLauncher; + css::uno::Reference< css::frame::XTerminateListener > xSWThreadManager = m_xSWThreadManager; + css::uno::Reference< css::frame::XTerminateListener > xSfxTerminator = m_xSfxTerminator; - css::lang::EventObject aEvent ( static_cast< ::cppu::OWeakObject* >(this) ); - ::sal_Bool bAskQuickStart = !m_bSuspendQuickstartVeto ; + css::lang::EventObject aEvent ( static_cast< ::cppu::OWeakObject* >(this) ); + ::sal_Bool bAskQuickStart = !m_bSuspendQuickstartVeto ; - aReadLock.unlock(); - SYNCHRONIZED_END + aReadLock.unlock(); // end synchronize //------------------------------------------------------------------------------------------------------------- // Ask normal terminate listener. They could stop terminate without closing any open document. @@ -1180,30 +1177,29 @@ void SAL_CALL Desktop::dispose() fprintf( stderr, "This used to be an assertion failure: Desktop disposed before terminating it,\n" "but nothing bad seems to happen anyway?\n" ); #endif - SYNCHRONIZED_START - WriteGuard aWriteLock( m_aLock ); - // Look for multiple calls of this method! - // If somewhere call dispose() twice - he will be stopped here realy!!! - TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); - - // Now - we are alone and its the first call of this method ... - // otherwise call before had thrown a DisposedException / hopefully .-) - // But we dont use the transaction object created before ... we reset it immediatly ... - // two lines of code ... for what ? - // The answer: We wished to synchronize concurrent dispose() calls -> OK - // But next line will wait for all currently running transaction (even if they - // are running within the same thread!) So we would block ourself there if aTransaction - // will stay registered .-) - aTransaction.stop(); - - // Disable this instance for further work. - // This will wait for all current running transactions ... - // and reject all new incoming requests! - m_aTransactionManager.setWorkingMode( E_BEFORECLOSE ); + WriteGuard aWriteLock( m_aLock ); // start synchronize - aWriteLock.unlock(); - SYNCHRONIZED_END + // Look for multiple calls of this method! + // If somewhere call dispose() twice - he will be stopped here realy!!! + TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); + + // Now - we are alone and its the first call of this method ... + // otherwise call before had thrown a DisposedException / hopefully .-) + // But we dont use the transaction object created before ... we reset it immediatly ... + // two lines of code ... for what ? + // The answer: We wished to synchronize concurrent dispose() calls -> OK + // But next line will wait for all currently running transaction (even if they + // are running within the same thread!) So we would block ourself there if aTransaction + // will stay registered .-) + aTransaction.stop(); + + // Disable this instance for further work. + // This will wait for all current running transactions ... + // and reject all new incoming requests! + m_aTransactionManager.setWorkingMode( E_BEFORECLOSE ); + + aWriteLock.unlock(); // end synchronize // Following lines of code can be called outside a synchronized block ... // Because our transaction manager will block all new requests to this object. @@ -1899,11 +1895,9 @@ void Desktop::impl_sendNotifyTerminationEvent() //============================================================================= ::sal_Bool Desktop::impl_closeFrames(::sal_Bool bAllowUI) { - SYNCHRONIZED_START - ReadGuard aReadLock( m_aLock ); - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lFrames = m_aChildTaskContainer.getAllElements(); - aReadLock.unlock(); - SYNCHRONIZED_END + ReadGuard aReadLock( m_aLock ); // start synchronize + css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lFrames = m_aChildTaskContainer.getAllElements(); + aReadLock.unlock(); // end synchronize ::sal_Int32 c = lFrames.getLength(); ::sal_Int32 i = 0; diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx index e3b264e47696..f70f853a2761 100644 --- a/framework/source/services/dispatchhelper.cxx +++ b/framework/source/services/dispatchhelper.cxx @@ -44,7 +44,7 @@ namespace framework{ DEFINE_XSERVICEINFO_MULTISERVICE(DispatchHelper , ::cppu::OWeakObject , - SERVICENAME_DISPATCHHELPER , + "com.sun.star.frame.DispatchHelper", IMPLEMENTATIONNAME_DISPATCHHELPER) DEFINE_INIT_SERVICE( DispatchHelper, {} ) diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index e3bf76b76006..5d956076d5bc 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -54,6 +54,7 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/frame/XDesktop.hpp> @@ -599,7 +600,7 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& m_pWindowCommandDispatch = new WindowCommandDispatch(xSMGR, this); // Initialize title functionality - TitleHelper* pTitleHelper = new TitleHelper(xSMGR); + TitleHelper* pTitleHelper = new TitleHelper( comphelper::getComponentContext(xSMGR) ); m_xTitleHelper = css::uno::Reference< css::frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pTitleHelper), css::uno::UNO_QUERY_THROW); pTitleHelper->setOwner(xThis); } @@ -2926,15 +2927,12 @@ void Frame::implts_startWindowListening() { xTopWindow->addTopWindowListener( xTopWindowListener ); - css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer( xFactory->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY ); - if( xTransfer.is() == sal_True ) + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xFactory) ); + css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow ); + if( xDropTarget.is() == sal_True ) { - css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget( xContainerWindow ); - if( xDropTarget.is() == sal_True ) - { - xDropTarget->addDropTargetListener( xDragDropListener ); - xDropTarget->setActive( sal_True ); - } + xDropTarget->addDropTargetListener( xDragDropListener ); + xDropTarget->setActive( sal_True ); } } } @@ -2969,15 +2967,12 @@ void Frame::implts_stopWindowListening() { xTopWindow->removeTopWindowListener( xTopWindowListener ); - css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer( xFactory->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY ); - if( xTransfer.is() == sal_True ) + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xFactory) ); + css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow ); + if( xDropTarget.is() == sal_True ) { - css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget( xContainerWindow ); - if( xDropTarget.is() == sal_True ) - { - xDropTarget->removeDropTargetListener( xDragDropListener ); - xDropTarget->setActive( sal_False ); - } + xDropTarget->removeDropTargetListener( xDragDropListener ); + xDropTarget->setActive( sal_False ); } } } diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx index 6dff1bf129e3..a7f435fffb63 100644 --- a/framework/source/services/license.cxx +++ b/framework/source/services/license.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/beans/NamedValue.hpp> @@ -64,6 +65,7 @@ using namespace ::osl ; using namespace ::cppu ; using namespace ::com::sun::star::uno ; using namespace ::com::sun::star::beans ; +using namespace ::com::sun::star::configuration ; using namespace ::com::sun::star::lang ; using namespace ::com::sun::star::util ; using namespace ::com::sun::star::frame ; @@ -81,7 +83,7 @@ static const char *szWNTLicenseExt = ".txt"; //***************************************************************************************************************** // constructor //***************************************************************************************************************** -License::License( const Reference< XMultiServiceFactory >& xFactory ) +License::License( const Reference< XComponentContext >& rxContext ) // Init baseclasses first // Attention: // Don't change order of initialization! @@ -91,7 +93,7 @@ License::License( const Reference< XMultiServiceFactory >& xFactory ) : ThreadHelpBase ( &Application::GetSolarMutex() ) , OWeakObject ( ) // Init member - , m_xFactory ( xFactory ) + , m_xContext ( rxContext ) , m_bTerminate ( sal_False ) { } @@ -122,7 +124,7 @@ DEFINE_XTYPEPROVIDER_4 ( License , XCloseable ) -DEFINE_XSERVICEINFO_MULTISERVICE ( License, +DEFINE_XSERVICEINFO_MULTISERVICE_2 ( License, OWeakObject , SERVICENAME_LICENSE , IMPLEMENTATIONNAME_LICENSE @@ -262,12 +264,10 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na #endif // check if we need to show the license at all // open org.openoffice.Setup/Office/ooLicenseAcceptDate - ::rtl::OUString sConfigSrvc = SERVICENAME_CFGPROVIDER; ::rtl::OUString sAccessSrvc("com.sun.star.configuration.ConfigurationUpdateAccess"); // get configuration provider - Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( - m_xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + Reference< XMultiServiceFactory > theConfigProvider = theDefaultProvider::get( m_xContext ); Sequence< Any > theArgs(1); NamedValue v; v.Name = ::rtl::OUString("NodePath"); diff --git a/framework/source/services/mediatypedetectionhelper.cxx b/framework/source/services/mediatypedetectionhelper.cxx index efe7097d50bf..4ab19425950a 100644 --- a/framework/source/services/mediatypedetectionhelper.cxx +++ b/framework/source/services/mediatypedetectionhelper.cxx @@ -55,7 +55,7 @@ MediaTypeDetectionHelper::~MediaTypeDetectionHelper() DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( MediaTypeDetectionHelper , ::cppu::OWeakObject - , SERVICENAME_MEDIATYPEDETECTIONHELPER + , "com.sun.star.frame.MediaTypeDetectionHelper" , IMPLEMENTATIONNAME_MEDIATYPEDETECTIONHELPER ) diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx index 8860f0d56c23..307e3fc1af2e 100644 --- a/framework/source/services/modulemanager.cxx +++ b/framework/source/services/modulemanager.cxx @@ -67,7 +67,7 @@ ModuleManager::impl_createFactory( css::uno::Sequence< rtl::OUString > ModuleManager::impl_getSupportedServiceNames() { css::uno::Sequence< rtl::OUString > s(1); - s[0] = SERVICENAME_MODULEMANAGER; + s[0] = "com.sun.star.frame.ModuleManager"; return s; } @@ -194,7 +194,7 @@ void SAL_CALL ModuleManager::replaceByName(const ::rtl::OUString& sName , // flush changes (because an error occurred) we will read them later. If we use a different config access // we can close it without a flush ... and our read data wont be affected .-) css::uno::Reference< css::uno::XInterface > xCfg = ::comphelper::ConfigurationHelper::openConfig( - xSMGR, + comphelper::getComponentContext(xSMGR), rtl::OUString(CFGPATH_FACTORIES), ::comphelper::ConfigurationHelper::E_STANDARD); css::uno::Reference< css::container::XNameAccess > xModules (xCfg, css::uno::UNO_QUERY_THROW); @@ -333,7 +333,7 @@ css::uno::Reference< css::container::XNameAccess > ModuleManager::implts_getConf try { xCfg = ::comphelper::ConfigurationHelper::openConfig( - xSMGR, + comphelper::getComponentContext(xSMGR), rtl::OUString(CFGPATH_FACTORIES), ::comphelper::ConfigurationHelper::E_READONLY); } diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index f8698868009d..00b807bef137 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -1112,7 +1112,7 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgOld() { xCfg = css::uno::Reference< css::container::XNameAccess >( ::comphelper::ConfigurationHelper::openConfig( - xSMGR, + comphelper::getComponentContext(xSMGR), CFG_NODE_OLD, ::comphelper::ConfigurationHelper::E_STANDARD), // not readonly! Somtimes we need write access there !!! css::uno::UNO_QUERY_THROW); @@ -1142,7 +1142,7 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgNew() { xCfg = css::uno::Reference< css::container::XNameAccess >( ::comphelper::ConfigurationHelper::openConfig( - xSMGR, + comphelper::getComponentContext(xSMGR), CFG_NODE_NEW, ::comphelper::ConfigurationHelper::E_STANDARD), css::uno::UNO_QUERY_THROW); diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index abe3761ec46d..5b573c6b8e93 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/AutoRecovery.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> @@ -144,8 +145,8 @@ void SessionListener::StoreSession( sal_Bool bAsync ) // on stop event m_rSessionManager->saveDone(this); in case of asynchronous call // in case of synchronous call the caller should do saveDone() call himself! - css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); - css::uno::Reference< XURLTransformer > xURLTransformer(URLTransformer::create(::comphelper::getComponentContext(m_xSMGR))); + css::uno::Reference< XDispatch > xDispatch = css::frame::AutoRecovery::create( ::comphelper::getComponentContext(m_xSMGR) ); + css::uno::Reference< XURLTransformer > xURLTransformer = URLTransformer::create( ::comphelper::getComponentContext(m_xSMGR) ); URL aURL; aURL.Complete = OUString("vnd.sun.star.autorecovery:/doSessionSave"); xURLTransformer->parseStrict(aURL); @@ -177,8 +178,8 @@ void SessionListener::QuitSessionQuietly() // xd->dispatch("vnd.sun.star.autorecovery:/doSessionQuietQuit, async=false // it is done synchronously to avoid conflict with normal quit process - css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); - css::uno::Reference< XURLTransformer > xURLTransformer(URLTransformer::create(::comphelper::getComponentContext(m_xSMGR))); + css::uno::Reference< XDispatch > xDispatch = css::frame::AutoRecovery::create( ::comphelper::getComponentContext(m_xSMGR) ); + css::uno::Reference< XURLTransformer > xURLTransformer = URLTransformer::create( ::comphelper::getComponentContext(m_xSMGR) ); URL aURL; aURL.Complete = OUString("vnd.sun.star.autorecovery:/doSessionQuietQuit"); xURLTransformer->parseStrict(aURL); @@ -257,7 +258,7 @@ sal_Bool SAL_CALL SessionListener::doRestore() ResetableGuard aGuard(m_aLock); m_bRestored = sal_False; try { - css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); + css::uno::Reference< XDispatch > xDispatch = css::frame::AutoRecovery::create( ::comphelper::getComponentContext(m_xSMGR) ); URL aURL; aURL.Complete = OUString("vnd.sun.star.autorecovery:/doSessionRestore"); diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx index f554854388d8..68178a52dcc7 100644 --- a/framework/source/services/substitutepathvars.cxx +++ b/framework/source/services/substitutepathvars.cxx @@ -570,7 +570,7 @@ void SubstitutePathVariables_Impl::ReadSharePointRuleSetFromConfiguration( //***************************************************************************************************************** DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( SubstitutePathVariables , ::cppu::OWeakObject , - SERVICENAME_SUBSTITUTEPATHVARIABLES , + "com.sun.star.util.PathSubstitution", IMPLEMENTATIONNAME_SUBSTITUTEPATHVARIABLES ) DEFINE_INIT_SERVICE ( SubstitutePathVariables, {} ) @@ -698,7 +698,7 @@ rtl::OUString SubstitutePathVariables::GetWorkPath() const try { ::comphelper::ConfigurationHelper::readDirectKey( - m_xServiceManager, + comphelper::getComponentContext(m_xServiceManager), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Paths")), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Paths/Work")), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WritePath")), @@ -723,7 +723,7 @@ rtl::OUString SubstitutePathVariables::GetWorkVariableValue() const try { ::comphelper::ConfigurationHelper::readDirectKey( - m_xServiceManager, + comphelper::getComponentContext(m_xServiceManager), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Paths")), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Variables")), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Work")), diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx index 56a308f88045..d7fb64392ecd 100644 --- a/framework/source/services/taskcreatorsrv.cxx +++ b/framework/source/services/taskcreatorsrv.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/WindowDescriptor.hpp> #include <com/sun/star/awt/WindowAttribute.hpp> @@ -220,7 +221,7 @@ css::uno::Reference< css::awt::XWindow > TaskCreatorService::implts_createContai // <- SAFE // get toolkit to create task container window - css::uno::Reference< css::awt::XToolkit > xToolkit( xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xSMGR) ); // Check if child frames can be created realy. We need at least a valid window at the parent frame ... css::uno::Reference< css::awt::XWindowPeer > xParentWindowPeer; diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx index d1b287492639..e0bdb92bfb2f 100644 --- a/framework/source/tabwin/tabwindow.cxx +++ b/framework/source/tabwin/tabwindow.cxx @@ -32,6 +32,7 @@ #include <threadhelp/resetableguard.hxx> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/awt/WindowDescriptor.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -299,15 +300,14 @@ throw (css::uno::Exception, css::uno::RuntimeException) { css::beans::PropertyValue aPropValue; css::uno::Reference< css::awt::XTopWindow > xTopWindow; - css::uno::Reference< css::awt::XToolkit > xToolkit; + css::uno::Reference< css::awt::XToolkit2 > xToolkit; css::awt::WindowDescriptor aDescriptor; if ( xSMGR.is() ) { try { - xToolkit = css::uno::Reference< css::awt::XToolkit >( - xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY ); + xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xSMGR) ); } catch ( const css::uno::RuntimeException& ) { diff --git a/framework/source/tabwin/tabwinfactory.cxx b/framework/source/tabwin/tabwinfactory.cxx index a3d7815fd7ce..89a58d2928a9 100644 --- a/framework/source/tabwin/tabwinfactory.cxx +++ b/framework/source/tabwin/tabwinfactory.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/WindowAttribute.hpp> @@ -90,7 +91,7 @@ throw ( css::uno::Exception, css::uno::RuntimeException ) /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ResetableGuard aLock( m_aLock ); - css::uno::Reference< css::awt::XToolkit > xToolkit = m_xToolkit; + css::uno::Reference< css::awt::XToolkit2 > xToolkit = m_xToolkit; css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xServiceManager ); aLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ @@ -110,37 +111,31 @@ throw ( css::uno::Exception, css::uno::RuntimeException ) if ( !xToolkit.is() && xSMGR.is() ) { - xToolkit = css::uno::Reference< css::awt::XToolkit >( xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY ); - if ( xToolkit.is() ) - { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - aLock.lock(); - m_xToolkit = xToolkit; - aLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - } + xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xSMGR) ); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + aLock.lock(); + m_xToolkit = xToolkit; + aLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } if ( !xTopWindow.is() ) { - if ( xToolkit.is() ) - { - // describe window properties. - css::awt::WindowDescriptor aDescriptor; - aDescriptor.Type = css::awt::WindowClass_TOP ; - aDescriptor.ParentIndex = -1 ; - aDescriptor.Parent = css::uno::Reference< css::awt::XWindowPeer >() ; - aDescriptor.Bounds = css::awt::Rectangle(0,0,0,0) ; - aDescriptor.WindowAttributes = css::awt::WindowAttribute::BORDER| - css::awt::WindowAttribute::SIZEABLE| - css::awt::WindowAttribute::MOVEABLE| - css::awt::WindowAttribute::CLOSEABLE| - css::awt::WindowAttribute::MINSIZE; - - // create a parent window - xTopWindow = css::uno::Reference< css::awt::XTopWindow >( - xToolkit->createWindow( aDescriptor ), css::uno::UNO_QUERY ); - } + // describe window properties. + css::awt::WindowDescriptor aDescriptor; + aDescriptor.Type = css::awt::WindowClass_TOP ; + aDescriptor.ParentIndex = -1 ; + aDescriptor.Parent = css::uno::Reference< css::awt::XWindowPeer >() ; + aDescriptor.Bounds = css::awt::Rectangle(0,0,0,0) ; + aDescriptor.WindowAttributes = css::awt::WindowAttribute::BORDER| + css::awt::WindowAttribute::SIZEABLE| + css::awt::WindowAttribute::MOVEABLE| + css::awt::WindowAttribute::CLOSEABLE| + css::awt::WindowAttribute::MINSIZE; + + // create a parent window + xTopWindow = css::uno::Reference< css::awt::XTopWindow >( + xToolkit->createWindow( aDescriptor ), css::uno::UNO_QUERY ); } if ( xTopWindow.is() ) diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx index de8304da6534..4567c5ceddd9 100644 --- a/framework/source/uiconfiguration/globalsettings.cxx +++ b/framework/source/uiconfiguration/globalsettings.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> @@ -74,7 +75,7 @@ class GlobalSettings_Access : public ::com::sun::star::lang::XComponent , public ::cppu::OWeakObject { public: - GlobalSettings_Access( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + GlobalSettings_Access( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~GlobalSettings_Access(); // XInterface, XTypeProvider, XServiceInfo @@ -103,7 +104,7 @@ class GlobalSettings_Access : public ::com::sun::star::lang::XComponent , rtl::OUString m_aPropLocked; rtl::OUString m_aPropDocked; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext; }; @@ -116,7 +117,7 @@ DEFINE_XINTERFACE_2 ( GlobalSettings_Access , DIRECT_INTERFACE ( css::lang::XEventListener ) ) -GlobalSettings_Access::GlobalSettings_Access( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) : +GlobalSettings_Access::GlobalSettings_Access( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) : ThreadHelpBase(), m_bDisposed( sal_False ), m_bConfigRead( sal_False ), @@ -125,7 +126,7 @@ GlobalSettings_Access::GlobalSettings_Access( const css::uno::Reference< css::la m_aPropStatesEnabled( RTL_CONSTASCII_USTRINGPARAM( GLOBALSETTINGS_PROPERTY_STATESENABLED )), m_aPropLocked( RTL_CONSTASCII_USTRINGPARAM( GLOBALSETTINGS_PROPERTY_LOCKED )), m_aPropDocked( RTL_CONSTASCII_USTRINGPARAM( GLOBALSETTINGS_PROPERTY_DOCKED )), - m_xServiceManager( rServiceManager ) + m_xContext( rxContext ) { } @@ -255,14 +256,11 @@ sal_Bool GlobalSettings_Access::impl_initConfigAccess() try { - css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider; - if ( m_xServiceManager.is() ) - xConfigProvider = css::uno::Reference< css::lang::XMultiServiceFactory >( - m_xServiceManager->createInstance( SERVICENAME_CFGPROVIDER ), - css::uno::UNO_QUERY ); - - if ( xConfigProvider.is() ) + if ( m_xContext.is() ) { + css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider = + css::configuration::theDefaultProvider::get( m_xContext ); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" )); aPropValue.Value = css::uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GLOBALSETTINGS_ROOT_ACCESS ))); aArgs[0] = css::uno::makeAny( aPropValue ); @@ -275,9 +273,8 @@ sal_Bool GlobalSettings_Access::impl_initConfigAccess() SERVICENAME_CFGREADACCESS, aArgs ), css::uno::UNO_QUERY ); - css::uno::Reference< css::lang::XComponent > xComponent( xConfigProvider, css::uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->addEventListener( + css::uno::Reference< css::lang::XComponent >( + xConfigProvider, css::uno::UNO_QUERY_THROW )->addEventListener( css::uno::Reference< css::lang::XEventListener >( static_cast< cppu::OWeakObject* >( this ), css::uno::UNO_QUERY )); @@ -302,16 +299,16 @@ sal_Bool GlobalSettings_Access::impl_initConfigAccess() struct mutexGlobalSettings : public rtl::Static< osl::Mutex, mutexGlobalSettings > {}; static GlobalSettings_Access* pStaticSettings = 0; -static GlobalSettings_Access* GetGlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSrvMgr ) +static GlobalSettings_Access* GetGlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) { osl::MutexGuard aGuard(mutexGlobalSettings::get()); if ( !pStaticSettings ) - pStaticSettings = new GlobalSettings_Access( rSrvMgr ); + pStaticSettings = new GlobalSettings_Access( rxContext ); return pStaticSettings; } -GlobalSettings::GlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSrvMgr ) : - m_xSrvMgr( rSrvMgr ) +GlobalSettings::GlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) : + m_xContext( rxContext ) { } @@ -322,7 +319,7 @@ GlobalSettings::~GlobalSettings() // settings access sal_Bool GlobalSettings::HasStatesInfo( UIElementType eElementType ) { - GlobalSettings_Access* pSettings( GetGlobalSettings( m_xSrvMgr )); + GlobalSettings_Access* pSettings( GetGlobalSettings( m_xContext )); if ( pSettings ) return pSettings->HasStatesInfo( eElementType ); @@ -332,7 +329,7 @@ sal_Bool GlobalSettings::HasStatesInfo( UIElementType eElementType ) sal_Bool GlobalSettings::GetStateInfo( UIElementType eElementType, StateInfo eStateInfo, ::com::sun::star::uno::Any& aValue ) { - GlobalSettings_Access* pSettings( GetGlobalSettings( m_xSrvMgr )); + GlobalSettings_Access* pSettings( GetGlobalSettings( m_xContext )); if ( pSettings ) return pSettings->GetStateInfo( eElementType, eStateInfo, aValue ); diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index 3e3b5033290c..c6f3389b2eb9 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -614,7 +614,7 @@ sal_Bool ImageManagerImpl::implts_storeUserImages( xOutputStream = xStream->getOutputStream(); if ( xOutputStream.is() ) - ImagesConfiguration::StoreImages( m_xServiceManager, xOutputStream, aUserImageListInfo ); + ImagesConfiguration::StoreImages( comphelper::getComponentContext(m_xServiceManager), xOutputStream, aUserImageListInfo ); // Commit user image storage xTransaction = uno::Reference< XTransactedObject >( xUserImageStorage, UNO_QUERY ); diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx index 0753e9d45e96..088271f1287e 100644 --- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx +++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XSeekable.hpp> @@ -109,7 +110,7 @@ ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons ThreadHelpBase( &Application::GetSolarMutex() ) , m_bDisposed( false ) //TODO_AS , m_bInit( false ) - , m_xModuleMgr( Reference< XModuleManager >( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )) + , m_xModuleMgr( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ) , m_xServiceManager( xServiceManager ) , m_aListenerContainer( m_aLock.getShareableOslMutex() ) { diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 2a6b451303c3..85a44285bbc3 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -468,7 +468,7 @@ void ModuleUIConfigurationManager::impl_storeElementTypeData( Reference< XStorag { try { - ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings ); + ToolBoxConfiguration::StoreToolBox( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { @@ -480,7 +480,7 @@ void ModuleUIConfigurationManager::impl_storeElementTypeData( Reference< XStorag { try { - StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings ); + StatusBarConfiguration::StoreStatusBar( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx index 18ed4445d477..7f701e8f4446 100644 --- a/framework/source/uiconfiguration/uicategorydescription.cxx +++ b/framework/source/uiconfiguration/uicategorydescription.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> @@ -55,6 +56,7 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; +using namespace com::sun::star::configuration; using namespace com::sun::star::container; using namespace ::com::sun::star::frame; @@ -85,7 +87,7 @@ class ConfigurationAccess_UICategory : // Order is neccessary for right initiali public ::cppu::WeakImplHelper2<XNameAccess,XContainerListener> { public: - ConfigurationAccess_UICategory( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager ); + ConfigurationAccess_UICategory( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XComponentContext >& rxContext ); virtual ~ConfigurationAccess_UICategory(); // XNameAccess @@ -130,7 +132,6 @@ class ConfigurationAccess_UICategory : // Order is neccessary for right initiali rtl::OUString m_aConfigCategoryAccess; rtl::OUString m_aPropUIName; Reference< XNameAccess > m_xGenericUICategories; - Reference< XMultiServiceFactory > m_xServiceManager; Reference< XMultiServiceFactory > m_xConfigProvider; Reference< XNameAccess > m_xConfigAccess; Reference< XContainerListener > m_xConfigListener; @@ -143,12 +144,11 @@ class ConfigurationAccess_UICategory : // Order is neccessary for right initiali // XInterface, XTypeProvider //***************************************************************************************************************** -ConfigurationAccess_UICategory::ConfigurationAccess_UICategory( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICategories, const Reference< XMultiServiceFactory >& rServiceManager ) : +ConfigurationAccess_UICategory::ConfigurationAccess_UICategory( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICategories, const Reference< XComponentContext >& rxContext ) : ThreadHelpBase(), m_aConfigCategoryAccess( CONFIGURATION_ROOT_ACCESS ), m_aPropUIName( CONFIGURATION_PROPERTY_NAME ), m_xGenericUICategories( rGenericUICategories ), - m_xServiceManager( rServiceManager ), m_bConfigAccessInitialized( sal_False ), m_bCacheFilled( sal_False ) { @@ -157,7 +157,7 @@ ConfigurationAccess_UICategory::ConfigurationAccess_UICategory( const rtl::OUStr m_aConfigCategoryAccess += aModuleName; m_aConfigCategoryAccess += rtl::OUString( CONFIGURATION_CATEGORY_ELEMENT_ACCESS ); - m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY ); + m_xConfigProvider = theDefaultProvider::get( rxContext ); } ConfigurationAccess_UICategory::~ConfigurationAccess_UICategory() @@ -424,7 +424,7 @@ void SAL_CALL ConfigurationAccess_UICategory::disposing( const EventObject& aEve //***************************************************************************************************************** // XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICategoryDescription , +DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UICategoryDescription , ::cppu::OWeakObject , SERVICENAME_UICATEGORYDESCRIPTION , IMPLEMENTATIONNAME_UICATEGORYDESCRIPTION @@ -432,12 +432,12 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICategoryDescription DEFINE_INIT_SERVICE ( UICategoryDescription, {} ) -UICategoryDescription::UICategoryDescription( const Reference< XMultiServiceFactory >& xServiceManager ) : - UICommandDescription(xServiceManager,true) +UICategoryDescription::UICategoryDescription( const Reference< XComponentContext >& rxContext ) : + UICommandDescription(rxContext,true) { Reference< XNameAccess > xEmpty; rtl::OUString aGenericCategories( "GenericCategories" ); - m_xGenericUICommands = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, xServiceManager ); + m_xGenericUICommands = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, rxContext ); // insert generic categories mappings m_aModuleToCommandFileMap.insert( ModuleToCommandFileMap::value_type( @@ -455,7 +455,7 @@ UICategoryDescription::~UICategoryDescription() } Reference< XNameAccess > UICategoryDescription::impl_createConfigAccess(const ::rtl::OUString& _sName) { - return new ConfigurationAccess_UICategory( _sName,m_xGenericUICommands,m_xServiceManager ); + return new ConfigurationAccess_UICategory( _sName, m_xGenericUICommands, m_xContext ); } } // namespace framework diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index f19853f0ed0c..6ca9126caf87 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -397,7 +397,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x { try { - ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings ); + ToolBoxConfiguration::StoreToolBox( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { @@ -409,7 +409,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x { try { - StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings ); + StatusBarConfiguration::StoreStatusBar( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx index 8a38346e391d..625aeb3128d8 100644 --- a/framework/source/uiconfiguration/windowstateconfiguration.cxx +++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx @@ -34,9 +34,11 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/ui/DockingArea.hpp> @@ -54,6 +56,7 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::util; +using namespace com::sun::star::configuration; using namespace com::sun::star::container; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::ui; @@ -139,7 +142,7 @@ class ConfigurationAccess_WindowState : // interfaces public ::cppu::OWeakObject { public: - ConfigurationAccess_WindowState( const ::rtl::OUString& aWindowStateConfigFile, const Reference< XMultiServiceFactory >& rServiceManager ); + ConfigurationAccess_WindowState( const ::rtl::OUString& aWindowStateConfigFile, const Reference< XComponentContext >& rxContext ); virtual ~ConfigurationAccess_WindowState(); // XInterface, XTypeProvider @@ -249,7 +252,6 @@ class ConfigurationAccess_WindowState : // interfaces ::std::equal_to< ::rtl::OUString > > ResourceURLToInfoCache; rtl::OUString m_aConfigWindowAccess; - Reference< XMultiServiceFactory > m_xServiceManager; Reference< XMultiServiceFactory > m_xConfigProvider; Reference< XNameAccess > m_xConfigAccess; Reference< XContainerListener > m_xConfigListener; @@ -283,17 +285,16 @@ DEFINE_XTYPEPROVIDER_7 ( ConfigurationAccess_WindowState , css::lang::XTypeProvider ) -ConfigurationAccess_WindowState::ConfigurationAccess_WindowState( const rtl::OUString& aModuleName, const Reference< XMultiServiceFactory >& rServiceManager ) : +ConfigurationAccess_WindowState::ConfigurationAccess_WindowState( const rtl::OUString& aModuleName, const Reference< XComponentContext >& rxContext ) : ThreadHelpBase(), m_aConfigWindowAccess( CONFIGURATION_ROOT_ACCESS ), - m_xServiceManager( rServiceManager ), m_bConfigAccessInitialized( sal_False ), m_bModified( sal_False ) { // Create configuration hierachical access name m_aConfigWindowAccess += aModuleName; m_aConfigWindowAccess += rtl::OUString( CONFIGURATION_WINDOWSTATE_ACCESS ); - m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance( SERVICENAME_CFGPROVIDER ), UNO_QUERY ); + m_xConfigProvider = theDefaultProvider::get( rxContext ); // Initialize access array with property names. sal_Int32 n = 0; @@ -1351,7 +1352,7 @@ DEFINE_XTYPEPROVIDER_4 ( WindowStateConfiguration css::container::XElementAccess ) -DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowStateConfiguration , +DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( WindowStateConfiguration , ::cppu::OWeakObject , SERVICENAME_WINDOWSTATECONFIGURATION , IMPLEMENTATIONNAME_WINDOWSTATECONFIGURATION @@ -1359,18 +1360,16 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowStateConfiguration DEFINE_INIT_SERVICE ( WindowStateConfiguration, {} ) -WindowStateConfiguration::WindowStateConfiguration( const Reference< XMultiServiceFactory >& xServiceManager ) : +WindowStateConfiguration::WindowStateConfiguration( const Reference< XComponentContext >& rxContext ) : ThreadHelpBase(), - m_xServiceManager( xServiceManager ) + m_xContext( rxContext ) { - m_xModuleManager = Reference< XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), - UNO_QUERY ); + m_xModuleManager = ModuleManager::create( m_xContext ); Reference< XNameAccess > xEmptyNameAccess; - Reference< XNameAccess > xNameAccess( m_xModuleManager, UNO_QUERY_THROW ); Sequence< rtl::OUString > aElementNames; try { - aElementNames = xNameAccess->getElementNames(); + aElementNames = m_xModuleManager->getElementNames(); } catch (const ::com::sun::star::uno::RuntimeException &) { @@ -1381,7 +1380,7 @@ WindowStateConfiguration::WindowStateConfiguration( const Reference< XMultiServi for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) { aModuleIdentifier = aElementNames[i]; - if ( xNameAccess->getByName( aModuleIdentifier ) >>= aSeq ) + if ( m_xModuleManager->getByName( aModuleIdentifier ) >>= aSeq ) { ::rtl::OUString aWindowStateFileStr; for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) @@ -1433,7 +1432,7 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la else { Reference< XNameAccess > xResourceURLWindowState; - ConfigurationAccess_WindowState* pModuleWindowState = new ConfigurationAccess_WindowState( aWindowStateConfigFile, m_xServiceManager ); + ConfigurationAccess_WindowState* pModuleWindowState = new ConfigurationAccess_WindowState( aWindowStateConfigFile, m_xContext ); xResourceURLWindowState = Reference< XNameAccess >( static_cast< cppu::OWeakObject* >( pModuleWindowState ),UNO_QUERY ); pModuleIter->second = xResourceURLWindowState; a <<= xResourceURLWindowState; diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index 1bc24dda35e1..5f6c847a4a48 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -48,6 +48,7 @@ #include <uielement/toolbarmerger.hxx> #include <com/sun/star/ui/ItemType.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XToolbarController.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -225,8 +226,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue ::rtl::OUString aModuleIdentifier; try { - Reference< XModuleManager > xModuleManager( - m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); aModuleIdentifier = xModuleManager->identify( m_xFrame ); } catch ( const Exception& ) diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index b79f1795bce8..2f1f22e09a2c 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -56,7 +56,7 @@ #include <com/sun/star/ui/ItemType.hpp> #include <com/sun/star/ui/ImageType.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/ItemStyle.hpp> @@ -1537,8 +1537,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh if ( !m_bModuleIdentified ) { m_bModuleIdentified = sal_True; - Reference< XModuleManager > xModuleManager; - xModuleManager = Reference< XModuleManager >( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext( getServiceFactory() ) ); try { @@ -1657,9 +1656,9 @@ void MenuBarManager::RetrieveImageManagers() } } - Reference< XModuleManager > xModuleManager; + Reference< XModuleManager2 > xModuleManager; if ( m_aModuleIdentifier.isEmpty() ) - xModuleManager.set( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + xModuleManager.set( ModuleManager::create( comphelper::getComponentContext( getServiceFactory() ) ) ); try { @@ -1895,8 +1894,7 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon if ( !m_bModuleIdentified ) { m_bModuleIdentified = sal_True; - Reference< XModuleManager > xModuleManager; - xModuleManager = Reference< XModuleManager >( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(getServiceFactory()) ); try { diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index 48b93d5fd754..cc7032a37bec 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/UIElementType.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <comphelper/processfactory.hxx> @@ -147,10 +147,7 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th pVCLMenuBar = new MenuBar(); } - Reference< XModuleManager > xModuleManager; - xModuleManager = Reference< XModuleManager >( - m_xServiceFactory->createInstance( - SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceFactory) ); try { diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 38595629a595..bf8dbbf91c43 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -41,8 +41,7 @@ #include <com/sun/star/awt/MenuItemStyle.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <vcl/svapp.hxx> #include <vcl/i18nhelp.hxx> @@ -487,39 +486,35 @@ void NewMenuController::impl_setPopupMenu() fillPopupMenu( m_xPopupMenu ); // Identify module that we are attach to. It's our context that we need to know. - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),UNO_QUERY ); - if ( xModuleManager.is() ) + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); + try { - try + m_aModuleIdentifier = xModuleManager->identify( m_xFrame ); + m_bModuleIdentified = sal_True; + + if ( !m_aModuleIdentifier.isEmpty() ) { - m_aModuleIdentifier = xModuleManager->identify( m_xFrame ); - m_bModuleIdentified = sal_True; + Sequence< PropertyValue > aSeq; - Reference< XNameAccess > xNameAccess( xModuleManager, UNO_QUERY ); - if ( !m_aModuleIdentifier.isEmpty() && xNameAccess.is() ) + if ( xModuleManager->getByName( m_aModuleIdentifier ) >>= aSeq ) { - Sequence< PropertyValue > aSeq; - - if ( xNameAccess->getByName( m_aModuleIdentifier ) >>= aSeq ) + for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) { - for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) + if ( aSeq[y].Name == "ooSetupFactoryEmptyDocumentURL" ) { - if ( aSeq[y].Name == "ooSetupFactoryEmptyDocumentURL" ) - { - aSeq[y].Value >>= m_aEmptyDocURL; - break; - } + aSeq[y].Value >>= m_aEmptyDocURL; + break; } } } } - catch ( const RuntimeException& ) - { - throw; - } - catch ( const Exception& ) - { - } + } + catch ( const RuntimeException& ) + { + throw; + } + catch ( const Exception& ) + { } } diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 208fe1dc81af..21d23bdd46dc 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -49,7 +49,7 @@ #include <com/sun/star/ui/DockingArea.hpp> #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/ui/XUIElementSettings.hpp> #include <com/sun/star/ui/XUIConfigurationPersistence.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> @@ -829,7 +829,7 @@ uno::Sequence< beans::PropertyValue > ToolBarManager::GetPropsForCommand( const { if ( !m_bModuleIdentified ) { - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); Reference< XInterface > xIfac( m_xFrame, UNO_QUERY ); m_bModuleIdentified = sal_True; @@ -1200,8 +1200,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine sal_uInt16 nId( 1 ); - Reference< XModuleManager > xModuleManager( Reference< XModuleManager >( - m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); if ( !m_xDocImageManager.is() ) { Reference< XModel > xModel( GetModelFromFrame() ); @@ -1221,8 +1220,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine try { - if ( xModuleManager.is() ) - m_aModuleIdentifier = xModuleManager->identify( Reference< XInterface >( m_xFrame, UNO_QUERY ) ); + m_aModuleIdentifier = xModuleManager->identify( Reference< XInterface >( m_xFrame, UNO_QUERY ) ); } catch (const Exception&) { diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 5d479a552060..37bf5ecad454 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/awt/MenuItemStyle.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -229,7 +230,7 @@ rtl::OUString ToolbarsMenuController::getUINameFromCommand( const rtl::OUString& { try { - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); m_aModuleIdentifier = xModuleManager->identify( m_xFrame ); Reference< XNameAccess > xNameAccess( m_xServiceManager->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), @@ -831,9 +832,7 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume if ( m_bInitialized ) { - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( - SERVICENAME_MODULEMANAGER ), - UNO_QUERY ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); Reference< XNameAccess > xPersistentWindowStateSupplier( m_xServiceManager->createInstance( SERVICENAME_WINDOWSTATECONFIGURATION ), UNO_QUERY ); diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index 4715e1c1a453..2946f1da2482 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -36,6 +36,8 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> @@ -57,6 +59,7 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; +using namespace com::sun::star::configuration; using namespace com::sun::star::container; using namespace ::com::sun::star::frame; @@ -96,12 +99,12 @@ namespace framework // Configuration access class for PopupMenuControllerFactory implementation //***************************************************************************************************************** -class ConfigurationAccess_UICommand : // Order is neccessary for right initialization! +class ConfigurationAccess_UICommand : // Order is necessary for right initialization! private ThreadHelpBase , public ::cppu::WeakImplHelper2<XNameAccess,XContainerListener> { public: - ConfigurationAccess_UICommand( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager ); + ConfigurationAccess_UICommand( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XComponentContext >& rxContext ); virtual ~ConfigurationAccess_UICommand(); // XNameAccess @@ -179,7 +182,6 @@ class ConfigurationAccess_UICommand : // Order is neccessary for right initializ rtl::OUString m_aExtension; rtl::OUString m_aPrivateResourceURL; Reference< XNameAccess > m_xGenericUICommands; - Reference< XMultiServiceFactory > m_xServiceManager; Reference< XMultiServiceFactory > m_xConfigProvider; Reference< XNameAccess > m_xConfigAccess; Reference< XContainerListener > m_xConfigListener; @@ -197,7 +199,7 @@ class ConfigurationAccess_UICommand : // Order is neccessary for right initializ //***************************************************************************************************************** // XInterface, XTypeProvider //***************************************************************************************************************** -ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager ) : +ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICommands, const Reference< XComponentContext>& rxContext ) : ThreadHelpBase(), m_aConfigCmdAccess( CONFIGURATION_ROOT_ACCESS ), m_aConfigPopupAccess( CONFIGURATION_ROOT_ACCESS ), @@ -209,7 +211,6 @@ ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUStrin m_aPropProperties( PROPSET_PROPERTIES ), m_aPrivateResourceURL( PRIVATE_RESOURCE_URL ), m_xGenericUICommands( rGenericUICommands ), - m_xServiceManager( rServiceManager ), m_bConfigAccessInitialized( sal_False ), m_bCacheFilled( sal_False ), m_bGenericDataRetrieved( sal_False ) @@ -218,7 +219,7 @@ ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUStrin m_aConfigCmdAccess += aModuleName; m_aConfigCmdAccess += rtl::OUString( CONFIGURATION_CMD_ELEMENT_ACCESS ); - m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY ); + m_xConfigProvider = theDefaultProvider::get( rxContext ); m_aConfigPopupAccess += aModuleName; m_aConfigPopupAccess += rtl::OUString( CONFIGURATION_POP_ELEMENT_ACCESS ); @@ -623,7 +624,7 @@ void SAL_CALL ConfigurationAccess_UICommand::disposing( const EventObject& aEven //***************************************************************************************************************** // XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICommandDescription , +DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UICommandDescription , ::cppu::OWeakObject , SERVICENAME_UICOMMANDDESCRIPTION , IMPLEMENTATIONNAME_UICOMMANDDESCRIPTION @@ -631,15 +632,15 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICommandDescription DEFINE_INIT_SERVICE ( UICommandDescription, {} ) -UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactory >& xServiceManager ) : +UICommandDescription::UICommandDescription( const Reference< XComponentContext >& rxContext ) : ThreadHelpBase(), m_aPrivateResourceURL( PRIVATE_RESOURCE_URL ), - m_xServiceManager( xServiceManager ) + m_xContext( rxContext ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::UICommandDescription" ); Reference< XNameAccess > xEmpty; rtl::OUString aGenericUICommand( "GenericCommands" ); - m_xGenericUICommands = new ConfigurationAccess_UICommand( aGenericUICommand, xEmpty, xServiceManager ); + m_xGenericUICommands = new ConfigurationAccess_UICommand( aGenericUICommand, xEmpty, m_xContext ); impl_fillElements("ooSetupFactoryCommandConfigRef"); @@ -648,9 +649,9 @@ UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactor if ( pIter != m_aUICommandsHashMap.end() ) pIter->second = m_xGenericUICommands; } -UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactory >& xServiceManager,bool ) : +UICommandDescription::UICommandDescription( const Reference< XComponentContext >& rxContext, bool ) : ThreadHelpBase(), - m_xServiceManager( xServiceManager ) + m_xContext( rxContext ) { } UICommandDescription::~UICommandDescription() @@ -662,16 +663,15 @@ UICommandDescription::~UICommandDescription() } void UICommandDescription::impl_fillElements(const sal_Char* _pName) { - m_xModuleManager.set( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),UNO_QUERY ); - Reference< XNameAccess > xNameAccess( m_xModuleManager, UNO_QUERY_THROW ); - Sequence< rtl::OUString > aElementNames = xNameAccess->getElementNames(); + m_xModuleManager.set( ModuleManager::create( m_xContext ) ); + Sequence< rtl::OUString > aElementNames = m_xModuleManager->getElementNames(); Sequence< PropertyValue > aSeq; ::rtl::OUString aModuleIdentifier; for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) { aModuleIdentifier = aElementNames[i]; - if ( xNameAccess->getByName( aModuleIdentifier ) >>= aSeq ) + if ( m_xModuleManager->getByName( aModuleIdentifier ) >>= aSeq ) { ::rtl::OUString aCommandStr; for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) @@ -695,7 +695,7 @@ void UICommandDescription::impl_fillElements(const sal_Char* _pName) } Reference< XNameAccess > UICommandDescription::impl_createConfigAccess(const ::rtl::OUString& _sName) { - return new ConfigurationAccess_UICommand( _sName,m_xGenericUICommands,m_xServiceManager ); + return new ConfigurationAccess_UICommand( _sName, m_xGenericUICommands, m_xContext ); } Any SAL_CALL UICommandDescription::getByName( const ::rtl::OUString& aName ) @@ -720,7 +720,7 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la Reference< XNameAccess > xUICommands; ConfigurationAccess_UICommand* pUICommands = new ConfigurationAccess_UICommand( aCommandFile, m_xGenericUICommands, - m_xServiceManager ); + m_xContext ); xUICommands = Reference< XNameAccess >( static_cast< cppu::OWeakObject* >( pUICommands ),UNO_QUERY ); pIter->second = xUICommands; a <<= xUICommands; diff --git a/framework/source/uifactory/addonstoolboxfactory.cxx b/framework/source/uifactory/addonstoolboxfactory.cxx index 21ca8c1a9909..54b84d15fa3b 100644 --- a/framework/source/uifactory/addonstoolboxfactory.cxx +++ b/framework/source/uifactory/addonstoolboxfactory.cxx @@ -32,6 +32,7 @@ #include <threadhelp/resetableguard.hxx> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -71,7 +72,7 @@ AddonsToolBoxFactory::AddonsToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : ThreadHelpBase( &Application::GetSolarMutex() ) , m_xServiceManager( xServiceManager ) - , m_xModuleManager( xServiceManager->createInstance(SERVICENAME_MODULEMANAGER),UNO_QUERY ) + , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ) { } diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx index d029b849f013..476fefcb391b 100644 --- a/framework/source/uifactory/factoryconfiguration.cxx +++ b/framework/source/uifactory/factoryconfiguration.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> @@ -69,19 +70,18 @@ rtl::OUString getHashKeyFromStrings( const rtl::OUString& aCommandURL, const rtl //***************************************************************************************************************** // XInterface, XTypeProvider //***************************************************************************************************************** -ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( Reference< XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue ) : +ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( const Reference< XComponentContext >& rxContext, const ::rtl::OUString& _sRoot,bool _bAskValue ) : ThreadHelpBase(), m_aPropCommand( RTL_CONSTASCII_USTRINGPARAM( "Command" )), m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )), m_aPropController( RTL_CONSTASCII_USTRINGPARAM( "Controller" )), m_aPropValue( RTL_CONSTASCII_USTRINGPARAM( "Value" )), m_sRoot(_sRoot), - m_xServiceManager( rServiceManager ), m_bConfigAccessInitialized( sal_False ), m_bAskValue(_bAskValue) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory" ); - m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance( SERVICENAME_CFGPROVIDER),UNO_QUERY ); + m_xConfigProvider = configuration::theDefaultProvider::get( rxContext ); } ConfigurationAccess_ControllerFactory::~ConfigurationAccess_ControllerFactory() diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index e221e9a5459f..fcb17ccd9496 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -33,6 +33,7 @@ #include <uielement/menubarwrapper.hxx> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -73,13 +74,13 @@ DEFINE_INIT_SERVICE ( MenuBarFactory, {} ) MenuBarFactory::MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : ThreadHelpBase() , m_xServiceManager( xServiceManager ) - , m_xModuleManager( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY ) + , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ) { } MenuBarFactory::MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ) : ThreadHelpBase(&Application::GetSolarMutex()) , m_xServiceManager( xServiceManager ) - , m_xModuleManager( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY ) + , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ) { } @@ -97,7 +98,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l ResetableGuard aLock( m_aLock ); MenuBarWrapper* pMenuBarWrapper = new MenuBarWrapper( m_xServiceManager ); Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pMenuBarWrapper, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager; + Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); CreateUIElement(ResourceURL,Args,"MenuOnly","private:resource/menubar/",xMenuBar,xModuleManager,m_xServiceManager); return xMenuBar; @@ -107,7 +108,7 @@ void MenuBarFactory::CreateUIElement(const ::rtl::OUString& ResourceURL ,const char* _pExtraMode ,const char* _pAsciiName ,const Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar - ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager >& _xModuleManager + ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) { Reference< XUIConfigurationManager > xCfgMgr; diff --git a/framework/source/uifactory/popupmenucontrollerfactory.cxx b/framework/source/uifactory/popupmenucontrollerfactory.cxx index e98f03e91464..34dd936f7b72 100644 --- a/framework/source/uifactory/popupmenucontrollerfactory.cxx +++ b/framework/source/uifactory/popupmenucontrollerfactory.cxx @@ -64,7 +64,7 @@ PopupMenuControllerFactory::PopupMenuControllerFactory( const Reference< XMultiS ToolbarControllerFactory(xServiceManager,true) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PopupMenuControllerFactory::PopupMenuControllerFactory" ); - m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/PopupMenu" )) ); + m_pConfigAccess = new ConfigurationAccess_ControllerFactory( comphelper::getComponentContext(m_xServiceManager), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/PopupMenu" )) ); m_pConfigAccess->acquire(); } diff --git a/framework/source/uifactory/statusbarcontrollerfactory.cxx b/framework/source/uifactory/statusbarcontrollerfactory.cxx index 3de5b25245ab..b0e0342f3e94 100644 --- a/framework/source/uifactory/statusbarcontrollerfactory.cxx +++ b/framework/source/uifactory/statusbarcontrollerfactory.cxx @@ -61,7 +61,7 @@ DEFINE_INIT_SERVICE ( StatusbarControllerFactory, {} ) StatusbarControllerFactory::StatusbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) : ToolbarControllerFactory(xServiceManager,true) { - m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/StatusBar" )),true ); + m_pConfigAccess = new ConfigurationAccess_ControllerFactory( comphelper::getComponentContext(m_xServiceManager), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/StatusBar" )),true ); m_pConfigAccess->acquire(); } diff --git a/framework/source/uifactory/statusbarfactory.cxx b/framework/source/uifactory/statusbarfactory.cxx index 7f2fce4714e0..df64bc16f899 100644 --- a/framework/source/uifactory/statusbarfactory.cxx +++ b/framework/source/uifactory/statusbarfactory.cxx @@ -76,7 +76,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l ResetableGuard aLock( m_aLock ); StatusBarWrapper* pWrapper = new StatusBarWrapper( m_xServiceManager ); Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager; + Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); MenuBarFactory::CreateUIElement(ResourceURL,Args,NULL,"private:resource/statusbar/",xMenuBar,xModuleManager,m_xServiceManager); return xMenuBar; diff --git a/framework/source/uifactory/toolbarcontrollerfactory.cxx b/framework/source/uifactory/toolbarcontrollerfactory.cxx index 5651159be7dd..6967a8aae367 100644 --- a/framework/source/uifactory/toolbarcontrollerfactory.cxx +++ b/framework/source/uifactory/toolbarcontrollerfactory.cxx @@ -73,7 +73,7 @@ ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XMultiServi m_bConfigRead( sal_False ), m_xServiceManager( xServiceManager ) { - m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/ToolBar" )) ); + m_pConfigAccess = new ConfigurationAccess_ControllerFactory( comphelper::getComponentContext(m_xServiceManager), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/ToolBar" )) ); m_pConfigAccess->acquire(); } diff --git a/framework/source/uifactory/toolboxfactory.cxx b/framework/source/uifactory/toolboxfactory.cxx index a30a1c3737a2..69a037c7a934 100644 --- a/framework/source/uifactory/toolboxfactory.cxx +++ b/framework/source/uifactory/toolboxfactory.cxx @@ -72,7 +72,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l ResetableGuard aLock( m_aLock ); ToolBarWrapper* pWrapper = new ToolBarWrapper( m_xServiceManager ); Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager; + Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); CreateUIElement(ResourceURL,Args,"PopupMode","private:resource/toolbar/",xMenuBar,xModuleManager,m_xServiceManager); return xMenuBar; diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index 11ff2a17fdc9..6e4b9d59b9b8 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -35,9 +35,11 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <rtl/ustrbuf.hxx> @@ -53,6 +55,7 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::frame; +using namespace com::sun::star::configuration; using namespace com::sun::star::container; using namespace ::com::sun::star::ui; using namespace ::com::sun::star::frame; @@ -81,18 +84,17 @@ rtl::OUString getHashKeyFromStrings( const rtl::OUString& aType, const rtl::OUSt //***************************************************************************************************************** -ConfigurationAccess_FactoryManager::ConfigurationAccess_FactoryManager( Reference< XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot ) : +ConfigurationAccess_FactoryManager::ConfigurationAccess_FactoryManager( const Reference< XComponentContext >& rxContext, const ::rtl::OUString& _sRoot ) : ThreadHelpBase(), m_aPropType( RTL_CONSTASCII_USTRINGPARAM( "Type" )), m_aPropName( RTL_CONSTASCII_USTRINGPARAM( "Name" )), m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )), m_aPropFactory( RTL_CONSTASCII_USTRINGPARAM( "FactoryImplementation" )), m_sRoot(_sRoot), - m_xServiceManager( rServiceManager ), m_bConfigAccessInitialized( sal_False ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::ConfigurationAccess_FactoryManager" ); - m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance( SERVICENAME_CFGPROVIDER),UNO_QUERY ); + m_xConfigProvider = theDefaultProvider::get( rxContext ); } ConfigurationAccess_FactoryManager::~ConfigurationAccess_FactoryManager() @@ -378,7 +380,7 @@ sal_Bool ConfigurationAccess_FactoryManager::impl_getElementProps( const Any& aE //***************************************************************************************************************** // XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UIElementFactoryManager , +DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UIElementFactoryManager , ::cppu::OWeakObject , SERVICENAME_UIELEMENTFACTORYMANAGER , IMPLEMENTATIONNAME_UIELEMENTFACTORYMANAGER @@ -386,15 +388,15 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UIElementFactoryManager DEFINE_INIT_SERVICE ( UIElementFactoryManager, {} ) -UIElementFactoryManager::UIElementFactoryManager( const Reference< XMultiServiceFactory >& xServiceManager ) : +UIElementFactoryManager::UIElementFactoryManager( const Reference< XComponentContext >& rxContext ) : ThreadHelpBase( &Application::GetSolarMutex() ), m_bConfigRead( sal_False ), - m_xServiceManager( xServiceManager ) + m_xContext(rxContext) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::UIElementFactoryManager" ); - m_pConfigAccess = new ConfigurationAccess_FactoryManager( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Factories/Registered/UIElementFactories" )) ); + m_pConfigAccess = new ConfigurationAccess_FactoryManager( rxContext, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Factories/Registered/UIElementFactories" )) ); m_pConfigAccess->acquire(); - m_xModuleManager = Reference< XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY ); + m_xModuleManager = ModuleManager::create( rxContext ); } UIElementFactoryManager::~UIElementFactoryManager() @@ -436,7 +438,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l Args[i].Value >>= xFrame; } - Reference< XModuleManager > xManager( m_xModuleManager ); + Reference< XModuleManager2 > xManager( m_xModuleManager ); aLock.unlock(); // Determine the module identifier @@ -490,13 +492,13 @@ throw ( RuntimeException ) WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName ); - Reference< XMultiServiceFactory > xSManager( m_xServiceManager ); + Reference< XComponentContext > xContext( m_xContext ); rtl::OUString aServiceSpecifier = m_pConfigAccess->getFactorySpecifierFromTypeNameModule( aType, aName, aModuleId ); aLock.unlock(); if ( !aServiceSpecifier.isEmpty() ) - return Reference< XUIElementFactory >( xSManager->createInstance( aServiceSpecifier ), UNO_QUERY ); + return Reference< XUIElementFactory >( xContext->getServiceManager()->createInstanceWithContext(aServiceSpecifier, xContext), UNO_QUERY ); else return Reference< XUIElementFactory >(); } diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx index b9691a5c92fd..68176592ae00 100644 --- a/framework/source/uifactory/windowcontentfactorymanager.cxx +++ b/framework/source/uifactory/windowcontentfactorymanager.cxx @@ -36,8 +36,8 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/awt/XToolkit.hpp> #include <com/sun/star/awt/XControlModel.hpp> #include <com/sun/star/awt/XControl.hpp> @@ -63,7 +63,7 @@ namespace framework //***************************************************************************************************************** // XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager , +DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( WindowContentFactoryManager , ::cppu::OWeakObject , SERVICENAME_WINDOWCONTENTFACTORYMANAGER , IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER @@ -71,14 +71,13 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager DEFINE_INIT_SERVICE ( WindowContentFactoryManager, {} ) -WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) : +WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< uno::XComponentContext >& rxContext ) : ThreadHelpBase( &Application::GetSolarMutex() ), - m_bConfigRead( sal_False ), - m_xServiceManager( xServiceManager ) + m_bConfigRead( sal_False ) { - m_pConfigAccess = new ConfigurationAccess_FactoryManager( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" )) ); + m_pConfigAccess = new ConfigurationAccess_FactoryManager( rxContext, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" )) ); m_pConfigAccess->acquire(); - m_xModuleManager = uno::Reference< frame::XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), uno::UNO_QUERY ); + m_xModuleManager = frame::ModuleManager::create( rxContext ); } WindowContentFactoryManager::~WindowContentFactoryManager() @@ -147,7 +146,7 @@ throw (uno::Exception, uno::RuntimeException) } } - uno::Reference< frame::XModuleManager > xModuleManager; + uno::Reference< frame::XModuleManager2 > xModuleManager; // SAFE { ResetableGuard aLock( m_aLock ); diff --git a/framework/source/xml/imagesconfiguration.cxx b/framework/source/xml/imagesconfiguration.cxx index 622b45f5eecc..c65c46cebf8d 100644 --- a/framework/source/xml/imagesconfiguration.cxx +++ b/framework/source/xml/imagesconfiguration.cxx @@ -34,6 +34,7 @@ #include <xml/saxnamespacefilter.hxx> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -50,26 +51,12 @@ using namespace ::com::sun::star::io; namespace framework { -static Reference< XParser > GetSaxParser( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext - ) -{ - return Parser::create(rxContext); -} - -static Reference< XDocumentHandler > GetSaxWriter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory - ) -{ - return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ; -} - sal_Bool ImagesConfiguration::LoadImages( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream, ImageListsDescriptor& rItems ) { - Reference< XParser > xParser( GetSaxParser( rxContext ) ); + Reference< XParser > xParser = Parser::create( rxContext ); // connect stream to input stream to the parser InputSource aInputSource; @@ -103,18 +90,17 @@ sal_Bool ImagesConfiguration::LoadImages( } sal_Bool ImagesConfiguration::StoreImages( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, const ImageListsDescriptor& rItems ) { - Reference< XDocumentHandler > xWriter( GetSaxWriter( xServiceFactory ) ); - - Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); - xDataSource->setOutputStream( rOutputStream ); + Reference< XWriter > xWriter = Writer::create(rxContext); + xWriter->setOutputStream( rOutputStream ); try { - OWriteImagesDocumentHandler aWriteImagesDocumentHandler( rItems, xWriter ); + Reference< XDocumentHandler > xHandler( xWriter, UNO_QUERY_THROW ); + OWriteImagesDocumentHandler aWriteImagesDocumentHandler( rItems, xHandler ); aWriteImagesDocumentHandler.WriteImagesDocument(); return sal_True; } |