diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2017-01-31 22:19:43 -0500 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2017-02-02 05:02:34 +0000 |
commit | 871614789ca7af6ebe51a3e7615551176642891a (patch) | |
tree | 5c35e7a00231a8c06c8507993c3546acfd840a61 | |
parent | 42e472b5870278058537d43d03d457dc80b16166 (diff) |
CreateQueryParam to take a ScRange parameter.
This simplifies its usage a bit.
Change-Id: Idd5b24897f65c7cf8b7ff88806dd058c35c95ffe
Reviewed-on: https://gerrit.libreoffice.org/33817
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
-rw-r--r-- | sc/inc/document.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 14 | ||||
-rw-r--r-- | sc/source/filter/excel/excimp8.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/dbgui/sfiltdlg.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/dbfunc3.cxx | 5 |
6 files changed, 14 insertions, 26 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 3f494b7dca6f..ee50a0a346f5 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1872,8 +1872,7 @@ public: void Reorder( const sc::ReorderParam& rParam ); SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, bool bKeepSub ); - SC_DLLPUBLIC bool CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - SCTAB nTab, ScQueryParam& rQueryParam ); + SC_DLLPUBLIC bool CreateQueryParam( const ScRange& rRange, ScQueryParam& rQueryParam ); void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rStr); /** diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 3e2d1acc94b1..bbece70341f4 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1424,13 +1424,17 @@ void ScDocument::GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, OUString rStr.clear(); } -bool ScDocument::CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, ScQueryParam& rQueryParam) +bool ScDocument::CreateQueryParam( const ScRange& rRange, ScQueryParam& rQueryParam ) { - if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) - return maTabs[nTab]->CreateQueryParam(nCol1, nRow1, nCol2, nRow2, rQueryParam); + ScTable* pTab = FetchTable(rRange.aStart.Tab()); + if (!pTab) + { + OSL_FAIL("missing tab"); + return false; + } - OSL_FAIL("missing tab"); - return false; + return pTab->CreateQueryParam( + rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row(), rQueryParam); } bool ScDocument::HasAutoFilter( SCCOL nCurCol, SCROW nCurRow, SCTAB nCurTab ) diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 020962ddc2a0..d7f1ab76243e 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -546,9 +546,7 @@ void XclImpAutoFilterData::InsertQueryParam() ScRange aAdvRange; bool bHasAdv = pCurrDBData->GetAdvancedQuerySource( aAdvRange ); if( bHasAdv ) - pExcRoot->pIR->GetDoc().CreateQueryParam( aAdvRange.aStart.Col(), - aAdvRange.aStart.Row(), aAdvRange.aEnd.Col(), aAdvRange.aEnd.Row(), - aAdvRange.aStart.Tab(), aParam ); + pExcRoot->pIR->GetDoc().CreateQueryParam(aAdvRange, aParam); pCurrDBData->SetQueryParam( aParam ); if( bHasAdv ) diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index 4f5eca4ba884..d3622bc8fd62 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -365,13 +365,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void ) theOutParam.bDuplicate = !pBtnUnique->IsChecked(); theOutParam.bDestPers = pBtnDestPers->IsChecked(); - bQueryOk = - pDoc->CreateQueryParam( rStart.Col(), - rStart.Row(), - rEnd.Col(), - rEnd.Row(), - rStart.Tab(), - theOutParam ); + bQueryOk = pDoc->CreateQueryParam(ScRange(rStart,rEnd), theOutParam); } } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 6e325a550e56..ae624ce46827 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5660,11 +5660,7 @@ uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFil aParam.nTab = aDataAddress.Sheet; ScDocument& rDoc = pDocSh->GetDocument(); - bool bOk = rDoc.CreateQueryParam( - aRange.aStart.Col(), aRange.aStart.Row(), - aRange.aEnd.Col(), aRange.aEnd.Row(), - aRange.aStart.Tab(), aParam ); - if ( bOk ) + if (rDoc.CreateQueryParam(aRange, aParam)) { // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt SCCOLROW nFieldStart = aParam.bByRow ? diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 72985854facb..1a3563674e62 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -2166,10 +2166,7 @@ void ScDBFunc::RepeatDB( bool bRecord ) ScRange aAdvSource; if (pDBData->GetAdvancedQuerySource(aAdvSource)) { - pDoc->CreateQueryParam( - aAdvSource.aStart.Col(), aAdvSource.aStart.Row(), - aAdvSource.aEnd.Col(), aAdvSource.aEnd.Row(), - aAdvSource.aStart.Tab(), aQueryParam ); + pDoc->CreateQueryParam(aAdvSource, aQueryParam); Query( aQueryParam, &aAdvSource, false ); } else |