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 .
20 #ifndef INCLUDED_UNOTOOLS_UCBHELPER_HXX
21 #define INCLUDED_UNOTOOLS_UCBHELPER_HXX
23 #include <sal/config.h>
25 #include <unotools/unotoolsdllapi.h>
26 #include <rtl/ustring.hxx>
27 #include <com/sun/star/uno/Reference.hxx>
29 namespace com::sun::star
{
32 class XComponentContext
;
35 class XCommandEnvironment
;
38 namespace ucbhelper
{ class Content
; }
40 namespace utl::UCBContentHelper
{
42 UNOTOOLS_DLLPUBLIC
bool IsDocument(OUString
const & url
);
44 UNOTOOLS_DLLPUBLIC
bool IsFolder(OUString
const & url
);
46 /// @param title must not be null
47 /// @return true iff title has been set (i.e., if obtaining the "Title" property
48 /// of the given content yields a non-void value without raising a
49 /// non-RuntimeException; RuntimeExceptions are passed through)
50 UNOTOOLS_DLLPUBLIC
bool GetTitle(
51 OUString
const & url
, OUString
* title
);
53 UNOTOOLS_DLLPUBLIC
bool Kill(OUString
const & url
);
55 UNOTOOLS_DLLPUBLIC
css::uno::Any
GetProperty(
56 OUString
const & url
, OUString
const & property
);
58 UNOTOOLS_DLLPUBLIC
bool MakeFolder(
59 ucbhelper::Content
& parent
, OUString
const & title
,
60 ucbhelper::Content
& result
);
63 UNOTOOLS_DLLPUBLIC
bool ensureFolder(
64 const css::uno::Reference
< css::uno::XComponentContext
>& xCtx
,
65 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
,
66 const OUString
& rFolder
, ucbhelper::Content
& result
) noexcept
;
68 UNOTOOLS_DLLPUBLIC
bool IsYounger(
69 OUString
const & younger
, OUString
const & older
);
71 UNOTOOLS_DLLPUBLIC
bool Exists(OUString
const & url
);
73 UNOTOOLS_DLLPUBLIC
bool IsSubPath(
74 OUString
const & parent
, OUString
const & child
);
76 UNOTOOLS_DLLPUBLIC
bool EqualURLs(
77 OUString
const & url1
, OUString
const & url2
);
80 * Returns a default XCommandEnvironment to be used
81 * when creating a ucbhelper::Content.
83 * Due to the way the WebDAV UCP provider works, an interaction handler
85 * 1) to activate the credential dialog or to provide the cached credentials
86 * whenever the server requests them;
88 * 2) in case of ssl connection (https) to activate the dialog to show the
89 * certificate if said certificate looks wrong or dubious.
91 * This helper provides the XCommandEnvironment with an interaction
92 * handler that intercepts:
93 * 1) css::ucb::AuthenticationRequest()
94 * 2) css::ucb::CertificateValidationRequest()
95 * 3) css::ucb::InteractiveIOException()
96 * 4) css::ucb::UnsupportedDataSinkException()
98 * Exception 1) and 2) will be passed to the UI handler, e.g. shown to
99 * the user for interaction.
101 * Exception 3) and 4) will be have a default 'Abort' result.
102 * See comphelper::StillReadWriteInteraction for details.
103 * comphelper::StillReadWriteInteraction was introduced in
104 * commit bbe51f039dffca2506ea542feb78571b6358b981.
107 css::uno::Reference
< css::ucb::XCommandEnvironment
> getDefaultCommandEnvironment();
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */