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 25 #ifndef _FILINSREQ_HXX_ 26 #define _FILINSREQ_HXX_ 27 28 #include <cppuhelper/weak.hxx> 29 #include <ucbhelper/macros.hxx> 30 #include <rtl/ustring.hxx> 31 #include <com/sun/star/uno/XInterface.hpp> 32 #include <com/sun/star/lang/XTypeProvider.hpp> 33 #include <com/sun/star/task/XInteractionAbort.hpp> 34 #include <com/sun/star/ucb/XInteractionSupplyName.hpp> 35 #include <com/sun/star/task/XInteractionRequest.hpp> 36 37 38 namespace fileaccess { 39 40 41 class shell; 42 43 44 class XInteractionSupplyNameImpl 45 : public cppu::OWeakObject, 46 public com::sun::star::lang::XTypeProvider, 47 public com::sun::star::ucb::XInteractionSupplyName 48 { 49 public: 50 XInteractionSupplyNameImpl()51 XInteractionSupplyNameImpl() 52 : m_bSelected(false) 53 { 54 } 55 56 virtual com::sun::star::uno::Any SAL_CALL 57 queryInterface( 58 const com::sun::star::uno::Type& rType ); 59 60 virtual void SAL_CALL 61 acquire( 62 void ) 63 throw(); 64 65 virtual void SAL_CALL 66 release( 67 void ) 68 throw(); 69 70 71 // XTypeProvider 72 XTYPEPROVIDER_DECL()73 XTYPEPROVIDER_DECL() 74 75 76 virtual void SAL_CALL select() 77 { 78 m_bSelected = true; 79 } 80 setName(const::rtl::OUString & Name)81 void SAL_CALL setName(const ::rtl::OUString& Name) 82 { 83 m_aNewName = Name; 84 } 85 getName() const86 rtl::OUString getName() const 87 { 88 return m_aNewName; 89 } 90 isSelected() const91 bool isSelected() const 92 { 93 return m_bSelected; 94 } 95 96 private: 97 98 bool m_bSelected; 99 rtl::OUString m_aNewName; 100 }; 101 102 103 104 class XInteractionAbortImpl 105 : public cppu::OWeakObject, 106 public com::sun::star::lang::XTypeProvider, 107 public com::sun::star::task::XInteractionAbort 108 { 109 public: 110 XInteractionAbortImpl()111 XInteractionAbortImpl() 112 : m_bSelected(false) 113 { 114 } 115 116 virtual com::sun::star::uno::Any SAL_CALL 117 queryInterface( 118 const com::sun::star::uno::Type& rType ); 119 120 virtual void SAL_CALL 121 acquire( 122 void ) 123 throw(); 124 125 virtual void SAL_CALL 126 release( 127 void ) 128 throw(); 129 130 131 // XTypeProvider 132 XTYPEPROVIDER_DECL()133 XTYPEPROVIDER_DECL() 134 135 136 virtual void SAL_CALL select() 137 { 138 m_bSelected = true; 139 } 140 141 isSelected() const142 bool isSelected() const 143 { 144 return m_bSelected; 145 } 146 147 private: 148 149 bool m_bSelected; 150 }; 151 152 153 154 class XInteractionRequestImpl 155 : public cppu::OWeakObject, 156 public com::sun::star::lang::XTypeProvider, 157 public com::sun::star::task::XInteractionRequest 158 { 159 public: 160 161 XInteractionRequestImpl( 162 const rtl::OUString& aClashingName, 163 const com::sun::star::uno::Reference< 164 com::sun::star::uno::XInterface>& xOrigin, 165 shell* pShell, 166 sal_Int32 CommandId); 167 168 virtual com::sun::star::uno::Any SAL_CALL 169 queryInterface( 170 const com::sun::star::uno::Type& rType ); 171 172 virtual void SAL_CALL 173 acquire( 174 void ) 175 throw(); 176 177 virtual void SAL_CALL 178 release( 179 void ) 180 throw(); 181 182 183 // XTypeProvider 184 185 XTYPEPROVIDER_DECL() 186 187 ::com::sun::star::uno::Any SAL_CALL getRequest( ); 188 189 com::sun::star::uno::Sequence< 190 com::sun::star::uno::Reference< 191 com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations()192 getContinuations( ) 193 { 194 return m_aSeq; 195 } 196 aborted() const197 bool aborted() const 198 { 199 return p2->isSelected(); 200 } 201 newName() const202 rtl::OUString newName() const 203 { 204 if( p1->isSelected() ) 205 return p1->getName(); 206 else 207 return rtl::OUString(); 208 } 209 210 private: 211 212 XInteractionSupplyNameImpl* p1; 213 XInteractionAbortImpl* p2; 214 sal_Int32 m_nErrorCode,m_nMinorError; 215 216 com::sun::star::uno::Sequence< 217 com::sun::star::uno::Reference< 218 com::sun::star::task::XInteractionContinuation > > m_aSeq; 219 220 rtl::OUString m_aClashingName; 221 com::sun::star::uno::Reference< 222 com::sun::star::uno::XInterface> m_xOrigin; 223 }; 224 225 } 226 227 228 #endif 229