1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 25 #ifndef _ESCHER_HXX 26 #define _ESCHER_HXX 27 28 #ifndef _ESCHEREX_HXX 29 #include <filter/msfilter/escherex.hxx> 30 #endif 31 32 const sal_uInt32 nInlineHack = 0x00010001; 33 class SwFrmFmt; 34 // --> OD 2005-01-06 #i30669# 35 class SwFmtHoriOrient; 36 class SwFmtVertOrient; 37 // <-- 38 39 class WinwordAnchoring : public EscherExClientRecord_Base 40 { 41 public: 42 void WriteData(EscherEx& rEx) const; 43 void SetAnchoring(const SwFrmFmt& rFmt); 44 45 /** method to perform conversion of positioning attributes with the help 46 of corresponding layout information 47 48 OD 2005-01-06 #i30669# 49 Because most of the Writer object positions doesn't correspond to the 50 object positions in WW8, this method converts the positioning 51 attributes. For this conversion the corresponding layout information 52 is needed. If no layout information exists - e.g. no layout exists - no 53 conversion is performed. 54 No conversion is performed for as-character anchored objects. Whose 55 object positions are already treated special in method <WriteData(..)>. 56 Usage of method: Used by method <SetAnchoring(..)>, nothing else 57 58 @author OD 59 60 @param _iorHoriOri 61 input/output parameter - containing the current horizontal position 62 attributes, which are converted by this method. 63 64 @param _iorVertOri 65 input/output parameter - containing the current vertical position 66 attributes, which are converted by this method. 67 68 @param _rFrmFmt 69 input parameter - frame format of the anchored object 70 71 @return boolean, indicating, if a conversion has been performed. 72 */ 73 static bool ConvertPosition( SwFmtHoriOrient& _iorHoriOri, 74 SwFmtVertOrient& _iorVertOri, 75 const SwFrmFmt& _rFrmFmt ); 76 77 private: 78 bool mbInline; 79 sal_uInt32 mnXAlign; 80 sal_uInt32 mnYAlign; 81 sal_uInt32 mnXRelTo; 82 sal_uInt32 mnYRelTo; 83 84 }; 85 86 class SwEscherExGlobal : public EscherExGlobal 87 { 88 public: 89 explicit SwEscherExGlobal(); 90 virtual ~SwEscherExGlobal(); 91 92 private: 93 /** Overloaded to create a new memory stream for picture data. */ 94 virtual SvStream* ImplQueryPictureStream(); 95 96 private: 97 ::std::auto_ptr< SvStream > mxPicStrm; 98 }; 99 100 class SwBasicEscherEx : public EscherEx 101 { 102 private: 103 void Init(); 104 protected: 105 WW8Export& rWrt; 106 SvStream* pEscherStrm; 107 long mnEmuMul, mnEmuDiv; 108 109 virtual sal_Int32 WriteFlyFrameAttr(const SwFrmFmt& rFmt, MSO_SPT eShapeType, 110 EscherPropertyContainer& rPropOpt); 111 void WriteBrushAttr(const SvxBrushItem &rBrush, 112 EscherPropertyContainer& rPropOpt); 113 void WriteOLEPicture(EscherPropertyContainer &rPropOpt, 114 sal_uInt32 nShapeFlags, const Graphic &rGraphic, const SdrObject &rObj, 115 sal_uInt32 nShapeId, const com::sun::star::awt::Rectangle* pVisArea ); 116 void WriteGrfAttr(const SwNoTxtNode& rNd,EscherPropertyContainer& rPropOpt); 117 DrawModelToEmu(sal_Int32 nVal) const118 sal_Int32 DrawModelToEmu(sal_Int32 nVal) const 119 { return BigMulDiv(nVal, mnEmuMul, mnEmuDiv); } 120 121 sal_Int32 ToFract16(sal_Int32 nVal, sal_uInt32 nMax) const; 122 123 virtual void SetPicId(const SdrObject &, sal_uInt32, EscherPropertyContainer &); 124 SdrLayerID GetInvisibleHellId() const; 125 126 public: 127 SwBasicEscherEx(SvStream* pStrm, WW8Export& rWrt); 128 sal_Int32 WriteGrfFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId); 129 //For i120928,to export graphic of bullet 130 sal_Int32 WriteGrfBullet(const Graphic&); 131 sal_Int32 WriteOLEFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId); 132 void WriteEmptyFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId); 133 virtual void WriteFrmExtraData(const SwFrmFmt&); 134 virtual void WritePictures(); 135 virtual ~SwBasicEscherEx(); 136 //i120927,this function is added to export hyperlink info,such as graphic/frame/OLE 137 bool IsRelUrl(); 138 String GetBasePath(); 139 String BuildFileName(sal_uInt16& rnLevel, bool& rbRel, const String& rUrl ); 140 void WriteHyperlinkWithinFly( SvMemoryStream& rStrm, const SwFmtURL* pINetFmtArg); 141 void PreWriteHyperlinkWithinFly(const SwFrmFmt& rFmt,EscherPropertyContainer& rPropOpt); 142 143 private: 144 //No copying 145 SwBasicEscherEx(const SwBasicEscherEx&); 146 SwBasicEscherEx& operator=(const SwBasicEscherEx&); 147 }; 148 149 class SwEscherEx : public SwBasicEscherEx 150 { 151 private: 152 SvULongs aFollowShpIds; 153 EscherExHostAppData aHostData; 154 WinwordAnchoring aWinwordAnchoring; 155 WW8_WrPlcTxtBoxes *pTxtBxs; 156 157 sal_uInt32 GetFlyShapeId(const SwFrmFmt& rFmt, 158 unsigned int nHdFtIndex, DrawObjPointerVector &rPVec); 159 void MakeZOrderArrAndFollowIds(std::vector<DrawObj>& rSrcArr, 160 DrawObjPointerVector& rDstArr); 161 162 sal_Int32 WriteFlyFrm(const DrawObj &rObj, sal_uInt32 &rShapeId, 163 DrawObjPointerVector &rPVec); 164 sal_Int32 WriteTxtFlyFrame(const DrawObj &rObj, sal_uInt32 nShapeId, 165 sal_uInt32 nTxtBox, DrawObjPointerVector &rPVec); 166 void WriteOCXControl(const SwFrmFmt& rFmt,sal_uInt32 nShapeId); 167 virtual sal_Int32 WriteFlyFrameAttr(const SwFrmFmt& rFmt, MSO_SPT eShapeType, 168 EscherPropertyContainer& rPropOpt); 169 170 virtual sal_uInt32 QueryTextID( 171 const com::sun::star::uno::Reference< 172 com::sun::star::drawing::XShape > &,sal_uInt32); 173 virtual void SetPicId(const SdrObject &rSdrObj, sal_uInt32 nShapeId, 174 EscherPropertyContainer &rPropOpt); 175 public: 176 SwEscherEx( SvStream* pStrm, WW8Export& rWW8Wrt ); 177 virtual ~SwEscherEx(); 178 void FinishEscher(); 179 virtual void WritePictures(); 180 181 virtual void WriteFrmExtraData(const SwFrmFmt& rFmt); 182 StartShape(const com::sun::star::uno::Reference<com::sun::star::drawing::XShape> &,const Rectangle *)183 EscherExHostAppData* StartShape(const com::sun::star::uno::Reference< 184 com::sun::star::drawing::XShape > &, const Rectangle*) {return &aHostData;} 185 private: 186 //No copying 187 SwEscherEx(const SwEscherEx&); 188 SwEscherEx &operator=(const SwEscherEx&); 189 }; 190 191 #endif 192 193 /* vi:set tabstop=4 shiftwidth=4 expandtab: */ 194