diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-26 10:30:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-26 14:58:23 +0100 |
commit | f74bf51d9cdfc64b72434d062a67dba65eaf7447 (patch) | |
tree | 0018c160088b3118f3df186939996014419843d9 /sc | |
parent | 1efcc72d4ac27c9c5f151e410ca3066521c14355 (diff) |
std::unique_ptr -> std::optional
Change-Id: Ib3a901c26874bb6e6b7deacca359cefacbb0a3e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104798
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/output.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/output.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 12 |
3 files changed, 14 insertions, 13 deletions
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index a5de8bbac213..a1e5d6661135 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -28,6 +28,7 @@ #include <editeng/svxenum.hxx> #include <vcl/outdev.hxx> #include <o3tl/deleter.hxx> +#include <optional> namespace sc { struct SpellCheckContext; @@ -216,9 +217,9 @@ private: bool mbForceAutoColor; bool mbSyntaxMode; // Syntax highlighting - std::unique_ptr<Color> pValueColor; - std::unique_ptr<Color> pTextColor; - std::unique_ptr<Color> pFormulaColor; + std::optional<Color> mxValueColor; + std::optional<Color> mxTextColor; + std::optional<Color> mxFormulaColor; Color aGridColor; diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index c44ae0e2c095..4a9c035d16a2 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -277,12 +277,12 @@ void ScOutputData::SetMetaFileMode( bool bNewMode ) void ScOutputData::SetSyntaxMode( bool bNewMode ) { mbSyntaxMode = bNewMode; - if ( bNewMode && !pValueColor ) + if ( bNewMode && !mxValueColor ) { const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); - pValueColor.reset( new Color( rColorCfg.GetColorValue( svtools::CALCVALUE ).nColor ) ); - pTextColor.reset( new Color( rColorCfg.GetColorValue( svtools::CALCTEXT ).nColor ) ); - pFormulaColor.reset( new Color( rColorCfg.GetColorValue( svtools::CALCFORMULA ).nColor ) ); + mxValueColor = rColorCfg.GetColorValue( svtools::CALCVALUE ).nColor; + mxTextColor = rColorCfg.GetColorValue( svtools::CALCTEXT ).nColor; + mxFormulaColor = rColorCfg.GetColorValue( svtools::CALCFORMULA ).nColor; } } diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 50fbbd2070c1..564221da4ade 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -864,13 +864,13 @@ void ScOutputData::SetSyntaxColor( vcl::Font* pFont, const ScRefCellValue& rCell switch (rCell.meType) { case CELLTYPE_VALUE: - pFont->SetColor(*pValueColor); + pFont->SetColor(*mxValueColor); break; case CELLTYPE_STRING: - pFont->SetColor(*pTextColor); + pFont->SetColor(*mxTextColor); break; case CELLTYPE_FORMULA: - pFont->SetColor(*pFormulaColor); + pFont->SetColor(*mxFormulaColor); break; default: { @@ -894,13 +894,13 @@ void ScOutputData::SetEditSyntaxColor( EditEngine& rEngine, const ScRefCellValue switch (rCell.meType) { case CELLTYPE_VALUE: - aColor = *pValueColor; + aColor = *mxValueColor; break; case CELLTYPE_STRING: - aColor = *pTextColor; + aColor = *mxTextColor; break; case CELLTYPE_FORMULA: - aColor = *pFormulaColor; + aColor = *mxFormulaColor; break; default: { |