tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / ucb / source / ucp / cmis / cmis_content.hxx
blob7c2938c65b64b35822a9e3035e10de6aecc0350b
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 #pragma once
12 #include <sal/config.h>
14 #include <string_view>
16 #include "cmis_url.hxx"
17 #include "children_provider.hxx"
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>
28 #include <ucbhelper/contenthelper.hxx>
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
40 namespace com::sun::star {
41 namespace beans {
42 struct Property;
43 struct PropertyValue;
45 namespace sdbc {
46 class XRow;
49 namespace ucbhelper
51 class Content;
55 namespace cmis
58 inline constexpr OUString CMIS_FILE_TYPE = u"application/vnd.libreoffice.cmis-file"_ustr;
59 inline constexpr OUString CMIS_FOLDER_TYPE = u"application/vnd.libreoffice.cmis-folder"_ustr;
61 class ContentProvider;
62 class Content : public ::ucbhelper::ContentImplHelper,
63 public css::ucb::XContentCreator,
64 public ChildrenProvider
66 private:
67 ContentProvider* m_pProvider;
68 libcmis::Session* m_pSession;
69 libcmis::ObjectPtr m_pObject;
70 OUString m_sObjectPath;
71 OUString m_sObjectId;
72 OUString m_sURL;
73 cmis::URL m_aURL;
75 // Members to be set for non-persistent content
76 bool m_bTransient;
77 bool m_bIsFolder;
78 libcmis::ObjectTypePtr m_pObjectType;
79 std::map< std::string, libcmis::PropertyPtr > m_pObjectProps;
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 );
85 css::uno::Any getBadArgExcept();
87 css::uno::Reference< css::sdbc::XRow >
88 getPropertyValues(
89 const css::uno::Sequence< css::beans::Property >& rProperties,
90 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
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 );
95 private:
96 typedef rtl::Reference< Content > ContentRef;
97 typedef std::vector< ContentRef > ContentRefList;
99 /// @throws css::uno::Exception
100 /// @throws libcmis::Exception
101 css::uno::Any open(const css::ucb::OpenCommandArgument2 & rArg,
102 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
104 /// @throws css::uno::Exception
105 void transfer( const css::ucb::TransferInfo& rTransferInfo,
106 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
108 /// @throws css::uno::Exception
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 );
113 /// @throws css::uno::Exception
114 OUString checkIn( const css::ucb::CheckinArgument& rArg,
115 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
117 /// @throws css::uno::Exception
118 OUString checkOut( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
120 /// @throws css::uno::Exception
121 OUString cancelCheckOut( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
123 static void copyData( const css::uno::Reference< css::io::XInputStream >& xIn,
124 const css::uno::Reference< css::io::XOutputStream >& xOut );
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 );
130 /// @throws css::uno::Exception
131 css::uno::Sequence< css::document::CmisVersion >
132 getAllVersions( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
134 bool feedSink( const css::uno::Reference< css::uno::XInterface>& aSink,
135 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
137 public:
138 /// @throws css::ucb::ContentCreationException
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( ) );
144 /// @throws css::ucb::ContentCreationException
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);
150 virtual ~Content() override;
152 virtual css::uno::Sequence< css::beans::Property >
153 getProperties( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) override;
155 libcmis::ObjectPtr updateProperties(
156 const css::uno::Any& iCmisProps,
157 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv);
159 virtual css::uno::Sequence< css::ucb::CommandInfo >
160 getCommands( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) override;
162 virtual OUString getParentURL() override;
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;
171 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
172 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
174 virtual OUString SAL_CALL
175 getImplementationName() override;
177 virtual css::uno::Sequence< OUString > SAL_CALL
178 getSupportedServiceNames() override;
180 virtual OUString SAL_CALL
181 getContentType() override;
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;
188 virtual void SAL_CALL abort( sal_Int32 CommandId ) override;
190 virtual css::uno::Sequence< css::ucb::ContentInfo >
191 SAL_CALL queryCreatableContentsInfo() override;
193 virtual css::uno::Reference< css::ucb::XContent >
194 SAL_CALL createNewContent( const css::ucb::ContentInfo& Info ) override;
196 /// @throws css::uno::RuntimeException
197 css::uno::Sequence< css::ucb::ContentInfo >
198 queryCreatableContentsInfo( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
200 virtual std::vector< css::uno::Reference< css::ucb::XContent > > getChildren( ) override;
202 /// @throws css::uno::RuntimeException
203 /// @throws css::ucb::CommandFailedException
204 /// @throws libcmis::Exception
205 libcmis::ObjectPtr const & getObject( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */