LCOV - code coverage report
Current view: top level - oox/source/drawingml/table - tablecellcontext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 32 36 88.9 %
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             : 
      22             : #include "drawingml/table/tablecellcontext.hxx"
      23             : #include "drawingml/textbodycontext.hxx"
      24             : #include "drawingml/linepropertiescontext.hxx"
      25             : #include "drawingml/fillpropertiesgroupcontext.hxx"
      26             : #include "oox/helper/attributelist.hxx"
      27             : 
      28             : using namespace ::oox::core;
      29             : using namespace ::com::sun::star;
      30             : 
      31             : namespace oox { namespace drawingml { namespace table {
      32             : 
      33          77 : TableCellContext::TableCellContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, TableCell& rTableCell )
      34             : : ContextHandler2( rParent )
      35          77 : , mrTableCell( rTableCell )
      36             : {
      37          77 :     if ( rAttribs.hasAttribute( XML_rowSpan ) )
      38           0 :         mrTableCell.setRowSpan( rAttribs.getString( XML_rowSpan ).get().toInt32() );
      39          77 :     if ( rAttribs.hasAttribute( XML_gridSpan ) )
      40           0 :         mrTableCell.setGridSpan( rAttribs.getString( XML_gridSpan ).get().toInt32() );
      41             : 
      42          77 :     mrTableCell.sethMerge( rAttribs.getBool( XML_hMerge, false ) );
      43          77 :     mrTableCell.setvMerge( rAttribs.getBool( XML_vMerge, false ) );
      44          77 : }
      45             : 
      46         154 : TableCellContext::~TableCellContext()
      47             : {
      48         154 : }
      49             : 
      50             : ContextHandlerRef
      51         230 : TableCellContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs )
      52             : {
      53         230 :     switch( aElementToken )
      54             :     {
      55             :     case A_TOKEN( txBody ):     // CT_TextBody
      56             :         {
      57          73 :             oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody );
      58          73 :             mrTableCell.setTextBody( xTextBody );
      59          73 :             return new oox::drawingml::TextBodyContext( *this, *xTextBody );
      60             :         }
      61             : 
      62             :     case A_TOKEN( tcPr ):       // CT_TableCellProperties
      63             :         {
      64          77 :             mrTableCell.setLeftMargin( rAttribs.getInteger( XML_marL, 91440 ) );
      65          77 :             mrTableCell.setRightMargin( rAttribs.getInteger( XML_marR, 91440 ) );
      66          77 :             mrTableCell.setTopMargin( rAttribs.getInteger( XML_marT, 45720 ) );
      67          77 :             mrTableCell.setBottomMargin( rAttribs.getInteger( XML_marB, 45720 ) );
      68          77 :             mrTableCell.setVertToken( rAttribs.getToken( XML_vert, XML_horz ) );                  // ST_TextVerticalType
      69          77 :             mrTableCell.setAnchorToken( rAttribs.getToken( XML_anchor, XML_t ) );                 // ST_TextAnchoringType
      70          77 :             mrTableCell.setAnchorCtr( rAttribs.getBool( XML_anchorCtr, false ) );
      71          77 :             mrTableCell.setHorzOverflowToken( rAttribs.getToken( XML_horzOverflow, XML_clip ) );  // ST_TextHorzOverflowType
      72             :         }
      73          77 :         break;
      74             :         case A_TOKEN( lnL ):
      75          13 :                 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesLeft );
      76             :         case A_TOKEN( lnR ):
      77          13 :                 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesRight );
      78             :         case A_TOKEN( lnT ):
      79          14 :                 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesTop );
      80             :         case A_TOKEN( lnB ):
      81          14 :                 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesBottom );
      82             :         case A_TOKEN( lnTlToBr ):
      83           4 :                 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesTopLeftToBottomRight );
      84             :         case A_TOKEN( lnBlToTr ):
      85           4 :                 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesBottomLeftToTopRight );
      86             :         case A_TOKEN( cell3D ): // CT_Cell3D
      87           0 :         break;
      88             : 
      89             :     case A_TOKEN( extLst ):     // CT_OfficeArtExtensionList
      90           0 :     break;
      91             : 
      92             :     default:
      93          18 :         return FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs, mrTableCell.maFillProperties );
      94             : 
      95             :     }
      96             : 
      97          77 :     return this;
      98             : }
      99             : 
     100         246 : } } }
     101             : 
     102             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11