summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-09 14:01:05 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-10 10:23:29 +0100
commitbcda535f96f858c6176f9b2c0a3575804a78a10a (patch)
tree16e9f8185f02b1662dc302cd55d1dc1fc7313a2d
parentc324047398ec550c84ff316b017cc905e129de0a (diff)
fwk: Use constructor feature for PopupMenuControllerFactory.
Change-Id: Id433edc6f66a4595cf144c18e437abf7950c7438
-rw-r--r--framework/inc/uifactory/uicontrollerfactory.hxx83
-rw-r--r--framework/source/register/registerservices.cxx2
-rw-r--r--framework/source/uifactory/uicontrollerfactory.cxx84
-rw-r--r--framework/util/fwk.component3
4 files changed, 69 insertions, 103 deletions
diff --git a/framework/inc/uifactory/uicontrollerfactory.hxx b/framework/inc/uifactory/uicontrollerfactory.hxx
deleted file mode 100644
index e7df645db3fb..000000000000
--- a/framework/inc/uifactory/uicontrollerfactory.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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_UIFACTORY_UICONTROLLERFACTORY_HXX
-#define INCLUDED_FRAMEWORK_INC_UIFACTORY_UICONTROLLERFACTORY_HXX
-
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
-#include <macros/xserviceinfo.hxx>
-#include <stdtypes.h>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/frame/XUIControllerFactory.hpp>
-
-#include <cppuhelper/implbase2.hxx>
-
-namespace framework
-{
-
-class ConfigurationAccess_ControllerFactory;
-class UIControllerFactory : protected ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::WeakImplHelper2<
- com::sun::star::lang::XServiceInfo,
- com::sun::star::frame::XUIControllerFactory >
-{
- public:
- virtual ~UIControllerFactory();
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0;
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) = 0;
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0;
-
- // XMultiComponentFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const OUString& aServiceSpecifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
- // XUIControllerRegistration
- virtual sal_Bool SAL_CALL hasController( const OUString& aCommandURL, const OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL registerController( const OUString& aCommandURL, const OUString& aModuleName, const OUString& aControllerImplementationName ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deregisterController( const OUString& aCommandURL, const OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
-
- protected:
- UIControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, const rtl::OUString &rUINode );
- sal_Bool m_bConfigRead;
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
- ConfigurationAccess_ControllerFactory* m_pConfigAccess;
-};
-
-class PopupMenuControllerFactory : public UIControllerFactory
-{
- public:
- PopupMenuControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
-
- // XInterface, XTypeProvider, XServiceInfo
- DECLARE_XSERVICEINFO
-};
-
-}
-
-#endif // INCLUDED_FRAMEWORK_INC_UIFACTORY_UICONTROLLERFACTORY_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index a35f8a1c3c8b..57b435bc6987 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -41,7 +41,6 @@
#include <jobs/jobdispatch.hxx>
#include <services/layoutmanager.hxx>
#include <uifactory/uielementfactorymanager.hxx>
-#include <uifactory/uicontrollerfactory.hxx>
#include <uielement/objectmenucontroller.hxx>
#include <uielement/controlmenucontroller.hxx>
#include <uielement/uicommanddescription.hxx>
@@ -75,7 +74,6 @@ COMPONENTGETFACTORY ( fwk,
IFFACTORY( ::framework::JobDispatch ) else
IFFACTORY( ::framework::LayoutManager ) else
IFFACTORY( ::framework::UIElementFactoryManager ) else
- IFFACTORY( ::framework::PopupMenuControllerFactory ) else
IFFACTORY( ::framework::ObjectMenuController ) else
IFFACTORY( ::framework::ControlMenuController ) else
IFFACTORY( ::framework::UICommandDescription ) else
diff --git a/framework/source/uifactory/uicontrollerfactory.cxx b/framework/source/uifactory/uicontrollerfactory.cxx
index f6d539a20fba..f3624de2d7a4 100644
--- a/framework/source/uifactory/uicontrollerfactory.cxx
+++ b/framework/source/uifactory/uicontrollerfactory.cxx
@@ -17,29 +17,66 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <uifactory/uicontrollerfactory.hxx>
#include <uifactory/factoryconfiguration.hxx>
#include <threadhelp/resetableguard.hxx>
#include "services.h"
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.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/lang/XServiceInfo.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
#include <rtl/ustrbuf.hxx>
#include <rtl/ref.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/weak.hxx>
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::container;
-using namespace ::com::sun::star::frame;
+#include <threadhelp/threadhelpbase.hxx>
+#include <macros/generic.hxx>
+#include <macros/xinterface.hxx>
+#include <macros/xtypeprovider.hxx>
+#include <macros/xserviceinfo.hxx>
+
+using namespace css::uno;
+using namespace css::lang;
+using namespace css::beans;
+using namespace css::container;
+using namespace css::frame;
+using namespace framework;
+
+namespace framework { class ConfigurationAccess_ControllerFactory; }
+
+namespace {
-namespace framework
+class UIControllerFactory : protected ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2<
+ css::lang::XServiceInfo,
+ css::frame::XUIControllerFactory >
{
+ public:
+ virtual ~UIControllerFactory();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) = 0;
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException) = 0;
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException) = 0;
+
+ // XMultiComponentFactory
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithContext( const OUString& aServiceSpecifier, const css::uno::Reference< css::uno::XComponentContext >& Context ) throw (css::uno::Exception, css::uno::RuntimeException);
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments, const css::uno::Reference< css::uno::XComponentContext >& Context ) throw (css::uno::Exception, css::uno::RuntimeException);
+ virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (css::uno::RuntimeException);
+
+ // XUIControllerRegistration
+ virtual sal_Bool SAL_CALL hasController( const OUString& aCommandURL, const OUString& aModuleName ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL registerController( const OUString& aCommandURL, const OUString& aModuleName, const OUString& aControllerImplementationName ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL deregisterController( const OUString& aCommandURL, const OUString& aModuleName ) throw (css::uno::RuntimeException);
+
+ protected:
+ UIControllerFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString &rUINode );
+ sal_Bool m_bConfigRead;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ ConfigurationAccess_ControllerFactory* m_pConfigAccess;
+};
UIControllerFactory::UIControllerFactory(
const Reference< XComponentContext >& xContext,
@@ -166,7 +203,7 @@ throw (RuntimeException)
sal_Bool SAL_CALL UIControllerFactory::hasController(
const OUString& aCommandURL,
const OUString& aModuleName )
-throw (::com::sun::star::uno::RuntimeException)
+throw (css::uno::RuntimeException)
{
ResetableGuard aLock( m_aLock );
@@ -216,6 +253,14 @@ throw (RuntimeException)
// SAFE
}
+class PopupMenuControllerFactory : public UIControllerFactory
+{
+ public:
+ PopupMenuControllerFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+
+ // XInterface, XTypeProvider, XServiceInfo
+ DECLARE_XSERVICEINFO
+};
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( PopupMenuControllerFactory ,
::cppu::OWeakObject ,
@@ -232,12 +277,6 @@ PopupMenuControllerFactory::PopupMenuControllerFactory( const Reference< XCompon
{
}
-} // namespace framework
-
-using namespace framework;
-
-namespace {
-
class ToolbarControllerFactory : public UIControllerFactory
{
public:
@@ -289,6 +328,17 @@ StatusbarControllerFactory::StatusbarControllerFactory( const Reference< XCompon
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_PopupMenuControllerFactory_get_implementation(
+ css::uno::XComponentContext * context,
+ uno_Sequence * arguments)
+{
+ assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+ rtl::Reference<PopupMenuControllerFactory> x(new PopupMenuControllerFactory(context));
+ x->acquire();
+ return static_cast<cppu::OWeakObject *>(x.get());
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation(
css::uno::XComponentContext * context,
uno_Sequence * arguments)
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index a35aff32dc95..fff861c36439 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -85,7 +85,8 @@
<implementation name="com.sun.star.comp.framework.PathSubstitution">
<service name="com.sun.star.util.PathSubstitution"/>
</implementation>
- <implementation name="com.sun.star.comp.framework.PopupMenuControllerFactory">
+ <implementation name="com.sun.star.comp.framework.PopupMenuControllerFactory"
+ constructor="com_sun_star_comp_framework_PopupMenuControllerFactory_get_implementation">
<service name="com.sun.star.frame.PopupMenuControllerFactory"/>
</implementation>
<implementation name="com.sun.star.comp.framework.RecentFilesMenuController">