Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / cmis / cmis_content.hxx
blobe61a223b147ae3de08784078430420f8cd18ca1a
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"
34 #include <com/sun/star/io/XInputStream.hpp>
35 #include <com/sun/star/io/XOutputStream.hpp>
36 #include <com/sun/star/ucb/ContentCreationException.hpp>
37 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
38 #include <com/sun/star/ucb/TransferInfo.hpp>
39 #include <com/sun/star/ucb/XContentCreator.hpp>
40 #include <ucbhelper/contenthelper.hxx>
41 #include <libcmis/session-factory.hxx>
43 #include <list>
45 namespace com { namespace sun { namespace star {
46 namespace beans {
47 struct Property;
48 struct PropertyValue;
50 namespace sdbc {
51 class XRow;
53 }}}
54 namespace ucbhelper
56 class Content;
60 namespace cmis
63 #define CMIS_FILE_TYPE "application/vnd.sun.staroffice.cmis-file"
64 #define CMIS_FOLDER_TYPE "application/vnd.sun.staroffice.cmis-folder"
66 class ContentProvider;
67 class ContentProperties;
68 class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator
70 private:
71 ContentProvider* m_pProvider;
72 libcmis::Session* m_pSession;
73 libcmis::ObjectPtr m_pObject;
74 rtl::OUString m_sObjectPath;
75 rtl::OUString m_sObjectId;
76 rtl::OUString m_sURL;
77 rtl::OUString m_sBindingUrl;
79 // Members to be set for non-persistent content
80 bool m_bTransient;
81 libcmis::ObjectTypePtr m_pObjectType;
82 std::map< std::string, libcmis::PropertyPtr > m_pObjectProps;
84 bool isFolder(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv);
85 void setCmisProperty( std::string sName, std::string sValue );
87 com::sun::star::uno::Any getBadArgExcept();
89 com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
90 getPropertyValues(
91 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties,
92 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
94 bool exists( );
96 private:
97 typedef rtl::Reference< Content > ContentRef;
98 typedef std::list< ContentRef > ContentRefList;
100 void queryChildren( ContentRefList& rChildren );
102 com::sun::star::uno::Any open(const com::sun::star::ucb::OpenCommandArgument2 & rArg,
103 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
104 throw( com::sun::star::uno::Exception );
106 void transfer( const com::sun::star::ucb::TransferInfo& rTransferInfo,
107 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
108 throw( com::sun::star::uno::Exception );
110 void insert( const com::sun::star::uno::Reference< com::sun::star::io::XInputStream > & xInputStream,
111 sal_Bool bReplaceExisting, const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
112 throw( com::sun::star::uno::Exception );
114 void destroy( ) throw( com::sun::star::uno::Exception );
116 void copyData( com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xIn,
117 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOut );
119 com::sun::star::uno::Sequence< com::sun::star::uno::Any >
120 setPropertyValues( const com::sun::star::uno::Sequence<
121 com::sun::star::beans::PropertyValue >& rValues,
122 const com::sun::star::uno::Reference<
123 com::sun::star::ucb::XCommandEnvironment >& xEnv );
125 sal_Bool feedSink( com::sun::star::uno::Reference< com::sun::star::uno::XInterface> aSink,
126 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
128 sal_Bool exchangeIdentity(const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xNewId);
130 void resetAuthProvider( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
132 public:
133 Content( const com::sun::star::uno::Reference<
134 com::sun::star::lang::XMultiServiceFactory >& rxSMgr, ContentProvider *pProvider,
135 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier)
136 throw ( com::sun::star::ucb::ContentCreationException );
138 Content( const com::sun::star::uno::Reference<
139 com::sun::star::lang::XMultiServiceFactory >& rxSMgr, ContentProvider *pProvider,
140 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier,
141 sal_Bool bIsFolder)
142 throw ( com::sun::star::ucb::ContentCreationException );
144 virtual ~Content();
146 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
147 getProperties( const com::sun::star::uno::Reference<
148 com::sun::star::ucb::XCommandEnvironment > & xEnv );
150 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
151 getCommands( const com::sun::star::uno::Reference<
152 com::sun::star::ucb::XCommandEnvironment > & xEnv );
154 virtual ::rtl::OUString getParentURL();
156 XINTERFACE_DECL()
158 XTYPEPROVIDER_DECL()
160 virtual ::rtl::OUString SAL_CALL
161 getImplementationName()
162 throw( com::sun::star::uno::RuntimeException );
164 virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
165 getSupportedServiceNames()
166 throw( com::sun::star::uno::RuntimeException );
168 virtual rtl::OUString SAL_CALL
169 getContentType()
170 throw( com::sun::star::uno::RuntimeException );
172 virtual com::sun::star::uno::Any SAL_CALL
173 execute( const com::sun::star::ucb::Command& aCommand,
174 sal_Int32 CommandId,
175 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment )
176 throw( com::sun::star::uno::Exception, com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::RuntimeException );
178 virtual void SAL_CALL abort( sal_Int32 CommandId )
179 throw( com::sun::star::uno::RuntimeException );
181 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
182 SAL_CALL queryCreatableContentsInfo()
183 throw( com::sun::star::uno::RuntimeException );
185 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
186 SAL_CALL createNewContent( const com::sun::star::ucb::ContentInfo& Info )
187 throw( com::sun::star::uno::RuntimeException );
189 com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
190 queryCreatableContentsInfo( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
191 throw( com::sun::star::uno::RuntimeException );
193 libcmis::ObjectPtr getObject( ) throw ( libcmis::Exception );
198 #endif
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */