1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef GIO_DATASUPPLIER_HXX 29 #define GIO_DATASUPPLIER_HXX 30 31 #include <ucbhelper/resultset.hxx> 32 #include "gio_content.hxx" 33 #include <vector> 34 35 namespace gio 36 { 37 38 class Content; 39 40 struct ResultListEntry 41 { 42 ::rtl::OUString aId; 43 com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > xId; 44 com::sun::star::uno::Reference< com::sun::star::ucb::XContent > xContent; 45 com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > xRow; 46 GFileInfo *pInfo; 47 48 ResultListEntry( GFileInfo *pInInfo ) : pInfo(pInInfo) 49 { 50 g_object_ref( pInfo ); 51 } 52 53 ~ResultListEntry() 54 { 55 g_object_unref( pInfo ); 56 } 57 }; 58 59 typedef std::vector< ResultListEntry* > ResultList; 60 61 class DataSupplier : public ucbhelper::ResultSetDataSupplier 62 { 63 private: 64 com::sun::star::uno::Reference< ::gio::Content > mxContent; 65 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xSMgr; 66 sal_Int32 mnOpenMode; 67 bool mbCountFinal; 68 bool getData(); 69 ResultList maResults; 70 public: 71 DataSupplier( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSMgr, 72 const com::sun::star::uno::Reference< Content >& rContent, sal_Int32 nOpenMode ); 73 virtual ~DataSupplier(); 74 75 virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex ); 76 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > 77 queryContentIdentifier( sal_uInt32 nIndex ); 78 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > 79 queryContent( sal_uInt32 nIndex ); 80 81 virtual sal_Bool getResult( sal_uInt32 nIndex ); 82 83 virtual sal_uInt32 totalCount(); 84 virtual sal_uInt32 currentCount(); 85 virtual sal_Bool isCountFinal(); 86 87 virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > 88 queryPropertyValues( sal_uInt32 nIndex ); 89 virtual void releasePropertyValues( sal_uInt32 nIndex ); 90 91 virtual void close(); 92 93 virtual void validate() 94 throw( com::sun::star::ucb::ResultSetException ); 95 }; 96 97 } 98 99 #endif 100