From dccd82b5ac47f44ea0297d301dc894c70bc793a2 Mon Sep 17 00:00:00 2001 From: "Armin Le Grand (allotropia)" Date: Thu, 20 Apr 2023 17:16:32 +0200 Subject: MCGR: Reduce diverse GradientStyle enums to single UNO API one Change-Id: Ie0cd26a308a75ddead9451c53e874a39cc6eeb63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150705 Tested-by: Jenkins Reviewed-by: Armin Le Grand --- canvas/source/vcl/canvashelper_texturefill.cxx | 4 +- cppcanvas/source/mtfrenderer/implrenderer.cxx | 14 +++---- drawinglayer/qa/unit/vclpixelprocessor2d.cxx | 2 +- .../source/attribute/fillgradientattribute.cxx | 18 ++++---- .../source/primitive2d/fillgradientprimitive2d.cxx | 21 +++++----- .../source/primitive3d/textureprimitive3d.cxx | 2 +- .../source/processor2d/vclmetafileprocessor2d.cxx | 49 ++++------------------ .../source/processor2d/vclpixelprocessor2d.cxx | 31 +------------- .../source/processor3d/defaultprocessor3d.cxx | 15 +++---- drawinglayer/source/tools/primitive2dxmldump.cxx | 13 +++--- drawinglayer/source/tools/wmfemfhelper.cxx | 38 +---------------- filter/source/msfilter/escherex.cxx | 2 +- filter/source/svg/svgwriter.cxx | 20 ++++----- .../attribute/fillgradientattribute.hxx | 17 ++------ include/vcl/gradient.hxx | 7 ++-- include/vcl/vclenum.hxx | 12 ------ reportdesign/source/ui/report/EndMarker.cxx | 2 +- reportdesign/source/ui/report/StartMarker.cxx | 2 +- sc/source/ui/cctrl/tbzoomsliderctrl.cxx | 2 +- sc/source/ui/view/output.cxx | 2 +- sd/source/ui/annotations/annotationwindow.cxx | 2 +- .../ui/slidesorter/view/SlsPageObjectPainter.cxx | 2 +- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 35 +--------------- svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 2 +- svx/source/svdraw/svdfmtf.cxx | 36 ++-------------- svx/source/xoutdev/xtabgrdt.cxx | 37 +--------------- sw/source/core/text/inftxt.cxx | 2 +- sw/source/uibase/docvw/AnnotationWin2.cxx | 2 +- sw/source/uibase/docvw/HeaderFooterWin.cxx | 2 +- sw/source/uibase/docvw/ShadowOverlayObject.cxx | 6 +-- sw/source/uibase/docvw/SidebarTxtControl.cxx | 4 +- toolkit/source/awt/vclxgraphics.cxx | 2 +- vcl/backendtest/VisualBackendTest.cxx | 2 +- vcl/backendtest/outputdevice/gradient.cxx | 24 +++++++---- vcl/headless/CairoCommon.cxx | 6 +-- vcl/qa/cppunit/TypeSerializerTest.cxx | 5 ++- vcl/qa/cppunit/gradient.cxx | 6 +-- vcl/qa/cppunit/outdev.cxx | 10 ++--- vcl/qa/cppunit/svm/svmtest.cxx | 10 ++--- vcl/skia/gdiimpl.cxx | 10 ++--- vcl/source/filter/svm/SvmConverter.cxx | 2 +- vcl/source/gdi/TypeSerializer.cxx | 2 +- vcl/source/gdi/gradient.cxx | 28 ++++++------- vcl/source/gdi/mtfxmldump.cxx | 18 ++++---- vcl/source/gdi/pdfwriter_impl.cxx | 26 ++++++------ vcl/source/gdi/pdfwriter_impl2.cxx | 4 +- vcl/source/gdi/wall.cxx | 2 +- vcl/source/outdev/gradient.cxx | 10 ++--- vcl/source/window/toolbox.cxx | 2 +- vcl/workben/svptest.cxx | 2 +- vcl/workben/vcldemo.cxx | 14 +++---- 51 files changed, 194 insertions(+), 394 deletions(-) diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 211592685204..1582a3ad7601 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -160,7 +160,7 @@ namespace vclcanvas aLeftBottom -= 2.0*nDiagonalLength*aDirection; aRightTop += 2.0*nDiagonalLength*aDirection; aRightBottom += 2.0*nDiagonalLength*aDirection; - Gradient vclGradient( GradientStyle::Linear, rColors[ 0 ], rColors[ 1 ] ); + Gradient vclGradient( css::awt::GradientStyle_LINEAR, rColors[ 0 ], rColors[ 1 ] ); ::tools::Polygon aTempPoly( static_cast(5) ); aTempPoly[0] = ::Point( ::basegfx::fround( aLeftTop.getX() ), ::basegfx::fround( aLeftTop.getY() ) ); @@ -185,7 +185,7 @@ namespace vclcanvas aLeftBottom -= 2.0*nDiagonalLength*aDirection; aRightTop += 2.0*nDiagonalLength*aDirection; aRightBottom += 2.0*nDiagonalLength*aDirection; - Gradient vclGradient( GradientStyle::Axial, rColors[ 1 ], rColors[ 0 ] ); + Gradient vclGradient( css::awt::GradientStyle_AXIAL, rColors[ 1 ], rColors[ 0 ] ); ::tools::Polygon aTempPoly( static_cast(5) ); aTempPoly[0] = ::Point( ::basegfx::fround( aLeftTop.getX() ), ::basegfx::fround( aLeftTop.getY() ) ); diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index e1b4476b62ee..226e62d7eec4 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -549,7 +549,7 @@ namespace cppcanvas::internal uno::Sequence< uno::Sequence < double > > aColors; uno::Sequence< double > aStops; - if( rGradient.GetStyle() == GradientStyle::Axial ) + if( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) { aStops = { 0.0, 0.5, 1.0 }; aColors = { aEndColor, aStartColor, aEndColor }; @@ -575,7 +575,7 @@ namespace cppcanvas::internal OUString aGradientService; switch( rGradient.GetStyle() ) { - case GradientStyle::Linear: + case css::awt::GradientStyle_LINEAR: aGradInfo = basegfx::utils::createLinearODFGradientInfo( aBounds, nSteps, @@ -587,7 +587,7 @@ namespace cppcanvas::internal aGradientService = "LinearGradient"; break; - case GradientStyle::Axial: + case css::awt::GradientStyle_AXIAL: { // Adapt the border so that it is suitable // for the axial gradient. An axial @@ -621,7 +621,7 @@ namespace cppcanvas::internal break; } - case GradientStyle::Radial: + case css::awt::GradientStyle_RADIAL: aGradInfo = basegfx::utils::createRadialODFGradientInfo( aBounds, aOffset, @@ -630,7 +630,7 @@ namespace cppcanvas::internal aGradientService = "EllipticalGradient"; break; - case GradientStyle::Elliptical: + case css::awt::GradientStyle_ELLIPTICAL: aGradInfo = basegfx::utils::createEllipticalODFGradientInfo( aBounds, aOffset, @@ -640,7 +640,7 @@ namespace cppcanvas::internal aGradientService = "EllipticalGradient"; break; - case GradientStyle::Square: + case css::awt::GradientStyle_SQUARE: aGradInfo = basegfx::utils::createSquareODFGradientInfo( aBounds, aOffset, @@ -650,7 +650,7 @@ namespace cppcanvas::internal aGradientService = "RectangularGradient"; break; - case GradientStyle::Rect: + case css::awt::GradientStyle_RECT: aGradInfo = basegfx::utils::createRectangularODFGradientInfo( aBounds, aOffset, diff --git a/drawinglayer/qa/unit/vclpixelprocessor2d.cxx b/drawinglayer/qa/unit/vclpixelprocessor2d.cxx index 4c26c2d4bfde..6ccf1e7c55ab 100644 --- a/drawinglayer/qa/unit/vclpixelprocessor2d.cxx +++ b/drawinglayer/qa/unit/vclpixelprocessor2d.cxx @@ -61,7 +61,7 @@ public: basegfx::B2DRange definitionRange(0, 0, 100, 200); basegfx::B2DRange outputRange(0, 100, 100, 200); // Paint only lower half of the gradient. attribute::FillGradientAttribute attributes( - attribute::GradientStyle::Linear, 0, 0, 0, 0, + css::awt::GradientStyle_LINEAR, 0, 0, 0, 0, basegfx::utils::createColorStopsFromStartEndColor(COL_WHITE.getBColor(), COL_BLACK.getBColor())); rtl::Reference gradientPrimitive( diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx index b25a4dab2f25..0233195113af 100644 --- a/drawinglayer/source/attribute/fillgradientattribute.cxx +++ b/drawinglayer/source/attribute/fillgradientattribute.cxx @@ -31,11 +31,11 @@ namespace drawinglayer::attribute double mfOffsetY; double mfAngle; basegfx::ColorStops maColorStops; - GradientStyle meStyle; + css::awt::GradientStyle meStyle; sal_uInt16 mnSteps; ImpFillGradientAttribute( - GradientStyle eStyle, + css::awt::GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, @@ -74,7 +74,7 @@ namespace drawinglayer::attribute mfOffsetY(0.0), mfAngle(0.0), maColorStops(), - meStyle(GradientStyle::Linear), + meStyle(css::awt::GradientStyle_LINEAR), mnSteps(0) { // always add a fallback color, see above @@ -82,7 +82,7 @@ namespace drawinglayer::attribute } // data read access - GradientStyle getStyle() const { return meStyle; } + css::awt::GradientStyle getStyle() const { return meStyle; } double getBorder() const { return mfBorder; } double getOffsetX() const { return mfOffsetX; } double getOffsetY() const { return mfOffsetY; } @@ -121,7 +121,7 @@ namespace drawinglayer::attribute } FillGradientAttribute::FillGradientAttribute( - GradientStyle eStyle, + css::awt::GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, @@ -179,9 +179,9 @@ namespace drawinglayer::attribute // is different from processing the gradient manually by drawinglayer // (and the Writer unittest for it fails). Keep using the drawinglayer code // until somebody founds out what's wrong and fixes it. - if (getStyle() != drawinglayer::attribute::GradientStyle::Linear - && getStyle() != drawinglayer::attribute::GradientStyle::Axial - && getStyle() != drawinglayer::attribute::GradientStyle::Radial) + if (getStyle() != css::awt::GradientStyle_LINEAR + && getStyle() != css::awt::GradientStyle_AXIAL + && getStyle() != css::awt::GradientStyle_RADIAL) { return true; } @@ -227,7 +227,7 @@ namespace drawinglayer::attribute return mpFillGradientAttribute->getAngle(); } - GradientStyle FillGradientAttribute::getStyle() const + css::awt::GradientStyle FillGradientAttribute::getStyle() const { return mpFillGradientAttribute->getStyle(); } diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 088e69357213..f39daccc4320 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -32,14 +32,14 @@ using namespace com::sun::star; namespace drawinglayer::primitive2d { - // Get the OuterColor. Take into account that for attribute::GradientStyle::Axial + // Get the OuterColor. Take into account that for css::awt::GradientStyle_AXIAL // this is the last one due to inverted gradient usage (see constructor there) basegfx::BColor FillGradientPrimitive2D::getOuterColor() const { if (getFillGradient().getColorStops().empty()) return basegfx::BColor(); - if (attribute::GradientStyle::Axial == getFillGradient().getStyle()) + if (css::awt::GradientStyle_AXIAL == getFillGradient().getStyle()) return getFillGradient().getColorStops().back().getStopColor(); return getFillGradient().getColorStops().front().getStopColor(); @@ -48,8 +48,8 @@ namespace drawinglayer::primitive2d // Get the needed UnitPolygon dependent on the GradientStyle basegfx::B2DPolygon FillGradientPrimitive2D::getUnitPolygon() const { - if (attribute::GradientStyle::Radial == getFillGradient().getStyle() - || attribute::GradientStyle::Elliptical == getFillGradient().getStyle()) + if (css::awt::GradientStyle_RADIAL == getFillGradient().getStyle() + || css::awt::GradientStyle_ELLIPTICAL == getFillGradient().getStyle()) { return basegfx::utils::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), 1.0); } @@ -62,7 +62,8 @@ namespace drawinglayer::primitive2d { switch(getFillGradient().getStyle()) { - case attribute::GradientStyle::Linear: + default: // GradientStyle_MAKE_FIXED_SIZE + case css::awt::GradientStyle_LINEAR: { texture::GeoTexSvxGradientLinear aGradient( getDefinitionRange(), @@ -74,7 +75,7 @@ namespace drawinglayer::primitive2d aGradient.appendTransformationsAndColors(aCallback); break; } - case attribute::GradientStyle::Axial: + case css::awt::GradientStyle_AXIAL: { texture::GeoTexSvxGradientAxial aGradient( getDefinitionRange(), @@ -86,7 +87,7 @@ namespace drawinglayer::primitive2d aGradient.appendTransformationsAndColors(aCallback); break; } - case attribute::GradientStyle::Radial: + case css::awt::GradientStyle_RADIAL: { texture::GeoTexSvxGradientRadial aGradient( getDefinitionRange(), @@ -98,7 +99,7 @@ namespace drawinglayer::primitive2d aGradient.appendTransformationsAndColors(aCallback); break; } - case attribute::GradientStyle::Elliptical: + case css::awt::GradientStyle_ELLIPTICAL: { texture::GeoTexSvxGradientElliptical aGradient( getDefinitionRange(), @@ -111,7 +112,7 @@ namespace drawinglayer::primitive2d aGradient.appendTransformationsAndColors(aCallback); break; } - case attribute::GradientStyle::Square: + case css::awt::GradientStyle_SQUARE: { texture::GeoTexSvxGradientSquare aGradient( getDefinitionRange(), @@ -124,7 +125,7 @@ namespace drawinglayer::primitive2d aGradient.appendTransformationsAndColors(aCallback); break; } - case attribute::GradientStyle::Rect: + case css::awt::GradientStyle_RECT: { texture::GeoTexSvxGradientRect aGradient( getDefinitionRange(), diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx index 977670446c8a..ebae584e9dbf 100644 --- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx @@ -99,7 +99,7 @@ namespace drawinglayer::primitive3d basegfx::ColorStop(0.0, aGray), basegfx::ColorStop(1.0, aGray) }; - const attribute::FillGradientAttribute aFillGradient(attribute::GradientStyle::Linear, 0.0, 0.0, 0.0, 0.0, aColorStops); + const attribute::FillGradientAttribute aFillGradient(css::awt::GradientStyle_LINEAR, 0.0, 0.0, 0.0, 0.0, aColorStops); const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize())); return { xRef }; } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 9adbb7501701..529a34ce599a 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -285,40 +285,7 @@ void VclMetafileProcessor2D::impConvertFillGradientAttributeToVCLGradient( // defaults for intensity; those were computed into the start/end colors already o_rVCLGradient.SetStartIntensity(100); o_rVCLGradient.SetEndIntensity(100); - - switch (rFiGrAtt.getStyle()) - { - default: // attribute::GradientStyle::Linear : - { - o_rVCLGradient.SetStyle(GradientStyle::Linear); - break; - } - case attribute::GradientStyle::Axial: - { - o_rVCLGradient.SetStyle(GradientStyle::Axial); - break; - } - case attribute::GradientStyle::Radial: - { - o_rVCLGradient.SetStyle(GradientStyle::Radial); - break; - } - case attribute::GradientStyle::Elliptical: - { - o_rVCLGradient.SetStyle(GradientStyle::Elliptical); - break; - } - case attribute::GradientStyle::Square: - { - o_rVCLGradient.SetStyle(GradientStyle::Square); - break; - } - case attribute::GradientStyle::Rect: - { - o_rVCLGradient.SetStyle(GradientStyle::Rect); - break; - } - } + o_rVCLGradient.SetStyle(rFiGrAtt.getStyle()); } void VclMetafileProcessor2D::impStartSvtGraphicFill(SvtGraphicFill const* pSvtGraphicFill) @@ -2078,16 +2045,16 @@ void VclMetafileProcessor2D::processPolyPolygonGradientPrimitive2D( switch (aVCLGradient.GetStyle()) { - default: // GradientStyle::Linear: - case GradientStyle::Axial: + default: // css::awt::GradientStyle_LINEAR: + case css::awt::GradientStyle_AXIAL: eGrad = SvtGraphicFill::GradientType::Linear; break; - case GradientStyle::Radial: - case GradientStyle::Elliptical: + case css::awt::GradientStyle_RADIAL: + case css::awt::GradientStyle_ELLIPTICAL: eGrad = SvtGraphicFill::GradientType::Radial; break; - case GradientStyle::Square: - case GradientStyle::Rect: + case css::awt::GradientStyle_SQUARE: + case css::awt::GradientStyle_RECT: eGrad = SvtGraphicFill::GradientType::Rectangular; break; } @@ -2269,7 +2236,7 @@ void VclMetafileProcessor2D::processUnifiedTransparencePrimitive2D( basegfx::fround(rUniTransparenceCandidate.getTransparence() * 255.0))); const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl); - aVCLGradient.SetStyle(GradientStyle::Linear); + aVCLGradient.SetStyle(css::awt::GradientStyle_LINEAR); aVCLGradient.SetStartColor(aTransColor); aVCLGradient.SetEndColor(aTransColor); aVCLGradient.SetAngle(0_deg10); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index d6da12a1e32e..e71cda4a0bb6 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -185,32 +185,6 @@ bool VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect( rSource.getLineAttribute().getMiterMinimumAngle()); } -namespace -{ -GradientStyle convertGradientStyle(drawinglayer::attribute::GradientStyle eGradientStyle) -{ - switch (eGradientStyle) - { - case drawinglayer::attribute::GradientStyle::Axial: - return GradientStyle::Axial; - case drawinglayer::attribute::GradientStyle::Radial: - return GradientStyle::Radial; - case drawinglayer::attribute::GradientStyle::Elliptical: - return GradientStyle::Elliptical; - case drawinglayer::attribute::GradientStyle::Square: - return GradientStyle::Square; - case drawinglayer::attribute::GradientStyle::Rect: - return GradientStyle::Rect; - case drawinglayer::attribute::GradientStyle::Linear: - return GradientStyle::Linear; - default: - assert(false); - return GradientStyle::Linear; - } -} - -} // end anonymous namespace - void VclPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) { switch (rCandidate.getPrimitive2DID()) @@ -1053,9 +1027,8 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D( // try to use vcl - since vcl uses the old gradient paint mechanisms this may // create wrong geometries. If so, add another case above for useDecompose - GradientStyle eGradientStyle = convertGradientStyle(rFillGradient.getStyle()); - - Gradient aGradient(eGradientStyle, Color(rFillGradient.getColorStops().front().getStopColor()), + Gradient aGradient(rFillGradient.getStyle(), + Color(rFillGradient.getColorStops().front().getStopColor()), Color(rFillGradient.getColorStops().back().getStopColor())); aGradient.SetAngle(Degree10(static_cast(basegfx::rad2deg<10>(rFillGradient.getAngle())))); diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index a2a5111bc49b..20d81871dbd7 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -59,14 +59,15 @@ namespace drawinglayer::processor3d // create texture const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient(); const basegfx::B2DRange aOutlineRange(0.0, 0.0, rPrimitive.getTextureSize().getX(), rPrimitive.getTextureSize().getY()); - const attribute::GradientStyle aGradientStyle(rFillGradient.getStyle()); + const css::awt::GradientStyle aGradientStyle(rFillGradient.getStyle()); std::shared_ptr< texture::GeoTexSvx > pNewTex; if(!rFillGradient.hasSingleColor()) { switch(aGradientStyle) { - case attribute::GradientStyle::Linear: + default: // GradientStyle_MAKE_FIXED_SIZE + case css::awt::GradientStyle_LINEAR: { pNewTex = std::make_shared( aOutlineRange, @@ -77,7 +78,7 @@ namespace drawinglayer::processor3d rFillGradient.getAngle()); break; } - case attribute::GradientStyle::Axial: + case css::awt::GradientStyle_AXIAL: { pNewTex = std::make_shared( aOutlineRange, @@ -88,7 +89,7 @@ namespace drawinglayer::processor3d rFillGradient.getAngle()); break; } - case attribute::GradientStyle::Radial: + case css::awt::GradientStyle_RADIAL: { pNewTex = std::make_shared( @@ -100,7 +101,7 @@ namespace drawinglayer::processor3d rFillGradient.getOffsetY()); break; } - case attribute::GradientStyle::Elliptical: + case css::awt::GradientStyle_ELLIPTICAL: { pNewTex = std::make_shared( @@ -113,7 +114,7 @@ namespace drawinglayer::processor3d rFillGradient.getAngle()); break; } - case attribute::GradientStyle::Square: + case css::awt::GradientStyle_SQUARE: { pNewTex = std::make_shared( @@ -126,7 +127,7 @@ namespace drawinglayer::processor3d rFillGradient.getAngle()); break; } - case attribute::GradientStyle::Rect: + case css::awt::GradientStyle_RECT: { pNewTex = std::make_shared( diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx index 31c88c6482ed..08f585a3638b 100644 --- a/drawinglayer/source/tools/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -276,22 +276,23 @@ void writeSdrFillAttribute(::tools::XmlWriter& rWriter, rWriter.startElement("gradient"); switch (rGradient.getStyle()) { - case drawinglayer::attribute::GradientStyle::Linear: + default: // GradientStyle_MAKE_FIXED_SIZE + case css::awt::GradientStyle_LINEAR: rWriter.attribute("style", "Linear"); break; - case drawinglayer::attribute::GradientStyle::Axial: + case css::awt::GradientStyle_AXIAL: rWriter.attribute("style", "Axial"); break; - case drawinglayer::attribute::GradientStyle::Radial: + case css::awt::GradientStyle_RADIAL: rWriter.attribute("style", "Radial"); break; - case drawinglayer::attribute::GradientStyle::Elliptical: + case css::awt::GradientStyle_ELLIPTICAL: rWriter.attribute("style", "Elliptical"); break; - case drawinglayer::attribute::GradientStyle::Square: + case css::awt::GradientStyle_SQUARE: rWriter.attribute("style", "Square"); break; - case drawinglayer::attribute::GradientStyle::Rect: + case css::awt::GradientStyle_RECT: rWriter.attribute("style", "Rect"); break; } diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index e6eb401833c7..1b2b2d0a5abd 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -675,44 +675,8 @@ namespace wmfemfhelper aEnd = interpolate(aBlack, aEnd, static_cast(nEndIntens) * 0.01); } - drawinglayer::attribute::GradientStyle aGradientStyle(drawinglayer::attribute::GradientStyle::Rect); - - switch(rGradient.GetStyle()) - { - case GradientStyle::Linear : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Linear; - break; - } - case GradientStyle::Axial : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Axial; - break; - } - case GradientStyle::Radial : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Radial; - break; - } - case GradientStyle::Elliptical : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Elliptical; - break; - } - case GradientStyle::Square : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Square; - break; - } - default : // GradientStyle::Rect - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Rect; - break; - } - } - return drawinglayer::attribute::FillGradientAttribute( - aGradientStyle, + rGradient.GetStyle(), static_cast(rGradient.GetBorder()) * 0.01, static_cast(rGradient.GetOfsX()) * 0.01, static_cast(rGradient.GetOfsY()) * 0.01, diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 8169a0fb0601..6ab8eb844580 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -408,7 +408,7 @@ void EscherPropertyContainer::CreateGradientProperties( nFillType = ESCHER_FillShadeScale; nAngle = (rGradient.Angle * 0x10000) / 10; nFillFocus = (sal::static_int_cast(rGradient.Style) == - sal::static_int_cast(GradientStyle::Linear)) ? 0 : 50; + sal::static_int_cast(css::awt::GradientStyle_LINEAR)) ? 0 : 50; } break; case awt::GradientStyle_RADIAL : diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 2da8385bc4c3..e5f918afb0aa 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -219,8 +219,8 @@ void SVGAttributeWriter::AddPaintAttr( const Color& rLineColor, const Color& rFi void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const Gradient& rGradient, OUString& rGradientId ) { if( rObjRect.GetWidth() && rObjRect.GetHeight() && - ( rGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() == GradientStyle::Axial || - rGradient.GetStyle() == GradientStyle::Radial || rGradient.GetStyle() == GradientStyle::Elliptical ) ) + ( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL || + rGradient.GetStyle() == css::awt::GradientStyle_RADIAL || rGradient.GetStyle() == css::awt::GradientStyle_ELLIPTICAL ) ) { SvXMLElementExport aDesc( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, true, true ); Color aStartColor( rGradient.GetStartColor() ), aEndColor( rGradient.GetEndColor() ); @@ -248,7 +248,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const std::unique_ptr< SvXMLElementExport > apGradient; OUString aColorStr; - if( rGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() == GradientStyle::Axial ) + if( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) { tools::Polygon aLinePoly( 2 ); @@ -267,9 +267,9 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const // write stop values double fBorder = static_cast< double >( rGradient.GetBorder() ) * - ( ( rGradient.GetStyle() == GradientStyle::Axial ) ? 0.005 : 0.01 ); + ( ( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) ? 0.005 : 0.01 ); - ImplGetColorStr( ( rGradient.GetStyle() == GradientStyle::Axial ) ? aEndColor : aStartColor, aColorStr ); + ImplGetColorStr( ( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) ? aEndColor : aStartColor, aColorStr ); mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( fBorder ) ); mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr ); @@ -277,7 +277,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const SvXMLElementExport aDesc2( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, true, true ); } - if( rGradient.GetStyle() == GradientStyle::Axial ) + if( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) { ImplGetColorStr( aStartColor, aColorStr ); mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( 0.5 ) ); @@ -288,7 +288,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const } } - if( rGradient.GetStyle() != GradientStyle::Axial ) + if( rGradient.GetStyle() != css::awt::GradientStyle_AXIAL ) fBorder = 0.0; ImplGetColorStr( aEndColor, aColorStr ); @@ -2315,8 +2315,8 @@ void SVGActionWriter::ImplWritePattern( const tools::PolyPolygon& rPolyPoly, void SVGActionWriter::ImplWriteGradientEx( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, sal_uInt32 nWriteFlags) { - if ( rGradient.GetStyle() == GradientStyle::Linear || - rGradient.GetStyle() == GradientStyle::Axial ) + if ( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || + rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) { ImplWriteGradientLinear( rPolyPoly, rGradient ); } @@ -2376,7 +2376,7 @@ void SVGActionWriter::ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPo const Color aEndColor = ImplGetColorWithIntensity( rGradient.GetEndColor(), rGradient.GetEndIntensity() ); double fBorderOffset = rGradient.GetBorder() / 100.0; const sal_uInt16 nSteps = rGradient.GetSteps(); - if( rGradient.GetStyle() == GradientStyle::Linear ) + if( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR ) { // Emulate non-smooth gradient if( 0 < nSteps && nSteps < 100 ) diff --git a/include/drawinglayer/attribute/fillgradientattribute.hxx b/include/drawinglayer/attribute/fillgradientattribute.hxx index eab442644be3..da4cf9564705 100644 --- a/include/drawinglayer/attribute/fillgradientattribute.hxx +++ b/include/drawinglayer/attribute/fillgradientattribute.hxx @@ -21,6 +21,7 @@ #include #include +#include #include namespace basegfx @@ -34,16 +35,6 @@ namespace drawinglayer::attribute { class ImpFillGradientAttribute; -enum class GradientStyle -{ - Linear, - Axial, - Radial, - Elliptical, - Square, - Rect -}; - class DRAWINGLAYER_DLLPUBLIC FillGradientAttribute { public: @@ -73,8 +64,8 @@ public: but (existing) fallbacks to filled polygon can trigger. */ /// constructors/assignmentoperator/destructor - FillGradientAttribute(GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, - double fAngle, const basegfx::ColorStops& rColorStops, + FillGradientAttribute(css::awt::GradientStyle eStyle, double fBorder, double fOffsetX, + double fOffsetY, double fAngle, const basegfx::ColorStops& rColorStops, sal_uInt16 nSteps = 0); FillGradientAttribute(); FillGradientAttribute(const FillGradientAttribute&); @@ -100,7 +91,7 @@ public: bool operator==(const FillGradientAttribute& rCandidate) const; // data read access - GradientStyle getStyle() const; + css::awt::GradientStyle getStyle() const; double getBorder() const; double getOffsetX() const; double getOffsetY() const; diff --git a/include/vcl/gradient.hxx b/include/vcl/gradient.hxx index f7c2bd2ec5f9..fdb8df0b9a4c 100644 --- a/include/vcl/gradient.hxx +++ b/include/vcl/gradient.hxx @@ -28,6 +28,7 @@ #include #include +#include namespace tools { class Rectangle; } @@ -45,13 +46,13 @@ public: Gradient(); Gradient( const Gradient& rGradient ); Gradient( Gradient&& rGradient ); - Gradient( GradientStyle eStyle, + Gradient( css::awt::GradientStyle eStyle, const Color& rStartColor, const Color& rEndColor ); ~Gradient(); - void SetStyle( GradientStyle eStyle ); - GradientStyle GetStyle() const; + void SetStyle( css::awt::GradientStyle eStyle ); + css::awt::GradientStyle GetStyle() const; void SetStartColor( const Color& rColor ); const Color& GetStartColor() const; diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx index 75437f8772e5..8e38593c047c 100644 --- a/include/vcl/vclenum.hxx +++ b/include/vcl/vclenum.hxx @@ -141,18 +141,6 @@ enum class ExtDateFieldFormat FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -// this appears to be a direct copy of css::awt::GradientStyle -enum class GradientStyle -{ - Linear = 0, - Axial = 1, - Radial = 2, - Elliptical = 3, - Square = 4, - Rect = 5, - FORCE_EQUAL_SIZE = SAL_MAX_ENUM -}; - enum class HatchStyle { Single = 0, diff --git a/reportdesign/source/ui/report/EndMarker.cxx b/reportdesign/source/ui/report/EndMarker.cxx index fdd28f4db5e6..be12f9b8cebf 100644 --- a/reportdesign/source/ui/report/EndMarker.cxx +++ b/reportdesign/source/ui/report/EndMarker.cxx @@ -62,7 +62,7 @@ void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl aStartColor.RGBtoHSB(nHue, nSat, nBri); nSat += 40; Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri)); - Gradient aGradient(GradientStyle::Linear, aStartColor, aEndColor); + Gradient aGradient(css::awt::GradientStyle_LINEAR, aStartColor, aEndColor); aGradient.SetSteps(static_cast(aSize.Height())); rRenderContext.DrawGradient(PixelToLogic(aPoly), aGradient); diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx index 3d05f2910050..313313db62dc 100644 --- a/reportdesign/source/ui/report/StartMarker.cxx +++ b/reportdesign/source/ui/report/StartMarker.cxx @@ -128,7 +128,7 @@ void OStartMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan aStartColor.RGBtoHSB(nHue, nSat, nBri); nSat += 40; Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri)); - Gradient aGradient(GradientStyle::Linear,aStartColor,aEndColor); + Gradient aGradient(css::awt::GradientStyle_LINEAR,aStartColor,aEndColor); aGradient.SetSteps(static_cast(aSize.Height())); rRenderContext.DrawGradient(PixelToLogic(aPoly) ,aGradient); diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx index 7888e2656207..0168eaf3e93a 100644 --- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx +++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx @@ -404,7 +404,7 @@ void ScZoomSlider::DoPaint(vcl::RenderContext& rRenderContext) Gradient aGradient; aGradient.SetAngle(0_deg10); - aGradient.SetStyle(GradientStyle::Linear); + aGradient.SetStyle(css::awt::GradientStyle_LINEAR); aGradient.SetStartColor(aStartColor); aGradient.SetEndColor(aEndColor); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index d00f222b0f75..ab5b88062e24 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -869,7 +869,7 @@ void drawDataBars(vcl::RenderContext& rRenderContext, const ScDataBarInfo* pOldD if(pOldDataBarInfo->mbGradient) { rRenderContext.SetLineColor(pOldDataBarInfo->maColor); - Gradient aGradient(GradientStyle::Linear, pOldDataBarInfo->maColor, COL_TRANSPARENT); + Gradient aGradient(css::awt::GradientStyle_LINEAR, pOldDataBarInfo->maColor, COL_TRANSPARENT); aGradient.SetSteps(255); if(pOldDataBarInfo->mnLength < 0) diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index dd6290206966..bc6304529e43 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -77,7 +77,7 @@ void AnnotationTextWindow::Paint(vcl::RenderContext& rRenderContext, const ::too if (!bHighContrast) { rRenderContext.DrawGradient(::tools::Rectangle(Point(0,0), rRenderContext.PixelToLogic(aSize)), - Gradient(GradientStyle::Linear, mrContents.maColorLight, mrContents.maColor)); + Gradient(css::awt::GradientStyle_LINEAR, mrContents.maColorLight, mrContents.maColor)); } DoPaint(rRenderContext, rRect); diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx index feaf5a5fa36a..26131a8cd939 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx @@ -384,7 +384,7 @@ void PageObjectPainter::PaintBackgroundDetail ( const Color aBottomColor(mpTheme->GetGradientColor(eColorType, Theme::GradientColorClass::Fill2)); if (aTopColor != aBottomColor) { - Gradient gradient(GradientStyle::Linear, aTopColor, aBottomColor); + Gradient gradient(css::awt::GradientStyle_LINEAR, aTopColor, aBottomColor); rDevice.DrawGradient(aPageObjectBox, gradient); } else diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 963bba567f6d..d620f8468395 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -93,37 +93,6 @@ namespace drawinglayer { namespace { - attribute::GradientStyle XGradientStyleToGradientStyle(css::awt::GradientStyle eStyle) - { - switch(eStyle) - { - case css::awt::GradientStyle_LINEAR : - { - return attribute::GradientStyle::Linear; - } - case css::awt::GradientStyle_AXIAL : - { - return attribute::GradientStyle::Axial; - } - case css::awt::GradientStyle_RADIAL : - { - return attribute::GradientStyle::Radial; - } - case css::awt::GradientStyle_ELLIPTICAL : - { - return attribute::GradientStyle::Elliptical; - } - case css::awt::GradientStyle_SQUARE : - { - return attribute::GradientStyle::Square; - } - default : - { - return attribute::GradientStyle::Rect; // css::awt::GradientStyle_RECT - } - } - } - attribute::HatchStyle XHatchStyleToHatchStyle(css::drawing::HatchStyle eStyle) { switch(eStyle) @@ -772,7 +741,7 @@ namespace drawinglayer::primitive2d } aGradient = attribute::FillGradientAttribute( - XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()), + aXGradient.GetGradientStyle(), static_cast(aXGradient.GetBorder()) * 0.01, static_cast(aXGradient.GetXOffset()) * 0.01, static_cast(aXGradient.GetYOffset()) * 0.01, @@ -941,7 +910,7 @@ namespace drawinglayer::primitive2d } return attribute::FillGradientAttribute( - XGradientStyleToGradientStyle(rGradient.GetGradientStyle()), + rGradient.GetGradientStyle(), static_cast(rGradient.GetBorder()) * 0.01, static_cast(rGradient.GetXOffset()) * 0.01, static_cast(rGradient.GetYOffset()) * 0.01, diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 59a90f887a8b..bb79b0086fd6 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -523,7 +523,7 @@ void AreaPropertyPanelBase::FillStyleChanged(bool bUpdateModel) mxGradientStyle->set_active( sal::static_int_cast(aGradient.GetGradientStyle())); - if (mxGradientStyle->get_active() == sal_Int32(GradientStyle::Radial)) + if (mxGradientStyle->get_active() == sal_Int32(css::awt::GradientStyle_RADIAL)) mxMTRAngle->set_sensitive(false); else mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()), diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 86cb829119ec..acd8b321a7f8 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -1250,7 +1250,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction const & rAct, GDIMetaF rGrad.GetStartColor().getBColor(), rGrad.GetEndColor().getBColor())); - aXGradient.SetGradientStyle(static_cast(rGrad.GetStyle())); + aXGradient.SetGradientStyle(rGrad.GetStyle()); aXGradient.SetAngle(rGrad.GetAngle()); aXGradient.SetBorder(rGrad.GetBorder()); aXGradient.SetXOffset(rGrad.GetOfsX()); @@ -1393,34 +1393,6 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScalePartAction const & rAct) InsertObj(pGraf.get()); } -namespace -{ - css::awt::GradientStyle getXGradientStyleFromGradientStyle(const GradientStyle& rGradientStyle) - { - css::awt::GradientStyle aXGradientStyle(css::awt::GradientStyle_LINEAR); - - switch(rGradientStyle) - { - case GradientStyle::Linear: aXGradientStyle = css::awt::GradientStyle_LINEAR; break; - case GradientStyle::Axial: aXGradientStyle = css::awt::GradientStyle_AXIAL; break; - case GradientStyle::Radial: aXGradientStyle = css::awt::GradientStyle_RADIAL; break; - case GradientStyle::Elliptical: aXGradientStyle = css::awt::GradientStyle_ELLIPTICAL; break; - case GradientStyle::Square: aXGradientStyle = css::awt::GradientStyle_SQUARE; break; - case GradientStyle::Rect: aXGradientStyle = css::awt::GradientStyle_RECT; break; - - // Needed due to GradientStyle::FORCE_EQUAL_SIZE; this again is needed - // to force the enum defines in VCL to a defined size for the compilers, - // so despite it is never used it cannot be removed (would break the - // API implementation probably). - case GradientStyle::FORCE_EQUAL_SIZE: break; - default: - break; - } - - return aXGradientStyle; - } -} - void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction const & rAct) { basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(rAct.GetRect()); @@ -1440,13 +1412,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction const & rAct) ceil(aRange.getMaxY()))); // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet SfxItemSet aGradientAttr(mpModel->GetItemPool(), pRect->GetMergedItemSet().GetRanges()); - const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle())); const XFillGradientItem aXFillGradientItem( XGradient( basegfx::utils::createColorStopsFromStartEndColor( rGradient.GetStartColor().getBColor(), rGradient.GetEndColor().getBColor()), - aXGradientStyle, + rGradient.GetStyle(), rGradient.GetAngle(), rGradient.GetOfsX(), rGradient.GetOfsY(), @@ -1503,13 +1474,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction const & rAct) std::move(aSource)); // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet SfxItemSet aGradientAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges()); - const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle())); const XFillGradientItem aXFillGradientItem( XGradient( basegfx::utils::createColorStopsFromStartEndColor( rGradient.GetStartColor().getBColor(), rGradient.GetEndColor().getBColor()), - aXGradientStyle, + rGradient.GetStyle(), rGradient.GetAngle(), rGradient.GetOfsX(), rGradient.GetOfsY(), diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index c853e69a3a44..4ae0bf68ff23 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -102,41 +102,6 @@ BitmapEx XGradientList::CreateBitmap( tools::Long nIndex, const Size& rSize ) co const XGradient& rGradient = GetGradient(nIndex)->GetGradient(); basegfx::ColorStops aColorStops(rGradient.GetColorStops()); - drawinglayer::attribute::GradientStyle aGradientStyle(drawinglayer::attribute::GradientStyle::Rect); - - switch(rGradient.GetGradientStyle()) - { - case css::awt::GradientStyle_LINEAR : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Linear; - break; - } - case css::awt::GradientStyle_AXIAL : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Axial; - break; - } - case css::awt::GradientStyle_RADIAL : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Radial; - break; - } - case css::awt::GradientStyle_ELLIPTICAL : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Elliptical; - break; - } - case css::awt::GradientStyle_SQUARE : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Square; - break; - } - default : - { - aGradientStyle = drawinglayer::attribute::GradientStyle::Rect; // css::awt::GradientStyle_RECT - break; - } - } if (rGradient.GetStartIntens() != 100 || rGradient.GetEndIntens() != 100) { @@ -149,7 +114,7 @@ BitmapEx XGradientList::CreateBitmap( tools::Long nIndex, const Size& rSize ) co } drawinglayer::attribute::FillGradientAttribute aFillGradient( - aGradientStyle, + rGradient.GetGradientStyle(), static_cast(rGradient.GetBorder()) * 0.01, static_cast(rGradient.GetXOffset()) * 0.01, static_cast(rGradient.GetYOffset()) * 0.01, diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 358b961c8b50..a0032082dd95 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -575,7 +575,7 @@ SwTransparentTextGuard::~SwTransparentTextGuard() Gradient aVCLGradient; sal_uInt8 nTransPercentVcl = 255 - m_rPaintInf.GetFont()->GetColor().GetAlpha(); const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl); - aVCLGradient.SetStyle(GradientStyle::Linear); + aVCLGradient.SetStyle(css::awt::GradientStyle_LINEAR); aVCLGradient.SetStartColor(aTransColor); aVCLGradient.SetEndColor(aTransColor); aVCLGradient.SetAngle(0_deg10); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 677d62210046..06efbfdb581f 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -469,7 +469,7 @@ void SwAnnotationWin::SetMenuButtonColors() tools::Rectangle aRect(Point(0, 0), aSize); xVirDev->SetOutputSizePixel(aSize); - Gradient aGradient(GradientStyle::Linear, + Gradient aGradient(css::awt::GradientStyle_LINEAR, ColorFromAlphaColor(15, mColorAnchor, mColorDark), ColorFromAlphaColor(80, mColorAnchor, mColorDark)); xVirDev->DrawGradient(aRect, aGradient); diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 431de9e5e183..0ea4a37937f0 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -152,7 +152,7 @@ void SwFrameButtonPainter::PaintButton(drawinglayer::primitive2d::Primitive2DCon if (bOnTop) nAngle = 0; - FillGradientAttribute aFillAttrs(drawinglayer::attribute::GradientStyle::Linear, 0.0, 0.0, 0.0, nAngle, + FillGradientAttribute aFillAttrs(css::awt::GradientStyle_LINEAR, 0.0, 0.0, 0.0, nAngle, basegfx::utils::createColorStopsFromStartEndColor(aLighterColor, aFillColor)); rSeq.push_back(drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::FillGradientPrimitive2D(aGradientRect, std::move(aFillAttrs)))); diff --git a/sw/source/uibase/docvw/ShadowOverlayObject.cxx b/sw/source/uibase/docvw/ShadowOverlayObject.cxx index 418c9157a7c2..afabffb44e66 100644 --- a/sw/source/uibase/docvw/ShadowOverlayObject.cxx +++ b/sw/source/uibase/docvw/ShadowOverlayObject.cxx @@ -85,7 +85,7 @@ void ShadowPrimitive::create2DDecomposition( aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (2.0 * getDiscreteUnit()))); ::drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute( - drawinglayer::attribute::GradientStyle::Linear, + css::awt::GradientStyle_LINEAR, 0.0, 0.5, 0.5, @@ -104,7 +104,7 @@ void ShadowPrimitive::create2DDecomposition( { aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit()))); drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute( - drawinglayer::attribute::GradientStyle::Linear, + css::awt::GradientStyle_LINEAR, 0.0, 0.5, 0.5, @@ -123,7 +123,7 @@ void ShadowPrimitive::create2DDecomposition( { aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit()))); drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute( - drawinglayer::attribute::GradientStyle::Linear, + css::awt::GradientStyle_LINEAR, 0.0, 0.5, 0.5, diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 5fc7dd137c69..62f65e2eba3b 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -246,12 +246,12 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const tools:: if (mrSidebarWin.IsMouseOverSidebarWin() || HasFocus()) { rRenderContext.DrawGradient(tools::Rectangle(aPos, rRenderContext.PixelToLogic(aSize)), - Gradient(GradientStyle::Linear, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark())); + Gradient(css::awt::GradientStyle_LINEAR, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark())); } else { rRenderContext.DrawGradient(tools::Rectangle(aPos, rRenderContext.PixelToLogic(aSize)), - Gradient(GradientStyle::Linear, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark())); + Gradient(css::awt::GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark())); } } diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx index b89a67f49506..06df80a42106 100644 --- a/toolkit/source/awt/vclxgraphics.cxx +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -432,7 +432,7 @@ void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_ return; InitOutputDevice( InitOutDevFlags::COLORS ); - Gradient aGradient(static_cast(rGradient.Style), Color(ColorTransparency, rGradient.StartColor), Color(ColorTransparency, rGradient.EndColor)); + Gradient aGradient(rGradient.Style, Color(ColorTransparency, rGradient.StartColor), Color(ColorTransparency, rGradient.EndColor)); aGradient.SetAngle(Degree10(rGradient.Angle)); aGradient.SetBorder(rGradient.Border); aGradient.SetOfsX(rGradient.XOffset); diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx index 3277a3a54f3f..cbcf881bc788 100644 --- a/vcl/backendtest/VisualBackendTest.cxx +++ b/vcl/backendtest/VisualBackendTest.cxx @@ -712,7 +712,7 @@ public: mpVDev->DrawPolyPolygon(polyPolygon); tools::Rectangle aGradientRect(Point(200, 200), Size(200 + fTime * 300, 200 + fTime * 300)); - mpVDev->DrawGradient(aGradientRect, Gradient(GradientStyle::Linear, COL_YELLOW, COL_BLUE)); + mpVDev->DrawGradient(aGradientRect, Gradient(css::awt::GradientStyle_LINEAR, COL_YELLOW, COL_BLUE)); rRenderContext.DrawOutDev(Point(), mpVDev->GetOutputSizePixel(), Point(), mpVDev->GetOutputSizePixel(), diff --git a/vcl/backendtest/outputdevice/gradient.cxx b/vcl/backendtest/outputdevice/gradient.cxx index ebb94fbaaf9b..2596670b6874 100644 --- a/vcl/backendtest/outputdevice/gradient.cxx +++ b/vcl/backendtest/outputdevice/gradient.cxx @@ -17,7 +17,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradient() { initialSetup(12, 12, constBackgroundColor); - Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); + Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF), + Color(0x00, 0x00, 0x00)); aGradient.SetAngle(900_deg10); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); @@ -30,7 +31,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientAngled() { initialSetup(12, 12, constBackgroundColor); - Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); + Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF), + Color(0x00, 0x00, 0x00)); aGradient.SetAngle(450_deg10); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); @@ -43,7 +45,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientBorder() { initialSetup(12, 12, constBackgroundColor); - Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); + Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF), + Color(0x00, 0x00, 0x00)); aGradient.SetBorder(50); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); @@ -56,7 +59,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientIntensity() { initialSetup(12, 12, constBackgroundColor); - Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); + Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF), + Color(0x00, 0x00, 0x00)); aGradient.SetStartIntensity(50); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); @@ -69,7 +73,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientSteps() { initialSetup(12, 12, constBackgroundColor); - Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); + Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF), + Color(0x00, 0x00, 0x00)); aGradient.SetAngle(900_deg10); aGradient.SetSteps(4); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, @@ -83,7 +88,8 @@ Bitmap OutputDeviceTestGradient::setupAxialGradient() { initialSetup(13, 13, constBackgroundColor); - Gradient aGradient(GradientStyle::Axial, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); + Gradient aGradient(css::awt::GradientStyle_AXIAL, Color(0xFF, 0xFF, 0xFF), + Color(0x00, 0x00, 0x00)); aGradient.SetAngle(900_deg10); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); @@ -96,7 +102,8 @@ Bitmap OutputDeviceTestGradient::setupRadialGradient() { initialSetup(12, 12, constBackgroundColor); - Gradient aGradient(GradientStyle::Radial, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); + Gradient aGradient(css::awt::GradientStyle_RADIAL, Color(0xFF, 0xFF, 0xFF), + Color(0x00, 0x00, 0x00)); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); mpVirtualDevice->DrawGradient(aDrawRect, aGradient); @@ -108,7 +115,8 @@ Bitmap OutputDeviceTestGradient::setupRadialGradientOfs() { initialSetup(12, 12, constBackgroundColor); - Gradient aGradient(GradientStyle::Radial, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); + Gradient aGradient(css::awt::GradientStyle_RADIAL, Color(0xFF, 0xFF, 0xFF), + Color(0x00, 0x00, 0x00)); aGradient.SetOfsX(100); // Move center to the bottom-right corner. aGradient.SetOfsY(100); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx index 4706c7e344c0..2b732f627f30 100644 --- a/vcl/headless/CairoCommon.cxx +++ b/vcl/headless/CairoCommon.cxx @@ -1283,8 +1283,8 @@ bool CairoCommon::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWid bool CairoCommon::drawGradient(const tools::PolyPolygon& rPolyPolygon, const Gradient& rGradient, bool bAntiAlias) { - if (rGradient.GetStyle() != GradientStyle::Linear - && rGradient.GetStyle() != GradientStyle::Radial) + if (rGradient.GetStyle() != css::awt::GradientStyle_LINEAR + && rGradient.GetStyle() != css::awt::GradientStyle_RADIAL) return false; // unsupported if (rGradient.GetSteps() != 0) return false; // We can't tell cairo how many colors to use in the gradient. @@ -1323,7 +1323,7 @@ bool CairoCommon::drawGradient(const tools::PolyPolygon& rPolyPolygon, const Gra Color aEndColor = aGradient.GetEndColor(); cairo_pattern_t* pattern; - if (rGradient.GetStyle() == GradientStyle::Linear) + if (rGradient.GetStyle() == css::awt::GradientStyle_LINEAR) { tools::Polygon aPoly(aBoundRect); aPoly.Rotate(aCenter, aGradient.GetAngle() % 3600_deg10); diff --git a/vcl/qa/cppunit/TypeSerializerTest.cxx b/vcl/qa/cppunit/TypeSerializerTest.cxx index 1c7b93d25a62..2ffa3ec1257f 100644 --- a/vcl/qa/cppunit/TypeSerializerTest.cxx +++ b/vcl/qa/cppunit/TypeSerializerTest.cxx @@ -89,7 +89,8 @@ TypeSerializerTest::~TypeSerializerTest() void TypeSerializerTest::testGradient() { - Gradient aGradient(GradientStyle::Radial, Color(0xFF, 0x00, 0x00), Color(0x00, 0xFF, 0x00)); + Gradient aGradient(css::awt::GradientStyle_RADIAL, Color(0xFF, 0x00, 0x00), + Color(0x00, 0xFF, 0x00)); aGradient.SetAngle(900_deg10); aGradient.SetBorder(5); aGradient.SetOfsX(11); @@ -105,7 +106,7 @@ void TypeSerializerTest::testGradient() Gradient aReadGradient; aSerializer.readGradient(aReadGradient); - CPPUNIT_ASSERT_EQUAL(GradientStyle::Radial, aReadGradient.GetStyle()); + CPPUNIT_ASSERT_EQUAL(css::awt::GradientStyle_RADIAL, aReadGradient.GetStyle()); CPPUNIT_ASSERT_EQUAL(Color(0xFF, 0x00, 0x00), aReadGradient.GetStartColor()); CPPUNIT_ASSERT_EQUAL(Color(0x00, 0xFF, 0x00), aReadGradient.GetEndColor()); CPPUNIT_ASSERT_EQUAL(sal_Int16(900), aReadGradient.GetAngle().get()); diff --git a/vcl/qa/cppunit/gradient.cxx b/vcl/qa/cppunit/gradient.cxx index 474c619bef72..2f33f4b1a6d0 100644 --- a/vcl/qa/cppunit/gradient.cxx +++ b/vcl/qa/cppunit/gradient.cxx @@ -91,7 +91,7 @@ void VclGradientTest::testAddGradientActions_rect_linear() { GDIMetaFile aMtf; tools::Rectangle aRect(Point(10, 10), Size(40, 40)); - Gradient aGradient(GradientStyle::Linear, COL_RED, COL_WHITE); + Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_RED, COL_WHITE); aGradient.SetBorder(100); aGradient.AddGradientActions(aRect, aMtf); @@ -166,7 +166,7 @@ void VclGradientTest::testAddGradientActions_rect_axial() { GDIMetaFile aMtf; tools::Rectangle aRect(Point(10, 10), Size(40, 40)); - Gradient aGradient(GradientStyle::Axial, COL_RED, COL_WHITE); + Gradient aGradient(css::awt::GradientStyle_AXIAL, COL_RED, COL_WHITE); aGradient.SetBorder(100); aGradient.AddGradientActions(aRect, aMtf); @@ -226,7 +226,7 @@ void VclGradientTest::testAddGradientActions_rect_complex() { GDIMetaFile aMtf; tools::Rectangle aRect(Point(10, 10), Size(40, 40)); - Gradient aGradient(GradientStyle::Square, COL_RED, COL_WHITE); + Gradient aGradient(css::awt::GradientStyle_SQUARE, COL_RED, COL_WHITE); aGradient.SetBorder(10); aGradient.AddGradientActions(aRect, aMtf); diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index e9576c42221e..379346dd0b76 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -2021,7 +2021,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_rect_linear) tools::Rectangle aRect(Point(10, 10), Size(40, 40)); pVDev->SetOutputSizePixel(Size(100, 100)); - Gradient aGradient(GradientStyle::Linear, COL_RED, COL_WHITE); + Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_RED, COL_WHITE); aGradient.SetBorder(100); pVDev->DrawGradient(aRect, aGradient); @@ -2042,7 +2042,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_rect_axial) tools::Rectangle aRect(Point(10, 10), Size(40, 40)); pVDev->SetOutputSizePixel(Size(100, 100)); - Gradient aGradient(GradientStyle::Axial, COL_RED, COL_WHITE); + Gradient aGradient(css::awt::GradientStyle_AXIAL, COL_RED, COL_WHITE); aGradient.SetBorder(100); pVDev->DrawGradient(aRect, aGradient); @@ -2064,7 +2064,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_polygon_linear) pVDev->SetOutputSizePixel(Size(100, 100)); - Gradient aGradient(GradientStyle::Linear, COL_RED, COL_WHITE); + Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_RED, COL_WHITE); aGradient.SetBorder(100); pVDev->DrawGradient(aPolyPolygon, aGradient); @@ -2082,7 +2082,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_polygon_axial) pVDev->SetOutputSizePixel(Size(100, 100)); - Gradient aGradient(GradientStyle::Axial, COL_RED, COL_WHITE); + Gradient aGradient(css::awt::GradientStyle_AXIAL, COL_RED, COL_WHITE); aGradient.SetBorder(100); pVDev->DrawGradient(aPolyPolygon, aGradient); @@ -2099,7 +2099,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_rect_complex) tools::Rectangle aRect(Point(10, 10), Size(40, 40)); pVDev->SetOutputSizePixel(Size(1000, 1000)); - Gradient aGradient(GradientStyle::Square, COL_RED, COL_WHITE); + Gradient aGradient(css::awt::GradientStyle_SQUARE, COL_RED, COL_WHITE); aGradient.SetBorder(10); pVDev->DrawGradient(aRect, aGradient); diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index c5ca008b0a9b..8b43f828ac7d 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -1290,13 +1290,13 @@ void SvmTest::testGradient() tools::Rectangle aRectangle(Point(1, 2), Size(4,5)); - Gradient aGradient(GradientStyle::Linear, COL_WHITE, COL_BLACK); + Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_WHITE, COL_BLACK); pVirtualDev->DrawGradient(aRectangle, aGradient); tools::Rectangle aRectangle2(Point(3, 4), Size(1,2)); Gradient aGradient2; - aGradient2.SetStyle(GradientStyle::Radial); + aGradient2.SetStyle(css::awt::GradientStyle_RADIAL); aGradient2.SetStartColor(COL_LIGHTRED); aGradient2.SetEndColor(COL_LIGHTGREEN); aGradient2.SetAngle(Degree10(55)); @@ -1384,7 +1384,7 @@ void SvmTest::testGradientEx() tools::PolyPolygon aPolyPolygon(1); aPolyPolygon.Insert(aPolygon); - Gradient aGradient(GradientStyle::Linear, COL_WHITE, COL_BLACK); + Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_WHITE, COL_BLACK); pVirtualDev->DrawGradient(aPolyPolygon, aGradient); tools::Polygon aPolygon2(2); @@ -1400,7 +1400,7 @@ void SvmTest::testGradientEx() aPolyPolygon2.Insert(aPolygon3); Gradient aGradient2; - aGradient2.SetStyle(GradientStyle::Axial); + aGradient2.SetStyle(css::awt::GradientStyle_AXIAL); aGradient2.SetStartColor(COL_LIGHTMAGENTA); aGradient2.SetEndColor(COL_CYAN); aGradient2.SetAngle(Degree10(55)); @@ -2134,7 +2134,7 @@ void SvmTest::testFloatTransparent() pVirtualDev1->DrawPixel(Point(1, 8)); pVirtualDev1->DrawPixel(Point(2, 7)); - Gradient aGradient(GradientStyle::Linear, COL_WHITE, COL_BLACK); + Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_WHITE, COL_BLACK); pVirtualDev->DrawTransparent(aGDIMetaFile1, Point(1, 2), Size(3, 4), aGradient); diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index f26b2d26711b..94e1f7c176fa 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1994,9 +1994,9 @@ bool SkiaSalGraphicsImpl::drawAlphaRect(tools::Long nX, tools::Long nY, tools::L bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPolygon, const Gradient& rGradient) { - if (rGradient.GetStyle() != GradientStyle::Linear - && rGradient.GetStyle() != GradientStyle::Axial - && rGradient.GetStyle() != GradientStyle::Radial) + if (rGradient.GetStyle() != css::awt::GradientStyle_LINEAR + && rGradient.GetStyle() != css::awt::GradientStyle_AXIAL + && rGradient.GetStyle() != css::awt::GradientStyle_RADIAL) return false; // unsupported if (rGradient.GetSteps() != 0) return false; // We can't tell Skia how many colors to use in the gradient. @@ -2031,7 +2031,7 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPolygon, SkColor endColor = toSkColorWithIntensity(rGradient.GetEndColor(), rGradient.GetEndIntensity()); sk_sp shader; - if (rGradient.GetStyle() == GradientStyle::Linear) + if (rGradient.GetStyle() == css::awt::GradientStyle_LINEAR) { tools::Polygon aPoly(aBoundRect); aPoly.Rotate(aCenter, aGradient.GetAngle() % 3600_deg10); @@ -2041,7 +2041,7 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPolygon, SkScalar pos[2] = { SkDoubleToScalar(aGradient.GetBorder() / 100.0), 1.0 }; shader = SkGradientShader::MakeLinear(points, colors, pos, 2, SkTileMode::kClamp); } - else if (rGradient.GetStyle() == GradientStyle::Axial) + else if (rGradient.GetStyle() == css::awt::GradientStyle_AXIAL) { tools::Polygon aPoly(aBoundRect); aPoly.Rotate(aCenter, aGradient.GetAngle() % 3600_deg10); diff --git a/vcl/source/filter/svm/SvmConverter.cxx b/vcl/source/filter/svm/SvmConverter.cxx index 60fa48f2927d..c844648d7b9b 100644 --- a/vcl/source/filter/svm/SvmConverter.cxx +++ b/vcl/source/filter/svm/SvmConverter.cxx @@ -1080,7 +1080,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) sal_Int16 nAngle(0), nBorder(0), nOfsX(0), nOfsY(0), nIntensityStart(0), nIntensityEnd(0); rIStm.ReadInt16( nAngle ).ReadInt16( nBorder ).ReadInt16( nOfsX ).ReadInt16( nOfsY ).ReadInt16( nIntensityStart ).ReadInt16( nIntensityEnd ); - Gradient aGrad( static_cast(nStyle), aStartCol, aEndCol ); + Gradient aGrad( static_cast(nStyle), aStartCol, aEndCol ); aGrad.SetAngle( Degree10(nAngle) ); aGrad.SetBorder( nBorder ); diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx index 0882f97243ad..9144650154af 100644 --- a/vcl/source/gdi/TypeSerializer.cxx +++ b/vcl/source/gdi/TypeSerializer.cxx @@ -58,7 +58,7 @@ void TypeSerializer::readGradient(Gradient& rGradient) mrStream.ReadUInt16(nIntensityEnd); mrStream.ReadUInt16(nStepCount); - rGradient.SetStyle(static_cast(nStyle)); + rGradient.SetStyle(static_cast(nStyle)); rGradient.SetStartColor(aStartColor); rGradient.SetEndColor(aEndColor); if (nAngle > 3600) diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx index f7722174ba81..b8712511a39a 100644 --- a/vcl/source/gdi/gradient.cxx +++ b/vcl/source/gdi/gradient.cxx @@ -26,7 +26,7 @@ class Gradient::Impl { public: - GradientStyle meStyle; + css::awt::GradientStyle meStyle; Color maStartColor; Color maEndColor; Degree10 mnAngle; @@ -38,7 +38,7 @@ public: sal_uInt16 mnStepCount; Impl() - : meStyle (GradientStyle::Linear) + : meStyle (css::awt::GradientStyle_LINEAR) , maStartColor(COL_BLACK) , maEndColor(COL_WHITE) , mnAngle(0) @@ -86,7 +86,7 @@ Gradient::Gradient( const Gradient& ) = default; Gradient::Gradient( Gradient&& ) = default; -Gradient::Gradient( GradientStyle eStyle, +Gradient::Gradient( css::awt::GradientStyle eStyle, const Color& rStartColor, const Color& rEndColor ) { mpImplGradient->meStyle = eStyle; @@ -97,12 +97,12 @@ Gradient::Gradient( GradientStyle eStyle, Gradient::~Gradient() = default; -GradientStyle Gradient::GetStyle() const +css::awt::GradientStyle Gradient::GetStyle() const { return mpImplGradient->meStyle; } -void Gradient::SetStyle( GradientStyle eStyle ) +void Gradient::SetStyle( css::awt::GradientStyle eStyle ) { mpImplGradient->meStyle = eStyle; } @@ -202,7 +202,7 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB tools::Rectangle aRect( rRect ); Degree10 nAngle = GetAngle() % 3600_deg10; - if( GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial ) + if( GetStyle() == css::awt::GradientStyle_LINEAR || GetStyle() == css::awt::GradientStyle_AXIAL ) { const double fAngle = toRadians(nAngle); const double fWidth = aRect.GetWidth(); @@ -223,7 +223,7 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB } else { - if( GetStyle() == GradientStyle::Square || GetStyle() == GradientStyle::Rect ) + if( GetStyle() == css::awt::GradientStyle_SQUARE || GetStyle() == css::awt::GradientStyle_RECT ) { const double fAngle = toRadians(nAngle); const double fWidth = aRect.GetWidth(); @@ -242,13 +242,13 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB Size aSize( aRect.GetSize() ); - if( GetStyle() == GradientStyle::Radial ) + if( GetStyle() == css::awt::GradientStyle_RADIAL ) { // Calculation of radii for circle aSize.setWidth( static_cast(0.5 + std::hypot(aSize.Width(), aSize.Height())) ); aSize.setHeight( aSize.Width() ); } - else if( GetStyle() == GradientStyle::Elliptical ) + else if( GetStyle() == css::awt::GradientStyle_ELLIPTICAL ) { // Calculation of radii for ellipse aSize.setWidth( static_cast( 0.5 + static_cast(aSize.Width()) * M_SQRT2 ) ); @@ -324,7 +324,7 @@ void Gradient::AddGradientActions(tools::Rectangle const& rRect, GDIMetaFile& rM if (!GetSteps()) SetSteps(GRADIENT_DEFAULT_STEPCOUNT); - if (GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial) + if (GetStyle() == css::awt::GradientStyle_LINEAR || GetStyle() == css::awt::GradientStyle_AXIAL) DrawLinearGradientToMetafile(aRect, rMetaFile); else DrawComplexGradientToMetafile(aRect, rMetaFile); @@ -340,7 +340,7 @@ tools::Long Gradient::GetMetafileSteps(tools::Rectangle const& rRect) const if (nStepCount) return nStepCount; - if (GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial) + if (GetStyle() == css::awt::GradientStyle_LINEAR || GetStyle() == css::awt::GradientStyle_AXIAL) return rRect.GetHeight(); else return std::min(rRect.GetWidth(), rRect.GetHeight()); @@ -366,7 +366,7 @@ void Gradient::DrawLinearGradientToMetafile(tools::Rectangle const& rRect, GDIMe GetBoundRect(rRect, aRect, aCenter); - bool bLinear = (GetStyle() == GradientStyle::Linear); + bool bLinear = (GetStyle() == css::awt::GradientStyle_LINEAR); double fBorder = GetBorder() * aRect.GetHeight() / 100.0; if ( !bLinear ) { @@ -593,7 +593,7 @@ void Gradient::DrawComplexGradientToMetafile(tools::Rectangle const& rRect, GDIM // all gradients are rendered as nested rectangles which shrink // equally in each dimension - except for 'square' gradients // which shrink to a central vertex but are not per-se square. - if (GetStyle() != GradientStyle::Square) + if (GetStyle() != css::awt::GradientStyle_SQUARE) { fScanIncY = std::min( fScanIncY, fScanIncX ); fScanIncX = fScanIncY; @@ -623,7 +623,7 @@ void Gradient::DrawComplexGradientToMetafile(tools::Rectangle const& rRect, GDIM if( ( aRect.GetWidth() < 2 ) || ( aRect.GetHeight() < 2 ) ) break; - if (GetStyle() == GradientStyle::Radial || GetStyle() == GradientStyle::Elliptical) + if (GetStyle() == css::awt::GradientStyle_RADIAL || GetStyle() == css::awt::GradientStyle_ELLIPTICAL) aPoly = tools::Polygon( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 ); else aPoly = tools::Polygon( aRect ); diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index b20dd7d35513..7092ebfa54fc 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -374,17 +374,17 @@ OUString convertFractionToString(const Fraction& aFraction) return OUString::createFromAscii(ss.str().c_str()); } -OUString convertGradientStyle(GradientStyle eStyle) +OUString convertGradientStyleToOUString(css::awt::GradientStyle eStyle) { switch (eStyle) { - case GradientStyle::Linear: return "Linear"; - case GradientStyle::Axial: return "Axial"; - case GradientStyle::Radial: return "Radial"; - case GradientStyle::Elliptical: return "Elliptical"; - case GradientStyle::Square: return "Square"; - case GradientStyle::Rect: return "Rect"; - case GradientStyle::FORCE_EQUAL_SIZE: return "ForceEqualSize"; + case css::awt::GradientStyle_LINEAR: return "Linear"; + case css::awt::GradientStyle_AXIAL: return "Axial"; + case css::awt::GradientStyle_RADIAL: return "Radial"; + case css::awt::GradientStyle_ELLIPTICAL: return "Elliptical"; + case css::awt::GradientStyle_SQUARE: return "Square"; + case css::awt::GradientStyle_RECT: return "Rect"; + case css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE: return "ForceEqualSize"; } return OUString(); } @@ -555,7 +555,7 @@ void writeLineInfo(tools::XmlWriter& rWriter, LineInfo const& rLineInfo) void writeGradient(tools::XmlWriter& rWriter, Gradient const& rGradient) { - rWriter.attribute("style", convertGradientStyle(rGradient.GetStyle())); + rWriter.attribute("style", convertGradientStyleToOUString(rGradient.GetStyle())); rWriter.attribute("startcolor", convertColorToString(rGradient.GetStartColor())); rWriter.attribute("endcolor", convertColorToString(rGradient.GetEndColor())); rWriter.attribute("angle", rGradient.GetAngle().get()); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 634a24235e16..2e2788fbac8b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -8694,9 +8694,9 @@ void PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject ) { // LO internal gradient -> PDF shading type: - // * GradientStyle::Linear: axial shading, using sampled-function with 2 samples + // * css::awt::GradientStyle_LINEAR: axial shading, using sampled-function with 2 samples // [t=0:colorStart, t=1:colorEnd] - // * GradientStyle::Axial: axial shading, using sampled-function with 3 samples + // * css::awt::GradientStyle_AXIAL: axial shading, using sampled-function with 3 samples // [t=0:colorEnd, t=0.5:colorStart, t=1:colorEnd] // * other styles: function shading with aSize.Width() * aSize.Height() samples sal_Int32 nFunctionObject = createObject(); @@ -8727,8 +8727,8 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject ) "<> 1, aRect.GetHeight() >> 1 ); else aPoly = tools::Polygon( aRect ); @@ -591,7 +591,7 @@ tools::Long OutputDevice::GetGradientSteps(Gradient const& rGradient, tools::Rec tools::Long nMinRect = 0; - if (rGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() == GradientStyle::Axial) + if (rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL) nMinRect = rRect.GetHeight(); else nMinRect = std::min(rRect.GetWidth(), rRect.GetHeight()); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index cb33666cb06d..95c5fd5d0867 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -322,7 +322,7 @@ void ToolBox::ImplDrawGradientBackground(vcl::RenderContext& rRenderContext) Gradient g; g.SetAngle(Degree10(mbHorz ? 0 : 900)); - g.SetStyle(GradientStyle::Linear); + g.SetStyle(css::awt::GradientStyle_LINEAR); g.SetStartColor(startCol); g.SetEndColor(endCol); diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index e152365a1342..a969bff5e242 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -265,7 +265,7 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR Color const aLightGreen(0, 0xff, 0); Color const aDarkGreen(0, 0x40, 0); - Gradient aGradient(GradientStyle::Linear, aBlack, aWhite); + Gradient aGradient(css::awt::GradientStyle_LINEAR, aBlack, aWhite); aGradient.SetAngle(900_deg10); rRenderContext.DrawGradient(tools::Rectangle(Point(1000, 4500), Size(aPaperSize.Width() - 2000, 500)), diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 6fb5f3514017..5b9b2b0289e1 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -244,7 +244,7 @@ public: Gradient aGradient; aGradient.SetStartColor(COL_BLUE); aGradient.SetEndColor(COL_GREEN); - aGradient.SetStyle(GradientStyle::Linear); + aGradient.SetStyle(css::awt::GradientStyle_LINEAR); rDev.DrawGradient(r, aGradient); } @@ -795,11 +795,11 @@ public: COL_GRAY, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTCYAN, COL_BLUE, COL_BLUE, COL_BLUE, COL_CYAN, COL_CYAN }; - GradientStyle eStyles[] = { - GradientStyle::Linear, GradientStyle::Axial, GradientStyle::Radial, GradientStyle::Elliptical, GradientStyle::Square, - GradientStyle::Rect, GradientStyle::FORCE_EQUAL_SIZE, GradientStyle::Linear, GradientStyle::Radial, GradientStyle::Linear, - GradientStyle::Linear, GradientStyle::Axial, GradientStyle::Radial, GradientStyle::Elliptical, GradientStyle::Square, - GradientStyle::Rect, GradientStyle::FORCE_EQUAL_SIZE, GradientStyle::Linear, GradientStyle::Radial, GradientStyle::Linear + css::awt::GradientStyle eStyles[] = { + css::awt::GradientStyle_LINEAR, css::awt::GradientStyle_AXIAL, css::awt::GradientStyle_RADIAL, css::awt::GradientStyle_ELLIPTICAL, css::awt::GradientStyle_SQUARE, + css::awt::GradientStyle_RECT, css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE, css::awt::GradientStyle_LINEAR, css::awt::GradientStyle_RADIAL, css::awt::GradientStyle_LINEAR, + css::awt::GradientStyle_LINEAR, css::awt::GradientStyle_AXIAL, css::awt::GradientStyle_RADIAL, css::awt::GradientStyle_ELLIPTICAL, css::awt::GradientStyle_SQUARE, + css::awt::GradientStyle_RECT, css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE, css::awt::GradientStyle_LINEAR, css::awt::GradientStyle_RADIAL, css::awt::GradientStyle_LINEAR }; sal_uInt16 nAngles[] = { 0, 0, 0, 0, 0, @@ -837,7 +837,7 @@ public: Gradient aGradient; aGradient.SetStartColor(COL_YELLOW); aGradient.SetEndColor(COL_RED); - aGradient.SetStyle(GradientStyle::Rect); + aGradient.SetStyle(css::awt::GradientStyle_RECT); aGradient.SetBorder(r.GetSize().Width()/20); rDev.DrawGradient(r, aGradient); } -- cgit