tdf#115386: Show Mail Merge toolbar for documents with MM fields
Change-Id: I357a30d72c5ac4af8c64b82b4cc61c3bd606940a Reviewed-on: https://gerrit.libreoffice.org/54612 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -234,6 +234,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
|
|||||||
m_bOldShellWasPagePreview : 1,
|
m_bOldShellWasPagePreview : 1,
|
||||||
m_bIsPreviewDoubleClick : 1, // #i114045#
|
m_bIsPreviewDoubleClick : 1, // #i114045#
|
||||||
m_bMakeSelectionVisible : 1; // transport the bookmark selection
|
m_bMakeSelectionVisible : 1; // transport the bookmark selection
|
||||||
|
bool m_bInitOnceCompleted = false;
|
||||||
|
|
||||||
/// LibreOfficeKit has to force the page size for PgUp/PgDown
|
/// LibreOfficeKit has to force the page size for PgUp/PgDown
|
||||||
/// functionality based on the user's view, instead of using the m_aVisArea.
|
/// functionality based on the user's view, instead of using the m_aVisArea.
|
||||||
|
@@ -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()
|
void SwView::SelectShell()
|
||||||
{
|
{
|
||||||
// Attention: Maintain the SelectShell for the WebView additionally
|
// Attention: Maintain the SelectShell for the WebView additionally
|
||||||
@@ -420,6 +442,20 @@ void SwView::SelectShell()
|
|||||||
GetEditWin().SetInputContext( aCntxt );
|
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.
|
// 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
|
// Before a flush () must be, but does not affect the UI according to MBA and
|
||||||
// is not a performance problem.
|
// is not a performance problem.
|
||||||
@@ -444,6 +480,8 @@ void SwView::SelectShell()
|
|||||||
m_pWrtShell->UpdateTable();
|
m_pWrtShell->UpdateTable();
|
||||||
|
|
||||||
GetViewImpl()->GetUNOObject_Impl()->NotifySelChanged();
|
GetViewImpl()->GetUNOObject_Impl()->NotifySelChanged();
|
||||||
|
|
||||||
|
m_bInitOnceCompleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interaction: AttrChangedNotify() and TimeoutHdl.
|
// Interaction: AttrChangedNotify() and TimeoutHdl.
|
||||||
|
Reference in New Issue
Block a user