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

Generated by: LCOV version 1.10