LCOV - code coverage report
Current view: top level - svx/source/xml - xmlxtexp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 205 0.0 %
Date: 2012-08-25 Functions: 0 37 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 394 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 <tools/urlobj.hxx>
      30                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      31                 :            : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      32                 :            : #include <com/sun/star/uno/Sequence.hxx>
      33                 :            : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      34                 :            : #include <com/sun/star/drawing/LineDash.hpp>
      35                 :            : #include <com/sun/star/awt/Gradient.hpp>
      36                 :            : #include <com/sun/star/drawing/Hatch.hpp>
      37                 :            : #include <com/sun/star/io/XActiveDataSource.hpp>
      38                 :            : #include <com/sun/star/embed/ElementModes.hpp>
      39                 :            : 
      40                 :            : #include <sax/tools/converter.hxx>
      41                 :            : #include <sfx2/docfile.hxx>
      42                 :            : #include <rtl/ustrbuf.hxx>
      43                 :            : #include "xmloff/xmlnmspe.hxx"
      44                 :            : #include "xmloff/nmspmap.hxx"
      45                 :            : 
      46                 :            : #include "xmloff/xmltoken.hxx"
      47                 :            : #include "xmloff/xmlmetae.hxx"
      48                 :            : #include "xmloff/DashStyle.hxx"
      49                 :            : #include "xmloff/GradientStyle.hxx"
      50                 :            : #include "xmloff/HatchStyle.hxx"
      51                 :            : #include "xmloff/ImageStyle.hxx"
      52                 :            : #include "xmloff/MarkerStyle.hxx"
      53                 :            : #include <com/sun/star/embed/XTransactedObject.hpp>
      54                 :            : #include <comphelper/processfactory.hxx>
      55                 :            : #include <unotools/streamwrap.hxx>
      56                 :            : #include "svx/xmlgrhlp.hxx"
      57                 :            : 
      58                 :            : #include "xmlxtexp.hxx"
      59                 :            : 
      60                 :            : #include <comphelper/storagehelper.hxx>
      61                 :            : 
      62                 :            : using namespace com::sun::star;
      63                 :            : using namespace com::sun::star::container;
      64                 :            : using namespace com::sun::star::document;
      65                 :            : using namespace com::sun::star::uno;
      66                 :            : using namespace com::sun::star::awt;
      67                 :            : using namespace com::sun::star::lang;
      68                 :            : using namespace com::sun::star::xml::sax;
      69                 :            : using namespace ::xmloff::token;
      70                 :            : using namespace ::rtl;
      71                 :            : using namespace cppu;
      72                 :            : 
      73                 :            : using com::sun::star::embed::XTransactedObject;
      74                 :            : 
      75                 :            : class SvxXMLTableEntryExporter
      76                 :            : {
      77                 :            : public:
      78                 :          0 :     SvxXMLTableEntryExporter( SvXMLExport& rExport ) : mrExport( rExport ) {}
      79                 :            :     virtual ~SvxXMLTableEntryExporter();
      80                 :            : 
      81                 :            :     virtual void exportEntry( const OUString& rStrName, const Any& rValue ) = 0;
      82                 :            : 
      83                 :            : protected:
      84                 :            :     SvXMLExport& mrExport;
      85                 :            : };
      86                 :            : 
      87                 :            : class SvxXMLColorEntryExporter : public SvxXMLTableEntryExporter
      88                 :            : {
      89                 :            : public:
      90                 :            :     SvxXMLColorEntryExporter( SvXMLExport& rExport );
      91                 :            :     virtual ~SvxXMLColorEntryExporter();
      92                 :            : 
      93                 :            :     virtual void exportEntry( const OUString& rStrName, const Any& rValue );
      94                 :            : };
      95                 :            : 
      96                 :            : class SvxXMLLineEndEntryExporter : public SvxXMLTableEntryExporter
      97                 :            : {
      98                 :            : public:
      99                 :            :     SvxXMLLineEndEntryExporter( SvXMLExport& rExport );
     100                 :            :     SvxXMLLineEndEntryExporter();
     101                 :            :     virtual ~SvxXMLLineEndEntryExporter();
     102                 :            : 
     103                 :            :     virtual void exportEntry( const OUString& rStrName, const Any& rValue );
     104                 :            : private:
     105                 :            :     XMLMarkerStyleExport maMarkerStyle;
     106                 :            : };
     107                 :            : 
     108                 :            : class SvxXMLDashEntryExporter : public SvxXMLTableEntryExporter
     109                 :            : {
     110                 :            : public:
     111                 :            :     SvxXMLDashEntryExporter( SvXMLExport& rExport );
     112                 :            :     virtual ~SvxXMLDashEntryExporter();
     113                 :            : 
     114                 :            :     virtual void exportEntry( const OUString& rStrName, const Any& rValue );
     115                 :            : 
     116                 :            : private:
     117                 :            :     XMLDashStyleExport maDashStyle;
     118                 :            : };
     119                 :            : 
     120                 :            : class SvxXMLHatchEntryExporter : public SvxXMLTableEntryExporter
     121                 :            : {
     122                 :            : public:
     123                 :            :     SvxXMLHatchEntryExporter( SvXMLExport& rExport );
     124                 :            :     virtual ~SvxXMLHatchEntryExporter();
     125                 :            : 
     126                 :            :     virtual void exportEntry( const OUString& rStrName, const Any& rValue );
     127                 :            : private:
     128                 :            :     XMLHatchStyleExport maHatchStyle;
     129                 :            : };
     130                 :            : 
     131                 :            : class SvxXMLGradientEntryExporter : public SvxXMLTableEntryExporter
     132                 :            : {
     133                 :            : public:
     134                 :            :     SvxXMLGradientEntryExporter( SvXMLExport& rExport );
     135                 :            :     virtual ~SvxXMLGradientEntryExporter();
     136                 :            : 
     137                 :            :     virtual void exportEntry( const OUString& rStrName, const Any& rValue );
     138                 :            : private:
     139                 :            :     XMLGradientStyleExport maGradientStyle;
     140                 :            : };
     141                 :            : 
     142                 :            : class SvxXMLBitmapEntryExporter : public SvxXMLTableEntryExporter
     143                 :            : {
     144                 :            : public:
     145                 :            :     SvxXMLBitmapEntryExporter( SvXMLExport& rExport );
     146                 :            :     virtual ~SvxXMLBitmapEntryExporter();
     147                 :            : 
     148                 :            :     virtual void exportEntry( const OUString& rStrName, const Any& rValue );
     149                 :            : 
     150                 :            : private:
     151                 :            :     XMLImageStyle maImageStyle;
     152                 :            : };
     153                 :            : 
     154                 :            : ///////////////////////////////////////////////////////////////////////
     155                 :            : 
     156                 :            : // #110680#
     157                 :          0 : SvxXMLXTableExportComponent::SvxXMLXTableExportComponent(
     158                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
     159                 :            :     const OUString& rFileName,
     160                 :            :     const uno::Reference<xml::sax::XDocumentHandler> & rHandler,
     161                 :            :     const uno::Reference<container::XNameContainer >& xTable,
     162                 :            :     uno::Reference<document::XGraphicObjectResolver >& xGrfResolver )
     163                 :            : :   SvXMLExport( xServiceFactory, rFileName, rHandler, NULL, MAP_100TH_MM),
     164         [ #  # ]:          0 :     mxTable( xTable )
     165                 :            : {
     166                 :            : 
     167 [ #  # ][ #  # ]:          0 :     _GetNamespaceMap().Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
                 [ #  # ]
     168 [ #  # ][ #  # ]:          0 :     _GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
                 [ #  # ]
     169 [ #  # ][ #  # ]:          0 :     _GetNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
                 [ #  # ]
     170 [ #  # ][ #  # ]:          0 :     _GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
                 [ #  # ]
     171 [ #  # ][ #  # ]:          0 :     _GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG),  XML_NAMESPACE_SVG );
                 [ #  # ]
     172         [ #  # ]:          0 :     SetGraphicResolver( xGrfResolver );
     173                 :          0 :     setExportFlags( 0 );
     174                 :          0 : }
     175                 :            : 
     176                 :          0 : SvxXMLXTableExportComponent::~SvxXMLXTableExportComponent()
     177                 :            : {
     178         [ #  # ]:          0 : }
     179                 :            : 
     180                 :          0 : static void initializeStreamMetadata( const uno::Reference< uno::XInterface > &xOut )
     181                 :            : {
     182         [ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xProps( xOut, uno::UNO_QUERY );
     183         [ #  # ]:          0 :     if( !xProps.is() )
     184                 :            :     {
     185                 :            :         OSL_FAIL( "Missing stream metadata interface" );
     186                 :          0 :         return;
     187                 :            :     }
     188                 :            : 
     189                 :            :     try
     190                 :            :     {
     191         [ #  # ]:          0 :         xProps->setPropertyValue(
     192                 :            :             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
     193 [ #  # ][ #  # ]:          0 :             uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/xml" ) ) ) );
         [ #  # ][ #  # ]
     194                 :            : 
     195                 :            :         // use stock encryption
     196         [ #  # ]:          0 :         xProps->setPropertyValue(
     197                 :            :             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ),
     198 [ #  # ][ #  # ]:          0 :             uno::makeAny( sal_True ) );
         [ #  # ][ #  # ]
     199         [ #  # ]:          0 :     } catch ( const uno::Exception & )
     200                 :            :     {
     201                 :            :         OSL_FAIL( "exception setting stream metadata" );
     202         [ #  # ]:          0 :     }
     203                 :            : }
     204                 :            : 
     205                 :          0 : static void createStorageStream( uno::Reference < io::XOutputStream > *xOut,
     206                 :            :                                  SvXMLGraphicHelper                  **ppGraphicHelper,
     207                 :            :                                  uno::Reference < embed::XStorage >    xSubStorage )
     208                 :            : {
     209                 :          0 :     uno::Reference < io::XStream > xStream;
     210         [ #  # ]:          0 :     xStream = xSubStorage->openStreamElement(
     211                 :            :                         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) ),
     212 [ #  # ][ #  # ]:          0 :                         embed::ElementModes::WRITE );
                 [ #  # ]
     213         [ #  # ]:          0 :     *ppGraphicHelper = SvXMLGraphicHelper::Create( xSubStorage, GRAPHICHELPER_MODE_WRITE );
     214         [ #  # ]:          0 :     initializeStreamMetadata( xStream );
     215 [ #  # ][ #  # ]:          0 :     *xOut = xStream->getOutputStream();
                 [ #  # ]
     216                 :          0 : }
     217                 :            : 
     218                 :          0 : bool SvxXMLXTableExportComponent::save(
     219                 :            :         const OUString& rURL,
     220                 :            :         const uno::Reference<container::XNameContainer >& xTable,
     221                 :            :         const uno::Reference<embed::XStorage >& xStorage,
     222                 :            :         rtl::OUString *pOptName ) throw()
     223                 :            : {
     224                 :          0 :     bool bRet = false;
     225                 :          0 :     SfxMedium* pMedium = NULL;
     226                 :          0 :     SvXMLGraphicHelper* pGraphicHelper = NULL;
     227                 :          0 :     sal_Int32 eCreate = embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE;
     228                 :            : 
     229         [ #  # ]:          0 :     INetURLObject aURLObj( rURL );
     230                 :          0 :     bool bToStorage = aURLObj.GetProtocol() == INET_PROT_NOT_VALID; // a relative path
     231                 :            : 
     232 [ #  # ][ #  # ]:          0 :     sal_Bool bSaveAsStorage = xTable->getElementType() == ::getCppuType((const OUString*)0);
                 [ #  # ]
     233                 :            : 
     234         [ #  # ]:          0 :     if( pOptName )
     235                 :          0 :         *pOptName = rURL;
     236                 :            : 
     237                 :            :     try
     238                 :            :     {
     239         [ #  # ]:          0 :         uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
     240         [ #  # ]:          0 :         if( !xServiceFactory.is() )
     241                 :            :         {
     242                 :            :             OSL_FAIL( "got no service manager" );
     243                 :          0 :             return false;
     244                 :            :         }
     245                 :            : 
     246 [ #  # ][ #  # ]:          0 :         uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
                 [ #  # ]
     247         [ #  # ]:          0 :         if( !xWriter.is() )
     248                 :            :         {
     249                 :            :             OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" );
     250                 :          0 :             return false;
     251                 :            :         }
     252                 :            : 
     253                 :          0 :         uno::Reference < io::XStream > xStream;
     254                 :          0 :         uno::Reference < io::XOutputStream > xOut;
     255                 :          0 :         uno::Reference<embed::XStorage > xSubStorage;
     256                 :          0 :         uno::Reference< XGraphicObjectResolver > xGrfResolver;
     257                 :            : 
     258         [ #  # ]:          0 :         uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
     259                 :            : 
     260 [ #  # ][ #  # ]:          0 :         if( !bToStorage || !xStorage.is() )
                 [ #  # ]
     261                 :            :         { // local URL -> SfxMedium route
     262         [ #  # ]:          0 :             if( bSaveAsStorage )
     263 [ #  # ][ #  # ]:          0 :                 xSubStorage = ::comphelper::OStorageHelper::GetStorageFromURL( rURL, eCreate );
     264                 :            :             else
     265                 :            :             {
     266 [ #  # ][ #  # ]:          0 :                 pMedium = new SfxMedium( rURL, STREAM_WRITE | STREAM_TRUNC );
         [ #  # ][ #  # ]
     267         [ #  # ]:          0 :                 pMedium->IsRemote();
     268                 :            : 
     269         [ #  # ]:          0 :                 SvStream* pStream = pMedium->GetOutStream();
     270         [ #  # ]:          0 :                 if( !pStream )
     271                 :            :                 {
     272                 :            :                     OSL_FAIL( "no output stream!" );
     273                 :          0 :                     return false;
     274                 :            :                 }
     275                 :            : 
     276 [ #  # ][ #  # ]:          0 :                 xOut = new utl::OOutputStreamWrapper( *pStream );
                 [ #  # ]
     277                 :            :             }
     278                 :            :         }
     279                 :            :         else // save into the xSubStorage
     280                 :            :         {
     281                 :          0 :             rtl::OUString aPath = rURL;
     282                 :            : 
     283         [ #  # ]:          0 :             if( bSaveAsStorage )
     284                 :            :             {
     285                 :            :                 try {
     286 [ #  # ][ #  # ]:          0 :                     xSubStorage = xStorage->openStorageElement( aPath, eCreate );
         [ #  # ][ #  # ]
     287         [ #  # ]:          0 :                 } catch (uno::Exception &) {
     288                 :            :                     OSL_FAIL( "no output storage!" );
     289                 :          0 :                     return false;
     290                 :            :                 }
     291                 :            :             }
     292                 :            :             else
     293                 :            :             {
     294         [ #  # ]:          0 :                 aPath += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".xml" ) );
     295                 :            :                 try {
     296 [ #  # ][ #  # ]:          0 :                     xStream = xStorage->openStreamElement( aPath, eCreate );
                 [ #  # ]
     297         [ #  # ]:          0 :                     if( !xStream.is() )
     298                 :          0 :                         return false;
     299         [ #  # ]:          0 :                     initializeStreamMetadata( xStream );
     300 [ #  # ][ #  # ]:          0 :                     xOut = xStream->getOutputStream();
         [ #  # ][ #  # ]
     301         [ #  # ]:          0 :                 } catch (uno::Exception &) {
     302                 :            :                     OSL_FAIL( "no output stream!" );
     303                 :          0 :                     return false;
     304                 :            :                 }
     305         [ #  # ]:          0 :                 if( pOptName )
     306                 :          0 :                     *pOptName = aPath;
     307         [ #  # ]:          0 :             }
     308                 :            :         }
     309                 :            : 
     310 [ #  # ][ #  # ]:          0 :         if( !xOut.is() && xSubStorage.is() )
                 [ #  # ]
     311         [ #  # ]:          0 :             createStorageStream( &xOut, &pGraphicHelper, xSubStorage );
     312         [ #  # ]:          0 :         if( !xOut.is() )
     313                 :          0 :             return false;
     314                 :            : 
     315         [ #  # ]:          0 :         uno::Reference<io::XActiveDataSource> xMetaSrc( xWriter, uno::UNO_QUERY );
     316 [ #  # ][ #  # ]:          0 :         xMetaSrc->setOutputStream( xOut );
     317         [ #  # ]:          0 :         if( pGraphicHelper )
     318 [ #  # ][ #  # ]:          0 :             xGrfResolver = pGraphicHelper;
     319                 :            : 
     320                 :            :         // Finally do the export
     321                 :          0 :         const OUString aName;
     322         [ #  # ]:          0 :         SvxXMLXTableExportComponent aExporter( xServiceFactory, aName, xHandler, xTable, xGrfResolver );
     323                 :          0 :         bRet = aExporter.exportTable();
     324                 :            : 
     325         [ #  # ]:          0 :         if( pGraphicHelper )
     326         [ #  # ]:          0 :             SvXMLGraphicHelper::Destroy( pGraphicHelper );
     327                 :            : 
     328         [ #  # ]:          0 :         if( xSubStorage.is() )
     329                 :            :         {
     330         [ #  # ]:          0 :             uno::Reference< XTransactedObject > xTrans( xSubStorage, UNO_QUERY );
     331         [ #  # ]:          0 :             if( xTrans.is() )
     332 [ #  # ][ #  # ]:          0 :                 xTrans->commit();
     333                 :            : 
     334         [ #  # ]:          0 :             uno::Reference< XComponent > xComp( xSubStorage, UNO_QUERY );
     335         [ #  # ]:          0 :             if( xComp.is() )
     336 [ #  # ][ #  # ]:          0 :                 xSubStorage->dispose();
     337 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     338                 :            :     }
     339         [ #  # ]:          0 :     catch( uno::Exception& )
     340                 :            :     {
     341                 :          0 :         bRet = false;
     342                 :            :     }
     343                 :            : 
     344         [ #  # ]:          0 :     if( pMedium )
     345                 :            :     {
     346         [ #  # ]:          0 :         pMedium->Commit();
     347 [ #  # ][ #  # ]:          0 :         delete pMedium;
     348                 :            :     }
     349                 :            : 
     350         [ #  # ]:          0 :     return bRet;
     351                 :            : }
     352                 :            : 
     353                 :          0 : bool SvxXMLXTableExportComponent::exportTable() throw()
     354                 :            : {
     355                 :          0 :     bool bRet = false;
     356                 :            : 
     357                 :            :     try
     358                 :            :     {
     359 [ #  # ][ #  # ]:          0 :         GetDocHandler()->startDocument();
     360                 :            : 
     361         [ #  # ]:          0 :         addChaffWhenEncryptedStorage();
     362                 :            : 
     363                 :            :         // export namespaces
     364         [ #  # ]:          0 :         sal_uInt16 nPos = GetNamespaceMap().GetFirstKey();
     365         [ #  # ]:          0 :         while( USHRT_MAX != nPos )
     366                 :            :         {
     367 [ #  # ][ #  # ]:          0 :             GetAttrList().AddAttribute( GetNamespaceMap().GetAttrNameByKey( nPos ), GetNamespaceMap().GetNameByKey( nPos ) );
                 [ #  # ]
     368         [ #  # ]:          0 :             nPos = GetNamespaceMap().GetNextKey( nPos );
     369                 :            :         }
     370                 :            : 
     371                 :            :         do
     372                 :            :         {
     373         [ #  # ]:          0 :             if( !mxTable.is() )
     374                 :            :                 break;
     375                 :            : 
     376                 :            :             char const* pEleName;
     377 [ #  # ][ #  # ]:          0 :             Type aExportType = mxTable->getElementType();
     378                 :          0 :             SvxXMLTableEntryExporter* pExporter = NULL;
     379                 :            : 
     380 [ #  # ][ #  # ]:          0 :             if( aExportType == ::getCppuType((const sal_Int32*)0) )
     381                 :            :             {
     382         [ #  # ]:          0 :                 pExporter = new SvxXMLColorEntryExporter(*this);
     383                 :          0 :                 pEleName = "color-table";
     384                 :            :             }
     385 [ #  # ][ #  # ]:          0 :             else if( aExportType == ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
     386                 :            :             {
     387 [ #  # ][ #  # ]:          0 :                 pExporter = new SvxXMLLineEndEntryExporter(*this);
     388                 :          0 :                 pEleName = "marker-table";
     389                 :            :             }
     390 [ #  # ][ #  # ]:          0 :             else if( aExportType == ::getCppuType((const drawing::LineDash*)0) )
     391                 :            :             {
     392 [ #  # ][ #  # ]:          0 :                 pExporter = new SvxXMLDashEntryExporter(*this);
     393                 :          0 :                 pEleName = "dash-table";
     394                 :            :             }
     395 [ #  # ][ #  # ]:          0 :             else if( aExportType == ::getCppuType((const drawing::Hatch*)0) )
     396                 :            :             {
     397 [ #  # ][ #  # ]:          0 :                 pExporter = new SvxXMLHatchEntryExporter(*this);
     398                 :          0 :                 pEleName = "hatch-table";
     399                 :            :             }
     400 [ #  # ][ #  # ]:          0 :             else if( aExportType == ::getCppuType((const awt::Gradient*)0))
     401                 :            :             {
     402 [ #  # ][ #  # ]:          0 :                 pExporter = new SvxXMLGradientEntryExporter(*this);
     403                 :          0 :                 pEleName = "gradient-table";
     404                 :            :             }
     405 [ #  # ][ #  # ]:          0 :             else if( aExportType == ::getCppuType((const OUString*)0))
     406                 :            :             {
     407 [ #  # ][ #  # ]:          0 :                 pExporter = new SvxXMLBitmapEntryExporter(*this);
     408                 :          0 :                 pEleName = "bitmap-table";
     409                 :            :             }
     410                 :            :             else
     411                 :            :             {
     412                 :            :                 OSL_FAIL( "unknown type for export");
     413                 :            :                 break;
     414                 :            :             }
     415                 :            : 
     416         [ #  # ]:          0 :             SvXMLElementExport aElem( *this, XML_NAMESPACE_OOO, pEleName, sal_True, sal_True );
     417                 :            : 
     418 [ #  # ][ #  # ]:          0 :             Sequence< OUString > aNames = mxTable->getElementNames();
     419                 :          0 :             const sal_Int32 nCount = aNames.getLength();
     420                 :          0 :             const OUString* pNames = aNames.getConstArray();
     421                 :          0 :             Any aAny;
     422                 :            : 
     423                 :            :             sal_Int32 nIndex;
     424         [ #  # ]:          0 :             for( nIndex = 0; nIndex < nCount; nIndex++, pNames++ )
     425                 :            :             {
     426 [ #  # ][ #  # ]:          0 :                 aAny = mxTable->getByName( *pNames );
     427         [ #  # ]:          0 :                 pExporter->exportEntry( *pNames, aAny );
     428                 :            :             }
     429                 :            : 
     430 [ #  # ][ #  # ]:          0 :             bRet = true;
         [ #  # ][ #  # ]
     431                 :            :         }
     432                 :            :         while(0);
     433                 :            : 
     434 [ #  # ][ #  # ]:          0 :         GetDocHandler()->endDocument();
     435                 :            :     }
     436                 :          0 :     catch( Exception const& )
     437                 :            :     {
     438                 :          0 :         bRet = false;
     439                 :            :     }
     440                 :            : 
     441                 :          0 :     return bRet;
     442                 :            : }
     443                 :            : 
     444                 :            : // methods without content:
     445                 :          0 : void SvxXMLXTableExportComponent::_ExportAutoStyles() {}
     446                 :          0 : void SvxXMLXTableExportComponent::_ExportMasterStyles() {}
     447                 :          0 : void SvxXMLXTableExportComponent::_ExportContent() {}
     448                 :            : 
     449                 :            : ///////////////////////////////////////////////////////////////////////
     450                 :            : 
     451                 :          0 : SvxXMLTableEntryExporter::~SvxXMLTableEntryExporter()
     452                 :            : {
     453         [ #  # ]:          0 : }
     454                 :            : 
     455                 :            : ///////////////////////////////////////////////////////////////////////
     456                 :            : 
     457                 :          0 : SvxXMLColorEntryExporter::SvxXMLColorEntryExporter( SvXMLExport& rExport )
     458                 :          0 : : SvxXMLTableEntryExporter( rExport )
     459                 :            : {
     460                 :          0 : }
     461                 :            : 
     462                 :          0 : SvxXMLColorEntryExporter::~SvxXMLColorEntryExporter()
     463                 :            : {
     464         [ #  # ]:          0 : }
     465                 :            : 
     466                 :          0 : void SvxXMLColorEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
     467                 :            : {
     468         [ #  # ]:          0 :     mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, rStrName );
     469                 :            : 
     470                 :          0 :     sal_Int32 nColor = 0;
     471                 :          0 :     rValue >>= nColor;
     472                 :            : 
     473                 :          0 :     OUStringBuffer aOut;
     474         [ #  # ]:          0 :     ::sax::Converter::convertColor( aOut, nColor );
     475 [ #  # ][ #  # ]:          0 :     mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, aOut.makeStringAndClear() );
     476                 :            : 
     477 [ #  # ][ #  # ]:          0 :     SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_COLOR, sal_True, sal_True );
     478                 :          0 : }
     479                 :            : 
     480                 :            : ///////////////////////////////////////////////////////////////////////
     481                 :            : 
     482                 :          0 : SvxXMLLineEndEntryExporter::SvxXMLLineEndEntryExporter( SvXMLExport& rExport )
     483         [ #  # ]:          0 : : SvxXMLTableEntryExporter( rExport ), maMarkerStyle( rExport )
     484                 :            : {
     485                 :          0 : }
     486                 :            : 
     487         [ #  # ]:          0 : SvxXMLLineEndEntryExporter::~SvxXMLLineEndEntryExporter()
     488                 :            : {
     489         [ #  # ]:          0 : }
     490                 :            : 
     491                 :          0 : void SvxXMLLineEndEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
     492                 :            : {
     493                 :          0 :     maMarkerStyle.exportXML( rStrName, rValue );
     494                 :          0 : }
     495                 :            : 
     496                 :            : ///////////////////////////////////////////////////////////////////////
     497                 :            : 
     498                 :          0 : SvxXMLDashEntryExporter::SvxXMLDashEntryExporter( SvXMLExport& rExport )
     499         [ #  # ]:          0 : : SvxXMLTableEntryExporter( rExport ), maDashStyle( rExport )
     500                 :            : {
     501                 :          0 : }
     502                 :            : 
     503         [ #  # ]:          0 : SvxXMLDashEntryExporter::~SvxXMLDashEntryExporter()
     504                 :            : {
     505         [ #  # ]:          0 : }
     506                 :            : 
     507                 :          0 : void SvxXMLDashEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
     508                 :            : {
     509                 :          0 :     maDashStyle.exportXML( rStrName, rValue );
     510                 :          0 : }
     511                 :            : 
     512                 :            : ///////////////////////////////////////////////////////////////////////
     513                 :            : 
     514                 :          0 : SvxXMLHatchEntryExporter::SvxXMLHatchEntryExporter( SvXMLExport& rExport )
     515         [ #  # ]:          0 : : SvxXMLTableEntryExporter( rExport ), maHatchStyle( rExport )
     516                 :            : {
     517                 :          0 : }
     518                 :            : 
     519         [ #  # ]:          0 : SvxXMLHatchEntryExporter::~SvxXMLHatchEntryExporter()
     520                 :            : {
     521         [ #  # ]:          0 : }
     522                 :            : 
     523                 :          0 : void SvxXMLHatchEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
     524                 :            : {
     525                 :          0 :     maHatchStyle.exportXML( rStrName, rValue );
     526                 :          0 : }
     527                 :            : 
     528                 :            : ///////////////////////////////////////////////////////////////////////
     529                 :            : 
     530                 :          0 : SvxXMLGradientEntryExporter::SvxXMLGradientEntryExporter( SvXMLExport& rExport )
     531         [ #  # ]:          0 : : SvxXMLTableEntryExporter( rExport ), maGradientStyle( rExport )
     532                 :            : {
     533                 :          0 : }
     534                 :            : 
     535         [ #  # ]:          0 : SvxXMLGradientEntryExporter::~SvxXMLGradientEntryExporter()
     536                 :            : {
     537         [ #  # ]:          0 : }
     538                 :            : 
     539                 :          0 : void SvxXMLGradientEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
     540                 :            : {
     541                 :          0 :     maGradientStyle.exportXML( rStrName, rValue );
     542                 :          0 : }
     543                 :            : 
     544                 :            : ///////////////////////////////////////////////////////////////////////
     545                 :            : 
     546                 :          0 : SvxXMLBitmapEntryExporter::SvxXMLBitmapEntryExporter( SvXMLExport& rExport )
     547         [ #  # ]:          0 : : SvxXMLTableEntryExporter( rExport )
     548                 :            : {
     549                 :          0 : }
     550                 :            : 
     551         [ #  # ]:          0 : SvxXMLBitmapEntryExporter::~SvxXMLBitmapEntryExporter()
     552                 :            : {
     553         [ #  # ]:          0 : }
     554                 :            : 
     555                 :          0 : void SvxXMLBitmapEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
     556                 :            : {
     557                 :          0 :     maImageStyle.exportXML( rStrName, rValue, mrExport );
     558                 :          0 : }
     559                 :            : 
     560                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10