LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/filter/oox - connectionsfragment.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 64 1.6 %
Date: 2013-07-09 Functions: 2 12 16.7 %
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 "connectionsfragment.hxx"
      21             : 
      22             : #include "oox/helper/attributelist.hxx"
      23             : #include "biffhelper.hxx"
      24             : #include "connectionsbuffer.hxx"
      25             : 
      26             : namespace oox {
      27             : namespace xls {
      28             : 
      29             : // ============================================================================
      30             : 
      31             : using namespace ::oox::core;
      32             : 
      33             : 
      34             : // ============================================================================
      35             : 
      36           0 : ConnectionContext::ConnectionContext( WorkbookFragmentBase& rParent, Connection& rConnection ) :
      37             :     WorkbookContextBase( rParent ),
      38           0 :     mrConnection( rConnection )
      39             : {
      40           0 : }
      41             : 
      42           0 : ContextHandlerRef ConnectionContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      43             : {
      44           0 :     switch( getCurrentElement() )
      45             :     {
      46             :         case XLS_TOKEN( connection ):
      47           0 :             if( nElement == XLS_TOKEN( webPr ) )
      48             :             {
      49           0 :                 mrConnection.importWebPr( rAttribs );
      50           0 :                 return this;
      51             :             }
      52           0 :         break;
      53             : 
      54             :         case XLS_TOKEN( webPr ):
      55           0 :             if( nElement == XLS_TOKEN( tables ) )
      56             :             {
      57           0 :                 mrConnection.importTables( rAttribs );
      58           0 :                 return this;
      59             :             }
      60           0 :         break;
      61             : 
      62             :         case XLS_TOKEN( tables ):
      63           0 :             mrConnection.importTable( rAttribs, nElement );
      64           0 :         break;
      65             :     }
      66           0 :     return 0;
      67             : }
      68             : 
      69           0 : void ConnectionContext::onStartElement( const AttributeList& rAttribs )
      70             : {
      71           0 :     if( getCurrentElement() == XLS_TOKEN( connection ) )
      72           0 :         mrConnection.importConnection( rAttribs );
      73           0 : }
      74             : 
      75           0 : ContextHandlerRef ConnectionContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
      76             : {
      77           0 :     switch( getCurrentElement() )
      78             :     {
      79             :         case BIFF12_ID_CONNECTION:
      80           0 :             if( nRecId == BIFF12_ID_WEBPR )
      81             :             {
      82           0 :                 mrConnection.importWebPr( rStrm );
      83           0 :                 return this;
      84             :             }
      85           0 :         break;
      86             : 
      87             :         case BIFF12_ID_WEBPR:
      88           0 :             if( nRecId == BIFF12_ID_WEBPRTABLES )
      89             :             {
      90           0 :                 mrConnection.importWebPrTables( rStrm );
      91           0 :                 return this;
      92             :             }
      93           0 :         break;
      94             : 
      95             :         case BIFF12_ID_WEBPRTABLES:
      96           0 :             mrConnection.importWebPrTable( rStrm, nRecId );
      97           0 :         break;
      98             :     }
      99           0 :     return 0;
     100             : }
     101             : 
     102           0 : void ConnectionContext::onStartRecord( SequenceInputStream& rStrm )
     103             : {
     104           0 :     if( getCurrentElement() == BIFF12_ID_CONNECTION )
     105           0 :         mrConnection.importConnection( rStrm );
     106           0 : }
     107             : 
     108             : // ============================================================================
     109             : 
     110           0 : ConnectionsFragment::ConnectionsFragment( const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
     111           0 :     WorkbookFragmentBase( rHelper, rFragmentPath )
     112             : {
     113           0 : }
     114             : 
     115           0 : ContextHandlerRef ConnectionsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& /*rAttribs*/ )
     116             : {
     117           0 :     switch( getCurrentElement() )
     118             :     {
     119             :         case XML_ROOT_CONTEXT:
     120           0 :             if( nElement == XLS_TOKEN( connections ) )
     121           0 :                 return this;
     122           0 :         break;
     123             : 
     124             :         case XLS_TOKEN( connections ):
     125           0 :             if( nElement == XLS_TOKEN( connection ) )
     126           0 :                 return new ConnectionContext( *this, getConnections().createConnection() );
     127           0 :         break;
     128             :     }
     129           0 :     return 0;
     130             : }
     131             : 
     132           0 : ContextHandlerRef ConnectionsFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& /*rStrm*/ )
     133             : {
     134           0 :     switch( getCurrentElement() )
     135             :     {
     136             :         case XML_ROOT_CONTEXT:
     137           0 :             if( nRecId == BIFF12_ID_CONNECTIONS )
     138           0 :                 return this;
     139           0 :         break;
     140             : 
     141             :         case BIFF12_ID_CONNECTIONS:
     142           0 :             if( nRecId == BIFF12_ID_CONNECTION )
     143           0 :                 return new ConnectionContext( *this, getConnections().createConnection() );
     144           0 :         break;
     145             :     }
     146           0 :     return 0;
     147             : }
     148             : 
     149           0 : const RecordInfo* ConnectionsFragment::getRecordInfos() const
     150             : {
     151             :     static const RecordInfo spRecInfos[] =
     152             :     {
     153             :         { BIFF12_ID_CONNECTIONS,    BIFF12_ID_CONNECTIONS + 1   },
     154             :         { BIFF12_ID_CONNECTION,     BIFF12_ID_CONNECTION + 1    },
     155             :         { BIFF12_ID_WEBPR,          BIFF12_ID_WEBPR + 1         },
     156             :         { BIFF12_ID_WEBPRTABLES,    BIFF12_ID_WEBPRTABLES + 1   },
     157             :         { -1,                       -1                          }
     158             :     };
     159           0 :     return spRecInfos;
     160             : }
     161             : 
     162           0 : void ConnectionsFragment::finalizeImport()
     163             : {
     164           0 :     getConnections().finalizeImport();
     165           0 : }
     166             : 
     167             : // ============================================================================
     168             : 
     169             : } // namespace xls
     170          15 : } // namespace oox
     171             : 
     172             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10