summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-02-10 13:38:56 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-02-10 21:53:34 +0100
commit5e402bac39dc4245844efbde442bdb3bd993a157 (patch)
tree3c6bdbba3233a78779e2f9233f68510d9534e3dc /sc
parent7973ba264101f46356d632545e4cb303f5b6d6c1 (diff)
remove most hardcoded MAXCOL/MAXROW from Calc filters
Change-Id: I50d4a5c22a2b224526978e41fc7b8cb194b4bf3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129780 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/colrowst.cxx4
-rw-r--r--sc/source/filter/excel/xelink.cxx2
-rw-r--r--sc/source/filter/excel/xistyle.cxx8
-rw-r--r--sc/source/filter/inc/xistyle.hxx2
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx5
-rw-r--r--sc/source/filter/xml/xmlcoli.cxx2
-rw-r--r--sc/source/filter/xml/xmlsubti.cxx5
7 files changed, 15 insertions, 13 deletions
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index 755e1d355b2f..e194b7309d9b 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -28,8 +28,8 @@
XclImpColRowSettings::XclImpColRowSettings( const XclImpRoot& rRoot ) :
XclImpRoot( rRoot ),
- maColWidths(0, MAXCOLCOUNT, 0),
- maColFlags(0, MAXCOLCOUNT, ExcColRowFlags::NONE),
+ maColWidths(0, rRoot.GetDoc().GetSheetLimits().GetMaxColCount(), 0),
+ maColFlags(0, rRoot.GetDoc().GetSheetLimits().GetMaxColCount(), ExcColRowFlags::NONE),
maRowHeights(0, rRoot.GetDoc().GetSheetLimits().GetMaxRowCount(), 0),
maRowFlags(0, rRoot.GetDoc().GetSheetLimits().GetMaxRowCount(), ExcColRowFlags::NONE),
maHiddenRows(0, rRoot.GetDoc().GetSheetLimits().GetMaxRowCount(), false),
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index c2224dacacdb..4bdc243355a4 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -1381,7 +1381,7 @@ bool XclExpXct::BuildCrnList( XclExpCrnList& rCrnRecs )
for( SCROW nScRow = nScRow1; bValid && (nScRow <= nScRow2); ++nScRow )
{
::std::pair< SCCOL, SCCOL > aColRange = mxCacheTable->getColRange( nScRow );
- const SCCOL nScEnd = ::std::min( aColRange.second, MAXCOLCOUNT );
+ const SCCOL nScEnd = ::std::min( aColRange.second, GetDoc().GetSheetLimits().GetMaxColCount() );
for( SCCOL nScCol = aColRange.first; bValid && (nScCol < nScEnd); ++nScCol )
{
if( maUsedCells.IsCellMarked( nScCol, nScRow, true ) )
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 808ddbcbdd64..4161d47a94df 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1715,14 +1715,14 @@ bool XclImpXFRange::Expand( const XclImpXFRange& rNextRange )
return false;
}
-void XclImpXFRangeColumn::SetDefaultXF( const XclImpXFIndex& rXFIndex )
+void XclImpXFRangeColumn::SetDefaultXF( const XclImpXFIndex& rXFIndex, const XclImpRoot& rRoot )
{
// List should be empty when inserting the default column format.
// Later explicit SetXF() calls will break up this range.
OSL_ENSURE( maIndexList.empty(), "XclImpXFRangeColumn::SetDefaultXF - Setting Default Column XF is not empty" );
// insert a complete row range with one insert.
- maIndexList.push_back( std::make_unique<XclImpXFRange>( 0, MAXROW, rXFIndex ) );
+ maIndexList.push_back( std::make_unique<XclImpXFRange>( 0, rRoot.GetDoc().MaxRow(), rXFIndex ) );
}
void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
@@ -1939,7 +1939,7 @@ void XclImpXFRangeBuffer::SetBoolXF( const ScAddress& rScPos, sal_uInt16 nXFInde
void XclImpXFRangeBuffer::SetRowDefXF( SCROW nScRow, sal_uInt16 nXFIndex )
{
- for( SCCOL nScCol = 0; nScCol <= MAXCOL; ++nScCol )
+ for( SCCOL nScCol = 0; nScCol <= GetDoc().MaxCol(); ++nScCol )
SetXF( ScAddress( nScCol, nScRow, 0 ), nXFIndex, xlXFModeRow );
}
@@ -1951,7 +1951,7 @@ void XclImpXFRangeBuffer::SetColumnDefXF( SCCOL nScCol, sal_uInt16 nXFIndex )
maColumns.resize( nIndex + 1 );
OSL_ENSURE( !maColumns[ nIndex ], "XclImpXFRangeBuffer::SetColumnDefXF - default column of XFs already has values" );
maColumns[ nIndex ] = std::make_shared<XclImpXFRangeColumn>();
- maColumns[ nIndex ]->SetDefaultXF( XclImpXFIndex( nXFIndex ) );
+ maColumns[ nIndex ]->SetDefaultXF( XclImpXFIndex( nXFIndex ), GetRoot());
}
void XclImpXFRangeBuffer::SetBorderLine( const ScRange& rRange, SCTAB nScTab, SvxBoxItemLine nLine )
diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index a462c8d5a1d0..1d0f0e04c5b1 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -576,7 +576,7 @@ public:
IndexList::iterator end() { return maIndexList.end(); }
/** Inserts a single row range into the list. */
- void SetDefaultXF( const XclImpXFIndex& rXFIndex );
+ void SetDefaultXF( const XclImpXFIndex& rXFIndex, const XclImpRoot& rRoot );
/** Inserts a new (encoded) XF index (first try to expand the last range). */
void SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex );
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index a31a7659cc76..e4dbc07a9e6b 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -180,8 +180,9 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
nMatrixRows = static_cast<SCROW>(it.toInt32());
break;
case XML_ELEMENT( TABLE, XML_NUMBER_COLUMNS_REPEATED ):
- nColsRepeated = static_cast<SCCOL>(std::min<sal_Int32>( MAXCOLCOUNT,
- std::max( it.toInt32(), static_cast<sal_Int32>(1) ) ));
+ nColsRepeated = static_cast<SCCOL>(
+ std::min<sal_Int32>( rImport.GetDocument()->GetSheetLimits().GetMaxRowCount(),
+ std::max( it.toInt32(), static_cast<sal_Int32>(1) ) ));
break;
case XML_ELEMENT( OFFICE, XML_VALUE_TYPE ):
nCellType = ScXMLImport::GetCellType(it.toCString(), it.getLength());
diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx
index fc40a6f63c6b..c50ece581ac6 100644
--- a/sc/source/filter/xml/xmlcoli.cxx
+++ b/sc/source/filter/xml/xmlcoli.cxx
@@ -53,7 +53,7 @@ ScXMLTableColContext::ScXMLTableColContext( ScXMLImport& rImport,
case XML_ELEMENT( TABLE, XML_NUMBER_COLUMNS_REPEATED ):
{
nColCount = std::max<sal_Int32>(aIter.toInt32(), 1);
- nColCount = std::min<sal_Int32>(nColCount, MAXCOLCOUNT);
+ nColCount = std::min<sal_Int32>(nColCount, rImport.GetDocument()->GetSheetLimits().GetMaxRowCount() );
}
break;
case XML_ELEMENT( TABLE, XML_STYLE_NAME ):
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index 190dc30d3d1f..8016264bc72d 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -212,8 +212,9 @@ void ScMyTables::AddColStyle(const sal_Int32 nRepeat, const OUString& rCellStyle
{
rImport.GetStylesImportHelper()->AddColumnStyle(rCellStyleName, nCurrentColCount, nRepeat);
nCurrentColCount += nRepeat;
- SAL_WARN_IF(nCurrentColCount > MAXCOLCOUNT, "sc", "more columns than fit into SCCOL");
- nCurrentColCount = std::min<sal_Int32>( nCurrentColCount, MAXCOLCOUNT );
+ SAL_WARN_IF(nCurrentColCount > rImport.GetDocument()->GetSheetLimits().GetMaxRowCount(),
+ "sc", "more columns than fit into SCCOL");
+ nCurrentColCount = std::min<sal_Int32>( nCurrentColCount, rImport.GetDocument()->GetSheetLimits().GetMaxRowCount() );
}
uno::Reference< drawing::XDrawPage > const & ScMyTables::GetCurrentXDrawPage()