diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-11-02 18:21:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-11-04 17:33:06 +0100 |
commit | 4d83c24cdd433d5c63800290e2da6317ae12111c (patch) | |
tree | bfd4c863f0f79d40ac1671812fef1976ca4a9c85 /sfx2/source/appl/childwin.cxx | |
parent | 628e96ce1fce194b30a5c2912feb8b7ec0328db0 (diff) |
reweld SwWordCountFloatDlg
fixing up the bit that failed the last time
Change-Id: I235f8f92cbc0c3e31837e01a9b094580c6f5aecf
Reviewed-on: https://gerrit.libreoffice.org/62786
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source/appl/childwin.cxx')
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 83 |
1 files changed, 62 insertions, 21 deletions
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index aa8018eb0ed4..65f06344079c 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -194,7 +194,10 @@ SfxChildWindow::~SfxChildWindow() { pContext.reset(); ClearWorkwin(); - pWindow.disposeAndClear(); + if (xController) + xController->DeInit(); + else + pWindow.disposeAndClear(); } @@ -270,7 +273,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, DBG_ASSERT(pFact && (pChild || !rInfo.bVisible), "ChildWindow-Typ not registered!"); - if ( pChild && !pChild->pWindow ) + if (pChild && (!pChild->pWindow && !pChild->xController)) { DELETEZ(pChild); SAL_INFO("sfx.appl", "ChildWindow has no Window!"); @@ -319,26 +322,38 @@ void SfxChildWindow::SetAlignment(SfxChildAlignment eAlign) SfxChildWinInfo SfxChildWindow::GetInfo() const { - SfxChildWinInfo aInfo(pImpl->pFact->aInfo); - aInfo.aPos = pWindow->GetPosPixel(); - aInfo.aSize = pWindow->GetSizePixel(); - if ( pWindow->IsSystemWindow() ) + if (xController) { + weld::Dialog* pDialog = xController->getDialog(); + aInfo.aPos = pDialog->get_position(); + aInfo.aSize = pDialog->get_size(); WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State; - if ( pWindow->GetStyle() & WB_SIZEABLE ) - nMask |= ( WindowStateMask::Width | WindowStateMask::Height ); - aInfo.aWinState = static_cast<SystemWindow*>(pWindow.get())->GetWindowState( nMask ); + if (pDialog->get_resizable()) + nMask |= (WindowStateMask::Width | WindowStateMask::Height); + aInfo.aWinState = pDialog->get_window_state(nMask); } - else if (DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow.get())) + else if (pWindow) { - if (pDockingWindow->GetFloatingWindow()) - aInfo.aWinState = pDockingWindow->GetFloatingWindow()->GetWindowState(); - else if (SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(pDockingWindow)) + aInfo.aPos = pWindow->GetPosPixel(); + aInfo.aSize = pWindow->GetSizePixel(); + if ( pWindow->IsSystemWindow() ) { - SfxChildWinInfo aTmpInfo; - pSfxDockingWindow->FillInfo( aTmpInfo ); - aInfo.aExtraString = aTmpInfo.aExtraString; + WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State; + if ( pWindow->GetStyle() & WB_SIZEABLE ) + nMask |= ( WindowStateMask::Width | WindowStateMask::Height ); + aInfo.aWinState = static_cast<SystemWindow*>(pWindow.get())->GetWindowState( nMask ); + } + else if (DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow.get())) + { + if (pDockingWindow->GetFloatingWindow()) + aInfo.aWinState = pDockingWindow->GetFloatingWindow()->GetWindowState(); + else if (SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(pDockingWindow)) + { + SfxChildWinInfo aTmpInfo; + pSfxDockingWindow->FillInfo( aTmpInfo ); + aInfo.aExtraString = aTmpInfo.aExtraString; + } } } @@ -608,12 +623,24 @@ void SfxChildWindow::SetVisible_Impl( bool bVis ) void SfxChildWindow::Hide() { - pWindow->Hide(); + if (xController) + xController->EndDialog(); + else + pWindow->Hide(); } void SfxChildWindow::Show( ShowFlags nFlags ) { - pWindow->Show(true, nFlags); + if (xController) + { + if (!xController->getDialog()->get_visible()) + { + weld::DialogController::runAsync(xController, + [=](sal_Int32 /*nResult*/){ xController->Close(); }); + } + } + else + pWindow->Show(true, nFlags); } vcl::Window* SfxChildWindow::GetContextWindow( SfxModule const *pModule ) const @@ -624,8 +651,14 @@ vcl::Window* SfxChildWindow::GetContextWindow( SfxModule const *pModule ) const void SfxChildWindow::SetWorkWindow_Impl( SfxWorkWindow* pWin ) { pImpl->pWorkWin = pWin; - if ( pWin && pWindow->HasChildPathFocus() ) - pImpl->pWorkWin->SetActiveChild_Impl( pWindow ); + if (pWin) + { + if ( (xController && xController->getDialog()->has_toplevel_focus()) || + (pWindow && pWindow->HasChildPathFocus()) ) + { + pImpl->pWorkWin->SetActiveChild_Impl( pWindow ); + } + } } void SfxChildWindow::Activate_Impl() @@ -646,7 +679,15 @@ bool SfxChildWindow::QueryClose() } if ( bAllow ) - bAllow = !GetWindow()->IsInModalMode(); + { + if (GetController()) + { + weld::Dialog* pDialog = GetController()->getDialog(); + bAllow = !pDialog->get_visible() || !pDialog->get_modal(); + } + else if (GetWindow()) + bAllow = !GetWindow()->IsInModalMode(); + } return bAllow; } |