[Libreoffice-commits] core.git: 3 commits - include/xmloff xmloff/inc xmloff/source

Michael Stahl mstahl at redhat.com
Wed Nov 18 05:32:52 PST 2015


 include/xmloff/txtimp.hxx      |   11 +++++++++++
 include/xmloff/xmlimp.hxx      |    6 ++++--
 xmloff/inc/txtvfldi.hxx        |   11 -----------
 xmloff/source/core/i18nmap.cxx |    2 +-
 xmloff/source/core/xmlimp.cxx  |   21 ++++++++++++++-------
 5 files changed, 30 insertions(+), 21 deletions(-)

New commits:
commit ee655627ad2ba66a8160b4cbdaeb1dd52d047a1d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Nov 18 14:12:53 2015 +0100

    xmloff: add meta:generator constants LO_43x and LO_44x
    
    Change-Id: I1d962ad637f19b02855616edebcedbad719689c5

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 7da065e..6371075 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -476,9 +476,11 @@ public:
     static const sal_uInt16 LO_3x = 30 | LO_flag;
     static const sal_uInt16 LO_41x = 41 | LO_flag;
     static const sal_uInt16 LO_42x = 42 | LO_flag;
-    /// @ATTENTION: when adding a new value more specific than "4x", grep for
+    static const sal_uInt16 LO_43x = 43 | LO_flag;
+    static const sal_uInt16 LO_44x = 44 | LO_flag;
+    /// @ATTENTION: when adding a new value more specific than "5x", grep for
     /// all current uses and adapt them!!!
-    static const sal_uInt16 LO_4x = 43 | LO_flag;
+    static const sal_uInt16 LO_5x = 50 | LO_flag;
     static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16;
 
     /** depending on whether the generator version indicates LO, compare
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 53adae8..ad5f58a 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -190,24 +190,31 @@ getBuildIdsProperty(uno::Reference<beans::XPropertySet> const& xImportInfo)
                             {
                                 mnGeneratorVersion = SvXMLImport::LO_3x;
                             }
-                            else
+                            else if ('4' == loVersion[0])
                             {
-                                SAL_INFO_IF('4' != loVersion[0], "xmloff.core", "unknown LO version: " << loVersion);
-                                if ('4' == loVersion[0] && loVersion.getLength() > 1
+                                if (loVersion.getLength() > 1
                                     && (loVersion[1] == '0' || loVersion[1] == '1'))
                                 {
                                     mnGeneratorVersion = SvXMLImport::LO_41x; // 4.0/4.1
                                 }
-                                else if ('4' == loVersion[0]
-                                    && loVersion.getLength() > 1 && loVersion[1] == '2')
+                                else if (loVersion.getLength() > 1 && '2' == loVersion[1])
                                 {
                                     mnGeneratorVersion = SvXMLImport::LO_42x; // 4.2
                                 }
-                                else
+                                else if (loVersion.getLength() > 1 && '3' == loVersion[1])
+                                {
+                                    mnGeneratorVersion = SvXMLImport::LO_43x; // 4.3
+                                }
+                                else if (loVersion.getLength() > 1 && '4' == loVersion[1])
                                 {
-                                    mnGeneratorVersion = SvXMLImport::LO_4x;
+                                    mnGeneratorVersion = SvXMLImport::LO_44x; // 4.4
                                 }
                             }
+                            else
+                            {
+                                SAL_INFO_IF('5' != loVersion[0], "xmloff.core", "unknown LO version: " << loVersion);
+                                mnGeneratorVersion = SvXMLImport::LO_5x;
+                            }
                             return; // ignore buildIds
                         }
                     }
commit e3ad062229c95a5cf987d562613d01738bb7fd81
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Nov 18 13:41:09 2015 +0100

    xmloff: legacy assert to SAL_INFO as it can only be triggered by
    
    ... invalid input files.
    
    Change-Id: I351302253169d32cd6a83ff63eb497d0069ab49b

diff --git a/xmloff/source/core/i18nmap.cxx b/xmloff/source/core/i18nmap.cxx
index 57c33a5..c297d2e 100644
--- a/xmloff/source/core/i18nmap.cxx
+++ b/xmloff/source/core/i18nmap.cxx
@@ -26,7 +26,7 @@ bool SvI18NMap::Add( sal_uInt16 nKind, const OUString& rName,
 {
     SvI18NMapEntry_Key aKey(nKind, rName);
     bool bIsNewInsertion = m_aMap.insert(SvI18NMap_Impl::value_type(aKey, rNewName)).second;
-    DBG_ASSERT( bIsNewInsertion, "SvI18NMap::Add: item registered already" );
+    SAL_INFO_IF(!bIsNewInsertion, "xmloff.core", "SvI18NMap::Add: item with key \"" << rName << "\" registered already, likely invalid input file");
     return bIsNewInsertion;
 }
 
commit 2af0870fae82f1228886fbf37baa15d22ee4d2d1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Nov 18 13:36:57 2015 +0100

    xmloff: document potential pitfall with SvI18NMap usage
    
    Change-Id: I37050203f9d7b4f04b6d0b0dc5c4e04855d017f7

diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index a4bfbd0..6d9239f 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -362,6 +362,17 @@ enum XMLTextType
     XML_TEXT_TYPE_CHANGED_REGION
 };
 
+/// variable type (for XMLSetVarFieldImportContext)
+enum VarType
+{
+    VarTypeSimple,
+    VarTypeUserField,
+    VarTypeSequence
+    // see following NOTE!
+};
+
+// NOTE: these values must be distinct from any in "enum VarType" because they
+// are used as keys to SvI18NMap::Add()
 #define XML_TEXT_RENAME_TYPE_FRAME 10
 #define XML_TEXT_RENAME_TYPE_TABLE 20
 
diff --git a/xmloff/inc/txtvfldi.hxx b/xmloff/inc/txtvfldi.hxx
index a995279..5dd636a 100644
--- a/xmloff/inc/txtvfldi.hxx
+++ b/xmloff/inc/txtvfldi.hxx
@@ -30,17 +30,6 @@
 #include <com/sun/star/beans/XPropertySetInfo.hpp>
 
 
-
-/// variable type (for XMLSetVarFieldImportContext)
-enum VarType
-{
-    VarTypeSimple,
-    VarTypeUserField,
-    VarTypeSequence
-};
-
-
-
 /** helper class: parses value-type and associated value attributes */
 class XMLValueImportHelper
 {


More information about the Libreoffice-commits mailing list