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

Mark Hung (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 10 03:31:01 UTC 2019


 oox/source/drawingml/textcharacterproperties.cxx |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

New commits:
commit f9569785dd513b9b2f1d7c8c687fed285b0ad280
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Mon Sep 30 16:05:40 2019 +0800
Commit:     Mark Hung <marklh9 at gmail.com>
CommitDate: Thu Oct 10 05:30:27 2019 +0200

    tdf#98603 fix the missing char property (1/2).
    
    - moLang is missed from assignUsed, so the attribute was never processed.
    - Set CharLocale, CharLocaleAsian, or CharLocaleComplex based on lang
    attribute of rPr (run property).
    
    Change-Id: I6a9a636d790d244d19e7b661a1a63b1249c2bd37
    Reviewed-on: https://gerrit.libreoffice.org/79972
    Tested-by: Jenkins
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 6a0f37532d8b..703e23db9c3f 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -21,8 +21,10 @@
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/awt/FontSlant.hpp>
 #include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
 #include <comphelper/sequence.hxx>
 #include <i18nlangtag/languagetag.hxx>
+#include <i18nlangtag/mslangid.hxx>
 #include <editeng/escapementitem.hxx>
 #include <oox/helper/helper.hxx>
 #include <oox/helper/propertyset.hxx>
@@ -52,6 +54,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource
     maSymbolFont.assignIfUsed( rSourceProps.maSymbolFont );
     maHighlightColor.assignIfUsed( rSourceProps.maHighlightColor );
     maUnderlineColor.assignIfUsed( rSourceProps.maUnderlineColor );
+    moLang.assignIfUsed( rSourceProps.moLang );
     moHeight.assignIfUsed( rSourceProps.moHeight );
     moFontScale.assignIfUsed(rSourceProps.moFontScale);
     moSpacing.assignIfUsed( rSourceProps.moSpacing );
@@ -110,10 +113,17 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
 
     if( moLang.has() && !moLang.get().isEmpty() )
     {
-        lang::Locale aLocale( LanguageTag( moLang.get()).getLocale());
-        rPropMap.setProperty( PROP_CharLocale, aLocale);
-        rPropMap.setProperty( PROP_CharLocaleAsian, aLocale);
-        rPropMap.setProperty( PROP_CharLocaleComplex, aLocale);
+        LanguageTag aTag(moLang.get());
+        lang::Locale aLocale(aTag.getLocale());
+        switch(MsLangId::getScriptType(aTag.getLanguageType()))
+        {
+            case css::i18n::ScriptType::LATIN:
+                rPropMap.setProperty( PROP_CharLocale, aLocale);break;
+            case css::i18n::ScriptType::ASIAN:
+                rPropMap.setProperty( PROP_CharLocaleAsian, aLocale);break;
+            case css::i18n::ScriptType::COMPLEX:
+                rPropMap.setProperty( PROP_CharLocaleComplex, aLocale);break;
+        }
     }
 
     if( moHeight.has() )


More information about the Libreoffice-commits mailing list