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

Generated by: LCOV version 1.11