summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-09 10:56:09 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-10 10:10:34 +0100
commite69d96448a72386f808dc092f75358784482c6c8 (patch)
treedbe1724286f1971c3ead98c6ccfb6117f96f5075
parent80f4c3ed260a5aeb0bee261b6b9ca02497d81e31 (diff)
fwk: Use constructor feature for WizardsToolbarController.
Change-Id: I5bc8e2e212e97f216f828dfea1fbcda59adda4e4
-rw-r--r--framework/inc/uielement/popuptoolbarcontroller.hxx74
-rw-r--r--framework/source/register/registerservices.cxx4
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx102
-rw-r--r--framework/util/fwk.component3
4 files changed, 93 insertions, 90 deletions
diff --git a/framework/inc/uielement/popuptoolbarcontroller.hxx b/framework/inc/uielement/popuptoolbarcontroller.hxx
deleted file mode 100644
index f0f8f57a676b..000000000000
--- a/framework/inc/uielement/popuptoolbarcontroller.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_POPUPTOOLBARCONTROLLER_HXX
-#define INCLUDED_FRAMEWORK_INC_UIELEMENT_POPUPTOOLBARCONTROLLER_HXX
-
-#include <com/sun/star/awt/XPopupMenu.hpp>
-#include <com/sun/star/frame/XPopupMenuController.hpp>
-#include <com/sun/star/frame/XUIControllerFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <macros/xserviceinfo.hxx>
-#include <svtools/toolboxcontroller.hxx>
-
-namespace framework
-{
- class PopupMenuToolbarController : public svt::ToolboxController
- {
- public:
- virtual ~PopupMenuToolbarController();
-
- // XComponent
- virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
- // XInitialization
- virtual 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);
- // XToolbarController
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
- // XStatusListener
- virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException );
-
- protected:
- PopupMenuToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
- const OUString &rPopupCommand = OUString() );
- virtual void functionExecuted( const OUString &rCommand );
- virtual sal_uInt16 getDropDownStyle() const;
- void createPopupMenuController();
-
- com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
- sal_Bool m_bHasController;
- com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > m_xPopupMenu;
-
- private:
- OUString m_aPopupCommand;
- com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > m_xPopupMenuFactory;
- com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > m_xPopupMenuController;
- };
-
- class WizardsToolbarController : public PopupMenuToolbarController
- {
- public:
- WizardsToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
-
- // XServiceInfo
- DECLARE_XSERVICEINFO
- private:
- sal_uInt16 getDropDownStyle() const;
- };
-}
-
-#endif
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index a5b63322d9cf..8cced2d96412 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -70,7 +70,6 @@
#include <services/substitutepathvars.hxx>
#include <services/pathsettings.hxx>
#include <services/ContextChangeEventMultiplexer.hxx>
-#include <uielement/popuptoolbarcontroller.hxx>
COMPONENTGETFACTORY ( fwk,
IFFACTORY( ::framework::URLTransformer ) else
@@ -111,8 +110,7 @@ COMPONENTGETFACTORY ( fwk,
IFFACTORY( ::framework::TabWindowService ) else
IFFACTORY( ::framework::SubstitutePathVariables ) else
IFFACTORY( ::framework::PathSettings ) else
- IFFACTORY( ::framework::ContextChangeEventMultiplexer ) else
- IFFACTORY( ::framework::WizardsToolbarController )
+ IFFACTORY( ::framework::ContextChangeEventMultiplexer )
)
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index d4431eef356d..e52d13d8d38f 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -16,13 +16,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <uielement/popuptoolbarcontroller.hxx>
#include <framework/menuconfiguration.hxx>
#include <toolkit/awt/vclxmenu.hxx>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <rtl/ref.hxx>
#include <svtools/imagemgr.hxx>
#include <svtools/miscopt.hxx>
+#include <svtools/toolboxcontroller.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/urlobj.hxx>
#include <unotools/moduleoptions.hxx>
@@ -30,15 +31,49 @@
#include <vcl/toolbox.hxx>
#include <com/sun/star/awt/PopupMenuDirection.hpp>
+#include <com/sun/star/awt/XPopupMenu.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#define UNO_COMMAND_RECENT_FILE_LIST ".uno:RecentFileList"
using namespace framework;
-namespace framework
+namespace {
+
+class PopupMenuToolbarController : public svt::ToolboxController
{
+public:
+ virtual ~PopupMenuToolbarController();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException);
+ // XToolbarController
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() throw (css::uno::RuntimeException);
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException );
+
+protected:
+ PopupMenuToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString &rPopupCommand = OUString() );
+ virtual void functionExecuted( const OUString &rCommand );
+ virtual sal_uInt16 getDropDownStyle() const;
+ void createPopupMenuController();
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ sal_Bool m_bHasController;
+ css::uno::Reference< css::awt::XPopupMenu > m_xPopupMenu;
+
+private:
+ OUString m_aPopupCommand;
+ css::uno::Reference< css::frame::XUIControllerFactory > m_xPopupMenuFactory;
+ css::uno::Reference< css::frame::XPopupMenuController > m_xPopupMenuController;
+};
PopupMenuToolbarController::PopupMenuToolbarController(
const css::uno::Reference< css::uno::XComponentContext >& xContext,
@@ -208,13 +243,24 @@ void PopupMenuToolbarController::createPopupMenuController()
}
}
-DEFINE_XSERVICEINFO_MULTISERVICE_2( WizardsToolbarController,
- ::cppu::OWeakObject,
- "com.sun.star.frame.ToolbarController",
- OUString("org.apache.openoffice.comp.framework.WizardsToolbarController")
- )
+class WizardsToolbarController : public PopupMenuToolbarController
+{
+public:
+ WizardsToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException);
-DEFINE_INIT_SERVICE( WizardsToolbarController, {} )
+ sal_Bool SAL_CALL supportsService(OUString const & rServiceName)
+ throw (css::uno::RuntimeException);
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+ throw (css::uno::RuntimeException);
+
+private:
+ sal_uInt16 getDropDownStyle() const;
+};
WizardsToolbarController::WizardsToolbarController(
const css::uno::Reference< css::uno::XComponentContext >& xContext )
@@ -222,14 +268,31 @@ WizardsToolbarController::WizardsToolbarController(
{
}
-sal_uInt16 WizardsToolbarController::getDropDownStyle() const
+OUString WizardsToolbarController::getImplementationName()
+ throw (css::uno::RuntimeException)
{
- return TIB_DROPDOWNONLY;
+ return OUString("org.apache.openoffice.comp.framework.WizardsToolbarController");
}
-} // framework
+sal_Bool WizardsToolbarController::supportsService(OUString const & rServiceName)
+ throw (css::uno::RuntimeException)
+{
+ return rServiceName == "com.sun.star.frame.ToolbarController";
+}
-namespace {
+css::uno::Sequence<OUString> WizardsToolbarController::getSupportedServiceNames()
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = "com.sun.star.frame.ToolbarController";
+ return aRet;
+}
+
+sal_uInt16 WizardsToolbarController::getDropDownStyle() const
+{
+ return TIB_DROPDOWNONLY;
+}
class OpenToolbarController : public PopupMenuToolbarController
{
@@ -515,6 +578,21 @@ void NewToolbarController::setItemImage( const OUString &rCommand )
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+org_apache_openoffice_comp_framework_WizardsToolbarController_get_implementation(
+ css::uno::XComponentContext * context,
+ uno_Sequence * arguments)
+{
+ assert(arguments != 0);
+ rtl::Reference<WizardsToolbarController> x(new WizardsToolbarController(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());
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
org_apache_openoffice_comp_framework_OpenToolbarController_get_implementation(
css::uno::XComponentContext * context,
uno_Sequence * arguments)
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 79d75278c7c4..a1fe849c0d58 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -141,7 +141,8 @@
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">
+ <implementation name="org.apache.openoffice.comp.framework.WizardsToolbarController"
+ constructor="org_apache_openoffice_comp_framework_WizardsToolbarController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
</component>