1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "filinsreq.hxx"
22 #include "filglob.hxx"
23 #include <com/sun/star/ucb/IOErrorCode.hpp>
24 #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
25 #include <com/sun/star/ucb/NameClashException.hpp>
26 #include <com/sun/star/beans/PropertyValue.hpp>
31 using namespace com::sun::star
;
32 using namespace com::sun::star::uno
;
33 using namespace com::sun::star::lang
;
34 using namespace com::sun::star::task
;
35 using namespace com::sun::star::ucb
;
36 using namespace com::sun::star::beans
;
37 using namespace fileaccess
;
40 XInteractionRequestImpl::XInteractionRequestImpl(
41 const OUString
& aClashingName
,
42 const Reference
<XInterface
>& xOrigin
,
43 shell
*pShell
,sal_Int32 CommandId
)
44 : p1( new XInteractionSupplyNameImpl
),
45 p2( new XInteractionAbortImpl
),
49 m_aClashingName(aClashingName
),
53 pShell
->retrieveError(CommandId
,m_nErrorCode
,m_nMinorError
);
54 m_aSeq
[0] = Reference
<XInteractionContinuation
>(p1
);
55 m_aSeq
[1] = Reference
<XInteractionContinuation
>(p2
);
60 XInteractionRequestImpl::getRequest()
61 throw(RuntimeException
, std::exception
)
64 if(m_nErrorCode
== TASKHANDLING_FOLDER_EXISTS_MKDIR
)
66 NameClashException excep
;
67 excep
.Name
= m_aClashingName
;
68 excep
.Classification
= InteractionClassification_ERROR
;
69 excep
.Context
= m_xOrigin
;
70 excep
.Message
= "folder exists and overwritte forbidden";
73 else if(m_nErrorCode
== TASKHANDLING_INVALID_NAME_MKDIR
)
75 InteractiveAugmentedIOException excep
;
76 excep
.Code
= IOErrorCode_INVALID_CHARACTER
;
78 prop
.Name
= "ResourceName";
80 prop
.Value
<<= m_aClashingName
;
83 excep
.Arguments
= seq
;
84 excep
.Classification
= InteractionClassification_ERROR
;
85 excep
.Context
= m_xOrigin
;
86 excep
.Message
= "the name contained invalid characters";
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */