fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / oox / source / drawingml / textbody.cxx
blob3df76433977908c84692be51c82324f167bf2a96
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 #include "oox/drawingml/textbody.hxx"
21 #include <com/sun/star/text/XText.hpp>
22 #include <com/sun/star/text/XTextCursor.hpp>
23 #include "oox/drawingml/textparagraph.hxx"
25 using namespace ::com::sun::star::uno;
26 using namespace ::com::sun::star::text;
27 using namespace ::com::sun::star::frame;
29 namespace oox { namespace drawingml {
32 TextBody::TextBody()
36 TextBody::TextBody( TextBodyPtr pBody )
38 if( pBody.get() ) {
39 maTextProperties = pBody->maTextProperties;
40 maTextListStyle = pBody->maTextListStyle;
44 TextBody::~TextBody()
48 TextParagraph& TextBody::addParagraph()
50 TextParagraphPtr xPara( new TextParagraph );
51 maParagraphs.push_back( xPara );
52 return *xPara;
55 void TextBody::insertAt(
56 const ::oox::core::XmlFilterBase& rFilterBase,
57 const Reference < XText > & xText,
58 const Reference < XTextCursor > & xAt,
59 const TextCharacterProperties& rTextStyleProperties,
60 const TextListStylePtr& pMasterTextListStylePtr ) const
62 TextListStyle aCombinedTextStyle;
63 aCombinedTextStyle.apply( *pMasterTextListStylePtr );
64 aCombinedTextStyle.apply( maTextListStyle );
66 for( TextParagraphVector::const_iterator aBeg = maParagraphs.begin(), aIt = aBeg, aEnd = maParagraphs.end(); aIt != aEnd; ++aIt )
67 (*aIt)->insertAt( rFilterBase, xText, xAt, rTextStyleProperties, aCombinedTextStyle, aIt == aBeg );
70 bool TextBody::isEmpty()
72 if ( maParagraphs.size() <= 0 )
73 return true;
74 if ( maParagraphs.size() > 1 )
75 return false;
77 const TextRunVector aRuns = maParagraphs[0]->getRuns();
78 if ( aRuns.size() <= 0 )
79 return true;
80 if ( aRuns.size() > 1 )
81 return false;
83 return aRuns[0]->getText().getLength() <= 0;
86 } }
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */