diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 10:36:10 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-17 12:24:39 +0100 |
commit | 78cf00643e028a4032d16c4242eeeb5de5515998 (patch) | |
tree | 8505112ac041ab38a77266076acb140b6fb8e171 | |
parent | 8634c127d488a5aa8e994664b9ebc80860055fbf (diff) |
fwk: Use constructor feature for NewToolbarController.
Change-Id: Ic087dbce11572789bab749b0b4fb0be4a80f274d
-rw-r--r-- | framework/inc/uielement/popuptoolbarcontroller.hxx | 17 | ||||
-rw-r--r-- | framework/source/register/registerservices.cxx | 1 | ||||
-rw-r--r-- | framework/source/uielement/popuptoolbarcontroller.cxx | 66 | ||||
-rw-r--r-- | framework/util/fwk.component | 3 |
4 files changed, 62 insertions, 25 deletions
diff --git a/framework/inc/uielement/popuptoolbarcontroller.hxx b/framework/inc/uielement/popuptoolbarcontroller.hxx index d329b9ddb325..65ddf1588b2c 100644 --- a/framework/inc/uielement/popuptoolbarcontroller.hxx +++ b/framework/inc/uielement/popuptoolbarcontroller.hxx @@ -68,23 +68,6 @@ namespace framework DECLARE_XSERVICEINFO }; - class NewToolbarController : public PopupMenuToolbarController - { - public: - NewToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); - - // XServiceInfo - DECLARE_XSERVICEINFO - private: - void functionExecuted( const OUString &rCommand ); - void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException ); - void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); - void setItemImage( const OUString &rCommand ); - - OUString m_aLastURL; - }; - class WizardsToolbarController : public PopupMenuToolbarController { public: diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index bf3105b08d33..4cc4ba0e1bc0 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -113,7 +113,6 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::PathSettings ) else IFFACTORY( ::framework::ContextChangeEventMultiplexer ) else IFFACTORY( ::framework::OpenToolbarController ) else - IFFACTORY( ::framework::NewToolbarController ) else IFFACTORY( ::framework::WizardsToolbarController ) ) diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index e2ac700d38ab..e6f6dccbbe67 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -20,6 +20,7 @@ #include <framework/menuconfiguration.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <comphelper/processfactory.hxx> +#include <rtl/ref.hxx> #include <svtools/imagemgr.hxx> #include <svtools/miscopt.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -34,6 +35,8 @@ #define UNO_COMMAND_RECENT_FILE_LIST ".uno:RecentFileList" +using namespace framework; + namespace framework { @@ -238,14 +241,35 @@ OpenToolbarController::OpenToolbarController( { } +} // framework -DEFINE_XSERVICEINFO_MULTISERVICE_2( NewToolbarController, - ::cppu::OWeakObject, - "com.sun.star.frame.ToolbarController", - OUString("org.apache.openoffice.comp.framework.NewToolbarController") - ) +namespace { + +class NewToolbarController : public PopupMenuToolbarController +{ +public: + NewToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + + // XServiceInfo + OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException); + + sal_Bool SAL_CALL supportsService(OUString const & rServiceName) + throw (css::uno::RuntimeException); + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException); + + void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); + +private: + void functionExecuted( const OUString &rCommand ); + void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); + void SAL_CALL execute( sal_Int16 KeyModifier ) throw (css::uno::RuntimeException); + void setItemImage( const OUString &rCommand ); -DEFINE_INIT_SERVICE( NewToolbarController, {} ) + OUString m_aLastURL; +}; NewToolbarController::NewToolbarController( const css::uno::Reference< css::uno::XComponentContext >& xContext ) @@ -253,6 +277,27 @@ NewToolbarController::NewToolbarController( { } +OUString NewToolbarController::getImplementationName() + throw (css::uno::RuntimeException) +{ + return OUString("org.apache.openoffice.comp.framework.NewToolbarController"); +} + +sal_Bool NewToolbarController::supportsService(OUString const & rServiceName) + throw (css::uno::RuntimeException) +{ + return rServiceName == "com.sun.star.frame.ToolbarController"; +} + +css::uno::Sequence<OUString> NewToolbarController::getSupportedServiceNames() + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< OUString > aRet(1); + OUString* pArray = aRet.getArray(); + pArray[0] = "com.sun.star.frame.ToolbarController"; + return aRet; +} + void SAL_CALL NewToolbarController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) @@ -438,5 +483,14 @@ void NewToolbarController::setItemImage( const OUString &rCommand ) m_aLastURL = aURL; } +} +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +org_apache_openoffice_comp_framework_NewToolbarController_get_implementation( + css::uno::XComponentContext *context, + css::uno::Sequence<css::uno::Any> const &) +{ + rtl::Reference<NewToolbarController> x(new NewToolbarController(context)); + x->acquire(); + return static_cast<cppu::OWeakObject *>(x.get()); } diff --git a/framework/util/fwk.component b/framework/util/fwk.component index bbdce6214cb4..7a49829be0a4 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -136,7 +136,8 @@ <implementation name="org.apache.openoffice.comp.framework.OpenToolbarController"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> - <implementation name="org.apache.openoffice.comp.framework.NewToolbarController"> + <implementation name="org.apache.openoffice.comp.framework.NewToolbarController" + constructor="org_apache_openoffice_comp_framework_NewToolbarController_get_implementation"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> <implementation name="org.apache.openoffice.comp.framework.WizardsToolbarController"> |