summaryrefslogtreecommitdiff
path: root/sc/source/ui/app
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-04-16 17:17:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-04-17 22:21:54 +0200
commite54762baa8019d02cadd311e750f6ff0d276f67b (patch)
treecfc9596639edeab1a0f3d659c55be60dc138e145 /sc/source/ui/app
parent05a0c51ced86460b273a24f5884c99f46d8aae0d (diff)
weld ScTPValidationValue and ScValidationDlg
Change-Id: I74b1569fe378f42c1cc78ca8d9b758c6e585c979 Reviewed-on: https://gerrit.libreoffice.org/70845 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/app')
-rw-r--r--sc/source/ui/app/scmod.cxx36
1 files changed, 21 insertions, 15 deletions
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 381c27501d07..c701866a66d4 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2228,26 +2228,34 @@ void ScModule::UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd )
m_mapRefWindow.erase( nSlotId );
}
-void ScModule::RegisterRefController( sal_uInt16 nSlotId, SfxModelessDialogController *pWnd )
+void ScModule::RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd, weld::Window* pWndAncestor)
{
- std::vector<SfxModelessDialogController*> & rlRefWindow = m_mapRefController[nSlotId];
+ std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = m_mapRefController[nSlotId];
- if( std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ) == rlRefWindow.end() )
+ if (std::find_if(rlRefWindow.begin(), rlRefWindow.end(),
+ [rWnd](const std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>& rCandidate)
+ {
+ return rCandidate.first.get() == rWnd.get();
+ }) == rlRefWindow.end())
{
- rlRefWindow.emplace_back(pWnd );
+ rlRefWindow.emplace_back(rWnd, pWndAncestor);
}
}
-void ScModule::UnregisterRefController( sal_uInt16 nSlotId, SfxModelessDialogController *pWnd )
+void ScModule::UnregisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd)
{
auto iSlot = m_mapRefController.find( nSlotId );
if( iSlot == m_mapRefController.end() )
return;
- std::vector<SfxModelessDialogController* > & rlRefWindow = iSlot->second;
+ std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = iSlot->second;
- auto i = std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd );
+ auto i = std::find_if(rlRefWindow.begin(), rlRefWindow.end(),
+ [rWnd](const std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>& rCandidate)
+ {
+ return rCandidate.first.get() == rWnd.get();
+ });
if( i == rlRefWindow.end() )
return;
@@ -2258,23 +2266,21 @@ void ScModule::UnregisterRefController( sal_uInt16 nSlotId, SfxModelessDialogCo
m_mapRefController.erase( nSlotId );
}
-vcl::Window * ScModule::Find1RefWindow( sal_uInt16 nSlotId, vcl::Window *pWndAncestor )
+std::shared_ptr<SfxDialogController> ScModule::Find1RefWindow(sal_uInt16 nSlotId, weld::Window *pWndAncestor)
{
if (!pWndAncestor)
return nullptr;
- auto iSlot = m_mapRefWindow.find( nSlotId );
+ auto iSlot = m_mapRefController.find( nSlotId );
- if( iSlot == m_mapRefWindow.end() )
+ if( iSlot == m_mapRefController.end() )
return nullptr;
- std::vector<VclPtr<vcl::Window> > & rlRefWindow = iSlot->second;
-
- while( vcl::Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent;
+ std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = iSlot->second;
for (auto const& refWindow : rlRefWindow)
- if ( pWndAncestor->IsWindowOrChild( refWindow, refWindow->IsSystemWindow() ) )
- return refWindow;
+ if ( refWindow.second == pWndAncestor )
+ return refWindow.first;
return nullptr;
}