1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
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"
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
;
49 ResultSetI::ResultSetI(const Reference
<XMultiServiceFactory
>& xMSF
,
50 const Reference
<XContentProvider
>& xProvider
,
52 const Sequence
<Property
>& seqProp
,
53 const Sequence
< NumberedSortingInfo
>& seqSort
,
54 const std::vector
<FTPDirentry
>& dirvec
)
55 : ResultSetBase(xMSF
,xProvider
,nOpenMode
,seqProp
,seqSort
)
57 for( unsigned int i
= 0; i
< dirvec
.size(); ++i
)
58 m_aPath
.push_back(dirvec
[i
].m_aURL
);
60 // m_aIdents holds the contentidentifiers
62 m_aItems
.resize( m_aPath
.size() );
63 m_aIdents
.resize( m_aPath
.size() );
65 for(unsigned n
= 0; n
< m_aItems
.size(); ++n
) {
66 rtl::Reference
<ucbhelper::PropertyValueSet
> xRow
=
67 new ucbhelper::PropertyValueSet(xMSF
);
69 for( int i
= 0; i
< seqProp
.getLength(); ++i
) {
70 const rtl::OUString
& Name
= seqProp
[i
].Name
;
71 if(Name
.compareToAscii("ContentType") == 0 )
72 xRow
->appendString(seqProp
[i
],
73 rtl::OUString( "application/ftp" ));
74 else if(Name
.compareToAscii("Title") == 0)
75 xRow
->appendString(seqProp
[i
],dirvec
[n
].m_aName
);
76 else if(Name
.compareToAscii("IsReadOnly") == 0)
77 xRow
->appendBoolean(seqProp
[i
],
78 sal_Bool(dirvec
[n
].m_nMode
&
79 INETCOREFTP_FILEMODE_WRITE
));
80 else if(Name
.compareToAscii("IsDocument") == 0)
81 xRow
->appendBoolean(seqProp
[i
],
82 ! sal_Bool(dirvec
[n
].m_nMode
&
83 INETCOREFTP_FILEMODE_ISDIR
));
84 else if(Name
.compareToAscii("IsFolder") == 0)
85 xRow
->appendBoolean(seqProp
[i
],
86 sal_Bool(dirvec
[n
].m_nMode
&
87 INETCOREFTP_FILEMODE_ISDIR
));
88 else if(Name
.compareToAscii("Size") == 0)
89 xRow
->appendLong(seqProp
[i
],
91 else if(Name
.compareToAscii("DateCreated") == 0)
92 xRow
->appendTimestamp(seqProp
[i
],
94 else if(Name
.compareToAscii("CreatableContentsInfo") == 0)
97 makeAny(FTPContent::queryCreatableContentsInfo_Static()));
99 xRow
->appendVoid(seqProp
[i
]);
101 m_aItems
[n
] = Reference
<XRow
>(xRow
.get());
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */