summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-05-25 16:05:12 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-05-28 20:50:41 +0200
commit7859f9f259846889bcdd193ddb067e8912d6a89f (patch)
treeab2e6d9f6ff7b9024ae52834b6f33f0a47a85ed1
parentdb488f42a900504004d819e2795c18b056500db6 (diff)
tdf#115386: Show Mail Merge toolbar for new labels
Change-Id: I26ec6c7fdfa5b6f6f818927fd9ede00184dc5e8c Reviewed-on: https://gerrit.libreoffice.org/54813 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/54961 Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sw/inc/view.hxx1
-rw-r--r--sw/source/uibase/app/applab.cxx3
-rw-r--r--sw/source/uibase/uiview/view.cxx24
3 files changed, 17 insertions, 11 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 9fdd4c26d95e..82a736801d61 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -643,6 +643,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
diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx
index 6f688a5d9903..9d72bda9b3c9 100644
--- a/sw/source/uibase/app/applab.cxx
+++ b/sw/source/uibase/app/applab.cxx
@@ -386,6 +386,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();
}
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index e6d52358aaa2..103713df7a07 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -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