diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-01-17 09:41:07 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-01-17 10:01:39 +0100 |
commit | 796e9a796603397c79e160610c8541e16dfc4c82 (patch) | |
tree | 8efce7283a587d162ef79a9a13a7f45b47b0a537 | |
parent | b7aa16fe0da53001e056ad347ac5e10855376365 (diff) |
fdo#52286 fix RTF export of sub/super script font height
Change-Id: If71cb6a20842f2fbe8eae94955da2d53842999a4
-rw-r--r-- | sw/qa/extras/rtfexport/data/fdo52286.odt | bin | 0 -> 9130 bytes | |||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 11 |
3 files changed, 19 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfexport/data/fdo52286.odt b/sw/qa/extras/rtfexport/data/fdo52286.odt Binary files differnew file mode 100644 index 000000000000..b6e70efd0a0a --- /dev/null +++ b/sw/qa/extras/rtfexport/data/fdo52286.odt diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 4a4e62264f74..be9b27b96500 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -68,6 +68,7 @@ public: void testFdo55939(); void testTextFrames(); void testFdo53604(); + void testFdo52286(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -111,6 +112,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[] = { @@ -454,6 +456,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 9a65c42c0d5f..14afa3619218 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 ) { |