summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-15 13:40:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-16 08:17:34 +0200
commitce7cdf53ae1310622bd10e60f493ba7bfab2d8e2 (patch)
tree0c391f86f84a11dc8d9ea2fdc585868e491aefef /sc
parent2a9b0e435147929b4cd55ed9adf4d879e8b8a484 (diff)
convert DrawPosMode to scoped enum
and drop unused enumerators Change-Id: If61605d1b234664ba9264997cc3c4ec40608cc99
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/detfunc.hxx10
-rw-r--r--sc/source/core/tool/detfunc.cxx30
2 files changed, 12 insertions, 28 deletions
diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx
index 14fb1b19f779..553a611fe3c4 100644
--- a/sc/inc/detfunc.hxx
+++ b/sc/inc/detfunc.hxx
@@ -58,13 +58,11 @@ class SC_DLLPUBLIC ScDetectiveFunc
ScDocument* pDoc;
SCTAB nTab;
- enum DrawPosMode
+ enum class DrawPosMode
{
- DRAWPOS_TOPLEFT, ///< Top-left edge of the cell.
- DRAWPOS_BOTTOMRIGHT, ///< Bottom-right edge of the cell.
- DRAWPOS_DETARROW, ///< Position inside cell for detective arrows.
- DRAWPOS_CAPTIONLEFT, ///< Top-left edge of the cell for captions.
- DRAWPOS_CAPTIONRIGHT ///< Top-right edge of the cell for captions (incl. merged cells).
+ TopLeft, ///< Top-left edge of the cell.
+ BottomRight, ///< Bottom-right edge of the cell.
+ DetectiveArrow, ///< Position inside cell for detective arrows.
};
/** @return a drawing layer position for the passed cell address. */
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index bec278847141..a80aaf34625e 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -312,30 +312,16 @@ Point ScDetectiveFunc::GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) c
switch( eMode )
{
- case DRAWPOS_TOPLEFT:
+ case DrawPosMode::TopLeft:
break;
- case DRAWPOS_BOTTOMRIGHT:
+ case DrawPosMode::BottomRight:
++nCol;
++nRow;
break;
- case DRAWPOS_DETARROW:
+ case DrawPosMode::DetectiveArrow:
aPos.X() += pDoc->GetColWidth( nCol, nTab ) / 4;
aPos.Y() += pDoc->GetRowHeight( nRow, nTab ) / 2;
break;
- case DRAWPOS_CAPTIONLEFT:
- aPos.X() += 6;
- break;
- case DRAWPOS_CAPTIONRIGHT:
- {
- // find right end of passed cell position
- const ScMergeAttr* pMerge = static_cast< const ScMergeAttr* >( pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE ) );
- if ( pMerge->GetColMerge() > 1 )
- nCol = nCol + pMerge->GetColMerge();
- else
- ++nCol;
- aPos.X() -= 6;
- }
- break;
}
for ( SCCOL i = 0; i < nCol; ++i )
@@ -354,8 +340,8 @@ Point ScDetectiveFunc::GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) c
Rectangle ScDetectiveFunc::GetDrawRect( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const
{
Rectangle aRect(
- GetDrawPos( ::std::min( nCol1, nCol2 ), ::std::min( nRow1, nRow2 ), DRAWPOS_TOPLEFT ),
- GetDrawPos( ::std::max( nCol1, nCol2 ), ::std::max( nRow1, nRow2 ), DRAWPOS_BOTTOMRIGHT ) );
+ GetDrawPos( ::std::min( nCol1, nCol2 ), ::std::min( nRow1, nRow2 ), DrawPosMode::TopLeft ),
+ GetDrawPos( ::std::max( nCol1, nCol2 ), ::std::max( nRow1, nRow2 ), DrawPosMode::BottomRight ) );
aRect.Justify(); // reorder left/right in RTL sheets
return aRect;
}
@@ -483,8 +469,8 @@ bool ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
pData->maEnd.Set( nRefEndCol, nRefEndRow, nTab);
}
- Point aStartPos = GetDrawPos( nRefStartCol, nRefStartRow, DRAWPOS_DETARROW );
- Point aEndPos = GetDrawPos( nCol, nRow, DRAWPOS_DETARROW );
+ Point aStartPos = GetDrawPos( nRefStartCol, nRefStartRow, DrawPosMode::DetectiveArrow );
+ Point aEndPos = GetDrawPos( nCol, nRow, DrawPosMode::DetectiveArrow );
if (bFromOtherTab)
{
@@ -559,7 +545,7 @@ bool ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
bool bNegativePage = pDoc->IsNegativePage( nTab );
long nPageSign = bNegativePage ? -1 : 1;
- Point aStartPos = GetDrawPos( nStartCol, nStartRow, DRAWPOS_DETARROW );
+ Point aStartPos = GetDrawPos( nStartCol, nStartRow, DrawPosMode::DetectiveArrow );
Point aEndPos = Point( aStartPos.X() + 1000 * nPageSign, aStartPos.Y() - 1000 );
if (aEndPos.Y() < 0)
aEndPos.Y() += 2000;