LCOV - code coverage report
Current view: top level - dbaccess/source/filter/xml - xmlQuery.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 48 0.0 %
Date: 2012-08-25 Functions: 0 5 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 111 0.0 %

           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 "xmlQuery.hxx"
      21                 :            : #include "xmlfilter.hxx"
      22                 :            : #include <xmloff/xmltoken.hxx>
      23                 :            : #include <xmloff/xmlnmspe.hxx>
      24                 :            : #include <xmloff/nmspmap.hxx>
      25                 :            : #include "xmlEnums.hxx"
      26                 :            : #include "xmlstrings.hrc"
      27                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      28                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      29                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      30                 :            : #include <tools/debug.hxx>
      31                 :            : 
      32                 :            : namespace dbaxml
      33                 :            : {
      34                 :            :     using namespace ::com::sun::star::uno;
      35                 :            :     using namespace ::com::sun::star::beans;
      36                 :            :     using namespace ::com::sun::star::container;
      37                 :            :     using namespace ::com::sun::star::xml::sax;
      38                 :            : 
      39                 :            : DBG_NAME(OXMLQuery)
      40                 :            : 
      41                 :          0 : OXMLQuery::OXMLQuery( ODBFilter& rImport
      42                 :            :                 ,sal_uInt16 nPrfx
      43                 :            :                 ,const ::rtl::OUString& _sLocalName
      44                 :            :                 ,const Reference< XAttributeList > & _xAttrList
      45                 :            :                 ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xParentContainer
      46                 :            :                 ) :
      47                 :            :     OXMLTable( rImport, nPrfx, _sLocalName,_xAttrList,_xParentContainer,SERVICE_SDB_COMMAND_DEFINITION )
      48         [ #  # ]:          0 :         ,m_bEscapeProcessing(sal_True)
      49                 :            : {
      50                 :            :     DBG_CTOR(OXMLQuery,NULL);
      51                 :            : 
      52                 :            :     OSL_ENSURE(_xAttrList.is(),"Attribute list is NULL!");
      53                 :          0 :     const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
      54         [ #  # ]:          0 :     const SvXMLTokenMap& rTokenMap = rImport.GetQueryElemTokenMap();
      55                 :            : 
      56 [ #  # ][ #  # ]:          0 :     sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
                 [ #  # ]
      57         [ #  # ]:          0 :     for(sal_Int16 i = 0; i < nLength; ++i)
      58                 :            :     {
      59                 :          0 :         ::rtl::OUString sLocalName;
      60 [ #  # ][ #  # ]:          0 :         rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
      61         [ #  # ]:          0 :         sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
      62 [ #  # ][ #  # ]:          0 :         rtl::OUString sValue = _xAttrList->getValueByIndex( i );
      63                 :            : 
      64         [ #  # ]:          0 :         switch( rTokenMap.Get( nPrefix, sLocalName ) )
              [ #  #  # ]
      65                 :            :         {
      66                 :            :             case XML_TOK_COMMAND:
      67                 :          0 :                 m_sCommand = sValue;
      68                 :          0 :                 break;
      69                 :            :             case XML_TOK_ESCAPE_PROCESSING:
      70                 :          0 :                 m_bEscapeProcessing = sValue == "true";
      71                 :          0 :                 break;
      72                 :            :         }
      73                 :          0 :     }
      74                 :          0 : }
      75                 :            : // -----------------------------------------------------------------------------
      76                 :            : 
      77                 :          0 : OXMLQuery::~OXMLQuery()
      78                 :            : {
      79                 :            : 
      80                 :            :     DBG_DTOR(OXMLQuery,NULL);
      81         [ #  # ]:          0 : }
      82                 :            : // -----------------------------------------------------------------------------
      83                 :          0 : SvXMLImportContext* OXMLQuery::CreateChildContext(
      84                 :            :         sal_uInt16 nPrefix,
      85                 :            :         const ::rtl::OUString& rLocalName,
      86                 :            :         const Reference< XAttributeList > & xAttrList )
      87                 :            : {
      88                 :          0 :     SvXMLImportContext* pContext = OXMLTable::CreateChildContext(nPrefix, rLocalName,xAttrList );
      89         [ #  # ]:          0 :     if ( !pContext )
      90                 :            :     {
      91                 :          0 :         const SvXMLTokenMap& rTokenMap = GetOwnImport().GetQueryElemTokenMap();
      92                 :            : 
      93         [ #  # ]:          0 :         switch( rTokenMap.Get( nPrefix, rLocalName ) )
      94                 :            :         {
      95                 :            :             case XML_TOK_UPDATE_TABLE:
      96                 :            :                 {
      97 [ #  # ][ #  # ]:          0 :                     GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
                 [ #  # ]
      98                 :          0 :                     ::rtl::OUString s1;
      99         [ #  # ]:          0 :                     fillAttributes(nPrefix, rLocalName,xAttrList,s1,m_sTable,m_sSchema,m_sCatalog);
     100                 :            :                 }
     101                 :          0 :                 break;
     102                 :            :         }
     103                 :            :     }
     104                 :            : 
     105         [ #  # ]:          0 :     if( !pContext )
     106         [ #  # ]:          0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
     107                 :            : 
     108                 :          0 :     return pContext;
     109                 :            : }
     110                 :            : // -----------------------------------------------------------------------------
     111                 :          0 : void OXMLQuery::setProperties(Reference< XPropertySet > & _xProp )
     112                 :            : {
     113                 :            :     try
     114                 :            :     {
     115         [ #  # ]:          0 :         if ( _xProp.is() )
     116                 :            :         {
     117         [ #  # ]:          0 :             OXMLTable::setProperties(_xProp);
     118                 :            : 
     119 [ #  # ][ #  # ]:          0 :             _xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(m_sCommand));
         [ #  # ][ #  # ]
     120 [ #  # ][ #  # ]:          0 :             _xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,makeAny(m_bEscapeProcessing));
         [ #  # ][ #  # ]
     121                 :            : 
     122         [ #  # ]:          0 :             if ( !m_sTable.isEmpty() )
     123 [ #  # ][ #  # ]:          0 :                 _xProp->setPropertyValue(PROPERTY_UPDATE_TABLENAME,makeAny(m_sTable));
         [ #  # ][ #  # ]
     124         [ #  # ]:          0 :             if ( !m_sCatalog.isEmpty() )
     125 [ #  # ][ #  # ]:          0 :                 _xProp->setPropertyValue(PROPERTY_UPDATE_CATALOGNAME,makeAny(m_sCatalog));
         [ #  # ][ #  # ]
     126         [ #  # ]:          0 :             if ( !m_sSchema.isEmpty() )
     127 [ #  # ][ #  # ]:          0 :                 _xProp->setPropertyValue(PROPERTY_UPDATE_SCHEMANAME,makeAny(m_sSchema));
         [ #  # ][ #  # ]
     128                 :            : 
     129         [ #  # ]:          0 :             const ODBFilter::TPropertyNameMap& rSettings = GetOwnImport().getQuerySettings();
     130         [ #  # ]:          0 :             ODBFilter::TPropertyNameMap::const_iterator aFind = rSettings.find(m_sName);
     131         [ #  # ]:          0 :             if ( aFind != rSettings.end() )
     132 [ #  # ][ #  # ]:          0 :                 _xProp->setPropertyValue(PROPERTY_LAYOUTINFORMATION,makeAny(aFind->second));
         [ #  # ][ #  # ]
                 [ #  # ]
     133                 :            :         }
     134                 :            :     }
     135                 :          0 :     catch(Exception&)
     136                 :            :     {
     137                 :            :         OSL_FAIL("OXMLTable::EndElement -> exception catched");
     138                 :            :     }
     139                 :          0 : }
     140                 :            : //----------------------------------------------------------------------------
     141                 :            : } // namespace dbaxml
     142                 :            : // -----------------------------------------------------------------------------
     143                 :            : 
     144                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10