summaryrefslogtreecommitdiff
path: root/extensions/source/scanner/scanunx.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2004-02-02 18:34:49 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2004-02-02 18:34:49 +0000
commit419bf3e0eb3d1067e9f7428b9c4f777996a56c0b (patch)
tree4b762e1a90d5d854b78401169b1e34a064f8931f /extensions/source/scanner/scanunx.cxx
parent1670a29afb60d05336288b4e426e2a184004b13a (diff)
INTEGRATION: CWS geordi2q14 (1.5.132); FILE MERGED
2004/01/28 15:41:14 hr 1.5.132.1: #111934#: merge CWS vcl7pp1r3
Diffstat (limited to 'extensions/source/scanner/scanunx.cxx')
-rw-r--r--extensions/source/scanner/scanunx.cxx32
1 files changed, 28 insertions, 4 deletions
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
index 88339759e..918f8044b 100644
--- a/extensions/source/scanner/scanunx.cxx
+++ b/extensions/source/scanner/scanunx.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: scanunx.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: vg $ $Date: 2003-04-15 16:19:13 $
+ * last change: $Author: hr $ $Date: 2004-02-02 19:34:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -143,6 +143,7 @@ struct SaneHolder
REF( AWT::XBitmap ) m_xBitmap;
vos::OMutex m_aProtector;
ScanError m_nError;
+ bool m_bBusy;
};
DECLARE_LIST( SaneHolderList, SaneHolder* );
@@ -198,6 +199,7 @@ void ScannerThread::run()
m_pHolder->m_xBitmap = REF( AWT::XBitmap )( aIf, UNO_QUERY );
+ m_pHolder->m_bBusy = true;
if( m_pHolder->m_aSane.IsOpen() )
{
int nOption = m_pHolder->m_aSane.GetOptionByName( "preview" );
@@ -214,6 +216,7 @@ void ScannerThread::run()
REF( XInterface ) xXInterface( static_cast< OWeakObject* >( m_pManager ) );
m_xListener->disposing( com::sun::star::lang::EventObject(xXInterface) );
+ m_pHolder->m_bBusy = false;
}
// ------------------
@@ -251,6 +254,7 @@ SEQ( ScannerContext ) ScannerManager::getAvailableScanners() throw()
{
SaneHolder* pSaneHolder = new SaneHolder;
pSaneHolder->m_nError = ScanError_ScanErrorNone;
+ pSaneHolder->m_bBusy = false;
if( Sane::IsSane() )
allSanes.Insert( pSaneHolder );
else
@@ -284,8 +288,21 @@ BOOL ScannerManager::configureScanner( ScannerContext& scanner_context ) throw(
REF( XScannerManager )( this ),
ScanError_InvalidContext
);
- SaneDlg aDlg( NULL, allSanes.GetObject( scanner_context.InternalData )->m_aSane );
- return (BOOL)aDlg.Execute();
+
+ SaneHolder* pHolder = allSanes.GetObject( scanner_context.InternalData );
+ if( pHolder->m_bBusy )
+ throw ScannerException(
+ ::rtl::OUString::createFromAscii( "Scanner is busy" ),
+ REF( XScannerManager )( this ),
+ ScanError_ScanInProgress
+ );
+
+ pHolder->m_bBusy = true;
+ SaneDlg aDlg( NULL, pHolder->m_aSane );
+ BOOL bRet = (BOOL)aDlg.Execute();
+ pHolder->m_bBusy = false;
+
+ return bRet;
}
// -----------------------------------------------------------------------------
@@ -306,6 +323,13 @@ void ScannerManager::startScan( const ScannerContext& scanner_context,
ScanError_InvalidContext
);
SaneHolder* pHolder = allSanes.GetObject( scanner_context.InternalData );
+ if( pHolder->m_bBusy )
+ throw ScannerException(
+ ::rtl::OUString::createFromAscii( "Scanner is busy" ),
+ REF( XScannerManager )( this ),
+ ScanError_ScanInProgress
+ );
+ pHolder->m_bBusy = true;
ScannerThread* pThread = new ScannerThread( pHolder, listener, this );
pThread->create();