LCOV - code coverage report
Current view: top level - libreoffice/comphelper/source/xml - ofopxmlhelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 181 217 83.4 %
Date: 2012-12-27 Functions: 15 17 88.2 %
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             : 
      21             : #include <com/sun/star/beans/StringPair.hpp>
      22             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      23             : #include <com/sun/star/io/XActiveDataSource.hpp>
      24             : #include <com/sun/star/xml/sax/Parser.hpp>
      25             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      26             : #include <com/sun/star/xml/sax/Writer.hpp>
      27             : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      28             : 
      29             : #include <comphelper/ofopxmlhelper.hxx>
      30             : #include <comphelper/attributelist.hxx>
      31             : 
      32             : #define RELATIONINFO_FORMAT 0
      33             : #define CONTENTTYPE_FORMAT  1
      34             : #define FORMAT_MAX_ID CONTENTTYPE_FORMAT
      35             : 
      36             : using namespace ::com::sun::star;
      37             : 
      38             : namespace comphelper {
      39             : 
      40             : // -----------------------------------
      41         298 : uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::ReadRelationsInfoSequence( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString aStreamName, const uno::Reference< uno::XComponentContext > xContext )
      42             :     throw( uno::Exception )
      43             : {
      44         298 :     ::rtl::OUString aStringID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/" ) );
      45         298 :     aStringID += aStreamName;
      46         298 :     return ReadSequence_Impl( xInStream, aStringID, RELATIONINFO_FORMAT, xContext );
      47             : }
      48             : 
      49             : // -----------------------------------
      50         199 : uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::ReadContentTypeSequence( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< uno::XComponentContext > xContext )
      51             :     throw( uno::Exception )
      52             : {
      53         199 :     ::rtl::OUString aStringID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[Content_Types].xml" ) );
      54         199 :     return ReadSequence_Impl( xInStream, aStringID, CONTENTTYPE_FORMAT, xContext );
      55             : }
      56             : 
      57             : // -----------------------------------
      58          50 : void SAL_CALL OFOPXMLHelper::WriteRelationsInfoSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< uno::Sequence< beans::StringPair > >& aSequence, const uno::Reference< uno::XComponentContext > xContext )
      59             :     throw( uno::Exception )
      60             : {
      61          50 :     if ( !xOutStream.is() )
      62           0 :         throw uno::RuntimeException();
      63             : 
      64          50 :     uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
      65             : 
      66          50 :     xWriter->setOutputStream( xOutStream );
      67             : 
      68          50 :     ::rtl::OUString aRelListElement( RTL_CONSTASCII_USTRINGPARAM( "Relationships" ) );
      69          50 :     ::rtl::OUString aRelElement( RTL_CONSTASCII_USTRINGPARAM( "Relationship" ) );
      70          50 :     ::rtl::OUString aIDAttr( RTL_CONSTASCII_USTRINGPARAM( "Id" ) );
      71          50 :     ::rtl::OUString aTypeAttr( RTL_CONSTASCII_USTRINGPARAM( "Type" ) );
      72          50 :     ::rtl::OUString aTargetModeAttr( RTL_CONSTASCII_USTRINGPARAM( "TargetMode" ) );
      73          50 :     ::rtl::OUString aTargetAttr( RTL_CONSTASCII_USTRINGPARAM( "Target" ) );
      74          50 :     ::rtl::OUString aCDATAString( RTL_CONSTASCII_USTRINGPARAM ( "CDATA" ) );
      75          50 :     ::rtl::OUString aWhiteSpace( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
      76             : 
      77             :     // write the namespace
      78          50 :     AttributeList* pRootAttrList = new AttributeList;
      79          50 :     uno::Reference< xml::sax::XAttributeList > xRootAttrList( pRootAttrList );
      80             :     pRootAttrList->AddAttribute(
      81             :         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "xmlns" ) ),
      82             :         aCDATAString,
      83          50 :         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "http://schemas.openxmlformats.org/package/2006/relationships" ) ) );
      84             : 
      85          50 :     xWriter->startDocument();
      86          50 :     xWriter->startElement( aRelListElement, xRootAttrList );
      87             : 
      88         203 :     for ( sal_Int32 nInd = 0; nInd < aSequence.getLength(); nInd++ )
      89             :     {
      90         153 :         AttributeList *pAttrList = new AttributeList;
      91         153 :         uno::Reference< xml::sax::XAttributeList > xAttrList( pAttrList );
      92         613 :         for( sal_Int32 nSecInd = 0; nSecInd < aSequence[nInd].getLength(); nSecInd++ )
      93             :         {
      94        1074 :             if ( aSequence[nInd][nSecInd].First.equals( aIDAttr )
      95         307 :               || aSequence[nInd][nSecInd].First.equals( aTypeAttr )
      96         154 :               || aSequence[nInd][nSecInd].First.equals( aTargetModeAttr )
      97         153 :               || aSequence[nInd][nSecInd].First.equals( aTargetAttr ) )
      98             :             {
      99         460 :                 pAttrList->AddAttribute( aSequence[nInd][nSecInd].First, aCDATAString, aSequence[nInd][nSecInd].Second );
     100             :             }
     101             :             else
     102             :             {
     103             :                 // TODO/LATER: should the extensions be allowed?
     104           0 :                 throw lang::IllegalArgumentException();
     105             :             }
     106             :         }
     107             : 
     108         153 :         xWriter->startElement( aRelElement, xAttrList );
     109         153 :         xWriter->ignorableWhitespace( aWhiteSpace );
     110         153 :         xWriter->endElement( aRelElement );
     111         153 :     }
     112             : 
     113          50 :     xWriter->ignorableWhitespace( aWhiteSpace );
     114          50 :     xWriter->endElement( aRelListElement );
     115          50 :     xWriter->endDocument();
     116          50 : }
     117             : 
     118             : // -----------------------------------
     119          25 : void SAL_CALL OFOPXMLHelper::WriteContentSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< beans::StringPair >& aDefaultsSequence, const uno::Sequence< beans::StringPair >& aOverridesSequence, const uno::Reference< uno::XComponentContext > xContext )
     120             :     throw( uno::Exception )
     121             : {
     122          25 :     if ( !xOutStream.is() )
     123           0 :         throw uno::RuntimeException();
     124             : 
     125          25 :     uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
     126             : 
     127          25 :     xWriter->setOutputStream( xOutStream );
     128             : 
     129          25 :     ::rtl::OUString aTypesElement( RTL_CONSTASCII_USTRINGPARAM( "Types" ) );
     130          25 :     ::rtl::OUString aDefaultElement( RTL_CONSTASCII_USTRINGPARAM( "Default" ) );
     131          25 :     ::rtl::OUString aOverrideElement( RTL_CONSTASCII_USTRINGPARAM( "Override" ) );
     132          25 :     ::rtl::OUString aExtensionAttr( RTL_CONSTASCII_USTRINGPARAM( "Extension" ) );
     133          25 :     ::rtl::OUString aPartNameAttr( RTL_CONSTASCII_USTRINGPARAM( "PartName" ) );
     134          25 :     ::rtl::OUString aContentTypeAttr( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) );
     135          25 :     ::rtl::OUString aCDATAString( RTL_CONSTASCII_USTRINGPARAM ( "CDATA" ) );
     136          25 :     ::rtl::OUString aWhiteSpace( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
     137             : 
     138             :     // write the namespace
     139          25 :     AttributeList* pRootAttrList = new AttributeList;
     140          25 :     uno::Reference< xml::sax::XAttributeList > xRootAttrList( pRootAttrList );
     141             :     pRootAttrList->AddAttribute(
     142             :         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "xmlns" ) ),
     143             :         aCDATAString,
     144          25 :         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "http://schemas.openxmlformats.org/package/2006/content-types" ) ) );
     145             : 
     146          25 :     xWriter->startDocument();
     147          25 :     xWriter->startElement( aTypesElement, xRootAttrList );
     148             : 
     149          25 :     for ( sal_Int32 nInd = 0; nInd < aDefaultsSequence.getLength(); nInd++ )
     150             :     {
     151           0 :         AttributeList *pAttrList = new AttributeList;
     152           0 :         uno::Reference< xml::sax::XAttributeList > xAttrList( pAttrList );
     153           0 :         pAttrList->AddAttribute( aExtensionAttr, aCDATAString, aDefaultsSequence[nInd].First );
     154           0 :         pAttrList->AddAttribute( aContentTypeAttr, aCDATAString, aDefaultsSequence[nInd].Second );
     155             : 
     156           0 :         xWriter->startElement( aDefaultElement, xAttrList );
     157           0 :         xWriter->ignorableWhitespace( aWhiteSpace );
     158           0 :         xWriter->endElement( aDefaultElement );
     159           0 :     }
     160             : 
     161         227 :     for ( sal_Int32 nInd = 0; nInd < aOverridesSequence.getLength(); nInd++ )
     162             :     {
     163         202 :         AttributeList *pAttrList = new AttributeList;
     164         202 :         uno::Reference< xml::sax::XAttributeList > xAttrList( pAttrList );
     165         202 :         pAttrList->AddAttribute( aPartNameAttr, aCDATAString, aOverridesSequence[nInd].First );
     166         202 :         pAttrList->AddAttribute( aContentTypeAttr, aCDATAString, aOverridesSequence[nInd].Second );
     167             : 
     168         202 :         xWriter->startElement( aOverrideElement, xAttrList );
     169         202 :         xWriter->ignorableWhitespace( aWhiteSpace );
     170         202 :         xWriter->endElement( aOverrideElement );
     171         202 :     }
     172             : 
     173          25 :     xWriter->ignorableWhitespace( aWhiteSpace );
     174          25 :     xWriter->endElement( aTypesElement );
     175          25 :     xWriter->endDocument();
     176             : 
     177          25 : }
     178             : 
     179             : // ==================================================================================
     180             : 
     181             : // -----------------------------------
     182         497 : uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::ReadSequence_Impl( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, sal_uInt16 nFormat, const uno::Reference< uno::XComponentContext > xContext )
     183             :     throw( uno::Exception )
     184             : {
     185         497 :     if ( !xContext.is() || !xInStream.is() || nFormat > FORMAT_MAX_ID )
     186           0 :         throw uno::RuntimeException();
     187             : 
     188         497 :     uno::Sequence< uno::Sequence< beans::StringPair > > aResult;
     189             : 
     190         497 :     uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
     191             : 
     192         497 :     OFOPXMLHelper* pHelper = new OFOPXMLHelper( nFormat );
     193         497 :     uno::Reference< xml::sax::XDocumentHandler > xHelper( static_cast< xml::sax::XDocumentHandler* >( pHelper ) );
     194         497 :     xml::sax::InputSource aParserInput;
     195         497 :     aParserInput.aInputStream = xInStream;
     196         497 :     aParserInput.sSystemId = aStringID;
     197         497 :     xParser->setDocumentHandler( xHelper );
     198         497 :     xParser->parseStream( aParserInput );
     199         497 :     xParser->setDocumentHandler( uno::Reference < xml::sax::XDocumentHandler > () );
     200             : 
     201         497 :     return pHelper->GetParsingResult();
     202             : }
     203             : 
     204             : // -----------------------------------
     205         497 : OFOPXMLHelper::OFOPXMLHelper( sal_uInt16 nFormat )
     206             : : m_nFormat( nFormat )
     207             : , m_aRelListElement( RTL_CONSTASCII_USTRINGPARAM( "Relationships" ) )
     208             : , m_aRelElement( RTL_CONSTASCII_USTRINGPARAM( "Relationship" ) )
     209             : , m_aIDAttr( RTL_CONSTASCII_USTRINGPARAM( "Id" ) )
     210             : , m_aTypeAttr( RTL_CONSTASCII_USTRINGPARAM( "Type" ) )
     211             : , m_aTargetModeAttr( RTL_CONSTASCII_USTRINGPARAM( "TargetMode" ) )
     212             : , m_aTargetAttr( RTL_CONSTASCII_USTRINGPARAM( "Target" ) )
     213             : , m_aTypesElement( RTL_CONSTASCII_USTRINGPARAM( "Types" ) )
     214             : , m_aDefaultElement( RTL_CONSTASCII_USTRINGPARAM( "Default" ) )
     215             : , m_aOverrideElement( RTL_CONSTASCII_USTRINGPARAM( "Override" ) )
     216             : , m_aExtensionAttr( RTL_CONSTASCII_USTRINGPARAM( "Extension" ) )
     217             : , m_aPartNameAttr( RTL_CONSTASCII_USTRINGPARAM( "PartName" ) )
     218         497 : , m_aContentTypeAttr( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) )
     219             : {
     220         497 : }
     221             : 
     222             : // -----------------------------------
     223         994 : OFOPXMLHelper::~OFOPXMLHelper()
     224             : {
     225         994 : }
     226             : 
     227             : // -----------------------------------
     228         497 : uno::Sequence< uno::Sequence< beans::StringPair > > OFOPXMLHelper::GetParsingResult()
     229             : {
     230         497 :     if ( m_aElementsSeq.getLength() )
     231           0 :         throw uno::RuntimeException(); // the parsing has still not finished!
     232             : 
     233         497 :     return m_aResultSeq;
     234             : }
     235             : 
     236             : // -----------------------------------
     237         497 : void SAL_CALL OFOPXMLHelper::startDocument()
     238             :         throw(xml::sax::SAXException, uno::RuntimeException)
     239             : {
     240         497 : }
     241             : 
     242             : // -----------------------------------
     243         497 : void SAL_CALL OFOPXMLHelper::endDocument()
     244             :         throw(xml::sax::SAXException, uno::RuntimeException)
     245             : {
     246         497 : }
     247             : 
     248             : // -----------------------------------
     249        3615 : void SAL_CALL OFOPXMLHelper::startElement( const ::rtl::OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs )
     250             :         throw( xml::sax::SAXException, uno::RuntimeException )
     251             : {
     252        3615 :     if ( m_nFormat == RELATIONINFO_FORMAT )
     253             :     {
     254        1387 :         if ( aName == m_aRelListElement )
     255             :         {
     256         298 :             sal_Int32 nNewLength = m_aElementsSeq.getLength() + 1;
     257             : 
     258         298 :             if ( nNewLength != 1 )
     259           0 :                 throw xml::sax::SAXException(); // TODO: this element must be the first level element
     260             : 
     261         298 :             m_aElementsSeq.realloc( nNewLength );
     262         298 :             m_aElementsSeq[nNewLength-1] = aName;
     263             : 
     264         298 :             return; // nothing to do
     265             :         }
     266        1089 :         else if ( aName == m_aRelElement )
     267             :         {
     268        1089 :             sal_Int32 nNewLength = m_aElementsSeq.getLength() + 1;
     269        1089 :             if ( nNewLength != 2 )
     270           0 :                 throw xml::sax::SAXException(); // TODO: this element must be the second level element
     271             : 
     272        1089 :             m_aElementsSeq.realloc( nNewLength );
     273        1089 :             m_aElementsSeq[nNewLength-1] = aName;
     274             : 
     275        1089 :             sal_Int32 nNewEntryNum = m_aResultSeq.getLength() + 1;
     276        1089 :             m_aResultSeq.realloc( nNewEntryNum );
     277        1089 :             sal_Int32 nAttrNum = 0;
     278        1089 :             m_aResultSeq[nNewEntryNum-1].realloc( 4 ); // the maximal expected number of arguments is 4
     279             : 
     280        1089 :             ::rtl::OUString aIDValue = xAttribs->getValueByName( m_aIDAttr );
     281        1089 :             if ( aIDValue.isEmpty() )
     282           0 :                 throw xml::sax::SAXException(); // TODO: the ID value must present
     283             : 
     284        1089 :             ::rtl::OUString aTypeValue = xAttribs->getValueByName( m_aTypeAttr );
     285        1089 :             ::rtl::OUString aTargetValue = xAttribs->getValueByName( m_aTargetAttr );
     286        1089 :             ::rtl::OUString aTargetModeValue = xAttribs->getValueByName( m_aTargetModeAttr );
     287             : 
     288        1089 :             m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aIDAttr;
     289        1089 :             m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aIDValue;
     290             : 
     291        1089 :             if ( !aTypeValue.isEmpty() )
     292             :             {
     293        1089 :                 m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTypeAttr;
     294        1089 :                 m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTypeValue;
     295             :             }
     296             : 
     297        1089 :             if ( !aTargetValue.isEmpty() )
     298             :             {
     299        1089 :                 m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTargetAttr;
     300        1089 :                 m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTargetValue;
     301             :             }
     302             : 
     303        1089 :             if ( !aTargetModeValue.isEmpty() )
     304             :             {
     305           2 :                 m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTargetModeAttr;
     306           2 :                 m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTargetModeValue;
     307             :             }
     308             : 
     309        1089 :             m_aResultSeq[nNewEntryNum-1].realloc( nAttrNum );
     310             :         }
     311             :         else
     312           0 :             throw xml::sax::SAXException(); // TODO: no other elements expected!
     313             :     }
     314        2228 :     else if ( m_nFormat == CONTENTTYPE_FORMAT )
     315             :     {
     316        2228 :         if ( aName == m_aTypesElement )
     317             :         {
     318         199 :             sal_Int32 nNewLength = m_aElementsSeq.getLength() + 1;
     319             : 
     320         199 :             if ( nNewLength != 1 )
     321           0 :                 throw xml::sax::SAXException(); // TODO: this element must be the first level element
     322             : 
     323         199 :             m_aElementsSeq.realloc( nNewLength );
     324         199 :             m_aElementsSeq[nNewLength-1] = aName;
     325             : 
     326         199 :             if ( !m_aResultSeq.getLength() )
     327         199 :                 m_aResultSeq.realloc( 2 );
     328             : 
     329         199 :             return; // nothing to do
     330             :         }
     331        2029 :         else if ( aName == m_aDefaultElement )
     332             :         {
     333         241 :             sal_Int32 nNewLength = m_aElementsSeq.getLength() + 1;
     334         241 :             if ( nNewLength != 2 )
     335           0 :                 throw xml::sax::SAXException(); // TODO: this element must be the second level element
     336             : 
     337         241 :             m_aElementsSeq.realloc( nNewLength );
     338         241 :             m_aElementsSeq[nNewLength-1] = aName;
     339             : 
     340         241 :             if ( !m_aResultSeq.getLength() )
     341           0 :                 m_aResultSeq.realloc( 2 );
     342             : 
     343         241 :             if ( m_aResultSeq.getLength() != 2 )
     344           0 :                 throw uno::RuntimeException();
     345             : 
     346         241 :             ::rtl::OUString aExtensionValue = xAttribs->getValueByName( m_aExtensionAttr );
     347         241 :             if ( aExtensionValue.isEmpty() )
     348           0 :                 throw xml::sax::SAXException(); // TODO: the Extension value must present
     349             : 
     350         241 :             ::rtl::OUString aContentTypeValue = xAttribs->getValueByName( m_aContentTypeAttr );
     351         241 :             if ( aContentTypeValue.isEmpty() )
     352           0 :                 throw xml::sax::SAXException(); // TODO: the ContentType value must present
     353             : 
     354         241 :             sal_Int32 nNewResultLen = m_aResultSeq[0].getLength() + 1;
     355         241 :             m_aResultSeq[0].realloc( nNewResultLen );
     356             : 
     357         241 :             m_aResultSeq[0][nNewResultLen-1].First = aExtensionValue;
     358         241 :             m_aResultSeq[0][nNewResultLen-1].Second = aContentTypeValue;
     359             :         }
     360        1788 :         else if ( aName == m_aOverrideElement )
     361             :         {
     362        1788 :             sal_Int32 nNewLength = m_aElementsSeq.getLength() + 1;
     363        1788 :             if ( nNewLength != 2 )
     364           0 :                 throw xml::sax::SAXException(); // TODO: this element must be the second level element
     365             : 
     366        1788 :             m_aElementsSeq.realloc( nNewLength );
     367        1788 :             m_aElementsSeq[nNewLength-1] = aName;
     368             : 
     369        1788 :             if ( !m_aResultSeq.getLength() )
     370           0 :                 m_aResultSeq.realloc( 2 );
     371             : 
     372        1788 :             if ( m_aResultSeq.getLength() != 2 )
     373           0 :                 throw uno::RuntimeException();
     374             : 
     375        1788 :             ::rtl::OUString aPartNameValue = xAttribs->getValueByName( m_aPartNameAttr );
     376        1788 :             if ( aPartNameValue.isEmpty() )
     377           0 :                 throw xml::sax::SAXException(); // TODO: the PartName value must present
     378             : 
     379        1788 :             ::rtl::OUString aContentTypeValue = xAttribs->getValueByName( m_aContentTypeAttr );
     380        1788 :             if ( aContentTypeValue.isEmpty() )
     381           0 :                 throw xml::sax::SAXException(); // TODO: the ContentType value must present
     382             : 
     383        1788 :             sal_Int32 nNewResultLen = m_aResultSeq[1].getLength() + 1;
     384        1788 :             m_aResultSeq[1].realloc( nNewResultLen );
     385             : 
     386        1788 :             m_aResultSeq[1][nNewResultLen-1].First = aPartNameValue;
     387        1788 :             m_aResultSeq[1][nNewResultLen-1].Second = aContentTypeValue;
     388             :         }
     389             :         else
     390           0 :             throw xml::sax::SAXException(); // TODO: no other elements expected!
     391             :     }
     392             :     else
     393           0 :         throw xml::sax::SAXException(); // TODO: no other elements expected!
     394             : }
     395             : 
     396             : // -----------------------------------
     397        3615 : void SAL_CALL OFOPXMLHelper::endElement( const ::rtl::OUString& aName )
     398             :     throw( xml::sax::SAXException, uno::RuntimeException )
     399             : {
     400        3615 :     if ( m_nFormat == RELATIONINFO_FORMAT || m_nFormat == CONTENTTYPE_FORMAT )
     401             :     {
     402        3615 :         sal_Int32 nLength = m_aElementsSeq.getLength();
     403        3615 :         if ( nLength <= 0 )
     404           0 :             throw xml::sax::SAXException(); // TODO: no other end elements expected!
     405             : 
     406        3615 :         if ( !m_aElementsSeq[nLength-1].equals( aName ) )
     407           0 :             throw xml::sax::SAXException(); // TODO: unexpected element ended
     408             : 
     409        3615 :         m_aElementsSeq.realloc( nLength - 1 );
     410             :     }
     411        3615 : }
     412             : 
     413             : // -----------------------------------
     414         234 : void SAL_CALL OFOPXMLHelper::characters( const ::rtl::OUString& /*aChars*/ )
     415             :         throw(xml::sax::SAXException, uno::RuntimeException)
     416             : {
     417         234 : }
     418             : 
     419             : // -----------------------------------
     420           0 : void SAL_CALL OFOPXMLHelper::ignorableWhitespace( const ::rtl::OUString& /*aWhitespaces*/ )
     421             :         throw(xml::sax::SAXException, uno::RuntimeException)
     422             : {
     423           0 : }
     424             : 
     425             : // -----------------------------------
     426           0 : void SAL_CALL OFOPXMLHelper::processingInstruction( const ::rtl::OUString& /*aTarget*/, const ::rtl::OUString& /*aData*/ )
     427             :         throw(xml::sax::SAXException, uno::RuntimeException)
     428             : {
     429           0 : }
     430             : 
     431             : // -----------------------------------
     432         497 : void SAL_CALL OFOPXMLHelper::setDocumentLocator( const uno::Reference< xml::sax::XLocator >& /*xLocator*/ )
     433             :         throw(xml::sax::SAXException, uno::RuntimeException)
     434             : {
     435         497 : }
     436             : 
     437             : } // namespace comphelper
     438             : 
     439             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10