diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-18 15:05:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-19 09:40:22 +0100 |
commit | d4cafd20506a60a148b55e716c690a74c943def7 (patch) | |
tree | 208ea984d2c9f33cffdf4f1f0729964a7ca7d78f /include/editeng | |
parent | ddaaf6d1ae63320e15ce797ca2c0f11a2b539bee (diff) |
use boost::optional in EditFieldInfo
it is inefficient to allocate a tiny object like Color separately on the
heap
Change-Id: I2f03538f987ff032857f3316ed2d8c2c8d731549
Reviewed-on: https://gerrit.libreoffice.org/67968
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/editeng')
-rw-r--r-- | include/editeng/outliner.hxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 1158f7195fea..67d2c47bb222 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -49,6 +49,7 @@ #include <editeng/paragraphdata.hxx> #include <o3tl/typed_flags_set.hxx> +#include <boost/optional.hpp> #include <functional> #include <memory> #include <vector> @@ -497,8 +498,8 @@ private: Outliner* pOutliner; const SvxFieldItem& rFldItem; - std::unique_ptr<Color> pTxtColor; - std::unique_ptr<Color> pFldColor; + boost::optional<Color> mxTxtColor; + boost::optional<Color> mxFldColor; OUString aRepresentation; @@ -522,15 +523,11 @@ public: const SvxFieldItem& GetField() const { return rFldItem; } - Color* GetTextColor() const { return pTxtColor.get(); } - void SetTextColor( const Color& rColor ) - { pTxtColor.reset( new Color( rColor ) ); } + boost::optional<Color> const & GetTextColor() const { return mxTxtColor; } + void SetTextColor( boost::optional<Color> xCol ) { mxTxtColor = xCol; } - Color* GetFieldColor() const { return pFldColor.get(); } - void SetFieldColor( const Color& rColor ) - { pFldColor.reset( new Color( rColor ) ); } - void ClearFieldColor() - { pFldColor.reset(); } + boost::optional<Color> const & GetFieldColor() const { return mxFldColor; } + void SetFieldColor( boost::optional<Color> xCol ) { mxFldColor = xCol; } sal_Int32 GetPara() const { return nPara; } sal_Int32 GetPos() const { return nPos; } |