diff options
Diffstat (limited to 'sw/source/filter/ww8/wrtw8esh.cxx')
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 108 |
1 files changed, 52 insertions, 56 deletions
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 0117b7150a95..6686ae5b13d7 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2,14 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: wrtw8esh.cxx,v $ - * $Revision: 1.105.10.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -51,21 +47,21 @@ #include <svx/svdotext.hxx> #include <svx/svdmodel.hxx> #include <svx/svdpage.hxx> -#include <svx/outlobj.hxx> -#include <svx/editobj.hxx> +#include <editeng/outlobj.hxx> +#include <editeng/editobj.hxx> #include <svx/unoshape.hxx> -#include <svx/brshitem.hxx> -#include <svx/boxitem.hxx> -#include <svx/lrspitem.hxx> -#include <svx/ulspitem.hxx> -#include <svx/fontitem.hxx> -#include <svx/frmdiritem.hxx> +#include <editeng/brshitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/frmdiritem.hxx> #include <svx/svdoole2.hxx> -#include <svx/editeng.hxx> +#include <editeng/editeng.hxx> #ifndef _SVX_FLDITEM_HXX //miserable hack to get around #98519# -#include <svx/flditem.hxx> +#include <editeng/flditem.hxx> #endif #include <comphelper/seqstream.hxx> @@ -1312,16 +1308,14 @@ void WW8Export::WriteEscher() void SwEscherEx::WritePictures() { - if (pPictStrm) + if( SvStream* pPicStrm = static_cast< SwEscherExGlobal& >( *mxGlobal ).GetPictureStream() ) { // set the blip - entries to the correct stream pos INT32 nEndPos = rWrt.Strm().Tell(); - SetNewBlipStreamOffset( nEndPos ); - - pPictStrm->Seek( 0 ); - rWrt.Strm() << *pPictStrm; + mxGlobal->SetNewBlipStreamOffset( nEndPos ); - delete pPictStrm, pPictStrm = 0; + pPicStrm->Seek( 0 ); + rWrt.Strm() << *pPicStrm; } Flush(); } @@ -1330,10 +1324,24 @@ void SwEscherEx::WritePictures() // Output- Routines for Escher Export -SwBasicEscherEx::SwBasicEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt, - UINT32 nDrawings) - : EscherEx(*pStrm, nDrawings), rWrt(rWW8Wrt), pEscherStrm(pStrm), - pPictStrm(0) +SwEscherExGlobal::SwEscherExGlobal() +{ +} + +SwEscherExGlobal::~SwEscherExGlobal() +{ +} + +SvStream* SwEscherExGlobal::ImplQueryPictureStream() +{ + // this function will be called exactly once + mxPicStrm.reset( new SvMemoryStream ); + mxPicStrm->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + return mxPicStrm.get(); +} + +SwBasicEscherEx::SwBasicEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) + : EscherEx( EscherExGlobalRef( new SwEscherExGlobal ), *pStrm), rWrt(rWW8Wrt), pEscherStrm(pStrm) { Init(); } @@ -1446,8 +1454,8 @@ INT32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId) Point aEmptyPoint = Point(); Rectangle aRect( aEmptyPoint, aSize ); - sal_uInt32 nBlibId = GetBlibID( *QueryPicStream(), aUniqueId, - aRect, NULL, 0 ); + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), + aUniqueId, aRect, NULL, 0 ); if (nBlibId) aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, sal_True); } @@ -1655,8 +1663,8 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem &rBrush, Point aEmptyPoint = Point(); Rectangle aRect(aEmptyPoint, aSize); - sal_uInt32 nBlibId = GetBlibID(*QueryPicStream(), aUniqueId, - aRect, NULL, 0); + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), + aUniqueId, aRect, NULL, 0); if (nBlibId) rPropOpt.AddOpt(ESCHER_Prop_fillBlip,nBlibId,sal_True); } @@ -1898,16 +1906,6 @@ INT32 SwBasicEscherEx::ToFract16(INT32 nVal, UINT32 nMax) const return 0; } -SvStream* SwBasicEscherEx::QueryPicStream() -{ - if (!pPictStrm) - { - pPictStrm = new SvMemoryStream; - pPictStrm->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); - } - return pPictStrm; -} - SdrLayerID SwBasicEscherEx::GetInvisibleHellId() const { return rWrt.pDoc->GetInvisibleHellId(); @@ -1915,22 +1913,19 @@ SdrLayerID SwBasicEscherEx::GetInvisibleHellId() const void SwBasicEscherEx::WritePictures() { - ASSERT(pPictStrm, "no picture!"); - if (pPictStrm) + if( SvStream* pPicStrm = static_cast< SwEscherExGlobal& >( *mxGlobal ).GetPictureStream() ) { // set the blip - entries to the correct stream pos - INT32 nEndPos = pPictStrm->Tell(); - WriteBlibStoreEntry(*pEscherStrm, 1, sal_True, nEndPos); - - pPictStrm->Seek(0); - *pEscherStrm << *pPictStrm; + INT32 nEndPos = pPicStrm->Tell(); + mxGlobal->WriteBlibStoreEntry(*pEscherStrm, 1, sal_True, nEndPos); - delete pPictStrm, pPictStrm = 0; + pPicStrm->Seek(0); + *pEscherStrm << *pPicStrm; } } SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) - : SwBasicEscherEx(pStrm, rWW8Wrt, rWW8Wrt.pHFSdrObjs->size() ? 2 : 1), + : SwBasicEscherEx(pStrm, rWW8Wrt), pTxtBxs(0) { aHostData.SetClientData(&aWinwordAnchoring); @@ -1968,7 +1963,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) EnterGroup( 0 ); - ULONG nSecondShapeId = pSdrObjs == rWrt.pSdrObjs ? GetShapeID() : 0; + ULONG nSecondShapeId = pSdrObjs == rWrt.pSdrObjs ? GenerateShapeId() : 0; // write now all Writer-/DrawObjects DrawObjPointerVector aSorted; @@ -1994,7 +1989,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) nBorderThick = WriteFlyFrm(*pObj, nShapeId, aSorted); break; case sw::Frame::eFormControl: - WriteOCXControl(rFmt, nShapeId=GetShapeID()); + WriteOCXControl(rFmt, nShapeId = GenerateShapeId()); break; case sw::Frame::eDrawing: aWinwordAnchoring.SetAnchoring(rFmt); @@ -2564,10 +2559,10 @@ INT32 SwEscherEx::WriteFlyFrm(const DrawObj &rObj, UINT32 &rShapeId, switch( aIdx.GetNode().GetNodeType() ) { case ND_GRFNODE: - nBorderThick = WriteGrfFlyFrame( rFmt, rShapeId = GetShapeID() ); + nBorderThick = WriteGrfFlyFrame( rFmt, rShapeId = GenerateShapeId() ); break; case ND_OLENODE: - nBorderThick = WriteOLEFlyFrame( rFmt, rShapeId = GetShapeID() ); + nBorderThick = WriteOLEFlyFrame( rFmt, rShapeId = GenerateShapeId() ); break; default: if (const SdrObject* pObj = rFmt.FindRealSdrObject()) @@ -2706,7 +2701,8 @@ void SwBasicEscherEx::WriteOLEPicture(EscherPropertyContainer &rPropOpt, aRect.SetPos(Point(0,0)); aRect.Right() = DrawModelToEmu(aRect.Right()); aRect.Bottom() = DrawModelToEmu(aRect.Bottom()); - sal_uInt32 nBlibId = GetBlibID(*QueryPicStream(), aId, aRect, pVisArea, 0); // SJ: the fourth parameter (VisArea) should be set.. + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), + aId, aRect, pVisArea, 0); // SJ: the fourth parameter (VisArea) should be set.. if (nBlibId) rPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, sal_True); } @@ -2778,7 +2774,7 @@ void SwEscherEx::MakeZOrderArrAndFollowIds( bNeedsShapeId = true; } - ULONG nShapeId = bNeedsShapeId ? GetShapeID() : 0; + ULONG nShapeId = bNeedsShapeId ? GenerateShapeId() : 0; aFollowShpIds.Insert(nShapeId, n); } @@ -2793,12 +2789,12 @@ UINT32 SwEscherEx::GetFlyShapeId(const SwFrmFmt& rFmt, { if (0 == (nShapeId = aFollowShpIds[nPos])) { - nShapeId = GetShapeID(); + nShapeId = GenerateShapeId(); aFollowShpIds[ nPos ] = nShapeId; } } else - nShapeId = GetShapeID(); + nShapeId = GenerateShapeId(); return nShapeId; } |