From cfaeeb5a4ceef152e7af938cdf9e7b5ee536c827 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 12 Jul 2018 16:16:17 +0200 Subject: [PATCH] Refresh linked OLE representation when OLE updated Change-Id: If949778779f1a91901412938d0b0298e1d7cfc3e Reviewed-on: https://gerrit.libreoffice.org/57357 Tested-by: Jenkins Reviewed-by: Armin Le Grand Gbp-Pq: Name 0078-Refresh-linked-OLE-representation-when-OLE-updated.patch --- sw/inc/ndole.hxx | 4 ++++ sw/source/core/ole/ndole.cxx | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx index cc72ff6279a..74c6945abdf 100644 --- a/sw/inc/ndole.hxx +++ b/sw/inc/ndole.hxx @@ -149,6 +149,10 @@ public: const OUString& GetChartTableName() const { return msChartTableName; } void SetChartTableName( const OUString& rNm ) { msChartTableName = rNm; } + + + // react on visual change (invalidate) + void SetChanged(); }; /// Inline methods from Node.hxx diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 755410d33bc..5c73a1b3ed3 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -42,9 +42,10 @@ #include #include #include +#include #include #include - +#include #include #include #include @@ -193,6 +194,8 @@ SwEmbedObjectLink::SwEmbedObjectLink(SwOLENode* pNode): } pOleNode->GetNewReplacement(); + pOleNode->SetChanged(); + return SUCCESS; } @@ -630,6 +633,36 @@ bool SwOLENode::IsChart() const return bIsChart; } +// react on visual change (invalidate) +void SwOLENode::SetChanged() +{ + SwFrame* pFrame(getLayoutFrame(nullptr)); + + if(nullptr == pFrame) + { + return; + } + + const SwRect aFrameArea(pFrame->getFrameArea()); + SwViewShell* pVSh(GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()); + + if(nullptr == pVSh) + { + return; + } + + for(SwViewShell& rShell : pVSh->GetRingContainer()) + { + SET_CURR_SHELL(&rShell); + + if(rShell.VisArea().IsOver(aFrameArea) && OUTDEV_WINDOW == rShell.GetOut()->GetOutDevType()) + { + // invalidate instead of painting + rShell.GetWin()->Invalidate(aFrameArea.SVRect()); + } + } +} + namespace { class DeflateThread; } /// Holder for local data for a parallel-executed task to load a chart model -- 2.30.2