summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-05-31 13:47:04 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2024-06-02 20:45:56 +0200
commitcb982975c16e380f88282f03d07f8cfb8421ed77 (patch)
treef5b316a71361b9f0c090e42151e250e432faee11 /svx
parente8392bc1c984da1f09674055b1bac95e12de59a6 (diff)
svx: use SAL_RET_MAYBENULL in GetSfxViewShell()
Change-Id: I05e66544c08a1ed55a5571f6061b23346235224e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168293 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdedtv1.cxx9
-rw-r--r--svx/source/svdraw/svdmrkv.cxx25
2 files changed, 22 insertions, 12 deletions
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index cff6238b8005..bf1cc6f9a638 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -1035,8 +1035,13 @@ void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, bool bOnlyHardAttr) con
}
if (!sPayload.isEmpty())
- GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US));
+ {
+ if (SfxViewShell* pViewShell = GetSfxViewShell())
+ {
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+ OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US));
+ }
+ }
}
nWhich = aIter.NextWhich();
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 1b44fb021edf..d79a899de4c8 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -257,12 +257,15 @@ void SdrMarkView::modelHasChangedLOKit()
const vcl::Window* pWin = pOut ? pOut->GetOwnerWindow() : nullptr;
if (pWin && pWin->IsChart())
{
- const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
- if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
+ if (SfxViewShell* pViewShell = GetSfxViewShell())
{
- Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
- Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
- aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
+ const vcl::Window* pViewShellWindow = pViewShell->GetEditWindowForActiveOLEObj();
+ if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
+ {
+ Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
+ Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
+ aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
+ }
}
}
}
@@ -881,7 +884,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
}
// hide the text selection too
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""_ostr);
+ if (pViewShell)
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""_ostr);
}
{
@@ -1022,7 +1026,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
+ "]");
// polygon approximating the pie segment or donut segment
- if (pO->GetObjIdentifier() == SdrObjKind::PathFill)
+ if (pViewShell && pO->GetObjIdentifier() == SdrObjKind::PathFill)
{
const basegfx::B2DPolyPolygon aPolyPolygon(pO->TakeXorPoly());
if (aPolyPolygon.count() == 1)
@@ -1199,7 +1203,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
{
sSelectionText = "EMPTY"_ostr;
sSelectionTextView = "EMPTY"_ostr;
- if (!pOtherShell)
+ if (!pOtherShell && pViewShell)
pViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection"_ostr, OString());
}
@@ -1214,9 +1218,10 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
std::stringstream aStream;
boost::property_tree::write_json(aStream, aTableJsonTree);
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, OString(aStream.str()));
+ if (pViewShell)
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, OString(aStream.str()));
}
- else if (!getSdrModelFromSdrView().IsWriter())
+ else if (!getSdrModelFromSdrView().IsWriter() && pViewShell)
{
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, "{}"_ostr);
}