diff options
author | Ocke Janssen <oj@openoffice.org> | 2002-05-10 10:33:31 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2002-05-10 10:33:31 +0000 |
commit | b4733d67425b916b1e2d270b84bf27b4c11f9778 (patch) | |
tree | 0d64294181574c9c69999b458ca27a0c2386df19 /svx/source/fmcomp | |
parent | 7b5bc13a8232871264defe4973c316f05db98316 (diff) |
#95191# check position of seekcursor before asking for bookmark
Diffstat (limited to 'svx/source/fmcomp')
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 14dace59247f..a704e0768bfb 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: gridctrl.cxx,v $ * - * $Revision: 1.49 $ + * $Revision: 1.50 $ * - * last change: $Author: fs $ $Date: 2002-04-30 18:28:19 $ + * last change: $Author: oj $ $Date: 2002-05-10 11:33:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2108,7 +2108,8 @@ sal_Bool DbGridControl::SetCurrent(long nNewRow, sal_Bool bForceInsertIfNewRow) // we need to insert the if the current row isn't the insert row or if the // cursor triggered the move by itselt and we need a reinitialization of the row Reference< XPropertySet > xCursorProps((Reference< XInterface >)*m_pDataCursor, UNO_QUERY); - if (bForceInsertIfNewRow || !::comphelper::getBOOL(xCursorProps->getPropertyValue(FM_PROP_ISNEW))) + // if ( !::comphelper::getBOOL(xCursorProps->getPropertyValue(FM_PROP_ISNEW)) || (bForceInsertIfNewRow && !::comphelper::getBOOL(xCursorProps->getPropertyValue(FM_PROP_ISNEW))) ) + if ( !::comphelper::getBOOL(xCursorProps->getPropertyValue(FM_PROP_ISNEW)) ) { Reference< XResultSetUpdate > xUpdateCursor((Reference< XInterface >)*m_pDataCursor, UNO_QUERY); xUpdateCursor->moveToInsertRow(); @@ -2117,14 +2118,18 @@ sal_Bool DbGridControl::SetCurrent(long nNewRow, sal_Bool bForceInsertIfNewRow) } else { - Any aBookmark = m_pSeekCursor->getBookmark(); - if (!m_xCurrentRow || m_xCurrentRow->IsNew() || !CompareBookmark(aBookmark, m_pDataCursor->getBookmark())) + + if ( !m_pSeekCursor->isBeforeFirst() && !m_pSeekCursor->isAfterLast() ) { - // adjust the cursor to the new desired row - if (!m_pDataCursor->moveToBookmark(aBookmark)) + Any aBookmark = m_pSeekCursor->getBookmark(); + if (!m_xCurrentRow || m_xCurrentRow->IsNew() || !CompareBookmark(aBookmark, m_pDataCursor->getBookmark())) { - EndCursorAction(); - return sal_False; + // adjust the cursor to the new desired row + if (!m_pDataCursor->moveToBookmark(aBookmark)) + { + EndCursorAction(); + return sal_False; + } } } } |