summaryrefslogtreecommitdiff
path: root/sdext/source/pdfimport/misc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-28 18:26:44 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-28 18:30:24 +0200
commitd3d720b14c0bbfc849f8562d02b471e223e1b0bc (patch)
tree6e85a07fb4f30d1b8284b4286625b81144d3e9ce /sdext/source/pdfimport/misc
parent050d74b558f896ab510a31bcffde2e0346fc5bd8 (diff)
rhbz#826526 Inform user about unsupported PDF encryption formats
...with a crudely reused "Version Incompatibility" message box (TODO: improve), rather than keeping asking for a password. Change-Id: I8239232704a4426af7a14a729840d184a502d2df
Diffstat (limited to 'sdext/source/pdfimport/misc')
-rw-r--r--sdext/source/pdfimport/misc/pwdinteract.cxx41
1 files changed, 40 insertions, 1 deletions
diff --git a/sdext/source/pdfimport/misc/pwdinteract.cxx b/sdext/source/pdfimport/misc/pwdinteract.cxx
index e5fb674047bc..81cdcb832208 100644
--- a/sdext/source/pdfimport/misc/pwdinteract.cxx
+++ b/sdext/source/pdfimport/misc/pwdinteract.cxx
@@ -26,9 +26,14 @@
*
************************************************************************/
+#include "sal/config.h"
+
+#include <cassert>
#include "pdfihelper.hxx"
+#include <boost/noncopyable.hpp>
+#include <com/sun/star/task/ErrorCodeRequest.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/task/XInteractionRequest.hpp>
#include <com/sun/star/task/XInteractionPassword.hpp>
@@ -36,8 +41,9 @@
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/basemutex.hxx>
-
+#include <tools/errcode.hxx>
using namespace com::sun::star;
@@ -125,6 +131,32 @@ void SAL_CALL PDFPasswordRequest::select() throw (uno::RuntimeException)
m_bSelected = true;
}
+class UnsupportedEncryptionFormatRequest:
+ public cppu::WeakImplHelper1< task::XInteractionRequest >,
+ private boost::noncopyable
+{
+public:
+ UnsupportedEncryptionFormatRequest() {}
+
+private:
+ virtual ~UnsupportedEncryptionFormatRequest() {}
+
+ virtual uno::Any SAL_CALL getRequest() throw (uno::RuntimeException) {
+ return uno::makeAny(
+ task::ErrorCodeRequest(
+ OUString(), uno::Reference< uno::XInterface >(),
+ ERRCODE_IO_WRONGVERSION));
+ //TODO: should be something more informative than crudely reused
+ // ERRCODE_IO_WRONGVERSION
+ }
+
+ virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > >
+ SAL_CALL getContinuations() throw (uno::RuntimeException) {
+ return
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > >();
+ }
+};
+
} // namespace
namespace pdfi
@@ -159,6 +191,13 @@ bool getPassword( const uno::Reference< task::XInteractionHandler >& xHandler,
return bSuccess;
}
+void reportUnsupportedEncryptionFormat(
+ uno::Reference< task::XInteractionHandler > const & handler)
+{
+ assert(handler.is());
+ handler->handle(new UnsupportedEncryptionFormatRequest);
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */