merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / source / scanner / scanner.hxx
blob6ca0804d1c33c4e2573296ea23f3245dfdd378e7
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>
35 #endif
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>
42 #endif
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>
47 #endif
48 #include <com/sun/star/scanner/XScannerManager.hpp>
49 #include <com/sun/star/scanner/ScannerException.hpp>
51 using namespace rtl;
52 using namespace cppu;
53 using namespace com::sun::star::uno;
54 using namespace com::sun::star::scanner;
56 // -----------
57 // - Defines -
58 // -----------
60 #define REF( _def_Obj ) Reference< _def_Obj >
61 #define SEQ( _def_Obj ) Sequence< _def_Obj >
62 #define ANY Any
63 #define AWT com::sun::star::awt
65 // ------------------
66 // - ScannerManager -
67 // ------------------
69 class ScannerManager : public OWeakObject, XScannerManager, AWT::XBitmap
71 protected:
73 vos::OMutex maProtector;
74 void* mpData;
76 void DestroyData();
78 public:
80 ScannerManager();
81 virtual ~ScannerManager();
83 // XInterface
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();
88 // XScannerManager
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 );
95 // XBitmap
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();
100 // Misc
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 );
115 #endif