[Libreoffice-commits] core.git: 2 commits - dbaccess/source dbaccess/util sw/qa

Matúš Kukan matus.kukan at gmail.com
Sat Dec 12 08:23:48 PST 2015


 dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx |   78 +++++----------
 dbaccess/source/core/inc/services.hxx                    |   31 -----
 dbaccess/source/core/misc/services.cxx                   |   25 ----
 dbaccess/util/dba.component                              |    3 
 sw/qa/extras/uiwriter/data/tdf34957.odt                  |binary
 5 files changed, 31 insertions(+), 106 deletions(-)

New commits:
commit 0769ad9284c4d71ab11e4460c0f380eca8d4c788
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Sat Dec 5 07:56:36 2015 +0100

    test for tdf#34957: change font in test document to make it work here
    
    Previously the text was too long, ending on second page,
    and table was on third page here, but is expected on second.
    Change font to 'Liberation Serif' which seems to be used elsewhere,
    and set line spacing to 'single' which makes the test succeed.
    
    Change-Id: I4fc903c5d83308608e70e3e440d5277abd487052

diff --git a/sw/qa/extras/uiwriter/data/tdf34957.odt b/sw/qa/extras/uiwriter/data/tdf34957.odt
index 5aacca0..291c6a2 100644
Binary files a/sw/qa/extras/uiwriter/data/tdf34957.odt and b/sw/qa/extras/uiwriter/data/tdf34957.odt differ
commit 1ded035f853ba62f02958175046948d2b47b8075
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Sat Nov 21 01:32:49 2015 +0100

    tdf#74608 dbaccess: Constructor for singleton DataAccessDescriptorFactory
    
    Change-Id: Id1453e3cf1c8aef22536b4e0797cca7e654316c0

diff --git a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
index 567e231..e351d29 100644
--- a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
+++ b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
@@ -18,8 +18,6 @@
  */
 
 #include "dbastrings.hrc"
-#include "module_dba.hxx"
-#include "services.hxx"
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -28,6 +26,7 @@
 #include <com/sun/star/sdbc/XConnection.hpp>
 #include <com/sun/star/sdbc/XResultSet.hpp>
 #include <com/sun/star/sdb/XDataAccessDescriptorFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <comphelper/broadcasthelper.hxx>
 #include <comphelper/proparrhlp.hxx>
@@ -36,28 +35,20 @@
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
-namespace dbaccess
+namespace
 {
 
     using ::com::sun::star::uno::Reference;
-    using ::com::sun::star::uno::XInterface;
-    using ::com::sun::star::uno::UNO_QUERY;
-    using ::com::sun::star::uno::UNO_QUERY_THROW;
-    using ::com::sun::star::uno::UNO_SET_THROW;
-    using ::com::sun::star::uno::Exception;
     using ::com::sun::star::uno::RuntimeException;
     using ::com::sun::star::uno::Any;
-    using ::com::sun::star::uno::makeAny;
     using ::com::sun::star::uno::Sequence;
+    using ::com::sun::star::uno::XComponentContext;
     using ::com::sun::star::lang::XServiceInfo;
-    using ::com::sun::star::lang::XMultiServiceFactory;
     using ::com::sun::star::beans::XPropertySetInfo;
     using ::com::sun::star::beans::Property;
     using ::com::sun::star::sdbc::XConnection;
     using ::com::sun::star::sdbc::XResultSet;
-    using ::com::sun::star::sdb::XDataAccessDescriptorFactory;
     using ::com::sun::star::beans::XPropertySet;
-    using ::com::sun::star::uno::XComponentContext;
     using ::com::sun::star::beans::PropertyValue;
 
     namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
@@ -211,10 +202,7 @@ namespace dbaccess
     }
 
     // DataAccessDescriptorFactory
-    typedef ::cppu::WeakImplHelper<   XServiceInfo
-                                  ,   XDataAccessDescriptorFactory
-                                  >   DataAccessDescriptorFactory_Base;
-    class DataAccessDescriptorFactory : public DataAccessDescriptorFactory_Base
+    class DataAccessDescriptorFactory: public ::cppu::WeakImplHelper<XServiceInfo, css::sdb::XDataAccessDescriptorFactory>
     {
     public:
         // XServiceInfo
@@ -222,16 +210,9 @@ namespace dbaccess
         virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException, std::exception) override;
         virtual Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (RuntimeException, std::exception) override;
 
-        // XServiceInfo - static versions
-        static Sequence< OUString >  getSupportedServiceNames_static() throw( RuntimeException );
-        static OUString              getImplementationName_static() throw( RuntimeException );
-        static Reference< XInterface >      Create(const Reference< XComponentContext >& _rxContext);
-        static OUString              getSingletonName_static();
-
         // XDataAccessDescriptorFactory
         virtual Reference< XPropertySet > SAL_CALL createDataAccessDescriptor(  ) throw (RuntimeException, std::exception) override;
 
-    protected:
         explicit DataAccessDescriptorFactory( const Reference< XComponentContext >& _rxContext );
         virtual ~DataAccessDescriptorFactory();
 
@@ -248,30 +229,9 @@ namespace dbaccess
     {
     }
 
-    OUString DataAccessDescriptorFactory::getSingletonName_static()
-    {
-        return OUString( "com.sun.star.sdb.DataAccessDescriptorFactory" );
-    }
-
-    Sequence< OUString > DataAccessDescriptorFactory::getSupportedServiceNames_static() throw( RuntimeException )
-    {
-        Sequence< OUString > aServices { getSingletonName_static() };
-        return aServices;
-    }
-
-    OUString DataAccessDescriptorFactory::getImplementationName_static() throw( RuntimeException )
-    {
-        return OUString( "com.sun.star.comp.dba.DataAccessDescriptorFactory" );
-    }
-
-    Reference< XInterface > DataAccessDescriptorFactory::Create( const Reference< XComponentContext >& _rxContext )
-    {
-        return *( new DataAccessDescriptorFactory( _rxContext ) );
-    }
-
     OUString SAL_CALL DataAccessDescriptorFactory::getImplementationName() throw (RuntimeException, std::exception)
     {
-        return getImplementationName_static();
+        return OUString( "com.sun.star.comp.dba.DataAccessDescriptorFactory" );
     }
 
     sal_Bool SAL_CALL DataAccessDescriptorFactory::supportsService( const OUString& rServiceName ) throw (RuntimeException, std::exception)
@@ -279,9 +239,10 @@ namespace dbaccess
         return cppu::supportsService(this, rServiceName);
     }
 
-    Sequence< OUString > SAL_CALL DataAccessDescriptorFactory::getSupportedServiceNames(  ) throw (RuntimeException, std::exception)
+    Sequence< OUString > SAL_CALL DataAccessDescriptorFactory::getSupportedServiceNames() throw (RuntimeException, std::exception)
     {
-        return getSupportedServiceNames_static();
+        Sequence< OUString > aServices { "com.sun.star.sdb.DataAccessDescriptorFactory" };
+        return aServices;
     }
 
     Reference< XPropertySet > SAL_CALL DataAccessDescriptorFactory::createDataAccessDescriptor(  ) throw (RuntimeException, std::exception)
@@ -289,11 +250,28 @@ namespace dbaccess
         return new DataAccessDescriptor( m_xContext );
     }
 
-} // namespace dbaccess
+struct Instance {
+    explicit Instance(
+        css::uno::Reference<css::uno::XComponentContext> const & context):
+        instance(new DataAccessDescriptorFactory(context))
+    {}
+
+    css::uno::Reference<cppu::OWeakObject> instance;
+};
+
+struct Singleton:
+    public rtl::StaticWithArg<
+        Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
+{};
+
+}
 
-extern "C" void SAL_CALL createRegistryInfo_DataAccessDescriptorFactory()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_dba_DataAccessDescriptorFactory(
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    static ::dba::OSingletonRegistration< ::dbaccess::DataAccessDescriptorFactory > aAutoRegistration;
+    return cppu::acquire(Singleton::get(context).instance.get());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/services.hxx b/dbaccess/source/core/inc/services.hxx
deleted file mode 100644
index 4e40c48..0000000
--- a/dbaccess/source/core/inc/services.hxx
+++ /dev/null
@@ -1,31 +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_DBACCESS_SOURCE_CORE_INC_SERVICES_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_SERVICES_HXX
-
-#include <sal/config.h>
-
-#include <sal/types.h>
-
-extern "C" void SAL_CALL createRegistryInfo_DataAccessDescriptorFactory();
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/services.cxx b/dbaccess/source/core/misc/services.cxx
index 3624225..60c877a 100644
--- a/dbaccess/source/core/misc/services.cxx
+++ b/dbaccess/source/core/misc/services.cxx
@@ -19,13 +19,11 @@
 
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implementationentry.hxx>
-#include "module_dba.hxx"
 #include <osl/diagnose.h>
 #include "DatabaseDataProvider.hxx"
 #include "dbadllapi.hxx"
 
 #include <../dataaccess/databasecontext.hxx>
-#include <services.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -51,34 +49,13 @@ namespace dba{
     };
 }
 
-// The prescribed C api must be complied with
-// It consists of three functions which must be exported by the module.
-extern "C" void SAL_CALL createRegistryInfo_DBA()
-{
-    static bool bInit = false;
-    if (!bInit)
-    {
-        createRegistryInfo_DataAccessDescriptorFactory();
-        bInit = true;
-    }
-}
-
 extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL dba_component_getFactory(
                     const sal_Char* pImplementationName,
                     void* pServiceManager,
                     void* pRegistryKey)
 {
-    createRegistryInfo_DBA();
-
-    Reference<XInterface> xRet(::dba::DbaModule::getInstance().getComponentFactory(
-        OUString::createFromAscii(pImplementationName)));
-
-    if (xRet.is())
-        xRet->acquire();
-    else
-        return cppu::component_getFactoryHelper(
+    return cppu::component_getFactoryHelper(
             pImplementationName, pServiceManager, pRegistryKey, dba::entries);
-    return xRet.get();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/util/dba.component b/dbaccess/util/dba.component
index 3a4ac35..90ba9e3 100644
--- a/dbaccess/util/dba.component
+++ b/dbaccess/util/dba.component
@@ -22,7 +22,8 @@
   <implementation name="com.sun.star.comp.dbaccess.DatabaseDataProvider">
     <service name="com.sun.star.chart2.data.DatabaseDataProvider"/>
   </implementation>
-  <implementation name="com.sun.star.comp.dba.DataAccessDescriptorFactory">
+  <implementation name="com.sun.star.comp.dba.DataAccessDescriptorFactory"
+      constructor="com_sun_star_comp_dba_DataAccessDescriptorFactory">
     <singleton name="com.sun.star.sdb.DataAccessDescriptorFactory"/>
   </implementation>
   <implementation name="com.sun.star.comp.dba.OCommandDefinition"


More information about the Libreoffice-commits mailing list