Branch libreoffice-5-0-4
[LibreOffice.git] / include / oox / vml / vmltextbox.hxx
blob6b14c4c900b3ed5288f00c4723dfdceb2199e2b3
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 <vector>
24 #include <rtl/ustring.hxx>
25 #include <oox/helper/helper.hxx>
26 #include <oox/dllapi.h>
27 #include <com/sun/star/uno/Reference.h>
29 namespace com { namespace sun { namespace star {
30 namespace drawing { class XShape; }
31 } } }
33 namespace oox {
34 namespace vml {
36 struct ShapeTypeModel;
40 /// A text paragraph in a textbox.
41 struct TextParagraphModel
43 OptValue<OUString> moParaAdjust; ///< Paragraph adjust (left, center, right, etc.)
46 /** Font settings for a text portion in a textbox. */
47 struct OOX_DLLPUBLIC TextFontModel
49 OptValue< OUString > moName; ///< Font name.
50 OptValue< OUString > moColor; ///< Font color, HTML encoded, sort of.
51 OptValue< sal_Int32 > monSize; ///< Font size in twips.
52 OptValue< sal_Int32 > monUnderline; ///< Single or double underline.
53 OptValue< sal_Int32 > monEscapement; ///< Subscript or superscript.
54 OptValue< bool > mobBold;
55 OptValue< bool > mobItalic;
56 OptValue< bool > mobStrikeout;
57 OptValue<sal_Int32> monSpacing;
59 explicit TextFontModel();
64 /** A text portion in a textbox with the same formatting for all characters. */
65 struct TextPortionModel
67 TextParagraphModel maParagraph;
68 TextFontModel maFont;
69 OUString maText;
71 explicit TextPortionModel( const TextParagraphModel& rParagraph, const TextFontModel& rFont, const OUString& rText );
76 /** The textbox contains all text contents and properties. */
77 class OOX_DLLPUBLIC TextBox
79 public:
80 explicit TextBox(ShapeTypeModel& rTypeModel);
82 /** Appends a new text portion to the textbox. */
83 void appendPortion( const TextParagraphModel& rParagraph, const TextFontModel& rFont, const OUString& rText );
85 /** Returns the current number of text portions. */
86 size_t getPortionCount() const { return maPortions.size(); }
87 /** Returns the font settings of the first text portion. */
88 const TextFontModel* getFirstFont() const;
89 /** Returns the entire text of all text portions. */
90 OUString getText() const;
91 void convert(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xShape) const;
93 ShapeTypeModel& mrTypeModel;
94 /// Text distance from the border (inset attribute of v:textbox), valid only if set.
95 bool borderDistanceSet;
96 int borderDistanceLeft, borderDistanceTop, borderDistanceRight, borderDistanceBottom;
97 OUString maLayoutFlow;
98 OUString msNextTextbox;
100 private:
101 typedef ::std::vector< TextPortionModel > PortionVector;
103 PortionVector maPortions;
108 } // namespace vml
109 } // namespace oox
111 #endif
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */