LCOV - code coverage report
Current view: top level - writerfilter/source/dmapper - TblStylePrHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 31 51.6 %
Date: 2012-08-25 Functions: 6 8 75.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 25 72 34.7 %

           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 <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                 :         94 : TblStylePrHandler::TblStylePrHandler( DomainMapper & rDMapper ) :
      32                 :            : LoggedProperties(dmapper_logger, "TblStylePrHandler"),
      33                 :            : m_rDMapper( rDMapper ),
      34         [ +  - ]:         94 : m_pTablePropsHandler( new TablePropertiesHandler( true ) ),
      35                 :            : m_nType( TBL_STYLE_UNKNOWN ),
      36 [ +  - ][ +  - ]:        188 : m_pProperties( new PropertyMap )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      37                 :            : {
      38                 :         94 : }
      39                 :            : 
      40         [ +  - ]:         94 : TblStylePrHandler::~TblStylePrHandler( )
      41                 :            : {
      42 [ +  - ][ +  - ]:         94 :     delete m_pTablePropsHandler, m_pTablePropsHandler = NULL;
      43         [ -  + ]:        188 : }
      44                 :            : 
      45                 :          0 : 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         [ #  # ]:          0 :     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                 :          0 :                 m_nType = TblStyleType( rVal.getInt( ) );
      61                 :            :             }
      62                 :          0 :             break;
      63                 :            :     }
      64                 :          0 : }
      65                 :            : 
      66                 :        202 : 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 [ +  - ][ +  - ]:        202 :     Value::Pointer_t pValue = rSprm.getValue();
      74 [ +  - ][ -  + ]:        202 :     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         [ #  # ]:          0 :             resolveSprmProps( rSprm );
      82                 :          0 :             break;
      83                 :            :         default:
      84                 :            :             // Tables specific properties have to handled here
      85 [ +  - ][ +  - ]:        202 :             m_pTablePropsHandler->SetProperties( m_pProperties );
                 [ +  - ]
      86         [ +  - ]:        202 :             bool bRet = m_pTablePropsHandler->sprm( rSprm );
      87                 :            : 
      88         [ -  + ]:        202 :             if ( !bRet )
      89                 :            :             {
      90                 :            :                 // The DomainMapper can handle some of the properties
      91 [ #  # ][ #  # ]:          0 :                 m_rDMapper.PushStyleSheetProperties( m_pProperties, true );
                 [ #  # ]
      92         [ #  # ]:          0 :                 m_rDMapper.sprm( rSprm );
      93         [ #  # ]:          0 :                 m_rDMapper.PopStyleSheetProperties( true );
      94                 :            :             }
      95         [ +  - ]:        202 :     }
      96                 :            : 
      97                 :            : #ifdef DEBUG_DOMAINMAPPER
      98                 :            :     dmapper_logger->endElement();
      99                 :            : #endif
     100                 :        202 : }
     101                 :            : 
     102                 :          0 : void TblStylePrHandler::resolveSprmProps(Sprm & rSprm)
     103                 :            : {
     104         [ #  # ]:          0 :     writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
     105         [ #  # ]:          0 :     if( pProperties.get())
     106 [ #  # ][ #  # ]:          0 :         pProperties->resolve(*this);
     107                 :          0 : }
     108                 :            : 
     109 [ +  - ][ +  - ]:         60 : }}
     110                 :            : 
     111                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10