Branch data 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 : : #include "oox/vml/vmltextbox.hxx"
21 : :
22 : : #include <rtl/ustrbuf.hxx>
23 : :
24 : : namespace oox {
25 : : namespace vml {
26 : :
27 : : using ::rtl::OUString;
28 : : using ::rtl::OUStringBuffer;
29 : :
30 : 105 : TextFontModel::TextFontModel()
31 : : {
32 : 105 : }
33 : :
34 : 5 : TextPortionModel::TextPortionModel( const TextFontModel& rFont, const OUString& rText ) :
35 : : maFont( rFont ),
36 : 5 : maText( rText )
37 : : {
38 : 5 : }
39 : :
40 : 45 : TextBox::TextBox()
41 : : {
42 : 45 : }
43 : :
44 : 5 : void TextBox::appendPortion( const TextFontModel& rFont, const OUString& rText )
45 : : {
46 [ + - ]: 5 : maPortions.push_back( TextPortionModel( rFont, rText ) );
47 : 5 : }
48 : :
49 : 5 : const TextFontModel* TextBox::getFirstFont() const
50 : : {
51 [ - + ]: 5 : return maPortions.empty() ? 0 : &maPortions.front().maFont;
52 : : }
53 : :
54 : 5 : OUString TextBox::getText() const
55 : : {
56 : 5 : OUStringBuffer aBuffer;
57 [ + - ][ + + ]: 10 : for( PortionVector::const_iterator aIt = maPortions.begin(), aEnd = maPortions.end(); aIt != aEnd; ++aIt )
58 [ + - ]: 5 : aBuffer.append( aIt->maText );
59 [ + - ]: 5 : return aBuffer.makeStringAndClear();
60 : : }
61 : :
62 : : } // namespace vml
63 : : } // namespace oox
64 : :
65 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|