[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 17 03:31:50 PST 2013


 sw/qa/extras/rtfexport/data/fdo52286.odt    |binary
 sw/qa/extras/rtfexport/rtfexport.cxx        |    9 +++++++++
 sw/source/filter/ww8/rtfattributeoutput.cxx |   11 ++++++++++-
 3 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 865471d966b6db24ece283a0c7a70ce1cea921fe
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jan 17 09:41:07 2013 +0100

    fdo#52286 fix RTF export of sub/super script font height
    
    (cherry picked from commit 796e9a796603397c79e160610c8541e16dfc4c82)
    
    Change-Id: If71cb6a20842f2fbe8eae94955da2d53842999a4
    Reviewed-on: https://gerrit.libreoffice.org/1731
    Reviewed-by: Noel Power <noel.power at suse.com>
    Tested-by: Noel Power <noel.power at suse.com>

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
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/fdo52286.odt 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 @@ public:
     void testFdo55939();
     void testTextFrames();
     void testFdo53604();
+    void testFdo52286();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -112,6 +113,7 @@ void Test::run()
         {"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 @@ void Test::testFdo53604()
     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 @@ void RtfAttributeOutput::CharEscapement( const SvxEscapementItem& rEsc )
 {
     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 @@ void RtfAttributeOutput::CharEscapement( const SvxEscapementItem& rEsc )
     else
         return;
 
-    short nEsc = rEsc.GetEsc();
     short nProp = rEsc.GetProp() * 100;
     if( DFLT_ESC_AUTO_SUPER == nEsc )
     {


More information about the Libreoffice-commits mailing list