summaryrefslogtreecommitdiffstats
path: root/include/ucbhelper
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /include/ucbhelper
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/ucbhelper')
-rw-r--r--include/ucbhelper/activedatasink.hxx57
-rw-r--r--include/ucbhelper/authenticationfallback.hxx48
-rw-r--r--include/ucbhelper/cancelcommandexecution.hxx100
-rw-r--r--include/ucbhelper/commandenvironment.hxx79
-rw-r--r--include/ucbhelper/content.hxx680
-rw-r--r--include/ucbhelper/contenthelper.hxx448
-rw-r--r--include/ucbhelper/contentidentifier.hxx57
-rw-r--r--include/ucbhelper/fd_inputstream.hxx93
-rw-r--r--include/ucbhelper/interactionrequest.hxx547
-rw-r--r--include/ucbhelper/interceptedinteraction.hxx281
-rw-r--r--include/ucbhelper/macros.hxx146
-rw-r--r--include/ucbhelper/propertyvalueset.hxx203
-rw-r--r--include/ucbhelper/providerhelper.hxx246
-rw-r--r--include/ucbhelper/proxydecider.hxx135
-rw-r--r--include/ucbhelper/registerucb.hxx96
-rw-r--r--include/ucbhelper/resultset.hxx435
-rw-r--r--include/ucbhelper/resultsethelper.hxx164
-rw-r--r--include/ucbhelper/resultsetmetadata.hxx341
-rw-r--r--include/ucbhelper/simpleauthenticationrequest.hxx139
-rw-r--r--include/ucbhelper/simplecertificatevalidationrequest.hxx64
-rw-r--r--include/ucbhelper/simpleinteractionrequest.hxx95
-rw-r--r--include/ucbhelper/simplenameclashresolverequest.hxx72
-rw-r--r--include/ucbhelper/ucbhelperdllapi.h34
23 files changed, 4560 insertions, 0 deletions
diff --git a/include/ucbhelper/activedatasink.hxx b/include/ucbhelper/activedatasink.hxx
new file mode 100644
index 000000000..391be2c91
--- /dev/null
+++ b/include/ucbhelper/activedatasink.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_ACTIVEDATASINK_HXX
+#define INCLUDED_UCBHELPER_ACTIVEDATASINK_HXX
+
+#include <config_options.h>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <cppuhelper/implbase.hxx>
+
+namespace ucbhelper
+{
+// workaround for incremental linking bugs in MSVC2015
+class SAL_DLLPUBLIC_TEMPLATE ActiveDataSink_Base
+ : public cppu::WeakImplHelper<css::io::XActiveDataSink>
+{
+};
+
+/**
+ * This class implements the interface css::io::XActiveDataSink.
+ * Instances of this class can be passed with the parameters of an
+ * "open" command.
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) ActiveDataSink final : public ActiveDataSink_Base
+{
+ css::uno::Reference<css::io::XInputStream> m_xStream;
+
+public:
+ // XActiveDataSink methods.
+ virtual void SAL_CALL
+ setInputStream(const css::uno::Reference<css::io::XInputStream>& aStream) override;
+
+ virtual css::uno::Reference<css::io::XInputStream> SAL_CALL getInputStream() override;
+};
+
+} /* namespace ucbhelper */
+
+#endif /* ! INCLUDED_UCBHELPER_ACTIVEDATASINK_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/authenticationfallback.hxx b/include/ucbhelper/authenticationfallback.hxx
new file mode 100644
index 000000000..a2634b060
--- /dev/null
+++ b/include/ucbhelper/authenticationfallback.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple authentication interaction request used
+ * when programmatically authentication cannot succeed.
+ *
+ * Read-only values : instructions, url
+ * Read-write values: code
+ */
+class UCBHELPER_DLLPUBLIC AuthenticationFallbackRequest final : public ucbhelper::InteractionRequest
+{
+private:
+ rtl::Reference< ucbhelper::InteractionAuthFallback > m_xAuthFallback;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rInstructions instructions to be followed by the user
+ * @param rURL contains a URL for which authentication is requested.
+ */
+ AuthenticationFallbackRequest( const OUString & rInstructions,
+ const OUString & rURL );
+
+ const rtl::Reference< ucbhelper::InteractionAuthFallback >&
+ getAuthFallbackInter( ) const { return m_xAuthFallback; }
+
+};
+
+} // namespace ucbhelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/cancelcommandexecution.hxx b/include/ucbhelper/cancelcommandexecution.hxx
new file mode 100644
index 000000000..85eba5d98
--- /dev/null
+++ b/include/ucbhelper/cancelcommandexecution.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_CANCELCOMMANDEXECUTION_HXX
+#define INCLUDED_UCBHELPER_CANCELCOMMANDEXECUTION_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/ucb/IOErrorCode.hpp>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star {
+ namespace uno { class Any; }
+ namespace ucb { class XCommandEnvironment; }
+ namespace ucb { class XCommandProcessor; }
+}
+
+namespace ucbhelper
+{
+
+
+/** Cancel the execution of a command by throwing the appropriate exception.
+ If an Interaction Handler is given with the command environment and the
+ handler handles the exception by selecting the supplied continuation,
+ then this function will put the original exception supplied into a
+ css::ucb::CommandFailedException and throw the
+ CommandFailedException. If no handler was given or the handler was not
+ able to handle the exception, then the given exception will be thrown
+ directly.
+
+ NOTE THAT THIS FUNCTION NEVER RETURNS! IT ALWAYS THROWS AN EXCEPTION!
+
+ @param rException is the exception describing the error to handle.
+
+ @param xEnv is the command environment that may contain an Interaction
+ Handler to use before throwing the appropriate exception.
+
+ @throws css::uno::Exception
+ */
+UCBHELPER_DLLPUBLIC void cancelCommandExecution( const css::uno::Any & rException,
+ const css::uno::Reference<
+ css::ucb::XCommandEnvironment > &
+ xEnv );
+
+/** Cancel the execution of a command by throwing the appropriate exception.
+ If an Interaction Handler is given with the command environment and the
+ handler handles the exception by selecting the supplied continuation,
+ then this function will put the original exception supplied into a
+ css::ucb::CommandFailedException and throw the
+ CommandFailedException. If no handler was given or the handler was not
+ able to handle the exception, then the given exception will be thrown
+ directly.
+
+ NOTE THAT THIS FUNCTION NEVER RETURNS! IT ALWAYS THROWS AN EXCEPTION!
+
+ @param eError is an IO error code.
+
+ @param rArgs is a sequence containing the arguments to pass along with
+ the exception. Each IO error code can be combined with one or
+ more additional arguments. Refer to com/sun/star/ucb/IOErroprCode.idl
+ for details.
+
+ @param xEnv is the command environment that may contain an Interaction
+ Handler to use before throwing the appropriate exception.
+
+ @param rMessage is a text containing additional error information.
+ Used as debugging aid only. Passed to the member 'Message' of the
+ uno::Exception thrown by this function.
+
+ @param xContext is the command processor executing the command to cancel.
+ Used as debugging aid only. Passed to the member 'Context' of the
+ uno::Exception thrown by this function.
+
+ @throws css::uno::Exception
+ */
+UCBHELPER_DLLPUBLIC void cancelCommandExecution( const css::ucb::IOErrorCode eError,
+ const css::uno::Sequence< css::uno::Any > & rArgs,
+ const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv,
+ const OUString & rMessage = OUString(),
+ const css::uno::Reference< css::ucb::XCommandProcessor > & xContext = nullptr );
+}
+
+#endif // INCLUDED_UCBHELPER_CANCELCOMMANDEXECUTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/commandenvironment.hxx b/include/ucbhelper/commandenvironment.hxx
new file mode 100644
index 000000000..efdc9ea66
--- /dev/null
+++ b/include/ucbhelper/commandenvironment.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_COMMANDENVIRONMENT_HXX
+#define INCLUDED_UCBHELPER_COMMANDENVIRONMENT_HXX
+
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <cppuhelper/implbase.hxx>
+#include <memory>
+
+namespace ucbhelper
+{
+struct CommandEnvironment_Impl;
+
+// workaround for incremental linking bugs in MSVC2015
+class SAL_DLLPUBLIC_TEMPLATE CommandEnvironment_Base
+ : public cppu::WeakImplHelper<css::ucb::XCommandEnvironment>
+{
+};
+
+/**
+ * This class implements the interface
+ * css::ucb::XCommandEnvironment. Instances of this class can
+ * be used to supply environments to commands executed by UCB contents.
+ */
+class UCBHELPER_DLLPUBLIC CommandEnvironment final : public CommandEnvironment_Base
+{
+ std::unique_ptr<CommandEnvironment_Impl> m_pImpl;
+
+private:
+ CommandEnvironment(const CommandEnvironment&) = delete;
+ CommandEnvironment& operator=(const CommandEnvironment&) = delete;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rxInteractionHandler is the implementation of an Interaction
+ * Handler or an empty reference.
+ * @param rxProgressHandler is the implementation of a Progress
+ * Handler or an empty reference.
+ */
+ CommandEnvironment(
+ const css::uno::Reference<css::task::XInteractionHandler>& rxInteractionHandler,
+ const css::uno::Reference<css::ucb::XProgressHandler>& rxProgressHandler);
+ /**
+ * Destructor.
+ */
+ virtual ~CommandEnvironment() override;
+
+ // XCommandEnvironment
+ virtual css::uno::Reference<css::task::XInteractionHandler>
+ SAL_CALL getInteractionHandler() override;
+
+ virtual css::uno::Reference<css::ucb::XProgressHandler> SAL_CALL getProgressHandler() override;
+};
+
+} /* namespace ucbhelper */
+
+#endif /* ! INCLUDED_UCBHELPER_COMMANDENVIRONMENT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/content.hxx b/include/ucbhelper/content.hxx
new file mode 100644
index 000000000..6f4a7b2d4
--- /dev/null
+++ b/include/ucbhelper/content.hxx
@@ -0,0 +1,680 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UCBHELPER_CONTENT_HXX
+#define INCLUDED_UCBHELPER_CONTENT_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::beans
+{
+class XPropertySetInfo;
+}
+
+namespace com::sun::star::io
+{
+class XActiveDataSink;
+class XOutputStream;
+class XInputStream;
+class XStream;
+}
+
+namespace com::sun::star::sdbc
+{
+class XResultSet;
+class XRow;
+}
+
+namespace com::sun::star::ucb
+{
+class XCommandEnvironment;
+class XCommandInfo;
+class XContent;
+class XDynamicResultSet;
+class XAnyCompareFactory;
+struct ContentInfo;
+struct NumberedSortingInfo;
+}
+
+namespace com::sun::star::uno
+{
+class XComponentContext;
+}
+
+namespace com::sun::star::uno
+{
+class Any;
+}
+
+namespace ucbhelper
+{
+/**
+ * These are the possible values for the parameter eMode of method
+ * ucbhelper::Content::createCursor.
+ */
+enum ResultSetInclude
+{
+ INCLUDE_FOLDERS_ONLY,
+ INCLUDE_DOCUMENTS_ONLY,
+ INCLUDE_FOLDERS_AND_DOCUMENTS
+};
+
+/**
+ * These are the possible values for the parameter eOperation of method
+ * ucbhelper::Content::insertNewContent.
+ */
+enum class InsertOperation
+{
+ Copy, // copy source data
+ Move, // move source data
+ Checkin // check-in source data
+};
+
+class Content_Impl;
+
+/**
+ * This class simplifies access to UCB contents by providing a more
+ * convenient API for frequently used functionality then the "raw"
+ * UCB-API does.
+ */
+class UCBHELPER_DLLPUBLIC Content final
+{
+ rtl::Reference<Content_Impl> m_xImpl;
+
+ /// @throws css::ucb::CommandAbortedException
+ /// @throws css::uno::RuntimeException,
+ /// @throws css::uno::Exception
+ css::uno::Any createCursorAny(const css::uno::Sequence<OUString>& rPropertyNames,
+ ResultSetInclude eMode);
+
+public:
+ /**
+ * Constructor.
+ */
+ Content();
+
+ /**
+ * Constructor.
+ *
+ * @param rURL is the URL of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ * @throws css::ucb::ContentCreationException
+ * @throws css::uno::RuntimeException
+ */
+ Content(const OUString& rURL, const css::uno::Reference<css::ucb::XCommandEnvironment>& rEnv,
+ const css::uno::Reference<css::uno::XComponentContext>& rCtx);
+ /**
+ * Constructor.
+ *
+ * @param rContent is the content object of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ * @throws css::ucb::ContentCreationException
+ * @throws css::uno::RuntimeException
+ */
+ 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);
+ /**
+ * Copy Constructor.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content(const Content& rOther);
+
+ /**
+ * Move constructor.
+ */
+ Content(Content&& rOther) noexcept;
+
+ /**
+ * Destructor.
+ */
+ ~Content();
+
+ /**
+ * Assignment operator.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content& operator=(const Content& rOther);
+
+ /**
+ * Move assignment operator.
+ */
+ Content& operator=(Content&& rOther) noexcept;
+
+ /**
+ * Constructor. This method should be used, if the exception thrown
+ * by the direct ctors of this class are to 'expensive' for your
+ * application
+ *
+ * @param rURL is the URL of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ * @param rContent will be filled by this method with the content created.
+ * @return true, if the operation was successful - false, otherwise.
+ */
+ static bool create(const OUString& rURL,
+ const css::uno::Reference<css::ucb::XCommandEnvironment>& rEnv,
+ const css::uno::Reference<css::uno::XComponentContext>& rCtx,
+ Content& rContent);
+
+ // Direct access to UCB content.
+
+ /**
+ * This method provides access to the "native" UCB content interface(s).
+ * This is useful in case the convenience methods provided by this
+ * class are insufficient for your needs. You may obtain all interfaces
+ * supported by the underlying UCB content by calling this method and
+ * after that doing a queryInterface call.
+ *
+ * @return the XContent interface of the underlying UCB content.
+ */
+ css::uno::Reference<css::ucb::XContent> get() const;
+
+ // Object identity.
+
+ /**
+ * This method returns the URL of the content.
+ *
+ * @return the URL of the content.
+ */
+ const OUString& getURL() const;
+
+ // Command environment.
+
+ /**
+ * This method returns the environment to use when executing commands.
+ *
+ * @return the command environment.
+ */
+ const css::uno::Reference<css::ucb::XCommandEnvironment>& getCommandEnvironment() const;
+
+ /**
+ * This method sets a new command environment.
+ *
+ * @param xNewEnv is the new command environment.
+ */
+ void setCommandEnvironment(const css::uno::Reference<css::ucb::XCommandEnvironment>& xNewEnv);
+
+ // Access to supported commands/properties.
+
+ /**
+ * This methods provides access to meta data of the commands supported
+ * by this content.
+ *
+ * @return an XCommandInfo interface implementation, which can be used
+ * to obtain meta data of the commands supported by this content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::ucb::XCommandInfo> getCommands();
+ /**
+ * This methods provides access to meta data of the properties supported
+ * by this content.
+ *
+ * @return an XPropertSetInfo interface implementation, which can be used
+ * to obtain meta data of the properties supported by this content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::beans::XPropertySetInfo> getProperties();
+
+ // Access to property value(s).
+
+ /**
+ * This method can be used to read a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the value
+ * shall be obtained.
+ * @return the property value.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Any getPropertyValue(const OUString& rPropertyName);
+ /**
+ * This method can be used to set a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the
+ * value shall be set.
+ * @return an any containing:
+ * - No value indicates, that the property value was set
+ * successfully.
+ * - css::beans::UnknownPropertyException indicates,
+ * that the property is not known to the content implementation.
+ * - css::beans::IllegalTypeException indicates, that
+ * the data type of the property value is not acceptable.
+ * - css::lang::IllegalAccessException indicates, that
+ * the property is constant.
+ * - css::lang::IllegalArgumentException indicates,
+ * that the property value is not acceptable. For instance,
+ * setting an empty title may be illegal.
+ * - Any other exception derived from
+ * css::uno::Exception indicates, that the value was
+ * not set successfully. For example, this can be a
+ * com::sun:star::ucb::InteractiveAugmentedIOException
+ * transporting the error code
+ * css::ucb::IOErrorCode::ACCESS_DENIED.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Any setPropertyValue(const OUString& rPropertyName, const css::uno::Any& rValue);
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Sequence<css::uno::Any>
+ getPropertyValues(const css::uno::Sequence<OUString>& rPropertyNames);
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::sdbc::XRow>
+ getPropertyValuesInterface(const css::uno::Sequence<OUString>& rPropertyNames);
+
+ /**
+ * This method can be used to set multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that values shall be set.
+ * @return a sequence of any's which has exactly the same number
+ * of elements as the number of properties to set. Every
+ * sequence element contains the status for a property. The
+ * first sequence elements corresponds to the first element in
+ * the sequence of property names and so on.
+ *
+ * An any containing:
+ * - No value indicates, that the property value was set
+ * successfully.
+ * - css::beans::UnknownPropertyException indicates,
+ * that the property is not known to the content implementation.
+ * - css::beans::IllegalTypeException indicates, that
+ * the data type of the property value is not acceptable.
+ * - css::lang::IllegalAccessException indicates, that
+ * the property is constant.
+ * - css::lang::IllegalArgumentException indicates,
+ * that the property value is not acceptable. For instance,
+ * setting an empty title may be illegal.
+ * - Any other exception derived from
+ * css::uno::Exception indicates, that the value was
+ * not set successfully. For example, this can be a
+ * com::sun:star::ucb::InteractiveAugmentedIOException
+ * transporting the error code
+ * css::ucb::IOErrorCode::ACCESS_DENIED.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Sequence<css::uno::Any>
+ setPropertyValues(const css::uno::Sequence<OUString>& rPropertyNames,
+ const css::uno::Sequence<css::uno::Any>& rValues);
+
+ // General command execution.
+
+ /**
+ * This method can be used to execute any command supported by the
+ * content.
+ *
+ * @param rCommandName is the name of the command to execute.
+ * @param rCommandArgument is the argument for the command. Type and
+ * values of this parameter must correspond to the command
+ * specification.
+ * @return the result of the command according to its specification.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Any executeCommand(const OUString& rCommandName,
+ const css::uno::Any& rCommandArgument);
+
+ // Special commands.
+
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessible via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.ContentResultSet, which can be used to
+ * get access to the children of a content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::sdbc::XResultSet>
+ createCursor(const css::uno::Sequence<OUString>& rPropertyNames,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS);
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessible via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.DynamicResultSet, which can be used to
+ * get access to the children of a content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::ucb::XDynamicResultSet>
+ createDynamicCursor(const css::uno::Sequence<OUString>& rPropertyNames,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS);
+
+ /// @throws css::ucb::CommandAbortedException
+ /// @throws css::uno::RuntimeException
+ /// @throws css::uno::Exception
+ css::uno::Reference<css::sdbc::XResultSet>
+ createSortedCursor(const css::uno::Sequence<OUString>& rPropertyNames,
+ const css::uno::Sequence<css::ucb::NumberedSortingInfo>& rSortInfo,
+ const css::uno::Reference<css::ucb::XAnyCompareFactory>& rAnyCompareFactory,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS);
+
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @return an implementation of the interface XInputStream, which can
+ * be used to read the content's data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::io::XInputStream> openStream();
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ * The method requests opening without locking.
+ *
+ * @return an implementation of the interface XInputStream, which can
+ * be used to read the content's data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::io::XInputStream> openStreamNoLock();
+
+ /**
+ * This methods gives read/write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @return an implementation of the interface XStream, which can
+ * be used to read/write the content's data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::io::XStream> openWriteableStream();
+ /**
+ * This methods gives read/write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ * The method requests opening without locking.
+ *
+ * @return an implementation of the interface XStream, which can
+ * be used to read/write the content's data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::io::XStream> openWriteableStreamNoLock();
+
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rSink is the implementation of an XActiveDataSink interface,
+ * which shall be used by the content to deliver the data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ 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 at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rStream is the implementation of an XOutputStream interface,
+ * which shall be used by the content to deliver the data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ bool openStream(const css::uno::Reference<css::io::XOutputStream>& rStream);
+ /**
+ * This methods gives write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "insert" at the content.
+ *
+ * @param rStream is the implementation of an XInputStream interface,
+ * which contains the content data to write.
+ * @param bReplaceExisting specifies, whether any existing content data
+ * shall be overwritten.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ void writeStream(const css::uno::Reference<css::io::XInputStream>& rStream,
+ bool bReplaceExisting);
+
+ /**
+ * This method returns the different types of contents this content
+ * can create.
+ *
+ * @return the content types or an empty sequence if no contents can be
+ * created by this content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Sequence<css::ucb::ContentInfo> queryCreatableContentsInfo();
+
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a
+ * XCommandProcessor::execute( "createNewContent", ... );
+ * XCommandProcessor::execute( "setPropertyValues", ... );
+ * XCommandProcessor::execute( "insert", ... ); calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its content
+ * objects (See queryCreatableContentsInfo()).
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( committed ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( committed ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ 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
+ * inside this (the target folder) content. For example, it can be used to
+ * create a new file system file.
+ * Internally this method does a
+ * XCommandProcessor::execute( "createNewContent", ... );
+ * XCommandProcessor::execute( "setPropertyValues", ... );
+ * XCommandProcessor::execute( "insert", ... ); calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its content
+ * objects (See queryCreatableContentsInfo()).
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( committed ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( committed ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rStream is a stream containing the content data for the new
+ * content (i.e. the content of a file to create)
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ 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 transfers (copies/moves) a content. It creates a new
+ * resource inside this (the target folder) content.
+ * The implementation is able to do cross-provider transfers (like copying
+ * a file from the local file system to a directory located on an HTTP
+ * server).
+ * Internally this method executes the command "globalTransfer" at the UCB.
+ *
+ * @param rSourceContent is the content that contains the data for the
+ * new UCB content.
+ * @param eOperation defines what shall be done with the source data
+ * ( COPY, MOVE, LINK ).
+ * @param rTitle contains a title for the new content. If this is an empty
+ * string, the new content will have the same title as the source
+ * content.
+ * @param rNameClashAction describes how the implementation shall behave
+ * in case a content with a clashing name exists in the target
+ * folder.
+ * NameClash::ERROR will abort the operation, NameClash::OVERWRITE
+ * will overwrite the clashing content and all its data,
+ * NameClash::RENAME will generate and supply a non-clashing title.
+ * @see com/sun/star/ucb/NameClash.idl
+ * @param rMimeType contains the MIME type of the document to write.
+ * @param bMajorVersion tells to create a new major version for checkin operations
+ * @param rCommentVersion contains the comment to use for checkin operations
+ * @param rResultURL is a hacky way to get the update URL after the operation in
+ * case there was a change (introduced for the checkin operation)
+ * @param rDocumentId is the document Id ( in case of CMIS ).
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ void transferContent(const Content& rSourceContent, InsertOperation eOperation,
+ const OUString& rTitle, const sal_Int32 nNameClashAction,
+ const OUString& rMimeType = OUString(), bool bMajorVersion = false,
+ const OUString& rCommentVersion = OUString(),
+ OUString* pResultURL = nullptr,
+ const OUString& rDocumentId = OUString()) const;
+
+ /**
+ * This method lock the resource.
+ *
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ void lock();
+
+ /**
+ * This method unlock the resource.
+ *
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ void unlock();
+
+ // Required properties.
+
+ /**
+ * This method returns the value of the content's property "IsFolder".
+ *
+ * @return true, if the content is a folder ( it can contain other
+ * UCB contents). false, otherwise.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ bool isFolder();
+ /**
+ * This method returns the value of the content's property "IsDocument".
+ *
+ * @return true, if the content is a document ( it has a content stream ).
+ * false, otherwise.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ bool isDocument();
+};
+
+} /* namespace ucbhelper */
+
+#endif /* ! INCLUDED_UCBHELPER_CONTENT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/contenthelper.hxx b/include/ucbhelper/contenthelper.hxx
new file mode 100644
index 000000000..3f269e475
--- /dev/null
+++ b/include/ucbhelper/contenthelper.hxx
@@ -0,0 +1,448 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_CONTENTHELPER_HXX
+#define INCLUDED_UCBHELPER_CONTENTHELPER_HXX
+
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
+#include <com/sun/star/ucb/XCommandInfoChangeNotifier.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/weak.hxx>
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace com::sun::star::ucb {
+ struct CommandInfo;
+ class XCommandEnvironment;
+ class XCommandInfo;
+ class XPersistentPropertySet;
+}
+
+namespace com::sun::star::beans {
+ struct Property;
+ class XPropertySetInfo;
+}
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace ucbhelper_impl { struct ContentImplHelper_Impl; }
+
+namespace ucbhelper
+{
+
+
+class ContentProviderImplHelper;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.Content. Implementations derived from this class are
+ * objects provided by implementations derived from
+ * class ucb::ContentProviderImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service css::ucb::Content
+ * - all required listener containers
+ * ( XComponent, XPropertiesChangeNotifier, XPropertySetInfoChangeNotifier,
+ * XCommandInfoChangeNotifier )
+ * - XPropertyContainer implementation ( persistence is implemented using
+ * service com.sun.star.ucb.Store )
+ * - complete XPropertySetInfo implementation ( including Additional Core
+ * Properties supplied via XPropertyContainer interface )
+ * -> protected method: getPropertySetInfo
+ * - complete XCommandInfo implementation
+ * -> protected method: getCommandInfo
+ */
+class UCBHELPER_DLLPUBLIC ContentImplHelper :
+ public cppu::OWeakObject,
+ public css::lang::XTypeProvider,
+ public css::lang::XServiceInfo,
+ public css::lang::XComponent,
+ public css::ucb::XContent,
+ public css::ucb::XCommandProcessor,
+ public css::beans::XPropertiesChangeNotifier,
+ public css::beans::XPropertyContainer,
+ public css::beans::XPropertySetInfoChangeNotifier,
+ public css::ucb::XCommandInfoChangeNotifier,
+ public css::container::XChild
+{
+ friend class PropertySetInfo;
+ friend class CommandProcessorInfo;
+
+ std::unique_ptr<ucbhelper_impl::ContentImplHelper_Impl> m_pImpl;
+
+protected:
+ osl::Mutex m_aMutex;
+ css::uno::Reference< css::uno::XComponentContext >
+ m_xContext;
+ css::uno::Reference< css::ucb::XContentIdentifier >
+ m_xIdentifier;
+ rtl::Reference< ContentProviderImplHelper >
+ m_xProvider;
+ sal_uInt32 m_nCommandId;
+
+private:
+ /**
+ * Your implementation of this method must return a sequence containing
+ * the meta data of the properties supported by the content.
+ * Note: If you wish to provide your own implementation of the interface
+ * XPropertyContainer ( completely override addContent and removeContent
+ * implementation of this base class in this case ), you can supply the
+ * meta data for your Additional Core Properties here to get a fully
+ * featured getPropertySetInfo method ( see below ).
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @return a sequence containing the property meta data.
+ */
+ UCBHELPER_DLLPRIVATE
+ virtual css::uno::Sequence< css::beans::Property >
+ getProperties( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) = 0;
+
+ /**
+ * Your implementation of this method must return a sequence containing
+ * the meta data of the commands supported by the content.
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @return a sequence containing the command meta data.
+ */
+ UCBHELPER_DLLPRIVATE
+ virtual css::uno::Sequence< css::ucb::CommandInfo >
+ getCommands( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) = 0;
+
+ /**
+ * The implementation of this method shall return the URL of the parent
+ * of your content.
+ *
+ * @return the URL of the parent content or an empty string.
+ * Note that not all contents must have one parent. There may
+ * be contents with no parent. In that case an empty string must
+ * be returned. If your content has more than one parent you may
+ * return the URL of one "preferred" parent or an empty string.
+ */
+ UCBHELPER_DLLPRIVATE virtual OUString getParentURL() = 0;
+
+protected:
+ /**
+ * This method returns complete meta data for the properties ( including
+ * Additional Core Properties supplied via XPropertyContainer interface )
+ * supported by the content. To implement the required command
+ * "getPropertySetInfo" simply return the return value of this method.
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @param bCache indicates, whether the implementation should use
+ * cached data, if exist.
+ * @return an XPropertySetInfo implementation object containing meta data
+ * for the properties supported by this content.
+ */
+ css::uno::Reference< css::beans::XPropertySetInfo >
+ getPropertySetInfo( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv,
+ bool bCache = true );
+
+ /**
+ * This method returns complete meta data for the commands supported by
+ * the content. To implement the required command "getCommandInfo" simply
+ * return the return value of this method.
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @param bCache indicates, whether the implementation should use
+ * cached data, if exist.
+ * @return an XCommandInfo implementation object containing meta data
+ * for the commands supported by this content.
+ */
+ css::uno::Reference< css::ucb::XCommandInfo >
+ getCommandInfo( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv,
+ bool bCache = true );
+
+ /**
+ * This method can be used to propagate changes of property values.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertiesChange(
+ const css::uno::Sequence< css::beans::PropertyChangeEvent >& evt ) const;
+
+ /**
+ * This method can be used to propagate changes of the propertyset
+ * info of your content (i.e. this happens if a new property is added
+ * to your content via its XPropertyContainer interface). This base class
+ * automatically generates events when the propertyset info changes. If
+ * you provide your own implementations of addproperty and removeProperty,
+ * then you must call "notifyPropertySetInfoChange" by yourself.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertySetInfoChange(
+ const css::beans::PropertySetInfoChangeEvent& evt ) const;
+
+ /**
+ * This method can be used to propagate content events.
+ *
+ * @param evt is a sequence of content events.
+ */
+ void notifyContentEvent(
+ const css::ucb::ContentEvent& evt ) const;
+
+ /**
+ * Use this method to announce the insertion of this content at
+ * the end of your implementation of the command "insert". The
+ * implementation of is method propagates a ContentEvent( INSERTED ).
+ */
+ void inserted();
+
+ /**
+ * Use this method to announce the destruction of this content at
+ * the end of your implementation of the command "delete". The
+ * implementation of is method propagates a ContentEvent( DELETED )
+ * and a ContentEvent( REMOVED ) at the parent of the deleted content,
+ * if a parent exists.
+ */
+ void deleted();
+
+ /**
+ * Use this method to change the identity of a content. The implementation
+ * of this method will replace the content identifier of the content and
+ * propagate the appropriate ContentEvent( EXCHANGED ).
+ *
+ * @param rNewId is the new content identifier for the content.
+ * @return a success indicator.
+ */
+ bool exchange( const css::uno::Reference< css::ucb::XContentIdentifier >& rNewId );
+
+ /**
+ * Use this method to get access to the Additional Core Properties of
+ * the content ( added using content's XPropertyContainer interface ).
+ * If you supply your own XPropertyContainer implementation, this method
+ * will always return an empty propertyset.
+ *
+ * @param bCreate indicates whether a new propertyset shall be created
+ * if it does not exist.
+ * @return the implementation of the service
+ * com.sun.star.ucb.PersistentPropertySet.
+ */
+ css::uno::Reference< css::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool renameAdditionalPropertySet( const OUString& rOldKey,
+ const OUString& rNewKey );
+
+ /**
+ * This method copies the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param rSourceKey is the key of the source propertyset.
+ * @param rTargetKey is the key of the target propertyset.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool copyAdditionalPropertySet( const OUString& rSourceKey,
+ const OUString& rTargetKey );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * Propertysets for children described by rOldKey are removed too.
+ *
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool removeAdditionalPropertySet();
+
+public:
+ /**
+ * Constructor.
+ *
+ * Note that the implementation of this ctor registers itself at its
+ * content provider. The provider implementation inserts the content
+ * in a hash map. So it easily can be found and reused when the provider
+ * is asked for a content.
+ *
+ * @param rxContext is a Service Manager.
+ * @param rxProvider is the provider for the content.
+ * @param Identifier is the content identifier for the content.
+ */
+ ContentImplHelper(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const rtl::Reference< ContentProviderImplHelper >& rxProvider,
+ const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier );
+
+ /**
+ * Destructor.
+ *
+ * Note that the implementation of this dtor deregisters itself from its
+ * content provider. The provider implementation removes the content
+ * from a hash map.
+ */
+ virtual ~ContentImplHelper() override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { cppu::OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL
+ getImplementationName() override = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() override = 0;
+
+ // XComponent
+ virtual void SAL_CALL
+ dispose() override;
+ virtual void SAL_CALL
+ addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+
+ // XContent
+ virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
+ getIdentifier() override;
+ virtual OUString SAL_CALL
+ getContentType() override = 0;
+ virtual void SAL_CALL
+ addContentEventListener(
+ const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeContentEventListener(
+ const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
+
+ // XCommandProcessor
+ virtual sal_Int32 SAL_CALL
+ createCommandIdentifier() 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 = 0;
+ virtual void SAL_CALL
+ abort( sal_Int32 CommandId ) override = 0;
+
+ // XPropertiesChangeNotifier
+ virtual void SAL_CALL
+ addPropertiesChangeListener(
+ const css::uno::Sequence< OUString >& PropertyNames,
+ const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
+ virtual void SAL_CALL
+ removePropertiesChangeListener(
+ const css::uno::Sequence< OUString >& PropertyNames,
+ const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
+
+ // XCommandInfoChangeNotifier
+ virtual void SAL_CALL
+ addCommandInfoChangeListener(
+ const css::uno::Reference< css::ucb::XCommandInfoChangeListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeCommandInfoChangeListener(
+ const css::uno::Reference< css::ucb::XCommandInfoChangeListener >& Listener ) override;
+
+ // XPropertyContainer
+
+ /**
+ * This method adds a property to the content according to the interface
+ * specification. The properties will be stored using the service
+ * com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ addProperty( const OUString& Name,
+ sal_Int16 Attributes,
+ const css::uno::Any& DefaultValue ) override;
+
+ /**
+ * This method removes a property from the content according to the
+ * interface specification. The properties will be stored using the
+ * service com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ removeProperty( const OUString& Name ) override;
+
+ // XPropertySetInfoChangeNotifier
+ virtual void SAL_CALL
+ addPropertySetInfoChangeListener(
+ const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
+ virtual void SAL_CALL
+ removePropertySetInfoChangeListener(
+ const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
+
+ // XChild
+
+ /**
+ * This method returns the content representing the parent of a content,
+ * if such a parent exists. The implementation of this method uses your
+ * implementation of getParentURL.
+ */
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
+ getParent() override;
+
+ /**
+ * The implementation of this method always throws a NoSupportException.
+ */
+ virtual void SAL_CALL
+ setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
+
+
+ // Non-interface methods.
+
+
+ /**
+ * This method returns the provider of the content.
+ *
+ * @return the provider of the content.
+ */
+ const rtl::Reference< ContentProviderImplHelper >& getProvider() const
+ { return m_xProvider; }
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_CONTENTHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/contentidentifier.hxx b/include/ucbhelper/contentidentifier.hxx
new file mode 100644
index 000000000..9b538829f
--- /dev/null
+++ b/include/ucbhelper/contentidentifier.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_CONTENTIDENTIFIER_HXX
+#define INCLUDED_UCBHELPER_CONTENTIDENTIFIER_HXX
+
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/ucb/XContentIdentifier.hpp>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace ucbhelper
+{
+struct ContentIdentifier_Impl;
+
+/**
+ * This class implements a simple identifier object for UCB contents.
+ * It mainly stores and returns the URL as it was passed to the constructor -
+ * The only difference is that the URL scheme will be lower cased. This can
+ * be done, because URL schemes are never case sensitive.
+ */
+class UCBHELPER_DLLPUBLIC ContentIdentifier final
+ : public cppu::WeakImplHelper<css::ucb::XContentIdentifier>
+{
+public:
+ ContentIdentifier(const OUString& rURL);
+ virtual ~ContentIdentifier() override;
+
+ // XContentIdentifier
+ virtual OUString SAL_CALL getContentIdentifier() override;
+ virtual OUString SAL_CALL getContentProviderScheme() override;
+
+private:
+ std::unique_ptr<ContentIdentifier_Impl> m_pImpl;
+};
+
+} /* namespace ucbhelper */
+
+#endif /* ! INCLUDED_UCBHELPER_CONTENTIDENTIFIER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/fd_inputstream.hxx b/include/ucbhelper/fd_inputstream.hxx
new file mode 100644
index 000000000..ebef7dae7
--- /dev/null
+++ b/include/ucbhelper/fd_inputstream.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_FD_INPUTSTREAM_HXX
+#define INCLUDED_UCBHELPER_FD_INPUTSTREAM_HXX
+
+#include <osl/file.h>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace ucbhelper
+{
+ typedef cppu::WeakImplHelper<
+ css::io::XInputStream,
+ css::io::XSeekable > FdInputStream_Base;
+
+ /** Implements a seekable InputStream
+ * working on a buffer.
+ */
+ class UCBHELPER_DLLPUBLIC FdInputStream final
+ : protected cppu::BaseMutex,
+ public FdInputStream_Base
+ {
+ public:
+
+ /** Defines the storage kind found
+ * on which the inputstream acts.
+ */
+ FdInputStream(oslFileHandle tmpfl);
+
+ virtual ~FdInputStream() override;
+
+ virtual sal_Int32 SAL_CALL
+ readBytes(css::uno::Sequence< sal_Int8 >& aData,
+ sal_Int32 nBytesToRead) override;
+
+ virtual sal_Int32 SAL_CALL
+ readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
+ sal_Int32 nMaxBytesToRead ) override;
+
+ virtual void SAL_CALL
+ skipBytes(sal_Int32 nBytesToSkip) override;
+
+ virtual sal_Int32 SAL_CALL
+ available() override;
+
+ virtual void SAL_CALL
+ closeInput() override;
+
+
+ /** XSeekable
+ */
+
+ virtual void SAL_CALL
+ seek(sal_Int64 location) override;
+
+
+ virtual sal_Int64 SAL_CALL
+ getPosition() override;
+
+
+ virtual sal_Int64 SAL_CALL
+ getLength() override;
+
+ private:
+ oslFileHandle m_tmpfl;
+ sal_uInt64 m_nLength;
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/interactionrequest.hxx b/include/ucbhelper/interactionrequest.hxx
new file mode 100644
index 000000000..78fc31f7a
--- /dev/null
+++ b/include/ucbhelper/interactionrequest.hxx
@@ -0,0 +1,547 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX
+#define INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX
+
+#include <config_options.h>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include <com/sun/star/ucb/XInteractionAuthFallback.hpp>
+#include <com/sun/star/ucb/XInteractionReplaceExistingData.hpp>
+#include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace rtl { template <class reference_type> class Reference; }
+
+namespace ucbhelper {
+
+class InteractionContinuation;
+
+
+struct InteractionRequest_Impl;
+
+/**
+ * This class implements the interface XInteractionRequest. Instances can
+ * be passed directly to XInteractionHandler::handle(...). Each interaction
+ * request contains an exception describing the error and a number of
+ * interaction continuations describing the possible "answers" for the request.
+ * After the request was passed to XInteractionHandler::handle(...) the method
+ * getSelection() returns the continuation chosen by the interaction handler.
+ *
+ * The typical usage of this class would be:
+ *
+ * 1) Create exception object that shall be handled by the interaction handler.
+ * 2) Create InteractionRequest, supply exception as ctor parameter
+ * 3) Create continuations needed and add them to a sequence
+ * 4) Supply the continuations to the InteractionRequest by calling
+ * setContinuations(...)
+ *
+ * This class can also be used as base class for more specialized requests,
+ * like authentication requests.
+ */
+class UCBHELPER_DLLPUBLIC InteractionRequest :
+ public cppu::WeakImplHelper<css::task::XInteractionRequest>
+{
+ std::unique_ptr<InteractionRequest_Impl> m_pImpl;
+
+protected:
+ void setRequest( const css::uno::Any & rRequest );
+
+ InteractionRequest();
+ virtual ~InteractionRequest() override;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rRequest is the exception describing the error.
+ */
+ InteractionRequest( const css::uno::Any & rRequest );
+
+ /**
+ * This method sets the continuations for the request.
+ *
+ * @param rContinuations contains the possible continuations.
+ */
+ void setContinuations(
+ const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > & rContinuations );
+
+ // XInteractionRequest
+ virtual css::uno::Any SAL_CALL
+ getRequest() override;
+ virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL
+ getContinuations() override;
+
+ // Non-interface methods.
+
+ /**
+ * After passing this request to XInteractionHandler::handle, this method
+ * returns the continuation that was chosen by the interaction handler.
+ *
+ * @return the continuation chosen by an interaction handler or an empty
+ * reference, if the request was not (yet) handled.
+ */
+ rtl::Reference< InteractionContinuation > const & getSelection() const;
+
+ /**
+ * This method sets a continuation for the request. It also can be used
+ * to reset the continuation set by a previous XInteractionHandler::handle
+ * call in order to use this request object more than once.
+ *
+ * @param rxSelection is the interaction continuation to activate for
+ * the request or an empty reference in order to reset the
+ * current selection.
+ */
+ void
+ setSelection(
+ const rtl::Reference< InteractionContinuation > & rxSelection );
+};
+
+
+/**
+ * This class is the base for implementations of the interface
+ * XInteractionContinuation. Classes derived from this bas class work together
+ * with class InteractionRequest.
+ *
+ * Derived classes must implement their XInteractionContinuation::select()
+ * method the way that they simply call recordSelection() which is provided by
+ * this class.
+ */
+class UCBHELPER_DLLPUBLIC InteractionContinuation : public cppu::OWeakObject
+{
+ InteractionRequest* m_pRequest;
+
+protected:
+ /**
+ * This method marks this continuation as "selected" at the request it
+ * belongs to.
+ *
+ * Derived classes must implement their XInteractionContinuation::select()
+ * method the way that they call this method.
+ */
+ void recordSelection();
+ virtual ~InteractionContinuation() override;
+
+public:
+ InteractionContinuation( InteractionRequest * pRequest );
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionAbort. Instances of this class can be passed
+ * along with an interaction request to indicate the possibility to abort
+ * the operation that caused the request.
+ */
+class UCBHELPER_DLLPUBLIC InteractionAbort final : public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::task::XInteractionAbort
+{
+public:
+ InteractionAbort( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionRetry. Instances of this class can be passed
+ * along with an interaction request to indicate the possibility to retry
+ * the operation that caused the request.
+ */
+class UCBHELPER_DLLPUBLIC InteractionRetry final : public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::task::XInteractionRetry
+{
+public:
+ InteractionRetry( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionApprove. Instances of this class can be passed
+ * along with an interaction request to indicate the possibility to approve
+ * the request.
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) InteractionApprove final : public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::task::XInteractionApprove
+{
+public:
+ InteractionApprove( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionDisapprove. Instances of this class can be passed
+ * along with an interaction request to indicate the possibility to disapprove
+ * the request.
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) InteractionDisapprove final : public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::task::XInteractionDisapprove
+{
+public:
+ InteractionDisapprove( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionSupplyAuthentication. Instances of this class can be
+ * passed along with an authentication interaction request to enable the
+ * interaction handler to supply the missing authentication data.
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) InteractionSupplyAuthentication final :
+ public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::ucb::XInteractionSupplyAuthentication2
+{
+ css::uno::Sequence< css::ucb::RememberAuthentication >
+ m_aRememberPasswordModes;
+ css::uno::Sequence< css::ucb::RememberAuthentication >
+ m_aRememberAccountModes;
+ OUString m_aRealm;
+ OUString m_aUserName;
+ OUString m_aPassword;
+ css::ucb::RememberAuthentication m_eRememberPasswordMode;
+ css::ucb::RememberAuthentication m_eDefaultRememberPasswordMode;
+ css::ucb::RememberAuthentication m_eDefaultRememberAccountMode;
+ bool m_bCanSetRealm : 1;
+ bool m_bCanSetUserName : 1;
+ bool m_bCanSetPassword : 1;
+ bool m_bCanSetAccount : 1;
+ bool m_bCanUseSystemCredentials : 1;
+ bool m_bUseSystemCredentials : 1;
+
+public:
+ /**
+ * Constructor.
+ *
+ * Note: The remember-authentication stuff is interesting only for
+ * clients implementing own password storage functionality.
+ *
+ * @param rxRequest is the interaction request that owns this continuation.
+ * @param bCanSetRealm indicates, whether the realm given with the
+ * authentication request is read-only.
+ * @param bCanSetUserName indicates, whether the username given with the
+ * authentication request is read-only.
+ * @param bCanSetPassword indicates, whether the password given with the
+ * authentication request is read-only.
+ * @param bCanSetAccount indicates, whether the account given with the
+ * authentication request is read-only.
+ * @param rRememberPasswordModes specifies the authentication-remember-
+ * modes for passwords supported by the requesting client.
+ * @param eDefaultRememberPasswordMode specifies the default
+ * authentication-remember-mode for passwords preferred by the
+ * requesting client.
+ * @param rRememberAccountModes specifies the authentication-remember-
+ * modes for accounts supported by the requesting client.
+ * @param eDefaultRememberAccountMode specifies the default
+ * authentication-remember-mode for accounts preferred by the
+ * requesting client.
+ * @param bCanUseSystemCredentials indicates whether issuer of the
+ * authentication request can obtain and use system credentials
+ * for authentication.
+ *
+ * @see css::ucb::AuthenticationRequest
+ * @see css::ucb::RememberAuthentication
+ */
+ inline InteractionSupplyAuthentication(
+ InteractionRequest * pRequest,
+ bool bCanSetRealm,
+ bool bCanSetUserName,
+ bool bCanSetPassword,
+ bool bCanSetAccount,
+ const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberPasswordModes,
+ const css::ucb::RememberAuthentication eDefaultRememberPasswordMode,
+ const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberAccountModes,
+ const css::ucb::RememberAuthentication eDefaultRememberAccountMode,
+ bool bCanUseSystemCredentials );
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+
+ // XInteractionSupplyAuthentication
+ virtual sal_Bool SAL_CALL
+ canSetRealm() override;
+ virtual void SAL_CALL
+ setRealm( const OUString& Realm ) override;
+
+ virtual sal_Bool SAL_CALL
+ canSetUserName() override;
+ virtual void SAL_CALL
+ setUserName( const OUString& UserName ) override;
+
+ virtual sal_Bool SAL_CALL
+ canSetPassword() override;
+ virtual void SAL_CALL
+ setPassword( const OUString& Password ) override;
+
+ virtual css::uno::Sequence<
+ css::ucb::RememberAuthentication > SAL_CALL
+ getRememberPasswordModes(
+ css::ucb::RememberAuthentication& Default ) override;
+ virtual void SAL_CALL
+ setRememberPassword( css::ucb::RememberAuthentication Remember ) override;
+
+ virtual sal_Bool SAL_CALL
+ canSetAccount() override;
+ virtual void SAL_CALL
+ setAccount( const OUString& Account ) override;
+
+ virtual css::uno::Sequence< css::ucb::RememberAuthentication > SAL_CALL
+ getRememberAccountModes(
+ css::ucb::RememberAuthentication& Default ) override;
+ virtual void SAL_CALL
+ setRememberAccount( css::ucb::RememberAuthentication Remember ) override;
+
+ // XInteractionSupplyAuthentication2
+ virtual sal_Bool SAL_CALL canUseSystemCredentials( sal_Bool& Default ) override;
+ virtual void SAL_CALL setUseSystemCredentials( sal_Bool UseSystemCredentials ) override;
+
+ // Non-interface methods.
+
+ /**
+ * This method returns the realm that was supplied by the interaction
+ * handler.
+ *
+ * @return the realm.
+ */
+ const OUString & getRealm() const { return m_aRealm; }
+
+ /**
+ * This method returns the username that was supplied by the interaction
+ * handler.
+ *
+ * @return the username.
+ */
+ const OUString & getUserName() const { return m_aUserName; }
+
+ /**
+ * This method returns the password that was supplied by the interaction
+ * handler.
+ *
+ * @return the password.
+ */
+ const OUString & getPassword() const { return m_aPassword; }
+
+ /**
+ * This method returns the authentication remember-mode for the password
+ * that was supplied by the interaction handler.
+ *
+ * @return the remember-mode for the password.
+ */
+ const css::ucb::RememberAuthentication &
+ getRememberPasswordMode() const { return m_eRememberPasswordMode; }
+
+ bool getUseSystemCredentials() const { return m_bUseSystemCredentials; }
+};
+
+
+
+inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
+ InteractionRequest * pRequest,
+ bool bCanSetRealm,
+ bool bCanSetUserName,
+ bool bCanSetPassword,
+ bool bCanSetAccount,
+ const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberPasswordModes,
+ const css::ucb::RememberAuthentication eDefaultRememberPasswordMode,
+ const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberAccountModes,
+ const css::ucb::RememberAuthentication eDefaultRememberAccountMode,
+ bool bCanUseSystemCredentials )
+: InteractionContinuation( pRequest ),
+ m_aRememberPasswordModes( rRememberPasswordModes ),
+ m_aRememberAccountModes( rRememberAccountModes ),
+ m_eRememberPasswordMode( eDefaultRememberPasswordMode ),
+ m_eDefaultRememberPasswordMode( eDefaultRememberPasswordMode ),
+ m_eDefaultRememberAccountMode( eDefaultRememberAccountMode ),
+ m_bCanSetRealm( bCanSetRealm ),
+ m_bCanSetUserName( bCanSetUserName ),
+ m_bCanSetPassword( bCanSetPassword ),
+ m_bCanSetAccount( bCanSetAccount ),
+ m_bCanUseSystemCredentials( bCanUseSystemCredentials ),
+ m_bUseSystemCredentials( false )
+{
+}
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionReplaceExistingData. Instances of this class can be
+ * passed along with an interaction request to indicate the possibility to
+ * replace existing data.
+ */
+class InteractionReplaceExistingData final :
+ public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::ucb::XInteractionReplaceExistingData
+{
+public:
+ InteractionReplaceExistingData( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+class UCBHELPER_DLLPUBLIC InteractionAuthFallback final :
+ public InteractionContinuation,
+ public css::ucb::XInteractionAuthFallback
+{
+ OUString m_aCode;
+
+public:
+ InteractionAuthFallback( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+
+ // XAuthFallback
+ virtual void SAL_CALL setCode( const OUString& code ) override;
+ /// @throws css::uno::RuntimeException
+ const OUString& getCode() const;
+
+
+};
+
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/interceptedinteraction.hxx b/include/ucbhelper/interceptedinteraction.hxx
new file mode 100644
index 000000000..78344c319
--- /dev/null
+++ b/include/ucbhelper/interceptedinteraction.hxx
@@ -0,0 +1,281 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_INTERCEPTEDINTERACTION_HXX
+#define INCLUDED_UCBHELPER_INTERCEPTEDINTERACTION_HXX
+
+#include <vector>
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::task { class XInteractionRequest; }
+
+
+namespace ucbhelper{
+
+
+/** @short it wraps any other interaction handler and intercept
+ its handle() requests.
+
+ @descr This class can be used as:
+ - instance if special interactions must be suppressed
+ only
+ - or as base class if interactions must be modified.
+ */
+// extra struct to work around MSVC linking issue
+struct InterceptedInteraction_Base : public ::cppu::WeakImplHelper< css::task::XInteractionHandler > {};
+
+class UCBHELPER_DLLPUBLIC InterceptedInteraction : public InterceptedInteraction_Base
+{
+
+ // types
+ public:
+
+ struct InterceptedRequest
+ {
+
+ /** @short marks an Handle as invalid.
+ */
+ static const sal_Int32 INVALID_HANDLE = -1;
+
+
+ /** @short contains the interaction request, which should be intercepted. */
+ css::uno::Any Request;
+
+
+ /** @short specify the fix continuation, which must be selected, if the
+ interaction could be intercepted successfully.
+ */
+ css::uno::Type Continuation;
+
+
+ /** @short it's a unique identifier, which must be managed by the outside code.
+
+ @descr If there is a derived class, which overwrites the InterceptedInteraction::intercepted()
+ method, it will be called with a reference to an InterceptedRequest struct.
+ Then it can use the handle to react without checking the request type again.
+ */
+ sal_Int32 Handle;
+
+
+ /** @short default ctor.
+
+ @descr Such constructed object can't be used really.
+ Might it will crash if it's used!
+ Don't forget to initialize all(!) members...
+ */
+ InterceptedRequest()
+ {
+ Handle = INVALID_HANDLE;
+ }
+ InterceptedRequest(css::uno::Any Request_, css::uno::Type Continuation_, sal_Int32 Handle_)
+ : Request(std::move(Request_)), Continuation(std::move(Continuation_)), Handle(Handle_)
+ {
+ }
+
+ };
+
+
+ /** @short represent the different states, which can occur
+ as result of an interception.
+
+ @see impl_interceptRequest()
+ */
+ enum EInterceptionState
+ {
+ /** none of the specified interceptions match the incoming request */
+ E_NOT_INTERCEPTED,
+ /** the request could be intercepted - but the specified continuation could not be located.
+ That's normally an error of the programmer. May be the interaction request does not use
+ the right set of continuations ... or the interception list contains the wrong continuation. */
+ E_NO_CONTINUATION_FOUND,
+ /** the request could be intercepted and the specified continuation could be selected successfully. */
+ E_INTERCEPTED
+ };
+
+
+ // member
+ protected:
+
+
+ /** @short reference to the intercepted interaction handler.
+
+ @descr NULL is allowed for this member!
+ All interaction will be aborted then ...
+ expecting th handle() was overwritten by
+ a derived class.
+ */
+ css::uno::Reference< css::task::XInteractionHandler > m_xInterceptedHandler;
+
+
+ /** @short these list contains the requests, which should be intercepted.
+ */
+ ::std::vector< InterceptedRequest > m_lInterceptions;
+
+
+ // native interface
+ public:
+
+
+ /** @short initialize a new instance with default values.
+ */
+ InterceptedInteraction();
+
+
+ /** @short initialize a new instance with the interaction handler,
+ which should be intercepted.
+
+ @attention If such interaction handler isn't set here,
+ all incoming requests will be aborted ...
+ if the right continuation is available!
+
+ @param xInterceptedHandler
+ the outside interaction handler, which should
+ be intercepted here.
+ */
+ void setInterceptedHandler(const css::uno::Reference< css::task::XInteractionHandler >& xInterceptedHandler);
+
+
+ /** @short set a new list of intercepted interactions.
+
+ @attention If the interface method handle() will be overwritten by
+ a derived class, the functionality behind these static list
+ can't be used.
+
+ @param lInterceptions
+ the list of intercepted requests.
+ */
+ void setInterceptions(::std::vector< InterceptedRequest >&& lInterceptions);
+
+
+ /** @short extract a requested continuation from the list of available ones.
+
+ @param lContinuations
+ the list of available continuations.
+
+ @param aType
+ is used to locate the right continuation,
+ by checking its interface type.
+
+ @return A valid reference to the continuation, if it could be located...
+ or an empty reference otherwise.
+ */
+ static css::uno::Reference< css::task::XInteractionContinuation > extractContinuation(
+ const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >& lContinuations,
+ const css::uno::Type& aType );
+
+
+ // usable for derived classes
+ protected:
+
+
+ /** @short can be overwritten by a derived class to handle interceptions
+ outside.
+
+ @descr This base implementation checks, if the request could be intercepted
+ successfully. Then this method intercepted() is called.
+ The default implementation returns "NOT_INTERCEPTED" every time.
+ So the method impl_interceptRequest() uses the right continuation automatically.
+
+ If this method was overwritten and something different "NO_INTERCEPTED"
+ is returned, the method impl_interceptRequest() will return immediately with
+ the result, which is returned by this intercepted() method.
+ Then the continuations must be selected inside the intercepted() call!
+
+ @param rRequest
+ it points to the intercepted request (means the item of the
+ set interception list). e.g. its "Handle" member can be used
+ to identify it and react very easy, without the need to check the
+ type of the exception ...
+
+ @param xOrgRequest
+ points to the original interaction, which was intercepted.
+ It provides access to the exception and the list of possible
+ continuations.
+
+ @return The result of this operation.
+ Note: If E_NOT_INTERCEPTED is returned the default handling of the base class
+ will be used automatically for this request!
+ */
+ virtual EInterceptionState intercepted(const InterceptedRequest& rRequest ,
+ const css::uno::Reference< css::task::XInteractionRequest >& xOrgRequest);
+
+
+ // uno interface
+ public:
+
+
+ /** @short implements the default handling of this class...
+ or can be overwritten by any derived class.
+
+ @descr If no further class is derived from this one
+ -> the default implementation is used. Then the
+ internal list of requests is used to handle different
+ interactions automatically.
+ (see impl_interceptRequest())
+
+ If this method was overwritten by a derived implementation
+ -> the new implementation has to do everything by itself.
+ Of course it can access all members/helpers and work with it.
+ But the default implementation is not used automatically then.
+
+ @param xRequest
+ the interaction request, which should be intercepted.
+ */
+ virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest) override;
+
+
+ // helper
+ private:
+
+
+ /** @short implements the default handling:
+ - intercept or forward to internal handler.
+ */
+ UCBHELPER_DLLPRIVATE void impl_handleDefault(const css::uno::Reference< css::task::XInteractionRequest >& xRequest);
+
+
+ /** @short implements the interception of requests.
+
+ @descr The incoming request will be analyzed, if it match
+ any request of the m_lIntercepions list.
+ If an interception could be found, its continuation will be
+ searched and selected.
+
+ The method return the state of that operation.
+ But it doesn't call the intercepted and here set
+ interaction handler. That has to be done in the outside method.
+
+ @param xRequest
+ the interaction request, which should be intercepted.
+
+ @return A identifier, which indicates if the request was intercepted,
+ the continuation was found and selected... or not.
+ */
+ UCBHELPER_DLLPRIVATE EInterceptionState impl_interceptRequest(const css::uno::Reference< css::task::XInteractionRequest >& xRequest);
+};
+
+} // namespace ucbhelper
+
+#endif // INCLUDED_UCBHELPER_INTERCEPTEDINTERACTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/macros.hxx b/include/ucbhelper/macros.hxx
new file mode 100644
index 000000000..ecdbeef70
--- /dev/null
+++ b/include/ucbhelper/macros.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_MACROS_HXX
+#define INCLUDED_UCBHELPER_MACROS_HXX
+
+#include <sal/types.h>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+#define CPPU_TYPE( T ) cppu::UnoType<T>::get()
+#define CPPU_TYPE_REF( T ) CPPU_TYPE( T )
+
+// XTypeProvider impl. internals
+
+
+#define XTYPEPROVIDER_COMMON_IMPL( Class ) \
+css::uno::Sequence< sal_Int8 > SAL_CALL \
+Class::getImplementationId() \
+{ \
+ return css::uno::Sequence<sal_Int8>(); \
+}
+
+#define GETTYPES_IMPL_START( Class ) \
+css::uno::Sequence< css::uno::Type > SAL_CALL \
+Class::getTypes() \
+{ \
+ static cppu::OTypeCollection collection(
+
+
+#define GETTYPES_IMPL_END \
+ ); \
+ \
+ return collection.getTypes(); \
+}
+
+
+// XTypeProvider impl.
+
+
+// 2 interfaces supported
+#define XTYPEPROVIDER_IMPL_2( Class, I1,I2 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ) \
+GETTYPES_IMPL_END
+
+// 3 interfaces supported
+#define XTYPEPROVIDER_IMPL_3( Class, I1,I2,I3 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ) \
+GETTYPES_IMPL_END
+
+// 4 interfaces supported
+#define XTYPEPROVIDER_IMPL_4( Class, I1,I2,I3,I4 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ) \
+GETTYPES_IMPL_END
+
+// 5 interfaces supported
+#define XTYPEPROVIDER_IMPL_5( Class, I1,I2,I3,I4,I5 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ) \
+GETTYPES_IMPL_END
+
+// 9 interfaces supported
+#define XTYPEPROVIDER_IMPL_9( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ) \
+GETTYPES_IMPL_END
+
+// 10 interfaces supported
+#define XTYPEPROVIDER_IMPL_10( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ) \
+GETTYPES_IMPL_END
+
+// 11 interfaces supported
+#define XTYPEPROVIDER_IMPL_11( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ) \
+GETTYPES_IMPL_END
+
+#endif /* ! INCLUDED_UCBHELPER_MACROS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/propertyvalueset.hxx b/include/ucbhelper/propertyvalueset.hxx
new file mode 100644
index 000000000..ea088e910
--- /dev/null
+++ b/include/ucbhelper/propertyvalueset.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_PROPERTYVALUESET_HXX
+#define INCLUDED_UCBHELPER_PROPERTYVALUESET_HXX
+
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <cppuhelper/implbase.hxx>
+
+#include <mutex>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace com::sun::star::script {
+ class XTypeConverter;
+}
+
+namespace com::sun::star::beans {
+ class XPropertySet;
+}
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+enum class PropsSet;
+namespace ucbhelper_impl { struct PropertyValue; }
+
+namespace ucbhelper {
+
+class PropertyValues;
+
+
+/**
+ * This class implements the interface XRow. After construction of a valueset
+ * the user can append properties ( incl. its values ) to the set. This class
+ * is useful when implementing the command "getPropertyValues", because the
+ * values to return can easily appended to a valueset object. That object can
+ * directly be returned by the implementation of the command.
+ */
+class UCBHELPER_DLLPUBLIC PropertyValueSet final :
+ public cppu::WeakImplHelper<
+ css::sdbc::XRow,
+ css::sdbc::XColumnLocate>
+{
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::script::XTypeConverter > m_xTypeConverter;
+ std::mutex m_aMutex;
+ std::unique_ptr<PropertyValues> m_pValues;
+ bool m_bWasNull;
+ bool m_bTriedToGetTypeConverter;
+
+private:
+ UCBHELPER_DLLPRIVATE const css::uno::Reference< css::script::XTypeConverter >&
+ getTypeConverter();
+
+ template <class T, T ucbhelper_impl::PropertyValue::*_member_name_>
+ T getValue(PropsSet nTypeName, sal_Int32 columnIndex);
+
+ template <class T, T ucbhelper_impl::PropertyValue::*_member_name_>
+ void appendValue(const OUString& rPropName, PropsSet nTypeName, const T& rValue);
+
+public:
+ PropertyValueSet(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ virtual ~PropertyValueSet() override;
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull() override;
+ virtual OUString SAL_CALL
+ getString( sal_Int32 columnIndex ) override;
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex ) override;
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex ) override;
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex ) override;
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex ) override;
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex ) override;
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex ) override;
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex ) override;
+ virtual css::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex ) override;
+ virtual css::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex ) override;
+ virtual css::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const css::uno::Reference<
+ css::container::XNameAccess >& typeMap ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex ) override;
+
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL
+ findColumn( const OUString& columnName ) override;
+
+
+ // Non-interface methods
+
+ void appendString( const OUString& rPropName, const OUString& rValue );
+ void appendString( const css::beans::Property& rProp, const OUString& rValue )
+ {
+ appendString( rProp.Name, rValue );
+ }
+
+ void appendBoolean( const OUString& rPropName, bool bValue );
+ void appendBoolean( const css::beans::Property& rProp, bool bValue )
+ {
+ appendBoolean( rProp.Name, bValue );
+ }
+
+ void appendLong( const OUString& rPropName, sal_Int64 nValue );
+ void appendLong( const css::beans::Property& rProp, sal_Int64 nValue )
+ {
+ appendLong( rProp.Name, nValue );
+ }
+
+ void appendTimestamp( const OUString& rPropName, const css::util::DateTime& rValue );
+ void appendTimestamp( const css::beans::Property& rProp, const css::util::DateTime& rValue )
+ {
+ appendTimestamp( rProp.Name, rValue );
+ }
+
+ void appendObject( const OUString& rPropName, const css::uno::Any& rValue );
+ void appendObject( const css::beans::Property& rProp, const css::uno::Any& rValue )
+ {
+ appendObject( rProp.Name, rValue );
+ }
+
+ void appendVoid( const OUString& rPropName );
+ void appendVoid( const css::beans::Property& rProp )
+ {
+ appendVoid( rProp.Name );
+ }
+
+ /**
+ * This method tries to append all property values contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ */
+ void appendPropertySet( const css::uno::Reference< css::beans::XPropertySet >& rSet );
+
+ /** This method tries to append a single property value contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ * @param rProperty is the property for that the value shall be obtained
+ * from the given property set.
+ * @return False, if the property value cannot be obtained from the
+ * given property pet. True, otherwise.
+ */
+ bool appendPropertySetValue(
+ const css::uno::Reference< css::beans::XPropertySet >& rSet,
+ const css::beans::Property& rProperty );
+};
+
+}
+
+#endif /* ! INCLUDED_UCBHELPER_PROPERTYVALUESET_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/providerhelper.hxx b/include/ucbhelper/providerhelper.hxx
new file mode 100644
index 000000000..550da6c0e
--- /dev/null
+++ b/include/ucbhelper/providerhelper.hxx
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_PROVIDERHELPER_HXX
+#define INCLUDED_UCBHELPER_PROVIDERHELPER_HXX
+
+#include <vector>
+#include <memory>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase.hxx>
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+
+namespace com::sun::star::ucb {
+ class XPropertySetRegistry;
+ class XPersistentPropertySet;
+}
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace ucbhelper_impl { struct ContentProviderImplHelper_Impl; }
+
+namespace ucbhelper {
+
+
+class ContentImplHelper;
+typedef rtl::Reference< ContentImplHelper > ContentImplHelperRef;
+typedef std::vector< ContentImplHelperRef > ContentRefList;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.ContentProvider. It provides contents derived from
+ * class ucb::ContentImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - maintains a set of ContentImplHelper objects, which were created by
+ * the provider implementation. So there will be exactly one object for
+ * one Content Identifier.
+ * - Provides access to the Additional Core PropertySet of a content.
+ * ( These set contains the properties added to a content using its
+ * XPropertyContainer interface )
+ */
+class UCBHELPER_DLLPUBLIC ContentProviderImplHelper :
+ public cppu::WeakImplHelper<
+ css::lang::XServiceInfo,
+ css::ucb::XContentProvider>
+{
+ friend class ContentImplHelper;
+
+ std::unique_ptr<ucbhelper_impl::ContentProviderImplHelper_Impl> m_pImpl;
+
+protected:
+ osl::Mutex m_aMutex;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+private:
+ UCBHELPER_DLLPRIVATE void removeContent( ContentImplHelper* pContent );
+
+ UCBHELPER_DLLPRIVATE css::uno::Reference< css::ucb::XPropertySetRegistry >
+ getAdditionalPropertySetRegistry();
+
+ UCBHELPER_DLLPRIVATE void cleanupRegisteredContents();
+
+protected:
+ /**
+ * This method returns a content with the given id, if it already exists.
+ * Use this method in your "queryContent" implementation to ensure unique
+ * objects.
+ *
+ * @param Identifier is the content identifier, for that an existing
+ * content object is requested.
+ * @return the content with the given identifier, if it exists or 0, if it
+ * does not exist.
+ */
+ rtl::Reference< ContentImplHelper >
+ queryExistingContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier );
+
+ /**
+ * This method returns a content with the given URL, if it already exists.
+ *
+ * @param rURL is the URL ( content identifier string ), for that an
+ * existing content object is requested.
+ * @return the content with the given URL, if it exists or 0, if it
+ * does not exist.
+ */
+ rtl::Reference< ContentImplHelper >
+ queryExistingContent( const OUString& rURL );
+
+ /**
+ * This method registers a newly created content instance with the
+ * content provider. It should be called directly after creating a new
+ * content instance. The provider can reuse a registered instance upon
+ * subsequent requests for content instances with an identifier
+ * of a registered instance.
+ * Note that the provider does not hold a hard reference on the
+ * registered instance. If last external reference is gone, the provider
+ * will remove the instance from its inventory of known instances.
+ * Nothing will happen in case an already registered instance shall
+ * be registered more than once.
+ *
+ * @param the content instance that is to be registered.
+ */
+ void registerNewContent(
+ const css::uno::Reference< css::ucb::XContent > & xContent );
+
+public:
+
+
+ // Construction/Destruction
+
+
+ ContentProviderImplHelper(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ virtual ~ContentProviderImplHelper() override;
+
+
+ // XServiceInfo
+
+
+ virtual OUString SAL_CALL
+ getImplementationName() override = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() override = 0;
+
+
+ // XContentProvider
+
+
+ /**
+ * This method returns a content with the requested id.
+ *
+ * The implementation should:
+ *
+ * - Check, whether the Identifier is valid ( URL syntax ).
+ * - Use queryExistingContent(...) to determine, whether there exists
+ * already a content with the given id.
+ * - Return the possibly existing content.Create and return a new
+ * content, otherwise
+ */
+ virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
+ queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override = 0;
+ virtual sal_Int32 SAL_CALL
+ compareContentIds( const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
+ const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
+
+
+ // Non-interface methods.
+
+
+ /**
+ * This method returns a mutex, which protects the content list of the
+ * provider. So you can prevent modifications of that list easily.
+ *
+ * @return the mutex.
+ */
+ osl::Mutex& getContentListMutex() { return m_aMutex; }
+
+ /**
+ * This method fills a list with all contents existing at calling time.
+ * Note: You may prevent modifications of the content list at any time
+ * by acquiring the content list mutex of the provider.
+ *
+ * @param rContents is the list to fill with the children.
+ */
+ void queryExistingContents( ContentRefList& rContents );
+
+ /**
+ * This method returns the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key for the propertyset.
+ * @param bCreate is a flag indicating whether the propertyset shall
+ * be created in case it does not exist.
+ * @return the propertyset containing the Additional Core Properties.
+ */
+ css::uno::Reference< css::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( const OUString& rKey, bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be renamed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool renameAdditionalPropertySet( const OUString& rOldKey,
+ const OUString& rNewKey,
+ bool bRecursive );
+
+ /**
+ * This method copies the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rSourceKey is the key of the source propertyset.
+ * @param rTargetKey is the key of the target propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rSourceKey shall be copied, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool copyAdditionalPropertySet( const OUString& rSourceKey,
+ const OUString& rTargetKey,
+ bool bRecursive );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key of the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be removed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool removeAdditionalPropertySet( const OUString& rKey,
+ bool bRecursive );
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_PROVIDERHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/proxydecider.hxx b/include/ucbhelper/proxydecider.hxx
new file mode 100644
index 000000000..9a1abad32
--- /dev/null
+++ b/include/ucbhelper/proxydecider.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_PROXYDECIDER_HXX
+#define INCLUDED_UCBHELPER_PROXYDECIDER_HXX
+
+#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+namespace ucbhelper
+{
+
+/**
+ * This struct describes a proxy server.
+ */
+struct InternetProxyServer
+{
+ /**
+ * The name of the proxy server.
+ */
+ OUString aName;
+
+ /**
+ * The port of the proxy server.
+ */
+ sal_Int32 nPort;
+
+ /**
+ * Constructor.
+ */
+ InternetProxyServer() : nPort( -1 ) {}
+};
+
+namespace proxydecider_impl { class InternetProxyDecider_Impl; }
+
+/**
+ * This class is able to decide whether and which internet proxy server is to
+ * be used to access a given URI.
+ *
+ * The implementation reads the internet proxy settings from Office
+ * configuration. It listens for configuration changes and adapts itself
+ * accordingly. Because configuration data can change during runtime clients
+ * should not cache results obtained from InternetProxyDecider instances. One
+ * instance should be kept to be queried multiple times instead.
+ */
+class UCBHELPER_DLLPUBLIC InternetProxyDecider
+{
+public:
+ /**
+ * Constructor.
+ *
+ * Note: Every instance should be held alive as long as possible because
+ * because construction is quite expensive.
+ *
+ * @param rxSMgr is a Service Manager.
+ */
+ InternetProxyDecider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+ /**
+ * Destructor.
+ */
+ ~InternetProxyDecider();
+
+ /**
+ * Informs whether a proxy server should be used.
+ *
+ * @param rProtocol contains the internet protocol to be used to
+ * access the server (i.e. "ftp", "http"). The protocol string
+ * is handled case-insensitive and must not be empty.
+ * @param rHost contains the name of the server that should be accessed.
+ * This parameter might be left empty. In this case the
+ * implementation will return whether a proxy is configured
+ * for the given protocol.
+ * @param nPort contains the port of the server that should be accessed.
+ * If host is not empty this parameter must always contain a valid
+ * port number, for instance the default port for the requested
+ * protocol(i.e. 80 or http).
+ * @return true if a proxy server should be used, false otherwise.
+ */
+ bool
+ shouldUseProxy( const OUString & rProtocol,
+ const OUString & rHost,
+ sal_Int32 nPort ) const;
+
+ /**
+ * Returns the proxy server to be used.
+ *
+ * @param rProtocol contains the internet protocol to be used to
+ * access the server (i.e. "ftp", "http"). The protocol string
+ * is handled case-insensitive and must not be empty.
+ * @param rHost contains the name of the server that should be accessed.
+ * This parameter might be left empty. In this case the
+ * implementation will return the proxy that is configured
+ * for the given protocol.
+ * @param nPort contains the port of the server that should be accessed.
+ * If host is not empty this parameter must always contain a valid
+ * port number, for instance the default port for the requested
+ * protocol(i.e. 80 or http).
+ * @return a InternetProxyServer struct. If member aName of the
+ * InternetProxyServer is empty no proxy server is to be used.
+ */
+ InternetProxyServer
+ getProxy( const OUString & rProtocol,
+ const OUString & rHost,
+ sal_Int32 nPort ) const;
+
+private:
+ rtl::Reference<proxydecider_impl::InternetProxyDecider_Impl> m_xImpl;
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_PROXYDECIDER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/registerucb.hxx b/include/ucbhelper/registerucb.hxx
new file mode 100644
index 000000000..1e103f927
--- /dev/null
+++ b/include/ucbhelper/registerucb.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_REGISTERUCB_HXX
+#define INCLUDED_UCBHELPER_REGISTERUCB_HXX
+
+#include <rtl/ustring.hxx>
+#include <vector>
+
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace com::sun::star {
+ namespace uno { class XComponentContext; }
+ namespace ucb { class XContentProviderManager; }
+}
+
+
+namespace ucbhelper {
+
+
+/** Information about a content provider, passed to
+ <method>configureUcb</method>.
+ */
+struct ContentProviderData
+{
+ /** The UNO service name to use to instantiate the content provider.
+
+ If it is the empty string, a null provider will be used (see the
+ documentation of the Provider argument to
+ com.sun.star.ucb.XContentProviderManager.registerContentProvider).
+ */
+ OUString ServiceName;
+
+ /** The URL template to use to instantiate the content provider.
+ */
+ OUString URLTemplate;
+
+ /** The arguments to use to instantiate the content provider.
+ */
+ OUString Arguments;
+};
+
+typedef std::vector< ContentProviderData > ContentProviderDataList;
+
+/** Register a content provider at a Universal Content Broker.
+
+ @param rManager A content provider manager (normally, this would be a
+ UCB). May be null, which is only useful if the content provider is an
+ XParameterizedContentProviders.
+
+ @param rServiceFactory A factory through which to obtain the required
+ services.
+
+ @param rName The service name of the content provider. If it is the empty
+ string, a null provider will be used (see the documentation of the Provider
+ argument to
+ com.sun.star.ucb.XContentProviderManager.registerContentProvider).
+
+ @param rArguments Any arguments to instantiate the content provider with.
+
+ @param rTemplate The URL template to register the content provider on.
+
+ @param pInfo If not null, this output parameter is filled with
+ information about the (attemptively) registered provider.
+
+ @throws css::uno::RuntimeException
+ */
+
+UCBHELPER_DLLPUBLIC bool registerAtUcb(
+ css::uno::Reference< css::ucb::XContentProviderManager > const & rManager,
+ css::uno::Reference< css::uno::XComponentContext > const & rxContext,
+ OUString const & rName,
+ OUString const & rArguments,
+ OUString const & rTemplate);
+
+}
+#endif // INCLUDED_UCBHELPER_REGISTERUCB_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/resultset.hxx b/include/ucbhelper/resultset.hxx
new file mode 100644
index 000000000..6790c3dd1
--- /dev/null
+++ b/include/ucbhelper/resultset.hxx
@@ -0,0 +1,435 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_RESULTSET_HXX
+#define INCLUDED_UCBHELPER_RESULTSET_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::ucb { class XCommandEnvironment; }
+
+namespace ucbhelper {
+
+
+inline constexpr OUStringLiteral RESULTSET_SERVICE_NAME = u"com.sun.star.ucb.ContentResultSet";
+
+
+class ResultSetDataSupplier;
+struct ResultSet_Impl;
+
+/**
+ * This is an implementation of the service com.sun.star.ucb.ContentResultSet.
+ * It can be used to implement the method XDynamicResultSet::getStaticResultSet,
+ * which needs to be implemented for instance to implement the command "open"
+ * at folder objects. This class uses a user supplied ResultSetDataSupplier
+ * object to request data on demand.
+ *
+ * @see ResultSetDataSupplier
+ */
+class UCBHELPER_DLLPUBLIC ResultSet final :
+ public cppu::WeakImplHelper<
+ css::lang::XServiceInfo,
+ css::lang::XComponent,
+ css::ucb::XContentAccess,
+ css::sdbc::XResultSet,
+ css::sdbc::XResultSetMetaDataSupplier,
+ css::sdbc::XRow,
+ css::sdbc::XCloseable,
+ css::beans::XPropertySet>
+{
+ std::unique_ptr<ResultSet_Impl> m_pImpl;
+
+public:
+ /**
+ * Construction.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProperties is a sequence of properties for that the resultset
+ * shall be able to obtain the values.
+ * @param rDataSupplier is a supplier for the resultset data.
+ */
+ ResultSet(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier );
+ /**
+ * Construction.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProperties is a sequence of properties for that the resultset
+ * shall be able to obtain the values.
+ * @param rDataSupplier is a supplier for the resultset data.
+ * @param rxEnv is the environment for interactions, progress propagation,
+ * ...
+ */
+ ResultSet(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& rxEnv );
+ virtual ~ResultSet() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XComponent
+ virtual void SAL_CALL
+ dispose() override;
+ virtual void SAL_CALL
+ addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+
+ // XContentAccess
+ virtual OUString SAL_CALL
+ queryContentIdentifierString() override;
+ virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
+ queryContentIdentifier() override;
+ virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
+ queryContent() override;
+
+ // XResultSetMetaDataSupplier
+ virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL
+ getMetaData() override;
+
+ // XResultSet
+ virtual sal_Bool SAL_CALL
+ next() override;
+ virtual sal_Bool SAL_CALL
+ isBeforeFirst() override;
+ virtual sal_Bool SAL_CALL
+ isAfterLast() override;
+ virtual sal_Bool SAL_CALL
+ isFirst() override;
+ virtual sal_Bool SAL_CALL
+ isLast() override;
+ virtual void SAL_CALL
+ beforeFirst() override;
+ virtual void SAL_CALL
+ afterLast() override;
+ virtual sal_Bool SAL_CALL
+ first() override;
+ virtual sal_Bool SAL_CALL
+ last() override;
+ virtual sal_Int32 SAL_CALL
+ getRow() override;
+ virtual sal_Bool SAL_CALL
+ absolute( sal_Int32 row ) override;
+ virtual sal_Bool SAL_CALL
+ relative( sal_Int32 rows ) override;
+ virtual sal_Bool SAL_CALL
+ previous() override;
+ virtual void SAL_CALL
+ refreshRow() override;
+ virtual sal_Bool SAL_CALL
+ rowUpdated() override;
+ virtual sal_Bool SAL_CALL
+ rowInserted() override;
+ virtual sal_Bool SAL_CALL
+ rowDeleted() override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
+ getStatement() override;
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull() override;
+ virtual OUString SAL_CALL
+ getString( sal_Int32 columnIndex ) override;
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex ) override;
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex ) override;
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex ) override;
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex ) override;
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex ) override;
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex ) override;
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex ) override;
+ virtual css::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex ) override;
+ virtual css::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex ) override;
+ virtual css::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
+ virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex ) override;
+
+ // XCloseable
+ virtual void SAL_CALL
+ close() override;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() override;
+ virtual void SAL_CALL
+ setPropertyValue( const OUString& aPropertyName,
+ const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL
+ getPropertyValue( const OUString& PropertyName ) override;
+ virtual void SAL_CALL
+ addPropertyChangeListener( const OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
+ virtual void SAL_CALL
+ removePropertyChangeListener( const OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
+ virtual void SAL_CALL
+ addVetoableChangeListener( const OUString& PropertyName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+ virtual void SAL_CALL
+ removeVetoableChangeListener( const OUString& PropertyName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+
+
+ // Non-interface methods.
+
+
+ /**
+ * This method propagates property value changes to all registered
+ * listeners.
+ *
+ * @param rEvt is a property change event.
+ */
+ void propertyChanged(
+ const css::beans::PropertyChangeEvent& rEvt ) const;
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were new data obtained from the data source.
+ *
+ * @param nOld is the old count of rows; must be non-negative.
+ * @param nnew is the new count of rows; must be non-negative.
+ */
+ void rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew );
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were all rows obtained from the data source.
+ */
+ void rowCountFinal();
+
+ /**
+ * This method returns a sequence containing all properties ( not the
+ * values! ) of the result set.
+ *
+ * @return a sequence of properties.
+ */
+ const css::uno::Sequence< css::beans::Property >&
+ getProperties() const;
+
+ /**
+ * This method returns the environment to use for interactions, progress
+ * propagation, ... It can by empty.
+ *
+ * @return an environment or an empty reference.
+ */
+ const css::uno::Reference< css::ucb::XCommandEnvironment >&
+ getEnvironment() const;
+};
+
+
+/**
+ * This is the base class for an object that supplies data to a result set
+ *
+ * @see ResultSet
+ */
+class ResultSetDataSupplier : public salhelper::SimpleReferenceObject
+{
+ friend class ResultSet;
+
+ // No ref, otherwise we get a cyclic reference between supplier and set!
+ // Will be set from ResultSet ctor.
+ ResultSet* m_pResultSet;
+
+public:
+ ResultSetDataSupplier() : m_pResultSet( nullptr ) {}
+
+ /**
+ * This method returns the resultset this supplier belongs to.
+ *
+ * @return the resultset for that the supplier supplies data.
+ */
+ rtl::Reference< ResultSet > getResultSet() const { return m_pResultSet; }
+
+ /**
+ * This method returns the identifier string of the content at the
+ * specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return the content's identifier string.
+ */
+ virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the identifier of the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return the content's identifier.
+ */
+ virtual css::uno::Reference< css::ucb::XContentIdentifier >
+ queryContentIdentifier( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return the content.
+ */
+ virtual css::uno::Reference< css::ucb::XContent >
+ queryContent( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns whether there is a content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return true, if there is a content at the given index.
+ */
+ virtual bool getResult( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the total count of objects in the logical data array
+ * of the supplier. The implementation of this method may be very
+ * "expensive", because it can be necessary to obtain all data in order
+ * to determine the count. Therefore the ResultSet implementation calls
+ * it very seldom.
+ *
+ * @return the total count of objects; will always be non-negative.
+ */
+ virtual sal_uInt32 totalCount() = 0;
+
+ /**
+ * This method returns the count of objects obtained so far. There is no
+ * for the implementation to obtain all objects at once. It can obtain
+ * all data on demand.
+ *
+ * The implementation should call m_pResultSet->rowCountChanged(...)
+ * every time it has inserted a new entry in its logical result array.
+ *
+ * @return the count of objects obtained so far; will always be
+ * non-negative.
+ */
+ virtual sal_uInt32 currentCount() = 0;
+
+ /**
+ * This method returns whether the value returned by currentCount() is
+ * "final". This is the case, if that there was all data obtained by the
+ * supplier and the current count won't increase any more.
+ *
+ * The implementation should call m_pResultSet->rowCountFinal(...) if
+ * it has inserted all entries in its logical result array.
+ *
+ * @return true, if the value returned by currentCount() won't change
+ anymore.
+ */
+ virtual bool isCountFinal() = 0;
+
+ /**
+ * This method returns an object for accessing the property values at
+ * the specified index. The implementation may use the helper class
+ * ucb::PropertyValueSet to provide the return value.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the object for accessing the property values.
+ */
+ virtual css::uno::Reference< css::sdbc::XRow >
+ queryPropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method is called to instruct the supplier to release the (possibly
+ * present) property values at the given index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ */
+ virtual void releasePropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * to instruct the data supplier to release all resources it has
+ * allocated so far. In case the supplier is collecting data
+ * asynchronously, that process must be stopped.
+ */
+ virtual void close() = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * check, whether an error has occurred while collecting data. The
+ * implementation of this method must throw an exception in that case.
+ *
+ * Note: An exception thrown to indicate an error must always be thrown
+ * by the thread that created the data supplier. If the supplier collects
+ * data asynchronously ( i.e. in a separate thread ) and an error
+ * occurs, throwing of the appropriate exception must be deferred
+ * until validate() is called by the ResultSet implementation from
+ * inside the main thread.
+ * In case data are obtained synchronously, the ResultSetException can
+ * be thrown directly.
+ *
+ * @exception ResultSetException thrown, if an error has occurred
+ */
+ virtual void validate() = 0;
+};
+
+}
+
+#endif /* ! INCLUDED_UCBHELPER_RESULTSET_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/resultsethelper.hxx b/include/ucbhelper/resultsethelper.hxx
new file mode 100644
index 000000000..486d07fe5
--- /dev/null
+++ b/include/ucbhelper/resultsethelper.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_RESULTSETHELPER_HXX
+#define INCLUDED_UCBHELPER_RESULTSETHELPER_HXX
+
+#include <memory>
+#include <mutex>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#include <comphelper/interfacecontainer4.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace cppu {
+ class OInterfaceContainerHelper;
+}
+
+namespace ucbhelper {
+
+
+inline constexpr OUStringLiteral DYNAMICRESULTSET_SERVICE_NAME = u"com.sun.star.ucb.DynamicResultSet";
+
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.DynamicResultSet, which is the result of the command
+ * "open" executed at a UCB folder content.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service css::ucb::DynamicResultSet
+ */
+class UCBHELPER_DLLPUBLIC ResultSetImplHelper :
+ public cppu::WeakImplHelper<
+ css::lang::XServiceInfo,
+ css::ucb::XDynamicResultSet>
+{
+ comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aDisposeEventListeners;
+ bool m_bStatic;
+ bool m_bInitDone;
+
+protected:
+ std::mutex m_aMutex;
+ css::ucb::OpenCommandArgument2 m_aCommand;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ // Resultset #1
+ css::uno::Reference< css::sdbc::XResultSet > m_xResultSet1;
+ // Resultset #2
+ css::uno::Reference< css::sdbc::XResultSet > m_xResultSet2;
+ // Resultset changes listener.
+ css::uno::Reference< css::ucb::XDynamicResultSetListener > m_xListener;
+
+private:
+ UCBHELPER_DLLPRIVATE void init( bool bStatic );
+
+ /**
+ * Your implementation of this method has to fill the protected member
+ * m_xResultSet1. This resultset must implement a complete static
+ * resultset ( service com.sun.star.ucb.ContentResultSet ). This method
+ * will be called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "static". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively statically. You may deploy this factum to optimize your
+ * implementation (i.e. "switch off" all changes detection code in
+ * your implementation).
+ * Note that you may use the class ucb::ResultSet to implement the
+ * static resultset, that is required here.
+ */
+ UCBHELPER_DLLPRIVATE virtual void initStatic() = 0;
+
+ /**
+ * Your implementation of this method has to fill the protected members
+ * m_xResultSet1 and m_xResultSet2 of this base class. Each of these
+ * resultsets must implement a complete static resultset
+ * ( service com.sun.star.ucb.ContentResultSet ). This method will be
+ * called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "dynamic". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively dynamically. This means, it is interested in getting
+ * notifications on changes of data of the resultset contents. ( These
+ * changes are to propagate by your implementation throw the member
+ * m_xListener of this base class ).
+ * If your implementation cannot detect changes of relevant data, you
+ * may fill m_xResultSet1 and m_xResultSet2 with the same static resultset
+ * implementation object. This normally will be the same instance you put
+ * into m_xResultSet1 when initStatic() is called.
+ */
+ UCBHELPER_DLLPRIVATE virtual void initDynamic() = 0;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rxContext is a Service Manager.
+ * @param rCommand is the parameter for the open command that produces
+ * this resultset.
+ */
+ ResultSetImplHelper(
+ const css::uno::Reference<
+ css::uno::XComponentContext >& rxContext,
+ const css::ucb::OpenCommandArgument2& rCommand );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetImplHelper() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XComponent ( base class of XDynamicResultSet )
+ virtual void SAL_CALL
+ dispose() override;
+ virtual void SAL_CALL
+ addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+
+ // XDynamicResultSet
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL
+ getStaticResultSet() override;
+ virtual void SAL_CALL
+ setListener( const css::uno::Reference< css::ucb::XDynamicResultSetListener >& Listener ) override;
+ virtual void SAL_CALL
+ connectToCache( const css::uno::Reference< css::ucb::XDynamicResultSet > & xCache ) override;
+
+ /**
+ * The implementation of this method always returns 0. Override this
+ * method, if necessary.
+ */
+ virtual sal_Int16 SAL_CALL
+ getCapabilities() override;
+
+};
+
+}
+
+#endif /* ! INCLUDED_UCBHELPER_RESULTSETHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/resultsetmetadata.hxx b/include/ucbhelper/resultsetmetadata.hxx
new file mode 100644
index 000000000..856c28a0a
--- /dev/null
+++ b/include/ucbhelper/resultsetmetadata.hxx
@@ -0,0 +1,341 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_RESULTSETMETADATA_HXX
+#define INCLUDED_UCBHELPER_RESULTSETMETADATA_HXX
+
+#include <vector>
+#include <memory>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star {
+ namespace beans { struct Property; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ucbhelper_impl {
+ struct ResultSetMetaData_Impl;
+}
+
+namespace ucbhelper
+{
+
+
+/**
+ * This is a structure that holds additional meta data for one column
+ * of a resultset. The default values set in the constructor should be a
+ * good guess for many UCB use cases.
+ */
+struct ResultSetColumnData
+{
+ /** @see ResultSetMetaData::isCaseSensitive */
+ bool isCaseSensitive;
+
+ inline ResultSetColumnData();
+};
+
+// Note: Never change the initial values! Implementations using this struct
+// may heavily depend on the behaviour of the default constructor.
+
+ResultSetColumnData::ResultSetColumnData()
+: isCaseSensitive( true )
+{
+}
+
+
+/**
+ * This is an implementation of the interface XResultSetMetaData. It can be
+ * used to implement the interface
+ * css::sdbc::XResultSetMetaDataSupplier, which is required for
+ * implementations of service com.sun.star.ucb.ContentResultSet.
+ */
+class UCBHELPER_DLLPUBLIC ResultSetMetaData final :
+ public cppu::WeakImplHelper<css::sdbc::XResultSetMetaData>
+{
+ std::unique_ptr<ucbhelper_impl::ResultSetMetaData_Impl> m_pImpl;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Sequence< css::beans::Property > m_aProps;
+
+public:
+
+ /**
+ * Constructor. ResultSet is readonly by default.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProps is a sequence of properties (partially) describing the
+ * columns of a resultset.
+ */
+ ResultSetMetaData(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::Property >& rProps );
+
+ /**
+ * Constructor.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProps is a sequence of properties (partially) describing the
+ * columns of a resultset.
+ * @param rColumnData contains additional meta data for the columns of
+ * a resultset, which override the default values returned by the
+ * appropriate methods of this class. The length of rColumnData
+ * must be the same as length of rProps.
+ * rColumnData[ 0 ] corresponds to data in rProps[ 0 ],
+ * rColumnData[ 1 ] corresponds to data in rProps[ 1 ], ...
+ */
+ ResultSetMetaData(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::Property >& rProps,
+ std::vector< ResultSetColumnData >&& rColumnData );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetMetaData() override;
+
+ // XResultSetMetaData
+
+ /**
+ * Returns the number of columns of the resultset.
+ *
+ * @return the length of the property sequence.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnCount() override;
+ /**
+ * Checks whether column is automatically numbered, which makes it
+ * read-only.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if column is automatically numbered.
+ */
+ virtual sal_Bool SAL_CALL
+ isAutoIncrement( sal_Int32 column ) override;
+ /**
+ * Checks whether column is case sensitive.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if column is case sensitive.
+ */
+ virtual sal_Bool SAL_CALL
+ isCaseSensitive( sal_Int32 column ) override;
+ /**
+ * Checks whether the value stored in column can be used in a
+ * WHERE clause.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the column is searchable.
+ */
+ virtual sal_Bool SAL_CALL
+ isSearchable( sal_Int32 column ) override;
+ /**
+ * Checks whether column is a cash value.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the column is a cash value.
+ */
+ virtual sal_Bool SAL_CALL
+ isCurrency( sal_Int32 column ) override;
+ /**
+ * Checks whether a NULL can be stored in column.
+ *
+ * @see css::sdbc::ColumnValue
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return css::sdbc::ColumnValue::NULLABLE, if a NULL
+ * can be stored in the column.
+ */
+ virtual sal_Int32 SAL_CALL
+ isNullable( sal_Int32 column ) override;
+ /**
+ * Checks whether the value stored in column is a signed number.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the value stored in column is a signed number.
+ */
+ virtual sal_Bool SAL_CALL
+ isSigned( sal_Int32 column ) override;
+ /**
+ * Gets the normal maximum width in characters for column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the normal maximum width in characters for column.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnDisplaySize( sal_Int32 column ) override;
+ /**
+ * Gets the suggested column title for column, to be used in print-
+ * outs and displays.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the column label.
+ */
+ virtual OUString SAL_CALL
+ getColumnLabel( sal_Int32 column ) override;
+ /**
+ * Gets the name of column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the name of the property that corresponds to column.
+ */
+ virtual OUString SAL_CALL
+ getColumnName( sal_Int32 column ) override;
+ /**
+ * Gets the schema name for the table from which column of this
+ * result set was derived.
+ * Because this feature is not widely supported, the return value
+ * for many DBMSs will be an empty string.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the schema name of column or an empty string.
+ */
+ virtual OUString SAL_CALL
+ getSchemaName( sal_Int32 column ) override;
+ /**
+ * For number types, getprecision gets the number of decimal digits
+ * in column.
+ * For character types, it gets the maximum length in characters for
+ * column.
+ * For binary types, it gets the maximum length in bytes for column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the precision for the column.
+ */
+ virtual sal_Int32 SAL_CALL
+ getPrecision( sal_Int32 column ) override;
+ /**
+ * Gets the number of digits to the right of the decimal point for
+ * values in column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the scale of the column.
+ */
+ virtual sal_Int32 SAL_CALL
+ getScale( sal_Int32 column ) override;
+ /**
+ * Gets the name of the table from which column of this result set
+ * was derived or "" if there is none (for example, for a join).
+ * Because this feature is not widely supported, the return value
+ * for many DBMSs will be an empty string.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the table name for column or an empty string.
+ */
+ virtual OUString SAL_CALL
+ getTableName( sal_Int32 column ) override;
+ virtual OUString SAL_CALL
+ /**
+ * Gets the catalog name for the table from which column of this
+ * result set was derived.
+ * Because this feature is not widely supported, the return value
+ * for many DBMSs will be an empty string.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the catalog name for column or an empty string.
+ */
+ getCatalogName( sal_Int32 column ) override;
+ /**
+ * Gets the JDBC type for the value stored in column. ... The STRUCT
+ * and DISTINCT type codes are always returned for structured and
+ * distinct types, regardless of whether the value will be mapped
+ * according to the standard mapping or be a custom mapping.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the type of the property that corresponds to column - mapped
+ * from UNO-Type to SQL-Type.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnType( sal_Int32 column ) override;
+ /**
+ * Gets the type name used by this particular data source for the
+ * values stored in column. If the type code for the type of value
+ * stored in column is STRUCT, DISTINCT or JAVA_OBJECT, this method
+ * returns a fully-qualified SQL type name.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the column type name.
+ */
+ virtual OUString SAL_CALL
+ getColumnTypeName( sal_Int32 column ) override;
+ /**
+ * Indicates whether a column is definitely not writable.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the column is definitely not writable.
+ */
+ virtual sal_Bool SAL_CALL
+ isReadOnly( sal_Int32 column ) override;
+ /**
+ * Indicates whether it is possible for a write on the column to succeed.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if it is possible for a write to succeed.
+ */
+ virtual sal_Bool SAL_CALL
+ isWritable( sal_Int32 column ) override;
+ /**
+ * Indicates whether a write on the column will definitely succeed.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if a write on the column will definitely succeed.
+ */
+ virtual sal_Bool SAL_CALL
+ isDefinitelyWritable( sal_Int32 column ) override;
+ /**
+ * Returns the fully-qualified name of the service whose instances
+ * are manufactured if the method
+ * css::sdbc::ResultSet::getObject is called to retrieve a
+ * value from the column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the service name for column or an empty string, if no service
+ * is applicable.
+ */
+ virtual OUString SAL_CALL
+ getColumnServiceName( sal_Int32 column ) override;
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_RESULTSETMETADATA_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/simpleauthenticationrequest.hxx b/include/ucbhelper/simpleauthenticationrequest.hxx
new file mode 100644
index 000000000..69cb20ab8
--- /dev/null
+++ b/include/ucbhelper/simpleauthenticationrequest.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX
+#define INCLUDED_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::ucb {
+ class URLAuthenticationRequest;
+}
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple authentication interaction request.
+ * Instances can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains an AuthenticationRequest and three interaction
+ * continuations: "Abort", "Retry" and "SupplyAuthentication". The parameters
+ * for the AuthenticationRequest and the InteractionSupplyAuthentication
+ * objects are partly taken from constructors parameters and partly defaulted
+ * as follows:
+ *
+ * Read-only values : servername, realm
+ * Read-write values: username, password, account
+ * All remember-authentication values: RememberAuthentication_NO
+ *
+ * @see css::ucb::AuthenticationRequest
+ * @see css::ucb::RememberAuthentication
+ * @see InteractionAbort
+ * @see InteractionRetry
+ * @see InteractionSupplyAuthentication
+ */
+class UCBHELPER_DLLPUBLIC SimpleAuthenticationRequest final : public ucbhelper::InteractionRequest
+{
+ rtl::Reference<
+ ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier;
+
+private:
+ void initialize( const css::ucb::URLAuthenticationRequest & rRequest,
+ bool bCanSetRealm,
+ bool bCanSetUserName,
+ bool bCanSetPassword,
+ bool bCanSetAccount,
+ bool bAllowUseSystemCredentials,
+ bool bAllowSessionStoring );
+
+public:
+ /** Specification whether some entity (realm, username, password, account)
+ is either not applicable at all, has a fixed value, or is modifiable.
+ */
+ enum EntityType
+ {
+ ENTITY_NA,
+ ENTITY_FIXED,
+ ENTITY_MODIFY
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param rURL contains a URL for which authentication is requested.
+ * @param rServerName contains a server name.
+ * @param rRealm contains a realm, if applicable.
+ * @param rUserName contains a username, if available (for instance from
+ * a previous try).
+ * @param rPassword contains a password, if available (for instance from
+ * a previous try).
+ * @param bAllowUseSystemCredentials specifies if requesting client is
+ * able to obtain and use system credentials for authentication
+ */
+ SimpleAuthenticationRequest( const OUString & rURL,
+ const OUString & rServerName,
+ const OUString & rRealm,
+ const OUString & rUserName,
+ const OUString & rPassword,
+ bool bAllowUseSystemCredentials,
+ bool bAllowSessionStoring = true );
+
+
+ /**
+ * Constructor.
+ *
+ * @param rServerName contains a server name.
+ * @param eRealmType specifies whether a realm is applicable and
+ modifiable.
+ * @param rRealm contains a realm, if applicable.
+ * @param eUserNameType specifies whether a username is applicable and
+ modifiable.
+ * @param rUserName contains a username, if available (for instance from
+ * a previous try).
+ * @param ePasswordType specifies whether a password is applicable and
+ modifiable.
+ * @param rPassword contains a password, if available (for instance from
+ * a previous try).
+ */
+ SimpleAuthenticationRequest( const OUString & rURL,
+ const OUString & rServerName,
+ EntityType eRealmType,
+ const OUString & rRealm,
+ EntityType eUserNameType,
+ const OUString & rUserName,
+ EntityType ePasswordType,
+ const OUString & rPassword );
+
+ /**
+ * This method returns the supplier for the missing authentication data,
+ * that, for instance can be used to query the password supplied by the
+ * interaction handler.
+ *
+ * @return the supplier for the missing authentication data.
+ */
+ const rtl::Reference< ucbhelper::InteractionSupplyAuthentication > &
+ getAuthenticationSupplier() const { return m_xAuthSupplier; }
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/simplecertificatevalidationrequest.hxx b/include/ucbhelper/simplecertificatevalidationrequest.hxx
new file mode 100644
index 000000000..f839e0253
--- /dev/null
+++ b/include/ucbhelper/simplecertificatevalidationrequest.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX
+#define INCLUDED_UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX
+
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace com::sun::star::security { class XCertificate; }
+
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple validation interaction request of a certificate.
+ * Instances can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains a CertificateValidationRequest and two interaction
+ * continuations: "Abort" and "Approved". The parameters
+ * for the CertificateValidationRequest object are partly taken from constructors parameters and partly defaulted
+ * as follows:
+ *
+ * Read-write values: certificateValidity, certificate
+ *
+ * @see css::ucb::CertificateValidationRequest
+ * @see InteractionApproved
+ * @see InteractionRetry
+ */
+class UCBHELPER_DLLPUBLIC SimpleCertificateValidationRequest final : public ucbhelper::InteractionRequest
+{
+public:
+ /**
+ * Constructor.
+ *
+ * @param lCertificateValidity contains a bitmask which validation error occur.
+ * @param pCertificate contains the server certificate.
+ */
+ SimpleCertificateValidationRequest( sal_Int32 lCertificateValidity,
+ const css::uno::Reference<css::security::XCertificate>& certificate,
+ const OUString & hostname );
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/simpleinteractionrequest.hxx b/include/ucbhelper/simpleinteractionrequest.hxx
new file mode 100644
index 000000000..256562022
--- /dev/null
+++ b/include/ucbhelper/simpleinteractionrequest.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
+#define INCLUDED_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
+
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+/** These are the constants that can be passed to the constructor of class
+ * SimpleInteractionRequest and that are returned by method
+ * SimpleInteractionRequest::getResponse().
+ */
+
+enum class ContinuationFlags
+{
+ /** The request was not (yet) handled by the interaction handler. */
+ NONE = 0,
+ /** The interaction handler selected XInteractionAbort. */
+ Abort = 1,
+ /** The interaction handler selected XInteractionRetry. */
+ Retry = 2,
+ /** The interaction handler selected XInteractionApprove. */
+ Approve = 4,
+ /** The interaction handler selected XInteractionDisapprove. */
+ Disapprove = 8,
+};
+namespace o3tl
+{
+template <> struct typed_flags<ContinuationFlags> : is_typed_flags<ContinuationFlags, 0x0f>
+{
+};
+}
+
+namespace ucbhelper
+{
+/**
+ * This class implements a simple interaction request. The user must not deal
+ * with XInteractionContinuations directly, but can use constants that are
+ * mapped internally to the according objects. This class encapsulates the
+ * standard Interaction Continuations "Abort", "Retry", "Approve" and
+ * "Disapprove". Instances can be passed directly to
+ * XInteractionHandler::handle(...).
+ *
+ * @see InteractionRequest
+ * @see InteractionAbort
+ * @see InteractionRetry
+ * @see InteractionApprove
+ * @see InteractionDisapprove
+ */
+class UCBHELPER_DLLPUBLIC SimpleInteractionRequest final : public ucbhelper::InteractionRequest
+{
+public:
+ /**
+ * Constructor.
+ *
+ * @param rRequest is the exception describing the error.
+ * @param nContinuations contains the possible "answers" for the request.
+ * This can be any of the CONTINUATION_* constants combinations
+ * listed above.
+ */
+ SimpleInteractionRequest(const css::uno::Any& rRequest, const ContinuationFlags nContinuations);
+
+ /**
+ * After passing this request to XInteractionHandler::handle, this method
+ * returns the continuation that was chosen by the interaction handler.
+ *
+ * @return the continuation chosen by an interaction handler or
+ * ContinuationFlags::NONE, if the request was not (yet) handled.
+ */
+ ContinuationFlags getResponse() const;
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/simplenameclashresolverequest.hxx b/include/ucbhelper/simplenameclashresolverequest.hxx
new file mode 100644
index 000000000..f6826b43d
--- /dev/null
+++ b/include/ucbhelper/simplenameclashresolverequest.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_SIMPLENAMECLASHRESOLVEREQUEST_HXX
+#define INCLUDED_UCBHELPER_SIMPLENAMECLASHRESOLVEREQUEST_HXX
+
+#include <config_options.h>
+#include <rtl/ref.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace ucbhelper
+{
+class InteractionSupplyName;
+
+/**
+ * This class implements a simple name clash resolve interaction request.
+ * Instances can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains a NameClashResolveRequest and two interaction
+ * continuations: "Abort" and "SupplyName". Another continuation
+ * ("ReplaceExistingData") may be supplied optionally.
+ *
+ * @see css::ucb::NameClashResolveRequest
+ * @see InteractionAbort
+ * @see InteractioneplaceExistingData
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) SimpleNameClashResolveRequest final
+ : public ucbhelper::InteractionRequest
+{
+ rtl::Reference<InteractionSupplyName> m_xNameSupplier;
+
+ virtual ~SimpleNameClashResolveRequest() override;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rTargetFolderURL contains the URL of the folder that contains
+ * the clashing resource.
+ * @param rClashingName contains the clashing name.
+ */
+ SimpleNameClashResolveRequest(const OUString& rTargetFolderURL, const OUString& rClashingName);
+ /**
+ * This method returns the new name that was supplied by the interaction
+ * handler.
+ *
+ * @return the new name, if supplied.
+ */
+ OUString const& getNewName() const;
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_SIMPLENAMECLASHRESOLVEREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/ucbhelperdllapi.h b/include/ucbhelper/ucbhelperdllapi.h
new file mode 100644
index 000000000..739d76d0e
--- /dev/null
+++ b/include/ucbhelper/ucbhelperdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_UCBHELPERDLLAPI_H
+#define INCLUDED_UCBHELPER_UCBHELPERDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(UCBHELPER_DLLIMPLEMENTATION)
+#define UCBHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define UCBHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define UCBHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_UCBHELPER_UCBHELPERDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */