sd/inc/unomodel.hxx                           |    4 +-
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |   35 +++++++++++++++++++------
 sd/source/ui/inc/SlideshowLayerRenderer.hxx   |    4 ++
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |   36 ++++++++++++++++++--------
 sd/source/ui/unoidl/unomodel.cxx              |   12 ++++----
 5 files changed, 63 insertions(+), 28 deletions(-)

New commits:
commit 8e9ab1e89691d979d169dd616a0e5afb63dc7c7d
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Mon Mar 10 15:50:10 2025 +0100
Commit:     Marco Cecchetti <marco.cecche...@collabora.com>
CommitDate: Sun Aug 24 23:21:21 2025 +0200

    lok: slideshow: regression: background not hidden for animated paragraph
    
    The layer for an animated paragraph included the backgound, too.
    It seems that in co 25.04 text primitive structure is changed.
    There is a group wrapping polygon and text primitives.
    Non-solid backgrounds seem to use the POLYPOLYGONRGBA primitive, now.
    
    Change-Id: I9fe548aacea1bf8a489befdd1a98d5fd5cb6609f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190033
    Reviewed-by: Marco Cecchetti <marco.cecche...@collabora.com>
    Tested-by: Jenkins

diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx 
b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
index 10f6e8904366..4bd8405be04d 100644
--- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx
+++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
@@ -200,17 +200,30 @@ bool isGroup(SdrObject* pObject) { return 
pObject->getChildrenOfSdrObject() != n
 
 /// Sets visible for all kinds of polypolys in the container
 void changePolyPolys(
-    drawinglayer::primitive2d::Primitive2DContainer& rContainer, bool 
bRenderObject,
+    const drawinglayer::primitive2d::Primitive2DContainer& rContainer, bool 
bRenderObject,
     std::vector<drawinglayer::primitive2d::Primitive2DReference>& 
rPrimitivesToUnhide)
 {
     for (auto& pBasePrimitive : rContainer)
     {
-        if (pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D
-            || pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D
-            || pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D
-            || pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D
-            || pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D
-            || pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D)
+        if (pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_GROUPPRIMITIVE2D)
+        {
+            auto& rGroupPrimitive
+                = 
static_cast<drawinglayer::primitive2d::GroupPrimitive2D&>(*pBasePrimitive);
+            const drawinglayer::primitive2d::Primitive2DContainer& rChildren
+                = rGroupPrimitive.getChildren();
+            changePolyPolys(rChildren, bRenderObject, rPrimitivesToUnhide);
+        }
+        else if (pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D
+                 || pBasePrimitive->getPrimitive2DID()
+                        == PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D
+                 || pBasePrimitive->getPrimitive2DID()
+                        == PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D
+                 || pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D
+                 || pBasePrimitive->getPrimitive2DID()
+                        == PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D
+                 || pBasePrimitive->getPrimitive2DID()
+                        == PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D
+                 || pBasePrimitive->getPrimitive2DID() == 
PRIMITIVE2D_ID_POLYPOLYGONRGBAPRIMITIVE2D)
         {
             pBasePrimitive->setVisible(bRenderObject);
             if (!bRenderObject)
commit d139a87b383c8c483dcd1a546d4ae65fac746f62
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Sun Mar 9 10:50:56 2025 +0100
Commit:     Marco Cecchetti <marco.cecche...@collabora.com>
CommitDate: Sun Aug 24 23:21:07 2025 +0200

    lok: slideshow: regression: mismatching slide hash
    
    Slide hash generated by getPresentationInfo and by renderNextSlideLayer
    didn't match
    
    Change-Id: Iba15828f486f4d29700eee19f8a5438884bfb8ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190032
    Tested-by: Jenkins
    Reviewed-by: Marco Cecchetti <marco.cecche...@collabora.com>

diff --git a/sd/inc/unomodel.hxx b/sd/inc/unomodel.hxx
index f74dc8eea87a..98a761d03bc9 100644
--- a/sd/inc/unomodel.hxx
+++ b/sd/inc/unomodel.hxx
@@ -310,7 +310,7 @@ public:
     /// @see vcl::ITiledRenderable::renderNextSlideLayer().
     SD_DLLPUBLIC bool renderNextSlideLayer(unsigned char* pBuffer, bool& 
bIsBitmapLayer, double& rScale, OUString& rJsonMsg) override;
 
-    rtl::Reference< SdDrawPagesAccess > getSdDrawPages();
+    SD_DLLPUBLIC rtl::Reference< SdDrawPagesAccess > getSdDrawPages();
 
     // XComponent
 
@@ -364,7 +364,7 @@ public:
     virtual void SAL_CALL addEventListener( const css::uno::Reference< 
css::lang::XEventListener >& xListener ) override;
     virtual void SAL_CALL removeEventListener( const css::uno::Reference< 
css::lang::XEventListener >& aListener ) override;
 
-    SdGenericDrawPage* getDrawPageByIndex( sal_Int32 Index );
+    SD_DLLPUBLIC SdGenericDrawPage* getDrawPageByIndex( sal_Int32 Index );
 };
 
 /***********************************************************************
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 56bfcdd87a5a..d56cd76e41e5 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -45,6 +45,7 @@
 #include <drawdoc.hxx>
 #include <undo/undomanager.hxx>
 #include <sfx2/request.hxx>
+#include <unopage.hxx>
 
 #include <svx/svxids.hrc>
 #include <pres.hxx>
@@ -2828,6 +2829,24 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testPresentationInfo)
 
 namespace
 {
+std::string GetSlideHash(SdXImpressDocument* pDoc, sal_Int32 nSlideNumber)
+{
+    try
+    {
+        rtl::Reference<SdDrawPagesAccess> xDrawPages = pDoc->getSdDrawPages();
+        SdGenericDrawPage* 
pSlide(xDrawPages->getDrawPageByIndex(nSlideNumber));
+        if (pSlide)
+        {
+            return GetInterfaceHash(cppu::getXWeak(pSlide));
+        }
+    }
+    catch (uno::Exception&)
+    {
+        CPPUNIT_FAIL("SdXImpressDocument::createLOKSlideRenderer: failed");
+    }
+    return {};
+}
+
 class SlideRendererChecker
 {
 private:
@@ -2853,7 +2872,7 @@ public:
         SdPage* pPage = pDoc->GetSdPage(sal_uInt16(mnSlideNumber), 
PageKind::Standard);
         CPPUNIT_ASSERT(pPage);
 
-        std::string sHash = GetInterfaceHash(GetXDrawPageForSdrPage(pPage));
+        std::string sHash = GetSlideHash(mpXImpressDocument, mnSlideNumber);
         CPPUNIT_ASSERT(mpXImpressDocument->createSlideRenderer(
             sHash.c_str(), mnSlideNumber, mnViewWidth, mnViewHeight, 
bRenderBackground,
             bRenderMasterPage));
@@ -3033,7 +3052,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering)
     CPPUNIT_ASSERT(pViewShell);
     SdPage* pPage = pViewShell->GetActualPage();
     CPPUNIT_ASSERT(pPage);
-    std::string sHash = GetInterfaceHash(GetXDrawPageForSdrPage(pPage));
+    std::string sHash = GetSlideHash(pXImpressDocument, 0);
     sal_Int32 nViewWidth = 2000;
     sal_Int32 nViewHeight = 2000;
     CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(sHash.c_str(), 0, 
nViewWidth, nViewHeight, true, true));
@@ -3151,7 +3170,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_WithFie
     SdPage* pPage = pViewShell->GetActualPage();
 
     CPPUNIT_ASSERT(pPage);
-    std::string sHash = GetInterfaceHash(GetXDrawPageForSdrPage(pPage));
+    std::string sHash = GetSlideHash(pXImpressDocument, 0);
     sal_Int32 nViewWidth = 2000;
     sal_Int32 nViewHeight = 2000;
     CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(sHash.c_str(), 0, 
nViewWidth, nViewHeight, true, true));
@@ -3531,7 +3550,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
     CPPUNIT_ASSERT(pViewShell);
     SdPage* pPage = pViewShell->GetActualPage();
     CPPUNIT_ASSERT(pPage);
-    std::string sHash = GetInterfaceHash(GetXDrawPageForSdrPage(pPage));
+    std::string sHash = GetSlideHash(pXImpressDocument, 0);
     sal_Int32 nViewWidth = 2000;
     sal_Int32 nViewHeight = 2000;
     CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(sHash.c_str(), 0, 
nViewWidth, nViewHeight, true, true));
@@ -3705,7 +3724,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
     CPPUNIT_ASSERT(pPage);
     sal_Int32 nViewWidth = 2000;
     sal_Int32 nViewHeight = 2000;
-    std::string sHash = GetInterfaceHash(GetXDrawPageForSdrPage(pPage));
+    std::string sHash = GetSlideHash(pXImpressDocument, 0);
     CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(sHash.c_str(), 0, 
nViewWidth, nViewHeight, true, true));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nViewWidth);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1125), nViewHeight);
@@ -3967,7 +3986,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
     sal_Int32 nViewWidth = 2000;
     sal_Int32 nViewHeight = 2000;
 
-    std::string sHash = GetInterfaceHash(GetXDrawPageForSdrPage(pPage));
+    std::string sHash = GetSlideHash(pXImpressDocument, 0);
     CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(sHash.c_str(), 0, 
nViewWidth, nViewHeight, true, true));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nViewWidth);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1125), nViewHeight);
@@ -4134,7 +4153,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
     sal_Int32 nViewWidth = 2000;
     sal_Int32 nViewHeight = 2000;
 
-    std::string sHash = GetInterfaceHash(GetXDrawPageForSdrPage(pPage));
+    std::string sHash = GetSlideHash(pXImpressDocument, 0);
     CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(sHash.c_str(), 0, 
nViewWidth, nViewHeight, true, true));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nViewWidth);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1125), nViewHeight);
@@ -4239,7 +4258,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
     sal_Int32 nViewWidth = 2000;
     sal_Int32 nViewHeight = 2000;
 
-    std::string sHash = GetInterfaceHash(GetXDrawPageForSdrPage(pPage));
+    std::string sHash = GetSlideHash(pXImpressDocument, 0);
     CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(sHash.c_str(), 0, 
nViewWidth, nViewHeight, true, true));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nViewWidth);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1500), nViewHeight);
diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx 
b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
index 88e04db1b5e8..15064456c9fb 100644
--- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx
+++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
@@ -146,6 +146,7 @@ class SD_DLLPUBLIC SlideshowLayerRenderer
 {
 private:
     SdrPage& mrPage;
+    OString msSlideHash;
     SdrModel& mrModel;
     Size maSlideSize;
     RenderState maRenderState;
@@ -163,7 +164,8 @@ private:
     void cleanup();
 
 public:
-    SlideshowLayerRenderer(SdrPage& rPage, bool bRenderBackground, bool 
bRenderMasterPage);
+    SlideshowLayerRenderer(SdrPage& rPage, const OString& rSlideHash, bool 
bRenderBackground,
+                           bool bRenderMasterPage);
 
     /** Calculate and set the slide size depending on input desired size (in 
pixels)
      *
diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx 
b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
index 459060c28503..10f6e8904366 100644
--- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx
+++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
@@ -663,9 +663,10 @@ SdrObject* 
getObjectForShape(uno::Reference<drawing::XShape> const& xShape)
 
 } // end anonymous namespace
 
-SlideshowLayerRenderer::SlideshowLayerRenderer(SdrPage& rPage, bool 
bRenderBackground,
-                                               bool bRenderMasterPage)
+SlideshowLayerRenderer::SlideshowLayerRenderer(SdrPage& rPage, const OString& 
rSlideHash,
+                                               bool bRenderBackground, bool 
bRenderMasterPage)
     : mrPage(rPage)
+    , msSlideHash(rSlideHash)
     , mrModel(rPage.getSdrModelFromSdrPage())
     , mbRenderBackground(bRenderBackground)
     , mbRenderMasterPage(bRenderMasterPage)
@@ -941,7 +942,7 @@ void SlideshowLayerRenderer::writeBackgroundJSON(OString& 
rJsonMsg)
     ::tools::JsonWriter aJsonWriter;
     aJsonWriter.put("group", maRenderState.stageString());
     aJsonWriter.put("index", maRenderState.currentIndex());
-    aJsonWriter.put("slideHash", 
GetInterfaceHash(GetXDrawPageForSdrPage(&mrPage)));
+    aJsonWriter.put("slideHash", msSlideHash);
     aJsonWriter.put("type", "bitmap");
     writeContentNode(aJsonWriter);
     rJsonMsg = aJsonWriter.finishAndGetAsOString();
@@ -953,7 +954,7 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg, 
RenderPass const& rRen
     ::tools::JsonWriter aJsonWriter;
     aJsonWriter.put("group", maRenderState.stageString());
     aJsonWriter.put("index", maRenderState.currentIndex());
-    aJsonWriter.put("slideHash", 
GetInterfaceHash(GetXDrawPageForSdrPage(&mrPage)));
+    aJsonWriter.put("slideHash", msSlideHash);
 
     SdrObject* pObject = rRenderPass.mpObject;
     sal_Int32 nParagraph = rRenderPass.mnParagraph;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 8ccf6990c85d..b4b9ad89afa9 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -4844,12 +4844,12 @@ bool isRequestedSlideValid(SdDrawDocument* mpDoc, 
sal_Int32 nSlideNumber, const
 {
     try
     {
-        uno::Reference<drawing::XDrawPagesSupplier> 
xDrawPages(getXWeak(mpDoc->getUnoModel()), uno::UNO_QUERY_THROW);
-        uno::Reference<container::XIndexAccess> 
xSlides(xDrawPages->getDrawPages(), uno::UNO_QUERY_THROW);
-        uno::Reference<drawing::XDrawPage> 
xSlide(xSlides->getByIndex(nSlideNumber), uno::UNO_QUERY_THROW);
-        if (xSlide.is())
+        SdXImpressDocument* pDoc = mpDoc->getUnoModel();
+        rtl::Reference<SdDrawPagesAccess> xDrawPages = pDoc->getSdDrawPages();
+        SdGenericDrawPage* 
pSlide(xDrawPages->getDrawPageByIndex(nSlideNumber));
+        if (pSlide)
         {
-            return slideHash == GetInterfaceHash(xSlide);
+            return slideHash == GetInterfaceHash(cppu::getXWeak(pSlide));
         }
     }
     catch (uno::Exception&)
@@ -4873,7 +4873,7 @@ bool SdXImpressDocument::createSlideRenderer(
     if (!pPage)
         return false;
 
-    mpSlideshowLayerRenderer.reset(new SlideshowLayerRenderer(*pPage, 
bRenderBackground, bRenderMasterPage));
+    mpSlideshowLayerRenderer.reset(new SlideshowLayerRenderer(*pPage, 
rSlideHash, bRenderBackground, bRenderMasterPage));
     Size aDesiredSize(nViewWidth, nViewHeight);
     Size aCalculatedSize = 
mpSlideshowLayerRenderer->calculateAndSetSizePixel(aDesiredSize);
     nViewWidth = aCalculatedSize.Width();

Reply via email to