summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-11-19 09:18:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-12-13 13:07:21 +0100
commitc434fc0d181f098a179c6dc9d1506fa806d579f1 (patch)
tree3b53ada3fffc9c91c4d28deb4062b1bedc238a99 /sfx2
parent72e0d12c39faceda2e84d3321e0a11880d3b8593 (diff)
tdf#128191 Show infobar when hyphenation info for text language is missing
During doc loading it's too early to add infobars, thus add a mechanism to display infobars once view is ready Change-Id: Ie963a304d2101a5bbdd59130c354d581ff7d2e9b Reviewed-on: https://gerrit.libreoffice.org/84634 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/objmisc.cxx19
-rw-r--r--sfx2/source/doc/objxtor.cxx1
-rw-r--r--sfx2/source/inc/objshimp.hxx3
-rw-r--r--sfx2/source/view/viewfrm.cxx14
4 files changed, 37 insertions, 0 deletions
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 5af5ddfdf2f0..3254eb18d7b0 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -112,6 +112,7 @@
#include <sfx2/strings.hrc>
#include <workwin.hxx>
#include <sfx2/sfxdlg.hxx>
+#include <sfx2/infobar.hxx>
#include <appbaslib.hxx>
#include <openflag.hxx>
#include "objstor.hxx"
@@ -202,6 +203,24 @@ void SfxObjectShell::FlushDocInfo()
(delay > 0) || !url.isEmpty() );
}
+void SfxObjectShell::AppendInfoBarWhenReady(const OUString& sId, const OUString& sPrimaryMessage,
+ const OUString& sSecondaryMessage,
+ InfobarType aInfobarType, bool bShowCloseButton)
+{
+ InfobarData aInfobarData;
+ aInfobarData.msId = sId;
+ aInfobarData.msPrimaryMessage = sPrimaryMessage;
+ aInfobarData.msSecondaryMessage = sSecondaryMessage;
+ aInfobarData.maInfobarType = aInfobarType;
+ aInfobarData.mbShowCloseButton = bShowCloseButton;
+ Get_Impl()->m_aPendingInfobars.emplace_back(aInfobarData);
+}
+
+std::vector<InfobarData>& SfxObjectShell::getPendingInfobars()
+{
+ return Get_Impl()->m_aPendingInfobars;
+}
+
void SfxObjectShell::SetError(ErrCode lErr)
{
if (pImpl->lErr==ERRCODE_NONE)
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 1f1ead6642ed..510c35daf59f 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -99,6 +99,7 @@
#include <sfx2/sfxuno.hxx>
#include <shellimpl.hxx>
#include <sfx2/notebookbar/SfxNotebookBar.hxx>
+#include <sfx2/infobar.hxx>
#include <basic/basicmanagerrepository.hxx>
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index d52ee83d9a3c..3d7b0b69c945 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -131,6 +131,9 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
bool m_bSavingForSigning;
bool m_bAllowModifiedBackAfterSigning;
+ /// Holds Infobars until View is fully loaded
+ std::vector<InfobarData> m_aPendingInfobars;
+
SfxObjectShell_Impl( SfxObjectShell& _rDocShell );
virtual ~SfxObjectShell_Impl();
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 3264a1c9497a..6029bdc341e3 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1432,6 +1432,17 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
aHelper.UpdateInfobar(*this);
}
+ // Add pending infobars
+ std::vector<InfobarData>& aPendingInfobars = m_xObjSh->getPendingInfobars();
+ while (!aPendingInfobars.empty())
+ {
+ InfobarData& aInfobarData = aPendingInfobars.back();
+ AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage,
+ aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType,
+ aInfobarData.mbShowCloseButton);
+ aPendingInfobars.pop_back();
+ }
+
break;
}
default: break;
@@ -3292,6 +3303,9 @@ VclPtr<SfxInfoBarWindow> SfxViewFrame::AppendInfoBar(const OUString& sId,
if (!pChild)
return nullptr;
+ if (HasInfoBarWithID(sId))
+ return nullptr;
+
SfxInfoBarContainerWindow* pInfoBarContainer = static_cast<SfxInfoBarContainerWindow*>(pChild->GetWindow());
auto pInfoBar = pInfoBarContainer->appendInfoBar(sId, sPrimaryMessage, sSecondaryMessage,
aInfobarType, WB_LEFT | WB_VCENTER, bShowCloseButton);