xref: /trunk/main/sw/source/filter/xml/wrtxml.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _WRTXML_HXX
24 #define _WRTXML_HXX
25 
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <com/sun/star/beans/PropertyValue.hpp>
29 #include <shellio.hxx>
30 
31 class SwPaM;
32 class SfxMedium;
33 
34 namespace com { namespace sun { namespace star {
35 	namespace uno { template<class A> class Reference; }
36 	namespace uno { template<class A> class Sequence; }
37 	namespace uno { class Any; }
38 	namespace lang { class XComponent; }
39 	namespace lang { class XMultiServiceFactory; }
40 	namespace beans { struct PropertyValue; }
41 } } }
42 
43 
44 class SwXMLWriter : public StgWriter
45 {
46 	sal_uInt32 _Write( const com::sun::star::uno::Reference < com::sun::star::task::XStatusIndicator>&, const rtl::OUString&  );
47 
48     using StgWriter::Write;
49 
50 protected:
51 	virtual sal_uLong WriteStorage();
52 	virtual sal_uLong WriteMedium( SfxMedium& aTargetMedium );
53 
54 public:
55 
56     SwXMLWriter( const String& rBaseURL );
57 	virtual ~SwXMLWriter();
58 
59 	virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 );
60 
61 private:
62 
63 	// helper methods to write XML streams
64 
65 	/// write a single XML stream into the package
66 	sal_Bool WriteThroughComponent(
67 		/// the component we export
68 		const ::com::sun::star::uno::Reference<
69 			::com::sun::star::lang::XComponent> & xComponent,
70 		const sal_Char* pStreamName,		/// the stream name
71 		/// service factory for pServiceName
72 		const ::com::sun::star::uno::Reference<
73 			::com::sun::star::lang::XMultiServiceFactory> & rFactory,
74 		const sal_Char* pServiceName,		/// service name of the component
75 		/// the argument (XInitialization)
76 		const ::com::sun::star::uno::Sequence<
77 			::com::sun::star::uno::Any> & rArguments,
78 		/// output descriptor
79 		const ::com::sun::star::uno::Sequence<
80 			::com::sun::star::beans::PropertyValue> & rMediaDesc,
81 		sal_Bool bPlainStream );			/// neither compress nor encrypt
82 
83 	/// write a single output stream
84 	/// (to be called either directly or by WriteThroughComponent(...))
85 	sal_Bool WriteThroughComponent(
86 		const ::com::sun::star::uno::Reference<
87 			::com::sun::star::io::XOutputStream> & xOutputStream,
88 		const ::com::sun::star::uno::Reference<
89 			::com::sun::star::lang::XComponent> & xComponent,
90 		const ::com::sun::star::uno::Reference<
91 			::com::sun::star::lang::XMultiServiceFactory> & rFactory,
92 		const sal_Char* pServiceName,
93 		const ::com::sun::star::uno::Sequence<
94 			::com::sun::star::uno::Any> & rArguments,
95 		const ::com::sun::star::uno::Sequence<
96 			::com::sun::star::beans::PropertyValue> & rMediaDesc );
97 };
98 
99 
100 #endif	//  _WRTXML_HXX
101 
102