[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - svx/sdi svx/source

2023-06-13 Thread Tomaž Vajngerl (via logerrit)
 svx/sdi/svxitems.sdi |8 -
 svx/source/xoutdev/xattr.cxx |   64 ++-
 2 files changed, 65 insertions(+), 7 deletions(-)

New commits:
commit e04080c1259cd91388e157b58e3c4b041aed163c
Author: Tomaž Vajngerl 
AuthorDate: Thu Jun 8 15:17:38 2023 +0900
Commit: Miklos Vajna 
CommitDate: Tue Jun 13 15:54:33 2023 +0200

svx: add "Color" and "ComplexColorJSON" argument for XColorItem

This is needed now that the color picker expects this argument to
be present. Without the "ComplexColorJSON" argument, it is not
possible for the color picker to set any ComplexColor attributes,
which is needed for theme support.

Change-Id: I0a04ea57826afb9f17a54ce24a4cbcc88dfe1481
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152727
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit ac2838a9cd5577f92dbece130fa6fb8b8e26e6cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152739
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi
index eabb753f647a..6e8773315d29 100644
--- a/svx/sdi/svxitems.sdi
+++ b/svx/sdi/svxitems.sdi
@@ -214,7 +214,13 @@ item String SvxPatternListItem;
 item String SfxLockBytesItem;
 item String SvxFontListItem;
 item String avmedia_MediaItem;
-item INT32  XColorItem;
+struct XColor
+{
+INT32  ColorMID_COLOR_RGB;
+String ComplexColorJSON MID_COMPLEX_COLOR_JSON;
+};
+item XColor XColorItem;
+
 item INT16  SdrPercentItem;
 item INT32  SdrMetricItem;
 
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index d3fd73f5fa04..3cb12c467b74 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -306,18 +306,70 @@ const Color& XColorItem::GetColorValue() const
 
 }
 
-bool XColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 
const
+bool XColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId) const
 {
-rVal <<= GetColorValue().GetRGBColor();
+nMemberId &= ~CONVERT_TWIPS;
+switch (nMemberId)
+{
+case MID_COMPLEX_COLOR:
+{
+auto xComplexColor = 
model::color::createXComplexColor(getComplexColor());
+rVal <<= xComplexColor;
+break;
+}
+case MID_COMPLEX_COLOR_JSON:
+{
+rVal <<= 
OStringToOUString(model::color::convertToJSON(getComplexColor()), 
RTL_TEXTENCODING_UTF8);
+break;
+}
+default:
+{
+rVal <<= GetColorValue().GetRGBColor();
+break;
+}
+}
 return true;
 }
 
-bool XColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+bool XColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId)
 {
-Color nValue;
-rVal >>= nValue;
-SetColorValue( nValue );
+nMemberId &= ~CONVERT_TWIPS;
+switch (nMemberId)
+{
+case MID_COMPLEX_COLOR:
+{
+css::uno::Reference xComplexColor;
+if (!(rVal >>= xComplexColor))
+return false;
+setComplexColor(model::color::getFromXComplexColor(xComplexColor));
+}
+break;
+case MID_COMPLEX_COLOR_JSON:
+{
+OUString sComplexColorJson;
+if (!(rVal >>= sComplexColorJson))
+return false;
+
+if (sComplexColorJson.isEmpty())
+return false;
+
+OString aJSON = OUStringToOString(sComplexColorJson, 
RTL_TEXTENCODING_ASCII_US);
+model::ComplexColor aComplexColor;
+model::color::convertFromJSON(aJSON, aComplexColor);
+setComplexColor(aComplexColor);
+}
+break;
+default:
+{
+Color nValue;
+if(!(rVal >>= nValue ))
+return false;
+
+SetColorValue( nValue );
 
+}
+break;
+}
 return true;
 }
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - svx/sdi svx/source

2023-06-08 Thread Tomaž Vajngerl (via logerrit)
 svx/sdi/xoitems.sdi|   16 +++--
 svx/source/tbxctrls/PaletteManager.cxx |2 +
 svx/source/xoutdev/xattr.cxx   |   40 +
 3 files changed, 56 insertions(+), 2 deletions(-)

New commits:
commit 1ff0a84e1f9cd82b750217e1c4042e385d5978dd
Author: Tomaž Vajngerl 
AuthorDate: Thu Jun 8 01:36:27 2023 +0900
Commit: Miklos Vajna 
CommitDate: Thu Jun 8 11:52:30 2023 +0200

tdf#155404 handle ComplexColor as JSON for XLineColor and XFillColor

This adds support for MID_COMPLEX_COLOR_JSON attribute for
XLineColorItem and XFillColorItem, which makes it possible to set
a theme colors from the UI also for fills and lines.

In addition this resolved the issue tdf#155404 which had the effect
that unsupported "Color" attribute for the UNO call resulted that
the dialog was opened. This is now not the case anymore as the
"Color" argument for XLineColorItem and XFillColorItem was added
in addition to "ComplexColorJSON" argument.

Change-Id: I8876942b07aba453cbe1422b76a1608c78e42109
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152713
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 5a2c6f4df7149f8c1f543f120fe19bd66abfc189)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152722
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/svx/sdi/xoitems.sdi b/svx/sdi/xoitems.sdi
index 015ead6e0d72..50db129a6434 100644
--- a/svx/sdi/xoitems.sdi
+++ b/svx/sdi/xoitems.sdi
@@ -24,7 +24,13 @@ struct XFillBitmap
 };
 item XFillBitmap XFillBitmapItem;
 
-item INT32  XFillColorItem; // XColorItem
+struct XFillColor
+{
+INT32 Color MID_COLOR_RGB;
+String ComplexColorJSON MID_COMPLEX_COLOR_JSON;
+};
+
+item XFillColor XFillColorItem; // XColorItem
 
 enum SvxGradientStyle
 {
@@ -84,7 +90,13 @@ item SvxFillStyle XFillStyleItem;
 
 //item String XLineAttrSetItem; SfxSetItem!
 
-item INT32  XLineColorItem;
+struct XLineColor
+{
+INT32  Color MID_COLOR_RGB;
+String ComplexColorJSON MID_COMPLEX_COLOR_JSON;
+};
+
+item XLineColor XLineColorItem;
 
 enum SvxDashStyle
 {
diff --git a/svx/source/tbxctrls/PaletteManager.cxx 
b/svx/source/tbxctrls/PaletteManager.cxx
index 3fb713f50a6e..082b07f94c92 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -428,6 +428,8 @@ void PaletteManager::DispatchColorCommand(const OUString& 
aCommand, const NamedC
 comphelper::makePropertyValue(aObj.GetURLPath()+ ".Color", 
sal_Int32(rColor.m_aColor)),
 };
 
+printf ("Sending: %s\n", aObj.GetURLPath().toUtf8().getStr());
+
 if (rColor.m_nThemeIndex != -1)
 {
 model::ComplexColor aComplexColor;
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 4860373836a8..d3fd73f5fa04 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1002,6 +1003,11 @@ bool XLineColorItem::QueryValue( css::uno::Any& rVal, 
sal_uInt8 nMemberId) const
 rVal <<= xComplexColor;
 break;
 }
+case MID_COMPLEX_COLOR_JSON:
+{
+rVal <<= 
OStringToOUString(model::color::convertToJSON(getComplexColor()), 
RTL_TEXTENCODING_UTF8);
+break;
+}
 default:
 {
 rVal <<= GetColorValue().GetRGBColor();
@@ -1024,6 +1030,20 @@ bool XLineColorItem::PutValue( const css::uno::Any& 
rVal, sal_uInt8 nMemberId)
 setComplexColor(model::color::getFromXComplexColor(xComplexColor));
 }
 break;
+case MID_COMPLEX_COLOR_JSON:
+{
+OUString sComplexColorJson;
+if (!(rVal >>= sComplexColorJson))
+return false;
+
+if (sComplexColorJson.isEmpty())
+return false;
+model::ComplexColor aComplexColor;
+OString aJSON = OUStringToOString(sComplexColorJson, 
RTL_TEXTENCODING_ASCII_US);
+model::color::convertFromJSON(aJSON, aComplexColor);
+setComplexColor(aComplexColor);
+}
+break;
 default:
 {
 sal_Int32 nValue;
@@ -1985,6 +2005,11 @@ bool XFillColorItem::QueryValue( css::uno::Any& rVal, 
sal_uInt8 nMemberId ) cons
 rVal <<= xComplexColor;
 break;
 }
+case MID_COMPLEX_COLOR_JSON:
+{
+rVal <<= 
OStringToOUString(model::color::convertToJSON(getComplexColor()), 
RTL_TEXTENCODING_UTF8);
+break;
+}
 default:
 {
 rVal <<= GetColorValue().GetRGBColor();
@@ -2034,6 +2059,21 @@ bool XFillColorItem::PutValue( const css::uno::Any& 
rVal, sal_uInt8 nMemberId )
 setComplexColor(model::color::getFromXComplexColor(xComplexColor));
 }
 break;
+case