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