[PATCH] Change in core[libreoffice-3-6]: fdo#52286 fix RTF export of sub/super script font height
Miklos Vajna (via Code Review)
gerrit at gerrit.libreoffice.org
Thu Jan 17 02:13:24 PST 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1732
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/32/1732/1
fdo#52286 fix RTF export of sub/super script font height
(cherry picked from commit 796e9a796603397c79e160610c8541e16dfc4c82)
Conflicts:
sw/qa/extras/rtfexport/rtfexport.cxx
Change-Id: If71cb6a20842f2fbe8eae94955da2d53842999a4
---
M sw/CppunitTest_sw_subsequent_rtfexport.mk
A sw/qa/extras/rtfexport/data/fdo52286.odt
M sw/qa/extras/rtfexport/rtfexport.cxx
M sw/source/filter/ww8/rtfattributeoutput.cxx
4 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/sw/CppunitTest_sw_subsequent_rtfexport.mk b/sw/CppunitTest_sw_subsequent_rtfexport.mk
index 3943f7e..407aae4 100644
--- a/sw/CppunitTest_sw_subsequent_rtfexport.mk
+++ b/sw/CppunitTest_sw_subsequent_rtfexport.mk
@@ -58,7 +58,9 @@
filter/source/config/cache/filterconfig1 \
framework/util/fwk \
i18npool/util/i18npool \
+ package/source/xstor/xstor \
package/util/package2 \
+ sax/source/expatwrap/expwrap \
sfx2/util/sfx \
svl/source/fsstor/fsstorage \
svtools/util/svt \
diff --git a/sw/qa/extras/rtfexport/data/fdo52286.odt b/sw/qa/extras/rtfexport/data/fdo52286.odt
new file mode 100644
index 0000000..b6e70ef
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo52286.odt
Binary files differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 428b7e1..62bdba8 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -49,6 +49,7 @@
void testFdo44174();
void testFdo50087();
void testFdo50831();
+ void testFdo52286();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -58,6 +59,7 @@
CPPUNIT_TEST(testFdo44174);
CPPUNIT_TEST(testFdo50087);
CPPUNIT_TEST(testFdo50831);
+ CPPUNIT_TEST(testFdo52286);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -144,6 +146,27 @@
CPPUNIT_ASSERT_EQUAL(10.f, fValue);
}
+void Test::testFdo52286()
+{
+ // The problem was that font size wasn't reduced in sub/super script.
+ roundtrip("fdo52286.odt");
+
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
+ xRunEnum->nextElement();
+ uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(58), xPropertySet->getPropertyValue("CharEscapementHeight").get<sal_Int32>());
+
+ xRunEnumAccess.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+ xRunEnum = xRunEnumAccess->createEnumeration();
+ xRunEnum->nextElement();
+ xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(58), xPropertySet->getPropertyValue("CharEscapementHeight").get<sal_Int32>());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 99160de..6944bbb 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1872,6 +1872,16 @@
{
SAL_INFO("sw.rtf", OSL_THIS_FUNC);
+ short nEsc = rEsc.GetEsc();
+ if (rEsc.GetProp() == DFLT_ESC_PROP)
+ {
+ if ( DFLT_ESC_SUB == nEsc || DFLT_ESC_AUTO_SUB == nEsc )
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SUB);
+ else if ( DFLT_ESC_SUPER == nEsc || DFLT_ESC_AUTO_SUPER == nEsc )
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SUPER);
+ return;
+ }
+
const char * pUpDn;
SwTwips nH = ((SvxFontHeightItem&)m_rExport.GetItem( RES_CHRATR_FONTSIZE )).GetHeight();
@@ -1886,7 +1896,6 @@
else
return;
- short nEsc = rEsc.GetEsc();
short nProp = rEsc.GetProp() * 100;
if( DFLT_ESC_AUTO_SUPER == nEsc )
{
--
To view, visit https://gerrit.libreoffice.org/1732
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If71cb6a20842f2fbe8eae94955da2d53842999a4
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-3-6
Gerrit-Owner: Miklos Vajna <vmiklos at suse.cz>
More information about the LibreOffice
mailing list