summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2023-12-08 12:42:37 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-12-12 09:39:32 +0100
commitaa281fab00724d23c8d6f1f7fd557e3f05dcfc51 (patch)
tree48f0632801a139b32accc54fd12c2517d0bba23d
parent0be761900d69febd9ccb2a6a88b6183416d09c7b (diff)
tdf#158421 use correct awt:Gradient2 in Chart lists
Change-Id: I5fa02c2660d59981f540cde8bd6eaaaaddb30e65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160463 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com> (cherry picked from commit 6c986c718630ab21e6d9b5d353ddf1534e2dda41) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160573 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--chart2/Library_chartcore.mk1
-rw-r--r--chart2/source/tools/PropertyHelper.cxx23
-rw-r--r--svx/source/unodraw/unogtabl.cxx5
-rw-r--r--svx/source/unodraw/unottabl.cxx5
4 files changed, 26 insertions, 8 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index ea427820a726..b61390ec42ea 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_Library_use_libraries,chartcore,\
ucbhelper \
utl \
vcl \
+ docmodel \
))
$(eval $(call gb_Library_set_componentfile,chartcore,chart2/source/chartcore,services))
diff --git a/chart2/source/tools/PropertyHelper.cxx b/chart2/source/tools/PropertyHelper.cxx
index 90e0b06cdf59..48e21eccaf25 100644
--- a/chart2/source/tools/PropertyHelper.cxx
+++ b/chart2/source/tools/PropertyHelper.cxx
@@ -20,6 +20,7 @@
#include <PropertyHelper.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <docmodel/uno/UnoGradientTools.hxx>
#include <comphelper/sequence.hxx>
#include <osl/diagnose.h>
#include <comphelper/diagnose_ex.hxx>
@@ -113,15 +114,29 @@ OUString lcl_addNamedPropertyUniqueNameToTable(
const OUString & rPreferredName )
{
if( ! xNameContainer.is() ||
- ! rValue.hasValue() ||
- ( rValue.getValueType() != xNameContainer->getElementType()))
+ ! rValue.hasValue() )
+ return rPreferredName;
+
+ Any aValue(rValue);
+
+ if ( rValue.has<css::awt::Gradient>())
+ {
+ // tdf#158421 the lists for Gradients needs awt::Gradient2
+ // as type, convert input data if needed (and warn about it,
+ // the caller should be changed to offer the needed type)
+ SAL_WARN("chart2","input value needs to be awt::Gradient2");
+ const basegfx::BGradient aTemp(model::gradient::getFromAny(rValue));
+ aValue <<= model::gradient::createUnoGradient2(aTemp);
+ }
+
+ if ( aValue.getValueType() != xNameContainer->getElementType())
return rPreferredName;
try
{
Reference< container::XNameAccess > xNameAccess( xNameContainer, uno::UNO_QUERY_THROW );
const uno::Sequence<OUString> aElementNames = xNameAccess->getElementNames();
- auto it = std::find_if( aElementNames.begin(), aElementNames.end(), lcl_EqualsElement( rValue, xNameAccess ));
+ auto it = std::find_if( aElementNames.begin(), aElementNames.end(), lcl_EqualsElement( aValue, xNameAccess ));
// element found => return name
if( it != aElementNames.end())
@@ -159,7 +174,7 @@ OUString lcl_addNamedPropertyUniqueNameToTable(
}
OSL_ASSERT( !aUniqueName.isEmpty());
- xNameContainer->insertByName( aUniqueName, rValue );
+ xNameContainer->insertByName( aUniqueName, aValue );
return aUniqueName;
}
catch( const uno::Exception & )
diff --git a/svx/source/unodraw/unogtabl.cxx b/svx/source/unodraw/unogtabl.cxx
index 7939ccfd0e89..74f25f4a1397 100644
--- a/svx/source/unodraw/unogtabl.cxx
+++ b/svx/source/unodraw/unogtabl.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/awt/Gradient2.hpp>
#include "UnoNameItemTable.hxx"
#include <svx/svdmodel.hxx>
@@ -65,7 +65,8 @@ NameOrIndex* SvxUnoGradientTable::createItem() const { return new XFillGradientI
// XElementAccess
uno::Type SAL_CALL SvxUnoGradientTable::getElementType()
{
- return cppu::UnoType<awt::Gradient>::get();
+ // tdf#158421 use newer extended type for the list
+ return cppu::UnoType<awt::Gradient2>::get();
}
/**
diff --git a/svx/source/unodraw/unottabl.cxx b/svx/source/unodraw/unottabl.cxx
index 6233bccb9a0b..33cab4364937 100644
--- a/svx/source/unodraw/unottabl.cxx
+++ b/svx/source/unodraw/unottabl.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/awt/Gradient2.hpp>
#include <svx/xflftrit.hxx>
#include <svx/svdmodel.hxx>
@@ -71,7 +71,8 @@ NameOrIndex* SvxUnoTransGradientTable::createItem() const
// XElementAccess
uno::Type SAL_CALL SvxUnoTransGradientTable::getElementType()
{
- return cppu::UnoType<awt::Gradient>::get();
+ // tdf#158421 use newer extended type for the list
+ return cppu::UnoType<awt::Gradient2>::get();
}
/**