Kaydet (Commit) 53c28304 authored tarafından Jens-Heiner Rechtien's avatar Jens-Heiner Rechtien

CWS-TOOLING: integrate CWS unoawt2

...@@ -190,6 +190,7 @@ void OImageControlModel::implConstruct() ...@@ -190,6 +190,7 @@ void OImageControlModel::implConstruct()
{ {
m_pImageProducer = new ImageProducer; m_pImageProducer = new ImageProducer;
m_xImageProducer = m_pImageProducer; m_xImageProducer = m_pImageProducer;
m_pImageProducer->SetDoneHdl( LINK( this, OImageControlModel, OnImageImportDone ) );
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
...@@ -630,6 +631,16 @@ void SAL_CALL OImageControlModel::startProduction( ) throw (RuntimeException) ...@@ -630,6 +631,16 @@ void SAL_CALL OImageControlModel::startProduction( ) throw (RuntimeException)
GetImageProducer()->startProduction(); 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 // OImageControlControl
......
...@@ -140,6 +140,8 @@ protected: ...@@ -140,6 +140,8 @@ protected:
bound field, or the control itself if there is no bound field bound field, or the control itself if there is no bound field
*/ */
sal_Bool impl_updateStreamForURL_lck( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator ); sal_Bool impl_updateStreamForURL_lck( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator );
DECL_LINK( OnImageImportDone, ::Graphic* );
}; };
//================================================================== //==================================================================
......
...@@ -190,11 +190,7 @@ ErrCode ImgProdLockBytes::Stat( SvLockBytesStat* pStat, SvLockBytesStatFlag eFla ...@@ -190,11 +190,7 @@ ErrCode ImgProdLockBytes::Stat( SvLockBytesStat* pStat, SvLockBytesStatFlag eFla
ImageProducer::ImageProducer() : ImageProducer::ImageProducer() :
mpStm ( NULL ), mpStm ( NULL ),
mpFilter ( NULL ), mbConsInit ( sal_False )
mnStatus ( 0UL ),
mbConsInit ( sal_False ),
mnLastError ( 0UL ),
mbAsync ( sal_False )
{ {
mpGraphic = new Graphic; mpGraphic = new Graphic;
DBG_ASSERT( Application::GetFilterHdl().IsSet(), "ImageProducer::ImageProducer(): No filter handler set" ); DBG_ASSERT( Application::GetFilterHdl().IsSet(), "ImageProducer::ImageProducer(): No filter handler set" );
...@@ -207,9 +203,6 @@ ImageProducer::~ImageProducer() ...@@ -207,9 +203,6 @@ ImageProducer::~ImageProducer()
delete mpGraphic; delete mpGraphic;
mpGraphic = NULL; mpGraphic = NULL;
delete mpFilter;
mpFilter = NULL;
delete mpStm; delete mpStm;
mpStm = NULL; mpStm = NULL;
...@@ -261,7 +254,6 @@ void ImageProducer::SetImage( const ::rtl::OUString& rPath ) ...@@ -261,7 +254,6 @@ void ImageProducer::SetImage( const ::rtl::OUString& rPath )
maURL = rPath; maURL = rPath;
mpGraphic->Clear(); mpGraphic->Clear();
mbConsInit = sal_False; mbConsInit = sal_False;
mbAsync = sal_False;
delete mpStm; delete mpStm;
if ( ::svt::GraphicAccess::isSupportedURL( maURL ) ) if ( ::svt::GraphicAccess::isSupportedURL( maURL ) )
...@@ -284,7 +276,6 @@ void ImageProducer::SetImage( SvStream& rStm ) ...@@ -284,7 +276,6 @@ void ImageProducer::SetImage( SvStream& rStm )
maURL = ::rtl::OUString(); maURL = ::rtl::OUString();
mpGraphic->Clear(); mpGraphic->Clear();
mbConsInit = sal_False; mbConsInit = sal_False;
mbAsync = sal_False;
delete mpStm; delete mpStm;
mpStm = new SvStream( new ImgProdLockBytes( &rStm, sal_False ) ); mpStm = new SvStream( new ImgProdLockBytes( &rStm, sal_False ) );
...@@ -297,7 +288,6 @@ void ImageProducer::setImage( ::com::sun::star::uno::Reference< ::com::sun::star ...@@ -297,7 +288,6 @@ void ImageProducer::setImage( ::com::sun::star::uno::Reference< ::com::sun::star
maURL = ::rtl::OUString(); maURL = ::rtl::OUString();
mpGraphic->Clear(); mpGraphic->Clear();
mbConsInit = sal_False; mbConsInit = sal_False;
mbAsync = sal_False;
delete mpStm; delete mpStm;
if( rInputStmRef.is() ) if( rInputStmRef.is() )
...@@ -318,9 +308,7 @@ void ImageProducer::NewDataAvailable() ...@@ -318,9 +308,7 @@ void ImageProducer::NewDataAvailable()
void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeException) void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeException)
{ {
ResetLastError(); if( maConsList.Count() || maDoneHdl.IsSet() )
if( maConsList.Count() )
{ {
bool bNotifyEmptyGraphics = false; bool bNotifyEmptyGraphics = false;
...@@ -331,8 +319,8 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept ...@@ -331,8 +319,8 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept
// graphic is cleared if a new Stream is set // graphic is cleared if a new Stream is set
if( ( mpGraphic->GetType() == GRAPHIC_NONE ) || mpGraphic->GetContext() ) if( ( mpGraphic->GetType() == GRAPHIC_NONE ) || mpGraphic->GetContext() )
{ {
if( !ImplImportGraphic( *mpGraphic ) && maErrorHdl.IsSet() ) if ( ImplImportGraphic( *mpGraphic ) && maDoneHdl.IsSet() )
maErrorHdl.Call( this ); maDoneHdl.Call( mpGraphic );
} }
if( mpGraphic->GetType() != GRAPHIC_NONE ) if( mpGraphic->GetType() != GRAPHIC_NONE )
...@@ -371,33 +359,16 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept ...@@ -371,33 +359,16 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept
sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic ) sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic )
{ {
USHORT nFilter = GRFILTER_FORMAT_DONTKNOW;
short nRet;
sal_Bool bRet = sal_False;
if( ERRCODE_IO_PENDING == mpStm->GetError() ) if( ERRCODE_IO_PENDING == mpStm->GetError() )
mpStm->ResetError(); mpStm->ResetError();
mpStm->Seek( 0UL ); mpStm->Seek( 0UL );
if( mpFilter ) sal_Bool bRet = GraphicConverter::Import( *mpStm, rGraphic ) == ERRCODE_NONE;
nRet = mpFilter->ImportGraphic( rGraphic, String(), *mpStm, nFilter );
else
{
if( GraphicConverter::Import( *mpStm, rGraphic ) == ERRCODE_NONE )
nRet = GRFILTER_OK;
else
nRet = GRFILTER_FILTERERROR;
}
if( ERRCODE_IO_PENDING == mpStm->GetError() ) if( ERRCODE_IO_PENDING == mpStm->GetError() )
mpStm->ResetError(); mpStm->ResetError();
if( nRet == GRFILTER_OK )
bRet = sal_True;
else
mnLastError = nRet;
return bRet; return bRet;
} }
...@@ -405,10 +376,6 @@ sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic ) ...@@ -405,10 +376,6 @@ sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic )
void ImageProducer::ImplUpdateData( const Graphic& rGraphic ) void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
{ {
// asynchronous?
if( mpGraphic->GetContext() )
mbAsync = sal_True;
ImplInitConsumer( rGraphic ); ImplInitConsumer( rGraphic );
if( mbConsInit && maConsList.Count() ) if( mbConsInit && maConsList.Count() )
...@@ -425,7 +392,7 @@ void ImageProducer::ImplUpdateData( const Graphic& rGraphic ) ...@@ -425,7 +392,7 @@ void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
// iterate through interfaces // iterate through interfaces
for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) 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 // delete interfaces in temporary list
for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
......
...@@ -64,20 +64,9 @@ private: ...@@ -64,20 +64,9 @@ private:
List maConsList; List maConsList;
Graphic* mpGraphic; Graphic* mpGraphic;
SvStream* mpStm; SvStream* mpStm;
GraphicFilter* mpFilter;
sal_uInt32 mnTransIndex; sal_uInt32 mnTransIndex;
sal_uInt32 mnStatus;
sal_Bool mbConsInit; sal_Bool mbConsInit;
sal_Bool mbStmDel; Link maDoneHdl;
Link maErrorHdl;
sal_uInt32 mnLastError;
sal_uInt32 mnExtra2;
sal_Bool mbAsync;
sal_Bool mbExtra1;
sal_Bool mbExtra2;
sal_Bool mbExtra3;
sal_Bool ImplImportGraphic( Graphic& rGraphic ); sal_Bool ImplImportGraphic( Graphic& rGraphic );
void ImplUpdateData( const Graphic& rGraphic ); void ImplUpdateData( const Graphic& rGraphic );
...@@ -92,14 +81,11 @@ public: ...@@ -92,14 +81,11 @@ public:
void SetImage( const ::rtl::OUString& rPath ); void SetImage( const ::rtl::OUString& rPath );
void SetImage( SvStream& rStm ); 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 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::XInterface
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); ::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(); } void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment