summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-01-17 09:41:07 +0100
committerNoel Power <noel.power@suse.com>2013-01-17 11:31:31 +0000
commit865471d966b6db24ece283a0c7a70ce1cea921fe (patch)
tree4429e916fd35a805f7893e1edc3ed5a3471344d4 /sw
parent7273244d44e7ab1e64b57cd3de7f89e72cbd9507 (diff)
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@suse.com> Tested-by: Noel Power <noel.power@suse.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/fdo52286.odtbin0 -> 9130 bytes
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx9
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx11
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
new file mode 100644
index 000000000000..b6e70efd0a0a
--- /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 150fc61ce306..4f92fbb2397e 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 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 )
{