Kaydet (Commit) 1c0113e7 authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Andras Timar

tdf#92124 DOCX import: don't add a dummy Suffix for an empty LabelFollowedBy

(cherry picked from commit 3e27df10)

Conflicts:
	sw/qa/extras/ooxmlimport/ooxmlimport.cxx
	writerfilter/source/dmapper/NumberingManager.cxx

Change-Id: I0c4366ad0a2f81a198860869f670767343a392be
Reviewed-on: https://gerrit.libreoffice.org/19032Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
(cherry picked from commit c33af041)
üst c8ea6ec1
...@@ -2783,6 +2783,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92454, "tdf92454.docx") ...@@ -2783,6 +2783,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92454, "tdf92454.docx")
CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, xParagraph->getPropertyState("ParaFirstLineIndent")); CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, xParagraph->getPropertyState("ParaFirstLineIndent"));
} }
DECLARE_OOXMLIMPORT_TEST(testTdf92124, "tdf92124.docx")
{
// Get the second paragraph's numbering style's 1st level's suffix.
uno::Reference<text::XTextRange> xParagraph = getParagraph(2);
auto xLevels = getProperty< uno::Reference<container::XIndexAccess> >(xParagraph, "NumberingRules");
uno::Sequence<beans::PropertyValue> aLevel;
xLevels->getByIndex(0) >>= aLevel; // 1st level
OUString aSuffix = std::find_if(aLevel.begin(), aLevel.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "Suffix"; })->Value.get<OUString>();
// Make sure it's empty as the source document contains <w:suff w:val="nothing"/>.
CPPUNIT_ASSERT(aSuffix.isEmpty());
}
#endif #endif
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -632,7 +632,18 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, ...@@ -632,7 +632,18 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
if (aMap.find("NumberingType") != aMap.end()) if (aMap.find("NumberingType") != aMap.end())
{ {
sal_Int16 nNumberFormat = aMap["NumberingType"].get<sal_Int16>(); sal_Int16 nNumberFormat = aMap["NumberingType"].get<sal_Int16>();
if (nNumberFormat == style::NumberingType::NUMBER_NONE)
// No need for a zero width space without a real LabelFollowedBy.
bool bLabelFollowedBy = true;
auto 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;
}
if (bLabelFollowedBy && nNumberFormat == style::NumberingType::NUMBER_NONE)
rSuffix = OUString(static_cast<sal_Unicode>(0x200B)); rSuffix = OUString(static_cast<sal_Unicode>(0x200B));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment