diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-04 13:04:00 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-11-28 14:15:53 +0100 |
commit | 766e0a09d06a2eed0d197a3a48f7504a079ac8dc (patch) | |
tree | d123d84f68eaecdfcbe1f5438e61fe5ac4f687ab /cui | |
parent | a50165a9b96198e6a5b9da9fca3158fcf113066e (diff) |
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@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 6213ce4ab8621ad307df25c1fd2bfeb8de5dd1f6)
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/autocdlg.hxx | 33 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 47 |
2 files changed, 50 insertions, 30 deletions
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx index 1ff86e70fcdf..4302e0a323f6 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 c720d6725028..5b06d926069d 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, |