sc/source/filter/oox/addressconverter.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
New commits: commit 9b9d6ad52d34543f20077edbcfc4cce76ded879d Author: siddhisalunkhe1998 <[email protected]> AuthorDate: Sun Nov 9 03:49:31 2025 +0000 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Nov 10 11:08:24 2025 +0100 tdf#48140 Remove UNO calls from AddressConverter::initializeMaxPos Replace XIndexAccess/XCellRangeAddressable with direct ScDocument access to retrieve max cell Change-Id: Ie4573942a6881d4d7dc141f04a778ccaaaa83a86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193639 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx index 98a8dae3b625..35e7ee9c5da2 100644 --- a/sc/source/filter/oox/addressconverter.cxx +++ b/sc/source/filter/oox/addressconverter.cxx @@ -29,6 +29,7 @@ #include <oox/helper/binaryinputstream.hxx> #include <docuno.hxx> #include <rangeutl.hxx> +#include <document.hxx> namespace oox::xls { @@ -303,11 +304,16 @@ void AddressConverter::initializeMaxPos( // maximum cell position in Calc try { - Reference< XIndexAccess > xSheetsIA( getDocument()->getSheets(), UNO_QUERY_THROW ); - Reference< XCellRangeAddressable > xAddressable( xSheetsIA->getByIndex( 0 ), UNO_QUERY_THROW ); - CellRangeAddress aRange = xAddressable->getRangeAddress(); - maMaxApiPos = ScAddress( aRange.EndColumn, aRange.EndRow, API_MAXTAB ); - maMaxPos = getBaseFilter().isImportFilter() ? maMaxApiPos : maMaxXlsPos; + ScDocument* pDoc = getDocument()->GetDocument(); + + if (pDoc) + { + SCCOL nEndCol = pDoc->MaxCol(); + SCROW nEndRow = pDoc->MaxRow(); + + maMaxApiPos = ScAddress(nEndCol, nEndRow, API_MAXTAB); + maMaxPos = getBaseFilter().isImportFilter() ? maMaxApiPos : maMaxXlsPos; + } } catch( Exception& ) {
