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 : :
30 : : /** this file implements an export of a selected EditEngine content into
31 : : a xml stream. See editeng/source/inc/xmledit.hxx for interface */
32 : : #include <com/sun/star/ucb/XAnyCompareFactory.hpp>
33 : : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
34 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 : : #include <com/sun/star/io/XActiveDataSource.hpp>
36 : : #include <svl/itemprop.hxx>
37 : : #include <svl/brdcst.hxx>
38 : : #include <com/sun/star/uno/Sequence.hxx>
39 : : #include <sot/storage.hxx>
40 : : #include <rtl/ustrbuf.hxx>
41 : : #include <xmloff/xmluconv.hxx>
42 : : #include <xmloff/xmlnmspe.hxx>
43 : : #include <xmloff/nmspmap.hxx>
44 : : #include <xmloff/xmlmetae.hxx>
45 : : #include <cppuhelper/implbase4.hxx>
46 : : #include <comphelper/processfactory.hxx>
47 : : #include <unotools/streamwrap.hxx>
48 : : #include <xmloff/xmlexp.hxx>
49 : : #include <editeng/unoedsrc.hxx>
50 : : #include <editeng/unofored.hxx>
51 : : #include <editeng/unotext.hxx>
52 : : #include <editeng/unoprnms.hxx>
53 : : #include <editeng/unofield.hxx>
54 : : #include <editeng/editeng.hxx>
55 : : #include "editsource.hxx"
56 : : #include <editeng/unonrule.hxx>
57 : : #include <editeng/unoipset.hxx>
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 cppu;
68 : :
69 : : ///////////////////////////////////////////////////////////////////////
70 : :
71 : : class SvxEditEngineSourceImpl;
72 : :
73 : : ///////////////////////////////////////////////////////////////////////
74 : :
75 : : class SvxEditEngineSourceImpl
76 : : {
77 : : private:
78 : : oslInterlockedCount maRefCount;
79 : :
80 : : EditEngine* mpEditEngine;
81 : : SvxTextForwarder* mpTextForwarder;
82 : :
83 : : ~SvxEditEngineSourceImpl();
84 : :
85 : : public:
86 : : SvxEditEngineSourceImpl( EditEngine* pEditEngine );
87 : :
88 : : void SAL_CALL acquire();
89 : : void SAL_CALL release();
90 : :
91 : : SvxTextForwarder* GetTextForwarder();
92 : : };
93 : :
94 : : ///////////////////////////////////////////////////////////////////////
95 : :
96 : :
97 : : //------------------------------------------------------------------------
98 : :
99 : 0 : SvxEditEngineSourceImpl::SvxEditEngineSourceImpl( EditEngine* pEditEngine )
100 : : : maRefCount(0),
101 : : mpEditEngine( pEditEngine ),
102 : 0 : mpTextForwarder(NULL)
103 : : {
104 : 0 : }
105 : :
106 : : //------------------------------------------------------------------------
107 : :
108 : 0 : SvxEditEngineSourceImpl::~SvxEditEngineSourceImpl()
109 : : {
110 [ # # ]: 0 : delete mpTextForwarder;
111 : 0 : }
112 : :
113 : : //------------------------------------------------------------------------
114 : :
115 : 0 : void SAL_CALL SvxEditEngineSourceImpl::acquire()
116 : : {
117 : 0 : osl_incrementInterlockedCount( &maRefCount );
118 : 0 : }
119 : :
120 : : //------------------------------------------------------------------------
121 : :
122 : 0 : void SAL_CALL SvxEditEngineSourceImpl::release()
123 : : {
124 [ # # ]: 0 : if( ! osl_decrementInterlockedCount( &maRefCount ) )
125 [ # # ]: 0 : delete this;
126 : 0 : }
127 : :
128 : : //------------------------------------------------------------------------
129 : :
130 : 0 : SvxTextForwarder* SvxEditEngineSourceImpl::GetTextForwarder()
131 : : {
132 [ # # ]: 0 : if (!mpTextForwarder)
133 [ # # ]: 0 : mpTextForwarder = new SvxEditEngineForwarder( *mpEditEngine );
134 : :
135 : 0 : return mpTextForwarder;
136 : : }
137 : :
138 : : // --------------------------------------------------------------------
139 : : // SvxTextEditSource
140 : : // --------------------------------------------------------------------
141 : :
142 : 0 : SvxEditEngineSource::SvxEditEngineSource( EditEngine* pEditEngine )
143 : : {
144 [ # # ]: 0 : mpImpl = new SvxEditEngineSourceImpl( pEditEngine );
145 [ # # ]: 0 : mpImpl->acquire();
146 : 0 : }
147 : :
148 : : // --------------------------------------------------------------------
149 : :
150 : 0 : SvxEditEngineSource::SvxEditEngineSource( SvxEditEngineSourceImpl* pImpl )
151 : : {
152 : 0 : mpImpl = pImpl;
153 [ # # ]: 0 : mpImpl->acquire();
154 : 0 : }
155 : :
156 : : //------------------------------------------------------------------------
157 : :
158 : 0 : SvxEditEngineSource::~SvxEditEngineSource()
159 : : {
160 [ # # ]: 0 : mpImpl->release();
161 [ # # ]: 0 : }
162 : :
163 : : //------------------------------------------------------------------------
164 : :
165 : 0 : SvxEditSource* SvxEditEngineSource::Clone() const
166 : : {
167 [ # # ]: 0 : return new SvxEditEngineSource( mpImpl );
168 : : }
169 : :
170 : : //------------------------------------------------------------------------
171 : :
172 : 0 : SvxTextForwarder* SvxEditEngineSource::GetTextForwarder()
173 : : {
174 : 0 : return mpImpl->GetTextForwarder();
175 : : }
176 : :
177 : : //------------------------------------------------------------------------
178 : :
179 : 0 : void SvxEditEngineSource::UpdateData()
180 : : {
181 : 0 : }
182 : :
183 : : class SvxSimpleUnoModel : public cppu::WeakAggImplHelper4<
184 : : ::com::sun::star::frame::XModel,
185 : : ::com::sun::star::ucb::XAnyCompareFactory,
186 : : ::com::sun::star::style::XStyleFamiliesSupplier,
187 : : ::com::sun::star::lang::XMultiServiceFactory >
188 : : {
189 : : public:
190 : : SvxSimpleUnoModel();
191 : : virtual ~SvxSimpleUnoModel();
192 : :
193 : :
194 : : // XMultiServiceFactory
195 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
196 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
197 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
198 : :
199 : : // XStyleFamiliesSupplier
200 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getStyleFamilies( ) throw(::com::sun::star::uno::RuntimeException);
201 : :
202 : : // XAnyCompareFactory
203 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
204 : :
205 : : // XModel
206 : : virtual sal_Bool SAL_CALL attachResource( const ::rtl::OUString& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw (::com::sun::star::uno::RuntimeException);
207 : : virtual ::rtl::OUString SAL_CALL getURL( ) throw (::com::sun::star::uno::RuntimeException);
208 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getArgs( ) throw (::com::sun::star::uno::RuntimeException);
209 : : virtual void SAL_CALL connectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) throw (::com::sun::star::uno::RuntimeException);
210 : : virtual void SAL_CALL disconnectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) throw (::com::sun::star::uno::RuntimeException);
211 : : virtual void SAL_CALL lockControllers( ) throw (::com::sun::star::uno::RuntimeException);
212 : : virtual void SAL_CALL unlockControllers( ) throw (::com::sun::star::uno::RuntimeException);
213 : : virtual sal_Bool SAL_CALL hasControllersLocked( ) throw (::com::sun::star::uno::RuntimeException);
214 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > SAL_CALL getCurrentController( ) throw (::com::sun::star::uno::RuntimeException);
215 : : virtual void SAL_CALL setCurrentController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
216 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getCurrentSelection( ) throw (::com::sun::star::uno::RuntimeException);
217 : :
218 : : // XComponent
219 : : virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
220 : : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
221 : : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
222 : :
223 : : };
224 : :
225 : 0 : SvxSimpleUnoModel::SvxSimpleUnoModel()
226 : : {
227 : 0 : }
228 : :
229 : 0 : SvxSimpleUnoModel::~SvxSimpleUnoModel()
230 : : {
231 [ # # ]: 0 : }
232 : :
233 : : // XMultiServiceFactory ( SvxFmMSFactory )
234 : 0 : uno::Reference< uno::XInterface > SAL_CALL SvxSimpleUnoModel::createInstance( const OUString& aServiceSpecifier )
235 : : throw(uno::Exception, uno::RuntimeException)
236 : : {
237 [ # # ]: 0 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) )
238 : : {
239 : : return uno::Reference< uno::XInterface >(
240 [ # # ]: 0 : SvxCreateNumRule(), uno::UNO_QUERY );
241 : : }
242 [ # # ]: 0 : if ( (0 == aServiceSpecifier.reverseCompareToAsciiL(
[ # # # # ]
243 : 0 : RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.textfield.DateTime")))
244 : : || (0 == aServiceSpecifier.reverseCompareToAsciiL(
245 : 0 : RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime")))
246 : : )
247 : : {
248 : 0 : return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::DATE );
249 : : }
250 : :
251 : 0 : return SvxUnoTextCreateTextField( aServiceSpecifier );
252 : :
253 : : }
254 : :
255 : 0 : uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxSimpleUnoModel::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
256 : : {
257 : 0 : return createInstance( ServiceSpecifier );
258 : : }
259 : :
260 : 0 : Sequence< ::rtl::OUString > SAL_CALL SvxSimpleUnoModel::getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
261 : : {
262 : 0 : Sequence< OUString > aSeq;
263 : 0 : return aSeq;
264 : : }
265 : :
266 : : // XAnyCompareFactory
267 : 0 : uno::Reference< com::sun::star::ucb::XAnyCompare > SAL_CALL SvxSimpleUnoModel::createAnyCompareByName( const OUString& PropertyName )
268 : : throw(uno::RuntimeException)
269 : : {
270 : : (void)PropertyName;
271 : 0 : return SvxCreateNumRuleCompare();
272 : : }
273 : :
274 : : // XStyleFamiliesSupplier
275 : 0 : uno::Reference< container::XNameAccess > SAL_CALL SvxSimpleUnoModel::getStyleFamilies( )
276 : : throw(uno::RuntimeException)
277 : : {
278 : 0 : uno::Reference< container::XNameAccess > xStyles;
279 : 0 : return xStyles;
280 : : }
281 : :
282 : : // XModel
283 : 0 : sal_Bool SAL_CALL SvxSimpleUnoModel::attachResource( const ::rtl::OUString& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw (::com::sun::star::uno::RuntimeException)
284 : : {
285 : : (void)aURL;
286 : : (void)aArgs;
287 : 0 : return sal_False;
288 : : }
289 : :
290 : 0 : ::rtl::OUString SAL_CALL SvxSimpleUnoModel::getURL( ) throw (::com::sun::star::uno::RuntimeException)
291 : : {
292 : 0 : OUString aStr;
293 : 0 : return aStr;
294 : : }
295 : :
296 : 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL SvxSimpleUnoModel::getArgs( ) throw (::com::sun::star::uno::RuntimeException)
297 : : {
298 : 0 : Sequence< beans::PropertyValue > aSeq;
299 : 0 : return aSeq;
300 : : }
301 : :
302 : 0 : void SAL_CALL SvxSimpleUnoModel::connectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& ) throw (::com::sun::star::uno::RuntimeException)
303 : : {
304 : 0 : }
305 : :
306 : 0 : void SAL_CALL SvxSimpleUnoModel::disconnectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& ) throw (::com::sun::star::uno::RuntimeException)
307 : : {
308 : 0 : }
309 : :
310 : 0 : void SAL_CALL SvxSimpleUnoModel::lockControllers( ) throw (::com::sun::star::uno::RuntimeException)
311 : : {
312 : 0 : }
313 : :
314 : 0 : void SAL_CALL SvxSimpleUnoModel::unlockControllers( ) throw (::com::sun::star::uno::RuntimeException)
315 : : {
316 : 0 : }
317 : :
318 : 0 : sal_Bool SAL_CALL SvxSimpleUnoModel::hasControllersLocked( ) throw (::com::sun::star::uno::RuntimeException)
319 : : {
320 : 0 : return sal_True;
321 : : }
322 : :
323 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > SAL_CALL SvxSimpleUnoModel::getCurrentController( ) throw (::com::sun::star::uno::RuntimeException)
324 : : {
325 : 0 : uno::Reference< frame::XController > xRet;
326 : 0 : return xRet;
327 : : }
328 : :
329 : 0 : void SAL_CALL SvxSimpleUnoModel::setCurrentController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException)
330 : : {
331 : 0 : }
332 : :
333 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxSimpleUnoModel::getCurrentSelection( ) throw (::com::sun::star::uno::RuntimeException)
334 : : {
335 : 0 : uno::Reference< XInterface > xRet;
336 : 0 : return xRet;
337 : : }
338 : :
339 : :
340 : : // XComponent
341 : 0 : void SAL_CALL SvxSimpleUnoModel::dispose( ) throw (::com::sun::star::uno::RuntimeException)
342 : : {
343 : 0 : }
344 : :
345 : 0 : void SAL_CALL SvxSimpleUnoModel::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& ) throw (::com::sun::star::uno::RuntimeException)
346 : : {
347 : 0 : }
348 : :
349 : 0 : void SAL_CALL SvxSimpleUnoModel::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& ) throw (::com::sun::star::uno::RuntimeException)
350 : : {
351 : 0 : }
352 : :
353 : : ///////////////////////////////////////////////////////////////////////
354 : :
355 : : class SvxXMLTextExportComponent : public SvXMLExport
356 : : {
357 : : public:
358 : : SvxXMLTextExportComponent(
359 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
360 : : EditEngine* pEditEngine,
361 : : const ESelection& rSel,
362 : : const ::rtl::OUString& rFileName,
363 : : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > & xHandler );
364 : :
365 : : ~SvxXMLTextExportComponent();
366 : :
367 : : // methods without content:
368 : : virtual void _ExportAutoStyles();
369 : : virtual void _ExportMasterStyles();
370 : : virtual void _ExportContent();
371 : :
372 : : private:
373 : : com::sun::star::uno::Reference< com::sun::star::text::XText > mxText;
374 : : ESelection maSelection;
375 : : };
376 : :
377 : : ///////////////////////////////////////////////////////////////////////
378 : :
379 : 0 : SvxXMLTextExportComponent::SvxXMLTextExportComponent(
380 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
381 : : EditEngine* pEditEngine,
382 : : const ESelection& rSel,
383 : : const ::rtl::OUString& rFileName,
384 : : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > & xHandler)
385 [ # # ][ # # ]: 0 : : SvXMLExport( xServiceFactory, rFileName, xHandler, ((frame::XModel*)new SvxSimpleUnoModel()), MAP_CM ),
386 [ # # ]: 0 : maSelection( rSel )
387 : : {
388 [ # # ]: 0 : SvxEditEngineSource aEditSource( pEditEngine );
389 : :
390 : : static const SfxItemPropertyMapEntry SvxXMLTextExportComponentPropertyMap[] =
391 : : {
392 [ # # ][ # # ]: 0 : SVX_UNOEDIT_CHAR_PROPERTIES,
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
393 [ # # ]: 0 : SVX_UNOEDIT_FONT_PROPERTIES,
394 : : // SVX_UNOEDIT_OUTLINER_PROPERTIES,
395 [ # # ]: 0 : {MAP_CHAR_LEN(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace>*)0), 0, 0 },
396 [ # # ]: 0 : {MAP_CHAR_LEN(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE,&::getBooleanCppuType(), 0, 0 },
397 [ # # ]: 0 : {MAP_CHAR_LEN(UNO_NAME_NUMBERING_LEVEL), EE_PARA_OUTLLEVEL, &::getCppuType((const sal_Int16*)0), 0, 0 },
398 [ # # ][ # # ]: 0 : SVX_UNOEDIT_PARA_PROPERTIES,
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
399 : : {0,0,0,0,0,0}
400 [ # # ][ # # ]: 0 : };
[ # # ]
401 [ # # ][ # # ]: 0 : static SvxItemPropertySet aSvxXMLTextExportComponentPropertySet( SvxXMLTextExportComponentPropertyMap, EditEngine::GetGlobalItemPool() );
[ # # ][ # # ]
[ # # ]
402 : :
403 : 0 : SvxUnoText* pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextExportComponentPropertySet, mxText );
404 : 0 : pUnoText->SetSelection( rSel );
405 [ # # ][ # # ]: 0 : mxText = pUnoText;
406 : :
407 [ # # ]: 0 : setExportFlags( EXPORT_AUTOSTYLES|EXPORT_CONTENT );
408 : 0 : }
409 : :
410 : 0 : SvxXMLTextExportComponent::~SvxXMLTextExportComponent()
411 : : {
412 [ # # ]: 0 : }
413 : :
414 : 0 : void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel )
415 : : {
416 : : try
417 : : {
418 : : do
419 : : {
420 : : // create service factory
421 : :
422 [ # # ]: 0 : uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
423 : :
424 [ # # ]: 0 : if( !xServiceFactory.is() )
425 : : {
426 : : OSL_FAIL( "got no service manager" );
427 : : break;
428 : : }
429 : :
430 : : // create document handler
431 : :
432 [ # # ][ # # ]: 0 : uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
[ # # ]
433 : :
434 [ # # ]: 0 : if( !xWriter.is() )
435 : : {
436 : : OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" );
437 : : break;
438 : : }
439 : :
440 [ # # ]: 0 : uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
441 : :
442 : : // create output stream and active data source
443 [ # # ][ # # ]: 0 : uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( rStream ) );
[ # # ]
444 : :
445 : : /* testcode
446 : : const OUString aURL( RTL_CONSTASCII_USTRINGPARAM( "file:///e:/test.xml" ) );
447 : : SfxMedium aMedium( aURL, STREAM_WRITE | STREAM_TRUNC, sal_True );
448 : : aMedium.IsRemote();
449 : : uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( *aMedium.GetOutStream() ) );
450 : : */
451 : :
452 : :
453 [ # # ]: 0 : uno::Reference<io::XActiveDataSource> xMetaSrc( xWriter, uno::UNO_QUERY );
454 [ # # ][ # # ]: 0 : xMetaSrc->setOutputStream( xOut );
455 : :
456 : : // export text
457 : 0 : const OUString aName;
458 : :
459 : : // SvxXMLTextExportComponent aExporter( &rEditEngine, rSel, aName, xHandler );
460 [ # # ]: 0 : SvxXMLTextExportComponent aExporter( xServiceFactory, &rEditEngine, rSel, aName, xHandler );
461 : :
462 [ # # ][ # # ]: 0 : aExporter.exportDoc();
[ # # ][ # # ]
[ # # ]
463 : :
464 : : /* testcode
465 : : aMedium.Commit();
466 : : */
467 : :
468 : : }
469 : : while( 0 );
470 : : }
471 : 0 : catch( const uno::Exception& )
472 : : {
473 : : OSL_FAIL("exception during xml export");
474 : : }
475 : 0 : }
476 : :
477 : : // methods without content:
478 : 0 : void SvxXMLTextExportComponent::_ExportAutoStyles()
479 : : {
480 [ # # ]: 0 : UniReference< XMLTextParagraphExport > xTextExport( GetTextParagraphExport() );
481 : :
482 [ # # ][ # # ]: 0 : xTextExport->collectTextAutoStyles( mxText );
483 [ # # ][ # # ]: 0 : xTextExport->exportTextAutoStyles();
[ # # ]
484 : 0 : }
485 : :
486 : 0 : void SvxXMLTextExportComponent::_ExportContent()
487 : : {
488 [ # # ]: 0 : UniReference< XMLTextParagraphExport > xTextExport( GetTextParagraphExport() );
489 : :
490 [ # # ][ # # ]: 0 : xTextExport->exportText( mxText );
[ # # ]
491 : 0 : }
492 : :
493 : 0 : void SvxXMLTextExportComponent::_ExportMasterStyles() {}
494 : :
495 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|