Kaydet (Commit) 1d77f5ce authored tarafından Matúš Kukan's avatar Matúš Kukan

sw: Ctor feature for sw.sidebar.SwPanelFactory

Change-Id: I6854bdf96f050b7f333803d068fe681df92ed3e6
üst 351cfed9
/* -*- 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_SW_INC_SWPANELFACTORY_HXX
#define INCLUDED_SW_INC_SWPANELFACTORY_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 sw { namespace sidebar {
namespace
{
typedef ::cppu::WeakComponentImplHelper1 <
css::ui::XUIElementFactory
> PanelFactoryInterfaceBase;
}
class SwPanelFactory
: 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);
SwPanelFactory(void);
virtual ~SwPanelFactory(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 sw::sidebar
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "SwPanelFactory.hxx" #include <com/sun/star/ui/XUIElementFactory.hpp>
#include <PagePropertyPanel.hxx> #include <PagePropertyPanel.hxx>
#include <WrapPropertyPanel.hxx> #include <WrapPropertyPanel.hxx>
...@@ -29,44 +29,39 @@ ...@@ -29,44 +29,39 @@
#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/compbase1.hxx>
#include <cppuhelper/basemutex.hxx>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/noncopyable.hpp>
using namespace css; using namespace css;
using namespace cssu; using namespace css::uno;
using ::rtl::OUString;
namespace sw { namespace sidebar {
#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.sw.sidebar.SwPanelFactory" namespace {
#define SERVICE_NAME "com.sun.star.ui.UIElementFactory"
typedef ::cppu::WeakComponentImplHelper1 <
css::ui::XUIElementFactory
> PanelFactoryInterfaceBase;
::rtl::OUString SAL_CALL SwPanelFactory::getImplementationName (void) class SwPanelFactory
: private ::boost::noncopyable,
private ::cppu::BaseMutex,
public PanelFactoryInterfaceBase
{ {
return OUString(IMPLEMENTATION_NAME); public:
} SwPanelFactory(void);
virtual ~SwPanelFactory(void);
cssu::Reference<cssu::XInterface> SAL_CALL SwPanelFactory::createInstance( // XUIElementFactory
const uno::Reference<lang::XMultiServiceFactory>& ) cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement(
{ const ::rtl::OUString& rsResourceURL,
::rtl::Reference<SwPanelFactory> pPanelFactory (new SwPanelFactory()); const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY); throw(
return xService; css::container::NoSuchElementException,
} css::lang::IllegalArgumentException,
cssu::RuntimeException );
};
cssu::Sequence<OUString> SAL_CALL SwPanelFactory::getSupportedServiceNames (void)
{
cssu::Sequence<OUString> aServiceNames (1);
aServiceNames[0] = SERVICE_NAME;
return aServiceNames;
}
SwPanelFactory::SwPanelFactory (void) SwPanelFactory::SwPanelFactory (void)
: PanelFactoryInterfaceBase(m_aMutex) : PanelFactoryInterfaceBase(m_aMutex)
...@@ -112,7 +107,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( ...@@ -112,7 +107,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) #define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
if (DoesResourceEndWith("/PagePropertyPanel")) if (DoesResourceEndWith("/PagePropertyPanel"))
{ {
PagePropertyPanel* pPanel = PagePropertyPanel::Create( pParentWindow, xFrame, pBindings ); sw::sidebar::PagePropertyPanel* pPanel = sw::sidebar::PagePropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create( xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL, rsResourceURL,
xFrame, xFrame,
...@@ -121,7 +116,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( ...@@ -121,7 +116,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
} }
else if (DoesResourceEndWith("/WrapPropertyPanel")) else if (DoesResourceEndWith("/WrapPropertyPanel"))
{ {
WrapPropertyPanel* pPanel = WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings ); sw::sidebar::WrapPropertyPanel* pPanel = sw::sidebar::WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create( xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL, rsResourceURL,
xFrame, xFrame,
...@@ -142,8 +137,14 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( ...@@ -142,8 +137,14 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
return xElement; return xElement;
} }
} } // end of namespace sw::sidebar }
// eof extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
org_apache_openoffice_comp_sw_sidebar_SwPanelFactory_get_implementation(
css::uno::XComponentContext *,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new SwPanelFactory());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -132,8 +132,6 @@ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL _crea ...@@ -132,8 +132,6 @@ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL _crea
} }
#include "SwPanelFactory.hxx"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
...@@ -353,13 +351,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory( ...@@ -353,13 +351,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory(
LayoutDumpFilter_createInstance, LayoutDumpFilter_createInstance,
LayoutDumpFilter_getSupportedServiceNames() ); LayoutDumpFilter_getSupportedServiceNames() );
} }
else if ( ::sw::sidebar::SwPanelFactory::getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
{
xFactory = ::cppu::createSingleFactory( xMSF,
::sw::sidebar::SwPanelFactory::getImplementationName(),
::sw::sidebar::SwPanelFactory::createInstance,
::sw::sidebar::SwPanelFactory::getSupportedServiceNames() );
}
else if( comp_FinalThreadManager::_getImplementationName().equalsAsciiL( else if( comp_FinalThreadManager::_getImplementationName().equalsAsciiL(
pImplName, nImplNameLen ) ) pImplName, nImplNameLen ) )
{ {
......
...@@ -94,7 +94,8 @@ ...@@ -94,7 +94,8 @@
<implementation name="com.sun.star.comp.Writer.LayoutDump"> <implementation name="com.sun.star.comp.Writer.LayoutDump">
<service name="com.sun.star.comp.Writer.LayoutDump"/> <service name="com.sun.star.comp.Writer.LayoutDump"/>
</implementation> </implementation>
<implementation name="org.apache.openoffice.comp.sw.sidebar.SwPanelFactory"> <implementation name="org.apache.openoffice.comp.sw.sidebar.SwPanelFactory"
constructor="org_apache_openoffice_comp_sw_sidebar_SwPanelFactory_get_implementation">
<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