[Libreoffice-commits] core.git: 2 commits - solenv/bin sw/Library_swd.mk sw/source

Matúš Kukan matus.kukan at collabora.com
Thu Jan 9 03:00:05 PST 2014


 solenv/bin/native-code.py            |   76 ++++++++++++++++++++++++++---------
 sw/Library_swd.mk                    |    1 
 sw/source/filter/basflt/iodetect.cxx |    6 ++
 sw/source/ui/uno/swdet2.cxx          |   71 --------------------------------
 sw/source/ui/uno/swdetect.cxx        |   36 +++++++++++++++-
 5 files changed, 96 insertions(+), 94 deletions(-)

New commits:
commit fc1762f96540e18561fbc93c28a36e37ca6e6168
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Jan 9 09:54:38 2014 +0100

    Merge these source files. Also move a function to where it's used.
    
    Change-Id: Ia0378a58c63364a73c40dd901d93e20a596a4c29

diff --git a/sw/Library_swd.mk b/sw/Library_swd.mk
index 477bcea..fd53b7b 100644
--- a/sw/Library_swd.mk
+++ b/sw/Library_swd.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Library_use_libraries,swd,\
 $(eval $(call gb_Library_add_exception_objects,swd,\
     sw/source/filter/basflt/iodetect \
     sw/source/ui/uno/detreg \
-    sw/source/ui/uno/swdet2 \
     sw/source/ui/uno/swdetect \
 ))
 
diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx
index 2a1ad72..a71587e 100644
--- a/sw/source/filter/basflt/iodetect.cxx
+++ b/sw/source/filter/basflt/iodetect.cxx
@@ -24,8 +24,12 @@
 #include <sot/storage.hxx>
 #include <svtools/parhtml.hxx>
 #include <tools/urlobj.hxx>
+#include <unotools/moduleoptions.hxx>
 
-bool IsDocShellRegistered();
+static bool IsDocShellRegistered()
+{
+    return SvtModuleOptions().IsWriter();
+}
 
 SwIoDetect aFilterDetect[] =
 {
diff --git a/sw/source/ui/uno/swdet2.cxx b/sw/source/ui/uno/swdet2.cxx
deleted file mode 100644
index 0eacb62..0000000
--- a/sw/source/ui/uno/swdet2.cxx
+++ /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 .
- */
-
-#include "rtl/ustring.hxx"              // for OUString, operator==
-#include "sal/types.h"                  // for sal_Bool
-#include "tools/errcode.hxx"            // for ERRCODE_ABORT, ERRCODE_NONE
-#include "tools/solar.h"                // for sal_uLong
-
-#include <sfx2/docfilt.hxx>
-#include <sfx2/fcontnr.hxx>
-#include <sfx2/docfile.hxx>
-#include <iodetect.hxx>
-#include <swdetect.hxx>
-
-#include <unotools/moduleoptions.hxx>
-
-bool IsDocShellRegistered()
-{
-    return SvtModuleOptions().IsWriter();
-}
-
-sal_uLong SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter )
-{
-    sal_uLong nRet = ERRCODE_NONE;
-    if( *ppFilter )
-    {
-        // verify the given filter
-        OUString aPrefFlt = (*ppFilter)->GetUserData();
-
-        // detection for TextFilter needs an additional checking
-        sal_Bool bDetected = SwIoSystem::IsFileFilter(rMedium, aPrefFlt);
-        return bDetected ? nRet : ERRCODE_ABORT;
-    }
-
-    // mba: without preselection there is no PrefFlt
-    OUString aPrefFlt;
-    const SfxFilter* pTmp = SwIoSystem::GetFileFilter( rMedium.GetPhysicalName(), aPrefFlt, &rMedium );
-    if( !pTmp )
-        return ERRCODE_ABORT;
-
-    else
-    {
-        //Bug 41417: JP 09.07.97: HTML documents should be loaded by WebWriter
-        SfxFilterContainer aFilterContainer( OUString("swriter/web") );
-        if( !pTmp->GetUserData().equals(sHTML) ||
-            pTmp->GetServiceName() == "com.sun.star.text.WebDocument" ||
-            0 == ( (*ppFilter) = SwIoSystem::GetFilterOfFormat( OUString(sHTML),
-                    &aFilterContainer ) ) )
-            *ppFilter = pTmp;
-    }
-
-    return nRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index bdfd354..81a0f11 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -56,8 +56,7 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <unotools/moduleoptions.hxx>
 #include <comphelper/ihwrapnofilter.hxx>
-
-#include <swdll.hxx>
+#include <iodetect.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -418,6 +417,39 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
     return aTypeName;
 }
 
+sal_uLong SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter )
+{
+    sal_uLong nRet = ERRCODE_NONE;
+    if( *ppFilter )
+    {
+        // verify the given filter
+        OUString aPrefFlt = (*ppFilter)->GetUserData();
+
+        // detection for TextFilter needs an additional checking
+        sal_Bool bDetected = SwIoSystem::IsFileFilter(rMedium, aPrefFlt);
+        return bDetected ? nRet : ERRCODE_ABORT;
+    }
+
+    // mba: without preselection there is no PrefFlt
+    OUString aPrefFlt;
+    const SfxFilter* pTmp = SwIoSystem::GetFileFilter( rMedium.GetPhysicalName(), aPrefFlt, &rMedium );
+    if( !pTmp )
+        return ERRCODE_ABORT;
+
+    else
+    {
+        //Bug 41417: JP 09.07.97: HTML documents should be loaded by WebWriter
+        SfxFilterContainer aFilterContainer( OUString("swriter/web") );
+        if( !pTmp->GetUserData().equals(sHTML) ||
+            pTmp->GetServiceName() == "com.sun.star.text.WebDocument" ||
+            0 == ( (*ppFilter) = SwIoSystem::GetFilterOfFormat( OUString(sHTML),
+                    &aFilterContainer ) ) )
+            *ppFilter = pTmp;
+    }
+
+    return nRet;
+}
+
 /* XServiceInfo */
 OUString SAL_CALL SwFilterDetect::getImplementationName() throw( RuntimeException )
 {
commit 27014f48f47b1c90699d51dbf665cc57c3de1705
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Jan 9 09:20:55 2014 +0100

    native code generator: Use groups for constructors too.
    
    Change-Id: I42570b4b7b68e36cab1286948d03df0c2f0d4103

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index ba8ebc2..603a849 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -13,11 +13,8 @@ from optparse import OptionParser
 # relevant function sections will be referenced in lo_get_factory_map().
 # That prevents garbage collector to ignore them as unused.
 
-# We need the same groups for new constructor functions, started in
-# ae3a0c8da50b36db395984637f5ad74d3b4887bc
-# For now, there are only constructor functions for implementations in 'core'
-# group, so no need for other groups, core_constructor_list is enough.
-# (These functions are referenced in lo_get_constructor_map().)
+# The same groups are used for constructor based implementations
+# referenced in lo_get_constructor_map().
 
 core_factory_list = [
     ("libembobj.a", "embobj_component_getFactory"),
@@ -60,6 +57,16 @@ core_factory_list = [
     ("libxstor.a", "xstor_component_getFactory"),
     ]
 
+core_constructor_list = [
+# sax/source/expatwrap/expwrap.component
+    "com_sun_star_comp_extensions_xml_sax_ParserExpat",
+    "com_sun_star_comp_extensions_xml_sax_FastParser",
+# svtools/util/svt.component
+    "com_sun_star_comp_graphic_GraphicProvider_get_implementation",
+# svx/util/svx.component
+    "com_sun_star_drawing_EnhancedCustomShapeEngine_implementation_getFactory",
+    ]
+
 extended_core_factory_list = core_factory_list + [
     ("libanimcorelo.a", "animcore_component_getFactory"),
     ("libavmedialo.a", "avmedia_component_getFactory"),
@@ -77,23 +84,35 @@ extended_core_factory_list = core_factory_list + [
     ("libxmlfdlo.a", "xmlfd_component_getFactory"),
     ]
 
+extended_core_constructor_list = core_constructor_list + [
+    ]
+
 base_core_factory_list = [
     ("libdbalo.a", "dba_component_getFactory"),
     ("libdbaxmllo.a", "dbaxml_component_getFactory"),
     ]
 
+base_core_constructor_list = [
+    ]
+
 calc_core_factory_list = [
     ("libscdlo.a", "scd_component_getFactory"),
     ("libscfiltlo.a", "scfilt_component_getFactory"),
     ("libsclo.a", "sc_component_getFactory"),
     ]
 
+calc_core_constructor_list = [
+    ]
+
 calc_factory_list = calc_core_factory_list + [
     ("libanalysislo.a", "analysis_component_getFactory"),
     ("libdatelo.a", "date_component_getFactory"),
     ("libpricinglo.a", "pricing_component_getFactory"),
     ]
 
+calc_constructor_list = calc_core_constructor_list + [
+    ]
+
 draw_core_factory_list = [
     ("libsddlo.a", "sdd_component_getFactory"),
     ("libsdlo.a", "sd_component_getFactory"),
@@ -101,23 +120,35 @@ draw_core_factory_list = [
     ("libwpftdrawlo.a", "wpftdraw_component_getFactory"),
     ]
 
+draw_core_constructor_list = [
+    ]
+
 math_factory_list = [
     ("libsmdlo.a", "smd_component_getFactory"),
     ("libsmlo.a", "sm_component_getFactory"),
     ]
 
+math_constructor_list = [
+    ]
+
 writer_core_factory_list = [
     ("libswdlo.a", "swd_component_getFactory"),
     ("libswlo.a", "sw_component_getFactory"),
     ("libwriterfilterlo.a", "writerfilter_component_getFactory"),
     ]
 
+writer_core_constructor_list = [
+    ]
+
 writer_factory_list = writer_core_factory_list + [
     ("libhwplo.a", "hwp_component_getFactory"),
     ("libt602filterlo.a", "t602filter_component_getFactory"),
     ("libwpftwriterlo.a", "wpftwriter_component_getFactory"),
     ]
 
+writer_constructor_list = writer_core_constructor_list + [
+    ]
+
 factory_map = {
     'core' : core_factory_list,
     'extended_core' : extended_core_factory_list,
@@ -130,15 +161,17 @@ factory_map = {
     'writer' : writer_factory_list,
     }
 
-core_constructor_list = [
-# sax/source/expatwrap/expwrap.component
-    "com_sun_star_comp_extensions_xml_sax_ParserExpat",
-    "com_sun_star_comp_extensions_xml_sax_FastParser",
-# svtools/util/svt.component
-    "com_sun_star_comp_graphic_GraphicProvider_get_implementation",
-# svx/util/svx.component
-    "com_sun_star_drawing_EnhancedCustomShapeEngine_implementation_getFactory",
-    ]
+constructor_map = {
+    'core' : core_constructor_list,
+    'extended_core' : extended_core_constructor_list,
+    'base_core' : base_core_constructor_list,
+    'calc_core' : calc_core_constructor_list,
+    'calc' : calc_constructor_list,
+    'draw_core' : draw_core_constructor_list,
+    'math' : math_constructor_list,
+    'writer_core' : writer_core_constructor_list,
+    'writer' : writer_constructor_list,
+    }
 
 opts = OptionParser()
 opts.add_option("-j", "--java-guard", action="store_true", help="include external java functions", dest="java", default=False)
@@ -148,7 +181,7 @@ opts.add_option("-g", "--group", action="append", help="group of implementations
 
 print ("""/*
  * This is a generated file. Do not edit.
- *   file generated by solenc/bin/native-code.py
+ *   file generated by solenv/bin/native-code.py
  */
 
 #include <osl/detail/component-mapping.h>
@@ -162,8 +195,10 @@ if options.groups:
             print ('void * '+factory_function+'( const char* , void* , void* );')
 
 print ('')
-for constructor in core_constructor_list:
-    print ('void * '+constructor+'( void *, void * );')
+if options.groups:
+    for constructor_group in options.groups:
+        for constructor in constructor_map[constructor_group]:
+            print ('void * '+constructor+'( void *, void * );')
 
 print ("""
 const lib_to_factory_mapping *
@@ -199,8 +234,11 @@ const lib_to_constructor_mapping *
 lo_get_constructor_map(void)
 {
     static lib_to_constructor_mapping map[] = {""")
-for constructor in core_constructor_list:
-    print ('        { "' +constructor+ '", ' +constructor+ ' },')
+
+if options.groups:
+    for constructor_group in options.groups:
+        for constructor in constructor_map[constructor_group]:
+            print ('        { "' +constructor+ '", ' +constructor+ ' },')
 
 print ("""
         { 0, 0 }


More information about the Libreoffice-commits mailing list