dba33h: #i114022# properly handle new/empty images

This commit is contained in:
Frank Schoenheit [fs]
2010-08-25 16:14:14 +02:00
parent 356027851e
commit 96a48f7977
2 changed files with 12 additions and 3 deletions

View File

@@ -523,7 +523,13 @@ Any OImageControlModel::translateDbColumnToControlValue()
{
switch ( lcl_getImageStoreType( getFieldType() ) )
{
case ImageStoreBinary: return makeAny( m_xColumn->getBinaryStream() );
case ImageStoreBinary:
{
Reference< XInputStream > xImageStream( m_xColumn->getBinaryStream() );
if ( m_xColumn->wasNull() )
xImageStream.clear();
return makeAny( xImageStream );
}
case ImageStoreLink:
{
::rtl::OUString sImageLink( m_xColumn->getString() );
@@ -634,10 +640,10 @@ void SAL_CALL OImageControlModel::startProduction( ) throw (RuntimeException)
//------------------------------------------------------------------------------
IMPL_LINK( OImageControlModel, OnImageImportDone, ::Graphic*, i_pGraphic )
{
ENSURE_OR_RETURN( i_pGraphic, "OImageControlModel::OnImageImportDone: illegal graphic!", 0L );
const Reference< XGraphic > xGraphic( i_pGraphic != NULL ? Image( i_pGraphic->GetBitmapEx() ).GetXGraphic() : NULL );
setPropertyValue(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ) ),
makeAny( Image( i_pGraphic->GetBitmapEx() ).GetXGraphic() )
makeAny( xGraphic )
);
return 1L;
}