tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / oox / inc / drawingml / fontworkhelpers.hxx
blob9a550b00904cf4dffac0daf9f80d0a2ef4e502e6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <docmodel/color/ComplexColor.hxx>
23 #include <rtl/ustring.hxx>
24 #include <sal/types.h>
25 #include <svx/msdffdef.hxx>
27 #include "customshapeproperties.hxx"
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <com/sun/star/drawing/LineCap.hpp>
32 #include <com/sun/star/drawing/LineDash.hpp>
33 #include <com/sun/star/drawing/XShape.hpp>
34 #include <com/sun/star/text/XText.hpp>
36 namespace FontworkHelpers
38 /** Removes the property specified by rName from the rPropVec vector of properties */
39 void resetPropertyValueInVec(std::vector<css::beans::PropertyValue>& rPropVec,
40 const OUString& rName);
42 /** Changes the EnhancedCustomShapeGeometry of xShape shape so, that it becomes a LO Fontwork
43 shape corresponding to the OOXML shape specified by sMSPresetType.
44 Precondition: xShape is a custom shape.*/
45 void putCustomShapeIntoTextPathMode(
46 const css::uno::Reference<css::drawing::XShape>& xShape,
47 const oox::drawingml::CustomShapePropertiesPtr& pCustomShapePropertiesPtr,
48 const OUString& sMSPresetType, const bool bFromWordArt);
50 /** Returns the markup for the v:shapetype element for export of a Fontwork shape to VML.
51 If eShapeType is not a Fontwork shape type or the special type is not yet implemented,
52 it returns an empty string.*/
53 OString GetVMLFontworkShapetypeMarkup(const MSO_SPT eShapeType);
55 /** Collects the properties "CharColor", "CharLumMod", "CharLumOff", "CharColorTheme",
56 "CharComplexColor" and "CharTransparence" from the first non-empty run in rXText and puts
57 them into rCharPropVec.*/
58 void collectCharColorProps(const css::uno::Reference<css::text::XText>& rXText,
59 std::vector<css::beans::PropertyValue>& rCharPropVec);
61 /** Applies all properties in rTextPropVec excluding "CharInteropGrabBag" to all non-empty runs in
62 rXText.*/
63 void applyPropsToRuns(const std::vector<css::beans::PropertyValue>& rTextPropVec,
64 css::uno::Reference<css::text::XText>& rXText);
66 /** Generates the properties "CharColor", "CharLumMod", "CharLumOff", "CharColorTheme",
67 "CharComplexColor" and "CharTransparence" from the shape properties "FillColor",
68 "FillColorLumMod, "FillColorLumOff", "FillColorTheme", "FillComplexColor" and
69 "FillTransparence" and puts them into rCharPropVec.*/
70 void createCharFillPropsFromShape(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
71 std::vector<css::beans::PropertyValue>& rCharPropVec);
73 /** Creates the properties "CharTextFillTextEffect", "CharTextOutlineTextEffect", "CharThemeColor",
74 "CharThemeColorShade" or "CharThemeColorTint", and "CharThemeOriginalColor" from the FillFoo and
75 LineBar properties of the shape and puts them into rUpdatePropVec.*/
76 void createCharInteropGrabBagUpdatesFromShapeProps(
77 const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
78 std::vector<css::beans::PropertyValue>& rUpdatePropVec);
80 /** Puts all properties in rUpdatePropVec into the "CharInteropGrabBag" of all non-empty runs in rXText.
81 Existing properties are overwritten.*/
82 void applyUpdatesToCharInteropGrabBag(const std::vector<css::beans::PropertyValue>& rUpdatePropVec,
83 css::uno::Reference<css::text::XText>& rXText);
85 // ToDo: This is essentially the same as contained in method DrawingML::WriteOutline. Change it
86 // there to use this method too, perhaps move this method to a common location.
87 /** Uses LineDash and LineCap to detect, whether the dashing comes from a prstDash in MS Office.
88 If prstDash is detected, the method puts the corresponding string for markup into rsPrstDash
89 and returns true.
90 If no prstDash is detected, the method leaves rsPrstDash unchanged and returns false. */
91 bool createPrstDashFromLineDash(const css::drawing::LineDash& rLineDash,
92 const css::drawing::LineCap& rLineCap, OUString& rsPrstDash);
94 /** Returns true if a theme color with other type than model::ThemeColorType::Unknown was found.
95 The theme color is then in rComplexColor.
96 Returns false otherwise. rComplexColor is then unchanged or its type is
97 model::ThemeColorType::Unknown */
98 bool getThemeColorFromShape(const OUString& rPropertyName,
99 const css::uno::Reference<css::beans::XPropertySet>& xPropertySet,
100 model::ComplexColor& rComplexColor);
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */