LCOV - code coverage report
Current view: top level - writerfilter/source/dmapper - PageBordersHandler.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 59 0.0 %
Date: 2014-04-14 Functions: 0 8 0.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 "PageBordersHandler.hxx"
      21             : 
      22             : #include <ooxml/resourceids.hxx>
      23             : 
      24             : #include "dmapperLoggers.hxx"
      25             : 
      26             : namespace writerfilter {
      27             : namespace dmapper {
      28             : 
      29           0 : _PgBorder::_PgBorder( ) :
      30             :     m_nDistance( 0 ),
      31             :     m_ePos( BORDER_RIGHT ),
      32           0 :     m_bShadow(false)
      33             : {
      34           0 : }
      35             : 
      36           0 : _PgBorder::~_PgBorder( )
      37             : {
      38           0 : }
      39             : 
      40           0 : PageBordersHandler::PageBordersHandler( ) :
      41             : LoggedProperties(dmapper_logger, "PageBordersHandler"),
      42             : m_nDisplay( 0 ),
      43           0 : m_nOffset( 0 )
      44             : {
      45           0 : }
      46             : 
      47           0 : PageBordersHandler::~PageBordersHandler( )
      48             : {
      49           0 : }
      50             : 
      51           0 : void PageBordersHandler::lcl_attribute( Id eName, Value& rVal )
      52             : {
      53           0 :     int nIntValue = rVal.getInt( );
      54           0 :     switch ( eName )
      55             :     {
      56             :         case NS_ooxml::LN_CT_PageBorders_display:
      57             :         {
      58           0 :             switch ( nIntValue )
      59             :             {
      60             :                 default:
      61             :                 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_allPages:
      62           0 :                     m_nDisplay = 0;
      63           0 :                     break;
      64             :                 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_firstPage:
      65           0 :                     m_nDisplay = 1;
      66           0 :                     break;
      67             :                 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_notFirstPage:
      68           0 :                     m_nDisplay = 2;
      69           0 :                     break;
      70             :             }
      71             :         }
      72           0 :         break;
      73             :         case NS_ooxml::LN_CT_PageBorders_offsetFrom:
      74             :         {
      75           0 :             switch ( nIntValue )
      76             :             {
      77             :                 default:
      78             :                 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderOffset_page:
      79           0 :                     m_nOffset = 1;
      80           0 :                     break;
      81             :                 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderOffset_text:
      82           0 :                     m_nOffset = 0;
      83           0 :                     break;
      84             :             }
      85             :         }
      86           0 :         break;
      87             :         default:;
      88             :     }
      89           0 : }
      90             : 
      91           0 : void PageBordersHandler::lcl_sprm( Sprm& rSprm )
      92             : {
      93           0 :     switch ( rSprm.getId( ) )
      94             :     {
      95             :         case NS_ooxml::LN_CT_PageBorders_top:
      96             :         case NS_ooxml::LN_CT_PageBorders_left:
      97             :         case NS_ooxml::LN_CT_PageBorders_bottom:
      98             :         case NS_ooxml::LN_CT_PageBorders_right:
      99             :         {
     100           0 :             writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
     101           0 :             if( pProperties.get())
     102             :             {
     103           0 :                 BorderHandlerPtr pBorderHandler( new BorderHandler( true ) );
     104           0 :                 pProperties->resolve(*pBorderHandler);
     105           0 :                 BorderPosition ePos = BorderPosition( 0 );
     106           0 :                 switch( rSprm.getId( ) )
     107             :                 {
     108             :                     case NS_ooxml::LN_CT_PageBorders_top:
     109           0 :                         ePos = BORDER_TOP;
     110           0 :                     break;
     111             :                     case NS_ooxml::LN_CT_PageBorders_left:
     112           0 :                         ePos = BORDER_LEFT;
     113           0 :                     break;
     114             :                     case NS_ooxml::LN_CT_PageBorders_bottom:
     115           0 :                         ePos = BORDER_BOTTOM;
     116           0 :                     break;
     117             :                     case NS_ooxml::LN_CT_PageBorders_right:
     118           0 :                         ePos = BORDER_RIGHT;
     119           0 :                     break;
     120             :                     default:;
     121             :                 }
     122             : 
     123           0 :                 _PgBorder aPgBorder;
     124           0 :                 aPgBorder.m_rLine = pBorderHandler->getBorderLine( );
     125           0 :                 aPgBorder.m_nDistance = pBorderHandler->getLineDistance( );
     126           0 :                 aPgBorder.m_ePos = ePos;
     127           0 :                 aPgBorder.m_bShadow = pBorderHandler->getShadow();
     128           0 :                 m_aBorders.push_back( aPgBorder );
     129           0 :             }
     130             :         }
     131           0 :         break;
     132             :         default:;
     133             :     }
     134           0 : }
     135             : 
     136           0 : void PageBordersHandler::SetBorders( SectionPropertyMap* pSectContext )
     137             : {
     138           0 :     for ( int i = 0, length = m_aBorders.size( ); i < length; i++ )
     139             :     {
     140           0 :         _PgBorder aBorder = m_aBorders[i];
     141           0 :         pSectContext->SetBorder( aBorder.m_ePos, aBorder.m_nDistance, aBorder.m_rLine, aBorder.m_bShadow );
     142           0 :     }
     143           0 : }
     144             : 
     145             : } }
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10