LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlImportDocumentHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 207 1.0 %
Date: 2012-08-25 Functions: 1 23 4.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 482 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                 :            : 
      29                 :            : #include "xmlImportDocumentHandler.hxx"
      30                 :            : #include <com/sun/star/sdb/CommandType.hpp>
      31                 :            : #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp>
      32                 :            : #include <com/sun/star/chart2/data/XDataReceiver.hpp>
      33                 :            : #include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
      34                 :            : #include <com/sun/star/chart/ChartDataRowSource.hpp>
      35                 :            : #include <com/sun/star/reflection/XProxyFactory.hpp>
      36                 :            : #include <com/sun/star/sdb/CommandType.hpp>
      37                 :            : #include <comphelper/sequence.hxx>
      38                 :            : #include <comphelper/sequenceashashmap.hxx>
      39                 :            : #include <comphelper/documentconstants.hxx>
      40                 :            : #include <comphelper/namedvaluecollection.hxx>
      41                 :            : #include <xmloff/attrlist.hxx>
      42                 :            : #include <xmloff/xmltoken.hxx>
      43                 :            : #include <xmloff/xmlement.hxx>
      44                 :            : #include <xmloff/xmluconv.hxx>
      45                 :            : #include <xmloff/xmltkmap.hxx>
      46                 :            : #include <xmloff/xmlnmspe.hxx>
      47                 :            : 
      48                 :            : #include "xmlHelper.hxx"
      49                 :            : #include "xmlEnums.hxx"
      50                 :            : 
      51                 :            : #include <connectivity/dbtools.hxx>
      52                 :            : 
      53                 :            : namespace rptxml
      54                 :            : {
      55                 :            : using namespace ::com::sun::star;
      56                 :            : using namespace ::xmloff::token;
      57                 :            : 
      58                 :            : ::rtl::OUString lcl_createAttribute(const xmloff::token::XMLTokenEnum& _eNamespace,const xmloff::token::XMLTokenEnum& _eAttribute);
      59                 :            : 
      60                 :          0 : ImportDocumentHandler::ImportDocumentHandler(uno::Reference< uno::XComponentContext > const & context)
      61                 :            :     :m_bImportedChart( false )
      62 [ #  # ][ #  # ]:          0 :     ,m_xContext(context)
         [ #  # ][ #  # ]
      63                 :            : {
      64                 :          0 : }
      65                 :            : // -----------------------------------------------------------------------------
      66 [ #  # ][ #  # ]:          0 : ImportDocumentHandler::~ImportDocumentHandler()
                 [ #  # ]
      67                 :            : {
      68         [ #  # ]:          0 :     if ( m_xProxy.is() )
      69                 :            :     {
      70 [ #  # ][ #  # ]:          0 :         m_xProxy->setDelegator( NULL );
                 [ #  # ]
      71                 :          0 :         m_xProxy.clear();
      72                 :            :     }
      73         [ #  # ]:          0 : }
      74                 :          0 : IMPLEMENT_GET_IMPLEMENTATION_ID(ImportDocumentHandler)
      75                 :          0 : IMPLEMENT_FORWARD_REFCOUNT( ImportDocumentHandler, ImportDocumentHandler_BASE )
      76                 :            : //------------------------------------------------------------------------
      77                 :          0 : ::rtl::OUString SAL_CALL ImportDocumentHandler::getImplementationName(  ) throw(uno::RuntimeException)
      78                 :            : {
      79                 :          0 :     return getImplementationName_Static();
      80                 :            : }
      81                 :            : 
      82                 :            : //------------------------------------------------------------------------
      83                 :          0 : sal_Bool SAL_CALL ImportDocumentHandler::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException)
      84                 :            : {
      85         [ #  # ]:          0 :     return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_static());
      86                 :            : }
      87                 :            : 
      88                 :            : //------------------------------------------------------------------------
      89                 :          0 : uno::Sequence< ::rtl::OUString > SAL_CALL ImportDocumentHandler::getSupportedServiceNames(  ) throw(uno::RuntimeException)
      90                 :            : {
      91         [ #  # ]:          0 :     uno::Sequence< ::rtl::OUString > aSupported;
      92         [ #  # ]:          0 :     if ( m_xServiceInfo.is() )
      93 [ #  # ][ #  # ]:          0 :         aSupported = m_xServiceInfo->getSupportedServiceNames();
         [ #  # ][ #  # ]
      94 [ #  # ][ #  # ]:          0 :     return ::comphelper::concatSequences(getSupportedServiceNames_static(),aSupported);
         [ #  # ][ #  # ]
      95                 :            : }
      96                 :            : 
      97                 :            : //------------------------------------------------------------------------
      98                 :          6 : ::rtl::OUString ImportDocumentHandler::getImplementationName_Static(  ) throw(uno::RuntimeException)
      99                 :            : {
     100                 :          6 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.ImportDocumentHandler"));
     101                 :            : }
     102                 :            : 
     103                 :            : //------------------------------------------------------------------------
     104                 :          0 : uno::Sequence< ::rtl::OUString > ImportDocumentHandler::getSupportedServiceNames_static(  ) throw(uno::RuntimeException)
     105                 :            : {
     106                 :          0 :     uno::Sequence< ::rtl::OUString > aSupported(1);
     107 [ #  # ][ #  # ]:          0 :     aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ImportDocumentHandler"));
     108                 :          0 :     return aSupported;
     109                 :            : }
     110                 :            : 
     111                 :            : //------------------------------------------------------------------------
     112                 :          0 : uno::Reference< uno::XInterface > SAL_CALL ImportDocumentHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
     113                 :            : {
     114         [ #  # ]:          0 :     return *(new ImportDocumentHandler( _rxContext ));
     115                 :            : }
     116                 :            : // xml::sax::XDocumentHandler:
     117                 :          0 : void SAL_CALL ImportDocumentHandler::startDocument() throw (uno::RuntimeException, xml::sax::SAXException)
     118                 :            : {
     119                 :          0 :     m_xDelegatee->startDocument();
     120                 :          0 : }
     121                 :            : 
     122                 :          0 : void SAL_CALL ImportDocumentHandler::endDocument() throw (uno::RuntimeException, xml::sax::SAXException)
     123                 :            : {
     124 [ #  # ][ #  # ]:          0 :     m_xDelegatee->endDocument();
     125         [ #  # ]:          0 :     uno::Reference< chart2::data::XDataReceiver > xReceiver(m_xModel,uno::UNO_QUERY_THROW);
     126 [ #  # ][ #  # ]:          0 :     if ( xReceiver.is() && m_bImportedChart )
                 [ #  # ]
     127                 :            :     {
     128                 :            :         // this fills the chart again
     129         [ #  # ]:          0 :         ::comphelper::NamedValueCollection aArgs;
     130 [ #  # ][ #  # ]:          0 :         aArgs.put( "CellRangeRepresentation", ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("all")) );
     131 [ #  # ][ #  # ]:          0 :         aArgs.put( "HasCategories", uno::makeAny( sal_True ) );
     132 [ #  # ][ #  # ]:          0 :         aArgs.put( "FirstCellAsLabel", uno::makeAny( sal_True ) );
     133 [ #  # ][ #  # ]:          0 :         aArgs.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
     134                 :            : 
     135 [ #  # ][ #  # ]:          0 :         uno::Reference< chart::XComplexDescriptionAccess > xDataProvider(m_xModel->getDataProvider(),uno::UNO_QUERY);
                 [ #  # ]
     136         [ #  # ]:          0 :         if ( xDataProvider.is() )
     137                 :            :         {
     138 [ #  # ][ #  # ]:          0 :             const uno::Sequence< ::rtl::OUString > aColumnNames = xDataProvider->getColumnDescriptions();
     139 [ #  # ][ #  # ]:          0 :             aArgs.put( "ColumnDescriptions", uno::makeAny( aColumnNames ) );
                 [ #  # ]
     140                 :            :         }
     141                 :            : 
     142 [ #  # ][ #  # ]:          0 :         xReceiver->attachDataProvider( m_xDatabaseDataProvider.get() );
         [ #  # ][ #  # ]
     143 [ #  # ][ #  # ]:          0 :         xReceiver->setArguments( aArgs.getPropertyValues() );
         [ #  # ][ #  # ]
                 [ #  # ]
     144                 :          0 :     }
     145                 :          0 : }
     146                 :            : 
     147                 :          0 : void SAL_CALL ImportDocumentHandler::startElement(const ::rtl::OUString & _sName, const uno::Reference< xml::sax::XAttributeList > & _xAttrList) throw (uno::RuntimeException, xml::sax::SAXException)
     148                 :            : {
     149                 :          0 :     uno::Reference< xml::sax::XAttributeList > xNewAttribs = _xAttrList;
     150                 :          0 :     bool bExport = true;
     151         [ #  # ]:          0 :     if ( _sName == "office:report" )
     152                 :            :     {
     153 [ #  # ][ #  # ]:          0 :         const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
                 [ #  # ]
     154 [ #  # ][ #  # ]:          0 :         static const ::rtl::OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
         [ #  # ][ #  # ]
     155                 :            :         try
     156                 :            :         {
     157         [ #  # ]:          0 :             for(sal_Int16 i = 0; i < nLength; ++i)
     158                 :            :             {
     159                 :          0 :                 ::rtl::OUString sLocalName;
     160 [ #  # ][ #  # ]:          0 :                 const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
     161                 :          0 :                 const sal_Int32 nColonPos = sAttrName.indexOf( sal_Unicode(':') );
     162         [ #  # ]:          0 :                 if( -1L == nColonPos )
     163                 :          0 :                     sLocalName = sAttrName;
     164                 :            :                 else
     165                 :          0 :                     sLocalName = sAttrName.copy( nColonPos + 1L );
     166 [ #  # ][ #  # ]:          0 :                 const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
     167                 :            : 
     168 [ #  # ][ #  #  :          0 :                 switch( m_pReportElemTokenMap->Get( XML_NAMESPACE_REPORT, sLocalName ) )
                #  #  # ]
     169                 :            :                 {
     170                 :            :                     case XML_TOK_COMMAND_TYPE:
     171                 :            :                         {
     172                 :          0 :                             sal_uInt16 nRet = static_cast<sal_uInt16>(sdb::CommandType::COMMAND);
     173         [ #  # ]:          0 :                             const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetCommandTypeOptions();
     174         [ #  # ]:          0 :                             SvXMLUnitConverter::convertEnum( nRet, sValue, aXML_EnumMap );
     175 [ #  # ][ #  # ]:          0 :                             m_xDatabaseDataProvider->setCommandType(nRet);
     176                 :            :                         }
     177                 :          0 :                         break;
     178                 :            :                     case XML_TOK_COMMAND:
     179 [ #  # ][ #  # ]:          0 :                         m_xDatabaseDataProvider->setCommand(sValue);
     180                 :          0 :                         break;
     181                 :            :                     case XML_TOK_FILTER:
     182 [ #  # ][ #  # ]:          0 :                         m_xDatabaseDataProvider->setFilter(sValue);
     183                 :          0 :                         break;
     184                 :            :                     case XML_TOK_ESCAPE_PROCESSING:
     185 [ #  # ][ #  # ]:          0 :                         m_xDatabaseDataProvider->setEscapeProcessing(sValue == s_sTRUE);
     186                 :          0 :                         break;
     187                 :            :                     default:
     188                 :          0 :                         break;
     189                 :            :                 }
     190         [ #  # ]:          0 :             }
     191                 :            :         }
     192         [ #  # ]:          0 :         catch(uno::Exception&)
     193                 :            :         {
     194                 :            :         }
     195 [ #  # ][ #  # ]:          0 :         m_xDelegatee->startElement(lcl_createAttribute(XML_NP_OFFICE,XML_CHART),NULL);
         [ #  # ][ #  # ]
     196                 :          0 :         bExport = false;
     197                 :          0 :         m_bImportedChart = true;
     198                 :            :     }
     199         [ #  # ]:          0 :     else if ( _sName == "rpt:master-detail-field" )
     200                 :            :     {
     201 [ #  # ][ #  # ]:          0 :         const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
                 [ #  # ]
     202 [ #  # ][ #  # ]:          0 :         static const ::rtl::OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
         [ #  # ][ #  # ]
     203                 :            :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     204         [ #  # ]:          0 :         ::std::auto_ptr<SvXMLTokenMap> pMasterElemTokenMap( OXMLHelper::GetSubDocumentElemTokenMap());
     205                 :            :         SAL_WNODEPRECATED_DECLARATIONS_POP
     206                 :            :         try
     207                 :            :         {
     208                 :          0 :             ::rtl::OUString sMasterField,sDetailField;
     209         [ #  # ]:          0 :             for(sal_Int16 i = 0; i < nLength; ++i)
     210                 :            :             {
     211                 :          0 :                 ::rtl::OUString sLocalName;
     212 [ #  # ][ #  # ]:          0 :                 const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
     213                 :          0 :                 const sal_Int32 nColonPos = sAttrName.indexOf( sal_Unicode(':') );
     214         [ #  # ]:          0 :                 if( -1L == nColonPos )
     215                 :          0 :                     sLocalName = sAttrName;
     216                 :            :                 else
     217                 :          0 :                     sLocalName = sAttrName.copy( nColonPos + 1L );
     218 [ #  # ][ #  # ]:          0 :                 const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
     219                 :            : 
     220         [ #  # ]:          0 :                 switch( pMasterElemTokenMap->Get( XML_NAMESPACE_REPORT, sLocalName ) )
              [ #  #  # ]
     221                 :            :                 {
     222                 :            :                     case XML_TOK_MASTER:
     223                 :          0 :                         sMasterField = sValue;
     224                 :          0 :                         break;
     225                 :            :                     case XML_TOK_SUB_DETAIL:
     226                 :          0 :                         sDetailField = sValue;
     227                 :          0 :                         break;
     228                 :            :                 }
     229                 :          0 :             }
     230         [ #  # ]:          0 :             if ( sDetailField.isEmpty() )
     231                 :          0 :                 sDetailField = sMasterField;
     232         [ #  # ]:          0 :             m_aMasterFields.push_back(sMasterField);
     233 [ #  # ][ #  # ]:          0 :             m_aDetailFields.push_back(sDetailField);
     234                 :            :         }
     235         [ #  # ]:          0 :         catch(uno::Exception&)
     236                 :            :         {
     237                 :            :             OSL_FAIL("Exception catched while filling the report definition props");
     238                 :            :         }
     239         [ #  # ]:          0 :         bExport = false;
     240                 :            :     }
     241   [ #  #  #  #  :          0 :     else if ( _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:detail"))
          #  #  #  #  #  
              # ][ #  # ]
     242                 :          0 :         ||    _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:formatted-text"))
     243                 :          0 :         ||    _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:master-detail-fields"))
     244                 :          0 :         ||    _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:report-component"))
     245                 :          0 :         ||    _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:report-element")))
     246                 :          0 :         bExport = false;
     247         [ #  # ]:          0 :     else if ( _sName == "chart:plot-area" )
     248                 :            :     {
     249                 :          0 :         sal_Bool bHasCategories = sal_True;
     250 [ #  # ][ #  # ]:          0 :         const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
                 [ #  # ]
     251                 :            :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     252         [ #  # ]:          0 :         ::std::auto_ptr<SvXMLTokenMap> pMasterElemTokenMap( OXMLHelper::GetSubDocumentElemTokenMap());
     253                 :            :         SAL_WNODEPRECATED_DECLARATIONS_POP
     254         [ #  # ]:          0 :         for(sal_Int16 i = 0; i < nLength; ++i)
     255                 :            :         {
     256                 :          0 :             ::rtl::OUString sLocalName;
     257 [ #  # ][ #  # ]:          0 :             const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
     258                 :          0 :             const sal_Int32 nColonPos = sAttrName.indexOf( sal_Unicode(':') );
     259         [ #  # ]:          0 :             if( -1L == nColonPos )
     260                 :          0 :                 sLocalName = sAttrName;
     261                 :            :             else
     262                 :          0 :                 sLocalName = sAttrName.copy( nColonPos + 1L );
     263         [ #  # ]:          0 :             if ( sLocalName == "data-source-has-labels" )
     264                 :            :             {
     265 [ #  # ][ #  # ]:          0 :                 const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
     266                 :          0 :                 bHasCategories = sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("both"));
     267                 :          0 :                 break;
     268                 :            :             }
     269 [ #  # ][ #  # ]:          0 :         }
     270         [ #  # ]:          0 :         beans::PropertyValue* pArgIter = m_aArguments.getArray();
     271                 :          0 :         beans::PropertyValue* pArgEnd  = pArgIter + m_aArguments.getLength();
     272         [ #  # ]:          0 :         for(;pArgIter != pArgEnd;++pArgIter)
     273                 :            :         {
     274         [ #  # ]:          0 :             if ( pArgIter->Name == "HasCategories" )
     275                 :            :             {
     276         [ #  # ]:          0 :                 pArgIter->Value <<= bHasCategories;
     277                 :          0 :                 break;
     278                 :            :             }
     279                 :            :         }
     280                 :            : 
     281         [ #  # ]:          0 :         SvXMLAttributeList* pList = new SvXMLAttributeList();
     282 [ #  # ][ #  # ]:          0 :         xNewAttribs = pList;
     283         [ #  # ]:          0 :         pList->AppendAttributeList(_xAttrList);
     284 [ #  # ][ #  # ]:          0 :         pList->AddAttribute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("table:cell-range-address")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("local-table.$A$1:.$Z$65536")));
         [ #  # ][ #  # ]
     285                 :            : 
     286                 :            :     }
     287                 :            : 
     288         [ #  # ]:          0 :     if ( bExport )
     289 [ #  # ][ #  # ]:          0 :         m_xDelegatee->startElement(_sName,xNewAttribs);
     290                 :          0 : }
     291                 :            : 
     292                 :          0 : void SAL_CALL ImportDocumentHandler::endElement(const ::rtl::OUString & _sName) throw (uno::RuntimeException, xml::sax::SAXException)
     293                 :            : {
     294                 :          0 :     bool bExport = true;
     295                 :          0 :     ::rtl::OUString sNewName = _sName;
     296         [ #  # ]:          0 :     if ( _sName == "office:report" )
     297                 :            :     {
     298         [ #  # ]:          0 :         sNewName = lcl_createAttribute(XML_NP_OFFICE,XML_CHART);
     299                 :            :     }
     300         [ #  # ]:          0 :     else if ( _sName == "rpt:master-detail-fields" )
     301                 :            :     {
     302         [ #  # ]:          0 :         if ( !m_aMasterFields.empty() )
     303 [ #  # ][ #  # ]:          0 :             m_xDatabaseDataProvider->setMasterFields(uno::Sequence< ::rtl::OUString>(&*m_aMasterFields.begin(),m_aMasterFields.size()));
         [ #  # ][ #  # ]
     304         [ #  # ]:          0 :         if ( !m_aDetailFields.empty() )
     305 [ #  # ][ #  # ]:          0 :             m_xDatabaseDataProvider->setDetailFields(uno::Sequence< ::rtl::OUString>(&*m_aDetailFields.begin(),m_aDetailFields.size()));
         [ #  # ][ #  # ]
     306                 :          0 :         bExport = false;
     307                 :            :     }
     308   [ #  #  #  #  :          0 :     else if ( _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:detail"))
          #  #  #  #  #  
              # ][ #  # ]
     309                 :          0 :         ||    _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:formatted-text"))
     310                 :          0 :         ||    _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:master-detail-field"))
     311                 :          0 :         ||    _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:report-component"))
     312                 :          0 :         ||    _sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("rpt:report-element")))
     313                 :          0 :         bExport = false;
     314                 :            : 
     315         [ #  # ]:          0 :     if ( bExport )
     316 [ #  # ][ #  # ]:          0 :         m_xDelegatee->endElement(sNewName);
     317                 :          0 : }
     318                 :            : 
     319                 :          0 : void SAL_CALL ImportDocumentHandler::characters(const ::rtl::OUString & aChars) throw (uno::RuntimeException, xml::sax::SAXException)
     320                 :            : {
     321                 :          0 :     m_xDelegatee->characters(aChars);
     322                 :          0 : }
     323                 :            : 
     324                 :          0 : void SAL_CALL ImportDocumentHandler::ignorableWhitespace(const ::rtl::OUString & aWhitespaces) throw (uno::RuntimeException, xml::sax::SAXException)
     325                 :            : {
     326                 :          0 :     m_xDelegatee->ignorableWhitespace(aWhitespaces);
     327                 :          0 : }
     328                 :            : 
     329                 :          0 : void SAL_CALL ImportDocumentHandler::processingInstruction(const ::rtl::OUString & aTarget, const ::rtl::OUString & aData) throw (uno::RuntimeException, xml::sax::SAXException)
     330                 :            : {
     331                 :          0 :     m_xDelegatee->processingInstruction(aTarget,aData);
     332                 :          0 : }
     333                 :            : 
     334                 :          0 : void SAL_CALL ImportDocumentHandler::setDocumentLocator(const uno::Reference< xml::sax::XLocator > & xLocator) throw (uno::RuntimeException, xml::sax::SAXException)
     335                 :            : {
     336                 :          0 :     m_xDelegatee->setDocumentLocator(xLocator);
     337                 :          0 : }
     338                 :          0 : void SAL_CALL ImportDocumentHandler::initialize( const uno::Sequence< uno::Any >& _aArguments ) throw (uno::Exception, uno::RuntimeException)
     339                 :            : {
     340         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
     341         [ #  # ]:          0 :     comphelper::SequenceAsHashMap aArgs(_aArguments);
     342 [ #  # ][ #  # ]:          0 :     m_xDelegatee = aArgs.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentHandler")),m_xDelegatee);
                 [ #  # ]
     343 [ #  # ][ #  # ]:          0 :     m_xModel = aArgs.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model")),m_xModel);
                 [ #  # ]
     344                 :            : 
     345                 :            :     OSL_ENSURE(m_xDelegatee.is(),"No document handler avialable!");
     346 [ #  # ][ #  # ]:          0 :     if ( !m_xDelegatee.is() || !m_xModel.is() )
                 [ #  # ]
     347         [ #  # ]:          0 :         throw uno::Exception();
     348                 :            : 
     349 [ #  # ][ #  # ]:          0 :     m_xDatabaseDataProvider.set(m_xModel->getDataProvider(),uno::UNO_QUERY);
                 [ #  # ]
     350         [ #  # ]:          0 :     if ( !m_xDatabaseDataProvider.is() )
     351                 :            :     {
     352 [ #  # ][ #  # ]:          0 :         const static ::rtl::OUString s_sDatabaseDataProvider(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DatabaseDataProvider"));
         [ #  # ][ #  # ]
     353 [ #  # ][ #  # ]:          0 :         m_xDatabaseDataProvider.set(m_xContext->getServiceManager()->createInstanceWithContext(s_sDatabaseDataProvider
                 [ #  # ]
     354 [ #  # ][ #  # ]:          0 :             ,m_xContext),uno::UNO_QUERY);
     355         [ #  # ]:          0 :         if ( !m_xDatabaseDataProvider.is() )
     356         [ #  # ]:          0 :             throw uno::Exception();
     357                 :            : 
     358 [ #  # ][ #  # ]:          0 :         m_xDatabaseDataProvider->setRowLimit(10);
     359                 :            : 
     360         [ #  # ]:          0 :         uno::Reference< chart2::data::XDataReceiver > xReceiver(m_xModel,uno::UNO_QUERY_THROW);
     361 [ #  # ][ #  # ]:          0 :         xReceiver->attachDataProvider(m_xDatabaseDataProvider.get());
         [ #  # ][ #  # ]
     362                 :            :     }
     363                 :            : 
     364 [ #  # ][ #  # ]:          0 :     m_aArguments = m_xDatabaseDataProvider->detectArguments(NULL);
         [ #  # ][ #  # ]
                 [ #  # ]
     365                 :            : 
     366 [ #  # ][ #  # ]:          0 :     uno::Reference< reflection::XProxyFactory > xProxyFactory( m_xContext->getServiceManager()->createInstanceWithContext(
                 [ #  # ]
     367                 :          0 :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.ProxyFactory")),m_xContext),
     368 [ #  # ][ #  # ]:          0 :         uno::UNO_QUERY);
                 [ #  # ]
     369 [ #  # ][ #  # ]:          0 :     m_xProxy = xProxyFactory->createProxy(m_xDelegatee.get());
         [ #  # ][ #  # ]
                 [ #  # ]
     370         [ #  # ]:          0 :     ::comphelper::query_aggregation(m_xProxy,m_xDelegatee);
     371         [ #  # ]:          0 :     m_xTypeProvider.set(m_xDelegatee,uno::UNO_QUERY);
     372         [ #  # ]:          0 :     m_xServiceInfo.set(m_xDelegatee,uno::UNO_QUERY);
     373                 :            : 
     374                 :            :     // set ourself as delegator
     375 [ #  # ][ #  # ]:          0 :     m_xProxy->setDelegator( *this );
                 [ #  # ]
     376                 :            : 
     377 [ #  # ][ #  # ]:          0 :     m_pReportElemTokenMap.reset(OXMLHelper::GetReportElemTokenMap());
                 [ #  # ]
     378                 :          0 : }
     379                 :            : // --------------------------------------------------------------------------------
     380                 :          0 : uno::Any SAL_CALL ImportDocumentHandler::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException)
     381                 :            : {
     382         [ #  # ]:          0 :     uno::Any aReturn = ImportDocumentHandler_BASE::queryInterface(_rType);
     383 [ #  # ][ #  # ]:          0 :     return aReturn.hasValue() ? aReturn : (m_xProxy.is() ? m_xProxy->queryAggregation(_rType) : aReturn);
         [ #  # ][ #  # ]
     384                 :            : }
     385                 :            : // --------------------------------------------------------------------------------
     386                 :          0 : uno::Sequence< uno::Type > SAL_CALL ImportDocumentHandler::getTypes(  ) throw (uno::RuntimeException)
     387                 :            : {
     388         [ #  # ]:          0 :     if ( m_xTypeProvider.is() )
     389                 :            :         return ::comphelper::concatSequences(
     390                 :            :             ImportDocumentHandler_BASE::getTypes(),
     391                 :          0 :             m_xTypeProvider->getTypes()
     392 [ #  # ][ #  # ]:          0 :         );
                 [ #  # ]
     393                 :          0 :     return ImportDocumentHandler_BASE::getTypes();
     394                 :            : }
     395                 :            : 
     396                 :            : // -----------------------------------------------------------------------------
     397                 :            : } // namespace rptxml
     398                 :            : // -----------------------------------------------------------------------------
     399                 :            : 
     400                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10