LibreOffice Module oox (master) 1
vmlformatting.hxx
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
20#ifndef INCLUDED_OOX_VML_VMLFORMATTING_HXX
21#define INCLUDED_OOX_VML_VMLFORMATTING_HXX
22
23#include <sal/config.h>
24
25#include <string_view>
26#include <utility>
27#include <vector>
28
29#include <com/sun/star/drawing/PolygonFlags.hpp>
30#include <com/sun/star/uno/Reference.hxx>
31#include <oox/dllapi.h>
32#include <oox/helper/helper.hxx>
33#include <rtl/ustring.hxx>
34#include <sal/types.h>
35#include <tools/degree.hxx>
36
37namespace com::sun::star {
38 namespace awt { struct Point; }
39 namespace drawing { class XShape; }
40}
41
42namespace oox {
43 class GraphicHelper;
44 namespace drawingml { class Color; }
45 namespace drawingml { class ShapePropertyMap; }
46}
47
48namespace oox::vml {
49
50
51typedef ::std::pair< sal_Int32, sal_Int32 > Int32Pair;
52typedef ::std::pair< double, double > DoublePair;
53
54
55namespace ConversionHelper
56{
60 std::u16string_view& orValue1, std::u16string_view& orValue2,
61 std::u16string_view rValue, sal_Unicode cSep );
62
66 OOX_DLLPUBLIC bool decodeBool( std::u16string_view rValue );
67
78 std::u16string_view rValue,
79 double fDefValue );
80
91 OOX_DLLPUBLIC Degree100 decodeRotation( std::u16string_view rValue );
92
112 const GraphicHelper& rGraphicHelper,
113 std::u16string_view rValue,
114 sal_Int32 nRefValue,
115 bool bPixelX,
116 bool bDefaultAsPixel );
117
127 const GraphicHelper& rGraphicHelper,
128 std::u16string_view rValue,
129 sal_Int32 nRefValue,
130 bool bPixelX,
131 bool bDefaultAsPixel );
132
141OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const GraphicHelper& rGraphicHelper,
142 std::u16string_view rValue, sal_Int32 nRefValue,
143 bool bPixelX, bool bDefaultAsPixel);
144
167 OOX_DLLPUBLIC ::oox::drawingml::Color decodeColor(
168 const GraphicHelper& rGraphicHelper,
169 const std::optional< OUString >& roVmlColor,
170 const std::optional< double >& roVmlOpacity,
171 ::Color nDefaultRgb,
172 ::Color nPrimaryRgb = API_RGB_TRANSPARENT );
173
187 ::std::vector< ::std::vector< css::awt::Point > >& rPoints,
188 ::std::vector< ::std::vector< css::drawing::PolygonFlags > >& rFlags,
189 std::u16string_view rPath );
190}
191
192
195{
196 std::optional< sal_Int32 > moArrowType;
197 std::optional< sal_Int32 > moArrowWidth;
198 std::optional< sal_Int32 > moArrowLength;
199
200 void assignUsed( const StrokeArrowModel& rSource );
201};
202
203
206{
207 std::optional< bool > moStroked;
210 std::optional< OUString > moColor;
211 std::optional< double > moOpacity;
212 std::optional< OUString > moWeight;
213 std::optional< OUString > moDashStyle;
214 std::optional< sal_Int32 > moLineStyle;
215 std::optional< sal_Int32 > moEndCap;
216 std::optional< sal_Int32 > moJoinStyle;
217
218 void assignUsed( const StrokeModel& rSource );
219
221 void pushToPropMap(
223 const GraphicHelper& rGraphicHelper ) const;
224};
225
226
229{
230 std::optional< bool > moFilled;
231 std::optional< OUString > moColor;
232 std::optional< double > moOpacity;
233 std::optional< OUString > moColor2;
234 std::optional< double > moOpacity2;
235 std::optional< sal_Int32 > moType;
236 std::optional< sal_Int32 > moAngle;
237 std::optional< double > moFocus;
238 std::optional< DoublePair > moFocusPos;
239 std::optional< DoublePair > moFocusSize;
240 std::optional< OUString > moBitmapPath;
241 std::optional< bool > moRotate;
242
243 void assignUsed( const FillModel& rSource );
244
246 void pushToPropMap(
248 const GraphicHelper& rGraphicHelper ) const;
249};
250
251
254{
256 std::optional<bool> moShadowOn;
257 std::optional<OUString> moColor;
258 std::optional<OUString> moOffset;
259 std::optional<double> moOpacity;
260
261 ShadowModel();
262
264 void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const;
265};
266
269{
270 std::optional<OUString> moString;
271 std::optional<OUString> moStyle;
272 std::optional<bool> moTrim;
273
275
277 void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const css::uno::Reference<css::drawing::XShape>& xShape,
278 const GraphicHelper& rGraphicHelper) const;
279};
280
281} // namespace oox::vml
282
283#endif
284
285/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Provides helper functions for colors, device measurement conversion, graphics, and graphic objects ha...
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
OOX_DLLPUBLIC bool separatePair(std::u16string_view &orValue1, std::u16string_view &orValue2, std::u16string_view rValue, sal_Unicode cSep)
Returns two values contained in rValue separated by cSep.
OOX_DLLPUBLIC::oox::drawingml::Color decodeColor(const GraphicHelper &rGraphicHelper, const std::optional< OUString > &roVmlColor, const std::optional< double > &roVmlOpacity, ::Color nDefaultRgb, ::Color nPrimaryRgb=API_RGB_TRANSPARENT)
Converts VML color attributes to a DrawingML color.
OOX_DLLPUBLIC void decodeVmlPath(::std::vector< ::std::vector< css::awt::Point > > &rPoints, ::std::vector< ::std::vector< css::drawing::PolygonFlags > > &rFlags, std::u16string_view rPath)
Converts VML path string into point and flag vectors.
OOX_DLLPUBLIC sal_Int64 decodeMeasureToEmu(const GraphicHelper &rGraphicHelper, std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel)
Converts the passed VML measure string to EMU (English Metric Units).
OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const GraphicHelper &rGraphicHelper, std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel)
Converts the passed VML measure string to Twip.
OOX_DLLPUBLIC double decodePercent(std::u16string_view rValue, double fDefValue)
Converts the passed VML percentage measure string to a normalized floating-point value.
OOX_DLLPUBLIC sal_Int32 decodeMeasureToHmm(const GraphicHelper &rGraphicHelper, std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel)
Converts the passed VML measure string to 1/100 mm.
OOX_DLLPUBLIC bool decodeBool(std::u16string_view rValue)
Returns the boolean value from the passed string of a VML attribute.
OOX_DLLPUBLIC Degree100 decodeRotation(std::u16string_view rValue)
Converts the passed VML rotation value to degrees.
::std::pair< sal_Int32, sal_Int32 > Int32Pair
::std::pair< double, double > DoublePair
const ::Color API_RGB_TRANSPARENT(ColorTransparency, 0xffffffff)
Transparent color for API calls.
The fill model structure contains all shape fill properties.
std::optional< DoublePair > moFocusSize
Rectangular gradient focus size of second color.
std::optional< double > moOpacity
Solid fill color opacity.
std::optional< OUString > moColor2
End color of gradient.
std::optional< bool > moRotate
True = rotate gradient/bitmap with shape.
std::optional< DoublePair > moFocusPos
Rectangular gradient focus position of second color.
std::optional< sal_Int32 > moType
Fill type.
std::optional< double > moFocus
Linear gradient focus of second color.
std::optional< bool > moFilled
Shape fill on/off.
std::optional< OUString > moBitmapPath
Path to fill bitmap fragment.
std::optional< double > moOpacity2
End color opacity of gradient.
std::optional< sal_Int32 > moAngle
Gradient rotation angle.
std::optional< OUString > moColor
Solid fill color.
The shadow model structure contains all shape shadow properties.
bool mbHasShadow
Is a v:shadow element seen?
std::optional< double > moOpacity
Specifies the opacity of the shadow.
std::optional< OUString > moOffset
Specifies the shadow's offset from the shape's location.
std::optional< bool > moShadowOn
Is the element turned on?
std::optional< OUString > moColor
Specifies the color of the shadow.
The stroke arrow model structure contains all properties for a line end arrow.
std::optional< sal_Int32 > moArrowWidth
std::optional< sal_Int32 > moArrowType
void assignUsed(const StrokeArrowModel &rSource)
std::optional< sal_Int32 > moArrowLength
The stroke model structure contains all shape border properties.
void pushToPropMap(::oox::drawingml::ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
void assignUsed(const StrokeModel &rSource)
StrokeArrowModel maStartArrow
Start line arrow style.
StrokeArrowModel maEndArrow
End line arrow style.
std::optional< sal_Int32 > moLineStyle
Line style (single, double, ...).
std::optional< sal_Int32 > moEndCap
Type of line end cap.
std::optional< OUString > moColor
Solid line color.
std::optional< bool > moStroked
Shape border line on/off.
std::optional< OUString > moDashStyle
Line dash (predefined or manually).
std::optional< sal_Int32 > moJoinStyle
Type of line join.
std::optional< double > moOpacity
Solid line color opacity.
std::optional< OUString > moWeight
Line width.
The shadow model structure contains all shape textpath properties.
std::optional< OUString > moStyle
Specifies the style of the textpath.
void pushToPropMap(oox::drawingml::ShapePropertyMap &rPropMap, const css::uno::Reference< css::drawing::XShape > &xShape, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
std::optional< bool > moTrim
Specifies whether extra space is removed above and below the text.
std::optional< OUString > moString
Specifies the string of the textpath.
sal_uInt16 sal_Unicode