summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/svdedxv.hxx4
-rw-r--r--sd/source/ui/inc/View.hxx1
-rw-r--r--sd/source/ui/view/sdview.cxx10
-rw-r--r--svx/source/svdraw/svdedxv.cxx14
4 files changed, 28 insertions, 1 deletions
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 4aac4ffed86b..70ffe3b9be0d 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -35,6 +35,7 @@ class ImpSdrEditPara;
struct PasteOrDropInfos;
class SdrUndoManager;
class TextChainCursorManager;
+class SfxViewShell;
namespace com { namespace sun { namespace star { namespace uno {
class Any;
@@ -155,6 +156,9 @@ public:
virtual void BckAction() override;
virtual void TakeActionRect(Rectangle& rRect) const override;
+ /// Get access to the view shell owning this draw view, if any.
+ virtual SfxViewShell* GetSfxViewShell() const;
+
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
virtual void ModelHasChanged() override;
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index c1b97b34e9f9..c1f52acf2a46 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -122,6 +122,7 @@ public:
inline DrawDocShell* GetDocSh() const { return mpDocSh; }
inline SdDrawDocument& GetDoc() const;
inline ViewShell* GetViewShell() const { return mpViewSh; }
+ SfxViewShell* GetSfxViewShell() const override;
virtual bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = nullptr, vcl::Window* pWin = nullptr, bool bIsNewObj = false,
SdrOutliner* pGivenOutliner = nullptr, OutlinerView* pGivenOutlinerView = nullptr,
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 5e097ddfc269..ddaf809ca7f8 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -651,6 +651,16 @@ void OutlinerMasterViewFilter::End()
}
}
+SfxViewShell* View::GetSfxViewShell() const
+{
+ SfxViewShell* pRet = nullptr;
+
+ if (mpViewSh)
+ pRet = &mpViewSh->GetViewShellBase();
+
+ return pRet;
+}
+
bool View::SdrBeginTextEdit(
SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin,
bool bIsNewObj,
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 9a4588060b71..cd6e083eac5f 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -142,6 +142,11 @@ void SdrObjEditView::TakeActionRect(Rectangle& rRect) const
}
}
+SfxViewShell* SdrObjEditView::GetSfxViewShell() const
+{
+ return nullptr;
+}
+
void SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
SdrGlueEditView::Notify(rBC,rHint);
@@ -461,7 +466,14 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, bool /*bNoP
}
pOutlView->SetControlWord(nStat);
pOutlView->SetBackgroundColor( aBackground );
- pOutlView->registerLibreOfficeKitViewCallback(SfxViewShell::Current());
+
+ // In case we're in the process of constructing a new view shell,
+ // SfxViewShell::Current() may still point to the old one. So if possible,
+ // depend on the application owning this draw view to provide the view
+ // shell.
+ SfxViewShell* pSfxViewShell = GetSfxViewShell();
+ pOutlView->registerLibreOfficeKitViewCallback(pSfxViewShell ? pSfxViewShell : SfxViewShell::Current());
+
if (pText!=nullptr)
{
pOutlView->SetAnchorMode((EVAnchorMode)(pText->GetOutlinerViewAnchorMode()));