decouple IEditImplementation from Edit more

Change-Id: Ie01373ca40d519c179485bd1a4b6616d5929fa5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97328
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 2e9c7cb..ac84f07 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -143,7 +143,7 @@ namespace svt
        virtual void                SetModified() = 0;
        virtual bool                IsModified() const = 0;
        virtual void                ClearModified() = 0;
        virtual void                SetModifyHdl( const Link<Edit&,void>& _rLink ) = 0;
        virtual void                SetModifyHdl( const Link<LinkParamNone*,void>& _rLink ) = 0;
    };


@@ -153,6 +153,8 @@ namespace svt
    class GenericEditImplementation : public IEditImplementation
    {
        EDIT&   m_rEdit;
    protected:
        Link<LinkParamNone*,void> m_aModifyHdl;
    public:
        GenericEditImplementation( EDIT& _rEdit );

@@ -178,7 +180,7 @@ namespace svt
        virtual void                SetModified() override;
        virtual bool                IsModified() const override;
        virtual void                ClearModified() override;
        virtual void                SetModifyHdl( const Link<Edit&,void>& _rLink ) override;
        virtual void                SetModifyHdl( const Link<LinkParamNone*,void>& _rLink ) override;
    };

    #include <svtools/editimplementation.hxx>
@@ -209,23 +211,32 @@ namespace svt

    //= concrete edit implementations

    typedef GenericEditImplementation< Edit >             EditImplementation;
    typedef GenericEditImplementation< Edit >             EditImplementation_Base;
    class UNLESS_MERGELIBS(SVT_DLLPUBLIC) EditImplementation final : public EditImplementation_Base
    {
        DECL_LINK(ModifyHdl, Edit&, void);
    public:
        EditImplementation( Edit& _rEdit ) : EditImplementation_Base( _rEdit )
        {
            _rEdit.SetModifyHdl(LINK(this, EditImplementation, ModifyHdl));
        }
    };

    typedef GenericEditImplementation< MultiLineTextCell >  MultiLineEditImplementation_Base;
    class UNLESS_MERGELIBS(SVT_DLLPUBLIC) MultiLineEditImplementation final : public MultiLineEditImplementation_Base
    {
        DECL_LINK(ModifyHdl, Edit&, void);
    public:
        MultiLineEditImplementation( MultiLineTextCell& _rEdit ) : MultiLineEditImplementation_Base( _rEdit )
        {
            _rEdit.SetModifyHdl(LINK(this, MultiLineEditImplementation, ModifyHdl));
        }

        virtual OUString GetText( LineEnd aSeparator ) const override;
        virtual OUString GetSelected( LineEnd aSeparator ) const override;
    };


    //= EditCellController

    class SVT_DLLPUBLIC EditCellController : public CellController
    {
        IEditImplementation*    m_pEditImplementation;
@@ -246,7 +257,7 @@ namespace svt
    protected:
        virtual bool MoveAllowed(const KeyEvent& rEvt) const override;
    private:
        DECL_LINK(ModifyHdl, Edit&, void);
        DECL_LINK(ModifyHdl, LinkParamNone*, void);
    };


diff --git a/include/svtools/editimplementation.hxx b/include/svtools/editimplementation.hxx
index c43c44d..ceddf0a 100644
--- a/include/svtools/editimplementation.hxx
+++ b/include/svtools/editimplementation.hxx
@@ -28,7 +28,6 @@ GenericEditImplementation< EDIT >::GenericEditImplementation( EDIT& _rEdit )
{
}


template <class EDIT>
Control& GenericEditImplementation< EDIT >::GetControl()
{
@@ -129,9 +128,9 @@ void GenericEditImplementation< EDIT >::ClearModified()


template <class EDIT>
void GenericEditImplementation< EDIT >::SetModifyHdl( const Link<Edit&,void>& _rLink )
void GenericEditImplementation< EDIT >::SetModifyHdl( const Link<LinkParamNone*,void>& _rLink )
{
    m_rEdit.SetModifyHdl( _rLink );
    m_aModifyHdl = _rLink;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index 2c6291f..df5eb4d 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -317,6 +317,15 @@ namespace svt
        return const_cast< MultiLineEditImplementation* >( this )->GetEditWindow().GetSelected( aSeparator );
    }

    IMPL_LINK_NOARG(MultiLineEditImplementation, ModifyHdl, Edit&, void)
    {
        m_aModifyHdl.Call(nullptr);
    }

    IMPL_LINK_NOARG(EditImplementation, ModifyHdl, Edit&, void)
    {
        m_aModifyHdl.Call(nullptr);
    }

    //= EditCellController

@@ -388,7 +397,7 @@ namespace svt
    }


    IMPL_LINK_NOARG(EditCellController, ModifyHdl, Edit&, void)
    IMPL_LINK_NOARG(EditCellController, ModifyHdl, LinkParamNone*, void)
    {
        callModifyHdl();
    }
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index bb349b8..81d3e41 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3567,7 +3567,7 @@ void FmXEditCell::disposing()
    m_aTextListeners.disposeAndClear(aEvt);
    m_aChangeListeners.disposeAndClear(aEvt);

    m_pEditImplementation->SetModifyHdl( Link<Edit&,void>() );
    m_pEditImplementation->SetModifyHdl( Link<LinkParamNone*,void>() );
    if ( m_bOwnEditImplementation )
        delete m_pEditImplementation;
    m_pEditImplementation = nullptr;