Get the style color and number just once
[LibreOffice.git] / include / oox / vml / vmltextbox.hxx
blob66e1e7273769a4a5ca6a744f5b005aa80e7dcb78
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_OOX_VML_VMLTEXTBOX_HXX
21 #define INCLUDED_OOX_VML_VMLTEXTBOX_HXX
23 #include <cstddef>
24 #include <optional>
25 #include <vector>
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <oox/dllapi.h>
29 #include <rtl/ustring.hxx>
30 #include <sal/types.h>
32 namespace com::sun::star {
33 namespace drawing { class XShape; }
36 namespace oox::vml {
38 struct ShapeTypeModel;
41 /// A text paragraph in a textbox.
42 struct TextParagraphModel
44 std::optional<OUString> moParaAdjust; ///< Paragraph adjust (left, center, right, etc.)
45 std::optional<OUString> moParaStyleName;
48 /** Font settings for a text portion in a textbox. */
49 struct OOX_DLLPUBLIC TextFontModel
51 std::optional< OUString > moName; ///< Font name.
52 std::optional< OUString > moNameAsian; ///< Asian font name.
53 std::optional< OUString > moNameComplex; ///< Complex font name.
54 std::optional< OUString > moColor; ///< Font color, HTML encoded, sort of.
55 std::optional< sal_Int32 > monSize; ///< Font size in twips.
56 std::optional< sal_Int32 > monUnderline; ///< Single or double underline.
57 std::optional< sal_Int32 > monEscapement; ///< Subscript or superscript.
58 std::optional< bool > mobBold;
59 std::optional< bool > mobItalic;
60 std::optional< bool > mobStrikeout;
61 std::optional<sal_Int32> monSpacing;
63 explicit TextFontModel();
67 /** A text portion in a textbox with the same formatting for all characters. */
68 struct TextPortionModel
70 TextParagraphModel maParagraph;
71 TextFontModel maFont;
72 OUString maText;
74 explicit TextPortionModel( TextParagraphModel aParagraph, TextFontModel aFont, OUString aText );
78 /** The textbox contains all text contents and properties. */
79 class OOX_DLLPUBLIC TextBox
81 public:
82 explicit TextBox(ShapeTypeModel& rTypeModel);
84 /** Appends a new text portion to the textbox. */
85 void appendPortion( const TextParagraphModel& rParagraph, const TextFontModel& rFont, const OUString& rText );
87 /** Returns the current number of text portions. */
88 size_t getPortionCount() const { return maPortions.size(); }
89 /** Returns the font settings of the first text portion. */
90 const TextFontModel* getFirstFont() const;
91 /** Returns the entire text of all text portions. */
92 OUString getText() const;
93 void convert(const css::uno::Reference<css::drawing::XShape>& xShape) const;
95 ShapeTypeModel& mrTypeModel;
96 /// Text distance from the border (inset attribute of v:textbox), valid only if set.
97 bool borderDistanceSet;
98 int borderDistanceLeft, borderDistanceTop, borderDistanceRight, borderDistanceBottom;
99 OUString maLayoutFlow;
100 OUString msNextTextbox;
102 private:
103 typedef ::std::vector< TextPortionModel > PortionVector;
105 PortionVector maPortions;
109 } // namespace oox::vml
111 #endif
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */