summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen3.cxx12
-rw-r--r--sc/source/core/tool/compiler.cxx2
-rw-r--r--sc/source/core/tool/dbdata.cxx45
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx2
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx6
-rw-r--r--sc/source/ui/docshell/docsh5.cxx2
-rw-r--r--sc/source/ui/undo/undodat.cxx2
-rw-r--r--sc/source/ui/view/cellsh2.cxx2
-rw-r--r--sc/source/ui/view/dbfunc.cxx2
-rw-r--r--sc/source/ui/view/dbfunc3.cxx4
-rw-r--r--sc/source/ui/view/gridwin.cxx6
-rw-r--r--sc/source/ui/view/gridwin4.cxx4
12 files changed, 47 insertions, 42 deletions
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 2b8dc9afa57c..32791dab34d1 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -281,18 +281,18 @@ void ScDocument::SetDBCollection( ScDBCollection* pNewDBCollection, bool bRemove
pDBCollection = pNewDBCollection;
}
-const ScDBData* ScDocument::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const
+const ScDBData* ScDocument::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
{
if (pDBCollection)
- return pDBCollection->GetDBAtCursor(nCol, nRow, nTab, bStartOnly);
+ return pDBCollection->GetDBAtCursor(nCol, nRow, nTab, ePortion);
else
return NULL;
}
-ScDBData* ScDocument::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly)
+ScDBData* ScDocument::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion)
{
if (pDBCollection)
- return pDBCollection->GetDBAtCursor(nCol, nRow, nTab, bStartOnly);
+ return pDBCollection->GetDBAtCursor(nCol, nRow, nTab, ePortion);
else
return NULL;
}
@@ -1413,7 +1413,7 @@ bool ScDocument::CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
bool ScDocument::HasAutoFilter( SCCOL nCurCol, SCROW nCurRow, SCTAB nCurTab )
{
- const ScDBData* pDBData = GetDBAtCursor( nCurCol, nCurRow, nCurTab );
+ const ScDBData* pDBData = GetDBAtCursor( nCurCol, nCurRow, nCurTab, ScDBDataPortion::AREA );
bool bHasAutoFilter = (pDBData != NULL);
if ( pDBData )
@@ -1465,7 +1465,7 @@ bool ScDocument::GetFilterEntries(
{
if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] && pDBCollection )
{
- ScDBData* pDBData = pDBCollection->GetDBAtCursor(nCol, nRow, nTab, false); //!??
+ ScDBData* pDBData = pDBCollection->GetDBAtCursor(nCol, nRow, nTab, ScDBDataPortion::AREA); //!??
if (pDBData)
{
pDBData->ExtendDataArea(this);
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index a166a41a5807..67cf1d7c11e2 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4705,7 +4705,7 @@ void ScCompiler::CreateStringFromSingleRef( OUStringBuffer& rBuffer, const Formu
if (aStr.isEmpty())
{
// Hope that there's still the original column name available.
- const ScDBData* pData = pDoc->GetDBAtCursor( aAbs.Col(), aAbs.Row(), aAbs.Tab());
+ const ScDBData* pData = pDoc->GetDBAtCursor( aAbs.Col(), aAbs.Row(), aAbs.Tab(), ScDBDataPortion::HEADER);
if (pData)
aStr = pData->GetTableColumnName( aAbs.Col());
}
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index f9c69b20d338..825e6ca51124 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -430,15 +430,19 @@ void ScDBData::SetImportParam(const ScImportParam& rImportParam)
mpImportParam.reset(new ScImportParam(rImportParam));
}
-bool ScDBData::IsDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const
+bool ScDBData::IsDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
{
if (nTab == nTable)
{
- if ( bStartOnly )
- return ( nCol == nStartCol && nRow == nStartRow );
- else
- return ( nCol >= nStartCol && nCol <= nEndCol &&
- nRow >= nStartRow && nRow <= nEndRow );
+ switch (ePortion)
+ {
+ case ScDBDataPortion::TOP_LEFT:
+ return nCol == nStartCol && nRow == nStartRow;
+ case ScDBDataPortion::HEADER:
+ return HasHeader() && nRow == nStartRow && nCol >= nStartCol && nCol <= nEndCol;
+ case ScDBDataPortion::AREA:
+ return nCol >= nStartCol && nCol <= nEndCol && nRow >= nStartRow && nRow <= nEndRow;
+ }
}
return false;
@@ -812,14 +816,14 @@ class FindByCursor : public unary_function<std::unique_ptr<ScDBData>, bool>
SCCOL mnCol;
SCROW mnRow;
SCTAB mnTab;
- bool mbStartOnly;
+ ScDBDataPortion mePortion;
public:
- FindByCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) :
- mnCol(nCol), mnRow(nRow), mnTab(nTab), mbStartOnly(bStartOnly) {}
+ FindByCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) :
+ mnCol(nCol), mnRow(nRow), mnTab(nTab), mePortion(ePortion) {}
bool operator() (std::unique_ptr<ScDBData> const& p)
{
- return p->IsDBAtCursor(mnCol, mnRow, mnTab, mbStartOnly);
+ return p->IsDBAtCursor(mnCol, mnRow, mnTab, mePortion);
}
};
@@ -980,10 +984,11 @@ ScDBCollection::AnonDBs::const_iterator ScDBCollection::AnonDBs::end() const
return m_DBs.end();
}
-const ScDBData* ScDBCollection::AnonDBs::findAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const
+const ScDBData* ScDBCollection::AnonDBs::findAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab,
+ ScDBDataPortion ePortion) const
{
DBsType::const_iterator itr = find_if(
- m_DBs.begin(), m_DBs.end(), FindByCursor(nCol, nRow, nTab, bStartOnly));
+ m_DBs.begin(), m_DBs.end(), FindByCursor(nCol, nRow, nTab, ePortion));
return itr == m_DBs.end() ? nullptr : itr->get();
}
@@ -1062,22 +1067,22 @@ ScDBCollection::ScDBCollection(ScDocument* pDocument) :
ScDBCollection::ScDBCollection(const ScDBCollection& r) :
pDoc(r.pDoc), nEntryIndex(r.nEntryIndex), maNamedDBs(r.maNamedDBs), maAnonDBs(r.maAnonDBs) {}
-const ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const
+const ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
{
// First, search the global named db ranges.
NamedDBs::DBsType::const_iterator itr = find_if(
- maNamedDBs.begin(), maNamedDBs.end(), FindByCursor(nCol, nRow, nTab, bStartOnly));
+ maNamedDBs.begin(), maNamedDBs.end(), FindByCursor(nCol, nRow, nTab, ePortion));
if (itr != maNamedDBs.end())
return itr->get();
// Check for the sheet-local anonymous db range.
const ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
if (pNoNameData)
- if (pNoNameData->IsDBAtCursor(nCol,nRow,nTab,bStartOnly))
+ if (pNoNameData->IsDBAtCursor(nCol,nRow,nTab,ePortion))
return pNoNameData;
// Check the global anonymous db ranges.
- const ScDBData* pData = getAnonDBs().findAtCursor(nCol, nRow, nTab, bStartOnly);
+ const ScDBData* pData = getAnonDBs().findAtCursor(nCol, nRow, nTab, ePortion);
if (pData)
return pData;
@@ -1086,22 +1091,22 @@ const ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab
return NULL;
}
-ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly)
+ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion)
{
// First, search the global named db ranges.
NamedDBs::DBsType::iterator itr = find_if(
- maNamedDBs.begin(), maNamedDBs.end(), FindByCursor(nCol, nRow, nTab, bStartOnly));
+ maNamedDBs.begin(), maNamedDBs.end(), FindByCursor(nCol, nRow, nTab, ePortion));
if (itr != maNamedDBs.end())
return itr->get();
// Check for the sheet-local anonymous db range.
ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
if (pNoNameData)
- if (pNoNameData->IsDBAtCursor(nCol,nRow,nTab,bStartOnly))
+ if (pNoNameData->IsDBAtCursor(nCol,nRow,nTab,ePortion))
return pNoNameData;
// Check the global anonymous db ranges.
- const ScDBData* pData = getAnonDBs().findAtCursor(nCol, nRow, nTab, bStartOnly);
+ const ScDBData* pData = getAnonDBs().findAtCursor(nCol, nRow, nTab, ePortion);
if (pData)
return const_cast<ScDBData*>(pData);
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 )