diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2010-04-28 14:19:13 +0200 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2010-04-28 14:19:13 +0200 |
commit | 3651f6631751fc5acd3e9f709c0346958e3ab79e (patch) | |
tree | 7d24a9bdf0a61b70e5456b1f03ee86b16f8ead17 /sdext | |
parent | ef8fba320644340ec9500ff633f4bcb73dd4dedb (diff) |
pdfextfix03: #i110871# use DocumentPasswordRequest, PasswordRequest is deprecated
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/pdfimport/filterdet.cxx | 4 | ||||
-rw-r--r-- | sdext/source/pdfimport/filterdet.hxx | 4 | ||||
-rwxr-xr-x | sdext/source/pdfimport/inc/pdfihelper.hxx | 4 | ||||
-rw-r--r-- | sdext/source/pdfimport/misc/pwdinteract.cxx | 19 | ||||
-rwxr-xr-x | sdext/source/pdfimport/wrapper/wrapper.cxx | 8 |
5 files changed, 25 insertions, 14 deletions
diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx index 9dac0acf7e1e..e9d58cfdb3b2 100644 --- a/sdext/source/pdfimport/filterdet.cxx +++ b/sdext/source/pdfimport/filterdet.cxx @@ -736,10 +736,12 @@ uno::Reference< io::XStream > getAdditionalStream( const rtl::OUString& break; } + rtl::OUString aDocName( rInPDFFileURL.copy( rInPDFFileURL.lastIndexOf( sal_Unicode('/') )+1 ) ); + bool bEntered = false; do { - bEntered = getPassword( xIntHdl, io_rPwd, ! bEntered ); + bEntered = getPassword( xIntHdl, io_rPwd, ! bEntered, aDocName ); rtl::OString aIsoPwd = rtl::OUStringToOString( io_rPwd, RTL_TEXTENCODING_ISO_8859_1 ); bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() ); diff --git a/sdext/source/pdfimport/filterdet.hxx b/sdext/source/pdfimport/filterdet.hxx index 5a35320c91c5..4be260eb4254 100644 --- a/sdext/source/pdfimport/filterdet.hxx +++ b/sdext/source/pdfimport/filterdet.hxx @@ -104,7 +104,9 @@ bool checkDocChecksum( const rtl::OUString& rInPDFFileURL, bool getPassword( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler, rtl::OUString& o_rPwd, - bool bFirstTry ); + bool bFirstTry, + const rtl::OUString& i_rDocName + ); } diff --git a/sdext/source/pdfimport/inc/pdfihelper.hxx b/sdext/source/pdfimport/inc/pdfihelper.hxx index bcc69b0e9eda..9abc22214a6c 100755 --- a/sdext/source/pdfimport/inc/pdfihelper.hxx +++ b/sdext/source/pdfimport/inc/pdfihelper.hxx @@ -190,7 +190,9 @@ namespace pdfi bool getPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, rtl::OUString& rOutPwd, - bool bFirstTry ); + bool bFirstTry, + const rtl::OUString& rDocName + ); } #define USTR(x) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) diff --git a/sdext/source/pdfimport/misc/pwdinteract.cxx b/sdext/source/pdfimport/misc/pwdinteract.cxx index a68c63054137..43dfd1151964 100644 --- a/sdext/source/pdfimport/misc/pwdinteract.cxx +++ b/sdext/source/pdfimport/misc/pwdinteract.cxx @@ -33,7 +33,7 @@ #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/task/XInteractionRequest.hpp> #include <com/sun/star/task/XInteractionPassword.hpp> -#include <com/sun/star/task/PasswordRequest.hpp> +#include <com/sun/star/task/DocumentPasswordRequest.hpp> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/compbase2.hxx> @@ -53,12 +53,12 @@ class PDFPasswordRequest : private cppu::BaseMutex, public PDFPasswordRequestBase { private: - task::PasswordRequest m_aRequest; - rtl::OUString m_aPassword; - bool m_bSelected; + task::DocumentPasswordRequest m_aRequest; + rtl::OUString m_aPassword; + bool m_bSelected; public: - explicit PDFPasswordRequest(bool bFirstTry); + explicit PDFPasswordRequest(bool bFirstTry, const rtl::OUString& rName); // XInteractionRequest virtual uno::Any SAL_CALL getRequest( ) throw (uno::RuntimeException); @@ -74,7 +74,7 @@ public: bool isSelected() const { osl::MutexGuard const guard( m_aMutex ); return m_bSelected; } }; -PDFPasswordRequest::PDFPasswordRequest( bool bFirstTry ) : +PDFPasswordRequest::PDFPasswordRequest( bool bFirstTry, const rtl::OUString& rName ) : PDFPasswordRequestBase( m_aMutex ), m_aRequest(), m_aPassword(), @@ -84,6 +84,7 @@ PDFPasswordRequest::PDFPasswordRequest( bool bFirstTry ) : task::PasswordRequestMode_PASSWORD_ENTER : task::PasswordRequestMode_PASSWORD_REENTER; m_aRequest.Classification = task::InteractionClassification_QUERY; + m_aRequest.Name = rName; } uno::Any SAL_CALL PDFPasswordRequest::getRequest() throw (uno::RuntimeException) @@ -132,13 +133,15 @@ namespace pdfi bool getPassword( const uno::Reference< task::XInteractionHandler >& xHandler, rtl::OUString& rOutPwd, - bool bFirstTry ) + bool bFirstTry, + const rtl::OUString& rDocName + ) { bool bSuccess = false; PDFPasswordRequest* pRequest; uno::Reference< task::XInteractionRequest > xReq( - pRequest = new PDFPasswordRequest( bFirstTry ) ); + pRequest = new PDFPasswordRequest( bFirstTry, rDocName ) ); try { xHandler->handle( xReq ); diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 0eafbbb83327..bbc8c4f19f47 100755 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -875,7 +875,8 @@ oslFileError readLine( oslFileHandle pFile, ::rtl::OStringBuffer& line ) static bool checkEncryption( const rtl::OUString& i_rPath, const uno::Reference< task::XInteractionHandler >& i_xIHdl, rtl::OUString& io_rPwd, - bool& o_rIsEncrypted + bool& o_rIsEncrypted, + const rtl::OUString& i_rDocName ) { bool bSuccess = false; @@ -908,7 +909,7 @@ static bool checkEncryption( const rtl::OUString& bool bEntered = false; do { - bEntered = getPassword( i_xIHdl, io_rPwd, ! bEntered ); + bEntered = getPassword( i_xIHdl, io_rPwd, ! bEntered, i_rDocName ); rtl::OString aIsoPwd = rtl::OUStringToOString( io_rPwd, RTL_TEXTENCODING_ISO_8859_1 ); bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() ); @@ -937,11 +938,12 @@ bool xpdf_ImportFromFile( const ::rtl::OUString& rUR ::rtl::OUString aSysUPath; if( osl_getSystemPathFromFileURL( rURL.pData, &aSysUPath.pData ) != osl_File_E_None ) return false; + rtl::OUString aDocName( rURL.copy( rURL.lastIndexOf( sal_Unicode('/') )+1 ) ); // check for encryption, if necessary get password rtl::OUString aPwd( rPwd ); bool bIsEncrypted = false; - if( checkEncryption( aSysUPath, xIHdl, aPwd, bIsEncrypted ) == false ) + if( checkEncryption( aSysUPath, xIHdl, aPwd, bIsEncrypted, aDocName ) == false ) return false; rtl::OUStringBuffer converterURL = rtl::OUString::createFromAscii("xpdfimport"); |