update credits
[LibreOffice.git] / extensions / source / scanner / scanner.hxx
blob85f1163395914613e31095424cf249403779288d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _EXT_SCANNER_HXX
21 #define _EXT_SCANNER_HXX
23 #include <tools/stream.hxx>
24 #include <osl/mutex.hxx>
25 #include <rtl/ustring.hxx>
26 #include <cppuhelper/weak.hxx>
27 #include <com/sun/star/uno/Reference.h>
28 #include <com/sun/star/uno/Sequence.h>
29 #include <com/sun/star/awt/XBitmap.hpp>
30 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 #include <com/sun/star/lang/XEventListener.hpp>
32 #include <com/sun/star/lang/EventObject.hpp>
33 #include <com/sun/star/scanner/XScannerManager2.hpp>
34 #include <com/sun/star/scanner/ScannerException.hpp>
36 using namespace cppu;
37 using namespace com::sun::star::uno;
38 using namespace com::sun::star::scanner;
40 class ScannerManager : public OWeakObject, XScannerManager2, css::awt::XBitmap
42 protected:
44 osl::Mutex maProtector;
45 void* mpData;
47 void AcquireData();
48 void ReleaseData();
50 public:
52 ScannerManager();
53 virtual ~ScannerManager();
55 // XInterface
56 virtual Any SAL_CALL queryInterface( const Type & rType ) throw( RuntimeException );
57 virtual void SAL_CALL acquire() throw();
58 virtual void SAL_CALL release() throw();
60 // XScannerManager
61 virtual Sequence< ScannerContext > SAL_CALL getAvailableScanners() throw();
62 virtual sal_Bool SAL_CALL configureScanner( ScannerContext& scanner_context ) throw( ScannerException );
63 virtual sal_Bool SAL_CALL configureScannerAndScan( ScannerContext& scanner_context, const Reference< com::sun::star::lang::XEventListener >& rxListener ) throw( ScannerException );
64 virtual void SAL_CALL startScan( const ScannerContext& scanner_context, const Reference< com::sun::star::lang::XEventListener >& rxListener ) throw( ScannerException );
65 virtual ScanError SAL_CALL getError( const ScannerContext& scanner_context ) throw( ScannerException );
66 virtual Reference< css::awt::XBitmap > SAL_CALL getBitmap( const ScannerContext& scanner_context ) throw( ScannerException );
68 // XBitmap
69 virtual css::awt::Size SAL_CALL getSize() throw();
70 virtual Sequence< sal_Int8 > SAL_CALL getDIB() throw();
71 virtual Sequence< sal_Int8 > SAL_CALL getMaskDIB() throw();
73 // Misc
74 static OUString getImplementationName_Static() throw();
75 static Sequence< OUString > getSupportedServiceNames_Static() throw();
77 void Lock() { maProtector.acquire(); }
78 void Unlock() { maProtector.release(); }
80 void* GetData() const { return mpData; }
81 void SetData( void* pData ) { ReleaseData(); mpData = pData; }
84 Reference< XInterface > SAL_CALL ScannerManager_CreateInstance( const Reference< com::sun::star::lang::XMultiServiceFactory >& rxFactory ) throw( Exception );
86 #endif
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */