Hi, I have submitted a patch for review:
https://gerrit.libreoffice.org/3743 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/43/3743/1 Fix style renaming confusion in ww8 filter (solves fdo#63603) - Mapping LO default style to Word "Normal" style for docx output used a hard coded style name, so it broke when LO's default style was renamed in 4.0 (plus it would never have worked for non-English languages) - This renaming did not cater for nameclashes, leading to fdo#63603 - Similar renaming when importing doc styles did cater for nameclashes, but had a minor bug in that Change-Id: Id23f3021c6507b474c16e93abf43ba748606ebc7 --- M sw/source/filter/ww8/writerwordglue.cxx M sw/source/filter/ww8/wrtw8sty.cxx 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 8ce8bd9..7d4444e 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -300,11 +300,13 @@ aName.InsertAscii("WW-" , 0); sal_Int32 nI = 1; + String aBaseName = aName; while ( 0 != (pColl = maHelper.GetStyle(aName)) && (nI < SAL_MAX_INT32) ) { + aName = aBaseName; aName += OUString::number(nI++); } } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 17fb01c..3a157c2 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -527,8 +527,22 @@ GetStyleData( pFmt, bFmtColl, nBase, nWwNext ); String aName = pFmt->GetName(); - if ( aName.EqualsAscii( "Default" ) ) + // We want to map LO's default style to Word's "Normal" style. + // Word looks for this specific style name when reading docx files. + // (It must be the English word regardless of language settings) + if ( nPos == 0 ) { + assert( pFmt->GetPoolFmtId() == RES_POOLCOLL_STANDARD ); aName = OUString("Normal"); + } else if (aName.EqualsAscii("Normal")) { + // If LO has a style named "Normal"(!) rename it to something unique + aName.InsertAscii("LO-" , 0); + String aBaseName = aName; + int nSuffix = 0; + while ( sw::util::GetParaStyle(*m_rExport.pDoc, aName) ) { + aName = aBaseName; + aName += OUString::number(++nSuffix); + } + } m_rExport.AttrOutput().StartStyle( aName, bFmtColl, nBase, nWwNext, GetWWId( *pFmt ), nPos, -- To view, visit https://gerrit.libreoffice.org/3743 To unsubscribe, visit https://gerrit.libreoffice.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id23f3021c6507b474c16e93abf43ba748606ebc7 Gerrit-PatchSet: 1 Gerrit-Project: core Gerrit-Branch: master Gerrit-Owner: Luke Deller <l...@deller.id.au> _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice