LCOV - code coverage report
Current view: top level - svx/source/xml - xmlxtimp.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 197 0.0 %
Date: 2014-04-14 Functions: 0 16 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 <tools/urlobj.hxx>
      21             : #include <com/sun/star/document/XGraphicObjectResolver.hpp>
      22             : #include <com/sun/star/embed/ElementModes.hpp>
      23             : #include <com/sun/star/io/XActiveDataControl.hpp>
      24             : #include <com/sun/star/io/XActiveDataSource.hpp>
      25             : #include <com/sun/star/xml/sax/Parser.hpp>
      26             : #include <com/sun/star/container/XNameContainer.hpp>
      27             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      28             : #include <com/sun/star/uno/Sequence.hxx>
      29             : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      30             : #include <com/sun/star/drawing/LineDash.hpp>
      31             : #include <com/sun/star/awt/Gradient.hpp>
      32             : #include <com/sun/star/drawing/Hatch.hpp>
      33             : #include <com/sun/star/io/XOutputStream.hpp>
      34             : #include <com/sun/star/io/XSeekable.hpp>
      35             : #include <comphelper/processfactory.hxx>
      36             : #include <comphelper/storagehelper.hxx>
      37             : #include <unotools/streamwrap.hxx>
      38             : #include <rtl/ustrbuf.hxx>
      39             : #include <sax/tools/converter.hxx>
      40             : #include <sfx2/docfile.hxx>
      41             : #include "xmloff/xmlnmspe.hxx"
      42             : #include "xmloff/nmspmap.hxx"
      43             : 
      44             : #include "xmloff/xmltoken.hxx"
      45             : #include "xmloff/xmlmetae.hxx"
      46             : #include "xmloff/DashStyle.hxx"
      47             : #include "xmloff/GradientStyle.hxx"
      48             : #include "xmloff/HatchStyle.hxx"
      49             : #include "xmloff/ImageStyle.hxx"
      50             : #include "xmloff/MarkerStyle.hxx"
      51             : #include <xmloff/xmlictxt.hxx>
      52             : #include "svx/xmlgrhlp.hxx"
      53             : #include "xmloff/attrlist.hxx"
      54             : 
      55             : #include "xmlxtimp.hxx"
      56             : 
      57             : #include <cstdio>
      58             : 
      59             : using namespace com::sun::star;
      60             : using namespace com::sun::star::container;
      61             : using namespace com::sun::star::document;
      62             : using namespace com::sun::star::uno;
      63             : using namespace com::sun::star::awt;
      64             : using namespace com::sun::star::lang;
      65             : using namespace com::sun::star::xml::sax;
      66             : using namespace ::rtl;
      67             : using namespace ::xmloff::token;
      68             : using namespace cppu;
      69             : 
      70             : sal_Char const sXML_np__office[] = "__office";
      71             : sal_Char const sXML_np__office_ooo[] = "___office";
      72             : sal_Char const sXML_np__draw[] = "__draw";
      73             : sal_Char const sXML_np__draw_ooo[] = "___draw";
      74             : sal_Char const sXML_np__ooo[] = "__ooo";
      75             : sal_Char const sXML_np__xlink[] = "__xlink";
      76             : 
      77             : 
      78             : 
      79             : enum SvxXMLTableImportContextEnum { stice_unknown, stice_color, stice_marker, stice_dash, stice_hatch, stice_gradient, stice_bitmap };
      80             : 
      81             : 
      82             : 
      83             : class SvxXMLTableImportContext : public SvXMLImportContext
      84             : {
      85             : public:
      86             :     SvxXMLTableImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >& xAttrList, SvxXMLTableImportContextEnum eContext, const uno::Reference< XNameContainer >& xTable,
      87             :         bool bOOoFormat );
      88             :     virtual ~SvxXMLTableImportContext();
      89             : 
      90             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList ) SAL_OVERRIDE;
      91             : 
      92             : protected:
      93             :     void importColor( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
      94             :     void importMarker( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
      95             :     void importDash( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
      96             :     void importHatch( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
      97             :     void importGradient( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
      98             :     void importBitmap( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
      99             : 
     100             : private:
     101             :     uno::Reference< XNameContainer > mxTable;
     102             :     SvxXMLTableImportContextEnum meContext;
     103             :     bool mbOOoFormat;
     104             : };
     105             : 
     106             : 
     107             : 
     108           0 : SvxXMLTableImportContext::SvxXMLTableImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >&, SvxXMLTableImportContextEnum eContext, const uno::Reference< XNameContainer >& xTable, bool bOOoFormat )
     109             : : SvXMLImportContext( rImport, nPrfx, rLName ), mxTable( xTable ), meContext( eContext ),
     110           0 :     mbOOoFormat( bOOoFormat )
     111             : {
     112           0 : }
     113             : 
     114           0 : SvxXMLTableImportContext::~SvxXMLTableImportContext()
     115             : {
     116           0 : }
     117             : 
     118           0 : SvXMLImportContext *SvxXMLTableImportContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& rAttrList )
     119             : {
     120           0 :     if( XML_NAMESPACE_DRAW == nPrefix )
     121             :     {
     122           0 :         uno::Reference< XAttributeList > xAttrList( rAttrList );
     123           0 :         if( mbOOoFormat &&
     124           0 :              (stice_dash == meContext || stice_hatch == meContext ||
     125           0 :              stice_bitmap == meContext) )
     126             :         {
     127           0 :             SvXMLAttributeList *pAttrList = new SvXMLAttributeList( rAttrList );
     128           0 :             xAttrList = pAttrList;
     129           0 :             sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
     130           0 :             for( sal_Int16 i=0; i < nAttrCount; i++ )
     131             :             {
     132           0 :                 const OUString& rAttrName = xAttrList->getNameByIndex( i );
     133           0 :                 OUString aLocalName;
     134             :                 sal_uInt16 nPrefix_ =
     135           0 :                     GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
     136           0 :                                                                 &aLocalName );
     137           0 :                 if( XML_NAMESPACE_XLINK == nPrefix_ &&
     138           0 :                     stice_bitmap == meContext &&
     139           0 :                     IsXMLToken( aLocalName, XML_HREF ) )
     140             :                 {
     141           0 :                     const OUString rValue = xAttrList->getValueByIndex( i );
     142           0 :                     if( !rValue.isEmpty() && '#' == rValue[0] )
     143           0 :                         pAttrList->SetValueByIndex( i, rValue.copy( 1 ) );
     144             :                 }
     145           0 :                 else if( XML_NAMESPACE_DRAW == nPrefix_ &&
     146           0 :                           ( ( stice_dash == meContext &&
     147           0 :                               (IsXMLToken( aLocalName, XML_DOTS1_LENGTH ) ||
     148           0 :                                IsXMLToken( aLocalName, XML_DOTS2_LENGTH ) ||
     149           0 :                                IsXMLToken( aLocalName, XML_DISTANCE )) ) ||
     150           0 :                             ( stice_hatch == meContext &&
     151           0 :                               IsXMLToken( aLocalName, XML_HATCH_DISTANCE ) ) ) )
     152             :                 {
     153           0 :                     const OUString rValue = xAttrList->getValueByIndex( i );
     154           0 :                     sal_Int32 nPos = rValue.getLength();
     155           0 :                     while( nPos && rValue[nPos-1] <= ' ' )
     156           0 :                         --nPos;
     157           0 :                     if( nPos > 2 &&
     158           0 :                         ('c'==rValue[nPos-2] || 'C'==rValue[nPos-2]) &&
     159           0 :                         ('h'==rValue[nPos-1] || 'H'==rValue[nPos-1]) )
     160             :                     {
     161           0 :                         pAttrList->SetValueByIndex( i, rValue.copy( 0, nPos-2 ) );
     162           0 :                     }
     163             :                 }
     164           0 :             }
     165             :         }
     166             :         try
     167             :         {
     168           0 :             Any aAny;
     169           0 :             OUString aName;
     170             : 
     171           0 :             switch( meContext )
     172             :             {
     173             :             case stice_color:
     174           0 :                 importColor( nPrefix, rLocalName, xAttrList, aAny, aName );
     175           0 :                 break;
     176             :             case stice_marker:
     177           0 :                 importMarker( nPrefix, rLocalName, xAttrList, aAny, aName  );
     178           0 :                 break;
     179             :             case stice_dash:
     180           0 :                 importDash( nPrefix, rLocalName, xAttrList, aAny, aName  );
     181           0 :                 break;
     182             :             case stice_hatch:
     183           0 :                 importHatch( nPrefix, rLocalName, xAttrList, aAny, aName  );
     184           0 :                 break;
     185             :             case stice_gradient:
     186           0 :                 importGradient( nPrefix, rLocalName, xAttrList, aAny, aName  );
     187           0 :                 break;
     188             :             case stice_bitmap:
     189           0 :                 importBitmap( nPrefix, rLocalName, xAttrList, aAny, aName  );
     190           0 :                 break;
     191             :             case stice_unknown:
     192           0 :                 break;
     193             :             }
     194             : 
     195           0 :             if( !aName.isEmpty() && aAny.hasValue() )
     196             :             {
     197           0 :                 if( mxTable->hasByName( aName ) )
     198             :                 {
     199           0 :                     mxTable->replaceByName( aName, aAny );
     200             :                 }
     201             :                 else
     202             :                 {
     203           0 :                     mxTable->insertByName( aName, aAny );
     204             :                 }
     205           0 :             }
     206             :         }
     207           0 :         catch (const uno::Exception&)
     208             :         {
     209           0 :         }
     210             :     }
     211             : 
     212           0 :     return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
     213             : }
     214             : 
     215           0 : void SvxXMLTableImportContext::importColor( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
     216             : {
     217             :     (void)nPrfx;
     218             :     (void)rLocalName;
     219             : 
     220           0 :     const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
     221           0 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
     222             :     {
     223           0 :         const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
     224           0 :         OUString aLocalName;
     225           0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rFullAttrName, &aLocalName );
     226             : 
     227             : 
     228           0 :         if( XML_NAMESPACE_DRAW == nPrefix )
     229             :         {
     230           0 :             if( aLocalName == GetXMLToken(XML_NAME) )
     231             :             {
     232           0 :                 rName = xAttrList->getValueByIndex( i );
     233             :             }
     234           0 :             else if( aLocalName == GetXMLToken(XML_COLOR) )
     235             :             {
     236           0 :                 sal_Int32 nColor(0);
     237             :                 ::sax::Converter::convertColor(nColor,
     238           0 :                         xAttrList->getValueByIndex( i ));
     239           0 :                 rAny <<= nColor;
     240             :             }
     241             :         }
     242           0 :     }
     243           0 : }
     244             : 
     245           0 : void SvxXMLTableImportContext::importMarker( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
     246             : {
     247             :     (void)nPrfx;
     248             :     (void)rLocalName;
     249             : 
     250             :     try
     251             :     {
     252           0 :         XMLMarkerStyleImport aMarkerStyle( GetImport() );
     253           0 :         aMarkerStyle.importXML( xAttrList, rAny, rName );
     254             :     }
     255           0 :     catch (const Exception&)
     256             :     {
     257             :         OSL_FAIL("SvxXMLTableImportContext::importMarker(), exception caught!");
     258             :     }
     259           0 : }
     260             : 
     261           0 : void SvxXMLTableImportContext::importDash( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
     262             : {
     263             :     (void)nPrfx;
     264             :     (void)rLocalName;
     265             : 
     266             :     try
     267             :     {
     268           0 :         XMLDashStyleImport aDashStyle( GetImport() );
     269           0 :         aDashStyle.importXML( xAttrList, rAny, rName );
     270             :     }
     271           0 :     catch (const Exception&)
     272             :     {
     273             :         OSL_FAIL("SvxXMLTableImportContext::importDash(), exception caught!");
     274             :     }
     275           0 : }
     276             : 
     277           0 : void SvxXMLTableImportContext::importHatch( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
     278             : {
     279             :     (void)nPrfx;
     280             :     (void)rLocalName;
     281             : 
     282             :     try
     283             :     {
     284           0 :         XMLHatchStyleImport aHatchStyle( GetImport() );
     285           0 :         aHatchStyle.importXML( xAttrList, rAny, rName );
     286             :     }
     287           0 :     catch (const Exception&)
     288             :     {
     289             :         OSL_FAIL("SvxXMLTableImportContext::importHatch(), exception caught!");
     290             :     }
     291           0 : }
     292             : 
     293           0 : void SvxXMLTableImportContext::importGradient( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
     294             : {
     295             :     (void)nPrfx;
     296             :     (void)rLocalName;
     297             : 
     298             :     try
     299             :     {
     300           0 :         XMLGradientStyleImport aGradientStyle( GetImport() );
     301           0 :         aGradientStyle.importXML( xAttrList, rAny, rName );
     302             :     }
     303           0 :     catch (const Exception&)
     304             :     {
     305             :         OSL_FAIL("SvxXMLTableImportContext::importGradient(), exception caught!");
     306             :     }
     307           0 : }
     308             : 
     309           0 : void SvxXMLTableImportContext::importBitmap( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
     310             : {
     311             :     (void)nPrfx;
     312             :     (void)rLocalName;
     313             : 
     314             :     try
     315             :     {
     316           0 :         XMLImageStyle aImageStyle;
     317           0 :         aImageStyle.importXML( xAttrList, rAny, rName, GetImport() );
     318             :     }
     319           0 :     catch (const Exception&)
     320             :     {
     321             :         OSL_FAIL("SvxXMLTableImportContext::importBitmap(), exception caught!");
     322             :     }
     323           0 : }
     324             : 
     325             : 
     326             : 
     327             : // #110680#
     328           0 : SvxXMLXTableImport::SvxXMLXTableImport(
     329             :     const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
     330             :     const uno::Reference< XNameContainer > & rTable,
     331             :     uno::Reference< XGraphicObjectResolver >& xGrfResolver )
     332             : :   SvXMLImport(xContext, "", 0),
     333           0 :     mrTable( rTable )
     334             : {
     335           0 :     SetGraphicResolver( xGrfResolver );
     336             : 
     337           0 :     GetNamespaceMap().Add( OUString( sXML_np__ooo ), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
     338           0 :     GetNamespaceMap().Add( OUString( sXML_np__office ), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
     339           0 :     GetNamespaceMap().Add( OUString( sXML_np__draw ), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
     340           0 :     GetNamespaceMap().Add( OUString( sXML_np__xlink ), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
     341             : 
     342             :     // OOo namespaces for reading OOo 1.1 files
     343           0 :     GetNamespaceMap().Add( OUString( sXML_np__office_ooo ),
     344           0 :                         GetXMLToken(XML_N_OFFICE_OOO),
     345           0 :                         XML_NAMESPACE_OFFICE );
     346           0 :     GetNamespaceMap().Add( OUString( sXML_np__draw_ooo ),
     347           0 :                         GetXMLToken(XML_N_DRAW_OOO),
     348           0 :                         XML_NAMESPACE_DRAW );
     349           0 : }
     350             : 
     351           0 : SvxXMLXTableImport::~SvxXMLXTableImport() throw ()
     352             : {
     353           0 : }
     354             : 
     355           0 : static void openStorageStream( xml::sax::InputSource *pParserInput,
     356             :                                SvXMLGraphicHelper   **ppGraphicHelper,
     357             :                                uno::Reference < embed::XStorage > xStorage )
     358             : {
     359           0 :     uno::Reference < io::XStream > xIStm;
     360           0 :     xIStm.set( xStorage->openStreamElement( "Content.xml", embed::ElementModes::READ ), uno::UNO_QUERY_THROW );
     361           0 :     if( !xIStm.is() )
     362             :     {
     363             :         OSL_FAIL( "could not open Content stream" );
     364           0 :         return;
     365             :     }
     366           0 :     pParserInput->aInputStream = xIStm->getInputStream();
     367           0 :     *ppGraphicHelper = SvXMLGraphicHelper::Create( xStorage, GRAPHICHELPER_MODE_READ );
     368             : }
     369             : 
     370           0 : bool SvxXMLXTableImport::load( const OUString &rPath, const OUString &rReferer,
     371             :                                const uno::Reference < embed::XStorage > &xStorage,
     372             :                                const uno::Reference< XNameContainer >& xTable,
     373             :                                bool *bOptLoadedFromStorage ) throw()
     374             : {
     375           0 :     bool bRet = true;
     376           0 :     SvXMLGraphicHelper* pGraphicHelper = 0;
     377             : 
     378           0 :     INetURLObject aURLObj( rPath );
     379           0 :     bool bUseStorage = aURLObj.GetProtocol() == INET_PROT_NOT_VALID; // a relative path
     380             : 
     381             :     try
     382             :     {
     383           0 :         uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
     384             : 
     385           0 :         uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
     386             : 
     387           0 :         xml::sax::InputSource aParserInput;
     388           0 :         comphelper::LifecycleProxy aNasty;
     389             : 
     390           0 :         if( !bUseStorage || !xStorage.is() )
     391             :         {
     392           0 :             SfxMedium aMedium( rPath, rReferer, STREAM_READ | STREAM_NOCREATE );
     393           0 :             aParserInput.sSystemId = aMedium.GetName();
     394             : 
     395           0 :             if( aMedium.IsStorage() )
     396             :             {
     397           0 :                 uno::Reference < embed::XStorage > xMediumStorage( aMedium.GetStorage( false ), uno::UNO_QUERY_THROW );
     398           0 :                 openStorageStream( &aParserInput, &pGraphicHelper, xMediumStorage );
     399             :             }
     400             :             else
     401           0 :                 aParserInput.aInputStream = aMedium.GetInputStream();
     402             :         }
     403             :         else // relative URL into a storage
     404             :         {
     405           0 :             uno::Reference< embed::XStorage > xSubStorage;
     406             :             try
     407             :             {
     408           0 :                 xSubStorage = comphelper::OStorageHelper::GetStorageAtPath(
     409           0 :                         xStorage, rPath, embed::ElementModes::READ, aNasty );
     410             :             }
     411           0 :             catch (const uno::Exception&)
     412             :             {
     413             :             }
     414           0 :             if( xSubStorage.is() )
     415           0 :                 openStorageStream( &aParserInput, &pGraphicHelper, xSubStorage );
     416             :             else
     417             :             {
     418           0 :                 ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xStream;
     419           0 :                 xStream = comphelper::OStorageHelper::GetStreamAtPath(
     420           0 :                         xStorage, rPath, embed::ElementModes::READ, aNasty );
     421           0 :                 if( !xStream.is() )
     422           0 :                     return false;
     423           0 :                 aParserInput.aInputStream = xStream->getInputStream();
     424             :             }
     425           0 :             if( bOptLoadedFromStorage )
     426           0 :                 *bOptLoadedFromStorage = true;
     427             :         }
     428             : 
     429           0 :         uno::Reference< XGraphicObjectResolver > xGrfResolver;
     430           0 :         if (pGraphicHelper)
     431           0 :             xGrfResolver = pGraphicHelper;
     432             : 
     433             :         try
     434             :         {
     435           0 :             uno::Reference< io::XSeekable > xSeek( aParserInput.aInputStream, uno::UNO_QUERY_THROW );
     436           0 :             xSeek->seek( 0 );
     437             :         }
     438           0 :         catch (const uno::Exception&)
     439             :         {
     440             :         }
     441             : 
     442           0 :         uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTableImport( xContext, xTable, xGrfResolver ) );
     443           0 :         xParser->setDocumentHandler( xHandler );
     444           0 :         xParser->parseStream( aParserInput );
     445             : 
     446           0 :         if( pGraphicHelper )
     447           0 :             SvXMLGraphicHelper::Destroy( pGraphicHelper );
     448             :     }
     449           0 :     catch (const uno::Exception&)
     450             :     {
     451             : //      thrown each time you load a document with property tables that are not
     452             : //      on the current machine. FIXME: would be better to check a file exists
     453             : //      before importing ...
     454             : //        fprintf (stderr, "parsing etc. exception '%s'\n",
     455             : //                 OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
     456           0 :         bRet = false;
     457             :     }
     458             : 
     459           0 :     return bRet;
     460             : }
     461             : 
     462           0 : SvXMLImportContext *SvxXMLXTableImport::CreateContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList )
     463             : {
     464           0 :     if( XML_NAMESPACE_OOO == nPrefix ||
     465             :         XML_NAMESPACE_OFFICE == nPrefix )
     466             :     {
     467           0 :         bool bOOoFormat = (XML_NAMESPACE_OFFICE == nPrefix);
     468           0 :         Type aType = mrTable->getElementType();
     469             : 
     470           0 :         if ( rLocalName == "color-table" )
     471             :         {
     472           0 :             if( aType == ::getCppuType((const sal_Int32*)0) )
     473           0 :                 return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_color, mrTable, bOOoFormat );
     474             :         }
     475           0 :         else if ( rLocalName == "marker-table" )
     476             :         {
     477           0 :             if( aType == ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
     478           0 :                 return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_marker, mrTable, bOOoFormat );
     479             :         }
     480           0 :         else if ( rLocalName == "dash-table" )
     481             :         {
     482           0 :             if( aType == ::getCppuType((const drawing::LineDash*)0) )
     483           0 :                 return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_dash, mrTable, bOOoFormat );
     484             :         }
     485           0 :         else if ( rLocalName == "hatch-table" )
     486             :         {
     487           0 :             if( aType == ::getCppuType((const drawing::Hatch*)0) )
     488           0 :                 return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_hatch, mrTable, bOOoFormat );
     489             :         }
     490           0 :         else if ( rLocalName == "gradient-table" )
     491             :         {
     492           0 :             if( aType == ::getCppuType((const awt::Gradient*)0))
     493           0 :                 return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_gradient, mrTable, bOOoFormat );
     494             :         }
     495           0 :         else if ( rLocalName == "bitmap-table" )
     496             :         {
     497           0 :             if( aType == ::getCppuType((const OUString*)0))
     498           0 :                 return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_bitmap, mrTable, bOOoFormat );
     499           0 :         }
     500             :     }
     501             : 
     502           0 :     return new SvXMLImportContext( *this, nPrefix, rLocalName );
     503             : }
     504             : 
     505             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10