[Libreoffice-commits] core.git: oox/inc oox/source oox/util solenv/bin

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 10 07:04:15 UTC 2018


 oox/inc/services.hxx             |    7 -------
 oox/source/core/filterdetect.cxx |   33 ++++++++++++---------------------
 oox/source/core/services.cxx     |    1 -
 oox/util/oox.component           |    3 ++-
 solenv/bin/native-code.py        |    1 +
 5 files changed, 15 insertions(+), 30 deletions(-)

New commits:
commit 2963e0c69949c2c5d0c57a1960ac0406edfc2311
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Thu Aug 9 21:27:45 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Fri Aug 10 09:03:50 2018 +0200

    oox: create FilterDetect instances with an uno constructor
    
    Change-Id: Ic9baba6a4ca37af18c5f5175aadcc59bf47c7b64
    Reviewed-on: https://gerrit.libreoffice.org/58798
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/oox/inc/services.hxx b/oox/inc/services.hxx
index 5b77f4b1d9a4..9fd9ddd46b70 100644
--- a/oox/inc/services.hxx
+++ b/oox/inc/services.hxx
@@ -23,13 +23,6 @@
 #include <sal/config.h>
 
 namespace oox {
-    namespace core {
-        extern OUString FilterDetect_getImplementationName();
-        extern css::uno::Sequence< OUString > FilterDetect_getSupportedServiceNames();
-        /// @throws css::uno::Exception
-        extern css::uno::Reference< css::uno::XInterface > FilterDetect_createInstance(
-            const css::uno::Reference< css::uno::XComponentContext >& rxContext );
-    }
     namespace docprop {
         extern OUString DocumentPropertiesImport_getImplementationName();
         extern css::uno::Sequence< OUString > DocumentPropertiesImport_getSupportedServiceNames();
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 0f1fe8625b7c..cbbaae3ed333 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -38,6 +38,8 @@
 
 #include <services.hxx>
 
+using namespace ::com::sun::star;
+
 namespace oox {
 namespace core {
 
@@ -228,25 +230,6 @@ void FilterDetectDocHandler::parseContentTypesOverride( const AttributeList& rAt
         mrFilterName = getFilterNameFromContentType( rAttribs.getString( XML_ContentType, OUString() ), maFileName );
 }
 
-/* Helper for XServiceInfo */
-Sequence< OUString > FilterDetect_getSupportedServiceNames()
-{
-    Sequence<OUString> aServiceNames { "com.sun.star.frame.ExtendedTypeDetection" };
-    return aServiceNames;
-}
-
-/* Helper for XServiceInfo */
-OUString FilterDetect_getImplementationName()
-{
-    return OUString( "com.sun.star.comp.oox.FormatDetector" );
-}
-
-/* Helper for registry */
-Reference< XInterface > FilterDetect_createInstance( const Reference< XComponentContext >& rxContext )
-{
-    return static_cast< ::cppu::OWeakObject* >( new FilterDetect( rxContext ) );
-}
-
 FilterDetect::FilterDetect( const Reference< XComponentContext >& rxContext ) :
     mxContext( rxContext, UNO_SET_THROW )
 {
@@ -377,7 +360,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
 
 OUString SAL_CALL FilterDetect::getImplementationName()
 {
-    return FilterDetect_getImplementationName();
+    return OUString( "com.sun.star.comp.oox.FormatDetector" );
 }
 
 sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName )
@@ -387,7 +370,8 @@ sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName )
 
 Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames()
 {
-    return FilterDetect_getSupportedServiceNames();
+    Sequence<OUString> aServiceNames { "com.sun.star.frame.ExtendedTypeDetection" };
+    return aServiceNames;
 }
 
 // com.sun.star.document.XExtendedFilterDetection interface -------------------
@@ -452,4 +436,11 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq
 } // namespace core
 } // namespace oox
 
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+com_sun_star_comp_oox_FormatDetector_get_implementation(uno::XComponentContext* pCtx,
+                                                        uno::Sequence<uno::Any> const& /*rSeq*/)
+{
+    return cppu::acquire(new oox::core::FilterDetect(pCtx));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/core/services.cxx b/oox/source/core/services.cxx
index 354501e79e2c..2c9412ea2640 100644
--- a/oox/source/core/services.cxx
+++ b/oox/source/core/services.cxx
@@ -35,7 +35,6 @@ namespace {
 // Impress" would actually want to make use of them:
 static ::cppu::ImplementationEntry const spServices[] =
 {
-    IMPLEMENTATION_ENTRY( ::oox::core::FilterDetect ),
     IMPLEMENTATION_ENTRY( ::oox::docprop::DocumentPropertiesImport ),
     IMPLEMENTATION_ENTRY( ::oox::ppt::PowerPointImport ),
     IMPLEMENTATION_ENTRY( ::oox::ppt::QuickDiagrammingImport ),
diff --git a/oox/util/oox.component b/oox/util/oox.component
index ccbba4d28759..5d235e1485cf 100644
--- a/oox/util/oox.component
+++ b/oox/util/oox.component
@@ -23,7 +23,8 @@
     constructor="com_sun_star_comp_oox_core_FastTokenHandler_get_implementation">
     <service name="com.sun.star.xml.sax.FastTokenHandler"/>
   </implementation>
-  <implementation name="com.sun.star.comp.oox.FormatDetector">
+  <implementation name="com.sun.star.comp.oox.FormatDetector"
+    constructor="com_sun_star_comp_oox_FormatDetector_get_implementation">
     <service name="com.sun.star.frame.ExtendedTypeDetection"/>
   </implementation>
   <implementation name="com.sun.star.comp.oox.docprop.DocumentPropertiesImporter">
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 6ff60365e1a8..06c16550b8b0 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -254,6 +254,7 @@ core_constructor_list = [
     ("com_sun_star_xml_crypto_XMLSignature_get_implementation", "#if HAVE_FEATURE_NSS"),
 # oox/util/oox.component
     "com_sun_star_comp_oox_core_FastTokenHandler_get_implementation",
+    "com_sun_star_comp_oox_FormatDetector_get_implementation",
     ]
 
 # edit group for apps, where you can edit documents


More information about the Libreoffice-commits mailing list