LCOV - code coverage report
Current view: top level - libreoffice/reportdesign/source/filter/xml - xmlMasterFields.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-12-27 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             : DBG_NAME( rpt_OXMLMasterFields )
      36             : 
      37           0 : OXMLMasterFields::OXMLMasterFields( ORptFilter& rImport,
      38             :                 sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
      39             :                 const Reference< XAttributeList > & _xAttrList
      40             :                 ,IMasterDetailFieds* _pReport
      41             :                 ) :
      42             :     SvXMLImportContext( rImport, nPrfx, rLName)
      43           0 : ,m_pReport(_pReport)
      44             : {
      45             :     DBG_CTOR( rpt_OXMLMasterFields,NULL);
      46             : 
      47           0 :     const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
      48           0 :     const SvXMLTokenMap& rTokenMap = rImport.GetSubDocumentElemTokenMap();
      49             : 
      50           0 :     ::rtl::OUString sMasterField,sDetailField;
      51           0 :     const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
      52           0 :     for(sal_Int16 i = 0; i < nLength; ++i)
      53             :     {
      54           0 :         ::rtl::OUString sLocalName;
      55           0 :         const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
      56           0 :         const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
      57           0 :         const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
      58             : 
      59           0 :         switch( rTokenMap.Get( nPrefix, sLocalName ) )
      60             :         {
      61             :             case XML_TOK_MASTER:
      62           0 :                 sMasterField = sValue;
      63           0 :                 break;
      64             :             case XML_TOK_SUB_DETAIL:
      65           0 :                 sDetailField = sValue;
      66           0 :                 break;
      67             :             default:
      68           0 :                 break;
      69             :         }
      70           0 :     }
      71           0 :     if ( sDetailField.isEmpty() )
      72           0 :         sDetailField = sMasterField;
      73           0 :     if ( !sMasterField.isEmpty() )
      74           0 :         m_pReport->addMasterDetailPair(::std::pair< ::rtl::OUString,::rtl::OUString >(sMasterField,sDetailField));
      75           0 : }
      76             : // -----------------------------------------------------------------------------
      77             : 
      78           0 : OXMLMasterFields::~OXMLMasterFields()
      79             : {
      80             :     DBG_DTOR( rpt_OXMLMasterFields,NULL);
      81           0 : }
      82             : 
      83             : // -----------------------------------------------------------------------------
      84           0 : SvXMLImportContext* OXMLMasterFields::CreateChildContext(
      85             :         sal_uInt16 _nPrefix,
      86             :         const ::rtl::OUString& _rLocalName,
      87             :         const Reference< XAttributeList > & xAttrList )
      88             : {
      89           0 :     SvXMLImportContext *pContext = 0;
      90           0 :     const SvXMLTokenMap&    rTokenMap   = static_cast<ORptFilter&>(GetImport()).GetSubDocumentElemTokenMap();
      91             : 
      92           0 :     switch( rTokenMap.Get( _nPrefix, _rLocalName ) )
      93             :     {
      94             :         case XML_TOK_MASTER_DETAIL_FIELD:
      95             :             {
      96           0 :                 GetImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      97           0 :                 pContext = new OXMLMasterFields(static_cast<ORptFilter&>(GetImport()), _nPrefix, _rLocalName,xAttrList ,m_pReport);
      98             :             }
      99           0 :             break;
     100             :         default:
     101           0 :             break;
     102             :     }
     103             : 
     104           0 :     if( !pContext )
     105           0 :         pContext = new SvXMLImportContext( GetImport(), _nPrefix, _rLocalName );
     106             : 
     107           0 :     return pContext;
     108             : }
     109             : 
     110             : //----------------------------------------------------------------------------
     111             : } // namespace rptxml
     112             : // -----------------------------------------------------------------------------
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10