summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-09 12:17:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-10 08:42:37 +0200
commit5c9ae702b42745bf6963d1cbb4e779b66ade0825 (patch)
tree323545cbc5386b483067030b66cf5ca07bc25e45 /svx
parentc5f8a296fcfc08f8ac441cb8300a7565caa50b53 (diff)
store Color using boost::optional in EditCharAttribField
Change-Id: If4af5991be51cdb035c0bc0fb7668844df703073 Reviewed-on: https://gerrit.libreoffice.org/54022 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/accessibility/AccessibleEmptyEditSource.cxx2
-rw-r--r--svx/source/dialog/ClassificationEditView.cxx2
-rw-r--r--svx/source/svdraw/svdedxv.cxx10
-rw-r--r--svx/source/svdraw/svdomeas.cxx11
-rw-r--r--svx/source/svdraw/svdotxfl.cxx2
-rw-r--r--svx/source/svdraw/svdoutl.cxx2
6 files changed, 12 insertions, 17 deletions
diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
index f42ba7221187..0b87947ce329 100644
--- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx
+++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
@@ -120,7 +120,7 @@ namespace accessibility
//XTextCopy
void CopyText(const SvxTextForwarder& ) override {}
- OUString CalcFieldValue( const SvxFieldItem& /*rField*/, sal_Int32 /*nPara*/, sal_Int32 /*nPos*/, Color*& /*rpTxtColor*/, Color*& /*rpFldColor*/ ) override
+ OUString CalcFieldValue( const SvxFieldItem& /*rField*/, sal_Int32 /*nPara*/, sal_Int32 /*nPos*/, boost::optional<Color>& /*rpTxtColor*/, boost::optional<Color>& /*rpFldColor*/ ) override
{
return OUString();
}
diff --git a/svx/source/dialog/ClassificationEditView.cxx b/svx/source/dialog/ClassificationEditView.cxx
index aad04dcfd8ac..3fda7b5dc6c9 100644
--- a/svx/source/dialog/ClassificationEditView.cxx
+++ b/svx/source/dialog/ClassificationEditView.cxx
@@ -29,7 +29,7 @@ ClassificationEditEngine::ClassificationEditEngine(SfxItemPool* pItemPool)
{}
OUString ClassificationEditEngine::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 /*nPara*/,
- sal_Int32 /*nPos*/, Color*& /*rTxtColor*/, Color*& /*rFldColor*/)
+ sal_Int32 /*nPos*/, boost::optional<Color>& /*rTxtColor*/, boost::optional<Color>& /*rFldColor*/)
{
OUString aString;
const ClassificationField* pClassificationField = dynamic_cast<const ClassificationField*>(rField.GetField());
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index bab1f5e71898..93d317ff0fbf 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -975,17 +975,15 @@ IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI,void)
rStr.clear();
SdrTextObj* pTextObj = mxTextEditObj.get();
if (pTextObj!=nullptr) {
- Color* pTxtCol=nullptr;
- Color* pFldCol=nullptr;
+ boost::optional<Color> pTxtCol;
+ boost::optional<Color> pFldCol;
bOk=pTextObj->CalcFieldValue(pFI->GetField(),pFI->GetPara(),pFI->GetPos(),true,pTxtCol,pFldCol,rStr);
if (bOk) {
- if (pTxtCol!=nullptr) {
+ if (pTxtCol) {
pFI->SetTextColor(*pTxtCol);
- delete pTxtCol;
}
- if (pFldCol!=nullptr) {
+ if (pFldCol) {
pFI->SetFieldColor(*pFldCol);
- delete pFldCol;
} else {
pFI->SetFieldColor(COL_LIGHTGRAY); // TODO: remove this later on (357)
}
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index a7cbdda2297d..918b6fd4ebce 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -549,18 +549,15 @@ basegfx::B2DPolyPolygon SdrMeasureObj::ImpCalcXPoly(const ImpMeasurePoly& rPol)
bool SdrMeasureObj::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
bool bEdit,
- Color*& rpTxtColor, Color*& rpFldColor, OUString& rRet) const
+ boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor, OUString& rRet) const
{
const SvxFieldData* pField=rField.GetField();
const SdrMeasureField* pMeasureField=dynamic_cast<const SdrMeasureField*>( pField );
if (pMeasureField!=nullptr) {
rRet = TakeRepresentation(pMeasureField->GetMeasureFieldKind());
- if (rpFldColor!=nullptr) {
- if (!bEdit)
- {
- delete rpFldColor;
- rpFldColor=nullptr;
- }
+ if (rpFldColor && !bEdit)
+ {
+ rpFldColor.reset();
}
return true;
} else {
diff --git a/svx/source/svdraw/svdotxfl.cxx b/svx/source/svdraw/svdotxfl.cxx
index 4fe84291dc80..c8e82711b6a3 100644
--- a/svx/source/svdraw/svdotxfl.cxx
+++ b/svx/source/svdraw/svdotxfl.cxx
@@ -22,7 +22,7 @@
#include <svx/svdotext.hxx>
bool SdrTextObj::CalcFieldValue(const SvxFieldItem& /*rField*/, sal_Int32 /*nPara*/, sal_uInt16 /*nPos*/,
- bool /*bEdit*/, Color*& /*rpTxtColor*/, Color*& /*rpFldColor*/, OUString& /*rRet*/) const
+ bool /*bEdit*/, boost::optional<Color>& /*rpTxtColor*/, boost::optional<Color>& /*rpFldColor*/, OUString& /*rRet*/) const
{
return false;
}
diff --git a/svx/source/svdraw/svdoutl.cxx b/svx/source/svdraw/svdoutl.cxx
index bebb82b76c54..c2befff17c15 100644
--- a/svx/source/svdraw/svdoutl.cxx
+++ b/svx/source/svdraw/svdoutl.cxx
@@ -72,7 +72,7 @@ void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
}
OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
- Color*& rpTxtColor, Color*& rpFldColor)
+ boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor)
{
bool bOk = false;
OUString aRet;