sc/inc/scmod.hxx | 4 --- sc/source/ui/app/scmod.cxx | 31 ----------------------------- sc/source/ui/inc/anyrefdg.hxx | 44 +++++++++--------------------------------- sc/source/ui/inc/validate.hxx | 4 +-- 4 files changed, 12 insertions(+), 71 deletions(-)
New commits: commit d69db73ec1de29ec5b72cdcd2a64873b92cac672 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Apr 17 15:59:22 2019 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Apr 17 22:22:38 2019 +0200 m_mapRefWindow is unneeded now Change-Id: I68811d64ed340f3b5f86d7c13289455009eea74e Reviewed-on: https://gerrit.libreoffice.org/70890 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 5b4e519fd693..2c517eedf770 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -108,7 +108,6 @@ class ScModule: public SfxModule, public SfxListener, public utl::ConfigurationL bool m_bIsInSharedDocLoading:1; bool m_bIsInSharedDocSaving:1; - std::map<sal_uInt16, std::vector<VclPtr<vcl::Window> > > m_mapRefWindow; // a way to find existing Dialogs for a given parent Window of the slot type std::map<sal_uInt16, std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>>> m_mapRefController; @@ -249,9 +248,6 @@ public: void SetInSharedDocSaving( bool bNew ) { m_bIsInSharedDocSaving = bNew; } bool IsInSharedDocSaving() const { return m_bIsInSharedDocSaving; } - SC_DLLPUBLIC void RegisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ); - SC_DLLPUBLIC void UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ); - SC_DLLPUBLIC void RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd, weld::Window* pWndAncestor); SC_DLLPUBLIC void UnregisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd); SC_DLLPUBLIC std::shared_ptr<SfxDialogController> Find1RefWindow(sal_uInt16 nSlotId, weld::Window *pWndAncestor); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index c701866a66d4..082b4e32c929 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2197,37 +2197,6 @@ IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void ) } } -void ScModule::RegisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ) -{ - std::vector<VclPtr<vcl::Window> > & rlRefWindow = m_mapRefWindow[nSlotId]; - - if( std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ) == rlRefWindow.end() ) - { - rlRefWindow.emplace_back(pWnd ); - } - -} - -void ScModule::UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ) -{ - auto iSlot = m_mapRefWindow.find( nSlotId ); - - if( iSlot == m_mapRefWindow.end() ) - return; - - std::vector<VclPtr<vcl::Window> > & rlRefWindow = iSlot->second; - - auto i = std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ); - - if( i == rlRefWindow.end() ) - return; - - rlRefWindow.erase( i ); - - if( rlRefWindow.empty() ) - m_mapRefWindow.erase( nSlotId ); -} - void ScModule::RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd, weld::Window* pWndAncestor) { std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = m_mapRefController[nSlotId]; diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 7fd1c4b19381..978c733fb784 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -209,19 +209,16 @@ struct ScRefHdlrImpl: ScRefHdlrImplBase< TBase, bBindRef > ScRefHdlrImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4 ) : ScRefHdlrImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4) { - SC_MOD()->RegisterRefWindow( static_cast<sal_uInt16>( TDerived::SLOTID ), this ); } template<class T1, class T2, class T3, class T4, class T5> ScRefHdlrImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4, const T5& rt5 ) : ScRefHdlrImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4, rt5) { - SC_MOD()->RegisterRefWindow( static_cast<sal_uInt16>( TDerived::SLOTID ), this ); } virtual void dispose() override { - SC_MOD()->UnregisterRefWindow( static_cast<sal_uInt16>( TDerived::SLOTID ), this ); ScRefHdlrImplBase<TBase, bBindRef >::disposeRefHandler(); TBase::dispose(); } commit b6075c3afed5837a79a9c509f5b38f38eeacf6dc Author: Caolán McNamara <[email protected]> AuthorDate: Wed Apr 17 15:46:05 2019 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Apr 17 22:22:18 2019 +0200 boil incomprehensible template spew down to its simpler reality Change-Id: I6a428b6515bffb69b6890ddcf8990c2c773b506c Reviewed-on: https://gerrit.libreoffice.org/70889 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 99c57edf5320..7fd1c4b19381 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -241,49 +241,28 @@ struct ScAnyRefDlg : ::ScRefHdlrImpl< ScAnyRefDlg, SfxModelessDialog> } }; -template< class TWindow, bool bBindRef = true > -class ScRefHdlrControllerImplBase: public TWindow, public ScRefHandler -{ -private: - ScRefHdlrControllerImplBase(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID) - : TWindow(pB, pCW, pParent, rUIXMLDescription, rID) - , ScRefHandler(*static_cast<TWindow*>(this), pB, bBindRef) - { - } - - ScRefHdlrControllerImplBase(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet* pArg, SfxBindings *pB) - : TWindow(pParent, rUIXMLDescription, rID, pArg) - , ScRefHandler(*static_cast<TWindow*>(this), pB, bBindRef) - { - } - - virtual ~ScRefHdlrControllerImplBase() override - { - } - - template<class, class, bool> friend struct ScRefHdlrControllerImpl; -}; - -template<class TDerived, class TBase, bool bBindRef = true> -struct ScRefHdlrControllerImpl : ScRefHdlrControllerImplBase<TBase, bBindRef> +template<class TBase, bool bBindRef = true> +struct ScRefHdlrControllerImpl : public TBase, public ScRefHandler { enum { UNKNOWN_SLOTID = 0U, SLOTID = UNKNOWN_SLOTID }; - ScRefHdlrControllerImpl(weld::Window* rt1, const OUString& rt2, const OString& rt3, const SfxItemSet* rt4, SfxBindings *rt5) - : ScRefHdlrControllerImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4, rt5) + ScRefHdlrControllerImpl(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet* pArg, SfxBindings *pB) + : TBase(pParent, rUIXMLDescription, rID, pArg) + , ScRefHandler(*static_cast<TBase*>(this), pB, bBindRef) { } - ScRefHdlrControllerImpl(SfxBindings* rt1, SfxChildWindow* rt2, weld::Window* rt3, const OUString& rt4, const OString& rt5) - : ScRefHdlrControllerImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4, rt5) + ScRefHdlrControllerImpl(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID) + : TBase(pB, pCW, pParent, rUIXMLDescription, rID) + , ScRefHandler(*static_cast<TBase*>(this), pB, bBindRef) { } }; -struct ScAnyRefDlgController : ScRefHdlrControllerImpl<ScAnyRefDlgController, SfxModelessDialogController> +struct ScAnyRefDlgController : ScRefHdlrControllerImpl<SfxModelessDialogController> { ScAnyRefDlgController(SfxBindings* rt1, SfxChildWindow* rt2, weld::Window* rt3, const OUString& rt4, const OString& rt5) - : ScRefHdlrControllerImpl<ScAnyRefDlgController, SfxModelessDialogController>(rt1, rt2, rt3, rt4, rt5) + : ScRefHdlrControllerImpl<SfxModelessDialogController>(rt1, rt2, rt3, rt4, rt5) { } }; diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index d28ee58192cd..661b605387d9 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -146,10 +146,10 @@ public: /** The "Validity" tab dialog. */ class ScValidationDlg - : public ScRefHdlrControllerImpl<ScValidationDlg, SfxTabDialogController, false> + : public ScRefHdlrControllerImpl<SfxTabDialogController, false> , public ScRefHandlerHelper { - typedef ScRefHdlrControllerImpl<ScValidationDlg, SfxTabDialogController, false> ScValidationDlgBase; + typedef ScRefHdlrControllerImpl<SfxTabDialogController, false> ScValidationDlgBase; ScTabViewShell * const m_pTabVwSh; OString m_sValuePageId; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
