diff options
-rw-r--r-- | editeng/source/items/textitem.cxx | 25 | ||||
-rw-r--r-- | include/editeng/colritem.hxx | 26 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/ThemePanel.cxx | 2 |
3 files changed, 28 insertions, 25 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 147fa301d548..30b780f1b855 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1354,9 +1354,10 @@ bool SvxContourItem::GetPresentation } SvxThemeColor::SvxThemeColor() - : maThemeIndex(-1), - mnLumMod(10000), - mnLumOff(0) + : maThemeIndex(-1) + , mnLumMod(10000) + , mnLumOff(0) + , mnTintOrShade(0) { } @@ -1364,7 +1365,8 @@ bool SvxThemeColor::operator==(const SvxThemeColor& rThemeColor) const { return maThemeIndex == rThemeColor.maThemeIndex && mnLumMod == rThemeColor.mnLumMod && - mnLumOff == rThemeColor.mnLumOff; + mnLumOff == rThemeColor.mnLumOff && + mnTintOrShade == rThemeColor.mnTintOrShade; } void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const @@ -1377,6 +1379,8 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const BAD_CAST(OString::number(mnLumMod).getStr())); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-off"), BAD_CAST(OString::number(mnLumOff).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("tint-or-shade"), + BAD_CAST(OString::number(mnTintOrShade).getStr())); (void)xmlTextWriterEndElement(pWriter); } @@ -1384,15 +1388,13 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxColorItem ---------------------------------------------------- SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : SfxPoolItem(nId), - mColor( COL_BLACK ), - maTintShade(0) + mColor( COL_BLACK ) { } SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) : SfxPoolItem( nId ), - mColor( rCol ), - maTintShade(0) + mColor( rCol ) { } @@ -1406,8 +1408,7 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const const SvxColorItem& rColorItem = static_cast<const SvxColorItem&>(rAttr); return mColor == rColorItem.mColor && - maThemeColor == rColorItem.maThemeColor && - maTintShade == rColorItem.maTintShade; + maThemeColor == rColorItem.maThemeColor; } bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const @@ -1433,7 +1434,7 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const } case MID_COLOR_TINT_OR_SHADE: { - rVal <<= maTintShade; + rVal <<= maThemeColor.GetTintOrShade(); break; } case MID_COLOR_LUM_MOD: @@ -1489,7 +1490,7 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int16 nTintShade = -1; if (!(rVal >>= nTintShade)) return false; - maTintShade = nTintShade; + maThemeColor.SetTintOrShade(nTintShade); } break; case MID_COLOR_LUM_MOD: diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index cbd52844b059..05a7183c8582 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -34,6 +34,8 @@ class EDITENG_DLLPUBLIC SvxThemeColor /// Luminance Offset: 100th percentage, defaults to 0%. sal_Int16 mnLumOff; + sal_Int16 mnTintOrShade; + public: explicit SvxThemeColor(); bool operator==(const SvxThemeColor& rThemeColor) const; @@ -46,8 +48,8 @@ public: void SetThemeIndex(sal_Int16 nIndex) { maThemeIndex = nIndex; - } + } void SetLumMod(sal_Int16 nLumMod) { mnLumMod = nLumMod; } sal_Int16 GetLumMod() const { return mnLumMod; } @@ -56,6 +58,16 @@ public: sal_Int16 GetLumOff() const { return mnLumOff; } + sal_Int16 GetTintOrShade() const + { + return mnTintOrShade; + } + + void SetTintOrShade(sal_Int16 nTintOrShade) + { + mnTintOrShade = nTintOrShade; + } + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; @@ -66,7 +78,7 @@ class EDITENG_DLLPUBLIC SvxColorItem final : public SfxPoolItem private: Color mColor; SvxThemeColor maThemeColor; - sal_Int16 maTintShade; + public: static SfxPoolItem* CreateDefault(); @@ -93,16 +105,6 @@ public: } void SetValue(const Color& rNewColor); - sal_Int16 GetTintOrShade() const - { - return maTintShade; - } - - void SetTintOrShade(sal_Int16 nTintOrShade) - { - maTintShade = nTintOrShade; - } - SvxThemeColor& GetThemeColor() { return maThemeColor; } const SvxThemeColor& GetThemeColor() const { return maThemeColor; } diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index aabe27bb8bb0..d392382e1e31 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -221,7 +221,7 @@ void changeColor(SwTextFormatColl* pCollection, svx::ColorSet const& rColorSet, if (nThemeIndex >= 0) { Color aColor = rColorSet.getColor(nThemeIndex); - aColor.ApplyTintOrShade(aColorItem.GetTintOrShade()); + aColor.ApplyTintOrShade(aColorItem.GetThemeColor().GetTintOrShade()); aColorItem.SetValue(aColor); pCollection->SetFormatAttr(aColorItem); } |