LCOV - code coverage report
Current view: top level - oox/source/drawingml/table - tablecontext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 26 29 89.7 %
Date: 2015-06-13 12:38:46 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             : #include "oox/helper/attributelist.hxx"
      22             : #include "drawingml/guidcontext.hxx"
      23             : #include "drawingml/table/tablecontext.hxx"
      24             : #include "drawingml/table/tableproperties.hxx"
      25             : #include "drawingml/table/tablestylecontext.hxx"
      26             : #include "drawingml/table/tablerowcontext.hxx"
      27             : 
      28             : using namespace ::oox::core;
      29             : using namespace ::com::sun::star;
      30             : 
      31             : namespace oox { namespace drawingml { namespace table {
      32             : 
      33          12 : TableContext::TableContext( ContextHandler2Helper& rParent, ShapePtr pShapePtr )
      34             : : ShapeContext( rParent, ShapePtr(), pShapePtr )
      35          12 : , mrTableProperties( *pShapePtr->getTableProperties().get() )
      36             : {
      37          12 :     pShapePtr->setTableType();
      38          12 : }
      39             : 
      40          24 : TableContext::~TableContext()
      41             : {
      42          24 : }
      43             : 
      44             : ContextHandlerRef
      45         102 : TableContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs )
      46             : {
      47         102 :     switch( aElementToken )
      48             :     {
      49             :     case A_TOKEN( tblPr ):              // CT_TableProperties
      50             :         {
      51          12 :             mrTableProperties.isRtl() = rAttribs.getBool( XML_rtl, false );
      52          12 :             mrTableProperties.isFirstRow() = rAttribs.getBool( XML_firstRow, false );
      53          12 :             mrTableProperties.isFirstCol() = rAttribs.getBool( XML_firstCol, false );
      54          12 :             mrTableProperties.isLastRow() = rAttribs.getBool( XML_lastRow, false );
      55          12 :             mrTableProperties.isLastCol() = rAttribs.getBool( XML_lastCol, false );
      56          12 :             mrTableProperties.isBandRow() = rAttribs.getBool( XML_bandRow, false );
      57          12 :             mrTableProperties.isBandCol() = rAttribs.getBool( XML_bandCol, false );
      58             :         }
      59          12 :         break;
      60             :     case A_TOKEN( tableStyle ):         // CT_TableStyle
      61             :         {
      62           0 :             boost::shared_ptr< TableStyle >& rTableStyle = mrTableProperties.getTableStyle();
      63           0 :             rTableStyle.reset( new TableStyle() );
      64           0 :             return new TableStyleContext( *this, rAttribs, *rTableStyle );
      65             :         }
      66             :     case A_TOKEN( tableStyleId ):       // ST_Guid
      67           6 :         return new oox::drawingml::GuidContext( *this, mrTableProperties.getStyleId() );
      68             : 
      69             :     case A_TOKEN( tblGrid ):            // CT_TableGrid
      70          12 :         break;
      71             :     case A_TOKEN( gridCol ):            // CT_TableCol
      72             :         {
      73          25 :             std::vector< sal_Int32 >& rvTableGrid( mrTableProperties.getTableGrid() );
      74          25 :             rvTableGrid.push_back( rAttribs.getString( XML_w ).get().toInt32() );
      75             :         }
      76          25 :         break;
      77             :     case A_TOKEN( tr ):                 // CT_TableRow
      78             :         {
      79          35 :             std::vector< TableRow >& rvTableRows( mrTableProperties.getTableRows() );
      80          35 :             rvTableRows.resize( rvTableRows.size() + 1 );
      81          35 :             return new TableRowContext( *this, rAttribs, rvTableRows.back() );
      82             :         }
      83             :     }
      84             : 
      85          61 :     return this;
      86             : }
      87             : 
      88         246 : } } }
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11