diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-12-19 16:26:59 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-12-19 17:32:06 +0100 |
commit | e155e05ab70f1744d296dbee8c61564a5b7d346c (patch) | |
tree | fd4caaf9ad44103f5a71d4aa54e6940fcce7bf13 /writerfilter | |
parent | f3d54642672b4a4fb6cca0c2439744189de5f0bc (diff) |
DOCX filter: handle decimal number format with no level text correctly
The first problem was that no level text means no list text in Word, but
Writer only does that for the "none" numbering format.
Also, when the numbering format is "none", then Writer doesn't show the
follow character (typically a tab), either, but Word does: add a zero
width space as a suffix to mimic the Word behavior on DOCX import.
Adapt CppunitTest_sw_rtfimport accordingly, that effectively tested that
LabelFollowedBy is lost on import.
Change-Id: I7d5c7e62ba3d02da4a750ba5afad07e68b0b8c38
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 0a1c52fb8a50..cae1b6aee81a 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -33,6 +33,7 @@ #include <osl/diagnose.h> #include <rtl/ustring.hxx> +#include <comphelper/sequenceashashmap.hxx> #include "dmapperLoggers.hxx" @@ -273,6 +274,10 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetLevelProperties( ) { if (!m_sGraphicURL.isEmpty() || m_sGraphicBitmap.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( MAKE_PROPVAL(PROP_NUMBERING_TYPE, nNumberFormat )); } @@ -619,6 +624,20 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, aLvlProps.realloc( aLvlProps.getLength( ) + 4 ); aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 4] = MAKE_PROPVAL( PROP_PREFIX, rPrefix ); + + 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. + comphelper::SequenceAsHashMap aMap(aLvlProps); + if (aMap.find("NumberingType") != aMap.end()) + { + sal_Int16 nNumberFormat = aMap["NumberingType"].get<sal_Int16>(); + if (nNumberFormat == style::NumberingType::NUMBER_NONE) + rSuffix = OUString(static_cast<sal_Unicode>(0x200B)); + } + } + aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 3] = MAKE_PROPVAL( PROP_SUFFIX, rSuffix ); aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 2] = MAKE_PROPVAL( PROP_PARENT_NUMBERING, nParentNum ); |