use more BitmapEx in sd

Change-Id: I5c24ca437a329b105151adfedcaed0016bdaf771
Reviewed-on: https://gerrit.libreoffice.org/55191
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 50d7955..837ac5a 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -542,7 +542,7 @@ void AnimationWindow::UpdateControl(bool const bDisableCtrls)
                : sd::OUTPUT_DRAWMODE_COLOR );
            pVD->Erase();
            pObject->SingleObjectPainter( *pVD.get() );
            aBmp = BitmapEx( pVD->GetBitmap( aObjRect.TopLeft(), aObjSize ) );
            aBmp = pVD->GetBitmapEx( aObjRect.TopLeft(), aObjSize );
        }

        m_pCtlDisplay->SetBitmapEx(&aBmp);
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx
index b5c6ba0..434d627 100644
--- a/sd/source/ui/docshell/docshel2.cxx
+++ b/sd/source/ui/docshell/docshel2.cxx
@@ -262,7 +262,7 @@ BitmapEx DrawDocShell::GetPagePreviewBitmap(SdPage* pPage)

    pVDev->SetMapMode( MapMode() );

    BitmapEx aPreview( pVDev->GetBitmap( aNullPt, pVDev->GetOutputSizePixel() ) );
    BitmapEx aPreview( pVDev->GetBitmapEx( aNullPt, pVDev->GetOutputSizePixel() ) );

    DBG_ASSERT(!!aPreview, "Preview-Bitmap could not be generated");

diff --git a/sd/source/ui/presenter/PresenterPreviewCache.cxx b/sd/source/ui/presenter/PresenterPreviewCache.cxx
index ea15e28..1c347cc3 100644
--- a/sd/source/ui/presenter/PresenterPreviewCache.cxx
+++ b/sd/source/ui/presenter/PresenterPreviewCache.cxx
@@ -51,7 +51,7 @@ public:
    // CacheContext
    virtual void NotifyPreviewCreation (
        CacheKey aKey,
        const Bitmap& rPreview) override;
        const BitmapEx& rPreview) override;
    virtual bool IsIdle() override;
    virtual bool IsVisible (CacheKey aKey) override;
    virtual const SdrPage* GetPage (CacheKey aKey) override;
@@ -247,7 +247,7 @@ void PresenterPreviewCache::PresenterCacheContext::RemovePreviewCreationNotifyLi

void PresenterPreviewCache::PresenterCacheContext::NotifyPreviewCreation (
    CacheKey aKey,
    const Bitmap&)
    const BitmapEx&)
{
    if ( ! mxSlides.is())
        return;
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
index 03f3d12..78f714a 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
@@ -39,7 +39,7 @@ namespace sd { namespace slidesorter { namespace cache {
class BitmapCache::CacheEntry
{
public:
    CacheEntry(const Bitmap& rBitmap, sal_Int32 nLastAccessTime, bool bIsPrecious);
    CacheEntry(const BitmapEx& rBitmap, sal_Int32 nLastAccessTime, bool bIsPrecious);
    CacheEntry(sal_Int32 nLastAccessTime, bool bIsPrecious);
    inline void Recycle (const CacheEntry& rEntry);
    inline sal_Int32 GetMemorySize() const;
@@ -51,12 +51,12 @@ public:
    sal_Int32 GetAccessTime() const { return mnLastAccessTime; }
    void SetAccessTime (sal_Int32 nAccessTime) { mnLastAccessTime = nAccessTime; }

    const Bitmap& GetPreview() const { return maPreview; }
    inline void SetPreview (const Bitmap& rPreview);
    const BitmapEx& GetPreview() const { return maPreview; }
    inline void SetPreview (const BitmapEx& rPreview);
    bool HasPreview() const;

    const Bitmap& GetMarkedPreview() const { return maMarkedPreview; }
    inline void SetMarkedPreview (const Bitmap& rMarkePreview);
    const BitmapEx& GetMarkedPreview() const { return maMarkedPreview; }
    inline void SetMarkedPreview (const BitmapEx& rMarkePreview);

    bool HasReplacement() const { return (mpReplacement.get() != nullptr); }
    inline bool HasLosslessReplacement() const;
@@ -65,8 +65,8 @@ public:
    void SetPrecious (bool bIsPrecious) { mbIsPrecious = bIsPrecious; }

private:
    Bitmap maPreview;
    Bitmap maMarkedPreview;
    BitmapEx maPreview;
    BitmapEx maMarkedPreview;
    std::shared_ptr<BitmapReplacement> mpReplacement;
    std::shared_ptr<BitmapCompressor> mpCompressor;
    bool mbIsUpToDate;
@@ -167,7 +167,7 @@ bool BitmapCache::BitmapIsUpToDate (const CacheKey& rKey)
    return bIsUpToDate;
}

Bitmap BitmapCache::GetBitmap (const CacheKey& rKey)
BitmapEx BitmapCache::GetBitmap (const CacheKey& rKey)
{
    ::osl::MutexGuard aGuard (maMutex);

@@ -176,7 +176,7 @@ Bitmap BitmapCache::GetBitmap (const CacheKey& rKey)
    {
        // Create an empty bitmap for the given key that acts as placeholder
        // until we are given the real one.  Mark it as not being up to date.
        SetBitmap(rKey, Bitmap(), false);
        SetBitmap(rKey, BitmapEx(), false);
        iEntry = mpBitmapContainer->find(rKey);
        iEntry->second.SetUpToDate(false);
    }
@@ -195,7 +195,7 @@ Bitmap BitmapCache::GetBitmap (const CacheKey& rKey)
    return iEntry->second.GetPreview();
}

Bitmap BitmapCache::GetMarkedBitmap (const CacheKey& rKey)
BitmapEx BitmapCache::GetMarkedBitmap (const CacheKey& rKey)
{
    ::osl::MutexGuard aGuard (maMutex);

@@ -206,7 +206,7 @@ Bitmap BitmapCache::GetMarkedBitmap (const CacheKey& rKey)
        return iEntry->second.GetMarkedPreview();
    }
    else
        return Bitmap();
        return BitmapEx();
}

void BitmapCache::ReleaseBitmap (const CacheKey& rKey)
@@ -258,7 +258,7 @@ void BitmapCache::InvalidateCache()

void BitmapCache::SetBitmap (
    const CacheKey& rKey,
    const Bitmap& rPreview,
    const BitmapEx& rPreview,
    bool bIsPrecious)
{
    ::osl::MutexGuard aGuard (maMutex);
@@ -285,7 +285,7 @@ void BitmapCache::SetBitmap (

void BitmapCache::SetMarkedBitmap (
    const CacheKey& rKey,
    const Bitmap& rPreview)
    const BitmapEx& rPreview)
{
    ::osl::MutexGuard aGuard (maMutex);

@@ -317,7 +317,7 @@ void BitmapCache::SetPrecious (const CacheKey& rKey, bool bIsPrecious)
    {
        iEntry = mpBitmapContainer->emplace(
            rKey,
            CacheEntry(Bitmap(), mnCurrentAccessTime++, bIsPrecious)
            CacheEntry(BitmapEx(), mnCurrentAccessTime++, bIsPrecious)
            ).first;
        UpdateCacheSize(iEntry->second, ADD);
    }
@@ -459,7 +459,7 @@ BitmapCache::CacheEntry::CacheEntry(
}

BitmapCache::CacheEntry::CacheEntry(
    const Bitmap& rPreview,
    const BitmapEx& rPreview,
    sal_Int32 nLastAccessTime,
    bool bIsPrecious)
    : maPreview(rPreview),
@@ -530,7 +530,7 @@ inline void BitmapCache::CacheEntry::Decompress()
    }
}

inline void BitmapCache::CacheEntry::SetPreview (const Bitmap& rPreview)
inline void BitmapCache::CacheEntry::SetPreview (const BitmapEx& rPreview)
{
    maPreview = rPreview;
    maMarkedPreview.SetEmpty();
@@ -543,7 +543,7 @@ bool BitmapCache::CacheEntry::HasPreview() const
    return ! maPreview.IsEmpty();
}

inline void BitmapCache::CacheEntry::SetMarkedPreview (const Bitmap& rMarkedPreview)
inline void BitmapCache::CacheEntry::SetMarkedPreview (const BitmapEx& rMarkedPreview)
{
    maMarkedPreview = rMarkedPreview;
}
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
index f4c2f97..11906742 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
@@ -93,11 +93,11 @@ public:

    /** Return the preview bitmap for the given contact object.
    */
    Bitmap GetBitmap (const CacheKey& rKey);
    BitmapEx GetBitmap (const CacheKey& rKey);

    /** Return the marked preview bitmap for the given contact object.
    */
    Bitmap GetMarkedBitmap (const CacheKey& rKey);
    BitmapEx GetMarkedBitmap (const CacheKey& rKey);

    /** Release the reference to the preview bitmap that is associated with
        the given key.
@@ -121,14 +121,14 @@ public:
    */
    void SetBitmap (
        const CacheKey& rKey,
        const Bitmap& rPreview,
        const BitmapEx& rPreview,
        bool bIsPrecious);

    /** Add or replace a marked bitmap for the given key.
    */
    void SetMarkedBitmap (
        const CacheKey& rKey,
        const Bitmap& rPreview);
        const BitmapEx& rPreview);

    /** Mark the specified preview bitmap as precious, i.e. that it must not
        be compressed or otherwise removed from the cache.
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
index a158b62..4cf521e 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
@@ -35,19 +35,19 @@ class NoBitmapCompression::DummyReplacement
    : public BitmapReplacement
{
public:
    Bitmap maPreview;
    BitmapEx maPreview;

    explicit DummyReplacement (const Bitmap& rPreview) : maPreview(rPreview)  { }
    explicit DummyReplacement (const BitmapEx& rPreview) : maPreview(rPreview)  { }
    virtual ~DummyReplacement() {}
    virtual sal_Int32 GetMemorySize() const override { return maPreview.GetSizeBytes(); }
};

std::shared_ptr<BitmapReplacement> NoBitmapCompression::Compress (const Bitmap& rBitmap) const
std::shared_ptr<BitmapReplacement> NoBitmapCompression::Compress (const BitmapEx& rBitmap) const
{
    return std::shared_ptr<BitmapReplacement>(new DummyReplacement(rBitmap));
}

Bitmap NoBitmapCompression::Decompress (const BitmapReplacement& rBitmapData) const
BitmapEx NoBitmapCompression::Decompress (const BitmapReplacement& rBitmapData) const
{
    return dynamic_cast<const DummyReplacement&>(rBitmapData).maPreview;
}
@@ -59,16 +59,16 @@ bool NoBitmapCompression::IsLossless() const

//===== CompressionByDeletion =================================================

std::shared_ptr<BitmapReplacement> CompressionByDeletion::Compress (const Bitmap& ) const
std::shared_ptr<BitmapReplacement> CompressionByDeletion::Compress (const BitmapEx& ) const
{
    return std::shared_ptr<BitmapReplacement>();
}

Bitmap CompressionByDeletion::Decompress (const BitmapReplacement& ) const
BitmapEx CompressionByDeletion::Decompress (const BitmapReplacement& ) const
{
    // Return a NULL pointer.  This will eventually lead to a request for
    // the creation of a new one.
    return Bitmap();
    return BitmapEx();
}

bool CompressionByDeletion::IsLossless() const
@@ -83,7 +83,7 @@ bool CompressionByDeletion::IsLossless() const
class ResolutionReduction::ResolutionReducedReplacement : public BitmapReplacement
{
public:
    Bitmap maPreview;
    BitmapEx maPreview;
    Size maOriginalSize;

    virtual ~ResolutionReducedReplacement();
@@ -100,7 +100,7 @@ sal_Int32 ResolutionReduction::ResolutionReducedReplacement::GetMemorySize() con
}

std::shared_ptr<BitmapReplacement> ResolutionReduction::Compress (
    const Bitmap& rBitmap) const
    const BitmapEx& rBitmap) const
{
    ResolutionReducedReplacement* pResult = new ResolutionReducedReplacement;
    pResult->maPreview = rBitmap;
@@ -115,9 +115,9 @@ std::shared_ptr<BitmapReplacement> ResolutionReduction::Compress (
    return std::shared_ptr<BitmapReplacement>(pResult);
}

Bitmap ResolutionReduction::Decompress (const BitmapReplacement& rBitmapData) const
BitmapEx ResolutionReduction::Decompress (const BitmapReplacement& rBitmapData) const
{
    Bitmap aResult;
    BitmapEx aResult;

    const ResolutionReducedReplacement* pData (
        dynamic_cast<const ResolutionReducedReplacement*>(&rBitmapData));
@@ -160,7 +160,7 @@ public:
    }
};

std::shared_ptr<BitmapReplacement> PngCompression::Compress (const Bitmap& rBitmap) const
std::shared_ptr<BitmapReplacement> PngCompression::Compress (const BitmapEx& rBitmap) const
{
    vcl::PNGWriter aWriter ((BitmapEx(rBitmap)));
    SvMemoryStream aStream (32768, 32768);
@@ -175,10 +175,10 @@ std::shared_ptr<BitmapReplacement> PngCompression::Compress (const Bitmap& rBitm
    return std::shared_ptr<BitmapReplacement>(pResult);
}

Bitmap PngCompression::Decompress (
BitmapEx PngCompression::Decompress (
    const BitmapReplacement& rBitmapData) const
{
    Bitmap aResult;
    BitmapEx aResult;
    const PngReplacement* pData (dynamic_cast<const PngReplacement*>(&rBitmapData));
    if (pData != nullptr)
    {
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx
index a77a809..678f20b 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx
@@ -23,7 +23,7 @@
#include <sal/types.h>
#include <memory>

class Bitmap;
class BitmapEx;

namespace sd { namespace slidesorter { namespace cache {

@@ -38,7 +38,7 @@ public:
    /** Compress the given bitmap into a replacement format that is specific
        to the compressor class.
    */
    virtual std::shared_ptr<BitmapReplacement> Compress (const Bitmap& rBitmap) const = 0;
    virtual std::shared_ptr<BitmapReplacement> Compress (const BitmapEx& rBitmap) const = 0;

    /** Decompress the given replacement data into a preview bitmap.
        Depending on the compression technique the returned bitmap may
@@ -47,7 +47,7 @@ public:
        task of the caller to create a new preview bitmap if the returned
        one is not as desired.
    */
    virtual Bitmap Decompress (const BitmapReplacement& rBitmapData)const=0;
    virtual BitmapEx Decompress (const BitmapReplacement& rBitmapData)const=0;

    /** Return whether the compression and decompression is lossless.  This
        value is used by the caller of Decompress() to decide whether to use
@@ -82,8 +82,8 @@ class NoBitmapCompression
    class DummyReplacement;
public:
    virtual ~NoBitmapCompression() {}
    virtual std::shared_ptr<BitmapReplacement> Compress (const Bitmap& rpBitmap) const override;
    virtual Bitmap Decompress (const BitmapReplacement& rBitmapData) const override;
    virtual std::shared_ptr<BitmapReplacement> Compress (const BitmapEx& rpBitmap) const override;
    virtual BitmapEx Decompress (const BitmapReplacement& rBitmapData) const override;
    virtual bool IsLossless() const override;
};

@@ -97,8 +97,8 @@ class CompressionByDeletion
{
public:
    virtual ~CompressionByDeletion() {}
    virtual std::shared_ptr<BitmapReplacement> Compress (const Bitmap& rBitmap) const override;
    virtual Bitmap Decompress (const BitmapReplacement& rBitmapData) const override;
    virtual std::shared_ptr<BitmapReplacement> Compress (const BitmapEx& rBitmap) const override;
    virtual BitmapEx Decompress (const BitmapReplacement& rBitmapData) const override;
    virtual bool IsLossless() const override;
};

@@ -114,10 +114,10 @@ class ResolutionReduction
    static const sal_Int32 mnWidth = 100;
public:
    virtual ~ResolutionReduction() {}
    virtual std::shared_ptr<BitmapReplacement> Compress (const Bitmap& rpBitmap) const override;
    virtual std::shared_ptr<BitmapReplacement> Compress (const BitmapEx& rpBitmap) const override;
    /** Scale the replacement bitmap up to the original size.
    */
    virtual Bitmap Decompress (const BitmapReplacement& rBitmapData) const override;
    virtual BitmapEx Decompress (const BitmapReplacement& rBitmapData) const override;
    virtual bool IsLossless() const override;
};

@@ -130,8 +130,8 @@ class PngCompression
    class PngReplacement;
public:
    virtual ~PngCompression() {}
    virtual std::shared_ptr<BitmapReplacement> Compress (const Bitmap& rBitmap) const override;
    virtual Bitmap Decompress (const BitmapReplacement& rBitmapData) const override;
    virtual std::shared_ptr<BitmapReplacement> Compress (const BitmapEx& rBitmap) const override;
    virtual BitmapEx Decompress (const BitmapReplacement& rBitmapData) const override;
    virtual bool IsLossless() const override;
};

diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
index f09318f..13f6844 100644
--- a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
@@ -102,13 +102,13 @@ void GenericPageCache::ChangePreviewSize (
    }
}

Bitmap GenericPageCache::GetPreviewBitmap (
BitmapEx GenericPageCache::GetPreviewBitmap (
    const CacheKey aKey,
    const bool bResize)
{
    assert(aKey != nullptr);

    Bitmap aPreview;
    BitmapEx aPreview;
    bool bMayBeUpToDate = true;
    ProvideCacheAndProcessor();
    const SdrPage* pPage = mpCacheContext->GetPage(aKey);
@@ -140,21 +140,21 @@ Bitmap GenericPageCache::GetPreviewBitmap (
    return aPreview;
}

Bitmap GenericPageCache::GetMarkedPreviewBitmap (
BitmapEx GenericPageCache::GetMarkedPreviewBitmap (
    const CacheKey aKey)
{
    assert(aKey != nullptr);

    ProvideCacheAndProcessor();
    const SdrPage* pPage = mpCacheContext->GetPage(aKey);
    Bitmap aMarkedPreview (mpBitmapCache->GetMarkedBitmap(pPage));
    BitmapEx aMarkedPreview (mpBitmapCache->GetMarkedBitmap(pPage));

    return aMarkedPreview;
}

void GenericPageCache::SetMarkedPreviewBitmap (
    const CacheKey aKey,
    const Bitmap& rMarkedBitmap)
    const BitmapEx& rMarkedBitmap)
{
    assert(aKey != nullptr);

@@ -179,7 +179,7 @@ void GenericPageCache::RequestPreviewBitmap (
        bIsUpToDate = mpBitmapCache->BitmapIsUpToDate (pPage);
    if (bIsUpToDate)
    {
        const Bitmap aPreview (mpBitmapCache->GetBitmap(pPage));
        const BitmapEx aPreview (mpBitmapCache->GetBitmap(pPage));
        if (aPreview.IsEmpty() || aPreview.GetSizePixel()!=maPreviewSize)
              bIsUpToDate = false;
    }
diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
index 7ebabdf..39f9be0 100644
--- a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
@@ -77,14 +77,14 @@ public:
            Returns a bitmap that is either empty, contains a scaled (up or
            down) version or is the requested bitmap.
    */
    Bitmap GetPreviewBitmap (
    BitmapEx GetPreviewBitmap (
        const CacheKey aKey,
        const bool bResize);
    Bitmap GetMarkedPreviewBitmap (
    BitmapEx GetMarkedPreviewBitmap (
        const CacheKey aKey);
    void SetMarkedPreviewBitmap (
        const CacheKey aKey,
        const Bitmap& rMarkedBitmap);
        const BitmapEx& rMarkedBitmap);

    /** When the requested preview bitmap does not yet exist or is not
        up-to-date then the rendering of one is scheduled.  Otherwise this
diff --git a/sd/source/ui/slidesorter/cache/SlsPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsPageCache.cxx
index 5763670..d91d810 100644
--- a/sd/source/ui/slidesorter/cache/SlsPageCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsPageCache.cxx
@@ -52,14 +52,14 @@ void PageCache::ChangeSize (
    mpImplementation->ChangePreviewSize(rPreviewSize, bDoSuperSampling);
}

Bitmap PageCache::GetPreviewBitmap (
BitmapEx PageCache::GetPreviewBitmap (
    const CacheKey aKey,
    const bool bResize)
{
    return mpImplementation->GetPreviewBitmap(aKey, bResize);
}

Bitmap PageCache::GetMarkedPreviewBitmap (
BitmapEx PageCache::GetMarkedPreviewBitmap (
    const CacheKey aKey)
{
    return mpImplementation->GetMarkedPreviewBitmap(aKey);
@@ -67,7 +67,7 @@ Bitmap PageCache::GetMarkedPreviewBitmap (

void PageCache::SetMarkedPreviewBitmap (
    const CacheKey aKey,
    const Bitmap& rMarkedBitmap)
    const BitmapEx& rMarkedBitmap)
{
    mpImplementation->SetMarkedPreviewBitmap(aKey, rMarkedBitmap);
}
diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
index d9e962f..75145ed 100644
--- a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
@@ -150,7 +150,7 @@ void QueueProcessor::ProcessOneRequest (
            const SdPage* pSdPage = dynamic_cast<const SdPage*>(mpCacheContext->GetPage(aKey));
            if (pSdPage != nullptr)
            {
                const Bitmap aPreview (
                const BitmapEx aPreview (
                    maBitmapFactory.CreateBitmap(*pSdPage, maPreviewSize, mbDoSuperSampling));
                mpCache->SetBitmap (pSdPage, aPreview, ePriorityClass!=NOT_VISIBLE);

diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
index 7ac3ed0..1ffe7e6 100644
--- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -422,7 +422,7 @@ void Clipboard::CreateSlideTransferable (
        model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
        if ( ! pDescriptor || pDescriptor->GetPage()==nullptr)
            continue;
        Bitmap aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false));
        BitmapEx aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false));
        aRepresentatives.emplace_back(
            aPreview,
            pDescriptor->HasState(model::PageDescriptor::ST_Excluded));
@@ -533,7 +533,7 @@ std::shared_ptr<SdTransferable::UserData> Clipboard::CreateTransferableUserData 
        model::SharedPageDescriptor pDescriptor (rSlideSorter.GetModel().GetPageDescriptor((nPageIndex-1)/2));
        if ( ! pDescriptor || pDescriptor->GetPage()==nullptr)
            break;
        Bitmap aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false));
        BitmapEx aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false));
        aRepresentatives.emplace_back(
                aPreview,
                pDescriptor->HasState(model::PageDescriptor::ST_Excluded));
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
index fe0ff6a..ed2548a 100644
--- a/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
+++ b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
@@ -26,7 +26,7 @@
#include <vector>

class SdrPage;
class Bitmap;
class BitmapEx;

namespace sd { namespace slidesorter { namespace cache {

@@ -49,7 +49,7 @@ public:
    */
    virtual void NotifyPreviewCreation (
        CacheKey aKey,
        const Bitmap& rPreview) = 0;
        const BitmapEx& rPreview) = 0;

    /** Called to determine whether the system is idle and a preview can be
        created without annoying the user.
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
index fffcefb..0963223 100644
--- a/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
+++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
@@ -22,7 +22,7 @@

#include <cache/SlsCacheContext.hxx>
#include <sal/types.h>
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <memory>

class Size;
@@ -103,15 +103,15 @@ public:
            Returns a bitmap that is either empty, contains a scaled (up or
            down) version or is the requested bitmap.
    */
    Bitmap GetPreviewBitmap (
    BitmapEx GetPreviewBitmap (
        const CacheKey aKey,
        const bool bResize);

    Bitmap GetMarkedPreviewBitmap (
    BitmapEx GetMarkedPreviewBitmap (
        const CacheKey aKey);
    void SetMarkedPreviewBitmap (
        const CacheKey aKey,
        const Bitmap& rBitmap);
        const BitmapEx& rBitmap);

    /** When the requested preview bitmap does not yet exist or is not
        up-to-date then the rendering of one is scheduled.  Otherwise this
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx b/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx
index 9625ca4..35b3480 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx
@@ -43,10 +43,10 @@ public:
    class Representative
    {
    public:
        Representative (const Bitmap& rBitmap, const bool bIsExcluded)
        Representative (const BitmapEx& rBitmap, const bool bIsExcluded)
            : maBitmap(rBitmap), mbIsExcluded(bIsExcluded) {}

        Bitmap maBitmap;
        BitmapEx maBitmap;
        bool mbIsExcluded;
    };

diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
index 9fd424a..ce7098a8 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
@@ -64,7 +64,7 @@ public:
        @return
            The returned bitmap may have a different size then the preview area.
    */
    Bitmap GetPreviewBitmap (
    BitmapEx GetPreviewBitmap (
        const model::SharedPageDescriptor& rpDescriptor,
        const OutputDevice* pReferenceDevice) const;

@@ -105,9 +105,9 @@ private:
        OutputDevice& rDevice,
        const model::SharedPageDescriptor& rpDescriptor) const;

    static Bitmap CreateMarkedPreview(
    static BitmapEx CreateMarkedPreview(
        const Size& rSize,
        const Bitmap& rPreview,
        const BitmapEx& rPreview,
        const BitmapEx& rOverlay,
        const OutputDevice* pReferenceDevice);

diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index c860149..bd8c071 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -141,20 +141,20 @@ void PageObjectPainter::PaintPreview (
        const SdrPage* pPage = rpDescriptor->GetPage();
        mpCache->SetPreciousFlag(pPage, true);

        const Bitmap aPreview (GetPreviewBitmap(rpDescriptor, &rDevice));
        const BitmapEx aPreview (GetPreviewBitmap(rpDescriptor, &rDevice));
        if ( ! aPreview.IsEmpty())
        {
            if (aPreview.GetSizePixel() != aBox.GetSize())
                rDevice.DrawBitmap(aBox.TopLeft(), aBox.GetSize(), aPreview);
                rDevice.DrawBitmapEx(aBox.TopLeft(), aBox.GetSize(), aPreview);
            else
                rDevice.DrawBitmap(aBox.TopLeft(), aPreview);
                rDevice.DrawBitmapEx(aBox.TopLeft(), aPreview);
        }
    }
}

Bitmap PageObjectPainter::CreateMarkedPreview (
BitmapEx PageObjectPainter::CreateMarkedPreview (
    const Size& rSize,
    const Bitmap& rPreview,
    const BitmapEx& rPreview,
    const BitmapEx& rOverlay,
    const OutputDevice* pReferenceDevice)
{
@@ -165,7 +165,7 @@ Bitmap PageObjectPainter::CreateMarkedPreview (
        pDevice.disposeAndReset(VclPtr<VirtualDevice>::Create());
    pDevice->SetOutputSizePixel(rSize);

    pDevice->DrawBitmap(Point(0,0), rSize, rPreview);
    pDevice->DrawBitmapEx(Point(0,0), rSize, rPreview);

    // Paint bitmap tiled over the preview to mark it as excluded.
    const sal_Int32 nIconWidth (rOverlay.GetSizePixel().Width());
@@ -176,10 +176,10 @@ Bitmap PageObjectPainter::CreateMarkedPreview (
            for (long nY=0; nY<rSize.Height(); nY+=nIconHeight)
                pDevice->DrawBitmapEx(Point(nX,nY), rOverlay);
    }
    return pDevice->GetBitmap(Point(0,0), rSize);
    return pDevice->GetBitmapEx(Point(0,0), rSize);
}

Bitmap PageObjectPainter::GetPreviewBitmap (
BitmapEx PageObjectPainter::GetPreviewBitmap (
    const model::SharedPageDescriptor& rpDescriptor,
    const OutputDevice* pReferenceDevice) const
{
@@ -190,7 +190,7 @@ Bitmap PageObjectPainter::GetPreviewBitmap (
    {
        PageObjectLayouter *pPageObjectLayouter = mrLayouter.GetPageObjectLayouter().get();

        Bitmap aMarkedPreview (mpCache->GetMarkedPreviewBitmap(pPage));
        BitmapEx aMarkedPreview (mpCache->GetMarkedPreviewBitmap(pPage));
        const ::tools::Rectangle aPreviewBox (pPageObjectLayouter->GetBoundingBox(
            rpDescriptor,
            PageObjectLayouter::Part::Preview,
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
index 9cdd421..27ec932 100644
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
@@ -47,7 +47,7 @@ ViewCacheContext::~ViewCacheContext()

void ViewCacheContext::NotifyPreviewCreation (
    cache::CacheKey aKey,
    const Bitmap&)
    const BitmapEx&)
{
    const model::SharedPageDescriptor pDescriptor (GetDescriptor(aKey));
    if (pDescriptor.get() != nullptr)
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
index 88047a3..62f1074 100644
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
@@ -41,7 +41,7 @@ class ViewCacheContext : public cache::CacheContext
public:
    explicit ViewCacheContext (SlideSorter& rSlideSorter);
    virtual ~ViewCacheContext() override;
    virtual void NotifyPreviewCreation (cache::CacheKey aKey, const Bitmap& rPreview) override;
    virtual void NotifyPreviewCreation (cache::CacheKey aKey, const BitmapEx& rPreview) override;
    virtual bool IsIdle() override;
    virtual bool IsVisible (cache::CacheKey aKey) override;
    virtual const SdrPage* GetPage (cache::CacheKey aKey) override;