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

Eike Rathke erack at redhat.com
Thu Aug 15 12:47:53 PDT 2013


 xmloff/source/core/xmlexp.cxx    |    7 ++++---
 xmloff/source/style/chrlohdl.cxx |    7 +++++++
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 8f15ae6c3fabef7532a71e7e3e16a911eaf57bb5
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Aug 15 21:46:39 2013 +0200

    write *:script* and *:rfc-language-tag* only for ODF >= 1.2
    
    Change-Id: I767edf86f9e4d96da538ec1e32792524b22af11d

diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index e5e5cee..efa6ff4 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1081,7 +1081,7 @@ void SvXMLExport::AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPref
         if (bWriteEmpty || !rLanguageTag.isSystemLocale())
         {
             AddAttribute( nPrefix, eLanguage, rLanguageTag.getLanguage());
-            if (rLanguageTag.hasScript())
+            if (rLanguageTag.hasScript() && getDefaultVersion() >= SvtSaveOptions::ODFVER_012)
                 AddAttribute( nPrefix, eScript, rLanguageTag.getScript());
             if (bWriteEmpty || !rLanguageTag.getCountry().isEmpty())
                 AddAttribute( nPrefix, eCountry, rLanguageTag.getCountry());
@@ -1089,7 +1089,8 @@ void SvXMLExport::AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPref
     }
     else
     {
-        AddAttribute( nPrefixRfc, eRfcLanguageTag, rLanguageTag.getBcp47());
+        if (getDefaultVersion() >= SvtSaveOptions::ODFVER_012)
+            AddAttribute( nPrefixRfc, eRfcLanguageTag, rLanguageTag.getBcp47());
         // Also in case of non-pure-ISO tag store best matching fo: attributes
         // for consumers not handling *:rfc-language-tag, ensuring that only
         // valid ISO codes are stored. Here the bWriteEmpty parameter has no
@@ -1099,7 +1100,7 @@ void SvXMLExport::AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPref
         if (!aLanguage.isEmpty())
         {
             AddAttribute( nPrefix, eLanguage, aLanguage);
-            if (!aScript.isEmpty())
+            if (!aScript.isEmpty() && getDefaultVersion() >= SvtSaveOptions::ODFVER_012)
                 AddAttribute( nPrefix, eScript, aScript);
             if (!aCountry.isEmpty())
                 AddAttribute( nPrefix, eCountry, aCountry);
diff --git a/xmloff/source/style/chrlohdl.cxx b/xmloff/source/style/chrlohdl.cxx
index 855266a..64c3772 100644
--- a/xmloff/source/style/chrlohdl.cxx
+++ b/xmloff/source/style/chrlohdl.cxx
@@ -20,6 +20,7 @@
 #include <chrlohdl.hxx>
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/xmluconv.hxx>
+#include <unotools/saveopt.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <com/sun/star/uno/Any.hxx>
@@ -229,6 +230,9 @@ sal_Bool XMLCharScriptHdl::exportXML( OUString& rStrExpValue, const uno::Any& rV
     if (!aLanguageTag.hasScript())
         return sal_False;
 
+    if (SvtSaveOptions().GetODFDefaultVersion() < SvtSaveOptions::ODFVER_012)
+        return sal_False;
+
     OUString aLanguage, aCountry;
     aLanguageTag.getIsoLanguageScriptCountry( aLanguage, rStrExpValue, aCountry);
     // For non-ISO language it does not make sense to write *:script if
@@ -352,6 +356,9 @@ sal_Bool XMLCharRfcLanguageTagHdl::exportXML( OUString& rStrExpValue, const uno:
     if (aLocale.Variant.isEmpty())
         return sal_False;
 
+    if (SvtSaveOptions().GetODFDefaultVersion() < SvtSaveOptions::ODFVER_012)
+        return sal_False;
+
     rStrExpValue = aLocale.Variant;
 
     return sal_True;


More information about the Libreoffice-commits mailing list