diff options
author | Eike Rathke <erack@redhat.com> | 2013-07-10 15:57:25 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-07-10 15:59:19 +0200 |
commit | 1e744d5d9de568aeef6794365dc6f2bf84537ddb (patch) | |
tree | ebe07251cc7f5f1d9a8dbbef9e24fd23ba7949a2 /xmloff | |
parent | a9e0c222f504104124485ef4684ce6f79d3dee52 (diff) |
changed getIsoLanguageCountry() to getIsoLanguageScriptCountry()
And don't write ODF *:script if *:language is not written either.
Change-Id: If6d49cc6fbb8d566cc59edf35ed7991d57d941c0
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/style/chrlohdl.cxx | 19 |
2 files changed, 15 insertions, 12 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 357999b51016..3c22c8f841e6 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1113,13 +1113,13 @@ void SvXMLExport::AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPref // for consumers not handling *:rfc-language-tag, ensuring that only // valid ISO codes are stored. Here the bWriteEmpty parameter has no // meaning. - OUString aLanguage, aCountry; - rLanguageTag.getIsoLanguageCountry( aLanguage, aCountry); + OUString aLanguage, aScript, aCountry; + rLanguageTag.getIsoLanguageScriptCountry( aLanguage, aScript, aCountry); if (!aLanguage.isEmpty()) { AddAttribute( nPrefix, eLanguage, aLanguage); - if (rLanguageTag.hasScript()) - AddAttribute( nPrefix, eScript, rLanguageTag.getScript()); + if (!aScript.isEmpty()) + 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 4a0ee091c680..d23159d06505 100644 --- a/xmloff/source/style/chrlohdl.cxx +++ b/xmloff/source/style/chrlohdl.cxx @@ -115,8 +115,8 @@ sal_Bool XMLCharLanguageHdl::exportXML( OUString& rStrExpValue, const uno::Any& else { LanguageTag aLanguageTag( aLocale); - OUString aCountry; - aLanguageTag.getIsoLanguageCountry( rStrExpValue, aCountry); + OUString aScript, aCountry; + aLanguageTag.getIsoLanguageScriptCountry( rStrExpValue, aScript, aCountry); // Do not write *:language='none' for a non-ISO language with // *:rfc-language-tag that is written if Variant is not empty. If there // is no match do not write this attribute at all. @@ -235,10 +235,13 @@ sal_Bool XMLCharScriptHdl::exportXML( OUString& rStrExpValue, const uno::Any& rV if (!aLanguageTag.hasScript()) return sal_False; - rStrExpValue = aLanguageTag.getScript(); - - if( rStrExpValue.isEmpty() ) - rStrExpValue = GetXMLToken( XML_NONE ); + OUString aLanguage, aCountry; + aLanguageTag.getIsoLanguageScriptCountry( aLanguage, rStrExpValue, aCountry); + // For non-ISO language it does not make sense to write *:script if + // *:language is not written either, does it? It's all in + // *:rfc-language-tag + if (aLanguage.isEmpty() || rStrExpValue.isEmpty()) + return sal_False; return sal_True; } @@ -301,8 +304,8 @@ sal_Bool XMLCharCountryHdl::exportXML( OUString& rStrExpValue, const uno::Any& r else { LanguageTag aLanguageTag( aLocale); - OUString aLanguage; - aLanguageTag.getIsoLanguageCountry( aLanguage, rStrExpValue); + OUString aLanguage, aScript; + aLanguageTag.getIsoLanguageScriptCountry( aLanguage, aScript, rStrExpValue); // Do not write *:country='none' for a non-ISO country with // *:rfc-language-tag that is written if Variant is not empty. If there // is no match do not write this attribute at all. |