include/svx/unoapi.hxx                    |    6 +++++
 sd/source/console/PresenterController.cxx |   11 +++++++++
 sd/source/console/PresenterController.hxx |    4 +++
 sd/source/console/PresenterScreen.cxx     |   23 +++++++++++++++++++
 sd/source/console/PresenterScreen.hxx     |    2 +
 sd/source/ui/tools/IdleDetection.cxx      |    2 -
 svx/source/unodraw/unopage.cxx            |   36 ++++++++++++++++++++++++++++++
 7 files changed, 83 insertions(+), 1 deletion(-)

New commits:
commit aef28c23adc87b8e26eacb56c7dbcf652e907fb9
Author:     Armin Le Grand (allotropia) <[email protected]>
AuthorDate: Thu Mar 28 12:22:12 2024 +0100
Commit:     Armin Le Grand <[email protected]>
CommitDate: Fri Mar 29 01:55:38 2024 +0100

    IASS: Update NextSlide in PresenterConsole
    
    Change-Id: I6060e95aabfdb5956bf2f4a71d047bdf5c97a723
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165458
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <[email protected]>

diff --git a/include/svx/unoapi.hxx b/include/svx/unoapi.hxx
index 3107a483579d..6ee2d2cb27c4 100644
--- a/include/svx/unoapi.hxx
+++ b/include/svx/unoapi.hxx
@@ -53,6 +53,12 @@ SVXCORE_DLLPUBLIC css::uno::Reference< 
css::drawing::XDrawPage > GetXDrawPageFor
 /** Returns the SdrPage from the given StarOffice API wrapper */
 SVXCORE_DLLPUBLIC SdrPage* GetSdrPageFromXDrawPage( const css::uno::Reference< 
css::drawing::XDrawPage >& xDrawPage ) noexcept ;
 
+// helper that returns true if the given XShape is member of the given
+// XDrawPage or it's MasterPage (aka associated)
+SVXCORE_DLLPUBLIC bool IsXShapeAssociatedWithXDrawPage(
+    const css::uno::Reference<css::drawing::XShape>& rxShape,
+    const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage) noexcept;
+
 /**
  * Maps the vcl MapUnit enum to an API constant MeasureUnit.
  * Returns false if conversion is not supported.
diff --git a/sd/source/console/PresenterController.cxx 
b/sd/source/console/PresenterController.cxx
index 7bb137d8c03b..e5874c8e7fab 100644
--- a/sd/source/console/PresenterController.cxx
+++ b/sd/source/console/PresenterController.cxx
@@ -51,6 +51,7 @@
 #include <com/sun/star/util/URLTransformer.hpp>
 
 #include <rtl/ustrbuf.hxx>
+#include <svx/unoapi.hxx>
 #include <utility>
 
 using namespace ::com::sun::star;
@@ -402,6 +403,16 @@ void PresenterController::UpdateViews()
     }
 }
 
+void PresenterController::CheckNextSlideUpdate(const 
Reference<drawing::XShape>& rxShape)
+{
+    if (!mxNextSlide)
+        return;
+
+    // check if shape is member of page or it's masterPage
+    if(IsXShapeAssociatedWithXDrawPage(rxShape, mxNextSlide))
+        UpdateViews();
+}
+
 SharedBitmapDescriptor
     PresenterController::GetViewBackground (const OUString& rsViewURL) const
 {
diff --git a/sd/source/console/PresenterController.hxx 
b/sd/source/console/PresenterController.hxx
index a4d7993eecda..c4a7d22b6096 100644
--- a/sd/source/console/PresenterController.hxx
+++ b/sd/source/console/PresenterController.hxx
@@ -130,6 +130,10 @@ public:
     void HandleMouseClick (const css::awt::MouseEvent& rEvent);
     void UpdatePaneTitles();
 
+    // check if the 'NextSlide' needs an update when the given
+    // XShape is changed and trigger that update
+    void CheckNextSlideUpdate(const css::uno::Reference<css::drawing::XShape>& 
rxShape);
+
     /** Request activation or deactivation of (some of) the views according
         to the given parameters.
     */
diff --git a/sd/source/console/PresenterScreen.cxx 
b/sd/source/console/PresenterScreen.cxx
index 2cbd612ff357..7e3f9f0722c5 100644
--- a/sd/source/console/PresenterScreen.cxx
+++ b/sd/source/console/PresenterScreen.cxx
@@ -220,6 +220,20 @@ void SAL_CALL PresenterScreenListener::notifyEvent( const 
css::document::EventOb
             mpPresenterScreen = nullptr;
         }
     }
+    else if ( Event.EventName == "ShapeModified" )
+    {
+        if (mpPresenterScreen.is())
+        {
+            Reference<drawing::XShape> xShape(Event.Source, UNO_QUERY);
+
+            if (xShape.is())
+            {
+                // when presenter is used and shape changes, check
+                // and evtl. trigger update of 'NextSlide' view
+                mpPresenterScreen->CheckNextSlideUpdate(xShape);
+            }
+        }
+    }
 }
 
 // XEventListener
@@ -432,6 +446,15 @@ void PresenterScreen::SwitchMonitors()
     }
 }
 
+void PresenterScreen::CheckNextSlideUpdate(const Reference<drawing::XShape>& 
rxShape)
+{
+    if (nullptr == mpPresenterController)
+        return;
+
+    // forward to PresenterController if used
+    mpPresenterController->CheckNextSlideUpdate(rxShape);
+}
+
 /**
  * Return the real VCL screen number to show the presenter console
  * on or -1 to not show anything.
diff --git a/sd/source/console/PresenterScreen.hxx 
b/sd/source/console/PresenterScreen.hxx
index 430384a45c6d..907d48a12e78 100644
--- a/sd/source/console/PresenterScreen.hxx
+++ b/sd/source/console/PresenterScreen.hxx
@@ -127,6 +127,8 @@ public:
 
     virtual void SAL_CALL disposing ( const css::lang::EventObject& rEvent) 
override;
 
+    void CheckNextSlideUpdate(const css::uno::Reference<css::drawing::XShape>& 
rxShape);
+
 private:
     css::uno::Reference<css::frame::XModel2 > mxModel;
     rtl::Reference<::sd::DrawController> mxController;
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index 06cebcfc4914..0dcba14527ec 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -907,6 +907,42 @@ SdrPage* GetSdrPageFromXDrawPage( const uno::Reference< 
drawing::XDrawPage >& xD
     return nullptr;
 }
 
+// helper that returns true if the given XShape is member of the given
+// XDrawPage or it's MasterPage (aka associated)
+bool IsXShapeAssociatedWithXDrawPage(
+    const css::uno::Reference<css::drawing::XShape>& rxShape,
+    const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage) noexcept
+{
+    if (!rxShape)
+        return false;
+
+    if (!rxDrawPage)
+        return false;
+
+    const SdrObject* pSdrObject(SdrObject::getSdrObjectFromXShape(rxShape));
+    if (nullptr == pSdrObject)
+        return false;
+
+    SdrPage* pSdrPage(GetSdrPageFromXDrawPage(rxDrawPage));
+    if (nullptr == pSdrPage)
+        return false;
+
+    const SdrPage* pPageFromObj(pSdrObject->getSdrPageFromSdrObject());
+    if (nullptr == pPageFromObj)
+        return false;
+
+    if (pSdrPage == pPageFromObj)
+        // given XShape is member of given XDrawPage
+        return true;
+
+    if (pSdrPage->TRG_HasMasterPage())
+        if (&pSdrPage->TRG_GetMasterPage() == pPageFromObj)
+            // given XShape is member of MasterPage of given XDrawPage
+            return true;
+
+    return false;
+}
+
 // XFormsSupplier
 css::uno::Reference< css::container::XNameContainer > SAL_CALL 
SvxDrawPage::getForms()
 {
commit 3027850e18eb2983e26d2535c33ff79eaa756af9
Author:     Armin Le Grand (allotropia) <[email protected]>
AuthorDate: Thu Mar 28 16:21:24 2024 +0100
Commit:     Armin Le Grand <[email protected]>
CommitDate: Fri Mar 29 01:55:28 2024 +0100

    IASS: SlidePane/Sorter updates were missing
    
    Change-Id: I75ce5311a74f15397dd5a1762e17ddff3203fc7f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165468
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <[email protected]>

diff --git a/sd/source/ui/tools/IdleDetection.cxx 
b/sd/source/ui/tools/IdleDetection.cxx
index 988bd849bf0e..ef4cc0521c52 100644
--- a/sd/source/ui/tools/IdleDetection.cxx
+++ b/sd/source/ui/tools/IdleDetection.cxx
@@ -77,7 +77,7 @@ IdleState IdleDetection::CheckSlideShowRunning()
         if (pBase != nullptr)
         {
             rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( 
*pBase ) );
-            if( xSlideShow.is() && xSlideShow->isRunning() )
+            if( xSlideShow.is() && xSlideShow->isRunning() && 
!xSlideShow->IsInteractiveSlideshow()) // IASS
             {
                 if (xSlideShow->isFullScreen())
                     eResult |= IdleState::FullScreenShowActive;

Reply via email to