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