From 7f9668926d03de947a73c0b3a5e2f6490701fcad Mon Sep 17 00:00:00 2001 From: Gülşah Köse Date: Wed, 26 May 2021 08:47:38 +0300 Subject: Seperate SvxBackgroundColorItem from SvxColorItem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116183 --- include/editeng/colritem.hxx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'include/editeng/colritem.hxx') diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index 1eab79723577..8e081fc6aab1 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 { +private: + Color mColor; + public: static SfxPoolItem* CreateDefault(); SvxBackgroundColorItem(const sal_uInt16 nId); SvxBackgroundColorItem(const Color& rCol, const sal_uInt16 nId); + virtual ~SvxBackgroundColorItem() override; - virtual SvxBackgroundColorItem* Clone(SfxItemPool* pPool = nullptr) const 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; + + virtual SvxBackgroundColorItem* Clone(SfxItemPool* pPool = nullptr) const override; + SvxBackgroundColorItem(SvxBackgroundColorItem const &) = default; // SfxPoolItem copy function dichotomy + + const Color& GetValue() const + { + return mColor; + } + + void SetValue(const Color& rNewColor); + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; #endif -- cgit