sc/inc/reftokenhelper.hxx                     |    2 +-
 sc/source/core/tool/reftokenhelper.cxx        |   12 ++++++------
 sc/source/filter/xml/XMLTableShapeResizer.cxx |    2 +-
 sc/source/ui/unoobj/chart2uno.cxx             |   14 +++++++-------
 4 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit cded40e436340163fd537946749019b68800be4d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Sep 15 15:36:46 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Sep 17 09:41:42 2020 +0200

    compileRangeRepresentation never called with null ScDocument*
    
    Change-Id: I910731ecc1b7a36b9532841c7cc9c9288110bfe3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102880
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/inc/reftokenhelper.hxx b/sc/inc/reftokenhelper.hxx
index a63d882011d7..c8ba9acca9b0 100644
--- a/sc/inc/reftokenhelper.hxx
+++ b/sc/inc/reftokenhelper.hxx
@@ -37,7 +37,7 @@ namespace ScRefTokenHelper
      * The source range may consist of multiple ranges separated by ';'s.
      */
     void compileRangeRepresentation(
-        ::std::vector<ScTokenRef>& rRefTokens, const OUString& rRangeStr, 
ScDocument* pDoc,
+        ::std::vector<ScTokenRef>& rRefTokens, const OUString& rRangeStr, 
ScDocument& rDoc,
         const sal_Unicode cSep, ::formula::FormulaGrammar::Grammar eGrammar, 
bool bOnly3DRef = false);
 
     bool getRangeFromToken(const ScDocument* pDoc, ScRange& rRange, const 
ScTokenRef& pToken, const ScAddress& rPos, bool bExternal = false);
diff --git a/sc/source/core/tool/reftokenhelper.cxx 
b/sc/source/core/tool/reftokenhelper.cxx
index bddb458f5004..a1ae5510e2d3 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -34,7 +34,7 @@ using namespace formula;
 using ::std::vector;
 
 void ScRefTokenHelper::compileRangeRepresentation(
-    vector<ScTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* 
pDoc,
+    vector<ScTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument& 
rDoc,
     const sal_Unicode cSep, FormulaGrammar::Grammar eGrammar, bool bOnly3DRef)
 {
     // #i107275# ignore parentheses
@@ -51,7 +51,7 @@ void ScRefTokenHelper::compileRangeRepresentation(
         if (nOffset < 0)
             break;
 
-        ScCompiler aCompiler(pDoc, ScAddress(0,0,0), eGrammar);
+        ScCompiler aCompiler(&rDoc, ScAddress(0,0,0), eGrammar);
         std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(aToken));
 
         // There MUST be exactly one reference per range token and nothing
@@ -77,7 +77,7 @@ void ScRefTokenHelper::compileRangeRepresentation(
             case svSingleRef:
                 {
                     const ScSingleRefData& rRef = *p->GetSingleRef();
-                    if (!rRef.Valid(pDoc))
+                    if (!rRef.Valid(&rDoc))
                         bFailure = true;
                     else if (bOnly3DRef && !rRef.IsFlag3D())
                         bFailure = true;
@@ -86,7 +86,7 @@ void ScRefTokenHelper::compileRangeRepresentation(
             case svDoubleRef:
                 {
                     const ScComplexRefData& rRef = *p->GetDoubleRef();
-                    if (!rRef.Valid(pDoc))
+                    if (!rRef.Valid(&rDoc))
                         bFailure = true;
                     else if (bOnly3DRef && !rRef.Ref1.IsFlag3D())
                         bFailure = true;
@@ -94,13 +94,13 @@ void ScRefTokenHelper::compileRangeRepresentation(
                 break;
             case svExternalSingleRef:
                 {
-                    if (!p->GetSingleRef()->ValidExternal(pDoc))
+                    if (!p->GetSingleRef()->ValidExternal(&rDoc))
                         bFailure = true;
                 }
                 break;
             case svExternalDoubleRef:
                 {
-                    if (!p->GetDoubleRef()->ValidExternal(pDoc))
+                    if (!p->GetDoubleRef()->ValidExternal(&rDoc))
                         bFailure = true;
                 }
                 break;
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx 
b/sc/source/filter/xml/XMLTableShapeResizer.cxx
index bac71f2ab82d..84bc25588cdd 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.cxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx
@@ -84,7 +84,7 @@ 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, *pDoc, cSep, pDoc->GetGrammar());
     if (pRefTokens->empty())
         return;
 
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 8b13cbc19304..75593140747d 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1001,7 +1001,7 @@ sal_Bool SAL_CALL 
ScChart2DataProvider::createDataSourcePossible( const uno::Seq
     vector<ScTokenRef> aTokens;
     const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
     ScRefTokenHelper::compileRangeRepresentation(
-        aTokens, aRangeRepresentation, m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
+        aTokens, aRangeRepresentation, *m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
     return !aTokens.empty();
 }
 
@@ -1432,7 +1432,7 @@ ScChart2DataProvider::createDataSource(
     vector<ScTokenRef> aRefTokens;
     const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
     ScRefTokenHelper::compileRangeRepresentation(
-        aRefTokens, aRangeRepresentation, m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
+        aRefTokens, aRangeRepresentation, *m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
     if (aRefTokens.empty())
         // Invalid range representation.  Bail out.
         throw lang::IllegalArgumentException();
@@ -1774,7 +1774,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL 
ScChart2DataProvider::detectArgum
                     vector<ScTokenRef> aTokens;
                     const sal_Unicode cSep = 
ScCompiler::GetNativeSymbolChar(ocSep);
                     ScRefTokenHelper::compileRangeRepresentation(
-                        aTokens, xLabel->getSourceRangeRepresentation(), 
m_pDocument, cSep, m_pDocument->GetGrammar(), true);
+                        aTokens, xLabel->getSourceRangeRepresentation(), 
*m_pDocument, cSep, m_pDocument->GetGrammar(), true);
                     aLabel.initRangeAnalyzer(aTokens);
                     for (const auto& rxToken : aTokens)
                     {
@@ -1792,7 +1792,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL 
ScChart2DataProvider::detectArgum
                     vector<ScTokenRef> aTokens;
                     const sal_Unicode cSep = 
ScCompiler::GetNativeSymbolChar(ocSep);
                     ScRefTokenHelper::compileRangeRepresentation(
-                        aTokens, xValues->getSourceRangeRepresentation(), 
m_pDocument, cSep, m_pDocument->GetGrammar(), true);
+                        aTokens, xValues->getSourceRangeRepresentation(), 
*m_pDocument, cSep, m_pDocument->GetGrammar(), true);
                     aValues.initRangeAnalyzer(aTokens);
                     for (const auto& rxToken : aTokens)
                     {
@@ -1976,7 +1976,7 @@ sal_Bool SAL_CALL 
ScChart2DataProvider::createDataSequenceByRangeRepresentationP
     vector<ScTokenRef> aTokens;
     const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
     ScRefTokenHelper::compileRangeRepresentation(
-        aTokens, aRangeRepresentation, m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
+        aTokens, aRangeRepresentation, *m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
     return !aTokens.empty();
 }
 
@@ -1994,7 +1994,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL
     vector<ScTokenRef> aRefTokens;
     const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
     ScRefTokenHelper::compileRangeRepresentation(
-        aRefTokens, aRangeRepresentation, m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
+        aRefTokens, aRangeRepresentation, *m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
     if (aRefTokens.empty())
         return xResult;
 
@@ -2164,7 +2164,7 @@ OUString SAL_CALL 
ScChart2DataProvider::convertRangeToXML( const OUString& sRang
     vector<ScTokenRef> aRefTokens;
     const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
     ScRefTokenHelper::compileRangeRepresentation(
-        aRefTokens, sRangeRepresentation, m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
+        aRefTokens, sRangeRepresentation, *m_pDocument, cSep, 
m_pDocument->GetGrammar(), true);
     if (aRefTokens.empty())
         throw lang::IllegalArgumentException();
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to