LCOV - code coverage report
Current view: top level - oox/source/drawingml - theme.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 29 29 100.0 %
Date: 2012-08-25 Functions: 10 10 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 69 116 59.5 %

           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/theme.hxx"
      21                 :            : 
      22                 :            : using ::rtl::OUString;
      23                 :            : 
      24                 :            : namespace oox {
      25                 :            : namespace drawingml {
      26                 :            : 
      27                 :            : // ============================================================================
      28                 :            : 
      29 [ +  - ][ +  - ]:         90 : Theme::Theme()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      30                 :            : {
      31                 :         90 : }
      32                 :            : 
      33 [ +  - ][ +  - ]:         90 : Theme::~Theme()
         [ +  - ][ +  - ]
      34                 :            : {
      35                 :         90 : }
      36                 :            : 
      37                 :            : namespace {
      38                 :            : 
      39                 :            : template< typename Type >
      40                 :         54 : const Type* lclGetStyleElement( const RefVector< Type >& rVector, sal_Int32 nIndex )
      41                 :            : {
      42                 :            :     return (rVector.empty() || (nIndex < 1)) ? 0 :
      43 [ +  - ][ +  + ]:         54 :         rVector.get( ::std::min( static_cast< sal_Int32 >( nIndex - 1 ), static_cast< sal_Int32 >( rVector.size() - 1 ) ) ).get();
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
         [ +  + ][ +  + ]
           [ #  #  #  #  
           #  # ][ +  - ]
         [ +  + ][ +  - ]
         [ +  - ][ +  + ]
         [ +  - ][ +  + ]
         [ +  + ][ #  #  
             #  #  #  # ]
      44                 :            : }
      45                 :            : 
      46                 :            : } // namespace
      47                 :            : 
      48                 :         30 : const FillProperties* Theme::getFillStyle( sal_Int32 nIndex ) const
      49                 :            : {
      50                 :            :     return (nIndex >= 1000) ?
      51                 :          6 :         lclGetStyleElement( maBgFillStyleList, nIndex - 1000 ) :
      52         [ +  + ]:         30 :         lclGetStyleElement( maFillStyleList, nIndex );
      53                 :            : }
      54                 :            : 
      55                 :         24 : const LineProperties* Theme::getLineStyle( sal_Int32 nIndex ) const
      56                 :            : {
      57                 :         24 :      return lclGetStyleElement( maLineStyleList, nIndex );
      58                 :            : }
      59                 :            : 
      60                 :          9 : const TextCharacterProperties* Theme::getFontStyle( sal_Int32 nSchemeType ) const
      61                 :            : {
      62                 :          9 :     return maFontScheme.get( nSchemeType ).get();
      63                 :            : }
      64                 :            : 
      65                 :        759 : const TextFont* Theme::resolveFont( const OUString& rName ) const
      66                 :            : {
      67                 :            :     /*  Resolves the following names:
      68                 :            :         +mj-lt, +mj-ea, +mj-cs  --  major Latin, Asian, Complex font
      69                 :            :         +mn-lt, +mn-ea, +mn-cs  --  minor Latin, Asian, Complex font
      70                 :            :      */
      71 [ +  + ][ +  - ]:        759 :     if( (rName.getLength() == 6) && (rName[ 0 ] == '+') && (rName[ 3 ] == '-') )
         [ +  - ][ +  + ]
      72                 :            :     {
      73                 :        405 :         const TextCharacterProperties* pCharProps = 0;
      74 [ +  - ][ +  + ]:        405 :         if( (rName[ 1 ] == 'm') && (rName[ 2 ] == 'j') )
                 [ +  + ]
      75                 :         36 :             pCharProps = maFontScheme.get( XML_major ).get();
      76 [ +  - ][ +  - ]:        369 :         else if( (rName[ 1 ] == 'm') && (rName[ 2 ] == 'n') )
                 [ +  - ]
      77                 :        369 :             pCharProps = maFontScheme.get( XML_minor ).get();
      78         [ +  - ]:        405 :         if( pCharProps )
      79                 :            :         {
      80 [ +  + ][ +  - ]:        405 :             if( (rName[ 4 ] == 'l') && (rName[ 5 ] == 't') )
                 [ +  + ]
      81                 :        135 :                 return &pCharProps->maLatinFont;
      82 [ +  + ][ +  - ]:        270 :             if( (rName[ 4 ] == 'e') && (rName[ 5 ] == 'a') )
                 [ +  + ]
      83                 :        135 :                 return &pCharProps->maAsianFont;
      84 [ +  - ][ +  - ]:        135 :             if( (rName[ 4 ] == 'c') && (rName[ 5 ] == 's') )
                 [ +  - ]
      85                 :        135 :                 return &pCharProps->maComplexFont;
      86                 :            :         }
      87                 :            :     }
      88                 :        759 :     return 0;
      89                 :            : }
      90                 :            : 
      91                 :            : // ============================================================================
      92                 :            : 
      93                 :            : } // namespace drawingml
      94 [ +  - ][ +  - ]:        285 : } // namespace oox
      95                 :            : 
      96                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10