LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlSection.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 42 0.0 %
Date: 2012-08-25 Functions: 0 6 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 "xmlSection.hxx"
      29                 :            : #include "xmlfilter.hxx"
      30                 :            : #include <xmloff/xmltoken.hxx>
      31                 :            : #include <xmloff/xmlnmspe.hxx>
      32                 :            : #include <xmloff/nmspmap.hxx>
      33                 :            : #include <xmloff/xmluconv.hxx>
      34                 :            : #include "xmlHelper.hxx"
      35                 :            : #include "xmlEnums.hxx"
      36                 :            : #include "xmlColumn.hxx"
      37                 :            : #include "xmlCondPrtExpr.hxx"
      38                 :            : #include "xmlStyleImport.hxx"
      39                 :            : #include <connectivity/dbtools.hxx>
      40                 :            : #include <tools/debug.hxx>
      41                 :            : #include <com/sun/star/report/ReportPrintOption.hpp>
      42                 :            : #include "xmlstrings.hrc"
      43                 :            : #include "xmlTable.hxx"
      44                 :            : 
      45                 :            : 
      46                 :            : namespace rptxml
      47                 :            : {
      48                 :            :     using namespace ::xmloff;
      49                 :            :     using namespace ::com::sun::star;
      50                 :            :     using namespace ::com::sun::star::uno;
      51                 :            :     using namespace ::com::sun::star::xml::sax;
      52                 :            : 
      53                 :          0 :       sal_uInt16 lcl_getReportPrintOption(const ::rtl::OUString& _sValue)
      54                 :            :     {
      55                 :          0 :         sal_uInt16 nRet = report::ReportPrintOption::ALL_PAGES;
      56         [ #  # ]:          0 :         const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetReportPrintOptions();
      57         [ #  # ]:          0 :         SvXMLUnitConverter::convertEnum( nRet, _sValue, aXML_EnumMap );
      58                 :          0 :         return nRet;
      59                 :            :     }
      60                 :            : 
      61                 :            : 
      62                 :            : DBG_NAME( rpt_OXMLSection )
      63                 :            : 
      64                 :          0 : OXMLSection::OXMLSection( ORptFilter& rImport,
      65                 :            :                 sal_uInt16 nPrfx, const ::rtl::OUString& _sLocalName,
      66                 :            :                 const uno::Reference< xml::sax::XAttributeList > & _xAttrList
      67                 :            :                 ,const uno::Reference< report::XSection >& _xSection
      68                 :            :                 ,sal_Bool _bPageHeader)
      69                 :            : :SvXMLImportContext( rImport, nPrfx, _sLocalName )
      70                 :            : ,m_xSection(_xSection)
      71                 :          0 : ,m_bPageHeader(_bPageHeader)
      72                 :            : {
      73                 :            :     DBG_CTOR( rpt_OXMLSection,NULL);
      74                 :            : 
      75                 :            :     OSL_ENSURE(_xAttrList.is(),"Attribute list is NULL!");
      76                 :          0 :     const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
      77         [ #  # ]:          0 :     const SvXMLTokenMap& rTokenMap = rImport.GetSectionElemTokenMap();
      78                 :            : 
      79 [ #  # ][ #  # ]:          0 :     const sal_Int16 nLength = (m_xSection.is() && _xAttrList.is()) ? _xAttrList->getLength() : 0;
         [ #  # ][ #  # ]
      80 [ #  # ][ #  # ]:          0 :     static const ::rtl::OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
         [ #  # ][ #  # ]
      81                 :            :     try
      82                 :            :     {
      83         [ #  # ]:          0 :         for(sal_Int16 i = 0; i < nLength; ++i)
      84                 :            :         {
      85                 :          0 :             rtl::OUString sLocalName;
      86 [ #  # ][ #  # ]:          0 :             const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
      87         [ #  # ]:          0 :             const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
      88 [ #  # ][ #  # ]:          0 :             const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
      89                 :            : 
      90         [ #  # ]:          0 :             switch( rTokenMap.Get( nPrefix, sLocalName ) )
              [ #  #  # ]
      91                 :            :             {
      92                 :            : 
      93                 :            :                 case XML_TOK_PAGE_PRINT_OPTION:
      94         [ #  # ]:          0 :                     if ( _bPageHeader )
      95 [ #  # ][ #  # ]:          0 :                         m_xSection->getReportDefinition()->setPageHeaderOption(lcl_getReportPrintOption(sValue));
         [ #  # ][ #  # ]
                 [ #  # ]
      96                 :            :                     else
      97 [ #  # ][ #  # ]:          0 :                         m_xSection->getReportDefinition()->setPageFooterOption(lcl_getReportPrintOption(sValue));
         [ #  # ][ #  # ]
                 [ #  # ]
      98                 :          0 :                     break;
      99                 :            :                 case XML_TOK_REPEAT_SECTION:
     100 [ #  # ][ #  # ]:          0 :                     m_xSection->setRepeatSection(sValue == s_sTRUE );
     101                 :          0 :                     break;
     102                 :            : 
     103                 :            :                 default:
     104                 :            :                     OSL_FAIL("OXMLSection: Unknown attribute!");
     105                 :            :             }
     106         [ #  # ]:          0 :         }
     107                 :            :     }
     108         [ #  # ]:          0 :     catch(Exception&)
     109                 :            :     {
     110                 :            :         OSL_FAIL("Exception catched while filling the section props");
     111                 :            :     }
     112                 :          0 : }
     113                 :            : // -----------------------------------------------------------------------------
     114                 :          0 : OXMLSection::~OXMLSection()
     115                 :            : {
     116                 :            :     DBG_DTOR( rpt_OXMLSection,NULL);
     117         [ #  # ]:          0 : }
     118                 :            : // -----------------------------------------------------------------------------
     119                 :            : 
     120                 :          0 : SvXMLImportContext* OXMLSection::CreateChildContext(
     121                 :            :         sal_uInt16 _nPrefix,
     122                 :            :         const ::rtl::OUString& _rLocalName,
     123                 :            :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
     124                 :            : {
     125                 :          0 :     SvXMLImportContext *pContext = 0;
     126                 :          0 :     ORptFilter& rImport = GetOwnImport();
     127         [ #  # ]:          0 :     const SvXMLTokenMap&    rTokenMap   = rImport.GetSectionElemTokenMap();
     128         [ #  # ]:          0 :     uno::Reference<lang::XMultiServiceFactory> xFactor = rImport.getServiceFactory();
     129                 :            : 
     130 [ #  # ][ #  # ]:          0 :     switch( rTokenMap.Get( _nPrefix, _rLocalName ) )
     131                 :            :     {
     132                 :            :         case XML_TOK_TABLE:
     133 [ #  # ][ #  # ]:          0 :             pContext = new OXMLTable( rImport, _nPrefix, _rLocalName,xAttrList,m_xSection);
     134                 :          0 :             break;
     135                 :            :         default:
     136                 :          0 :             break;
     137                 :            :     }
     138                 :            : 
     139         [ #  # ]:          0 :     if( !pContext )
     140 [ #  # ][ #  # ]:          0 :         pContext = new SvXMLImportContext( rImport, _nPrefix, _rLocalName );
     141                 :            : 
     142                 :          0 :     return pContext;
     143                 :            : }
     144                 :            : // -----------------------------------------------------------------------------
     145                 :          0 : ORptFilter& OXMLSection::GetOwnImport()
     146                 :            : {
     147                 :          0 :     return static_cast<ORptFilter&>(GetImport());
     148                 :            : }
     149                 :            : // -----------------------------------------------------------------------------
     150                 :            : // -----------------------------------------------------------------------------
     151                 :            : } // namespace rptxml
     152                 :            : // -----------------------------------------------------------------------------
     153                 :            : 
     154                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10