LibreOffice Module sw (master) 1
ww8graf.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 <comphelper/string.hxx>
21#include <svl/urihelper.hxx>
22#include <hintids.hxx>
23#include <osl/endian.h>
24#include <sal/log.hxx>
25#include <editeng/lrspitem.hxx>
26#include <svx/xflbmtit.hxx>
27#include <svx/xfillit0.hxx>
28#include <svx/xlineit0.hxx>
29#include <svx/xlnclit.hxx>
30#include <svx/xlnwtit.hxx>
31#include <svx/xlndsit.hxx>
32#include <svx/xlnstit.hxx>
33#include <svx/xlnedit.hxx>
34#include <svx/xlnstwit.hxx>
35#include <svx/xlnedwit.hxx>
36#include <svx/xlnstcit.hxx>
37#include <svx/xlnedcit.hxx>
38#include <svx/xflclit.hxx>
39#include <svx/xbtmpit.hxx>
40#include <svx/svdmodel.hxx>
41#include <svx/svdocapt.hxx>
42#include <svx/sxctitm.hxx>
43#include <svx/sdggaitm.hxx>
44#include <svx/sdgluitm.hxx>
45#include <svx/sdgmoitm.hxx>
46#include <svx/sdmetitm.hxx>
47#include <svx/sdooitm.hxx>
48#include <svx/sdshitm.hxx>
49#include <svx/sdsxyitm.hxx>
50#include <svx/sdtagitm.hxx>
51#include <svx/sdtditm.hxx>
52#include <svx/sdtfsitm.hxx>
53#include <editeng/editeng.hxx>
54#include <svx/svdpage.hxx>
55#include <svx/svdopath.hxx>
56#include <svx/svdocirc.hxx>
57#include <editeng/outlobj.hxx>
58#include <svx/svdogrp.hxx>
59#include <svx/svdograf.hxx>
60#include <svx/svdoole2.hxx>
61#include <editeng/ulspitem.hxx>
62#include <editeng/brushitem.hxx>
63#include <editeng/opaqitem.hxx>
64#include <editeng/shaditem.hxx>
65#include <editeng/boxitem.hxx>
66#include <editeng/outliner.hxx>
68#include <svx/xfltrit.hxx>
70#include <grfatr.hxx>
71#include <fmtornt.hxx>
72#include <fmtcntnt.hxx>
73#include <frmfmt.hxx>
74#include <fmtanchr.hxx>
75#include <pam.hxx>
76#include <doc.hxx>
77#include <drawdoc.hxx>
79#include <ndgrf.hxx>
80#include <dcontact.hxx>
81#include <docsh.hxx>
82#include <mdiexp.hxx>
83#include "ww8struc.hxx"
84#include "ww8scan.hxx"
85#include "ww8par.hxx"
86#include "ww8par2.hxx"
87#include "ww8graf.hxx"
88#include <fmtinfmt.hxx>
89#include <editeng/eeitem.hxx>
90#include <editeng/flditem.hxx>
91#include <fmtfollowtextflow.hxx>
92#include "writerhelper.hxx"
93#include "writerwordglue.hxx"
96#include <editeng/editobj.hxx>
97#include <math.h>
98#include <fmturl.hxx>
99#include <o3tl/enumrange.hxx>
100#include <o3tl/safeint.hxx>
101#include <memory>
102#include <optional>
104#include <utility>
105#include "sprmids.hxx"
106
107using ::editeng::SvxBorderLine;
108using namespace ::com::sun::star;
109using namespace sw::types;
110using namespace sw::util;
111
112// helper methods
113static Color WW8TransCol(SVBT32 nWC)
114{
115#if 1 // 1 = use predefined color, 0 = ignore
116
117 // color table to convert RGB values to pre-defined colors
118 // (to make the writer UI show the right color names)
119 // the table is split in base 3, the greys are missing as
120 // they don't fit into that system (4 values: bw, wb, 2 * grey)
121 static const Color eColA[] = { // B G R B G R B G R
122 COL_BLACK, COL_RED, COL_LIGHTRED, // 0 0 0, 0 0 1, 0 0 2
123 COL_GREEN, COL_BROWN, COL_BLACK, // 0 1 0, 0 1 1, 0 1 2
124 COL_LIGHTGREEN, COL_BLACK, COL_YELLOW, // 0 2 0, 0 2 1, 0 2 2
125 COL_BLUE, COL_MAGENTA, COL_BLACK, // 1 0 0, 1 0 1, 1 0 2
126 COL_CYAN, COL_LIGHTGRAY, COL_BLACK, // 1 1 0, 1 1 1, 1 1 2
127 COL_BLACK, COL_BLACK, COL_BLACK, // 1 2 0, 1 2 1, 1 2 2
128 COL_LIGHTBLUE, COL_BLACK, COL_LIGHTMAGENTA, // 2 0 0, 2 0 1, 2 0 2
129 COL_BLACK, COL_BLACK, COL_BLACK, // 2 1 0, 2 1 1, 2 1 2
130 COL_LIGHTCYAN, COL_BLACK, COL_WHITE }; // 2 2 0, 2 2 1, 2 2 2
131
132 // In nWC[3] is a byte that's not described in the WW documentation.
133 // Its meaning appears to be the following: For 0, it's a normal color
134 // whose RGB values are in nWC[0..2]. If nWC[3] is 0x1, 0x7d or 0x83,
135 // it's a grey value whose black portion is given in 0.5% in nWC[0].
136 // I guess that BIT(0) in nWC[3] is relevant for distinguishing RGB/Grey.
137
138 if( !( nWC[3] & 0x1 ) && // not special (grey)
139 ( ( nWC[0] == 0 || nWC[0]== 0x80 || nWC[0] == 0xff ) // R
140 && ( nWC[1] == 0 || nWC[1]== 0x80 || nWC[1] == 0xff ) // G
141 && ( nWC[2] == 0 || nWC[2]== 0x80 || nWC[2] == 0xff ) ) ){// B
142 int nIdx = 0; // and now: Idx-calculation in base 3
143 for (int i = 2; i >= 0; i--)
144 {
145 nIdx *= 3;
146 if (nWC[i])
147 nIdx += ((nWC[i] == 0xff) ? 2 : 1);
148 }
149 if (eColA[nIdx] != COL_BLACK)
150 return eColA[nIdx]; // default color
151 }
152#endif
153
154 if (nWC[3] & 0x1)
155 {
156 // Special color gray
157 sal_uInt8 u = static_cast<sal_uInt8>( static_cast<sal_uLong>( 200 - nWC[0] ) * 256 / 200 );
158 return Color(u, u, u);
159 }
160
161 // User-Color
162 return Color(nWC[0], nWC[1], nWC[2]);
163}
164
165void wwFrameNamer::SetUniqueGraphName(SwFrameFormat *pFrameFormat, std::u16string_view rFixed)
166{
167 if (mbIsDisabled || rFixed.empty())
168 return;
169
170 pFrameFormat->SetFormatName(msSeed+OUString::number(++mnImportedGraphicsCount) + ": " + rFixed);
171}
172
173// ReadGrafStart reads object data and if necessary creates an anchor
174bool SwWW8ImplReader::ReadGrafStart(void* pData, short nDataSiz,
175 WW8_DPHEAD const * pHd, SfxAllItemSet &rSet)
176{
177 if (SVBT16ToUInt16(pHd->cb) < sizeof(WW8_DPHEAD) + nDataSiz)
178 {
179 OSL_ENSURE( false, "+graphic element: too short?" );
180 m_pStrm->SeekRel(SVBT16ToUInt16(pHd->cb) - sizeof(WW8_DPHEAD));
181 return false;
182 }
183
184 bool bCouldRead = checkRead(*m_pStrm, pData, nDataSiz);
185 OSL_ENSURE(bCouldRead, "Short Graphic header");
186 if (!bCouldRead)
187 return false;
188
189 SwFormatAnchor aAnchor( RndStdIds::FLY_AT_CHAR );
190 aAnchor.SetAnchor( m_pPaM->GetPoint() );
191 rSet.Put( aAnchor );
192
195
196 return true;
197}
198
199// SetStdAttr() sets standard attributes
200static void SetStdAttr( SfxItemSet& rSet, WW8_DP_LINETYPE& rL,
201 WW8_DP_SHADOW const & rSh )
202{
203 if( SVBT16ToUInt16( rL.lnps ) == 5 ){ // invisible
204 rSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
205 }else{ // visible
206 Color aCol( WW8TransCol( rL.lnpc ) ); // line color
207 rSet.Put( XLineColorItem( OUString(), aCol ) );
208 rSet.Put( XLineWidthItem( SVBT16ToUInt16( rL.lnpw ) ) );
209 // line thickness
210 if( SVBT16ToUInt16( rL.lnps ) >= 1
211 && SVBT16ToUInt16(rL.lnps ) <= 4 ){ // line style
212 rSet.Put( XLineStyleItem( drawing::LineStyle_DASH ) );
213 sal_Int16 nLen = SVBT16ToUInt16( rL.lnpw );
214 XDash aD( css::drawing::DashStyle_RECT, 1, 2 * nLen, 1, 5 * nLen, 5 * nLen );
215 switch( SVBT16ToUInt16( rL.lnps ) ){
216 case 1: aD.SetDots( 0 ); // Dash
217 aD.SetDashLen( 6 * nLen );
218 aD.SetDistance( 4 * nLen );
219 break;
220 case 2: aD.SetDashes( 0 ); break; // Dot
221 case 3: break; // Dash Dot
222 case 4: aD.SetDots( 2 ); break; // Dash Dot Dot
223 }
224 rSet.Put( XLineDashItem( OUString(), aD ) );
225 }else{
226 rSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) ); // needed for TextBox
227 }
228 }
229 if( SVBT16ToUInt16( rSh.shdwpi ) ){ // shadow
231 rSet.Put( makeSdrShadowXDistItem( SVBT16ToUInt16( rSh.xaOffset ) ) );
232 rSet.Put( makeSdrShadowYDistItem( SVBT16ToUInt16( rSh.yaOffset ) ) );
233 }
234}
235
236// SetFill() sets fill attributes such as fore- and background color and
237// pattern by reducing to a color
238// SetFill() doesn't yet set a pattern, because Sdr can't easily do that
239// and the Sdr hatching (XDash) isn't finished yet.
240// Instead, a mixed color will be picked that's between the selected ones.
241static void SetFill( SfxItemSet& rSet, WW8_DP_FILL& rFill )
242{
243 static const sal_uInt8 nPatA[] =
244 {
245 0, 0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80,
246 90, 50, 50, 50, 50, 50, 50, 33, 33, 33, 33, 33, 33
247 };
248 sal_uInt16 nPat = SVBT16ToUInt16(rFill.flpp);
249
250 if (nPat == 0) // transparent
251 rSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
252 else
253 {
254 rSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); // necessary for textbox
255 if (nPat <= 1 || (SAL_N_ELEMENTS(nPatA) <= nPat))
256 {
257 // Solid background or unknown
258 rSet.Put(XFillColorItem(OUString(), WW8TransCol(rFill.dlpcBg)));
259 }
260 else
261 { // Brush -> color mix
262 Color aB( WW8TransCol( rFill.dlpcBg ) );
263 Color aF( WW8TransCol( rFill.dlpcFg ) );
264 aB.SetRed( static_cast<sal_uInt8>( ( static_cast<sal_uLong>(aF.GetRed()) * nPatA[nPat]
265 + static_cast<sal_uLong>(aB.GetRed()) * ( 100 - nPatA[nPat] ) ) / 100 ) );
266 aB.SetGreen( static_cast<sal_uInt8>( ( static_cast<sal_uLong>(aF.GetGreen()) * nPatA[nPat]
267 + static_cast<sal_uLong>(aB.GetGreen()) * ( 100 - nPatA[nPat] ) ) / 100 ) );
268 aB.SetBlue( static_cast<sal_uInt8>( ( static_cast<sal_uLong>(aF.GetBlue()) * nPatA[nPat]
269 + static_cast<sal_uLong>(aB.GetBlue()) * ( 100 - nPatA[nPat] ) ) / 100 ) );
270 rSet.Put( XFillColorItem( OUString(), aB ) );
271 }
272 }
273}
274
275static void SetLineEndAttr( SfxItemSet& rSet, WW8_DP_LINEEND const & rLe,
276 WW8_DP_LINETYPE const & rLt )
277{
278 sal_uInt16 aSB = SVBT16ToUInt16( rLe.aStartBits );
279 if( aSB & 0x3 )
280 {
281 ::basegfx::B2DPolygon aPolygon;
282 aPolygon.append(::basegfx::B2DPoint(0.0, 330.0));
283 aPolygon.append(::basegfx::B2DPoint(100.0, 0.0));
284 aPolygon.append(::basegfx::B2DPoint(200.0, 330.0));
285 aPolygon.setClosed(true);
286 rSet.Put( XLineEndItem( OUString(), ::basegfx::B2DPolyPolygon(aPolygon) ) );
287 sal_uInt16 nSiz = SVBT16ToUInt16( rLt.lnpw )
288 * ( ( aSB >> 2 & 0x3 ) + ( aSB >> 4 & 0x3 ) );
289 if( nSiz < 220 ) nSiz = 220;
292 }
293
294 sal_uInt16 aEB = SVBT16ToUInt16( rLe.aEndBits );
295 if( !(aEB & 0x3) ) return;
296
297 ::basegfx::B2DPolygon aPolygon;
298 aPolygon.append(::basegfx::B2DPoint(0.0, 330.0));
299 aPolygon.append(::basegfx::B2DPoint(100.0, 0.0));
300 aPolygon.append(::basegfx::B2DPoint(200.0, 330.0));
301 aPolygon.setClosed(true);
302 rSet.Put( XLineStartItem( OUString(), ::basegfx::B2DPolyPolygon(aPolygon) ) );
303 sal_uInt16 nSiz = SVBT16ToUInt16( rLt.lnpw )
304 * ( ( aEB >> 2 & 0x3 ) + ( aEB >> 4 & 0x3 ) );
305 if( nSiz < 220 ) nSiz = 220;
308}
309
310// start of routines for the different objects
312{
313 WW8_DP_LINE aLine;
314
315 if( !ReadGrafStart( static_cast<void*>(&aLine), sizeof( aLine ), pHd, rSet ) )
316 return nullptr;
317
318 Point aP[2];
319 {
320 Point& rP0 = aP[0];
321 Point& rP1 = aP[1];
322
323 rP0.setX( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2 );
324 rP0.setY( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
325 rP1 = rP0;
326 rP0.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.xaStart )) );
327 rP0.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.yaStart )) );
328 rP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.xaEnd )) );
329 rP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.yaEnd )) );
330 }
331
332 ::basegfx::B2DPolygon aPolygon;
333 aPolygon.append(::basegfx::B2DPoint(aP[0].X(), aP[0].Y()));
334 aPolygon.append(::basegfx::B2DPoint(aP[1].X(), aP[1].Y()));
337 SdrObjKind::Line,
338 ::basegfx::B2DPolyPolygon(aPolygon));
339
340 SetStdAttr( rSet, aLine.aLnt, aLine.aShd );
341 SetLineEndAttr( rSet, aLine.aEpp, aLine.aLnt );
342
343 return pObj;
344}
345
347{
348 WW8_DP_RECT aRect;
349
350 if( !ReadGrafStart( static_cast<void*>(&aRect), sizeof( aRect ), pHd, rSet ) )
351 return nullptr;
352
353 Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2,
354 static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
355 Point aP1( aP0 );
356 aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
357 aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
358
361 tools::Rectangle(aP0, aP1));
362
363 SetStdAttr( rSet, aRect.aLnt, aRect.aShd );
364 SetFill( rSet, aRect.aFill );
365
366 return pObj;
367}
368
370{
371 WW8_DP_ELLIPSE aEllipse;
372
373 if( !ReadGrafStart( static_cast<void*>(&aEllipse), sizeof( aEllipse ), pHd, rSet ) )
374 return nullptr;
375
376 Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2,
377 static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
378 Point aP1( aP0 );
379 aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
380 aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
381
384 SdrCircKind::Full,
385 tools::Rectangle(aP0, aP1));
386
387 SetStdAttr( rSet, aEllipse.aLnt, aEllipse.aShd );
388 SetFill( rSet, aEllipse.aFill );
389
390 return pObj;
391}
392
394{
395 WW8_DP_ARC aArc;
396
397 if( !ReadGrafStart( static_cast<void*>(&aArc), sizeof( aArc ), pHd, rSet ) )
398 return nullptr;
399
400 Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2,
401 static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
402 Point aP1( aP0 );
403 aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) * 2 );
404 aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) * 2 );
405
406 short nA[] = { 2, 3, 1, 0 };
407 short nW = nA[ ( ( aArc.fLeft & 1 ) << 1 ) + ( aArc.fUp & 1 ) ];
408 if( !aArc.fLeft ){
409 aP0.AdjustY( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
410 aP1.AdjustY( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
411 }
412 if( aArc.fUp ){
413 aP0.AdjustX( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
414 aP1.AdjustX( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
415 }
416
419 SdrCircKind::Section,
420 tools::Rectangle(aP0, aP1),
421 Degree100(nW * 9000),
422 Degree100(( ( nW + 1 ) & 3 ) * 9000));
423
424 SetStdAttr( rSet, aArc.aLnt, aArc.aShd );
425 SetFill( rSet, aArc.aFill );
426
427 return pObj;
428}
429
431{
432 WW8_DP_POLYLINE aPoly;
433
434 if( !ReadGrafStart( static_cast<void*>(&aPoly), sizeof( aPoly ), pHd, rSet ) )
435 return nullptr;
436
437 sal_uInt16 nCount = SVBT16ToUInt16( aPoly.aBits1 ) >> 1 & 0x7fff;
438 std::unique_ptr<SVBT16[]> xP(new SVBT16[nCount * 2]);
439
440 bool bCouldRead = checkRead(*m_pStrm, xP.get(), nCount * 4); // read points
441 OSL_ENSURE(bCouldRead, "Short PolyLine header");
442 if (!bCouldRead)
443 return nullptr;
444
446 Point aPt;
447 for (sal_uInt16 i=0; i<nCount; ++i)
448 {
449 aPt.setX( SVBT16ToUInt16( xP[i << 1] ) + m_nDrawXOfs2
450 + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) );
451 aPt.setY( SVBT16ToUInt16( xP[( i << 1 ) + 1] ) + m_nDrawYOfs2
452 + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) );
453 aP[i] = aPt;
454 }
455 xP.reset();
456
459 (SVBT16ToUInt16(aPoly.aBits1) & 0x1) ? SdrObjKind::Polygon : SdrObjKind::PolyLine,
461
462 SetStdAttr( rSet, aPoly.aLnt, aPoly.aShd );
463 SetFill( rSet, aPoly.aFill );
464
465 return pObj;
466}
467
468static ESelection GetESelection(EditEngine const &rDrawEditEngine, tools::Long nCpStart, tools::Long nCpEnd)
469{
470 sal_Int32 nPCnt = rDrawEditEngine.GetParagraphCount();
471 sal_Int32 nSP = 0;
472 sal_Int32 nEP = 0;
473 while( (nSP < nPCnt)
474 && (nCpStart >= rDrawEditEngine.GetTextLen( nSP ) + 1) )
475 {
476 nCpStart -= rDrawEditEngine.GetTextLen( nSP ) + 1;
477 nSP++;
478 }
479 // at the end, switch to the new line only 1 character later as
480 // otherwise line attributes reach one line too far
481 while( (nEP < nPCnt)
482 && (nCpEnd > rDrawEditEngine.GetTextLen( nEP ) + 1) )
483 {
484 nCpEnd -= rDrawEditEngine.GetTextLen( nEP ) + 1;
485 nEP++;
486 }
487 return ESelection( nSP, nCpStart, nEP, nCpEnd );
488}
489
490// InsertTxbxStyAttrs() sets style attributes into the passed ItemSet.
491// SW styles are used since import-WW-styles are already destroyed.
492// SW styles are examined in depth first search order (with parent styles)
493// for the attributes given in aSrcTab. They're cloned, and the clones'
494// Which-IDs are changed according to the aDstTab table so that the
495// EditEngine will not ignore them.
496// Both Paragraph and character attributes are stuffed into the ItemSet.
498{
499 SwWW8StyInf * pStyInf = GetStyle(nColl);
500 if( !(pStyInf != nullptr && pStyInf->m_pFormat && pStyInf->m_bColl) )
501 return;
502
503 const SfxPoolItem* pItem;
504 for( sal_uInt16 i = POOLATTR_BEGIN; i < POOLATTR_END; i++ )
505 {
506 // If we are set in the source and not set in the destination
507 // then add it in.
508 if ( SfxItemState::SET == pStyInf->m_pFormat->GetItemState(
509 i, true, &pItem ) )
510 {
511 SfxItemPool *pEditPool = rS.GetPool();
512 sal_uInt16 nWhich = i;
513 sal_uInt16 nSlotId = m_rDoc.GetAttrPool().GetSlotId(nWhich);
514 if (
515 nSlotId && nWhich != nSlotId &&
516 0 != (nWhich = pEditPool->GetWhich(nSlotId)) &&
517 nWhich != nSlotId &&
518 ( SfxItemState::SET != rS.GetItemState(nWhich, false) )
519 )
520 {
521 rS.Put( pItem->CloneSetWhich(nWhich) );
522 }
523 }
524 }
525
526}
527
528static void lcl_StripFields(OUString &rString, WW8_CP &rNewStartCp)
529{
530 sal_Int32 nStartPos = 0;
531 for (;;)
532 {
533 nStartPos = rString.indexOf(0x13, nStartPos);
534 if (nStartPos<0)
535 return;
536
537 const sal_Unicode cStops[] = {0x14, 0x15, 0};
538 const sal_Int32 nStopPos = comphelper::string::indexOfAny(rString, cStops, nStartPos);
539 if (nStopPos<0)
540 {
541 rNewStartCp += rString.getLength()-nStartPos;
542 rString = rString.copy(0, nStartPos);
543 return;
544 }
545
546 const bool was0x14 = rString[nStopPos]==0x14;
547 rString = rString.replaceAt(nStartPos, nStopPos+1-nStartPos, u"");
548 rNewStartCp += nStopPos-nStartPos;
549
550 if (was0x14)
551 {
552 ++rNewStartCp;
553 nStartPos = rString.indexOf(0x15, nStartPos);
554 if (nStartPos<0)
555 return;
556 rString = rString.replaceAt(nStartPos, 1, u"");
557 }
558 }
559}
560
561namespace {
562
563class Chunk
564{
565private:
566 OUString msURL;
567 tools::Long mnStartPos; // 0x13
568 tools::Long mnEndPos; // 0x15
569public:
570 explicit Chunk(tools::Long nStart, OUString aURL)
571 : msURL(std::move(aURL)), mnStartPos(nStart), mnEndPos(0) {}
572
573 void SetEndPos(tools::Long nEnd) { mnEndPos = nEnd; }
574 tools::Long GetStartPos() const {return mnStartPos;}
575 tools::Long GetEndPos() const {return mnEndPos;}
576 const OUString &GetURL() const {return msURL;}
577 void Adjust(sal_Int32 nAdjust)
578 {
579 mnStartPos-=nAdjust;
580 mnEndPos-=nAdjust;
581 }
582};
583
584 bool IsValidSel(const EditEngine& rEngine, const ESelection& rSel)
585 {
586 const auto nParaCount = rEngine.GetParagraphCount();
587 if (rSel.nStartPara < nParaCount && rSel.nEndPara < nParaCount)
588 return rSel.nStartPos >= 0 && rSel.nEndPos >= 0;
589 return false;
590 }
591}
592
593// InsertAttrsAsDrawingAttrs() sets attributes between StartCp and EndCp.
594// Style attributes are set as hard, paragraph and character attributes.
596 ManTypes eType, bool bONLYnPicLocFc)
597{
598 /*
599 Save and create new plcxman for this drawing object, of the type that
600 will include the para end mark inside a paragraph property range, as
601 drawing boxes have real paragraph marks as part of their text, while
602 normal writer has separate nodes for each paragraph and so has no actual
603 paragraph mark as part of the paragraph text.
604 */
605 WW8ReaderSave aSave(this);
606 m_xPlcxMan = std::make_shared<WW8PLCFMan>(m_xSBase.get(), eType, nStartCp, true);
607
608 WW8_CP nStart = m_xPlcxMan->Where();
609 WW8_CP nNext, nStartReplace=0;
610
611 bool bDoingSymbol = false;
612 sal_Unicode cReplaceSymbol = m_cSymbol;
613
614 std::optional<SfxItemSet> pS(m_pDrawEditEngine->GetEmptyItemSet());
615 WW8PLCFManResult aRes;
616
617 std::deque<Chunk> aChunks;
618
619 // Here store stack location
620 size_t nCurrentCount = m_xCtrlStck->size();
621 while (nStart < nEndCp)
622 {
623 // nStart is the beginning of the attributes for this range, and
624 // may be before the text itself. So watch out for that
625 WW8_CP nTextStart = nStart;
626 if (nTextStart < nStartCp)
627 nTextStart = nStartCp;
628
629 // get position of next SPRM
630 bool bStartAttr = m_xPlcxMan->Get(&aRes);
631 m_nCurrentColl = m_xPlcxMan->GetColl();
632 if (aRes.nSprmId)
633 {
634 if( bONLYnPicLocFc )
635 {
636 if ( (68 == aRes.nSprmId) || (0x6A03 == aRes.nSprmId) )
637 {
638 Read_PicLoc(aRes.nSprmId, aRes.pMemPos +
639 m_oSprmParser->DistanceToData(aRes.nSprmId), 4);
640 // Ok, that's what we were looking for. Now let's get
641 // out of here!
642 break;
643 }
644 }
645 else if ((eFTN > aRes.nSprmId) || (0x0800 <= aRes.nSprmId))
646 {
647 // Here place them onto our usual stack and we will pop them
648 // off and convert them later
649 if (bStartAttr)
650 {
651 ImportSprm(aRes.pMemPos, aRes.nMemLen, aRes.nSprmId);
652 if (!bDoingSymbol && m_bSymbol)
653 {
654 bDoingSymbol = true;
655 nStartReplace = nTextStart;
656 cReplaceSymbol = m_cSymbol;
657 }
658 }
659 else
660 {
661 EndSprm( aRes.nSprmId );
662 if (!m_bSymbol && bDoingSymbol)
663 {
664 bDoingSymbol = false;
665
666 ESelection aReplaceSel(GetESelection(*m_pDrawEditEngine, nStartReplace - nStartCp,
667 nTextStart - nStartCp));
668
669 sal_Int32 nParaCount = m_pDrawEditEngine->GetParagraphCount();
670 bool bBadSelection = aReplaceSel.nStartPara >= nParaCount || aReplaceSel.nEndPara >= nParaCount;
671
672 SAL_WARN_IF(bBadSelection, "sw.ww8", "editengine has different amount of text than expected");
673
674 if (!bBadSelection)
675 {
676 sal_Int32 nCount = nTextStart - nStartReplace;
677 OUStringBuffer sTemp(nCount);
678 comphelper::string::padToLength(sTemp, nCount, cReplaceSymbol);
679 m_pDrawEditEngine->QuickInsertText(sTemp.makeStringAndClear(), aReplaceSel);
680 }
681 }
682 }
683 }
684 else if (aRes.nSprmId == eFLD)
685 {
686 if (bStartAttr)
687 {
688 size_t nCount = m_xCtrlStck->size();
689 if (m_aFieldStack.empty() && Read_Field(&aRes))
690 {
691 OUString sURL;
692 for (size_t nI = m_xCtrlStck->size(); nI > nCount; --nI)
693 {
694 const SfxPoolItem *pItem = ((*m_xCtrlStck)[nI-1]).m_pAttr.get();
695 sal_uInt16 nWhich = pItem->Which();
696 if (nWhich == RES_TXTATR_INETFMT)
697 {
698 const SwFormatINetFormat *pURL =
699 static_cast<const SwFormatINetFormat *>(pItem);
700 sURL = pURL->GetValue();
701 }
702 m_xCtrlStck->DeleteAndDestroy(nI-1);
703 }
704 aChunks.emplace_back(nStart, sURL);
705 }
706 }
707 else
708 {
709 if (!m_aFieldStack.empty() && End_Field() && !aChunks.empty())
710 aChunks.back().SetEndPos(nStart+1);
711 }
712 }
713 }
714
715 m_xPlcxMan->advance();
716 nNext = m_xPlcxMan->Where();
717
718 const WW8_CP nEnd = ( nNext < nEndCp ) ? nNext : nEndCp;
719 if (!bONLYnPicLocFc && nNext != nStart && nEnd >= nStartCp)
720 {
721 SfxItemPool *pEditPool = pS->GetPool();
722
723 // Here read current properties and convert them into pS
724 // and put those attrs into the draw box if they can be converted
725 // to draw attributes
726 if (m_xCtrlStck->size() - nCurrentCount)
727 {
728 for (size_t i = nCurrentCount; i < m_xCtrlStck->size(); ++i)
729 {
730 const SfxPoolItem *pItem = ((*m_xCtrlStck)[i]).m_pAttr.get();
731 sal_uInt16 nWhich = pItem->Which();
732 if( nWhich < RES_FLTRATTR_BEGIN ||
733 nWhich >= RES_FLTRATTR_END )
734 {
735 sal_uInt16 nSlotId = m_rDoc.GetAttrPool().GetSlotId(nWhich);
736 if (nWhich == RES_CHRATR_BACKGROUND || nWhich == RES_CHRATR_HIGHLIGHT)
737 {
738 Color aColor(static_cast<const SvxBrushItem*>(pItem)->GetColor());
739 pS->Put(SvxColorItem(aColor, EE_CHAR_BKGCOLOR));
740 }
741 else if (
742 nSlotId && nWhich != nSlotId &&
743 0 != (nWhich = pEditPool->GetWhich(nSlotId)) &&
744 nWhich != nSlotId
745 )
746 {
747 pS->Put( pItem->CloneSetWhich(nWhich) );
748 }
749 }
750 }
751 }
752 // Fill in the remainder from the style
754
755 if( pS->Count() )
756 {
757 m_pDrawEditEngine->QuickSetAttribs( *pS,
758 GetESelection(*m_pDrawEditEngine, nTextStart - nStartCp, nEnd - nStartCp ) );
759 pS.emplace(m_pDrawEditEngine->GetEmptyItemSet());
760 }
761 }
762 nStart = nNext;
763 }
764 pS.reset();
765
766 // pop off as far as recorded location just in case there were some left
767 // unclosed
768 for (size_t nI = m_xCtrlStck->size(); nI > nCurrentCount; --nI)
769 m_xCtrlStck->DeleteAndDestroy(nI-1);
770
771 auto aEnd = aChunks.end();
772 for (auto aIter = aChunks.begin(); aIter != aEnd; ++aIter)
773 {
774 ESelection aSel(GetESelection(*m_pDrawEditEngine, aIter->GetStartPos()-nStartCp,
775 aIter->GetEndPos()-nStartCp));
776 if (!IsValidSel(*m_pDrawEditEngine, aSel))
777 continue;
778 OUString aString(m_pDrawEditEngine->GetText(aSel));
779 const sal_Int32 nOrigLen = aString.getLength();
780 WW8_CP nDummy(0);
781 lcl_StripFields(aString, nDummy);
782
783 sal_Int32 nChanged;
784 if (!aIter->GetURL().isEmpty())
785 {
786 SvxURLField aURL(aIter->GetURL(), aString, SvxURLFormat::AppDefault);
787 m_pDrawEditEngine->QuickInsertField(SvxFieldItem(aURL, EE_FEATURE_FIELD), aSel);
788 nChanged = nOrigLen - 1;
789 }
790 else
791 {
792 m_pDrawEditEngine->QuickInsertText(aString, aSel);
793 nChanged = nOrigLen - aString.getLength();
794 }
795 for (auto aIter2 = aIter+1; aIter2 != aEnd; ++aIter2)
796 aIter2->Adjust(nChanged);
797 }
798
799 /*
800 Don't worry about the new pPlcxMan, the restore removes it when
801 replacing the current one with the old one.
802 */
803 aSave.Restore(this);
804}
805
807 sal_uInt16 nTxBxS, sal_uInt16 nSequence)
808{
809 // grab the TextBox-PLCF quickly
810 WW8PLCFspecial* pT = m_xPlcxMan ? m_xPlcxMan->GetTxbx() : nullptr;
811 if( !pT )
812 {
813 OSL_ENSURE( false, "+where's the text graphic (1)?" );
814 return false;
815 }
816
817 // if applicable first find the right TextBox-Story
818 bool bCheckTextBoxStory = ( nTxBxS && pT->GetIMax() >= nTxBxS );
819 if( bCheckTextBoxStory )
820 pT->SetIdx( nTxBxS-1 );
821
822 // then determine start and end
823 void* pT0;
824 if (!pT->Get(rStartCp, pT0) || rStartCp < 0)
825 {
826 OSL_ENSURE( false, "+where's the text graphic (2)?" );
827 return false;
828 }
829
830 if( bCheckTextBoxStory )
831 {
832 bool bReusable = (0 != SVBT16ToUInt16( static_cast<WW8_TXBXS*>(pT0)->fReusable ));
833 while( bReusable )
834 {
835 pT->advance();
836 if( !pT->Get( rStartCp, pT0 ) )
837 {
838 OSL_ENSURE( false, "+where's the text graphic (2a)?" );
839 return false;
840 }
841 bReusable = (0 != SVBT16ToUInt16( static_cast<WW8_TXBXS*>(pT0)->fReusable ));
842 }
843 }
844 pT->advance();
845 if (!pT->Get(rEndCp, pT0) || rEndCp < 0)
846 {
847 OSL_ENSURE( false, "+where's the text graphic (3)?" );
848 return false;
849 }
850
851 // find the right page in the break table (if necessary)
852 if( bCheckTextBoxStory )
853 {
854 // special case: entire chain should be determined - done!
855 if( USHRT_MAX > nSequence )
856 {
857 tools::Long nMinStartCp = rStartCp;
858 tools::Long nMaxEndCp = rEndCp;
859 // quickly grab the TextBox-Break-Descriptor-PLCF
860 pT = m_xPlcxMan->GetTxbxBkd();
861 if (!pT) // It can occur on occasion, Caolan
862 return false;
863
864 // find first entry for this TextBox story
865 if( !pT->SeekPos( rStartCp ) )
866 {
867 OSL_ENSURE( false, "+where's the text graphic (4)" );
868 return false;
869 }
870 // if needed skip the appropriate number of entries
871 for (sal_uInt16 iSequence = 0; iSequence < nSequence; ++iSequence)
872 pT->advance();
873 // and determine actual start and end
874 if( (!pT->Get( rStartCp, pT0 ))
875 || ( nMinStartCp > rStartCp ) )
876 {
877 OSL_ENSURE( false, "+where's the text graphic (5)?" );
878 return false;
879 }
880 if( rStartCp >= nMaxEndCp )
881 rEndCp = rStartCp; // not an error: empty string
882 else
883 {
884 pT->advance();
885 if ( (!pT->Get(rEndCp, pT0)) || (nMaxEndCp < rEndCp-1) )
886 {
887 OSL_ENSURE( false, "+where's the text graphic (6)?" );
888 return false;
889 }
890 rEndCp -= 1;
891 }
892 }
893 else
894 rEndCp -= 1;
895 }
896 else
897 rEndCp -= 1;
898 return true;
899}
900
901// TxbxText() grabs the text from the WW file and returns that along with
902// the StartCp and the corrected (by -2, or -1 for version 8) EndCp.
903sal_Int32 SwWW8ImplReader::GetRangeAsDrawingString(OUString& rString, tools::Long nStartCp, tools::Long nEndCp, ManTypes eType)
904{
905 WW8_CP nOffset = 0;
906 m_xWwFib->GetBaseCp(eType, &nOffset); //TODO: check return value
907
908 OSL_ENSURE(nStartCp <= nEndCp, "+where's the graphic text (7)?");
909 if (nStartCp == nEndCp)
910 rString.clear(); // empty string: entirely possible
911 else if (nStartCp < nEndCp)
912 {
913 // read the text: can be split into multiple pieces
914 const sal_Int32 nLen = m_xSBase->WW8ReadString(*m_pStrm, rString,
915 nStartCp + nOffset, nEndCp - nStartCp, GetCurrentCharSet());
916 OSL_ENSURE(nLen, "+where's the text graphic (8)?");
917 if (nLen>0)
918 {
919 if( rString[nLen-1]==0x0d )
920 rString = rString.copy(0, nLen-1);
921
922 rString = rString.replace( 0xb, 0xa );
923 return nLen;
924 }
925 }
926 return 0;
927}
928
929//EditEngine::InsertText will replace dos lines resulting in a shorter
930//string than is passed in, so inserting attributes based on the original
931//string len can fail. So here replace the dos line ends similar to
932//how EditEngine does it, but preserve the length and replace the extra
933//chars with placeholders, record the position of the placeholders and
934//remove those extra chars after attributes have been inserted
935static std::vector<sal_Int32> replaceDosLineEndsButPreserveLength(OUString &rIn)
936{
937 OUStringBuffer aNewData(rIn);
938 std::vector<sal_Int32> aDosLineEndDummies;
939 sal_Int32 i = 0;
940 sal_Int32 nStrLen = rIn.getLength();
941 while (i < nStrLen)
942 {
943 // \r or \n causes linebreak
944 if (rIn[i] == '\r' || rIn[i] == '\n')
945 {
946 // skip char if \r\n or \n\r
947 if ( (i+1) < nStrLen && ((rIn[i+1] == '\r') || (rIn[i+1] == '\n')) &&
948 (rIn[i] != rIn[i+1]) )
949 {
950 ++i;
951 aDosLineEndDummies.push_back(i);
952 aNewData[i] = 0;
953 }
954 }
955 ++i;
956 }
957 rIn = aNewData.makeStringAndClear();
958 return aDosLineEndDummies;
959}
960
961static void removePositions(EditEngine &rDrawEditEngine, const std::vector<sal_Int32>& rDosLineEndDummies)
962{
963 for (auto aIter = rDosLineEndDummies.rbegin(); aIter != rDosLineEndDummies.rend(); ++aIter)
964 {
965 sal_Int32 nCharPos(*aIter);
966 rDrawEditEngine.QuickDelete(GetESelection(rDrawEditEngine, nCharPos, nCharPos+1));
967 }
968}
969
971{
973
974 sal_Int32 nLen = GetRangeAsDrawingString(rString, nStartCp, nEndCp, eType);
975 if (nLen > 0)
976 {
977 if (m_bFuzzing && rString.getLength() > 1024)
978 {
979 SAL_WARN("sw.ww8", "Truncating long EditEngine strings when fuzzing for performance");
980 rString = rString.copy(0, 1024);
981 }
982
984 {
985 m_pDrawEditEngine.reset(new EditEngine(nullptr));
986 }
987
988 //replace dos line endings with editeng ones, replace any extra chars with
989 //placeholders to keep the inserted string len in sync with the attribute cps
990 //and record in aDosLineEnds the superfluous positions
991 OUString sEEString(rString);
992 std::vector<sal_Int32> aDosLineEnds(replaceDosLineEndsButPreserveLength(sEEString));
993 m_pDrawEditEngine->SetText(sEEString);
994 InsertAttrsAsDrawingAttrs(nStartCp, nStartCp+nLen, eType);
995 //remove any superfluous placeholders of replaceDosLineEndsButPreserveLength
996 //after attributes have been inserted
997 removePositions(*m_pDrawEditEngine, aDosLineEnds);
998
999 // Annotations typically begin with a (useless) 0x5
1000 if ((eType == MAN_AND) && m_pDrawEditEngine->GetTextLen())
1001 {
1002 ESelection aFirstChar(0, 0, 0, 1);
1003 if (m_pDrawEditEngine->GetText( aFirstChar ) == "\x05")
1004 m_pDrawEditEngine->QuickDelete(aFirstChar);
1005 }
1006
1007 std::unique_ptr<EditTextObject> pTemporaryText = m_pDrawEditEngine->CreateTextObject();
1008 pRet.emplace( std::move(pTemporaryText) );
1009 pRet->SetOutlinerMode( OutlinerMode::TextObject );
1010
1011 m_pDrawEditEngine->SetText( OUString() );
1012 m_pDrawEditEngine->SetParaAttribs(0, m_pDrawEditEngine->GetEmptyItemSet());
1013
1014 // Strip out fields, leaving the result
1015 WW8_CP nDummy(0);
1016 lcl_StripFields(rString, nDummy);
1017 // Strip out word's special characters for the simple string
1018 rString = rString.replaceAll("\x01", "");
1019 rString = rString.replaceAll("\x05", "");
1020 rString = rString.replaceAll("\x08", "");
1021 rString = rString.replaceAll("\007\007", "\007\012");
1022 rString = rString.replace(0x7, ' ');
1023 }
1024
1025 return pRet;
1026}
1027
1028// InsertTxbxText() adds the Text and the Attributes for TextBoxes and CaptionBoxes
1030 Size const * pObjSiz, sal_uInt16 nTxBxS, sal_uInt16 nSequence, tools::Long nPosCp,
1031 SwFrameFormat const * pOldFlyFormat, bool bMakeSdrGrafObj, bool& rbEraseTextObj,
1032 bool* pbTestTxbxContainsText, tools::Long* pnStartCp, tools::Long* pnEndCp,
1033 bool* pbContainsGraphics, SvxMSDffImportRec const * pRecord)
1034{
1035 SwFrameFormat* pFlyFormat = nullptr;
1036 sal_uInt64 nOld = m_pStrm->Tell();
1037
1038 ManTypes eType = m_xPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX;
1039
1040 rbEraseTextObj = false;
1041
1042 OUString aString;
1043 WW8_CP nStartCp, nEndCp;
1044 bool bContainsGraphics = false;
1045 bool bTextWasRead = GetTxbxTextSttEndCp(nStartCp, nEndCp, nTxBxS, nSequence) &&
1046 GetRangeAsDrawingString(aString, nStartCp, nEndCp, eType) > 0;
1047
1048 if (!m_pDrawEditEngine)
1049 {
1050 m_pDrawEditEngine.reset(new EditEngine(nullptr));
1051 }
1052 if( pObjSiz )
1053 m_pDrawEditEngine->SetPaperSize( *pObjSiz );
1054
1055 if (m_bFuzzing && aString.getLength() > 1024)
1056 {
1057 SAL_WARN("sw.ww8", "Truncating long EditEngine strings when fuzzing for performance");
1058 aString = aString.copy(0, 1024);
1059 }
1060
1061 const OUString aOrigString(aString);
1062 if( bTextWasRead )
1063 {
1064 WW8_CP nNewStartCp = nStartCp;
1065 lcl_StripFields(aString, nNewStartCp);
1066
1067 if (aString.getLength()!=1)
1068 {
1069 bContainsGraphics = aString.indexOf(0x1)<0 || aString.indexOf(0x8)<0;
1070 }
1071 else // May be a single graphic or object
1072 {
1073 bool bDone = true;
1074 switch( aString[0] )
1075 {
1076 case 0x1:
1077 if (!pbTestTxbxContainsText)
1078 {
1079 WW8ReaderSave aSave(this, nNewStartCp -1);
1080 bool bOldEmbeddObj = m_bEmbeddObj;
1081 // bEmbeddObj Ordinarily would have been set by field
1082 // parse, but this is impossible here so...
1083 m_bEmbeddObj = true;
1084
1085 // 1st look for OLE- or Graph-Indicator Sprms
1086 WW8PLCFx_Cp_FKP* pChp = m_xPlcxMan->GetChpPLCF();
1087 WW8PLCFxDesc aDesc;
1088 pChp->GetSprms( &aDesc );
1089 WW8SprmIter aSprmIter(aDesc.pMemPos, aDesc.nSprmsLen, *m_oSprmParser);
1090
1091 for( int nLoop = 0; nLoop < 2; ++nLoop )
1092 {
1093 while (aSprmIter.GetSprms())
1094 {
1095 const sal_uInt8 *const pParams(aSprmIter.GetCurrentParams());
1096 if (nullptr == pParams)
1097 break;
1098 sal_uInt16 nCurrentId = aSprmIter.GetCurrentId();
1099 switch( nCurrentId )
1100 {
1101 case 75:
1102 case 118:
1103 case 0x080A:
1104 case 0x0856:
1105 Read_Obj(nCurrentId, pParams, 1);
1106 break;
1107 case 68: // Read_Pic()
1108 case 0x6A03:
1110 Read_PicLoc(nCurrentId, pParams, 1);
1111 break;
1112 }
1113 aSprmIter.advance();
1114 }
1115
1116 if( !nLoop )
1117 {
1118 pChp->GetPCDSprms( aDesc );
1119 aSprmIter.SetSprms( aDesc.pMemPos,
1120 aDesc.nSprmsLen );
1121 }
1122 }
1123 aSave.Restore(this);
1124 m_bEmbeddObj=bOldEmbeddObj;
1125
1126 // then import either an OLE of a Graphic
1127 if( m_bObj )
1128 {
1129 if( bMakeSdrGrafObj && pTextObj &&
1131 {
1132 // use SdrOleObj/SdrGrafObj instead of
1133 // SdrTextObj in this Group
1134
1135 Graphic aGraph;
1137
1138 if( !pNew )
1139 {
1140 pNew = new SdrGrafObj(*m_pDrawModel);
1141 static_cast<SdrGrafObj*>(pNew.get())->SetGraphic(aGraph);
1142 }
1143
1144 GraphicCtor();
1145
1146 pNew->SetLogicRect( pTextObj->GetCurrentBoundRect() );
1147 pNew->SetLayer( pTextObj->GetLayer() );
1148
1150 ReplaceObject(pNew.get(), pTextObj->GetOrdNum());
1151 }
1152 else
1153 pFlyFormat = ImportOle();
1154 m_bObj = false;
1155 }
1156 else
1157 {
1158 InsertAttrsAsDrawingAttrs(nNewStartCp, nNewStartCp+1,
1159 eType, true);
1160 pFlyFormat = ImportGraf(bMakeSdrGrafObj ? pTextObj : nullptr,
1161 pOldFlyFormat);
1162 }
1163 }
1164 break;
1165 case 0x8:
1166 if ( (!pbTestTxbxContainsText) && (!m_bObj) )
1167 pFlyFormat = Read_GrafLayer( nPosCp );
1168 break;
1169 default:
1170 bDone = false;
1171 break;
1172 }
1173
1174 if( bDone )
1175 {
1176 if( pFlyFormat && pRecord )
1177 {
1179 aFlySet( m_rDoc.GetAttrPool() );
1180
1181 tools::Rectangle aInnerDist( pRecord->nDxTextLeft,
1182 pRecord->nDyTextTop,
1183 pRecord->nDxTextRight,
1184 pRecord->nDyTextBottom );
1185 MatchSdrItemsIntoFlySet( pTextObj,
1186 aFlySet,
1187 pRecord->eLineStyle,
1188 pRecord->eLineDashing,
1189 pRecord->eShapeType,
1190 aInnerDist );
1191
1192 pFlyFormat->SetFormatAttr( aFlySet );
1193
1194 MapWrapIntoFlyFormat(*pRecord, *pFlyFormat);
1195 }
1196 aString.clear();
1197 rbEraseTextObj = (nullptr != pFlyFormat);
1198 }
1199 }
1200 }
1201
1202 if( pnStartCp )
1203 *pnStartCp = nStartCp;
1204 if( pnEndCp )
1205 *pnEndCp = nEndCp;
1206
1207 if( pbTestTxbxContainsText )
1208 *pbTestTxbxContainsText = bTextWasRead && ! rbEraseTextObj;
1209 else if( !rbEraseTextObj )
1210 {
1211 if( bTextWasRead )
1212 {
1213 m_pDrawEditEngine->SetText(aOrigString);
1214 InsertAttrsAsDrawingAttrs(nStartCp, nEndCp, eType);
1215 }
1216
1217 bool bVertical = pTextObj->IsVerticalWriting();
1218 OutlinerParaObject aOp(m_pDrawEditEngine->CreateTextObject());
1219 aOp.SetOutlinerMode( OutlinerMode::TextObject );
1220 aOp.SetVertical( bVertical );
1221 pTextObj->NbcSetOutlinerParaObject( std::move(aOp) );
1222 pTextObj->SetVerticalWriting(bVertical);
1223
1224 // For the next TextBox also remove the old paragraph attributes
1225 // and styles, otherwise the next box will start with the wrong
1226 // attributes.
1227 // Course of action: delete text = reduce to one paragraph
1228 // and on this one delete the paragraph attributes
1229 // and styles
1230 m_pDrawEditEngine->SetText( OUString() );
1231 m_pDrawEditEngine->SetParaAttribs(0, m_pDrawEditEngine->GetEmptyItemSet());
1232 }
1233
1234 m_pStrm->Seek( nOld );
1235 if (pbContainsGraphics)
1236 *pbContainsGraphics = bContainsGraphics;
1237}
1238
1240 tools::Long& rEndCp)
1241{
1242 bool bErase, bContainsText;
1243 InsertTxbxText( nullptr,nullptr,nTxBxS,USHRT_MAX,0,nullptr,false, bErase, &bContainsText,
1244 &rStartCp, &rEndCp );
1245 return bContainsText;
1246}
1247
1248// TextBoxes only for Ver67 !!
1250{
1251 bool bDummy;
1252 WW8_DP_TXTBOX aTextB;
1253
1254 if( !ReadGrafStart( static_cast<void*>(&aTextB), sizeof( aTextB ), pHd, rSet ) )
1255 return nullptr;
1256
1257 Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2,
1258 static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 );
1259 Point aP1( aP0 );
1260 aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) );
1261 aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
1262
1264 *m_pDrawModel,
1265 SdrObjKind::Text,
1266 tools::Rectangle(aP0, aP1));
1267
1268 pObj->NbcSetSnapRect(tools::Rectangle(aP0, aP1));
1269 Size aSize( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) ,
1270 static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) );
1271
1272 tools::Long nStartCpFly,nEndCpFly;
1273 bool bContainsGraphics;
1274 InsertTxbxText(pObj.get(), &aSize, 0, 0, 0, nullptr, false,
1275 bDummy,nullptr,&nStartCpFly,&nEndCpFly,&bContainsGraphics);
1276
1277 SetStdAttr( rSet, aTextB.aLnt, aTextB.aShd );
1278 SetFill( rSet, aTextB.aFill );
1279
1280 rSet.Put( SdrTextFitToSizeTypeItem( drawing::TextFitToSizeType_NONE ) );
1287
1288 return pObj;
1289}
1290
1292{
1293 static const SdrCaptionType aCaptA[] = { SdrCaptionType::Type1, SdrCaptionType::Type2,
1294 SdrCaptionType::Type3, SdrCaptionType::Type4 };
1295
1296 WW8_DP_CALLOUT_TXTBOX aCallB;
1297
1298 if( !ReadGrafStart( static_cast<void*>(&aCallB), sizeof( aCallB ), pHd, rSet ) )
1299 return nullptr;
1300
1301 sal_uInt16 nCount = SVBT16ToUInt16( aCallB.dpPolyLine.aBits1 ) >> 1 & 0x7fff;
1302 if (nCount < 1)
1303 {
1304 SAL_WARN("sw.ww8", "Short CaptionBox header");
1305 return nullptr;
1306 }
1307
1308 std::unique_ptr<SVBT16[]> xP(new SVBT16[nCount * 2]);
1309
1310 bool bCouldRead = checkRead(*m_pStrm, xP.get(), nCount * 4); // read points
1311 if (!bCouldRead)
1312 {
1313 SAL_WARN("sw.ww8", "Short CaptionBox header");
1314 return nullptr;
1315 }
1316
1317 sal_uInt8 nTyp = static_cast<sal_uInt8>(nCount) - 1;
1318 if( nTyp == 1 && SVBT16ToUInt16( xP[0] ) == SVBT16ToUInt16( xP[2] ) )
1319 nTyp = 0;
1320
1321 Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) +
1322 static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.xa )) + m_nDrawXOfs2,
1323 static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya ))
1324 + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.ya )) + m_nDrawYOfs2 );
1325 Point aP1( aP0 );
1326 aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dxa )) );
1327 aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dya )) );
1328 Point aP2( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa ))
1329 + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadPolyLine.xa ))
1330 + m_nDrawXOfs2 + static_cast<sal_Int16>(SVBT16ToUInt16( xP[0] )),
1331 static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya ))
1332 + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadPolyLine.ya ))
1333 + m_nDrawYOfs2 + static_cast<sal_Int16>(SVBT16ToUInt16( xP[1] )) );
1334 xP.reset();
1335
1337 *m_pDrawModel,
1338 tools::Rectangle(aP0, aP1),
1339 aP2);
1340
1341 pObj->NbcSetSnapRect(tools::Rectangle(aP0, aP1));
1342 Size aSize( static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dxa )),
1343 static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dya )) );
1344 bool bEraseThisObject;
1345
1346 InsertTxbxText(pObj.get(), &aSize, 0, 0, 0, nullptr, false, bEraseThisObject );
1347
1348 if( SVBT16ToUInt16( aCallB.dptxbx.aLnt.lnps ) != 5 ) // Is border visible ?
1349 SetStdAttr( rSet, aCallB.dptxbx.aLnt, aCallB.dptxbx.aShd );
1350 else // no -> take lines
1351 SetStdAttr( rSet, aCallB.dpPolyLine.aLnt, aCallB.dptxbx.aShd );
1352 SetFill( rSet, aCallB.dptxbx.aFill );
1353 rSet.Put(SdrCaptionTypeItem(aCaptA[nTyp % SAL_N_ELEMENTS(aCaptA)]));
1354
1355 return pObj;
1356}
1357
1359{
1360 sal_Int16 nGrouped;
1361
1362 if( !ReadGrafStart( static_cast<void*>(&nGrouped), sizeof( nGrouped ), pHd, rSet ) )
1363 return nullptr;
1364
1365#ifdef OSL_BIGENDIAN
1366 nGrouped = (sal_Int16)OSL_SWAPWORD( nGrouped );
1367#endif
1368
1369 m_nDrawXOfs = m_nDrawXOfs + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa ));
1370 m_nDrawYOfs = m_nDrawYOfs + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya ));
1371
1373
1374 short nLeft = static_cast<sal_Int16>(SVBT16ToUInt16( pHd->cb )) - sizeof( WW8_DPHEAD );
1375 for (int i = 0; i < nGrouped && nLeft >= static_cast<short>(sizeof(WW8_DPHEAD)); ++i)
1376 {
1379 {
1380 // first add and then set ItemSet
1381 SdrObjList *pSubGroup = pObj->GetSubList();
1382 OSL_ENSURE(pSubGroup, "Why no sublist available?");
1383 if (pSubGroup)
1384 pSubGroup->InsertObject(pObject.get(), 0);
1385 pObject->SetMergedItemSetAndBroadcast(aSet);
1386 }
1387 }
1388
1389 m_nDrawXOfs = m_nDrawXOfs - static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa ));
1390 m_nDrawYOfs = m_nDrawYOfs - static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya ));
1391
1392 return pObj;
1393}
1394
1396{
1397 // This whole archaic word 6 graphic import can probably be refactored
1398 // into an object hierarchy with a little effort.
1400 WW8_DPHEAD aHd; // Read Draw-Primitive-Header
1401 bool bCouldRead = checkRead(*m_pStrm, &aHd, sizeof(WW8_DPHEAD)) &&
1402 SVBT16ToUInt16(aHd.cb) >= sizeof(WW8_DPHEAD);
1403 OSL_ENSURE(bCouldRead, "Graphic Primitive header short read" );
1404 if (!bCouldRead)
1405 {
1406 rLeft=0;
1407 return pRet;
1408 }
1409
1410 if( rLeft >= SVBT16ToUInt16(aHd.cb) ) // precautions
1411 {
1412 rSet.Put(SwFormatSurround(css::text::WrapTextMode_THROUGH));
1413 switch (SVBT16ToUInt16(aHd.dpk) & 0xff )
1414 {
1415 case 0:
1416 pRet = ReadGroup(&aHd, rSet);
1417 break;
1418 case 1:
1419 pRet = ReadLine(&aHd, rSet);
1420 break;
1421 case 2:
1422 pRet = ReadTextBox(&aHd, rSet);
1423 break;
1424 case 3:
1425 pRet = ReadRect(&aHd, rSet);
1426 break;
1427 case 4:
1428 pRet = ReadEllipse(&aHd, rSet);
1429 break;
1430 case 5:
1431 pRet = ReadArc(&aHd, rSet);
1432 break;
1433 case 6:
1434 pRet = ReadPolyLine(&aHd, rSet);
1435 break;
1436 case 7:
1437 pRet = ReadCaptionBox(&aHd, rSet);
1438 break;
1439 default: // unknown
1440 m_pStrm->SeekRel(SVBT16ToUInt16(aHd.cb) - sizeof(WW8_DPHEAD));
1441 break;
1442 }
1443 }
1444 else
1445 {
1446 OSL_ENSURE( false, "+Grafik-Overlap" );
1447 }
1448 rLeft = rLeft - SVBT16ToUInt16( aHd.cb );
1449 return pRet;
1450}
1451
1453{
1454 rPF.SeekPos(nGrafAnchorCp);
1455 WW8_FC nStartFc;
1456 void* pF0;
1457 if (!rPF.Get(nStartFc, pF0))
1458 {
1459 OSL_ENSURE( false, "+Where is the graphic (2) ?" );
1460 return;
1461 }
1462 WW8_FDOA* pF = static_cast<WW8_FDOA*>(pF0);
1463 if( !SVBT32ToUInt32( pF->fc ) )
1464 {
1465 OSL_ENSURE( false, "+Where is the graphic (3) ?" );
1466 return;
1467 }
1468
1469 sal_uInt32 nPosFc = SVBT32ToUInt32(pF->fc);
1470
1471 //skip duplicate graphics when fuzzing
1472 if (m_bFuzzing)
1473 {
1474 if (!m_aGrafPosSet.insert(nPosFc).second)
1475 return;
1476 }
1477
1478 bool bCouldSeek = checkSeek(*m_pStrm, nPosFc);
1479 OSL_ENSURE(bCouldSeek, "Invalid graphic offset");
1480 if (!bCouldSeek)
1481 return;
1482
1483 // read Draw-Header
1484 WW8_DO aDo;
1485 bool bCouldRead = checkRead(*m_pStrm, &aDo, sizeof(WW8_DO));
1486 OSL_ENSURE(bCouldRead, "Short graphic header");
1487 if (!bCouldRead)
1488 return;
1489
1490 short nLeft = SVBT16ToUInt16( aDo.cb ) - sizeof( WW8_DO );
1491 while (nLeft > static_cast<short>(sizeof(WW8_DPHEAD)))
1492 {
1495 {
1496 m_xWWZOrder->InsertDrawingObject(pObject.get(), SVBT16ToUInt16(aDo.dhgt));
1497
1498 tools::Rectangle aRect(pObject->GetSnapRect());
1499
1500 const sal_uInt32 nCntRelTo = 3;
1501
1502 // Adjustment is horizontally relative to...
1503 static const sal_Int16 aHoriRelOriTab[nCntRelTo] =
1504 {
1505 text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
1506 text::RelOrientation::PAGE_FRAME, // 1 is page margin
1507 text::RelOrientation::FRAME, // 2 is relative to paragraph
1508 };
1509
1510 // Adjustment is vertically relative to...
1511 static const sal_Int16 aVertRelOriTab[nCntRelTo] =
1512 {
1513 text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
1514 text::RelOrientation::PAGE_FRAME, // 1 is page margin
1515 text::RelOrientation::FRAME, // 2 is relative to paragraph
1516 };
1517
1518 const int nXAlign = aDo.bx < nCntRelTo ? aDo.bx : 0;
1519 const int nYAlign = aDo.by < nCntRelTo ? aDo.by : 0;
1520
1522 aHoriRelOriTab[ nXAlign ]));
1524 aVertRelOriTab[ nYAlign ]));
1525
1527 pObject->SetMergedItemSet(aSet);
1528
1529 if (SwDrawFrameFormat *pDrawFrame = dynamic_cast<SwDrawFrameFormat*>(pFrame))
1530 {
1531 pDrawFrame->PosAttrSet();
1532 }
1533
1534 AddAutoAnchor(pFrame);
1535 }
1536 }
1537}
1538
1540 MSO_SPT eShapeType, sal_Int32 &rThick)
1541{
1542 sal_Int32 nOutsideThick = 0;
1543 /*
1544 Note: In contrast to the regular WinWord table and frame border width,
1545 where the overall border width has to be calculated from the width of *one*
1546 line, the data from ESCHER already contains the overall width [twips]!
1547
1548 The WinWord default is 15 tw. We take for this our 20 tw line.
1549 (0.75 pt and 1.0 pt looking more similar on hardcopy than 0.75 pt and our
1550 0.05 pt hairline.) The hairline we only set by WinWord width up to max.
1551 0.5 pt.
1552 */
1553 switch( eStyle )
1554 {
1555 case mso_lineTriple:
1556 case mso_lineSimple:
1557 nOutsideThick = eShapeType != mso_sptTextBox ? rThick : rThick/2;
1558 break;
1559 case mso_lineDouble:
1560 if (eShapeType == mso_sptTextBox)
1561 {
1562 nOutsideThick = rThick/6;
1563 rThick = rThick*2/3;
1564 }
1565 else
1566 nOutsideThick = rThick*2/3;
1567 break;
1568 case mso_lineThickThin:
1569 if (eShapeType == mso_sptTextBox)
1570 {
1571 nOutsideThick = rThick*3/10;
1572 rThick = rThick*4/5;
1573 }
1574 else
1575 nOutsideThick = rThick*4/5;
1576 break;
1577 case mso_lineThinThick:
1578 {
1579 if (eShapeType == mso_sptTextBox)
1580 {
1581 nOutsideThick = rThick/10;
1582 rThick = rThick*3/5;
1583 }
1584 else
1585 nOutsideThick = rThick*3/5;
1586 }
1587 break;
1588 default:
1589 break;
1590 }
1591 return nOutsideThick;
1592}
1593
1594// Returns the thickness of the line outside the frame, the logic of
1595// words positioning of borders around floating objects is that of a
1596// disturbed mind.
1598 MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType, sal_Int32 &rLineThick,
1599 SvxBoxItem& rBox )
1600{
1601 sal_Int32 nOutsideThick = 0;
1602 if( !rLineThick )
1603 return nOutsideThick;
1604
1605 SvxBorderLineStyle nIdx = SvxBorderLineStyle::NONE;
1606
1607 sal_Int32 nLineThick=rLineThick;
1608 nOutsideThick = SwMSDffManager::GetEscherLineMatch(eLineStyle,
1609 eShapeType, rLineThick);
1610
1611 /*
1612 Note: In contrast to the regular WinWord table and frame border width,
1613 where the overall border width has to be calculated from the width of *one*
1614 line, the data from ESCHER already contains the overall width [twips]!
1615
1616 The WinWord default is 15 tw. We take for this our 20 tw line.
1617 (0.75 pt and 1.0 pt looking more similar on hardcopy than 0.75 pt and our
1618 0.05 pt hairline.) The hairline we only set by WinWord width up to max.
1619 0.5 pt.
1620 */
1621 switch( +eLineStyle )
1622 {
1623 // first the single lines
1624 case mso_lineSimple:
1625 nIdx = SvxBorderLineStyle::SOLID;
1626 break;
1627 // second the double lines
1628 case mso_lineDouble:
1629 nIdx = SvxBorderLineStyle::DOUBLE;
1630 break;
1631 case mso_lineThickThin:
1632 nIdx = SvxBorderLineStyle::THICKTHIN_SMALLGAP;
1633 break;
1634 case mso_lineThinThick:
1635 nIdx = SvxBorderLineStyle::THINTHICK_SMALLGAP;
1636 break;
1637 // We have no triple border, use double instead.
1638 case mso_lineTriple:
1639 nIdx = SvxBorderLineStyle::DOUBLE;
1640 break;
1641 // no line style is set
1642 case MSO_LineStyle(USHRT_MAX):
1643 break;
1644 // erroneously not implemented line style is set
1645 default:
1646 OSL_ENSURE(false, "eLineStyle is not (yet) implemented!");
1647 break;
1648 }
1649
1650 switch( eDashing )
1651 {
1652 case mso_lineDashGEL:
1653 nIdx = SvxBorderLineStyle::DASHED;
1654 break;
1655 case mso_lineDotGEL:
1656 nIdx = SvxBorderLineStyle::DOTTED;
1657 break;
1658 default:
1659 break;
1660 }
1661
1662 if (SvxBorderLineStyle::NONE != nIdx)
1663 {
1664 SvxBorderLine aLine;
1665 aLine.SetColor( rLineColor );
1666
1667 aLine.SetWidth( nLineThick ); // No conversion here, nLineThick is already in twips
1668 aLine.SetBorderLineStyle(nIdx);
1669
1671 {
1672 // aLine is cloned by SetLine
1673 rBox.SetLine(&aLine, nLine);
1674 }
1675 }
1676
1677 return nOutsideThick;
1678}
1679
1680#define WW8ITEMVALUE(ItemSet,Id,Cast) ItemSet.GetItem<Cast>(Id)->GetValue()
1681
1683 SfxItemSet& rFlySet, MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType,
1684 tools::Rectangle& rInnerDist )
1685{
1686 /*
1687 attributes to be set on the frame
1688 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1689 SwFormatFrameSize if not set, set here
1690 SvxLRSpaceItem set here
1691 SvxULSpaceItem set here
1692 SvxOpaqueItem (Currently not possible for frames! khz 10.2.1999)
1693 SwFormatSurround already set
1694 SwFormatVertOrient already set
1695 SwFormatHoriOrient already set
1696 SwFormatAnchor already set
1697 SvxBoxItem set here
1698 SvxBrushItem set here
1699 SvxShadowItem set here
1700 */
1701
1702 // 1. GraphicObject of documents?
1703 GraphicCtor();
1704
1705 const SfxItemSet& rOldSet = pSdrObj->GetMergedItemSet();
1706
1707 // some Items can be taken over directly
1708 static sal_uInt16 const aDirectMatch[]
1709 {
1710 RES_LR_SPACE, // outer spacing left/right: SvxLRSpaceItem
1711 RES_UL_SPACE // outer spacing top/bottom: SvxULSpaceItem
1712 };
1713 const SfxPoolItem* pPoolItem;
1714 for(sal_uInt16 i : aDirectMatch)
1715 if( SfxItemState::SET == rOldSet.GetItemState(i, false, &pPoolItem) )
1716 {
1717 rFlySet.Put( *pPoolItem );
1718 }
1719
1720 // take new XATTR items directly. Skip old RES_BACKGROUND if new FILLSTYLE taken.
1721 bool bSkipResBackground = false;
1722 SfxItemPool* pPool = rFlySet.GetPool();
1723 if ( pPool )
1724 {
1725 for ( sal_uInt16 i = XATTR_START; i < XATTR_END; ++i )
1726 {
1727 // Not all Fly types support XATTRs - skip unsupported attributes
1728 SfxItemPool* pAttrPool = pPool->GetMasterPool();
1729 while ( pAttrPool && !pAttrPool->IsInRange(i) )
1730 pAttrPool = pAttrPool->GetSecondaryPool();
1731 if ( !pAttrPool )
1732 continue;
1733
1734 if ( SfxItemState::SET == rOldSet.GetItemState(i, false, &pPoolItem) )
1735 {
1736 rFlySet.Put( *pPoolItem );
1737 if ( i == XATTR_FILLSTYLE )
1738 {
1739 const drawing::FillStyle eFill = static_cast<const XFillStyleItem*>(pPoolItem)->GetValue();
1740 // Transparency forced in certain situations when fillstyle is none - use old logic for that case still
1741 // which is especially needed for export purposes (tdf112618).
1742 if ( eFill != drawing::FillStyle_NONE )
1743 bSkipResBackground = true;
1744 }
1745 }
1746 }
1747 }
1748
1749 // now calculate the borders and build the box: The unit is needed for the
1750 // frame SIZE!
1751 SvxBoxItem aBox(rFlySet.Get(RES_BOX));
1752 // dashed or solid becomes solid
1753 // WW-default: 0.75 pt = 15 twips
1754 sal_Int32 nLineThick = 15, nOutside=0;
1755
1756 // check if LineStyle is *really* set!
1757
1758 SfxItemState eState = rOldSet.GetItemState(XATTR_LINESTYLE);
1759 if( eState == SfxItemState::SET )
1760 {
1761 // Now, that we know there is a line style we will make use the
1762 // parameter given to us when calling the method... :-)
1763 const Color aLineColor = rOldSet.Get(XATTR_LINECOLOR).GetColorValue();
1764 nLineThick = WW8ITEMVALUE(rOldSet, XATTR_LINEWIDTH, XLineWidthItem);
1765
1766 if( !nLineThick )
1767 nLineThick = 1; // for Writer, zero is "no border", so set a minimal value
1768
1769 nOutside = MatchSdrBoxIntoFlyBoxItem(aLineColor, eLineStyle,
1770 eDashing, eShapeType, nLineThick, aBox);
1771 }
1772
1773 rInnerDist.AdjustLeft(nLineThick );
1774 rInnerDist.AdjustTop(nLineThick );
1775 rInnerDist.AdjustRight(nLineThick );
1776 rInnerDist.AdjustBottom(nLineThick );
1777
1778 rInnerDist.AdjustLeft( -(aBox.CalcLineWidth( SvxBoxItemLine::LEFT )) );
1779 rInnerDist.AdjustTop( -(aBox.CalcLineWidth( SvxBoxItemLine::TOP )) );
1780 rInnerDist.AdjustRight( -(aBox.CalcLineWidth( SvxBoxItemLine::RIGHT )) );
1781 rInnerDist.AdjustBottom( -(aBox.CalcLineWidth( SvxBoxItemLine::BOTTOM )) );
1782
1783 // set distances from box's border to text contained within the box
1784 if( 0 < rInnerDist.Left() )
1785 aBox.SetDistance( o3tl::narrowing<sal_uInt16>(rInnerDist.Left()), SvxBoxItemLine::LEFT );
1786 if( 0 < rInnerDist.Top() )
1787 aBox.SetDistance( o3tl::narrowing<sal_uInt16>(rInnerDist.Top()), SvxBoxItemLine::TOP );
1788 if( 0 < rInnerDist.Right() )
1789 aBox.SetDistance( o3tl::narrowing<sal_uInt16>(rInnerDist.Right()), SvxBoxItemLine::RIGHT );
1790 if( 0 < rInnerDist.Bottom() )
1791 aBox.SetDistance( o3tl::narrowing<sal_uInt16>(rInnerDist.Bottom()), SvxBoxItemLine::BOTTOM );
1792
1793 bool bFixSize = !(WW8ITEMVALUE(rOldSet, SDRATTR_TEXT_AUTOGROWHEIGHT,
1794 SdrOnOffItem));
1795
1796 // Size: SwFormatFrameSize
1797 if( SfxItemState::SET != rFlySet.GetItemState(RES_FRM_SIZE, false) )
1798 {
1799 const tools::Rectangle& rSnapRect = pSdrObj->GetSnapRect();
1800 // if necessary adapt width and position of the framework: The
1801 // recorded interior is to remain equally large despite thick edges.
1803 rSnapRect.GetWidth() + 2*nOutside,
1804 rSnapRect.GetHeight() + 2*nOutside) );
1805 }
1806 else // If a size is set, adjust it to consider border thickness
1807 {
1808 SwFormatFrameSize aSize = rFlySet.Get(RES_FRM_SIZE);
1809
1811 aSize.GetWidth() + 2*nOutside,
1812 aSize.GetHeight() + 2*nOutside);
1813 aNewSize.SetWidthSizeType(aSize.GetWidthSizeType());
1814 rFlySet.Put( aNewSize );
1815 }
1816
1817 // Sadly word puts escher borders outside the graphic, but orients the
1818 // graphic in relation to the top left inside the border. We don't
1819 if (nOutside)
1820 {
1821 SwFormatHoriOrient aHori = rFlySet.Get(RES_HORI_ORIENT);
1822 aHori.SetPos(MakeSafePositioningValue(aHori.GetPos()-nOutside));
1823 rFlySet.Put(aHori);
1824
1825 SwFormatVertOrient aVert = rFlySet.Get(RES_VERT_ORIENT);
1826 aVert.SetPos(aVert.GetPos()-nOutside);
1827 rFlySet.Put(aVert);
1828 }
1829
1830 // now set the border
1831 rFlySet.Put( aBox );
1832
1833 // shadow of the box: SvxShadowItem
1835 {
1836 SvxShadowItem aShadow( RES_SHADOW );
1837
1838 const Color aShdColor = rOldSet.Get(SDRATTR_SHADOWCOLOR).GetColorValue();
1839 const sal_Int32 nShdDistX = WW8ITEMVALUE(rOldSet, SDRATTR_SHADOWXDIST,
1841 const sal_Int32 nShdDistY = WW8ITEMVALUE(rOldSet, SDRATTR_SHADOWYDIST,
1843
1844 aShadow.SetColor( aShdColor );
1845
1846 aShadow.SetWidth(writer_cast<sal_uInt16>((std::abs( nShdDistX) +
1847 std::abs( nShdDistY )) / 2 ));
1848
1849 SvxShadowLocation eShdPosi;
1850 if( 0 <= nShdDistX )
1851 {
1852 if( 0 <= nShdDistY )
1853 eShdPosi = SvxShadowLocation::BottomRight;
1854 else
1855 eShdPosi = SvxShadowLocation::TopRight;
1856 }
1857 else
1858 {
1859 if( 0 <= nShdDistY )
1860 eShdPosi = SvxShadowLocation::BottomLeft;
1861 else
1862 eShdPosi = SvxShadowLocation::TopLeft;
1863 }
1864 aShadow.SetLocation( eShdPosi );
1865
1866 rFlySet.Put( aShadow );
1867 }
1869 bool bBrushItemOk = false;
1870 sal_uInt8 nTrans = 0;
1871
1872 // Separate transparency
1873 eState = rOldSet.GetItemState(XATTR_FILLTRANSPARENCE);
1874 if (!bSkipResBackground && eState == SfxItemState::SET)
1875 {
1876 sal_uInt16 nRes = WW8ITEMVALUE(rOldSet, XATTR_FILLTRANSPARENCE,
1878 nTrans = sal_uInt8((nRes * 0xFE) / 100);
1879 aBrushItem.GetColor().SetAlpha(255 - nTrans);
1880 bBrushItemOk = true;
1881 }
1882
1883 // Background: SvxBrushItem
1884 const XFillStyleItem* pFillStyleItem = rOldSet.GetItemIfSet(XATTR_FILLSTYLE);
1885 if (!bSkipResBackground && pFillStyleItem)
1886 {
1887 const drawing::FillStyle eFill = pFillStyleItem->GetValue();
1888
1889 switch (eFill)
1890 {
1891 default:
1892 case drawing::FillStyle_NONE:
1893 // Writer graphics don't have it yet
1894 if (eShapeType != mso_sptPictureFrame)
1895 {
1896 aBrushItem.GetColor().SetAlpha(1);
1897 bBrushItemOk = true;
1898 }
1899 break;
1900 case drawing::FillStyle_SOLID:
1901 case drawing::FillStyle_GRADIENT:
1902 {
1903 const Color aColor =
1904 rOldSet.Get(XATTR_FILLCOLOR).GetColorValue();
1905 aBrushItem.SetColor(aColor);
1906
1907 if (bBrushItemOk) // has trans
1908 aBrushItem.GetColor().SetAlpha(255 - nTrans);
1909
1910 bBrushItemOk = true;
1911 }
1912 break;
1913 case drawing::FillStyle_HATCH:
1914 break;
1915 case drawing::FillStyle_BITMAP:
1916 {
1917 GraphicObject aGrfObj(rOldSet.Get(XATTR_FILLBITMAP).GetGraphicObject());
1918 const bool bTile(WW8ITEMVALUE(rOldSet, XATTR_FILLBMP_TILE, XFillBmpTileItem));
1919
1920 if(bBrushItemOk) // has trans
1921 {
1922 GraphicAttr aAttr(aGrfObj.GetAttr());
1923
1924 aAttr.SetAlpha(255 - nTrans);
1925 aGrfObj.SetAttr(aAttr);
1926 }
1927
1928 aBrushItem.SetGraphicObject(aGrfObj);
1929 aBrushItem.SetGraphicPos(bTile ? GPOS_TILED : GPOS_AREA);
1930 bBrushItemOk = true;
1931 }
1932 break;
1933 }
1934 }
1935
1936 if (bBrushItemOk)
1937 rFlySet.Put(aBrushItem);
1938}
1939
1941 const SvxMSDffImportRec &rRecord, SvxLRSpaceItem &rLR)
1942{
1943 sal_uInt32 nXRelTo = SvxMSDffImportRec::RELTO_DEFAULT;
1944 if ( rRecord.nXRelTo )
1945 {
1946 nXRelTo = *rRecord.nXRelTo;
1947 }
1948
1949 // Left adjustments - if horizontally aligned to left of
1950 // margin or column then remove the left wrapping
1951 if (rRecord.nXAlign == 1)
1952 {
1953 if ((nXRelTo == 0) || (nXRelTo == 2))
1954 rLR.SetLeft(sal_uInt16(0));
1955 }
1956
1957 // Right adjustments - if horizontally aligned to right of
1958 // margin or column then remove the right wrapping
1959 if (rRecord.nXAlign == 3)
1960 {
1961 if ((nXRelTo == 0) || (nXRelTo == 2))
1962 rLR.SetRight(sal_uInt16(0));
1963 }
1964
1965 // Inside margin, remove left wrapping
1966 if ((rRecord.nXAlign == 4) && (nXRelTo == 0))
1967 {
1968 rLR.SetLeft(sal_uInt16(0));
1969 }
1970
1971 // Outside margin, remove left wrapping
1972 if ((rRecord.nXAlign == 5) && (nXRelTo == 0))
1973 {
1974 rLR.SetRight(sal_uInt16(0));
1975 }
1976}
1977
1979 const SvxMSDffImportRec &rRecord, SvxULSpaceItem &rUL)
1980{
1981 sal_uInt32 nYRelTo = SvxMSDffImportRec::RELTO_DEFAULT;
1982 if ( rRecord.nYRelTo )
1983 {
1984 nYRelTo = *rRecord.nYRelTo;
1985 }
1986
1987 // Top adjustment - remove upper wrapping if aligned to page
1988 // printable area or to page
1989 if (rRecord.nYAlign == 1)
1990 {
1991 if ((nYRelTo == 0) || (nYRelTo == 1))
1992 rUL.SetUpper(sal_uInt16(0));
1993 }
1994
1995 // Bottom adjustment - remove bottom wrapping if aligned to page or
1996 // printable area or to page
1997 if (rRecord.nYAlign == 3)
1998 {
1999 if ((nYRelTo == 0) || (nYRelTo == 1))
2000 rUL.SetLower(sal_uInt16(0));
2001 }
2002
2003 // Remove top margin if aligned vertically inside margin
2004 if ((rRecord.nYAlign == 4) && (nYRelTo == 0))
2005 rUL.SetUpper(sal_uInt16(0));
2006}
2007
2009 SwFrameFormat& rFlyFormat)
2010{
2011 if (rRecord.nDxWrapDistLeft || rRecord.nDxWrapDistRight)
2012 {
2013 SvxLRSpaceItem aLR(writer_cast<sal_uInt16>(rRecord.nDxWrapDistLeft),
2014 writer_cast<sal_uInt16>(rRecord.nDxWrapDistRight), 0, RES_LR_SPACE);
2015 AdjustLRWrapForWordMargins(rRecord, aLR);
2016 rFlyFormat.SetFormatAttr(aLR);
2017 }
2018 if (rRecord.nDyWrapDistTop || rRecord.nDyWrapDistBottom)
2019 {
2020 SvxULSpaceItem aUL(writer_cast<sal_uInt16>(rRecord.nDyWrapDistTop),
2021 writer_cast<sal_uInt16>(rRecord.nDyWrapDistBottom), RES_UL_SPACE);
2022 AdjustULWrapForWordMargins(rRecord, aUL);
2023 rFlyFormat.SetFormatAttr(aUL);
2024 }
2025
2026 // If we are contoured and have a custom polygon...
2027 if (rRecord.pWrapPolygon && rFlyFormat.GetSurround().IsContour())
2028 {
2029 if (SwNoTextNode* pNd = GetNoTextNodeFromSwFrameFormat(rFlyFormat))
2030 {
2031 /*
2032 Gather round children and hear of a tale that will raise the
2033 hairs on the back of your neck this dark halloween night.
2034
2035 There is a polygon in word that describes the wrapping around
2036 the graphic.
2037
2038 Here are some sample values for the simplest case of a square
2039 around some solid coloured graphics
2040
2041 X Y Pixel size of graphic
2042 TopLeft -54 21600 400x400
2043 Bottom Right 0 21546
2044
2045 TopLeft -108 21600 200x200
2046 Bottom Right 0 21492
2047
2048 TopLeft -216 21600 100x100
2049 Bottom Right 0 21384
2050
2051 TopLeft -432 21600 50x50
2052 Bottom Right 0 21168
2053
2054 TopLeft -76 21600 283x212
2055 Bottom Right 0 21498
2056
2057 So given that the size of the values remains pretty much the
2058 same despite the size of the graphic, we can tell that the
2059 polygon is measured in units that are independent of the
2060 graphic. But why does the left corner move a different value
2061 to the left each time, and why does the bottom move upwards
2062 each time, when the right and top remain at the same value ?
2063
2064 I have no idea, but clearly once we calculate the values out
2065 we see that the left margin is always a fixed realworld
2066 distance from the true left and the polygon bottom is the same
2067 fixed value from the bottom. i.e. 15twips.
2068
2069 So here we take our word provided polygon, shift it to the
2070 right by 15twips and rescale it widthwise to shrink the width
2071 a little to fit the now moved right margin back to where it
2072 was, and stretch the height a little to make the bottom move
2073 down the missing 15twips then we get a polygon that matches
2074 what I actually see in word
2075 */
2076
2077 tools::PolyPolygon aPoly(*rRecord.pWrapPolygon);
2078 const Size &rSize = pNd->GetTwipSize();
2079 /*
2080 Move to the left by 15twips, and rescale to
2081 a) shrink right bound back to orig position
2082 b) stretch bottom bound to where I think it should have been
2083 in the first place
2084 */
2085 Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
2086 aMoveHack *= Fraction(15, 1);
2087 tools::Long nMove(aMoveHack);
2088 aPoly.Move(nMove, 0);
2089
2092 aPoly.Scale(double(aHackX), double(aHackY));
2093
2094 // Turn polygon back into units that match the graphic's
2095 const Size &rOrigSize = pNd->GetGraphic().GetPrefSize();
2096 Fraction aMapPolyX(rOrigSize.Width(), ww::nWrap100Percent);
2097 Fraction aMapPolyY(rOrigSize.Height(), ww::nWrap100Percent);
2098 aPoly.Scale(double(aMapPolyX), double(aMapPolyY));
2099
2100 // #i47277# - contour is already in unit of the
2101 // graphic preferred unit. Thus, call method <SetContour(..)>
2102 pNd->SetContour(&aPoly);
2103 }
2104 }
2105 else if (rFlyFormat.GetSurround().IsContour())
2106 {
2107 const SdrObject* pSdrObj = rFlyFormat.FindSdrObject();
2108 SdrObjKind eKind = pSdrObj ? pSdrObj->GetObjIdentifier() : SdrObjKind::Graphic;
2109 switch (eKind)
2110 {
2111 case SdrObjKind::Text:
2112 break;
2113 case SdrObjKind::SwFlyDrawObjIdentifier:
2114 default:
2115 {
2116 // Contour is enabled, but no polygon is set: disable contour, because Word does not
2117 // Writer-style auto-contour in that case.
2118 SwFormatSurround aSurround(rFlyFormat.GetSurround());
2119 aSurround.SetContour(false);
2120 rFlyFormat.SetFormatAttr(aSurround);
2121 }
2122 }
2123 }
2124}
2125
2126static sal_Int32 lcl_ConvertCrop(sal_uInt32 const nCrop, sal_Int32 const nSize)
2127{
2128 // cast to sal_Int32 to handle negative crop properly
2129 sal_Int32 const nIntegral(static_cast<sal_Int32>(nCrop) >> 16);
2130 // fdo#77454: heuristic to detect mangled values written by old OOo/LO
2131 if (abs(nIntegral) >= 50) // FIXME: what's a good cut-off?
2132 {
2133 SAL_INFO("sw.ww8", "ignoring suspiciously large crop: " << nIntegral);
2134 return 0;
2135 }
2136 return (nIntegral * nSize) + (((nCrop & 0xffff) * nSize) >> 16);
2137}
2138
2140 const SwFrameFormat& rFlyFormat, WW8_FSPA const *pF)
2141{
2142 const SwNodeIndex* pIdx = rFlyFormat.GetContent(false).GetContentIdx();
2143 SwGrfNode *const pGrfNd(
2144 pIdx ? m_rDoc.GetNodes()[pIdx->GetIndex() + 1]->GetGrfNode() : nullptr);
2145 if (!pGrfNd)
2146 return;
2147
2148 Size aSz(pGrfNd->GetTwipSize());
2149 // use type <sal_uInt64> instead of sal_uLong to get correct results
2150 // in the following calculations.
2151 sal_uInt64 nHeight = aSz.Height();
2152 sal_uInt64 nWidth = aSz.Width();
2153 if (!nWidth && pF)
2154 nWidth = o3tl::saturating_sub(pF->nXaRight, pF->nXaLeft);
2155 else if (!nHeight && pF)
2156 nHeight = o3tl::saturating_sub(pF->nYaBottom, pF->nYaTop);
2157
2158 if (rRecord.nCropFromTop || rRecord.nCropFromBottom ||
2159 rRecord.nCropFromLeft || rRecord.nCropFromRight)
2160 {
2161 SwCropGrf aCrop; // Cropping is stored in 'fixed floats'
2162 // 16.16 (fraction times total
2163 if (rRecord.nCropFromTop) // image width or height resp.)
2164 {
2165 aCrop.SetTop(lcl_ConvertCrop(rRecord.nCropFromTop, nHeight));
2166 }
2167 if (rRecord.nCropFromBottom)
2168 {
2169 aCrop.SetBottom(lcl_ConvertCrop(rRecord.nCropFromBottom, nHeight));
2170 }
2171 if (rRecord.nCropFromLeft)
2172 {
2173 aCrop.SetLeft(lcl_ConvertCrop(rRecord.nCropFromLeft, nWidth));
2174 }
2175 if (rRecord.nCropFromRight)
2176 {
2177 aCrop.SetRight(lcl_ConvertCrop(rRecord.nCropFromRight, nWidth));
2178 }
2179
2180 pGrfNd->SetAttr( aCrop );
2181 }
2182
2183 bool bFlipH(rRecord.nFlags & ShapeFlag::FlipH);
2184 bool bFlipV(rRecord.nFlags & ShapeFlag::FlipV);
2185 if ( bFlipH || bFlipV )
2186 {
2187 SwMirrorGrf aMirror = pGrfNd->GetSwAttrSet().GetMirrorGrf();
2188 if( bFlipH )
2189 {
2190 if( bFlipV )
2191 aMirror.SetValue(MirrorGraph::Both);
2192 else
2194 }
2195 else
2197
2198 pGrfNd->SetAttr( aMirror );
2199 }
2200
2201 if (!rRecord.pObj)
2202 return;
2203
2204 const SfxItemSet& rOldSet = rRecord.pObj->GetMergedItemSet();
2205 // contrast
2208 {
2209 SwContrastGrf aContrast(
2210 WW8ITEMVALUE(rOldSet,
2212 pGrfNd->SetAttr( aContrast );
2213 }
2214
2215 // luminance
2218 {
2219 SwLuminanceGrf aLuminance(WW8ITEMVALUE(rOldSet,
2221 pGrfNd->SetAttr( aLuminance );
2222 }
2223 // gamma
2225 {
2226 double fVal = WW8ITEMVALUE(rOldSet, SDRATTR_GRAFGAMMA,
2228 pGrfNd->SetAttr(SwGammaGrf(fVal/100.));
2229 }
2230
2231 // drawmode
2232 auto nGrafMode = rOldSet.GetItem<SdrGrafModeItem>(SDRATTR_GRAFMODE)->GetValue();
2233 if ( nGrafMode != GraphicDrawMode::Standard)
2234 {
2235 SwDrawModeGrf aDrawMode( nGrafMode );
2236 pGrfNd->SetAttr( aDrawMode );
2237 }
2238}
2239
2241{
2242 if (pFlyFormat)
2243 {
2244 SdrObject* pNewObject = m_bNewDoc ? nullptr : pFlyFormat->FindRealSdrObject();
2245 if (!pNewObject)
2246 pNewObject = pFlyFormat->FindSdrObject();
2247 if (!pNewObject )
2248 if (auto pFlyFrameFormat = dynamic_cast<SwFlyFrameFormat *>( pFlyFormat ))
2249 {
2250 SwFlyDrawContact* pContactObject = pFlyFrameFormat->GetOrCreateContact();
2251 pNewObject = pContactObject->GetMaster();
2252 }
2253 return pNewObject;
2254 }
2255 return nullptr;
2256}
2257
2258// Miserable miserable hack to fudge word's graphic layout in RTL mode to ours.
2260 sal_Int16 eHoriOri, sal_Int16 eHoriRel)
2261{
2262 if (!IsRightToLeft())
2263 return false;
2264 return RTLGraphicsHack(rLeft, nWidth, eHoriOri, eHoriRel,
2268}
2269
2271 SfxItemSet &rFlySet)
2272{
2273 bool bCurSectionVertical = m_aSectionManager.CurrentSectionIsVertical();
2274
2275 if (!rRecord.nXRelTo)
2276 {
2277 rRecord.nXRelTo = sal_Int32(rFSPA.nbx);
2278 }
2279 if (!rRecord.nYRelTo)
2280 {
2281 rRecord.nYRelTo = sal_Int32(rFSPA.nby);
2282 }
2283
2284 // nXAlign - abs. Position, Left, Centered, Right, Inside, Outside
2285 // nYAlign - abs. Position, Top, Centered, Bottom, Inside, Outside
2286
2287 // nXRelTo - Page printable area, Page, Column, Character
2288 // nYRelTo - Page printable area, Page, Paragraph, Line
2289
2290 const sal_uInt32 nCntXAlign = 6;
2291 const sal_uInt32 nCntYAlign = 6;
2292
2293 const sal_uInt32 nCntRelTo = 4;
2294
2295 sal_uInt32 nXAlign = nCntXAlign > rRecord.nXAlign ? rRecord.nXAlign : 1;
2296 sal_uInt32 nYAlign = nCntYAlign > rRecord.nYAlign ? rRecord.nYAlign : 1;
2297
2298 // #i52565# - try to handle special case for objects in tables regarding its X Rel
2299
2300 // if X and Y Rel values are on default take it as a hint, that they have not been set
2301 // by <SwMSDffManager::ProcessObj(..)>
2302 const bool bXYRelHaveDefaultValues = *rRecord.nXRelTo == 2 && *rRecord.nYRelTo == 2;
2303 if (bXYRelHaveDefaultValues && m_nInTable > 0 && !bCurSectionVertical)
2304 {
2305 if (sal_uInt32(rFSPA.nby) != rRecord.nYRelTo)
2306 rRecord.nYRelTo = sal_uInt32(rFSPA.nby);
2307 }
2308
2309 sal_uInt32 nXRelTo = (rRecord.nXRelTo && nCntRelTo > rRecord.nXRelTo) ? *rRecord.nXRelTo : 1;
2310 sal_uInt32 nYRelTo = (rRecord.nYRelTo && nCntRelTo > rRecord.nYRelTo) ? *rRecord.nYRelTo : 1;
2311
2312 RndStdIds eAnchor = IsInlineEscherHack() ? RndStdIds::FLY_AS_CHAR : RndStdIds::FLY_AT_CHAR; // #i43718#
2313
2314 SwFormatAnchor aAnchor( eAnchor );
2315 aAnchor.SetAnchor( m_pPaM->GetPoint() );
2316 rFlySet.Put( aAnchor );
2317
2318 // #i18732#
2319 // Given new layout where everything is changed to be anchored to
2320 // character the following 4 tables may need to be changed.
2321
2322 // horizontal Adjustment
2323 static const sal_Int16 aHoriOriTab[ nCntXAlign ] =
2324 {
2325 text::HoriOrientation::NONE, // From left position
2326 text::HoriOrientation::LEFT, // left
2327 text::HoriOrientation::CENTER, // centered
2328 text::HoriOrientation::RIGHT, // right
2329 // #i36649#
2330 // - inside -> text::HoriOrientation::LEFT and outside -> text::HoriOrientation::RIGHT
2331 text::HoriOrientation::LEFT, // inside
2332 text::HoriOrientation::RIGHT // outside
2333 };
2334
2335 // generic vertical Adjustment
2336 static const sal_Int16 aVertOriTab[ nCntYAlign ] =
2337 {
2338 text::VertOrientation::NONE, // From Top position
2339 text::VertOrientation::TOP, // top
2340 text::VertOrientation::CENTER, // centered
2341 text::VertOrientation::BOTTOM, // bottom
2342 text::VertOrientation::LINE_TOP, // inside (obscure)
2343 text::VertOrientation::LINE_BOTTOM // outside (obscure)
2344 };
2345
2346 // #i22673# - to-line vertical alignment
2347 static const sal_Int16 aToLineVertOriTab[ nCntYAlign ] =
2348 {
2350 text::VertOrientation::LINE_BOTTOM, // top
2351 text::VertOrientation::LINE_CENTER, // centered
2352 text::VertOrientation::LINE_TOP, // bottom
2353 text::VertOrientation::LINE_BOTTOM, // inside (obscure)
2354 text::VertOrientation::LINE_TOP // outside (obscure)
2355 };
2356
2357 // Adjustment is horizontally relative to...
2358 static const sal_Int16 aHoriRelOriTab[nCntRelTo] =
2359 {
2360 text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
2361 text::RelOrientation::PAGE_FRAME, // 1 is page margin
2362 text::RelOrientation::FRAME, // 2 is relative to column
2363 text::RelOrientation::CHAR // 3 is relative to character
2364 };
2365
2366 // Adjustment is vertically relative to...
2367 // #i22673# - adjustment for new vertical alignment at top of line.
2368 static const sal_Int16 aVertRelOriTab[nCntRelTo] =
2369 {
2370 text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
2371 text::RelOrientation::PAGE_FRAME, // 1 is page margin
2372 text::RelOrientation::FRAME, // 2 is relative to paragraph
2373 text::RelOrientation::TEXT_LINE // 3 is relative to line
2374 };
2375
2376 sal_Int16 eHoriOri = aHoriOriTab[ nXAlign ];
2377 sal_Int16 eHoriRel = aHoriRelOriTab[ nXRelTo ];
2378
2379 // #i36649# - adjustments for certain alignments
2380 if (eHoriOri == text::HoriOrientation::LEFT && eHoriRel == text::RelOrientation::PAGE_FRAME)
2381 {
2382 // convert 'left to page' to 'from left -<width> to page text area'
2383 eHoriOri = text::HoriOrientation::NONE;
2384 eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;
2385 const tools::Long nWidth = rFSPA.nXaRight - rFSPA.nXaLeft;
2386 rFSPA.nXaLeft = -nWidth;
2387 rFSPA.nXaRight = 0;
2388 }
2389 else if (eHoriOri == text::HoriOrientation::RIGHT && eHoriRel == text::RelOrientation::PAGE_FRAME)
2390 {
2391 // convert 'right to page' to 'from left 0 to right page border'
2392 eHoriOri = text::HoriOrientation::NONE;
2393 eHoriRel = text::RelOrientation::PAGE_RIGHT;
2394 const tools::Long nWidth = rFSPA.nXaRight - rFSPA.nXaLeft;
2395 rFSPA.nXaLeft = 0;
2396 rFSPA.nXaRight = nWidth;
2397 }
2398
2399 // #i24255# - position of floating screen objects in
2400 // R2L layout are given in L2R layout, thus convert them of all
2401 // floating screen objects, which are imported.
2402 {
2403 // Miserable miserable hack.
2404 SwTwips nWidth = o3tl::saturating_sub(rFSPA.nXaRight, rFSPA.nXaLeft);
2405 SwTwips nLeft = rFSPA.nXaLeft;
2406 if (MiserableRTLGraphicsHack(nLeft, nWidth, eHoriOri,
2407 eHoriRel))
2408 {
2409 rFSPA.nXaLeft = nLeft;
2410 rFSPA.nXaRight = rFSPA.nXaLeft + nWidth;
2411 }
2412 }
2413
2414 // if the object is anchored inside a table cell, is horizontal aligned
2415 // at frame|character and has wrap through, but its attribute
2416 // 'layout in table cell' isn't set, convert its horizontal alignment to page text area.
2417 // #i84783# - use new method <IsObjectLayoutInTableCell()>
2418 if (m_nInTable &&
2419 (eHoriRel == text::RelOrientation::FRAME || eHoriRel == text::RelOrientation::CHAR) &&
2420 rFSPA.nwr == 3 &&
2422 {
2423 eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;
2424 }
2425
2426 // Writer honours this wrap distance when aligned as "left" or "right",
2427 // Word doesn't. Writer doesn't honour it when its "from left".
2428 if (eHoriOri == text::HoriOrientation::LEFT)
2429 rRecord.nDxWrapDistLeft = 0;
2430 else if (eHoriOri == text::HoriOrientation::RIGHT)
2431 rRecord.nDxWrapDistRight = 0;
2432
2433 sal_Int16 eVertRel;
2434
2435 eVertRel = aVertRelOriTab[ nYRelTo ]; // #i18732#
2436 if (bCurSectionVertical && nYRelTo == 2)
2437 eVertRel = text::RelOrientation::PAGE_PRINT_AREA;
2438 // #i22673# - fill <eVertOri> in dependence of <eVertRel>
2439 sal_Int16 eVertOri;
2440 if (eVertRel == text::RelOrientation::TEXT_LINE)
2441 {
2442 eVertOri = aToLineVertOriTab[ nYAlign ];
2443 }
2444 else
2445 {
2446 eVertOri = aVertOriTab[ nYAlign ];
2447 }
2448
2449 // Below line in word is a positive value, while in writer its
2450 // negative
2451 tools::Long nYPos = rFSPA.nYaTop;
2452 // #i22673#
2453 if ((eVertRel == text::RelOrientation::TEXT_LINE) && (eVertOri == text::VertOrientation::NONE))
2454 nYPos = -nYPos;
2455
2456 SwFormatHoriOrient aHoriOri(MakeSafePositioningValue(bCurSectionVertical ? nYPos : rFSPA.nXaLeft),
2457 bCurSectionVertical ? eVertOri : eHoriOri,
2458 bCurSectionVertical ? eVertRel : eHoriRel);
2459 if (4 <= nXAlign)
2460 aHoriOri.SetPosToggle(true);
2461 rFlySet.Put(aHoriOri);
2462
2463 rFlySet.Put(SwFormatVertOrient(MakeSafePositioningValue(!bCurSectionVertical ? nYPos : -rFSPA.nXaRight),
2464 !bCurSectionVertical ? eVertOri : eHoriOri,
2465 !bCurSectionVertical ? eVertRel : eHoriRel));
2466
2467 return eAnchor;
2468}
2469
2470// #i84783#
2471bool SwWW8ImplReader::IsObjectLayoutInTableCell(const sal_uInt32 nGroupShapeBooleanProperties) const
2472{
2473 bool bIsObjectLayoutInTableCell = false;
2474
2475 if ( m_bVer8 )
2476 {
2477 sal_uInt16 nWWVersion = m_xWwFib->m_nProduct & 0xE000;
2478 if (nWWVersion == 0)
2479 {
2480 // 0 nProduct can happen for Word >97 as well, check cswNew in this case instead.
2481 if (m_xWwFib->m_cswNew > 0)
2482 {
2483 // This is Word >=2000.
2484 nWWVersion = 0x2000;
2485 }
2486 }
2487
2488 switch ( nWWVersion )
2489 {
2490 case 0x0000: // version 8 aka Microsoft Word 97
2491 {
2492 bIsObjectLayoutInTableCell = false;
2493 OSL_ENSURE(nGroupShapeBooleanProperties == 0,
2494 "no explicit object attribute layout in table cell expected." );
2495 }
2496 break;
2497 case 0x2000: // version 9 aka Microsoft Word 2000
2498 case 0x4000: // version 10 aka Microsoft Word 2002
2499 case 0x6000: // version 11 aka Microsoft Word 2003
2500 case 0x8000: // version 12 aka Microsoft Word 2007
2501 case 0xC000: // version 14 aka Microsoft Word 2010
2502 case 0xE000: // version 15 aka Microsoft Word 2013
2503 {
2504 // Documented in [MS-ODRAW], 2.3.4.44 "Group Shape Boolean Properties".
2505 bool fUsefLayoutInCell = (nGroupShapeBooleanProperties & 0x80000000) >> 31;
2506 bool fLayoutInCell = (nGroupShapeBooleanProperties & 0x8000) >> 15;
2507 // If unspecified, defaults to true
2508 bIsObjectLayoutInTableCell = !fUsefLayoutInCell || fLayoutInCell;
2509 }
2510 break;
2511 default:
2512 {
2513 OSL_FAIL( "unknown version." );
2514 }
2515 }
2516 }
2517
2518 return bIsObjectLayoutInTableCell;
2519}
2520
2522{
2524 return nullptr;
2525
2527
2528 m_nDrawCpO = 0;
2529 m_bDrawCpOValid = m_xWwFib->GetBaseCp(m_xPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX, &m_nDrawCpO);
2530
2531 GraphicCtor();
2532
2533 WW8PLCFspecial* pPF = m_xPlcxMan->GetFdoa();
2534 if( !pPF )
2535 {
2536 OSL_ENSURE( false, "Where is the graphic (1) ?" );
2537 return nullptr;
2538 }
2539
2540 if( m_bVer67 )
2541 {
2542 sal_uInt64 nOldPos = m_pStrm->Tell();
2543
2545 ReadGrafLayer1(*pPF, nGrafAnchorCp);
2546
2547 m_pStrm->Seek( nOldPos );
2548 return nullptr;
2549 }
2550
2551 // Normal case of Word 8+ version stuff
2552 pPF->SeekPos( nGrafAnchorCp );
2553
2554 WW8_FC nStartFc;
2555 void* pF0;
2556 if (!pPF->Get(nStartFc, pF0))
2557 {
2558 OSL_ENSURE( false, "+Where is the graphic (2) ?" );
2559 return nullptr;
2560 }
2561
2562 WW8_FSPA_SHADOW& rFS = *static_cast<WW8_FSPA_SHADOW*>(pF0);
2563 WW8_FSPA aFSFA;
2564 WW8FSPAShadowToReal(rFS, aFSFA);
2565 if (!aFSFA.nSpId)
2566 {
2567 OSL_ENSURE( false, "+Where is the graphic (3) ?" );
2568 return nullptr;
2569 }
2570
2571 if (!m_xMSDffManager->GetModel())
2572 m_xMSDffManager->SetModel(m_pDrawModel, 1440);
2573
2574 tools::Rectangle aRect(aFSFA.nXaLeft, aFSFA.nYaTop, aFSFA.nXaRight, aFSFA.nYaBottom);
2575 SvxMSDffImportData aData( aRect );
2576
2578 bool bOk = (m_xMSDffManager->GetShape(aFSFA.nSpId, pObject, aData) && pObject);
2579
2580 if (!bOk)
2581 {
2582 OSL_ENSURE( false, "Where is the Shape ?" );
2583 return nullptr;
2584 }
2585
2586 // tdf#118375 Word relates position to the unrotated rectangle,
2587 // Writer uses the rotated one.
2588 if (pObject->GetRotateAngle())
2589 {
2590 tools::Rectangle aObjSnapRect(pObject->GetSnapRect()); // recalculates the SnapRect
2591 aFSFA.nXaLeft = aObjSnapRect.Left();
2592 aFSFA.nYaTop = aObjSnapRect.Top();
2593 aFSFA.nXaRight = aObjSnapRect.Right();
2594 aFSFA.nYaBottom = aObjSnapRect.Bottom();
2595 }
2596
2597 bool bDone = false;
2598 rtl::Reference<SdrObject> pOurNewObject;
2599 bool bReplaceable = false;
2600
2601 switch (pObject->GetObjIdentifier())
2602 {
2603 case SdrObjKind::Graphic:
2604 bReplaceable = true;
2605 bDone = true;
2606 break;
2607 case SdrObjKind::OLE2:
2608 bReplaceable = true;
2609 break;
2610 default:
2611 break;
2612
2613 }
2614
2615 // when in a header or footer word appears to treat all elements as wrap through
2616
2617 // determine wrapping mode
2619 Reader::ResetFrameFormatAttrs(aFlySet); // tdf#122425: Explicitly remove borders and spacing
2620 css::text::WrapTextMode eSurround = css::text::WrapTextMode_PARALLEL;
2621 bool bContour = false;
2622 switch (aFSFA.nwr)
2623 {
2624 case 0: // 0 like 2, but doesn't require absolute object
2625 case 2: // 2 wrap around absolute object
2626 eSurround = css::text::WrapTextMode_PARALLEL;
2627 break;
2628 case 1: // 1 no text next to shape
2629 eSurround = css::text::WrapTextMode_NONE;
2630 break;
2631 case 3: // 3 wrap as if no object present
2632 eSurround = css::text::WrapTextMode_THROUGH;
2633 break;
2634 case 4: // 4 wrap tightly around object
2635 case 5: // 5 wrap tightly, but allow holes
2636 eSurround = css::text::WrapTextMode_PARALLEL;
2637 bContour = true;
2638 break;
2639 }
2640
2641 // if mode 2 or 4 also regard the additional parameters
2642 if ((2 == aFSFA.nwr) || (4 == aFSFA.nwr))
2643 {
2644 switch (aFSFA.nwrk)
2645 {
2646 // 0 wrap both sides
2647 case 0:
2648 eSurround = css::text::WrapTextMode_PARALLEL;
2649 break;
2650 // 1 wrap only on left
2651 case 1:
2652 eSurround = css::text::WrapTextMode_LEFT;
2653 break;
2654 // 2 wrap only on right
2655 case 2:
2656 eSurround = css::text::WrapTextMode_RIGHT;
2657 break;
2658 // 3 wrap only on largest side
2659 case 3:
2660 eSurround = css::text::WrapTextMode_DYNAMIC;
2661 break;
2662 }
2663 }
2664
2665 SwFormatSurround aSur( eSurround );
2666 aSur.SetContour( bContour );
2667 aSur.SetOutside(true); // Winword can only do outside contours
2668 aFlySet.Put( aSur );
2669
2670 // now position imported object correctly and so on (can be a whole group)
2671
2672 OSL_ENSURE(!((aData.size() != 1) && bReplaceable),
2673 "Replaceable drawing with > 1 entries ?");
2674
2675 if (aData.size() != 1)
2676 bReplaceable = false;
2677
2678 /*
2679 Get the record for top level object, so we can get the word anchoring
2680 and wrapping information for it.
2681 */
2682 SvxMSDffImportRec* pRecord = aData.find(pObject.get());
2683 OSL_ENSURE(pRecord, "how did that happen?");
2684 if (!pRecord)
2685 {
2686 // remove old object from the Z-Order list
2687 m_xMSDffManager->RemoveFromShapeOrder(pObject.get());
2688 return nullptr;
2689 }
2690 const bool bLayoutInTableCell =
2692
2693 // #i18732# - Switch on 'follow text flow', if object is laid out
2694 // inside table cell
2695 if (bLayoutInTableCell)
2696 {
2697 SwFormatFollowTextFlow aFollowTextFlow( true );
2698 aFlySet.Put( aFollowTextFlow );
2699 }
2700
2701 // #i21847#
2702 // Some shapes are set to *hidden*, don't import those ones.
2703 if (pRecord->bHidden)
2704 {
2705 // remove old object from the Z-Order list
2706 m_xMSDffManager->RemoveFromShapeOrder(pObject.get());
2707 return nullptr;
2708 }
2709
2710 sal_uInt16 nCount = pObject->GetUserDataCount();
2711 if(nCount)
2712 {
2713 OUString lnName, aObjName, aTarFrame;
2714 for (sal_uInt16 i = 0; i < nCount; i++ )
2715 {
2716 SdrObjUserData* pData = pObject->GetUserData( i );
2717 if( pData && pData->GetInventor() == SdrInventor::ScOrSwDraw
2718 && pData->GetId() == SW_UD_IMAPDATA)
2719 {
2720 SwMacroInfo* macInf = dynamic_cast<SwMacroInfo*>(pData);
2721 if (macInf && macInf->GetShapeId() == aFSFA.nSpId)
2722 {
2723 lnName = macInf->GetHlink();
2724 aObjName = macInf->GetName();
2725 aTarFrame = macInf->GetTarFrame();
2726 break;
2727 }
2728 }
2729 }
2730 std::unique_ptr<SwFormatURL> pFormatURL(new SwFormatURL());
2731 pFormatURL->SetURL( lnName, false );
2732 if (!aObjName.isEmpty())
2733 pFormatURL->SetName(aObjName);
2734 if (!aTarFrame.isEmpty())
2735 pFormatURL->SetTargetFrameName(aTarFrame);
2736 pFormatURL->SetMap(nullptr);
2737 aFlySet.Put(std::move(pFormatURL));
2738 }
2739
2740 // If we are to be "below text" then we are not to be opaque
2741 // #i14045# MM If we are in a header or footer then make the object transparent
2742 // Not exactly like word but close enough for now
2743
2744 // both flags <bBelowText> and <bDrawHell> have to be set to move object into the background.
2745 // #i46794# - it reveals that value of flag <bBelowText> can be neglected.
2746 const bool bMoveToBackground = pRecord->bDrawHell ||
2747 ((m_bIsHeader || m_bIsFooter) && aFSFA.nwr == 3);
2748 if ( bMoveToBackground )
2749 aFlySet.Put(SvxOpaqueItem(RES_OPAQUE,false));
2750
2751 OUString aObjName = pObject->GetName();
2752
2753 bool bDrawObj = false;
2754 bool bFrame = false;
2755
2756 SwFrameFormat* pRetFrameFormat = nullptr;
2757 if (bReplaceable)
2758 {
2759 // Single graphics or ole objects
2760 pRetFrameFormat = ImportReplaceableDrawables(pObject, pOurNewObject, *pRecord, aFSFA, aFlySet);
2761 }
2762 else
2763 {
2764 bDrawObj = true;
2765
2766 // Drawing objects, (e.g. ovals or drawing groups)
2767 if (aFSFA.bRcaSimple)
2768 {
2771 }
2772
2773 RndStdIds eAnchor = ProcessEscherAlign(*pRecord, aFSFA, aFlySet);
2774
2775 // Should we, and is it possible to make this into a writer textbox
2776 if ((!(m_nIniFlags1 & WW8FL_NO_FLY_FOR_TXBX)) && pRecord->bReplaceByFly)
2777 {
2778 pRetFrameFormat
2779 = ConvertDrawTextToFly(pObject, pOurNewObject, *pRecord, eAnchor, aFSFA, aFlySet);
2780 if (pRetFrameFormat)
2781 {
2782 bDone = true;
2783 bDrawObj = false;
2784 bFrame = true;
2785 }
2786 }
2787
2788 if (!bDone)
2789 {
2790 sw::util::SetLayer aSetLayer(m_rDoc);
2791 if ( bMoveToBackground )
2792 aSetLayer.SendObjectToHell(*pObject);
2793 else
2794 aSetLayer.SendObjectToHeaven(*pObject);
2795
2796 if (!IsInlineEscherHack())
2797 {
2798 /* Need to make sure that the correct layer ordering is applied. */
2799 // pass information, if object is in page header|footer to method.
2800 m_xWWZOrder->InsertEscherObject(pObject.get(), aFSFA.nSpId, pRecord->bDrawHell,
2802 }
2803 else
2804 {
2805 m_xWWZOrder->InsertTextLayerObject(pObject.get());
2806 }
2807
2808 pRetFrameFormat = m_rDoc.getIDocumentContentOperations().InsertDrawObj(*m_pPaM, *pObject, aFlySet );
2809
2810 OSL_ENSURE(pRetFrameFormat->GetAnchor().GetAnchorId() ==
2811 eAnchor, "Not the anchor type requested!");
2812
2813 /*
2814 Insert text if necessary into textboxes contained in groups.
2815 */
2816 for (const auto& it : aData)
2817 {
2818 pRecord = it.get();
2819 if (pRecord->pObj && pRecord->aTextId.nTxBxS)
2820 { // #i52825# pRetFrameFormat can be NULL
2821 pRetFrameFormat = MungeTextIntoDrawBox(
2822 *pRecord, nGrafAnchorCp, pRetFrameFormat);
2823 }
2824 }
2825 }
2826 }
2827
2828 SwDrawFrameFormat* pDrawFrameFormat = dynamic_cast<SwDrawFrameFormat*>(pRetFrameFormat);
2829 // #i44344#, #i44681# - positioning attributes already set
2830 if (pDrawFrameFormat)
2831 pDrawFrameFormat->PosAttrSet();
2832 if (!IsInlineEscherHack() && pRetFrameFormat)
2833 MapWrapIntoFlyFormat(*pRecord, *pRetFrameFormat);
2834
2835 // Set frame name with object name
2836 if (pRetFrameFormat /*#i52825# */)
2837 {
2838 if (!aObjName.isEmpty())
2839 pRetFrameFormat->SetFormatName( aObjName );
2840 if (pRetFrameFormat->GetName().isEmpty())
2841 {
2842 if (bDrawObj)
2843 pRetFrameFormat->SetFormatName(m_rDoc.GetUniqueDrawObjectName());
2844 else if (bFrame)
2845 pRetFrameFormat->SetFormatName(m_rDoc.GetUniqueFrameName());
2846 }
2847 }
2848 return AddAutoAnchor(pRetFrameFormat);
2849}
2850
2852{
2853 /*
2854 * anchored to character at the current position will move along the
2855 * paragraph as text is added because we are at the insertion point.
2856 *
2857 * Leave to later and set the correct location then.
2858 */
2859 if (pFormat && (pFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR))
2860 {
2861 m_xAnchorStck->AddAnchor(*m_pPaM->GetPoint(), pFormat);
2862 }
2863 return pFormat;
2864}
2865
2867 tools::Long nGrafAnchorCp, SwFrameFormat* pRetFrameFormat)
2868{
2869 rtl::Reference<SdrObject> pTrueObject = rRecord.pObj;
2870
2871 rtl::Reference<SdrTextObj> pSdrTextObj;
2872
2873 // check for group object (e.g. two parentheses)
2874 if (SdrObjGroup* pThisGroup = dynamic_cast<SdrObjGroup*>(rRecord.pObj.get()))
2875 {
2876 // Group objects don't have text. Insert a text object into
2877 // the group for holding the text.
2878 pSdrTextObj = new SdrRectObj(
2879 *m_pDrawModel,
2880 SdrObjKind::Text,
2881 pThisGroup->GetCurrentBoundRect());
2882
2884 aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
2885 aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
2886 aSet.Put(SdrTextFitToSizeTypeItem( drawing::TextFitToSizeType_NONE ));
2888 aSet.Put(makeSdrTextAutoGrowWidthItem(false));
2889 pSdrTextObj->SetMergedItemSet(aSet);
2890 pSdrTextObj->NbcSetLayer( pThisGroup->GetLayer() );
2891 pThisGroup->GetSubList()->NbcInsertObject(pSdrTextObj.get());
2892 }
2893 else
2894 pSdrTextObj = DynCastSdrTextObj(rRecord.pObj.get());
2895
2896 if( pSdrTextObj )
2897 {
2898 Size aObjSize(pSdrTextObj->GetSnapRect().GetWidth(),
2899 pSdrTextObj->GetSnapRect().GetHeight());
2900
2901 // Object is part of a group?
2902 SdrObject* pGroupObject = pSdrTextObj->getParentSdrObjectFromSdrObject();
2903
2904 const size_t nOrdNum = pSdrTextObj->GetOrdNum();
2905 bool bEraseThisObject;
2906 InsertTxbxText(pSdrTextObj.get(), &aObjSize, rRecord.aTextId.nTxBxS, rRecord.aTextId.nSequence,
2907 nGrafAnchorCp, pRetFrameFormat,
2908 (pSdrTextObj.get() != pTrueObject.get()) || (nullptr != pGroupObject), bEraseThisObject,
2909 nullptr, nullptr, nullptr, nullptr, &rRecord);
2910
2911 // was this object replaced ??
2912 if (bEraseThisObject)
2913 {
2914 if( pGroupObject || (pSdrTextObj.get() != pTrueObject.get()) )
2915 {
2916 // Object is already replaced by a new SdrGrafObj (in the group
2917 // and) the Drawing-Page.
2918
2919 SdrObject* pNewObj = pGroupObject ?
2920 pGroupObject->GetSubList()->GetObj(nOrdNum) : pTrueObject.get();
2921 if (pSdrTextObj.get() != pNewObj)
2922 {
2923 // Replace object in the Z-Order-List
2924 m_xMSDffManager->ExchangeInShapeOrder(pSdrTextObj.get(), 0, pNewObj);
2925 // and save the new object.
2926 rRecord.pObj = pNewObj;
2927 }
2928 }
2929 else
2930 {
2931 // remove the object from Z-Order list
2932 m_xMSDffManager->RemoveFromShapeOrder( pSdrTextObj.get() );
2933 // take the object from the drawing page
2934 if( pSdrTextObj->getSdrPageFromSdrObject() )
2935 m_pDrawPg->RemoveObject( pSdrTextObj->GetOrdNum() );
2936 // and delete FrameFormat, because replaced by graphic
2937 // (this also deletes the object)
2938 m_rDoc.DelFrameFormat( pRetFrameFormat );
2939 pRetFrameFormat = nullptr;
2940 // also delete the object record
2941 rRecord.pObj = nullptr;
2942 }
2943 }
2944 else
2945 {
2946 // use ww8-default border distance
2948 aItemSet(m_pDrawModel->GetItemPool());
2949 aItemSet.Put(makeSdrTextLeftDistItem(rRecord.nDxTextLeft));
2950 aItemSet.Put(makeSdrTextRightDistItem(rRecord.nDxTextRight));
2951 aItemSet.Put(makeSdrTextUpperDistItem(rRecord.nDyTextTop));
2952 aItemSet.Put(makeSdrTextLowerDistItem(rRecord.nDyTextBottom));
2953 pSdrTextObj->SetMergedItemSetAndBroadcast(aItemSet);
2954 }
2955 }
2956 return pRetFrameFormat;
2957}
2958
2960 rtl::Reference<SdrObject>& rpOurNewObject,
2961 const SvxMSDffImportRec& rRecord,
2962 RndStdIds eAnchor, const WW8_FSPA& rF,
2963 SfxItemSet &rFlySet)
2964{
2965 SwFlyFrameFormat* pRetFrameFormat = nullptr;
2966 tools::Long nStartCp;
2967 tools::Long nEndCp;
2968
2969 // Check if this textbox chain contains text as conversion of an empty
2970 // chain would not make sense.
2971 if (TxbxChainContainsRealText(rRecord.aTextId.nTxBxS, nStartCp, nEndCp))
2972 {
2973 // The Text is not read into SdrTextObj! Rather insert a frame and
2974 // insert the text from nStartCp to nEndCp.
2975
2976 // More attributes can be used in a frame compared to the
2977 // Edit-Engine, and it can contain field, OLEs or graphics...
2978 tools::Rectangle aInnerDist(rRecord.nDxTextLeft, rRecord.nDyTextTop, rRecord.nDxTextRight,
2979 rRecord.nDyTextBottom);
2980
2982 rF.nYaBottom - rF.nYaTop);
2985 rFlySet.Put(aFrameSize);
2986
2987 MatchSdrItemsIntoFlySet(rpObject.get(), rFlySet, rRecord.eLineStyle, rRecord.eLineDashing,
2988 rRecord.eShapeType, aInnerDist);
2989
2990 SdrTextObj *pSdrTextObj = DynCastSdrTextObj(rpObject.get());
2991 if (pSdrTextObj && pSdrTextObj->IsVerticalWriting())
2992 rFlySet.Put(SvxFrameDirectionItem(SvxFrameDirection::Vertical_RL_TB, RES_FRAMEDIR));
2993
2994 pRetFrameFormat = m_rDoc.MakeFlySection(eAnchor, m_pPaM->GetPoint(), &rFlySet);
2995 OSL_ENSURE(pRetFrameFormat->GetAnchor().GetAnchorId() == eAnchor,
2996 "Not the anchor type requested!");
2997
2998 // if everything is OK, find pointer on new object and correct
2999 // Z-order list (or delete entry)
3000 rpOurNewObject = CreateContactObject(pRetFrameFormat);
3001
3002 // remove old object from the Z-Order list
3003 m_xMSDffManager->RemoveFromShapeOrder( rpObject.get() );
3004
3005 // and delete the object
3006 rpObject.clear();
3007 /*
3008 NB: only query pOrgShapeObject starting here!
3009 */
3010
3011 if (rpOurNewObject)
3012 {
3013 /*
3014 We do not store our rpOutNewObject in the ShapeOrder because we
3015 have a FrameFormat from which we can regenerate the contact object when
3016 we need it. Because, we can have frames anchored to paragraphs in
3017 header/footers and we can copy header/footers, if we do copy a
3018 header/footer with a nonpage anchored frame in it then the contact
3019 objects are invalidated. Under this condition the FrameFormat will be
3020 updated to reflect this change and can be used to get a new
3021 contact object, while a raw rpOutNewObject stored here becomes
3022 deleted and useless.
3023 */
3024 m_xMSDffManager->StoreShapeOrder(rF.nSpId,
3025 (static_cast<sal_uLong>(rRecord.aTextId.nTxBxS) << 16) +
3026 rRecord.aTextId.nSequence, nullptr, pRetFrameFormat);
3027
3028 // The Contact object has to be inserted into the draw page, so
3029 // SwWW8ImplReader::LoadDoc1() can determine the z-order.
3030 if (!rpOurNewObject->IsInserted())
3031 {
3032 // pass information, if object is in page header|footer to method.
3033 m_xWWZOrder->InsertEscherObject(rpOurNewObject.get(), rF.nSpId, rRecord.bDrawHell,
3035 }
3036 }
3037
3038 // Box-0 receives the text for the whole chain!
3039 if (!rRecord.aTextId.nSequence)
3040 {
3041 // save flags etc and reset them
3042 WW8ReaderSave aSave( this );
3043
3044 MoveInsideFly(pRetFrameFormat);
3045
3046 m_xWWZOrder->InsideEscher(rF.nSpId);
3047
3048 // read in the text
3049 m_bTxbxFlySection = true;
3050 bool bJoined = ReadText(nStartCp, (nEndCp-nStartCp),
3051 MAN_MAINTEXT == m_xPlcxMan->GetManType() ?
3053
3054 m_xWWZOrder->OutsideEscher();
3055
3056 MoveOutsideFly(pRetFrameFormat, aSave.GetStartPos(),!bJoined);
3057
3058 aSave.Restore( this );
3059
3060 StripNegativeAfterIndent(pRetFrameFormat);
3061 }
3062
3063 }
3064 return pRetFrameFormat;
3065}
3066
3068{
3069 if (rRecord.bVFlip || rRecord.bHFlip)
3070 {
3072 if (rRecord.bVFlip && rRecord.bHFlip)
3074 else if (rRecord.bVFlip)
3076 else
3078 rFlySet.Put( SwMirrorGrf(eType) );
3079 }
3080}
3081
3083 rtl::Reference<SdrObject> &rpOurNewObject,
3084 SvxMSDffImportRec& rRecord,
3085 WW8_FSPA& rF,
3086 SfxItemSet &rFlySet )
3087{
3088 SwFlyFrameFormat* pRetFrameFormat = nullptr;
3089 sal_Int32 nWidthTw = o3tl::saturating_sub(rF.nXaRight, rF.nXaLeft);
3090 if (0 > nWidthTw)
3091 nWidthTw = 0;
3092 sal_Int32 nHeightTw = o3tl::saturating_sub(rF.nYaBottom, rF.nYaTop);
3093 if (0 > nHeightTw)
3094 nHeightTw = 0;
3095
3096 ProcessEscherAlign(rRecord, rF, rFlySet);
3097
3098 rFlySet.Put(SwFormatFrameSize(SwFrameSize::Fixed, nWidthTw, nHeightTw));
3099
3101
3102 // Note that the escher inner distance only seems to be honoured in
3103 // word for textboxes, not for graphics and ole objects.
3104 tools::Rectangle aInnerDist(0, 0, 0, 0);
3105
3106 MatchSdrItemsIntoFlySet(rpObject.get(), rFlySet, rRecord.eLineStyle, rRecord.eLineDashing,
3107 rRecord.eShapeType, aInnerDist);
3108
3109 MatchEscherMirrorIntoFlySet(rRecord, aGrSet);
3110
3111 OUString aObjectName(rpObject->GetName());
3112 if (SdrObjKind::OLE2 == rpObject->GetObjIdentifier())
3113 pRetFrameFormat = InsertOle(*static_cast<SdrOle2Obj*>(rpObject.get()), rFlySet, &aGrSet);
3114 else
3115 {
3116 const SdrGrafObj *pGrf = static_cast<const SdrGrafObj*>(rpObject.get());
3117 bool bDone = false;
3118 if (pGrf->IsLinkedGraphic() && !pGrf->GetFileName().isEmpty())
3119 {
3121 OUString aGrfName(
3125 // correction of fix for issue #i10939#:
3126 // One of the two conditions have to be true to insert the graphic
3127 // as a linked graphic -
3128 if (GraphicType::NONE == eType || CanUseRemoteLink(aGrfName))
3129 {
3131 *m_pPaM, aGrfName, OUString(), nullptr,
3132 &rFlySet, &aGrSet, nullptr);
3133 bDone = true;
3134 }
3135 }
3136 if (!bDone)
3137 {
3138 const Graphic& rGraph = pGrf->GetGraphic();
3140 *m_pPaM, OUString(), OUString(), &rGraph,
3141 &rFlySet, &aGrSet, nullptr);
3142 }
3143 }
3144
3145 if (pRetFrameFormat)
3146 {
3147 if (SdrObjKind::OLE2 != rpObject->GetObjIdentifier())
3148 SetAttributesAtGrfNode(rRecord, *pRetFrameFormat, &rF);
3149 // avoid multiple occurrences of the same graphic name
3150 m_aGrfNameGenerator.SetUniqueGraphName(pRetFrameFormat, aObjectName);
3151 }
3152 // if everything is OK, determine pointer to new object and correct
3153 // Z-Order-List accordingly (or delete entry)
3154 rpOurNewObject = CreateContactObject(pRetFrameFormat);
3155
3156 // remove old object from Z-Order-List
3157 m_xMSDffManager->RemoveFromShapeOrder( rpObject.get() );
3158 // remove from Drawing-Page
3159 if( rpObject->getSdrPageFromSdrObject() )
3160 m_pDrawPg->RemoveObject( rpObject->GetOrdNum() );
3161
3162 // and delete the object
3163 rpObject.clear();
3164
3165 /*
3166 Warning: from now on query only pOrgShapeObject!
3167 */
3168
3169 // add Contact-Object to the Z-Order-List and the page
3170 if (rpOurNewObject)
3171 {
3172 if (!m_bHdFtFootnoteEdn)
3173 m_xMSDffManager->StoreShapeOrder(rF.nSpId, 0, rpOurNewObject.get());
3174
3175 // The Contact-Object MUST be set in the Draw-Page, so that in
3176 // SwWW8ImplReader::LoadDoc1() the Z-Order can be defined !!!
3177 if (!rpOurNewObject->IsInserted())
3178 {
3179 // pass information, if object is in page header|footer to method.
3180 m_xWWZOrder->InsertEscherObject(rpOurNewObject.get(), rF.nSpId, rRecord.bDrawHell,
3182 }
3183 }
3184 return pRetFrameFormat;
3185}
3186
3187void SwWW8ImplReader::GraphicCtor() // For SVDraw and VCControls and Escher
3188{
3189 if (m_pDrawModel)
3190 return;
3191
3192 m_rDoc.getIDocumentDrawModelAccess().GetOrCreateDrawModel(); // #i52858# - method name changed
3194 OSL_ENSURE(m_pDrawModel, "Cannot create DrawModel");
3196
3197 m_xMSDffManager.reset(new SwMSDffManager(*this, m_bSkipImages));
3198 m_xMSDffManager->SetModel(m_pDrawModel, 1440);
3199 /*
3200 Now the dff manager always needs a controls converter as well, but a
3201 control converter may still exist without a dffmanager.
3202 */
3204
3206 m_xMSDffManager->GetShapeOrders()));
3207}
3208
3210{
3211 m_pDrawEditEngine.reset(); // maybe created by graphic
3212 m_xWWZOrder.reset(); // same
3213}
3214
3216{
3217 OSL_ENSURE(pFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR,
3218 "Don't use fltanchors with inline frames, slap!");
3219 NewAttr(rPos, SwFltAnchor(pFormat));
3220}
3221
3223{
3224 size_t nCnt = size();
3225 for (size_t i=0; i < nCnt; ++i)
3226 {
3227 SwFltStackEntry &rEntry = (*this)[i];
3228 SwPosition aDummy(rEntry.m_aMkPos.m_nNode);
3229 SetAttrInDoc(aDummy, rEntry);
3231 --nCnt;
3232 }
3233}
3234
3235/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxBorderLineStyle
SvxBoxItemLine
GPOS_TILED
GPOS_AREA
sal_uInt8 GetBlue() const
void SetGreen(sal_uInt8 nGreen)
void SetRed(sal_uInt8 nRed)
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
void SetAlpha(sal_uInt8 nAlpha)
void SetBlue(sal_uInt8 nBlue)
sal_Int32 GetParagraphCount() const
void QuickDelete(const ESelection &rSel)
sal_Int32 GetTextLen() const
void SetAlpha(sal_uInt8 cAlpha)
const GraphicAttr & GetAttr() const
void SetAttr(const GraphicAttr &rAttr)
virtual SwDrawFrameFormat * InsertDrawObj(const SwPaM &rRg, SdrObject &rDrawObj, const SfxItemSet &rFlyAttrSet)=0
Insert a DrawObject.
virtual SwFlyFrameFormat * InsertGraphic(const SwPaM &rRg, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *)=0
Insert graphic or formula.
virtual SwDrawModel * GetOrCreateDrawModel()=0
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
void SetOutlinerMode(OutlinerMode nNew)
void SetVertical(bool bNew)
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
Definition: shellio.cxx:621
bool IsLinkedGraphic() const
const OUString & GetFileName() const
const Graphic & GetGraphic() const
GraphicType GetGraphicType() const
const SfxItemPool & GetItemPool() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
SdrObject * GetObj(size_t nNum) const
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
sal_uInt32 GetOrdNum() const
virtual SdrObjList * GetSubList() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
virtual const tools::Rectangle & GetSnapRect() const
virtual SdrObjKind GetObjIdentifier() const
const SfxItemSet & GetMergedItemSet() const
SdrObject * getParentSdrObjectFromSdrObject() const
virtual SdrLayerID GetLayer() const
virtual void SetVerticalWriting(bool bVertical)
virtual void NbcSetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject) override
virtual bool IsVerticalWriting() const
void SetValue(EnumT nTheValue)
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
SfxItemPool * GetSecondaryPool() const
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
bool IsInRange(sal_uInt16 nWhich) const
SfxItemPool * GetMasterPool() const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) 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
sal_uInt16 Which() const
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
sal_uInt64 Tell() const
sal_uInt64 Seek(sal_uInt64 nPos)
sal_uInt64 SeekRel(sal_Int64 nPos)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
sal_uInt16 CalcLineWidth(SvxBoxItemLine nLine) const
void SetDistance(sal_Int16 nNew, SvxBoxItemLine nLine)
void SetGraphicPos(SvxGraphicPosition eNew)
const Color & GetColor() const
void SetColor(const Color &rCol)
void SetGraphicObject(const GraphicObject &rNewObj)
void SetTop(sal_Int32 nVal)
void SetLeft(sal_Int32 nVal)
void SetBottom(sal_Int32 nVal)
void SetRight(sal_Int32 nVal)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
void SetLocation(SvxShadowLocation eNew)
void SetWidth(sal_uInt16 nNew)
void SetColor(const Color &rNew)
tools::Long GetHeight() const
tools::Long GetWidth() const
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
const SwMirrorGrf & GetMirrorGrf(bool=true) const
Definition: grfatr.hxx:282
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:765
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1586
SwFlyFrameFormat * MakeFlySection(RndStdIds eAnchorType, const SwPosition *pAnchorPos, const SfxItemSet *pSet=nullptr, SwFrameFormat *pParent=nullptr, bool bCalledFromShell=false)
Definition: doclay.cxx:288
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
SwNodes & GetNodes()
Definition: doc.hxx:422
OUString GetUniqueDrawObjectName() const
Definition: doclay.cxx:1396
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:703
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1334
OUString GetUniqueFrameName() const
Definition: doclay.cxx:1386
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:169
void PosAttrSet()
Definition: frmfmt.hxx:451
void DeleteAndDestroy(Entries::size_type nCnt)
Definition: fltshell.cxx:273
void NewAttr(const SwPosition &rPos, const SfxPoolItem &rAttr)
Definition: fltshell.cxx:248
Entries::size_type size() const
Definition: fltshell.hxx:158
virtual void SetAttrInDoc(const SwPosition &rTmpPos, SwFltStackEntry &rEntry)
Definition: fltshell.cxx:490
SwFltPosition m_aMkPos
Definition: fltshell.hxx:87
ContactObject for connection between frames (or their formats respectively) in SwClient and the drawo...
Definition: dcontact.hxx:177
virtual const SdrObject * GetMaster() const override
Definition: dcontact.hxx:193
FlyAnchors.
Definition: fmtanchr.hxx:37
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1593
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
void SetWidthSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:84
SwFrameSize GetWidthSizeType() const
Definition: fmtfsize.hxx:83
Defines the horizontal position of a fly frame.
Definition: fmtornt.hxx:73
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:100
void SetPosToggle(bool bNew)
Definition: fmtornt.hxx:103
SwTwips GetPos() const
Definition: fmtornt.hxx:99
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
bool IsContour() const
Definition: fmtsrnd.hxx:53
void SetOutside(bool bNew)
Definition: fmtsrnd.hxx:58
void SetContour(bool bNew)
Definition: fmtsrnd.hxx:57
SfxPoolItem subclass that wraps a URL.
Definition: fmturl.hxx:33
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
SwTwips GetPos() const
Definition: fmtornt.hxx:62
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:63
const OUString & GetName() const
Definition: format.hxx:131
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:385
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
Style of a layout element.
Definition: frmfmt.hxx:72
virtual void SetFormatName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2608
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2802
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:153
virtual Size GetTwipSize() const override
Definition: ndgrf.cxx:424
static sal_Int32 GetEscherLineMatch(MSO_LineStyle eStyle, MSO_SPT eShapeType, sal_Int32 &rThick)
Definition: ww8graf.cxx:1539
const OUString & GetHlink() const
Definition: ww8par.hxx:517
const OUString & GetTarFrame() const
Definition: ww8par.hxx:519
const OUString & GetName() const
Definition: ww8par.hxx:523
const sal_Int32 & GetShapeId() const
Definition: ww8par.hxx:521
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Definition: ndnotxt.hxx:30
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
const SwPosition * GetPoint() const
Definition: pam.hxx:253
void AddAnchor(const SwPosition &rPos, SwFrameFormat *pFormat)
Definition: ww8graf.cxx:3215
bool ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType)
Definition: ww8par.cxx:4031
SwPaM * m_pPaM
Definition: ww8par.hxx:1133
RndStdIds ProcessEscherAlign(SvxMSDffImportRec &rRecord, WW8_FSPA &rFSPA, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:2270
SwDocShell * m_pDocShell
Definition: ww8par.hxx:1110
rtl::Reference< SdrObject > ReadGroup(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1358
void GraphicDtor()
Definition: ww8graf.cxx:3209
rtl::Reference< SdrObject > ReadPolyLine(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:430
bool m_bDrawCpOValid
Definition: ww8par.hxx:1314
static void StripNegativeAfterIndent(SwFrameFormat const *pFlyFormat)
Definition: ww8par6.cxx:2629
bool IsObjectLayoutInTableCell(const sal_uInt32 nGroupShapeBooleanProperties) const
Definition: ww8graf.cxx:2471
OUString m_sBaseURL
Definition: ww8par.hxx:1304
std::unique_ptr< SwMSConvertControls > m_xFormImpl
Definition: ww8par.hxx:1235
static void AdjustULWrapForWordMargins(const SvxMSDffImportRec &rRecord, SvxULSpaceItem &rUL)
Definition: ww8graf.cxx:1978
SwFrameFormat * ImportOle(const Graphic *=nullptr, const SfxItemSet *pFlySet=nullptr, const SfxItemSet *pGrfSet=nullptr, const tools::Rectangle &aVisArea=tools::Rectangle())
Definition: ww8par4.cxx:239
sal_Int32 GetRangeAsDrawingString(OUString &rString, tools::Long StartCp, tools::Long nEndCp, ManTypes eType)
Definition: ww8graf.cxx:903
SwFlyFrameFormat * ImportReplaceableDrawables(rtl::Reference< SdrObject > &rpObject, rtl::Reference< SdrObject > &rpOurNewObject, SvxMSDffImportRec &rRecord, WW8_FSPA &rF, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:3082
void InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, ManTypes eType, bool bONLYnPicLocFc=false)
Definition: ww8graf.cxx:595
void SetAttributesAtGrfNode(const SvxMSDffImportRec &rRecord, const SwFrameFormat &rFlyFormat, WW8_FSPA const *pF)
Definition: ww8graf.cxx:2139
std::unique_ptr< SwWW8FltControlStack > m_xCtrlStck
Definition: ww8par.hxx:1135
SwDoc & m_rDoc
Definition: ww8par.hxx:1131
SwFlyFrameFormat * ConvertDrawTextToFly(rtl::Reference< SdrObject > &rpObject, rtl::Reference< SdrObject > &rpOurNewObject, const SvxMSDffImportRec &rRecord, RndStdIds eAnchor, const WW8_FSPA &rF, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:2959
bool ReadGrafStart(void *pData, short nDataSiz, WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:174
tools::Long Read_Field(WW8PLCFManResult *pRes)
Definition: ww8par5.cxx:806
sal_uInt16 End_Field()
Definition: ww8par5.cxx:520
SvStream * m_pStrm
Definition: ww8par.hxx:1126
static void MapWrapIntoFlyFormat(const SvxMSDffImportRec &rRecord, SwFrameFormat &rFlyFormat)
Definition: ww8graf.cxx:2008
SwFlyFrameFormat * InsertOle(SdrOle2Obj &rObject, const SfxItemSet &rFlySet, const SfxItemSet *rGrfSet)
Definition: ww8par4.cxx:195
short m_nDrawXOfs
Definition: ww8par.hxx:1333
SwTwips MoveOutsideFly(SwFrameFormat *pFlyFormat, const SwPosition &rPos, bool bTableJoin=true)
Definition: ww8par6.cxx:2353
std::shared_ptr< WW8Fib > m_xWwFib
Definition: ww8par.hxx:1257
rtl::Reference< SdrObject > ReadRect(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:346
wwSectionManager m_aSectionManager
Definition: ww8par.hxx:1188
SwFrameFormat * ImportGraf(SdrTextObj const *pTextObj=nullptr, SwFrameFormat const *pFlyFormat=nullptr)
Definition: ww8graf2.cxx:472
bool m_bSkipImages
Definition: ww8par.hxx:1346
void ReadGrafLayer1(WW8PLCFspecial &rPF, tools::Long nGrafAnchorCp)
Definition: ww8graf.cxx:1452
std::optional< OutlinerParaObject > ImportAsOutliner(OUString &rString, WW8_CP nStartCp, WW8_CP nEndCp, ManTypes eType)
Definition: ww8graf.cxx:970
sal_uInt16 m_nCurrentColl
Definition: ww8par.hxx:1327
rtl::Reference< SdrObject > ReadEllipse(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:369
std::unique_ptr< EditEngine > m_pDrawEditEngine
Definition: ww8par.hxx:1291
bool m_bHdFtFootnoteEdn
Definition: ww8par.hxx:1362
bool m_bTxbxFlySection
Definition: ww8par.hxx:1351
static sal_Int32 MatchSdrBoxIntoFlyBoxItem(const Color &rLineColor, MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType, sal_Int32 &rLineWidth, SvxBoxItem &rBox)
Definition: ww8graf.cxx:1597
SdrPage * m_pDrawPg
Definition: ww8par.hxx:1290
bool GetTxbxTextSttEndCp(WW8_CP &rStartCp, WW8_CP &rEndCp, sal_uInt16 nTxBxS, sal_uInt16 nSequence)
Definition: ww8graf.cxx:806
rtl_TextEncoding GetCurrentCharSet()
Definition: ww8par.cxx:2829
SdrModel * m_pDrawModel
Definition: ww8par.hxx:1289
rtl::Reference< SdrObject > ReadGrafPrimitive(short &rLeft, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1395
rtl::Reference< SdrObject > ImportOleBase(Graphic &rGraph, const Graphic *pGrf=nullptr, const SfxItemSet *pFlySet=nullptr, const tools::Rectangle &aVisArea=tools::Rectangle())
Definition: ww8par4.cxx:326
std::shared_ptr< WW8PLCFMan > m_xPlcxMan
Definition: ww8par.hxx:1262
rtl::Reference< SdrObject > ReadTextBox(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1249
void EndSprm(sal_uInt16 nId)
Definition: ww8par6.cxx:6212
std::unique_ptr< SwMSDffManager > m_xMSDffManager
Definition: ww8par.hxx:1296
short m_nDrawXOfs2
Definition: ww8par.hxx:1334
sal_uInt32 m_nIniFlags1
Definition: ww8par.hxx:1308
bool IsInlineEscherHack() const
Definition: ww8par.hxx:1723
std::deque< WW8FieldEntry > m_aFieldStack
Definition: ww8par.hxx:1176
SwFrameFormat * MungeTextIntoDrawBox(SvxMSDffImportRec &rRecord, tools::Long nGrafAnchorCp, SwFrameFormat *pRetFrameFormat)
Definition: ww8graf.cxx:2866
void MoveInsideFly(const SwFrameFormat *pFlyFormat)
Definition: ww8par6.cxx:2339
void Read_Obj(sal_uInt16, const sal_uInt8 *, short nLen)
Definition: ww8par6.cxx:2909
wwFrameNamer m_aGrfNameGenerator
Definition: ww8par.hxx:1216
void GraphicCtor()
Definition: ww8graf.cxx:3187
std::unique_ptr< wwZOrderer > m_xWWZOrder
Definition: ww8par.hxx:1292
bool IsRightToLeft()
Definition: ww8par6.cxx:4670
void Read_PicLoc(sal_uInt16, const sal_uInt8 *pData, short nLen)
Definition: ww8par6.cxx:2932
rtl::Reference< SdrObject > ReadArc(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:393
std::set< sal_uLong > m_aGrafPosSet
Definition: ww8par.hxx:1253
SdrObject * CreateContactObject(SwFrameFormat *pFlyFormat)
Definition: ww8graf.cxx:2240
void InsertTxbxStyAttrs(SfxItemSet &rS, sal_uInt16 nColl)
Definition: ww8graf.cxx:497
sal_uInt16 m_nProgress
Definition: ww8par.hxx:1326
std::unique_ptr< WW8ScannerBase > m_xSBase
Definition: ww8par.hxx:1261
friend class SwMSDffManager
Definition: ww8par.hxx:1118
std::unique_ptr< SwWW8FltAnchorStack > m_xAnchorStck
Definition: ww8par.hxx:1164
WW8_CP m_nDrawCpO
Definition: ww8par.hxx:1315
SwFrameFormat * AddAutoAnchor(SwFrameFormat *pFormat)
Definition: ww8graf.cxx:2851
static void AdjustLRWrapForWordMargins(const SvxMSDffImportRec &rRecord, SvxLRSpaceItem &rLR)
Definition: ww8graf.cxx:1940
short m_nDrawYOfs
Definition: ww8par.hxx:1333
rtl::Reference< SdrObject > ReadLine(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:311
sal_uInt32 m_nIniFlags
Definition: ww8par.hxx:1307
bool MiserableRTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, sal_Int16 eHoriOri, sal_Int16 eHoriRel)
Definition: ww8graf.cxx:2259
SwWW8StyInf * GetStyle(sal_uInt16 nColl) const
Definition: ww8par6.cxx:3024
std::optional< wwSprmParser > m_oSprmParser
Definition: ww8par.hxx:1211
void MatchSdrItemsIntoFlySet(SdrObject const *pSdrObj, SfxItemSet &aFlySet, MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType, tools::Rectangle &rInnerDist)
Definition: ww8graf.cxx:1682
rtl::Reference< SdrObject > ReadCaptionBox(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1291
SwFrameFormat * Read_GrafLayer(tools::Long nGrafAnchorCp)
Definition: ww8graf.cxx:2521
short m_nDrawYOfs2
Definition: ww8par.hxx:1334
short ImportSprm(const sal_uInt8 *pPos, sal_Int32 nMemLen, sal_uInt16 nId=0)
Definition: ww8par6.cxx:6222
void InsertTxbxText(SdrTextObj *pTextObj, Size const *pObjSiz, sal_uInt16 nTxBxS, sal_uInt16 nSequence, tools::Long nPosCp, SwFrameFormat const *pFlyFormat, bool bMakeSdrGrafObj, bool &rbEraseTextObj, bool *pbTestTxbxContainsText=nullptr, tools::Long *pnStartCp=nullptr, tools::Long *pnEndCp=nullptr, bool *pbContainsGraphics=nullptr, SvxMSDffImportRec const *pRecord=nullptr)
Definition: ww8graf.cxx:1029
sal_Unicode m_cSymbol
Definition: ww8par.hxx:1336
bool TxbxChainContainsRealText(sal_uInt16 nTxBxS, tools::Long &rStartCp, tools::Long &rEndCp)
Definition: ww8graf.cxx:1239
bool m_bColl
Definition: ww8par.hxx:257
SwFormat * m_pFormat
Definition: ww8par.hxx:233
among others for fields, that is, the same number of attr as positions, if Ctor-Param bNoEnd = false
Definition: ww8scan.hxx:221
bool Get(WW8_CP &rStart, void *&rpValue) const
Definition: ww8scan.cxx:2244
bool SeekPos(tools::Long nPos)
Definition: ww8scan.cxx:2178
void advance()
Definition: ww8scan.hxx:254
void SetIdx(tools::Long nI)
Definition: ww8scan.hxx:236
tools::Long GetIMax() const
Definition: ww8scan.hxx:237
iterator for Piece Table Exceptions of Fkps works on CPs (high-level)
Definition: ww8scan.hxx:634
virtual void GetSprms(WW8PLCFxDesc *p) override
Definition: ww8scan.cxx:3413
void GetPCDSprms(WW8PLCFxDesc &rDesc)
Definition: ww8scan.cxx:3264
void Restore(SwWW8ImplReader *pRdr)
Definition: ww8par.cxx:2106
const SwPosition & GetStartPos() const
Definition: ww8par.hxx:620
simple Iterator for SPRMs
Definition: ww8scan.hxx:263
const sal_uInt8 * GetSprms() const
Definition: ww8scan.hxx:282
const sal_uInt8 * GetCurrentParams() const
Definition: ww8scan.hxx:284
void SetSprms(const sal_uInt8 *pSprms_, sal_Int32 nLen_)
Definition: ww8scan.cxx:882
sal_uInt16 GetCurrentId() const
Definition: ww8scan.hxx:285
void advance()
Definition: ww8scan.cxx:889
void SetDashLen(double nNewDashLen)
void SetDots(sal_uInt16 nNewDots)
void SetDistance(double nNewDistance)
void SetDashes(sal_uInt16 nNewDashes)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void setClosed(bool bNew)
Make setting a drawing object's layer in a Writer document easy.
void SendObjectToHeaven(SdrObject &rObject) const
Make Object lives in the top layer.
void SendObjectToHell(SdrObject &rObject) const
Make Object live in the bottom drawing layer.
void Move(tools::Long nHorzMove, tools::Long nVertMove)
void Scale(double fScaleX, double fScaleY)
::basegfx::B2DPolygon getB2DPolygon() const
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr tools::Long GetHeight() const
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
void SetUniqueGraphName(SwFrameFormat *pFrameFormat, std::u16string_view rFixedPart)
Definition: ww8graf.cxx:165
OUString msSeed
Definition: ww8par.hxx:970
sal_Int32 mnImportedGraphicsCount
Definition: ww8par.hxx:971
bool mbIsDisabled
Definition: ww8par.hxx:972
bool CurrentSectionIsVertical() const
Definition: ww8par2.cxx:127
sal_uInt32 GetPageWidth() const
Definition: ww8par2.cxx:155
sal_uInt32 GetPageRight() const
Definition: ww8par2.cxx:150
sal_uInt32 GetPageLeft() const
Definition: ww8par2.cxx:145
constexpr ::Color COL_LIGHTRED(0xFF, 0x00, 0x00)
constexpr ::Color COL_GREEN(0x00, 0x80, 0x00)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTCYAN(0x00, 0xFF, 0xFF)
constexpr ::Color COL_MAGENTA(0x80, 0x00, 0x80)
constexpr ::Color COL_LIGHTMAGENTA(0xFF, 0x00, 0xFF)
constexpr ::Color COL_BROWN(0x80, 0x80, 0x00)
constexpr ::Color COL_YELLOW(0xFF, 0xFF, 0x00)
constexpr ::Color COL_RED(0x80, 0x00, 0x00)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
constexpr ::Color COL_CYAN(0x00, 0x80, 0x80)
constexpr ::Color COL_LIGHTGREEN(0x00, 0xFF, 0x00)
constexpr ::Color COL_BLUE(0x00, 0x00, 0x80)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
int nCount
const char * pS
URL aURL
virtual OUString GetURL() const override
float u
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_BKGCOLOR(EE_CHAR_START+32)
EmbeddedObjectRef * pObject
DocumentType eType
@ Fixed
Frame cannot be moved in Var-direction.
@ Variable
Frame is variable in Var-direction.
GraphicType
MirrorGraph
Definition: grfatr.hxx:32
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN)
constexpr sal_uInt16 RES_FLTRATTR_END(197)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr sal_uInt16 RES_GRFATR_BEGIN(RES_FRMATR_END)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_HIGHLIGHT(42)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(105)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr sal_uInt16 RES_FLTRATTR_BEGIN(RES_FORMAT_MSG_END)
constexpr sal_uInt16 RES_GRFATR_END(156)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
sal_Int16 nAdjust
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
std::unique_ptr< sal_Int32[]> pData
MSO_LineStyle
mso_lineDouble
mso_lineThickThin
mso_lineSimple
mso_lineThinThick
mso_lineTriple
MSO_LineDashing
mso_lineDashGEL
mso_lineDotGEL
MSO_SPT
mso_sptPictureFrame
mso_sptTextBox
const sal_uInt16 LN_CObjLocation
Definition: sprmids.hxx:45
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
sal_Int32 indexOfAny(std::u16string_view rIn, sal_Unicode const *const pChars, sal_Int32 const nPos)
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill='\0')
int i
constexpr T saturating_sub(T a, T b)
SwNoTextNode * GetNoTextNodeFromSwFrameFormat(const SwFrameFormat &rFormat)
Get the SwNoTextNode associated with a SwFrameFormat if here is one.
SwTwips MakeSafePositioningValue(SwTwips nIn)
Clips a value to MAX/MIN 16bit value to make it safe for use as a position value to give to writer.
long Long
const int nWrap100Percent
For custom wrapping.
Definition: types.hxx:40
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
const char GetValue[]
#define Y
SfxItemState
SdrOnOffItem makeSdrShadowItem(bool bShadow)
SdrMetricItem makeSdrShadowXDistItem(tools::Long nDist)
SdrMetricItem makeSdrShadowYDistItem(tools::Long nDist)
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
SdrMetricItem makeSdrTextUpperDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextRightDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLowerDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLeftDistItem(tools::Long mnHeight)
static SfxItemSet & rSet
sal_uInt8 SVBT16[2]
sal_uIntPtr sal_uLong
TOOLS_DLLPUBLIC bool checkSeek(SvStream &rSt, sal_uInt64 nOffset)
sal_Int32 nStartPara
sal_Int32 nEndPos
sal_Int32 nStartPos
sal_Int32 nEndPara
sal_uInt16 nTxBxS
sal_uInt16 nSequence
sal_uInt32 nGroupShapeBooleanProperties
std::optional< sal_uInt32 > nXRelTo
sal_Int32 nCropFromRight
sal_Int32 nDxWrapDistLeft
sal_Int32 nCropFromBottom
std::optional< tools::Polygon > pWrapPolygon
sal_Int32 nDxTextLeft
sal_uInt32 nXAlign
sal_Int32 nDxTextRight
static const int RELTO_DEFAULT
rtl::Reference< SdrObject > pObj
sal_Int32 nCropFromTop
sal_Int32 nDyTextBottom
sal_Int32 nCropFromLeft
sal_Int32 nDyWrapDistTop
sal_Int32 nDyTextTop
std::optional< sal_uInt32 > nYRelTo
MSO_LineDashing eLineDashing
sal_uInt32 nYAlign
sal_Int32 nDxWrapDistRight
sal_Int32 nDyWrapDistBottom
MSO_LineStyle eLineStyle
SwNodeIndex m_nNode
Definition: fltshell.hxx:50
Marks a position in the document model.
Definition: pam.hxx:38
tools::Long nMemLen
Definition: ww8scan.hxx:854
const sal_uInt8 * pMemPos
Definition: ww8scan.hxx:857
sal_uInt16 nSprmId
Definition: ww8scan.hxx:858
sal_Int32 nSprmsLen
Definition: ww8scan.hxx:902
const sal_uInt8 * pMemPos
Definition: ww8scan.hxx:883
sal_uInt8 bx
Definition: ww8struc.hxx:685
sal_uInt8 by
Definition: ww8struc.hxx:686
SVBT16 cb
Definition: ww8struc.hxx:684
SVBT16 dhgt
Definition: ww8struc.hxx:701
SVBT16 dya
Definition: ww8struc.hxx:717
SVBT16 dpk
Definition: ww8struc.hxx:709
SVBT16 cb
Definition: ww8struc.hxx:713
SVBT16 ya
Definition: ww8struc.hxx:715
SVBT16 xa
Definition: ww8struc.hxx:714
SVBT16 dxa
Definition: ww8struc.hxx:716
sal_uInt8 fLeft
Definition: ww8struc.hxx:795
WW8_DP_FILL aFill
Definition: ww8struc.hxx:793
sal_uInt8 fUp
Definition: ww8struc.hxx:796
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:792
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:794
WW8_DP_POLYLINE dpPolyLine
Definition: ww8struc.hxx:833
WW8_DP_TXTBOX dptxbx
Definition: ww8struc.hxx:831
WW8_DPHEAD dpheadTxbx
Definition: ww8struc.hxx:830
WW8_DPHEAD dpheadPolyLine
Definition: ww8struc.hxx:832
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:805
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:803
WW8_DP_FILL aFill
Definition: ww8struc.hxx:804
SVBT32 dlpcBg
Definition: ww8struc.hxx:738
SVBT16 flpp
Definition: ww8struc.hxx:739
SVBT32 dlpcFg
Definition: ww8struc.hxx:737
SVBT16 aStartBits
Definition: ww8struc.hxx:744
SVBT16 aEndBits
Definition: ww8struc.hxx:750
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:764
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:766
SVBT16 xaStart
Definition: ww8struc.hxx:760
SVBT16 xaEnd
Definition: ww8struc.hxx:762
WW8_DP_LINEEND aEpp
Definition: ww8struc.hxx:765
SVBT16 yaStart
Definition: ww8struc.hxx:761
SVBT16 yaEnd
Definition: ww8struc.hxx:763
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:810
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:813
WW8_DP_FILL aFill
Definition: ww8struc.hxx:811
WW8_DP_FILL aFill
Definition: ww8struc.hxx:783
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:782
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:784
SVBT16 yaOffset
Definition: ww8struc.hxx:732
SVBT16 shdwpi
Definition: ww8struc.hxx:730
SVBT16 xaOffset
Definition: ww8struc.hxx:731
WW8_DP_FILL aFill
Definition: ww8struc.hxx:772
WW8_DP_SHADOW aShd
Definition: ww8struc.hxx:773
WW8_DP_LINETYPE aLnt
Definition: ww8struc.hxx:771
SVBT32 fc
Definition: ww8struc.hxx:677
sal_Int32 nYaBottom
Definition: ww8struc.hxx:909
sal_uInt16 nby
Definition: ww8struc.hxx:918
@ RelPageBorder
Definition: ww8struc.hxx:949
sal_Int32 nXaRight
Definition: ww8struc.hxx:908
sal_Int32 nXaLeft
Definition: ww8struc.hxx:906
sal_Int32 nSpId
Definition: ww8struc.hxx:905
sal_uInt16 nwrk
Definition: ww8struc.hxx:932
sal_Int32 nYaTop
Definition: ww8struc.hxx:907
sal_uInt16 bRcaSimple
Definition: ww8struc.hxx:938
sal_uInt16 nbx
Definition: ww8struc.hxx:912
sal_uInt16 nwr
Definition: ww8struc.hxx:923
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_SHADOW(SDRATTR_SHADOW_FIRST+0)
constexpr TypedWhichId< SdrGrafLuminanceItem > SDRATTR_GRAFLUMINANCE(SDRATTR_GRAF_FIRST+3)
constexpr TypedWhichId< SdrGrafModeItem > SDRATTR_GRAFMODE(SDRATTR_GRAF_FIRST+8)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_SHADOWYDIST(SDRATTR_SHADOW_FIRST+3)
constexpr TypedWhichId< SdrGrafContrastItem > SDRATTR_GRAFCONTRAST(SDRATTR_GRAF_FIRST+4)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWHEIGHT(SDRATTR_MISC_FIRST+2)
constexpr TypedWhichId< SdrGrafGamma100Item > SDRATTR_GRAFGAMMA(SDRATTR_GRAF_FIRST+5)
constexpr TypedWhichId< XColorItem > SDRATTR_SHADOWCOLOR(SDRATTR_SHADOW_FIRST+1)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_SHADOWXDIST(SDRATTR_SHADOW_FIRST+2)
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
SdrObjKind
SvxShadowLocation
RndStdIds
tools::Long SwTwips
Definition: swtypes.hxx:51
constexpr SwTwips MIN_BORDER_DIST
Definition: swtypes.hxx:70
SdrCaptionType
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, SwTwips nPageRight, SwTwips nPageSize)
Definition: wrtw8esh.cxx:525
static ESelection GetESelection(EditEngine const &rDrawEditEngine, tools::Long nCpStart, tools::Long nCpEnd)
Definition: ww8graf.cxx:468
static void SetStdAttr(SfxItemSet &rSet, WW8_DP_LINETYPE &rL, WW8_DP_SHADOW const &rSh)
Definition: ww8graf.cxx:200
static void SetLineEndAttr(SfxItemSet &rSet, WW8_DP_LINEEND const &rLe, WW8_DP_LINETYPE const &rLt)
Definition: ww8graf.cxx:275
static sal_Int32 lcl_ConvertCrop(sal_uInt32 const nCrop, sal_Int32 const nSize)
Definition: ww8graf.cxx:2126
void MatchEscherMirrorIntoFlySet(const SvxMSDffImportRec &rRecord, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:3067
static void SetFill(SfxItemSet &rSet, WW8_DP_FILL &rFill)
Definition: ww8graf.cxx:241
#define WW8ITEMVALUE(ItemSet, Id, Cast)
Definition: ww8graf.cxx:1680
static std::vector< sal_Int32 > replaceDosLineEndsButPreserveLength(OUString &rIn)
Definition: ww8graf.cxx:935
static void lcl_StripFields(OUString &rString, WW8_CP &rNewStartCp)
Definition: ww8graf.cxx:528
static Color WW8TransCol(SVBT32 nWC)
Definition: ww8graf.cxx:113
static void removePositions(EditEngine &rDrawEditEngine, const std::vector< sal_Int32 > &rDosLineEndDummies)
Definition: ww8graf.cxx:961
void WW8FSPAShadowToReal(const WW8_FSPA_SHADOW &rFSPAS, WW8_FSPA &rPic)
Definition: ww8graf2.cxx:760
#define SW_UD_IMAPDATA
Definition: ww8par.hxx:60
#define WW8FL_NO_GRAFLAYER
Definition: ww8par.hxx:127
bool CanUseRemoteLink(const OUString &rGrfName)
Definition: ww8par5.cxx:2433
#define WW8FL_NO_FLY_FOR_TXBX
Definition: ww8par.hxx:130
bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength)
Definition: ww8scan.cxx:8544
ManTypes
Definition: ww8scan.hxx:871
@ MAN_HDFT
Definition: ww8scan.hxx:872
@ MAN_MAINTEXT
Definition: ww8scan.hxx:872
@ MAN_TXBX
Definition: ww8scan.hxx:873
@ MAN_AND
Definition: ww8scan.hxx:872
@ MAN_TXBX_HDFT
Definition: ww8scan.hxx:873
@ eFTN
Definition: ww8scan.hxx:388
@ eFLD
Definition: ww8scan.hxx:388
sal_Int32 WW8_CP
Definition: ww8struc.hxx:153
sal_Int32 WW8_FC
Definition: ww8struc.hxx:152
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr sal_uInt16 XATTR_START
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
constexpr sal_uInt16 XATTR_END
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
constexpr TypedWhichId< XFillBmpTileItem > XATTR_FILLBMP_TILE(XATTR_FILL_FIRST+7)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)