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 _FILTERDETECT_HXX
25 #define _FILTERDETECT_HXX
26 
27 
28 #include <com/sun/star/document/XFilter.hpp>
29 #include <com/sun/star/document/XExporter.hpp>
30 #include <com/sun/star/document/XExtendedFilterDetection.hpp>
31 #include <com/sun/star/document/XImporter.hpp>
32 #include <com/sun/star/lang/XInitialization.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <cppuhelper/implbase5.hxx>
35 
36 #ifndef _CPPUHELPER_IMPLBASE4_HXX_
37 #include <cppuhelper/implbase3.hxx>
38 #endif
39 
40 
41 
42 enum FilterType
43 {
44 	FILTER_IMPORT,
45 	FILTER_EXPORT
46 };
47 
48 /* This component will be instantiated for both import or export. Whether it calls
49  * setSourceDocument or setTargetDocument determines which Impl function the filter
50  * member calls */
51 
52 class FilterDetect : public cppu::WeakImplHelper3
53 
54 <
55 
56 
57 	com::sun::star::document::XExtendedFilterDetection,
58 
59 	com::sun::star::lang::XInitialization,
60 
61 	com::sun::star::lang::XServiceInfo
62 
63 >
64 
65 {
66 
67 protected:
68 
69   ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
70 
71   ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
72 
73   ::rtl::OUString msFilterName;
74 
75   ::com::sun::star::uno::Sequence< ::rtl::OUString > msUserData;
76 
77    ::rtl::OUString msTemplateName;
78 
79 
80 
81     sal_Bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
82 
83 		throw (::com::sun::star::uno::RuntimeException);
84 
85     sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
86 
87 		throw (::com::sun::star::uno::RuntimeException);
88 
89 
90 
91 
92 
93 public:
94 
FilterDetect(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & rxMSF)95 	FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
96 
97         : mxMSF( rxMSF ) {}
98 
~FilterDetect()99 	virtual ~FilterDetect() {}
100 
101 
102 
103 
104 
105 
106  	//XExtendedFilterDetection
107      virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& lDescriptor )
108 			throw( com::sun::star::uno::RuntimeException );
109 
110 
111 	// XInitialization
112 
113     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
114 
115 		throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
116 
117 
118 
119 	// XServiceInfo
120 
121     virtual ::rtl::OUString SAL_CALL getImplementationName(  )
122 
123 		throw (::com::sun::star::uno::RuntimeException);
124 
125     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
126 
127 		throw (::com::sun::star::uno::RuntimeException);
128 
129     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
130 
131 		throw (::com::sun::star::uno::RuntimeException);
132 
133 };
134 
135 
136 
137 ::rtl::OUString FilterDetect_getImplementationName()
138 
139 	throw ( ::com::sun::star::uno::RuntimeException );
140 
141 
142 
143 sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceName )
144 
145 	throw ( ::com::sun::star::uno::RuntimeException );
146 
147 
148 
149 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL FilterDetect_getSupportedServiceNames(  )
150 
151 	throw ( ::com::sun::star::uno::RuntimeException );
152 
153 
154 
155 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
156 
157 SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
158 
159 	throw ( ::com::sun::star::uno::Exception );
160 
161 
162 
163 #endif
164 
165