LibreOffice Module oox (master) 1
misccontexts.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
26#include <oox/token/namespaces.hxx>
27#include <oox/token/tokens.hxx>
29#include <vcl/graph.hxx>
30#include <unordered_map>
31#include <frozen/bits/defines.h>
32#include <frozen/bits/elsa_std.h>
33#include <frozen/unordered_map.h>
34
35using namespace ::com::sun::star;
36using namespace ::com::sun::star::uno;
37using namespace ::com::sun::star::xml::sax;
38using ::oox::core::ContextHandler2;
40
41namespace oox::drawingml {
42
43SolidFillContext::SolidFillContext(ContextHandler2Helper const & rParent, FillProperties& rFillProps, model::SolidFill* pSolidFill)
44 : ColorContext(rParent, rFillProps.maFillColor, pSolidFill ? &pSolidFill->maColor : nullptr)
45{
46}
47
49{}
50
51GradientFillContext::GradientFillContext(ContextHandler2Helper const & rParent,
52 const AttributeList& rAttribs, GradientFillProperties& rGradientProps, model::GradientFill* pGradientFill)
53 : ContextHandler2(rParent)
54 , mpGradientFill(pGradientFill)
55 , mrGradientProps(rGradientProps)
56{
57 auto oRotateWithShape = rAttribs.getBool(XML_rotWithShape);
58 mrGradientProps.moShadeFlip = rAttribs.getToken( XML_flip );
59 mrGradientProps.moRotateWithShape = oRotateWithShape;
60 if (mpGradientFill && oRotateWithShape)
61 mpGradientFill->mbRotateWithShape = *oRotateWithShape;
62}
63
65 sal_Int32 nElement, const AttributeList& rAttribs )
66{
67 switch( nElement )
68 {
69 case A_TOKEN( gsLst ):
70 return this; // for gs elements
71
72 case A_TOKEN( gs ):
73 if (rAttribs.hasAttribute(XML_pos))
74 {
75 double fPosition = getLimitedValue<double>(rAttribs.getDouble(XML_pos, 0.0) / 100000.0, 0.0, 1.0);
76 auto aElement = mrGradientProps.maGradientStops.emplace(fPosition, Color());
77
78 model::ComplexColor* pComplexColor = nullptr;
80 {
81 model::GradientStop& rStop = mpGradientFill->maGradientStops.emplace_back();
82 rStop.mfPosition = fPosition;
83 pComplexColor = &rStop.maColor;
84 }
85
86 return new ColorContext(*this, aElement->second, pComplexColor);
87 }
88 break;
89
90 case A_TOKEN( lin ):
91 {
92 mrGradientProps.moShadeAngle = rAttribs.getInteger(XML_ang);
93 mrGradientProps.moShadeScaled = rAttribs.getBool(XML_scaled);
94
96 {
98 mpGradientFill->maLinearGradient.mnAngle = rAttribs.getInteger(XML_ang, 0);
99 mpGradientFill->maLinearGradient.mbScaled = rAttribs.getBool(XML_scaled, false);
100 }
101 }
102 break;
103
104 case A_TOKEN( path ):
105 {
106 // always set a path type, this disables linear gradient in conversion
107 sal_Int32 nToken = rAttribs.getToken(XML_path, XML_rect);
109 if (mpGradientFill)
110 {
111 switch (nToken)
112 {
113 case XML_rect:
115 break;
116 case XML_circle:
118 break;
119 case XML_shape:
121 break;
122 default:
123 break;
124 }
125 }
126 return this; // for fillToRect element
127 }
128 case A_TOKEN( fillToRect ):
129 {
131 if (mpGradientFill)
133 }
134 break;
135
136 case A_TOKEN( tileRect ):
138 if (mpGradientFill)
140 break;
141 }
142 return nullptr;
143}
144
145
146namespace
147{
148
149constexpr frozen::unordered_map<sal_Int32, model::PatternPreset, 54> constPatternPresetMap
150{
164 { XML_vert, model::PatternPreset::Vertical },
172 { XML_dashVert, model::PatternPreset::DashedVertical },
173 { XML_cross, model::PatternPreset::Cross },
184 { XML_diagCross, model::PatternPreset::DiagonalCross },
187 { XML_smGrid, model::PatternPreset::SmallGrid },
188 { XML_lgGrid, model::PatternPreset::LargeGrid },
189 { XML_dotGrid, model::PatternPreset::DottedGrid },
190 { XML_smConfetti, model::PatternPreset::SmallConfetti },
191 { XML_lgConfetti, model::PatternPreset::LargeConfetti },
192 { XML_horzBrick, model::PatternPreset::HorizontalBrick },
193 { XML_diagBrick, model::PatternPreset::DiagonalBrick },
194 { XML_solidDmnd, model::PatternPreset::SolidDiamond },
195 { XML_openDmnd, model::PatternPreset::OpenDiamond },
197 { XML_plaid, model::PatternPreset::Plaid },
198 { XML_sphere, model::PatternPreset::Sphere },
199 { XML_weave, model::PatternPreset::Weave },
200 { XML_divot, model::PatternPreset::Divot },
201 { XML_shingle, model::PatternPreset::Shingle },
202 { XML_wave, model::PatternPreset::Wave },
203 { XML_trellis, model::PatternPreset::Trellis },
204 { XML_zigZag, model::PatternPreset::ZigZag }
205};
206
207} // end anonymous namespace
208PatternFillContext::PatternFillContext(ContextHandler2Helper const & rParent,
209 const AttributeList& rAttribs, PatternFillProperties& rPatternProps, model::PatternFill* pPatternFill)
210 : ContextHandler2(rParent)
211 , mpPatternFill(pPatternFill)
212 , mrPatternProps(rPatternProps)
213{
214 mrPatternProps.moPattPreset = rAttribs.getToken(XML_prst);
215
216 if (mpPatternFill)
217 {
218 sal_Int32 nToken = rAttribs.getToken(XML_prst, XML_TOKEN_INVALID);
219
220 auto aIterator = constPatternPresetMap.find(nToken);
221 if (aIterator != constPatternPresetMap.end())
222 {
223 auto const& aPair = *aIterator;
224 model::PatternPreset ePatternPreset = aPair.second;
225 mpPatternFill->mePatternPreset = ePatternPreset;
226 }
227 }
228}
229
231 sal_Int32 nElement, const AttributeList& )
232{
233 model::ComplexColor* pComplexColor = nullptr;
234 switch( nElement )
235 {
236 case A_TOKEN( bgClr ):
237 if (mpPatternFill)
238 pComplexColor = &mpPatternFill->maBackgroundColor;
239 return new ColorContext(*this, mrPatternProps.maPattBgColor, pComplexColor);
240 case A_TOKEN( fgClr ):
241 if (mpPatternFill)
242 pComplexColor = &mpPatternFill->maForegroundColor;
243 return new ColorContext(*this, mrPatternProps.maPattFgColor, pComplexColor);
244 }
245 return nullptr;
246}
247
248ColorChangeContext::ColorChangeContext( ContextHandler2Helper const & rParent,
249 const AttributeList& rAttribs, BlipFillProperties& rBlipProps, model::BlipFill* pBlipFill)
250 : ContextHandler2(rParent)
251 , mpBlipFill(pBlipFill)
252 , mrBlipProps(rBlipProps)
253{
256 mbUseAlpha = rAttribs.getBool( XML_useA, true );
257 if (mpBlipFill)
258 {
259 auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
260 rEffect.meType = model::BlipEffectType::ColorChange;
261 rEffect.mbUseAlpha = mbUseAlpha;
262 }
263}
264
266{
267 if( !mbUseAlpha )
269}
270
272 sal_Int32 nElement, const AttributeList& )
273{
274 model::ComplexColor* pComplexColor = nullptr;
275 switch (nElement)
276 {
277 case A_TOKEN(clrFrom):
278 if (mpBlipFill)
279 {
280 auto& rEffect = mpBlipFill->maBlipEffects.back();
281 pComplexColor = &rEffect.getColorFrom();
282 }
283 return new ColorContext(*this, mrBlipProps.maColorChangeFrom, pComplexColor);
284 case A_TOKEN(clrTo):
285 if (mpBlipFill)
286 {
287 auto& rEffect = mpBlipFill->maBlipEffects.back();
288 pComplexColor = &rEffect.getColorTo();
289 }
290 return new ColorContext(*this, mrBlipProps.maColorChangeTo, pComplexColor);
291 }
292 return nullptr;
293}
294
295BlipContext::BlipContext(ContextHandler2Helper const & rParent, const AttributeList& rAttribs,
296 BlipFillProperties& rBlipProps, model::BlipFill* pBlipFill)
297 : ContextHandler2(rParent)
298 , mpBlipFill(pBlipFill)
299 , mrBlipProps(rBlipProps)
300{
301 if( rAttribs.hasAttribute( R_TOKEN( embed ) ) )
302 {
303 // internal picture URL
304 OUString aFragmentPath = getFragmentPathFromRelId( rAttribs.getStringDefaulted( R_TOKEN( embed )) );
305 if (!aFragmentPath.isEmpty())
306 {
307 auto xGraphic = getFilter().getGraphicHelper().importEmbeddedGraphic(aFragmentPath);
308 mrBlipProps.mxFillGraphic = xGraphic;
309 if (mpBlipFill)
310 mpBlipFill->mxGraphic = xGraphic;
311 }
312 }
313 else if( rAttribs.hasAttribute( R_TOKEN( link ) ) )
314 {
315 // external URL
316
317 // we will embed this link, this is better than just doing nothing...
318 // TODO: import this graphic as real link, but this requires some
319 // code rework.
320 OUString aRelId = rAttribs.getStringDefaulted( R_TOKEN( link ));
321 OUString aTargetLink = getFilter().getAbsoluteUrl( getRelations().getExternalTargetFromRelId( aRelId ) );
322 GraphicExternalLink aLink(aTargetLink);
323 Graphic aGraphic(aLink);
324 auto xGraphic = aGraphic.GetXGraphic();
325 mrBlipProps.mxFillGraphic = xGraphic;
326 if (mpBlipFill)
327 mpBlipFill->mxGraphic = xGraphic;
328 }
329}
330
332 sal_Int32 nElement, const AttributeList& rAttribs )
333{
334 switch( nElement )
335 {
336 case A_TOKEN( biLevel ):
337 {
338 sal_Int32 nTreshold = rAttribs.getInteger(XML_thresh, 0);
339
341 mrBlipProps.moColorEffect = getBaseToken(nElement);
342
343 if (mpBlipFill)
344 {
345 auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
346 rEffect.meType = model::BlipEffectType::BiLevel;
347 rEffect.mnThreshold = nTreshold;
348 }
349 }
350 break;
351
352 case A_TOKEN( grayscl ):
353 {
354 mrBlipProps.moColorEffect = getBaseToken( nElement );
355 if (mpBlipFill)
356 {
357 auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
358 rEffect.meType = model::BlipEffectType::Grayscale;
359 }
360 }
361 break;
362
363 case A_TOKEN( clrChange ):
364 {
365 return new ColorChangeContext(*this, rAttribs, mrBlipProps, mpBlipFill);
366 }
367 break;
368 case A_TOKEN( duotone ):
369 return new DuotoneContext( *this, mrBlipProps );
370
371 case A_TOKEN( extLst ):
372 return new BlipExtensionContext( *this, mrBlipProps );
373
374 case A_TOKEN( lum ):
375 {
376 mrBlipProps.moBrightness = rAttribs.getInteger( XML_bright );
377 mrBlipProps.moContrast = rAttribs.getInteger( XML_contrast );
378
379 if (mpBlipFill)
380 {
381 auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
382 rEffect.meType = model::BlipEffectType::Luminance;
383 rEffect.mnBrightness = rAttribs.getInteger(XML_bright, 0);
384 rEffect.mnContrast = rAttribs.getInteger(XML_contrast, 0);
385 }
386 }
387 break;
388 case A_TOKEN( alphaModFix ):
389 {
390 mrBlipProps.moAlphaModFix = rAttribs.getInteger(XML_amt);
391 if (mpBlipFill)
392 {
393 auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
395 rEffect.mnAmount = rAttribs.getInteger(XML_amt, 100 * 1000);
396 }
397 }
398 break;
399 }
400 return nullptr;
401}
402
403DuotoneContext::DuotoneContext( ContextHandler2Helper const & rParent,
404 BlipFillProperties& rBlipProps ) :
405 ContextHandler2( rParent ),
406 mrBlipProps( rBlipProps ),
407 mnColorIndex( 0 )
408{
411}
412
414{
415}
416
418 sal_Int32 /*nElement*/, const AttributeList& /*rAttribs*/ )
419{
420 if( mnColorIndex < 2 )
421 return new ColorValueContext(*this, mrBlipProps.maDuotoneColors[mnColorIndex++], nullptr);
422 return nullptr;
423}
424
425BlipFillContext::BlipFillContext(ContextHandler2Helper const & rParent, const AttributeList& rAttribs,
426 BlipFillProperties& rBlipProps, model::BlipFill* pBlipFill)
427 : ContextHandler2( rParent )
428 , mpBlipFill(pBlipFill)
429 , mrBlipProps(rBlipProps)
430{
431 mrBlipProps.moRotateWithShape = rAttribs.getBool( XML_rotWithShape );
432 if (mpBlipFill)
433 mpBlipFill->mbRotateWithShape = rAttribs.getBool(XML_rotWithShape, false);
434}
435
437 sal_Int32 nElement, const AttributeList& rAttribs )
438{
439 switch( nElement )
440 {
441 case A_TOKEN( blip ):
442 return new BlipContext(*this, rAttribs, mrBlipProps, mpBlipFill);
443
444 case A_TOKEN( srcRect ):
445 {
447
448 if (mpBlipFill)
450 }
451 break;
452
453 case A_TOKEN( tile ):
454 {
455 mrBlipProps.moBitmapMode = getBaseToken( nElement );
456 mrBlipProps.moTileOffsetX = rAttribs.getInteger( XML_tx );
457 mrBlipProps.moTileOffsetY = rAttribs.getInteger( XML_ty );
458 mrBlipProps.moTileScaleX = rAttribs.getInteger( XML_sx );
459 mrBlipProps.moTileScaleY = rAttribs.getInteger( XML_sy );
460 mrBlipProps.moTileAlign = rAttribs.getToken( XML_algn );
461 mrBlipProps.moTileFlip = rAttribs.getToken( XML_flip );
462
463 if (mpBlipFill)
464 {
466 mpBlipFill->mnTileOffsetX = rAttribs.getInteger(XML_tx, 0);
467 mpBlipFill->mnTileOffsetY = rAttribs.getInteger(XML_ty, 0);
468 mpBlipFill->mnTileScaleX = rAttribs.getInteger(XML_sx, 0);
469 mpBlipFill->mnTileScaleY = rAttribs.getInteger(XML_sy, 0);
470
471 switch (rAttribs.getToken(XML_flip, XML_none))
472 {
473 case XML_x: mpBlipFill->meTileFlipMode = model::FlipMode::X; break;
474 case XML_y: mpBlipFill->meTileFlipMode = model::FlipMode::Y; break;
475 case XML_xy: mpBlipFill->meTileFlipMode = model::FlipMode::XY; break;
476 default:
478 }
480 }
481 }
482 break;
483
484 case A_TOKEN( stretch ):
485 {
486 mrBlipProps.moBitmapMode = getBaseToken( nElement );
487 if (mpBlipFill)
488 {
490 }
491 return this; // for fillRect element
492 }
493 break;
494
495 case A_TOKEN( fillRect ):
496 {
498
499 if (mpBlipFill)
501 }
502 break;
503 }
504 return nullptr;
505}
506
507FillPropertiesContext::FillPropertiesContext( ContextHandler2Helper const & rParent, FillProperties& rFillProps ) :
508 ContextHandler2( rParent ),
509 mrFillProps( rFillProps )
510{
511}
512
514 sal_Int32 nElement, const AttributeList& rAttribs )
515{
516 return createFillContext(*this, nElement, rAttribs, mrFillProps, &maFillStyle);
517}
518
520 ContextHandler2Helper const & rParent, sal_Int32 nElement,
521 const AttributeList& rAttribs, FillProperties& rFillProps,
522 model::FillStyle* pFillStyle)
523{
524 switch( nElement )
525 {
526 case A_TOKEN( noFill ):
527 {
528 rFillProps.moFillType = getBaseToken(nElement);
529 if (pFillStyle)
530 {
531 pFillStyle->mpFill = std::make_shared<model::NoFill>();
532 }
533 return nullptr;
534 }
535 case A_TOKEN( solidFill ):
536 {
537 rFillProps.moFillType = getBaseToken(nElement);
538 model::SolidFill* pSolidFill = nullptr;
539 if (pFillStyle)
540 {
541 pFillStyle->mpFill = std::make_shared<model::SolidFill>();
542 pSolidFill = static_cast<model::SolidFill*>(pFillStyle->mpFill.get());
543 }
544 return new SolidFillContext(rParent, rFillProps, pSolidFill);
545 }
546 case A_TOKEN( gradFill ):
547 {
548 rFillProps.moFillType = getBaseToken(nElement);
549 model::GradientFill* pGradientFill = nullptr;
550 if (pFillStyle)
551 {
552 pFillStyle->mpFill = std::make_shared<model::GradientFill>();
553 pGradientFill = static_cast<model::GradientFill*>(pFillStyle->mpFill.get());
554 }
555 return new GradientFillContext(rParent, rAttribs, rFillProps.maGradientProps, pGradientFill);
556 }
557 case A_TOKEN( pattFill ):
558 {
559 rFillProps.moFillType = getBaseToken( nElement );
560 model::PatternFill* pPatternFill = nullptr;
561 if (pFillStyle)
562 {
563 auto pFill = std::make_shared<model::PatternFill>();
564 pPatternFill = pFill.get();
565 pFillStyle->mpFill = pFill;
566 }
567 return new PatternFillContext(rParent, rAttribs, rFillProps.maPatternProps, pPatternFill);
568 }
569 case A_TOKEN( blipFill ):
570 {
571 rFillProps.moFillType = getBaseToken( nElement );
572 model::BlipFill* pBlipFill = nullptr;
573 if (pFillStyle)
574 {
575 pFillStyle->mpFill = std::make_unique<model::BlipFill>();
576 pBlipFill = static_cast<model::BlipFill*>(pFillStyle->mpFill.get());
577 }
578 return new BlipFillContext( rParent, rAttribs, rFillProps.maBlipProps, pBlipFill);
579 }
580 case A_TOKEN( grpFill ):
581 {
582 // TODO
583 rFillProps.moFillType = getBaseToken( nElement );
584 return nullptr;
585 };
586 }
587 return nullptr;
588}
589
590SimpleFillPropertiesContext::SimpleFillPropertiesContext( ContextHandler2Helper const & rParent, Color& rColor ) :
591 FillPropertiesContext( rParent, *this ),
592 mrColor( rColor )
593{
594}
595
597{
599}
600
601BlipExtensionContext::BlipExtensionContext( ContextHandler2Helper const & rParent, BlipFillProperties& rBlipProps ) :
602 ContextHandler2( rParent ),
603 mrBlipProps( rBlipProps )
604{
605}
606
608{
609}
610
612 sal_Int32 nElement, const AttributeList& )
613{
614 switch( nElement )
615 {
616 case A_TOKEN( ext ):
617 return new BlipExtensionContext( *this, mrBlipProps );
618
619 case OOX_TOKEN( a14, imgProps ):
620 return new ArtisticEffectContext( *this, mrBlipProps.maEffect );
621 }
622 return nullptr;
623}
624
625ArtisticEffectContext::ArtisticEffectContext( ContextHandler2Helper const & rParent, ArtisticEffectProperties& rEffect ) :
626 ContextHandler2( rParent ),
627 maEffect( rEffect )
628{
629}
630
632{
633}
634
636 sal_Int32 nElement, const AttributeList& rAttribs )
637{
638 // containers
639 if( nElement == OOX_TOKEN( a14, imgLayer ) )
640 {
641 if( rAttribs.hasAttribute( R_TOKEN( embed ) ) )
642 {
643 OUString aFragmentPath = getFragmentPathFromRelId( rAttribs.getStringDefaulted( R_TOKEN( embed )) );
644 if( !aFragmentPath.isEmpty() )
645 {
647 maEffect.mrOleObjectInfo.maProgId = aFragmentPath;
648 }
649 }
650 return new ArtisticEffectContext( *this, maEffect );
651 }
652 if( nElement == OOX_TOKEN( a14, imgEffect ) )
653 return new ArtisticEffectContext( *this, maEffect );
654
655 // effects
657 if( maEffect.isEmpty() )
658 return nullptr;
659
660 // effect attributes
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
666 };
667 for(sal_Int32 nAttrib : aAttribs)
668 {
669 if( rAttribs.hasAttribute( nAttrib ) )
670 {
672 if( !sName.isEmpty() )
673 maEffect.maAttribs[sName] <<= rAttribs.getInteger( nAttrib, 0 );
674 }
675 }
676
677 return nullptr;
678}
679
680} // namespace oox::drawingml
681
682/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
basegfx::BColor maColor
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
sal_Int32 mnTileOffsetX
css::uno::Reference< css::graphic::XGraphic > mxGraphic
sal_Int32 mnTileOffsetY
std::vector< BlipEffect > maBlipEffects
RelativeRectangle maClipRectangle
BitmapMode meMode
RectangleAlignment meTileAlignment
sal_Int32 mnTileScaleY
RelativeRectangle maFillRectangle
FlipMode meTileFlipMode
sal_Int32 mnTileScaleX
std::shared_ptr< Fill > mpFill
GradientType meGradientType
LinearGradientProperties maLinearGradient
RelativeRectangle maFillToRectangle
RelativeRectangle maTileRectangle
std::vector< GradientStop > maGradientStops
ComplexColor maColor
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.
Definition: filterbase.cxx:382
OUString getAbsoluteUrl(const OUString &rUrl) const
Returns an absolute URL for the passed relative or absolute URL.
Definition: filterbase.cxx:268
GraphicHelper & getGraphicHelper() const
Returns a helper for the handling of graphics and graphic objects.
Definition: filterbase.cxx:346
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
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
BlipExtensionContext(::oox::core::ContextHandler2Helper const &rParent, BlipFillProperties &rBlipProps)
Context handler that imports the a:blipFill element.
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...
ColorChangeContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttribs, BlipFillProperties &rBlipProps, model::BlipFill *pBlipFill)
virtual ~ColorChangeContext() override
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.
Definition: color.cxx:329
void clearTransparence()
Removes transparence from the color.
Definition: color.cxx:566
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,...
::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
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)
OString sName
Definition: drawingml.cxx:4451
::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)
XML_none
XML_TOKEN_INVALID
uno::Sequence< double > maFillColor
DefTokenId nToken
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.
Color maPattBgColor
Pattern foreground color.
std::optional< sal_Int32 > moPattPreset
Pattern background color.
StreamDataSequence maEmbeddedData
Data of an embedded OLE object.