sw/inc/view.hxx | 1 + sw/source/uibase/app/appenv.cxx | 2 +- sw/source/uibase/uiview/view.cxx | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-)
New commits: commit db488f42a900504004d819e2795c18b056500db6 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Fri May 25 14:58:11 2018 +0300 tdf#35798: use separate paragraphs for Label elements Since commit db04be037b611e296ef9f2542322c52ed82d7a2b, empty Database fields are hidden. But since Labels wizard generates a single paragraph with line breaks for the label's text, the hiding feature cannot be used efficiently. Let the individual lines be in individual paragraphs. Change-Id: I27430d54baea88461c2ea9de38baa95d6b7e9e62 Reviewed-on: https://gerrit.libreoffice.org/54800 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 2f11ce0670749b9da20dfb29269b176cb09fb01e) Reviewed-on: https://gerrit.libreoffice.org/54959 Tested-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx index 447205517e6e..b5671577c204 100644 --- a/sw/source/uibase/app/appenv.cxx +++ b/sw/source/uibase/app/appenv.cxx @@ -124,7 +124,7 @@ OUString InsertLabEnvText( SwWrtShell& rSh, SwFieldMgr& rFieldMgr, const OUStrin if ( !bField ) rSh.Insert( sTmpText ); } - rSh.InsertLineBreak(); + rSh.SplitNode(); } rSh.DelLeft(); // Again remove last linebreak commit 67de15af3debfef0993f39be2bc20e865b803f35 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Mon May 21 09:35:01 2018 +0300 tdf#115386: Show Mail Merge toolbar for documents with MM fields Change-Id: I357a30d72c5ac4af8c64b82b4cc61c3bd606940a Reviewed-on: https://gerrit.libreoffice.org/54612 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/54957 Tested-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index 0e0f57fe10b2..9fdd4c26d95e 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -248,6 +248,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell m_bOldShellWasPagePreview : 1, m_bIsPreviewDoubleClick : 1, // #i114045# m_bMakeSelectionVisible : 1; // transport the bookmark selection + bool m_bInitOnceCompleted = false; /// LibreOfficeKit has to force the page size for PgUp/PgDown /// functionality based on the user's view, instead of using the m_aVisArea. diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index b48be3a0b2a5..e6d52358aaa2 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -219,6 +219,28 @@ IMPL_LINK_NOARG(SwView, FormControlActivated, LinkParamNone*, void) } } +namespace +{ +uno::Reference<frame::XLayoutManager> getLayoutManager(const SfxViewFrame& rViewFrame) +{ + uno::Reference<frame::XLayoutManager> xLayoutManager; + uno::Reference<beans::XPropertySet> xPropSet(rViewFrame.GetFrame().GetFrameInterface(), + uno::UNO_QUERY); + if (xPropSet.is()) + { + try + { + xLayoutManager.set(xPropSet->getPropertyValue("LayoutManager"), uno::UNO_QUERY); + } + catch (const Exception& e) + { + SAL_WARN("sw.ui", "Failure getting layout manager: " + e.Message); + } + } + return xLayoutManager; +} +} + void SwView::SelectShell() { // Attention: Maintain the SelectShell for the WebView additionally @@ -420,6 +442,20 @@ void SwView::SelectShell() GetEditWin().SetInputContext( aCntxt ); } + // 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); + } + } + } + // 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 // is not a performance problem. @@ -444,6 +480,8 @@ void SwView::SelectShell() m_pWrtShell->UpdateTable(); GetViewImpl()->GetUNOObject_Impl()->NotifySelChanged(); + + m_bInitOnceCompleted = true; } // Interaction: AttrChangedNotify() and TimeoutHdl. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits