summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-09-20 19:20:59 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-11-16 14:19:40 +0100
commit5006dfcbc370e80bd159a9e957254b0ce09a6cdd (patch)
treecf00f2f3b8eed3eb7bdba5ce9e00aee9949c3929
parente73e45e0ff14f4b0fe443d95937cc5f5a166feb4 (diff)
Theme color and tint/shade attribute for SvxColorItem
To support theme colors the SvxColorItem must be extended with an optional attribute theme index to define the index to which theme color current color belongs and an optional tint/shade attribute define how much the color ha been additionally tinted or shaded. [ Miklos: left out the potentially breaking svx/sdi/svxitems.sdi changes. ] (cherry picked from commit ccdbf815e00dbe2ba21f7e86b6743df100b7401f, from the feature/themesupport2 branch) Change-Id: Ifb0481770be675181dafa94cd2778f374fcf3c7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125296 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--editeng/source/items/textitem.cxx43
-rw-r--r--include/editeng/colritem.hxx22
-rw-r--r--include/editeng/memberids.h8
-rw-r--r--offapi/com/sun/star/style/CharacterProperties.idl12
4 files changed, 79 insertions, 6 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 75470ff20e4a..8ecfa67584aa 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1354,14 +1354,18 @@ bool SvxContourItem::GetPresentation
// class SvxColorItem ----------------------------------------------------
SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
- SfxPoolItem( nId ),
- mColor( COL_BLACK )
+ SfxPoolItem(nId),
+ mColor( COL_BLACK ),
+ maThemeIndex(-1),
+ maTintShade(0)
{
}
SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
SfxPoolItem( nId ),
- mColor( rCol )
+ mColor( rCol ),
+ maThemeIndex(-1),
+ maTintShade(0)
{
}
@@ -1372,8 +1376,11 @@ SvxColorItem::~SvxColorItem()
bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
+ const SvxColorItem& rColorItem = static_cast<const SvxColorItem&>(rAttr);
- return mColor == static_cast<const SvxColorItem&>( rAttr ).mColor;
+ return mColor == rColorItem.mColor &&
+ maThemeIndex == rColorItem.maThemeIndex &&
+ maTintShade == rColorItem.maTintShade;
}
bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1392,6 +1399,16 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
rVal <<= mColor.GetAlpha() == 0;
break;
}
+ case MID_COLOR_THEME_INDEX:
+ {
+ rVal <<= maThemeIndex;
+ break;
+ }
+ case MID_COLOR_TINT_OR_SHADE:
+ {
+ rVal <<= maTintShade;
+ break;
+ }
default:
{
rVal <<= mColor;
@@ -1422,11 +1439,29 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
mColor.SetAlpha( Any2Bool( rVal ) ? 0 : 255 );
return true;
}
+ case MID_COLOR_THEME_INDEX:
+ {
+ sal_Int16 nIndex = -1;
+ if (!(rVal >>= nIndex))
+ return false;
+ maThemeIndex = nIndex;
+ }
+ break;
+ case MID_COLOR_TINT_OR_SHADE:
+ {
+ sal_Int16 nTintShade = -1;
+ if (!(rVal >>= nTintShade))
+ return false;
+ maTintShade = nTintShade;
+ }
+ break;
default:
{
return rVal >>= mColor;
}
+ break;
}
+ return true;
}
SvxColorItem* SvxColorItem::Clone( SfxItemPool * ) const
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
index afb1d9d15c18..ce51be7f3e30 100644
--- a/include/editeng/colritem.hxx
+++ b/include/editeng/colritem.hxx
@@ -31,6 +31,8 @@ class EDITENG_DLLPUBLIC SvxColorItem final : public SfxPoolItem
{
private:
Color mColor;
+ sal_Int16 maThemeIndex;
+ sal_Int16 maTintShade;
public:
static SfxPoolItem* CreateDefault();
@@ -57,6 +59,26 @@ public:
}
void SetValue(const Color& rNewColor);
+ sal_Int16 GetThemeIndex() const
+ {
+ return maThemeIndex;
+ }
+
+ void SetThemeIndex(sal_Int16 nIndex)
+ {
+ maThemeIndex = nIndex;
+ }
+
+ sal_Int16 GetTintOrShade() const
+ {
+ return maTintShade;
+ }
+
+ void SetTintOrShade(sal_Int16 nTintOrShade)
+ {
+ maTintShade = nTintOrShade;
+ }
+
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index 8a6c9d0e7769..c6d781da568a 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -178,8 +178,12 @@
#define MID_SHADOW_TRANSPARENCE 1
// SvxColorItem
-#define MID_COLOR_RGB 0
-#define MID_COLOR_ALPHA 1
+#define MID_COLOR_RGB 0
+#define MID_COLOR_ALPHA 1
+//#define MID_GRAPHIC_TRANSPARENT 3 // used, but already defined above
+#define MID_COLOR_THEME_INDEX 4
+#define MID_COLOR_TINT_OR_SHADE 5
+
#endif
diff --git a/offapi/com/sun/star/style/CharacterProperties.idl b/offapi/com/sun/star/style/CharacterProperties.idl
index 2f8a87448a33..edb40949dcff 100644
--- a/offapi/com/sun/star/style/CharacterProperties.idl
+++ b/offapi/com/sun/star/style/CharacterProperties.idl
@@ -468,6 +468,18 @@ published service CharacterProperties
*/
[optional, property] short CharTransparence;
+ /** If available, keeps the color theme index, so that the character can
+ * be re-colored easily based on a theme.
+ *
+ * @since LibreOffice 7.3
+ **/
+ [optional, property] short CharColorTheme;
+
+ /** Tint or shade of the character color.
+ *
+ * @since LibreOffice 7.3
+ **/
+ [optional, property] short CharColorTintOrShade;
};
}; }; }; };