LibreOffice Module sw (master)  1
ww8graf.cxx
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 #include <comphelper/string.hxx>
21 #include <svl/urihelper.hxx>
22 #include <hintids.hxx>
23 #include <osl/endian.h>
24 #include <sal/log.hxx>
25 #include <svx/fmglob.hxx>
26 #include <svx/sdtaitm.hxx>
27 #include <editeng/lrspitem.hxx>
28 #include <editeng/udlnitem.hxx>
29 #include <svx/xlnclit.hxx>
30 #include <svx/xlnwtit.hxx>
31 #include <svx/xlndsit.hxx>
32 #include <svx/xlnstit.hxx>
33 #include <svx/xlnedit.hxx>
34 #include <svx/xlnstwit.hxx>
35 #include <svx/xlnedwit.hxx>
36 #include <svx/xlnstcit.hxx>
37 #include <svx/xlnedcit.hxx>
38 #include <svx/xflclit.hxx>
39 #include <svx/xbtmpit.hxx>
40 #include <svx/svdmodel.hxx>
41 #include <svx/svdocapt.hxx>
42 #include <svx/sxctitm.hxx>
43 #include <svx/sdggaitm.hxx>
44 #include <svx/sdgluitm.hxx>
45 #include <svx/sdgmoitm.hxx>
46 #include <svx/sdmetitm.hxx>
47 #include <svx/sdooitm.hxx>
48 #include <svx/sdshitm.hxx>
49 #include <svx/sdsxyitm.hxx>
50 #include <svx/sdtagitm.hxx>
51 #include <svx/sdtditm.hxx>
52 #include <svx/sdtfsitm.hxx>
53 #include <editeng/editeng.hxx>
54 #include <svx/svdpage.hxx>
55 #include <svx/svdopath.hxx>
56 #include <svx/svdocirc.hxx>
57 #include <editeng/outlobj.hxx>
58 #include <svx/svdogrp.hxx>
59 #include <svx/svdograf.hxx>
60 #include <svx/svdoole2.hxx>
61 #include <editeng/colritem.hxx>
62 #include <editeng/fhgtitem.hxx>
63 #include <editeng/postitem.hxx>
64 #include <editeng/adjustitem.hxx>
65 #include <editeng/wghtitem.hxx>
67 #include <editeng/contouritem.hxx>
68 #include <editeng/shdditem.hxx>
69 #include <editeng/fontitem.hxx>
70 #include <editeng/ulspitem.hxx>
71 #include <svx/svdoattr.hxx>
72 #include <editeng/brushitem.hxx>
73 #include <svx/rectenum.hxx>
74 #include <editeng/opaqitem.hxx>
75 #include <editeng/shaditem.hxx>
76 #include <editeng/boxitem.hxx>
77 #include <editeng/outliner.hxx>
78 #include <editeng/frmdiritem.hxx>
79 #include <svx/xfltrit.hxx>
81 #include <grfatr.hxx>
82 #include <fmtornt.hxx>
83 #include <fmtcntnt.hxx>
84 #include <frmfmt.hxx>
85 #include <fmtanchr.hxx>
86 #include <pam.hxx>
87 #include <doc.hxx>
88 #include <drawdoc.hxx>
90 #include <docary.hxx>
91 #include <ndgrf.hxx>
92 #include <ndtxt.hxx>
93 #include <dcontact.hxx>
94 #include <docsh.hxx>
95 #include <mdiexp.hxx>
96 #include <fmtcnct.hxx>
97 #include "ww8struc.hxx"
98 #include "ww8scan.hxx"
99 #include "ww8par.hxx"
100 #include "ww8par2.hxx"
101 #include "ww8graf.hxx"
102 #include <fmtinfmt.hxx>
103 #include <editeng/eeitem.hxx>
104 #include <editeng/flditem.hxx>
105 #include <fmtfollowtextflow.hxx>
106 #include "writerhelper.hxx"
107 #include "writerwordglue.hxx"
110 #include <editeng/editobj.hxx>
111 #include <math.h>
112 #include <fmturl.hxx>
113 #include <svx/hlnkitem.hxx>
114 #include <svl/whiter.hxx>
115 #include <o3tl/enumrange.hxx>
116 #include <o3tl/safeint.hxx>
117 #include <memory>
119 #include "sprmids.hxx"
120 
121 using ::editeng::SvxBorderLine;
122 using namespace ::com::sun::star;
123 using namespace sw::types;
124 using namespace sw::util;
125 
126 // helper methods
127 static Color WW8TransCol(SVBT32 nWC)
128 {
129 #if 1 // 1 = use predefined color, 0 = ignore
130 
131  // color table to convert RGB values to pre-defined colors
132  // (to make the writer UI show the right color names)
133  // the table is split in base 3, the greys are missing as
134  // they don't fit into that system (4 values: bw, wb, 2 * grey)
135  static const Color eColA[] = { // B G R B G R B G R
136  COL_BLACK, COL_RED, COL_LIGHTRED, // 0 0 0, 0 0 1, 0 0 2
137  COL_GREEN, COL_BROWN, COL_BLACK, // 0 1 0, 0 1 1, 0 1 2
138  COL_LIGHTGREEN, COL_BLACK, COL_YELLOW, // 0 2 0, 0 2 1, 0 2 2
139  COL_BLUE, COL_MAGENTA, COL_BLACK, // 1 0 0, 1 0 1, 1 0 2
140  COL_CYAN, COL_LIGHTGRAY, COL_BLACK, // 1 1 0, 1 1 1, 1 1 2
141  COL_BLACK, COL_BLACK, COL_BLACK, // 1 2 0, 1 2 1, 1 2 2
142  COL_LIGHTBLUE, COL_BLACK, COL_LIGHTMAGENTA, // 2 0 0, 2 0 1, 2 0 2
143  COL_BLACK, COL_BLACK, COL_BLACK, // 2 1 0, 2 1 1, 2 1 2
144  COL_LIGHTCYAN, COL_BLACK, COL_WHITE }; // 2 2 0, 2 2 1, 2 2 2
145 
146  // In nWC[3] is a byte that's not described in the WW documentation.
147  // Its meaning appears to be the following: For 0, it's a normal color
148  // whose RGB values are in nWC[0..2]. If nWC[3] is 0x1, 0x7d or 0x83,
149  // it's a grey value whose black portion is given in 0.5% in nWC[0].
150  // I guess that BIT(0) in nWC[3] is relevant for distinguishing RGB/Grey.
151 
152  if( !( nWC[3] & 0x1 ) && // not special (grey)
153  ( ( nWC[0] == 0 || nWC[0]== 0x80 || nWC[0] == 0xff ) // R
154  && ( nWC[1] == 0 || nWC[1]== 0x80 || nWC[1] == 0xff ) // G
155  && ( nWC[2] == 0 || nWC[2]== 0x80 || nWC[2] == 0xff ) ) ){// B
156  int nIdx = 0; // and now: Idx-calculation in base 3
157  for (int i = 2; i >= 0; i--)
158  {
159  nIdx *= 3;
160  if (nWC[i])
161  nIdx += ((nWC[i] == 0xff) ? 2 : 1);
162  }
163  if (eColA[nIdx] != COL_BLACK)
164  return eColA[nIdx]; // default color
165  }
166 #endif
167 
168  if (nWC[3] & 0x1)
169  {
170  // Special color gray
171  sal_uInt8 u = static_cast<sal_uInt8>( static_cast<sal_uLong>( 200 - nWC[0] ) * 256 / 200 );
172  return Color(u, u, u);
173  }
174 
175  // User-Color
176  return Color(nWC[0], nWC[1], nWC[2]);
177 }
178 
179 void wwFrameNamer::SetUniqueGraphName(SwFrameFormat *pFrameFormat, const OUString &rFixed)
180 {
181  if (mbIsDisabled || rFixed.isEmpty())
182  return;
183 
184  pFrameFormat->SetName(msSeed+OUString::number(++mnImportedGraphicsCount) + ": " + rFixed);
185 }
186 
187 // ReadGrafStart reads object data and if necessary creates an anchor
188 bool SwWW8ImplReader::ReadGrafStart(void* pData, short nDataSiz,
189  WW8_DPHEAD const * pHd, SfxAllItemSet &rSet)
190 {
191  if (SVBT16ToUInt16(pHd->cb) < sizeof(WW8_DPHEAD) + nDataSiz)
192  {
193  OSL_ENSURE( false, "+graphic element: too short?" );
194  m_pStrm->SeekRel(SVBT16ToUInt16(pHd->cb) - sizeof(WW8_DPHEAD));
195  return false;
196  }
197 
198  bool bCouldRead = checkRead(*m_pStrm, pData, nDataSiz);
199  OSL_ENSURE(bCouldRead, "Short Graphic header");
200  if (!bCouldRead)
201  return false;
202 
203  SwFormatAnchor aAnchor( RndStdIds::FLY_AT_CHAR );
204  aAnchor.SetAnchor( m_pPaM->GetPoint() );
205  rSet.Put( aAnchor );
206 
207  m_nDrawXOfs2 = m_nDrawXOfs;
208  m_nDrawYOfs2 = m_nDrawYOfs;
209 
210  return true;
211 }
212 
213 // SetStdAttr() sets standard attributes
214 static void SetStdAttr( SfxItemSet& rSet, WW8_DP_LINETYPE& rL,
215  WW8_DP_SHADOW const & rSh )
216 {
217  if( SVBT16ToUInt16( rL.lnps ) == 5 ){ // invisible
218  rSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
219  }else{ // visible
220  Color aCol( WW8TransCol( rL.lnpc ) ); // line color
221  rSet.Put( XLineColorItem( OUString(), aCol ) );
222  rSet.Put( XLineWidthItem( SVBT16ToUInt16( rL.lnpw ) ) );
223  // line thickness
224  if( SVBT16ToUInt16( rL.lnps ) >= 1
225  && SVBT16ToUInt16(rL.lnps ) <= 4 ){ // line style
226  rSet.Put( XLineStyleItem( drawing::LineStyle_DASH ) );
227  sal_Int16 nLen = SVBT16ToUInt16( rL.lnpw );
228  XDash aD( css::drawing::DashStyle_RECT, 1, 2 * nLen, 1, 5 * nLen, 5 * nLen );
229  switch( SVBT16ToUInt16( rL.lnps ) ){
230  case 1: aD.SetDots( 0 ); // Dash
231  aD.SetDashLen( 6 * nLen );
232  aD.SetDistance( 4 * nLen );
233  break;
234  case 2: aD.SetDashes( 0 ); break; // Dot
235  case 3: break; // Dash Dot
236  case 4: aD.SetDots( 2 ); break; // Dash Dot Dot
237  }
238  rSet.Put( XLineDashItem( OUString(), aD ) );
239  }else{
240  rSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) ); // needed for TextBox
241  }
242  }
243  if( SVBT16ToUInt16( rSh.shdwpi ) ){ // shadow
244  rSet.Put(makeSdrShadowItem(true));
245  rSet.Put( makeSdrShadowXDistItem( SVBT16ToUInt16( rSh.xaOffset ) ) );
246  rSet.Put( makeSdrShadowYDistItem( SVBT16ToUInt16( rSh.yaOffset ) ) );
247  }
248 }
249 
250 // SetFill() sets fill attributes such as fore- and background color and
251 // pattern by reducing to a color
252 // SetFill() doesn't yet set a pattern, because Sdr can't easily do that
253 // and the Sdr hatching (XDash) isn't finished yet.
254 // Instead, a mixed color will be picked that's between the selected ones.
255 static void SetFill( SfxItemSet& rSet, WW8_DP_FILL& rFill )
256 {
257  static const sal_uInt8 nPatA[] =
258  {
259  0, 0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80,
260  90, 50, 50, 50, 50, 50, 50, 33, 33, 33, 33, 33, 33
261  };
262  sal_uInt16 nPat = SVBT16ToUInt16(rFill.flpp);
263 
264  if (nPat == 0) // transparent
265  rSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
266  else
267  {
268  rSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); // necessary for textbox
269  if (nPat <= 1 || (SAL_N_ELEMENTS(nPatA) <= nPat))
270  {
271  // Solid background or unknown
272  rSet.Put(XFillColorItem(OUString(), WW8TransCol(rFill.dlpcBg)));
273  }
274  else
275  { // Brush -> color mix
276  Color aB( WW8TransCol( rFill.dlpcBg ) );
277  Color aF( WW8TransCol( rFill.dlpcFg ) );
278  aB.SetRed( static_cast<sal_uInt8>( ( static_cast<sal_uLong>(aF.GetRed()) * nPatA[nPat]
279  + static_cast<sal_uLong>(aB.GetRed()) * ( 100 - nPatA[nPat] ) ) / 100 ) );
280  aB.SetGreen( static_cast<sal_uInt8>( ( static_cast<sal_uLong>(aF.GetGreen()) * nPatA[nPat]
281  + static_cast<sal_uLong>(aB.GetGreen()) * ( 100 - nPatA[nPat] ) ) / 100 ) );
282  aB.SetBlue( static_cast<sal_uInt8>( ( static_cast<sal_uLong>(aF.GetBlue()) * nPatA[nPat]
283  + static_cast<sal_uLong>(aB.GetBlue()) * ( 100 - nPatA[nPat] ) ) / 100 ) );
284  rSet.Put( XFillColorItem( OUString(), aB ) );
285  }
286  }
287 }
288 
289 static void SetLineEndAttr( SfxItemSet& rSet, WW8_DP_LINEEND const & rLe,
290  WW8_DP_LINETYPE const & rLt )
291 {
292  sal_uInt16 aSB = SVBT16ToUInt16( rLe.aStartBits );
293  if( aSB & 0x3 )
294  {
295  ::basegfx::B2DPolygon aPolygon;
296  aPolygon.append(::basegfx::B2DPoint(0.0, 330.0));
297  aPolygon.append(::basegfx::B2DPoint(100.0, 0.0));
298  aPolygon.append(::basegfx::B2DPoint(200.0, 330.0));
299  aPolygon.setClosed(true);
300  rSet.Put( XLineEndItem( OUString(), ::basegfx::B2DPolyPolygon(aPolygon) ) );
301  sal_uInt16 nSiz = SVBT16ToUInt16( rLt.lnpw )
302  * ( ( aSB >> 2 & 0x3 ) + ( aSB >> 4 & 0x3 ) );
303  if( nSiz < 220 ) nSiz = 220;
304  rSet.Put(XLineEndWidthItem(nSiz));
305  rSet.Put(XLineEndCenterItem(false));
306  }
307 
308  sal_uInt16 aEB = SVBT16ToUInt16( rLe.aEndBits );
309  if( aEB & 0x3 ){
310  ::basegfx::B2DPolygon aPolygon;
311  aPolygon.append(::basegfx::B2DPoint(0.0, 330.0));
312  aPolygon.append(::basegfx::B2DPoint(100.0, 0.0));
313  aPolygon.append(::basegfx::B2DPoint(200.0, 330.0));
314  aPolygon.setClosed(true);
315  rSet.Put( XLineStartItem( OUString(), ::basegfx::B2DPolyPolygon(aPolygon) ) );
316  sal_uInt16 nSiz = SVBT16ToUInt16( rLt.lnpw )
317  * ( ( aEB >> 2 & 0x3 ) + ( aEB >> 4 & 0x3 ) );
318  if( nSiz < 220 ) nSiz = 220;
319  rSet.Put(XLineStartWidthItem(nSiz));
320  rSet.Put(XLineStartCenterItem(false));
321  }
322 }
323 
324 // start of routines for the different objects
326 {
327  WW8_DP_LINE aLine;
328 
329  if( !ReadGrafStart( static_cast<void*>(&aLine), sizeof( aLine ), pHd, rSet ) )
330  return nullptr;
331 
332  Point aP[2];
333  {
334  Point& rP0 = aP[0];
335  Point& rP1 = aP[1];
336 
337  rP0.setX( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2 );
338  rP0.setY( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
339  rP1 = rP0;
340  rP0.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.xaStart )) );
341  rP0.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.yaStart )) );
342  rP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.xaEnd )) );
343  rP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.yaEnd )) );
344  }
345 
346  ::basegfx::B2DPolygon aPolygon;
347  aPolygon.append(::basegfx::B2DPoint(aP[0].X(), aP[0].Y()));
348  aPolygon.append(::basegfx::B2DPoint(aP[1].X(), aP[1].Y()));
349  SdrObject* pObj = new SdrPathObj(
350  *m_pDrawModel,
351  OBJ_LINE,
352  ::basegfx::B2DPolyPolygon(aPolygon));
353 
354  SetStdAttr( rSet, aLine.aLnt, aLine.aShd );
355  SetLineEndAttr( rSet, aLine.aEpp, aLine.aLnt );
356 
357  return pObj;
358 }
359 
361 {
362  WW8_DP_RECT aRect;
363 
364  if( !ReadGrafStart( static_cast<void*>(&aRect), sizeof( aRect ), pHd, rSet ) )
365  return nullptr;
366 
367  Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2,
368  static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
369  Point aP1( aP0 );
370  aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
371  aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
372 
373  SdrObject* pObj = new SdrRectObj(
374  *m_pDrawModel,
375  tools::Rectangle(aP0, aP1));
376 
377  SetStdAttr( rSet, aRect.aLnt, aRect.aShd );
378  SetFill( rSet, aRect.aFill );
379 
380  return pObj;
381 }
382 
384 {
385  WW8_DP_ELIPSE aElipse;
386 
387  if( !ReadGrafStart( static_cast<void*>(&aElipse), sizeof( aElipse ), pHd, rSet ) )
388  return nullptr;
389 
390  Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2,
391  static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
392  Point aP1( aP0 );
393  aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
394  aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
395 
396  SdrObject* pObj = new SdrCircObj(
397  *m_pDrawModel,
398  OBJ_CIRC,
399  tools::Rectangle(aP0, aP1));
400 
401  SetStdAttr( rSet, aElipse.aLnt, aElipse.aShd );
402  SetFill( rSet, aElipse.aFill );
403 
404  return pObj;
405 }
406 
408 {
409  WW8_DP_ARC aArc;
410 
411  if( !ReadGrafStart( static_cast<void*>(&aArc), sizeof( aArc ), pHd, rSet ) )
412  return nullptr;
413 
414  Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2,
415  static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
416  Point aP1( aP0 );
417  aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) * 2 );
418  aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) * 2 );
419 
420  short nA[] = { 2, 3, 1, 0 };
421  short nW = nA[ ( ( aArc.fLeft & 1 ) << 1 ) + ( aArc.fUp & 1 ) ];
422  if( !aArc.fLeft ){
423  aP0.AdjustY( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
424  aP1.AdjustY( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
425  }
426  if( aArc.fUp ){
427  aP0.AdjustX( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
428  aP1.AdjustX( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
429  }
430 
431  SdrObject* pObj = new SdrCircObj(
432  *m_pDrawModel,
433  OBJ_SECT,
434  tools::Rectangle(aP0, aP1),
435  nW * 9000,
436  ( ( nW + 1 ) & 3 ) * 9000);
437 
438  SetStdAttr( rSet, aArc.aLnt, aArc.aShd );
439  SetFill( rSet, aArc.aFill );
440 
441  return pObj;
442 }
443 
445 {
446  WW8_DP_POLYLINE aPoly;
447 
448  if( !ReadGrafStart( static_cast<void*>(&aPoly), sizeof( aPoly ), pHd, rSet ) )
449  return nullptr;
450 
451  sal_uInt16 nCount = SVBT16ToUInt16( aPoly.aBits1 ) >> 1 & 0x7fff;
452  std::unique_ptr<SVBT16[]> xP(new SVBT16[nCount * 2]);
453 
454  bool bCouldRead = checkRead(*m_pStrm, xP.get(), nCount * 4); // read points
455  OSL_ENSURE(bCouldRead, "Short PolyLine header");
456  if (!bCouldRead)
457  return nullptr;
458 
459  tools::Polygon aP( nCount );
460  Point aPt;
461  for (sal_uInt16 i=0; i<nCount; ++i)
462  {
463  aPt.setX( SVBT16ToUInt16( xP[i << 1] ) + m_nDrawXOfs2
464  + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) );
465  aPt.setY( SVBT16ToUInt16( xP[( i << 1 ) + 1] ) + m_nDrawYOfs2
466  + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) );
467  aP[i] = aPt;
468  }
469  xP.reset();
470 
471  SdrObject* pObj = new SdrPathObj(
472  *m_pDrawModel,
473  (SVBT16ToUInt16(aPoly.aBits1) & 0x1) ? OBJ_POLY : OBJ_PLIN,
475 
476  SetStdAttr( rSet, aPoly.aLnt, aPoly.aShd );
477  SetFill( rSet, aPoly.aFill );
478 
479  return pObj;
480 }
481 
482 static ESelection GetESelection(EditEngine const &rDrawEditEngine, long nCpStart, long nCpEnd)
483 {
484  sal_Int32 nPCnt = rDrawEditEngine.GetParagraphCount();
485  sal_Int32 nSP = 0;
486  sal_Int32 nEP = 0;
487  while( (nSP < nPCnt)
488  && (nCpStart >= rDrawEditEngine.GetTextLen( nSP ) + 1) )
489  {
490  nCpStart -= rDrawEditEngine.GetTextLen( nSP ) + 1;
491  nSP++;
492  }
493  // at the end, switch to the new line only 1 character later as
494  // otherwise line attributes reach one line too far
495  while( (nEP < nPCnt)
496  && (nCpEnd > rDrawEditEngine.GetTextLen( nEP ) + 1) )
497  {
498  nCpEnd -= rDrawEditEngine.GetTextLen( nEP ) + 1;
499  nEP++;
500  }
501  return ESelection( nSP, nCpStart, nEP, nCpEnd );
502 }
503 
504 // InsertTxbxStyAttrs() sets style attributes into the passed ItemSet.
505 // SW styles are used since import-WW-styles are already destroyed.
506 // SW styles are examined in depth first search order (with parent styles)
507 // for the attributes given in aSrcTab. They're cloned, and the clones'
508 // Which-IDs are changed according to the aDstTab table so that the
509 // EditEngine will not ignore them.
510 // Both Paragraph and character attributes are stuffed into the ItemSet.
511 void SwWW8ImplReader::InsertTxbxStyAttrs( SfxItemSet& rS, sal_uInt16 nColl )
512 {
513  SwWW8StyInf * pStyInf = GetStyle(nColl);
514  if( pStyInf != nullptr && pStyInf->m_pFormat && pStyInf->m_bColl )
515  {
516  const SfxPoolItem* pItem;
517  for( sal_uInt16 i = POOLATTR_BEGIN; i < POOLATTR_END; i++ )
518  {
519  // If we are set in the source and not set in the destination
520  // then add it in.
521  if ( SfxItemState::SET == pStyInf->m_pFormat->GetItemState(
522  i, true, &pItem ) )
523  {
524  SfxItemPool *pEditPool = rS.GetPool();
525  sal_uInt16 nWhich = i;
526  sal_uInt16 nSlotId = m_rDoc.GetAttrPool().GetSlotId(nWhich);
527  if (
528  nSlotId && nWhich != nSlotId &&
529  0 != (nWhich = pEditPool->GetWhich(nSlotId)) &&
530  nWhich != nSlotId &&
531  ( SfxItemState::SET != rS.GetItemState(nWhich, false) )
532  )
533  {
534  rS.Put( pItem->CloneSetWhich(nWhich) );
535  }
536  }
537  }
538  }
539 
540 }
541 
542 static void lcl_StripFields(OUString &rString, WW8_CP &rNewStartCp)
543 {
544  sal_Int32 nStartPos = 0;
545  for (;;)
546  {
547  nStartPos = rString.indexOf(0x13, nStartPos);
548  if (nStartPos<0)
549  return;
550 
551  const sal_Unicode cStops[] = {0x14, 0x15, 0};
552  const sal_Int32 nStopPos = comphelper::string::indexOfAny(rString, cStops, nStartPos);
553  if (nStopPos<0)
554  {
555  rNewStartCp += rString.getLength()-nStartPos;
556  rString = rString.copy(0, nStartPos);
557  return;
558  }
559 
560  const bool was0x14 = rString[nStopPos]==0x14;
561  rString = rString.replaceAt(nStartPos, nStopPos+1-nStartPos, "");
562  rNewStartCp += nStopPos-nStartPos;
563 
564  if (was0x14)
565  {
566  ++rNewStartCp;
567  nStartPos = rString.indexOf(0x15, nStartPos);
568  if (nStartPos<0)
569  return;
570  rString = rString.replaceAt(nStartPos, 1, "");
571  }
572  }
573 }
574 
575 class Chunk
576 {
577 private:
578  OUString msURL;
579  long mnStartPos; // 0x13
580  long mnEndPos; // 0x15
581 public:
582  explicit Chunk(long nStart, const OUString &rURL)
583  : msURL(rURL), mnStartPos(nStart), mnEndPos(0) {}
584 
585  void SetEndPos(long nEnd) { mnEndPos = nEnd; }
586  long GetStartPos() const {return mnStartPos;}
587  long GetEndPos() const {return mnEndPos;}
588  const OUString &GetURL() const {return msURL;}
589  void Adjust(sal_Int32 nAdjust)
590  {
591  mnStartPos-=nAdjust;
592  mnEndPos-=nAdjust;
593  }
594 };
595 
596 namespace
597 {
598  bool IsValidSel(const EditEngine& rEngine, const ESelection& rSel)
599  {
600  const auto nParaCount = rEngine.GetParagraphCount();
601  if (rSel.nStartPara < nParaCount && rSel.nEndPara < nParaCount)
602  return rSel.nStartPos >= 0 && rSel.nEndPos >= 0;
603  return false;
604  }
605 }
606 
607 // InsertAttrsAsDrawingAttrs() sets attributes between StartCp and EndCp.
608 // Style attributes are set as hard, paragraph and character attributes.
610  ManTypes eType, bool bONLYnPicLocFc)
611 {
612  /*
613  Save and create new plcxman for this drawing object, of the type that
614  will include the para end mark inside a paragraph property range, as
615  drawing boxes have real paragraph marks as part of their text, while
616  normal writer has separate nodes for each paragraph and so has no actual
617  paragraph mark as part of the paragraph text.
618  */
619  WW8ReaderSave aSave(this);
620  m_xPlcxMan.reset(new WW8PLCFMan(m_xSBase.get(), eType, nStartCp, true));
621 
622  WW8_CP nStart = m_xPlcxMan->Where();
623  WW8_CP nNext, nStartReplace=0;
624 
625  bool bDoingSymbol = false;
626  sal_Unicode cReplaceSymbol = m_cSymbol;
627 
628  std::unique_ptr<SfxItemSet> pS(new SfxItemSet(m_pDrawEditEngine->GetEmptyItemSet()));
629  WW8PLCFManResult aRes;
630 
631  std::deque<Chunk> aChunks;
632 
633  // Here store stack location
634  size_t nCurrentCount = m_xCtrlStck->size();
635  while (nStart < nEndCp)
636  {
637  // nStart is the beginning of the attributes for this range, and
638  // may be before the text itself. So watch out for that
639  WW8_CP nTextStart = nStart;
640  if (nTextStart < nStartCp)
641  nTextStart = nStartCp;
642 
643  // get position of next SPRM
644  bool bStartAttr = m_xPlcxMan->Get(&aRes);
645  m_nCurrentColl = m_xPlcxMan->GetColl();
646  if (aRes.nSprmId)
647  {
648  if( bONLYnPicLocFc )
649  {
650  if ( (68 == aRes.nSprmId) || (0x6A03 == aRes.nSprmId) )
651  {
652  Read_PicLoc(aRes.nSprmId, aRes.pMemPos +
653  m_xSprmParser->DistanceToData(aRes.nSprmId), 4);
654  // Ok, that's what we were looking for. Now let's get
655  // out of here!
656  break;
657  }
658  }
659  else if ((eFTN > aRes.nSprmId) || (0x0800 <= aRes.nSprmId))
660  {
661  // Here place them onto our usual stack and we will pop them
662  // off and convert them later
663  if (bStartAttr)
664  {
665  ImportSprm(aRes.pMemPos, aRes.nMemLen, aRes.nSprmId);
666  if (!bDoingSymbol && m_bSymbol)
667  {
668  bDoingSymbol = true;
669  nStartReplace = nTextStart;
670  cReplaceSymbol = m_cSymbol;
671  }
672  }
673  else
674  {
675  EndSprm( aRes.nSprmId );
676  if (!m_bSymbol && bDoingSymbol)
677  {
678  bDoingSymbol = false;
679  OUStringBuffer sTemp;
681  nTextStart - nStartReplace, cReplaceSymbol);
682  m_pDrawEditEngine->QuickInsertText(sTemp.makeStringAndClear(),
683  GetESelection(*m_pDrawEditEngine, nStartReplace - nStartCp,
684  nTextStart - nStartCp ) );
685  }
686  }
687  }
688  else if (aRes.nSprmId == eFLD)
689  {
690  if (bStartAttr)
691  {
692  size_t nCount = m_xCtrlStck->size();
693  if (m_aFieldStack.empty() && Read_Field(&aRes))
694  {
695  OUString sURL;
696  for (size_t nI = m_xCtrlStck->size(); nI > nCount; --nI)
697  {
698  const SfxPoolItem *pItem = ((*m_xCtrlStck)[nI-1]).pAttr.get();
699  sal_uInt16 nWhich = pItem->Which();
700  if (nWhich == RES_TXTATR_INETFMT)
701  {
702  const SwFormatINetFormat *pURL =
703  static_cast<const SwFormatINetFormat *>(pItem);
704  sURL = pURL->GetValue();
705  }
706  m_xCtrlStck->DeleteAndDestroy(nI-1);
707  }
708  aChunks.emplace_back(nStart, sURL);
709  }
710  }
711  else
712  {
713  if (!m_aFieldStack.empty() && End_Field() && !aChunks.empty())
714  aChunks.back().SetEndPos(nStart+1);
715  }
716  }
717  }
718 
719  m_xPlcxMan->advance();
720  nNext = m_xPlcxMan->Where();
721 
722  const WW8_CP nEnd = ( nNext < nEndCp ) ? nNext : nEndCp;
723  if (!bONLYnPicLocFc && nNext != nStart && nEnd >= nStartCp)
724  {
725  SfxItemPool *pEditPool = pS->GetPool();
726 
727  // Here read current properties and convert them into pS
728  // and put those attrs into the draw box if they can be converted
729  // to draw attributes
730  if (m_xCtrlStck->size() - nCurrentCount)
731  {
732  for (size_t i = nCurrentCount; i < m_xCtrlStck->size(); ++i)
733  {
734  const SfxPoolItem *pItem = ((*m_xCtrlStck)[i]).pAttr.get();
735  sal_uInt16 nWhich = pItem->Which();
736  if( nWhich < RES_FLTRATTR_BEGIN ||
737  nWhich >= RES_FLTRATTR_END )
738  {
739  sal_uInt16 nSlotId = m_rDoc.GetAttrPool().GetSlotId(nWhich);
740  if (
741  nSlotId && nWhich != nSlotId &&
742  0 != (nWhich = pEditPool->GetWhich(nSlotId)) &&
743  nWhich != nSlotId
744  )
745  {
746  pS->Put( pItem->CloneSetWhich(nWhich) );
747  }
748  }
749  }
750  }
751  // Fill in the remainder from the style
752  InsertTxbxStyAttrs(*pS, m_nCurrentColl);
753 
754  if( pS->Count() )
755  {
756  m_pDrawEditEngine->QuickSetAttribs( *pS,
757  GetESelection(*m_pDrawEditEngine, nTextStart - nStartCp, nEnd - nStartCp ) );
758  pS.reset( new SfxItemSet(m_pDrawEditEngine->GetEmptyItemSet()) );
759  }
760  }
761  nStart = nNext;
762  }
763  pS.reset();
764 
765  // pop off as far as recorded location just in case there were some left
766  // unclosed
767  for (size_t nI = m_xCtrlStck->size(); nI > nCurrentCount; --nI)
768  m_xCtrlStck->DeleteAndDestroy(nI-1);
769 
770  auto aEnd = aChunks.end();
771  for (auto aIter = aChunks.begin(); aIter != aEnd; ++aIter)
772  {
773  ESelection aSel(GetESelection(*m_pDrawEditEngine, aIter->GetStartPos()-nStartCp,
774  aIter->GetEndPos()-nStartCp));
775  if (!IsValidSel(*m_pDrawEditEngine, aSel))
776  continue;
777  OUString aString(m_pDrawEditEngine->GetText(aSel));
778  const sal_Int32 nOrigLen = aString.getLength();
779  WW8_CP nDummy(0);
780  lcl_StripFields(aString, nDummy);
781 
782  sal_Int32 nChanged;
783  if (!aIter->GetURL().isEmpty())
784  {
785  SvxURLField aURL(aIter->GetURL(), aString, SvxURLFormat::AppDefault);
786  m_pDrawEditEngine->QuickInsertField(SvxFieldItem(aURL, EE_FEATURE_FIELD), aSel);
787  nChanged = nOrigLen - 1;
788  }
789  else
790  {
791  m_pDrawEditEngine->QuickInsertText(aString, aSel);
792  nChanged = nOrigLen - aString.getLength();
793  }
794  for (auto aIter2 = aIter+1; aIter2 != aEnd; ++aIter2)
795  aIter2->Adjust(nChanged);
796  }
797 
798  /*
799  Don't worry about the new pPlcxMan, the restorer removes it when
800  replacing the current one with the old one.
801  */
802  aSave.Restore(this);
803 }
804 
806  sal_uInt16 nTxBxS, sal_uInt16 nSequence)
807 {
808  // grab the TextBox-PLCF quickly
809  WW8PLCFspecial* pT = m_xPlcxMan ? m_xPlcxMan->GetTxbx() : nullptr;
810  if( !pT )
811  {
812  OSL_ENSURE( false, "+where's the text graphic (1)?" );
813  return false;
814  }
815 
816  // if applicable first find the right TextBox-Story
817  bool bCheckTextBoxStory = ( nTxBxS && pT->GetIMax() >= nTxBxS );
818  if( bCheckTextBoxStory )
819  pT->SetIdx( nTxBxS-1 );
820 
821  // then determine start and end
822  void* pT0;
823  if (!pT->Get(rStartCp, pT0) || rStartCp < 0)
824  {
825  OSL_ENSURE( false, "+where's the text graphic (2)?" );
826  return false;
827  }
828 
829  if( bCheckTextBoxStory )
830  {
831  bool bReusable = (0 != SVBT16ToUInt16( static_cast<WW8_TXBXS*>(pT0)->fReusable ));
832  while( bReusable )
833  {
834  pT->advance();
835  if( !pT->Get( rStartCp, pT0 ) )
836  {
837  OSL_ENSURE( false, "+where's the text graphic (2a)?" );
838  return false;
839  }
840  bReusable = (0 != SVBT16ToUInt16( static_cast<WW8_TXBXS*>(pT0)->fReusable ));
841  }
842  }
843  pT->advance();
844  if (!pT->Get(rEndCp, pT0) || rEndCp < 0)
845  {
846  OSL_ENSURE( false, "+where's the text graphic (3)?" );
847  return false;
848  }
849 
850  // find the right page in the break table (if necessary)
851  if( bCheckTextBoxStory )
852  {
853  // special case: entire chain should be determined - done!
854  if( USHRT_MAX > nSequence )
855  {
856  long nMinStartCp = rStartCp;
857  long nMaxEndCp = rEndCp;
858  // quickly grab the TextBox-Break-Deskriptor-PLCF
859  pT = m_xPlcxMan->GetTxbxBkd();
860  if (!pT) // It can occur on occasion, Caolan
861  return false;
862 
863  // find first entry for this TextBox story
864  if( !pT->SeekPos( rStartCp ) )
865  {
866  OSL_ENSURE( false, "+where's the text graphic (4)" );
867  return false;
868  }
869  // if needed skip the appropriate number of entries
870  for (sal_uInt16 iSequence = 0; iSequence < nSequence; ++iSequence)
871  pT->advance();
872  // and determine actual start and end
873  if( (!pT->Get( rStartCp, pT0 ))
874  || ( nMinStartCp > rStartCp ) )
875  {
876  OSL_ENSURE( false, "+where's the text graphic (5)?" );
877  return false;
878  }
879  if( rStartCp >= nMaxEndCp )
880  rEndCp = rStartCp; // not an error: empty string
881  else
882  {
883  pT->advance();
884  if ( (!pT->Get(rEndCp, pT0)) || (nMaxEndCp < rEndCp-1) )
885  {
886  OSL_ENSURE( false, "+where's the text graphic (6)?" );
887  return false;
888  }
889  rEndCp -= 1;
890  }
891  }
892  else
893  rEndCp -= 1;
894  }
895  else
896  rEndCp -= 1;
897  return true;
898 }
899 
900 // TxbxText() grabs the text from the WW file and returns that along with
901 // the StartCp and the corrected (by -2, or -1 for version 8) EndCp.
902 sal_Int32 SwWW8ImplReader::GetRangeAsDrawingString(OUString& rString, long nStartCp, long nEndCp, ManTypes eType)
903 {
904  WW8_CP nOffset = 0;
905  m_xWwFib->GetBaseCp(eType, &nOffset); //TODO: check return value
906 
907  OSL_ENSURE(nStartCp <= nEndCp, "+where's the graphic text (7)?");
908  if (nStartCp == nEndCp)
909  rString.clear(); // empty string: entirely possible
910  else if (nStartCp < nEndCp)
911  {
912  // read the text: can be split into multiple pieces
913  const sal_Int32 nLen = m_xSBase->WW8ReadString(*m_pStrm, rString,
914  nStartCp + nOffset, nEndCp - nStartCp, GetCurrentCharSet());
915  OSL_ENSURE(nLen, "+where's the text graphic (8)?");
916  if (nLen>0)
917  {
918  if( rString[nLen-1]==0x0d )
919  rString = rString.copy(0, nLen-1);
920 
921  rString = rString.replace( 0xb, 0xa );
922  return nLen;
923  }
924  }
925  return 0;
926 }
927 
928 //EditEngine::InsertText will replace dos lines resulting in a shorter
929 //string than is passed in, so inserting attributes based on the original
930 //string len can fail. So here replace the dos line ends similar to
931 //how EditEngine does it, but preserve the length and replace the extra
932 //chars with placeholders, record the position of the placeholders and
933 //remove those extra chars after attributes have been inserted
934 static std::vector<sal_Int32> replaceDosLineEndsButPreserveLength(OUString &rIn)
935 {
936  OUStringBuffer aNewData(rIn);
937  std::vector<sal_Int32> aDosLineEndDummies;
938  sal_Int32 i = 0;
939  sal_Int32 nStrLen = rIn.getLength();
940  while (i < nStrLen)
941  {
942  // \r or \n causes linebreak
943  if (rIn[i] == '\r' || rIn[i] == '\n')
944  {
945  // skip char if \r\n or \n\r
946  if ( (i+1) < nStrLen && ((rIn[i+1] == '\r') || (rIn[i+1] == '\n')) &&
947  (rIn[i] != rIn[i+1]) )
948  {
949  ++i;
950  aDosLineEndDummies.push_back(i);
951  aNewData[i] = 0;
952  }
953  }
954  ++i;
955  }
956  rIn = aNewData.makeStringAndClear();
957  return aDosLineEndDummies;
958 }
959 
960 static void removePositions(EditEngine &rDrawEditEngine, const std::vector<sal_Int32>& rDosLineEndDummies)
961 {
962  for (auto aIter = rDosLineEndDummies.rbegin(); aIter != rDosLineEndDummies.rend(); ++aIter)
963  {
964  sal_Int32 nCharPos(*aIter);
965  rDrawEditEngine.QuickDelete(GetESelection(rDrawEditEngine, nCharPos, nCharPos+1));
966  }
967 }
968 
969 std::unique_ptr<OutlinerParaObject> SwWW8ImplReader::ImportAsOutliner(OUString &rString, WW8_CP nStartCp, WW8_CP nEndCp, ManTypes eType)
970 {
971  std::unique_ptr<OutlinerParaObject> pRet;
972 
973  sal_Int32 nLen = GetRangeAsDrawingString(rString, nStartCp, nEndCp, eType);
974  if (nLen > 0)
975  {
976  if (!m_pDrawEditEngine)
977  {
978  m_pDrawEditEngine.reset(new EditEngine(nullptr));
979  }
980 
981  //replace dos line endings with editeng ones, replace any extra chars with
982  //placeholders to keep the inserted string len in sync with the attribute cps
983  //and record in aDosLineEnds the superfluous positions
984  OUString sEEString(rString);
985  std::vector<sal_Int32> aDosLineEnds(replaceDosLineEndsButPreserveLength(sEEString));
986  m_pDrawEditEngine->SetText(sEEString);
987  InsertAttrsAsDrawingAttrs(nStartCp, nStartCp+nLen, eType);
988  //remove any superfluous placeholders of replaceDosLineEndsButPreserveLength
989  //after attributes have been inserted
990  removePositions(*m_pDrawEditEngine, aDosLineEnds);
991 
992  // Annotations typically begin with a (useless) 0x5
993  if ((eType == MAN_AND) && m_pDrawEditEngine->GetTextLen())
994  {
995  ESelection aFirstChar(0, 0, 0, 1);
996  if (m_pDrawEditEngine->GetText( aFirstChar ) == "\x05")
997  m_pDrawEditEngine->QuickDelete(aFirstChar);
998  }
999 
1000  std::unique_ptr<EditTextObject> pTemporaryText = m_pDrawEditEngine->CreateTextObject();
1001  pRet.reset( new OutlinerParaObject( std::move(pTemporaryText) ) );
1002  pRet->SetOutlinerMode( OutlinerMode::TextObject );
1003 
1004  m_pDrawEditEngine->SetText( OUString() );
1005  m_pDrawEditEngine->SetParaAttribs(0, m_pDrawEditEngine->GetEmptyItemSet());
1006 
1007  // Strip out fields, leaving the result
1008  WW8_CP nDummy(0);
1009  lcl_StripFields(rString, nDummy);
1010  // Strip out word's special characters for the simple string
1011  rString = rString.replaceAll("\x01", "");
1012  rString = rString.replaceAll("\x05", "");
1013  rString = rString.replaceAll("\x08", "");
1014  rString = rString.replaceAll("\007\007", "\007\012");
1015  rString = rString.replace(0x7, ' ');
1016  }
1017 
1018  return pRet;
1019 }
1020 
1021 // InsertTxbxText() adds the Text and the Attributes for TextBoxes and CaptionBoxes
1023  Size const * pObjSiz, sal_uInt16 nTxBxS, sal_uInt16 nSequence, long nPosCp,
1024  SwFrameFormat const * pOldFlyFormat, bool bMakeSdrGrafObj, bool& rbEraseTextObj,
1025  bool* pbTestTxbxContainsText, long* pnStartCp, long* pnEndCp,
1026  bool* pbContainsGraphics, SvxMSDffImportRec const * pRecord)
1027 {
1028  SwFrameFormat* pFlyFormat = nullptr;
1029  sal_uLong nOld = m_pStrm->Tell();
1030 
1031  ManTypes eType = m_xPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX;
1032 
1033  rbEraseTextObj = false;
1034 
1035  OUString aString;
1036  WW8_CP nStartCp, nEndCp;
1037  bool bContainsGraphics = false;
1038  bool bTextWasRead = GetTxbxTextSttEndCp(nStartCp, nEndCp, nTxBxS, nSequence) &&
1039  GetRangeAsDrawingString(aString, nStartCp, nEndCp, eType) > 0;
1040 
1041  if (!m_pDrawEditEngine)
1042  {
1043  m_pDrawEditEngine.reset(new EditEngine(nullptr));
1044  }
1045  if( pObjSiz )
1046  m_pDrawEditEngine->SetPaperSize( *pObjSiz );
1047 
1048  const OUString aOrigString(aString);
1049  if( bTextWasRead )
1050  {
1051  WW8_CP nNewStartCp = nStartCp;
1052  lcl_StripFields(aString, nNewStartCp);
1053 
1054  if (aString.getLength()!=1)
1055  {
1056  bContainsGraphics = aString.indexOf(0x1)<0 || aString.indexOf(0x8)<0;
1057  }
1058  else // May be a single graphic or object
1059  {
1060  bool bDone = true;
1061  switch( aString[0] )
1062  {
1063  case 0x1:
1064  if (!pbTestTxbxContainsText)
1065  {
1066  WW8ReaderSave aSave(this, nNewStartCp -1);
1067  bool bOldEmbeddObj = m_bEmbeddObj;
1068  // bEmbeddObj Ordinarily would have been set by field
1069  // parse, but this is impossible here so...
1070  m_bEmbeddObj = true;
1071 
1072  // 1st look for OLE- or Graph-Indicator Sprms
1073  WW8PLCFx_Cp_FKP* pChp = m_xPlcxMan->GetChpPLCF();
1074  WW8PLCFxDesc aDesc;
1075  pChp->GetSprms( &aDesc );
1076  WW8SprmIter aSprmIter(aDesc.pMemPos, aDesc.nSprmsLen, *m_xSprmParser);
1077 
1078  for( int nLoop = 0; nLoop < 2; ++nLoop )
1079  {
1080  while (aSprmIter.GetSprms())
1081  {
1082  const sal_uInt8 *const pParams(aSprmIter.GetCurrentParams());
1083  if (nullptr == pParams)
1084  break;
1085  sal_uInt16 nCurrentId = aSprmIter.GetCurrentId();
1086  switch( nCurrentId )
1087  {
1088  case 75:
1089  case 118:
1090  case 0x080A:
1091  case 0x0856:
1092  Read_Obj(nCurrentId, pParams, 1);
1093  break;
1094  case 68: // Read_Pic()
1095  case 0x6A03:
1097  Read_PicLoc(nCurrentId, pParams, 1);
1098  break;
1099  }
1100  aSprmIter.advance();
1101  }
1102 
1103  if( !nLoop )
1104  {
1105  pChp->GetPCDSprms( aDesc );
1106  aSprmIter.SetSprms( aDesc.pMemPos,
1107  aDesc.nSprmsLen );
1108  }
1109  }
1110  aSave.Restore(this);
1111  m_bEmbeddObj=bOldEmbeddObj;
1112 
1113  // then import either an OLE of a Graphic
1114  if( m_bObj )
1115  {
1116  if( bMakeSdrGrafObj && pTextObj &&
1117  pTextObj->getParentSdrObjectFromSdrObject() )
1118  {
1119  // use SdrOleObj/SdrGrafObj instead of
1120  // SdrTextObj in this Group
1121 
1122  Graphic aGraph;
1123  SdrObject* pNew = ImportOleBase(aGraph);
1124 
1125  if( !pNew )
1126  {
1127  pNew = new SdrGrafObj(*m_pDrawModel);
1128  static_cast<SdrGrafObj*>(pNew)->SetGraphic(aGraph);
1129  }
1130 
1131  GrafikCtor();
1132 
1133  pNew->SetLogicRect( pTextObj->GetCurrentBoundRect() );
1134  pNew->SetLayer( pTextObj->GetLayer() );
1135 
1137  ReplaceObject(pNew, pTextObj->GetOrdNum());
1138  }
1139  else
1140  pFlyFormat = ImportOle();
1141  m_bObj = false;
1142  }
1143  else
1144  {
1145  InsertAttrsAsDrawingAttrs(nNewStartCp, nNewStartCp+1,
1146  eType, true);
1147  pFlyFormat = ImportGraf(bMakeSdrGrafObj ? pTextObj : nullptr,
1148  pOldFlyFormat);
1149  }
1150  }
1151  break;
1152  case 0x8:
1153  if ( (!pbTestTxbxContainsText) && (!m_bObj) )
1154  pFlyFormat = Read_GrafLayer( nPosCp );
1155  break;
1156  default:
1157  bDone = false;
1158  break;
1159  }
1160 
1161  if( bDone )
1162  {
1163  if( pFlyFormat && pRecord )
1164  {
1165  SfxItemSet aFlySet( m_rDoc.GetAttrPool(),
1167 
1168  tools::Rectangle aInnerDist( pRecord->nDxTextLeft,
1169  pRecord->nDyTextTop,
1170  pRecord->nDxTextRight,
1171  pRecord->nDyTextBottom );
1172  MatchSdrItemsIntoFlySet( pTextObj,
1173  aFlySet,
1174  pRecord->eLineStyle,
1175  pRecord->eLineDashing,
1176  pRecord->eShapeType,
1177  aInnerDist );
1178 
1179  pFlyFormat->SetFormatAttr( aFlySet );
1180 
1181  MapWrapIntoFlyFormat(pRecord, pFlyFormat);
1182  }
1183  aString.clear();
1184  rbEraseTextObj = (nullptr != pFlyFormat);
1185  }
1186  }
1187  }
1188 
1189  if( pnStartCp )
1190  *pnStartCp = nStartCp;
1191  if( pnEndCp )
1192  *pnEndCp = nEndCp;
1193 
1194  if( pbTestTxbxContainsText )
1195  *pbTestTxbxContainsText = bTextWasRead && ! rbEraseTextObj;
1196  else if( !rbEraseTextObj )
1197  {
1198  if( bTextWasRead )
1199  {
1200  m_pDrawEditEngine->SetText(aOrigString);
1201  InsertAttrsAsDrawingAttrs(nStartCp, nEndCp, eType);
1202  }
1203 
1204  bool bVertical = pTextObj->IsVerticalWriting();
1205  std::unique_ptr<EditTextObject> pTemporaryText = m_pDrawEditEngine->CreateTextObject();
1206  std::unique_ptr<OutlinerParaObject> pOp( new OutlinerParaObject(*pTemporaryText) );
1207  pOp->SetOutlinerMode( OutlinerMode::TextObject );
1208  pOp->SetVertical( bVertical );
1209  pTemporaryText.reset();
1210  pTextObj->NbcSetOutlinerParaObject( std::move(pOp) );
1211  pTextObj->SetVerticalWriting(bVertical);
1212 
1213  // For the next TextBox also remove the old paragraph attributes
1214  // and styles, otherwise the next box will start with the wrong
1215  // attributes.
1216  // Course of action: delete text = reduce to one paragraph
1217  // and on this one delete the paragraph attributes
1218  // and styles
1219  m_pDrawEditEngine->SetText( OUString() );
1220  m_pDrawEditEngine->SetParaAttribs(0, m_pDrawEditEngine->GetEmptyItemSet());
1221  }
1222 
1223  m_pStrm->Seek( nOld );
1224  if (pbContainsGraphics)
1225  *pbContainsGraphics = bContainsGraphics;
1226 }
1227 
1228 bool SwWW8ImplReader::TxbxChainContainsRealText(sal_uInt16 nTxBxS, long& rStartCp,
1229  long& rEndCp)
1230 {
1231  bool bErase, bContainsText;
1232  InsertTxbxText( nullptr,nullptr,nTxBxS,USHRT_MAX,0,nullptr,false, bErase, &bContainsText,
1233  &rStartCp, &rEndCp );
1234  return bContainsText;
1235 }
1236 
1237 // TextBoxes only for Ver67 !!
1239 {
1240  bool bDummy;
1241  WW8_DP_TXTBOX aTextB;
1242 
1243  if( !ReadGrafStart( static_cast<void*>(&aTextB), sizeof( aTextB ), pHd, rSet ) )
1244  return nullptr;
1245 
1246  Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2,
1247  static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
1248  Point aP1( aP0 );
1249  aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
1250  aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
1251 
1252  SdrRectObj* pObj = new SdrRectObj(
1253  *m_pDrawModel,
1254  OBJ_TEXT,
1255  tools::Rectangle(aP0, aP1));
1256 
1257  pObj->NbcSetSnapRect(tools::Rectangle(aP0, aP1));
1258  Size aSize( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) ,
1259  static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
1260 
1261  long nStartCpFly,nEndCpFly;
1262  bool bContainsGraphics;
1263  InsertTxbxText(pObj, &aSize, 0, 0, 0, nullptr, false,
1264  bDummy,nullptr,&nStartCpFly,&nEndCpFly,&bContainsGraphics);
1265 
1266  SetStdAttr( rSet, aTextB.aLnt, aTextB.aShd );
1267  SetFill( rSet, aTextB.aFill );
1268 
1269  rSet.Put( SdrTextFitToSizeTypeItem( drawing::TextFitToSizeType_NONE ) );
1270  rSet.Put( makeSdrTextAutoGrowWidthItem(false));
1271  rSet.Put( makeSdrTextAutoGrowHeightItem(false));
1276 
1277  return pObj;
1278 }
1279 
1281 {
1282  static const SdrCaptionType aCaptA[] = { SdrCaptionType::Type1, SdrCaptionType::Type2,
1283  SdrCaptionType::Type3, SdrCaptionType::Type4 };
1284 
1285  WW8_DP_CALLOUT_TXTBOX aCallB;
1286 
1287  if( !ReadGrafStart( static_cast<void*>(&aCallB), sizeof( aCallB ), pHd, rSet ) )
1288  return nullptr;
1289 
1290  sal_uInt16 nCount = SVBT16ToUInt16( aCallB.dpPolyLine.aBits1 ) >> 1 & 0x7fff;
1291  if (nCount < 1)
1292  {
1293  SAL_WARN("sw.ww8", "Short CaptionBox header");
1294  return nullptr;
1295  }
1296 
1297  std::unique_ptr<SVBT16[]> xP(new SVBT16[nCount * 2]);
1298 
1299  bool bCouldRead = checkRead(*m_pStrm, xP.get(), nCount * 4); // read points
1300  if (!bCouldRead)
1301  {
1302  SAL_WARN("sw.ww8", "Short CaptionBox header");
1303  return nullptr;
1304  }
1305 
1306  sal_uInt8 nTyp = static_cast<sal_uInt8>(nCount) - 1;
1307  if( nTyp == 1 && SVBT16ToUInt16( xP[0] ) == SVBT16ToUInt16( xP[2] ) )
1308  nTyp = 0;
1309 
1310  Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) +
1311  static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.xa )) + m_nDrawXOfs2,
1312  static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya ))
1313  + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.ya )) + m_nDrawYOfs2 );
1314  Point aP1( aP0 );
1315  aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dxa )) );
1316  aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dya )) );
1317  Point aP2( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa ))
1318  + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadPolyLine.xa ))
1319  + m_nDrawXOfs2 + static_cast<sal_Int16>(SVBT16ToUInt16( xP[0] )),
1320  static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya ))
1321  + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadPolyLine.ya ))
1322  + m_nDrawYOfs2 + static_cast<sal_Int16>(SVBT16ToUInt16( xP[1] )) );
1323  xP.reset();
1324 
1325  SdrCaptionObj* pObj = new SdrCaptionObj(
1326  *m_pDrawModel,
1327  tools::Rectangle(aP0, aP1),
1328  aP2);
1329 
1330  pObj->NbcSetSnapRect(tools::Rectangle(aP0, aP1));
1331  Size aSize( static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dxa )),
1332  static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dya )) );
1333  bool bEraseThisObject;
1334 
1335  InsertTxbxText(pObj, &aSize, 0, 0, 0, nullptr, false, bEraseThisObject );
1336 
1337  if( SVBT16ToUInt16( aCallB.dptxbx.aLnt.lnps ) != 5 ) // Is border visible ?
1338  SetStdAttr( rSet, aCallB.dptxbx.aLnt, aCallB.dptxbx.aShd );
1339  else // no -> take lines
1340  SetStdAttr( rSet, aCallB.dpPolyLine.aLnt, aCallB.dptxbx.aShd );
1341  SetFill( rSet, aCallB.dptxbx.aFill );
1342  rSet.Put(SdrCaptionTypeItem(aCaptA[nTyp % SAL_N_ELEMENTS(aCaptA)]));
1343 
1344  return pObj;
1345 }
1346 
1348 {
1349  sal_Int16 nGrouped;
1350 
1351  if( !ReadGrafStart( static_cast<void*>(&nGrouped), sizeof( nGrouped ), pHd, rSet ) )
1352  return nullptr;
1353 
1354 #ifdef OSL_BIGENDIAN
1355  nGrouped = (sal_Int16)OSL_SWAPWORD( nGrouped );
1356 #endif
1357 
1358  m_nDrawXOfs = m_nDrawXOfs + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa ));
1359  m_nDrawYOfs = m_nDrawYOfs + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya ));
1360 
1361  SdrObject* pObj = new SdrObjGroup(*m_pDrawModel);
1362 
1363  short nLeft = static_cast<sal_Int16>(SVBT16ToUInt16( pHd->cb )) - sizeof( WW8_DPHEAD );
1364  for (int i = 0; i < nGrouped && nLeft >= static_cast<short>(sizeof(WW8_DPHEAD)); ++i)
1365  {
1366  SfxAllItemSet aSet(m_pDrawModel->GetItemPool());
1367  if (SdrObject *pObject = ReadGrafPrimitive(nLeft, aSet))
1368  {
1369  // first add and then set ItemSet
1370  SdrObjList *pSubGroup = pObj->GetSubList();
1371  OSL_ENSURE(pSubGroup, "Why no sublist available?");
1372  if (pSubGroup)
1373  pSubGroup->InsertObject(pObject, 0);
1374  pObject->SetMergedItemSetAndBroadcast(aSet);
1375  }
1376  }
1377 
1378  m_nDrawXOfs = m_nDrawXOfs - static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa ));
1379  m_nDrawYOfs = m_nDrawYOfs - static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya ));
1380 
1381  return pObj;
1382 }
1383 
1385 {
1386  // This whole archaic word 6 graphic import can probably be refactored
1387  // into an object hierarchy with a little effort.
1388  SdrObject *pRet=nullptr;
1389  WW8_DPHEAD aHd; // Read Draw-Primitive-Header
1390  bool bCouldRead = checkRead(*m_pStrm, &aHd, sizeof(WW8_DPHEAD)) &&
1391  SVBT16ToUInt16(aHd.cb) >= sizeof(WW8_DPHEAD);
1392  OSL_ENSURE(bCouldRead, "Graphic Primitive header short read" );
1393  if (!bCouldRead)
1394  {
1395  rLeft=0;
1396  return pRet;
1397  }
1398 
1399  if( rLeft >= SVBT16ToUInt16(aHd.cb) ) // precautions
1400  {
1401  rSet.Put(SwFormatSurround(css::text::WrapTextMode_THROUGH));
1402  switch (SVBT16ToUInt16(aHd.dpk) & 0xff )
1403  {
1404  case 0:
1405  pRet = ReadGroup(&aHd, rSet);
1406  break;
1407  case 1:
1408  pRet = ReadLine(&aHd, rSet);
1409  break;
1410  case 2:
1411  pRet = ReadTextBox(&aHd, rSet);
1412  break;
1413  case 3:
1414  pRet = ReadRect(&aHd, rSet);
1415  break;
1416  case 4:
1417  pRet = ReadElipse(&aHd, rSet);
1418  break;
1419  case 5:
1420  pRet = ReadArc(&aHd, rSet);
1421  break;
1422  case 6:
1423  pRet = ReadPolyLine(&aHd, rSet);
1424  break;
1425  case 7:
1426  pRet = ReadCaptionBox(&aHd, rSet);
1427  break;
1428  default: // unknown
1429  m_pStrm->SeekRel(SVBT16ToUInt16(aHd.cb) - sizeof(WW8_DPHEAD));
1430  break;
1431  }
1432  }
1433  else
1434  {
1435  OSL_ENSURE( false, "+Grafik-Overlap" );
1436  }
1437  rLeft = rLeft - SVBT16ToUInt16( aHd.cb );
1438  return pRet;
1439 }
1440 
1441 void SwWW8ImplReader::ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp )
1442 {
1443  pPF->SeekPos( nGrafAnchorCp );
1444  WW8_FC nStartFc;
1445  void* pF0;
1446  if( !pPF->Get( nStartFc, pF0 ) )
1447  {
1448  OSL_ENSURE( false, "+Where is the graphic (2) ?" );
1449  return;
1450  }
1451  WW8_FDOA* pF = static_cast<WW8_FDOA*>(pF0);
1452  if( !SVBT32ToUInt32( pF->fc ) )
1453  {
1454  OSL_ENSURE( false, "+Where is the graphic (3) ?" );
1455  return;
1456  }
1457 
1458  bool bCouldSeek = checkSeek(*m_pStrm, SVBT32ToUInt32(pF->fc));
1459  OSL_ENSURE(bCouldSeek, "Invalid graphic offset");
1460  if (!bCouldSeek)
1461  return;
1462 
1463  // read Draw-Header
1464  WW8_DO aDo;
1465  bool bCouldRead = checkRead(*m_pStrm, &aDo, sizeof(WW8_DO));
1466  OSL_ENSURE(bCouldRead, "Short graphic header");
1467  if (!bCouldRead)
1468  return;
1469 
1470  short nLeft = SVBT16ToUInt16( aDo.cb ) - sizeof( WW8_DO );
1471  while (nLeft > static_cast<short>(sizeof(WW8_DPHEAD)))
1472  {
1473  SfxAllItemSet aSet( m_pDrawModel->GetItemPool() );
1474  if (SdrObject *pObject = ReadGrafPrimitive(nLeft, aSet))
1475  {
1476  m_xWWZOrder->InsertDrawingObject(pObject, SVBT16ToUInt16(aDo.dhgt));
1477 
1478  tools::Rectangle aRect(pObject->GetSnapRect());
1479 
1480  const sal_uInt32 nCntRelTo = 3;
1481 
1482  // Adjustment is horizontally relative to...
1483  static const sal_Int16 aHoriRelOriTab[nCntRelTo] =
1484  {
1485  text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
1486  text::RelOrientation::PAGE_FRAME, // 1 is page margin
1487  text::RelOrientation::FRAME, // 2 is relative to paragraph
1488  };
1489 
1490  // Adjustment is vertically relative to...
1491  static const sal_Int16 aVertRelOriTab[nCntRelTo] =
1492  {
1493  text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
1494  text::RelOrientation::PAGE_FRAME, // 1 is page margin
1495  text::RelOrientation::FRAME, // 2 is relative to paragraph
1496  };
1497 
1498  const int nXAlign = aDo.bx < nCntRelTo ? aDo.bx : 0;
1499  const int nYAlign = aDo.by < nCntRelTo ? aDo.by : 0;
1500 
1501  aSet.Put(SwFormatHoriOrient(aRect.Left(), text::HoriOrientation::NONE,
1502  aHoriRelOriTab[ nXAlign ]));
1503  aSet.Put(SwFormatVertOrient(aRect.Top(), text::VertOrientation::NONE,
1504  aVertRelOriTab[ nYAlign ]));
1505 
1506  SwFrameFormat *pFrame = m_rDoc.getIDocumentContentOperations().InsertDrawObj( *m_pPaM, *pObject, aSet );
1507  pObject->SetMergedItemSet(aSet);
1508 
1509  if (SwDrawFrameFormat *pDrawFrame = dynamic_cast<SwDrawFrameFormat*>(pFrame))
1510  {
1511  pDrawFrame->PosAttrSet();
1512  }
1513 
1514  AddAutoAnchor(pFrame);
1515  }
1516  }
1517 }
1518 
1520  MSO_SPT eShapeType, sal_Int32 &rThick)
1521 {
1522  sal_Int32 nOutsideThick = 0;
1523  /*
1524  Note: In contrast to the regular WinWord table and frame border width,
1525  where the overall border width has to be calculated from the width of *one*
1526  line, the data from ESCHER already contains the overall width [twips]!
1527 
1528  The WinWord default is 15 tw. We take for this our 20 tw line.
1529  (0.75 pt and 1.0 pt looking more similar on hardcopy than 0.75 pt and our
1530  0.05 pt hairline.) The hairline we only set by WinWord width up to max.
1531  0.5 pt.
1532  */
1533  switch( eStyle )
1534  {
1535  case mso_lineTriple:
1536  case mso_lineSimple:
1537  nOutsideThick = eShapeType != mso_sptTextBox ? rThick : rThick/2;
1538  break;
1539  case mso_lineDouble:
1540  if (eShapeType == mso_sptTextBox)
1541  {
1542  nOutsideThick = rThick/6;
1543  rThick = rThick*2/3;
1544  }
1545  else
1546  nOutsideThick = rThick*2/3;
1547  break;
1548  case mso_lineThickThin:
1549  if (eShapeType == mso_sptTextBox)
1550  {
1551  nOutsideThick = rThick*3/10;
1552  rThick = rThick*4/5;
1553  }
1554  else
1555  nOutsideThick = rThick*4/5;
1556  break;
1557  case mso_lineThinThick:
1558  {
1559  if (eShapeType == mso_sptTextBox)
1560  {
1561  nOutsideThick = rThick/10;
1562  rThick = rThick*3/5;
1563  }
1564  else
1565  nOutsideThick = rThick*3/5;
1566  }
1567  break;
1568  default:
1569  break;
1570  }
1571  return nOutsideThick;
1572 }
1573 
1574 // Returns the thickness of the line outside the frame, the logic of
1575 // words positioning of borders around floating objects is that of a
1576 // disturbed mind.
1578  MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType, sal_Int32 &rLineThick,
1579  SvxBoxItem& rBox )
1580 {
1581  sal_Int32 nOutsideThick = 0;
1582  if( !rLineThick )
1583  return nOutsideThick;
1584 
1585  SvxBorderLineStyle nIdx = SvxBorderLineStyle::NONE;
1586 
1587  sal_Int32 nLineThick=rLineThick;
1588  nOutsideThick = SwMSDffManager::GetEscherLineMatch(eLineStyle,
1589  eShapeType, rLineThick);
1590 
1591  /*
1592  Note: In contrast to the regular WinWord table and frame border width,
1593  where the overall border width has to be calculated from the width of *one*
1594  line, the data from ESCHER already contains the overall width [twips]!
1595 
1596  The WinWord default is 15 tw. We take for this our 20 tw line.
1597  (0.75 pt and 1.0 pt looking more similar on hardcopy than 0.75 pt and our
1598  0.05 pt hairline.) The hairline we only set by WinWord width up to max.
1599  0.5 pt.
1600  */
1601  switch( +eLineStyle )
1602  {
1603  // first the single lines
1604  case mso_lineSimple:
1605  nIdx = SvxBorderLineStyle::SOLID;
1606  break;
1607  // second the double lines
1608  case mso_lineDouble:
1609  nIdx = SvxBorderLineStyle::DOUBLE;
1610  break;
1611  case mso_lineThickThin:
1612  nIdx = SvxBorderLineStyle::THICKTHIN_SMALLGAP;
1613  break;
1614  case mso_lineThinThick:
1615  nIdx = SvxBorderLineStyle::THINTHICK_SMALLGAP;
1616  break;
1617  // We have no triple border, use double instead.
1618  case mso_lineTriple:
1619  nIdx = SvxBorderLineStyle::DOUBLE;
1620  break;
1621  // no line style is set
1622  case MSO_LineStyle(USHRT_MAX):
1623  break;
1624  // erroneously not implemented line style is set
1625  default:
1626  OSL_ENSURE(false, "eLineStyle is not (yet) implemented!");
1627  break;
1628  }
1629 
1630  switch( eDashing )
1631  {
1632  case mso_lineDashGEL:
1633  nIdx = SvxBorderLineStyle::DASHED;
1634  break;
1635  case mso_lineDotGEL:
1636  nIdx = SvxBorderLineStyle::DOTTED;
1637  break;
1638  default:
1639  break;
1640  }
1641 
1642  if (SvxBorderLineStyle::NONE != nIdx)
1643  {
1644  SvxBorderLine aLine;
1645  aLine.SetColor( rLineColor );
1646 
1647  aLine.SetWidth( nLineThick ); // No conversion here, nLineThick is already in twips
1648  aLine.SetBorderLineStyle(nIdx);
1649 
1651  {
1652  // aLine is cloned by SetLine
1653  rBox.SetLine(&aLine, nLine);
1654  }
1655  }
1656 
1657  return nOutsideThick;
1658 }
1659 
1660 #define WW8ITEMVALUE(ItemSet,Id,Cast) ItemSet.GetItem<Cast>(Id)->GetValue()
1661 
1663  SfxItemSet& rFlySet, MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType,
1664  tools::Rectangle& rInnerDist )
1665 {
1666  /*
1667  attributes to be set on the frame
1668  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1669  SwFormatFrameSize if not set, set here
1670  SvxLRSpaceItem set here
1671  SvxULSpaceItem set here
1672  SvxOpaqueItem (Currently not possible for frames! khz 10.2.1999)
1673  SwFormatSurround already set
1674  SwFormatVertOrient already set
1675  SwFormatHoriOrient already set
1676  SwFormatAnchor already set
1677  SvxBoxItem set here
1678  SvxBrushItem set here
1679  SvxShadowItem set here
1680  */
1681 
1682  // 1. GraphicObject of documents?
1683  GrafikCtor();
1684 
1685  const SfxItemSet& rOldSet = pSdrObj->GetMergedItemSet();
1686 
1687  // some Items can be taken over directly
1688  static sal_uInt16 const aDirectMatch[]
1689  {
1690  RES_LR_SPACE, // outer spacing left/right: SvxLRSpaceItem
1691  RES_UL_SPACE // outer spacing top/bottom: SvxULSpaceItem
1692  };
1693  const SfxPoolItem* pPoolItem;
1694  for(sal_uInt16 i : aDirectMatch)
1695  if( SfxItemState::SET == rOldSet.GetItemState(i, false, &pPoolItem) )
1696  {
1697  rFlySet.Put( *pPoolItem );
1698  }
1699 
1700  // take new XATTR items directly. Skip old RES_BACKGROUND if new FILLSTYLE taken.
1701  bool bSkipResBackground = false;
1702  SfxItemPool* pPool = rFlySet.GetPool();
1703  if ( pPool )
1704  {
1705  for ( sal_uInt16 i = XATTR_START; i < XATTR_END; ++i )
1706  {
1707  // Not all Fly types support XATTRs - skip unsupported attributes
1708  SfxItemPool* pAttrPool = pPool->GetMasterPool();
1709  while ( pAttrPool && !pAttrPool->IsInRange(i) )
1710  pAttrPool = pAttrPool->GetSecondaryPool();
1711  if ( !pAttrPool )
1712  continue;
1713 
1714  if ( SfxItemState::SET == rOldSet.GetItemState(i, false, &pPoolItem) )
1715  {
1716  rFlySet.Put( *pPoolItem );
1717  if ( i == XATTR_FILLSTYLE )
1718  bSkipResBackground = true;
1719  }
1720  }
1721  }
1722 
1723  // now calculate the borders and build the box: The unit is needed for the
1724  // frame SIZE!
1725  SvxBoxItem aBox(sw::util::ItemGet<SvxBoxItem>(rFlySet, RES_BOX));
1726  // dashed or solid becomes solid
1727  // WW-default: 0.75 pt = 15 twips
1728  sal_Int32 nLineThick = 15, nOutside=0;
1729 
1730  // check if LineStyle is *really* set!
1731  const SfxPoolItem* pItem;
1732 
1733  SfxItemState eState = rOldSet.GetItemState(XATTR_LINESTYLE,true,&pItem);
1734  if( eState == SfxItemState::SET )
1735  {
1736  // Now, that we know there is a line style we will make use the
1737  // parameter given to us when calling the method... :-)
1738  const Color aLineColor = rOldSet.Get(XATTR_LINECOLOR).GetColorValue();
1739  nLineThick = WW8ITEMVALUE(rOldSet, XATTR_LINEWIDTH, XLineWidthItem);
1740 
1741  if( !nLineThick )
1742  nLineThick = 1; // for Writer, zero is "no border", so set a minimal value
1743 
1744  nOutside = MatchSdrBoxIntoFlyBoxItem(aLineColor, eLineStyle,
1745  eDashing, eShapeType, nLineThick, aBox);
1746  }
1747 
1748  rInnerDist.AdjustLeft(nLineThick );
1749  rInnerDist.AdjustTop(nLineThick );
1750  rInnerDist.AdjustRight(nLineThick );
1751  rInnerDist.AdjustBottom(nLineThick );
1752 
1753  rInnerDist.AdjustLeft( -(aBox.CalcLineWidth( SvxBoxItemLine::LEFT )) );
1754  rInnerDist.AdjustTop( -(aBox.CalcLineWidth( SvxBoxItemLine::TOP )) );
1755  rInnerDist.AdjustRight( -(aBox.CalcLineWidth( SvxBoxItemLine::RIGHT )) );
1756  rInnerDist.AdjustBottom( -(aBox.CalcLineWidth( SvxBoxItemLine::BOTTOM )) );
1757 
1758  // set distances from box's border to text contained within the box
1759  if( 0 < rInnerDist.Left() )
1760  aBox.SetDistance( static_cast<sal_uInt16>(rInnerDist.Left()), SvxBoxItemLine::LEFT );
1761  if( 0 < rInnerDist.Top() )
1762  aBox.SetDistance( static_cast<sal_uInt16>(rInnerDist.Top()), SvxBoxItemLine::TOP );
1763  if( 0 < rInnerDist.Right() )
1764  aBox.SetDistance( static_cast<sal_uInt16>(rInnerDist.Right()), SvxBoxItemLine::RIGHT );
1765  if( 0 < rInnerDist.Bottom() )
1766  aBox.SetDistance( static_cast<sal_uInt16>(rInnerDist.Bottom()), SvxBoxItemLine::BOTTOM );
1767 
1768  bool bFixSize = !(WW8ITEMVALUE(rOldSet, SDRATTR_TEXT_AUTOGROWHEIGHT,
1769  SdrOnOffItem));
1770 
1771  // Size: SwFormatFrameSize
1772  if( SfxItemState::SET != rFlySet.GetItemState(RES_FRM_SIZE, false) )
1773  {
1774  const tools::Rectangle& rSnapRect = pSdrObj->GetSnapRect();
1775  // if necessary adapt width and position of the framework: The
1776  // recorded interior is to remain equally large despite thick edges.
1777  rFlySet.Put( SwFormatFrameSize(bFixSize ? ATT_FIX_SIZE : ATT_VAR_SIZE,
1778  rSnapRect.GetWidth() + 2*nOutside,
1779  rSnapRect.GetHeight() + 2*nOutside) );
1780  }
1781  else // If a size is set, adjust it to consider border thickness
1782  {
1783  SwFormatFrameSize aSize = rFlySet.Get(RES_FRM_SIZE);
1784 
1786  aSize.GetWidth() + 2*nOutside,
1787  aSize.GetHeight() + 2*nOutside);
1788  aNewSize.SetWidthSizeType(aSize.GetWidthSizeType());
1789  rFlySet.Put( aNewSize );
1790  }
1791 
1792  // Sadly word puts escher borders outside the graphic, but orients the
1793  // graphic in relation to the top left inside the border. We don't
1794  if (nOutside)
1795  {
1796  SwFormatHoriOrient aHori = rFlySet.Get(RES_HORI_ORIENT);
1797  aHori.SetPos(MakeSafePositioningValue(aHori.GetPos()-nOutside));
1798  rFlySet.Put(aHori);
1799 
1800  SwFormatVertOrient aVert = rFlySet.Get(RES_VERT_ORIENT);
1801  aVert.SetPos(aVert.GetPos()-nOutside);
1802  rFlySet.Put(aVert);
1803  }
1804 
1805  // now set the border
1806  rFlySet.Put( aBox );
1807 
1808  // shadow of the box: SvxShadowItem
1809  if( WW8ITEMVALUE(rOldSet, SDRATTR_SHADOW, SdrOnOffItem) )
1810  {
1811  SvxShadowItem aShadow( RES_SHADOW );
1812 
1813  const Color aShdColor = rOldSet.Get(SDRATTR_SHADOWCOLOR).GetColorValue();
1814  const sal_Int32 nShdDistX = WW8ITEMVALUE(rOldSet, SDRATTR_SHADOWXDIST,
1815  SdrMetricItem);
1816  const sal_Int32 nShdDistY = WW8ITEMVALUE(rOldSet, SDRATTR_SHADOWYDIST,
1817  SdrMetricItem);
1818 
1819  aShadow.SetColor( aShdColor );
1820 
1821  aShadow.SetWidth(writer_cast<sal_uInt16>((std::abs( nShdDistX) +
1822  std::abs( nShdDistY )) / 2 ));
1823 
1824  SvxShadowLocation eShdPosi;
1825  if( 0 <= nShdDistX )
1826  {
1827  if( 0 <= nShdDistY )
1828  eShdPosi = SvxShadowLocation::BottomRight;
1829  else
1830  eShdPosi = SvxShadowLocation::TopRight;
1831  }
1832  else
1833  {
1834  if( 0 <= nShdDistY )
1835  eShdPosi = SvxShadowLocation::BottomLeft;
1836  else
1837  eShdPosi = SvxShadowLocation::TopLeft;
1838  }
1839  aShadow.SetLocation( eShdPosi );
1840 
1841  rFlySet.Put( aShadow );
1842  }
1843  SvxBrushItem aBrushItem(COL_WHITE, RES_BACKGROUND);
1844  bool bBrushItemOk = false;
1845  sal_uInt8 nTrans = 0;
1846 
1847  // Separate transparency
1848  eState = rOldSet.GetItemState(XATTR_FILLTRANSPARENCE, true, &pItem);
1849  if (!bSkipResBackground && eState == SfxItemState::SET)
1850  {
1851  sal_uInt16 nRes = WW8ITEMVALUE(rOldSet, XATTR_FILLTRANSPARENCE,
1853  nTrans = sal_uInt8((nRes * 0xFE) / 100);
1854  aBrushItem.GetColor().SetTransparency(nTrans);
1855  bBrushItemOk = true;
1856  }
1857 
1858  // Background: SvxBrushItem
1859  eState = rOldSet.GetItemState(XATTR_FILLSTYLE, true, &pItem);
1860  if (!bSkipResBackground && eState == SfxItemState::SET)
1861  {
1862  const drawing::FillStyle eFill = static_cast<const XFillStyleItem*>(pItem)->GetValue();
1863 
1864  switch (eFill)
1865  {
1866  default:
1867  case drawing::FillStyle_NONE:
1868  // Writer graphics don't have it yet
1869  if (eShapeType != mso_sptPictureFrame)
1870  {
1871  aBrushItem.GetColor().SetTransparency(0xFE);
1872  bBrushItemOk = true;
1873  }
1874  break;
1875  case drawing::FillStyle_SOLID:
1876  case drawing::FillStyle_GRADIENT:
1877  {
1878  const Color aColor =
1879  rOldSet.Get(XATTR_FILLCOLOR).GetColorValue();
1880  aBrushItem.SetColor(aColor);
1881 
1882  if (bBrushItemOk) // has trans
1883  aBrushItem.GetColor().SetTransparency(nTrans);
1884 
1885  bBrushItemOk = true;
1886  }
1887  break;
1888  case drawing::FillStyle_HATCH:
1889  break;
1890  case drawing::FillStyle_BITMAP:
1891  {
1892  GraphicObject aGrfObj(rOldSet.Get(XATTR_FILLBITMAP).GetGraphicObject());
1893  const bool bTile(WW8ITEMVALUE(rOldSet, XATTR_FILLBMP_TILE, SfxBoolItem));
1894 
1895  if(bBrushItemOk) // has trans
1896  {
1897  GraphicAttr aAttr(aGrfObj.GetAttr());
1898 
1899  aAttr.SetTransparency(nTrans);
1900  aGrfObj.SetAttr(aAttr);
1901  }
1902 
1903  aBrushItem.SetGraphicObject(aGrfObj);
1904  aBrushItem.SetGraphicPos(bTile ? GPOS_TILED : GPOS_AREA);
1905  bBrushItemOk = true;
1906  }
1907  break;
1908  }
1909  }
1910 
1911  if (bBrushItemOk)
1912  rFlySet.Put(aBrushItem);
1913 }
1914 
1916  const SvxMSDffImportRec &rRecord, SvxLRSpaceItem &rLR)
1917 {
1918  sal_uInt32 nXRelTo = SvxMSDffImportRec::RELTO_DEFAULT;
1919  if ( rRecord.nXRelTo )
1920  {
1921  nXRelTo = rRecord.nXRelTo.get();
1922  }
1923 
1924  // Left adjustments - if horizontally aligned to left of
1925  // margin or column then remove the left wrapping
1926  if (rRecord.nXAlign == 1)
1927  {
1928  if ((nXRelTo == 0) || (nXRelTo == 2))
1929  rLR.SetLeft(sal_uInt16(0));
1930  }
1931 
1932  // Right adjustments - if horizontally aligned to right of
1933  // margin or column then remove the right wrapping
1934  if (rRecord.nXAlign == 3)
1935  {
1936  if ((nXRelTo == 0) || (nXRelTo == 2))
1937  rLR.SetRight(sal_uInt16(0));
1938  }
1939 
1940  // Inside margin, remove left wrapping
1941  if ((rRecord.nXAlign == 4) && (nXRelTo == 0))
1942  {
1943  rLR.SetLeft(sal_uInt16(0));
1944  }
1945 
1946  // Outside margin, remove left wrapping
1947  if ((rRecord.nXAlign == 5) && (nXRelTo == 0))
1948  {
1949  rLR.SetRight(sal_uInt16(0));
1950  }
1951 }
1952 
1954  const SvxMSDffImportRec &rRecord, SvxULSpaceItem &rUL)
1955 {
1956  sal_uInt32 nYRelTo = SvxMSDffImportRec::RELTO_DEFAULT;
1957  if ( rRecord.nYRelTo )
1958  {
1959  nYRelTo = rRecord.nYRelTo.get();
1960  }
1961 
1962  // Top adjustment - remove upper wrapping if aligned to page
1963  // printable area or to page
1964  if (rRecord.nYAlign == 1)
1965  {
1966  if ((nYRelTo == 0) || (nYRelTo == 1))
1967  rUL.SetUpper(sal_uInt16(0));
1968  }
1969 
1970  // Bottom adjustment - remove bottom wrapping if aligned to page or
1971  // printable area or to page
1972  if (rRecord.nYAlign == 3)
1973  {
1974  if ((nYRelTo == 0) || (nYRelTo == 1))
1975  rUL.SetLower(sal_uInt16(0));
1976  }
1977 
1978  // Remove top margin if aligned vertically inside margin
1979  if ((rRecord.nYAlign == 4) && (nYRelTo == 0))
1980  rUL.SetUpper(sal_uInt16(0));
1981 }
1982 
1984  SwFrameFormat* pFlyFormat)
1985 {
1986  if (!pRecord || !pFlyFormat)
1987  return;
1988 
1989  if (pRecord->nDxWrapDistLeft || pRecord->nDxWrapDistRight)
1990  {
1991  SvxLRSpaceItem aLR(writer_cast<sal_uInt16>(pRecord->nDxWrapDistLeft),
1992  writer_cast<sal_uInt16>(pRecord->nDxWrapDistRight), 0, 0, RES_LR_SPACE);
1993  AdjustLRWrapForWordMargins(*pRecord, aLR);
1994  pFlyFormat->SetFormatAttr(aLR);
1995  }
1996  if (pRecord->nDyWrapDistTop || pRecord->nDyWrapDistBottom)
1997  {
1998  SvxULSpaceItem aUL(writer_cast<sal_uInt16>(pRecord->nDyWrapDistTop),
1999  writer_cast<sal_uInt16>(pRecord->nDyWrapDistBottom), RES_UL_SPACE);
2000  AdjustULWrapForWordMargins(*pRecord, aUL);
2001  pFlyFormat->SetFormatAttr(aUL);
2002  }
2003 
2004  // If we are contoured and have a custom polygon...
2005  if (pRecord->pWrapPolygon && pFlyFormat->GetSurround().IsContour())
2006  {
2007  if (SwNoTextNode *pNd = GetNoTextNodeFromSwFrameFormat(*pFlyFormat))
2008  {
2009 
2010  /*
2011  Gather round children and hear of a tale that will raise the
2012  hairs on the back of your neck this dark halloween night.
2013 
2014  There is a polygon in word that describes the wrapping around
2015  the graphic.
2016 
2017  Here are some sample values for the simplest case of a square
2018  around some solid coloured graphics
2019 
2020  X Y Pixel size of graphic
2021  TopLeft -54 21600 400x400
2022  Bottom Right 0 21546
2023 
2024  TopLeft -108 21600 200x200
2025  Bottom Right 0 21492
2026 
2027  TopLeft -216 21600 100x100
2028  Bottom Right 0 21384
2029 
2030  TopLeft -432 21600 50x50
2031  Bottom Right 0 21168
2032 
2033  TopLeft -76 21600 283x212
2034  Bottom Right 0 21498
2035 
2036  So given that the size of the values remains pretty much the
2037  same despite the size of the graphic, we can tell that the
2038  polygon is measured in units that are independent of the
2039  graphic. But why does the left corner move a different value
2040  to the left each time, and why does the bottom move upwards
2041  each time, when the right and top remain at the same value ?
2042 
2043  I have no idea, but clearly once we calculate the values out
2044  we see that the left margin is always a fixed realworld
2045  distance from the true left and the polygon bottom is the same
2046  fixed value from the bottom. i.e. 15twips.
2047 
2048  So here we take our word provided polygon, shift it to the
2049  right by 15twips and rescale it widthwise to shrink the width
2050  a little to fit the now moved right margin back to where it
2051  was, and stretch the height a little to make the bottom move
2052  down the missing 15twips then we get a polygon that matches
2053  what I actually see in word
2054  */
2055 
2056  tools::PolyPolygon aPoly(*pRecord->pWrapPolygon);
2057  const Size &rSize = pNd->GetTwipSize();
2058  /*
2059  Move to the left by 15twips, and rescale to
2060  a) shrink right bound back to orig position
2061  b) stretch bottom bound to where I think it should have been
2062  in the first place
2063  */
2064  Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
2065  aMoveHack *= Fraction(15, 1);
2066  long nMove(aMoveHack);
2067  aPoly.Move(nMove, 0);
2068 
2071  aPoly.Scale(double(aHackX), double(aHackY));
2072 
2073  // Turn polygon back into units that match the graphic's
2074  const Size &rOrigSize = pNd->GetGraphic().GetPrefSize();
2075  Fraction aMapPolyX(rOrigSize.Width(), ww::nWrap100Percent);
2076  Fraction aMapPolyY(rOrigSize.Height(), ww::nWrap100Percent);
2077  aPoly.Scale(double(aMapPolyX), double(aMapPolyY));
2078 
2079  // #i47277# - contour is already in unit of the
2080  // graphic preferred unit. Thus, call method <SetContour(..)>
2081  pNd->SetContour(&aPoly);
2082  }
2083  }
2084 }
2085 
2086 static sal_Int32 lcl_ConvertCrop(sal_uInt32 const nCrop, sal_Int32 const nSize)
2087 {
2088  // cast to sal_Int32 to handle negative crop properly
2089  sal_Int32 const nIntegral(static_cast<sal_Int32>(nCrop) >> 16);
2090  // fdo#77454: heuristic to detect mangled values written by old OOo/LO
2091  if (abs(nIntegral) >= 50) // FIXME: what's a good cut-off?
2092  {
2093  SAL_INFO("sw.ww8", "ignoring suspiciously large crop: " << nIntegral);
2094  return 0;
2095  }
2096  return (nIntegral * nSize) + (((nCrop & 0xffff) * nSize) >> 16);
2097 }
2098 
2099 void
2101  SwFrameFormat const *pFlyFormat, WW8_FSPA const *pF )
2102 {
2103  const SwNodeIndex* pIdx = pFlyFormat->GetContent(false).GetContentIdx();
2104  SwGrfNode *const pGrfNd(
2105  pIdx ? m_rDoc.GetNodes()[pIdx->GetIndex() + 1]->GetGrfNode() : nullptr);
2106  if (pGrfNd)
2107  {
2108  Size aSz(pGrfNd->GetTwipSize());
2109  // use type <sal_uInt64> instead of sal_uLong to get correct results
2110  // in the following calculations.
2111  sal_uInt64 nHeight = aSz.Height();
2112  sal_uInt64 nWidth = aSz.Width();
2113  if (!nWidth && pF)
2114  nWidth = o3tl::saturating_sub(pF->nXaRight, pF->nXaLeft);
2115  else if (!nHeight && pF)
2116  nHeight = o3tl::saturating_sub(pF->nYaBottom, pF->nYaTop);
2117 
2118  if( pRecord->nCropFromTop || pRecord->nCropFromBottom ||
2119  pRecord->nCropFromLeft || pRecord->nCropFromRight )
2120  {
2121  SwCropGrf aCrop; // Cropping is stored in 'fixed floats'
2122  // 16.16 (fraction times total
2123  if( pRecord->nCropFromTop ) // image width or height resp.)
2124  {
2125  aCrop.SetTop(lcl_ConvertCrop(pRecord->nCropFromTop, nHeight));
2126  }
2127  if( pRecord->nCropFromBottom )
2128  {
2129  aCrop.SetBottom(lcl_ConvertCrop(pRecord->nCropFromBottom, nHeight));
2130  }
2131  if( pRecord->nCropFromLeft )
2132  {
2133  aCrop.SetLeft(lcl_ConvertCrop(pRecord->nCropFromLeft, nWidth));
2134  }
2135  if( pRecord->nCropFromRight )
2136  {
2137  aCrop.SetRight(lcl_ConvertCrop(pRecord->nCropFromRight, nWidth));
2138  }
2139 
2140  pGrfNd->SetAttr( aCrop );
2141  }
2142 
2143  bool bFlipH(pRecord->nFlags & ShapeFlag::FlipH);
2144  bool bFlipV(pRecord->nFlags & ShapeFlag::FlipV);
2145  if ( bFlipH || bFlipV )
2146  {
2147  SwMirrorGrf aMirror = pGrfNd->GetSwAttrSet().GetMirrorGrf();
2148  if( bFlipH )
2149  {
2150  if( bFlipV )
2151  aMirror.SetValue(MirrorGraph::Both);
2152  else
2154  }
2155  else
2157 
2158  pGrfNd->SetAttr( aMirror );
2159  }
2160 
2161  if (pRecord->pObj)
2162  {
2163  const SfxItemSet& rOldSet = pRecord->pObj->GetMergedItemSet();
2164  // contrast
2165  if (WW8ITEMVALUE(rOldSet, SDRATTR_GRAFCONTRAST,
2167  {
2168  SwContrastGrf aContrast(
2169  WW8ITEMVALUE(rOldSet,
2171  pGrfNd->SetAttr( aContrast );
2172  }
2173 
2174  // luminance
2175  if (WW8ITEMVALUE(rOldSet, SDRATTR_GRAFLUMINANCE,
2177  {
2178  SwLuminanceGrf aLuminance(WW8ITEMVALUE(rOldSet,
2180  pGrfNd->SetAttr( aLuminance );
2181  }
2182  // gamma
2184  {
2185  double fVal = WW8ITEMVALUE(rOldSet, SDRATTR_GRAFGAMMA,
2187  pGrfNd->SetAttr(SwGammaGrf(fVal/100.));
2188  }
2189 
2190  // drawmode
2191  auto nGrafMode = rOldSet.GetItem<SdrGrafModeItem>(SDRATTR_GRAFMODE)->GetValue();
2192  if ( nGrafMode != GraphicDrawMode::Standard)
2193  {
2194  SwDrawModeGrf aDrawMode( nGrafMode );
2195  pGrfNd->SetAttr( aDrawMode );
2196  }
2197  }
2198  }
2199 }
2200 
2202 {
2203  if (pFlyFormat)
2204  {
2205  SdrObject* pNewObject = m_bNewDoc ? nullptr : pFlyFormat->FindRealSdrObject();
2206  if (!pNewObject)
2207  pNewObject = pFlyFormat->FindSdrObject();
2208  if (!pNewObject && dynamic_cast< const SwFlyFrameFormat *>( pFlyFormat ) != nullptr)
2209  {
2210  SwFlyDrawContact* pContactObject(static_cast<SwFlyFrameFormat*>(pFlyFormat)->GetOrCreateContact());
2211  pNewObject = pContactObject->GetMaster();
2212  }
2213  return pNewObject;
2214  }
2215  return nullptr;
2216 }
2217 
2218 // Miserable miserable hack to fudge word's graphic layout in RTL mode to ours.
2220  sal_Int16 eHoriOri, sal_Int16 eHoriRel)
2221 {
2222  if (!IsRightToLeft())
2223  return false;
2224  return RTLGraphicsHack(rLeft, nWidth, eHoriOri, eHoriRel,
2225  m_aSectionManager.GetPageLeft(),
2226  m_aSectionManager.GetPageRight(),
2227  m_aSectionManager.GetPageWidth());
2228 }
2229 
2231  WW8_FSPA *pFSPA, SfxItemSet &rFlySet)
2232 {
2233  OSL_ENSURE(pRecord || pFSPA, "give me something! to work with for anchoring");
2234  if (!pRecord && !pFSPA)
2235  return RndStdIds::FLY_AT_PAGE;
2236  bool bCurSectionVertical = m_aSectionManager.CurrentSectionIsVertical();
2237 
2238  SvxMSDffImportRec aRecordFromFSPA;
2239  if (!pRecord)
2240  pRecord = &aRecordFromFSPA;
2241  if (!(pRecord->nXRelTo) && pFSPA)
2242  {
2243  pRecord->nXRelTo = sal_Int32(pFSPA->nbx);
2244  }
2245  if (!(pRecord->nYRelTo) && pFSPA)
2246  {
2247  pRecord->nYRelTo = sal_Int32(pFSPA->nby);
2248  }
2249 
2250  // nXAlign - abs. Position, Left, Centered, Right, Inside, Outside
2251  // nYAlign - abs. Position, Top, Centered, Bottom, Inside, Outside
2252 
2253  // nXRelTo - Page printable area, Page, Column, Character
2254  // nYRelTo - Page printable area, Page, Paragraph, Line
2255 
2256  const sal_uInt32 nCntXAlign = 6;
2257  const sal_uInt32 nCntYAlign = 6;
2258 
2259  const sal_uInt32 nCntRelTo = 4;
2260 
2261  sal_uInt32 nXAlign = nCntXAlign > pRecord->nXAlign ? pRecord->nXAlign : 1;
2262  sal_uInt32 nYAlign = nCntYAlign > pRecord->nYAlign ? pRecord->nYAlign : 1;
2263 
2264  if (pFSPA)
2265  {
2266  // #i52565# - try to handle special case for objects in tables regarding its X Rel
2267 
2268  // if X and Y Rel values are on default take it as a hint, that they have not been set
2269  // by <SwMSDffManager::ProcessObj(..)>
2270  const bool bXYRelHaveDefaultValues = pRecord->nXRelTo.get() == 2 && pRecord->nYRelTo.get() == 2;
2271  if ( bXYRelHaveDefaultValues
2272  && m_nInTable > 0
2273  && !bCurSectionVertical )
2274  {
2275  if ( sal_uInt32(pFSPA->nby) != pRecord->nYRelTo )
2276  {
2277  pRecord->nYRelTo = sal_uInt32(pFSPA->nby);
2278  }
2279  }
2280  }
2281 
2282  sal_uInt32 nXRelTo = (pRecord->nXRelTo && nCntRelTo > pRecord->nXRelTo) ? pRecord->nXRelTo.get() : 1;
2283  sal_uInt32 nYRelTo = (pRecord->nYRelTo && nCntRelTo > pRecord->nYRelTo) ? pRecord->nYRelTo.get() : 1;
2284 
2285  RndStdIds eAnchor = IsInlineEscherHack() ? RndStdIds::FLY_AS_CHAR : RndStdIds::FLY_AT_CHAR; // #i43718#
2286 
2287  SwFormatAnchor aAnchor( eAnchor );
2288  aAnchor.SetAnchor( m_pPaM->GetPoint() );
2289  rFlySet.Put( aAnchor );
2290 
2291  if (pFSPA)
2292  {
2293  // #i18732#
2294  // Given new layout where everything is changed to be anchored to
2295  // character the following 4 tables may need to be changed.
2296 
2297  // horizontal Adjustment
2298  static const sal_Int16 aHoriOriTab[ nCntXAlign ] =
2299  {
2300  text::HoriOrientation::NONE, // From left position
2302  text::HoriOrientation::CENTER, // centered
2304  // #i36649#
2305  // - inside -> text::HoriOrientation::LEFT and outside -> text::HoriOrientation::RIGHT
2306  text::HoriOrientation::LEFT, // inside
2307  text::HoriOrientation::RIGHT // outside
2308  };
2309 
2310  // generic vertical Adjustment
2311  static const sal_Int16 aVertOriTab[ nCntYAlign ] =
2312  {
2313  text::VertOrientation::NONE, // From Top position
2315  text::VertOrientation::CENTER, // centered
2317  text::VertOrientation::LINE_TOP, // inside (obscure)
2318  text::VertOrientation::LINE_BOTTOM // outside (obscure)
2319  };
2320 
2321  // #i22673# - to-line vertical alignment
2322  static const sal_Int16 aToLineVertOriTab[ nCntYAlign ] =
2323  {
2324  text::VertOrientation::NONE, // below
2325  text::VertOrientation::LINE_BOTTOM, // top
2326  text::VertOrientation::LINE_CENTER, // centered
2327  text::VertOrientation::LINE_TOP, // bottom
2328  text::VertOrientation::LINE_BOTTOM, // inside (obscure)
2329  text::VertOrientation::LINE_TOP // outside (obscure)
2330  };
2331 
2332  // Adjustment is horizontally relative to...
2333  static const sal_Int16 aHoriRelOriTab[nCntRelTo] =
2334  {
2335  text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
2336  text::RelOrientation::PAGE_FRAME, // 1 is page margin
2337  text::RelOrientation::FRAME, // 2 is relative to column
2338  text::RelOrientation::CHAR // 3 is relative to character
2339  };
2340 
2341  // Adjustment is vertically relative to...
2342  // #i22673# - adjustment for new vertical alignment at top of line.
2343  static const sal_Int16 aVertRelOriTab[nCntRelTo] =
2344  {
2345  text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
2346  text::RelOrientation::PAGE_FRAME, // 1 is page margin
2347  text::RelOrientation::FRAME, // 2 is relative to paragraph
2348  text::RelOrientation::TEXT_LINE // 3 is relative to line
2349  };
2350 
2351  sal_Int16 eHoriOri = aHoriOriTab[ nXAlign ];
2352  sal_Int16 eHoriRel = aHoriRelOriTab[ nXRelTo ];
2353 
2354  // #i36649# - adjustments for certain alignments
2355  if ( eHoriOri == text::HoriOrientation::LEFT && eHoriRel == text::RelOrientation::PAGE_FRAME )
2356  {
2357  // convert 'left to page' to 'from left -<width> to page text area'
2358  eHoriOri = text::HoriOrientation::NONE;
2359  eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;
2360  const long nWidth = pFSPA->nXaRight - pFSPA->nXaLeft;
2361  pFSPA->nXaLeft = -nWidth;
2362  pFSPA->nXaRight = 0;
2363  }
2364  else if ( eHoriOri == text::HoriOrientation::RIGHT && eHoriRel == text::RelOrientation::PAGE_FRAME )
2365  {
2366  // convert 'right to page' to 'from left 0 to right page border'
2367  eHoriOri = text::HoriOrientation::NONE;
2368  eHoriRel = text::RelOrientation::PAGE_RIGHT;
2369  const long nWidth = pFSPA->nXaRight - pFSPA->nXaLeft;
2370  pFSPA->nXaLeft = 0;
2371  pFSPA->nXaRight = nWidth;
2372  }
2373 
2374  // #i24255# - position of floating screen objects in
2375  // R2L layout are given in L2R layout, thus convert them of all
2376  // floating screen objects, which are imported.
2377  {
2378  // Miserable miserable hack.
2379  SwTwips nWidth = o3tl::saturating_sub(pFSPA->nXaRight, pFSPA->nXaLeft);
2380  SwTwips nLeft = pFSPA->nXaLeft;
2381  if (MiserableRTLGraphicsHack(nLeft, nWidth, eHoriOri,
2382  eHoriRel))
2383  {
2384  pFSPA->nXaLeft = nLeft;
2385  pFSPA->nXaRight = pFSPA->nXaLeft + nWidth;
2386  }
2387  }
2388 
2389  // if the object is anchored inside a table cell, is horizontal aligned
2390  // at frame|character and has wrap through, but its attribute
2391  // 'layout in table cell' isn't set, convert its horizontal alignment to page text area.
2392  // #i84783# - use new method <IsObjectLayoutInTableCell()>
2393  if ( m_nInTable &&
2394  ( eHoriRel == text::RelOrientation::FRAME || eHoriRel == text::RelOrientation::CHAR ) &&
2395  pFSPA->nwr == 3 &&
2396  !IsObjectLayoutInTableCell( pRecord->nLayoutInTableCell ) )
2397  {
2398  eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;
2399  }
2400 
2401  // Writer honours this wrap distance when aligned as "left" or "right",
2402  // Word doesn't. Writer doesn't honour it when its "from left".
2403  if (eHoriOri == text::HoriOrientation::LEFT)
2404  pRecord->nDxWrapDistLeft=0;
2405  else if (eHoriOri == text::HoriOrientation::RIGHT)
2406  pRecord->nDxWrapDistRight=0;
2407 
2408  sal_Int16 eVertRel;
2409 
2410  eVertRel = aVertRelOriTab[ nYRelTo ]; // #i18732#
2411  if ( bCurSectionVertical && nYRelTo == 2 )
2412  eVertRel = text::RelOrientation::PAGE_PRINT_AREA;
2413  // #i22673# - fill <eVertOri> in dependence of <eVertRel>
2414  sal_Int16 eVertOri;
2415  if ( eVertRel == text::RelOrientation::TEXT_LINE )
2416  {
2417  eVertOri = aToLineVertOriTab[ nYAlign ];
2418  }
2419  else
2420  {
2421  eVertOri = aVertOriTab[ nYAlign ];
2422  }
2423 
2424  // Below line in word is a positive value, while in writer its
2425  // negative
2426  long nYPos = pFSPA->nYaTop;
2427  // #i22673#
2428  if ((eVertRel == text::RelOrientation::TEXT_LINE) && (eVertOri == text::VertOrientation::NONE))
2429  nYPos = -nYPos;
2430 
2431  SwFormatHoriOrient aHoriOri(MakeSafePositioningValue( bCurSectionVertical ? nYPos : pFSPA->nXaLeft ),
2432  bCurSectionVertical ? eVertOri : eHoriOri,
2433  bCurSectionVertical ? eVertRel : eHoriRel);
2434  if( 4 <= nXAlign )
2435  aHoriOri.SetPosToggle(true);
2436  rFlySet.Put( aHoriOri );
2437 
2438  rFlySet.Put(SwFormatVertOrient(MakeSafePositioningValue( !bCurSectionVertical ? nYPos : -pFSPA->nXaRight ),
2439  !bCurSectionVertical ? eVertOri : eHoriOri,
2440  !bCurSectionVertical ? eVertRel : eHoriRel ));
2441  }
2442 
2443  return eAnchor;
2444 }
2445 
2446 // #i84783#
2447 bool SwWW8ImplReader::IsObjectLayoutInTableCell( const sal_uInt32 nLayoutInTableCell ) const
2448 {
2449  bool bIsObjectLayoutInTableCell = false;
2450 
2451  if ( m_bVer8 )
2452  {
2453  const sal_uInt16 nWWVersion = m_xWwFib->m_nProduct & 0xE000;
2454  switch ( nWWVersion )
2455  {
2456  case 0x0000: // version 8 aka Microsoft Word 97
2457  {
2458  bIsObjectLayoutInTableCell = false;
2459  OSL_ENSURE( nLayoutInTableCell == 0xFFFFFFFF,
2460  "no explicit object attribute layout in table cell expected." );
2461  }
2462  break;
2463  case 0x2000: // version 9 aka Microsoft Word 2000
2464  case 0x4000: // version 10 aka Microsoft Word 2002
2465  case 0x6000: // version 11 aka Microsoft Word 2003
2466  case 0x8000: // version 12 aka Microsoft Word 2007
2467  case 0xC000: // version 14 aka Microsoft Word 2010
2468  {
2469  // #i98037#
2470  // adjustment of conditions needed after deeper analysis of
2471  // certain test cases.
2472  if ( nLayoutInTableCell == 0xFFFFFFFF || // no explicit attribute value given
2473  nLayoutInTableCell == 0x80008000 ||
2474  ( nLayoutInTableCell & 0x02000000 &&
2475  !(nLayoutInTableCell & 0x80000000 ) ) )
2476  {
2477  bIsObjectLayoutInTableCell = true;
2478  }
2479  else
2480  {
2481  bIsObjectLayoutInTableCell = false;
2482  }
2483  }
2484  break;
2485  default:
2486  {
2487  OSL_FAIL( "unknown version." );
2488  }
2489  }
2490  }
2491 
2492  return bIsObjectLayoutInTableCell;
2493 }
2494 
2496 {
2497  if( m_nIniFlags & WW8FL_NO_GRAFLAYER )
2498  return nullptr;
2499 
2500  ::SetProgressState(m_nProgress, m_pDocShell); // Update
2501 
2502  m_nDrawCpO = 0;
2503  m_bDrawCpOValid = m_xWwFib->GetBaseCp(m_xPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX, &m_nDrawCpO);
2504 
2505  GrafikCtor();
2506 
2507  WW8PLCFspecial* pPF = m_xPlcxMan->GetFdoa();
2508  if( !pPF )
2509  {
2510  OSL_ENSURE( false, "Where is the graphic (1) ?" );
2511  return nullptr;
2512  }
2513 
2514  if( m_bVer67 )
2515  {
2516  long nOldPos = m_pStrm->Tell();
2517 
2518  m_nDrawXOfs = m_nDrawYOfs = 0;
2519  ReadGrafLayer1( pPF, nGrafAnchorCp );
2520 
2521  m_pStrm->Seek( nOldPos );
2522  return nullptr;
2523  }
2524 
2525  // Normal case of Word 8+ version stuff
2526  pPF->SeekPos( nGrafAnchorCp );
2527 
2528  WW8_FC nStartFc;
2529  void* pF0;
2530  if( !pPF->Get( nStartFc, pF0 ) ){
2531  OSL_ENSURE( false, "+Where is the graphic (2) ?" );
2532  return nullptr;
2533  }
2534 
2535  WW8_FSPA_SHADOW* pFS = static_cast<WW8_FSPA_SHADOW*>(pF0);
2536  WW8_FSPA* pF;
2537  WW8_FSPA aFSFA;
2538  pF = &aFSFA;
2539  WW8FSPAShadowToReal( pFS, pF );
2540  if( !pF->nSpId )
2541  {
2542  OSL_ENSURE( false, "+Where is the graphic (3) ?" );
2543  return nullptr;
2544  }
2545 
2546  if (!m_xMSDffManager->GetModel())
2547  m_xMSDffManager->SetModel(m_pDrawModel, 1440);
2548 
2549  tools::Rectangle aRect(pF->nXaLeft, pF->nYaTop, pF->nXaRight, pF->nYaBottom);
2550  SvxMSDffImportData aData( aRect );
2551 
2552  /*
2553  #i20540#
2554  The SdrOle2Obj will try and manage any ole objects it finds, causing all
2555  sorts of trouble later on
2556  */
2557  SwDocShell* pPersist = m_rDoc.GetDocShell();
2558  m_rDoc.SetDocShell(nullptr); // #i20540# Persist guard
2559 
2560  SdrObject* pObject = nullptr;
2561  bool bOk = (m_xMSDffManager->GetShape(pF->nSpId, pObject, aData) && pObject);
2562 
2563  m_rDoc.SetDocShell(pPersist); // #i20540# Persist guard
2564 
2565  if (!bOk)
2566  {
2567  OSL_ENSURE( false, "Where is the Shape ?" );
2568  return nullptr;
2569  }
2570 
2571  // tdf#118375 Word relates position to the unrotated rectangle,
2572  // Writer uses the rotated one.
2573  if (pObject->GetRotateAngle())
2574  {
2575  tools::Rectangle aObjSnapRect(pObject->GetSnapRect()); // recalculates the SnapRect
2576  pF->nXaLeft = aObjSnapRect.Left();
2577  pF->nYaTop = aObjSnapRect.Top();
2578  pF->nXaRight = aObjSnapRect.Right();
2579  pF->nYaBottom = aObjSnapRect.Bottom();
2580  }
2581 
2582  bool bDone = false;
2583  SdrObject* pOurNewObject = nullptr;
2584  bool bReplaceable = false;
2585 
2586  switch (SdrObjKind(pObject->GetObjIdentifier()))
2587  {
2588  case OBJ_GRAF:
2589  bReplaceable = true;
2590  bDone = true;
2591  break;
2592  case OBJ_OLE2:
2593  bReplaceable = true;
2594  break;
2595  default:
2596  break;
2597 
2598  }
2599 
2600  // when in a header or footer word appears to treat all elements as wrap through
2601 
2602  // determine wrapping mode
2603  SfxItemSet aFlySet(m_rDoc.GetAttrPool(), svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END-1, XATTR_START, XATTR_END>{});
2604  Reader::ResetFrameFormatAttrs(aFlySet); // tdf#122425: Explicitly remove borders and spacing
2605  css::text::WrapTextMode eSurround = css::text::WrapTextMode_PARALLEL;
2606  bool bContour = false;
2607  switch (pF->nwr)
2608  {
2609  case 0: // 0 like 2, but doesn't require absolute object
2610  case 2: // 2 wrap around absolute object
2611  eSurround = css::text::WrapTextMode_PARALLEL;
2612  break;
2613  case 1: // 1 no text next to shape
2614  eSurround = css::text::WrapTextMode_NONE;
2615  break;
2616  case 3: // 3 wrap as if no object present
2617  eSurround = css::text::WrapTextMode_THROUGH;
2618  break;
2619  case 4: // 4 wrap tightly around object
2620  case 5: // 5 wrap tightly, but allow holes
2621  eSurround = css::text::WrapTextMode_PARALLEL;
2622  bContour = true;
2623  break;
2624  }
2625 
2626  // if mode 2 or 4 also regard the additional parameters
2627  if ( (2 == pF->nwr) || (4 == pF->nwr) )
2628  {
2629  switch( pF->nwrk )
2630  {
2631  // 0 wrap both sides
2632  case 0:
2633  eSurround = css::text::WrapTextMode_PARALLEL;
2634  break;
2635  // 1 wrap only on left
2636  case 1:
2637  eSurround = css::text::WrapTextMode_LEFT;
2638  break;
2639  // 2 wrap only on right
2640  case 2:
2641  eSurround = css::text::WrapTextMode_RIGHT;
2642  break;
2643  // 3 wrap only on largest side
2644  case 3:
2645  eSurround = css::text::WrapTextMode_DYNAMIC;
2646  break;
2647  }
2648  }
2649 
2650  SwFormatSurround aSur( eSurround );
2651  aSur.SetContour( bContour );
2652  aSur.SetOutside(true); // Winword can only do outside contours
2653  aFlySet.Put( aSur );
2654 
2655  // now position imported object correctly and so on (can be a whole group)
2656 
2657  OSL_ENSURE(!((aData.size() != 1) && bReplaceable),
2658  "Replaceable drawing with > 1 entries ?");
2659 
2660  if (aData.size() != 1)
2661  bReplaceable = false;
2662 
2663  /*
2664  Get the record for top level object, so we can get the word anchoring
2665  and wrapping information for it.
2666  */
2667  SvxMSDffImportRec* pRecord = aData.find(pObject);
2668  OSL_ENSURE(pRecord, "how did that happen?");
2669  if (!pRecord)
2670  {
2671  // remove old object from the Z-Order list
2672  m_xMSDffManager->RemoveFromShapeOrder(pObject);
2673  // and delete the object
2674  SdrObject::Free(pObject);
2675  return nullptr;
2676  }
2677 
2678  const bool bLayoutInTableCell =
2679  m_nInTable && IsObjectLayoutInTableCell( pRecord->nLayoutInTableCell );
2680 
2681  // #i18732# - Switch on 'follow text flow', if object is laid out
2682  // inside table cell and its wrapping isn't 'SURROUND_THROUGH'
2683  if (bLayoutInTableCell && eSurround != css::text::WrapTextMode_THROUGH)
2684  {
2685  SwFormatFollowTextFlow aFollowTextFlow( true );
2686  aFlySet.Put( aFollowTextFlow );
2687  }
2688 
2689  // #i21847#
2690  // Some shapes are set to *hidden*, don't import those ones.
2691  if (pRecord->bHidden)
2692  {
2693  // remove old object from the Z-Order list
2694  m_xMSDffManager->RemoveFromShapeOrder(pObject);
2695  // and delete the object
2696  SdrObject::Free(pObject);
2697  return nullptr;
2698  }
2699 
2700  sal_uInt16 nCount = pObject->GetUserDataCount();
2701  if(nCount)
2702  {
2703  OUString lnName, aObjName, aTarFrame;
2704  for (sal_uInt16 i = 0; i < nCount; i++ )
2705  {
2706  SdrObjUserData* pData = pObject->GetUserData( i );
2707  if( pData && pData->GetInventor() == SdrInventor::ScOrSwDraw
2708  && pData->GetId() == SW_UD_IMAPDATA)
2709  {
2710  SwMacroInfo* macInf = dynamic_cast<SwMacroInfo*>(pData);
2711  if( macInf && macInf->GetShapeId() == pF->nSpId )
2712  {
2713  lnName = macInf->GetHlink();
2714  aObjName = macInf->GetName();
2715  aTarFrame = macInf->GetTarFrame();
2716  break;
2717  }
2718  }
2719  }
2720  SwFormatURL* pFormatURL = new SwFormatURL();
2721  pFormatURL->SetURL( lnName, false );
2722  if (!aObjName.isEmpty())
2723  pFormatURL->SetName(aObjName);
2724  if (!aTarFrame.isEmpty())
2725  pFormatURL->SetTargetFrameName(aTarFrame);
2726  pFormatURL->SetMap(nullptr);
2727  aFlySet.Put(*pFormatURL);
2728  }
2729 
2730  // If we are to be "below text" then we are not to be opaque
2731  // #i14045# MM If we are in a header or footer then make the object transparent
2732  // Not exactly like word but close enough for now
2733 
2734  // both flags <bBelowText> and <bDrawHell> have to be set to move object into the background.
2735  // #i46794# - it reveals that value of flag <bBelowText> can be neglected.
2736  const bool bMoveToBackgrd = pRecord->bDrawHell ||
2737  ( ( m_bIsHeader || m_bIsFooter ) && pF->nwr == 3 );
2738  if ( bMoveToBackgrd )
2739  aFlySet.Put(SvxOpaqueItem(RES_OPAQUE,false));
2740 
2741  OUString aObjName = pObject->GetName();
2742 
2743  SwFrameFormat* pRetFrameFormat = nullptr;
2744  if (bReplaceable)
2745  {
2746  // Single graphics or ole objects
2747  pRetFrameFormat = ImportReplaceableDrawables(pObject, pOurNewObject, pRecord,
2748  pF, aFlySet);
2749  }
2750  else
2751  {
2752  // Drawing objects, (e.g. ovals or drawing groups)
2753  if (pF->bRcaSimple)
2754  {
2757  }
2758 
2759  RndStdIds eAnchor = ProcessEscherAlign(pRecord, pF, aFlySet);
2760 
2761  // Should we, and is it possible to make this into a writer textbox
2762  if ((!(m_nIniFlags1 & WW8FL_NO_FLY_FOR_TXBX)) && pRecord->bReplaceByFly)
2763  {
2764  pRetFrameFormat = ConvertDrawTextToFly(pObject, pOurNewObject, pRecord,
2765  eAnchor, pF, aFlySet);
2766  if (pRetFrameFormat)
2767  bDone = true;
2768  }
2769 
2770  if (!bDone)
2771  {
2772  sw::util::SetLayer aSetLayer(m_rDoc);
2773  if ( bMoveToBackgrd )
2774  aSetLayer.SendObjectToHell(*pObject);
2775  else
2776  aSetLayer.SendObjectToHeaven(*pObject);
2777 
2778  if (!IsInlineEscherHack())
2779  {
2780  /* Need to make sure that the correct layer ordering is applied. */
2781  // pass information, if object is in page header|footer to method.
2782  m_xWWZOrder->InsertEscherObject( pObject, pF->nSpId,
2783  m_bIsHeader || m_bIsFooter );
2784  }
2785  else
2786  {
2787  m_xWWZOrder->InsertTextLayerObject(pObject);
2788  }
2789 
2790  pRetFrameFormat = m_rDoc.getIDocumentContentOperations().InsertDrawObj(*m_pPaM, *pObject, aFlySet );
2791 
2792  OSL_ENSURE(pRetFrameFormat->GetAnchor().GetAnchorId() ==
2793  eAnchor, "Not the anchor type requested!");
2794 
2795  /*
2796  Insert text if necessary into textboxes contained in groups.
2797  */
2798  for (const auto& it : aData)
2799  {
2800  pRecord = it.get();
2801  if (pRecord->pObj && pRecord->aTextId.nTxBxS)
2802  { // #i52825# pRetFrameFormat can be NULL
2803  pRetFrameFormat = MungeTextIntoDrawBox(
2804  pRecord, nGrafAnchorCp, pRetFrameFormat);
2805  }
2806  }
2807  }
2808  }
2809 
2810  // #i44344#, #i44681# - positioning attributes already set
2811  if ( pRetFrameFormat /*#i52825# */ && dynamic_cast< const SwDrawFrameFormat *>( pRetFrameFormat ) != nullptr )
2812  {
2813  static_cast<SwDrawFrameFormat*>(pRetFrameFormat)->PosAttrSet();
2814  }
2815  if (!IsInlineEscherHack())
2816  MapWrapIntoFlyFormat(pRecord, pRetFrameFormat);
2817 
2818  // Set frame name with object name
2819  if( pRetFrameFormat /*#i52825# */ && !aObjName.isEmpty() )
2820  pRetFrameFormat->SetName( aObjName );
2821  return AddAutoAnchor(pRetFrameFormat);
2822 }
2823 
2825 {
2826  /*
2827  * anchored to character at the current position will move along the
2828  * paragraph as text is added because we are at the insertion point.
2829  *
2830  * Leave to later and set the correct location then.
2831  */
2832  if (pFormat && (pFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR))
2833  {
2834  m_xAnchorStck->AddAnchor(*m_pPaM->GetPoint(), pFormat);
2835  }
2836  return pFormat;
2837 }
2838 
2840  long nGrafAnchorCp, SwFrameFormat* pRetFrameFormat)
2841 {
2842  SdrObject* pTrueObject = pRecord->pObj;
2843 
2844  SdrTextObj* pSdrTextObj;
2845 
2846  // check for group object (e.g. two parentheses)
2847  if (SdrObjGroup* pThisGroup = dynamic_cast<SdrObjGroup*>( pRecord->pObj) )
2848  {
2849  // Group objects don't have text. Insert a text object into
2850  // the group for holding the text.
2851  pSdrTextObj = new SdrRectObj(
2852  *m_pDrawModel,
2853  OBJ_TEXT,
2854  pThisGroup->GetCurrentBoundRect());
2855 
2856  SfxItemSet aSet(m_pDrawModel->GetItemPool());
2857  aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
2858  aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
2859  aSet.Put(SdrTextFitToSizeTypeItem( drawing::TextFitToSizeType_NONE ));
2860  aSet.Put(makeSdrTextAutoGrowHeightItem(false));
2861  aSet.Put(makeSdrTextAutoGrowWidthItem(false));
2862  pSdrTextObj->SetMergedItemSet(aSet);
2863  pSdrTextObj->NbcSetLayer( pThisGroup->GetLayer() );
2864  pThisGroup->GetSubList()->NbcInsertObject(pSdrTextObj);
2865  }
2866  else
2867  pSdrTextObj = dynamic_cast<SdrTextObj*>( pRecord->pObj );
2868 
2869  if( pSdrTextObj )
2870  {
2871  Size aObjSize(pSdrTextObj->GetSnapRect().GetWidth(),
2872  pSdrTextObj->GetSnapRect().GetHeight());
2873 
2874  // Object is part of a group?
2875  SdrObject* pGroupObject = pSdrTextObj->getParentSdrObjectFromSdrObject();
2876 
2877  const size_t nOrdNum = pSdrTextObj->GetOrdNum();
2878  bool bEraseThisObject;
2879  InsertTxbxText( pSdrTextObj, &aObjSize, pRecord->aTextId.nTxBxS,
2880  pRecord->aTextId.nSequence, nGrafAnchorCp, pRetFrameFormat,
2881  (pSdrTextObj != pTrueObject) || (nullptr != pGroupObject),
2882  bEraseThisObject, nullptr, nullptr, nullptr, nullptr, pRecord);
2883 
2884  // was this object replaced ??
2885  if (bEraseThisObject)
2886  {
2887  if( pGroupObject || (pSdrTextObj != pTrueObject) )
2888  {
2889  // Object is already replaced by a new SdrGrafObj (in the group
2890  // and) the Drawing-Page.
2891 
2892  SdrObject* pNewObj = pGroupObject ?
2893  pGroupObject->GetSubList()->GetObj(nOrdNum) : pTrueObject;
2894  if (pSdrTextObj != pNewObj)
2895  {
2896  // Replace object in the Z-Order-List
2897  m_xMSDffManager->ExchangeInShapeOrder(pSdrTextObj, 0, pNewObj);
2898  // now delete object
2899  SdrObject::Free( pRecord->pObj );
2900  // and save the new object.
2901  pRecord->pObj = pNewObj;
2902  }
2903  }
2904  else
2905  {
2906  // remove the object from Z-Order list
2907  m_xMSDffManager->RemoveFromShapeOrder( pSdrTextObj );
2908  // take the object from the drawing page
2909  if( pSdrTextObj->getSdrPageFromSdrObject() )
2910  m_pDrawPg->RemoveObject( pSdrTextObj->GetOrdNum() );
2911  // and delete FrameFormat, because replaced by graphic
2912  // (this also deletes the object)
2913  m_rDoc.DelFrameFormat( pRetFrameFormat );
2914  pRetFrameFormat = nullptr;
2915  // also delete the object record
2916  pRecord->pObj = nullptr;
2917  }
2918  }
2919  else
2920  {
2921  // use ww8-default border distance
2922  SfxItemSet aItemSet(m_pDrawModel->GetItemPool(),
2924  aItemSet.Put( makeSdrTextLeftDistItem( pRecord->nDxTextLeft ) );
2925  aItemSet.Put( makeSdrTextRightDistItem( pRecord->nDxTextRight ) );
2926  aItemSet.Put( makeSdrTextUpperDistItem( pRecord->nDyTextTop ) );
2927  aItemSet.Put( makeSdrTextLowerDistItem( pRecord->nDyTextBottom ) );
2928  pSdrTextObj->SetMergedItemSetAndBroadcast(aItemSet);
2929  }
2930  }
2931  return pRetFrameFormat;
2932 }
2933 
2935  SdrObject* &rpOurNewObject, SvxMSDffImportRec const * pRecord, RndStdIds eAnchor,
2936  WW8_FSPA const *pF, SfxItemSet &rFlySet)
2937 {
2938  SwFlyFrameFormat* pRetFrameFormat = nullptr;
2939  long nStartCp;
2940  long nEndCp;
2941 
2942  // Check if this textbox chain contains text as conversion of an empty
2943  // chain would not make sense.
2944  if ( TxbxChainContainsRealText(pRecord->aTextId.nTxBxS,nStartCp,nEndCp) )
2945  {
2946  // The Text is not read into SdrTextObj! Rather insert a frame and
2947  // insert the text from nStartCp to nEndCp.
2948 
2949  // More attributes can be used in a frame compared to the
2950  // Edit-Engine, and it can contain field, OLEs or graphics...
2951  tools::Rectangle aInnerDist(pRecord->nDxTextLeft, pRecord->nDyTextTop,
2952  pRecord->nDxTextRight, pRecord->nDyTextBottom);
2953 
2954  SwFormatFrameSize aFrameSize(ATT_FIX_SIZE, pF->nXaRight - pF->nXaLeft, pF->nYaBottom - pF->nYaTop);
2955  aFrameSize.SetWidthSizeType(pRecord->bAutoWidth ? ATT_VAR_SIZE : ATT_FIX_SIZE);
2956  rFlySet.Put(aFrameSize);
2957 
2958  MatchSdrItemsIntoFlySet( rpObject, rFlySet, pRecord->eLineStyle,
2959  pRecord->eLineDashing, pRecord->eShapeType, aInnerDist );
2960 
2961  SdrTextObj *pSdrTextObj = dynamic_cast<SdrTextObj*>(rpObject);
2962  if (pSdrTextObj && pSdrTextObj->IsVerticalWriting())
2963  rFlySet.Put(SvxFrameDirectionItem(SvxFrameDirection::Vertical_RL_TB, RES_FRAMEDIR));
2964 
2965  pRetFrameFormat = m_rDoc.MakeFlySection(eAnchor, m_pPaM->GetPoint(), &rFlySet);
2966  OSL_ENSURE(pRetFrameFormat->GetAnchor().GetAnchorId() == eAnchor,
2967  "Not the anchor type requested!");
2968 
2969  // if everything is OK, find pointer on new object and correct
2970  // Z-order list (or delete entry)
2971  rpOurNewObject = CreateContactObject(pRetFrameFormat);
2972 
2973  // remove old object from the Z-Order list
2974  m_xMSDffManager->RemoveFromShapeOrder( rpObject );
2975 
2976  // and delete the object
2977  SdrObject::Free( rpObject );
2978  /*
2979  NB: only query pOrgShapeObject starting here!
2980  */
2981 
2982  if (rpOurNewObject)
2983  {
2984  /*
2985  We do not store our rpOutNewObject in the ShapeOrder because we
2986  have a FrameFormat from which we can regenerate the contact object when
2987  we need it. Because, we can have frames anchored to paragraphs in
2988  header/footers and we can copy header/footers, if we do copy a
2989  header/footer with a nonpage anchored frame in it then the contact
2990  objects are invalidated. Under this condition the FrameFormat will be
2991  updated to reflect this change and can be used to get a new
2992  contact object, while a raw rpOutNewObject stored here becomes
2993  deleted and useless.
2994  */
2995  m_xMSDffManager->StoreShapeOrder(pF->nSpId,
2996  (static_cast<sal_uLong>(pRecord->aTextId.nTxBxS) << 16) +
2997  pRecord->aTextId.nSequence, nullptr, pRetFrameFormat);
2998 
2999  // The Contact object has to be inserted into the draw page, so
3000  // SwWW8ImplReader::LoadDoc1() can determine the z-order.
3001  if (!rpOurNewObject->IsInserted())
3002  {
3003  // pass information, if object is in page header|footer to method.
3004  m_xWWZOrder->InsertEscherObject( rpOurNewObject, pF->nSpId,
3005  m_bIsHeader || m_bIsFooter );
3006  }
3007  }
3008 
3009  // Box-0 receives the text for the whole chain!
3010  if( !pRecord->aTextId.nSequence )
3011  {
3012  // save flags etc and reset them
3013  WW8ReaderSave aSave( this );
3014 
3015  MoveInsideFly(pRetFrameFormat);
3016 
3017  SwNodeIndex aStart(m_pPaM->GetPoint()->nNode);
3018 
3019  m_xWWZOrder->InsideEscher(pF->nSpId);
3020 
3021  // read in the text
3022  m_bTxbxFlySection = true;
3023  bool bJoined = ReadText(nStartCp, (nEndCp-nStartCp),
3024  MAN_MAINTEXT == m_xPlcxMan->GetManType() ?
3026 
3027  m_xWWZOrder->OutsideEscher();
3028 
3029  MoveOutsideFly(pRetFrameFormat, aSave.GetStartPos(),!bJoined);
3030 
3031  aSave.Restore( this );
3032 
3033  StripNegativeAfterIndent(pRetFrameFormat);
3034  }
3035 
3036  }
3037  return pRetFrameFormat;
3038 }
3039 
3041  SfxItemSet &rFlySet)
3042 {
3043  if (rRecord.bVFlip || rRecord.bHFlip)
3044  {
3046  if (rRecord.bVFlip && rRecord.bHFlip)
3047  eType = MirrorGraph::Both;
3048  else if (rRecord.bVFlip)
3049  eType = MirrorGraph::Horizontal;
3050  else
3051  eType = MirrorGraph::Vertical;
3052  rFlySet.Put( SwMirrorGrf(eType) );
3053  }
3054 }
3055 
3057  SdrObject* &rpOurNewObject, SvxMSDffImportRec* pRecord, WW8_FSPA *pF,
3058  SfxItemSet &rFlySet )
3059 {
3060  SwFlyFrameFormat* pRetFrameFormat = nullptr;
3061  sal_Int32 nWidthTw = o3tl::saturating_sub(pF->nXaRight, pF->nXaLeft);
3062  if (0 > nWidthTw)
3063  nWidthTw = 0;
3064  sal_Int32 nHeightTw = o3tl::saturating_sub(pF->nYaBottom, pF->nYaTop);
3065  if (0 > nHeightTw)
3066  nHeightTw = 0;
3067 
3068  ProcessEscherAlign(pRecord, pF, rFlySet);
3069 
3070  rFlySet.Put(SwFormatFrameSize(ATT_FIX_SIZE, nWidthTw, nHeightTw));
3071 
3072  SfxItemSet aGrSet(m_rDoc.GetAttrPool(), svl::Items<RES_GRFATR_BEGIN, RES_GRFATR_END-1>{});
3073 
3074  if (pRecord)
3075  {
3076  // Note that the escher inner distance only seems to be honoured in
3077  // word for textboxes, not for graphics and ole objects.
3078  tools::Rectangle aInnerDist(0, 0, 0, 0);
3079 
3080  MatchSdrItemsIntoFlySet(rpObject, rFlySet, pRecord->eLineStyle,
3081  pRecord->eLineDashing, pRecord->eShapeType, aInnerDist);
3082 
3083  MatchEscherMirrorIntoFlySet(*pRecord, aGrSet);
3084  }
3085 
3086  OUString aObjectName(rpObject->GetName());
3087  if (OBJ_OLE2 == SdrObjKind(rpObject->GetObjIdentifier()))
3088  pRetFrameFormat = InsertOle(*static_cast<SdrOle2Obj*>(rpObject), rFlySet, &aGrSet);
3089  else
3090  {
3091  const SdrGrafObj *pGrf = static_cast<const SdrGrafObj*>(rpObject);
3092  bool bDone = false;
3093  if (pGrf->IsLinkedGraphic() && !pGrf->GetFileName().isEmpty())
3094  {
3095  GraphicType eType = pGrf->GetGraphicType();
3096  OUString aGrfName(
3098  INetURLObject(m_sBaseURL), pGrf->GetFileName(),
3100  // correction of fix for issue #i10939#:
3101  // One of the two conditions have to be true to insert the graphic
3102  // as a linked graphic -
3103  if (GraphicType::NONE == eType || CanUseRemoteLink(aGrfName))
3104  {
3105  pRetFrameFormat = m_rDoc.getIDocumentContentOperations().InsertGraphic(
3106  *m_pPaM, aGrfName, OUString(), nullptr,
3107  &rFlySet, &aGrSet, nullptr);
3108  bDone = true;
3109  }
3110  }
3111  if (!bDone)
3112  {
3113  const Graphic& rGraph = pGrf->GetGraphic();
3114  pRetFrameFormat = m_rDoc.getIDocumentContentOperations().InsertGraphic(
3115  *m_pPaM, OUString(), OUString(), &rGraph,
3116  &rFlySet, &aGrSet, nullptr);
3117  }
3118  }
3119 
3120  if (pRetFrameFormat)
3121  {
3122  if( pRecord )
3123  {
3124  if( OBJ_OLE2 != SdrObjKind(rpObject->GetObjIdentifier()) )
3125  SetAttributesAtGrfNode( pRecord, pRetFrameFormat, pF );
3126  }
3127  // avoid multiple occurrences of the same graphic name
3128  m_aGrfNameGenerator.SetUniqueGraphName(pRetFrameFormat, aObjectName);
3129  }
3130  // if everything is OK, determine pointer to new object and correct
3131  // Z-Order-List accordingly (or delete entry)
3132  rpOurNewObject = CreateContactObject(pRetFrameFormat);
3133 
3134  // remove old object from Z-Order-List
3135  m_xMSDffManager->RemoveFromShapeOrder( rpObject );
3136  // remove from Drawing-Page
3137  if( rpObject->getSdrPageFromSdrObject() )
3138  m_pDrawPg->RemoveObject( rpObject->GetOrdNum() );
3139 
3140  // and delete the object
3141  SdrObject::Free( rpObject );
3142  /*
3143  Warning: from now on query only pOrgShapeObject!
3144  */
3145 
3146  // add Contact-Object to the Z-Order-List and the page
3147  if (rpOurNewObject)
3148  {
3149  if (!m_bHdFtFootnoteEdn)
3150  m_xMSDffManager->StoreShapeOrder(pF->nSpId, 0, rpOurNewObject );
3151 
3152  // The Contact-Object MUST be set in the Draw-Page, so that in
3153  // SwWW8ImplReader::LoadDoc1() the Z-Order can be defined !!!
3154  if (!rpOurNewObject->IsInserted())
3155  {
3156  // pass information, if object is in page header|footer to method.
3157  m_xWWZOrder->InsertEscherObject( rpOurNewObject, pF->nSpId,
3158  m_bIsHeader || m_bIsFooter );
3159  }
3160  }
3161  return pRetFrameFormat;
3162 }
3163 
3164 void SwWW8ImplReader::GrafikCtor() // For SVDraw and VCControls and Escher
3165 {
3166  if (!m_pDrawModel)
3167  {
3168  m_rDoc.getIDocumentDrawModelAccess().GetOrCreateDrawModel(); // #i52858# - method name changed
3169  m_pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
3170  OSL_ENSURE(m_pDrawModel, "Cannot create DrawModel");
3171  m_pDrawPg = m_pDrawModel->GetPage(0);
3172 
3173  m_xMSDffManager.reset(new SwMSDffManager(*this, m_bSkipImages));
3174  m_xMSDffManager->SetModel(m_pDrawModel, 1440);
3175  /*
3176  Now the dff manager always needs a controls converter as well, but a
3177  control converter may still exist without a dffmanager.
3178  */
3179  m_xFormImpl.reset(new SwMSConvertControls(m_pDocShell, m_pPaM));
3180 
3181  m_xWWZOrder.reset(new wwZOrderer(sw::util::SetLayer(m_rDoc), m_pDrawPg,
3182  m_xMSDffManager->GetShapeOrders()));
3183  }
3184 }
3185 
3187 {
3188  m_pDrawEditEngine.reset(); // maybe created by graphic
3189  m_xWWZOrder.reset(); // same
3190 }
3191 
3193 {
3194  OSL_ENSURE(pFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR,
3195  "Don't use fltanchors with inline frames, slap!");
3196  NewAttr(rPos, SwFltAnchor(pFormat));
3197 }
3198 
3200 {
3201  size_t nCnt = size();
3202  for (size_t i=0; i < nCnt; ++i)
3203  {
3204  SwFltStackEntry &rEntry = (*this)[i];
3205  SwPosition aDummy(rEntry.m_aMkPos.m_nNode);
3206  SetAttrInDoc(aDummy, rEntry);
3207  DeleteAndDestroy(i--);
3208  --nCnt;
3209  }
3210 }
3211 
3212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void GrafikDtor()
Definition: ww8graf.cxx:3186
long Width() const
void SetTransparency(sal_uInt8 cTransparency)
sal_Int32 nXaRight
Definition: ww8struc.hxx:903
bool IsContour() const
Definition: fmtsrnd.hxx:53
sal_Int32 nDyTextBottom
simple Iterator for SPRMs
Definition: ww8scan.hxx:267
OBJ_GRAF
long mnEndPos
Definition: ww8graf.cxx:580
long GetWidth() const
sal_uInt16 nby
Definition: ww8struc.hxx:913
#define RES_GRFATR_END
Definition: hintids.hxx:258
#define RES_FRM_SIZE
Definition: hintids.hxx:194
bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength)
Definition: ww8scan.cxx:8503
sal_Int32 nStartPara
SwNoTextNode * GetNoTextNodeFromSwFrameFormat(const SwFrameFormat &rFormat)
Get the SwNoTextNode associated with a SwFrameFormat if here is one.
sal_uInt16 CalcLineWidth(SvxBoxItemLine nLine) const
SdrObject * ReadPolyLine(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:444
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
static sal_Int32 MatchSdrBoxIntoFlyBoxItem(const Color &rLineColor, MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType, sal_Int32 &rLineWidth, SvxBoxItem &rBox)
Definition: ww8graf.cxx:1577
long GetEndPos() const
Definition: ww8graf.cxx:587
constexpr::Color COL_BROWN(0x80, 0x80, 0x00)
sal_Int32 nDxWrapDistRight
long GetHeight() const
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:797
SdrObject * ReadElipse(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:383
Marks a position in the document model.
Definition: pam.hxx:35
bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, SwTwips nPageRight, SwTwips nPageSize)
Definition: wrtw8esh.cxx:540
virtual const tools::Rectangle & GetCurrentBoundRect() const
sal_uInt8 GetRed() const
WW8_DP_POLYLINE dpPolyLine
Definition: ww8struc.hxx:827
SVBT16 cb
Definition: ww8struc.hxx:707
void SetSprms(const sal_uInt8 *pSprms_, sal_Int32 nLen_)
Definition: ww8scan.cxx:878
void SetBlue(sal_uInt8 nBlue)
static void SetFill(SfxItemSet &rSet, WW8_DP_FILL &rFill)
Definition: ww8graf.cxx:255
OBJ_OLE2
void SetTransparency(sal_uInt8 nTransparency)
bool TxbxChainContainsRealText(sal_uInt16 nTxBxS, long &rStartCp, long &rEndCp)
Definition: ww8graf.cxx:1228
SdrObject * ReadCaptionBox(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1280
mso_lineDouble
void SetLeft(sal_Int32 nVal)
sal_uInt8 SVBT16[2]
void SetPosToggle(bool bNew)
Definition: fmtornt.hxx:96
WW8_DPHEAD dpheadPolyLine
Definition: ww8struc.hxx:826
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:767
sal_uInt32 nXAlign
sal_uInt8 fUp
Definition: ww8struc.hxx:790
const OUString & GetFileName() const
long AdjustX(long nHorzMove)
#define RES_HORI_ORIENT
Definition: hintids.hxx:208
SvxMSDffImportRec * find(const SdrObject *pObj)
sal_Int32 nDxTextLeft
std::string GetValue
SwNodeIndex m_nNode
Definition: fltshell.hxx:55
#define SDRATTR_GRAFMODE
SwFrameFormat * MungeTextIntoDrawBox(SvxMSDffImportRec *pRecord, long nGrafAnchorCp, SwFrameFormat *pRetFrameFormat)
Definition: ww8graf.cxx:2839
constexpr::Color COL_LIGHTGREEN(0x00, 0xFF, 0x00)
long Height() const
void ReadGrafLayer1(WW8PLCFspecial *pPF, long nGrafAnchorCp)
Definition: ww8graf.cxx:1441
static sal_Int32 lcl_ConvertCrop(sal_uInt32 const nCrop, sal_Int32 const nSize)
Definition: ww8graf.cxx:2086
#define SDRATTR_GRAFGAMMA
sal_uInt16 nbx
Definition: ww8struc.hxx:907
sal_Int32 nCropFromRight
sal_Int32 nDxWrapDistLeft
constexpr::Color COL_RED(0x80, 0x00, 0x00)
long GetWidth() const
std::enable_if< std::is_signed< T >::value, T >::type saturating_sub(T a, T b)
OBJ_TEXT
#define RES_SHADOW
Definition: hintids.hxx:212
long AdjustLeft(long nHorzMoveDelta)
void MatchSdrItemsIntoFlySet(SdrObject const *pSdrObj, SfxItemSet &aFlySet, MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType, tools::Rectangle &rInnerDist)
Definition: ww8graf.cxx:1662
#define XATTR_START
void SetDots(sal_uInt16 nNewDots)
SwTwips GetPos() const
Definition: fmtornt.hxx:92
sal_uIntPtr sal_uLong
bool IsObjectLayoutInTableCell(const sal_uInt32 nLayoutInTableCell) const
Definition: ww8graf.cxx:2447
void SetColor(const Color &rNew)
#define RES_FRAMEDIR
Definition: hintids.hxx:225
sal_uInt16 GetCurrentId() const
Definition: ww8scan.hxx:290
static void AdjustLRWrapForWordMargins(const SvxMSDffImportRec &rRecord, SvxLRSpaceItem &rLR)
Definition: ww8graf.cxx:1915
const sal_uInt8 * pMemPos
Definition: ww8scan.hxx:857
#define WW8FL_NO_GRAFLAYER
Definition: ww8par.hxx:123
#define RES_FRMATR_END
Definition: hintids.hxx:236
GraphicType
void SetAttributesAtGrfNode(SvxMSDffImportRec const *pRecord, SwFrameFormat const *pFlyFormat, WW8_FSPA const *pF)
Definition: ww8graf.cxx:2100
static sal_Int32 GetEscherLineMatch(MSO_LineStyle eStyle, MSO_SPT eShapeType, sal_Int32 &rThick)
Definition: ww8graf.cxx:1519
bool IsInserted() const
const OUString & GetTarFrame() const
Definition: ww8par.hxx:519
void InsertTxbxText(SdrTextObj *pTextObj, Size const *pObjSiz, sal_uInt16 nTxBxS, sal_uInt16 nSequence, long nPosCp, SwFrameFormat const *pFlyFormat, bool bMakeSdrGrafObj, bool &rbEraseTextObj, bool *pbTestTxbxContainsText=nullptr, long *pnStartCp=nullptr, long *pnEndCp=nullptr, bool *pbContainsGraphics=nullptr, SvxMSDffImportRec const *pRecord=nullptr)
Definition: ww8graf.cxx:1022
void SetDashLen(sal_uInt32 nNewDashLen)
void SetEndPos(long nEnd)
Definition: ww8graf.cxx:585
void Scale(double fScaleX, double fScaleY)
#define SDRATTR_SHADOWCOLOR
sal_uInt8 by
Definition: ww8struc.hxx:680
RndStdIds ProcessEscherAlign(SvxMSDffImportRec *pRecord, WW8_FSPA *pFSPA, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:2230
void SetIdx(long nI)
Definition: ww8scan.hxx:241
MirrorGraph
Definition: grfatr.hxx:31
sal_uInt16 nTxBxS
long SwTwips
Definition: swtypes.hxx:49
sal_uInt32 nYAlign
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:804
bool CanUseRemoteLink(const OUString &rGrfName)
Definition: ww8par5.cxx:2335
constexpr::Color COL_LIGHTRED(0xFF, 0x00, 0x00)
sal_Int32 nCropFromLeft
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
OBJ_POLY
sal_Int32 nXaLeft
Definition: ww8struc.hxx:901
static void Free(SdrObject *&_rpObject)
sal_Int32 nSpId
Definition: ww8struc.hxx:900
constexpr::Color COL_YELLOW(0xFF, 0xFF, 0x00)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
virtual const tools::Rectangle & GetSnapRect() const override
Frame cannot be moved in Var-direction.
Definition: fmtfsize.hxx:38
SVBT32 dlpcBg
Definition: ww8struc.hxx:732
GraphicType GetGraphicType() const
#define MIN_BORDER_DIST
Definition: swtypes.hxx:74
void SetOutside(bool bNew)
Definition: fmtsrnd.hxx:58
void SetContour(bool bNew)
Definition: fmtsrnd.hxx:57
SVBT16 xa
Definition: ww8struc.hxx:708
void SetDistance(sal_uInt32 nNewDistance)
sal_Int32 nCropFromTop
virtual SdrObjList * GetSubList() const
#define RES_FLTRATTR_BEGIN
Definition: hintids.hxx:320
OBJ_PLIN
const OUString & GetName() const
Definition: ww8par.hxx:523
WW8_DP_LINEEND aEpp
Definition: ww8struc.hxx:759
#define XATTR_FILLCOLOR
Make setting a drawing object's layer in a Writer document easy.
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
void SetRight(sal_Int32 nVal)
const int nWrap100Percent
For custom wrapping.
Definition: types.hxx:38
long AdjustBottom(long nVertMoveDelta)
Chunk(long nStart, const OUString &rURL)
Definition: ww8graf.cxx:582
const OUString & GetHlink() const
Definition: ww8par.hxx:517
virtual const tools::Rectangle & GetSnapRect() const
void SetGraphicObject(const GraphicObject &rNewObj)
constexpr::Color COL_MAGENTA(0x80, 0x00, 0x80)
mso_lineThickThin
mso_sptPictureFrame
void SetTargetFrameName(const OUString &rStr)
Definition: fmturl.hxx:61
SvxBorderLineStyle
GPOS_TILED
WW8_DP_FILL aFill
Definition: ww8struc.hxx:805
SVBT16 dpk
Definition: ww8struc.hxx:703
sal_uInt16 sal_Unicode
#define POOLATTR_END
Definition: hintids.hxx:64
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
Definition: shellio.cxx:625
long Right() const
void SetLeft(const long nL, const sal_uInt16 nProp=100)
MSO_LineDashing
MSO_SPT
SdrPage * getSdrPageFromSdrObject() const
constexpr::Color COL_LIGHTCYAN(0x00, 0xFF, 0xFF)
void setX(long nX)
#define WW8FL_NO_FLY_FOR_TXBX
Definition: ww8par.hxx:126
#define X
void advance()
Definition: ww8scan.hxx:259
SwFlyFrameFormat * ImportReplaceableDrawables(SdrObject *&rpObject, SdrObject *&rpOurNewObject, SvxMSDffImportRec *pRecord, WW8_FSPA *pF, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:3056
constexpr::Color COL_CYAN(0x00, 0x80, 0x80)
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
static void lcl_StripFields(OUString &rString, WW8_CP &rNewStartCp)
Definition: ww8graf.cxx:542
static void SetStdAttr(SfxItemSet &rSet, WW8_DP_LINETYPE &rL, WW8_DP_SHADOW const &rSh)
Definition: ww8graf.cxx:214
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2464
SdrCaptionType
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:786
#define RES_UL_SPACE
Definition: hintids.hxx:197
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
const OUString & GetURL() const
Definition: ww8graf.cxx:588
long Top() const
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
void InsertTxbxStyAttrs(SfxItemSet &rS, sal_uInt16 nColl)
Definition: ww8graf.cxx:511
sal_Int32 nEndPos
void SetMap(const ImageMap *pM)
Pointer will be copied.
Definition: atrfrm.cxx:1742
void GrafikCtor()
Definition: ww8graf.cxx:3164
void setY(long nY)
OBJ_SECT
void SetUniqueGraphName(SwFrameFormat *pFrameFormat, const OUString &rFixedPart)
Definition: ww8graf.cxx:179
sal_uInt8 GetBlue() const
SdrMetricItem makeSdrTextUpperDistItem(long mnHeight)
void SetColor(const Color &rCol)
void SetProgressState(long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:78
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
mso_lineTriple
SVBT16 ya
Definition: ww8struc.hxx:709
void Move(long nHorzMove, long nVertMove)
#define SAL_N_ELEMENTS(arr)
virtual void GetSprms(WW8PLCFxDesc *p) override
Definition: ww8scan.cxx:3378
SVBT16 dhgt
Definition: ww8struc.hxx:695
#define SDRATTR_SHADOWYDIST
ContactObject for connection between frames (or their formats respectively) in SwClient and the drawo...
Definition: dcontact.hxx:175
#define RES_BACKGROUND
Definition: hintids.hxx:210
void SendObjectToHeaven(SdrObject &rObject) const
Make Object lives in the top layer.
#define POOLATTR_BEGIN
Definition: hintids.hxx:63
const Color & GetColor() const
sal_Int32 nDxTextRight
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:799
MSO_LineDashing eLineDashing
bool IsInRange(sal_uInt16 nWhich) const
void Adjust(sal_Int32 nAdjust)
Definition: ww8graf.cxx:589
virtual void SetLayer(SdrLayerID nLayer)
void SetRight(const long nR, const sal_uInt16 nProp=100)
sal_Int32 nEndPara
OBJ_LINE
Style of a layout element.
Definition: frmfmt.hxx:57
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:776
SVBT16 cb
Definition: ww8struc.hxx:678
bool checkSeek(SvStream &rSt, sal_uInt64 nOffset)
void WW8FSPAShadowToReal(WW8_FSPA_SHADOW const *pFSPAS, WW8_FSPA *pPic)
Definition: ww8graf2.cxx:755
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
long AdjustY(long nVertMove)
mso_lineDashGEL
among others for fields, that is, the same number of attr as positions, if Ctor-Param bNoEnd = false ...
Definition: ww8scan.hxx:225
SVBT16 flpp
Definition: ww8struc.hxx:733
SwTwips MakeSafePositioningValue(SwTwips nIn)
Clips a value to MAX/MIN 16bit value to make it safe for use as a position value to give to writer...
void SetValue(EnumT nTheValue)
virtual sal_uInt16 GetObjIdentifier() const
bool GetTxbxTextSttEndCp(WW8_CP &rStartCp, WW8_CP &rEndCp, sal_uInt16 nTxBxS, sal_uInt16 nSequence)
Definition: ww8graf.cxx:805
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
sal_uInt32 GetTextLen() const
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
#define SDRATTR_SHADOWXDIST
SwFormat * m_pFormat
Definition: ww8par.hxx:223
const Graphic & GetGraphic() const
#define RES_VERT_ORIENT
Definition: hintids.hxx:207
SwFrameFormat * AddAutoAnchor(SwFrameFormat *pFormat)
Definition: ww8graf.cxx:2824
std::unique_ptr< OutlinerParaObject > ImportAsOutliner(OUString &rString, WW8_CP nStartCp, WW8_CP nEndCp, ManTypes eType)
Definition: ww8graf.cxx:969
#define EE_FEATURE_FIELD
int i
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:758
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:60
static void SetLineEndAttr(SfxItemSet &rSet, WW8_DP_LINEEND const &rLe, WW8_DP_LINETYPE const &rLt)
Definition: ww8graf.cxx:289
SdrObject * ReadRect(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:360
FlyAnchors.
Definition: fmtanchr.hxx:34
void SetWidthSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:84
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, sal_Char cFill= '\0')
SVBT16 xaOffset
Definition: ww8struc.hxx:725
#define RES_FLTRATTR_END
Definition: hintids.hxx:328
sal_Int32 indexOfAny(OUString const &rIn, sal_Unicode const *const pChars, sal_Int32 const nPos)
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
void SetRed(sal_uInt8 nRed)
float u
void MatchEscherMirrorIntoFlySet(const SvxMSDffImportRec &rRecord, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:3040
static const int RELTO_DEFAULT
long Bottom() const
SwFrameSize GetWidthSizeType() const
Definition: fmtfsize.hxx:83
void SetTop(sal_Int32 nVal)
sal_uInt32 GetOrdNum() const
#define SDRATTR_SHADOW
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:760
void Restore(SwWW8ImplReader *pRdr)
Definition: ww8par.cxx:2041
mso_lineThinThick
size
#define XATTR_LINESTYLE
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:398
bool SeekPos(long nPos)
Definition: ww8scan.cxx:2171
virtual void SetLogicRect(const tools::Rectangle &rRect)
static Color WW8TransCol(SVBT32 nWC)
Definition: ww8graf.cxx:127
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:778
Marks a node in the document model.
Definition: ndindex.hxx:31
const sal_uInt16 LN_CObjLocation
Definition: sprmids.hxx:45
sal_uInt32 nLayoutInTableCell
constexpr::Color COL_LIGHTMAGENTA(0xFF, 0x00, 0xFF)
GUIDCNamePair const aData
ManTypes
Definition: ww8scan.hxx:870
void SetDistance(sal_uInt16 nNew, SvxBoxItemLine nLine)
::basegfx::B2DPolygon getB2DPolygon() const
#define XATTR_FILLSTYLE
void SetURL(const OUString &rURL, bool bServerMap)
Definition: atrfrm.cxx:1736
sal_Int32 nDyTextTop
DocumentType const eType
GPOS_AREA
sal_Int32 GetRangeAsDrawingString(OUString &rString, long StartCp, long nEndCp, ManTypes eType)
Definition: ww8graf.cxx:902
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
#define RES_TXTATR_INETFMT
Definition: hintids.hxx:141
SfxItemPool * GetPool() const
SwFrameFormat * Read_GrafLayer(long nGrafAnchorCp)
Definition: ww8graf.cxx:2495
SVBT32 dlpcFg
Definition: ww8struc.hxx:731
long GetIMax() const
Definition: ww8scan.hxx:242
OUString msURL
Definition: ww8graf.cxx:578
static void MapWrapIntoFlyFormat(SvxMSDffImportRec const *pRecord, SwFrameFormat *pFlyFormat)
Definition: ww8graf.cxx:1983
SwFltPosition m_aMkPos
Definition: fltshell.hxx:90
OUString GetName() const
#define Y
bool ReadGrafStart(void *pData, short nDataSiz, WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:188
SdrMetricItem makeSdrShadowYDistItem(long nDist)
size_t size() const
sal_Int32 GetParagraphCount() const
#define RES_GRFATR_BEGIN
Definition: hintids.hxx:238
static void removePositions(EditEngine &rDrawEditEngine, const std::vector< sal_Int32 > &rDosLineEndDummies)
Definition: ww8graf.cxx:960
WW8_DP_FILL aFill
Definition: ww8struc.hxx:787
sal_Int32 WW8_CP
Definition: ww8struc.hxx:151
virtual SdrLayerID GetLayer() const
bool Get(WW8_CP &rStart, void *&rpValue) const
Definition: ww8scan.cxx:2237
#define RES_LR_SPACE
Definition: hintids.hxx:196
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
SVBT16 dxa
Definition: ww8struc.hxx:710
sal_uInt16 nwrk
Definition: ww8struc.hxx:927
boost::optional< sal_uInt32 > nYRelTo
static void AdjustULWrapForWordMargins(const SvxMSDffImportRec &rRecord, SvxULSpaceItem &rUL)
Definition: ww8graf.cxx:1953
sal_Int32 nSprmsLen
Definition: ww8scan.hxx:902
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:460
#define XATTR_LINEWIDTH
void SetGraphicPos(SvxGraphicPosition eNew)
SVBT16 yaEnd
Definition: ww8struc.hxx:757
SfxItemPool * GetSecondaryPool() const
SVBT16 aEndBits
Definition: ww8struc.hxx:744
sal_uInt8 GetGreen() const
SwFlyFrameFormat * ConvertDrawTextToFly(SdrObject *&rpObject, SdrObject *&rpOurNewObject, SvxMSDffImportRec const *pRecord, RndStdIds eAnchor, WW8_FSPA const *pF, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:2934
bool IsLinkedGraphic() const
void GetPCDSprms(WW8PLCFxDesc &rDesc)
Definition: ww8scan.cxx:3229
SdrObject * ReadTextBox(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1238
sal_uInt8 bx
Definition: ww8struc.hxx:679
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:788
virtual void NbcSetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject) override
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SVBT32 fc
Definition: ww8struc.hxx:671
void setClosed(bool bNew)
void SetDashes(sal_uInt16 nNewDashes)
sal_uInt16 bRcaSimple
Definition: ww8struc.hxx:933
#define XATTR_FILLBMP_TILE
#define SW_UD_IMAPDATA
Definition: ww8par.hxx:57
virtual bool IsVerticalWriting() const
mso_sptTextBox
sal_Int32 nDyWrapDistBottom
SfxItemState
long AdjustRight(long nHorzMoveDelta)
SdrObjKind
MSO_LineStyle eLineStyle
SVBT16 yaStart
Definition: ww8struc.hxx:755
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
#define WW8ITEMVALUE(ItemSet, Id, Cast)
Definition: ww8graf.cxx:1660
void advance()
Definition: ww8scan.cxx:885
unsigned char sal_uInt8
void SetWidth(sal_uInt16 nNew)
const SwNodes & GetNodes() const
Definition: ndindex.hxx:155
constexpr::Color COL_GREEN(0x00, 0x80, 0x00)
SVBT16 shdwpi
Definition: ww8struc.hxx:724
#define SDRATTR_GRAFLUMINANCE
void SetName(const OUString &rNm)
Definition: fmturl.hxx:72
SwTwips GetPos() const
Definition: fmtornt.hxx:59
sal_uInt16 GetId() const
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:259
void SetGreen(sal_uInt8 nGreen)
sal_uInt16 nSprmId
Definition: ww8scan.hxx:858
#define SAL_INFO(area, stream)
#define RES_OPAQUE
Definition: hintids.hxx:204
const SfxItemSet & GetMergedItemSet() const
void SetLocation(SvxShadowLocation eNew)
SfxItemPool * GetMasterPool() const
SdrObjUserData * GetUserData(sal_uInt16 nNum) const
SvxBoxItemLine
iterator for Piece Table Exceptions of Fkps works on CPs (high-level)
Definition: ww8scan.hxx:633
MSO_LineStyle
WW8_DP_FILL aFill
Definition: ww8struc.hxx:766
void InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, ManTypes eType, bool bONLYnPicLocFc=false)
Definition: ww8graf.cxx:609
const sal_uInt8 * GetCurrentParams() const
Definition: ww8scan.hxx:289
sal_Int32 nCropFromBottom
void QuickDelete(const ESelection &rSel)
long AdjustTop(long nVertMoveDelta)
SdrObject * CreateContactObject(SwFrameFormat *pFlyFormat)
Definition: ww8graf.cxx:2201
WW8_DP_TXTBOX dptxbx
Definition: ww8struc.hxx:825
virtual long GetRotateAngle() const
SdrObject * ReadGrafPrimitive(short &rLeft, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1384
SdrOnOffItem makeSdrShadowItem(bool bShadow)
std::unique_ptr< tools::Polygon > pWrapPolygon
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
SdrMetricItem makeSdrTextLeftDistItem(long mnHeight)
SVBT16 xaStart
Definition: ww8struc.hxx:754
sal_uInt16 GetUserDataCount() const
long Left() const
SdrObject * getParentSdrObjectFromSdrObject() const
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:93
constexpr::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
SVBT16 xaEnd
Definition: ww8struc.hxx:756
const sal_Int32 & GetShapeId() const
Definition: ww8par.hxx:521
WW8_DP_FILL aFill
Definition: ww8struc.hxx:777
SVBT16 dya
Definition: ww8struc.hxx:711
#define RES_BOX
Definition: hintids.hxx:211
SdrMetricItem makeSdrTextRightDistItem(long mnHeight)
SdrObject * ReadArc(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:407
#define XATTR_FILLBITMAP
sal_Int32 nDyWrapDistTop
#define SDRATTR_TEXT_AUTOGROWHEIGHT
#define SAL_WARN(area, stream)
SdrObject * ReadLine(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:325
#define SDRATTR_GRAFCONTRAST
WW8_DP_FILL aFill
Definition: ww8struc.hxx:798
RndStdIds
void SendObjectToHell(SdrObject &rObject) const
Make Object live in the bottom drawing layer.
constexpr::Color COL_BLUE(0x00, 0x00, 0x80)
#define XATTR_LINECOLOR
SdrObject * pObj
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
sal_uInt16 nwr
Definition: ww8struc.hxx:918
boost::optional< sal_uInt32 > nXRelTo
long mnStartPos
Definition: ww8graf.cxx:579
#define XATTR_END
bool m_bColl
Definition: ww8par.hxx:245
const SwPosition & GetStartPos() const
Definition: ww8par.hxx:619
SVBT16 yaOffset
Definition: ww8struc.hxx:726
SVBT16 aStartBits
Definition: ww8struc.hxx:738
WW8_DPHEAD dpheadTxbx
Definition: ww8struc.hxx:824
sal_Int32 nYaBottom
Definition: ww8struc.hxx:904
long GetHeight() const
sal_Int32 WW8_FC
Definition: ww8struc.hxx:150
SdrObject * ReadGroup(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1347
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
SdrMetricItem makeSdrTextLowerDistItem(long mnHeight)
sal_uInt16 nSequence
SdrInventor GetInventor() const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
mso_lineSimple
#define RES_FRMATR_BEGIN
Definition: hintids.hxx:192
void AddAnchor(const SwPosition &rPos, SwFrameFormat *pFormat)
Definition: ww8graf.cxx:3192
static std::vector< sal_Int32 > replaceDosLineEndsButPreserveLength(OUString &rIn)
Definition: ww8graf.cxx:934
Frame is variable in Var-direction.
Definition: fmtfsize.hxx:37
const sal_uInt8 * pMemPos
Definition: ww8scan.hxx:883
static ESelection GetESelection(EditEngine const &rDrawEditEngine, long nCpStart, long nCpEnd)
Definition: ww8graf.cxx:482
sal_Int32 nYaTop
Definition: ww8struc.hxx:902
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:137
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:765
long GetStartPos() const
Definition: ww8graf.cxx:586
virtual void SetVerticalWriting(bool bVertical)
sal_uInt16 Which() const
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2686
void SetBottom(sal_Int32 nVal)
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:807
mso_lineDotGEL
const sal_uInt8 * GetSprms() const
Definition: ww8scan.hxx:287
SdrMetricItem makeSdrShadowXDistItem(long nDist)
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1486
#define XATTR_FILLTRANSPARENCE
OBJ_CIRC
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
virtual const SdrObject * GetMaster() const override
Definition: dcontact.hxx:194
SvxShadowLocation
virtual void NbcSetLayer(SdrLayerID nLayer)
sal_Int32 nStartPos
sal_uInt8 fLeft
Definition: ww8struc.hxx:789
bool MiserableRTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, sal_Int16 eHoriOri, sal_Int16 eHoriRel)
Definition: ww8graf.cxx:2219