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_DP_UCB_H
21 #define INCLUDED_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( 1 );
46 static OUString
getTitle( ::ucbhelper::Content
&rContent
)
48 return OUString( rContent
.getPropertyValue(
49 OUString::createFromAscii( "Title" ) ).get
<OUString
>() );
51 // just return titles - the ucbhelper should have a simpler API for this [!]
52 static css::uno::Reference
< css::sdbc::XResultSet
>
53 createCursor( ::ucbhelper::Content
&rContent
,
54 ucbhelper::ResultSetInclude eInclude
)
56 return css::uno::Reference
< css::sdbc::XResultSet
>(
57 rContent
.createCursor( StrTitle::getTitleSequence(), eInclude
) );
61 //==============================================================================
62 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool create_ucb_content(
63 ::ucbhelper::Content
* ucb_content
,
65 css::uno::Reference
<css::ucb::XCommandEnvironment
> const & xCmdEnv
,
66 bool throw_exc
= true );
68 //==============================================================================
69 /** @return true if previously non-existing folder has been created
71 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool create_folder(
72 ::ucbhelper::Content
* ucb_content
,
74 css::uno::Reference
<css::ucb::XCommandEnvironment
> const & xCmdEnv
,
75 bool throw_exc
= true );
77 //==============================================================================
78 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool erase_path(
80 css::uno::Reference
<css::ucb::XCommandEnvironment
> const & xCmdEnv
,
81 bool throw_exc
= true );
83 //==============================================================================
84 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
85 ::rtl::ByteSequence
readFile( ::ucbhelper::Content
& ucb_content
);
87 //==============================================================================
88 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
89 bool readLine( OUString
* res
, OUString
const & startingWith
,
90 ::ucbhelper::Content
& ucb_content
, rtl_TextEncoding textenc
);
92 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
93 bool readProperties( ::std::list
< ::std::pair
< OUString
, OUString
> > & out_result
,
94 ::ucbhelper::Content
& ucb_content
);
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */