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

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #include "xmlReportElement.hxx"
      29                 :            : #include "xmlfilter.hxx"
      30                 :            : #include <xmloff/xmltoken.hxx>
      31                 :            : #include <xmloff/xmlnmspe.hxx>
      32                 :            : #include <xmloff/nmspmap.hxx>
      33                 :            : #include "xmlEnums.hxx"
      34                 :            : #include "xmlComponent.hxx"
      35                 :            : #include "xmlCondPrtExpr.hxx"
      36                 :            : #include <tools/debug.hxx>
      37                 :            : #include "xmlFormatCondition.hxx"
      38                 :            : 
      39                 :            : 
      40                 :            : namespace rptxml
      41                 :            : {
      42                 :            :     using namespace ::com::sun::star;
      43                 :            :     using namespace report;
      44                 :            :     using namespace uno;
      45                 :            :     using namespace xml::sax;
      46                 :            : DBG_NAME( rpt_OXMLReportElement )
      47                 :            : 
      48                 :          0 : OXMLReportElement::OXMLReportElement( ORptFilter& rImport,
      49                 :            :                 sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
      50                 :            :                 const Reference< XAttributeList > & _xAttrList
      51                 :            :                 ,const Reference< XReportControlModel > & _xComponent) :
      52                 :            :     SvXMLImportContext( rImport, nPrfx, rLName )
      53                 :          0 : ,m_xComponent(_xComponent)
      54                 :            : {
      55                 :            :     DBG_CTOR( rpt_OXMLReportElement,NULL);
      56                 :            : 
      57                 :            :     OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
      58                 :          0 :     const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
      59         [ #  # ]:          0 :     const SvXMLTokenMap& rTokenMap = rImport.GetReportElementElemTokenMap();
      60                 :            : 
      61 [ #  # ][ #  # ]:          0 :     static const ::rtl::OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
         [ #  # ][ #  # ]
      62 [ #  # ][ #  # ]:          0 :     const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
                 [ #  # ]
      63                 :            :     try
      64                 :            :     {
      65         [ #  # ]:          0 :         for(sal_Int16 i = 0; i < nLength; ++i)
      66                 :            :         {
      67                 :          0 :          ::rtl::OUString sLocalName;
      68 [ #  # ][ #  # ]:          0 :             const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
      69         [ #  # ]:          0 :             const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
      70 [ #  # ][ #  # ]:          0 :             const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
      71                 :            : 
      72         [ #  # ]:          0 :             switch( rTokenMap.Get( nPrefix, sLocalName ) )
              [ #  #  # ]
      73                 :            :             {
      74                 :            :                 case XML_TOK_PRINT_ONLY_WHEN_GROUP_CHANGE:
      75 [ #  # ][ #  # ]:          0 :                     m_xComponent->setPrintWhenGroupChange(s_sTRUE == sValue);
      76                 :          0 :                     break;
      77                 :            :                    case XML_TOK_PRINT_REPEATED_VALUES:
      78 [ #  # ][ #  # ]:          0 :                     m_xComponent->setPrintRepeatedValues(sValue == s_sTRUE ? sal_True : sal_False);
                 [ #  # ]
      79                 :          0 :                     break;
      80                 :            :                 default:
      81                 :          0 :                     break;
      82                 :            :             }
      83         [ #  # ]:          0 :         }
      84                 :            :     }
      85         [ #  # ]:          0 :     catch(Exception&)
      86                 :            :     {
      87                 :            :         OSL_FAIL("Exception catched while filling the report definition props");
      88                 :            :     }
      89                 :          0 : }
      90                 :            : // -----------------------------------------------------------------------------
      91                 :            : 
      92                 :          0 : OXMLReportElement::~OXMLReportElement()
      93                 :            : {
      94                 :            : 
      95                 :            :     DBG_DTOR( rpt_OXMLReportElement,NULL);
      96         [ #  # ]:          0 : }
      97                 :            : // -----------------------------------------------------------------------------
      98                 :            : 
      99                 :          0 : SvXMLImportContext* OXMLReportElement::CreateChildContext(
     100                 :            :         sal_uInt16 _nPrefix,
     101                 :            :         const ::rtl::OUString& _rLocalName,
     102                 :            :         const Reference< XAttributeList > & xAttrList )
     103                 :            : {
     104                 :          0 :     SvXMLImportContext *pContext = 0;
     105                 :          0 :     ORptFilter& rImport = GetOwnImport();
     106                 :          0 :     const SvXMLTokenMap&    rTokenMap   = rImport.GetReportElementElemTokenMap();
     107                 :            : 
     108   [ #  #  #  # ]:          0 :     switch( rTokenMap.Get( _nPrefix, _rLocalName ) )
     109                 :            :     {
     110                 :            :         case XML_TOK_COMPONENT:
     111                 :          0 :             rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
     112 [ #  # ][ #  # ]:          0 :             pContext = new OXMLComponent( rImport, _nPrefix, _rLocalName,xAttrList,m_xComponent.get());
     113                 :          0 :             break;
     114                 :            :         case XML_TOK_REP_CONDITIONAL_PRINT_EXPRESSION:
     115                 :          0 :             rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
     116 [ #  # ][ #  # ]:          0 :             pContext = new OXMLCondPrtExpr( rImport, _nPrefix, _rLocalName,xAttrList,m_xComponent.get());
                 [ #  # ]
     117                 :          0 :             break;
     118                 :            :         case XML_TOK_FORMATCONDITION:
     119                 :            :             {
     120 [ #  # ][ #  # ]:          0 :                 uno::Reference< report::XFormatCondition > xNewCond = m_xComponent->createFormatCondition();
     121 [ #  # ][ #  # ]:          0 :                 m_xComponent->insertByIndex(m_xComponent->getCount(),uno::makeAny(xNewCond));
         [ #  # ][ #  # ]
                 [ #  # ]
     122 [ #  # ][ #  # ]:          0 :                 rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
     123 [ #  # ][ #  # ]:          0 :                 pContext = new OXMLFormatCondition( rImport, _nPrefix, _rLocalName,xAttrList,xNewCond);
     124                 :            :             }
     125                 :          0 :             break;
     126                 :            :         default:
     127                 :          0 :             break;
     128                 :            :     }
     129                 :            : 
     130         [ #  # ]:          0 :     if( !pContext )
     131         [ #  # ]:          0 :         pContext = new SvXMLImportContext( GetImport(), _nPrefix, _rLocalName );
     132                 :            : 
     133                 :            : 
     134                 :          0 :     return pContext;
     135                 :            : }
     136                 :            : // -----------------------------------------------------------------------------
     137                 :          0 : ORptFilter& OXMLReportElement::GetOwnImport()
     138                 :            : {
     139                 :          0 :     return static_cast<ORptFilter&>(GetImport());
     140                 :            : }
     141                 :            : //----------------------------------------------------------------------------
     142                 :            : } // namespace rptxml
     143                 :            : // -----------------------------------------------------------------------------
     144                 :            : 
     145                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10