summaryrefslogtreecommitdiff
path: root/offapi
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-11-18 09:08:03 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-11-22 14:29:04 +0100
commitfa070a798536d4017baada1e8f036b0e18dad9c7 (patch)
tree3e34754fb883a8d46cc8e42e8c0f494f5a26f977 /offapi
parent54239c99b7f9d82ec14492aff29e450abdafc61d (diff)
tdf#97926 Add UNO API for Infobar
This allows creating, updating and removing infobars from macros/extensions. It also extends the infobar with a primary and a secondary text, so there can be a bold summary at the beginning at the infobar with a longer text following in normal letters. Macro sample: ------------------------------------------------------------ Sub AddInfobar dim buttons(1) as new com.sun.star.beans.StringPair buttons(0).first = "Close doc" buttons(0).second = ".uno:CloseDoc" buttons(1).first = "Paste into doc" buttons(1).second = ".uno:Paste" ThisComponent.getCurrentController().appendInfobar("my", "Hello world", "Things happened. What now?", com.sun.star.frame.InfobarType.INFO, buttons, true) End Sub Sub UpdateInfobar ThisComponent.getCurrentController().updateInfobar("my", "WARNING","Do not read this message.", com.sun.star.frame.InfobarType.WARNING) End Sub Sub RemoveInfobar ThisComponent.getCurrentController().removeInfobar("my") End Sub ------------------------------------------------------------ Change-Id: I5d0a223525845d23ffab17acdaa431e0eb783fec Reviewed-on: https://gerrit.libreoffice.org/29816 Reviewed-by: Serge Krot (CIB) <Serge.Krot@cib.de> Tested-by: Serge Krot (CIB) <Serge.Krot@cib.de> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> (cherry picked from commit 9e3ba7c3036c4d21e01d6f75ed29a1e8c4208141) Reviewed-on: https://gerrit.libreoffice.org/83405 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'offapi')
-rw-r--r--offapi/UnoApi_offapi.mk2
-rw-r--r--offapi/com/sun/star/frame/InfobarType.idl38
-rw-r--r--offapi/com/sun/star/frame/XInfobarProvider.idl104
3 files changed, 144 insertions, 0 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 5fa55f8f191d..81dbf3c3441b 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2584,6 +2584,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/frame,\
FrameActionEvent \
FrameSearchFlag \
IllegalArgumentIOException \
+ InfobarType \
LayoutManagerEvents \
TerminationVetoException \
TitleChangedEvent \
@@ -2624,6 +2625,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/frame,\
XFrames \
XFramesSupplier \
XGlobalEventBroadcaster \
+ XInfobarProvider \
XInterceptorInfo \
XLayoutManager \
XLayoutManager2 \
diff --git a/offapi/com/sun/star/frame/InfobarType.idl b/offapi/com/sun/star/frame/InfobarType.idl
new file mode 100644
index 000000000000..4b579987f1d5
--- /dev/null
+++ b/offapi/com/sun/star/frame/InfobarType.idl
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef __com_sun_star_frame_InfobarType_idl__
+#define __com_sun_star_frame_InfobarType_idl__
+
+module com { module sun { module star { module frame {
+
+/** Infobar types.
+
+ @since LibreOffice 6.4
+*/
+constants InfobarType
+{
+ /** For information messages (color: light blue). */
+ const long INFO = 0;
+
+ /** For success notifications (color: light green). */
+ const long SUCCESS = 1;
+
+ /** For warning messages (color: orange). */
+ const long WARNING = 2;
+
+ /** For critical errors (color: red). */
+ const long DANGER = 3;
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ \ No newline at end of file
diff --git a/offapi/com/sun/star/frame/XInfobarProvider.idl b/offapi/com/sun/star/frame/XInfobarProvider.idl
new file mode 100644
index 000000000000..1fbaa4657188
--- /dev/null
+++ b/offapi/com/sun/star/frame/XInfobarProvider.idl
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef __com_sun_star_frame_XInfobarProvider_idl__
+#define __com_sun_star_frame_XInfobarProvider_idl__
+
+#include <com/sun/star/beans/StringPair.idl>
+#include <com/sun/star/frame/InfobarType.idl>
+#include <com/sun/star/uno/XInterface.idl>
+
+module com { module sun { module star { module frame {
+
+/** Allows to add Infobars to a frame.
+
+ This interface can be obtained via com::sun::star::frame::XController.
+
+ @since LibreOffice 6.4
+ */
+interface XInfobarProvider: uno::XInterface
+{
+ /** Creates and displays a new Infobar.
+
+ @param id
+ The ID by which this Infobar is recognized.
+ You can remove the Infobar afterwards using this ID.
+
+ @param primaryMessage
+ The (short) primary message.
+ Will appear at the start of the infobar in bold letters.
+ May be empty.
+
+ @param secondaryMessage
+ The (longer) secondary message.
+ Will appear in normal letters after the primaryMessage
+
+ @param infobarType
+ The type of the Infobar.
+ See com::sun::star::frame::InfobarType for possible values.
+
+ @param actionButtons
+ A sequence of action buttons.
+ The buttons will be added from Right to Left at the right side of the info bar.
+ Each button is represented by a com::sun::star::beans::StringPair.
+ StringPair::First represents the button label, while
+ StringPair::Second represents the button URL which will be called on button click.
+ The URL can be any URL, either external (http://libreoffice.org), or internal (.uno:Save),
+ or from your extension (service:your.example.Extension?anyAction).
+
+ @param showCloseButton
+ Whether the Close (x) button is shown at the end of the Infobar.
+ Set to false, when you don't want the user to close the Infobar.
+
+ @throws com::sun::star::lang::IllegalArgumentException
+ If an Infobar with the same ID already exists, or infobarType contains an invalid value.
+ */
+ void appendInfobar(
+ [in] string id,
+ [in] string primaryMessage,
+ [in] string secondaryMessage,
+ [in] long infobarType,
+ [in] sequence<com::sun::star::beans::StringPair> actionButtons,
+ [in] boolean showCloseButton)
+ raises(com::sun::star::lang::IllegalArgumentException);
+
+ /** Updates an existing Infobar.
+ Use if you want to update only small parts of the Infobar.
+
+ @see appendInfobar for parameter documentation.
+
+ @throws com::sun::star::container::NoSuchElementException
+ If no such Infobar exists (it might have been closed by the user already)
+ @throws com::sun::star::lang::IllegalArgumentException
+ If infobarType contains an invalid value.
+ */
+ void updateInfobar(
+ [in] string id,
+ [in] string primaryMessage,
+ [in] string secondaryMessage,
+ [in] long infobarType)
+ raises(com::sun::star::container::NoSuchElementException);
+
+ /** Removes an existing Infobar.
+
+ @param id
+ The ID which was used when creating this Infobar.
+
+ @throws com::sun::star::container::NoSuchElementException
+ If no such Infobar exists (it might have been closed by the user already)
+ */
+ void removeInfobar([in] string id) raises(com::sun::star::container::NoSuchElementException);
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ \ No newline at end of file