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 GIO_DATASUPPLIER_HXX
21 : #define GIO_DATASUPPLIER_HXX
22 :
23 : #include <ucbhelper/resultset.hxx>
24 : #include "gio_content.hxx"
25 : #include <vector>
26 :
27 : namespace gio
28 : {
29 :
30 : class Content;
31 :
32 : struct ResultListEntry
33 : {
34 : OUString aId;
35 : com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > xId;
36 : com::sun::star::uno::Reference< com::sun::star::ucb::XContent > xContent;
37 : com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > xRow;
38 : GFileInfo *pInfo;
39 :
40 0 : ResultListEntry( GFileInfo *pInInfo ) : pInfo(pInInfo)
41 : {
42 0 : g_object_ref( pInfo );
43 0 : }
44 :
45 0 : ~ResultListEntry()
46 0 : {
47 0 : g_object_unref( pInfo );
48 0 : }
49 : };
50 :
51 : typedef std::vector< ResultListEntry* > ResultList;
52 :
53 : class DataSupplier : public ucbhelper::ResultSetDataSupplier
54 : {
55 : private:
56 : com::sun::star::uno::Reference< ::gio::Content > mxContent;
57 : com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
58 : sal_Int32 mnOpenMode;
59 : bool mbCountFinal;
60 : bool getData();
61 : ResultList maResults;
62 : public:
63 : DataSupplier( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
64 : const com::sun::star::uno::Reference< Content >& rContent, sal_Int32 nOpenMode );
65 : virtual ~DataSupplier();
66 :
67 : virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) SAL_OVERRIDE;
68 : virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >
69 : queryContentIdentifier( sal_uInt32 nIndex ) SAL_OVERRIDE;
70 : virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
71 : queryContent( sal_uInt32 nIndex ) SAL_OVERRIDE;
72 :
73 : virtual bool getResult( sal_uInt32 nIndex ) SAL_OVERRIDE;
74 :
75 : virtual sal_uInt32 totalCount() SAL_OVERRIDE;
76 : virtual sal_uInt32 currentCount() SAL_OVERRIDE;
77 : virtual bool isCountFinal() SAL_OVERRIDE;
78 :
79 : virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
80 : queryPropertyValues( sal_uInt32 nIndex ) SAL_OVERRIDE;
81 : virtual void releasePropertyValues( sal_uInt32 nIndex ) SAL_OVERRIDE;
82 :
83 : virtual void close() SAL_OVERRIDE;
84 :
85 : virtual void validate()
86 : throw( com::sun::star::ucb::ResultSetException ) SAL_OVERRIDE;
87 : };
88 :
89 : }
90 :
91 : #endif
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|