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
983void SvmWriter::TextArrayHandler(const MetaTextArrayAction* pAction, const ImplMetaWriteData* pData)
984{
985 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
986
987 const std::vector<sal_Int32>& rDXArray = pAction->GetDXArray();
988
989 const sal_Int32 nAryLen = !rDXArray.empty() ? pAction->GetLen() : 0;
990
991 VersionCompatWrite aCompat(mrStream, 2);
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
1002 write_uInt16_lenPrefixed_uInt16s_FromOUString(mrStream, pAction->GetText()); // version 2
1003}
1004
1006 const ImplMetaWriteData* pData)
1007{
1008 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1009
1010 VersionCompatWrite aCompat(mrStream, 2);
1011 TypeSerializer aSerializer(mrStream);
1012 aSerializer.writePoint(pAction->GetPoint());
1013 mrStream.WriteUniOrByteString(pAction->GetText(), pData->meActualCharSet);
1014 mrStream.WriteUInt32(pAction->GetWidth());
1015 mrStream.WriteUInt16(pAction->GetIndex());
1016 mrStream.WriteUInt16(pAction->GetLen());
1017
1019}
1020
1022{
1023 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1024
1025 VersionCompatWrite aCompat(mrStream, 2);
1026 TypeSerializer aSerializer(mrStream);
1027 aSerializer.writeRectangle(pAction->GetRect());
1028 mrStream.WriteUniOrByteString(pAction->GetText(), pData->meActualCharSet);
1029 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetStyle()));
1030
1032}
1033
1035{
1036 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1037
1038 VersionCompatWrite aCompat(mrStream, 2);
1039
1040 TypeSerializer aSerializer(mrStream);
1041 aSerializer.writePoint(pAction->GetStartPoint());
1042
1043 mrStream.WriteInt32(pAction->GetWidth());
1044 mrStream.WriteUInt32(pAction->GetStrikeout());
1045 mrStream.WriteUInt32(pAction->GetUnderline());
1046 // new in version 2
1047 mrStream.WriteUInt32(pAction->GetOverline());
1048}
1049
1051{
1052 if (!pAction->GetBitmap().IsEmpty())
1053 {
1054 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1055 VersionCompatWrite aCompat(mrStream, 1);
1056 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1057 TypeSerializer aSerializer(mrStream);
1058 aSerializer.writePoint(pAction->GetPoint());
1059 }
1060}
1061
1063{
1064 if (!pAction->GetBitmap().IsEmpty())
1065 {
1066 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1067 VersionCompatWrite aCompat(mrStream, 1);
1068 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1069 TypeSerializer aSerializer(mrStream);
1070 aSerializer.writePoint(pAction->GetPoint());
1071 aSerializer.writeSize(pAction->GetSize());
1072 }
1073}
1074
1075void SvmWriter::BmpScalePartHandler(const MetaBmpScalePartAction* pAction)
1076{
1077 if (!pAction->GetBitmap().IsEmpty())
1078 {
1079 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1080 VersionCompatWrite aCompat(mrStream, 1);
1081 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1082 TypeSerializer aSerializer(mrStream);
1083 aSerializer.writePoint(pAction->GetDestPoint());
1084 aSerializer.writeSize(pAction->GetDestSize());
1085 aSerializer.writePoint(pAction->GetSrcPoint());
1086 aSerializer.writeSize(pAction->GetSrcSize());
1087 }
1088}
1089
1091{
1092 if (!pAction->GetBitmapEx().GetBitmap().IsEmpty())
1093 {
1094 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1095 VersionCompatWrite aCompat(mrStream, 1);
1097 TypeSerializer aSerializer(mrStream);
1098 aSerializer.writePoint(pAction->GetPoint());
1099 }
1100}
1101
1103{
1104 if (!pAction->GetBitmapEx().GetBitmap().IsEmpty())
1105 {
1106 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1107 VersionCompatWrite aCompat(mrStream, 1);
1109 TypeSerializer aSerializer(mrStream);
1110 aSerializer.writePoint(pAction->GetPoint());
1111 aSerializer.writeSize(pAction->GetSize());
1112 }
1113}
1114
1115void SvmWriter::BmpExScalePartHandler(const MetaBmpExScalePartAction* pAction)
1116{
1117 if (!pAction->GetBitmapEx().GetBitmap().IsEmpty())
1118 {
1119 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1120 VersionCompatWrite aCompat(mrStream, 1);
1121 WriteDIBBitmapEx(pAction->GetBitmapEx(), mrStream);
1122 TypeSerializer aSerializer(mrStream);
1123 aSerializer.writePoint(pAction->GetDestPoint());
1124 aSerializer.writeSize(pAction->GetDestSize());
1125 aSerializer.writePoint(pAction->GetSrcPoint());
1126 aSerializer.writeSize(pAction->GetSrcSize());
1127 }
1128}
1129
1131{
1132 if (!pAction->GetBitmap().IsEmpty())
1133 {
1134 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1135 VersionCompatWrite aCompat(mrStream, 1);
1136 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1137 TypeSerializer aSerializer(mrStream);
1138 aSerializer.writePoint(pAction->GetPoint());
1139 }
1140}
1141
1143{
1144 if (!pAction->GetBitmap().IsEmpty())
1145 {
1146 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1147 VersionCompatWrite aCompat(mrStream, 1);
1148 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1149 TypeSerializer aSerializer(mrStream);
1150 aSerializer.writePoint(pAction->GetPoint());
1151 aSerializer.writeSize(pAction->GetSize());
1152 }
1153}
1154
1156{
1157 if (!pAction->GetBitmap().IsEmpty())
1158 {
1159 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1160 VersionCompatWrite aCompat(mrStream, 1);
1161 WriteDIB(pAction->GetBitmap(), mrStream, false, true);
1162 WriteColor(pAction->GetColor());
1163 TypeSerializer aSerializer(mrStream);
1164 aSerializer.writePoint(pAction->GetDestPoint());
1165 aSerializer.writeSize(pAction->GetDestSize());
1166 aSerializer.writePoint(pAction->GetSrcPoint());
1167 aSerializer.writeSize(pAction->GetSrcSize());
1168 }
1169}
1170
1172{
1173 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1174 VersionCompatWrite aCompat(mrStream, 1);
1175 TypeSerializer aSerializer(mrStream);
1176 aSerializer.writeRectangle(pAction->GetRect());
1177 aSerializer.writeGradient(pAction->GetGradient());
1178}
1179
1181{
1182 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1183 VersionCompatWrite aCompat(mrStream, 1);
1184
1185 // #i105373# see comment at MetaTransparentAction::Write
1186 tools::PolyPolygon aNoCurvePolyPolygon;
1187 pAction->GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon);
1188
1189 WritePolyPolygon(mrStream, aNoCurvePolyPolygon);
1190 TypeSerializer aSerializer(mrStream);
1191 aSerializer.writeGradient(pAction->GetGradient());
1192}
1193
1195{
1196 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1197 VersionCompatWrite aCompat(mrStream, 1);
1198
1199 // #i105373# see comment at MetaTransparentAction::Write
1200 tools::PolyPolygon aNoCurvePolyPolygon;
1201 pAction->GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon);
1202
1203 WritePolyPolygon(mrStream, aNoCurvePolyPolygon);
1204 WriteHatch(mrStream, pAction->GetHatch());
1205}
1206
1207void SvmWriter::WallpaperHandler(const MetaWallpaperAction* pAction)
1208{
1209 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1210 VersionCompatWrite aCompat(mrStream, 1);
1211
1212 WriteWallpaper(mrStream, pAction->GetWallpaper());
1213}
1214
1216{
1217 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1218 VersionCompatWrite aCompat(mrStream, 1);
1219 WriteRegion(mrStream, pAction->GetRegion());
1220 mrStream.WriteBool(pAction->IsClipping());
1221}
1222
1224{
1225 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1226 VersionCompatWrite aCompat(mrStream, 1);
1227 TypeSerializer aSerializer(mrStream);
1228 aSerializer.writeRectangle(pAction->GetRect());
1229}
1230
1232{
1233 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1234 VersionCompatWrite aCompat(mrStream, 1);
1235 WriteRegion(mrStream, pAction->GetRegion());
1236}
1237
1239{
1240 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1241 VersionCompatWrite aCompat(mrStream, 1);
1242 mrStream.WriteInt32(pAction->GetHorzMove()).WriteInt32(pAction->GetVertMove());
1243}
1244
1246{
1247 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1248 VersionCompatWrite aCompat(mrStream, 1);
1249 WriteColor(pAction->GetColor());
1250 mrStream.WriteBool(pAction->IsSetting());
1251}
1252
1254{
1255 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1256 VersionCompatWrite aCompat(mrStream, 1);
1257 WriteColor(pAction->GetColor());
1258 mrStream.WriteBool(pAction->IsSetting());
1259}
1260
1262{
1263 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1264 VersionCompatWrite aCompat(mrStream, 1);
1265 WriteColor(pAction->GetColor());
1266}
1267
1269{
1270 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1271 VersionCompatWrite aCompat(mrStream, 1);
1272 WriteColor(pAction->GetColor());
1273 mrStream.WriteBool(pAction->IsSetting());
1274}
1275
1277{
1278 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1279 VersionCompatWrite aCompat(mrStream, 1);
1280 WriteColor(pAction->GetColor());
1281 mrStream.WriteBool(pAction->IsSetting());
1282}
1283
1285{
1286 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1287 VersionCompatWrite aCompat(mrStream, 1);
1288 WriteColor(pAction->GetColor());
1289 mrStream.WriteBool(pAction->IsSetting());
1290}
1291
1293{
1294 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1295 VersionCompatWrite aCompat(mrStream, 1);
1296 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetTextAlign()));
1297}
1298
1300{
1301 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1302 VersionCompatWrite aCompat(mrStream, 1);
1303 TypeSerializer aSerializer(mrStream);
1304 aSerializer.writeMapMode(pAction->GetMapMode());
1305}
1306
1308{
1309 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1310 VersionCompatWrite aCompat(mrStream, 1);
1311 WriteFont(mrStream, pAction->GetFont());
1312 pData->meActualCharSet = pAction->GetFont().GetCharSet();
1313 if (pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW)
1314 pData->meActualCharSet = osl_getThreadTextEncoding();
1315}
1316
1318{
1319 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1320 VersionCompatWrite aCompat(mrStream, 1);
1321 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetFlags()));
1322}
1323
1325{
1326 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1327 VersionCompatWrite aCompat(mrStream, 1);
1328}
1329
1331{
1332 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1333 VersionCompatWrite aCompat(mrStream, 1);
1334 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetRasterOp()));
1335}
1336
1338{
1339 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1340 VersionCompatWrite aCompat(mrStream, 1);
1341
1342 // #i105373# The tools::PolyPolygon in this action may be a curve; this
1343 // was ignored until now what is an error. To make older office
1344 // versions work with MetaFiles, i opt for applying AdaptiveSubdivide
1345 // to the PolyPolygon.
1346 // The alternative would be to really write the curve information
1347 // like in MetaPolyPolygonAction::Write (where someone extended it
1348 // correctly, but not here :-( ).
1349 // The golden solution would be to combine both, but i think it's
1350 // not necessary; a good subdivision will be sufficient.
1351 tools::PolyPolygon aNoCurvePolyPolygon;
1352 pAction->GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon);
1353
1354 WritePolyPolygon(mrStream, aNoCurvePolyPolygon);
1356}
1357
1359{
1360 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1361 VersionCompatWrite aCompat(mrStream, 1);
1362
1363 SvmWriter aWriter(mrStream);
1364 GDIMetaFile aMtf = pAction->GetGDIMetaFile();
1365 aWriter.Write(aMtf);
1366 TypeSerializer aSerializer(mrStream);
1367 aSerializer.writePoint(pAction->GetPoint());
1368 aSerializer.writeSize(pAction->GetSize());
1369 aSerializer.writeGradient(pAction->GetGradient());
1370}
1371
1373{
1374 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1375 VersionCompatWrite aCompat(mrStream, 1);
1376
1377 TypeSerializer aSerializer(mrStream);
1378 aSerializer.writeGfxLink(pAction->GetLink());
1379 aSerializer.writePoint(pAction->GetPoint());
1380 aSerializer.writeSize(pAction->GetSize());
1381
1382 SvmWriter aWriter(mrStream);
1383 GDIMetaFile aMtf = pAction->GetSubstitute();
1384 aWriter.Write(aMtf);
1385}
1386
1388{
1389 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1390 VersionCompatWrite aCompat(mrStream, 1);
1391
1392 TypeSerializer aSerializer(mrStream);
1393 aSerializer.writePoint(pAction->GetRefPoint());
1394 mrStream.WriteBool(pAction->IsSetting());
1395}
1396
1398{
1399 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1400 VersionCompatWrite aCompat(mrStream, 1);
1402 mrStream.WriteInt32(pAction->GetValue()).WriteUInt32(pAction->GetDataSize());
1403
1404 if (pAction->GetDataSize())
1405 mrStream.WriteBytes(pAction->GetData(), pAction->GetDataSize());
1406}
1407
1409{
1410 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1411 VersionCompatWrite aCompat(mrStream, 1);
1412 mrStream.WriteUInt32(static_cast<sal_uInt32>(pAction->GetLayoutMode()));
1413}
1414
1416{
1417 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
1418 VersionCompatWrite aCompat(mrStream, 1);
1419 mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetTextLanguage()));
1420}
1421/* 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:230
Bitmap GetBitmap(Color aTransparentReplaceColor) const
Definition: BitmapEx.cxx:203
BitmapChecksum GetChecksum() const
bool IsEmpty() const
size_t GetActionSize() const
Definition: gdimtf.cxx:179
const Size & GetPrefSize() const
Definition: gdimtf.hxx:172
MetaAction * GetAction(size_t nAction) const
Definition: gdimtf.cxx:184
const MapMode & GetPrefMapMode() const
Definition: gdimtf.hxx:175
MetaActionType GetType() const
Definition: metaact.hxx:94
const Point & GetStartPoint() const
Definition: metaact.hxx:306
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:305
const Point & GetEndPoint() const
Definition: metaact.hxx:307
const Bitmap & GetBitmap() const
Definition: metaact.hxx:684
const Point & GetPoint() const
Definition: metaact.hxx:685
const BitmapEx & GetBitmapEx() const
Definition: metaact.hxx:789
const Point & GetPoint() const
Definition: metaact.hxx:790
const Size & GetSize() const
Definition: metaact.hxx:824
const Point & GetPoint() const
Definition: metaact.hxx:823
const BitmapEx & GetBitmapEx() const
Definition: metaact.hxx:822
const Point & GetPoint() const
Definition: metaact.hxx:717
const Size & GetSize() const
Definition: metaact.hxx:718
const Bitmap & GetBitmap() const
Definition: metaact.hxx:716
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:373
const Point & GetStartPoint() const
Definition: metaact.hxx:374
const Point & GetEndPoint() const
Definition: metaact.hxx:375
const vcl::Region & GetRegion() const
Definition: metaact.hxx:1133
bool IsClipping() const
Definition: metaact.hxx:1134
sal_Int32 GetValue() const
Definition: metaact.hxx:1693
const sal_uInt8 * GetData() const
Definition: metaact.hxx:1695
const OString & GetComment() const
Definition: metaact.hxx:1692
sal_uInt32 GetDataSize() const
Definition: metaact.hxx:1694
const GDIMetaFile & GetSubstitute() const
Definition: metaact.hxx:1630
const Point & GetPoint() const
Definition: metaact.hxx:1631
const Size & GetSize() const
Definition: metaact.hxx:1632
const GfxLink & GetLink() const
Definition: metaact.hxx:1629
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:275
const Color & GetColor() const
Definition: metaact.hxx:1270
bool IsSetting() const
Definition: metaact.hxx:1271
const Gradient & GetGradient() const
Definition: metaact.hxx:1594
const Size & GetSize() const
Definition: metaact.hxx:1593
const GDIMetaFile & GetGDIMetaFile() const
Definition: metaact.hxx:1591
const Point & GetPoint() const
Definition: metaact.hxx:1592
const vcl::Font & GetFont() const
Definition: metaact.hxx:1463
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:1013
const Gradient & GetGradient() const
Definition: metaact.hxx:1014
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1043
const Gradient & GetGradient() const
Definition: metaact.hxx:1044
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1073
const Hatch & GetHatch() const
Definition: metaact.hxx:1074
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:1162
const vcl::Region & GetRegion() const
Definition: metaact.hxx:1189
vcl::text::ComplexTextLayoutFlags GetLayoutMode() const
Definition: metaact.hxx:1722
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:185
const Point & GetEndPoint() const
Definition: metaact.hxx:184
const Point & GetStartPoint() const
Definition: metaact.hxx:183
bool IsSetting() const
Definition: metaact.hxx:1244
const Color & GetColor() const
Definition: metaact.hxx:1243
const MapMode & GetMapMode() const
Definition: metaact.hxx:1429
const Point & GetPoint() const
Definition: metaact.hxx:902
const Bitmap & GetBitmap() const
Definition: metaact.hxx:900
const Color & GetColor() const
Definition: metaact.hxx:901
const Bitmap & GetBitmap() const
Definition: metaact.hxx:935
const Point & GetPoint() const
Definition: metaact.hxx:937
const Color & GetColor() const
Definition: metaact.hxx:936
const Size & GetSize() const
Definition: metaact.hxx:938
const Bitmap & GetBitmap() const
Definition: metaact.hxx:975
const Point & GetSrcPoint() const
Definition: metaact.hxx:979
const Color & GetColor() const
Definition: metaact.hxx:976
const Size & GetSrcSize() const
Definition: metaact.hxx:980
const Point & GetDestPoint() const
Definition: metaact.hxx:977
const Size & GetDestSize() const
Definition: metaact.hxx:978
tools::Long GetVertMove() const
Definition: metaact.hxx:1217
tools::Long GetHorzMove() const
Definition: metaact.hxx:1216
const Color & GetColor() const
Definition: metaact.hxx:1377
bool IsSetting() const
Definition: metaact.hxx:1380
const Point & GetEndPoint() const
Definition: metaact.hxx:341
const Point & GetStartPoint() const
Definition: metaact.hxx:340
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:339
const Point & GetPoint() const
Definition: metaact.hxx:124
const Color & GetColor() const
Definition: metaact.hxx:125
const Point & GetPoint() const
Definition: metaact.hxx:152
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:407
const tools::Polygon & GetPolygon() const
Definition: metaact.hxx:406
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:462
const tools::Polygon & GetPolygon() const
Definition: metaact.hxx:435
vcl::PushFlags GetFlags() const
Definition: metaact.hxx:1488
RasterOp GetRasterOp() const
Definition: metaact.hxx:1528
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:214
bool IsSetting() const
Definition: metaact.hxx:1663
const Point & GetRefPoint() const
Definition: metaact.hxx:1660
sal_uInt32 GetHorzRound() const
Definition: metaact.hxx:245
sal_uInt32 GetVertRound() const
Definition: metaact.hxx:246
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:244
sal_uInt32 GetWidth() const
Definition: metaact.hxx:575
sal_Int32 GetLen() const
Definition: metaact.hxx:577
sal_Int32 GetIndex() const
Definition: metaact.hxx:576
const OUString & GetText() const
Definition: metaact.hxx:574
const Point & GetPoint() const
Definition: metaact.hxx:573
const Point & GetPoint() const
Definition: metaact.hxx:493
sal_Int32 GetLen() const
Definition: metaact.hxx:496
const OUString & GetText() const
Definition: metaact.hxx:494
sal_Int32 GetIndex() const
Definition: metaact.hxx:495
TextAlign GetTextAlign() const
Definition: metaact.hxx:1403
const Color & GetColor() const
Definition: metaact.hxx:1297
bool IsSetting() const
Definition: metaact.hxx:1325
const Color & GetColor() const
Definition: metaact.hxx:1322
LanguageType GetTextLanguage() const
Definition: metaact.hxx:1746
const Point & GetStartPoint() const
Definition: metaact.hxx:648
tools::Long GetWidth() const
Definition: metaact.hxx:649
FontLineStyle GetUnderline() const
Definition: metaact.hxx:651
FontLineStyle GetOverline() const
Definition: metaact.hxx:652
FontStrikeout GetStrikeout() const
Definition: metaact.hxx:650
bool IsSetting() const
Definition: metaact.hxx:1353
const Color & GetColor() const
Definition: metaact.hxx:1350
DrawTextFlags GetStyle() const
Definition: metaact.hxx:613
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:611
const OUString & GetText() const
Definition: metaact.hxx:612
sal_uInt16 GetTransparence() const
Definition: metaact.hxx:1557
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1556
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const void * GetData()
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 & 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:1330
void PopHandler(const MetaPopAction *pAction)
Definition: SvmWriter.cxx:1324
void BmpExHandler(const MetaBmpExAction *pAction)
Definition: SvmWriter.cxx:1090
void EPSHandler(const MetaEPSAction *pAction)
Definition: SvmWriter.cxx:1372
void BmpScalePartHandler(const MetaBmpScalePartAction *pAction)
Definition: SvmWriter.cxx:1075
void ISectRegionClipRegionHandler(const MetaISectRegionClipRegionAction *pAction)
Definition: SvmWriter.cxx:1231
void OverlineColorHandler(const MetaOverlineColorAction *pAction)
Definition: SvmWriter.cxx:1284
void EllipseHandler(const MetaEllipseAction *pAction)
Definition: SvmWriter.cxx:859
void BmpExScalePartHandler(const MetaBmpExScalePartAction *pAction)
Definition: SvmWriter.cxx:1115
void BmpExScaleHandler(const MetaBmpExScaleAction *pAction)
Definition: SvmWriter.cxx:1102
void CommentHandler(const MetaCommentAction *pAction)
Definition: SvmWriter.cxx:1397
void MaskHandler(const MetaMaskAction *pAction)
Definition: SvmWriter.cxx:1130
void TextLineColorHandler(const MetaTextLineColorAction *pAction)
Definition: SvmWriter.cxx:1276
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:1415
void PushHandler(const MetaPushAction *pAction)
Definition: SvmWriter.cxx:1317
void TextFillColorHandler(const MetaTextFillColorAction *pAction)
Definition: SvmWriter.cxx:1268
void BmpScaleHandler(const MetaBmpScaleAction *pAction)
Definition: SvmWriter.cxx:1062
void WallpaperHandler(const MetaWallpaperAction *pAction)
Definition: SvmWriter.cxx:1207
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:1245
void MaskScalePartHandler(const MetaMaskScalePartAction *pAction)
Definition: SvmWriter.cxx:1155
void PolyLineHandler(const MetaPolyLineAction *pAction)
Definition: SvmWriter.cxx:901
void MaskScaleHandler(const MetaMaskScaleAction *pAction)
Definition: SvmWriter.cxx:1142
void TransparentHandler(const MetaTransparentAction *pAction)
Definition: SvmWriter.cxx:1337
void RefPointHandler(const MetaRefPointAction *pAction)
Definition: SvmWriter.cxx:1387
void HatchHandler(const MetaHatchAction *pAction)
Definition: SvmWriter.cxx:1194
void TextLineHandler(const MetaTextLineAction *pAction)
Definition: SvmWriter.cxx:1034
void StretchTextHandler(const MetaStretchTextAction *pAction, const ImplMetaWriteData *pData)
Definition: SvmWriter.cxx:1005
void LayoutModeHandler(const MetaLayoutModeAction *pAction)
Definition: SvmWriter.cxx:1408
void FillColorHandler(const MetaFillColorAction *pAction)
Definition: SvmWriter.cxx:1253
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:1050
void ClipRegionHandler(const MetaClipRegionAction *pAction)
Definition: SvmWriter.cxx:1215
void PolygonHandler(const MetaPolygonAction *pAction)
Definition: SvmWriter.cxx:919
void TextAlignHandler(const MetaTextAlignAction *pAction)
Definition: SvmWriter.cxx:1292
void TextColorHandler(const MetaTextColorAction *pAction)
Definition: SvmWriter.cxx:1261
void MapModeHandler(const MetaMapModeAction *pAction)
Definition: SvmWriter.cxx:1299
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:1223
void PixelHandler(const MetaPixelAction *pAction)
Definition: SvmWriter.cxx:809
void TextRectHandler(const MetaTextRectAction *pAction, const ImplMetaWriteData *pData)
Definition: SvmWriter.cxx:1021
void MoveClipRegionHandler(const MetaMoveClipRegionAction *pAction)
Definition: SvmWriter.cxx:1238
void GradientExHandler(const MetaGradientExAction *pAction)
Definition: SvmWriter.cxx:1180
void GradientHandler(const MetaGradientAction *pAction)
Definition: SvmWriter.cxx:1171
void ActionHandler(const MetaAction *pAction)
Definition: SvmWriter.cxx:804
void FloatTransparentHandler(const MetaFloatTransparentAction *pAction)
Definition: SvmWriter.cxx:1358
void FontHandler(const MetaFontAction *pAction, ImplMetaWriteData *pData)
Definition: SvmWriter.cxx:1307
void PolyPolygonHandler(const MetaPolyPolygonAction *pAction)
Definition: SvmWriter.cxx:935
void writeGradient(const Gradient &rGradient)
void writeMapMode(MapMode const &rMapMode)
void writeGfxLink(const GfxLink &rGfxLink)
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:887
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:1849
bool WriteDIB(const Bitmap &rSource, SvStream &rOStm, bool bCompressed, bool bFileHeader)
Definition: dibtools.cxx:1832
SvStream & WriteFont(SvStream &rOStm, const vcl::Font &rFont)
Definition: font/font.cxx:623
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:65
unsigned char sal_uInt8
SvStream & WriteWallpaper(SvStream &rOStm, const Wallpaper &rImplWallpaper)
Definition: wall.cxx:82