00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _EXT_SCANNER_HXX
00037 #define _EXT_SCANNER_HXX
00038
00039 #ifndef _STREAM_HXX
00040 #include <tools/stream.hxx>
00041 #endif
00042 #ifndef _VOS_MUTEX_HXX_
00043 #include <vos/mutex.hxx>
00044 #endif
00045 #ifndef __RTL_USTRING_HXX_
00046 #include <rtl/ustring.hxx>
00047 #endif
00048 #ifndef _CPPUHELPER_WEAK_HXX_
00049 #include <cppuhelper/weak.hxx>
00050 #endif
00051 #ifndef _CPPUHELPER_WEAK_HXX_
00052 #include <cppuhelper/weak.hxx>
00053 #endif
00054 #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
00055 #include <com/sun/star/uno/Reference.h>
00056 #endif
00057 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
00058 #include <com/sun/star/uno/Sequence.h>
00059 #endif
00060 #ifndef __COM_SUN_STAR_AWT_XBITMAP_HPP
00061 #include <com/sun/star/awt/XBitmap.hpp>
00062 #endif
00063 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
00064 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
00065 #endif
00066 #ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
00067 #include <com/sun/star/lang/XEventListener.hpp>
00068 #endif
00069 #ifndef __COM_SUN_STAR_LANG_EVENTOBJECT_HPP
00070 #include <com/sun/star/lang/EventObject.hpp>
00071 #endif
00072 #ifndef _COM_SUN_STAR_SCANNER_XSCANNERMANAGER_HPP_
00073 #include <com/sun/star/scanner/XScannerManager.hpp>
00074 #endif
00075 #ifndef _COM_SUN_STAR_SCANNER_SCANNEREXCEPTION_HPP_
00076 #include <com/sun/star/scanner/ScannerException.hpp>
00077 #endif
00078
00079 using namespace rtl;
00080 using namespace cppu;
00081 using namespace com::sun::star::uno;
00082 using namespace com::sun::star::scanner;
00083
00084
00085
00086
00087
00088 #define REF( _def_Obj ) Reference< _def_Obj >
00089 #define SEQ( _def_Obj ) Sequence< _def_Obj >
00090 #define ANY Any
00091 #define AWT com::sun::star::awt
00092
00093
00094
00095
00096
00097 class ScannerManager : public OWeakObject, XScannerManager, AWT::XBitmap
00098 {
00099 protected:
00100
00101 vos::OMutex maProtector;
00102 void* mpData;
00103
00104 void DestroyData();
00105
00106 public:
00107
00108 ScannerManager();
00109 virtual ~ScannerManager();
00110
00111
00112 virtual ANY SAL_CALL queryInterface( const Type & rType ) throw( RuntimeException );
00113 virtual void SAL_CALL acquire() throw();
00114 virtual void SAL_CALL release() throw();
00115
00116
00117 virtual SEQ( ScannerContext ) SAL_CALL getAvailableScanners() throw();
00118 virtual BOOL SAL_CALL configureScanner( ScannerContext& scanner_context ) throw( ScannerException );
00119 virtual void SAL_CALL startScan( const ScannerContext& scanner_context, const REF( com::sun::star::lang::XEventListener )& rxListener ) throw( ScannerException );
00120 virtual ScanError SAL_CALL getError( const ScannerContext& scanner_context ) throw( ScannerException );
00121 virtual REF( AWT::XBitmap ) SAL_CALL getBitmap( const ScannerContext& scanner_context ) throw( ScannerException );
00122
00123
00124 virtual AWT::Size SAL_CALL getSize() throw();
00125 virtual SEQ( sal_Int8 ) SAL_CALL getDIB() throw();
00126 virtual SEQ( sal_Int8 ) SAL_CALL getMaskDIB() throw();
00127
00128
00129 OUString getImplementationName() throw();
00130 static OUString getImplementationName_Static() throw();
00131 Sequence< OUString > getSupportedServiceNames() throw();
00132 static Sequence< OUString > getSupportedServiceNames_Static() throw();
00133 BOOL supportsService( const OUString& ServiceName ) throw();
00134
00135 void Lock() { maProtector.acquire(); }
00136 void Unlock() { maProtector.release(); }
00137
00138 void* GetData() const { return mpData; }
00139 void SetData( void* pData ) { DestroyData(); mpData = pData; }
00140 };
00141
00142
00143
00144 REF( XInterface ) SAL_CALL ScannerManager_CreateInstance( const REF( com::sun::star::lang::XMultiServiceFactory )& rxFactory ) throw( Exception );
00145
00146 #endif