summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-01-25 10:35:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-01-26 10:05:24 +0000
commitd4237bfb17101c6158ff98a6930e03aec94df314 (patch)
tree990b2423058e433500bf0f342b6a60224e492eb3 /sd
parent6b1f83880372868fb61c84dbe3230910cdbb386f (diff)
GetDrawController should return pointer
since it may be nullptr Change-Id: Id618ef6a25a8432024a67170a7d1402cb0fa6b8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146157 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx2
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx4
-rw-r--r--sd/source/ui/inc/ViewShellBase.hxx2
-rw-r--r--sd/source/ui/sidebar/LayoutMenu.cxx17
-rw-r--r--sd/source/ui/sidebar/MasterPagesSelector.cxx2
-rw-r--r--sd/source/ui/slideshow/SlideShowRestarter.cxx2
-rw-r--r--sd/source/ui/slideshow/slideshow.cxx2
-rw-r--r--sd/source/ui/tools/EventMultiplexer.cxx2
-rw-r--r--sd/source/ui/view/GraphicViewShellBase.cxx2
-rw-r--r--sd/source/ui/view/ImpressViewShellBase.cxx3
-rw-r--r--sd/source/ui/view/PresentationViewShellBase.cxx2
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx11
-rw-r--r--sd/source/ui/view/drviews1.cxx12
-rw-r--r--sd/source/ui/view/drviews5.cxx4
-rw-r--r--sd/source/ui/view/drviewsa.cxx2
-rw-r--r--sd/source/ui/view/outlnvsh.cxx6
-rw-r--r--sd/source/ui/view/sdview.cxx4
-rw-r--r--sd/source/ui/view/viewshel.cxx4
18 files changed, 42 insertions, 41 deletions
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 156eb3ee33a7..6578f3eb3c27 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -293,7 +293,7 @@ IMPL_LINK(CustomAnimationPane,EventMultiplexerListener,
{
if( mrBase.GetMainViewShell()->GetShellType() == ViewShell::ST_IMPRESS )
{
- mxView.set(mrBase.GetDrawController(), UNO_QUERY);
+ mxView = mrBase.GetDrawController();
onSelectionChanged();
onChangeCurrentPage();
break;
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 30f642d9533b..313edb6627ec 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -237,7 +237,7 @@ void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxV
// With the view in the center pane the sub controller is
// released, too.
- mpBase->GetDrawController().SetSubController(
+ mpBase->GetDrawController()->SetSubController(
Reference<drawing::XDrawSubController>());
SfxViewShell* pSfxViewShell = pViewShell->GetViewShell();
@@ -485,7 +485,7 @@ void BasicViewFactory::ActivateCenterView (
if (mpBase->GetDocShell()->IsInPlaceActive())
mpBase->GetViewFrame()->Resize(true);
- mpBase->GetDrawController().SetSubController(
+ mpBase->GetDrawController()->SetSubController(
rpDescriptor->mpViewShell->CreateSubController());
}
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx
index 7fc4af2a2da0..06b46514a487 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -198,7 +198,7 @@ public:
std::shared_ptr<ToolBarManager> const & GetToolBarManager() const;
std::shared_ptr<FormShellManager> const & GetFormShellManager() const;
- DrawController& GetDrawController() const;
+ DrawController* GetDrawController() const;
void SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar);
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index 26d26d507715..bb808be34ebb 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -507,14 +507,15 @@ void LayoutMenu::Fill()
OUString sCenterPaneViewName;
try
{
- Reference<XControllerManager> xControllerManager (
- Reference<XWeak>(&mrBase.GetDrawController()), UNO_QUERY_THROW);
- Reference<XResourceId> xPaneId (ResourceId::create(
- ::comphelper::getProcessComponentContext(),
- FrameworkHelper::msCenterPaneURL));
- Reference<XView> xView (FrameworkHelper::Instance(mrBase)->GetView(xPaneId));
- if (xView.is())
- sCenterPaneViewName = xView->getResourceId()->getResourceURL();
+ if (mrBase.GetDrawController())
+ {
+ Reference<XResourceId> xPaneId (ResourceId::create(
+ ::comphelper::getProcessComponentContext(),
+ FrameworkHelper::msCenterPaneURL));
+ Reference<XView> xView (FrameworkHelper::Instance(mrBase)->GetView(xPaneId));
+ if (xView.is())
+ sCenterPaneViewName = xView->getResourceId()->getResourceURL();
+ }
}
catch (RuntimeException&)
{}
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx
index 884a955c1bc2..4dfc5f30bfc9 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx
@@ -259,7 +259,7 @@ void MasterPagesSelector::ExecuteCommand(const OString &rIdent)
sal_uInt16 nIndex = mxPreviewValueSet->GetSelectedItemId();
pDispatcher->Execute(SID_MASTERPAGE, SfxCallMode::SYNCHRON);
mxPreviewValueSet->SelectItem (nIndex);
- mrBase.GetDrawController().setCurrentPage(xSelectedMaster);
+ mrBase.GetDrawController()->setCurrentPage(xSelectedMaster);
}
}
}
diff --git a/sd/source/ui/slideshow/SlideShowRestarter.cxx b/sd/source/ui/slideshow/SlideShowRestarter.cxx
index 639d80c32e87..b46d1b3d0b84 100644
--- a/sd/source/ui/slideshow/SlideShowRestarter.cxx
+++ b/sd/source/ui/slideshow/SlideShowRestarter.cxx
@@ -132,7 +132,7 @@ void SlideShowRestarter::StartPresentation()
//being called during the configuration update event on exit. At this point
//newly created objects won't get disposed called on them, because the
//disposer is doing its last execution of that now.
- if (mpViewShellBase && mpViewShellBase->GetDrawController().IsDisposing())
+ if (mpViewShellBase && mpViewShellBase->GetDrawController()->IsDisposing())
return;
if (mpDispatcher == nullptr && mpViewShellBase!=nullptr)
diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx
index 194cb3c62804..ec070d0919c7 100644
--- a/sd/source/ui/slideshow/slideshow.cxx
+++ b/sd/source/ui/slideshow/slideshow.cxx
@@ -736,7 +736,7 @@ void SAL_CALL SlideShow::end()
else
{
DrawController& rDrawController =
- mpCurrentViewShellBase->GetDrawController();
+ *mpCurrentViewShellBase->GetDrawController();
rDrawController.setCurrentPage(
Reference<XDrawPage>(
mpDoc->GetSdPage(xController->getRestoreSlide(), PageKind::Standard)->getUnoPage(),
diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx
index 26d43b9b6dc6..d106a937f284 100644
--- a/sd/source/ui/tools/EventMultiplexer.cxx
+++ b/sd/source/ui/tools/EventMultiplexer.cxx
@@ -211,7 +211,7 @@ EventMultiplexer::Implementation::Implementation (ViewShellBase& rBase)
StartListening (*mpDocument);
// Listen for configuration changes.
- DrawController& rDrawController = mrBase.GetDrawController();
+ DrawController& rDrawController = *mrBase.GetDrawController();
Reference<XConfigurationController> xConfigurationController (
rDrawController.getConfigurationController());
diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx
index 573c9fc2a058..98706271ebf9 100644
--- a/sd/source/ui/view/GraphicViewShellBase.cxx
+++ b/sd/source/ui/view/GraphicViewShellBase.cxx
@@ -85,7 +85,7 @@ void GraphicViewShellBase::Execute(SfxRequest& rRequest)
void GraphicViewShellBase::InitializeFramework()
{
- rtl::Reference<sd::DrawController> xController(&GetDrawController());
+ rtl::Reference<sd::DrawController> xController(GetDrawController());
sd::framework::DrawModule::Initialize(xController);
}
diff --git a/sd/source/ui/view/ImpressViewShellBase.cxx b/sd/source/ui/view/ImpressViewShellBase.cxx
index 9b28213970ec..c28a00e7989d 100644
--- a/sd/source/ui/view/ImpressViewShellBase.cxx
+++ b/sd/source/ui/view/ImpressViewShellBase.cxx
@@ -88,8 +88,7 @@ void ImpressViewShellBase::Execute (SfxRequest& rRequest)
void ImpressViewShellBase::InitializeFramework()
{
- rtl::Reference<sd::DrawController>
- xController (&GetDrawController());
+ rtl::Reference<sd::DrawController> xController(GetDrawController());
sd::framework::ImpressModule::Initialize(xController);
}
diff --git a/sd/source/ui/view/PresentationViewShellBase.cxx b/sd/source/ui/view/PresentationViewShellBase.cxx
index 9c1faff02713..5a0f13d75881 100644
--- a/sd/source/ui/view/PresentationViewShellBase.cxx
+++ b/sd/source/ui/view/PresentationViewShellBase.cxx
@@ -85,7 +85,7 @@ PresentationViewShellBase::~PresentationViewShellBase()
void PresentationViewShellBase::InitializeFramework()
{
- rtl::Reference<sd::DrawController> xController (&GetDrawController());
+ rtl::Reference<sd::DrawController> xController (GetDrawController());
sd::framework::PresentationModule::Initialize(xController);
}
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 3bebad697786..a3a154ce0ee6 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -306,9 +306,10 @@ void ViewShellBase::LateInit (const OUString& rsDefaultView)
try
{
- Reference<XControllerManager> xControllerManager (GetDrawController(), UNO_QUERY_THROW);
- Reference<XConfigurationController> xConfigurationController (
- xControllerManager->getConfigurationController());
+ rtl::Reference<::sd::DrawController> xControllerManager (GetDrawController());
+ Reference<XConfigurationController> xConfigurationController;
+ if (xControllerManager)
+ xConfigurationController = xControllerManager->getConfigurationController();
if (xConfigurationController.is())
{
OUString sView (rsDefaultView);
@@ -937,11 +938,11 @@ std::shared_ptr<FormShellManager> const & ViewShellBase::GetFormShellManager() c
return mpImpl->mpFormShellManager;
}
-DrawController& ViewShellBase::GetDrawController() const
+DrawController* ViewShellBase::GetDrawController() const
{
OSL_ASSERT(mpImpl != nullptr);
- return *mpImpl->mpController;
+ return mpImpl->mpController.get();
}
void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar)
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 2cddc0cea1c6..efd54a520f8b 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -256,7 +256,7 @@ void DrawViewShell::SelectionHasChanged()
mpDrawView->UpdateSelectionClipboard();
- GetViewShellBase().GetDrawController().FireSelectionChangeListener();
+ GetViewShellBase().GetDrawController()->FireSelectionChangeListener();
}
namespace {
@@ -344,8 +344,8 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
eEMode = EditMode::MasterPage;
}
- GetViewShellBase().GetDrawController().FireChangeEditMode (eEMode == EditMode::MasterPage);
- GetViewShellBase().GetDrawController().FireChangeLayerMode (bIsLayerModeActive);
+ GetViewShellBase().GetDrawController()->FireChangeEditMode (eEMode == EditMode::MasterPage);
+ GetViewShellBase().GetDrawController()->FireChangeLayerMode (bIsLayerModeActive);
if ( mpDrawView->IsTextEdit() )
{
@@ -359,7 +359,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
pLayerBar->EndEditMode();
maTabControl->EndEditMode();
- GetViewShellBase().GetDrawController().BroadcastContextChange();
+ GetViewShellBase().GetDrawController()->BroadcastContextChange();
meEditMode = eEMode;
@@ -1051,7 +1051,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, bool bAllowChangeFocus)
mpDrawView->HideSdrPage();
maTabControl->SetCurPageId(maTabControl->GetPageId(nSelectedPage));
mpDrawView->ShowSdrPage(mpActualPage);
- GetViewShellBase().GetDrawController().FireSwitchCurrentPage(mpActualPage);
+ GetViewShellBase().GetDrawController()->FireSwitchCurrentPage(mpActualPage);
SdrPageView* pNewPageView = mpDrawView->GetSdrPageView();
@@ -1120,7 +1120,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, bool bAllowChangeFocus)
sal_uInt16 nNum = pMaster->GetPageNum();
mpDrawView->ShowSdrPage(mpDrawView->GetModel()->GetMasterPage(nNum));
- GetViewShellBase().GetDrawController().FireSwitchCurrentPage(pMaster);
+ GetViewShellBase().GetDrawController()->FireSwitchCurrentPage(pMaster);
SdrPageView* pNewPageView = mpDrawView->GetSdrPageView();
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index 3eb9f39c376f..0ad1a18a6c2c 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -573,7 +573,7 @@ void DrawViewShell::VisAreaChanged(const ::tools::Rectangle& rRect)
{
ViewShell::VisAreaChanged( rRect );
- DrawController& rController = GetViewShellBase().GetDrawController();
+ DrawController& rController = *GetViewShellBase().GetDrawController();
rController.FireVisAreaChanged (rRect);
}
@@ -626,7 +626,7 @@ void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
*this,
*GetView()));
css::uno::Reference< css::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer();
- GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer );
+ GetViewShellBase().GetDrawController()->fireChangeLayer( &rLayer );
}
}
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index a345af61331b..b09944043c24 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -110,7 +110,7 @@ DrawViewShell::DrawViewShell( ViewShellBase& rViewShellBase, vcl::Window* pParen
, mbIsInSwitchPage(false)
, mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
[this] () { return this->GetSidebarContextName(); },
- uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()),
+ uno::Reference<frame::XController>(rViewShellBase.GetDrawController()),
vcl::EnumContext::Context::Default))
, mbMouseButtonDown(false)
, mbMouseSelecting(false)
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 10a6e7620afe..1d3bd9500841 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -1332,7 +1332,7 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet)
//Now, CurrentPage property change is already sent for DrawView and OutlineView, so it is not necessary to send again here
if(m_StrOldPageName!=aPageStr)
{
- GetViewShellBase().GetDrawController().fireSwitchCurrentPage(nPos);
+ GetViewShellBase().GetDrawController()->fireSwitchCurrentPage(nPos);
m_StrOldPageName = aPageStr;
}
}
@@ -1812,7 +1812,7 @@ void OutlineViewShell::VisAreaChanged(const ::tools::Rectangle& rRect)
{
ViewShell::VisAreaChanged( rRect );
- GetViewShellBase().GetDrawController().FireVisAreaChanged(rRect);
+ GetViewShellBase().GetDrawController()->FireVisAreaChanged(rRect);
}
/** If there is a valid controller then create a new instance of
@@ -1870,7 +1870,7 @@ void OutlineViewShell::SetCurrentPage (SdPage* pPage)
false);
GetDoc()->SetSelected (pPage, true);
- DrawController& rController(GetViewShellBase().GetDrawController());
+ DrawController& rController(*GetViewShellBase().GetDrawController());
rController.FireSelectionChangeListener();
rController.FireSwitchCurrentPage (pPage);
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 153284bdc414..cc217bfb8ba2 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -705,7 +705,7 @@ bool View::SdrBeginTextEdit(
if ( mpViewSh )
{
- mpViewSh->GetViewShellBase().GetDrawController().FireSelectionChangeListener();
+ mpViewSh->GetViewShellBase().GetDrawController()->FireSelectionChangeListener();
if (pObj && pObj->GetObjIdentifier() == SdrObjKind::Table)
mpViewSh->UpdateScrollBars();
@@ -808,7 +808,7 @@ SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally)
{
if ( mpViewSh )
{
- mpViewSh->GetViewShellBase().GetDrawController().FireSelectionChangeListener();
+ mpViewSh->GetViewShellBase().GetDrawController()->FireSelectionChangeListener();
if (comphelper::LibreOfficeKit::isActive())
SfxLokHelper::notifyOtherViews(&mpViewSh->GetViewShellBase(), LOK_CALLBACK_VIEW_LOCK, "rectangle", "EMPTY");
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index e12f65236dd9..a3cbfe8d896d 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -1572,11 +1572,11 @@ void ViewShell::SwitchActiveViewFireFocus()
// move these two methods from DrawViewShell.
void ViewShell::fireSwitchCurrentPage(sal_Int32 pageIndex)
{
- GetViewShellBase().GetDrawController().fireSwitchCurrentPage(pageIndex);
+ GetViewShellBase().GetDrawController()->fireSwitchCurrentPage(pageIndex);
}
void ViewShell::NotifyAccUpdate( )
{
- GetViewShellBase().GetDrawController().NotifyAccUpdate();
+ GetViewShellBase().GetDrawController()->NotifyAccUpdate();
}
weld::Window* ViewShell::GetFrameWeld() const