sc/source/ui/inc/output.hxx   |    1 +
 sc/source/ui/view/output.cxx  |    1 +
 sc/source/ui/view/output3.cxx |    8 +++++++-
 3 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit c8d067868792e6de49bde70507bd30261d3fbd3d
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Tue Apr 16 16:26:07 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jun 3 10:46:08 2024 +0200

    tdf#160589: compare the correct OutDev with PageWindows
    
    Change-Id: I29d9c60cac04536bb2d5ad2ed1c086c8e67a9f20
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166151
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>
    (cherry picked from commit 1e1a3825d76ed8071424e8e21bbda23464c10fff)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168317
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index e4763767b7f5..18d4aa1f2bbc 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -175,6 +175,7 @@ private:
         void adjustForHyperlinkInPDF(Point aURLStart, const OutputDevice* 
pDev);
     };
 
+    VclPtr<OutputDevice> mpOriginalTargetDevice; // 'unpatched' TargetDevice
     VclPtr<OutputDevice> mpDev;        // Device
     VclPtr<OutputDevice> mpRefDevice;  // printer if used for preview
     VclPtr<OutputDevice> pFmtDevice;   // reference for text formatting
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 9d0fe1430550..6f01dc052fa4 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -144,6 +144,7 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, 
ScOutputType eNewType,
                             SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW 
nNewY2,
                             double nPixelPerTwipsX, double nPixelPerTwipsY,
                             const Fraction* pZoomX, const Fraction* pZoomY ) :
+    mpOriginalTargetDevice( pNewDev ),
     mpDev( pNewDev ),
     mpRefDevice( pNewDev ),      // default is output device
     pFmtDevice( pNewDev ),      // default is output device
diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx
index bc6efec65400..760a62a12d1d 100644
--- a/sc/source/ui/view/output3.cxx
+++ b/sc/source/ui/view/output3.cxx
@@ -206,7 +206,13 @@ void ScOutputData::DrawSelectiveObjects(SdrLayerID nLayer)
 
             if(pPageView)
             {
-                if (nullptr != pPageView->FindPageWindow(*mpDev))
+                // tdf#160589 need to check for registered PaintWindow using 
the
+                // 'original' TragetDevice, mpDev might have been changed by a
+                // call to ::SetContentDevice. That again might patch in a
+                // pre-render device fetched from 
SdrPaintWindow::GetTargetOutputDevice
+                // and thus the test if target is aregistered PageWindow would 
fail
+                assert(nullptr != mpOriginalTargetDevice && 
"mpOriginalTargetDevice *must* be set when constructing ScOutputData (!)");
+                if (nullptr != 
pPageView->FindPageWindow(*mpOriginalTargetDevice))
                 {
                     // Target OutputDevice is registered for this view
                     // (as it should be), we can just render

Reply via email to