LCOV - code coverage report
Current view: top level - vcl/source/gdi - cvtsvm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1247 0.0 %
Date: 2012-08-25 Functions: 0 24 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2079 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <algorithm>
      31                 :            : #include <string.h>
      32                 :            : #include <tools/debug.hxx>
      33                 :            : #include <tools/stream.hxx>
      34                 :            : #include <tools/helpers.hxx>
      35                 :            : #include <vcl/virdev.hxx>
      36                 :            : #include <vcl/graph.hxx>
      37                 :            : #include <vcl/lineinfo.hxx>
      38                 :            : #include <vcl/cvtsvm.hxx>
      39                 :            : #include <rtl/strbuf.hxx>
      40                 :            : 
      41                 :            : // -----------
      42                 :            : // - Inlines -
      43                 :            : // -----------
      44                 :            : 
      45                 :          0 : void ImplReadRect( SvStream& rIStm, Rectangle& rRect )
      46                 :            : {
      47                 :          0 :     Point aTL;
      48                 :          0 :     Point aBR;
      49                 :            : 
      50         [ #  # ]:          0 :     rIStm >> aTL;
      51         [ #  # ]:          0 :     rIStm >> aBR;
      52                 :            : 
      53         [ #  # ]:          0 :     rRect = Rectangle( aTL, aBR );
      54                 :          0 : }
      55                 :            : 
      56                 :            : // ------------------------------------------------------------------------
      57                 :            : 
      58                 :          0 : void ImplWriteRect( SvStream& rOStm, const Rectangle& rRect )
      59                 :            : {
      60         [ #  # ]:          0 :     rOStm << rRect.TopLeft();
      61         [ #  # ]:          0 :     rOStm << rRect.BottomRight();
      62                 :          0 : }
      63                 :            : 
      64                 :            : // ------------------------------------------------------------------------
      65                 :            : 
      66                 :          0 : void ImplReadPoly( SvStream& rIStm, Polygon& rPoly )
      67                 :            : {
      68                 :            :     sal_Int32   nSize;
      69                 :            : 
      70         [ #  # ]:          0 :     rIStm >> nSize;
      71 [ #  # ][ #  # ]:          0 :     rPoly = Polygon( (sal_uInt16) nSize );
                 [ #  # ]
      72                 :            : 
      73         [ #  # ]:          0 :     for( sal_uInt16 i = 0; i < (sal_uInt16) nSize; i++ )
      74 [ #  # ][ #  # ]:          0 :         rIStm >> rPoly[ i ];
      75                 :          0 : }
      76                 :            : 
      77                 :            : // ------------------------------------------------------------------------
      78                 :            : 
      79                 :          0 : void ImplReadPolyPoly( SvStream& rIStm, PolyPolygon& rPolyPoly )
      80                 :            : {
      81         [ #  # ]:          0 :     Polygon aPoly;
      82                 :            :     sal_Int32   nPolyCount;
      83                 :            : 
      84         [ #  # ]:          0 :     rIStm >> nPolyCount;
      85                 :            : 
      86         [ #  # ]:          0 :     for( sal_uInt16 i = 0; i < (sal_uInt16) nPolyCount; i++ )
      87                 :            :     {
      88         [ #  # ]:          0 :         ImplReadPoly( rIStm, aPoly );
      89         [ #  # ]:          0 :         rPolyPoly.Insert( aPoly );
      90         [ #  # ]:          0 :     }
      91                 :          0 : }
      92                 :            : 
      93                 :            : // ------------------------------------------------------------------------
      94                 :            : 
      95                 :          0 : void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly )
      96                 :            : {
      97                 :          0 :     const sal_uInt16    nPoly = rPolyPoly.Count();
      98                 :          0 :     sal_uInt16          nPoints = 0;
      99                 :            :     sal_uInt16          n;
     100                 :            : 
     101         [ #  # ]:          0 :     for( n = 0; n < nPoly; n++ )
     102                 :          0 :         nPoints = sal::static_int_cast<sal_uInt16>(nPoints + rPolyPoly[ n ].GetSize());
     103                 :            : 
     104                 :          0 :     rOStm << (sal_Int16) GDI_POLYPOLYGON_ACTION;
     105                 :          0 :     rOStm << (sal_Int32) ( 8 + ( nPoly << 2 ) + ( nPoints << 3 ) );
     106                 :          0 :     rOStm << (sal_Int32) nPoly;
     107                 :            : 
     108         [ #  # ]:          0 :     for( n = 0; n < nPoly; n++ )
     109                 :            :     {
     110                 :            :         // #i102224# Here the evtl. curved nature of Polygon was
     111                 :            :         // ignored (for all those Years). Adapted to at least write
     112                 :            :         // a polygon representing the curve as good as possible
     113         [ #  # ]:          0 :          Polygon aSimplePoly;
     114 [ #  # ][ #  # ]:          0 :          rPolyPoly[n].AdaptiveSubdivide(aSimplePoly);
     115         [ #  # ]:          0 :          const sal_uInt16 nSize(aSimplePoly.GetSize());
     116                 :            : 
     117         [ #  # ]:          0 :         rOStm << (sal_Int32) nSize;
     118                 :            : 
     119         [ #  # ]:          0 :         for( sal_uInt16 j = 0; j < nSize; j++ )
     120 [ #  # ][ #  # ]:          0 :             rOStm << aSimplePoly[ j ];
     121         [ #  # ]:          0 :     }
     122                 :          0 : }
     123                 :            : 
     124                 :            : // ------------------------------------------------------------------------
     125                 :            : 
     126                 :          0 : void ImplReadColor( SvStream& rIStm, Color& rColor )
     127                 :            : {
     128                 :            :     sal_Int16 nVal;
     129                 :            : 
     130 [ #  # ][ #  # ]:          0 :     rIStm >> nVal; rColor.SetRed( sal::static_int_cast<sal_uInt8>((sal_uInt16)nVal >> 8) );
     131 [ #  # ][ #  # ]:          0 :     rIStm >> nVal; rColor.SetGreen( sal::static_int_cast<sal_uInt8>((sal_uInt16)nVal >> 8) );
     132 [ #  # ][ #  # ]:          0 :     rIStm >> nVal; rColor.SetBlue( sal::static_int_cast<sal_uInt8>((sal_uInt16)nVal >> 8) );
     133                 :          0 : }
     134                 :            : 
     135                 :            : // ------------------------------------------------------------------------
     136                 :            : 
     137                 :          0 : void ImplWriteColor( SvStream& rOStm, const Color& rColor )
     138                 :            : {
     139                 :            :     sal_Int16 nVal;
     140                 :            : 
     141                 :          0 :     nVal = ( (sal_Int16) rColor.GetRed() << 8 ) | rColor.GetRed();
     142                 :          0 :     rOStm << nVal;
     143                 :            : 
     144                 :          0 :     nVal = ( (sal_Int16) rColor.GetGreen() << 8 ) | rColor.GetGreen();
     145                 :          0 :     rOStm << nVal;
     146                 :            : 
     147                 :          0 :     nVal = ( (sal_Int16) rColor.GetBlue() << 8 ) | rColor.GetBlue();
     148                 :          0 :     rOStm << nVal;
     149                 :          0 : }
     150                 :            : 
     151                 :            : // ------------------------------------------------------------------------
     152                 :            : 
     153                 :          0 : void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode )
     154                 :            : {
     155                 :          0 :     Point   aOrg;
     156                 :            :     sal_Int32   nXNum;
     157                 :            :     sal_Int32   nXDenom;
     158                 :            :     sal_Int32   nYNum;
     159                 :            :     sal_Int32   nYDenom;
     160                 :            :     sal_Int16   nUnit;
     161                 :            : 
     162 [ #  # ][ #  # ]:          0 :     rIStm >> nUnit >> aOrg >> nXNum >> nXDenom >> nYNum >> nYDenom;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     163 [ #  # ][ #  # ]:          0 :     rMapMode = MapMode( (MapUnit) nUnit, aOrg, Fraction( nXNum, nXDenom ), Fraction( nYNum, nYDenom ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     164                 :          0 : }
     165                 :            : 
     166                 :            : // ------------------------------------------------------------------------
     167                 :            : 
     168                 :          0 : void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode )
     169                 :            : {
     170                 :          0 :     rOStm << (sal_Int16) rMapMode.GetMapUnit();
     171                 :          0 :     rOStm << rMapMode.GetOrigin();
     172                 :          0 :     rOStm << (sal_Int32) rMapMode.GetScaleX().GetNumerator();
     173                 :          0 :     rOStm << (sal_Int32) rMapMode.GetScaleX().GetDenominator();
     174                 :          0 :     rOStm << (sal_Int32) rMapMode.GetScaleY().GetNumerator();
     175                 :          0 :     rOStm << (sal_Int32) rMapMode.GetScaleY().GetDenominator();
     176                 :          0 : }
     177                 :            : 
     178                 :            : // ------------------------------------------------------------------------
     179                 :            : 
     180                 :          0 : void ImplWritePushAction( SvStream& rOStm )
     181                 :            : {
     182                 :          0 :     rOStm << (sal_Int16) GDI_PUSH_ACTION;
     183                 :          0 :     rOStm << (sal_Int32) 4;
     184                 :          0 : }
     185                 :            : 
     186                 :            : // ------------------------------------------------------------------------
     187                 :            : 
     188                 :          0 : void ImplWritePopAction( SvStream& rOStm )
     189                 :            : {
     190                 :          0 :     rOStm << (sal_Int16) GDI_POP_ACTION;
     191                 :          0 :     rOStm << (sal_Int32) 4;
     192                 :          0 : }
     193                 :            : 
     194                 :            : // ------------------------------------------------------------------------
     195                 :            : 
     196                 :          0 : void ImplWriteLineColor( SvStream& rOStm, const Color& rColor, sal_Int16 nStyle, sal_Int32 nWidth = 0L )
     197                 :            : {
     198         [ #  # ]:          0 :     if( rColor.GetTransparency() > 127 )
     199                 :          0 :         nStyle = 0;
     200                 :            : 
     201                 :          0 :     rOStm << (sal_Int16) GDI_PEN_ACTION;
     202                 :          0 :     rOStm << (sal_Int32) 16;
     203                 :          0 :     ImplWriteColor( rOStm, rColor );
     204                 :          0 :     rOStm << nWidth;
     205                 :          0 :     rOStm << nStyle;
     206                 :          0 : }
     207                 :            : 
     208                 :            : // ------------------------------------------------------------------------
     209                 :            : 
     210                 :          0 : void ImplWriteFillColor( SvStream& rOStm, const Color& rColor, sal_Int16 nStyle )
     211                 :            : {
     212                 :          0 :     rOStm << (sal_Int16) GDI_FILLBRUSH_ACTION;
     213                 :          0 :     rOStm << (sal_Int32) 20;
     214                 :          0 :     ImplWriteColor( rOStm, rColor );
     215                 :            : 
     216         [ #  # ]:          0 :     if( rColor.GetTransparency() > 127 )
     217                 :          0 :         nStyle = 0;
     218                 :            : 
     219         [ #  # ]:          0 :     if( nStyle > 1 )
     220                 :            :     {
     221         [ #  # ]:          0 :         ImplWriteColor( rOStm, COL_WHITE );
     222                 :          0 :         rOStm << nStyle;
     223                 :          0 :         rOStm << (sal_Int16) 1;
     224                 :            :     }
     225                 :            :     else
     226                 :            :     {
     227         [ #  # ]:          0 :         ImplWriteColor( rOStm, COL_BLACK );
     228                 :          0 :         rOStm << nStyle;
     229                 :          0 :         rOStm << (sal_Int16) 0;
     230                 :            :     }
     231                 :          0 : }
     232                 :            : 
     233                 :            : // ------------------------------------------------------------------------
     234                 :            : 
     235                 :          0 : void ImplWriteFont( SvStream& rOStm, const Font& rFont,
     236                 :            :                     rtl_TextEncoding& rActualCharSet )
     237                 :            : {
     238                 :            :     char    aName[32];
     239                 :            :     short   nWeight;
     240                 :            : 
     241         [ #  # ]:          0 :     rtl::OString aByteName(rtl::OUStringToOString(rFont.GetName(),
     242 [ #  # ][ #  # ]:          0 :         rOStm.GetStreamCharSet()));
     243                 :          0 :     strncpy( aName, aByteName.getStr(), 32 );
     244                 :            : 
     245   [ #  #  #  # ]:          0 :     switch ( rFont.GetWeight() )
                 [ #  # ]
     246                 :            :     {
     247                 :            :         case WEIGHT_THIN:
     248                 :            :         case WEIGHT_ULTRALIGHT:
     249                 :            :         case WEIGHT_LIGHT:
     250                 :          0 :             nWeight = 1;
     251                 :          0 :         break;
     252                 :            : 
     253                 :            :         case WEIGHT_NORMAL:
     254                 :            :         case WEIGHT_MEDIUM:
     255                 :          0 :             nWeight = 2;
     256                 :          0 :         break;
     257                 :            : 
     258                 :            :         case WEIGHT_BOLD:
     259                 :            :         case WEIGHT_ULTRABOLD:
     260                 :            :         case WEIGHT_BLACK:
     261                 :          0 :             nWeight = 3;
     262                 :          0 :         break;
     263                 :            : 
     264                 :            :         default:
     265                 :          0 :             nWeight = 0;
     266                 :          0 :         break;
     267                 :            :     }
     268                 :            : 
     269         [ #  # ]:          0 :     rOStm << (sal_Int16) GDI_FONT_ACTION;
     270         [ #  # ]:          0 :     rOStm << (sal_Int32) 78;
     271                 :            : 
     272         [ #  # ]:          0 :     rActualCharSet = GetStoreCharSet( rFont.GetCharSet() );
     273 [ #  # ][ #  # ]:          0 :     ImplWriteColor( rOStm, rFont.GetColor() );
     274 [ #  # ][ #  # ]:          0 :     ImplWriteColor( rOStm, rFont.GetFillColor() );
     275         [ #  # ]:          0 :     rOStm.Write( aName, 32 );
     276 [ #  # ][ #  # ]:          0 :     rOStm << rFont.GetSize();
     277         [ #  # ]:          0 :     rOStm << (sal_Int16) 0; // no character orientation anymore
     278 [ #  # ][ #  # ]:          0 :     rOStm << (sal_Int16) rFont.GetOrientation();
     279         [ #  # ]:          0 :     rOStm << (sal_Int16) rActualCharSet;
     280 [ #  # ][ #  # ]:          0 :     rOStm << (sal_Int16) rFont.GetFamily();
     281 [ #  # ][ #  # ]:          0 :     rOStm << (sal_Int16) rFont.GetPitch();
     282 [ #  # ][ #  # ]:          0 :     rOStm << (sal_Int16) rFont.GetAlign();
     283         [ #  # ]:          0 :     rOStm << (sal_Int16) nWeight;
     284 [ #  # ][ #  # ]:          0 :     rOStm << (sal_Int16) rFont.GetUnderline();
     285 [ #  # ][ #  # ]:          0 :     rOStm << (sal_Int16) rFont.GetStrikeout();
     286 [ #  # ][ #  # ]:          0 :     rOStm << (sal_Bool) ( rFont.GetItalic() != ITALIC_NONE );
     287 [ #  # ][ #  # ]:          0 :     rOStm << rFont.IsOutline();
     288 [ #  # ][ #  # ]:          0 :     rOStm << rFont.IsShadow();
     289 [ #  # ][ #  # ]:          0 :     rOStm << rFont.IsTransparent();
     290         [ #  # ]:          0 :     if ( rActualCharSet == RTL_TEXTENCODING_DONTKNOW )
     291         [ #  # ]:          0 :         rActualCharSet = osl_getThreadTextEncoding();
     292                 :          0 : }
     293                 :            : 
     294                 :            : // ------------------------------------------------------------------------
     295                 :            : 
     296                 :          0 : void ImplWriteRasterOpAction( SvStream& rOStm, sal_Int16 nRasterOp )
     297                 :            : {
     298                 :          0 :     rOStm << (sal_Int16) GDI_RASTEROP_ACTION << (sal_Int32) 6 << nRasterOp;
     299                 :          0 : }
     300                 :            : 
     301                 :            : // ------------------------------------------------------------------------
     302                 :            : 
     303                 :          0 : sal_Bool ImplWriteUnicodeComment( SvStream& rOStm, const String& rString )
     304                 :            : {
     305                 :          0 :     xub_StrLen nStringLen = rString.Len();
     306         [ #  # ]:          0 :     if ( nStringLen )
     307                 :            :     {
     308                 :          0 :         sal_uInt32  nSize = ( nStringLen << 1 ) + 4;
     309                 :          0 :         sal_uInt16  nType = GDI_UNICODE_COMMENT;
     310                 :            : 
     311                 :          0 :         rOStm << nType << nSize;
     312         [ #  # ]:          0 :         write_uInt16s_FromOUString(rOStm, rString);
     313                 :            :     }
     314                 :          0 :     return nStringLen != 0;
     315                 :            : }
     316                 :            : 
     317                 :            : // ------------------------------------------------------------------------
     318                 :            : 
     319                 :          0 : void ImplReadUnicodeComment( sal_uInt32 nStrmPos, SvStream& rIStm, String& rString )
     320                 :            : {
     321                 :          0 :     sal_uInt32 nOld = rIStm.Tell();
     322         [ #  # ]:          0 :     if ( nStrmPos )
     323                 :            :     {
     324                 :            :         sal_uInt16  nType;
     325                 :            :         sal_uInt32  nActionSize;
     326                 :            :         xub_StrLen  nStringLen;
     327                 :            : 
     328         [ #  # ]:          0 :         rIStm.Seek( nStrmPos );
     329         [ #  # ]:          0 :         rIStm   >> nType
     330         [ #  # ]:          0 :                 >> nActionSize;
     331                 :            : 
     332                 :          0 :         nStringLen = sal::static_int_cast<xub_StrLen>(( nActionSize - 4 ) >> 1);
     333                 :            : 
     334 [ #  # ][ #  # ]:          0 :         if ( nStringLen && ( nType == GDI_UNICODE_COMMENT ) )
     335 [ #  # ][ #  # ]:          0 :             rString = read_uInt16s_ToOUString(rIStm, nStringLen);
     336                 :            :     }
     337                 :          0 :     rIStm.Seek( nOld );
     338                 :          0 : }
     339                 :            : 
     340                 :            : // ------------------------------------------------------------------------
     341                 :            : 
     342                 :          0 : void ImplSkipActions( SvStream& rIStm, sal_uLong nSkipCount )
     343                 :            : {
     344                 :            :     sal_Int32 nActionSize;
     345                 :            :     sal_Int16 nType;
     346                 :            : 
     347         [ #  # ]:          0 :     for( sal_uLong i = 0UL; i < nSkipCount; i++ )
     348                 :            :     {
     349 [ #  # ][ #  # ]:          0 :         rIStm >> nType >> nActionSize;
     350         [ #  # ]:          0 :         rIStm.SeekRel( nActionSize - 4L );
     351                 :            :     }
     352                 :          0 : }
     353                 :            : 
     354                 :            : // ------------------------------------------------------------------------
     355                 :            : 
     356                 :          0 : bool ImplWriteExtendedPolyPolygonAction(SvStream& rOStm, const PolyPolygon& rPolyPolygon, bool bOnlyWhenCurve)
     357                 :            : {
     358                 :          0 :     const sal_uInt16 nPolygonCount(rPolyPolygon.Count());
     359                 :            : 
     360         [ #  # ]:          0 :     if(nPolygonCount)
     361                 :            :     {
     362                 :          0 :         sal_uInt32 nAllPolygonCount(0);
     363                 :          0 :         sal_uInt32 nAllPointCount(0);
     364                 :          0 :         sal_uInt32 nAllFlagCount(0);
     365                 :          0 :         sal_uInt16 a(0);
     366                 :            : 
     367         [ #  # ]:          0 :         for(a = 0; a < nPolygonCount; a++)
     368                 :            :         {
     369                 :          0 :             const Polygon& rCandidate = rPolyPolygon.GetObject(a);
     370                 :          0 :             const sal_uInt16 nPointCount(rCandidate.GetSize());
     371                 :            : 
     372         [ #  # ]:          0 :             if(nPointCount)
     373                 :            :             {
     374                 :          0 :                 nAllPolygonCount++;
     375                 :          0 :                 nAllPointCount += nPointCount;
     376                 :            : 
     377         [ #  # ]:          0 :                 if(rCandidate.HasFlags())
     378                 :            :                 {
     379                 :          0 :                     nAllFlagCount += nPointCount;
     380                 :            :                 }
     381                 :            :             }
     382                 :            :         }
     383                 :            : 
     384 [ #  # ][ #  # ]:          0 :         if((bOnlyWhenCurve && nAllFlagCount) || (!bOnlyWhenCurve && nAllPointCount))
         [ #  # ][ #  # ]
     385                 :            :         {
     386                 :          0 :             rOStm << (sal_Int16) GDI_EXTENDEDPOLYGON_ACTION;
     387                 :            : 
     388                 :            :             const sal_Int32 nActionSize(
     389                 :            :                 4 +                         // Action size
     390                 :            :                 2 +                         // PolygonCount
     391                 :            :                 (nAllPolygonCount * 2) +    // Points per polygon
     392                 :            :                 (nAllPointCount << 3) +     // Points themselves
     393                 :            :                 nAllPolygonCount +          // Bool if (when poly has points) it has flags, too
     394                 :          0 :                 nAllFlagCount);             // Flags themselves
     395                 :            : 
     396                 :          0 :             rOStm << nActionSize;
     397                 :          0 :             rOStm << (sal_uInt16)nAllPolygonCount;
     398                 :            : 
     399         [ #  # ]:          0 :             for(a = 0; a < nPolygonCount; a++)
     400                 :            :             {
     401                 :          0 :                 const Polygon& rCandidate = rPolyPolygon.GetObject(a);
     402                 :          0 :                 const sal_uInt16 nPointCount(rCandidate.GetSize());
     403                 :            : 
     404         [ #  # ]:          0 :                 if(nPointCount)
     405                 :            :                 {
     406                 :          0 :                     rOStm << nPointCount;
     407                 :            : 
     408         [ #  # ]:          0 :                     for(sal_uInt16 b(0); b < nPointCount; b++)
     409                 :            :                     {
     410                 :          0 :                         rOStm << rCandidate[b];
     411                 :            :                     }
     412                 :            : 
     413         [ #  # ]:          0 :                     if(rCandidate.HasFlags())
     414                 :            :                     {
     415                 :          0 :                         rOStm << (sal_uInt8)true;
     416                 :            : 
     417         [ #  # ]:          0 :                         for(sal_uInt16 c(0); c < nPointCount; c++)
     418                 :            :                         {
     419                 :          0 :                             rOStm << (sal_uInt8)rCandidate.GetFlags(c);
     420                 :            :                         }
     421                 :            :                     }
     422                 :            :                     else
     423                 :            :                     {
     424                 :          0 :                         rOStm << (sal_uInt8)false;
     425                 :            :                     }
     426                 :            :                 }
     427                 :            :             }
     428                 :            : 
     429                 :          0 :             return true;
     430                 :            :         }
     431                 :            :     }
     432                 :            : 
     433                 :          0 :     return false;
     434                 :            : }
     435                 :            : 
     436                 :            : // ------------------------------------------------------------------------
     437                 :            : 
     438                 :          0 : void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, PolyPolygon& rPolyPoly)
     439                 :            : {
     440         [ #  # ]:          0 :     rPolyPoly.Clear();
     441                 :          0 :     sal_uInt16 nPolygonCount(0);
     442         [ #  # ]:          0 :     rIStm >> nPolygonCount;
     443                 :            : 
     444         [ #  # ]:          0 :     for(sal_uInt16 a(0); a < nPolygonCount; a++)
     445                 :            :     {
     446                 :          0 :         sal_uInt16 nPointCount(0);
     447         [ #  # ]:          0 :         rIStm >> nPointCount;
     448         [ #  # ]:          0 :         Polygon aCandidate(nPointCount);
     449                 :            : 
     450         [ #  # ]:          0 :         if(nPointCount)
     451                 :            :         {
     452         [ #  # ]:          0 :             for(sal_uInt16 b(0); b < nPointCount; b++)
     453                 :            :             {
     454 [ #  # ][ #  # ]:          0 :                 rIStm >> aCandidate[b];
     455                 :            :             }
     456                 :            : 
     457                 :          0 :             sal_uInt8 bHasFlags(false);
     458         [ #  # ]:          0 :             rIStm >> bHasFlags;
     459                 :            : 
     460         [ #  # ]:          0 :             if(bHasFlags)
     461                 :            :             {
     462                 :          0 :                 sal_uInt8 aPolyFlags(0);
     463                 :            : 
     464         [ #  # ]:          0 :                 for(sal_uInt16 c(0); c < nPointCount; c++)
     465                 :            :                 {
     466         [ #  # ]:          0 :                     rIStm >> aPolyFlags;
     467         [ #  # ]:          0 :                     aCandidate.SetFlags(c, (PolyFlags)aPolyFlags);
     468                 :            :                 }
     469                 :            :             }
     470                 :            :         }
     471                 :            : 
     472         [ #  # ]:          0 :         rPolyPoly.Insert(aCandidate);
     473         [ #  # ]:          0 :     }
     474                 :          0 : }
     475                 :            : 
     476                 :            : // ----------------
     477                 :            : // - SVMConverter -
     478                 :            : // ----------------
     479                 :            : 
     480                 :          0 : SVMConverter::SVMConverter( SvStream& rStm, GDIMetaFile& rMtf, sal_uLong nConvertMode )
     481                 :            : {
     482         [ #  # ]:          0 :     if( !rStm.GetError() )
     483                 :            :     {
     484         [ #  # ]:          0 :         if( CONVERT_FROM_SVM1 == nConvertMode )
     485                 :          0 :             ImplConvertFromSVM1( rStm, rMtf );
     486         [ #  # ]:          0 :         else if( CONVERT_TO_SVM1 == nConvertMode )
     487                 :          0 :             ImplConvertToSVM1( rStm, rMtf );
     488                 :            :     }
     489                 :          0 : }
     490                 :            : 
     491                 :            : // ------------------------------------------------------------------------
     492                 :            : 
     493                 :          0 : void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
     494                 :            : {
     495                 :          0 :     const sal_uLong         nPos = rIStm.Tell();
     496                 :          0 :     const sal_uInt16        nOldFormat = rIStm.GetNumberFormatInt();
     497                 :            : 
     498         [ #  # ]:          0 :     rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
     499                 :            : 
     500                 :            :     char    aCode[ 5 ];
     501                 :          0 :     Size    aPrefSz;
     502                 :            :     sal_Int16   nSize;
     503                 :            :     sal_Int16   nVersion;
     504                 :            : 
     505                 :            :     // read header
     506         [ #  # ]:          0 :     rIStm.Read( (char*) &aCode, sizeof( aCode ) );  // Kennung
     507         [ #  # ]:          0 :     rIStm >> nSize;                                 // Size
     508         [ #  # ]:          0 :     rIStm >> nVersion;                              // Version
     509                 :            :     //#fdo39428 SvStream no longer supports operator>>(long&)
     510                 :          0 :     sal_Int32 nTmp32(0);
     511         [ #  # ]:          0 :     rIStm >> nTmp32;
     512                 :          0 :     aPrefSz.Width() = nTmp32;                       // PrefSize.Width()
     513         [ #  # ]:          0 :     rIStm >> nTmp32;
     514                 :          0 :     aPrefSz.Height() = nTmp32;                      // PrefSize.Height()
     515                 :            : 
     516                 :            :     // check header-magic and version
     517 [ #  # ][ #  # ]:          0 :     if( rIStm.GetError()
         [ #  # ][ #  # ]
     518                 :          0 :         || ( memcmp( aCode, "SVGDI", sizeof( aCode ) ) != 0 )
     519                 :            :         || ( nVersion != 200 ) )
     520                 :            :     {
     521         [ #  # ]:          0 :         rIStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
     522         [ #  # ]:          0 :         rIStm.SetNumberFormatInt( nOldFormat );
     523         [ #  # ]:          0 :         rIStm.Seek( nPos );
     524                 :          0 :         return;
     525                 :            :     }
     526                 :            : 
     527         [ #  # ]:          0 :     LineInfo            aLineInfo( LINE_NONE, 0 );
     528 [ #  # ][ #  # ]:          0 :     ::std::stack< LineInfo* > aLIStack;
     529         [ #  # ]:          0 :     VirtualDevice       aFontVDev;
     530         [ #  # ]:          0 :     rtl_TextEncoding    eActualCharSet = osl_getThreadTextEncoding();
     531                 :          0 :     sal_Bool                bFatLine = sal_False;
     532                 :            : 
     533                 :            :     // TODO: fix reindentation below if you can accept being blamed by the SCM
     534         [ #  # ]:          0 :         MapMode     aMapMode;
     535         [ #  # ]:          0 :         Polygon     aActionPoly;
     536         [ #  # ]:          0 :         Rectangle   aRect;
     537                 :          0 :         Point       aPt, aPt1;
     538                 :          0 :         Size        aSz;
     539                 :          0 :         Color       aActionColor;
     540                 :            :         sal_Int32       nTmp, nTmp1, nActionSize;
     541                 :            :         sal_Int32       nActions;
     542                 :            :         sal_Int16       nType;
     543                 :            : 
     544                 :          0 :         sal_uInt32  nUnicodeCommentStreamPos = 0;
     545                 :          0 :         sal_Int32       nUnicodeCommentActionNumber = 0;
     546                 :            : 
     547         [ #  # ]:          0 :         ImplReadMapMode( rIStm, aMapMode );             // MapMode
     548         [ #  # ]:          0 :         rIStm >> nActions;                              // Action count
     549                 :            : 
     550                 :          0 :         rMtf.SetPrefSize( aPrefSz );
     551         [ #  # ]:          0 :         rMtf.SetPrefMapMode( aMapMode );
     552                 :          0 :         size_t nLastPolygonAction(0);
     553                 :            : 
     554         [ #  # ]:          0 :         for( sal_Int32 i = 0L; i < nActions; i++ )
     555                 :            :         {
     556         [ #  # ]:          0 :             rIStm >> nType;
     557                 :          0 :             sal_Int32 nActBegin = rIStm.Tell();
     558         [ #  # ]:          0 :             rIStm >> nActionSize;
     559                 :            : 
     560                 :            :             DBG_ASSERT( ( nType <= 33 ) || ( nType >= 1024 ), "Unknown GDIMetaAction while converting!" );
     561                 :            : 
     562   [ #  #  #  #  :          0 :             switch( nType )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     563                 :            :             {
     564                 :            :                 case( GDI_PIXEL_ACTION ):
     565                 :            :                 {
     566         [ #  # ]:          0 :                     rIStm >> aPt;
     567         [ #  # ]:          0 :                     ImplReadColor( rIStm, aActionColor );
     568 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaPixelAction( aPt, aActionColor ) );
                 [ #  # ]
     569                 :            :                 }
     570                 :          0 :                 break;
     571                 :            : 
     572                 :            :                 case( GDI_POINT_ACTION ):
     573                 :            :                 {
     574         [ #  # ]:          0 :                     rIStm >> aPt;
     575 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaPointAction( aPt ) );
                 [ #  # ]
     576                 :            :                 }
     577                 :          0 :                 break;
     578                 :            : 
     579                 :            :                 case( GDI_LINE_ACTION ):
     580                 :            :                 {
     581 [ #  # ][ #  # ]:          0 :                     rIStm >> aPt >> aPt1;
     582 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaLineAction( aPt, aPt1, aLineInfo ) );
                 [ #  # ]
     583                 :            :                 }
     584                 :          0 :                 break;
     585                 :            : 
     586                 :            :                 case (GDI_LINEJOIN_ACTION) :
     587                 :            :                 {
     588                 :          0 :                     sal_Int16 nLineJoin(0);
     589         [ #  # ]:          0 :                     rIStm >> nLineJoin;
     590         [ #  # ]:          0 :                     aLineInfo.SetLineJoin((basegfx::B2DLineJoin)nLineJoin);
     591                 :            :                 }
     592                 :          0 :                 break;
     593                 :            : 
     594                 :            :                 case (GDI_LINEDASHDOT_ACTION) :
     595                 :            :                 {
     596                 :          0 :                     sal_Int16 a(0);
     597                 :          0 :                     sal_Int32 b(0);
     598                 :            : 
     599 [ #  # ][ #  # ]:          0 :                     rIStm >> a; aLineInfo.SetDashCount(a);
     600 [ #  # ][ #  # ]:          0 :                     rIStm >> b; aLineInfo.SetDashLen(b);
     601 [ #  # ][ #  # ]:          0 :                     rIStm >> a; aLineInfo.SetDotCount(a);
     602 [ #  # ][ #  # ]:          0 :                     rIStm >> b; aLineInfo.SetDotLen(b);
     603 [ #  # ][ #  # ]:          0 :                     rIStm >> b; aLineInfo.SetDistance(b);
     604                 :            : 
     605 [ #  # ][ #  #  :          0 :                     if(((aLineInfo.GetDashCount() && aLineInfo.GetDashLen())
          #  #  #  #  #  
              # ][ #  # ]
     606                 :          0 :                         || (aLineInfo.GetDotCount() && aLineInfo.GetDotLen()))
     607                 :          0 :                         && aLineInfo.GetDistance())
     608                 :            :                     {
     609         [ #  # ]:          0 :                         aLineInfo.SetStyle(LINE_DASH);
     610                 :            :                     }
     611                 :            :                 }
     612                 :          0 :                 break;
     613                 :            : 
     614                 :            :                 case (GDI_EXTENDEDPOLYGON_ACTION) :
     615                 :            :                 {
     616                 :            :                     // read the PolyPolygon in every case
     617         [ #  # ]:          0 :                     PolyPolygon aInputPolyPolygon;
     618         [ #  # ]:          0 :                     ImplReadExtendedPolyPolygonAction(rIStm, aInputPolyPolygon);
     619                 :            : 
     620                 :            :                     // now check if it can be set somewhere
     621 [ #  # ][ #  # ]:          0 :                     if(nLastPolygonAction < rMtf.GetActionSize())
     622                 :            :                     {
     623 [ #  # ][ #  # ]:          0 :                         MetaPolyLineAction* pPolyLineAction = dynamic_cast< MetaPolyLineAction* >(rMtf.GetAction(nLastPolygonAction));
     624                 :            : 
     625         [ #  # ]:          0 :                         if(pPolyLineAction)
     626                 :            :                         {
     627                 :            :                             // replace MetaPolyLineAction when we have a single polygon. Do not rely on the
     628                 :            :                             // same point count; the originally written GDI_POLYLINE_ACTION may have been
     629                 :            :                             // Subdivided for better quality for older usages
     630 [ #  # ][ #  # ]:          0 :                             if(1 == aInputPolyPolygon.Count())
     631                 :            :                             {
     632                 :            :                                 rMtf.ReplaceAction(
     633                 :            :                                     new MetaPolyLineAction(
     634                 :            :                                         aInputPolyPolygon.GetObject(0),
     635         [ #  # ]:          0 :                                         pPolyLineAction->GetLineInfo()),
     636 [ #  # ][ #  # ]:          0 :                                     nLastPolygonAction);
                 [ #  # ]
     637         [ #  # ]:          0 :                                 pPolyLineAction->Delete();
     638                 :            :                             }
     639                 :            :                         }
     640                 :            :                         else
     641                 :            :                         {
     642 [ #  # ][ #  # ]:          0 :                             MetaPolyPolygonAction* pPolyPolygonAction = dynamic_cast< MetaPolyPolygonAction* >(rMtf.GetAction(nLastPolygonAction));
     643                 :            : 
     644         [ #  # ]:          0 :                             if(pPolyPolygonAction)
     645                 :            :                             {
     646                 :            :                                 // replace MetaPolyPolygonAction when we have a curved polygon. Do rely on the
     647                 :            :                                 // same sub-polygon count
     648 [ #  # ][ #  # ]:          0 :                                 if(pPolyPolygonAction->GetPolyPolygon().Count() == aInputPolyPolygon.Count())
                 [ #  # ]
     649                 :            :                                 {
     650                 :            :                                     rMtf.ReplaceAction(
     651                 :            :                                         new MetaPolyPolygonAction(
     652         [ #  # ]:          0 :                                             aInputPolyPolygon),
     653 [ #  # ][ #  # ]:          0 :                                         nLastPolygonAction);
     654         [ #  # ]:          0 :                                     pPolyPolygonAction->Delete();
     655                 :            :                                 }
     656                 :            :                             }
     657                 :            :                             else
     658                 :            :                             {
     659 [ #  # ][ #  # ]:          0 :                                 MetaPolygonAction* pPolygonAction = dynamic_cast< MetaPolygonAction* >(rMtf.GetAction(nLastPolygonAction));
     660                 :            : 
     661         [ #  # ]:          0 :                                 if(pPolygonAction)
     662                 :            :                                 {
     663                 :            :                                     // replace MetaPolygonAction
     664 [ #  # ][ #  # ]:          0 :                                     if(1 == aInputPolyPolygon.Count())
     665                 :            :                                     {
     666                 :            :                                         rMtf.ReplaceAction(
     667                 :            :                                             new MetaPolygonAction(
     668         [ #  # ]:          0 :                                                 aInputPolyPolygon.GetObject(0)),
     669 [ #  # ][ #  # ]:          0 :                                             nLastPolygonAction);
                 [ #  # ]
     670         [ #  # ]:          0 :                                         pPolygonAction->Delete();
     671                 :            :                                     }
     672                 :            :                                 }
     673                 :            :                             }
     674                 :            :                         }
     675         [ #  # ]:          0 :                     }
     676                 :            :                 }
     677                 :          0 :                 break;
     678                 :            : 
     679                 :            :                 case( GDI_RECT_ACTION ):
     680                 :            :                 {
     681         [ #  # ]:          0 :                     ImplReadRect( rIStm, aRect );
     682 [ #  # ][ #  # ]:          0 :                     rIStm >> nTmp >> nTmp1;
     683                 :            : 
     684 [ #  # ][ #  # ]:          0 :                     if( nTmp || nTmp1 )
     685 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaRoundRectAction( aRect, nTmp, nTmp1 ) );
                 [ #  # ]
     686                 :            :                     else
     687                 :            :                     {
     688 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaRectAction( aRect ) );
                 [ #  # ]
     689                 :            : 
     690         [ #  # ]:          0 :                         if( bFatLine )
     691 [ #  # ][ #  # ]:          0 :                             rMtf.AddAction( new MetaPolyLineAction( aRect, aLineInfo ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     692                 :            :                     }
     693                 :            :                 }
     694                 :          0 :                 break;
     695                 :            : 
     696                 :            :                 case( GDI_ELLIPSE_ACTION ):
     697                 :            :                 {
     698         [ #  # ]:          0 :                     ImplReadRect( rIStm, aRect );
     699                 :            : 
     700         [ #  # ]:          0 :                     if( bFatLine )
     701                 :            :                     {
     702 [ #  # ][ #  # ]:          0 :                         const Polygon aPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
         [ #  # ][ #  # ]
     703                 :            : 
     704 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
                 [ #  # ]
     705 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
                 [ #  # ]
     706 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolygonAction( aPoly ) );
                 [ #  # ]
     707 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPopAction() );
                 [ #  # ]
     708 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
         [ #  # ][ #  # ]
     709                 :            :                     }
     710                 :            :                     else
     711 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaEllipseAction( aRect ) );
                 [ #  # ]
     712                 :            :                 }
     713                 :          0 :                 break;
     714                 :            : 
     715                 :            :                 case( GDI_ARC_ACTION ):
     716                 :            :                 {
     717         [ #  # ]:          0 :                     ImplReadRect( rIStm, aRect );
     718 [ #  # ][ #  # ]:          0 :                     rIStm >> aPt >> aPt1;
     719                 :            : 
     720         [ #  # ]:          0 :                     if( bFatLine )
     721                 :            :                     {
     722         [ #  # ]:          0 :                         const Polygon aPoly( aRect, aPt, aPt1, POLY_ARC );
     723                 :            : 
     724 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
                 [ #  # ]
     725 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
                 [ #  # ]
     726 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolygonAction( aPoly ) );
                 [ #  # ]
     727 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPopAction() );
                 [ #  # ]
     728 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
         [ #  # ][ #  # ]
     729                 :            :                     }
     730                 :            :                     else
     731 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaArcAction( aRect, aPt, aPt1 ) );
                 [ #  # ]
     732                 :            :                 }
     733                 :          0 :                 break;
     734                 :            : 
     735                 :            :                 case( GDI_PIE_ACTION ):
     736                 :            :                 {
     737         [ #  # ]:          0 :                     ImplReadRect( rIStm, aRect );
     738 [ #  # ][ #  # ]:          0 :                     rIStm >> aPt >> aPt1;
     739                 :            : 
     740         [ #  # ]:          0 :                     if( bFatLine )
     741                 :            :                     {
     742         [ #  # ]:          0 :                         const Polygon aPoly( aRect, aPt, aPt1, POLY_PIE );
     743                 :            : 
     744 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
                 [ #  # ]
     745 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
                 [ #  # ]
     746 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolygonAction( aPoly ) );
                 [ #  # ]
     747 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPopAction() );
                 [ #  # ]
     748 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
         [ #  # ][ #  # ]
     749                 :            :                     }
     750                 :            :                     else
     751 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPieAction( aRect, aPt, aPt1 ) );
                 [ #  # ]
     752                 :            :                 }
     753                 :          0 :                 break;
     754                 :            : 
     755                 :            :                 case( GDI_INVERTRECT_ACTION ):
     756                 :            :                 case( GDI_HIGHLIGHTRECT_ACTION ):
     757                 :            :                 {
     758         [ #  # ]:          0 :                     ImplReadRect( rIStm, aRect );
     759 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaPushAction( PUSH_RASTEROP ) );
                 [ #  # ]
     760 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaRasterOpAction( ROP_INVERT ) );
                 [ #  # ]
     761 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaRectAction( aRect ) );
                 [ #  # ]
     762 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaPopAction() );
                 [ #  # ]
     763                 :            :                 }
     764                 :          0 :                 break;
     765                 :            : 
     766                 :            :                 case( GDI_POLYLINE_ACTION ):
     767                 :            :                 {
     768         [ #  # ]:          0 :                     ImplReadPoly( rIStm, aActionPoly );
     769         [ #  # ]:          0 :                     nLastPolygonAction = rMtf.GetActionSize();
     770                 :            : 
     771         [ #  # ]:          0 :                     if( bFatLine )
     772 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) );
                 [ #  # ]
     773                 :            :                     else
     774 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolyLineAction( aActionPoly ) );
                 [ #  # ]
     775                 :            :                 }
     776                 :          0 :                 break;
     777                 :            : 
     778                 :            :                 case( GDI_POLYGON_ACTION ):
     779                 :            :                 {
     780         [ #  # ]:          0 :                     ImplReadPoly( rIStm, aActionPoly );
     781                 :            : 
     782         [ #  # ]:          0 :                     if( bFatLine )
     783                 :            :                     {
     784 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
                 [ #  # ]
     785 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
                 [ #  # ]
     786 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolygonAction( aActionPoly ) );
                 [ #  # ]
     787 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPopAction() );
                 [ #  # ]
     788 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) );
                 [ #  # ]
     789                 :            :                     }
     790                 :            :                     else
     791                 :            :                     {
     792         [ #  # ]:          0 :                         nLastPolygonAction = rMtf.GetActionSize();
     793 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolygonAction( aActionPoly ) );
                 [ #  # ]
     794                 :            :                     }
     795                 :            :                 }
     796                 :          0 :                 break;
     797                 :            : 
     798                 :            :                 case( GDI_POLYPOLYGON_ACTION ):
     799                 :            :                 {
     800         [ #  # ]:          0 :                     PolyPolygon aPolyPoly;
     801                 :            : 
     802         [ #  # ]:          0 :                     ImplReadPolyPoly( rIStm, aPolyPoly );
     803                 :            : 
     804         [ #  # ]:          0 :                     if( bFatLine )
     805                 :            :                     {
     806 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
                 [ #  # ]
     807 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
                 [ #  # ]
     808 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
                 [ #  # ]
     809 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPopAction() );
                 [ #  # ]
     810                 :            : 
     811 [ #  # ][ #  # ]:          0 :                         for( sal_uInt16 nPoly = 0, nCount = aPolyPoly.Count(); nPoly < nCount; nPoly++ )
     812 [ #  # ][ #  # ]:          0 :                             rMtf.AddAction( new MetaPolyLineAction( aPolyPoly[ nPoly ], aLineInfo ) );
         [ #  # ][ #  # ]
     813                 :            :                     }
     814                 :            :                     else
     815                 :            :                     {
     816         [ #  # ]:          0 :                         nLastPolygonAction = rMtf.GetActionSize();
     817 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
                 [ #  # ]
     818         [ #  # ]:          0 :                     }
     819                 :            :                 }
     820                 :          0 :                 break;
     821                 :            : 
     822                 :            :                 case( GDI_FONT_ACTION ):
     823                 :            :                 {
     824         [ #  # ]:          0 :                     Font    aFont;
     825                 :            :                     char    aName[ 32 ];
     826                 :            :                     sal_Int32   nWidth, nHeight;
     827                 :            :                     sal_Int16   nCharSet, nFamily, nPitch, nAlign, nWeight, nUnderline, nStrikeout;
     828                 :            :                     sal_Int16   nCharOrient, nLineOrient;
     829                 :            :                     sal_Bool    bItalic, bOutline, bShadow, bTransparent;
     830                 :            : 
     831 [ #  # ][ #  # ]:          0 :                     ImplReadColor( rIStm, aActionColor ); aFont.SetColor( aActionColor );
     832 [ #  # ][ #  # ]:          0 :                     ImplReadColor( rIStm, aActionColor ); aFont.SetFillColor( aActionColor );
     833         [ #  # ]:          0 :                     rIStm.Read( aName, 32 );
     834 [ #  # ][ #  # ]:          0 :                     aFont.SetName( UniString( aName, rIStm.GetStreamCharSet() ) );
         [ #  # ][ #  # ]
     835 [ #  # ][ #  # ]:          0 :                     rIStm >> nWidth >> nHeight;
     836 [ #  # ][ #  # ]:          0 :                     rIStm >> nCharOrient >> nLineOrient;
     837 [ #  # ][ #  # ]:          0 :                     rIStm >> nCharSet >> nFamily >> nPitch >> nAlign >> nWeight >> nUnderline >> nStrikeout;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     838 [ #  # ][ #  # ]:          0 :                     rIStm >> bItalic >> bOutline >> bShadow >> bTransparent;
         [ #  # ][ #  # ]
     839                 :            : 
     840         [ #  # ]:          0 :                     aFont.SetSize( Size( nWidth, nHeight ) );
     841         [ #  # ]:          0 :                     aFont.SetCharSet( (CharSet) nCharSet );
     842         [ #  # ]:          0 :                     aFont.SetFamily( (FontFamily) nFamily );
     843         [ #  # ]:          0 :                     aFont.SetPitch( (FontPitch) nPitch );
     844         [ #  # ]:          0 :                     aFont.SetAlign( (FontAlign) nAlign );
     845                 :            :                     aFont.SetWeight( ( nWeight == 1 ) ? WEIGHT_LIGHT : ( nWeight == 2 ) ? WEIGHT_NORMAL :
     846 [ #  # ][ #  # ]:          0 :                                      ( nWeight == 3 ) ? WEIGHT_BOLD : WEIGHT_DONTKNOW );
         [ #  # ][ #  # ]
     847         [ #  # ]:          0 :                     aFont.SetUnderline( (FontUnderline) nUnderline );
     848         [ #  # ]:          0 :                     aFont.SetStrikeout( (FontStrikeout) nStrikeout );
     849 [ #  # ][ #  # ]:          0 :                     aFont.SetItalic( bItalic ? ITALIC_NORMAL : ITALIC_NONE );
     850         [ #  # ]:          0 :                     aFont.SetOutline( bOutline );
     851         [ #  # ]:          0 :                     aFont.SetShadow( bShadow );
     852         [ #  # ]:          0 :                     aFont.SetOrientation( nLineOrient );
     853         [ #  # ]:          0 :                     aFont.SetTransparent( bTransparent );
     854                 :            : 
     855         [ #  # ]:          0 :                     eActualCharSet = aFont.GetCharSet();
     856         [ #  # ]:          0 :                     if ( eActualCharSet == RTL_TEXTENCODING_DONTKNOW )
     857         [ #  # ]:          0 :                         eActualCharSet = osl_getThreadTextEncoding();
     858                 :            : 
     859 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaFontAction( aFont ) );
                 [ #  # ]
     860 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaTextAlignAction( aFont.GetAlign() ) );
         [ #  # ][ #  # ]
     861 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaTextColorAction( aFont.GetColor() ) );
         [ #  # ][ #  # ]
     862 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     863                 :            : 
     864                 :            :                     // #106172# Track font relevant data in shadow VDev
     865 [ #  # ][ #  # ]:          0 :                     aFontVDev.SetFont( aFont );
     866                 :            :                 }
     867                 :          0 :                 break;
     868                 :            : 
     869                 :            :                 case( GDI_TEXT_ACTION ):
     870                 :            :                 {
     871                 :            :                     sal_Int32       nIndex, nLen;
     872                 :            : 
     873 [ #  # ][ #  # ]:          0 :                     rIStm >> aPt >> nIndex >> nLen >> nTmp;
         [ #  # ][ #  # ]
     874 [ #  # ][ #  # ]:          0 :                     if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
     875                 :            :                     {
     876         [ #  # ]:          0 :                         rtl::OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
     877                 :          0 :                         sal_uInt8 nTerminator = 0;
     878         [ #  # ]:          0 :                         rIStm >> nTerminator;
     879                 :            :                         DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
     880                 :            : 
     881 [ #  # ][ #  # ]:          0 :                         UniString aStr(rtl::OStringToOUString(aByteStr, eActualCharSet));
     882         [ #  # ]:          0 :                         if ( nUnicodeCommentActionNumber == i )
     883         [ #  # ]:          0 :                             ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
     884 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaTextAction( aPt, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     885                 :            :                     }
     886         [ #  # ]:          0 :                     rIStm.Seek( nActBegin + nActionSize );
     887                 :            :                 }
     888                 :          0 :                 break;
     889                 :            : 
     890                 :            :                 case( GDI_TEXTARRAY_ACTION ):
     891                 :            :                 {
     892                 :          0 :                     sal_Int32*  pDXAry = NULL;
     893                 :            :                     sal_Int32       nIndex, nLen, nAryLen;
     894                 :            : 
     895 [ #  # ][ #  # ]:          0 :                     rIStm >> aPt >> nIndex >> nLen >> nTmp >> nAryLen;
         [ #  # ][ #  # ]
                 [ #  # ]
     896 [ #  # ][ #  # ]:          0 :                     if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
     897                 :            :                     {
     898         [ #  # ]:          0 :                         rtl::OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
     899                 :          0 :                         sal_uInt8 nTerminator = 0;
     900         [ #  # ]:          0 :                         rIStm >> nTerminator;
     901                 :            :                         DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
     902                 :            : 
     903 [ #  # ][ #  # ]:          0 :                         UniString aStr(rtl::OStringToOUString(aByteStr, eActualCharSet));
     904                 :            : 
     905         [ #  # ]:          0 :                         if( nAryLen > 0L )
     906                 :            :                         {
     907                 :          0 :                             sal_Int32 nStrLen( aStr.Len() );
     908                 :            : 
     909         [ #  # ]:          0 :                             pDXAry = new sal_Int32[ Max( nAryLen, nStrLen ) ];
     910                 :            : 
     911         [ #  # ]:          0 :                             for( long j = 0L; j < nAryLen; j++ )
     912         [ #  # ]:          0 :                                 rIStm >> nTmp, pDXAry[ j ] = nTmp;
     913                 :            : 
     914                 :            :                             // #106172# Add last DX array elem, if missing
     915         [ #  # ]:          0 :                             if( nAryLen != nStrLen )
     916                 :            :                             {
     917         [ #  # ]:          0 :                                 if( nAryLen+1 == nStrLen )
     918                 :            :                                 {
     919         [ #  # ]:          0 :                                     sal_Int32* pTmpAry = new sal_Int32[nStrLen];
     920                 :            : 
     921         [ #  # ]:          0 :                                     aFontVDev.GetTextArray( aStr, pTmpAry, (sal_uInt16) nIndex, (sal_uInt16) nLen );
     922                 :            : 
     923                 :            :                                     // now, the difference between the
     924                 :            :                                     // last and the second last DX array
     925                 :            :                                     // is the advancement for the last
     926                 :            :                                     // glyph. Thus, to complete our meta
     927                 :            :                                     // action's DX array, just add that
     928                 :            :                                     // difference to last elem and store
     929                 :            :                                     // in very last.
     930         [ #  # ]:          0 :                                     if( nStrLen > 1 )
     931                 :          0 :                                         pDXAry[ nStrLen-1 ] = pDXAry[ nStrLen-2 ] + pTmpAry[ nStrLen-1 ] - pTmpAry[ nStrLen-2 ];
     932                 :            :                                     else
     933                 :          0 :                                         pDXAry[ nStrLen-1 ] = pTmpAry[ nStrLen-1 ]; // len=1: 0th position taken to be 0
     934                 :            : 
     935         [ #  # ]:          0 :                                     delete[] pTmpAry;
     936                 :            :                                 }
     937                 :            :     #ifdef DBG_UTIL
     938                 :            :                                 else
     939                 :            :                                     OSL_FAIL("More than one DX array element missing on SVM import");
     940                 :            :     #endif
     941                 :            :                             }
     942                 :            :                         }
     943         [ #  # ]:          0 :                         if ( nUnicodeCommentActionNumber == i )
     944         [ #  # ]:          0 :                             ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
     945 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
         [ #  # ][ #  # ]
     946                 :            : 
     947         [ #  # ]:          0 :                         if( pDXAry )
     948 [ #  # ][ #  # ]:          0 :                             delete[] pDXAry;
     949                 :            :                     }
     950         [ #  # ]:          0 :                     rIStm.Seek( nActBegin + nActionSize );
     951                 :            :                 }
     952                 :          0 :                 break;
     953                 :            : 
     954                 :            :                 case( GDI_STRETCHTEXT_ACTION ):
     955                 :            :                 {
     956                 :            :                     sal_Int32       nIndex, nLen, nWidth;
     957                 :            : 
     958 [ #  # ][ #  # ]:          0 :                     rIStm >> aPt >> nIndex >> nLen >> nTmp >> nWidth;
         [ #  # ][ #  # ]
                 [ #  # ]
     959 [ #  # ][ #  # ]:          0 :                     if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_INT16 - 1 ) ) )
     960                 :            :                     {
     961         [ #  # ]:          0 :                         rtl::OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
     962                 :          0 :                         sal_uInt8 nTerminator = 0;
     963         [ #  # ]:          0 :                         rIStm >> nTerminator;
     964                 :            :                         DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
     965                 :            : 
     966 [ #  # ][ #  # ]:          0 :                         UniString aStr(rtl::OStringToOUString(aByteStr, eActualCharSet));
     967         [ #  # ]:          0 :                         if ( nUnicodeCommentActionNumber == i )
     968         [ #  # ]:          0 :                             ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
     969 [ #  # ][ #  # ]:          0 :                         rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     970                 :            :                     }
     971         [ #  # ]:          0 :                     rIStm.Seek( nActBegin + nActionSize );
     972                 :            :                 }
     973                 :          0 :                 break;
     974                 :            : 
     975                 :            :                 case( GDI_BITMAP_ACTION ):
     976                 :            :                 {
     977         [ #  # ]:          0 :                     Bitmap aBmp;
     978                 :            : 
     979 [ #  # ][ #  # ]:          0 :                     rIStm >> aPt >> aBmp;
     980 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaBmpAction( aPt, aBmp ) );
         [ #  # ][ #  # ]
     981                 :            :                 }
     982                 :          0 :                 break;
     983                 :            : 
     984                 :            :                 case( GDI_BITMAPSCALE_ACTION ):
     985                 :            :                 {
     986         [ #  # ]:          0 :                     Bitmap aBmp;
     987                 :            : 
     988 [ #  # ][ #  # ]:          0 :                     rIStm >> aPt >> aSz >> aBmp;
                 [ #  # ]
     989 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaBmpScaleAction( aPt, aSz, aBmp ) );
         [ #  # ][ #  # ]
     990                 :            :                 }
     991                 :          0 :                 break;
     992                 :            : 
     993                 :            :                 case( GDI_BITMAPSCALEPART_ACTION ):
     994                 :            :                 {
     995         [ #  # ]:          0 :                     Bitmap  aBmp;
     996                 :          0 :                     Size    aSz2;
     997                 :            : 
     998 [ #  # ][ #  # ]:          0 :                     rIStm >> aPt >> aSz >> aPt1 >> aSz2 >> aBmp;
         [ #  # ][ #  # ]
                 [ #  # ]
     999 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaBmpScalePartAction( aPt, aSz, aPt1, aSz2, aBmp ) );
         [ #  # ][ #  # ]
    1000                 :            :                 }
    1001                 :          0 :                 break;
    1002                 :            : 
    1003                 :            :                 case( GDI_PEN_ACTION ):
    1004                 :            :                 {
    1005                 :            :                     sal_Int32 nPenWidth;
    1006                 :            :                     sal_Int16 nPenStyle;
    1007                 :            : 
    1008         [ #  # ]:          0 :                     ImplReadColor( rIStm, aActionColor );
    1009 [ #  # ][ #  # ]:          0 :                     rIStm >> nPenWidth >> nPenStyle;
    1010                 :            : 
    1011 [ #  # ][ #  # ]:          0 :                     aLineInfo.SetStyle( nPenStyle ? LINE_SOLID : LINE_NONE );
    1012         [ #  # ]:          0 :                     aLineInfo.SetWidth( nPenWidth );
    1013 [ #  # ][ #  # ]:          0 :                     bFatLine = nPenStyle && !aLineInfo.IsDefault();
    1014                 :            : 
    1015 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaLineColorAction( aActionColor, nPenStyle != 0 ) );
                 [ #  # ]
    1016                 :            :                 }
    1017                 :          0 :                 break;
    1018                 :            : 
    1019                 :            :                 case( GDI_FILLBRUSH_ACTION ):
    1020                 :            :                 {
    1021                 :            :                     sal_Int16 nBrushStyle;
    1022                 :            : 
    1023         [ #  # ]:          0 :                     ImplReadColor( rIStm, aActionColor );
    1024         [ #  # ]:          0 :                     rIStm.SeekRel( 6L );
    1025         [ #  # ]:          0 :                     rIStm >> nBrushStyle;
    1026 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaFillColorAction( aActionColor, nBrushStyle != 0 ) );
                 [ #  # ]
    1027         [ #  # ]:          0 :                     rIStm.SeekRel( 2L );
    1028                 :            :                 }
    1029                 :          0 :                 break;
    1030                 :            : 
    1031                 :            :                 case( GDI_MAPMODE_ACTION ):
    1032                 :            :                 {
    1033         [ #  # ]:          0 :                     ImplReadMapMode( rIStm, aMapMode );
    1034 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaMapModeAction( aMapMode ) );
                 [ #  # ]
    1035                 :            : 
    1036                 :            :                     // #106172# Track font relevant data in shadow VDev
    1037         [ #  # ]:          0 :                     aFontVDev.SetMapMode( aMapMode );
    1038                 :            :                 }
    1039                 :          0 :                 break;
    1040                 :            : 
    1041                 :            :                 case( GDI_CLIPREGION_ACTION ):
    1042                 :            :                 {
    1043         [ #  # ]:          0 :                     Region  aRegion;
    1044                 :            :                     sal_Int16   nRegType;
    1045                 :            :                     sal_Int16   bIntersect;
    1046                 :          0 :                     sal_Bool    bClip = sal_False;
    1047                 :            : 
    1048 [ #  # ][ #  # ]:          0 :                     rIStm >> nRegType >> bIntersect;
    1049         [ #  # ]:          0 :                     ImplReadRect( rIStm, aRect );
    1050                 :            : 
    1051   [ #  #  #  #  :          0 :                     switch( nRegType )
                      # ]
    1052                 :            :                     {
    1053                 :            :                         case( 0 ):
    1054                 :          0 :                         break;
    1055                 :            : 
    1056                 :            :                         case( 1 ):
    1057                 :            :                         {
    1058         [ #  # ]:          0 :                             Rectangle aRegRect;
    1059                 :            : 
    1060         [ #  # ]:          0 :                             ImplReadRect( rIStm, aRegRect );
    1061 [ #  # ][ #  # ]:          0 :                             aRegion = Region( aRegRect );
                 [ #  # ]
    1062                 :          0 :                             bClip = sal_True;
    1063                 :            :                         }
    1064                 :          0 :                         break;
    1065                 :            : 
    1066                 :            :                         case( 2 ):
    1067                 :            :                         {
    1068         [ #  # ]:          0 :                             ImplReadPoly( rIStm, aActionPoly );
    1069 [ #  # ][ #  # ]:          0 :                             aRegion = Region( aActionPoly );
                 [ #  # ]
    1070                 :          0 :                             bClip = sal_True;
    1071                 :            :                         }
    1072                 :          0 :                         break;
    1073                 :            : 
    1074                 :            :                         case( 3 ):
    1075                 :            :                         {
    1076         [ #  # ]:          0 :                             PolyPolygon aPolyPoly;
    1077                 :            :                             sal_Int32       nPolyCount;
    1078                 :            : 
    1079         [ #  # ]:          0 :                             rIStm >> nPolyCount;
    1080                 :            : 
    1081         [ #  # ]:          0 :                             for( sal_uInt16 j = 0; j < (sal_uInt16) nPolyCount; j++ )
    1082                 :            :                             {
    1083         [ #  # ]:          0 :                                 ImplReadPoly( rIStm, aActionPoly );
    1084         [ #  # ]:          0 :                                 aPolyPoly.Insert( aActionPoly );
    1085                 :            :                             }
    1086                 :            : 
    1087 [ #  # ][ #  # ]:          0 :                             aRegion = Region( aPolyPoly );
                 [ #  # ]
    1088         [ #  # ]:          0 :                             bClip = sal_True;
    1089                 :            :                         }
    1090                 :          0 :                         break;
    1091                 :            :                     }
    1092                 :            : 
    1093         [ #  # ]:          0 :                     if( bIntersect )
    1094         [ #  # ]:          0 :                         aRegion.Intersect( aRect );
    1095                 :            : 
    1096 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaClipRegionAction( aRegion, bClip ) );
         [ #  # ][ #  # ]
    1097                 :            :                 }
    1098                 :          0 :                 break;
    1099                 :            : 
    1100                 :            :                 case( GDI_MOVECLIPREGION_ACTION ):
    1101                 :            :                 {
    1102 [ #  # ][ #  # ]:          0 :                     rIStm >> nTmp >> nTmp1;
    1103 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaMoveClipRegionAction( nTmp, nTmp1 ) );
                 [ #  # ]
    1104                 :            :                 }
    1105                 :          0 :                 break;
    1106                 :            : 
    1107                 :            :                 case( GDI_ISECTCLIPREGION_ACTION ):
    1108                 :            :                 {
    1109         [ #  # ]:          0 :                     ImplReadRect( rIStm, aRect );
    1110 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaISectRectClipRegionAction( aRect ) );
                 [ #  # ]
    1111                 :            :                 }
    1112                 :          0 :                 break;
    1113                 :            : 
    1114                 :            :                 case( GDI_RASTEROP_ACTION ):
    1115                 :            :                 {
    1116                 :            :                     RasterOp    eRasterOp;
    1117                 :            :                     sal_Int16       nRasterOp;
    1118                 :            : 
    1119         [ #  # ]:          0 :                     rIStm >> nRasterOp;
    1120                 :            : 
    1121      [ #  #  # ]:          0 :                     switch( nRasterOp )
    1122                 :            :                     {
    1123                 :            :                         case( 1 ):
    1124                 :          0 :                             eRasterOp = ROP_INVERT;
    1125                 :          0 :                         break;
    1126                 :            : 
    1127                 :            :                         case( 4 ):
    1128                 :            :                         case( 5 ):
    1129                 :          0 :                             eRasterOp = ROP_XOR;
    1130                 :          0 :                         break;
    1131                 :            : 
    1132                 :            :                         default:
    1133                 :          0 :                             eRasterOp = ROP_OVERPAINT;
    1134                 :          0 :                         break;
    1135                 :            :                     }
    1136                 :            : 
    1137 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaRasterOpAction( eRasterOp ) );
                 [ #  # ]
    1138                 :            :                 }
    1139                 :          0 :                 break;
    1140                 :            : 
    1141                 :            :                 case( GDI_PUSH_ACTION ):
    1142                 :            :                 {
    1143 [ #  # ][ #  # ]:          0 :                     aLIStack.push( new LineInfo( aLineInfo ) );
                 [ #  # ]
    1144 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaPushAction( PUSH_ALL ) );
                 [ #  # ]
    1145                 :            : 
    1146                 :            :                     // #106172# Track font relevant data in shadow VDev
    1147         [ #  # ]:          0 :                     aFontVDev.Push();
    1148                 :            :                 }
    1149                 :          0 :                 break;
    1150                 :            : 
    1151                 :            :                 case( GDI_POP_ACTION ):
    1152                 :            :                 {
    1153                 :            : 
    1154                 :            :                     LineInfo* pLineInfo;
    1155 [ #  # ][ #  # ]:          0 :                     if (aLIStack.empty())
    1156                 :          0 :                         pLineInfo = NULL;
    1157                 :            :                     else
    1158                 :            :                     {
    1159         [ #  # ]:          0 :                         pLineInfo = aLIStack.top();
    1160         [ #  # ]:          0 :                         aLIStack.pop();
    1161                 :            :                     }
    1162                 :            : 
    1163                 :            :                     // restore line info
    1164         [ #  # ]:          0 :                     if( pLineInfo )
    1165                 :            :                     {
    1166         [ #  # ]:          0 :                         aLineInfo = *pLineInfo;
    1167 [ #  # ][ #  # ]:          0 :                         delete pLineInfo;
    1168 [ #  # ][ #  # ]:          0 :                         bFatLine = ( LINE_NONE != aLineInfo.GetStyle() ) && !aLineInfo.IsDefault();
    1169                 :            :                     }
    1170                 :            : 
    1171 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaPopAction() );
                 [ #  # ]
    1172                 :            : 
    1173                 :            :                     // #106172# Track font relevant data in shadow VDev
    1174         [ #  # ]:          0 :                     aFontVDev.Pop();
    1175                 :            :                 }
    1176                 :          0 :                 break;
    1177                 :            : 
    1178                 :            :                 case( GDI_GRADIENT_ACTION ):
    1179                 :            :                 {
    1180                 :          0 :                     Color   aStartCol;
    1181                 :          0 :                     Color   aEndCol;
    1182                 :            :                     sal_Int16   nStyle;
    1183                 :            :                     sal_Int16   nAngle;
    1184                 :            :                     sal_Int16   nBorder;
    1185                 :            :                     sal_Int16   nOfsX;
    1186                 :            :                     sal_Int16   nOfsY;
    1187                 :            :                     sal_Int16   nIntensityStart;
    1188                 :            :                     sal_Int16   nIntensityEnd;
    1189                 :            : 
    1190         [ #  # ]:          0 :                     ImplReadRect( rIStm, aRect );
    1191         [ #  # ]:          0 :                     rIStm >> nStyle;
    1192         [ #  # ]:          0 :                     ImplReadColor( rIStm, aStartCol );
    1193         [ #  # ]:          0 :                     ImplReadColor( rIStm, aEndCol );
    1194 [ #  # ][ #  # ]:          0 :                     rIStm >> nAngle >> nBorder >> nOfsX >> nOfsY >> nIntensityStart >> nIntensityEnd;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1195                 :            : 
    1196         [ #  # ]:          0 :                     Gradient aGrad( (GradientStyle) nStyle, aStartCol, aEndCol );
    1197                 :            : 
    1198         [ #  # ]:          0 :                     aGrad.SetAngle( nAngle );
    1199         [ #  # ]:          0 :                     aGrad.SetBorder( nBorder );
    1200         [ #  # ]:          0 :                     aGrad.SetOfsX( nOfsX );
    1201         [ #  # ]:          0 :                     aGrad.SetOfsY( nOfsY );
    1202         [ #  # ]:          0 :                     aGrad.SetStartIntensity( nIntensityStart );
    1203         [ #  # ]:          0 :                     aGrad.SetEndIntensity( nIntensityEnd );
    1204 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaGradientAction( aRect, aGrad ) );
         [ #  # ][ #  # ]
    1205                 :            :                 }
    1206                 :          0 :                 break;
    1207                 :            : 
    1208                 :            :                 case( GDI_TRANSPARENT_COMMENT ):
    1209                 :            :                 {
    1210         [ #  # ]:          0 :                     PolyPolygon aPolyPoly;
    1211                 :            :                     sal_Int32       nFollowingActionCount;
    1212                 :            :                     sal_Int16       nTrans;
    1213                 :            : 
    1214 [ #  # ][ #  # ]:          0 :                     rIStm >> aPolyPoly >> nTrans >> nFollowingActionCount;
                 [ #  # ]
    1215         [ #  # ]:          0 :                     ImplSkipActions( rIStm, nFollowingActionCount );
    1216 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaTransparentAction( aPolyPoly, nTrans ) );
                 [ #  # ]
    1217                 :            : 
    1218         [ #  # ]:          0 :                     i += nFollowingActionCount;
    1219                 :            :                 }
    1220                 :          0 :                 break;
    1221                 :            : 
    1222                 :            :                 case( GDI_FLOATTRANSPARENT_COMMENT ):
    1223                 :            :                 {
    1224         [ #  # ]:          0 :                     GDIMetaFile aMtf;
    1225                 :          0 :                     Point       aPos;
    1226                 :          0 :                     Size        aSize;
    1227         [ #  # ]:          0 :                     Gradient    aGradient;
    1228                 :            :                     sal_Int32       nFollowingActionCount;
    1229                 :            : 
    1230 [ #  # ][ #  # ]:          0 :                     rIStm >> aMtf >> aPos >> aSize >> aGradient >> nFollowingActionCount;
         [ #  # ][ #  # ]
                 [ #  # ]
    1231         [ #  # ]:          0 :                     ImplSkipActions( rIStm, nFollowingActionCount );
    1232 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaFloatTransparentAction( aMtf, aPos, aSize, aGradient ) );
                 [ #  # ]
    1233                 :            : 
    1234 [ #  # ][ #  # ]:          0 :                     i += nFollowingActionCount;
    1235                 :            :                 }
    1236                 :          0 :                 break;
    1237                 :            : 
    1238                 :            :                 case( GDI_HATCH_COMMENT ):
    1239                 :            :                 {
    1240         [ #  # ]:          0 :                     PolyPolygon aPolyPoly;
    1241         [ #  # ]:          0 :                     Hatch       aHatch;
    1242                 :            :                     sal_Int32       nFollowingActionCount;
    1243                 :            : 
    1244 [ #  # ][ #  # ]:          0 :                     rIStm >> aPolyPoly >> aHatch >> nFollowingActionCount;
                 [ #  # ]
    1245         [ #  # ]:          0 :                     ImplSkipActions( rIStm, nFollowingActionCount );
    1246 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaHatchAction( aPolyPoly, aHatch ) );
                 [ #  # ]
    1247                 :            : 
    1248 [ #  # ][ #  # ]:          0 :                     i += nFollowingActionCount;
    1249                 :            :                 }
    1250                 :          0 :                 break;
    1251                 :            : 
    1252                 :            :                 case( GDI_REFPOINT_COMMENT ):
    1253                 :            :                 {
    1254                 :          0 :                     Point   aRefPoint;
    1255                 :            :                     sal_Bool    bSet;
    1256                 :            :                     sal_Int32   nFollowingActionCount;
    1257                 :            : 
    1258 [ #  # ][ #  # ]:          0 :                     rIStm >> aRefPoint >> bSet >> nFollowingActionCount;
                 [ #  # ]
    1259         [ #  # ]:          0 :                     ImplSkipActions( rIStm, nFollowingActionCount );
    1260 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaRefPointAction( aRefPoint, bSet ) );
                 [ #  # ]
    1261                 :            : 
    1262                 :          0 :                     i += nFollowingActionCount;
    1263                 :            : 
    1264                 :            :                     // #106172# Track font relevant data in shadow VDev
    1265         [ #  # ]:          0 :                     if( bSet )
    1266         [ #  # ]:          0 :                         aFontVDev.SetRefPoint( aRefPoint );
    1267                 :            :                     else
    1268         [ #  # ]:          0 :                         aFontVDev.SetRefPoint();
    1269                 :            :                 }
    1270                 :          0 :                 break;
    1271                 :            : 
    1272                 :            :                 case( GDI_TEXTLINECOLOR_COMMENT ):
    1273                 :            :                 {
    1274                 :          0 :                     Color   aColor;
    1275                 :            :                     sal_Bool    bSet;
    1276                 :            :                     sal_Int32   nFollowingActionCount;
    1277                 :            : 
    1278 [ #  # ][ #  # ]:          0 :                     rIStm >> aColor >> bSet >> nFollowingActionCount;
                 [ #  # ]
    1279         [ #  # ]:          0 :                     ImplSkipActions( rIStm, nFollowingActionCount );
    1280 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaTextLineColorAction( aColor, bSet ) );
                 [ #  # ]
    1281                 :            : 
    1282                 :          0 :                     i += nFollowingActionCount;
    1283                 :            :                 }
    1284                 :          0 :                 break;
    1285                 :            : 
    1286                 :            :                 case( GDI_TEXTLINE_COMMENT ):
    1287                 :            :                 {
    1288                 :          0 :                     Point   aStartPt;
    1289                 :            :                     //#fdo39428 SvStream no longer supports operator>>(long&)
    1290                 :            :                     sal_Int32  nWidth;
    1291                 :            :                     sal_uInt32 nStrikeout;
    1292                 :            :                     sal_uInt32 nUnderline;
    1293                 :            :                     sal_Int32   nFollowingActionCount;
    1294                 :            : 
    1295 [ #  # ][ #  # ]:          0 :                     rIStm >> aStartPt >> nWidth >> nStrikeout >> nUnderline >> nFollowingActionCount;
         [ #  # ][ #  # ]
                 [ #  # ]
    1296         [ #  # ]:          0 :                     ImplSkipActions( rIStm, nFollowingActionCount );
    1297                 :            :                     rMtf.AddAction( new MetaTextLineAction( aStartPt, nWidth,
    1298                 :            :                                                             (FontStrikeout) nStrikeout,
    1299                 :            :                                                             (FontUnderline) nUnderline,
    1300 [ #  # ][ #  # ]:          0 :                                                             UNDERLINE_NONE ) );
                 [ #  # ]
    1301                 :            : 
    1302                 :          0 :                     i += nFollowingActionCount;
    1303                 :            :                 }
    1304                 :          0 :                 break;
    1305                 :            : 
    1306                 :            :                 case( GDI_GRADIENTEX_COMMENT ):
    1307                 :            :                 {
    1308         [ #  # ]:          0 :                     PolyPolygon aPolyPoly;
    1309         [ #  # ]:          0 :                     Gradient    aGradient;
    1310                 :            :                     sal_Int32       nFollowingActionCount;
    1311                 :            : 
    1312 [ #  # ][ #  # ]:          0 :                     rIStm >> aPolyPoly >> aGradient >> nFollowingActionCount;
                 [ #  # ]
    1313         [ #  # ]:          0 :                     ImplSkipActions( rIStm, nFollowingActionCount );
    1314 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaGradientExAction( aPolyPoly, aGradient ) );
                 [ #  # ]
    1315                 :            : 
    1316 [ #  # ][ #  # ]:          0 :                     i += nFollowingActionCount;
    1317                 :            :                 }
    1318                 :          0 :                 break;
    1319                 :            : 
    1320                 :            :                 case( GDI_COMMENT_COMMENT ):
    1321                 :            :                 {
    1322                 :            :                     sal_Int32   nValue;
    1323                 :            :                     sal_uInt32  nDataSize;
    1324                 :            :                     sal_uInt8*      pData;
    1325                 :            :                     sal_Int32       nFollowingActionCount;
    1326                 :            : 
    1327         [ #  # ]:          0 :                     rtl::OString aComment = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rIStm);
    1328 [ #  # ][ #  # ]:          0 :                     rIStm >> nValue >> nDataSize;
    1329                 :            : 
    1330         [ #  # ]:          0 :                     if( nDataSize )
    1331                 :            :                     {
    1332         [ #  # ]:          0 :                         pData = new sal_uInt8[ nDataSize ];
    1333         [ #  # ]:          0 :                         rIStm.Read( pData, nDataSize );
    1334                 :            :                     }
    1335                 :            :                     else
    1336                 :          0 :                         pData = NULL;
    1337                 :            : 
    1338         [ #  # ]:          0 :                     rIStm >> nFollowingActionCount;
    1339         [ #  # ]:          0 :                     ImplSkipActions( rIStm, nFollowingActionCount );
    1340 [ #  # ][ #  # ]:          0 :                     rMtf.AddAction( new MetaCommentAction( aComment, nValue, pData, nDataSize ) );
                 [ #  # ]
    1341                 :            : 
    1342                 :          0 :                     i += nFollowingActionCount;
    1343                 :            :                 }
    1344                 :          0 :                 break;
    1345                 :            : 
    1346                 :            :                 case ( GDI_UNICODE_COMMENT ):
    1347                 :            :                 {
    1348                 :          0 :                     nUnicodeCommentActionNumber = i + 1;
    1349                 :          0 :                     nUnicodeCommentStreamPos = rIStm.Tell() - 6;
    1350         [ #  # ]:          0 :                     rIStm.SeekRel( nActionSize - 4 );
    1351                 :            :                 }
    1352                 :          0 :                 break;
    1353                 :            : 
    1354                 :            :                 default:
    1355         [ #  # ]:          0 :                     rIStm.SeekRel( nActionSize - 4L );
    1356                 :          0 :                 break;
    1357                 :            :             }
    1358                 :            :         }
    1359                 :            : 
    1360                 :            :     // cleanup push-pop stack if neccessary
    1361 [ #  # ][ #  # ]:          0 :     while( !aLIStack.empty() )
    1362                 :            :     {
    1363 [ #  # ][ #  # ]:          0 :         delete aLIStack.top();
                 [ #  # ]
    1364         [ #  # ]:          0 :         aLIStack.pop();
    1365                 :            :     }
    1366                 :            : 
    1367 [ #  # ][ #  # ]:          0 :     rIStm.SetNumberFormatInt( nOldFormat );
         [ #  # ][ #  # ]
                 [ #  # ]
    1368                 :            : }
    1369                 :            : 
    1370                 :            : // ------------------------------------------------------------------------
    1371                 :            : 
    1372                 :          0 : void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf )
    1373                 :            : {
    1374                 :            :     sal_uLong               nCountPos;
    1375         [ #  # ]:          0 :     Font                aSaveFont;
    1376                 :          0 :     const sal_uInt16        nOldFormat = rOStm.GetNumberFormatInt();
    1377         [ #  # ]:          0 :     rtl_TextEncoding    eActualCharSet = osl_getThreadTextEncoding();
    1378                 :          0 :     const Size          aPrefSize( rMtf.GetPrefSize() );
    1379                 :          0 :     sal_Bool                bRop_0_1 = sal_False;
    1380         [ #  # ]:          0 :     VirtualDevice       aSaveVDev;
    1381                 :          0 :     Color               aLineCol( COL_BLACK );
    1382 [ #  # ][ #  # ]:          0 :     ::std::stack< Color* >  aLineColStack;
    1383                 :            : 
    1384         [ #  # ]:          0 :     rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
    1385                 :            : 
    1386                 :            :     //MagicCode schreiben
    1387         [ #  # ]:          0 :     rOStm << "SVGDI";                                   // Kennung
    1388         [ #  # ]:          0 :     rOStm << (sal_Int16) 42;                                // HeaderSize
    1389         [ #  # ]:          0 :     rOStm << (sal_Int16) 200;                               // VERSION
    1390         [ #  # ]:          0 :     rOStm << (sal_Int32) aPrefSize.Width();
    1391         [ #  # ]:          0 :     rOStm << (sal_Int32) aPrefSize.Height();
    1392         [ #  # ]:          0 :     ImplWriteMapMode( rOStm, rMtf.GetPrefMapMode() );
    1393                 :            : 
    1394                 :            :     // ActionCount wird spaeter geschrieben
    1395                 :          0 :     nCountPos = rOStm.Tell();
    1396         [ #  # ]:          0 :     rOStm.SeekRel( 4L );
    1397                 :            : 
    1398         [ #  # ]:          0 :     const sal_Int32 nActCount = ImplWriteActions( rOStm, rMtf, aSaveVDev, bRop_0_1, aLineCol, aLineColStack, eActualCharSet );
    1399                 :          0 :     const sal_uLong nActPos = rOStm.Tell();
    1400                 :            : 
    1401         [ #  # ]:          0 :     rOStm.Seek( nCountPos );
    1402         [ #  # ]:          0 :     rOStm << nActCount;
    1403         [ #  # ]:          0 :     rOStm.Seek( nActPos );
    1404         [ #  # ]:          0 :     rOStm.SetNumberFormatInt( nOldFormat );
    1405                 :            : 
    1406                 :            :     // cleanup push-pop stack if neccessary
    1407 [ #  # ][ #  # ]:          0 :     while ( !aLineColStack.empty() )
    1408                 :            :     {
    1409         [ #  # ]:          0 :         delete aLineColStack.top();
    1410         [ #  # ]:          0 :         aLineColStack.pop();
    1411 [ #  # ][ #  # ]:          0 :     }
    1412                 :          0 : }
    1413                 :            : 
    1414                 :            : // ------------------------------------------------------------------------
    1415                 :            : 
    1416                 :          0 : sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
    1417                 :            :                                       VirtualDevice& rSaveVDev, sal_Bool& rRop_0_1,
    1418                 :            :                                       Color& rLineCol, ::std::stack< Color* >& rLineColStack,
    1419                 :            :                                       rtl_TextEncoding& rActualCharSet )
    1420                 :            : {
    1421                 :          0 :     sal_uLong nCount = 0;
    1422         [ #  # ]:          0 :     for( size_t i = 0, nActionCount = rMtf.GetActionSize(); i < nActionCount; i++ )
    1423                 :            :     {
    1424                 :          0 :         const MetaAction* pAction = rMtf.GetAction( i );
    1425                 :            : 
    1426   [ #  #  #  #  :          0 :         switch( pAction->GetType() )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
    1427                 :            :         {
    1428                 :            :             case( META_PIXEL_ACTION ):
    1429                 :            :             {
    1430                 :          0 :                 MetaPixelAction* pAct = (MetaPixelAction*) pAction;
    1431                 :            : 
    1432                 :          0 :                 rOStm << (sal_Int16) GDI_PIXEL_ACTION;
    1433                 :          0 :                 rOStm << (sal_Int32) 18;
    1434                 :          0 :                 rOStm << pAct->GetPoint();
    1435                 :          0 :                 ImplWriteColor( rOStm, pAct->GetColor() );
    1436                 :          0 :                 nCount++;
    1437                 :            :             }
    1438                 :          0 :             break;
    1439                 :            : 
    1440                 :            :             case( META_POINT_ACTION ):
    1441                 :            :             {
    1442                 :          0 :                 MetaPointAction* pAct = (MetaPointAction*) pAction;
    1443                 :            : 
    1444                 :          0 :                 rOStm << (sal_Int16) GDI_POINT_ACTION;
    1445                 :          0 :                 rOStm << (sal_Int32) 12;
    1446                 :          0 :                 rOStm << pAct->GetPoint();
    1447                 :          0 :                 nCount++;
    1448                 :            :             }
    1449                 :          0 :             break;
    1450                 :            : 
    1451                 :            :             case( META_LINE_ACTION ):
    1452                 :            :             {
    1453                 :          0 :                 MetaLineAction* pAct = (MetaLineAction*) pAction;
    1454                 :          0 :                 const LineInfo& rInfo = pAct->GetLineInfo();
    1455 [ #  # ][ #  # ]:          0 :                 const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle()));
    1456 [ #  # ][ #  # ]:          0 :                 const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin());
    1457                 :          0 :                 const bool bLineDashDot(LINE_DASH == rInfo.GetStyle());
    1458                 :            : 
    1459         [ #  # ]:          0 :                 if( bFatLine )
    1460                 :            :                 {
    1461                 :          0 :                     ImplWritePushAction( rOStm );
    1462                 :          0 :                     ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
    1463                 :            : 
    1464         [ #  # ]:          0 :                     if(bLineJoin)
    1465                 :            :                     {
    1466                 :          0 :                         rOStm << (sal_Int16) GDI_LINEJOIN_ACTION;
    1467                 :          0 :                         rOStm << (sal_Int32) 6;
    1468                 :          0 :                         rOStm << (sal_Int16) rInfo.GetLineJoin();
    1469                 :            :                     }
    1470                 :            : 
    1471         [ #  # ]:          0 :                     if(bLineDashDot)
    1472                 :            :                     {
    1473                 :          0 :                         rOStm << (sal_Int16) GDI_LINEDASHDOT_ACTION;
    1474                 :          0 :                         rOStm << (sal_Int32) 4 + 16;
    1475                 :          0 :                         rOStm << (sal_Int16)rInfo.GetDashCount();
    1476                 :          0 :                         rOStm << (sal_Int32)rInfo.GetDashLen();
    1477                 :          0 :                         rOStm << (sal_Int16)rInfo.GetDotCount();
    1478                 :          0 :                         rOStm << (sal_Int32)rInfo.GetDotLen();
    1479                 :          0 :                         rOStm << (sal_Int32)rInfo.GetDistance();
    1480                 :            :                     }
    1481                 :            :                 }
    1482                 :            : 
    1483                 :          0 :                 rOStm << (sal_Int16) GDI_LINE_ACTION;
    1484                 :          0 :                 rOStm << (sal_Int32) 20;
    1485                 :          0 :                 rOStm << pAct->GetStartPoint();
    1486                 :          0 :                 rOStm << pAct->GetEndPoint();
    1487                 :          0 :                 nCount++;
    1488                 :            : 
    1489         [ #  # ]:          0 :                 if( bFatLine )
    1490                 :            :                 {
    1491                 :          0 :                     ImplWritePopAction( rOStm );
    1492                 :          0 :                     nCount += 3;
    1493                 :            : 
    1494         [ #  # ]:          0 :                     if(bLineJoin)
    1495                 :            :                     {
    1496                 :          0 :                         nCount += 1;
    1497                 :            :                     }
    1498                 :            : 
    1499         [ #  # ]:          0 :                     if(bLineDashDot)
    1500                 :            :                     {
    1501                 :          0 :                         nCount += 1;
    1502                 :            :                     }
    1503                 :            :                 }
    1504                 :            :             }
    1505                 :          0 :             break;
    1506                 :            : 
    1507                 :            :             case( META_RECT_ACTION ):
    1508                 :            :             {
    1509                 :          0 :                 MetaRectAction* pAct = (MetaRectAction*) pAction;
    1510                 :            : 
    1511                 :          0 :                 rOStm << (sal_Int16) GDI_RECT_ACTION;
    1512                 :          0 :                 rOStm << (sal_Int32) 28;
    1513                 :          0 :                 ImplWriteRect( rOStm, pAct->GetRect() );
    1514                 :          0 :                 rOStm << (sal_Int32) 0;
    1515                 :          0 :                 rOStm << (sal_Int32) 0;
    1516                 :          0 :                 nCount++;
    1517                 :            :             }
    1518                 :          0 :             break;
    1519                 :            : 
    1520                 :            :             case( META_ROUNDRECT_ACTION ):
    1521                 :            :             {
    1522                 :          0 :                 MetaRoundRectAction* pAct = (MetaRoundRectAction*) pAction;
    1523                 :            : 
    1524                 :          0 :                 rOStm << (sal_Int16) GDI_RECT_ACTION;
    1525                 :          0 :                 rOStm << (sal_Int32) 28;
    1526                 :          0 :                 ImplWriteRect( rOStm, pAct->GetRect() );
    1527                 :          0 :                 rOStm << (sal_Int32) pAct->GetHorzRound();
    1528                 :          0 :                 rOStm << (sal_Int32) pAct->GetVertRound();
    1529                 :          0 :                 nCount++;
    1530                 :            :             }
    1531                 :          0 :             break;
    1532                 :            : 
    1533                 :            :             case( META_ELLIPSE_ACTION ):
    1534                 :            :             {
    1535                 :          0 :                 MetaEllipseAction* pAct = (MetaEllipseAction*) pAction;
    1536                 :            : 
    1537                 :          0 :                 rOStm << (sal_Int16) GDI_ELLIPSE_ACTION;
    1538                 :          0 :                 rOStm << (sal_Int32) 20;
    1539                 :          0 :                 ImplWriteRect( rOStm, pAct->GetRect() );
    1540                 :          0 :                 nCount++;
    1541                 :            :             }
    1542                 :          0 :             break;
    1543                 :            : 
    1544                 :            :             case( META_ARC_ACTION ):
    1545                 :            :             {
    1546                 :          0 :                 MetaArcAction* pAct = (MetaArcAction*) pAction;
    1547                 :            : 
    1548                 :          0 :                 rOStm << (sal_Int16) GDI_ARC_ACTION;
    1549                 :          0 :                 rOStm << (sal_Int32) 36;
    1550                 :          0 :                 ImplWriteRect( rOStm, pAct->GetRect() );
    1551                 :          0 :                 rOStm << pAct->GetStartPoint();
    1552                 :          0 :                 rOStm << pAct->GetEndPoint();
    1553                 :          0 :                 nCount++;
    1554                 :            :             }
    1555                 :          0 :             break;
    1556                 :            : 
    1557                 :            :             case( META_PIE_ACTION ):
    1558                 :            :             {
    1559                 :          0 :                 MetaPieAction* pAct = (MetaPieAction*) pAction;
    1560                 :            : 
    1561                 :          0 :                 rOStm << (sal_Int16) GDI_PIE_ACTION;
    1562                 :          0 :                 rOStm << (sal_Int32) 36;
    1563                 :          0 :                 ImplWriteRect( rOStm, pAct->GetRect() );
    1564                 :          0 :                 rOStm << pAct->GetStartPoint();
    1565                 :          0 :                 rOStm << pAct->GetEndPoint();
    1566                 :          0 :                 nCount++;
    1567                 :            :             }
    1568                 :          0 :             break;
    1569                 :            : 
    1570                 :            :             case( META_CHORD_ACTION ):
    1571                 :            :             {
    1572                 :          0 :                 MetaChordAction*    pAct = (MetaChordAction*) pAction;
    1573                 :          0 :                 Polygon             aChordPoly( pAct->GetRect(), pAct->GetStartPoint(),
    1574         [ #  # ]:          0 :                                                 pAct->GetEndPoint(), POLY_CHORD );
    1575         [ #  # ]:          0 :                 const sal_uInt16        nPoints = aChordPoly.GetSize();
    1576                 :            : 
    1577         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_POLYGON_ACTION;
    1578         [ #  # ]:          0 :                 rOStm << (sal_Int32) ( 8 + ( nPoints << 3 ) );
    1579         [ #  # ]:          0 :                 rOStm << (sal_Int32) nPoints;
    1580                 :            : 
    1581         [ #  # ]:          0 :                 for( sal_uInt16 n = 0; n < nPoints; n++ )
    1582 [ #  # ][ #  # ]:          0 :                     rOStm << aChordPoly[ n ];
    1583         [ #  # ]:          0 :                 nCount++;
    1584                 :            :             }
    1585                 :          0 :             break;
    1586                 :            : 
    1587                 :            :             case( META_POLYLINE_ACTION ):
    1588                 :            :             {
    1589                 :            :                 // #i102224#
    1590                 :          0 :                 MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction;
    1591                 :            :                 // #i102224# Here the evtl. curved nature of Polygon was
    1592                 :            :                 // ignored (for all those Years). Adapted to at least write
    1593                 :            :                 // a polygon representing the curve as good as possible
    1594         [ #  # ]:          0 :                  Polygon aSimplePoly;
    1595         [ #  # ]:          0 :                  pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly);
    1596                 :          0 :                 const LineInfo& rInfo = pAct->GetLineInfo();
    1597         [ #  # ]:          0 :                  const sal_uInt16 nPoints(aSimplePoly.GetSize());
    1598 [ #  # ][ #  # ]:          0 :                 const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle()));
    1599 [ #  # ][ #  # ]:          0 :                 const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin());
    1600                 :          0 :                 const bool bLineDashDot(LINE_DASH == rInfo.GetStyle());
    1601                 :            : 
    1602         [ #  # ]:          0 :                 if( bFatLine )
    1603                 :            :                 {
    1604         [ #  # ]:          0 :                     ImplWritePushAction( rOStm );
    1605         [ #  # ]:          0 :                     ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
    1606                 :            : 
    1607         [ #  # ]:          0 :                     if(bLineJoin)
    1608                 :            :                     {
    1609         [ #  # ]:          0 :                         rOStm << (sal_Int16) GDI_LINEJOIN_ACTION;
    1610         [ #  # ]:          0 :                         rOStm << (sal_Int32) 6;
    1611         [ #  # ]:          0 :                         rOStm << (sal_Int16) rInfo.GetLineJoin();
    1612                 :            :                     }
    1613                 :            :                 }
    1614                 :            : 
    1615         [ #  # ]:          0 :                 if(bLineDashDot)
    1616                 :            :                 {
    1617         [ #  # ]:          0 :                     rOStm << (sal_Int16) GDI_LINEDASHDOT_ACTION;
    1618         [ #  # ]:          0 :                     rOStm << (sal_Int32) 4 + 16;
    1619         [ #  # ]:          0 :                     rOStm << (sal_Int16)rInfo.GetDashCount();
    1620         [ #  # ]:          0 :                     rOStm << (sal_Int32)rInfo.GetDashLen();
    1621         [ #  # ]:          0 :                     rOStm << (sal_Int16)rInfo.GetDotCount();
    1622         [ #  # ]:          0 :                     rOStm << (sal_Int32)rInfo.GetDotLen();
    1623         [ #  # ]:          0 :                     rOStm << (sal_Int32)rInfo.GetDistance();
    1624                 :            :                 }
    1625                 :            : 
    1626         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_POLYLINE_ACTION;
    1627         [ #  # ]:          0 :                 rOStm << (sal_Int32) ( 8 + ( nPoints << 3 ) );
    1628         [ #  # ]:          0 :                 rOStm << (sal_Int32) nPoints;
    1629                 :            : 
    1630         [ #  # ]:          0 :                 for( sal_uInt16 n = 0; n < nPoints; n++ )
    1631                 :            :                 {
    1632 [ #  # ][ #  # ]:          0 :                     rOStm << aSimplePoly[ n ];
    1633                 :            :                 }
    1634                 :            : 
    1635                 :          0 :                 nCount++;
    1636                 :            : 
    1637         [ #  # ]:          0 :                 const PolyPolygon aPolyPolygon(pAct->GetPolygon());
    1638 [ #  # ][ #  # ]:          0 :                 if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true))
    1639                 :            :                 {
    1640                 :          0 :                     nCount++;
    1641                 :            :                 }
    1642                 :            : 
    1643         [ #  # ]:          0 :                 if( bFatLine )
    1644                 :            :                 {
    1645         [ #  # ]:          0 :                     ImplWritePopAction( rOStm );
    1646                 :          0 :                     nCount += 3;
    1647                 :            : 
    1648         [ #  # ]:          0 :                     if(bLineJoin)
    1649                 :            :                     {
    1650                 :          0 :                         nCount += 1;
    1651                 :            :                     }
    1652                 :            :                 }
    1653                 :            : 
    1654         [ #  # ]:          0 :                 if(bLineDashDot)
    1655                 :            :                 {
    1656                 :          0 :                     nCount += 1;
    1657 [ #  # ][ #  # ]:          0 :                 }
    1658                 :            :             }
    1659                 :          0 :             break;
    1660                 :            : 
    1661                 :            :             case( META_POLYGON_ACTION ):
    1662                 :            :             {
    1663                 :          0 :                 MetaPolygonAction* pAct = (MetaPolygonAction*)pAction;
    1664                 :            :                 // #i102224# Here the evtl. curved nature of Polygon was
    1665                 :            :                 // ignored (for all those Years). Adapted to at least write
    1666                 :            :                 // a polygon representing the curve as good as possible
    1667         [ #  # ]:          0 :                  Polygon aSimplePoly;
    1668         [ #  # ]:          0 :                  pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly);
    1669         [ #  # ]:          0 :                 const sal_uInt16 nPoints(aSimplePoly.GetSize());
    1670                 :            : 
    1671         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_POLYGON_ACTION;
    1672         [ #  # ]:          0 :                 rOStm << (sal_Int32) ( 8 + ( nPoints << 3 ) );
    1673         [ #  # ]:          0 :                 rOStm << (sal_Int32) nPoints;
    1674                 :            : 
    1675         [ #  # ]:          0 :                 for( sal_uInt16 n = 0; n < nPoints; n++ )
    1676 [ #  # ][ #  # ]:          0 :                     rOStm << aSimplePoly[ n ];
    1677                 :            : 
    1678                 :          0 :                 nCount++;
    1679                 :            : 
    1680         [ #  # ]:          0 :                 const PolyPolygon aPolyPolygon(pAct->GetPolygon());
    1681 [ #  # ][ #  # ]:          0 :                 if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true))
    1682                 :            :                 {
    1683                 :          0 :                     nCount++;
    1684 [ #  # ][ #  # ]:          0 :                 }
    1685                 :            :             }
    1686                 :          0 :             break;
    1687                 :            : 
    1688                 :            :             case( META_POLYPOLYGON_ACTION ):
    1689                 :            :             {
    1690                 :          0 :                 MetaPolyPolygonAction* pAct = (MetaPolyPolygonAction*) pAction;
    1691                 :          0 :                 ImplWritePolyPolyAction( rOStm, pAct->GetPolyPolygon() );
    1692                 :          0 :                 nCount++;
    1693                 :            : 
    1694         [ #  # ]:          0 :                 if(ImplWriteExtendedPolyPolygonAction(rOStm, pAct->GetPolyPolygon(), true))
    1695                 :            :                 {
    1696                 :          0 :                     nCount++;
    1697                 :            :                 }
    1698                 :            :             }
    1699                 :          0 :             break;
    1700                 :            : 
    1701                 :            :             case( META_TEXT_ACTION ):
    1702                 :            :             {
    1703                 :          0 :                 MetaTextAction* pAct = (MetaTextAction*) pAction;
    1704         [ #  # ]:          0 :                 String          aUniText( pAct->GetText() );
    1705                 :            :                 rtl::OString aText(rtl::OUStringToOString(aUniText,
    1706 [ #  # ][ #  # ]:          0 :                     rActualCharSet));
    1707                 :          0 :                 const sal_uLong nStrLen = aText.getLength();
    1708                 :            : 
    1709 [ #  # ][ #  # ]:          0 :                 if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
    1710                 :          0 :                     nCount++;
    1711                 :            : 
    1712         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_TEXT_ACTION;
    1713         [ #  # ]:          0 :                 rOStm << (sal_Int32) ( 24 + ( nStrLen + 1 ) );
    1714         [ #  # ]:          0 :                 rOStm << pAct->GetPoint();
    1715         [ #  # ]:          0 :                 rOStm << (sal_Int32) pAct->GetIndex();
    1716         [ #  # ]:          0 :                 rOStm << (sal_Int32) pAct->GetLen();
    1717         [ #  # ]:          0 :                 rOStm << (sal_Int32) nStrLen;
    1718         [ #  # ]:          0 :                 rOStm.Write( aText.getStr(), nStrLen + 1 );
    1719         [ #  # ]:          0 :                 nCount++;
    1720                 :            :             }
    1721                 :          0 :             break;
    1722                 :            : 
    1723                 :            :             case( META_TEXTARRAY_ACTION ):
    1724                 :            :             {
    1725                 :          0 :                 MetaTextArrayAction*    pAct = (MetaTextArrayAction*)pAction;
    1726                 :          0 :                 rtl::OString aText(rtl::OUStringToOString(pAct->GetText(),
    1727         [ #  # ]:          0 :                     rActualCharSet));
    1728 [ #  # ][ #  # ]:          0 :                 String                  aUniText( pAct->GetText(), pAct->GetIndex(), pAct->GetLen() );
                 [ #  # ]
    1729                 :            :                 sal_uLong                   nAryLen;
    1730                 :          0 :                 sal_uLong                   nLen = pAct->GetLen();
    1731                 :          0 :                 const sal_uLong nTextLen = aText.getLength();
    1732                 :          0 :                 sal_Int32*              pDXArray = pAct->GetDXArray();
    1733                 :            : 
    1734 [ #  # ][ #  # ]:          0 :                 if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
    1735                 :          0 :                     nCount++;
    1736                 :            : 
    1737         [ #  # ]:          0 :                 if( ( nLen + pAct->GetIndex() ) > nTextLen )
    1738                 :            :                 {
    1739         [ #  # ]:          0 :                     if( pAct->GetIndex() <= nTextLen )
    1740                 :          0 :                         nLen = nTextLen - pAct->GetIndex();
    1741                 :            :                     else
    1742                 :          0 :                         nLen = 0UL;
    1743                 :            :                 }
    1744                 :            : 
    1745 [ #  # ][ #  # ]:          0 :                 if( !pDXArray || !nLen )
    1746                 :          0 :                     nAryLen = 0;
    1747                 :            :                 else
    1748                 :          0 :                     nAryLen = nLen; // #105987# Write out all of DX array
    1749                 :            : 
    1750         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_TEXTARRAY_ACTION;
    1751         [ #  # ]:          0 :                 rOStm << (sal_Int32) ( 28 + ( nLen + 1 ) + ( nAryLen * 4 ) );
    1752         [ #  # ]:          0 :                 rOStm << pAct->GetPoint();
    1753         [ #  # ]:          0 :                 rOStm << (sal_Int32) 0;
    1754         [ #  # ]:          0 :                 rOStm << (sal_Int32) nLen;
    1755         [ #  # ]:          0 :                 rOStm << (sal_Int32) nLen;
    1756         [ #  # ]:          0 :                 rOStm << (sal_Int32) nAryLen;
    1757         [ #  # ]:          0 :                 rOStm.Write( aText.getStr()+pAct->GetIndex(), nLen + 1 );
    1758                 :            : 
    1759         [ #  # ]:          0 :                 for( sal_uLong n = 0UL ; n < nAryLen; n++ )
    1760         [ #  # ]:          0 :                     rOStm << (sal_Int32) pDXArray[ n ];
    1761                 :            : 
    1762         [ #  # ]:          0 :                 nCount++;
    1763                 :            :             }
    1764                 :          0 :             break;
    1765                 :            : 
    1766                 :            :             case( META_STRETCHTEXT_ACTION ):
    1767                 :            :             {
    1768                 :          0 :                 MetaStretchTextAction*  pAct = (MetaStretchTextAction*) pAction;
    1769         [ #  # ]:          0 :                 String                  aUniText( pAct->GetText() );
    1770                 :            :                 rtl::OString aText(rtl::OUStringToOString(aUniText,
    1771 [ #  # ][ #  # ]:          0 :                     rActualCharSet));
    1772                 :          0 :                 const sal_uLong nStrLen = aText.getLength();
    1773                 :            : 
    1774 [ #  # ][ #  # ]:          0 :                 if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
    1775                 :          0 :                     nCount++;
    1776                 :            : 
    1777         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_STRETCHTEXT_ACTION;
    1778         [ #  # ]:          0 :                 rOStm << (sal_Int32) ( 28 + ( nStrLen + 1 ) );
    1779         [ #  # ]:          0 :                 rOStm << pAct->GetPoint();
    1780         [ #  # ]:          0 :                 rOStm << (sal_Int32) pAct->GetIndex();
    1781         [ #  # ]:          0 :                 rOStm << (sal_Int32) pAct->GetLen();
    1782         [ #  # ]:          0 :                 rOStm << (sal_Int32) nStrLen;
    1783         [ #  # ]:          0 :                 rOStm << (sal_Int32) pAct->GetWidth();
    1784         [ #  # ]:          0 :                 rOStm.Write( aText.getStr(), nStrLen + 1 );
    1785         [ #  # ]:          0 :                 nCount++;
    1786                 :            :             }
    1787                 :          0 :             break;
    1788                 :            : 
    1789                 :            :             case( META_BMP_ACTION ):
    1790                 :            :             {
    1791                 :          0 :                 MetaBmpAction* pAct = (MetaBmpAction*) pAction;
    1792                 :            : 
    1793                 :          0 :                 rOStm << (sal_Int16) GDI_BITMAP_ACTION;
    1794                 :          0 :                 rOStm << (sal_Int32) 12;
    1795                 :          0 :                 rOStm << pAct->GetPoint();
    1796                 :          0 :                 rOStm << pAct->GetBitmap();
    1797                 :          0 :                 nCount++;
    1798                 :            :             }
    1799                 :          0 :             break;
    1800                 :            : 
    1801                 :            :             case( META_BMPSCALE_ACTION ):
    1802                 :            :             {
    1803                 :          0 :                 MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction;
    1804                 :            : 
    1805                 :          0 :                 rOStm << (sal_Int16) GDI_BITMAPSCALE_ACTION;
    1806                 :          0 :                 rOStm << (sal_Int32) 20;
    1807                 :          0 :                 rOStm << pAct->GetPoint();
    1808                 :          0 :                 rOStm << pAct->GetSize();
    1809                 :          0 :                 rOStm << pAct->GetBitmap();
    1810                 :          0 :                 nCount++;
    1811                 :            :             }
    1812                 :          0 :             break;
    1813                 :            : 
    1814                 :            :             case( META_BMPSCALEPART_ACTION ):
    1815                 :            :             {
    1816                 :          0 :                 MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction;
    1817                 :            : 
    1818                 :          0 :                 rOStm << (sal_Int16) GDI_BITMAPSCALEPART_ACTION;
    1819                 :          0 :                 rOStm << (sal_Int32) 36;
    1820                 :          0 :                 rOStm << pAct->GetDestPoint();
    1821                 :          0 :                 rOStm << pAct->GetDestSize();
    1822                 :          0 :                 rOStm << pAct->GetSrcPoint();
    1823                 :          0 :                 rOStm << pAct->GetSrcSize();
    1824                 :          0 :                 rOStm << pAct->GetBitmap();
    1825                 :          0 :                 nCount++;
    1826                 :            :             }
    1827                 :          0 :             break;
    1828                 :            : 
    1829                 :            :             case( META_BMPEX_ACTION ):
    1830                 :            :             {
    1831                 :          0 :                 MetaBmpExAction*    pAct = (MetaBmpExAction*) pAction;
    1832 [ #  # ][ #  # ]:          0 :                 const Bitmap        aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
                 [ #  # ]
    1833                 :            : 
    1834         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_BITMAP_ACTION;
    1835         [ #  # ]:          0 :                 rOStm << (sal_Int32) 12;
    1836         [ #  # ]:          0 :                 rOStm << pAct->GetPoint();
    1837         [ #  # ]:          0 :                 rOStm << aBmp;
    1838         [ #  # ]:          0 :                 nCount++;
    1839                 :            :             }
    1840                 :          0 :             break;
    1841                 :            : 
    1842                 :            :             case( META_BMPEXSCALE_ACTION ):
    1843                 :            :             {
    1844                 :          0 :                 MetaBmpExScaleAction*   pAct = (MetaBmpExScaleAction*) pAction;
    1845 [ #  # ][ #  # ]:          0 :                 const Bitmap            aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
                 [ #  # ]
    1846                 :            : 
    1847         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_BITMAPSCALE_ACTION;
    1848         [ #  # ]:          0 :                 rOStm << (sal_Int32) 20;
    1849         [ #  # ]:          0 :                 rOStm << pAct->GetPoint();
    1850         [ #  # ]:          0 :                 rOStm << pAct->GetSize();
    1851         [ #  # ]:          0 :                 rOStm << aBmp;
    1852         [ #  # ]:          0 :                 nCount++;
    1853                 :            :             }
    1854                 :          0 :             break;
    1855                 :            : 
    1856                 :            :             case( META_BMPEXSCALEPART_ACTION ):
    1857                 :            :             {
    1858                 :          0 :                 MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction;
    1859 [ #  # ][ #  # ]:          0 :                 const Bitmap            aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
                 [ #  # ]
    1860                 :            : 
    1861         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_BITMAPSCALEPART_ACTION;
    1862         [ #  # ]:          0 :                 rOStm << (sal_Int32) 36;
    1863         [ #  # ]:          0 :                 rOStm << pAct->GetDestPoint();
    1864         [ #  # ]:          0 :                 rOStm << pAct->GetDestSize();
    1865         [ #  # ]:          0 :                 rOStm << pAct->GetSrcPoint();
    1866         [ #  # ]:          0 :                 rOStm << pAct->GetSrcSize();
    1867         [ #  # ]:          0 :                 rOStm << aBmp;
    1868         [ #  # ]:          0 :                 nCount++;
    1869                 :            :             }
    1870                 :          0 :             break;
    1871                 :            : 
    1872                 :            :             case( META_GRADIENT_ACTION ):
    1873                 :            :             {
    1874                 :          0 :                 MetaGradientAction* pAct = (MetaGradientAction*) pAction;
    1875                 :          0 :                 const Gradient&     rGrad = pAct->GetGradient();
    1876                 :            : 
    1877                 :          0 :                 rOStm << (sal_Int16) GDI_GRADIENT_ACTION;
    1878                 :          0 :                 rOStm << (sal_Int32) 46;
    1879                 :          0 :                 ImplWriteRect( rOStm, pAct->GetRect() );
    1880                 :          0 :                 rOStm << (sal_Int16) rGrad.GetStyle();
    1881                 :          0 :                 ImplWriteColor( rOStm, rGrad.GetStartColor() );
    1882                 :          0 :                 ImplWriteColor( rOStm, rGrad.GetEndColor() );
    1883                 :          0 :                 rOStm << (sal_Int16) rGrad.GetAngle();
    1884                 :          0 :                 rOStm << (sal_Int16) rGrad.GetBorder();
    1885                 :          0 :                 rOStm << (sal_Int16) rGrad.GetOfsX();
    1886                 :          0 :                 rOStm << (sal_Int16) rGrad.GetOfsY();
    1887                 :          0 :                 rOStm << (sal_Int16) rGrad.GetStartIntensity();
    1888                 :          0 :                 rOStm << (sal_Int16) rGrad.GetEndIntensity();
    1889                 :          0 :                 nCount++;
    1890                 :            :             }
    1891                 :          0 :             break;
    1892                 :            : 
    1893                 :            :             case( META_GRADIENTEX_ACTION ):
    1894                 :            :             {
    1895                 :          0 :                 const MetaGradientExAction* pA = (MetaGradientExAction*) pAction;
    1896                 :            :                 sal_uLong                       nOldPos, nNewPos;
    1897                 :            : 
    1898                 :            :                 // write RefPoint comment
    1899                 :          0 :                 rOStm << (sal_Int16) GDI_GRADIENTEX_COMMENT;
    1900                 :            : 
    1901                 :            :                 // we'll write the ActionSize later
    1902                 :          0 :                 nOldPos = rOStm.Tell();
    1903                 :          0 :                 rOStm.SeekRel( 4 );
    1904                 :            : 
    1905                 :            :                 // write data
    1906                 :          0 :                 rOStm << pA->GetPolyPolygon() << pA->GetGradient();
    1907                 :          0 :                 rOStm << (sal_Int32) 0; // number of actions that follow this comment
    1908                 :            : 
    1909                 :            :                 // calculate and write ActionSize of comment
    1910                 :          0 :                 nNewPos = rOStm.Tell();
    1911                 :          0 :                 rOStm.Seek( nOldPos );
    1912                 :          0 :                 rOStm << (sal_Int32) ( nNewPos - nOldPos );
    1913                 :          0 :                 rOStm.Seek( nNewPos );
    1914                 :            : 
    1915                 :          0 :                 nCount++;
    1916                 :            :             }
    1917                 :          0 :             break;
    1918                 :            : 
    1919                 :            :             case( META_WALLPAPER_ACTION ):
    1920                 :            :             {
    1921                 :          0 :                 MetaWallpaperAction*    pAct = (MetaWallpaperAction*) pAction;
    1922                 :          0 :                 const Color&            rColor = pAct->GetWallpaper().GetColor();
    1923                 :            : 
    1924                 :          0 :                 ImplWritePushAction( rOStm );
    1925                 :          0 :                 ImplWriteLineColor( rOStm, rColor, 1 );
    1926                 :          0 :                 ImplWriteFillColor( rOStm, rColor, 1 );
    1927                 :            : 
    1928                 :          0 :                 rOStm << (sal_Int16) GDI_RECT_ACTION;
    1929                 :          0 :                 rOStm << (sal_Int32) 28;
    1930                 :          0 :                 ImplWriteRect( rOStm, pAct->GetRect() );
    1931                 :          0 :                 rOStm << (sal_Int32) 0;
    1932                 :          0 :                 rOStm << (sal_Int32) 0;
    1933                 :            : 
    1934                 :          0 :                 ImplWritePopAction( rOStm );
    1935                 :          0 :                 nCount += 5;
    1936                 :            :             }
    1937                 :          0 :             break;
    1938                 :            : 
    1939                 :            :             case( META_CLIPREGION_ACTION ):
    1940                 :            :             {
    1941                 :          0 :                 MetaClipRegionAction*   pAct = (MetaClipRegionAction*) pAction;
    1942                 :          0 :                 const Region&           rRegion = pAct->GetRegion();
    1943         [ #  # ]:          0 :                 Rectangle               aClipRect;
    1944                 :            : 
    1945         [ #  # ]:          0 :                 rOStm << (sal_Int16) GDI_CLIPREGION_ACTION;
    1946         [ #  # ]:          0 :                 rOStm << (sal_Int32) 24;
    1947                 :            : 
    1948         [ #  # ]:          0 :                 if( pAct->IsClipping() )
    1949                 :            :                 {
    1950         [ #  # ]:          0 :                     aClipRect = rRegion.GetBoundRect();
    1951         [ #  # ]:          0 :                     rOStm << (sal_Int16) 1;
    1952                 :            :                 }
    1953                 :            :                 else
    1954         [ #  # ]:          0 :                     rOStm << (sal_Int16) 0;
    1955                 :            : 
    1956         [ #  # ]:          0 :                 rOStm << (sal_Int16) 0;
    1957         [ #  # ]:          0 :                 ImplWriteRect( rOStm, aClipRect );
    1958                 :            : 
    1959         [ #  # ]:          0 :                 if( pAct->IsClipping() )
    1960         [ #  # ]:          0 :                     ImplWriteRect( rOStm, aClipRect );
    1961                 :            : 
    1962                 :          0 :                 nCount++;
    1963                 :            :             }
    1964                 :          0 :             break;
    1965                 :            : 
    1966                 :            :             case( META_ISECTRECTCLIPREGION_ACTION ):
    1967                 :            :             {
    1968                 :          0 :                 MetaISectRectClipRegionAction* pAct = (MetaISectRectClipRegionAction*) pAction;
    1969                 :            : 
    1970                 :          0 :                 rOStm << (sal_Int16) GDI_ISECTCLIPREGION_ACTION;
    1971                 :          0 :                 rOStm << (sal_Int32) 20;
    1972                 :          0 :                 rOStm << pAct->GetRect();
    1973                 :          0 :                 nCount++;
    1974                 :            :             }
    1975                 :          0 :             break;
    1976                 :            : 
    1977                 :            :             case( META_MOVECLIPREGION_ACTION ):
    1978                 :            :             {
    1979                 :          0 :                 MetaMoveClipRegionAction* pAct = (MetaMoveClipRegionAction*) pAction;
    1980                 :            : 
    1981                 :          0 :                 rOStm << (sal_Int16) GDI_MOVECLIPREGION_ACTION;
    1982                 :          0 :                 rOStm << (sal_Int32) 12;
    1983                 :          0 :                 rOStm << (sal_Int32) pAct->GetHorzMove();
    1984                 :          0 :                 rOStm << (sal_Int32) pAct->GetVertMove();
    1985                 :          0 :                 nCount++;
    1986                 :            :             }
    1987                 :          0 :             break;
    1988                 :            : 
    1989                 :            :             case( META_LINECOLOR_ACTION ):
    1990                 :            :             {
    1991                 :          0 :                 MetaLineColorAction* pAct = (MetaLineColorAction*) pAction;
    1992         [ #  # ]:          0 :                 ImplWriteLineColor( rOStm, rLineCol = pAct->GetColor(), pAct->IsSetting() ? 1 : 0 );
    1993                 :          0 :                 nCount++;
    1994                 :            :             }
    1995                 :          0 :             break;
    1996                 :            : 
    1997                 :            :             case( META_FILLCOLOR_ACTION ):
    1998                 :            :             {
    1999                 :          0 :                 MetaFillColorAction* pAct = (MetaFillColorAction*) pAction;
    2000         [ #  # ]:          0 :                 ImplWriteFillColor( rOStm, pAct->GetColor(), pAct->IsSetting() ? 1 : 0 );
    2001                 :          0 :                 nCount++;
    2002                 :            :             }
    2003                 :          0 :             break;
    2004                 :            : 
    2005                 :            :             case( META_FONT_ACTION ):
    2006                 :            :             {
    2007                 :          0 :                 rSaveVDev.SetFont( ( (MetaFontAction*) pAction )->GetFont() );
    2008                 :          0 :                 ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
    2009                 :          0 :                 nCount++;
    2010                 :            :             }
    2011                 :          0 :             break;
    2012                 :            : 
    2013                 :            :             case( META_TEXTCOLOR_ACTION ):
    2014                 :            :             {
    2015         [ #  # ]:          0 :                 Font aSaveFont( rSaveVDev.GetFont() );
    2016                 :            : 
    2017         [ #  # ]:          0 :                 aSaveFont.SetColor( ( (MetaTextColorAction*) pAction )->GetColor() );
    2018         [ #  # ]:          0 :                 rSaveVDev.SetFont( aSaveFont );
    2019         [ #  # ]:          0 :                 ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
    2020         [ #  # ]:          0 :                 nCount++;
    2021                 :            :             }
    2022                 :          0 :             break;
    2023                 :            : 
    2024                 :            :             case( META_TEXTFILLCOLOR_ACTION ):
    2025                 :            :             {
    2026                 :          0 :                 MetaTextFillColorAction*    pAct = (MetaTextFillColorAction*) pAction;
    2027         [ #  # ]:          0 :                 Font                        aSaveFont( rSaveVDev.GetFont() );
    2028                 :            : 
    2029         [ #  # ]:          0 :                 if( pAct->IsSetting() )
    2030         [ #  # ]:          0 :                     aSaveFont.SetFillColor( pAct->GetColor() );
    2031                 :            :                 else
    2032         [ #  # ]:          0 :                     aSaveFont.SetFillColor( Color( COL_TRANSPARENT ) );
    2033                 :            : 
    2034         [ #  # ]:          0 :                 rSaveVDev.SetFont( aSaveFont );
    2035         [ #  # ]:          0 :                 ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
    2036         [ #  # ]:          0 :                 nCount++;
    2037                 :            :             }
    2038                 :          0 :             break;
    2039                 :            : 
    2040                 :            :             case( META_TEXTALIGN_ACTION ):
    2041                 :            :             {
    2042         [ #  # ]:          0 :                 Font aSaveFont( rSaveVDev.GetFont() );
    2043                 :            : 
    2044         [ #  # ]:          0 :                 aSaveFont.SetAlign( ( (MetaTextAlignAction*) pAction )->GetTextAlign() );
    2045         [ #  # ]:          0 :                 rSaveVDev.SetFont( aSaveFont );
    2046         [ #  # ]:          0 :                 ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
    2047         [ #  # ]:          0 :                 nCount++;
    2048                 :            :             }
    2049                 :          0 :             break;
    2050                 :            : 
    2051                 :            :             case( META_MAPMODE_ACTION ):
    2052                 :            :             {
    2053                 :          0 :                 MetaMapModeAction* pAct = (MetaMapModeAction*) pAction;
    2054                 :            : 
    2055                 :          0 :                 rOStm << (sal_Int16) GDI_MAPMODE_ACTION;
    2056                 :          0 :                 rOStm << (sal_Int32) 30;
    2057                 :          0 :                 ImplWriteMapMode( rOStm, pAct->GetMapMode() );
    2058                 :          0 :                 nCount++;
    2059                 :            :             }
    2060                 :          0 :             break;
    2061                 :            : 
    2062                 :            :             case( META_PUSH_ACTION ):
    2063                 :            :             {
    2064                 :          0 :                 ImplWritePushAction( rOStm );
    2065         [ #  # ]:          0 :                 rLineColStack.push( new Color( rLineCol ) );
    2066                 :          0 :                 rSaveVDev.Push();
    2067                 :          0 :                 nCount++;
    2068                 :            :             }
    2069                 :          0 :             break;
    2070                 :            : 
    2071                 :            :             case( META_POP_ACTION ):
    2072                 :            :             {
    2073                 :            :                 Color* pCol;
    2074         [ #  # ]:          0 :                 if (rLineColStack.empty())
    2075                 :          0 :                     pCol = NULL;
    2076                 :            :                 else
    2077                 :            :                 {
    2078                 :          0 :                     pCol = rLineColStack.top();
    2079                 :          0 :                     rLineColStack.pop();
    2080                 :            :                 }
    2081                 :            : 
    2082         [ #  # ]:          0 :                 if( pCol )
    2083                 :            :                 {
    2084                 :          0 :                     rLineCol = *pCol;
    2085                 :          0 :                     delete pCol;
    2086                 :            :                 }
    2087                 :            : 
    2088                 :          0 :                 ImplWritePopAction( rOStm );
    2089                 :          0 :                 rSaveVDev.Pop();
    2090                 :          0 :                 nCount++;
    2091                 :            :             }
    2092                 :          0 :             break;
    2093                 :            : 
    2094                 :            :             case( META_RASTEROP_ACTION ):
    2095                 :            :             {
    2096                 :          0 :                 MetaRasterOpAction* pAct = (MetaRasterOpAction*) pAction;
    2097                 :            : 
    2098 [ #  # ][ #  # ]:          0 :                 if( ( pAct->GetRasterOp() != ROP_0 ) && ( pAct->GetRasterOp() != ROP_1 ) )
                 [ #  # ]
    2099                 :            :                 {
    2100                 :            :                     sal_Int16 nRasterOp;
    2101                 :            : 
    2102                 :            :                     // Falls vorher ROP_0/1 gesetzt war, alten
    2103                 :            :                     // Zustand durch Pop erst wieder herstellen
    2104         [ #  # ]:          0 :                     if( rRop_0_1 )
    2105                 :            :                     {
    2106                 :          0 :                         ImplWritePopAction( rOStm );
    2107                 :          0 :                         rSaveVDev.Pop();
    2108                 :          0 :                         rRop_0_1 = sal_False;
    2109                 :          0 :                         nCount++;
    2110                 :            :                     }
    2111                 :            : 
    2112   [ #  #  #  # ]:          0 :                     switch( pAct->GetRasterOp() )
    2113                 :            :                     {
    2114                 :          0 :                         case( ROP_OVERPAINT ) : nRasterOp = 0; break;
    2115                 :          0 :                         case( ROP_XOR ) :       nRasterOp = 4; break;
    2116                 :          0 :                         case( ROP_INVERT ):     nRasterOp = 1; break;
    2117                 :          0 :                         default:                nRasterOp = 0; break;
    2118                 :            :                     }
    2119                 :            : 
    2120                 :          0 :                     ImplWriteRasterOpAction( rOStm, nRasterOp );
    2121                 :          0 :                     nCount++;
    2122                 :            :                 }
    2123                 :            :                 else
    2124                 :            :                 {
    2125                 :          0 :                     ImplWritePushAction( rOStm );
    2126                 :          0 :                     rSaveVDev.Push();
    2127                 :            : 
    2128         [ #  # ]:          0 :                     if( pAct->GetRasterOp() == ROP_0 )
    2129                 :            :                     {
    2130         [ #  # ]:          0 :                         ImplWriteLineColor( rOStm, COL_BLACK, 1 );
    2131         [ #  # ]:          0 :                         ImplWriteFillColor( rOStm, COL_BLACK, 1 );
    2132                 :            :                     }
    2133                 :            :                     else
    2134                 :            :                     {
    2135         [ #  # ]:          0 :                         ImplWriteLineColor( rOStm, COL_WHITE, 1 );
    2136         [ #  # ]:          0 :                         ImplWriteFillColor( rOStm, COL_WHITE, 1 );
    2137                 :            :                     }
    2138                 :            : 
    2139                 :          0 :                     ImplWriteRasterOpAction( rOStm, 0 );
    2140                 :          0 :                     rRop_0_1 = sal_True;
    2141                 :          0 :                     nCount += 4;
    2142                 :            :                 }
    2143                 :            :             }
    2144                 :          0 :             break;
    2145                 :            : 
    2146                 :            :             case( META_TRANSPARENT_ACTION ):
    2147                 :            :             {
    2148                 :          0 :                 const PolyPolygon&  rPolyPoly = ( (MetaTransparentAction*) pAction )->GetPolyPolygon();
    2149                 :          0 :                 const sal_Int16         nTrans = ( (MetaTransparentAction*) pAction )->GetTransparence();
    2150 [ #  # ][ #  # ]:          0 :                 const sal_Int16         nBrushStyle = ( nTrans < 38 ) ? 8 : ( nTrans < 63 ) ? 9 : 10;
    2151                 :            :                 sal_uLong               nOldPos, nNewPos;
    2152                 :            : 
    2153                 :            :                 // write transparence comment
    2154                 :          0 :                 rOStm << (sal_Int16) GDI_TRANSPARENT_COMMENT;
    2155                 :            : 
    2156                 :            :                 // we'll write the ActionSize later
    2157                 :          0 :                 nOldPos = rOStm.Tell();
    2158                 :          0 :                 rOStm.SeekRel( 4 );
    2159                 :            : 
    2160                 :            :                 // write comment data
    2161                 :          0 :                 rOStm << rPolyPoly;
    2162                 :          0 :                 rOStm << nTrans;
    2163                 :          0 :                 rOStm << (sal_Int32) 15; // number of actions that follow this comment
    2164                 :            : 
    2165                 :            :                 // calculate and write ActionSize of comment
    2166                 :          0 :                 nNewPos = rOStm.Tell();
    2167                 :          0 :                 rOStm.Seek( nOldPos );
    2168                 :          0 :                 rOStm << (sal_Int32) ( nNewPos - nOldPos );
    2169                 :          0 :                 rOStm.Seek( nNewPos );
    2170                 :            : 
    2171                 :            :                 {
    2172                 :            :                     // write actions for transparence
    2173                 :          0 :                     ImplWritePushAction( rOStm );
    2174                 :            :                     {
    2175                 :          0 :                         ImplWriteRasterOpAction( rOStm, 4 );
    2176                 :          0 :                         ImplWritePolyPolyAction( rOStm, rPolyPoly );
    2177                 :            : 
    2178                 :          0 :                         ImplWritePushAction( rOStm );
    2179                 :            :                         {
    2180                 :          0 :                             ImplWriteRasterOpAction( rOStm, 2 );
    2181         [ #  # ]:          0 :                             ImplWriteFillColor( rOStm, COL_BLACK, nBrushStyle );
    2182                 :          0 :                             ImplWritePolyPolyAction( rOStm, rPolyPoly );
    2183                 :            :                         }
    2184                 :          0 :                         ImplWritePopAction( rOStm );
    2185                 :            : 
    2186                 :          0 :                         ImplWriteRasterOpAction( rOStm, 4 );
    2187                 :          0 :                         ImplWritePolyPolyAction( rOStm, rPolyPoly );
    2188                 :            :                     }
    2189                 :          0 :                     ImplWritePopAction( rOStm );
    2190                 :            : 
    2191                 :          0 :                     ImplWritePushAction( rOStm );
    2192                 :            :                     {
    2193         [ #  # ]:          0 :                         ImplWriteFillColor( rOStm, Color(), 0 );
    2194                 :          0 :                         ImplWritePolyPolyAction( rOStm, rPolyPoly );
    2195                 :            :                     }
    2196                 :          0 :                     ImplWritePopAction( rOStm );
    2197                 :            : 
    2198                 :          0 :                     nCount += 15;
    2199                 :            :                 }
    2200                 :            : 
    2201                 :          0 :                 nCount++;
    2202                 :            :             }
    2203                 :          0 :             break;
    2204                 :            : 
    2205                 :            :             case( META_FLOATTRANSPARENT_ACTION ):
    2206                 :            :             {
    2207                 :          0 :                 const MetaFloatTransparentAction*   pA = (MetaFloatTransparentAction*) pAction;
    2208                 :          0 :                 const GDIMetaFile&                  rTransMtf = pA->GetGDIMetaFile();
    2209                 :          0 :                 const Point&                        rPos = pA->GetPoint();
    2210                 :          0 :                 const Size&                         rSize = pA->GetSize();
    2211                 :          0 :                 const Gradient&                     rGradient = pA->GetGradient();
    2212                 :            :                 sal_uLong                               nOldPos, nNewPos;
    2213                 :            : 
    2214                 :            :                 // write RefPoint comment
    2215                 :          0 :                 rOStm << (sal_Int16) GDI_FLOATTRANSPARENT_COMMENT;
    2216                 :            : 
    2217                 :            :                 // we'll write the ActionSize later
    2218                 :          0 :                 nOldPos = rOStm.Tell();
    2219                 :          0 :                 rOStm.SeekRel( 4 );
    2220                 :            : 
    2221                 :            :                 // write comment data
    2222                 :          0 :                 rOStm << rTransMtf << rPos << rSize << rGradient;
    2223                 :            : 
    2224                 :            :                 // calculate and write ActionSize of comment
    2225                 :          0 :                 nNewPos = rOStm.Tell();
    2226                 :          0 :                 rOStm.Seek( nOldPos );
    2227                 :          0 :                 rOStm << (sal_Int32) ( nNewPos - nOldPos + 4 );
    2228                 :          0 :                 rOStm.Seek( ( nOldPos = nNewPos ) + 4 );
    2229                 :            : 
    2230                 :            :                 {
    2231                 :            :                     // write actions for float transparence
    2232                 :            :                     sal_uLong           nAddCount;
    2233         [ #  # ]:          0 :                     GDIMetaFile     aMtf( rTransMtf );
    2234                 :          0 :                     const Size      aSrcSize( rTransMtf.GetPrefSize() );
    2235                 :          0 :                     Point           aSrcPt( rTransMtf.GetPrefMapMode().GetOrigin() );
    2236         [ #  # ]:          0 :                     const double    fScaleX = aSrcSize.Width() ? (double) rSize.Width() / aSrcSize.Width() : 1.0;
    2237         [ #  # ]:          0 :                     const double    fScaleY = aSrcSize.Height() ? (double) rSize.Height() / aSrcSize.Height() : 1.0;
    2238                 :            :                     long            nMoveX, nMoveY;
    2239                 :            : 
    2240 [ #  # ][ #  # ]:          0 :                     if( fScaleX != 1.0 || fScaleY != 1.0 )
    2241                 :            :                     {
    2242         [ #  # ]:          0 :                         aMtf.Scale( fScaleX, fScaleY );
    2243                 :          0 :                         aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
    2244                 :            :                     }
    2245                 :            : 
    2246                 :          0 :                     nMoveX = rPos.X() - aSrcPt.X(), nMoveY = rPos.Y() - aSrcPt.Y();
    2247                 :            : 
    2248 [ #  # ][ #  # ]:          0 :                     if( nMoveX || nMoveY )
    2249         [ #  # ]:          0 :                         aMtf.Move( nMoveX, nMoveY );
    2250                 :            : 
    2251         [ #  # ]:          0 :                     nAddCount = ImplWriteActions( rOStm, aMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet );
    2252                 :          0 :                     nNewPos = rOStm.Tell();
    2253         [ #  # ]:          0 :                     rOStm.Seek( nOldPos );
    2254         [ #  # ]:          0 :                     rOStm << (sal_Int32) nAddCount;
    2255         [ #  # ]:          0 :                     rOStm.Seek( nNewPos );
    2256                 :            : 
    2257         [ #  # ]:          0 :                     nCount += nAddCount;
    2258                 :            :                 }
    2259                 :            : 
    2260                 :          0 :                 nCount++;
    2261                 :            :             }
    2262                 :          0 :             break;
    2263                 :            : 
    2264                 :            :             case( META_HATCH_ACTION ):
    2265                 :            :             {
    2266                 :          0 :                 const MetaHatchAction*  pA = (MetaHatchAction*) pAction;
    2267                 :          0 :                 const PolyPolygon&      rPolyPoly = pA->GetPolyPolygon();
    2268                 :          0 :                 const Hatch&            rHatch = pA->GetHatch();
    2269                 :            :                 sal_uLong                   nOldPos, nNewPos, nAddCount;
    2270                 :            : 
    2271                 :            :                 // write hatch comment
    2272                 :          0 :                 rOStm << (sal_Int16) GDI_HATCH_COMMENT;
    2273                 :            : 
    2274                 :            :                 // we'll write the ActionSize later
    2275                 :          0 :                 nOldPos = rOStm.Tell();
    2276                 :          0 :                 rOStm.SeekRel( 4 );
    2277                 :            : 
    2278                 :            :                 // write comment data
    2279                 :          0 :                 rOStm << rPolyPoly;
    2280                 :          0 :                 rOStm << rHatch;
    2281                 :            : 
    2282                 :            :                 // calculate and write ActionSize of comment
    2283                 :          0 :                 nNewPos = rOStm.Tell();
    2284                 :          0 :                 rOStm.Seek( nOldPos );
    2285                 :          0 :                 rOStm << (sal_Int32) ( nNewPos - nOldPos + 4 );
    2286                 :          0 :                 rOStm.Seek( ( nOldPos = nNewPos ) + 4 );
    2287                 :            : 
    2288                 :            :                 {
    2289                 :            :                     // write actions for hatch
    2290         [ #  # ]:          0 :                     VirtualDevice   aVDev;
    2291         [ #  # ]:          0 :                     GDIMetaFile     aTmpMtf;
    2292                 :            : 
    2293         [ #  # ]:          0 :                     aVDev.AddHatchActions( rPolyPoly, rHatch, aTmpMtf );
    2294         [ #  # ]:          0 :                     nAddCount = ImplWriteActions( rOStm, aTmpMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet );
    2295                 :          0 :                     nNewPos = rOStm.Tell();
    2296         [ #  # ]:          0 :                     rOStm.Seek( nOldPos );
    2297         [ #  # ]:          0 :                     rOStm << (sal_Int32) nAddCount;
    2298         [ #  # ]:          0 :                     rOStm.Seek( nNewPos );
    2299                 :            : 
    2300 [ #  # ][ #  # ]:          0 :                     nCount += nAddCount;
    2301                 :            :                 }
    2302                 :            : 
    2303                 :          0 :                 nCount++;
    2304                 :            :             }
    2305                 :          0 :             break;
    2306                 :            : 
    2307                 :            :             case( META_REFPOINT_ACTION ):
    2308                 :            :             {
    2309                 :          0 :                 const MetaRefPointAction*   pA = (MetaRefPointAction*) pAction;
    2310                 :          0 :                 const Point&                rRefPoint = pA->GetRefPoint();
    2311                 :          0 :                 const sal_Bool                  bSet = pA->IsSetting();
    2312                 :            :                 sal_uLong                       nOldPos, nNewPos;
    2313                 :            : 
    2314                 :            :                 // write RefPoint comment
    2315                 :          0 :                 rOStm << (sal_Int16) GDI_REFPOINT_COMMENT;
    2316                 :            : 
    2317                 :            :                 // we'll write the ActionSize later
    2318                 :          0 :                 nOldPos = rOStm.Tell();
    2319                 :          0 :                 rOStm.SeekRel( 4 );
    2320                 :            : 
    2321                 :            :                 // write data
    2322                 :          0 :                 rOStm << rRefPoint << bSet;
    2323                 :          0 :                 rOStm << (sal_Int32) 0; // number of actions that follow this comment
    2324                 :            : 
    2325                 :            :                 // calculate and write ActionSize of comment
    2326                 :          0 :                 nNewPos = rOStm.Tell();
    2327                 :          0 :                 rOStm.Seek( nOldPos );
    2328                 :          0 :                 rOStm << (sal_Int32) ( nNewPos - nOldPos );
    2329                 :          0 :                 rOStm.Seek( nNewPos );
    2330                 :            : 
    2331                 :          0 :                 nCount++;
    2332                 :            :             }
    2333                 :          0 :             break;
    2334                 :            : 
    2335                 :            :             case( META_TEXTLINECOLOR_ACTION ):
    2336                 :            :             {
    2337                 :          0 :                 const MetaTextLineColorAction*  pA = (MetaTextLineColorAction*) pAction;
    2338                 :          0 :                 const Color&                    rColor = pA->GetColor();
    2339                 :          0 :                 const sal_Bool                      bSet = pA->IsSetting();
    2340                 :            :                 sal_uLong                           nOldPos, nNewPos;
    2341                 :            : 
    2342                 :            :                 // write RefPoint comment
    2343                 :          0 :                 rOStm << (sal_Int16) GDI_TEXTLINECOLOR_COMMENT;
    2344                 :            : 
    2345                 :            :                 // we'll write the ActionSize later
    2346                 :          0 :                 nOldPos = rOStm.Tell();
    2347                 :          0 :                 rOStm.SeekRel( 4 );
    2348                 :            : 
    2349                 :            :                 // write data
    2350                 :          0 :                 rOStm << rColor << bSet;
    2351                 :          0 :                 rOStm << (sal_Int32) 0; // number of actions that follow this comment
    2352                 :            : 
    2353                 :            :                 // calculate and write ActionSize of comment
    2354                 :          0 :                 nNewPos = rOStm.Tell();
    2355                 :          0 :                 rOStm.Seek( nOldPos );
    2356                 :          0 :                 rOStm << (sal_Int32) ( nNewPos - nOldPos );
    2357                 :          0 :                 rOStm.Seek( nNewPos );
    2358                 :            : 
    2359                 :          0 :                 nCount++;
    2360                 :            :             }
    2361                 :          0 :             break;
    2362                 :            : 
    2363                 :            :             case( META_TEXTLINE_ACTION ):
    2364                 :            :             {
    2365                 :          0 :                 const MetaTextLineAction*   pA = (MetaTextLineAction*) pAction;
    2366                 :          0 :                 const Point&                rStartPt = pA->GetStartPoint();
    2367                 :          0 :                 const sal_Int32             nWidth = (sal_Int32) pA->GetWidth();
    2368                 :          0 :                 const FontStrikeout         eStrikeout = pA->GetStrikeout();
    2369                 :          0 :                 const FontUnderline         eUnderline = pA->GetUnderline();
    2370                 :            :                 sal_uLong                       nOldPos, nNewPos;
    2371                 :            : 
    2372                 :            :                 // write RefPoint comment
    2373                 :          0 :                 rOStm << (sal_Int16) GDI_TEXTLINE_COMMENT;
    2374                 :            : 
    2375                 :            :                 // we'll write the ActionSize later
    2376                 :          0 :                 nOldPos = rOStm.Tell();
    2377                 :          0 :                 rOStm.SeekRel( 4 );
    2378                 :            : 
    2379                 :            :                 // write data
    2380                 :          0 :                 rOStm << rStartPt << nWidth <<
    2381                 :          0 :                     static_cast<sal_uInt32>(eStrikeout) <<
    2382                 :          0 :                     static_cast<sal_uInt32>(eUnderline);
    2383                 :          0 :                 rOStm << (sal_Int32) 0; // number of actions that follow this comment
    2384                 :            : 
    2385                 :            :                 // calculate and write ActionSize of comment
    2386                 :          0 :                 nNewPos = rOStm.Tell();
    2387                 :          0 :                 rOStm.Seek( nOldPos );
    2388                 :          0 :                 rOStm << (sal_Int32) ( nNewPos - nOldPos );
    2389                 :          0 :                 rOStm.Seek( nNewPos );
    2390                 :            : 
    2391                 :          0 :                 nCount++;
    2392                 :            :             }
    2393                 :          0 :             break;
    2394                 :            : 
    2395                 :            :             case( META_EPS_ACTION ):
    2396                 :          0 :             break;
    2397                 :            : 
    2398                 :            :             case( META_COMMENT_ACTION ):
    2399                 :            :             {
    2400                 :          0 :                 const MetaCommentAction*    pA = (MetaCommentAction*) pAction;
    2401                 :          0 :                 const sal_uInt32            nDataSize = pA->GetDataSize();
    2402                 :            :                 sal_uLong                       nOldPos, nNewPos;
    2403                 :            : 
    2404                 :            :                 // write RefPoint comment
    2405                 :          0 :                 rOStm << (sal_Int16) GDI_COMMENT_COMMENT;
    2406                 :            : 
    2407                 :            :                 // we'll write the ActionSize later
    2408                 :          0 :                 nOldPos = rOStm.Tell();
    2409                 :          0 :                 rOStm.SeekRel( 4 );
    2410                 :            : 
    2411                 :            :                 // write data
    2412                 :          0 :                 write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rOStm, pA->GetComment());
    2413                 :          0 :                 rOStm << pA->GetValue() << nDataSize;
    2414                 :            : 
    2415         [ #  # ]:          0 :                 if( nDataSize )
    2416                 :          0 :                     rOStm.Write( pA->GetData(), nDataSize );
    2417                 :            : 
    2418                 :          0 :                 rOStm << (sal_Int32) 0; // number of actions that follow this comment
    2419                 :            : 
    2420                 :            :                 // calculate and write ActionSize of comment
    2421                 :          0 :                 nNewPos = rOStm.Tell();
    2422                 :          0 :                 rOStm.Seek( nOldPos );
    2423                 :          0 :                 rOStm << (sal_Int32) ( nNewPos - nOldPos );
    2424                 :          0 :                 rOStm.Seek( nNewPos );
    2425                 :            : 
    2426                 :          0 :                 nCount++;
    2427                 :            :             }
    2428                 :          0 :             break;
    2429                 :            : 
    2430                 :            : #ifdef DBG_UTIL
    2431                 :            :             default:
    2432                 :            :             {
    2433                 :            :                 rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
    2434                 :            :                     "Missing implementation for Action#: "));
    2435                 :            :                 aStr.append(static_cast<sal_Int32>(pAction->GetType()));
    2436                 :            :                 aStr.append('!');
    2437                 :            :                 OSL_FAIL(aStr.getStr());
    2438                 :            :             }
    2439                 :            :             break;
    2440                 :            : #endif
    2441                 :            :         }
    2442                 :            :     }
    2443                 :            : 
    2444                 :          0 :     return nCount;
    2445                 :            : }
    2446                 :            : 
    2447                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10