fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucbhelper / source / client / fileidentifierconverter.cxx
blobe3f3ec9cfeb96a508b4a8b30d1cd5f301d73bc0e
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 <ucbhelper/fileidentifierconverter.hxx>
21 #include <com/sun/star/ucb/ContentProviderInfo.hpp>
22 #include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
23 #include <com/sun/star/ucb/XUniversalContentBroker.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/uno/Sequence.hxx>
26 #include <osl/diagnose.h>
27 #include <rtl/ustring.hxx>
28 #include <sal/types.h>
30 using namespace com::sun::star;
32 namespace ucbhelper {
36 // getLocalFileURL
40 OUString
41 getLocalFileURL()
43 // If there were more file systems than just "file:///" (e.g., the obsolete
44 // "vnd.sun.star.wfs:///"), this code should query all relevant UCPs for
45 // their com.sun.star.ucb.XFileIdentifierConverter.getFileProviderLocality
46 // and return the most local one:
47 return OUString("file:///");
52 // getFileURLFromSystemPath
56 OUString
57 getFileURLFromSystemPath(
58 uno::Reference< ucb::XUniversalContentBroker > const & rUcb,
59 OUString const & rBaseURL,
60 OUString const & rSystemPath)
62 OSL_ASSERT(rUcb.is());
64 uno::Reference< ucb::XFileIdentifierConverter >
65 xConverter(rUcb->queryContentProvider(rBaseURL), uno::UNO_QUERY);
66 if (xConverter.is())
67 return xConverter->getFileURLFromSystemPath(rBaseURL, rSystemPath);
68 else
69 return OUString();
74 // getSystemPathFromFileURL
78 OUString
79 getSystemPathFromFileURL(
80 uno::Reference< ucb::XUniversalContentBroker > const & rUcb,
81 OUString const & rURL)
83 OSL_ASSERT(rUcb.is());
85 uno::Reference< ucb::XFileIdentifierConverter >
86 xConverter(rUcb->queryContentProvider(rURL), uno::UNO_QUERY);
87 if (xConverter.is())
88 return xConverter->getSystemPathFromFileURL(rURL);
89 else
90 return OUString();
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */