diff options
-rw-r--r-- | sw/source/ui/frmdlg/column.cxx | 31 | ||||
-rw-r--r-- | sw/source/ui/inc/column.hxx | 9 |
2 files changed, 26 insertions, 14 deletions
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 873236ca2042..85093848937b 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -437,16 +437,11 @@ SwColumnPage::SwColumnPage(Window *pParent, const SfxItemSet &rSet) get(m_pPgeExampleWN, "pageexample"); get(m_pFrmExampleWN, "frameexample"); - MetricField *pEd1 = get<MetricField>("width1mf"); - aEd1.set(pEd1); - MetricField *pEd2 = get<MetricField>("width2mf"); - aEd2.set(pEd2); - MetricField *pEd3 = get<MetricField>("width3mf"); - aEd3.set(pEd3); - MetricField *pDistEd1 = get<MetricField>("spacing1mf"); - aDistEd1.set(pDistEd1); - MetricField *pDistEd2 = get<MetricField>("spacing2mf"); - aDistEd2.set(pDistEd2); + connectPercentFieldWrapper(aEd1, "width1mf"); + connectPercentFieldWrapper(aEd2, "width2mf"); + connectPercentFieldWrapper(aEd3, "width3mf"); + connectPercentFieldWrapper(aDistEd1, "spacing1mf"); + connectPercentFieldWrapper(aDistEd2, "spacing2mf"); SetExchangeSupport(); @@ -561,6 +556,14 @@ void SwColumnPage::SetPageWidth(long nPageWidth) aEd3.SetMax(nNewMaxWidth, FUNIT_TWIP); } +void SwColumnPage::connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName) +{ + MetricField *pFld = get<MetricField>(rName); + assert(pFld); + rWrap.set(pFld); + m_aPercentFieldWrappersMap[pFld] = &rWrap; +} + void SwColumnPage::Reset(const SfxItemSet &rSet) { sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); @@ -960,8 +963,10 @@ IMPL_LINK( SwColumnPage, ColModify, NumericField *, pNF ) of the column width is overruled; only an alteration of the column number leads back to that default. ------------------------------------------------------------------------*/ -IMPL_LINK( SwColumnPage, GapModify, PercentFieldWrap *, pFld ) +IMPL_LINK( SwColumnPage, GapModify, MetricField*, pMetricFld ) { + PercentFieldWrap *pFld = m_aPercentFieldWrappersMap[pMetricFld]; + assert(pFld); long nActValue = static_cast< long >(pFld->DenormalizePercent(pFld->GetValue(FUNIT_TWIP))); if(nCols < 2) return 0; @@ -1031,8 +1036,10 @@ IMPL_LINK( SwColumnPage, GapModify, PercentFieldWrap *, pFld ) return 0; } -IMPL_LINK( SwColumnPage, EdModify, PercentFieldWrap *, pField ) +IMPL_LINK( SwColumnPage, EdModify, MetricField *, pMetricFld ) { + PercentFieldWrap *pField = m_aPercentFieldWrappersMap[pMetricFld]; + assert(pField); pModifiedField = pField; Timeout(); return 0; diff --git a/sw/source/ui/inc/column.hxx b/sw/source/ui/inc/column.hxx index 40a2603a034f..8cb80c152e01 100644 --- a/sw/source/ui/inc/column.hxx +++ b/sw/source/ui/inc/column.hxx @@ -134,6 +134,9 @@ class SwColumnPage : public SfxTabPage long nColDist[nMaxCols]; sal_uInt16 nMinWidth; PercentFieldWrap* pModifiedField; + + std::map<MetricField*, PercentFieldWrap*> m_aPercentFieldWrappersMap; + sal_Bool bFormat; sal_Bool bFrm; sal_Bool bHtmlMode; @@ -141,8 +144,8 @@ class SwColumnPage : public SfxTabPage // Handler DECL_LINK( ColModify, NumericField * ); - DECL_LINK( GapModify, PercentFieldWrap * ); - DECL_LINK( EdModify, PercentFieldWrap * ); + DECL_LINK( GapModify, MetricField * ); + DECL_LINK( EdModify, MetricField * ); DECL_LINK( AutoWidthHdl, CheckBox * ); DECL_LINK( SetDefaultsHdl, ValueSet * ); @@ -166,6 +169,8 @@ class SwColumnPage : public SfxTabPage SwColumnPage(Window *pParent, const SfxItemSet &rSet); + void connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName); + public: virtual ~SwColumnPage(); |