diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-11-12 18:12:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-11-14 11:13:23 +0100 |
commit | 8061c8c70b7ffcd8f472d2f5b909911f2095fec7 (patch) | |
tree | da1cee91243467e3d88ad763d7786c147eb93a7d /include | |
parent | 18be6f161de20f3b0e05d0dd494242eda16ee5c4 (diff) |
Make requestAndVerifyDocPassword var with MediaDescriptor a mem fn of latter
Change-Id: I645d554c7ce592d93ca0696fa7e6068ce40c9058
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/docpasswordhelper.hxx | 54 | ||||
-rw-r--r-- | include/comphelper/mediadescriptor.hxx | 48 |
2 files changed, 48 insertions, 54 deletions
diff --git a/include/comphelper/docpasswordhelper.hxx b/include/comphelper/docpasswordhelper.hxx index 716309840226..8c160fd32e1f 100644 --- a/include/comphelper/docpasswordhelper.hxx +++ b/include/comphelper/docpasswordhelper.hxx @@ -30,10 +30,6 @@ namespace com { namespace sun { namespace star { namespace beans { struct Proper namespace comphelper { -class MediaDescriptor; - -// ============================================================================ - enum DocPasswordVerifierResult { DocPasswordVerifierResult_OK, @@ -290,56 +286,6 @@ public: const ::std::vector< OUString >* pDefaultPasswords = 0, bool* pbIsDefaultPassword = 0 ); - // ------------------------------------------------------------------------ - - /** This helper function tries to find a password for the document - described by the passed media descriptor. - - First, the list of default passwords will be tried if provided. This is - needed by import filters for external file formats that have to check a - predefined password in some cases without asking the user for a - password. Every password is checked using the passed password verifier. - - If not successful, the passed media descriptor is asked for a password, - that has been set e.g. by an API call to load a document. If existing, - the password is checked using the passed password verifier. - - If still not successful, the interaction handler contained in the - passed nmedia descriptor is used to request a password from the user. - This will be repeated until the passed password verifier validates the - entered password, or if the user chooses to cancel password input. - - @param rVerifier - The password verifier used to check every processed password. - - @param rMediaDesc - The media descriptor of the document that needs to be opened with - a password. If a valid password (that is not contained in the - passed list of default passwords) was found, it will be inserted - into the "Password" property of this descriptor. - - @param eRequestType - The password request type that will be passed to the - DocPasswordRequest object created internally. See - docpasswordrequest.hxx for more details. - - @param pDefaultPasswords - If not null, contains default passwords that will be tried before a - password will be requested from the media descriptor or the user. - - @return - If not empty, contains the password that has been validated by the - passed password verifier. If empty, no valid password has been - found, or the user has chossen to cancel password input. - */ - static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestAndVerifyDocPassword( - IDocPasswordVerifier& rVerifier, - MediaDescriptor& rMediaDesc, - DocPasswordRequestType eRequestType, - const ::std::vector< OUString >* pDefaultPasswords = 0 ); - - // ------------------------------------------------------------------------ - private: ~DocPasswordHelper(); }; diff --git a/include/comphelper/mediadescriptor.hxx b/include/comphelper/mediadescriptor.hxx index 3080c496aab2..4cc457e1f5c8 100644 --- a/include/comphelper/mediadescriptor.hxx +++ b/include/comphelper/mediadescriptor.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_COMPHELPER_MEDIADESCRIPTOR_HXX #define INCLUDED_COMPHELPER_MEDIADESCRIPTOR_HXX +#include <comphelper/docpasswordrequest.hxx> #include <comphelper/sequenceashashmap.hxx> #include <rtl/ustring.hxx> #include <comphelper/comphelperdllapi.h> @@ -30,6 +31,8 @@ namespace com { namespace sun { namespace star { namespace io { namespace comphelper{ +class IDocPasswordVerifier; + /** @short can be used to work with a ::com::sun::star::document::MediaDescriptor struct. @@ -216,6 +219,51 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap void clearComponentDataEntry( const OUString& rName ); + /** This helper function tries to find a password for the document + described by this media descriptor. + + First, the list of default passwords will be tried if provided. This + is needed by import filters for external file formats that have to + check a predefined password in some cases without asking the user + for a password. Every password is checked using the passed password + verifier. + + If not successful, this media descriptor is asked for a password, + that has been set e.g. by an API call to load a document. If + existing, the password is checked using the passed password + verifier. + + If still not successful, the interaction handler contained in this + media descriptor is used to request a password from the user. This + will be repeated until the passed password verifier validates the + entered password, or if the user chooses to cancel password input. + + If a valid password (that is not contained in the passed list of + default passwords) was found, it will be inserted into the + "Password" property of this descriptor. + + @param rVerifier + The password verifier used to check every processed password. + + @param eRequestType + The password request type that will be passed to the + DocPasswordRequest object created internally. See + docpasswordrequest.hxx for more details. + + @param pDefaultPasswords + If not null, contains default passwords that will be tried before a + password will be requested from the media descriptor or the user. + + @return + If not empty, contains the password that has been validated by the + passed password verifier. If empty, no valid password has been + found, or the user has chossen to cancel password input. + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestAndVerifyDocPassword( + IDocPasswordVerifier& rVerifier, + DocPasswordRequestType eRequestType, + const ::std::vector< OUString >* pDefaultPasswords = 0 ); + //------------------------------------------- // helper private: |