[PATCH] Change in core[libreoffice-4-0]: 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:00:43 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1731

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/31/1731/1

fdo#52286 fix RTF export of sub/super script font height

(cherry picked from commit 796e9a796603397c79e160610c8541e16dfc4c82)

Change-Id: If71cb6a20842f2fbe8eae94955da2d53842999a4
---
A sw/qa/extras/rtfexport/data/fdo52286.odt
M sw/qa/extras/rtfexport/rtfexport.cxx
M sw/source/filter/ww8/rtfattributeoutput.cxx
3 files changed, 19 insertions(+), 1 deletion(-)



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 150fc61..4f92fbb 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -69,6 +69,7 @@
     void testFdo55939();
     void testTextFrames();
     void testFdo53604();
+    void testFdo52286();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -112,6 +113,7 @@
         {"fdo55939.odt", &Test::testFdo55939},
         {"textframes.odt", &Test::testTextFrames},
         {"fdo53604.odt", &Test::testFdo53604},
+        {"fdo52286.odt", &Test::testFdo52286},
     };
     // Don't test the first import of these, for some reason those tests fail
     const char* aBlacklist[] = {
@@ -460,6 +462,13 @@
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount());
 }
 
+void Test::testFdo52286()
+{
+    // The problem was that font size wasn't reduced in sub/super script.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(58), getProperty<sal_Int32>(getRun(getParagraph(1), 2), "CharEscapementHeight"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(58), getProperty<sal_Int32>(getRun(getParagraph(2), 2), "CharEscapementHeight"));
+}
+
 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 9a65c42..14afa36 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1865,6 +1865,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();
@@ -1879,7 +1889,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/1731
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If71cb6a20842f2fbe8eae94955da2d53842999a4
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Miklos Vajna <vmiklos at suse.cz>



More information about the LibreOffice mailing list