LibreOffice Module vcl (master) 1
SvmWriter.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
22#include <vcl/dibtools.hxx>
23
24#include <tools/vcompat.hxx>
25
26#include <osl/thread.h>
27
29 : mrStream(rIStm)
30{
31}
32
34{
35 mrStream.WriteUInt32(static_cast<sal_uInt32>(aColor));
36}
37
39{
40 const SvStreamCompressFlags nStmCompressMode = mrStream.GetCompressMode();
41 SvStreamEndian nOldFormat = mrStream.GetEndian();
42
43 mrStream.SetEndian(SvStreamEndian::LITTLE);
44 mrStream.WriteBytes("VCLMTF", 6);
45
46 {
47 VersionCompatWrite aCompat(mrStream, 1);
48
49 mrStream.WriteUInt32(static_cast<sal_uInt32>(nStmCompressMode));
50 TypeSerializer aSerializer(mrStream);
51 aSerializer.writeMapMode(rMetaFile.GetPrefMapMode());
52 aSerializer.writeSize(rMetaFile.GetPrefSize());
54 } // VersionCompatWrite dtor writes stuff into the header
55
56 ImplMetaWriteData aWriteData;
57
59
60 MetaAction* pAct = const_cast<GDIMetaFile&>(rMetaFile).FirstAction();
61 while (pAct)
62 {
63 MetaActionHandler(pAct, &aWriteData);
64 pAct = const_cast<GDIMetaFile&>(rMetaFile).NextAction();
65 }
66
67 mrStream.SetEndian(nOldFormat);
68
69 return mrStream;
70}
71
73{
74 SvMemoryStream aMemStm(65535, 65535);
75 ImplMetaWriteData aWriteData;
76 SVBT16 aBT16;
77 SVBT32 aBT32;
79 BitmapChecksum nCrc = 0;
80
81 aWriteData.meActualCharSet = aMemStm.GetStreamCharSet();
82
83 for (size_t i = 0, nObjCount = rMetaFile.GetActionSize(); i < nObjCount; i++)
84 {
85 MetaAction* pAction = rMetaFile.GetAction(i);
86
87 switch (pAction->GetType())
88 {
90 {
91 MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction);
92
93 ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
94 nCrc = vcl_get_checksum(nCrc, aBT16, 2);
95
96 BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
97 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
98
99 Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
100 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
101
102 Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
103 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
104 }
105 break;
106
108 {
109 MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
110
111 ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
112 nCrc = vcl_get_checksum(nCrc, aBT16, 2);
113
114 BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
115 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
116
117 Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
118 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
119
120 Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
121 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
122
123 Int32ToSVBT32(pAct->GetSize().Width(), aBT32);
124 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
125
126 Int32ToSVBT32(pAct->GetSize().Height(), aBT32);
127 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
128 }
129 break;
130
132 {
133 MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
134
135 ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
136 nCrc = vcl_get_checksum(nCrc, aBT16, 2);
137
138 BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
139 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
140
141 Int32ToSVBT32(pAct->GetDestPoint().X(), aBT32);
142 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
143
144 Int32ToSVBT32(pAct->GetDestPoint().Y(), aBT32);
145 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
146
147 Int32ToSVBT32(pAct->GetDestSize().Width(), aBT32);
148 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
149
150 Int32ToSVBT32(pAct->GetDestSize().Height(), aBT32);
151 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
152
153 Int32ToSVBT32(pAct->GetSrcPoint().X(), aBT32);
154 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
155
156 Int32ToSVBT32(pAct->GetSrcPoint().Y(), aBT32);
157 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
158
159 Int32ToSVBT32(pAct->GetSrcSize().Width(), aBT32);
160 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
161
162 Int32ToSVBT32(pAct->GetSrcSize().Height(), aBT32);
163 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
164 }
165 break;
166
168 {
169 MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction);
170
171 ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
172 nCrc = vcl_get_checksum(nCrc, aBT16, 2);
173
174 BCToBCOA(pAct->GetBitmapEx().GetChecksum(), aBCOA);
175 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
176
177 Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
178 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
179
180 Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
181 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
182 }
183 break;
184
186 {
187 MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
188
189 ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
190 nCrc = vcl_get_checksum(nCrc, aBT16, 2);
191
192 BCToBCOA(pAct->GetBitmapEx().GetChecksum(), aBCOA);
193 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
194
195 Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
196 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
197
198 Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
199 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
200
201 Int32ToSVBT32(pAct->GetSize().Width(), aBT32);
202 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
203
204 Int32ToSVBT32(pAct->GetSize().Height(), aBT32);
205 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
206 }
207 break;
208
210 {
211 MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
212
213 ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
214 nCrc = vcl_get_checksum(nCrc, aBT16, 2);
215
216 BCToBCOA(pAct->GetBitmapEx().GetChecksum(), aBCOA);
217 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
218
219 Int32ToSVBT32(pAct->GetDestPoint().X(), aBT32);
220 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
221
222 Int32ToSVBT32(pAct->GetDestPoint().Y(), aBT32);
223 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
224
225 Int32ToSVBT32(pAct->GetDestSize().Width(), aBT32);
226 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
227
228 Int32ToSVBT32(pAct->GetDestSize().Height(), aBT32);
229 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
230
231 Int32ToSVBT32(pAct->GetSrcPoint().X(), aBT32);
232 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
233
234 Int32ToSVBT32(pAct->GetSrcPoint().Y(), aBT32);
235 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
236
237 Int32ToSVBT32(pAct->GetSrcSize().Width(), aBT32);
238 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
239
240 Int32ToSVBT32(pAct->GetSrcSize().Height(), aBT32);
241 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
242 }
243 break;
244
246 {
247 MetaMaskAction* pAct = static_cast<MetaMaskAction*>(pAction);
248
249 ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
250 nCrc = vcl_get_checksum(nCrc, aBT16, 2);
251
252 BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
253 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
254
255 UInt32ToSVBT32(sal_uInt32(pAct->GetColor()), aBT32);
256 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
257
258 Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
259 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
260
261 Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
262 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
263 }
264 break;
265
267 {
268 MetaMaskScaleAction* pAct = static_cast<MetaMaskScaleAction*>(pAction);
269
270 ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
271 nCrc = vcl_get_checksum(nCrc, aBT16, 2);
272
273 BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
274 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
275
276 UInt32ToSVBT32(sal_uInt32(pAct->GetColor()), aBT32);
277 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
278
279 Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
280 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
281
282 Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
283 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
284
285 Int32ToSVBT32(pAct->GetSize().Width(), aBT32);
286 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
287
288 Int32ToSVBT32(pAct->GetSize().Height(), aBT32);
289 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
290 }
291 break;
292
294 {
295 MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction);
296
297 ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
298 nCrc = vcl_get_checksum(nCrc, aBT16, 2);
299
300 BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
301 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
302
303 UInt32ToSVBT32(sal_uInt32(pAct->GetColor()), aBT32);
304 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
305
306 Int32ToSVBT32(pAct->GetDestPoint().X(), aBT32);
307 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
308
309 Int32ToSVBT32(pAct->GetDestPoint().Y(), aBT32);
310 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
311
312 Int32ToSVBT32(pAct->GetDestSize().Width(), aBT32);
313 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
314
315 Int32ToSVBT32(pAct->GetDestSize().Height(), aBT32);
316 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
317
318 Int32ToSVBT32(pAct->GetSrcPoint().X(), aBT32);
319 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
320
321 Int32ToSVBT32(pAct->GetSrcPoint().Y(), aBT32);
322 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
323
324 Int32ToSVBT32(pAct->GetSrcSize().Width(), aBT32);
325 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
326
327 Int32ToSVBT32(pAct->GetSrcSize().Height(), aBT32);
328 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
329 }
330 break;
331
333 {
334 MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction);
335 nCrc = vcl_get_checksum(nCrc, pAct->GetLink().GetData(),
336 pAct->GetLink().GetDataSize());
337 }
338 break;
339
341 {
342 MetaClipRegionAction& rAct = static_cast<MetaClipRegionAction&>(*pAction);
343 const vcl::Region& rRegion = rAct.GetRegion();
344
345 if (rRegion.HasPolyPolygonOrB2DPolyPolygon())
346 {
347 // It has shown that this is a possible bottleneck for checksum calculation.
348 // In worst case a very expensive RegionHandle representation gets created.
349 // In this case it's cheaper to use the PolyPolygon
350 const basegfx::B2DPolyPolygon aPolyPolygon(rRegion.GetAsB2DPolyPolygon());
351 SVBT64 aSVBT64;
352
353 for (auto const& rPolygon : aPolyPolygon)
354 {
355 const sal_uInt32 nPointCount(rPolygon.count());
356 const bool bControl(rPolygon.areControlPointsUsed());
357
358 for (sal_uInt32 b(0); b < nPointCount; b++)
359 {
360 const basegfx::B2DPoint aPoint(rPolygon.getB2DPoint(b));
361
362 DoubleToSVBT64(aPoint.getX(), aSVBT64);
363 nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
364 DoubleToSVBT64(aPoint.getY(), aSVBT64);
365 nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
366
367 if (bControl)
368 {
369 if (rPolygon.isPrevControlPointUsed(b))
370 {
371 const basegfx::B2DPoint aCtrl(rPolygon.getPrevControlPoint(b));
372
373 DoubleToSVBT64(aCtrl.getX(), aSVBT64);
374 nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
375 DoubleToSVBT64(aCtrl.getY(), aSVBT64);
376 nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
377 }
378
379 if (rPolygon.isNextControlPointUsed(b))
380 {
381 const basegfx::B2DPoint aCtrl(rPolygon.getNextControlPoint(b));
382
383 DoubleToSVBT64(aCtrl.getX(), aSVBT64);
384 nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
385 DoubleToSVBT64(aCtrl.getY(), aSVBT64);
386 nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
387 }
388 }
389 }
390 }
391
392 sal_uInt8 tmp = static_cast<sal_uInt8>(rAct.IsClipping());
393 nCrc = vcl_get_checksum(nCrc, &tmp, 1);
394 }
395 else
396 {
397 SvmWriter aWriter(aMemStm);
398 aWriter.MetaActionHandler(pAction, &aWriteData);
399 nCrc = vcl_get_checksum(nCrc, aMemStm.GetData(), aMemStm.Tell());
400 aMemStm.Seek(0);
401 }
402 }
403 break;
404
405 default:
406 {
407 SvmWriter aWriter(aMemStm);
408 aWriter.MetaActionHandler(pAction, &aWriteData);
409 nCrc = vcl_get_checksum(nCrc, aMemStm.GetData(), aMemStm.Tell());
410 aMemStm.Seek(0);
411 }
412 break;
413 }
414 }
415
416 return nCrc;
417}
418
420{
421 MetaActionType nType = pAction->GetType();
422
423 switch (nType)
424 {
426 {
427 ActionHandler(pAction);
428 }
429 break;
430
432 {
433 auto* pMetaAction = static_cast<MetaPixelAction*>(pAction);
434 PixelHandler(pMetaAction);
435 }
436 break;
437
439 {
440 auto pMetaAction = static_cast<MetaPointAction*>(pAction);
441 PointHandler(pMetaAction);
442 }
443 break;
444
446 {
447 auto* pMetaAction = static_cast<MetaLineAction*>(pAction);
448 LineHandler(pMetaAction);
449 }
450 break;
451
453 {
454 auto* pMetaAction = static_cast<MetaRectAction*>(pAction);
455 RectHandler(pMetaAction);
456 }
457 break;
458
460 {
461 auto* pMetaAction = static_cast<MetaRoundRectAction*>(pAction);
462 RoundRectHandler(pMetaAction);
463 }
464 break;
465
467 {
468 auto* pMetaAction = static_cast<MetaEllipseAction*>(pAction);
469 EllipseHandler(pMetaAction);
470 }
471 break;
472
474 {
475 auto* pMetaAction = static_cast<MetaArcAction*>(pAction);
476 ArcHandler(pMetaAction);
477 }
478 break;
479
481 {
482 auto* pMetaAction = static_cast<MetaPieAction*>(pAction);
483 PieHandler(pMetaAction);
484 }
485 break;
486
488 {
489 auto* pMetaAction = static_cast<MetaChordAction*>(pAction);
490 ChordHandler(pMetaAction);
491 }
492 break;
493
495 {
496 auto* pMetaAction = static_cast<MetaPolyLineAction*>(pAction);
497 PolyLineHandler(pMetaAction);
498 }
499 break;
500
502 {
503 auto* pMetaAction = static_cast<MetaPolygonAction*>(pAction);
504 PolygonHandler(pMetaAction);
505 }
506 break;
507
509 {
510 auto* pMetaAction = static_cast<MetaPolyPolygonAction*>(pAction);
511 PolyPolygonHandler(pMetaAction);
512 }
513 break;
514
516 {
517 auto* pMetaAction = static_cast<MetaTextAction*>(pAction);
518 TextHandler(pMetaAction, pData);
519 }
520 break;
521
523 {
524 auto* pMetaAction = static_cast<MetaTextArrayAction*>(pAction);
525 TextArrayHandler(pMetaAction, pData);
526 }
527 break;
528
530 {
531 auto* pMetaAction = static_cast<MetaStretchTextAction*>(pAction);
532 StretchTextHandler(pMetaAction, pData);
533 }
534 break;
535
537 {
538 auto* pMetaAction = static_cast<MetaTextRectAction*>(pAction);
539 TextRectHandler(pMetaAction, pData);
540 }
541 break;
542
544 {
545 auto* pMetaAction = static_cast<MetaTextLineAction*>(pAction);
546 TextLineHandler(pMetaAction);
547 }
548 break;
549
551 {
552 auto* pMetaAction = static_cast<MetaBmpAction*>(pAction);
553 BmpHandler(pMetaAction);
554 }
555 break;
556
558 {
559 auto* pMetaAction = static_cast<MetaBmpScaleAction*>(pAction);
560 BmpScaleHandler(pMetaAction);
561 }
562 break;
563
565 {
566 auto* pMetaAction = static_cast<MetaBmpScalePartAction*>(pAction);
567 BmpScalePartHandler(pMetaAction);
568 }
569 break;
570
572 {
573 auto* pMetaAction = static_cast<MetaBmpExAction*>(pAction);
574 BmpExHandler(pMetaAction);
575 }
576 break;
577
579 {
580 auto* pMetaAction = static_cast<MetaBmpExScaleAction*>(pAction);
581 BmpExScaleHandler(pMetaAction);
582 }
583 break;
584
586 {
587 auto* pMetaAction = static_cast<MetaBmpExScalePartAction*>(pAction);
588 BmpExScalePartHandler(pMetaAction);
589 }
590 break;
591
593 {
594 auto* pMetaAction = static_cast<MetaMaskAction*>(pAction);
595 MaskHandler(pMetaAction);
596 }
597 break;
598
600 {
601 auto* pMetaAction = static_cast<MetaMaskScaleAction*>(pAction);
602 MaskScaleHandler(pMetaAction);
603 }
604 break;
605
607 {
608 auto* pMetaAction = static_cast<MetaMaskScalePartAction*>(pAction);
609 MaskScalePartHandler(pMetaAction);
610 }
611 break;
612
614 {
615 auto* pMetaAction = static_cast<MetaGradientAction*>(pAction);
616 GradientHandler(pMetaAction);
617 }
618 break;
619
621 {
622 auto* pMetaAction = static_cast<MetaGradientExAction*>(pAction);
623 GradientExHandler(pMetaAction);
624 }
625 break;
626
628 {
629 auto* pMetaAction = static_cast<MetaHatchAction*>(pAction);
630 HatchHandler(pMetaAction);
631 }
632 break;
633
635 {
636 auto* pMetaAction = static_cast<MetaWallpaperAction*>(pAction);
637 WallpaperHandler(pMetaAction);
638 }
639 break;
640
642 {
643 auto* pMetaAction = static_cast<MetaClipRegionAction*>(pAction);
644 ClipRegionHandler(pMetaAction);
645 }
646 break;
647
649 {
650 auto* pMetaAction = static_cast<MetaISectRectClipRegionAction*>(pAction);
651 ISectRectClipRegionHandler(pMetaAction);
652 }
653 break;
654
656 {
657 auto* pMetaAction = static_cast<MetaISectRegionClipRegionAction*>(pAction);
658 ISectRegionClipRegionHandler(pMetaAction);
659 }
660 break;
661
663 {
664 auto* pMetaAction = static_cast<MetaMoveClipRegionAction*>(pAction);
665 MoveClipRegionHandler(pMetaAction);
666 }
667 break;
668
670 {
671 auto* pMetaAction = static_cast<MetaLineColorAction*>(pAction);
672 LineColorHandler(pMetaAction);
673 }
674 break;
675
677 {
678 auto* pMetaAction = static_cast<MetaFillColorAction*>(pAction);
679 FillColorHandler(pMetaAction);
680 }
681 break;
682
684 {
685 auto* pMetaAction = static_cast<MetaTextColorAction*>(pAction);
686 TextColorHandler(pMetaAction);
687 }
688 break;
689
691 {
692 auto* pMetaAction = static_cast<MetaTextFillColorAction*>(pAction);
693 TextFillColorHandler(pMetaAction);
694 }
695 break;
696
698 {
699 auto* pMetaAction = static_cast<MetaTextLineColorAction*>(pAction);
700 TextLineColorHandler(pMetaAction);
701 }
702 break;
703
705 {
706 auto* pMetaAction = static_cast<MetaOverlineColorAction*>(pAction);
707 OverlineColorHandler(pMetaAction);
708 }
709 break;
710
712 {
713 auto* pMetaAction = static_cast<MetaTextAlignAction*>(pAction);
714 TextAlignHandler(pMetaAction);
715 }
716 break;
717
719 {
720 auto* pMetaAction = static_cast<MetaMapModeAction*>(pAction);
721 MapModeHandler(pMetaAction);
722 }
723 break;
724
726 {
727 auto* pMetaAction = static_cast<MetaFontAction*>(pAction);
728 FontHandler(pMetaAction, pData);
729 }
730 break;
731
733 {
734 auto* pMetaAction = static_cast<MetaPushAction*>(pAction);
735 PushHandler(pMetaAction);
736 }
737 break;
738
740 {
741 auto* pMetaAction = static_cast<MetaPopAction*>(pAction);
742 PopHandler(pMetaAction);
743 }
744 break;
745
747 {
748 auto* pMetaAction = static_cast<MetaRasterOpAction*>(pAction);
749 RasterOpHandler(pMetaAction);
750 }
751 break;
752
754 {
755 auto* pMetaAction = static_cast<MetaTransparentAction*>(pAction);
756 TransparentHandler(pMetaAction);
757 }
758 break;
759
761 {
762 auto* pMetaAction = static_cast<MetaFloatTransparentAction*>(pAction);
763 FloatTransparentHandler(pMetaAction);
764 }
765 break;
766
768 {
769 auto* pMetaAction = static_cast<MetaEPSAction*>(pAction);
770 EPSHandler(pMetaAction);
771 }
772 break;
773
775 {
776 auto* pMetaAction = static_cast<MetaRefPointAction*>(pAction);
777 RefPointHandler(pMetaAction);
778 }
779 break;
780
782 {
783 auto* pMetaAction = static_cast<MetaCommentAction*>(pAction);
784 CommentHandler(pMetaAction);
785 }
786 break;
787
789 {
790 auto* pMetaAction = static_cast<MetaLayoutModeAction*>(pAction);
791 LayoutModeHandler(pMetaAction);
792 }
793 break;
794
796 {
797 auto* pMetaAction = static_cast<MetaTextLanguageAction*>(pAction);
798 TextLanguageHandler(pMetaAction);
799 }
800 break;
801 }
802}
803
805{
806 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
807}
808
810{
811 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
812 VersionCompatWrite aCompat(mrStream, 1);
813 TypeSerializer aSerializer(mrStream);
814 aSerializer.writePoint(pAction->GetPoint());
815 WriteColor(pAction->GetColor());
816}
817
819{
820 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
821 VersionCompatWrite aCompat(mrStream, 1);
822 TypeSerializer aSerializer(mrStream);
823 aSerializer.writePoint(pAction->GetPoint());
824}
825
827{
828 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
829
830 VersionCompatWrite aCompat(mrStream, 2);
831
832 // Version 1
833 TypeSerializer aSerializer(mrStream);
834 aSerializer.writePoint(pAction->GetStartPoint());
835 aSerializer.writePoint(pAction->GetEndPoint());
836 // Version 2
838}
839
841{
842 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
843
844 VersionCompatWrite aCompat(mrStream, 1);
845 TypeSerializer aSerializer(mrStream);
846 aSerializer.writeRectangle(pAction->GetRect());
847}
848
850{
851 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
852
853 VersionCompatWrite aCompat(mrStream, 1);
854 TypeSerializer aSerializer(mrStream);
855 aSerializer.writeRectangle(pAction->GetRect());
857}
858
860{
861 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
862
863 VersionCompatWrite aCompat(mrStream, 1);
864 TypeSerializer aSerializer(mrStream);
865 aSerializer.writeRectangle(pAction->GetRect());
866}
867
869{
870 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
871
872 VersionCompatWrite aCompat(mrStream, 1);
873 TypeSerializer aSerializer(mrStream);
874 aSerializer.writeRectangle(pAction->GetRect());
875 aSerializer.writePoint(pAction->GetStartPoint());
876 aSerializer.writePoint(pAction->GetEndPoint());
877}
878
880{
881 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
882
883 VersionCompatWrite aCompat(mrStream, 1);
884 TypeSerializer aSerializer(mrStream);
885 aSerializer.writeRectangle(pAction->GetRect());
886 aSerializer.writePoint(pAction->GetStartPoint());
887 aSerializer.writePoint(pAction->GetEndPoint());
888}
889
891{
892 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
893
894 VersionCompatWrite aCompat(mrStream, 1);
895 TypeSerializer aSerializer(mrStream);
896 aSerializer.writeRectangle(pAction->GetRect());
897 aSerializer.writePoint(pAction->GetStartPoint());
898 aSerializer.writePoint(pAction->GetEndPoint());
899}
900
902{
903 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
904
905 VersionCompatWrite aCompat(mrStream, 3);
906
907 tools::Polygon aSimplePoly;
908 pAction->GetPolygon().AdaptiveSubdivide(aSimplePoly);
909
910 WritePolygon(mrStream, aSimplePoly); // Version 1
911 WriteLineInfo(mrStream, pAction->GetLineInfo()); // Version 2
912
913 bool bHasPolyFlags = pAction->GetPolygon().HasFlags(); // Version 3
914 mrStream.WriteBool(bHasPolyFlags);
915 if (bHasPolyFlags)
916 pAction->GetPolygon().Write(mrStream);
917}
918
920{
921 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
922
923 VersionCompatWrite aCompat(mrStream, 2);
924
925 tools::Polygon aSimplePoly; // Version 1
926 pAction->GetPolygon().AdaptiveSubdivide(aSimplePoly);
927 WritePolygon(mrStream, aSimplePoly);
928
929 bool bHasPolyFlags = pAction->GetPolygon().HasFlags(); // Version 2
930 mrStream.WriteBool(bHasPolyFlags);
931 if (bHasPolyFlags)
932 pAction->GetPolygon().Write(mrStream);
933}
934
936{
937 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
938
939 VersionCompatWrite aCompat(mrStream, 2);
940
941 sal_uInt16 nNumberOfComplexPolygons = 0;
942 sal_uInt16 i, nPolyCount = pAction->GetPolyPolygon().Count();
943
944 tools::Polygon aSimplePoly; // Version 1
945 mrStream.WriteUInt16(nPolyCount);
946 for (i = 0; i < nPolyCount; i++)
947 {
948 const tools::Polygon& rPoly = pAction->GetPolyPolygon().GetObject(i);
949 if (rPoly.HasFlags())
950 nNumberOfComplexPolygons++;
951 rPoly.AdaptiveSubdivide(aSimplePoly);
952 WritePolygon(mrStream, aSimplePoly);
953 }
954
955 mrStream.WriteUInt16(nNumberOfComplexPolygons); // Version 2
956 for (i = 0; nNumberOfComplexPolygons && (i < nPolyCount); i++)
957 {
958 const tools::Polygon& rPoly = pAction->GetPolyPolygon().GetObject(i);
959 if (rPoly.HasFlags())
960 {
962 rPoly.Write(mrStream);
963
964 nNumberOfComplexPolygons--;
965 }
966 }
967}
968
970{
971 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
972
973 VersionCompatWrite aCompat(mrStream, 2);
974 TypeSerializer aSerializer(mrStream);
975 aSerializer.writePoint(pAction->GetPoint());
976 mrStream.WriteUniOrByteString(pAction->GetText(), pData->meActualCharSet);
977 mrStream.WriteUInt16(pAction->GetIndex());
978 mrStream.WriteUInt16(pAction->GetLen());
979
981}
982
984{
985 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
986
987 const KernArray& rDXArray = pAction->GetDXArray();
988
989 const sal_Int32 nAryLen = !rDXArray.empty() ? pAction->GetLen() : 0;
990
991 VersionCompatWrite aCompat(mrStream, 3);
992 TypeSerializer aSerializer(mrStream);
993 aSerializer.writePoint(pAction->GetPoint());
994 mrStream.WriteUniOrByteString(pAction->GetText(), pData->meActualCharSet);
995 mrStream.WriteUInt16(pAction->GetIndex());
996 mrStream.WriteUInt16(pAction->GetLen());
997 mrStream.WriteInt32(nAryLen);
998
999 for (sal_Int32 i = 0; i < nAryLen; ++i)
1000 mrStream.WriteInt32(rDXArray[i]);
1001
1003
1004 // Version 3
1005 const auto& rKashidaArray = pAction->GetKashidaArray();
1006 mrStream.WriteUInt32(rKashidaArray.size());
1007 for (const auto& val : rKashidaArray)
1008 mrStream.WriteUChar(val);
1009}
1010
1012 const ImplMetaWriteData* pData)
1013{
1014 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1015
1016 VersionCompatWrite aCompat(mrStream, 2);
1017 TypeSerializer aSerializer(mrStream);
1018 aSerializer.writePoint(pAction->GetPoint());
1019 mrStream.WriteUniOrByteString(pAction->GetText(), pData->meActualCharSet);
1020 mrStream.WriteUInt32(pAction->GetWidth());
1021 mrStream.WriteUInt16(pAction->GetIndex());
1022 mrStream.WriteUInt16(pAction->GetLen());
1023
1025}
1026
1028{
1029 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1030
1031 VersionCompatWrite aCompat(mrStream, 2);
1032 TypeSerializer aSerializer(mrStream);
1033 aSerializer.writeRectangle(pAction->GetRect());
1034 mrStream.WriteUniOrByteString(pAction->GetText(), pData->meActualCharSet);
1035 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetStyle()));
1036
1038}
1039
1041{
1042 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1043
1044 VersionCompatWrite aCompat(mrStream, 2);
1045
1046 TypeSerializer aSerializer(mrStream);
1047 aSerializer.writePoint(pAction->GetStartPoint());
1048
1049 mrStream.WriteInt32(pAction->GetWidth());
1050 mrStream.WriteUInt32(pAction->GetStrikeout());
1051 mrStream.WriteUInt32(pAction->GetUnderline());
1052 // new in version 2
1053 mrStream.WriteUInt32(pAction->GetOverline());
1054}
1055
1057{
1058 if (!pAction->GetBitmap().IsEmpty())
1059 {
1060 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1061 VersionCompatWrite aCompat(mrStream, 1);
1062 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1063 TypeSerializer aSerializer(mrStream);
1064 aSerializer.writePoint(pAction->GetPoint());
1065 }
1066}
1067
1069{
1070 if (!pAction->GetBitmap().IsEmpty())
1071 {
1072 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1073 VersionCompatWrite aCompat(mrStream, 1);
1074 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1075 TypeSerializer aSerializer(mrStream);
1076 aSerializer.writePoint(pAction->GetPoint());
1077 aSerializer.writeSize(pAction->GetSize());
1078 }
1079}
1080
1082{
1083 if (!pAction->GetBitmap().IsEmpty())
1084 {
1085 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1086 VersionCompatWrite aCompat(mrStream, 1);
1087 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1088 TypeSerializer aSerializer(mrStream);
1089 aSerializer.writePoint(pAction->GetDestPoint());
1090 aSerializer.writeSize(pAction->GetDestSize());
1091 aSerializer.writePoint(pAction->GetSrcPoint());
1092 aSerializer.writeSize(pAction->GetSrcSize());
1093 }
1094}
1095
1097{
1098 if (!pAction->GetBitmapEx().GetBitmap().IsEmpty())
1099 {
1100 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1101 VersionCompatWrite aCompat(mrStream, 1);
1103 TypeSerializer aSerializer(mrStream);
1104 aSerializer.writePoint(pAction->GetPoint());
1105 }
1106}
1107
1109{
1110 if (!pAction->GetBitmapEx().GetBitmap().IsEmpty())
1111 {
1112 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1113 VersionCompatWrite aCompat(mrStream, 1);
1115 TypeSerializer aSerializer(mrStream);
1116 aSerializer.writePoint(pAction->GetPoint());
1117 aSerializer.writeSize(pAction->GetSize());
1118 }
1119}
1120
1122{
1123 if (!pAction->GetBitmapEx().GetBitmap().IsEmpty())
1124 {
1125 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1126 VersionCompatWrite aCompat(mrStream, 1);
1128 TypeSerializer aSerializer(mrStream);
1129 aSerializer.writePoint(pAction->GetDestPoint());
1130 aSerializer.writeSize(pAction->GetDestSize());
1131 aSerializer.writePoint(pAction->GetSrcPoint());
1132 aSerializer.writeSize(pAction->GetSrcSize());
1133 }
1134}
1135
1137{
1138 if (!pAction->GetBitmap().IsEmpty())
1139 {
1140 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1141 VersionCompatWrite aCompat(mrStream, 1);
1142 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1143 TypeSerializer aSerializer(mrStream);
1144 aSerializer.writePoint(pAction->GetPoint());
1145 }
1146}
1147
1149{
1150 if (!pAction->GetBitmap().IsEmpty())
1151 {
1152 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1153 VersionCompatWrite aCompat(mrStream, 1);
1154 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1155 TypeSerializer aSerializer(mrStream);
1156 aSerializer.writePoint(pAction->GetPoint());
1157 aSerializer.writeSize(pAction->GetSize());
1158 }
1159}
1160
1162{
1163 if (!pAction->GetBitmap().IsEmpty())
1164 {
1165 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1166 VersionCompatWrite aCompat(mrStream, 1);
1167 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1168 WriteColor(pAction->GetColor());
1169 TypeSerializer aSerializer(mrStream);
1170 aSerializer.writePoint(pAction->GetDestPoint());
1171 aSerializer.writeSize(pAction->GetDestSize());
1172 aSerializer.writePoint(pAction->GetSrcPoint());
1173 aSerializer.writeSize(pAction->GetSrcSize());
1174 }
1175}
1176
1178{
1179 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1180 VersionCompatWrite aCompat(mrStream, 1);
1181 TypeSerializer aSerializer(mrStream);
1182 aSerializer.writeRectangle(pAction->GetRect());
1183 aSerializer.writeGradient(pAction->GetGradient());
1184}
1185
1187{
1188 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1189 VersionCompatWrite aCompat(mrStream, 1);
1190
1191 // #i105373# see comment at MetaTransparentAction::Write
1192 tools::PolyPolygon aNoCurvePolyPolygon;
1193 pAction->GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon);
1194
1195 WritePolyPolygon(mrStream, aNoCurvePolyPolygon);
1196 TypeSerializer aSerializer(mrStream);
1197 aSerializer.writeGradient(pAction->GetGradient());
1198}
1199
1201{
1202 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1203 VersionCompatWrite aCompat(mrStream, 1);
1204
1205 // #i105373# see comment at MetaTransparentAction::Write
1206 tools::PolyPolygon aNoCurvePolyPolygon;
1207 pAction->GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon);
1208
1209 WritePolyPolygon(mrStream, aNoCurvePolyPolygon);
1210 WriteHatch(mrStream, pAction->GetHatch());
1211}
1212
1214{
1215 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1216 VersionCompatWrite aCompat(mrStream, 1);
1217
1219}
1220
1222{
1223 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1224 VersionCompatWrite aCompat(mrStream, 1);
1225 WriteRegion(mrStream, pAction->GetRegion());
1226 mrStream.WriteBool(pAction->IsClipping());
1227}
1228
1230{
1231 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1232 VersionCompatWrite aCompat(mrStream, 1);
1233 TypeSerializer aSerializer(mrStream);
1234 aSerializer.writeRectangle(pAction->GetRect());
1235}
1236
1238{
1239 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1240 VersionCompatWrite aCompat(mrStream, 1);
1241 WriteRegion(mrStream, pAction->GetRegion());
1242}
1243
1245{
1246 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1247 VersionCompatWrite aCompat(mrStream, 1);
1248 mrStream.WriteInt32(pAction->GetHorzMove()).WriteInt32(pAction->GetVertMove());
1249}
1250
1252{
1253 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1254 VersionCompatWrite aCompat(mrStream, 1);
1255 WriteColor(pAction->GetColor());
1256 mrStream.WriteBool(pAction->IsSetting());
1257}
1258
1260{
1261 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1262 VersionCompatWrite aCompat(mrStream, 1);
1263 WriteColor(pAction->GetColor());
1264 mrStream.WriteBool(pAction->IsSetting());
1265}
1266
1268{
1269 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1270 VersionCompatWrite aCompat(mrStream, 1);
1271 WriteColor(pAction->GetColor());
1272}
1273
1275{
1276 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1277 VersionCompatWrite aCompat(mrStream, 1);
1278 WriteColor(pAction->GetColor());
1279 mrStream.WriteBool(pAction->IsSetting());
1280}
1281
1283{
1284 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1285 VersionCompatWrite aCompat(mrStream, 1);
1286 WriteColor(pAction->GetColor());
1287 mrStream.WriteBool(pAction->IsSetting());
1288}
1289
1291{
1292 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1293 VersionCompatWrite aCompat(mrStream, 1);
1294 WriteColor(pAction->GetColor());
1295 mrStream.WriteBool(pAction->IsSetting());
1296}
1297
1299{
1300 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1301 VersionCompatWrite aCompat(mrStream, 1);
1302 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetTextAlign()));
1303}
1304
1306{
1307 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1308 VersionCompatWrite aCompat(mrStream, 1);
1309 TypeSerializer aSerializer(mrStream);
1310 aSerializer.writeMapMode(pAction->GetMapMode());
1311}
1312
1314{
1315 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1316 VersionCompatWrite aCompat(mrStream, 1);
1317 WriteFont(mrStream, pAction->GetFont());
1318 pData->meActualCharSet = pAction->GetFont().GetCharSet();
1319 if (pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW)
1320 pData->meActualCharSet = osl_getThreadTextEncoding();
1321}
1322
1324{
1325 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1326 VersionCompatWrite aCompat(mrStream, 1);
1327 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetFlags()));
1328}
1329
1331{
1332 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1333 VersionCompatWrite aCompat(mrStream, 1);
1334}
1335
1337{
1338 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1339 VersionCompatWrite aCompat(mrStream, 1);
1340 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetRasterOp()));
1341}
1342
1344{
1345 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1346 VersionCompatWrite aCompat(mrStream, 1);
1347
1348 // #i105373# The tools::PolyPolygon in this action may be a curve; this
1349 // was ignored until now what is an error. To make older office
1350 // versions work with MetaFiles, i opt for applying AdaptiveSubdivide
1351 // to the PolyPolygon.
1352 // The alternative would be to really write the curve information
1353 // like in MetaPolyPolygonAction::Write (where someone extended it
1354 // correctly, but not here :-( ).
1355 // The golden solution would be to combine both, but i think it's
1356 // not necessary; a good subdivision will be sufficient.
1357 tools::PolyPolygon aNoCurvePolyPolygon;
1358 pAction->GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon);
1359
1360 WritePolyPolygon(mrStream, aNoCurvePolyPolygon);
1362}
1363
1365{
1366 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1367
1368 // tdf#155479 prep vars for MCGR
1369 const basegfx::BColorStops* pSVGTransparencyColorStops(pAction->getSVGTransparencyColorStops());
1370 const bool bSVG(nullptr != pSVGTransparencyColorStops);
1371
1372 VersionCompatWrite aCompat(mrStream, bSVG ? 2 : 1);
1373
1374 SvmWriter aWriter(mrStream);
1375 GDIMetaFile aMtf = pAction->GetGDIMetaFile();
1376 aWriter.Write(aMtf);
1377 TypeSerializer aSerializer(mrStream);
1378 aSerializer.writePoint(pAction->GetPoint());
1379 aSerializer.writeSize(pAction->GetSize());
1380 aSerializer.writeGradient(pAction->GetGradient());
1381
1382 // tdf#155479 add support for MCGR and SVG export
1383 if (bSVG)
1384 {
1385 sal_uInt16 nTmp(sal::static_int_cast<sal_uInt16>(pSVGTransparencyColorStops->size()));
1386 mrStream.WriteUInt16(nTmp);
1387
1388 for (auto const& rCand : *pSVGTransparencyColorStops)
1389 {
1390 mrStream.WriteDouble(rCand.getStopOffset());
1391 const basegfx::BColor& rColor(rCand.getStopColor());
1392 mrStream.WriteDouble(rColor.getRed());
1393 mrStream.WriteDouble(rColor.getGreen());
1394 mrStream.WriteDouble(rColor.getBlue());
1395 }
1396 }
1397}
1398
1400{
1401 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1402 VersionCompatWrite aCompat(mrStream, 1);
1403
1404 TypeSerializer aSerializer(mrStream);
1405 aSerializer.writeGfxLink(pAction->GetLink());
1406 aSerializer.writePoint(pAction->GetPoint());
1407 aSerializer.writeSize(pAction->GetSize());
1408
1409 SvmWriter aWriter(mrStream);
1410 GDIMetaFile aMtf = pAction->GetSubstitute();
1411 aWriter.Write(aMtf);
1412}
1413
1415{
1416 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1417 VersionCompatWrite aCompat(mrStream, 1);
1418
1419 TypeSerializer aSerializer(mrStream);
1420 aSerializer.writePoint(pAction->GetRefPoint());
1421 mrStream.WriteBool(pAction->IsSetting());
1422}
1423
1425{
1426 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1427 VersionCompatWrite aCompat(mrStream, 1);
1429 mrStream.WriteInt32(pAction->GetValue()).WriteUInt32(pAction->GetDataSize());
1430
1431 if (pAction->GetDataSize())
1432 mrStream.WriteBytes(pAction->GetData(), pAction->GetDataSize());
1433}
1434
1436{
1437 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1438 VersionCompatWrite aCompat(mrStream, 1);
1439 mrStream.WriteUInt32(static_cast<sal_uInt32>(pAction->GetLayoutMode()));
1440}
1441
1443{
1444 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1445 VersionCompatWrite aCompat(mrStream, 1);
1446 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetTextLanguage()));
1447}
1448/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define BITMAP_CHECKSUM_SIZE
Definition: checksum.hxx:28
sal_uInt8 BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE]
Definition: checksum.hxx:31
sal_uInt64 BitmapChecksum
Definition: checksum.hxx:30
void BCToBCOA(BitmapChecksum n, BitmapChecksumOctetArray p)
Definition: checksum.hxx:34
BitmapChecksum vcl_get_checksum(BitmapChecksum Checksum, const void *Data, sal_uInt32 DatLen)
Definition: checksum.hxx:72
BitmapChecksum GetChecksum() const
Definition: BitmapEx.cxx:239
Bitmap GetBitmap(Color aTransparentReplaceColor) const
Definition: BitmapEx.cxx:217
BitmapChecksum GetChecksum() const
bool IsEmpty() const
size_t GetActionSize() const
Definition: gdimtf.cxx:181
const Size & GetPrefSize() const
Definition: gdimtf.hxx:176
MetaAction * GetAction(size_t nAction) const
Definition: gdimtf.cxx:186
const MapMode & GetPrefMapMode() const
Definition: gdimtf.hxx:179
bool empty() const
Definition: kernarray.hxx:74
MetaActionType GetType() const
Definition: metaact.hxx:96
const Point & GetStartPoint() const
Definition: metaact.hxx:308
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:307
const Point & GetEndPoint() const
Definition: metaact.hxx:309
const Bitmap & GetBitmap() const
Definition: metaact.hxx:693
const Point & GetPoint() const
Definition: metaact.hxx:694
const BitmapEx & GetBitmapEx() const
Definition: metaact.hxx:798
const Point & GetPoint() const
Definition: metaact.hxx:799
const Size & GetSize() const
Definition: metaact.hxx:833
const Point & GetPoint() const
Definition: metaact.hxx:832
const BitmapEx & GetBitmapEx() const
Definition: metaact.hxx:831
const Point & GetSrcPoint() const
Definition: metaact.hxx:872
const Size & GetDestSize() const
Definition: metaact.hxx:871
const Point & GetDestPoint() const
Definition: metaact.hxx:870
const Size & GetSrcSize() const
Definition: metaact.hxx:873
const BitmapEx & GetBitmapEx() const
Definition: metaact.hxx:869
const Point & GetPoint() const
Definition: metaact.hxx:726
const Size & GetSize() const
Definition: metaact.hxx:727
const Bitmap & GetBitmap() const
Definition: metaact.hxx:725
const Bitmap & GetBitmap() const
Definition: metaact.hxx:762
const Point & GetDestPoint() const
Definition: metaact.hxx:763
const Point & GetSrcPoint() const
Definition: metaact.hxx:765
const Size & GetSrcSize() const
Definition: metaact.hxx:766
const Size & GetDestSize() const
Definition: metaact.hxx:764
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:375
const Point & GetStartPoint() const
Definition: metaact.hxx:376
const Point & GetEndPoint() const
Definition: metaact.hxx:377
const vcl::Region & GetRegion() const
Definition: metaact.hxx:1142
bool IsClipping() const
Definition: metaact.hxx:1143
sal_Int32 GetValue() const
Definition: metaact.hxx:1710
const sal_uInt8 * GetData() const
Definition: metaact.hxx:1712
const OString & GetComment() const
Definition: metaact.hxx:1709
sal_uInt32 GetDataSize() const
Definition: metaact.hxx:1711
const GDIMetaFile & GetSubstitute() const
Definition: metaact.hxx:1647
const Point & GetPoint() const
Definition: metaact.hxx:1648
const Size & GetSize() const
Definition: metaact.hxx:1649
const GfxLink & GetLink() const
Definition: metaact.hxx:1646
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:277
const Color & GetColor() const
Definition: metaact.hxx:1279
bool IsSetting() const
Definition: metaact.hxx:1280
const Gradient & GetGradient() const
Definition: metaact.hxx:1606
const Size & GetSize() const
Definition: metaact.hxx:1605
const GDIMetaFile & GetGDIMetaFile() const
Definition: metaact.hxx:1603
const Point & GetPoint() const
Definition: metaact.hxx:1604
const basegfx::BColorStops * getSVGTransparencyColorStops() const
Definition: metaact.hxx:1614
const vcl::Font & GetFont() const
Definition: metaact.hxx:1472
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:1022
const Gradient & GetGradient() const
Definition: metaact.hxx:1023
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1052
const Gradient & GetGradient() const
Definition: metaact.hxx:1053
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1082
const Hatch & GetHatch() const
Definition: metaact.hxx:1083
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:1171
const vcl::Region & GetRegion() const
Definition: metaact.hxx:1198
vcl::text::ComplexTextLayoutFlags GetLayoutMode() const
Definition: metaact.hxx:1739
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:187
const Point & GetEndPoint() const
Definition: metaact.hxx:186
const Point & GetStartPoint() const
Definition: metaact.hxx:185
bool IsSetting() const
Definition: metaact.hxx:1253
const Color & GetColor() const
Definition: metaact.hxx:1252
const MapMode & GetMapMode() const
Definition: metaact.hxx:1438
const Point & GetPoint() const
Definition: metaact.hxx:911
const Bitmap & GetBitmap() const
Definition: metaact.hxx:909
const Color & GetColor() const
Definition: metaact.hxx:910
const Bitmap & GetBitmap() const
Definition: metaact.hxx:944
const Point & GetPoint() const
Definition: metaact.hxx:946
const Color & GetColor() const
Definition: metaact.hxx:945
const Size & GetSize() const
Definition: metaact.hxx:947
const Bitmap & GetBitmap() const
Definition: metaact.hxx:984
const Point & GetSrcPoint() const
Definition: metaact.hxx:988
const Color & GetColor() const
Definition: metaact.hxx:985
const Size & GetSrcSize() const
Definition: metaact.hxx:989
const Point & GetDestPoint() const
Definition: metaact.hxx:986
const Size & GetDestSize() const
Definition: metaact.hxx:987
tools::Long GetVertMove() const
Definition: metaact.hxx:1226
tools::Long GetHorzMove() const
Definition: metaact.hxx:1225
const Color & GetColor() const
Definition: metaact.hxx:1386
bool IsSetting() const
Definition: metaact.hxx:1389
const Point & GetEndPoint() const
Definition: metaact.hxx:343
const Point & GetStartPoint() const
Definition: metaact.hxx:342
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:341
const Point & GetPoint() const
Definition: metaact.hxx:126
const Color & GetColor() const
Definition: metaact.hxx:127
const Point & GetPoint() const
Definition: metaact.hxx:154
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:409
const tools::Polygon & GetPolygon() const
Definition: metaact.hxx:408
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:464
const tools::Polygon & GetPolygon() const
Definition: metaact.hxx:437
vcl::PushFlags GetFlags() const
Definition: metaact.hxx:1497
RasterOp GetRasterOp() const
Definition: metaact.hxx:1537
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:216
bool IsSetting() const
Definition: metaact.hxx:1680
const Point & GetRefPoint() const
Definition: metaact.hxx:1677
sal_uInt32 GetHorzRound() const
Definition: metaact.hxx:247
sal_uInt32 GetVertRound() const
Definition: metaact.hxx:248
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:246
sal_uInt32 GetWidth() const
Definition: metaact.hxx:584
sal_Int32 GetLen() const
Definition: metaact.hxx:586
sal_Int32 GetIndex() const
Definition: metaact.hxx:585
const OUString & GetText() const
Definition: metaact.hxx:583
const Point & GetPoint() const
Definition: metaact.hxx:582
const Point & GetPoint() const
Definition: metaact.hxx:495
sal_Int32 GetLen() const
Definition: metaact.hxx:498
const OUString & GetText() const
Definition: metaact.hxx:496
sal_Int32 GetIndex() const
Definition: metaact.hxx:497
TextAlign GetTextAlign() const
Definition: metaact.hxx:1412
sal_Int32 GetIndex() const
Definition: metaact.hxx:541
const KernArray & GetDXArray() const
Definition: metaact.hxx:543
sal_Int32 GetLen() const
Definition: metaact.hxx:542
const OUString & GetText() const
Definition: metaact.hxx:540
const Point & GetPoint() const
Definition: metaact.hxx:539
const std::vector< sal_Bool > & GetKashidaArray() const
Definition: metaact.hxx:544
const Color & GetColor() const
Definition: metaact.hxx:1306
bool IsSetting() const
Definition: metaact.hxx:1334
const Color & GetColor() const
Definition: metaact.hxx:1331
LanguageType GetTextLanguage() const
Definition: metaact.hxx:1763
const Point & GetStartPoint() const
Definition: metaact.hxx:657
tools::Long GetWidth() const
Definition: metaact.hxx:658
FontLineStyle GetUnderline() const
Definition: metaact.hxx:660
FontLineStyle GetOverline() const
Definition: metaact.hxx:661
FontStrikeout GetStrikeout() const
Definition: metaact.hxx:659
bool IsSetting() const
Definition: metaact.hxx:1362
const Color & GetColor() const
Definition: metaact.hxx:1359
DrawTextFlags GetStyle() const
Definition: metaact.hxx:622
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:620
const OUString & GetText() const
Definition: metaact.hxx:621
sal_uInt16 GetTransparence() const
Definition: metaact.hxx:1566
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1565
const Wallpaper & GetWallpaper() const
Definition: metaact.hxx:1114
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const void * GetData()
SvStream & WriteDouble(const double &rDouble)
SvStream & WriteInt32(sal_Int32 nInt32)
sal_uInt64 Tell() const
void SetEndian(SvStreamEndian SvStreamEndian)
SvStream & WriteUniOrByteString(std::u16string_view rStr, rtl_TextEncoding eDestCharSet)
SvStreamCompressFlags GetCompressMode() const
std::size_t WriteBytes(const void *pData, std::size_t nSize)
SvStream & WriteBool(bool b)
SvStream & WriteUChar(unsigned char nChar)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStreamEndian GetEndian() const
sal_uInt64 Seek(sal_uInt64 nPos)
rtl_TextEncoding GetStreamCharSet() const
void RasterOpHandler(const MetaRasterOpAction *pAction)
Definition: SvmWriter.cxx:1336
void PopHandler(const MetaPopAction *pAction)
Definition: SvmWriter.cxx:1330
void BmpExHandler(const MetaBmpExAction *pAction)
Definition: SvmWriter.cxx:1096
void EPSHandler(const MetaEPSAction *pAction)
Definition: SvmWriter.cxx:1399
void BmpScalePartHandler(const MetaBmpScalePartAction *pAction)
Definition: SvmWriter.cxx:1081
void ISectRegionClipRegionHandler(const MetaISectRegionClipRegionAction *pAction)
Definition: SvmWriter.cxx:1237
void OverlineColorHandler(const MetaOverlineColorAction *pAction)
Definition: SvmWriter.cxx:1290
void EllipseHandler(const MetaEllipseAction *pAction)
Definition: SvmWriter.cxx:859
void BmpExScalePartHandler(const MetaBmpExScalePartAction *pAction)
Definition: SvmWriter.cxx:1121
void BmpExScaleHandler(const MetaBmpExScaleAction *pAction)
Definition: SvmWriter.cxx:1108
void CommentHandler(const MetaCommentAction *pAction)
Definition: SvmWriter.cxx:1424
void MaskHandler(const MetaMaskAction *pAction)
Definition: SvmWriter.cxx:1136
void TextLineColorHandler(const MetaTextLineColorAction *pAction)
Definition: SvmWriter.cxx:1282
SvStream & Write(const GDIMetaFile &rMetaFile)
Definition: SvmWriter.cxx:38
void TextHandler(const MetaTextAction *pAction, const ImplMetaWriteData *pData)
Definition: SvmWriter.cxx:969
void TextLanguageHandler(const MetaTextLanguageAction *pAction)
Definition: SvmWriter.cxx:1442
void PushHandler(const MetaPushAction *pAction)
Definition: SvmWriter.cxx:1323
void TextFillColorHandler(const MetaTextFillColorAction *pAction)
Definition: SvmWriter.cxx:1274
void BmpScaleHandler(const MetaBmpScaleAction *pAction)
Definition: SvmWriter.cxx:1068
void WallpaperHandler(const MetaWallpaperAction *pAction)
Definition: SvmWriter.cxx:1213
void RectHandler(const MetaRectAction *pAction)
Definition: SvmWriter.cxx:840
SvmWriter(SvStream &rIStm)
Definition: SvmWriter.cxx:28
void ChordHandler(const MetaChordAction *pAction)
Definition: SvmWriter.cxx:890
void LineColorHandler(const MetaLineColorAction *pAction)
Definition: SvmWriter.cxx:1251
void MaskScalePartHandler(const MetaMaskScalePartAction *pAction)
Definition: SvmWriter.cxx:1161
void PolyLineHandler(const MetaPolyLineAction *pAction)
Definition: SvmWriter.cxx:901
void MaskScaleHandler(const MetaMaskScaleAction *pAction)
Definition: SvmWriter.cxx:1148
void TransparentHandler(const MetaTransparentAction *pAction)
Definition: SvmWriter.cxx:1343
void RefPointHandler(const MetaRefPointAction *pAction)
Definition: SvmWriter.cxx:1414
void HatchHandler(const MetaHatchAction *pAction)
Definition: SvmWriter.cxx:1200
void TextLineHandler(const MetaTextLineAction *pAction)
Definition: SvmWriter.cxx:1040
void StretchTextHandler(const MetaStretchTextAction *pAction, const ImplMetaWriteData *pData)
Definition: SvmWriter.cxx:1011
void LayoutModeHandler(const MetaLayoutModeAction *pAction)
Definition: SvmWriter.cxx:1435
void FillColorHandler(const MetaFillColorAction *pAction)
Definition: SvmWriter.cxx:1259
void ArcHandler(const MetaArcAction *pAction)
Definition: SvmWriter.cxx:868
void PointHandler(const MetaPointAction *pAction)
Definition: SvmWriter.cxx:818
void MetaActionHandler(MetaAction *pAction, ImplMetaWriteData *pData)
Definition: SvmWriter.cxx:419
static BitmapChecksum GetChecksum(const GDIMetaFile &rMetaFile)
Definition: SvmWriter.cxx:72
void BmpHandler(const MetaBmpAction *pAction)
Definition: SvmWriter.cxx:1056
void ClipRegionHandler(const MetaClipRegionAction *pAction)
Definition: SvmWriter.cxx:1221
void PolygonHandler(const MetaPolygonAction *pAction)
Definition: SvmWriter.cxx:919
void TextAlignHandler(const MetaTextAlignAction *pAction)
Definition: SvmWriter.cxx:1298
void TextColorHandler(const MetaTextColorAction *pAction)
Definition: SvmWriter.cxx:1267
void MapModeHandler(const MetaMapModeAction *pAction)
Definition: SvmWriter.cxx:1305
SvStream & mrStream
Definition: SvmWriter.hxx:30
void WriteColor(::Color aColor)
Definition: SvmWriter.cxx:33
void PieHandler(const MetaPieAction *pAction)
Definition: SvmWriter.cxx:879
void LineHandler(const MetaLineAction *pAction)
Definition: SvmWriter.cxx:826
void RoundRectHandler(const MetaRoundRectAction *pAction)
Definition: SvmWriter.cxx:849
void TextArrayHandler(const MetaTextArrayAction *pAction, const ImplMetaWriteData *pData)
Definition: SvmWriter.cxx:983
void ISectRectClipRegionHandler(const MetaISectRectClipRegionAction *pAction)
Definition: SvmWriter.cxx:1229
void PixelHandler(const MetaPixelAction *pAction)
Definition: SvmWriter.cxx:809
void TextRectHandler(const MetaTextRectAction *pAction, const ImplMetaWriteData *pData)
Definition: SvmWriter.cxx:1027
void MoveClipRegionHandler(const MetaMoveClipRegionAction *pAction)
Definition: SvmWriter.cxx:1244
void GradientExHandler(const MetaGradientExAction *pAction)
Definition: SvmWriter.cxx:1186
void GradientHandler(const MetaGradientAction *pAction)
Definition: SvmWriter.cxx:1177
void ActionHandler(const MetaAction *pAction)
Definition: SvmWriter.cxx:804
void FloatTransparentHandler(const MetaFloatTransparentAction *pAction)
Definition: SvmWriter.cxx:1364
void FontHandler(const MetaFontAction *pAction, ImplMetaWriteData *pData)
Definition: SvmWriter.cxx:1313
void PolyPolygonHandler(const MetaPolyPolygonAction *pAction)
Definition: SvmWriter.cxx:935
void writeGradient(const Gradient &rGradient)
void writeMapMode(MapMode const &rMapMode)
void writeGfxLink(const GfxLink &rGfxLink)
double getBlue() const
double getRed() const
double getGreen() const
TYPE getX() const
TYPE getY() const
void writePoint(const Point &rPoint)
void writeRectangle(const Rectangle &rRectangle)
void writeSize(const Size &rSize)
sal_uInt16 Count() const
void AdaptiveSubdivide(tools::PolyPolygon &rResult) const
const tools::Polygon & GetObject(sal_uInt16 nPos) const
bool HasFlags() const
void Write(SvStream &rOStream) const
void AdaptiveSubdivide(tools::Polygon &rResult, const double d=1.0) const
rtl_TextEncoding GetCharSet() const
Definition: font/font.cxx:913
basegfx::B2DPolyPolygon GetAsB2DPolyPolygon() const
Definition: region.cxx:1294
bool HasPolyPolygonOrB2DPolyPolygon() const
Definition: region.hxx:107
bool WriteDIBBitmapEx(const BitmapEx &rSource, SvStream &rOStm)
Definition: dibtools.cxx:1742
bool WriteDIB(const Bitmap &rSource, SvStream &rOStm, bool bCompressed, bool bFileHeader)
Definition: dibtools.cxx:1725
SvStream & WriteFont(SvStream &rOStm, const vcl::Font &rFont)
Definition: font/font.cxx:649
SvStream & WriteHatch(SvStream &rOStm, const Hatch &rHatch)
Definition: gdi/hatch.cxx:101
SvStream & WriteLineInfo(SvStream &rOStm, const LineInfo &rLineInfo)
Definition: lineinfo.cxx:190
MetaActionType
std::unique_ptr< sal_Int32[]> pData
int i
SvStream & WritePolyPolygon(SvStream &rOStream, const tools::PolyPolygon &rPolyPoly)
SvStream & WritePolygon(SvStream &rOStream, const tools::Polygon &rPoly)
SvStream & WriteRegion(SvStream &rOStrm, const vcl::Region &rRegion)
Definition: region.cxx:1602
QPRO_FUNC_TYPE nType
sal_uInt8 SVBT64[8]
sal_uInt8 SVBT32[4]
sal_uInt8 SVBT16[2]
std::size_t write_uInt16_lenPrefixed_uInt16s_FromOUString(SvStream &rStrm, std::u16string_view rStr)
SvStreamEndian
SvStreamCompressFlags
TOOLS_DLLPUBLIC std::size_t write_uInt16_lenPrefixed_uInt8s_FromOString(SvStream &rStrm, std::string_view rStr)
rtl_TextEncoding meActualCharSet
Definition: metaact.hxx:67
unsigned char sal_uInt8
SvStream & WriteWallpaper(SvStream &rOStm, const Wallpaper &rImplWallpaper)
Definition: wall.cxx:82