LCOV - code coverage report
Current view: top level - libreoffice/reportdesign/source/filter/xml - xmlExportDocumentHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 253 0.0 %
Date: 2012-12-27 Functions: 0 27 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             : 
      20             : #include "xmlExportDocumentHandler.hxx"
      21             : #include <com/sun/star/sdb/CommandType.hpp>
      22             : #include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp>
      23             : #include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
      24             : #include <com/sun/star/reflection/ProxyFactory.hpp>
      25             : #include <com/sun/star/sdb/CommandType.hpp>
      26             : #include <comphelper/sequence.hxx>
      27             : #include <comphelper/sequenceashashmap.hxx>
      28             : #include <comphelper/documentconstants.hxx>
      29             : #include <xmloff/attrlist.hxx>
      30             : #include <xmloff/xmltoken.hxx>
      31             : #include <xmloff/xmlement.hxx>
      32             : #include <xmloff/xmluconv.hxx>
      33             : #include <unotools/saveopt.hxx>
      34             : #include <rtl/ustrbuf.hxx>
      35             : #include <connectivity/dbtools.hxx>
      36             : #include <rtl/ustrbuf.hxx>
      37             : 
      38             : namespace rptxml
      39             : {
      40             : using namespace ::com::sun::star;
      41             : using namespace ::xmloff::token;
      42             : 
      43           0 : void lcl_exportPrettyPrinting(const uno::Reference< xml::sax::XDocumentHandler >& _xDelegatee)
      44             : {
      45           0 :     SvtSaveOptions aSaveOpt;
      46           0 :     if ( aSaveOpt.IsPrettyPrinting() )
      47             :     {
      48           0 :         static const ::rtl::OUString s_sWhitespaces(RTL_CONSTASCII_USTRINGPARAM(" "));
      49           0 :         _xDelegatee->ignorableWhitespace(s_sWhitespaces);
      50           0 :     }
      51           0 : }
      52             : 
      53           0 : ::rtl::OUString lcl_createAttribute(const xmloff::token::XMLTokenEnum& _eNamespace,const xmloff::token::XMLTokenEnum& _eAttribute)
      54             : {
      55           0 :     ::rtl::OUStringBuffer sQName;
      56             :     // ...if it's in our map, make the prefix
      57           0 :     sQName.append ( xmloff::token::GetXMLToken(_eNamespace) );
      58           0 :     sQName.append ( sal_Unicode(':') );
      59           0 :     sQName.append ( xmloff::token::GetXMLToken(_eAttribute) );
      60           0 :     return sQName.makeStringAndClear();
      61             : }
      62             : 
      63           0 : void lcl_correctCellAddress(const ::rtl::OUString & _sName, const uno::Reference< xml::sax::XAttributeList > & xAttribs)
      64             : {
      65           0 :     SvXMLAttributeList* pList = SvXMLAttributeList::getImplementation(xAttribs);
      66           0 :     ::rtl::OUString sCellAddress = pList->getValueByName(_sName);
      67           0 :     const sal_Int32 nPos = sCellAddress.lastIndexOf('$');
      68           0 :     if ( nPos != -1 )
      69             :     {
      70           0 :         sCellAddress = sCellAddress.copy(0,nPos);
      71           0 :         sCellAddress += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$65535"));
      72           0 :         pList->RemoveAttribute(_sName);
      73           0 :         pList->AddAttribute(_sName,sCellAddress);
      74           0 :     }
      75           0 : }
      76             : 
      77           0 : ExportDocumentHandler::ExportDocumentHandler(uno::Reference< uno::XComponentContext > const & context) :
      78             :     m_xContext(context)
      79             :     ,m_nCurrentCellIndex(0)
      80             :     ,m_nColumnCount(0)
      81             :     ,m_bTableRowsStarted(false)
      82             :     ,m_bFirstRowExported(false)
      83             :     ,m_bExportChar(false)
      84           0 :     ,m_bCountColumnHeader(false)
      85             : {
      86           0 : }
      87             : // -----------------------------------------------------------------------------
      88           0 : ExportDocumentHandler::~ExportDocumentHandler()
      89             : {
      90           0 :     if ( m_xProxy.is() )
      91             :     {
      92           0 :         m_xProxy->setDelegator( NULL );
      93           0 :         m_xProxy.clear();
      94             :     }
      95           0 : }
      96           0 : IMPLEMENT_GET_IMPLEMENTATION_ID(ExportDocumentHandler)
      97           0 : IMPLEMENT_FORWARD_REFCOUNT( ExportDocumentHandler, ExportDocumentHandler_BASE )
      98             : //------------------------------------------------------------------------
      99           0 : ::rtl::OUString SAL_CALL ExportDocumentHandler::getImplementationName(  ) throw(uno::RuntimeException)
     100             : {
     101           0 :     return getImplementationName_Static();
     102             : }
     103             : 
     104             : //------------------------------------------------------------------------
     105           0 : sal_Bool SAL_CALL ExportDocumentHandler::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException)
     106             : {
     107           0 :     return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_static());
     108             : }
     109             : 
     110             : //------------------------------------------------------------------------
     111           0 : uno::Sequence< ::rtl::OUString > SAL_CALL ExportDocumentHandler::getSupportedServiceNames(  ) throw(uno::RuntimeException)
     112             : {
     113           0 :     uno::Sequence< ::rtl::OUString > aSupported;
     114           0 :     if ( m_xServiceInfo.is() )
     115           0 :         aSupported = m_xServiceInfo->getSupportedServiceNames();
     116           0 :     return ::comphelper::concatSequences(getSupportedServiceNames_static(),aSupported);
     117             : }
     118             : 
     119             : //------------------------------------------------------------------------
     120           0 : ::rtl::OUString ExportDocumentHandler::getImplementationName_Static(  ) throw(uno::RuntimeException)
     121             : {
     122           0 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.ExportDocumentHandler"));
     123             : }
     124             : 
     125             : //------------------------------------------------------------------------
     126           0 : uno::Sequence< ::rtl::OUString > ExportDocumentHandler::getSupportedServiceNames_static(  ) throw(uno::RuntimeException)
     127             : {
     128           0 :     uno::Sequence< ::rtl::OUString > aSupported(1);
     129           0 :     aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ExportDocumentHandler"));
     130           0 :     return aSupported;
     131             : }
     132             : 
     133             : //------------------------------------------------------------------------
     134           0 : uno::Reference< uno::XInterface > SAL_CALL ExportDocumentHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
     135             : {
     136           0 :     return *(new ExportDocumentHandler( _rxContext ));
     137             : }
     138             : // xml::sax::XDocumentHandler:
     139           0 : void SAL_CALL ExportDocumentHandler::startDocument() throw (uno::RuntimeException, xml::sax::SAXException)
     140             : {
     141           0 :     m_xDelegatee->startDocument();
     142           0 : }
     143             : 
     144           0 : void SAL_CALL ExportDocumentHandler::endDocument() throw (uno::RuntimeException, xml::sax::SAXException)
     145             : {
     146           0 :     m_xDelegatee->endDocument();
     147           0 : }
     148             : 
     149           0 : void SAL_CALL ExportDocumentHandler::startElement(const ::rtl::OUString & _sName, const uno::Reference< xml::sax::XAttributeList > & xAttribs) throw (uno::RuntimeException, xml::sax::SAXException)
     150             : {
     151           0 :     bool bExport = true;
     152           0 :     if ( _sName == "office:chart" )
     153             :     {
     154           0 :         SvXMLAttributeList* pList = new SvXMLAttributeList();
     155           0 :         uno::Reference< xml::sax::XAttributeList > xNewAttribs = pList;
     156           0 :         ::rtl::OUStringBuffer sValue;
     157             :         static SvXMLEnumMapEntry aXML_CommnadTypeEnumMap[] =
     158             :         {
     159             :             { XML_TABLE, sdb::CommandType::TABLE },
     160             :             { XML_QUERY, sdb::CommandType::QUERY },
     161             :             { XML_TOKEN_INVALID, 0 }
     162             :         };
     163           0 :         if ( SvXMLUnitConverter::convertEnum( sValue, static_cast<sal_uInt16>(m_xDatabaseDataProvider->getCommandType()),aXML_CommnadTypeEnumMap ) )
     164             :         {
     165           0 :             pList->AddAttribute(lcl_createAttribute(XML_NP_RPT,XML_COMMAND_TYPE),sValue.makeStringAndClear());
     166             :         }
     167           0 :         const ::rtl::OUString sComamnd = m_xDatabaseDataProvider->getCommand();
     168           0 :         if ( !sComamnd.isEmpty() )
     169           0 :             pList->AddAttribute(lcl_createAttribute(XML_NP_RPT,XML_COMMAND),sComamnd);
     170             : 
     171           0 :         const ::rtl::OUString sFilter( m_xDatabaseDataProvider->getFilter() );
     172           0 :         if ( !sFilter.isEmpty() )
     173           0 :             pList->AddAttribute(lcl_createAttribute(XML_NP_RPT,XML_FILTER),sFilter);
     174             : 
     175           0 :         const sal_Bool bEscapeProcessing( m_xDatabaseDataProvider->getEscapeProcessing() );
     176           0 :         if ( !bEscapeProcessing )
     177           0 :             pList->AddAttribute(lcl_createAttribute(XML_NP_RPT,XML_ESCAPE_PROCESSING),::xmloff::token::GetXMLToken( XML_FALSE ));
     178             : 
     179           0 :         pList->AddAttribute(lcl_createAttribute(XML_NP_OFFICE,XML_MIMETYPE),MIMETYPE_OASIS_OPENDOCUMENT_CHART);
     180             : 
     181           0 :         m_xDelegatee->startElement(lcl_createAttribute(XML_NP_OFFICE,XML_REPORT),xNewAttribs);
     182             : 
     183           0 :         const ::rtl::OUString sTableCalc = lcl_createAttribute(XML_NP_TABLE,XML_CALCULATION_SETTINGS);
     184           0 :         m_xDelegatee->startElement(sTableCalc,NULL);
     185           0 :         pList = new SvXMLAttributeList();
     186           0 :         uno::Reference< xml::sax::XAttributeList > xNullAttr = pList;
     187           0 :         pList->AddAttribute(lcl_createAttribute(XML_NP_TABLE,XML_DATE_VALUE),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1900-01-01")));
     188             : 
     189           0 :         const ::rtl::OUString sNullDate = lcl_createAttribute(XML_NP_TABLE,XML_NULL_DATE);
     190           0 :         m_xDelegatee->startElement(sNullDate,xNullAttr);
     191           0 :         m_xDelegatee->endElement(sNullDate);
     192           0 :         m_xDelegatee->endElement(sTableCalc);
     193           0 :         bExport = false;
     194             :     }
     195           0 :     else if ( _sName == "table:table" )
     196             :     {
     197           0 :         m_xDelegatee->startElement(lcl_createAttribute(XML_NP_RPT,XML_DETAIL),NULL);
     198           0 :         lcl_exportPrettyPrinting(m_xDelegatee);
     199             :     }
     200           0 :     else if ( _sName == "table:table-header-rows" )
     201             :     {
     202           0 :         m_bCountColumnHeader = true;
     203             :     }
     204           0 :     else if ( m_bCountColumnHeader && _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("table:table-cell")) )
     205             :     {
     206           0 :         ++m_nColumnCount;
     207             :     }
     208           0 :     else if ( _sName == "table:table-rows" )
     209             :     {
     210           0 :         m_xDelegatee->startElement(_sName,xAttribs);
     211           0 :         exportTableRows();
     212           0 :         bExport = false;
     213           0 :         m_bTableRowsStarted = true;
     214           0 :         m_bFirstRowExported = true;
     215             :     }
     216           0 :     else if ( m_bTableRowsStarted && m_bFirstRowExported && (_sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("table:table-row")) || _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("table:table-cell"))) )
     217           0 :         bExport = false;
     218           0 :     else if ( _sName == "chart:plot-area" )
     219             :     {
     220           0 :         SvXMLAttributeList* pList = SvXMLAttributeList::getImplementation(xAttribs);
     221           0 :         pList->RemoveAttribute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("table:cell-range-address")));
     222             :     }
     223           0 :     else if ( _sName == "chart:categories" )
     224             :     {
     225           0 :         static ::rtl::OUString s_sCellAddress(lcl_createAttribute(XML_NP_TABLE,XML_CELL_RANGE_ADDRESS));
     226           0 :         lcl_correctCellAddress(s_sCellAddress,xAttribs);
     227             :     }
     228           0 :     else if ( _sName == "chart:series" )
     229             :     {
     230           0 :         static ::rtl::OUString s_sCellAddress(lcl_createAttribute(XML_NP_CHART,XML_VALUES_CELL_RANGE_ADDRESS));
     231           0 :         lcl_correctCellAddress(s_sCellAddress,xAttribs);
     232             :     }
     233           0 :     else if ( m_bTableRowsStarted && !m_bFirstRowExported && _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("table:table-cell")) )
     234             :     {
     235           0 :         SvXMLAttributeList* pList = SvXMLAttributeList::getImplementation(xAttribs);
     236           0 :         static ::rtl::OUString s_sValue(lcl_createAttribute(XML_NP_OFFICE,XML_VALUE));
     237           0 :         pList->RemoveAttribute(s_sValue);
     238             :     }
     239           0 :     else if ( m_bTableRowsStarted && _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("text:p")) )
     240             :     {
     241           0 :         bExport = false;
     242             :     }
     243           0 :     if ( bExport )
     244           0 :         m_xDelegatee->startElement(_sName,xAttribs);
     245           0 : }
     246             : // -----------------------------------------------------------------------------
     247           0 : void SAL_CALL ExportDocumentHandler::endElement(const ::rtl::OUString & _sName) throw (uno::RuntimeException, xml::sax::SAXException)
     248             : {
     249           0 :     bool bExport = true;
     250           0 :     ::rtl::OUString sNewName = _sName;
     251           0 :     if ( _sName == "office:chart" )
     252             :     {
     253           0 :         sNewName = lcl_createAttribute(XML_NP_OFFICE,XML_REPORT);
     254             :     }
     255           0 :     else if ( _sName == "table:table" )
     256             :     {
     257           0 :         m_xDelegatee->endElement(_sName);
     258           0 :         lcl_exportPrettyPrinting(m_xDelegatee);
     259           0 :         sNewName = lcl_createAttribute(XML_NP_RPT,XML_DETAIL);
     260             :     }
     261           0 :     else if ( _sName == "table:table-header-rows" )
     262             :     {
     263           0 :         m_bCountColumnHeader = false;
     264             :     }
     265           0 :     else if ( _sName == "table:table-rows" )
     266           0 :         m_bTableRowsStarted = false;
     267           0 :     else if ( m_bTableRowsStarted && m_bFirstRowExported && (_sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("table:table-row")) || _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("table:table-cell"))) )
     268           0 :         bExport = false;
     269           0 :     else if ( m_bTableRowsStarted && _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("table:table-row")) )
     270           0 :         m_bFirstRowExported = true;
     271           0 :     else if ( m_bTableRowsStarted && _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("text:p")) )
     272             :     {
     273           0 :         bExport = !m_bFirstRowExported;
     274             :     }
     275             : 
     276           0 :     if ( bExport )
     277           0 :         m_xDelegatee->endElement(sNewName);
     278           0 : }
     279             : 
     280           0 : void SAL_CALL ExportDocumentHandler::characters(const ::rtl::OUString & aChars) throw (uno::RuntimeException, xml::sax::SAXException)
     281             : {
     282           0 :     if ( !(m_bTableRowsStarted || m_bFirstRowExported) )
     283             :     {
     284           0 :         m_xDelegatee->characters(aChars);
     285             :     }
     286           0 :     else if ( m_bExportChar )
     287             :     {
     288           0 :         static const ::rtl::OUString s_sZero(RTL_CONSTASCII_USTRINGPARAM("0"));
     289           0 :         m_xDelegatee->characters(s_sZero);
     290             :     }
     291           0 : }
     292             : 
     293           0 : void SAL_CALL ExportDocumentHandler::ignorableWhitespace(const ::rtl::OUString & aWhitespaces) throw (uno::RuntimeException, xml::sax::SAXException)
     294             : {
     295           0 :     m_xDelegatee->ignorableWhitespace(aWhitespaces);
     296           0 : }
     297             : 
     298           0 : void SAL_CALL ExportDocumentHandler::processingInstruction(const ::rtl::OUString & aTarget, const ::rtl::OUString & aData) throw (uno::RuntimeException, xml::sax::SAXException)
     299             : {
     300           0 :     m_xDelegatee->processingInstruction(aTarget,aData);
     301           0 : }
     302             : 
     303           0 : void SAL_CALL ExportDocumentHandler::setDocumentLocator(const uno::Reference< xml::sax::XLocator > & xLocator) throw (uno::RuntimeException, xml::sax::SAXException)
     304             : {
     305           0 :     m_xDelegatee->setDocumentLocator(xLocator);
     306           0 : }
     307           0 : void SAL_CALL ExportDocumentHandler::initialize( const uno::Sequence< uno::Any >& _aArguments ) throw (uno::Exception, uno::RuntimeException)
     308             : {
     309           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     310           0 :     comphelper::SequenceAsHashMap aArgs(_aArguments);
     311           0 :     m_xDelegatee = aArgs.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentHandler")),m_xDelegatee);
     312           0 :     m_xModel = aArgs.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model")),m_xModel);
     313             : 
     314             :     OSL_ENSURE(m_xDelegatee.is(),"No document handler avialable!");
     315           0 :     if ( !m_xDelegatee.is() || !m_xModel.is() )
     316           0 :         throw uno::Exception();
     317             : 
     318           0 :     m_xDatabaseDataProvider.set(m_xModel->getDataProvider(),uno::UNO_QUERY);
     319           0 :     if ( !m_xDatabaseDataProvider.is() || !m_xDatabaseDataProvider->getActiveConnection().is() )
     320           0 :         throw uno::Exception();
     321             : 
     322           0 :     uno::Reference< reflection::XProxyFactory > xProxyFactory = reflection::ProxyFactory::create( m_xContext );
     323           0 :     m_xProxy = xProxyFactory->createProxy(m_xDelegatee.get());
     324           0 :     ::comphelper::query_aggregation(m_xProxy,m_xDelegatee);
     325           0 :     m_xTypeProvider.set(m_xDelegatee,uno::UNO_QUERY);
     326           0 :     m_xServiceInfo.set(m_xDelegatee,uno::UNO_QUERY);
     327             : 
     328             :     // set ourself as delegator
     329           0 :     m_xProxy->setDelegator( *this );
     330           0 :     const ::rtl::OUString sCommand = m_xDatabaseDataProvider->getCommand();
     331           0 :     if ( !sCommand.isEmpty() )
     332           0 :         m_aColumns = ::dbtools::getFieldNamesByCommandDescriptor(m_xDatabaseDataProvider->getActiveConnection()
     333           0 :                     ,m_xDatabaseDataProvider->getCommandType()
     334           0 :                     ,sCommand);
     335             : 
     336           0 :     uno::Reference< chart::XComplexDescriptionAccess > xDataProvider(m_xDatabaseDataProvider,uno::UNO_QUERY);
     337           0 :     if ( xDataProvider.is() )
     338             :     {
     339           0 :         m_aColumns.realloc(1);
     340           0 :         uno::Sequence< ::rtl::OUString > aColumnNames = xDataProvider->getColumnDescriptions();
     341           0 :         for(sal_Int32 i = 0 ; i < aColumnNames.getLength();++i)
     342             :         {
     343           0 :             if ( !aColumnNames[i].isEmpty() )
     344             :             {
     345           0 :                 sal_Int32 nCount = m_aColumns.getLength();
     346           0 :                 m_aColumns.realloc(nCount+1);
     347           0 :                 m_aColumns[nCount] = aColumnNames[i];
     348             :             }
     349           0 :         }
     350           0 :     }
     351           0 : }
     352             : // --------------------------------------------------------------------------------
     353           0 : uno::Any SAL_CALL ExportDocumentHandler::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException)
     354             : {
     355           0 :     uno::Any aReturn = ExportDocumentHandler_BASE::queryInterface(_rType);
     356           0 :     return aReturn.hasValue() ? aReturn : (m_xProxy.is() ? m_xProxy->queryAggregation(_rType) : aReturn);
     357             : }
     358             : // --------------------------------------------------------------------------------
     359           0 : uno::Sequence< uno::Type > SAL_CALL ExportDocumentHandler::getTypes(  ) throw (uno::RuntimeException)
     360             : {
     361           0 :     if ( m_xTypeProvider.is() )
     362             :         return ::comphelper::concatSequences(
     363             :             ExportDocumentHandler_BASE::getTypes(),
     364           0 :             m_xTypeProvider->getTypes()
     365           0 :         );
     366           0 :     return ExportDocumentHandler_BASE::getTypes();
     367             : }
     368             : // -----------------------------------------------------------------------------
     369           0 : void ExportDocumentHandler::exportTableRows()
     370             : {
     371           0 :     const ::rtl::OUString sRow( lcl_createAttribute(XML_NP_TABLE, XML_TABLE_ROW) );
     372           0 :     m_xDelegatee->startElement(sRow,NULL);
     373             : 
     374           0 :     const ::rtl::OUString sValueType( lcl_createAttribute(XML_NP_OFFICE, XML_VALUE_TYPE) );
     375             : 
     376           0 :     const static ::rtl::OUString s_sFieldPrefix(RTL_CONSTASCII_USTRINGPARAM("field:["));
     377           0 :     const static ::rtl::OUString s_sFieldPostfix(RTL_CONSTASCII_USTRINGPARAM("]"));
     378           0 :     const ::rtl::OUString sCell( lcl_createAttribute(XML_NP_TABLE, XML_TABLE_CELL) );
     379           0 :     const ::rtl::OUString sP( lcl_createAttribute(XML_NP_TEXT, XML_P) );
     380           0 :     const ::rtl::OUString sFtext(lcl_createAttribute(XML_NP_RPT,XML_FORMATTED_TEXT) );
     381           0 :     const ::rtl::OUString sRElement(lcl_createAttribute(XML_NP_RPT,XML_REPORT_ELEMENT) );
     382           0 :     const ::rtl::OUString sRComponent( lcl_createAttribute(XML_NP_RPT,XML_REPORT_COMPONENT) ) ;
     383           0 :     const ::rtl::OUString sFormulaAttrib( lcl_createAttribute(XML_NP_RPT,XML_FORMULA) );
     384           0 :     const static ::rtl::OUString s_sString(RTL_CONSTASCII_USTRINGPARAM("string"));
     385           0 :     const static ::rtl::OUString s_sFloat(RTL_CONSTASCII_USTRINGPARAM("float"));
     386             : 
     387           0 :     SvXMLAttributeList* pCellAtt = new SvXMLAttributeList();
     388           0 :     uno::Reference< xml::sax::XAttributeList > xCellAtt = pCellAtt;
     389           0 :     pCellAtt->AddAttribute(sValueType,s_sString);
     390             : 
     391           0 :     bool bRemoveString = true;
     392           0 :     ::rtl::OUString sFormula;
     393           0 :     const sal_Int32 nCount = m_aColumns.getLength();
     394           0 :     if ( m_nColumnCount > nCount )
     395             :     {
     396           0 :         const sal_Int32 nEmptyCellCount = m_nColumnCount - nCount;
     397           0 :         for(sal_Int32 i = 0; i < nEmptyCellCount ; ++i)
     398             :         {
     399           0 :             m_xDelegatee->startElement(sCell,xCellAtt);
     400           0 :             if ( bRemoveString )
     401             :             {
     402           0 :                 bRemoveString = false;
     403           0 :                 pCellAtt->RemoveAttribute(sValueType);
     404           0 :                 pCellAtt->AddAttribute(sValueType,s_sFloat);
     405             :             }
     406           0 :             m_xDelegatee->startElement(sP,NULL);
     407           0 :             m_xDelegatee->endElement(sP);
     408           0 :             m_xDelegatee->endElement(sCell);
     409             :         }
     410             :     }
     411           0 :     for(sal_Int32 i = 0; i < nCount ; ++i)
     412             :     {
     413           0 :         sFormula = s_sFieldPrefix;
     414           0 :         sFormula += m_aColumns[i];
     415           0 :         sFormula += s_sFieldPostfix;
     416           0 :         SvXMLAttributeList* pList = new SvXMLAttributeList();
     417           0 :         uno::Reference< xml::sax::XAttributeList > xAttribs = pList;
     418           0 :         pList->AddAttribute(sFormulaAttrib,sFormula);
     419             : 
     420           0 :         m_xDelegatee->startElement(sCell,xCellAtt);
     421           0 :         if ( bRemoveString )
     422             :         {
     423           0 :             bRemoveString = false;
     424           0 :             pCellAtt->RemoveAttribute(sValueType);
     425           0 :             pCellAtt->AddAttribute(sValueType,s_sFloat);
     426             :         }
     427           0 :         m_xDelegatee->startElement(sP,NULL);
     428           0 :         m_xDelegatee->startElement(sFtext,xAttribs);
     429           0 :         m_xDelegatee->startElement(sRElement,NULL);
     430           0 :         m_xDelegatee->startElement(sRComponent,NULL);
     431             : 
     432           0 :         m_xDelegatee->endElement(sRComponent);
     433           0 :         m_xDelegatee->endElement(sRElement);
     434           0 :         m_xDelegatee->endElement(sFtext);
     435           0 :         m_xDelegatee->endElement(sP);
     436           0 :         m_xDelegatee->endElement(sCell);
     437           0 :     }
     438             : 
     439           0 :     m_xDelegatee->endElement(sRow);
     440           0 : }
     441             : // -----------------------------------------------------------------------------
     442             : } // namespace rptxml
     443             : // -----------------------------------------------------------------------------
     444             : 
     445             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10