1*46dbaceeSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*46dbaceeSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*46dbaceeSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*46dbaceeSAndrew Rist  * distributed with this work for additional information
6*46dbaceeSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*46dbaceeSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*46dbaceeSAndrew Rist  * "License"); you may not use this file except in compliance
9*46dbaceeSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*46dbaceeSAndrew Rist  *
11*46dbaceeSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*46dbaceeSAndrew Rist  *
13*46dbaceeSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*46dbaceeSAndrew Rist  * software distributed under the License is distributed on an
15*46dbaceeSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*46dbaceeSAndrew Rist  * KIND, either express or implied.  See the License for the
17*46dbaceeSAndrew Rist  * specific language governing permissions and limitations
18*46dbaceeSAndrew Rist  * under the License.
19*46dbaceeSAndrew Rist  *
20*46dbaceeSAndrew Rist  *************************************************************/
21*46dbaceeSAndrew Rist 
22*46dbaceeSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _EXT_SCANNER_HXX
25cdf0e10cSrcweir #define _EXT_SCANNER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/stream.hxx>
28cdf0e10cSrcweir #include <vos/mutex.hxx>
29cdf0e10cSrcweir #ifndef __RTL_USTRING_HXX_
30cdf0e10cSrcweir #include <rtl/ustring.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
33cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
34cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
35cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
36cdf0e10cSrcweir #ifndef __COM_SUN_STAR_AWT_XBITMAP_HPP
37cdf0e10cSrcweir #include <com/sun/star/awt/XBitmap.hpp>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
41cdf0e10cSrcweir #ifndef __COM_SUN_STAR_LANG_EVENTOBJECT_HPP
42cdf0e10cSrcweir #include <com/sun/star/lang/EventObject.hpp>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #include <com/sun/star/scanner/XScannerManager.hpp>
45cdf0e10cSrcweir #include <com/sun/star/scanner/ScannerException.hpp>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir using namespace rtl;
48cdf0e10cSrcweir using namespace cppu;
49cdf0e10cSrcweir using namespace com::sun::star::uno;
50cdf0e10cSrcweir using namespace com::sun::star::scanner;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir // -----------
53cdf0e10cSrcweir // - Defines -
54cdf0e10cSrcweir // -----------
55cdf0e10cSrcweir 
56cdf0e10cSrcweir #define REF( _def_Obj )						Reference< _def_Obj >
57cdf0e10cSrcweir #define SEQ( _def_Obj )						Sequence< _def_Obj >
58cdf0e10cSrcweir #define ANY									Any
59cdf0e10cSrcweir #define	AWT									com::sun::star::awt
60cdf0e10cSrcweir 
61cdf0e10cSrcweir // ------------------
62cdf0e10cSrcweir // - ScannerManager -
63cdf0e10cSrcweir // ------------------
64cdf0e10cSrcweir 
65cdf0e10cSrcweir class ScannerManager : public OWeakObject, XScannerManager, AWT::XBitmap
66cdf0e10cSrcweir {
67cdf0e10cSrcweir protected:
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	vos::OMutex								maProtector;
70cdf0e10cSrcweir 	void*									mpData;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	void									AcquireData();
73cdf0e10cSrcweir 	void									ReleaseData();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir public:
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 											ScannerManager();
78cdf0e10cSrcweir 	virtual									~ScannerManager();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	// XInterface
81cdf0e10cSrcweir 	virtual ANY SAL_CALL					queryInterface( const Type & rType ) throw( RuntimeException );
82cdf0e10cSrcweir     virtual void SAL_CALL					acquire() throw();
83cdf0e10cSrcweir     virtual void SAL_CALL					release() throw();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	// XScannerManager
86cdf0e10cSrcweir 	virtual SEQ( ScannerContext ) SAL_CALL	getAvailableScanners() throw();
87cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL					configureScanner( ScannerContext& scanner_context ) throw( ScannerException );
88cdf0e10cSrcweir 	virtual void SAL_CALL					startScan( const ScannerContext& scanner_context, const REF( com::sun::star::lang::XEventListener )& rxListener ) throw( ScannerException );
89cdf0e10cSrcweir 	virtual ScanError SAL_CALL				getError( const ScannerContext& scanner_context ) throw( ScannerException );
90cdf0e10cSrcweir 	virtual REF( AWT::XBitmap ) SAL_CALL	getBitmap( const ScannerContext& scanner_context ) throw( ScannerException );
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	// XBitmap
93cdf0e10cSrcweir 	virtual AWT::Size SAL_CALL				getSize() throw();
94cdf0e10cSrcweir 	virtual SEQ( sal_Int8 ) SAL_CALL		getDIB() throw();
95cdf0e10cSrcweir 	virtual SEQ( sal_Int8 ) SAL_CALL		getMaskDIB() throw();
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	// Misc
98cdf0e10cSrcweir 	static OUString 						getImplementationName_Static() throw();
99cdf0e10cSrcweir     static Sequence< OUString > 			getSupportedServiceNames_Static() throw();
100cdf0e10cSrcweir 
Lock()101cdf0e10cSrcweir 	void									Lock() { maProtector.acquire(); }
Unlock()102cdf0e10cSrcweir 	void									Unlock() { maProtector.release(); }
103cdf0e10cSrcweir 
GetData() const104cdf0e10cSrcweir 	void*									GetData() const { return mpData; }
SetData(void * pData)105cdf0e10cSrcweir 	void									SetData( void* pData ) { ReleaseData(); mpData = pData; }
106cdf0e10cSrcweir };
107cdf0e10cSrcweir 
108cdf0e10cSrcweir // -----------------------------------------------------------------------------
109cdf0e10cSrcweir 
110cdf0e10cSrcweir REF( XInterface ) SAL_CALL ScannerManager_CreateInstance( const REF( com::sun::star::lang::XMultiServiceFactory )& rxFactory ) throw( Exception );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir #endif
113