diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-08-09 13:27:49 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-08-21 09:27:12 +0200 |
commit | 242bb3fdda5be165bd00701518df47cc1276438f (patch) | |
tree | bc61d6d7fa1b3ee628bfe2ff875c03b89728f59f /chart2 | |
parent | 84b12cd3ea96ee9b02365b5239f391af242f7303 (diff) |
move BGradient to awt::Gradient2 UNO conversion into docmodel
This is needed because the module dependencies are an issues if
the conversion is done in basegfx. The bigger issue will come when
the ComplexColor conversion will be done as basegfx can't depend on
docmodel because of circular dependencies.
The BGradient is also more suitable for docmodel anyway as the
previously it was part of the model and is not a basic (gfx)
type - however this doesn't move the whole BGradient into docmodel
yet.
Change-Id: Id91ce52232f89f00e09b451c13da36e2854ae14b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155674
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/Library_chartcontroller.mk | 3 | ||||
-rw-r--r-- | chart2/import_setup.mk | 1 | ||||
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 5 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Tools.cxx | 4 |
4 files changed, 9 insertions, 4 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index 56a80ea9e43d..ca50d52a1fd9 100644 --- a/chart2/Library_chartcontroller.mk +++ b/chart2/Library_chartcontroller.mk @@ -33,10 +33,11 @@ $(eval $(call gb_Library_use_libraries,chartcontroller,\ cppu \ cppuhelper \ drawinglayer \ + docmodel \ editeng \ sal \ salhelper \ - i18nlangtag \ + i18nlangtag \ sfx \ sot \ svl \ diff --git a/chart2/import_setup.mk b/chart2/import_setup.mk index fb004d9830f4..a63d314bfc34 100644 --- a/chart2/import_setup.mk +++ b/chart2/import_setup.mk @@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,chart2_import$(1), \ cppu \ cppuhelper \ drawinglayer \ + docmodel \ editeng \ for \ forui \ diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 0b8acca9a3ab..b219baccad74 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/awt/Gradient2.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <basegfx/utils/gradienttools.hxx> +#include <docmodel/uno/UnoGradientTools.hxx> class Chart2ImportTest : public ChartTest { @@ -628,7 +629,7 @@ CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testBnc889755) uno::Reference<beans::XPropertySet> xShapeProps(xPage->getByIndex(4), uno::UNO_QUERY_THROW); awt::Gradient2 aTransparence; xShapeProps->getPropertyValue("FillTransparenceGradient") >>= aTransparence; - const basegfx::BColorStops aColorStops(aTransparence.ColorStops); + const basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aTransparence.ColorStops); CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); @@ -671,7 +672,7 @@ CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testTransparencyGradientValue) uno::Reference< container::XNameAccess > xTransparenceGradient(xFact->createInstance("com.sun.star.drawing.TransparencyGradientTable"), uno::UNO_QUERY); uno::Any rTransparenceValue = xTransparenceGradient->getByName(sTranspGradientName); CPPUNIT_ASSERT(rTransparenceValue >>= aTransparenceGradient); - const basegfx::BColorStops aColorStops(aTransparenceGradient.ColorStops); + const basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aTransparenceGradient.ColorStops); // MCGR: Use the whole completely imported transparency gradient to check for correctness CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 6d4a463a4487..48dbfaf7f673 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -47,6 +47,7 @@ #include <ObjectNameProvider.hxx> #include <unonames.hxx> +#include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/graphic/XGraphic.hpp> @@ -55,6 +56,7 @@ #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart2/XRegressionCurveContainer.hpp> +#include <docmodel/uno/UnoGradientTools.hxx> #include <editeng/editview.hxx> #include <editeng/outliner.hxx> #include <svx/ActionDescriptionProvider.hxx> @@ -957,7 +959,7 @@ void ChartController::executeDispatch_FillColor(sal_uInt32 nColor) void ChartController::executeDispatch_FillGradient(std::u16string_view sJSONGradient) { basegfx::BGradient aBGradient = basegfx::BGradient::fromJSON(sJSONGradient); - css::awt::Gradient aGradient = aBGradient.getAsGradient2(); + css::awt::Gradient aGradient = model::gradient::createUnoGradient2(aBGradient); try { |