diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-08-15 17:13:25 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-08-15 17:13:35 +0200 |
commit | e06e0fd5ead2eeb7fcf221e53b646ea7efc337ef (patch) | |
tree | ec5f1e6dc461d81f259c7762eec5c1df33d939a7 /sw | |
parent | 66b4bfe302e248fc1503c5c74b83f4fb5fee4026 (diff) |
RTF import/export of paragraph drop shadow
Change-Id: I8d2485962947eac8acc9ada384a9c1bd4cb22503
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfexport/data/para-shadow.rtf | 21 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 10 |
3 files changed, 40 insertions, 2 deletions
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 000000000000..acc9fd1574de --- /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 3f062e20a97d..c9d661071ba1 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 89c3ecd577f9..c5a13708ac80 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)); } } } |