sc/inc/table.hxx                 |    8 --------
 sc/source/core/data/document.cxx |   24 +++++++-----------------
 2 files changed, 7 insertions(+), 25 deletions(-)

New commits:
commit 9368734ff9b5f7ccc962e5b93aacda215c6c8e27
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Jul 4 22:35:58 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Jul 4 21:57:52 2025 +0200

    Deduplicate some ScDocument functions
    
    Change-Id: I7a827366709fb0d0bdd883e6689a754b4581dc64
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187424
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index daa255957744..a499026ef46e 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -484,14 +484,6 @@ public:
     const ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow ) const;
     ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow );
 
-    CellType    GetCellType( const ScAddress& rPos ) const
-                    {
-                        if (!GetDoc().ValidColRow(rPos.Col(),rPos.Row()))
-                            return CELLTYPE_NONE;
-                        if (rPos.Col() >= aCol.size())
-                            return CELLTYPE_NONE;
-                        return aCol[rPos.Col()].GetCellType( rPos.Row() );
-                    }
     CellType    GetCellType( SCCOL nCol, SCROW nRow ) const;
     ScRefCellValue GetCellValue( SCCOL nCol, sc::ColumnBlockPosition& 
rBlockPos, SCROW nRow );
     ScRefCellValue GetCellValue( SCCOL nCol, SCROW nRow ) const;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index b18a68041448..f4e6844270ea 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3571,9 +3571,7 @@ OUString ScDocument::GetString( SCCOL nCol, SCROW nRow, 
SCTAB nTab, ScInterprete
 
 OUString ScDocument::GetString( const ScAddress& rPos, ScInterpreterContext* 
pContext ) const
 {
-    if (const ScTable* pTable = FetchTable(rPos.Tab()))
-        return pTable->GetString(rPos.Col(), rPos.Row(), pContext);
-    return OUString();
+    return GetString(rPos.Col(), rPos.Row(), rPos.Tab(), pContext);
 }
 
 double* ScDocument::GetValueCell( const ScAddress& rPos )
@@ -3685,16 +3683,14 @@ void ScDocument::RemoveEditTextCharAttribs( const 
ScAddress& rPos, const ScPatte
 
 double ScDocument::GetValue( const ScAddress& rPos ) const
 {
-    SCTAB nTab = rPos.Tab();
-    if (const ScTable* pTable = FetchTable(nTab))
-        return pTable->GetValue(rPos.Col(), rPos.Row());
-    return 0.0;
+    return GetValue(rPos.Col(), rPos.Row(), rPos.Tab());
 }
 
 double ScDocument::GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
 {
-    ScAddress aAdr(nCol, nRow, nTab);
-    return GetValue(aAdr);
+    if (const ScTable* pTable = FetchTable(nTab))
+        return pTable->GetValue(nCol, nRow);
+    return 0.0;
 }
 
 sal_uInt32 ScDocument::GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) 
const
@@ -3787,10 +3783,7 @@ ScFormulaCell* ScDocument::GetFormulaCell( const 
ScAddress& rPos )
 
 CellType ScDocument::GetCellType( const ScAddress& rPos ) const
 {
-    SCTAB nTab = rPos.Tab();
-    if (const ScTable* pTable = FetchTable(nTab))
-        return pTable->GetCellType(rPos);
-    return CELLTYPE_NONE;
+    return GetCellType(rPos.Col(), rPos.Row(), rPos.Tab());
 }
 
 CellType ScDocument::GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
@@ -4786,10 +4779,7 @@ const ScPatternAttr* ScDocument::GetPattern( SCCOL nCol, 
SCROW nRow, SCTAB nTab
 
 const ScPatternAttr* ScDocument::GetPattern( const ScAddress& rPos ) const
 {
-    if (const ScTable* pTable = FetchTable(rPos.Tab()))
-        return pTable->GetPattern(rPos.Col(), rPos.Row());
-
-    return nullptr;
+    return GetPattern(rPos.Col(), rPos.Row(), rPos.Tab());
 }
 
 const ScPatternAttr* ScDocument::GetMostUsedPattern( SCCOL nCol, SCROW 
nStartRow, SCROW nEndRow, SCTAB nTab ) const

Reply via email to