fdo#78939 [DOCX] Hang while opening due to incorrect modification of Style
http://opengrok.libreoffice.org/xref/core/sw/source/core/unocore/unosett.cxx#1884
Modifies the refernced style of the numbering rule to use the current numbering rule.
Actually the refernced style is not supposed to be modified.
As the numbering level formatonly uses that properties particular style,
which may or may not be a numbering style
For this Particular document the numbering format refers the "Default Style" (Normal).
Almost all of the styles in style.xml are based on it. Normal was modified,
and as a result the whole document was bulletized; Which caused the hang while opening
Removed the addition of style as a PARA_STYLE, as the properties of the
refernced style are already added in ListLevel::AddParaProperties
Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
Reviewed on:
https://gerrit.libreoffice.org/9668
Change-Id: I8cc143805a38613908d2e2cb4827882d4cf40a78
diff --git a/sw/qa/extras/ooxmlimport/data/fdo78939.docx b/sw/qa/extras/ooxmlimport/data/fdo78939.docx
new file mode 100644
index 0000000..2fc3198
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/fdo78939.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index ea1910b..1102c29 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2198,6 +2198,18 @@ DECLARE_OOXMLIMPORT_TEST(testGroupshapeTrackedchanges, "groupshape-trackedchange
CPPUNIT_ASSERT_EQUAL(OUString(" Inserted"), xShape->getString());
}
DECLARE_OOXMLIMPORT_TEST(testFdo78939, "fdo78939.docx")
{
// fdo#78939 : LO hanged while opening issue document
// Whenever a para-style was applied to a Numbering format level,
// LO incorrectly also changed the para-style..
// check that file opens and does not hang while opening and also
// check that an incorrect numbering style is not applied ...
CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(1), "NumberingStyleName"));
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 65f6a66..66e9d65 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -643,13 +643,6 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 1] = MAKE_PROPVAL( PROP_POSITION_AND_SPACE_MODE,
sal_Int16( text::PositionAndSpaceMode::LABEL_ALIGNMENT ) );
StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( );
if( pParaStyle.get())
{
aLvlProps.realloc( aLvlProps.getLength() + 1 );
aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 1] = MAKE_PROPVAL( PROP_PARAGRAPH_STYLE_NAME,
pParaStyle->sConvertedStyleName );
}
// Replace the numbering rules for the level
m_xNumRules->replaceByIndex( nLevel, uno::makeAny( aLvlProps ) );
@@ -662,6 +655,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
uno::Reference< container::XIndexReplace > xOutlineRules =
xOutlines->getChapterNumberingRules( );
StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( );
aLvlProps.realloc( aLvlProps.getLength() + 1 );
aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 1] = MAKE_PROPVAL( PROP_HEADING_STYLE_NAME,
pParaStyle->sConvertedStyleName );