summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-02-02 11:22:53 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-02-02 11:04:04 +0100
commitfd7a84aca0c94044bbc3bfb8852a1ae5115845bf (patch)
tree5cee666b4e5ff3b25e47dbafdacecaa7b9ddfffb /sfx2
parentb13579fd2a811e32b06f34ebf932469cabe5fd27 (diff)
lok: find active SmViewShell reliably
... even after SfxViewShell::Current() had been set to parent document frame's viewshell (e.g., see LOKPostAsyncEvent grabbing focus, which replaces current frame and its associated viewshell). Change-Id: If63087f4c7f3f878ada93d93cc0af6c20a6c0a62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129323 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokstarmathhelper.cxx25
1 files changed, 14 insertions, 11 deletions
diff --git a/sfx2/source/view/lokstarmathhelper.cxx b/sfx2/source/view/lokstarmathhelper.cxx
index fedd931b08fd..885decdc2fea 100644
--- a/sfx2/source/view/lokstarmathhelper.cxx
+++ b/sfx2/source/view/lokstarmathhelper.cxx
@@ -83,28 +83,31 @@ vcl::Window* FindChildSmGraphicWidgetWindow(vcl::Window* pWin)
}
return nullptr;
}
-
-vcl::Window* FindSmGraphicWidgetWindow(vcl::Window* pWin)
-{
- return FindChildSmGraphicWidgetWindow(FindSmGraphicWindow(pWin));
-}
}
-vcl::Window* LokStarMathHelper::GetWindow()
+vcl::Window* LokStarMathHelper::GetGraphicWindow()
{
- if (!mpWindow)
+ if (!mpGraphicWindow)
{
if (const css::uno::Reference<css::frame::XController>& xController = GetXController())
{
if (const css::uno::Reference<css::frame::XFrame> xFrame = xController->getFrame())
{
css::uno::Reference<css::awt::XWindow> xDockerWin = xFrame->getContainerWindow();
- mpWindow.set(FindSmGraphicWidgetWindow(VCLUnoHelper::GetWindow(xDockerWin)));
+ mpGraphicWindow.set(FindSmGraphicWindow(VCLUnoHelper::GetWindow(xDockerWin)));
}
}
}
- return mpWindow.get();
+ return mpGraphicWindow.get();
+}
+
+vcl::Window* LokStarMathHelper::GetWidgetWindow()
+{
+ if (!mpWidgetWindow)
+ mpWidgetWindow.set(FindChildSmGraphicWidgetWindow(GetGraphicWindow()));
+
+ return mpWidgetWindow.get();
}
tools::Rectangle LokStarMathHelper::GetBoundingBox()
@@ -115,7 +118,7 @@ tools::Rectangle LokStarMathHelper::GetBoundingBox()
{
if (vcl::Window* pRootWin = pIPClient->GetEditWin())
{
- if (vcl::Window* pWindow = GetWindow())
+ if (vcl::Window* pWindow = GetWidgetWindow())
{
// In all cases, the following code fragment
// returns the bounding box in twips.
@@ -143,7 +146,7 @@ tools::Rectangle LokStarMathHelper::GetBoundingBox()
bool LokStarMathHelper::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons,
int nModifier, double fScaleX, double fScaleY)
{
- if (vcl::Window* pWindow = GetWindow())
+ if (vcl::Window* pWindow = GetWidgetWindow())
{
Point aMousePos(nX, nY);
tools::Rectangle rBBox = GetBoundingBox();