diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-11-18 09:08:03 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2019-11-22 14:29:04 +0100 |
commit | fa070a798536d4017baada1e8f036b0e18dad9c7 (patch) | |
tree | 3e34754fb883a8d46cc8e42e8c0f494f5a26f977 /sfx2/source/doc/objserv.cxx | |
parent | 54239c99b7f9d82ec14492aff29e450abdafc61d (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 '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 24cfa8afd294..b438d2d4e269 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1300,35 +1300,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: @@ -1340,7 +1340,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())); @@ -1355,7 +1355,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); } } |