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