[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - cui/source

Caolán McNamara caolanm at redhat.com
Thu Nov 26 11:35:35 PST 2015


 cui/source/inc/autocdlg.hxx      |   33 +++++++++++++++++++--------
 cui/source/tabpages/autocdlg.cxx |   47 +++++++++++++++++++++------------------
 2 files changed, 50 insertions(+), 30 deletions(-)

New commits:
commit 6213ce4ab8621ad307df25c1fd2bfeb8de5dd1f6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 4 13:04:00 2015 +0000

    Resolves: tdf#95352 resize the columns when the edits reposition
    
    instead of assuming they are in their final position when the
    top level dialog resizes. Cause there's a timer/idle involved
    so the final position isn't known yet
    
    (cherry picked from commit d4d4e00a5a449bdf46608ce0cecbfa07c340e555)
    
    Change-Id: I713e938b0e275f181514315cb4ce4531f36191ca
    
    loplugin:vclwidgets
    
    (cherry picked from commit 4882664e39718109e2ae80348da8b914eb8b2ae6)
    
    Change-Id: I3e5d88bdc2ecae6164c75da8ddf1b8cfe0ed325f
    Reviewed-on: https://gerrit.libreoffice.org/19796
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 1ff86e7..4302e0a 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -183,21 +183,39 @@ public:
 class AutoCorrEdit : public Edit
 {
     Link<>  aActionLink;
-    bool    bSpaces;
+    VclPtr<SvTabListBox> m_xReplaceTLB;
+    sal_Int32 m_nCol;
+    bool bSpaces;
 
-    public:
-                    AutoCorrEdit(vcl::Window* pParent, const ResId& rResId) :
-                        Edit(pParent, rResId), bSpaces(false){}
-                    AutoCorrEdit(vcl::Window* pParent) :
-                        Edit(pParent), bSpaces(false){}
+    void dispose() override;
+
+public:
+    AutoCorrEdit(vcl::Window* pParent, const ResId& rResId)
+        : Edit(pParent, rResId)
+        , m_nCol(0)
+        , bSpaces(false)
+    {
+    }
+
+    AutoCorrEdit(vcl::Window* pParent)
+        : Edit(pParent)
+        , m_nCol(0)
+        , bSpaces(false)
+    {
+    }
+
+    virtual ~AutoCorrEdit();
 
     void            SetActionHdl( const Link<>& rLink )
                                 { aActionLink = rLink;}
 
+    void            ConnectColumn(const VclPtr<SvTabListBox>& rTable, sal_Int32 nCol);
+
     void            SetSpaces(bool bSet)
                                 {bSpaces = bSet;}
 
     virtual void    KeyInput( const KeyEvent& rKEvent ) SAL_OVERRIDE;
+    virtual void    Resize() SAL_OVERRIDE;
 };
 
 // class OfaAutocorrReplacePage ------------------------------------------
@@ -259,7 +277,6 @@ private:
                                 LanguageType eOldLanguage,
                                 LanguageType eNewLanguage);
 
-        void setTabs();
 public:
                         OfaAutocorrReplacePage( vcl::Window* pParent, const SfxItemSet& rSet );
                         virtual ~OfaAutocorrReplacePage();
@@ -271,8 +288,6 @@ public:
     virtual void        Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
     virtual void        ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
     virtual sfxpg       DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
-    virtual void        Resize() SAL_OVERRIDE;
-    virtual void        StateChanged(StateChangedType nStateChange) SAL_OVERRIDE;
 
     void    SetLanguage(LanguageType eSet);
     void    DeleteEntry(const OUString& sShort, const OUString& sLong);
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index c720d67..5b06d92 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -906,28 +906,9 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage( vcl::Window* pParent,
 
     m_pReplaceED->SetSpaces(true);
     m_pShortED->SetSpaces(true);
-}
-
-void OfaAutocorrReplacePage::setTabs()
-{
-    m_pReplaceTLB->SetTab(0, m_pShortED->GetPosPixel().X(), MAP_PIXEL);
-    m_pReplaceTLB->SetTab(1, m_pReplaceED->GetPosPixel().X(), MAP_PIXEL);
-}
-
-void OfaAutocorrReplacePage::StateChanged(StateChangedType nStateChange)
-{
-    SfxTabPage::StateChanged(nStateChange);
 
-    if (nStateChange == StateChangedType::InitShow)
-    {
-        setTabs();
-    }
-}
-
-void OfaAutocorrReplacePage::Resize()
-{
-    SfxTabPage::Resize();
-    setTabs();
+    m_pShortED->ConnectColumn(m_pReplaceTLB, 0);
+    m_pReplaceED->ConnectColumn(m_pReplaceTLB, 1);
 }
 
 OfaAutocorrReplacePage::~OfaAutocorrReplacePage()
@@ -1752,6 +1733,22 @@ IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, Edit*, pEdt)
 
 VCL_BUILDER_FACTORY(AutoCorrEdit)
 
+void AutoCorrEdit::dispose()
+{
+    m_xReplaceTLB.disposeAndClear();
+    Edit::dispose();
+}
+
+AutoCorrEdit::~AutoCorrEdit() {
+    disposeOnce();
+}
+
+void AutoCorrEdit::ConnectColumn(const VclPtr<SvTabListBox>& rTable, sal_Int32 nCol)
+{
+    m_xReplaceTLB = rTable;
+    m_nCol = nCol;
+}
+
 void AutoCorrEdit::KeyInput( const KeyEvent& rKEvt )
 {
     const vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
@@ -1767,6 +1764,14 @@ void AutoCorrEdit::KeyInput( const KeyEvent& rKEvt )
         Edit::KeyInput(rKEvt);
 }
 
+void AutoCorrEdit::Resize()
+{
+    Edit::Resize();
+    if (!m_xReplaceTLB)
+        return;
+    m_xReplaceTLB->SetTab(m_nCol, GetPosPixel().X(), MAP_PIXEL);
+}
+
 enum OfaQuoteOptions
 {
     ADD_NONBRK_SPACE,


More information about the Libreoffice-commits mailing list