LCOV - code coverage report
Current view: top level - sc/source/filter/oox - sharedstringsfragment.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 13 27 48.1 %
Date: 2014-04-11 Functions: 5 7 71.4 %
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 "sharedstringsfragment.hxx"
      21             : 
      22             : #include "richstringcontext.hxx"
      23             : #include "sharedstringsbuffer.hxx"
      24             : 
      25             : namespace oox {
      26             : namespace xls {
      27             : 
      28             : using namespace ::oox::core;
      29             : 
      30             : 
      31          31 : SharedStringsFragment::SharedStringsFragment(
      32             :         const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
      33          31 :     WorkbookFragmentBase( rHelper, rFragmentPath )
      34             : {
      35          31 : }
      36             : 
      37         280 : ContextHandlerRef SharedStringsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
      38             : {
      39         280 :     switch( getCurrentElement() )
      40             :     {
      41             :         case XML_ROOT_CONTEXT:
      42          31 :             if( nElement == XLS_TOKEN( sst ) )
      43          31 :                 return this;
      44           0 :         break;
      45             : 
      46             :         case XLS_TOKEN( sst ):
      47         249 :             if( nElement == XLS_TOKEN( si ) )
      48         249 :                 return new RichStringContext( *this, getSharedStrings().createRichString() );
      49           0 :         break;
      50             :     }
      51           0 :     return 0;
      52             : }
      53             : 
      54           0 : ContextHandlerRef SharedStringsFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
      55             : {
      56           0 :     switch( getCurrentElement() )
      57             :     {
      58             :         case XML_ROOT_CONTEXT:
      59           0 :             if( nRecId == BIFF12_ID_SST )
      60           0 :                 return this;
      61           0 :         break;
      62             : 
      63             :         case BIFF12_ID_SST:
      64           0 :             if( nRecId == BIFF12_ID_SI )
      65           0 :                 getSharedStrings().createRichString()->importString( rStrm, true );
      66           0 :         break;
      67             :     }
      68           0 :     return 0;
      69             : }
      70             : 
      71           0 : const RecordInfo* SharedStringsFragment::getRecordInfos() const
      72             : {
      73             :     static const RecordInfo spRecInfos[] =
      74             :     {
      75             :         { BIFF12_ID_SST,    BIFF12_ID_SST + 1   },
      76             :         { -1,               -1                  }
      77             :     };
      78           0 :     return spRecInfos;
      79             : }
      80             : 
      81          31 : void SharedStringsFragment::finalizeImport()
      82             : {
      83          31 :     getSharedStrings().finalizeImport();
      84          31 : }
      85             : 
      86             : } // namespace xls
      87          18 : } // namespace oox
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10