write *:script* and *:rfc-language-tag* only for ODF >= 1.2
Change-Id: I767edf86f9e4d96da538ec1e32792524b22af11d
This commit is contained in:
@@ -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);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user