[Libreoffice-commits] core.git: Branch 'libreoffice-4-2-5' - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Jun 3 01:29:51 PDT 2014


 sc/source/filter/xml/xmlexprt.cxx |   40 ++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)

New commits:
commit 9c2f1677aa4048f0ce2a744bb28d8cd8774216e7
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri May 30 22:02:01 2014 -0400

    fdo#78927: Use different XML attribute names for asian and complex fonts.
    
    Change-Id: I96a26bd495d6a78fffd0854b5084f69b5db84ee6
    (cherry picked from commit 1b35c7ea4f7fe1473dbe08ab93b7259403b290ff)
    Reviewed-on: https://gerrit.libreoffice.org/9588
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit 282227a81df90dfe11f0b57a4d7558d7faa56836)
    Reviewed-on: https://gerrit.libreoffice.org/9623
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 885b5bc..058e719 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1075,6 +1075,27 @@ void ScXMLExport::ExportExternalRefCacheStyles()
 
 namespace {
 
+void handleFont(
+    std::vector<XMLPropertyState>& rPropStates,
+    const SfxPoolItem* p, const UniReference<XMLPropertySetMapper>& xMapper, const OUString& rXMLName )
+{
+    sal_Int32 nEntryCount = xMapper->GetEntryCount();
+
+    // Apparently font info needs special handling.
+    const SvxFontItem* pItem = static_cast<const SvxFontItem*>(p);
+
+    sal_Int32 nIndexFontName = xMapper->GetEntryIndex(XML_NAMESPACE_STYLE, rXMLName, 0);
+
+    if (nIndexFontName == -1 || nIndexFontName >= nEntryCount)
+        return;
+
+    uno::Any aAny;
+    if (!pItem->QueryValue(aAny, MID_FONT_FAMILY_NAME))
+        return;
+
+    rPropStates.push_back(XMLPropertyState(nIndexFontName, aAny));
+}
+
 const SvxFieldData* toXMLPropertyStates(
     std::vector<XMLPropertyState>& rPropStates, const std::vector<const SfxPoolItem*>& rSecAttrs,
     const UniReference<XMLPropertySetMapper>& xMapper, const ScXMLEditAttributeMap& rAttrMap )
@@ -1106,22 +1127,13 @@ const SvxFieldData* toXMLPropertyStates(
         switch (p->Which())
         {
             case EE_CHAR_FONTINFO:
+                handleFont(rPropStates, p, xMapper, "font-name");
+            break;
             case EE_CHAR_FONTINFO_CJK:
+                handleFont(rPropStates, p, xMapper, "font-name-asian");
+            break;
             case EE_CHAR_FONTINFO_CTL:
-            {
-                // Apparently font info needs special handling.
-                const SvxFontItem* pItem = static_cast<const SvxFontItem*>(p);
-
-                sal_Int32 nIndexFontName = xMapper->GetEntryIndex(XML_NAMESPACE_STYLE, "font-name", 0);
-
-                if (nIndexFontName == -1 || nIndexFontName >= nEntryCount)
-                    break;
-
-                if (!pItem->QueryValue(aAny, MID_FONT_FAMILY_NAME))
-                    break;
-
-                rPropStates.push_back(XMLPropertyState(nIndexFontName, aAny));
-            }
+                handleFont(rPropStates, p, xMapper, "font-name-complex");
             break;
             case EE_CHAR_WEIGHT:
             case EE_CHAR_WEIGHT_CJK:


More information about the Libreoffice-commits mailing list