summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-09 10:36:10 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-10 10:09:39 +0100
commit5aaf6afd4307a9fb6bc809f51dc457491d1e3886 (patch)
tree21b33691668b70c1d92e889c569bbd73a6662ccf
parent8f84aa5e91a36788d3aff834729b07ff689376be (diff)
fwk: Use constructor feature for NewToolbarController.
Change-Id: Ic087dbce11572789bab749b0b4fb0be4a80f274d
-rw-r--r--framework/inc/uielement/popuptoolbarcontroller.hxx17
-rw-r--r--framework/source/register/registerservices.cxx1
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx71
-rw-r--r--framework/util/fwk.component3
4 files changed, 67 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..aa4cfbcb0eda 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,19 @@ 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,
+ uno_Sequence * arguments)
+{
+ assert(arguments != 0);
+ rtl::Reference<NewToolbarController> x(new NewToolbarController(context));
+ css::uno::Sequence<css::uno::Any> aArgs(
+ reinterpret_cast<css::uno::Any *>(arguments->elements),
+ arguments->nElements);
+ x->initialize(aArgs);
+ 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">