From 26e84b3852bbb9585fab76e8d3dba5dcd77f0357 Mon Sep 17 00:00:00 2001
From: Eike Rathke <erack@redhat.com>
Date: Wed, 2 Sep 2015 15:58:07 +0200
Subject: TableRef: introduce ScDBDataPortion enum

... to replace
* bool bStartonly=false with ScDBDataPortion::AREA
* bool bStartonly=true  with ScDBDataPortion::TOP_LEFT

and provide means to look at header row only with
ScDBDataPortion::HEADER as needed for TableRef.

Change-Id: I9f6affd04c15a6204193687b2379160eb975f56e
---
 sc/source/ui/dbgui/dbnamdlg.cxx    | 2 +-
 sc/source/ui/docshell/dbdocfun.cxx | 6 +++---
 sc/source/ui/docshell/docsh5.cxx   | 2 +-
 sc/source/ui/undo/undodat.cxx      | 2 +-
 sc/source/ui/view/cellsh2.cxx      | 2 +-
 sc/source/ui/view/dbfunc.cxx       | 2 +-
 sc/source/ui/view/dbfunc3.cxx      | 4 ++--
 sc/source/ui/view/gridwin.cxx      | 6 +++---
 sc/source/ui/view/gridwin4.cxx     | 4 ++--
 9 files changed, 15 insertions(+), 15 deletions(-)

(limited to 'sc/source/ui')

diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 4ebe1d0e89e7..f35e7649b518 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -230,7 +230,7 @@ void ScDbNameDlg::Init()
         if ( pDBColl )
         {
             // Feststellen, ob definierter DB-Bereich markiert wurde:
-            pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, true );
+            pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, ScDBDataPortion::TOP_LEFT );
             if ( pDBData )
             {
                 ScAddress&  rStart = theCurArea.aStart;
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index e7bf8faecbe2..5d308af5f19a 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -323,7 +323,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
             if (bQuery && !aQueryParam.bInplace)
             {
                 ScDBData* pDest = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
-                                                        aQueryParam.nDestTab, true );
+                                                        aQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
                 if (pDest && pDest->IsDoSize())
                 {
                     pDest->GetArea( aOldQuery );
@@ -432,7 +432,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
                 if (bQuerySize)
                 {
                     ScDBData* pDest = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
-                                                            aQueryParam.nDestTab, true );
+                                                            aQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
                     if (pDest)
                     {
                         pDest->GetArea( aNewQuery );
@@ -678,7 +678,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
         }
 
         pDestData = rDoc.GetDBAtCursor( rQueryParam.nDestCol, rQueryParam.nDestRow,
-                                            rQueryParam.nDestTab, true );
+                                            rQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
         if (pDestData)
         {
             pDestData->GetArea( aOldDest );
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index c66fc6578ac0..cbef1979ee13 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -523,7 +523,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
     ScDocShellModificator aModificator( *this );
 
     ScRange aOldDest;
-    ScDBData* pDestData = aDocument.GetDBAtCursor( rParam.nCol, rParam.nRow, rParam.nTab, true );
+    ScDBData* pDestData = aDocument.GetDBAtCursor( rParam.nCol, rParam.nRow, rParam.nTab, ScDBDataPortion::TOP_LEFT );
     if (pDestData)
         pDestData->GetArea(aOldDest);
 
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index f636c596f9ba..849e9f764ab3 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -792,7 +792,7 @@ void ScUndoQuery::Undo()
         nDestEndRow = aQueryParam.nDestRow + ( aQueryParam.nRow2-aQueryParam.nRow1 );
 
         ScDBData* pData = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
-                                                aQueryParam.nDestTab, true );
+                                                aQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
         if (pData)
         {
             ScRange aNewDest;
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index e106cb3cd823..28dd99d6eda6 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -1159,7 +1159,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet )
 
                     ScDBData* pDBData = bSelected
                                 ? rDoc.GetDBAtArea( nStartTab, nStartCol, nStartRow, nEndCol, nEndRow )
-                                : rDoc.GetDBAtCursor( nStartCol, nStartRow, nStartTab );
+                                : rDoc.GetDBAtCursor( nStartCol, nStartRow, nStartTab, ScDBDataPortion::AREA );
 
                     if ( pDBData )
                     {
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index da44ac4a43b9..f9c3c4b7f099 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -259,7 +259,7 @@ void ScDBFunc::Query( const ScQueryParam& rQueryParam, const ScRange* pAdvSource
             ScDocument& rDoc = pDocSh->GetDocument();
             ScDBData* pDestData = rDoc.GetDBAtCursor(
                                             rQueryParam.nDestCol, rQueryParam.nDestRow,
-                                            rQueryParam.nDestTab, true );
+                                            rQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
             if (pDestData)
             {
                 ScRange aDestRange;
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 26466f66c094..367b5caf668b 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -2088,7 +2088,7 @@ void ScDBFunc::RepeatDB( bool bRecord )
         if (bQuery && !aQueryParam.bInplace)
         {
             ScDBData* pDest = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
-                                                    aQueryParam.nDestTab, true );
+                                                    aQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
             if (pDest && pDest->IsDoSize())
             {
                 pDest->GetArea( aOldQuery );
@@ -2199,7 +2199,7 @@ void ScDBFunc::RepeatDB( bool bRecord )
             if (bQuerySize)
             {
                 ScDBData* pDest = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
-                                                        aQueryParam.nDestTab, true );
+                                                        aQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
                 if (pDest)
                 {
                     pDest->GetArea( aNewQuery );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 00ad26ed51f0..995b174e5ea1 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -717,7 +717,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
     pViewData->GetMergeSizePixel(nCol, nRow, nSizeX, nSizeY);
     Rectangle aCellRect(OutputToScreenPixel(aPos), Size(nSizeX, nSizeY));
 
-    ScDBData* pDBData = pDoc->GetDBAtCursor(nCol, nRow, nTab);
+    ScDBData* pDBData = pDoc->GetDBAtCursor(nCol, nRow, nTab, ScDBDataPortion::AREA);
     if (!pDBData)
         return;
 
@@ -1242,7 +1242,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
 
     if (!bDataSelect)                       // AutoFilter: Select active entry
     {
-        ScDBData* pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab );
+        ScDBData* pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
         if (pDBData)
         {
             ScQueryParam aParam;
@@ -1412,7 +1412,7 @@ void ScGridWindow::ExecFilter( sal_uLong nSel,
     ScDocument* pDoc = pViewData->GetDocument();
     svl::SharedStringPool& rPool = pDoc->GetSharedStringPool();
 
-    ScDBData* pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab );
+    ScDBData* pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
     if (pDBData)
     {
         ScQueryParam aParam;
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 3cb269d1d4a8..f82668a4058d 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1364,7 +1364,7 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
                     }
                     if (bNewData)
                     {
-                        pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab );
+                        pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
                         if (pDBData)
                             pDBData->GetQueryParam( *pQueryParam );
                         else
@@ -1514,7 +1514,7 @@ Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos )
 bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab )
 {
     ScDocument*     pDoc    = pViewData->GetDocument();
-    ScDBData*       pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab );
+    ScDBData*       pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
     ScQueryParam    aQueryParam;
 
     if ( pDBData )
-- 
cgit