diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:24:12 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:24:12 +0100 |
commit | c578d1c81274a1c0e5bdbdf5654bb4e186afdf49 (patch) | |
tree | 2345617c2a5bbbc7638d233723be2250b54d0bad /filter | |
parent | 1099ae1c16cd8323d877e894d8ce213ef8e1c349 (diff) |
More loplugin:cstylecast: filter
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: I39cc98d11a608d5fdad11c621b4cbde285204095
Diffstat (limited to 'filter')
48 files changed, 763 insertions, 763 deletions
diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx index 8b6db4f5fe0b..f67fb4114b8a 100644 --- a/filter/source/config/cache/cacheitem.cxx +++ b/filter/source/config/cache/cacheitem.cxx @@ -88,7 +88,7 @@ void CacheItem::validateUINames(const OUString& sActLocale) css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyValueList() { - sal_Int32 c = (sal_Int32)size(); + sal_Int32 c = static_cast<sal_Int32>(size()); sal_Int32 i = 0; css::uno::Sequence< css::beans::PropertyValue > lList(c); diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 13f779e4a533..1a00245c2ce3 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -1362,7 +1362,7 @@ void FilterCache::impl_load(EFillState eRequiredState) } // update fill state. Note: it's a bit field, which combines different parts. - m_eFillState = (EFillState) ((sal_Int32)m_eFillState | (sal_Int32)eRequiredState); + m_eFillState = (EFillState) (static_cast<sal_Int32>(m_eFillState) | static_cast<sal_Int32>(eRequiredState)); // any data readed? // yes! => validate it and update optimized structures. diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index 2e425c27ed63..ef8faeec31b2 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -320,7 +320,7 @@ OUStringList FilterFactory::impl_queryMatchByDocumentService(const QueryTokenize // "iflags=-1" => not allowed // "iflags=0" => not useful // "iflags=283648" => only filter, which has set these flag field will be addressed - sal_Int32 nCheckValue = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, (sal_Int32)0); + sal_Int32 nCheckValue = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, sal_Int32(0)); if ( (nIFlags > 0 ) && ((nCheckValue & nIFlags) != nIFlags) @@ -379,7 +379,7 @@ class stlcomp_removeIfMatchFlags try { const CacheItem aFilter = m_pCache->getItem(FilterCache::E_FILTER, sFilter); - sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, ((sal_Int32)0)); + sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, (sal_Int32(0))); bool bMatch = false; if (m_bIFlags) diff --git a/filter/source/flash/impswfdialog.cxx b/filter/source/flash/impswfdialog.cxx index 1d15cc09d1db..ea920709901a 100644 --- a/filter/source/flash/impswfdialog.cxx +++ b/filter/source/flash/impswfdialog.cxx @@ -76,7 +76,7 @@ void ImpSWFDialog::dispose() Sequence< PropertyValue > ImpSWFDialog::GetFilterData() { - sal_Int32 nCompressMode = (sal_Int32)mpNumFldQuality->GetValue(); + sal_Int32 nCompressMode = static_cast<sal_Int32>(mpNumFldQuality->GetValue()); maConfigItem.WriteInt32( "CompressMode" , nCompressMode ); maConfigItem.WriteBool( "ExportAll", mpCheckExportAll->IsChecked() ); maConfigItem.WriteBool( "ExportBackgrounds", mpCheckExportBackgrounds->IsChecked() ); diff --git a/filter/source/flash/swfexporter.cxx b/filter/source/flash/swfexporter.cxx index 8b923b750f66..c56a6ea1871e 100644 --- a/filter/source/flash/swfexporter.cxx +++ b/filter/source/flash/swfexporter.cxx @@ -502,7 +502,7 @@ void FlashExporter::exportShapes( const Reference< XShapes >& xShapes, bool bStr { OSL_ENSURE( (xShapes->getCount() <= 0xffff), "overflow in FlashExporter::exportDrawPageContents()" ); - sal_uInt16 nShapeCount = (sal_uInt16)std::min( xShapes->getCount(), (sal_Int32)0xffff ); + sal_uInt16 nShapeCount = static_cast<sal_uInt16>(std::min( xShapes->getCount(), sal_Int32(0xffff) )); sal_uInt16 nShape; Reference< XShape > xShape; @@ -629,7 +629,7 @@ bool FlashExporter::getMetaFile( Reference< XComponent > const &xComponent, GDIM Sequence< PropertyValue > aFilterData(bExportAsJPEG ? 3 : 2); aFilterData[0].Name = "Version"; - aFilterData[0].Value <<= (sal_Int32)6000; + aFilterData[0].Value <<= sal_Int32(6000); aFilterData[1].Name = "PageNumber"; aFilterData[1].Value <<= mnPageNumber; diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx index aa288915ae8f..d32c417d4362 100644 --- a/filter/source/flash/swfwriter.cxx +++ b/filter/source/flash/swfwriter.cxx @@ -41,8 +41,8 @@ static sal_Int32 map100thmm( sal_Int32 n100thMM ) Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int32 nDocWidth, sal_Int32 nDocHeight, sal_Int32 nJPEGcompressMode ) : mnDocWidth( map100thmm(nDocWidth) ), mnDocHeight( map100thmm(nDocHeight) ), - mnDocXScale( (double)nTWIPWidthOutput / mnDocWidth ), - mnDocYScale( (double)nTWIPHeightOutput / mnDocHeight ), + mnDocXScale( static_cast<double>(nTWIPWidthOutput) / mnDocWidth ), + mnDocYScale( static_cast<double>(nTWIPHeightOutput) / mnDocHeight ), mpClipPolyPolygon( nullptr ), mpTag( nullptr ), mpSprite( nullptr ), @@ -60,7 +60,7 @@ Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int mpFontsStream = maFontsTempFile.GetStream( StreamMode::WRITE|StreamMode::TRUNC ); // define an invisible button with the size of a page - tools::Rectangle aRect( 0, 0, (long)( mnDocWidth * mnDocXScale ), (long)( mnDocHeight * mnDocYScale ) ); + tools::Rectangle aRect( 0, 0, static_cast<long>( mnDocWidth * mnDocXScale ), static_cast<long>( mnDocHeight * mnDocYScale ) ); tools::Polygon aPoly( aRect ); FillStyle aFill = FillStyle( Color(COL_WHITE) ); mnWhiteBackgroundShapeId = defineShape( aPoly, aFill ); diff --git a/filter/source/flash/swfwriter.hxx b/filter/source/flash/swfwriter.hxx index 7afb1718e431..7bb9d33b65cd 100644 --- a/filter/source/flash/swfwriter.hxx +++ b/filter/source/flash/swfwriter.hxx @@ -52,14 +52,14 @@ namespace tools inline sal_uInt16 uInt16_( sal_Int32 nValue ) { - OSL_ENSURE( (nValue >= 0) && ((sal_uInt32)nValue <= 0xffff), "overflow while converting sal_Int32 to sal_uInt16" ); - return (sal_uInt16)nValue; + OSL_ENSURE( (nValue >= 0) && (static_cast<sal_uInt32>(nValue) <= 0xffff), "overflow while converting sal_Int32 to sal_uInt16" ); + return static_cast<sal_uInt16>(nValue); } inline sal_Int16 Int16_( sal_Int32 nValue ) { OSL_ENSURE( (nValue >= -32768) && (nValue <= 32767), "overflow while converting sal_Int32 to sal_Int16" ); - return (sal_Int16)nValue; + return static_cast<sal_Int16>(nValue); } class VirtualDevice; diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index 429fcb7e1ca2..908faffb1f9f 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -57,8 +57,8 @@ Point Writer::map( const Point& rPoint ) const // AS: Produces a 'possible loss of data' warning that we can't fix without // hurting code readability. - retPoint.X() = (long)( retPoint.X() * mnDocXScale ); - retPoint.Y() = (long)( retPoint.Y() * mnDocYScale ); + retPoint.X() = static_cast<long>( retPoint.X() * mnDocXScale ); + retPoint.Y() = static_cast<long>( retPoint.Y() * mnDocYScale ); return retPoint; } @@ -72,8 +72,8 @@ Size Writer::map( const Size& rSize ) const // AS: Produces a 'possible loss of data' warning that we can't fix without // hurting code readability. - retSize.Width() = (long)( retSize.Width() * mnDocXScale ); - retSize.Height() = (long)( retSize.Height() * mnDocYScale ); + retSize.Width() = static_cast<long>( retSize.Width() * mnDocXScale ); + retSize.Height() = static_cast<long>( retSize.Height() * mnDocYScale ); return retSize; } @@ -229,7 +229,7 @@ void Writer::Impl_addCurvedEdgeRecord( BitStream& rBits, sal_Int16 control_dx, s std::max( getMaxBitsSigned( control_dx ), std::max( getMaxBitsSigned( control_dy ), std::max( getMaxBitsSigned( anchor_dx ), - std::max( getMaxBitsSigned( anchor_dy ), (sal_uInt16)3 ) ) ) ) ); + std::max( getMaxBitsSigned( anchor_dy ), sal_uInt16(3) ) ) ) ) ); rBits.writeUB( nBits - 2, 4 ); // Number of bits per value @@ -496,7 +496,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon { // todo: optimize me as this will generate a huge amount of duplicate polygons tools::PolyPolygon aPolyPoygon; - mpVDev->GetTextOutline( aPolyPoygon, rText, (sal_uInt16)nLen, nWidth, pDXArray ); + mpVDev->GetTextOutline( aPolyPoygon, rText, static_cast<sal_uInt16>(nLen), nWidth, pDXArray ); aPolyPoygon.Translate( rPos ); Impl_writePolyPolygon( aPolyPoygon, true, aTextColor, aTextColor ); } @@ -525,7 +525,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) ) { - const double fFactor = (double) nWidth / aNormSize.Width(); + const double fFactor = static_cast<double>(nWidth) / aNormSize.Width(); for( sal_Int32 i = 0; i < ( nLen - 1 ); i++ ) pDX[ i ] = FRound( pDX[ i ] * fFactor ); @@ -591,7 +591,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon const long n1 = aFont.GetFontSize().Width(); const long n2 = aMetric2.GetFontSize().Width(); - scale = (double)n1 / (double)n2; + scale = static_cast<double>(n1) / static_cast<double>(n2); } basegfx::B2DHomMatrix m(basegfx::utils::createRotateB2DHomMatrix(static_cast<double>(nOrientation) * F_PI1800)); @@ -623,7 +623,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon DBG_ASSERT( nLen <= 127, "TODO: handle text with more than 127 characters" ); // Glyph record - mpTag->addUI8( (sal_uInt8) nLen ); + mpTag->addUI8( static_cast<sal_uInt8>(nLen) ); BitStream aBits; @@ -642,7 +642,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon } aBits.writeUB( rFlashFont.getGlyph(rText[i],mpVDev), nGlyphBits ); - aBits.writeSB( Int16_(map( Size( (long)( nAdvance / scale ), 0 ) ).Width() ), nAdvanceBits ); + aBits.writeSB( Int16_(map( Size( static_cast<long>( nAdvance / scale ), 0 ) ).Width() ), nAdvanceBits ); } mpTag->addBits( aBits ); @@ -783,7 +783,7 @@ sal_uInt16 Writer::defineBitmap( const BitmapEx &bmpSource, sal_Int32 nJPEGQuali getBitmapData( bmpSource, pImageData, pAlphaData, width, height ); sal_uInt32 raw_size = width * height * 4; - uLongf compressed_size = raw_size + (sal_uInt32)(raw_size/100) + 12; + uLongf compressed_size = raw_size + static_cast<sal_uInt32>(raw_size/100) + 12; std::unique_ptr<sal_uInt8[]> pCompressed(new sal_uInt8[ compressed_size ]); #ifdef DBG_UTIL @@ -801,7 +801,7 @@ sal_uInt16 Writer::defineBitmap( const BitmapEx &bmpSource, sal_Int32 nJPEGQuali std::unique_ptr<sal_uInt8[]> pAlphaCompressed; if (bmpSource.IsAlpha() || bmpSource.IsTransparent()) { - alpha_compressed_size = uLongf(width * height + (sal_uInt32)(raw_size/100) + 12); + alpha_compressed_size = uLongf(width * height + static_cast<sal_uInt32>(raw_size/100) + 12); pAlphaCompressed.reset(new sal_uInt8[ compressed_size ]); #ifdef DBG_UTIL @@ -922,7 +922,7 @@ void Writer::Impl_writeImage( const BitmapEx& rBmpEx, const Point& rPt, const Si double qualityScale = (pixXScale + pixYScale)/2; - nJPEGQuality = (sal_Int32)( nJPEGQuality * qualityScale ); + nJPEGQuality = static_cast<sal_Int32>( nJPEGQuality * qualityScale ); if (nJPEGQuality < 10) nJPEGQuality += 3; @@ -1171,9 +1171,9 @@ bool Writer::Impl_writeStroke( SvtGraphicStroke const & rStroke ) Color aColor( mpVDev->GetLineColor() ); if( 0.0 != rStroke.getTransparency() ) - aColor.SetTransparency( sal::static_int_cast<sal_uInt8>( MinMax( (long int)( rStroke.getTransparency() * 0xff ), 0, 0xff ) ) ); + aColor.SetTransparency( sal::static_int_cast<sal_uInt8>( MinMax( static_cast<long int>( rStroke.getTransparency() * 0xff ), 0, 0xff ) ) ); - sal_uInt16 nShapeId = defineShape( aPolyPolygon, sal::static_int_cast<sal_uInt16>( mapRelative( (sal_Int32)( rStroke.getStrokeWidth() ) ) ), aColor ); + sal_uInt16 nShapeId = defineShape( aPolyPolygon, sal::static_int_cast<sal_uInt16>( mapRelative( static_cast<sal_Int32>( rStroke.getStrokeWidth() ) ) ), aColor ); maShapeIds.push_back( nShapeId ); return true; } @@ -1200,7 +1200,7 @@ bool Writer::Impl_writeFilling( SvtGraphicFill const & rFilling ) Color aColor( rFilling.getFillColor() ); if( 0.0 != rFilling.getTransparency() ) - aColor.SetTransparency( sal::static_int_cast<sal_uInt8>( MinMax( (long int)( rFilling.getTransparency() * 0xff ) , 0, 0xff ) ) ); + aColor.SetTransparency( sal::static_int_cast<sal_uInt8>( MinMax( static_cast<long int>( rFilling.getTransparency() * 0xff ) , 0, 0xff ) ) ); FillStyle aFillStyle( aColor ); @@ -1239,8 +1239,8 @@ bool Writer::Impl_writeFilling( SvtGraphicFill const & rFilling ) aMatrix.set(2, 2, 1.0); // scale bitmap - double XScale = aOldRect.GetWidth() ? (double)aNewRect.GetWidth()/aOldRect.GetWidth() : 1.0; - double YScale = aOldRect.GetHeight() ? (double)aNewRect.GetHeight()/aOldRect.GetHeight() : 1.0; + double XScale = aOldRect.GetWidth() ? static_cast<double>(aNewRect.GetWidth())/aOldRect.GetWidth() : 1.0; + double YScale = aOldRect.GetHeight() ? static_cast<double>(aNewRect.GetHeight())/aOldRect.GetHeight() : 1.0; aMatrix.scale( XScale, YScale ); @@ -1518,7 +1518,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) if( rPolyPoly.Count() ) { // convert transparence from percent into 0x00 - 0xff - sal_uInt8 nTransparence = (sal_uInt8) MinMax( FRound( pA->GetTransparence() * 2.55 ), 0, 255 ); + sal_uInt8 nTransparence = static_cast<sal_uInt8>(MinMax( FRound( pA->GetTransparence() * 2.55 ), 0, 255 )); Impl_writePolyPolygon( rPolyPoly, true, nTransparence ); } } @@ -1532,8 +1532,8 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) const Size aSrcSize( aTmpMtf.GetPrefSize() ); const Point aDestPt( pA->GetPoint() ); const Size aDestSize( pA->GetSize() ); - const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0; - const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0; + const double fScaleX = aSrcSize.Width() ? static_cast<double>(aDestSize.Width()) / aSrcSize.Width() : 1.0; + const double fScaleY = aSrcSize.Height() ? static_cast<double>(aDestSize.Height()) / aSrcSize.Height() : 1.0; long nMoveX, nMoveY; if( fScaleX != 1.0 || fScaleY != 1.0 ) @@ -1550,10 +1550,10 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) aTmpMtf.Move( nMoveX, nMoveY ); const Gradient& rGradient = pA->GetGradient(); - sal_uInt32 nLuminance = ((sal_Int32)rGradient.GetStartColor().GetLuminance() + (sal_Int32)rGradient.GetEndColor().GetLuminance() ) >> 1; + sal_uInt32 nLuminance = (static_cast<sal_Int32>(rGradient.GetStartColor().GetLuminance()) + static_cast<sal_Int32>(rGradient.GetEndColor().GetLuminance()) ) >> 1; sal_uInt8 nOldGlobalTransparency = mnGlobalTransparency; - mnGlobalTransparency = (sal_uInt8)MinMax( nLuminance, 0, 0xff ); + mnGlobalTransparency = static_cast<sal_uInt8>(MinMax( nLuminance, 0, 0xff )); mpVDev->Push(); Impl_writeActions( aTmpMtf ); diff --git a/filter/source/flash/swfwriter2.cxx b/filter/source/flash/swfwriter2.cxx index 3bbc4afe83bc..5cd41343cfd6 100644 --- a/filter/source/flash/swfwriter2.cxx +++ b/filter/source/flash/swfwriter2.cxx @@ -315,8 +315,8 @@ void Tag::writeMatrix( SvStream& rOut, const ::basegfx::B2DHomMatrix& rMatrix ) sal_uInt8 nTranslateBits = 16; aBits.writeUB( nTranslateBits, 5 ); - aBits.writeSB( (sal_Int16)rMatrix.get(0, 2), nTranslateBits ); // Translate X - aBits.writeSB( (sal_Int16)rMatrix.get(1, 2), nTranslateBits ); // Translate Y + aBits.writeSB( static_cast<sal_Int16>(rMatrix.get(0, 2)), nTranslateBits ); // Translate X + aBits.writeSB( static_cast<sal_Int16>(rMatrix.get(1, 2)), nTranslateBits ); // Translate Y aBits.writeTo( rOut ); } @@ -374,10 +374,10 @@ void Sprite::addTag( Tag* pNewTag ) sal_uInt32 swf::getFixed( double fValue ) { - sal_Int16 nUpper = (sal_Int16)floor(fValue); - sal_uInt16 nLower = (sal_uInt16)((fValue - floor(fValue))*0x10000); + sal_Int16 nUpper = static_cast<sal_Int16>(floor(fValue)); + sal_uInt16 nLower = static_cast<sal_uInt16>((fValue - floor(fValue))*0x10000); - sal_uInt32 temp = ((sal_Int32)nUpper)<<16; + sal_uInt32 temp = static_cast<sal_Int32>(nUpper)<<16; temp |= nLower; return temp; @@ -563,8 +563,8 @@ void FillStyle::Impl_addGradient( Tag* pTag ) const double tx = ( maGradient.GetOfsX() * 32768.0 ) / 100.0; double ty = ( maGradient.GetOfsY() * 32768.0 ) / 100.0; - double scalex = (double)maBoundRect.GetWidth() / 32768.0; - double scaley = (double)maBoundRect.GetHeight() / 32768.0; + double scalex = static_cast<double>(maBoundRect.GetWidth()) / 32768.0; + double scaley = static_cast<double>(maBoundRect.GetHeight()) / 32768.0; m.scale( 1.2, 1.2 ); @@ -594,8 +594,8 @@ void FillStyle::Impl_addGradient( Tag* pTag ) const aGradientRecords.emplace_back( 0x00, maGradient.GetEndColor() ); aGradientRecords.emplace_back( 0x80, maGradient.GetStartColor() ); aGradientRecords.emplace_back( 0xff, maGradient.GetEndColor() ); - double scalex = (double)maBoundRect.GetWidth() / 32768.0; - double scaley = (double)maBoundRect.GetHeight() / 32768.0; + double scalex = static_cast<double>(maBoundRect.GetWidth()) / 32768.0; + double scaley = static_cast<double>(maBoundRect.GetHeight()) / 32768.0; m.translate( 32768.0 / 2.0, 32768.0 / 2.0 ); m.scale( scalex, scaley ); } @@ -606,8 +606,8 @@ void FillStyle::Impl_addGradient( Tag* pTag ) const { aGradientRecords.emplace_back( 0x00, maGradient.GetStartColor() ); aGradientRecords.emplace_back( 0xff, maGradient.GetEndColor() ); - double scalex = (double)maBoundRect.GetWidth() / 32768.0; - double scaley = (double)maBoundRect.GetHeight() / 32768.0; + double scalex = static_cast<double>(maBoundRect.GetWidth()) / 32768.0; + double scaley = static_cast<double>(maBoundRect.GetHeight()) / 32768.0; m.scale( scalex, scaley ); diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx index aed662ba4cbd..a34632d9061f 100644 --- a/filter/source/graphicfilter/egif/egif.cxx +++ b/filter/source/graphicfilter/egif/egif.cxx @@ -211,7 +211,7 @@ void GIFWriter::WriteAnimation( const Animation& rAnimation ) const double fStep = 100. / nCount; nMinPercent = 0; - nMaxPercent = (sal_uInt32)fStep; + nMaxPercent = static_cast<sal_uInt32>(fStep); for( sal_uInt16 i = 0; i < nCount; i++ ) { @@ -220,7 +220,7 @@ void GIFWriter::WriteAnimation( const Animation& rAnimation ) WriteBitmapEx( rAnimBmp.aBmpEx, rAnimBmp.aPosPix, true, rAnimBmp.nWait, rAnimBmp.eDisposal ); nMinPercent = nMaxPercent; - nMaxPercent = (sal_uInt32)(nMaxPercent + fStep); + nMaxPercent = static_cast<sal_uInt32>(nMaxPercent + fStep); } } } @@ -297,8 +297,8 @@ void GIFWriter::WriteGlobalHeader( const Size& rSize ) if( bStatus ) { // 256 colors - const sal_uInt16 nWidth = (sal_uInt16) rSize.Width(); - const sal_uInt16 nHeight = (sal_uInt16) rSize.Height(); + const sal_uInt16 nWidth = static_cast<sal_uInt16>(rSize.Width()); + const sal_uInt16 nHeight = static_cast<sal_uInt16>(rSize.Height()); const sal_uInt8 cFlags = 128 | ( 7 << 4 ); // write values @@ -325,7 +325,7 @@ void GIFWriter::WriteLoopExtension( const Animation& rAnimation ) { DBG_ASSERT( rAnimation.Count() > 0, "Animation has no bitmaps!" ); - sal_uInt16 nLoopCount = (sal_uInt16) rAnimation.GetLoopCount(); + sal_uInt16 nLoopCount = static_cast<sal_uInt16>(rAnimation.GetLoopCount()); // if only one run should take place // the LoopExtension won't be written @@ -337,8 +337,8 @@ void GIFWriter::WriteLoopExtension( const Animation& rAnimation ) if( nLoopCount ) nLoopCount--; - const sal_uInt8 cLoByte = (sal_uInt8) nLoopCount; - const sal_uInt8 cHiByte = (sal_uInt8) ( nLoopCount >> 8 ); + const sal_uInt8 cLoByte = static_cast<sal_uInt8>(nLoopCount); + const sal_uInt8 cHiByte = static_cast<sal_uInt8>( nLoopCount >> 8 ); m_rGIF.WriteUChar( 0x21 ); m_rGIF.WriteUChar( 0xff ); @@ -375,7 +375,7 @@ void GIFWriter::WriteImageExtension( long nTimer, Disposal eDisposal ) { if( bStatus ) { - const sal_uInt16 nDelay = (sal_uInt16) nTimer; + const sal_uInt16 nDelay = static_cast<sal_uInt16>(nTimer); sal_uInt8 cFlags = 0; // set Transparency-Flag @@ -406,11 +406,11 @@ void GIFWriter::WriteLocalHeader() { if( bStatus ) { - const sal_uInt16 nPosX = (sal_uInt16) nActX; - const sal_uInt16 nPosY = (sal_uInt16) nActY; - const sal_uInt16 nWidth = (sal_uInt16) m_pAcc->Width(); - const sal_uInt16 nHeight = (sal_uInt16) m_pAcc->Height(); - sal_uInt8 cFlags = (sal_uInt8) ( m_pAcc->GetBitCount() - 1 ); + const sal_uInt16 nPosX = static_cast<sal_uInt16>(nActX); + const sal_uInt16 nPosY = static_cast<sal_uInt16>(nActY); + const sal_uInt16 nWidth = static_cast<sal_uInt16>(m_pAcc->Width()); + const sal_uInt16 nHeight = static_cast<sal_uInt16>(m_pAcc->Height()); + sal_uInt8 cFlags = static_cast<sal_uInt8>( m_pAcc->GetBitCount() - 1 ); // set Interlaced-Flag if( nInterlaced ) diff --git a/filter/source/graphicfilter/egif/giflzwc.cxx b/filter/source/graphicfilter/egif/giflzwc.cxx index 8fc3718f5197..a660007c7a36 100644 --- a/filter/source/graphicfilter/egif/giflzwc.cxx +++ b/filter/source/graphicfilter/egif/giflzwc.cxx @@ -53,7 +53,7 @@ inline void GIFImageDataOutputStream::FlushBitsBufsFullBytes() if( nBlockBufSize==255 ) FlushBlockBuf(); - pBlockBuf[nBlockBufSize++] = (sal_uInt8) nBitsBuf; + pBlockBuf[nBlockBufSize++] = static_cast<sal_uInt8>(nBitsBuf); nBitsBuf >>= 8; nBitsBufSize -= 8; } @@ -65,7 +65,7 @@ inline void GIFImageDataOutputStream::WriteBits( sal_uInt16 nCode, sal_uInt16 nC if( nBitsBufSize+nCodeLen>32 ) FlushBitsBufsFullBytes(); - nBitsBuf |= (sal_uInt32)nCode << nBitsBufSize; + nBitsBuf |= static_cast<sal_uInt32>(nCode) << nBitsBufSize; nBitsBufSize = nBitsBufSize + nCodeLen; } @@ -139,13 +139,13 @@ void GIFLZWCompressor::StartCompression( SvStream& rGIF, sal_uInt16 nPixelSize ) nTableSize=nEOICode+1; nCodeSize=nDataSize+1; - pIDOS=new GIFImageDataOutputStream(rGIF,(sal_uInt8)nDataSize); + pIDOS=new GIFImageDataOutputStream(rGIF,static_cast<sal_uInt8>(nDataSize)); pTable=new GIFLZWCTreeNode[4096]; for (i=0; i<4096; i++) { pTable[i].pBrother = pTable[i].pFirstChild = nullptr; - pTable[i].nValue = (sal_uInt8) ( pTable[i].nCode = i ); + pTable[i].nValue = static_cast<sal_uInt8>( pTable[i].nCode = i ); } pPrefix = nullptr; @@ -195,7 +195,7 @@ void GIFLZWCompressor::Compress(sal_uInt8* pSrc, sal_uInt32 nSize) } else { - if(nTableSize==(sal_uInt16)(1<<nCodeSize)) + if(nTableSize==static_cast<sal_uInt16>(1<<nCodeSize)) nCodeSize++; p=pTable+(nTableSize++); diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 55965ae6f3ba..4afe1f137e5f 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -576,7 +576,7 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview ) ImplWriteLine( "%%BeginPageSetup" ); ImplWriteLine( "%%EndPageSetup" ); ImplWriteLine( "pum" ); - ImplScale( (double)aSizePoint.Width() / (double)pMTF->GetPrefSize().Width(), (double)aSizePoint.Height() / (double)pMTF->GetPrefSize().Height() ); + ImplScale( static_cast<double>(aSizePoint.Width()) / static_cast<double>(pMTF->GetPrefSize().Width()), static_cast<double>(aSizePoint.Height()) / static_cast<double>(pMTF->GetPrefSize().Height()) ); ImplWriteDouble( 0 ); ImplWriteDouble( -pMTF->GetPrefSize().Height() ); ImplWriteLine( "t" ); @@ -1174,8 +1174,8 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) const Size aSrcSize( aTmpMtf.GetPrefSize() ); const Point aDestPt( pA->GetPoint() ); const Size aDestSize( pA->GetSize() ); - const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0; - const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0; + const double fScaleX = aSrcSize.Width() ? static_cast<double>(aDestSize.Width()) / aSrcSize.Width() : 1.0; + const double fScaleY = aSrcSize.Height() ? static_cast<double>(aDestSize.Height()) / aSrcSize.Height() : 1.0; long nMoveX, nMoveY; if( fScaleX != 1.0 || fScaleY != 1.0 ) @@ -1257,7 +1257,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) bSkipSequence = false; if ( aStartArrow.Count() || aEndArrow.Count() ) bSkipSequence = false; - if ( (sal_uInt32)eJT > 2 ) + if ( static_cast<sal_uInt32>(eJT) > 2 ) bSkipSequence = false; if ( l_aDashArray.size() && ( fStrokeWidth != 0.0 ) ) bSkipSequence = false; @@ -1941,7 +1941,7 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons if ( nHeightLeft ) { nHeightLeft++; - aSourcePos.Y() = (long) ( rPoint.Y() + ( nYHeightOrg * ( nHeightOrg - nHeightLeft ) ) / nHeightOrg ); + aSourcePos.Y() = static_cast<long>( rPoint.Y() + ( nYHeightOrg * ( nHeightOrg - nHeightLeft ) ) / nHeightOrg ); } } } @@ -1953,9 +1953,9 @@ void PSWriter::ImplWriteCharacter( sal_Char nChar ) case '(' : case ')' : case '\\' : - ImplWriteByte( (sal_uInt8)'\\', PS_NONE ); + ImplWriteByte( sal_uInt8('\\'), PS_NONE ); } - ImplWriteByte( (sal_uInt8)nChar, PS_NONE ); + ImplWriteByte( static_cast<sal_uInt8>(nChar), PS_NONE ); } void PSWriter::ImplWriteString( const OString& rString, VirtualDevice const & rVDev, const long* pDXArry, bool bStretch ) @@ -2175,8 +2175,8 @@ void PSWriter::ImplGetMapMode( const MapMode& rMapMode ) { ImplWriteLine( "tm setmatrix" ); double fMul = ImplGetScaling(rMapMode); - double fScaleX = (double)rMapMode.GetScaleX() * fMul; - double fScaleY = (double)rMapMode.GetScaleY() * fMul; + double fScaleX = static_cast<double>(rMapMode.GetScaleX()) * fMul; + double fScaleY = static_cast<double>(rMapMode.GetScaleY()) * fMul; ImplTranslate( rMapMode.GetOrigin().X() * fScaleX, rMapMode.GetOrigin().Y() * fScaleY ); ImplScale( fScaleX, fScaleY ); } @@ -2276,13 +2276,13 @@ void PSWriter::ImplWriteLineInfo( double fLWidth, double fMLimit, if ( eLineCap != eLCap ) { eLineCap = eLCap; - ImplWriteLong( (sal_Int32)eLineCap ); + ImplWriteLong( static_cast<sal_Int32>(eLineCap) ); ImplWriteLine( "lc", PS_SPACE ); } if ( eJoinType != eJoin ) { eJoinType = eJoin; - ImplWriteLong( (sal_Int32)eJoinType ); + ImplWriteLong( static_cast<sal_Int32>(eJoinType) ); ImplWriteLine( "lj", PS_SPACE ); } if ( eJoinType == SvtGraphicStroke::joinMiter ) @@ -2363,8 +2363,8 @@ void PSWriter::ImplWriteLong(sal_Int32 nNumber, sal_uLong nMode) void PSWriter::ImplWriteDouble( double fNumber ) { - sal_Int32 nPTemp = (sal_Int32)fNumber; - sal_Int32 nATemp = labs( (sal_Int32)( ( fNumber - nPTemp ) * 100000 ) ); + sal_Int32 nPTemp = static_cast<sal_Int32>(fNumber); + sal_Int32 nATemp = labs( static_cast<sal_Int32>( ( fNumber - nPTemp ) * 100000 ) ); if ( !nPTemp && nATemp && ( fNumber < 0.0 ) ) mpPS->WriteChar( '-' ); @@ -2477,12 +2477,12 @@ inline void PSWriter::WriteBits( sal_uInt16 nCode, sal_uInt16 nCodeLen ) nOffset -= nCodeLen; while ( nOffset < 24 ) { - ImplWriteHexByte( (sal_uInt8)( dwShift >> 24 ) ); + ImplWriteHexByte( static_cast<sal_uInt8>( dwShift >> 24 ) ); dwShift <<= 8; nOffset += 8; } if ( nCode == 257 && nOffset != 32 ) - ImplWriteHexByte( (sal_uInt8)( dwShift >> 24 ) ); + ImplWriteHexByte( static_cast<sal_uInt8>( dwShift >> 24 ) ); } void PSWriter::StartCompression() @@ -2503,7 +2503,7 @@ void PSWriter::StartCompression() for ( i = 0; i < 4096; i++ ) { pTable[ i ].pBrother = pTable[ i ].pFirstChild = nullptr; - pTable[ i ].nValue = (sal_uInt8)( pTable[ i ].nCode = i ); + pTable[ i ].nValue = static_cast<sal_uInt8>( pTable[ i ].nCode = i ); } pPrefix = nullptr; WriteBits( nClearCode, nCodeSize ); @@ -2546,7 +2546,7 @@ void PSWriter::Compress( sal_uInt8 nCompThis ) } else { - if( nTableSize == (sal_uInt16)( ( 1 << nCodeSize ) - 1 ) ) + if( nTableSize == static_cast<sal_uInt16>( ( 1 << nCodeSize ) - 1 ) ) nCodeSize++; p = pTable + ( nTableSize++ ); diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx index 1a10eb540b38..6b21e39b90a7 100644 --- a/filter/source/graphicfilter/etiff/etiff.cxx +++ b/filter/source/graphicfilter/etiff/etiff.cxx @@ -390,7 +390,7 @@ void TIFFWriter::ImplWriteBody() if (!( nShift & 1 )) nTemp = ( mpAcc->GetPixelIndex( y, x ) << 4 ); else - Compress( (sal_uInt8)( nTemp | ( mpAcc->GetPixelIndex( y, x ) & 0xf ) ) ); + Compress( static_cast<sal_uInt8>( nTemp | ( mpAcc->GetPixelIndex( y, x ) & 0xf ) ) ); } if ( nShift & 1 ) Compress( nTemp ); @@ -410,13 +410,13 @@ void TIFFWriter::ImplWriteBody() j |= ( ( ~mpAcc->GetPixelIndex( y, x ) ) & 1 ); if ( j & 0x100 ) { - Compress( (sal_uInt8)j ); + Compress( static_cast<sal_uInt8>(j) ); j = 1; } } if ( j != 1 ) { - Compress( (sal_uInt8)(j << ( ( ( x & 7) ^ 7 ) + 1 ) ) ); + Compress( static_cast<sal_uInt8>(j << ( ( ( x & 7) ^ 7 ) + 1 ) ) ); j = 1; } } @@ -501,7 +501,7 @@ void TIFFWriter::StartCompression() for ( i = 0; i < 4096; i++) { pTable[ i ].pBrother = pTable[ i ].pFirstChild = nullptr; - pTable[ i ].nValue = (sal_uInt8)( pTable[ i ].nCode = i ); + pTable[ i ].nValue = static_cast<sal_uInt8>( pTable[ i ].nCode = i ); } pPrefix = nullptr; @@ -546,7 +546,7 @@ void TIFFWriter::Compress( sal_uInt8 nCompThis ) } else { - if( nTableSize == (sal_uInt16)( ( 1 << nCodeSize ) - 1 ) ) + if( nTableSize == static_cast<sal_uInt16>( ( 1 << nCodeSize ) - 1 ) ) nCodeSize++; p = pTable + ( nTableSize++ ); diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx index 7c382906fe0c..b58d5266ad84 100644 --- a/filter/source/graphicfilter/icgm/actimpr.cxx +++ b/filter/source/graphicfilter/icgm/actimpr.cxx @@ -119,9 +119,9 @@ bool CGMImpressOutAct::ImplCreateShape( const OUString& rType ) void CGMImpressOutAct::ImplSetOrientation( FloatPoint const & rRefPoint, double rOrientation ) { - maXPropSet->setPropertyValue( "RotationPointX", uno::Any((sal_Int32)rRefPoint.X) ); - maXPropSet->setPropertyValue( "RotationPointY", uno::Any((sal_Int32)rRefPoint.Y) ); - maXPropSet->setPropertyValue( "RotateAngle", uno::Any((sal_Int32)( rOrientation * 100.0 )) ); + maXPropSet->setPropertyValue( "RotationPointX", uno::Any(static_cast<sal_Int32>(rRefPoint.X)) ); + maXPropSet->setPropertyValue( "RotationPointY", uno::Any(static_cast<sal_Int32>(rRefPoint.Y)) ); + maXPropSet->setPropertyValue( "RotateAngle", uno::Any(static_cast<sal_Int32>( rOrientation * 100.0 )) ); } @@ -146,9 +146,9 @@ void CGMImpressOutAct::ImplSetLineBundle() else fLineWidth = mpCGM->pElement->aLineBundle.nLineWidth; - maXPropSet->setPropertyValue( "LineColor", uno::Any((sal_Int32)nLineColor) ); + maXPropSet->setPropertyValue( "LineColor", uno::Any(static_cast<sal_Int32>(nLineColor)) ); - maXPropSet->setPropertyValue( "LineWidth", uno::Any((sal_Int32)fLineWidth) ); + maXPropSet->setPropertyValue( "LineWidth", uno::Any(static_cast<sal_Int32>(fLineWidth)) ); switch( eLineType ) { @@ -216,11 +216,11 @@ void CGMImpressOutAct::ImplSetFillBundle() else nFillColor = mpCGM->pElement->aFillBundle.GetColor(); if ( mpCGM->pElement->nAspectSourceFlags & ASF_HATCHINDEX ) - nHatchIndex = (sal_uInt32)mpCGM->pElement->pFillBundle->nFillHatchIndex; + nHatchIndex = static_cast<sal_uInt32>(mpCGM->pElement->pFillBundle->nFillHatchIndex); else - nHatchIndex = (sal_uInt32)mpCGM->pElement->aFillBundle.nFillHatchIndex; + nHatchIndex = static_cast<sal_uInt32>(mpCGM->pElement->aFillBundle.nFillHatchIndex); - maXPropSet->setPropertyValue( "FillColor", uno::Any((sal_Int32)nFillColor) ); + maXPropSet->setPropertyValue( "FillColor", uno::Any(static_cast<sal_Int32>(nFillColor)) ); switch ( eFillStyle ) { @@ -275,14 +275,14 @@ void CGMImpressOutAct::ImplSetFillBundle() if ( eFillStyle == FIS_HOLLOW ) { eLS = drawing::LineStyle_SOLID; - maXPropSet->setPropertyValue( "LineColor", uno::Any((sal_Int32)nFillColor) ); - maXPropSet->setPropertyValue( "LineWidth", uno::Any((sal_Int32)0) ); + maXPropSet->setPropertyValue( "LineColor", uno::Any(static_cast<sal_Int32>(nFillColor)) ); + maXPropSet->setPropertyValue( "LineWidth", uno::Any(sal_Int32(0)) ); } else if ( eEdgeType != ET_NONE ) { - maXPropSet->setPropertyValue( "LineColor", uno::Any((sal_Int32)nEdgeColor) ); + maXPropSet->setPropertyValue( "LineColor", uno::Any(static_cast<sal_Int32>(nEdgeColor)) ); - maXPropSet->setPropertyValue( "LineWidth", uno::Any((sal_Int32)fEdgeWidth) ); + maXPropSet->setPropertyValue( "LineWidth", uno::Any(static_cast<sal_Int32>(fEdgeWidth)) ); switch( eEdgeType ) { @@ -344,7 +344,7 @@ void CGMImpressOutAct::ImplSetTextBundle( const uno::Reference< beans::XProperty else nTextColor = mpCGM->pElement->aTextBundle.GetColor(); - rProperty->setPropertyValue( "CharColor", uno::Any((sal_Int32)nTextColor) ); + rProperty->setPropertyValue( "CharColor", uno::Any(static_cast<sal_Int32>(nTextColor)) ); sal_uInt32 nFontType = 0; awt::FontDescriptor aFontDescriptor; @@ -436,9 +436,9 @@ void CGMImpressOutAct::DrawRectangle( FloatRect const & rFloatRect ) { if ( ImplCreateShape( "com.sun.star.drawing.RectangleShape" ) ) { - awt::Size aSize( (long)(rFloatRect.Right - rFloatRect.Left ), (long)(rFloatRect.Bottom-rFloatRect.Top ) ); + awt::Size aSize( static_cast<long>(rFloatRect.Right - rFloatRect.Left ), static_cast<long>(rFloatRect.Bottom-rFloatRect.Top ) ); maXShape->setSize( aSize ); - maXShape->setPosition( awt::Point( (long)rFloatRect.Left, (long)rFloatRect.Top ) ); + maXShape->setPosition( awt::Point( static_cast<long>(rFloatRect.Left), static_cast<long>(rFloatRect.Top) ) ); ImplSetFillBundle(); } } @@ -452,14 +452,14 @@ void CGMImpressOutAct::DrawEllipse( FloatPoint const & rCenter, FloatPoint const uno::Any aAny( &eCircleKind, ::cppu::UnoType<drawing::CircleKind>::get() ); maXPropSet->setPropertyValue( "CircleKind", aAny ); - long nXSize = (long)( rSize.X * 2.0 ); // strange behaviour with a awt::Size of 0 - long nYSize = (long)( rSize.Y * 2.0 ); + long nXSize = static_cast<long>( rSize.X * 2.0 ); // strange behaviour with a awt::Size of 0 + long nYSize = static_cast<long>( rSize.Y * 2.0 ); if ( nXSize < 1 ) nXSize = 1; if ( nYSize < 1 ) nYSize = 1; maXShape->setSize( awt::Size( nXSize, nYSize ) ); - maXShape->setPosition( awt::Point( (long)( rCenter.X - rSize.X ), (long)( rCenter.Y - rSize.Y ) ) ); + maXShape->setPosition( awt::Point( static_cast<long>( rCenter.X - rSize.X ), static_cast<long>( rCenter.Y - rSize.Y ) ) ); if ( rOrientation != 0 ) { @@ -478,8 +478,8 @@ void CGMImpressOutAct::DrawEllipticalArc( FloatPoint const & rCenter, FloatPoint drawing::CircleKind eCircleKind; - long nXSize = (long)( rSize.X * 2.0 ); // strange behaviour with a awt::Size of 0 - long nYSize = (long)( rSize.Y * 2.0 ); + long nXSize = static_cast<long>( rSize.X * 2.0 ); // strange behaviour with a awt::Size of 0 + long nYSize = static_cast<long>( rSize.Y * 2.0 ); if ( nXSize < 1 ) nXSize = 1; if ( nYSize < 1 ) @@ -503,7 +503,7 @@ void CGMImpressOutAct::DrawEllipticalArc( FloatPoint const & rCenter, FloatPoint case 2 : eCircleKind = drawing::CircleKind_ARC; break; default : eCircleKind = drawing::CircleKind_FULL; break; } - if ( (long)fStartAngle == (long)fEndAngle ) + if ( static_cast<long>(fStartAngle) == static_cast<long>(fEndAngle) ) { eCircleKind = drawing::CircleKind_FULL; maXPropSet->setPropertyValue( "CircleKind", uno::Any(eCircleKind) ); @@ -511,10 +511,10 @@ void CGMImpressOutAct::DrawEllipticalArc( FloatPoint const & rCenter, FloatPoint else { maXPropSet->setPropertyValue( "CircleKind", uno::Any(eCircleKind) ); - maXPropSet->setPropertyValue( "CircleStartAngle", uno::Any((sal_Int32)( fStartAngle * 100 )) ); - maXPropSet->setPropertyValue( "CircleEndAngle", uno::Any((sal_Int32)( fEndAngle * 100 )) ); + maXPropSet->setPropertyValue( "CircleStartAngle", uno::Any(static_cast<sal_Int32>( fStartAngle * 100 )) ); + maXPropSet->setPropertyValue( "CircleEndAngle", uno::Any(static_cast<sal_Int32>( fEndAngle * 100 )) ); } - maXShape->setPosition( awt::Point( (long)( rCenter.X - rSize.X ), (long)( rCenter.Y - rSize.Y ) ) ); + maXShape->setPosition( awt::Point( static_cast<long>( rCenter.X - rSize.X ), static_cast<long>( rCenter.Y - rSize.Y ) ) ); if ( rOrientation != 0 ) { ImplSetOrientation( rCenter, rOrientation ); @@ -556,8 +556,8 @@ void CGMImpressOutAct::DrawBitmap( CGMBitmapDescriptor* pBmpDesc ) if ( ImplCreateShape( "com.sun.star.drawing.GraphicObjectShape" ) ) { - maXShape->setSize( awt::Size( (long)fdx, (long)fdy ) ); - maXShape->setPosition( awt::Point( (long)aOrigin.X, (long)aOrigin.Y ) ); + maXShape->setSize( awt::Size( static_cast<long>(fdx), static_cast<long>(fdy) ) ); + maXShape->setPosition( awt::Point( static_cast<long>(aOrigin.X), static_cast<long>(aOrigin.Y) ) ); if ( pBmpDesc->mnOrientation != 0 ) { @@ -586,7 +586,7 @@ void CGMImpressOutAct::DrawPolygon( tools::Polygon& rPoly ) drawing::PointSequence* pOuterSequence = aRetval.getArray(); // make room in arrays - pOuterSequence->realloc((sal_Int32)nPoints); + pOuterSequence->realloc(static_cast<sal_Int32>(nPoints)); // get pointer to arrays awt::Point* pInnerSequence = pOuterSequence->getArray(); @@ -616,7 +616,7 @@ void CGMImpressOutAct::DrawPolyLine( tools::Polygon& rPoly ) drawing::PointSequence* pOuterSequence = aRetval.getArray(); // make room in arrays - pOuterSequence->realloc((sal_Int32)nPoints); + pOuterSequence->realloc(static_cast<sal_Int32>(nPoints)); // get pointer to arrays awt::Point* pInnerSequence = pOuterSequence->getArray(); @@ -672,8 +672,8 @@ void CGMImpressOutAct::DrawPolyPolygon( tools::PolyPolygon const & rPolyPolygon drawing::PolyPolygonBezierCoords aRetval; // prepare inside polygons - aRetval.Coordinates.realloc((sal_Int32)nNumPolys); - aRetval.Flags.realloc((sal_Int32)nNumPolys); + aRetval.Coordinates.realloc(static_cast<sal_Int32>(nNumPolys)); + aRetval.Flags.realloc(static_cast<sal_Int32>(nNumPolys)); // get pointer to outside arrays drawing::PointSequence* pOuterSequence = aRetval.Coordinates.getArray(); @@ -685,8 +685,8 @@ void CGMImpressOutAct::DrawPolyPolygon( tools::PolyPolygon const & rPolyPolygon sal_uInt32 nNumPoints = aPolygon.GetSize(); // make room in arrays - pOuterSequence->realloc((sal_Int32)nNumPoints); - pOuterFlags->realloc((sal_Int32)nNumPoints); + pOuterSequence->realloc(static_cast<sal_Int32>(nNumPoints)); + pOuterFlags->realloc(static_cast<sal_Int32>(nNumPoints)); // get pointer to arrays awt::Point* pInnerSequence = pOuterSequence->getArray(); @@ -763,9 +763,9 @@ void CGMImpressOutAct::DrawText( awt::Point const & rTextPos, awt::Size const & if ( nOrientation ) { - maXPropSet->setPropertyValue( "RotationPointX", uno::Any((sal_Int32)( aTextPos.X )) ); - maXPropSet->setPropertyValue( "RotationPointY", uno::Any((sal_Int32)( aTextPos.Y + nHeight )) ); - maXPropSet->setPropertyValue( "RotateAngle", uno::Any((sal_Int32)( nOrientation * 100 )) ); + maXPropSet->setPropertyValue( "RotationPointX", uno::Any(static_cast<sal_Int32>( aTextPos.X )) ); + maXPropSet->setPropertyValue( "RotationPointY", uno::Any(static_cast<sal_Int32>( aTextPos.Y + nHeight )) ); + maXPropSet->setPropertyValue( "RotateAngle", uno::Any(static_cast<sal_Int32>( nOrientation * 100 )) ); } if ( nWidth == -1 ) { @@ -954,8 +954,8 @@ void CGMImpressOutAct::SetGradientOffset( long nHorzOfs, long nVertOfs ) { if ( !mpGradient ) mpGradient.reset( new awt::Gradient ); - mpGradient->XOffset = ( (sal_uInt16)nHorzOfs & 0x7f ); - mpGradient->YOffset = ( (sal_uInt16)nVertOfs & 0x7f ); + mpGradient->XOffset = ( static_cast<sal_uInt16>(nHorzOfs) & 0x7f ); + mpGradient->YOffset = ( static_cast<sal_uInt16>(nVertOfs) & 0x7f ); } void CGMImpressOutAct::SetGradientAngle( long nAngle ) diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx index 4a99c2de3706..eb2f337d8e4b 100644 --- a/filter/source/graphicfilter/icgm/bitmap.cxx +++ b/filter/source/graphicfilter/icgm/bitmap.cxx @@ -23,7 +23,7 @@ namespace { constexpr BitmapColor BMCOL(sal_uInt32 _col) { - return BitmapColor( (sal_Int8)(_col >> 16 ), (sal_Int8)( _col >> 8 ), (sal_Int8)_col ); + return BitmapColor( static_cast<sal_Int8>(_col >> 16 ), static_cast<sal_Int8>( _col >> 8 ), static_cast<sal_Int8>(_col) ); } } @@ -66,7 +66,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) if (ImplGetDimensions(rDesc) && rDesc.mpBuf && isLegalBitsPerPixel(rDesc.mnDstBitsPerPixel)) { - rDesc.mpBitmap = new Bitmap( Size( rDesc.mnX, rDesc.mnY ), (sal_uInt16)rDesc.mnDstBitsPerPixel ); + rDesc.mpBitmap = new Bitmap( Size( rDesc.mnX, rDesc.mnY ), static_cast<sal_uInt16>(rDesc.mnDstBitsPerPixel) ); if ( ( rDesc.mpAcc = rDesc.mpBitmap->AcquireWriteAccess() ) != nullptr ) { @@ -379,7 +379,7 @@ std::unique_ptr<CGMBitmap> CGMBitmap::GetNext() if (pCGMBitmapDescriptor->mpBitmap && pCGMBitmapDescriptor->mbStatus) { xCGMTempBitmap.reset(new CGMBitmap(*mpCGM)); - if ( ( (long)xCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation == (long)pCGMBitmapDescriptor->mnOrientation ) && + if ( ( static_cast<long>(xCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation) == static_cast<long>(pCGMBitmapDescriptor->mnOrientation) ) && ( ( ( xCGMTempBitmap->pCGMBitmapDescriptor->mnR.X == pCGMBitmapDescriptor->mnQ.X ) && ( xCGMTempBitmap->pCGMBitmapDescriptor->mnR.Y == pCGMBitmapDescriptor->mnQ.Y ) ) || ( ( xCGMTempBitmap->pCGMBitmapDescriptor->mnQ.X == pCGMBitmapDescriptor->mnR.X ) && diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index a421b93500cf..5fe936c0384c 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -97,7 +97,7 @@ sal_uInt32 CGM::ImplGetUI16() sal_uInt8 CGM::ImplGetByte( sal_uInt32 nSource, sal_uInt32 nPrecision ) { - return (sal_uInt8)( nSource >> ( ( nPrecision - 1 ) << 3 ) ); + return static_cast<sal_uInt8>( nSource >> ( ( nPrecision - 1 ) << 3 ) ); }; sal_Int32 CGM::ImplGetI( sal_uInt32 nPrecision ) @@ -110,12 +110,12 @@ sal_Int32 CGM::ImplGetI( sal_uInt32 nPrecision ) { case 1 : { - return (char)*pSource; + return static_cast<char>(*pSource); } case 2 : { - return (sal_Int16)( ( pSource[ 0 ] << 8 ) | pSource[ 1 ] ); + return static_cast<sal_Int16>( ( pSource[ 0 ] << 8 ) | pSource[ 1 ] ); } case 3 : @@ -124,7 +124,7 @@ sal_Int32 CGM::ImplGetI( sal_uInt32 nPrecision ) } case 4: { - return (sal_Int32)( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | ( pSource[ 2 ] << 8 ) | ( pSource[ 3 ] ) ); + return static_cast<sal_Int32>( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | ( pSource[ 2 ] << 8 ) | ( pSource[ 3 ] ) ); } default: mbStatus = false; @@ -141,10 +141,10 @@ sal_uInt32 CGM::ImplGetUI( sal_uInt32 nPrecision ) switch( nPrecision ) { case 1 : - return (sal_Int8)*pSource; + return static_cast<sal_Int8>(*pSource); case 2 : { - return (sal_uInt16)( ( pSource[ 0 ] << 8 ) | pSource[ 1 ] ); + return static_cast<sal_uInt16>( ( pSource[ 0 ] << 8 ) | pSource[ 1 ] ); } case 3 : { @@ -152,7 +152,7 @@ sal_uInt32 CGM::ImplGetUI( sal_uInt32 nPrecision ) } case 4: { - return (sal_uInt32)( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | ( pSource[ 2 ] << 8 ) | ( pSource[ 3 ] ) ); + return static_cast<sal_uInt32>( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | ( pSource[ 2 ] << 8 ) | ( pSource[ 3 ] ) ); } default: mbStatus = false; @@ -210,7 +210,7 @@ double CGM::ImplGetFloat( RealPrecision eRealPrecision, sal_uInt32 nRealSize ) if ( nRealSize == 4 ) { memcpy( static_cast<void*>(&fFloatBuf), pPtr, 4 ); - nRetValue = (double)fFloatBuf; + nRetValue = static_cast<double>(fFloatBuf); } else { @@ -228,17 +228,17 @@ double CGM::ImplGetFloat( RealPrecision eRealPrecision, sal_uInt32 nRealSize ) nVal = pShort[ nSwitch ]; nVal <<= 16; nVal |= pShort[ nSwitch ^ 1 ]; - nRetValue = (double)nVal; + nRetValue = static_cast<double>(nVal); nRetValue /= 65536; } else { sal_Int32* pLong = static_cast<sal_Int32*>(pPtr); - nRetValue = (double)abs( pLong[ nSwitch ] ); + nRetValue = static_cast<double>(abs( pLong[ nSwitch ] )); nRetValue *= 65536; - nVal = (sal_uInt32)( pLong[ nSwitch ^ 1 ] ); + nVal = static_cast<sal_uInt32>( pLong[ nSwitch ^ 1 ] ); nVal >>= 16; - nRetValue += (double)nVal; + nRetValue += static_cast<double>(nVal); if ( pLong[ nSwitch ] < 0 ) { nRetValue = -nRetValue; @@ -365,12 +365,12 @@ sal_uInt32 CGM::ImplGetBitmapColor( bool bDirect ) if ( !nDiff ) nDiff++; nColor = ( ( nColor - pElement->nColorValueExtent[ 2 ] ) << 8 ) / nDiff; - nTmp |= (sal_uInt8)nColor; + nTmp |= static_cast<sal_uInt8>(nColor); } else { sal_uInt32 nIndex = ImplGetUI( pElement->nColorIndexPrecision ); - nTmp = pElement->aColorTable[ (sal_uInt8)nIndex ] ; + nTmp = pElement->aColorTable[ static_cast<sal_uInt8>(nIndex) ] ; } return nTmp; } diff --git a/filter/source/graphicfilter/icgm/class1.cxx b/filter/source/graphicfilter/icgm/class1.cxx index f697e7c75251..ff04efb7f0de 100644 --- a/filter/source/graphicfilter/icgm/class1.cxx +++ b/filter/source/graphicfilter/icgm/class1.cxx @@ -155,7 +155,7 @@ void CGM::ImplDoClass1() } for ( nI0 = 0; nI0 < nI1; nI0++ ) { - pElement->nColorValueExtent[ nI0 ] = (sal_uInt8)ImplGetUI( pElement->nColorPrecision ); + pElement->nColorValueExtent[ nI0 ] = static_cast<sal_uInt8>(ImplGetUI( pElement->nColorPrecision )); } } break; diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx index 0185f699014c..2f2b57895443 100644 --- a/filter/source/graphicfilter/icgm/class4.cxx +++ b/filter/source/graphicfilter/icgm/class4.cxx @@ -62,7 +62,7 @@ void CGM::ImplGetVector( double* pVector ) { for ( sal_uInt32 i = 0; i < 4; i++ ) { - pVector[ i ] = (double)ImplGetI( pElement->nVDCIntegerPrecision ); + pVector[ i ] = static_cast<double>(ImplGetI( pElement->nVDCIntegerPrecision )); } } pVector[ 0 ] *= mnVDCXmul; @@ -123,12 +123,12 @@ void CGM::ImplDoClass4() case 0x01 : /*PolyLine*/ { sal_uInt32 nPoints = mnElementSize / ImplGetPointSize(); - tools::Polygon aPolygon( (sal_uInt16)nPoints ); + tools::Polygon aPolygon( static_cast<sal_uInt16>(nPoints) ); for ( sal_uInt32 i = 0; i < nPoints; i++) { FloatPoint aFloatPoint; ImplGetPoint( aFloatPoint, true ); - aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), i ); + aPolygon.SetPoint( Point( static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ), i ); } if ( mbFigure ) mpOutAct->RegPolyLine( aPolygon ); @@ -151,20 +151,20 @@ void CGM::ImplDoClass4() for ( sal_uInt16 i = 0; i < nPoints; i++ ) { ImplGetPoint( aFloatPoint, true ); - aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), 0 ); + aPolygon.SetPoint( Point( static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ), 0 ); } mpOutAct->RegPolyLine( aPolygon ); } else { mpOutAct->BeginGroup(); - tools::Polygon aPolygon( (sal_uInt16)2 ); + tools::Polygon aPolygon( sal_uInt16(2) ); for ( sal_uInt16 i = 0; i < nPoints; i++ ) { ImplGetPoint( aFloatPoint, true ); - aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), 0 ); + aPolygon.SetPoint( Point( static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ), 0 ); ImplGetPoint( aFloatPoint, true ); - aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), 1); + aPolygon.SetPoint( Point( static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ), 1); mpOutAct->DrawPolyLine( aPolygon ); } mpOutAct->EndGroup(); @@ -191,7 +191,7 @@ void CGM::ImplDoClass4() mpSource[mnParaSize + nSize] = 0; awt::Size aSize; - awt::Point aPoint( (long)aFloatPoint.X, (long)aFloatPoint.Y ); + awt::Point aPoint( static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ); mpOutAct->DrawText( aPoint, aSize, reinterpret_cast<char*>(mpSource) + mnParaSize, (FinalFlag)nType ); mnParaSize = mnElementSize; @@ -213,8 +213,8 @@ void CGM::ImplDoClass4() } else { - dx = (double)ImplGetI( pElement->nVDCIntegerPrecision ); - dy = (double)ImplGetI( pElement->nVDCIntegerPrecision ); + dx = static_cast<double>(ImplGetI( pElement->nVDCIntegerPrecision )); + dy = static_cast<double>(ImplGetI( pElement->nVDCIntegerPrecision )); } ImplMapDouble( dx ); ImplMapDouble( dy ); @@ -228,8 +228,8 @@ void CGM::ImplDoClass4() mpSource[ mnParaSize + nSize ] = 0; - awt::Point aPoint( (long)aFloatPoint.X, (long)aFloatPoint.Y ); - awt::Size aSize((long)dx, (long)dy); + awt::Point aPoint( static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ); + awt::Size aSize(static_cast<long>(dx), static_cast<long>(dy)); mpOutAct->DrawText( aPoint, aSize , reinterpret_cast<char*>(mpSource) + mnParaSize, (FinalFlag)nType ); mnParaSize = mnElementSize; @@ -263,7 +263,7 @@ void CGM::ImplDoClass4() { FloatPoint aFloatPoint; ImplGetPoint( aFloatPoint, true ); - aPolygon.SetPoint( Point ( (long)( aFloatPoint.X ), (long)( aFloatPoint.Y ) ), i ); + aPolygon.SetPoint( Point ( static_cast<long>( aFloatPoint.X ), static_cast<long>( aFloatPoint.Y ) ), i ); } mpOutAct->DrawPolygon( aPolygon ); } @@ -284,7 +284,7 @@ void CGM::ImplDoClass4() { ImplGetPoint( aFloatPoint, true ); nEdgeFlag = ImplGetUI16(); - pPoints[ nPoints++ ] = Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ); + pPoints[ nPoints++ ] = Point( static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ); if ( ( nEdgeFlag & 2 ) || ( mnParaSize == mnElementSize ) ) { tools::Polygon aPolygon( nPoints ); @@ -351,7 +351,7 @@ void CGM::ImplDoClass4() if ( pElement->eVDCType == VDC_REAL ) aRadius.X = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize ); else - aRadius.X = (double)ImplGetI( pElement->nVDCIntegerPrecision ); + aRadius.X = static_cast<double>(ImplGetI( pElement->nVDCIntegerPrecision )); ImplMapDouble( aRadius.X ); aRadius.Y = aRadius.X; mpOutAct->DrawEllipse( aCenter, aRadius, fRotation ); @@ -409,9 +409,9 @@ void CGM::ImplDoClass4() if ( mbFigure ) { - tools::Rectangle aBoundingBox( Point( (long)( aCenterPoint.X - fRadius ), long( aCenterPoint.Y - fRadius ) ), - Size( static_cast< long >( 2 * fRadius ), (long)( 2 * fRadius) ) ); - tools::Polygon aPolygon( aBoundingBox, Point( (long)aStartingPoint.X, (long)aStartingPoint.Y ) ,Point( (long)aEndingPoint.X, (long)aEndingPoint.Y ), PolyStyle::Arc ); + tools::Rectangle aBoundingBox( Point( static_cast<long>( aCenterPoint.X - fRadius ), long( aCenterPoint.Y - fRadius ) ), + Size( static_cast< long >( 2 * fRadius ), static_cast<long>( 2 * fRadius) ) ); + tools::Polygon aPolygon( aBoundingBox, Point( static_cast<long>(aStartingPoint.X), static_cast<long>(aStartingPoint.Y) ) ,Point( static_cast<long>(aEndingPoint.X), static_cast<long>(aEndingPoint.Y) ), PolyStyle::Arc ); if ( nSwitch ) mpOutAct->RegPolyLine( aPolygon, true ); else @@ -506,7 +506,7 @@ void CGM::ImplDoClass4() } else { - aRadius.X = (double)ImplGetI( pElement->nVDCIntegerPrecision ); + aRadius.X = static_cast<double>(ImplGetI( pElement->nVDCIntegerPrecision )); } ImplMapDouble( aRadius.X ); @@ -528,11 +528,11 @@ void CGM::ImplDoClass4() if ( mbFigure ) { tools::Rectangle aBoundingBox( - Point( (long)( aCenter.X - aRadius.X ), long( aCenter.Y - aRadius.X ) ), - Size( static_cast< long >( 2 * aRadius.X ), (long)( 2 * aRadius.X ) ) ); + Point( static_cast<long>( aCenter.X - aRadius.X ), long( aCenter.Y - aRadius.X ) ), + Size( static_cast< long >( 2 * aRadius.X ), static_cast<long>( 2 * aRadius.X ) ) ); tools::Polygon aPolygon( aBoundingBox, - Point( (long)vector[ 0 ], (long)vector[ 1 ] ), - Point( (long)vector[ 2 ], (long)vector[ 3 ] ), PolyStyle::Arc ); + Point( static_cast<long>(vector[ 0 ]), static_cast<long>(vector[ 1 ]) ), + Point( static_cast<long>(vector[ 2 ]), static_cast<long>(vector[ 3 ]) ), PolyStyle::Arc ); mpOutAct->RegPolyLine( aPolygon ); } else @@ -561,7 +561,7 @@ void CGM::ImplDoClass4() } else { - aRadius.X = (double)ImplGetI( pElement->nVDCIntegerPrecision ); + aRadius.X = static_cast<double>(ImplGetI( pElement->nVDCIntegerPrecision )); } ImplMapDouble( aRadius.X ); aRadius.Y = aRadius.X; @@ -721,7 +721,7 @@ void CGM::ImplDoClass4() { FloatPoint aFloatPoint; ImplGetPoint( aFloatPoint, true ); - aPolygon.SetPoint( Point ( (long)( aFloatPoint.X ), (long)( aFloatPoint.Y ) ), i ); + aPolygon.SetPoint( Point ( static_cast<long>( aFloatPoint.X ), static_cast<long>( aFloatPoint.Y ) ), i ); } if ( nOrder & 4 ) { diff --git a/filter/source/graphicfilter/icgm/class5.cxx b/filter/source/graphicfilter/icgm/class5.cxx index f095dbb18f39..e78c298842e4 100644 --- a/filter/source/graphicfilter/icgm/class5.cxx +++ b/filter/source/graphicfilter/icgm/class5.cxx @@ -46,12 +46,12 @@ void CGM::ImplDoClass5() if ( pElement->eVDCType == VDC_REAL ) nWidth = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize ); else - nWidth = (double)ImplGetI( pElement->nVDCIntegerPrecision ); + nWidth = static_cast<double>(ImplGetI( pElement->nVDCIntegerPrecision )); ImplMapDouble( nWidth ); } else - nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25; // scaling in 1/4 mm + nWidth = static_cast<sal_uInt32>(ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize )) * 25; // scaling in 1/4 mm ( pElement->nAspectSourceFlags & ASF_LINEWIDTH ) ? pElement->pLineBundle->nLineWidth = nWidth @@ -85,11 +85,11 @@ void CGM::ImplDoClass5() if ( pElement->eVDCType == VDC_REAL ) nWidth = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize ); else - nWidth = (double)ImplGetI( pElement->nVDCIntegerPrecision ); + nWidth = static_cast<double>(ImplGetI( pElement->nVDCIntegerPrecision )); ImplMapDouble( nWidth ); } else - nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25; + nWidth = static_cast<sal_uInt32>(ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize )) * 25; ( pElement->nAspectSourceFlags & ASF_MARKERSIZE ) ? pElement->pMarkerBundle->nMarkerSize = nWidth : pElement->aMarkerBundle.nMarkerSize = nWidth; @@ -262,12 +262,12 @@ void CGM::ImplDoClass5() if ( pElement->eVDCType == VDC_REAL ) nWidth = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize ); else - nWidth = (double)ImplGetI( pElement->nVDCIntegerPrecision ); + nWidth = static_cast<double>(ImplGetI( pElement->nVDCIntegerPrecision )); ImplMapDouble( nWidth ); } else - nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25; + nWidth = static_cast<sal_uInt32>(ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize )) * 25; ( pElement->nAspectSourceFlags & ASF_EDGEWIDTH ) ? pElement->pEdgeBundle->nEdgeWidth = nWidth : pElement->aEdgeBundle.nEdgeWidth = nWidth; diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx index b06827c6d17e..862ed03e3a20 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx @@ -151,7 +151,7 @@ bool DXF2GDIMetaFile::SetLineAttribute(const DXFBasicEntity & rE) nColor=GetEntityColor(rE); if (nColor<0) return false; - aColor=ConvertColor((sal_uInt8)nColor); + aColor=ConvertColor(static_cast<sal_uInt8>(nColor)); if (aActLineColor!=aColor) { pVirDev->SetLineColor( aActLineColor = aColor ); @@ -171,7 +171,7 @@ bool DXF2GDIMetaFile::SetAreaAttribute(const DXFBasicEntity & rE) nColor=GetEntityColor(rE); if (nColor<0) return false; - aColor=ConvertColor((sal_uInt8)nColor); + aColor=ConvertColor(static_cast<sal_uInt8>(nColor)); if (aActLineColor!=aColor) { pVirDev->SetLineColor( aActLineColor = aColor ); @@ -196,7 +196,7 @@ bool DXF2GDIMetaFile::SetFontAttribute(const DXFBasicEntity & rE, short nAngle, nColor=GetEntityColor(rE); if (nColor<0) return false; - aColor=ConvertColor((sal_uInt8)nColor); + aColor=ConvertColor(static_cast<sal_uInt8>(nColor)); aFont.SetColor(aColor); aFont.SetTransparent(true); @@ -264,15 +264,15 @@ void DXF2GDIMetaFile::DrawCircleEntity(const DXFCircleEntity & rE, const DXFTran rTransform.Transform(rE.aP0,aC); if (rE.fThickness==0 && rTransform.TransCircleToEllipse(rE.fRadius,frx,fry)) { pVirDev->DrawEllipse( - tools::Rectangle((long)(aC.fx-frx+0.5),(long)(aC.fy-fry+0.5), - (long)(aC.fx+frx+0.5),(long)(aC.fy+fry+0.5))); + tools::Rectangle(static_cast<long>(aC.fx-frx+0.5),static_cast<long>(aC.fy-fry+0.5), + static_cast<long>(aC.fx+frx+0.5),static_cast<long>(aC.fy+fry+0.5))); } else { double fAng; nPoints=OptPointsPerCircle; tools::Polygon aPoly(nPoints); for (i=0; i<nPoints; i++) { - fAng=2*3.14159265359/(double)(nPoints-1)*(double)i; + fAng=2*3.14159265359/static_cast<double>(nPoints-1)*static_cast<double>(i); rTransform.Transform( rE.aP0+DXFVector(rE.fRadius*cos(fAng),rE.fRadius*sin(fAng),0), aPoly[i] @@ -282,7 +282,7 @@ void DXF2GDIMetaFile::DrawCircleEntity(const DXFCircleEntity & rE, const DXFTran if (rE.fThickness!=0) { tools::Polygon aPoly2(nPoints); for (i=0; i<nPoints; i++) { - fAng=2*3.14159265359/(double)(nPoints-1)*(double)i; + fAng=2*3.14159265359/static_cast<double>(nPoints-1)*static_cast<double>(i); rTransform.Transform( rE.aP0+DXFVector(rE.fRadius*cos(fAng),rE.fRadius*sin(fAng),rE.fThickness), aPoly2[i] @@ -324,18 +324,18 @@ void DXF2GDIMetaFile::DrawArcEntity(const DXFArcEntity & rE, const DXFTransform rTransform.Transform(aVE,aPS); } pVirDev->DrawArc( - tools::Rectangle((long)(aC.fx-frx+0.5),(long)(aC.fy-fry+0.5), - (long)(aC.fx+frx+0.5),(long)(aC.fy+fry+0.5)), + tools::Rectangle(static_cast<long>(aC.fx-frx+0.5),static_cast<long>(aC.fy-fry+0.5), + static_cast<long>(aC.fx+frx+0.5),static_cast<long>(aC.fy+fry+0.5)), aPS,aPE ); } else { double fAng; - nPoints=(sal_uInt16)(fdA/360.0*(double)OptPointsPerCircle+0.5); + nPoints=static_cast<sal_uInt16>(fdA/360.0*static_cast<double>(OptPointsPerCircle)+0.5); if (nPoints<2) nPoints=2; tools::Polygon aPoly(nPoints); for (i=0; i<nPoints; i++) { - fAng=3.14159265359/180.0 * ( fA1 + fdA/(double)(nPoints-1)*(double)i ); + fAng=3.14159265359/180.0 * ( fA1 + fdA/static_cast<double>(nPoints-1)*static_cast<double>(i) ); rTransform.Transform( rE.aP0+DXFVector(rE.fRadius*cos(fAng),rE.fRadius*sin(fAng),0), aPoly[i] @@ -345,7 +345,7 @@ void DXF2GDIMetaFile::DrawArcEntity(const DXFArcEntity & rE, const DXFTransform if (rE.fThickness!=0) { tools::Polygon aPoly2(nPoints); for (i=0; i<nPoints; i++) { - fAng=3.14159265359/180.0 * ( fA1 + fdA/(double)(nPoints-1)*(double)i ); + fAng=3.14159265359/180.0 * ( fA1 + fdA/static_cast<double>(nPoints-1)*static_cast<double>(i) ); rTransform.Transform( rE.aP0+DXFVector(rE.fRadius*cos(fAng),rE.fRadius*sin(fAng),rE.fThickness), aPoly2[i] @@ -418,9 +418,9 @@ void DXF2GDIMetaFile::DrawTextEntity(const DXFTextEntity & rE, const DXFTransfor short nAng; DXFTransform aT( DXFTransform(rE.fXScale,rE.fHeight,1.0,rE.fRotAngle,rE.aP0), rTransform ); aT.TransDir(DXFVector(0,1,0),aV); - nHeight=(sal_uInt16)(aV.Abs()+0.5); + nHeight=static_cast<sal_uInt16>(aV.Abs()+0.5); fA=aT.CalcRotAngle(); - nAng=(short)(fA*10.0+0.5); + nAng=static_cast<short>(fA*10.0+0.5); aT.TransDir(DXFVector(1,0,0),aV); if ( SetFontAttribute( rE,nAng, nHeight ) ) { @@ -476,9 +476,9 @@ void DXF2GDIMetaFile::DrawAttribEntity(const DXFAttribEntity & rE, const DXFTran short nAng; DXFTransform aT( DXFTransform( rE.fXScale, rE.fHeight, 1.0, rE.fRotAngle, rE.aP0 ), rTransform ); aT.TransDir(DXFVector(0,1,0),aV); - nHeight=(sal_uInt16)(aV.Abs()+0.5); + nHeight=static_cast<sal_uInt16>(aV.Abs()+0.5); fA=aT.CalcRotAngle(); - nAng=(short)(fA*10.0+0.5); + nAng=static_cast<short>(fA*10.0+0.5); aT.TransDir(DXFVector(1,0,0),aV); if (SetFontAttribute(rE,nAng,nHeight)) { @@ -534,10 +534,10 @@ void DXF2GDIMetaFile::DrawLWPolyLineEntity(const DXFLWPolyLineEntity & rE, const sal_Int32 i, nPolySize = rE.nCount; if ( nPolySize && rE.pP ) { - tools::Polygon aPoly( (sal_uInt16)nPolySize); + tools::Polygon aPoly( static_cast<sal_uInt16>(nPolySize)); for ( i = 0; i < nPolySize; i++ ) { - rTransform.Transform( rE.pP[ (sal_uInt16)i ], aPoly[ (sal_uInt16)i ] ); + rTransform.Transform( rE.pP[ static_cast<sal_uInt16>(i) ], aPoly[ static_cast<sal_uInt16>(i) ] ); } if ( SetLineAttribute( rE ) ) { @@ -593,7 +593,7 @@ void DXF2GDIMetaFile::DrawHatchEntity(const DXFHatchEntity & rE, const DXFTransf } } } - sal_uInt16 i, nSize = (sal_uInt16)aPtAry.size(); + sal_uInt16 i, nSize = static_cast<sal_uInt16>(aPtAry.size()); if ( nSize ) { tools::Polygon aPoly( nSize ); @@ -773,8 +773,8 @@ bool DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF OptPointsPerCircle=50; - nMinPercent=(sal_uLong)nminpercent; - nMaxPercent=(sal_uLong)nmaxpercent; + nMinPercent=static_cast<sal_uLong>(nminpercent); + nMaxPercent=static_cast<sal_uLong>(nmaxpercent); nLastPercent=nMinPercent; nMainEntitiesCount=CountEntities(pDXF->aEntities); @@ -835,8 +835,8 @@ bool DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF pDXF->aBoundingBox.fMaxY*fScale, -pDXF->aBoundingBox.fMinZ*fScale)); } - aPrefSize.Width() =(long)(fWidth*fScale+1.5); - aPrefSize.Height()=(long)(fHeight*fScale+1.5); + aPrefSize.Width() =static_cast<long>(fWidth*fScale+1.5); + aPrefSize.Height()=static_cast<long>(fHeight*fScale+1.5); } } else { @@ -857,8 +857,8 @@ bool DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF ) ); } - aPrefSize.Width() =(long)(fWidth*fScale+1.5); - aPrefSize.Height()=(long)(fHeight*fScale+1.5); + aPrefSize.Width() =static_cast<long>(fWidth*fScale+1.5); + aPrefSize.Height()=static_cast<long>(fHeight*fScale+1.5); } if (bStatus) diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.cxx b/filter/source/graphicfilter/idxf/dxfgrprd.cxx index a7b4f5e58b83..c7fbd2cfd65a 100644 --- a/filter/source/graphicfilter/idxf/dxfgrprd.cxx +++ b/filter/source/graphicfilter/idxf/dxfgrprd.cxx @@ -125,7 +125,7 @@ sal_uInt16 DXFGroupReader::Read() if ( bStatus ) { nGCount++; - nG = (sal_uInt16)ReadI(); + nG = static_cast<sal_uInt16>(ReadI()); if ( bStatus ) { if (nG< 10) ReadS(); diff --git a/filter/source/graphicfilter/idxf/dxfreprd.cxx b/filter/source/graphicfilter/idxf/dxfreprd.cxx index 5cd11bc3a84b..5920eaddab83 100644 --- a/filter/source/graphicfilter/idxf/dxfreprd.cxx +++ b/filter/source/graphicfilter/idxf/dxfreprd.cxx @@ -95,15 +95,15 @@ DXFPalette::DXFPalette() for (j=0; j<3; j++) nC[j]=(nC[j]>>1)+128; } for (j=0; j<3; j++) nC[j]=nC[j]*nVal/5; - SetColor((sal_uInt8)(i++),(sal_uInt8)nC[0],(sal_uInt8)nC[1],(sal_uInt8)nC[2]); + SetColor(static_cast<sal_uInt8>(i++),static_cast<sal_uInt8>(nC[0]),static_cast<sal_uInt8>(nC[1]),static_cast<sal_uInt8>(nC[2])); } } } // Farben 250 - 255 (shades of gray) for (i=0; i<6; i++) { - nV=(sal_uInt8)(i*38+65); - SetColor((sal_uInt8)(250+i),nV,nV,nV); + nV=static_cast<sal_uInt8>(i*38+65); + SetColor(static_cast<sal_uInt8>(250+i),nV,nV,nV); } } diff --git a/filter/source/graphicfilter/idxf/dxfvec.cxx b/filter/source/graphicfilter/idxf/dxfvec.cxx index 902cd0a6ad5c..fc6de7bcf671 100644 --- a/filter/source/graphicfilter/idxf/dxfvec.cxx +++ b/filter/source/graphicfilter/idxf/dxfvec.cxx @@ -152,8 +152,8 @@ void DXFTransform::Transform(const DXFVector & rSrc, DXFVector & rTgt) const void DXFTransform::Transform(const DXFVector & rSrc, Point & rTgt) const { - rTgt.X()=(long)( rSrc.fx * aMX.fx + rSrc.fy * aMY.fx + rSrc.fz * aMZ.fx + aMP.fx + 0.5 ); - rTgt.Y()=(long)( rSrc.fx * aMX.fy + rSrc.fy * aMY.fy + rSrc.fz * aMZ.fy + aMP.fy + 0.5 ); + rTgt.X()=static_cast<long>( rSrc.fx * aMX.fx + rSrc.fy * aMY.fx + rSrc.fz * aMZ.fx + aMP.fx + 0.5 ); + rTgt.Y()=static_cast<long>( rSrc.fx * aMX.fy + rSrc.fy * aMY.fy + rSrc.fz * aMZ.fy + aMP.fy + 0.5 ); } @@ -205,12 +205,12 @@ LineInfo DXFTransform::Transform(const DXFLineInfo& aDXFLineInfo) const LineInfo aLineInfo; aLineInfo.SetStyle( aDXFLineInfo.eStyle ); - aLineInfo.SetWidth( (sal_Int32) (aDXFLineInfo.fWidth * scale + 0.5) ); + aLineInfo.SetWidth( static_cast<sal_Int32>(aDXFLineInfo.fWidth * scale + 0.5) ); aLineInfo.SetDashCount( static_cast< sal_uInt16 >( aDXFLineInfo.nDashCount ) ); - aLineInfo.SetDashLen( (sal_Int32) (aDXFLineInfo.fDashLen * scale + 0.5) ); + aLineInfo.SetDashLen( static_cast<sal_Int32>(aDXFLineInfo.fDashLen * scale + 0.5) ); aLineInfo.SetDotCount( static_cast< sal_uInt16 >( aDXFLineInfo.nDotCount ) ); - aLineInfo.SetDotLen( (sal_Int32) (aDXFLineInfo.fDotLen * scale + 0.5) ); - aLineInfo.SetDistance( (sal_Int32) (aDXFLineInfo.fDistance * scale + 0.5) ); + aLineInfo.SetDotLen( static_cast<sal_Int32>(aDXFLineInfo.fDotLen * scale + 0.5) ); + aLineInfo.SetDistance( static_cast<sal_Int32>(aDXFLineInfo.fDistance * scale + 0.5) ); if ( aLineInfo.GetDashCount() > 0 && aLineInfo.GetDashLen() == 0 ) aLineInfo.SetDashLen(1); diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index faf82a7569ed..1139015339af 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -798,7 +798,7 @@ sal_uInt16 OS2METReader::ReadBigEndianWord() { sal_uInt8 nLo(0), nHi(0); pOS2MET->ReadUChar( nHi ).ReadUChar( nLo ); - return (((sal_uInt16)nHi)<<8)|(((sal_uInt16)nLo)&0x00ff); + return (static_cast<sal_uInt16>(nHi)<<8)|(static_cast<sal_uInt16>(nLo)&0x00ff); } sal_uInt32 OS2METReader::ReadBigEndian3BytesLong() @@ -806,7 +806,7 @@ sal_uInt32 OS2METReader::ReadBigEndian3BytesLong() sal_uInt8 nHi(0); pOS2MET->ReadUChar( nHi ); sal_uInt16 nLo = ReadBigEndianWord(); - return ((((sal_uInt32)nHi)<<16)&0x00ff0000)|((sal_uInt32)nLo); + return ((static_cast<sal_uInt32>(nHi)<<16)&0x00ff0000)|static_cast<sal_uInt32>(nLo); } sal_uInt32 OS2METReader::ReadLittleEndian3BytesLong() @@ -814,7 +814,7 @@ sal_uInt32 OS2METReader::ReadLittleEndian3BytesLong() sal_uInt8 nHi,nMed,nLo; pOS2MET->ReadUChar( nLo ).ReadUChar( nMed ).ReadUChar( nHi ); - return ((((sal_uInt32)nHi)&0xff)<<16)|((((sal_uInt32)nMed)&0xff)<<8)|(((sal_uInt32)nLo)&0xff); + return ((static_cast<sal_uInt32>(nHi)&0xff)<<16)|((static_cast<sal_uInt32>(nMed)&0xff)<<8)|(static_cast<sal_uInt32>(nLo)&0xff); } sal_Int32 OS2METReader::ReadCoord(bool b32) @@ -894,8 +894,8 @@ void OS2METReader::ReadRelLine(bool bGivenPos, sal_uInt16 nOrderLen) tools::Polygon aPolygon(nPolySize); for (i=0; i<nPolySize; i++) { sal_Int8 nsignedbyte; - pOS2MET->ReadSChar( nsignedbyte ); aP0.X()+=(sal_Int32)nsignedbyte; - pOS2MET->ReadSChar( nsignedbyte ); aP0.Y()-=(sal_Int32)nsignedbyte; + pOS2MET->ReadSChar( nsignedbyte ); aP0.X()+=static_cast<sal_Int32>(nsignedbyte); + pOS2MET->ReadSChar( nsignedbyte ); aP0.Y()-=static_cast<sal_Int32>(nsignedbyte); aCalcBndRect.Union(tools::Rectangle(aP0,Size(1,1))); aPolygon.SetPoint(aP0,i); } @@ -1099,12 +1099,12 @@ void OS2METReader::ReadArc(bool bGivenPos) w1=fmod((atan2(x1-cx,y1-cy)-atan2(x2-cx,y2-cy)),6.28318530718); if (w1<0) w1+=6.28318530718; w3=fmod((atan2(x3-cx,y3-cy)-atan2(x2-cx,y2-cy)),6.28318530718); if (w3<0) w3+=6.28318530718; if (w3<w1) { - pVirDev->DrawArc(tools::Rectangle((sal_Int32)(cx-rx),(sal_Int32)(cy-ry), - (sal_Int32)(cx+rx),(sal_Int32)(cy+ry)),aP1,aP3); + pVirDev->DrawArc(tools::Rectangle(static_cast<sal_Int32>(cx-rx),static_cast<sal_Int32>(cy-ry), + static_cast<sal_Int32>(cx+rx),static_cast<sal_Int32>(cy+ry)),aP1,aP3); } else { - pVirDev->DrawArc(tools::Rectangle((sal_Int32)(cx-rx),(sal_Int32)(cy-ry), - (sal_Int32)(cx+rx),(sal_Int32)(cy+ry)),aP3,aP1); + pVirDev->DrawArc(tools::Rectangle(static_cast<sal_Int32>(cx-rx),static_cast<sal_Int32>(cy-ry), + static_cast<sal_Int32>(cx+rx),static_cast<sal_Int32>(cy+ry)),aP3,aP1); } } @@ -1127,7 +1127,7 @@ void OS2METReader::ReadFullArc(bool bGivenPos, sal_uInt16 nOrderSize) nQ = o3tl::saturating_toggle_sign(nQ); sal_uInt32 nMul(0); sal_uInt16 nMulS(0); if (nOrderSize>=4) pOS2MET->ReadUInt32( nMul ); - else { pOS2MET->ReadUInt16( nMulS ); nMul=((sal_uInt32)nMulS)<<8; } + else { pOS2MET->ReadUInt16( nMulS ); nMul=static_cast<sal_uInt32>(nMulS)<<8; } if (nMul!=0x00010000) { nP=(nP*nMul)>>16; nQ=(nQ*nMul)>>16; @@ -1174,7 +1174,7 @@ void OS2METReader::ReadPartialArc(bool bGivenPos, sal_uInt16 nOrderSize) nQ = o3tl::saturating_toggle_sign(nQ); sal_uInt32 nMul(0); sal_uInt16 nMulS(0); if (nOrderSize>=12) pOS2MET->ReadUInt32( nMul ); - else { pOS2MET->ReadUInt16( nMulS ); nMul=((sal_uInt32)nMulS)<<8; } + else { pOS2MET->ReadUInt16( nMulS ); nMul=static_cast<sal_uInt32>(nMulS)<<8; } if (nMul!=0x00010000) { nP=(nP*nMul)>>16; nQ=(nQ*nMul)>>16; @@ -1182,12 +1182,12 @@ void OS2METReader::ReadPartialArc(bool bGivenPos, sal_uInt16 nOrderSize) sal_Int32 nStart(0), nSweep(0); pOS2MET->ReadInt32( nStart ).ReadInt32( nSweep ); - double fStart = ((double)nStart)/65536.0/180.0*3.14159265359; - double fEnd = fStart+((double)nSweep)/65536.0/180.0*3.14159265359; - aPStart=Point(aCenter.X()+(sal_Int32)( cos(fStart)*nP), - aCenter.Y()+(sal_Int32)(-sin(fStart)*nQ)); - aPEnd= Point(aCenter.X()+(sal_Int32)( cos(fEnd)*nP), - aCenter.Y()+(sal_Int32)(-sin(fEnd)*nQ)); + double fStart = static_cast<double>(nStart)/65536.0/180.0*3.14159265359; + double fEnd = fStart+ static_cast<double>(nSweep)/65536.0/180.0*3.14159265359; + aPStart=Point(aCenter.X()+static_cast<sal_Int32>( cos(fStart)*nP), + aCenter.Y()+static_cast<sal_Int32>(-sin(fStart)*nQ)); + aPEnd= Point(aCenter.X()+static_cast<sal_Int32>( cos(fEnd)*nP), + aCenter.Y()+static_cast<sal_Int32>(-sin(fEnd)*nQ)); aRect=tools::Rectangle(aCenter.X()-nP,aCenter.Y()-nQ, aCenter.X()+nP,aCenter.Y()+nQ); @@ -1231,12 +1231,12 @@ void OS2METReader::ReadPolygons() return; } if (i==0) ++nNumPoints; - aPoly.SetSize((short)nNumPoints); + aPoly.SetSize(static_cast<short>(nNumPoints)); for (sal_uInt32 j=0; j<nNumPoints; ++j) { if (i==0 && j==0) aPoint=aAttr.aCurPos; else aPoint=ReadPoint(); - aPoly.SetPoint(aPoint,(short)j); + aPoly.SetPoint(aPoint,static_cast<short>(j)); if (i==nNumPolys-1 && j==nNumPoints-1) aAttr.aCurPos=aPoint; } aPolyPoly.Insert(aPoly); @@ -1812,7 +1812,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen) sal_uInt16 nVal; Color aCol; if (nOrderID==GOrdPColor || nOrderID==GOrdSColor) { - pOS2MET->ReadUChar( nbyte ); nVal=((sal_uInt16)nbyte)|0xff00; + pOS2MET->ReadUChar( nbyte ); nVal=static_cast<sal_uInt16>(nbyte)|0xff00; } else pOS2MET->ReadUInt16( nVal ); if (nVal==0x0000 || nVal==0xff00) { @@ -1826,7 +1826,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen) if (nVal==0x0007) aCol=Color(COL_WHITE); else if (nVal==0x0008) aCol=Color(COL_BLACK); else if (nVal==0xff08) aCol=GetPaletteColor(1); - else aCol=GetPaletteColor(((sal_uInt32)nVal) & 0x000000ff); + else aCol=GetPaletteColor(static_cast<sal_uInt32>(nVal) & 0x000000ff); aAttr.aLinCol = aAttr.aChrCol = aAttr.aMrkCol = aAttr.aPatCol = aAttr.aImgCol = aCol; } @@ -1850,7 +1850,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen) if (nVal==0x0007) aCol=Color(COL_WHITE); else if (nVal==0x0008) aCol=Color(COL_BLACK); else if (nVal==0xff08) aCol=GetPaletteColor(0); - else aCol=GetPaletteColor(((sal_uInt32)nVal) & 0x000000ff); + else aCol=GetPaletteColor(static_cast<sal_uInt32>(nVal) & 0x000000ff); aAttr.aLinBgCol = aAttr.aChrBgCol = aAttr.aMrkBgCol = aAttr.aPatBgCol = aAttr.aImgBgCol = aCol; } @@ -1968,7 +1968,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen) sal_uInt8 nbyte; pOS2MET->ReadUChar( nbyte ); if (nbyte==0) aAttr.nLinWidth=aDefAttr.nLinWidth; - else aAttr.nLinWidth=(sal_uInt16)nbyte-1; + else aAttr.nLinWidth=static_cast<sal_uInt16>(nbyte)-1; break; } case GOrdPFrLWd: PushAttr(nOrderID); @@ -1991,7 +1991,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen) sal_Int32 nWd = ReadCoord( bCoord32 ); if (nWd < 0) nWd = o3tl::saturating_toggle_sign(nWd); - aAttr.nStrLinWidth = (sal_uInt16)nWd; + aAttr.nStrLinWidth = static_cast<sal_uInt16>(nWd); } break; } @@ -2009,7 +2009,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen) SAL_FALLTHROUGH; case GOrdSChSet: { sal_uInt8 nbyte; pOS2MET->ReadUChar( nbyte ); - aAttr.nChrSet=((sal_uInt32)nbyte)&0xff; + aAttr.nChrSet=static_cast<sal_uInt32>(nbyte)&0xff; break; } case GOrdPChAng: PushAttr(nOrderID); @@ -2019,7 +2019,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen) sal_Int32 nY = ReadCoord(bCoord32); if (nX>=0 && nY==0) aAttr.nChrAng=0; else { - aAttr.nChrAng=(short)(atan2((double)nY,(double)nX)/3.1415926539*1800.0); + aAttr.nChrAng=static_cast<short>(atan2(static_cast<double>(nY),static_cast<double>(nX))/3.1415926539*1800.0); while (aAttr.nChrAng<0) aAttr.nChrAng+=3600; aAttr.nChrAng%=3600; } @@ -2334,7 +2334,7 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize) pOS2MET->SeekRel(2); nPos+=2; while (nPos<nMaxPos && pOS2MET->GetError()==ERRCODE_NONE) { pOS2MET->ReadUChar( nByte ); - sal_uInt16 nLen = ((sal_uInt16)nByte) & 0x00ff; + sal_uInt16 nLen = static_cast<sal_uInt16>(nByte) & 0x00ff; if (nLen == 0) { pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR); @@ -2365,7 +2365,7 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize) switch (nTripType2) { case 0x05: //Icid pOS2MET->ReadUChar( nByte ); - pF->nID=((sal_uInt32)nByte)&0xff; + pF->nID=static_cast<sal_uInt32>(nByte)&0xff; break; } break; @@ -2419,13 +2419,13 @@ void OS2METReader::ReadField(sal_uInt16 nFieldType, sal_uInt16 nFieldSize) auto nMaxPos = nPos + nFieldSize; pOS2MET->SeekRel(3); nPos+=3; while (nPos<nMaxPos && pOS2MET->GetError()==ERRCODE_NONE) { - pOS2MET->ReadUChar( nbyte ); nElemLen=((sal_uInt16)nbyte) & 0x00ff; + pOS2MET->ReadUChar( nbyte ); nElemLen=static_cast<sal_uInt16>(nbyte) & 0x00ff; if (nElemLen>11) { pOS2MET->SeekRel(4); nStartIndex=ReadBigEndianWord(); pOS2MET->SeekRel(3); pOS2MET->ReadUChar( nbyte ); - nBytesPerCol=((sal_uInt16)nbyte) & 0x00ff; + nBytesPerCol=static_cast<sal_uInt16>(nbyte) & 0x00ff; if (nBytesPerCol == 0) { pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR); @@ -2464,7 +2464,7 @@ void OS2METReader::ReadField(sal_uInt16 nFieldType, sal_uInt16 nFieldSize) nbyte -= 0x30; nbyte2 -= 0x30; nbyte = (nbyte << 4) | nbyte2; - pB->nID=(pB->nID>>8)|(((sal_uInt32)nbyte)<<24); + pB->nID=(pB->nID>>8)|(static_cast<sal_uInt32>(nbyte)<<24); } // put new palette on the palette stack: (will be filled later) OSPalette * pP=new OSPalette; @@ -2507,15 +2507,15 @@ void OS2METReader::ReadField(sal_uInt16 nFieldType, sal_uInt16 nFieldSize) auto nPos = pOS2MET->Tell(); auto nMaxPos = nPos + nFieldSize; while (nPos<nMaxPos && pOS2MET->GetError()==ERRCODE_NONE) { - pOS2MET->ReadUChar( nbyte ); nDataID=((sal_uInt16)nbyte)&0x00ff; + pOS2MET->ReadUChar( nbyte ); nDataID=static_cast<sal_uInt16>(nbyte)&0x00ff; if (nDataID==0x00fe) { pOS2MET->ReadUChar( nbyte ); - nDataID=(nDataID<<8)|(((sal_uInt16)nbyte)&0x00ff); + nDataID=(nDataID<<8)|(static_cast<sal_uInt16>(nbyte)&0x00ff); nDataLen=ReadBigEndianWord(); nPos+=4; } else { - pOS2MET->ReadUChar( nbyte ); nDataLen=((sal_uInt16)nbyte)&0x00ff; + pOS2MET->ReadUChar( nbyte ); nDataLen=static_cast<sal_uInt16>(nbyte)&0x00ff; nPos+=2; } ReadImageData(nDataID, nDataLen); @@ -2558,10 +2558,10 @@ void OS2METReader::ReadField(sal_uInt16 nFieldType, sal_uInt16 nFieldSize) // loop through Order: while (pOS2MET->Tell()<nMaxPos && pOS2MET->GetError()==ERRCODE_NONE) { - pOS2MET->ReadUChar( nbyte ); nOrderID=((sal_uInt16)nbyte) & 0x00ff; + pOS2MET->ReadUChar( nbyte ); nOrderID=static_cast<sal_uInt16>(nbyte) & 0x00ff; if (nOrderID==0x00fe) { pOS2MET->ReadUChar( nbyte ); - nOrderID=(nOrderID << 8) | (((sal_uInt16)nbyte) & 0x00ff); + nOrderID=(nOrderID << 8) | (static_cast<sal_uInt16>(nbyte) & 0x00ff); } if (nOrderID>0x00ff || nOrderID==GOrdPolygn) { // ooo: As written in OS2 documentation, the order length should now @@ -2569,13 +2569,13 @@ void OS2METReader::ReadField(sal_uInt16 nFieldType, sal_uInt16 nFieldSize) // In reality there are files in which the length is stored as little endian word // (at least for nOrderID==GOrdPolygn) // So we throw a coin or what else can we do? - pOS2MET->ReadUChar( nbyte ); nOrderLen=(sal_uInt16)nbyte&0x00ff; - pOS2MET->ReadUChar( nbyte ); if (nbyte!=0) nOrderLen=nOrderLen<<8|(((sal_uInt16)nbyte)&0x00ff); + pOS2MET->ReadUChar( nbyte ); nOrderLen=static_cast<sal_uInt16>(nbyte)&0x00ff; + pOS2MET->ReadUChar( nbyte ); if (nbyte!=0) nOrderLen=nOrderLen<<8|(static_cast<sal_uInt16>(nbyte)&0x00ff); } else if (nOrderID==GOrdSTxAlg || nOrderID==GOrdPTxAlg) nOrderLen=2; else if ((nOrderID&0xff88)==0x0008) nOrderLen=1; else if (nOrderID==0x0000 || nOrderID==0x00ff) nOrderLen=0; - else { pOS2MET->ReadUChar( nbyte ); nOrderLen=((sal_uInt16)nbyte) & 0x00ff; } + else { pOS2MET->ReadUChar( nbyte ); nOrderLen=static_cast<sal_uInt16>(nbyte) & 0x00ff; } auto nPos=pOS2MET->Tell(); ReadOrder(nOrderID, nOrderLen); if (nPos+nOrderLen < pOS2MET->Tell()) { @@ -2601,8 +2601,8 @@ void OS2METReader::ReadField(sal_uInt16 nFieldType, sal_uInt16 nFieldSize) auto nMaxPos = pOS2MET->Tell() + nFieldSize; while (pOS2MET->Tell()<nMaxPos && pOS2MET->GetError()==ERRCODE_NONE) { - pOS2MET->ReadUChar( nbyte ); nDscID =((sal_uInt16)nbyte) & 0x00ff; - pOS2MET->ReadUChar( nbyte ); nDscLen=((sal_uInt16)nbyte) & 0x00ff; + pOS2MET->ReadUChar( nbyte ); nDscID =static_cast<sal_uInt16>(nbyte) & 0x00ff; + pOS2MET->ReadUChar( nbyte ); nDscLen=static_cast<sal_uInt16>(nbyte) & 0x00ff; auto nPos = pOS2MET->Tell(); ReadDsc(nDscID); pOS2MET->Seek(nPos+nDscLen); diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx index c0476adbbd5e..d1e5eb09cc5d 100644 --- a/filter/source/graphicfilter/ipbm/ipbm.cxx +++ b/filter/source/graphicfilter/ipbm/ipbm.cxx @@ -109,7 +109,7 @@ bool PBMReader::ReadPBM(Graphic & rGraphic ) if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == nullptr ) return false; - mnCol = (sal_uInt16)mnMaxVal + 1; + mnCol = static_cast<sal_uInt16>(mnMaxVal) + 1; if ( mnCol > 256 ) mnCol = 256; @@ -117,7 +117,7 @@ bool PBMReader::ReadPBM(Graphic & rGraphic ) for ( sal_uLong i = 0; i < mnCol; i++ ) { sal_uLong nCount = 255 * i / mnCol; - mpAcc->SetPaletteColor( i, BitmapColor( (sal_uInt8)nCount, (sal_uInt8)nCount, (sal_uInt8)nCount ) ); + mpAcc->SetPaletteColor( i, BitmapColor( static_cast<sal_uInt8>(nCount), static_cast<sal_uInt8>(nCount), static_cast<sal_uInt8>(nCount) ) ); } break; case 2 : @@ -329,7 +329,7 @@ bool PBMReader::ImplReadBody() nRed = 255 * nR / mnMaxVal; nGreen = 255 * nG / mnMaxVal; nBlue = 255 * nB / mnMaxVal; - mpAcc->SetPixel( nHeight, nWidth++, BitmapColor( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) ); + mpAcc->SetPixel( nHeight, nWidth++, BitmapColor( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) ); if ( nWidth == mnWidth ) { nWidth = 0; diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/filter/source/graphicfilter/ipcd/ipcd.cxx index 5adaf3e7d911..323e58b4d634 100644 --- a/filter/source/graphicfilter/ipcd/ipcd.cxx +++ b/filter/source/graphicfilter/ipcd/ipcd.cxx @@ -277,31 +277,31 @@ void PCDReader::ReadImage() nXPair = nx >> 1; if ( ndy == 0 ) { - nL = (long)pL0[ nx ]; + nL = static_cast<long>(pL0[ nx ]); if (( nx & 1 ) == 0 ) { - nCb = (long)pCb[ nXPair ]; - nCr = (long)pCr[ nXPair ]; + nCb = static_cast<long>(pCb[ nXPair ]); + nCr = static_cast<long>(pCr[ nXPair ]); } else { - nCb = ( ( (long)pCb[ nXPair ] ) + ( (long)pCb[ nXPair + 1 ] ) ) >> 1; - nCr = ( ( (long)pCr[ nXPair ] ) + ( (long)pCr[ nXPair + 1 ] ) ) >> 1; + nCb = ( static_cast<long>(pCb[ nXPair ]) + static_cast<long>(pCb[ nXPair + 1 ]) ) >> 1; + nCr = ( static_cast<long>(pCr[ nXPair ]) + static_cast<long>(pCr[ nXPair + 1 ]) ) >> 1; } } else { nL = pL1[ nx ]; if ( ( nx & 1 ) == 0 ) { - nCb = ( ( (long)pCb[ nXPair ] ) + ( (long)pCbN[ nXPair ] ) ) >> 1; - nCr = ( ( (long)pCr[ nXPair ] ) + ( (long)pCrN[ nXPair ] ) ) >> 1; + nCb = ( static_cast<long>(pCb[ nXPair ]) + static_cast<long>(pCbN[ nXPair ]) ) >> 1; + nCr = ( static_cast<long>(pCr[ nXPair ]) + static_cast<long>(pCrN[ nXPair ]) ) >> 1; } else { - nCb = ( ( (long)pCb[ nXPair ] ) + ( (long)pCb[ nXPair + 1 ] ) + - ( (long)pCbN[ nXPair ] ) + ( (long)pCbN[ nXPair + 1 ] ) ) >> 2; - nCr = ( ( (long)pCr[ nXPair ] ) + ( (long)pCr[ nXPair + 1] ) + - ( (long)pCrN[ nXPair ] ) + ( (long)pCrN[ nXPair + 1 ] ) ) >> 2; + nCb = ( static_cast<long>(pCb[ nXPair ]) + static_cast<long>(pCb[ nXPair + 1 ]) + + static_cast<long>(pCbN[ nXPair ]) + static_cast<long>(pCbN[ nXPair + 1 ]) ) >> 2; + nCr = ( static_cast<long>(pCr[ nXPair ]) + static_cast<long>(pCr[ nXPair + 1]) + + static_cast<long>(pCrN[ nXPair ]) + static_cast<long>(pCrN[ nXPair + 1 ]) ) >> 2; } } // conversion of nL,nCb,nCr in nRed,nGreen,nBlue: @@ -328,16 +328,16 @@ void PCDReader::ReadImage() if ( nOrientation < 2 ) { if ( nOrientation == 0 ) - mpAcc->SetPixel( ny, nx, BitmapColor( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) ); + mpAcc->SetPixel( ny, nx, BitmapColor( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) ); else - mpAcc->SetPixel( nWidth - 1 - nx, ny, BitmapColor( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) ); + mpAcc->SetPixel( nWidth - 1 - nx, ny, BitmapColor( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) ); } else { if ( nOrientation == 2 ) - mpAcc->SetPixel( nHeight - 1 - ny, ( nWidth - 1 - nx ), BitmapColor( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) ); + mpAcc->SetPixel( nHeight - 1 - ny, ( nWidth - 1 - nx ), BitmapColor( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) ); else - mpAcc->SetPixel( nx, ( nHeight - 1 - ny ), BitmapColor( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) ); + mpAcc->SetPixel( nx, ( nHeight - 1 - ny ), BitmapColor( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) ); } } } diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index 4adfb3ec24f1..b6ea13f04a3d 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -151,7 +151,7 @@ void PCXReader::ImplReadHeader() } nbyte = 0; - m_rPCX.ReadUChar( nbyte ); nBitsPerPlanePix = (sal_uLong)nbyte; + m_rPCX.ReadUChar( nbyte ); nBitsPerPlanePix = static_cast<sal_uLong>(nbyte); sal_uInt16 nMinX(0),nMinY(0),nMaxX(0),nMaxY(0); m_rPCX.ReadUInt16( nMinX ).ReadUInt16( nMinY ).ReadUInt16( nMaxX ).ReadUInt16( nMaxY ); @@ -173,15 +173,15 @@ void PCXReader::ImplReadHeader() m_rPCX.SeekRel( 1 ); nbyte = 0; - m_rPCX.ReadUChar( nbyte ); nPlanes = (sal_uLong)nbyte; + m_rPCX.ReadUChar( nbyte ); nPlanes = static_cast<sal_uLong>(nbyte); sal_uInt16 nushort(0); - m_rPCX.ReadUInt16( nushort ); nBytesPerPlaneLin = (sal_uLong)nushort; + m_rPCX.ReadUInt16( nushort ); nBytesPerPlaneLin = static_cast<sal_uLong>(nushort); sal_uInt16 nPaletteInfo; m_rPCX.ReadUInt16( nPaletteInfo ); m_rPCX.SeekRel( 58 ); - nDestBitsPerPixel = (sal_uInt16)( nBitsPerPlanePix * nPlanes ); + nDestBitsPerPixel = static_cast<sal_uInt16>( nBitsPerPlanePix * nPlanes ); if (nDestBitsPerPixel == 2 || nDestBitsPerPixel == 3) nDestBitsPerPixel = 4; if ( ( nDestBitsPerPixel != 1 && nDestBitsPerPixel != 4 && nDestBitsPerPixel != 8 && nDestBitsPerPixel != 24 ) @@ -242,7 +242,7 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) m_rPCX.ReadUChar( nDat ); if ( ( nDat & 0xc0 ) == 0xc0 ) { - nCount =( (sal_uLong)nDat ) & 0x003f; + nCount =static_cast<sal_uLong>(nDat) & 0x003f; m_rPCX.ReadUChar( nDat ); if ( nCount < nx ) { diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index a661c9a2e9a5..323501eaffeb 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -98,14 +98,14 @@ namespace PictReaderInternal { } // store pattern in 2 long words: - nHiBytes=(((((((sal_uLong)nbyte[0])<<8)| - (sal_uLong)nbyte[1])<<8)| - (sal_uLong)nbyte[2])<<8)| - (sal_uLong)nbyte[3]; - nLoBytes=(((((((sal_uLong)nbyte[4])<<8)| - (sal_uLong)nbyte[5])<<8)| - (sal_uLong)nbyte[6])<<8)| - (sal_uLong)nbyte[7]; + nHiBytes=(((((static_cast<sal_uLong>(nbyte[0])<<8)| + static_cast<sal_uLong>(nbyte[1]))<<8)| + static_cast<sal_uLong>(nbyte[2]))<<8)| + static_cast<sal_uLong>(nbyte[3]); + nLoBytes=(((((static_cast<sal_uLong>(nbyte[4])<<8)| + static_cast<sal_uLong>(nbyte[5]))<<8)| + static_cast<sal_uLong>(nbyte[6]))<<8)| + static_cast<sal_uLong>(nbyte[7]); // create a PenStyle: if (nBitCount<=0) penStyle=PEN_NULL; @@ -360,8 +360,8 @@ Point PictReader::ReadPoint() pPict->ReadInt16( ny ).ReadInt16( nx ); - Point aPoint( (long)nx - aBoundingRect.Left(), - (long)ny - aBoundingRect.Top() ); + Point aPoint( static_cast<long>(nx) - aBoundingRect.Left(), + static_cast<long>(ny) - aBoundingRect.Top() ); SAL_INFO("filter.pict", "ReadPoint: " << aPoint); return aPoint; @@ -373,7 +373,7 @@ Point PictReader::ReadDeltaH(Point aBase) pPict->ReadChar( reinterpret_cast<char&>(ndh) ); - return Point( aBase.X() + (long)ndh, aBase.Y() ); + return Point( aBase.X() + static_cast<long>(ndh), aBase.Y() ); } Point PictReader::ReadDeltaV(Point aBase) @@ -382,7 +382,7 @@ Point PictReader::ReadDeltaV(Point aBase) pPict->ReadChar( reinterpret_cast<char&>(ndv) ); - return Point( aBase.X(), aBase.Y() + (long)ndv ); + return Point( aBase.X(), aBase.Y() + static_cast<long>(ndv) ); } Point PictReader::ReadUnsignedDeltaH(Point aBase) @@ -391,7 +391,7 @@ Point PictReader::ReadUnsignedDeltaH(Point aBase) pPict->ReadUChar( ndh ); - return Point( aBase.X() + (long)ndh, aBase.Y() ); + return Point( aBase.X() + static_cast<long>(ndh), aBase.Y() ); } Point PictReader::ReadUnsignedDeltaV(Point aBase) @@ -400,7 +400,7 @@ Point PictReader::ReadUnsignedDeltaV(Point aBase) pPict->ReadUChar( ndv ); - return Point( aBase.X(), aBase.Y() + (long)ndv ); + return Point( aBase.X(), aBase.Y() + static_cast<long>(ndv) ); } Size PictReader::ReadSize() @@ -409,7 +409,7 @@ Size PictReader::ReadSize() pPict->ReadInt16( ny ).ReadInt16( nx ); - return Size( (long)nx, (long)ny ); + return Size( static_cast<long>(nx), static_cast<long>(ny) ); } Color PictReader::ReadColor() @@ -439,7 +439,7 @@ Color PictReader::ReadRGBColor() sal_uInt16 nR, nG, nB; pPict->ReadUInt16( nR ).ReadUInt16( nG ).ReadUInt16( nB ); - return Color( (sal_uInt8) ( nR >> 8 ), (sal_uInt8) ( nG >> 8 ), (sal_uInt8) ( nB >> 8 ) ); + return Color( static_cast<sal_uInt8>( nR >> 8 ), static_cast<sal_uInt8>( nG >> 8 ), static_cast<sal_uInt8>( nB >> 8 ) ); } @@ -459,7 +459,7 @@ sal_uLong PictReader::ReadPolygon(tools::Polygon & rPoly) sal_uInt16 nSize(0); pPict->ReadUInt16(nSize); pPict->SeekRel(8); - sal_uLong nDataSize = (sal_uLong)nSize; + sal_uLong nDataSize = static_cast<sal_uLong>(nSize); nSize=(nSize-10)/4; const size_t nMaxPossiblePoints = pPict->remainingSize() / 2 * sizeof(sal_uInt16); if (nSize > nMaxPossiblePoints) @@ -503,7 +503,7 @@ sal_uLong PictReader::ReadPixPattern(PictReader::Pattern &pattern) // RGBColor sal_uInt16 nR, nG, nB; pPict->ReadUInt16( nR ).ReadUInt16( nG ).ReadUInt16( nB ); - Color col((sal_uInt8) ( nR >> 8 ), (sal_uInt8) ( nG >> 8 ), (sal_uInt8) ( nB >> 8 ) ); + Color col(static_cast<sal_uInt8>( nR >> 8 ), static_cast<sal_uInt8>( nG >> 8 ), static_cast<sal_uInt8>( nB >> 8 ) ); pattern.setColor(col); nDataSize=16; } @@ -595,8 +595,8 @@ sal_uLong PictReader::ReadAndDrawSameArc(PictDrawingMethod eMethod) narcAngle=-narcAngle; } const double pi = 2 * acos(0.0); - fAng1 = ( (double)nstartAngle ) * pi / 180.0; - fAng2 = ( (double)(nstartAngle + narcAngle) ) * pi / 180.0; + fAng1 = static_cast<double>(nstartAngle) * pi / 180.0; + fAng2 = static_cast<double>(nstartAngle + narcAngle) * pi / 180.0; PictReaderShape::drawArc( pVirDev, eMethod == PictDrawingMethod::FRAME, aLastArcRect, fAng1, fAng2, nActPenSize ); return 4; } @@ -621,7 +621,7 @@ sal_uLong PictReader::ReadAndDrawRgn(PictDrawingMethod eMethod) // - takes M and inverts all values in [a_0,b_0-1], in [a_1,b_1-1] ... // - sets M = new y_i line mask ReadAndDrawSameRgn(eMethod); - return (sal_uLong)nSize; + return static_cast<sal_uLong>(nSize); } sal_uLong PictReader::ReadAndDrawSameRgn(PictDrawingMethod eMethod) @@ -692,7 +692,7 @@ sal_uLong PictReader::ReadAndDrawText() sal_uInt32 nLen, nDataLen; sal_Char sText[256]; - pPict->ReadChar( nByteLen ); nLen=((sal_uLong)nByteLen)&0x000000ff; + pPict->ReadChar( nByteLen ); nLen=static_cast<sal_uLong>(nByteLen)&0x000000ff; nDataLen = nLen + 1; pPict->ReadBytes(&sText, nLen); @@ -700,7 +700,7 @@ sal_uLong PictReader::ReadAndDrawText() DrawingMethod( PictDrawingMethod::TEXT ); // remove annoying control characters: - while ( nLen > 0 && ( (unsigned char)sText[ nLen - 1 ] ) < 32 ) + while ( nLen > 0 && static_cast<unsigned char>(sText[ nLen - 1 ]) < 32 ) nLen--; sText[ nLen ] = 0; OUString aString( sText, strlen(sText), aActFont.GetCharSet()); @@ -813,7 +813,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo { sal_uInt16 nTop, nLeft, nBottom, nRight; pPict->ReadUInt16( nTop ).ReadUInt16( nLeft ).ReadUInt16( nBottom ).ReadUInt16( nRight ); - *pSrcRect = tools::Rectangle( (sal_uLong)nLeft, (sal_uLong)nTop, (sal_uLong)nRight, (sal_uLong)nBottom ); + *pSrcRect = tools::Rectangle( static_cast<sal_uLong>(nLeft), static_cast<sal_uLong>(nTop), static_cast<sal_uLong>(nRight), static_cast<sal_uLong>(nBottom) ); nDataSize += 8; } @@ -840,7 +840,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo sal_uInt16 nSize; pPict->ReadUInt16( nSize ); pPict->SeekRel( nSize - 2 ); - nDataSize += (sal_uLong)nSize; + nDataSize += static_cast<sal_uLong>(nSize); } BitmapWriteAccess* pAcc = nullptr; @@ -893,14 +893,14 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo if ( nRowBytes > 250 ) { pPict->ReadUInt16( nByteCount ); - nDataSize += 2 + (sal_uLong)nByteCount; + nDataSize += 2 + static_cast<sal_uLong>(nByteCount); } else { sal_uInt8 nByteCountAsByte(0); pPict->ReadUChar( nByteCountAsByte ); - nByteCount = ( (sal_uInt16)nByteCountAsByte ) & 0x00ff; - nDataSize += 1 + (sal_uLong)nByteCount; + nByteCount = static_cast<sal_uInt16>(nByteCountAsByte) & 0x00ff; + nDataSize += 1 + static_cast<sal_uLong>(nByteCount); } while (pPict->good() && nByteCount) @@ -909,7 +909,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo pPict->ReadUChar(nFlagCounterByte); if ( ( nFlagCounterByte & 0x80 ) == 0 ) { - nCount = ( (sal_uInt16)nFlagCounterByte ) + 1; + nCount = static_cast<sal_uInt16>(nFlagCounterByte) + 1; for (size_t i = 0; i < nCount; ++i) { pPict->ReadUChar( nDat ); @@ -920,7 +920,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo } else { - nCount = static_cast<sal_uInt16>( 1 - sal_Int16( ( (sal_uInt16)nFlagCounterByte ) | 0xff00 ) ); + nCount = static_cast<sal_uInt16>( 1 - sal_Int16( static_cast<sal_uInt16>(nFlagCounterByte) | 0xff00 ) ); pPict->ReadUChar( nDat ); for (size_t i = 0; i < nCount; ++i) { @@ -965,12 +965,12 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo for (size_t i = 0; i < nWidth; ++i) { pPict->ReadUInt16( nD ); - nRed = (sal_uInt8)( nD >> 7 ); - nGreen = (sal_uInt8)( nD >> 2 ); - nBlue = (sal_uInt8)( nD << 3 ); + nRed = static_cast<sal_uInt8>( nD >> 7 ); + nGreen = static_cast<sal_uInt8>( nD >> 2 ); + nBlue = static_cast<sal_uInt8>( nD << 3 ); pAcc->SetPixel( ny, nx++, BitmapColor( nRed, nGreen, nBlue ) ); } - nDataSize += ( (sal_uLong)nWidth ) * 2; + nDataSize += static_cast<sal_uLong>(nWidth) * 2; } else { @@ -983,7 +983,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo else { pPict->ReadUChar( nByteCountAsByte ); - nByteCount = ( (sal_uInt16)nByteCountAsByte ) & 0x00ff; + nByteCount = static_cast<sal_uInt16>(nByteCountAsByte) & 0x00ff; nByteCount++; } while ( nx != nWidth ) @@ -991,7 +991,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo pPict->ReadUChar( nFlagCounterByte ); if ( (nFlagCounterByte & 0x80) == 0) { - nCount=((sal_uInt16)nFlagCounterByte)+1; + nCount=static_cast<sal_uInt16>(nFlagCounterByte)+1; if ( nCount + nx > nWidth) nCount = nWidth - nx; if (pPict->remainingSize() < sizeof(sal_uInt16) * nCount) @@ -1004,9 +1004,9 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo for (size_t i = 0; i < nCount; ++i) { pPict->ReadUInt16( nD ); - nRed = (sal_uInt8)( nD >> 7 ); - nGreen = (sal_uInt8)( nD >> 2 ); - nBlue = (sal_uInt8)( nD << 3 ); + nRed = static_cast<sal_uInt8>( nD >> 7 ); + nGreen = static_cast<sal_uInt8>( nD >> 2 ); + nBlue = static_cast<sal_uInt8>( nD << 3 ); pAcc->SetPixel( ny, nx++, BitmapColor( nRed, nGreen, nBlue ) ); } } @@ -1014,21 +1014,21 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo { if (pPict->remainingSize() < sizeof(sal_uInt16)) BITMAPERROR; - nCount=(1-sal_Int16(((sal_uInt16)nFlagCounterByte)|0xff00)); + nCount=(1-sal_Int16(static_cast<sal_uInt16>(nFlagCounterByte)|0xff00)); if ( nCount + nx > nWidth ) nCount = nWidth - nx; pPict->ReadUInt16( nD ); - nRed = (sal_uInt8)( nD >> 7 ); - nGreen = (sal_uInt8)( nD >> 2 ); - nBlue = (sal_uInt8)( nD << 3 ); + nRed = static_cast<sal_uInt8>( nD >> 7 ); + nGreen = static_cast<sal_uInt8>( nD >> 2 ); + nBlue = static_cast<sal_uInt8>( nD << 3 ); for (size_t i = 0; i < nCount; ++i) { pAcc->SetPixel( ny, nx++, BitmapColor( nRed, nGreen, nBlue ) ); } } } - nDataSize+=(sal_uLong)nByteCount; - pPict->Seek(nSrcBitsPos+(sal_uLong)nByteCount); + nDataSize+=static_cast<sal_uLong>(nByteCount); + pPict->Seek(nSrcBitsPos+static_cast<sal_uLong>(nByteCount)); } } } @@ -1062,7 +1062,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo pPict->ReadUChar( nDummy ).ReadUChar( nRed ).ReadUChar( nGreen ).ReadUChar( nBlue ); pAcc->SetPixel( ny, nx, BitmapColor( nRed, nGreen, nBlue) ); } - nDataSize += ( (sal_uLong)nWidth ) * 4; + nDataSize += static_cast<sal_uLong>(nWidth) * 4; } } else if ( nPackType == 2 ) @@ -1085,7 +1085,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo pPict->ReadUChar( nRed ).ReadUChar( nGreen ).ReadUChar( nBlue ); pAcc->SetPixel( ny, nx, BitmapColor( nRed, nGreen, nBlue ) ); } - nDataSize += ( (sal_uLong)nWidth ) * 3; + nDataSize += static_cast<sal_uLong>(nWidth) * 3; } } else @@ -1123,7 +1123,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo pPict->ReadUChar( nFlagCounterByte ); if ( ( nFlagCounterByte & 0x80 ) == 0) { - nCount = ( (sal_uInt16)nFlagCounterByte ) + 1; + nCount = static_cast<sal_uInt16>(nFlagCounterByte) + 1; if ((i + nCount) > nByteWidth) nCount = nByteWidth - i; if (pPict->remainingSize() < nCount) @@ -1138,7 +1138,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo { if (pPict->remainingSize() < 1) BITMAPERROR; - nCount = ( 1 - sal_Int16( ( (sal_uInt16)nFlagCounterByte ) | 0xff00 ) ); + nCount = ( 1 - sal_Int16( static_cast<sal_uInt16>(nFlagCounterByte) | 0xff00 ) ); if (( i + nCount) > nByteWidth) nCount = nByteWidth - i; pPict->ReadUChar( nDat ); @@ -1151,8 +1151,8 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo pTmp += nWidth; for (sal_uInt16 nx = 0; nx < nWidth; pTmp++) pAcc->SetPixel( ny, nx++, BitmapColor( *pTmp, pTmp[ nWidth ], pTmp[ 2 * nWidth ] ) ); - nDataSize += (sal_uLong)nByteCount; - pPict->Seek( nSrcBitsPos + (sal_uLong)nByteCount ); + nDataSize += static_cast<sal_uLong>(nByteCount); + pPict->Seek( nSrcBitsPos + static_cast<sal_uLong>(nByteCount) ); } } } @@ -1459,7 +1459,7 @@ sal_uLong PictReader::ReadData(sal_uInt16 nOpcode) case 0x000d: // TxSize { pPict->ReadUInt16( nUSHORT ); - aActFont.SetFontSize( Size( 0, (long)nUSHORT ) ); + aActFont.SetFontSize( Size( 0, static_cast<long>(nUSHORT) ) ); eActMethod = PictDrawingMethod::UNDEFINED; nDataSize=2; } @@ -1623,7 +1623,7 @@ sal_uLong PictReader::ReadData(sal_uInt16 nOpcode) else if (nUSHORT <= 1023) aActFont.SetFamily(FAMILY_SWISS); else aActFont.SetFamily(FAMILY_ROMAN); aActFont.SetCharSet(GetTextEncoding(nUSHORT)); - pPict->ReadChar( nByteLen ); nLen=((sal_uInt16)nByteLen)&0x00ff; + pPict->ReadChar( nByteLen ); nLen=static_cast<sal_uInt16>(nByteLen)&0x00ff; pPict->ReadBytes(&sFName, nLen); sFName[ nLen ] = 0; OUString aString( sFName, strlen(sFName), osl_getThreadTextEncoding() ); @@ -1954,7 +1954,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ) else { pPict->ReadUChar( nOneByteOpcode ); - nOpcode=(sal_uInt16)nOneByteOpcode; + nOpcode=static_cast<sal_uInt16>(nOneByteOpcode); } if (pPict->GetError()) diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx index 29718b67119c..9f08f4dd8c93 100644 --- a/filter/source/graphicfilter/ipsd/ipsd.cxx +++ b/filter/source/graphicfilter/ipsd/ipsd.cxx @@ -247,7 +247,7 @@ bool PSDReader::ImplReadHeader() mpPalette.reset( new sal_uInt8[ 768 ] ); for ( sal_uInt16 i = 0; i < 256; i++ ) { - mpPalette[ i ] = mpPalette[ i + 256 ] = mpPalette[ i + 512 ] = (sal_uInt8)i; + mpPalette[ i ] = mpPalette[ i + 256 ] = mpPalette[ i + 512 ] = static_cast<sal_uInt8>(i); } } break; @@ -472,7 +472,7 @@ bool PSDReader::ImplReadBody() const sal_uInt16 nCount = -nRunCount + 1; for (sal_uInt16 i = 0; i < nCount && m_rPSD.good(); ++i) { - mpWriteAcc->SetPixel( nY, nX, BitmapColor( nRed, (sal_uInt8)0, (sal_uInt8)0 ) ); + mpWriteAcc->SetPixel( nY, nX, BitmapColor( nRed, sal_uInt8(0), sal_uInt8(0) ) ); if ( ++nX == mpFileHeader->nColumns ) { nX = 0; @@ -490,7 +490,7 @@ bool PSDReader::ImplReadBody() m_rPSD.ReadUChar( nRed ); if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped m_rPSD.ReadUChar( nDummy ); - mpWriteAcc->SetPixel( nY, nX, BitmapColor( nRed, (sal_uInt8)0, (sal_uInt8)0 ) ); + mpWriteAcc->SetPixel( nY, nX, BitmapColor( nRed, sal_uInt8(0), sal_uInt8(0) ) ); if ( ++nX == mpFileHeader->nColumns ) { nX = 0; @@ -677,9 +677,9 @@ bool PSDReader::ImplReadBody() sal_Int32 nDAT = pBlack[ nX + nY * mpFileHeader->nColumns ] * ( nBlackMax - 256 ) / 0x1ff; aBitmapColor = mpReadAcc->GetPixel( nY, nX ); - sal_uInt8 cR = (sal_uInt8) MinMax( aBitmapColor.GetRed() - nDAT, 0L, 255L ); - sal_uInt8 cG = (sal_uInt8) MinMax( aBitmapColor.GetGreen() - nDAT, 0L, 255L ); - sal_uInt8 cB = (sal_uInt8) MinMax( aBitmapColor.GetBlue() - nDAT, 0L, 255L ); + sal_uInt8 cR = static_cast<sal_uInt8>(MinMax( aBitmapColor.GetRed() - nDAT, 0L, 255L )); + sal_uInt8 cG = static_cast<sal_uInt8>(MinMax( aBitmapColor.GetGreen() - nDAT, 0L, 255L )); + sal_uInt8 cB = static_cast<sal_uInt8>(MinMax( aBitmapColor.GetBlue() - nDAT, 0L, 255L )); mpWriteAcc->SetPixel( nY, nX, BitmapColor( cR, cG, cB ) ); } } diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx index 232ac9807dc2..78670d0f3287 100644 --- a/filter/source/graphicfilter/iras/iras.cxx +++ b/filter/source/graphicfilter/iras/iras.cxx @@ -109,7 +109,7 @@ bool RASReader::ReadRAS(Graphic & rGraphic) } else if ( mnColorMapType == RAS_COLOR_RGB_MAP ) // we can read out the RGB { - mnDstColors = (sal_uInt16)( mnColorMapSize / 3 ); + mnDstColors = static_cast<sal_uInt16>( mnColorMapSize / 3 ); if ( ( 1 << mnDstBitsPerPix ) < mnDstColors ) return false; @@ -142,7 +142,7 @@ bool RASReader::ReadRAS(Graphic & rGraphic) for ( sal_uInt16 i = 0; i < mnDstColors; i++ ) { sal_uLong nCount = 255 - ( 255 * i / ( mnDstColors - 1 ) ); - aPalette[i] = BitmapColor((sal_uInt8)nCount, (sal_uInt8)nCount, (sal_uInt8)nCount); + aPalette[i] = BitmapColor(static_cast<sal_uInt8>(nCount), static_cast<sal_uInt8>(nCount), static_cast<sal_uInt8>(nCount)); } bPalette = true; } @@ -204,7 +204,7 @@ bool RASReader::ImplReadHeader() case 24 : case 8 : case 1 : - mnDstBitsPerPix = (sal_uInt16)mnDepth; + mnDstBitsPerPix = static_cast<sal_uInt16>(mnDepth); break; case 32 : mnDstBitsPerPix = 24; diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx index 10681f221085..4efbd21d3e4b 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -312,9 +312,9 @@ bool TGAReader::ImplReadBody() m_rTGA.ReadUInt16( nRGB16 ); if ( nRGB16 >= mpFileHeader->nColorMapLength ) return false; - nRed = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 16 ); - nGreen = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 8 ); - nBlue = (sal_uInt8)( mpColorMap[ nRGB16 ] ); + nRed = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 16 ); + nGreen = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 8 ); + nBlue = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] ); if ( !m_rTGA.good()) return false; for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ ) @@ -343,9 +343,9 @@ bool TGAReader::ImplReadBody() return false; if ( nRGB16 >= mpFileHeader->nColorMapLength ) return false; - nRed = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 16 ); - nGreen = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 8 ); - nBlue = (sal_uInt8)( mpColorMap[ nRGB16 ] ); + nRed = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 16 ); + nGreen = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 8 ); + nBlue = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] ); if ( !m_rTGA.good()) return false; mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) ); @@ -554,9 +554,9 @@ bool TGAReader::ImplReadBody() m_rTGA.ReadUInt16( nRGB16 ); if ( !m_rTGA.good()) return false; - nRed = (sal_uInt8)( nRGB16 >> 7 ) & 0xf8; - nGreen = (sal_uInt8)( nRGB16 >> 2 ) & 0xf8; - nBlue = (sal_uInt8)( nRGB16 << 3 ) & 0xf8; + nRed = static_cast<sal_uInt8>( nRGB16 >> 7 ) & 0xf8; + nGreen = static_cast<sal_uInt8>( nRGB16 >> 2 ) & 0xf8; + nBlue = static_cast<sal_uInt8>( nRGB16 << 3 ) & 0xf8; for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ ) { mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) ); @@ -581,9 +581,9 @@ bool TGAReader::ImplReadBody() m_rTGA.ReadUInt16( nRGB16 ); if ( !m_rTGA.good()) return false; - nRed = (sal_uInt8)( nRGB16 >> 7 ) & 0xf8; - nGreen = (sal_uInt8)( nRGB16 >> 2 ) & 0xf8; - nBlue = (sal_uInt8)( nRGB16 << 3 ) & 0xf8; + nRed = static_cast<sal_uInt8>( nRGB16 >> 7 ) & 0xf8; + nGreen = static_cast<sal_uInt8>( nRGB16 >> 2 ) & 0xf8; + nBlue = static_cast<sal_uInt8>( nRGB16 << 3 ) & 0xf8; mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) ); nX += nXAdd; nXCount++; @@ -627,9 +627,9 @@ bool TGAReader::ImplReadBody() return false; if ( nRGB16 >= mpFileHeader->nColorMapLength ) return false; - nRed = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 16 ); - nGreen = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 8 ); - nBlue = (sal_uInt8)( mpColorMap[ nRGB16 ] ); + nRed = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 16 ); + nGreen = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 8 ); + nBlue = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] ); mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) ); } break; @@ -685,9 +685,9 @@ bool TGAReader::ImplReadBody() m_rTGA.ReadUInt16( nRGB16 ); if ( !m_rTGA.good()) return false; - nRed = (sal_uInt8)( nRGB16 >> 7 ) & 0xf8; - nGreen = (sal_uInt8)( nRGB16 >> 2 ) & 0xf8; - nBlue = (sal_uInt8)( nRGB16 << 3 ) & 0xf8; + nRed = static_cast<sal_uInt8>( nRGB16 >> 7 ) & 0xf8; + nGreen = static_cast<sal_uInt8>( nRGB16 >> 2 ) & 0xf8; + nBlue = static_cast<sal_uInt8>( nRGB16 << 3 ) & 0xf8; mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) ); } break; @@ -775,8 +775,8 @@ bool TGAReader::ImplReadPalette() mpAcc->SetPaletteEntryCount( nColors ); for ( sal_uInt16 i = 0; i < nColors; i++ ) { - mpAcc->SetPaletteColor( i, Color( (sal_uInt8)( mpColorMap[ i ] >> 16 ), - (sal_uInt8)( mpColorMap[ i ] >> 8 ), (sal_uInt8)(mpColorMap[ i ] ) ) ); + mpAcc->SetPaletteColor( i, Color( static_cast<sal_uInt8>( mpColorMap[ i ] >> 16 ), + static_cast<sal_uInt8>( mpColorMap[ i ] >> 8 ), static_cast<sal_uInt8>(mpColorMap[ i ] ) ) ); } } } diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx index 9d638c0260c3..00d39b866e18 100644 --- a/filter/source/graphicfilter/itiff/ccidecom.cxx +++ b/filter/source/graphicfilter/itiff/ccidecom.cxx @@ -776,10 +776,10 @@ bool CCIDecompressor::ReadEOL() if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=(nInputBitsBuf<<8) | (sal_uLong)nByte; + nInputBitsBuf=(nInputBitsBuf<<8) | static_cast<sal_uLong>(nByte); nInputBitsBufSize += 8; } - nCode = (sal_uInt16)( ( nInputBitsBuf >> ( nInputBitsBufSize - 12 ) ) & 0x0fff ); + nCode = static_cast<sal_uInt16>( ( nInputBitsBuf >> ( nInputBitsBufSize - 12 ) ) & 0x0fff ); if ( nCode == 0x0001 ) { nEOLCount++; @@ -802,7 +802,7 @@ bool CCIDecompressor::Read2DTag() pIStream->ReadUChar( nByte ); if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=(sal_uLong)nByte; + nInputBitsBuf=static_cast<sal_uLong>(nByte); nInputBitsBufSize=8; } nInputBitsBufSize--; @@ -819,7 +819,7 @@ sal_uInt8 CCIDecompressor::ReadBlackOrWhite() pIStream->ReadUChar( nByte ); if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=(sal_uLong)nByte; + nInputBitsBuf=static_cast<sal_uLong>(nByte); nInputBitsBufSize=8; } nInputBitsBufSize--; @@ -838,10 +838,10 @@ sal_uInt16 CCIDecompressor::ReadCodeAndDecode(const CCILookUpTableEntry * pLookU pIStream->ReadUChar( nByte ); if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=(nInputBitsBuf<<8) | (sal_uLong)nByte; + nInputBitsBuf=(nInputBitsBuf<<8) | static_cast<sal_uLong>(nByte); nInputBitsBufSize+=8; } - sal_uInt16 nCode = (sal_uInt16)((nInputBitsBuf>>(nInputBitsBufSize-nMaxCodeBits)) + sal_uInt16 nCode = static_cast<sal_uInt16>((nInputBitsBuf>>(nInputBitsBufSize-nMaxCodeBits)) &(0xffff>>(16-nMaxCodeBits))); sal_uInt16 nCodeBits = pLookUp[nCode].nCodeBits; if (nCodeBits==0) bStatus=false; @@ -932,10 +932,10 @@ bool CCIDecompressor::Read1DScanlineData(sal_uInt8 * pTarget, sal_uInt16 nBitsTo pIStream->ReadUChar( nByte ); if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=(nInputBitsBuf<<8) | (sal_uLong)nByte; + nInputBitsBuf=(nInputBitsBuf<<8) | static_cast<sal_uLong>(nByte); nInputBitsBufSize+=8; } - nCode=(sal_uInt16)((nInputBitsBuf>>(nInputBitsBufSize-13))&0x1fff); + nCode=static_cast<sal_uInt16>((nInputBitsBuf>>(nInputBitsBufSize-13))&0x1fff); // determine the number of DataBits CodeBits: if (nBlackOrWhite) { diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index a9c875e2287d..c2086aa2023b 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -253,11 +253,11 @@ sal_uInt32 TIFFReader::ReadIntData() break; case 6 : pTIFF->ReadChar( nCHAR ); - nUINT32a = (sal_Int32)nCHAR; + nUINT32a = static_cast<sal_Int32>(nCHAR); break; case 8 : pTIFF->ReadInt16( nINT16 ); - nUINT32a = (sal_Int32)nINT16; + nUINT32a = static_cast<sal_Int32>(nINT16); break; case 10 : pTIFF->ReadUInt32( nUINT32a ).ReadInt32( nINT32 ); @@ -266,11 +266,11 @@ sal_uInt32 TIFFReader::ReadIntData() break; case 11 : pTIFF->ReadFloat( nFLOAT ); - nUINT32a = (sal_Int32)nFLOAT; + nUINT32a = static_cast<sal_Int32>(nFLOAT); break; case 12 : pTIFF->ReadDouble( nDOUBLE ); - nUINT32a = (sal_Int32)nDOUBLE; + nUINT32a = static_cast<sal_Int32>(nDOUBLE); break; default: pTIFF->ReadUInt32( nUINT32a ); @@ -287,14 +287,14 @@ double TIFFReader::ReadDoubleData() { sal_uInt32 nulong(0); pTIFF->ReadUInt32( nulong ); - nd = (double)nulong; + nd = static_cast<double>(nulong); nulong = 0; pTIFF->ReadUInt32( nulong ); if ( nulong != 0 ) - nd /= (double)nulong; + nd /= static_cast<double>(nulong); } else - nd = (double)ReadIntData(); + nd = static_cast<double>(ReadIntData()); return nd; } @@ -465,7 +465,7 @@ void TIFFReader::ReadTagData( sal_uInt16 nTagType, sal_uInt32 nDataLen) case 0x0140: { // Color Map sal_uInt16 nVal; - nNumColors = ((sal_uInt32)1 << nBitsPerSample); + nNumColors = (sal_uInt32(1) << nBitsPerSample); if ( nDataType == 3 && nNumColors <= 256) { aColorMap.resize(256); @@ -474,17 +474,17 @@ void TIFFReader::ReadTagData( sal_uInt16 nTagType, sal_uInt32 nDataLen) for (sal_uInt32 i = 0; i < nNumColors; ++i) { pTIFF->ReadUInt16( nVal ); - aColorMap[i] |= ( ( (sal_uInt32)nVal ) << 8 ) & 0x00ff0000; + aColorMap[i] |= ( static_cast<sal_uInt32>(nVal) << 8 ) & 0x00ff0000; } for (sal_uInt32 i = 0; i < nNumColors; ++i) { pTIFF->ReadUInt16( nVal ); - aColorMap[i] |= ( (sal_uInt32)nVal ) & 0x0000ff00; + aColorMap[i] |= static_cast<sal_uInt32>(nVal) & 0x0000ff00; } for (sal_uInt32 i = 0; i < nNumColors; ++i) { pTIFF->ReadUInt16( nVal ); - aColorMap[i] |= ( ( (sal_uInt32)nVal ) >> 8 ) & 0x000000ff; + aColorMap[i] |= ( static_cast<sal_uInt32>(nVal) >> 8 ) & 0x000000ff; } } else @@ -677,7 +677,7 @@ bool TIFFReader::ReadMap() sal_uInt32 nRecCount; if ((nRecHeader&0x80)==0) { - nRecCount=0x00000001 + ((sal_uInt32)nRecHeader); + nRecCount=0x00000001 + static_cast<sal_uInt32>(nRecHeader); if ( nRecCount > nRowBytesLeft ) return false; pTIFF->ReadBytes(pdst, nRecCount); @@ -688,7 +688,7 @@ bool TIFFReader::ReadMap() } else if ( nRecHeader != 0x80 ) { - nRecCount = 0x000000101 - ((sal_uInt32)nRecHeader); + nRecCount = 0x000000101 - static_cast<sal_uInt32>(nRecHeader); if ( nRecCount > nRowBytesLeft ) { nRecCount = nRowBytesLeft; @@ -720,7 +720,7 @@ sal_uInt32 TIFFReader::GetBits( const sal_uInt8 * pSrc, sal_uInt32 nBitsPos, sal pSrc += ( nBitsPos >> 3 ); nBitsPos &= 7; sal_uInt8 nDat = *pSrc; - nRes = (sal_uInt32)( BYTESWAP( nDat ) & ( 0xff >> nBitsPos ) ); + nRes = static_cast<sal_uInt32>( BYTESWAP( nDat ) & ( 0xff >> nBitsPos ) ); if ( nBitsCount <= 8 - nBitsPos ) { @@ -733,13 +733,13 @@ sal_uInt32 TIFFReader::GetBits( const sal_uInt8 * pSrc, sal_uInt32 nBitsPos, sal while ( nBitsCount >= 8 ) { nDat = *(pSrc++); - nRes = ( nRes << 8 ) | ((sal_uInt32)BYTESWAP( nDat ) ); + nRes = ( nRes << 8 ) | static_cast<sal_uInt32>(BYTESWAP( nDat )); nBitsCount -= 8; } if ( nBitsCount > 0 ) { nDat = *pSrc; - nRes = ( nRes << nBitsCount ) | (((sal_uInt32)BYTESWAP(nDat))>>(8-nBitsCount)); + nRes = ( nRes << nBitsCount ) | (static_cast<sal_uInt32>(BYTESWAP(nDat))>>(8-nBitsCount)); } } } @@ -747,7 +747,7 @@ sal_uInt32 TIFFReader::GetBits( const sal_uInt8 * pSrc, sal_uInt32 nBitsPos, sal { pSrc += ( nBitsPos >> 3 ); nBitsPos &= 7; - nRes = (sal_uInt32)((*pSrc)&(0xff>>nBitsPos)); + nRes = static_cast<sal_uInt32>((*pSrc)&(0xff>>nBitsPos)); if ( nBitsCount <= 8 - nBitsPos ) { nRes >>= ( 8 - nBitsPos - nBitsCount ); @@ -758,11 +758,11 @@ sal_uInt32 TIFFReader::GetBits( const sal_uInt8 * pSrc, sal_uInt32 nBitsPos, sal nBitsCount -= 8 - nBitsPos; while ( nBitsCount >= 8 ) { - nRes = ( nRes << 8 ) | ((sal_uInt32)*(pSrc++)); + nRes = ( nRes << 8 ) | static_cast<sal_uInt32>(*(pSrc++)); nBitsCount -= 8; } if ( nBitsCount > 0 ) - nRes = ( nRes << nBitsCount ) | (((sal_uInt32)*pSrc)>>(8-nBitsCount)); + nRes = ( nRes << nBitsCount ) | (static_cast<sal_uInt32>(*pSrc)>>(8-nBitsCount)); } } return nRes; @@ -838,7 +838,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) nGreen = GetBits( getMapData(1), nx * nBitsPerSample, nBitsPerSample ); nBlue = GetBits( getMapData(2), nx * nBitsPerSample, nBitsPerSample ); } - xAcc->SetPixel( nY, nx, Color( (sal_uInt8)( nRed - nMinMax ), (sal_uInt8)( nGreen - nMinMax ), (sal_uInt8)(nBlue - nMinMax) ) ); + xAcc->SetPixel( nY, nx, Color( static_cast<sal_uInt8>( nRed - nMinMax ), static_cast<sal_uInt8>( nGreen - nMinMax ), static_cast<sal_uInt8>(nBlue - nMinMax) ) ); } } } @@ -861,10 +861,10 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) nGreen = GetBits( getMapData(1), nx * nBitsPerSample, nBitsPerSample ); nBlue = GetBits( getMapData(2), nx * nBitsPerSample, nBitsPerSample ); } - nRed = 255 - (sal_uInt8)( nRed - nMinMax ); - nGreen = 255 - (sal_uInt8)( nGreen - nMinMax ); - nBlue = 255 - (sal_uInt8)( nBlue - nMinMax ); - xAcc->SetPixel( nY, nx, Color( (sal_uInt8) nRed, (sal_uInt8) nGreen, (sal_uInt8) nBlue ) ); + nRed = 255 - static_cast<sal_uInt8>( nRed - nMinMax ); + nGreen = 255 - static_cast<sal_uInt8>( nGreen - nMinMax ); + nBlue = 255 - static_cast<sal_uInt8>( nBlue - nMinMax ); + xAcc->SetPixel( nY, nx, Color( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) ); } } } @@ -883,9 +883,9 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) for( ns = 0; ns < 4; ns++ ) { if( nPlanes < 3 ) - nSampLast[ ns ] = nSampLast[ ns ] + (sal_uInt8) GetBits( getMapData(0), ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample ); + nSampLast[ ns ] = nSampLast[ ns ] + static_cast<sal_uInt8>(GetBits( getMapData(0), ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample )); else - nSampLast[ ns ] = nSampLast[ ns ] + (sal_uInt8) GetBits( getMapData(ns), nx * nBitsPerSample, nBitsPerSample ); + nSampLast[ ns ] = nSampLast[ ns ] + static_cast<sal_uInt8>(GetBits( getMapData(ns), nx * nBitsPerSample, nBitsPerSample )); nSamp[ ns ] = nSampLast[ ns ]; } } @@ -894,19 +894,19 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) for( ns = 0; ns < 4; ns++ ) { if( nPlanes < 3 ) - nSamp[ ns ] = (sal_uInt8) GetBits( getMapData(0), ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample ); + nSamp[ ns ] = static_cast<sal_uInt8>(GetBits( getMapData(0), ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample )); else - nSamp[ ns ]= (sal_uInt8) GetBits( getMapData(ns), nx * nBitsPerSample, nBitsPerSample ); + nSamp[ ns ]= static_cast<sal_uInt8>(GetBits( getMapData(ns), nx * nBitsPerSample, nBitsPerSample )); } } const long nBlack = nSamp[ 3 ]; - nRed = (sal_uInt8) std::max( 0L, 255L - ( ( (sal_Int32) nSamp[ 0 ] + nBlack - ( ( (sal_Int32) nMinSampleValue ) << 1 ) ) * - 255L/(sal_Int32)(nMaxSampleValue-nMinSampleValue) ) ); - nGreen = (sal_uInt8) std::max( 0L, 255L - ( ( (sal_Int32) nSamp[ 1 ] + nBlack - ( ( (sal_Int32) nMinSampleValue ) << 1 ) ) * - 255L/(sal_Int32)(nMaxSampleValue-nMinSampleValue) ) ); - nBlue = (sal_uInt8) std::max( 0L, 255L - ( ( (sal_Int32) nSamp[ 2 ] + nBlack - ( ( (sal_Int32) nMinSampleValue ) << 1 ) ) * - 255L/(sal_Int32)(nMaxSampleValue-nMinSampleValue) ) ); - xAcc->SetPixel( nY, nx, Color ( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) ); + nRed = static_cast<sal_uInt8>(std::max( 0L, 255L - ( ( static_cast<sal_Int32>(nSamp[ 0 ]) + nBlack - ( static_cast<sal_Int32>(nMinSampleValue) << 1 ) ) * + 255L/static_cast<sal_Int32>(nMaxSampleValue-nMinSampleValue) ) )); + nGreen = static_cast<sal_uInt8>(std::max( 0L, 255L - ( ( static_cast<sal_Int32>(nSamp[ 1 ]) + nBlack - ( static_cast<sal_Int32>(nMinSampleValue) << 1 ) ) * + 255L/static_cast<sal_Int32>(nMaxSampleValue-nMinSampleValue) ) )); + nBlue = static_cast<sal_uInt8>(std::max( 0L, 255L - ( ( static_cast<sal_Int32>(nSamp[ 2 ]) + nBlack - ( static_cast<sal_Int32>(nMinSampleValue) << 1 ) ) * + 255L/static_cast<sal_Int32>(nMaxSampleValue-nMinSampleValue) ) )); + xAcc->SetPixel( nY, nx, Color ( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) ); } } } @@ -943,7 +943,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) for (sal_Int32 nx = 0; nx < nImageWidth; ++nx) { sal_uInt8 nLast = *pt++; - SetPixelIndex(xAcc.get(), nY, nx, static_cast<sal_uInt8>( (BYTESWAP((sal_uInt32)nLast) - nMinSampleValue) * nMinMax )); + SetPixelIndex(xAcc.get(), nY, nx, static_cast<sal_uInt8>( (BYTESWAP(static_cast<sal_uInt32>(nLast)) - nMinSampleValue) * nMinMax )); } } } @@ -962,7 +962,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) { for (sal_Int32 nx = 0; nx < nImageWidth; ++nx) { - SetPixelIndex(xAcc.get(), nY, nx, static_cast<sal_uInt8>( ((sal_uInt32)*pt++ - nMinSampleValue) * nMinMax )); + SetPixelIndex(xAcc.get(), nY, nx, static_cast<sal_uInt8>( (static_cast<sal_uInt32>(*pt++) - nMinSampleValue) * nMinMax )); } } } @@ -1077,7 +1077,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) sal_uInt8* pt = getMapData(0); for (sal_Int32 nx = 0; nx < nImageWidth; nx++, pt += 2 ) { - SetPixelIndex(xAcc.get(), nY, nx, static_cast<sal_uInt8>( ((sal_uInt32)*pt - nMinSampleValue) * nMinMax)); + SetPixelIndex(xAcc.get(), nY, nx, static_cast<sal_uInt8>( (static_cast<sal_uInt32>(*pt) - nMinSampleValue) * nMinMax)); } } } @@ -1094,7 +1094,7 @@ void TIFFReader::MakePalCol() aColorMap.resize(256); if ( nPhotometricInterpretation <= 1 ) { - nNumColors = (sal_uInt32)1 << nBitsPerSample; + nNumColors = sal_uInt32(1) << nBitsPerSample; if ( nNumColors > 256 ) nNumColors = 256; @@ -1117,8 +1117,8 @@ void TIFFReader::MakePalCol() xAcc->SetPaletteEntryCount(std::max<sal_uInt16>(nNumColors, xAcc->GetPaletteEntryCount())); for (sal_uInt32 i = 0; i < nNumColors; ++i) { - xAcc->SetPaletteColor(i, BitmapColor( (sal_uInt8)( aColorMap[ i ] >> 16 ), - (sal_uInt8)( aColorMap[ i ] >> 8 ), (sal_uInt8)aColorMap[ i ] ) ); + xAcc->SetPaletteColor(i, BitmapColor( static_cast<sal_uInt8>( aColorMap[ i ] >> 16 ), + static_cast<sal_uInt8>( aColorMap[ i ] >> 8 ), static_cast<sal_uInt8>(aColorMap[ i ]) ) ); } } @@ -1127,13 +1127,13 @@ void TIFFReader::MakePalCol() sal_uInt32 nRX, nRY; if (nResolutionUnit==2) { - nRX=(sal_uInt32)(fXResolution+0.5); - nRY=(sal_uInt32)(fYResolution+0.5); + nRX=static_cast<sal_uInt32>(fXResolution+0.5); + nRY=static_cast<sal_uInt32>(fYResolution+0.5); } else { - nRX=(sal_uInt32)(fXResolution*2.54+0.5); - nRY=(sal_uInt32)(fYResolution*2.54+0.5); + nRX=static_cast<sal_uInt32>(fXResolution*2.54+0.5); + nRY=static_cast<sal_uInt32>(fYResolution*2.54+0.5); } MapMode aMapMode(MapUnit::MapInch,Point(0,0),Fraction(1,nRX),Fraction(1,nRY)); aBitmap.SetPrefMapMode(aMapMode); diff --git a/filter/source/graphicfilter/itiff/lzwdecom.cxx b/filter/source/graphicfilter/itiff/lzwdecom.cxx index 7ae157d0ead0..e1a952987169 100644 --- a/filter/source/graphicfilter/itiff/lzwdecom.cxx +++ b/filter/source/graphicfilter/itiff/lzwdecom.cxx @@ -39,7 +39,7 @@ LZWDecompressor::LZWDecompressor() { pTable[i].nPrevCode=0; pTable[i].nDataCount=1; - pTable[i].nData=(sal_uInt8)i; + pTable[i].nData=static_cast<sal_uInt8>(i); } } @@ -85,8 +85,8 @@ sal_uLong LZWDecompressor::Decompress(sal_uInt8 * pTarget, sal_uLong nMaxCount) if (pIStream->GetError()) break; - if (((sal_uLong)nOutBufDataLen)>=nMaxCount) { - nOutBufDataLen = nOutBufDataLen - (sal_uInt16)nMaxCount; + if (static_cast<sal_uLong>(nOutBufDataLen)>=nMaxCount) { + nOutBufDataLen = nOutBufDataLen - static_cast<sal_uInt16>(nMaxCount); nCount+=nMaxCount; while (nMaxCount>0) { *(pTarget++)=*(pOutBufData++); @@ -95,7 +95,7 @@ sal_uLong LZWDecompressor::Decompress(sal_uInt8 * pTarget, sal_uLong nMaxCount) break; } - nMaxCount-=(sal_uLong)nOutBufDataLen; + nMaxCount-=static_cast<sal_uLong>(nOutBufDataLen); nCount+=nOutBufDataLen; while (nOutBufDataLen>0) { *(pTarget++)=*(pOutBufData++); diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx index 58b9e6dd28a0..73c0e45d64db 100644 --- a/filter/source/msfilter/dffpropset.cxx +++ b/filter/source/msfilter/dffpropset.cxx @@ -1132,7 +1132,7 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly ) | ( nCurrentFlags >> 16 ) ) ^ 0xffffffff; // attributes from mergeflags nCurrentFlags &= ( ( nMergeFlags & 0xffff0000 ) // apply zero master bits | ( nMergeFlags >> 16 ) ) ^ 0xffffffff; - nCurrentFlags |= (sal_uInt16)nMergeFlags; // apply filled master bits + nCurrentFlags |= static_cast<sal_uInt16>(nMergeFlags); // apply filled master bits mpPropSetEntries[ nRecType ].nContent = nCurrentFlags; mpPropSetEntries[ nRecType ].nComplexIndexOrFlagsHAttr |= static_cast< sal_uInt16 >( nContent >> 16 ); } @@ -1180,7 +1180,7 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly ) // for -16 this works if ( nSize < 0 ) nSize = ( -nSize ) >> 2; - sal_uInt32 nDataSize = (sal_uInt32)( nSize * nNumElem ); + sal_uInt32 nDataSize = static_cast<sal_uInt32>( nSize * nNumElem ); // sometimes the content size is 6 bytes too small (array header information is missing ) if ( nDataSize == nContent ) diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 6f1457e88e1a..d3fc465bff20 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -186,9 +186,9 @@ void EscherPropertyContainer::AddOpt( sal_uInt16 nPropID, const OUString& rStrin sal_uInt8* pBuf = new sal_uInt8[ nLen ]; for ( j = i = 0; i < rString.getLength(); i++ ) { - sal_uInt16 nChar = (sal_uInt16)rString[ i ]; - pBuf[ j++ ] = (sal_uInt8)nChar; - pBuf[ j++ ] = (sal_uInt8)( nChar >> 8 ); + sal_uInt16 nChar = static_cast<sal_uInt16>(rString[ i ]); + pBuf[ j++ ] = static_cast<sal_uInt8>(nChar); + pBuf[ j++ ] = static_cast<sal_uInt8>( nChar >> 8 ); } pBuf[ j++ ] = 0; pBuf[ j++ ] = 0; @@ -321,8 +321,8 @@ sal_uInt32 EscherPropertyContainer::ImplGetColor( const sal_uInt32 nSOColor, boo if ( bSwap ) { sal_uInt32 nColor = nSOColor & 0xff00; // green - nColor |= (sal_uInt8) nSOColor << 16; // red - nColor |= (sal_uInt8)( nSOColor >> 16 ); // blue + nColor |= static_cast<sal_uInt8>(nSOColor) << 16; // red + nColor |= static_cast<sal_uInt8>( nSOColor >> 16 ); // blue return nColor; } else @@ -814,7 +814,7 @@ void EscherPropertyContainer::CreateTextProperties( { sal_uInt16 nAngle = EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "RotateAngle", true ) ? - (sal_uInt16)( ( *o3tl::doAccess<sal_Int32>(aAny) ) + 5 ) / 10 : 0; + static_cast<sal_uInt16>( ( *o3tl::doAccess<sal_Int32>(aAny) ) + 5 ) / 10 : 0; if (nAngle==900) { AddOpt( ESCHER_Prop_txflTextFlow, ESCHER_txflBtoT ); @@ -1367,7 +1367,7 @@ GraphicObject* lclDrawHatch( const drawing::Hatch& rHatch, const Color& rBackCol pVDev->SetLineColor(); pVDev->SetFillColor(bFillBackground ? rBackColor : Color(COL_TRANSPARENT)); pVDev->DrawRect(rRect); - pVDev->DrawHatch(tools::PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, (sal_uInt16)rHatch.Angle)); + pVDev->DrawHatch(tools::PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, static_cast<sal_uInt16>(rHatch.Angle))); aMtf.Stop(); aMtf.WindStart(); aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM)); @@ -1525,7 +1525,7 @@ bool EscherPropertyContainer::CreateGraphicProperties( else { nAngle = bRotate && EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "RotateAngle", true ) - ? (sal_uInt16)( ( *o3tl::doAccess<sal_Int32>(aAny) ) + 5 ) / 10 + ? static_cast<sal_uInt16>( ( *o3tl::doAccess<sal_Int32>(aAny) ) + 5 ) / 10 : 0; } @@ -1635,7 +1635,7 @@ bool EscherPropertyContainer::CreateGraphicProperties( if(nAngle && bIsGraphicMtf) { - AddOpt( ESCHER_Prop_Rotation, ( ( ((sal_Int32)nAngle << 16 ) / 10 ) + 0x8000 ) &~ 0xffff ); + AddOpt( ESCHER_Prop_Rotation, ( ( (static_cast<sal_Int32>(nAngle) << 16 ) / 10 ) + 0x8000 ) &~ 0xffff ); } if ( eBitmapMode == drawing::BitmapMode_REPEAT ) @@ -1762,7 +1762,7 @@ tools::PolyPolygon EscherPropertyContainer::GetPolyPolygon( const uno::Any& rAny if ( rAny.getValueType() == cppu::UnoType<drawing::PolyPolygonBezierCoords>::get()) { auto pSourcePolyPolygon = o3tl::doAccess<drawing::PolyPolygonBezierCoords>(rAny); - sal_uInt16 nOuterSequenceCount = (sal_uInt16)pSourcePolyPolygon->Coordinates.getLength(); + sal_uInt16 nOuterSequenceCount = static_cast<sal_uInt16>(pSourcePolyPolygon->Coordinates.getLength()); // get pointer of inner sequences drawing::PointSequence const * pOuterSequence = pSourcePolyPolygon->Coordinates.getConstArray(); @@ -1789,7 +1789,7 @@ tools::PolyPolygon EscherPropertyContainer::GetPolyPolygon( const uno::Any& rAny if ( pArray && pFlags ) { - nInnerSequenceCount = (sal_uInt16)pInnerSequence->getLength(); + nInnerSequenceCount = static_cast<sal_uInt16>(pInnerSequence->getLength()); aPolygon = tools::Polygon( nInnerSequenceCount ); for( b = 0; b < nInnerSequenceCount; b++) { @@ -1809,7 +1809,7 @@ tools::PolyPolygon EscherPropertyContainer::GetPolyPolygon( const uno::Any& rAny } else if ( auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PointSequenceSequence>(rAny) ) { - sal_uInt16 nOuterSequenceCount = (sal_uInt16)pSourcePolyPolygon->getLength(); + sal_uInt16 nOuterSequenceCount = static_cast<sal_uInt16>(pSourcePolyPolygon->getLength()); // get pointer to inner sequences drawing::PointSequence const * pOuterSequence = pSourcePolyPolygon->getConstArray(); @@ -1830,7 +1830,7 @@ tools::PolyPolygon EscherPropertyContainer::GetPolyPolygon( const uno::Any& rAny pInnerSequence->getConstArray(); if ( pArray != nullptr ) { - nInnerSequenceCount = (sal_uInt16)pInnerSequence->getLength(); + nInnerSequenceCount = static_cast<sal_uInt16>(pInnerSequence->getLength()); aPolygon = tools::Polygon( nInnerSequenceCount ); for( b = 0; b < nInnerSequenceCount; b++) { @@ -1854,7 +1854,7 @@ tools::PolyPolygon EscherPropertyContainer::GetPolyPolygon( const uno::Any& rAny awt::Point const * pArray = pInnerSequence->getConstArray(); if ( pArray != nullptr ) { - nInnerSequenceCount = (sal_uInt16)pInnerSequence->getLength(); + nInnerSequenceCount = static_cast<sal_uInt16>(pInnerSequence->getLength()); aPolygon = tools::Polygon( nInnerSequenceCount ); for( a = 0; a < nInnerSequenceCount; a++) { @@ -1937,12 +1937,12 @@ bool EscherPropertyContainer::CreatePolygonProperties( sal_uInt8* pSegmentBuf = new sal_uInt8[ nSegmentBufSize ]; sal_uInt8* pPtr = pVerticesBuf; - *pPtr++ = (sal_uInt8) nTotalPoints; // Little endian - *pPtr++ = (sal_uInt8)( nTotalPoints >> 8 ); - *pPtr++ = (sal_uInt8) nTotalPoints; - *pPtr++ = (sal_uInt8)( nTotalPoints >> 8 ); - *pPtr++ = (sal_uInt8)0xf0; - *pPtr++ = (sal_uInt8)0xff; + *pPtr++ = static_cast<sal_uInt8>(nTotalPoints); // Little endian + *pPtr++ = static_cast<sal_uInt8>( nTotalPoints >> 8 ); + *pPtr++ = static_cast<sal_uInt8>(nTotalPoints); + *pPtr++ = static_cast<sal_uInt8>( nTotalPoints >> 8 ); + *pPtr++ = sal_uInt8(0xf0); + *pPtr++ = sal_uInt8(0xff); for (sal_uInt16 j = 0; j < nPolyCount; ++j) { @@ -1954,20 +1954,20 @@ bool EscherPropertyContainer::CreatePolygonProperties( aPoint.X() -= rGeoRect.X; aPoint.Y() -= rGeoRect.Y; - *pPtr++ = (sal_uInt8)( aPoint.X() ); - *pPtr++ = (sal_uInt8)( aPoint.X() >> 8 ); - *pPtr++ = (sal_uInt8)( aPoint.Y() ); - *pPtr++ = (sal_uInt8)( aPoint.Y() >> 8 ); + *pPtr++ = static_cast<sal_uInt8>( aPoint.X() ); + *pPtr++ = static_cast<sal_uInt8>( aPoint.X() >> 8 ); + *pPtr++ = static_cast<sal_uInt8>( aPoint.Y() ); + *pPtr++ = static_cast<sal_uInt8>( aPoint.Y() >> 8 ); } } pPtr = pSegmentBuf; - *pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 1 ); - *pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 9 ); - *pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 1 ); - *pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 9 ); - *pPtr++ = (sal_uInt8)2; - *pPtr++ = (sal_uInt8)0; + *pPtr++ = static_cast<sal_uInt8>( ( nSegmentBufSize - 6 ) >> 1 ); + *pPtr++ = static_cast<sal_uInt8>( ( nSegmentBufSize - 6 ) >> 9 ); + *pPtr++ = static_cast<sal_uInt8>( ( nSegmentBufSize - 6 ) >> 1 ); + *pPtr++ = static_cast<sal_uInt8>( ( nSegmentBufSize - 6 ) >> 9 ); + *pPtr++ = sal_uInt8(2); + *pPtr++ = sal_uInt8(0); for (sal_uInt16 j = 0; j < nPolyCount; ++j) { @@ -2225,7 +2225,7 @@ bool EscherPropertyContainer::CreateConnectorProperties( rShapeType = ESCHER_ShpInst_CurvedConnector3; AddOpt( ESCHER_Prop_cxstyle, ESCHER_cxstyleCurved ); AddOpt( ESCHER_Prop_adjustValue, nAdjustValue1 ); - AddOpt( ESCHER_Prop_adjust2Value, -(sal_Int32)nAdjustValue2 ); + AddOpt( ESCHER_Prop_adjust2Value, -static_cast<sal_Int32>(nAdjustValue2) ); } break; @@ -2240,9 +2240,9 @@ bool EscherPropertyContainer::CreateConnectorProperties( AddOpt( ESCHER_Prop_cxstyle, ESCHER_cxstyleBent ); aPoly = aPolyPolygon[ 0 ]; sal_Int32 nAdjCount = lcl_GetAdjustValueCount( aPoly ); - rShapeType = ( sal_uInt16 )( ESCHER_ShpInst_BentConnector2 + nAdjCount); + rShapeType = static_cast<sal_uInt16>( ESCHER_ShpInst_BentConnector2 + nAdjCount); for ( sal_Int32 i = 0 ; i < nAdjCount; ++ i) - AddOpt( (sal_uInt16) ( ESCHER_Prop_adjustValue+i) , lcl_GetConnectorAdjustValue( aPoly, i ) ); + AddOpt( static_cast<sal_uInt16>( ESCHER_Prop_adjustValue+i) , lcl_GetConnectorAdjustValue( aPoly, i ) ); } sal_Int32 nAngle=0; if (lcl_GetAngle(aPoly,rShapeFlags,nAngle )) @@ -2308,7 +2308,7 @@ void EscherPropertyContainer::CreateShadowProperties( if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "ShadowYDistance" ) ) AddOpt( ESCHER_Prop_shadowOffsetY, *o3tl::doAccess<sal_Int32>(aAny) * 360 ); if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "ShadowTransparence" ) ) - AddOpt( ESCHER_Prop_shadowOpacity, 0x10000 - (((sal_uInt32)*o3tl::doAccess<sal_uInt16>(aAny)) * 655 ) ); + AddOpt( ESCHER_Prop_shadowOpacity, 0x10000 - (static_cast<sal_uInt32>(*o3tl::doAccess<sal_uInt16>(aAny)) * 655 ) ); } } } @@ -2324,7 +2324,7 @@ sal_Int32 EscherPropertyContainer::GetValueForEnhancedCustomShapeParameter( cons { double fValue(0.0); if ( rParameter.Value >>= fValue ) - nValue = (sal_Int32)fValue; + nValue = static_cast<sal_Int32>(fValue); } else rParameter.Value >>= nValue; @@ -2333,12 +2333,12 @@ sal_Int32 EscherPropertyContainer::GetValueForEnhancedCustomShapeParameter( cons { case drawing::EnhancedCustomShapeParameterType::EQUATION : { - size_t nIndex = (size_t) nValue; + size_t nIndex = static_cast<size_t>(nValue); OSL_ASSERT(nIndex < rEquationOrder.size()); if ( nIndex < rEquationOrder.size() ) { - nValue = (sal_uInt16)rEquationOrder[ nIndex ]; - nValue |= (sal_uInt32)0x80000000; + nValue = static_cast<sal_uInt16>(rEquationOrder[ nIndex ]); + nValue |= sal_uInt32(0x80000000); } } break; @@ -2347,8 +2347,8 @@ sal_Int32 EscherPropertyContainer::GetValueForEnhancedCustomShapeParameter( cons if(bAdjustTrans) { sal_uInt32 nAdjustValue = 0; - bool bGot = GetOpt((sal_uInt16)( DFF_Prop_adjustValue + nValue ), nAdjustValue); - if(bGot) nValue = (sal_Int32)nAdjustValue; + bool bGot = GetOpt(static_cast<sal_uInt16>( DFF_Prop_adjustValue + nValue ), nAdjustValue); + if(bGot) nValue = static_cast<sal_Int32>(nAdjustValue); } } break; @@ -2374,7 +2374,7 @@ bool GetValueForEnhancedCustomShapeHandleParameter( sal_Int32& nRetValue, const { double fValue(0.0); if ( rParameter.Value >>= fValue ) - nRetValue = (sal_Int32)fValue; + nRetValue = static_cast<sal_Int32>(fValue); } else rParameter.Value >>= nRetValue; @@ -2554,7 +2554,7 @@ bool EscherPropertyContainer::GetAdjustmentValue( const drawing::EnhancedCustomS rkProp.Value >>= fValue; if ( bUseFixedFloat ) fValue *= 65536.0; - nValue = (sal_Int32)fValue; + nValue = static_cast<sal_Int32>(fValue); } else { @@ -2693,7 +2693,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT { double fExtrusionBrightness = 0; if ( rrProp.Value >>= fExtrusionBrightness ) - AddOpt( DFF_Prop_c3DAmbientIntensity, (sal_Int32)( fExtrusionBrightness * 655.36 ) ); + AddOpt( DFF_Prop_c3DAmbientIntensity, static_cast<sal_Int32>( fExtrusionBrightness * 655.36 ) ); } else if ( rrProp.Name == sExtrusionDepth ) { @@ -2706,12 +2706,12 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT double fBackDepth = fDepth - fForeDepth; fBackDepth *= 360.0; - AddOpt( DFF_Prop_c3DExtrudeBackward, (sal_Int32)fBackDepth ); + AddOpt( DFF_Prop_c3DExtrudeBackward, static_cast<sal_Int32>(fBackDepth) ); if ( fForeDepth != 0.0 ) { fForeDepth *= 360.0; - AddOpt( DFF_Prop_c3DExtrudeForward, (sal_Int32)fForeDepth ); + AddOpt( DFF_Prop_c3DExtrudeForward, static_cast<sal_Int32>(fForeDepth) ); } } } @@ -2719,7 +2719,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT { double fExtrusionDiffusion = 0; if ( rrProp.Value >>= fExtrusionDiffusion ) - AddOpt( DFF_Prop_c3DDiffuseAmt, (sal_Int32)( fExtrusionDiffusion * 655.36 ) ); + AddOpt( DFF_Prop_c3DDiffuseAmt, static_cast<sal_Int32>( fExtrusionDiffusion * 655.36 ) ); } else if ( rrProp.Name == sExtrusionNumberOfLineSegments ) { @@ -2767,22 +2767,22 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT { double fExtrusionFirstLightLevel = 0; if ( rrProp.Value >>= fExtrusionFirstLightLevel ) - AddOpt( DFF_Prop_c3DKeyIntensity, (sal_Int32)( fExtrusionFirstLightLevel * 655.36 ) ); + AddOpt( DFF_Prop_c3DKeyIntensity, static_cast<sal_Int32>( fExtrusionFirstLightLevel * 655.36 ) ); } else if ( rrProp.Name == sExtrusionSecondLightLevel ) { double fExtrusionSecondLightLevel = 0; if ( rrProp.Value >>= fExtrusionSecondLightLevel ) - AddOpt( DFF_Prop_c3DFillIntensity, (sal_Int32)( fExtrusionSecondLightLevel * 655.36 ) ); + AddOpt( DFF_Prop_c3DFillIntensity, static_cast<sal_Int32>( fExtrusionSecondLightLevel * 655.36 ) ); } else if ( rrProp.Name == sExtrusionFirstLightDirection ) { drawing::Direction3D aExtrusionFirstLightDirection; if ( rrProp.Value >>= aExtrusionFirstLightDirection ) { - AddOpt( DFF_Prop_c3DKeyX, (sal_Int32)aExtrusionFirstLightDirection.DirectionX ); - AddOpt( DFF_Prop_c3DKeyY, (sal_Int32)aExtrusionFirstLightDirection.DirectionY ); - AddOpt( DFF_Prop_c3DKeyZ, (sal_Int32)aExtrusionFirstLightDirection.DirectionZ ); + AddOpt( DFF_Prop_c3DKeyX, static_cast<sal_Int32>(aExtrusionFirstLightDirection.DirectionX) ); + AddOpt( DFF_Prop_c3DKeyY, static_cast<sal_Int32>(aExtrusionFirstLightDirection.DirectionY) ); + AddOpt( DFF_Prop_c3DKeyZ, static_cast<sal_Int32>(aExtrusionFirstLightDirection.DirectionZ) ); } } else if ( rrProp.Name == sExtrusionSecondLightDirection ) @@ -2790,9 +2790,9 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT drawing::Direction3D aExtrusionSecondLightPosition; if ( rrProp.Value >>= aExtrusionSecondLightPosition ) { - AddOpt( DFF_Prop_c3DFillX, (sal_Int32)aExtrusionSecondLightPosition.DirectionX ); - AddOpt( DFF_Prop_c3DFillY, (sal_Int32)aExtrusionSecondLightPosition.DirectionY ); - AddOpt( DFF_Prop_c3DFillZ, (sal_Int32)aExtrusionSecondLightPosition.DirectionZ ); + AddOpt( DFF_Prop_c3DFillX, static_cast<sal_Int32>(aExtrusionSecondLightPosition.DirectionX) ); + AddOpt( DFF_Prop_c3DFillY, static_cast<sal_Int32>(aExtrusionSecondLightPosition.DirectionY) ); + AddOpt( DFF_Prop_c3DFillZ, static_cast<sal_Int32>(aExtrusionSecondLightPosition.DirectionZ) ); } } else if ( rrProp.Name == sExtrusionMetal ) @@ -2839,8 +2839,8 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT { fExtrusionAngleX *= 65536; fExtrusionAngleY *= 65536; - AddOpt( DFF_Prop_c3DXRotationAngle, (sal_Int32)fExtrusionAngleX ); - AddOpt( DFF_Prop_c3DYRotationAngle, (sal_Int32)fExtrusionAngleY ); + AddOpt( DFF_Prop_c3DXRotationAngle, static_cast<sal_Int32>(fExtrusionAngleX) ); + AddOpt( DFF_Prop_c3DYRotationAngle, static_cast<sal_Int32>(fExtrusionAngleY) ); } } else if ( rrProp.Name == sExtrusionRotationCenter ) @@ -2848,9 +2848,9 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT drawing::Direction3D aExtrusionRotationCenter; if ( rrProp.Value >>= aExtrusionRotationCenter ) { - AddOpt( DFF_Prop_c3DRotationCenterX, (sal_Int32)( aExtrusionRotationCenter.DirectionX * 360.0 ) ); - AddOpt( DFF_Prop_c3DRotationCenterY, (sal_Int32)( aExtrusionRotationCenter.DirectionY * 360.0 ) ); - AddOpt( DFF_Prop_c3DRotationCenterZ, (sal_Int32)( aExtrusionRotationCenter.DirectionZ * 360.0 ) ); + AddOpt( DFF_Prop_c3DRotationCenterX, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionX * 360.0 ) ); + AddOpt( DFF_Prop_c3DRotationCenterY, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionY * 360.0 ) ); + AddOpt( DFF_Prop_c3DRotationCenterZ, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionZ * 360.0 ) ); nFillHarshFlags &=~8; // don't use AutoRotationCenter; } } @@ -2858,7 +2858,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT { double fExtrusionShininess = 0; if ( rrProp.Value >>= fExtrusionShininess ) - AddOpt( DFF_Prop_c3DShininess, (sal_Int32)( fExtrusionShininess * 655.36 ) ); + AddOpt( DFF_Prop_c3DShininess, static_cast<sal_Int32>( fExtrusionShininess * 655.36 ) ); } else if ( rrProp.Name == sExtrusionSkew ) { @@ -2867,15 +2867,15 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT drawing::EnhancedCustomShapeParameterPair aSkewParaPair; if ( ( rrProp.Value >>= aSkewParaPair ) && ( aSkewParaPair.First.Value >>= fSkewAmount ) && ( aSkewParaPair.Second.Value >>= fSkewAngle ) ) { - AddOpt( DFF_Prop_c3DSkewAmount, (sal_Int32)fSkewAmount ); - AddOpt( DFF_Prop_c3DSkewAngle, (sal_Int32)( fSkewAngle * 65536 ) ); + AddOpt( DFF_Prop_c3DSkewAmount, static_cast<sal_Int32>(fSkewAmount) ); + AddOpt( DFF_Prop_c3DSkewAngle, static_cast<sal_Int32>( fSkewAngle * 65536 ) ); } } else if ( rrProp.Name == sExtrusionSpecularity ) { double fExtrusionSpecularity = 0; if ( rrProp.Value >>= fExtrusionSpecularity ) - AddOpt( DFF_Prop_c3DSpecularAmt, (sal_Int32)( fExtrusionSpecularity * 1333 ) ); + AddOpt( DFF_Prop_c3DSpecularAmt, static_cast<sal_Int32>( fExtrusionSpecularity * 1333 ) ); } else if ( rrProp.Name == sExtrusionProjectionMode ) { @@ -2897,9 +2897,9 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT aExtrusionViewPoint.PositionX *= 360.0; aExtrusionViewPoint.PositionY *= 360.0; aExtrusionViewPoint.PositionZ *= 360.0; - AddOpt( DFF_Prop_c3DXViewpoint, (sal_Int32)aExtrusionViewPoint.PositionX ); - AddOpt( DFF_Prop_c3DYViewpoint, (sal_Int32)aExtrusionViewPoint.PositionY ); - AddOpt( DFF_Prop_c3DZViewpoint, (sal_Int32)aExtrusionViewPoint.PositionZ ); + AddOpt( DFF_Prop_c3DXViewpoint, static_cast<sal_Int32>(aExtrusionViewPoint.PositionX) ); + AddOpt( DFF_Prop_c3DYViewpoint, static_cast<sal_Int32>(aExtrusionViewPoint.PositionY) ); + AddOpt( DFF_Prop_c3DZViewpoint, static_cast<sal_Int32>(aExtrusionViewPoint.PositionZ) ); } } else if ( rrProp.Name == sExtrusionOrigin ) @@ -2909,8 +2909,8 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT drawing::EnhancedCustomShapeParameterPair aOriginPair; if ( ( rrProp.Value >>= aOriginPair ) && ( aOriginPair.First.Value >>= fExtrusionOriginX ) && ( aOriginPair.Second.Value >>= fExtrusionOriginY ) ) { - AddOpt( DFF_Prop_c3DOriginX, (sal_Int32)( fExtrusionOriginX * 65536 ) ); - AddOpt( DFF_Prop_c3DOriginY, (sal_Int32)( fExtrusionOriginY * 65536 ) ); + AddOpt( DFF_Prop_c3DOriginX, static_cast<sal_Int32>( fExtrusionOriginX * 65536 ) ); + AddOpt( DFF_Prop_c3DOriginY, static_cast<sal_Int32>( fExtrusionOriginY * 65536 ) ); } } else if ( rrProp.Name == sExtrusionColor ) @@ -2944,7 +2944,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT { if ( !bIsDefaultObject ) { - sal_uInt16 nElements = (sal_uInt16)aEquations.size(); + sal_uInt16 nElements = static_cast<sal_uInt16>(aEquations.size()); if ( nElements ) { sal_uInt16 nElementSize = 8; @@ -3052,7 +3052,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT if ( rrProp.Value >>= aGluePoints ) { // creating the vertices - sal_uInt16 nElements = (sal_uInt16)aGluePoints.getLength(); + sal_uInt16 nElements = static_cast<sal_uInt16>(aGluePoints.getLength()); if ( nElements ) { sal_uInt16 j, nElementSize = 8; @@ -3084,7 +3084,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT { sal_Int16 nGluePointType = sal_Int16(); if ( rrProp.Value >>= nGluePointType ) - AddOpt( DFF_Prop_connectorType, (sal_uInt16)nGluePointType ); + AddOpt( DFF_Prop_connectorType, static_cast<sal_uInt16>(nGluePointType) ); } else if ( rrProp.Name == sPathSegments ) { @@ -3094,9 +3094,9 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT if ( rrProp.Value >>= aSegments ) { // creating seginfo - if ( (sal_uInt16)aSegments.getLength() ) + if ( static_cast<sal_uInt16>(aSegments.getLength()) ) { - sal_uInt16 j, nElements = (sal_uInt16)aSegments.getLength(); + sal_uInt16 j, nElements = static_cast<sal_uInt16>(aSegments.getLength()); sal_uInt16 nElementSize = 2; sal_uInt32 nStreamSize = nElementSize * nElements + 6; SvMemoryStream aOut( nStreamSize ); @@ -3112,7 +3112,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT // If the segment type is msopathEscape, the lower 13 bits // are divided in a 5 bit escape code and 8 bit // vertex count (not segment count!) - sal_uInt16 nVal = (sal_uInt16)aSegments[ j ].Count; + sal_uInt16 nVal = static_cast<sal_uInt16>(aSegments[ j ].Count); switch( aSegments[ j ].Command ) { case drawing::EnhancedCustomShapeSegmentCommand::UNKNOWN : @@ -3233,9 +3233,9 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT uno::Sequence<drawing::EnhancedCustomShapeTextFrame> aPathTextFrames; if ( rrProp.Value >>= aPathTextFrames ) { - if ( (sal_uInt16)aPathTextFrames.getLength() ) + if ( static_cast<sal_uInt16>(aPathTextFrames.getLength()) ) { - sal_uInt16 j, nElements = (sal_uInt16)aPathTextFrames.getLength(); + sal_uInt16 j, nElements = static_cast<sal_uInt16>(aPathTextFrames.getLength()); sal_uInt16 nElementSize = 16; sal_uInt32 nStreamSize = nElementSize * nElements + 6; SvMemoryStream aOut( nStreamSize ); @@ -3484,7 +3484,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT bPredefinedHandlesUsed = false; if ( rProp.Value >>= aHandlesPropSeq ) { - sal_uInt16 nElements = (sal_uInt16)aHandlesPropSeq.getLength(); + sal_uInt16 nElements = static_cast<sal_uInt16>(aHandlesPropSeq.getLength()); if ( nElements ) { sal_uInt16 k, nElementSize = 36; @@ -3571,8 +3571,8 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT } else if ( rPropVal.Name == sRadiusRangeMinimum ) { - nYRangeMin = (sal_Int32)0xff4c0000; // the range of angles seems to be a not - nYRangeMax = (sal_Int32)0x00b40000; // used feature, so we are defaulting this + nYRangeMin = sal_Int32(0xff4c0000); // the range of angles seems to be a not + nYRangeMax = sal_Int32(0x00b40000); // used feature, so we are defaulting this drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum; if ( rPropVal.Value >>= aRadiusRangeMinimum ) @@ -3584,8 +3584,8 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT } else if ( rPropVal.Name == sRadiusRangeMaximum ) { - nYRangeMin = (sal_Int32)0xff4c0000; // the range of angles seems to be a not - nYRangeMax = (sal_Int32)0x00b40000; // used feature, so we are defaulting this + nYRangeMin = sal_Int32(0xff4c0000); // the range of angles seems to be a not + nYRangeMax = sal_Int32(0x00b40000); // used feature, so we are defaulting this drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum; if ( rPropVal.Value >>= aRadiusRangeMaximum ) @@ -3680,7 +3680,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT sal_Int32 k, nValue = 0, nAdjustmentValues = aAdjustmentSeq.getLength(); for ( k = 0; k < nAdjustmentValues; k++ ) if( GetAdjustmentValue( aAdjustmentSeq[ k ], k, nAdjustmentsWhichNeedsToBeConverted, nValue ) ) - AddOpt( (sal_uInt16)( DFF_Prop_adjustValue + k ), (sal_uInt32)nValue ); + AddOpt( static_cast<sal_uInt16>( DFF_Prop_adjustValue + k ), static_cast<sal_uInt32>(nValue) ); } } if( bPathCoordinatesProp ) @@ -3691,7 +3691,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT // creating the vertices if (aCoordinates.getLength() > 0) { - sal_uInt16 j, nElements = (sal_uInt16)aCoordinates.getLength(); + sal_uInt16 j, nElements = static_cast<sal_uInt16>(aCoordinates.getLength()); sal_uInt16 nElementSize = 8; sal_uInt32 nStreamSize = nElementSize * nElements + 6; SvMemoryStream aOut( nStreamSize ); @@ -4002,7 +4002,7 @@ void EscherBlibEntry::WriteBlibEntry( SvStream& rSt, bool bWritePictureOffset, s { sal_uInt32 nPictureOffset = bWritePictureOffset ? mnPictureOffset : 0; - rSt.WriteUInt32( ( ESCHER_BSE << 16 ) | ( ( (sal_uInt16)meBlibType << 4 ) | 2 ) ) + rSt.WriteUInt32( ( ESCHER_BSE << 16 ) | ( ( static_cast<sal_uInt16>(meBlibType) << 4 ) | 2 ) ) .WriteUInt32( 36 + nResize ) .WriteUChar( meBlibType ); @@ -4283,7 +4283,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin if ( mnFlags & EscherGraphicProviderFlags::UseInstances ) { - rPicOutStrm.WriteUInt32( 0x7f90000 | (sal_uInt16)( mvBlibEntrys.size() << 4 ) ) + rPicOutStrm.WriteUInt32( 0x7f90000 | static_cast<sal_uInt16>( mvBlibEntrys.size() << 4 ) ) .WriteUInt32( 0 ); nAtomSize = rPicOutStrm.Tell(); if ( eBlibType == PNG ) @@ -4423,7 +4423,7 @@ sal_uInt32 EscherConnectorListEntry::GetClosestPoint( const tools::Polygon& rPol { sal_uInt16 nCount = rPoly.GetSize(); sal_uInt16 nClosest = nCount; - double fDist = (sal_uInt32)0xffffffff; + double fDist = sal_uInt32(0xffffffff); while( nCount-- ) { double fDistance = hypot( rPoint.X - rPoly[ nCount ].X(), rPoint.Y - rPoly[ nCount ].Y() ); @@ -4488,7 +4488,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) { for ( b = 0; b < pInnerSequence->getLength(); b++, nIndex++, pArray++ ) { - sal_uInt32 nDist = (sal_uInt32)hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y ); + sal_uInt32 nDist = static_cast<sal_uInt32>(hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y )); if ( nDist < nDistance ) { nRule = nIndex; @@ -4541,7 +4541,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) drawing::PolygonFlags ePolyFlags = *pFlags++; if ( ePolyFlags == drawing::PolygonFlags_CONTROL ) continue; - sal_uInt32 nDist = (sal_uInt32)hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y ); + sal_uInt32 nDist = static_cast<sal_uInt32>(hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y )); if ( nDist < nDistance ) { nRule = nIndex; @@ -4625,7 +4625,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) if ( rPoly.GetFlags( b ) != PolyFlags::Normal ) continue; const Point& rPt = rPoly[ b ]; - sal_uInt32 nDist = (sal_uInt32)hypot( aRefPoint.X - rPt.X(), aRefPoint.Y - rPt.Y() ); + sal_uInt32 nDist = static_cast<sal_uInt32>(hypot( aRefPoint.X - rPt.X(), aRefPoint.Y - rPt.Y() )); if ( nDist < nDistance ) { nRule = nIndex; @@ -4657,7 +4657,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) sal_Int32 nAngle = ( EscherPropertyValueHelper::GetPropertyValue( aAny, aPropertySet, "RotateAngle", true ) ) ? *o3tl::doAccess<sal_Int32>(aAny) : 0; if ( nAngle ) - aPoly.Rotate( aRect.TopLeft(), (sal_uInt16)( ( nAngle + 5 ) / 10 ) ); + aPoly.Rotate( aRect.TopLeft(), static_cast<sal_uInt16>( ( nAngle + 5 ) / 10 ) ); nRule = GetClosestPoint( aPoly, aRefPoint ); if (aType == OString( "drawing.Ellipse" )) @@ -5307,8 +5307,8 @@ void EscherEx::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& sal_uInt32 EscherEx::GetColor( const sal_uInt32 nSOColor ) { sal_uInt32 nColor = nSOColor & 0xff00; // Green - nColor |= (sal_uInt8) nSOColor << 16; // Red - nColor |= (sal_uInt8)( nSOColor >> 16 ); // Blue + nColor |= static_cast<sal_uInt8>(nSOColor) << 16; // Red + nColor |= static_cast<sal_uInt8>( nSOColor >> 16 ); // Blue return nColor; } diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index 9e9ed04dcc3e..d10e96bb5765 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -107,12 +107,12 @@ void ImplEESdrWriter::ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherProperty while ( nAngle > 9000 ) nAngle = ( 18000 - ( nAngle % 18000 ) ); - double fVal = (double)nAngle * F_PI18000; + double fVal = static_cast<double>(nAngle) * F_PI18000; double fCos = cos( fVal ); double fSin = sin( fVal ); - double nWidthHalf = (double) aRect.GetWidth() / 2; - double nHeightHalf = (double) aRect.GetHeight() / 2; + double nWidthHalf = static_cast<double>(aRect.GetWidth()) / 2; + double nHeightHalf = static_cast<double>(aRect.GetHeight()) / 2; // fdo#70838: // when you rotate an object, the top-left corner of its bounding box is moved @@ -124,7 +124,7 @@ void ImplEESdrWriter::ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherProperty double nXDiff = fSin * nHeightHalf + fCos * nWidthHalf - nWidthHalf; double nYDiff = fSin * nWidthHalf + fCos * nHeightHalf - nHeightHalf; - aRect.Move( (sal_Int32) nXDiff, (sal_Int32) nYDiff ); + aRect.Move( static_cast<sal_Int32>(nXDiff), static_cast<sal_Int32>(nYDiff) ); // calculate the proper angle value to be saved nAngle = rObj.GetAngle(); @@ -371,10 +371,10 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, nEndAngle = *o3tl::doAccess<sal_Int32>(rObj.GetUsrAny()); Point aStart, aEnd, aCenter; - aStart.X() = (sal_Int32)( cos( nStartAngle * F_PI18000 ) * 100.0 ); - aStart.Y() = - (sal_Int32)( sin( nStartAngle * F_PI18000 ) * 100.0 ); - aEnd.X() = (sal_Int32)( cos( nEndAngle * F_PI18000 ) * 100.0 ); - aEnd.Y() = - (sal_Int32)( sin( nEndAngle * F_PI18000 ) * 100.0 ); + aStart.X() = static_cast<sal_Int32>( cos( nStartAngle * F_PI18000 ) * 100.0 ); + aStart.Y() = - static_cast<sal_Int32>( sin( nStartAngle * F_PI18000 ) * 100.0 ); + aEnd.X() = static_cast<sal_Int32>( cos( nEndAngle * F_PI18000 ) * 100.0 ); + aEnd.Y() = - static_cast<sal_Int32>( sin( nEndAngle * F_PI18000 ) * 100.0 ); const tools::Rectangle& rRect = aRect100thmm; aCenter.X() = rRect.Left() + ( rRect.GetWidth() / 2 ); aCenter.Y() = rRect.Top() + ( rRect.GetHeight() / 2 ); @@ -385,7 +385,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, tools::Polygon aPolygon( rRect, aStart, aEnd, ePolyKind ); if( rObj.GetAngle() ) { - aPolygon.Rotate( rRect.TopLeft(), (sal_uInt16)( rObj.GetAngle() / 10 ) ); + aPolygon.Rotate( rRect.TopLeft(), static_cast<sal_uInt16>( rObj.GetAngle() / 10 ) ); rObj.SetAngle( 0 ); } mpEscherEx->OpenContainer( ESCHER_SpContainer ); @@ -737,7 +737,7 @@ void ImplEESdrWriter::ImplWriteAdditionalText( ImplEESdrObject& rObj, double fDist = hypot( rObj.GetRect().GetWidth(), rObj.GetRect().GetHeight() ); rObj.SetRect( tools::Rectangle( rTextRefPoint, - Point( (sal_Int32)( rTextRefPoint.X() + fDist ), rTextRefPoint.Y() - 1 ) ) ); + Point( static_cast<sal_Int32>( rTextRefPoint.X() + fDist ), rTextRefPoint.Y() - 1 ) ) ); mpEscherEx->OpenContainer( ESCHER_SpContainer ); mpEscherEx->AddShape( ESCHER_ShpInst_TextBox, ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor ); diff --git a/filter/source/msfilter/mscodec.cxx b/filter/source/msfilter/mscodec.cxx index 02a1a1b444d1..c4c0a4c83c85 100644 --- a/filter/source/msfilter/mscodec.cxx +++ b/filter/source/msfilter/mscodec.cxx @@ -173,8 +173,8 @@ bool MSCodec_Xor95::InitCodec( const uno::Sequence< beans::NamedValue >& aData ) (void)memcpy( mpnKey, aKey.getConstArray(), 16 ); bResult = true; - mnKey = (sal_uInt16)aHashData.getUnpackedValueOrDefault("XOR95BaseKey", (sal_Int16)0 ); - mnHash = (sal_uInt16)aHashData.getUnpackedValueOrDefault("XOR95PasswordHash", (sal_Int16)0 ); + mnKey = static_cast<sal_uInt16>(aHashData.getUnpackedValueOrDefault("XOR95BaseKey", sal_Int16(0) )); + mnHash = static_cast<sal_uInt16>(aHashData.getUnpackedValueOrDefault("XOR95PasswordHash", sal_Int16(0) )); } else OSL_FAIL( "Unexpected key size!" ); @@ -186,8 +186,8 @@ uno::Sequence< beans::NamedValue > MSCodec_Xor95::GetEncryptionData() { ::comphelper::SequenceAsHashMap aHashData; aHashData[ OUString( "XOR95EncryptionKey" ) ] <<= uno::Sequence<sal_Int8>( reinterpret_cast<sal_Int8*>(mpnKey), 16 ); - aHashData[ OUString( "XOR95BaseKey" ) ] <<= (sal_Int16)mnKey; - aHashData[ OUString( "XOR95PasswordHash" ) ] <<= (sal_Int16)mnHash; + aHashData[ OUString( "XOR95BaseKey" ) ] <<= static_cast<sal_Int16>(mnKey); + aHashData[ OUString( "XOR95PasswordHash" ) ] <<= static_cast<sal_Int16>(mnHash); return aHashData.getAsConstNamedValueList(); } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index f0c98eb30faa..e765c3f9fb5e 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -368,7 +368,7 @@ sal_Int32 DffPropertyReader::Fix16ToAngle( sal_Int32 nContent ) sal_Int32 nAngle = 0; if ( nContent ) { - nAngle = ( (sal_Int16)( nContent >> 16) * 100L ) + ( ( ( nContent & 0x0000ffff) * 100L ) >> 16 ); + nAngle = ( static_cast<sal_Int16>( nContent >> 16) * 100L ) + ( ( ( nContent & 0x0000ffff) * 100L ) >> 16 ); nAngle = NormAngle360( -nAngle ); } return nAngle; @@ -525,7 +525,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) if (pList->GetCount() > nC ) { bValidGluePoint = true; - nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 ); + nId = static_cast<sal_Int32>((*pList)[ static_cast<sal_uInt16>(nC)].GetId() + 3 ); } else { @@ -558,15 +558,15 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) sal_Int32 nHeight= aBoundRect.GetHeight(); if ( !nHeight ) nHeight = 1; - fXRel /= (double)nWidth; + fXRel /= static_cast<double>(nWidth); fXRel *= 10000; - fYRel /= (double)nHeight; + fYRel /= static_cast<double>(nHeight); fYRel *= 10000; - aGluePoint.SetPos( Point( (sal_Int32)fXRel, (sal_Int32)fYRel ) ); + aGluePoint.SetPos( Point( static_cast<sal_Int32>(fXRel), static_cast<sal_Int32>(fYRel) ) ); aGluePoint.SetPercent( true ); aGluePoint.SetAlign( SdrAlign::VERT_TOP | SdrAlign::HORZ_LEFT ); aGluePoint.SetEscDir( SdrEscapeDirection::SMART ); - nId = (sal_Int32)((*pList)[ pList->Insert( aGluePoint ) ].GetId() + 3 ); + nId = static_cast<sal_Int32>((*pList)[ pList->Insert( aGluePoint ) ].GetId() + 3 ); bNotFound = false; } nPointCount++; @@ -609,7 +609,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) if ( pList && ( pList->GetCount() > nC ) ) { bValidGluePoint = true; - nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 ); + nId = static_cast<sal_Int32>((*pList)[ static_cast<sal_uInt16>(nC)].GetId() + 3 ); } } else if ( nGluePointType == EnhancedCustomShapeGluePointType::RECT ) @@ -654,7 +654,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) { if ( *pAny >>= aSegments ) { - for ( nPt = 0, k = 1; nC && ( k < (sal_uInt32)aSegments.getLength() ); k++ ) + for ( nPt = 0, k = 1; nC && ( k < static_cast<sal_uInt32>(aSegments.getLength()) ); k++ ) { sal_Int16 j, nCnt2 = aSegments[ k ].Count; if ( aSegments[ k ].Command != EnhancedCustomShapeSegmentCommand::UNKNOWN ) @@ -710,7 +710,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) { css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > aCoordinates; *pAny >>= aCoordinates; - if ( nPt < (sal_uInt32)aCoordinates.getLength() ) + if ( nPt < static_cast<sal_uInt32>(aCoordinates.getLength()) ) { nId = 4; css::drawing::EnhancedCustomShapeParameterPair& rPara = aCoordinates[ nPt ]; @@ -734,7 +734,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) static_cast<SdrObjCustomShape*>(pO)->SetMergedItem( aGeometryItem ); SdrGluePointList* pLst = pO->ForceGluePointList(); if ( pLst->GetCount() > nGluePoints ) - nId = (sal_Int32)((*pLst)[ (sal_uInt16)nGluePoints ].GetId() + 3 ); + nId = static_cast<sal_Int32>((*pLst)[ static_cast<sal_uInt16>(nGluePoints) ].GetId() + 3 ); } } } @@ -875,9 +875,9 @@ static basegfx::B2DPolyPolygon GetLineArrow( const sal_Int32 nLineWidth, const M break; case mso_lineArrowOvalEnd : { - aRetPolyPoly = basegfx::B2DPolyPolygon( XPolygon( Point( (sal_Int32)( fWidthMul * fLineWidth * 0.50 ), 0 ), - (sal_Int32)( fWidthMul * fLineWidth * 0.50 ), - (sal_Int32)( fLengthMul * fLineWidth * 0.50 ), 0, 3600 ).getB2DPolygon() ); + aRetPolyPoly = basegfx::B2DPolyPolygon( XPolygon( Point( static_cast<sal_Int32>( fWidthMul * fLineWidth * 0.50 ), 0 ), + static_cast<sal_Int32>( fWidthMul * fLineWidth * 0.50 ), + static_cast<sal_Int32>( fLengthMul * fLineWidth * 0.50 ), 0, 3600 ).getB2DPolygon() ); rbArrowCenter = true; aArrowName.append("msArrowOvalEnd "); } @@ -886,7 +886,7 @@ static basegfx::B2DPolyPolygon GetLineArrow( const sal_Int32 nLineWidth, const M } aArrowName.append(nLineNumber); rsArrowName = aArrowName.makeStringAndClear(); - rnArrowWidth = (sal_Int32)( fLineWidth * fWidthMul ); + rnArrowWidth = static_cast<sal_Int32>( fLineWidth * fWidthMul ); return aRetPolyPoly; } @@ -903,7 +903,7 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh if ( nLineFlags & 8 ) { // Line Attributes - sal_Int32 nLineWidth = (sal_Int32)GetPropertyValue( DFF_Prop_lineWidth, 9525 ); + sal_Int32 nLineWidth = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_lineWidth, 9525 )); // support LineCap const MSO_LineCap eLineCap((MSO_LineCap)GetPropertyValue(DFF_Prop_lineEndCapStyle, mso_lineEndCapSquare)); @@ -1581,8 +1581,8 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt const OUString sViewBox( "ViewBox" ); aViewBox.X = GetPropertyValue( DFF_Prop_geoLeft, 0 ); aViewBox.Y = GetPropertyValue( DFF_Prop_geoTop, 0 ); - aViewBox.Width = nCoordWidth = ((sal_Int32)GetPropertyValue( DFF_Prop_geoRight, 21600 ) ) - aViewBox.X; - aViewBox.Height = nCoordHeight = ((sal_Int32)GetPropertyValue( DFF_Prop_geoBottom, 21600 ) ) - aViewBox.Y; + aViewBox.Width = nCoordWidth = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_geoRight, 21600 )) - aViewBox.X; + aViewBox.Height = nCoordHeight = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_geoBottom, 21600 )) - aViewBox.Y; aProp.Name = sViewBox; aProp.Value <<= aViewBox; aPropVec.push_back( aProp ); @@ -1641,7 +1641,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DAmbientIntensity ) ) { const OUString sExtrusionBrightness( "Brightness" ); - double fBrightness = (sal_Int32)GetPropertyValue( DFF_Prop_c3DAmbientIntensity, 0 ); + double fBrightness = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DAmbientIntensity, 0 )); fBrightness /= 655.36; aProp.Name = sExtrusionBrightness; aProp.Value <<= fBrightness; @@ -1651,8 +1651,8 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DExtrudeBackward ) || IsProperty( DFF_Prop_c3DExtrudeForward ) ) { const OUString sDepth( "Depth" ); - double fBackDepth = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DExtrudeBackward, 1270 * 360 )) / 360.0; - double fForeDepth = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DExtrudeForward, 0 )) / 360.0; + double fBackDepth = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DExtrudeBackward, 1270 * 360 ))) / 360.0; + double fForeDepth = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DExtrudeForward, 0 ))) / 360.0; double fDepth = fBackDepth + fForeDepth; double fFraction = fDepth != 0.0 ? fForeDepth / fDepth : 0; EnhancedCustomShapeParameterPair aDepthParaPair; @@ -1668,7 +1668,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DDiffuseAmt ) ) { const OUString sExtrusionDiffusion( "Diffusion" ); - double fDiffusion = (sal_Int32)GetPropertyValue( DFF_Prop_c3DDiffuseAmt, 0 ); + double fDiffusion = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DDiffuseAmt, 0 )); fDiffusion /= 655.36; aProp.Name = sExtrusionDiffusion; aProp.Value <<= fDiffusion; @@ -1679,7 +1679,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt { const OUString sExtrusionNumberOfLineSegments( "NumberOfLineSegments" ); aProp.Name = sExtrusionNumberOfLineSegments; - aProp.Value <<= (sal_Int32)GetPropertyValue( DFF_Prop_c3DTolerance, 0 ); + aProp.Value <<= static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DTolerance, 0 )); aExtrusionPropVec.push_back( aProp ); } // "LightFace" @@ -1704,7 +1704,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DKeyIntensity ) ) { const OUString sExtrusionFirstLightLevel( "FirstLightLevel" ); - double fFirstLightLevel = (sal_Int32)GetPropertyValue( DFF_Prop_c3DKeyIntensity, 0 ); + double fFirstLightLevel = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DKeyIntensity, 0 )); fFirstLightLevel /= 655.36; aProp.Name = sExtrusionFirstLightLevel; aProp.Value <<= fFirstLightLevel; @@ -1714,7 +1714,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DFillIntensity ) ) { const OUString sExtrusionSecondLightLevel( "SecondLightLevel" ); - double fSecondLightLevel = (sal_Int32)GetPropertyValue( DFF_Prop_c3DFillIntensity, 0 ); + double fSecondLightLevel = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DFillIntensity, 0 )); fSecondLightLevel /= 655.36; aProp.Name = sExtrusionSecondLightLevel; aProp.Value <<= fSecondLightLevel; @@ -1723,9 +1723,9 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt // "FirtstLightDirection" if ( IsProperty( DFF_Prop_c3DKeyX ) || IsProperty( DFF_Prop_c3DKeyY ) || IsProperty( DFF_Prop_c3DKeyZ ) ) { - double fLightX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DKeyX, 50000 )); - double fLightY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DKeyY, 0 )); - double fLightZ = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DKeyZ, 10000 )); + double fLightX = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DKeyX, 50000 ))); + double fLightY = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DKeyY, 0 ))); + double fLightZ = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DKeyZ, 10000 ))); css::drawing::Direction3D aExtrusionFirstLightDirection( fLightX, fLightY, fLightZ ); const OUString sExtrusionFirstLightDirection( "FirstLightDirection" ); aProp.Name = sExtrusionFirstLightDirection; @@ -1735,9 +1735,9 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt // "SecondLightDirection" if ( IsProperty( DFF_Prop_c3DFillX ) || IsProperty( DFF_Prop_c3DFillY ) || IsProperty( DFF_Prop_c3DFillZ ) ) { - double fLight2X = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DFillX, (sal_uInt32)-50000 )); - double fLight2Y = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DFillY, 0 )); - double fLight2Z = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DFillZ, 10000 )); + double fLight2X = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DFillX, sal_uInt32(-50000) ))); + double fLight2Y = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DFillY, 0 ))); + double fLight2Z = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DFillZ, 10000 ))); css::drawing::Direction3D aExtrusionSecondLightDirection( fLight2X, fLight2Y, fLight2Z ); const OUString sExtrusionSecondLightDirection( "SecondLightDirection" ); aProp.Name = sExtrusionSecondLightDirection; @@ -1768,8 +1768,8 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DXRotationAngle ) || IsProperty( DFF_Prop_c3DYRotationAngle ) ) { const OUString sExtrusionAngle( "RotateAngle" ); - double fAngleX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DXRotationAngle, 0 )) / 65536.0; - double fAngleY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DYRotationAngle, 0 )) / 65536.0; + double fAngleX = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DXRotationAngle, 0 ))) / 65536.0; + double fAngleY = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DYRotationAngle, 0 ))) / 65536.0; EnhancedCustomShapeParameterPair aRotateAnglePair; aRotateAnglePair.First.Value <<= fAngleX; aRotateAnglePair.First.Type = EnhancedCustomShapeParameterType::NORMAL; @@ -1787,9 +1787,9 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DRotationCenterX ) || IsProperty( DFF_Prop_c3DRotationCenterY ) || IsProperty( DFF_Prop_c3DRotationCenterZ ) ) { css::drawing::Direction3D aRotationCenter( - (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationCenterX, 0 )) / 360.0, - (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationCenterY, 0 )) / 360.0, - (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationCenterZ, 0 )) / 360.0 ); + static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DRotationCenterX, 0 ))) / 360.0, + static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DRotationCenterY, 0 ))) / 360.0, + static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DRotationCenterZ, 0 ))) / 360.0 ); const OUString sExtrusionRotationCenter( "RotationCenter" ); aProp.Name = sExtrusionRotationCenter; @@ -1801,7 +1801,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DShininess ) ) { const OUString sExtrusionShininess( "Shininess" ); - double fShininess = (sal_Int32)GetPropertyValue( DFF_Prop_c3DShininess, 0 ); + double fShininess = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DShininess, 0 )); fShininess /= 655.36; aProp.Name = sExtrusionShininess; aProp.Value <<= fShininess; @@ -1811,8 +1811,8 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DSkewAmount ) || IsProperty( DFF_Prop_c3DSkewAngle ) ) { const OUString sExtrusionSkew( "Skew" ); - double fSkewAmount = (sal_Int32)GetPropertyValue( DFF_Prop_c3DSkewAmount, 50 ); - double fSkewAngle = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DSkewAngle, sal::static_int_cast< sal_uInt32 >(-135 * 65536) )) / 65536.0; + double fSkewAmount = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DSkewAmount, 50 )); + double fSkewAngle = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DSkewAngle, sal::static_int_cast< sal_uInt32 >(-135 * 65536) ))) / 65536.0; EnhancedCustomShapeParameterPair aSkewPair; aSkewPair.First.Value <<= fSkewAmount; @@ -1827,7 +1827,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DSpecularAmt ) ) { const OUString sExtrusionSpecularity( "Specularity" ); - double fSpecularity = (sal_Int32)GetPropertyValue( DFF_Prop_c3DSpecularAmt, 0 ); + double fSpecularity = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DSpecularAmt, 0 )); fSpecularity /= 1333; aProp.Name = sExtrusionSpecularity; aProp.Value <<= fSpecularity; @@ -1843,9 +1843,9 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt // "ViewPoint" in 1/100mm if ( IsProperty( DFF_Prop_c3DXViewpoint ) || IsProperty( DFF_Prop_c3DYViewpoint ) || IsProperty( DFF_Prop_c3DZViewpoint ) ) { - double fViewX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DXViewpoint, 1250000 )) / 360.0; - double fViewY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DYViewpoint, (sal_uInt32)-1250000 ))/ 360.0; - double fViewZ = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DZViewpoint, 9000000 )) / 360.0; + double fViewX = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DXViewpoint, 1250000 ))) / 360.0; + double fViewY = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DYViewpoint, sal_uInt32(-1250000) )))/ 360.0; + double fViewZ = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DZViewpoint, 9000000 ))) / 360.0; css::drawing::Position3D aExtrusionViewPoint( fViewX, fViewY, fViewZ ); const OUString sExtrusionViewPoint( "ViewPoint" ); aProp.Name = sExtrusionViewPoint; @@ -1856,8 +1856,8 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( IsProperty( DFF_Prop_c3DOriginX ) || IsProperty( DFF_Prop_c3DOriginY ) ) { const OUString sExtrusionOrigin( "Origin" ); - double fOriginX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DOriginX, 32768 )); - double fOriginY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DOriginY, (sal_uInt32)-32768 )); + double fOriginX = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DOriginX, 32768 ))); + double fOriginY = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DOriginY, sal_uInt32(-32768) ))); fOriginX /= 65536; fOriginY /= 65536; EnhancedCustomShapeParameterPair aOriginPair; @@ -2017,7 +2017,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt } if ( nFlags & SvxMSDffHandleFlags::RANGE ) { - if ( (sal_uInt32)nRangeXMin != 0x80000000 ) + if ( static_cast<sal_uInt32>(nRangeXMin) != 0x80000000 ) { if ( nRangeXMin == 2 ) nRangeXMin = nCoordWidth / 2; @@ -2029,7 +2029,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt aProp.Value <<= aRangeXMinimum; aHandlePropVec.push_back( aProp ); } - if ( (sal_uInt32)nRangeXMax != 0x7fffffff ) + if ( static_cast<sal_uInt32>(nRangeXMax) != 0x7fffffff ) { if ( nRangeXMax == 2 ) nRangeXMax = nCoordWidth / 2; @@ -2041,7 +2041,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt aProp.Value <<= aRangeXMaximum; aHandlePropVec.push_back( aProp ); } - if ( (sal_uInt32)nRangeYMin != 0x80000000 ) + if ( static_cast<sal_uInt32>(nRangeYMin) != 0x80000000 ) { if ( nRangeYMin == 2 ) nRangeYMin = nCoordHeight / 2; @@ -2053,7 +2053,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt aProp.Value <<= aRangeYMinimum; aHandlePropVec.push_back( aProp ); } - if ( (sal_uInt32)nRangeYMax != 0x7fffffff ) + if ( static_cast<sal_uInt32>(nRangeYMax) != 0x7fffffff ) { if ( nRangeYMax == 2 ) nRangeYMax = nCoordHeight / 2; @@ -2068,7 +2068,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt } if ( nFlags & SvxMSDffHandleFlags::RADIUS_RANGE ) { - if ( (sal_uInt32)nRangeXMin != 0x7fffffff ) + if ( static_cast<sal_uInt32>(nRangeXMin) != 0x7fffffff ) { if ( nRangeXMin == 2 ) nRangeXMin = nCoordWidth / 2; @@ -2080,7 +2080,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt aProp.Value <<= aRadiusRangeMinimum; aHandlePropVec.push_back( aProp ); } - if ( (sal_uInt32)nRangeXMax != 0x80000000 ) + if ( static_cast<sal_uInt32>(nRangeXMax) != 0x80000000 ) { if ( nRangeXMax == 2 ) nRangeXMax = nCoordWidth / 2; @@ -2227,7 +2227,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt sal_uInt16 nTmp(0); rIn.ReadUInt16( nTmp ); sal_Int16 nCommand = EnhancedCustomShapeSegmentCommand::UNKNOWN; - sal_Int16 nCnt = (sal_Int16)( nTmp & 0x1fff );//Last 13 bits for segment points number + sal_Int16 nCnt = static_cast<sal_Int16>( nTmp & 0x1fff );//Last 13 bits for segment points number switch( nTmp >> 13 )//First 3 bits for command type { case 0x0: @@ -2321,7 +2321,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt } // if the command is unknown, we will store all the data in nCnt, so it will be possible to export without loss if ( nCommand == EnhancedCustomShapeSegmentCommand::UNKNOWN ) - nCnt = (sal_Int16)nTmp; + nCnt = static_cast<sal_Int16>(nTmp); aSegments[ i ].Command = nCommand; aSegments[ i ].Count = nCnt; } @@ -2439,7 +2439,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt } if ( IsProperty( DFF_Prop_connectorType ) ) { - sal_Int16 nGluePointType = (sal_uInt16)GetPropertyValue( DFF_Prop_connectorType, 0 ); + sal_Int16 nGluePointType = static_cast<sal_uInt16>(GetPropertyValue( DFF_Prop_connectorType, 0 )); const OUString sGluePointType( "GluePointType" ); aProp.Name = sGluePointType; aProp.Value <<= nGluePointType; @@ -2595,7 +2595,7 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObj rSet.Put( makeSdrShadowColorItem( rManager.MSO_CLR_ToColor( 0x00808080, DFF_Prop_shadowColor ) ) ); } if ( IsProperty( DFF_Prop_shadowOpacity ) ) - rSet.Put( makeSdrShadowTransparenceItem( (sal_uInt16)( ( 0x10000 - GetPropertyValue( DFF_Prop_shadowOpacity, 0 ) ) / 655 ) ) ); + rSet.Put( makeSdrShadowTransparenceItem( static_cast<sal_uInt16>( ( 0x10000 - GetPropertyValue( DFF_Prop_shadowOpacity, 0 ) ) / 655 ) ) ); if ( IsProperty( DFF_Prop_shadowOffsetX ) ) { sal_Int32 nVal = static_cast< sal_Int32 >( GetPropertyValue( DFF_Prop_shadowOffsetX, 0 ) ); @@ -2807,7 +2807,7 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet,MSO_FillType eMSO_ { nRotateAngle = GetPropertyValue( DFF_Prop_Rotation, 0 ); if(nRotateAngle)//fixed point number - nRotateAngle = ( (sal_Int16)( nRotateAngle >> 16) * 100L ) + ( ( ( nRotateAngle & 0x0000ffff) * 100L ) >> 16 ); + nRotateAngle = ( static_cast<sal_Int16>( nRotateAngle >> 16) * 100L ) + ( ( ( nRotateAngle & 0x0000ffff) * 100L ) >> 16 ); nRotateAngle = ( nRotateAngle + 5 ) / 10 ;//round up //nAngle is a clockwise angle. If nRotateAngle is a clockwise angle, then gradient need be rotated a little less //Or it need be rotated a little more @@ -2834,8 +2834,8 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet,MSO_FillType eMSO_ } //if the type is linear or axial, just save focus to nFocusX and nFocusY for export //Core function does no need them. They serves for rect gradient(CenterXY). - sal_uInt16 nFocusX = (sal_uInt16)nFocus; - sal_uInt16 nFocusY = (sal_uInt16)nFocus; + sal_uInt16 nFocusX = static_cast<sal_uInt16>(nFocus); + sal_uInt16 nFocusY = static_cast<sal_uInt16>(nFocus); switch( eMSO_FillType ) { @@ -2882,8 +2882,8 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet,MSO_FillType eMSO_ //Construct tranparency item. This item can coordinate with both solid and gradient. if ( dTrans < 1.0 || dBackTrans < 1.0 ) { - sal_uInt8 nStartCol = (sal_uInt8)( (1 - dTrans )* 255 ); - sal_uInt8 nEndCol = (sal_uInt8)( ( 1- dBackTrans ) * 255 ); + sal_uInt8 nStartCol = static_cast<sal_uInt8>( (1 - dTrans )* 255 ); + sal_uInt8 nEndCol = static_cast<sal_uInt8>( ( 1- dBackTrans ) * 255 ); aCol1 = Color(nStartCol, nStartCol, nStartCol); aCol2 = Color(nEndCol, nEndCol, nEndCol); @@ -3361,7 +3361,7 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) // sj: it needs to be checked if 0xfe is used in nColorCode &= 0x00ffffff; // other cases than ppt text -> if not this code can be removed - sal_uInt8 nUpper = (sal_uInt8)( nColorCode >> 24 ); + sal_uInt8 nUpper = static_cast<sal_uInt8>( nColorCode >> 24 ); // sj: below change from 0x1b to 0x19 was done because of i84812 (0x02 -> rgb color), // now I have some problems to fix i104685 (there the color value is 0x02000000 which requires @@ -3371,7 +3371,7 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte if( ( nUpper & 0x08 ) || ( ( nUpper & 0x10 ) == 0 ) ) { // SCHEMECOLOR - if ( !GetColorFromPalette( ( nUpper & 8 ) ? (sal_uInt16)nColorCode : nUpper, aColor ) ) + if ( !GetColorFromPalette( ( nUpper & 8 ) ? static_cast<sal_uInt16>(nColorCode) : nUpper, aColor ) ) { switch( nContentProperty ) { @@ -3394,8 +3394,8 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); sal_uInt16 nParameter = sal_uInt16(( nColorCode >> 16 ) & 0x00ff); // the HiByte of nParameter is not zero, an exclusive AND is helping :o - sal_uInt16 nFunctionBits = (sal_uInt16)( ( nColorCode & 0x00000f00 ) >> 8 ); - sal_uInt16 nAdditionalFlags = (sal_uInt16)( ( nColorCode & 0x0000f000) >> 8 ); + sal_uInt16 nFunctionBits = static_cast<sal_uInt16>( ( nColorCode & 0x00000f00 ) >> 8 ); + sal_uInt16 nAdditionalFlags = static_cast<sal_uInt16>( ( nColorCode & 0x0000f000) >> 8 ); sal_uInt16 nColorIndex = sal_uInt16(nColorCode & 0x00ff); sal_uInt32 nPropColor = 0; @@ -3514,44 +3514,44 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte break; case 0x03 : // add grey level RGB(p,p,p) { - sal_Int16 nR = (sal_Int16)aColor.GetRed() + (sal_Int16)nParameter; - sal_Int16 nG = (sal_Int16)aColor.GetGreen() + (sal_Int16)nParameter; - sal_Int16 nB = (sal_Int16)aColor.GetBlue() + (sal_Int16)nParameter; + sal_Int16 nR = static_cast<sal_Int16>(aColor.GetRed()) + static_cast<sal_Int16>(nParameter); + sal_Int16 nG = static_cast<sal_Int16>(aColor.GetGreen()) + static_cast<sal_Int16>(nParameter); + sal_Int16 nB = static_cast<sal_Int16>(aColor.GetBlue()) + static_cast<sal_Int16>(nParameter); if ( nR > 0x00ff ) nR = 0x00ff; if ( nG > 0x00ff ) nG = 0x00ff; if ( nB > 0x00ff ) nB = 0x00ff; - aColor = Color( (sal_uInt8)nR, (sal_uInt8)nG, (sal_uInt8)nB ); + aColor = Color( static_cast<sal_uInt8>(nR), static_cast<sal_uInt8>(nG), static_cast<sal_uInt8>(nB) ); } break; case 0x04 : // subtract grey level RGB(p,p,p) { - sal_Int16 nR = (sal_Int16)aColor.GetRed() - (sal_Int16)nParameter; - sal_Int16 nG = (sal_Int16)aColor.GetGreen() - (sal_Int16)nParameter; - sal_Int16 nB = (sal_Int16)aColor.GetBlue() - (sal_Int16)nParameter; + sal_Int16 nR = static_cast<sal_Int16>(aColor.GetRed()) - static_cast<sal_Int16>(nParameter); + sal_Int16 nG = static_cast<sal_Int16>(aColor.GetGreen()) - static_cast<sal_Int16>(nParameter); + sal_Int16 nB = static_cast<sal_Int16>(aColor.GetBlue()) - static_cast<sal_Int16>(nParameter); if ( nR < 0 ) nR = 0; if ( nG < 0 ) nG = 0; if ( nB < 0 ) nB = 0; - aColor = Color( (sal_uInt8)nR, (sal_uInt8)nG, (sal_uInt8)nB ); + aColor = Color( static_cast<sal_uInt8>(nR), static_cast<sal_uInt8>(nG), static_cast<sal_uInt8>(nB) ); } break; case 0x05 : // subtract from gray level RGB(p,p,p) { - sal_Int16 nR = (sal_Int16)nParameter - (sal_Int16)aColor.GetRed(); - sal_Int16 nG = (sal_Int16)nParameter - (sal_Int16)aColor.GetGreen(); - sal_Int16 nB = (sal_Int16)nParameter - (sal_Int16)aColor.GetBlue(); + sal_Int16 nR = static_cast<sal_Int16>(nParameter) - static_cast<sal_Int16>(aColor.GetRed()); + sal_Int16 nG = static_cast<sal_Int16>(nParameter) - static_cast<sal_Int16>(aColor.GetGreen()); + sal_Int16 nB = static_cast<sal_Int16>(nParameter) - static_cast<sal_Int16>(aColor.GetBlue()); if ( nR < 0 ) nR = 0; if ( nG < 0 ) nG = 0; if ( nB < 0 ) nB = 0; - aColor = Color( (sal_uInt8)nR, (sal_uInt8)nG, (sal_uInt8)nB ); + aColor = Color( static_cast<sal_uInt8>(nR), static_cast<sal_uInt8>(nG), static_cast<sal_uInt8>(nB) ); } break; case 0x06 : // per component: black if < p, white if >= p @@ -3574,7 +3574,7 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte GetColorFromPalette( nUpper, aColor ); } else // attributed hard, maybe with hint to SYSTEMRGB - aColor = Color( (sal_uInt8)nColorCode, (sal_uInt8)( nColorCode >> 8 ), (sal_uInt8)( nColorCode >> 16 ) ); + aColor = Color( static_cast<sal_uInt8>(nColorCode), static_cast<sal_uInt8>( nColorCode >> 8 ), static_cast<sal_uInt8>( nColorCode >> 16 ) ); return aColor; } @@ -3714,10 +3714,10 @@ static Size lcl_GetPrefSize(const Graphic& rGraf, const MapMode& aWanted) // otherwise rGraf is untouched and pSet is used to store the corresponding SdrGrafCropItem static void lcl_ApplyCropping( const DffPropSet& rPropSet, SfxItemSet* pSet, Graphic& rGraf ) { - sal_Int32 nCropTop = (sal_Int32)rPropSet.GetPropertyValue( DFF_Prop_cropFromTop, 0 ); - sal_Int32 nCropBottom = (sal_Int32)rPropSet.GetPropertyValue( DFF_Prop_cropFromBottom, 0 ); - sal_Int32 nCropLeft = (sal_Int32)rPropSet.GetPropertyValue( DFF_Prop_cropFromLeft, 0 ); - sal_Int32 nCropRight = (sal_Int32)rPropSet.GetPropertyValue( DFF_Prop_cropFromRight, 0 ); + sal_Int32 nCropTop = static_cast<sal_Int32>(rPropSet.GetPropertyValue( DFF_Prop_cropFromTop, 0 )); + sal_Int32 nCropBottom = static_cast<sal_Int32>(rPropSet.GetPropertyValue( DFF_Prop_cropFromBottom, 0 )); + sal_Int32 nCropLeft = static_cast<sal_Int32>(rPropSet.GetPropertyValue( DFF_Prop_cropFromLeft, 0 )); + sal_Int32 nCropRight = static_cast<sal_Int32>(rPropSet.GetPropertyValue( DFF_Prop_cropFromRight, 0 )); if( nCropTop || nCropBottom || nCropLeft || nCropRight ) { @@ -3735,23 +3735,23 @@ static void lcl_ApplyCropping( const DffPropSet& rPropSet, SfxItemSet* pSet, Gra } if ( nCropTop ) { - fFactor = (double)nCropTop / 65536.0; - nTop = (sal_uInt32)( ( (double)( aCropSize.Height() + 1 ) * fFactor ) + 0.5 ); + fFactor = static_cast<double>(nCropTop) / 65536.0; + nTop = static_cast<sal_uInt32>( ( static_cast<double>( aCropSize.Height() + 1 ) * fFactor ) + 0.5 ); } if ( nCropBottom ) { - fFactor = (double)nCropBottom / 65536.0; - nBottom = (sal_uInt32)( ( (double)( aCropSize.Height() + 1 ) * fFactor ) + 0.5 ); + fFactor = static_cast<double>(nCropBottom) / 65536.0; + nBottom = static_cast<sal_uInt32>( ( static_cast<double>( aCropSize.Height() + 1 ) * fFactor ) + 0.5 ); } if ( nCropLeft ) { - fFactor = (double)nCropLeft / 65536.0; - nLeft = (sal_uInt32)( ( (double)( aCropSize.Width() + 1 ) * fFactor ) + 0.5 ); + fFactor = static_cast<double>(nCropLeft) / 65536.0; + nLeft = static_cast<sal_uInt32>( ( static_cast<double>( aCropSize.Width() + 1 ) * fFactor ) + 0.5 ); } if ( nCropRight ) { - fFactor = (double)nCropRight / 65536.0; - nRight = (sal_uInt32)( ( (double)( aCropSize.Width() + 1 ) * fFactor ) + 0.5 ); + fFactor = static_cast<double>(nCropRight) / 65536.0; + nRight = static_cast<sal_uInt32>( ( static_cast<double>( aCropSize.Width() + 1 ) * fFactor ) + 0.5 ); } if ( pSet ) // use crop attributes ? pSet->Put( SdrGrafCropItem( nLeft, nTop, nRight, nBottom ) ); @@ -3873,7 +3873,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons nContrast -= 100; } } - sal_Int16 nBrightness = (sal_Int16)( (sal_Int32)GetPropertyValue( DFF_Prop_pictureBrightness, 0 ) / 327 ); + sal_Int16 nBrightness = static_cast<sal_Int16>( static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_pictureBrightness, 0 )) / 327 ); sal_Int32 nGamma = GetPropertyValue( DFF_Prop_pictureGamma, 0x10000 ); GraphicDrawMode eDrawMode = GraphicDrawMode::Standard; switch ( GetPropertyValue( DFF_Prop_pictureActive, 0 ) & 6 ) @@ -3907,7 +3907,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons if ( nBrightness ) rSet.Put( SdrGrafLuminanceItem( nBrightness ) ); if ( nContrast ) - rSet.Put( SdrGrafContrastItem( (sal_Int16)nContrast ) ); + rSet.Put( SdrGrafContrastItem( static_cast<sal_Int16>(nContrast) ) ); if ( nGamma != 0x10000 ) rSet.Put( SdrGrafGamma100Item( nGamma / 655 ) ); if ( eDrawMode != GraphicDrawMode::Standard ) @@ -3927,7 +3927,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons { BitmapEx aBitmapEx( aGraf.GetBitmapEx() ); if ( nBrightness || nContrast || ( nGamma != 0x10000 ) ) - aBitmapEx.Adjust( nBrightness, (sal_Int16)nContrast, 0, 0, 0, (double)nGamma / 0x10000, false, true ); + aBitmapEx.Adjust( nBrightness, static_cast<sal_Int16>(nContrast), 0, 0, 0, static_cast<double>(nGamma) / 0x10000, false, true ); if ( eDrawMode == GraphicDrawMode::Greys ) aBitmapEx.Convert( BmpConversion::N8BitGreys ); else if ( eDrawMode == GraphicDrawMode::Mono ) @@ -3941,7 +3941,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons { GDIMetaFile aGdiMetaFile( aGraf.GetGDIMetaFile() ); if ( nBrightness || nContrast || ( nGamma != 0x10000 ) ) - aGdiMetaFile.Adjust( nBrightness, (sal_Int16)nContrast, 0, 0, 0, (double)nGamma / 0x10000, false, true ); + aGdiMetaFile.Adjust( nBrightness, static_cast<sal_Int16>(nContrast), 0, 0, 0, static_cast<double>(nGamma) / 0x10000, false, true ); if ( eDrawMode == GraphicDrawMode::Greys ) aGdiMetaFile.Convert( MtfConversion::N8BitGreys ); else if ( eDrawMode == GraphicDrawMode::Mono ) @@ -4265,13 +4265,13 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r if (!rGlobalChildRect.IsEmpty() && !rClientRect.IsEmpty() && rGlobalChildRect.GetWidth() && rGlobalChildRect.GetHeight() && !o3tl::checked_sub(r, l, nWidth) && !o3tl::checked_sub(u, o, nHeight)) { - double fXScale = (double)rClientRect.GetWidth() / (double)rGlobalChildRect.GetWidth(); - double fYScale = (double)rClientRect.GetHeight() / (double)rGlobalChildRect.GetHeight(); + double fXScale = static_cast<double>(rClientRect.GetWidth()) / static_cast<double>(rGlobalChildRect.GetWidth()); + double fYScale = static_cast<double>(rClientRect.GetHeight()) / static_cast<double>(rGlobalChildRect.GetHeight()); double fl = ( ( l - rGlobalChildRect.Left() ) * fXScale ) + rClientRect.Left(); double fo = ( ( o - rGlobalChildRect.Top() ) * fYScale ) + rClientRect.Top(); double fWidth = nWidth * fXScale; double fHeight = nHeight * fYScale; - aObjData.aChildAnchor = tools::Rectangle( Point( (sal_Int32)fl, (sal_Int32)fo ), Size( (sal_Int32)( fWidth + 1 ), (sal_Int32)( fHeight + 1 ) ) ); + aObjData.aChildAnchor = tools::Rectangle( Point( static_cast<sal_Int32>(fl), static_cast<sal_Int32>(fo) ), Size( static_cast<sal_Int32>( fWidth + 1 ), static_cast<sal_Int32>( fHeight + 1 ) ) ); } } @@ -4422,7 +4422,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r { sal_Int32 nTextWidth = GetPropertyValue( DFF_Prop_gtextSpacing, 1 << 16 ) / 655; if ( nTextWidth != 100 ) - aSet.Put( SvxCharScaleWidthItem( (sal_uInt16)nTextWidth, EE_CHAR_FONTWIDTH ) ); + aSet.Put( SvxCharScaleWidthItem( static_cast<sal_uInt16>(nTextWidth), EE_CHAR_FONTWIDTH ) ); } if ( ngtextFStrikethrough & 0x1000 ) // SJ: Font Kerning On ? aSet.Put( SvxKerningItem( 1, EE_CHAR_KERNING ) ); @@ -4452,7 +4452,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r if ( nTextWidth && aObjData.eShapeType == mso_sptTextPlainText && aObjName.match( "PowerPlusWaterMarkObject" ) ) { - double fRatio = (double)pDevice->GetTextHeight() / nTextWidth; + double fRatio = static_cast<double>(pDevice->GetTextHeight()) / nTextWidth; sal_Int32 nNewHeight = fRatio * aObjData.aBoundRect.getWidth(); sal_Int32 nPaddingY = aObjData.aBoundRect.getHeight() - nNewHeight; @@ -4532,7 +4532,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r if ( pAny && ( *pAny >>= seqCoordinates ) && ( seqCoordinates.getLength() >= 4 ) ) { sal_Int32 nPtNum, nNumElemVert = seqCoordinates.getLength(); - XPolygon aXP( (sal_uInt16)nNumElemVert ); + XPolygon aXP( static_cast<sal_uInt16>(nNumElemVert) ); for ( nPtNum = 0; nPtNum < nNumElemVert; nPtNum++ ) { Point aP; @@ -4541,7 +4541,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r seqCoordinates[ nPtNum ].Second.Value >>= nY; aP.X() = nX; aP.Y() = nY; - aXP[ (sal_uInt16)nPtNum ] = aP; + aXP[ static_cast<sal_uInt16>(nPtNum) ] = aP; } aPolyBoundRect = tools::Rectangle( aXP.GetBoundRect() ); if ( nNumElemVert >= 3 ) @@ -4568,7 +4568,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r { double fNumber; seqAdjustmentValues[ 0 ].Value >>= fNumber; - nEndAngle = NormAngle360( - (sal_Int32)fNumber * 100 ); + nEndAngle = NormAngle360( - static_cast<sal_Int32>(fNumber) * 100 ); } else { @@ -4584,7 +4584,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r fNumber = atan2( double( aStartPt.X() - cent.X() ),double( aStartPt.Y() - cent.Y() ) )+ F_PI; // 0..2PI fNumber /= F_PI180; // 0..360.0 } - nEndAngle = NormAngle360( - (sal_Int32)fNumber * 100 ); + nEndAngle = NormAngle360( - static_cast<sal_Int32>(fNumber) * 100 ); seqAdjustmentValues[ 0 ].Value <<= fNumber; seqAdjustmentValues[ 0 ].State = css::beans::PropertyState_DIRECT_VALUE; // so this value will properly be stored } @@ -4593,7 +4593,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r { double fNumber; seqAdjustmentValues[ 1 ].Value >>= fNumber; - nStartAngle = NormAngle360( - (sal_Int32)fNumber * 100 ); + nStartAngle = NormAngle360( - static_cast<sal_Int32>(fNumber) * 100 ); } else { @@ -4609,7 +4609,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r if ( nStartAngle != nEndAngle ) { XPolygon aXPoly( aPolyBoundRect.Center(), aPolyBoundRect.GetWidth() / 2, aPolyBoundRect.GetHeight() / 2, - (sal_uInt16)nStartAngle / 10, (sal_uInt16)nEndAngle / 10, true ); + static_cast<sal_uInt16>(nStartAngle) / 10, static_cast<sal_uInt16>(nEndAngle) / 10, true ); tools::Rectangle aPolyPieRect( aXPoly.GetBoundRect() ); double fYScale = 0.0, fXScale = 0.0; @@ -4625,42 +4625,42 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r if ( aPolyBoundRect.GetWidth() && aPolyPieRect.GetWidth() ) { - fXScale = (double)aLogicRect.GetWidth() / (double)aPolyPieRect.GetWidth(); + fXScale = static_cast<double>(aLogicRect.GetWidth()) / static_cast<double>(aPolyPieRect.GetWidth()); if ( nSpFlags & ShapeFlag::FlipH ) - fXOfs = ( (double)aPolyPieRect.Right() - (double)aPolyBoundRect.Right() ) * fXScale; + fXOfs = ( static_cast<double>(aPolyPieRect.Right()) - static_cast<double>(aPolyBoundRect.Right()) ) * fXScale; else - fXOfs = ( (double)aPolyBoundRect.Left() - (double)aPolyPieRect.Left() ) * fXScale; + fXOfs = ( static_cast<double>(aPolyBoundRect.Left()) - static_cast<double>(aPolyPieRect.Left()) ) * fXScale; } if ( aPolyBoundRect.GetHeight() && aPolyPieRect.GetHeight() ) { - fYScale = (double)aLogicRect.GetHeight() / (double)aPolyPieRect.GetHeight(); + fYScale = static_cast<double>(aLogicRect.GetHeight()) / static_cast<double>(aPolyPieRect.GetHeight()); if ( nSpFlags & ShapeFlag::FlipV ) - fYOfs = ( (double)aPolyPieRect.Bottom() - (double)aPolyBoundRect.Bottom() ) * fYScale; + fYOfs = ( static_cast<double>(aPolyPieRect.Bottom()) - static_cast<double>(aPolyBoundRect.Bottom()) ) * fYScale; else - fYOfs = ((double)aPolyBoundRect.Top() - (double)aPolyPieRect.Top() ) * fYScale; + fYOfs = (static_cast<double>(aPolyBoundRect.Top()) - static_cast<double>(aPolyPieRect.Top()) ) * fYScale; } if ( aPolyPieRect.GetWidth() ) - fXScale = (double)aPolyBoundRect.GetWidth() / (double)aPolyPieRect.GetWidth(); + fXScale = static_cast<double>(aPolyBoundRect.GetWidth()) / static_cast<double>(aPolyPieRect.GetWidth()); if ( aPolyPieRect.GetHeight() ) - fYScale = (double)aPolyBoundRect.GetHeight() / (double)aPolyPieRect.GetHeight(); + fYScale = static_cast<double>(aPolyBoundRect.GetHeight()) / static_cast<double>(aPolyPieRect.GetHeight()); tools::Rectangle aOldBoundRect( aObjData.aBoundRect ); - aObjData.aBoundRect = tools::Rectangle( Point( aLogicRect.Left() + (sal_Int32)fXOfs, aLogicRect.Top() + (sal_Int32)fYOfs ), - Size( (sal_Int32)( aLogicRect.GetWidth() * fXScale ), (sal_Int32)( aLogicRect.GetHeight() * fYScale ) ) ); + aObjData.aBoundRect = tools::Rectangle( Point( aLogicRect.Left() + static_cast<sal_Int32>(fXOfs), aLogicRect.Top() + static_cast<sal_Int32>(fYOfs) ), + Size( static_cast<sal_Int32>( aLogicRect.GetWidth() * fXScale ), static_cast<sal_Int32>( aLogicRect.GetHeight() * fYScale ) ) ); // creating the text frame -> scaling into (0,0),(21600,21600) destination coordinate system double fTextFrameScaleX = 0.0; double fTextFrameScaleY = 0.0; if (aPolyBoundRect.GetWidth()) - fTextFrameScaleX = (double)21600 / (double)aPolyBoundRect.GetWidth(); + fTextFrameScaleX = double(21600) / static_cast<double>(aPolyBoundRect.GetWidth()); if (aPolyBoundRect.GetHeight()) - fTextFrameScaleY = (double)21600 / (double)aPolyBoundRect.GetHeight(); + fTextFrameScaleY = double(21600) / static_cast<double>(aPolyBoundRect.GetHeight()); - sal_Int32 nLeft = (sal_Int32)(( aPolyPieRect.Left() - aPolyBoundRect.Left() ) * fTextFrameScaleX ); - sal_Int32 nTop = (sal_Int32)(( aPolyPieRect.Top() - aPolyBoundRect.Top() ) * fTextFrameScaleY ); - sal_Int32 nRight = (sal_Int32)(( aPolyPieRect.Right() - aPolyBoundRect.Left() ) * fTextFrameScaleX ); - sal_Int32 nBottom= (sal_Int32)(( aPolyPieRect.Bottom()- aPolyBoundRect.Top() ) * fTextFrameScaleY ); + sal_Int32 nLeft = static_cast<sal_Int32>(( aPolyPieRect.Left() - aPolyBoundRect.Left() ) * fTextFrameScaleX ); + sal_Int32 nTop = static_cast<sal_Int32>(( aPolyPieRect.Top() - aPolyBoundRect.Top() ) * fTextFrameScaleY ); + sal_Int32 nRight = static_cast<sal_Int32>(( aPolyPieRect.Right() - aPolyBoundRect.Left() ) * fTextFrameScaleX ); + sal_Int32 nBottom= static_cast<sal_Int32>(( aPolyPieRect.Bottom()- aPolyBoundRect.Top() ) * fTextFrameScaleY ); css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > aTextFrame( 1 ); EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrame[ 0 ].TopLeft.First, nLeft ); EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrame[ 0 ].TopLeft.Second, nTop ); @@ -5010,13 +5010,13 @@ void SvxMSDffManager::GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt { double fWidth = r - l; double fHeight= u - o; - double fXScale = (double)rClientRect.GetWidth() / (double)rGlobalChildRect.GetWidth(); - double fYScale = (double)rClientRect.GetHeight() / (double)rGlobalChildRect.GetHeight(); + double fXScale = static_cast<double>(rClientRect.GetWidth()) / static_cast<double>(rGlobalChildRect.GetWidth()); + double fYScale = static_cast<double>(rClientRect.GetHeight()) / static_cast<double>(rGlobalChildRect.GetHeight()); double fl = ( ( l - rGlobalChildRect.Left() ) * fXScale ) + rClientRect.Left(); double fo = ( ( o - rGlobalChildRect.Top() ) * fYScale ) + rClientRect.Top(); fWidth *= fXScale; fHeight *= fYScale; - rGroupClientAnchor = tools::Rectangle( Point( (sal_Int32)fl, (sal_Int32)fo ), Size( (sal_Int32)( fWidth + 1 ), (sal_Int32)( fHeight + 1 ) ) ); + rGroupClientAnchor = tools::Rectangle( Point( static_cast<sal_Int32>(fl), static_cast<sal_Int32>(fo) ), Size( static_cast<sal_Int32>( fWidth + 1 ), static_cast<sal_Int32>( fHeight + 1 ) ) ); } bFirst = false; } @@ -5440,8 +5440,8 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, if ( nTextId ) { - pTextImpRec->aTextId.nTxBxS = (sal_uInt16)( nTextId >> 16 ); - pTextImpRec->aTextId.nSequence = (sal_uInt16)nTextId; + pTextImpRec->aTextId.nTxBxS = static_cast<sal_uInt16>( nTextId >> 16 ); + pTextImpRec->aTextId.nSequence = static_cast<sal_uInt16>(nTextId); } pTextImpRec->nDxWrapDistLeft = GetPropertyValue( @@ -5540,7 +5540,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, && (rObjData.nCalledByGroup < 2) ) ) StoreShapeOrder( pImpRec->nShapeId, - ( ( (sal_uLong)pImpRec->aTextId.nTxBxS ) << 16 ) + ( static_cast<sal_uLong>(pImpRec->aTextId.nTxBxS) << 16 ) + pImpRec->aTextId.nSequence, pObj ); } @@ -6534,8 +6534,8 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool if( aOldSize.Width() && ( aOldSize.Width() != aMtfSize100.Width() ) && aOldSize.Height() && ( aOldSize.Height() != aMtfSize100.Height() ) ) { - aMtf.Scale( (double) aMtfSize100.Width() / aOldSize.Width(), - (double) aMtfSize100.Height() / aOldSize.Height() ); + aMtf.Scale( static_cast<double>(aMtfSize100.Width()) / aOldSize.Width(), + static_cast<double>(aMtfSize100.Height()) / aOldSize.Height() ); aMtf.SetPrefSize( aMtfSize100 ); aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM)); rData = aMtf; @@ -6790,7 +6790,7 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen, { std::unique_ptr<sal_Char[]> pBuf(new sal_Char[ nStrLen ]); rStm.ReadBytes(pBuf.get(), nStrLen); - aSvrName = OUString( pBuf.get(), (sal_uInt16) nStrLen-1, osl_getThreadTextEncoding() ); + aSvrName = OUString( pBuf.get(), static_cast<sal_uInt16>(nStrLen)-1, osl_getThreadTextEncoding() ); } else break; diff --git a/filter/source/msfilter/msoleexp.cxx b/filter/source/msfilter/msoleexp.cxx index f527012bce07..1d8d54249f69 100644 --- a/filter/source/msfilter/msoleexp.cxx +++ b/filter/source/msfilter/msoleexp.cxx @@ -268,7 +268,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef const & rObj sal_Int32 nVal = pRect[ind]; for ( int nByte = 0; nByte < 4; nByte++ ) { - aWriteSet[ind*4+nByte] = (sal_Int8) nVal % 0x100; + aWriteSet[ind*4+nByte] = static_cast<sal_Int8>(nVal) % 0x100; nVal /= 0x100; } } diff --git a/filter/source/msfilter/rtfutil.cxx b/filter/source/msfilter/rtfutil.cxx index 279fe123e5b5..31bcffeb4a09 100644 --- a/filter/source/msfilter/rtfutil.cxx +++ b/filter/source/msfilter/rtfutil.cxx @@ -28,7 +28,7 @@ OString OutHex(sal_uLong nHex, sal_uInt8 nLen) sal_Char* pStr = aNToABuf + (sizeof(aNToABuf) - 1); for (sal_uInt8 n = 0; n < nLen; ++n) { - *(--pStr) = (sal_Char)(nHex & 0xf) + 48; + *(--pStr) = static_cast<sal_Char>(nHex & 0xf) + 48; if (*pStr > '9') *pStr += 39; nHex >>= 4; @@ -68,7 +68,7 @@ OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc, bool* pS case '}': case '{': aBuf.append('\\'); - aBuf.append((sal_Char)c); + aBuf.append(static_cast<sal_Char>(c)); break; case 0xa0: // non-breaking space @@ -84,7 +84,7 @@ OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc, bool* pS break; default: if (c >= ' ' && c <= '~') - aBuf.append((sal_Char)c); + aBuf.append(static_cast<sal_Char>(c)); else { OUString sBuf(&c, 1); @@ -102,13 +102,13 @@ OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc, bool* pS if (*pUCMode != nLen) { aBuf.append("\\uc"); - aBuf.append((sal_Int32)nLen); + aBuf.append(static_cast<sal_Int32>(nLen)); // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored. aBuf.append(' '); *pUCMode = nLen; } aBuf.append("\\u"); - aBuf.append((sal_Int32)c); + aBuf.append(static_cast<sal_Int32>(c)); } for (sal_Int32 nI = 0; nI < nLen; ++nI) @@ -144,7 +144,7 @@ OString OutString(const OUString& rStr, rtl_TextEncoding eDestEnc, bool bUnicode if (nUCMode != 1) { aBuf.append(OOO_STRING_SVTOOLS_RTF_UC); - aBuf.append((sal_Int32)1); + aBuf.append(sal_Int32(1)); aBuf.append( " "); // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.; } diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index d8e2cd1ea322..78d185bd0785 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -622,7 +622,7 @@ void SdrEscherImport::RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic if ( ( nGlobalColorsCount <= 64 ) && ( nFillColorsCount <= 64 ) ) { - if ( (sal_uInt32)( ( nGlobalColorsCount + nFillColorsCount ) * 44 + 12 ) == nRecLen ) + if ( static_cast<sal_uInt32>( ( nGlobalColorsCount + nFillColorsCount ) * 44 + 12 ) == nRecLen ) { sal_uInt32 OriginalGlobalColors[ 64 ]; sal_uInt32 NewGlobalColors[ 64 ]; @@ -688,13 +688,13 @@ void SdrEscherImport::RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic sal_uInt32 nSearch = OriginalGlobalColors[ j ]; sal_uInt32 nReplace = NewGlobalColors[ j ]; - pSearchColors[ j ].SetRed( (sal_uInt8)nSearch ); - pSearchColors[ j ].SetGreen( (sal_uInt8)( nSearch >> 8 ) ); - pSearchColors[ j ].SetBlue( (sal_uInt8)( nSearch >> 16 ) ); + pSearchColors[ j ].SetRed( static_cast<sal_uInt8>(nSearch) ); + pSearchColors[ j ].SetGreen( static_cast<sal_uInt8>( nSearch >> 8 ) ); + pSearchColors[ j ].SetBlue( static_cast<sal_uInt8>( nSearch >> 16 ) ); - pReplaceColors[ j ].SetRed( (sal_uInt8)nReplace ); - pReplaceColors[ j ].SetGreen( (sal_uInt8)( nReplace >> 8 ) ); - pReplaceColors[ j ].SetBlue( (sal_uInt8)( nReplace >> 16 ) ); + pReplaceColors[ j ].SetRed( static_cast<sal_uInt8>(nReplace) ); + pReplaceColors[ j ].SetGreen( static_cast<sal_uInt8>( nReplace >> 8 ) ); + pReplaceColors[ j ].SetBlue( static_cast<sal_uInt8>( nReplace >> 16 ) ); } GDIMetaFile aGdiMetaFile( rGraphic.GetGDIMetaFile() ); aGdiMetaFile.ReplaceColors( pSearchColors.get(), pReplaceColors.get(), @@ -1815,7 +1815,7 @@ SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId, ReadDffRecordHeader( rStCtrl, aHd ); sal_uInt32 nLen = aHd.nRecLen - 4; - if ( (sal_Int32)nLen > 0 ) + if ( static_cast<sal_Int32>(nLen) > 0 ) { bool bSuccess = false; @@ -1965,7 +1965,7 @@ SvMemoryStream* SdrPowerPointImport::ImportExOleObjStg( sal_uInt32 nPersistPtr, if ( aHd.nRecType == DFF_PST_ExOleObjStg ) { sal_uInt32 nLen = aHd.nRecLen - 4; - if ( (sal_Int32)nLen > 0 ) + if ( static_cast<sal_Int32>(nLen) > 0 ) { rStCtrl.ReadUInt32( nOleId ); pRet = new SvMemoryStream; @@ -2383,7 +2383,7 @@ bool SdrPowerPointImport::SeekToContentOfProgTag( sal_Int32 nVersion, SvStream& if ( i > n ) { OUString aPre = read_uInt16s_ToOUString(rSt, n); - n = (sal_uInt16)( i - 6 ); + n = static_cast<sal_uInt16>( i - 6 ); OUString aSuf = read_uInt16s_ToOUString(rSt, n); sal_Int32 nV = aSuf.toInt32(); if ( ( nV == nVersion ) && ( aPre == "___PPT" ) ) @@ -2424,7 +2424,7 @@ bool SdrPowerPointImport::SeekToAktPage( DffRecordHeader* pRecHd ) const PptSlidePersistList* pList = GetPageList( eAktPageKind ); if ( pList && ( nAktPageNum < pList->size() ) ) { - sal_uLong nPersist = (*pList)[ (sal_uInt16)nAktPageNum ].aPersistAtom.nPsrReference; + sal_uLong nPersist = (*pList)[ static_cast<sal_uInt16>(nAktPageNum) ].aPersistAtom.nPsrReference; if ( nPersist > 0 && nPersist < nPersistPtrCnt ) { sal_uLong nFPos = 0; @@ -3442,7 +3442,7 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport const & { SvxBrushItem aBrush( aGraphic, GPOS_MM, SID_ATTR_BRUSH ); rNumberFormat.SetGraphicBrush( &aBrush ); - sal_uInt32 nHeight = (sal_uInt32)( (double)nFontHeight * 0.2540 * nBulletHeight + 0.5 ); + sal_uInt32 nHeight = static_cast<sal_uInt32>( static_cast<double>(nFontHeight) * 0.2540 * nBulletHeight + 0.5 ); Size aPrefSize( aGraphic.GetPrefSize() ); sal_uInt32 nWidth; if (aPrefSize.Height()) @@ -3647,7 +3647,7 @@ void PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport const & rManag boost::optional< sal_Int16 > oStartNumbering; ImplGetExtNumberFormat( rManager, rNumberFormat, nLevel, nInstance, TSS_Type::Unknown, oStartNumbering, rCharLevel.mnFontHeight, nullptr ); if ( ( rNumberFormat.GetNumberingType() != SVX_NUM_BITMAP ) && ( nBulletHeight > 0x7fff ) ) - nBulletHeight = rCharLevel.mnFontHeight ? ((-((sal_Int16)nBulletHeight)) * 100 ) / rCharLevel.mnFontHeight : 100; + nBulletHeight = rCharLevel.mnFontHeight ? ((- static_cast<sal_Int16>(nBulletHeight)) * 100 ) / rCharLevel.mnFontHeight : 100; ImplGetNumberFormat( rManager, rNumberFormat ); switch ( rNumberFormat.GetNumberingType() ) { @@ -3754,7 +3754,7 @@ void PPTNumberFormatCreator::ImplGetNumberFormat( SdrPowerPointImport const & rM Color aCol( rManager.MSO_TEXT_CLR_ToColor( nBulletColor ) ); aFont.SetColor( aCol ); - sal_uInt16 nBuChar = (sal_uInt16)nBulletChar; + sal_uInt16 nBuChar = static_cast<sal_uInt16>(nBulletChar); if ( aFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL ) { nBuChar &= 0x00ff; @@ -3762,10 +3762,10 @@ void PPTNumberFormatCreator::ImplGetNumberFormat( SdrPowerPointImport const & rM } rNumberFormat.SetBulletFont( &aFont ); rNumberFormat.SetBulletChar( nBuChar ); - rNumberFormat.SetBulletRelSize( (sal_uInt16)nBulletHeight ); + rNumberFormat.SetBulletRelSize( static_cast<sal_uInt16>(nBulletHeight) ); rNumberFormat.SetBulletColor( aCol ); - sal_uInt16 nAbsLSpace = (sal_uInt16)( ( nTextOfs * 2540 ) / 576 ); - sal_uInt16 nFirstLineOffset = nAbsLSpace - (sal_uInt16)( ( nBulletOfs * 2540 ) / 576 ); + sal_uInt16 nAbsLSpace = static_cast<sal_uInt16>( ( nTextOfs * 2540 ) / 576 ); + sal_uInt16 nFirstLineOffset = nAbsLSpace - static_cast<sal_uInt16>( ( nBulletOfs * 2540 ) / 576 ); rNumberFormat.SetAbsLSpace( nAbsLSpace ); rNumberFormat.SetFirstLineOffset( -nFirstLineOffset ); } @@ -3805,7 +3805,7 @@ PPTCharSheet::PPTCharSheet( TSS_Type nInstance ) nDepth.mnAsianOrComplexFont = 0xffff; nDepth.mnFontHeight = nFontHeight; nDepth.mnFontColor = nColor; - nDepth.mnFontColorInStyleSheet = Color( (sal_uInt8)nColor, (sal_uInt8)( nColor >> 8 ), (sal_uInt8)( nColor >> 16 ) ); + nDepth.mnFontColorInStyleSheet = Color( static_cast<sal_uInt8>(nColor), static_cast<sal_uInt8>( nColor >> 8 ), static_cast<sal_uInt8>( nColor >> 16 ) ); nDepth.mnEscapement = 0; } } @@ -3825,7 +3825,7 @@ void PPTCharSheet::Read( SvStream& rIn, sal_uInt32 nLevel) if ( nCMask & 0x0000FFFF ) { sal_uInt16 nBitAttr; - maCharLevel[ nLevel ].mnFlags &= ~( (sal_uInt16)nCMask ); + maCharLevel[ nLevel ].mnFlags &= ~static_cast<sal_uInt16>(nCMask); rIn.ReadUInt16( nBitAttr ); // Bit attributes (bold, underlined, ...) maCharLevel[ nLevel ].mnFlags |= nBitAttr; } @@ -3924,7 +3924,7 @@ void PPTParaSheet::Read( SdrPowerPointImport const & sal_uInt32 nVal32, nPMask; rIn.ReadUInt32( nPMask ); - nMask16 = (sal_uInt16)nPMask & 0xf; + nMask16 = static_cast<sal_uInt16>(nPMask) & 0xf; if ( nMask16 ) { rIn.ReadUInt16( nVal16 ); @@ -4006,7 +4006,7 @@ void PPTParaSheet::Read( SdrPowerPointImport const & rIn.ReadUInt16( nVal16 ); if ( nPMask & 0xe0000 ) { - sal_uInt16 nFlagsToModifyMask = (sal_uInt16)( ( nPMask >> 17 ) & 7 ); + sal_uInt16 nFlagsToModifyMask = static_cast<sal_uInt16>( ( nPMask >> 17 ) & 7 ); rIn.ReadUInt16( nVal16 ); // bits that are not involved to zero nVal16 &= nFlagsToModifyMask; @@ -4047,7 +4047,7 @@ void PPTParaSheet::UpdateBulletRelSize( sal_uInt32 nLevel, sal_uInt16 nFontHeig { if ( maParaLevel[ nLevel ].mnBulletHeight > 0x7fff ) // a negative value is the absolute bullet height { - sal_Int16 nBulletRelSize = ( sal_Int16 )maParaLevel[ nLevel ].mnBulletHeight; + sal_Int16 nBulletRelSize = static_cast<sal_Int16>(maParaLevel[ nLevel ].mnBulletHeight); nBulletRelSize = nFontHeight ? ((-nBulletRelSize) * 100 ) / nFontHeight : 100; if ( nBulletRelSize < 0 ) //bullet size over flow nBulletRelSize = 100; @@ -5127,9 +5127,9 @@ void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aChar // character attributes rIn.ReadUInt32( nMask ); - if ( (sal_uInt16)nMask ) + if ( static_cast<sal_uInt16>(nMask) ) { - aSet.mnAttrSet |= (sal_uInt16)nMask; + aSet.mnAttrSet |= static_cast<sal_uInt16>(nMask); rIn.ReadUInt16( aSet.mnFlags ); } if ( nMask & 0x10000 ) // cfTypeface @@ -5238,13 +5238,13 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe if ( !nChar ) break; if ( ( nChar & 0xff00 ) == 0xf000 ) // in this special case we got a symbol - aSpecMarkerList.push_back( (sal_uInt32)( i | PPT_SPEC_SYMBOL ) ); + aSpecMarkerList.push_back( static_cast<sal_uInt32>( i | PPT_SPEC_SYMBOL ) ); else if ( nChar == 0xd ) { if ( nInstance == TSS_Type::PageTitle ) *pPtr = 0xb; else - aSpecMarkerList.push_back( (sal_uInt32)( i | PPT_SPEC_NEWLINE ) ); + aSpecMarkerList.push_back( static_cast<sal_uInt32>( i | PPT_SPEC_NEWLINE ) ); } } if ( i ) @@ -5266,7 +5266,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe if ( nInstance == TSS_Type::PageTitle ) *pPtr = 0xb; else - aSpecMarkerList.push_back( (sal_uInt32)( (pPtr - pBuf.get()) | PPT_SPEC_NEWLINE ) ); + aSpecMarkerList.push_back( static_cast<sal_uInt32>( (pPtr - pBuf.get()) | PPT_SPEC_NEWLINE ) ); } pPtr++; } @@ -5788,7 +5788,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T if ( nVal ) { - nEsc = (sal_Int16)nVal; + nEsc = static_cast<sal_Int16>(nVal); nProp = DFLT_ESC_PROP; } SvxEscapementItem aItem( nEsc, nProp, EE_CHAR_ESCAPEMENT ); @@ -5897,7 +5897,7 @@ void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const { nFontHeight = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[sanitizeForMaxPPTLevels(mxParaSet->mnDepth)].mnFontHeight; } - nBulletRelSize = nFontHeight ? ((-((sal_Int16)nBulletRelSize)) * 100 ) / nFontHeight : 100; + nBulletRelSize = nFontHeight ? ((- static_cast<sal_Int16>(nBulletRelSize)) * 100 ) / nFontHeight : 100; } } @@ -5993,7 +5993,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty rRetValue = rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BulletOn ); if ( pParaLevel ) { - if ( rRetValue != ( (sal_uInt32)pParaLevel->mnBuFlags & ( 1 << PPT_ParaAttr_BulletOn ) ) ) + if ( rRetValue != ( static_cast<sal_uInt32>(pParaLevel->mnBuFlags) & ( 1 << PPT_ParaAttr_BulletOn ) ) ) bIsHardAttribute = true; } } @@ -6137,21 +6137,21 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty case PPT_ParaAttr_AsianLB_1 : { rRetValue = rParaLevel.mnAsianLineBreak & 1; - if ( pParaLevel && ( rRetValue != ( (sal_uInt32)pParaLevel->mnAsianLineBreak & 1 ) ) ) + if ( pParaLevel && ( rRetValue != ( static_cast<sal_uInt32>(pParaLevel->mnAsianLineBreak) & 1 ) ) ) bIsHardAttribute = true; } break; case PPT_ParaAttr_AsianLB_2 : { rRetValue = ( rParaLevel.mnAsianLineBreak >> 1 ) & 1; - if ( pParaLevel && ( rRetValue != ( ( (sal_uInt32)pParaLevel->mnAsianLineBreak >> 1 ) & 1 ) ) ) + if ( pParaLevel && ( rRetValue != ( ( static_cast<sal_uInt32>(pParaLevel->mnAsianLineBreak) >> 1 ) & 1 ) ) ) bIsHardAttribute = true; } break; case PPT_ParaAttr_AsianLB_3 : { rRetValue = ( rParaLevel.mnAsianLineBreak >> 2 ) & 1; - if ( pParaLevel && ( rRetValue != ( ( (sal_uInt32)pParaLevel->mnAsianLineBreak >> 2 ) & 1 ) ) ) + if ( pParaLevel && ( rRetValue != ( ( static_cast<sal_uInt32>(pParaLevel->mnAsianLineBreak) >> 2 ) & 1 ) ) ) bIsHardAttribute = true; } break; @@ -6225,8 +6225,8 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& if ( !nIsBullet2 ) { SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE ); - sal_uInt16 nAbsLSpace = (sal_uInt16)( ( _nTextOfs * 2540 ) / 576 ); - sal_uInt16 nFirstLineOffset = nAbsLSpace - (sal_uInt16)( ( _nBulletOfs * 2540 ) / 576 ); + sal_uInt16 nAbsLSpace = static_cast<sal_uInt16>( ( _nTextOfs * 2540 ) / 576 ); + sal_uInt16 nFirstLineOffset = nAbsLSpace - static_cast<sal_uInt16>( ( _nBulletOfs * 2540 ) / 576 ); aLRSpaceItem.SetLeft( nAbsLSpace ); aLRSpaceItem.SetTextFirstLineOfstValue( -nFirstLineOffset ); rSet.Put( aLRSpaceItem ); @@ -6258,7 +6258,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& // LineSpacing PPTPortionObj* pPortion = First(); bool bIsHardAttribute = GetAttrib( PPT_ParaAttr_LineFeed, nVal, nDestinationInstance ); - nVal2 = (sal_Int16)nVal; + nVal2 = static_cast<sal_Int16>(nVal); sal_uInt32 nFont = sal_uInt32(); if ( pPortion && pPortion->GetAttrib( PPT_CharAttr_Font, nFont, nDestinationInstance ) ) bIsHardAttribute = true; @@ -6269,19 +6269,19 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& { sal_uInt32 nFontHeight; pPortion->GetAttrib( PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance ); - nVal2 = -(sal_Int16)( ( nFontHeight * nVal * 8 ) / 100 ); + nVal2 = -static_cast<sal_Int16>( ( nFontHeight * nVal * 8 ) / 100 ); } SdrTextFixedCellHeightItem aHeightItem(true); aHeightItem.SetWhich(SDRATTR_TEXT_USEFIXEDCELLHEIGHT); rSet.Put( aHeightItem ); SvxLineSpacingItem aItem( 200, EE_PARA_SBL ); if ( nVal2 <= 0 ) { - aItem.SetLineHeight( (sal_uInt16)( rManager.ScalePoint( -nVal2 ) / 8 ) ); + aItem.SetLineHeight( static_cast<sal_uInt16>( rManager.ScalePoint( -nVal2 ) / 8 ) ); aItem.SetLineSpaceRule( SvxLineSpaceRule::Fix ); aItem.SetInterLineSpaceRule(SvxInterLineSpaceRule::Off); } else { - sal_uInt8 nPropLineSpace = (sal_uInt8)nVal2; + sal_uInt8 nPropLineSpace = static_cast<sal_uInt8>(nVal2); aItem.SetPropLineSpace( nPropLineSpace ); aItem.SetLineSpaceRule( SvxLineSpaceRule::Auto ); } @@ -6289,8 +6289,8 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& } // Paragraph Spacing - bIsHardAttribute = ( (sal_uInt32)GetAttrib( PPT_ParaAttr_UpperDist, nUpperDist, nDestinationInstance ) + - (sal_uInt32)GetAttrib( PPT_ParaAttr_LowerDist, nLowerDist, nDestinationInstance ) ) != 0; + bIsHardAttribute = ( static_cast<sal_uInt32>(GetAttrib( PPT_ParaAttr_UpperDist, nUpperDist, nDestinationInstance )) + + static_cast<sal_uInt32>(GetAttrib( PPT_ParaAttr_LowerDist, nLowerDist, nDestinationInstance )) ) != 0; if ( ( nUpperDist > 0 ) || ( nLowerDist > 0 ) ) { if (!m_PortionList.empty()) @@ -6298,31 +6298,31 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& sal_uInt32 nFontHeight = 0; m_PortionList.back()->GetAttrib( PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance); - if ( ((sal_Int16)nUpperDist) > 0 ) - nUpperDist = - (sal_Int16)( ( nFontHeight * nUpperDist * 100 ) / 1000 ); - if ( ((sal_Int16)nLowerDist) > 0 ) - nLowerDist = - (sal_Int16)( ( nFontHeight * nLowerDist * 100 ) / 1000 ); + if ( static_cast<sal_Int16>(nUpperDist) > 0 ) + nUpperDist = - static_cast<sal_Int16>( ( nFontHeight * nUpperDist * 100 ) / 1000 ); + if ( static_cast<sal_Int16>(nLowerDist) > 0 ) + nLowerDist = - static_cast<sal_Int16>( ( nFontHeight * nLowerDist * 100 ) / 1000 ); } bIsHardAttribute = true; } if ( bIsHardAttribute ) { SvxULSpaceItem aULSpaceItem( EE_PARA_ULSPACE ); - nVal2 = (sal_Int16)nUpperDist; + nVal2 = static_cast<sal_Int16>(nUpperDist); if ( nVal2 <= 0 ) - aULSpaceItem.SetUpper( (sal_uInt16)(((sal_uInt32) - nVal2 * 2540 ) / ( 72 * 8 ) ) ); + aULSpaceItem.SetUpper( static_cast<sal_uInt16>((static_cast<sal_uInt32>(- nVal2) * 2540 ) / ( 72 * 8 ) ) ); else { aULSpaceItem.SetUpperValue( 0 ); - aULSpaceItem.SetPropUpper( (sal_uInt16)nUpperDist == 100 ? 101 : (sal_uInt16)nUpperDist ); + aULSpaceItem.SetPropUpper( static_cast<sal_uInt16>(nUpperDist) == 100 ? 101 : static_cast<sal_uInt16>(nUpperDist) ); } - nVal2 = (sal_Int16)nLowerDist; + nVal2 = static_cast<sal_Int16>(nLowerDist); if ( nVal2 <= 0 ) - aULSpaceItem.SetLower( (sal_uInt16)(((sal_uInt32) - nVal2 * 2540 ) / ( 72 * 8 ) ) ); + aULSpaceItem.SetLower( static_cast<sal_uInt16>((static_cast<sal_uInt32>(- nVal2) * 2540 ) / ( 72 * 8 ) ) ); else { aULSpaceItem.SetLowerValue( 0 ); - aULSpaceItem.SetPropLower( (sal_uInt16)nLowerDist == 100 ? 101 : (sal_uInt16)nLowerDist ); + aULSpaceItem.SetPropLower( static_cast<sal_uInt16>(nLowerDist) == 100 ? 101 : static_cast<sal_uInt16>(nLowerDist) ); } rSet.Put( aULSpaceItem ); } @@ -6343,8 +6343,8 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& for ( i = 0; i < GetTabCount(); i++ ) { SvxTabAdjust eTabAdjust; - nTab = GetTabOffsetByIndex( (sal_uInt16)i ); - switch( GetTabStyleByIndex( (sal_uInt16)i ) ) + nTab = GetTabOffsetByIndex( static_cast<sal_uInt16>(i) ); + switch( GetTabStyleByIndex( static_cast<sal_uInt16>(i) ) ) { case 1 : eTabAdjust = SvxTabAdjust::Center; break; case 2 : eTabAdjust = SvxTabAdjust::Right; break; @@ -6357,7 +6357,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& nLatestManTab = nTab; } if ( nIsBullet2 == 0 ) - aTabItem.Insert( SvxTabStop( (sal_uInt16)0 ) ); + aTabItem.Insert( SvxTabStop( sal_uInt16(0) ) ); if ( nDefaultTab ) { nTab = std::max( nTextOfs2, nLatestManTab ); @@ -6365,7 +6365,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& nTab = nDefaultTab * ( 1 + nTab ); for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ ) { - aTabItem.Insert( SvxTabStop( (sal_uInt16)( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) ); + aTabItem.Insert( SvxTabStop( static_cast<sal_uInt16>( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) ); nTab += nDefaultTab; } } @@ -6889,8 +6889,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport if ( nEndPos ) { xEntry.reset(new PPTFieldEntry); - xEntry->nPos = (sal_uInt16)nStartPos; - xEntry->nTextRangeEnd = (sal_uInt16)nEndPos; + xEntry->nPos = static_cast<sal_uInt16>(nStartPos); + xEntry->nTextRangeEnd = static_cast<sal_uInt16>(nEndPos); OUString aTarget( pHyperlink->aTarget ); if ( !pHyperlink->aConvSubString.isEmpty() ) { @@ -7432,9 +7432,9 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell > const & xCel css::awt::Gradient aGradient; aGradient.Style = aXGradient.GetGradientStyle(); - aGradient.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor(); - aGradient.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor(); - aGradient.Angle = (short)aXGradient.GetAngle(); + aGradient.StartColor = static_cast<sal_Int32>(aXGradient.GetStartColor().GetColor()); + aGradient.EndColor = static_cast<sal_Int32>(aXGradient.GetEndColor().GetColor()); + aGradient.Angle = static_cast<short>(aXGradient.GetAngle()); aGradient.Border = aXGradient.GetBorder(); aGradient.XOffset = aXGradient.GetXOffset(); aGradient.YOffset = aXGradient.GetYOffset(); diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 9cf01a0929a3..86d31971ad75 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -74,15 +74,15 @@ DateTime DTTM2DateTime( long lDTTM ) DateTime aDateTime(Date( 0 ), ::tools::Time( 0 )); if( lDTTM ) { - sal_uInt16 lMin = (sal_uInt16)(lDTTM & 0x0000003F); + sal_uInt16 lMin = static_cast<sal_uInt16>(lDTTM & 0x0000003F); lDTTM >>= 6; - sal_uInt16 lHour= (sal_uInt16)(lDTTM & 0x0000001F); + sal_uInt16 lHour= static_cast<sal_uInt16>(lDTTM & 0x0000001F); lDTTM >>= 5; - sal_uInt16 lDay = (sal_uInt16)(lDTTM & 0x0000001F); + sal_uInt16 lDay = static_cast<sal_uInt16>(lDTTM & 0x0000001F); lDTTM >>= 5; - sal_uInt16 lMon = (sal_uInt16)(lDTTM & 0x0000000F); + sal_uInt16 lMon = static_cast<sal_uInt16>(lDTTM & 0x0000000F); lDTTM >>= 4; - sal_uInt16 lYear= (sal_uInt16)(lDTTM & 0x000001FF) + 1900; + sal_uInt16 lYear= static_cast<sal_uInt16>(lDTTM & 0x000001FF) + 1900; aDateTime = DateTime(Date(lDay, lMon, lYear), tools::Time(lHour, lMin)); } return aDateTime; diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 88d0e9687d05..b76a73136d5c 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -628,7 +628,7 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent ) mpCbExportFormFields->Check( mbExportFormFieldsUserSelection ); } - mpLbFormsFormat->SelectEntryPos( (sal_uInt16)paParent->mnFormsType ); + mpLbFormsFormat->SelectEntryPos( static_cast<sal_uInt16>(paParent->mnFormsType) ); mpCbAllowDuplicateFieldNames->Check( paParent->mbAllowDuplicateFieldNames ); mpFormsFrame->Enable( paParent->mbExportFormFields ); diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 8cf1df70a757..1187d3391bbf 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -287,7 +287,7 @@ public: SVGFilter::ObjectSet::const_iterator aMasterPageIt = mMasterPageSet.begin(); for( ; aMasterPageIt != mMasterPageSet.end(); ++aMasterPageIt ) { - aTextFieldCharSets[ *aMasterPageIt ][ sFieldId ].insert( (sal_Unicode)( format ) ); + aTextFieldCharSets[ *aMasterPageIt ][ sFieldId ].insert( static_cast<sal_Unicode>( format ) ); } } }; @@ -1236,7 +1236,7 @@ void SVGFilter::implEmbedBulletGlyphs() void SVGFilter::implEmbedBulletGlyph( sal_Unicode cBullet, const OUString & sPathData ) { - OUString sId = "bullet-char-template-" + OUString::number( (sal_Int32)cBullet ); + OUString sId = "bullet-char-template-" + OUString::number( static_cast<sal_Int32>(cBullet) ); mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sId ); OUString sFactor = OUString::number( 1.0 / 2048 ); @@ -2172,7 +2172,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void ) // we look for the most verbose date format for( ; aChar != aCharSet.end(); ++aChar ) { - eCurDateFormat = (SvxDateFormat)( (int)( *aChar ) & 0x0f ); + eCurDateFormat = (SvxDateFormat)( static_cast<int>( *aChar ) & 0x0f ); switch( eDateFormat ) { case SvxDateFormat::StdSmall: diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 732c650c460a..d6022b1747f5 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -215,13 +215,13 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const tools::Rectangle aRect( aPoly.GetBoundRect() ); // adjust start/end colors with intensities - aStartColor.SetRed( (sal_uInt8)( ( aStartColor.GetRed() * rGradient.GetStartIntensity() ) / 100 ) ); - aStartColor.SetGreen( (sal_uInt8)( ( aStartColor.GetGreen() * rGradient.GetStartIntensity() ) / 100 ) ); - aStartColor.SetBlue( (sal_uInt8)( ( aStartColor.GetBlue() * rGradient.GetStartIntensity() ) / 100 ) ); + aStartColor.SetRed( static_cast<sal_uInt8>( ( aStartColor.GetRed() * rGradient.GetStartIntensity() ) / 100 ) ); + aStartColor.SetGreen( static_cast<sal_uInt8>( ( aStartColor.GetGreen() * rGradient.GetStartIntensity() ) / 100 ) ); + aStartColor.SetBlue( static_cast<sal_uInt8>( ( aStartColor.GetBlue() * rGradient.GetStartIntensity() ) / 100 ) ); - aEndColor.SetRed( (sal_uInt8)( ( aEndColor.GetRed() * rGradient.GetEndIntensity() ) / 100 ) ); - aEndColor.SetGreen( (sal_uInt8)( ( aEndColor.GetGreen() * rGradient.GetEndIntensity() ) / 100 ) ); - aEndColor.SetBlue( (sal_uInt8)( ( aEndColor.GetBlue() * rGradient.GetEndIntensity() ) / 100 ) ); + aEndColor.SetRed( static_cast<sal_uInt8>( ( aEndColor.GetRed() * rGradient.GetEndIntensity() ) / 100 ) ); + aEndColor.SetGreen( static_cast<sal_uInt8>( ( aEndColor.GetGreen() * rGradient.GetEndIntensity() ) / 100 ) ); + aEndColor.SetBlue( static_cast<sal_uInt8>( ( aEndColor.GetBlue() * rGradient.GetEndIntensity() ) / 100 ) ); mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, ( rGradientId = "Gradient_" ) += OUString::number( nCurGradientId++ ) ); @@ -1031,7 +1031,7 @@ bool SVGTextWriter::nextParagraph() } mcBulletChar = cBullet; #if OSL_DEBUG_LEVEL > 0 - sInfo = OUString::number( (sal_Int32) cBullet ); + sInfo = OUString::number( static_cast<sal_Int32>(cBullet) ); mrExport.AddAttribute( XML_NAMESPACE_NONE, "bullet-char", sInfo ); #endif } @@ -1806,7 +1806,7 @@ OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bo for( long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ ) { - const tools::Polygon& rPoly = rPolyPoly[ (sal_uInt16) i ]; + const tools::Polygon& rPoly = rPolyPoly[ static_cast<sal_uInt16>(i) ]; sal_uInt16 n = 1, nSize = rPoly.GetSize(); if( nSize > 1 ) @@ -2276,11 +2276,11 @@ void SVGActionWriter::ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPo // Emulate non-smooth gradient if( 0 < nSteps && nSteps < 100 ) { - double fOffsetStep = ( 1.0 - fBorderOffset ) / (double)nSteps; + double fOffsetStep = ( 1.0 - fBorderOffset ) / static_cast<double>(nSteps); for( sal_uInt16 i = 0; i < nSteps; i++ ) { - Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / (double) nSteps ); + Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / static_cast<double>(nSteps) ); ImplWriteGradientStop( aColor, fBorderOffset + ( i + 1 ) * fOffsetStep ); - aColor = ImplGetGradientColor( aStartColor, aEndColor, ( i + 1 ) / (double) nSteps ); + aColor = ImplGetGradientColor( aStartColor, aEndColor, ( i + 1 ) / static_cast<double>(nSteps) ); ImplWriteGradientStop( aColor, fBorderOffset + ( i + 1 ) * fOffsetStep ); } } @@ -2296,21 +2296,21 @@ void SVGActionWriter::ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPo // Emulate non-smooth gradient if( 0 < nSteps && nSteps < 100 ) { - double fOffsetStep = ( 0.5 - fBorderOffset ) / (double)nSteps; + double fOffsetStep = ( 0.5 - fBorderOffset ) / static_cast<double>(nSteps); // Upper half for( sal_uInt16 i = 0; i < nSteps; i++ ) { - Color aColor = ImplGetGradientColor( aEndColor, aStartColor, i / (double) nSteps ); + Color aColor = ImplGetGradientColor( aEndColor, aStartColor, i / static_cast<double>(nSteps) ); ImplWriteGradientStop( aColor, fBorderOffset + i * fOffsetStep ); - aColor = ImplGetGradientColor( aEndColor, aStartColor, (i + 1 ) / (double) nSteps ); + aColor = ImplGetGradientColor( aEndColor, aStartColor, (i + 1 ) / static_cast<double>(nSteps) ); ImplWriteGradientStop( aColor, fBorderOffset + i * fOffsetStep ); } // Lower half for( sal_uInt16 i = 0; i < nSteps; i++ ) { - Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / (double) nSteps ); + Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / static_cast<double>(nSteps) ); ImplWriteGradientStop( aColor, 0.5 + (i + 1) * fOffsetStep ); - aColor = ImplGetGradientColor( aStartColor, aEndColor, (i + 1 ) / (double) nSteps ); + aColor = ImplGetGradientColor( aStartColor, aEndColor, (i + 1 ) / static_cast<double>(nSteps) ); ImplWriteGradientStop( aColor, 0.5 + (i + 1) * fOffsetStep ); } } @@ -2351,9 +2351,9 @@ void SVGActionWriter::ImplWriteGradientStop( const Color& rColor, double fOffset Color SVGActionWriter::ImplGetColorWithIntensity( const Color& rColor, sal_uInt16 nIntensity ) { - sal_uInt8 nNewRed = (sal_uInt8)( (long)rColor.GetRed() * nIntensity / 100L ); - sal_uInt8 nNewGreen = (sal_uInt8)( (long)rColor.GetGreen() * nIntensity / 100L ); - sal_uInt8 nNewBlue = (sal_uInt8)( (long)rColor.GetBlue() * nIntensity / 100L ); + sal_uInt8 nNewRed = static_cast<sal_uInt8>( static_cast<long>(rColor.GetRed()) * nIntensity / 100L ); + sal_uInt8 nNewGreen = static_cast<sal_uInt8>( static_cast<long>(rColor.GetGreen()) * nIntensity / 100L ); + sal_uInt8 nNewBlue = static_cast<sal_uInt8>( static_cast<long>(rColor.GetBlue()) * nIntensity / 100L ); return Color( nNewRed, nNewGreen, nNewBlue); } @@ -2363,18 +2363,18 @@ Color SVGActionWriter::ImplGetGradientColor( const Color& rStartColor, double fOffset ) { long nRedStep = rEndColor.GetRed() - rStartColor.GetRed(); - long nNewRed = rStartColor.GetRed() + (long)( nRedStep * fOffset ); + long nNewRed = rStartColor.GetRed() + static_cast<long>( nRedStep * fOffset ); nNewRed = ( nNewRed < 0 ) ? 0 : ( nNewRed > 0xFF) ? 0xFF : nNewRed; long nGreenStep = rEndColor.GetGreen() - rStartColor.GetGreen(); - long nNewGreen = rStartColor.GetGreen() + (long)( nGreenStep * fOffset ); + long nNewGreen = rStartColor.GetGreen() + static_cast<long>( nGreenStep * fOffset ); nNewGreen = ( nNewGreen < 0 ) ? 0 : ( nNewGreen > 0xFF) ? 0xFF : nNewGreen; long nBlueStep = rEndColor.GetBlue() - rStartColor.GetBlue(); - long nNewBlue = rStartColor.GetBlue() + (long)( nBlueStep * fOffset ); + long nNewBlue = rStartColor.GetBlue() + static_cast<long>( nBlueStep * fOffset ); nNewBlue = ( nNewBlue < 0 ) ? 0 : ( nNewBlue > 0xFF) ? 0xFF : nNewBlue; - return Color( (sal_uInt8)nNewRed, (sal_uInt8)nNewGreen, (sal_uInt8)nNewBlue ); + return Color( static_cast<sal_uInt8>(nNewRed), static_cast<sal_uInt8>(nNewGreen), static_cast<sal_uInt8>(nNewBlue) ); } @@ -2386,8 +2386,8 @@ void SVGActionWriter::ImplWriteMask( GDIMetaFile& rMtf, { Point aSrcPt( rMtf.GetPrefMapMode().GetOrigin() ); const Size aSrcSize( rMtf.GetPrefSize() ); - const double fScaleX = aSrcSize.Width() ? (double) rDestSize.Width() / aSrcSize.Width() : 1.0; - const double fScaleY = aSrcSize.Height() ? (double) rDestSize.Height() / aSrcSize.Height() : 1.0; + const double fScaleX = aSrcSize.Width() ? static_cast<double>(rDestSize.Width()) / aSrcSize.Width() : 1.0; + const double fScaleY = aSrcSize.Height() ? static_cast<double>(rDestSize.Height()) / aSrcSize.Height() : 1.0; long nMoveX, nMoveY; if( fScaleX != 1.0 || fScaleY != 1.0 ) @@ -2612,7 +2612,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) ) { long i; - const double fFactor = (double) nWidth / aNormSize.Width(); + const double fFactor = static_cast<double>(nWidth) / aNormSize.Width(); for( i = 0; i < ( nLen - 1 ); i++ ) pDX[ i ] = FRound( pDX[ i ] * fFactor ); @@ -2808,7 +2808,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, sal_uInt8 const*const pData = pA->GetData(); if (pData && (pA->GetDataSize())) { - sal_uInt16 sz = (sal_uInt16)((pA->GetDataSize()) / 2); + sal_uInt16 sz = static_cast<sal_uInt16>((pA->GetDataSize()) / 2); if (sz) { sType.append("; "); @@ -3142,7 +3142,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, mapCurShape->maShapePolyPoly = aShapePolyPoly; mapCurShape->maShapeFillColor = aFill.getFillColor(); - mapCurShape->maShapeFillColor.SetTransparency( (sal_uInt8) FRound( 255.0 * aFill.getTransparency() ) ); + mapCurShape->maShapeFillColor.SetTransparency( static_cast<sal_uInt8>(FRound( 255.0 * aFill.getTransparency() )) ); if( bGradient ) { @@ -3231,7 +3231,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, } mapCurShape->maShapeLineColor = mpVDev->GetLineColor(); - mapCurShape->maShapeLineColor.SetTransparency( (sal_uInt8) FRound( aStroke.getTransparency() * 255.0 ) ); + mapCurShape->maShapeLineColor.SetTransparency( static_cast<sal_uInt8>(FRound( aStroke.getTransparency() * 255.0 )) ); mapCurShape->mnStrokeWidth = FRound( aStroke.getStrokeWidth() ); aStroke.getDashArray( mapCurShape->maDashArray ); diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index 2ed3b960f413..163097a99d02 100644 --- a/filter/source/t602/t602filter.cxx +++ b/filter/source/t602/t602filter.cxx @@ -612,7 +612,7 @@ sal_Int16 T602ImportFilter::readnum(unsigned char *ch, bool show) buff[i]='\0'; // mba: cast from unsigned char via int to sal_Int16 seems to be safe - return (sal_Int16) atoi(reinterpret_cast<char const *>(buff)); + return static_cast<sal_Int16>(atoi(reinterpret_cast<char const *>(buff))); } unsigned char T602ImportFilter::Setformat602(const char *cmd) @@ -658,14 +658,14 @@ tnode T602ImportFilter::PointCmd602(unsigned char *ch) char pcmd[2]; // warning: uChar -> char - pcmd[0] = (char) rtl::toAsciiUpperCase(*ch); inschr(*ch); + pcmd[0] = static_cast<char>(rtl::toAsciiUpperCase(*ch)); inschr(*ch); *ch = Readchar602(); if (!*ch) return tnode::EEND; if (*ch=='\n') return tnode::EOL; if (!rtl::isAsciiAlpha(*ch)) return (*ch<32) ? tnode::SETCH : tnode::WRITE; // warning: uChar -> char - pcmd[1] = (char) rtl::toAsciiUpperCase(*ch); inschr(*ch); + pcmd[1] = static_cast<char>(rtl::toAsciiUpperCase(*ch)); inschr(*ch); if (pcmd[0]=='P' && pcmd[1]=='A') { if (pst.pars) pst.willbeeop = true; } else if (pcmd[0]=='C' && pcmd[1]=='P') { if (pst.pars) pst.willbeeop = true; } @@ -988,7 +988,7 @@ bool T602ImportFilterDialog::OptionsDlg() xPSetCodeLB->setPropertyValue("StringItemList", any); Sequence < sal_Int16 > shr(1); - shr[0] = ini.forcecode ? ((sal_Int16) ini.xcode) + 1 : 0; + shr[0] = ini.forcecode ? static_cast<sal_Int16>(ini.xcode) + 1 : 0; any <<= shr; xPSetCodeLB->setPropertyValue("SelectedItems", any); diff --git a/filter/source/xsltfilter/OleHandler.cxx b/filter/source/xsltfilter/OleHandler.cxx index afb7eb0f6009..799465f0ca1b 100644 --- a/filter/source/xsltfilter/OleHandler.cxx +++ b/filter/source/xsltfilter/OleHandler.cxx @@ -167,7 +167,7 @@ namespace XSLT { //get the length and seek to 0 Reference<XSeekable> xSeek (m_rootStream, UNO_QUERY); - int oleLength = (int) xSeek->getLength(); + int oleLength = static_cast<int>(xSeek->getLength()); xSeek->seek(0); //read all bytes Reference<XInputStream> xInput = m_rootStream->getInputStream(); @@ -194,15 +194,15 @@ namespace XSLT Reference<XOutputStream> xOutput = subStream->getOutputStream(); //write the length to the temp stream Sequence<sal_Int8> header(4); - header[0] = (sal_Int8) (oledata.getLength() >> 0) & 0xFF; - header[1] = (sal_Int8) (oledata.getLength() >> 8) & 0xFF; - header[2] = (sal_Int8) (oledata.getLength() >> 16) & 0xFF; - header[3] = (sal_Int8) (oledata.getLength() >> 24) & 0xFF; + header[0] = static_cast<sal_Int8>(oledata.getLength() >> 0) & 0xFF; + header[1] = static_cast<sal_Int8>(oledata.getLength() >> 8) & 0xFF; + header[2] = static_cast<sal_Int8>(oledata.getLength() >> 16) & 0xFF; + header[3] = static_cast<sal_Int8>(oledata.getLength() >> 24) & 0xFF; xOutput->writeBytes(header); // Compress the bytes Sequence<sal_Int8> output(oledata.getLength()); - std::unique_ptr< ::ZipUtils::Deflater> compresser(new ::ZipUtils::Deflater((sal_Int32) 3, false)); + std::unique_ptr< ::ZipUtils::Deflater> compresser(new ::ZipUtils::Deflater(sal_Int32(3), false)); compresser->setInputSegment(oledata); compresser->finish(); int compressedDataLength = compresser->doDeflateSegment(output, 0, oledata.getLength()); |