xref: /AOO42X/main/sw/source/filter/xml/wrtxml.hxx (revision 45e4e2b01db2c233bee37896baa4c45c84609d67)
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 #ifndef _WRTXML_HXX
23 #define _WRTXML_HXX
24 
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <com/sun/star/beans/PropertyValue.hpp>
28 #include <shellio.hxx>
29 
30 class SwPaM;
31 class SfxMedium;
32 
33 namespace com { namespace sun { namespace star {
34     namespace uno { template<class A> class Reference; }
35     namespace uno { template<class A> class Sequence; }
36     namespace uno { class Any; }
37     namespace lang { class XComponent; }
38     namespace lang { class XMultiServiceFactory; }
39     namespace beans { struct PropertyValue; }
40 } } }
41 
42 
43 class SwXMLWriter : public StgWriter
44 {
45     sal_uInt32 _Write( const com::sun::star::uno::Reference < com::sun::star::task::XStatusIndicator>&, const rtl::OUString& );
46 
47     using StgWriter::Write;
48 
49 protected:
50     virtual sal_uLong WriteStorage();
51     virtual sal_uLong WriteMedium( SfxMedium& aTargetMedium );
52 
53 public:
54 
55     SwXMLWriter( const String& rBaseURL );
56     virtual ~SwXMLWriter();
57 
58     virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 );
59 
60 private:
61 
62     // helper methods to write XML streams
63 
64     // write a single XML stream into the package
65     sal_Bool WriteThroughComponent(
66         // the component we export
67         const ::com::sun::star::uno::Reference<
68             ::com::sun::star::lang::XComponent> & xComponent,
69         const sal_Char* pStreamName, // the stream name
70         // service factory for pServiceName
71         const ::com::sun::star::uno::Reference<
72             ::com::sun::star::lang::XMultiServiceFactory> & rFactory,
73         const sal_Char* pServiceName, // service name of the component
74         // the argument (XInitialization)
75         const ::com::sun::star::uno::Sequence<
76             ::com::sun::star::uno::Any> & rArguments,
77         // output descriptor
78         const ::com::sun::star::uno::Sequence<
79             ::com::sun::star::beans::PropertyValue> & rMediaDesc,
80         sal_Bool bPlainStream ); // neither compress nor encrypt
81 
82     // write a single output stream
83     // (to be called either directly or by WriteThroughComponent(...))
84     sal_Bool WriteThroughComponent(
85         const ::com::sun::star::uno::Reference<
86             ::com::sun::star::io::XOutputStream> & xOutputStream,
87         const ::com::sun::star::uno::Reference<
88             ::com::sun::star::lang::XComponent> & xComponent,
89         const ::com::sun::star::uno::Reference<
90             ::com::sun::star::lang::XMultiServiceFactory> & rFactory,
91         const sal_Char* pServiceName,
92         const ::com::sun::star::uno::Sequence<
93             ::com::sun::star::uno::Any> & rArguments,
94         const ::com::sun::star::uno::Sequence<
95             ::com::sun::star::beans::PropertyValue> & rMediaDesc );
96 };
97 
98 #endif // _WRTXML_HXX
99 
100 /* vim: set noet sw=4 ts=4: */
101