summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-22 09:28:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-22 18:13:07 +0200
commit25732d7f211ce51fcecbb15ce6d9c551c2715b6e (patch)
tree8ea2f3b54bbcd459c61ec552cc92a88e384e01e8
parent173b7fcaae86980809889db30ddb82f8ba883103 (diff)
sc: rowcol: tdf#50916 convert output
Change-Id: I6fbcf26dbf6a5dfa506d5c69b123dbb297855ef3 Reviewed-on: https://gerrit.libreoffice.org/81304 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/ui/view/hdrcont.cxx23
-rw-r--r--sc/source/ui/view/output.cxx22
-rw-r--r--sc/source/ui/view/output2.cxx14
3 files changed, 32 insertions, 27 deletions
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 7fd1a8dd8f26..601f982efd75 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -425,7 +425,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools
aScrPos = Point( nScrPos, 0 );
SCCOLROW nEntryNo = nCount + nPos;
- if ( nEntryNo >= nSize ) // MAXCOL/MAXROW
+ if ( nEntryNo >= nSize ) // rDoc.MaxCol()/rDoc.MaxRow()
nScrPos = nPEnd + nLayoutSign; // beyond nPEnd -> stop
else
{
@@ -579,13 +579,13 @@ bool ScHeaderControl::IsSelectionAllowed(SCCOLROW nPos) const
{
// row header
SCROW nRPos = static_cast<SCROW>(nPos);
- bCellsProtected = pDoc->HasAttrib(0, nRPos, nTab, MAXCOL, nRPos, nTab, HasAttrFlags::Protected);
+ bCellsProtected = pDoc->HasAttrib(0, nRPos, nTab, pDoc->MaxCol(), nRPos, nTab, HasAttrFlags::Protected);
}
else
{
// column header
SCCOL nCPos = static_cast<SCCOL>(nPos);
- bCellsProtected = pDoc->HasAttrib(nCPos, 0, nTab, nCPos, MAXROW, nTab, HasAttrFlags::Protected);
+ bCellsProtected = pDoc->HasAttrib(nCPos, 0, nTab, nCPos, pDoc->MaxRow(), nTab, HasAttrFlags::Protected);
}
bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
@@ -620,15 +620,17 @@ void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
SCTAB nTab = pTabView->GetViewData().GetTabNo();
if( !rMEvt.IsShift() )
pTabView->DoneRefMode( rMEvt.IsMod1() );
+ ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
if( !bVertical )
{
pTabView->InitRefMode( nHitNo, 0, nTab, SC_REFTYPE_REF );
- pTabView->UpdateRef( nHitNo, MAXROW, nTab );
+ pTabView->UpdateRef( nHitNo, pDoc->MaxRow(), nTab );
}
else
{
pTabView->InitRefMode( 0, nHitNo, nTab, SC_REFTYPE_REF );
- pTabView->UpdateRef( MAXCOL, nHitNo, nTab );
+ pTabView->UpdateRef( pDoc->MaxCol(), nHitNo, nTab );
}
bInRefMode = true;
return;
@@ -763,10 +765,12 @@ void ScHeaderControl::MouseMove( const MouseEvent& rMEvt )
bool bTmp;
SCCOLROW nHitNo = GetMousePos( rMEvt, bTmp );
SCTAB nTab = pTabView->GetViewData().GetTabNo();
+ ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
if( !bVertical )
- pTabView->UpdateRef( nHitNo, MAXROW, nTab );
+ pTabView->UpdateRef( nHitNo, pDoc->MaxRow(), nTab );
else
- pTabView->UpdateRef( MAXCOL, nHitNo, nTab );
+ pTabView->UpdateRef( pDoc->MaxCol(), nHitNo, nTab );
return;
}
@@ -842,13 +846,14 @@ void ScHeaderControl::Command( const CommandEvent& rCEvt )
return;
SCTAB nTab = rViewData.GetTabNo();
+ ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
ScRange aNewRange;
if ( bVertical )
aNewRange = ScRange( 0, sal::static_int_cast<SCROW>(nPos), nTab,
- MAXCOL, sal::static_int_cast<SCROW>(nPos), nTab );
+ pDoc->MaxCol(), sal::static_int_cast<SCROW>(nPos), nTab );
else
aNewRange = ScRange( sal::static_int_cast<SCCOL>(nPos), 0, nTab,
- sal::static_int_cast<SCCOL>(nPos), MAXROW, nTab );
+ sal::static_int_cast<SCCOL>(nPos), pDoc->MaxRow(), nTab );
// see if any part of the range is already selected
ScRangeList aRanges;
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 2903ad0d172e..53c510eaa707 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -371,7 +371,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
{
// Search also in hidden part for page breaks
SCCOL nCol = nXplus1;
- while (nCol <= MAXCOL)
+ while (nCol <= mpDoc->MaxCol())
{
nBreak = mpDoc->HasColBreak(nCol, nTab);
bool bHidden = mpDoc->ColHidden(nCol, nTab);
@@ -405,7 +405,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
sal_uInt16 nWidthXplus2 = pRowInfo[0].pCellInfo[nXplus2].nWidth;
bSingle = false; //! get into Fillinfo !!!!!
- if ( nX<MAXCOL && !bSingle )
+ if ( nX<mpDoc->MaxCol() && !bSingle )
{
bSingle = ( nWidthXplus2 == 0 );
for (nArrY=1; nArrY+1<nArrCount && !bSingle; nArrY++)
@@ -419,10 +419,10 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
if (bDraw)
{
- if ( nX<MAXCOL && bSingle )
+ if ( nX<mpDoc->MaxCol() && bSingle )
{
SCCOL nVisX = nXplus1;
- while ( nVisX < MAXCOL && !mpDoc->GetColWidth(nVisX,nTab) )
+ while ( nVisX < mpDoc->MaxCol() && !mpDoc->GetColWidth(nVisX,nTab) )
++nVisX;
nPosY = nScrY;
@@ -482,7 +482,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
{
if ( bPage )
{
- for (SCROW i = nYplus1; i <= MAXROW; ++i)
+ for (SCROW i = nYplus1; i <= mpDoc->MaxRow(); ++i)
{
if (i > nHiddenEndRow)
bHiddenRow = mpDoc->RowHidden(i, nTab, nullptr, &nHiddenEndRow);
@@ -530,7 +530,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
if (bDraw)
{
- if ( bSingle && nY<MAXROW )
+ if ( bSingle && nY<mpDoc->MaxRow() )
{
SCROW nVisY = pRowInfo[nArrYplus1].nRowNo;
@@ -723,7 +723,7 @@ static const SvxBrushItem* lcl_FindBackground( const ScDocument* pDoc, SCCOL nCo
else if ( nDir == ScRotateDir::Left )
{
// text goes to the left -> take background from the right
- while ( nCol < MAXCOL && lcl_GetRotateDir( pDoc, nCol, nRow, nTab ) == nDir &&
+ while ( nCol < pDoc->MaxCol() && lcl_GetRotateDir( pDoc, nCol, nRow, nTab ) == nDir &&
pBackground->GetColor().GetTransparency() != 255 )
{
++nCol;
@@ -1794,8 +1794,8 @@ void ScOutputData::FindChanged()
for (nArrY=0; nArrY<nArrCount; nArrY++)
pRowInfo[nArrY].bChanged = false;
- SCCOL nCol1 = MAXCOL, nCol2 = 0;
- SCROW nRow1 = MAXROW, nRow2 = 0;
+ SCCOL nCol1 = mpDoc->MaxCol(), nCol2 = 0;
+ SCROW nRow1 = mpDoc->MaxRow(), nRow2 = 0;
bool bAnyDirty = false;
bool bAnyChanged = false;
@@ -2235,8 +2235,8 @@ void ScOutputData::DrawChangeTrack()
SCCOL nEndX = nX2;
SCROW nEndY = nY2;
- if ( nEndX < MAXCOL ) ++nEndX; // also from the next cell since the mark
- if ( nEndY < MAXROW ) ++nEndY; // protrudes from the preceding cell
+ if ( nEndX < mpDoc->MaxCol() ) ++nEndX; // also from the next cell since the mark
+ if ( nEndY < mpDoc->MaxRow() ) ++nEndY; // protrudes from the preceding cell
ScRange aViewRange( nX1, nY1, nTab, nEndX, nEndY, nTab );
const ScChangeAction* pAction = pTrack->GetFirst();
while (pAction)
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 34c920993a6b..6fbb00412663 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1288,7 +1288,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
{
// look for empty cells into which the text can be extended
- while ( nRightMissing > 0 && nRightX < MAXCOL && ( bOverwrite || IsAvailable( nRightX+1, nCellY ) ) )
+ while ( nRightMissing > 0 && nRightX < mpDoc->MaxCol() && ( bOverwrite || IsAvailable( nRightX+1, nCellY ) ) )
{
++nRightX;
long nAdd = static_cast<long>( mpDoc->GetColWidth( nRightX, nTab ) * mnPPTX );
@@ -1465,10 +1465,10 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co
nInitPosX += nMirrorW - 1; // pixels
long nLayoutSign = bLayoutRTL ? -1 : 1;
- SCCOL nLastContentCol = MAXCOL;
- if ( nX2 < MAXCOL )
+ SCCOL nLastContentCol = mpDoc->MaxCol();
+ if ( nX2 < mpDoc->MaxCol() )
nLastContentCol = sal::static_int_cast<SCCOL>(
- nLastContentCol - mpDoc->GetEmptyLinesInBlock( nX2+1, nY1, nTab, MAXCOL, nY2, nTab, DIR_RIGHT ) );
+ nLastContentCol - mpDoc->GetEmptyLinesInBlock( nX2+1, nY1, nTab, mpDoc->MaxCol(), nY2, nTab, DIR_RIGHT ) );
SCCOL nLoopStartX = nX1;
if ( nX1 > 0 )
--nLoopStartX; // start before nX1 for rest of long text to the left
@@ -4259,10 +4259,10 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
long nLayoutSign = bLayoutRTL ? -1 : 1;
//! store nLastContentCol as member!
- SCCOL nLastContentCol = MAXCOL;
- if ( nX2 < MAXCOL )
+ SCCOL nLastContentCol = mpDoc->MaxCol();
+ if ( nX2 < mpDoc->MaxCol() )
nLastContentCol = sal::static_int_cast<SCCOL>(
- nLastContentCol - mpDoc->GetEmptyLinesInBlock( nX2+1, nY1, nTab, MAXCOL, nY2, nTab, DIR_RIGHT ) );
+ nLastContentCol - mpDoc->GetEmptyLinesInBlock( nX2+1, nY1, nTab, mpDoc->MaxCol(), nY2, nTab, DIR_RIGHT ) );
long nRowPosY = nScrY;
for (SCSIZE nArrY=0; nArrY+1<nArrCount; nArrY++) // 0 of the rest of the merged