diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-15 13:43:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-16 08:17:34 +0200 |
commit | 9aed81ca1ed542552f82eab041208bef78abd6c8 (patch) | |
tree | cd25097e585341cb9668fed93a76beeaf84d4833 /sc | |
parent | ce7cdf53ae1310622bd10e60f493ba7bfab2d8e2 (diff) |
convert ScDetectiveDelete to scoped enum
and drop unused SC_DET_ALL enumerator
Change-Id: I67b729cfcf71c0e7bc406b205b56d74923617098
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/detfunc.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/detfunc.cxx | 25 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 4 |
3 files changed, 14 insertions, 17 deletions
diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx index 553a611fe3c4..47e8a4f2ac1f 100644 --- a/sc/inc/detfunc.hxx +++ b/sc/inc/detfunc.hxx @@ -37,7 +37,7 @@ class ScRange; #define SC_DET_MAXCIRCLE 1000 -enum ScDetectiveDelete { SC_DET_ALL, SC_DET_DETECTIVE, SC_DET_CIRCLES, SC_DET_ARROWS }; +enum class ScDetectiveDelete { Detective, Circles, Arrows }; enum ScDetectiveObjType { diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index a80aaf34625e..0186c0ce5586 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1243,20 +1243,17 @@ bool ScDetectiveFunc::DeleteAll( ScDetectiveDelete eWhat ) if ( pObject->GetLayer() == SC_LAYER_INTERN ) { bool bDoThis = true; - if ( eWhat != SC_DET_ALL ) + bool bCircle = ( dynamic_cast<const SdrCircObj*>( pObject) != nullptr ); + bool bCaption = ScDrawLayer::IsNoteCaption( pObject ); + if ( eWhat == ScDetectiveDelete::Detective ) // detective, from menu + bDoThis = !bCaption; // also circles + else if ( eWhat == ScDetectiveDelete::Circles ) // circles, if new created + bDoThis = bCircle; + else if ( eWhat == ScDetectiveDelete::Arrows ) // DetectiveRefresh + bDoThis = !bCaption && !bCircle; // don't include circles + else { - bool bCircle = ( dynamic_cast<const SdrCircObj*>( pObject) != nullptr ); - bool bCaption = ScDrawLayer::IsNoteCaption( pObject ); - if ( eWhat == SC_DET_DETECTIVE ) // detektive, from menue - bDoThis = !bCaption; // also circles - else if ( eWhat == SC_DET_CIRCLES ) // circles, if new created - bDoThis = bCircle; - else if ( eWhat == SC_DET_ARROWS ) // DetectiveRefresh - bDoThis = !bCaption && !bCircle; // don't include circles - else - { - OSL_FAIL("what?"); - } + OSL_FAIL("what?"); } if ( bDoThis ) ppObj[nDelCount++] = pObject; @@ -1286,7 +1283,7 @@ bool ScDetectiveFunc::MarkInvalid(bool& rOverflow) if (!pModel) return false; - bool bDeleted = DeleteAll( SC_DET_CIRCLES ); // just circles + bool bDeleted = DeleteAll( ScDetectiveDelete::Circles ); // just circles ScDetectiveData aData( pModel ); long nInsCount = 0; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 6c5dbe721ad2..37111fa51c51 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -416,7 +416,7 @@ bool ScDocFunc::DetectiveDelAll(SCTAB nTab) if (bUndo) pModel->BeginCalcUndo(false); - bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeleteAll( SC_DET_DETECTIVE ); + bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeleteAll( ScDetectiveDelete::Detective ); SdrUndoGroup* pUndo = nullptr; if (bUndo) pUndo = pModel->GetCalcUndo(); @@ -463,7 +463,7 @@ bool ScDocFunc::DetectiveRefresh( bool bAutomatic ) SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTab<nTabCount; nTab++) - ScDetectiveFunc( &rDoc,nTab ).DeleteAll( SC_DET_ARROWS ); // don't remove circles + ScDetectiveFunc( &rDoc,nTab ).DeleteAll( ScDetectiveDelete::Arrows ); // don't remove circles // repeat |