? sc/sc.vpj Index: sc/inc/document.hxx =================================================================== RCS file: /cvs/sc/sc/inc/document.hxx,v retrieving revision 1.105 diff -u -r1.105 document.hxx --- sc/inc/document.hxx 7 Dec 2007 10:40:50 -0000 1.105 +++ sc/inc/document.hxx 16 Jan 2008 17:03:07 -0000 @@ -857,7 +857,7 @@ USHORT GetErrCode( const ScAddress& ) const; void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, - SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld ); + SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld ) const; BOOL GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; BOOL GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; BOOL GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow, @@ -1365,6 +1365,9 @@ SCTAB nTab, ScQueryParam& rQueryParam ); void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, String& rStr); + /** Expands the database range in a presense of new data rows. */ + void ExpandDBDataRows(ScDBData& rDBData) const; + BOOL GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedStrCollection& rStrings, bool bFilter = false ); SC_DLLPUBLIC BOOL GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, Index: sc/inc/table.hxx =================================================================== RCS file: /cvs/sc/sc/inc/table.hxx,v retrieving revision 1.32 diff -u -r1.32 table.hxx --- sc/inc/table.hxx 21 Sep 2007 09:22:40 -0000 1.32 +++ sc/inc/table.hxx 16 Jan 2008 17:03:08 -0000 @@ -355,7 +355,7 @@ SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow ); void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, - BOOL bIncludeOld ); + BOOL bIncludeOld ) const; SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ); Index: sc/source/core/data/documen3.cxx =================================================================== RCS file: /cvs/sc/sc/source/core/data/documen3.cxx,v retrieving revision 1.38 diff -u -r1.38 documen3.cxx --- sc/source/core/data/documen3.cxx 21 Sep 2007 09:22:54 -0000 1.38 +++ sc/source/core/data/documen3.cxx 16 Jan 2008 17:03:08 -0000 @@ -1337,6 +1337,20 @@ // GetFilterEntries - Eintraege fuer AutoFilter-Listbox // +void ScDocument::ExpandDBDataRows(ScDBData& rDBData) const +{ + SCCOL nCol1, nCol2; + SCROW nRow1, nRow2; + SCTAB nTab; + rDBData.GetArea(nTab, nCol1, nRow1, nCol2, nRow2); + SCCOL nCol1a = nCol1, nCol2a = nCol2; + SCROW nRow1a = nRow1, nRow2a = nRow2; + GetDataArea(nTab, nCol1a, nRow1a, nCol2a, nRow2a, false); + if (nRow2a > nRow2) + // resize only when the data size grows. + rDBData.SetArea(nTab, nCol1, nRow1, nCol2, nRow2a); +} + BOOL ScDocument::GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedStrCollection& rStrings, bool bFilter ) { if ( ValidTab(nTab) && pTab[nTab] && pDBCollection ) @@ -1344,6 +1358,7 @@ ScDBData* pDBData = pDBCollection->GetDBAtCursor(nCol, nRow, nTab, FALSE); //!?? if (pDBData) { + ExpandDBDataRows(*pDBData); SCTAB nAreaTab; SCCOL nStartCol; SCROW nStartRow; Index: sc/source/core/data/document.cxx =================================================================== RCS file: /cvs/sc/sc/source/core/data/document.cxx,v retrieving revision 1.80 diff -u -r1.80 document.cxx --- sc/source/core/data/document.cxx 27 Sep 2007 13:52:38 -0000 1.80 +++ sc/source/core/data/document.cxx 16 Jan 2008 17:03:08 -0000 @@ -590,7 +590,7 @@ // zusammenhaengender Bereich void ScDocument::GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, - SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld ) + SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld ) const { if (VALIDTAB(nTab)) if (pTab[nTab]) Index: sc/source/core/data/table1.cxx =================================================================== RCS file: /cvs/sc/sc/source/core/data/table1.cxx,v retrieving revision 1.20 diff -u -r1.20 table1.cxx --- sc/source/core/data/table1.cxx 27 Feb 2007 12:09:14 -0000 1.20 +++ sc/source/core/data/table1.cxx 16 Jan 2008 17:03:09 -0000 @@ -619,7 +619,7 @@ } void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, - BOOL bIncludeOld ) + BOOL bIncludeOld ) const { BOOL bLeft = FALSE; BOOL bRight = FALSE; Index: sc/source/ui/inc/dbfunc.hxx =================================================================== RCS file: /cvs/sc/sc/source/ui/inc/dbfunc.hxx,v retrieving revision 1.10 diff -u -r1.10 dbfunc.hxx --- sc/source/ui/inc/dbfunc.hxx 7 Dec 2007 10:42:00 -0000 1.10 +++ sc/source/ui/inc/dbfunc.hxx 16 Jan 2008 17:03:09 -0000 @@ -85,7 +85,7 @@ void GotoDBArea( const String& rDBName ); // DB-Bereich vom Cursor - ScDBData* GetDBData( BOOL bMarkArea = TRUE, ScGetDBMode eMode = SC_DB_MAKE ); + ScDBData* GetDBData( bool bMarkArea = true, ScGetDBMode eMode = SC_DB_MAKE, bool bExpandRows = false ); void NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& rDelAreaList ); Index: sc/source/ui/view/dbfunc.cxx =================================================================== RCS file: /cvs/sc/sc/source/ui/view/dbfunc.cxx,v retrieving revision 1.13 diff -u -r1.13 dbfunc.cxx --- sc/source/ui/view/dbfunc.cxx 27 Feb 2007 13:49:34 -0000 1.13 +++ sc/source/ui/view/dbfunc.cxx 16 Jan 2008 17:03:09 -0000 @@ -112,7 +112,7 @@ // aktuellen Datenbereich fuer Sortieren / Filtern suchen -ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode ) +ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, bool bExpandRows ) { ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScDBData* pData = NULL; @@ -124,8 +124,17 @@ ScRange( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ), eMode, FALSE ); + if (!pData) + return NULL; - if ( pData && bMark ) + if (bExpandRows && pData->GetName() != ScGlobal::GetRscString(STR_DB_NONAME)) + { + // Dynamically expand rows to include any new data rows that are + // immediately below the original range. + GetViewData()->GetDocument()->ExpandDBDataRows(*pData); + } + + if (bMark) { ScRange aFound; pData->GetArea(aFound); Index: sc/source/ui/view/tabvwshc.cxx =================================================================== RCS file: /cvs/sc/sc/source/ui/view/tabvwshc.cxx,v retrieving revision 1.11 diff -u -r1.11 tabvwshc.cxx --- sc/source/ui/view/tabvwshc.cxx 22 May 2007 20:15:06 -0000 1.11 +++ sc/source/ui/view/tabvwshc.cxx 16 Jan 2008 17:03:09 -0000 @@ -194,7 +194,7 @@ SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData(); + ScDBData* pDBData = GetDBData(true, SC_DB_MAKE, true); pDBData->GetQueryParam( aQueryParam ); ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam ); @@ -219,7 +219,7 @@ SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData(); + ScDBData* pDBData = GetDBData(true, SC_DB_MAKE, true); pDBData->GetQueryParam( aQueryParam ); aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA,