[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Mar 14 11:23:43 UTC 2017
sw/qa/extras/rtfimport/data/tdf105729.rtf | 9 +++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 6 ++++++
writerfilter/source/dmapper/DomainMapper.cxx | 6 ++++--
3 files changed, 19 insertions(+), 2 deletions(-)
New commits:
commit 2cc5f18d10cf6ef1349d9518e6f67977f7c5d9bf
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 14 09:38:44 2017 +0100
tdf#105729 RTF import: \ltrpar should not override \qc from style
This is similar to commit 92fd894ea18672cba4cf961bdc4c0bc98f168102
(tdf#94435 RTF import: \ltrpar should not override \qc, 2015-10-05),
except that here the \qc is inherited from the style, it's not a direct
formatting. The problematic code was added in commit
2638faa2e834c2da4c195224fd88d32c29b3d0cc (writerfilter08ooo330: applied
patch for writerfilter08, 2010-07-28), and it's not really clear to me
what is its purpose, given that the DOC import equivalent in
SwWW8ImplReader::Read_ParaBiDi() doesn't set the paragraph alignment.
Fix the situation by not touching the paragraph alignment for the RTF
case at least.
Change-Id: I2baa2c8c8012d972740da7cf3f710117812859b3
Reviewed-on: https://gerrit.libreoffice.org/35163
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/qa/extras/rtfimport/data/tdf105729.rtf b/sw/qa/extras/rtfimport/data/tdf105729.rtf
new file mode 100644
index 0000000..996dd37
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf105729.rtf
@@ -0,0 +1,9 @@
+{\rtf1
+{\stylesheet
+{\s16\qc
+Titel 1;}
+}
+\pard\plain \ltrpar\s16\qc
+Centered Title
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 098a210..68d71db 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2797,6 +2797,12 @@ DECLARE_RTFIMPORT_TEST(testTdf104287, "tdf104287.rtf")
CPPUNIT_ASSERT(xShape->getAnchor().is());
}
+DECLARE_RTFIMPORT_TEST(testTdf105729, "tdf105729.rtf")
+{
+ // This was style::ParagraphAdjust_LEFT, \ltrpar undone the effect of \qc from style.
+ CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust")));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 8c42966..2c44cbb 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1445,12 +1445,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
if (nIntValue != 0)
{
rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::RL_TB ));
- rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_RIGHT ), /*bOverwrite=*/false);
+ if (!IsRTFImport())
+ rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_RIGHT ), /*bOverwrite=*/false);
}
else
{
rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::LR_TB ));
- rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_LEFT ), /*bOverwrite=*/false);
+ if (!IsRTFImport())
+ rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_LEFT ), /*bOverwrite=*/false);
}
}
More information about the Libreoffice-commits
mailing list