summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2023-04-18 15:36:35 +0200
committerAndras Timar <andras.timar@collabora.com>2023-05-15 21:38:54 +0200
commitcf85af1e5a2dfd127e8b9f9ac60184611b1fc9aa (patch)
tree47020433c99eaae280d454b04cee058067859baf /oox
parent848feced631f6f457c867fe4eb8ad97577f8b7f3 (diff)
MCGR: 2nd corrections/adaptions to MCGR
Adapted handling of 'border' argument from our gradients for oox export, so that it looks the same. Also added quite some cases to peserve in-between GradientStops for current UI implementations to be able to edit the gradients as usual without losing the in-between GradientStops. While we will not be able to modify these, we are at least able to modify all the other gradient attributes, including start/endColor. Done this for TransparencyGradients, too. Also moved more stuff to the gradient tooling in basegfx. Change-Id: I6e94011bbf3715baa1401ab97e5b59811298342f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150577 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx6
-rw-r--r--oox/source/export/drawingml.cxx48
2 files changed, 6 insertions, 48 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 6c4da67c5f38..972fac19a058 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1935,7 +1935,7 @@ void ChartExport::exportSolidFill(const Reference< XPropertySet >& xPropSet)
uno::Reference< container::XNameAccess > xTransparenceGradient(xFact->createInstance("com.sun.star.drawing.TransparencyGradientTable"), uno::UNO_QUERY);
uno::Any rTransparenceValue = xTransparenceGradient->getByName(sFillTransparenceGradientName);
- if (fillGradient2FromAny(aTransparenceGradient, rTransparenceValue))
+ if (basegfx::utils::fillGradient2FromAny(aTransparenceGradient, rTransparenceValue))
{
basegfx::ColorStops aColorStops;
basegfx::utils::fillColorStopsFromAny(aColorStops, rTransparenceValue);
@@ -2024,7 +2024,7 @@ void ChartExport::exportGradientFill( const Reference< XPropertySet >& xPropSet
uno::Any rGradientValue = xGradient->getByName( sFillGradientName );
awt::Gradient2 aGradient;
- if (fillGradient2FromAny(aGradient, rGradientValue))
+ if (basegfx::utils::fillGradient2FromAny(aGradient, rGradientValue))
{
awt::Gradient2 aTransparenceGradient;
mpFS->startElementNS(XML_a, XML_gradFill);
@@ -2033,7 +2033,7 @@ void ChartExport::exportGradientFill( const Reference< XPropertySet >& xPropSet
{
uno::Reference< container::XNameAccess > xTransparenceGradient(xFact->createInstance("com.sun.star.drawing.TransparencyGradientTable"), uno::UNO_QUERY);
uno::Any rTransparenceValue = xTransparenceGradient->getByName(sFillTransparenceGradientName);
- fillGradient2FromAny(aTransparenceGradient, rTransparenceValue);
+ basegfx::utils::fillGradient2FromAny(aTransparenceGradient, rTransparenceValue);
WriteGradientFill(&aGradient, 0, &aTransparenceGradient, 0);
}
else if (GetProperty(xPropSet, "FillTransparence") )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 3fa79f0b7259..417460a28e49 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -191,48 +191,6 @@ const char* g_aPredefinedClrNames[] = {
namespace oox::drawingml {
-/// Tooling method to fill awt::Gradient2 from data contained in the given Any
-bool fillGradient2FromAny(css::awt::Gradient2& rGradient, const css::uno::Any& rVal)
-{
- bool bRetval(false);
-
- if (rVal.has< css::awt::Gradient2 >())
- {
- // we can use awt::Gradient2 directly
- bRetval = (rVal >>= rGradient);
- }
- else if (rVal.has< css::awt::Gradient >())
- {
- // 1st get awt::Gradient
- css::awt::Gradient aTmp;
-
- if (rVal >>= aTmp)
- {
- // copy all awt::Gradient data to awt::Gradient2
- rGradient.Style = aTmp.Style;
- rGradient.StartColor = aTmp.StartColor;
- rGradient.EndColor = aTmp.EndColor;
- rGradient.Angle = aTmp.Angle;
- rGradient.Border = aTmp.Border;
- rGradient.XOffset = aTmp.XOffset;
- rGradient.YOffset = aTmp.YOffset;
- rGradient.StartIntensity = aTmp.StartIntensity;
- rGradient.EndIntensity = aTmp.EndIntensity;
- rGradient.StepCount = aTmp.StepCount;
-
- // complete data by creating ColorStops for awt::Gradient2
- basegfx::utils::fillColorStopSequenceFromColorStops(
- rGradient.ColorStops,
- basegfx::ColorStops {
- basegfx::ColorStop(0.0, ::Color(ColorTransparency, aTmp.StartColor).getBColor()),
- basegfx::ColorStop(1.0, ::Color(ColorTransparency, aTmp.EndColor).getBColor()) });
- bRetval = true;
- }
- }
-
- return bRetval;
-}
-
URLTransformer::~URLTransformer()
{
}
@@ -538,7 +496,7 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet )
if (GetProperty(rXPropSet, "FillTransparenceGradient"))
{
- if (fillGradient2FromAny(aTransparenceGradient, mAny))
+ if (basegfx::utils::fillGradient2FromAny(aTransparenceGradient, mAny))
{
basegfx::ColorStops aColorStops;
basegfx::utils::fillColorStopsFromAny(aColorStops, mAny);
@@ -697,7 +655,7 @@ void DrawingML::WriteGradientFill( const Reference< XPropertySet >& rXPropSet )
return;
// use fillGradient2FromAny to evtl. take care of Gradient/Gradient2
- fillGradient2FromAny(aGradient, mAny);
+ basegfx::utils::fillGradient2FromAny(aGradient, mAny);
// get InteropGrabBag and search the relevant attributes
awt::Gradient2 aOriginalGradient;
@@ -711,7 +669,7 @@ void DrawingML::WriteGradientFill( const Reference< XPropertySet >& rXPropSet )
rProp.Value >>= aGradientStops;
else if( rProp.Name == "OriginalGradFill" )
// use fillGradient2FromAny to evtl. take care of Gradient/Gradient2
- fillGradient2FromAny(aOriginalGradient, rProp.Value);
+ basegfx::utils::fillGradient2FromAny(aOriginalGradient, rProp.Value);
}
// check if an ooxml gradient had been imported and if the user has modified it