diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-04-07 20:22:33 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-04-07 20:22:33 +0200 |
commit | 92096d634ab93b42bb9ed6e634b2101452b2a609 (patch) | |
tree | 8306554f1feb4fbc650ccebc8c26ed9ce8086882 /sw | |
parent | b97cade9183d14ad21ae71892348a9a81689488b (diff) |
export RTF_LISTPICTURE and RTF_LEVELPICTURE
Change-Id: I5aac0e49013ce0f4b2e8e227bf4a6b61138884d4
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 35 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.hxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.cxx | 26 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.hxx | 1 |
4 files changed, 63 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index ce0c1e0f65cd..5d95a5687278 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1326,7 +1326,7 @@ void RtfAttributeOutput::NumberingLevel( sal_uInt8 nLevel, sal_Int16 nFirstLineIndex, sal_Int16 /*nListTabPos*/, const String &rNumberingString, - const SvxBrushItem* /*pBrush*/) + const SvxBrushItem* pBrush) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); @@ -1362,6 +1362,17 @@ void RtfAttributeOutput::NumberingLevel( sal_uInt8 nLevel, m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LEVELJC; m_rExport.OutULong( nVal ); + // bullet + if (nNumberingType == SVX_NUM_BITMAP && pBrush) + { + int nIndex = m_rExport.GetGrfIndex(*pBrush); + if (nIndex != -1) + { + m_rExport.Strm() << LO_STRING_SVTOOLS_RTF_LEVELPICTURE; + m_rExport.OutULong(nIndex); + } + } + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT; m_rExport.OutULong( nStart ); @@ -3544,4 +3555,26 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S m_rExport.Strm() << m_rExport.sNewLine; } +void RtfAttributeOutput::BulletDefinition(int /*nId*/, const Graphic& rGraphic, Size aSize) +{ + m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT; + m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_PICT OOO_STRING_SVTOOLS_RTF_PNGBLIP; + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_PICWGOAL; + m_rExport.OutULong(aSize.Width()); + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_PICHGOAL; + m_rExport.OutULong(aSize.Height()); + + m_rExport.Strm() << RtfExport::sNewLine; + const sal_uInt8* pGraphicAry = 0; + SvMemoryStream aStream; + if (GraphicConverter::Export(aStream, rGraphic, CVT_PNG) != ERRCODE_NONE) + SAL_WARN("sw.rtf", "failed to export the numbering picture bullet"); + aStream.Seek(STREAM_SEEK_TO_END); + sal_uInt32 nSize = aStream.Tell(); + pGraphicAry = (sal_uInt8*)aStream.GetData(); + RtfAttributeOutput::WriteHex(pGraphicAry, nSize, &m_rExport.Strm()); + m_rExport.Strm() << "}}"; // pict, shppict +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index 5038f32787d2..c4c6e840ada5 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -586,6 +586,9 @@ public: /// Writes binary data as a hex dump. static OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream = 0, sal_uInt32 nLimit = 64); + + /// Exports the definition (image, size) of a single numbering picture bullet. + void BulletDefinition(int nId, const Graphic& rGraphic, Size aSize); }; #endif // _RTFATTRIBUTEOUTPUT_HXX_ diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index cb769c77ec04..aaf8a5c48f73 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -57,6 +57,7 @@ #include <svtools/rtfkeywd.hxx> #include <filter/msfilter/rtfutil.hxx> #include <unotools/configmgr.hxx> +#include <vcl/svapp.hxx> #if OSL_DEBUG_LEVEL > 1 #include <iostream> @@ -171,7 +172,7 @@ void RtfExport::AppendBookmark( const OUString& rName, bool /*bSkip*/ ) //For i120928,to export graphic of bullet for RTF filter void RtfExport::ExportGrfBullet(const SwTxtNode&) { - SAL_INFO("sw.rtf", "TODO: " << OSL_THIS_FUNC); + // Noop, would be too late, see WriteNumbering() instead. } void RtfExport::WriteChar( sal_Unicode ) @@ -224,6 +225,21 @@ void RtfExport::BuildNumbering() } } +void RtfExport::BulletDefinitions() +{ + for (size_t i = 0; i < m_vecBulletPic.size(); ++i) + { + const MapMode aMapMode(MAP_TWIP); + const Graphic& rGraphic = *m_vecBulletPic[i]; + Size aSize(rGraphic.GetPrefSize()); + if (MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit()) + aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMapMode); + else + aSize = OutputDevice::LogicToLogic(aSize,rGraphic.GetPrefMapMode(), aMapMode); + m_pAttrOutput->BulletDefinition(i, rGraphic, aSize); + } +} + void RtfExport::WriteNumbering() { SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start"); @@ -232,6 +248,14 @@ void RtfExport::WriteNumbering() return; // no numbering is used Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_LISTTABLE; + + CollectGrfsOfBullets(); + if (!m_vecBulletPic.empty()) + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << LO_STRING_SVTOOLS_RTF_LISTPICTURE; + BulletDefinitions(); + if (!m_vecBulletPic.empty()) + Strm() << '}'; + AbstractNumberingDefinitions(); Strm() << '}'; diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx index 4f4f24e78e41..0481fd608bbf 100644 --- a/sw/source/filter/ww8/rtfexport.hxx +++ b/sw/source/filter/ww8/rtfexport.hxx @@ -181,6 +181,7 @@ private: void WriteFonts(); void WriteStyles(); + void BulletDefinitions(); void WriteMainText(); void WriteInfo(); /// Writes the writer-specific \pgdsctbl group. |