From d82649ea6f8232d52e1fe4e48ad6ccf1668418a8 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Sat, 14 Nov 2015 11:06:08 +0100
Subject: [PATCH 329/398] sw lok comments: fix callback of newly created
outliner views
SwPostItMgr::registerLibreOfficeKitCallback() already took care of
informing existing outliners, this commit gives a callback to newly
registered ones as well.
(cherry picked from commit dacc616f7020d045a1cfdb3806436e06046dae10)
Change-Id: I660dcb54231a9d404bf80b4284003d119dae6a5c
---
sw/inc/drawdoc.hxx | 2 ++
sw/source/core/draw/drawdoc.cxx | 6 ++++++
sw/source/uibase/docvw/SidebarWin.cxx | 13 +++++++++++++
3 files changed, 21 insertions(+)
diff --git a/sw/inc/drawdoc.hxx b/sw/inc/drawdoc.hxx
index bad9c0ca41a1..bbf079911656 100644
--- a/sw/inc/drawdoc.hxx
+++ b/sw/inc/drawdoc.hxx
@@ -42,6 +42,8 @@ public:
virtual ::com::sun::star::uno::Reference<
::com::sun::star::embed::XStorage> GetDocumentStorage() const SAL_OVERRIDE;
+ /// Get the callback and callback data, previously given to registerLibreOfficeKitCallback().
+ void getLibreOfficeKitCallback(LibreOfficeKitCallback& rCallback, void*& rLibreOfficeKitData);
/// For saving of rectangles as control-replacement for versions < 5.0.
virtual SdrLayerID GetControlExportLayerId( const SdrObject & ) const SAL_OVERRIDE;
diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx
index efd0bb1f163d..7f352c981890 100644
--- a/sw/source/core/draw/drawdoc.cxx
+++ b/sw/source/core/draw/drawdoc.cxx
@@ -126,6 +126,12 @@ uno::Reference<embed::XStorage> SwDrawModel::GetDocumentStorage() const
return m_pDoc->GetDocStorage();
}
+void SwDrawModel::getLibreOfficeKitCallback(LibreOfficeKitCallback& rCallback, void*& rLibreOfficeKitData)
+{
+ rCallback = mpLibreOfficeKitCallback;
+ rLibreOfficeKitData = mpLibreOfficeKitData;
+}
+
SdrLayerID SwDrawModel::GetControlExportLayerId( const SdrObject & ) const
{
//for versions < 5.0, there was only Hell and Heaven
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 721ef95e4acf..32d8b78815ae 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -82,6 +82,8 @@
#include <boost/scoped_ptr.hpp>
#include <memory>
#include <comphelper/lok.hxx>
+#include <IDocumentDrawModelAccess.hxx>
+#include <drawdoc.hxx>
namespace
{
@@ -532,6 +534,17 @@ void SwSidebarWin::InitControls()
mpOutlinerView->SetAttribs(DefaultItem());
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ // If there is a callback already registered, inform the new outliner view about it.
+ SwDrawModel* pDrawModel = mrView.GetWrtShellPtr()->getIDocumentDrawModelAccess()->GetDrawModel();
+ LibreOfficeKitCallback pCallback = 0;
+ void* pData = 0;
+ pDrawModel->getLibreOfficeKitCallback(pCallback, pData);
+ mpOutlinerView->setTiledRendering(mrView.GetWrtShellPtr()->isTiledRendering());
+ mpOutlinerView->registerLibreOfficeKitCallback(pCallback, pData);
+ }
+
//create Scrollbars
mpVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
mpVScrollbar->EnableNativeWidget(false);
--
2.12.0