LCOV - code coverage report
Current view: top level - writerfilter/source/dmapper - TrackChangesHandler.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 40 42 95.2 %
Date: 2015-06-13 12:38:46 Functions: 5 6 83.3 %
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             : #include <TrackChangesHandler.hxx>
      10             : #include <PropertyMap.hxx>
      11             : #include <ConversionHelper.hxx>
      12             : #include <ooxml/resourceids.hxx>
      13             : #include <oox/token/tokens.hxx>
      14             : #include <osl/diagnose.h>
      15             : 
      16             : namespace writerfilter {
      17             : namespace dmapper {
      18             : 
      19             : using namespace ::com::sun::star;
      20             : using namespace oox;
      21             : 
      22             : 
      23          34 : TrackChangesHandler::TrackChangesHandler( sal_Int32 nToken ) :
      24          34 : LoggedProperties("TrackChangesHandler")
      25             : {
      26          34 :     m_pRedlineParams = RedlineParamsPtr( new RedlineParams() );
      27          34 :     m_pRedlineParams->m_nToken = nToken;
      28          34 : }
      29             : 
      30             : 
      31          68 : TrackChangesHandler::~TrackChangesHandler()
      32             : {
      33          68 : }
      34             : 
      35             : 
      36          98 : void TrackChangesHandler::lcl_attribute(Id rName, Value & rVal)
      37             : {
      38          98 :     sal_Int32 nIntValue = rVal.getInt();
      39          98 :     OUString sStringValue = rVal.getString();
      40             :     (void)rName;
      41          98 :     switch( rName )
      42             :     {
      43             :         case NS_ooxml::LN_CT_TrackChange_author:
      44             :         {
      45          34 :             m_pRedlineParams->m_sAuthor = sStringValue;
      46             :         }
      47          34 :         break;
      48             :         case NS_ooxml::LN_CT_TrackChange_date:
      49             :         {
      50          30 :             m_pRedlineParams->m_sDate = sStringValue;
      51             :         }
      52          30 :         break;
      53             :         case NS_ooxml::LN_CT_Markup_id:
      54             :         {
      55          34 :             m_pRedlineParams->m_nId = nIntValue;
      56             :         }
      57          34 :         break;
      58             :         default:
      59             :             OSL_FAIL( "unknown attribute");
      60          98 :     }
      61          98 : }
      62             : 
      63          34 : uno::Sequence<beans::PropertyValue> TrackChangesHandler::getRedlineProperties() const
      64             : {
      65          34 :     uno::Sequence< beans::PropertyValue > aRedlineProperties(3);
      66          34 :     beans::PropertyValue* pRedlineProperties = aRedlineProperties.getArray();
      67             : 
      68          34 :     PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
      69             : 
      70          68 :     OUString sType;
      71          34 :     switch ( m_pRedlineParams->m_nToken & 0xffff )
      72             :     {
      73             :         case XML_tableRowInsert:
      74           3 :             sType = rPropNameSupplier.GetName( PROP_TABLE_ROW_INSERT );
      75           3 :             break;
      76             :         case XML_tableRowDelete:
      77          25 :             sType = rPropNameSupplier.GetName( PROP_TABLE_ROW_DELETE );
      78          25 :             break;
      79             :         case XML_tableCellInsert:
      80           3 :             sType = rPropNameSupplier.GetName( PROP_TABLE_CELL_INSERT );
      81           3 :             break;
      82             :         case XML_tableCellDelete:
      83           3 :             sType = rPropNameSupplier.GetName( PROP_TABLE_CELL_DELETE );
      84           3 :             break;
      85             :     }
      86             : 
      87          34 :     pRedlineProperties[0].Name = rPropNameSupplier.GetName( PROP_REDLINE_TYPE );
      88          34 :     pRedlineProperties[0].Value <<= sType;
      89          34 :     pRedlineProperties[1].Name = rPropNameSupplier.GetName( PROP_REDLINE_AUTHOR );
      90          34 :     pRedlineProperties[1].Value <<= m_pRedlineParams->m_sAuthor;
      91          34 :     pRedlineProperties[2].Name = rPropNameSupplier.GetName( PROP_REDLINE_DATE_TIME );
      92          34 :     pRedlineProperties[2].Value <<= ConversionHelper::ConvertDateStringToDateTime( m_pRedlineParams->m_sDate );
      93             :     //pRedlineProperties[3].Name = rPropNameSupplier.GetName( PROP_REDLINE_REVERT_PROPERTIES );
      94             :     //pRedlineProperties[3].Value <<= pRedline->m_aRevertProperties;
      95             : 
      96          68 :     return aRedlineProperties;
      97             : }
      98             : 
      99           0 : void TrackChangesHandler::lcl_sprm(Sprm & rSprm)
     100             : {
     101             :     (void)rSprm;
     102           0 : }
     103             : 
     104             : } //namespace dmapper
     105             : } //namespace writerfilter
     106             : 
     107             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11