1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
24 #include <svx/svdtrans.hxx>
27 const sal_uInt32 nInlineHack
= 0x00010001;
30 class SwFormatHoriOrient
;
31 class SwFormatVertOrient
;
33 class WinwordAnchoring
: public EscherExClientRecord_Base
36 void WriteData(EscherEx
& rEx
) const override
;
37 void SetAnchoring(const SwFrameFormat
& rFormat
);
39 /** method to perform conversion of positioning attributes with the help
40 of corresponding layout information
43 Because most of the Writer object positions doesn't correspond to the
44 object positions in WW8, this method converts the positioning
45 attributes. For this conversion the corresponding layout information
46 is needed. If no layout information exists - e.g. no layout exists - no
47 conversion is performed.
48 No conversion is performed for as-character anchored objects. Whose
49 object positions are already treated special in method <WriteData(..)>.
50 Usage of method: Used by method <SetAnchoring(..)>, nothing else
53 input/output parameter - containing the current horizontal position
54 attributes, which are converted by this method.
57 input/output parameter - containing the current vertical position
58 attributes, which are converted by this method.
61 input parameter - frame format of the anchored object
63 @return boolean, indicating, if a conversion has been performed.
65 static bool ConvertPosition( SwFormatHoriOrient
& _iorHoriOri
,
66 SwFormatVertOrient
& _iorVertOri
,
67 const SwFrameFormat
& _rFrameFormat
);
71 sal_uInt32 mnGroupShapeBooleanProperties
;
79 class SwEscherExGlobal
: public EscherExGlobal
82 explicit SwEscherExGlobal();
83 virtual ~SwEscherExGlobal() override
;
86 /** Override to create a new memory stream for picture data. */
87 virtual SvStream
* ImplQueryPictureStream() override
;
90 std::shared_ptr
< SvStream
> mxPicStrm
;
93 class SwBasicEscherEx
: public EscherEx
99 SvStream
* mpEscherStrm
;
100 tools::Long mnEmuMul
, mnEmuDiv
;
102 virtual sal_Int32
WriteFlyFrameAttr(const SwFrameFormat
& rFormat
, MSO_SPT eShapeType
,
103 EscherPropertyContainer
& rPropOpt
);
104 void WriteBrushAttr(const SvxBrushItem
&rBrush
,
105 EscherPropertyContainer
& rPropOpt
);
106 void WriteOLEPicture(EscherPropertyContainer
&rPropOpt
,
107 ShapeFlag nShapeFlags
, const Graphic
&rGraphic
, const SdrObject
&rObj
,
108 sal_uInt32 nShapeId
, const css::awt::Rectangle
* pVisArea
);
109 static void WriteGrfAttr(const SwNoTextNode
& rNd
, const SwFrameFormat
& rFormat
, EscherPropertyContainer
& rPropOpt
);
111 sal_Int32
DrawModelToEmu(sal_Int32 nVal
) const
112 { return BigMulDiv(nVal
, mnEmuMul
, mnEmuDiv
); }
114 static sal_Int32
ToFract16(sal_Int32 nVal
, sal_uInt32 nMax
);
116 virtual void SetPicId(const SdrObject
&, sal_uInt32
, EscherPropertyContainer
&);
117 SdrLayerID
GetInvisibleHellId() const;
120 SwBasicEscherEx(SvStream
* pStrm
, WW8Export
& rWrt
);
121 sal_Int32
WriteGrfFlyFrame(const SwFrameFormat
& rFormat
, sal_uInt32 nShapeId
);
122 //For i120928,to export graphic of bullet
123 void WriteGrfBullet(const Graphic
&);
124 sal_Int32
WriteOLEFlyFrame(const SwFrameFormat
& rFormat
, sal_uInt32 nShapeId
);
125 void WriteEmptyFlyFrame(const SwFrameFormat
& rFormat
, sal_uInt32 nShapeId
);
126 virtual void WriteFrameExtraData(const SwFrameFormat
&);
127 virtual void WritePictures();
128 virtual ~SwBasicEscherEx() override
;
129 //i120927,this function is added to export hyperlink info,such as graphic/frame/OLE
130 bool IsRelUrl() const;
131 OUString
GetBasePath() const;
132 OUString
BuildFileName(sal_uInt16
& rnLevel
, bool& rbRel
, const OUString
& rUrl
);
133 void WriteHyperlinkWithinFly( SvMemoryStream
& rStrm
, const SwFormatURL
* pINetFormatArg
);
134 void PreWriteHyperlinkWithinFly(const SwFrameFormat
& rFormat
,EscherPropertyContainer
& rPropOpt
);
137 SwBasicEscherEx(const SwBasicEscherEx
&) = delete;
138 SwBasicEscherEx
& operator=(const SwBasicEscherEx
&) = delete;
141 class SwEscherEx
: public SwBasicEscherEx
144 std::vector
<sal_uLong
> m_aFollowShpIds
;
145 EscherExHostAppData m_aHostData
;
146 WinwordAnchoring m_aWinwordAnchoring
;
147 WW8_WrPlcTextBoxes
*m_pTextBxs
;
149 sal_uInt32
GetFlyShapeId(const SwFrameFormat
& rFormat
,
150 unsigned int nHdFtIndex
, DrawObjPointerVector
&rPVec
);
151 void MakeZOrderArrAndFollowIds(std::vector
<DrawObj
>& rSrcArr
,
152 DrawObjPointerVector
& rDstArr
);
154 sal_Int32
WriteFlyFrame(const DrawObj
&rObj
, sal_uInt32
&rShapeId
,
155 DrawObjPointerVector
&rPVec
);
156 sal_Int32
WriteTextFlyFrame(const DrawObj
&rObj
, sal_uInt32 nShapeId
,
157 sal_uInt32 nTextBox
, DrawObjPointerVector
&rPVec
);
158 void WriteOCXControl(const SwFrameFormat
& rFormat
,sal_uInt32 nShapeId
);
159 virtual sal_Int32
WriteFlyFrameAttr(const SwFrameFormat
& rFormat
, MSO_SPT eShapeType
,
160 EscherPropertyContainer
& rPropOpt
) override
;
162 virtual sal_uInt32
QueryTextID(
163 const css::uno::Reference
< css::drawing::XShape
> &, sal_uInt32
) override
;
164 virtual void SetPicId(const SdrObject
&rSdrObj
, sal_uInt32 nShapeId
,
165 EscherPropertyContainer
&rPropOpt
) override
;
167 SwEscherEx( SvStream
* pStrm
, WW8Export
& rWW8Wrt
);
168 virtual ~SwEscherEx() override
;
170 virtual void WritePictures() override
;
172 virtual void WriteFrameExtraData(const SwFrameFormat
& rFormat
) override
;
174 EscherExHostAppData
* StartShape(const css::uno::Reference
< css::drawing::XShape
> &, const tools::Rectangle
*) override
{return &m_aHostData
;}
176 SwEscherEx(const SwEscherEx
&) = delete;
177 SwEscherEx
&operator=(const SwEscherEx
&) = delete;
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */