sc/inc/rangeutl.hxx                           |    2 -
 sc/source/core/tool/rangeutl.cxx              |   38 +++++++++++++-------------
 sc/source/filter/xml/XMLTableShapeResizer.cxx |    2 -
 sc/source/ui/unoobj/chart2uno.cxx             |    2 -
 4 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 662c6a43a4826fc88cd6a86bb57ab7fd513a4762
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Sep 14 15:32:26 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Sep 15 17:27:19 2020 +0200

    GetStringFromXMLRangeString never passed a null ScDocument*
    
    Change-Id: I2855e212db08b6df0aa91f25b10b4605173b2095
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102745
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index e0d0f65c2b88..286eb01421da 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -218,7 +218,7 @@ public:
     static void         GetStringFromXMLRangeString(
                             OUString& rString,
                             const OUString& rXMLRange,
-                            const ScDocument* pDoc );
+                            const ScDocument& rDoc );
 
 /// String to RangeData core
     static ScRangeData* GetRangeDataFromString(const OUString& rString, const 
SCTAB nTab, const ScDocument& rDoc);
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index c90c61d0055c..a2996f13b81b 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -702,12 +702,12 @@ void ScRangeStringConverter::GetStringFromRangeList(
 }
 
 static void lcl_appendCellAddress(
-    OUStringBuffer& rBuf, const ScDocument* pDoc, const ScAddress& rCell,
+    OUStringBuffer& rBuf, const ScDocument& rDoc, const ScAddress& rCell,
     const ScAddress::ExternalInfo& rExtInfo)
 {
     if (rExtInfo.mbExternal)
     {
-        ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
+        ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager();
         const OUString* pFilePath = 
pRefMgr->getExternalFileName(rExtInfo.mnFileId, true);
         if (!pFilePath)
             return;
@@ -721,18 +721,18 @@ static void lcl_appendCellAddress(
         ScRangeStringConverter::AppendTableName(rBuf, rExtInfo.maTabName);
         rBuf.append('.');
 
-        OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS, nullptr, 
pDoc->GetAddressConvention()));
+        OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS, nullptr, 
rDoc.GetAddressConvention()));
         rBuf.append(aAddr);
     }
     else
     {
-        OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS_3D, pDoc, 
pDoc->GetAddressConvention()));
+        OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS_3D, &rDoc, 
rDoc.GetAddressConvention()));
         rBuf.append(aAddr);
     }
 }
 
 static void lcl_appendCellRangeAddress(
-    OUStringBuffer& rBuf, const ScDocument* pDoc, const ScAddress& rCell1, 
const ScAddress& rCell2,
+    OUStringBuffer& rBuf, const ScDocument& rDoc, const ScAddress& rCell1, 
const ScAddress& rCell2,
     const ScAddress::ExternalInfo& rExtInfo1, const ScAddress::ExternalInfo& 
rExtInfo2)
 {
     if (rExtInfo1.mbExternal)
@@ -740,7 +740,7 @@ static void lcl_appendCellRangeAddress(
         OSL_ENSURE(rExtInfo2.mbExternal, "2nd address is not external!?");
         OSL_ENSURE(rExtInfo1.mnFileId == rExtInfo2.mnFileId, "File IDs do not 
match between 1st and 2nd addresses.");
 
-        ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
+        ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager();
         const OUString* pFilePath = 
pRefMgr->getExternalFileName(rExtInfo1.mnFileId, true);
         if (!pFilePath)
             return;
@@ -754,7 +754,7 @@ static void lcl_appendCellRangeAddress(
         ScRangeStringConverter::AppendTableName(rBuf, rExtInfo1.maTabName);
         rBuf.append('.');
 
-        OUString aAddr(rCell1.Format(ScRefFlags::ADDR_ABS, nullptr, 
pDoc->GetAddressConvention()));
+        OUString aAddr(rCell1.Format(ScRefFlags::ADDR_ABS, nullptr, 
rDoc.GetAddressConvention()));
         rBuf.append(aAddr);
 
         rBuf.append(":");
@@ -766,7 +766,7 @@ static void lcl_appendCellRangeAddress(
             rBuf.append('.');
         }
 
-        aAddr = rCell2.Format(ScRefFlags::ADDR_ABS, nullptr, 
pDoc->GetAddressConvention());
+        aAddr = rCell2.Format(ScRefFlags::ADDR_ABS, nullptr, 
rDoc.GetAddressConvention());
         rBuf.append(aAddr);
     }
     else
@@ -774,14 +774,14 @@ static void lcl_appendCellRangeAddress(
         ScRange aRange;
         aRange.aStart = rCell1;
         aRange.aEnd   = rCell2;
-        OUString aAddr(aRange.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, 
pDoc->GetAddressConvention()));
+        OUString aAddr(aRange.Format(rDoc, ScRefFlags::RANGE_ABS_3D, 
rDoc.GetAddressConvention()));
         rBuf.append(aAddr);
     }
 }
 
-void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, 
const OUString& rXMLRange, const ScDocument* pDoc )
+void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, 
const OUString& rXMLRange, const ScDocument& rDoc )
 {
-    FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+    FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
     const sal_Unicode cSepNew = ScCompiler::GetNativeSymbolChar(ocSep);
 
     OUStringBuffer aRetStr;
@@ -830,27 +830,27 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( 
OUString& rString, con
 
             ScAddress::ExternalInfo aExtInfo1, aExtInfo2;
             ScAddress aCell1, aCell2;
-            ScRefFlags nRet = aCell1.Parse(aBeginCell, pDoc, 
FormulaGrammar::CONV_OOO, &aExtInfo1);
+            ScRefFlags nRet = aCell1.Parse(aBeginCell, &rDoc, 
FormulaGrammar::CONV_OOO, &aExtInfo1);
             if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
             {
                 // first cell is invalid.
                 if (eConv == FormulaGrammar::CONV_OOO)
                     continue;
 
-                nRet = aCell1.Parse(aBeginCell, pDoc, eConv, &aExtInfo1);
+                nRet = aCell1.Parse(aBeginCell, &rDoc, eConv, &aExtInfo1);
                 if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
                     // first cell is really invalid.
                     continue;
             }
 
-            nRet = aCell2.Parse(aEndCell, pDoc, FormulaGrammar::CONV_OOO, 
&aExtInfo2);
+            nRet = aCell2.Parse(aEndCell, &rDoc, FormulaGrammar::CONV_OOO, 
&aExtInfo2);
             if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
             {
                 // second cell is invalid.
                 if (eConv == FormulaGrammar::CONV_OOO)
                     continue;
 
-                nRet = aCell2.Parse(aEndCell, pDoc, eConv, &aExtInfo2);
+                nRet = aCell2.Parse(aEndCell, &rDoc, eConv, &aExtInfo2);
                 if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
                     // second cell is really invalid.
                     continue;
@@ -867,17 +867,17 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( 
OUString& rString, con
             else
                 aRetStr.append(cSepNew);
 
-            lcl_appendCellRangeAddress(aRetStr, pDoc, aCell1, aCell2, 
aExtInfo1, aExtInfo2);
+            lcl_appendCellRangeAddress(aRetStr, rDoc, aCell1, aCell2, 
aExtInfo1, aExtInfo2);
         }
         else
         {
             // Chart always saves ranges using CONV_OOO convention.
             ScAddress::ExternalInfo aExtInfo;
             ScAddress aCell;
-            ScRefFlags nRet = aCell.Parse(aToken, pDoc, 
::formula::FormulaGrammar::CONV_OOO, &aExtInfo);
+            ScRefFlags nRet = aCell.Parse(aToken, &rDoc, 
::formula::FormulaGrammar::CONV_OOO, &aExtInfo);
             if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO )
             {
-                nRet = aCell.Parse(aToken, pDoc, eConv, &aExtInfo);
+                nRet = aCell.Parse(aToken, &rDoc, eConv, &aExtInfo);
                 if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
                     continue;
             }
@@ -889,7 +889,7 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( 
OUString& rString, con
             else
                 aRetStr.append(cSepNew);
 
-            lcl_appendCellAddress(aRetStr, pDoc, aCell, aExtInfo);
+            lcl_appendCellAddress(aRetStr, rDoc, aCell, aExtInfo);
         }
     }
 
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx 
b/sc/source/filter/xml/XMLTableShapeResizer.cxx
index b5c3b56e4f8e..bac71f2ab82d 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.cxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx
@@ -68,7 +68,7 @@ void ScMyOLEFixer::CreateChartListener(ScDocument* pDoc,
     }
 
     OUString aRangeStr;
-    ScRangeStringConverter::GetStringFromXMLRangeString(aRangeStr, rRangeList, 
pDoc);
+    ScRangeStringConverter::GetStringFromXMLRangeString(aRangeStr, rRangeList, 
*pDoc);
     if (aRangeStr.isEmpty())
     {
         pDoc->AddOLEObjectToCollection(rName);
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index f98c2c27d3a2..8b13cbc19304 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2212,7 +2212,7 @@ OUString SAL_CALL 
ScChart2DataProvider::convertRangeFromXML( const OUString& sXM
     }
 
     OUString aRet;
-    ScRangeStringConverter::GetStringFromXMLRangeString(aRet, sXMLRange, 
m_pDocument);
+    ScRangeStringConverter::GetStringFromXMLRangeString(aRet, sXMLRange, 
*m_pDocument);
     return aRet;
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to