diff options
Diffstat (limited to 'sfx2/source/appl/childwin.cxx')
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 73 |
1 files changed, 54 insertions, 19 deletions
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index aa8018eb0ed4..e2bbc3ee9e7f 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 @@ -646,7 +673,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; } |