diff options
-rw-r--r-- | sw/inc/SwPanelFactory.hxx | 71 | ||||
-rw-r--r-- | sw/source/ui/sidebar/SwPanelFactory.cxx | 71 | ||||
-rw-r--r-- | sw/source/ui/uno/unofreg.cxx | 9 | ||||
-rw-r--r-- | sw/util/sw.component | 3 |
4 files changed, 38 insertions, 116 deletions
diff --git a/sw/inc/SwPanelFactory.hxx b/sw/inc/SwPanelFactory.hxx deleted file mode 100644 index 23e352dcef8c..000000000000 --- a/sw/inc/SwPanelFactory.hxx +++ /dev/null @@ -1,71 +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_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: */ diff --git a/sw/source/ui/sidebar/SwPanelFactory.cxx b/sw/source/ui/sidebar/SwPanelFactory.cxx index 46edc90b1cb5..c40c7dfdfaa0 100644 --- a/sw/source/ui/sidebar/SwPanelFactory.cxx +++ b/sw/source/ui/sidebar/SwPanelFactory.cxx @@ -17,7 +17,7 @@ * 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 <WrapPropertyPanel.hxx> @@ -29,44 +29,39 @@ #include <vcl/window.hxx> #include <rtl/ref.hxx> #include <comphelper/namedvaluecollection.hxx> +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> #include <boost/bind.hpp> - +#include <boost/noncopyable.hpp> using namespace css; -using namespace cssu; -using ::rtl::OUString; - - -namespace sw { namespace sidebar { +using namespace css::uno; -#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.sw.sidebar.SwPanelFactory" -#define SERVICE_NAME "com.sun.star.ui.UIElementFactory" +namespace { +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); -} - - -cssu::Reference<cssu::XInterface> SAL_CALL SwPanelFactory::createInstance( - const uno::Reference<lang::XMultiServiceFactory>& ) -{ - ::rtl::Reference<SwPanelFactory> pPanelFactory (new SwPanelFactory()); - cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY); - return xService; -} - - -cssu::Sequence<OUString> SAL_CALL SwPanelFactory::getSupportedServiceNames (void) -{ - cssu::Sequence<OUString> aServiceNames (1); - aServiceNames[0] = SERVICE_NAME; - return aServiceNames; - -} - +public: + 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 ); +}; SwPanelFactory::SwPanelFactory (void) : PanelFactoryInterfaceBase(m_aMutex) @@ -112,7 +107,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( #define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) 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( rsResourceURL, xFrame, @@ -121,7 +116,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( } 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( rsResourceURL, xFrame, @@ -142,8 +137,14 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( 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: */ diff --git a/sw/source/ui/uno/unofreg.cxx b/sw/source/ui/uno/unofreg.cxx index 4c36a3caf4a8..f2c71a4fb8cb 100644 --- a/sw/source/ui/uno/unofreg.cxx +++ b/sw/source/ui/uno/unofreg.cxx @@ -132,8 +132,6 @@ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL _crea } -#include "SwPanelFactory.hxx" - #ifdef __cplusplus extern "C" { @@ -353,13 +351,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory( LayoutDumpFilter_createInstance, 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( pImplName, nImplNameLen ) ) { diff --git a/sw/util/sw.component b/sw/util/sw.component index b125120c8172..46cdc6730cbc 100644 --- a/sw/util/sw.component +++ b/sw/util/sw.component @@ -94,7 +94,8 @@ <implementation name="com.sun.star.comp.Writer.LayoutDump"> <service name="com.sun.star.comp.Writer.LayoutDump"/> </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"/> </implementation> </component> |