Kaydet (Commit) 40e431de authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#115386: Show Mail Merge toolbar for new labels

Change-Id: I26ec6c7fdfa5b6f6f818927fd9ede00184dc5e8c
Reviewed-on: https://gerrit.libreoffice.org/54813Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 08a2f9bf
......@@ -629,6 +629,7 @@ public:
const OUString& GetRedlineAuthor();
/// See SfxViewShell::NotifyCursor().
void NotifyCursor(SfxViewShell* pViewShell) const override;
void ShowUIElement(const OUString& sElementURL) const;
};
inline long SwView::GetXScroll() const
......
......@@ -385,6 +385,9 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel)
if (pFirstFlyFormat)
pSh->GotoFly(pFirstFlyFormat->GetName(), FLYCNTTYPE_ALL, false);
if (pSh->IsAnyDatabaseFieldInDoc())
pSh->GetView().ShowUIElement("private:resource/toolbar/mailmerge");
pSh->EndAllAction();
pSh->DoUndo();
}
......
......@@ -241,6 +241,18 @@ uno::Reference<frame::XLayoutManager> getLayoutManager(const SfxViewFrame& rView
}
}
void SwView::ShowUIElement(const OUString& sElementURL) const
{
if (auto xLayoutManager = getLayoutManager(*GetViewFrame()))
{
if (!xLayoutManager->getElement(sElementURL).is())
{
xLayoutManager->createElement(sElementURL);
xLayoutManager->showElement(sElementURL);
}
}
}
void SwView::SelectShell()
{
// Attention: Maintain the SelectShell for the WebView additionally
......@@ -444,17 +456,7 @@ void SwView::SelectShell()
// Show Mail Merge toolbar initially for documents with Database fields
if (!m_bInitOnceCompleted && GetWrtShell().IsAnyDatabaseFieldInDoc())
{
if (auto xLayoutManager = getLayoutManager(*GetViewFrame()))
{
const OUString sResourceURL("private:resource/toolbar/mailmerge");
if (!xLayoutManager->getElement(sResourceURL).is())
{
xLayoutManager->createElement(sResourceURL);
xLayoutManager->showElement(sResourceURL);
}
}
}
ShowUIElement("private:resource/toolbar/mailmerge");
// Activate the toolbar to the new selection which also was active last time.
// Before a flush () must be, but does not affect the UI according to MBA and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment