summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-22 10:34:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-22 14:31:34 +0200
commitc0a6a4c3ae0116ada31971f80bf383c5bc6c28e8 (patch)
treec5803166cbffc6c0e5594caf3a9d5c54e644cf8e
parentcf8b3a74e8c093dd0ffc7e2f431a26864958f6fb (diff)
Resolves: tdf#120731 crash in border tabpage
Change-Id: Id11b8fdc91e552a38a78f13df410f4d364e7acbf Reviewed-on: https://gerrit.libreoffice.org/62170 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/inc/border.hxx2
-rw-r--r--cui/source/tabpages/border.cxx28
2 files changed, 28 insertions, 2 deletions
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 8097872ad362..f2994a3fadb2 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -47,6 +47,7 @@ public:
SvxShadowItem GetControlValue(const SvxShadowItem& rItem) const;
void SetControlValue(const SvxShadowItem& rItem);
+ void SetControlDontKnow();
private:
SvtValueSet& mrVsPos;
@@ -62,6 +63,7 @@ public:
SvxMarginItem GetControlValue(const SvxMarginItem& rItem) const;
void SetControlValue(const SvxMarginItem& rItem);
+ void SetControlDontKnow();
bool get_value_changed_from_saved() const;
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 17c6417f778b..7bfaf4889ad1 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -161,6 +161,13 @@ void ShadowControlsWrapper::SetControlValue(const SvxShadowItem& rItem)
mrLbColor.SelectEntry(rItem.GetColor());
}
+void ShadowControlsWrapper::SetControlDontKnow()
+{
+ mrVsPos.SetNoSelection();
+ mrMfSize.set_text("");
+ mrLbColor.SetNoSelection();
+}
+
MarginControlsWrapper::MarginControlsWrapper(weld::MetricSpinButton& rMfLeft, weld::MetricSpinButton& rMfRight,
weld::MetricSpinButton& rMfTop, weld::MetricSpinButton& rMfBottom)
: mrLeftWrp(rMfLeft)
@@ -204,6 +211,15 @@ void MarginControlsWrapper::SetControlValue(const SvxMarginItem& rItem)
mrBottomWrp.save_value();
}
+void MarginControlsWrapper::SetControlDontKnow()
+{
+ const OUString sEmpty;
+ mrLeftWrp.set_text(sEmpty);
+ mrRightWrp.set_text(sEmpty);
+ mrTopWrp.set_text(sEmpty);
+ mrBottomWrp.set_text(sEmpty);
+}
+
SvxBorderTabPage::SvxBorderTabPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs)
: SfxTabPage(pParent, "cui/ui/borderpage.ui", "BorderPage", &rCoreAttrs)
, nMinValue(0)
@@ -547,13 +563,21 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
if (m_xShadowControls)
{
sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot);
- m_xShadowControls->SetControlValue(*static_cast<const SvxShadowItem*>(rSet->GetItem(nShadowId)));
+ const SfxPoolItem* pItem = rSet->GetItem(nShadowId);
+ if (pItem)
+ m_xShadowControls->SetControlValue(*static_cast<const SvxShadowItem*>(pItem));
+ else
+ m_xShadowControls->SetControlDontKnow();
}
if (m_xMarginControls)
{
sal_uInt16 nAlignMarginId = pPool->GetWhich(SID_ATTR_ALIGN_MARGIN);
- m_xMarginControls->SetControlValue(*static_cast<const SvxMarginItem*>(rSet->GetItem(nAlignMarginId)));
+ const SfxPoolItem* pItem = rSet->GetItem(nAlignMarginId);
+ if (pItem)
+ m_xMarginControls->SetControlValue(*static_cast<const SvxMarginItem*>(pItem));
+ else
+ m_xMarginControls->SetControlDontKnow();
}
sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS);