1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "filinsreq.hxx"
31 #include "filglob.hxx"
32 #include <com/sun/star/ucb/IOErrorCode.hpp>
33 #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
34 #include <com/sun/star/ucb/NameClashException.hpp>
35 #include <com/sun/star/beans/PropertyValue.hpp>
40 using namespace com::sun::star
;
41 using namespace com::sun::star::uno
;
42 using namespace com::sun::star::lang
;
43 using namespace com::sun::star::task
;
44 using namespace com::sun::star::ucb
;
45 using namespace com::sun::star::beans
;
46 using namespace fileaccess
;
51 XInteractionSupplyNameImpl::acquire( void )
54 OWeakObject::acquire();
60 XInteractionSupplyNameImpl::release( void )
63 OWeakObject::release();
69 XInteractionSupplyNameImpl::queryInterface( const Type
& rType
)
70 throw( RuntimeException
)
72 Any aRet
= cppu::queryInterface( rType
,
73 (static_cast< lang::XTypeProvider
* >(this)),
74 (static_cast< XInteractionSupplyName
* >(this)) );
75 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( rType
);
79 //////////////////////////////////////////////////////////////////////////////////////////
81 //////////////////////////////////////////////////////////////////////////////////////////
83 XTYPEPROVIDER_IMPL_2( XInteractionSupplyNameImpl
,
85 XInteractionSupplyName
)
90 XInteractionAbortImpl::acquire( void )
93 OWeakObject::acquire();
99 XInteractionAbortImpl::release( void )
102 OWeakObject::release();
108 XInteractionAbortImpl::queryInterface( const Type
& rType
)
109 throw( RuntimeException
)
111 Any aRet
= cppu::queryInterface( rType
,
112 (static_cast< lang::XTypeProvider
* >(this)),
113 (static_cast< XInteractionAbort
* >(this)) );
114 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( rType
);
118 //////////////////////////////////////////////////////////////////////////////////////////
120 //////////////////////////////////////////////////////////////////////////////////////////
122 XTYPEPROVIDER_IMPL_2( XInteractionAbortImpl
,
128 XInteractionRequestImpl::XInteractionRequestImpl(
129 const rtl::OUString
& aClashingName
,
130 const Reference
<XInterface
>& xOrigin
,
131 shell
*pShell
,sal_Int32 CommandId
)
132 : p1( new XInteractionSupplyNameImpl
),
133 p2( new XInteractionAbortImpl
),
137 m_aClashingName(aClashingName
),
141 pShell
->retrieveError(CommandId
,m_nErrorCode
,m_nMinorError
);
142 m_aSeq
[0] = Reference
<XInteractionContinuation
>(p1
);
143 m_aSeq
[1] = Reference
<XInteractionContinuation
>(p2
);
148 XInteractionRequestImpl::acquire( void )
151 OWeakObject::acquire();
157 XInteractionRequestImpl::release( void )
160 OWeakObject::release();
166 XInteractionRequestImpl::queryInterface( const Type
& rType
)
167 throw( RuntimeException
)
170 cppu::queryInterface(
172 (static_cast< lang::XTypeProvider
* >(this)),
173 (static_cast< XInteractionRequest
* >(this)) );
174 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( rType
);
178 //////////////////////////////////////////////////////////////////////////////////////////
180 //////////////////////////////////////////////////////////////////////////////////////////
182 XTYPEPROVIDER_IMPL_2( XInteractionRequestImpl
,
184 XInteractionRequest
)
188 XInteractionRequestImpl::getRequest()
189 throw(RuntimeException
)
192 if(m_nErrorCode
== TASKHANDLING_FOLDER_EXISTS_MKDIR
)
194 NameClashException excep
;
195 excep
.Name
= m_aClashingName
;
196 excep
.Classification
= InteractionClassification_ERROR
;
197 excep
.Context
= m_xOrigin
;
198 excep
.Message
= rtl::OUString( "folder exists and overwritte forbidden");
201 else if(m_nErrorCode
== TASKHANDLING_INVALID_NAME_MKDIR
)
203 InteractiveAugmentedIOException excep
;
204 excep
.Code
= IOErrorCode_INVALID_CHARACTER
;
206 prop
.Name
= rtl::OUString("ResourceName");
208 prop
.Value
<<= m_aClashingName
;
209 Sequence
<Any
> seq(1);
211 excep
.Arguments
= seq
;
212 excep
.Classification
= InteractionClassification_ERROR
;
213 excep
.Context
= m_xOrigin
;
214 excep
.Message
= rtl::OUString( "the name contained invalid characters");
221 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */