1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_ucb.hxx"
30 
31 #include <com/sun/star/beans/Property.hpp>
32 #include <com/sun/star/beans/PropertyAttribute.hpp>
33 #include <com/sun/star/beans/PropertyValue.hpp>
34 #include <com/sun/star/ucb/CommandInfo.hpp>
35 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
36 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
37 #include <com/sun/star/util/DateTime.hpp>
38 #include <com/sun/star/uno/Sequence.hxx>
39 
40 #include "ftpcontent.hxx"
41 
42 using namespace com::sun::star;
43 using namespace ftp;
44 
45 // virtual
46 uno::Sequence< beans::Property > FTPContent::getProperties(
47     const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/)
48 {
49     #define PROPS_COUNT 8
50 
51     static const beans::Property aPropsInfoTable[] =
52     {
53         beans::Property(
54             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
55             -1,
56             getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
57             beans::PropertyAttribute::BOUND
58             | beans::PropertyAttribute::READONLY
59         ),
60         beans::Property(
61             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
62             -1,
63             getCppuBooleanType(),
64             beans::PropertyAttribute::BOUND
65             | beans::PropertyAttribute::READONLY
66         ),
67         beans::Property(
68             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
69             -1,
70             getCppuBooleanType(),
71             beans::PropertyAttribute::BOUND
72             | beans::PropertyAttribute::READONLY
73         ),
74         beans::Property(
75             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
76             -1,
77             getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
78             beans::PropertyAttribute::BOUND
79             //  | beans::PropertyAttribute::READONLY
80         ),
81         beans::Property(
82             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ),
83             -1,
84             getCppuType( static_cast< const sal_Int64 * >( 0 ) ),
85             beans::PropertyAttribute::BOUND
86             | beans::PropertyAttribute::READONLY
87         ),
88         beans::Property(
89             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ),
90             -1,
91             getCppuType( static_cast< util::DateTime * >( 0 ) ),
92             beans::PropertyAttribute::BOUND
93             | beans::PropertyAttribute::READONLY
94         ),
95         beans::Property(
96             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ),
97             -1,
98             getCppuBooleanType(),
99             beans::PropertyAttribute::BOUND
100             | beans::PropertyAttribute::READONLY
101         ),
102         beans::Property(
103             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
104                 "CreatableContentsInfo" ) ),
105             -1,
106             getCppuType(
107                 static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
108             beans::PropertyAttribute::BOUND
109             | beans::PropertyAttribute::READONLY
110         )
111     };
112 
113     return uno::Sequence< beans::Property >( aPropsInfoTable, PROPS_COUNT );
114 }
115 
116 //=========================================================================
117 // virtual
118 uno::Sequence< ucb::CommandInfo > FTPContent::getCommands(
119     const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
120 {
121 // osl::MutexGuard aGuard( m_aMutex );
122 
123     //=================================================================
124     //
125     // Supported commands
126     //
127     //=================================================================
128 
129     #define COMMAND_COUNT 8
130 
131     static const ucb::CommandInfo aCommandInfoTable[] =
132     {
133         ///////////////////////////////////////////////////////////////
134         // Required commands
135         ///////////////////////////////////////////////////////////////
136         ucb::CommandInfo(
137             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
138             -1,
139             getCppuVoidType()
140         ),
141         ucb::CommandInfo(
142             rtl::OUString(
143                 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
144             -1,
145             getCppuVoidType()
146         ),
147         ucb::CommandInfo(
148             rtl::OUString(
149                 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
150             -1,
151             getCppuType(
152                 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
153         ),
154         ucb::CommandInfo(
155             rtl::OUString(
156                 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
157             -1,
158             getCppuType(
159                 static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
160         ),
161         ucb::CommandInfo(
162             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
163             -1,
164             getCppuType(
165                 static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
166         ),
167         ucb::CommandInfo(
168             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
169             -1,
170             getCppuType(
171                 static_cast< ucb::InsertCommandArgument * >( 0 ) )
172         ),
173         ucb::CommandInfo(
174             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
175             -1,
176             getCppuBooleanType()
177         ),
178         ucb::CommandInfo(
179             rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
180             -1,
181             getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
182         )
183     };
184 
185     return uno::Sequence< ucb::CommandInfo >( aCommandInfoTable, COMMAND_COUNT );
186 }
187 
188