sc/source/filter/xml/XMLTableShapeResizer.cxx |   22 +++++++++-------------
 sc/source/filter/xml/XMLTableShapeResizer.hxx |    2 +-
 2 files changed, 10 insertions(+), 14 deletions(-)

New commits:
commit ed7fdc72fcbe1f60c431a6b72b1c5b0de343a831
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Sep 23 08:52:25 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Sep 23 11:20:02 2020 +0200

    only call to CreateChartListener guarded against null ScDocument*
    
    Change-Id: Idfe582cabb1842676573d76095a3863c2ab2e1e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103232
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx 
b/sc/source/filter/xml/XMLTableShapeResizer.cxx
index 84bc25588cdd..33b186132c6b 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.cxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx
@@ -53,30 +53,26 @@ bool ScMyOLEFixer::IsOLE(const uno::Reference< 
drawing::XShape >& rShape)
     return rShape->getShapeType() == "com.sun.star.drawing.OLE2Shape";
 }
 
-void ScMyOLEFixer::CreateChartListener(ScDocument* pDoc,
+void ScMyOLEFixer::CreateChartListener(ScDocument& rDoc,
     const OUString& rName,
     const OUString& rRangeList)
 {
-    // This is the minimum required.
-    if (!pDoc)
-        return;
-
     if (rRangeList.isEmpty())
     {
-        pDoc->AddOLEObjectToCollection(rName);
+        rDoc.AddOLEObjectToCollection(rName);
         return;
     }
 
     OUString aRangeStr;
-    ScRangeStringConverter::GetStringFromXMLRangeString(aRangeStr, rRangeList, 
*pDoc);
+    ScRangeStringConverter::GetStringFromXMLRangeString(aRangeStr, rRangeList, 
rDoc);
     if (aRangeStr.isEmpty())
     {
-        pDoc->AddOLEObjectToCollection(rName);
+        rDoc.AddOLEObjectToCollection(rName);
         return;
     }
 
     if (!pCollection)
-        pCollection = pDoc->GetChartListenerCollection();
+        pCollection = rDoc.GetChartListenerCollection();
 
     if (!pCollection)
         return;
@@ -84,11 +80,11 @@ void ScMyOLEFixer::CreateChartListener(ScDocument* pDoc,
     unique_ptr< vector<ScTokenRef> > pRefTokens(new vector<ScTokenRef>);
     const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
     ScRefTokenHelper::compileRangeRepresentation(
-        *pRefTokens, aRangeStr, *pDoc, cSep, pDoc->GetGrammar());
+        *pRefTokens, aRangeStr, rDoc, cSep, rDoc.GetGrammar());
     if (pRefTokens->empty())
         return;
 
-    ScChartListener* pCL(new ScChartListener(rName, pDoc, 
std::move(pRefTokens)));
+    ScChartListener* pCL(new ScChartListener(rName, &rDoc, 
std::move(pRefTokens)));
 
     //for loading binary files e.g.
     //if we have the flat filter we need to set the dirty flag thus the 
visible charts get repainted
@@ -99,7 +95,7 @@ void ScMyOLEFixer::CreateChartListener(ScDocument* pDoc,
     {
         // #i104899# If a formula cell is already dirty, further changes 
aren't propagated.
         // This can happen easily now that row heights aren't updated for all 
sheets.
-        pDoc->InterpretDirtyCells( *pCL->GetRangeList() );
+        rDoc.InterpretDirtyCells( *pCL->GetRangeList() );
     }
 
     pCollection->insert( pCL );
@@ -139,7 +135,7 @@ void ScMyOLEFixer::FixupOLEs()
             OUString sName;
             if (pDoc && xShapeProps.is() && xShapeInfo.is() && 
xShapeInfo->hasPropertyByName(sPersistName) &&
                 (xShapeProps->getPropertyValue(sPersistName) >>= sName))
-                CreateChartListener(pDoc, sName, shape.sRangeList);
+                CreateChartListener(*pDoc, sName, shape.sRangeList);
         }
     }
     aShapes.clear();
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.hxx 
b/sc/source/filter/xml/XMLTableShapeResizer.hxx
index 99c412fb80c2..e09495c7d324 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.hxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.hxx
@@ -41,7 +41,7 @@ class ScMyOLEFixer
     std::vector<ScMyToFixupOLE>   aShapes;
     ScChartListenerCollection*  pCollection;
 
-    void CreateChartListener(ScDocument* pDoc,
+    void CreateChartListener(ScDocument& rDoc,
         const OUString& rName,
         const OUString& rRangeList);
 public:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to