LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlReportElement.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 44 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 5 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 "xmlReportElement.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 "xmlComponent.hxx"
      26             : #include "xmlCondPrtExpr.hxx"
      27             : #include <tools/debug.hxx>
      28             : #include "xmlFormatCondition.hxx"
      29             : 
      30             : 
      31             : namespace rptxml
      32             : {
      33             :     using namespace ::com::sun::star;
      34             :     using namespace report;
      35             :     using namespace uno;
      36             :     using namespace xml::sax;
      37             : 
      38           0 : OXMLReportElement::OXMLReportElement( ORptFilter& rImport,
      39             :                 sal_uInt16 nPrfx, const OUString& rLName,
      40             :                 const Reference< XAttributeList > & _xAttrList
      41             :                 ,const Reference< XReportControlModel > & _xComponent) :
      42             :     SvXMLImportContext( rImport, nPrfx, rLName )
      43           0 : ,m_xComponent(_xComponent)
      44             : {
      45             : 
      46             :     OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
      47           0 :     const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
      48           0 :     const SvXMLTokenMap& rTokenMap = rImport.GetReportElementElemTokenMap();
      49             : 
      50           0 :     static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
      51           0 :     const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
      52             :     try
      53             :     {
      54           0 :         for(sal_Int16 i = 0; i < nLength; ++i)
      55             :         {
      56           0 :             OUString sLocalName;
      57           0 :             const OUString sAttrName = _xAttrList->getNameByIndex( i );
      58           0 :             const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
      59           0 :             const OUString sValue = _xAttrList->getValueByIndex( i );
      60             : 
      61           0 :             switch( rTokenMap.Get( nPrefix, sLocalName ) )
      62             :             {
      63             :                 case XML_TOK_PRINT_WHEN_GROUP_CHANGE:
      64           0 :                     m_xComponent->setPrintWhenGroupChange(s_sTRUE == sValue);
      65           0 :                     break;
      66             :                 case XML_TOK_PRINT_REPEATED_VALUES:
      67           0 :                     m_xComponent->setPrintRepeatedValues(sValue == s_sTRUE);
      68           0 :                     break;
      69             :                 default:
      70           0 :                     break;
      71             :             }
      72           0 :         }
      73             :     }
      74           0 :     catch(Exception&)
      75             :     {
      76             :         OSL_FAIL("Exception catched while filling the report definition props");
      77             :     }
      78           0 : }
      79             : 
      80             : 
      81           0 : OXMLReportElement::~OXMLReportElement()
      82             : {
      83             : 
      84           0 : }
      85             : 
      86             : 
      87           0 : SvXMLImportContext* OXMLReportElement::CreateChildContext(
      88             :         sal_uInt16 _nPrefix,
      89             :         const OUString& _rLocalName,
      90             :         const Reference< XAttributeList > & xAttrList )
      91             : {
      92           0 :     SvXMLImportContext *pContext = 0;
      93           0 :     ORptFilter& rImport = GetOwnImport();
      94           0 :     const SvXMLTokenMap&    rTokenMap   = rImport.GetReportElementElemTokenMap();
      95             : 
      96           0 :     switch( rTokenMap.Get( _nPrefix, _rLocalName ) )
      97             :     {
      98             :         case XML_TOK_COMPONENT:
      99           0 :             rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
     100           0 :             pContext = new OXMLComponent( rImport, _nPrefix, _rLocalName,xAttrList,m_xComponent.get());
     101           0 :             break;
     102             :         case XML_TOK_REP_CONDITIONAL_PRINT_EXPRESSION:
     103           0 :             rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
     104           0 :             pContext = new OXMLCondPrtExpr( rImport, _nPrefix, _rLocalName,xAttrList,m_xComponent.get());
     105           0 :             break;
     106             :         case XML_TOK_FORMATCONDITION:
     107             :             {
     108           0 :                 uno::Reference< report::XFormatCondition > xNewCond = m_xComponent->createFormatCondition();
     109           0 :                 m_xComponent->insertByIndex(m_xComponent->getCount(),uno::makeAny(xNewCond));
     110           0 :                 rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
     111           0 :                 pContext = new OXMLFormatCondition( rImport, _nPrefix, _rLocalName,xAttrList,xNewCond);
     112             :             }
     113           0 :             break;
     114             :         default:
     115           0 :             break;
     116             :     }
     117             : 
     118           0 :     if( !pContext )
     119           0 :         pContext = new SvXMLImportContext( GetImport(), _nPrefix, _rLocalName );
     120             : 
     121             : 
     122           0 :     return pContext;
     123             : }
     124             : 
     125           0 : ORptFilter& OXMLReportElement::GetOwnImport()
     126             : {
     127           0 :     return static_cast<ORptFilter&>(GetImport());
     128             : }
     129             : 
     130             : } // namespace rptxml
     131             : 
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11