LCOV - code coverage report
Current view: top level - dbaccess/source/filter/xml - xmlTableFilterList.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 26 29 89.7 %
Date: 2012-08-25 Functions: 6 6 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 22 56 39.3 %

           Branch data     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 "xmlTableFilterList.hxx"
      21                 :            : #include "xmlTableFilterPattern.hxx"
      22                 :            : #include "xmlEnums.hxx"
      23                 :            : #include <xmloff/xmltoken.hxx>
      24                 :            : #include <xmloff/xmlnmspe.hxx>
      25                 :            : #include <xmloff/nmspmap.hxx>
      26                 :            : #include "xmlstrings.hrc"
      27                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      28                 :            : #include <xmloff/xmlimp.hxx>
      29                 :            : #include "xmlfilter.hxx"
      30                 :            : #include <tools/debug.hxx>
      31                 :            : 
      32                 :            : namespace dbaxml
      33                 :            : {
      34                 :            :     using namespace ::xmloff::token;
      35                 :            :     using namespace ::com::sun::star::uno;
      36                 :            :     using namespace ::com::sun::star::beans;
      37                 :            :     using namespace ::com::sun::star::xml::sax;
      38                 :            : DBG_NAME(OXMLTableFilterList)
      39                 :            : 
      40                 :         28 : OXMLTableFilterList::OXMLTableFilterList( SvXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& _sLocalName )
      41 [ +  - ][ +  - ]:         28 :     :SvXMLImportContext( rImport, nPrfx, _sLocalName )
      42                 :            : {
      43                 :            :     DBG_CTOR(OXMLTableFilterList,NULL);
      44                 :            : 
      45                 :         28 : }
      46                 :            : // -----------------------------------------------------------------------------
      47                 :            : 
      48                 :         28 : OXMLTableFilterList::~OXMLTableFilterList()
      49                 :            : {
      50                 :            :     DBG_DTOR(OXMLTableFilterList,NULL);
      51         [ -  + ]:         56 : }
      52                 :            : // -----------------------------------------------------------------------------
      53                 :            : 
      54                 :         28 : SvXMLImportContext* OXMLTableFilterList::CreateChildContext(
      55                 :            :         sal_uInt16 nPrefix,
      56                 :            :         const ::rtl::OUString& rLocalName,
      57                 :            :         const Reference< XAttributeList > & /*xAttrList*/ )
      58                 :            : {
      59                 :         28 :     SvXMLImportContext *pContext = 0;
      60                 :            : 
      61         [ +  - ]:         28 :     if ( XML_NAMESPACE_DB == nPrefix )
      62                 :            :     {
      63                 :         28 :         GetImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      64         [ +  + ]:         28 :         if ( IsXMLToken( rLocalName, XML_TABLE_FILTER_PATTERN ) )
      65         [ +  - ]:         14 :             pContext = new OXMLTableFilterPattern( GetImport(), nPrefix, rLocalName,sal_True,*this);
      66         [ -  + ]:         14 :         else if ( IsXMLToken( rLocalName, XML_TABLE_TYPE ) )
      67         [ #  # ]:          0 :             pContext = new OXMLTableFilterPattern( GetImport(), nPrefix, rLocalName,sal_False,*this);
      68         [ +  - ]:         14 :         else if ( IsXMLToken( rLocalName, XML_TABLE_INCLUDE_FILTER ) )
      69         [ +  - ]:         14 :             pContext = new OXMLTableFilterList( GetImport(), nPrefix, rLocalName );
      70                 :            :     }
      71                 :            : 
      72         [ -  + ]:         28 :     if( !pContext )
      73         [ #  # ]:          0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
      74                 :            : 
      75                 :         28 :     return pContext;
      76                 :            : }
      77                 :            : // -----------------------------------------------------------------------------
      78                 :         28 : ODBFilter& OXMLTableFilterList::GetOwnImport()
      79                 :            : {
      80                 :         28 :     return static_cast<ODBFilter&>(GetImport());
      81                 :            : }
      82                 :            : 
      83                 :            : // -----------------------------------------------------------------------------
      84                 :         28 : void OXMLTableFilterList::EndElement()
      85                 :            : {
      86         [ +  - ]:         28 :     Reference<XPropertySet> xDataSource(GetOwnImport().getDataSource());
      87         [ +  - ]:         28 :     if ( xDataSource.is() )
      88                 :            :     {
      89         [ +  + ]:         28 :         if ( !m_aPatterns.empty() )
      90 [ +  - ][ +  - ]:         14 :             xDataSource->setPropertyValue(PROPERTY_TABLEFILTER,makeAny(Sequence< ::rtl::OUString>(&(*m_aPatterns.begin()),m_aPatterns.size())));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      91         [ -  + ]:         28 :         if ( !m_aTypes.empty() )
      92 [ #  # ][ #  # ]:          0 :             xDataSource->setPropertyValue(PROPERTY_TABLETYPEFILTER,makeAny(Sequence< ::rtl::OUString>(&(*m_aTypes.begin()),m_aTypes.size())));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      93                 :         28 :     }
      94                 :         28 : }
      95                 :            : //----------------------------------------------------------------------------
      96                 :            : } // namespace dbaxml
      97                 :            : // -----------------------------------------------------------------------------
      98                 :            : 
      99                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10