summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx8
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx8
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx9
3 files changed, 13 insertions, 12 deletions
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index cb4caa351b98..7a4dc17d4ede 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -176,8 +176,12 @@ DECLARE_WW8EXPORT_TEST(testTdf120225_textControlCrossRef, "tdf120225_textControl
DECLARE_WW8EXPORT_TEST(testTdf127316_autoEscapement, "tdf127316_autoEscapement.odt")
{
uno::Reference<text::XTextRange> xPara = getParagraph(2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1), "CharEscapement"), 0);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(-33.f, getProperty<float>(getRun(xPara, 2), "CharEscapement"), 3);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1, "Normal text "), "CharEscapement"), 0);
+ // Automatic escapement SHOULD BE limited by the font bottom line(?)
+ // and so the calculations ought to be different. There is room for a lot of export improvement here.
+ // Negative escapements (subscripts) were decreasing by 1% every round-trip due to bad manual rounding.
+ // The actual number of 33% isn't so important here, but test that it is stable across multiple round-trips.
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Did you fix or break me?", -33.f, getProperty<float>(getRun(xPara, 2), "CharEscapement"), 1);
}
DECLARE_WW8EXPORT_TEST(testTdf121111_fillStyleNone, "tdf121111_fillStyleNone.docx")
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 078f9dc94dd6..70ba0dd85115 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2306,14 +2306,14 @@ void RtfAttributeOutput::CharEscapement(const SvxEscapementItem& rEscapement)
const char* pUpDn;
- SwTwips nH = m_rExport.GetItem(RES_CHRATR_FONTSIZE).GetHeight();
+ double fHeight = m_rExport.GetItem(RES_CHRATR_FONTSIZE).GetHeight();
if (0 < rEscapement.GetEsc())
pUpDn = OOO_STRING_SVTOOLS_RTF_UP;
else if (0 > rEscapement.GetEsc())
{
pUpDn = OOO_STRING_SVTOOLS_RTF_DN;
- nH = -nH;
+ fHeight = -fHeight;
}
else
return;
@@ -2344,9 +2344,7 @@ void RtfAttributeOutput::CharEscapement(const SvxEscapementItem& rEscapement)
* ----------------------- = ------------
* 100% Escapement
*/
-
- m_aStyles.append(static_cast<sal_Int32>((long(nEsc) * nH) + 500) / 1000);
- // 500 to round !!
+ m_aStyles.append(static_cast<sal_Int32>(round(fHeight * nEsc / 1000)));
}
void RtfAttributeOutput::CharFont(const SvxFontItem& rFont)
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 040153b65bdd..17780b0e0efb 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1396,6 +1396,7 @@ void WW8AttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement )
else if ( DFLT_ESC_SUPER == nEsc || DFLT_ESC_AUTO_SUPER == nEsc )
b = 1;
}
+ // FIXME: these need a better formula. See rtfAttributeOutput
else if ( DFLT_ESC_AUTO_SUPER == nEsc )
nEsc = DFLT_ESC_SUPER;
else if ( DFLT_ESC_AUTO_SUB == nEsc )
@@ -1410,17 +1411,15 @@ void WW8AttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement )
if ( 0 == b || 0xFF == b )
{
- long nHeight = m_rWW8Export.GetItem( RES_CHRATR_FONTSIZE ).GetHeight();
+ double fHeight = m_rWW8Export.GetItem( RES_CHRATR_FONTSIZE ).GetHeight();
m_rWW8Export.InsUInt16( NS_sprm::sprmCHpsPos );
- m_rWW8Export.InsUInt16( static_cast<short>(( nHeight * nEsc + 500 ) / 1000 ));
+ m_rWW8Export.InsUInt16(static_cast<short>( round(fHeight * nEsc / 1000) ));
if( 100 != nProp || !b )
{
m_rWW8Export.InsUInt16( NS_sprm::sprmCHps );
-
- m_rWW8Export.InsUInt16(
- msword_cast<sal_uInt16>((nHeight * nProp + 500 ) / 1000));
+ m_rWW8Export.InsUInt16(msword_cast<sal_uInt16>( round(fHeight * nProp / 1000) ));
}
}
}