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

           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 <osl/diagnose.h>
      21                 :            : #include "oox/drawingml/clrscheme.hxx"
      22                 :            : #include "oox/token/tokens.hxx"
      23                 :            : 
      24                 :            : namespace oox { namespace drawingml {
      25                 :            : 
      26                 :        108 : sal_Bool ClrMap::getColorMap( sal_Int32& nClrToken )
      27                 :            : {
      28                 :        108 :     sal_Int32 nMapped = 0;
      29 [ +  - ][ +  - ]:        108 :     std::map < sal_Int32, sal_Int32 >::const_iterator aIter( maClrMap.find( nClrToken ) );
      30 [ +  - ][ +  - ]:        108 :     if ( aIter != maClrMap.end() )
                 [ +  - ]
      31         [ +  - ]:        108 :         nMapped = (*aIter).second;
      32         [ +  - ]:        108 :     if ( nMapped )
      33                 :            :     {
      34                 :        108 :         nClrToken = nMapped;
      35                 :        108 :         return sal_True;
      36                 :            :     }
      37                 :            :     else
      38                 :        108 :         return sal_False;
      39                 :            : }
      40                 :            : 
      41                 :        144 : void ClrMap::setColorMap( sal_Int32 nClrToken, sal_Int32 nMappedClrToken )
      42                 :            : {
      43                 :        144 :     maClrMap[ nClrToken ] = nMappedClrToken;
      44                 :        144 : }
      45                 :            : 
      46                 :            : //-----------------------------------------------------------------------------------------
      47                 :            : 
      48                 :         90 : ClrScheme::ClrScheme()
      49                 :            : {
      50                 :         90 : }
      51                 :         90 : ClrScheme::~ClrScheme()
      52                 :            : {
      53                 :         90 : }
      54                 :            : 
      55                 :        150 : sal_Bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const
      56                 :            : {
      57                 :            :     OSL_ASSERT((nSchemeClrToken & sal_Int32(0xFFFF0000))==0);
      58   [ -  -  -  -  :        150 :     switch( nSchemeClrToken )
                      + ]
      59                 :            :     {
      60                 :          0 :         case XML_bg1 : nSchemeClrToken = XML_lt1; break;
      61                 :          0 :         case XML_bg2 : nSchemeClrToken = XML_lt2; break;
      62                 :          0 :         case XML_tx1 : nSchemeClrToken = XML_dk1; break;
      63                 :          0 :         case XML_tx2 : nSchemeClrToken = XML_dk2; break;
      64                 :            :     }
      65         [ +  - ]:        150 :     std::map < sal_Int32, sal_Int32 >::const_iterator aIter( maClrScheme.find( nSchemeClrToken ) );
      66 [ +  - ][ +  - ]:        150 :     if ( aIter != maClrScheme.end() )
      67         [ +  - ]:        150 :         rColor = (*aIter).second;
      68         [ +  - ]:        150 :     return aIter != maClrScheme.end();
      69                 :            : }
      70                 :            : 
      71                 :        216 : void ClrScheme::setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor )
      72                 :            : {
      73                 :        216 :     maClrScheme[ nSchemeClrToken ] = nColor;
      74                 :        216 : }
      75                 :            : 
      76                 :            : } }
      77                 :            : 
      78                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10