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