include/svx/unoapi.hxx                    |    6 +++
 sd/source/console/PresenterController.cxx |   11 ++++++
 sd/source/console/PresenterController.hxx |    4 ++
 sd/source/console/PresenterScreen.cxx     |   51 ++++++++++++++++++++++++++++--
 sd/source/console/PresenterScreen.hxx     |    5 ++
 sd/source/ui/slideshow/slideshowimpl.cxx  |   17 ++++++++--
 sd/source/ui/tools/IdleDetection.cxx      |    2 -
 svx/source/unodraw/unopage.cxx            |   36 +++++++++++++++++++++
 sw/source/uibase/docvw/edtwin.cxx         |    1 
 9 files changed, 126 insertions(+), 7 deletions(-)

New commits:
commit 2643084fa3d9e5c103c35b1329f74abfeefe166d
Author:     Thorsten Behrens <thorsten.behr...@allotropia.de>
AuthorDate: Thu Apr 4 21:49:44 2024 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Apr 4 21:49:44 2024 +0200

    Fixup "improve usability of variable fields"
    
    - bookmark.hxx still needed on this branch
    
    Change-Id: I0941bd7a995b7687cbb3bb75ffb06b3cdb861666

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 6ab4cba04698..418d8bf385a0 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -71,6 +71,7 @@
 #include <sfx2/lokhelper.hxx>
 
 #include <editeng/acorrcfg.hxx>
+#include <bookmark.hxx>
 #include <SwSmartTagMgr.hxx>
 #include <edtdd.hxx>
 #include <edtwin.hxx>
commit cee3b384d412194960626a4c88929bb573537cb2
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Thu Mar 28 12:22:12 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Apr 4 21:03:50 2024 +0200

    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 <armin.le.gr...@me.com>

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 39ed5506960d..55c0929d8746 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 64e8c8e11e5f..ae2b60448a52 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 (!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 7c8ab3dde951..f7e8a28b715d 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -899,4 +899,40 @@ 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;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 77d3d6007b0c382d9f5b4b7ae0b77ce53a137a87
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Thu Mar 28 16:21:24 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Apr 4 20:51:28 2024 +0200

    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 <armin.le.gr...@me.com>

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;
commit e074460a8240265d4948e4712fdc7a2d102449f2
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Tue Mar 26 18:35:21 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Apr 4 20:51:21 2024 +0200

    IASS: Fix crash with PresenterConsole
    
    When being in IASS mode and adding e.g. an effect to
    a Shape (or anything else that triggers a preview)
    and the PresenterConsole being active, we got a
    crash. That happend due to the PresenterConsole
    being initialized *twice* due to interpreting that
    preview as SlideShow start. It also closed due to
    interpreting the preview end as SlideShow end. The
    next SlideShow end then bites the dust in an already
    messed up situation.
    To solve this, SlideshowImpl::startShowImpl now only
    uses NotifyDocumentEvent "OnStartPresentation" when
    this is not a SlideShow startup.
    I also secured PresenterScreen using a local bool
    to remember if it is initialized to avoid when that
    would be done twice (also used for shutdown).
    
    Change-Id: Ice588e0783fd39ec46d90a40affcaf2f789df8ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165356
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>

diff --git a/sd/source/console/PresenterScreen.cxx 
b/sd/source/console/PresenterScreen.cxx
index cd6c20d38cc5..64e8c8e11e5f 100644
--- a/sd/source/console/PresenterScreen.cxx
+++ b/sd/source/console/PresenterScreen.cxx
@@ -240,9 +240,17 @@ void SAL_CALL PresenterScreenListener::disposing (const 
css::lang::EventObject&)
 PresenterScreen::PresenterScreen (
     const Reference<XComponentContext>& rxContext,
     css::uno::Reference<css::frame::XModel2> xModel)
-    : PresenterScreenInterfaceBase(m_aMutex),
-      mxModel(std::move(xModel)),
-      mxContextWeak(rxContext)
+: PresenterScreenInterfaceBase(m_aMutex)
+, mxModel(std::move(xModel))
+, mxController()
+, mxConfigurationControllerWeak()
+, mxContextWeak(rxContext)
+, mpPresenterController()
+, mxSavedConfiguration()
+, mpPaneContainer()
+, mxPaneFactory()
+, mxViewFactory()
+, mbIsInitialized(false)
 {
 }
 
@@ -303,6 +311,10 @@ void SAL_CALL PresenterScreen::disposing (const 
lang::EventObject& /*rEvent*/)
 
 void PresenterScreen::InitializePresenterScreen()
 {
+    // IASS: already initialized (may even assert here?)
+    if (mbIsInitialized)
+        return;
+
     try
     {
         Reference<XComponentContext> xContext (mxContextWeak);
@@ -388,6 +400,9 @@ void PresenterScreen::InitializePresenterScreen()
     catch (const Exception&)
     {
     }
+
+    // IASS: Remember we are initialized
+    mbIsInitialized = true;
 }
 
 void PresenterScreen::SwitchMonitors()
@@ -545,6 +560,10 @@ Reference<drawing::framework::XResourceId> 
PresenterScreen::GetMainPaneId (
 
 void PresenterScreen::RequestShutdownPresenterScreen()
 {
+    // IASS: only cleanup when we are initialized
+    if (!mbIsInitialized)
+        return;
+
     // Restore the configuration that was active before the presenter screen
     // has been activated.  Now, that the presenter screen is displayed in
     // its own top level window this probably not necessary, but one never 
knows.
@@ -567,6 +586,9 @@ void PresenterScreen::RequestShutdownPresenterScreen()
             [pSelf](bool){ return pSelf->ShutdownPresenterScreen(); });
         xCC->update();
     }
+
+    // IASS: reset to non-initialized
+    mbIsInitialized = false;
 }
 
 void PresenterScreen::ShutdownPresenterScreen()
diff --git a/sd/source/console/PresenterScreen.hxx 
b/sd/source/console/PresenterScreen.hxx
index 0445311b9603..430384a45c6d 100644
--- a/sd/source/console/PresenterScreen.hxx
+++ b/sd/source/console/PresenterScreen.hxx
@@ -139,6 +139,9 @@ private:
     css::uno::Reference<css::drawing::framework::XResourceFactory> 
mxPaneFactory;
     css::uno::Reference<css::drawing::framework::XResourceFactory> 
mxViewFactory;
 
+    // IASS: Flag to note if InitializePresenterScreen() was executed
+    bool mbIsInitialized;
+
     class ViewDescriptor
     {
     public:
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx 
b/sd/source/ui/slideshow/slideshowimpl.cxx
index 4987a598ae1a..8b5a5977c8cb 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -644,6 +644,8 @@ void SlideshowImpl::disposing(std::unique_lock<std::mutex>&)
 #ifdef ENABLE_SDREMOTE
     RemoteServer::presentationStopped();
 #endif
+    // IASS: This is the central methodology to 'steer' the
+    // PresenterConsole - in this case, to shut it down
     if( mxShow.is() && mpDoc )
         NotifyDocumentEvent(
             *mpDoc,
@@ -1314,9 +1316,18 @@ bool SlideshowImpl::startShowImpl( const Sequence< 
beans::PropertyValue >& aProp
         mxListenerProxy.set( new SlideShowListenerProxy( this, mxShow ) );
         mxListenerProxy->addAsSlideShowListener();
 
-        NotifyDocumentEvent(
-            *mpDoc,
-            "OnStartPresentation");
+        // IASS: Do only startup the PresenterConsole if this is not
+        // the SlideShow Preview mode (else would be double)
+        if (!mbInterActiveSetup)
+        {
+            // IASS: This is the central methodology to 'steer' the
+            // PresenterConsole - in this case, to start it up and make
+            // it visible (if activated)
+            NotifyDocumentEvent(
+                *mpDoc,
+                "OnStartPresentation");
+        }
+
         displaySlideIndex( mpSlideController->getStartSlideIndex() );
 
         return true;

Reply via email to