[Libreoffice-commits] core.git: sc/inc sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 13 19:17:28 UTC 2020


 sc/inc/address.hxx                |    2 +-
 sc/source/core/tool/address.cxx   |    6 +++---
 sc/source/ui/vba/vbarange.cxx     |    8 ++++----
 sc/source/ui/vba/vbarange.hxx     |    2 +-
 sc/source/ui/vba/vbaworksheet.cxx |    2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit bc3bddc67de7a7604a123854860395554512abe6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Sep 13 14:57:18 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Sep 13 21:16:48 2020 +0200

    ParseCols never passed a null ScDocument*
    
    Change-Id: I2276af9d49226bd3ef6514910ead9a7f4c263fe8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102583
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 772cd7112cff..a56572c65f8f 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -559,7 +559,7 @@ public:
 
     SC_DLLPUBLIC ScRefFlags ParseAny( const OUString&, const ScDocument*,
                                       const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 );
-    SC_DLLPUBLIC ScRefFlags ParseCols( const ScDocument* pDoc,
+    SC_DLLPUBLIC ScRefFlags ParseCols( const ScDocument& rDoc,
                                        const OUString&,
                                        const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 );
     SC_DLLPUBLIC void ParseRows( const ScDocument& rDoc,
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 0d432a795305..eaccf67a1149 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1785,7 +1785,7 @@ ScRefFlags ScRange::ParseAny( const OUString& rString, const ScDocument* pDoc,
 }
 
 // Parse only full row references
-ScRefFlags ScRange::ParseCols( const ScDocument* pDoc,
+ScRefFlags ScRange::ParseCols( const ScDocument& rDoc,
                                const OUString& rStr,
                                const ScAddress::Details& rDetails )
 {
@@ -1802,11 +1802,11 @@ ScRefFlags ScRange::ParseCols( const ScDocument* pDoc,
     case formula::FormulaGrammar::CONV_OOO: // No full col refs in OOO yet, assume XL notation
     case formula::FormulaGrammar::CONV_XL_A1:
     case formula::FormulaGrammar::CONV_XL_OOX:
-        if (nullptr != (p = lcl_a1_get_col( pDoc, p, &aStart, &ignored, nullptr) ) )
+        if (nullptr != (p = lcl_a1_get_col( &rDoc, p, &aStart, &ignored, nullptr) ) )
         {
             if( p[0] == ':')
             {
-                if( nullptr != (p = lcl_a1_get_col( pDoc, p+1, &aEnd, &ignored, nullptr)))
+                if( nullptr != (p = lcl_a1_get_col( &rDoc, p+1, &aEnd, &ignored, nullptr)))
                 {
                     nRes = ScRefFlags::COL_VALID;
                 }
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index e646b60c681f..6610d0fc1b5c 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -2146,12 +2146,12 @@ ScVbaRange::Cells( const uno::Any &nRowIndex, const uno::Any &nColumnIndex )
 
     // Performance: Use a common helper method for ScVbaRange::Cells and ScVbaWorksheet::Cells,
     // instead of creating a new ScVbaRange object in often-called ScVbaWorksheet::Cells
-    return CellsHelper( &getScDocument(), mxParent, mxContext, mxRange, nRowIndex, nColumnIndex );
+    return CellsHelper( getScDocument(), mxParent, mxContext, mxRange, nRowIndex, nColumnIndex );
 }
 
 // static
 uno::Reference< excel::XRange >
-ScVbaRange::CellsHelper( const ScDocument* pDoc,
+ScVbaRange::CellsHelper( const ScDocument& rDoc,
                          const uno::Reference< ov::XHelperInterface >& xParent,
                          const uno::Reference< uno::XComponentContext >& xContext,
                          const uno::Reference< css::table::XCellRange >& xRange,
@@ -2186,7 +2186,7 @@ ScVbaRange::CellsHelper( const ScDocument* pDoc,
         {
             ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
             ScRange tmpRange;
-            ScRefFlags flags = tmpRange.ParseCols( pDoc, sCol, dDetails );
+            ScRefFlags flags = tmpRange.ParseCols( rDoc, sCol, dDetails );
             if ( (flags & ScRefFlags::COL_VALID) == ScRefFlags::ZERO )
                throw uno::RuntimeException();
             nColumn = tmpRange.aStart.Col() + 1;
@@ -2405,7 +2405,7 @@ ScVbaRange::Columns(const uno::Any& aIndex )
         {
             ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
             ScRange tmpRange;
-            tmpRange.ParseCols( &getScDocument(), sAddress, dDetails );
+            tmpRange.ParseCols( getScDocument(), sAddress, dDetails );
             SCCOL nStartCol = tmpRange.aStart.Col();
             SCCOL nEndCol = tmpRange.aEnd.Col();
 
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index 5c28acf6f245..76cccdb5e1bb 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -164,7 +164,7 @@ public:
 
     /// @throws css::uno::RuntimeException
     static css::uno::Reference< ov::excel::XRange > CellsHelper(
-        const ScDocument* pDoc,
+        const ScDocument& rDoc,
         const css::uno::Reference< ov::XHelperInterface >& xParent,
         const css::uno::Reference< css::uno::XComponentContext >& xContext,
         const css::uno::Reference< css::table::XCellRange >& xRange,
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index 91cfcd09a6f8..a2caa3fb3a77 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -671,7 +671,7 @@ ScVbaWorksheet::Cells( const ::uno::Any &nRow, const ::uno::Any &nCol )
     uno::Reference< table::XCellRange > xRange( getSheet(), uno::UNO_QUERY_THROW );
     uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
     ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
-    return ScVbaRange::CellsHelper( &rDoc, this, mxContext, xRange, nRow, nCol );
+    return ScVbaRange::CellsHelper( rDoc, this, mxContext, xRange, nRow, nCol );
 }
 
 uno::Reference< excel::XRange >


More information about the Libreoffice-commits mailing list