diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2020-05-17 13:35:46 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-06-12 01:13:55 +0200 |
commit | 129006ee5bec721bfb8bae9cd55586b353e230b7 (patch) | |
tree | b4751962829a7a7dcdea51786a33af2a83d8cd99 /sw/source/filter | |
parent | 0d97bcee3505cf70828aaf4f053c079127b7f94d (diff) |
tdf#120394: DOCX list import: simplify zero width space hack
Since introducion of list format string hack with creation
of zero-width-space can be much more simple. It was being
used to indicate existing, but empty list label suffix to
avoid stripping down numbering.
Change-Id: I9a0c6047f806b2c656ef5dbab0c6b38200818bd2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94383
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95346
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/ww8/wrtw8num.cxx | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index d08a7703ce50..02695da1bc5a 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -493,12 +493,7 @@ void MSWordExportBase::NumberingLevel( const vcl::Font* pBulletFont=nullptr; rtl_TextEncoding eChrSet=0; FontFamily eFamily=FAMILY_DECORATIVE; - if (rRule.Get(nLvl).HasListFormat()) - { - // Nothing to construct: we have it already - sNumStr = rRule.Get(nLvl).GetListFormat(); - } - else if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType() || + if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType() || SVX_NUM_BITMAP == rFormat.GetNumberingType()) { // Use bullet @@ -506,7 +501,9 @@ void MSWordExportBase::NumberingLevel( } else { - // Construct list format string from prefix, level numbers and suffix + // Create level string + // For docx it is not the best way: we can just take it from rRule.Get(nLvl).GetListFormat() + // But for compatibility with doc we follow same routine if (SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType()) { sal_uInt8* pLvlPos = aNumLvlPos; @@ -517,20 +514,23 @@ void MSWordExportBase::NumberingLevel( // now search the nums in the string for (sal_uInt8 i = 0; i <= nLvl; ++i) { - OUString sSrch( OUString::number( i )); - sal_Int32 nFnd = sNumStr.indexOf( sSrch ); - if( -1 != nFnd ) + OUString sSrch(OUString::number(i)); + sal_Int32 nFnd = sNumStr.indexOf(sSrch); + if (-1 != nFnd) { - *pLvlPos = static_cast<sal_uInt8>(nFnd + rFormat.GetPrefix().getLength() + 1 ); + *pLvlPos = static_cast<sal_uInt8>(nFnd + rFormat.GetPrefix().getLength() + 1); ++pLvlPos; - sNumStr = sNumStr.replaceAt( nFnd, 1, OUString(static_cast<char>(i)) ); + sNumStr = sNumStr.replaceAt(nFnd, 1, OUString(static_cast<char>(i))); } } } - if (!rFormat.GetPrefix().isEmpty()) - sNumStr = rFormat.GetPrefix() + sNumStr; - sNumStr += rFormat.GetSuffix(); + if (!rRule.Get(nLvl).HasListFormat()) + { + if (!rFormat.GetPrefix().isEmpty()) + sNumStr = rFormat.GetPrefix() + sNumStr; + sNumStr += rFormat.GetSuffix(); + } } if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType() || |