LCOV - code coverage report
Current view: top level - oox/source/drawingml - textbody.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 30 32 93.8 %
Date: 2012-08-25 Functions: 8 8 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 33 58 56.9 %

           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/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"
      24                 :            : 
      25                 :            : using ::rtl::OUString;
      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 [ +  - ][ +  - ]:         24 : TextBody::TextBody()
      34                 :            : {
      35                 :         24 : }
      36                 :            : 
      37 [ +  - ][ +  - ]:        108 : TextBody::TextBody( TextBodyPtr pBody )
      38                 :            : {
      39         [ +  + ]:        108 :     if( pBody.get() ) {
      40         [ +  - ]:         39 :         maTextProperties = pBody->maTextProperties;
      41         [ +  - ]:         39 :         maTextListStyle = pBody->maTextListStyle;
      42                 :            :     }
      43                 :        108 : }
      44                 :            : 
      45 [ +  - ][ +  - ]:        174 : TextBody::~TextBody()
      46                 :            : {
      47                 :        174 : }
      48                 :            : 
      49                 :        198 : TextParagraph& TextBody::addParagraph()
      50                 :            : {
      51 [ +  - ][ +  - ]:        198 :     TextParagraphPtr xPara( new TextParagraph );
                 [ +  - ]
      52         [ +  - ]:        198 :     maParagraphs.push_back( xPara );
      53         [ +  - ]:        198 :     return *xPara;
      54                 :            : }
      55                 :            : 
      56                 :         39 : 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         [ +  - ]:         39 :     TextListStyle aCombinedTextStyle;
      64         [ +  - ]:         39 :     aCombinedTextStyle.apply( *pMasterTextListStylePtr );
      65         [ +  - ]:         39 :     aCombinedTextStyle.apply( maTextListStyle );
      66                 :            : 
      67 [ +  - ][ +  + ]:         84 :     for( TextParagraphVector::const_iterator aBeg = maParagraphs.begin(), aIt = aBeg, aEnd = maParagraphs.end(); aIt != aEnd; ++aIt )
      68 [ +  - ][ +  - ]:         84 :         (*aIt)->insertAt( rFilterBase, xText, xAt, rTextStyleProperties, aCombinedTextStyle, aIt == aBeg );
                 [ +  - ]
      69                 :         39 : }
      70                 :            : 
      71                 :         36 : bool TextBody::isEmpty()
      72                 :            : {
      73         [ -  + ]:         36 :     if ( maParagraphs.size() <= 0 )
      74                 :          0 :         return true;
      75         [ +  + ]:         36 :     if ( maParagraphs.size() > 1 )
      76                 :          3 :         return false;
      77                 :            : 
      78         [ +  - ]:         33 :     const TextRunVector aRuns = maParagraphs[0]->getRuns();
      79         [ +  + ]:         33 :     if ( aRuns.size() <= 0 )
      80                 :         12 :         return true;
      81         [ -  + ]:         21 :     if ( aRuns.size() > 1 )
      82                 :          0 :         return false;
      83                 :            : 
      84                 :         36 :     return aRuns[0]->getText().getLength() <= 0;
      85                 :            : }
      86                 :            : 
      87 [ +  - ][ +  - ]:        285 : } }
      88                 :            : 
      89                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10