diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-15 13:28:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-16 08:17:34 +0200 |
commit | 1b7bc018c850471a34563348c81877b6cf2d6793 (patch) | |
tree | 6b48bc1ab181c70ba349ad112d5dc3fcc6a13423 /sc/source/ui | |
parent | f5d15f418fa1be0f73fbb4eef1bf7fa06a43c969 (diff) |
convert ScGetDBSelection to scoped enum
and drop unused SC_DBSEL_SHRINK_TO_SHEET_DATA enumerator
Change-Id: I083f65fba450fd0a9abebcaaae3b18c8d0b6c808
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocimp.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh5.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/dbfunc.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/view/dbfunc.cxx | 29 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshc.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun5.cxx | 2 |
9 files changed, 28 insertions, 43 deletions
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index a0690244fc8a..86680d88d94f 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -890,7 +890,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, pNewData = rDocShell.GetDBData( ScRange( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab, aLocalParam.nCol2, aLocalParam.nRow2, nDestTab ), - SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); + SC_DB_MAKE, ScGetDBSelection::ForceMark ); if (pNewData) { diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index f752045b1948..11e7cc0c1e94 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -107,7 +107,7 @@ bool ScDBDocFunc::DoImportUno( const ScAddress& rPos, svx::ODataAccessDescriptor aDesc( aArgs ); // includes selection and result set // create database range - ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); + ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, ScGetDBSelection::Keep ); DBG_ASSERT(pDBData, "can't create DB data"); OUString sTarget = pDBData->GetName(); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 207b37b61941..77eccb6e1c0a 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -208,7 +208,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) GetUndoManager()->EnterListAction( aStrImport, aStrImport, 0, nViewShellId ); } - ScDBData* pDBData = GetDBData( ScRange(aPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); + ScDBData* pDBData = GetDBData( ScRange(aPos), SC_DB_IMPORT, ScGetDBSelection::Keep ); OSL_ENSURE(pDBData, "kann DB-Daten nicht anlegen"); sTarget = pDBData->GetName(); } diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 9322a3859bb1..66d7cc53969c 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -124,9 +124,9 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe if (!pData) pData = pColl->GetDBNearCursor(nCol, nRow, nTab ); - bool bSelected = ( eSel == SC_DBSEL_FORCE_MARK || - (rMarked.aStart != rMarked.aEnd && eSel != SC_DBSEL_ROW_DOWN) ); - bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row()); + bool bSelected = ( eSel == ScGetDBSelection::ForceMark || + (rMarked.aStart != rMarked.aEnd && eSel != ScGetDBSelection::RowDown) ); + bool bOnlyDown = (!bSelected && eSel == ScGetDBSelection::RowDown && rMarked.aStart.Row() == rMarked.aEnd.Row()); bool bUseThis = false; if (pData) diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx index e40758022da4..0a6537425867 100644 --- a/sc/source/ui/inc/dbfunc.hxx +++ b/sc/source/ui/inc/dbfunc.hxx @@ -66,7 +66,7 @@ public: void GotoDBArea( const OUString& rDBName ); // DB range from Cursor - ScDBData* GetDBData( bool bMarkArea = true, ScGetDBMode eMode = SC_DB_MAKE, ScGetDBSelection eSel = SC_DBSEL_KEEP); + ScDBData* GetDBData( bool bMarkArea = true, ScGetDBMode eMode = SC_DB_MAKE, ScGetDBSelection eSel = ScGetDBSelection::Keep); ScDBData* GetAnonymousDBData(); void Consolidate( const ScConsolidateParam& rParam ); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 1f186510b541..0c2556246795 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5448,7 +5448,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createSortDescripto if ( pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, ScGetDBSelection::ForceMark ); if (pData) { pData->GetSortParam(aParam); @@ -5478,7 +5478,7 @@ void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& a { sal_uInt16 i; ScSortParam aParam; - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // ggf. Bereich anlegen if (pData) { // alten Einstellungen holen, falls nicht alles neu gesetzt wird @@ -5515,7 +5515,7 @@ void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& a aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein (void)aFunc.Sort( nTab, aParam, true, true, true ); @@ -5533,7 +5533,7 @@ uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFil if ( !bEmpty && pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, ScGetDBSelection::ForceMark ); if (pData) { ScQueryParam aParam; @@ -5619,7 +5619,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // ggf. Bereich anlegen //! keep source range in filter descriptor //! if created by createFilterDescriptorByObject ??? @@ -5700,7 +5700,7 @@ uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScCellRangeObj::createSubTot if ( !bEmpty && pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, ScGetDBSelection::ForceMark ); if (pData) { ScSubTotalParam aParam; @@ -5763,7 +5763,7 @@ void SAL_CALL ScCellRangeObj::applySubTotals( aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); aFunc.DoSubTotals( nTab, aParam, true, true ); // Bereich muss angelegt sein @@ -5778,7 +5778,7 @@ void SAL_CALL ScCellRangeObj::removeSubTotals() if (pDocSh) { ScSubTotalParam aParam; - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, ScGetDBSelection::ForceMark ); if (pData) pData->GetSubTotalParam(aParam); // auch bei Remove die Feld-Eintraege behalten @@ -5790,7 +5790,7 @@ void SAL_CALL ScCellRangeObj::removeSubTotals() aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); aFunc.DoSubTotals( nTab, aParam, true, true ); // Bereich muss angelegt sein @@ -5805,7 +5805,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createImportDescrip if ( !bEmpty && pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, ScGetDBSelection::ForceMark ); if (pData) pData->GetImportParam(aParam); } @@ -5832,7 +5832,7 @@ void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue //! TODO: could we get passed a valid result set by any means? - pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein aFunc.DoImport( nTab, aParam, nullptr ); //! Api-Flag as parameter diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 35c52e665e42..860268a7a97f 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -85,7 +85,7 @@ ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection e if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED ) { bool bShrinkColumnsOnly = false; - if (eSel == SC_DBSEL_ROW_DOWN) + if (eSel == ScGetDBSelection::RowDown) { // Don't alter row range, additional rows may have been selected on // purpose to append data, or to have a fake header row. @@ -96,7 +96,7 @@ ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection e { // If an area is selected shrink that to the actual used // columns, don't draw filter buttons for empty columns. - eSel = SC_DBSEL_SHRINK_TO_USED_DATA; + eSel = ScGetDBSelection::ShrinkToUsedData; } else if (aRange.aStart.Col() == aRange.aEnd.Col()) { @@ -104,28 +104,13 @@ ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection e // area. const ScMarkData& rMarkData = GetViewData().GetMarkData(); if (!(rMarkData.IsMarked() || rMarkData.IsMultiMarked())) - eSel = SC_DBSEL_KEEP; + eSel = ScGetDBSelection::Keep; } } switch (eSel) { - case SC_DBSEL_SHRINK_TO_SHEET_DATA: - { - // Shrink the selection to sheet data area. - ScDocument& rDoc = pDocSh->GetDocument(); - SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); - SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); - if (rDoc.ShrinkToDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2)) - { - aRange.aStart.SetCol(nCol1); - aRange.aEnd.SetCol(nCol2); - aRange.aStart.SetRow(nRow1); - aRange.aEnd.SetRow(nRow2); - } - } - break; - case SC_DBSEL_SHRINK_TO_USED_DATA: - case SC_DBSEL_ROW_DOWN: + case ScGetDBSelection::ShrinkToUsedData: + case ScGetDBSelection::RowDown: { // Shrink the selection to actual used area. ScDocument& rDoc = pDocSh->GetDocument(); @@ -152,7 +137,7 @@ ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection e pData = pDocSh->GetDBData( ScRange( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ), - eMode, SC_DBSEL_KEEP ); + eMode, ScGetDBSelection::Keep ); if (!pData) return nullptr; @@ -288,7 +273,7 @@ void ScDBFunc::ToggleAutoFilter() ScQueryParam aParam; ScDocument* pDoc = GetViewData().GetDocument(); - ScDBData* pDBData = GetDBData(false, SC_DB_AUTOFILTER, SC_DBSEL_ROW_DOWN); + ScDBData* pDBData = GetDBData(false, SC_DB_AUTOFILTER, ScGetDBSelection::RowDown); pDBData->SetByRow( true ); //! undo, retrieve beforehand ?? pDBData->GetQueryParam( aParam ); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 0c478f45ebaa..b3f4c1a078e9 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -254,7 +254,7 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog( SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); + ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, ScGetDBSelection::RowDown); pDBData->ExtendDataArea(pDoc); pDBData->GetQueryParam( aQueryParam ); @@ -284,7 +284,7 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog( SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); + ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, ScGetDBSelection::RowDown); pDBData->ExtendDataArea(pDoc); pDBData->GetQueryParam( aQueryParam ); diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index ac66ce82421e..6034d8990fc8 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -390,7 +390,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, // Creation of database area "Import1" isn't here, but in the DocShell // slot execute, so it can be added to the undo action - ScDBData* pDBData = pDocSh->GetDBData( ScRange(nPosX,nPosY,nTab), SC_DB_OLD, SC_DBSEL_KEEP ); + ScDBData* pDBData = pDocSh->GetDBData( ScRange(nPosX,nPosY,nTab), SC_DB_OLD, ScGetDBSelection::Keep ); OUString sTarget; if (pDBData) sTarget = pDBData->GetName(); |