[Libreoffice-commits] core.git: include/svtools svtools/source svx/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Jun 28 19:39:30 UTC 2020


 include/svtools/editbrowsebox.hxx      |   23 +++++++++++++++++------
 include/svtools/editimplementation.hxx |    5 ++---
 svtools/source/brwbox/ebbcontrols.cxx  |   11 ++++++++++-
 svx/source/fmcomp/gridcell.cxx         |    2 +-
 4 files changed, 30 insertions(+), 11 deletions(-)

New commits:
commit 8fe03ea93213bbb19b6ee9862a3966144f0df5cb
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Jun 27 21:28:04 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Jun 28 21:38:55 2020 +0200

    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 at redhat.com>

diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 2e9c7cb891cb..ac84f078b6b1 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 c43c44d66db2..ceddf0a81fbc 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 2c6291fd3f7e..df5eb4d4b2d8 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 bb349b8f4890..81d3e410dd25 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;


More information about the Libreoffice-commits mailing list