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 INCLUDED_FILTER_SOURCE_XMLFILTERDETECT_FILTERDETECT_HXX
21 : #define INCLUDED_FILTER_SOURCE_XMLFILTERDETECT_FILTERDETECT_HXX
22 :
23 : #include <com/sun/star/document/XFilter.hpp>
24 : #include <com/sun/star/document/XExporter.hpp>
25 : #include <com/sun/star/document/XExtendedFilterDetection.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/implbase3.hxx>
30 :
31 : namespace com { namespace sun { namespace star { namespace uno {
32 : class XComponentContext;
33 : } } } }
34 :
35 : enum FilterType
36 : {
37 : FILTER_IMPORT,
38 : FILTER_EXPORT
39 : };
40 :
41 : /* This component will be instantiated for both import or export. Whether it calls
42 : * setSourceDocument or setTargetDocument determines which Impl function the filter
43 : * member calls */
44 :
45 : class FilterDetect : public cppu::WeakImplHelper3 <
46 : css::document::XExtendedFilterDetection,
47 : css::lang::XInitialization,
48 : css::lang::XServiceInfo
49 : >
50 : {
51 :
52 : protected:
53 : css::uno::Reference< css::uno::XComponentContext > mxCtx;
54 : css::uno::Reference< css::lang::XComponent > mxDoc;
55 :
56 : OUString msFilterName;
57 : OUString msTemplateName;
58 :
59 : css::uno::Sequence< OUString > msUserData;
60 :
61 : sal_Bool SAL_CALL exportImpl( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor )
62 : throw (css::uno::RuntimeException);
63 :
64 : sal_Bool SAL_CALL importImpl( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor )
65 : throw (css::uno::RuntimeException);
66 :
67 : public:
68 0 : FilterDetect( const css::uno::Reference< css::uno::XComponentContext > &rxCtx)
69 0 : : mxCtx( rxCtx ) {}
70 :
71 0 : virtual ~FilterDetect() {}
72 :
73 : //XExtendedFilterDetection
74 : virtual OUString SAL_CALL detect( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor )
75 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
76 :
77 : // XInitialization
78 : virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
79 : throw (css::uno::Exception, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 :
81 : // XServiceInfo
82 : virtual OUString SAL_CALL getImplementationName( )
83 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 :
85 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
86 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 :
88 : virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
89 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 : };
91 :
92 : OUString SAL_CALL FilterDetect_getImplementationName();
93 :
94 : css::uno::Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames();
95 :
96 : css::uno::Reference< css::uno::XInterface > SAL_CALL
97 : FilterDetect_createInstance(
98 : css::uno::Reference<
99 : css::uno::XComponentContext > const & context);
100 :
101 : #endif
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|