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