summaryrefslogtreecommitdiff
path: root/sfx2/source/appl/childwin.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-04 12:41:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-11-01 22:12:33 +0100
commit26c375671aa362b2f59d84645784938677ae1719 (patch)
tree5ea3214bf75b3d612a6760597e16ab2cc041ce29 /sfx2/source/appl/childwin.cxx
parentd611d5535b818854f9c6c6d4c144c2e5a9155a1a (diff)
weld SwWordCountFloatDlg
enable modeless dialogs to emit a response so runAsync can be used with them and get something called when the dialog is dismissed Change-Id: Ie9603bcc063cefabbae635949671baf06620785d Reviewed-on: https://gerrit.libreoffice.org/61383 Tested-by: Jenkins 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.cxx73
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;
}