Kaydet (Commit) 12e788f1 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#114572 immediate update of value while typing unwanted

Revert "connect to modified instead of up/down/focus-lost"

This reverts commit 44bfe8fa

Revert "listening to modify is sufficient to get all changes"

This reverts commit 5c0bb108

we probably need to distinguish a modify vs update signal to
get what I wanted here. Back to the original mode for now.

Change-Id: I51ebfc96b3a06cf09905f4a311d526f23ce371f1
Reviewed-on: https://gerrit.libreoffice.org/46958Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 054dac27
......@@ -90,11 +90,23 @@ SwWrapTabPage::SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet)
SetExchangeSupport();
Link<Edit&,void> aLk = LINK(this, SwWrapTabPage, RangeModifyHdl);
m_pLeftMarginED->SetModifyHdl(aLk);
m_pRightMarginED->SetModifyHdl(aLk);
m_pTopMarginED->SetModifyHdl(aLk);
m_pBottomMarginED->SetModifyHdl(aLk);
Link<SpinField&,void> aLk = LINK(this, SwWrapTabPage, RangeModifyHdl);
Link<Control&,void> aLk3 = LINK(this, SwWrapTabPage, RangeLoseFocusHdl);
m_pLeftMarginED->SetUpHdl(aLk);
m_pLeftMarginED->SetDownHdl(aLk);
m_pLeftMarginED->SetLoseFocusHdl(aLk3);
m_pRightMarginED->SetUpHdl(aLk);
m_pRightMarginED->SetDownHdl(aLk);
m_pRightMarginED->SetLoseFocusHdl(aLk3);
m_pTopMarginED->SetUpHdl(aLk);
m_pTopMarginED->SetDownHdl(aLk);
m_pTopMarginED->SetLoseFocusHdl(aLk3);
m_pBottomMarginED->SetUpHdl(aLk);
m_pBottomMarginED->SetDownHdl(aLk);
m_pBottomMarginED->SetLoseFocusHdl(aLk3);
Link<Button*,void> aLk2 = LINK(this, SwWrapTabPage, WrapTypeHdl);
m_pNoWrapRB->SetClickHdl(aLk2);
......@@ -552,7 +564,12 @@ DeactivateRC SwWrapTabPage::DeactivatePage(SfxItemSet* _pSet)
return DeactivateRC::LeavePage;
}
IMPL_LINK( SwWrapTabPage, RangeModifyHdl, Edit&, rSpin, void )
// range check
IMPL_LINK( SwWrapTabPage, RangeLoseFocusHdl, Control&, rControl, void )
{
RangeModifyHdl( static_cast<SpinField&>(rControl) );
}
IMPL_LINK( SwWrapTabPage, RangeModifyHdl, SpinField&, rSpin, void )
{
MetricField& rEdit = static_cast<MetricField&>(rSpin);
sal_Int64 nValue = rEdit.GetValue();
......
......@@ -149,12 +149,25 @@ void SwFormatTablePage::Init()
m_pRightBtn->SetClickHdl( aLk2 );
m_pCenterBtn->SetClickHdl( aLk2 );
Link<Edit&, void> aLk = LINK(this, SwFormatTablePage, UpDownHdl);
m_pTopMF->SetModifyHdl(aLk);
m_pBottomMF->SetModifyHdl(aLk);
m_aRightMF.SetModifyHdl(aLk);
m_aLeftMF.SetModifyHdl(aLk);
m_aWidthMF.SetModifyHdl(aLk);
Link<SpinField&,void> aLk = LINK( this, SwFormatTablePage, UpDownHdl );
m_pTopMF->SetUpHdl( aLk );
m_pBottomMF->SetUpHdl( aLk );
m_aRightMF.SetUpHdl( aLk );
m_aLeftMF.SetUpHdl( aLk );
m_aWidthMF.SetUpHdl( aLk );
m_pTopMF->SetDownHdl( aLk );
m_pBottomMF->SetDownHdl( aLk );
m_aRightMF.SetDownHdl( aLk );
m_aLeftMF.SetDownHdl( aLk );
m_aWidthMF.SetDownHdl( aLk );
Link<Control&,void> aLk3 = LINK( this, SwFormatTablePage, LoseFocusHdl );
m_pTopMF->SetLoseFocusHdl( aLk3 );
m_pBottomMF->SetLoseFocusHdl( aLk3 );
m_aRightMF.SetLoseFocusHdl( aLk3 );
m_aLeftMF.SetLoseFocusHdl( aLk3 );
m_aWidthMF.SetLoseFocusHdl( aLk3 );
m_pRelWidthCB->SetClickHdl(LINK( this, SwFormatTablePage, RelWidthClickHdl ));
}
......@@ -275,7 +288,11 @@ void SwFormatTablePage::RightModify()
}
}
IMPL_LINK( SwFormatTablePage, UpDownHdl, Edit&, rEdit, void )
IMPL_LINK( SwFormatTablePage, LoseFocusHdl, Control&, rControl, void )
{
UpDownHdl(static_cast<SpinField&>(rControl));
}
IMPL_LINK( SwFormatTablePage, UpDownHdl, SpinField&, rEdit, void )
{
if( m_aRightMF.get() == &rEdit)
RightModify();
......@@ -578,6 +595,7 @@ void SwFormatTablePage::Reset( const SfxItemSet* )
m_aRightMF.SetMax( m_aRightMF.NormalizePercent( pTableData->GetSpace() ), FUNIT_TWIP );
m_aLeftMF.SetMax( m_aLeftMF.NormalizePercent( pTableData->GetSpace() ), FUNIT_TWIP );
m_aWidthMF.SetMin( m_aWidthMF.NormalizePercent( nMinTableWidth ), FUNIT_TWIP );
}
void SwFormatTablePage::ActivatePage( const SfxItemSet& rSet )
......@@ -832,12 +850,16 @@ void SwTableColumnPage::Reset( const SfxItemSet* )
void SwTableColumnPage::Init(bool bWeb)
{
FieldUnit aMetric = ::GetDfltMetric(bWeb);
Link<Edit&,void> aLkModify = LINK(this, SwTableColumnPage, ModifyHdl);
Link<SpinField&,void> aLkUp = LINK( this, SwTableColumnPage, UpHdl );
Link<SpinField&,void> aLkDown = LINK( this, SwTableColumnPage, DownHdl );
Link<Control&,void> aLkLF = LINK( this, SwTableColumnPage, LoseFocusHdl );
for( sal_uInt16 i = 0; i < MET_FIELDS; i++ )
{
aValueTable[i] = i;
m_aFieldArr[i].SetMetric(aMetric);
m_aFieldArr[i].SetModifyHdl(aLkModify);
m_aFieldArr[i].SetUpHdl( aLkUp );
m_aFieldArr[i].SetDownHdl( aLkDown );
m_aFieldArr[i].SetLoseFocusHdl( aLkLF );
}
SetMetric(*m_pSpaceED, aMetric);
......@@ -882,10 +904,26 @@ IMPL_LINK( SwTableColumnPage, AutoClickHdl, Button*, pControl, void )
UpdateCols(0);
}
IMPL_LINK(SwTableColumnPage, ModifyHdl, Edit&, rEdit, void)
IMPL_LINK( SwTableColumnPage, UpHdl, SpinField&, rEdit, void )
{
bModified = true;
ModifyHdl( static_cast<MetricField*>(&rEdit) );
}
IMPL_LINK( SwTableColumnPage, DownHdl, SpinField&, rEdit, void )
{
bModified = true;
ModifyHdl(static_cast<MetricField*>(&rEdit));
ModifyHdl( static_cast<MetricField*>(&rEdit) );
}
IMPL_LINK( SwTableColumnPage, LoseFocusHdl, Control&, rControl, void )
{
MetricField* pEdit = static_cast<MetricField*>(&rControl);
if (pEdit->IsModified())
{
bModified = true;
ModifyHdl( pEdit );
}
}
IMPL_LINK( SwTableColumnPage, ModeHdl, Button*, pBox, void )
......@@ -901,7 +939,16 @@ IMPL_LINK( SwTableColumnPage, ModeHdl, Button*, pBox, void )
bool SwTableColumnPage::FillItemSet( SfxItemSet* )
{
if (bModified)
for(PercentField & i : m_aFieldArr)
{
if (i.HasFocus())
{
LoseFocusHdl(*i.get());
break;
}
}
if(bModified)
{
pTableData->SetColsChanged();
}
......
......@@ -23,7 +23,7 @@
#include <swdllapi.h>
#include "uitool.hxx"
//Wraps a MetricField with extra features
//Wraps a MetricField with extra features, preferred to PercentField
class SW_DLLPUBLIC PercentField
{
VclPtr<MetricField> m_pField;
......@@ -48,6 +48,8 @@ public:
void set(MetricField *pField);
const MetricField* get() const { return m_pField; }
MetricField* get() { return m_pField; }
void SetUpHdl(const Link<SpinField&,void>& rLink) { m_pField->SetUpHdl(rLink); }
void SetDownHdl(const Link<SpinField&,void>& rLink) { m_pField->SetDownHdl(rLink); }
void SetModifyHdl(const Link<Edit&,void>& rLink) { m_pField->SetModifyHdl(rLink); }
void SetLoseFocusHdl(const Link<Control&,void>& rLink) { m_pField->SetLoseFocusHdl(rLink); }
void SetMetric(FieldUnit eUnit) { ::SetMetric(*m_pField, eUnit); }
......
......@@ -79,7 +79,8 @@ class SwWrapTabPage: public SfxTabPage
virtual void ActivatePage(const SfxItemSet& rSet) override;
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
DECL_LINK( RangeModifyHdl, Edit&, void );
DECL_LINK( RangeModifyHdl, SpinField&, void );
DECL_LINK( RangeLoseFocusHdl, Control&, void );
DECL_LINK( WrapTypeHdl, Button *, void );
DECL_LINK( ContourHdl, Button *, void);
......
......@@ -74,7 +74,8 @@ class SwFormatTablePage : public SfxTabPage
DECL_LINK( AutoClickHdl, Button*, void );
DECL_LINK( RelWidthClickHdl, Button*, void );
void RightModify();
DECL_LINK( UpDownHdl, Edit&, void );
DECL_LINK( UpDownHdl, SpinField&, void );
DECL_LINK( LoseFocusHdl, Control&, void );
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
......@@ -119,7 +120,9 @@ class SwTableColumnPage : public SfxTabPage
void Init(bool bWeb);
DECL_LINK( AutoClickHdl, Button *, void );
void ModifyHdl( MetricField const * pEdit );
DECL_LINK(ModifyHdl, Edit&, void);
DECL_LINK( UpHdl, SpinField&, void );
DECL_LINK( DownHdl, SpinField&, void );
DECL_LINK( LoseFocusHdl, Control&, void );
DECL_LINK( ModeHdl, Button *, void );
void UpdateCols( sal_uInt16 nAktPos );
SwTwips GetVisibleWidth(sal_uInt16 nPos);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment