12#include <oox/token/namespaces.hxx>
13#include <oox/token/properties.hxx>
14#include <oox/token/tokens.hxx>
20#include <unordered_map>
22#include <frozen/bits/defines.h>
23#include <frozen/bits/elsa_std.h>
24#include <frozen/unordered_map.h>
33 pFS->singleElementNS(XML_a, nToken, XML_l, OString::number(rRelativeRectangle.
mnLeft), XML_t,
34 OString::number(rRelativeRectangle.
mnTop), XML_r,
35 OString::number(rRelativeRectangle.
mnRight), XML_b,
36 OString::number(rRelativeRectangle.
mnBottom));
42 : mpFilterBase(pFilterBase)
43 , meDocumentType(eDocumentType)
50 rPath,
"application/vnd.openxmlformats-officedocument.theme+xml");
52 OUString aThemeName = rTheme.
GetName();
54 mpFS->startElementNS(XML_a, XML_theme,
FSNS(XML_xmlns, XML_a),
58 mpFS->startElementNS(XML_a, XML_themeElements);
62 mpFS->startElementNS(XML_a, XML_clrScheme, XML_name, pColorSet->getName());
64 mpFS->endElementNS(XML_a, XML_clrScheme);
67 mpFS->startElementNS(XML_a, XML_fontScheme, XML_name, rFontScheme.
getName());
69 mpFS->endElementNS(XML_a, XML_fontScheme);
72 mpFS->startElementNS(XML_a, XML_fmtScheme);
74 mpFS->endElementNS(XML_a, XML_fmtScheme);
76 mpFS->endElementNS(XML_a, XML_themeElements);
77 mpFS->endElementNS(XML_a, XML_theme);
89 pAttrList->add(XML_typeface,
"");
93 pAttrList->add(XML_typeface, rThemeFont.
maTypeface);
96 pAttrList->add(XML_panose, rThemeFont.
maPanose);
98 pAttrList->add(XML_pitchFamily, OString::number(rThemeFont.
getPitchFamily()));
99 pAttrList->add(XML_charset, OString::number(rThemeFont.
maCharset));
106 mpFS->startElementNS(XML_a, XML_majorFont);
111 mpFS->singleElementNS(XML_a, XML_latin, aAttrList);
116 mpFS->singleElementNS(XML_a, XML_ea, aAttrList);
121 mpFS->singleElementNS(XML_a, XML_cs, aAttrList);
124 mpFS->endElementNS(XML_a, XML_majorFont);
126 mpFS->startElementNS(XML_a, XML_minorFont);
131 mpFS->singleElementNS(XML_a, XML_latin, aAttrList);
136 mpFS->singleElementNS(XML_a, XML_ea, aAttrList);
141 mpFS->singleElementNS(XML_a, XML_cs, aAttrList);
144 mpFS->endElementNS(XML_a, XML_minorFont);
151constexpr frozen::unordered_map<model::TransformationType, sal_Int32, 4> constTransformTypeTokenMap{
158constexpr frozen::unordered_map<model::ThemeColorType, const char*, 12> constThemeColorTypeTokenMap{
173constexpr frozen::unordered_map<model::SystemColorType, const char*, 30>
174 constSystemColorTypeTokenMap{
207constexpr frozen::unordered_map<sal_Int32, model::ThemeColorType, 12> constTokenMap{
225 std::vector<model::Transformation>
const& rTransformations)
229 auto iterator = constTransformTypeTokenMap.find(rTransformation.meType);
230 if (iterator != constTransformTypeTokenMap.end())
232 sal_Int32
nToken = iterator->second;
234 OString::number(rTransformation.mnValue * 10));
242 mpFS->startElementNS(XML_a, XML_srgbClr, XML_val,
I32SHEX(sal_Int32(aColor)));
243 mpFS->endElementNS(XML_a, XML_srgbClr);
248 mpFS->startElementNS(XML_a, XML_scrgbClr, XML_r, OString::number(rComplexColor.
mnComponent1),
249 XML_g, OString::number(rComplexColor.
mnComponent2), XML_b,
252 mpFS->endElementNS(XML_a, XML_scrgbClr);
257 mpFS->startElementNS(XML_a, XML_hslClr, XML_hue, OString::number(rComplexColor.
mnComponent1),
258 XML_sat, OString::number(rComplexColor.
mnComponent2), XML_lum,
261 mpFS->endElementNS(XML_a, XML_hslClr);
266 auto iterator = constThemeColorTypeTokenMap.find(rComplexColor.
meSchemeType);
267 if (iterator != constThemeColorTypeTokenMap.end())
269 const char* sValue = iterator->second;
270 mpFS->startElementNS(XML_a, XML_schemeClr, XML_val, sValue);
272 mpFS->endElementNS(XML_a, XML_schemeClr);
278 auto iterator = constSystemColorTypeTokenMap.find(rComplexColor.
meSystemColorType);
279 if (iterator != constSystemColorTypeTokenMap.end())
281 const char* sValue = iterator->second;
282 mpFS->startElementNS(XML_a, XML_sysClr, XML_val, sValue);
285 mpFS->endElementNS(XML_a, XML_schemeClr);
291 mpFS->startElementNS(XML_a, XML_schemeClr, XML_val,
"phClr");
293 mpFS->endElementNS(XML_a, XML_schemeClr);
298 switch (rComplexColor.
meType)
327 mpFS->startElementNS(XML_a, XML_solidFill);
329 mpFS->endElementNS(XML_a, XML_solidFill);
334 mpFS->startElementNS(XML_a, XML_gradFill);
335 mpFS->startElementNS(XML_a, XML_gsLst);
338 mpFS->startElementNS(XML_a, XML_gs, XML_pos,
339 OString::number(sal_Int32(rStop.mfPosition * 100000.0)));
341 mpFS->endElementNS(XML_a, XML_gs);
343 mpFS->endElementNS(XML_a, XML_gsLst);
347 mpFS->singleElementNS(XML_a, XML_lin, XML_ang,
357 sPathType =
"circle";
369 if (!sPathType.isEmpty())
371 mpFS->startElementNS(XML_a, XML_path, XML_path, sPathType);
373 mpFS->endElementNS(XML_a, XML_path);
377 mpFS->endElementNS(XML_a, XML_gradFill);
386 sPresetType =
"pct5";
389 sPresetType =
"pct10";
392 sPresetType =
"pct20";
395 sPresetType =
"pct25";
398 sPresetType =
"pct30";
401 sPresetType =
"pct40";
404 sPresetType =
"pct50";
407 sPresetType =
"pct60";
410 sPresetType =
"pct70";
413 sPresetType =
"pct75";
416 sPresetType =
"pct80";
419 sPresetType =
"pct90";
422 sPresetType =
"horz";
425 sPresetType =
"vert";
428 sPresetType =
"ltHorz";
431 sPresetType =
"ltVert";
434 sPresetType =
"dkHorz";
437 sPresetType =
"dkVert";
440 sPresetType =
"narHorz";
443 sPresetType =
"narVert";
446 sPresetType =
"dashHorz";
449 sPresetType =
"dashVert";
452 sPresetType =
"cross";
455 sPresetType =
"dnDiag";
458 sPresetType =
"upDiag";
461 sPresetType =
"ltDnDiag";
464 sPresetType =
"ltUpDiag";
467 sPresetType =
"dkDnDiag";
470 sPresetType =
"dkUpDiag";
473 sPresetType =
"wdDnDiag";
476 sPresetType =
"wdUpDiag";
479 sPresetType =
"dashDnDiag";
482 sPresetType =
"dashUpDiag";
485 sPresetType =
"diagCross";
488 sPresetType =
"smCheck";
491 sPresetType =
"lgCheck";
494 sPresetType =
"smGrid";
497 sPresetType =
"lgGrid";
500 sPresetType =
"dotGrid";
503 sPresetType =
"smConfetti";
506 sPresetType =
"lgConfetti";
509 sPresetType =
"horzBrick";
512 sPresetType =
"diagBrick";
515 sPresetType =
"solidDmnd";
518 sPresetType =
"openDmnd";
521 sPresetType =
"dotDmnd";
524 sPresetType =
"plaid";
527 sPresetType =
"sphere";
530 sPresetType =
"weave";
533 sPresetType =
"divot";
536 sPresetType =
"shingle";
539 sPresetType =
"wave";
542 sPresetType =
"trellis";
545 sPresetType =
"zigZag";
551 if (!sPresetType.isEmpty())
553 mpFS->startElementNS(XML_a, XML_pattFill, XML_prst, sPresetType);
555 mpFS->startElementNS(XML_a, XML_fgClr);
557 mpFS->endElementNS(XML_a, XML_fgClr);
559 mpFS->startElementNS(XML_a, XML_bgClr);
561 mpFS->endElementNS(XML_a, XML_bgClr);
563 mpFS->endElementNS(XML_a, XML_pattFill);
625 mpFS->startElementNS(XML_a, XML_blipFill, XML_rotWithShape,
636 OString aAlignment = convertRectangleAlignment(rBlipFill.
meTileAlignment);
638 mpFS->startElementNS(XML_a, XML_tile, XML_tx, OString::number(rBlipFill.
mnTileOffsetX),
641 OString::number(rBlipFill.
mnTileScaleY), XML_flip, aFlipMode, XML_algn,
643 mpFS->endElementNS(XML_a, XML_tile);
647 mpFS->startElementNS(XML_a, XML_stretch);
649 mpFS->endElementNS(XML_a, XML_stretch);
652 mpFS->endElementNS(XML_a, XML_blipFill);
657 switch (rFillStyle.
mpFill->meType)
723 OString sCompoundLine;
727 sCompoundLine =
"sng";
730 sCompoundLine =
"dbl";
733 sCompoundLine =
"thickThin";
736 sCompoundLine =
"thinThick";
739 sCompoundLine =
"tri";
745 mpFS->startElementNS(XML_a, XML_ln, XML_w, OString::number(rLineStyle.
mnWidth), XML_cap,
759 sPresetType =
"dash";
762 sPresetType =
"lgDash";
765 sPresetType =
"dashDot";
768 sPresetType =
"lgDashDot";
771 sPresetType =
"lgDashDotDot";
774 sPresetType =
"solid";
777 sPresetType =
"sysDash";
780 sPresetType =
"sysDot";
783 sPresetType =
"sysDashDot";
786 sPresetType =
"sysDashDotDot";
791 mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, sPresetType);
799 mpFS->singleElementNS(XML_a, XML_round);
802 mpFS->singleElementNS(XML_a, XML_bevel);
807 mpFS->singleElementNS(
808 XML_a, XML_miter, XML_lim,
817 mpFS->endElementNS(XML_a, XML_ln);
822 mpFS->startElementNS(XML_a, XML_effectStyle);
823 mpFS->singleElementNS(XML_a, XML_effectLst);
824 mpFS->endElementNS(XML_a, XML_effectStyle);
833 mpFS->startElementNS(XML_a, XML_fillStyleLst);
838 mpFS->endElementNS(XML_a, XML_fillStyleLst);
842 mpFS->startElementNS(XML_a, XML_lnStyleLst);
847 mpFS->endElementNS(XML_a, XML_lnStyleLst);
851 mpFS->startElementNS(XML_a, XML_effectStyleLst);
858 mpFS->endElementNS(XML_a, XML_effectStyleLst);
862 mpFS->startElementNS(XML_a, XML_bgFillStyleLst);
867 mpFS->endElementNS(XML_a, XML_bgFillStyleLst);
874 static const constexpr std::array<sal_Int32, 12> constTokenArray
875 = { XML_dk1, XML_lt1, XML_dk2, XML_lt2, XML_accent1, XML_accent2,
876 XML_accent3, XML_accent4, XML_accent5, XML_accent6, XML_hlink, XML_folHlink };
882 for (
auto nToken : constTokenArray)
884 auto iterator = constTokenMap.find(
nToken);
885 if (iterator != constTokenMap.end())
888 Color aColor = pColorSet->getColor(eColorType);
890 mpFS->singleElementNS(XML_a, XML_srgbClr, XML_val,
I32SHEX(sal_Int32(aColor)));
css::uno::Reference< css::graphic::XGraphic > mxGraphic
std::vector< BlipEffect > maBlipEffects
RelativeRectangle maClipRectangle
RectangleAlignment meTileAlignment
RelativeRectangle maFillRectangle
ThemeColorType meSchemeType
std::vector< Transformation > maTransformations
SystemColorType meSystemColorType
Color getRGBColor() const
std::shared_ptr< Fill > mpFill
ThemeFont const & getMinorAsian() const
ThemeFont const & getMajorComplex() const
ThemeFont const & getMajorLatin() const
ThemeFont const & getMajorAsian() const
ThemeFont const & getMinorLatin() const
const OUString & getName() const
ThemeFont const & getMinorComplex() const
GradientType meGradientType
LinearGradientProperties maLinearGradient
RelativeRectangle maFillToRectangle
RelativeRectangle maTileRectangle
std::vector< GradientStop > maGradientStops
PenAlignmentType mePenAlignment
CompoundLineType meCompoundLineType
ComplexColor maBackgroundColor
PatternPreset mePatternPreset
ComplexColor maForegroundColor
std::shared_ptr< model::ColorSet > const & getColorSet() const
FontScheme const & getFontScheme() const
const OUString & GetName() const
FormatScheme const & getFormatScheme() const
void writeBlip(model::BlipFill const &rBlipFill)
void writeEffectStyle(model::EffectStyle const &rEffectStyle)
void writeFillStyle(model::FillStyle const &rFillStyle)
oox::core::XmlFilterBase * mpFilterBase
void writeColorCRGB(model::ComplexColor const &rComplexColor)
void writeLineStyle(model::LineStyle const &rLineStyle)
void writeSolidFill(model::SolidFill const &rSolidFill)
oox::drawingml::DocumentType meDocumentType
void writeColorHSL(model::ComplexColor const &rComplexColor)
void writePatternFill(model::PatternFill const &rPatternFill)
void writeBlipFill(model::BlipFill const &rBlipFill)
bool writeFontScheme(model::FontScheme const &rFontScheme)
void writeGradientFill(model::GradientFill const &rGradientFill)
bool writeFormatScheme(model::FormatScheme const &rFormatScheme)
bool writeColorSet(model::Theme const &rTheme)
void writeBackgroundFillStyle(model::FillStyle const &rFillStyle)
void writeComplexColor(model::ComplexColor const &rComplexColor)
void writeColorPlaceholder(model::ComplexColor const &rComplexColor)
void write(OUString const &rPath, model::Theme const &rTheme)
void writeColorSystem(model::ComplexColor const &rComplexColor)
sax_fastparser::FSHelperPtr mpFS
void writeColorRGB(model::ComplexColor const &rComplexColor)
void writeColorScheme(model::ComplexColor const &rComplexColor)
void writeColorTransformations(std::vector< model::Transformation > const &rTransformations)
ThemeExport(oox::core::XmlFilterBase *pFilterBase, oox::drawingml::DocumentType eDocumentType)
::sax_fastparser::FSHelperPtr openFragmentStreamWithSerializer(const OUString &rStreamName, const OUString &rMediaType)
Opens specified output stream from the base storage with specified media type and returns new fast se...
OUString getNamespaceURL(sal_Int32 nNSID) const
OUString writeBlip(Graphic const &rGraphic, std::vector< model::BlipEffect > const &rEffects, bool bRelPathToMedia=false)
static rtl::Reference< FastAttributeList > createAttrList()
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
@ GradientInactiveCaption
const char * UseIf(const char *s, bool bUse)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
PresetDashType mePresetType
sal_Int16 getPitchFamily() const
OString I32SHEX(sal_Int32 x)