Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / ucb / source / ucp / cmis / cmis_content.hxx
blob7260cb38517ac4b3f2c7f111cfd4f963c43f72d1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * Version: MPL 1.1 / GPLv3+ / LGPLv3+
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License or as specified alternatively below. You may obtain a copy of
8 * the License at http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * Major Contributor(s):
16 * [ Copyright (C) 2011 SUSE <cbosdonnat@suse.com> (initial developer) ]
18 * All Rights Reserved.
20 * For minor contributions see the git repository.
22 * Alternatively, the contents of this file may be used under the terms of
23 * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 * instead of those above.
29 #ifndef CMIS_CONTENT_HXX
30 #define CMIS_CONTENT_HXX
32 #include "cmis_url.hxx"
33 #include "children_provider.hxx"
35 #include <com/sun/star/io/XInputStream.hpp>
36 #include <com/sun/star/io/XOutputStream.hpp>
37 #include <com/sun/star/ucb/CheckinArgument.hpp>
38 #include <com/sun/star/ucb/ContentCreationException.hpp>
39 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
40 #include <com/sun/star/ucb/TransferInfo.hpp>
41 #include <com/sun/star/ucb/XContentCreator.hpp>
42 #include <ucbhelper/contenthelper.hxx>
43 #include <libcmis/session-factory.hxx>
45 #include <list>
47 namespace com { namespace sun { namespace star {
48 namespace beans {
49 struct Property;
50 struct PropertyValue;
52 namespace sdbc {
53 class XRow;
55 }}}
56 namespace ucbhelper
58 class Content;
62 namespace cmis
65 #define CMIS_FILE_TYPE "application/vnd.libreoffice.cmis-file"
66 #define CMIS_FOLDER_TYPE "application/vnd.libreoffice.cmis-folder"
68 class ContentProvider;
69 class Content : public ::ucbhelper::ContentImplHelper,
70 public com::sun::star::ucb::XContentCreator,
71 public ChildrenProvider
73 private:
74 ContentProvider* m_pProvider;
75 libcmis::Session* m_pSession;
76 libcmis::ObjectPtr m_pObject;
77 rtl::OUString m_sObjectPath;
78 rtl::OUString m_sObjectId;
79 rtl::OUString m_sURL;
80 cmis::URL m_aURL;
82 // Members to be set for non-persistent content
83 bool m_bTransient;
84 bool m_bIsFolder;
85 libcmis::ObjectTypePtr m_pObjectType;
86 std::map< std::string, libcmis::PropertyPtr > m_pObjectProps;
88 bool isFolder( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
89 void setCmisProperty( std::string sName, std::string sValue,
90 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
92 com::sun::star::uno::Any getBadArgExcept();
94 com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
95 getPropertyValues(
96 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties,
97 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
99 libcmis::Session* getSession( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
100 libcmis::ObjectTypePtr getObjectType( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
102 private:
103 typedef rtl::Reference< Content > ContentRef;
104 typedef std::list< ContentRef > ContentRefList;
106 com::sun::star::uno::Any open(const com::sun::star::ucb::OpenCommandArgument2 & rArg,
107 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
108 throw( com::sun::star::uno::Exception );
110 void transfer( const com::sun::star::ucb::TransferInfo& rTransferInfo,
111 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
112 throw( com::sun::star::uno::Exception );
114 void insert( const com::sun::star::uno::Reference< com::sun::star::io::XInputStream > & xInputStream,
115 sal_Bool bReplaceExisting, const ::rtl::OUString & rMimeType,
116 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
117 throw( com::sun::star::uno::Exception );
119 rtl::OUString checkIn( const com::sun::star::ucb::CheckinArgument& rArg,
120 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
121 throw( com::sun::star::uno::Exception );
123 rtl::OUString checkOut( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
124 throw( com::sun::star::uno::Exception );
126 rtl::OUString cancelCheckOut( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
127 throw( com::sun::star::uno::Exception );
129 void destroy( ) throw( com::sun::star::uno::Exception );
131 void copyData( com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xIn,
132 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOut );
134 com::sun::star::uno::Sequence< com::sun::star::uno::Any >
135 setPropertyValues( const com::sun::star::uno::Sequence<
136 com::sun::star::beans::PropertyValue >& rValues,
137 const com::sun::star::uno::Reference<
138 com::sun::star::ucb::XCommandEnvironment >& xEnv );
140 sal_Bool feedSink( com::sun::star::uno::Reference< com::sun::star::uno::XInterface> aSink,
141 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
143 public:
144 Content( const com::sun::star::uno::Reference<
145 com::sun::star::uno::XComponentContext >& rxContext, ContentProvider *pProvider,
146 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier,
147 libcmis::ObjectPtr pObject = libcmis::ObjectPtr( ) )
148 throw ( com::sun::star::ucb::ContentCreationException );
150 Content( const com::sun::star::uno::Reference<
151 com::sun::star::uno::XComponentContext >& rxContext, ContentProvider *pProvider,
152 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier,
153 sal_Bool bIsFolder)
154 throw ( com::sun::star::ucb::ContentCreationException );
156 virtual ~Content();
158 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
159 getProperties( const com::sun::star::uno::Reference<
160 com::sun::star::ucb::XCommandEnvironment > & xEnv );
162 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
163 getCommands( const com::sun::star::uno::Reference<
164 com::sun::star::ucb::XCommandEnvironment > & xEnv );
166 virtual ::rtl::OUString getParentURL();
168 XINTERFACE_DECL()
170 XTYPEPROVIDER_DECL()
172 virtual ::rtl::OUString SAL_CALL
173 getImplementationName()
174 throw( com::sun::star::uno::RuntimeException );
176 virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
177 getSupportedServiceNames()
178 throw( com::sun::star::uno::RuntimeException );
180 virtual rtl::OUString SAL_CALL
181 getContentType()
182 throw( com::sun::star::uno::RuntimeException );
184 virtual com::sun::star::uno::Any SAL_CALL
185 execute( const com::sun::star::ucb::Command& aCommand,
186 sal_Int32 CommandId,
187 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment )
188 throw( com::sun::star::uno::Exception, com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::RuntimeException );
190 virtual void SAL_CALL abort( sal_Int32 CommandId )
191 throw( com::sun::star::uno::RuntimeException );
193 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
194 SAL_CALL queryCreatableContentsInfo()
195 throw( com::sun::star::uno::RuntimeException );
197 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
198 SAL_CALL createNewContent( const com::sun::star::ucb::ContentInfo& Info )
199 throw( com::sun::star::uno::RuntimeException );
201 com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
202 queryCreatableContentsInfo( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
203 throw( com::sun::star::uno::RuntimeException );
205 virtual std::list< com::sun::star::uno::Reference< com::sun::star::ucb::XContent > > getChildren( );
207 libcmis::ObjectPtr getObject( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw ( libcmis::Exception );
212 #endif
214 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */