diff options
Diffstat (limited to 'vcl/source/gdi')
71 files changed, 1194 insertions, 1018 deletions
diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx index 21c3f15f51c0..6107affaf4e9 100644 --- a/vcl/source/gdi/alpha.cxx +++ b/vcl/source/gdi/alpha.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -432,3 +433,5 @@ void AlphaMask::ReleaseAccess( BitmapReadAccess* pAccess ) Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index 9fc45f2f61d6..63d0010bd5d2 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -937,3 +938,5 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation ) return rIStm; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/base14.cxx b/vcl/source/gdi/base14.cxx index 83820bc654bf..9912b3e91509 100644 --- a/vcl/source/gdi/base14.cxx +++ b/vcl/source/gdi/base14.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,9 @@ #include <rtl/strbuf.hxx> using namespace vcl; -using namespace rtl; + +using ::rtl::OString; +using ::rtl::OStringBuffer; OString PDFWriterImpl::BuiltinFont::getNameObject() const { @@ -685,3 +688,4 @@ const PDFWriterImpl::BuiltinFont PDFWriterImpl::m_aBuiltinFonts[ 14 ] = { }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index bcf141a8e005..e2ab338e66b0 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,6 @@ #include <tools/stream.hxx> #include <tools/poly.hxx> #include <tools/rc.h> - #include <vcl/salbtype.hxx> #include <vcl/bmpacc.hxx> #include <vcl/outdev.hxx> @@ -223,7 +223,7 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries ) } else { - DBG_ERROR( "Bitmap::GetGreyPalette: invalid entry count (2/4/16/256 allowed)" ); + OSL_FAIL( "Bitmap::GetGreyPalette: invalid entry count (2/4/16/256 allowed)" ); return aGreyPalette2; } } @@ -1745,38 +1745,6 @@ Bitmap Bitmap::CreateDisplayBitmap( OutputDevice* pDisplay ) // ------------------------------------------------------------------ -Bitmap Bitmap::GetColorTransformedBitmap( BmpColorMode eColorMode ) const -{ - Bitmap aRet; - - if( BMP_COLOR_HIGHCONTRAST == eColorMode ) - { - Color* pSrcColors = NULL; - Color* pDstColors = NULL; - sal_uLong nColorCount = 0; - - aRet = *this; - - Image::GetColorTransformArrays( (ImageColorTransform) eColorMode, pSrcColors, pDstColors, nColorCount ); - - if( nColorCount && pSrcColors && pDstColors ) - aRet.Replace( pSrcColors, pDstColors, nColorCount ); - - delete[] pSrcColors; - delete[] pDstColors; - } - else if( BMP_COLOR_MONOCHROME_BLACK == eColorMode || - BMP_COLOR_MONOCHROME_WHITE == eColorMode ) - { - aRet = *this; - aRet.MakeMono( BMP_COLOR_MONOCHROME_THRESHOLD ); - } - - return aRet; -} - -// ------------------------------------------------------------------ - sal_Bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) { BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess(); @@ -1971,3 +1939,5 @@ bool Bitmap::GetSystemData( BitmapSystemData& rData ) const return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx index 8dffa7d59a2c..9db334395e23 100644 --- a/vcl/source/gdi/bitmap2.cxx +++ b/vcl/source/gdi/bitmap2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,9 +30,7 @@ #include "precompiled_vcl.hxx" #include <tools/zcodec.hxx> -#ifndef _TOOLS_STREAM_HXX #include <tools/stream.hxx> -#endif #include <vcl/salbtype.hxx> #include <vcl/bmpacc.hxx> #include <vcl/outdev.hxx> @@ -46,6 +45,8 @@ #define DIBCOREHEADERSIZE ( 12UL ) #define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) ) +#define BITMAPINFOHEADER 0x28 + #define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 ); // ---------------------- @@ -129,7 +130,7 @@ SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap ) // ------------------------------------------------------------------ -sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader ) +sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader, sal_Bool bIsMSOFormat ) { const sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt(); const sal_uLong nOldPos = rIStm.Tell(); @@ -144,7 +145,7 @@ sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader ) bRet = ImplReadDIB( rIStm, *this, nOffset ); } else - bRet = ImplReadDIB( rIStm, *this, nOffset ); + bRet = ImplReadDIB( rIStm, *this, nOffset, bIsMSOFormat ); if( !bRet ) { @@ -161,18 +162,18 @@ sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader ) // ------------------------------------------------------------------ -sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset ) +sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset, sal_Bool bIsMSOFormat ) { DIBInfoHeader aHeader; const sal_uLong nStmPos = rIStm.Tell(); sal_Bool bRet = sal_False; sal_Bool bTopDown = sal_False; - if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount ) + if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown, bIsMSOFormat ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount ) { const sal_uInt16 nBitCount( discretizeBitcount(aHeader.nBitCount) ); - const Size aSizePixel( aHeader.nWidth, aHeader.nHeight ); + const Size aSizePixel( aHeader.nWidth, abs(aHeader.nHeight) ); BitmapPalette aDummyPal; Bitmap aNewBmp( aSizePixel, nBitCount, &aDummyPal ); BitmapWriteAccess* pAcc = aNewBmp.AcquireWriteAccess(); @@ -215,7 +216,8 @@ sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset ) // set decoded bytes to memory stream, // from which we will read the bitmap data - pIStm = pMemStm = new SvMemoryStream; + pMemStm = new SvMemoryStream; + pIStm = pMemStm; pMemStm->SetBuffer( (char*) pData, nUncodedSize, sal_False, nUncodedSize ); nOffset = 0; } @@ -244,7 +246,7 @@ sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset ) Fraction( 1000, aHeader.nYPelsPerMeter ) ); aNewBmp.SetPrefMapMode( aMapMode ); - aNewBmp.SetPrefSize( Size( aHeader.nWidth, aHeader.nHeight ) ); + aNewBmp.SetPrefSize( Size( aHeader.nWidth, abs(aHeader.nHeight) ) ); } } @@ -299,21 +301,37 @@ sal_Bool Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset ) // ------------------------------------------------------------------ -sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown ) +sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat ) { // BITMAPINFOHEADER or BITMAPCOREHEADER rIStm >> rHeader.nSize; // BITMAPCOREHEADER + sal_Int16 nTmp16 = 0; if ( rHeader.nSize == DIBCOREHEADERSIZE ) { - sal_Int16 nTmp16; rIStm >> nTmp16; rHeader.nWidth = nTmp16; rIStm >> nTmp16; rHeader.nHeight = nTmp16; rIStm >> rHeader.nPlanes; rIStm >> rHeader.nBitCount; } + else if ( bIsMSOFormat && ( rHeader.nSize == BITMAPINFOHEADER ) ) + { + sal_uInt8 nTmp8 = 0; + rIStm >> nTmp16; rHeader.nWidth = nTmp16; + rIStm >> nTmp16; rHeader.nHeight = nTmp16; + rIStm >> nTmp8; rHeader.nPlanes = nTmp8; + rIStm >> nTmp8; rHeader.nBitCount = nTmp8; + rIStm >> nTmp16; rHeader.nSizeImage = nTmp16; + rIStm >> nTmp16; rHeader.nCompression = nTmp16; + if ( !rHeader.nSizeImage ) // uncompressed? + rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight; + rIStm >> rHeader.nXPelsPerMeter; + rIStm >> rHeader.nYPelsPerMeter; + rIStm >> rHeader.nColsUsed; + rIStm >> rHeader.nColsImportant; + } else { // unknown Header @@ -365,7 +383,7 @@ sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, else { rIStm >> rHeader.nWidth; - rIStm >> rHeader.nHeight; + rIStm >> rHeader.nHeight; //rHeader.nHeight=abs(rHeader.nHeight); rIStm >> rHeader.nPlanes; rIStm >> rHeader.nBitCount; rIStm >> rHeader.nCompression; @@ -461,7 +479,13 @@ sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, Bitma if( rHeader.nColsUsed && rHeader.nBitCount > 8 ) rIStm.SeekRel( rHeader.nColsUsed * ( ( rHeader.nSize != DIBCOREHEADERSIZE ) ? 4 : 3 ) ); - rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth ); + if ( rHeader.nHeight > 0 ) + rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth ); + else + { + for( int i = abs(rHeader.nHeight)-1; i >= 0; i-- ) + rIStm.Read( ((char*)rAcc.GetBuffer()) + (nAlignedWidth*i), nAlignedWidth ); + } } else { @@ -504,7 +528,7 @@ sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, Bitma else { const long nWidth = rHeader.nWidth; - const long nHeight = rHeader.nHeight; + const long nHeight = abs(rHeader.nHeight); sal_uInt8* pBuf = new sal_uInt8[ nAlignedWidth ]; // true color DIB's can have a (optimization) palette @@ -1061,7 +1085,7 @@ void Bitmap::ImplDecodeRLE( sal_uInt8* pBuffer, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bRLE4 ) { Scanline pRLE = pBuffer; - long nY = rHeader.nHeight - 1L; + long nY = abs(rHeader.nHeight) - 1L; const sal_uLong nWidth = rAcc.Width(); sal_uLong nCountByte; sal_uLong nRunByte; @@ -1275,3 +1299,5 @@ sal_Bool Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool return( rOStm.GetError() == 0UL ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index d39b0f7169d0..0ae8e63d2519 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -355,7 +356,7 @@ sal_Bool Bitmap::Convert( BmpConversion eConversion ) break; default: - DBG_ERROR( "Bitmap::Convert(): Unsupported conversion" ); + OSL_FAIL( "Bitmap::Convert(): Unsupported conversion" ); break; } @@ -967,10 +968,11 @@ sal_Bool Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY ) const long nHeight = pReadAcc->Height(); long* pLutX = new long[ nNewWidth ]; long* pLutY = new long[ nNewHeight ]; - long nX, nY, nMapY, nActY = 0L; if( nNewWidth1 && nNewHeight1 ) { + long nX, nY, nMapY, nActY = 0L; + for( nX = 0L; nX < nNewWidth; nX++ ) pLutX[ nX ] = nX * nWidth / nNewWidth; @@ -1841,7 +1843,7 @@ sal_Bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount ) nBitCount = 8; else { - DBG_ERROR( "Bitmap::ImplReduceMedian(): invalid color count!" ); + OSL_FAIL( "Bitmap::ImplReduceMedian(): invalid color count!" ); nBitCount = 8; nColCount = 256; } @@ -2203,3 +2205,5 @@ sal_Bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index 5fe9139ea35e..1166f6cc0931 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,6 @@ #include "precompiled_vcl.hxx" #include <stdlib.h> -#include <vos/macros.hxx> #include <vcl/bmpacc.hxx> #include <vcl/bitmap.hxx> @@ -98,7 +98,7 @@ sal_Bool Bitmap::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, break; default: - DBG_ERROR( "Bitmap::Convert(): Unsupported filter" ); + OSL_FAIL( "Bitmap::Convert(): Unsupported filter" ); break; } @@ -474,7 +474,7 @@ sal_Bool Bitmap::ImplSobelGrey( const BmpFilterParam* /*pFilterParam*/, const Li nSum2 += nMask332 * nGrey33; nSum1 = (long) sqrt( (double)( nSum1 * nSum1 + nSum2 * nSum2 ) ); - aGrey.SetIndex( ~(sal_uInt8) VOS_BOUND( nSum1, 0, 255 ) ); + aGrey.SetIndex( ~(sal_uInt8) SAL_BOUND( nSum1, 0, 255 ) ); pWriteAcc->SetPixel( nY, nX, aGrey ); if( nX < ( nWidth - 1 ) ) @@ -549,7 +549,7 @@ sal_Bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* const long nLz = FRound( sin( fElev ) * 255.0 ); const long nZ2 = ( ( 6 * 255 ) / 4 ) * ( ( 6 * 255 ) / 4 ); const long nNzLz = ( ( 6 * 255 ) / 4 ) * nLz; - const sal_uInt8 cLz = (sal_uInt8) VOS_BOUND( nLz, 0, 255 ); + const sal_uInt8 cLz = (sal_uInt8) SAL_BOUND( nLz, 0, 255 ); // fill mapping tables pHMap[ 0 ] = 0; @@ -586,7 +586,7 @@ sal_Bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* else { const double fGrey = nDotL / sqrt( (double)(nNx * nNx + nNy * nNy + nZ2) ); - aGrey.SetIndex( (sal_uInt8) VOS_BOUND( fGrey, 0, 255 ) ); + aGrey.SetIndex( (sal_uInt8) SAL_BOUND( fGrey, 0, 255 ) ); } pWriteAcc->SetPixel( nY, nX, aGrey ); @@ -687,7 +687,7 @@ sal_Bool Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pP { long nSepiaPercent = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_SEPIA ) ? pFilterParam->mcSolarGreyThreshold : 10; - const long nSepia = 10000 - 100 * VOS_BOUND( nSepiaPercent, 0, 100 ); + const long nSepia = 10000 - 100 * SAL_BOUND( nSepiaPercent, 0, 100 ); BitmapPalette aSepiaPal( 256 ); DBG_ASSERT( nSepiaPercent <= 100, "Bitmap::ImplSepia(): sepia value out of range; defaulting to 100%" ); @@ -1007,3 +1007,5 @@ sal_Bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link* return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 743326df04d5..2e77b666f8c8 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,6 +44,7 @@ #include <vcl/pngread.hxx> #include <vcl/svapp.hxx> #include <vcl/bmpacc.hxx> +#include <vcl/virdev.hxx> #include <image.h> #include <impimagetree.hxx> @@ -107,11 +109,11 @@ BitmapEx::BitmapEx( const ResId& rResId ) : const String aFileName( pResMgr->ReadString() ); ::rtl::OUString aCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName(); - if( !aImageTree->loadImage( aFileName, aCurrentSymbolsStyle, *this ) ) + if( !aImageTree->loadImage( aFileName, aCurrentSymbolsStyle, *this, true ) ) { #ifdef DBG_UTIL ByteString aErrorStr( "BitmapEx::BitmapEx( const ResId& rResId ): could not load image <" ); - DBG_ERROR( ( ( aErrorStr += ByteString( aFileName, RTL_TEXTENCODING_ASCII_US ) ) += '>' ).GetBuffer() ); + OSL_FAIL( ( ( aErrorStr += ByteString( aFileName, RTL_TEXTENCODING_ASCII_US ) ) += '>' ).GetBuffer() ); #endif } } @@ -301,36 +303,6 @@ Bitmap BitmapEx::GetBitmap( const Color* pTransReplaceColor ) const // ------------------------------------------------------------------ -BitmapEx BitmapEx::GetColorTransformedBitmapEx( BmpColorMode eColorMode ) const -{ - BitmapEx aRet; - - if( BMP_COLOR_HIGHCONTRAST == eColorMode ) - { - aRet = *this; - aRet.aBitmap = aBitmap.GetColorTransformedBitmap( eColorMode ); - } - else if( BMP_COLOR_MONOCHROME_BLACK == eColorMode || - BMP_COLOR_MONOCHROME_WHITE == eColorMode ) - { - aRet = *this; - aRet.aBitmap = aRet.aBitmap.GetColorTransformedBitmap( eColorMode ); - - if( !aRet.aMask.IsEmpty() ) - { - aRet.aMask.CombineSimple( aRet.aBitmap, BMP_COMBINE_OR ); - aRet.aBitmap.Erase( ( BMP_COLOR_MONOCHROME_BLACK == eColorMode ) ? COL_BLACK : COL_WHITE ); - - DBG_ASSERT( aRet.aBitmap.GetSizePixel() == aRet.aMask.GetSizePixel(), - "BitmapEx::GetColorTransformedBitmapEx(): size mismatch for bitmap and alpha mask." ); - } - } - - return aRet; -} - -// ------------------------------------------------------------------ - Bitmap BitmapEx::GetMask() const { Bitmap aRet( aMask ); @@ -758,6 +730,60 @@ void BitmapEx::Draw( OutputDevice* pOutDev, pOutDev->DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, *this ); } +BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize) +{ + Point aEmptyPoint(0,0); + sal_Int32 imgNewWidth = 0; + sal_Int32 imgNewHeight = 0; + double imgposX = 0; + double imgposY = 0; + BitmapEx aRet = aBitmap; + double imgOldWidth = aRet.GetSizePixel().Width(); + double imgOldHeight =aRet.GetSizePixel().Height(); + + Size aScaledSize; + if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize) + { + if (imgOldWidth >= imgOldHeight) + { + imgNewWidth = aStandardSize; + imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5); + imgposX = 0; + imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5; + } + else + { + imgNewHeight = aStandardSize; + imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5); + imgposY = 0; + imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5; + } + + aScaledSize = Size( imgNewWidth, imgNewHeight ); + aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE ); + } + else + { + imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5; + imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5; + } + + Size aStdSize( aStandardSize, aStandardSize ); + Rectangle aRect(aEmptyPoint, aStdSize ); + + VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 ); + aVirDevice.SetOutputSizePixel( aStdSize ); + aVirDevice.SetFillColor( COL_TRANSPARENT ); + aVirDevice.SetLineColor( COL_TRANSPARENT ); + + //draw a rect into virDevice + aVirDevice.DrawRect( aRect ); + Point aPointPixel( (long)imgposX, (long)imgposY ); + aVirDevice.DrawBitmapEx( aPointPixel, aRet ); + aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize ); + + return aRet; +} // ------------------------------------------------------------------ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const @@ -913,3 +939,5 @@ SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ) return rIStm; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index ed0dc6225a0f..03b29fcbc965 100644 --- a/vcl/source/gdi/bmpacc.cxx +++ b/vcl/source/gdi/bmpacc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -252,7 +253,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits() default: { - DBG_ERROR( "BitmapWriteAccess::ZeroInitUnusedBits: Unsupported pixel format"); + OSL_FAIL( "BitmapWriteAccess::ZeroInitUnusedBits: Unsupported pixel format"); nBits = 0; bMsb = true; } @@ -448,3 +449,5 @@ void BitmapWriteAccess::CopyBuffer( const BitmapReadAccess& rReadAcc ) for( long nY = 0L, nHeight = Min( mpBuffer->mnHeight, rReadAcc.Height() ); nY < nHeight; nY++ ) CopyScanline( nY, rReadAcc ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx index ae0eade2381b..718bd56cdb0c 100644 --- a/vcl/source/gdi/bmpacc2.cxx +++ b/vcl/source/gdi/bmpacc2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -329,3 +330,5 @@ IMPL_FORMAT_SETPIXEL( _32BIT_TC_MASK ) { rMask.SetColorFor32Bit( rBitmapColor, pScanline + ( nX << 2UL ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx index fc3e031f260e..39d57a05cb84 100644 --- a/vcl/source/gdi/bmpacc3.cxx +++ b/vcl/source/gdi/bmpacc3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -411,3 +412,5 @@ void BitmapWriteAccess::DrawPolyPolygon( const PolyPolygon& rPolyPoly ) } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpconv.cxx b/vcl/source/gdi/bmpconv.cxx index 789c8377318d..886055817312 100644 --- a/vcl/source/gdi/bmpconv.cxx +++ b/vcl/source/gdi/bmpconv.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include "vcl/bitmap.hxx" #include "vcl/svapp.hxx" #include "vcl/salctype.hxx" -#include "vos/mutex.hxx" +#include <osl/mutex.hxx> #include "tools/stream.hxx" #include "com/sun/star/script/XInvocation.hpp" #include "com/sun/star/awt/XBitmap.hpp" @@ -43,7 +44,8 @@ using namespace com::sun::star::script; using namespace com::sun::star::beans; using namespace com::sun::star::reflection; using namespace com::sun::star::awt; -using namespace rtl; + +using ::rtl::OUString; namespace vcl { @@ -118,7 +120,7 @@ Any SAL_CALL BmpConverter::getValue( const OUString& ) throw( UnknownPropertyExc sal_Bool SAL_CALL BmpConverter::hasMethod( const OUString& rName ) throw() { - return rName.equalsIgnoreAsciiCase( OUString::createFromAscii( "convert-bitmap-depth" ) ); + return rName.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("convert-bitmap-depth")) ); } sal_Bool SAL_CALL BmpConverter::hasProperty( const OUString& ) throw() @@ -135,7 +137,7 @@ Any SAL_CALL BmpConverter::invoke( { Any aRet; - if( rFunction.equalsIgnoreAsciiCase( OUString::createFromAscii( "convert-bitmap-depth" ) ) ) + if( rFunction.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("convert-bitmap-depth")) ) ) { Reference< XBitmap > xBM; sal_uInt16 nTargetDepth = 0; @@ -149,7 +151,7 @@ Any SAL_CALL BmpConverter::invoke( Sequence< sal_Int8 > aDIB = xBM->getDIB(); // call into vcl not thread safe - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvMemoryStream aStream( aDIB.getArray(), aDIB.getLength(), STREAM_READ | STREAM_WRITE ); Bitmap aBM; @@ -211,3 +213,5 @@ Sequence< sal_Int8 > SAL_CALL BmpTransporter::getMaskDIB() throw() { return Sequence< sal_Int8 >(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx index a3b729e69244..e410e0ee25e8 100644 --- a/vcl/source/gdi/bmpfast.cxx +++ b/vcl/source/gdi/bmpfast.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -251,63 +252,6 @@ class TrueColorPixelPtr<BMP_FORMAT_8BIT_PAL> : public TrueColorPixelPtr<BMP_FORMAT_8BIT_TC_MASK> {}; -#if 0 -template <> -class TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_MASK> : public BasePixelPtr -{ -public: - void operator++() { mpPixel += 3; } - - unsigned GetAlpha() const - { - unsigned nAlpha = mpPixel[0]; - nAlpha |= mpPixel[1] << 8U; - nAlpha |= mpPixel[2] << 16U; - return nAlpha; - } - - void SetAlpha( unsigned nAlpha ) const - { - mpPixel[0] = nAlpha; - mpPixel[1] = nAlpha >> 8U; - mpPixel[2] = nAlpha >> 16U; - } -}; - -template <> -class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_MASK> : public BasePixelPtr -{ -public: - void operator++() { mpPixel += 4; } - - unsigned GetAlpha() const - { -#ifdef OSL_BIGENDIAN - unsigned nAlpha = *reinterpret_cast<unsigned*>( mpPixel ); -#else - unsigned nAlpha = mpPixel[0]; - nAlpha |= mpPixel[1] << 8U; - nAlpha |= mpPixel[2] << 16U; - nAlpha |= mpPixel[3] << 24U; -#endif - return nAlpha; - } - - void SetAlpha( unsigned nAlpha ) const - { -#ifdef OSL_BIGENDIAN - *reinterpret_cast<unsigned*>( mpPixel ) = nAlpha; -#else - mpPixel[0] = nAlpha; - mpPixel[1] = nAlpha >> 8U; - mpPixel[2] = nAlpha >> 16U; - mpPixel[3] = nAlpha >> 24U; -#endif - } -}; - -#endif - // ======================================================================= // converting truecolor formats @@ -1038,3 +982,5 @@ bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx index ce39c70e243f..1ddc801c8329 100644 --- a/vcl/source/gdi/configsettings.cxx +++ b/vcl/source/gdi/configsettings.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,7 +37,6 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> -using namespace rtl; using namespace utl; using namespace vcl; using namespace com::sun::star::uno; @@ -44,6 +44,8 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; +using ::rtl::OUString; + #define SETTINGS_CONFIGNODE "VCL/Settings" /* @@ -90,7 +92,7 @@ void SettingsConfigItem::Commit() if( ! IsValidConfigMgr() ) return; - std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; + boost::unordered_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group ) { @@ -135,12 +137,11 @@ void SettingsConfigItem::getValues() m_aSettings.clear(); Sequence< OUString > aNames( GetNodeNames( OUString() ) ); - m_aSettings.resize( aNames.getLength() ); for( int j = 0; j < aNames.getLength(); j++ ) { #if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "found settings data for \"%s\"\n", + OSL_TRACE( "found settings data for \"%s\"\n", OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr() ); #endif @@ -166,7 +167,7 @@ void SettingsConfigItem::getValues() if( pLine->getLength() ) m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine; #if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, " \"%s\"=\"%.30s\"\n", + OSL_TRACE( " \"%s\"=\"%.30s\"\n", OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(), OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() ); @@ -182,7 +183,7 @@ void SettingsConfigItem::getValues() const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const { - ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); + ::boost::unordered_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() ) { static OUString aEmpty; @@ -205,3 +206,4 @@ void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx index 61a08df4ddc0..6d3b60777120 100644 --- a/vcl/source/gdi/cvtgrf.cxx +++ b/vcl/source/gdi/cvtgrf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -171,3 +172,5 @@ sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, sa return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 7a6dd74db2c5..2d9fbef36e44 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -942,7 +943,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } #ifdef DBG_UTIL else - DBG_ERROR("More than one DX array element missing on SVM import"); + OSL_FAIL("More than one DX array element missing on SVM import"); #endif } } @@ -1379,7 +1380,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ) { - sal_uLong nPos; sal_uLong nCountPos; Font aSaveFont; const sal_uInt16 nOldFormat = rOStm.GetNumberFormatInt(); @@ -1394,7 +1394,6 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ) //MagicCode schreiben rOStm << "SVGDI"; // Kennung - nPos = rOStm.Tell(); rOStm << (sal_Int16) 42; // HeaderSize rOStm << (sal_Int16) 200; // VERSION rOStm << (sal_Int32) aPrefSize.Width(); @@ -2363,11 +2362,6 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, } break; -#if 0 - case( META_OVERLINECOLOR_ACTION ): - break; -#endif - case( META_TEXTLINE_ACTION ): { const MetaTextLineAction* pA = (MetaTextLineAction*) pAction; @@ -2440,7 +2434,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, ByteString aStr( "Missing implementation for Action#: " ); aStr += ByteString::CreateFromInt32( pAction->GetType() ); aStr += '!'; - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } break; #endif @@ -2514,3 +2508,5 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, return nCount; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/extoutdevdata.cxx b/vcl/source/gdi/extoutdevdata.cxx index eebd6b35765b..2b8ad0fb9ae6 100644 --- a/vcl/source/gdi/extoutdevdata.cxx +++ b/vcl/source/gdi/extoutdevdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ ExtOutDevData::~ExtOutDevData() } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx index 4f1aad4d36cb..9102f693c025 100644 --- a/vcl/source/gdi/font.cxx +++ b/vcl/source/gdi/font.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,6 +41,7 @@ #include "outfont.hxx" #include "sft.hxx" +#include <sal/macros.h> #include <algorithm> @@ -1032,7 +1034,7 @@ namespace aEnt.string = pOpen+1; aEnt.string_len = (pClose-pOpen)-1; aEnt.weight = WEIGHT_NORMAL; - const int nEnt = sizeof( weight_table ) / sizeof( weight_table[0] ); + const int nEnt = SAL_N_ELEMENTS( weight_table ); WeightSearchEntry* pFound = std::lower_bound( weight_table, weight_table+nEnt, aEnt ); if( pFound != (weight_table+nEnt) ) o_rResult.SetWeight( pFound->weight ); @@ -1113,3 +1115,5 @@ FontStrikeout Font::GetStrikeout() const { return mpImplFont->meStrikeout; } FontEmphasisMark Font::GetEmphasisMark() const { return mpImplFont->meEmphasisMark; } sal_Bool Font::IsWordLineMode() const { return mpImplFont->mbWordLine; } sal_Bool Font::IsSameInstance( const Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 1e99c5c3c04f..ed15dfae81a2 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <vos/macros.hxx> #include <rtl/crc.h> #include <tools/stream.hxx> #include <tools/vcompat.hxx> @@ -35,12 +35,28 @@ #include <vcl/salbtype.hxx> #include <vcl/outdev.hxx> #include <vcl/window.hxx> -#ifndef _SV_CVTSVM_HXX #include <vcl/cvtsvm.hxx> -#endif #include <vcl/virdev.hxx> +#include <vcl/salbmp.hxx> +#include <vcl/svapp.hxx> +#include <vcl/svdata.hxx> +#include <vcl/salinst.hxx> #include <vcl/gdimtf.hxx> #include <vcl/graphictools.hxx> +#include <vcl/canvastools.hxx> +#include <vcl/unohelp.hxx> + +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <com/sun/star/rendering/XCanvas.hpp> +#include <com/sun/star/rendering/MtfRenderer.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/awt/XGraphics.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/graphic/XGraphicRenderer.hpp> + +using namespace com::sun::star; // ----------- // - Defines - @@ -200,7 +216,8 @@ GDIMetaFile::GDIMetaFile() : pOutDev ( NULL ), pLabelList ( NULL ), bPause ( sal_False ), - bRecord ( sal_False ) + bRecord ( sal_False ), + bUseCanvas ( sal_False ) { } @@ -215,7 +232,8 @@ GDIMetaFile::GDIMetaFile( const GDIMetaFile& rMtf ) : pNext ( rMtf.pNext ), pOutDev ( NULL ), bPause ( sal_False ), - bRecord ( sal_False ) + bRecord ( sal_False ), + bUseCanvas ( rMtf.bUseCanvas ) { // RefCount der MetaActions erhoehen for( void* pAct = First(); pAct; pAct = Next() ) @@ -269,6 +287,7 @@ GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf ) pOutDev = NULL; bPause = sal_False; bRecord = sal_False; + bUseCanvas = rMtf.bUseCanvas; if( rMtf.bRecord ) { @@ -418,6 +437,8 @@ void GDIMetaFile::Play( GDIMetaFile& rMtf, sal_uLong nPos ) MetaAction* pAction = GetCurAction(); const sal_uLong nObjCount = Count(); + rMtf.UseCanvas( rMtf.GetUseCanvas() || bUseCanvas ); + if( nPos > nObjCount ) nPos = nObjCount; @@ -459,7 +480,16 @@ void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos ) { if( !Hook() ) { - pAction->Execute( pOut ); + MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction); + if( pAction->GetType() == META_COMMENT_ACTION && + pCommentAct->GetComment().Equals("DELEGATE_PLUGGABLE_RENDERER") ) + { + ImplDelegate2PluggableRenderer(pCommentAct, pOut); + } + else + { + pAction->Execute( pOut ); + } // flush output from time to time if( i++ > nSyncCount ) @@ -475,6 +505,154 @@ void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos ) // ------------------------------------------------------------------------ +bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize ) +{ + const Window* win = dynamic_cast <Window*> ( pOut ); + + if (!win) + win = Application::GetActiveTopWindow(); + if (!win) + win = Application::GetFirstTopLevelWindow(); + + if (!win) + return false; + + try { + const uno::Reference<rendering::XCanvas>& xCanvas = win->GetCanvas (); + Size aSize (rDestSize.Width () + 1, rDestSize.Height () + 1); + const uno::Reference<rendering::XBitmap>& xBitmap = xCanvas->getDevice ()->createCompatibleAlphaBitmap (vcl::unotools::integerSize2DFromSize( aSize)); + uno::Reference< lang::XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); + if( xFactory.is() && xBitmap.is () ) { + uno::Reference< rendering::XMtfRenderer > xMtfRenderer; + uno::Sequence< uno::Any > args (1); + uno::Reference< rendering::XBitmapCanvas > xBitmapCanvas( xBitmap, uno::UNO_QUERY ); + if( xBitmapCanvas.is() ) { + args[0] = uno::Any( xBitmapCanvas ); + xMtfRenderer.set( xFactory->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rendering.MtfRenderer")), + args ), uno::UNO_QUERY ); + + if( xMtfRenderer.is() ) { + xBitmapCanvas->clear(); + uno::Reference< beans::XFastPropertySet > xMtfFastPropertySet( xMtfRenderer, uno::UNO_QUERY ); + if( xMtfFastPropertySet.is() ) + // set this metafile to the renderer to + // speedup things (instead of copying data to + // sequence of bytes passed to renderer) + xMtfFastPropertySet->setFastPropertyValue( 0, uno::Any( reinterpret_cast<sal_Int64>( this ) ) ); + + xMtfRenderer->draw( rDestSize.Width(), rDestSize.Height() ); + + uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, uno::UNO_QUERY ); + if( xFastPropertySet.get() ) { + // 0 means get BitmapEx + uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 ); + BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue()); + if( pBitmapEx ) { + pOut->DrawBitmapEx( rPos, *pBitmapEx ); + delete pBitmapEx; + return true; + } + } + + SalBitmap* pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap(); + SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap(); + + if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) ) { + Bitmap aBitmap( pSalBmp ); + Bitmap aMask( pSalMask ); + AlphaMask aAlphaMask( aMask ); + BitmapEx aBitmapEx( aBitmap, aAlphaMask ); + pOut->DrawBitmapEx( rPos, aBitmapEx ); + return true; + } + + delete pSalBmp; + delete pSalMask; + } + } + } + } catch( uno::RuntimeException& ) { + throw; // runtime errors are fatal + } catch( uno::Exception& ) { + // ignore errors, no way of reporting them here + } + + return false; +} + +// ------------------------------------------------------------------------ + +void GDIMetaFile::ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, OutputDevice* pOut ) +{ + OSL_ASSERT( pAct->GetComment().Equals("DELEGATE_PLUGGABLE_RENDERER") ); + + // read payload - string of service name, followed by raw render input + const sal_uInt8* pData = pAct->GetData(); + const sal_uInt8* const pEndData = pData + pAct->GetDataSize(); + if( !pData ) + return; + + ::rtl::OUStringBuffer aBuffer; + while( pData<pEndData && *pData ) + aBuffer.append(static_cast<sal_Unicode>(*pData++)); + const ::rtl::OUString aRendererServiceName=aBuffer.makeStringAndClear(); + ++pData; + + while( pData<pEndData && *pData ) + aBuffer.append(static_cast<sal_Unicode>(*pData++)); + const ::rtl::OUString aGraphicServiceName=aBuffer.makeStringAndClear(); + ++pData; + + uno::Reference< lang::XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); + if( pData<pEndData && xFactory.is() ) + { + try + { + // instantiate render service + uno::Sequence<uno::Any> aRendererArgs(1); + aRendererArgs[0] = makeAny(uno::Reference<awt::XGraphics>(pOut->CreateUnoGraphics())); + uno::Reference<graphic::XGraphicRenderer> xRenderer( + xFactory->createInstanceWithArguments( + aRendererServiceName, + aRendererArgs), + uno::UNO_QUERY ); + + // instantiate graphic service + uno::Reference<graphic::XGraphic> xGraphic( + xFactory->createInstance( + aGraphicServiceName), + uno::UNO_QUERY ); + + uno::Reference<lang::XInitialization> xInit( + xGraphic, uno::UNO_QUERY); + + if(xGraphic.is() && xRenderer.is() && xInit.is()) + { + // delay intialization of XGraphic, to only expose + // XGraphic-generating services to arbitrary binary data + uno::Sequence< sal_Int8 > aSeq( + (sal_Int8*)&pData, pEndData-pData ); + uno::Sequence<uno::Any> aGraphicsArgs(1); + aGraphicsArgs[0] = makeAny(aSeq); + xInit->initialize(aGraphicsArgs); + + xRenderer->render(xGraphic); + } + } + catch( uno::RuntimeException& ) + { + // runtime errors are fatal + throw; + } + catch( uno::Exception& ) + { + // ignore errors, no way of reporting them here + } + } +} + +// ------------------------------------------------------------------------ + void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos, const Size& rSize, sal_uLong nPos ) { @@ -484,9 +662,13 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos, if( aDestSize.Width() && aDestSize.Height() ) { - Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) ); GDIMetaFile* pMtf = pOut->GetConnectMetaFile(); + if( bUseCanvas && !pMtf && ImplPlayWithRenderer( pOut, rPos, aDestSize ) ) + return; + + Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) ); + if( !aTmpPrefSize.Width() ) aTmpPrefSize.Width() = aDestSize.Width(); @@ -783,12 +965,12 @@ sal_Bool GDIMetaFile::Mirror( sal_uLong nMirrorFlags ) sal_Bool bRet; if( nMirrorFlags & MTF_MIRROR_HORZ ) - nMoveX = VOS_ABS( aOldPrefSize.Width() ) - 1, fScaleX = -1.0; + nMoveX = SAL_ABS( aOldPrefSize.Width() ) - 1, fScaleX = -1.0; else nMoveX = 0, fScaleX = 1.0; if( nMirrorFlags & MTF_MIRROR_VERT ) - nMoveY = VOS_ABS( aOldPrefSize.Height() ) - 1, fScaleY = -1.0; + nMoveY = SAL_ABS( aOldPrefSize.Height() ) - 1, fScaleY = -1.0; else nMoveY = 0, fScaleY = 1.0; @@ -1445,7 +1627,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) case( META_TEXTRECT_ACTION ): case( META_MOVECLIPREGION_ACTION ): { - DBG_ERROR( "GDIMetaFile::Rotate(): unsupported action" ); + OSL_FAIL( "GDIMetaFile::Rotate(): unsupported action" ); } break; @@ -2166,7 +2348,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol case( META_BMPEX_ACTION ): case( META_MASK_ACTION ): { - DBG_ERROR( "Don't use bitmap actions of this type in metafiles!" ); + OSL_FAIL( "Don't use bitmap actions of this type in metafiles!" ); } break; @@ -3193,3 +3375,53 @@ sal_Bool GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent, return !rBmpEx.IsEmpty(); } + +void GDIMetaFile::UseCanvas( sal_Bool _bUseCanvas ) +{ + bUseCanvas = _bUseCanvas; +} + +// ------------------------------------------------------------------------ + +MetaCommentAction* makePluggableRendererAction( const rtl::OUString& rRendererServiceName, + const rtl::OUString& rGraphicServiceName, + const void* _pData, + sal_uInt32 nDataSize ) +{ + const sal_uInt8* pData=(sal_uInt8*)_pData; + + // data gets copied twice, unfortunately + rtl::OString aRendererServiceName( + rRendererServiceName.getStr(), + rRendererServiceName.getLength(), + RTL_TEXTENCODING_ASCII_US); + rtl::OString aGraphicServiceName( + rGraphicServiceName.getStr(), + rGraphicServiceName.getLength(), + RTL_TEXTENCODING_ASCII_US); + + std::vector<sal_uInt8> aMem( + aRendererServiceName.getLength()+ + aGraphicServiceName.getLength()+2+nDataSize); + sal_uInt8* pMem=&aMem[0]; + + std::copy(aRendererServiceName.getStr(), + aRendererServiceName.getStr()+aRendererServiceName.getLength()+1, + pMem); + pMem+=aRendererServiceName.getLength()+1; + std::copy(aGraphicServiceName.getStr(), + aGraphicServiceName.getStr()+aGraphicServiceName.getLength()+1, + pMem); + pMem+=aGraphicServiceName.getLength()+1; + + std::copy(pData,pData+nDataSize, + pMem); + + return new MetaCommentAction( + "DELEGATE_PLUGGABLE_RENDERER", + 0, + &aMem[0], + aMem.size()); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx index c9c997b568e2..745c4f765398 100644 --- a/vcl/source/gdi/gfxlink.cxx +++ b/vcl/source/gdi/gfxlink.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -468,3 +469,5 @@ void ImpSwap::WriteTo( SvStream& rOStm ) const delete[] pData; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx index 9f4f91c38e60..38d8ba4567a2 100644 --- a/vcl/source/gdi/gradient.cxx +++ b/vcl/source/gdi/gradient.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -244,6 +245,99 @@ void Gradient::SetSteps( sal_uInt16 nSteps ) // ----------------------------------------------------------------------- +void Gradient::GetBoundRect( const Rectangle& rRect, Rectangle& rBoundRect, Point& rCenter ) const +{ + Rectangle aRect( rRect ); + sal_uInt16 nAngle = GetAngle() % 3600; + + if( GetStyle() == GRADIENT_LINEAR || GetStyle() == GRADIENT_AXIAL ) + { + aRect.Left()--; + aRect.Top()--; + aRect.Right()++; + aRect.Bottom()++; + + const double fAngle = nAngle * F_PI1800; + const double fWidth = aRect.GetWidth(); + const double fHeight = aRect.GetHeight(); + double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) ); + double fDY = fHeight * fabs( cos( fAngle ) ) + fWidth * fabs( sin( fAngle ) ); + + fDX = ( fDX - fWidth ) * 0.5 + 0.5; + fDY = ( fDY - fHeight ) * 0.5 + 0.5; + + aRect.Left() -= (long) fDX; + aRect.Right() += (long) fDX; + aRect.Top() -= (long) fDY; + aRect.Bottom() += (long) fDY; + + rBoundRect = aRect; + rCenter = rRect.Center(); + } + else + { + + if( GetStyle() == GRADIENT_SQUARE || GetStyle() == GRADIENT_RECT ) + { + const double fAngle = nAngle * F_PI1800; + const double fWidth = aRect.GetWidth(); + const double fHeight = aRect.GetHeight(); + double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) ); + double fDY = fHeight * fabs( cos( fAngle ) ) + fWidth * fabs( sin( fAngle ) ); + + fDX = ( fDX - fWidth ) * 0.5 + 0.5; + fDY = ( fDY - fHeight ) * 0.5 + 0.5; + + aRect.Left() -= (long) fDX; + aRect.Right() += (long) fDX; + aRect.Top() -= (long) fDY; + aRect.Bottom() += (long) fDY; + } + + Size aSize( aRect.GetSize() ); + + if( GetStyle() == GRADIENT_RADIAL ) + { + // Radien-Berechnung fuer Kreis + aSize.Width() = (long)(0.5 + sqrt((double)aSize.Width()*(double)aSize.Width() + (double)aSize.Height()*(double)aSize.Height())); + aSize.Height() = aSize.Width(); + } + else if( GetStyle() == GRADIENT_ELLIPTICAL ) + { + // Radien-Berechnung fuer Ellipse + aSize.Width() = (long)( 0.5 + (double) aSize.Width() * 1.4142 ); + aSize.Height() = (long)( 0.5 + (double) aSize.Height() * 1.4142 ); + } + else if( GetStyle() == GRADIENT_SQUARE ) + { + if ( aSize.Width() > aSize.Height() ) + aSize.Height() = aSize.Width(); + else + aSize.Width() = aSize.Height(); + } + + // neue Mittelpunkte berechnen + long nZWidth = aRect.GetWidth() * (long) GetOfsX() / 100; + long nZHeight = aRect.GetHeight() * (long) GetOfsY() / 100; + long nBorderX = (long) GetBorder() * aSize.Width() / 100; + long nBorderY = (long) GetBorder() * aSize.Height() / 100; + rCenter = Point( aRect.Left() + nZWidth, aRect.Top() + nZHeight ); + + // Rand beruecksichtigen + aSize.Width() -= nBorderX; + aSize.Height() -= nBorderY; + + // Ausgaberechteck neu setzen + aRect.Left() = rCenter.X() - ( aSize.Width() >> 1 ); + aRect.Top() = rCenter.Y() - ( aSize.Height() >> 1 ); + + aRect.SetSize( aSize ); + rBoundRect = rRect; + } +} + +// ----------------------------------------------------------------------- + Gradient& Gradient::operator=( const Gradient& rGradient ) { DBG_CHKTHIS( Gradient, NULL ); @@ -342,3 +436,5 @@ SvStream& operator<<( SvStream& rOStm, const Gradient& rGradient ) { return( rOStm << *rGradient.mpImplGradient ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 65555a441a1a..eb22d31937df 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -844,3 +845,5 @@ SvStream& operator<<( SvStream& rOStream, const Graphic& rGraphic ) { return rOStream << *rGraphic.mpImpGraphic; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx index 5ef9ed038163..2e20a3639790 100644 --- a/vcl/source/gdi/graphictools.cxx +++ b/vcl/source/gdi/graphictools.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,7 +52,7 @@ static ::rtl::OString polyToString( const Polygon& rPoly ) break; default: - DBG_ERROR( "SvtGraphicStroke::polyToString invalid flag"); + OSL_FAIL( "SvtGraphicStroke::polyToString invalid flag"); break; } aStr += ::rtl::OString::valueOf( static_cast< double >( rPoly[nVertex].getX() ) ); @@ -226,7 +227,7 @@ void SvtGraphicStroke::getDashArray( DashArray& rDashArray ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing cap type"); + OSL_FAIL( "SvtGraphicStroke::toString missing cap type"); break; } aStr += " join: "; @@ -249,7 +250,7 @@ void SvtGraphicStroke::getDashArray( DashArray& rDashArray ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing join type"); + OSL_FAIL( "SvtGraphicStroke::toString missing join type"); break; } aStr += " "; @@ -514,7 +515,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicFill::toString missing fill rule"); + OSL_FAIL( "SvtGraphicFill::toString missing fill rule"); break; } aStr += " type: "; @@ -537,7 +538,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing fill type"); + OSL_FAIL( "SvtGraphicStroke::toString missing fill type"); break; } @@ -563,7 +564,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing hatch type"); + OSL_FAIL( "SvtGraphicStroke::toString missing hatch type"); break; } @@ -586,7 +587,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing gradient type"); + OSL_FAIL( "SvtGraphicStroke::toString missing gradient type"); break; } @@ -617,7 +618,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing graphic type"); + OSL_FAIL( "SvtGraphicStroke::toString missing graphic type"); break; } @@ -757,3 +758,5 @@ SvStream& operator>>( SvStream& rIStm, SvtGraphicFill& rClass ) return rIStm; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx index b226c0f06936..9836b2e6e4b4 100644 --- a/vcl/source/gdi/hatch.cxx +++ b/vcl/source/gdi/hatch.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <tools/stream.hxx> #include <tools/vcompat.hxx> #include <tools/debug.hxx> -#ifndef _SV_HATCX_HXX #include <vcl/hatch.hxx> -#endif DBG_NAME( Hatch ) @@ -220,3 +219,5 @@ SvStream& operator<<( SvStream& rOStm, const Hatch& rHatch ) { return( rOStm << *rHatch.mpImplHatch ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index d33709787d2d..18f927e5b0ff 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,13 +38,12 @@ #include <tools/rc.h> #include <tools/rc.hxx> #include <tools/resmgr.hxx> - #include <vcl/settings.hxx> #include <vcl/outdev.hxx> #include <vcl/graph.hxx> #include <vcl/svapp.hxx> #include <vcl/image.hxx> - +#include <vcl/imagerepository.hxx> #include <impimagetree.hxx> #include <image.h> @@ -276,51 +276,6 @@ uno::Reference< graphic::XGraphic > Image::GetXGraphic() const // ----------------------------------------------------------------------- -Image Image::GetColorTransformedImage( ImageColorTransform eColorTransform ) const -{ - DBG_CHKTHIS( Image, NULL ); - - Image aRet; - - if( IMAGECOLORTRANSFORM_HIGHCONTRAST == eColorTransform ) - { - BitmapEx aBmpEx( GetBitmapEx() ); - - if( !aBmpEx.IsEmpty() ) - { - Color* pSrcColors = NULL; - Color* pDstColors = NULL; - sal_uLong nColorCount = 0; - - Image::GetColorTransformArrays( eColorTransform, pSrcColors, pDstColors, nColorCount ); - - if( nColorCount && pSrcColors && pDstColors ) - { - aBmpEx.Replace( pSrcColors, pDstColors, nColorCount ); - aRet = Image( aBmpEx ); - } - - delete[] pSrcColors; - delete[] pDstColors; - } - } - else if( IMAGECOLORTRANSFORM_MONOCHROME_BLACK == eColorTransform || - IMAGECOLORTRANSFORM_MONOCHROME_WHITE == eColorTransform ) - { - BitmapEx aBmpEx( GetBitmapEx() ); - - if( !aBmpEx.IsEmpty() ) - aRet = Image( aBmpEx.GetColorTransformedBitmapEx( ( BmpColorMode )( eColorTransform ) ) ); - } - - if( !aRet ) - aRet = *this; - - return aRet; -} - -// ----------------------------------------------------------------------- - void Image::Invert() { BitmapEx aInvertedBmp( GetBitmapEx() ); @@ -492,8 +447,6 @@ ImageList::ImageList( const ::std::vector< ::rtl::OUString >& rNameVector, mpImplData->maPrefix = rPrefix; for( sal_uInt32 i = 0; i < rNameVector.size(); ++i ) { -// fprintf (stderr, "List %p [%d]: '%s'\n", -// this, i, rtl::OUStringToOString( rNameVector[i], RTL_TEXTENCODING_UTF8 ).getStr() ); mpImplData->AddImage( rNameVector[ i ], static_cast< sal_uInt16 >( i ) + 1, BitmapEx() ); } } @@ -539,9 +492,6 @@ void ImageAryData::Load(const rtl::OUString &rPrefix) BitmapEx aBmpEx; -// fprintf (stderr, "Attempt load of '%s'\n", -// rtl::OUStringToOString( maName, RTL_TEXTENCODING_UTF8 ).getStr() ); - rtl::OUString aFileName = rPrefix; aFileName += maName; #if OSL_DEBUG_LEVEL > 0 @@ -555,7 +505,7 @@ void ImageAryData::Load(const rtl::OUString &rPrefix) aMessage.append( "ImageAryData::Load: failed to load image '" ); aMessage.append( ::rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() ); aMessage.append( "'" ); - OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); + OSL_FAIL( aMessage.makeStringAndClear().getStr() ); } #endif } @@ -618,8 +568,6 @@ void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx, { sal_uInt16 nItems = sal::static_int_cast< sal_uInt16 >( rNameVector.size() ); -// fprintf (stderr, "InsertFromHorizontalStrip (1) [%d items]\n", nItems); - if (!nItems) return; @@ -791,15 +739,13 @@ Image ImageList::GetImage( sal_uInt16 nId ) const { DBG_CHKTHIS( ImageList, NULL ); -// fprintf (stderr, "GetImage %d\n", nId); - Image aRet; if( mpImplData ) { std::vector<ImageAryData *>::iterator aIter; for( aIter = mpImplData->maImages.begin(); - aIter != mpImplData->maImages.end(); aIter++) + aIter != mpImplData->maImages.end(); ++aIter) { if ((*aIter)->mnId == nId) { @@ -811,6 +757,14 @@ Image ImageList::GetImage( sal_uInt16 nId ) const } } + if (!aRet) + { + BitmapEx rBitmap; + bool res = ::vcl::ImageRepository::loadDefaultImage(rBitmap); + if (res) + aRet = Image(rBitmap); + } + return aRet; } @@ -818,9 +772,6 @@ Image ImageList::GetImage( sal_uInt16 nId ) const Image ImageList::GetImage( const ::rtl::OUString& rImageName ) const { -// fprintf (stderr, "GetImage '%s'\n", -// rtl::OUStringToOString( rImageName, RTL_TEXTENCODING_UTF8 ).getStr() ); - if( mpImplData ) { ImageAryData *pImg = mpImplData->maNameHash[ rImageName ]; @@ -832,7 +783,6 @@ Image ImageList::GetImage( const ::rtl::OUString& rImageName ) const return Image( pImg->maBitmapEx ); } } -// fprintf (stderr, "no such image\n"); return Image(); } @@ -981,9 +931,6 @@ Size ImageList::GetImageSize() const aRet = mpImplData->maImageSize = aTmp.GetSizePixel(); } } -// fprintf (stderr, "GetImageSize returns %d, %d\n", -// aRet.Width(), aRet.Height()); - return aRet; } @@ -1024,3 +971,5 @@ sal_Bool ImageList::operator==( const ImageList& rImageList ) const return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/imagerepository.cxx b/vcl/source/gdi/imagerepository.cxx index 0118acc13146..6fda85735b01 100644 --- a/vcl/source/gdi/imagerepository.cxx +++ b/vcl/source/gdi/imagerepository.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,6 @@ #include <vcl/bitmapex.hxx> #include <vcl/imagerepository.hxx> #include <vcl/svapp.hxx> - #include "impimagetree.hxx" //........................................................................ @@ -43,15 +43,23 @@ namespace vcl //= ImageRepository //==================================================================== //-------------------------------------------------------------------- - bool ImageRepository::loadImage( const ::rtl::OUString& _rName, BitmapEx& _out_rImage, bool _bSearchLanguageDependent ) + bool ImageRepository::loadImage( const ::rtl::OUString& _rName, BitmapEx& _out_rImage, bool _bSearchLanguageDependent, bool loadMissing ) { ::rtl::OUString sCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName(); ImplImageTreeSingletonRef aImplImageTree; - return aImplImageTree->loadImage( _rName, sCurrentSymbolsStyle, _out_rImage, _bSearchLanguageDependent ); + return aImplImageTree->loadImage( _rName, sCurrentSymbolsStyle, _out_rImage, _bSearchLanguageDependent, loadMissing ); + } + + bool ImageRepository::loadDefaultImage( BitmapEx& _out_rImage) + { + ::rtl::OUString sCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName(); + ImplImageTreeSingletonRef aImplImageTree; + return aImplImageTree->loadDefaultImage( sCurrentSymbolsStyle,_out_rImage); } //........................................................................ } // namespace vcl //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index aaaca451ebe3..59ee15fa558a 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -353,3 +354,5 @@ AInfo* ImplAnimView::ImplCreateAInfo() const return pAInfo; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impanmvw.hxx b/vcl/source/gdi/impanmvw.hxx index 69ae35fe1c6e..4e96ecbd9b64 100644 --- a/vcl/source/gdi/impanmvw.hxx +++ b/vcl/source/gdi/impanmvw.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,3 +95,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx index f8d71112d3a1..579515f67e9c 100644 --- a/vcl/source/gdi/impbmp.cxx +++ b/vcl/source/gdi/impbmp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -131,3 +132,5 @@ void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, sal_Bool bReadOnly ) if( !bReadOnly ) mnChecksum = 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 62b1976015ce..84e962bd2f6e 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,6 @@ #include <unotools/ucbstreamhelper.hxx> #include <unotools/tempfile.hxx> - #include <vcl/outdev.hxx> #include <vcl/virdev.hxx> #include <vcl/gfxlink.hxx> @@ -392,7 +392,7 @@ void ImpGraphic::ImplClear() ::ucbhelper::Content aCnt( mpSwapFile->aSwapURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), + aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); } catch( const ::com::sun::star::ucb::ContentCreationException& ) @@ -1127,7 +1127,7 @@ sal_Bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, sal_Bool bSwap ) ::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), + aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); } catch( const ::com::sun::star::ucb::ContentCreationException& ) @@ -1311,7 +1311,7 @@ sal_Bool ImpGraphic::ImplSwapOut() ::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), + aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); } catch( const ::com::sun::star::ucb::ContentCreationException& ) @@ -1413,7 +1413,7 @@ sal_Bool ImpGraphic::ImplSwapIn() ::ucbhelper::Content aCnt( aSwapURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), + aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); } catch( const ::com::sun::star::ucb::ContentCreationException& ) @@ -1732,3 +1732,5 @@ SvStream& operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic ) return rOStm; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx index 735f912f0782..2246058fb10f 100644 --- a/vcl/source/gdi/impimage.cxx +++ b/vcl/source/gdi/impimage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -348,15 +349,6 @@ void ImplImageBmp::ReplaceColors( const Color* pSrcColors, const Color* pDstColo // ----------------------------------------------------------------------- -void ImplImageBmp::ColorTransform( BmpColorMode eColorMode ) -{ - maBmpEx = maBmpEx.GetColorTransformedBitmapEx( eColorMode ); - delete mpDisplayBmp; - mpDisplayBmp = NULL; -} - -// ----------------------------------------------------------------------- - BitmapEx ImplImageBmp::GetBitmapEx( sal_uInt16 nPosCount, sal_uInt16* pPosAry ) const { const Bitmap aNewBmp( Size( nPosCount * maSize.Width(), maSize.Height() ), maBmpEx.GetBitmap().GetBitCount() ); @@ -406,7 +398,6 @@ void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev, else { if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM | - IMAGE_DRAW_MONOCHROME_BLACK | IMAGE_DRAW_MONOCHROME_WHITE | IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE | IMAGE_DRAW_SEMITRANSPARENT ) ) { BitmapEx aTmpBmpEx; @@ -419,14 +410,6 @@ void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev, aTmpBmpEx.Crop( aCropRect ); - if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM | IMAGE_DRAW_MONOCHROME_BLACK | IMAGE_DRAW_MONOCHROME_WHITE ) ) - { - const BmpColorMode eMode = ( nStyle & IMAGE_DRAW_COLORTRANSFORM ) ? BMP_COLOR_HIGHCONTRAST : - ( ( nStyle & IMAGE_DRAW_MONOCHROME_BLACK ) ? BMP_COLOR_MONOCHROME_BLACK : BMP_COLOR_MONOCHROME_WHITE ); - - aTmpBmpEx = aTmpBmpEx.GetColorTransformedBitmapEx( eMode ); - } - Bitmap aTmpBmp( aTmpBmpEx.GetBitmap() ); if( nStyle & ( IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE ) ) @@ -634,3 +617,5 @@ void ImplImageBmp::ImplUpdateDisabledBmpEx( int nPos ) maDisabledBmpEx = BitmapEx( aGrey, aGreyAlphaMask ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx index 19947679567c..b43611e34b04 100644 --- a/vcl/source/gdi/impimagetree.cxx +++ b/vcl/source/gdi/impimagetree.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ #include <memory> #include <utility> #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/io/XInputStream.hpp" @@ -91,8 +92,8 @@ std::auto_ptr< SvStream > wrapStream( OSL_ASSERT(stream.is()); std::auto_ptr< SvStream > s(new SvMemoryStream); for (;;) { - css::uno::Sequence< sal_Int8 > data; - sal_Int32 const size = 30000; + sal_Int32 const size = 2048; + css::uno::Sequence< sal_Int8 > data(size); sal_Int32 n = stream->readBytes(data, size); s->Write(data.getConstArray(), n); if (n < size) { @@ -144,7 +145,7 @@ bool ImplImageTree::checkStyle(rtl::OUString const & style) // skip brand-specific icon themes; they are incomplete and thus not useful for this check if (nFromIndex < 0 || !aZipURL.match(sBrandURLSuffix, nFromIndex)) { osl::File aZip(aZipURL); - if (aZip.open(OpenFlag_Read) == ::osl::FileBase::E_None) { + if (aZip.open(osl_File_OpenFlag_Read) == ::osl::FileBase::E_None) { aZip.close(); exists = true; } @@ -157,6 +158,41 @@ bool ImplImageTree::checkStyle(rtl::OUString const & style) bool ImplImageTree::loadImage( rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap, + bool localized, bool loadMissing ) +{ + bool found = false; + try { + found = doLoadImage(name, style, bitmap, localized); + } catch (css::uno::RuntimeException &) { + if (!loadMissing) + throw; + } + if (found || !loadMissing) + return found; + + try { + OSL_TRACE( + "ImplImageTree::loadImage exception couldn't load \"%s\", fetching missing_icon.png", + rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr()); + found = loadDefaultImage(style, bitmap); + } catch (css::uno::RuntimeException &) { + throw; + } + return found; +} + +bool ImplImageTree::loadDefaultImage( + rtl::OUString const & style, + BitmapEx& bitmap) +{ + return doLoadImage( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("res/grafikde.png")), + style, bitmap, false); +} + + +bool ImplImageTree::doLoadImage( + rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap, bool localized) { setStyle(style); @@ -279,7 +315,7 @@ void ImplImageTree::resetZips() { u.GetMainURL(INetURLObject::NO_DECODE), css::uno::Reference< css::container::XNameAccess >())); } - if ( m_style.equals(::rtl::OUString::createFromAscii("default")) ) + if ( m_style.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default"))) ) { rtl::OUString url( RTL_CONSTASCII_USTRINGPARAM( @@ -357,3 +393,5 @@ bool ImplImageTree::find( } return false; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index f405c3e4b602..21c0cbb0abd4 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,9 +37,7 @@ #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <vcl/virdev.hxx> -#ifndef _SV_VECTORIZ_HXX #include <impvect.hxx> -#endif // ----------- // - Defines - @@ -364,7 +363,7 @@ public: inline void ImplAdd( sal_uInt8 nCode ); void ImplEndAdd( sal_uLong nTypeFlag ); - const Polygon& ImplGetPoly() { return maPoly; } + const Polygon& ImplGetPoly() const { return maPoly; } }; // ----------------------------------------------------------------------------- @@ -1202,3 +1201,5 @@ sal_Bool ImplVectorizer::ImplIsUp( ImplVectMap* pMap, long nY, long nX ) const else return sal_False; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impvect.hxx b/vcl/source/gdi/impvect.hxx index 86fef6a04083..56591e969b8b 100644 --- a/vcl/source/gdi/impvect.hxx +++ b/vcl/source/gdi/impvect.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index b44a99b2789d..d06e16dcf0cb 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <tools/debug.hxx> #include <tools/stream.hxx> - #include <rtl/alloc.h> - #include <vcl/jobset.hxx> #include <jobset.h> @@ -215,7 +214,7 @@ String JobSetup::GetValue( const String& rKey ) const { if( mpData ) { - ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; + ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; it = mpData->maValueMap.find( rKey ); return it != mpData->maValueMap.end() ? String( it->second ) : String(); } @@ -298,8 +297,6 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ) { DBG_ASSERTWARNING( rIStream.GetVersion(), "JobSetup::>> - Solar-Version not set on rOStream" ); - // Zur Zeit haben wir noch kein neues FileFormat -// if ( rIStream.GetVersion() < JOBSET_FILEFORMAT2 ) { sal_Size nFirstPos = rIStream.Tell(); @@ -383,11 +380,6 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ) } delete[] pTempBuf; } -/* - else - { - } -*/ return rIStream; } @@ -433,7 +425,7 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup ) rOStream.Write( (char*)&aOldData, sizeof( aOldData ) ); rOStream.Write( (char*)&aOldJobData, nOldJobDataSize ); rOStream.Write( (char*)pJobData->mpDriverData, pJobData->mnDriverDataLen ); - ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; + ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; for( it = pJobData->maValueMap.begin(); it != pJobData->maValueMap.end(); ++it ) { rOStream.WriteByteString( it->first, RTL_TEXTENCODING_UTF8 ); @@ -461,3 +453,5 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup ) return rOStream; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx index ebd55a48f593..542c3103eb27 100644 --- a/vcl/source/gdi/lineinfo.cxx +++ b/vcl/source/gdi/lineinfo.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -367,3 +368,5 @@ void LineInfo::applyToB2DPolyPolygon( } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index ec664cf648a6..e124dc343eba 100755 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -43,81 +43,84 @@ CDEFS+=-D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE .ENDIF .IF "$(ENABLE_GRAPHITE)" == "TRUE" CDEFS+=-DENABLE_GRAPHITE +.IF "$(SYSTEM_GRAPHITE)" != "YES" +CDEFS+=-DGR2_STATIC +.ENDIF .ENDIF # --- Files -------------------------------------------------------- EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ - $(SLO)$/outdev.obj \ - $(SLO)$/outdev3.obj \ - $(SLO)$/outdevnative.obj \ - $(SLO)$/gfxlink.obj \ - $(SLO)$/print.obj \ - $(SLO)$/print2.obj \ - $(SLO)$/print3.obj \ - $(SLO)$/oldprintadaptor.obj \ - $(SLO)$/configsettings.obj \ - $(SLO)$/sallayout.obj \ - $(SLO)$/image.obj \ - $(SLO)$/impimage.obj \ - $(SLO)$/impgraph.obj \ - $(SLO)$/metric.obj \ - $(SLO)$/pdfwriter_impl.obj \ - $(SLO)$/pdfwriter_impl2.obj \ - $(SLO)$/pdffontcache.obj \ - $(SLO)$/bmpconv.obj \ - $(SLO)$/pdfextoutdevdata.obj \ - $(SLO)$/jobset.obj \ - $(SLO)$/impimagetree.obj \ - $(SLO)$/pngread.obj \ - $(SLO)$/pngwrite.obj \ - $(SLO)$/virdev.obj \ - $(SLO)$/gdimtf.obj \ - $(SLO)$/graphictools.obj \ - $(SLO)$/textlayout.obj \ - $(SLO)$/lineinfo.obj \ - $(SLO)$/svgread.obj \ - $(SLO)$/rendergraphic.obj \ - $(SLO)$/rendergraphicrasterizer.obj + $(SLO)$/animate.obj \ + $(SLO)$/base14.obj \ + $(SLO)$/bitmap.obj \ + $(SLO)$/bitmap2.obj \ + $(SLO)$/bitmapex.obj \ + $(SLO)$/bmpconv.obj \ + $(SLO)$/configsettings.obj \ + $(SLO)$/cvtgrf.obj \ + $(SLO)$/cvtsvm.obj \ + $(SLO)$/gdimtf.obj \ + $(SLO)$/gfxlink.obj \ + $(SLO)$/graph.obj \ + $(SLO)$/graphictools.obj \ + $(SLO)$/image.obj \ + $(SLO)$/imagerepository.obj \ + $(SLO)$/impanmvw.obj \ + $(SLO)$/impgraph.obj \ + $(SLO)$/impimage.obj \ + $(SLO)$/impimagetree.obj \ + $(SLO)$/impvect.obj \ + $(SLO)$/jobset.obj \ + $(SLO)$/lineinfo.obj \ + $(SLO)$/metaact.obj \ + $(SLO)$/metric.obj \ + $(SLO)$/oldprintadaptor.obj \ + $(SLO)$/outdev.obj \ + $(SLO)$/outdev2.obj \ + $(SLO)$/outdev3.obj \ + $(SLO)$/outdev4.obj \ + $(SLO)$/outdev5.obj \ + $(SLO)$/outdev6.obj \ + $(SLO)$/outdevnative.obj \ + $(SLO)$/outmap.obj \ + $(SLO)$/pdfextoutdevdata.obj \ + $(SLO)$/pdffontcache.obj\ + $(SLO)$/pdfwriter.obj \ + $(SLO)$/pdfwriter_impl.obj \ + $(SLO)$/pdfwriter_impl2.obj \ + $(SLO)$/pngread.obj \ + $(SLO)$/pngwrite.obj \ + $(SLO)$/print.obj \ + $(SLO)$/print2.obj \ + $(SLO)$/print3.obj \ + $(SLO)$/rendergraphic.obj \ + $(SLO)$/rendergraphicrasterizer.obj \ + $(SLO)$/salgdilayout.obj \ + $(SLO)$/sallayout.obj \ + $(SLO)$/salnativewidgets-none.obj \ + $(SLO)$/svgread.obj \ + $(SLO)$/textlayout.obj \ + $(SLO)$/virdev.obj \ + $(SLO)$/wall.obj SLOFILES= $(EXCEPTIONSFILES) \ - $(SLO)$/animate.obj \ - $(SLO)$/impanmvw.obj \ - $(SLO)$/bitmap.obj \ - $(SLO)$/bitmap2.obj \ $(SLO)$/bitmap3.obj \ $(SLO)$/bitmap4.obj \ $(SLO)$/alpha.obj \ - $(SLO)$/bitmapex.obj \ $(SLO)$/bmpacc.obj \ $(SLO)$/bmpacc2.obj \ $(SLO)$/bmpacc3.obj \ $(SLO)$/bmpfast.obj \ - $(SLO)$/cvtsvm.obj \ - $(SLO)$/cvtgrf.obj \ $(SLO)$/font.obj \ $(SLO)$/gradient.obj \ $(SLO)$/hatch.obj \ - $(SLO)$/graph.obj \ $(SLO)$/impbmp.obj \ - $(SLO)$/imagerepository.obj \ - $(SLO)$/impvect.obj \ $(SLO)$/mapmod.obj \ - $(SLO)$/metaact.obj \ $(SLO)$/octree.obj \ - $(SLO)$/outmap.obj \ - $(SLO)$/outdev2.obj \ - $(SLO)$/outdev4.obj \ - $(SLO)$/outdev5.obj \ - $(SLO)$/outdev6.obj \ $(SLO)$/regband.obj \ $(SLO)$/region.obj \ - $(SLO)$/wall.obj \ - $(SLO)$/base14.obj \ - $(SLO)$/pdfwriter.obj \ - $(SLO)$/salgdilayout.obj \ - $(SLO)$/extoutdevdata.obj \ - $(SLO)$/salnativewidgets-none.obj + $(SLO)$/extoutdevdata.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx index 5eff28d559a7..ae7b13ca25b7 100644 --- a/vcl/source/gdi/mapmod.cxx +++ b/vcl/source/gdi/mapmod.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -309,3 +310,5 @@ SvStream& operator<<( SvStream& rOStm, const MapMode& rMapMode ) { return (rOStm << *rMapMode.mpImplMapMode); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index ad0c9c9d5f95..2ffa3c68e4f7 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -4121,6 +4122,7 @@ void MetaCommentAction::Move( long nXMove, long nYMove ) // SJ: 25.07.06 #i56656# we are not able to mirrorcertain kind of // comments properly, especially the XPATHSTROKE and XPATHFILL lead to // problems, so it is better to remove these comments when mirroring +// FIXME: fake comment to apply the next hunk in the right location void MetaCommentAction::Scale( double fXScale, double fYScale ) { if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) ) @@ -4154,6 +4156,32 @@ void MetaCommentAction::Scale( double fXScale, double fYScale ) } delete[] mpData; ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() ); + } else if( maComment.Equals( "EMF_PLUS_HEADER_INFO" ) ) { + SvMemoryStream aMemStm( (void*)mpData, mnDataSize, STREAM_READ ); + SvMemoryStream aDest; + + sal_Int32 nLeft, nRight, nTop, nBottom; + sal_Int32 nPixX, nPixY, nMillX, nMillY; + float m11, m12, m21, m22, mdx, mdy; + + // read data + aMemStm >> nLeft >> nTop >> nRight >> nBottom; + aMemStm >> nPixX >> nPixY >> nMillX >> nMillY; + aMemStm >> m11 >> m12 >> m21 >> m22 >> mdx >> mdy; + + // add scale to the transformation + m11 *= fXScale; + m12 *= fXScale; + m22 *= fYScale; + m21 *= fYScale; + + // prepare new data + aDest << nLeft << nTop << nRight << nBottom; + aDest << nPixX << nPixY << nMillX << nMillY; + aDest << m11 << m12 << m21 << m22 << mdx << mdy; + + // save them + ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() ); } } } @@ -4380,3 +4408,5 @@ void MetaRenderGraphicAction::Read( SvStream& rIStm, ImplMetaReadData* ) COMPAT( rIStm ); rIStm >> maRenderGraphic >> maPoint >> maSize >> mfRotateAngle >> mfShearAngleX >> mfShearAngleY; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index b05ae27a8f5f..e8a8a2cb3a63 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -685,15 +686,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) sal_uInt32 cMaxChar = GetUInt( pGroup + 4 ); int nGlyphId = GetUInt( pGroup + 8 ); pGroup += 12; -#if 0 // TODO: remove unicode baseplane clipping for UCS-4 support - if( cMinChar > 0xFFFF ) - continue; - if( cMaxChar > 0xFFFF ) - cMaxChar = 0xFFFF; -#else if( cMinChar > cMaxChar ) // no sane font should trigger this break; -#endif *(pCP++) = cMinChar; *(pCP++) = cMaxChar + 1; pStartGlyphs[i] = nGlyphId; @@ -932,3 +926,4 @@ sal_uInt32 FontCharMap::GetCharFromIndex( int nIndex ) const // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx index be69d34bff7e..56c46f421695 100644 --- a/vcl/source/gdi/octree.cxx +++ b/vcl/source/gdi/octree.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -370,3 +371,5 @@ void InverseColorMap::ImplCreateBuffers( const sal_uLong nMax ) pBuffer = (sal_uInt8*) rtl_allocateMemory( nSize ); memset( pBuffer, 0xff, nSize ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx index ce3ece7e1e5b..4d87c06471ee 100644 --- a/vcl/source/gdi/oldprintadaptor.cxx +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -115,3 +116,4 @@ void OldStylePrintAdaptor::printPage( int i_nPage ) const } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index dcad34c363ad..6bbaec8e43f5 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1049,7 +1050,7 @@ void OutputDevice::ImplSetClipRegion( const Region* pRegion ) void OutputDevice::SetClipRegion() { - DBG_TRACE( "OutputDevice::SetClipRegion()" ); + OSL_TRACE( "OutputDevice::SetClipRegion()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1065,7 +1066,7 @@ void OutputDevice::SetClipRegion() void OutputDevice::SetClipRegion( const Region& rRegion ) { - DBG_TRACE( "OutputDevice::SetClipRegion( rRegion )" ); + OSL_TRACE( "OutputDevice::SetClipRegion( rRegion )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion ); @@ -1120,7 +1121,7 @@ Region OutputDevice::GetActiveClipRegion() const void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove ) { - DBG_TRACE( "OutputDevice::MoveClipRegion()" ); + OSL_TRACE( "OutputDevice::MoveClipRegion()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mbClipRegion ) @@ -1141,7 +1142,7 @@ void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove ) void OutputDevice::IntersectClipRegion( const Rectangle& rRect ) { - DBG_TRACE( "OutputDevice::IntersectClipRegion( rRect )" ); + OSL_TRACE( "OutputDevice::IntersectClipRegion( rRect )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1160,7 +1161,7 @@ void OutputDevice::IntersectClipRegion( const Rectangle& rRect ) void OutputDevice::IntersectClipRegion( const Region& rRegion ) { - DBG_TRACE( "OutputDevice::IntersectClipRegion( rRegion )" ); + OSL_TRACE( "OutputDevice::IntersectClipRegion( rRegion )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion ); @@ -1185,7 +1186,7 @@ void OutputDevice::IntersectClipRegion( const Region& rRegion ) void OutputDevice::SetDrawMode( sal_uLong nDrawMode ) { - DBG_TRACE1( "OutputDevice::SetDrawMode( %lx )", nDrawMode ); + OSL_TRACE( "OutputDevice::SetDrawMode( %lx )", nDrawMode ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); mnDrawMode = nDrawMode; @@ -1198,7 +1199,7 @@ void OutputDevice::SetDrawMode( sal_uLong nDrawMode ) void OutputDevice::SetRasterOp( RasterOp eRasterOp ) { - DBG_TRACE1( "OutputDevice::SetRasterOp( %d )", (int)eRasterOp ); + OSL_TRACE( "OutputDevice::SetRasterOp( %d )", (int)eRasterOp ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1221,7 +1222,7 @@ void OutputDevice::SetRasterOp( RasterOp eRasterOp ) void OutputDevice::SetLineColor() { - DBG_TRACE( "OutputDevice::SetLineColor()" ); + OSL_TRACE( "OutputDevice::SetLineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1242,7 +1243,7 @@ void OutputDevice::SetLineColor() void OutputDevice::SetLineColor( const Color& rColor ) { - DBG_TRACE1( "OutputDevice::SetLineColor( %lx )", rColor.GetColor() ); + OSL_TRACE( "OutputDevice::SetLineColor( %lx )", rColor.GetColor() ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -1310,7 +1311,7 @@ void OutputDevice::SetLineColor( const Color& rColor ) void OutputDevice::SetFillColor() { - DBG_TRACE( "OutputDevice::SetFillColor()" ); + OSL_TRACE( "OutputDevice::SetFillColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1331,7 +1332,7 @@ void OutputDevice::SetFillColor() void OutputDevice::SetFillColor( const Color& rColor ) { - DBG_TRACE1( "OutputDevice::SetFillColor( %lx )", rColor.GetColor() ); + OSL_TRACE( "OutputDevice::SetFillColor( %lx )", rColor.GetColor() ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -1403,7 +1404,7 @@ void OutputDevice::SetFillColor( const Color& rColor ) void OutputDevice::SetBackground() { - DBG_TRACE( "OutputDevice::SetBackground()" ); + OSL_TRACE( "OutputDevice::SetBackground()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); maBackground = Wallpaper(); @@ -1417,7 +1418,7 @@ void OutputDevice::SetBackground() void OutputDevice::SetBackground( const Wallpaper& rBackground ) { - DBG_TRACE( "OutputDevice::SetBackground( rBackground )" ); + OSL_TRACE( "OutputDevice::SetBackground( rBackground )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); maBackground = rBackground; @@ -1435,7 +1436,7 @@ void OutputDevice::SetBackground( const Wallpaper& rBackground ) void OutputDevice::SetRefPoint() { - DBG_TRACE( "OutputDevice::SetRefPoint()" ); + OSL_TRACE( "OutputDevice::SetRefPoint()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1452,7 +1453,7 @@ void OutputDevice::SetRefPoint() void OutputDevice::SetRefPoint( const Point& rRefPoint ) { - DBG_TRACE( "OutputDevice::SetRefPoint( rRefPoint )" ); + OSL_TRACE( "OutputDevice::SetRefPoint( rRefPoint )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1469,7 +1470,7 @@ void OutputDevice::SetRefPoint( const Point& rRefPoint ) void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt ) { - DBG_TRACE( "OutputDevice::DrawLine()" ); + OSL_TRACE( "OutputDevice::DrawLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1667,7 +1668,7 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand( void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, const LineInfo& rLineInfo ) { - DBG_TRACE( "OutputDevice::DrawLine()" ); + OSL_TRACE( "OutputDevice::DrawLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( rLineInfo.IsDefault() ) @@ -1721,7 +1722,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, void OutputDevice::DrawRect( const Rectangle& rRect ) { - DBG_TRACE( "OutputDevice::DrawRect()" ); + OSL_TRACE( "OutputDevice::DrawRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1762,7 +1763,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect ) void OutputDevice::DrawPolyLine( const Polygon& rPoly ) { - DBG_TRACE( "OutputDevice::DrawPolyLine()" ); + OSL_TRACE( "OutputDevice::DrawPolyLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rPoly, Polygon, NULL ); @@ -1840,7 +1841,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo ) { - DBG_TRACE( "OutputDevice::DrawPolyLine()" ); + OSL_TRACE( "OutputDevice::DrawPolyLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rPoly, Polygon, NULL ); @@ -1932,7 +1933,7 @@ void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineI void OutputDevice::DrawPolygon( const Polygon& rPoly ) { - DBG_TRACE( "OutputDevice::DrawPolygon()" ); + OSL_TRACE( "OutputDevice::DrawPolygon()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rPoly, Polygon, NULL ); @@ -2022,7 +2023,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly ) { - DBG_TRACE( "OutputDevice::DrawPolyPolygon()" ); + OSL_TRACE( "OutputDevice::DrawPolyPolygon()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rPolyPoly, PolyPolygon, NULL ); @@ -2133,20 +2134,12 @@ void OutputDevice::DrawPolygon( const ::basegfx::B2DPolygon& rB2DPolygon) void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly ) { - DBG_TRACE( "OutputDevice::DrawPolyPolygon(B2D&)" ); + OSL_TRACE( "OutputDevice::DrawPolyPolygon(B2D&)" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); -#if 0 - // MetaB2DPolyPolygonAction is not implemented yet: - // according to AW adding it is very dangerous since there is a lot - // of code that uses the metafile actions directly and unless every - // place that does this knows about the new action we need to fallback - if( mpMetaFile ) - mpMetaFile->AddAction( new MetaB2DPolyPolygonAction( rB2DPolyPoly ) ); -#else + if( mpMetaFile ) mpMetaFile->AddAction( new MetaPolyPolygonAction( PolyPolygon( rB2DPolyPoly ) ) ); -#endif // call helper ImpDrawPolyPolygonWithB2DPolyPolygon(rB2DPolyPoly); @@ -2257,17 +2250,10 @@ void OutputDevice::DrawPolyLine( double fLineWidth, basegfx::B2DLineJoin eLineJoin) { - DBG_TRACE( "OutputDevice::DrawPolyLine(B2D&)" ); + OSL_TRACE( "OutputDevice::DrawPolyLine(B2D&)" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); (void)eLineJoin; // ATM used in UNX, but not in WNT, access it for warning-free -#if 0 // MetaB2DPolyLineAction is not implemented yet: - // according to AW adding it is very dangerous since there is a lot - // of code that uses the metafile actions directly and unless every - // place that does this knows about the new action we need to fallback - if( mpMetaFile ) - mpMetaFile->AddAction( new MetaB2DPolyLineAction( rB2DPolygon ) ); -#else if( mpMetaFile ) { LineInfo aLineInfo; @@ -2276,7 +2262,7 @@ void OutputDevice::DrawPolyLine( const Polygon aToolsPolygon( rB2DPolygon ); mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) ); } -#endif + // AW: Do NOT paint empty PolyPolygons if(!rB2DPolygon.count()) @@ -2377,7 +2363,7 @@ sal_uInt32 OutputDevice::GetGCStackDepth() const void OutputDevice::Push( sal_uInt16 nFlags ) { - DBG_TRACE( "OutputDevice::Push()" ); + OSL_TRACE( "OutputDevice::Push()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -2466,7 +2452,7 @@ void OutputDevice::Push( sal_uInt16 nFlags ) void OutputDevice::Pop() { - DBG_TRACE( "OutputDevice::Pop()" ); + OSL_TRACE( "OutputDevice::Pop()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mpMetaFile ) @@ -2707,3 +2693,5 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx index 46b0d81c348d..d1a76a9f085b 100755..100644 --- a/vcl/source/gdi/outdev2.cxx +++ b/vcl/source/gdi/outdev2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -243,7 +244,7 @@ void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, void* pVoi void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPt, const Size& rSrcSize ) { - DBG_TRACE( "OutputDevice::DrawOutDev()" ); + OSL_TRACE( "OutputDevice::DrawOutDev()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); @@ -317,7 +318,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPt, const Size& rSrcSize, const OutputDevice& rOutDev ) { - DBG_TRACE( "OutputDevice::DrawOutDev()" ); + OSL_TRACE( "OutputDevice::DrawOutDev()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rOutDev, OutputDevice, ImplDbgCheckOutputDevice ); DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); @@ -390,7 +391,7 @@ void OutputDevice::CopyArea( const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize, sal_uInt16 nFlags ) { - DBG_TRACE( "OutputDevice::CopyArea()" ); + OSL_TRACE( "OutputDevice::CopyArea()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::CopyArea(...) with printer devices!" ); @@ -520,7 +521,7 @@ void OutputDevice::ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap ) { - DBG_TRACE( "OutputDevice::DrawBitmap()" ); + OSL_TRACE( "OutputDevice::DrawBitmap()" ); if( ImplIsRecordLayout() ) return; @@ -539,7 +540,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap ) void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap ) { - DBG_TRACE( "OutputDevice::DrawBitmap( Size )" ); + OSL_TRACE( "OutputDevice::DrawBitmap( Size )" ); if( ImplIsRecordLayout() ) return; @@ -559,7 +560,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const Bitmap& rBitmap ) { - DBG_TRACE( "OutputDevice::DrawBitmap( Point, Size )" ); + OSL_TRACE( "OutputDevice::DrawBitmap( Point, Size )" ); if( ImplIsRecordLayout() ) return; @@ -737,7 +738,7 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize, void OutputDevice::DrawBitmapEx( const Point& rDestPt, const BitmapEx& rBitmapEx ) { - DBG_TRACE( "OutputDevice::DrawBitmapEx()" ); + OSL_TRACE( "OutputDevice::DrawBitmapEx()" ); if( ImplIsRecordLayout() ) return; @@ -756,7 +757,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const BitmapEx& rBitmapEx ) { - DBG_TRACE( "OutputDevice::DrawBitmapEx( Size )" ); + OSL_TRACE( "OutputDevice::DrawBitmapEx( Size )" ); if( ImplIsRecordLayout() ) return; @@ -773,7 +774,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const BitmapEx& rBitmapEx ) { - DBG_TRACE( "OutputDevice::DrawBitmapEx( Point, Size )" ); + OSL_TRACE( "OutputDevice::DrawBitmapEx( Point, Size )" ); if( ImplIsRecordLayout() ) return; @@ -1008,7 +1009,7 @@ void OutputDevice::ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize void OutputDevice::DrawMask( const Point& rDestPt, const Bitmap& rBitmap, const Color& rMaskColor ) { - DBG_TRACE( "OutputDevice::DrawMask()" ); + OSL_TRACE( "OutputDevice::DrawMask()" ); if( ImplIsRecordLayout() ) return; @@ -1036,7 +1037,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap, const Color& rMaskColor ) { - DBG_TRACE( "OutputDevice::DrawMask( Size )" ); + OSL_TRACE( "OutputDevice::DrawMask( Size )" ); if( ImplIsRecordLayout() ) return; @@ -1065,7 +1066,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const Bitmap& rBitmap, const Color& rMaskColor ) { - DBG_TRACE( "OutputDevice::DrawMask( Point, Size )" ); + OSL_TRACE( "OutputDevice::DrawMask( Point, Size )" ); if( ImplIsRecordLayout() ) return; @@ -1446,7 +1447,7 @@ Color* OutputDevice::GetPixel( const Polygon& rPts ) const void OutputDevice::DrawPixel( const Point& rPt ) { - DBG_TRACE( "OutputDevice::DrawPixel()" ); + OSL_TRACE( "OutputDevice::DrawPixel()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1482,7 +1483,7 @@ void OutputDevice::DrawPixel( const Point& rPt ) void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor ) { - DBG_TRACE( "OutputDevice::DrawPixel()" ); + OSL_TRACE( "OutputDevice::DrawPixel()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -1554,7 +1555,7 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors ) DrawPixel( rPts, GetLineColor() ); else { - DBG_TRACE( "OutputDevice::DrawPixel()" ); + OSL_TRACE( "OutputDevice::DrawPixel()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_ASSERT( pColors, "OutputDevice::DrawPixel: No color array specified" ); @@ -2267,3 +2268,5 @@ void OutputDevice::ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor, mpMetaFile = pOldMetaFile; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 1681e1eeec7c..f5b493b7db4f 100755 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -507,7 +508,7 @@ static void ImplFontSubstitute( String& rFontName, Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, sal_uLong nFlags, const OutputDevice* pOutDev ) { - DBG_TRACE( "OutputDevice::GetDefaultFont()" ); + OSL_TRACE( "OutputDevice::GetDefaultFont()" ); com::sun::star::lang::Locale aLocale; if( eLang == LANGUAGE_NONE || eLang == LANGUAGE_SYSTEM || eLang == LANGUAGE_DONTKNOW ) @@ -615,10 +616,10 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, // No Name, than set all names if ( !aFont.GetName().Len() ) { - xub_StrLen nIndex = 0; if ( nFlags & DEFAULTFONT_FLAGS_ONLYONE ) { - //aFont.SetName( aSearch.GetToken( 0, ';', nIndex ) ); + xub_StrLen nIndex = 0; + if( !pOutDev ) pOutDev = (const OutputDevice *)ImplGetSVData()->mpDefaultWin; if( !pOutDev ) @@ -1004,8 +1005,8 @@ ImplFontEntry::~ImplFontEntry() size_t ImplFontEntry::GFBCacheKey_Hash::operator()( const GFBCacheKey& rData ) const { - std::hash<sal_UCS4> a; - std::hash<int > b; + boost::hash<sal_UCS4> a; + boost::hash<int > b; return a(rData.first) ^ b(rData.second); } @@ -1402,16 +1403,6 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const } #endif -#if defined(HDU_DEBUG) - for( int i = 0; i < nMaxLevel; ++i ) - { - ImplDevFontListData* pFont = pFallbackList[ i ]; - ByteString aFontName( pFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ); - fprintf( stderr, "GlyphFallbackFont[%d] (quality=%05d): \"%s\"\n", - i, pFont->GetMinQuality(), aFontName.GetBuffer() ); - } -#endif - mnFallbackCount = nMaxLevel; mpFallbackList = pFallbackList; } @@ -1514,7 +1505,8 @@ void ImplDevFontList::Add( ImplFontData* pNewData ) pNewData->maMapNames = String(); bool bKeepNewData = false; - for( xub_StrLen nMapNameIndex = 0; nMapNameIndex != STRING_NOTFOUND; ) + xub_StrLen nMapNameIndex = 0; + while( true ) { String aSearchName = pNewData->maName; GetEnglishSearchFontName( aSearchName ); @@ -1532,7 +1524,7 @@ void ImplDevFontList::Add( ImplFontData* pNewData ) bKeepNewData = pFoundData->AddFontFace( pNewData ); - // add font alias if available + // add (another) font alias if available // a font alias should never win against an original font with similar quality if( aMapNames.Len() <= nMapNameIndex ) break; @@ -2757,8 +2749,20 @@ ImplFontEntry* ImplFontCache::GetGlyphFallbackFont( ImplDevFontList* pFontList, // e.g. PsPrint Arial->Helvetica for udiaeresis when Helvetica doesn't support it if( nFallbackLevel >= 1) { - ImplDevFontListData* pFallbackData = pFontList->GetGlyphFallbackFont( - rFontSelData, rMissingCodes, nFallbackLevel-1 ); + ImplDevFontListData* pFallbackData = NULL; + + //fdo#33898 If someone has EUDC installed then they really want that to + //be used as the first-choice glyph fallback seeing as it's filled with + //private area codes with don't make any sense in any other font so + //prioritise it here if it's available. Ideally we would remove from + //rMissingCodes all the glyphs which it is able to resolve as an + //optimization, but that's tricky to achieve cross-platform without + //sufficient heavy-weight code that's likely to undo the value of the + //optimization + if (nFallbackLevel == 1) + pFallbackData = pFontList->FindFontFamily(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EUDC"))); + if (!pFallbackData) + pFallbackData = pFontList->GetGlyphFallbackFont(rFontSelData, rMissingCodes, nFallbackLevel-1); // escape when there are no font candidates if( !pFallbackData ) return NULL; @@ -3552,12 +3556,8 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, { long nCurX = nStartX; long nCurY = nStartY; - long nDiffX = 2; long nDiffY = nHeight-1; long nCount = nWidth; - long nOffY = -1; - long nFreq; - long i; long nPixWidth; long nPixHeight; sal_Bool bDrawPixAsRect; @@ -3597,8 +3597,11 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, } else { + long nDiffX = 2; + long nOffY = -1; + long i; nCurY += nDiffY; - nFreq = nCount / (nDiffX+nDiffY); + long nFreq = nCount / (nDiffX+nDiffY); while ( nFreq-- ) { for( i = nDiffY; i; --i ) @@ -4010,6 +4013,11 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, FontStrikeout eStrikeout, Color aColor ) { + //See qadevOOo/testdocs/StrikeThrough.odt for examples if you need + //to tweak this + if (!nWidth) + return; + // PDF-export does its own strikeout drawing... why again? if( mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) return; @@ -4022,35 +4030,23 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, cStrikeoutChar = 'X'; static const int nTestStrLen = 4; static const int nMaxStrikeStrLen = 2048; - xub_Unicode aChars[ nMaxStrikeStrLen +1]; // +1 for valgrind... + xub_Unicode aChars[nMaxStrikeStrLen+1]; // +1 for valgrind... for( int i = 0; i < nTestStrLen; ++i) aChars[i] = cStrikeoutChar; const String aStrikeoutTest( aChars, nTestStrLen ); // calculate approximation of strikeout atom size - long nStrikeoutWidth = nWidth; + long nStrikeoutWidth = 0; SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen ); if( pLayout ) { - nStrikeoutWidth = (pLayout->GetTextWidth() +nTestStrLen/2) / (nTestStrLen * pLayout->GetUnitsPerPixel()); + nStrikeoutWidth = pLayout->GetTextWidth() / (nTestStrLen * pLayout->GetUnitsPerPixel()); pLayout->Release(); } if( nStrikeoutWidth <= 0 ) // sanity check return; - // calculate acceptable strikeout length - // allow the strikeout to be one pixel larger than the text it strikes out - long nMaxWidth = nStrikeoutWidth * 3 / 4; - if ( nMaxWidth < 2 ) - nMaxWidth = 2; - nMaxWidth += nWidth + 1; - - int nStrikeStrLen = (nMaxWidth - 1) / nStrikeoutWidth; - // if the text width is smaller than the strikeout text, then do not - // strike out at all. This case requires user interaction, e.g. adding - // a space to the text - if( nStrikeStrLen <= 0 ) - return; + int nStrikeStrLen = (nWidth+(nStrikeoutWidth-1)) / nStrikeoutWidth; if( nStrikeStrLen > nMaxStrikeStrLen ) nStrikeStrLen = nMaxStrikeStrLen; @@ -4079,8 +4075,29 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, ImplInitTextColor(); pLayout->DrawBase() = Point( nBaseX+mnTextOffX, nBaseY+mnTextOffY ); + + Rectangle aPixelRect; + aPixelRect.nLeft = nBaseX+mnTextOffX; + aPixelRect.nRight = aPixelRect.nLeft+nWidth; + aPixelRect.nBottom = nBaseY+mpFontEntry->maMetric.mnDescent; + aPixelRect.nTop = nBaseY-mpFontEntry->maMetric.mnAscent; + + if (mpFontEntry->mnOrientation) + { + Polygon aPoly( aPixelRect ); + aPoly.Rotate( Point(nBaseX+mnTextOffX, nBaseY+mnTextOffY), mpFontEntry->mnOrientation); + aPixelRect = aPoly.GetBoundRect(); + } + + Push( PUSH_CLIPREGION ); + IntersectClipRegion( PixelToLogic(aPixelRect) ); + if( mbInitClipRegion ) + ImplInitClipRegion(); + pLayout->DrawText( *mpGraphics ); + pLayout->Release(); + Pop(); SetTextColor( aOldColor ); ImplInitTextColor(); @@ -4440,7 +4457,6 @@ void OutputDevice::ImplDrawEmphasisMark( long nBaseX, long nX, long nY, void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout ) { - Color aOldColor = GetTextColor(); Color aOldLineColor = GetLineColor(); Color aOldFillColor = GetFillColor(); sal_Bool bOldMap = mbMap; @@ -4856,8 +4872,6 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, // auf mehr als Zwei Zeilen gebrochen wird... if ( xHyph.is() ) { - sal_Unicode cAlternateReplChar = 0; - sal_Unicode cAlternateExtraChar = 0; i18n::Boundary aBoundary = xBI->getWordBoundary( aText, nBreakPos, rDefLocale, ::com::sun::star::i18n::WordType::DICTIONARY_WORD, sal_True ); // sal_uInt16 nWordStart = nBreakPos; // sal_uInt16 nBreakPos_OLD = nBreakPos; @@ -4929,10 +4943,10 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, DBG_ASSERT( ( nAltEnd - nAltStart ) == 1, "Alternate: Falsche Annahme!" ); + sal_Unicode cAlternateReplChar = 0; + if ( nTxtEnd > nTxtStart ) cAlternateReplChar = aAlt.GetChar( nAltStart ); - else - cAlternateExtraChar = aAlt.GetChar( nAltStart ); nBreakPos = nWordStart + nTxtStart; if ( cAlternateReplChar ) @@ -5025,7 +5039,7 @@ void OutputDevice::SetAntialiasing( sal_uInt16 nMode ) void OutputDevice::SetFont( const Font& rNewFont ) { - DBG_TRACE( "OutputDevice::SetFont()" ); + OSL_TRACE( "OutputDevice::SetFont()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rNewFont, Font, NULL ); @@ -5100,12 +5114,6 @@ void OutputDevice::SetFont( const Font& rNewFont ) mpMetaFile->AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) ); } -#if (OSL_DEBUG_LEVEL > 2) || defined (HDU_DEBUG) - fprintf( stderr, " OutputDevice::SetFont( name=\"%s\", h=%ld)\n", - OUStringToOString( aFont.GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), - aFont.GetSize().Height() ); -#endif - if ( !maFont.IsSameInstance( aFont ) ) { // Optimization MT/HDU: COL_TRANSPARENT means SetFont should ignore the font color, @@ -5143,7 +5151,7 @@ void OutputDevice::SetFont( const Font& rNewFont ) void OutputDevice::SetLayoutMode( sal_uLong nTextLayoutMode ) { - DBG_TRACE( "OutputDevice::SetTextLayoutMode()" ); + OSL_TRACE( "OutputDevice::SetTextLayoutMode()" ); if( mpMetaFile ) mpMetaFile->AddAction( new MetaLayoutModeAction( nTextLayoutMode ) ); @@ -5158,7 +5166,7 @@ void OutputDevice::SetLayoutMode( sal_uLong nTextLayoutMode ) void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage ) { - DBG_TRACE( "OutputDevice::SetTextLanguage()" ); + OSL_TRACE( "OutputDevice::SetTextLanguage()" ); if( mpMetaFile ) mpMetaFile->AddAction( new MetaTextLanguageAction( eTextLanguage ) ); @@ -5173,7 +5181,7 @@ void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage ) void OutputDevice::SetTextColor( const Color& rColor ) { - DBG_TRACE( "OutputDevice::SetTextColor()" ); + OSL_TRACE( "OutputDevice::SetTextColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -5219,7 +5227,7 @@ void OutputDevice::SetTextColor( const Color& rColor ) void OutputDevice::SetTextFillColor() { - DBG_TRACE( "OutputDevice::SetTextFillColor()" ); + OSL_TRACE( "OutputDevice::SetTextFillColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5238,7 +5246,7 @@ void OutputDevice::SetTextFillColor() void OutputDevice::SetTextFillColor( const Color& rColor ) { - DBG_TRACE( "OutputDevice::SetTextFillColor()" ); + OSL_TRACE( "OutputDevice::SetTextFillColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -5302,7 +5310,7 @@ Color OutputDevice::GetTextFillColor() const void OutputDevice::SetTextLineColor() { - DBG_TRACE( "OutputDevice::SetTextLineColor()" ); + OSL_TRACE( "OutputDevice::SetTextLineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5318,7 +5326,7 @@ void OutputDevice::SetTextLineColor() void OutputDevice::SetTextLineColor( const Color& rColor ) { - DBG_TRACE( "OutputDevice::SetTextLineColor()" ); + OSL_TRACE( "OutputDevice::SetTextLineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -5361,7 +5369,7 @@ void OutputDevice::SetTextLineColor( const Color& rColor ) void OutputDevice::SetOverlineColor() { - DBG_TRACE( "OutputDevice::SetOverlineColor()" ); + OSL_TRACE( "OutputDevice::SetOverlineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5377,7 +5385,7 @@ void OutputDevice::SetOverlineColor() void OutputDevice::SetOverlineColor( const Color& rColor ) { - DBG_TRACE( "OutputDevice::SetOverlineColor()" ); + OSL_TRACE( "OutputDevice::SetOverlineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -5421,7 +5429,7 @@ void OutputDevice::SetOverlineColor( const Color& rColor ) void OutputDevice::SetTextAlign( TextAlign eAlign ) { - DBG_TRACE( "OutputDevice::SetTextAlign()" ); + OSL_TRACE( "OutputDevice::SetTextAlign()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5445,7 +5453,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth, FontUnderline eOverline, sal_Bool bUnderlineAbove ) { - DBG_TRACE( "OutputDevice::DrawTextLine()" ); + OSL_TRACE( "OutputDevice::DrawTextLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5496,7 +5504,7 @@ sal_Bool OutputDevice::IsTextUnderlineAbove( const Font& rFont ) void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos, sal_uInt16 nStyle ) { - DBG_TRACE( "OutputDevice::DrawWaveLine()" ); + OSL_TRACE( "OutputDevice::DrawWaveLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) @@ -5575,7 +5583,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const String& rStr, pDisplayText = &mpOutDevData->mpRecordLayout->m_aDisplayText; } - DBG_TRACE( "OutputDevice::DrawText()" ); + OSL_TRACE( "OutputDevice::DrawText()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); #if OSL_DEBUG_LEVEL > 2 @@ -5651,7 +5659,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const String& rStr, long OutputDevice::GetTextWidth( const String& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const { - DBG_TRACE( "OutputDevice::GetTextWidth()" ); + OSL_TRACE( "OutputDevice::GetTextWidth()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); long nWidth = GetTextArray( rStr, NULL, nIndex, nLen ); @@ -5662,7 +5670,7 @@ long OutputDevice::GetTextWidth( const String& rStr, long OutputDevice::GetTextHeight() const { - DBG_TRACE( "OutputDevice::GetTextHeight()" ); + OSL_TRACE( "OutputDevice::GetTextHeight()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mbNewFont ) @@ -5686,7 +5694,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr, const sal_Int32* pDXAry, xub_StrLen nIndex, xub_StrLen nLen ) { - DBG_TRACE( "OutputDevice::DrawTextArray()" ); + OSL_TRACE( "OutputDevice::DrawTextArray()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5717,7 +5725,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr, long OutputDevice::GetTextArray( const String& rStr, sal_Int32* pDXAry, xub_StrLen nIndex, xub_StrLen nLen ) const { - DBG_TRACE( "OutputDevice::GetTextArray()" ); + OSL_TRACE( "OutputDevice::GetTextArray()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( nIndex >= rStr.Len() ) @@ -5766,7 +5774,7 @@ bool OutputDevice::GetCaretPositions( const XubString& rStr, sal_Int32* pCaretXA sal_Int32* pDXAry, long nLayoutWidth, sal_Bool bCellBreaking ) const { - DBG_TRACE( "OutputDevice::GetCaretPositions()" ); + OSL_TRACE( "OutputDevice::GetCaretPositions()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( nIndex >= rStr.Len() ) @@ -5834,7 +5842,7 @@ void OutputDevice::DrawStretchText( const Point& rStartPt, sal_uLong nWidth, const String& rStr, xub_StrLen nIndex, xub_StrLen nLen ) { - DBG_TRACE( "OutputDevice::DrawStretchText()" ); + OSL_TRACE( "OutputDevice::DrawStretchText()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -6087,6 +6095,58 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr, return pSalLayout; } +void OutputDevice::forceFallbackFontToFit(SalLayout &rFallback, ImplFontEntry &rFallbackFont, + ImplFontSelectData &rFontSelData, int nFallbackLevel, + ImplLayoutArgs& rLayoutArgs, const ImplFontMetricData& rOrigMetric) const +{ + Rectangle aBoundRect; + bool bHaveBounding = false; + Rectangle aRectangle; + + rFallback.AdjustLayout( rLayoutArgs ); + + //All we care about here is getting the vertical bounds of this text and + //make sure it will fit inside the available space + Point aPos; + for( int nStart = 0;;) + { + sal_GlyphId nLGlyph; + if( !rFallback.GetNextGlyphs( 1, &nLGlyph, aPos, nStart ) ) + break; + + int nFontTag = nFallbackLevel << GF_FONTSHIFT; + nLGlyph |= nFontTag; + + // get bounding rectangle of individual glyph + if( mpGraphics->GetGlyphBoundRect( nLGlyph, aRectangle ) ) + { + // merge rectangle + aRectangle += aPos; + aBoundRect.Union( aRectangle ); + bHaveBounding = true; + } + } + + //Shrink it down if it won't fit + if (bHaveBounding) + { + long nGlyphsAscent = -aBoundRect.Top(); + float fScaleTop = nGlyphsAscent > rOrigMetric.mnAscent ? + rOrigMetric.mnAscent/(float)nGlyphsAscent : 1; + long nGlyphsDescent = aBoundRect.Bottom(); + float fScaleBottom = nGlyphsDescent > rOrigMetric.mnDescent ? + rOrigMetric.mnDescent/(float)nGlyphsDescent : 1; + float fScale = fScaleBottom < fScaleTop ? fScaleBottom : fScaleTop; + if (fScale < 1) + { + long nOrigHeight = rFontSelData.mnHeight; + rFontSelData.mnHeight *= fScale; + rFallbackFont.mnSetFontFlags = mpGraphics->SetFont( &rFontSelData, nFallbackLevel ); + rFontSelData.mnHeight = nOrigHeight; + } + } +} + // ----------------------------------------------------------------------- SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLayoutArgs& rLayoutArgs ) const @@ -6097,17 +6157,6 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay rLayoutArgs.PrepareFallback(); rLayoutArgs.mnFlags |= SAL_LAYOUT_FOR_FALLBACK; -#if defined(HDU_DEBUG) - { - int nCharPos = -1; - bool bRTL = false; - fprintf(stderr,"OD:ImplLayout Glyph Fallback for"); - for( int i=0; i<8 && rLayoutArgs.GetNextPos( &nCharPos, &bRTL); ++i ) - fprintf(stderr," U+%04X", rLayoutArgs.mpStr[ nCharPos ] ); - fprintf(stderr,"\n"); - rLayoutArgs.ResetPos(); - } -#endif // get list of unicodes that need glyph fallback int nCharPos = -1; bool bRTL = false; @@ -6156,38 +6205,7 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay } } -#if defined(HDU_DEBUG) - { - ByteString aOrigFontName( maFont.GetName(), RTL_TEXTENCODING_UTF8); - ByteString aFallbackName( aFontSelData.mpFontData->GetFamilyName(), - RTL_TEXTENCODING_UTF8); - fprintf(stderr,"\tGlyphFallback[lvl=%d] \"%s\" -> \"%s\" (q=%d)\n", - nFallbackLevel, aOrigFontName.GetBuffer(), aFallbackName.GetBuffer(), - aFontSelData.mpFontData->GetQuality()); - } -#endif - - // TODO: try to get the metric data from the GFB's mpFontEntry - ImplFontMetricData aSubstituteMetric( aFontSelData ); pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel ); - mpGraphics->GetFontMetric( &aSubstituteMetric, nFallbackLevel ); - - const long nOriginalHeight = aOrigMetric.mnAscent + aOrigMetric.mnDescent; - const long nSubstituteHeight = aSubstituteMetric.mnAscent + aSubstituteMetric.mnDescent; - // Too tall, shrink it a bit. Need a better calculation to include extra - // factors and any extra wriggle room we might have available? - // TODO: should we scale by max-ascent/max-descent instead of design height? - if( nSubstituteHeight > nOriginalHeight ) - { - const float fScale = nOriginalHeight / (float)nSubstituteHeight; - const float fOrigHeight = aFontSelData.mfExactHeight; - const int nOrigHeight = aFontSelData.mnHeight; - aFontSelData.mfExactHeight *= fScale; - aFontSelData.mnHeight = static_cast<int>(aFontSelData.mfExactHeight); - pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel ); - aFontSelData.mnHeight = nOrigHeight; - aFontSelData.mfExactHeight = fOrigHeight; - } // create and add glyph fallback layout to multilayout rLayoutArgs.ResetPos(); @@ -6196,6 +6214,9 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay { if( pFallback->LayoutText( rLayoutArgs ) ) { + forceFallbackFontToFit(*pFallback, *pFallbackFont, aFontSelData, + nFallbackLevel, rLayoutArgs, aOrigMetric); + if( !pMultiSalLayout ) pMultiSalLayout = new MultiSalLayout( *pSalLayout ); pMultiSalLayout->AddFallback( *pFallback, @@ -6247,7 +6268,7 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, xub_StrLen nIndex, xub_StrLen nLen, long nCharExtra, sal_Bool /*TODO: bCellBreaking*/ ) const { - DBG_TRACE( "OutputDevice::GetTextBreak()" ); + OSL_TRACE( "OutputDevice::GetTextBreak()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen ); @@ -6283,7 +6304,7 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, xub_StrLen nIndex, xub_StrLen nLen, long nCharExtra ) const { - DBG_TRACE( "OutputDevice::GetTextBreak()" ); + OSL_TRACE( "OutputDevice::GetTextBreak()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); rHyphenatorPos = STRING_LEN; @@ -6617,7 +6638,7 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, sal_uInt16 nStyle, GDIMetaFile& rMtf ) { - DBG_TRACE( "OutputDevice::AddTextRectActions( const Rectangle& )" ); + OSL_TRACE( "OutputDevice::AddTextRectActions( const Rectangle& )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( !rOrigStr.Len() || rRect.IsEmpty() ) @@ -6659,7 +6680,7 @@ void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, sal pDisplayText = &mpOutDevData->mpRecordLayout->m_aDisplayText; } - DBG_TRACE( "OutputDevice::DrawText( const Rectangle& )" ); + OSL_TRACE( "OutputDevice::DrawText( const Rectangle& )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); bool bDecomposeTextRectAction = ( _pTextLayout != NULL ) && _pTextLayout->DecomposeTextRectAction(); @@ -6702,7 +6723,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, TextRectInfo* pInfo, const ::vcl::ITextLayout* _pTextLayout ) const { - DBG_TRACE( "OutputDevice::GetTextRect()" ); + OSL_TRACE( "OutputDevice::GetTextRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Rectangle aRect = rRect; @@ -6841,7 +6862,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rOrigStr, long nMaxWidth, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout ) { - DBG_TRACE( "OutputDevice::ImplGetEllipsisString()" ); + OSL_TRACE( "OutputDevice::ImplGetEllipsisString()" ); String aStr = rOrigStr; xub_StrLen nIndex = _rLayout.GetTextBreak( aStr, nMaxWidth, 0, aStr.Len() ); @@ -6974,7 +6995,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen, sal_uInt16 nStyle, MetricVector* pVector, String* pDisplayText ) { - DBG_TRACE( "OutputDevice::DrawCtrlText()" ); + OSL_TRACE( "OutputDevice::DrawCtrlText()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( !IsDeviceOutputNecessary() || (nIndex >= rStr.Len()) ) @@ -7107,7 +7128,7 @@ long OutputDevice::GetCtrlTextWidth( const String& rStr, xub_StrLen nIndex, xub_StrLen nLen, sal_uInt16 nStyle ) const { - DBG_TRACE( "OutputDevice::GetCtrlTextSize()" ); + OSL_TRACE( "OutputDevice::GetCtrlTextSize()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( nStyle & TEXT_DRAW_MNEMONIC ) @@ -7166,7 +7187,7 @@ String OutputDevice::GetNonMnemonicString( const String& rStr, xub_StrLen& rMnem int OutputDevice::GetDevFontCount() const { - DBG_TRACE( "OutputDevice::GetDevFontCount()" ); + OSL_TRACE( "OutputDevice::GetDevFontCount()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( !mpGetDevFontList ) @@ -7178,7 +7199,7 @@ int OutputDevice::GetDevFontCount() const FontInfo OutputDevice::GetDevFont( int nDevFontIndex ) const { - DBG_TRACE( "OutputDevice::GetDevFont()" ); + OSL_TRACE( "OutputDevice::GetDevFont()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); FontInfo aFontInfo; @@ -7210,7 +7231,7 @@ FontInfo OutputDevice::GetDevFont( int nDevFontIndex ) const sal_Bool OutputDevice::AddTempDevFont( const String& rFileURL, const String& rFontName ) { - DBG_TRACE( "OutputDevice::AddTempDevFont()" ); + OSL_TRACE( "OutputDevice::AddTempDevFont()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); ImplInitFontList(); @@ -7233,7 +7254,7 @@ sal_Bool OutputDevice::AddTempDevFont( const String& rFileURL, const String& rFo int OutputDevice::GetDevFontSizeCount( const Font& rFont ) const { - DBG_TRACE( "OutputDevice::GetDevFontSizeCount()" ); + OSL_TRACE( "OutputDevice::GetDevFontSizeCount()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); delete mpGetDevSizeList; @@ -7247,7 +7268,7 @@ int OutputDevice::GetDevFontSizeCount( const Font& rFont ) const Size OutputDevice::GetDevFontSize( const Font& rFont, int nSizeIndex ) const { - DBG_TRACE( "OutputDevice::GetDevFontSize()" ); + OSL_TRACE( "OutputDevice::GetDevFontSize()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); // check range @@ -7282,7 +7303,7 @@ Size OutputDevice::GetDevFontSize( const Font& rFont, int nSizeIndex ) const sal_Bool OutputDevice::IsFontAvailable( const String& rFontName ) const { - DBG_TRACE( "OutputDevice::IsFontAvailable()" ); + OSL_TRACE( "OutputDevice::IsFontAvailable()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); ImplDevFontListData* pFound = mpFontList->FindFontFamily( rFontName ); @@ -7293,7 +7314,7 @@ sal_Bool OutputDevice::IsFontAvailable( const String& rFontName ) const FontMetric OutputDevice::GetFontMetric() const { - DBG_TRACE( "OutputDevice::GetFontMetric()" ); + OSL_TRACE( "OutputDevice::GetFontMetric()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); FontMetric aMetric; @@ -7401,7 +7422,7 @@ SystemFontData OutputDevice::GetSysFontData(int nFallbacklevel) const SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen, const sal_Int32* pDXAry) const { - DBG_TRACE( "OutputDevice::GetSysTextLayoutData()" ); + OSL_TRACE( "OutputDevice::GetSysTextLayoutData()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); SystemTextLayoutData aSysLayoutData; @@ -7449,7 +7470,7 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c long OutputDevice::GetMinKashida() const { - DBG_TRACE( "OutputDevice::GetMinKashida()" ); + OSL_TRACE( "OutputDevice::GetMinKashida()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mbNewFont && !ImplNewFont() ) return 0; @@ -7502,7 +7523,7 @@ xub_StrLen OutputDevice::ValidateKashidas ( const String& rTxt, // TODO: best is to get rid of this method completely sal_uLong OutputDevice::GetKerningPairCount() const { - DBG_TRACE( "OutputDevice::GetKerningPairCount()" ); + OSL_TRACE( "OutputDevice::GetKerningPairCount()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mbNewFont && !ImplNewFont() ) @@ -7528,7 +7549,7 @@ inline bool CmpKernData( const KerningPair& a, const KerningPair& b ) // TODO: best is to get rid of this method completely void OutputDevice::GetKerningPairs( sal_uLong nRequestedPairs, KerningPair* pKernPairs ) const { - DBG_TRACE( "OutputDevice::GetKerningPairs()" ); + OSL_TRACE( "OutputDevice::GetKerningPairs()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mbNewFont && !ImplNewFont() ) @@ -7551,7 +7572,7 @@ void OutputDevice::GetKerningPairs( sal_uLong nRequestedPairs, KerningPair* pKer sal_Bool OutputDevice::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) { - DBG_TRACE( "OutputDevice::GetGlyphBoundRect_CTL()" ); + OSL_TRACE( "OutputDevice::GetGlyphBoundRect_CTL()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); rVector.clear(); @@ -7577,7 +7598,7 @@ sal_Bool OutputDevice::GetTextBoundRect( Rectangle& rRect, const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, xub_StrLen nLen, sal_uLong nLayoutWidth, const sal_Int32* pDXAry ) const { - DBG_TRACE( "OutputDevice::GetTextBoundRect()" ); + OSL_TRACE( "OutputDevice::GetTextBoundRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); sal_Bool bRet = sal_False; @@ -8024,6 +8045,22 @@ sal_Bool OutputDevice::GetTextOutline( PolyPolygon& rPolyPoly, return sal_True; } +bool OutputDevice::GetFontCapabilities( FontCapabilities& rFontCapabilities ) const +{ + // we need a graphics + if( !mpGraphics && !ImplGetGraphics() ) + return false; + + if( mbNewFont ) + ImplNewFont(); + if( mbInitFont ) + ImplInitFont(); + if( !mpFontEntry ) + return false; + + return mpGraphics->GetImplFontCapabilities(rFontCapabilities); +} + // ----------------------------------------------------------------------- sal_Bool OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const @@ -8117,3 +8154,5 @@ xub_StrLen OutputDevice::HasGlyphs( const Font& rTempFont, const String& rStr, } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx index 84fc4fd7c524..f3828761bd6f 100644 --- a/vcl/source/gdi/outdev4.cxx +++ b/vcl/source/gdi/outdev4.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -175,42 +176,25 @@ void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect, sal_Bool bMtf, const PolyPolygon* pClipPolyPoly ) { // rotiertes BoundRect ausrechnen - Rectangle aRect = rRect; - aRect.Left()--; - aRect.Top()--; - aRect.Right()++; - aRect.Bottom()++; - sal_uInt16 nAngle = rGradient.GetAngle() % 3600; - double fAngle = nAngle * F_PI1800; - double fWidth = aRect.GetWidth(); - double fHeight = aRect.GetHeight(); - double fDX = fWidth * fabs( cos( fAngle ) ) + - fHeight * fabs( sin( fAngle ) ); - double fDY = fHeight * fabs( cos( fAngle ) ) + - fWidth * fabs( sin( fAngle ) ); - fDX = (fDX - fWidth) * 0.5 + 0.5; - fDY = (fDY - fHeight) * 0.5 + 0.5; - aRect.Left() -= (long)fDX; - aRect.Right() += (long)fDX; - aRect.Top() -= (long)fDY; - aRect.Bottom() += (long)fDY; + Rectangle aRect; + Point aCenter; + sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + + rGradient.GetBoundRect( rRect, aRect, aCenter ); // Rand berechnen und Rechteck neu setzen - Point aCenter = rRect.Center(); Rectangle aFullRect = aRect; long nBorder = (long)rGradient.GetBorder() * aRect.GetHeight() / 100; - sal_Bool bLinear; // Rand berechnen und Rechteck neu setzen fuer linearen Farbverlauf - if ( rGradient.GetStyle() == GRADIENT_LINEAR ) + bool bLinear = (rGradient.GetStyle() == GRADIENT_LINEAR); + if ( bLinear ) { - bLinear = sal_True; aRect.Top() += nBorder; } // Rand berechnen und Rechteck neu setzen fuer axiale Farbverlauf else { - bLinear = sal_False; nBorder >>= 1; aRect.Top() += nBorder; @@ -430,7 +414,8 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, // Virtuelle Device werden auch ausgeklammert, da einige Treiber // ansonsten zu langsam sind PolyPolygon* pPolyPoly; - Rectangle aRect( rRect ); + Rectangle aRect; + Point aCenter; Color aStartCol( rGradient.GetStartColor() ); Color aEndCol( rGradient.GetEndColor() ); long nStartRed = ( (long) aStartCol.GetRed() * rGradient.GetStartIntensity() ) / 100; @@ -445,66 +430,13 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, long nStepCount = rGradient.GetSteps(); sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + rGradient.GetBoundRect( rRect, aRect, aCenter ); + if( (meRasterOp != ROP_OVERPAINT) || (meOutDevType != OUTDEV_WINDOW) || bMtf ) pPolyPoly = new PolyPolygon( 2 ); else pPolyPoly = NULL; - if( rGradient.GetStyle() == GRADIENT_SQUARE || rGradient.GetStyle() == GRADIENT_RECT ) - { - const double fAngle = nAngle * F_PI1800; - const double fWidth = aRect.GetWidth(); - const double fHeight = aRect.GetHeight(); - double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) ); - double fDY = fHeight * fabs( cos( fAngle ) ) + fWidth * fabs( sin( fAngle ) ); - - fDX = ( fDX - fWidth ) * 0.5 + 0.5; - fDY = ( fDY - fHeight ) * 0.5 + 0.5; - - aRect.Left() -= (long) fDX; - aRect.Right() += (long) fDX; - aRect.Top() -= (long) fDY; - aRect.Bottom() += (long) fDY; - } - - Size aSize( aRect.GetSize() ); - - if( rGradient.GetStyle() == GRADIENT_RADIAL ) - { - // Radien-Berechnung fuer Kreis - aSize.Width() = (long)(0.5 + sqrt((double)aSize.Width()*(double)aSize.Width() + (double)aSize.Height()*(double)aSize.Height())); - aSize.Height() = aSize.Width(); - } - else if( rGradient.GetStyle() == GRADIENT_ELLIPTICAL ) - { - // Radien-Berechnung fuer Ellipse - aSize.Width() = (long)( 0.5 + (double) aSize.Width() * 1.4142 ); - aSize.Height() = (long)( 0.5 + (double) aSize.Height() * 1.4142 ); - } - else if( rGradient.GetStyle() == GRADIENT_SQUARE ) - { - if ( aSize.Width() > aSize.Height() ) - aSize.Height() = aSize.Width(); - else - aSize.Width() = aSize.Height(); - } - - // neue Mittelpunkte berechnen - long nZWidth = aRect.GetWidth() * (long) rGradient.GetOfsX() / 100; - long nZHeight = aRect.GetHeight() * (long) rGradient.GetOfsY() / 100; - long nBorderX = (long) rGradient.GetBorder() * aSize.Width() / 100; - long nBorderY = (long) rGradient.GetBorder() * aSize.Height() / 100; - Point aCenter( aRect.Left() + nZWidth, aRect.Top() + nZHeight ); - - // Rand beruecksichtigen - aSize.Width() -= nBorderX; - aSize.Height() -= nBorderY; - - // Ausgaberechteck neu setzen - aRect.Left() = aCenter.X() - ( aSize.Width() >> 1 ); - aRect.Top() = aCenter.Y() - ( aSize.Height() >> 1 ); - - aRect.SetSize( aSize ); long nMinRect = Min( aRect.GetWidth(), aRect.GetHeight() ); // Anzahl der Schritte berechnen, falls nichts uebergeben wurde @@ -675,7 +607,7 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, void OutputDevice::DrawGradient( const Rectangle& rRect, const Gradient& rGradient ) { - DBG_TRACE( "OutputDevice::DrawGradient()" ); + OSL_TRACE( "OutputDevice::DrawGradient()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rGradient, Gradient, NULL ); @@ -806,7 +738,7 @@ void OutputDevice::DrawGradient( const Rectangle& rRect, void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient ) { - DBG_TRACE( "OutputDevice::DrawGradient()" ); + OSL_TRACE( "OutputDevice::DrawGradient()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rGradient, Gradient, NULL ); @@ -1073,7 +1005,7 @@ void OutputDevice::AddGradientActions( const Rectangle& rRect, const Gradient& r void OutputDevice::DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch ) { - DBG_TRACE( "OutputDevice::DrawHatch()" ); + OSL_TRACE( "OutputDevice::DrawHatch()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Hatch aHatch( rHatch ); @@ -1420,3 +1352,5 @@ void OutputDevice::ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPol } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev5.cxx b/vcl/source/gdi/outdev5.cxx index 0a28203dbdfd..fcf32aff87e6 100644 --- a/vcl/source/gdi/outdev5.cxx +++ b/vcl/source/gdi/outdev5.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,7 +52,7 @@ DBG_NAMEEX( OutputDevice ) void OutputDevice::DrawRect( const Rectangle& rRect, sal_uLong nHorzRound, sal_uLong nVertRound ) { - DBG_TRACE( "OutputDevice::DrawRoundRect()" ); + OSL_TRACE( "OutputDevice::DrawRoundRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -110,7 +111,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect, void OutputDevice::DrawEllipse( const Rectangle& rRect ) { - DBG_TRACE( "OutputDevice::DrawEllipse()" ); + OSL_TRACE( "OutputDevice::DrawEllipse()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -161,7 +162,7 @@ void OutputDevice::DrawEllipse( const Rectangle& rRect ) void OutputDevice::DrawArc( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ) { - DBG_TRACE( "OutputDevice::DrawArc()" ); + OSL_TRACE( "OutputDevice::DrawArc()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -208,7 +209,7 @@ void OutputDevice::DrawArc( const Rectangle& rRect, void OutputDevice::DrawPie( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ) { - DBG_TRACE( "OutputDevice::DrawPie()" ); + OSL_TRACE( "OutputDevice::DrawPie()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -262,7 +263,7 @@ void OutputDevice::DrawPie( const Rectangle& rRect, void OutputDevice::DrawChord( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ) { - DBG_TRACE( "OutputDevice::DrawChord()" ); + OSL_TRACE( "OutputDevice::DrawChord()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -310,3 +311,5 @@ void OutputDevice::DrawChord( const Rectangle& rRect, if( mpAlphaVDev ) mpAlphaVDev->DrawChord( rRect, rStartPt, rEndPt ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index 4e02681841d2..2c0861ac9494 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,7 +63,7 @@ DBG_NAMEEX( OutputDevice ) void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ) { - DBG_TRACE( "OutputDevice::DrawGrid()" ); + OSL_TRACE( "OutputDevice::DrawGrid()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() ); @@ -161,7 +162,7 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLon void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency) { - DBG_TRACE( "OutputDevice::DrawTransparent(B2D&,transparency)" ); + OSL_TRACE( "OutputDevice::DrawTransparent(B2D&,transparency)" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); // AW: Do NOT paint empty PolyPolygons @@ -211,17 +212,8 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, if( bDrawnOk ) { -#if 0 - // MetaB2DPolyPolygonAction is not implemented yet: - // according to AW adding it is very dangerous since there is a lot - // of code that uses the metafile actions directly and unless every - // place that does this knows about the new action we need to fallback - if( mpMetaFile ) - mpMetaFile->AddAction( new MetaB2DPolyPolygonAction( rB2DPolyPoly ) ); -#else if( mpMetaFile ) mpMetaFile->AddAction( new MetaTransparentAction( PolyPolygon( rB2DPolyPoly ), static_cast< sal_uInt16 >(fTransparency * 100.0))); -#endif return; } } @@ -236,7 +228,7 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ) { - DBG_TRACE( "OutputDevice::DrawTransparent()" ); + OSL_TRACE( "OutputDevice::DrawTransparent()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); // short circuit for drawing an opaque polygon @@ -633,7 +625,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize, const Gradient& rTransparenceGradient ) { - DBG_TRACE( "OutputDevice::DrawTransparent()" ); + OSL_TRACE( "OutputDevice::DrawTransparent()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); const Color aBlack( COL_BLACK ); @@ -722,6 +714,8 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, pVDev->EnableMapMode(false); const AlphaMask aAlpha(pVDev->GetBitmap(aPoint, pVDev->GetOutputSizePixel())); + delete pVDev; + // draw masked content to target and restore MapMode DrawBitmapEx(aDstRect.TopLeft(), BitmapEx(aPaint, aAlpha)); EnableMapMode(bOrigMapModeEnabled); @@ -1251,8 +1245,6 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, } // ------------------------------------------------------------------ - -void OutputDevice::DrawRenderGraphic( const Point& rPoint, const Size& rSize, const ::vcl::RenderGraphic& rRenderGraphic ) { DBG_TRACE( "OutputDevice::DrawRenderGraphic()" ); @@ -1271,4 +1263,5 @@ void OutputDevice::DrawRenderGraphic( const Point& rPoint, const Size& rSize, DrawBitmapEx( rPoint, rSize, aRasterizer.Rasterize( aSizePixel ) ); mpMetaFile = pOldMetaFile; } -} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx index c31188fc357e..2bdc4f84fb7b 100755..100644 --- a/vcl/source/gdi/outdevnative.cxx +++ b/vcl/source/gdi/outdevnative.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -214,12 +215,11 @@ static boost::shared_ptr< ImplControlValue > lcl_transformControlValue( const Im } break; default: - OSL_ENSURE( 0, "unknown ImplControlValue type !" ); + OSL_FAIL( "unknown ImplControlValue type !" ); break; } return aResult; } - sal_Bool OutputDevice::DrawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, @@ -237,7 +237,7 @@ sal_Bool OutputDevice::DrawNativeControl( ControlType nType, if ( mbInitClipRegion ) ImplInitClipRegion(); - if ( mbOutputClipped ) + if ( mbOutputClipped || rControlRegion.IsEmpty() ) return sal_True; if ( mbInitLineColor ) @@ -336,3 +336,4 @@ sal_Bool OutputDevice::GetNativeControlRegion( ControlType nType, } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx index 72bcd2cc8a14..dd69e74d80fb 100644 --- a/vcl/source/gdi/outmap.cxx +++ b/vcl/source/gdi/outmap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,8 +54,6 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> -#define USE_64BIT_INTS - // ======================================================================= DBG_NAMEEX( OutputDevice ) @@ -175,12 +174,10 @@ static void ImplCalcBigIntThreshold( long nDPIX, long nDPIY, rThresRes.mnThresPixToLogY = (long)(((sal_uLong)LONG_MAX + (sal_uLong)(-nProductY/2)) / nDenomY); } -#ifdef USE_64BIT_INTS rThresRes.mnThresLogToPixX /= 2; rThresRes.mnThresLogToPixY /= 2; rThresRes.mnThresPixToLogX /= 2; rThresRes.mnThresPixToLogY /= 2; -#endif } // ----------------------------------------------------------------------- @@ -284,7 +281,7 @@ static void ImplCalcMapResolution( const MapMode& rMapMode, } break; default: - DBG_ERROR( "unhandled MapUnit" ); + OSL_FAIL( "unhandled MapUnit" ); break; } @@ -384,7 +381,6 @@ static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom, { // To "use" it... (void) nThres; -#ifdef USE_64BIT_INTS #if (SAL_TYPES_SIZEOFLONG < 8) if( (+n < nThres) && (-n < nThres) ) { @@ -412,34 +408,6 @@ static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom, } } return n; -#else // USE_64BIT_INTS - if ( Abs( n ) < nThres ) - { - n *= nDPI * nMapNum; - n += n >= 0 ? nMapDenom/2 : -((nMapDenom-1)/2); - return (n / nMapDenom); - } - else - { - BigInt aTemp( n ); - aTemp *= BigInt( nDPI ); - aTemp *= BigInt( nMapNum ); - - if ( aTemp.IsNeg() ) - { - BigInt aMapScDenom2( (nMapDenom-1)/2 ); - aTemp -= aMapScDenom2; - } - else - { - BigInt aMapScDenom2( nMapDenom/2 ); - aTemp += aMapScDenom2; - } - - aTemp /= BigInt( nMapDenom ); - return (long)aTemp; - } -#endif } // ----------------------------------------------------------------------- @@ -449,7 +417,6 @@ static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom, { // To "use" it... (void) nThres; -#ifdef USE_64BIT_INTS #if (SAL_TYPES_SIZEOFLONG < 8) if( (+n < nThres) && (-n < nThres) ) n = (2 * n * nMapDenom) / (nDPI * nMapNum); @@ -463,59 +430,6 @@ static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom, } if( n < 0 ) --n; else ++n; return (n / 2); -#else // USE_64BIT_INTS - if ( Abs( n ) < nThres ) - { - long nDenom = nDPI * nMapNum; - long nNum = n * nMapDenom; - if( (nNum ^ nDenom) >= 0 ) - nNum += nDenom/2; - else - nNum -= nDenom/2; - return (nNum / nDenom); - } - else - { - BigInt aDenom( nDPI ); - aDenom *= BigInt( nMapNum ); - - BigInt aNum( n ); - aNum *= BigInt( nMapDenom ); - - BigInt aDenom2( aDenom ); - if ( aNum.IsNeg() ) - { - if ( aDenom.IsNeg() ) - { - aDenom2 /= BigInt(2); - aNum += aDenom2; - } - else - { - aDenom2 -= 1; - aDenom2 /= BigInt(2); - aNum -= aDenom2; - } - } - else - { - if ( aDenom.IsNeg() ) - { - aDenom2 += 1; - aDenom2 /= BigInt(2); - aNum -= aDenom2; - } - else - { - aDenom2 /= BigInt(2); - aNum += aDenom2; - } - } - - aNum /= aDenom; - return (long)aNum; - } -#endif } // ----------------------------------------------------------------------- @@ -2505,3 +2419,5 @@ long Window::ImplLogicUnitToPixelY( long nY, MapUnit eUnit ) return nY; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index c47b034e1011..2736e321ea80 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -426,7 +427,7 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM } break; } - aBeg++; + ++aBeg; } } break; @@ -437,13 +438,11 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM break; case PDFExtOutDevDataSync::EndGroupGfxLink : { - sal_Int32 nTransparency; Rectangle aOutputRect, aVisibleOutputRect; Graphic aGraphic( mGraphics.front() ); mGraphics.pop_front(); - nTransparency = mParaInts.front(); - mParaInts.pop_front(); + mParaInts.pop_front(); //Transparency aOutputRect = mParaRects.front(); mParaRects.pop_front(); aVisibleOutputRect = mParaRects.front(); @@ -843,3 +842,5 @@ void PDFExtOutDevData::EndGroup( const Graphic& rGraphic, } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdffontcache.cxx b/vcl/source/gdi/pdffontcache.cxx index f0842c6bc1ba..61499fdc24d8 100644 --- a/vcl/source/gdi/pdffontcache.cxx +++ b/vcl/source/gdi/pdffontcache.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -83,3 +84,4 @@ sal_Int32 PDFFontCache::getGlyphWidth( const ImplFontData* pFont, sal_GlyphId nG return nWidth; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdffontcache.hxx b/vcl/source/gdi/pdffontcache.hxx index b9997c1e6fc9..f607f100c52c 100644 --- a/vcl/source/gdi/pdffontcache.hxx +++ b/vcl/source/gdi/pdffontcache.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,3 +80,5 @@ namespace vcl } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index d6c5aed6b52a..244620bdafd5 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -578,3 +579,4 @@ void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::P ((PDFWriterImpl*)pImplementation)->playMetafile( i_rMTF, i_pData, i_rPlayContext, NULL); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 11e4367eae95..8bab1abf6d47 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,7 +83,14 @@ #include "cppuhelper/implbase1.hxx" using namespace vcl; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OUStringToOString; +using ::rtl::OString; +using ::rtl::OStringHash; +using ::rtl::OUStringHash; +using ::rtl::OStringBuffer; +using ::rtl::OUStringBuffer; #if (OSL_DEBUG_LEVEL < 2) #define COMPRESS_PAGES @@ -712,7 +720,7 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr // find or create a hierarchical field // first find the fully qualified name up to this field aDomain = aFullName.copy( 0, nTokenIndex-1 ); - std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); + boost::unordered_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); if( it == m_aFieldNameMap.end() ) { // create new hierarchy field @@ -773,7 +781,7 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr // insert widget into its hierarchy field if( aDomain.getLength() ) { - std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); + boost::unordered_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); if( it != m_aFieldNameMap.end() ) { OSL_ENSURE( it->second >= 0 && it->second < sal_Int32( m_aWidgets.size() ), "invalid field index" ); @@ -800,11 +808,11 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr if( ! m_aContext.AllowDuplicateFieldNames ) { - std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aFullName ); + boost::unordered_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aFullName ); if( it != m_aFieldNameMap.end() ) // not unique { - std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it; + boost::unordered_map< OString, sal_Int32, OStringHash >::const_iterator check_it; OString aTry; sal_Int32 nTry = 2; do @@ -1251,11 +1259,6 @@ bool PDFWriterImpl::PDFPage::emit(sal_Int32 nParentObject ) } aLine.append( "]\n" ); } - #if 0 - // FIXME: implement tab order as Structure Tree - if( m_bHasWidgets && m_pWriter->getVersion() >= PDFWriter::PDF_1_5 ) - aLine.append( " /Tabs /S\n" ); - #endif if( m_aMCIDParents.size() > 0 ) { OStringBuffer aStructParents( 1024 ); @@ -2277,7 +2280,7 @@ ImplDevFontList* PDFWriterImpl::filterDevFontList( ImplDevFontList* pFontList ) // append the PDF builtin fonts if( !m_bIsPDF_A1 && !m_bEmbedStandardFonts) - for( unsigned int i = 0; i < sizeof(m_aBuiltinFonts)/sizeof(m_aBuiltinFonts[0]); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aBuiltinFonts); i++ ) { ImplFontData* pNewData = new ImplPdfBuiltinFontData( m_aBuiltinFonts[i] ); pFiltered->Add( pNewData ); @@ -2473,7 +2476,7 @@ void PDFWriterImpl::endPage() // sanity check if( m_aOutputStreams.begin() != m_aOutputStreams.end() ) { - DBG_ERROR( "redirection across pages !!!" ); + OSL_FAIL( "redirection across pages !!!" ); m_aOutputStreams.clear(); // leak ! m_aMapMode.SetOrigin( Point() ); } @@ -2724,7 +2727,7 @@ OString PDFWriterImpl::emitStructureAttributes( PDFStructureElement& i_rEle ) } else { - DBG_ERROR( "unresolved link id for Link structure" ); + OSL_FAIL( "unresolved link id for Link structure" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "unresolved link id %" SAL_PRIdINT32 " for Link structure\n", nLink ); { @@ -2825,7 +2828,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) emitStructure( rChild ); else { - DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure element" ); + OSL_FAIL( "PDFWriterImpl::emitStructure: invalid child structure element" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "PDFWriterImpl::emitStructure: invalid child structure elemnt with id %" SAL_PRIdINT32 "\n", *it ); #endif @@ -2834,7 +2837,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) } else { - DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure id" ); + OSL_FAIL( "PDFWriterImpl::emitStructure: invalid child structure id" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "PDFWriterImpl::emitStructure: invalid child structure id %" SAL_PRIdINT32 "\n", *it ); #endif @@ -2857,7 +2860,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) if( ! m_aRoleMap.empty() ) { aLine.append( "/RoleMap<<" ); - for( std::hash_map<OString,OString,OStringHash>::const_iterator + for( boost::unordered_map<OString,OString,OStringHash>::const_iterator it = m_aRoleMap.begin(); it != m_aRoleMap.end(); ++it ) { aLine.append( '/' ); @@ -3101,7 +3104,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa return aRet; } - sal_Int32 nFontObject = 0; sal_Int32 nFontDescriptor = 0; rtl::OString aSubType( "/Type1" ); FontSubsetInfo aInfo; @@ -3164,7 +3166,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa } else { - DBG_ERROR( "system font neither embeddable nor subsettable" ); + OSL_FAIL( "system font neither embeddable nor subsettable" ); } // write font descriptor @@ -3199,7 +3201,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa "endobj\n\n" ); writeBuffer( aLine.getStr(), aLine.getLength() ); - nFontObject = nObject; aRet[ rEmbed.m_nNormalFontID ] = nObject; } } @@ -3252,7 +3253,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont return aRet; } - sal_Int32 nFontObject = 0; sal_Int32 nStreamObject = 0; sal_Int32 nFontDescriptor = 0; @@ -3668,7 +3668,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont if( nFontDescriptor ) { if( pEncoding ) - nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, sizeof(nEncoding)/sizeof(nEncoding[0]) ); + nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, SAL_N_ELEMENTS(nEncoding) ); // write font object sal_Int32 nObject = createObject(); @@ -3704,8 +3704,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) ) throw FontException(); - nFontObject = nObject; - aRet[ rEmbed.m_nNormalFontID ] = nObject; // write additional encodings @@ -3998,7 +3996,7 @@ sal_Int32 PDFWriterImpl::emitFontDescriptor( const ImplFontData* pFont, FontSubs case FontSubsetInfo::ANY_TYPE1: break; default: - DBG_ERROR( "unknown fonttype in PDF font descriptor" ); + OSL_FAIL( "unknown fonttype in PDF font descriptor" ); return 0; } aLine.append( ' ' ); @@ -4073,7 +4071,7 @@ bool PDFWriterImpl::emitFonts() nGlyphs++; else { - DBG_ERROR( "too many glyphs for subset" ); + OSL_FAIL( "too many glyphs for subset" ); } } FontSubsetInfo aSubsetInfo; @@ -4131,7 +4129,7 @@ bool PDFWriterImpl::emitFonts() else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::CFF_FONT) != 0 ) { // TODO: implement - DBG_ERROR( "PDFWriterImpl does not support CFF-font subsets yet!" ); + OSL_FAIL( "PDFWriterImpl does not support CFF-font subsets yet!" ); } else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::TYPE1_PFB) != 0 ) // TODO: also support PFA? { @@ -4594,7 +4592,6 @@ we check in the following sequence: // extract target file type INetURLObject aDocumentURL( m_aContext.BaseURL ); INetURLObject aTargetURL( rLink.m_aURL ); - sal_Int32 nChangeFileExtensionToPDF = 0; sal_Int32 nSetGoToRMode = 0; sal_Bool bTargetHasPDFExtension = sal_False; INetProtocol eTargetProtocol = aTargetURL.GetProtocol(); @@ -4633,18 +4630,19 @@ we check in the following sequence: { if( m_aContext.ConvertOOoTargetToPDFTarget ) { -//examine the file type (.odm .odt. .odp, odg, ods) + sal_Int32 bChangeFileExtensionToPDF = false; + //examine the file type (.odm .odt. .odp, odg, ods) if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odm" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odt" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odp" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odg" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ods" ) ) ) ) - nChangeFileExtensionToPDF++; - if( nChangeFileExtensionToPDF ) + bChangeFileExtensionToPDF = true; + if( bChangeFileExtensionToPDF ) aTargetURL.setExtension(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ) ); } //check if extension is pdf, see if GoToR should be forced @@ -4691,7 +4689,9 @@ we check in the following sequence: // and will force the use of URI when the protocol is not file:// if( (aFragment.getLength() > 0 && !bTargetHasPDFExtension) || eTargetProtocol != INET_PROT_FILE ) + { aLine.append( "/URI/URI" ); + } else { aLine.append( "/Launch/F" ); @@ -4702,7 +4702,8 @@ we check in the following sequence: } //fragment are encoded in the same way as in the named destination processing if( nSetGoToRMode ) - {//add the fragment + { + //add the fragment rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET ); aLine.append("/GoToR"); aLine.append("/F"); @@ -4730,15 +4731,11 @@ we check in the following sequence: aTargetURL.SetMark( aLineLoc.getStr() ); } rtl::OUString aURL = aTargetURL.GetMainURL( bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE ); -// check if we have a URL available, if the string is empty, set it as the original one -// if( aURL.getLength() == 0 ) -// appendLiteralStringEncrypt( rLink.m_aURL , rLink.m_nObject, aLine ); -// else - appendLiteralStringEncrypt( bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL, - INetURLObject::WAS_ENCODED, + appendLiteralStringEncrypt(bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL, + INetURLObject::WAS_ENCODED, bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE ) : - aURL , rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); + aURL , rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); } //<--- i56629 } @@ -5042,22 +5039,6 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr beginRedirect( pListBoxStream, rBox.m_aRect ); OStringBuffer aAppearance( 64 ); -#if 0 - if( ! rWidget.DropDown ) - { - // prepare linewidth for DA string hack, see below - Size aFontSize = lcl_convert( m_aGraphicsStack.front().m_aMapMode, - m_aMapMode, - getReferenceDevice(), - Size( 0, aFont.GetHeight() ) ); - sal_Int32 nLW = aFontSize.Height() / 40; - appendFixedInt( nLW > 0 ? nLW : 1, aAppearance ); - aAppearance.append( " w\n" ); - writeBuffer( aAppearance.getStr(), aAppearance.getLength() ); - aAppearance.setLength( 0 ); - } -#endif - setLineColor( Color( COL_TRANSPARENT ) ); setFillColor( replaceColor( rWidget.BackgroundColor, rSettings.GetFieldColor() ) ); drawRectangle( rBox.m_aRect ); @@ -5073,18 +5054,6 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr // prepare DA string OStringBuffer aDA( 256 ); -#if 0 - if( !rWidget.DropDown ) - { - /* another of AR5's peculiarities: the selected item of a choice - field is highlighted using the non stroking color - same as the - text color. so workaround that by using text rendering mode 2 - (fill, then stroke) and set the stroking color - */ - appendStrokingColor( replaceColor( rWidget.BackgroundColor, rSettings.GetFieldColor() ), aDA ); - aDA.append( " 2 Tr " ); - } -#endif // prepare DA string appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA ); aDA.append( ' ' ); @@ -6660,7 +6629,7 @@ void PDFWriterImpl::sortWidgets() { // sort widget annotations on each page as per their // TabOrder attribute - std::hash_map< sal_Int32, AnnotSortContainer > sorted; + boost::unordered_map< sal_Int32, AnnotSortContainer > sorted; int nWidgets = m_aWidgets.size(); for( int nW = 0; nW < nWidgets; nW++ ) { @@ -6680,7 +6649,7 @@ void PDFWriterImpl::sortWidgets() } } } - for( std::hash_map< sal_Int32, AnnotSortContainer >::iterator it = sorted.begin(); it != sorted.end(); ++it ) + for( boost::unordered_map< sal_Int32, AnnotSortContainer >::iterator it = sorted.begin(); it != sorted.end(); ++it ) { // append entries for non widget annotations PDFPage& rPage = m_aPages[ it->first ]; @@ -7808,7 +7777,6 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sa XubString aLastLine; ImplMultiTextLineInfo aMultiLineInfo; ImplTextLineInfo* pLineInfo; - long nMaxTextWidth; xub_StrLen i; xub_StrLen nLines; xub_StrLen nFormatLines; @@ -7816,7 +7784,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sa if ( nTextHeight ) { ::vcl::DefaultTextLayout aLayout( *m_pReferenceDevice ); - nMaxTextWidth = OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); + OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) @@ -8307,6 +8275,9 @@ void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontSt void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout ) { + //See qadevOOo/testdocs/StrikeThrough.odt for examples if you need + //to tweak this + String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" ); String aStrikeout = aStrikeoutChar; while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth ) @@ -8328,7 +8299,27 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik // strikeout string is left aligned non-CTL text sal_uLong nOrigTLM = m_pReferenceDevice->GetLayoutMode(); m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED ); + + push( PUSH_CLIPREGION ); + FontMetric aRefDevFontMetric = m_pReferenceDevice->GetFontMetric(); + Rectangle aRect; + aRect.nLeft = rPos.X(); + aRect.nRight = aRect.nLeft+nWidth; + aRect.nBottom = rPos.Y()+aRefDevFontMetric.GetDescent(); + aRect.nTop = rPos.Y()-aRefDevFontMetric.GetAscent(); + + ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry; + if (pFontEntry->mnOrientation) + { + Polygon aPoly( aRect ); + aPoly.Rotate( rPos, pFontEntry->mnOrientation); + aRect = aPoly.GetBoundRect(); + } + + intersectClipRegion( aRect ); drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false ); + pop(); + m_pReferenceDevice->SetLayoutMode( nOrigTLM ); if ( bShadow ) @@ -9316,11 +9307,6 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) * resource dict anyway, let's use the one from the page by NOT * emitting a Resources entry. */ - #if 0 - aLine.append( " /Resources " ); - aLine.append( getResourceDictObj() ); - aLine.append( " 0 R\n" ); - #endif aLine.append( "/Length " ); aLine.append( (sal_Int32)(nSize) ); @@ -9395,12 +9381,6 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) aMask.append( "]\n" ); /* #i42884# see above */ -#if 0 - aLine.append( "/Resources " ); - aMask.append( getResourceDictObj() ); - aMask.append( " 0 R\n" ); -#endif - aMask.append( "/Group<</S/Transparency/CS/DeviceRGB>>\n" ); aMask.append( "/Length " ); aMask.append( nMaskSize ); @@ -11133,11 +11113,11 @@ sal_Int32 PDFWriterImpl::beginStructureElement( PDFWriter::StructElement eType, DBG_ASSERT( 0, "Structure element inserted to StructTreeRoot that is not a document" ); } else { - DBG_ERROR( "document structure in disorder !" ); + OSL_FAIL( "document structure in disorder !" ); } } else { - DBG_ERROR( "PDF document structure MUST be contained in a Document element" ); + OSL_FAIL( "PDF document structure MUST be contained in a Document element" ); } } @@ -11255,7 +11235,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) addInternalStructureContainer( rChild );//examine the child else { - DBG_ERROR( "PDFWriterImpl::addInternalStructureContainer: invalid child structure element" ); + OSL_FAIL( "PDFWriterImpl::addInternalStructureContainer: invalid child structure element" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "PDFWriterImpl::addInternalStructureContainer: invalid child structure elemnt with id %" SAL_PRIdINT32 "\n", *it ); #endif @@ -11264,7 +11244,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) } else { - DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure id" ); + OSL_FAIL( "PDFWriterImpl::emitStructure: invalid child structure id" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "PDFWriterImpl::addInternalStructureContainer: invalid child structure id %" SAL_PRIdINT32 "\n", *it ); #endif @@ -11767,7 +11747,7 @@ void PDFWriterImpl::ensureUniqueRadioOnValues() { PDFWidget& rGroupWidget = m_aWidgets[ group->second ]; // check whether all kids have a unique OnValue - std::hash_map< OUString, sal_Int32, OUStringHash > aOnValues; + boost::unordered_map< OUString, sal_Int32, OUStringHash > aOnValues; int nChildren = rGroupWidget.m_aKidsIndex.size(); bool bIsUnique = true; for( int nKid = 0; nKid < nChildren && bIsUnique; nKid++ ) @@ -11797,7 +11777,7 @@ void PDFWriterImpl::ensureUniqueRadioOnValues() int nKidIndex = rGroupWidget.m_aKidsIndex[nKid]; PDFWidget& rKid = m_aWidgets[nKidIndex]; rKid.m_aOnValue = OUString::valueOf( sal_Int32(nKid+1) ); - if( ! rKid.m_aValue.equalsAscii( "Off" ) ) + if( ! rKid.m_aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Off" ) ) ) rKid.m_aValue = rKid.m_aOnValue; } } @@ -11824,7 +11804,7 @@ void PDFWriterImpl::ensureUniqueRadioOnValues() #endif } // update selected radio button - if( ! rKid.m_aValue.equalsAscii( "Off" ) ) + if( ! rKid.m_aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Off" ) ) ) { rGroupWidget.m_aValue = rKid.m_aValue; } @@ -11958,7 +11938,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa rNewWidget.m_nTextStyle = TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK; - rNewWidget.m_aValue = OUString::createFromAscii( rBox.Checked ? "Yes" : "Off" ); + rNewWidget.m_aValue = rBox.Checked ? OUString(RTL_CONSTASCII_USTRINGPARAM("Yes")) : OUString(RTL_CONSTASCII_USTRINGPARAM("Off" )); // create default appearance before m_aRect gets transformed createDefaultCheckBoxAppearance( rNewWidget, rBox ); } @@ -12157,3 +12137,4 @@ void PDFWriterImpl::addStream( const String& rMimeType, PDFOutputStream* pStream +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 845e95d29270..d6f87f83a006 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,13 +44,14 @@ #include "rtl/digest.h" #include "com/sun/star/util/XURLTransformer.hpp" #include "com/sun/star/lang/Locale.hpp" +#include <sal/macros.h> #include <sallayout.hxx> #include "pdffontcache.hxx" #include <vector> #include <map> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <list> #include <boost/shared_array.hpp> @@ -201,7 +203,7 @@ public: return *this; } - bool operator==( const BitmapID& rComp ) + bool operator==( const BitmapID& rComp ) const { return (m_aPixelSize == rComp.m_aPixelSize && m_nSize == rComp.m_nSize && @@ -228,7 +230,7 @@ public: sal_Int32 m_nObject; bool m_bTrueColor; - JPGEmit() : m_pStream( NULL ) {} + JPGEmit() : m_pStream( NULL ), m_bTrueColor( false ) {} ~JPGEmit() { delete m_pStream; } }; @@ -293,7 +295,7 @@ public: GlyphEmit() : m_nUnicodes(0), m_nSubsetGlyphID(0) { rtl_zeroMemory( m_aBufferedUnicodes, sizeof( m_aBufferedUnicodes ) ); - m_nMaxUnicodes = sizeof(m_aBufferedUnicodes)/sizeof(m_aBufferedUnicodes[0]); + m_nMaxUnicodes = SAL_N_ELEMENTS(m_aBufferedUnicodes); } ~GlyphEmit() { @@ -439,8 +441,8 @@ public: {} }; - typedef std::hash_map< rtl::OString, SvMemoryStream*, rtl::OStringHash > PDFAppearanceStreams; - typedef std::hash_map< rtl::OString, PDFAppearanceStreams, rtl::OStringHash > PDFAppearanceMap; + typedef boost::unordered_map< rtl::OString, SvMemoryStream*, rtl::OStringHash > PDFAppearanceStreams; + typedef boost::unordered_map< rtl::OString, PDFAppearanceStreams, rtl::OStringHash > PDFAppearanceMap; struct PDFWidget : public PDFAnnotation { @@ -647,7 +649,7 @@ private: bool m_bEmitStructure; bool m_bNewMCID; /* role map of struct tree root */ - std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > + boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aRoleMap; /* contains all widgets used in the PDF @@ -657,8 +659,8 @@ private: std::map< sal_Int32, sal_Int32 > m_aRadioGroupWidgets; /* used to store control id during beginControlAppearance/endControlAppearance */ sal_Int32 m_nCurrentControl; - /* hash_map for field names, used to ensure unique field names */ - std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash > m_aFieldNameMap; + /* boost::unordered_map for field names, used to ensure unique field names */ + boost::unordered_map< rtl::OString, sal_Int32, rtl::OStringHash > m_aFieldNameMap; /* contains Bitmaps for gradient functions until they are written * to the file stream */ @@ -1338,3 +1340,4 @@ public: #endif //_VCL_PDFEXPORT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index b957c57205e8..eae543b1b65d 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -834,7 +834,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa case( META_MASKSCALE_ACTION ): case( META_MASKSCALEPART_ACTION ): { - DBG_ERROR( "MetaMask...Action not supported yet" ); + OSL_TRACE( "MetaMask...Action not supported yet" ); } break; @@ -1066,7 +1066,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa if( !bAssertionFired ) { bAssertionFired = true; - DBG_ERROR( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" ); + OSL_TRACE( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" ); } break; } diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index ac6116e38234..66e3cd1bea1a 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -157,7 +158,6 @@ private: bool ReadNextChunk(); void ReadRemainingChunks(); - void SkipRemainingChunks(); void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor & ); void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, sal_uInt8 nPalIndex ); @@ -200,7 +200,9 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream ) mpInflateInBuf ( NULL ), mpScanPrior ( NULL ), mpTransTab ( NULL ), + mpScanCurrent ( NULL ), mpColorTable ( (sal_uInt8*) mpDefaultColorTable ), + mnPass ( 0 ), mbzCodecInUse ( sal_False ), mbStatus( sal_True), mbIDAT( sal_False ), @@ -333,30 +335,6 @@ void PNGReaderImpl::ReadRemainingChunks() // ------------------------------------------------------------------------ -// move position of mrPNGStream to the end of the file -void PNGReaderImpl::SkipRemainingChunks() -{ - // nothing to skip if the last chunk was read - if( !maChunkSeq.empty() && (maChunkSeq.back().nType == PNGCHUNK_IEND) ) - return; - - // read from the stream until the IEND chunk is found - const sal_Size nStreamPos = mrPNGStream.Tell(); - while( !mrPNGStream.IsEof() && (mrPNGStream.GetError() == ERRCODE_NONE) ) - { - mrPNGStream >> mnChunkLen >> mnChunkType; - if( mnChunkLen < 0 ) - break; - if( nStreamPos + mnChunkLen >= mnStreamSize ) - break; - mrPNGStream.SeekRel( mnChunkLen + 4 ); // skip data + CRC - if( mnChunkType == PNGCHUNK_IEND ) - break; - } -} - -// ------------------------------------------------------------------------ - const std::vector< vcl::PNGReader::ChunkData >& PNGReaderImpl::GetAllChunks() { ReadRemainingChunks(); @@ -478,11 +456,6 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) aRet.SetPrefSize( maPhysSize ); } -#if 0 - // TODO: make sure nobody depends on the stream being after the IEND chunks - // => let them do ReadChunks before - ReadRemainingChunks(); -#endif } return aRet; @@ -1587,3 +1560,5 @@ void PNGReader::SetIgnoreGammaChunk( sal_Bool b ) } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index 3d814bea000e..b87457c35054 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -119,7 +120,7 @@ private: void ImplWriteChunk( sal_uInt8 nNumb ); void ImplWriteChunk( sal_uInt32 nNumb ); void ImplWriteChunk( unsigned char* pSource, sal_uInt32 nDatSize ); - void ImplCloseChunk( void ); + void ImplCloseChunk( void ) const; }; // ------------------------------------------------------------------------ @@ -148,11 +149,11 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, sal_Int32 i = 0; for ( i = 0; i < pFilterData->getLength(); i++ ) { - if ( (*pFilterData)[ i ].Name.equalsAscii( "Compression" ) ) + if ( (*pFilterData)[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Compression" ) ) ) (*pFilterData)[ i ].Value >>= mnCompLevel; - else if ( (*pFilterData)[ i ].Name.equalsAscii( "Interlaced" ) ) + else if ( (*pFilterData)[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Interlaced" ) ) ) (*pFilterData)[ i ].Value >>= mnInterlaced; - else if ( (*pFilterData)[ i ].Name.equalsAscii( "MaxChunkSize" ) ) + else if ( (*pFilterData)[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MaxChunkSize" ) ) ) { sal_Int32 nVal = 0; if ( (*pFilterData)[ i ].Value >>= nVal ) @@ -698,7 +699,7 @@ void PNGWriterImpl::ImplWriteChunk ( unsigned char* pSource, sal_uInt32 nDatSize // ------------------------------------------------------------------------ // nothing to do -void PNGWriterImpl::ImplCloseChunk ( void ) +void PNGWriterImpl::ImplCloseChunk ( void ) const { } @@ -735,3 +736,4 @@ std::vector< vcl::PNGWriter::ChunkData >& PNGWriter::GetChunks() } // namespace vcl +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 9d8bee00ef24..4c9461fbcb97 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -339,7 +340,7 @@ ImplPrnQueueList::~ImplPrnQueueList() void ImplPrnQueueList::Add( SalPrinterQueueInfo* pData ) { - std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash >::iterator it = + boost::unordered_map< rtl::OUString, sal_Int32, rtl::OUStringHash >::iterator it = m_aNameToIndex.find( pData->maPrinterName ); if( it == m_aNameToIndex.end() ) { @@ -364,7 +365,7 @@ void ImplPrnQueueList::Add( SalPrinterQueueInfo* pData ) ImplPrnQueueData* ImplPrnQueueList::Get( const rtl::OUString& rPrinter ) { ImplPrnQueueData* pData = NULL; - std::hash_map<rtl::OUString,sal_Int32,rtl::OUStringHash>::iterator it = + boost::unordered_map<rtl::OUString,sal_Int32,rtl::OUStringHash>::iterator it = m_aNameToIndex.find( rPrinter ); if( it != m_aNameToIndex.end() ) pData = &m_aQueueInfos[it->second]; @@ -1285,7 +1286,7 @@ rtl::OUString Printer::GetPaperName( Paper ePaper ) ImplSVData* pSVData = ImplGetSVData(); if( ! pSVData->mpPaperNames ) { - pSVData->mpPaperNames = new std::hash_map< int, rtl::OUString >(); + pSVData->mpPaperNames = new boost::unordered_map< int, rtl::OUString >(); if( ImplGetResMgr() ) { ResStringArray aPaperStrings( VclResId( RID_STR_PAPERNAMES ) ); @@ -1305,7 +1306,7 @@ rtl::OUString Printer::GetPaperName( Paper ePaper ) } } - std::hash_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper ); + boost::unordered_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper ); return (it != pSVData->mpPaperNames->end()) ? it->second : rtl::OUString(); } @@ -1626,3 +1627,5 @@ void Printer::updatePrinters() delete pNewList; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 59b79c64a13c..5a23eb406bc3 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -218,7 +219,7 @@ static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf, case META_TRANSPARENT_ACTION: default: - DBG_ERROR("Printer::GetPreparedMetafile impossible state reached"); + OSL_FAIL("Printer::GetPreparedMetafile impossible state reached"); break; } @@ -288,7 +289,7 @@ static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf, static_cast<const MetaRenderGraphicAction&>(rAct).GetSize(), aBmp )); default: - DBG_ERROR("Unexpected case"); + OSL_FAIL("Unexpected case"); break; } } @@ -651,7 +652,7 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic break; case META_TEXTLINE_ACTION: - DBG_ERROR("META_TEXTLINE_ACTION not supported"); + OSL_FAIL("META_TEXTLINE_ACTION not supported"); break; case( META_RENDERGRAPHIC_ACTION ): @@ -1620,3 +1621,5 @@ void Printer::DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, else pOut->DrawGradient( rPolyPoly, rGradient ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 3bc47e6cf8fb..0e99923ccc0f 100755..100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,8 +51,8 @@ #include "com/sun/star/awt/Size.hpp" #include "comphelper/processfactory.hxx" -#include <hash_map> -#include <hash_set> +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> using namespace com::sun::star; using namespace com::sun::star::uno; @@ -76,13 +77,8 @@ class ImplPageCache { if( maCacheRanking[0] != nLastHit ) { - bool bMove = false; for( sal_Int32 i = nCacheSize-1; i > 0; i-- ) - { - if( maCacheRanking[i] == nLastHit ) - bMove = true; maCacheRanking[i] = maCacheRanking[i-1]; - } maCacheRanking[0] = nLastHit; } } @@ -149,9 +145,9 @@ public: ControlDependency() : mnDependsOnEntry( -1 ) {} }; - typedef std::hash_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap; - typedef std::hash_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap; - typedef std::hash_map< rtl::OUString, Sequence< sal_Bool >, rtl::OUStringHash > ChoiceDisableMap; + typedef boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap; + typedef boost::unordered_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap; + typedef boost::unordered_map< rtl::OUString, Sequence< sal_Bool >, rtl::OUStringHash > ChoiceDisableMap; boost::shared_ptr<Printer> mpPrinter; Sequence< PropertyValue > maUIOptions; @@ -775,21 +771,21 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons sal_Int32 nPaperBin = mnDefaultPaperBin; for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty ) { - if( i_rProps[ nProperty ].Name.equalsAscii( "PreferredPageSize" ) ) + if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreferredPageSize" ) ) ) { i_rProps[ nProperty ].Value >>= aSetSize; } - else if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) ) + else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageSize" ) ) ) { i_rProps[ nProperty ].Value >>= aIsSize; } - else if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) ) + else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageIncludesNonprintableArea" ) ) ) { sal_Bool bVal = sal_False; i_rProps[ nProperty ].Value >>= bVal; aPageSize.bFullPaper = static_cast<bool>(bVal); } - else if( i_rProps[ nProperty ].Name.equalsAscii( "PrinterPaperTray" ) ) + else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrinterPaperTray" ) ) ) { sal_Int32 nBin = -1; i_rProps[ nProperty ].Value >>= nBin; @@ -1235,7 +1231,7 @@ bool PrinterController::getReversePrint() const Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const { - std::hash_set< rtl::OUString, rtl::OUStringHash > aMergeSet; + boost::unordered_set< rtl::OUString, rtl::OUStringHash > aMergeSet; size_t nResultLen = size_t(i_rMergeList.getLength()) + mpImplData->maUIProperties.size() + 3; for( int i = 0; i < i_rMergeList.getLength(); i++ ) aMergeSet.insert( i_rMergeList[i].Name ); @@ -1284,14 +1280,14 @@ const Sequence< beans::PropertyValue >& PrinterController::getUIOptions() const beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL; } const beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) const { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL; } @@ -1321,7 +1317,7 @@ void PrinterController::setValue( const rtl::OUString& i_rName, const Any& i_rVa void PrinterController::setValue( const beans::PropertyValue& i_rValue ) { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rValue.Name ); if( it != mpImplData->maPropertyToIndex.end() ) mpImplData->maUIProperties[ it->second ] = i_rValue; @@ -1352,7 +1348,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ for( int n = 0; n < aOptProp.getLength(); n++ ) { const beans::PropertyValue& rEntry( aOptProp[ n ] ); - if( rEntry.Name.equalsAscii( "Property" ) ) + if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Property" ) ) ) { PropertyValue aVal; rEntry.Value >>= aVal; @@ -1362,17 +1358,17 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ aPropName = aVal.Name; bHaveProperty = true; } - else if( rEntry.Name.equalsAscii( "Enabled" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Enabled" ) ) ) { sal_Bool bValue = sal_True; rEntry.Value >>= bValue; bIsEnabled = bValue; } - else if( rEntry.Name.equalsAscii( "DependsOnName" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnName" ) ) ) { rEntry.Value >>= aDep.maDependsOnName; } - else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnEntry" ) ) ) { rEntry.Value >>= aDep.mnDependsOnEntry; } @@ -1400,7 +1396,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i_bEnable ) { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); if( it != mpImplData->maPropertyToIndex.end() ) { @@ -1418,7 +1414,7 @@ void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) const { bool bEnabled = false; - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it = mpImplData->maPropertyToIndex.find( i_rProperty ); if( prop_it != mpImplData->maPropertyToIndex.end() ) { @@ -1458,7 +1454,7 @@ bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) co else { // if the type does not match something is awry - OSL_ENSURE( 0, "strange type in control dependency" ); + OSL_FAIL( "strange type in control dependency" ); bEnabled = false; } } @@ -1526,7 +1522,7 @@ rtl::OUString PrinterController::makeEnabled( const rtl::OUString& i_rProperty ) else { // if the type does not match something is awry - OSL_ENSURE( 0, "strange type in control dependency" ); + OSL_FAIL( "strange type in control dependency" ); } } } @@ -1639,7 +1635,7 @@ sal_Bool PrinterController::getBoolProperty( const rtl::OUString& i_rProperty, s Any PrinterOptionsHelper::getValue( const rtl::OUString& i_rPropertyName ) const { Any aRet; - std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = m_aPropertyMap.find( i_rPropertyName ); if( it != m_aPropertyMap.end() ) aRet = it->second; @@ -1654,7 +1650,7 @@ void PrinterOptionsHelper::setValue( const rtl::OUString& i_rPropertyName, const bool PrinterOptionsHelper::hasProperty( const rtl::OUString& i_rPropertyName ) const { Any aRet; - std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = m_aPropertyMap.find( i_rPropertyName ); return it != m_aPropertyMap.end(); } @@ -1694,7 +1690,7 @@ bool PrinterOptionsHelper::processProperties( const Sequence< PropertyValue >& i for( sal_Int32 i = 0; i < nElements; i++ ) { bool bElementChanged = false; - std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it = + boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it = m_aPropertyMap.find( pVals[ i ].Name ); if( it != m_aPropertyMap.end() ) { @@ -1945,3 +1941,5 @@ Any PrinterOptionsHelper::getEditControlOpt( const rtl::OUString& i_rTitle, i_rControlOptions ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index 08c94bc2ebc6..21c82cd51f3a 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -967,3 +968,5 @@ ImplRegionBand* ImplRegionBand::SplitBand (const sal_Int32 nY) return pLowerBand; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index fe2e0f763e08..3992b774630d 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,10 +34,8 @@ #include <tools/vcompat.hxx> #include <tools/stream.hxx> #include <tools/debug.hxx> - #include <vcl/region.hxx> #include <vcl/regband.hxx> -#include <vcl/salbtype.hxx> #include <region.h> @@ -660,7 +659,7 @@ sal_Bool ImplRegion::InsertPoint( const Point &rPoint, long nLineID, mpLastCheckedBand = mpLastCheckedBand->mpNextBand; } - DBG_ERROR( "ImplRegion::InsertPoint reached the end of the list!" ); + OSL_FAIL( "ImplRegion::InsertPoint reached the end of the list!" ); } else { @@ -677,10 +676,10 @@ sal_Bool ImplRegion::InsertPoint( const Point &rPoint, long nLineID, mpLastCheckedBand = mpLastCheckedBand->mpPrevBand; } - DBG_ERROR( "ImplRegion::InsertPoint reached the beginning of the list!" ); + OSL_FAIL( "ImplRegion::InsertPoint reached the beginning of the list!" ); } - DBG_ERROR( "ImplRegion::InsertPoint point not inserted!" ); + OSL_FAIL( "ImplRegion::InsertPoint point not inserted!" ); // reinitialize pointer (should never be reached!) mpLastCheckedBand = mpFirstBand; @@ -893,7 +892,7 @@ void ImplRegion::Union( long nLeft, long nTop, long nRight, long nBottom ) { if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) ) { - DBG_ERROR( "ImplRegion::Union() - Bands not sorted!" ); + OSL_FAIL( "ImplRegion::Union() - Bands not sorted!" ); } pBand = pBand->mpNextBand; } @@ -930,7 +929,7 @@ void ImplRegion::Exclude( long nLeft, long nTop, long nRight, long nBottom ) { if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) ) { - DBG_ERROR( "ImplRegion::Exclude() - Bands not sorted!" ); + OSL_FAIL( "ImplRegion::Exclude() - Bands not sorted!" ); } pBand = pBand->mpNextBand; } @@ -967,7 +966,7 @@ void ImplRegion::XOr( long nLeft, long nTop, long nRight, long nBottom ) { if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) ) { - DBG_ERROR( "ImplRegion::XOr() - Bands not sorted!" ); + OSL_FAIL( "ImplRegion::XOr() - Bands not sorted!" ); } pBand = pBand->mpNextBand; } @@ -1058,12 +1057,12 @@ sal_Bool ImplRegion::OptimizeBandList() "Exiting ImplRegion::OptimizeBandList(): empty band in region!" ); if ( pBand->mnYBottom < pBand->mnYTop ) - DBG_ERROR( "ImplRegion::OptimizeBandList(): YBottomBoundary < YTopBoundary" ); + OSL_FAIL( "ImplRegion::OptimizeBandList(): YBottomBoundary < YTopBoundary" ); if ( pBand->mpNextBand ) { if ( pBand->mnYBottom >= pBand->mpNextBand->mnYTop ) - DBG_ERROR( "ImplRegion::OptimizeBandList(): overlapping bands in region!" ); + OSL_FAIL( "ImplRegion::OptimizeBandList(): overlapping bands in region!" ); } pBand = pBand->mpNextBand; @@ -2654,7 +2653,7 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion ) if( rIStrm.IsEof() ) { - DBG_ERROR( "premature end of region stream" ); + OSL_FAIL( "premature end of region stream" ); delete rRegion.mpImplRegion; rRegion.mpImplRegion = (ImplRegion*)&aImplEmptyRegion; return rIStrm; @@ -3102,3 +3101,5 @@ Region Region::GetRegionFromPolyPolygon( const PolyPolygon& rPolyPoly ) } return aResult; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 0b6677b2426f..bf0f7523a453 100755..100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -827,3 +828,4 @@ void SalGraphics::AddDevFontSubstitute( OutputDevice* pOutDev, pOutDev->ImplAddDevFontSubstitute( rFontName, rReplaceFontName, nFlags ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 3a2251da5d84..9679170df9b9 100755..100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,7 +37,6 @@ #include <salgdi.hxx> #include <sallayout.hxx> - #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> @@ -97,11 +97,6 @@ bool IsDiacritic( sal_UCS4 nChar ) {0x0590, 0x05BE}, {0x05BF, 0x05C0}, {0x05C1, 0x05C3}, {0x05C4, 0x05C6}, {0x05C7, 0x05C8}, {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DD}, {0x06DF, 0x06E5}, {0x06E7, 0x06E9}, {0x06EA,0x06EF}, {0x0730, 0x074D}, {0x07A6, 0x07B1}, {0x07EB, 0x07F4}, -#if 0 // all known fonts have zero-width diacritics already, so no need to query it - {0x0900, 0x0904}, {0x093C, 0x093D}, {0x0941, 0x0948}, {0x094D, 0x0950}, {0x0951, 0x0958}, - {0x0980, 0x0985}, {0x09BC, 0x09BD}, {0x09C1, 0x09C7}, {0x09CD, 0x09CE}, {0x09E2, 0x09E6}, - {0x0A00, 0x0A05}, {0x0A3C, 0x0A59}, //... -#endif {0x1DC0, 0x1E00}, {0x205F, 0x2070}, {0x20D0, 0x2100}, {0xFB1E, 0xFB1F} @@ -152,48 +147,6 @@ int GetVerticalFlags( sal_UCS4 nChar ) sal_UCS4 GetVerticalChar( sal_UCS4 ) { return 0; // #i14788# input method is responsible vertical char changes - -#if 0 - int nVert = 0; - switch( nChar ) - { - // #104627# special treatment for some unicodes - case 0x002C: nVert = 0x3001; break; - case 0x002E: nVert = 0x3002; break; - /* - // to few fonts have the compatibility forms, using - // them will then cause more trouble than good - // TODO: decide on a font specific basis - case 0x2018: nVert = 0xFE41; break; - case 0x2019: nVert = 0xFE42; break; - case 0x201C: nVert = 0xFE43; break; - case 0x201D: nVert = 0xFE44; break; - // CJK compatibility forms - case 0x2025: nVert = 0xFE30; break; - case 0x2014: nVert = 0xFE31; break; - case 0x2013: nVert = 0xFE32; break; - case 0x005F: nVert = 0xFE33; break; - case 0x0028: nVert = 0xFE35; break; - case 0x0029: nVert = 0xFE36; break; - case 0x007B: nVert = 0xFE37; break; - case 0x007D: nVert = 0xFE38; break; - case 0x3014: nVert = 0xFE39; break; - case 0x3015: nVert = 0xFE3A; break; - case 0x3010: nVert = 0xFE3B; break; - case 0x3011: nVert = 0xFE3C; break; - case 0x300A: nVert = 0xFE3D; break; - case 0x300B: nVert = 0xFE3E; break; - case 0x3008: nVert = 0xFE3F; break; - case 0x3009: nVert = 0xFE40; break; - case 0x300C: nVert = 0xFE41; break; - case 0x300D: nVert = 0xFE42; break; - case 0x300E: nVert = 0xFE43; break; - case 0x300F: nVert = 0xFE44; break; - */ - } - - return nVert; -#endif } // ----------------------------------------------------------------------- @@ -370,17 +323,6 @@ sal_UCS4 GetLocalizedChar( sal_UCS4 nChar, LanguageType eLang ) case LANGUAGE_TIBETAN & LANGUAGE_MASK_PRIMARY: nOffset = 0x0F20 - '0'; // tibetan break; -#if 0 // TODO: use language type for these digit substitutions? - // TODO case: - nOffset = 0x2776 - '0'; // dingbat circled - break; - // TODO case: - nOffset = 0x2070 - '0'; // superscript - break; - // TODO case: - nOffset = 0x2080 - '0'; // subscript - break; -#endif } nChar += nOffset; @@ -839,12 +781,6 @@ int SalLayout::CalcAsianKerning( sal_UCS4 c, bool bLeft, bool /*TODO:? bVertical nResult = nTable[ c - 0x3000 ]; else switch( c ) { -#if 0 // TODO: enable it for real-fixed-width fonts? - case ':': case ';': case '!': - if( !bVertical ) - nResult = bLeft ? -1 : +1; // 25% left and right - break; -#endif case 0x30FB: nResult = bLeft ? -1 : +1; // 25% left/right/top/bottom break; @@ -950,10 +886,6 @@ bool SalLayout::IsSpacingGlyph( sal_GlyphId nGlyph ) const const ImplFontData* SalLayout::GetFallbackFontData( sal_GlyphId /*nGlyphId*/ ) const { -#if 0 - int nFallbackLevel = (nGlyphId & GF_FONTMASK) >> GF_FONTSHIFT - assert( nFallbackLevel == 0 ); -#endif return NULL; } @@ -2321,3 +2253,5 @@ bool MultiSalLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rRect ) co } // ======================================================================= + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index d1cf56f6a044..d2b794af02d6 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -212,7 +213,7 @@ static void ImplTCToTC( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffer if( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) == BMP_FORMAT_24BIT_TC_BGR ) { BitmapColor aCol; - sal_uInt8* pPixel; + sal_uInt8* pPixel = NULL; for( long nActY = 0, nMapY; nActY < nHeight; nActY++ ) { @@ -325,7 +326,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec // initialize pFncGetPixel to something valid that is // least likely to crash pFncGetPixel = BitmapReadAccess::GetPixelFor_1BIT_MSB_PAL; - DBG_ERROR( "unknown read format" ); + OSL_FAIL( "unknown read format" ); break; } @@ -356,7 +357,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec // least likely to crash pFncSetPixel = BitmapReadAccess::SetPixelFor_1BIT_MSB_PAL; pDstBuffer->mnBitCount = 1; - DBG_ERROR( "unknown write format" ); + OSL_FAIL( "unknown write format" ); break; } @@ -514,3 +515,5 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec return pDstBuffer; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx index 50048831f3b3..8f50802c9431 100644 --- a/vcl/source/gdi/salnativewidgets-none.cxx +++ b/vcl/source/gdi/salnativewidgets-none.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,7 @@ #include <salgdi.hxx> -using namespace rtl; +using ::rtl::OUString; /**************************************************************** * Placeholder for no native widgets @@ -132,3 +133,4 @@ sal_Bool SalGraphics::getNativeControlRegion( ControlType, return( sal_False ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index fa674d1a712b..e1a2667a8f58 100755..100644 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -227,7 +228,7 @@ namespace vcl aTrace.append( ", " ); } aTrace.append( ")" ); - OSL_TRACE( aTrace.makeStringAndClear().getStr() ); + OSL_TRACE( "%s", aTrace.makeStringAndClear().getStr() ); } #endif return nTextWidth; @@ -385,3 +386,5 @@ namespace vcl //........................................................................ } // namespace vcl //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index cfea7205ee34..5e693d23abf5 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -139,7 +140,7 @@ VirtualDevice::VirtualDevice( sal_uInt16 nBitCount ) : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { - DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); + OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount ); } @@ -150,7 +151,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { - DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); + OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); ImplInitVirDev( &rCompDev, 1, 1, nBitCount ); } @@ -161,7 +162,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { - DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); + OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); ImplInitVirDev( &rCompDev, 1, 1, nBitCount ); @@ -175,7 +176,7 @@ VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCo : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { - DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); + OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount, pData ); } @@ -184,7 +185,7 @@ VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCo VirtualDevice::~VirtualDevice() { - DBG_TRACE( "VirtualDevice::~VirtualDevice()" ); + OSL_TRACE( "VirtualDevice::~VirtualDevice()" ); ImplSVData* pSVData = ImplGetSVData(); @@ -209,7 +210,7 @@ VirtualDevice::~VirtualDevice() sal_Bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase ) { - DBG_TRACE3( "VirtualDevice::ImplSetOutputSizePixel( %ld, %ld, %d )", rNewSize.Width(), rNewSize.Height(), (int)bErase ); + OSL_TRACE( "VirtualDevice::ImplSetOutputSizePixel( %ld, %ld, %d )", rNewSize.Width(), rNewSize.Height(), (int)bErase ); if ( !mpVirDev ) return sal_False; @@ -446,3 +447,4 @@ void VirtualDevice::Compat_ZeroExtleadBug() // ----------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index aa7c421dbc65..a24d3b0cbd66 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -640,3 +641,5 @@ SvStream& operator<<( SvStream& rOStm, const Wallpaper& rWallpaper ) { return( rOStm << *rWallpaper.mpImplWallpaper ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |