Kaydet (Commit) 02eb7511 authored tarafından Matúš Kukan's avatar Matúš Kukan

svx: Use constructor feature for sidebar::PanelFactory.

Change-Id: Iafc01d943c9862a8e8775b79b81c885ab9565dbc
üst abcca7ae
/*
* 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_SVX_INC_SIDEBAR_PANELFACTORY_HXX
#define INCLUDED_SVX_INC_SIDEBAR_PANELFACTORY_HXX
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/ui/XUIElementFactory.hpp>
#include <boost/noncopyable.hpp>
namespace cssu = ::com::sun::star::uno;
namespace svx { namespace sidebar {
namespace
{
typedef ::cppu::WeakComponentImplHelper1 <
css::ui::XUIElementFactory
> PanelFactoryInterfaceBase;
}
class PanelFactory
: private ::boost::noncopyable,
private ::cppu::BaseMutex,
public PanelFactoryInterfaceBase
{
public:
static ::rtl::OUString SAL_CALL getImplementationName (void);
static cssu::Reference<cssu::XInterface> SAL_CALL createInstance (
const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory);
static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void);
PanelFactory (void);
virtual ~PanelFactory (void);
// XUIElementFactory
cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement (
const ::rtl::OUString& rsResourceURL,
const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
throw(
css::container::NoSuchElementException,
css::lang::IllegalArgumentException,
cssu::RuntimeException);
};
} } // end of namespace svx::sidebar
#endif
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "sidebar/PanelFactory.hxx"
#include "GalleryControl.hxx" #include "GalleryControl.hxx"
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "sidebar/PanelFactory.hxx"
#include "text/TextPropertyPanel.hxx" #include "text/TextPropertyPanel.hxx"
#include "paragraph/ParaPropertyPanel.hxx" #include "paragraph/ParaPropertyPanel.hxx"
...@@ -37,53 +36,48 @@ ...@@ -37,53 +36,48 @@
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <comphelper/namedvaluecollection.hxx> #include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase1.hxx>
#include <com/sun/star/ui/XSidebar.hpp> #include <com/sun/star/ui/XSidebar.hpp>
#include <com/sun/star/ui/XUIElementFactory.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/noncopyable.hpp>
namespace cssu = ::com::sun::star::uno;
using namespace css; using namespace css;
using namespace cssu; using namespace cssu;
using ::rtl::OUString; using namespace svx::sidebar;
namespace svx { namespace sidebar { namespace {
/* Why this is not used ? Doesn't it need to inherit from XServiceInfo ?
#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.svx.sidebar.PanelFactory" #define IMPLEMENTATION_NAME "org.apache.openoffice.comp.svx.sidebar.PanelFactory"
#define SERVICE_NAME "com.sun.star.ui.UIElementFactory" #define SERVICE_NAME "com.sun.star.ui.UIElementFactory"
*/
typedef ::cppu::WeakComponentImplHelper1< css::ui::XUIElementFactory >
PanelFactoryInterfaceBase;
::rtl::OUString SAL_CALL PanelFactory::getImplementationName (void) class PanelFactory
{ : private ::boost::noncopyable,
return OUString(IMPLEMENTATION_NAME); private ::cppu::BaseMutex,
} public PanelFactoryInterfaceBase
cssu::Reference<cssu::XInterface> SAL_CALL PanelFactory::createInstance (
const uno::Reference<lang::XMultiServiceFactory>& rxFactory)
{
(void)rxFactory;
::rtl::Reference<PanelFactory> pPanelFactory (new PanelFactory());
cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY);
return xService;
}
cssu::Sequence<OUString> SAL_CALL PanelFactory::getSupportedServiceNames (void)
{ {
cssu::Sequence<OUString> aServiceNames (1); public:
aServiceNames[0] = SERVICE_NAME; PanelFactory (void);
return aServiceNames; virtual ~PanelFactory (void);
} // XUIElementFactory
cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement (
const ::rtl::OUString& rsResourceURL,
const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
throw(
css::container::NoSuchElementException,
css::lang::IllegalArgumentException,
cssu::RuntimeException);
};
PanelFactory::PanelFactory (void) PanelFactory::PanelFactory (void)
: PanelFactoryInterfaceBase(m_aMutex) : PanelFactoryInterfaceBase(m_aMutex)
...@@ -208,6 +202,16 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( ...@@ -208,6 +202,16 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
return Reference<ui::XUIElement>(); return Reference<ui::XUIElement>();
} }
} } // end of namespace svx::sidebar }
// eof extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
org_apache_openoffice_comp_svx_sidebar_PanelFactory_implementation_getFactory(
SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
uno_Sequence * arguments)
{
assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
css::uno::Reference<css::uno::XInterface> x(
static_cast<cppu::OWeakObject *>(new PanelFactory));
x->acquire();
return x.get();
}
...@@ -230,8 +230,6 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con ...@@ -230,8 +230,6 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con
#include "osl/diagnose.h" #include "osl/diagnose.h"
#include "cppuhelper/factory.hxx" #include "cppuhelper/factory.hxx"
#include <svx/sdr/primitive2d/primitiveFactory2d.hxx> #include <svx/sdr/primitive2d/primitiveFactory2d.hxx>
#include "sidebar/PanelFactory.hxx"
extern "C" extern "C"
{ {
...@@ -366,14 +364,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory ( ...@@ -366,14 +364,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory (
::svx::SvXMLGraphicExportHelper_createInstance, ::svx::SvXMLGraphicExportHelper_createInstance,
::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() ); ::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() );
} }
else if (::svx::sidebar::PanelFactory::getImplementationName().equalsAscii(pImplName))
{
xFactory = ::cppu::createSingleFactory(
reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
::svx::sidebar::PanelFactory::getImplementationName(),
::svx::sidebar::PanelFactory::createInstance,
::svx::sidebar::PanelFactory::getSupportedServiceNames());
}
if( xFactory.is()) if( xFactory.is())
{ {
......
...@@ -73,7 +73,8 @@ ...@@ -73,7 +73,8 @@
<implementation name="com.sun.star.svx.ExitFindbarToolboxController"> <implementation name="com.sun.star.svx.ExitFindbarToolboxController">
<service name="com.sun.star.frame.ToolbarController"/> <service name="com.sun.star.frame.ToolbarController"/>
</implementation> </implementation>
<implementation name="org.apache.openoffice.comp.svx.sidebar.PanelFactory"> <implementation name="org.apache.openoffice.comp.svx.sidebar.PanelFactory"
constructor="org_apache_openoffice_comp_svx_sidebar_PanelFactory_implementation_getFactory">
<service name="com.sun.star.ui.UIElementFactory"/> <service name="com.sun.star.ui.UIElementFactory"/>
</implementation> </implementation>
</component> </component>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment