xref: /aoo4110/main/oox/inc/oox/vml/vmltextbox.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef OOX_VML_VMLTEXTBOX_HXX
25 #define OOX_VML_VMLTEXTBOX_HXX
26 
27 #include <vector>
28 #include <rtl/ustring.hxx>
29 #include "oox/helper/helper.hxx"
30 
31 namespace oox {
32 namespace vml {
33 
34 // ============================================================================
35 
36 /** Font settings for a text portion in a textbox. */
37 struct TextFontModel
38 {
39     OptValue< ::rtl::OUString > moName;     /// Font name.
40     OptValue< ::rtl::OUString > moColor;    /// Font color, HTML encoded, sort of.
41     OptValue< sal_Int32 > monSize;          /// Font size in twips.
42     OptValue< sal_Int32 > monUnderline;     /// Single or double underline.
43     OptValue< sal_Int32 > monEscapement;    /// Subscript or superscript.
44     OptValue< bool >    mobBold;
45     OptValue< bool >    mobItalic;
46     OptValue< bool >    mobStrikeout;
47 
48     explicit            TextFontModel();
49 };
50 
51 // ============================================================================
52 
53 /** A text portion in a textbox with the same formatting for all characters. */
54 struct TextPortionModel
55 {
56     TextFontModel       maFont;
57     ::rtl::OUString     maText;
58 
59     explicit            TextPortionModel( const TextFontModel& rFont, const ::rtl::OUString& rText );
60 };
61 
62 // ============================================================================
63 
64 /** The textbox contains all text contents and properties. */
65 class TextBox
66 {
67 public:
68     explicit            TextBox();
69 
70     /** Appends a new text portion to the textbox. */
71     void                appendPortion( const TextFontModel& rFont, const ::rtl::OUString& rText );
72 
73     /** Returns the current number of text portions. */
getPortionCount() const74     inline size_t       getPortionCount() const { return maPortions.size(); }
75     /** Returns the font settings of the first text portion. */
76     const TextFontModel* getFirstFont() const;
77     /** Returns the entire text of all text portions. */
78     ::rtl::OUString     getText() const;
79 
80 private:
81     typedef ::std::vector< TextPortionModel > PortionVector;
82 
83     PortionVector       maPortions;
84 };
85 
86 // ============================================================================
87 
88 } // namespace vml
89 } // namespace oox
90 
91 #endif
92