1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_ucb.hxx"
26 
27 #include <com/sun/star/beans/Property.hpp>
28 #include <com/sun/star/beans/PropertyAttribute.hpp>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <com/sun/star/ucb/CommandInfo.hpp>
31 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
32 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
33 #include <com/sun/star/util/DateTime.hpp>
34 #include <com/sun/star/uno/Sequence.hxx>
35 
36 #include "ftpcontent.hxx"
37 
38 using namespace com::sun::star;
39 using namespace ftp;
40 
41 // virtual
getProperties(const uno::Reference<ucb::XCommandEnvironment> &)42 uno::Sequence< beans::Property > FTPContent::getProperties(
43     const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/)
44 {
45     #define PROPS_COUNT 8
46 
47     static const beans::Property aPropsInfoTable[] =
48     {
49         beans::Property(
50             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
51             -1,
52             getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
53             beans::PropertyAttribute::BOUND
54             | beans::PropertyAttribute::READONLY
55         ),
56         beans::Property(
57             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
58             -1,
59             getCppuBooleanType(),
60             beans::PropertyAttribute::BOUND
61             | beans::PropertyAttribute::READONLY
62         ),
63         beans::Property(
64             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
65             -1,
66             getCppuBooleanType(),
67             beans::PropertyAttribute::BOUND
68             | beans::PropertyAttribute::READONLY
69         ),
70         beans::Property(
71             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
72             -1,
73             getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
74             beans::PropertyAttribute::BOUND
75             //  | beans::PropertyAttribute::READONLY
76         ),
77         beans::Property(
78             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ),
79             -1,
80             getCppuType( static_cast< const sal_Int64 * >( 0 ) ),
81             beans::PropertyAttribute::BOUND
82             | beans::PropertyAttribute::READONLY
83         ),
84         beans::Property(
85             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ),
86             -1,
87             getCppuType( static_cast< util::DateTime * >( 0 ) ),
88             beans::PropertyAttribute::BOUND
89             | beans::PropertyAttribute::READONLY
90         ),
91         beans::Property(
92             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ),
93             -1,
94             getCppuBooleanType(),
95             beans::PropertyAttribute::BOUND
96             | beans::PropertyAttribute::READONLY
97         ),
98         beans::Property(
99             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
100                 "CreatableContentsInfo" ) ),
101             -1,
102             getCppuType(
103                 static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
104             beans::PropertyAttribute::BOUND
105             | beans::PropertyAttribute::READONLY
106         )
107     };
108 
109     return uno::Sequence< beans::Property >( aPropsInfoTable, PROPS_COUNT );
110 }
111 
112 //=========================================================================
113 // virtual
getCommands(const uno::Reference<ucb::XCommandEnvironment> &)114 uno::Sequence< ucb::CommandInfo > FTPContent::getCommands(
115     const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
116 {
117 // osl::MutexGuard aGuard( m_aMutex );
118 
119     //=================================================================
120     //
121     // Supported commands
122     //
123     //=================================================================
124 
125     #define COMMAND_COUNT 8
126 
127     static const ucb::CommandInfo aCommandInfoTable[] =
128     {
129         ///////////////////////////////////////////////////////////////
130         // Required commands
131         ///////////////////////////////////////////////////////////////
132         ucb::CommandInfo(
133             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
134             -1,
135             getCppuVoidType()
136         ),
137         ucb::CommandInfo(
138             rtl::OUString(
139                 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
140             -1,
141             getCppuVoidType()
142         ),
143         ucb::CommandInfo(
144             rtl::OUString(
145                 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
146             -1,
147             getCppuType(
148                 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
149         ),
150         ucb::CommandInfo(
151             rtl::OUString(
152                 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
153             -1,
154             getCppuType(
155                 static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
156         ),
157         ucb::CommandInfo(
158             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
159             -1,
160             getCppuType(
161                 static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
162         ),
163         ucb::CommandInfo(
164             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
165             -1,
166             getCppuType(
167                 static_cast< ucb::InsertCommandArgument * >( 0 ) )
168         ),
169         ucb::CommandInfo(
170             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
171             -1,
172             getCppuBooleanType()
173         ),
174         ucb::CommandInfo(
175             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
176             -1,
177             getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
178         )
179     };
180 
181     return uno::Sequence< ucb::CommandInfo >( aCommandInfoTable, COMMAND_COUNT );
182 }
183 
184