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