Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "ucbhelper/propertyvalueset.hxx"
31 : : #include "rtl/ref.hxx"
32 : : #include "com/sun/star/ucb/Command.hpp"
33 : : #include "com/sun/star/ucb/XCommandEnvironment.hpp"
34 : : #include "com/sun/star/ucb/XCommandProcessor.hpp"
35 : : #include "com/sun/star/sdbc/XRow.hpp"
36 : : #include "ftpresultsetI.hxx"
37 : : #include "ftpcontent.hxx"
38 : :
39 : :
40 : : using namespace std;
41 : : using namespace ftp;
42 : : using namespace com::sun::star::ucb;
43 : : using namespace com::sun::star::lang;
44 : : using namespace com::sun::star::uno;
45 : : using namespace com::sun::star::beans;
46 : : using namespace com::sun::star::sdbc;
47 : :
48 : :
49 : 0 : ResultSetI::ResultSetI(const Reference<XMultiServiceFactory>& xMSF,
50 : : const Reference<XContentProvider>& xProvider,
51 : : sal_Int32 nOpenMode,
52 : : const Sequence<Property>& seqProp,
53 : : const Sequence< NumberedSortingInfo >& seqSort,
54 : : const std::vector<FTPDirentry>& dirvec)
55 : 0 : : ResultSetBase(xMSF,xProvider,nOpenMode,seqProp,seqSort)
56 : : {
57 [ # # ]: 0 : for( unsigned int i = 0; i < dirvec.size(); ++i)
58 [ # # ]: 0 : m_aPath.push_back(dirvec[i].m_aURL);
59 : :
60 : : // m_aIdents holds the contentidentifiers
61 : :
62 [ # # ]: 0 : m_aItems.resize( m_aPath.size() );
63 [ # # ]: 0 : m_aIdents.resize( m_aPath.size() );
64 : :
65 [ # # ]: 0 : for(unsigned n = 0; n < m_aItems.size(); ++n) {
66 : : rtl::Reference<ucbhelper::PropertyValueSet> xRow =
67 [ # # ]: 0 : new ucbhelper::PropertyValueSet(xMSF);
68 : :
69 [ # # ]: 0 : for( int i = 0; i < seqProp.getLength(); ++i) {
70 : 0 : const rtl::OUString& Name = seqProp[i].Name;
71 [ # # ]: 0 : if(Name.compareToAscii("ContentType") == 0 )
72 : 0 : xRow->appendString(seqProp[i],
73 [ # # ]: 0 : rtl::OUString( "application/ftp" ));
74 [ # # ]: 0 : else if(Name.compareToAscii("Title") == 0)
75 [ # # ]: 0 : xRow->appendString(seqProp[i],dirvec[n].m_aName);
76 [ # # ]: 0 : else if(Name.compareToAscii("IsReadOnly") == 0)
77 : 0 : xRow->appendBoolean(seqProp[i],
78 : 0 : sal_Bool(dirvec[n].m_nMode &
79 [ # # ]: 0 : INETCOREFTP_FILEMODE_WRITE));
80 [ # # ]: 0 : else if(Name.compareToAscii("IsDocument") == 0)
81 : 0 : xRow->appendBoolean(seqProp[i],
82 : 0 : ! sal_Bool(dirvec[n].m_nMode &
83 [ # # ]: 0 : INETCOREFTP_FILEMODE_ISDIR));
84 [ # # ]: 0 : else if(Name.compareToAscii("IsFolder") == 0)
85 : 0 : xRow->appendBoolean(seqProp[i],
86 : 0 : sal_Bool(dirvec[n].m_nMode &
87 [ # # ]: 0 : INETCOREFTP_FILEMODE_ISDIR));
88 [ # # ]: 0 : else if(Name.compareToAscii("Size") == 0)
89 : 0 : xRow->appendLong(seqProp[i],
90 [ # # ]: 0 : dirvec[n].m_nSize);
91 [ # # ]: 0 : else if(Name.compareToAscii("DateCreated") == 0)
92 : 0 : xRow->appendTimestamp(seqProp[i],
93 [ # # ]: 0 : dirvec[n].m_aDate);
94 [ # # ]: 0 : else if(Name.compareToAscii("CreatableContentsInfo") == 0)
95 : : xRow->appendObject(
96 : 0 : seqProp[i],
97 [ # # ]: 0 : makeAny(FTPContent::queryCreatableContentsInfo_Static()));
[ # # # # ]
[ # # ]
98 : : else
99 [ # # ]: 0 : xRow->appendVoid(seqProp[i]);
100 : : }
101 [ # # ][ # # ]: 0 : m_aItems[n] = Reference<XRow>(xRow.get());
[ # # ]
102 : 0 : }
103 : 0 : }
104 : :
105 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|