1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
11 #include <sal/config.h>
13 #include <string_view>
15 #include <libxml/xmlwriter.h>
17 #include <com/sun/star/beans/XPropertySet.hpp>
18 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
19 #include <com/sun/star/drawing/Direction3D.hpp>
20 #include <com/sun/star/drawing/ShadeMode.hpp>
21 #include <com/sun/star/drawing/ProjectionMode.hpp>
22 #include <com/sun/star/drawing/Position3D.hpp>
24 #include <com/sun/star/awt/Rectangle.hpp>
25 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
26 #include <com/sun/star/beans/PropertyValue.hpp>
27 #include <com/sun/star/beans/PropertyValues.hpp>
28 #include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
30 #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
31 #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
32 #include <com/sun/star/awt/Size.hpp>
34 #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
36 class EnhancedShapeDumper
39 explicit EnhancedShapeDumper(xmlTextWriterPtr writer
)
44 // auxiliary functions
45 void dumpEnhancedCustomShapeParameterPair(
46 const css::drawing::EnhancedCustomShapeParameterPair
& aParameterPair
);
47 void dumpDirection3D(css::drawing::Direction3D aDirection3D
);
48 void dumpPropertyValueAsElement(const css::beans::PropertyValue
& aPropertyValue
);
50 dumpEnhancedCustomShapeParameter(const css::drawing::EnhancedCustomShapeParameter
& aParameter
);
52 // EnhancedCustomShapeExtrusion.idl
53 void dumpEnhancedCustomShapeExtrusionService(const css::uno::Reference
< css::beans::XPropertySet
>& xPropSet
);
54 void dumpExtrusionAsAttribute(bool bExtrusion
);
55 void dumpBrightnessAsAttribute(double aBrightness
);
56 void dumpDepthAsElement(const css::drawing::EnhancedCustomShapeParameterPair
& aDepth
);
57 void dumpDiffusionAsAttribute(double aDiffusion
);
58 void dumpNumberOfLineSegmentsAsAttribute(sal_Int32 aNumberOfLineSegments
);
59 void dumpLightFaceAsAttribute(bool bLightFace
);
60 void dumpFirstLightHarshAsAttribute(bool bFirstLightHarsh
);
61 void dumpSecondLightHarshAsAttribute(bool bSecondLightHarsh
);
62 void dumpFirstLightLevelAsAttribute(double aFirstLightLevel
);
63 void dumpSecondLightLevelAsAttribute(double aSecondLightLevel
);
64 void dumpFirstLightDirectionAsElement(css::drawing::Direction3D aFirstLightDirection
);
65 void dumpSecondLightDirectionAsElement(css::drawing::Direction3D aSecondLightDirection
);
66 void dumpMetalAsAttribute(bool bMetal
);
67 void dumpShadeModeAsAttribute(css::drawing::ShadeMode eShadeMode
);
68 void dumpRotateAngleAsElement(const css::drawing::EnhancedCustomShapeParameterPair
& aRotateAngle
);
69 void dumpRotationCenterAsElement(css::drawing::Direction3D aRotationCenter
);
70 void dumpShininessAsAttribute(double aShininess
);
71 void dumpSkewAsElement(const css::drawing::EnhancedCustomShapeParameterPair
& aSkew
);
72 void dumpSpecularityAsAttribute(double aSpecularity
);
73 void dumpProjectionModeAsAttribute(css::drawing::ProjectionMode eProjectionMode
);
74 void dumpViewPointAsElement(css::drawing::Position3D aViewPoint
);
75 void dumpOriginAsElement(const css::drawing::EnhancedCustomShapeParameterPair
& aOrigin
);
76 void dumpExtrusionColorAsAttribute(bool bExtrusionColor
);
78 // EnhancedCustomShapeGeometry.idl
79 void dumpEnhancedCustomShapeGeometryService(const css::uno::Reference
< css::beans::XPropertySet
>& xPropSet
);
80 void dumpTypeAsAttribute(std::u16string_view sType
);
81 void dumpViewBoxAsElement(css::awt::Rectangle aViewBox
);
82 void dumpMirroredXAsAttribute(bool bMirroredX
); // also used in EnhancedCustomShapeHandle
83 void dumpMirroredYAsAttribute(bool bMirroredY
); // also used in EnhancedCustomShapeHandle
84 void dumpTextRotateAngleAsAttribute(double aTextRotateAngle
);
85 void dumpAdjustmentValuesAsElement(const css::uno::Sequence
< css::drawing::EnhancedCustomShapeAdjustmentValue
>& aAdjustmentValues
);
86 void dumpExtrusionAsElement(const css::uno::Sequence
< css::beans::PropertyValue
>& aExtrusion
);
87 void dumpPathAsElement(const css::uno::Sequence
< css::beans::PropertyValue
>& aPath
);
88 void dumpTextPathAsElement(const css::uno::Sequence
< css::beans::PropertyValue
>& aTextPath
);
89 void dumpEquationsAsElement(const css::uno::Sequence
< OUString
>& aEquations
);
90 void dumpHandlesAsElement(const css::uno::Sequence
< css::beans::PropertyValues
>& aHandles
);
92 // EnhancedCustomShapeHandle.idl
93 void dumpEnhancedCustomShapeHandleService(const css::uno::Reference
< css::beans::XPropertySet
>& xPropSet
);
94 void dumpSwitchedAsAttribute(bool bSwitched
);
95 void dumpPositionAsElement(const css::drawing::EnhancedCustomShapeParameterPair
& aPosition
);
96 void dumpPolarAsElement(const css::drawing::EnhancedCustomShapeParameterPair
& aPolar
);
97 void dumpRefXAsAttribute(sal_Int32 aRefX
);
98 void dumpRefYAsAttribute(sal_Int32 aRefY
);
99 void dumpRefAngleAsAttribute(sal_Int32 aRefAngle
);
100 void dumpRefRAsAttribute(sal_Int32 aRefR
);
101 void dumpRangeXMinimumAsElement(const css::drawing::EnhancedCustomShapeParameter
& aRangeXMinimum
);
102 void dumpRangeXMaximumAsElement(const css::drawing::EnhancedCustomShapeParameter
& aRangeXMaximum
);
103 void dumpRangeYMinimumAsElement(const css::drawing::EnhancedCustomShapeParameter
& aRangeYMinimum
);
104 void dumpRangeYMaximumAsElement(const css::drawing::EnhancedCustomShapeParameter
& aRangeXMaximum
);
105 void dumpRadiusRangeMinimumAsElement(const css::drawing::EnhancedCustomShapeParameter
& aRadiusRangeMinimum
);
106 void dumpRadiusRangeMaximumAsElement(const css::drawing::EnhancedCustomShapeParameter
& aRadiusRangeMaximum
);
108 // EnhancedCustomShapePath.idl
109 void dumpEnhancedCustomShapePathService(const css::uno::Reference
< css::beans::XPropertySet
>& xPropSet
);
110 void dumpCoordinatesAsElement(const css::uno::Sequence
< css::drawing::EnhancedCustomShapeParameterPair
>& aCoordinates
);
111 void dumpSegmentsAsElement(const css::uno::Sequence
< css::drawing::EnhancedCustomShapeSegment
>& aSegments
);
112 void dumpStretchXAsAttribute(sal_Int32 aStretchX
);
113 void dumpStretchYAsAttribute(sal_Int32 aStretchY
);
114 void dumpTextFramesAsElement(const css::uno::Sequence
< css::drawing::EnhancedCustomShapeTextFrame
>& aTextFrames
);
115 void dumpGluePointsAsElement(const css::uno::Sequence
< css::drawing::EnhancedCustomShapeParameterPair
>& aGluePoints
);
116 void dumpGluePointLeavingDirectionsAsElement(const css::uno::Sequence
< double >& aGluePointLeavingDirections
);
117 void dumpGluePointTypeAsAttribute(sal_Int32 aGluePointType
);
118 void dumpExtrusionAllowedAsAttribute(bool bExtrusionAllowed
);
119 void dumpConcentricGradientFillAllowedAsAttribute(bool bConcentricGradientFillAllowed
);
120 void dumpTextPathAllowedAsAttribute(bool bTextPathAllowed
);
121 void dumpSubViewSizeAsElement(const css::uno::Sequence
< css::awt::Size
>& aSubViewSize
);
123 // EnhancedCustomShapePath.idl
124 void dumpEnhancedCustomShapeTextPathService(const css::uno::Reference
< css::beans::XPropertySet
>& xPropSet
);
125 void dumpTextPathAsAttribute(bool bTextPath
);
126 void dumpTextPathModeAsAttribute(css::drawing::EnhancedCustomShapeTextPathMode eTextPathMode
);
127 void dumpScaleXAsAttribute(bool bScaleX
);
130 xmlTextWriterPtr xmlWriter
;
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */