LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlMasterFields.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 36 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 4 0.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             : #include "xmlMasterFields.hxx"
      20             : #include "xmlfilter.hxx"
      21             : #include <xmloff/xmltoken.hxx>
      22             : #include <xmloff/xmlnmspe.hxx>
      23             : #include <xmloff/nmspmap.hxx>
      24             : #include "xmlEnums.hxx"
      25             : #include "xmlReport.hxx"
      26             : #include <tools/debug.hxx>
      27             : 
      28             : 
      29             : namespace rptxml
      30             : {
      31             :     using namespace ::com::sun::star;
      32             :     using namespace ::com::sun::star::report;
      33             :     using namespace ::com::sun::star::uno;
      34             :     using namespace ::com::sun::star::xml::sax;
      35             : 
      36           0 : OXMLMasterFields::OXMLMasterFields( ORptFilter& rImport,
      37             :                 sal_uInt16 nPrfx, const OUString& rLName,
      38             :                 const Reference< XAttributeList > & _xAttrList
      39             :                 ,IMasterDetailFieds* _pReport
      40             :                 ) :
      41             :     SvXMLImportContext( rImport, nPrfx, rLName)
      42           0 : ,m_pReport(_pReport)
      43             : {
      44             : 
      45           0 :     const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
      46           0 :     const SvXMLTokenMap& rTokenMap = rImport.GetSubDocumentElemTokenMap();
      47             : 
      48           0 :     OUString sMasterField,sDetailField;
      49           0 :     const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
      50           0 :     for(sal_Int16 i = 0; i < nLength; ++i)
      51             :     {
      52           0 :         OUString sLocalName;
      53           0 :         const OUString sAttrName = _xAttrList->getNameByIndex( i );
      54           0 :         const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
      55           0 :         const OUString sValue = _xAttrList->getValueByIndex( i );
      56             : 
      57           0 :         switch( rTokenMap.Get( nPrefix, sLocalName ) )
      58             :         {
      59             :             case XML_TOK_MASTER:
      60           0 :                 sMasterField = sValue;
      61           0 :                 break;
      62             :             case XML_TOK_SUB_DETAIL:
      63           0 :                 sDetailField = sValue;
      64           0 :                 break;
      65             :             default:
      66           0 :                 break;
      67             :         }
      68           0 :     }
      69           0 :     if ( sDetailField.isEmpty() )
      70           0 :         sDetailField = sMasterField;
      71           0 :     if ( !sMasterField.isEmpty() )
      72           0 :         m_pReport->addMasterDetailPair(::std::pair< OUString,OUString >(sMasterField,sDetailField));
      73           0 : }
      74             : 
      75             : 
      76           0 : OXMLMasterFields::~OXMLMasterFields()
      77             : {
      78           0 : }
      79             : 
      80             : 
      81           0 : SvXMLImportContext* OXMLMasterFields::CreateChildContext(
      82             :         sal_uInt16 _nPrefix,
      83             :         const OUString& _rLocalName,
      84             :         const Reference< XAttributeList > & xAttrList )
      85             : {
      86           0 :     SvXMLImportContext *pContext = 0;
      87           0 :     const SvXMLTokenMap&    rTokenMap   = static_cast<ORptFilter&>(GetImport()).GetSubDocumentElemTokenMap();
      88             : 
      89           0 :     switch( rTokenMap.Get( _nPrefix, _rLocalName ) )
      90             :     {
      91             :         case XML_TOK_MASTER_DETAIL_FIELD:
      92             :             {
      93           0 :                 GetImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      94           0 :                 pContext = new OXMLMasterFields(static_cast<ORptFilter&>(GetImport()), _nPrefix, _rLocalName,xAttrList ,m_pReport);
      95             :             }
      96           0 :             break;
      97             :         default:
      98           0 :             break;
      99             :     }
     100             : 
     101           0 :     if( !pContext )
     102           0 :         pContext = new SvXMLImportContext( GetImport(), _nPrefix, _rLocalName );
     103             : 
     104           0 :     return pContext;
     105             : }
     106             : 
     107             : 
     108             : } // namespace rptxml
     109             : 
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11