[Libreoffice-commits] core.git: sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 23 09:06:47 UTC 2019
sc/source/ui/unoobj/cellsuno.cxx | 75 ++++++++++++++++++++------------------
sc/source/ui/unoobj/chart2uno.cxx | 24 ++++++------
sc/source/ui/unoobj/confuno.cxx | 4 +-
sc/source/ui/unoobj/cursuno.cxx | 14 ++++---
sc/source/ui/unoobj/defltuno.cxx | 4 +-
sc/source/ui/unoobj/docuno.cxx | 51 ++++++++++++++++---------
sc/source/ui/unoobj/funcuno.cxx | 8 ++--
sc/source/ui/unoobj/nameuno.cxx | 6 +--
sc/source/ui/unoobj/servuno.cxx | 3 -
sc/source/ui/unoobj/shapeuno.cxx | 4 +-
sc/source/ui/unoobj/styleuno.cxx | 8 ++--
11 files changed, 110 insertions(+), 91 deletions(-)
New commits:
commit 009e7a54f40ebacd9dd4a394504c277789699801
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Oct 22 15:30:34 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 23 11:05:29 2019 +0200
sc: rowcol: tdf#50916 convert unoobj
Change-Id: Iec648767c7f09f9655dcd6bceff9df5fc66026de
Reviewed-on: https://gerrit.libreoffice.org/81332
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index d7280b666477..b28ece90e404 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -921,13 +921,13 @@ static SCTAB lcl_FirstTab( const ScRangeList& rRanges )
return rFirst.aStart.Tab();
}
-static bool lcl_WholeSheet( const ScRangeList& rRanges )
+static bool lcl_WholeSheet( const ScDocument* pDoc, const ScRangeList& rRanges )
{
if ( rRanges.size() == 1 )
{
const ScRange & rRange = rRanges[0];
- if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL &&
- rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW )
+ if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == pDoc->MaxCol() &&
+ rRange.aStart.Row() == 0 && rRange.aEnd.Row() == pDoc->MaxRow() )
return true;
}
return false;
@@ -1560,8 +1560,8 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
ScRange & rR = aRanges.front();
rR.aStart.SetCol(0);
rR.aStart.SetRow(0);
- rR.aEnd.SetCol(MAXCOL);
- rR.aEnd.SetRow(MAXROW);
+ rR.aEnd.SetCol(rDoc.MaxCol());
+ rR.aEnd.SetRow(rDoc.MaxRow());
}
RefChanged();
@@ -2919,9 +2919,10 @@ std::unique_ptr<ScMemChart> ScCellRangesBase::CreateMemChart_Impl() const
// (only here - Listeners are registered for the whole area)
//! check immediately if a ScTableSheetObj?
+ const ScDocument & rDoc = pDocShell->GetDocument();
const ScRange & rRange = aRanges[0];
- if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL &&
- rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW )
+ if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == rDoc.MaxCol() &&
+ rRange.aStart.Row() == 0 && rRange.aEnd.Row() == rDoc.MaxRow() )
{
SCTAB nTab = rRange.aStart.Tab();
@@ -2987,9 +2988,10 @@ ScRangeListRef ScCellRangesBase::GetLimitedChartRanges_Impl( long nDataColumns,
{
if ( aRanges.size() == 1 )
{
+ const ScDocument & rDoc = pDocShell->GetDocument();
const ScRange & rRange = aRanges[0];
- if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL &&
- rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW )
+ if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == rDoc.MaxCol() &&
+ rRange.aStart.Row() == 0 && rRange.aEnd.Row() == rDoc.MaxRow() )
{
// if aRanges is a complete sheet, limit to given size
@@ -2998,14 +3000,14 @@ ScRangeListRef ScCellRangesBase::GetLimitedChartRanges_Impl( long nDataColumns,
long nEndColumn = nDataColumns - 1 + ( bChartColAsHdr ? 1 : 0 );
if ( nEndColumn < 0 )
nEndColumn = 0;
- if ( nEndColumn > MAXCOL )
- nEndColumn = MAXCOL;
+ if ( nEndColumn > rDoc.MaxCol() )
+ nEndColumn = rDoc.MaxCol();
long nEndRow = nDataRows - 1 + ( bChartRowAsHdr ? 1 : 0 );
if ( nEndRow < 0 )
nEndRow = 0;
- if ( nEndRow > MAXROW )
- nEndRow = MAXROW;
+ if ( nEndRow > rDoc.MaxRow() )
+ nEndRow = rDoc.MaxRow();
ScRangeListRef xChartRanges = new ScRangeList( ScRange( 0, 0, nTab, static_cast<SCCOL>(nEndColumn), static_cast<SCROW>(nEndRow), nTab ) );
return xChartRanges;
@@ -3341,21 +3343,21 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryVisibleC
ScDocument& rDoc = pDocShell->GetDocument();
SCCOL nCol = 0, nLastCol;
- while (nCol <= MAXCOL)
+ while (nCol <= rDoc.MaxCol())
{
if (rDoc.ColHidden(nCol, nTab, nullptr, &nLastCol))
// hidden columns. Deselect them.
- aMarkData.SetMultiMarkArea(ScRange(nCol, 0, nTab, nLastCol, MAXROW, nTab), false);
+ aMarkData.SetMultiMarkArea(ScRange(nCol, 0, nTab, nLastCol, rDoc.MaxRow(), nTab), false);
nCol = nLastCol + 1;
}
SCROW nRow = 0, nLastRow;
- while (nRow <= MAXROW)
+ while (nRow <= rDoc.MaxRow())
{
if (rDoc.RowHidden(nRow, nTab, nullptr, &nLastRow))
// These rows are hidden. Deselect them.
- aMarkData.SetMultiMarkArea(ScRange(0, nRow, nTab, MAXCOL, nLastRow, nTab), false);
+ aMarkData.SetMultiMarkArea(ScRange(0, nRow, nTab, rDoc.MaxCol(), nLastRow, nTab), false);
nRow = nLastRow + 1;
}
@@ -3563,18 +3565,18 @@ uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl(
SCTAB nTab = lcl_FirstTab(aRanges); //! for all tables, if markings per table
ScRange aCmpRange, aCellRange;
if (bColumnDiff)
- aCmpRange = ScRange( 0,nCmpPos,nTab, MAXCOL,nCmpPos,nTab );
+ aCmpRange = ScRange( 0,nCmpPos,nTab, rDoc.MaxCol(),nCmpPos,nTab );
else
- aCmpRange = ScRange( static_cast<SCCOL>(nCmpPos),0,nTab, static_cast<SCCOL>(nCmpPos),MAXROW,nTab );
+ aCmpRange = ScRange( static_cast<SCCOL>(nCmpPos),0,nTab, static_cast<SCCOL>(nCmpPos),rDoc.MaxRow(),nTab );
ScCellIterator aCmpIter( &rDoc, aCmpRange );
for (bool bHasCell = aCmpIter.first(); bHasCell; bHasCell = aCmpIter.next())
{
SCCOLROW nCellPos = bColumnDiff ? static_cast<SCCOLROW>(aCmpIter.GetPos().Col()) : static_cast<SCCOLROW>(aCmpIter.GetPos().Row());
if (bColumnDiff)
aCellRange = ScRange( static_cast<SCCOL>(nCellPos),0,nTab,
- static_cast<SCCOL>(nCellPos),MAXROW,nTab );
+ static_cast<SCCOL>(nCellPos),rDoc.MaxRow(),nTab );
else
- aCellRange = ScRange( 0,nCellPos,nTab, MAXCOL,nCellPos,nTab );
+ aCellRange = ScRange( 0,nCellPos,nTab, rDoc.MaxCol(),nCellPos,nTab );
for (i=0; i<nRangeCount; i++)
{
@@ -3738,7 +3740,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependen
SCTAB nTab = lcl_FirstTab(aNewRanges); //! all tables
- ScCellIterator aCellIter( &rDoc, ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab) );
+ ScCellIterator aCellIter( &rDoc, ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab) );
for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next())
{
if (aCellIter.getType() != CELLTYPE_FORMULA)
@@ -3804,7 +3806,7 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
ScDocument& rDoc = pDocShell->GetDocument();
pSearchItem->SetCommand( SvxSearchCmd::FIND_ALL );
// always only within this object
- pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
+ pSearchItem->SetSelection( !lcl_WholeSheet(&rDoc, aRanges) );
ScMarkData aMark(*GetMarkData());
@@ -3842,7 +3844,7 @@ uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
ScDocument& rDoc = pDocShell->GetDocument();
pSearchItem->SetCommand( SvxSearchCmd::FIND );
// only always in this object
- pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
+ pSearchItem->SetSelection( !lcl_WholeSheet(&rDoc, aRanges) );
ScMarkData aMark(*GetMarkData());
@@ -3924,7 +3926,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea
bool bUndo(rDoc.IsUndoEnabled());
pSearchItem->SetCommand( SvxSearchCmd::REPLACE_ALL );
// only always in this object
- pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
+ pSearchItem->SetSelection( !lcl_WholeSheet(&rDoc, aRanges) );
ScMarkData aMark(*GetMarkData());
@@ -5252,7 +5254,8 @@ void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
default:
bError = true;
}
- if (nCount < 0 || nCount > MAXROW) // overflow
+ const ScDocument& rDoc = pDocSh->GetDocument();
+ if (nCount < 0 || nCount > rDoc.MaxRow()) // overflow
bError = true;
if (!bError)
@@ -6562,7 +6565,7 @@ sal_Int16 SAL_CALL ScCellObj::resetActionLocks()
}
ScTableSheetObj::ScTableSheetObj( ScDocShell* pDocSh, SCTAB nTab ) :
- ScCellRangeObj( pDocSh, ScRange(0,0,nTab, MAXCOL,MAXROW,nTab) ),
+ ScCellRangeObj( pDocSh, ScRange(0,0,nTab, pDocSh->GetDocument().MaxCol(), pDocSh->GetDocument().MaxRow(),nTab) ),
pSheetPropSet(lcl_GetSheetPropertySet())
{
}
@@ -6573,7 +6576,8 @@ ScTableSheetObj::~ScTableSheetObj()
void ScTableSheetObj::InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab)
{
- InitInsertRange( pDocSh, ScRange(0,0,nTab, MAXCOL,MAXROW,nTab) );
+ ScDocument& rDoc = pDocSh->GetDocument();
+ InitInsertRange( pDocSh, ScRange(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab) );
}
uno::Any SAL_CALL ScTableSheetObj::queryInterface( const uno::Type& rType )
@@ -6731,8 +6735,9 @@ uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursor()
if ( pDocSh )
{
//! single cell or whole table??????
+ const ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- return new ScCellCursorObj( pDocSh, ScRange( 0,0,nTab, MAXCOL,MAXROW,nTab ) );
+ return new ScCellCursorObj( pDocSh, ScRange( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab ) );
}
return nullptr;
}
@@ -6798,7 +6803,7 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPage
}
SCCOL nCount = 0;
- for (SCCOL nCol : rDoc.GetColumnsRange(nTab, 0, MAXCOL))
+ for (SCCOL nCol : rDoc.GetColumnsRange(nTab, 0, rDoc.MaxCol()))
if (rDoc.HasColBreak(nCol, nTab) != ScBreakType::NONE)
++nCount;
@@ -6806,7 +6811,7 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPage
uno::Sequence<sheet::TablePageBreakData> aSeq(nCount);
sheet::TablePageBreakData* pAry = aSeq.getArray();
sal_uInt16 nPos = 0;
- for (SCCOL nCol : rDoc.GetColumnsRange(nTab, 0, MAXCOL))
+ for (SCCOL nCol : rDoc.GetColumnsRange(nTab, 0, rDoc.MaxCol()))
{
ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
if (nBreak != ScBreakType::NONE)
@@ -6861,7 +6866,7 @@ void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks()
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
- rDoc.CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
+ rDoc.CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
pDocSh->GetUndoManager()->AddUndoAction(
std::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
}
@@ -6871,7 +6876,7 @@ void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks()
//? UpdatePageBreakData( sal_True );
pDocSh->SetDocumentModified();
- pDocSh->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PaintPartFlags::Grid);
+ pDocSh->PostPaint(ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab), PaintPartFlags::Grid);
}
}
@@ -8305,7 +8310,7 @@ uno::Sequence<OUString> SAL_CALL ScTableSheetObj::getSupportedServiceNames()
UNO3_GETIMPLEMENTATION2_IMPL(ScTableSheetObj, ScCellRangeObj);
ScTableColumnObj::ScTableColumnObj( ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab ) :
- ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol,MAXROW,nTab) ),
+ ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol, pDocSh->GetDocument().MaxRow(),nTab) ),
pColPropSet(lcl_GetColumnPropertySet())
{
}
@@ -8489,7 +8494,7 @@ const SfxItemPropertyMap& ScTableColumnObj::GetItemPropertyMap()
}
ScTableRowObj::ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab) :
- ScCellRangeObj( pDocSh, ScRange(0,nRow,nTab, MAXCOL,nRow,nTab) ),
+ ScCellRangeObj( pDocSh, ScRange(0,nRow,nTab, pDocSh->GetDocument().MaxCol(),nRow,nTab) ),
pRowPropSet(lcl_GetRowPropertySet())
{
}
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 68bdd4e86ce4..0f404ba5d780 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -540,10 +540,10 @@ void Chart2Positioner::glueState()
ScRefTokenHelper::getDoubleRefDataFromToken(aData, rxToken);
SCCOLROW n1 = aData.Ref1.Col();
SCCOLROW n2 = aData.Ref2.Col();
- if (n1 > MAXCOL)
- n1 = MAXCOL;
- if (n2 > MAXCOL)
- n2 = MAXCOL;
+ if (n1 > mpDoc->MaxCol())
+ n1 = mpDoc->MaxCol();
+ if (n2 > mpDoc->MaxCol())
+ n2 = mpDoc->MaxCol();
if (n1 < mnStartCol)
mnStartCol = static_cast<SCCOL>(n1);
if (n2 > nEndCol)
@@ -551,10 +551,10 @@ void Chart2Positioner::glueState()
n1 = aData.Ref1.Row();
n2 = aData.Ref2.Row();
- if (n1 > MAXROW)
- n1 = MAXROW;
- if (n2 > MAXROW)
- n2 = MAXROW;
+ if (n1 > mpDoc->MaxRow())
+ n1 = mpDoc->MaxRow();
+ if (n2 > mpDoc->MaxRow())
+ n2 = mpDoc->MaxRow();
if (n1 < mnStartRow)
mnStartRow = static_cast<SCROW>(n1);
@@ -1342,15 +1342,15 @@ public:
if(abs((e.Col()-s.Col())*(e.Row()-s.Row())) < SHRINK_RANGE_THRESHOLD)
return;
- SCCOL nMinCol = MAXCOL, nMaxCol = 0;
- SCROW nMinRow = MAXROW, nMaxRow = 0;
+ SCCOL nMinCol = mpDoc->MaxCol(), nMaxCol = 0;
+ SCROW nMinRow = mpDoc->MaxRow(), nMaxRow = 0;
// Determine the smallest range that encompasses the data ranges of all sheets.
SCTAB nTab1 = s.Tab(), nTab2 = e.Tab();
for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
{
- SCCOL nCol1 = 0, nCol2 = MAXCOL;
- SCROW nRow1 = 0, nRow2 = MAXROW;
+ SCCOL nCol1 = 0, nCol2 = mpDoc->MaxCol();
+ SCROW nRow1 = 0, nRow2 = mpDoc->MaxRow();
mpDoc->ShrinkToDataArea(nTab, nCol1, nRow1, nCol2, nRow2);
nMinCol = std::min(nMinCol, nCol1);
nMinRow = std::min(nMinRow, nRow1);
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index 9403d73408cc..5cd457885c71 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -417,8 +417,8 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
// update automatic row heights and repaint
SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) )
- pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PaintPartFlags::Grid);
+ if ( !pDocShell->AdjustRowHeight( 0, rDoc.MaxRow(), nTab ) )
+ pDocShell->PostPaint(ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab), PaintPartFlags::Grid);
pDocShell->SetDocumentModified();
}
diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx
index dd9b03c57e83..82cbe769fb34 100644
--- a/sc/source/ui/unoobj/cursuno.cxx
+++ b/sc/source/ui/unoobj/cursuno.cxx
@@ -162,7 +162,7 @@ void SAL_CALL ScCellCursorObj::expandToEntireColumns()
ScRange aNewRange( rRanges[ 0 ] );
aNewRange.aStart.SetRow( 0 );
- aNewRange.aEnd.SetRow( MAXROW );
+ aNewRange.aEnd.SetRow( GetDocShell()->GetDocument().MaxRow() );
SetNewRange( aNewRange );
}
@@ -175,7 +175,7 @@ void SAL_CALL ScCellCursorObj::expandToEntireRows()
ScRange aNewRange( rRanges[ 0 ] );
aNewRange.aStart.SetCol( 0 );
- aNewRange.aEnd.SetCol( MAXCOL );
+ aNewRange.aEnd.SetCol( GetDocShell()->GetDocument().MaxCol() );
SetNewRange( aNewRange );
}
@@ -196,12 +196,13 @@ void SAL_CALL ScCellCursorObj::collapseToSize( sal_Int32 nColumns, sal_Int32 nRo
aNewRange.PutInOrder(); //! really?
+ const auto & rDoc = GetDocShell()->GetDocument();
long nEndX = aNewRange.aStart.Col() + nColumns - 1;
long nEndY = aNewRange.aStart.Row() + nRows - 1;
if ( nEndX < 0 ) nEndX = 0;
- if ( nEndX > MAXCOL ) nEndX = MAXCOL;
+ if ( nEndX > rDoc.MaxCol() ) nEndX = rDoc.MaxCol();
if ( nEndY < 0 ) nEndY = 0;
- if ( nEndY > MAXROW ) nEndY = MAXROW;
+ if ( nEndY > rDoc.MaxRow() ) nEndY = rDoc.MaxRow();
//! error/exception or so, if too big/small
aNewRange.aEnd.SetCol(static_cast<SCCOL>(nEndX));
@@ -379,10 +380,11 @@ void SAL_CALL ScCellCursorObj::gotoOffset( sal_Int32 nColumnOffset, sal_Int32 nR
ScRange aOneRange( rRanges[ 0 ] );
aOneRange.PutInOrder();
+ const auto & rDoc = GetDocShell()->GetDocument();
if ( aOneRange.aStart.Col() + nColumnOffset >= 0 &&
- aOneRange.aEnd.Col() + nColumnOffset <= MAXCOL &&
+ aOneRange.aEnd.Col() + nColumnOffset <= rDoc.MaxCol() &&
aOneRange.aStart.Row() + nRowOffset >= 0 &&
- aOneRange.aEnd.Row() + nRowOffset <= MAXROW )
+ aOneRange.aEnd.Row() + nRowOffset <= rDoc.MaxRow() )
{
ScRange aNew( static_cast<SCCOL>(aOneRange.aStart.Col() + nColumnOffset),
static_cast<SCROW>(aOneRange.aStart.Row() + nRowOffset),
diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx
index ca4ac662abff..68d5c962efeb 100644
--- a/sc/source/ui/unoobj/defltuno.cxx
+++ b/sc/source/ui/unoobj/defltuno.cxx
@@ -99,8 +99,8 @@ void ScDocDefaultsObj::ItemsChanged()
if (pDocShell)
{
//! if not in XML import, adjust row heights
-
- pDocShell->PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PaintPartFlags::Grid);
+ const auto & rDoc = pDocShell->GetDocument();
+ pDocShell->PostPaint(ScRange(0, 0, 0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB), PaintPartFlags::Grid);
}
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index eb7f2d7281b2..b30cbd61ddbc 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1337,7 +1337,7 @@ static bool lcl_ParseTarget( const OUString& rTarget, ScRange& rTargetRange, too
bRangeValid = true; // named range or database range
}
else if ( comphelper::string::isdigitAsciiString(rTarget) &&
- ( nNumeric = rTarget.toInt32() ) > 0 && nNumeric <= MAXROW+1 )
+ ( nNumeric = rTarget.toInt32() ) > 0 && nNumeric <= pDoc->MaxRow()+1 )
{
// row number is always mapped to cell A(row) on the same sheet
rTargetRange = ScAddress( 0, static_cast<SCROW>(nNumeric-1), nSourceTab ); // target row number is 1-based
@@ -3883,12 +3883,16 @@ void SAL_CALL ScTableColumnsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 n
{
SolarMutexGuard aGuard;
bool bDone = false;
- if ( pDocShell && nCount > 0 && nPosition >= 0 && nStartCol+nPosition <= nEndCol &&
- nStartCol+nPosition+nCount-1 <= MAXCOL )
+ if ( pDocShell )
{
- ScRange aRange( static_cast<SCCOL>(nStartCol+nPosition), 0, nTab,
- static_cast<SCCOL>(nStartCol+nPosition+nCount-1), MAXROW, nTab );
- bDone = pDocShell->GetDocFunc().InsertCells( aRange, nullptr, INS_INSCOLS_BEFORE, true, true );
+ const ScDocument& rDoc = pDocShell->GetDocument();
+ if ( nCount > 0 && nPosition >= 0 && nStartCol+nPosition <= nEndCol &&
+ nStartCol+nPosition+nCount-1 <= rDoc.MaxCol() )
+ {
+ ScRange aRange( static_cast<SCCOL>(nStartCol+nPosition), 0, nTab,
+ static_cast<SCCOL>(nStartCol+nPosition+nCount-1), rDoc.MaxRow(), nTab );
+ bDone = pDocShell->GetDocFunc().InsertCells( aRange, nullptr, INS_INSCOLS_BEFORE, true, true );
+ }
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
@@ -3899,11 +3903,15 @@ void SAL_CALL ScTableColumnsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCou
SolarMutexGuard aGuard;
bool bDone = false;
// the range to be deleted has to lie within the object
- if ( pDocShell && nCount > 0 && nIndex >= 0 && nStartCol+nIndex+nCount-1 <= nEndCol )
+ if ( pDocShell )
{
- ScRange aRange( static_cast<SCCOL>(nStartCol+nIndex), 0, nTab,
- static_cast<SCCOL>(nStartCol+nIndex+nCount-1), MAXROW, nTab );
- bDone = pDocShell->GetDocFunc().DeleteCells( aRange, nullptr, DelCellCmd::Cols, true );
+ const ScDocument& rDoc = pDocShell->GetDocument();
+ if ( nCount > 0 && nIndex >= 0 && nStartCol+nIndex+nCount-1 <= nEndCol )
+ {
+ ScRange aRange( static_cast<SCCOL>(nStartCol+nIndex), 0, nTab,
+ static_cast<SCCOL>(nStartCol+nIndex+nCount-1), rDoc.MaxRow(), nTab );
+ bDone = pDocShell->GetDocFunc().DeleteCells( aRange, nullptr, DelCellCmd::Cols, true );
+ }
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
@@ -4122,12 +4130,16 @@ void SAL_CALL ScTableRowsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 nCou
{
SolarMutexGuard aGuard;
bool bDone = false;
- if ( pDocShell && nCount > 0 && nPosition >= 0 && nStartRow+nPosition <= nEndRow &&
- nStartRow+nPosition+nCount-1 <= MAXROW )
+ if ( pDocShell )
{
- ScRange aRange( 0, static_cast<SCROW>(nStartRow+nPosition), nTab,
- MAXCOL, static_cast<SCROW>(nStartRow+nPosition+nCount-1), nTab );
- bDone = pDocShell->GetDocFunc().InsertCells( aRange, nullptr, INS_INSROWS_BEFORE, true, true );
+ const ScDocument& rDoc = pDocShell->GetDocument();
+ if ( nCount > 0 && nPosition >= 0 && nStartRow+nPosition <= nEndRow &&
+ nStartRow+nPosition+nCount-1 <= rDoc.MaxRow() )
+ {
+ ScRange aRange( 0, static_cast<SCROW>(nStartRow+nPosition), nTab,
+ rDoc.MaxCol(), static_cast<SCROW>(nStartRow+nPosition+nCount-1), nTab );
+ bDone = pDocShell->GetDocFunc().InsertCells( aRange, nullptr, INS_INSROWS_BEFORE, true, true );
+ }
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
@@ -4140,8 +4152,9 @@ void SAL_CALL ScTableRowsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount
// the range to be deleted has to lie within the object
if ( pDocShell && nCount > 0 && nIndex >= 0 && nStartRow+nIndex+nCount-1 <= nEndRow )
{
+ const ScDocument& rDoc = pDocShell->GetDocument();
ScRange aRange( 0, static_cast<SCROW>(nStartRow+nIndex), nTab,
- MAXCOL, static_cast<SCROW>(nStartRow+nIndex+nCount-1), nTab );
+ rDoc.MaxCol(), static_cast<SCROW>(nStartRow+nIndex+nCount-1), nTab );
bDone = pDocShell->GetDocFunc().DeleteCells( aRange, nullptr, DelCellCmd::Rows, true );
}
if (!bDone)
@@ -4286,7 +4299,7 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
// Use ScCellRangeObj to set the property for all cells in the rows
// (this means, the "row attribute" must be set before individual cell attributes).
- ScRange aRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab );
+ ScRange aRange( 0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab );
uno::Reference<beans::XPropertySet> xRangeObj = new ScCellRangeObj( pDocShell, aRange );
xRangeObj->setPropertyValue( aPropertyName, aValue );
}
@@ -4340,7 +4353,7 @@ uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyNam
// Use ScCellRangeObj to get the property from the cell range
// (for completeness only, this is not used by the XML filter).
- ScRange aRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab );
+ ScRange aRange( 0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab );
uno::Reference<beans::XPropertySet> xRangeObj = new ScCellRangeObj( pDocShell, aRange );
aAny = xRangeObj->getPropertyValue( aPropertyName );
}
@@ -4469,7 +4482,7 @@ sal_Int32 SAL_CALL ScAnnotationsObj::getCount()
if (pDocShell)
{
const ScDocument& rDoc = pDocShell->GetDocument();
- for (SCCOL nCol : rDoc.GetColumnsRange(nTab, 0, MAXCOL))
+ for (SCCOL nCol : rDoc.GetColumnsRange(nTab, 0, rDoc.MaxCol()))
nCount += rDoc.GetNoteCount(nTab, nCol);
}
return nCount;
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index b66c71120355..89680f3e7a28 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -148,13 +148,13 @@ static bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange,
ScClipParam aClipParam(rSrcRange, false);
pSrcDoc->CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark, false, false);
- if ( pClipDoc->HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab,
+ if ( pClipDoc->HasAttrib( 0,0,nSrcTab, pClipDoc->MaxCol(), pClipDoc->MaxRow(),nSrcTab,
HasAttrFlags::Merged | HasAttrFlags::Overlapped ) )
{
ScPatternAttr aPattern( pSrcDoc->GetPool() );
aPattern.GetItemSet().Put( ScMergeAttr() ); // Defaults
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
- pClipDoc->ApplyPatternAreaTab( 0,0, MAXCOL,MAXROW, nSrcTab, aPattern );
+ pClipDoc->ApplyPatternAreaTab( 0,0, pClipDoc->MaxCol(), pClipDoc->MaxRow(), nSrcTab, aPattern );
}
ScMarkData aDestMark;
@@ -411,7 +411,7 @@ public:
nMaxColCount = nColCount;
const seq* pColArr = rRow.getConstArray();
for (long nCol=0; nCol<nColCount; nCol++)
- if ( nCol <= MAXCOL && mrDocRow <= MAXROW )
+ if ( nCol <= mpDoc->MaxCol() && mrDocRow <= mpDoc->MaxRow() )
aVisitor.visitElem( nCol, mrDocRow, pColArr[ nCol ] );
else
mbOverflow=true;
@@ -627,7 +627,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName,
bArgErr = true;
}
- pDoc->DeleteAreaTab( 0, 0, MAXCOL, MAXROW, 0, InsertDeleteFlags::ALL );
+ pDoc->DeleteAreaTab( 0, 0, pDoc->MaxCol(), pDoc->MaxRow(), 0, InsertDeleteFlags::ALL );
pDoc->DeleteAreaTab( 0, 0, 0, 0, nTempSheet, InsertDeleteFlags::ALL );
}
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 42e6a836a1b2..5359cb5eb03b 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -949,7 +949,7 @@ void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData )
rDoc.GetRowNameRangesRef() = xNewList;
rDoc.CompileColRowNameFormula();
- pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid );
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
pDocShell->SetDocumentModified();
//! Undo ?!?! (here and from dialog)
@@ -1065,7 +1065,7 @@ void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelAre
rDoc.GetRowNameRangesRef() = xNewList;
rDoc.CompileColRowNameFormula();
- pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid );
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
pDocShell->SetDocumentModified();
//! Undo ?!?! (here and from dialog)
@@ -1094,7 +1094,7 @@ void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex )
rDoc.GetRowNameRangesRef() = xNewList;
rDoc.CompileColRowNameFormula();
- pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid );
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
pDocShell->SetDocumentModified();
bDone = true;
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index e778247eaa4f..23c7c4b93d27 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -401,8 +401,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
switch (nType)
{
case Type::SHEET:
- // not inserted yet - DocShell=Null
- xRet.set(static_cast<sheet::XSpreadsheet*>(new ScTableSheetObj(nullptr,0)));
+ xRet.set(static_cast<sheet::XSpreadsheet*>(new ScTableSheetObj(pDocShell,0)));
break;
case Type::URLFIELD:
case Type::PAGEFIELD:
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 8f353b361213..65d649913343 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -390,8 +390,8 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
if (aAddress.StartRow != aAddress.EndRow) //should be a Spreadsheet
{
- OSL_ENSURE(aAddress.StartRow == 0 && aAddress.EndRow == MAXROW &&
- aAddress.StartColumn == 0 && aAddress.EndColumn == MAXCOL, "here should be a XSpreadsheet");
+ OSL_ENSURE(aAddress.StartRow == 0 && aAddress.EndRow == pDoc->MaxRow() &&
+ aAddress.StartColumn == 0 && aAddress.EndColumn == pDoc->MaxCol(), "here should be a XSpreadsheet");
ScDrawLayer::SetPageAnchored(*pObj);
}
else
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index a9215095b970..3d61f1a29925 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -729,7 +729,7 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName )
double nPPTY = aLogic.Y() / 1000.0;
Fraction aZoom(1,1);
rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
- pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
pDocShell->SetDocumentModified();
pStylePool->Remove( pStyle );
@@ -1035,7 +1035,7 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle )
if (!rDoc.IsImportingXML())
{
- pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
pDocShell->SetDocumentModified();
}
}
@@ -1391,7 +1391,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault()
if (!rDoc.IsImportingXML())
{
- pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
pDocShell->SetDocumentModified();
}
}
@@ -1738,7 +1738,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx
if (!rDoc.IsImportingXML())
{
- pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
pDocShell->SetDocumentModified();
}
}
More information about the Libreoffice-commits
mailing list