summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2020-05-17 13:35:46 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-06-05 01:13:05 +0200
commit36c713f673796f51b9bc657492b0c16396231805 (patch)
tree5397293a7632da3f2940f61cb63689e7b104d635 /writerfilter
parent69eb1bb950d09c8edfc78f980c21645c88ac408e (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> (cherry picked from commit 8401181bf0232959efb516802abcda42377ea06e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95315
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx44
1 files changed, 7 insertions, 37 deletions
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 762bd623a1d3..3ecc38fc383c 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -207,10 +207,6 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults
{
if (m_xGraphicBitmap.is())
nNumberFormat = style::NumberingType::BITMAP;
- else if (m_sBulletChar.isEmpty() && nNumberFormat != style::NumberingType::CHAR_SPECIAL)
- // w:lvlText is empty, that means no numbering in Word.
- // CHAR_SPECIAL is handled separately below.
- nNumberFormat = style::NumberingType::NUMBER_NONE;
aNumberingProperties.push_back(lcl_makePropVal(PROP_NUMBERING_TYPE, nNumberFormat));
}
@@ -548,40 +544,14 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
if (pLevel && !pLevel->GetBulletChar().isEmpty())
sText = pLevel->GetBulletChar( );
- if (sText.isEmpty())
- {
- // Empty <w:lvlText>? Then put a Unicode "zero width space" as a suffix, so LabelFollowedBy is still shown, as in Word.
- // With empty suffix, Writer does not show LabelFollowedBy, either.
- OUString sSuffix;
- auto it = std::find_if(aLvlProps.begin(), aLvlProps.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "NumberingType"; });
- if (it != aLvlProps.end())
- {
- sal_Int16 nNumberFormat = it->Value.get<sal_Int16>();
-
- // No need for a zero width space without a real LabelFollowedBy.
- bool bLabelFollowedBy = true;
- it = std::find_if(aLvlProps.begin(), aLvlProps.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "LabelFollowedBy"; });
- if (it != aLvlProps.end())
- {
- sal_Int16 nValue;
- if (it->Value >>= nValue)
- bLabelFollowedBy = nValue != SvxNumberFormat::NOTHING;
- }
+ aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_PREFIX), OUString("")));
+ aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SUFFIX), OUString("")));
+ aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_LIST_FORMAT), sText));
- if (bLabelFollowedBy && nNumberFormat == style::NumberingType::NUMBER_NONE)
- sSuffix = OUString(u'\x200B');
- }
- aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SUFFIX), sSuffix));
- }
- else
- {
- aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_LIST_FORMAT), sText));
-
- // Total count of replacement holders is determining amount of required parent numbering to include
- // TODO: not sure how "%" symbol is escaped. This is not supported yet
- sal_Int16 nParentNum = comphelper::string::getTokenCount(sText, '%');
- aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_PARENT_NUMBERING), nParentNum));
- }
+ // Total count of replacement holders is determining amount of required parent numbering to include
+ // TODO: not sure how "%" symbol is escaped. This is not supported yet
+ sal_Int16 nParentNum = comphelper::string::getTokenCount(sText, '%');
+ aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_PARENT_NUMBERING), nParentNum));
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_POSITION_AND_SPACE_MODE), sal_Int16(text::PositionAndSpaceMode::LABEL_ALIGNMENT)));