LCOV - code coverage report
Current view: top level - oox/source/drawingml - textbody.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 33 34 97.1 %
Date: 2015-06-13 12:38:46 Functions: 8 8 100.0 %
Legend: Lines: hit not hit

          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 "drawingml/textbody.hxx"
      21             : #include <com/sun/star/text/XText.hpp>
      22             : #include <com/sun/star/text/XTextCursor.hpp>
      23             : #include <com/sun/star/beans/XPropertySet.hpp>
      24             : #include "drawingml/textparagraph.hxx"
      25             : 
      26             : using namespace ::com::sun::star::uno;
      27             : using namespace ::com::sun::star::text;
      28             : using namespace ::com::sun::star::frame;
      29             : 
      30             : namespace oox { namespace drawingml {
      31             : 
      32        2471 : TextBody::TextBody()
      33             : {
      34        2471 : }
      35             : 
      36         957 : TextBody::TextBody( TextBodyPtr pBody )
      37             : {
      38         957 :     if( pBody.get() ) {
      39         325 :         maTextProperties = pBody->maTextProperties;
      40         325 :         maTextListStyle = pBody->maTextListStyle;
      41             :     }
      42         957 : }
      43             : 
      44        3757 : TextBody::~TextBody()
      45             : {
      46        3757 : }
      47             : 
      48        3873 : TextParagraph& TextBody::addParagraph()
      49             : {
      50        3873 :     TextParagraphPtr xPara( new TextParagraph );
      51        3873 :     maParagraphs.push_back( xPara );
      52        3873 :     return *xPara;
      53             : }
      54             : 
      55        1071 : 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
      61             : {
      62        1071 :     TextListStyle aCombinedTextStyle;
      63        1071 :     aCombinedTextStyle.apply( *pMasterTextListStylePtr );
      64        1071 :     aCombinedTextStyle.apply( maTextListStyle );
      65             : 
      66        2142 :     Reference<css::beans::XPropertySet> xPropertySet(xAt, UNO_QUERY);
      67        1071 :     float nCharHeight = xPropertySet->getPropertyValue("CharHeight").get<float>();
      68        2370 :     for( TextParagraphVector::const_iterator aBeg = maParagraphs.begin(), aIt = aBeg, aEnd = maParagraphs.end(); aIt != aEnd; ++aIt )
      69        2370 :         (*aIt)->insertAt( rFilterBase, xText, xAt, rTextStyleProperties, aCombinedTextStyle, aIt == aBeg, nCharHeight );
      70        1071 : }
      71             : 
      72         333 : bool TextBody::isEmpty()
      73             : {
      74         333 :     if ( maParagraphs.size() <= 0 )
      75           0 :         return true;
      76         333 :     if ( maParagraphs.size() > 1 )
      77          21 :         return false;
      78             : 
      79         312 :     const TextRunVector aRuns = maParagraphs[0]->getRuns();
      80         312 :     if ( aRuns.size() <= 0 )
      81         117 :         return true;
      82         195 :     if ( aRuns.size() > 1 )
      83          14 :         return false;
      84             : 
      85         181 :     return aRuns[0]->getText().getLength() <= 0;
      86             : }
      87             : 
      88         246 : } }
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11