1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scanner.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _EXT_SCANNER_HXX
32 #define _EXT_SCANNER_HXX
34 #include <tools/stream.hxx>
35 #include <vos/mutex.hxx>
36 #ifndef __RTL_USTRING_HXX_
37 #include <rtl/ustring.hxx>
39 #include <cppuhelper/weak.hxx>
40 #include <cppuhelper/weak.hxx>
41 #include <com/sun/star/uno/Reference.h>
42 #include <com/sun/star/uno/Sequence.h>
43 #ifndef __COM_SUN_STAR_AWT_XBITMAP_HPP
44 #include <com/sun/star/awt/XBitmap.hpp>
46 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
47 #include <com/sun/star/lang/XEventListener.hpp>
48 #ifndef __COM_SUN_STAR_LANG_EVENTOBJECT_HPP
49 #include <com/sun/star/lang/EventObject.hpp>
51 #include <com/sun/star/scanner/XScannerManager.hpp>
52 #include <com/sun/star/scanner/ScannerException.hpp>
56 using namespace com::sun::star::uno
;
57 using namespace com::sun::star::scanner
;
63 #define REF( _def_Obj ) Reference< _def_Obj >
64 #define SEQ( _def_Obj ) Sequence< _def_Obj >
66 #define AWT com::sun::star::awt
72 class ScannerManager
: public OWeakObject
, XScannerManager
, AWT::XBitmap
76 vos::OMutex maProtector
;
84 virtual ~ScannerManager();
87 virtual ANY SAL_CALL
queryInterface( const Type
& rType
) throw( RuntimeException
);
88 virtual void SAL_CALL
acquire() throw();
89 virtual void SAL_CALL
release() throw();
92 virtual SEQ( ScannerContext
) SAL_CALL
getAvailableScanners() throw();
93 virtual BOOL SAL_CALL
configureScanner( ScannerContext
& scanner_context
) throw( ScannerException
);
94 virtual void SAL_CALL
startScan( const ScannerContext
& scanner_context
, const REF( com::sun::star::lang::XEventListener
)& rxListener
) throw( ScannerException
);
95 virtual ScanError SAL_CALL
getError( const ScannerContext
& scanner_context
) throw( ScannerException
);
96 virtual REF( AWT::XBitmap
) SAL_CALL
getBitmap( const ScannerContext
& scanner_context
) throw( ScannerException
);
99 virtual AWT::Size SAL_CALL
getSize() throw();
100 virtual SEQ( sal_Int8
) SAL_CALL
getDIB() throw();
101 virtual SEQ( sal_Int8
) SAL_CALL
getMaskDIB() throw();
104 static OUString
getImplementationName_Static() throw();
105 static Sequence
< OUString
> getSupportedServiceNames_Static() throw();
107 void Lock() { maProtector
.acquire(); }
108 void Unlock() { maProtector
.release(); }
110 void* GetData() const { return mpData
; }
111 void SetData( void* pData
) { DestroyData(); mpData
= pData
; }
114 // -----------------------------------------------------------------------------
116 REF( XInterface
) SAL_CALL
ScannerManager_CreateInstance( const REF( com::sun::star::lang::XMultiServiceFactory
)& rxFactory
) throw( Exception
);