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 
27 namespace com::sun::star::beans
28 {
29 class XPropertySetInfo;
30 }
31 
32 namespace com::sun::star::io
33 {
34 class XActiveDataSink;
35 class XOutputStream;
36 class XInputStream;
37 class XStream;
38 }
39 
40 namespace com::sun::star::sdbc
41 {
42 class XResultSet;
43 class XRow;
44 }
45 
46 namespace com::sun::star::ucb
47 {
48 class XCommandEnvironment;
49 class XCommandInfo;
50 class XContent;
51 class XDynamicResultSet;
52 class XAnyCompareFactory;
53 struct ContentInfo;
54 struct NumberedSortingInfo;
55 }
56 
57 namespace com::sun::star::uno
58 {
59 class XComponentContext;
60 }
61 
62 namespace com::sun::star::uno
63 {
64 class Any;
65 }
66 
67 namespace ucbhelper
68 {
74 {
78 };
79 
84 enum class InsertOperation
85 {
86  Copy, // copy source data
87  Move, // move source data
88  Checkin // check-in source data
89 };
90 
91 class Content_Impl;
92 
99 {
101 
105  css::uno::Any createCursorAny(const css::uno::Sequence<OUString>& rPropertyNames,
106  ResultSetInclude eMode);
107 
108 public:
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,
415  ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS);
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,
424  ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS);
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: */
rtl::Reference< Content_Impl > m_xImpl
Definition: content.hxx:100
ResultSetInclude
These are the possible values for the parameter eMode of method ucbhelper::Content::createCursor.
Definition: content.hxx:73
InsertOperation
These are the possible values for the parameter eOperation of method ucbhelper::Content::insertNewCon...
Definition: content.hxx:84
This class simplifies access to UCB contents by providing a more convenient API for frequently used f...
Definition: content.hxx:98
#define UCBHELPER_DLLPUBLIC