Line data Source code
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 OOX_VML_VMLTEXTBOX_HXX
21 : #define OOX_VML_VMLTEXTBOX_HXX
22 :
23 : #include <vector>
24 : #include <rtl/ustring.hxx>
25 : #include "oox/helper/helper.hxx"
26 : #include "oox/dllapi.h"
27 :
28 : namespace oox {
29 : namespace vml {
30 :
31 : // ============================================================================
32 :
33 : /** Font settings for a text portion in a textbox. */
34 64 : struct OOX_DLLPUBLIC TextFontModel
35 : {
36 : OptValue< ::rtl::OUString > moName; ///< Font name.
37 : OptValue< ::rtl::OUString > moColor; ///< Font color, HTML encoded, sort of.
38 : OptValue< sal_Int32 > monSize; ///< Font size in twips.
39 : OptValue< sal_Int32 > monUnderline; ///< Single or double underline.
40 : OptValue< sal_Int32 > monEscapement; ///< Subscript or superscript.
41 : OptValue< bool > mobBold;
42 : OptValue< bool > mobItalic;
43 : OptValue< bool > mobStrikeout;
44 :
45 : explicit TextFontModel();
46 : };
47 :
48 : // ============================================================================
49 :
50 : /** A text portion in a textbox with the same formatting for all characters. */
51 6 : struct TextPortionModel
52 : {
53 : TextFontModel maFont;
54 : ::rtl::OUString maText;
55 :
56 : explicit TextPortionModel( const TextFontModel& rFont, const ::rtl::OUString& rText );
57 : };
58 :
59 : // ============================================================================
60 :
61 : /** The textbox contains all text contents and properties. */
62 26 : class OOX_DLLPUBLIC TextBox
63 : {
64 : public:
65 : explicit TextBox();
66 :
67 : /** Appends a new text portion to the textbox. */
68 : void appendPortion( const TextFontModel& rFont, const ::rtl::OUString& rText );
69 :
70 : /** Returns the current number of text portions. */
71 4 : inline size_t getPortionCount() const { return maPortions.size(); }
72 : /** Returns the font settings of the first text portion. */
73 : const TextFontModel* getFirstFont() const;
74 : /** Returns the entire text of all text portions. */
75 : ::rtl::OUString getText() const;
76 :
77 : /// Text distance from the border (inset attribute of v:textbox), valid only if set.
78 : bool borderDistanceSet;
79 : int borderDistanceLeft, borderDistanceTop, borderDistanceRight, borderDistanceBottom;
80 :
81 : private:
82 : typedef ::std::vector< TextPortionModel > PortionVector;
83 :
84 : PortionVector maPortions;
85 : };
86 :
87 : // ============================================================================
88 :
89 : } // namespace vml
90 : } // namespace oox
91 :
92 : #endif
93 :
94 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|