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