diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-11-18 09:08:03 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-11-19 08:51:43 +0100 |
commit | 9e3ba7c3036c4d21e01d6f75ed29a1e8c4208141 (patch) | |
tree | c648a26f2445955be14aa6e96815c14ec193dddc /sfx2/source/doc/objserv.cxx | |
parent | b234743dd26e0be4be272d2d2c82f90c67e192b7 (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>
Diffstat (limited to 'sfx2/source/doc/objserv.cxx')
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 512fe81d6efd..ff155a031383 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1298,35 +1298,35 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) if ( pFrame ) { SignatureState eState = GetDocumentSignatureState(); - InfoBarType aInfoBarType(InfoBarType::Info); + InfobarType aInfobarType(InfobarType::INFO); OUString sMessage(""); switch (eState) { case SignatureState::BROKEN: sMessage = SfxResId(STR_SIGNATURE_BROKEN); - aInfoBarType = InfoBarType::Danger; + aInfobarType = InfobarType::DANGER; break; case SignatureState::INVALID: sMessage = SfxResId(STR_SIGNATURE_INVALID); // Warning only, I've tried Danger and it looked too scary - aInfoBarType = InfoBarType::Warning; + aInfobarType = InfobarType::WARNING; break; case SignatureState::NOTVALIDATED: sMessage = SfxResId(STR_SIGNATURE_NOTVALIDATED); - aInfoBarType = InfoBarType::Warning; + aInfobarType = InfobarType::WARNING; break; case SignatureState::PARTIAL_OK: sMessage = SfxResId(STR_SIGNATURE_PARTIAL_OK); - aInfoBarType = InfoBarType::Warning; + aInfobarType = InfobarType::WARNING; break; case SignatureState::OK: sMessage = SfxResId(STR_SIGNATURE_OK); - aInfoBarType = InfoBarType::Info; + aInfobarType = InfobarType::INFO; break; case SignatureState::NOTVALIDATED_PARTIAL_OK: sMessage = SfxResId(STR_SIGNATURE_NOTVALIDATED_PARTIAL_OK); - aInfoBarType = InfoBarType::Warning; + aInfobarType = InfobarType::WARNING; break; //FIXME SignatureState::Unknown, own message? default: @@ -1338,7 +1338,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) { if ( !sMessage.isEmpty() ) { - auto pInfoBar = pFrame->AppendInfoBar("signature", sMessage, aInfoBarType); + auto pInfoBar = pFrame->AppendInfoBar("signature", "", sMessage, aInfobarType); if (pInfoBar == nullptr || pInfoBar->IsDisposed()) return; VclPtrInstance<PushButton> xBtn(&(pFrame->GetWindow())); @@ -1353,7 +1353,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) if ( eState == SignatureState::NOSIGNATURES ) pFrame->RemoveInfoBar("signature"); else - pFrame->UpdateInfoBar("signature", sMessage, aInfoBarType); + pFrame->UpdateInfoBar("signature", "", sMessage, aInfobarType); } } |