summaryrefslogtreecommitdiff
path: root/sfx2/source/dialog/basedlgs.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-03-20 21:18:04 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-03-22 14:20:43 +0100
commit7d0bd54bad1782f74c156aa667e875c33efee0c1 (patch)
tree929357474beb322c71dc13fec316bef940d67308 /sfx2/source/dialog/basedlgs.cxx
parentf8efe7d63279900c7fd737cff5030dede870fac6 (diff)
refactor into a shareable base class
Change-Id: I5eb1f2b6b7b2dbc3bc675845730cb3aef1cab5f0 Reviewed-on: https://gerrit.libreoffice.org/69528 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source/dialog/basedlgs.cxx')
-rw-r--r--sfx2/source/dialog/basedlgs.cxx56
1 files changed, 35 insertions, 21 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index b5056df8b1a9..81ccb97b910e 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -408,8 +408,6 @@ SfxModelessDialogController::SfxModelessDialogController(SfxBindings* pBindinx,
: SfxDialogController(pParent, rUIXMLDescription, rID)
{
Init(pBindinx, pCW);
- m_xDialog->connect_focus_in(LINK(this, SfxModelessDialogController, FocusInHdl));
- m_xDialog->connect_focus_out(LINK(this, SfxModelessDialogController, FocusOutHdl));
}
void SfxModelessDialogController::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
@@ -423,35 +421,30 @@ void SfxModelessDialogController::Init(SfxBindings *pBindinx, SfxChildWindow *pC
m_xImpl->StartListening( *pBindinx );
}
-void SfxModelessDialogController::DeInit()
-{
- if (m_xImpl->pMgr)
- {
- WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
- if (m_xDialog->get_resizable())
- nMask |= WindowStateMask::Width | WindowStateMask::Height;
- m_xImpl->aWinState = m_xDialog->get_window_state(nMask);
- GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, m_xImpl->pMgr->GetType() );
- }
-
- m_xImpl->pMgr = nullptr;
-}
-
/* [Description]
If a ModelessDialog is enabled its ViewFrame will be activated.
This is necessary by PluginInFrames.
*/
-IMPL_LINK_NOARG(SfxModelessDialogController, FocusInHdl, weld::Widget&, void)
+IMPL_LINK_NOARG(SfxDialogController, FocusInHdl, weld::Widget&, void)
+{
+ Activate();
+}
+
+void SfxModelessDialogController::Activate()
{
if (!m_xImpl)
return;
m_pBindings->SetActiveFrame(m_xImpl->pMgr->GetFrame());
m_xImpl->pMgr->Activate_Impl();
- Activate();
}
-IMPL_LINK_NOARG(SfxModelessDialogController, FocusOutHdl, weld::Widget&, void)
+IMPL_LINK_NOARG(SfxDialogController, FocusOutHdl, weld::Widget&, void)
+{
+ DeActivate();
+}
+
+void SfxModelessDialogController::DeActivate()
{
if (!m_xImpl)
return;
@@ -469,15 +462,34 @@ SfxModelessDialogController::~SfxModelessDialogController()
m_pBindings->SetActiveFrame(nullptr);
}
-void SfxModelessDialogController::EndDialog()
+void SfxDialogController::EndDialog()
{
if (!m_xDialog->get_visible())
return;
- m_xImpl->bClosing = true;
response(RET_CLOSE);
+}
+
+void SfxModelessDialogController::EndDialog()
+{
+ m_xImpl->bClosing = true;
+ SfxDialogController::EndDialog();
m_xImpl->bClosing = false;
}
+void SfxModelessDialogController::ChildWinDispose()
+{
+ if (m_xImpl->pMgr)
+ {
+ WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
+ if (m_xDialog->get_resizable())
+ nMask |= WindowStateMask::Width | WindowStateMask::Height;
+ m_xImpl->aWinState = m_xDialog->get_window_state(nMask);
+ GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, m_xImpl->pMgr->GetType() );
+ }
+
+ m_xImpl->pMgr = nullptr;
+}
+
/* [Description]
The window is closed when the ChildWindow is destroyed by running the
@@ -837,6 +849,8 @@ SfxDialogController::SfxDialogController(weld::Widget* pParent, const OUString&
: GenericDialogController(pParent, rUIFile, rDialogId)
{
m_xDialog->SetInstallLOKNotifierHdl(LINK(this, SfxDialogController, InstallLOKNotifierHdl));
+ m_xDialog->connect_focus_in(LINK(this, SfxDialogController, FocusInHdl));
+ m_xDialog->connect_focus_out(LINK(this, SfxDialogController, FocusOutHdl));
}
IMPL_STATIC_LINK_NOARG(SfxDialogController, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*)