xref: /trunk/main/xmlscript/source/xmlflat_imexp/xmlbas_export.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 
70         // XInitialization
71         virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
72 
73         // XExporter
74         virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxDoc );
75 
76         // XFilter
77         virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor );
78         virtual void SAL_CALL cancel();
79     };
80 
81 
82     // =============================================================================
83     // class XMLBasicExporter
84     // =============================================================================
85 
86     class XMLBasicExporter : public XMLBasicExporterBase
87     {
88     public:
89         XMLBasicExporter(
90             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
91         virtual ~XMLBasicExporter();
92 
93         // XServiceInfo
94         virtual ::rtl::OUString SAL_CALL getImplementationName(  );
95         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  );
96     };
97 
98 
99     // =============================================================================
100     // class XMLOasisBasicExporter
101     // =============================================================================
102 
103     class XMLOasisBasicExporter : public XMLBasicExporterBase
104     {
105     public:
106         XMLOasisBasicExporter(
107             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
108         virtual ~XMLOasisBasicExporter();
109 
110         // XServiceInfo
111         virtual ::rtl::OUString SAL_CALL getImplementationName(  );
112         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  );
113     };
114 
115 //.........................................................................
116 }   // namespace xmlscript
117 //.........................................................................
118 
119 #endif // XMLSCRIPT_XMLBAS_EXPORT_HXX
120