/src/libreoffice/comphelper/source/misc/getexpandeduri.cxx
Line | Count | Source |
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 | | |
10 | | #include <sal/config.h> |
11 | | |
12 | | #include <com/sun/star/uno/Reference.hxx> |
13 | | #include <com/sun/star/uri/UriReferenceFactory.hpp> |
14 | | #include <com/sun/star/uri/XVndSunStarExpandUrlReference.hpp> |
15 | | #include <com/sun/star/util/theMacroExpander.hpp> |
16 | | #include <comphelper/getexpandeduri.hxx> |
17 | | #include <rtl/ustring.hxx> |
18 | | |
19 | | namespace com::sun::star::uno { class XComponentContext; } |
20 | | |
21 | | OUString comphelper::getExpandedUri( |
22 | | css::uno::Reference<css::uno::XComponentContext> const & context, |
23 | | OUString const & uri) |
24 | 0 | { |
25 | 0 | css::uno::Reference<css::uri::XVndSunStarExpandUrlReference> ref( |
26 | 0 | css::uri::UriReferenceFactory::create(context)->parse(uri), |
27 | 0 | css::uno::UNO_QUERY); |
28 | 0 | return ref.is() |
29 | 0 | ? ref->expand(css::util::theMacroExpander::get(context)) : uri; |
30 | 0 | } |
31 | | |
32 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |