bump product version to 5.0.4.1
[LibreOffice.git] / ucb / source / ucp / ftp / ftpresultsetI.cxx
blob1bfcddc3a3e59e84017b37addbc137fcb9412148
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "comphelper/processfactory.hxx"
22 #include "ucbhelper/propertyvalueset.hxx"
23 #include "rtl/ref.hxx"
24 #include "com/sun/star/ucb/Command.hpp"
25 #include "com/sun/star/ucb/XCommandEnvironment.hpp"
26 #include "com/sun/star/ucb/XCommandProcessor.hpp"
27 #include "com/sun/star/sdbc/XRow.hpp"
28 #include "ftpresultsetI.hxx"
29 #include "ftpcontent.hxx"
32 using namespace std;
33 using namespace ftp;
34 using namespace com::sun::star::ucb;
35 using namespace com::sun::star::lang;
36 using namespace com::sun::star::uno;
37 using namespace com::sun::star::beans;
38 using namespace com::sun::star::sdbc;
41 ResultSetI::ResultSetI(const Reference<XComponentContext>& rxContext,
42 const Reference<XContentProvider>& xProvider,
43 sal_Int32 nOpenMode,
44 const Sequence<Property>& seqProp,
45 const Sequence< NumberedSortingInfo >& seqSort,
46 const std::vector<FTPDirentry>& dirvec)
47 : ResultSetBase(rxContext,xProvider,nOpenMode,seqProp,seqSort)
49 for( unsigned int i = 0; i < dirvec.size(); ++i)
50 m_aPath.push_back(dirvec[i].m_aURL);
52 // m_aIdents holds the contentidentifiers
54 m_aItems.resize( m_aPath.size() );
55 m_aIdents.resize( m_aPath.size() );
57 for(unsigned n = 0; n < m_aItems.size(); ++n) {
58 rtl::Reference<ucbhelper::PropertyValueSet> xRow =
59 new ucbhelper::PropertyValueSet(rxContext);
61 for( int i = 0; i < seqProp.getLength(); ++i) {
62 const OUString& Name = seqProp[i].Name;
63 if(Name == "ContentType")
64 xRow->appendString(seqProp[i],
65 OUString( "application/ftp" ));
66 else if(Name == "Title")
67 xRow->appendString(seqProp[i],dirvec[n].m_aName);
68 else if(Name == "IsReadOnly")
69 xRow->appendBoolean(seqProp[i],
70 (dirvec[n].m_nMode &
71 INETCOREFTP_FILEMODE_WRITE) == INETCOREFTP_FILEMODE_WRITE);
72 else if(Name == "IsDocument")
73 xRow->appendBoolean(seqProp[i],
74 (dirvec[n].m_nMode &
75 INETCOREFTP_FILEMODE_ISDIR) != INETCOREFTP_FILEMODE_ISDIR);
76 else if(Name == "IsFolder")
77 xRow->appendBoolean(seqProp[i],
78 ( dirvec[n].m_nMode &
79 INETCOREFTP_FILEMODE_ISDIR) == INETCOREFTP_FILEMODE_ISDIR);
80 else if(Name == "Size")
81 xRow->appendLong(seqProp[i],
82 dirvec[n].m_nSize);
83 else if(Name == "DateCreated")
84 xRow->appendTimestamp(seqProp[i],
85 dirvec[n].m_aDate);
86 else if(Name == "CreatableContentsInfo")
87 xRow->appendObject(
88 seqProp[i],
89 makeAny(FTPContent::queryCreatableContentsInfo_Static()));
90 else
91 xRow->appendVoid(seqProp[i]);
93 m_aItems[n] = Reference<XRow>(xRow.get());
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */