LCOV - code coverage report
Current view: top level - libreoffice/writerfilter/source/dmapper - TblStylePrHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 31 31 100.0 %
Date: 2012-12-27 Functions: 8 8 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 <TblStylePrHandler.hxx>
      21             : #include <PropertyMap.hxx>
      22             : #include <ooxml/resourceids.hxx>
      23             : #include <dmapperLoggers.hxx>
      24             : #include <resourcemodel/QNameToString.hxx>
      25             : 
      26             : #include "dmapperLoggers.hxx"
      27             : 
      28             : namespace writerfilter {
      29             : namespace dmapper {
      30             : 
      31          68 : TblStylePrHandler::TblStylePrHandler( DomainMapper & rDMapper ) :
      32             : LoggedProperties(dmapper_logger, "TblStylePrHandler"),
      33             : m_rDMapper( rDMapper ),
      34          68 : m_pTablePropsHandler( new TablePropertiesHandler( true ) ),
      35             : m_nType( TBL_STYLE_UNKNOWN ),
      36         136 : m_pProperties( new PropertyMap )
      37             : {
      38          68 : }
      39             : 
      40         204 : TblStylePrHandler::~TblStylePrHandler( )
      41             : {
      42          68 :     delete m_pTablePropsHandler, m_pTablePropsHandler = NULL;
      43         136 : }
      44             : 
      45          10 : void TblStylePrHandler::lcl_attribute(Id rName, Value & rVal)
      46             : {
      47             : #ifdef DEBUG_DOMAINMAPPER
      48             :     dmapper_logger->startElement("TblStylePrHandler.attribute");
      49             :     dmapper_logger->attribute("name", (*QNameToString::Instance())(rName));
      50             :     dmapper_logger->chars(rVal.toString());
      51             :     dmapper_logger->endElement();
      52             : #endif
      53             : 
      54          10 :     switch ( rName )
      55             :     {
      56             :         case NS_ooxml::LN_CT_TblStyleOverrideType:
      57             :             {
      58             :                 // The tokenid should be the same in the model.xml than
      59             :                 // in the TblStyleType enum
      60          10 :                 m_nType = TblStyleType( rVal.getInt( ) );
      61             :             }
      62          10 :             break;
      63             :     }
      64          10 : }
      65             : 
      66         180 : void TblStylePrHandler::lcl_sprm(Sprm & rSprm)
      67             : {
      68             : #ifdef DEBUG_DOMAINMAPPER
      69             :     dmapper_logger->startElement("TblStylePrHandler.sprm");
      70             :     dmapper_logger->attribute("sprm", rSprm.toString());
      71             : #endif
      72             : 
      73         180 :     Value::Pointer_t pValue = rSprm.getValue();
      74         180 :     switch ( rSprm.getId( ) )
      75             :     {
      76             :         case NS_ooxml::LN_CT_PPrBase:
      77             :         case NS_ooxml::LN_EG_RPrBase:
      78             :         case NS_ooxml::LN_CT_TblPrBase:
      79             :         case NS_ooxml::LN_CT_TrPrBase:
      80             :         case NS_ooxml::LN_CT_TcPrBase:
      81          22 :             resolveSprmProps( rSprm );
      82          22 :             break;
      83             :         default:
      84             :             // Tables specific properties have to handled here
      85         158 :             m_pTablePropsHandler->SetProperties( m_pProperties );
      86         158 :             bool bRet = m_pTablePropsHandler->sprm( rSprm );
      87             : 
      88         158 :             if ( !bRet )
      89             :             {
      90             :                 // The DomainMapper can handle some of the properties
      91          22 :                 m_rDMapper.PushStyleSheetProperties( m_pProperties, true );
      92          22 :                 m_rDMapper.sprm( rSprm );
      93          22 :                 m_rDMapper.PopStyleSheetProperties( true );
      94             :             }
      95         180 :     }
      96             : 
      97             : #ifdef DEBUG_DOMAINMAPPER
      98             :     dmapper_logger->endElement();
      99             : #endif
     100         180 : }
     101             : 
     102          22 : void TblStylePrHandler::resolveSprmProps(Sprm & rSprm)
     103             : {
     104          22 :     writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
     105          22 :     if( pProperties.get())
     106          22 :         pProperties->resolve(*this);
     107          22 : }
     108             : 
     109          15 : }}
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10