diff options
Diffstat (limited to 'sfx2/source/view/lokhelper.cxx')
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 9208c6e35476..8eab6c772528 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -177,6 +177,23 @@ void SfxLokHelper::setView(int nId) } +SfxViewShell* SfxLokHelper::getViewOfId(int nId) +{ + SfxApplication* pApp = SfxApplication::Get(); + if (pApp == nullptr) + return nullptr; + + const ViewShellId nViewShellId(nId); + SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl(); + for (SfxViewShell* pViewShell : rViewArr) + { + if (pViewShell->GetViewShellId() == nViewShellId) + return pViewShell; + } + + return nullptr; +} + int SfxLokHelper::getView(const SfxViewShell* pViewShell) { if (!pViewShell) @@ -489,14 +506,16 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView, pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_WINDOW, s.getStr()); } -void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OString& rPayload) +void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, tools::Rectangle const* pRect) { - OStringBuffer aBuf(32); - if (DisableCallbacks::disabled()) return; - aBuf.append(rPayload); + OStringBuffer aBuf(64); + if (pRect) + aBuf.append(pRect->toString()); + else + aBuf.append("EMPTY"); if (comphelper::LibreOfficeKit::isPartInInvalidation()) { aBuf.append(", "); @@ -608,7 +627,7 @@ namespace void LOKPostAsyncEvent(void* pEv, void*) { - LOKAsyncEventData* pLOKEv = static_cast<LOKAsyncEventData*>(pEv); + std::unique_ptr<LOKAsyncEventData> pLOKEv(static_cast<LOKAsyncEventData*>(pEv)); if (pLOKEv->mpWindow->IsDisposed()) return; @@ -629,6 +648,9 @@ namespace if (!pFocusWindow) pFocusWindow = pLOKEv->mpWindow; + if (pLOKEv->mpWindow->IsDisposed()) + return; + switch (pLOKEv->mnEvent) { case VclEventId::WindowKeyInput: @@ -637,11 +659,13 @@ namespace KeyEvent singlePress(pLOKEv->maKeyEvent.GetCharCode(), pLOKEv->maKeyEvent.GetKeyCode()); for (sal_uInt16 i = 0; i <= nRepeat; ++i) - pFocusWindow->KeyInput(singlePress); + if (!pFocusWindow->IsDisposed()) + pFocusWindow->KeyInput(singlePress); break; } case VclEventId::WindowKeyUp: - pFocusWindow->KeyUp(pLOKEv->maKeyEvent); + if (!pFocusWindow->IsDisposed()) + pFocusWindow->KeyUp(pLOKEv->maKeyEvent); break; case VclEventId::WindowMouseButtonDown: pLOKEv->mpWindow->LogicMouseButtonDown(pLOKEv->maMouseEvent); @@ -672,8 +696,6 @@ namespace assert(false); break; } - - delete pLOKEv; } void postEventAsync(LOKAsyncEventData *pEvent) @@ -717,6 +739,16 @@ void SfxLokHelper::postKeyEventAsync(const VclPtr<vcl::Window> &xWindow, postEventAsync(pLOKEv); } +void SfxLokHelper::setBlockedCommandList(int nViewId, const char* bolckedCommandList) +{ + SfxViewShell* pViewShell = SfxLokHelper::getViewOfId(nViewId); + + if(pViewShell) + { + pViewShell->setBlockedCommandList(bolckedCommandList); + } +} + void SfxLokHelper::postExtTextEventAsync(const VclPtr<vcl::Window> &xWindow, int nType, const OUString &rText) { |