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 enum FilterType
41 {
42     FILTER_IMPORT,
43     FILTER_EXPORT
44 };
45 
46 /* This component will be instantiated for both import or export. Whether it calls
47  * setSourceDocument or setTargetDocument determines which Impl function the filter
48  * member calls */
49 class FilterDetect : public cppu::WeakImplHelper3 <com::sun::star::document::XExtendedFilterDetection,
50                      com::sun::star::lang::XInitialization,
51                      com::sun::star::lang::XServiceInfo>
52 {
53 protected:
54     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
55     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
56     ::rtl::OUString msFilterName;
57     ::com::sun::star::uno::Sequence< ::rtl::OUString > msUserData;
58     ::rtl::OUString msTemplateName;
59 
60     sal_Bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor );
61 
62     sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor );
63 
64 public:
FilterDetect(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & rxMSF)65     FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
66         : mxMSF( rxMSF ) {}
67 
~FilterDetect()68     virtual ~FilterDetect() {}
69 
70     //XExtendedFilterDetection
71     virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& lDescriptor );
72 
73     // XInitialization
74 
75     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
76 
77     // XServiceInfo
78     virtual ::rtl::OUString SAL_CALL getImplementationName(  );
79 
80     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName );
81 
82     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  );
83 };
84 
85 
86 ::rtl::OUString FilterDetect_getImplementationName();
87 
88 sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceName );
89 
90 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL FilterDetect_getSupportedServiceNames(  );
91 
92 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
93 SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr);
94 
95 #endif
96