26#include <oox/token/namespaces.hxx>
27#include <oox/token/tokens.hxx>
30#include <unordered_map>
31#include <frozen/bits/defines.h>
32#include <frozen/bits/elsa_std.h>
33#include <frozen/unordered_map.h>
38using ::oox::core::ContextHandler2;
54 , mpGradientFill(pGradientFill)
55 , mrGradientProps(rGradientProps)
57 auto oRotateWithShape = rAttribs.
getBool(XML_rotWithShape);
69 case A_TOKEN( gsLst ):
75 double fPosition = getLimitedValue<double>(rAttribs.
getDouble(XML_pos, 0.0) / 100000.0, 0.0, 1.0);
86 return new ColorContext(*
this, aElement->second, pComplexColor);
104 case A_TOKEN( path ):
128 case A_TOKEN( fillToRect ):
136 case A_TOKEN( tileRect ):
149constexpr frozen::unordered_map<sal_Int32, model::PatternPreset, 54> constPatternPresetMap
211 , mpPatternFill(pPatternFill)
212 , mrPatternProps(rPatternProps)
220 auto aIterator = constPatternPresetMap.find(
nToken);
221 if (aIterator != constPatternPresetMap.end())
223 auto const& aPair = *aIterator;
236 case A_TOKEN( bgClr ):
240 case A_TOKEN( fgClr ):
251 , mpBlipFill(pBlipFill)
252 , mrBlipProps(rBlipProps)
277 case A_TOKEN(clrFrom):
281 pComplexColor = &rEffect.getColorFrom();
288 pComplexColor = &rEffect.getColorTo();
298 , mpBlipFill(pBlipFill)
299 , mrBlipProps(rBlipProps)
305 if (!aFragmentPath.isEmpty())
336 case A_TOKEN( biLevel ):
338 sal_Int32 nTreshold = rAttribs.
getInteger(XML_thresh, 0);
347 rEffect.mnThreshold = nTreshold;
352 case A_TOKEN( grayscl ):
363 case A_TOKEN( clrChange ):
368 case A_TOKEN( duotone ):
371 case A_TOKEN( extLst ):
383 rEffect.mnBrightness = rAttribs.
getInteger(XML_bright, 0);
384 rEffect.mnContrast = rAttribs.
getInteger(XML_contrast, 0);
388 case A_TOKEN( alphaModFix ):
395 rEffect.mnAmount = rAttribs.
getInteger(XML_amt, 100 * 1000);
406 mrBlipProps( rBlipProps ),
428 , mpBlipFill(pBlipFill)
429 , mrBlipProps(rBlipProps)
441 case A_TOKEN( blip ):
444 case A_TOKEN( srcRect ):
453 case A_TOKEN( tile ):
484 case A_TOKEN( stretch ):
509 mrFillProps( rFillProps )
520 ContextHandler2Helper
const & rParent, sal_Int32 nElement,
526 case A_TOKEN( noFill ):
528 rFillProps.
moFillType = getBaseToken(nElement);
531 pFillStyle->
mpFill = std::make_shared<model::NoFill>();
535 case A_TOKEN( solidFill ):
537 rFillProps.
moFillType = getBaseToken(nElement);
541 pFillStyle->
mpFill = std::make_shared<model::SolidFill>();
546 case A_TOKEN( gradFill ):
548 rFillProps.
moFillType = getBaseToken(nElement);
552 pFillStyle->
mpFill = std::make_shared<model::GradientFill>();
557 case A_TOKEN( pattFill ):
559 rFillProps.
moFillType = getBaseToken( nElement );
563 auto pFill = std::make_shared<model::PatternFill>();
564 pPatternFill = pFill.get();
565 pFillStyle->
mpFill = pFill;
569 case A_TOKEN( blipFill ):
571 rFillProps.
moFillType = getBaseToken( nElement );
575 pFillStyle->
mpFill = std::make_unique<model::BlipFill>();
580 case A_TOKEN( grpFill ):
583 rFillProps.
moFillType = getBaseToken( nElement );
603 mrBlipProps( rBlipProps )
619 case OOX_TOKEN( a14, imgProps ):
639 if( nElement == OOX_TOKEN( a14, imgLayer ) )
644 if( !aFragmentPath.isEmpty() )
652 if( nElement == OOX_TOKEN( a14, imgEffect ) )
661 sal_Int32
const aAttribs[19] = {
662 XML_visible, XML_trans, XML_crackSpacing, XML_pressure, XML_numberOfShades,
663 XML_grainSize, XML_intensity, XML_smoothness, XML_gridSize, XML_pencilSize,
664 XML_size, XML_brushSize, XML_scaling, XML_detail, XML_bright, XML_contrast,
665 XML_colorTemp, XML_sat, XML_amount
667 for(sal_Int32 nAttrib : aAttribs)
672 if( !
sName.isEmpty() )
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
css::uno::Reference< css::graphic::XGraphic > mxGraphic
std::vector< BlipEffect > maBlipEffects
RelativeRectangle maClipRectangle
RectangleAlignment meTileAlignment
RelativeRectangle maFillRectangle
std::shared_ptr< Fill > mpFill
GradientType meGradientType
LinearGradientProperties maLinearGradient
RelativeRectangle maFillToRectangle
RelativeRectangle maTileRectangle
std::vector< GradientStop > maGradientStops
ComplexColor maBackgroundColor
PatternPreset mePatternPreset
ComplexColor maForegroundColor
Provides access to attribute values of an element.
OUString getStringDefaulted(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute, returns an empty string if attribute not present...
bool hasAttribute(sal_Int32 nAttrToken) const
Returns true, if the specified attribute is present.
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
Returns the 32-bit signed integer value of the specified attribute (decimal).
const css::uno::Reference< css::xml::sax::XFastAttributeList > & getFastAttributeList() const
Returns the wrapped com.sun.star.xml.sax.XFastAttributeList object.
std::optional< bool > getBool(sal_Int32 nAttrToken) const
Returns the boolean value of the specified attribute.
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.
std::optional< double > getDouble(sal_Int32 nAttrToken) const
Returns the double value of the specified attribute.
css::uno::Reference< css::graphic::XGraphic > importEmbeddedGraphic(const OUString &rStreamName, const WmfExternal *pExtHeader=nullptr) const
Imports a graphic from the storage stream with the passed path and name.
XmlFilterBase & getFilter() const
Returns the filter instance.
OUString getFragmentPathFromRelId(const OUString &rRelId) const
Returns the full fragment path for the passed relation identifier.
const Relations & getRelations() const
Returns the relations of the current fragment.
bool importBinaryData(StreamDataSequence &orDataSeq, const OUString &rStreamName)
Imports the raw binary data from the specified stream.
OUString getAbsoluteUrl(const OUString &rUrl) const
Returns an absolute URL for the passed relative or absolute URL.
GraphicHelper & getGraphicHelper() const
Returns a helper for the handling of graphics and graphic objects.
Context handler that imports a14:imgProps, a14:imgLayer, a14:imgEffect containers and the a14:artisti...
ArtisticEffectContext(::oox::core::ContextHandler2Helper const &rParent, ArtisticEffectProperties &rEffect)
ArtisticEffectProperties & maEffect
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
virtual ~ArtisticEffectContext() override
Context handler that imports the a:blip element containing the fill bitmap and bitmap color transform...
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
model::BlipFill * mpBlipFill
BlipContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttribs, BlipFillProperties &rBlipProps, model::BlipFill *pBlipFill)
BlipFillProperties & mrBlipProps
Context handler that imports the a:extLst element inside a:blip and its children a:ext,...
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
virtual ~BlipExtensionContext() override
BlipFillProperties & mrBlipProps
BlipExtensionContext(::oox::core::ContextHandler2Helper const &rParent, BlipFillProperties &rBlipProps)
Context handler that imports the a:blipFill element.
model::BlipFill * mpBlipFill
BlipFillContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttribs, BlipFillProperties &rBlipProps, model::BlipFill *pBlipFill)
BlipFillProperties & mrBlipProps
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
Context handler that imports the a:clrChange element containing the colors of a bitmap color change t...
BlipFillProperties & mrBlipProps
ColorChangeContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttribs, BlipFillProperties &rBlipProps, model::BlipFill *pBlipFill)
virtual ~ColorChangeContext() override
model::BlipFill * mpBlipFill
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
Context handler for elements that contain a color value element (a:scrgbClr, a:srgbClr,...
Context handler for the different color value elements (a:scrgbClr, a:srgbClr, a:hslClr,...
void setUnused()
Sets the color to unused state.
void clearTransparence()
Removes transparence from the color.
Context handler that imports the a:duotone element containing the colors of a bitmap duotone transfor...
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
DuotoneContext(::oox::core::ContextHandler2Helper const &rParent, BlipFillProperties &rBlipProps)
BlipFillProperties & mrBlipProps
virtual ~DuotoneContext() override
Context handler for elements that contain a fill property element (a:noFill, a:solidFill,...
model::FillStyle maFillStyle
FillProperties & mrFillProps
::oox::core::ContextHandlerRef createFillContext(::oox::core::ContextHandler2Helper const &rParent, sal_Int32 nElement, const ::oox::AttributeList &rAttribs, FillProperties &rFillProps, model::FillStyle *pFillStyle)
FillPropertiesContext(::oox::core::ContextHandler2Helper const &rParent, FillProperties &rFillProps)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
Context handler that imports the a:gradFill element.
GradientFillContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttribs, GradientFillProperties &rGradientProps, model::GradientFill *pGradientFill)
model::GradientFill * mpGradientFill
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
GradientFillProperties & mrGradientProps
Context handler that imports the a:pattFill element.
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
PatternFillContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttribs, PatternFillProperties &rPatternProps, model::PatternFill *pPatternFill)
model::PatternFill * mpPatternFill
PatternFillProperties & mrPatternProps
virtual ~SimpleFillPropertiesContext() override
SimpleFillPropertiesContext(::oox::core::ContextHandler2Helper const &rParent, Color &rColor)
Context handler that imports the a:solidFill element.
SolidFillContext(::oox::core::ContextHandler2Helper const &rParent, FillProperties &rFillProps, model::SolidFill *pSolidFill)
::rtl::Reference< ContextHandler > ContextHandlerRef
model::RectangleAlignment convertToRectangleAlignment(sal_Int32 nToken)
IntegerRectangle2D GetRelativeRect(const Reference< XFastAttributeList > &xAttribs)
converts the attributes from a CT_RelativeRect to an IntegerRectangle2D
void fillRelativeRectangle(model::RelativeRectangle &rRelativeRectangle, const Reference< XFastAttributeList > &xAttribs)
void fillRect(const ::cppcanvas::CanvasSharedPtr &rCanvas, const ::basegfx::B2DRectangle &rRect, ::cppcanvas::IntSRGBA aFillColor)
uno::Sequence< double > maFillColor
bool isEmpty() const
The original graphic as embedded object.
::oox::ole::OleObjectInfo mrOleObjectInfo
std::map< OUString, css::uno::Any > maAttribs
static OUString getEffectString(sal_Int32 nToken)
Translate effect tokens to strings.
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.
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.
Color getBestSolidColor() const
Tries to resolve current settings to a solid color, e.g.
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
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
Color maPattBgColor
Pattern foreground color.
std::optional< sal_Int32 > moPattPreset
Pattern background color.
StreamDataSequence maEmbeddedData
Data of an embedded OLE object.