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

tdf#92454 DOCX import: allow overriding para prop from num style in para style

Word has a feature like this: a paragraph style can refer to a numbering
style, and both can specify paragraph margins. If that's the case, then
the ones from the paragraph style has priority.

In Writer, the numbering style has priority, so the only chance for
correct import result is to set the margin directly on the paragraph in
this case.

(cherry picked from commit f4badd9a)

Conflicts:
	sw/qa/extras/ooxmlimport/ooxmlimport.cxx

Conflicts:
	sw/qa/extras/ooxmlimport/ooxmlimport.cxx

Change-Id: Iff3b03bcc56e0db3a48452c293acf41c91b8f159
Reviewed-on: https://gerrit.libreoffice.org/18794Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
Tested-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst 8e911fe7
......@@ -2773,6 +2773,16 @@ DECLARE_OOXMLIMPORT_TEST(testTdf93919, "tdf93919.docx")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
}
DECLARE_OOXMLIMPORT_TEST(testTdf92454, "tdf92454.docx")
{
// The first paragraph had a large indentation / left margin as inheritance
// in Word and Writer works differently, and no direct value was set to be
// explicit.
uno::Reference<beans::XPropertyState> xParagraph(getParagraph(1), uno::UNO_QUERY);
// This was beans::PropertyState_DEFAULT_VALUE.
CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, xParagraph->getPropertyState("ParaFirstLineIndent"));
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -2039,6 +2039,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
rContext->Insert(PROP_PARA_RIGHT_MARGIN, uno::makeAny(nParaRightMargin));
}
// Indent properties from the paragraph style have priority
// over the ones from the numbering styles in Word, not in
// Writer.
boost::optional<PropertyMap::Property> oProperty;
if (pStyleSheetProperties && (oProperty = pStyleSheetProperties->getProperty(PROP_PARA_FIRST_LINE_INDENT)))
rContext->Insert(PROP_PARA_FIRST_LINE_INDENT, oProperty->second);
}
if( pStyleSheetProperties && pStyleSheetProperties->GetListLevel() >= 0 )
......
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