LibreOffice Module sw (master)  1
wrtw8esh.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 <memory>
21 #include <com/sun/star/embed/Aspects.hpp>
22 
23 #include <hintids.hxx>
24 
25 #include <o3tl/any.hxx>
26 #include <com/sun/star/drawing/XShape.hpp>
27 #include <vcl/svapp.hxx>
28 #include <sot/storage.hxx>
29 #include <svl/itemiter.hxx>
30 #include <svl/stritem.hxx>
31 #include <svl/whiter.hxx>
32 #include <svx/svdobj.hxx>
33 #include <svx/svdotext.hxx>
34 #include <svx/svdpage.hxx>
35 #include <editeng/outlobj.hxx>
36 #include <editeng/editobj.hxx>
37 #include <editeng/brushitem.hxx>
38 #include <editeng/boxitem.hxx>
39 #include <editeng/lrspitem.hxx>
40 #include <editeng/ulspitem.hxx>
41 #include <editeng/fontitem.hxx>
42 #include <editeng/frmdiritem.hxx>
43 #include <editeng/flditem.hxx>
44 #include <editeng/shaditem.hxx>
45 #include <editeng/eeitem.hxx>
47 #include <svx/svdouno.hxx>
48 #include <svx/unoapi.hxx>
49 #include <svx/svdview.hxx>
50 #include <svx/unopage.hxx>
51 #include <fmtcnct.hxx>
52 #include <fmtanchr.hxx>
53 #include <fmtsrnd.hxx>
54 #include <fmtornt.hxx>
55 #include <fmtfsize.hxx>
56 #include <fmtfollowtextflow.hxx>
57 #include <frmfmt.hxx>
58 #include <fmtcntnt.hxx>
59 #include <ndindex.hxx>
60 #include <doc.hxx>
61 #include <drawdoc.hxx>
64 #include <pam.hxx>
65 #include <swrect.hxx>
66 #include <ndgrf.hxx>
67 #include <grfatr.hxx>
68 #include <ndole.hxx>
69 #include <pagedesc.hxx>
70 #include <poolfmt.hxx>
71 #include "ww8par.hxx"
72 #include <breakit.hxx>
73 #include <com/sun/star/i18n/XBreakIterator.hpp>
74 #include <com/sun/star/lang/XServiceInfo.hpp>
75 #include "attributeoutputbase.hxx"
76 #include "writerhelper.hxx"
77 #include "writerwordglue.hxx"
78 #include "wrtww8.hxx"
79 #include "escher.hxx"
80 #include <ndtxt.hxx>
81 #include "WW8FFData.hxx"
82 #include <com/sun/star/beans/XPropertySet.hpp>
83 #include <com/sun/star/form/XFormComponent.hpp>
85 #include <oox/ole/olehelper.hxx>
86 #include <fmturl.hxx>
87 #include <frameformats.hxx>
88 #include <sfx2/sfxsids.hrc>
89 #include <unotools/saveopt.hxx>
90 #include <o3tl/enumrange.hxx>
91 #include <o3tl/enumarray.hxx>
92 #include <sfx2/docfile.hxx>
93 
94 #include <algorithm>
95 
96 using ::editeng::SvxBorderLine;
97 using namespace com::sun::star;
98 using namespace sw::util;
99 using namespace sw::types;
100 using ::com::sun::star::beans::XPropertySet;
101 using ::com::sun::star::drawing::XShape;
102 
104 {
105  SvtSaveOptions aSaveOpt;
106  bool bRelUrl = false;
107  SfxMedium * pMedium = rWrt.GetWriter().GetMedia();
108  if ( pMedium )
109  bRelUrl = pMedium->IsRemote() ? aSaveOpt.IsSaveRelINet() : aSaveOpt.IsSaveRelFSys();
110  return bRelUrl;
111 }
112 
114 {
115  OUString sDocUrl;
116  SfxMedium * pMedium = rWrt.GetWriter().GetMedia();
117  if (pMedium)
118  {
119  const SfxItemSet* pPItemSet = pMedium->GetItemSet();
120  if( pPItemSet )
121  {
122  const SfxStringItem* pPItem = dynamic_cast< const SfxStringItem* >( pPItemSet->GetItem( SID_FILE_NAME ) );
123  if ( pPItem )
124  sDocUrl = pPItem->GetValue();
125  }
126  }
127 
128  return sDocUrl.copy(0, sDocUrl.lastIndexOf('/') + 1);
129 }
130 
131 OUString SwBasicEscherEx::BuildFileName(sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl)
132 {
133  OUString aDosName( INetURLObject( rUrl ).getFSysPath( FSysStyle::Dos ) );
134  rnLevel = 0;
135  rbRel = IsRelUrl();
136 
137  if (rbRel)
138  {
139  // try to convert to relative file name
140  OUString aTmpName( aDosName );
141  aDosName = INetURLObject::GetRelURL( GetBasePath(), rUrl,
143 
144  if (aDosName.startsWith(INET_FILE_SCHEME))
145  {
146  // not converted to rel -> back to old, return absolute flag
147  aDosName = aTmpName;
148  rbRel = false;
149  }
150  else if (aDosName.startsWith("./"))
151  {
152  aDosName = aDosName.copy(2);
153  }
154  else
155  {
156  while (aDosName.startsWith("../"))
157  {
158  ++rnLevel;
159  aDosName = aDosName.copy(3);
160  }
161  }
162  }
163  return aDosName;
164 }
165 
167 {
168  if ( !pINetFormatArg ) return;
169 
170  const sal_uInt8 aGuidStdLink[ 16 ] ={
171  0xD0, 0xC9, 0xEA, 0x79, 0xF9, 0xBA, 0xCE, 0x11, 0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B };
172  const sal_uInt8 aGuidUrlMoniker[ 16 ] = {
173  0xE0, 0xC9, 0xEA, 0x79, 0xF9, 0xBA, 0xCE, 0x11, 0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B };
174 
175  const sal_uInt8 aGuidFileMoniker[ 16 ] = {
176  0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 };
177  const sal_uInt8 aGuidFileTail[] = {
178  0xFF, 0xFF, 0xAD, 0xDE, 0x00, 0x00, 0x00, 0x00,
179  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
180  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
181  };
182  //const sal_uInt18 WW8_ID_HLINK = 0x01B8;
183  constexpr sal_uInt32 WW8_HLINK_BODY = 0x00000001;
184  constexpr sal_uInt32 WW8_HLINK_ABS = 0x00000002;
185  //const sal_uInt32 WW8_HLINK_DESCR = 0x00000014; /// Description.
186  constexpr sal_uInt32 WW8_HLINK_MARK = 0x00000008;
187  constexpr sal_uInt32 WW8_HLINK_FRAME = 0x00000080;
188  //const sal_uInt32 WW8_HLINK_UNC = 0x00000100; /// UNC path.
189  SvMemoryStream tmpStrm;
190  OUString tmpTextMark;
191 
192  OUString rUrl = pINetFormatArg->GetURL();
193  OUString rTarFrame = pINetFormatArg->GetTargetFrameName();
194  sal_uInt32 nFlags = 0;
195 
196  INetURLObject aUrlObj( rUrl );
197  const INetProtocol eProtocol = aUrlObj.GetProtocol();
198 
199  //Target Frame
200  if (!rTarFrame.isEmpty())
201  {
202  SwWW8Writer::WriteLong(tmpStrm, rTarFrame.getLength()+1);
203  SwWW8Writer::WriteString16(tmpStrm, rTarFrame, false);
204 
205  tmpStrm.WriteUInt16( 0 );
206 
207  nFlags |= WW8_HLINK_FRAME;
208  }
209 
210  // file link or URL
211  if (eProtocol == INetProtocol::File || (eProtocol == INetProtocol::NotValid && rUrl[0] != '#'))
212  {
213  sal_uInt16 nLevel;
214  bool bRel;
215  OUString aFileName( BuildFileName( nLevel, bRel, rUrl ));
216 
217  if( !bRel )
218  nFlags |= WW8_HLINK_ABS;
219 
220  nFlags |= WW8_HLINK_BODY;
221 
222  tmpStrm.WriteBytes(aGuidFileMoniker, sizeof(aGuidFileMoniker));
223  tmpStrm.WriteUInt16( nLevel );
224  SwWW8Writer::WriteLong(tmpStrm, aFileName.getLength()+1);
225  SwWW8Writer::WriteString8( tmpStrm, aFileName, true, RTL_TEXTENCODING_MS_1252 );
226  tmpStrm.WriteBytes(aGuidFileTail, sizeof(aGuidFileTail));
227 
228  //For UNICODE
229  SwWW8Writer::WriteLong(tmpStrm, 2*aFileName.getLength()+6);
230  SwWW8Writer::WriteLong(tmpStrm, 2*aFileName.getLength());
231  tmpStrm.WriteUInt16( 0x0003 );
232  SwWW8Writer::WriteString16(tmpStrm, aFileName, false);
233  }
234  else if( eProtocol != INetProtocol::NotValid )
235  {
236  tmpStrm.WriteBytes(aGuidUrlMoniker, sizeof(aGuidUrlMoniker));
237  SwWW8Writer::WriteLong(tmpStrm, 2*(rUrl.getLength()+1));
238 
239  SwWW8Writer::WriteString16(tmpStrm, rUrl, true);
240  nFlags |= WW8_HLINK_BODY | WW8_HLINK_ABS;
241  }
242  else if (rUrl[0] == '#' )
243  {
244  OUString aTextMark(rUrl.copy( 1 ));
245  aTextMark = aTextMark.replaceFirst(".", "!");
246  tmpTextMark = aTextMark;
247  }
248 
249  if (tmpTextMark.isEmpty() && aUrlObj.HasMark())
250  {
251  tmpTextMark = aUrlObj.GetMark();
252  }
253 
254  if (!tmpTextMark.isEmpty())
255  {
256  SwWW8Writer::WriteLong(tmpStrm, tmpTextMark.getLength()+1);
257  SwWW8Writer::WriteString16(tmpStrm, tmpTextMark, true);
258 
259  nFlags |= WW8_HLINK_MARK;
260  }
261 
262  rStrm.WriteBytes(aGuidStdLink, 16);
263  rStrm .WriteUInt32( 2 )
264  .WriteUInt32( nFlags );
265  tmpStrm.Seek( STREAM_SEEK_TO_BEGIN );
266  sal_uInt32 const nLen = tmpStrm.remainingSize();
267  if(nLen >0)
268  {
269  std::unique_ptr<sal_uInt8[]> pBuffer( new sal_uInt8[ nLen ] );
270  tmpStrm.ReadBytes(pBuffer.get(), nLen);
271  rStrm.WriteBytes(pBuffer.get(), nLen);
272  }
273 }
275 {
276  const SfxPoolItem* pItem;
277  const SwAttrSet& rAttrSet = rFormat.GetAttrSet();
278  if (SfxItemState::SET != rAttrSet.GetItemState(RES_URL, true, &pItem))
279  return;
280 
281  const SwFormatURL *pINetFormat = dynamic_cast<const SwFormatURL*>(pItem);
282  if (!pINetFormat || pINetFormat->GetURL().isEmpty())
283  return;
284 
285  SvMemoryStream aStrm;
286  WriteHyperlinkWithinFly( aStrm, pINetFormat );
287  rPropOpt.AddOpt(ESCHER_Prop_pihlShape, true, 0, aStrm);
288  sal_uInt32 nValue;
289  OUString aNamestr = pINetFormat->GetName();
290  if (!aNamestr.isEmpty())
291  {
292  rPropOpt.AddOpt(ESCHER_Prop_wzName, aNamestr );
293  }
294  if(rPropOpt.GetOpt( ESCHER_Prop_fPrint, nValue))
295  {
296  nValue|=0x03080008;
297  rPropOpt.AddOpt(ESCHER_Prop_fPrint, nValue );
298  }
299  else
300  rPropOpt.AddOpt(ESCHER_Prop_fPrint, 0x03080008 );
301 }
302 
303 namespace
304 {
309  sal_uLong lcl_getSdrOrderNumber(const WW8Export& rWrt, DrawObj const *pObj)
310  {
311  return rWrt.GetSdrOrdNum(pObj->maContent.GetFrameFormat());
312  };
313 
316  class CompareDrawObjs
317  {
318  private:
319  const WW8Export& wrt;
320 
321  public:
322  explicit CompareDrawObjs(const WW8Export& rWrt) : wrt(rWrt) {};
323  bool operator()(DrawObj const *a, DrawObj const *b) const
324  {
325  sal_uLong aSort = lcl_getSdrOrderNumber(wrt, a);
326  sal_uLong bSort = lcl_getSdrOrderNumber(wrt, b);
327  return aSort < bSort;
328  }
329  };
330 
335  void lcl_makeZOrderArray(const WW8Export& rWrt,
336  std::vector<DrawObj> &rSrcArr,
337  std::vector<DrawObj*> &rDstArr)
338  {
339  rDstArr.clear();
340  rDstArr.reserve(rSrcArr.size());
341  for(DrawObj & i : rSrcArr)
342  {
343  rDstArr.push_back( &i );
344  }
345  std::sort(rDstArr.begin(), rDstArr.end(), CompareDrawObjs(rWrt));
346  }
347 
348 }
349 
350 // get a part fix for this type of element
352 {
353  const SdrObject *pObject = rFrameFormat.FindRealSdrObject();
354  if (!pObject || pObject->GetObjInventor() != SdrInventor::FmForm)
355  return false;
356 
357  const SdrUnoObj *pFormObj = dynamic_cast< const SdrUnoObj* >(pObject);
358  if (!pFormObj)
359  return false;
360 
361  uno::Reference< awt::XControlModel > xControlModel =
362  pFormObj->GetUnoControlModel();
363  uno::Reference< lang::XServiceInfo > xInfo(xControlModel,
364  uno::UNO_QUERY);
365  uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY);
366  if (!xInfo.is())
367  return false;
368 
369  if (xInfo->supportsService("com.sun.star.form.component.ComboBox"))
370  {
371  DoComboBox(xPropSet);
372  return true;
373  }
374 
375  return false;
376 }
377 
378 void WW8Export::DoComboBox(uno::Reference<beans::XPropertySet> const & xPropSet)
379 {
380  OUString sSelected;
381  uno::Sequence<OUString> aListItems;
382  xPropSet->getPropertyValue("StringItemList") >>= aListItems;
383  if (aListItems.hasElements())
384  {
385  uno::Any aTmp = xPropSet->getPropertyValue("DefaultText");
386  auto pStr = o3tl::tryAccess<OUString>(aTmp);
387  if (pStr)
388  sSelected = *pStr;
389  }
390 
391  OUString sName;
392  {
393  uno::Any aTmp = xPropSet->getPropertyValue("Name");
394  auto pStr = o3tl::tryAccess<OUString>(aTmp);
395  if (pStr)
396  sName = *pStr;
397  }
398 
399  OUString sHelp;
400  {
401  // property "Help" does not exist and due to the no-existence an exception is thrown.
402  try
403  {
404  uno::Any aTmp = xPropSet->getPropertyValue("HelpText");
405  auto pStr = o3tl::tryAccess<OUString>(aTmp);
406  if (pStr)
407  sHelp = *pStr;
408  }
409  catch( const uno::Exception& )
410  {}
411  }
412 
413  OUString sToolTip;
414  {
415  uno::Any aTmp = xPropSet->getPropertyValue("Name");
416  auto pStr = o3tl::tryAccess<OUString>(aTmp);
417  if (pStr)
418  sToolTip = *pStr;
419  }
420 
421  DoComboBox(sName, sHelp, sToolTip, sSelected, aListItems);
422 }
423 
424 void WW8Export::DoComboBox(const OUString &rName,
425  const OUString &rHelp,
426  const OUString &rToolTip,
427  const OUString &rSelected,
428  const uno::Sequence<OUString> &rListItems)
429 {
430  OutputField(nullptr, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
432  // write the reference to the "picture" structure
433  sal_uLong nDataStt = pDataStrm->Tell();
434  m_pChpPlc->AppendFkpEntry( Strm().Tell() );
435 
436  WriteChar( 0x01 );
437 
438  static sal_uInt8 aArr1[] =
439  {
440  0x03, 0x6a, 0,0,0,0, // sprmCPicLocation
441  0x06, 0x08, 0x01, // sprmCFData
442  0x55, 0x08, 0x01, // sprmCFSpec
443  0x02, 0x08, 0x01 // sprmCFFieldVanish
444  };
445  sal_uInt8* pDataAdr = aArr1 + 2;
446  Set_UInt32( pDataAdr, nDataStt );
447 
448  m_pChpPlc->AppendFkpEntry(Strm().Tell(), sizeof(aArr1), aArr1);
449 
450  OutputField(nullptr, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
452 
453  ::sw::WW8FFData aFFData;
454 
455  aFFData.setType(2);
456  aFFData.setName(rName);
457  aFFData.setHelp(rHelp);
458  aFFData.setStatus(rToolTip);
459 
460  sal_uInt32 nListItems = rListItems.getLength();
461 
462  for (sal_uInt32 i = 0; i < nListItems; i++)
463  {
464  if (i < 0x20 && rSelected == rListItems[i])
465  aFFData.setResult(::sal::static_int_cast<sal_uInt8>(i));
466  aFFData.addListboxEntry(rListItems[i]);
467  }
468 
469  aFFData.Write(pDataStrm);
470 }
471 
473 {
474  OutputField(nullptr, ww::eFORMTEXT, FieldString(ww::eFORMTEXT),
476  // write the reference to the "picture" structure
477  sal_uLong nDataStt = pDataStrm->Tell();
478  m_pChpPlc->AppendFkpEntry( Strm().Tell() );
479 
480  WriteChar( 0x01 );
481  static sal_uInt8 aArr1[] = {
482  0x02, 0x08, 0x81, // sprmCFFieldVanish
483  0x03, 0x6a, 0,0,0,0, // sprmCPicLocation
484 
485  0x06, 0x08, 0x01, // sprmCFData
486  0x55, 0x08, 0x01 // sprmCFSpec
487  };
488  sal_uInt8* pDataAdr = aArr1 + 5;
489  Set_UInt32( pDataAdr, nDataStt );
490 
491  m_pChpPlc->AppendFkpEntry(Strm().Tell(),
492  sizeof( aArr1 ), aArr1 );
493 
494  ::sw::WW8FFData aFFData;
495 
496  aFFData.setType(0);
497  aFFData.setName(pField->GetPar2());
498  aFFData.setHelp(pField->GetHelp());
499  aFFData.setStatus(pField->GetToolTip());
500  aFFData.Write(pDataStrm);
501 
502  OutputField(nullptr, ww::eFORMTEXT, OUString(), FieldFlags::CmdEnd);
503 
504  const OUString fieldStr( pField->ExpandField(true, nullptr) );
505  SwWW8Writer::WriteString16(Strm(), fieldStr, false);
506 
507  static sal_uInt8 aArr2[] = {
508  0x55, 0x08, 0x01, // sprmCFSpec
509  0x75, 0x08, 0x01 // ???
510  };
511 
512  pDataAdr = aArr2 + 2;
513  Set_UInt32( pDataAdr, nDataStt );
514  m_pChpPlc->AppendFkpEntry(Strm().Tell(),
515  sizeof( aArr2 ), aArr2 );
516 
517  OutputField(nullptr, ww::eFORMTEXT, OUString(), FieldFlags::Close);
518 }
519 
521 {
522 }
523 
524 //It's irritating to have to change the RTL frames position into LTR ones
525 //so that word will have to place them in the right place. Doubly so that
526 //the SO drawings and writer frames have different ideas themselves as to
527 //how to be positioned when in RTL mode!
528 bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth,
529 sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft,
530  SwTwips nPageRight, SwTwips nPageSize)
531 {
532  bool bRet = false;
533  if (eHoriOri == text::HoriOrientation::NONE)
534  {
535  if (eHoriRel == text::RelOrientation::PAGE_FRAME)
536  {
537  rLeft = nPageSize - rLeft;
538  bRet = true;
539  }
540  else if (
541  (eHoriRel == text::RelOrientation::PAGE_PRINT_AREA) ||
542  (eHoriRel == text::RelOrientation::FRAME) ||
543  (eHoriRel == text::RelOrientation::PRINT_AREA)
544  )
545  {
546  rLeft = nPageSize - nPageLeft - nPageRight - rLeft;
547  bRet = true;
548  }
549  }
550  if (bRet)
551  rLeft -= nWidth;
552  return bRet;
553 }
554 
555 static bool RTLDrawingsHack(SwTwips &rLeft,
556  sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft,
557  SwTwips nPageRight, SwTwips nPageSize)
558 {
559  bool bRet = false;
560  if (eHoriOri == text::HoriOrientation::NONE)
561  {
562  if (eHoriRel == text::RelOrientation::PAGE_FRAME)
563  {
564  rLeft = nPageSize + rLeft;
565  bRet = true;
566  }
567  else if (
568  (eHoriRel == text::RelOrientation::PAGE_PRINT_AREA) ||
569  (eHoriRel == text::RelOrientation::FRAME) ||
570  (eHoriRel == text::RelOrientation::PRINT_AREA)
571  )
572  {
573  rLeft = nPageSize - nPageLeft - nPageRight + rLeft;
574  bRet = true;
575  }
576  }
577  return bRet;
578 }
579 
581  const ww8::Frame &rFrameFormat)
582 {
583  //Require nasty bidi swap
584  if (SvxFrameDirection::Horizontal_RL_TB != m_rDoc.GetTextDirection(rFrameFormat.GetPosition()))
585  return;
586 
587  SwTwips nWidth = rRight - rLeft;
588  SwTwips nPageLeft, nPageRight;
589  SwTwips nPageSize = CurrentPageWidth(nPageLeft, nPageRight);
590 
591  const SwFormatHoriOrient& rHOr = rFrameFormat.GetFrameFormat().GetHoriOrient();
592 
593  bool bRet = false;
594  ww8::Frame::WriterSource eSource = rFrameFormat.GetWriterType();
595  if (eSource == ww8::Frame::eDrawing || eSource == ww8::Frame::eFormControl)
596  {
597  if (RTLDrawingsHack(rLeft, rHOr.GetHoriOrient(),
598  rHOr.GetRelationOrient(), nPageLeft, nPageRight, nPageSize))
599  {
600  bRet = true;
601  }
602  }
603  else
604  {
605  if (RTLGraphicsHack(rLeft, nWidth, rHOr.GetHoriOrient(),
606  rHOr.GetRelationOrient(), nPageLeft, nPageRight, nPageSize))
607  {
608  bRet = true;
609  }
610  }
611  if (bRet)
612  rRight = rLeft + nWidth;
613 }
614 
615 void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
616 {
617  if (8 > rWrt.pFib->m_nVersion) // Cannot export drawobject in vers 7-
618  return;
619 
620  sal_uInt32 nFcStart = rWrt.pTableStrm->Tell();
621 
622  if (maDrawObjs.empty())
623  return;
624 
625  // write CPs
626  WW8Fib& rFib = *rWrt.pFib;
627  WW8_CP nCpOffs = GetCpOffset(rFib);
628 
629  for (const auto& rDrawObj : maDrawObjs)
630  SwWW8Writer::WriteLong(*rWrt.pTableStrm, rDrawObj.mnCp - nCpOffs);
631 
633  rFib.m_ccpHdr + rFib.m_ccpEdn + rFib.m_ccpTxbx + rFib.m_ccpHdrTxbx + 1);
634 
635  for (const auto& rDrawObj : maDrawObjs)
636  {
637  // write the fspa-struct
638  const ww8::Frame &rFrameFormat = rDrawObj.maContent;
639  const SwFrameFormat &rFormat = rFrameFormat.GetFrameFormat();
640  const SdrObject* pObj = rFormat.FindRealSdrObject();
641 
642  tools::Rectangle aRect;
643  SwFormatVertOrient rVOr = rFormat.GetVertOrient();
644  SwFormatHoriOrient rHOr = rFormat.GetHoriOrient();
645  // #i30669# - convert the positioning attributes.
646  // Most positions are converted, if layout information exists.
647  const bool bPosConverted =
648  WinwordAnchoring::ConvertPosition( rHOr, rVOr, rFormat );
649 
650  Point aObjPos;
651  bool bHasHeightWidthSwapped(false);
652  if (RES_FLYFRMFMT == rFormat.Which())
653  {
654  SwRect aLayRect(rFormat.FindLayoutRect(false, &aObjPos));
655  // the Object is not visible - so get the values from
656  // the format. The Position may not be correct.
657  if( aLayRect.IsEmpty() )
658  aRect.SetSize( rFormat.GetFrameSize().GetSize() );
659  else
660  {
661  // #i56090# Do not only consider the first client
662  // Note that we actually would have to find the maximum size of the
663  // frame format clients. However, this already should work in most cases.
664  const SwRect aSizeRect(rFormat.FindLayoutRect());
665  if ( aSizeRect.Width() > aLayRect.Width() )
666  aLayRect.Width( aSizeRect.Width() );
667 
668  aRect = aLayRect.SVRect();
669  }
670  }
671  else
672  {
673  OSL_ENSURE(pObj, "Where is the SDR-Object?");
674  if (pObj)
675  {
676  aRect = pObj->GetLogicRect();
677 
678  // rotating to vertical means swapping height and width as seen in SvxMSDffManager::ImportShape
679  const Degree100 nAngle = NormAngle36000( pObj->GetRotateAngle() );
680  const bool bAllowSwap = pObj->GetObjIdentifier() != OBJ_LINE && pObj->GetObjIdentifier() != OBJ_GRUP;
681  if ( bAllowSwap && (( nAngle > 4500_deg100 && nAngle <= 13500_deg100 ) || ( nAngle > 22500_deg100 && nAngle <= 31500_deg100 )) )
682  {
683  const tools::Long nWidth = aRect.getWidth();
684  const tools::Long nHeight = aRect.getHeight();
685  aRect.setWidth( nHeight );
686  aRect.setHeight( nWidth );
687  bHasHeightWidthSwapped = true;
688  }
689  }
690  }
691 
692  // #i30669# - use converted position, if conversion is performed.
693  // Unify position determination of Writer fly frames
694  // and drawing objects.
695  if ( bPosConverted )
696  {
697  aRect.SetPos( Point( rHOr.GetPos(), rVOr.GetPos() ) );
698  }
699  else
700  {
701  aRect -= rDrawObj.maParentPos;
702  aObjPos = aRect.TopLeft();
704  {
705  // #i22673#
706  sal_Int16 eOri = rVOr.GetRelationOrient();
707  if (eOri == text::RelOrientation::CHAR || eOri == text::RelOrientation::TEXT_LINE)
708  aObjPos.setY( -rVOr.GetPos() );
709  else
710  aObjPos.setY( rVOr.GetPos() );
711  }
713  aObjPos.setX( rHOr.GetPos() );
714  aRect.SetPos( aObjPos );
715  }
716 
717  sal_Int32 nThick = rDrawObj.mnThick;
718 
719  //If we are being exported as an inline hack, set
720  //corner to 0 and forget about border thickness for positioning
721  if (rFrameFormat.IsInline())
722  {
723  aRect.SetPos(Point(0,0));
724  nThick = 0;
725  }
726 
727  // spid
728  SwWW8Writer::WriteLong(*rWrt.pTableStrm, rDrawObj.mnShapeId);
729 
730  SwTwips nLeft = aRect.Left() + nThick;
731  SwTwips nRight = aRect.Right() - nThick;
732  SwTwips nTop = aRect.Top() + nThick;
733  SwTwips nBottom = aRect.Bottom() - nThick;
734 
735  // tdf#93675, 0 below line/paragraph and/or top line/paragraph with
736  // wrap top+bottom or other wraps is affecting the line directly
737  // above the anchor line, which seems odd, but a tiny adjustment
738  // here to bring the top down convinces msoffice to wrap like us
739  if (nTop == 0 && !rFrameFormat.IsInline() &&
741  rVOr.GetRelationOrient() == text::RelOrientation::FRAME)
742  {
743  nTop = 8;
744  }
745 
746  //Nasty swap for bidi if necessary
747  rWrt.MiserableRTLFrameFormatHack(nLeft, nRight, rFrameFormat);
748 
749  // tdf#70838. Word relates the position to the unrotated rectangle,
750  // Writer to the rotated one. Because the rotation is around center,
751  // the difference counts half.
752  if(pObj && pObj->GetRotateAngle())
753  {
754  SwTwips nXOff;
755  SwTwips nYOff;
756  SwTwips nSnapWidth = pObj->GetSnapRect().getWidth();
757  SwTwips nSnapHeight = pObj->GetSnapRect().getHeight();
758  SwTwips nLogicWidth = pObj->GetLogicRect().getWidth();
759  SwTwips nLogicHeight = pObj->GetLogicRect().getHeight();
760  // +1 for to compensate integer arithmetic rounding errors
761  if(bHasHeightWidthSwapped)
762  {
763  nXOff = (nSnapWidth - nLogicHeight + 1) / 2;
764  nYOff = (nSnapHeight - nLogicWidth + 1) / 2;
765  }
766  else
767  {
768  nXOff = (nSnapWidth - nLogicWidth + 1) / 2;
769  nYOff = (nSnapHeight - nLogicHeight + 1) / 2;
770  }
771  nLeft += nXOff;
772  nRight += nXOff;
773  nTop += nYOff;
774  nBottom += nYOff;
775  }
776 
777  //xaLeft/yaTop/xaRight/yaBottom - rel. to anchor
778  //(most of) the border is outside the graphic is word, so
779  //change dimensions to fit
780  SwWW8Writer::WriteLong(*rWrt.pTableStrm, nLeft);
781  SwWW8Writer::WriteLong(*rWrt.pTableStrm, nTop);
782  SwWW8Writer::WriteLong(*rWrt.pTableStrm, nRight);
783  SwWW8Writer::WriteLong(*rWrt.pTableStrm, nBottom);
784 
785  //fHdr/bx/by/wr/wrk/fRcaSimple/fBelowText/fAnchorLock
786  sal_uInt16 nFlags=0;
787  //If nFlags isn't 0x14 its overridden by the escher properties
788  if (RndStdIds::FLY_AT_PAGE == rFormat.GetAnchor().GetAnchorId())
789  nFlags = 0x0000;
790  else
791  nFlags = 0x0014; // x-rel to text, y-rel to text
792 
793  const SwFormatSurround& rSurr = rFormat.GetSurround();
794  sal_uInt16 nContour = rSurr.IsContour() ? 0x0080 : 0x0040;
795  css::text::WrapTextMode eSurround = rSurr.GetSurround();
796 
797  /*
798  #i3958#
799  The inline elements being export as anchored to character inside
800  the shape field hack are required to be wrap through so as to flow
801  over the following dummy 0x01 graphic
802  */
803  if (rFrameFormat.IsInline())
804  eSurround = css::text::WrapTextMode_THROUGH;
805 
806  switch (eSurround)
807  {
808  case css::text::WrapTextMode_NONE:
809  nFlags |= 0x0020;
810  break;
811  case css::text::WrapTextMode_THROUGH:
812  nFlags |= 0x0060;
813  break;
814  case css::text::WrapTextMode_PARALLEL:
815  nFlags |= 0x0000 | nContour;
816  break;
817  case css::text::WrapTextMode_DYNAMIC:
818  nFlags |= 0x0600 | nContour;
819  break;
820  case css::text::WrapTextMode_LEFT:
821  nFlags |= 0x0200 | nContour;
822  break;
823  case css::text::WrapTextMode_RIGHT:
824  nFlags |= 0x0400 | nContour;
825  break;
826  default:
827  OSL_ENSURE(false, "Unsupported surround type for export");
828  break;
829  }
830  if (pObj && (pObj->GetLayer() == rWrt.m_rDoc.getIDocumentDrawModelAccess().GetHellId() ||
832  {
833  nFlags |= 0x4000;
834  }
835 
836  /*
837  #i3958# Required to make this inline stuff work in WordXP, not
838  needed for 2003 interestingly
839  */
840  if (rFrameFormat.IsInline())
841  nFlags |= 0x8000;
842 
843  SwWW8Writer::WriteShort(*rWrt.pTableStrm, nFlags);
844 
845  // cTxbx
847  }
848 
849  RegisterWithFib(rFib, nFcStart, rWrt.pTableStrm->Tell() - nFcStart);
850 }
851 
852 void MainTextPlcDrawObj::RegisterWithFib(WW8Fib &rFib, sal_uInt32 nStart,
853  sal_uInt32 nLen) const
854 {
855  rFib.m_fcPlcfspaMom = nStart;
856  rFib.m_lcbPlcfspaMom = nLen;
857 }
858 
860 {
861  return 0;
862 }
863 
864 void HdFtPlcDrawObj::RegisterWithFib(WW8Fib &rFib, sal_uInt32 nStart,
865  sal_uInt32 nLen) const
866 {
867  rFib.m_fcPlcfspaHdr = nStart;
868  rFib.m_lcbPlcfspaHdr = nLen;
869 }
870 
872 {
873  return rFib.m_ccpText + rFib.m_ccpFootnote;
874 }
875 
876 bool PlcDrawObj::Append( WW8Export const & rWrt, WW8_CP nCp, const ww8::Frame& rFormat,
877  const Point& rNdTopLeft )
878 {
879  bool bRet = false;
880  const SwFrameFormat &rFrameFormat = rFormat.GetFrameFormat();
881  if (TXT_HDFT == rWrt.m_nTextTyp || TXT_MAINTEXT == rWrt.m_nTextTyp)
882  {
883  if (RES_FLYFRMFMT == rFrameFormat.Which())
884  {
885  // check for textflyframe and if it is the first in a Chain
886  if (rFrameFormat.GetContent().GetContentIdx())
887  bRet = true;
888  }
889  else
890  bRet = true;
891  }
892 
893  if (bRet)
894  {
895  DrawObj aObj(rFormat, nCp, rNdTopLeft, rWrt.TrueFrameDirection(rFrameFormat),
896  rWrt.GetHdFtIndex());
897  maDrawObjs.push_back(aObj);
898  }
899  return bRet;
900 }
901 
902 void DrawObj::SetShapeDetails(sal_uInt32 nId, sal_Int32 nThick)
903 {
904  mnShapeId = nId;
905  mnThick = nThick;
906 }
907 
909 {
910  rWrt.m_bInWriteEscher = true;
911  WW8_CP& rccp=TXT_TXTBOX == nTyp ? rWrt.pFib->m_ccpTxbx : rWrt.pFib->m_ccpHdrTxbx;
912 
913  bool bRet = WriteGenericText( rWrt, nTyp, rccp );
914 
915  WW8_CP nCP = rWrt.Fc2Cp( rWrt.Strm().Tell() );
916  WW8Fib& rFib = *rWrt.pFib;
917  WW8_CP nMyOffset = rFib.m_ccpText + rFib.m_ccpFootnote + rFib.m_ccpHdr + rFib.m_ccpAtn
918  + rFib.m_ccpEdn;
919  if( TXT_TXTBOX == nTyp )
920  rWrt.m_pFieldTextBxs->Finish( nCP, nMyOffset );
921  else
922  rWrt.m_pFieldHFTextBxs->Finish( nCP, nMyOffset + rFib.m_ccpTxbx );
923  rWrt.m_bInWriteEscher = false;
924  return bRet;
925 }
926 
927 void WW8_WrPlcTextBoxes::Append( const SdrObject& rObj, sal_uInt32 nShapeId )
928 {
929  aContent.push_back( &rObj );
930  aShapeIds.push_back( nShapeId );
931  //save NULL, if we have an actual SdrObject
932  aSpareFormats.push_back(nullptr);
933 }
934 
935 void WW8_WrPlcTextBoxes::Append( const SwFrameFormat* pFormat, sal_uInt32 nShapeId )
936 {
937  //no sdr object, we insert a NULL in the aContent and save the real fmt in aSpareFormats.
938  aContent.push_back( nullptr );
939  aShapeIds.push_back( nShapeId );
940  aSpareFormats.push_back(pFormat);
941 }
942 
943 const std::vector<sal_uInt32>* WW8_WrPlcTextBoxes::GetShapeIdArr() const
944 {
945  return &aShapeIds;
946 }
947 
948 sal_uInt32 WW8Export::GetSdrOrdNum( const SwFrameFormat& rFormat ) const
949 {
950  sal_uInt32 nOrdNum;
951  const SdrObject* pObj = rFormat.FindRealSdrObject();
952  if( pObj )
953  nOrdNum = pObj->GetOrdNum();
954  else
955  {
956  // no Layout for this format, then recalc the ordnum
957  SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(&rFormat);
958  nOrdNum = std::distance(m_rDoc.GetSpzFrameFormats()->begin(),
959  m_rDoc.GetSpzFrameFormats()->find( pFormat ) );
960 
962  if( pModel )
963  nOrdNum += pModel->GetPage( 0 )->GetObjCount();
964  }
965  return nOrdNum;
966 }
967 
968 void WW8Export::AppendFlyInFlys(const ww8::Frame& rFrameFormat,
969  const Point& rNdTopLeft)
970 {
971  OSL_ENSURE(!m_pEscher, "the EscherStream was already written!");
972  if (m_pEscher)
973  return ;
974  PlcDrawObj *pDrwO;
975  if (TXT_HDFT == m_nTextTyp)
976  pDrwO = m_pHFSdrObjs;
977  else
978  pDrwO = m_pSdrObjs;
979 
980  if (rFrameFormat.IsInline())
981  {
982  OutputField(nullptr, ww::eSHAPE, FieldString(ww::eSHAPE),
984  }
985 
986  WW8_CP nCP = Fc2Cp(Strm().Tell());
987  bool bSuccess = pDrwO->Append(*this, nCP, rFrameFormat, rNdTopLeft);
988  OSL_ENSURE(bSuccess, "Couldn't export a graphical element!");
989 
990  if (bSuccess)
991  {
992  static const sal_uInt8 aSpec8[] =
993  {
994  0x03, 0x6a, 0, 0, 0, 0, // sprmCObjLocation
995  0x55, 0x08, 1 // sprmCFSpec
996  };
997  // fSpec-Attribute true
998 
999  // A special character is required in the text for DrawObjects,
1000  // therefore a fSpec-Attribute
1001  m_pChpPlc->AppendFkpEntry( Strm().Tell() );
1002  WriteChar( 0x8 );
1003  m_pChpPlc->AppendFkpEntry( Strm().Tell(), sizeof( aSpec8 ), aSpec8 );
1004 
1005  //Need dummy picture frame
1006  if (rFrameFormat.IsInline())
1007  OutGrf(rFrameFormat);
1008  }
1009 
1010  if (rFrameFormat.IsInline())
1011  OutputField(nullptr, ww::eSHAPE, OUString(), FieldFlags::Close);
1012 }
1013 
1015  const EditTextObject& rEditObj, sal_uInt8 nTyp )
1016  : MSWordAttrIter( rWr ), pEditObj(&rEditObj), pEditPool(nullptr), mnTyp(nTyp)
1017 {
1018  NextPara( 0 );
1019 }
1020 
1021 void MSWord_SdrAttrIter::NextPara( sal_Int32 nPar )
1022 {
1023  nPara = nPar;
1024  // Ignore change of attribute at position 0, because we expect that
1025  // the attributes are outputted at start of a paragraph anyway.
1026  aChrTextAtrArr.clear();
1027  aChrSetArr.clear();
1028  nCurrentSwPos = nTmpSwPos = 0;
1029 
1031  pEditPool = aSet.GetPool();
1032  eNdChrSet = ItemGet<SvxFontItem>(aSet,EE_CHAR_FONTINFO).GetCharSet();
1033 
1035  nScript = g_pBreakIt->GetBreakIter()->getScriptType( pEditObj->GetText(nPara), 0);
1036 
1038  nCurrentSwPos = SearchNext( 1 );
1039 }
1040 
1041 rtl_TextEncoding MSWord_SdrAttrIter::GetNextCharSet() const
1042 {
1043  if( !aChrSetArr.empty() )
1044  return aChrSetArr.back();
1045  return eNdChrSet;
1046 }
1047 
1048 // the first parameter in SearchNext() returns if it's a TextAtr
1049 sal_Int32 MSWord_SdrAttrIter::SearchNext( sal_Int32 nStartPos )
1050 {
1051  sal_Int32 nMinPos = SAL_MAX_INT32;
1052  for(const auto& rTextAtr : aTextAtrArr)
1053  {
1054  sal_Int32 nPos = rTextAtr.nStart; // first character attribute
1055  if( nPos >= nStartPos && nPos <= nMinPos )
1056  {
1057  nMinPos = nPos;
1058  SetCharSet(rTextAtr, true);
1059  }
1060 
1061  nPos = rTextAtr.nEnd; // last character attribute + 1
1062  if( nPos >= nStartPos && nPos < nMinPos )
1063  {
1064  nMinPos = nPos;
1065  SetCharSet(rTextAtr, false);
1066  }
1067  }
1068  return nMinPos;
1069 }
1070 
1071 void MSWord_SdrAttrIter::SetCharSet(const EECharAttrib& rAttr, bool bStart)
1072 {
1073  const SfxPoolItem& rItem = *rAttr.pAttr;
1074  if( rItem.Which() != EE_CHAR_FONTINFO )
1075  {
1076  return;
1077  }
1078 
1079  if( bStart )
1080  {
1081  rtl_TextEncoding eChrSet = static_cast<const SvxFontItem&>(rItem).GetCharSet();
1082  aChrSetArr.push_back( eChrSet );
1083  aChrTextAtrArr.push_back( &rAttr );
1084  }
1085  else
1086  {
1087  std::vector<const EECharAttrib*>::iterator it =
1088  std::find( aChrTextAtrArr.begin(), aChrTextAtrArr.end(), &rAttr );
1089  if ( it != aChrTextAtrArr.end() )
1090  {
1091  aChrSetArr.erase( aChrSetArr.begin() + (it - aChrTextAtrArr.begin()) );
1092  aChrTextAtrArr.erase( it );
1093  }
1094  }
1095 }
1096 
1098 {
1099  const SvxFieldItem &rField = static_cast<const SvxFieldItem &>(rHt);
1100  const SvxFieldData *pField = rField.GetField();
1101  if (auto pURL = dynamic_cast< const SvxURLField *>( pField ))
1102  {
1103  sal_uInt8 nOldTextTyp = m_rExport.m_nTextTyp;
1105  m_rExport.AttrOutput().StartURL( pURL->GetURL(), pURL->GetTargetFrame() );
1106 
1107  const OUString &rStr = pURL->GetRepresentation();
1109 
1110  m_rExport.AttrOutput().EndURL(false);
1111  m_rExport.m_nTextTyp = nOldTextTyp;
1112  }
1113 }
1114 
1115 void MSWord_SdrAttrIter::OutAttr( sal_Int32 nSwPos )
1116 {
1117  //Collect the which ids belong to the run that we will export after
1118  //outputting the underlying paragraph attributes. We will exclude
1119  //writing these from the underlying paragraph attributes to avoid
1120  //duplicate attributes in docx export. Doesn't matter in doc
1121  //export as later props just override earlier ones.
1122  std::set<sal_uInt16> aUsedRunWhichs;
1123  for(const auto& rTextAtr : aTextAtrArr)
1124  {
1125  if (nSwPos >= rTextAtr.nStart && nSwPos < rTextAtr.nEnd)
1126  {
1127  sal_uInt16 nWhich = rTextAtr.pAttr->Which();
1128  aUsedRunWhichs.insert(nWhich);
1129  }
1130 
1131  if( nSwPos < rTextAtr.nStart )
1132  break;
1133  }
1134 
1135  OutParaAttr(true, &aUsedRunWhichs);
1136 
1137  if (aTextAtrArr.empty())
1138  return;
1139 
1141  m_rExport.m_pOutFormatNode = nullptr;
1142 
1143  const SfxItemPool* pSrcPool = pEditPool;
1144  const SfxItemPool& rDstPool = m_rExport.m_rDoc.GetAttrPool();
1145 
1146  nTmpSwPos = nSwPos;
1147  // Did we already produce a <w:sz> element?
1148  m_rExport.m_bFontSizeWritten = false;
1149  for(const auto& rTextAtr : aTextAtrArr)
1150  {
1151  if (nSwPos >= rTextAtr.nStart && nSwPos < rTextAtr.nEnd)
1152  {
1153  sal_uInt16 nWhich = rTextAtr.pAttr->Which();
1154  if (nWhich == EE_FEATURE_FIELD)
1155  {
1156  OutEEField(*(rTextAtr.pAttr));
1157  continue;
1158  }
1159  if (nWhich == EE_FEATURE_TAB)
1160  {
1161  m_rExport.WriteChar(0x9);
1162  continue;
1163  }
1164 
1165  const sal_uInt16 nSlotId = pSrcPool->GetSlotId(nWhich);
1166  if (nSlotId && nWhich != nSlotId)
1167  {
1168  nWhich = rDstPool.GetWhich(nSlotId);
1169  if (nWhich && nWhich != nSlotId &&
1170  nWhich < RES_UNKNOWNATR_BEGIN &&
1172  {
1173  // use always the SW-Which Id !
1174  std::unique_ptr<SfxPoolItem> pI(rTextAtr.pAttr->Clone());
1175  pI->SetWhich( nWhich );
1176  // Will this item produce a <w:sz> element?
1177  bool bFontSizeItem = nWhich == RES_CHRATR_FONTSIZE || nWhich == RES_CHRATR_CJK_FONTSIZE;
1178  if (!m_rExport.m_bFontSizeWritten || !bFontSizeItem)
1179  m_rExport.AttrOutput().OutputItem( *pI );
1180  if (bFontSizeItem)
1182  }
1183  }
1184  }
1185 
1186  if( nSwPos < rTextAtr.nStart )
1187  break;
1188  }
1189  m_rExport.m_bFontSizeWritten = false;
1190 
1191  nTmpSwPos = 0; // HasTextItem only allowed in the above area
1192  m_rExport.m_pOutFormatNode = pOldMod;
1193 }
1194 
1195 bool MSWord_SdrAttrIter::IsTextAttr(sal_Int32 nSwPos)
1196 {
1197  return std::any_of(aTextAtrArr.begin(), aTextAtrArr.end(),
1198  [nSwPos](const EECharAttrib& rTextAtr) {
1199  return (nSwPos >= rTextAtr.nStart && nSwPos < rTextAtr.nEnd) &&
1200  (rTextAtr.pAttr->Which() == EE_FEATURE_FIELD ||
1201  rTextAtr.pAttr->Which() == EE_FEATURE_TAB);
1202  }
1203  );
1204 }
1205 
1206 // HasItem is used for the consolidation of the double attribute Underline and
1207 // WordLineMode as a TextItem. OutAttr() calls the output function, which can
1208 // query for other items at the start position of attribute via HasItem().
1209 // Only attributes with an end can be queried.
1210 // The search is done with bDeep.
1211 const SfxPoolItem* MSWord_SdrAttrIter::HasTextItem(sal_uInt16 nWhich) const
1212 {
1214  m_rExport.m_rDoc.GetAttrPool(), nWhich);
1215  if (nWhich)
1216  {
1217  for (const auto& rTextAtr : aTextAtrArr)
1218  {
1219  if (nWhich == rTextAtr.pAttr->Which() && nTmpSwPos >= rTextAtr.nStart && nTmpSwPos < rTextAtr.nEnd)
1220  return rTextAtr.pAttr; // Found
1221  if (nTmpSwPos < rTextAtr.nStart)
1222  return nullptr;
1223  }
1224  }
1225  return nullptr;
1226 }
1227 
1228 const SfxPoolItem& MSWord_SdrAttrIter::GetItem( sal_uInt16 nWhich ) const
1229 {
1231  const SfxPoolItem* pRet = HasTextItem(nWhich);
1232  if (!pRet)
1233  {
1235  nWhich = GetSetWhichFromSwDocWhich(aSet, m_rExport.m_rDoc, nWhich);
1236  OSL_ENSURE(nWhich, "Impossible, catastrophic failure imminent");
1237  pRet = &aSet.Get(nWhich);
1238  }
1239  return *pRet;
1240 }
1241 
1242 //Drawing shapes properties inherit from a different pool that the document
1243 //styles. On export to .doc[x] they will default to style "Normal". Here explicitly
1244 //set any items which are not already set, but differ from "Normal".
1246 {
1248  (RES_POOLCOLL_STANDARD, false);
1249 
1250  SfxWhichIter aWhichIter(rSet);
1251  for (sal_uInt16 nEEWhich = aWhichIter.FirstWhich(); nEEWhich; nEEWhich = aWhichIter.NextWhich())
1252  {
1253  if (SfxItemState::SET != rSet.GetItemState(nEEWhich, false))
1254  {
1256  *pEditPool, nEEWhich);
1257  if (!nSwWhich)
1258  continue;
1259  bool bWanted = ( bCharAttr ? ( nSwWhich >= RES_CHRATR_BEGIN && nSwWhich < RES_TXTATR_END )
1260  : ( nSwWhich >= RES_PARATR_BEGIN && nSwWhich < RES_FRMATR_END ) );
1261  if (!bWanted)
1262  continue;
1263 
1264  const SfxPoolItem& rDrawItem = rSet.Get(nEEWhich);
1265  const SfxPoolItem& rStandardItem = pC->GetFormatAttr(nSwWhich);
1266  if (rDrawItem != rStandardItem)
1267  rSet.Put(rDrawItem);
1268  }
1269  }
1270 }
1271 
1272 void MSWord_SdrAttrIter::OutParaAttr(bool bCharAttr, const std::set<sal_uInt16>* pWhichsToIgnore)
1273 {
1275 
1276  SetItemsThatDifferFromStandard(bCharAttr, aSet);
1277 
1278  if (!aSet.Count())
1279  return;
1280 
1281  const SfxItemSet* pOldSet = m_rExport.GetCurItemSet();
1282  m_rExport.SetCurItemSet( &aSet );
1283 
1284  SfxItemIter aIter( aSet );
1285  const SfxPoolItem* pItem = aIter.GetCurItem();
1286 
1287  const SfxItemPool* pSrcPool = pEditPool,
1288  * pDstPool = &m_rExport.m_rDoc.GetAttrPool();
1289 
1290  do
1291  {
1292  sal_uInt16 nWhich = pItem->Which();
1293  if (pWhichsToIgnore && pWhichsToIgnore->find(nWhich) != pWhichsToIgnore->end())
1294  continue;
1295 
1296  sal_uInt16 nSlotId = pSrcPool->GetSlotId(nWhich);
1297 
1298  if ( nSlotId && nWhich != nSlotId &&
1299  0 != ( nWhich = pDstPool->GetWhich( nSlotId ) ) &&
1300  nWhich != nSlotId &&
1301  ( bCharAttr ? ( nWhich >= RES_CHRATR_BEGIN && nWhich < RES_TXTATR_END )
1302  : ( nWhich >= RES_PARATR_BEGIN && nWhich < RES_FRMATR_END ) ) )
1303  {
1304  // use always the SW-Which Id !
1305  std::unique_ptr<SfxPoolItem> pI(pItem->Clone());
1306  pI->SetWhich( nWhich );
1309  }
1310  } while ((pItem = aIter.NextItem()));
1311  m_rExport.SetCurItemSet( pOldSet );
1312 }
1313 
1315 {
1316  const OutlinerParaObject* pParaObj = nullptr;
1317  bool bOwnParaObj = false;
1318 
1319  /*
1320  #i13885#
1321  When the object is actively being edited, that text is not set into
1322  the objects normal text object, but lives in a separate object.
1323  */
1324  if (rTextObj.IsTextEditActive())
1325  {
1326  pParaObj = rTextObj.CreateEditOutlinerParaObject().release();
1327  bOwnParaObj = true;
1328  }
1329  else
1330  {
1331  pParaObj = rTextObj.GetOutlinerParaObject();
1332  }
1333 
1334  if( pParaObj )
1335  {
1336  WriteOutliner(*pParaObj, nTyp);
1337  if( bOwnParaObj )
1338  delete pParaObj;
1339  }
1340 }
1341 
1343 {
1344  bool bAnyWrite = false;
1345  const EditTextObject& rEditObj = rParaObj.GetTextObject();
1346  MSWord_SdrAttrIter aAttrIter( *this, rEditObj, nTyp );
1347 
1348  sal_Int32 nPara = rEditObj.GetParagraphCount();
1349  sal_uInt8 bNul = 0;
1350  for( sal_Int32 n = 0; n < nPara; ++n )
1351  {
1352  if( n )
1353  aAttrIter.NextPara( n );
1354 
1355  OSL_ENSURE( pO->empty(), " pO is not empty at start of line" );
1356 
1357  OUString aStr( rEditObj.GetText( n ));
1358  sal_Int32 nCurrentPos = 0;
1359  const sal_Int32 nEnd = aStr.getLength();
1360 
1361  const SfxItemSet& aSet(rEditObj.GetParaAttribs(n));
1362  bool bIsRTLPara = false;
1363  const SfxPoolItem *pItem;
1364  if(SfxItemState::SET == aSet.GetItemState(EE_PARA_WRITINGDIR, true, &pItem))
1365  {
1366  SvxFrameDirection nDir = static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue();
1367  bIsRTLPara = SvxFrameDirection::Horizontal_RL_TB == nDir;
1368  }
1369 
1370  do {
1371  const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd);
1372 
1373  bool bTextAtr = aAttrIter.IsTextAttr( nCurrentPos );
1374  if( !bTextAtr )
1375  OutSwString(aStr, nCurrentPos, nNextAttr - nCurrentPos);
1376 
1377  // At the end of the line the attributes are extended over the CR.
1378  // exception: foot note at line end
1379  if( nNextAttr == nEnd && !bTextAtr )
1380  WriteCR(); // CR after it
1381 
1382  // output of character attributes
1383  aAttrIter.OutAttr( nCurrentPos ); // nCurrentPos - 1 ??
1384 
1385  if (bIsRTLPara)
1386  {
1387  // This is necessary to make word order correct in MS Word.
1388  // In theory we should do this for complex-script runs only,
1389  // but Outliner does not split runs like Writer core did.
1390  // Fortunately, both MS Word and Writer seems to tolerate
1391  // that we turn it on for non complex-script runs.
1393  }
1394 
1395  m_pChpPlc->AppendFkpEntry( Strm().Tell(),
1396  pO->size(), pO->data() );
1397  pO->clear();
1398 
1399  // exception: foot note at line end
1400  if( nNextAttr == nEnd && bTextAtr )
1401  WriteCR(); // CR after it
1402  nCurrentPos = nNextAttr;
1403  aAttrIter.NextPos();
1404  }
1405  while( nCurrentPos < nEnd );
1406 
1407  OSL_ENSURE( pO->empty(), " pO is not empty at start of line" );
1408 
1409  pO->push_back( bNul ); // Style # as short
1410  pO->push_back( bNul );
1411 
1412  aAttrIter.OutParaAttr(false);
1413 
1414  sal_uLong nPos = Strm().Tell();
1415  m_pPapPlc->AppendFkpEntry( Strm().Tell(),
1416  pO->size(), pO->data() );
1417  pO->clear();
1418  m_pChpPlc->AppendFkpEntry( nPos );
1419  }
1420 
1421  bAnyWrite = 0 != nPara;
1422  if( !bAnyWrite )
1423  WriteStringAsPara( OUString() );
1424 }
1425 
1427 {
1428  //Toplevel groups get their winword extra data attached, and sub elements
1429  //use the defaults
1430  if (rEx.GetGroupLevel() > 1)
1431  return;
1432 
1433  SvStream& rSt = rEx.GetStream();
1434  //The last argument denotes the number of sub properties in this atom
1435  if (mbInline)
1436  {
1437  rEx.AddAtom(18, DFF_msofbtUDefProp, 3, 3); //Prop id is 0xF122
1438  rSt.WriteUInt16( 0x0390 ).WriteUInt32( 3 );
1439  rSt.WriteUInt16( 0x0392 ).WriteUInt32( 3 );
1440  //This sub property is required to be in the dummy inline frame as
1441  //well
1442  rSt.WriteUInt16( 0x053F ).WriteUInt32( nInlineHack );
1443  }
1444  else
1445  {
1446  rEx.AddAtom(24, DFF_msofbtUDefProp, 3, 4 ); //Prop id is 0xF122
1447  rSt.WriteUInt16( 0x038F ).WriteUInt32( mnXAlign );
1448  rSt.WriteUInt16( 0x0390 ).WriteUInt32( mnXRelTo );
1449  rSt.WriteUInt16( 0x0391 ).WriteUInt32( mnYAlign );
1450  rSt.WriteUInt16( 0x0392 ).WriteUInt32( mnYRelTo );
1451  }
1452 }
1453 
1455 {
1456  SfxItemState eBackSet = m_rDoc.GetPageDesc(0).GetMaster().
1457  GetItemState(RES_BACKGROUND);
1458  if (m_pHFSdrObjs->size() || m_pSdrObjs->size() || SfxItemState::SET == eBackSet)
1459  {
1460  OSL_ENSURE( !m_pEscher, "Who did not deleted the pointer?" );
1461  SvMemoryStream* pEscherStrm = new SvMemoryStream;
1462  pEscherStrm->SetEndian(SvStreamEndian::LITTLE);
1463  m_pEscher = new SwEscherEx(pEscherStrm, *this);
1464  }
1465 }
1466 
1468 {
1469  if (m_pEscher)
1470  {
1471  sal_uLong nStart = pTableStrm->Tell();
1472 
1475 
1476  pFib->m_fcDggInfo = nStart;
1477  pFib->m_lcbDggInfo = pTableStrm->Tell() - nStart;
1478  delete m_pEscher;
1479  m_pEscher = nullptr;
1480  }
1481 }
1482 
1484 {
1485  if( SvStream* pPicStrm = static_cast< SwEscherExGlobal& >( *mxGlobal ).GetPictureStream() )
1486  {
1487  // set the blip - entries to the correct stream pos
1488  sal_Int32 nEndPos = rWrt.Strm().Tell();
1489  mxGlobal->SetNewBlipStreamOffset( nEndPos );
1490 
1491  pPicStrm->Seek( 0 );
1492  rWrt.Strm().WriteStream( *pPicStrm );
1493  }
1494  Flush();
1495 }
1496 
1497 // Output- Routines for Escher Export
1498 
1500 {
1501 }
1502 
1504 {
1505 }
1506 
1508 {
1509  // this function will be called exactly once
1510  mxPicStrm = std::make_shared<SvMemoryStream>();
1511  mxPicStrm->SetEndian(SvStreamEndian::LITTLE);
1512  return mxPicStrm.get();
1513 }
1514 
1516  : EscherEx( std::make_shared<SwEscherExGlobal>(), pStrm), rWrt(rWW8Wrt), pEscherStrm(pStrm)
1517 {
1518  Init();
1519 }
1520 
1522 {
1523 }
1524 
1526 {
1528  GetStream().WriteUInt32( 0x80000000 );
1529 }
1530 
1531 void SwBasicEscherEx::WriteEmptyFlyFrame(const SwFrameFormat& rFormat, sal_uInt32 nShapeId)
1532 {
1534  AddShape(ESCHER_ShpInst_PictureFrame, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty, nShapeId);
1535  // store anchor attribute
1536  WriteFrameExtraData(rFormat);
1537 
1538  AddAtom(6, DFF_msofbtUDefProp, 3, 1); //Prop id is 0xF122
1540 
1541  CloseContainer(); // ESCHER_SpContainer
1542 }
1543 
1544 static ShapeFlag AddMirrorFlags(ShapeFlag nFlags, const SwMirrorGrf &rMirror)
1545 {
1546  switch (rMirror.GetValue())
1547  {
1548  default:
1549  case MirrorGraph::Dont:
1550  break;
1551  case MirrorGraph::Vertical:
1552  nFlags |= ShapeFlag::FlipH;
1553  break;
1555  nFlags |= ShapeFlag::FlipV;
1556  break;
1557  case MirrorGraph::Both:
1558  nFlags |= ShapeFlag::FlipH | ShapeFlag::FlipV;
1559  break;
1560 
1561  }
1562  return nFlags;
1563 }
1564 //For i120928,this function is added to export graphic of bullet
1566 {
1568  AddShape(ESCHER_ShpInst_PictureFrame, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty, 0x401);
1569  EscherPropertyContainer aPropOpt;
1570  GraphicObject aGraphicObject( rGrf );
1571  OString aUniqueId = aGraphicObject.GetUniqueID();
1572  if ( !aUniqueId.isEmpty() )
1573  {
1574  sal_uInt32 nBlibId = mxGlobal->GetBlibID( *(mxGlobal->QueryPictureStream()), aGraphicObject );
1575  if (nBlibId)
1576  aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, true);
1577  }
1583  aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
1584  aPropOpt.AddOpt( ESCHER_Prop_dyTextTop, 0 );
1585  aPropOpt.AddOpt( ESCHER_Prop_dyTextBottom, 0 );
1586  aPropOpt.AddOpt( ESCHER_Prop_dxTextLeft, 0 );
1587  aPropOpt.AddOpt( ESCHER_Prop_dxTextRight, 0 );
1588  const Color aTmpColor( COL_WHITE );
1589  std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(aTmpColor, RES_BACKGROUND));
1590  const SvxBrushItem* pRet = rWrt.GetCurrentPageBgBrush();
1591  if (pRet && (pRet->GetGraphic() ||( pRet->GetColor() != COL_TRANSPARENT)))
1592  aBrush.reset(pRet->Clone());
1593  WriteBrushAttr(*aBrush, aPropOpt);
1594 
1595  aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0 );
1596  aPropOpt.Commit( GetStream() );
1598  GetStream().WriteUInt32( 0x80000000 );
1599  CloseContainer();
1600 }
1601 
1602 sal_Int32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrameFormat& rFormat, sal_uInt32 nShapeId)
1603 {
1604  sal_Int32 nBorderThick=0;
1606  SwGrfNode *pGrfNd = pNd ? pNd->GetGrfNode() : nullptr;
1607  OSL_ENSURE(pGrfNd, "No SwGrfNode ?, suspicious");
1608  if (!pGrfNd)
1609  return nBorderThick;
1610 
1612 
1613  const SwMirrorGrf &rMirror = pGrfNd->GetSwAttrSet().GetMirrorGrf();
1615  AddMirrorFlags(ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty, rMirror),
1616  nShapeId);
1617 
1618  EscherPropertyContainer aPropOpt;
1619 
1620  sal_uInt32 nFlags = ESCHER_BlipFlagDefault;
1621 
1622  if (pGrfNd->IsLinkedFile())
1623  {
1624  OUString sURL;
1625  pGrfNd->GetFileFilterNms( &sURL, nullptr );
1626 
1627  ww::bytes aBuf;
1628  SwWW8Writer::InsAsString16( aBuf, sURL );
1629  SwWW8Writer::InsUInt16( aBuf, 0 );
1630 
1631  aPropOpt.AddOpt(ESCHER_Prop_pibName, true, aBuf.size(), aBuf);
1634  }
1635  else
1636  {
1637  const Graphic& aGraphic(pGrfNd->GetGrf());
1638  GraphicObject aGraphicObject( aGraphic );
1639  OString aUniqueId = aGraphicObject.GetUniqueID();
1640 
1641  if (!aUniqueId.isEmpty())
1642  {
1643  sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), aGraphicObject);
1644  if (nBlibId)
1645  aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, true);
1646  }
1647  }
1648 
1649  aPropOpt.AddOpt( ESCHER_Prop_pibFlags, nFlags );
1650  nBorderThick = WriteFlyFrameAttr(rFormat,mso_sptPictureFrame,aPropOpt);
1651  WriteGrfAttr(*pGrfNd, rFormat, aPropOpt);
1652 
1653  aPropOpt.Commit( GetStream() );
1654 
1655  // store anchor attribute
1656  WriteFrameExtraData( rFormat );
1657 
1658  CloseContainer(); // ESCHER_SpContainer
1659  return nBorderThick;
1660 }
1661 
1663  EscherPropertyContainer& rPropOpt)
1664 {
1665  const SfxPoolItem* pItem;
1666  GraphicDrawMode nMode = GraphicDrawMode::Standard;
1667  sal_Int32 nContrast = 0;
1668  sal_Int16 nBrightness = 0;
1669 
1670  if (SfxItemState::SET == rNd.GetSwAttrSet().GetItemState(RES_GRFATR_CONTRAST,
1671  true, &pItem))
1672  {
1673  nContrast = static_cast<const SfxInt16Item*>(pItem)->GetValue();
1674  }
1675 
1676  if (SfxItemState::SET == rNd.GetSwAttrSet().GetItemState(RES_GRFATR_LUMINANCE,
1677  true, &pItem))
1678  {
1679  nBrightness = static_cast<const SfxInt16Item*>(pItem)->GetValue();
1680  }
1681 
1682  if (SfxItemState::SET == rNd.GetSwAttrSet().GetItemState(RES_GRFATR_DRAWMODE,
1683  true, &pItem))
1684  {
1685  nMode = static_cast<GraphicDrawMode>(static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue());
1686  if (nMode == GraphicDrawMode::Watermark)
1687  {
1688  /*
1689  There is no real watermark mode in word, we must use standard
1690  mode and modify our ones by 70% extra brightness and 70% less
1691  contrast. This means that unmodified default OOo watermark
1692  will turn back into watermark, and modified OOo watermark will
1693  change into a close visual representation in standardmode
1694  */
1695  nBrightness += 70;
1696  if (nBrightness > 100)
1697  nBrightness = 100;
1698  nContrast -= 70;
1699  if (nContrast < -100)
1700  nContrast = -100;
1701  nMode = GraphicDrawMode::Standard;
1702  }
1703  }
1704 
1705  sal_uInt32 nPictureMode;
1706  if (nMode == GraphicDrawMode::Greys)
1707  nPictureMode = 0x40004;
1708  else if (nMode == GraphicDrawMode::Mono)
1709  nPictureMode = 0x60006;
1710  else
1711  nPictureMode = 0;
1712  rPropOpt.AddOpt( ESCHER_Prop_pictureActive, nPictureMode );
1713 
1714  if (nContrast != 0)
1715  {
1716  nContrast+=100;
1717  if (nContrast == 100)
1718  nContrast = 0x10000;
1719  else if (nContrast < 100)
1720  {
1721  nContrast *= 0x10000;
1722  nContrast /= 100;
1723  }
1724  else if (nContrast < 200)
1725  nContrast = (100 * 0x10000) / (200-nContrast);
1726  else
1727  nContrast = 0x7fffffff;
1728  rPropOpt.AddOpt( ESCHER_Prop_pictureContrast, nContrast);
1729  }
1730 
1731  if (nBrightness != 0)
1732  rPropOpt.AddOpt( ESCHER_Prop_pictureBrightness, nBrightness * 327 );
1733 
1734  sal_Int32 nCropL = 0;
1735  sal_Int32 nCropR = 0;
1736  sal_Int32 nCropT = 0;
1737  sal_Int32 nCropB = 0;
1738  if (SfxItemState::SET == rNd.GetSwAttrSet().GetItemState(RES_GRFATR_CROPGRF,
1739  true, &pItem))
1740  {
1741  const SwCropGrf& rCrop = *static_cast<const SwCropGrf*>(pItem);
1742  nCropL += rCrop.GetLeft();
1743  nCropR += rCrop.GetRight();
1744  nCropT += rCrop.GetTop();
1745  nCropB += rCrop.GetBottom();
1746  }
1747 
1748  // simulate border padding as a negative crop.
1749  if (SfxItemState::SET == rFormat.GetItemState(RES_BOX, false, &pItem))
1750  {
1751  const SvxBoxItem& rBox = *static_cast<const SvxBoxItem*>(pItem);
1752  nCropL -= rBox.GetDistance( SvxBoxItemLine::LEFT );
1753  nCropR -= rBox.GetDistance( SvxBoxItemLine::RIGHT );
1754  nCropT -= rBox.GetDistance( SvxBoxItemLine::TOP );
1755  nCropB -= rBox.GetDistance( SvxBoxItemLine::BOTTOM );
1756  }
1757 
1758  const Size aSz( rNd.GetTwipSize() );
1759  if( 0 != nCropL )
1760  rPropOpt.AddOpt( ESCHER_Prop_cropFromLeft, ToFract16( nCropL, aSz.Width()) );
1761  if( 0 != nCropR )
1762  rPropOpt.AddOpt( ESCHER_Prop_cropFromRight, ToFract16( nCropR, aSz.Width()));
1763  if( 0 != nCropT )
1764  rPropOpt.AddOpt( ESCHER_Prop_cropFromTop, ToFract16( nCropT, aSz.Height()));
1765  if( 0 != nCropB )
1766  rPropOpt.AddOpt( ESCHER_Prop_cropFromBottom, ToFract16( nCropB, aSz.Height()));
1767 }
1768 
1769 void SwBasicEscherEx::SetPicId(const SdrObject &, sal_uInt32,
1771 {
1772 }
1773 
1774 void SwEscherEx::SetPicId(const SdrObject &rSdrObj, sal_uInt32 nShapeId,
1775  EscherPropertyContainer &rPropOpt)
1776 {
1777  pTextBxs->Append(rSdrObj, nShapeId);
1778  sal_uInt32 nPicId = pTextBxs->Count();
1779  nPicId *= 0x10000;
1780  rPropOpt.AddOpt( ESCHER_Prop_pictureId, nPicId );
1781 }
1782 
1783 sal_Int32 SwBasicEscherEx::WriteOLEFlyFrame(const SwFrameFormat& rFormat, sal_uInt32 nShapeId)
1784 {
1785  sal_Int32 nBorderThick = 0;
1786  if (const SdrObject* pSdrObj = rFormat.FindRealSdrObject())
1787  {
1788  SwNodeIndex aIdx(*rFormat.GetContent().GetContentIdx(), 1);
1789  SwOLENode& rOLENd = *aIdx.GetNode().GetOLENode();
1790  sal_Int64 nAspect = rOLENd.GetAspect();
1791 
1792  uno::Reference < embed::XEmbeddedObject > xObj(rOLENd.GetOLEObj().GetOleRef());
1793 
1794  // the rectangle is used to transport the size of the object
1795  // the left, top corner is set to ( 0, 0 ) by default constructor,
1796  // if the width and height are set correctly bRectIsSet should be set to true
1797  awt::Rectangle aRect;
1798  bool bRectIsSet = false;
1799 
1800  // TODO/LATER: should the icon size be stored in case of iconified object?
1801  if ( xObj.is() && nAspect != embed::Aspects::MSOLE_ICON )
1802  {
1803  try
1804  {
1805  awt::Size aSize = xObj->getVisualAreaSize( nAspect );
1806  aRect.Width = aSize.Width;
1807  aRect.Height = aSize.Height;
1808  bRectIsSet = true;
1809  }
1810  catch( const uno::Exception& )
1811  {}
1812  }
1813 
1814  /*
1815  #i5970#
1816  Export floating ole2 .doc ver 8+ wmf ole2 previews as emf previews
1817  instead ==> allows unicode text to be preserved
1818  */
1819 #ifdef OLE_PREVIEW_AS_EMF
1820  const Graphic* pGraphic = rOLENd.GetGraphic();
1821 #endif
1823 
1824  EscherPropertyContainer aPropOpt;
1825  const SwMirrorGrf &rMirror = rOLENd.GetSwAttrSet().GetMirrorGrf();
1826  WriteOLEPicture(aPropOpt,
1827  AddMirrorFlags(ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::OLEShape, rMirror),
1828  pGraphic ? *pGraphic : Graphic(), *pSdrObj, nShapeId, bRectIsSet ? &aRect : nullptr );
1829 
1830  nBorderThick = WriteFlyFrameAttr(rFormat, mso_sptPictureFrame, aPropOpt);
1831  WriteGrfAttr(rOLENd, rFormat, aPropOpt);
1832  aPropOpt.Commit(GetStream());
1833 
1834  // store anchor attribute
1835  WriteFrameExtraData( rFormat );
1836 
1837  CloseContainer(); // ESCHER_SpContainer
1838  }
1839  return nBorderThick;
1840 }
1841 
1843  EscherPropertyContainer& rPropOpt)
1844 {
1845  bool bSetOpacity = false;
1846  sal_uInt32 nOpaque = 0;
1847  if (const GraphicObject *pGraphicObject = rBrush.GetGraphicObject())
1848  {
1849  OString aUniqueId = pGraphicObject->GetUniqueID();
1850  if (!aUniqueId.isEmpty())
1851  {
1852  sal_uInt32 nBlibId = mxGlobal->GetBlibID(*QueryPictureStream(), *pGraphicObject);
1853  if (nBlibId)
1854  rPropOpt.AddOpt(ESCHER_Prop_fillBlip,nBlibId,true);
1855  }
1856 
1857  nOpaque = 255 - pGraphicObject->GetAttr().GetAlpha();
1858  if (0 != nOpaque)
1859  bSetOpacity = true;
1860 
1862  rPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
1863  rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
1864  }
1865  else
1866  {
1867  sal_uInt32 nFillColor = GetColor(rBrush.GetColor());
1868  rPropOpt.AddOpt( ESCHER_Prop_fillColor, nFillColor );
1869  rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, nFillColor ^ 0xffffff );
1870  rPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100010 );
1871 
1872  nOpaque = 255 - rBrush.GetColor().GetAlpha();
1873  if (0 != nOpaque)
1874  bSetOpacity = true;
1875  }
1876 
1877  if (bSetOpacity)
1878  {
1879  nOpaque = (nOpaque * 100) / 0xFE;
1880  nOpaque = ((100 - nOpaque) << 16) / 100;
1881  rPropOpt.AddOpt(ESCHER_Prop_fillOpacity, nOpaque);
1882  }
1883 }
1884 
1886  MSO_SPT eShapeType, EscherPropertyContainer& rPropOpt)
1887 {
1888  sal_Int32 nLineWidth=0;
1889  const SfxPoolItem* pItem;
1890  bool bFirstLine = true;
1891  if (SfxItemState::SET == rFormat.GetItemState(RES_BOX, true, &pItem))
1892  {
1893  static const o3tl::enumarray<SvxBoxItemLine, sal_uInt16> aExhperProp =
1894  {
1897  };
1898  const SvxBorderLine* pLine;
1899 
1901  {
1902  pLine = static_cast<const SvxBoxItem*>(pItem)->GetLine( n );
1903  if( nullptr != pLine )
1904  {
1905  if( bFirstLine )
1906  {
1907  sal_uInt32 nLineColor = GetColor(pLine->GetColor());
1908  rPropOpt.AddOpt( ESCHER_Prop_lineColor, nLineColor );
1910  nLineColor ^ 0xffffff );
1911 
1912  MSO_LineStyle eStyle;
1913  if( pLine->isDouble() )
1914  {
1915  // double line
1916  nLineWidth = pLine->GetWidth();
1917  if( pLine->GetInWidth() == pLine->GetOutWidth() )
1918  eStyle = mso_lineDouble;
1919  else if( pLine->GetInWidth() < pLine->GetOutWidth() )
1920  eStyle = mso_lineThickThin;
1921  else
1922  eStyle = mso_lineThinThick;
1923  }
1924  else
1925  {
1926  // simple line
1927  eStyle = mso_lineSimple;
1928  nLineWidth = pLine->GetWidth();
1929  }
1930 
1931  rPropOpt.AddOpt( ESCHER_Prop_lineStyle, eStyle );
1932  rPropOpt.AddOpt( ESCHER_Prop_lineWidth,
1933  DrawModelToEmu( nLineWidth ));
1934 
1935  MSO_LineDashing eDashing = mso_lineSolid;
1936  switch (pLine->GetBorderLineStyle())
1937  {
1938  case SvxBorderLineStyle::DASHED:
1939  eDashing = mso_lineDashGEL;
1940  break;
1941  case SvxBorderLineStyle::DOTTED:
1942  eDashing = mso_lineDotGEL;
1943  break;
1944  case SvxBorderLineStyle::SOLID:
1945  default:
1946  break;
1947  }
1948  rPropOpt.AddOpt( ESCHER_Prop_lineDashing, eDashing );
1949  rPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x8000E );
1950 
1951  //Use import logic to determine how much of border will go
1952  //outside graphic
1954  eStyle,eShapeType,nLineWidth);
1955  bFirstLine = false;
1956  }
1957  rPropOpt.AddOpt( aExhperProp[ n ], DrawModelToEmu(
1958  static_cast<const SvxBoxItem*>(pItem)->GetDistance( n ) ));
1959  }
1960  else
1961  rPropOpt.AddOpt( aExhperProp[ n ], DrawModelToEmu(static_cast<const SvxBoxItem*>(pItem)->GetDistance( n )) );
1962  }
1963  }
1964  else
1965  {
1966  rPropOpt.AddOpt( ESCHER_Prop_dyTextTop, 0 );
1967  rPropOpt.AddOpt( ESCHER_Prop_dyTextBottom, 0 );
1968  rPropOpt.AddOpt( ESCHER_Prop_dxTextLeft, 0 );
1969  rPropOpt.AddOpt( ESCHER_Prop_dxTextRight, 0 );
1970  }
1971 
1972  if( bFirstLine ) // no valid line found
1973  {
1974  rPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
1975  }
1976  const SwAttrSet& rAttrSet = rFormat.GetAttrSet();
1977  if (SfxItemState::SET == rAttrSet.GetItemState(RES_BOX, false, &pItem))
1978  {
1979  const SvxBoxItem* pBox = static_cast<const SvxBoxItem*>(pItem);
1980  if( pBox )
1981  {
1982  const SfxPoolItem* pShadItem;
1983  if (SfxItemState::SET
1984  == rAttrSet.GetItemState(RES_SHADOW, true, &pShadItem))
1985  {
1986  const SvxShadowItem* pSI = static_cast<const SvxShadowItem*>(pShadItem);
1987 
1988  constexpr sal_uInt16 nCstScale = 635; // unit scale between AOO and MS Word
1989  constexpr sal_uInt32 nShadowType = 131074; // shadow type of ms word. need to set the default value.
1990 
1991  Color nColor = pSI->GetColor();
1992  sal_Int32 nOffX = pSI->GetWidth() * nCstScale;
1993  sal_Int32 nOffY = pSI->GetWidth() * nCstScale;
1994 
1995  SvxShadowLocation eLocation = pSI->GetLocation();
1996  if( (eLocation!=SvxShadowLocation::NONE) && (pSI->GetWidth()!=0) )
1997  {
1998  switch( eLocation )
1999  {
2000  case SvxShadowLocation::TopLeft:
2001  {
2002  nOffX = -nOffX;
2003  nOffY = -nOffY;
2004  }
2005  break;
2006  case SvxShadowLocation::TopRight:
2007  {
2008  nOffY = -nOffY;
2009  }
2010  break;
2011  case SvxShadowLocation::BottomLeft:
2012  {
2013  nOffX = -nOffX;
2014  }
2015  break;
2016  case SvxShadowLocation::BottomRight:
2017  break;
2018  default:
2019  break;
2020  }
2021 
2022  rPropOpt.AddOpt( DFF_Prop_shadowColor, wwUtility::RGBToBGR(nColor));
2023  rPropOpt.AddOpt( DFF_Prop_shadowOffsetX, nOffX );
2024  rPropOpt.AddOpt( DFF_Prop_shadowOffsetY, nOffY );
2025  rPropOpt.AddOpt( DFF_Prop_fshadowObscured, nShadowType );
2026  }
2027  }
2028  }
2029  }
2030 
2031  // SwWW8ImplReader::Read_GrafLayer() imports these as opaque
2032  // unconditionally, so if both are true, don't export the property.
2033  const bool bIsInHeader = sw::IsFlyFrameFormatInHeader(rFormat);
2034  const bool bIsThrough = rFormat.GetSurround().GetValue() == css::text::WrapTextMode_THROUGH;
2035 
2036  // Anything (like a transparent image) that allows text to wrap through should not force a non-transparent background,
2037  // and neither should the commonly seen backgrounds anchored in headers.
2038  if (bIsInHeader || bIsThrough)
2039  {
2040  std::unique_ptr<SvxBrushItem> aBrush(rFormat.makeBackgroundBrushItem());
2041 
2042  if(aBrush)
2043  {
2044  WriteBrushAttr(*aBrush, rPropOpt);
2045  }
2046  }
2047  else
2048  {
2049  // for unknown reasons, force exporting a non-transparent background on fly frames.
2050  std::shared_ptr<SvxBrushItem> aBrush(rWrt.TrueFrameBgBrush(rFormat));
2051 
2052  if(aBrush)
2053  {
2054  WriteBrushAttr(*aBrush, rPropOpt);
2055  }
2056  }
2057 
2058  const SdrObject* pObj = rFormat.FindRealSdrObject();
2059 
2060  if( pObj && (pObj->GetLayer() == GetHellLayerId() ||
2061  pObj->GetLayer() == GetInvisibleHellId() ) && !(bIsInHeader && bIsThrough))
2062  {
2063  rPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 );
2064  }
2065 
2066  PreWriteHyperlinkWithinFly(rFormat,rPropOpt);
2067 
2068  return nLineWidth;
2069 }
2070 
2071 sal_Int32 SwEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, MSO_SPT eShapeType,
2072  EscherPropertyContainer& rPropOpt)
2073 {
2074  sal_Int32 nLineWidth = SwBasicEscherEx::WriteFlyFrameAttr(rFormat, eShapeType,
2075  rPropOpt);
2076 
2077  /*
2078  These are not in SwBasicEscherEx::WriteFlyFrameAttr because inline objs
2079  can't do it in word and it hacks it in by stretching the graphic that
2080  way, perhaps we should actually draw in this space into the graphic we
2081  are exporting!
2082  */
2083  const SfxPoolItem* pItem;
2084  if (SfxItemState::SET == rFormat.GetItemState(RES_LR_SPACE, true, &pItem))
2085  {
2087  DrawModelToEmu( static_cast<const SvxLRSpaceItem*>(pItem)->GetLeft() ) );
2089  DrawModelToEmu( static_cast<const SvxLRSpaceItem*>(pItem)->GetRight() ) );
2090  }
2091  else
2092  {
2093  rPropOpt.AddOpt( ESCHER_Prop_dxWrapDistLeft, 0 );
2094  rPropOpt.AddOpt( ESCHER_Prop_dxWrapDistRight, 0 );
2095  }
2096 
2097  if (SfxItemState::SET == rFormat.GetItemState(RES_UL_SPACE, true, &pItem))
2098  {
2100  DrawModelToEmu( static_cast<const SvxULSpaceItem*>(pItem)->GetUpper() ) );
2102  DrawModelToEmu( static_cast<const SvxULSpaceItem*>(pItem)->GetLower() ) );
2103  }
2104 
2105  if (rFormat.GetSurround().IsContour())
2106  {
2107  if (const SwNoTextNode *pNd = GetNoTextNodeFromSwFrameFormat(rFormat))
2108  {
2109  const tools::PolyPolygon *pPolyPoly = pNd->HasContour();
2110  if (pPolyPoly && pPolyPoly->Count())
2111  {
2112  tools::Polygon aPoly = CorrectWordWrapPolygonForExport(*pPolyPoly, pNd, /*bCorrectCrop=*/false);
2113  SvMemoryStream aPolyDump;
2114  aPolyDump.SetEndian(SvStreamEndian::LITTLE);
2115 
2116  sal_uInt16 nLen = aPoly.GetSize();
2117  aPolyDump.WriteUInt16( nLen );
2118  aPolyDump.WriteUInt16( nLen );
2119  aPolyDump.WriteUInt16( 8 );
2120  for (sal_uInt16 nI = 0; nI < nLen; ++nI)
2121  {
2122  aPolyDump.WriteUInt32( aPoly[nI].X() );
2123  aPolyDump.WriteUInt32( aPoly[nI].Y() );
2124  }
2125 
2126  rPropOpt.AddOpt(DFF_Prop_pWrapPolygonVertices, false, 0, aPolyDump);
2127  }
2128  }
2129  }
2130 
2131  PreWriteHyperlinkWithinFly(rFormat,rPropOpt);
2132 
2133  return nLineWidth;
2134 }
2135 
2137 {
2138  MapUnit eMap = MapUnit::MapTwip;
2140  {
2141  // PPT works only with units of 576DPI
2142  // WW however is using twips, i.e 1440DPI.
2143  eMap = pModel->GetScaleUnit();
2144  }
2145 
2146  // MS-DFF-Properties mostly are in EMU (English Metric Units)
2147  // 1mm=36000emu, 1twip=635emu
2148  Fraction aFact(360, 1);
2149  aFact /= GetMapFactor(MapUnit::Map100thMM, eMap).X();
2150  // create little values
2151  aFact = Fraction(aFact.GetNumerator(), aFact.GetDenominator());
2152  mnEmuMul = aFact.GetNumerator();
2153  mnEmuDiv = aFact.GetDenominator();
2154 
2156 }
2157 
2158 sal_Int32 SwBasicEscherEx::ToFract16(sal_Int32 nVal, sal_uInt32 nMax)
2159 {
2160  if (nMax)
2161  {
2162  if (nVal >= 0)
2163  {
2164  sal_Int32 nMSVal = (nVal / 65536) * nMax;
2165  nMSVal += (nVal * 65536) / nMax;
2166  return nMSVal;
2167  } else {
2168  // negative fraction does not have "-0", fractional part is always
2169  // positive: -0.4 represented as -1 + 0.6
2170  sal_Int32 const nDiv = (nVal / sal_Int32(nMax)) - 1;
2171  sal_uInt32 nMSVal = (sal_uInt32(nDiv) << 16) & 0xffff0000;
2172  nMSVal += (nVal * 65536) / sal_Int32(nMax) + (-nDiv * 65536);
2173  return nMSVal;
2174  }
2175  }
2176  return 0;
2177 }
2178 
2180 {
2182 }
2183 
2185 {
2186  if( SvStream* pPicStrm = static_cast< SwEscherExGlobal& >( *mxGlobal ).GetPictureStream() )
2187  {
2188  // set the blip - entries to the correct stream pos
2189  sal_Int32 nEndPos = pPicStrm->Tell();
2190  mxGlobal->WriteBlibStoreEntry(*pEscherStrm, 1, nEndPos);
2191 
2192  pPicStrm->Seek(0);
2193  pEscherStrm->WriteStream( *pPicStrm );
2194  }
2195 }
2196 
2198  : SwBasicEscherEx(pStrm, rWW8Wrt),
2199  pTextBxs(nullptr)
2200 {
2203 
2204  sal_uInt16 nColorCount = 4;
2205  pStrm ->WriteUInt16( nColorCount << 4 ) // instance
2206  .WriteUInt16( ESCHER_SplitMenuColors ) // record type
2207  .WriteUInt32( nColorCount * 4 ) // size
2208  .WriteUInt32( 0x08000004 )
2209  .WriteUInt32( 0x08000001 )
2210  .WriteUInt32( 0x08000002 )
2211  .WriteUInt32( 0x100000f7 );
2212 
2213  CloseContainer(); // ESCHER_DggContainer
2214 
2215  sal_uInt8 i = 2; // for header/footer and the other
2216  PlcDrawObj *pSdrObjs = rWrt.m_pHFSdrObjs;
2217  pTextBxs = rWrt.m_pHFTextBxs;
2218 
2219  // if no header/footer -> skip over
2220  if (!pSdrObjs->size())
2221  {
2222  --i;
2223  pSdrObjs = rWrt.m_pSdrObjs;
2224  pTextBxs = rWrt.m_pTextBxs;
2225  }
2226 
2227  for( ; i--; pSdrObjs = rWrt.m_pSdrObjs, pTextBxs = rWrt.m_pTextBxs )
2228  {
2229  // "dummy char" (or any Count ?) - why? Only Microsoft knows it.
2230  GetStream().WriteChar( i );
2231 
2233 
2234  EnterGroup();
2235 
2236  sal_uLong nSecondShapeId = pSdrObjs == rWrt.m_pSdrObjs ? GenerateShapeId() : 0;
2237 
2238  // write now all Writer-/DrawObjects
2239  DrawObjPointerVector aSorted;
2240  MakeZOrderArrAndFollowIds(pSdrObjs->GetObjArr(), aSorted);
2241 
2242  sal_uInt32 nShapeId=0;
2243  for (auto& pObj : aSorted)
2244  {
2245  sal_Int32 nBorderThick=0;
2246  OSL_ENSURE(pObj, "impossible");
2247  if (!pObj)
2248  continue;
2249  const ww8::Frame &rFrame = pObj->maContent;
2250  const SwFrameFormat& rFormat = rFrame.GetFrameFormat();
2251 
2252  switch (rFrame.GetWriterType())
2253  {
2254  case ww8::Frame::eTextBox:
2255  case ww8::Frame::eOle:
2256  case ww8::Frame::eGraphic:
2257  nBorderThick = WriteFlyFrame(*pObj, nShapeId, aSorted);
2258  break;
2260  nShapeId = GenerateShapeId();
2261  WriteOCXControl(rFormat, nShapeId);
2262  break;
2263  case ww8::Frame::eDrawing:
2264  {
2266  const SdrObject* pSdrObj = rFormat.FindRealSdrObject();
2267  if (pSdrObj)
2268  {
2269  nShapeId = AddSdrObject(*pSdrObj);
2270  }
2271 #if OSL_DEBUG_LEVEL > 0
2272  else
2273  OSL_ENSURE( false, "Where is the SDR-Object?" );
2274 #endif
2275  }
2276  break;
2277  default:
2278  break;
2279  }
2280 
2281  if( !nShapeId )
2282  {
2283  nShapeId = AddDummyShape();
2284  }
2285 
2286  pObj->SetShapeDetails(nShapeId, nBorderThick);
2287  }
2288 
2289  EndSdrObjectPage(); // ???? Bugfix for 74724
2290 
2291  if( nSecondShapeId )
2292  {
2294 
2296  ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::Background,
2297  nSecondShapeId );
2298 
2299  EscherPropertyContainer aPropOpt;
2300  const SwFrameFormat &rFormat = rWrt.m_rDoc.GetPageDesc(0).GetMaster();
2301  const SfxPoolItem* pItem = nullptr;
2302  SfxItemState eState = rFormat.GetItemState(RES_BACKGROUND, true,
2303  &pItem);
2304  if (SfxItemState::SET == eState && pItem)
2305  {
2306  const SvxBrushItem* pBrush = static_cast<const SvxBrushItem*>(pItem);
2307  WriteBrushAttr(*pBrush, aPropOpt);
2308 
2310  if( ePos != GPOS_NONE && ePos != GPOS_AREA )
2311  {
2312  /* #i56806# 0x033F parameter specifies a 32-bit field of shape boolean properties.
2313  0x10001 means fBackground and fUsefBackground flag are true thus background
2314  picture will be shown as "tiled" fill.*/
2315  aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
2316  }
2317  }
2318  aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
2319  aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x00080008 );
2320  aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
2321  aPropOpt.AddOpt( ESCHER_Prop_lineWidth, 0 );
2322 
2323  aPropOpt.Commit( *pStrm );
2324 
2325  AddAtom( 4, ESCHER_ClientData );
2326  GetStream().WriteInt32( 1 );
2327 
2328  CloseContainer(); // ESCHER_SpContainer
2329  }
2330  CloseContainer(); // ESCHER_DgContainer
2331  }
2332 }
2333 
2335 {
2336 }
2337 
2339 {
2340  pEscherStrm->Seek(0);
2342  delete pEscherStrm;
2343  pEscherStrm = nullptr;
2344 }
2345 
2346 
2347 namespace
2348 {
2349  template<typename OrientType>
2350  void lcl_SetRelationOrient(OrientType& rOrient, const sw::WW8AnchorConv eConv, const std::function<void()>& fDefault)
2351  {
2352  switch(eConv)
2353  {
2355  // #i33818#
2356  rOrient.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
2357  break;
2359  rOrient.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
2360  break;
2362  rOrient.SetRelationOrient(text::RelOrientation::FRAME);
2363  break;
2365  rOrient.SetRelationOrient(text::RelOrientation::CHAR);
2366  break;
2368  rOrient.SetRelationOrient(text::RelOrientation::TEXT_LINE);
2369  break;
2370  default:
2371  fDefault();
2372  }
2373  }
2374 }
2401  SwFormatVertOrient& _iorVertOri,
2402  const SwFrameFormat& _rFrameFormat )
2403 {
2404  const RndStdIds eAnchor = _rFrameFormat.GetAnchor().GetAnchorId();
2405 
2406  if ( (RndStdIds::FLY_AS_CHAR == eAnchor) || (RndStdIds::FLY_AT_FLY == eAnchor) )
2407  {
2408  // no conversion for as-character or at frame anchored objects
2409  return false;
2410  }
2411 
2412  // determine value of attribute 'Follow text flow', because positions aligned
2413  // at page areas have to be converted, if it's set.
2414  const bool bFollowTextFlow = _rFrameFormat.GetFollowTextFlow().GetValue();
2415 
2416  // check, if horizontal and vertical position have to be converted due to
2417  // the fact, that the object is anchored at a paragraph, which has a "column
2418  // break before" attribute
2419  bool bConvDueToAnchoredAtColBreakPara( false );
2420  if ( ( (eAnchor == RndStdIds::FLY_AT_PARA) || (eAnchor == RndStdIds::FLY_AT_CHAR) ) &&
2421  _rFrameFormat.GetAnchor().GetContentAnchor() &&
2422  _rFrameFormat.GetAnchor().GetContentAnchor()->nNode.GetNode().IsTextNode() )
2423  {
2424  SwTextNode& rAnchorTextNode =
2425  dynamic_cast<SwTextNode&>(_rFrameFormat.GetAnchor().GetContentAnchor()->nNode.GetNode());
2426  const SvxFormatBreakItem& rBreak = ItemGet<SvxFormatBreakItem>(rAnchorTextNode, RES_BREAK);
2427  if (rBreak.GetBreak() == SvxBreak::ColumnBefore)
2428  {
2429  bConvDueToAnchoredAtColBreakPara = true;
2430  }
2431  }
2432 
2435  // convert horizontal position, if needed
2436  {
2437 
2438  // determine, if conversion has to be performed due to the position orientation
2439  bool bConvDueToOrientation( false );
2440  {
2441  const sal_Int16 eHOri = _iorHoriOri.GetHoriOrient();
2442  bConvDueToOrientation = eHOri == text::HoriOrientation::LEFT || eHOri == text::HoriOrientation::RIGHT ||
2443  eHOri == text::HoriOrientation::INSIDE || eHOri == text::HoriOrientation::OUTSIDE ||
2444  ( eHOri != text::HoriOrientation::CENTER && _iorHoriOri.IsPosToggle() );
2445  }
2446 
2447  // determine conversion type due to the position relation
2448  if ( bConvDueToAnchoredAtColBreakPara )
2449  {
2450  eHoriConv = sw::WW8AnchorConv::CONV2PG;
2451  }
2452  else if ( _iorHoriOri.IsPosToggle()
2453  && _iorHoriOri.GetHoriOrient() == text::HoriOrientation::RIGHT )
2454  {
2455  eHoriConv = sw::WW8AnchorConv::NO_CONV;
2456  _iorHoriOri.SetHoriOrient( text::HoriOrientation::OUTSIDE );
2457  }
2458  else
2459  {
2460  switch ( _iorHoriOri.GetRelationOrient() )
2461  {
2462  case text::RelOrientation::PAGE_FRAME:
2463  case text::RelOrientation::PAGE_PRINT_AREA:
2464  {
2465  if ( bConvDueToOrientation || bFollowTextFlow )
2466  eHoriConv = sw::WW8AnchorConv::CONV2PG;
2467  }
2468  break;
2469  case text::RelOrientation::PAGE_LEFT:
2470  case text::RelOrientation::PAGE_RIGHT:
2471  {
2472  // relation not supported by WW8. Thus, conversion always needed.
2473  eHoriConv = sw::WW8AnchorConv::CONV2PG;
2474  }
2475  break;
2476  case text::RelOrientation::FRAME:
2477  {
2478  if ( bConvDueToOrientation )
2480  }
2481  break;
2482  case text::RelOrientation::PRINT_AREA:
2483  case text::RelOrientation::FRAME_LEFT:
2484  case text::RelOrientation::FRAME_RIGHT:
2485  {
2486  // relation not supported by WW8. Thus, conversion always needed.
2488  }
2489  break;
2490  case text::RelOrientation::CHAR:
2491  {
2492  if ( bConvDueToOrientation )
2493  eHoriConv = sw::WW8AnchorConv::CONV2CHAR;
2494  }
2495  break;
2496  default:
2497  OSL_FAIL( "<WinwordAnchoring::ConvertPosition(..)> - unknown horizontal relation" );
2498  }
2499  }
2500  }
2501 
2502  // convert vertical position, if needed
2503  {
2504 
2505  // determine, if conversion has to be performed due to the position orientation
2506  bool bConvDueToOrientation( false );
2507  {
2508  const sal_Int16 eVOri = _iorVertOri.GetVertOrient();
2509  bConvDueToOrientation = ( eVOri == text::VertOrientation::TOP ||
2510  eVOri == text::VertOrientation::BOTTOM ||
2511  eVOri == text::VertOrientation::CHAR_TOP ||
2512  eVOri == text::VertOrientation::CHAR_BOTTOM ||
2513  eVOri == text::VertOrientation::CHAR_CENTER ||
2514  eVOri == text::VertOrientation::LINE_TOP ||
2515  eVOri == text::VertOrientation::LINE_BOTTOM ||
2516  eVOri == text::VertOrientation::LINE_CENTER );
2517  }
2518 
2519  // determine conversion type due to the position relation
2520  if ( bConvDueToAnchoredAtColBreakPara )
2521  {
2522  eVertConv = sw::WW8AnchorConv::CONV2PG;
2523  }
2524  else
2525  {
2526  switch ( _iorVertOri.GetRelationOrient() )
2527  {
2528  case text::RelOrientation::PAGE_FRAME:
2529  case text::RelOrientation::PAGE_PRINT_AREA:
2530  {
2531  if ( bConvDueToOrientation || bFollowTextFlow )
2532  eVertConv = sw::WW8AnchorConv::CONV2PG;
2533  }
2534  break;
2535  case text::RelOrientation::FRAME:
2536  {
2537  if ( bConvDueToOrientation ||
2538  _iorVertOri.GetVertOrient() == text::VertOrientation::CENTER )
2539  {
2541  }
2542  }
2543  break;
2544  case text::RelOrientation::PRINT_AREA:
2545  {
2546  // relation not supported by WW8. Thus, conversion always needed.
2548  }
2549  break;
2550  case text::RelOrientation::CHAR:
2551  {
2552  // relation not supported by WW8. Thus, conversion always needed.
2554  }
2555  break;
2556  case text::RelOrientation::TEXT_LINE:
2557  {
2558  if ( bConvDueToOrientation ||
2559  _iorVertOri.GetVertOrient() == text::VertOrientation::NONE )
2560  {
2561  eVertConv = sw::WW8AnchorConv::CONV2LINE;
2562  }
2563  }
2564  break;
2565  case text::RelOrientation::PAGE_LEFT:
2566  case text::RelOrientation::PAGE_RIGHT:
2567  case text::RelOrientation::FRAME_LEFT:
2568  case text::RelOrientation::FRAME_RIGHT:
2569  default:
2570  OSL_FAIL( "<WinwordAnchoring::ConvertPosition(..)> - unknown vertical relation" );
2571  }
2572  }
2573 
2574  }
2575  if (eVertConv != sw::WW8AnchorConv::NO_CONV || eHoriConv != sw::WW8AnchorConv::NO_CONV)
2576  {
2577  sw::WW8AnchorConvResult aResult(eHoriConv, eVertConv);
2578  _rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult));
2579  if(!aResult.m_bConverted)
2580  return false;
2581  if (eHoriConv != sw::WW8AnchorConv::NO_CONV)
2582  {
2583  lcl_SetRelationOrient(_iorHoriOri, eHoriConv, [&_iorHoriOri]() {_iorHoriOri.SetHoriOrient(text::HoriOrientation::NONE);} );
2584  _iorHoriOri.SetPos(aResult.m_aPos.X());
2585  }
2586  if (eVertConv != sw::WW8AnchorConv::NO_CONV)
2587  {
2588  lcl_SetRelationOrient(_iorVertOri, eVertConv, [&_iorVertOri]() {_iorVertOri.SetVertOrient(text::VertOrientation::NONE);} );
2589  _iorVertOri.SetPos(aResult.m_aPos.Y());
2590  }
2591  return true;
2592  }
2593  return false;
2594 }
2595 
2597 {
2598  const RndStdIds eAnchor = rFormat.GetAnchor().GetAnchorId();
2599  mbInline = (eAnchor == RndStdIds::FLY_AS_CHAR);
2600 
2601  SwFormatHoriOrient rHoriOri = rFormat.GetHoriOrient();
2602  SwFormatVertOrient rVertOri = rFormat.GetVertOrient();
2603 
2604  // #i30669# - convert the positioning attributes.
2605  // Most positions are converted, if layout information exists.
2606  const bool bPosConverted = ConvertPosition( rHoriOri, rVertOri, rFormat );
2607 
2608  const sal_Int16 eHOri = rHoriOri.GetHoriOrient();
2609  const sal_Int16 eVOri = rVertOri.GetVertOrient(); // #i22673#
2610 
2611  const sal_Int16 eHRel = rHoriOri.GetRelationOrient();
2612  const sal_Int16 eVRel = rVertOri.GetRelationOrient();
2613 
2614  // horizontal Adjustment
2615  switch (eHOri)
2616  {
2617  default:
2619  mnXAlign = 0;
2620  break;
2621  case text::HoriOrientation::LEFT:
2622  mnXAlign = 1;
2623  break;
2624  case text::HoriOrientation::CENTER:
2625  mnXAlign = 2;
2626  break;
2627  case text::HoriOrientation::RIGHT:
2628  mnXAlign = 3;
2629  break;
2630  case text::HoriOrientation::INSIDE:
2631  mnXAlign = 4;
2632  break;
2633  case text::HoriOrientation::OUTSIDE:
2634  mnXAlign = 5;
2635  break;
2636  }
2637 
2638  // vertical Adjustment
2639  // #i22673#
2640  // When adjustment is vertically relative to line or to char
2641  // bottom becomes top and vice versa
2642  const bool bVertSwap = !bPosConverted &&
2643  ( (eVRel == text::RelOrientation::CHAR) ||
2644  (eVRel == text::RelOrientation::TEXT_LINE) );
2645  switch (eVOri)
2646  {
2647  default:
2649  mnYAlign = 0;
2650  break;
2651  case text::VertOrientation::TOP:
2652  case text::VertOrientation::LINE_TOP:
2653  case text::VertOrientation::CHAR_TOP:
2654  mnYAlign = bVertSwap ? 3 : 1;
2655  break;
2656  case text::VertOrientation::CENTER:
2657  case text::VertOrientation::LINE_CENTER:
2658  mnYAlign = 2;
2659  break;
2660  case text::VertOrientation::BOTTOM:
2661  case text::VertOrientation::LINE_BOTTOM:
2662  case text::VertOrientation::CHAR_BOTTOM:
2663  mnYAlign = bVertSwap ? 1 : 3;
2664  break;
2665  }
2666 
2667  // Adjustment is horizontally relative to...
2668  switch (eHRel)
2669  {
2670  case text::RelOrientation::PAGE_PRINT_AREA:
2671  mnXRelTo = 0;
2672  break;
2673  case text::RelOrientation::PAGE_FRAME:
2674  case text::RelOrientation::PAGE_LEFT: //:-(
2675  case text::RelOrientation::PAGE_RIGHT: //:-(
2676  mnXRelTo = 1;
2677  break;
2678  case text::RelOrientation::FRAME:
2679  case text::RelOrientation::FRAME_LEFT: //:-(
2680  case text::RelOrientation::FRAME_RIGHT: //:-(
2681  if (eAnchor == RndStdIds::FLY_AT_PAGE)
2682  mnXRelTo = 1;
2683  else
2684  mnXRelTo = 2;
2685  break;
2686  case text::RelOrientation::PRINT_AREA:
2687  if (eAnchor == RndStdIds::FLY_AT_PAGE)
2688  mnXRelTo = 0;
2689  else
2690  mnXRelTo = 2;
2691  break;
2692  case text::RelOrientation::CHAR:
2693  mnXRelTo = 3;
2694  break;
2695  case text::RelOrientation::TEXT_LINE:
2696  break;
2697  }
2698 
2699  // Adjustment is vertically relative to...
2700  switch (eVRel)
2701  {
2702  case text::RelOrientation::PAGE_PRINT_AREA:
2703  mnYRelTo = 0;
2704  break;
2705  case text::RelOrientation::PAGE_FRAME:
2706  mnYRelTo = 1;
2707  break;
2708  case text::RelOrientation::PRINT_AREA:
2709  if (eAnchor == RndStdIds::FLY_AT_PAGE)
2710  mnYRelTo = 0;
2711  else
2712  mnYRelTo = 2;
2713  break;
2714  case text::RelOrientation::FRAME:
2715  if (eAnchor == RndStdIds::FLY_AT_PAGE)
2716  mnYRelTo = 1;
2717  else
2718  mnYRelTo = 2;
2719  break;
2720  case text::RelOrientation::CHAR:
2721  case text::RelOrientation::TEXT_LINE: // #i22673# - vertical alignment at top of line
2722  case text::RelOrientation::PAGE_LEFT: //nonsense
2723  case text::RelOrientation::PAGE_RIGHT: //nonsense
2724  case text::RelOrientation::FRAME_LEFT: //nonsense
2725  case text::RelOrientation::FRAME_RIGHT: //nonsense
2726  mnYRelTo = 3;
2727  break;
2728  }
2729 }
2730 
2732 {
2735 
2737  GetStream().WriteInt32( 0 );
2738 
2740  GetStream().WriteInt32( 1 );
2741 }
2742 
2743 sal_Int32 SwEscherEx::WriteFlyFrame(const DrawObj &rObj, sal_uInt32 &rShapeId,
2744  DrawObjPointerVector &rPVec)
2745 {
2746  const SwFrameFormat &rFormat = rObj.maContent.GetFrameFormat();
2747 
2748  // check for textflyframe and if it is the first in a Chain
2749  sal_Int32 nBorderThick = 0;
2750  const SwNodeIndex* pNdIdx = rFormat.GetContent().GetContentIdx();
2751  if( pNdIdx )
2752  {
2753  SwNodeIndex aIdx( *pNdIdx, 1 );
2754  switch( aIdx.GetNode().GetNodeType() )
2755  {
2756  case SwNodeType::Grf:
2757  rShapeId = GenerateShapeId();
2758  nBorderThick = WriteGrfFlyFrame( rFormat, rShapeId );
2759  break;
2760  case SwNodeType::Ole:
2761  rShapeId = GenerateShapeId();
2762  nBorderThick = WriteOLEFlyFrame( rFormat, rShapeId );
2763  break;
2764  default:
2765  if (const SdrObject* pObj = rFormat.FindRealSdrObject())
2766  {
2767  // check for the first in a Chain
2768  sal_uInt32 nTextId;
2769  sal_uInt16 nOff = 0;
2770  const SwFrameFormat* pFormat = &rFormat, *pPrev;
2771  while( nullptr != ( pPrev = pFormat->GetChain().GetPrev() ))
2772  {
2773  ++nOff;
2774  pFormat = pPrev;
2775  }
2776 
2777  rShapeId = GetFlyShapeId(rFormat, rObj.mnHdFtIndex, rPVec);
2778  if( !nOff )
2779  {
2780  nTextId = pTextBxs->GetPos( pObj );
2781  if( USHRT_MAX == nTextId )
2782  {
2783  pTextBxs->Append( *pObj, rShapeId );
2784  nTextId = pTextBxs->Count();
2785  }
2786  else
2787  ++nTextId;
2788  }
2789  else
2790  {
2791  const SdrObject* pPrevObj = pFormat->FindRealSdrObject();
2792  nTextId = pTextBxs->GetPos( pPrevObj );
2793  if( USHRT_MAX == nTextId )
2794  {
2795  sal_uInt32 nPrevShapeId =
2796  GetFlyShapeId(*pFormat, rObj.mnHdFtIndex, rPVec);
2797  pTextBxs->Append( *pPrevObj, nPrevShapeId );
2798  nTextId = pTextBxs->Count();
2799  }
2800  else
2801  ++nTextId;
2802  }
2803  nTextId *= 0x10000;
2804  nTextId += nOff;
2805 
2806  nBorderThick = WriteTextFlyFrame(rObj, rShapeId, nTextId, rPVec);
2807  }
2808 
2809  //In browse mode the sdr object doesn't always exist. For example, the
2810  //object is in the hidden header/footer. We save the fmt directly
2811  //in such cases; we copy most of the logic from the block above
2812  const bool bBrowseMode = rFormat.getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE);
2813  if( bBrowseMode && rFormat.GetDoc())
2814  {
2815  if( !rFormat.GetChain().GetPrev() )//obj in header/footer?
2816  {
2817  rShapeId = GetFlyShapeId(rFormat, rObj.mnHdFtIndex, rPVec);
2818  pTextBxs->Append( &rFormat, rShapeId );
2819  sal_uInt32 nTextId = pTextBxs->Count();
2820 
2821  nTextId *= 0x10000;
2822  nBorderThick = WriteTextFlyFrame(rObj, rShapeId, nTextId, rPVec);
2823  }
2824  }
2825 
2826  }
2827  }
2828  return nBorderThick;
2829 }
2830 
2831 static sal_uInt16 FindPos(const SwFrameFormat &rFormat, unsigned int nHdFtIndex,
2832  DrawObjPointerVector &rPVec)
2833 {
2834  auto aIter = std::find_if(rPVec.begin(), rPVec.end(),
2835  [&rFormat, nHdFtIndex](const DrawObj* pObj) {
2836  OSL_ENSURE(pObj, "Impossible");
2837  return pObj &&
2838  nHdFtIndex == pObj->mnHdFtIndex &&
2839  &rFormat == (&pObj->maContent.GetFrameFormat());
2840  });
2841  if (aIter != rPVec.end())
2842  return static_cast< sal_uInt16 >(aIter - rPVec.begin());
2843  return USHRT_MAX;
2844 }
2845 
2846 sal_Int32 SwEscherEx::WriteTextFlyFrame(const DrawObj &rObj, sal_uInt32 nShapeId,
2847  sal_uInt32 nTextBox, DrawObjPointerVector &rPVec)
2848 {
2849  const SwFrameFormat &rFormat = rObj.maContent.GetFrameFormat();
2850  SvxFrameDirection nDirection = rObj.mnDirection;
2851 
2852  sal_Int32 nBorderThick=0;
2854 
2855  AddShape( ESCHER_ShpInst_TextBox, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty, nShapeId );
2856  EscherPropertyContainer aPropOpt;
2857  aPropOpt.AddOpt(ESCHER_Prop_lTxid, nTextBox);
2858  if (const SwFrameFormat *pNext = rFormat.GetChain().GetNext())
2859  {
2860  sal_uInt16 nPos = FindPos(*pNext, rObj.mnHdFtIndex, rPVec);
2861  if (USHRT_MAX != nPos && aFollowShpIds[nPos])
2862  aPropOpt.AddOpt(ESCHER_Prop_hspNext, aFollowShpIds[nPos]);
2863  }
2864  nBorderThick = WriteFlyFrameAttr( rFormat, mso_sptTextBox, aPropOpt );
2865 
2866  MSO_TextFlow nFlow;
2867 
2868  switch (nDirection)
2869  {
2870  default:
2871  OSL_ENSURE(false, "unknown direction type");
2872  [[fallthrough]];
2873  case SvxFrameDirection::Horizontal_LR_TB:
2874  nFlow=mso_txflHorzN;
2875  break;
2876  case SvxFrameDirection::Horizontal_RL_TB:
2877  nFlow=mso_txflHorzN;
2878  break;
2879  case SvxFrameDirection::Vertical_LR_TB: //not really possible in word
2880  case SvxFrameDirection::Vertical_RL_TB:
2881  nFlow=mso_txflTtoBA;
2882  break;
2883  case SvxFrameDirection::Vertical_LR_BT:
2884  nFlow = mso_txflBtoT;
2885  break;
2886  }
2887  aPropOpt.AddOpt( ESCHER_Prop_txflTextFlow, nFlow );
2888 
2889  aPropOpt.Commit( GetStream() );
2890 
2891  // store anchor attribute
2892  WriteFrameExtraData( rFormat );
2893 
2894  AddAtom( 4, ESCHER_ClientTextbox ); GetStream().WriteUInt32( nTextBox );
2895 
2896  CloseContainer(); // ESCHER_SpContainer
2897  return nBorderThick;
2898 }
2899 
2901  ShapeFlag nShapeFlags, const Graphic &rGraphic, const SdrObject &rObj,
2902  sal_uInt32 nShapeId, const awt::Rectangle* pVisArea )
2903 {
2904  //nShapeFlags == 0xA00 + flips and ole active
2905  AddShape(ESCHER_ShpInst_PictureFrame, nShapeFlags, nShapeId);
2906 
2907  GraphicObject aGraphicObject(rGraphic);
2908  OString aId = aGraphicObject.GetUniqueID();
2909  if (!aId.isEmpty())
2910  {
2911  // SJ: the third parameter (pVisArea) should be set...
2912  sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), aGraphicObject, pVisArea);
2913  if (nBlibId)
2914  rPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, true);
2915  }
2916 
2917  SetPicId(rObj, nShapeId, rPropOpt);
2918  rPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
2919 }
2920 
2921 void SwEscherEx::WriteOCXControl( const SwFrameFormat& rFormat, sal_uInt32 nShapeId )
2922 {
2923  const SdrObject* pSdrObj = rFormat.FindRealSdrObject();
2924  if (!pSdrObj)
2925  return;
2926 
2928 
2931  OSL_ENSURE(pModel && pDevice, "no model or device");
2932 
2933  // #i71538# use complete SdrViews
2934  // SdrExchangeView aExchange(pModel, pDevice);
2935  SdrView aExchange(*pModel, pDevice);
2936  const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pSdrObj));
2937  EscherPropertyContainer aPropOpt;
2938  WriteOLEPicture(aPropOpt,
2939  ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::OLEShape, aGraphic,
2940  *pSdrObj, nShapeId, nullptr );
2941 
2942  WriteFlyFrameAttr( rFormat, mso_sptPictureFrame , aPropOpt );
2943  aPropOpt.Commit( GetStream() );
2944 
2945  // store anchor attribute
2946  WriteFrameExtraData( rFormat );
2947 
2948  CloseContainer(); // ESCHER_SpContainer
2949 
2950 }
2951 
2953  std::vector<DrawObj>& rSrcArr, DrawObjPointerVector&rDstArr)
2954 {
2955  ::lcl_makeZOrderArray(rWrt, rSrcArr, rDstArr);
2956 
2957  //Now set up the follow IDs
2958  aFollowShpIds.clear();
2959 
2960  for (DrawObj* p : rDstArr)
2961  {
2962  const SwFrameFormat &rFormat = p->maContent.GetFrameFormat();
2963  bool bNeedsShapeId = false;
2964 
2965  if (RES_FLYFRMFMT == rFormat.Which())
2966  {
2967  const SwFormatChain &rChain = rFormat.GetChain();
2968  if (rChain.GetPrev() || rChain.GetNext())
2969  bNeedsShapeId = true;
2970  }
2971 
2972  sal_uLong nShapeId = bNeedsShapeId ? GenerateShapeId() : 0;
2973 
2974  aFollowShpIds.push_back(nShapeId);
2975  }
2976 }
2977 
2978 sal_uInt32 SwEscherEx::GetFlyShapeId(const SwFrameFormat& rFormat,
2979  unsigned int nHdFtIndex, DrawObjPointerVector &rpVec)
2980 {
2981  sal_uInt16 nPos = FindPos(rFormat, nHdFtIndex, rpVec);
2982  sal_uInt32 nShapeId;
2983  if (USHRT_MAX != nPos)
2984  {
2985  nShapeId = aFollowShpIds[nPos];
2986  if (0 == nShapeId)
2987  {
2988  nShapeId = GenerateShapeId();
2989  aFollowShpIds[ nPos ] = nShapeId;
2990  }
2991  }
2992  else
2993  nShapeId = GenerateShapeId();
2994  return nShapeId;
2995 }
2996 
2998  const uno::Reference< drawing::XShape>& xXShapeRef, sal_uInt32 nShapeId )
2999 {
3000  sal_uInt32 nId = 0;
3001  if (SdrObject* pObj = GetSdrObjectFromXShape(xXShapeRef))
3002  {
3003  pTextBxs->Append( *pObj, nShapeId );
3004  nId = pTextBxs->Count();
3005  nId *= 0x10000;
3006  }
3007  return nId;
3008 }
3009 
3011 ::ole::MSConvertOCXControls( pDSh ? pDSh->GetModel() : nullptr ), pPaM( pP ), mnObjectId(0)
3012 {
3013 }
3014 
3015 
3016 // in transitioning away old filter for ole/ocx controls, ReadOCXStream has been made pure virtual in
3017 // filter/source/msocximex.cxx, so... we need an implementation here
3019  css::uno::Reference< css::drawing::XShape > *pShapeRef,
3020  bool bFloatingCtrl )
3021 {
3022  uno::Reference< form::XFormComponent > xFComp;
3023  bool bRes = oox::ole::MSConvertOCXControls::ReadOCXStorage( rSrc1, xFComp );
3024  if ( bRes && xFComp.is() )
3025  {
3026  css::awt::Size aSz; // not used in import
3027  bRes = InsertControl( xFComp, aSz,pShapeRef,bFloatingCtrl);
3028  }
3029  return bRes;
3030 }
3031 
3033 {
3034  const uno::Reference< awt::XControlModel >& xControlModel =
3035  rFormObj.GetUnoControlModel();
3036 
3037  //Why oh lord do we use so many different units ?
3038  //I think I painted myself into a little bit of a
3039  //corner by trying to use the uno interface for
3040  //controls export
3041  tools::Rectangle aRect = rFormObj.GetLogicRect();
3042  aRect.SetPos(Point(0,0));
3043  awt::Size aSize;
3044  aSize.Width = TWIPS_TO_MM(aRect.Right());
3045  aSize.Height = TWIPS_TO_MM(aRect.Bottom());
3046 
3047  //Open the ObjectPool
3049 
3050  //Create a destination storage for the microsoft control
3051  sal_uInt32 nObjId = ++mnObjectId;
3052  OUString sStorageName = "_" + OUString::number( static_cast<sal_Int64>( nObjId ));
3053  tools::SvRef<SotStorage> xOleStg = xObjPool->OpenSotStorage(sStorageName);
3054 
3055  if (!xOleStg.is())
3056  return;
3057 
3058  OUString sUName;
3059  if (!WriteOCXStream( mxModel, xOleStg,xControlModel,aSize,sUName))
3060  return;
3061 
3062  sal_uInt8 aSpecOLE[] =
3063  {
3064  0x03, 0x6a, 0xFF, 0xFF, 0xFF, 0xFF, // sprmCPicLocation
3065  0x0a, 0x08, 1, // sprmCFOLE2
3066  0x55, 0x08, 1, // sprmCFSpec
3067  0x56, 0x08, 1 // sprmCFObj
3068  };
3069  //Set the obj id into the sprmCPicLocation
3070  sal_uInt8 *pData = aSpecOLE+2;
3071  Set_UInt32(pData,nObjId );
3072 
3073  OUString sField = FieldString(ww::eCONTROL) + "Forms." + sUName + ".1 \\s ";
3074 
3075  rWW8Wrt.OutputField(nullptr, ww::eCONTROL, sField,
3077 
3078  rWW8Wrt.m_pChpPlc->AppendFkpEntry(rWW8Wrt.Strm().Tell(),sizeof(aSpecOLE),
3079  aSpecOLE);
3080  rWW8Wrt.WriteChar( 0x1 );
3081  rWW8Wrt.OutputField(nullptr, ww::eCONTROL, OUString(), FieldFlags::End | FieldFlags::Close);
3082 }
3083 
3084 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
mso_lineSolid
sal_uInt16 Count() const
Point TopLeft() const
constexpr TypedWhichId< SwCropGrf > RES_GRFATR_CROPGRF(132)
constexpr TypedWhichId< SwDrawModeGrf > RES_GRFATR_DRAWMODE(142)
bool GetValue() const
sal_Int32 nCurrentSwPos
Definition: wrtww8.hxx:1455
bool is() const
#define ESCHER_DgContainer
virtual void RegisterWithFib(WW8Fib &rFib, sal_uInt32 nStart, sal_uInt32 nLen) const override
Definition: wrtw8esh.cxx:852
void SetPos(const Point &rPoint)
bool IsContour() const
Definition: fmtsrnd.hxx:53
SvStream * pEscherStrm
Definition: escher.hxx:98
eFORMDROPDOWN
Exporter of the binary Word file formats.
Definition: wrtww8.hxx:983
sal_uInt32 mnObjectId
Definition: ww8par.hxx:753
void OutAttr(sal_Int32 nSwPos)
Definition: wrtw8esh.cxx:1115
virtual AttributeOutputBase & AttrOutput() const =0
Access to the attribute output class.
constexpr TypedWhichId< SfxInt16Item > RES_CHRATR_BIDIRTL(44)
sal_Int32 WhereNext() const
Definition: wrtww8.hxx:1482
const sw::BroadcastingModify * m_pOutFormatNode
Definition: wrtww8.hxx:534
SwNoTextNode * GetNoTextNodeFromSwFrameFormat(const SwFrameFormat &rFormat)
Get the SwNoTextNode associated with a SwFrameFormat if here is one.
sal_Int64 GetAspect() const
Definition: ndole.hxx:136
WW8AnchorConv
Definition: frmfmt.hxx:296
static ShapeFlag AddMirrorFlags(ShapeFlag nFlags, const SwMirrorGrf &rMirror)
Definition: wrtw8esh.cxx:1544
std::unique_ptr< ww::bytes > pO
Buffer.
Definition: wrtww8.hxx:986
SvStream * pTableStrm
Definition: wrtww8.hxx:988
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
unsigned int GetHdFtIndex() const
Definition: wrtww8.hxx:1126
sal_uInt8 GetAlpha() const
bool IsSaveRelFSys() const
void OutSwString(const OUString &, sal_Int32 nStt, sal_Int32 nLen)
Definition: wrtww8.cxx:1828
bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, SwTwips nPageRight, SwTwips nPageSize)
Definition: wrtw8esh.cxx:528
sal_Int32 GetLeft() const
void OutEEField(const SfxPoolItem &rHt)
Definition: wrtw8esh.cxx:1097
std::unique_ptr< WW8_WrPlcField > m_pFieldHFTextBxs
Definition: wrtww8.hxx:527
std::unique_ptr< WW8Fib > pFib
File Information Block.
Definition: wrtww8.hxx:990
virtual AttributeOutputBase & AttrOutput() const override
memory leak #i120098#, to hold the reference to unnamed SotStorage obj
Definition: wrtww8.cxx:3912
sal_uInt32 GetSdrOrdNum(const SwFrameFormat &rFormat) const
Definition: wrtw8esh.cxx:948
#define ESCHER_Prop_dyWrapDistBottom
constexpr sal_uInt16 EE_FEATURE_TAB(EE_FEATURE_START+0)
mso_lineDouble
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:161
void WriteStringAsPara(const OUString &rText)
Definition: wrtww8.cxx:1772
#define ESCHER_Prop_pictureId
rtl_TextEncoding GetNodeCharSet() const
Definition: wrtww8.hxx:1484
#define ESCHER_Prop_pictureActive
#define ESCHER_Prop_dyTextTop
SvStream & WriteInt32(sal_Int32 nInt32)
#define ESCHER_Prop_cropFromBottom
std::vector< sal_uLong > aFollowShpIds
Definition: escher.hxx:143
WW8_WrPlcTextBoxes * pTextBxs
Definition: escher.hxx:146
std::unique_ptr< ContentProperties > pData
std::string GetValue
tools::Long getWidth() const
OBJ_GRUP
const SfxItemPool * pEditPool
Definition: wrtww8.hxx:1450
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
void OutParaAttr(bool bCharAttr, const std::set< sal_uInt16 > *pWhichsToIgnore=nullptr)
Definition: wrtw8esh.cxx:1272
const_iterator find(const value_type &x) const
Definition: docfmt.cxx:2062
#define ESCHER_Prop_pictureBrightness
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
SwNodeIndex nNode
Definition: pam.hxx:37
std::shared_ptr< SvStream > mxPicStrm
Definition: escher.hxx:89
GPOS_NONE
const_iterator begin() const
#define ESCHER_Prop_lineWidth
void WriteOCXControl(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:2921
SvxBreak GetBreak() const
static sal_uInt16 FindPos(const SwFrameFormat &rFormat, unsigned int nHdFtIndex, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:2831
void SetShapeDetails(sal_uInt32 nId, sal_Int32 nThick)
Definition: wrtw8esh.cxx:902
std::vector< sal_uInt8 > bytes
Definition: types.hxx:29
virtual Size GetTwipSize() const =0
SwTwips GetPos() const
Definition: fmtornt.hxx:92
sal_uIntPtr sal_uLong
long Long
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: atrfrm.cxx:2659
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
OBJ_LINE
void SetCharSet(const EECharAttrib &rTextAttr, bool bStart)
Definition: wrtw8esh.cxx:1071
void Commit(SvStream &rSt, sal_uInt16 nVersion=3, sal_uInt16 nRecType=ESCHER_OPT)
#define ESCHER_Prop_pib
bool MiserableFormFieldExportHack(const SwFrameFormat &rFrameFormat)
Definition: wrtw8esh.cxx:351
sal_Int64 n
static sal_Int32 GetEscherLineMatch(MSO_LineStyle eStyle, MSO_SPT eShapeType, sal_Int32 &rThick)
Definition: ww8graf.cxx:1500
sal_uInt32 AddSdrObject(const SdrObject &rObj, bool ooxmlExport=false)
size_t GetObjCount() const
sal_Int32 nPara
Definition: wrtww8.hxx:1454
const GraphicObject * GetGraphicObject(OUString const &referer=OUString()) const
const EditTextObject * pEditObj
Definition: wrtww8.hxx:1449
virtual ~PlcDrawObj()
Definition: wrtw8esh.cxx:520
aBuf
#define ESCHER_ClientAnchor
#define ESCHER_Prop_lineStyle
virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat &rFormat, MSO_SPT eShapeType, EscherPropertyContainer &rPropOpt) override
Definition: wrtw8esh.cxx:2071
#define ESCHER_Prop_cropFromLeft
const SfxPoolItem * pAttr
sal_Int16 nId
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
virtual bool CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 nWhich)=0
Guess the script (asian/western).
sal_uInt16 FirstWhich()
bool IsLinkedFile() const
Definition: ndgrf.hxx:164
css::uno::Reference< css::frame::XModel2 > mxModel
sal_uInt64 Seek(sal_uInt64 nPos)
virtual WW8_CP GetCpOffset(const WW8Fib &rFib) const override
Definition: wrtw8esh.cxx:871
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
SwNode & GetNode() const
Definition: ndindex.hxx:119
OUString aId
static void WriteString8(SvStream &rStrm, std::u16string_view rStr, bool bAddZero, rtl_TextEncoding eCodeSet)
Definition: wrtww8.cxx:1759
#define ESCHER_Prop_txflTextFlow
void setResult(sal_uInt8 nResult)
Definition: WW8FFData.hxx:72
SvxFrameDirection
static OUString GetRelURL(OUString const &rTheBaseURIRef, OUString const &rTheAbsURIRef, EncodeMechanism eEncodeMechanism=EncodeMechanism::WasEncoded, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
SvxFrameDirection GetTextDirection(const SwPosition &rPos, const Point *pPt=nullptr) const
Definition: doclay.cxx:1610
sal_Int32 WriteOLEFlyFrame(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:1783
void addListboxEntry(const OUString &rEntry)
Definition: WW8FFData.cxx:63
void SetAnchoring(const SwFrameFormat &rFormat)
Definition: wrtw8esh.cxx:2596
WW8_CP Fc2Cp(sal_uLong nFc) const
Definition: wrtww8.hxx:1095
virtual void AddShape(sal_uInt32 nShpInstance, ShapeFlag nFlagIds, sal_uInt32 nShapeID=0)
eCONTROL
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
std::unique_ptr< WW8_WrPlcField > m_pFieldTextBxs
Definition: wrtww8.hxx:526
void Set_UInt32(sal_uInt8 *&p, sal_uInt32 n)
Definition: ww8struc.hxx:53
std::shared_ptr< T > make_shared(Args &&...args)
void AppendFlyInFlys(const ww8::Frame &rFrameFormat, const Point &rNdTopLeft)
Definition: wrtw8esh.cxx:968
DrawObjVector & GetObjArr()
Definition: wrtww8.hxx:375
virtual SdrObjKind GetObjIdentifier() const
virtual SvxBrushItem * Clone(SfxItemPool *pPool=nullptr) const override
Used to export formatted text associated to drawings.
Definition: wrtww8.hxx:1446
const sal_uInt32 nInlineHack
Definition: escher.hxx:27
bool IsTextEditActive() const
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:55
virtual void WriteFrameExtraData(const SwFrameFormat &rFormat) override
Definition: wrtw8esh.cxx:2731
EmbeddedObjectRef * pObject
std::shared_ptr< EscherExGlobal > mxGlobal
const SfxItemSet * GetCurItemSet() const
Getter for pISet.
Definition: wrtww8.hxx:725
#define ESCHER_ClientTextbox
css::chart::ChartAxisLabelPosition ePos
OUString FieldString(ww::eField eIndex)
Definition: ww8atr.cxx:2612
std::shared_ptr< SvxBrushItem > TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const
Definition: wrtw8nds.cxx:1673
bool ReadOCXStorage(tools::SvRef< SotStorage > const &rSrc1, css::uno::Reference< css::form::XFormComponent > &rxFormComp)
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:743
static bool WriteOCXStream(const css::uno::Reference< css::frame::XModel > &rxModel, tools::SvRef< SotStorage > const &rSrc1, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size &rSize, OUString &rName)
const OUString & GetHelp() const
Definition: expfld.cxx:1409
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
virtual WW8_CP GetCpOffset(const WW8Fib &) const override
Definition: wrtw8esh.cxx:859
constexpr TypedWhichId< SwLuminanceGrf > RES_GRFATR_LUMINANCE(134)
sal_uInt16 NextWhich()
virtual void SetPicId(const SdrObject &rSdrObj, sal_uInt32 nShapeId, EscherPropertyContainer &rPropOpt) override
Definition: wrtw8esh.cxx:1774
virtual void SetPicId(const SdrObject &, sal_uInt32, EscherPropertyContainer &)
Definition: wrtw8esh.cxx:1769
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
virtual sal_uInt32 GenerateShapeId()
virtual const tools::Rectangle & GetSnapRect() const
static OutputDevice * GetDefaultDevice()
static bool ConvertPosition(SwFormatHoriOrient &_iorHoriOri, SwFormatVertOrient &_iorVertOri, const SwFrameFormat &_rFrameFormat)
method to perform conversion of positioning attributes with the help of corresponding layout informat...
Definition: wrtw8esh.cxx:2400
tools::Long getHeight() const
mso_lineThickThin
mso_sptPictureFrame
SwDoc & m_rDoc
Definition: docbm.cxx:1205
#define ESCHER_Prop_dxWrapDistLeft
SvStream & GetStream() const
SwEscherEx * m_pEscher
Definition: wrtww8.hxx:540
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
virtual sal_uInt32 QueryTextID(const css::uno::Reference< css::drawing::XShape > &, sal_uInt32) override
Definition: wrtw8esh.cxx:2997
const SfxPoolItem * NextItem()
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:766
SvxGraphicPosition GetGraphicPos() const
void WritePlc(WW8Export &rWrt) const
Definition: wrtw8esh.cxx:615
#define ESCHER_Prop_wzName
virtual sal_Int32 WriteFlyFrameAttr(const SwFrameFormat &rFormat, MSO_SPT eShapeType, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:1885
MSO_LineDashing
SvxShadowLocation GetLocation() const
SotStorage * OpenSotStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool transacted=true)
virtual void OutputField(const SwField *pField, ww::eField eFieldType, const OUString &rFieldCmd, FieldFlags nMode=FieldFlags::All) override
Write the field.
Definition: ww8atr.cxx:1758
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
void SetHoriOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:89
SwNodeType GetNodeType() const
Definition: node.hxx:144
tools::Long Left() const
MSWordExportBase & m_rExport
Definition: wrtww8.hxx:1436
MSO_SPT
void Flush(SvStream *pPicStreamMergeBSE=nullptr)
static Graphic GetObjGraphic(const SdrObject &rSdrObject)
OString GetUniqueID() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
#define INET_FILE_SCHEME
#define X
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
void WriteHyperlinkWithinFly(SvMemoryStream &rStrm, const SwFormatURL *pINetFormatArg)
Definition: wrtw8esh.cxx:166
SwBasicEscherEx(SvStream *pStrm, WW8Export &rWrt)
Definition: wrtw8esh.cxx:1515
SwMSConvertControls(SfxObjectShell const *pDSh, SwPaM *pP)
Definition: wrtw8esh.cxx:3010
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
#define DFF_msofbtUDefProp
tools::Long Bottom() const
const SvxBrushItem * GetCurrentPageBgBrush() const
Definition: wrtw8nds.cxx:1654
sal_Int32 SearchNext(sal_Int32 nStartPos)
Definition: wrtw8esh.cxx:1049
bool m_bInWriteEscher
Definition: wrtww8.hxx:555
void SetClientData(EscherExClientRecord_Base *p)
void Width(tools::Long nNew)
Definition: swrect.hxx:187
bool Append(WW8Export const &, WW8_CP nCp, const ww8::Frame &rFormat, const Point &rNdTopLeft)
Definition: wrtw8esh.cxx:876
sal_uInt32 RGBToBGR(::Color nColour)
Definition: ww8struc.hxx:1088
SvStream & WriteUInt32(sal_uInt32 nUInt32)
const SfxItemSet & GetParaAttribs(sal_Int32 nPara) const
sal_uInt32 mnXAlign
Definition: escher.hxx:71
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
Degree100 NormAngle36000(Degree100 deg100)
const Graphic * GetGraphic(OUString const &referer=OUString()) const
mso_txflHorzN
virtual void RawText(const OUString &rText, rtl_TextEncoding eCharSet)=0
Output text (without markup).
MainTextPlcDrawObj * m_pSdrObjs
Definition: wrtww8.hxx:537
void WriteChar(sal_Unicode c) override
Definition: wrtww8.cxx:1865
INetProtocol
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
Definition: ndgrf.cxx:494
sal_uInt64 remainingSize()
void WriteBrushAttr(const SvxBrushItem &rBrush, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:1842
WW8_WrPlcTextBoxes * m_pTextBxs
Definition: wrtww8.hxx:501
SdrLayerID GetInvisibleHellId() const
Definition: wrtw8esh.cxx:2179
static sal_Int32 ToFract16(sal_Int32 nVal, sal_uInt32 nMax)
Definition: wrtw8esh.cxx:2158
#define ESCHER_Prop_fillOpacity
void OutputItem(const SfxPoolItem &rHt)
Call the right virtual function according to the type of the item.
Definition: ww8atr.cxx:5211
OUString BuildFileName(sal_uInt16 &rnLevel, bool &rbRel, const OUString &rUrl)
Definition: wrtw8esh.cxx:131
void WriteGrfBullet(const Graphic &)
Definition: wrtw8esh.cxx:1565
OUString GetBasePath() const
Definition: wrtw8esh.cxx:113
const char * sName
sal_uInt32 AddDummyShape()
SvStream * QueryPictureStream()
OUString GetText(sal_Int32 nPara) const
sal_Int32 m_lcbPlcfspaMom
Definition: ww8scan.hxx:1387
const OUString & GetName() const
Definition: fmturl.hxx:71
const SwFrameFormat & GetFrameFormat() const
Get the writer SwFrameFormat that this object describes.
#define ESCHER_Prop_dyTextBottom
#define ESCHER_Prop_cropFromTop
SvxFrameDirection mnDirection
Definition: wrtww8.hxx:347
int size()
Definition: wrtww8.hxx:374
GraphicDrawMode
virtual SdrLayerID GetInvisibleHellId() const =0
#define ESCHER_Prop_fNoLineDrawDash
void ExportControl(WW8Export &rWrt, const SdrUnoObj &rFormObj)
Definition: wrtw8esh.cxx:3032
static void WriteString16(SvStream &rStrm, const OUString &rStr, bool bAddZero)
Definition: wrtww8.cxx:1736
#define ESCHER_Prop_lineDashing
const Color & GetColor() const
std::unique_ptr< OutlinerParaObject > CreateEditOutlinerParaObject() const
#define DFF_Prop_shadowOffsetX
sal_Int32 nTmpSwPos
Definition: wrtww8.hxx:1456
ShapeFlag
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
const Color & GetColor() const
#define ESCHER_Prop_lineBackColor
#define ESCHER_ShpInst_TextBox
std::unique_ptr< WW8_WrPlcPn > m_pPapPlc
Definition: wrtww8.hxx:495
const SwFormatFollowTextFlow & GetFollowTextFlow(bool=true) const
const EditTextObject & GetTextObject() const
tools::Polygon CorrectWordWrapPolygonForExport(const tools::PolyPolygon &rPolyPoly, const SwNoTextNode *pNd, bool bCorrectCrop)
Undo all scaling / move tricks of the wrap polygon done during import.
Style of a layout element.
Definition: frmfmt.hxx:58
void setName(const OUString &rName)
Definition: WW8FFData.hxx:74
#define ESCHER_Prop_pictureContrast
#define SAL_MAX_INT32
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
void SetCurItemSet(const SfxItemSet *pS)
Setter for pISet.
Definition: wrtww8.hxx:728
EscherExHostAppData aHostData
Definition: escher.hxx:144
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
#define DFF_Prop_shadowOffsetY
SVXCORE_DLLPUBLIC SdrObject * GetSdrObjectFromXShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ESCHER_BlipFlagDoNotSave
WW8_CP m_ccpHdrTxbx
Definition: ww8scan.hxx:1215
void SetVertOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:56
virtual const SfxPoolItem * HasTextItem(sal_uInt16 nWhich) const override
Definition: wrtw8esh.cxx:1211
mso_lineDashGEL
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:882
#define STREAM_SEEK_TO_BEGIN
#define ESCHER_Prop_dxWrapDistRight
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
virtual void WritePictures() override
Definition: wrtw8esh.cxx:1483
sal_uInt32 mnXRelTo
Definition: escher.hxx:73
constexpr TypedWhichId< SwFormatURL > RES_URL(111)
ESCHER_BlipFlagLinkToFile
bool IsRelUrl() const
Definition: wrtw8esh.cxx:103
void SetSize(const Size &rSize)
sal_uInt16 GetPos(const void *p) const
Definition: wrtww8.hxx:1296
std::vector< rtl_TextEncoding > aChrSetArr
Definition: wrtww8.hxx:1453
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:60
virtual void RegisterWithFib(WW8Fib &rFib, sal_uInt32 nStart, sal_uInt32 nLen) const override
Definition: wrtw8esh.cxx:864
#define DFF_Prop_shadowColor
const OUString & GetValue() const
static void WriteShort(SvStream &rStrm, sal_Int16 nVal)
Definition: wrtww8.hxx:956
const Fraction & X() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void FinishEscher()
Definition: wrtw8esh.cxx:2338
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
rtl_TextEncoding eNdChrSet
Definition: wrtww8.hxx:1457
std::size_t WriteBytes(const void *pData, std::size_t nSize)
sal_Int32 DrawModelToEmu(sal_Int32 nVal) const
Definition: escher.hxx:110
SvxGraphicPosition
virtual bool InsertControl(const css::uno::Reference< css::form::XFormComponent > &rFComp, const css::awt::Size &rSize, css::uno::Reference< css::drawing::XShape > *pShape, bool bFloatingCtrl) override
Definition: ww8par3.cxx:2483
void MiserableRTLFrameFormatHack(SwTwips &rLeft, SwTwips &rRight, const ww8::Frame &rFrameFormat)
Nasty swap for bidi if necessary.
Definition: wrtw8esh.cxx:580
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
void WriteData(EscherEx &rEx) const override
Definition: wrtw8esh.cxx:1426
void DoComboBox(css::uno::Reference< css::beans::XPropertySet > const &xPropSet)
sal_uInt32 GetOrdNum() const
tools::Long mnEmuMul
Definition: escher.hxx:99
mso_txflBtoT
SwDoc & m_rDoc
Definition: wrtww8.hxx:571
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
mso_lineThinThick
SfxItemSet * GetItemSet() const
virtual void WriteCR(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner=ww8::WW8TableNodeInfoInner::Pointer_t()) override
Definition: wrtww8.cxx:1855
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:401
void setType(sal_uInt8 nType)
Definition: WW8FFData.hxx:70
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:31
#define DFF_Prop_pWrapPolygonVertices
sal_uInt16 GetSize() const
ESCHER_FillPicture
Marks a node in the document model.
Definition: ndindex.hxx:31
sal_uInt32 GetFlyShapeId(const SwFrameFormat &rFormat, unsigned int nHdFtIndex, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:2978
constexpr TypedWhichId< SwContrastGrf > RES_GRFATR_CONTRAST(135)
SwWW8Writer & GetWriter() const
Definition: wrtww8.hxx:1174
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
sal_Int32 WriteFlyFrame(const DrawObj &rObj, sal_uInt32 &rShapeId, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:2743
bool WriteText(WW8Export &rWrt)
Definition: wrtw8esh.cxx:908
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:140
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:741
WW8_CP m_ccpTxbx
Definition: ww8scan.hxx:1214
void Write(SvStream *pDataStrm)
Definition: WW8FFData.cxx:77
tools::Long Top() const
void GetCharAttribs(sal_Int32 nPara, std::vector< EECharAttrib > &rLst) const
#define ESCHER_Prop_dyWrapDistTop
GPOS_AREA
SvStream & WriteStream(SvStream &rStream)
bool IsSaveRelINet() const
void EndSdrObjectPage()
sal_uInt16 TransformWhichBetweenPools(const SfxItemPool &rDestPool, const SfxItemPool &rSrcPool, sal_uInt16 nWhich)
Map an ID valid in one SfxItemPool to its equivalent in another.
#define ESCHER_Prop_cropFromRight
HdFtPlcDrawObj * m_pHFSdrObjs
Definition: wrtww8.hxx:538
ESCHER_BlipFlagDefault
sal_Int32 nLineWidth
tools::Long SwTwips
Definition: swtypes.hxx:49
sal_Int32 m_lcbPlcfspaHdr
Definition: ww8scan.hxx:1392
tools::Long mnEmuDiv
Definition: escher.hxx:99
#define ESCHER_Prop_pibName
#define Y
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
#define ESCHER_Prop_fillBlip
virtual SdrInventor GetObjInventor() const
#define ESCHER_Prop_shadowColor
sal_uInt32 GetGroupLevel() const
sal_Int32 WW8_CP
Definition: ww8struc.hxx:153
void setStatus(const OUString &rStatus)
Definition: WW8FFData.cxx:57
virtual SdrLayerID GetHellId() const =0
#define ESCHER_Prop_fillBackColor
#define ESCHER_Prop_hspNext
virtual SdrLayerID GetLayer() const
void setHelp(const OUString &rHelp)
Definition: WW8FFData.cxx:51
sal_uInt32 mnYAlign
Definition: escher.hxx:72
eFORMTEXT
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual ~SwEscherEx() override
Definition: wrtw8esh.cxx:2334
std::size_t ReadBytes(void *pData, std::size_t nSize)
#define ESCHER_Prop_dxTextLeft
WW8_WrPlcTextBoxes * m_pHFTextBxs
Definition: wrtww8.hxx:501
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:62
sal_Int32 GetBottom() const
#define ESCHER_Prop_fillColor
const SwMirrorGrf & GetMirrorGrf(bool=true) const
Definition: grfatr.hxx:282
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:97
WW8_CP m_ccpEdn
Definition: ww8scan.hxx:1213
WW8_FC m_fcPlcfspaHdr
Definition: ww8scan.hxx:1389
sal_Int32 GetParagraphCount() const
#define ESCHER_DggContainer
constexpr sal_uInt16 RES_FRMATR_END(131)
virtual const std::vector< sal_uInt32 > * GetShapeIdArr() const override
Definition: wrtw8esh.cxx:943
sal_Int32 GetTop() const
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:216
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
bool IsFlyFrameFormatInHeader(const SwFrameFormat &rFormat)
Definition: atrfrm.cxx:3551
#define ESCHER_SpContainer
#define ESCHER_Prop_fBackground
unsigned int mnHdFtIndex
Definition: wrtww8.hxx:348
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
Definition: fldbas.cxx:455
bool IsPosToggle() const
Definition: fmtornt.hxx:95
static void WriteGrfAttr(const SwNoTextNode &rNd, const SwFrameFormat &rFormat, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:1662
SotStorage & GetStorage() const
Definition: shellio.hxx:494
void Append(const SdrObject &rObj, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:927
FrPair GetMapFactor(MapUnit eS, MapUnit eD)
mso_sptTextBox
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
virtual void CloseContainer()
SfxItemState
#define ESCHER_ShpInst_PictureFrame
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
void MakeZOrderArrAndFollowIds(std::vector< DrawObj > &rSrcArr, DrawObjPointerVector &rDstArr)
Definition: wrtw8esh.cxx:2952
sal_Int32 GetDenominator() const
SvStream & Strm() const
Definition: wrtww8.hxx:1175
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
void AddAtom(sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion=0, int nRecInstance=0)
sal_uInt8 mnTyp
Definition: wrtww8.hxx:1459
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
#define ESCHER_ShpInst_Rectangle
unsigned char sal_uInt8
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Make exporting a Writer Frame easy.
virtual void WriteFrameExtraData(const SwFrameFormat &)
Definition: wrtw8esh.cxx:1525
#define ESCHER_Prop_lineColor
bool IsRemote() const
void setWidth(tools::Long n)
SwTwips GetPos() const
Definition: fmtornt.hxx:59
#define ESCHER_Prop_fNoFillHitTest
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
const OUString & GetTargetFrameName() const
Definition: fmturl.hxx:65
sal_uInt16 nScript
Definition: wrtww8.hxx:1458
bool IsTextAttr(sal_Int32 nSwPos)
Definition: wrtw8esh.cxx:1195
virtual void OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance=0)
std::vector< EECharAttrib > aTextAtrArr
Definition: wrtww8.hxx:1451
virtual void WritePictures()
Definition: wrtw8esh.cxx:2184
void SetEndian(SvStreamEndian SvStreamEndian)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
MSO_TextFlow
bool HasMark() const
INetProtocol GetProtocol() const
MSWord_SdrAttrIter(const MSWord_SdrAttrIter &)=delete
#define ESCHER_Prop_fillType
SvxBoxItemLine
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
virtual sal_uInt32 EnterGroup(const OUString &rShapeName, const tools::Rectangle *pBoundRect)
MSO_LineStyle
static bool RTLDrawingsHack(SwTwips &rLeft, sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, SwTwips nPageRight, SwTwips nPageSize)
Definition: wrtw8esh.cxx:555
mso_txflTtoBA
#define TWIPS_TO_MM(val)
sal_uInt8 m_nTextTyp
Definition: wrtww8.hxx:544
void WriteSdrTextObj(const SdrTextObj &rObj, sal_uInt8 nTyp)
Definition: wrtw8esh.cxx:1314
#define DFF_Prop_fshadowObscured
virtual bool EndURL(bool isAtEndOfParagraph)=0
Output URL end.
sal_uInt64 Tell() const
void * p
void AddOpt(sal_uInt16 nPropID, bool bBlib, sal_uInt32 nSizeReduction, SvMemoryStream &rStream)
FIB - the File Information Block.
Definition: ww8scan.hxx:1103
void WriteEmptyFlyFrame(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:1531
sal_Int32 GetNumerator() const
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:382
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
WW8_CP m_ccpText
Definition: ww8scan.hxx:1208
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
sal_uInt16 Count() const
Definition: wrtww8.hxx:1295
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
WW8_CP m_ccpFootnote
Definition: ww8scan.hxx:1209
WW8_CP m_ccpAtn
Definition: ww8scan.hxx:1212
SvStream & WriteChar(char nChar)
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
static void InsUInt16(ww::bytes &rO, sal_uInt16 n)
Definition: wrtww8.cxx:1701
virtual ~SwEscherExGlobal() override
Definition: wrtw8esh.cxx:1503
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
void PreWriteHyperlinkWithinFly(const SwFrameFormat &rFormat, EscherPropertyContainer &rPropOpt)
Definition: wrtw8esh.cxx:274
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:717
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:363
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:93
virtual bool StartURL(const OUString &rUrl, const OUString &rTarget)=0
Output URL start.
sal_Int32 GetRight() const
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() const
virtual SvStream * ImplQueryPictureStream() override
Override to create a new memory stream for picture data.
Definition: wrtw8esh.cxx:1507
#define ESCHER_SplitMenuColors
const OUString & GetToolTip() const
Definition: expfld.cxx:1419
std::vector< const EECharAttrib * > aChrTextAtrArr
Definition: wrtww8.hxx:1452
bool m_bFontSizeWritten
Is font size written already as part of the current character properties?
Definition: wrtww8.hxx:568
SwEscherEx(SvStream *pStrm, WW8Export &rWW8Wrt)
Definition: wrtw8esh.cxx:2197
sal_Int32 WriteGrfFlyFrame(const SwFrameFormat &rFormat, sal_uInt32 nShapeId)
Definition: wrtw8esh.cxx:1602
SdrLayerID GetHellLayerId() const
ESCHER_BlipFlagURL
MapUnit
void CreateEscher()
Definition: wrtw8esh.cxx:1454
Base class for WW8Export and DocxExport.
Definition: wrtww8.hxx:448
OUString GetMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
RndStdIds
WW8_FC m_fcPlcfspaMom
Definition: ww8scan.hxx:1384
virtual Degree100 GetRotateAngle() const
constexpr sal_uInt16 EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
virtual const tools::Rectangle & GetLogicRect() const
if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
WinwordAnchoring aWinwordAnchoring
Definition: escher.hxx:145
bool IsInline() const
Is this frame inline (as character)
bool ReadOCXStream(tools::SvRef< SotStorage > const &rSrc1, css::uno::Reference< css::drawing::XShape > *pShapeRef, bool bFloatingCtrl=false)
Definition: wrtw8esh.cxx:3018
void WriteOutliner(const OutlinerParaObject &rOutliner, sal_uInt8 nTyp)
Definition: wrtw8esh.cxx:1342
WriterSource GetWriterType() const
Get the type of frame that this wraps.
virtual const SfxPoolItem & GetItem(sal_uInt16 nWhich) const override
Definition: wrtw8esh.cxx:1228
rtl_TextEncoding GetNextCharSet() const
Definition: wrtw8esh.cxx:1041
void SetItemsThatDifferFromStandard(bool bCharAttr, SfxItemSet &rSet)
Definition: wrtw8esh.cxx:1245
SwGrfNode * GetGrfNode()
Definition: ndgrf.hxx:154
std::vector< DrawObj * > DrawObjPointerVector
Definition: wrtww8.hxx:359
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:137
sal_uInt16 GetSetWhichFromSwDocWhich(const SfxItemSet &rSet, const SwDoc &rDoc, sal_uInt16 nWhich)
Map a SwDoc WhichId to the equivalent Id for a given SfxItemSet.
#define ESCHER_Prop_fPrint
virtual ~SwBasicEscherEx() override
Definition: wrtw8esh.cxx:1521
virtual void DoFormText(const SwInputField *pField) override
Definition: wrtw8esh.cxx:472
static sal_uInt32 GetColor(const sal_uInt32 nColor)
bool GetOpt(sal_uInt16 nPropertyID, sal_uInt32 &rPropValue) const
void WriteOLEPicture(EscherPropertyContainer &rPropOpt, ShapeFlag nShapeFlags, const Graphic &rGraphic, const SdrObject &rObj, sal_uInt32 nShapeId, const css::awt::Rectangle *pVisArea)
Definition: wrtw8esh.cxx:2900
void SetHellLayerId(SdrLayerID nId)
SwFlyFrameFormat * GetPrev() const
Definition: fmtcnct.hxx:53
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
mso_lineSimple
bool IsTextNode() const
Definition: node.hxx:639
#define ESCHER_Prop_pibFlags
The class MSWordAttrIter is a helper class to build the Fkp.chpx.
Definition: wrtww8.hxx:1429
static void WriteLong(SvStream &rStrm, sal_Int32 nVal)
Definition: wrtww8.hxx:959
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
ww8::Frame maContent
Definition: wrtww8.hxx:344
const SwPosition & GetPosition() const
Get the position this frame is anchored at.
virtual void WriteChar(sal_Unicode c)=0
aStr
WW8_CP m_ccpHdr
Definition: ww8scan.hxx:1210
void NextPara(sal_Int32 nPar)
Definition: wrtw8esh.cxx:1021
sal_uInt32 mnYRelTo
Definition: escher.hxx:74
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
virtual OUString GetPar2() const override
aPromptText
Definition: expfld.cxx:1399
std::unique_ptr< WW8_WrPlcPn > m_pChpPlc
Definition: wrtww8.hxx:496
tools::Long Right() const
sal_uInt16 Which() const
SvxFrameDirection TrueFrameDirection(const SwFrameFormat &rFlyFormat) const
Right to left?
Definition: wrtw8nds.cxx:1621
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2712
const Graphic & GetGrf(bool bWait=false) const
Definition: ndgrf.cxx:373
static void InsAsString16(ww::bytes &rO, const OUString &rStr)
Definition: wrtww8.cxx:1719
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
sal_Int32 WriteTextFlyFrame(const DrawObj &rObj, sal_uInt32 nShapeId, sal_uInt32 nTextBox, DrawObjPointerVector &rPVec)
Definition: wrtw8esh.cxx:2846
const Size & GetSize() const
void setHeight(tools::Long n)
sal_uInt16 nPos
mso_lineDotGEL
void WriteEscher()
Definition: wrtw8esh.cxx:1467
const SfxPoolItem * GetCurItem() const
#define ESCHER_Prop_lTxid
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
sal_Int16 nValue
#define ESCHER_ClientData
constexpr OUStringLiteral aObjectPool
Definition: ww8scan.hxx:44
#define ESCHER_Prop_pihlShape
const SvxFieldData * GetField() const
virtual const tools::Rectangle & GetLogicRect() const override
sal_uInt16 GetWidth() const
const OUString & GetURL() const
Definition: fmturl.hxx:66
SvxShadowLocation
#define ESCHER_Prop_dxTextRight
EnumT GetValue() const