summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/svx/unoapi.hxx6
-rw-r--r--sd/source/console/PresenterController.cxx11
-rw-r--r--sd/source/console/PresenterController.hxx4
-rw-r--r--sd/source/console/PresenterScreen.cxx23
-rw-r--r--sd/source/console/PresenterScreen.hxx2
-rw-r--r--svx/source/unodraw/unopage.cxx36
6 files changed, 82 insertions, 0 deletions
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()
{