move drawpage handling to sdrimport

This commit is contained in:
Miklos Vajna 2011-07-08 17:56:04 +02:00
parent 24c413558a
commit d8c57765e9
4 changed files with 29 additions and 39 deletions

View file

@ -25,6 +25,19 @@
* instead of those above.
*/
#include <editeng/borderline.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/tencinfo.h>
#include <svl/lngmisc.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/streamwrap.hxx>
#include <doctok/sprmids.hxx> // NS_sprm namespace
#include <doctok/resourceids.hxx> // NS_rtf namespace
#include <ooxml/resourceids.hxx> // NS_ooxml namespace
#include <ooxml/OOXMLFastTokens.hxx> // ooxml namespace
#include <rtfdocumentimpl.hxx>
#include <rtfsdrimport.hxx>
#include <rtftypes.hxx>
@ -32,25 +45,6 @@
#include <rtfvalue.hxx>
#include <rtfsprm.hxx>
#include <rtfreferenceproperties.hxx>
#include <doctok/sprmids.hxx> // NS_sprm namespace
#include <doctok/resourceids.hxx> // NS_rtf namespace
#include <ooxml/resourceids.hxx> // NS_ooxml namespace
#include <ooxml/OOXMLFastTokens.hxx> // ooxml namespace
#include <unotools/ucbstreamhelper.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/tencinfo.h>
#include <svl/lngmisc.hxx>
#include <editeng/borderline.hxx>
#include <unotools/streamwrap.hxx>
#include <svx/msdffdef.hxx>
#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
#include <com/sun/star/text/WritingMode.hpp>
#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
@ -288,12 +282,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_pGraphicHelper = new oox::GraphicHelper(m_xContext, xFrame, m_xStorage);
uno::Reference<drawing::XDrawPageSupplier> 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<com::sun::star::drawing::XDrawPage> RTFDocumentImpl::getDrawPage()
{
return m_xDrawPage;
}
RTFParserState::RTFParserState()
: nInternalState(INTERNAL_NORMAL),
nDestinationState(DESTINATION_NORMAL),

View file

@ -33,12 +33,11 @@
#include <vector>
#include <queue>
#include <rtl/strbuf.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <oox/helper/graphichelper.hxx>
#include <oox/helper/storagebase.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <rtl/strbuf.hxx>
#include <resourcemodel/WW8ResourceModel.hxx>
#include <rtftok/RTFDocument.hxx>
@ -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<com::sun::star::drawing::XDrawPage> getDrawPage();
void runBreak();
void replayShapetext();
private:
@ -284,7 +282,6 @@ namespace writerfilter {
com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const& m_xDstDoc;
com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const& m_xFrame;
com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xModelFactory;
com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage> m_xDrawPage;
SvStream* m_pInStream;
Stream* m_pMapperStream;
RTFSdrImport* m_pSdrImport;

View file

@ -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<lang::XComponent> const& xDstDoc)
: m_rImport(rDocument)
{
uno::Reference<drawing::XDrawPageSupplier> 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<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(xShape, uno::UNO_QUERY);

View file

@ -28,6 +28,8 @@
#ifndef _RTFSDRIMPORT_HXX_
#define _RTFSDRIMPORT_HXX_
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <rtfdocumentimpl.hxx>
namespace writerfilter {
@ -36,7 +38,8 @@ namespace writerfilter {
class RTFSdrImport
{
public:
RTFSdrImport(RTFDocumentImpl& rDocument);
RTFSdrImport(RTFDocumentImpl& rImport,
com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const& xDstDoc);
virtual ~RTFSdrImport();
void resolve(RTFShape& rShape);
@ -46,6 +49,7 @@ namespace writerfilter {
com::sun::star::uno::Reference<beans::XPropertySet>& xPropertySet);
RTFDocumentImpl& m_rImport;
com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage> m_xDrawPage;
};
} // namespace rtftok
} // namespace writerfilter