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