[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/source

Caolán McNamara caolanm at redhat.com
Tue Dec 2 09:06:36 PST 2014


 sw/source/filter/ww8/ww8par2.cxx |   27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

New commits:
commit f070a64a1d3ccdb382a189506bd4c5001411fc11
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 2 17:01:30 2014 +0000

    Resolves: fdo#36514 avoid empty style names in ww2 docs
    
    Change-Id: Ib7987e00bb33e46117442db74dcdd386e8a2bc97
    (cherry picked from commit 52979151ca45f9a8aff1694f3c4e1b87ef971ba8)

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index f3c154d..3f7897e 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -4229,35 +4229,30 @@ void WW8RStyle::ImportOldFormatStyles()
             continue;
 
         SwWW8StyInf &rSI = pIo->vColl[stc];
+        OUString sName;
+
         if (nCount != 0xFF)    // undefined style
         {
-            OUString sName;
-            if (nCount == 0)   // inbuilt style
-            {
-                ww::sti eSti = ww::GetCanonicalStiFromStc(stc);
-                if (const sal_Char *pStr = GetEnglishNameFromSti(eSti))
-                    sName = OUString(pStr, strlen(pStr), RTL_TEXTENCODING_ASCII_US);
-                else
-                    sName = "Unknown";
-            }
-            else               // user style
+            if (nCount != 0)   // user style
             {
                 OString aTmp = read_uInt8s_ToOString(rSt, nCount);
                 nByteCount += aTmp.getLength();
                 sName = OStringToOUString(aTmp, eStructChrSet);
             }
-            rSI.SetOrgWWIdent(sName, stc);
             rSI.bImported = true;
         }
-        else
+
+        if (sName.isEmpty())
         {
             ww::sti eSti = ww::GetCanonicalStiFromStc(stc);
             if (const sal_Char *pStr = GetEnglishNameFromSti(eSti))
-            {
-                OUString sName = OUString(pStr, strlen(pStr), RTL_TEXTENCODING_ASCII_US);
-                rSI.SetOrgWWIdent(sName, stc);
-            }
+                sName = OUString(pStr, strlen(pStr), RTL_TEXTENCODING_ASCII_US);
         }
+
+        if (sName.isEmpty())
+            sName = OUString("Unknown Style: ") + OUString::number(stc);
+
+        rSI.SetOrgWWIdent(sName, stc);
         stcp++;
     }
 


More information about the Libreoffice-commits mailing list