Kaydet (Commit) 045e4115 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#61665 modifying column width widgets crashes

Change-Id: Ifc9b31cad9e9935c4873c2785f203bd07d1f118e
üst 5fff8a99
...@@ -437,16 +437,11 @@ SwColumnPage::SwColumnPage(Window *pParent, const SfxItemSet &rSet) ...@@ -437,16 +437,11 @@ SwColumnPage::SwColumnPage(Window *pParent, const SfxItemSet &rSet)
get(m_pPgeExampleWN, "pageexample"); get(m_pPgeExampleWN, "pageexample");
get(m_pFrmExampleWN, "frameexample"); get(m_pFrmExampleWN, "frameexample");
MetricField *pEd1 = get<MetricField>("width1mf"); connectPercentFieldWrapper(aEd1, "width1mf");
aEd1.set(pEd1); connectPercentFieldWrapper(aEd2, "width2mf");
MetricField *pEd2 = get<MetricField>("width2mf"); connectPercentFieldWrapper(aEd3, "width3mf");
aEd2.set(pEd2); connectPercentFieldWrapper(aDistEd1, "spacing1mf");
MetricField *pEd3 = get<MetricField>("width3mf"); connectPercentFieldWrapper(aDistEd2, "spacing2mf");
aEd3.set(pEd3);
MetricField *pDistEd1 = get<MetricField>("spacing1mf");
aDistEd1.set(pDistEd1);
MetricField *pDistEd2 = get<MetricField>("spacing2mf");
aDistEd2.set(pDistEd2);
SetExchangeSupport(); SetExchangeSupport();
...@@ -561,6 +556,14 @@ void SwColumnPage::SetPageWidth(long nPageWidth) ...@@ -561,6 +556,14 @@ void SwColumnPage::SetPageWidth(long nPageWidth)
aEd3.SetMax(nNewMaxWidth, FUNIT_TWIP); 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) void SwColumnPage::Reset(const SfxItemSet &rSet)
{ {
sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
...@@ -960,8 +963,10 @@ IMPL_LINK( SwColumnPage, ColModify, NumericField *, pNF ) ...@@ -960,8 +963,10 @@ IMPL_LINK( SwColumnPage, ColModify, NumericField *, pNF )
of the column width is overruled; only an alteration of the column width is overruled; only an alteration
of the column number leads back to that default. 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))); long nActValue = static_cast< long >(pFld->DenormalizePercent(pFld->GetValue(FUNIT_TWIP)));
if(nCols < 2) if(nCols < 2)
return 0; return 0;
...@@ -1031,8 +1036,10 @@ IMPL_LINK( SwColumnPage, GapModify, PercentFieldWrap *, pFld ) ...@@ -1031,8 +1036,10 @@ IMPL_LINK( SwColumnPage, GapModify, PercentFieldWrap *, pFld )
return 0; return 0;
} }
IMPL_LINK( SwColumnPage, EdModify, PercentFieldWrap *, pField ) IMPL_LINK( SwColumnPage, EdModify, MetricField *, pMetricFld )
{ {
PercentFieldWrap *pField = m_aPercentFieldWrappersMap[pMetricFld];
assert(pField);
pModifiedField = pField; pModifiedField = pField;
Timeout(); Timeout();
return 0; return 0;
......
...@@ -134,6 +134,9 @@ class SwColumnPage : public SfxTabPage ...@@ -134,6 +134,9 @@ class SwColumnPage : public SfxTabPage
long nColDist[nMaxCols]; long nColDist[nMaxCols];
sal_uInt16 nMinWidth; sal_uInt16 nMinWidth;
PercentFieldWrap* pModifiedField; PercentFieldWrap* pModifiedField;
std::map<MetricField*, PercentFieldWrap*> m_aPercentFieldWrappersMap;
sal_Bool bFormat; sal_Bool bFormat;
sal_Bool bFrm; sal_Bool bFrm;
sal_Bool bHtmlMode; sal_Bool bHtmlMode;
...@@ -141,8 +144,8 @@ class SwColumnPage : public SfxTabPage ...@@ -141,8 +144,8 @@ class SwColumnPage : public SfxTabPage
// Handler // Handler
DECL_LINK( ColModify, NumericField * ); DECL_LINK( ColModify, NumericField * );
DECL_LINK( GapModify, PercentFieldWrap * ); DECL_LINK( GapModify, MetricField * );
DECL_LINK( EdModify, PercentFieldWrap * ); DECL_LINK( EdModify, MetricField * );
DECL_LINK( AutoWidthHdl, CheckBox * ); DECL_LINK( AutoWidthHdl, CheckBox * );
DECL_LINK( SetDefaultsHdl, ValueSet * ); DECL_LINK( SetDefaultsHdl, ValueSet * );
...@@ -166,6 +169,8 @@ class SwColumnPage : public SfxTabPage ...@@ -166,6 +169,8 @@ class SwColumnPage : public SfxTabPage
SwColumnPage(Window *pParent, const SfxItemSet &rSet); SwColumnPage(Window *pParent, const SfxItemSet &rSet);
void connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName);
public: public:
virtual ~SwColumnPage(); virtual ~SwColumnPage();
......
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