summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-22 08:47:03 +0200
committerAndras Timar <andras.timar@collabora.com>2015-10-07 08:32:24 +0200
commit24bd53ea71663bc49881deff6d10baf995dcd232 (patch)
treef10dc02046d4047008c6553854ec243e51d2b14e
parent89469ff777e4ac5e6cce4bd72c4aef843d0a9255 (diff)
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 f4badd9a485f32f787d78431ed673e2932973887) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: Iff3b03bcc56e0db3a48452c293acf41c91b8f159 Reviewed-on: https://gerrit.libreoffice.org/19100 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf92454.docxbin0 -> 32409 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx10
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx7
3 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf92454.docx b/sw/qa/extras/ooxmlimport/data/tdf92454.docx
new file mode 100644
index 000000000000..70426685e207
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf92454.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index fa8d504d3144..a71c4f960a94 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2647,6 +2647,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();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index a56fbede00f0..835e9731da5d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2017,6 +2017,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 )