summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-10-08 14:36:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-10-08 16:41:54 +0200
commite2ecb9a50acb7ab7c3287403104c6256d4369816 (patch)
tree2fbe215a11c056f6d728b7c7380c5503945e4469 /svtools
parent8e779c062a22a5755cae2c86787e16f59bfe4907 (diff)
don't warn about missing TopMostParentSystemWindow
Seen in tdf#144037 because the notebookbar is not a child of the toplevel window, but instead (like the menubar) is a child of borderwindow of the toplevel so from its perspective there is no eventual parent SystemWindow. This TaskPane thing could probably be dropped and likely no one would notice. But with tearable floaters like the color dropdown still a thing then F6 wouldn't work to move into them and someone might complain. Change-Id: I7174598a2ee01e98aca2f6e214adf94f7a555018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123258 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/control/toolbarmenu.cxx36
1 files changed, 13 insertions, 23 deletions
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index b507587fb017..3c95a6410d64 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -35,27 +35,19 @@ using namespace ::com::sun::star::accessibility;
namespace {
-vcl::Window* GetTopMostParentSystemWindow( vcl::Window* pWindow )
+SystemWindow* GetTopMostParentSystemWindow(vcl::Window& rWindow)
{
- OSL_ASSERT( pWindow );
- if ( pWindow )
+ // ->manually search topmost system window
+ // required because their might be another system window between this and the top window
+ vcl::Window* pWindow = rWindow.GetParent();
+ SystemWindow* pTopMostSysWin = nullptr;
+ while ( pWindow )
{
- // ->manually search topmost system window
- // required because their might be another system window between this and the top window
+ if ( pWindow->IsSystemWindow() )
+ pTopMostSysWin = static_cast<SystemWindow*>(pWindow);
pWindow = pWindow->GetParent();
- SystemWindow* pTopMostSysWin = nullptr;
- while ( pWindow )
- {
- if ( pWindow->IsSystemWindow() )
- pTopMostSysWin = static_cast<SystemWindow*>(pWindow);
- pWindow = pWindow->GetParent();
- }
- pWindow = pTopMostSysWin;
- OSL_ASSERT( pWindow );
- return pWindow;
}
-
- return nullptr;
+ return pTopMostSysWin;
}
class ToolbarPopupStatusListener : public svt::FrameStatusListener
@@ -182,9 +174,8 @@ InterimToolbarPopup::InterimToolbarPopup(const css::uno::Reference<css::frame::X
, m_xContainer(m_xBuilder->weld_container("container"))
, m_xPopup(std::move(xPopup))
{
- vcl::Window* pWindow = GetTopMostParentSystemWindow(this);
- if (pWindow)
- static_cast<SystemWindow*>(pWindow)->GetTaskPaneList()->AddWindow(this);
+ if (SystemWindow* pWindow = GetTopMostParentSystemWindow(*this))
+ pWindow->GetTaskPaneList()->AddWindow(this);
// move the WeldToolbarPopup contents into this interim toolbar so welded contents can appear as a dropdown in an unwelded toolbar
m_xPopup->getTopLevel()->move(m_xPopup->getContainer(), m_xContainer.get());
@@ -200,9 +191,8 @@ void InterimToolbarPopup::GetFocus()
void InterimToolbarPopup::dispose()
{
- vcl::Window* pWindow = GetTopMostParentSystemWindow(this);
- if (pWindow)
- static_cast<SystemWindow*>(pWindow)->GetTaskPaneList()->RemoveWindow(this);
+ if (SystemWindow* pWindow = GetTopMostParentSystemWindow(*this))
+ pWindow->GetTaskPaneList()->RemoveWindow(this);
// if we have focus when disposed, pick the document window as destination
// for focus rather than let it go to an arbitrary windows