[Libreoffice-commits] core.git: sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Thu Feb 2 05:03:18 UTC 2017


 sc/inc/document.hxx                |    3 +--
 sc/source/core/data/documen3.cxx   |   14 +++++++++-----
 sc/source/filter/excel/excimp8.cxx |    4 +---
 sc/source/ui/dbgui/sfiltdlg.cxx    |    8 +-------
 sc/source/ui/unoobj/cellsuno.cxx   |    6 +-----
 sc/source/ui/view/dbfunc3.cxx      |    5 +----
 6 files changed, 14 insertions(+), 26 deletions(-)

New commits:
commit 871614789ca7af6ebe51a3e7615551176642891a
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Jan 31 22:19:43 2017 -0500

    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 at libreoffice.org>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 3f494b7..ee50a0a 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 3e2d1ac..bbece70 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 020962d..d7f1ab7 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 4f5eca4..d3622bc 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 6e325a5..ae624ce 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 7298585..1a35636 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


More information about the Libreoffice-commits mailing list