diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfsdrexport.cxx | 41 |
2 files changed, 48 insertions, 3 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 7386247ffd3d..0ab46d27f0ee 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -1209,9 +1209,19 @@ DECLARE_RTFEXPORT_TEST(testWatermark, "watermark.rtf") CPPUNIT_ASSERT_EQUAL(OUString("WatermarkRTF"), xShape->getString()); uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); + OUString aFont; + float nFontSize; // Check transparency CPPUNIT_ASSERT_EQUAL(sal_Int16(50), getProperty<sal_Int16>(xShape, "FillTransparence")); + + // Check font family + CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CharFontName") >>= aFont); + CPPUNIT_ASSERT_EQUAL(OUString("DejaVu Serif"), aFont); + + // Check font size + CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CharHeight") >>= nFontSize); + CPPUNIT_ASSERT_EQUAL((float)66, nFontSize); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx index 3a7b3397d0a2..beb8adc44cf6 100644 --- a/sw/source/filter/ww8/rtfsdrexport.cxx +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -21,14 +21,19 @@ #include <memory> #include "rtfattributeoutput.hxx" #include <svtools/rtfkeywd.hxx> +#include <svtools/unitconv.hxx> #include <filter/msfilter/rtfutil.hxx> #include <editeng/editobj.hxx> +#include <editeng/editids.hrc> +#include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> #include <svx/svdotext.hxx> #include <svx/unoapi.hxx> #include <vcl/cvtgrf.hxx> #include <textboxhelper.hxx> #include <dcontact.hxx> #include <algorithm> +#include <filter/msfilter/rtfutil.hxx> using namespace css; @@ -554,9 +559,39 @@ sal_Int32 RtfSdrExport::StartShape() if (pParaObj) { - const EditTextObject& rEditObj = pParaObj->GetTextObject(); - lcl_AppendSP(m_rAttrOutput.RunText(), "gtextUNICODE", - msfilter::rtfutil::OutString(rEditObj.GetText(0), m_rExport.m_eCurrentEncoding)); + // this is reached only in case some text is attached to the shape + // Watermark or TextBox? + if (pTextObj->TakeObjNameSingul().match("Text Frame")) + WriteOutliner(*pParaObj, TXT_HFTXTBOX); + else + { + const EditTextObject& rEditObj = pParaObj->GetTextObject(); + const SfxItemSet& rItemSet = rEditObj.GetParaAttribs(0); + + lcl_AppendSP(m_rAttrOutput.RunText(), "gtextUNICODE", + msfilter::rtfutil::OutString(rEditObj.GetText(0), m_rExport.m_eCurrentEncoding)); + + const SvxFontItem* pFontFamily = static_cast<const SvxFontItem*>(rItemSet.GetItem(SID_ATTR_CHAR_FONT)); + if (pFontFamily) + { + lcl_AppendSP(m_rAttrOutput.RunText(), "gtextFont", + msfilter::rtfutil::OutString(pFontFamily->GetFamilyName(), m_rExport.m_eCurrentEncoding)); + } + + const SvxFontHeightItem* pFontHeight = static_cast<const SvxFontHeightItem*>(rItemSet.GetItem(SID_ATTR_CHAR_FONTHEIGHT)); + if (pFontHeight) + { + long nFontHeight = TransformMetric(pFontHeight->GetHeight(), FUNIT_TWIP, FUNIT_POINT); + lcl_AppendSP(m_rAttrOutput.RunText(), "gtextSize", + msfilter::rtfutil::OutString(OUString::number(nFontHeight * RTF_MULTIPLIER), m_rExport.m_eCurrentEncoding)); + } + + // RTF angle: 0-360 * 2^16 clockwise + // LO angle: 0-360 * 100 counter-clockwise + sal_Int32 nRotation = -1 * pTextObj->GetGeoStat().nRotationAngle * RTF_MULTIPLIER / 100; + lcl_AppendSP(m_rAttrOutput.RunText(), "rotation", + msfilter::rtfutil::OutString(OUString::number(nRotation), m_rExport.m_eCurrentEncoding)); + } } } |