LibreOffice Module vcl (master)  1
svmconverter.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <algorithm>
21 #include <string.h>
22 #include <osl/thread.h>
23 #include <tools/fract.hxx>
24 #include <tools/stream.hxx>
25 #include <vcl/dibtools.hxx>
26 #include <vcl/virdev.hxx>
27 #include <vcl/lineinfo.hxx>
28 #include <vcl/metaact.hxx>
29 #include <sal/log.hxx>
30 #include <osl/diagnose.h>
31 
32 #include <TypeSerializer.hxx>
33 #include <svmconverter.hxx>
34 #include <memory>
35 #include <stack>
36 
37 // Inlines
38 static void ImplReadRect( SvStream& rIStm, tools::Rectangle& rRect )
39 {
40  Point aTL;
41  Point aBR;
42 
43  TypeSerializer aSerializer(rIStm);
44  aSerializer.readPoint(aTL);
45  aSerializer.readPoint(aBR);
46 
47  rRect = tools::Rectangle( aTL, aBR );
48 }
49 
50 static bool ImplReadPoly(SvStream& rIStm, tools::Polygon& rPoly)
51 {
52  TypeSerializer aSerializer(rIStm);
53 
54  sal_Int32 nSize32(0);
55  rIStm.ReadInt32(nSize32);
56  sal_uInt16 nSize = nSize32;
57 
58  const size_t nMaxPossiblePoints = rIStm.remainingSize() / 2 * sizeof(sal_Int32);
59  if (nSize > nMaxPossiblePoints)
60  {
61  SAL_WARN("vcl.gdi", "svm record claims to have: " << nSize << " points, but only " << nMaxPossiblePoints << " possible");
62  return false;
63  }
64 
65  rPoly = tools::Polygon(nSize);
66 
67  for (sal_uInt16 i = 0; i < nSize && rIStm.good(); ++i)
68  {
69  aSerializer.readPoint(rPoly[i]);
70  }
71  return rIStm.good();
72 }
73 
74 static bool ImplReadPolyPoly(SvStream& rIStm, tools::PolyPolygon& rPolyPoly)
75 {
76  bool bSuccess = true;
77 
78  tools::Polygon aPoly;
79  sal_Int32 nPolyCount32(0);
80  rIStm.ReadInt32(nPolyCount32);
81  sal_uInt16 nPolyCount = static_cast<sal_uInt16>(nPolyCount32);
82 
83  for (sal_uInt16 i = 0; i < nPolyCount && rIStm.good(); ++i)
84  {
85  if (!ImplReadPoly(rIStm, aPoly))
86  {
87  bSuccess = false;
88  break;
89  }
90  rPolyPoly.Insert(aPoly);
91  }
92 
93  return bSuccess && rIStm.good();
94 }
95 
96 static void ImplReadColor( SvStream& rIStm, Color& rColor )
97 {
98  sal_Int16 nVal(0);
99 
100  rIStm.ReadInt16( nVal ); rColor.SetRed( sal::static_int_cast<sal_uInt8>(static_cast<sal_uInt16>(nVal) >> 8) );
101  rIStm.ReadInt16( nVal ); rColor.SetGreen( sal::static_int_cast<sal_uInt8>(static_cast<sal_uInt16>(nVal) >> 8) );
102  rIStm.ReadInt16( nVal ); rColor.SetBlue( sal::static_int_cast<sal_uInt8>(static_cast<sal_uInt16>(nVal) >> 8) );
103 }
104 
105 static bool ImplReadMapMode(SvStream& rIStm, MapMode& rMapMode)
106 {
107  sal_Int16 nUnit(0);
108  rIStm.ReadInt16(nUnit);
109 
110  Point aOrg;
111  TypeSerializer aSerializer(rIStm);
112  aSerializer.readPoint(aOrg);
113 
114  sal_Int32 nXNum(0), nXDenom(0), nYNum(0), nYDenom(0);
115  rIStm.ReadInt32(nXNum).ReadInt32(nXDenom).ReadInt32(nYNum).ReadInt32(nYDenom);
116 
117  if (!rIStm.good() || nXDenom <= 0 || nYDenom <= 0 || nXNum <= 0 || nYNum <= 0)
118  {
119  SAL_WARN("vcl.gdi", "Parsing error: invalid mapmode fraction");
120  return false;
121  }
122 
123  if (nUnit < sal_Int16(MapUnit::Map100thMM) || nUnit > sal_Int16(MapUnit::LAST))
124  {
125  SAL_WARN("vcl.gdi", "Parsing error: invalid mapmode");
126  return false;
127  }
128 
129  rMapMode = MapMode(static_cast<MapUnit>(nUnit), aOrg, Fraction(nXNum, nXDenom), Fraction(nYNum, nYDenom));
130 
131  return true;
132 }
133 
134 static void ImplReadUnicodeComment( sal_uInt32 nStrmPos, SvStream& rIStm, OUString& rString )
135 {
136  sal_uInt32 nOld = rIStm.Tell();
137  if ( nStrmPos )
138  {
139  sal_uInt16 nType;
140  sal_uInt32 nActionSize;
141  std::size_t nStringLen;
142 
143  rIStm.Seek( nStrmPos );
144  rIStm .ReadUInt16( nType )
145  .ReadUInt32( nActionSize );
146 
147  nStringLen = (nActionSize - 4) >> 1;
148 
149  if ( nStringLen && ( nType == GDI_UNICODE_COMMENT ) )
150  rString = read_uInt16s_ToOUString(rIStm, nStringLen);
151  }
152  rIStm.Seek( nOld );
153 }
154 
155 static void ImplSkipActions(SvStream& rIStm, sal_uLong nSkipCount)
156 {
157  sal_Int32 nActionSize;
158  sal_Int16 nType;
159  for (sal_uLong i = 0; i < nSkipCount; ++i)
160  {
161  rIStm.ReadInt16(nType).ReadInt32(nActionSize);
162  if (!rIStm.good() || nActionSize < 4)
163  break;
164  rIStm.SeekRel(nActionSize - 4);
165  }
166 }
167 
169 {
170  TypeSerializer aSerializer(rIStm);
171 
172  rPolyPoly.Clear();
173  sal_uInt16 nPolygonCount(0);
174  rIStm.ReadUInt16( nPolygonCount );
175 
176  if (!nPolygonCount)
177  return;
178 
179  const size_t nMinRecordSize = sizeof(sal_uInt16);
180  const size_t nMaxRecords = rIStm.remainingSize() / nMinRecordSize;
181  if (nPolygonCount > nMaxRecords)
182  {
183  SAL_WARN("vcl.gdi", "Parsing error: " << nMaxRecords <<
184  " max possible entries, but " << nPolygonCount << " claimed, truncating");
185  nPolygonCount = nMaxRecords;
186  }
187 
188  for(sal_uInt16 a(0); a < nPolygonCount; a++)
189  {
190  sal_uInt16 nPointCount(0);
191  rIStm.ReadUInt16(nPointCount);
192 
193  const size_t nMinPolygonSize = sizeof(sal_Int32) * 2;
194  const size_t nMaxPolygons = rIStm.remainingSize() / nMinPolygonSize;
195  if (nPointCount > nMaxPolygons)
196  {
197  SAL_WARN("vcl.gdi", "Parsing error: " << nMaxPolygons <<
198  " max possible entries, but " << nPointCount << " claimed, truncating");
199  nPointCount = nMaxPolygons;
200  }
201 
202  tools::Polygon aCandidate(nPointCount);
203 
204  if (nPointCount)
205  {
206  for(sal_uInt16 b(0); b < nPointCount; b++)
207  {
208  aSerializer.readPoint(aCandidate[b]);
209  }
210 
211  sal_uInt8 bHasFlags(int(false));
212  rIStm.ReadUChar( bHasFlags );
213 
214  if(bHasFlags)
215  {
216  sal_uInt8 aPolyFlags(0);
217 
218  for(sal_uInt16 c(0); c < nPointCount; c++)
219  {
220  rIStm.ReadUChar( aPolyFlags );
221  aCandidate.SetFlags(c, static_cast<PolyFlags>(aPolyFlags));
222  }
223  }
224  }
225 
226  rPolyPoly.Insert(aCandidate);
227  }
228 }
229 
231 {
232  if( !rStm.GetError() )
233  {
234  ImplConvertFromSVM1( rStm, rMtf );
235  }
236 }
237 
238 namespace
239 {
240  sal_Int32 SkipActions(sal_Int32 i, sal_Int32 nFollowingActionCount, sal_Int32 nActions)
241  {
242  sal_Int32 remainingActions = nActions - i;
243  if (nFollowingActionCount < 0)
244  nFollowingActionCount = remainingActions;
245  return std::min(remainingActions, nFollowingActionCount);
246  }
247 }
248 
249 #define LF_FACESIZE 32
250 
251 void static lcl_error( SvStream& rIStm, const SvStreamEndian& nOldFormat, sal_uLong nPos)
252 {
254  rIStm.SetEndian(nOldFormat);
255  rIStm.Seek(nPos);
256  return;
257 }
259 {
260  const sal_uLong nPos = rIStm.Tell();
261  const SvStreamEndian nOldFormat = rIStm.GetEndian();
262 
263  rIStm.SetEndian( SvStreamEndian::LITTLE );
264 
265  char aCode[ 5 ];
266  Size aPrefSz;
267 
268  // read header
269  rIStm.ReadBytes(aCode, sizeof(aCode)); // Identifier
270  sal_Int16 nSize(0);
271  rIStm.ReadInt16( nSize ); // Size
272  sal_Int16 nVersion(0);
273  rIStm.ReadInt16( nVersion ); // Version
274  sal_Int32 nTmp32(0);
275  rIStm.ReadInt32( nTmp32 );
276  if (nTmp32 < 0)
277  {
278  SAL_WARN("vcl.gdi", "svm: value for width should be positive");
279  lcl_error(rIStm, nOldFormat, nPos);
280  return;
281  }
282  aPrefSz.setWidth( nTmp32 ); // PrefSize.Width()
283  rIStm.ReadInt32( nTmp32 );
284  if (nTmp32 < 0)
285  {
286  SAL_WARN("vcl.gdi", "svm: value for height should be positive");
287  lcl_error(rIStm, nOldFormat, nPos);
288  return;
289  }
290  aPrefSz.setHeight( nTmp32 ); // PrefSize.Height()
291 
292  // check header-magic and version
293  if( rIStm.GetError()
294  || ( memcmp( aCode, "SVGDI", sizeof( aCode ) ) != 0 )
295  || ( nVersion != 200 ) )
296  {
297  SAL_WARN("vcl.gdi", "svm: wrong check for header-magic and version");
298  lcl_error(rIStm, nOldFormat, nPos);
299  return;
300  }
301 
302  LineInfo aLineInfo( LineStyle::NONE, 0 );
303  std::stack<std::unique_ptr<LineInfo>> aLIStack;
305  rtl_TextEncoding eActualCharSet = osl_getThreadTextEncoding();
306  bool bFatLine = false;
307 
308  tools::Polygon aActionPoly;
309  tools::Rectangle aRect;
310  Point aPt, aPt1;
311  Size aSz;
312  Color aActionColor;
313 
314  sal_uInt32 nUnicodeCommentStreamPos = 0;
315  sal_Int32 nUnicodeCommentActionNumber = 0;
316 
317  rMtf.SetPrefSize(aPrefSz);
318 
319  MapMode aMapMode;
320  if (ImplReadMapMode(rIStm, aMapMode)) // MapMode
321  rMtf.SetPrefMapMode(aMapMode);
322 
323  sal_Int32 nActions(0);
324  rIStm.ReadInt32(nActions); // Action count
325  if (nActions < 0)
326  {
327  SAL_WARN("vcl.gdi", "svm claims negative action count (" << nActions << ")");
328  nActions = 0;
329  }
330 
331  const size_t nMinActionSize = sizeof(sal_uInt16) + sizeof(sal_Int32);
332  const size_t nMaxPossibleActions = rIStm.remainingSize() / nMinActionSize;
333  if (static_cast<sal_uInt32>(nActions) > nMaxPossibleActions)
334  {
335  SAL_WARN("vcl.gdi", "svm claims more actions (" << nActions << ") than stream could provide, truncating");
336  nActions = nMaxPossibleActions;
337  }
338 
339  size_t nLastPolygonAction(0);
340 
341  TypeSerializer aSerializer(rIStm);
342 
343  for (sal_Int32 i = 0; i < nActions && rIStm.good(); ++i)
344  {
345  sal_Int16 nType(0);
346  rIStm.ReadInt16(nType);
347  sal_Int32 nActBegin = rIStm.Tell();
348  sal_Int32 nActionSize(0);
349  rIStm.ReadInt32(nActionSize);
350 
351  SAL_WARN_IF( ( nType > 33 ) && ( nType < 1024 ), "vcl.gdi", "Unknown GDIMetaAction while converting!" );
352 
353  switch( nType )
354  {
355  case GDI_PIXEL_ACTION:
356  {
357  aSerializer.readPoint(aPt);
358  ImplReadColor( rIStm, aActionColor );
359  rMtf.AddAction( new MetaPixelAction( aPt, aActionColor ) );
360  }
361  break;
362 
363  case GDI_POINT_ACTION:
364  {
365  aSerializer.readPoint(aPt);
366  rMtf.AddAction( new MetaPointAction( aPt ) );
367  }
368  break;
369 
370  case GDI_LINE_ACTION:
371  {
372  aSerializer.readPoint(aPt);
373  aSerializer.readPoint(aPt1);
374  rMtf.AddAction( new MetaLineAction( aPt, aPt1, aLineInfo ) );
375  }
376  break;
377 
378  case GDI_LINEJOIN_ACTION :
379  {
380  sal_Int16 nLineJoin(0);
381  rIStm.ReadInt16( nLineJoin );
382  aLineInfo.SetLineJoin(static_cast<basegfx::B2DLineJoin>(nLineJoin));
383  }
384  break;
385 
386  case GDI_LINECAP_ACTION :
387  {
388  sal_Int16 nLineCap(0);
389  rIStm.ReadInt16( nLineCap );
390  aLineInfo.SetLineCap(static_cast<css::drawing::LineCap>(nLineCap));
391  }
392  break;
393 
395  {
396  sal_Int16 a(0);
397  sal_Int32 b(0);
398 
399  rIStm.ReadInt16( a ); aLineInfo.SetDashCount(a);
400  rIStm.ReadInt32( b ); aLineInfo.SetDashLen(b);
401  rIStm.ReadInt16( a ); aLineInfo.SetDotCount(a);
402  rIStm.ReadInt32( b ); aLineInfo.SetDotLen(b);
403  rIStm.ReadInt32( b ); aLineInfo.SetDistance(b);
404 
405  if(((aLineInfo.GetDashCount() && aLineInfo.GetDashLen())
406  || (aLineInfo.GetDotCount() && aLineInfo.GetDotLen()))
407  && aLineInfo.GetDistance())
408  {
409  aLineInfo.SetStyle(LineStyle::Dash);
410  }
411  }
412  break;
413 
415  {
416  // read the tools::PolyPolygon in every case
417  tools::PolyPolygon aInputPolyPolygon;
418  ImplReadExtendedPolyPolygonAction(rIStm, aInputPolyPolygon);
419 
420  // now check if it can be set somewhere
421  if(nLastPolygonAction < rMtf.GetActionSize())
422  {
423  MetaPolyLineAction* pPolyLineAction = dynamic_cast< MetaPolyLineAction* >(rMtf.GetAction(nLastPolygonAction));
424 
425  if(pPolyLineAction)
426  {
427  // replace MetaPolyLineAction when we have a single polygon. Do not rely on the
428  // same point count; the originally written GDI_POLYLINE_ACTION may have been
429  // Subdivided for better quality for older usages
430  if(1 == aInputPolyPolygon.Count())
431  {
432  rMtf.ReplaceAction(
433  new MetaPolyLineAction(
434  aInputPolyPolygon.GetObject(0),
435  pPolyLineAction->GetLineInfo()),
436  nLastPolygonAction);
437  }
438  }
439  else
440  {
441  MetaPolyPolygonAction* pPolyPolygonAction = dynamic_cast< MetaPolyPolygonAction* >(rMtf.GetAction(nLastPolygonAction));
442 
443  if(pPolyPolygonAction)
444  {
445  // replace MetaPolyPolygonAction when we have a curved polygon. Do rely on the
446  // same sub-polygon count
447  if(pPolyPolygonAction->GetPolyPolygon().Count() == aInputPolyPolygon.Count())
448  {
449  rMtf.ReplaceAction(
451  aInputPolyPolygon),
452  nLastPolygonAction);
453  }
454  }
455  else
456  {
457  MetaPolygonAction* pPolygonAction = dynamic_cast< MetaPolygonAction* >(rMtf.GetAction(nLastPolygonAction));
458 
459  if(pPolygonAction)
460  {
461  // replace MetaPolygonAction
462  if(1 == aInputPolyPolygon.Count())
463  {
464  rMtf.ReplaceAction(
465  new MetaPolygonAction(
466  aInputPolyPolygon.GetObject(0)),
467  nLastPolygonAction);
468  }
469  }
470  }
471  }
472  }
473  }
474  break;
475 
476  case GDI_RECT_ACTION:
477  {
478  ImplReadRect( rIStm, aRect );
479  sal_Int32 nTmp(0), nTmp1(0);
480  rIStm.ReadInt32( nTmp ).ReadInt32( nTmp1 );
481 
482  if( nTmp || nTmp1 )
483  rMtf.AddAction( new MetaRoundRectAction( aRect, nTmp, nTmp1 ) );
484  else
485  {
486  rMtf.AddAction( new MetaRectAction( aRect ) );
487 
488  if( bFatLine )
489  rMtf.AddAction( new MetaPolyLineAction( aRect, aLineInfo ) );
490  }
491  }
492  break;
493 
494  case GDI_ELLIPSE_ACTION:
495  {
496  ImplReadRect( rIStm, aRect );
497 
498  if( bFatLine )
499  {
500  const tools::Polygon aPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
501 
503  rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, false ) );
504  rMtf.AddAction( new MetaPolygonAction( aPoly ) );
505  rMtf.AddAction( new MetaPopAction() );
506  rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
507  }
508  else
509  rMtf.AddAction( new MetaEllipseAction( aRect ) );
510  }
511  break;
512 
513  case GDI_ARC_ACTION:
514  {
515  ImplReadRect( rIStm, aRect );
516  aSerializer.readPoint(aPt);
517  aSerializer.readPoint(aPt1);
518 
519  if( bFatLine )
520  {
521  const tools::Polygon aPoly( aRect, aPt, aPt1, PolyStyle::Arc );
522 
524  rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, false ) );
525  rMtf.AddAction( new MetaPolygonAction( aPoly ) );
526  rMtf.AddAction( new MetaPopAction() );
527  rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
528  }
529  else
530  rMtf.AddAction( new MetaArcAction( aRect, aPt, aPt1 ) );
531  }
532  break;
533 
534  case GDI_PIE_ACTION:
535  {
536  ImplReadRect( rIStm, aRect );
537  aSerializer.readPoint(aPt);
538  aSerializer.readPoint(aPt1);
539 
540  if( bFatLine )
541  {
542  const tools::Polygon aPoly( aRect, aPt, aPt1, PolyStyle::Pie );
543 
545  rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, false ) );
546  rMtf.AddAction( new MetaPolygonAction( aPoly ) );
547  rMtf.AddAction( new MetaPopAction() );
548  rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
549  }
550  else
551  rMtf.AddAction( new MetaPieAction( aRect, aPt, aPt1 ) );
552  }
553  break;
554 
557  {
558  ImplReadRect( rIStm, aRect );
561  rMtf.AddAction( new MetaRectAction( aRect ) );
562  rMtf.AddAction( new MetaPopAction() );
563  }
564  break;
565 
566  case GDI_POLYLINE_ACTION:
567  {
568  if (ImplReadPoly(rIStm, aActionPoly))
569  {
570  nLastPolygonAction = rMtf.GetActionSize();
571 
572  if( bFatLine )
573  rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) );
574  else
575  rMtf.AddAction( new MetaPolyLineAction( aActionPoly ) );
576  }
577  }
578  break;
579 
580  case GDI_POLYGON_ACTION:
581  {
582  if (ImplReadPoly(rIStm, aActionPoly))
583  {
584  if( bFatLine )
585  {
587  rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, false ) );
588  rMtf.AddAction( new MetaPolygonAction( aActionPoly ) );
589  rMtf.AddAction( new MetaPopAction() );
590  rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) );
591  }
592  else
593  {
594  nLastPolygonAction = rMtf.GetActionSize();
595  rMtf.AddAction( new MetaPolygonAction( aActionPoly ) );
596  }
597  }
598  }
599  break;
600 
602  {
603  tools::PolyPolygon aPolyPoly;
604 
605  if (ImplReadPolyPoly(rIStm, aPolyPoly))
606  {
607  if( bFatLine )
608  {
610  rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, false ) );
611  rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
612  rMtf.AddAction( new MetaPopAction() );
613 
614  for( sal_uInt16 nPoly = 0, nCount = aPolyPoly.Count(); nPoly < nCount; nPoly++ )
615  rMtf.AddAction( new MetaPolyLineAction( aPolyPoly[ nPoly ], aLineInfo ) );
616  }
617  else
618  {
619  nLastPolygonAction = rMtf.GetActionSize();
620  rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
621  }
622  }
623  }
624  break;
625 
626  case GDI_FONT_ACTION:
627  {
628  vcl::Font aFont;
629  char aName[LF_FACESIZE+1];
630 
631  ImplReadColor( rIStm, aActionColor ); aFont.SetColor( aActionColor );
632  ImplReadColor( rIStm, aActionColor ); aFont.SetFillColor( aActionColor );
633  size_t nRet = rIStm.ReadBytes(aName, LF_FACESIZE);
634  aName[nRet] = 0;
635  aFont.SetFamilyName( OUString( aName, strlen(aName), rIStm.GetStreamCharSet() ) );
636 
637  sal_Int32 nWidth(0), nHeight(0);
638  rIStm.ReadInt32(nWidth).ReadInt32(nHeight);
639  sal_Int16 nCharOrient(0), nLineOrient(0);
640  rIStm.ReadInt16(nCharOrient).ReadInt16(nLineOrient);
641  sal_Int16 nCharSet(0), nFamily(0), nPitch(0), nAlign(0), nWeight(0), nUnderline(0), nStrikeout(0);
642  rIStm.ReadInt16(nCharSet).ReadInt16(nFamily).ReadInt16(nPitch).ReadInt16(nAlign).ReadInt16(nWeight).ReadInt16(nUnderline).ReadInt16(nStrikeout);
643  bool bItalic(false), bOutline(false), bShadow(false), bTransparent(false);
644  rIStm.ReadCharAsBool(bItalic).ReadCharAsBool(bOutline).ReadCharAsBool(bShadow).ReadCharAsBool(bTransparent);
645 
646  aFont.SetFontSize( Size( nWidth, nHeight ) );
647  aFont.SetCharSet( static_cast<rtl_TextEncoding>(nCharSet) );
648  aFont.SetFamily( static_cast<FontFamily>(nFamily) );
649  aFont.SetPitch( static_cast<FontPitch>(nPitch) );
650  aFont.SetAlignment( static_cast<FontAlign>(nAlign) );
651  aFont.SetWeight( ( nWeight == 1 ) ? WEIGHT_LIGHT : ( nWeight == 2 ) ? WEIGHT_NORMAL :
652  ( nWeight == 3 ) ? WEIGHT_BOLD : WEIGHT_DONTKNOW );
653  aFont.SetUnderline( static_cast<FontLineStyle>(nUnderline) );
654  aFont.SetStrikeout( static_cast<FontStrikeout>(nStrikeout) );
655  aFont.SetItalic( bItalic ? ITALIC_NORMAL : ITALIC_NONE );
656  aFont.SetOutline( bOutline );
657  aFont.SetShadow( bShadow );
658  aFont.SetOrientation( nLineOrient );
659  aFont.SetTransparent( bTransparent );
660 
661  eActualCharSet = aFont.GetCharSet();
662  if ( eActualCharSet == RTL_TEXTENCODING_DONTKNOW )
663  eActualCharSet = osl_getThreadTextEncoding();
664 
665  rMtf.AddAction( new MetaFontAction( aFont ) );
666  rMtf.AddAction( new MetaTextAlignAction( aFont.GetAlignment() ) );
667  rMtf.AddAction( new MetaTextColorAction( aFont.GetColor() ) );
668  rMtf.AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) );
669 
670  // #106172# Track font relevant data in shadow VDev
671  aFontVDev->SetFont( aFont );
672  }
673  break;
674 
675  case GDI_TEXT_ACTION:
676  {
677  sal_Int32 nIndex(0), nLen(0), nTmp(0);
678  aSerializer.readPoint(aPt);
679  rIStm.ReadInt32( nIndex ).ReadInt32( nLen ).ReadInt32( nTmp );
680  if (nTmp > 0)
681  {
682  OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
683  sal_uInt8 nTerminator = 0;
684  rIStm.ReadUChar( nTerminator );
685  SAL_WARN_IF( nTerminator != 0, "vcl.gdi", "expected string to be NULL terminated" );
686 
687  OUString aStr(OStringToOUString(aByteStr, eActualCharSet));
688  if ( nUnicodeCommentActionNumber == i )
689  ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
690  rMtf.AddAction( new MetaTextAction( aPt, aStr, nIndex, nLen ) );
691  }
692 
693  if (nActionSize < 24)
695  else
696  rIStm.Seek(nActBegin + nActionSize);
697  }
698  break;
699 
701  {
702  sal_Int32 nIndex(0), nLen(0), nAryLen(0), nTmp(0);
703  aSerializer.readPoint(aPt);
704  rIStm.ReadInt32( nIndex ).ReadInt32( nLen ).ReadInt32( nTmp ).ReadInt32( nAryLen );
705  if (nTmp > 0)
706  {
707  OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
708  sal_uInt8 nTerminator = 0;
709  rIStm.ReadUChar( nTerminator );
710  SAL_WARN_IF( nTerminator != 0, "vcl.gdi", "expected string to be NULL terminated" );
711 
712  OUString aStr(OStringToOUString(aByteStr, eActualCharSet));
713 
714  std::unique_ptr<long[]> pDXAry;
715  sal_Int32 nDXAryLen = 0;
716  if (nAryLen > 0)
717  {
718  const size_t nMinRecordSize = sizeof(sal_Int32);
719  const size_t nMaxRecords = rIStm.remainingSize() / nMinRecordSize;
720  if (static_cast<sal_uInt32>(nAryLen) > nMaxRecords)
721  {
722  SAL_WARN("vcl.gdi", "Parsing error: " << nMaxRecords <<
723  " max possible entries, but " << nAryLen << " claimed, truncating");
724  nAryLen = nMaxRecords;
725  }
726 
727  sal_Int32 nStrLen( aStr.getLength() );
728 
729  nDXAryLen = std::max(nAryLen, nStrLen);
730 
731  if (nDXAryLen < nLen)
732  {
733  //MetaTextArrayAction ctor expects pDXAry to be >= nLen if set, so if this can't
734  //be achieved, don't read it, it's utterly broken.
735  SAL_WARN("vcl.gdi", "dxary too short, discarding completely");
736  rIStm.SeekRel(sizeof(sal_Int32) * nDXAryLen);
737  nLen = 0;
738  nIndex = 0;
739  }
740  else
741  {
742  pDXAry.reset(new long[nDXAryLen]);
743 
744  for (sal_Int32 j = 0; j < nAryLen; ++j)
745  {
746  rIStm.ReadInt32( nTmp );
747  pDXAry[ j ] = nTmp;
748  }
749 
750  // #106172# Add last DX array elem, if missing
751  if( nAryLen != nStrLen )
752  {
753  if (nAryLen+1 == nStrLen && nIndex >= 0)
754  {
755  std::unique_ptr<long[]> pTmpAry(new long[nStrLen]);
756 
757  aFontVDev->GetTextArray( aStr, pTmpAry.get(), nIndex, nLen );
758 
759  // now, the difference between the
760  // last and the second last DX array
761  // is the advancement for the last
762  // glyph. Thus, to complete our meta
763  // action's DX array, just add that
764  // difference to last elem and store
765  // in very last.
766  if( nStrLen > 1 )
767  pDXAry[ nStrLen-1 ] = pDXAry[ nStrLen-2 ] + pTmpAry[ nStrLen-1 ] - pTmpAry[ nStrLen-2 ];
768  else
769  pDXAry[ nStrLen-1 ] = pTmpAry[ nStrLen-1 ]; // len=1: 0th position taken to be 0
770  }
771 #ifdef DBG_UTIL
772  else
773  OSL_FAIL("More than one DX array element missing on SVM import");
774 #endif
775  }
776  }
777  }
778  if ( nUnicodeCommentActionNumber == i )
779  ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
780  rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry.get(), nIndex, nLen ) );
781  }
782 
783  if (nActionSize < 24)
785  else
786  rIStm.Seek(nActBegin + nActionSize);
787  }
788  break;
789 
791  {
792  sal_Int32 nIndex(0), nLen(0), nWidth(0), nTmp(0);
793 
794  aSerializer.readPoint(aPt);
795  rIStm.ReadInt32( nIndex ).ReadInt32( nLen ).ReadInt32( nTmp ).ReadInt32( nWidth );
796  if (nTmp > 0)
797  {
798  OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
799  sal_uInt8 nTerminator = 0;
800  rIStm.ReadUChar( nTerminator );
801  SAL_WARN_IF( nTerminator != 0, "vcl.gdi", "expected string to be NULL terminated" );
802 
803  OUString aStr(OStringToOUString(aByteStr, eActualCharSet));
804  if ( nUnicodeCommentActionNumber == i )
805  ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
806  rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, nIndex, nLen ) );
807  }
808 
809  if (nActionSize < 28)
811  else
812  rIStm.Seek(nActBegin + nActionSize);
813  }
814  break;
815 
816  case GDI_BITMAP_ACTION:
817  {
818  Bitmap aBmp;
819 
820  aSerializer.readPoint(aPt);
821  ReadDIB(aBmp, rIStm, true);
822  rMtf.AddAction( new MetaBmpAction( aPt, aBmp ) );
823  }
824  break;
825 
827  {
828  Bitmap aBmp;
829 
830  aSerializer.readPoint(aPt);
831  aSerializer.readSize(aSz);
832  ReadDIB(aBmp, rIStm, true);
833  rMtf.AddAction( new MetaBmpScaleAction( aPt, aSz, aBmp ) );
834  }
835  break;
836 
838  {
839  Bitmap aBmp;
840  Size aSz2;
841 
842  aSerializer.readPoint(aPt);
843  aSerializer.readSize(aSz);
844  aSerializer.readPoint(aPt1);
845  aSerializer.readSize(aSz2);
846  ReadDIB(aBmp, rIStm, true);
847  rMtf.AddAction( new MetaBmpScalePartAction( aPt, aSz, aPt1, aSz2, aBmp ) );
848  }
849  break;
850 
851  case GDI_PEN_ACTION:
852  {
853  sal_Int32 nPenWidth;
854  sal_Int16 nPenStyle;
855 
856  ImplReadColor( rIStm, aActionColor );
857  rIStm.ReadInt32( nPenWidth ).ReadInt16( nPenStyle );
858 
859  aLineInfo.SetStyle( nPenStyle ? LineStyle::Solid : LineStyle::NONE );
860  aLineInfo.SetWidth( nPenWidth );
861  bFatLine = nPenStyle && !aLineInfo.IsDefault();
862 
863  rMtf.AddAction( new MetaLineColorAction( aActionColor, nPenStyle != 0 ) );
864  }
865  break;
866 
868  {
869  sal_Int16 nBrushStyle;
870 
871  ImplReadColor( rIStm, aActionColor );
872  rIStm.SeekRel( 6 );
873  rIStm.ReadInt16( nBrushStyle );
874  rMtf.AddAction( new MetaFillColorAction( aActionColor, nBrushStyle != 0 ) );
875  rIStm.SeekRel( 2 );
876  }
877  break;
878 
879  case GDI_MAPMODE_ACTION:
880  {
881  if (ImplReadMapMode(rIStm, aMapMode))
882  {
883  rMtf.AddAction(new MetaMapModeAction(aMapMode));
884 
885  // #106172# Track font relevant data in shadow VDev
886  aFontVDev->SetMapMode(aMapMode);
887  };
888  }
889  break;
890 
892  {
893  vcl::Region aRegion;
894  sal_Int16 nRegType;
895  sal_Int16 bIntersect;
896  bool bClip = false;
897 
898  rIStm.ReadInt16( nRegType ).ReadInt16( bIntersect );
899  ImplReadRect( rIStm, aRect );
900 
901  switch( nRegType )
902  {
903  case 0:
904  break;
905 
906  case 1:
907  {
908  tools::Rectangle aRegRect;
909 
910  ImplReadRect( rIStm, aRegRect );
911  aRegion = vcl::Region( aRegRect );
912  bClip = true;
913  }
914  break;
915 
916  case 2:
917  {
918  if (ImplReadPoly(rIStm, aActionPoly))
919  {
920  aRegion = vcl::Region( aActionPoly );
921  bClip = true;
922  }
923  }
924  break;
925 
926  case 3:
927  {
928  bool bSuccess = true;
929  tools::PolyPolygon aPolyPoly;
930  sal_Int32 nPolyCount32(0);
931  rIStm.ReadInt32(nPolyCount32);
932  sal_uInt16 nPolyCount(nPolyCount32);
933 
934  for (sal_uInt16 j = 0; j < nPolyCount && rIStm.good(); ++j)
935  {
936  if (!ImplReadPoly(rIStm, aActionPoly))
937  {
938  bSuccess = false;
939  break;
940  }
941  aPolyPoly.Insert(aActionPoly);
942  }
943 
944  if (bSuccess)
945  {
946  aRegion = vcl::Region( aPolyPoly );
947  bClip = true;
948  }
949  }
950  break;
951  }
952 
953  if( bIntersect )
954  aRegion.Intersect( aRect );
955 
956  rMtf.AddAction( new MetaClipRegionAction( aRegion, bClip ) );
957  }
958  break;
959 
961  {
962  sal_Int32 nTmp(0), nTmp1(0);
963  rIStm.ReadInt32( nTmp ).ReadInt32( nTmp1 );
964  rMtf.AddAction( new MetaMoveClipRegionAction( nTmp, nTmp1 ) );
965  }
966  break;
967 
969  {
970  ImplReadRect( rIStm, aRect );
971  rMtf.AddAction( new MetaISectRectClipRegionAction( aRect ) );
972  }
973  break;
974 
975  case GDI_RASTEROP_ACTION:
976  {
977  RasterOp eRasterOp;
978  sal_Int16 nRasterOp;
979 
980  rIStm.ReadInt16( nRasterOp );
981 
982  switch( nRasterOp )
983  {
984  case 1:
985  eRasterOp = RasterOp::Invert;
986  break;
987 
988  case 4:
989  case 5:
990  eRasterOp = RasterOp::Xor;
991  break;
992 
993  default:
994  eRasterOp = RasterOp::OverPaint;
995  break;
996  }
997 
998  rMtf.AddAction( new MetaRasterOpAction( eRasterOp ) );
999  }
1000  break;
1001 
1002  case GDI_PUSH_ACTION:
1003  {
1004  aLIStack.push(std::make_unique<LineInfo>(aLineInfo));
1005  rMtf.AddAction( new MetaPushAction( PushFlags::ALL ) );
1006 
1007  // #106172# Track font relevant data in shadow VDev
1008  aFontVDev->Push();
1009  }
1010  break;
1011 
1012  case GDI_POP_ACTION:
1013  {
1014 
1015  std::unique_ptr<LineInfo> xLineInfo;
1016  if (!aLIStack.empty())
1017  {
1018  xLineInfo = std::move(aLIStack.top());
1019  aLIStack.pop();
1020  }
1021 
1022  // restore line info
1023  if (xLineInfo)
1024  {
1025  aLineInfo = *xLineInfo;
1026  xLineInfo.reset();
1027  bFatLine = ( LineStyle::NONE != aLineInfo.GetStyle() ) && !aLineInfo.IsDefault();
1028  }
1029 
1030  rMtf.AddAction( new MetaPopAction() );
1031 
1032  // #106172# Track font relevant data in shadow VDev
1033  aFontVDev->Pop();
1034  }
1035  break;
1036 
1037  case GDI_GRADIENT_ACTION:
1038  {
1039  Color aStartCol;
1040  Color aEndCol;
1041  sal_Int16 nStyle;
1042  sal_Int16 nAngle;
1043  sal_Int16 nBorder;
1044  sal_Int16 nOfsX;
1045  sal_Int16 nOfsY;
1046  sal_Int16 nIntensityStart;
1047  sal_Int16 nIntensityEnd;
1048 
1049  ImplReadRect( rIStm, aRect );
1050  rIStm.ReadInt16( nStyle );
1051  ImplReadColor( rIStm, aStartCol );
1052  ImplReadColor( rIStm, aEndCol );
1053  rIStm.ReadInt16( nAngle ).ReadInt16( nBorder ).ReadInt16( nOfsX ).ReadInt16( nOfsY ).ReadInt16( nIntensityStart ).ReadInt16( nIntensityEnd );
1054 
1055  Gradient aGrad( static_cast<GradientStyle>(nStyle), aStartCol, aEndCol );
1056 
1057  aGrad.SetAngle( nAngle );
1058  aGrad.SetBorder( nBorder );
1059  aGrad.SetOfsX( nOfsX );
1060  aGrad.SetOfsY( nOfsY );
1061  aGrad.SetStartIntensity( nIntensityStart );
1062  aGrad.SetEndIntensity( nIntensityEnd );
1063  rMtf.AddAction( new MetaGradientAction( aRect, aGrad ) );
1064  }
1065  break;
1066 
1068  {
1069  tools::PolyPolygon aPolyPoly;
1070  sal_Int32 nFollowingActionCount(0);
1071  sal_Int16 nTrans(0);
1072 
1073  ReadPolyPolygon( rIStm, aPolyPoly );
1074  rIStm.ReadInt16( nTrans ).ReadInt32( nFollowingActionCount );
1075  ImplSkipActions( rIStm, nFollowingActionCount );
1076  rMtf.AddAction( new MetaTransparentAction( aPolyPoly, nTrans ) );
1077 
1078  i = SkipActions(i, nFollowingActionCount, nActions);
1079  }
1080  break;
1081 
1083  {
1084  GDIMetaFile aMtf;
1085  Point aPos;
1086  Size aSize;
1087  Gradient aGradient;
1088  sal_Int32 nFollowingActionCount(0);
1089 
1090  ReadGDIMetaFile( rIStm, aMtf );
1091  aSerializer.readPoint(aPos);
1092  aSerializer.readSize(aSize);
1093  aSerializer.readGradient(aGradient);
1094  rIStm.ReadInt32( nFollowingActionCount );
1095  ImplSkipActions( rIStm, nFollowingActionCount );
1096  rMtf.AddAction( new MetaFloatTransparentAction( aMtf, aPos, aSize, aGradient ) );
1097 
1098  i = SkipActions(i, nFollowingActionCount, nActions);
1099  }
1100  break;
1101 
1102  case GDI_HATCH_COMMENT:
1103  {
1104  tools::PolyPolygon aPolyPoly;
1105  Hatch aHatch;
1106  sal_Int32 nFollowingActionCount(0);
1107 
1108  ReadPolyPolygon( rIStm, aPolyPoly );
1109  ReadHatch( rIStm, aHatch );
1110  rIStm.ReadInt32( nFollowingActionCount );
1111  ImplSkipActions( rIStm, nFollowingActionCount );
1112  rMtf.AddAction( new MetaHatchAction( aPolyPoly, aHatch ) );
1113 
1114  i = SkipActions(i, nFollowingActionCount, nActions);
1115  }
1116  break;
1117 
1118  case GDI_REFPOINT_COMMENT:
1119  {
1120  Point aRefPoint;
1121  bool bSet;
1122  sal_Int32 nFollowingActionCount(0);
1123 
1124  aSerializer.readPoint(aRefPoint);
1125  rIStm.ReadCharAsBool( bSet ).ReadInt32( nFollowingActionCount );
1126  ImplSkipActions( rIStm, nFollowingActionCount );
1127  rMtf.AddAction( new MetaRefPointAction( aRefPoint, bSet ) );
1128 
1129  i = SkipActions(i, nFollowingActionCount, nActions);
1130 
1131  // #106172# Track font relevant data in shadow VDev
1132  if( bSet )
1133  aFontVDev->SetRefPoint( aRefPoint );
1134  else
1135  aFontVDev->SetRefPoint();
1136  }
1137  break;
1138 
1140  {
1141  Color aColor;
1142  bool bSet;
1143  sal_Int32 nFollowingActionCount(0);
1144 
1145  aSerializer.readColor(aColor);
1146  rIStm.ReadCharAsBool( bSet ).ReadInt32( nFollowingActionCount );
1147  ImplSkipActions( rIStm, nFollowingActionCount );
1148  rMtf.AddAction( new MetaTextLineColorAction( aColor, bSet ) );
1149 
1150  i = SkipActions(i, nFollowingActionCount, nActions);
1151  }
1152  break;
1153 
1154  case GDI_TEXTLINE_COMMENT:
1155  {
1156  Point aStartPt;
1157  sal_Int32 nWidth(0);
1158  sal_uInt32 nStrikeout(0);
1159  sal_uInt32 nUnderline(0);
1160  sal_Int32 nFollowingActionCount(0);
1161 
1162  aSerializer.readPoint(aStartPt);
1163  rIStm.ReadInt32(nWidth ).ReadUInt32(nStrikeout).ReadUInt32(nUnderline).ReadInt32(nFollowingActionCount);
1164  ImplSkipActions(rIStm, nFollowingActionCount);
1165  rMtf.AddAction( new MetaTextLineAction( aStartPt, nWidth,
1166  static_cast<FontStrikeout>(nStrikeout),
1167  static_cast<FontLineStyle>(nUnderline),
1168  LINESTYLE_NONE ) );
1169 
1170  i = SkipActions(i, nFollowingActionCount, nActions);
1171  }
1172  break;
1173 
1175  {
1176  tools::PolyPolygon aPolyPoly;
1177  Gradient aGradient;
1178  sal_Int32 nFollowingActionCount(0);
1179 
1180  ReadPolyPolygon( rIStm, aPolyPoly );
1181  aSerializer.readGradient(aGradient);
1182  rIStm.ReadInt32( nFollowingActionCount );
1183  ImplSkipActions( rIStm, nFollowingActionCount );
1184  rMtf.AddAction( new MetaGradientExAction( aPolyPoly, aGradient ) );
1185 
1186  i = SkipActions(i, nFollowingActionCount, nActions);
1187  }
1188  break;
1189 
1190  case GDI_COMMENT_COMMENT:
1191  {
1192  std::vector<sal_uInt8> aData;
1193 
1194  OString aComment = read_uInt16_lenPrefixed_uInt8s_ToOString(rIStm);
1195  sal_Int32 nValue(0);
1196  sal_uInt32 nDataSize(0);
1197  rIStm.ReadInt32(nValue).ReadUInt32(nDataSize);
1198 
1199  if (nDataSize)
1200  {
1201  const size_t nMaxPossibleData = rIStm.remainingSize();
1202  if (nDataSize > nMaxPossibleActions)
1203  {
1204  SAL_WARN("vcl.gdi", "svm record claims to have: " << nDataSize << " data, but only " << nMaxPossibleData << " possible");
1205  nDataSize = nMaxPossibleActions;
1206  }
1207  aData.resize(nDataSize);
1208  nDataSize = rIStm.ReadBytes(aData.data(), nDataSize);
1209  }
1210 
1211  sal_Int32 nFollowingActionCount(0);
1212  rIStm.ReadInt32(nFollowingActionCount);
1213  ImplSkipActions( rIStm, nFollowingActionCount );
1214  rMtf.AddAction(new MetaCommentAction(aComment, nValue, aData.data(), nDataSize));
1215 
1216  i = SkipActions(i, nFollowingActionCount, nActions);
1217  }
1218  break;
1219 
1220  case GDI_UNICODE_COMMENT:
1221  {
1222  nUnicodeCommentActionNumber = i + 1;
1223  nUnicodeCommentStreamPos = rIStm.Tell() - 6;
1224  if (nActionSize < 4)
1226  else
1227  rIStm.SeekRel(nActionSize - 4);
1228  }
1229  break;
1230 
1231  default:
1232  if (nActionSize < 4)
1234  else
1235  rIStm.SeekRel(nActionSize - 4);
1236  break;
1237  }
1238  }
1239 
1240  rIStm.SetEndian( nOldFormat );
1241 }
1242 
1243 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetFamily(FontFamily)
Definition: font/font.cxx:123
#define GDI_TEXT_ACTION
sal_uInt16 Count() const
#define GDI_LINE_ACTION
SvStream & ReadInt16(sal_Int16 &rInt16)
static void ImplReadRect(SvStream &rIStm, tools::Rectangle &rRect)
void SetStrikeout(FontStrikeout)
Definition: font/font.cxx:257
static bool ImplReadMapMode(SvStream &rIStm, MapMode &rMapMode)
void SetFillColor(const Color &)
Definition: font/font.cxx:88
long GetWidth() const
#define GDI_LINEDASHDOT_ACTION
Definition: hatch.hxx:44
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:401
const tools::Polygon & GetObject(sal_uInt16 nPos) const
void SetFontSize(const Size &)
Definition: font/font.cxx:117
long GetHeight() const
bool ReadDIB(Bitmap &rTarget, SvStream &rIStm, bool bFileHeader, bool bMSOFormat)
Definition: dibtools.cxx:1731
void SetBlue(sal_uInt8 nBlue)
void SetFlags(sal_uInt16 nPos, PolyFlags eFlags)
const char aData[]
SvStream & ReadPolyPolygon(SvStream &rIStream, tools::PolyPolygon &rPolyPoly)
OUString read_uInt16s_ToOUString(SvStream &rStrm, std::size_t nLen)
void readPoint(Point &rPoint)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
static void ImplSkipActions(SvStream &rIStm, sal_uLong nSkipCount)
static void lcl_error(SvStream &rIStm, const SvStreamEndian &nOldFormat, sal_uLong nPos)
sal_uIntPtr sal_uLong
#define GDI_TEXTARRAY_ACTION
#define GDI_FILLBRUSH_ACTION
SvStream & ReadCharAsBool(bool &rBool)
#define GDI_FONT_ACTION
void SetPrefSize(const Size &rSize)
Definition: gdimtf.hxx:174
void SetWeight(FontWeight)
Definition: font/font.cxx:215
#define GDI_ELLIPSE_ACTION
#define GDI_PIXEL_ACTION
void SetOutline(bool bOutline)
Definition: font/font.cxx:233
sal_uInt64 Seek(sal_uInt64 nPos)
#define GDI_UNICODE_COMMENT
#define GDI_GRADIENTEX_COMMENT
void SetBorder(sal_uInt16 nBorder)
void SetCharSet(rtl_TextEncoding)
Definition: font/font.cxx:129
void SetOrientation(short nLineOrientation)
Definition: font/font.cxx:192
void SetEndIntensity(sal_uInt16 nIntens)
WEIGHT_LIGHT
#define GDI_CLIPREGION_ACTION
sal_uInt64 SeekRel(sal_Int64 nPos)
FontAlign GetAlignment() const
Definition: font/font.cxx:668
#define GDI_TEXTLINE_COMMENT
static void ImplReadExtendedPolyPolygonAction(SvStream &rIStm, tools::PolyPolygon &rPolyPoly)
WEIGHT_BOLD
OString read_uInt16_lenPrefixed_uInt8s_ToOString(SvStream &rStrm)
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
ErrCode GetError() const
void SetOfsY(sal_uInt16 nOfsY)
LINESTYLE_NONE
#define GDI_BITMAPSCALE_ACTION
RasterOp
Definition: vclenum.hxx:191
#define GDI_REFPOINT_COMMENT
#define GDI_POP_ACTION
#define GDI_LINECAP_ACTION
void Insert(const tools::Polygon &rPoly, sal_uInt16 nPos=POLYPOLY_APPEND)
void SetUnderline(FontLineStyle)
Definition: font/font.cxx:245
#define GDI_POLYPOLYGON_ACTION
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:457
sal_uInt64 remainingSize()
#define GDI_BITMAPSCALEPART_ACTION
void readSize(Size &rSize)
void SetShadow(bool bShadow)
Definition: font/font.cxx:239
void SetPitch(FontPitch ePitch)
Definition: font/font.cxx:186
#define LF_FACESIZE
#define GDI_MOVECLIPREGION_ACTION
static void ImplReadUnicodeComment(sal_uInt32 nStrmPos, SvStream &rIStm, OUString &rString)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
WEIGHT_DONTKNOW
#define GDI_PEN_ACTION
#define GDI_POLYGON_ACTION
void SetAlignment(FontAlign)
Definition: font/font.cxx:101
void SetFamilyName(const OUString &rFamilyName)
Definition: font/font.cxx:107
#define GDI_RECT_ACTION
int i
QPRO_FUNC_TYPE const nType
#define GDI_RASTEROP_ACTION
#define GDI_EXTENDEDPOLYGON_ACTION
WEIGHT_NORMAL
void SetRed(sal_uInt8 nRed)
static void ImplConvertFromSVM1(SvStream &rIStm, GDIMetaFile &rMtf)
long const nBorder
#define GDI_PIE_ACTION
void SetError(ErrCode nErrorCode)
void Intersect(const tools::Rectangle &rRegion)
Definition: region.cxx:584
#define GDI_ARC_ACTION
#define GDI_POINT_ACTION
SvStream & ReadUChar(unsigned char &rChar)
#define GDI_PUSH_ACTION
ITALIC_NONE
const Color & GetFillColor() const
Definition: font/font.cxx:665
#define GDI_INVERTRECT_ACTION
void SetOfsX(sal_uInt16 nOfsX)
static bool ImplReadPolyPoly(SvStream &rIStm, tools::PolyPolygon &rPolyPoly)
#define GDI_ISECTCLIPREGION_ACTION
SvStream & ReadHatch(SvStream &rIStm, Hatch &rHatch)
Definition: gdi/hatch.cxx:79
void SetColor(const Color &)
Definition: font/font.cxx:80
SvStream & ReadInt32(sal_Int32 &rInt32)
#define GDI_COMMENT_COMMENT
std::size_t ReadBytes(void *pData, std::size_t nSize)
#define GDI_HATCH_COMMENT
SvStreamEndian GetEndian() const
const Color & GetColor() const
Definition: font/font.cxx:664
SVMConverter(SvStream &rIStm, GDIMetaFile &rMtf)
#define SAL_WARN_IF(condition, area, stream)
ITALIC_NORMAL
unsigned char sal_uInt8
void ReplaceAction(rtl::Reference< MetaAction > pAction, size_t nAction)
Definition: gdimtf.cxx:174
void SetAngle(sal_uInt16 nAngle)
void AddAction(const rtl::Reference< MetaAction > &pAction)
Definition: gdimtf.cxx:540
MetaAction * GetAction(size_t nAction) const
Definition: gdimtf.cxx:158
void SetGreen(sal_uInt8 nGreen)
void SetTransparent(bool bTransparent)
Definition: font/font.cxx:95
SvStream & ReadGDIMetaFile(SvStream &rIStm, GDIMetaFile &rGDIMetaFile, ImplMetaReadData *pData)
Definition: gdimtf.cxx:2621
void SetEndian(SvStreamEndian SvStreamEndian)
bool IsTransparent() const
Definition: font/font.cxx:666
#define SVSTREAM_FILEFORMAT_ERROR
Definition: errcode.hxx:262
rtl_TextEncoding GetStreamCharSet() const
#define GDI_LINEJOIN_ACTION
sal_uInt64 Tell() const
size_t GetActionSize() const
Definition: gdimtf.cxx:153
static bool ImplReadPoly(SvStream &rIStm, tools::Polygon &rPoly)
#define GDI_MAPMODE_ACTION
#define GDI_TRANSPARENT_COMMENT
bool good() const
void SetItalic(FontItalic)
Definition: font/font.cxx:227
OString const aName
#define GDI_POLYLINE_ACTION
#define SAL_WARN(area, stream)
SvStreamEndian
#define GDI_HIGHLIGHTRECT_ACTION
#define GDI_STRETCHTEXT_ACTION
void readGradient(Gradient &rGradient)
static void ImplReadColor(SvStream &rIStm, Color &rColor)
#define GDI_FLOATTRANSPARENT_COMMENT
sal_Int32 nPos
void setWidth(long nWidth)
#define GDI_GRADIENT_ACTION
OString read_uInt8s_ToOString(SvStream &rStrm, std::size_t nLen)
aStr
void SetStartIntensity(sal_uInt16 nIntens)
rtl_TextEncoding GetCharSet() const
Definition: font/font.cxx:679
Point Center() const
void SetPrefMapMode(const MapMode &rMapMode)
Definition: gdimtf.hxx:177
#define GDI_BITMAP_ACTION
void readColor(Color &rColor)
#define GDI_TEXTLINECOLOR_COMMENT
void setHeight(long nHeight)