diff options
author | Eike Rathke <erack@redhat.com> | 2013-08-15 21:46:39 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-08-15 21:47:31 +0200 |
commit | 8f15ae6c3fabef7532a71e7e3e16a911eaf57bb5 (patch) | |
tree | d0dc73276f6ed71e23f879279bb15f7326ea341a /xmloff | |
parent | aca3d35a3b950bd6bc7681787cc4fa10c2e01683 (diff) |
write *:script* and *:rfc-language-tag* only for ODF >= 1.2
Change-Id: I767edf86f9e4d96da538ec1e32792524b22af11d
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/style/chrlohdl.cxx | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index e5e5ceeda77c..efa6ff4ea54d 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 855266aa2fbd..64c37725097c 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; |