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 
24 #ifndef XMLSCRIPT_XMLBAS_EXPORT_HXX
25 #define XMLSCRIPT_XMLBAS_EXPORT_HXX
26 
27 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
28 #include <com/sun/star/document/XExporter.hpp>
29 #include <com/sun/star/document/XFilter.hpp>
30 #include <com/sun/star/frame/XModel.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XInitialization.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <cppuhelper/implbase4.hxx>
35 #include <osl/mutex.hxx>
36 
37 
38 //.........................................................................
39 namespace xmlscript
40 {
41 //.........................................................................
42 
43     // =============================================================================
44     // class XMLBasicExporterBase
45     // =============================================================================
46 
47     typedef ::cppu::WeakImplHelper4<
48         ::com::sun::star::lang::XServiceInfo,
49         ::com::sun::star::lang::XInitialization,
50         ::com::sun::star::document::XExporter,
51         ::com::sun::star::document::XFilter > XMLBasicExporterBase_BASE;
52 
53     class XMLBasicExporterBase : public XMLBasicExporterBase_BASE
54     {
55     private:
56         ::osl::Mutex                                                                        m_aMutex;
57         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >        m_xContext;
58         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >    m_xHandler;
59         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >                 m_xModel;
60         sal_Bool                                                                            m_bOasis;
61 
62     public:
63         XMLBasicExporterBase(
64             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, sal_Bool bOasis );
65         virtual ~XMLBasicExporterBase();
66 
67         // XServiceInfo
68         virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
69             throw (::com::sun::star::uno::RuntimeException);
70 
71         // XInitialization
72         virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
73             throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
74 
75         // XExporter
76         virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxDoc )
77             throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
78 
79         // XFilter
80         virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
81             throw (::com::sun::star::uno::RuntimeException);
82         virtual void SAL_CALL cancel()
83             throw (::com::sun::star::uno::RuntimeException);
84     };
85 
86 
87     // =============================================================================
88     // class XMLBasicExporter
89     // =============================================================================
90 
91     class XMLBasicExporter : public XMLBasicExporterBase
92     {
93     public:
94         XMLBasicExporter(
95             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
96         virtual ~XMLBasicExporter();
97 
98         // XServiceInfo
99         virtual ::rtl::OUString SAL_CALL getImplementationName(  )
100             throw (::com::sun::star::uno::RuntimeException);
101         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
102             throw (::com::sun::star::uno::RuntimeException);
103     };
104 
105 
106     // =============================================================================
107     // class XMLOasisBasicExporter
108     // =============================================================================
109 
110     class XMLOasisBasicExporter : public XMLBasicExporterBase
111     {
112     public:
113         XMLOasisBasicExporter(
114             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
115         virtual ~XMLOasisBasicExporter();
116 
117         // XServiceInfo
118         virtual ::rtl::OUString SAL_CALL getImplementationName(  )
119             throw (::com::sun::star::uno::RuntimeException);
120         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
121             throw (::com::sun::star::uno::RuntimeException);
122     };
123 
124 //.........................................................................
125 }	// namespace xmlscript
126 //.........................................................................
127 
128 #endif // XMLSCRIPT_XMLBAS_EXPORT_HXX
129