[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source sw/util uui/source uui/util

Matúš Kukan matus.kukan at collabora.com
Wed Feb 5 10:08:55 PST 2014


 sw/inc/SwPanelFactory.hxx               |   71 --------------------------------
 sw/source/ui/sidebar/SwPanelFactory.cxx |   71 ++++++++++++++++----------------
 sw/source/ui/uno/unofreg.cxx            |    9 ----
 sw/util/sw.component                    |    3 -
 uui/source/interactionhandler.cxx       |   44 +++++--------------
 uui/source/interactionhandler.hxx       |   15 ------
 uui/source/services.cxx                 |   20 ---------
 uui/util/uui.component                  |    3 -
 8 files changed, 55 insertions(+), 181 deletions(-)

New commits:
commit fe537786a42abea57551395f73328db48bebd086
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Jan 30 13:21:53 2014 +0100

    uui: Ctor feature for com.sun.star.comp.uui.UUIInteractionHandler.
    
    Change-Id: I94858cef5402e88ddcc3e0e9e4383f7be8443e77

diff --git a/uui/source/interactionhandler.cxx b/uui/source/interactionhandler.cxx
index 207b968..dd71174 100644
--- a/uui/source/interactionhandler.cxx
+++ b/uui/source/interactionhandler.cxx
@@ -20,7 +20,6 @@
 #include "iahndl.hxx"
 #include "interactionhandler.hxx"
 #include "comphelper/namedvaluecollection.hxx"
-#include "comphelper/processfactory.hxx"
 #include <cppuhelper/supportsservice.hxx>
 #include "com/sun/star/awt/XWindow.hpp"
 
@@ -42,7 +41,7 @@ UUIInteractionHandler::~UUIInteractionHandler()
 OUString SAL_CALL UUIInteractionHandler::getImplementationName()
     throw (uno::RuntimeException)
 {
-    return OUString::createFromAscii(m_aImplementationName);
+    return OUString("com.sun.star.comp.uui.UUIInteractionHandler");
 }
 
 sal_Bool SAL_CALL
@@ -56,7 +55,13 @@ uno::Sequence< OUString > SAL_CALL
 UUIInteractionHandler::getSupportedServiceNames()
     throw (uno::RuntimeException)
 {
-    return getSupportedServiceNames_static();
+    uno::Sequence< OUString > aNames(3);
+    aNames[0] = "com.sun.star.task.InteractionHandler";
+    // added to indicate support for configuration.backend.MergeRecoveryRequest
+    aNames[1] = "com.sun.star.configuration.backend.InteractionHandler";
+    aNames[2] = "com.sun.star.uui.InteractionHandler";
+    // for backwards compatibility
+    return aNames;
 }
 
 void SAL_CALL
@@ -119,35 +124,12 @@ UUIInteractionHandler::handle(
     }
 }
 
-char const UUIInteractionHandler::m_aImplementationName[]
-    = "com.sun.star.comp.uui.UUIInteractionHandler";
-
-uno::Sequence< OUString >
-UUIInteractionHandler::getSupportedServiceNames_static()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_uui_UUIInteractionHandler_get_implementation(
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    uno::Sequence< OUString > aNames(3);
-    aNames[0] = "com.sun.star.task.InteractionHandler";
-    // added to indicate support for configuration.backend.MergeRecoveryRequest
-    aNames[1] = "com.sun.star.configuration.backend.InteractionHandler";
-    aNames[2] = "com.sun.star.uui.InteractionHandler";
-    // for backwards compatibility
-    return aNames;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL
-UUIInteractionHandler::createInstance(
-    uno::Reference< lang::XMultiServiceFactory > const &
-        rServiceFactory)
-    SAL_THROW((uno::Exception))
-{
-    try
-    {
-        return *new UUIInteractionHandler(comphelper::getComponentContext(rServiceFactory));
-    }
-    catch (std::bad_alloc const &)
-    {
-        throw uno::RuntimeException("out of memory", 0);
-    }
+    return cppu::acquire(new UUIInteractionHandler(context));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/interactionhandler.hxx b/uui/source/interactionhandler.hxx
index a8d7595..d5ea999 100644
--- a/uui/source/interactionhandler.hxx
+++ b/uui/source/interactionhandler.hxx
@@ -32,26 +32,13 @@ class UUIInteractionHandler:
                                   com::sun::star::lang::XInitialization,
                                   com::sun::star::task::XInteractionHandler2 >
 {
-public:
-    static char const m_aImplementationName[];
-
-    static com::sun::star::uno::Sequence< OUString >
-    getSupportedServiceNames_static();
-
-    static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-    SAL_CALL
-    createInstance(
-        com::sun::star::uno::Reference<
-                com::sun::star::lang::XMultiServiceFactory > const &
-            rServiceFactory)
-        SAL_THROW((com::sun::star::uno::Exception));
-
 private:
     UUIInteractionHelper * m_pImpl;
 
     UUIInteractionHandler(UUIInteractionHandler &); // not implemented
     void operator =(UUIInteractionHandler); // not implemented
 
+public:
     UUIInteractionHandler(com::sun::star::uno::Reference<
                   com::sun::star::uno::XComponentContext >
                   const & rxContext)
diff --git a/uui/source/services.cxx b/uui/source/services.cxx
index f2d7c76..642f863 100644
--- a/uui/source/services.cxx
+++ b/uui/source/services.cxx
@@ -24,7 +24,6 @@
 #include <sal/types.h>
 #include <uno/environment.h>
 
-#include "interactionhandler.hxx"
 #include "requeststringresolver.hxx"
 #include "passwordcontainer.hxx"
 
@@ -48,27 +47,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL uui_component_getFactory(sal_Cha
     Reference< XSingleServiceFactory > xFactory;
 
     //////////////////////////////////////////////////////////////////////
-    // UUI Interaction Handler.
-    //////////////////////////////////////////////////////////////////////
-
-    if ( rtl_str_compare(pImplName,
-                         UUIInteractionHandler::m_aImplementationName)
-         == 0)
-    {
-        xFactory =
-            cppu::createSingleFactory(
-                static_cast< XMultiServiceFactory * >(pServiceManager),
-                OUString::createFromAscii(
-                    UUIInteractionHandler::m_aImplementationName),
-                &UUIInteractionHandler::createInstance,
-                UUIInteractionHandler::getSupportedServiceNames_static());
-    }
-
-    //////////////////////////////////////////////////////////////////////
     // UUI Interaction Request String Resolver.
     //////////////////////////////////////////////////////////////////////
 
-    else if ( rtl_str_compare(pImplName,
+    if ( rtl_str_compare(pImplName,
                   UUIInteractionRequestStringResolver::m_aImplementationName)
           == 0)
     {
diff --git a/uui/util/uui.component b/uui/util/uui.component
index 569ac4a..8989879 100644
--- a/uui/util/uui.component
+++ b/uui/util/uui.component
@@ -23,7 +23,8 @@
       name="com.sun.star.comp.uui.PasswordContainerInteractionHandler">
     <service name="com.sun.star.task.PasswordContainerInteractionHandler"/>
   </implementation>
-  <implementation name="com.sun.star.comp.uui.UUIInteractionHandler">
+  <implementation name="com.sun.star.comp.uui.UUIInteractionHandler"
+      constructor="com_sun_star_comp_uui_UUIInteractionHandler_get_implementation">
     <service name="com.sun.star.configuration.backend.InteractionHandler"/>
     <service name="com.sun.star.task.InteractionHandler"/>
     <service name="com.sun.star.uui.InteractionHandler"/>
commit 1d77f5ce5e13720d46b41fd3ee4c7fe1d92a9839
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Jan 30 13:07:28 2014 +0100

    sw: Ctor feature for sw.sidebar.SwPanelFactory
    
    Change-Id: I6854bdf96f050b7f333803d068fe681df92ed3e6

diff --git a/sw/inc/SwPanelFactory.hxx b/sw/inc/SwPanelFactory.hxx
deleted file mode 100644
index 23e352d..0000000
--- 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 46edc90..c40c7df 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 4c36a3c..f2c71a4 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 b125120..46cdc67 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>


More information about the Libreoffice-commits mailing list