xref: /aoo42x/main/svx/source/xml/xmlxtexp.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir #include <tools/debug.hxx>
31*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
34*cdf0e10cSrcweir #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/drawing/LineDash.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/awt/Gradient.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/drawing/Hatch.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/io/XActiveDataSource.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/embed/ElementModes.hpp>
40*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
41*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
42*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
43*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
44*cdf0e10cSrcweir #include "xmloff/nmspmap.hxx"
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir #include "xmloff/xmltoken.hxx"
47*cdf0e10cSrcweir #include "xmloff/xmlmetae.hxx"
48*cdf0e10cSrcweir #include "xmloff/DashStyle.hxx"
49*cdf0e10cSrcweir #include "xmloff/GradientStyle.hxx"
50*cdf0e10cSrcweir #include "xmloff/HatchStyle.hxx"
51*cdf0e10cSrcweir #include "xmloff/ImageStyle.hxx"
52*cdf0e10cSrcweir #include "xmloff/MarkerStyle.hxx"
53*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
54*cdf0e10cSrcweir #include <com/sun/star/embed/XTransactedObject.hpp>
55*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
56*cdf0e10cSrcweir #include <unotools/streamwrap.hxx>
57*cdf0e10cSrcweir #include "svx/xmlgrhlp.hxx"
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir #include "xmlxtexp.hxx"
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir #include <comphelper/storagehelper.hxx>
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir using namespace com::sun::star;
64*cdf0e10cSrcweir using namespace com::sun::star::container;
65*cdf0e10cSrcweir using namespace com::sun::star::document;
66*cdf0e10cSrcweir using namespace com::sun::star::uno;
67*cdf0e10cSrcweir using namespace com::sun::star::awt;
68*cdf0e10cSrcweir using namespace com::sun::star::lang;
69*cdf0e10cSrcweir using namespace com::sun::star::xml::sax;
70*cdf0e10cSrcweir using namespace ::xmloff::token;
71*cdf0e10cSrcweir using namespace ::rtl;
72*cdf0e10cSrcweir using namespace cppu;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir using com::sun::star::embed::XTransactedObject;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir class SvxXMLTableEntryExporter
77*cdf0e10cSrcweir {
78*cdf0e10cSrcweir public:
79*cdf0e10cSrcweir 	SvxXMLTableEntryExporter( SvXMLExport& rExport ) : mrExport( rExport ) {}
80*cdf0e10cSrcweir 	virtual ~SvxXMLTableEntryExporter();
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 	virtual void exportEntry( const OUString& rStrName, const Any& rValue ) = 0;
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir protected:
85*cdf0e10cSrcweir 	SvXMLExport& mrExport;
86*cdf0e10cSrcweir };
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir class SvxXMLColorEntryExporter : public SvxXMLTableEntryExporter
89*cdf0e10cSrcweir {
90*cdf0e10cSrcweir public:
91*cdf0e10cSrcweir 	SvxXMLColorEntryExporter( SvXMLExport& rExport );
92*cdf0e10cSrcweir 	virtual ~SvxXMLColorEntryExporter();
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 	virtual void exportEntry( const OUString& rStrName, const Any& rValue );
95*cdf0e10cSrcweir };
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir class SvxXMLLineEndEntryExporter : public SvxXMLTableEntryExporter
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir public:
100*cdf0e10cSrcweir 	SvxXMLLineEndEntryExporter( SvXMLExport& rExport );
101*cdf0e10cSrcweir 	SvxXMLLineEndEntryExporter();
102*cdf0e10cSrcweir 	virtual ~SvxXMLLineEndEntryExporter();
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 	virtual void exportEntry( const OUString& rStrName, const Any& rValue );
105*cdf0e10cSrcweir private:
106*cdf0e10cSrcweir 	XMLMarkerStyleExport maMarkerStyle;
107*cdf0e10cSrcweir };
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir class SvxXMLDashEntryExporter : public SvxXMLTableEntryExporter
110*cdf0e10cSrcweir {
111*cdf0e10cSrcweir public:
112*cdf0e10cSrcweir 	SvxXMLDashEntryExporter( SvXMLExport& rExport );
113*cdf0e10cSrcweir 	virtual ~SvxXMLDashEntryExporter();
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	virtual void exportEntry( const OUString& rStrName, const Any& rValue );
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir private:
118*cdf0e10cSrcweir 	XMLDashStyleExport maDashStyle;
119*cdf0e10cSrcweir };
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir class SvxXMLHatchEntryExporter : public SvxXMLTableEntryExporter
122*cdf0e10cSrcweir {
123*cdf0e10cSrcweir public:
124*cdf0e10cSrcweir 	SvxXMLHatchEntryExporter( SvXMLExport& rExport );
125*cdf0e10cSrcweir 	virtual ~SvxXMLHatchEntryExporter();
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 	virtual void exportEntry( const OUString& rStrName, const Any& rValue );
128*cdf0e10cSrcweir private:
129*cdf0e10cSrcweir 	XMLHatchStyleExport maHatchStyle;
130*cdf0e10cSrcweir };
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir class SvxXMLGradientEntryExporter : public SvxXMLTableEntryExporter
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir public:
135*cdf0e10cSrcweir 	SvxXMLGradientEntryExporter( SvXMLExport& rExport );
136*cdf0e10cSrcweir 	virtual ~SvxXMLGradientEntryExporter();
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	virtual void exportEntry( const OUString& rStrName, const Any& rValue );
139*cdf0e10cSrcweir private:
140*cdf0e10cSrcweir 	XMLGradientStyleExport maGradientStyle;
141*cdf0e10cSrcweir };
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir class SvxXMLBitmapEntryExporter : public SvxXMLTableEntryExporter
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir public:
146*cdf0e10cSrcweir 	SvxXMLBitmapEntryExporter( SvXMLExport& rExport );
147*cdf0e10cSrcweir 	virtual ~SvxXMLBitmapEntryExporter();
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 	virtual void exportEntry( const OUString& rStrName, const Any& rValue );
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir private:
152*cdf0e10cSrcweir 	XMLImageStyle maImageStyle;
153*cdf0e10cSrcweir };
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir // #110680#
158*cdf0e10cSrcweir SvxXMLXTableExportComponent::SvxXMLXTableExportComponent(
159*cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
160*cdf0e10cSrcweir 	const OUString& rFileName,
161*cdf0e10cSrcweir 	const uno::Reference<xml::sax::XDocumentHandler> & rHandler,
162*cdf0e10cSrcweir 	const uno::Reference<container::XNameContainer >& xTable,
163*cdf0e10cSrcweir 	uno::Reference<document::XGraphicObjectResolver >& xGrfResolver )
164*cdf0e10cSrcweir :	SvXMLExport( xServiceFactory, rFileName, rHandler, NULL, MAP_100TH_MM),
165*cdf0e10cSrcweir 	mxTable( xTable )
166*cdf0e10cSrcweir {
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	_GetNamespaceMap().Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
169*cdf0e10cSrcweir 	_GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
170*cdf0e10cSrcweir 	_GetNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
171*cdf0e10cSrcweir 	_GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
172*cdf0e10cSrcweir 	_GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG),  XML_NAMESPACE_SVG );
173*cdf0e10cSrcweir 	SetGraphicResolver( xGrfResolver );
174*cdf0e10cSrcweir 	setExportFlags( 0 );
175*cdf0e10cSrcweir }
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir SvxXMLXTableExportComponent::~SvxXMLXTableExportComponent()
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir sal_Bool SvxXMLXTableExportComponent::save( const OUString& rURL, const uno::Reference<container::XNameContainer >& xTable ) throw()
182*cdf0e10cSrcweir {
183*cdf0e10cSrcweir     uno::Reference < embed::XStorage > xStorage;
184*cdf0e10cSrcweir 	SfxMedium* pMedium = NULL;
185*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 	uno::Reference< XGraphicObjectResolver >	xGrfResolver;
188*cdf0e10cSrcweir 	SvXMLGraphicHelper*	pGraphicHelper = 0;
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 	try
191*cdf0e10cSrcweir 	{
192*cdf0e10cSrcweir 		do
193*cdf0e10cSrcweir 		{
194*cdf0e10cSrcweir             uno::Reference < io::XOutputStream > xOut;
195*cdf0e10cSrcweir             uno::Reference < io::XStream > xStream;
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 			sal_Bool bNeedStorage = xTable->getElementType() == ::getCppuType((const OUString*)0);
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 			uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
200*cdf0e10cSrcweir 			if( !xServiceFactory.is() )
201*cdf0e10cSrcweir 			{
202*cdf0e10cSrcweir 				DBG_ERROR( "got no service manager" );
203*cdf0e10cSrcweir 				return sal_False;
204*cdf0e10cSrcweir 			}
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir 			uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
207*cdf0e10cSrcweir 			if( !xWriter.is() )
208*cdf0e10cSrcweir 			{
209*cdf0e10cSrcweir 				DBG_ERROR( "com.sun.star.xml.sax.Writer service missing" );
210*cdf0e10cSrcweir 				return sal_False;
211*cdf0e10cSrcweir 			}
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 			uno::Reference<xml::sax::XDocumentHandler>	xHandler( xWriter, uno::UNO_QUERY );
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 			if( bNeedStorage )
216*cdf0e10cSrcweir 			{
217*cdf0e10cSrcweir                 xStorage =
218*cdf0e10cSrcweir                   ::comphelper::OStorageHelper::GetStorageFromURL( rURL, embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE );
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir                 if( !xStorage.is() )
221*cdf0e10cSrcweir 				{
222*cdf0e10cSrcweir 					DBG_ERROR( "no storage!" );
223*cdf0e10cSrcweir 					break;
224*cdf0e10cSrcweir 				}
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 				OUString sMetaName( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) );
227*cdf0e10cSrcweir                 xStream = xStorage->openStreamElement( sMetaName, embed::ElementModes::WRITE );
228*cdf0e10cSrcweir                 pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, GRAPHICHELPER_MODE_WRITE );
229*cdf0e10cSrcweir 				xGrfResolver = pGraphicHelper;
230*cdf0e10cSrcweir                 xOut = xStream->getOutputStream();
231*cdf0e10cSrcweir 			}
232*cdf0e10cSrcweir 			else
233*cdf0e10cSrcweir 			{
234*cdf0e10cSrcweir 				pMedium = new SfxMedium( rURL, STREAM_WRITE | STREAM_TRUNC, sal_True );
235*cdf0e10cSrcweir 				pMedium->IsRemote();
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 				SvStream* pStream = pMedium->GetOutStream();
238*cdf0e10cSrcweir 				if( NULL == pStream )
239*cdf0e10cSrcweir 				{
240*cdf0e10cSrcweir 					DBG_ERROR( "no output stream!" );
241*cdf0e10cSrcweir 					break;
242*cdf0e10cSrcweir 				}
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir 				xOut = new utl::OOutputStreamWrapper( *pStream );
245*cdf0e10cSrcweir 			}
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 			uno::Reference<io::XActiveDataSource> xMetaSrc( xWriter, uno::UNO_QUERY );
248*cdf0e10cSrcweir 			xMetaSrc->setOutputStream( xOut );
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 			const OUString aName;
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 			// #110680#
253*cdf0e10cSrcweir 			// SvxXMLXTableExportComponent aExporter( aName, xHandler, xTable, xGrfResolver );
254*cdf0e10cSrcweir 			SvxXMLXTableExportComponent aExporter( xServiceFactory, aName, xHandler, xTable, xGrfResolver );
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir 			bRet = aExporter.exportTable();
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 		}
259*cdf0e10cSrcweir 		while( 0 );
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 		if( pGraphicHelper )
262*cdf0e10cSrcweir 			SvXMLGraphicHelper::Destroy( pGraphicHelper );
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 		if( xStorage.is() )
265*cdf0e10cSrcweir 		{
266*cdf0e10cSrcweir 			uno::Reference< XTransactedObject > xTrans( xStorage, UNO_QUERY );
267*cdf0e10cSrcweir 			if( xTrans.is() )
268*cdf0e10cSrcweir 				xTrans->commit();
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 			uno::Reference< XComponent > xComp( xStorage, UNO_QUERY );
271*cdf0e10cSrcweir 			if( xComp.is() )
272*cdf0e10cSrcweir 				xStorage->dispose();
273*cdf0e10cSrcweir 		}
274*cdf0e10cSrcweir 	}
275*cdf0e10cSrcweir 	catch( uno::Exception& )
276*cdf0e10cSrcweir 	{
277*cdf0e10cSrcweir 		bRet = sal_False;
278*cdf0e10cSrcweir 	}
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 	if( pMedium )
281*cdf0e10cSrcweir 	{
282*cdf0e10cSrcweir 		pMedium->Commit();
283*cdf0e10cSrcweir 		delete pMedium;
284*cdf0e10cSrcweir 	}
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 	return bRet;
287*cdf0e10cSrcweir }
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir sal_Bool SvxXMLXTableExportComponent::exportTable() throw()
290*cdf0e10cSrcweir {
291*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir 	try
294*cdf0e10cSrcweir 	{
295*cdf0e10cSrcweir 		GetDocHandler()->startDocument();
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir 		// export namespaces
298*cdf0e10cSrcweir 		sal_uInt16 nPos = GetNamespaceMap().GetFirstKey();
299*cdf0e10cSrcweir 		while( USHRT_MAX != nPos )
300*cdf0e10cSrcweir 		{
301*cdf0e10cSrcweir 			GetAttrList().AddAttribute( GetNamespaceMap().GetAttrNameByKey( nPos ), GetNamespaceMap().GetNameByKey( nPos ) );
302*cdf0e10cSrcweir 			nPos = GetNamespaceMap().GetNextKey( nPos );
303*cdf0e10cSrcweir 		}
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 		do
306*cdf0e10cSrcweir 		{
307*cdf0e10cSrcweir 			if( !mxTable.is() )
308*cdf0e10cSrcweir 				break;
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir 			char const* pEleName;
311*cdf0e10cSrcweir 			Type aExportType = mxTable->getElementType();
312*cdf0e10cSrcweir 			SvxXMLTableEntryExporter* pExporter = NULL;
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 			if( aExportType == ::getCppuType((const sal_Int32*)0) )
315*cdf0e10cSrcweir 			{
316*cdf0e10cSrcweir 				pExporter = new SvxXMLColorEntryExporter(*this);
317*cdf0e10cSrcweir 				pEleName = "color-table";
318*cdf0e10cSrcweir 			}
319*cdf0e10cSrcweir 			else if( aExportType == ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
320*cdf0e10cSrcweir 			{
321*cdf0e10cSrcweir 				pExporter = new SvxXMLLineEndEntryExporter(*this);
322*cdf0e10cSrcweir 				pEleName = "marker-table";
323*cdf0e10cSrcweir 			}
324*cdf0e10cSrcweir 			else if( aExportType == ::getCppuType((const drawing::LineDash*)0) )
325*cdf0e10cSrcweir 			{
326*cdf0e10cSrcweir 				pExporter = new SvxXMLDashEntryExporter(*this);
327*cdf0e10cSrcweir 				pEleName = "dash-table";
328*cdf0e10cSrcweir 			}
329*cdf0e10cSrcweir 			else if( aExportType == ::getCppuType((const drawing::Hatch*)0) )
330*cdf0e10cSrcweir 			{
331*cdf0e10cSrcweir 				pExporter = new SvxXMLHatchEntryExporter(*this);
332*cdf0e10cSrcweir 				pEleName = "hatch-table";
333*cdf0e10cSrcweir 			}
334*cdf0e10cSrcweir 			else if( aExportType == ::getCppuType((const awt::Gradient*)0))
335*cdf0e10cSrcweir 			{
336*cdf0e10cSrcweir 				pExporter = new SvxXMLGradientEntryExporter(*this);
337*cdf0e10cSrcweir 				pEleName = "gradient-table";
338*cdf0e10cSrcweir 			}
339*cdf0e10cSrcweir 			else if( aExportType == ::getCppuType((const OUString*)0))
340*cdf0e10cSrcweir 			{
341*cdf0e10cSrcweir 				pExporter = new SvxXMLBitmapEntryExporter(*this);
342*cdf0e10cSrcweir 				pEleName = "bitmap-table";
343*cdf0e10cSrcweir 			}
344*cdf0e10cSrcweir 			else
345*cdf0e10cSrcweir 			{
346*cdf0e10cSrcweir 				DBG_ERROR( "unknown type for export");
347*cdf0e10cSrcweir 				break;
348*cdf0e10cSrcweir 			}
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir 			SvXMLElementExport aElem( *this, XML_NAMESPACE_OOO, pEleName, sal_True, sal_True );
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 			Sequence< OUString > aNames = mxTable->getElementNames();
353*cdf0e10cSrcweir 			const sal_Int32 nCount = aNames.getLength();
354*cdf0e10cSrcweir 			const OUString* pNames = aNames.getConstArray();
355*cdf0e10cSrcweir 			Any aAny;
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir 			sal_Int32 nIndex;
358*cdf0e10cSrcweir 			for( nIndex = 0; nIndex < nCount; nIndex++, pNames++ )
359*cdf0e10cSrcweir 			{
360*cdf0e10cSrcweir 				aAny = mxTable->getByName( *pNames );
361*cdf0e10cSrcweir 				pExporter->exportEntry( *pNames, aAny );
362*cdf0e10cSrcweir 			}
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir 			bRet = sal_True;
365*cdf0e10cSrcweir 		}
366*cdf0e10cSrcweir 		while(0);
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 		GetDocHandler()->endDocument();
369*cdf0e10cSrcweir 	}
370*cdf0e10cSrcweir 	catch( Exception e )
371*cdf0e10cSrcweir 	{
372*cdf0e10cSrcweir 		bRet = sal_False;
373*cdf0e10cSrcweir 	}
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 	return bRet;
376*cdf0e10cSrcweir }
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir // methods without content:
379*cdf0e10cSrcweir void SvxXMLXTableExportComponent::_ExportAutoStyles() {}
380*cdf0e10cSrcweir void SvxXMLXTableExportComponent::_ExportMasterStyles() {}
381*cdf0e10cSrcweir void SvxXMLXTableExportComponent::_ExportContent() {}
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir SvxXMLTableEntryExporter::~SvxXMLTableEntryExporter()
386*cdf0e10cSrcweir {
387*cdf0e10cSrcweir }
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir SvxXMLColorEntryExporter::SvxXMLColorEntryExporter( SvXMLExport& rExport )
392*cdf0e10cSrcweir : SvxXMLTableEntryExporter( rExport )
393*cdf0e10cSrcweir {
394*cdf0e10cSrcweir }
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir SvxXMLColorEntryExporter::~SvxXMLColorEntryExporter()
397*cdf0e10cSrcweir {
398*cdf0e10cSrcweir }
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir void SvxXMLColorEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
401*cdf0e10cSrcweir {
402*cdf0e10cSrcweir 	mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, rStrName );
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir 	sal_Int32 nColor = 0;
405*cdf0e10cSrcweir 	rValue >>= nColor;
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 	OUStringBuffer aOut;
408*cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertColor( aOut, nColor );
409*cdf0e10cSrcweir 	mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, aOut.makeStringAndClear() );
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir 	SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_COLOR, sal_True, sal_True );
412*cdf0e10cSrcweir }
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir SvxXMLLineEndEntryExporter::SvxXMLLineEndEntryExporter( SvXMLExport& rExport )
417*cdf0e10cSrcweir : SvxXMLTableEntryExporter( rExport ), maMarkerStyle( rExport )
418*cdf0e10cSrcweir {
419*cdf0e10cSrcweir }
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir SvxXMLLineEndEntryExporter::~SvxXMLLineEndEntryExporter()
422*cdf0e10cSrcweir {
423*cdf0e10cSrcweir }
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir void SvxXMLLineEndEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
426*cdf0e10cSrcweir {
427*cdf0e10cSrcweir 	maMarkerStyle.exportXML( rStrName, rValue );
428*cdf0e10cSrcweir }
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir SvxXMLDashEntryExporter::SvxXMLDashEntryExporter( SvXMLExport& rExport )
433*cdf0e10cSrcweir : SvxXMLTableEntryExporter( rExport ), maDashStyle( rExport )
434*cdf0e10cSrcweir {
435*cdf0e10cSrcweir }
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir SvxXMLDashEntryExporter::~SvxXMLDashEntryExporter()
438*cdf0e10cSrcweir {
439*cdf0e10cSrcweir }
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir void SvxXMLDashEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
442*cdf0e10cSrcweir {
443*cdf0e10cSrcweir 	maDashStyle.exportXML( rStrName, rValue );
444*cdf0e10cSrcweir }
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
447*cdf0e10cSrcweir 
448*cdf0e10cSrcweir SvxXMLHatchEntryExporter::SvxXMLHatchEntryExporter( SvXMLExport& rExport )
449*cdf0e10cSrcweir : SvxXMLTableEntryExporter( rExport ), maHatchStyle( rExport )
450*cdf0e10cSrcweir {
451*cdf0e10cSrcweir }
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir SvxXMLHatchEntryExporter::~SvxXMLHatchEntryExporter()
454*cdf0e10cSrcweir {
455*cdf0e10cSrcweir }
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir void SvxXMLHatchEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
458*cdf0e10cSrcweir {
459*cdf0e10cSrcweir 	maHatchStyle.exportXML( rStrName, rValue );
460*cdf0e10cSrcweir }
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir SvxXMLGradientEntryExporter::SvxXMLGradientEntryExporter( SvXMLExport& rExport )
465*cdf0e10cSrcweir : SvxXMLTableEntryExporter( rExport ), maGradientStyle( rExport )
466*cdf0e10cSrcweir {
467*cdf0e10cSrcweir }
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir SvxXMLGradientEntryExporter::~SvxXMLGradientEntryExporter()
470*cdf0e10cSrcweir {
471*cdf0e10cSrcweir }
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir void SvxXMLGradientEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
474*cdf0e10cSrcweir {
475*cdf0e10cSrcweir 	maGradientStyle.exportXML( rStrName, rValue );
476*cdf0e10cSrcweir }
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir SvxXMLBitmapEntryExporter::SvxXMLBitmapEntryExporter( SvXMLExport& rExport )
481*cdf0e10cSrcweir : SvxXMLTableEntryExporter( rExport )
482*cdf0e10cSrcweir {
483*cdf0e10cSrcweir }
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir SvxXMLBitmapEntryExporter::~SvxXMLBitmapEntryExporter()
486*cdf0e10cSrcweir {
487*cdf0e10cSrcweir }
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir void SvxXMLBitmapEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
490*cdf0e10cSrcweir {
491*cdf0e10cSrcweir 	maImageStyle.exportXML( rStrName, rValue, mrExport );
492*cdf0e10cSrcweir }
493