summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-06-20 22:36:14 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-06-20 22:36:14 +0200
commitddc43ba8f731c103d24daf8537d5437800ae0c09 (patch)
tree78d5255a5baf883a1c3acafda99b382f721c99e6 /forms
parent16ae4c1524769458f6d205430e7dcb8fc4ae333b (diff)
unoawt: now that the image control/model are not connected via XImageProducer/Consumer anymore, ensure that images loaded from a database document are displayed, too
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/ImageControl.cxx11
-rw-r--r--forms/source/component/ImageControl.hxx2
-rw-r--r--forms/source/component/imgprod.cxx43
-rw-r--r--forms/source/component/imgprod.hxx22
4 files changed, 23 insertions, 55 deletions
diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 72d22d3f30a5..f74e82135708 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -190,6 +190,7 @@ void OImageControlModel::implConstruct()
{
m_pImageProducer = new ImageProducer;
m_xImageProducer = m_pImageProducer;
+ m_pImageProducer->SetDoneHdl( LINK( this, OImageControlModel, OnImageImportDone ) );
}
//------------------------------------------------------------------
@@ -630,6 +631,16 @@ void SAL_CALL OImageControlModel::startProduction( ) throw (RuntimeException)
GetImageProducer()->startProduction();
}
+//------------------------------------------------------------------------------
+IMPL_LINK( OImageControlModel, OnImageImportDone, ::Graphic*, i_pGraphic )
+{
+ ENSURE_OR_RETURN( i_pGraphic, "OImageControlModel::OnImageImportDone: illegal graphic!", 0L );
+ setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ) ),
+ makeAny( Image( i_pGraphic->GetBitmapEx() ).GetXGraphic() )
+ );
+ return 1L;
+}
//==================================================================
// OImageControlControl
diff --git a/forms/source/component/ImageControl.hxx b/forms/source/component/ImageControl.hxx
index eb0e15660ca6..c31216fc8aca 100644
--- a/forms/source/component/ImageControl.hxx
+++ b/forms/source/component/ImageControl.hxx
@@ -140,6 +140,8 @@ protected:
bound field, or the control itself if there is no bound field
*/
sal_Bool impl_updateStreamForURL_lck( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator );
+
+ DECL_LINK( OnImageImportDone, ::Graphic* );
};
//==================================================================
diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx
index 8bd02173fc3f..8ee2315f366b 100644
--- a/forms/source/component/imgprod.cxx
+++ b/forms/source/component/imgprod.cxx
@@ -190,11 +190,7 @@ ErrCode ImgProdLockBytes::Stat( SvLockBytesStat* pStat, SvLockBytesStatFlag eFla
ImageProducer::ImageProducer() :
mpStm ( NULL ),
- mpFilter ( NULL ),
- mnStatus ( 0UL ),
- mbConsInit ( sal_False ),
- mnLastError ( 0UL ),
- mbAsync ( sal_False )
+ mbConsInit ( sal_False )
{
mpGraphic = new Graphic;
DBG_ASSERT( Application::GetFilterHdl().IsSet(), "ImageProducer::ImageProducer(): No filter handler set" );
@@ -207,9 +203,6 @@ ImageProducer::~ImageProducer()
delete mpGraphic;
mpGraphic = NULL;
- delete mpFilter;
- mpFilter = NULL;
-
delete mpStm;
mpStm = NULL;
@@ -261,7 +254,6 @@ void ImageProducer::SetImage( const ::rtl::OUString& rPath )
maURL = rPath;
mpGraphic->Clear();
mbConsInit = sal_False;
- mbAsync = sal_False;
delete mpStm;
if ( ::svt::GraphicAccess::isSupportedURL( maURL ) )
@@ -284,7 +276,6 @@ void ImageProducer::SetImage( SvStream& rStm )
maURL = ::rtl::OUString();
mpGraphic->Clear();
mbConsInit = sal_False;
- mbAsync = sal_False;
delete mpStm;
mpStm = new SvStream( new ImgProdLockBytes( &rStm, sal_False ) );
@@ -297,7 +288,6 @@ void ImageProducer::setImage( ::com::sun::star::uno::Reference< ::com::sun::star
maURL = ::rtl::OUString();
mpGraphic->Clear();
mbConsInit = sal_False;
- mbAsync = sal_False;
delete mpStm;
if( rInputStmRef.is() )
@@ -318,9 +308,7 @@ void ImageProducer::NewDataAvailable()
void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeException)
{
- ResetLastError();
-
- if( maConsList.Count() )
+ if( maConsList.Count() || maDoneHdl.IsSet() )
{
bool bNotifyEmptyGraphics = false;
@@ -331,8 +319,8 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept
// graphic is cleared if a new Stream is set
if( ( mpGraphic->GetType() == GRAPHIC_NONE ) || mpGraphic->GetContext() )
{
- if( !ImplImportGraphic( *mpGraphic ) && maErrorHdl.IsSet() )
- maErrorHdl.Call( this );
+ if ( ImplImportGraphic( *mpGraphic ) && maDoneHdl.IsSet() )
+ maDoneHdl.Call( mpGraphic );
}
if( mpGraphic->GetType() != GRAPHIC_NONE )
@@ -372,32 +360,17 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept
sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic )
{
USHORT nFilter = GRFILTER_FORMAT_DONTKNOW;
- short nRet;
- sal_Bool bRet = sal_False;
if( ERRCODE_IO_PENDING == mpStm->GetError() )
mpStm->ResetError();
mpStm->Seek( 0UL );
- if( mpFilter )
- nRet = mpFilter->ImportGraphic( rGraphic, String(), *mpStm, nFilter );
- else
- {
- if( GraphicConverter::Import( *mpStm, rGraphic ) == ERRCODE_NONE )
- nRet = GRFILTER_OK;
- else
- nRet = GRFILTER_FILTERERROR;
- }
+ sal_Bool bRet = GraphicConverter::Import( *mpStm, rGraphic ) == ERRCODE_NONE;
if( ERRCODE_IO_PENDING == mpStm->GetError() )
mpStm->ResetError();
- if( nRet == GRFILTER_OK )
- bRet = sal_True;
- else
- mnLastError = nRet;
-
return bRet;
}
@@ -405,10 +378,6 @@ sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic )
void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
{
- // asynchronous?
- if( mpGraphic->GetContext() )
- mbAsync = sal_True;
-
ImplInitConsumer( rGraphic );
if( mbConsInit && maConsList.Count() )
@@ -425,7 +394,7 @@ void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
// iterate through interfaces
for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( mnStatus = ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
+ ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
// delete interfaces in temporary list
for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
diff --git a/forms/source/component/imgprod.hxx b/forms/source/component/imgprod.hxx
index 0da5d04755df..170fc186fa73 100644
--- a/forms/source/component/imgprod.hxx
+++ b/forms/source/component/imgprod.hxx
@@ -64,20 +64,9 @@ private:
List maConsList;
Graphic* mpGraphic;
SvStream* mpStm;
- GraphicFilter* mpFilter;
sal_uInt32 mnTransIndex;
- sal_uInt32 mnStatus;
sal_Bool mbConsInit;
- sal_Bool mbStmDel;
- Link maErrorHdl;
- sal_uInt32 mnLastError;
-
- sal_uInt32 mnExtra2;
-
- sal_Bool mbAsync;
- sal_Bool mbExtra1;
- sal_Bool mbExtra2;
- sal_Bool mbExtra3;
+ Link maDoneHdl;
sal_Bool ImplImportGraphic( Graphic& rGraphic );
void ImplUpdateData( const Graphic& rGraphic );
@@ -92,14 +81,11 @@ public:
void SetImage( const ::rtl::OUString& rPath );
void SetImage( SvStream& rStm );
- void SetErrorHandler( const Link& rErrorHdl ) { maErrorHdl = rErrorHdl; }
- const Link& GetErrorHandler() const { return maErrorHdl; }
-
- sal_uInt32 GetLastError() const { return mnLastError; }
- void ResetLastError() { mnLastError = 0; }
-
void NewDataAvailable();
+ void SetDoneHdl( const Link& i_rHdl ) { maDoneHdl = i_rHdl; }
+ const Link& GetDoneHdl() const { return maDoneHdl; }
+
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL acquire() throw() { OWeakObject::acquire(); }