2001-02-23 20:37:19 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 00:16:48 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-02-23 20:37:19 +00:00
|
|
|
*
|
2005-09-09 00:16:48 +00:00
|
|
|
* $RCSfile: xmlxtexp.cxx,v $
|
2001-02-23 20:37:19 +00:00
|
|
|
*
|
2006-09-17 05:21:09 +00:00
|
|
|
* $Revision: 1.17 $
|
2001-02-23 20:37:19 +00:00
|
|
|
*
|
2006-09-17 05:21:09 +00:00
|
|
|
* last change: $Author: obo $ $Date: 2006-09-17 06:21:09 $
|
2001-02-23 20:37:19 +00:00
|
|
|
*
|
2005-09-09 00:16:48 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2001-02-23 20:37:19 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 00:16:48 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2001-02-23 20:37:19 +00:00
|
|
|
*
|
2005-09-09 00:16:48 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2001-02-23 20:37:19 +00:00
|
|
|
*
|
2005-09-09 00:16:48 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-02-23 20:37:19 +00:00
|
|
|
*
|
2005-09-09 00:16:48 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2001-02-23 20:37:19 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 05:21:09 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_svx.hxx"
|
|
|
|
|
2001-02-23 20:37:19 +00:00
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
|
|
|
|
#include <com/sun/star/container/XNameContainer.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
|
|
|
|
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
|
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_POLYPOLYGONBEZIERCOORDS_HPP_
|
|
|
|
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_LINEDASH_HPP_
|
|
|
|
#include <com/sun/star/drawing/LineDash.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
|
|
|
|
#include <com/sun/star/awt/Gradient.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_HATCH_HPP_
|
|
|
|
#include <com/sun/star/drawing/Hatch.hpp>
|
|
|
|
#endif
|
2002-09-17 10:49:31 +00:00
|
|
|
#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
|
|
|
|
#include <com/sun/star/io/XActiveDataSource.hpp>
|
|
|
|
#endif
|
2004-10-04 16:58:04 +00:00
|
|
|
#ifndef _COM_SUN_STAR_EMBED_ELEMENTMODES_HPP_
|
|
|
|
#include <com/sun/star/embed/ElementModes.hpp>
|
|
|
|
#endif
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
#ifndef _SFXDOCFILE_HXX
|
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _RTL_USTRBUF_HXX_
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLUCONV_HXX
|
|
|
|
#include <xmloff/xmluconv.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLNMSPE_HXX
|
|
|
|
#include "xmloff/xmlnmspe.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_NMSPMAP_HXX
|
|
|
|
#include "xmloff/nmspmap.hxx"
|
|
|
|
#endif
|
|
|
|
|
2005-01-11 13:34:00 +00:00
|
|
|
#include "xmloff/xmltoken.hxx"
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLMETAE_HXX
|
|
|
|
#include "xmloff/xmlmetae.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_DASHSTYLE_HXX
|
|
|
|
#include "xmloff/DashStyle.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_GRADIENTSTYLE_HXX
|
|
|
|
#include "xmloff/GradientStyle.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_HATCHSTYLE_HXX
|
|
|
|
#include "xmloff/HatchStyle.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_IMAGESTYLE_HXX
|
|
|
|
#include "xmloff/ImageStyle.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_MARKERSTYLE_HXX
|
|
|
|
#include "xmloff/MarkerStyle.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
|
|
|
|
#include <com/sun/star/container/XNameContainer.hpp>
|
|
|
|
#endif
|
|
|
|
|
2005-07-14 09:50:07 +00:00
|
|
|
#ifndef _COM_SUN_STAR_EMBED_XTRANSACTEDOBJECT_HPP_
|
|
|
|
#include <com/sun/star/embed/XTransactedObject.hpp>
|
|
|
|
#endif
|
|
|
|
|
2001-02-23 20:37:19 +00:00
|
|
|
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _UTL_STREAM_WRAPPER_HXX_
|
|
|
|
#include <unotools/streamwrap.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLGRHLP_HXX
|
|
|
|
#include "xmlgrhlp.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "xmlxtexp.hxx"
|
|
|
|
|
2004-10-04 16:58:04 +00:00
|
|
|
#include <comphelper/storagehelper.hxx>
|
|
|
|
|
2001-02-23 20:37:19 +00:00
|
|
|
using namespace com::sun::star;
|
|
|
|
using namespace com::sun::star::container;
|
|
|
|
using namespace com::sun::star::document;
|
|
|
|
using namespace com::sun::star::uno;
|
|
|
|
using namespace com::sun::star::awt;
|
|
|
|
using namespace com::sun::star::lang;
|
|
|
|
using namespace com::sun::star::xml::sax;
|
2004-07-13 06:51:55 +00:00
|
|
|
using namespace ::xmloff::token;
|
2001-02-23 20:37:19 +00:00
|
|
|
using namespace ::rtl;
|
|
|
|
using namespace cppu;
|
|
|
|
|
2005-07-14 09:50:07 +00:00
|
|
|
using com::sun::star::embed::XTransactedObject;
|
|
|
|
|
2001-02-23 20:37:19 +00:00
|
|
|
class SvxXMLTableEntryExporter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SvxXMLTableEntryExporter( SvXMLExport& rExport ) : mrExport( rExport ) {}
|
|
|
|
virtual ~SvxXMLTableEntryExporter();
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
virtual void exportEntry( const OUString& rStrName, const Any& rValue ) = 0;
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
SvXMLExport& mrExport;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SvxXMLColorEntryExporter : public SvxXMLTableEntryExporter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SvxXMLColorEntryExporter( SvXMLExport& rExport );
|
|
|
|
virtual ~SvxXMLColorEntryExporter();
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
virtual void exportEntry( const OUString& rStrName, const Any& rValue );
|
2001-02-23 20:37:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SvxXMLLineEndEntryExporter : public SvxXMLTableEntryExporter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SvxXMLLineEndEntryExporter( SvXMLExport& rExport );
|
|
|
|
SvxXMLLineEndEntryExporter();
|
|
|
|
virtual ~SvxXMLLineEndEntryExporter();
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
virtual void exportEntry( const OUString& rStrName, const Any& rValue );
|
2001-02-23 20:37:19 +00:00
|
|
|
private:
|
2001-10-19 17:48:55 +00:00
|
|
|
XMLMarkerStyleExport maMarkerStyle;
|
2001-02-23 20:37:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SvxXMLDashEntryExporter : public SvxXMLTableEntryExporter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SvxXMLDashEntryExporter( SvXMLExport& rExport );
|
|
|
|
virtual ~SvxXMLDashEntryExporter();
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
virtual void exportEntry( const OUString& rStrName, const Any& rValue );
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
private:
|
2001-10-19 17:48:55 +00:00
|
|
|
XMLDashStyleExport maDashStyle;
|
2001-02-23 20:37:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SvxXMLHatchEntryExporter : public SvxXMLTableEntryExporter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SvxXMLHatchEntryExporter( SvXMLExport& rExport );
|
|
|
|
virtual ~SvxXMLHatchEntryExporter();
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
virtual void exportEntry( const OUString& rStrName, const Any& rValue );
|
2001-02-23 20:37:19 +00:00
|
|
|
private:
|
2001-10-19 17:48:55 +00:00
|
|
|
XMLHatchStyleExport maHatchStyle;
|
2001-02-23 20:37:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SvxXMLGradientEntryExporter : public SvxXMLTableEntryExporter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SvxXMLGradientEntryExporter( SvXMLExport& rExport );
|
|
|
|
virtual ~SvxXMLGradientEntryExporter();
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
virtual void exportEntry( const OUString& rStrName, const Any& rValue );
|
2001-02-23 20:37:19 +00:00
|
|
|
private:
|
2001-10-19 17:48:55 +00:00
|
|
|
XMLGradientStyleExport maGradientStyle;
|
2001-02-23 20:37:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SvxXMLBitmapEntryExporter : public SvxXMLTableEntryExporter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SvxXMLBitmapEntryExporter( SvXMLExport& rExport );
|
|
|
|
virtual ~SvxXMLBitmapEntryExporter();
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
virtual void exportEntry( const OUString& rStrName, const Any& rValue );
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
XMLImageStyle maImageStyle;
|
|
|
|
};
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
2004-05-03 12:28:35 +00:00
|
|
|
// #110680#
|
2001-02-23 20:37:19 +00:00
|
|
|
SvxXMLXTableExportComponent::SvxXMLXTableExportComponent(
|
2004-05-03 12:28:35 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
|
2001-02-23 20:37:19 +00:00
|
|
|
const OUString& rFileName,
|
|
|
|
const uno::Reference<xml::sax::XDocumentHandler> & rHandler,
|
|
|
|
const uno::Reference<container::XNameContainer >& xTable,
|
2004-05-03 12:28:35 +00:00
|
|
|
uno::Reference<document::XGraphicObjectResolver >& xGrfResolver )
|
|
|
|
: SvXMLExport( xServiceFactory, rFileName, rHandler, NULL, MAP_100TH_MM),
|
|
|
|
mxTable( xTable )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
2004-07-13 06:51:55 +00:00
|
|
|
|
2004-11-09 11:38:38 +00:00
|
|
|
_GetNamespaceMap().Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
|
|
|
|
_GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
|
|
|
|
_GetNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
|
|
|
|
_GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
|
2005-01-28 14:45:11 +00:00
|
|
|
_GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG), XML_NAMESPACE_SVG );
|
2001-02-23 20:37:19 +00:00
|
|
|
SetGraphicResolver( xGrfResolver );
|
2001-06-21 13:53:46 +00:00
|
|
|
setExportFlags( 0 );
|
2001-02-23 20:37:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SvxXMLXTableExportComponent::~SvxXMLXTableExportComponent()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SvxXMLXTableExportComponent::save( const OUString& rURL, const uno::Reference<container::XNameContainer >& xTable ) throw()
|
|
|
|
{
|
2004-10-04 16:58:04 +00:00
|
|
|
uno::Reference < embed::XStorage > xStorage;
|
2001-02-23 20:37:19 +00:00
|
|
|
SfxMedium* pMedium = NULL;
|
|
|
|
sal_Bool bRet = sal_False;
|
|
|
|
|
|
|
|
Reference< XGraphicObjectResolver > xGrfResolver;
|
|
|
|
SvXMLGraphicHelper* pGraphicHelper = 0;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2004-10-04 16:58:04 +00:00
|
|
|
uno::Reference < io::XOutputStream > xOut;
|
|
|
|
uno::Reference < io::XStream > xStream;
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
sal_Bool bNeedStorage = xTable->getElementType() == ::getCppuType((const OUString*)0);
|
|
|
|
|
|
|
|
uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
|
|
|
|
if( !xServiceFactory.is() )
|
|
|
|
{
|
|
|
|
DBG_ERROR( "got no service manager" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
|
|
|
|
if( !xWriter.is() )
|
|
|
|
{
|
|
|
|
DBG_ERROR( "com.sun.star.xml.sax.Writer service missing" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
|
|
|
|
|
|
|
|
if( bNeedStorage )
|
|
|
|
{
|
2004-10-04 16:58:04 +00:00
|
|
|
xStorage =
|
|
|
|
::comphelper::OStorageHelper::GetStorageFromURL( rURL, embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE );
|
2001-02-23 20:37:19 +00:00
|
|
|
|
2004-10-04 16:58:04 +00:00
|
|
|
if( !xStorage.is() )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
DBG_ERROR( "no storage!" );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString sMetaName( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) );
|
2004-10-04 16:58:04 +00:00
|
|
|
xStream = xStorage->openStreamElement( sMetaName, embed::ElementModes::WRITE );
|
|
|
|
pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, GRAPHICHELPER_MODE_WRITE );
|
2001-02-23 20:37:19 +00:00
|
|
|
xGrfResolver = pGraphicHelper;
|
2004-10-04 16:58:04 +00:00
|
|
|
xOut = xStream->getOutputStream();
|
2001-02-23 20:37:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pMedium = new SfxMedium( rURL, STREAM_WRITE | STREAM_TRUNC, TRUE );
|
|
|
|
pMedium->IsRemote();
|
|
|
|
|
|
|
|
SvStream* pStream = pMedium->GetOutStream();
|
|
|
|
if( NULL == pStream )
|
|
|
|
{
|
|
|
|
DBG_ERROR( "no output stream!" );
|
|
|
|
break;
|
|
|
|
}
|
2004-10-04 16:58:04 +00:00
|
|
|
|
2001-02-23 20:37:19 +00:00
|
|
|
xOut = new utl::OOutputStreamWrapper( *pStream );
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference<io::XActiveDataSource> xMetaSrc( xWriter, uno::UNO_QUERY );
|
|
|
|
xMetaSrc->setOutputStream( xOut );
|
|
|
|
|
|
|
|
const OUString aName;
|
2004-05-03 12:28:35 +00:00
|
|
|
|
|
|
|
// #110680#
|
|
|
|
// SvxXMLXTableExportComponent aExporter( aName, xHandler, xTable, xGrfResolver );
|
|
|
|
SvxXMLXTableExportComponent aExporter( xServiceFactory, aName, xHandler, xTable, xGrfResolver );
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
bRet = aExporter.exportTable();
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
while( 0 );
|
|
|
|
|
|
|
|
if( pGraphicHelper )
|
|
|
|
SvXMLGraphicHelper::Destroy( pGraphicHelper );
|
2005-07-14 09:50:07 +00:00
|
|
|
|
|
|
|
if( xStorage.is() )
|
|
|
|
{
|
|
|
|
Reference< XTransactedObject > xTrans( xStorage, UNO_QUERY );
|
|
|
|
if( xTrans.is() )
|
|
|
|
xTrans->commit();
|
|
|
|
|
|
|
|
Reference< XComponent > xComp( xStorage, UNO_QUERY );
|
|
|
|
if( xComp.is() )
|
|
|
|
xStorage->dispose();
|
|
|
|
}
|
2001-02-23 20:37:19 +00:00
|
|
|
}
|
|
|
|
catch( uno::Exception& e )
|
|
|
|
{
|
|
|
|
bRet = sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pMedium )
|
2001-03-08 09:45:45 +00:00
|
|
|
{
|
|
|
|
pMedium->Commit();
|
2001-02-23 20:37:19 +00:00
|
|
|
delete pMedium;
|
2001-03-08 09:45:45 +00:00
|
|
|
}
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
sal_Bool SvxXMLXTableExportComponent::exportTable() throw()
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
sal_Bool bRet = sal_False;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
GetDocHandler()->startDocument();
|
|
|
|
|
|
|
|
// export namespaces
|
2001-07-10 15:43:01 +00:00
|
|
|
sal_uInt16 nPos = GetNamespaceMap().GetFirstKey();
|
2001-02-23 20:37:19 +00:00
|
|
|
while( USHRT_MAX != nPos )
|
|
|
|
{
|
2003-03-27 14:06:05 +00:00
|
|
|
GetAttrList().AddAttribute( GetNamespaceMap().GetAttrNameByKey( nPos ), GetNamespaceMap().GetNameByKey( nPos ) );
|
2001-07-10 15:43:01 +00:00
|
|
|
nPos = GetNamespaceMap().GetNextKey( nPos );
|
2001-02-23 20:37:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if( !mxTable.is() )
|
|
|
|
break;
|
|
|
|
|
|
|
|
char* pEleName;
|
|
|
|
Type aExportType = mxTable->getElementType();
|
|
|
|
SvxXMLTableEntryExporter* pExporter = NULL;
|
|
|
|
|
|
|
|
if( aExportType == ::getCppuType((const sal_Int32*)0) )
|
|
|
|
{
|
|
|
|
pExporter = new SvxXMLColorEntryExporter(*this);
|
|
|
|
pEleName = "color-table";
|
|
|
|
}
|
|
|
|
else if( aExportType == ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
|
|
|
|
{
|
|
|
|
pExporter = new SvxXMLLineEndEntryExporter(*this);
|
|
|
|
pEleName = "marker-table";
|
|
|
|
}
|
|
|
|
else if( aExportType == ::getCppuType((const drawing::LineDash*)0) )
|
|
|
|
{
|
|
|
|
pExporter = new SvxXMLDashEntryExporter(*this);
|
|
|
|
pEleName = "dash-table";
|
|
|
|
}
|
|
|
|
else if( aExportType == ::getCppuType((const drawing::Hatch*)0) )
|
|
|
|
{
|
|
|
|
pExporter = new SvxXMLHatchEntryExporter(*this);
|
|
|
|
pEleName = "hatch-table";
|
|
|
|
}
|
|
|
|
else if( aExportType == ::getCppuType((const awt::Gradient*)0))
|
|
|
|
{
|
|
|
|
pExporter = new SvxXMLGradientEntryExporter(*this);
|
|
|
|
pEleName = "gradient-table";
|
|
|
|
}
|
|
|
|
else if( aExportType == ::getCppuType((const OUString*)0))
|
|
|
|
{
|
|
|
|
pExporter = new SvxXMLBitmapEntryExporter(*this);
|
|
|
|
pEleName = "bitmap-table";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DBG_ERROR( "unknown type for export");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-11-09 11:38:38 +00:00
|
|
|
SvXMLElementExport aElem( *this, XML_NAMESPACE_OOO, pEleName, sal_True, sal_True );
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
Sequence< OUString > aNames = mxTable->getElementNames();
|
|
|
|
const sal_Int32 nCount = aNames.getLength();
|
|
|
|
const OUString* pNames = aNames.getConstArray();
|
|
|
|
Any aAny;
|
|
|
|
|
|
|
|
sal_Int32 nIndex;
|
|
|
|
for( nIndex = 0; nIndex < nCount; nIndex++, pNames++ )
|
|
|
|
{
|
|
|
|
aAny = mxTable->getByName( *pNames );
|
2001-02-27 13:18:58 +00:00
|
|
|
pExporter->exportEntry( *pNames, aAny );
|
2001-02-23 20:37:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bRet = sal_True;
|
|
|
|
}
|
|
|
|
while(0);
|
|
|
|
|
|
|
|
GetDocHandler()->endDocument();
|
|
|
|
}
|
|
|
|
catch( Exception e )
|
|
|
|
{
|
|
|
|
bRet = sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// methods without content:
|
|
|
|
void SvxXMLXTableExportComponent::_ExportAutoStyles() {}
|
|
|
|
void SvxXMLXTableExportComponent::_ExportMasterStyles() {}
|
|
|
|
void SvxXMLXTableExportComponent::_ExportContent() {}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SvxXMLTableEntryExporter::~SvxXMLTableEntryExporter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SvxXMLColorEntryExporter::SvxXMLColorEntryExporter( SvXMLExport& rExport )
|
|
|
|
: SvxXMLTableEntryExporter( rExport )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxXMLColorEntryExporter::~SvxXMLColorEntryExporter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
void SvxXMLColorEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
2005-01-11 13:34:00 +00:00
|
|
|
mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, rStrName );
|
2001-02-23 20:37:19 +00:00
|
|
|
|
|
|
|
sal_Int32 nColor;
|
|
|
|
rValue >>= nColor;
|
|
|
|
|
|
|
|
OUStringBuffer aOut;
|
|
|
|
mrExport.GetMM100UnitConverter().convertColor( aOut, nColor );
|
2005-01-11 13:34:00 +00:00
|
|
|
mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, aOut.makeStringAndClear() );
|
2001-02-23 20:37:19 +00:00
|
|
|
|
2005-01-11 13:34:00 +00:00
|
|
|
SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_COLOR, sal_True, sal_True );
|
2001-02-23 20:37:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SvxXMLLineEndEntryExporter::SvxXMLLineEndEntryExporter( SvXMLExport& rExport )
|
2001-10-19 17:48:55 +00:00
|
|
|
: SvxXMLTableEntryExporter( rExport ), maMarkerStyle( rExport )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxXMLLineEndEntryExporter::~SvxXMLLineEndEntryExporter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
void SvxXMLLineEndEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
maMarkerStyle.exportXML( rStrName, rValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SvxXMLDashEntryExporter::SvxXMLDashEntryExporter( SvXMLExport& rExport )
|
2001-10-19 17:48:55 +00:00
|
|
|
: SvxXMLTableEntryExporter( rExport ), maDashStyle( rExport )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxXMLDashEntryExporter::~SvxXMLDashEntryExporter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
void SvxXMLDashEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
maDashStyle.exportXML( rStrName, rValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SvxXMLHatchEntryExporter::SvxXMLHatchEntryExporter( SvXMLExport& rExport )
|
2001-10-19 17:48:55 +00:00
|
|
|
: SvxXMLTableEntryExporter( rExport ), maHatchStyle( rExport )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxXMLHatchEntryExporter::~SvxXMLHatchEntryExporter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
void SvxXMLHatchEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
maHatchStyle.exportXML( rStrName, rValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SvxXMLGradientEntryExporter::SvxXMLGradientEntryExporter( SvXMLExport& rExport )
|
2001-10-19 17:48:55 +00:00
|
|
|
: SvxXMLTableEntryExporter( rExport ), maGradientStyle( rExport )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxXMLGradientEntryExporter::~SvxXMLGradientEntryExporter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
void SvxXMLGradientEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
maGradientStyle.exportXML( rStrName, rValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SvxXMLBitmapEntryExporter::SvxXMLBitmapEntryExporter( SvXMLExport& rExport )
|
|
|
|
: SvxXMLTableEntryExporter( rExport )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxXMLBitmapEntryExporter::~SvxXMLBitmapEntryExporter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-02-27 13:18:58 +00:00
|
|
|
void SvxXMLBitmapEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
maImageStyle.exportXML( rStrName, rValue, mrExport );
|
|
|
|
}
|