LCOV - code coverage report
Current view: top level - dbaccess/source/filter/xml - xmlDocuments.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 25 29 86.2 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.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 "xmlDocuments.hxx"
      21             : #include "xmlfilter.hxx"
      22             : #include <xmloff/xmltoken.hxx>
      23             : #include <xmloff/xmlnmspe.hxx>
      24             : #include "xmlQuery.hxx"
      25             : #include "xmlTable.hxx"
      26             : #include "xmlComponent.hxx"
      27             : #include "xmlHierarchyCollection.hxx"
      28             : #include "xmlEnums.hxx"
      29             : #include "xmlstrings.hrc"
      30             : #include <tools/debug.hxx>
      31             : 
      32             : namespace dbaxml
      33             : {
      34             :     using namespace ::com::sun::star::uno;
      35             :     using namespace ::com::sun::star::container;
      36             :     using namespace ::com::sun::star::xml::sax;
      37             : 
      38           4 : OXMLDocuments::OXMLDocuments( ODBFilter& rImport
      39             :                 ,sal_uInt16 nPrfx
      40             :                 , const OUString& rLName
      41             :                 ,const Reference< XNameAccess >& _xContainer
      42             :                 ,const OUString& _sCollectionServiceName
      43             :                 ,const OUString& _sComponentServiceName) :
      44             :     SvXMLImportContext( rImport, nPrfx, rLName )
      45             :         ,m_xContainer(_xContainer)
      46             :         ,m_sCollectionServiceName(_sCollectionServiceName)
      47           4 :         ,m_sComponentServiceName(_sComponentServiceName)
      48             : {
      49             : 
      50           4 : }
      51             : 
      52          16 : OXMLDocuments::OXMLDocuments( ODBFilter& rImport
      53             :                 ,sal_uInt16 nPrfx
      54             :                 , const OUString& rLName
      55             :                 ,const Reference< XNameAccess >& _xContainer
      56             :                 ,const OUString& _sCollectionServiceName
      57             :                 ) :
      58             :     SvXMLImportContext( rImport, nPrfx, rLName )
      59             :         ,m_xContainer(_xContainer)
      60          16 :         ,m_sCollectionServiceName(_sCollectionServiceName)
      61             : {
      62          16 : }
      63             : 
      64          40 : OXMLDocuments::~OXMLDocuments()
      65             : {
      66             : 
      67          40 : }
      68             : 
      69          31 : SvXMLImportContext* OXMLDocuments::CreateChildContext(
      70             :         sal_uInt16 nPrefix,
      71             :         const OUString& rLocalName,
      72             :         const Reference< XAttributeList > & xAttrList )
      73             : {
      74          31 :     SvXMLImportContext *pContext = 0;
      75          31 :     const SvXMLTokenMap&    rTokenMap   = GetOwnImport().GetDocumentsElemTokenMap();
      76             : 
      77          31 :     switch( rTokenMap.Get( nPrefix, rLocalName ) )
      78             :     {
      79             :         case XML_TOK_TABLE:
      80          19 :             GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      81          19 :             pContext = new OXMLTable( GetOwnImport(), nPrefix, rLocalName, xAttrList, m_xContainer, "com.sun.star.sdb.TableDefinition");
      82          19 :             break;
      83             :         case XML_TOK_QUERY:
      84           4 :             GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      85           4 :             pContext = new OXMLQuery( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer );
      86           4 :             break;
      87             :         case XML_TOK_COMPONENT:
      88           8 :             GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      89           8 :             pContext = new OXMLComponent( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,m_sComponentServiceName );
      90           8 :             break;
      91             :         case XML_TOK_COMPONENT_COLLECTION:
      92           0 :             GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      93           0 :             pContext = new OXMLHierarchyCollection( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,m_sCollectionServiceName,m_sComponentServiceName );
      94           0 :             break;
      95             :     }
      96             : 
      97          31 :     if( !pContext )
      98           0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
      99             : 
     100          31 :     return pContext;
     101             : }
     102             : 
     103          93 : ODBFilter& OXMLDocuments::GetOwnImport()
     104             : {
     105          93 :     return static_cast<ODBFilter&>(GetImport());
     106             : }
     107             : 
     108             : } // namespace dbaxml
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11