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