LCOV - code coverage report
Current view: top level - oox/source/drawingml - textbody.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 33 34 97.1 %
Date: 2014-04-11 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 "oox/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 "oox/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             : 
      33        1412 : TextBody::TextBody()
      34             : {
      35        1412 : }
      36             : 
      37         392 : TextBody::TextBody( TextBodyPtr pBody )
      38             : {
      39         392 :     if( pBody.get() ) {
      40         110 :         maTextProperties = pBody->maTextProperties;
      41         110 :         maTextListStyle = pBody->maTextListStyle;
      42             :     }
      43         392 : }
      44             : 
      45        1916 : TextBody::~TextBody()
      46             : {
      47        1916 : }
      48             : 
      49        1870 : TextParagraph& TextBody::addParagraph()
      50             : {
      51        1870 :     TextParagraphPtr xPara( new TextParagraph );
      52        1870 :     maParagraphs.push_back( xPara );
      53        1870 :     return *xPara;
      54             : }
      55             : 
      56         599 : void TextBody::insertAt(
      57             :         const ::oox::core::XmlFilterBase& rFilterBase,
      58             :         const Reference < XText > & xText,
      59             :         const Reference < XTextCursor > & xAt,
      60             :         const TextCharacterProperties& rTextStyleProperties,
      61             :         const TextListStylePtr& pMasterTextListStylePtr ) const
      62             : {
      63         599 :     TextListStyle aCombinedTextStyle;
      64         599 :     aCombinedTextStyle.apply( *pMasterTextListStylePtr );
      65         599 :     aCombinedTextStyle.apply( maTextListStyle );
      66             : 
      67        1198 :     Reference<css::beans::XPropertySet> xPropertySet(xAt, UNO_QUERY);
      68         599 :     float nCharHeight = xPropertySet->getPropertyValue("CharHeight").get<float>();
      69        1162 :     for( TextParagraphVector::const_iterator aBeg = maParagraphs.begin(), aIt = aBeg, aEnd = maParagraphs.end(); aIt != aEnd; ++aIt )
      70        1162 :         (*aIt)->insertAt( rFilterBase, xText, xAt, rTextStyleProperties, aCombinedTextStyle, aIt == aBeg, nCharHeight );
      71         599 : }
      72             : 
      73          98 : bool TextBody::isEmpty()
      74             : {
      75          98 :     if ( maParagraphs.size() <= 0 )
      76           0 :         return true;
      77          98 :     if ( maParagraphs.size() > 1 )
      78           9 :         return false;
      79             : 
      80          89 :     const TextRunVector aRuns = maParagraphs[0]->getRuns();
      81          89 :     if ( aRuns.size() <= 0 )
      82          29 :         return true;
      83          60 :     if ( aRuns.size() > 1 )
      84           3 :         return false;
      85             : 
      86          57 :     return aRuns[0]->getText().getLength() <= 0;
      87             : }
      88             : 
      89         177 : } }
      90             : 
      91             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10