summaryrefslogtreecommitdiffstats
path: root/editeng/source/outliner
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 /editeng/source/outliner
parenttdf#117517: Fix OpenGL text rendering on Windows (diff)
downloadcore-5c9ae702b42745bf6963d1cbb4e779b66ade0825.tar.gz
core-5c9ae702b42745bf6963d1cbb4e779b66ade0825.zip
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 'editeng/source/outliner')
-rw-r--r--editeng/source/outliner/outleeng.cxx2
-rw-r--r--editeng/source/outliner/outleeng.hxx2
-rw-r--r--editeng/source/outliner/outliner.cxx11
3 files changed, 8 insertions, 7 deletions
diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx
index ea698471b6e9..8fb8f7ee7284 100644
--- a/editeng/source/outliner/outleeng.cxx
+++ b/editeng/source/outliner/outleeng.cxx
@@ -169,7 +169,7 @@ void OutlinerEditEng::DrawingTab( const Point& rStartPos, long nWidth, const OUS
bEndOfLine, bEndOfParagraph, rOverlineColor, rTextLineColor );
}
-OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor )
+OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor )
{
return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
}
diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx
index 2b45610c16d3..5110d8be28ef 100644
--- a/editeng/source/outliner/outleeng.hxx
+++ b/editeng/source/outliner/outleeng.hxx
@@ -71,7 +71,7 @@ public:
// for text conversion
virtual bool ConvertNextDocument() override;
- virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor ) override;
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rTxtColor, boost::optional<Color>& rFldColor ) override;
virtual tools::Rectangle GetBulletArea( sal_Int32 nPara ) override;
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 97291995a7db..cc19399e1812 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -635,7 +635,7 @@ void Outliner::AddText( const OutlinerParaObject& rPObj )
pEditEngine->SetUpdateMode( bUpdate );
}
-OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor )
+OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor )
{
if ( !aCalcFieldValueHdl.IsSet() )
return OUString( ' ' );
@@ -648,12 +648,13 @@ OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara,
aCalcFieldValueHdl.Call( &aFldInfo );
if ( aFldInfo.GetTextColor() )
{
- delete rpTxtColor;
- rpTxtColor = new Color( *aFldInfo.GetTextColor() );
+ rpTxtColor = *aFldInfo.GetTextColor();
}
- delete rpFldColor;
- rpFldColor = aFldInfo.GetFieldColor() ? new Color( *aFldInfo.GetFieldColor() ) : nullptr;
+ if (aFldInfo.GetFieldColor())
+ rpFldColor = *aFldInfo.GetFieldColor();
+ else
+ rpFldColor.reset();
return aFldInfo.GetRepresentation();
}