summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJozsef Szakacs <zmx3@citromail.hu>2019-03-13 12:32:20 +0100
committerLászló Németh <nemeth@numbertext.org>2019-05-29 14:31:03 +0200
commitbdfb3edb981ff04f1f3f6dc1ef335e37a0980245 (patch)
tree003858f805b7cc912d048e703c5fec7dd8aeceeb
parentbdc74dc279946abfdcca409edc96e985699eb368 (diff)
tdf#120412 DOCX filter: fix missing superscript
by editeng support of large superscript raising. Maximal raising of superscript text is 1584 pt in MSO, while LibreOffice didn't import the values greater than 100% of the current font height. Using the maximal percent value of the default 11 pt font, the limit is 14400% now, fixing most of the import problems. Greater raisings will be limited to 14400% during the DOCX import. Note: the standard doesn't limit the bigger percent values, see "20.374 style:text-position" and "18.3.23 percent" in OpenDocument 1.2. Change-Id: I3d0d08f273f2067180f74fba40c47d62364fcc59 Reviewed-on: https://gerrit.libreoffice.org/69164 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--editeng/source/items/textitem.cxx3
-rw-r--r--sw/qa/extras/ooxmlexport/data/test_tdf120412.docxbin0 -> 11820 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport10.cxx11
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx2
4 files changed, 15 insertions, 1 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 13c5c04ffbbe..e4ce386c68c9 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1782,7 +1782,8 @@ bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
case MID_ESC:
{
sal_Int16 nVal = sal_Int16();
- if( (rVal >>= nVal) && (std::abs(nVal) <= 101))
+ // tdf#120412 up to 14400% (eg. 1584 pt with 11 pt letters)
+ if( (rVal >>= nVal) && (std::abs(nVal) <= 14400))
nEsc = nVal;
else
return false;
diff --git a/sw/qa/extras/ooxmlexport/data/test_tdf120412.docx b/sw/qa/extras/ooxmlexport/data/test_tdf120412.docx
new file mode 100644
index 000000000000..6ce527842c9b
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/test_tdf120412.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 3b1250f11fd9..9cb85a8d11f0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -203,6 +203,17 @@ DECLARE_OOXMLEXPORT_TEST(textboxWpgOnly, "textbox-wpg-only.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xText), 1), "CharEscapementHeight"));
}
+DECLARE_OOXMLEXPORT_TEST(testFontEsc, "test_tdf120412.docx")
+{
+ xmlDocPtr pXmlDoc =parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ // don't lose the run with superscript formatting
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r", 2);
+ // raising is greater, than 100%
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:rPr/w:position","val", "24");
+}
+
DECLARE_OOXMLEXPORT_TEST(testMceWpg, "mce-wpg.docx")
{
// Make sure that we read the primary branch, if wpg is requested as a feature.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index cc7b7c720e05..6276d56a1b01 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2839,6 +2839,8 @@ void DomainMapper::processDeferredCharacterProperties( const std::map< sal_Int32
nEscapement = ( nIntValue > 0 ) ? 58: -58;
}
}
+ // tdf#120412 up to 14400% (eg. 1584 pt with 11 pt letters)
+ if( nEscapement > 14400 ) nEscapement = 14400;
rContext->Insert(PROP_CHAR_ESCAPEMENT, uno::makeAny( nEscapement ) );
rContext->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT, uno::makeAny( nProp ) );
}