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_xSprmParser->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_xSprmParser);
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, 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 // Contour is enabled, but no polygon is set: disable contour, because Word does not
2108 // Writer-style auto-contour in that case.
2109 SwFormatSurround aSurround(rFlyFormat.GetSurround());
2110 aSurround.SetContour(false);
2111 rFlyFormat.SetFormatAttr(aSurround);
2112 }
2113}
2114
2115static sal_Int32 lcl_ConvertCrop(sal_uInt32 const nCrop, sal_Int32 const nSize)
2116{
2117 // cast to sal_Int32 to handle negative crop properly
2118 sal_Int32 const nIntegral(static_cast<sal_Int32>(nCrop) >> 16);
2119 // fdo#77454: heuristic to detect mangled values written by old OOo/LO
2120 if (abs(nIntegral) >= 50) // FIXME: what's a good cut-off?
2121 {
2122 SAL_INFO("sw.ww8", "ignoring suspiciously large crop: " << nIntegral);
2123 return 0;
2124 }
2125 return (nIntegral * nSize) + (((nCrop & 0xffff) * nSize) >> 16);
2126}
2127
2129 const SwFrameFormat& rFlyFormat, WW8_FSPA const *pF)
2130{
2131 const SwNodeIndex* pIdx = rFlyFormat.GetContent(false).GetContentIdx();
2132 SwGrfNode *const pGrfNd(
2133 pIdx ? m_rDoc.GetNodes()[pIdx->GetIndex() + 1]->GetGrfNode() : nullptr);
2134 if (!pGrfNd)
2135 return;
2136
2137 Size aSz(pGrfNd->GetTwipSize());
2138 // use type <sal_uInt64> instead of sal_uLong to get correct results
2139 // in the following calculations.
2140 sal_uInt64 nHeight = aSz.Height();
2141 sal_uInt64 nWidth = aSz.Width();
2142 if (!nWidth && pF)
2143 nWidth = o3tl::saturating_sub(pF->nXaRight, pF->nXaLeft);
2144 else if (!nHeight && pF)
2145 nHeight = o3tl::saturating_sub(pF->nYaBottom, pF->nYaTop);
2146
2147 if (rRecord.nCropFromTop || rRecord.nCropFromBottom ||
2148 rRecord.nCropFromLeft || rRecord.nCropFromRight)
2149 {
2150 SwCropGrf aCrop; // Cropping is stored in 'fixed floats'
2151 // 16.16 (fraction times total
2152 if (rRecord.nCropFromTop) // image width or height resp.)
2153 {
2154 aCrop.SetTop(lcl_ConvertCrop(rRecord.nCropFromTop, nHeight));
2155 }
2156 if (rRecord.nCropFromBottom)
2157 {
2158 aCrop.SetBottom(lcl_ConvertCrop(rRecord.nCropFromBottom, nHeight));
2159 }
2160 if (rRecord.nCropFromLeft)
2161 {
2162 aCrop.SetLeft(lcl_ConvertCrop(rRecord.nCropFromLeft, nWidth));
2163 }
2164 if (rRecord.nCropFromRight)
2165 {
2166 aCrop.SetRight(lcl_ConvertCrop(rRecord.nCropFromRight, nWidth));
2167 }
2168
2169 pGrfNd->SetAttr( aCrop );
2170 }
2171
2172 bool bFlipH(rRecord.nFlags & ShapeFlag::FlipH);
2173 bool bFlipV(rRecord.nFlags & ShapeFlag::FlipV);
2174 if ( bFlipH || bFlipV )
2175 {
2176 SwMirrorGrf aMirror = pGrfNd->GetSwAttrSet().GetMirrorGrf();
2177 if( bFlipH )
2178 {
2179 if( bFlipV )
2180 aMirror.SetValue(MirrorGraph::Both);
2181 else
2183 }
2184 else
2186
2187 pGrfNd->SetAttr( aMirror );
2188 }
2189
2190 if (!rRecord.pObj)
2191 return;
2192
2193 const SfxItemSet& rOldSet = rRecord.pObj->GetMergedItemSet();
2194 // contrast
2197 {
2198 SwContrastGrf aContrast(
2199 WW8ITEMVALUE(rOldSet,
2201 pGrfNd->SetAttr( aContrast );
2202 }
2203
2204 // luminance
2207 {
2208 SwLuminanceGrf aLuminance(WW8ITEMVALUE(rOldSet,
2210 pGrfNd->SetAttr( aLuminance );
2211 }
2212 // gamma
2214 {
2215 double fVal = WW8ITEMVALUE(rOldSet, SDRATTR_GRAFGAMMA,
2217 pGrfNd->SetAttr(SwGammaGrf(fVal/100.));
2218 }
2219
2220 // drawmode
2221 auto nGrafMode = rOldSet.GetItem<SdrGrafModeItem>(SDRATTR_GRAFMODE)->GetValue();
2222 if ( nGrafMode != GraphicDrawMode::Standard)
2223 {
2224 SwDrawModeGrf aDrawMode( nGrafMode );
2225 pGrfNd->SetAttr( aDrawMode );
2226 }
2227}
2228
2230{
2231 if (pFlyFormat)
2232 {
2233 SdrObject* pNewObject = m_bNewDoc ? nullptr : pFlyFormat->FindRealSdrObject();
2234 if (!pNewObject)
2235 pNewObject = pFlyFormat->FindSdrObject();
2236 if (!pNewObject )
2237 if (auto pFlyFrameFormat = dynamic_cast<SwFlyFrameFormat *>( pFlyFormat ))
2238 {
2239 SwFlyDrawContact* pContactObject = pFlyFrameFormat->GetOrCreateContact();
2240 pNewObject = pContactObject->GetMaster();
2241 }
2242 return pNewObject;
2243 }
2244 return nullptr;
2245}
2246
2247// Miserable miserable hack to fudge word's graphic layout in RTL mode to ours.
2249 sal_Int16 eHoriOri, sal_Int16 eHoriRel)
2250{
2251 if (!IsRightToLeft())
2252 return false;
2253 return RTLGraphicsHack(rLeft, nWidth, eHoriOri, eHoriRel,
2257}
2258
2260 SfxItemSet &rFlySet)
2261{
2262 bool bCurSectionVertical = m_aSectionManager.CurrentSectionIsVertical();
2263
2264 if (!rRecord.nXRelTo)
2265 {
2266 rRecord.nXRelTo = sal_Int32(rFSPA.nbx);
2267 }
2268 if (!rRecord.nYRelTo)
2269 {
2270 rRecord.nYRelTo = sal_Int32(rFSPA.nby);
2271 }
2272
2273 // nXAlign - abs. Position, Left, Centered, Right, Inside, Outside
2274 // nYAlign - abs. Position, Top, Centered, Bottom, Inside, Outside
2275
2276 // nXRelTo - Page printable area, Page, Column, Character
2277 // nYRelTo - Page printable area, Page, Paragraph, Line
2278
2279 const sal_uInt32 nCntXAlign = 6;
2280 const sal_uInt32 nCntYAlign = 6;
2281
2282 const sal_uInt32 nCntRelTo = 4;
2283
2284 sal_uInt32 nXAlign = nCntXAlign > rRecord.nXAlign ? rRecord.nXAlign : 1;
2285 sal_uInt32 nYAlign = nCntYAlign > rRecord.nYAlign ? rRecord.nYAlign : 1;
2286
2287 // #i52565# - try to handle special case for objects in tables regarding its X Rel
2288
2289 // if X and Y Rel values are on default take it as a hint, that they have not been set
2290 // by <SwMSDffManager::ProcessObj(..)>
2291 const bool bXYRelHaveDefaultValues = *rRecord.nXRelTo == 2 && *rRecord.nYRelTo == 2;
2292 if (bXYRelHaveDefaultValues && m_nInTable > 0 && !bCurSectionVertical)
2293 {
2294 if (sal_uInt32(rFSPA.nby) != rRecord.nYRelTo)
2295 rRecord.nYRelTo = sal_uInt32(rFSPA.nby);
2296 }
2297
2298 sal_uInt32 nXRelTo = (rRecord.nXRelTo && nCntRelTo > rRecord.nXRelTo) ? *rRecord.nXRelTo : 1;
2299 sal_uInt32 nYRelTo = (rRecord.nYRelTo && nCntRelTo > rRecord.nYRelTo) ? *rRecord.nYRelTo : 1;
2300
2301 RndStdIds eAnchor = IsInlineEscherHack() ? RndStdIds::FLY_AS_CHAR : RndStdIds::FLY_AT_CHAR; // #i43718#
2302
2303 SwFormatAnchor aAnchor( eAnchor );
2304 aAnchor.SetAnchor( m_pPaM->GetPoint() );
2305 rFlySet.Put( aAnchor );
2306
2307 // #i18732#
2308 // Given new layout where everything is changed to be anchored to
2309 // character the following 4 tables may need to be changed.
2310
2311 // horizontal Adjustment
2312 static const sal_Int16 aHoriOriTab[ nCntXAlign ] =
2313 {
2314 text::HoriOrientation::NONE, // From left position
2315 text::HoriOrientation::LEFT, // left
2316 text::HoriOrientation::CENTER, // centered
2317 text::HoriOrientation::RIGHT, // right
2318 // #i36649#
2319 // - inside -> text::HoriOrientation::LEFT and outside -> text::HoriOrientation::RIGHT
2320 text::HoriOrientation::LEFT, // inside
2321 text::HoriOrientation::RIGHT // outside
2322 };
2323
2324 // generic vertical Adjustment
2325 static const sal_Int16 aVertOriTab[ nCntYAlign ] =
2326 {
2327 text::VertOrientation::NONE, // From Top position
2328 text::VertOrientation::TOP, // top
2329 text::VertOrientation::CENTER, // centered
2330 text::VertOrientation::BOTTOM, // bottom
2331 text::VertOrientation::LINE_TOP, // inside (obscure)
2332 text::VertOrientation::LINE_BOTTOM // outside (obscure)
2333 };
2334
2335 // #i22673# - to-line vertical alignment
2336 static const sal_Int16 aToLineVertOriTab[ nCntYAlign ] =
2337 {
2339 text::VertOrientation::LINE_BOTTOM, // top
2340 text::VertOrientation::LINE_CENTER, // centered
2341 text::VertOrientation::LINE_TOP, // bottom
2342 text::VertOrientation::LINE_BOTTOM, // inside (obscure)
2343 text::VertOrientation::LINE_TOP // outside (obscure)
2344 };
2345
2346 // Adjustment is horizontally relative to...
2347 static const sal_Int16 aHoriRelOriTab[nCntRelTo] =
2348 {
2349 text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
2350 text::RelOrientation::PAGE_FRAME, // 1 is page margin
2351 text::RelOrientation::FRAME, // 2 is relative to column
2352 text::RelOrientation::CHAR // 3 is relative to character
2353 };
2354
2355 // Adjustment is vertically relative to...
2356 // #i22673# - adjustment for new vertical alignment at top of line.
2357 static const sal_Int16 aVertRelOriTab[nCntRelTo] =
2358 {
2359 text::RelOrientation::PAGE_PRINT_AREA, // 0 is page textarea margin
2360 text::RelOrientation::PAGE_FRAME, // 1 is page margin
2361 text::RelOrientation::FRAME, // 2 is relative to paragraph
2362 text::RelOrientation::TEXT_LINE // 3 is relative to line
2363 };
2364
2365 sal_Int16 eHoriOri = aHoriOriTab[ nXAlign ];
2366 sal_Int16 eHoriRel = aHoriRelOriTab[ nXRelTo ];
2367
2368 // #i36649# - adjustments for certain alignments
2369 if (eHoriOri == text::HoriOrientation::LEFT && eHoriRel == text::RelOrientation::PAGE_FRAME)
2370 {
2371 // convert 'left to page' to 'from left -<width> to page text area'
2372 eHoriOri = text::HoriOrientation::NONE;
2373 eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;
2374 const tools::Long nWidth = rFSPA.nXaRight - rFSPA.nXaLeft;
2375 rFSPA.nXaLeft = -nWidth;
2376 rFSPA.nXaRight = 0;
2377 }
2378 else if (eHoriOri == text::HoriOrientation::RIGHT && eHoriRel == text::RelOrientation::PAGE_FRAME)
2379 {
2380 // convert 'right to page' to 'from left 0 to right page border'
2381 eHoriOri = text::HoriOrientation::NONE;
2382 eHoriRel = text::RelOrientation::PAGE_RIGHT;
2383 const tools::Long nWidth = rFSPA.nXaRight - rFSPA.nXaLeft;
2384 rFSPA.nXaLeft = 0;
2385 rFSPA.nXaRight = nWidth;
2386 }
2387
2388 // #i24255# - position of floating screen objects in
2389 // R2L layout are given in L2R layout, thus convert them of all
2390 // floating screen objects, which are imported.
2391 {
2392 // Miserable miserable hack.
2393 SwTwips nWidth = o3tl::saturating_sub(rFSPA.nXaRight, rFSPA.nXaLeft);
2394 SwTwips nLeft = rFSPA.nXaLeft;
2395 if (MiserableRTLGraphicsHack(nLeft, nWidth, eHoriOri,
2396 eHoriRel))
2397 {
2398 rFSPA.nXaLeft = nLeft;
2399 rFSPA.nXaRight = rFSPA.nXaLeft + nWidth;
2400 }
2401 }
2402
2403 // if the object is anchored inside a table cell, is horizontal aligned
2404 // at frame|character and has wrap through, but its attribute
2405 // 'layout in table cell' isn't set, convert its horizontal alignment to page text area.
2406 // #i84783# - use new method <IsObjectLayoutInTableCell()>
2407 if (m_nInTable &&
2408 (eHoriRel == text::RelOrientation::FRAME || eHoriRel == text::RelOrientation::CHAR) &&
2409 rFSPA.nwr == 3 &&
2411 {
2412 eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;
2413 }
2414
2415 // Writer honours this wrap distance when aligned as "left" or "right",
2416 // Word doesn't. Writer doesn't honour it when its "from left".
2417 if (eHoriOri == text::HoriOrientation::LEFT)
2418 rRecord.nDxWrapDistLeft = 0;
2419 else if (eHoriOri == text::HoriOrientation::RIGHT)
2420 rRecord.nDxWrapDistRight = 0;
2421
2422 sal_Int16 eVertRel;
2423
2424 eVertRel = aVertRelOriTab[ nYRelTo ]; // #i18732#
2425 if (bCurSectionVertical && nYRelTo == 2)
2426 eVertRel = text::RelOrientation::PAGE_PRINT_AREA;
2427 // #i22673# - fill <eVertOri> in dependence of <eVertRel>
2428 sal_Int16 eVertOri;
2429 if (eVertRel == text::RelOrientation::TEXT_LINE)
2430 {
2431 eVertOri = aToLineVertOriTab[ nYAlign ];
2432 }
2433 else
2434 {
2435 eVertOri = aVertOriTab[ nYAlign ];
2436 }
2437
2438 // Below line in word is a positive value, while in writer its
2439 // negative
2440 tools::Long nYPos = rFSPA.nYaTop;
2441 // #i22673#
2442 if ((eVertRel == text::RelOrientation::TEXT_LINE) && (eVertOri == text::VertOrientation::NONE))
2443 nYPos = -nYPos;
2444
2445 SwFormatHoriOrient aHoriOri(MakeSafePositioningValue(bCurSectionVertical ? nYPos : rFSPA.nXaLeft),
2446 bCurSectionVertical ? eVertOri : eHoriOri,
2447 bCurSectionVertical ? eVertRel : eHoriRel);
2448 if (4 <= nXAlign)
2449 aHoriOri.SetPosToggle(true);
2450 rFlySet.Put(aHoriOri);
2451
2452 rFlySet.Put(SwFormatVertOrient(MakeSafePositioningValue(!bCurSectionVertical ? nYPos : -rFSPA.nXaRight),
2453 !bCurSectionVertical ? eVertOri : eHoriOri,
2454 !bCurSectionVertical ? eVertRel : eHoriRel));
2455
2456 return eAnchor;
2457}
2458
2459// #i84783#
2460bool SwWW8ImplReader::IsObjectLayoutInTableCell(const sal_uInt32 nGroupShapeBooleanProperties) const
2461{
2462 bool bIsObjectLayoutInTableCell = false;
2463
2464 if ( m_bVer8 )
2465 {
2466 sal_uInt16 nWWVersion = m_xWwFib->m_nProduct & 0xE000;
2467 if (nWWVersion == 0)
2468 {
2469 // 0 nProduct can happen for Word >97 as well, check cswNew in this case instead.
2470 if (m_xWwFib->m_cswNew > 0)
2471 {
2472 // This is Word >=2000.
2473 nWWVersion = 0x2000;
2474 }
2475 }
2476
2477 switch ( nWWVersion )
2478 {
2479 case 0x0000: // version 8 aka Microsoft Word 97
2480 {
2481 bIsObjectLayoutInTableCell = false;
2482 OSL_ENSURE(nGroupShapeBooleanProperties == 0,
2483 "no explicit object attribute layout in table cell expected." );
2484 }
2485 break;
2486 case 0x2000: // version 9 aka Microsoft Word 2000
2487 case 0x4000: // version 10 aka Microsoft Word 2002
2488 case 0x6000: // version 11 aka Microsoft Word 2003
2489 case 0x8000: // version 12 aka Microsoft Word 2007
2490 case 0xC000: // version 14 aka Microsoft Word 2010
2491 case 0xE000: // version 15 aka Microsoft Word 2013
2492 {
2493 // Documented in [MS-ODRAW], 2.3.4.44 "Group Shape Boolean Properties".
2494 bool fUsefLayoutInCell = (nGroupShapeBooleanProperties & 0x80000000) >> 31;
2495 bool fLayoutInCell = (nGroupShapeBooleanProperties & 0x8000) >> 15;
2496 // If unspecified, defaults to true
2497 bIsObjectLayoutInTableCell = !fUsefLayoutInCell || fLayoutInCell;
2498 }
2499 break;
2500 default:
2501 {
2502 OSL_FAIL( "unknown version." );
2503 }
2504 }
2505 }
2506
2507 return bIsObjectLayoutInTableCell;
2508}
2509
2511{
2513 return nullptr;
2514
2516
2517 m_nDrawCpO = 0;
2518 m_bDrawCpOValid = m_xWwFib->GetBaseCp(m_xPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX, &m_nDrawCpO);
2519
2520 GraphicCtor();
2521
2522 WW8PLCFspecial* pPF = m_xPlcxMan->GetFdoa();
2523 if( !pPF )
2524 {
2525 OSL_ENSURE( false, "Where is the graphic (1) ?" );
2526 return nullptr;
2527 }
2528
2529 if( m_bVer67 )
2530 {
2531 sal_uInt64 nOldPos = m_pStrm->Tell();
2532
2534 ReadGrafLayer1(*pPF, nGrafAnchorCp);
2535
2536 m_pStrm->Seek( nOldPos );
2537 return nullptr;
2538 }
2539
2540 // Normal case of Word 8+ version stuff
2541 pPF->SeekPos( nGrafAnchorCp );
2542
2543 WW8_FC nStartFc;
2544 void* pF0;
2545 if (!pPF->Get(nStartFc, pF0))
2546 {
2547 OSL_ENSURE( false, "+Where is the graphic (2) ?" );
2548 return nullptr;
2549 }
2550
2551 WW8_FSPA_SHADOW& rFS = *static_cast<WW8_FSPA_SHADOW*>(pF0);
2552 WW8_FSPA aFSFA;
2553 WW8FSPAShadowToReal(rFS, aFSFA);
2554 if (!aFSFA.nSpId)
2555 {
2556 OSL_ENSURE( false, "+Where is the graphic (3) ?" );
2557 return nullptr;
2558 }
2559
2560 if (!m_xMSDffManager->GetModel())
2561 m_xMSDffManager->SetModel(m_pDrawModel, 1440);
2562
2563 tools::Rectangle aRect(aFSFA.nXaLeft, aFSFA.nYaTop, aFSFA.nXaRight, aFSFA.nYaBottom);
2564 SvxMSDffImportData aData( aRect );
2565
2566 /*
2567 #i20540#
2568 The SdrOle2Obj will try and manage any ole objects it finds, causing all
2569 sorts of trouble later on
2570 */
2571 SwDocShell* pPersist = m_rDoc.GetDocShell();
2572 m_rDoc.SetDocShell(nullptr); // #i20540# Persist guard
2573
2575 bool bOk = (m_xMSDffManager->GetShape(aFSFA.nSpId, pObject, aData) && pObject);
2576
2577 m_rDoc.SetDocShell(pPersist); // #i20540# Persist guard
2578
2579 if (!bOk)
2580 {
2581 OSL_ENSURE( false, "Where is the Shape ?" );
2582 return nullptr;
2583 }
2584
2585 // tdf#118375 Word relates position to the unrotated rectangle,
2586 // Writer uses the rotated one.
2587 if (pObject->GetRotateAngle())
2588 {
2589 tools::Rectangle aObjSnapRect(pObject->GetSnapRect()); // recalculates the SnapRect
2590 aFSFA.nXaLeft = aObjSnapRect.Left();
2591 aFSFA.nYaTop = aObjSnapRect.Top();
2592 aFSFA.nXaRight = aObjSnapRect.Right();
2593 aFSFA.nYaBottom = aObjSnapRect.Bottom();
2594 }
2595
2596 bool bDone = false;
2597 rtl::Reference<SdrObject> pOurNewObject;
2598 bool bReplaceable = false;
2599
2600 switch (pObject->GetObjIdentifier())
2601 {
2602 case SdrObjKind::Graphic:
2603 bReplaceable = true;
2604 bDone = true;
2605 break;
2606 case SdrObjKind::OLE2:
2607 bReplaceable = true;
2608 break;
2609 default:
2610 break;
2611
2612 }
2613
2614 // when in a header or footer word appears to treat all elements as wrap through
2615
2616 // determine wrapping mode
2618 Reader::ResetFrameFormatAttrs(aFlySet); // tdf#122425: Explicitly remove borders and spacing
2619 css::text::WrapTextMode eSurround = css::text::WrapTextMode_PARALLEL;
2620 bool bContour = false;
2621 switch (aFSFA.nwr)
2622 {
2623 case 0: // 0 like 2, but doesn't require absolute object
2624 case 2: // 2 wrap around absolute object
2625 eSurround = css::text::WrapTextMode_PARALLEL;
2626 break;
2627 case 1: // 1 no text next to shape
2628 eSurround = css::text::WrapTextMode_NONE;
2629 break;
2630 case 3: // 3 wrap as if no object present
2631 eSurround = css::text::WrapTextMode_THROUGH;
2632 break;
2633 case 4: // 4 wrap tightly around object
2634 case 5: // 5 wrap tightly, but allow holes
2635 eSurround = css::text::WrapTextMode_PARALLEL;
2636 bContour = true;
2637 break;
2638 }
2639
2640 // if mode 2 or 4 also regard the additional parameters
2641 if ((2 == aFSFA.nwr) || (4 == aFSFA.nwr))
2642 {
2643 switch (aFSFA.nwrk)
2644 {
2645 // 0 wrap both sides
2646 case 0:
2647 eSurround = css::text::WrapTextMode_PARALLEL;
2648 break;
2649 // 1 wrap only on left
2650 case 1:
2651 eSurround = css::text::WrapTextMode_LEFT;
2652 break;
2653 // 2 wrap only on right
2654 case 2:
2655 eSurround = css::text::WrapTextMode_RIGHT;
2656 break;
2657 // 3 wrap only on largest side
2658 case 3:
2659 eSurround = css::text::WrapTextMode_DYNAMIC;
2660 break;
2661 }
2662 }
2663
2664 SwFormatSurround aSur( eSurround );
2665 aSur.SetContour( bContour );
2666 aSur.SetOutside(true); // Winword can only do outside contours
2667 aFlySet.Put( aSur );
2668
2669 // now position imported object correctly and so on (can be a whole group)
2670
2671 OSL_ENSURE(!((aData.size() != 1) && bReplaceable),
2672 "Replaceable drawing with > 1 entries ?");
2673
2674 if (aData.size() != 1)
2675 bReplaceable = false;
2676
2677 /*
2678 Get the record for top level object, so we can get the word anchoring
2679 and wrapping information for it.
2680 */
2681 SvxMSDffImportRec* pRecord = aData.find(pObject.get());
2682 OSL_ENSURE(pRecord, "how did that happen?");
2683 if (!pRecord)
2684 {
2685 // remove old object from the Z-Order list
2686 m_xMSDffManager->RemoveFromShapeOrder(pObject.get());
2687 return nullptr;
2688 }
2689 const bool bLayoutInTableCell =
2691
2692 // #i18732# - Switch on 'follow text flow', if object is laid out
2693 // inside table cell
2694 if (bLayoutInTableCell)
2695 {
2696 SwFormatFollowTextFlow aFollowTextFlow( true );
2697 aFlySet.Put( aFollowTextFlow );
2698 }
2699
2700 // #i21847#
2701 // Some shapes are set to *hidden*, don't import those ones.
2702 if (pRecord->bHidden)
2703 {
2704 // remove old object from the Z-Order list
2705 m_xMSDffManager->RemoveFromShapeOrder(pObject.get());
2706 return nullptr;
2707 }
2708
2709 sal_uInt16 nCount = pObject->GetUserDataCount();
2710 if(nCount)
2711 {
2712 OUString lnName, aObjName, aTarFrame;
2713 for (sal_uInt16 i = 0; i < nCount; i++ )
2714 {
2715 SdrObjUserData* pData = pObject->GetUserData( i );
2716 if( pData && pData->GetInventor() == SdrInventor::ScOrSwDraw
2717 && pData->GetId() == SW_UD_IMAPDATA)
2718 {
2719 SwMacroInfo* macInf = dynamic_cast<SwMacroInfo*>(pData);
2720 if (macInf && macInf->GetShapeId() == aFSFA.nSpId)
2721 {
2722 lnName = macInf->GetHlink();
2723 aObjName = macInf->GetName();
2724 aTarFrame = macInf->GetTarFrame();
2725 break;
2726 }
2727 }
2728 }
2729 std::unique_ptr<SwFormatURL> pFormatURL(new SwFormatURL());
2730 pFormatURL->SetURL( lnName, false );
2731 if (!aObjName.isEmpty())
2732 pFormatURL->SetName(aObjName);
2733 if (!aTarFrame.isEmpty())
2734 pFormatURL->SetTargetFrameName(aTarFrame);
2735 pFormatURL->SetMap(nullptr);
2736 aFlySet.Put(std::move(pFormatURL));
2737 }
2738
2739 // If we are to be "below text" then we are not to be opaque
2740 // #i14045# MM If we are in a header or footer then make the object transparent
2741 // Not exactly like word but close enough for now
2742
2743 // both flags <bBelowText> and <bDrawHell> have to be set to move object into the background.
2744 // #i46794# - it reveals that value of flag <bBelowText> can be neglected.
2745 const bool bMoveToBackground = pRecord->bDrawHell ||
2746 ((m_bIsHeader || m_bIsFooter) && aFSFA.nwr == 3);
2747 if ( bMoveToBackground )
2748 aFlySet.Put(SvxOpaqueItem(RES_OPAQUE,false));
2749
2750 OUString aObjName = pObject->GetName();
2751
2752 bool bDrawObj = false;
2753 bool bFrame = false;
2754
2755 SwFrameFormat* pRetFrameFormat = nullptr;
2756 if (bReplaceable)
2757 {
2758 // Single graphics or ole objects
2759 pRetFrameFormat = ImportReplaceableDrawables(pObject, pOurNewObject, *pRecord, aFSFA, aFlySet);
2760 }
2761 else
2762 {
2763 bDrawObj = true;
2764
2765 // Drawing objects, (e.g. ovals or drawing groups)
2766 if (aFSFA.bRcaSimple)
2767 {
2770 }
2771
2772 RndStdIds eAnchor = ProcessEscherAlign(*pRecord, aFSFA, aFlySet);
2773
2774 // Should we, and is it possible to make this into a writer textbox
2775 if ((!(m_nIniFlags1 & WW8FL_NO_FLY_FOR_TXBX)) && pRecord->bReplaceByFly)
2776 {
2777 pRetFrameFormat
2778 = ConvertDrawTextToFly(pObject, pOurNewObject, *pRecord, eAnchor, aFSFA, aFlySet);
2779 if (pRetFrameFormat)
2780 {
2781 bDone = true;
2782 bDrawObj = false;
2783 bFrame = true;
2784 }
2785 }
2786
2787 if (!bDone)
2788 {
2789 sw::util::SetLayer aSetLayer(m_rDoc);
2790 if ( bMoveToBackground )
2791 aSetLayer.SendObjectToHell(*pObject);
2792 else
2793 aSetLayer.SendObjectToHeaven(*pObject);
2794
2795 if (!IsInlineEscherHack())
2796 {
2797 /* Need to make sure that the correct layer ordering is applied. */
2798 // pass information, if object is in page header|footer to method.
2799 m_xWWZOrder->InsertEscherObject(pObject.get(), aFSFA.nSpId, pRecord->bDrawHell,
2801 }
2802 else
2803 {
2804 m_xWWZOrder->InsertTextLayerObject(pObject.get());
2805 }
2806
2807 pRetFrameFormat = m_rDoc.getIDocumentContentOperations().InsertDrawObj(*m_pPaM, *pObject, aFlySet );
2808
2809 OSL_ENSURE(pRetFrameFormat->GetAnchor().GetAnchorId() ==
2810 eAnchor, "Not the anchor type requested!");
2811
2812 /*
2813 Insert text if necessary into textboxes contained in groups.
2814 */
2815 for (const auto& it : aData)
2816 {
2817 pRecord = it.get();
2818 if (pRecord->pObj && pRecord->aTextId.nTxBxS)
2819 { // #i52825# pRetFrameFormat can be NULL
2820 pRetFrameFormat = MungeTextIntoDrawBox(
2821 *pRecord, nGrafAnchorCp, pRetFrameFormat);
2822 }
2823 }
2824 }
2825 }
2826
2827 SwDrawFrameFormat* pDrawFrameFormat = dynamic_cast<SwDrawFrameFormat*>(pRetFrameFormat);
2828 // #i44344#, #i44681# - positioning attributes already set
2829 if (pDrawFrameFormat)
2830 pDrawFrameFormat->PosAttrSet();
2831 if (!IsInlineEscherHack() && pRetFrameFormat)
2832 MapWrapIntoFlyFormat(*pRecord, *pRetFrameFormat);
2833
2834 // Set frame name with object name
2835 if (pRetFrameFormat /*#i52825# */)
2836 {
2837 if (!aObjName.isEmpty())
2838 pRetFrameFormat->SetFormatName( aObjName );
2839 if (pRetFrameFormat->GetName().isEmpty())
2840 {
2841 if (bDrawObj)
2842 pRetFrameFormat->SetFormatName(m_rDoc.GetUniqueDrawObjectName());
2843 else if (bFrame)
2844 pRetFrameFormat->SetFormatName(m_rDoc.GetUniqueFrameName());
2845 }
2846 }
2847 return AddAutoAnchor(pRetFrameFormat);
2848}
2849
2851{
2852 /*
2853 * anchored to character at the current position will move along the
2854 * paragraph as text is added because we are at the insertion point.
2855 *
2856 * Leave to later and set the correct location then.
2857 */
2858 if (pFormat && (pFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR))
2859 {
2860 m_xAnchorStck->AddAnchor(*m_pPaM->GetPoint(), pFormat);
2861 }
2862 return pFormat;
2863}
2864
2866 tools::Long nGrafAnchorCp, SwFrameFormat* pRetFrameFormat)
2867{
2868 rtl::Reference<SdrObject> pTrueObject = rRecord.pObj;
2869
2870 rtl::Reference<SdrTextObj> pSdrTextObj;
2871
2872 // check for group object (e.g. two parentheses)
2873 if (SdrObjGroup* pThisGroup = dynamic_cast<SdrObjGroup*>(rRecord.pObj.get()))
2874 {
2875 // Group objects don't have text. Insert a text object into
2876 // the group for holding the text.
2877 pSdrTextObj = new SdrRectObj(
2878 *m_pDrawModel,
2879 SdrObjKind::Text,
2880 pThisGroup->GetCurrentBoundRect());
2881
2883 aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
2884 aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
2885 aSet.Put(SdrTextFitToSizeTypeItem( drawing::TextFitToSizeType_NONE ));
2887 aSet.Put(makeSdrTextAutoGrowWidthItem(false));
2888 pSdrTextObj->SetMergedItemSet(aSet);
2889 pSdrTextObj->NbcSetLayer( pThisGroup->GetLayer() );
2890 pThisGroup->GetSubList()->NbcInsertObject(pSdrTextObj.get());
2891 }
2892 else
2893 pSdrTextObj = dynamic_cast<SdrTextObj*>(rRecord.pObj.get());
2894
2895 if( pSdrTextObj )
2896 {
2897 Size aObjSize(pSdrTextObj->GetSnapRect().GetWidth(),
2898 pSdrTextObj->GetSnapRect().GetHeight());
2899
2900 // Object is part of a group?
2901 SdrObject* pGroupObject = pSdrTextObj->getParentSdrObjectFromSdrObject();
2902
2903 const size_t nOrdNum = pSdrTextObj->GetOrdNum();
2904 bool bEraseThisObject;
2905 InsertTxbxText(pSdrTextObj.get(), &aObjSize, rRecord.aTextId.nTxBxS, rRecord.aTextId.nSequence,
2906 nGrafAnchorCp, pRetFrameFormat,
2907 (pSdrTextObj.get() != pTrueObject.get()) || (nullptr != pGroupObject), bEraseThisObject,
2908 nullptr, nullptr, nullptr, nullptr, &rRecord);
2909
2910 // was this object replaced ??
2911 if (bEraseThisObject)
2912 {
2913 if( pGroupObject || (pSdrTextObj.get() != pTrueObject.get()) )
2914 {
2915 // Object is already replaced by a new SdrGrafObj (in the group
2916 // and) the Drawing-Page.
2917
2918 SdrObject* pNewObj = pGroupObject ?
2919 pGroupObject->GetSubList()->GetObj(nOrdNum) : pTrueObject.get();
2920 if (pSdrTextObj.get() != pNewObj)
2921 {
2922 // Replace object in the Z-Order-List
2923 m_xMSDffManager->ExchangeInShapeOrder(pSdrTextObj.get(), 0, pNewObj);
2924 // and save the new object.
2925 rRecord.pObj = pNewObj;
2926 }
2927 }
2928 else
2929 {
2930 // remove the object from Z-Order list
2931 m_xMSDffManager->RemoveFromShapeOrder( pSdrTextObj.get() );
2932 // take the object from the drawing page
2933 if( pSdrTextObj->getSdrPageFromSdrObject() )
2934 m_pDrawPg->RemoveObject( pSdrTextObj->GetOrdNum() );
2935 // and delete FrameFormat, because replaced by graphic
2936 // (this also deletes the object)
2937 m_rDoc.DelFrameFormat( pRetFrameFormat );
2938 pRetFrameFormat = nullptr;
2939 // also delete the object record
2940 rRecord.pObj = nullptr;
2941 }
2942 }
2943 else
2944 {
2945 // use ww8-default border distance
2947 aItemSet(m_pDrawModel->GetItemPool());
2948 aItemSet.Put(makeSdrTextLeftDistItem(rRecord.nDxTextLeft));
2949 aItemSet.Put(makeSdrTextRightDistItem(rRecord.nDxTextRight));
2950 aItemSet.Put(makeSdrTextUpperDistItem(rRecord.nDyTextTop));
2951 aItemSet.Put(makeSdrTextLowerDistItem(rRecord.nDyTextBottom));
2952 pSdrTextObj->SetMergedItemSetAndBroadcast(aItemSet);
2953 }
2954 }
2955 return pRetFrameFormat;
2956}
2957
2959 rtl::Reference<SdrObject>& rpOurNewObject,
2960 const SvxMSDffImportRec& rRecord,
2961 RndStdIds eAnchor, const WW8_FSPA& rF,
2962 SfxItemSet &rFlySet)
2963{
2964 SwFlyFrameFormat* pRetFrameFormat = nullptr;
2965 tools::Long nStartCp;
2966 tools::Long nEndCp;
2967
2968 // Check if this textbox chain contains text as conversion of an empty
2969 // chain would not make sense.
2970 if (TxbxChainContainsRealText(rRecord.aTextId.nTxBxS, nStartCp, nEndCp))
2971 {
2972 // The Text is not read into SdrTextObj! Rather insert a frame and
2973 // insert the text from nStartCp to nEndCp.
2974
2975 // More attributes can be used in a frame compared to the
2976 // Edit-Engine, and it can contain field, OLEs or graphics...
2977 tools::Rectangle aInnerDist(rRecord.nDxTextLeft, rRecord.nDyTextTop, rRecord.nDxTextRight,
2978 rRecord.nDyTextBottom);
2979
2981 rF.nYaBottom - rF.nYaTop);
2984 rFlySet.Put(aFrameSize);
2985
2986 MatchSdrItemsIntoFlySet(rpObject.get(), rFlySet, rRecord.eLineStyle, rRecord.eLineDashing,
2987 rRecord.eShapeType, aInnerDist);
2988
2989 SdrTextObj *pSdrTextObj = dynamic_cast<SdrTextObj*>(rpObject.get());
2990 if (pSdrTextObj && pSdrTextObj->IsVerticalWriting())
2991 rFlySet.Put(SvxFrameDirectionItem(SvxFrameDirection::Vertical_RL_TB, RES_FRAMEDIR));
2992
2993 pRetFrameFormat = m_rDoc.MakeFlySection(eAnchor, m_pPaM->GetPoint(), &rFlySet);
2994 OSL_ENSURE(pRetFrameFormat->GetAnchor().GetAnchorId() == eAnchor,
2995 "Not the anchor type requested!");
2996
2997 // if everything is OK, find pointer on new object and correct
2998 // Z-order list (or delete entry)
2999 rpOurNewObject = CreateContactObject(pRetFrameFormat);
3000
3001 // remove old object from the Z-Order list
3002 m_xMSDffManager->RemoveFromShapeOrder( rpObject.get() );
3003
3004 // and delete the object
3005 rpObject.clear();
3006 /*
3007 NB: only query pOrgShapeObject starting here!
3008 */
3009
3010 if (rpOurNewObject)
3011 {
3012 /*
3013 We do not store our rpOutNewObject in the ShapeOrder because we
3014 have a FrameFormat from which we can regenerate the contact object when
3015 we need it. Because, we can have frames anchored to paragraphs in
3016 header/footers and we can copy header/footers, if we do copy a
3017 header/footer with a nonpage anchored frame in it then the contact
3018 objects are invalidated. Under this condition the FrameFormat will be
3019 updated to reflect this change and can be used to get a new
3020 contact object, while a raw rpOutNewObject stored here becomes
3021 deleted and useless.
3022 */
3023 m_xMSDffManager->StoreShapeOrder(rF.nSpId,
3024 (static_cast<sal_uLong>(rRecord.aTextId.nTxBxS) << 16) +
3025 rRecord.aTextId.nSequence, nullptr, pRetFrameFormat);
3026
3027 // The Contact object has to be inserted into the draw page, so
3028 // SwWW8ImplReader::LoadDoc1() can determine the z-order.
3029 if (!rpOurNewObject->IsInserted())
3030 {
3031 // pass information, if object is in page header|footer to method.
3032 m_xWWZOrder->InsertEscherObject(rpOurNewObject.get(), rF.nSpId, rRecord.bDrawHell,
3034 }
3035 }
3036
3037 // Box-0 receives the text for the whole chain!
3038 if (!rRecord.aTextId.nSequence)
3039 {
3040 // save flags etc and reset them
3041 WW8ReaderSave aSave( this );
3042
3043 MoveInsideFly(pRetFrameFormat);
3044
3045 m_xWWZOrder->InsideEscher(rF.nSpId);
3046
3047 // read in the text
3048 m_bTxbxFlySection = true;
3049 bool bJoined = ReadText(nStartCp, (nEndCp-nStartCp),
3050 MAN_MAINTEXT == m_xPlcxMan->GetManType() ?
3052
3053 m_xWWZOrder->OutsideEscher();
3054
3055 MoveOutsideFly(pRetFrameFormat, aSave.GetStartPos(),!bJoined);
3056
3057 aSave.Restore( this );
3058
3059 StripNegativeAfterIndent(pRetFrameFormat);
3060 }
3061
3062 }
3063 return pRetFrameFormat;
3064}
3065
3067{
3068 if (rRecord.bVFlip || rRecord.bHFlip)
3069 {
3071 if (rRecord.bVFlip && rRecord.bHFlip)
3073 else if (rRecord.bVFlip)
3075 else
3077 rFlySet.Put( SwMirrorGrf(eType) );
3078 }
3079}
3080
3082 rtl::Reference<SdrObject> &rpOurNewObject,
3083 SvxMSDffImportRec& rRecord,
3084 WW8_FSPA& rF,
3085 SfxItemSet &rFlySet )
3086{
3087 SwFlyFrameFormat* pRetFrameFormat = nullptr;
3088 sal_Int32 nWidthTw = o3tl::saturating_sub(rF.nXaRight, rF.nXaLeft);
3089 if (0 > nWidthTw)
3090 nWidthTw = 0;
3091 sal_Int32 nHeightTw = o3tl::saturating_sub(rF.nYaBottom, rF.nYaTop);
3092 if (0 > nHeightTw)
3093 nHeightTw = 0;
3094
3095 ProcessEscherAlign(rRecord, rF, rFlySet);
3096
3097 rFlySet.Put(SwFormatFrameSize(SwFrameSize::Fixed, nWidthTw, nHeightTw));
3098
3100
3101 // Note that the escher inner distance only seems to be honoured in
3102 // word for textboxes, not for graphics and ole objects.
3103 tools::Rectangle aInnerDist(0, 0, 0, 0);
3104
3105 MatchSdrItemsIntoFlySet(rpObject.get(), rFlySet, rRecord.eLineStyle, rRecord.eLineDashing,
3106 rRecord.eShapeType, aInnerDist);
3107
3108 MatchEscherMirrorIntoFlySet(rRecord, aGrSet);
3109
3110 OUString aObjectName(rpObject->GetName());
3111 if (SdrObjKind::OLE2 == rpObject->GetObjIdentifier())
3112 pRetFrameFormat = InsertOle(*static_cast<SdrOle2Obj*>(rpObject.get()), rFlySet, &aGrSet);
3113 else
3114 {
3115 const SdrGrafObj *pGrf = static_cast<const SdrGrafObj*>(rpObject.get());
3116 bool bDone = false;
3117 if (pGrf->IsLinkedGraphic() && !pGrf->GetFileName().isEmpty())
3118 {
3120 OUString aGrfName(
3124 // correction of fix for issue #i10939#:
3125 // One of the two conditions have to be true to insert the graphic
3126 // as a linked graphic -
3127 if (GraphicType::NONE == eType || CanUseRemoteLink(aGrfName))
3128 {
3130 *m_pPaM, aGrfName, OUString(), nullptr,
3131 &rFlySet, &aGrSet, nullptr);
3132 bDone = true;
3133 }
3134 }
3135 if (!bDone)
3136 {
3137 const Graphic& rGraph = pGrf->GetGraphic();
3139 *m_pPaM, OUString(), OUString(), &rGraph,
3140 &rFlySet, &aGrSet, nullptr);
3141 }
3142 }
3143
3144 if (pRetFrameFormat)
3145 {
3146 if (SdrObjKind::OLE2 != rpObject->GetObjIdentifier())
3147 SetAttributesAtGrfNode(rRecord, *pRetFrameFormat, &rF);
3148 // avoid multiple occurrences of the same graphic name
3149 m_aGrfNameGenerator.SetUniqueGraphName(pRetFrameFormat, aObjectName);
3150 }
3151 // if everything is OK, determine pointer to new object and correct
3152 // Z-Order-List accordingly (or delete entry)
3153 rpOurNewObject = CreateContactObject(pRetFrameFormat);
3154
3155 // remove old object from Z-Order-List
3156 m_xMSDffManager->RemoveFromShapeOrder( rpObject.get() );
3157 // remove from Drawing-Page
3158 if( rpObject->getSdrPageFromSdrObject() )
3159 m_pDrawPg->RemoveObject( rpObject->GetOrdNum() );
3160
3161 // and delete the object
3162 rpObject.clear();
3163
3164 /*
3165 Warning: from now on query only pOrgShapeObject!
3166 */
3167
3168 // add Contact-Object to the Z-Order-List and the page
3169 if (rpOurNewObject)
3170 {
3171 if (!m_bHdFtFootnoteEdn)
3172 m_xMSDffManager->StoreShapeOrder(rF.nSpId, 0, rpOurNewObject.get());
3173
3174 // The Contact-Object MUST be set in the Draw-Page, so that in
3175 // SwWW8ImplReader::LoadDoc1() the Z-Order can be defined !!!
3176 if (!rpOurNewObject->IsInserted())
3177 {
3178 // pass information, if object is in page header|footer to method.
3179 m_xWWZOrder->InsertEscherObject(rpOurNewObject.get(), rF.nSpId, rRecord.bDrawHell,
3181 }
3182 }
3183 return pRetFrameFormat;
3184}
3185
3186void SwWW8ImplReader::GraphicCtor() // For SVDraw and VCControls and Escher
3187{
3188 if (m_pDrawModel)
3189 return;
3190
3191 m_rDoc.getIDocumentDrawModelAccess().GetOrCreateDrawModel(); // #i52858# - method name changed
3193 OSL_ENSURE(m_pDrawModel, "Cannot create DrawModel");
3195
3196 m_xMSDffManager.reset(new SwMSDffManager(*this, m_bSkipImages));
3197 m_xMSDffManager->SetModel(m_pDrawModel, 1440);
3198 /*
3199 Now the dff manager always needs a controls converter as well, but a
3200 control converter may still exist without a dffmanager.
3201 */
3203
3205 m_xMSDffManager->GetShapeOrders()));
3206}
3207
3209{
3210 m_pDrawEditEngine.reset(); // maybe created by graphic
3211 m_xWWZOrder.reset(); // same
3212}
3213
3215{
3216 OSL_ENSURE(pFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR,
3217 "Don't use fltanchors with inline frames, slap!");
3218 NewAttr(rPos, SwFltAnchor(pFormat));
3219}
3220
3222{
3223 size_t nCnt = size();
3224 for (size_t i=0; i < nCnt; ++i)
3225 {
3226 SwFltStackEntry &rEntry = (*this)[i];
3227 SwPosition aDummy(rEntry.m_aMkPos.m_nNode);
3228 SetAttrInDoc(aDummy, rEntry);
3230 --nCnt;
3231 }
3232}
3233
3234/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxBorderLineStyle
SvxBoxItemLine
GPOS_TILED
GPOS_AREA
sal_uInt8 GetBlue() const
void SetGreen(sal_uInt8 nGreen)
void SetRed(sal_uInt8 nRed)
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
void SetAlpha(sal_uInt8 nAlpha)
void SetBlue(sal_uInt8 nBlue)
sal_Int32 GetParagraphCount() const
void QuickDelete(const ESelection &rSel)
sal_Int32 GetTextLen() const
void SetAlpha(sal_uInt8 cAlpha)
const GraphicAttr & GetAttr() const
void SetAttr(const GraphicAttr &rAttr)
virtual SwDrawFrameFormat * InsertDrawObj(const SwPaM &rRg, SdrObject &rDrawObj, const SfxItemSet &rFlyAttrSet)=0
Insert a DrawObject.
virtual SwFlyFrameFormat * InsertGraphic(const SwPaM &rRg, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *)=0
Insert graphic or formula.
virtual SwDrawModel * GetOrCreateDrawModel()=0
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
void SetOutlinerMode(OutlinerMode nNew)
void SetVertical(bool bNew)
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
Definition: shellio.cxx:609
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
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:742
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:316
SwNodes & GetNodes()
Definition: doc.hxx:413
OUString GetUniqueDrawObjectName() const
Definition: doclay.cxx:1383
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:696
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1322
OUString GetUniqueFrameName() const
Definition: doclay.cxx:1373
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:156
void SetDocShell(SwDocShell *pDSh)
Definition: docnew.cxx:611
SwDocShell * GetDocShell()
Definition: doc.hxx:1355
void PosAttrSet()
Definition: frmfmt.hxx:427
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:176
virtual const SdrObject * GetMaster() const override
Definition: dcontact.hxx:192
FlyAnchors.
Definition: fmtanchr.hxx:37
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1586
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
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:93
void SetPosToggle(bool bNew)
Definition: fmtornt.hxx:96
SwTwips GetPos() const
Definition: fmtornt.hxx:92
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
SwTwips GetPos() const
Definition: fmtornt.hxx:59
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:60
const OUString & GetName() const
Definition: format.hxx:131
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:387
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:83
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:449
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
Style of a layout element.
Definition: frmfmt.hxx:62
virtual void SetFormatName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2568
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2771
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:141
virtual Size GetTwipSize() const override
Definition: ndgrf.cxx:432
static sal_Int32 GetEscherLineMatch(MSO_LineStyle eStyle, MSO_SPT eShapeType, sal_Int32 &rThick)
Definition: ww8graf.cxx:1539
const OUString & GetHlink() const
Definition: ww8par.hxx:513
const OUString & GetTarFrame() const
Definition: ww8par.hxx:515
const OUString & GetName() const
Definition: ww8par.hxx:519
const sal_Int32 & GetShapeId() const
Definition: ww8par.hxx:517
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:171
const SwPosition * GetPoint() const
Definition: pam.hxx:261
void AddAnchor(const SwPosition &rPos, SwFrameFormat *pFormat)
Definition: ww8graf.cxx:3214
bool ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType)
Definition: ww8par.cxx:4057
SwPaM * m_pPaM
Definition: ww8par.hxx:1129
RndStdIds ProcessEscherAlign(SvxMSDffImportRec &rRecord, WW8_FSPA &rFSPA, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:2259
SwDocShell * m_pDocShell
Definition: ww8par.hxx:1106
rtl::Reference< SdrObject > ReadGroup(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1358
void GraphicDtor()
Definition: ww8graf.cxx:3208
rtl::Reference< SdrObject > ReadPolyLine(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:430
bool m_bDrawCpOValid
Definition: ww8par.hxx:1310
static void StripNegativeAfterIndent(SwFrameFormat const *pFlyFormat)
Definition: ww8par6.cxx:2608
bool IsObjectLayoutInTableCell(const sal_uInt32 nGroupShapeBooleanProperties) const
Definition: ww8graf.cxx:2460
OUString m_sBaseURL
Definition: ww8par.hxx:1300
std::unique_ptr< SwMSConvertControls > m_xFormImpl
Definition: ww8par.hxx:1231
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:3081
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:2128
std::unique_ptr< SwWW8FltControlStack > m_xCtrlStck
Definition: ww8par.hxx:1131
SwDoc & m_rDoc
Definition: ww8par.hxx:1127
SwFlyFrameFormat * ConvertDrawTextToFly(rtl::Reference< SdrObject > &rpObject, rtl::Reference< SdrObject > &rpOurNewObject, const SvxMSDffImportRec &rRecord, RndStdIds eAnchor, const WW8_FSPA &rF, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:2958
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:775
sal_uInt16 End_Field()
Definition: ww8par5.cxx:506
SvStream * m_pStrm
Definition: ww8par.hxx:1122
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:1329
SwTwips MoveOutsideFly(SwFrameFormat *pFlyFormat, const SwPosition &rPos, bool bTableJoin=true)
Definition: ww8par6.cxx:2332
std::shared_ptr< WW8Fib > m_xWwFib
Definition: ww8par.hxx:1253
rtl::Reference< SdrObject > ReadRect(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:346
wwSectionManager m_aSectionManager
Definition: ww8par.hxx:1184
SwFrameFormat * ImportGraf(SdrTextObj const *pTextObj=nullptr, SwFrameFormat const *pFlyFormat=nullptr)
Definition: ww8graf2.cxx:472
bool m_bSkipImages
Definition: ww8par.hxx:1342
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:1323
rtl::Reference< SdrObject > ReadEllipse(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:369
std::unique_ptr< EditEngine > m_pDrawEditEngine
Definition: ww8par.hxx:1287
bool m_bHdFtFootnoteEdn
Definition: ww8par.hxx:1358
bool m_bTxbxFlySection
Definition: ww8par.hxx:1347
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:1286
bool GetTxbxTextSttEndCp(WW8_CP &rStartCp, WW8_CP &rEndCp, sal_uInt16 nTxBxS, sal_uInt16 nSequence)
Definition: ww8graf.cxx:806
rtl_TextEncoding GetCurrentCharSet()
Definition: ww8par.cxx:2861
SdrModel * m_pDrawModel
Definition: ww8par.hxx:1285
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:1258
rtl::Reference< SdrObject > ReadTextBox(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:1249
void EndSprm(sal_uInt16 nId)
Definition: ww8par6.cxx:6178
std::unique_ptr< SwMSDffManager > m_xMSDffManager
Definition: ww8par.hxx:1292
short m_nDrawXOfs2
Definition: ww8par.hxx:1330
sal_uInt32 m_nIniFlags1
Definition: ww8par.hxx:1304
bool IsInlineEscherHack() const
Definition: ww8par.hxx:1719
std::deque< WW8FieldEntry > m_aFieldStack
Definition: ww8par.hxx:1172
SwFrameFormat * MungeTextIntoDrawBox(SvxMSDffImportRec &rRecord, tools::Long nGrafAnchorCp, SwFrameFormat *pRetFrameFormat)
Definition: ww8graf.cxx:2865
void MoveInsideFly(const SwFrameFormat *pFlyFormat)
Definition: ww8par6.cxx:2318
void Read_Obj(sal_uInt16, const sal_uInt8 *, short nLen)
Definition: ww8par6.cxx:2888
std::unique_ptr< wwSprmParser > m_xSprmParser
Definition: ww8par.hxx:1207
wwFrameNamer m_aGrfNameGenerator
Definition: ww8par.hxx:1212
void GraphicCtor()
Definition: ww8graf.cxx:3186
std::unique_ptr< wwZOrderer > m_xWWZOrder
Definition: ww8par.hxx:1288
bool IsRightToLeft()
Definition: ww8par6.cxx:4635
void Read_PicLoc(sal_uInt16, const sal_uInt8 *pData, short nLen)
Definition: ww8par6.cxx:2911
rtl::Reference< SdrObject > ReadArc(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:393
std::set< sal_uLong > m_aGrafPosSet
Definition: ww8par.hxx:1249
SdrObject * CreateContactObject(SwFrameFormat *pFlyFormat)
Definition: ww8graf.cxx:2229
void InsertTxbxStyAttrs(SfxItemSet &rS, sal_uInt16 nColl)
Definition: ww8graf.cxx:497
sal_uInt16 m_nProgress
Definition: ww8par.hxx:1322
std::unique_ptr< WW8ScannerBase > m_xSBase
Definition: ww8par.hxx:1257
friend class SwMSDffManager
Definition: ww8par.hxx:1114
std::unique_ptr< SwWW8FltAnchorStack > m_xAnchorStck
Definition: ww8par.hxx:1160
WW8_CP m_nDrawCpO
Definition: ww8par.hxx:1311
SwFrameFormat * AddAutoAnchor(SwFrameFormat *pFormat)
Definition: ww8graf.cxx:2850
static void AdjustLRWrapForWordMargins(const SvxMSDffImportRec &rRecord, SvxLRSpaceItem &rLR)
Definition: ww8graf.cxx:1940
short m_nDrawYOfs
Definition: ww8par.hxx:1329
rtl::Reference< SdrObject > ReadLine(WW8_DPHEAD const *pHd, SfxAllItemSet &rSet)
Definition: ww8graf.cxx:311
sal_uInt32 m_nIniFlags
Definition: ww8par.hxx:1303
bool MiserableRTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, sal_Int16 eHoriOri, sal_Int16 eHoriRel)
Definition: ww8graf.cxx:2248
SwWW8StyInf * GetStyle(sal_uInt16 nColl) const
Definition: ww8par6.cxx:3003
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:2510
short m_nDrawYOfs2
Definition: ww8par.hxx:1330
short ImportSprm(const sal_uInt8 *pPos, sal_Int32 nMemLen, sal_uInt16 nId=0)
Definition: ww8par6.cxx:6188
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:1332
bool TxbxChainContainsRealText(sal_uInt16 nTxBxS, tools::Long &rStartCp, tools::Long &rEndCp)
Definition: ww8graf.cxx:1239
bool m_bColl
Definition: ww8par.hxx:255
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:2054
const SwPosition & GetStartPos() const
Definition: ww8par.hxx:616
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:966
sal_Int32 mnImportedGraphicsCount
Definition: ww8par.hxx:967
bool mbIsDisabled
Definition: ww8par.hxx:968
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(120)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN)
constexpr sal_uInt16 RES_FRMATR_END(133)
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(103)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_HIGHLIGHT(42)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
constexpr sal_uInt16 RES_GRFATR_END(150)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr sal_uInt16 RES_FLTRATTR_BEGIN(RES_MSG_END)
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
#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
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:37
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:910
sal_uInt16 nby
Definition: ww8struc.hxx:919
@ RelPageBorder
Definition: ww8struc.hxx:950
sal_Int32 nXaRight
Definition: ww8struc.hxx:909
sal_Int32 nXaLeft
Definition: ww8struc.hxx:907
sal_Int32 nSpId
Definition: ww8struc.hxx:906
sal_uInt16 nwrk
Definition: ww8struc.hxx:933
sal_Int32 nYaTop
Definition: ww8struc.hxx:908
sal_uInt16 bRcaSimple
Definition: ww8struc.hxx:939
sal_uInt16 nbx
Definition: ww8struc.hxx:913
sal_uInt16 nwr
Definition: ww8struc.hxx:924
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)
SvxShadowLocation
RndStdIds
tools::Long SwTwips
Definition: swtypes.hxx:51
constexpr SwTwips MIN_BORDER_DIST
Definition: swtypes.hxx:70
SdrCaptionType
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, SwTwips nPageRight, SwTwips nPageSize)
Definition: wrtw8esh.cxx:525
static ESelection GetESelection(EditEngine const &rDrawEditEngine, tools::Long nCpStart, tools::Long nCpEnd)
Definition: ww8graf.cxx:468
static void SetStdAttr(SfxItemSet &rSet, WW8_DP_LINETYPE &rL, WW8_DP_SHADOW const &rSh)
Definition: ww8graf.cxx:200
static void SetLineEndAttr(SfxItemSet &rSet, WW8_DP_LINEEND const &rLe, WW8_DP_LINETYPE const &rLt)
Definition: ww8graf.cxx:275
static sal_Int32 lcl_ConvertCrop(sal_uInt32 const nCrop, sal_Int32 const nSize)
Definition: ww8graf.cxx:2115
void MatchEscherMirrorIntoFlySet(const SvxMSDffImportRec &rRecord, SfxItemSet &rFlySet)
Definition: ww8graf.cxx:3066
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:2418
#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)