summaryrefslogtreecommitdiff
path: root/sfx2/source/appl/workwin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/appl/workwin.cxx')
-rw-r--r--sfx2/source/appl/workwin.cxx85
1 files changed, 75 insertions, 10 deletions
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 363b3005d1f9..69e29d2e6d83 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -864,7 +864,6 @@ bool SfxWorkWindow::PrepareClose_Impl()
return true;
}
-
SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( vcl::Window& rWindow,
SfxChildAlignment eAlign )
{
@@ -885,6 +884,19 @@ SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( vcl::Window& rWindow,
return aChildren.back();
}
+SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl(std::shared_ptr<SfxModelessDialogController>& rController,
+ SfxChildAlignment eAlign )
+{
+ DBG_ASSERT( aChildren.size() < 255, "too many children" );
+ DBG_ASSERT( SfxChildAlignValid(eAlign), "invalid align" );
+
+ SfxChild_Impl *pChild = new SfxChild_Impl(rController, eAlign);
+
+ aChildren.push_back(pChild);
+ bSorted = false;
+ nChildren++;
+ return aChildren.back();
+}
void SfxWorkWindow::ReleaseChild_Impl( vcl::Window& rWindow )
{
@@ -910,6 +922,29 @@ void SfxWorkWindow::ReleaseChild_Impl( vcl::Window& rWindow )
}
}
+void SfxWorkWindow::ReleaseChild_Impl(SfxModelessDialogController& rController)
+{
+
+ SfxChild_Impl *pChild = nullptr;
+ decltype(aChildren)::size_type nPos;
+ for ( nPos = 0; nPos < aChildren.size(); ++nPos )
+ {
+ pChild = aChildren[nPos];
+ if (pChild && pChild->xController.get() == &rController)
+ break;
+ }
+
+ if ( nPos < aChildren.size() )
+ {
+ bSorted = false;
+ nChildren--;
+ aChildren.erase(aChildren.begin() + nPos);
+ delete pChild;
+ }
+ else {
+ OSL_FAIL( "releasing unregistered child" );
+ }
+}
SfxChild_Impl* SfxWorkWindow::FindChild_Impl( const vcl::Window& rWindow ) const
{
@@ -933,8 +968,10 @@ void SfxWorkWindow::ShowChildren_Impl()
for (SfxChild_Impl* pCli : aChildren)
{
+ if (!pCli)
+ continue;
SfxChildWin_Impl* pCW = nullptr;
- if ( pCli && pCli->pWin )
+ if (pCli->pWin || pCli->xController)
{
// We have to find the SfxChildWin_Impl to retrieve the
// SFX_CHILDWIN flags that can influence visibility.
@@ -961,12 +998,27 @@ void SfxWorkWindow::ShowChildren_Impl()
if ( SfxChildVisibility::VISIBLE == (pCli->nVisible & SfxChildVisibility::VISIBLE) && bVisible )
{
ShowFlags nFlags = pCli->bSetFocus ? ShowFlags::NONE : ShowFlags::NoFocusChange | ShowFlags::NoActivate;
- pCli->pWin->Show(true, nFlags);
+ if (pCli->xController)
+ {
+ if (!pCli->xController->getDialog()->get_visible())
+ {
+ weld::DialogController::runAsync(pCli->xController,
+ [=](sal_Int32 /*nResult*/){ pCli->xController->Close(); });
+ }
+ }
+ else
+ pCli->pWin->Show(true, nFlags);
pCli->bSetFocus = false;
}
else
{
- pCli->pWin->Hide();
+ if (pCli->xController)
+ {
+ if (pCli->xController->getDialog()->get_visible())
+ pCli->xController->response(RET_CLOSE);
+ }
+ else
+ pCli->pWin->Hide();
}
}
}
@@ -978,12 +1030,15 @@ void SfxWorkWindow::HideChildren_Impl()
for ( sal_uInt16 nPos = aChildren.size(); nPos > 0; --nPos )
{
SfxChild_Impl *pChild = aChildren[nPos-1];
- if (pChild && pChild->pWin)
+ if (!pChild)
+ continue;
+ if (pChild->xController)
+ pChild->xController->response(RET_CLOSE);
+ else if (pChild->pWin)
pChild->pWin->Hide();
}
}
-
void SfxWorkWindow::ResetObjectBars_Impl()
{
for ( auto & n: aObjBarList )
@@ -1324,7 +1379,10 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus )
{
// The window is not docked or docked outside of one split windows
// and must therefore be registered explicitly as a Child
- pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment());
+ if (pChildWin->GetController())
+ pCW->pCli = RegisterChild_Impl(pChildWin->GetController(), pChildWin->GetAlignment());
+ else
+ pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment());
pCW->pCli->nVisible = SfxChildVisibility::VISIBLE;
if ( pChildWin->GetAlignment() != SfxChildAlignment::NOALIGNMENT && bIsFullScreen )
pCW->pCli->nVisible ^= SfxChildVisibility::ACTIVE;
@@ -1363,7 +1421,10 @@ void SfxWorkWindow::RemoveChildWin_Impl( SfxChildWin_Impl *pCW )
// Child window is a direct child window and must therefore unregister
// itself from the WorkWindow
pCW->pCli = nullptr;
- ReleaseChild_Impl(*pChildWin->GetWindow());
+ if (pChildWin->GetController())
+ ReleaseChild_Impl(*pChildWin->GetController());
+ else
+ ReleaseChild_Impl(*pChildWin->GetWindow());
}
else
{
@@ -2382,8 +2443,12 @@ void SfxWorkWindow::DataChanged_Impl()
for (n=0; n<nCount; n++)
{
SfxChildWin_Impl*pCW = aChildWins[n].get();
- if ( pCW && pCW->pWin )
- pCW->pWin->GetWindow()->UpdateSettings( Application::GetSettings() );
+ if (pCW && pCW->pWin)
+ {
+ // TODO does this really have any meaning ?
+ if (pCW->pWin->GetWindow())
+ pCW->pWin->GetWindow()->UpdateSettings(Application::GetSettings());
+ }
}
ArrangeChildren_Impl();