build fix
[LibreOffice.git] / sw / source / filter / ww8 / escher.hxx
blob873486be7a29051e4a337066953bbd242eab76cd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_ESCHER_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_WW8_ESCHER_HXX
23 #include <filter/msfilter/escherex.hxx>
25 const sal_uInt32 nInlineHack = 0x00010001;
26 class SwFrameFormat;
27 // #i30669#
28 class SwFormatHoriOrient;
29 class SwFormatVertOrient;
31 class WinwordAnchoring : public EscherExClientRecord_Base
33 public:
34 void WriteData(EscherEx& rEx) const override;
35 void SetAnchoring(const SwFrameFormat& rFormat);
37 /** method to perform conversion of positioning attributes with the help
38 of corresponding layout information
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
50 @param _iorHoriOri
51 input/output parameter - containing the current horizontal position
52 attributes, which are converted by this method.
54 @param _iorVertOri
55 input/output parameter - containing the current vertical position
56 attributes, which are converted by this method.
58 @param _rFrameFormat
59 input parameter - frame format of the anchored object
61 @return boolean, indicating, if a conversion has been performed.
63 static bool ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
64 SwFormatVertOrient& _iorVertOri,
65 const SwFrameFormat& _rFrameFormat );
67 private:
68 bool mbInline;
69 sal_uInt32 mnXAlign;
70 sal_uInt32 mnYAlign;
71 sal_uInt32 mnXRelTo;
72 sal_uInt32 mnYRelTo;
76 class SwEscherExGlobal : public EscherExGlobal
78 public:
79 explicit SwEscherExGlobal();
80 virtual ~SwEscherExGlobal() override;
82 private:
83 /** Override to create a new memory stream for picture data. */
84 virtual SvStream* ImplQueryPictureStream() override;
86 private:
87 std::shared_ptr< SvStream > mxPicStrm;
90 class SwBasicEscherEx : public EscherEx
92 private:
93 void Init();
94 protected:
95 WW8Export& rWrt;
96 SvStream* pEscherStrm;
97 long mnEmuMul, mnEmuDiv;
99 virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat& rFormat, 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 css::awt::Rectangle* pVisArea );
106 static void WriteGrfAttr(const SwNoTextNode& rNd, const SwFrameFormat& rFormat, EscherPropertyContainer& rPropOpt);
108 sal_Int32 DrawModelToEmu(sal_Int32 nVal) const
109 { return BigMulDiv(nVal, mnEmuMul, mnEmuDiv); }
111 static sal_Int32 ToFract16(sal_Int32 nVal, sal_uInt32 nMax);
113 virtual void SetPicId(const SdrObject &, sal_uInt32, EscherPropertyContainer &);
114 SdrLayerID GetInvisibleHellId() const;
116 public:
117 SwBasicEscherEx(SvStream* pStrm, WW8Export& rWrt);
118 sal_Int32 WriteGrfFlyFrame(const SwFrameFormat& rFormat, sal_uInt32 nShapeId);
119 //For i120928,to export graphic of bullet
120 void WriteGrfBullet(const Graphic&);
121 sal_Int32 WriteOLEFlyFrame(const SwFrameFormat& rFormat, sal_uInt32 nShapeId);
122 void WriteEmptyFlyFrame(const SwFrameFormat& rFormat, sal_uInt32 nShapeId);
123 virtual void WriteFrameExtraData(const SwFrameFormat&);
124 virtual void WritePictures();
125 virtual ~SwBasicEscherEx() override;
126 //i120927,this function is added to export hyperlink info,such as graphic/frame/OLE
127 bool IsRelUrl();
128 OUString GetBasePath();
129 OUString BuildFileName(sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl);
130 void WriteHyperlinkWithinFly( SvMemoryStream& rStrm, const SwFormatURL* pINetFormatArg);
131 void PreWriteHyperlinkWithinFly(const SwFrameFormat& rFormat,EscherPropertyContainer& rPropOpt);
133 private:
134 SwBasicEscherEx(const SwBasicEscherEx&) = delete;
135 SwBasicEscherEx& operator=(const SwBasicEscherEx&) = delete;
138 class SwEscherEx : public SwBasicEscherEx
140 private:
141 std::vector<sal_uLong> aFollowShpIds;
142 EscherExHostAppData aHostData;
143 WinwordAnchoring aWinwordAnchoring;
144 WW8_WrPlcTextBoxes *pTextBxs;
146 sal_uInt32 GetFlyShapeId(const SwFrameFormat& rFormat,
147 unsigned int nHdFtIndex, DrawObjPointerVector &rPVec);
148 void MakeZOrderArrAndFollowIds(std::vector<DrawObj>& rSrcArr,
149 DrawObjPointerVector& rDstArr);
151 sal_Int32 WriteFlyFrame(const DrawObj &rObj, sal_uInt32 &rShapeId,
152 DrawObjPointerVector &rPVec);
153 sal_Int32 WriteTextFlyFrame(const DrawObj &rObj, sal_uInt32 nShapeId,
154 sal_uInt32 nTextBox, DrawObjPointerVector &rPVec);
155 void WriteOCXControl(const SwFrameFormat& rFormat,sal_uInt32 nShapeId);
156 virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat& rFormat, MSO_SPT eShapeType,
157 EscherPropertyContainer& rPropOpt) override;
159 virtual sal_uInt32 QueryTextID(
160 const css::uno::Reference< css::drawing::XShape > &, sal_uInt32) override;
161 virtual void SetPicId(const SdrObject &rSdrObj, sal_uInt32 nShapeId,
162 EscherPropertyContainer &rPropOpt) override;
163 public:
164 SwEscherEx( SvStream* pStrm, WW8Export& rWW8Wrt );
165 virtual ~SwEscherEx() override;
166 void FinishEscher();
167 virtual void WritePictures() override;
169 virtual void WriteFrameExtraData(const SwFrameFormat& rFormat) override;
171 EscherExHostAppData* StartShape(const css::uno::Reference< css::drawing::XShape > &, const Rectangle*) override {return &aHostData;}
172 private:
173 SwEscherEx(const SwEscherEx&) = delete;
174 SwEscherEx &operator=(const SwEscherEx&) = delete;
177 #endif
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */