diff options
Diffstat (limited to 'svtools/source/filter.vcl/wmf/winmtf.cxx')
-rw-r--r-- | svtools/source/filter.vcl/wmf/winmtf.cxx | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx index 4ff2c19c7141..007a56e452fb 100644 --- a/svtools/source/filter.vcl/wmf/winmtf.cxx +++ b/svtools/source/filter.vcl/wmf/winmtf.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -256,7 +256,7 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont ) } else if ( aFontSize.Height() < 0 ) aFontSize.Height() *= -1; - + if ( !rFont.lfWidth ) { VirtualDevice aVDev; @@ -284,7 +284,7 @@ void WinMtfAssertHandler( const sal_Char* pAction, sal_uInt32 nFlags ) if ( nFlags & WIN_MTF_ASSERT_MIFE ) { if ( ( nAssertCount == 0 ) || ( bOnlyOnce == sal_False ) ) - { + { ByteString aText( "WMF/EMF Import: " ); if ( pAction ) { @@ -302,17 +302,17 @@ void WinMtfAssertHandler( const sal_Char* pAction, sal_uInt32 nFlags ) // ------------------------------------------------------------------------ WinMtf::WinMtf( WinMtfOutput* pWinMtfOutput, SvStream& rStreamWMF, FilterConfigItem* pConfigItem ) : - pOut ( pWinMtfOutput ), - pWMF ( &rStreamWMF ), - pFilterConfigItem ( pConfigItem ) + pOut ( pWinMtfOutput ), + pWMF ( &rStreamWMF ), + pFilterConfigItem ( pConfigItem ) { #ifdef WIN_MTF_ASSERT - // we want to assert not implemented features, but we do this + // we want to assert not implemented features, but we do this // only once, so that nobody is handicaped by getting too much assertions // I hope this will bring more testdocuments, without support of these // testdocuments the implementation of missing features won't be possible. (SJ) WinMtfAssertHandler( NULL, WIN_MTF_ASSERT_INIT | WIN_MTF_ASSERT_ONCE ); -#endif +#endif SvLockBytes *pLB = pWMF->GetLockBytes(); if ( pLB ) @@ -424,7 +424,7 @@ Point WinMtfOutput::ImplMap( const Point& rPt ) fX2 *= mnDevWidth; fY2 *= mnDevHeight; fX2 += mnDevOrgX; - fY2 += mnDevOrgY; // fX2, fY2 now in device units + fY2 += mnDevOrgY; // fX2, fY2 now in device units fX2 *= (double)mnMillX * 100.0 / (double)mnPixX; fY2 *= (double)mnMillY * 100.0 / (double)mnPixY; } @@ -549,7 +549,7 @@ void WinMtfOutput::SelectObject( INT32 nIndex ) pGDIObj = new GDIObj(); else { - nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen + nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen if ( (UINT32)nIndex < vGDIObj.size() ) pGDIObj = vGDIObj[ nIndex ]; @@ -711,7 +711,7 @@ void WinMtfOutput::ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly ) mpGDIMetaFile->AddAction( new MetaRectAction( rPolyPoly.GetBoundRect() ) ); else { - Polygon aPoly( rPolyPoly[ 0 ] ); + Polygon aPoly( rPolyPoly[ 0 ] ); sal_uInt16 nCount = aPoly.GetSize(); if ( nCount ) { @@ -740,7 +740,7 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle ) { ImplMap( ((WinMtfFontStyle*)pStyle)->aFont ); if (!((WinMtfFontStyle*)pStyle)->aFont.GetHeight() ) - ((WinMtfFontStyle*)pStyle)->aFont.SetHeight( 423 ); // defaulting to 12pt + ((WinMtfFontStyle*)pStyle)->aFont.SetHeight( 423 ); // defaulting to 12pt } else if ( eType == GDI_PEN ) { @@ -774,7 +774,7 @@ void WinMtfOutput::CreateObject( INT32 nIndex, GDIObjectType eType, void* pStyle { if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 ) { - nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen + nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen if ( pStyle ) { if ( eType == GDI_FONT ) @@ -878,44 +878,44 @@ void WinMtfOutput::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClip WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) : mnLatestTextAlign ( 0 ), - mnTextAlign ( TA_LEFT | TA_TOP | TA_NOUPDATECP ), + mnTextAlign ( TA_LEFT | TA_TOP | TA_NOUPDATECP ), maLatestBkColor ( 0x12345678 ), - maBkColor ( COL_WHITE ), + maBkColor ( COL_WHITE ), mnLatestTextLayoutMode( TEXT_LAYOUT_DEFAULT ), - mnTextLayoutMode ( TEXT_LAYOUT_DEFAULT ), + mnTextLayoutMode ( TEXT_LAYOUT_DEFAULT ), mnLatestBkMode ( 0 ), - mnBkMode ( OPAQUE ), + mnBkMode ( OPAQUE ), meLatestRasterOp ( ROP_INVERT ), - meRasterOp ( ROP_OVERPAINT ), - maActPos ( Point() ), - mbNopMode ( sal_False ), - mbFillStyleSelected ( sal_False ), + meRasterOp ( ROP_OVERPAINT ), + maActPos ( Point() ), + mbNopMode ( sal_False ), + mbFillStyleSelected ( sal_False ), mbClipNeedsUpdate ( true ), mbComplexClip ( false ), - mnGfxMode ( GM_COMPATIBLE ), + mnGfxMode ( GM_COMPATIBLE ), mnMapMode ( MM_TEXT ), - mnDevOrgX ( 0 ), - mnDevOrgY ( 0 ), - mnDevWidth ( 1 ), - mnDevHeight ( 1 ), - mnWinOrgX ( 0 ), - mnWinOrgY ( 0 ), - mnWinExtX ( 1 ), - mnWinExtY ( 1 ), - mnPixX ( 100 ), - mnPixY ( 100 ), - mnMillX ( 1 ), - mnMillY ( 1 ), + mnDevOrgX ( 0 ), + mnDevOrgY ( 0 ), + mnDevWidth ( 1 ), + mnDevHeight ( 1 ), + mnWinOrgX ( 0 ), + mnWinOrgY ( 0 ), + mnWinExtX ( 1 ), + mnWinExtY ( 1 ), + mnPixX ( 100 ), + mnPixY ( 100 ), + mnMillX ( 1 ), + mnMillY ( 1 ), mpGDIMetaFile ( &rGDIMetaFile ) { - mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_CLIPREGION ) ); // The original clipregion has to be on top + mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_CLIPREGION ) ); // The original clipregion has to be on top // of the stack so it can always be restored // this is necessary to be able to support // SetClipRgn( NULL ) and similar ClipRgn actions (SJ) - maFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Arial" )) ); // sj: #i57205#, we do have some scaling problems if using - maFont.SetCharSet( gsl_getSystemTextEncoding() ); // the default font then most times a x11 font is used, we - maFont.SetHeight( 423 ); // will prevent this defining a font + maFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Arial" )) ); // sj: #i57205#, we do have some scaling problems if using + maFont.SetCharSet( gsl_getSystemTextEncoding() ); // the default font then most times a x11 font is used, we + maFont.SetHeight( 423 ); // will prevent this defining a font maLatestLineStyle.aLineColor = Color( 0x12, 0x34, 0x56 ); maLatestFillStyle.aFillColor = Color( 0x12, 0x34, 0x56 ); @@ -949,7 +949,7 @@ void WinMtfOutput::UpdateClipRegion() mbComplexClip = false; mpGDIMetaFile->AddAction( new MetaPopAction() ); // taking the orignal clipregion - mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_CLIPREGION ) ); // + mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_CLIPREGION ) ); // // skip for 'no clipping at all' case if( !aClipPath.isEmpty() ) @@ -994,7 +994,7 @@ void WinMtfOutput::UpdateLineStyle() void WinMtfOutput::UpdateFillStyle() { - if ( !mbFillStyleSelected ) // SJ: #i57205# taking care of bkcolor if no brush is selected + if ( !mbFillStyleSelected ) // SJ: #i57205# taking care of bkcolor if no brush is selected maFillStyle = WinMtfFillStyle( maBkColor, mnBkMode == TRANSPARENT ); if (!( maLatestFillStyle == maFillStyle ) ) { @@ -1016,7 +1016,7 @@ sal_uInt32 WinMtfOutput::SetRasterOp( UINT32 nRasterOp ) static WinMtfLineStyle aNopLineStyle; if ( mbNopMode && ( nRasterOp != R2_NOP ) ) - { // beim uebergang von R2_NOP auf anderen Modus + { // beim uebergang von R2_NOP auf anderen Modus // gesetzten Pen und Brush aktivieren maFillStyle = aNopFillStyle; maLineStyle = aNopLineStyle; @@ -1215,14 +1215,14 @@ void WinMtfOutput::DrawArc( const Rectangle& rRect, const Point& rStart, const P UpdateLineStyle(); UpdateFillStyle(); - Rectangle aRect( ImplMap( rRect ) ); - Point aStart( ImplMap( rStart ) ); - Point aEnd( ImplMap( rEnd ) ); + Rectangle aRect( ImplMap( rRect ) ); + Point aStart( ImplMap( rStart ) ); + Point aEnd( ImplMap( rEnd ) ); if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) ) { if ( aStart == aEnd ) - { // SJ: #i53768# if start & end is identical, then we have to draw a full ellipse + { // SJ: #i53768# if start & end is identical, then we have to draw a full ellipse Point aCenter( aRect.Center() ); Size aRad( aRect.GetWidth() / 2, aRect.GetHeight() / 2 ); @@ -1245,9 +1245,9 @@ void WinMtfOutput::DrawPie( const Rectangle& rRect, const Point& rStart, const P UpdateClipRegion(); UpdateFillStyle(); - Rectangle aRect( ImplMap( rRect ) ); - Point aStart( ImplMap( rStart ) ); - Point aEnd( ImplMap( rEnd ) ); + Rectangle aRect( ImplMap( rRect ) ); + Point aStart( ImplMap( rStart ) ); + Point aEnd( ImplMap( rEnd ) ); if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) ) { @@ -1270,9 +1270,9 @@ void WinMtfOutput::DrawChord( const Rectangle& rRect, const Point& rStart, const UpdateClipRegion(); UpdateFillStyle(); - Rectangle aRect( ImplMap( rRect ) ); - Point aStart( ImplMap( rStart ) ); - Point aEnd( ImplMap( rEnd ) ); + Rectangle aRect( ImplMap( rRect ) ); + Point aStart( ImplMap( rStart ) ); + Point aEnd( ImplMap( rEnd ) ); if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) ) { @@ -1564,7 +1564,7 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry if( mnTextAlign & TA_UPDATECP ) rPosition = maActPos; - + if ( mnTextAlign & TA_RIGHT_CENTER ) { double fLenght = ( ( mnTextAlign & TA_RIGHT_CENTER ) == TA_RIGHT ) ? nTextWidth : nTextWidth >> 1; @@ -1574,7 +1574,7 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry if( mnTextAlign & TA_UPDATECP ) maActPos.X() = rPosition.X() + nTextWidth; - } + } if ( bChangeFont || ( maLatestFont != aTmp ) ) { maLatestFont = aTmp; @@ -1591,7 +1591,7 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry { /* because text without dx array is badly scaled, we will create such an array if necessary */ - sal_Int32* pDX = pDXArry; + sal_Int32* pDX = pDXArry; if ( !pDXArry ) { pDX = new sal_Int32[ rText.Len() ]; @@ -1602,8 +1602,8 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry pVDev->GetTextArray( rText, pDX, 0, STRING_LEN ); } mpGDIMetaFile->AddAction( new MetaTextArrayAction( rPosition, rText, pDX, 0, STRING_LEN ) ); - if ( !pDXArry ) // this means we have created our own array - delete[] pDX; // which must be deleted + if ( !pDXArry ) // this means we have created our own array + delete[] pDX; // which must be deleted } SetGfxMode( nOldGfxMode ); delete pVDev; @@ -1660,16 +1660,16 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) { UpdateClipRegion(); - sal_uInt32 nObjects = rSaveList.Count(); - sal_uInt32 nObjectsLeft = nObjects; + sal_uInt32 nObjects = rSaveList.Count(); + sal_uInt32 nObjectsLeft = nObjects; while ( nObjectsLeft ) { - sal_uInt32 i, nObjectsOfSameSize = 0; - sal_uInt32 nObjectStartIndex = nObjects - nObjectsLeft; + sal_uInt32 i, nObjectsOfSameSize = 0; + sal_uInt32 nObjectStartIndex = nObjects - nObjectsLeft; - BSaveStruct* pSave = (BSaveStruct*)rSaveList.GetObject( nObjectStartIndex ); - Rectangle aRect( pSave->aOutRect ); + BSaveStruct* pSave = (BSaveStruct*)rSaveList.GetObject( nObjectStartIndex ); + Rectangle aRect( pSave->aOutRect ); for ( i = nObjectStartIndex; i < nObjects; ) { @@ -1681,27 +1681,27 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) break; } } - Point aPos( ImplMap( aRect.TopLeft() ) ); - Size aSize( ImplMap( aRect.GetSize() ) ); + Point aPos( ImplMap( aRect.TopLeft() ) ); + Size aSize( ImplMap( aRect.GetSize() ) ); for ( i = nObjectStartIndex; i < ( nObjectStartIndex + nObjectsOfSameSize ); i++ ) { pSave = (BSaveStruct*)rSaveList.GetObject( i ); - sal_uInt32 nWinRop = pSave->nWinRop; - sal_uInt8 nRasterOperation = (sal_uInt8)( nWinRop >> 16 ); + sal_uInt32 nWinRop = pSave->nWinRop; + sal_uInt8 nRasterOperation = (sal_uInt8)( nWinRop >> 16 ); - sal_uInt32 nUsed = 0; + sal_uInt32 nUsed = 0; if ( ( nRasterOperation & 0xf ) != ( nRasterOperation >> 4 ) ) - nUsed |= 1; // pattern is used + nUsed |= 1; // pattern is used if ( ( nRasterOperation & 0x33 ) != ( ( nRasterOperation & 0xcc ) >> 2 ) ) - nUsed |= 2; // source is used + nUsed |= 2; // source is used if ( ( nRasterOperation & 0xaa ) != ( ( nRasterOperation & 0x55 ) << 1 ) ) - nUsed |= 4; // destination is used + nUsed |= 4; // destination is used if ( (nUsed & 1) && (( nUsed & 2 ) == 0) && nWinRop != PATINVERT ) - { // patterns aren't well supported yet - sal_uInt32 nOldRop = SetRasterOp( ROP_OVERPAINT ); // in this case nRasterOperation is either 0 or 0xff + { // patterns aren't well supported yet + sal_uInt32 nOldRop = SetRasterOp( ROP_OVERPAINT ); // in this case nRasterOperation is either 0 or 0xff UpdateFillStyle(); DrawRect( aRect, FALSE ); SetRasterOp( nOldRop ); @@ -1710,11 +1710,11 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) { sal_Bool bDrawn = sal_False; - if ( i == nObjectStartIndex ) // optimizing, sometimes it is possible to create just one transparent bitmap + if ( i == nObjectStartIndex ) // optimizing, sometimes it is possible to create just one transparent bitmap { if ( nObjectsOfSameSize == 2 ) { - BSaveStruct* pSave2 = (BSaveStruct*)rSaveList.GetObject( i + 1 ); + BSaveStruct* pSave2 = (BSaveStruct*)rSaveList.GetObject( i + 1 ); if ( ( pSave->aBmp.GetPrefSize() == pSave2->aBmp.GetPrefSize() ) && ( pSave->aBmp.GetPrefMapMode() == pSave2->aBmp.GetPrefMapMode() ) ) { @@ -1750,18 +1750,18 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) if ( !bDrawn ) { Push(); - sal_uInt32 nOldRop = SetRasterOp( R2_COPYPEN ); - Bitmap aBitmap( pSave->aBmp ); - sal_uInt32 nOperation = ( nRasterOperation & 0xf ); + sal_uInt32 nOldRop = SetRasterOp( R2_COPYPEN ); + Bitmap aBitmap( pSave->aBmp ); + sal_uInt32 nOperation = ( nRasterOperation & 0xf ); switch( nOperation ) { case 0x1 : case 0xe : - { + { SetRasterOp( R2_XORPEN ); ImplDrawBitmap( aPos, aSize, aBitmap ); SetRasterOp( R2_COPYPEN ); - Bitmap aMask( aBitmap ); + Bitmap aMask( aBitmap ); aMask.Invert(); BitmapEx aBmpEx( aBitmap, aMask ); ImplDrawBitmap( aPos, aSize, aBmpEx ); @@ -1775,8 +1775,8 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) case 0x7 : case 0x8 : { - Bitmap aMask( aBitmap ); - if ( ( nUsed & 1 ) && ( nRasterOperation & 0xb0 ) == 0xb0 ) // pattern used + Bitmap aMask( aBitmap ); + if ( ( nUsed & 1 ) && ( nRasterOperation & 0xb0 ) == 0xb0 ) // pattern used { aBitmap.Convert( BMP_CONVERSION_24BIT ); aBitmap.Erase( maFillStyle.aFillColor ); @@ -1797,7 +1797,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) SetRasterOp( R2_NOT ); DrawRect( aRect, FALSE ); SetRasterOp( R2_COPYPEN ); - Bitmap aMask( aBitmap ); + Bitmap aMask( aBitmap ); aBitmap.Invert(); BitmapEx aBmpEx( aBitmap, aMask ); ImplDrawBitmap( aPos, aSize, aBmpEx ); @@ -1814,7 +1814,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) case 0x2 : case 0xd : { - Bitmap aMask( aBitmap ); + Bitmap aMask( aBitmap ); aMask.Invert(); BitmapEx aBmpEx( aBitmap, aMask ); ImplDrawBitmap( aPos, aSize, aBmpEx ); @@ -1840,16 +1840,16 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) } break; - case 0x0 : // WHITENESS - case 0xf : // BLACKNESS - { // in this case nRasterOperation is either 0 or 0xff + case 0x0 : // WHITENESS + case 0xf : // BLACKNESS + { // in this case nRasterOperation is either 0 or 0xff maFillStyle = WinMtfFillStyle( Color( nRasterOperation, nRasterOperation, nRasterOperation ) ); UpdateFillStyle(); DrawRect( aRect, FALSE ); } break; - case 0x3 : // only source is used + case 0x3 : // only source is used case 0xc : { if ( nRasterOperation == 0x33 ) @@ -1858,12 +1858,12 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) } break; - case 0x5 : // only destination is used + case 0x5 : // only destination is used { SetRasterOp( R2_NOT ); DrawRect( aRect, FALSE ); } - case 0xa : // no operation + case 0xa : // no operation break; } SetRasterOp( nOldRop ); @@ -1905,7 +1905,7 @@ void WinMtfOutput::SetDevExt( const Size& rSize ) switch( mnMapMode ) { case MM_ISOTROPIC : - case MM_ANISOTROPIC : + case MM_ANISOTROPIC : { mnDevWidth = rSize.Width(); mnDevHeight = rSize.Height(); @@ -1948,7 +1948,7 @@ void WinMtfOutput::SetWinExt( const Size& rSize ) switch( mnMapMode ) { case MM_ISOTROPIC : - case MM_ANISOTROPIC : + case MM_ANISOTROPIC : { mnWinExtX = rSize.Width(); mnWinExtY = rSize.Height(); @@ -2039,7 +2039,7 @@ void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, UINT32 nMode ) case MWT_RIGHTMULTIPLY : case MWT_LEFTMULTIPLY : - { + { const XForm* pLeft; const XForm* pRight; @@ -2101,7 +2101,7 @@ void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, UINT32 nMode ) //----------------------------------------------------------------------------------- -void WinMtfOutput::Push() // !! to be able to access the original ClipRegion it +void WinMtfOutput::Push() // !! to be able to access the original ClipRegion it { // is not allowed to use the MetaPushAction() UpdateClipRegion(); // (the original clip region is on top of the stack) (SJ) SaveStructPtr pSave( new SaveStruct ); |