LCOV - code coverage report
Current view: top level - oox/source/drawingml/table - tablestylecellstylecontext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 24 30 80.0 %
Date: 2014-11-03 Functions: 6 6 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 <osl/diagnose.h>
      21             : 
      22             : #include "drawingml/table/tablestylecellstylecontext.hxx"
      23             : #include "drawingml/fillpropertiesgroupcontext.hxx"
      24             : #include "drawingml/linepropertiescontext.hxx"
      25             : #include "oox/helper/attributelist.hxx"
      26             : 
      27             : using namespace ::oox::core;
      28             : using namespace ::com::sun::star;
      29             : using namespace ::com::sun::star::uno;
      30             : using namespace ::com::sun::star::xml::sax;
      31             : 
      32             : namespace oox { namespace drawingml { namespace table {
      33             : 
      34          74 : TableStyleCellStyleContext::TableStyleCellStyleContext( ContextHandler2Helper& rParent, TableStylePart& rTableStylePart )
      35             : : ContextHandler2( rParent )
      36             : , mrTableStylePart( rTableStylePart )
      37          74 : , mnLineType( XML_none )
      38             : {
      39          74 : }
      40             : 
      41         148 : TableStyleCellStyleContext::~TableStyleCellStyleContext()
      42             : {
      43         148 : }
      44             : 
      45             : // CT_TableStyleCellStyle
      46             : ContextHandlerRef
      47         374 : TableStyleCellStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs )
      48             : {
      49         374 :     switch( aElementToken )
      50             :     {
      51             :         case A_TOKEN( tcBdr ):      // CT_TableCellBorderStyle
      52          74 :             break;
      53             :         case A_TOKEN( left ):       // CT_ThemeableLineStyle
      54             :         case A_TOKEN( right ):
      55             :         case A_TOKEN( top ):
      56             :         case A_TOKEN( bottom ):
      57             :         case A_TOKEN( insideH ):
      58             :         case A_TOKEN( insideV ):
      59             :         case A_TOKEN( tl2br ):
      60             :         case A_TOKEN( tr2bl ):
      61         126 :             mnLineType = getBaseToken( aElementToken );
      62         126 :             break;
      63             : 
      64             :         case A_TOKEN( ln ):
      65             :             {
      66          58 :                 if ( mnLineType != XML_none )
      67             :                 {
      68          58 :                     std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rLineBorders = mrTableStylePart.getLineBorders();
      69          58 :                     ::oox::drawingml::LinePropertiesPtr mpLineProperties( new oox::drawingml::LineProperties );
      70          58 :                     rLineBorders[ mnLineType ] = mpLineProperties;
      71          58 :                     return new LinePropertiesContext( *this, rAttribs, *mpLineProperties );
      72             :                 }
      73             :             }
      74           0 :             break;
      75             :         case A_TOKEN( lnRef ):
      76             :             {
      77          68 :                 if ( mnLineType != XML_none )
      78             :                 {
      79          68 :                     ShapeStyleRef& rLineStyleRef = mrTableStylePart.getStyleRefs()[ mnLineType ];
      80          68 :                     rLineStyleRef.mnThemedIdx = rAttribs.getInteger( XML_idx, 0 );
      81          68 :                     return new ColorContext( *this, rLineStyleRef.maPhClr );
      82             :                 }
      83             :             }
      84           0 :             break;
      85             : 
      86             :         // EG_ThemeableFillStyle (choice)
      87             :         case A_TOKEN( fill ):       // CT_FillProperties
      88             :             {
      89          48 :                 FillPropertiesPtr& rxFillProperties = mrTableStylePart.getFillProperties();
      90          48 :                 rxFillProperties.reset( new FillProperties );
      91          48 :                 return new FillPropertiesContext( *this, *rxFillProperties );
      92             :             }
      93             :         case A_TOKEN( fillRef ):    // CT_StyleMatrixReference
      94             :             {
      95           0 :                 ShapeStyleRef& rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ];
      96           0 :                 rStyleRef.mnThemedIdx = rAttribs.getInteger( XML_idx, 0 );
      97           0 :                 return new ColorContext( *this, rStyleRef.maPhClr );
      98             :             }
      99             :         case A_TOKEN( cell3D ):     // CT_Cell3D
     100           0 :             break;
     101             :     }
     102             : 
     103         200 :     return this;
     104             : }
     105             : 
     106         408 : } } }
     107             : 
     108             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10