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_SDEXT_SOURCE_PDFIMPORT_FILTERDET_HXX
21 : #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_FILTERDET_HXX
22 :
23 : #include <com/sun/star/document/XExtendedFilterDetection.hpp>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <com/sun/star/uno/XComponentContext.hpp>
26 : #include <com/sun/star/io/XStream.hpp>
27 : #include <com/sun/star/task/XInteractionHandler.hpp>
28 :
29 : #include <cppuhelper/compbase1.hxx>
30 : #include <cppuhelper/basemutex.hxx>
31 :
32 :
33 : namespace pdfi
34 : {
35 :
36 : typedef ::cppu::WeakComponentImplHelper1<
37 : com::sun::star::document::XExtendedFilterDetection > PDFDetectorBase;
38 :
39 0 : class PDFDetector : private cppu::BaseMutex,
40 : public PDFDetectorBase
41 : {
42 : private:
43 : com::sun::star::uno::Reference<
44 : com::sun::star::uno::XComponentContext > m_xContext;
45 :
46 : public:
47 : explicit PDFDetector( const ::com::sun::star::uno::Reference<
48 : ::com::sun::star::uno::XComponentContext >& xContext );
49 :
50 : // XExtendedFilterDetection
51 : virtual OUString SAL_CALL detect( com::sun::star::uno::Sequence<
52 : com::sun::star::beans::PropertyValue >& io_rDescriptor )
53 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
54 : };
55 :
56 :
57 : /** Retrieve embedded substream from PDF file
58 :
59 : Useful e.g. for hybrid PDF
60 :
61 : @param rPDFFile
62 : URI of the pdf file
63 :
64 : @param o_rOutMimetype
65 : Output parameter. Receives the mime type of the
66 : substream. Used to distinguish between
67 : draw/impress/writer/calc during import
68 :
69 : @param o_rOutPwd
70 : In/Out parameter. If given password is wrong, user is queried
71 : for another (if bMayUseUI is true)
72 :
73 : @param xContext
74 : Component context
75 :
76 : @param rFilterData
77 : Basically used to pass on XFilter::filter properties (function
78 : uses it to retrieve interaction handler)
79 :
80 : @param bMayUseUI
81 : When false, no dialog is opened to query user for alternate
82 : password
83 : */
84 : com::sun::star::uno::Reference< com::sun::star::io::XStream >
85 : getAdditionalStream( const OUString& rPDFFile,
86 : OUString& o_rOutMimetype,
87 : OUString& io_rOutPwd,
88 : const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext,
89 : const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rFilterData,
90 : bool bMayUseUI );
91 :
92 :
93 : bool checkDocChecksum( const OUString& rInPDFFileURL,
94 : sal_uInt32 nBytes,
95 : const OUString& rChkSum );
96 :
97 : bool getPassword( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler,
98 : OUString& o_rPwd,
99 : bool bFirstTry,
100 : const OUString& i_rDocName
101 : );
102 :
103 : }
104 :
105 : #endif
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|