1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: escher.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
37 #include <svx/escherex.hxx>
40 const sal_uInt32 nInlineHack
= 0x00010001;
42 // --> OD 2005-01-06 #i30669#
43 class SwFmtHoriOrient
;
44 class SwFmtVertOrient
;
47 class WinwordAnchoring
: public EscherExClientRecord_Base
50 void WriteData(EscherEx
& rEx
) const;
51 void SetAnchoring(const SwFrmFmt
& rFmt
);
53 /** method to perform conversion of positioning attributes with the help
54 of corresponding layout information
56 OD 2005-01-06 #i30669#
57 Because most of the Writer object positions doesn't correspond to the
58 object positions in WW8, this method converts the positioning
59 attributes. For this conversion the corresponding layout information
60 is needed. If no layout information exists - e.g. no layout exists - no
61 conversion is performed.
62 No conversion is performed for as-character anchored objects. Whose
63 object positions are already treated special in method <WriteData(..)>.
64 Usage of method: Used by method <SetAnchoring(..)>, nothing else
69 input/output parameter - containing the current horizontal position
70 attributes, which are converted by this method.
73 input/output parameter - containing the current vertical position
74 attributes, which are converted by this method.
77 input parameter - frame format of the anchored object
79 @return boolean, indicating, if a conversion has been performed.
81 static bool ConvertPosition( SwFmtHoriOrient
& _iorHoriOri
,
82 SwFmtVertOrient
& _iorVertOri
,
83 const SwFrmFmt
& _rFrmFmt
);
94 class SwBasicEscherEx
: public EscherEx
100 SvStream
* pEscherStrm
;
102 long mnEmuMul
, mnEmuDiv
;
104 virtual INT32
WriteFlyFrameAttr(const SwFrmFmt
& rFmt
, MSO_SPT eShapeType
,
105 EscherPropertyContainer
& rPropOpt
);
106 void WriteBrushAttr(const SvxBrushItem
&rBrush
,
107 EscherPropertyContainer
& rPropOpt
);
108 void WriteOLEPicture(EscherPropertyContainer
&rPropOpt
,
109 sal_uInt32 nShapeFlags
, const Graphic
&rGraphic
, const SdrObject
&rObj
,
110 sal_uInt32 nShapeId
, const com::sun::star::awt::Rectangle
* pVisArea
);
111 void WriteGrfAttr(const SwNoTxtNode
& rNd
,EscherPropertyContainer
& rPropOpt
);
113 INT32
DrawModelToEmu(INT32 nVal
) const
114 { return BigMulDiv(nVal
, mnEmuMul
, mnEmuDiv
); }
116 INT32
ToFract16(INT32 nVal
, UINT32 nMax
) const;
118 SvStream
* QueryPicStream();
120 virtual void SetPicId(const SdrObject
&, UINT32
, EscherPropertyContainer
&);
121 SdrLayerID
GetInvisibleHellId() const;
124 SwBasicEscherEx(SvStream
* pStrm
, WW8Export
& rWrt
, UINT32 nDrawings
= 1);
125 INT32
WriteGrfFlyFrame(const SwFrmFmt
& rFmt
, UINT32 nShapeId
);
126 INT32
WriteOLEFlyFrame(const SwFrmFmt
& rFmt
, UINT32 nShapeId
);
127 void WriteEmptyFlyFrame(const SwFrmFmt
& rFmt
, UINT32 nShapeId
);
128 virtual void WriteFrmExtraData(const SwFrmFmt
&);
129 virtual void WritePictures();
130 virtual ~SwBasicEscherEx();
133 SwBasicEscherEx(const SwBasicEscherEx
&);
134 SwBasicEscherEx
& operator=(const SwBasicEscherEx
&);
137 class SwEscherEx
: public SwBasicEscherEx
140 SvULongs aFollowShpIds
;
141 EscherExHostAppData aHostData
;
142 WinwordAnchoring aWinwordAnchoring
;
143 WW8_WrPlcTxtBoxes
*pTxtBxs
;
145 UINT32
GetFlyShapeId(const SwFrmFmt
& rFmt
,
146 unsigned int nHdFtIndex
, DrawObjPointerVector
&rPVec
);
147 void MakeZOrderArrAndFollowIds(std::vector
<DrawObj
>& rSrcArr
,
148 DrawObjPointerVector
& rDstArr
);
150 INT32
WriteFlyFrm(const DrawObj
&rObj
, UINT32
&rShapeId
,
151 DrawObjPointerVector
&rPVec
);
152 INT32
WriteTxtFlyFrame(const DrawObj
&rObj
, UINT32 nShapeId
,
153 UINT32 nTxtBox
, DrawObjPointerVector
&rPVec
);
154 void WriteOCXControl(const SwFrmFmt
& rFmt
,UINT32 nShapeId
);
155 virtual INT32
WriteFlyFrameAttr(const SwFrmFmt
& rFmt
, MSO_SPT eShapeType
,
156 EscherPropertyContainer
& rPropOpt
);
158 virtual UINT32
QueryTextID(
159 const com::sun::star::uno::Reference
<
160 com::sun::star::drawing::XShape
> &,UINT32
);
161 virtual void SetPicId(const SdrObject
&rSdrObj
, UINT32 nShapeId
,
162 EscherPropertyContainer
&rPropOpt
);
164 SwEscherEx( SvStream
* pStrm
, WW8Export
& rWW8Wrt
);
165 virtual ~SwEscherEx();
167 virtual void WritePictures();
169 virtual void WriteFrmExtraData(const SwFrmFmt
& rFmt
);
171 EscherExHostAppData
* StartShape(const com::sun::star::uno::Reference
<
172 com::sun::star::drawing::XShape
> &) {return &aHostData
;}
175 SwEscherEx(const SwEscherEx
&);
176 SwEscherEx
&operator=(const SwEscherEx
&);
181 /* vi:set tabstop=4 shiftwidth=4 expandtab: */