LibreOffice Module ucb (master) 1
cmis_content.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
10#pragma once
11
12#include <sal/config.h>
13
14#include <string_view>
15
16#include "cmis_url.hxx"
17#include "children_provider.hxx"
18
19#include <com/sun/star/io/XInputStream.hpp>
20#include <com/sun/star/io/XOutputStream.hpp>
21#include <com/sun/star/ucb/CheckinArgument.hpp>
22#include <com/sun/star/ucb/CommandFailedException.hpp>
23#include <com/sun/star/ucb/ContentCreationException.hpp>
24#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
25#include <com/sun/star/ucb/TransferInfo.hpp>
26#include <com/sun/star/ucb/XContentCreator.hpp>
27#include <com/sun/star/document/CmisVersion.hpp>
29
30#if defined __GNUC__ && !defined __clang__
31#pragma GCC diagnostic push
32#pragma GCC diagnostic ignored "-Wdeprecated"
33#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
34#endif
35#include <libcmis/libcmis.hxx>
36#if defined __GNUC__ && !defined __clang__
37#pragma GCC diagnostic pop
38#endif
39
40namespace com::sun::star {
41 namespace beans {
42 struct Property;
43 struct PropertyValue;
44 }
45 namespace sdbc {
46 class XRow;
47 }
48}
49namespace ucbhelper
50{
51 class Content;
52}
53
54
55namespace cmis
56{
57
58inline constexpr OUStringLiteral CMIS_FILE_TYPE = u"application/vnd.libreoffice.cmis-file";
59inline constexpr OUStringLiteral CMIS_FOLDER_TYPE = u"application/vnd.libreoffice.cmis-folder";
60
61class ContentProvider;
63 public css::ucb::XContentCreator,
64 public ChildrenProvider
65{
66private:
68 libcmis::Session* m_pSession;
69 libcmis::ObjectPtr m_pObject;
70 OUString m_sObjectPath;
71 OUString m_sObjectId;
72 OUString m_sURL;
74
75 // Members to be set for non-persistent content
78 libcmis::ObjectTypePtr m_pObjectType;
79 std::map< std::string, libcmis::PropertyPtr > m_pObjectProps;
80
81 bool isFolder( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
82 void setCmisProperty(const std::string& rName, const std::string& rValue,
83 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
84
85 css::uno::Any getBadArgExcept();
86
87 css::uno::Reference< css::sdbc::XRow >
89 const css::uno::Sequence< css::beans::Property >& rProperties,
90 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
91
92 libcmis::Session* getSession( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
93 libcmis::ObjectTypePtr const & getObjectType( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
94
95private:
97 typedef std::vector< ContentRef > ContentRefList;
98
101 css::uno::Any open(const css::ucb::OpenCommandArgument2 & rArg,
102 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
103
105 void transfer( const css::ucb::TransferInfo& rTransferInfo,
106 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
107
109 void insert( const css::uno::Reference< css::io::XInputStream > & xInputStream,
110 bool bReplaceExisting, std::u16string_view rMimeType,
111 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
112
114 OUString checkIn( const css::ucb::CheckinArgument& rArg,
115 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
116
118 OUString checkOut( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
119
121 OUString cancelCheckOut( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
122
123 static void copyData( const css::uno::Reference< css::io::XInputStream >& xIn,
124 const css::uno::Reference< css::io::XOutputStream >& xOut );
125
126 css::uno::Sequence< css::uno::Any >
127 setPropertyValues( const css::uno::Sequence< css::beans::PropertyValue >& rValues,
128 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
129
131 css::uno::Sequence< css::document::CmisVersion >
132 getAllVersions( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
133
134 bool feedSink( const css::uno::Reference< css::uno::XInterface>& aSink,
135 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
136
137public:
139 Content( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
140 ContentProvider *pProvider,
141 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier,
142 libcmis::ObjectPtr pObject = libcmis::ObjectPtr( ) );
143
145 Content( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
146 ContentProvider *pProvider,
147 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier,
148 bool bIsFolder);
149
150 virtual ~Content() override;
151
152 virtual css::uno::Sequence< css::beans::Property >
153 getProperties( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) override;
154
155 libcmis::ObjectPtr updateProperties(
156 const css::uno::Any& iCmisProps,
157 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv);
158
159 virtual css::uno::Sequence< css::ucb::CommandInfo >
160 getCommands( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) override;
161
162 virtual OUString getParentURL() override;
163
164 // XInterface
165 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
166 virtual void SAL_CALL acquire()
167 noexcept override;
168 virtual void SAL_CALL release()
169 noexcept override;
170
171 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
172 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
173
174 virtual OUString SAL_CALL
175 getImplementationName() override;
176
177 virtual css::uno::Sequence< OUString > SAL_CALL
178 getSupportedServiceNames() override;
179
180 virtual OUString SAL_CALL
181 getContentType() override;
182
183 virtual css::uno::Any SAL_CALL
184 execute( const css::ucb::Command& aCommand,
185 sal_Int32 CommandId,
186 const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ) override;
187
188 virtual void SAL_CALL abort( sal_Int32 CommandId ) override;
189
190 virtual css::uno::Sequence< css::ucb::ContentInfo >
191 SAL_CALL queryCreatableContentsInfo() override;
192
193 virtual css::uno::Reference< css::ucb::XContent >
194 SAL_CALL createNewContent( const css::ucb::ContentInfo& Info ) override;
195
197 css::uno::Sequence< css::ucb::ContentInfo >
198 queryCreatableContentsInfo( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
199
200 virtual std::vector< css::uno::Reference< css::ucb::XContent > > getChildren( ) override;
201
205 libcmis::ObjectPtr const & getObject( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
206};
207
208}
209
210/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void transfer(const css::ucb::TransferInfo &rTransferInfo, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
bool feedSink(const css::uno::Reference< css::uno::XInterface > &aSink, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
void insert(const css::uno::Reference< css::io::XInputStream > &xInputStream, bool bReplaceExisting, std::u16string_view rMimeType, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
virtual css::uno::Sequence< css::ucb::CommandInfo > getCommands(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv) override
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL createNewContent(const css::ucb::ContentInfo &Info) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
OUString checkIn(const css::ucb::CheckinArgument &rArg, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
css::uno::Sequence< css::document::CmisVersion > getAllVersions(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
virtual std::vector< css::uno::Reference< css::ucb::XContent > > getChildren() override
virtual void SAL_CALL acquire() noexcept override
virtual ~Content() override
virtual OUString SAL_CALL getContentType() override
cmis::URL m_aURL
libcmis::ObjectPtr m_pObject
virtual css::uno::Sequence< css::ucb::ContentInfo > SAL_CALL queryCreatableContentsInfo() override
libcmis::ObjectTypePtr const & getObjectType(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
std::vector< ContentRef > ContentRefList
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Any SAL_CALL execute(const css::ucb::Command &aCommand, sal_Int32 CommandId, const css::uno::Reference< css::ucb::XCommandEnvironment > &Environment) override
OUString m_sObjectPath
virtual void SAL_CALL abort(sal_Int32 CommandId) override
void setCmisProperty(const std::string &rName, const std::string &rValue, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
libcmis::ObjectPtr updateProperties(const css::uno::Any &iCmisProps, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
std::map< std::string, libcmis::PropertyPtr > m_pObjectProps
ContentProvider * m_pProvider
OUString m_sURL
OUString m_sObjectId
libcmis::Session * m_pSession
css::uno::Any getBadArgExcept()
libcmis::ObjectTypePtr m_pObjectType
libcmis::Session * getSession(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
css::uno::Sequence< css::uno::Any > setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue > &rValues, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
css::uno::Any open(const css::ucb::OpenCommandArgument2 &rArg, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
css::uno::Reference< css::sdbc::XRow > getPropertyValues(const css::uno::Sequence< css::beans::Property > &rProperties, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
virtual void SAL_CALL release() noexcept override
Content(const css::uno::Reference< css::uno::XComponentContext > &rxContext, ContentProvider *pProvider, const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier, bool bIsFolder)
libcmis::ObjectPtr const & getObject(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
static void copyData(const css::uno::Reference< css::io::XInputStream > &xIn, const css::uno::Reference< css::io::XOutputStream > &xOut)
rtl::Reference< Content > ContentRef
OUString checkOut(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
OUString cancelCheckOut(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
bool isFolder(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
Content(const css::uno::Reference< css::uno::XComponentContext > &rxContext, ContentProvider *pProvider, const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier, libcmis::ObjectPtr pObject=libcmis::ObjectPtr())
virtual OUString getParentURL() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Sequence< css::beans::Property > getProperties(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
float u
constexpr OUStringLiteral CMIS_FOLDER_TYPE
constexpr OUStringLiteral CMIS_FILE_TYPE
Type
signed char sal_Int8