diff options
Diffstat (limited to 'svtools/source/filter.vcl/wmf/winwmf.cxx')
-rw-r--r-- | svtools/source/filter.vcl/wmf/winwmf.cxx | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/svtools/source/filter.vcl/wmf/winwmf.cxx b/svtools/source/filter.vcl/wmf/winwmf.cxx index 1a67a97f17c2..fdb8cf5b620c 100644 --- a/svtools/source/filter.vcl/wmf/winwmf.cxx +++ b/svtools/source/filter.vcl/wmf/winwmf.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 @@ -334,9 +334,9 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_POLYPOLYGON: { - USHORT i, nPoly, nPoints; - USHORT* pnPoints; - Point* pPtAry; + USHORT i, nPoly, nPoints; + USHORT* pnPoints; + Point* pPtAry; // Anzahl der Polygone: *pWMF >> nPoly; // Anzahl der Punkte eines jeden Polygons holen, Gesammtzahl der Punkte ermitteln: @@ -401,7 +401,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) *pWMF >> nLength; if ( nLength ) { - char* pChar = new char[ ( nLength + 1 ) &~ 1 ]; + char* pChar = new char[ ( nLength + 1 ) &~ 1 ]; pWMF->Read( pChar, ( nLength + 1 ) &~ 1 ); String aText( pChar, nLength, pOut->GetCharSet() ); delete[] pChar; @@ -413,12 +413,12 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_EXTTEXTOUT: { - sal_Int16 nDx, nDxTmp; - sal_uInt16 i, nLen, nOptions; - sal_Int32 nRecordPos, nRecordSize, nOriginalTextLen, nNewTextLen; - Point aPosition; - Rectangle aRect; - sal_Int32* pDXAry = NULL; + sal_Int16 nDx, nDxTmp; + sal_uInt16 i, nLen, nOptions; + sal_Int32 nRecordPos, nRecordSize, nOriginalTextLen, nNewTextLen; + Point aPosition; + Rectangle aRect; + sal_Int32* pDXAry = NULL; pWMF->SeekRel(-6); nRecordPos = pWMF->Tell(); @@ -446,15 +446,15 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) char* pChar = new char[ ( nOriginalTextLen + 1 ) &~ 1 ]; pWMF->Read( pChar, ( nOriginalTextLen + 1 ) &~ 1 ); String aText( pChar, (sal_uInt16)nOriginalTextLen, pOut->GetCharSet() );// after this conversion the text may contain - nNewTextLen = aText.Len(); // less character (japanese version), so the - delete[] pChar; // dxAry will not fit + nNewTextLen = aText.Len(); // less character (japanese version), so the + delete[] pChar; // dxAry will not fit if ( nNewTextLen ) { - sal_uInt32 nMaxStreamPos = nRecordPos + ( nRecordSize << 1 ); - sal_Int32 nDxArySize = nMaxStreamPos - pWMF->Tell(); - sal_Int32 nDxAryEntries = nDxArySize >> 1; - sal_Bool bUseDXAry = FALSE; + sal_uInt32 nMaxStreamPos = nRecordPos + ( nRecordSize << 1 ); + sal_Int32 nDxArySize = nMaxStreamPos - pWMF->Tell(); + sal_Int32 nDxAryEntries = nDxArySize >> 1; + sal_Bool bUseDXAry = FALSE; if ( ( ( nDxAryEntries % nOriginalTextLen ) == 0 ) && ( nNewTextLen <= nOriginalTextLen ) ) { @@ -477,7 +477,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) *pWMF >> nDxTmp; nDx = nDx + nDxTmp; } - } + } } pDXAry[ i ] = nDx; } @@ -497,7 +497,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_SELECTOBJECT: { - INT16 nObjIndex; + INT16 nObjIndex; *pWMF >> nObjIndex; pOut->SelectObject( nObjIndex ); } @@ -505,7 +505,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_SETTEXTALIGN: { - UINT16 nAlign; + UINT16 nAlign; *pWMF >> nAlign; pOut->SetTextAlign( nAlign ); } @@ -513,7 +513,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_BITBLT: { - // 0-3 : nWinROP #93454# + // 0-3 : nWinROP #93454# // 4-5 : y offset of source bitmap // 6-7 : x offset of source bitmap // 8-9 : used height of source bitmap @@ -525,11 +525,11 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) // 20-21 : Height Bitmap in Pixel // 22-23 : bytes per scanline // 24 : planes - // 25 : bitcount + // 25 : bitcount - sal_Int32 nWinROP; - sal_uInt16 nSx, nSy, nSxe, nSye, nDontKnow, nWidth, nHeight, nBytesPerScan; - sal_uInt8 nPlanes, nBitCount; + sal_Int32 nWinROP; + sal_uInt16 nSx, nSy, nSxe, nSye, nDontKnow, nWidth, nHeight, nBytesPerScan; + sal_uInt8 nPlanes, nBitCount; *pWMF >> nWinROP >> nSy >> nSx >> nSye >> nSxe; @@ -562,7 +562,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) } } aBmp.ReleaseAccess( pAcc ); - if ( nSye && nSxe && + if ( nSye && nSxe && ( ( nSx + nSxe ) <= aBmp.GetSizePixel().Width() ) && ( ( nSy + nSye <= aBmp.GetSizePixel().Height() ) ) ) { @@ -573,7 +573,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ), LIST_APPEND ); } } - } + } break; case W_META_STRETCHBLT: @@ -583,13 +583,13 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) { sal_Int32 nWinROP; sal_uInt16 nSx, nSy, nSxe, nSye, nUsage; - Bitmap aBmp; + Bitmap aBmp; *pWMF >> nWinROP; if( nFunc == W_META_STRETCHDIB ) *pWMF >> nUsage; - + // nSye and nSxe is the number of pixels that has to been used if( nFunc == W_META_STRETCHDIB || nFunc == W_META_STRETCHBLT || nFunc == W_META_DIBSTRETCHBLT ) *pWMF >> nSye >> nSxe; @@ -602,18 +602,18 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) if( nFunc == W_META_STRETCHDIB || nFunc == W_META_DIBBITBLT || nFunc == W_META_DIBSTRETCHBLT ) { if ( nWinROP == PATCOPY ) - *pWMF >> nUsage; // i don't know anything of this parameter, so its called nUsage + *pWMF >> nUsage; // i don't know anything of this parameter, so its called nUsage // pOut->DrawRect( Rectangle( ReadYX(), aDestSize ), FALSE ); Size aDestSize( ReadYXExt() ); - if ( aDestSize.Width() && aDestSize.Height() ) // #92623# do not try to read buggy bitmaps + if ( aDestSize.Width() && aDestSize.Height() ) // #92623# do not try to read buggy bitmaps { Rectangle aDestRect( ReadYX(), aDestSize ); if ( nWinROP != PATCOPY ) aBmp.Read( *pWMF, FALSE ); // test if it is sensible to crop - if ( nSye && nSxe && + if ( nSye && nSxe && ( ( nSx + nSxe ) <= aBmp.GetSizePixel().Width() ) && ( ( nSy + nSye <= aBmp.GetSizePixel().Height() ) ) ) { @@ -628,10 +628,10 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_DIBCREATEPATTERNBRUSH: { - Bitmap aBmp; + Bitmap aBmp; BitmapReadAccess* pBmp; - UINT32 nRed = 0, nGreen = 0, nBlue = 0, nCount = 1; - UINT16 nFunction; + UINT32 nRed = 0, nGreen = 0, nBlue = 0, nCount = 1; + UINT16 nFunction; *pWMF >> nFunction >> nFunction; @@ -643,8 +643,8 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) { for ( INT32 x = 0; x < pBmp->Width(); x++ ) { - const BitmapColor aColor( pBmp->GetColor( y, x ) ); - + const BitmapColor aColor( pBmp->GetColor( y, x ) ); + nRed += aColor.GetRed(); nGreen += aColor.GetGreen(); nBlue += aColor.GetBlue(); @@ -688,8 +688,8 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_CREATEPENINDIRECT: { - LineInfo aLineInfo; - USHORT nStyle, nWidth, nHeight; + LineInfo aLineInfo; + USHORT nStyle, nWidth, nHeight; *pWMF >> nStyle >> nWidth >> nHeight; @@ -732,7 +732,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_CREATEBRUSHINDIRECT: { - USHORT nStyle; + USHORT nStyle; *pWMF >> nStyle; pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ? TRUE : FALSE ) ); } @@ -740,9 +740,9 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_CREATEFONTINDIRECT: { - Size aFontSize; - char lfFaceName[ LF_FACESIZE ]; - INT16 lfEscapement, lfOrientation, lfWeight; // ( ehemals USHORT ) + Size aFontSize; + char lfFaceName[ LF_FACESIZE ]; + INT16 lfEscapement, lfOrientation, lfWeight; // ( ehemals USHORT ) LOGFONTW aLogFont; aFontSize = ReadYXExt(); @@ -830,22 +830,22 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR ); break; } - if ( nRecSize >= 4 ) // minimal escape lenght + if ( nRecSize >= 4 ) // minimal escape lenght { - sal_uInt16 nMode, nLen; + sal_uInt16 nMode, nLen; *pWMF >> nMode >> nLen; if ( ( nMode == W_MFCOMMENT ) && ( nLen >= 4 ) ) { - sal_uInt32 nNewMagic; // we have to read int32 for + sal_uInt32 nNewMagic; // we have to read int32 for *pWMF >> nNewMagic; // META_ESCAPE_ENHANCED_METAFILE CommentIdentifier - + if( nNewMagic == 0x2c2a4f4f && nLen >= 14 ) { sal_uInt16 nMagic2; *pWMF >> nMagic2; if( nMagic2 == 0x0a ) // 2nd half of magic - { // continue with private escape + { // continue with private escape sal_uInt32 nCheck, nEsc; *pWMF >> nCheck >> nEsc; @@ -877,12 +877,12 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) switch( nEsc ) { case PRIVATE_ESCAPE_UNICODE : - { // we will use text instead of polygons only if we have the correct font + { // we will use text instead of polygons only if we have the correct font if ( aVDev.IsFontAvailable( pOut->GetFont().GetName() ) ) { Point aPt; String aString; - sal_uInt32 i, nStringLen, nDXCount; + sal_uInt32 i, nStringLen, nDXCount; sal_Int32* pDXAry = NULL; SvMemoryStream aMemoryStream( nEscLen ); aMemoryStream.Write( pData, nEscLen ); @@ -918,12 +918,12 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) } else if ( (nNewMagic == static_cast< sal_uInt32 >(0x43464D57)) && (nLen >= 34) && ( (sal_Int32)(nLen + 10) <= (sal_Int32)(nRecSize * 2) )) { - sal_uInt32 nComType, nVersion, nFlags, nComRecCount, + sal_uInt32 nComType, nVersion, nFlags, nComRecCount, nCurRecSize, nRemainingSize, nEMFTotalSize; sal_uInt16 nCheck; - + *pWMF >> nComType >> nVersion >> nCheck >> nFlags - >> nComRecCount >> nCurRecSize + >> nComRecCount >> nCurRecSize >> nRemainingSize >> nEMFTotalSize; // the nRemainingSize is not mentioned in MSDN documentation // but it seems to be required to read in data produced by OLE @@ -950,7 +950,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) delete pEMFStream; pEMFStream = NULL; } - + if( pEMFStream ) { sal_Int8* pBuf = new sal_Int8[ nCurRecSize ]; @@ -999,7 +999,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) BOOL WMFReader::ReadHeader() { - Rectangle aPlaceableBound; + Rectangle aPlaceableBound; sal_uInt32 nl, nStrmPos = pWMF->Tell(); // Einlesen des METAFILEHEADER, falls vorhanden @@ -1030,7 +1030,7 @@ BOOL WMFReader::ReadHeader() } else { - nUnitsPerInch = 96; + nUnitsPerInch = 96; pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the the metaactions GetPlaceableBound( aPlaceableBound, pWMF ); pWMF->Seek( nStrmPos ); @@ -1043,9 +1043,9 @@ BOOL WMFReader::ReadHeader() Size aDevExt( 10000, 10000 ); if( ( labs( aWMFSize.Width() ) > 1 ) && ( labs( aWMFSize.Height() ) > 1 ) ) { - const Fraction aFrac( 1, nUnitsPerInch ); - MapMode aWMFMap( MAP_INCH, Point(), aFrac, aFrac ); - Size aSize100( OutputDevice::LogicToLogic( aWMFSize, aWMFMap, MAP_100TH_MM ) ); + const Fraction aFrac( 1, nUnitsPerInch ); + MapMode aWMFMap( MAP_INCH, Point(), aFrac, aFrac ); + Size aSize100( OutputDevice::LogicToLogic( aWMFSize, aWMFMap, MAP_100TH_MM ) ); aDevExt = Size( labs( aSize100.Width() ), labs( aSize100.Height() ) ); } pOut->SetDevExt( aDevExt ); @@ -1070,9 +1070,9 @@ BOOL WMFReader::ReadHeader() void WMFReader::ReadWMF() { - USHORT nFunction; - ULONG nPos, nPercent, nLastPercent; - + USHORT nFunction; + ULONG nPos, nPercent, nLastPercent; + nSkipActions = 0; nCurrentAction = 0; nUnicodeEscapeAction = 0; @@ -1081,7 +1081,7 @@ void WMFReader::ReadWMF() nEMFRecCount = 0; nEMFRec = 0; nEMFSize = 0; - + sal_Bool bEMFAvailable = sal_False; pOut->SetMapMode( MM_ANISOTROPIC ); @@ -1133,7 +1133,7 @@ void WMFReader::ReadWMF() ReadRecordParams( nFunction ); else nSkipActions--; - + if( pEMFStream && nEMFRecCount == nEMFRec ) { GDIMetaFile aMeta; @@ -1142,7 +1142,7 @@ void WMFReader::ReadWMF() bEMFAvailable = pEMFReader->ReadEnhWMF(); delete pEMFReader; // destroy first!!! - if( bEMFAvailable ) + if( bEMFAvailable ) { pOut->AddFromGDIMetaFile( aMeta ); pOut->SetrclFrame( Rectangle(0, 0, aMeta.GetPrefSize().Width(), aMeta.GetPrefSize().Height() )); @@ -1210,14 +1210,14 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt rPlaceableBound.Top() = (sal_Int32)0x7fffffff; rPlaceableBound.Right() = (sal_Int32)0x80000000; rPlaceableBound.Bottom() = (sal_Int32)0x80000000; - + sal_Int16 nMapMode = MM_ANISOTROPIC; sal_uInt16 nFunction; sal_uInt32 nRSize; sal_uInt32 nPos = pStm->Tell(); sal_uInt32 nEnd = pStm->Seek( STREAM_SEEK_TO_END ); - + pStm->Seek( nPos ); if( nEnd - nPos ) @@ -1252,7 +1252,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt *pStm >> nHeight >> nWidth; rPlaceableBound.SetSize( Size( nWidth, nHeight ) ); } - break; + break; case W_META_SETMAPMODE : *pStm >> nMapMode; @@ -1298,7 +1298,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt case W_META_POLYPOLYGON: { - USHORT i, nPoly, nPoints = 0; + USHORT i, nPoly, nPoints = 0; *pStm >> nPoly; for( i = 0; i < nPoly; i++ ) { @@ -1342,10 +1342,10 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt case W_META_EXTTEXTOUT: { - sal_uInt16 nLen, nOptions; - sal_Int32 nRecordPos, nRecordSize; - Point aPosition; - Rectangle aRect; + sal_uInt16 nLen, nOptions; + sal_Int32 nRecordPos, nRecordSize; + Point aPosition; + Rectangle aRect; pStm->SeekRel(-6); nRecordPos = pStm->Tell(); @@ -1370,7 +1370,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt if( nFunction == W_META_STRETCHDIB ) *pStm >> nUsage; - + // nSye and nSxe is the number of pixels that has to been used if( nFunction == W_META_STRETCHDIB || nFunction == W_META_STRETCHBLT || nFunction == W_META_DIBSTRETCHBLT ) *pStm >> nSye >> nSxe; @@ -1383,11 +1383,11 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt if( nFunction == W_META_STRETCHDIB || nFunction == W_META_DIBBITBLT || nFunction == W_META_DIBSTRETCHBLT ) { if ( nWinROP == PATCOPY ) - *pStm >> nUsage; // i don't know anything of this parameter, so its called nUsage + *pStm >> nUsage; // i don't know anything of this parameter, so its called nUsage // pOut->DrawRect( Rectangle( ReadYX(), aDestSize ), FALSE ); Size aDestSize( ReadYXExt() ); - if ( aDestSize.Width() && aDestSize.Height() ) // #92623# do not try to read buggy bitmaps + if ( aDestSize.Width() && aDestSize.Height() ) // #92623# do not try to read buggy bitmaps { Rectangle aDestRect( ReadYX(), aDestSize ); GetWinExtMax( aDestRect, rPlaceableBound, nMapMode ); |