[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source
Aron Budea
aron.budea at collabora.com
Tue Feb 21 16:29:26 UTC 2017
sw/qa/extras/ooxmlexport/data/tdf106001.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 6 ++++++
writerfilter/source/dmapper/DomainMapper.cxx | 13 +++++++++++--
3 files changed, 17 insertions(+), 2 deletions(-)
New commits:
commit 06c81a3e61e2d5743ffd8a50d85e5ecee989e46b
Author: Aron Budea <aron.budea at collabora.com>
Date: Thu Feb 16 19:36:54 2017 +0100
tdf#106001: Treat CharScaleWidth outliers as 100 in DOCX import
Spec limit is [1..600], sometimes documents contain 0,
which, similar to other values outside the limit should be
treated as 100.
Change-Id: I04aec25b638762392de3f9881cd72588f2753e71
Reviewed-on: https://gerrit.libreoffice.org/34341
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit 6e3a84023b46f6be632b43d2f5713d8d4bb2ba62)
Reviewed-on: https://gerrit.libreoffice.org/34368
diff --git a/sw/qa/extras/ooxmlexport/data/tdf106001.docx b/sw/qa/extras/ooxmlexport/data/tdf106001.docx
new file mode 100644
index 0000000..efe4104
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf106001.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 4dd08ae..ef278f2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -201,6 +201,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103976, "tdf103976.docx")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(60)), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf106001, "tdf106001.docx")
+{
+ // This was 0 (1 on UI), while Word treats outliers as 100 (outlier = not in [1..600])
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>( 100 ), getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharScaleWidth" ));
+}
+
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 823640c..fe7b9a9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1694,8 +1694,17 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
rContext->Insert(PROP_CHAR_AUTO_KERNING, uno::makeAny( nIntValue != 0 ) );
break;
case NS_ooxml::LN_EG_RPrBase_w:
- rContext->Insert(PROP_CHAR_SCALE_WIDTH,
- uno::makeAny( sal_Int16(nIntValue) ));
+ // ST_TextScale must fall between 1% and 600% according to spec, otherwise resets to 100% according to experience
+ if ((1 <= nIntValue) && (nIntValue <= 600))
+ {
+ rContext->Insert(PROP_CHAR_SCALE_WIDTH,
+ uno::makeAny( sal_Int16(nIntValue) ));
+ }
+ else
+ {
+ rContext->Insert(PROP_CHAR_SCALE_WIDTH,
+ uno::makeAny( sal_Int16(100) ));
+ }
break;
case NS_ooxml::LN_EG_RPrBase_imprint:
// FontRelief: NONE, EMBOSSED, ENGRAVED
More information about the Libreoffice-commits
mailing list