Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : :
21 : : #ifndef _FILINSREQ_HXX_
22 : : #define _FILINSREQ_HXX_
23 : :
24 : : #include <cppuhelper/weak.hxx>
25 : : #include <ucbhelper/macros.hxx>
26 : : #include <rtl/ustring.hxx>
27 : : #include <com/sun/star/uno/XInterface.hpp>
28 : : #include <com/sun/star/lang/XTypeProvider.hpp>
29 : : #include <com/sun/star/task/XInteractionAbort.hpp>
30 : : #include <com/sun/star/ucb/XInteractionSupplyName.hpp>
31 : : #include <com/sun/star/task/XInteractionRequest.hpp>
32 : :
33 : :
34 : : namespace fileaccess {
35 : :
36 : :
37 : : class shell;
38 : :
39 : :
40 [ - + ]: 150 : class XInteractionSupplyNameImpl
41 : : : public cppu::OWeakObject,
42 : : public com::sun::star::lang::XTypeProvider,
43 : : public com::sun::star::ucb::XInteractionSupplyName
44 : : {
45 : : public:
46 : :
47 : 75 : XInteractionSupplyNameImpl()
48 : 75 : : m_bSelected(false)
49 : : {
50 : 75 : }
51 : :
52 : : virtual com::sun::star::uno::Any SAL_CALL
53 : : queryInterface(
54 : : const com::sun::star::uno::Type& rType )
55 : : throw( com::sun::star::uno::RuntimeException);
56 : :
57 : : virtual void SAL_CALL
58 : : acquire(
59 : : void )
60 : : throw();
61 : :
62 : : virtual void SAL_CALL
63 : : release(
64 : : void )
65 : : throw();
66 : :
67 : :
68 : : // XTypeProvider
69 : :
70 : : XTYPEPROVIDER_DECL()
71 : :
72 : :
73 : 0 : virtual void SAL_CALL select()
74 : : throw (::com::sun::star::uno::RuntimeException)
75 : : {
76 : 0 : m_bSelected = true;
77 : 0 : }
78 : :
79 : 0 : void SAL_CALL setName(const ::rtl::OUString& Name)
80 : : throw(::com::sun::star::uno::RuntimeException)
81 : : {
82 : 0 : m_aNewName = Name;
83 : 0 : }
84 : :
85 : 0 : rtl::OUString getName() const
86 : : {
87 : 0 : return m_aNewName;
88 : : }
89 : :
90 : 75 : bool isSelected() const
91 : : {
92 : 75 : return m_bSelected;
93 : : }
94 : :
95 : : private:
96 : :
97 : : bool m_bSelected;
98 : : rtl::OUString m_aNewName;
99 : : };
100 : :
101 : :
102 : :
103 [ - + ]: 150 : class XInteractionAbortImpl
104 : : : public cppu::OWeakObject,
105 : : public com::sun::star::lang::XTypeProvider,
106 : : public com::sun::star::task::XInteractionAbort
107 : : {
108 : : public:
109 : :
110 : 75 : XInteractionAbortImpl()
111 : 75 : : m_bSelected(false)
112 : : {
113 : 75 : }
114 : :
115 : : virtual com::sun::star::uno::Any SAL_CALL
116 : : queryInterface(
117 : : const com::sun::star::uno::Type& rType )
118 : : throw( com::sun::star::uno::RuntimeException);
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 : :
133 : : XTYPEPROVIDER_DECL()
134 : :
135 : :
136 : 0 : virtual void SAL_CALL select()
137 : : throw (::com::sun::star::uno::RuntimeException)
138 : : {
139 : 0 : m_bSelected = true;
140 : 0 : }
141 : :
142 : :
143 : 75 : bool isSelected() const
144 : : {
145 : 75 : return m_bSelected;
146 : : }
147 : :
148 : : private:
149 : :
150 : : bool m_bSelected;
151 : : };
152 : :
153 : :
154 : :
155 [ + - ][ - + ]: 150 : class XInteractionRequestImpl
156 : : : public cppu::OWeakObject,
157 : : public com::sun::star::lang::XTypeProvider,
158 : : public com::sun::star::task::XInteractionRequest
159 : : {
160 : : public:
161 : :
162 : : XInteractionRequestImpl(
163 : : const rtl::OUString& aClashingName,
164 : : const com::sun::star::uno::Reference<
165 : : com::sun::star::uno::XInterface>& xOrigin,
166 : : shell* pShell,
167 : : sal_Int32 CommandId);
168 : :
169 : : virtual com::sun::star::uno::Any SAL_CALL
170 : : queryInterface(
171 : : const com::sun::star::uno::Type& rType )
172 : : throw( com::sun::star::uno::RuntimeException);
173 : :
174 : : virtual void SAL_CALL
175 : : acquire(
176 : : void )
177 : : throw();
178 : :
179 : : virtual void SAL_CALL
180 : : release(
181 : : void )
182 : : throw();
183 : :
184 : :
185 : : // XTypeProvider
186 : :
187 : : XTYPEPROVIDER_DECL()
188 : :
189 : : ::com::sun::star::uno::Any SAL_CALL getRequest( )
190 : : throw (::com::sun::star::uno::RuntimeException);
191 : :
192 : : com::sun::star::uno::Sequence<
193 : : com::sun::star::uno::Reference<
194 : : com::sun::star::task::XInteractionContinuation > > SAL_CALL
195 : 0 : getContinuations( )
196 : : throw (::com::sun::star::uno::RuntimeException)
197 : : {
198 : 0 : return m_aSeq;
199 : : }
200 : :
201 : 75 : bool aborted() const
202 : : {
203 : 75 : return p2->isSelected();
204 : : }
205 : :
206 : 75 : rtl::OUString newName() const
207 : : {
208 [ - + ]: 75 : if( p1->isSelected() )
209 : 0 : return p1->getName();
210 : : else
211 : 75 : return rtl::OUString();
212 : : }
213 : :
214 : : private:
215 : :
216 : : XInteractionSupplyNameImpl* p1;
217 : : XInteractionAbortImpl* p2;
218 : : sal_Int32 m_nErrorCode,m_nMinorError;
219 : :
220 : : com::sun::star::uno::Sequence<
221 : : com::sun::star::uno::Reference<
222 : : com::sun::star::task::XInteractionContinuation > > m_aSeq;
223 : :
224 : : rtl::OUString m_aClashingName;
225 : : com::sun::star::uno::Reference<
226 : : com::sun::star::uno::XInterface> m_xOrigin;
227 : : };
228 : :
229 : : }
230 : :
231 : :
232 : : #endif
233 : :
234 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|