Fix GNU C++ version check
[LibreOffice.git] / ucb / source / ucp / file / filinsreq.cxx
blobc0af35edb01383c3d8e553a596ac9a7b8451e18a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
21 #include "filtask.hxx"
23 #include <comphelper/interaction.hxx>
25 #include <com/sun/star/ucb/IOErrorCode.hpp>
26 #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
27 #include <com/sun/star/ucb/NameClashException.hpp>
28 #include <com/sun/star/beans/PropertyValue.hpp>
31 using namespace cppu;
32 using namespace com::sun::star;
33 using namespace com::sun::star::uno;
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 TaskManager *pShell,sal_Int32 CommandId)
44 : p1( new XInteractionSupplyNameImpl ),
45 p2( new XInteractionAbortImpl ),
46 m_xOrigin(xOrigin)
48 TaskHandlerErr nErrorCode(TaskHandlerErr::NO_ERROR);
49 sal_Int32 nMinorError(0);
50 if( pShell )
51 pShell->retrieveError(CommandId,nErrorCode,nMinorError);
52 std::vector<uno::Reference<task::XInteractionContinuation>> continuations{
53 Reference<XInteractionContinuation>(p1),
54 Reference<XInteractionContinuation>(p2) };
55 Any aAny;
56 if(nErrorCode == TaskHandlerErr::FOLDER_EXISTS_MKDIR)
58 NameClashException excep(u"folder exists and overwrite forbidden"_ustr, m_xOrigin,
59 InteractionClassification_ERROR, aClashingName);
60 aAny <<= excep;
62 else if(nErrorCode == TaskHandlerErr::INVALID_NAME_MKDIR)
64 PropertyValue prop;
65 prop.Name = "ResourceName";
66 prop.Handle = -1;
67 prop.Value <<= aClashingName;
68 InteractiveAugmentedIOException excep(u"the name contained invalid characters"_ustr, m_xOrigin,
69 InteractionClassification_ERROR,
70 IOErrorCode_INVALID_CHARACTER, { Any(prop) });
71 aAny <<= excep;
74 m_xRequest.set(new ::comphelper::OInteractionRequest(aAny, std::move(continuations)));
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */