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
committerAndras Timar <andras.timar@collabora.com>2023-05-21 15:00:00 +0200
commitb1e18601c6a8ff2a0b516b309739af1b233d013b (patch)
tree8034f510f1d85b91ece1f8bb70cce7b7c8c9f3cd /oox
parentab2d590b0a9df03fcf9f1e559d15cfb29c59b8c8 (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/source/drawingml/fillproperties.cxx22
-rw-r--r--oox/source/export/chartexport.cxx5
-rw-r--r--oox/source/export/drawingml.cxx33
4 files changed, 30 insertions, 33 deletions
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index c205be79fe57..20aa63ef5e92 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/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 19a584a8a02e..c29a518d8e55 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -459,8 +459,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
{
// use awt::Gradient2, prepare ColorStops
awt::Gradient2 aGradient;
- basegfx::ColorStops aColorStops;
- basegfx::ColorStops aTransparencyStops;
+ basegfx::BColorStops aColorStops;
+ basegfx::BColorStops aTransparencyStops;
bool bContainsTransparency(false);
// set defaults
@@ -469,7 +469,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
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));
@@ -477,7 +477,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
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)
@@ -524,8 +524,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
aGradient.Style = awt::GradientStyle_RECT;
}
- basegfx::utils::reverseColorStops(aColorStops);
- basegfx::utils::reverseColorStops(aTransparencyStops);
+ aColorStops.reverseColorStops();
+ aTransparencyStops.reverseColorStops();
}
else if (!maGradientProps.maGradientStops.empty())
{
@@ -541,8 +541,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
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
@@ -551,10 +551,10 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
// (a) ignored consequently everywhere or
// (b) be set/added consequently everywhere
// since this is - in principle - redundant data.
- // Be aware thet e.g. cases like DrawingML::EqualGradients
+ // Be aware that e.g. cases like DrawingML::EqualGradients
// and others would have to be identified and adapted (!)
// Since awt::Gradient2 is UNO API data there might
- // be cases where just awt::Gradient is transfered, so (b)
+ // be cases where just awt::Gradient is transferred, so (b)
// is far better backwards compatible and thus more safe, so
// all changes will make use of additionally using/setting
// these additionally, but will only make use of the given
@@ -575,7 +575,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
// 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 7df0b02b1784..359edfcb081b 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 40b638074827..2f2aa2558f21 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -476,10 +476,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)
@@ -766,8 +765,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;
@@ -822,12 +821,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 gadients, scaled to [0.0 .. 0.5]
- basegfx::ColorStops::const_reverse_iterator aRevCurrColor(aColorStops.rbegin());
- basegfx::ColorStops::const_reverse_iterator aRevCurrAlpha(aAlphaStops.rbegin());
+ // add mirrored gradients, scaled to [0.0 .. 0.5]
+ basegfx::BColorStops::const_reverse_iterator aRevCurrColor(aColorStops.rbegin());
+ basegfx::BColorStops::const_reverse_iterator aRevCurrAlpha(aAlphaStops.rbegin());
while (aRevCurrColor != aColorStops.rend() && aRevCurrAlpha != aAlphaStops.rend())
{
@@ -837,8 +836,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()))
{
@@ -873,9 +872,9 @@ void DrawingML::WriteGradientFill(
// case awt::GradientStyle_RECT:
// case awt::GradientStyle_SQUARE:
{
- // all these types need the gadiens to be mirrored
- basegfx::utils::reverseColorStops(aColorStops);
- basegfx::utils::reverseColorStops(aAlphaStops);
+ // all these types need the gradients to be mirrored
+ aColorStops.reverseColorStops();
+ aAlphaStops.reverseColorStops();
bRadialOrEllipticalOrRectOrSquare = true;
break;
@@ -885,8 +884,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())
{