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 .
19 #ifndef INCLUDED_UNOTOOLS_LOCALFILEHELPER_HXX
20 #define INCLUDED_UNOTOOLS_LOCALFILEHELPER_HXX
22 #include <com/sun/star/uno/Sequence.hxx>
23 #include <unotools/unotoolsdllapi.h>
25 #include <rtl/ustring.hxx>
29 class UNOTOOLS_DLLPUBLIC LocalFileHelper
33 Converts a "physical" file name into a "UCB compatible" URL ( if possible ).
34 If no UCP is available for the local file system, sal_False and an empty URL is returned.
35 Returning sal_True and an empty URL means that the URL doesn't point to a local file.
37 static bool ConvertPhysicalNameToURL(const OUString
& rName
, OUString
& rReturn
);
38 static bool ConvertSystemPathToURL( const OUString
& rName
, const OUString
& rBaseURL
, OUString
& rReturn
);
41 Converts a "UCB compatible" URL into a "physical" file name.
42 If no UCP is available for the local file system, sal_False and an empty file name is returned,
43 otherwise sal_True and a valid URL, because a file name can always be converted if a UCP for the local
44 file system is present ( watch: this doesn't mean that this file really exists! )
46 static bool ConvertURLToPhysicalName( const OUString
& rName
, OUString
& rReturn
);
47 static bool ConvertURLToSystemPath( const OUString
& rName
, OUString
& rReturn
);
49 static bool IsLocalFile(const OUString
& rName
);
50 static bool IsFileContent(const OUString
& rName
);
52 static ::com::sun::star::uno::Sequence
< OUString
>
53 GetFolderContents( const OUString
& rFolder
, bool bFolder
);
56 /// recursively remove directory and all contents
57 UNOTOOLS_DLLPUBLIC
void removeTree(OUString
const & url
);
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */