LCOV - code coverage report
Current view: top level - oox/source/drawingml - textliststyle.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 32 33 97.0 %
Date: 2014-11-03 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/textliststyle.hxx"
      21             : 
      22             : namespace oox { namespace drawingml {
      23             : 
      24       31328 : TextListStyle::TextListStyle()
      25             : {
      26      313280 :     for ( int i = 0; i < 9; i++ )
      27             :     {
      28      281952 :         maListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties() ) );
      29      281952 :         maAggregationListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties() ) );
      30             :     }
      31       31328 : }
      32             : 
      33       32194 : TextListStyle::~TextListStyle()
      34             : {
      35       32194 : }
      36             : 
      37         866 : TextListStyle::TextListStyle(const TextListStyle& rStyle)
      38             : {
      39             :     assert(rStyle.maListStyle.size() == 9);
      40             :     assert(rStyle.maAggregationListStyle.size() == 9);
      41        8660 :     for ( size_t i = 0; i < 9; i++ )
      42             :     {
      43        7794 :         maListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties(*rStyle.maListStyle[i]) ) );
      44        7794 :         maAggregationListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties(*rStyle.maAggregationListStyle[i]) ) );
      45             :     }
      46         866 : }
      47             : 
      48         446 : TextListStyle& TextListStyle::operator=(const TextListStyle& rStyle)
      49             : {
      50         446 :     if(this != &rStyle)
      51             :     {
      52             :         assert(rStyle.maListStyle.size() == 9);
      53             :         assert(rStyle.maAggregationListStyle.size() == 9);
      54             :         assert(maListStyle.size() == 9);
      55             :         assert(maAggregationListStyle.size() == 9);
      56        4460 :         for ( size_t i = 0; i < 9; i++ )
      57             :         {
      58        4014 :             *maListStyle[i] = *rStyle.maListStyle[i];
      59        4014 :             *maAggregationListStyle[i] = *rStyle.maAggregationListStyle[i];
      60             :         }
      61             :     }
      62         446 :     return *this;
      63             : }
      64             : 
      65       11784 : void applyStyleList( const TextParagraphPropertiesVector& rSourceListStyle, TextParagraphPropertiesVector& rDestListStyle )
      66             : {
      67       11784 :     TextParagraphPropertiesVector::const_iterator aSourceListStyleIter( rSourceListStyle.begin() );
      68       11784 :     TextParagraphPropertiesVector::iterator aDestListStyleIter( rDestListStyle.begin() );
      69      129624 :     while( aSourceListStyleIter != rSourceListStyle.end() )
      70             :     {
      71      106056 :         if ( aDestListStyleIter != rDestListStyle.end() )
      72             :         {
      73      106056 :             (*aDestListStyleIter)->apply( **aSourceListStyleIter );
      74      106056 :             ++aDestListStyleIter;
      75             :         }
      76             :         else
      77           0 :             rDestListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties( **aSourceListStyleIter ) ) );
      78      106056 :         ++aSourceListStyleIter;
      79             :     }
      80       11784 : }
      81             : 
      82        5892 : void TextListStyle::apply( const TextListStyle& rTextListStyle )
      83             : {
      84        5892 :     applyStyleList( rTextListStyle.getAggregationListStyle(), getAggregationListStyle() );
      85        5892 :     applyStyleList( rTextListStyle.getListStyle(), getListStyle() );
      86        5892 : }
      87             : 
      88             : #if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 1
      89             : void TextListStyle::dump() const
      90             : {
      91             :     for ( int i = 0; i < 9; i++ )
      92             :     {
      93             :         OSL_TRACE("text list style level: %d", i);
      94             :         maListStyle[i]->dump();
      95             :     }
      96             : }
      97             : #endif
      98         408 : } }
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10