summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2023-05-12 15:32:51 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2023-05-15 15:19:53 +0200
commit438f0752deaf7d6e6d9d1df381b64aca4628e944 (patch)
treef1907b25dad1cbf2604b16c657e11f5623c8b5b2 /oox
parentefa965969c6d3dfe5745a535605a6b9a482a03bd (diff)
MCGR: consolidations/cleanups for changes so far
Change-Id: I85cf40e4803b0485bb40349d8e81adc8123666c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151706 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/qa/unit/drawingml.cxx3
-rw-r--r--oox/qa/unit/shape.cxx22
-rw-r--r--oox/source/drawingml/fillproperties.cxx18
-rw-r--r--oox/source/export/chartexport.cxx5
-rw-r--r--oox/source/export/drawingml.cxx29
5 files changed, 34 insertions, 43 deletions
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index 10dc88e4954d..27bd3984a1c7 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -191,8 +191,7 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testGradientMultiStepTransparency)
// i.e. the end transparency was not 100%, but was 21%, leading to an unexpected visible line on
// the right of this shape.
// MCGR: Use the completely imported transparency gradient to check for correctness
- basegfx::ColorStops aColorStops;
- basegfx::utils::fillColorStopsFromGradient2(aColorStops, aTransparence);
+ const basegfx::BColorStops aColorStops(aTransparence.ColorStops);
CPPUNIT_ASSERT_EQUAL(size_t(5), aColorStops.size());
CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[4].getStopOffset(), 1.0));
diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx
index ad43fb52b4a1..722d7d6d644b 100644
--- a/oox/qa/unit/shape.cxx
+++ b/oox/qa/unit/shape.cxx
@@ -471,8 +471,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork3)
xShapeProps->getPropertyValue(u"FillGradient") >>= aGradient;
// MCGR: Use the completely imported transparency gradient to check for correctness
- basegfx::ColorStops aColorStops;
- basegfx::utils::fillColorStopsFromGradient2(aColorStops, aGradient);
+ const basegfx::BColorStops aColorStops(aGradient.ColorStops);
CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size());
CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0));
@@ -497,8 +496,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork3)
xShapeProps->getPropertyValue(u"FillGradient") >>= aGradient;
// MCGR: Use the completely imported transparency gradient to check for correctness
- basegfx::ColorStops aColorStops;
- basegfx::utils::fillColorStopsFromGradient2(aColorStops, aGradient);
+ const basegfx::BColorStops aColorStops(aGradient.ColorStops);
CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size());
CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.40000000000000002));
@@ -523,8 +521,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork3)
xShapeProps->getPropertyValue(u"FillGradient") >>= aGradient;
// MCGR: Use the completely imported transparency gradient to check for correctness
- basegfx::ColorStops aColorStops;
- basegfx::utils::fillColorStopsFromGradient2(aColorStops, aGradient);
+ const basegfx::BColorStops aColorStops(aGradient.ColorStops);
CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size());
CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0));
@@ -641,8 +638,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient)
xShapeProps->getPropertyValue(u"FillGradient") >>= aGradient;
// MCGR: Use the completely imported transparency gradient to check for correctness
- basegfx::ColorStops aColorStops;
- basegfx::utils::fillColorStopsFromGradient2(aColorStops, aGradient);
+ const basegfx::BColorStops aColorStops(aGradient.ColorStops);
CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size());
CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0));
@@ -675,8 +671,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient)
xShapeProps->getPropertyValue(u"FillGradient") >>= aGradient;
// MCGR: Use the completely imported transparency gradient to check for correctness
- basegfx::ColorStops aColorStops;
- basegfx::utils::fillColorStopsFromGradient2(aColorStops, aGradient);
+ basegfx::BColorStops aColorStops(aGradient.ColorStops);
CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size());
CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0));
@@ -692,7 +687,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient)
xShapeProps->getPropertyValue(u"FillTransparenceGradient") >>= aGradient;
// MCGR: Use the completely imported transparency gradient to check for correctness
- basegfx::utils::fillColorStopsFromGradient2(aColorStops, aGradient);
+ aColorStops = basegfx::BColorStops(aGradient.ColorStops);
// Transparency is encoded in gray color.
CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size());
@@ -733,8 +728,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient)
xShapeProps->getPropertyValue(u"FillGradient") >>= aGradient;
// MCGR: Use the completely imported transparency gradient to check for correctness
- basegfx::ColorStops aColorStops;
- basegfx::utils::fillColorStopsFromGradient2(aColorStops, aGradient);
+ basegfx::BColorStops aColorStops(aGradient.ColorStops);
CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size());
CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0));
@@ -752,7 +746,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient)
xShapeProps->getPropertyValue(u"FillTransparenceGradient") >>= aGradient;
// MCGR: Use the completely imported transparency gradient to check for correctness
- basegfx::utils::fillColorStopsFromGradient2(aColorStops, aGradient);
+ aColorStops = basegfx::BColorStops(aGradient.ColorStops);
// Transparency is encoded in gray color.
CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size());
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index e6cded7e64c7..a42418198c12 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -461,8 +461,8 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp
// use awt::Gradient2, prepare ColorStops
awt::Gradient2 aGradient;
assert(aGradient.ColorStops.get() && "cid#1524676 aGradient.ColorStops._pSequence won't be null here");
- basegfx::ColorStops aColorStops;
- basegfx::ColorStops aTransparencyStops;
+ basegfx::BColorStops aColorStops;
+ basegfx::BColorStops aTransparencyStops;
bool bContainsTransparency(false);
// set defaults
@@ -471,7 +471,7 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp
aGradient.EndIntensity = 100;
aGradient.Style = awt::GradientStyle_LINEAR;
- // convert to ColorStops, check for contained transparency
+ // convert to BColorStops, check for contained transparency
for (const auto& rCandidate : maGradientProps.maGradientStops)
{
const ::Color aColor(rCandidate.second.getColor(rGraphicHelper, nPhClr));
@@ -479,7 +479,7 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp
bContainsTransparency = bContainsTransparency || rCandidate.second.hasTransparency();
}
- // if we have transparency, convert to ColorStops
+ // if we have transparency, convert to BColorStops
if (bContainsTransparency)
{
for (const auto& rCandidate : maGradientProps.maGradientStops)
@@ -526,8 +526,8 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp
aGradient.Style = awt::GradientStyle_RECT;
}
- basegfx::utils::reverseColorStops(aColorStops);
- basegfx::utils::reverseColorStops(aTransparencyStops);
+ aColorStops.reverseColorStops();
+ aTransparencyStops.reverseColorStops();
}
else if (!maGradientProps.maGradientStops.empty())
{
@@ -543,8 +543,8 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp
aGradient.Angle = static_cast< sal_Int16 >( (8100 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 );
}
- // set ColorStops using UNO API
- basegfx::utils::fillColorStopSequenceFromColorStops(aGradient.ColorStops, aColorStops);
+ // set BColorStops using UNO API
+ aGradient.ColorStops = aColorStops.getAsColorStopSequence();
// for compatibility, still set StartColor/EndColor
// NOTE: All code after adapting to multi color gradients works
@@ -577,7 +577,7 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp
// push gradient transparency to property map if it exists
if (!aTransparencyStops.empty())
{
- basegfx::utils::fillColorStopSequenceFromColorStops(aGradient.ColorStops, aTransparencyStops);
+ aGradient.ColorStops = aTransparencyStops.getAsColorStopSequence();
rPropMap.setProperty(ShapeProperty::GradientTransparency, aGradient);
}
}
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index da8ef4924615..0c223bb452aa 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1916,10 +1916,9 @@ void ChartExport::exportSolidFill(const Reference< XPropertySet >& xPropSet)
if (basegfx::utils::fillGradient2FromAny(aTransparenceGradient, rTransparenceValue))
{
- basegfx::ColorStops aColorStops;
- basegfx::utils::fillColorStopsFromAny(aColorStops, rTransparenceValue);
+ const basegfx::BColorStops aColorStops(rTransparenceValue);
basegfx::BColor aSingleColor;
- bNeedGradientFill = !basegfx::utils::isSingleColor(aColorStops, aSingleColor);
+ bNeedGradientFill = !aColorStops.isSingleColor(aSingleColor);
}
if (!bNeedGradientFill && 0 != aTransparenceGradient.StartColor)
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index fa587d6190bf..11d562ff41b9 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -479,10 +479,9 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet )
{
if (basegfx::utils::fillGradient2FromAny(aTransparenceGradient, mAny))
{
- basegfx::ColorStops aColorStops;
- basegfx::utils::fillColorStopsFromAny(aColorStops, mAny);
+ const basegfx::BColorStops aColorStops(mAny);
basegfx::BColor aSingleColor;
- bNeedGradientFill = !basegfx::utils::isSingleColor(aColorStops, aSingleColor);
+ bNeedGradientFill = !aColorStops.isSingleColor(aSingleColor);
}
if (!bNeedGradientFill && 0 != aTransparenceGradient.StartColor)
@@ -779,8 +778,8 @@ void DrawingML::WriteGradientFill(
const awt::Gradient2* pColorGradient, sal_Int32 nFixColor,
const awt::Gradient2* pTransparenceGradient, double fFixTransparence)
{
- basegfx::ColorStops aColorStops;
- basegfx::ColorStops aAlphaStops;
+ basegfx::BColorStops aColorStops;
+ basegfx::BColorStops aAlphaStops;
basegfx::BColor aSingleColor(::Color(ColorTransparency, nFixColor).getBColor());
basegfx::BColor aSingleAlpha(fFixTransparence);
awt::Gradient2 aGradient;
@@ -835,12 +834,12 @@ void DrawingML::WriteGradientFill(
{
// we need to 'double' the gradient to make it appear as what we call
// 'axial', but also scale and mirror in doing so
- basegfx::ColorStops aNewColorStops;
- basegfx::ColorStops aNewAlphaStops;
+ basegfx::BColorStops aNewColorStops;
+ basegfx::BColorStops aNewAlphaStops;
// add mirrored gradients, scaled to [0.0 .. 0.5]
- basegfx::ColorStops::const_reverse_iterator aRevCurrColor(aColorStops.rbegin());
- basegfx::ColorStops::const_reverse_iterator aRevCurrAlpha(aAlphaStops.rbegin());
+ basegfx::BColorStops::const_reverse_iterator aRevCurrColor(aColorStops.rbegin());
+ basegfx::BColorStops::const_reverse_iterator aRevCurrAlpha(aAlphaStops.rbegin());
while (aRevCurrColor != aColorStops.rend() && aRevCurrAlpha != aAlphaStops.rend())
{
@@ -850,8 +849,8 @@ void DrawingML::WriteGradientFill(
aRevCurrAlpha++;
}
- basegfx::ColorStops::const_iterator aCurrColor(aColorStops.begin());
- basegfx::ColorStops::const_iterator aCurrAlpha(aAlphaStops.begin());
+ basegfx::BColorStops::const_iterator aCurrColor(aColorStops.begin());
+ basegfx::BColorStops::const_iterator aCurrAlpha(aAlphaStops.begin());
if (basegfx::fTools::equalZero(aCurrColor->getStopOffset()))
{
@@ -887,8 +886,8 @@ void DrawingML::WriteGradientFill(
// case awt::GradientStyle_SQUARE:
{
// all these types need the gradients to be mirrored
- basegfx::utils::reverseColorStops(aColorStops);
- basegfx::utils::reverseColorStops(aAlphaStops);
+ aColorStops.reverseColorStops();
+ aAlphaStops.reverseColorStops();
bRadialOrEllipticalOrRectOrSquare = true;
break;
@@ -898,8 +897,8 @@ void DrawingML::WriteGradientFill(
// export GradientStops (with alpha)
mpFS->startElementNS(XML_a, XML_gsLst);
- basegfx::ColorStops::const_iterator aCurrColor(aColorStops.begin());
- basegfx::ColorStops::const_iterator aCurrAlpha(aAlphaStops.begin());
+ basegfx::BColorStops::const_iterator aCurrColor(aColorStops.begin());
+ basegfx::BColorStops::const_iterator aCurrAlpha(aAlphaStops.begin());
while (aCurrColor != aColorStops.end() && aCurrAlpha != aAlphaStops.end())
{