diff --git a/svx/inc/svx/fmgridcl.hxx b/svx/inc/svx/fmgridcl.hxx index f6b533513784..f8e04c4c405c 100644 --- a/svx/inc/svx/fmgridcl.hxx +++ b/svx/inc/svx/fmgridcl.hxx @@ -31,13 +31,8 @@ #define _SVX_FMGRIDCL_HXX #include - -#ifndef _COM_SUN_STAR_FORM_XINDEXCONTAINER_HPP_ -#include -#endif #include -// alles nur fuer stl #include #include #include "svx/svxdllapi.h" diff --git a/svx/inc/svx/gridctrl.hxx b/svx/inc/svx/gridctrl.hxx index 632ca6ea0805..834ea17eaa1f 100644 --- a/svx/inc/svx/gridctrl.hxx +++ b/svx/inc/svx/gridctrl.hxx @@ -584,9 +584,10 @@ protected: sal_Int32 GetSeekPos() const {return m_nSeekPos;} sal_Int32 GetTotalCount() const {return m_nTotalCount;} - const DbGridRowRef& GetEmptyRow() const {return m_xEmptyRow;} - const DbGridRowRef& GetSeekRow() const {return m_xSeekRow;} - CursorWrapper* GetSeekCursor() const {return m_pSeekCursor;} + const DbGridRowRef& GetEmptyRow() const { return m_xEmptyRow; } + const DbGridRowRef& GetSeekRow() const { return m_xSeekRow; } + const DbGridRowRef& GetPaintRow() const { return m_xPaintRow; } + CursorWrapper* GetSeekCursor() const { return m_pSeekCursor; } void ConnectToFields(); void DisconnectFromFields(); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 3108a545d510..ad3680391aa4 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -69,6 +69,7 @@ using namespace ::svxform; using namespace ::com::sun::star::container; +using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::view; @@ -1393,8 +1394,8 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type // don't use GetCurrentRow as this isn't affected by the above SeekRow // FS - 30.09.99 - 68644 - DbGridRowRef aRow = pGrid->GetSeekRow(); - DBG_ASSERT(aRow.Is(), "FmXGridPeer::queryFieldData : invalid current Row !"); + DbGridRowRef xPaintRow = pGrid->GetPaintRow(); + ENSURE_OR_THROW( xPaintRow.Is(), "invalid paint row" ); // die Columns des Controls brauche ich fuer GetFieldText DbGridColumns aColumns = pGrid->GetColumns(); @@ -1416,39 +1417,40 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type // don't use GetCurrentFieldValue to determine the field content as this isn't affected by the above SeekRow // FS - 30.09.99 - 68644 pCol = aColumns.GetObject(nModelPos); - const DbGridRowRef xRow = pGrid->GetSeekRow(); - xFieldContent = (xRow.Is() && xRow->HasField(pCol->GetFieldPos())) ? xRow->GetField(pCol->GetFieldPos()).getColumn() : Reference< ::com::sun::star::sdb::XColumn > (); + xFieldContent = xPaintRow->HasField( pCol->GetFieldPos() ) + ? xPaintRow->GetField( pCol->GetFieldPos() ).getColumn() + : Reference< XColumn > (); - if (xFieldContent.is()) + if ( !xFieldContent.is() ) + continue; + + if (bRequestedAsAny) { - if (bRequestedAsAny) + Reference< XPropertySet > xFieldSet(xFieldContent, UNO_QUERY); + pReturnArray[i] = xFieldSet->getPropertyValue(FM_PROP_VALUE); + } + else + { + switch (xType.getTypeClass()) { - Reference< XPropertySet > xFieldSet(xFieldContent, UNO_QUERY); - pReturnArray[i] = xFieldSet->getPropertyValue(FM_PROP_VALUE); - } - else - { - switch (xType.getTypeClass()) + // Strings werden direkt ueber das GetFieldText abgehandelt + case TypeClass_STRING : { - // Strings werden direkt ueber das GetFieldText abgehandelt - case TypeClass_STRING : - { - String sText = aColumns.GetObject(nModelPos)->GetCellText(aRow, pGrid->getNumberFormatter()); - pReturnArray[i] <<= ::rtl::OUString(sText); - } - break; - // alles andere wird an der DatabaseVariant erfragt - case TypeClass_FLOAT : pReturnArray[i] <<= xFieldContent->getFloat(); break; - case TypeClass_DOUBLE : pReturnArray[i] <<= xFieldContent->getDouble(); break; - case TypeClass_SHORT : pReturnArray[i] <<= (sal_Int16)xFieldContent->getShort(); break; - case TypeClass_LONG : pReturnArray[i] <<= (sal_Int32)xFieldContent->getLong(); break; - case TypeClass_UNSIGNED_SHORT: pReturnArray[i] <<= (sal_uInt16)xFieldContent->getShort(); break; - case TypeClass_UNSIGNED_LONG : pReturnArray[i] <<= (sal_uInt32)xFieldContent->getLong(); break; - case TypeClass_BOOLEAN : ::comphelper::setBOOL(pReturnArray[i],xFieldContent->getBoolean()); break; - default: - { - throw IllegalArgumentException(); - } + String sText = aColumns.GetObject(nModelPos)->GetCellText( xPaintRow, pGrid->getNumberFormatter() ); + pReturnArray[i] <<= ::rtl::OUString(sText); + } + break; + // alles andere wird an der DatabaseVariant erfragt + case TypeClass_FLOAT : pReturnArray[i] <<= xFieldContent->getFloat(); break; + case TypeClass_DOUBLE : pReturnArray[i] <<= xFieldContent->getDouble(); break; + case TypeClass_SHORT : pReturnArray[i] <<= (sal_Int16)xFieldContent->getShort(); break; + case TypeClass_LONG : pReturnArray[i] <<= (sal_Int32)xFieldContent->getLong(); break; + case TypeClass_UNSIGNED_SHORT : pReturnArray[i] <<= (sal_uInt16)xFieldContent->getShort(); break; + case TypeClass_UNSIGNED_LONG : pReturnArray[i] <<= (sal_uInt32)xFieldContent->getLong(); break; + case TypeClass_BOOLEAN : ::comphelper::setBOOL(pReturnArray[i],xFieldContent->getBoolean()); break; + default: + { + throw IllegalArgumentException(); } } } diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index f53168a273ac..1988983a5f0c 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -868,7 +868,7 @@ void DbGridRow::SetState(CursorWrapper* pCur, sal_Bool bPaintCursor) } catch(SQLException&) { - OSL_ENSURE(0,"SQLException catched while getting the bookmark"); + DBG_UNHANDLED_EXCEPTION(); m_aBookmark = Any(); m_eStatus = GRS_INVALID; m_bIsNew = sal_False; @@ -1786,30 +1786,32 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId) sal_Bool DbGridControl::SeekRow(long nRow) { // in filter mode or in insert only mode we don't have any cursor! - if (SeekCursor(nRow)) + if ( !SeekCursor( nRow ) ) + return sal_False; + + if ( IsFilterMode() ) { - if (m_pSeekCursor) - { - // on the current position we have to take the current row for display as we want - // to have the most recent values for display - if ((nRow == m_nCurrentPos) && getDisplaySynchron()) - m_xPaintRow = m_xCurrentRow; - // seek to the empty insert row - else if (IsInsertionRow(nRow)) - m_xPaintRow = m_xEmptyRow; - else - { - m_xSeekRow->SetState(m_pSeekCursor, sal_True); - m_xPaintRow = m_xSeekRow; - } - } - else if (IsFilterMode()) - { - DBG_ASSERT(IsFilterRow(nRow), "DbGridControl::SeekRow(): No filter row, wrong mode"); - m_xPaintRow = m_xEmptyRow; - } - DbGridControl_Base::SeekRow(nRow); + DBG_ASSERT( IsFilterRow( nRow ), "DbGridControl::SeekRow(): No filter row, wrong mode" ); + m_xPaintRow = m_xEmptyRow; } + else + { + // on the current position we have to take the current row for display as we want + // to have the most recent values for display + if ( ( nRow == m_nCurrentPos ) && getDisplaySynchron() ) + m_xPaintRow = m_xCurrentRow; + // seek to the empty insert row + else if ( IsInsertionRow( nRow ) ) + m_xPaintRow = m_xEmptyRow; + else + { + m_xSeekRow->SetState( m_pSeekCursor, sal_True ); + m_xPaintRow = m_xSeekRow; + } + } + + DbGridControl_Base::SeekRow(nRow); + return m_nSeekPos >= 0; } //------------------------------------------------------------------------------ @@ -2381,7 +2383,7 @@ sal_Bool DbGridControl::SeekCursor(long nRow, sal_Bool bAbsolute) // da der letzte Datensatz bereits erreicht wurde! if (nRow == m_nCurrentPos) { - // auf die aktuelle Zeile bewegt, dann mu� kein abgleich gemacht werden, wenn + // auf die aktuelle Zeile bewegt, dann muß kein abgleich gemacht werden, wenn // gerade ein Datensatz eingefuegt wird m_nSeekPos = nRow; }