[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3-desktop' - sw/inc sw/source

Mike Kaganski mike.kaganski at collabora.com
Tue May 29 13:52:06 UTC 2018


 sw/inc/view.hxx                  |    1 +
 sw/source/uibase/app/applab.cxx  |    3 +++
 sw/source/uibase/uiview/view.cxx |   26 ++++++++++++++------------
 3 files changed, 18 insertions(+), 12 deletions(-)

New commits:
commit 2a7ab376ffeeed07a2ae282033c65b568c56a08a
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Fri May 25 16:05:12 2018 +0300

    tdf#115386: Show Mail Merge toolbar for new labels
    
    Change-Id: I26ec6c7fdfa5b6f6f818927fd9ede00184dc5e8c
    Reviewed-on: https://gerrit.libreoffice.org/54813
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/54962
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index a54c6d8e7935..965177c3ebf5 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -645,6 +645,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 c15fa2e7ea81..27c9be51b57a 100644
--- a/sw/source/uibase/app/applab.cxx
+++ b/sw/source/uibase/app/applab.cxx
@@ -388,6 +388,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 2e241fc01555..fd63a262cbd0 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -243,6 +243,19 @@ uno::Reference<frame::XLayoutManager> getLayoutManager(const SfxViewFrame& rView
 }
 }
 
+void SwView::ShowUIElement(const OUString& sElementURL) const
+{
+    auto xLayoutManager = getLayoutManager(*GetViewFrame());
+    if (xLayoutManager.is())
+    {
+        if (!xLayoutManager->getElement(sElementURL).is())
+        {
+            xLayoutManager->createElement(sElementURL);
+            xLayoutManager->showElement(sElementURL);
+        }
+    }
+}
+
 void SwView::SelectShell()
 {
     // Attention: Maintain the SelectShell for the WebView additionally
@@ -450,18 +463,7 @@ void SwView::SelectShell()
 
         // Show Mail Merge toolbar initially for documents with Database fields
         if (!m_bInitOnceCompleted && GetWrtShell().IsAnyDatabaseFieldInDoc())
-        {
-            auto xLayoutManager = getLayoutManager(*GetViewFrame());
-            if (xLayoutManager.is())
-            {
-                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


More information about the Libreoffice-commits mailing list