32#include <com/sun/star/beans/XPropertySet.hpp>
33#include <com/sun/star/awt/Gradient2.hpp>
34#include <com/sun/star/text/GraphicCrop.hpp>
35#include <com/sun/star/awt/Size.hpp>
36#include <com/sun/star/drawing/BitmapMode.hpp>
37#include <com/sun/star/drawing/ColorMode.hpp>
38#include <com/sun/star/drawing/FillStyle.hpp>
39#include <com/sun/star/drawing/RectanglePoint.hpp>
40#include <com/sun/star/graphic/XGraphicTransformer.hpp>
45#include <oox/token/namespaces.hxx>
46#include <oox/token/properties.hxx>
47#include <oox/token/tokens.hxx>
48#include <osl/diagnose.h>
55using ::com::sun::star::uno::Reference;
56using ::com::sun::star::uno::Exception;
57using ::com::sun::star::uno::UNO_QUERY_THROW;
58using ::com::sun::star::geometry::IntegerRectangle2D;
64Reference< XGraphic > lclCheckAndApplyDuotoneTransform(
const BlipFillProperties& aBlipProps, uno::Reference<graphic::XGraphic>
const & xGraphic,
67 if (aBlipProps.maDuotoneColors[0].isUsed() && aBlipProps.maDuotoneColors[1].isUsed())
69 ::Color nColor1 = aBlipProps.maDuotoneColors[0].getColor( rGraphicHelper, nPhClr );
70 ::Color nColor2 = aBlipProps.maDuotoneColors[1].getColor( rGraphicHelper, nPhClr );
72 uno::Reference<graphic::XGraphicTransformer> xTransformer(aBlipProps.mxFillGraphic, uno::UNO_QUERY);
73 if (xTransformer.is())
74 return xTransformer->applyDuotone(xGraphic, sal_Int32(nColor1), sal_Int32(nColor2));
79Reference< XGraphic > lclRotateGraphic(uno::Reference<graphic::XGraphic>
const & xGraphic,
Degree10 nRotation)
84 assert (aGraphic.GetType() == GraphicType::Bitmap);
86 BitmapEx aBitmapEx(aGraphic.GetBitmapEx());
87 const ::Color& aColor =
::Color(0x00);
88 aBitmapEx.Rotate(nRotation, aColor);
95using Quotients = std::tuple<double, double, double, double>;
96Quotients getQuotients(geometry::IntegerRectangle2D aRelRect,
double hDiv,
double vDiv)
98 return { aRelRect.X1 / hDiv, aRelRect.Y1 / vDiv, aRelRect.X2 / hDiv, aRelRect.Y2 / vDiv };
102std::optional<Quotients> CropQuotientsFromSrcRect(geometry::IntegerRectangle2D aSrcRect)
104 aSrcRect.X1 = std::max(aSrcRect.X1, sal_Int32(0));
105 aSrcRect.X2 = std::max(aSrcRect.X2, sal_Int32(0));
106 aSrcRect.Y1 = std::max(aSrcRect.Y1, sal_Int32(0));
107 aSrcRect.Y2 = std::max(aSrcRect.Y2, sal_Int32(0));
108 if (aSrcRect.X1 + aSrcRect.X2 >= 100'000 || aSrcRect.Y1 + aSrcRect.Y2 >= 100'000)
110 return getQuotients(aSrcRect, 100'000.0, 100'000.0);
114std::optional<Quotients> CropQuotientsFromFillRect(geometry::IntegerRectangle2D aFillRect)
116 aFillRect.X1 = std::min(aFillRect.X1, sal_Int32(0));
117 aFillRect.X2 = std::min(aFillRect.X2, sal_Int32(0));
118 aFillRect.Y1 = std::min(aFillRect.Y1, sal_Int32(0));
119 aFillRect.Y2 = std::min(aFillRect.Y2, sal_Int32(0));
121 return getQuotients(aFillRect, -100'000.0 + aFillRect.X1 + aFillRect.X2,
122 -100'000.0 + aFillRect.Y1 + aFillRect.Y2);
126Reference<XGraphic> lclCropGraphic(uno::Reference<graphic::XGraphic>
const& xGraphic,
127 std::optional<Quotients> quotients)
130 assert (aGraphic.GetType() == GraphicType::Bitmap);
135 aBitmapEx = aGraphic.GetBitmapEx();
138 const auto& [qx1, qy1, qx2, qy2] = *quotients;
144 aBitmapEx.
Crop({ l,
t, bmpSize.
Width() - r - 1, bmpSize.
Height() - b - 1 });
153Reference< XGraphic > lclMirrorGraphic(uno::Reference<graphic::XGraphic>
const & xGraphic,
bool bFlipH,
bool bFlipV)
158 assert (aGraphic.GetType() == GraphicType::Bitmap);
160 BitmapEx aBitmapEx(aGraphic.GetBitmapEx());
164 nMirrorFlags |= BmpMirrorFlags::Horizontal;
166 nMirrorFlags |= BmpMirrorFlags::Vertical;
168 aBitmapEx.
Mirror(nMirrorFlags);
176Reference< XGraphic > lclGreysScaleGraphic(uno::Reference<graphic::XGraphic>
const & xGraphic)
181 assert (aGraphic.GetType() == GraphicType::Bitmap);
183 BitmapEx aBitmapEx(aGraphic.GetBitmapEx());
184 aBitmapEx.
Convert(BmpConversion::N8BitGreys);
193Reference<XGraphic> lclApplyBlackWhiteEffect(
const BlipFillProperties& aBlipProps,
194 const uno::Reference<graphic::XGraphic>& xGraphic)
196 const auto& oBiLevelThreshold = aBlipProps.moBiLevelThreshold;
197 if (oBiLevelThreshold.has_value())
205 BitmapEx aBitmapEx(aGraphic.GetBitmapEx());
212 aReturnGraphic.setOriginURL(aGraphic.getOriginURL());
213 return aReturnGraphic.GetXGraphic();
218Reference< XGraphic > lclCheckAndApplyChangeColorTransform(
const BlipFillProperties &aBlipProps, uno::Reference<graphic::XGraphic>
const & xGraphic,
221 if( aBlipProps.maColorChangeFrom.isUsed() && aBlipProps.maColorChangeTo.isUsed() )
223 ::Color nFromColor = aBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr );
224 ::Color nToColor = aBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr );
225 if ( (nFromColor != nToColor) || aBlipProps.maColorChangeTo.hasTransparency() )
227 sal_Int16 nToTransparence = aBlipProps.maColorChangeTo.getTransparency();
228 sal_Int8 nToAlpha =
static_cast< sal_Int8 >( (100 - nToTransparence) * 2.55 );
232 if( aGraphic.IsGfxLink() )
235 switch (aGraphic.GetGfxLink().GetType())
237 case GfxLinkType::NativeJpg:
240 case GfxLinkType::NativePng:
241 case GfxLinkType::NativeTif:
244 case GfxLinkType::NativeBmp:
252 uno::Reference<graphic::XGraphicTransformer> xTransformer(aBlipProps.mxFillGraphic, uno::UNO_QUERY);
253 if (xTransformer.is())
254 return xTransformer->colorChange(xGraphic, sal_Int32(nFromColor), nTolerance, sal_Int32(nToColor), nToAlpha);
260uno::Reference<graphic::XGraphic> applyBrightnessContrast(uno::Reference<graphic::XGraphic>
const & xGraphic, sal_Int32 brightness, sal_Int32 contrast)
262 uno::Reference<graphic::XGraphicTransformer> xTransformer(xGraphic, uno::UNO_QUERY);
263 if (xTransformer.is())
264 return xTransformer->applyBrightnessContrast(xGraphic, brightness, contrast,
true);
268BitmapMode lclGetBitmapMode( sal_Int32 nToken )
270 OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
273 case XML_tile:
return BitmapMode_REPEAT;
274 case XML_stretch:
return BitmapMode_STRETCH;
278 return BitmapMode_REPEAT;
281RectanglePoint lclGetRectanglePoint( sal_Int32 nToken )
283 OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
286 case XML_tl:
return RectanglePoint_LEFT_TOP;
287 case XML_t:
return RectanglePoint_MIDDLE_TOP;
288 case XML_tr:
return RectanglePoint_RIGHT_TOP;
289 case XML_l:
return RectanglePoint_LEFT_MIDDLE;
290 case XML_ctr:
return RectanglePoint_MIDDLE_MIDDLE;
291 case XML_r:
return RectanglePoint_RIGHT_MIDDLE;
292 case XML_bl:
return RectanglePoint_LEFT_BOTTOM;
293 case XML_b:
return RectanglePoint_MIDDLE_BOTTOM;
294 case XML_br:
return RectanglePoint_RIGHT_BOTTOM;
296 return RectanglePoint_LEFT_TOP;
299awt::Size lclGetOriginalSize(
const GraphicHelper& rGraphicHelper,
const Reference< XGraphic >& rxGraphic )
301 awt::Size aSizeHmm( 0, 0 );
304 Reference< beans::XPropertySet > xGraphicPropertySet( rxGraphic, UNO_QUERY_THROW );
305 if( xGraphicPropertySet->getPropertyValue(
"Size100thMM" ) >>= aSizeHmm )
307 if( !aSizeHmm.Width && !aSizeHmm.Height )
309 awt::Size aSourceSizePixel( 0, 0 );
310 if( xGraphicPropertySet->getPropertyValue(
"SizePixel" ) >>= aSourceSizePixel )
389 GradientFillProperties::GradientStopMap::const_iterator aGradientStop =
393 aSolidColor = aGradientStop->second;
404 sal_Int32 nShapeRotation,
::Color nPhClr,
405 const css::awt::Size& rSize, sal_Int16 nPhClrTheme,
bool bFlipH,
406 bool bFlipV,
bool bIsCustomShape)
const
412 OSL_ASSERT((
moFillType.value() & sal_Int32(0xFFFF0000))==0);
417 eFillStyle = FillStyle_NONE;
431 if (aFillColor == nPhClr)
441 eFillStyle = FillStyle_SOLID;
452 bool bContainsTransparency(
false);
457 const ::Color aColor(rCandidate.second.getColor(rGraphicHelper, nPhClr));
458 aColorStops.emplace_back(rCandidate.first, aColor.getBColor());
459 bContainsTransparency = bContainsTransparency || rCandidate.second.hasTransparency();
463 if (bContainsTransparency)
467 const double fTrans(rCandidate.second.getTransparency() * (1.0/100.0));
468 aTransparencyStops.emplace_back(rCandidate.first,
basegfx::BColor(fTrans, fTrans, fTrans));
480 awt::GradientStyle_LINEAR,
495 sal_Int32 nCenterX = (
MAX_PERCENT + aFillToRect.X1 - aFillToRect.X2) / 2;
496 aGradient.
SetXOffset(getLimitedValue<sal_Int16, sal_Int32>(
498 sal_Int32 nCenterY = (
MAX_PERCENT + aFillToRect.Y1 - aFillToRect.Y2) / 2;
499 aGradient.
SetYOffset(getLimitedValue<sal_Int16, sal_Int32>(
533 nShadeAngle = 180*60000 - nShadeAngle;
535 nShadeAngle = -nShadeAngle;
536 const sal_Int32 nDmlAngle = nShadeAngle + nShapeRotation;
552 eFillStyle = FillStyle_GRADIENT;
556 if (!aTransparencyStops.empty())
574 xGraphic = lclGreysScaleGraphic(xGraphic);
579 eFillStyle = FillStyle_BITMAP;
583 eFillStyle = FillStyle_BITMAP;
588 if( eFillStyle == FillStyle_BITMAP )
594 if( eBitmapMode == BitmapMode_REPEAT )
601 if( (aOriginalSize.Width > 0) && (aOriginalSize.Height > 0) )
605 sal_Int32 nFillBmpSizeX = getLimitedValue< sal_Int32, double >( aOriginalSize.Width * fScaleX, 1,
SAL_MAX_INT32 );
608 sal_Int32 nFillBmpSizeY = getLimitedValue< sal_Int32, double >( aOriginalSize.Height * fScaleY, 1,
SAL_MAX_INT32 );
611 awt::Size aBmpSize(nFillBmpSizeX, nFillBmpSizeY);
613 sal_Int16 nTileOffsetX = getDoubleIntervalValue< sal_Int16 >(std::round(
maBlipProps.
moTileOffsetX.value_or( 0 ) / 3.6 / aBmpSize.Width), 0, 100 );
615 sal_Int16 nTileOffsetY = getDoubleIntervalValue< sal_Int16 >(std::round(
maBlipProps.
moTileOffsetY.value_or( 0 ) / 3.6 / aBmpSize.Height), 0, 100 );
623 if ( aOriginalSize.Width && aOriginalSize.Height )
625 text::GraphicCrop aGraphCrop( 0, 0, 0, 0 );
627 aGraphCrop.Left =
static_cast< sal_Int32
>( (
static_cast< double >( aOriginalSize.Width ) * aFillRect.X1 ) / 100000 );
629 aGraphCrop.Top =
static_cast< sal_Int32
>( (
static_cast< double >( aOriginalSize.Height ) * aFillRect.Y1 ) / 100000 );
631 aGraphCrop.Right =
static_cast< sal_Int32
>( (
static_cast< double >( aOriginalSize.Width ) * aFillRect.X2 ) / 100000 );
633 aGraphCrop.Bottom =
static_cast< sal_Int32
>( (
static_cast< double >( aOriginalSize.Height ) * aFillRect.Y2 ) / 100000 );
635 bool bHasCropValues = aGraphCrop.Left != 0 || aGraphCrop.Right !=0 || aGraphCrop.Top != 0 || aGraphCrop.Bottom != 0;
637 bool bNeedCrop = aGraphCrop.Left <= 0 && aGraphCrop.Right <= 0 && aGraphCrop.Top <= 0 && aGraphCrop.Bottom <= 0;
641 if (bIsCustomShape && bNeedCrop)
646 xGraphic = lclCropGraphic(xGraphic, CropQuotientsFromFillRect(aFillRect));
652 else if ((aFillRect.X1 != 0 && aFillRect.X2 != 0
653 && aFillRect.X1 != aFillRect.X2)
654 || (aFillRect.Y1 != 0 && aFillRect.Y2 != 0
655 && aFillRect.Y1 != aFillRect.Y2))
661 double nL = aFillRect.X1 /
static_cast<double>(
MAX_PERCENT);
662 double nT = aFillRect.Y1 /
static_cast<double>(
MAX_PERCENT);
663 double nR = aFillRect.X2 /
static_cast<double>(
MAX_PERCENT);
664 double nB = aFillRect.Y2 /
static_cast<double>(
MAX_PERCENT);
668 nSizeX = rSize.Width * (1 - (nL + nR));
670 nSizeX = rSize.Width;
675 nSizeY = rSize.Height * (1 - (nT + nB));
677 nSizeY = rSize.Height;
680 RectanglePoint eRectPoint;
681 if (!aFillRect.X1 && aFillRect.X2)
683 if (!aFillRect.Y1 && aFillRect.Y2)
684 eRectPoint = lclGetRectanglePoint(XML_tl);
685 else if (aFillRect.Y1 && !aFillRect.Y2)
686 eRectPoint = lclGetRectanglePoint(XML_bl);
688 eRectPoint = lclGetRectanglePoint(XML_l);
690 else if (aFillRect.X1 && !aFillRect.X2)
692 if (!aFillRect.Y1 && aFillRect.Y2)
693 eRectPoint = lclGetRectanglePoint(XML_tr);
694 else if (aFillRect.Y1 && !aFillRect.Y2)
695 eRectPoint = lclGetRectanglePoint(XML_br);
697 eRectPoint = lclGetRectanglePoint(XML_r);
701 if (!aFillRect.Y1 && aFillRect.Y2)
702 eRectPoint = lclGetRectanglePoint(XML_t);
703 else if (aFillRect.Y1 && !aFillRect.Y2)
704 eRectPoint = lclGetRectanglePoint(XML_b);
706 eRectPoint = lclGetRectanglePoint(XML_ctr);
709 eBitmapMode = BitmapMode_NO_REPEAT;
729 eFillStyle = FillStyle_HATCH;
748 eFillStyle = FillStyle_SOLID;
756 eFillStyle = FillStyle_NONE;
768 ColorMode eColorMode = ColorMode_STANDARD;
772 case XML_biLevel: eColorMode = ColorMode_MONO;
break;
773 case XML_grayscl: eColorMode = ColorMode_GREYS;
break;
782 if( eColorMode == ColorMode_MONO )
788 xGraphic = lclApplyBlackWhiteEffect(
maBlipProps, xGraphic);
789 eColorMode = ColorMode_STANDARD;
793 if (eColorMode == ColorMode_STANDARD && nBrightness == 70 && nContrast == -70)
796 eColorMode = ColorMode_WATERMARK;
800 else if( nBrightness != 0 && nContrast != 0 )
806 xGraphic = applyBrightnessContrast( xGraphic, nBrightness, nContrast );
816 if ( aOriginalSize.Width && aOriginalSize.Height )
818 text::GraphicCrop aGraphCrop( 0, 0, 0, 0 );
820 aGraphCrop.Left = rtl::math::round( (
static_cast< double >( aOriginalSize.Width ) * oClipRect.X1 ) / 100000 );
822 aGraphCrop.Top = rtl::math::round( (
static_cast< double >( aOriginalSize.Height ) * oClipRect.Y1 ) / 100000 );
824 aGraphCrop.Right = rtl::math::round( (
static_cast< double >( aOriginalSize.Width ) * oClipRect.X2 ) / 100000 );
826 aGraphCrop.Bottom = rtl::math::round( (
static_cast< double >( aOriginalSize.Height ) * oClipRect.Y2 ) / 100000 );
829 bool bHasCropValues = aGraphCrop.Left != 0 || aGraphCrop.Right !=0 || aGraphCrop.Top != 0 || aGraphCrop.Bottom != 0;
831 bool bNeedCrop = aGraphCrop.Left >= 0 && aGraphCrop.Right >= 0 && aGraphCrop.Top >= 0 && aGraphCrop.Bottom >= 0;
835 xGraphic = lclCropGraphic(xGraphic, CropQuotientsFromSrcRect(oClipRect));
851 xGraphic = lclRotateGraphic(xGraphic,
Degree10(nAngle/10) );
857 xGraphic = lclMirrorGraphic(xGraphic, bFlipH, bFlipV );
859 if(eColorMode == ColorMode_GREYS)
860 xGraphic = lclGreysScaleGraphic( xGraphic );
876 if( nBrightness != 0 )
897 css::beans::PropertyValue aRet;
901 css::uno::Sequence< css::beans::PropertyValue >
aSeq(
maAttribs.size() + 1 );
902 auto pSeq =
aSeq.getArray();
906 pSeq[
i].Name = attrib.first;
907 pSeq[
i].Value = attrib.second;
913 css::uno::Sequence< css::beans::PropertyValue > aGraphicSeq{
918 pSeq[
i].Name =
"OriginalGraphic";
919 pSeq[
i].Value <<= aGraphicSeq;
942 case OOX_TOKEN( a14, artisticBlur ):
return "artisticBlur";
943 case OOX_TOKEN( a14, artisticCement ):
return "artisticCement";
944 case OOX_TOKEN( a14, artisticChalkSketch ):
return "artisticChalkSketch";
945 case OOX_TOKEN( a14, artisticCrisscrossEtching ):
return "artisticCrisscrossEtching";
946 case OOX_TOKEN( a14, artisticCutout ):
return "artisticCutout";
947 case OOX_TOKEN( a14, artisticFilmGrain ):
return "artisticFilmGrain";
948 case OOX_TOKEN( a14, artisticGlass ):
return "artisticGlass";
949 case OOX_TOKEN( a14, artisticGlowDiffused ):
return "artisticGlowDiffused";
950 case OOX_TOKEN( a14, artisticGlowEdges ):
return "artisticGlowEdges";
951 case OOX_TOKEN( a14, artisticLightScreen ):
return "artisticLightScreen";
952 case OOX_TOKEN( a14, artisticLineDrawing ):
return "artisticLineDrawing";
953 case OOX_TOKEN( a14, artisticMarker ):
return "artisticMarker";
954 case OOX_TOKEN( a14, artisticMosiaicBubbles ):
return "artisticMosiaicBubbles";
955 case OOX_TOKEN( a14, artisticPaintStrokes ):
return "artisticPaintStrokes";
956 case OOX_TOKEN( a14, artisticPaintBrush ):
return "artisticPaintBrush";
957 case OOX_TOKEN( a14, artisticPastelsSmooth ):
return "artisticPastelsSmooth";
958 case OOX_TOKEN( a14, artisticPencilGrayscale ):
return "artisticPencilGrayscale";
959 case OOX_TOKEN( a14, artisticPencilSketch ):
return "artisticPencilSketch";
960 case OOX_TOKEN( a14, artisticPhotocopy ):
return "artisticPhotocopy";
961 case OOX_TOKEN( a14, artisticPlasticWrap ):
return "artisticPlasticWrap";
962 case OOX_TOKEN( a14, artisticTexturizer ):
return "artisticTexturizer";
963 case OOX_TOKEN( a14, artisticWatercolorSponge ):
return "artisticWatercolorSponge";
964 case OOX_TOKEN( a14, brightnessContrast ):
return "brightnessContrast";
965 case OOX_TOKEN( a14, colorTemperature ):
return "colorTemperature";
966 case OOX_TOKEN( a14, saturation ):
return "saturation";
967 case OOX_TOKEN( a14, sharpenSoften ):
return "sharpenSoften";
970 case XML_visible:
return "visible";
971 case XML_trans:
return "trans";
972 case XML_crackSpacing:
return "crackSpacing";
973 case XML_pressure:
return "pressure";
974 case XML_numberOfShades:
return "numberOfShades";
975 case XML_grainSize:
return "grainSize";
976 case XML_intensity:
return "intensity";
977 case XML_smoothness:
return "smoothness";
978 case XML_gridSize:
return "gridSize";
979 case XML_pencilSize:
return "pencilSize";
980 case XML_size:
return "size";
981 case XML_brushSize:
return "brushSize";
982 case XML_scaling:
return "scaling";
983 case XML_detail:
return "detail";
984 case XML_bright:
return "bright";
985 case XML_contrast:
return "contrast";
986 case XML_colorTemp:
return "colorTemp";
987 case XML_sat:
return "sat";
988 case XML_amount:
return "amount";
990 SAL_WARN(
"oox.drawingml",
"ArtisticEffectProperties::getEffectString: unexpected token " <<
nToken );
997 if(
sName ==
"artisticBlur" )
998 return XML_artisticBlur;
999 else if(
sName ==
"artisticCement" )
1000 return XML_artisticCement;
1001 else if(
sName ==
"artisticChalkSketch" )
1002 return XML_artisticChalkSketch;
1003 else if(
sName ==
"artisticCrisscrossEtching" )
1004 return XML_artisticCrisscrossEtching;
1005 else if(
sName ==
"artisticCutout" )
1006 return XML_artisticCutout;
1007 else if(
sName ==
"artisticFilmGrain" )
1008 return XML_artisticFilmGrain;
1009 else if(
sName ==
"artisticGlass" )
1010 return XML_artisticGlass;
1011 else if(
sName ==
"artisticGlowDiffused" )
1012 return XML_artisticGlowDiffused;
1013 else if(
sName ==
"artisticGlowEdges" )
1014 return XML_artisticGlowEdges;
1015 else if(
sName ==
"artisticLightScreen" )
1016 return XML_artisticLightScreen;
1017 else if(
sName ==
"artisticLineDrawing" )
1018 return XML_artisticLineDrawing;
1019 else if(
sName ==
"artisticMarker" )
1020 return XML_artisticMarker;
1021 else if(
sName ==
"artisticMosiaicBubbles" )
1022 return XML_artisticMosiaicBubbles;
1023 else if(
sName ==
"artisticPaintStrokes" )
1024 return XML_artisticPaintStrokes;
1025 else if(
sName ==
"artisticPaintBrush" )
1026 return XML_artisticPaintBrush;
1027 else if(
sName ==
"artisticPastelsSmooth" )
1028 return XML_artisticPastelsSmooth;
1029 else if(
sName ==
"artisticPencilGrayscale" )
1030 return XML_artisticPencilGrayscale;
1031 else if(
sName ==
"artisticPencilSketch" )
1032 return XML_artisticPencilSketch;
1033 else if(
sName ==
"artisticPhotocopy" )
1034 return XML_artisticPhotocopy;
1035 else if(
sName ==
"artisticPlasticWrap" )
1036 return XML_artisticPlasticWrap;
1037 else if(
sName ==
"artisticTexturizer" )
1038 return XML_artisticTexturizer;
1039 else if(
sName ==
"artisticWatercolorSponge" )
1040 return XML_artisticWatercolorSponge;
1041 else if(
sName ==
"brightnessContrast" )
1042 return XML_brightnessContrast;
1043 else if(
sName ==
"colorTemperature" )
1044 return XML_colorTemperature;
1045 else if(
sName ==
"saturation" )
1046 return XML_saturation;
1047 else if(
sName ==
"sharpenSoften" )
1048 return XML_sharpenSoften;
1051 else if(
sName ==
"visible" )
1053 else if(
sName ==
"trans" )
1055 else if(
sName ==
"crackSpacing" )
1056 return XML_crackSpacing;
1057 else if(
sName ==
"pressure" )
1058 return XML_pressure;
1059 else if(
sName ==
"numberOfShades" )
1060 return XML_numberOfShades;
1061 else if(
sName ==
"grainSize" )
1062 return XML_grainSize;
1063 else if(
sName ==
"intensity" )
1064 return XML_intensity;
1065 else if(
sName ==
"smoothness" )
1066 return XML_smoothness;
1067 else if(
sName ==
"gridSize" )
1068 return XML_gridSize;
1069 else if(
sName ==
"pencilSize" )
1070 return XML_pencilSize;
1071 else if(
sName ==
"size" )
1073 else if(
sName ==
"brushSize" )
1074 return XML_brushSize;
1075 else if(
sName ==
"scaling" )
1077 else if(
sName ==
"detail" )
1079 else if(
sName ==
"bright" )
1081 else if(
sName ==
"contrast" )
1082 return XML_contrast;
1083 else if(
sName ==
"colorTemp" )
1084 return XML_colorTemp;
1085 else if(
sName ==
"sat" )
1087 else if(
sName ==
"amount" )
1090 SAL_WARN(
"oox.drawingml",
"ArtisticEffectProperties::getEffectToken - unexpected token name: " <<
sName );
const AlphaMask & GetAlphaMask() const
bool Convert(BmpConversion eConversion)
bool Mirror(BmpMirrorFlags nMirrorFlags)
Bitmap GetBitmap(Color aTransparentReplaceColor) const
bool Crop(const tools::Rectangle &rRectPixel)
const Size & GetSizePixel() const
static bool Filter(BitmapEx &rBmpEx, BitmapFilter const &rFilter)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
void setOriginURL(OUString const &rOriginURL)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void tryToRecreateBorder(basegfx::BColorStops *pAssociatedTransparencyStops=nullptr)
void SetGradientStyle(css::awt::GradientStyle eNewStyle)
void SetColorStops(const basegfx::BColorStops &rSteps)
void SetYOffset(sal_uInt16 nNewOffset)
void SetXOffset(sal_uInt16 nNewOffset)
sal_uInt16 GetXOffset() const
css::awt::Gradient2 getAsGradient2() const
css::awt::GradientStyle GetGradientStyle() const
void SetAngle(Degree10 nNewAngle)
sal_uInt16 GetYOffset() const
void setSchemeColor(ThemeColorType eType)
Provides helper functions for colors, device measurement conversion, graphics, and graphic objects ha...
css::awt::Size getOriginalSize(const css::uno::Reference< css::graphic::XGraphic > &rxGraphic) const
calculates the original size of a graphic which is necessary to be able to calculate cropping values
css::awt::Size convertScreenPixelToHmm(const css::awt::Size &rPixel) const
Converts the passed size from screen pixels to 1/100 mm.
A helper that maps property identifiers to property values.
css::uno::Any getProperty(sal_Int32 nPropId)
bool hasProperty(sal_Int32 nPropId) const
Returns true, if the map contains a property with the passed identifier.
bool setProperty(sal_Int32 nPropId, Type &&rValue)
Sets the specified property to the passed value.
sal_Int16 getTransparency() const
Returns the transparency of the color (0 = opaque, 100 = full transparent).
void assignIfUsed(const Color &rColor)
Overwrites this color with the passed color, if it is used.
bool isUsed() const
Returns true, if the color is initialized.
model::ComplexColor getComplexColor() const
bool hasTransparency() const
Returns true, if the color is transparent.
::Color getColor(const GraphicHelper &rGraphicHelper, ::Color nPhClr=API_RGB_TRANSPARENT) const
Returns the final RGB color value.
bool setProperty(ShapeProperty ePropId, const Type &rValue)
Sets the specified shape property to the passed value.
bool supportsProperty(ShapeProperty ePropId) const
Returns true, if the specified property is supported.
static drawing::Hatch createHatch(sal_Int32 nHatchToken, ::Color nColor)
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
enum SAL_DLLPUBLIC_RTTI FillStyle
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
uno::Reference< util::XComplexColor > createXComplexColor(model::ComplexColor const &rColor)
constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex)
@ FillBitmap
Explicit fill bitmap or name of a fill bitmap stored in a global container.
@ FillBitmapRectanglePoint
@ FillGradient
Explicit fill gradient or name of a fill gradient stored in a global container.
@ FillHatch
Explicit fill hatch or name of a fill hatch stored in a global container.
const sal_Int32 MAX_PERCENT
const sal_Int32 PER_DEGREE
const sal_Int32 PER_PERCENT
void assignIfUsed(std::optional< Type > &rDestValue, const std::optional< Type > &rSourceValue)
const ::Color API_RGB_TRANSPARENT(ColorTransparency, 0xffffffff)
Transparent color for API calls.
bool isEmpty() const
The original graphic as embedded object.
css::beans::PropertyValue getEffect()
Returns the struct as a PropertyValue with Name = msName and Value = maAttribs as a Sequence< Propert...
void assignUsed(const ArtisticEffectProperties &rSourceProps)
Overwrites all members that are explicitly set in rSourceProps.
::oox::ole::OleObjectInfo mrOleObjectInfo
std::map< OUString, css::uno::Any > maAttribs
static OUString getEffectString(sal_Int32 nToken)
Translate effect tokens to strings.
static sal_Int32 getEffectToken(const OUString &sName)
Translate effect strings to tokens.
std::optional< css::geometry::IntegerRectangle2D > moClipRect
Stretch fill offsets.
Color maColorChangeTo
Start color of color transformation.
std::optional< css::geometry::IntegerRectangle2D > moFillRect
Bitmap tile or stretch.
std::optional< sal_Int32 > moColorEffect
True = rotate bitmap with shape.
std::optional< sal_Int32 > moBitmapMode
The fill graphic.
std::optional< sal_Int32 > moTileFlip
Anchor point inside bitmap.
Color maDuotoneColors[2]
Destination color of color transformation.
std::optional< sal_Int32 > moAlphaModFix
Artistic effect, not supported by core.
std::optional< sal_Int32 > moTileScaleY
Horizontal scaling of bitmap tiles (1/1000 percent).
std::optional< sal_Int32 > moTileOffsetY
Width of bitmap tiles (EMUs).
std::optional< sal_Int32 > moBrightness
XML token for a color effect.
Color maColorChangeFrom
Bi-Level (Black/White) effect threshold (1/1000 percent)
std::optional< bool > moRotateWithShape
Flip mode of bitmap tiles.
std::optional< sal_Int32 > moBiLevelThreshold
Contrast in the range [-100000,100000].
css::uno::Reference< css::graphic::XGraphic > mxFillGraphic
ArtisticEffectProperties maEffect
Duotone Colors.
void assignUsed(const BlipFillProperties &rSourceProps)
Overwrites all members that are explicitly set in rSourceProps.
std::optional< sal_Int32 > moTileAlign
Vertical scaling of bitmap tiles (1/1000 percent).
std::optional< sal_Int32 > moTileScaleX
Height of bitmap tiles (EMUs).
std::optional< sal_Int32 > moTileOffsetX
std::optional< sal_Int32 > moContrast
Brightness in the range [-100000,100000].
PatternFillProperties maPatternProps
Properties for gradient fills.
GradientFillProperties maGradientProps
Whether the background is used as fill type.
BlipFillProperties maBlipProps
Properties for pattern fills.
void pushToPropMap(ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper, sal_Int32 nShapeRotation=0, ::Color nPhClr=API_RGB_TRANSPARENT, const css::awt::Size &rSize={}, sal_Int16 nPhClrTheme=-1, bool bFlipH=false, bool bFlipV=false, bool bIsCustomShape=false) const
Writes the properties to the passed property map.
void assignUsed(const FillProperties &rSourceProps)
Properties for bitmap fills.
Color getBestSolidColor() const
Tries to resolve current settings to a solid color, e.g.
std::optional< bool > moUseBgFill
Solid fill color and transparence.
Color maFillColor
Fill type (OOXML token).
std::optional< sal_Int32 > moFillType
std::optional< css::geometry::IntegerRectangle2D > moFillToRect
Gradient stops (colors/transparence).
std::optional< sal_Int32 > moShadeFlip
Rotation angle of linear gradients.
std::optional< bool > moRotateWithShape
True = scale gradient into shape.
std::optional< sal_Int32 > moGradientPath
void assignUsed(const GradientFillProperties &rSourceProps)
True = rotate gradient with shape.
std::optional< css::geometry::IntegerRectangle2D > moTileRect
std::optional< bool > moShadeScaled
Flip mode of gradient, if not stretched to shape.
std::optional< sal_Int32 > moShadeAngle
If set, gradient follows rectangle, circle, or shape.
GradientStopMap maGradientStops
OUString m_sMediaPackageURL
Audio/Video URL.
css::uno::Reference< css::io::XInputStream > m_xMediaStream
Audio/Video input stream.
void pushToPropMap(PropertyMap &rPropMap, const GraphicHelper &rGraphicHelper, bool bFlipH=false, bool bFlipV=false) const
Writes the properties to the passed property map.
BlipFillProperties maBlipProps
Properties for the graphic.
Color maPattBgColor
Pattern foreground color.
std::optional< sal_Int32 > moPattPreset
Pattern background color.
void assignUsed(const PatternFillProperties &rSourceProps)
Preset pattern type.
StreamDataSequence maEmbeddedData
Data of an embedded OLE object.
constexpr OUStringLiteral PROP_FillBitmapMode
constexpr OUStringLiteral PROP_GraphicColorMode
constexpr OUStringLiteral PROP_AdjustLuminance
constexpr OUStringLiteral PROP_RotateAngle
constexpr OUStringLiteral PROP_AdjustContrast
constexpr OUStringLiteral PROP_Transparency
constexpr OUStringLiteral PROP_GraphicCrop
constexpr OUStringLiteral PROP_FillComplexColor
constexpr OUStringLiteral PROP_FillStyle