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