summaryrefslogtreecommitdiff
path: root/svx/source/fmcomp
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/fmcomp')
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx15
-rw-r--r--svx/source/fmcomp/fmgridif.cxx78
-rw-r--r--svx/source/fmcomp/gridcell.cxx10
-rw-r--r--svx/source/fmcomp/gridcols.cxx33
-rw-r--r--svx/source/fmcomp/gridctrl.cxx46
5 files changed, 119 insertions, 63 deletions
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index fc05f258ab..2d21734dfe 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -35,6 +35,7 @@
#include "fmgridif.hxx"
#include "fmitems.hxx"
#include "fmprop.hrc"
+#include "svx/fmtools.hxx"
#include "fmresids.hrc"
#include "fmservs.hxx"
#include "fmurl.hxx"
@@ -435,6 +436,7 @@ IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ )
// diese Datentypen koennen im Gridcontrol nicht verarbeitet werden
switch (nDataType)
{
+ case DataType::BLOB:
case DataType::LONGVARBINARY:
case DataType::BINARY:
case DataType::VARBINARY:
@@ -1724,6 +1726,7 @@ void FmGridControl::InitColumnByField(
sal_Bool bIllegalType = sal_False;
switch ( nDataType )
{
+ case DataType::BLOB:
case DataType::LONGVARBINARY:
case DataType::BINARY:
case DataType::VARBINARY:
@@ -1768,14 +1771,18 @@ void FmGridControl::InitColumnsByFields(const Reference< ::com::sun::star::conta
Reference< XIndexContainer > xColumns( GetPeer()->getColumns() );
Reference< XNameAccess > xFieldsAsNames( _rxFields, UNO_QUERY );
- // Einfuegen mu� sich an den Column Positionen orientieren
+ // Einfuegen muss sich an den Column Positionen orientieren
for (sal_Int32 i = 0; i < xColumns->getCount(); i++)
{
DbGridColumn* pCol = GetColumns().GetObject(i);
- Reference< XPropertySet > xColumnModel;
- ::cppu::extractInterface( xColumnModel, xColumns->getByIndex( i ) );
+ OSL_ENSURE(pCol,"No grid column!");
+ if ( pCol )
+ {
+ Reference< XPropertySet > xColumnModel;
+ ::cppu::extractInterface( xColumnModel, xColumns->getByIndex( i ) );
- InitColumnByField( pCol, xColumnModel, xFieldsAsNames, _rxFields );
+ InitColumnByField( pCol, xColumnModel, xFieldsAsNames, _rxFields );
+ }
}
}
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 713ec5d5d5..08c682451f 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -36,12 +36,14 @@
#include "fmservs.hxx"
#include "svx/fmtools.hxx"
#include "fmurl.hxx"
+#include "svx/fmtools.hxx"
#include "formcontrolfactory.hxx"
#include "gridcell.hxx"
#include "sdbdatacolumn.hxx"
#include "svx/fmgridcl.hxx"
#include "svx/svxids.hrc"
+/** === begin UNO includes === **/
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
@@ -52,6 +54,8 @@
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+/** === end UNO includes === **/
#include <comphelper/container.hxx>
#include <comphelper/enumhelper.hxx>
@@ -66,6 +70,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;
@@ -1118,7 +1123,7 @@ namespace fmgridif
{
const ::rtl::OUString getDataModeIdentifier()
{
- static ::rtl::OUString s_sDataModeIdentifier = DATA_MODE;
+ static ::rtl::OUString s_sDataModeIdentifier = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) );
return s_sDataModeIdentifier;
}
}
@@ -1390,8 +1395,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();
@@ -1413,39 +1418,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
+ Reference< XPropertySet > xFieldSet(xFieldContent, UNO_QUERY);
+ pReturnArray[i] = xFieldSet->getPropertyValue(FM_PROP_VALUE);
+ }
+ else
+ {
+ switch (xType.getTypeClass())
{
- 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();
}
}
}
@@ -1724,6 +1730,8 @@ void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol)
//------------------------------------------------------------------------------
void FmXGridPeer::setColumns(const Reference< XIndexContainer >& Columns) throw( RuntimeException )
{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
FmGridControl* pGrid = static_cast< FmGridControl* >( GetWindow() );
if (m_xColumns.is())
@@ -2457,7 +2465,7 @@ void FmXGridPeer::setMode(const ::rtl::OUString& Mode) throw( NoSupportException
m_aMode = Mode;
FmGridControl* pGrid = (FmGridControl*) GetWindow();
- if (Mode == FILTER_MODE)
+ if ( Mode == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterMode" ) ) )
pGrid->SetFilterMode(sal_True);
else
{
@@ -2480,8 +2488,8 @@ void FmXGridPeer::setMode(const ::rtl::OUString& Mode) throw( NoSupportException
{
aModes.realloc(2);
::rtl::OUString* pModes = aModes.getArray();
- pModes[0] = DATA_MODE;
- pModes[1] = FILTER_MODE;
+ pModes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) );
+ pModes[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterMode" ) );
}
return aModes;
}
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 61ca01628c..2ab178f3ef 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -679,7 +679,15 @@ sal_Bool DbCellControl::Commit()
// lock the listening for value property changes
lockValueProperty();
// commit the content of the control into the model's value property
- sal_Bool bReturn = commitControl();
+ sal_Bool bReturn = sal_False;
+ try
+ {
+ bReturn = commitControl();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
// unlock the listening for value property changes
unlockValueProperty();
// outta here
diff --git a/svx/source/fmcomp/gridcols.cxx b/svx/source/fmcomp/gridcols.cxx
index f954068d4d..339cf12cbb 100644
--- a/svx/source/fmcomp/gridcols.cxx
+++ b/svx/source/fmcomp/gridcols.cxx
@@ -35,6 +35,7 @@
#include <comphelper/types.hxx>
#include "fmservs.hxx"
#include "svx/fmtools.hxx"
+using namespace ::com::sun::star::uno;
//------------------------------------------------------------------------------
const ::comphelper::StringSequence& getColumnTypes()
@@ -57,6 +58,36 @@ const ::comphelper::StringSequence& getColumnTypes()
return aColumnTypes;
}
+//------------------------------------------------------------------
+// Vergleichen von PropertyInfo
+extern "C" int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC ) && defined( OS2 )
+_Optlink
+#endif
+ NameCompare(const void* pFirst, const void* pSecond)
+{
+ return ((::rtl::OUString*)pFirst)->compareTo(*(::rtl::OUString*)pSecond);
+}
+
+namespace
+{
+ //------------------------------------------------------------------------------
+ sal_Int32 lcl_findPos(const ::rtl::OUString& aStr, const Sequence< ::rtl::OUString>& rList)
+ {
+ const ::rtl::OUString* pStrList = rList.getConstArray();
+ ::rtl::OUString* pResult = (::rtl::OUString*) bsearch(&aStr, (void*)pStrList, rList.getLength(), sizeof(::rtl::OUString),
+ &NameCompare);
+
+ if (pResult)
+ return (pResult - pStrList);
+ else
+ return -1;
+ }
+}
+
//------------------------------------------------------------------------------
sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName)
{
@@ -79,7 +110,7 @@ sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName)
: aModelName.copy(aCompatibleModelPrefix.getLength());
const ::comphelper::StringSequence& rColumnTypes = getColumnTypes();
- nTypeId = findPos(aColumnType, rColumnTypes);
+ nTypeId = lcl_findPos(aColumnType, rColumnTypes);
}
return nTypeId;
}
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 14b1ce554c..26e5d496bf 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -874,7 +874,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;
@@ -1787,30 +1787,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");
+ 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);
}
+
+ DbGridControl_Base::SeekRow(nRow);
+
return m_nSeekPos >= 0;
}
//------------------------------------------------------------------------------
@@ -2382,7 +2384,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;
}