during (writing a test case for) #i105235#: queryFieldData should also work on the insertion row
This commit is contained in:
parent
f175a7d39c
commit
616109598f
4 changed files with 63 additions and 63 deletions
|
@ -31,13 +31,8 @@
|
|||
#define _SVX_FMGRIDCL_HXX
|
||||
|
||||
#include <com/sun/star/container/XIndexContainer.hpp>
|
||||
|
||||
#ifndef _COM_SUN_STAR_FORM_XINDEXCONTAINER_HPP_
|
||||
#include <com/sun/star/container/XIndexContainer.hpp>
|
||||
#endif
|
||||
#include <com/sun/star/container/XNameContainer.hpp>
|
||||
|
||||
// alles nur fuer stl
|
||||
#include <svx/gridctrl.hxx>
|
||||
#include <svtools/transfer.hxx>
|
||||
#include "svx/svxdllapi.h"
|
||||
|
|
|
@ -586,6 +586,7 @@ protected:
|
|||
|
||||
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();
|
||||
|
|
|
@ -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,11 +1417,13 @@ 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() )
|
||||
continue;
|
||||
|
||||
if (xFieldContent.is())
|
||||
{
|
||||
if (bRequestedAsAny)
|
||||
{
|
||||
Reference< XPropertySet > xFieldSet(xFieldContent, UNO_QUERY);
|
||||
|
@ -1433,7 +1436,7 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type
|
|||
// Strings werden direkt ueber das GetFieldText abgehandelt
|
||||
case TypeClass_STRING :
|
||||
{
|
||||
String sText = aColumns.GetObject(nModelPos)->GetCellText(aRow, pGrid->getNumberFormatter());
|
||||
String sText = aColumns.GetObject(nModelPos)->GetCellText( xPaintRow, pGrid->getNumberFormatter() );
|
||||
pReturnArray[i] <<= ::rtl::OUString(sText);
|
||||
}
|
||||
break;
|
||||
|
@ -1452,7 +1455,6 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return aReturnSequence;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,9 +1786,15 @@ 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)
|
||||
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
|
||||
|
@ -1803,13 +1809,9 @@ sal_Bool DbGridControl::SeekRow(long nRow)
|
|||
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);
|
||||
}
|
||||
|
||||
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<EFBFBD> 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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue