diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2021-05-26 08:47:38 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-05-28 12:18:03 +0200 |
commit | 672044c7e5eb4d1b506593de0b843d31c9ec0780 (patch) | |
tree | 0136e535643393ece136a173b4f421ac52740a4c /include | |
parent | 1ecc7cd62b5fb571f6f7599ceea90aecc8a6f9f1 (diff) |
Seperate SvxBackgroundColorItem from SvxColorItem
SvxBackgroundColorItem derivated from SfxPoolItem instead of
SvxColorItem.
Casting is common usage to control if object is this or not.
When we can cast SvxBackgroundColorItem to SvxColorItem we can not
seperate them anymore.
eg: Char color is a SvxColorItem and char background color is a
SvxBackgroundColorItem. They can be hold together and we should
understand they are different types.
Change-Id: I7b1879a1b00de26c0b8a2d9f8d658aa3aef75ecb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116135
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116185
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/editeng/colritem.hxx | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index e1bf9e0c0a5d..b9fcd4c228bd 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -61,17 +61,37 @@ public: }; // XXX: to be moved in a separate header. -class EDITENG_DLLPUBLIC SvxBackgroundColorItem final : public SvxColorItem +class EDITENG_DLLPUBLIC SvxBackgroundColorItem final : public SfxPoolItem { - public: - static SfxPoolItem* CreateDefault(); +private: + Color mColor; + +public: + static SfxPoolItem* CreateDefault(); + + SvxBackgroundColorItem(const sal_uInt16 nId); + SvxBackgroundColorItem(const Color& rCol, const sal_uInt16 nId); + virtual ~SvxBackgroundColorItem() override; + + virtual bool operator==(const SfxPoolItem& rPoolItem) const override; + virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; + virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; + + virtual bool GetPresentation(SfxItemPresentation ePres, + MapUnit eCoreMetric, MapUnit ePresMetric, + OUString &rText, const IntlWrapper& rIntlWrapper) const override; - SvxBackgroundColorItem(const sal_uInt16 nId); - SvxBackgroundColorItem(const Color& rCol, const sal_uInt16 nId); + virtual SvxBackgroundColorItem* Clone(SfxItemPool* pPool = nullptr) const override; + SvxBackgroundColorItem(SvxBackgroundColorItem const &) = default; // SfxPoolItem copy function dichotomy - virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override; - virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; - virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; + const Color& GetValue() const + { + return mColor; + } + + void SetValue(const Color& rNewColor); + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; #endif |