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

Generated by: LCOV version 1.10