diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-15 16:35:00 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-16 10:24:57 +0100 |
commit | a384b21cc40818bf3c918951a086a30b5d9d8022 (patch) | |
tree | dfde5b66b409fd145ebad8df5d641d8bca157f83 /sfx2 | |
parent | cf51afb0269e9c1fd5d51ca8b67b86a38d1da75f (diff) |
sfx: Use constructor feature for ShutdownIcon.
Change-Id: I3af683cdc273fa8cb9224a0f1f7d342a140c9dd7
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appuno.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 39 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.hxx | 16 | ||||
-rw-r--r-- | sfx2/util/sfx.component | 3 |
4 files changed, 42 insertions, 18 deletions
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 1741f3c4bc4b..bb21a6ca863e 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -44,7 +44,6 @@ #include <sfx2/unoctitm.hxx> #include "sfxslots.hxx" #include "sfxtypes.hxx" -#include "shutdownicon.hxx" #include <sal/config.h> #include <basic/basmgr.hxx> @@ -1795,7 +1794,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory( //============================================================================= IF_NAME_CREATECOMPONENTFACTORY( BackingComp ) IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl ) - IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon ) #ifdef TEST_HANDLERS IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler ) IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler ) diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index ea865f481322..bef401945ac3 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -46,12 +46,14 @@ #include <sfx2/fcontnr.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/compbase1.hxx> +#include <cppuhelper/supportsservice.hxx> #include <sfx2/dispatch.hxx> #include <comphelper/extract.hxx> #include <tools/urlobj.hxx> #include <osl/security.hxx> #include <osl/file.hxx> #include <rtl/bootstrap.hxx> +#include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> #ifdef UNX // need symlink #include <unistd.h> @@ -70,10 +72,6 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::util; using namespace ::com::sun::star::ui::dialogs; -#ifdef WNT -#else -using namespace ::rtl; -#endif using namespace ::sfx2; #ifdef ENABLE_QUICKSTART_APPLET @@ -102,8 +100,25 @@ void SAL_CALL SfxNotificationListener_Impl::disposing( const EventObject& ) thro { } -SFX_IMPL_XSERVICEINFO_CTX( ShutdownIcon, "com.sun.star.office.Quickstart", "com.sun.star.comp.desktop.QuickstartWrapper" ) \ -SFX_IMPL_ONEINSTANCEFACTORY( ShutdownIcon ); +OUString SAL_CALL ShutdownIcon::getImplementationName() + throw (css::uno::RuntimeException) +{ + return OUString("com.sun.star.comp.desktop.QuickstartWrapper"); +} + +sal_Bool SAL_CALL ShutdownIcon::supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException) +{ + return cppu::supportsService(this, ServiceName); +} + +css::uno::Sequence<OUString> SAL_CALL ShutdownIcon::getSupportedServiceNames() + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< OUString > aSeq(1); + aSeq[0] = OUString("com.sun.star.office.Quickstart"); + return aSeq; +} bool ShutdownIcon::bModalMode = false; ShutdownIcon* ShutdownIcon::pShutdownIcon = NULL; @@ -863,7 +878,7 @@ void ShutdownIcon::SetAutostart( bool bActivate ) getAutostartDir( true ); OUString aPath( "${BRAND_BASE_DIR}/" LIBO_SHARE_FOLDER "/xdg/qstart.desktop" ); - Bootstrap::expandMacros( aPath ); + rtl::Bootstrap::expandMacros( aPath ); OUString aDesktopFile; ::osl::File::getSystemPathFromFileURL( aPath, aDesktopFile ); @@ -956,4 +971,14 @@ void SAL_CALL ShutdownIcon::setFastPropertyValue( ::sal_Int32 return aValue; } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_desktop_QuickstartWrapper_get_implementation( + css::uno::XComponentContext *context, + css::uno::Sequence<css::uno::Any> const &) +{ + rtl::Reference<ShutdownIcon> x(new ShutdownIcon(context)); + x->acquire(); + return static_cast<cppu::OWeakObject *>(x.get()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index 958c59d3c267..43a746ccbeac 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -22,9 +22,6 @@ #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/frame/XDesktop2.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -94,7 +91,14 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase virtual ~ShutdownIcon(); - SFX_DECL_XSERVICEINFO + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException); static ShutdownIcon* getInstance(); static ShutdownIcon* createInstance(); @@ -113,10 +117,6 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase void init() throw( ::com::sun::star::uno::Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > - GetWrapperFactory( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSMgr ); - static OUString GetImplementationName_static(); - OUString GetResString( int id ); OUString GetUrlDescription( const OUString& aUrl ); diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component index 4a7d699b5aa6..f8b6839b39a2 100644 --- a/sfx2/util/sfx.component +++ b/sfx2/util/sfx.component @@ -29,7 +29,8 @@ <implementation name="CompatWriterDocPropsImpl"> <service name="com.sun.star.writer.DocumentProperties"/> </implementation> - <implementation name="com.sun.star.comp.desktop.QuickstartWrapper"> + <implementation name="com.sun.star.comp.desktop.QuickstartWrapper" + constructor="com_sun_star_comp_desktop_QuickstartWrapper_get_implementation"> <service name="com.sun.star.office.Quickstart"/> </implementation> <implementation name="com.sun.star.comp.document.OwnSubFilter" |