xref: /aoo41x/main/ucb/source/ucp/ftp/ftpcontent.hxx (revision cdf0e10c)
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 #ifndef _FTP_FTPCONTENT_HXX
29 #define _FTP_FTPCONTENT_HXX
30 
31 #include <ucbhelper/contenthelper.hxx>
32 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
33 #include <com/sun/star/ucb/XContentCreator.hpp>
34 #include "ftpurl.hxx"
35 
36 
37 namespace com { namespace sun { namespace star { namespace beans {
38     struct Property;
39     struct PropertyValue;
40 } } } }
41 
42 namespace com { namespace sun { namespace star { namespace sdbc {
43     class XRow;
44 } } } }
45 
46 
47 namespace ftp
48 {
49 
50 //=========================================================================
51 
52 // UNO service name for the content.
53 #define FTP_CONTENT_SERVICE_NAME "com.sun.star.ucb.FTPContent"
54 
55 //=========================================================================
56 
57     class FTPContentProvider;
58 
59 //=========================================================================
60 
61     class FTPContent
62         : public ::ucbhelper::ContentImplHelper,
63           public com::sun::star::ucb::XContentCreator
64     {
65     public:
66 
67         FTPContent( const ::com::sun::star::uno::Reference<
68                     ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
69                     FTPContentProvider* pProvider,
70                     const ::com::sun::star::uno::Reference<
71                     ::com::sun::star::ucb::XContentIdentifier >& Identifier,
72                     const FTPURL& FtpUrl);
73 
74         FTPContent( const ::com::sun::star::uno::Reference<
75                     ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
76                     FTPContentProvider* pProvider,
77                     const ::com::sun::star::uno::Reference<
78                     ::com::sun::star::ucb::XContentIdentifier >& Identifier,
79                     const com::sun::star::ucb::ContentInfo& aInfo);
80 
81 
82         virtual ~FTPContent();
83 
84         // XInterface
85         XINTERFACE_DECL()
86 
87         // XTypeProvider
88         XTYPEPROVIDER_DECL()
89 
90         // XServiceInfo
91         XSERVICEINFO_DECL()
92 
93         // XContent
94         virtual rtl::OUString SAL_CALL
95         getContentType()
96             throw( com::sun::star::uno::RuntimeException );
97 
98         // XCommandProcessor
99         virtual com::sun::star::uno::Any SAL_CALL
100         execute( const com::sun::star::ucb::Command& aCommand,
101                  sal_Int32 CommandId,
102                  const com::sun::star::uno::Reference<
103                  com::sun::star::ucb::XCommandEnvironment >& Environment )
104             throw( com::sun::star::uno::Exception,
105                    com::sun::star::ucb::CommandAbortedException,
106                    com::sun::star::uno::RuntimeException );
107 
108         virtual void SAL_CALL
109         abort(sal_Int32 CommandId)
110             throw( com::sun::star::uno::RuntimeException);
111 
112         // XContentCreator
113         virtual com::sun::star::uno::Sequence<
114         com::sun::star::ucb::ContentInfo > SAL_CALL
115         queryCreatableContentsInfo(  )
116             throw (com::sun::star::uno::RuntimeException);
117 
118         virtual com::sun::star::uno::Reference<
119         com::sun::star::ucb::XContent > SAL_CALL
120         createNewContent( const com::sun::star::ucb::ContentInfo& Info )
121             throw (com::sun::star::uno::RuntimeException);
122 
123         // XChild
124 
125         virtual ::com::sun::star::uno::Reference<
126         ::com::sun::star::uno::XInterface > SAL_CALL
127         getParent(  )
128             throw (::com::sun::star::uno::RuntimeException);
129 
130         virtual void SAL_CALL
131         setParent( const ::com::sun::star::uno::Reference<
132                    ::com::sun::star::uno::XInterface >& Parent )
133             throw (::com::sun::star::lang::NoSupportException,
134                    ::com::sun::star::uno::RuntimeException);
135 
136 
137         static com::sun::star::uno::Sequence<
138         com::sun::star::ucb::ContentInfo >
139         queryCreatableContentsInfo_Static(  )
140             throw (com::sun::star::uno::RuntimeException);
141 
142     private:
143 
144         FTPContentProvider *m_pFCP;
145         FTPURL              m_aFTPURL;
146         bool                m_bInserted;
147         bool                m_bTitleSet;
148         com::sun::star::ucb::ContentInfo m_aInfo;
149 
150         virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
151         getProperties( const com::sun::star::uno::Reference<
152                        com::sun::star::ucb::XCommandEnvironment > & xEnv );
153 
154 
155         virtual com::sun::star::uno::Sequence<
156         com::sun::star::ucb::CommandInfo>
157         getCommands(const com::sun::star::uno::Reference<
158                     com::sun::star::ucb::XCommandEnvironment > & xEnv);
159 
160 
161         virtual ::rtl::OUString getParentURL();
162 
163         com::sun::star::uno::Reference<com::sun::star::sdbc::XRow>
164         getPropertyValues(
165             const com::sun::star::uno::Sequence<
166             com::sun::star::beans::Property>& seqProp,
167             const com::sun::star::uno::Reference<
168             com::sun::star::ucb::XCommandEnvironment >& Environment
169         );
170 
171         com::sun::star::uno::Sequence<com::sun::star::uno::Any>
172         setPropertyValues(
173             const ::com::sun::star::uno::Sequence<
174             ::com::sun::star::beans::PropertyValue>& seqPropVal);
175 
176         void insert(const com::sun::star::ucb::InsertCommandArgument&,
177                     const com::sun::star::uno::Reference<
178                     com::sun::star::ucb::XCommandEnvironment>&);
179     };
180 
181 }
182 
183 #endif
184