Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _ESCHER_HXX
21 : #define _ESCHER_HXX
22 :
23 : #include <filter/msfilter/escherex.hxx>
24 :
25 : const sal_uInt32 nInlineHack = 0x00010001;
26 : class SwFrmFmt;
27 : // #i30669#
28 : class SwFmtHoriOrient;
29 : class SwFmtVertOrient;
30 :
31 4 : class WinwordAnchoring : public EscherExClientRecord_Base
32 : {
33 : public:
34 : void WriteData(EscherEx& rEx) const;
35 : void SetAnchoring(const SwFrmFmt& rFmt);
36 :
37 : /** method to perform conversion of positioning attributes with the help
38 : of corresponding layout information
39 :
40 : #i30669#
41 : Because most of the Writer object positions doesn't correspond to the
42 : object positions in WW8, this method converts the positioning
43 : attributes. For this conversion the corresponding layout information
44 : is needed. If no layout information exists - e.g. no layout exists - no
45 : conversion is performed.
46 : No conversion is performed for as-character anchored objects. Whose
47 : object positions are already treated special in method <WriteData(..)>.
48 : Usage of method: Used by method <SetAnchoring(..)>, nothing else
49 :
50 : @param _iorHoriOri
51 : input/output parameter - containing the current horizontal position
52 : attributes, which are converted by this method.
53 :
54 : @param _iorVertOri
55 : input/output parameter - containing the current vertical position
56 : attributes, which are converted by this method.
57 :
58 : @param _rFrmFmt
59 : input parameter - frame format of the anchored object
60 :
61 : @return boolean, indicating, if a conversion has been performed.
62 : */
63 : static bool ConvertPosition( SwFmtHoriOrient& _iorHoriOri,
64 : SwFmtVertOrient& _iorVertOri,
65 : const SwFrmFmt& _rFrmFmt );
66 :
67 : private:
68 : bool mbInline;
69 : sal_uInt32 mnXAlign;
70 : sal_uInt32 mnYAlign;
71 : sal_uInt32 mnXRelTo;
72 : sal_uInt32 mnYRelTo;
73 :
74 : };
75 :
76 : class SwEscherExGlobal : public EscherExGlobal
77 : {
78 : public:
79 : explicit SwEscherExGlobal();
80 : virtual ~SwEscherExGlobal();
81 :
82 : private:
83 : /** Overloaded to create a new memory stream for picture data. */
84 : virtual SvStream* ImplQueryPictureStream();
85 :
86 : private:
87 : boost::shared_ptr< SvStream > mxPicStrm;
88 : };
89 :
90 : class SwBasicEscherEx : public EscherEx
91 : {
92 : private:
93 : void Init();
94 : protected:
95 : WW8Export& rWrt;
96 : SvStream* pEscherStrm;
97 : long mnEmuMul, mnEmuDiv;
98 :
99 : virtual sal_Int32 WriteFlyFrameAttr(const SwFrmFmt& rFmt, MSO_SPT eShapeType,
100 : EscherPropertyContainer& rPropOpt);
101 : void WriteBrushAttr(const SvxBrushItem &rBrush,
102 : EscherPropertyContainer& rPropOpt);
103 : void WriteOLEPicture(EscherPropertyContainer &rPropOpt,
104 : sal_uInt32 nShapeFlags, const Graphic &rGraphic, const SdrObject &rObj,
105 : sal_uInt32 nShapeId, const com::sun::star::awt::Rectangle* pVisArea );
106 : void WriteGrfAttr(const SwNoTxtNode& rNd,EscherPropertyContainer& rPropOpt);
107 :
108 8 : sal_Int32 DrawModelToEmu(sal_Int32 nVal) const
109 8 : { return BigMulDiv(nVal, mnEmuMul, mnEmuDiv); }
110 :
111 : sal_Int32 ToFract16(sal_Int32 nVal, sal_uInt32 nMax) const;
112 :
113 : virtual void SetPicId(const SdrObject &, sal_uInt32, EscherPropertyContainer &);
114 : SdrLayerID GetInvisibleHellId() const;
115 :
116 : public:
117 : SwBasicEscherEx(SvStream* pStrm, WW8Export& rWrt);
118 : sal_Int32 WriteGrfFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId);
119 : sal_Int32 WriteOLEFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId);
120 : void WriteEmptyFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId);
121 : virtual void WriteFrmExtraData(const SwFrmFmt&);
122 : virtual void WritePictures();
123 : virtual ~SwBasicEscherEx();
124 : private:
125 : //No copying
126 : SwBasicEscherEx(const SwBasicEscherEx&);
127 : SwBasicEscherEx& operator=(const SwBasicEscherEx&);
128 : };
129 :
130 : class SwEscherEx : public SwBasicEscherEx
131 : {
132 : private:
133 : std::vector<sal_uLong> aFollowShpIds;
134 : EscherExHostAppData aHostData;
135 : WinwordAnchoring aWinwordAnchoring;
136 : WW8_WrPlcTxtBoxes *pTxtBxs;
137 :
138 : sal_uInt32 GetFlyShapeId(const SwFrmFmt& rFmt,
139 : unsigned int nHdFtIndex, DrawObjPointerVector &rPVec);
140 : void MakeZOrderArrAndFollowIds(std::vector<DrawObj>& rSrcArr,
141 : DrawObjPointerVector& rDstArr);
142 :
143 : sal_Int32 WriteFlyFrm(const DrawObj &rObj, sal_uInt32 &rShapeId,
144 : DrawObjPointerVector &rPVec);
145 : sal_Int32 WriteTxtFlyFrame(const DrawObj &rObj, sal_uInt32 nShapeId,
146 : sal_uInt32 nTxtBox, DrawObjPointerVector &rPVec);
147 : void WriteOCXControl(const SwFrmFmt& rFmt,sal_uInt32 nShapeId);
148 : virtual sal_Int32 WriteFlyFrameAttr(const SwFrmFmt& rFmt, MSO_SPT eShapeType,
149 : EscherPropertyContainer& rPropOpt);
150 :
151 : virtual sal_uInt32 QueryTextID(
152 : const com::sun::star::uno::Reference<
153 : com::sun::star::drawing::XShape > &,sal_uInt32);
154 : virtual void SetPicId(const SdrObject &rSdrObj, sal_uInt32 nShapeId,
155 : EscherPropertyContainer &rPropOpt);
156 : public:
157 : SwEscherEx( SvStream* pStrm, WW8Export& rWW8Wrt );
158 : virtual ~SwEscherEx();
159 : void FinishEscher();
160 : virtual void WritePictures();
161 :
162 : virtual void WriteFrmExtraData(const SwFrmFmt& rFmt);
163 :
164 0 : EscherExHostAppData* StartShape(const com::sun::star::uno::Reference<
165 0 : com::sun::star::drawing::XShape > &, const Rectangle*) {return &aHostData;}
166 : private:
167 : //No copying
168 : SwEscherEx(const SwEscherEx&);
169 : SwEscherEx &operator=(const SwEscherEx&);
170 : };
171 :
172 : #endif
173 :
174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|