chart2/source/controller/main/ChartController_Tools.cxx | 6 - chart2/source/controller/main/ChartTransferable.cxx | 2 include/vcl/transfer.hxx | 8 +- sc/source/ui/app/drwtrans.cxx | 2 sc/source/ui/app/transobj.cxx | 2 sc/source/ui/view/viewfun3.cxx | 6 - sc/source/ui/view/viewfun5.cxx | 6 - sd/source/ui/app/sdxfer.cxx | 2 sd/source/ui/view/sdview3.cxx | 18 ++--- svtools/source/misc/embedtransfer.cxx | 2 svx/source/gallery2/galmisc.cxx | 2 sw/source/uibase/dochdl/swdtflvr.cxx | 2 vcl/source/treelist/transfer.cxx | 56 ++++++++-------- 13 files changed, 57 insertions(+), 57 deletions(-)
New commits: commit 9752d351889666714f08e1971c644f0ecd09a2d4 Author: Noel Grandin <[email protected]> AuthorDate: Sat Aug 9 16:08:22 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Aug 9 19:12:48 2025 +0200 BitmapEx->Bitmap in TransferableHelper now that Bitmap supports transparency Change-Id: Iaff3f0405cccac4c23ad8f263afe31d6e49597c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189261 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 0539106c18d8..093fb6f61be9 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -575,9 +575,9 @@ void ChartController::executeDispatch_Paste() else if( aDataHelper.HasFormat( SotClipboardFormatId::BITMAP )) { // bitmap (non-graphic-manager) - BitmapEx aBmpEx; - if( aDataHelper.GetBitmapEx( SotClipboardFormatId::BITMAP, aBmpEx )) - aGraphic = Graphic( aBmpEx ); + Bitmap aBmp; + if( aDataHelper.GetBitmapEx( SotClipboardFormatId::BITMAP, aBmp )) + aGraphic = Graphic( aBmp ); } else if( aDataHelper.HasFormat( SotClipboardFormatId::STRING )) { diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx index 7c8eb12041f6..5fbf1812be92 100644 --- a/chart2/source/controller/main/ChartTransferable.cxx +++ b/chart2/source/controller/main/ChartTransferable.cxx @@ -98,7 +98,7 @@ bool ChartTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, c else if( nFormat == SotClipboardFormatId::BITMAP ) { Graphic aGraphic( m_xMetaFileGraphic ); - bResult = SetBitmapEx( aGraphic.GetBitmapEx(), rFlavor ); + bResult = SetBitmapEx( Bitmap(aGraphic.GetBitmapEx()), rFlavor ); } } diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx index 4af956e60418..7e4ed34c8fd6 100644 --- a/include/vcl/transfer.hxx +++ b/include/vcl/transfer.hxx @@ -50,7 +50,7 @@ namespace com::sun::star::datatransfer::dnd { class XDropTarget; } template <typename Arg, typename Ret> class Link; -class BitmapEx; +class Bitmap; class GDIMetaFile; class Graphic; class ImageMap; @@ -231,7 +231,7 @@ protected: bool SetAny( const css::uno::Any& rAny ); bool SetString( const OUString& rString ); - bool SetBitmapEx( const BitmapEx& rBitmap, const css::datatransfer::DataFlavor& rFlavor ); + bool SetBitmapEx( const Bitmap& rBitmap, const css::datatransfer::DataFlavor& rFlavor ); bool SetGDIMetaFile( const GDIMetaFile& rMtf ); bool SetGraphic( const Graphic& rGraphic ); bool SetImageMap( const ImageMap& rIMap ); @@ -314,8 +314,8 @@ public: bool GetString( SotClipboardFormatId nFormat, OUString& rStr ) const; bool GetString( const css::datatransfer::DataFlavor& rFlavor, OUString& rStr ) const; - bool GetBitmapEx( SotClipboardFormatId nFormat, BitmapEx& rBmp ) const; - bool GetBitmapEx( const css::datatransfer::DataFlavor& rFlavor, BitmapEx& rBmp ) const; + bool GetBitmapEx( SotClipboardFormatId nFormat, Bitmap& rBmp ) const; + bool GetBitmapEx( const css::datatransfer::DataFlavor& rFlavor, Bitmap& rBmp ) const; /** Return as GDI metafile. diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 2d39a545eb33..18f90407e3b4 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -375,7 +375,7 @@ bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, c if ( nFormat == SotClipboardFormatId::GDIMETAFILE ) bOK = SetGDIMetaFile( aView.GetMarkedObjMetaFile(true) ); else - bOK = SetBitmapEx( BitmapEx(aView.GetMarkedObjBitmap(true)), rFlavor ); + bOK = SetBitmapEx( aView.GetMarkedObjBitmap(true), rFlavor ); } else if ( nFormat == SotClipboardFormatId::SVXB ) { diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 001979e2f569..10fff1a47b04 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -438,7 +438,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt PaintToDev( pVirtDev, *m_aDocShellRef, 1.0, aReducedBlock ); pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel, Point(), aScale, aScale ) ); - BitmapEx aBmp( pVirtDev->GetBitmap( Point(), pVirtDev->GetOutputSize() ) ); + Bitmap aBmp( pVirtDev->GetBitmap( Point(), pVirtDev->GetOutputSize() ) ); bOK = SetBitmapEx( aBmp, rFlavor ); } else if ( nFormat == SotClipboardFormatId::GDIMETAFILE ) diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 3bbe4b4ff92d..33153652fb04 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -816,14 +816,14 @@ bool ScViewFunc::PasteOnDrawObjectLinked( } else if ( aDataHelper.HasFormat( SotClipboardFormatId::BITMAP ) || aDataHelper.HasFormat( SotClipboardFormatId::PNG ) ) { - BitmapEx aBmpEx; + Bitmap aBmp; ScDrawView* pScDrawView = GetScDrawView(); - if( pScDrawView && aDataHelper.GetBitmapEx( SotClipboardFormatId::BITMAP, aBmpEx ) ) + if( pScDrawView && aDataHelper.GetBitmapEx( SotClipboardFormatId::BITMAP, aBmp ) ) { const OUString aBeginUndo(ScResId(STR_UNDO_DRAGDROP)); - if(pScDrawView->ApplyGraphicToObject( rHitObj, Graphic(aBmpEx), aBeginUndo, u""_ustr )) + if(pScDrawView->ApplyGraphicToObject( rHitObj, Graphic(aBmp), aBeginUndo, u""_ustr )) { return true; } diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index eec948c0f44e..9599833e00e0 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -221,9 +221,9 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, } else if (nFormatId == SotClipboardFormatId::BITMAP || nFormatId == SotClipboardFormatId::PNG || nFormatId == SotClipboardFormatId::JPEG) { - BitmapEx aBmpEx; - if( aDataHelper.GetBitmapEx( SotClipboardFormatId::BITMAP, aBmpEx ) ) - bRet = PasteBitmapEx( aPos, aBmpEx ); + Bitmap aBmp; + if( aDataHelper.GetBitmapEx( SotClipboardFormatId::BITMAP, aBmp ) ) + bRet = PasteBitmapEx( aPos, BitmapEx(aBmp) ); } else if (nFormatId == SotClipboardFormatId::GDIMETAFILE) { diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index af2386b8b6c5..8f9b879d3b2e 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -508,7 +508,7 @@ bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo const bool bToggleOnlineSpell = mpSdDrawDocumentIntern && mpSdDrawDocumentIntern->GetOnlineSpell(); if (bToggleOnlineSpell) mpSdDrawDocumentIntern->SetOnlineSpell(false); - bOK = SetBitmapEx( BitmapEx(mpSdViewIntern->GetMarkedObjBitmap(true)), rFlavor ); + bOK = SetBitmapEx( mpSdViewIntern->GetMarkedObjBitmap(true), rFlavor ); if (bToggleOnlineSpell) mpSdDrawDocumentIntern->SetOnlineSpell(true); } diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 7d783f2520cf..3ff7ec5c85df 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -1315,31 +1315,31 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if ((!bLink || pPickObj) && ShouldTry(SotClipboardFormatId::BITMAP)) { - BitmapEx aBmpEx; + Bitmap aBmp; // get basic Bitmap data - rDataHelper.GetBitmapEx(SotClipboardFormatId::BITMAP, aBmpEx); + rDataHelper.GetBitmapEx(SotClipboardFormatId::BITMAP, aBmp); - if(aBmpEx.IsEmpty()) + if(aBmp.IsEmpty()) { // if this did not work, try to get graphic formats and convert these to bitmap Graphic aGraphic; if (rDataHelper.GetGraphic(SotClipboardFormatId::GDIMETAFILE, aGraphic)) { - aBmpEx = aGraphic.GetBitmapEx(); + aBmp = Bitmap(aGraphic.GetBitmapEx()); } else if (rDataHelper.GetGraphic(SotClipboardFormatId::SVXB, aGraphic)) { - aBmpEx = aGraphic.GetBitmapEx(); + aBmp = Bitmap(aGraphic.GetBitmapEx()); } else if (rDataHelper.GetGraphic(SotClipboardFormatId::BITMAP, aGraphic)) { - aBmpEx = aGraphic.GetBitmapEx(); + aBmp = Bitmap(aGraphic.GetBitmapEx()); } } - if(!aBmpEx.IsEmpty()) + if(!aBmp.IsEmpty()) { Point aInsertPos( rPos ); @@ -1360,10 +1360,10 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, } // restrict movement to WorkArea - Size aImageMapSize(aBmpEx.GetPrefSize()); + Size aImageMapSize(aBmp.GetPrefSize()); ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea()); - InsertGraphic( aBmpEx, mnAction, aInsertPos, nullptr, pImageMap.get() ); + InsertGraphic( aBmp, mnAction, aInsertPos, nullptr, pImageMap.get() ); return true; } } diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index 233a1000c297..9f018bbc8d99 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -167,7 +167,7 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo } else if ( ( nFormat == SotClipboardFormatId::BITMAP || nFormat == SotClipboardFormatId::PNG ) && m_oGraphic ) { - bRet = SetBitmapEx( m_oGraphic->GetBitmapEx(), rFlavor ); + bRet = SetBitmapEx( Bitmap(m_oGraphic->GetBitmapEx()), rFlavor ); } else if ( m_xObj.is() && ::svt::EmbeddedObjectRef::TryRunningState( m_xObj ) ) { diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index cda1c9af2c71..4cf8d235806a 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -492,7 +492,7 @@ bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor, cons else if( ( SotClipboardFormatId::BITMAP == nFormat || SotClipboardFormatId::PNG == nFormat) && mpGraphicObject ) { - bRet = SetBitmapEx( mpGraphicObject->GetGraphic().GetBitmapEx(), rFlavor ); + bRet = SetBitmapEx( Bitmap(mpGraphicObject->GetGraphic().GetBitmapEx()), rFlavor ); } return bRet; diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 39a71f31eb21..2c364c7ecb17 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -661,7 +661,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo case SotClipboardFormatId::PNG: // Neither pClpBitmap nor pClpGraphic are necessarily set if( (m_eBufferType & TransferBufferType::Graphic) && (m_oClpBitmap || m_oClpGraphic)) - bOK = SetBitmapEx( (m_oClpBitmap ? m_oClpBitmap : m_oClpGraphic)->GetBitmapEx(), rFlavor ); + bOK = SetBitmapEx( Bitmap((m_oClpBitmap ? m_oClpBitmap : m_oClpGraphic)->GetBitmapEx()), rFlavor ); break; case SotClipboardFormatId::SVIM: diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index c02359312140..bc36fa8ba7a8 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -709,9 +709,9 @@ bool TransferableHelper::SetString( const OUString& rString ) } -bool TransferableHelper::SetBitmapEx( const BitmapEx& rBitmapEx, const DataFlavor& rFlavor ) +bool TransferableHelper::SetBitmapEx( const Bitmap& rBitmap, const DataFlavor& rFlavor ) { - if( !rBitmapEx.IsEmpty() ) + if( !rBitmap.IsEmpty() ) { SvMemoryStream aMemStm( 65535, 65535 ); @@ -736,12 +736,12 @@ bool TransferableHelper::SetBitmapEx( const BitmapEx& rBitmapEx, const DataFlavo #endif vcl::PngImageWriter aPNGWriter(aMemStm); aPNGWriter.setParameters(aFilterData); - aPNGWriter.write(rBitmapEx); + aPNGWriter.write(rBitmap); } else { // explicitly use Bitmap::Write with bCompressed = sal_False and bFileHeader = sal_True - WriteDIB(rBitmapEx.GetBitmap(), aMemStm, false, true); + WriteDIB(rBitmap, aMemStm, false, true); } maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.TellEnd() ); @@ -1522,7 +1522,7 @@ bool TransferableDataHelper::GetString( const DataFlavor& rFlavor, OUString& rSt } -bool TransferableDataHelper::GetBitmapEx( SotClipboardFormatId nFormat, BitmapEx& rBmpEx ) const +bool TransferableDataHelper::GetBitmapEx( SotClipboardFormatId nFormat, Bitmap& rBmp ) const { if(SotClipboardFormatId::BITMAP == nFormat) { @@ -1531,7 +1531,7 @@ bool TransferableDataHelper::GetBitmapEx( SotClipboardFormatId nFormat, BitmapEx if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aFlavor)) { - if(GetBitmapEx(aFlavor, rBmpEx)) + if(GetBitmapEx(aFlavor, rBmp)) { return true; } @@ -1540,7 +1540,7 @@ bool TransferableDataHelper::GetBitmapEx( SotClipboardFormatId nFormat, BitmapEx // then JPEG if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::JPEG, aFlavor)) { - if(GetBitmapEx(aFlavor, rBmpEx)) + if(GetBitmapEx(aFlavor, rBmp)) { return true; } @@ -1548,11 +1548,11 @@ bool TransferableDataHelper::GetBitmapEx( SotClipboardFormatId nFormat, BitmapEx } DataFlavor aFlavor; - return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetBitmapEx( aFlavor, rBmpEx ) ); + return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetBitmapEx( aFlavor, rBmp ) ); } -bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& rBmpEx ) const +bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, Bitmap& rBmp ) const { std::unique_ptr<SvStream> xStm = GetSotStorageStream(rFlavor); DataFlavor aSubstFlavor; @@ -1590,7 +1590,7 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r { // it's a PNG, import to BitmapEx vcl::PngImageReader aPNGReader(*xStm); - rBmpEx = aPNGReader.read(); + rBmp = aPNGReader.read(); } else if(!bSuppressJPEG && rFlavor.MimeType.equalsIgnoreAsciiCase("image/jpeg")) { @@ -1598,10 +1598,10 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic; if (rFilter.ImportGraphic(aGraphic, u"", *xStm) == ERRCODE_NONE) - rBmpEx = aGraphic.GetBitmapEx(); + rBmp = Bitmap(aGraphic.GetBitmapEx()); } - if(rBmpEx.IsEmpty()) + if(rBmp.IsEmpty()) { Bitmap aBitmap; AlphaMask aMask; @@ -1612,15 +1612,15 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r if(aMask.GetBitmap().IsEmpty()) { - rBmpEx = aBitmap; + rBmp = aBitmap; } else { - rBmpEx = BitmapEx(aBitmap, aMask); + rBmp = Bitmap(BitmapEx(aBitmap, aMask)); } } - bRet = (ERRCODE_NONE == xStm->GetError() && !rBmpEx.IsEmpty()); + bRet = (ERRCODE_NONE == xStm->GetError() && !rBmp.IsEmpty()); /* SJ: #110748# At the moment we are having problems with DDB inserted as DIB. The problem is, that some graphics are inserted much too big because the nXPelsPerMeter @@ -1633,21 +1633,21 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r */ if(bRet) { - const MapMode aMapMode(rBmpEx.GetPrefMapMode()); + const MapMode aMapMode(rBmp.GetPrefMapMode()); if(MapUnit::MapPixel != aMapMode.GetMapUnit()) { - const Size aSize(OutputDevice::LogicToLogic(rBmpEx.GetPrefSize(), aMapMode, MapMode(MapUnit::Map100thMM))); + const Size aSize(OutputDevice::LogicToLogic(rBmp.GetPrefSize(), aMapMode, MapMode(MapUnit::Map100thMM))); // #i122388# This wrongly corrects in the given case; changing from 5000 100th mm to // the described 50 cm (which is 50000 100th mm) if((aSize.Width() > 50000) || (aSize.Height() > 50000)) { - rBmpEx.SetPrefMapMode(MapMode(MapUnit::MapPixel)); + rBmp.SetPrefMapMode(MapMode(MapUnit::MapPixel)); // #i122388# also adapt size by applying the mew MapMode const Size aNewSize(o3tl::convert(aSize, o3tl::Length::mm100, o3tl::Length::pt)); - rBmpEx.SetPrefSize(aNewSize); + rBmp.SetPrefSize(aNewSize); } } } @@ -1741,11 +1741,11 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF TransferableDataHelper::IsEqual(aFlavor, rFlavor)) { // try to get PNG first - BitmapEx aBmpEx; + Bitmap aBmp; - bRet = GetBitmapEx( aFlavor, aBmpEx ); + bRet = GetBitmapEx( aFlavor, aBmp ); if( bRet ) - rGraphic = aBmpEx; + rGraphic = aBmp; } else if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PDF, aFlavor) && TransferableDataHelper::IsEqual(aFlavor, rFlavor)) @@ -1762,20 +1762,20 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF } else if (SotExchange::GetFormatDataFlavor(SotClipboardFormatId::JPEG, aFlavor) && TransferableDataHelper::IsEqual(aFlavor, rFlavor)) { - BitmapEx aBitmapEx; + Bitmap aBitmap; - bRet = GetBitmapEx(aFlavor, aBitmapEx); + bRet = GetBitmapEx(aFlavor, aBitmap); if (bRet) - rGraphic = aBitmapEx; + rGraphic = aBitmap; } else if(SotExchange::GetFormatDataFlavor( SotClipboardFormatId::BITMAP, aFlavor ) && TransferableDataHelper::IsEqual( aFlavor, rFlavor ) ) { - BitmapEx aBmpEx; + Bitmap aBmp; - bRet = GetBitmapEx( aFlavor, aBmpEx ); + bRet = GetBitmapEx( aFlavor, aBmp ); if( bRet ) - rGraphic = aBmpEx; + rGraphic = aBmp; } else if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aFlavor ) && TransferableDataHelper::IsEqual( aFlavor, rFlavor ) )
