From 52979151ca45f9a8aff1694f3c4e1b87ef971ba8 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 2 Dec 2014 17:01:30 +0000 Subject: Resolves: fdo#36514 avoid empty style names in ww2 docs Change-Id: Ib7987e00bb33e46117442db74dcdd386e8a2bc97 --- sw/source/filter/ww8/ww8par2.cxx | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index ca804428b2e1..8fe310b73056 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++; } -- cgit v1.2.3