| 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 |
#pragma once |
| 20 |
|
| 21 |
#include <sal/config.h> |
| 22 |
|
| 23 |
#include <string_view> |
| 24 |
|
| 25 |
#include <rtl/ustring.hxx> |
| 26 |
#include <osl/file.hxx> |
| 27 |
#include <com/sun/star/ucb/XCommandEnvironment.hpp> |
| 28 |
|
| 29 |
enum class TaskHandlerErr; |
| 30 |
|
| 31 |
namespace fileaccess { |
| 32 |
|
| 33 |
class BaseContent; |
| 34 |
|
| 35 |
/******************************************************************************/ |
| 36 |
/* */ |
| 37 |
/* Helper functions */ |
| 38 |
/* */ |
| 39 |
/******************************************************************************/ |
| 40 |
|
| 41 |
|
| 42 |
// Returns true if dstUnqPath is a child from srcUnqPath or both are equal |
| 43 |
|
| 44 |
extern bool isChild( std::u16string_view srcUnqPath, |
| 45 |
std::u16string_view dstUnqPath ); |
| 46 |
|
| 47 |
|
| 48 |
// Changes the prefix in name |
| 49 |
extern OUString newName( std::u16string_view aNewPrefix, |
| 50 |
std::u16string_view aOldPrefix, |
| 51 |
std::u16string_view old_Name ); |
| 52 |
|
| 53 |
// returns the last part of the given url as title |
| 54 |
extern std::u16string_view getTitle( std::u16string_view aPath ); |
| 55 |
|
| 56 |
// returns the url without last part as parentname |
| 57 |
// In case aFileName is root ( file:/// ) root is returned |
| 58 |
|
| 59 |
extern OUString getParentName( std::u16string_view aFileName ); |
| 60 |
|
| 61 |
/** |
| 62 |
* special copy: |
| 63 |
* On test = true, the implementation determines whether the |
| 64 |
* destination exists and returns the appropriate errorcode E_EXIST. |
| 65 |
* osl::File::copy copies unchecked. |
| 66 |
*/ |
| 67 |
|
| 68 |
extern osl::FileBase::RC osl_File_copy( const OUString& strPath, |
| 69 |
const OUString& strDestPath, |
| 70 |
bool test ); |
| 71 |
|
| 72 |
/** |
| 73 |
* special move: |
| 74 |
* On test = true, the implementation determines whether the |
| 75 |
* destination exists and returns the appropriate errorcode E_EXIST. |
| 76 |
* osl::File::move moves unchecked |
| 77 |
*/ |
| 78 |
|
| 79 |
extern osl::FileBase::RC osl_File_move( const OUString& strPath, |
| 80 |
const OUString& strDestPath, |
| 81 |
bool test = false ); |
| 82 |
|
| 83 |
// This function implements the global exception handler of the file_ucp; |
| 84 |
// It never returns; |
| 85 |
|
| 86 |
extern void throw_handler( TaskHandlerErr errorCode, |
| 87 |
sal_Int32 minorCode, |
| 88 |
const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv, |
| 89 |
const OUString& aUncPath, |
| 90 |
BaseContent* pContent, |
| 91 |
bool isHandled); |
| 92 |
// the physical URL of the object |
| 93 |
|
| 94 |
} // end namespace fileaccess |
| 95 |
|
| 96 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |