37#include <com/sun/star/beans/PropertyAttribute.hpp>
38#include <com/sun/star/drawing/XDrawSubController.hpp>
39#include <com/sun/star/drawing/XLayer.hpp>
52using namespace ::
cppu;
64 mpCurrentLayer(
nullptr),
65 m_aSelectionTypeIdentifier(
68 mpCurrentPage(
nullptr),
69 mbMasterPageMode(
false),
73 ProvideFrameworkControllers();
81 const Reference<drawing::XDrawSubController>& rxSubController)
106 OTypeCollection aTypeCollection (
111 return ::comphelper::concatSequences(
112 SfxBaseController::getTypes(),
113 aTypeCollection.getTypes(),
114 DrawControllerInterfaceBase::getTypes());
133 std::shared_ptr<ViewShell> pViewShell;
138 pViewShell->DeactivateCurrentFunction();
139 auto* pView = pViewShell->GetView();
141 pView->getSearchContext().resetSearchFunction();
154 OPropertySetHelper::disposing();
162 const Reference<lang::XEventListener >& xListener)
169 const Reference<lang::XEventListener >& aListener)
185 if( xSlideShow.is() && xSlideShow->dependsOn(pViewShellBase) )
199 return "DrawController" ;
202constexpr OUStringLiteral
ssServiceName =
u"com.sun.star.drawing.DrawingDocumentDrawView";
213 return aSupportedServices;
240 const Reference< view::XSelectionChangeListener >& xListener)
243 throw lang::DisposedException();
249 const Reference< view::XSelectionChangeListener >& xListener )
252 throw lang::DisposedException();
277 OInterfaceIteratorHelper aIterator (*pListeners);
278 while (aIterator.hasMoreElements())
282 view::XSelectionChangeListener* pListener =
283 static_cast<view::XSelectionChangeListener*
>(
285 if (pListener !=
nullptr)
286 pListener->selectionChanged (rEvent);
309 Reference<drawing::XDrawPage> xPage;
319 xPage.set(pPage->getUnoPage(), UNO_QUERY);
326 if( maLastVisArea == rVisArea )
330 aNewValue <<= awt::Rectangle(
334 rVisArea.GetHeight() );
337 aOldValue <<= awt::Rectangle(
338 maLastVisArea.Left(),
340 maLastVisArea.GetWidth(),
341 maLastVisArea.GetHeight() );
343 FirePropertyChange (PROPERTY_WORKAREA, aNewValue, aOldValue);
345 maLastVisArea = rVisArea;
355 Reference< XInterface > xSource(
static_cast<XWeak*
>(
this) );
356 const lang::EventObject
aEvent( xSource );
359 OInterfaceIteratorHelper aIt( *pLC);
360 while( aIt.hasMoreElements() )
364 view::XSelectionChangeListener * pL =
365 static_cast<view::XSelectionChangeListener*
>(aIt.next());
367 pL->selectionChanged(
aEvent );
377 if (bMasterPageMode != mbMasterPageMode )
380 PROPERTY_MASTERPAGEMODE,
381 Any(bMasterPageMode),
382 Any(mbMasterPageMode));
384 mbMasterPageMode = bMasterPageMode;
390 if (bLayerMode != mbLayerMode)
397 mbLayerMode = bLayerMode;
404 if (pNewCurrentPage == pCurrentPage.get())
410 Any(Reference<drawing::XDrawPage>(pNewCurrentPage->getUnoPage(), UNO_QUERY)));
413 if (pCurrentPage !=
nullptr)
415 Reference<drawing::XDrawPage> xOldPage (pCurrentPage->getUnoPage(), UNO_QUERY);
416 aOldValue <<= xOldPage;
421 mpCurrentPage = pNewCurrentPage;
423 catch (
const uno::Exception&)
432 Any aNewValue, aOldValue;
438 if( pCurrentLayer != mpCurrentLayer )
440 sal_Int32
nHandle = PROPERTY_ACTIVE_LAYER;
442 Any aNewValue ( *pCurrentLayer);
446 fire (&
nHandle, &aNewValue, &aOldValue, 1,
false);
448 mpCurrentLayer = pCurrentLayer;
460 aNewValue <<= pageIndex;
463 sal_Int32 nHandles = PROPERTY_PAGE_CHANGE;
464 fire( &nHandles, &aNewValue, &aOldValue, 1,
false );
469 const Any& rNewValue,
470 const Any& rOldValue)
492 EnumContext::Context eContext (EnumContext::Context::Unknown);
493 switch (pViewShell->GetShellType())
500 eContext = EnumContext::Context::DrawPage;
504 eContext = EnumContext::Context::NotesPage;
508 eContext = EnumContext::Context::HandoutPage;
512 eContext = EnumContext::Context::OutlineText;
516 eContext = EnumContext::Context::SlidesorterPage;
522 eContext = EnumContext::Context::Empty;
537Reference<XConfigurationController> SAL_CALL
545Reference<XModuleController> SAL_CALL
556 ::std::vector<beans::Property>& rProperties)
558 rProperties.emplace_back(
"VisibleArea",
561 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY);
562 rProperties.emplace_back(
566 beans::PropertyAttribute::BOUND);
567 rProperties.emplace_back(
571 beans::PropertyAttribute::BOUND );
572 rProperties.emplace_back(
"IsLayerMode",
575 beans::PropertyAttribute::BOUND );
576 rProperties.emplace_back(
"IsMasterPageMode",
579 beans::PropertyAttribute::BOUND );
580 rProperties.emplace_back(
"ActiveLayer",
583 beans::PropertyAttribute::BOUND );
584 rProperties.emplace_back(
"ZoomValue",
587 beans::PropertyAttribute::BOUND );
588 rProperties.emplace_back(
"ZoomType",
591 beans::PropertyAttribute::BOUND );
592 rProperties.emplace_back(
"ViewOffset",
595 beans::PropertyAttribute::BOUND );
596 rProperties.emplace_back(
"DrawViewMode",
599 beans::PropertyAttribute::BOUND|beans::PropertyAttribute::READONLY|beans::PropertyAttribute::MAYBEVOID );
601 rProperties.emplace_back(
"UpdateAcc",
604 beans::PropertyAttribute::BOUND );
605 rProperties.emplace_back(
"PageChange",
608 beans::PropertyAttribute::BOUND );
640 ::sd::Window* pWindow = pViewShell ? pViewShell->GetActiveWindow() :
nullptr;
642 uno::Reference< form::runtime::XFormController >
xController;
643 if ( pFormShell && pSdrView && pWindow )
652 bool bIsDesignMode =
true;
658 return bIsDesignMode;
677 ::sd::Window* pWindow = pViewShell ? pViewShell->GetActiveWindow() :
nullptr;
679 uno::Reference< awt::XControl > xControl;
680 if ( pFormShell && pSdrView && pWindow )
686 Any & rConvertedValue,
691 bool bResult =
false;
696 rConvertedValue <<= Reference<drawing::XDrawSubController>(rValue, UNO_QUERY);
697 bResult = (rOldValue != rConvertedValue);
701 rConvertedValue = rValue;
705 bResult = (rOldValue != rConvertedValue);
707 catch (
const beans::UnknownPropertyException&)
710 throw css::lang::IllegalArgumentException();
723 SetSubController(Reference<drawing::XDrawSubController>(rValue, UNO_QUERY));
730 sal_Int32 nHandle )
const
737 rRet <<= awt::Rectangle(
783 SAL_WARN(
"sd",
"Calling disposed DrawController object. Throwing exception.");
784 throw lang::DisposedException (
785 "DrawController object has already been disposed",
786 const_cast<uno::XWeak*
>(
static_cast<const uno::XWeak*
>(
this)));
PropertiesInfo aProperties
static void NotifyContextChange(const css::uno::Reference< css::frame::XController > &rxController, const vcl::EnumContext::Context eContext)
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override
virtual void SAL_CALL dispose() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
void DisconnectAllClients()
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
void SAL_CALL disposing()
OBroadcastHelper & rBHelper
void SAL_CALL fire(sal_Int32 *pnHandles, const css::uno::Any *pNewValues, const css::uno::Any *pOldValues, sal_Int32 nCount, sal_Bool bVetoable)
css::uno::Sequence< css::uno::Type > getTypes()
::cppu::OBroadcastHelper maBroadcastHelper
The DrawController is the UNO controller for Impress and Draw.
virtual sal_Bool SAL_CALL select(const css::uno::Any &aSelection) override
bool mbDisposing
This flag indicates whether the called DrawController is being disposed or already has been disposed.
virtual void SAL_CALL dispose() override
virtual css::uno::Reference< css::form::runtime::XFormController > SAL_CALL getFormController(const css::uno::Reference< css::form::XForm > &Form) override
void BroadcastContextChange() const
Broadcast a sidebar context change that is caused by a view switch.
virtual css::uno::Reference< css::drawing::framework::XModuleController > SAL_CALL getModuleController() override
virtual sal_Bool SAL_CALL isFormDesignMode() override
void FireChangeEditMode(bool bMasterPageMode) noexcept
Call this method when the edit mode has changed.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Any SAL_CALL getSelection() override
void ThrowIfDisposed() const
When the called object has been disposed already this method throws a Disposed exception and does not...
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &xPage) override
virtual void SAL_CALL removeSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
ViewShellBase * mpBase
This pointer to the ViewShellBase can be NULL (after a call to ReleaseViewShellBase()).
void FireSelectionChangeListener() noexcept
Call this method when the selection has changed.
css::uno::Reference< css::drawing::XDrawSubController > mxSubController
The current sub controller.
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
Convert the value rValue and return the result in rConvertedValue and the old value in rOldValue.
void FireVisAreaChanged(const ::tools::Rectangle &rVisArea) noexcept
Call this method when the VisArea has changed.
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentPage() override
void fireChangeLayer(css::uno::Reference< css::drawing::XLayer > *pCurrentLayer) noexcept
virtual void SAL_CALL addSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
This method must return the name to index table.
void SetSubController(const css::uno::Reference< css::drawing::XDrawSubController > &rxSubController)
Replace the currently used sub controller with the given one.
virtual ~DrawController() noexcept override
void FireChangeLayerMode(bool bLayerMode) noexcept
Call this method when the layer mode has changed.
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
void DisposeFrameworkControllers()
virtual void SAL_CALL setFormDesignMode(sal_Bool DesignMode) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
rtl::Reference< sd::framework::ModuleController > mxModuleController
ViewShellBase * GetViewShellBase()
Return a pointer to the ViewShellBase object that the DrawController is connected to.
@ PROPERTY_SUB_CONTROLLER
@ PROPERTY_MASTERPAGEMODE
void ProvideFrameworkControllers()
static void FillPropertyTable(::std::vector< css::beans::Property > &rProperties)
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL selectionChanged(const css::lang::EventObject &rEvent) override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
void fireSwitchCurrentPage(sal_Int32 pageIndex) noexcept
::std::unique_ptr< ::cppu::IPropertyArrayHelper > mpPropertyArrayHelper
void FirePropertyChange(sal_Int32 nHandle, const css::uno::Any &rNewValue, const css::uno::Any &rOldValue)
Send an event to all relevant property listeners that a property has changed its value.
rtl::Reference< sd::framework::ConfigurationController > mxConfigurationController
virtual css::uno::Reference< css::awt::XControl > SAL_CALL getControl(const css::uno::Reference< css::awt::XControlModel > &xModel) override
void FireSwitchCurrentPage(SdPage *pCurrentPage) noexcept
Call this method when there is a new current page.
::unotools::WeakReference< SdPage > mpCurrentPage
const css::uno::Type m_aSelectionTypeIdentifier
::tools::Rectangle maLastVisArea
virtual css::uno::Reference< css::drawing::framework::XConfigurationController > SAL_CALL getConfigurationController() override
virtual sal_Bool SAL_CALL suspend(sal_Bool Suspend) override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
The same as getFastPropertyValue, but return the value through rValue and nHandle is always valid.
DrawController(ViewShellBase &rBase) noexcept
Create a new DrawController object for the given ViewShellBase.
void ReleaseViewShellBase()
This method is typically called from the destructor of ViewShellBase to tell the DrawController that ...
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
The same as setFastPropertyValue, but no exception is thrown and nHandle is always valid.
static rtl::Reference< SlideShow > GetSlideShow(SdDrawDocument const *pDocument)
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
std::shared_ptr< ViewShell > GetMainViewShell() const
Return the main view shell stacked on the called ViewShellBase object.
std::shared_ptr< FormShellManager > const & GetFormShellManager() const
std::shared_ptr< ViewShellManager > const & GetViewShellManager() const
virtual SdrView * GetDrawView() const override
An SdWindow contains the actual working area of ViewShell.
The configuration controller is responsible for maintaining the current configuration.
The ModuleController has two tasks:
::OutputDevice const * GetOutDev() const
#define TOOLS_WARN_EXCEPTION(area, stream)
#define SAL_WARN(area, stream)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral ssServiceName
IMPLEMENT_GET_IMPLEMENTATION_ID(DrawController)
::cppu::ImplInheritanceHelper< SfxBaseController, css::view::XSelectionSupplier, css::lang::XServiceInfo, css::drawing::XDrawView, css::view::XSelectionChangeListener, css::view::XFormLayerAccess, css::drawing::framework::XControllerManager > DrawControllerInterfaceBase
IMPLEMENT_FORWARD_XINTERFACE2(DrawController, DrawControllerInterfaceBase, OPropertySetHelper)
void addListener(const keyType &key, const css::uno::Reference< css::uno::XInterface > &r)
void removeListener(const keyType &key, const css::uno::Reference< css::uno::XInterface > &r)
OInterfaceContainerHelper *SAL_CALL getContainer(const keyType &key) const
Reference< XController > xController
Reference< XModel > xModel