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 #include <svx/svdtrans.hxx>
25 #include "wrtww8.hxx"
26 
27 const sal_uInt32 nInlineHack = 0x00010001;
28 class SwFrameFormat;
29 // #i30669#
30 class SwFormatHoriOrient;
31 class SwFormatVertOrient;
32 
34 {
35 public:
36  void WriteData(EscherEx& rEx) const override;
37  void SetAnchoring(const SwFrameFormat& rFormat);
38 
65  static bool ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
66  SwFormatVertOrient& _iorVertOri,
67  const SwFrameFormat& _rFrameFormat );
68 
69 private:
70  bool mbInline;
71  sal_uInt32 mnXAlign;
72  sal_uInt32 mnYAlign;
73  sal_uInt32 mnXRelTo;
74  sal_uInt32 mnYRelTo;
75 
76 };
77 
79 {
80 public:
81  explicit SwEscherExGlobal();
82  virtual ~SwEscherExGlobal() override;
83 
84 private:
86  virtual SvStream* ImplQueryPictureStream() override;
87 
88 private:
89  std::shared_ptr< SvStream > mxPicStrm;
90 };
91 
92 class SwBasicEscherEx : public EscherEx
93 {
94 private:
95  void Init();
96 protected:
100 
101  virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat& rFormat, MSO_SPT eShapeType,
102  EscherPropertyContainer& rPropOpt);
103  void WriteBrushAttr(const SvxBrushItem &rBrush,
104  EscherPropertyContainer& rPropOpt);
106  ShapeFlag nShapeFlags, const Graphic &rGraphic, const SdrObject &rObj,
107  sal_uInt32 nShapeId, const css::awt::Rectangle* pVisArea );
108  static void WriteGrfAttr(const SwNoTextNode& rNd, const SwFrameFormat& rFormat, EscherPropertyContainer& rPropOpt);
109 
110  sal_Int32 DrawModelToEmu(sal_Int32 nVal) const
111  { return BigMulDiv(nVal, mnEmuMul, mnEmuDiv); }
112 
113  static sal_Int32 ToFract16(sal_Int32 nVal, sal_uInt32 nMax);
114 
115  virtual void SetPicId(const SdrObject &, sal_uInt32, EscherPropertyContainer &);
117 
118 public:
119  SwBasicEscherEx(SvStream* pStrm, WW8Export& rWrt);
120  sal_Int32 WriteGrfFlyFrame(const SwFrameFormat& rFormat, sal_uInt32 nShapeId);
121  //For i120928,to export graphic of bullet
122  void WriteGrfBullet(const Graphic&);
123  sal_Int32 WriteOLEFlyFrame(const SwFrameFormat& rFormat, sal_uInt32 nShapeId);
124  void WriteEmptyFlyFrame(const SwFrameFormat& rFormat, sal_uInt32 nShapeId);
125  virtual void WriteFrameExtraData(const SwFrameFormat&);
126  virtual void WritePictures();
127  virtual ~SwBasicEscherEx() override;
128  //i120927,this function is added to export hyperlink info,such as graphic/frame/OLE
129  bool IsRelUrl() const;
130  OUString GetBasePath() const;
131  OUString BuildFileName(sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl);
132  void WriteHyperlinkWithinFly( SvMemoryStream& rStrm, const SwFormatURL* pINetFormatArg);
134 
135 private:
136  SwBasicEscherEx(const SwBasicEscherEx&) = delete;
137  SwBasicEscherEx& operator=(const SwBasicEscherEx&) = delete;
138 };
139 
141 {
142 private:
143  std::vector<sal_uLong> aFollowShpIds;
147 
148  sal_uInt32 GetFlyShapeId(const SwFrameFormat& rFormat,
149  unsigned int nHdFtIndex, DrawObjPointerVector &rPVec);
150  void MakeZOrderArrAndFollowIds(std::vector<DrawObj>& rSrcArr,
151  DrawObjPointerVector& rDstArr);
152 
153  sal_Int32 WriteFlyFrame(const DrawObj &rObj, sal_uInt32 &rShapeId,
154  DrawObjPointerVector &rPVec);
155  sal_Int32 WriteTextFlyFrame(const DrawObj &rObj, sal_uInt32 nShapeId,
156  sal_uInt32 nTextBox, DrawObjPointerVector &rPVec);
157  void WriteOCXControl(const SwFrameFormat& rFormat,sal_uInt32 nShapeId);
158  virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat& rFormat, MSO_SPT eShapeType,
159  EscherPropertyContainer& rPropOpt) override;
160 
161  virtual sal_uInt32 QueryTextID(
162  const css::uno::Reference< css::drawing::XShape > &, sal_uInt32) override;
163  virtual void SetPicId(const SdrObject &rSdrObj, sal_uInt32 nShapeId,
164  EscherPropertyContainer &rPropOpt) override;
165 public:
166  SwEscherEx( SvStream* pStrm, WW8Export& rWW8Wrt );
167  virtual ~SwEscherEx() override;
168  void FinishEscher();
169  virtual void WritePictures() override;
170 
171  virtual void WriteFrameExtraData(const SwFrameFormat& rFormat) override;
172 
173  EscherExHostAppData* StartShape(const css::uno::Reference< css::drawing::XShape > &, const tools::Rectangle*) override {return &aHostData;}
174 private:
175  SwEscherEx(const SwEscherEx&) = delete;
176  SwEscherEx &operator=(const SwEscherEx&) = delete;
177 };
178 
179 #endif
180 
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvStream * pEscherStrm
Definition: escher.hxx:98
Exporter of the binary Word file formats.
Definition: wrtww8.hxx:987
std::vector< sal_uLong > aFollowShpIds
Definition: escher.hxx:143
WW8_WrPlcTextBoxes * pTextBxs
Definition: escher.hxx:146
std::shared_ptr< SvStream > mxPicStrm
Definition: escher.hxx:89
void WriteOCXControl(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:2923
virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat &rFormat, MSO_SPT eShapeType, EscherPropertyContainer &rPropOpt) override
Definition: wrtw8esh.cxx:2076
sal_Int32 WriteOLEFlyFrame(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:1796
SwBasicEscherEx & operator=(const SwBasicEscherEx &)=delete
void SetAnchoring(const SwFrameFormat &rFormat)
Definition: wrtw8esh.cxx:2600
SwEscherEx & operator=(const SwEscherEx &)=delete
const sal_uInt32 nInlineHack
Definition: escher.hxx:27
virtual void WriteFrameExtraData(const SwFrameFormat &rFormat) override
Definition: wrtw8esh.cxx:2735
virtual void SetPicId(const SdrObject &rSdrObj, sal_uInt32 nShapeId, EscherPropertyContainer &rPropOpt) override
Definition: wrtw8esh.cxx:1787
virtual void SetPicId(const SdrObject &, sal_uInt32, EscherPropertyContainer &)
Definition: wrtw8esh.cxx:1782
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:2404
virtual sal_uInt32 QueryTextID(const css::uno::Reference< css::drawing::XShape > &, sal_uInt32) override
Definition: wrtw8esh.cxx:2998
virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat &rFormat, MSO_SPT eShapeType, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:1896
MSO_SPT
void WriteHyperlinkWithinFly(SvMemoryStream &rStrm, const SwFormatURL *pINetFormatArg)
Definition: wrtw8esh.cxx:179
SwBasicEscherEx(SvStream *pStrm, WW8Export &rWrt)
Definition: wrtw8esh.cxx:1528
sal_uInt32 mnXAlign
Definition: escher.hxx:71
void WriteBrushAttr(const SvxBrushItem &rBrush, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:1855
SdrLayerID GetInvisibleHellId() const
Definition: wrtw8esh.cxx:2184
static sal_Int32 ToFract16(sal_Int32 nVal, sal_uInt32 nMax)
Definition: wrtw8esh.cxx:2163
OUString BuildFileName(sal_uInt16 &rnLevel, bool &rbRel, const OUString &rUrl)
Definition: wrtw8esh.cxx:144
void WriteGrfBullet(const Graphic &)
Definition: wrtw8esh.cxx:1578
OUString GetBasePath() const
Definition: wrtw8esh.cxx:126
ShapeFlag
Style of a layout element.
Definition: frmfmt.hxx:57
EscherExHostAppData aHostData
Definition: escher.hxx:144
virtual void WritePictures() override
Definition: wrtw8esh.cxx:1496
sal_uInt32 mnXRelTo
Definition: escher.hxx:73
bool IsRelUrl() const
Definition: wrtw8esh.cxx:116
void FinishEscher()
Definition: wrtw8esh.cxx:2342
sal_Int32 DrawModelToEmu(sal_Int32 nVal) const
Definition: escher.hxx:110
void WriteData(EscherEx &rEx) const override
Definition: wrtw8esh.cxx:1439
sal_uInt32 GetFlyShapeId(const SwFrameFormat &rFormat, unsigned int nHdFtIndex, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:2980
sal_Int32 WriteFlyFrame(const DrawObj &rObj, sal_uInt32 &rShapeId, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:2747
long BigMulDiv(long nVal, long nMul, long nDiv)
sal_uInt32 mnYAlign
Definition: escher.hxx:72
virtual ~SwEscherEx() override
Definition: wrtw8esh.cxx:2338
WW8Export & rWrt
Definition: escher.hxx:97
static void WriteGrfAttr(const SwNoTextNode &rNd, const SwFrameFormat &rFormat, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:1675
void MakeZOrderArrAndFollowIds(std::vector< DrawObj > &rSrcArr, DrawObjPointerVector &rDstArr)
Definition: wrtw8esh.cxx:2954
virtual void WriteFrameExtraData(const SwFrameFormat &)
Definition: wrtw8esh.cxx:1538
virtual void WritePictures()
Definition: wrtw8esh.cxx:2189
void WriteEmptyFlyFrame(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:1544
virtual ~SwEscherExGlobal() override
Definition: wrtw8esh.cxx:1516
void PreWriteHyperlinkWithinFly(const SwFrameFormat &rFormat, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:287
virtual SvStream * ImplQueryPictureStream() override
Override to create a new memory stream for picture data.
Definition: wrtw8esh.cxx:1520
EscherExHostAppData * StartShape(const css::uno::Reference< css::drawing::XShape > &, const tools::Rectangle *) override
Definition: escher.hxx:173
SwEscherEx(SvStream *pStrm, WW8Export &rWW8Wrt)
Definition: wrtw8esh.cxx:2202
sal_Int32 WriteGrfFlyFrame(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:1615
WinwordAnchoring aWinwordAnchoring
Definition: escher.hxx:145
std::vector< DrawObj * > DrawObjPointerVector
Definition: wrtww8.hxx:364
virtual ~SwBasicEscherEx() override
Definition: wrtw8esh.cxx:1534
void WriteOLEPicture(EscherPropertyContainer &rPropOpt, ShapeFlag nShapeFlags, const Graphic &rGraphic, const SdrObject &rObj, sal_uInt32 nShapeId, const css::awt::Rectangle *pVisArea)
Definition: wrtw8esh.cxx:2902
sal_uInt32 mnYRelTo
Definition: escher.hxx:74
sal_Int32 WriteTextFlyFrame(const DrawObj &rObj, sal_uInt32 nShapeId, sal_uInt32 nTextBox, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:2848