LibreOffice Module ucbhelper (master) 1
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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef INCLUDED_UCBHELPER_CONTENT_HXX
20#define INCLUDED_UCBHELPER_CONTENT_HXX
21
22#include <rtl/ref.hxx>
23#include <com/sun/star/uno/Reference.h>
24#include <com/sun/star/uno/Sequence.h>
26
28{
29class XPropertySetInfo;
30}
31
32namespace com::sun::star::io
33{
34class XActiveDataSink;
35class XOutputStream;
36class XInputStream;
37class XStream;
38}
39
41{
42class XResultSet;
43class XRow;
44}
45
46namespace com::sun::star::ucb
47{
48class XCommandEnvironment;
49class XCommandInfo;
50class XContent;
51class XDynamicResultSet;
52class XAnyCompareFactory;
53struct ContentInfo;
54struct NumberedSortingInfo;
55}
56
57namespace com::sun::star::uno
58{
59class XComponentContext;
60}
61
62namespace com::sun::star::uno
63{
64class Any;
65}
66
67namespace ucbhelper
68{
74{
78};
79
85{
86 Copy, // copy source data
87 Move, // move source data
88 Checkin // check-in source data
89};
90
91class Content_Impl;
92
99{
101
105 css::uno::Any createCursorAny(const css::uno::Sequence<OUString>& rPropertyNames,
106 ResultSetInclude eMode);
107
108public:
112 Content();
113
125 Content(const OUString& rURL, const css::uno::Reference<css::ucb::XCommandEnvironment>& rEnv,
126 const css::uno::Reference<css::uno::XComponentContext>& rCtx);
138 Content(const css::uno::Reference<css::ucb::XContent>& rContent,
139 const css::uno::Reference<css::ucb::XCommandEnvironment>& rEnv,
140 const css::uno::Reference<css::uno::XComponentContext>& rCtx);
146 Content(const Content& rOther);
147
151 Content(Content&& rOther) noexcept;
152
156 ~Content();
157
163 Content& operator=(const Content& rOther);
164
168 Content& operator=(Content&& rOther) noexcept;
169
183 static bool create(const OUString& rURL,
184 const css::uno::Reference<css::ucb::XCommandEnvironment>& rEnv,
185 const css::uno::Reference<css::uno::XComponentContext>& rCtx,
186 Content& rContent);
187
188 // Direct access to UCB content.
189
199 css::uno::Reference<css::ucb::XContent> get() const;
200
201 // Object identity.
202
208 const OUString& getURL() const;
209
210 // Command environment.
211
217 const css::uno::Reference<css::ucb::XCommandEnvironment>& getCommandEnvironment() const;
218
224 void setCommandEnvironment(const css::uno::Reference<css::ucb::XCommandEnvironment>& xNewEnv);
225
226 // Access to supported commands/properties.
227
238 css::uno::Reference<css::ucb::XCommandInfo> getCommands();
249 css::uno::Reference<css::beans::XPropertySetInfo> getProperties();
250
251 // Access to property value(s).
252
263 css::uno::Any getPropertyValue(const OUString& rPropertyName);
291 css::uno::Any setPropertyValue(const OUString& rPropertyName, const css::uno::Any& rValue);
302 css::uno::Sequence<css::uno::Any>
303 getPropertyValues(const css::uno::Sequence<OUString>& rPropertyNames);
314 css::uno::Reference<css::sdbc::XRow>
315 getPropertyValuesInterface(const css::uno::Sequence<OUString>& rPropertyNames);
316
350 css::uno::Sequence<css::uno::Any>
351 setPropertyValues(const css::uno::Sequence<OUString>& rPropertyNames,
352 const css::uno::Sequence<css::uno::Any>& rValues);
353
354 // General command execution.
355
369 css::uno::Any executeCommand(const OUString& rCommandName,
370 const css::uno::Any& rCommandArgument);
371
372 // Special commands.
373
392 css::uno::Reference<css::sdbc::XResultSet>
393 createCursor(const css::uno::Sequence<OUString>& rPropertyNames,
413 css::uno::Reference<css::ucb::XDynamicResultSet>
414 createDynamicCursor(const css::uno::Sequence<OUString>& rPropertyNames,
416
420 css::uno::Reference<css::sdbc::XResultSet>
421 createSortedCursor(const css::uno::Sequence<OUString>& rPropertyNames,
422 const css::uno::Sequence<css::ucb::NumberedSortingInfo>& rSortInfo,
423 const css::uno::Reference<css::ucb::XAnyCompareFactory>& rAnyCompareFactory,
425
437 css::uno::Reference<css::io::XInputStream> openStream();
450 css::uno::Reference<css::io::XInputStream> openStreamNoLock();
451
463 css::uno::Reference<css::io::XStream> openWriteableStream();
476 css::uno::Reference<css::io::XStream> openWriteableStreamNoLock();
477
489 bool openStream(const css::uno::Reference<css::io::XActiveDataSink>& rSink);
501 bool openStream(const css::uno::Reference<css::io::XOutputStream>& rStream);
515 void writeStream(const css::uno::Reference<css::io::XInputStream>& rStream,
516 bool bReplaceExisting);
517
528 css::uno::Sequence<css::ucb::ContentInfo> queryCreatableContentsInfo();
529
556 bool insertNewContent(const OUString& rContentType,
557 const css::uno::Sequence<OUString>& rPropertyNames,
558 const css::uno::Sequence<css::uno::Any>& rPropertyValues,
559 Content& rNewContent);
589 bool insertNewContent(const OUString& rContentType,
590 const css::uno::Sequence<OUString>& rPropertyNames,
591 const css::uno::Sequence<css::uno::Any>& rPropertyValues,
592 const css::uno::Reference<css::io::XInputStream>& rStream,
593 Content& rNewContent);
594
627 void transferContent(const Content& rSourceContent, InsertOperation eOperation,
628 const OUString& rTitle, const sal_Int32 nNameClashAction,
629 const OUString& rMimeType = OUString(), bool bMajorVersion = false,
630 const OUString& rCommentVersion = OUString(),
631 OUString* pResultURL = nullptr,
632 const OUString& rDocumentId = OUString()) const;
633
641 void lock();
642
650 void unlock();
651
652 // Required properties.
653
663 bool isFolder();
673 bool isDocument();
674};
675
676} /* namespace ucbhelper */
677
678#endif /* ! INCLUDED_UCBHELPER_CONTENT_HXX */
679
680/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class simplifies access to UCB contents by providing a more convenient API for frequently used f...
Definition: content.hxx:99
bool openStream(const css::uno::Reference< css::io::XActiveDataSink > &rSink)
This methods gives read access to the content stream of a content (i.e the content of a file located ...
bool openStream(const css::uno::Reference< css::io::XOutputStream > &rStream)
This methods gives read access to the content stream of a content (i.e the content of a file located ...
bool insertNewContent(const OUString &rContentType, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues, const css::uno::Reference< css::io::XInputStream > &rStream, Content &rNewContent)
This method creates, initializes and inserts (commits) a new content inside this (the target folder) ...
static bool create(const OUString &rURL, const css::uno::Reference< css::ucb::XCommandEnvironment > &rEnv, const css::uno::Reference< css::uno::XComponentContext > &rCtx, Content &rContent)
Constructor.
css::uno::Sequence< css::uno::Any > setPropertyValues(const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rValues)
This method can be used to set multiple property values.
bool insertNewContent(const OUString &rContentType, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues, Content &rNewContent)
This method creates, initializes and inserts ( commits ) a new content (i.e.
Content(const OUString &rURL, const css::uno::Reference< css::ucb::XCommandEnvironment > &rEnv, const css::uno::Reference< css::uno::XComponentContext > &rCtx)
Constructor.
rtl::Reference< Content_Impl > m_xImpl
Definition: content.hxx:100
css::uno::Sequence< css::uno::Any > getPropertyValues(const css::uno::Sequence< OUString > &rPropertyNames)
This method can be used to read multiple property values.
Content(const css::uno::Reference< css::ucb::XContent > &rContent, const css::uno::Reference< css::ucb::XCommandEnvironment > &rEnv, const css::uno::Reference< css::uno::XComponentContext > &rCtx)
Constructor.
bool executeCommand(const OUString &rCommand)
std::shared_ptr< osl::Mutex > const & lock()
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
InsertOperation
These are the possible values for the parameter eOperation of method ucbhelper::Content::insertNewCon...
Definition: content.hxx:85
ResultSetInclude
These are the possible values for the parameter eMode of method ucbhelper::Content::createCursor.
Definition: content.hxx:74
@ INCLUDE_FOLDERS_AND_DOCUMENTS
Definition: content.hxx:77
@ INCLUDE_FOLDERS_ONLY
Definition: content.hxx:75
@ INCLUDE_DOCUMENTS_ONLY
Definition: content.hxx:76
#define UCBHELPER_DLLPUBLIC