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 // If the image is inline, then the relative orientation means nothing,
2377 // so set it up so that if the user changes it into an anchor, it positions usefully.
2378 sal_Int16 eHoriOri
2379 = IsInlineEscherHack() ? text::HoriOrientation::CENTER : aHoriOriTab[ nXAlign ];
2380 sal_Int16 eHoriRel
2381 = IsInlineEscherHack() ? text::RelOrientation::FRAME : aHoriRelOriTab[nXRelTo];
2382
2383 // #i36649# - adjustments for certain alignments
2384 if (eHoriOri == text::HoriOrientation::LEFT && eHoriRel == text::RelOrientation::PAGE_FRAME)
2385 {
2386 // convert 'left to page' to 'from left -<width> to page text area'
2387 eHoriOri = text::HoriOrientation::NONE;
2388 eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;
2389 const tools::Long nWidth = rFSPA.nXaRight - rFSPA.nXaLeft;
2390 rFSPA.nXaLeft = -nWidth;
2391 rFSPA.nXaRight = 0;
2392 }
2393 else if (eHoriOri == text::HoriOrientation::RIGHT && eHoriRel == text::RelOrientation::PAGE_FRAME)
2394 {
2395 // convert 'right to page' to 'from left 0 to right page border'
2396 eHoriOri = text::HoriOrientation::NONE;
2397 eHoriRel = text::RelOrientation::PAGE_RIGHT;
2398 const tools::Long nWidth = rFSPA.nXaRight - rFSPA.nXaLeft;
2399 rFSPA.nXaLeft = 0;
2400 rFSPA.nXaRight = nWidth;
2401 }
2402
2403 // #i24255# - position of floating screen objects in
2404 // R2L layout are given in L2R layout, thus convert them of all
2405 // floating screen objects, which are imported.
2406 {
2407 // Miserable miserable hack.
2408 SwTwips nWidth = o3tl::saturating_sub(rFSPA.nXaRight, rFSPA.nXaLeft);
2409 SwTwips nLeft = rFSPA.nXaLeft;
2410 if (MiserableRTLGraphicsHack(nLeft, nWidth, eHoriOri,
2411 eHoriRel))
2412 {
2413 rFSPA.nXaLeft = nLeft;
2414 rFSPA.nXaRight = rFSPA.nXaLeft + nWidth;
2415 }
2416 }
2417
2418 // if the object is anchored inside a table cell, is horizontal aligned
2419 // at frame|character and has wrap through, but its attribute
2420 // 'layout in table cell' isn't set, convert its horizontal alignment to page text area.
2421 // #i84783# - use new method <IsObjectLayoutInTableCell()>
2422 if (m_nInTable &&
2423 (eHoriRel == text::RelOrientation::FRAME || eHoriRel == text::RelOrientation::CHAR) &&
2424 rFSPA.nwr == 3 &&
2426 {
2427 eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;
2428 }
2429
2430 // Writer honours this wrap distance when aligned as "left" or "right",
2431 // Word doesn't. Writer doesn't honour it when its "from left".
2432 if (eHoriOri == text::HoriOrientation::LEFT)
2433 rRecord.nDxWrapDistLeft = 0;
2434 else if (eHoriOri == text::HoriOrientation::RIGHT)
2435 rRecord.nDxWrapDistRight = 0;
2436
2437 sal_Int16 eVertRel;
2438
2439 eVertRel = aVertRelOriTab[ nYRelTo ]; // #i18732#
2440 if (bCurSectionVertical && nYRelTo == 2)
2441 eVertRel = text::RelOrientation::PAGE_PRINT_AREA;
2442 // #i22673# - fill <eVertOri> in dependence of <eVertRel>
2443 sal_Int16 eVertOri;
2444 if (eVertRel == text::RelOrientation::TEXT_LINE)
2445 {
2446 eVertOri = aToLineVertOriTab[ nYAlign ];
2447 }
2448 else
2449 {
2450 eVertOri = aVertOriTab[ nYAlign ];
2451 }
2452
2453 // Below line in word is a positive value, while in writer its
2454 // negative
2455 tools::Long nYPos = rFSPA.nYaTop;
2456 // #i22673#
2457 if ((eVertRel == text::RelOrientation::TEXT_LINE) && (eVertOri == text::VertOrientation::NONE))
2458 nYPos = -nYPos;
2459
2460 SwFormatHoriOrient aHoriOri(MakeSafePositioningValue(bCurSectionVertical ? nYPos : rFSPA.nXaLeft),
2461 bCurSectionVertical ? eVertOri : eHoriOri,
2462 bCurSectionVertical ? eVertRel : eHoriRel);
2463 if (4 <= nXAlign)
2464 aHoriOri.SetPosToggle(true);
2465 rFlySet.Put(aHoriOri);
2466
2467 rFlySet.Put(SwFormatVertOrient(MakeSafePositioningValue(!bCurSectionVertical ? nYPos : -rFSPA.nXaRight),
2468 !bCurSectionVertical ? eVertOri : eHoriOri,
2469 !bCurSectionVertical ? eVertRel : eHoriRel));
2470
2471 return eAnchor;
2472}
2473
2474// #i84783#
2475bool SwWW8ImplReader::IsObjectLayoutInTableCell(const sal_uInt32 nGroupShapeBooleanProperties) const
2476{
2477 bool bIsObjectLayoutInTableCell = false;
2478
2479 if ( m_bVer8 )
2480 {
2481 sal_uInt16 nWWVersion = m_xWwFib->m_nProduct & 0xE000;
2482 if (nWWVersion == 0)
2483 {
2484 // 0 nProduct can happen for Word >97 as well, check cswNew in this case instead.
2485 if (m_xWwFib->m_cswNew > 0)
2486 {
2487 // This is Word >=2000.
2488 nWWVersion = 0x2000;
2489 }
2490 }
2491
2492 switch ( nWWVersion )
2493 {
2494 case 0x0000: // version 8 aka Microsoft Word 97
2495 {
2496 bIsObjectLayoutInTableCell = false;
2497 OSL_ENSURE(nGroupShapeBooleanProperties == 0,
2498 "no explicit object attribute layout in table cell expected." );
2499 }
2500 break;
2501 case 0x2000: // version 9 aka Microsoft Word 2000
2502 case 0x4000: // version 10 aka Microsoft Word 2002
2503 case 0x6000: // version 11 aka Microsoft Word 2003
2504 case 0x8000: // version 12 aka Microsoft Word 2007
2505 case 0xC000: // version 14 aka Microsoft Word 2010
2506 case 0xE000: // version 15 aka Microsoft Word 2013
2507 {
2508 // Documented in [MS-ODRAW], 2.3.4.44 "Group Shape Boolean Properties".
2509 bool fUsefLayoutInCell = (nGroupShapeBooleanProperties & 0x80000000) >> 31;
2510 bool fLayoutInCell = (nGroupShapeBooleanProperties & 0x8000) >> 15;
2511 // If unspecified, defaults to true
2512 bIsObjectLayoutInTableCell = !fUsefLayoutInCell || fLayoutInCell;
2513 }
2514 break;
2515 default:
2516 {
2517 OSL_FAIL( "unknown version." );
2518 }
2519 }
2520 }
2521
2522 return bIsObjectLayoutInTableCell;
2523}
2524
2526{
2528 return nullptr;
2529
2531
2532 m_nDrawCpO = 0;
2533 m_bDrawCpOValid = m_xWwFib->GetBaseCp(m_xPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX, &m_nDrawCpO);
2534
2535 GraphicCtor();
2536
2537 WW8PLCFspecial* pPF = m_xPlcxMan->GetFdoa();
2538 if( !pPF )
2539 {
2540 OSL_ENSURE( false, "Where is the graphic (1) ?" );
2541 return nullptr;
2542 }
2543
2544 if( m_bVer67 )
2545 {
2546 sal_uInt64 nOldPos = m_pStrm->Tell();
2547
2549 ReadGrafLayer1(*pPF, nGrafAnchorCp);
2550
2551 m_pStrm->Seek( nOldPos );
2552 return nullptr;
2553 }
2554
2555 // Normal case of Word 8+ version stuff
2556 pPF->SeekPos( nGrafAnchorCp );
2557
2558 WW8_FC nStartFc;
2559 void* pF0;
2560 if (!pPF->Get(nStartFc, pF0))
2561 {
2562 OSL_ENSURE( false, "+Where is the graphic (2) ?" );
2563 return nullptr;
2564 }
2565
2566 WW8_FSPA_SHADOW& rFS = *static_cast<WW8_FSPA_SHADOW*>(pF0);
2567 WW8_FSPA aFSFA;
2568 WW8FSPAShadowToReal(rFS, aFSFA);
2569 if (!aFSFA.nSpId)
2570 {
2571 OSL_ENSURE( false, "+Where is the graphic (3) ?" );
2572 return nullptr;
2573 }
2574
2575 if (!m_xMSDffManager->GetModel())
2576 m_xMSDffManager->SetModel(m_pDrawModel, 1440);
2577
2578 tools::Rectangle aRect(aFSFA.nXaLeft, aFSFA.nYaTop, aFSFA.nXaRight, aFSFA.nYaBottom);
2579 SvxMSDffImportData aData( aRect );
2580
2582 bool bOk = (m_xMSDffManager->GetShape(aFSFA.nSpId, pObject, aData) && pObject);
2583
2584 if (!bOk)
2585 {
2586 OSL_ENSURE( false, "Where is the Shape ?" );
2587 return nullptr;
2588 }
2589
2590 // tdf#118375 Word relates position to the unrotated rectangle,
2591 // Writer uses the rotated one.
2592 if (pObject->GetRotateAngle())
2593 {
2594 tools::Rectangle aObjSnapRect(pObject->GetSnapRect()); // recalculates the SnapRect
2595 aFSFA.nXaLeft = aObjSnapRect.Left();
2596 aFSFA.nYaTop = aObjSnapRect.Top();
2597 aFSFA.nXaRight = aObjSnapRect.Right();
2598 aFSFA.nYaBottom = aObjSnapRect.Bottom();
2599 }
2600
2601 bool bDone = false;
2602 rtl::Reference<SdrObject> pOurNewObject;
2603 bool bReplaceable = false;
2604
2605 switch (pObject->GetObjIdentifier())
2606 {
2607 case SdrObjKind::Graphic:
2608 bReplaceable = true;
2609 bDone = true;
2610 break;
2611 case SdrObjKind::OLE2:
2612 bReplaceable = true;
2613 break;
2614 default:
2615 break;
2616
2617 }
2618
2619 // when in a header or footer word appears to treat all elements as wrap through
2620
2621 // determine wrapping mode
2623 Reader::ResetFrameFormatAttrs(aFlySet); // tdf#122425: Explicitly remove borders and spacing
2624 css::text::WrapTextMode eSurround = css::text::WrapTextMode_PARALLEL;
2625 bool bContour = false;
2626 switch (aFSFA.nwr)
2627 {
2628 case 0: // 0 like 2, but doesn't require absolute object
2629 case 2: // 2 wrap around absolute object
2630 eSurround = css::text::WrapTextMode_PARALLEL;
2631 break;
2632 case 1: // 1 no text next to shape
2633 eSurround = css::text::WrapTextMode_NONE;
2634 break;
2635 case 3: // 3 wrap as if no object present
2636 // Special case: on export, inline images are wrapped through as a hack for old formats.
2637 // That is irrelevant for Writer, so instead use the default wrap in that case,
2638 // so that when the user changes it into an anchor, it wraps nicely, and not through.
2639 if (!IsInlineEscherHack())
2640 eSurround = css::text::WrapTextMode_THROUGH;
2641 break;
2642 case 4: // 4 wrap tightly around object
2643 case 5: // 5 wrap tightly, but allow holes
2644 eSurround = css::text::WrapTextMode_PARALLEL;
2645 bContour = true;
2646 break;
2647 }
2648
2649 // if mode 2 or 4 also regard the additional parameters
2650 if ((2 == aFSFA.nwr) || (4 == aFSFA.nwr))
2651 {
2652 switch (aFSFA.nwrk)
2653 {
2654 // 0 wrap both sides
2655 case 0:
2656 eSurround = css::text::WrapTextMode_PARALLEL;
2657 break;
2658 // 1 wrap only on left
2659 case 1:
2660 eSurround = css::text::WrapTextMode_LEFT;
2661 break;
2662 // 2 wrap only on right
2663 case 2:
2664 eSurround = css::text::WrapTextMode_RIGHT;
2665 break;
2666 // 3 wrap only on largest side
2667 case 3:
2668 eSurround = css::text::WrapTextMode_DYNAMIC;
2669 break;
2670 }
2671 }
2672
2673 SwFormatSurround aSur( eSurround );
2674 aSur.SetContour( bContour );
2675 aSur.SetOutside(true); // Winword can only do outside contours
2676 aFlySet.Put( aSur );
2677
2678 // now position imported object correctly and so on (can be a whole group)
2679
2680 OSL_ENSURE(!((aData.size() != 1) && bReplaceable),
2681 "Replaceable drawing with > 1 entries ?");
2682
2683 if (aData.size() != 1)
2684 bReplaceable = false;
2685
2686 /*
2687 Get the record for top level object, so we can get the word anchoring
2688 and wrapping information for it.
2689 */
2690 SvxMSDffImportRec* pRecord = aData.find(pObject.get());
2691 OSL_ENSURE(pRecord, "how did that happen?");
2692 if (!pRecord)
2693 {
2694 // remove old object from the Z-Order list
2695 m_xMSDffManager->RemoveFromShapeOrder(pObject.get());
2696 return nullptr;
2697 }
2698 const bool bLayoutInTableCell =
2700
2701 // #i18732# - Switch on 'follow text flow', if object is laid out
2702 // inside table cell
2703 if (bLayoutInTableCell)
2704 {
2705 SwFormatFollowTextFlow aFollowTextFlow( true );
2706 aFlySet.Put( aFollowTextFlow );
2707 }
2708
2709 // #i21847#
2710 // Some shapes are set to *hidden*, don't import those ones.
2711 if (pRecord->bHidden)
2712 {
2713 // remove old object from the Z-Order list
2714 m_xMSDffManager->RemoveFromShapeOrder(pObject.get());
2715 return nullptr;
2716 }
2717
2718 sal_uInt16 nCount = pObject->GetUserDataCount();
2719 if(nCount)
2720 {
2721 OUString lnName, aObjName, aTarFrame;
2722 for (sal_uInt16 i = 0; i < nCount; i++ )
2723 {
2724 SdrObjUserData* pData = pObject->GetUserData( i );
2725 if( pData && pData->GetInventor() == SdrInventor::ScOrSwDraw
2726 && pData->GetId() == SW_UD_IMAPDATA)
2727 {
2728 SwMacroInfo* macInf = dynamic_cast<SwMacroInfo*>(pData);
2729 if (macInf && macInf->GetShapeId() == aFSFA.nSpId)
2730 {
2731 lnName = macInf->GetHlink();
2732 aObjName = macInf->GetName();
2733 aTarFrame = macInf->GetTarFrame();
2734 break;
2735 }
2736 }
2737 }
2738 std::unique_ptr<SwFormatURL> pFormatURL(new SwFormatURL());
2739 pFormatURL->SetURL( lnName, false );
2740 if (!aObjName.isEmpty())
2741 pFormatURL->SetName(aObjName);
2742 if (!aTarFrame.isEmpty())
2743 pFormatURL->SetTargetFrameName(aTarFrame);
2744 pFormatURL->SetMap(nullptr);
2745 aFlySet.Put(std::move(pFormatURL));
2746 }
2747
2748 // If we are to be "below text" then we are not to be opaque
2749 // #i14045# MM If we are in a header or footer then make the object transparent
2750 // Not exactly like word but close enough for now
2751
2752 // both flags <bBelowText> and <bDrawHell> have to be set to move object into the background.
2753 // #i46794# - it reveals that value of flag <bBelowText> can be neglected.
2754 const bool bMoveToBackground = pRecord->bDrawHell ||
2755 ((m_bIsHeader || m_bIsFooter) && aFSFA.nwr == 3);
2756 if ( bMoveToBackground )
2757 aFlySet.Put(SvxOpaqueItem(RES_OPAQUE,false));
2758
2759 OUString aObjName = pObject->GetName();
2760
2761 bool bDrawObj = false;
2762 bool bFrame = false;
2763
2764 SwFrameFormat* pRetFrameFormat = nullptr;
2765 if (bReplaceable)
2766 {
2767 // Single graphics or ole objects
2768 pRetFrameFormat = ImportReplaceableDrawables(pObject, pOurNewObject, *pRecord, aFSFA, aFlySet);
2769 }
2770 else
2771 {
2772 bDrawObj = true;
2773
2774 // Drawing objects, (e.g. ovals or drawing groups)
2775 if (aFSFA.bRcaSimple)
2776 {
2779 }
2780
2781 RndStdIds eAnchor = ProcessEscherAlign(*pRecord, aFSFA, aFlySet);
2782
2783 // Should we, and is it possible to make this into a writer textbox
2784 if ((!(m_nIniFlags1 & WW8FL_NO_FLY_FOR_TXBX)) && pRecord->bReplaceByFly)
2785 {
2786 pRetFrameFormat
2787 = ConvertDrawTextToFly(pObject, pOurNewObject, *pRecord, eAnchor, aFSFA, aFlySet);
2788 if (pRetFrameFormat)
2789 {
2790 bDone = true;
2791 bDrawObj = false;
2792 bFrame = true;
2793 }
2794 }
2795
2796 if (!bDone)
2797 {
2798 sw::util::SetLayer aSetLayer(m_rDoc);
2799 if ( bMoveToBackground )
2800 aSetLayer.SendObjectToHell(*pObject);
2801 else
2802 aSetLayer.SendObjectToHeaven(*pObject);
2803
2804 if (!IsInlineEscherHack())
2805 {
2806 /* Need to make sure that the correct layer ordering is applied. */
2807 // pass information, if object is in page header|footer to method.
2808 m_xWWZOrder->InsertEscherObject(pObject.get(), aFSFA.nSpId, pRecord->bDrawHell,
2810 }
2811 else
2812 {
2813 m_xWWZOrder->InsertTextLayerObject(pObject.get());
2814 }
2815
2816 pRetFrameFormat = m_rDoc.getIDocumentContentOperations().InsertDrawObj(*m_pPaM, *pObject, aFlySet );
2817
2818 OSL_ENSURE(pRetFrameFormat->GetAnchor().GetAnchorId() ==
2819 eAnchor, "Not the anchor type requested!");
2820
2821 /*
2822 Insert text if necessary into textboxes contained in groups.
2823 */
2824 for (const auto& it : aData)
2825 {
2826 pRecord = it.get();
2827 if (pRecord->pObj && pRecord->aTextId.nTxBxS)
2828 { // #i52825# pRetFrameFormat can be NULL
2829 pRetFrameFormat = MungeTextIntoDrawBox(
2830 *pRecord, nGrafAnchorCp, pRetFrameFormat);
2831 }
2832 }
2833 }
2834 }
2835
2836 SwDrawFrameFormat* pDrawFrameFormat = dynamic_cast<SwDrawFrameFormat*>(pRetFrameFormat);
2837 // #i44344#, #i44681# - positioning attributes already set
2838 if (pDrawFrameFormat)
2839 pDrawFrameFormat->PosAttrSet();
2840 if (!IsInlineEscherHack() && pRetFrameFormat)
2841 MapWrapIntoFlyFormat(*pRecord, *pRetFrameFormat);
2842
2843 // Set frame name with object name
2844 if (pRetFrameFormat /*#i52825# */)
2845 {
2846 if (!aObjName.isEmpty())
2847 pRetFrameFormat->SetFormatName( aObjName );
2848 if (pRetFrameFormat->GetName().isEmpty())
2849 {
2850 if (bDrawObj)
2851 pRetFrameFormat->SetFormatName(m_rDoc.GetUniqueDrawObjectName());
2852 else if (bFrame)
2853 pRetFrameFormat->SetFormatName(m_rDoc.GetUniqueFrameName());
2854 }
2855 }
2856 return AddAutoAnchor(pRetFrameFormat);
2857}
2858
2860{
2861 /*
2862 * anchored to character at the current position will move along the
2863 * paragraph as text is added because we are at the insertion point.
2864 *
2865 * Leave to later and set the correct location then.
2866 */
2867 if (pFormat && (pFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR))
2868 {
2869 m_xAnchorStck->AddAnchor(*m_pPaM->GetPoint(), pFormat);
2870 }
2871 return pFormat;
2872}
2873
2875 tools::Long nGrafAnchorCp, SwFrameFormat* pRetFrameFormat)
2876{
2877 rtl::Reference<SdrObject> pTrueObject = rRecord.pObj;
2878
2879 rtl::Reference<SdrTextObj> pSdrTextObj;
2880
2881 // check for group object (e.g. two parentheses)
2882 if (SdrObjGroup* pThisGroup = dynamic_cast<SdrObjGroup*>(rRecord.pObj.get()))
2883 {
2884 // Group objects don't have text. Insert a text object into
2885 // the group for holding the text.
2886 pSdrTextObj = new SdrRectObj(
2887 *m_pDrawModel,
2888 SdrObjKind::Text,
2889 pThisGroup->GetCurrentBoundRect());
2890
2892 aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
2893 aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
2894 aSet.Put(SdrTextFitToSizeTypeItem( drawing::TextFitToSizeType_NONE ));
2896 aSet.Put(makeSdrTextAutoGrowWidthItem(false));
2897 pSdrTextObj->SetMergedItemSet(aSet);
2898 pSdrTextObj->NbcSetLayer( pThisGroup->GetLayer() );
2899 pThisGroup->GetSubList()->NbcInsertObject(pSdrTextObj.get());
2900 }
2901 else
2902 pSdrTextObj = DynCastSdrTextObj(rRecord.pObj.get());
2903
2904 if( pSdrTextObj )
2905 {
2906 Size aObjSize(pSdrTextObj->GetSnapRect().GetWidth(),
2907 pSdrTextObj->GetSnapRect().GetHeight());
2908
2909 // Object is part of a group?
2910 SdrObject* pGroupObject = pSdrTextObj->getParentSdrObjectFromSdrObject();
2911
2912 const size_t nOrdNum = pSdrTextObj->GetOrdNum();
2913 bool bEraseThisObject;
2914 InsertTxbxText(pSdrTextObj.get(), &aObjSize, rRecord.aTextId.nTxBxS, rRecord.aTextId.nSequence,
2915 nGrafAnchorCp, pRetFrameFormat,
2916 (pSdrTextObj.get() != pTrueObject.get()) || (nullptr != pGroupObject), bEraseThisObject,
2917 nullptr, nullptr, nullptr, nullptr, &rRecord);
2918
2919 // was this object replaced ??
2920 if (bEraseThisObject)
2921 {
2922 if( pGroupObject || (pSdrTextObj.get() != pTrueObject.get()) )
2923 {
2924 // Object is already replaced by a new SdrGrafObj (in the group
2925 // and) the Drawing-Page.
2926
2927 SdrObject* pNewObj = pGroupObject ?
2928 pGroupObject->GetSubList()->GetObj(nOrdNum) : pTrueObject.get();
2929 if (pSdrTextObj.get() != pNewObj)
2930 {
2931 // Replace object in the Z-Order-List
2932 m_xMSDffManager->ExchangeInShapeOrder(pSdrTextObj.get(), 0, pNewObj);
2933 // and save the new object.
2934 rRecord.pObj = pNewObj;
2935 }
2936 }
2937 else
2938 {
2939 // remove the object from Z-Order list
2940 m_xMSDffManager->RemoveFromShapeOrder( pSdrTextObj.get() );
2941 // take the object from the drawing page
2942 if( pSdrTextObj->getSdrPageFromSdrObject() )
2943 m_pDrawPg->RemoveObject( pSdrTextObj->GetOrdNum() );
2944 // and delete FrameFormat, because replaced by graphic
2945 // (this also deletes the object)
2946 m_rDoc.DelFrameFormat( pRetFrameFormat );
2947 pRetFrameFormat = nullptr;
2948 // also delete the object record
2949 rRecord.pObj = nullptr;
2950 }
2951 }
2952 else
2953 {
2954 // use ww8-default border distance
2956 aItemSet(m_pDrawModel->GetItemPool());
2957 aItemSet.Put(makeSdrTextLeftDistItem(rRecord.nDxTextLeft));
2958 aItemSet.Put(makeSdrTextRightDistItem(rRecord.nDxTextRight));
2959 aItemSet.Put(makeSdrTextUpperDistItem(rRecord.nDyTextTop));
2960 aItemSet.Put(makeSdrTextLowerDistItem(rRecord.nDyTextBottom));
2961 pSdrTextObj->SetMergedItemSetAndBroadcast(aItemSet);
2962 }
2963 }
2964 return pRetFrameFormat;
2965}
2966
2968 rtl::Reference<SdrObject>& rpOurNewObject,
2969 const SvxMSDffImportRec& rRecord,
2970 RndStdIds eAnchor, const WW8_FSPA& rF,
2971 SfxItemSet &rFlySet)
2972{
2973 SwFlyFrameFormat* pRetFrameFormat = nullptr;
2974 tools::Long nStartCp;
2975 tools::Long nEndCp;
2976
2977 // Check if this textbox chain contains text as conversion of an empty
2978 // chain would not make sense.
2979 if (TxbxChainContainsRealText(rRecord.aTextId.nTxBxS, nStartCp, nEndCp))
2980 {
2981 // The Text is not read into SdrTextObj! Rather insert a frame and
2982 // insert the text from nStartCp to nEndCp.
2983
2984 // More attributes can be used in a frame compared to the
2985 // Edit-Engine, and it can contain field, OLEs or graphics...
2986 tools::Rectangle aInnerDist(rRecord.nDxTextLeft, rRecord.nDyTextTop, rRecord.nDxTextRight,
2987 rRecord.nDyTextBottom);
2988
2990 rF.nYaBottom - rF.nYaTop);
2993 rFlySet.Put(aFrameSize);
2994
2995 MatchSdrItemsIntoFlySet(rpObject.get(), rFlySet, rRecord.eLineStyle, rRecord.eLineDashing,
2996 rRecord.eShapeType, aInnerDist);
2997
2998 SdrTextObj *pSdrTextObj = DynCastSdrTextObj(rpObject.get());
2999 if (pSdrTextObj && pSdrTextObj->IsVerticalWriting())
3000 rFlySet.Put(SvxFrameDirectionItem(SvxFrameDirection::Vertical_RL_TB, RES_FRAMEDIR));
3001
3002 pRetFrameFormat = m_rDoc.MakeFlySection(eAnchor, m_pPaM->GetPoint(), &rFlySet);
3003 OSL_ENSURE(pRetFrameFormat->GetAnchor().GetAnchorId() == eAnchor,
3004 "Not the anchor type requested!");
3005
3006 // if everything is OK, find pointer on new object and correct
3007 // Z-order list (or delete entry)
3008 rpOurNewObject = CreateContactObject(pRetFrameFormat);
3009
3010 // remove old object from the Z-Order list
3011 m_xMSDffManager->RemoveFromShapeOrder( rpObject.get() );
3012
3013 // and delete the object
3014 rpObject.clear();
3015 /*
3016 NB: only query pOrgShapeObject starting here!
3017 */
3018
3019 if (rpOurNewObject)
3020 {
3021 /*
3022 We do not store our rpOutNewObject in the ShapeOrder because we
3023 have a FrameFormat from which we can regenerate the contact object when
3024 we need it. Because, we can have frames anchored to paragraphs in
3025 header/footers and we can copy header/footers, if we do copy a
3026 header/footer with a nonpage anchored frame in it then the contact
3027 objects are invalidated. Under this condition the FrameFormat will be
3028 updated to reflect this change and can be used to get a new
3029 contact object, while a raw rpOutNewObject stored here becomes
3030 deleted and useless.
3031 */
3032 m_xMSDffManager->StoreShapeOrder(rF.nSpId,
3033 (static_cast<sal_uLong>(rRecord.aTextId.nTxBxS) << 16) +
3034 rRecord.aTextId.nSequence, nullptr, pRetFrameFormat);
3035
3036 // The Contact object has to be inserted into the draw page, so
3037 // SwWW8ImplReader::LoadDoc1() can determine the z-order.
3038 if (!rpOurNewObject->IsInserted())
3039 {
3040 // pass information, if object is in page header|footer to method.
3041 m_xWWZOrder->InsertEscherObject(rpOurNewObject.get(), rF.nSpId, rRecord.bDrawHell,
3043 }
3044 }
3045
3046 // Box-0 receives the text for the whole chain!
3047 if (!rRecord.aTextId.nSequence)
3048 {
3049 // save flags etc and reset them
3050 WW8ReaderSave aSave( this );
3051
3052 MoveInsideFly(pRetFrameFormat);
3053
3054 m_xWWZOrder->InsideEscher(rF.nSpId);
3055
3056 // read in the text
3057 m_bTxbxFlySection = true;
3058 bool bJoined = ReadText(nStartCp, (nEndCp-nStartCp),
3059 MAN_MAINTEXT == m_xPlcxMan->GetManType() ?
3061
3062 m_xWWZOrder->OutsideEscher();
3063
3064 MoveOutsideFly(pRetFrameFormat, aSave.GetStartPos(),!bJoined);
3065
3066 aSave.Restore( this );
3067
3068 StripNegativeAfterIndent(pRetFrameFormat);
3069 }
3070
3071 }
3072 return pRetFrameFormat;
3073}
3074
3076{
3077 if (rRecord.bVFlip || rRecord.bHFlip)
3078 {
3080 if (rRecord.bVFlip && rRecord.bHFlip)
3082 else if (rRecord.bVFlip)
3084 else
3086 rFlySet.Put( SwMirrorGrf(eType) );
3087 }
3088}
3089
3091 rtl::Reference<SdrObject> &rpOurNewObject,
3092 SvxMSDffImportRec& rRecord,
3093 WW8_FSPA& rF,
3094 SfxItemSet &rFlySet )
3095{
3096 SwFlyFrameFormat* pRetFrameFormat = nullptr;
3097 sal_Int32 nWidthTw = o3tl::saturating_sub(rF.nXaRight, rF.nXaLeft);
3098 if (0 > nWidthTw)
3099 nWidthTw = 0;
3100 sal_Int32 nHeightTw = o3tl::saturating_sub(rF.nYaBottom, rF.nYaTop);
3101 if (0 > nHeightTw)
3102 nHeightTw = 0;
3103
3104 ProcessEscherAlign(rRecord, rF, rFlySet);
3105
3106 rFlySet.Put(SwFormatFrameSize(SwFrameSize::Fixed, nWidthTw, nHeightTw));
3107
3109
3110 // Note that the escher inner distance only seems to be honoured in
3111 // word for textboxes, not for graphics and ole objects.
3112 tools::Rectangle aInnerDist(0, 0, 0, 0);
3113
3114 MatchSdrItemsIntoFlySet(rpObject.get(), rFlySet, rRecord.eLineStyle, rRecord.eLineDashing,
3115 rRecord.eShapeType, aInnerDist);
3116
3117 MatchEscherMirrorIntoFlySet(rRecord, aGrSet);
3118
3119 OUString aObjectName(rpObject->GetName());
3120 if (SdrObjKind::OLE2 == rpObject->GetObjIdentifier())
3121 pRetFrameFormat = InsertOle(*static_cast<SdrOle2Obj*>(rpObject.get()), rFlySet, &aGrSet);
3122 else
3123 {
3124 const SdrGrafObj *pGrf = static_cast<const SdrGrafObj*>(rpObject.get());
3125 bool bDone = false;
3126 if (pGrf->IsLinkedGraphic() && !pGrf->GetFileName().isEmpty())
3127 {
3129 OUString aGrfName(
3133 // correction of fix for issue #i10939#:
3134 // One of the two conditions have to be true to insert the graphic
3135 // as a linked graphic -
3136 if (GraphicType::NONE == eType || CanUseRemoteLink(aGrfName))
3137 {
3139 *m_pPaM, aGrfName, OUString(), nullptr,
3140 &rFlySet, &aGrSet, nullptr);
3141 bDone = true;
3142 }
3143 }
3144 if (!bDone)
3145 {
3146 const Graphic& rGraph = pGrf->GetGraphic();
3148 *m_pPaM, OUString(), OUString(), &rGraph,
3149 &rFlySet, &aGrSet, nullptr);
3150 }
3151 }
3152
3153 if (pRetFrameFormat)
3154 {
3155 if (SdrObjKind::OLE2 != rpObject->GetObjIdentifier())
3156 SetAttributesAtGrfNode(rRecord, *pRetFrameFormat, &rF);
3157 // avoid multiple occurrences of the same graphic name
3158 m_aGrfNameGenerator.SetUniqueGraphName(pRetFrameFormat, aObjectName);
3159 }
3160 // if everything is OK, determine pointer to new object and correct
3161 // Z-Order-List accordingly (or delete entry)
3162 rpOurNewObject = CreateContactObject(pRetFrameFormat);
3163
3164 // remove old object from Z-Order-List
3165 m_xMSDffManager->RemoveFromShapeOrder( rpObject.get() );
3166 // remove from Drawing-Page
3167 if( rpObject->getSdrPageFromSdrObject() )
3168 m_pDrawPg->RemoveObject( rpObject->GetOrdNum() );
3169
3170 // and delete the object
3171 rpObject.clear();
3172
3173 /*
3174 Warning: from now on query only pOrgShapeObject!
3175 */
3176
3177 // add Contact-Object to the Z-Order-List and the page
3178 if (rpOurNewObject)
3179 {
3180 if (!m_bHdFtFootnoteEdn)
3181 m_xMSDffManager->StoreShapeOrder(rF.nSpId, 0, rpOurNewObject.get());
3182
3183 // The Contact-Object MUST be set in the Draw-Page, so that in
3184 // SwWW8ImplReader::LoadDoc1() the Z-Order can be defined !!!
3185 if (!rpOurNewObject->IsInserted())
3186 {
3187 // pass information, if object is in page header|footer to method.
3188 m_xWWZOrder->InsertEscherObject(rpOurNewObject.get(), rF.nSpId, rRecord.bDrawHell,
3190 }
3191 }
3192 return pRetFrameFormat;
3193}
3194
3195void SwWW8ImplReader::GraphicCtor() // For SVDraw and VCControls and Escher
3196{
3197 if (m_pDrawModel)
3198 return;
3199
3200 m_rDoc.getIDocumentDrawModelAccess().GetOrCreateDrawModel(); // #i52858# - method name changed
3202 OSL_ENSURE(m_pDrawModel, "Cannot create DrawModel");
3204
3205 m_xMSDffManager.reset(new SwMSDffManager(*this, m_bSkipImages));
3206 m_xMSDffManager->SetModel(m_pDrawModel, 1440);
3207 /*
3208 Now the dff manager always needs a controls converter as well, but a
3209 control converter may still exist without a dffmanager.
3210 */
3212
3214 m_xMSDffManager->GetShapeOrders()));
3215}
3216
3218{
3219 m_pDrawEditEngine.reset(); // maybe created by graphic
3220 m_xWWZOrder.reset(); // same
3221}
3222
3224{
3225 OSL_ENSURE(pFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR,
3226 "Don't use fltanchors with inline frames, slap!");
3227 NewAttr(rPos, SwFltAnchor(pFormat));
3228}
3229
3231{
3232 size_t nCnt = size();
3233 for (size_t i=0; i < nCnt; ++i)
3234 {
3235 SwFltStackEntry &rEntry = (*this)[i];
3236 SwPosition aDummy(rEntry.m_aMkPos.m_nNode);
3237 SetAttrInDoc(aDummy, rEntry);
3239 --nCnt;
3240 }
3241}
3242
3243/* 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)
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
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:727
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:1415
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:705
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
OUString GetUniqueFrameName() const
Definition: doclay.cxx:1405
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:169
void PosAttrSet()
Definition: frmfmt.hxx:452
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:409
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:3223
bool ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType)
Definition: ww8par.cxx:4038
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:3217
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:2647
bool IsObjectLayoutInTableCell(const sal_uInt32 nGroupShapeBooleanProperties) const
Definition: ww8graf.cxx:2475
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:3090
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:2967
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:2354
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:2836
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:6246
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:2874
void MoveInsideFly(const SwFrameFormat *pFlyFormat)
Definition: ww8par6.cxx:2340
void Read_Obj(sal_uInt16, const sal_uInt8 *, short nLen)
Definition: ww8par6.cxx:2927
wwFrameNamer m_aGrfNameGenerator
Definition: ww8par.hxx:1216
void GraphicCtor()
Definition: ww8graf.cxx:3195
std::unique_ptr< wwZOrderer > m_xWWZOrder
Definition: ww8par.hxx:1292
bool IsRightToLeft()
Definition: ww8par6.cxx:4704
void Read_PicLoc(sal_uInt16, const sal_uInt8 *pData, short nLen)
Definition: ww8par6.cxx:2950
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:2859
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:3042
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:2525
short m_nDrawYOfs2
Definition: ww8par.hxx:1334
short ImportSprm(const sal_uInt8 *pPos, sal_Int32 nMemLen, sal_uInt16 nId=0)
Definition: ww8par6.cxx:6256
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:2113
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:521
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:3075
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)