41#include <com/sun/star/document/XEventBroadcaster.hpp>
42#include <com/sun/star/beans/XPropertySet.hpp>
43#include <com/sun/star/frame/FrameActionEvent.hpp>
44#include <com/sun/star/frame/FrameAction.hpp>
60 mbListeningToDocument (false),
61 mbListeningToUNODocument (false),
62 mbListeningToController (false),
63 mbListeningToFrame (false),
64 mbIsMainViewChangePending(false)
71 Reference<document::XEventBroadcaster> xBroadcaster (
73 if (xBroadcaster.is())
75 xBroadcaster->addEventListener (
this);
80 Reference<XComponent> xComponent (xBroadcaster, UNO_QUERY);
82 xComponent->addEventListener (
83 Reference<lang::XEventListener>(
84 static_cast<XWeak*
>(
this), UNO_QUERY));
87 bool bIsMainViewShell (
false);
89 if (pViewShell !=
nullptr)
91 if ( ! bIsMainViewShell)
94 Reference<frame::XFrame>
xFrame;
101 xFrame->addFrameActionListener(Reference<frame::XFrameActionListener>(
this));
114 if (pMainViewShell !=
nullptr
115 && pMainViewShell!=pViewShell)
128 "sd::Listener::~Listener(), disposing() was not called, ask DBO!" );
142 Reference<document::XEventBroadcaster> xBroadcaster (
144 if (xBroadcaster.is())
145 xBroadcaster->removeEventListener (
this);
148 Reference<XComponent> xComponent (xBroadcaster, UNO_QUERY);
150 xComponent->removeEventListener (
151 Reference<lang::XEventListener>(
152 static_cast<XWeak*
>(
this), UNO_QUERY));
163 xFrame->removeFrameActionListener(Reference<frame::XFrameActionListener>(
this));
189 Reference<beans::XPropertySet> xSet (
xController, UNO_QUERY);
194 xSet->addPropertyChangeListener(
"CurrentPage",
this);
196 catch (beans::UnknownPropertyException&)
202 xSet->addPropertyChangeListener(
"IsMasterPageMode",
this);
204 catch (beans::UnknownPropertyException&)
214 Reference<lang::XEventListener>(
static_cast<XWeak*
>(
this), UNO_QUERY));
227 Reference<beans::XPropertySet> xSet (
xController, UNO_QUERY);
233 xSet->removePropertyChangeListener(
"CurrentPage",
this );
234 xSet->removePropertyChangeListener(
"IsMasterPageMode",
this);
240 Reference<lang::XEventListener>(
241 static_cast<XWeak*
>(
this), UNO_QUERY));
243 catch (beans::UnknownPropertyException&)
256 if (rHint.
GetId() == SfxHintId::ThisIsAnSdrHint)
261 case SdrHintKind::ModelCleared:
268 case SdrHintKind::PageOrderChange:
277 else if (rHint.
GetId() == SfxHintId::DocChanged)
282 else if (
auto pViewShellHint =
dynamic_cast<const ViewShellHint*
>(&rHint))
284 switch (pViewShellHint->GetHintId())
321 switch (rEvent.meEventId)
325 if (mpBase !=
nullptr)
327 ViewShell* pMainViewShell = mpBase->GetMainViewShell().get();
328 if (pMainViewShell !=
nullptr)
329 EndListening(*pMainViewShell);
335 mbIsMainViewChangePending =
true;
339 if (mbIsMainViewChangePending && mpBase !=
nullptr)
341 mbIsMainViewChangePending =
false;
342 ViewShell* pMainViewShell = mpBase->GetMainViewShell().get();
343 if (pMainViewShell !=
nullptr
353 ConnectToController();
360 DisconnectFromController();
366 HandleShapeModification(
static_cast<const SdrPage*
>(rEvent.mpUserData));
370 if (rEvent.mpUserData !=
nullptr)
373 HandleShapeModification(
pObject->getSdrPageFromSdrObject());
385 const lang::EventObject& rEventObject)
389 && rEventObject.Source
398 if (rEventObject.Source == xController)
408 const document::EventObject& )
415 const PropertyChangeEvent& rEvent)
419 throw lang::DisposedException (
"SlideSorterController object has already been disposed",
420 static_cast<uno::XWeak*
>(
this));
423 if (rEvent.PropertyName ==
"CurrentPage")
425 Any aCurrentPage = rEvent.NewValue;
426 Reference<beans::XPropertySet> xPageSet (aCurrentPage, UNO_QUERY);
431 Any aPageNumber = xPageSet->getPropertyValue (
"Number");
432 sal_Int32 nCurrentPage = 0;
433 aPageNumber >>= nCurrentPage;
441 catch (beans::UnknownPropertyException&)
445 catch (lang::DisposedException&)
452 else if (rEvent.PropertyName ==
"IsMasterPageMode")
454 bool bIsMasterPageMode =
false;
455 rEvent.NewValue >>= bIsMasterPageMode;
465 switch (rEvent.Action)
467 case frame::FrameAction_COMPONENT_DETACHING:
471 case frame::FrameAction_COMPONENT_REATTACHED:
487 const AccessibleEventObject& )
501 Reference<beans::XPropertySet> xSet (
xController, UNO_QUERY);
502 bool bIsMasterPageMode =
false;
507 Any aValue (xSet->getPropertyValue(
"IsMasterPageMode" ));
508 aValue >>= bIsMasterPageMode;
510 catch (beans::UnknownPropertyException&)
514 bIsMasterPageMode =
false;
541 if (pDocument !=
nullptr
556 if (pPage ==
nullptr)
562 if ( ! pCacheManager)
565 if (pDocument ==
nullptr)
567 OSL_ASSERT(pDocument!=
nullptr);
570 pCacheManager->InvalidatePreviewBitmap(pDocument->
getUnoModel(), pPage);
586 pCacheManager->InvalidatePreviewBitmap(pDocument->
getUnoModel(), pCandidate);
@ ControllerDetached
A UNO controller has been detached to the UNO frame.
@ ShapeRemoved
A shape has been removed from a page.
@ EndTextEdit
Text editing in one of the shapes in the MainViewShell has ended.
@ MainViewRemoved
The current MainViewShell (the ViewShell displayed in the center pane) has been removed.
@ ShapeChanged
The state of a shape has changed.
@ MainViewAdded
A new ViewShell has been made the MainViewShell.
@ ConfigurationUpdated
A configuration update has been completed.
@ ShapeInserted
A shape has been inserted to a page.
@ ControllerAttached
A UNO controller has been attached to the UNO frame.
SlideSorterController & mrController
SlideSorter & mrSlideSorter
sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
const SdrPage * GetPage() const
SdrHintKind GetKind() const
css::uno::Reference< css::uno::XInterface > const & getUnoModel()
SdrPage & TRG_GetMasterPage() const
bool IsMasterPage() const
bool TRG_HasMasterPage() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
std::shared_ptr< ViewShell > GetMainViewShell() const
Return the main view shell stacked on the called ViewShellBase object.
std::shared_ptr< tools::EventMultiplexer > const & GetEventMultiplexer() const
Return an event multiplexer.
Local derivation of the SfxHint class that defines some hint ids that are used by the ViewShell class...
@ HINT_CHANGE_EDIT_MODE_END
@ HINT_COMPLEX_MODEL_CHANGE_END
@ HINT_COMPLEX_MODEL_CHANGE_START
@ HINT_CHANGE_EDIT_MODE_START
Base class of the stacked shell hierarchy.
bool IsMainViewShell() const
Return <TRUE> when the called view shell is the main sub shell of its ViewShellBase object,...
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
css::uno::Reference< css::frame::XController > GetXController() const
Return the XController object of the main view.
ViewShell * GetViewShell() const
Return the view shell that was given at construction.
model::SlideSorterModel & GetModel() const
view::SlideSorterView & GetView() const
static std::shared_ptr< PageCacheManager > Instance()
Return the one instance of the PageCacheManager class.
Listen for events of various types and sources and react to them.
css::uno::WeakReference< css::frame::XFrame > mxFrameWeak
void HandleModelChange(const SdrPage *pPage)
Handle a change in the order of slides or when the set of slides has changed, i.e.
void DisconnectFromController()
Disconnect from the current controller of the view shell as listener.
css::uno::WeakReference< css::frame::XController > mxControllerWeak
bool mbListeningToFrame
Remember whether we are listening to the frame.
void ConnectToController()
Connect to the current controller of the view shell as listener.
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent &rEvent) override
For certain actions the listener connects to a new controller of the frame it is listening to.
virtual void SAL_CALL notifyEvent(const css::document::EventObject &rEventObject) override
virtual void Notify(SfxBroadcaster &rBroadcaster, const SfxHint &rHint) override
bool mbListeningToDocument
Remember whether we are listening to the document.
std::shared_ptr< SlideSorterController::ModelChangeLock > mpModelChangeLock
This object is used to lock the model between some events.
Listener(SlideSorter &rSlideSorter)
void HandleShapeModification(const SdrPage *pPage)
Handle a modification to a shape on the given page.
bool mbListeningToController
Remember whether we are listening to the UNO controller.
SlideSorterController & mrController
virtual ~Listener() override
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &rEvent) override
SlideSorter & mrSlideSorter
void UpdateEditMode()
Called when the edit mode has changed.
bool mbListeningToUNODocument
Remember whether we are listening to the UNO document.
virtual void SAL_CALL disposing(const css::lang::EventObject &rEventObject) override
void GetCoreSelection()
Update the selection state of all page descriptors to be the same as that of the corresponding pages ...
void SelectPage(int nPageIndex)
Select the specified descriptor.
Create an object of this inner class to prevent updates due to model changes.
void HandleModelChange()
Handle a change of the model, that is, handle the removal and insertion of whole pages or a change of...
void PrepareEditModeChange()
Prepare for a change of the edit mode.
void ChangeEditMode(EditMode eEditMode)
Set a new edit mode and return whether the edit mode really has been changed.
std::shared_ptr< CurrentSlideManager > const & GetCurrentSlideManager() const
void CheckForSlideTransitionAssignment()
std::shared_ptr< SelectionManager > const & GetSelectionManager() const
SD_DLLPUBLIC PageSelector & GetPageSelector()
void CheckForMasterPageAssignment()
void FinishEditModeChange()
Finish the change of the edit mode.
bool NotifyPageEvent(const SdrPage *pPage)
Typically called from controller::Listener this method handles the insertion and deletion of single p...
SdDrawDocument * GetDocument()
This method is present to let the view create a ShowView for displaying slides.
std::shared_ptr< cache::PageCache > const & GetPreviewCache()
#define DBG_ASSERT(sCon, aError)
#define DBG_UNHANDLED_EXCEPTION(...)
virtual std::shared_ptr< SfxDialogController > GetController() override
EmbeddedObjectRef * pObject
#define LINK(Instance, Class, Member)
IMPL_LINK(SlideSorterController, ApplicationEventHandler, VclSimpleEvent &, rEvent, void)
Reference< XController > xController
Reference< XFrame > xFrame