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