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_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_UCB_H
21 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_UCB_H
24 #include <rtl/byteseq.hxx>
25 #include <rtl/instance.hxx>
26 #include <com/sun/star/sdbc/XResultSet.hpp>
27 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
28 #include "dp_misc_api.hxx"
29 #include <ucbhelper/content.hxx>
38 struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC StrTitle
40 static css::uno::Sequence
< OUString
> getTitleSequence()
42 css::uno::Sequence
<OUString
> aSeq
{ "Title" };
45 static OUString
getTitle( ::ucbhelper::Content
&rContent
)
47 return rContent
.getPropertyValue("Title").get
<OUString
>();
49 // just return titles - the ucbhelper should have a simpler API for this [!]
50 static css::uno::Reference
< css::sdbc::XResultSet
>
51 createCursor( ::ucbhelper::Content
&rContent
,
52 ucbhelper::ResultSetInclude eInclude
)
54 return rContent
.createCursor( StrTitle::getTitleSequence(), eInclude
);
59 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool create_ucb_content(
60 ::ucbhelper::Content
* ucb_content
,
62 css::uno::Reference
<css::ucb::XCommandEnvironment
> const & xCmdEnv
,
63 bool throw_exc
= true );
66 /** @return true if previously non-existing folder has been created
68 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool create_folder(
69 ::ucbhelper::Content
* ucb_content
,
71 css::uno::Reference
<css::ucb::XCommandEnvironment
> const & xCmdEnv
,
72 bool throw_exc
= true );
75 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool erase_path(
77 css::uno::Reference
<css::ucb::XCommandEnvironment
> const & xCmdEnv
,
78 bool throw_exc
= true );
81 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
82 std::vector
<sal_Int8
> readFile( ::ucbhelper::Content
& ucb_content
);
85 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
86 bool readLine( OUString
* res
, OUString
const & startingWith
,
87 ::ucbhelper::Content
& ucb_content
, rtl_TextEncoding textenc
);
89 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
90 bool readProperties( std::vector
< std::pair
< OUString
, OUString
> > & out_result
,
91 ::ucbhelper::Content
& ucb_content
);
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */