include/svtools/rtfkeywd.hxx | 1 + sw/qa/extras/rtfexport/data/para-shadow.rtf | 21 +++++++++++++++++++++ sw/qa/extras/rtfexport/rtfexport.cxx | 11 +++++++++++ sw/source/filter/ww8/rtfattributeoutput.cxx | 10 ++++++++-- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 3 +++ 5 files changed, 44 insertions(+), 2 deletions(-)
New commits: commit e06e0fd5ead2eeb7fcf221e53b646ea7efc337ef Author: Miklos Vajna <[email protected]> Date: Thu Aug 15 17:13:25 2013 +0200 RTF import/export of paragraph drop shadow Change-Id: I8d2485962947eac8acc9ada384a9c1bd4cb22503 diff --git a/include/svtools/rtfkeywd.hxx b/include/svtools/rtfkeywd.hxx index cf4e908..8eea58a 100644 --- a/include/svtools/rtfkeywd.hxx +++ b/include/svtools/rtfkeywd.hxx @@ -1206,6 +1206,7 @@ #define LO_STRING_SVTOOLS_RTF_MNOR "\\mnor" #define LO_STRING_SVTOOLS_RTF_LISTPICTURE "\\listpicture" #define LO_STRING_SVTOOLS_RTF_LEVELPICTURE "\\levelpicture" +#define LO_STRING_SVTOOLS_RTF_BRDRSH "\\brdrsh" #endif // _RTFKEYWD_HXX diff --git a/sw/qa/extras/rtfexport/data/para-shadow.rtf b/sw/qa/extras/rtfexport/data/para-shadow.rtf new file mode 100644 index 0000000..acc9fd1 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/para-shadow.rtf @@ -0,0 +1,21 @@ +{\rtf1 +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0; +\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red0\green0\blue10;} +\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\aspalpha\faauto\rin0\lin0\itap0 \rtlch \af0\afs22\alang1025 \ltrch +\fs22\lang1031\langfe1033\loch\af37\hich\af37\dbch\af39\cgrid +{\rtlch\af0 \ltrch \lang1033\langfe1033 \hich\af37\dbch\af39\loch\f37 A} +{\rtlch\af0 \ltrch +\lang1033\langfe1033 +\par } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\brdrt\brdrsh\brdrs\brdrw60\brsp20\brdrcf17 \brdrl\brdrsh\brdrs\brdrw60\brsp80\brdrcf17 \brdrb\brdrsh\brdrs\brdrw60\brsp20\brdrcf17 \brdrr\brdrsh\brdrs\brdrw60\brsp80\brdrcf17 +\aspalpha\faauto\rin0\lin0\itap0 +{\rtlch\af0 \ltrch\lang1033\langfe1033 \hich\af37\dbch\af39\loch\f37 B} +{\rtlch\af0 \ltrch +\lang1033\langfe1033 +\par } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\aspalpha\faauto\rin0\lin0\itap0 +{\rtlch\af0 \ltrch\lang1033\langfe1033 \hich\af37\dbch\af39\loch\f37 C} +{\rtlch\af0 +\ltrch\lang1033\langfe1033 +\par } +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 3f062e2..c9d6610 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -67,6 +67,7 @@ public: void testRecordChanges(); void testTextframeTable(); void testFdo66682(); + void testParaShadow(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -123,6 +124,7 @@ void Test::run() {"record-changes.rtf", &Test::testRecordChanges}, {"textframe-table.rtf", &Test::testTextframeTable}, {"fdo66682.rtf", &Test::testFdo66682}, + {"para-shadow.rtf", &Test::testParaShadow}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -628,6 +630,15 @@ void Test::testFdo66682() CPPUNIT_ASSERT_EQUAL(OUString(" "), aSuffix); } +void Test::testParaShadow() +{ + // The problem was that \brdrsh was ignored. + table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(getParagraph(2), "ParaShadowFormat"); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color)); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(60)), aShadow.ShadowWidth); +} + 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 89c3ecd..c5a1370 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -189,12 +189,14 @@ static OString OutTBLBorderLine(RtfExport &rExport, const SvxBorderLine* pLine, } static OString OutBorderLine(RtfExport &rExport, const SvxBorderLine* pLine, - const sal_Char* pStr, sal_uInt16 nDist) + const sal_Char* pStr, sal_uInt16 nDist, SvxShadowLocation eShadowLocation = SVX_SHADOW_NONE) { OStringBuffer aRet; aRet.append(OutTBLBorderLine(rExport, pLine, pStr)); aRet.append(OOO_STRING_SVTOOLS_RTF_BRSP); aRet.append((sal_Int32)nDist); + if (eShadowLocation == SVX_SHADOW_BOTTOMRIGHT) + aRet.append(LO_STRING_SVTOOLS_RTF_BRDRSH); return aRet.makeStringAndClear(); } @@ -3033,6 +3035,10 @@ void RtfAttributeOutput::FormatBox( const SvxBoxItem& rBox ) m_aSectionBreaks.append(OutBorderLine( m_rExport, rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BOX, nDist )); else { + SvxShadowLocation eShadowLocation = SVX_SHADOW_NONE; + if (const SfxPoolItem* pItem = GetExport().HasItem(RES_SHADOW)) + eShadowLocation = static_cast<const SvxShadowItem*>(pItem)->GetLocation(); + const sal_uInt16* pBrd = aBorders; const sal_Char** pBrdNms = (const sal_Char**)aBorderNames; for(int i = 0; i < 4; ++i, ++pBrd, ++pBrdNms) @@ -3040,7 +3046,7 @@ void RtfAttributeOutput::FormatBox( const SvxBoxItem& rBox ) if (const SvxBorderLine* pLn = rBox.GetLine(*pBrd)) { m_aSectionBreaks.append(OutBorderLine(m_rExport, pLn, *pBrdNms, - rBox.GetDistance(*pBrd))); + rBox.GetDistance(*pBrd), eShadowLocation)); } } } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 1aa7814..3d995c6 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2710,6 +2710,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_REVISIONS: m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_trackRevisions, RTFValue::Pointer_t(new RTFValue(1))); break; + case RTF_BRDRSH: + lcl_putBorderProperty(m_aStates, NS_rtf::LN_FSHADOW, RTFValue::Pointer_t(new RTFValue(1))); + break; default: { SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
