1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef INCLUDED_TDOC_PASSWORDREQUEST_HXX 25 #define INCLUDED_TDOC_PASSWORDREQUEST_HXX 26 27 #include "com/sun/star/task/PasswordRequestMode.hpp" 28 #include "com/sun/star/task/XInteractionPassword.hpp" 29 30 #include "ucbhelper/interactionrequest.hxx" 31 32 namespace tdoc_ucp { 33 34 /* 35 @usage: 36 37 uno::Reference< ucb::XCommandEnvironment > Environment = ...; 38 39 if ( Environment.is() ) 40 { 41 uno::Reference< task::XInteractionHandler > xIH 42 = Environment->getInteractionHandler(); 43 if ( xIH.is() ) 44 { 45 rtl::Reference< DocumentPasswordRequest > xRequest 46 = new DocumentPasswordRequest( 47 task::PasswordRequestMode_PASSWORD_ENTER, 48 m_xIdentifier->getContentIdentifier() ); 49 xIH->handle( xRequest.get() ); 50 51 rtl::Reference< ucbhelper::InteractionContinuation > xSelection 52 = xRequest->getSelection(); 53 54 if ( xSelection.is() ) 55 { 56 // Handler handled the request. 57 uno::Reference< task::XInteractionAbort > xAbort( 58 xSelection.get(), uno::UNO_QUERY ); 59 if ( xAbort.is() ) 60 { 61 // @@@ 62 } 63 64 uno::Reference< task::XInteractionRetry > xRetry( 65 xSelection.get(), uno::UNO_QUERY ); 66 if ( xRetry.is() ) 67 { 68 // @@@ 69 } 70 71 uno::Reference< task::XInteractionPassword > xPassword( 72 xSelection.get(), uno::UNO_QUERY ); 73 if ( xPassword.is() ) 74 { 75 rtl::OUString aPassword = xPassword->getPassword(); 76 77 // @@@ 78 } 79 } 80 } 81 } 82 83 */ 84 85 class DocumentPasswordRequest : public ucbhelper::InteractionRequest 86 { 87 public: 88 DocumentPasswordRequest( 89 com::sun::star::task::PasswordRequestMode eMode, 90 const rtl::OUString & rDocumentName ); 91 }; 92 93 } // namespace tdoc_ucp 94 95 #endif /* !INCLUDED_TDOC_PASSWORDREQUEST_HXX */ 96 97