LCOV - code coverage report
Current view: top level - writerfilter/source/dmapper - SectionColumnHandler.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 32 32 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 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             : #include <SectionColumnHandler.hxx>
      20             : #include <PropertyMap.hxx>
      21             : #include <ConversionHelper.hxx>
      22             : #include <ooxml/resourceids.hxx>
      23             : #include <osl/diagnose.h>
      24             : 
      25             : namespace writerfilter {
      26             : namespace dmapper {
      27             : 
      28             : using namespace ::com::sun::star;
      29             : 
      30             : 
      31        1085 : SectionColumnHandler::SectionColumnHandler()
      32             :     : LoggedProperties("SectionColumnHandler")
      33             :     , m_bEqualWidth(false)
      34             :     , m_nSpace(1270) // 720 twips
      35             :     , m_nNum(0)
      36        1085 :     , m_bSep(false)
      37             : {
      38        1085 :     m_aTempColumn.nWidth = m_aTempColumn.nSpace = 0;
      39        1085 : }
      40             : 
      41        2170 : SectionColumnHandler::~SectionColumnHandler()
      42             : {
      43        2170 : }
      44             : 
      45        1271 : void SectionColumnHandler::lcl_attribute(Id rName, Value & rVal)
      46             : {
      47        1271 :     sal_Int32 nIntValue = rVal.getInt();
      48        1271 :     switch( rName )
      49             :     {
      50             :         case NS_ooxml::LN_CT_Columns_equalWidth:
      51          34 :             m_bEqualWidth = (nIntValue != 0);
      52          34 :             break;
      53             :         case NS_ooxml::LN_CT_Columns_space:
      54        1074 :             m_nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
      55        1074 :             break;
      56             :         case NS_ooxml::LN_CT_Columns_num:
      57          59 :             m_nNum = nIntValue;
      58          59 :             break;
      59             :         case NS_ooxml::LN_CT_Columns_sep:
      60          19 :             m_bSep = (nIntValue != 0);
      61          19 :             break;
      62             : 
      63             :         case NS_ooxml::LN_CT_Column_w:
      64          54 :             m_aTempColumn.nWidth = ConversionHelper::convertTwipToMM100( nIntValue );
      65          54 :             break;
      66             :         case NS_ooxml::LN_CT_Column_space:
      67          31 :             m_aTempColumn.nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
      68          31 :             break;
      69             :         default:
      70             :             OSL_FAIL( "SectionColumnHandler: unknown attribute");
      71             :     }
      72        1271 : }
      73             : 
      74          54 : void SectionColumnHandler::lcl_sprm(Sprm & rSprm)
      75             : {
      76          54 :     switch( rSprm.getId())
      77             :     {
      78             :         case NS_ooxml::LN_CT_Columns_col:
      79             :         {
      80          54 :             m_aTempColumn.nWidth = m_aTempColumn.nSpace = 0;
      81          54 :             writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
      82          54 :             if( pProperties.get())
      83             :             {
      84          54 :                 pProperties->resolve(*this);
      85          54 :                 m_aCols.push_back(m_aTempColumn);
      86          54 :             }
      87             :         }
      88          54 :         break;
      89             :         default:
      90             :             OSL_FAIL( "SectionColumnHandler: unknown sprm");
      91             :     }
      92          54 : }
      93             : } //namespace dmapper
      94             : } //namespace writerfilter
      95             : 
      96             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11