Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 : */
7 : /* "This product is not manufactured, approved, or supported by
8 : * Corel Corporation or Corel Corporation Limited."
9 : */
10 : #ifndef _WORDPERFECTIMPORTFILTER_HXX
11 : #define _WORDPERFECTIMPORTFILTER_HXX
12 :
13 : #include <com/sun/star/document/XFilter.hpp>
14 : #include <com/sun/star/document/XImporter.hpp>
15 : #include <com/sun/star/document/XExtendedFilterDetection.hpp>
16 : #include <com/sun/star/beans/XPropertyAccess.hpp>
17 : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
18 : #include <com/sun/star/lang/XInitialization.hpp>
19 : #include <com/sun/star/lang/XServiceInfo.hpp>
20 : #include <com/sun/star/uno/XComponentContext.hpp>
21 : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
22 : #include <com/sun/star/io/XInputStream.hpp>
23 : #include <cppuhelper/implbase3.hxx>
24 : #include <cppuhelper/implbase5.hxx>
25 :
26 : /* This component will be instantiated for both import or export. Whether it calls
27 : * setSourceDocument or setTargetDocument determines which Impl function the filter
28 : * member calls */
29 : class WordPerfectImportFilter : public cppu::WeakImplHelper5
30 : <
31 : com::sun::star::document::XFilter,
32 : com::sun::star::document::XImporter,
33 : com::sun::star::document::XExtendedFilterDetection,
34 : com::sun::star::lang::XInitialization,
35 : com::sun::star::lang::XServiceInfo
36 : >
37 : {
38 : protected:
39 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
40 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
41 : OUString msFilterName;
42 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
43 :
44 : bool SAL_CALL importImpl(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
45 : throw (css::uno::RuntimeException, std::exception);
46 :
47 : public:
48 2 : WordPerfectImportFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext)
49 2 : : mxContext(rxContext) {}
50 4 : virtual ~WordPerfectImportFilter() {}
51 :
52 : // XFilter
53 : virtual sal_Bool SAL_CALL filter(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
54 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
55 : virtual void SAL_CALL cancel()
56 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 :
58 : // XImporter
59 : virtual void SAL_CALL setTargetDocument(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &xDoc)
60 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
61 :
62 : //XExtendedFilterDetection
63 : virtual OUString SAL_CALL detect(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &Descriptor)
64 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
65 :
66 : // XInitialization
67 : virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &aArguments)
68 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 :
70 : // XServiceInfo
71 : virtual OUString SAL_CALL getImplementationName()
72 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 : virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName)
74 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
76 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
77 :
78 : };
79 :
80 : OUString WordPerfectImportFilter_getImplementationName()
81 : throw (::com::sun::star::uno::RuntimeException);
82 :
83 : bool SAL_CALL WordPerfectImportFilter_supportsService(const OUString &ServiceName)
84 : throw (::com::sun::star::uno::RuntimeException);
85 :
86 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL WordPerfectImportFilter_getSupportedServiceNames()
87 : throw (::com::sun::star::uno::RuntimeException);
88 :
89 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
90 : SAL_CALL WordPerfectImportFilter_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rContext)
91 : throw (::com::sun::star::uno::Exception);
92 :
93 :
94 : class WordPerfectImportFilterDialog : public cppu::WeakImplHelper3 <
95 : com::sun::star::ui::dialogs::XExecutableDialog,
96 : com::sun::star::lang::XServiceInfo,
97 : com::sun::star::beans::XPropertyAccess
98 : >
99 : {
100 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
101 : OUString msPassword;
102 : ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > mxInputStream;
103 :
104 : virtual ~WordPerfectImportFilterDialog();
105 :
106 : // XExecutableDialog
107 : virtual void SAL_CALL setTitle(const OUString &aTitle)
108 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 : virtual sal_Int16 SAL_CALL execute()
110 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 :
112 : // XServiceInfo
113 : virtual OUString SAL_CALL getImplementationName()
114 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName)
116 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
118 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
119 :
120 : // XPropertyAccess
121 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
122 : SAL_CALL getPropertyValues() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 : virtual void SAL_CALL setPropertyValues(const ::com::sun::star::uno::Sequence<
124 : ::com::sun::star::beans::PropertyValue >& aProps)
125 : throw (::com::sun::star::beans::UnknownPropertyException,
126 : ::com::sun::star::beans::PropertyVetoException,
127 : ::com::sun::star::lang::IllegalArgumentException,
128 : ::com::sun::star::lang::WrappedTargetException,
129 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 :
131 : public:
132 : WordPerfectImportFilterDialog(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rContext);
133 :
134 : };
135 :
136 : OUString WordPerfectImportFilterDialog_getImplementationName()
137 : throw (::com::sun::star::uno::RuntimeException);
138 :
139 : bool SAL_CALL WordPerfectImportFilterDialog_supportsService(const OUString &ServiceName)
140 : throw (::com::sun::star::uno::RuntimeException);
141 :
142 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL WordPerfectImportFilterDialog_getSupportedServiceNames()
143 : throw (::com::sun::star::uno::RuntimeException);
144 :
145 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
146 : SAL_CALL WordPerfectImportFilterDialog_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rContext)
147 : throw (::com::sun::star::uno::Exception);
148 :
149 : #endif
150 :
151 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|