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 <sal/types.h>
26 #include <unotools/unotoolsdllapi.h>
28 namespace com
{ namespace sun
{ namespace star
{
31 class XComponentContext
;
34 class XCommandEnvironment
;
37 namespace ucbhelper
{ class Content
; }
39 namespace utl
{ namespace UCBContentHelper
{
41 UNOTOOLS_DLLPUBLIC
bool IsDocument(OUString
const & url
);
43 UNOTOOLS_DLLPUBLIC
bool IsFolder(OUString
const & url
);
45 /// @param title must not be null
46 /// @return true iff title has been set (i.e., if obtaining the "Title" property
47 /// of the given content yields a non-void value without raising a
48 /// non-RuntimeException; RuntimeExceptions are passed through)
49 UNOTOOLS_DLLPUBLIC
bool GetTitle(
50 OUString
const & url
, OUString
* title
);
52 UNOTOOLS_DLLPUBLIC
bool Kill(OUString
const & url
);
54 UNOTOOLS_DLLPUBLIC
css::uno::Any
GetProperty(
55 OUString
const & url
, OUString
const & property
);
57 UNOTOOLS_DLLPUBLIC
bool MakeFolder(
58 ucbhelper::Content
& parent
, OUString
const & title
,
59 ucbhelper::Content
& result
);
62 UNOTOOLS_DLLPUBLIC
bool ensureFolder(
63 const css::uno::Reference
< css::uno::XComponentContext
>& xCtx
,
64 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
,
65 const OUString
& rFolder
, ucbhelper::Content
& result
) throw();
67 /// @return the value of the "Size" property of the given content, or zero if
68 /// obtaining the property yields a void value or raises a
69 /// non-RuntimeException (RuntimeExceptions are passed through)
70 UNOTOOLS_DLLPUBLIC sal_Int64
GetSize(OUString
const & url
);
72 UNOTOOLS_DLLPUBLIC
bool IsYounger(
73 OUString
const & younger
, OUString
const & older
);
75 UNOTOOLS_DLLPUBLIC
bool Exists(OUString
const & url
);
77 UNOTOOLS_DLLPUBLIC
bool IsSubPath(
78 OUString
const & parent
, OUString
const & child
);
80 UNOTOOLS_DLLPUBLIC
bool EqualURLs(
81 OUString
const & url1
, OUString
const & url2
);
84 * Returns a default XCommandEnvironment to be used
85 * when creating a ucbhelper::Content.
87 * Due to the way the WebDAV UCP provider works, an interaction handler
89 * 1) to activate the credential dialog or to provide the cached credentials
90 * whenever the server requests them;
92 * 2) in case of ssl connection (https) to activate the dialog to show the
93 * certificate if said certificate looks wrong or dubious.
95 * This helper provides the XCommandEnvironment with an interaction
96 * handler that intercepts:
97 * 1) css::ucb::AuthenticationRequest()
98 * 2) css::ucb::CertificateValidationRequest()
99 * 3) css::ucb::InteractiveIOException()
100 * 4) css::ucb::UnsupportedDataSinkException()
102 * Exception 1) and 2) will be passed to the UI handler, e.g. shown to
103 * the user for interaction.
105 * Exception 3) and 4) will be have a default 'Abort' result.
106 * See comphelper::StillReadWriteInteraction for details.
107 * comphelper::StillReadWriteInteraction was introduced in
108 * commit bbe51f039dffca2506ea542feb78571b6358b981.
111 css::uno::Reference
< css::ucb::XCommandEnvironment
> getDefaultCommandEnvironment();
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */