Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef _XMLFILTERADAPTOR_HXX
21 : : #define _XMLFILTERADAPTOR_HXX
22 : :
23 : :
24 : : #include <com/sun/star/document/XFilter.hpp>
25 : : #include <com/sun/star/document/XExporter.hpp>
26 : : #include <com/sun/star/document/XImporter.hpp>
27 : : #include <com/sun/star/lang/XInitialization.hpp>
28 : : #include <com/sun/star/lang/XServiceInfo.hpp>
29 : : #include <cppuhelper/implbase5.hxx>
30 : :
31 : :
32 : :
33 : : enum FilterType
34 : : {
35 : : FILTER_IMPORT,
36 : : FILTER_EXPORT
37 : : };
38 : :
39 : : /* This component will be instantiated for both import or export. Whether it calls
40 : : * setSourceDocument or setTargetDocument determines which Impl function the filter
41 : : * member calls */
42 : :
43 : : class XmlFilterAdaptor : public cppu::WeakImplHelper5
44 : :
45 : : <
46 : :
47 : : com::sun::star::document::XFilter,
48 : :
49 : : com::sun::star::document::XExporter,
50 : :
51 : : com::sun::star::document::XImporter,
52 : :
53 : : com::sun::star::lang::XInitialization,
54 : :
55 : : com::sun::star::lang::XServiceInfo
56 : :
57 : : >
58 : :
59 : : {
60 : :
61 : : protected:
62 : :
63 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
64 : :
65 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
66 : :
67 : : ::rtl::OUString msFilterName;
68 : :
69 : : ::com::sun::star::uno::Sequence< ::rtl::OUString > msUserData;
70 : :
71 : : ::rtl::OUString msTemplateName;
72 : :
73 : : FilterType meType;
74 : :
75 : : sal_Bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
76 : :
77 : : throw (::com::sun::star::uno::RuntimeException);
78 : :
79 : : sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
80 : :
81 : : throw (::com::sun::star::uno::RuntimeException);
82 : :
83 : :
84 : :
85 : : public:
86 : :
87 : 0 : XmlFilterAdaptor( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
88 : :
89 : 0 : : mxMSF( rxMSF ) {}
90 : :
91 : 0 : virtual ~XmlFilterAdaptor() {}
92 : :
93 : :
94 : :
95 : : // XFilter
96 : :
97 : : virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
98 : :
99 : : throw (::com::sun::star::uno::RuntimeException);
100 : :
101 : : virtual void SAL_CALL cancel( )
102 : :
103 : : throw (::com::sun::star::uno::RuntimeException);
104 : :
105 : :
106 : :
107 : : // XExporter
108 : :
109 : : virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
110 : :
111 : : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
112 : :
113 : :
114 : :
115 : : // XImporter
116 : :
117 : : virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
118 : :
119 : : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
120 : :
121 : :
122 : :
123 : : // XInitialization
124 : :
125 : : virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
126 : :
127 : : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
128 : :
129 : :
130 : :
131 : : // XServiceInfo
132 : :
133 : : virtual ::rtl::OUString SAL_CALL getImplementationName( )
134 : :
135 : : throw (::com::sun::star::uno::RuntimeException);
136 : :
137 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
138 : :
139 : : throw (::com::sun::star::uno::RuntimeException);
140 : :
141 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
142 : :
143 : : throw (::com::sun::star::uno::RuntimeException);
144 : :
145 : : };
146 : :
147 : :
148 : :
149 : : ::rtl::OUString XmlFilterAdaptor_getImplementationName()
150 : :
151 : : throw ( ::com::sun::star::uno::RuntimeException );
152 : :
153 : :
154 : :
155 : : sal_Bool SAL_CALL XmlFilterAdaptor_supportsService( const ::rtl::OUString& ServiceName )
156 : :
157 : : throw ( ::com::sun::star::uno::RuntimeException );
158 : :
159 : :
160 : :
161 : : ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL XmlFilterAdaptor_getSupportedServiceNames( )
162 : :
163 : : throw ( ::com::sun::star::uno::RuntimeException );
164 : :
165 : :
166 : :
167 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
168 : :
169 : : SAL_CALL XmlFilterAdaptor_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
170 : :
171 : : throw ( ::com::sun::star::uno::Exception );
172 : :
173 : :
174 : :
175 : : #endif
176 : :
177 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|