From d8c57765e9e76b9cebf9b31c1a846b17a7ab0be2 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 8 Jul 2011 17:56:04 +0200 Subject: [PATCH] move drawpage handling to sdrimport --- .../source/rtftok/rtfdocumentimpl.cxx | 44 ++++++------------- .../source/rtftok/rtfdocumentimpl.hxx | 9 ++-- writerfilter/source/rtftok/rtfsdrimport.cxx | 9 +++- writerfilter/source/rtftok/rtfsdrimport.hxx | 6 ++- 4 files changed, 29 insertions(+), 39 deletions(-) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index ccb6766e33ee..3d0e7df6e82b 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -25,6 +25,19 @@ * instead of those above. */ +#include +#include +#include +#include +#include +#include +#include + +#include // NS_sprm namespace +#include // NS_rtf namespace +#include // NS_ooxml namespace +#include // ooxml namespace + #include #include #include @@ -32,25 +45,6 @@ #include #include #include -#include // NS_sprm namespace -#include // NS_rtf namespace -#include // NS_ooxml namespace -#include // ooxml namespace -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) @@ -288,12 +282,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference const& x m_pGraphicHelper = new oox::GraphicHelper(m_xContext, xFrame, m_xStorage); - uno::Reference xDrawings(m_xDstDoc, uno::UNO_QUERY); - OSL_ASSERT(xDrawings.is()); - m_xDrawPage.set(xDrawings->getDrawPage(), uno::UNO_QUERY); - OSL_ASSERT(m_xDrawPage.is()); - - m_pSdrImport = new RTFSdrImport(*this); + m_pSdrImport = new RTFSdrImport(*this, m_xDstDoc); } RTFDocumentImpl::~RTFDocumentImpl() @@ -2527,11 +2516,6 @@ void RTFDocumentImpl::replayShapetext() replayBuffer(m_aShapetextBuffer); } -com::sun::star::uno::Reference RTFDocumentImpl::getDrawPage() -{ - return m_xDrawPage; -} - RTFParserState::RTFParserState() : nInternalState(INTERNAL_NORMAL), nDestinationState(DESTINATION_NORMAL), diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 2daf9fd2c216..680c44c83516 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -33,12 +33,11 @@ #include #include -#include +#include +#include #include #include -#include -#include -#include +#include #include #include @@ -245,7 +244,6 @@ namespace writerfilter { void setDestinationText(rtl::OUString& rString); /// Resolve a picture: If not inline, then anchored. int resolvePict(bool bInline); - com::sun::star::uno::Reference getDrawPage(); void runBreak(); void replayShapetext(); private: @@ -284,7 +282,6 @@ namespace writerfilter { com::sun::star::uno::Reference const& m_xDstDoc; com::sun::star::uno::Reference const& m_xFrame; com::sun::star::uno::Reference m_xModelFactory; - com::sun::star::uno::Reference m_xDrawPage; SvStream* m_pInStream; Stream* m_pMapperStream; RTFSdrImport* m_pSdrImport; diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index ba36fe2a5ee0..c6c4ffa9ec9b 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -58,9 +58,14 @@ static sal_uInt32 lcl_BGRToRGB(sal_uInt32 nColor) namespace writerfilter { namespace rtftok { -RTFSdrImport::RTFSdrImport(RTFDocumentImpl& rDocument) +RTFSdrImport::RTFSdrImport(RTFDocumentImpl& rDocument, + uno::Reference const& xDstDoc) : m_rImport(rDocument) { + uno::Reference xDrawings(xDstDoc, uno::UNO_QUERY); + OSL_ASSERT(xDrawings.is()); + m_xDrawPage.set(xDrawings->getDrawPage(), uno::UNO_QUERY); + OSL_ASSERT(m_xDrawPage.is()); } RTFSdrImport::~RTFSdrImport() @@ -275,7 +280,7 @@ void RTFSdrImport::resolve(RTFShape& rShape) return; } - m_rImport.getDrawPage()->add(xShape); + m_xDrawPage->add(xShape); if (bCustom) { uno::Reference xDefaulter(xShape, uno::UNO_QUERY); diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index 3c45950272de..5bc981cc68b8 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -28,6 +28,8 @@ #ifndef _RTFSDRIMPORT_HXX_ #define _RTFSDRIMPORT_HXX_ +#include + #include namespace writerfilter { @@ -36,7 +38,8 @@ namespace writerfilter { class RTFSdrImport { public: - RTFSdrImport(RTFDocumentImpl& rDocument); + RTFSdrImport(RTFDocumentImpl& rImport, + com::sun::star::uno::Reference const& xDstDoc); virtual ~RTFSdrImport(); void resolve(RTFShape& rShape); @@ -46,6 +49,7 @@ namespace writerfilter { com::sun::star::uno::Reference& xPropertySet); RTFDocumentImpl& m_rImport; + com::sun::star::uno::Reference m_xDrawPage; }; } // namespace rtftok } // namespace writerfilter