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
committerArmin Le Grand <Armin.Le.Grand@me.com>2023-04-19 20:43:45 +0200
commit4409cd197dfb1fab05c0285f3ae17a107c99b77e (patch)
treec89a73f29f03d4e656042f0b8b88e329b16fd5de /oox
parent730b329b51797254aca58843ad7937ee7662cf7f (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 37868d512ce1..a2c30f2e8861 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 9f02652f2b04..c5047db88392 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -192,48 +192,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()
{
}
@@ -557,7 +515,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);
@@ -727,7 +685,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;
@@ -741,7 +699,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