Refresh linked OLE representation when OLE updated
authorArmin Le Grand <Armin.Le.Grand@cib.de>
Thu, 12 Jul 2018 14:16:17 +0000 (16:16 +0200)
committerBastien Roucariès <rouca@debian.org>
Sat, 12 Aug 2023 19:58:29 +0000 (20:58 +0100)
Change-Id: If949778779f1a91901412938d0b0298e1d7cfc3e
Reviewed-on: https://gerrit.libreoffice.org/57357
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Gbp-Pq: Name 0078-Refresh-linked-OLE-representation-when-OLE-updated.patch

sw/inc/ndole.hxx
sw/source/core/ole/ndole.cxx

index cc72ff6279a3716d415886f3830da6aa61c563d4..74c6945abdf78a6d39ba5dbd987f6c38cf438ca1 100644 (file)
@@ -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
index 755410d33bc9c275cf60b4cdb82679e6798e1bd5..5c73a1b3ed3f53a440e8173d90e377a5c672eeff 100644 (file)
 #include <cntfrm.hxx>
 #include <frmatr.hxx>
 #include <ndole.hxx>
+#include <viewsh.hxx>
 #include <DocumentSettingManager.hxx>
 #include <IDocumentLinksAdministration.hxx>
-
+#include <IDocumentLayoutAccess.hxx>
 #include <comphelper/classids.hxx>
 #include <vcl/graph.hxx>
 #include <sot/formats.hxx>
@@ -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