summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-01-05 13:12:34 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-01-18 12:57:51 +0000
commit8cec5a700a36ad6d3ac6b054a3366b22354d7f1d (patch)
treed5633bb5471805efade88ce9471544cce023e651 /svx
parent5b1f5319fc065eac71267b29472111d81e0dc14e (diff)
support theme color for lines + oox support + tests
Extended XLineColor to handle model::ThemeColor which then maps to the newly added LineColorThemeData property. Extended oox import and export to map the scheme color elements to and from ThemeColor. Added a new test to check the theme line color in impress shapes. Change-Id: I23ecc18c88b5b47608c9110f5681f189d02e2f36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145071 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit af8fdba1194e657237f9abc460381a1c4bc49982) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145651 Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/table/cell.cxx12
-rw-r--r--svx/source/unodraw/unoshape.cxx10
-rw-r--r--svx/source/xoutdev/xattr.cxx44
3 files changed, 58 insertions, 8 deletions
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 89c2113fd4f4..8aef7510e45a 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -55,6 +55,7 @@
#include <editeng/charrotateitem.hxx>
#include <svx/xflbstit.hxx>
#include <svx/xflbmtit.hxx>
+#include <svx/xlnclit.hxx>
#include <svx/svdpool.hxx>
#include <svx/xflclit.hxx>
#include <tools/diagnose_ex.h>
@@ -1444,7 +1445,6 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName )
}
break;
case XATTR_FILLCOLOR:
-
if (pMap->nMemberId == MID_COLOR_THEME_INDEX)
{
const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
@@ -1490,6 +1490,16 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName )
}
}
break;
+ case XATTR_LINECOLOR:
+ if (pMap->nMemberId == MID_COLOR_THEME_REFERENCE)
+ {
+ auto const* pColor = rSet.GetItem<XLineColorItem>(pMap->nWID);
+ if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown)
+ {
+ eState = PropertyState_DEFAULT_VALUE;
+ }
+ }
+ break;
}
}
}
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 1f02b0c97c31..5cc292621bfa 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -42,6 +42,7 @@
#include <svx/xflbmtit.hxx>
#include <svx/xlnstit.hxx>
#include <svx/xlnedit.hxx>
+#include <svx/xlnclit.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdobjkind.hxx>
#include <svx/unopage.hxx>
@@ -2086,6 +2087,15 @@ beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName )
}
}
break;
+ case XATTR_LINECOLOR:
+ if (pMap->nMemberId == MID_COLOR_THEME_REFERENCE)
+ {
+ auto const* pColor = rSet.GetItem<XLineColorItem>(pMap->nWID);
+ if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown)
+ {
+ eState = beans::PropertyState_DEFAULT_VALUE;
+ }
+ }
break;
}
}
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index d5da15155815..608829503d16 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -990,19 +990,49 @@ bool XLineColorItem::GetPresentation
return true;
}
-bool XLineColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+bool XLineColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId) const
{
- rVal <<= GetColorValue().GetRGBColor();
+ nMemberId &= ~CONVERT_TWIPS;
+ switch (nMemberId)
+ {
+ case MID_COLOR_THEME_REFERENCE:
+ {
+ auto xThemeColor = model::theme::createXThemeColor(GetThemeColor());
+ rVal <<= xThemeColor;
+ break;
+ }
+ default:
+ {
+ rVal <<= GetColorValue().GetRGBColor();
+ break;
+ }
+ }
return true;
}
-bool XLineColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+bool XLineColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId)
{
- sal_Int32 nValue = 0;
- if(!(rVal >>= nValue))
- return false;
+ nMemberId &= ~CONVERT_TWIPS;
+ switch(nMemberId)
+ {
+ case MID_COLOR_THEME_REFERENCE:
+ {
+ css::uno::Reference<css::util::XThemeColor> xThemeColor;
+ if (!(rVal >>= xThemeColor))
+ return false;
+ model::theme::setFromXThemeColor(GetThemeColor(), xThemeColor);
+ }
+ break;
+ default:
+ {
+ sal_Int32 nValue;
+ if(!(rVal >>= nValue ))
+ return false;
- SetColorValue( Color(ColorTransparency, nValue) );
+ SetColorValue( Color(ColorTransparency, nValue) );
+ break;
+ }
+ }
return true;
}