fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / ucb / source / ucp / ftp / ftpresultsetI.cxx
blob3bac7bb066e4cd8ebe6c41fe32f3dbcafec48f2e
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.compareToAscii("ContentType") == 0 )
64 xRow->appendString(seqProp[i],
65 OUString( "application/ftp" ));
66 else if(Name.compareToAscii("Title") == 0)
67 xRow->appendString(seqProp[i],dirvec[n].m_aName);
68 else if(Name.compareToAscii("IsReadOnly") == 0)
69 xRow->appendBoolean(seqProp[i],
70 sal_Bool(dirvec[n].m_nMode &
71 INETCOREFTP_FILEMODE_WRITE));
72 else if(Name.compareToAscii("IsDocument") == 0)
73 xRow->appendBoolean(seqProp[i],
74 ! sal_Bool(dirvec[n].m_nMode &
75 INETCOREFTP_FILEMODE_ISDIR));
76 else if(Name.compareToAscii("IsFolder") == 0)
77 xRow->appendBoolean(seqProp[i],
78 sal_Bool(dirvec[n].m_nMode &
79 INETCOREFTP_FILEMODE_ISDIR));
80 else if(Name.compareToAscii("Size") == 0)
81 xRow->appendLong(seqProp[i],
82 dirvec[n].m_nSize);
83 else if(Name.compareToAscii("DateCreated") == 0)
84 xRow->appendTimestamp(seqProp[i],
85 dirvec[n].m_aDate);
86 else if(Name.compareToAscii("CreatableContentsInfo") == 0)
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: */