Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / ucb / source / ucp / cmis / cmis_content.hxx
blobf7430bdcf0f10c4669fcc825f209b111aa1216b6
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/.
8 */
10 #ifndef INCLUDED_UCB_SOURCE_UCP_CMIS_CMIS_CONTENT_HXX
11 #define INCLUDED_UCB_SOURCE_UCP_CMIS_CMIS_CONTENT_HXX
13 #include "cmis_url.hxx"
14 #include "children_provider.hxx"
16 #include <com/sun/star/io/XInputStream.hpp>
17 #include <com/sun/star/io/XOutputStream.hpp>
18 #include <com/sun/star/ucb/CheckinArgument.hpp>
19 #include <com/sun/star/ucb/ContentCreationException.hpp>
20 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
21 #include <com/sun/star/ucb/TransferInfo.hpp>
22 #include <com/sun/star/ucb/XContentCreator.hpp>
23 #include <com/sun/star/document/CmisVersion.hpp>
24 #include <ucbhelper/contenthelper.hxx>
25 #include <libcmis/libcmis.hxx>
27 #include <list>
29 namespace com { namespace sun { namespace star {
30 namespace beans {
31 struct Property;
32 struct PropertyValue;
34 namespace sdbc {
35 class XRow;
37 }}}
38 namespace ucbhelper
40 class Content;
44 namespace cmis
47 #define CMIS_FILE_TYPE "application/vnd.libreoffice.cmis-file"
48 #define CMIS_FOLDER_TYPE "application/vnd.libreoffice.cmis-folder"
50 class ContentProvider;
51 class Content : public ::ucbhelper::ContentImplHelper,
52 public com::sun::star::ucb::XContentCreator,
53 public ChildrenProvider
55 private:
56 ContentProvider* m_pProvider;
57 libcmis::Session* m_pSession;
58 libcmis::ObjectPtr m_pObject;
59 OUString m_sObjectPath;
60 OUString m_sObjectId;
61 OUString m_sURL;
62 cmis::URL m_aURL;
64 // Members to be set for non-persistent content
65 bool m_bTransient;
66 bool m_bIsFolder;
67 libcmis::ObjectTypePtr m_pObjectType;
68 std::map< std::string, libcmis::PropertyPtr > m_pObjectProps;
70 bool isFolder( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
71 void setCmisProperty( std::string sName, std::string sValue,
72 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
74 com::sun::star::uno::Any getBadArgExcept();
76 com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
77 getPropertyValues(
78 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties,
79 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
81 libcmis::Session* getSession( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
82 libcmis::ObjectTypePtr getObjectType( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
84 private:
85 typedef rtl::Reference< Content > ContentRef;
86 typedef std::list< ContentRef > ContentRefList;
88 com::sun::star::uno::Any open(const com::sun::star::ucb::OpenCommandArgument2 & rArg,
89 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
90 throw( com::sun::star::uno::Exception );
92 void transfer( const com::sun::star::ucb::TransferInfo& rTransferInfo,
93 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
94 throw( com::sun::star::uno::Exception );
96 void insert( const com::sun::star::uno::Reference< com::sun::star::io::XInputStream > & xInputStream,
97 bool bReplaceExisting, const OUString & rMimeType,
98 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
99 throw( com::sun::star::uno::Exception );
101 OUString checkIn( const com::sun::star::ucb::CheckinArgument& rArg,
102 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
103 throw( com::sun::star::uno::Exception );
105 OUString checkOut( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
106 throw( com::sun::star::uno::Exception );
108 OUString cancelCheckOut( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
109 throw( com::sun::star::uno::Exception );
111 void destroy( ) throw( com::sun::star::uno::Exception );
113 void copyData( com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xIn,
114 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOut );
116 com::sun::star::uno::Sequence< com::sun::star::uno::Any >
117 setPropertyValues( const com::sun::star::uno::Sequence<
118 com::sun::star::beans::PropertyValue >& rValues,
119 const com::sun::star::uno::Reference<
120 com::sun::star::ucb::XCommandEnvironment >& xEnv );
122 com::sun::star::uno::Sequence< com::sun::star::document::CmisVersion >
123 getAllVersions( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
124 throw(com::sun::star::uno::Exception,
125 std::exception);
127 bool feedSink( com::sun::star::uno::Reference< com::sun::star::uno::XInterface> aSink,
128 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
130 public:
131 Content( const com::sun::star::uno::Reference<
132 com::sun::star::uno::XComponentContext >& rxContext, ContentProvider *pProvider,
133 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier,
134 libcmis::ObjectPtr pObject = libcmis::ObjectPtr( ) )
135 throw ( com::sun::star::ucb::ContentCreationException );
137 Content( const com::sun::star::uno::Reference<
138 com::sun::star::uno::XComponentContext >& rxContext, ContentProvider *pProvider,
139 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier,
140 bool bIsFolder)
141 throw ( com::sun::star::ucb::ContentCreationException );
143 virtual ~Content();
145 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
146 getProperties( const com::sun::star::uno::Reference<
147 com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
149 virtual libcmis::ObjectPtr updateProperties(
150 const com::sun::star::uno::Any& iCmisProps,
151 const com::sun::star::uno::Reference<
152 com::sun::star::ucb::XCommandEnvironment > & xEnv);
154 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
155 getCommands( const com::sun::star::uno::Reference<
156 com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
158 virtual OUString getParentURL() SAL_OVERRIDE;
160 // XInterface
161 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
162 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
163 virtual void SAL_CALL acquire()
164 throw() SAL_OVERRIDE;
165 virtual void SAL_CALL release()
166 throw() SAL_OVERRIDE;
168 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
169 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
170 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
171 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
173 virtual OUString SAL_CALL
174 getImplementationName()
175 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
177 virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
178 getSupportedServiceNames()
179 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
181 virtual OUString SAL_CALL
182 getContentType()
183 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
185 virtual com::sun::star::uno::Any SAL_CALL
186 execute( const com::sun::star::ucb::Command& aCommand,
187 sal_Int32 CommandId,
188 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment )
189 throw( com::sun::star::uno::Exception, com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
191 virtual void SAL_CALL abort( sal_Int32 CommandId )
192 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
194 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
195 SAL_CALL queryCreatableContentsInfo()
196 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
198 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
199 SAL_CALL createNewContent( const com::sun::star::ucb::ContentInfo& Info )
200 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
202 com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
203 queryCreatableContentsInfo( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
204 throw( com::sun::star::uno::RuntimeException );
206 virtual std::list< com::sun::star::uno::Reference< com::sun::star::ucb::XContent > > getChildren( ) SAL_OVERRIDE;
208 libcmis::ObjectPtr getObject( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw ( libcmis::Exception );
213 #endif
215 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */