Debian Codegraph @

ucb/source/ucp/ext/ucpext_datasupplier.hxx

raw
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 #pragma once
21
22 #include "ucpext_content.hxx"
23
24 #include <rtl/ref.hxx>
25 #include <ucbhelper/resultset.hxx>
26
27 #include <mutex>
28 #include <vector>
29
30
31 namespace ucb::ucp::ext
32 {
33
34
35 //= DataSupplier
36
37 class DataSupplier : public ::ucbhelper::ResultSetDataSupplier
38 {
39 public:
40 DataSupplier(
41 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
42 rtl::Reference< Content > xContent
43 );
44
45 void fetchData();
46
47 protected:
48 virtual ~DataSupplier() override;
49
50 virtual OUString queryContentIdentifierString( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
51 virtual css::uno::Reference< css::ucb::XContentIdentifier > queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
52 virtual css::uno::Reference< css::ucb::XContent > queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
53
54 virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
55
56 virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& rResultSetGuard) override;
57 virtual sal_uInt32 currentCount() override;
58 virtual bool isCountFinal() override;
59
60 virtual css::uno::Reference< css::sdbc::XRow > queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
61 virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
62
63 virtual void close() override;
64
65 virtual void validate() override;
66
67 private:
68 struct ResultListEntry
69 {
70 OUString sId;
71 css::uno::Reference< css::ucb::XContentIdentifier > xId;
72 ::rtl::Reference< Content > pContent;
73 css::uno::Reference< css::sdbc::XRow > xRow;
74 };
75 typedef ::std::vector< ResultListEntry > ResultList;
76 std::mutex m_aMutex;
77 ResultList m_aResults;
78 ::rtl::Reference< Content > m_xContent;
79 css::uno::Reference< css::uno::XComponentContext > m_xContext;
80 };
81
82
83 } // namespace ucp::ext
84
85
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */