LibreOffice Module sw (master)  1
escher.hxx
Go to the documentation of this file.
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 INCLUDED_SW_SOURCE_FILTER_WW8_ESCHER_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_WW8_ESCHER_HXX
22 
24 
25 const sal_uInt32 nInlineHack = 0x00010001;
26 class SwFrameFormat;
27 // #i30669#
28 class SwFormatHoriOrient;
29 class SwFormatVertOrient;
30 
32 {
33 public:
34  void WriteData(EscherEx& rEx) const override;
35  void SetAnchoring(const SwFrameFormat& rFormat);
36 
63  static bool ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
64  SwFormatVertOrient& _iorVertOri,
65  const SwFrameFormat& _rFrameFormat );
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 
77 {
78 public:
79  explicit SwEscherExGlobal();
80  virtual ~SwEscherExGlobal() override;
81 
82 private:
84  virtual SvStream* ImplQueryPictureStream() override;
85 
86 private:
87  std::shared_ptr< SvStream > mxPicStrm;
88 };
89 
90 class SwBasicEscherEx : public EscherEx
91 {
92 private:
93  void Init();
94 protected:
98 
99  virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat& rFormat, MSO_SPT eShapeType,
100  EscherPropertyContainer& rPropOpt);
101  void WriteBrushAttr(const SvxBrushItem &rBrush,
102  EscherPropertyContainer& rPropOpt);
104  ShapeFlag 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);
107 
108  sal_Int32 DrawModelToEmu(sal_Int32 nVal) const
109  { return BigMulDiv(nVal, mnEmuMul, mnEmuDiv); }
110 
111  static sal_Int32 ToFract16(sal_Int32 nVal, sal_uInt32 nMax);
112 
113  virtual void SetPicId(const SdrObject &, sal_uInt32, EscherPropertyContainer &);
115 
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);
132 
133 private:
134  SwBasicEscherEx(const SwBasicEscherEx&) = delete;
135  SwBasicEscherEx& operator=(const SwBasicEscherEx&) = delete;
136 };
137 
139 {
140 private:
141  std::vector<sal_uLong> aFollowShpIds;
145 
146  sal_uInt32 GetFlyShapeId(const SwFrameFormat& rFormat,
147  unsigned int nHdFtIndex, DrawObjPointerVector &rPVec);
148  void MakeZOrderArrAndFollowIds(std::vector<DrawObj>& rSrcArr,
149  DrawObjPointerVector& rDstArr);
150 
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;
158 
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;
168 
169  virtual void WriteFrameExtraData(const SwFrameFormat& rFormat) override;
170 
171  EscherExHostAppData* StartShape(const css::uno::Reference< css::drawing::XShape > &, const tools::Rectangle*) override {return &aHostData;}
172 private:
173  SwEscherEx(const SwEscherEx&) = delete;
174  SwEscherEx &operator=(const SwEscherEx&) = delete;
175 };
176 
177 #endif
178 
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvStream * pEscherStrm
Definition: escher.hxx:96
Exporter of the binary Word file formats.
Definition: wrtww8.hxx:964
std::vector< sal_uLong > aFollowShpIds
Definition: escher.hxx:141
WW8_WrPlcTextBoxes * pTextBxs
Definition: escher.hxx:144
std::shared_ptr< SvStream > mxPicStrm
Definition: escher.hxx:87
void WriteOCXControl(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:2957
virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat &rFormat, MSO_SPT eShapeType, EscherPropertyContainer &rPropOpt) override
Definition: wrtw8esh.cxx:2113
sal_Int32 WriteOLEFlyFrame(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:1819
SwBasicEscherEx & operator=(const SwBasicEscherEx &)=delete
void SetAnchoring(const SwFrameFormat &rFormat)
Definition: wrtw8esh.cxx:2637
SwEscherEx & operator=(const SwEscherEx &)=delete
const sal_uInt32 nInlineHack
Definition: escher.hxx:25
virtual void WriteFrameExtraData(const SwFrameFormat &rFormat) override
Definition: wrtw8esh.cxx:2772
virtual void SetPicId(const SdrObject &rSdrObj, sal_uInt32 nShapeId, EscherPropertyContainer &rPropOpt) override
Definition: wrtw8esh.cxx:1810
virtual void SetPicId(const SdrObject &, sal_uInt32, EscherPropertyContainer &)
Definition: wrtw8esh.cxx:1805
static bool ConvertPosition(SwFormatHoriOrient &_iorHoriOri, SwFormatVertOrient &_iorVertOri, const SwFrameFormat &_rFrameFormat)
method to perform conversion of positioning attributes with the help of corresponding layout informat...
Definition: wrtw8esh.cxx:2441
virtual sal_uInt32 QueryTextID(const css::uno::Reference< css::drawing::XShape > &, sal_uInt32) override
Definition: wrtw8esh.cxx:3032
virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat &rFormat, MSO_SPT eShapeType, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:1933
MSO_SPT
void WriteHyperlinkWithinFly(SvMemoryStream &rStrm, const SwFormatURL *pINetFormatArg)
Definition: wrtw8esh.cxx:178
SwBasicEscherEx(SvStream *pStrm, WW8Export &rWrt)
Definition: wrtw8esh.cxx:1527
sal_uInt32 mnXAlign
Definition: escher.hxx:69
void WriteBrushAttr(const SvxBrushItem &rBrush, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:1878
SdrLayerID GetInvisibleHellId() const
Definition: wrtw8esh.cxx:2221
static sal_Int32 ToFract16(sal_Int32 nVal, sal_uInt32 nMax)
Definition: wrtw8esh.cxx:2200
OUString BuildFileName(sal_uInt16 &rnLevel, bool &rbRel, const OUString &rUrl)
Definition: wrtw8esh.cxx:143
void WriteGrfBullet(const Graphic &)
Definition: wrtw8esh.cxx:1577
ShapeFlag
OUString GetBasePath()
Definition: wrtw8esh.cxx:125
Style of a layout element.
Definition: frmfmt.hxx:57
EscherExHostAppData aHostData
Definition: escher.hxx:142
virtual void WritePictures() override
Definition: wrtw8esh.cxx:1495
sal_uInt32 mnXRelTo
Definition: escher.hxx:71
void FinishEscher()
Definition: wrtw8esh.cxx:2379
sal_Int32 DrawModelToEmu(sal_Int32 nVal) const
Definition: escher.hxx:108
void WriteData(EscherEx &rEx) const override
Definition: wrtw8esh.cxx:1438
sal_uInt32 GetFlyShapeId(const SwFrameFormat &rFormat, unsigned int nHdFtIndex, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:3014
sal_Int32 WriteFlyFrame(const DrawObj &rObj, sal_uInt32 &rShapeId, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:2784
long BigMulDiv(long nVal, long nMul, long nDiv)
sal_uInt32 mnYAlign
Definition: escher.hxx:70
virtual ~SwEscherEx() override
Definition: wrtw8esh.cxx:2375
WW8Export & rWrt
Definition: escher.hxx:95
static void WriteGrfAttr(const SwNoTextNode &rNd, const SwFrameFormat &rFormat, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:1698
void MakeZOrderArrAndFollowIds(std::vector< DrawObj > &rSrcArr, DrawObjPointerVector &rDstArr)
Definition: wrtw8esh.cxx:2988
virtual void WriteFrameExtraData(const SwFrameFormat &)
Definition: wrtw8esh.cxx:1537
virtual void WritePictures()
Definition: wrtw8esh.cxx:2226
void WriteEmptyFlyFrame(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:1543
virtual ~SwEscherExGlobal() override
Definition: wrtw8esh.cxx:1515
void PreWriteHyperlinkWithinFly(const SwFrameFormat &rFormat, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:286
virtual SvStream * ImplQueryPictureStream() override
Override to create a new memory stream for picture data.
Definition: wrtw8esh.cxx:1519
EscherExHostAppData * StartShape(const css::uno::Reference< css::drawing::XShape > &, const tools::Rectangle *) override
Definition: escher.hxx:171
SwEscherEx(SvStream *pStrm, WW8Export &rWW8Wrt)
Definition: wrtw8esh.cxx:2239
sal_Int32 WriteGrfFlyFrame(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:1624
WinwordAnchoring aWinwordAnchoring
Definition: escher.hxx:143
std::vector< DrawObj * > DrawObjPointerVector
Definition: wrtww8.hxx:365
virtual ~SwBasicEscherEx() override
Definition: wrtw8esh.cxx:1533
void WriteOLEPicture(EscherPropertyContainer &rPropOpt, ShapeFlag nShapeFlags, const Graphic &rGraphic, const SdrObject &rObj, sal_uInt32 nShapeId, const css::awt::Rectangle *pVisArea)
Definition: wrtw8esh.cxx:2936
sal_uInt32 mnYRelTo
Definition: escher.hxx:72
sal_Int32 WriteTextFlyFrame(const DrawObj &rObj, sal_uInt32 nShapeId, sal_uInt32 nTextBox, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:2885