xref: /aoo42x/main/oox/source/vml/vmltextbox.cxx (revision 79aad27f)
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 #include "oox/vml/vmltextbox.hxx"
25 
26 #include <rtl/ustrbuf.hxx>
27 
28 namespace oox {
29 namespace vml {
30 
31 // ============================================================================
32 
33 using ::rtl::OUString;
34 using ::rtl::OUStringBuffer;
35 
36 // ============================================================================
37 
TextFontModel()38 TextFontModel::TextFontModel()
39 {
40 }
41 
42 // ============================================================================
43 
TextPortionModel(const TextFontModel & rFont,const OUString & rText)44 TextPortionModel::TextPortionModel( const TextFontModel& rFont, const OUString& rText ) :
45     maFont( rFont ),
46     maText( rText )
47 {
48 }
49 
50 // ============================================================================
51 
TextBox()52 TextBox::TextBox()
53 {
54 }
55 
appendPortion(const TextFontModel & rFont,const OUString & rText)56 void TextBox::appendPortion( const TextFontModel& rFont, const OUString& rText )
57 {
58     maPortions.push_back( TextPortionModel( rFont, rText ) );
59 }
60 
getFirstFont() const61 const TextFontModel* TextBox::getFirstFont() const
62 {
63     return maPortions.empty() ? 0 : &maPortions.front().maFont;
64 }
65 
getText() const66 OUString TextBox::getText() const
67 {
68     OUStringBuffer aBuffer;
69     for( PortionVector::const_iterator aIt = maPortions.begin(), aEnd = maPortions.end(); aIt != aEnd; ++aIt )
70         aBuffer.append( aIt->maText );
71     return aBuffer.makeStringAndClear();
72 }
73 
74 // ============================================================================
75 
76 } // namespace vml
77 } // namespace oox
78