Line data Source code
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 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_UCB_H
21 : #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_UCB_H
22 :
23 : #include <list>
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"
30 :
31 : namespace ucbhelper
32 : {
33 : class Content;
34 : }
35 :
36 : namespace dp_misc {
37 :
38 : struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC StrTitle
39 : {
40 0 : static css::uno::Sequence< OUString > getTitleSequence()
41 : {
42 0 : css::uno::Sequence< OUString > aSeq( 1 );
43 0 : aSeq[ 0 ] = "Title";
44 0 : return aSeq;
45 : }
46 0 : static OUString getTitle( ::ucbhelper::Content &rContent )
47 : {
48 : return OUString( rContent.getPropertyValue(
49 0 : OUString::createFromAscii( "Title" ) ).get<OUString>() );
50 : }
51 : // just return titles - the ucbhelper should have a simpler API for this [!]
52 : static css::uno::Reference< css::sdbc::XResultSet >
53 0 : createCursor( ::ucbhelper::Content &rContent,
54 : ucbhelper::ResultSetInclude eInclude )
55 : {
56 : return css::uno::Reference< css::sdbc::XResultSet >(
57 0 : rContent.createCursor( StrTitle::getTitleSequence(), eInclude ) );
58 : }
59 : };
60 :
61 :
62 : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC bool create_ucb_content(
63 : ::ucbhelper::Content * ucb_content,
64 : OUString const & url,
65 : css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
66 : bool throw_exc = true );
67 :
68 :
69 : /** @return true if previously non-existing folder has been created
70 : */
71 : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC bool create_folder(
72 : ::ucbhelper::Content * ucb_content,
73 : OUString const & url,
74 : css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
75 : bool throw_exc = true );
76 :
77 :
78 : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC bool erase_path(
79 : OUString const & url,
80 : css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
81 : bool throw_exc = true );
82 :
83 :
84 : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
85 : ::rtl::ByteSequence readFile( ::ucbhelper::Content & ucb_content );
86 :
87 :
88 : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
89 : bool readLine( OUString * res, OUString const & startingWith,
90 : ::ucbhelper::Content & ucb_content, rtl_TextEncoding textenc );
91 :
92 : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
93 : bool readProperties( ::std::list< ::std::pair< OUString, OUString> > & out_result,
94 : ::ucbhelper::Content & ucb_content);
95 :
96 :
97 :
98 : }
99 :
100 : #endif
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|