summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/multicontainer2.hxx139
-rw-r--r--include/framework/desktop.hxx3
-rw-r--r--include/framework/titlehelper.hxx4
-rw-r--r--include/svtools/statusbarcontroller.hxx4
-rw-r--r--include/svtools/toolboxcontroller.hxx4
5 files changed, 147 insertions, 7 deletions
diff --git a/include/comphelper/multicontainer2.hxx b/include/comphelper/multicontainer2.hxx
new file mode 100644
index 000000000000..35f0fd9686ef
--- /dev/null
+++ b/include/comphelper/multicontainer2.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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <comphelper/interfacecontainer2.hxx>
+#include <cstddef>
+#include <functional>
+#include <memory>
+#include <vector>
+#include <utility>
+
+namespace com::sun::star::uno
+{
+class XInterface;
+}
+
+/** */ //for docpp
+namespace comphelper
+{
+/** Specialized class for key type css::uno::Type,
+ without explicit usage of STL symbols.
+*/
+class COMPHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelper2
+{
+public:
+ /**
+ Create a container of interface containers.
+
+ @param rMutex the mutex to protect multi thread access.
+ The lifetime must be longer than the lifetime
+ of this object.
+ */
+ OMultiTypeInterfaceContainerHelper2(::osl::Mutex& rMutex);
+ /**
+ Delete all containers.
+ */
+ ~OMultiTypeInterfaceContainerHelper2();
+
+ /**
+ Return all id's under which at least one interface is added.
+ */
+ std::vector<css::uno::Type> getContainedTypes() const;
+
+ /**
+ Return the container created under this key.
+ @return the container created under this key. If the container
+ was not created, null was returned.
+ */
+ OInterfaceContainerHelper2* getContainer(const css::uno::Type& rKey) const;
+
+ /** Inserts an element into the container with the specified key.
+ The position is not specified, thus it is not specified in which order events are fired.
+
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+
+ @param rKey
+ the id of the container
+ @param r
+ interface to be added; it is allowed, to insert null or
+ the same interface more than once
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 addInterface(const css::uno::Type& rKey,
+ const css::uno::Reference<css::uno::XInterface>& r);
+
+ /** Removes an element from the container with the specified key.
+ It uses interface equality to remove the interface.
+
+ @param rKey
+ the id of the container
+ @param rxIFace
+ interface to be removed
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 removeInterface(const css::uno::Type& rKey,
+ const css::uno::Reference<css::uno::XInterface>& rxIFace);
+
+ /**
+ Call disposing on all object in the container that
+ support XEventListener. Then clear the container.
+ */
+ void disposeAndClear(const css::lang::EventObject& rEvt);
+ /**
+ Remove all elements of all containers. Does not delete the container.
+ */
+ void clear();
+
+ typedef css::uno::Type keyType;
+
+private:
+ typedef std::vector<std::pair<css::uno::Type, std::unique_ptr<OInterfaceContainerHelper2>>>
+ t_type2ptr;
+
+ t_type2ptr::iterator findType(const css::uno::Type& rKey);
+ t_type2ptr::const_iterator findType(const css::uno::Type& rKey) const;
+
+ t_type2ptr m_aMap;
+ ::osl::Mutex& rMutex;
+
+ OMultiTypeInterfaceContainerHelper2(const OMultiTypeInterfaceContainerHelper2&) = delete;
+ OMultiTypeInterfaceContainerHelper2& operator=(const OMultiTypeInterfaceContainerHelper2&)
+ = delete;
+};
+
+} // namespace comphelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/desktop.hxx b/include/framework/desktop.hxx
index 254a1520bb3e..bd094ee90298 100644
--- a/include/framework/desktop.hxx
+++ b/include/framework/desktop.hxx
@@ -46,6 +46,7 @@
#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/multicontainer2.hxx>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/propshlp.hxx>
@@ -394,7 +395,7 @@ class FWK_DLLPUBLIC Desktop final : private cppu::BaseMutex,
css::uno::Reference< css::uno::XComponentContext > m_xContext; /// reference to factory, which has create this instance
FrameContainer m_aChildTaskContainer; /// array of child tasks (children of desktop are tasks; and tasks are also frames - But pure frames are not accepted!)
- ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
+ comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener
css::uno::Reference< css::frame::XFrames > m_xFramesHelper; /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer!
css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper; /// helper to dispatch something for new tasks, created by "_blank"!
ELoadState m_eLoadState; /// hold information about state of asynchron loading of component for loadComponentFromURL()!
diff --git a/include/framework/titlehelper.hxx b/include/framework/titlehelper.hxx
index 93322818955d..474d709339e2 100644
--- a/include/framework/titlehelper.hxx
+++ b/include/framework/titlehelper.hxx
@@ -29,7 +29,7 @@
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/multicontainer2.hxx>
#include <rtl/ustrbuf.hxx>
@@ -187,7 +187,7 @@ class FWK_DLLPUBLIC TitleHelper final : private ::cppu::BaseMutex
::sal_Int32 m_nLeasedNumber;
/** contains all title change listener */
- ::cppu::OMultiTypeInterfaceContainerHelper m_aListener;
+ comphelper::OMultiTypeInterfaceContainerHelper2 m_aListener;
};
} // namespace framework
diff --git a/include/svtools/statusbarcontroller.hxx b/include/svtools/statusbarcontroller.hxx
index f62feabc0e01..fee4b2869b25 100644
--- a/include/svtools/statusbarcontroller.hxx
+++ b/include/svtools/statusbarcontroller.hxx
@@ -22,7 +22,7 @@
#include <svtools/svtdllapi.h>
#include <com/sun/star/frame/XStatusbarController.hpp>
#include <cppuhelper/weak.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/multicontainer2.hxx>
#include <cppuhelper/basemutex.hxx>
#include <tools/gen.hxx>
#include <unordered_map>
@@ -122,7 +122,7 @@ class SVT_DLLPUBLIC StatusbarController :
css::uno::Reference< css::uno::XComponentContext > m_xContext;
OUString m_aCommandURL;
URLToDispatchMap m_aListenerMap;
- ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
+ comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener
mutable css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer;
css::uno::Reference< css::ui::XStatusbarItem > m_xStatusbarItem;
};
diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx
index c8d0e8c8e7de..f2068306438e 100644
--- a/include/svtools/toolboxcontroller.hxx
+++ b/include/svtools/toolboxcontroller.hxx
@@ -27,7 +27,7 @@
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/multicontainer2.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <comphelper/proparrhlp.hxx>
#include <comphelper/propertycontainer.hxx>
@@ -181,7 +181,7 @@ class SVT_DLLPUBLIC ToolboxController :
css::uno::Reference< css::uno::XComponentContext > m_xContext;
OUString m_aCommandURL;
URLToDispatchMap m_aListenerMap;
- ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
+ comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener
css::uno::Reference< css::awt::XWindow > m_xParentWindow;
css::uno::Reference< css::util::XURLTransformer > m_xUrlTransformer;