LibreOffice Module extensions (master) 1
scanner.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <osl/mutex.hxx>
23#include <rtl/ustring.hxx>
25#include <com/sun/star/uno/Reference.h>
26#include <com/sun/star/uno/Sequence.h>
27#include <com/sun/star/awt/XBitmap.hpp>
28#include <com/sun/star/awt/XWindow.hpp>
29#include <com/sun/star/lang/XInitialization.hpp>
30#include <com/sun/star/lang/XMultiServiceFactory.hpp>
31#include <com/sun/star/lang/XEventListener.hpp>
32#include <com/sun/star/lang/XServiceInfo.hpp>
33#include <com/sun/star/scanner/XScannerManager2.hpp>
34
35using namespace cppu;
36using namespace com::sun::star::uno;
37using namespace com::sun::star::scanner;
38
39class ScannerManager final :
40 public cppu::WeakImplHelper<
41 XScannerManager2, css::awt::XBitmap, css::lang::XServiceInfo, css::lang::XInitialization>
42{
43 osl::Mutex maProtector;
44 css::uno::Reference<css::awt::XWindow> mxDialogParent;
45 void* mpData;
46
47 static void AcquireData();
48 void ReleaseData();
49
50public:
51
53 virtual ~ScannerManager() override;
54
55 // XScannerManager
56 virtual Sequence< ScannerContext > SAL_CALL getAvailableScanners() override;
57 virtual sal_Bool SAL_CALL configureScanner( ScannerContext& scanner_context ) override;
58 virtual sal_Bool SAL_CALL configureScannerAndScan( ScannerContext& scanner_context, const Reference< css::lang::XEventListener >& rxListener ) override;
59 virtual void SAL_CALL startScan( const ScannerContext& scanner_context, const Reference< css::lang::XEventListener >& rxListener ) override;
60 virtual ScanError SAL_CALL getError( const ScannerContext& scanner_context ) override;
61 virtual Reference< css::awt::XBitmap > SAL_CALL getBitmap( const ScannerContext& scanner_context ) override;
62
63 // XBitmap
64 virtual css::awt::Size SAL_CALL getSize() override;
65 virtual Sequence< sal_Int8 > SAL_CALL getDIB() override;
66 virtual Sequence< sal_Int8 > SAL_CALL getMaskDIB() override;
67
68 OUString SAL_CALL getImplementationName() override;
69
70 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
71
72 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
73
74 virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
75
76#ifdef _WIN32
77 void* GetData() const { return mpData; }
78#endif
79 void SetData( void* pData ) { ReleaseData(); mpData = pData; }
80 };
81
84
85/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
Definition: scanner.cxx:74
virtual Sequence< sal_Int8 > SAL_CALL getDIB() override
Definition: scanunx.cxx:208
virtual Sequence< sal_Int8 > SAL_CALL getMaskDIB() override
Definition: scanner.cxx:45
void SetData(void *pData)
Definition: scanner.hxx:79
osl::Mutex maProtector
Definition: scanner.hxx:43
void * mpData
Definition: scanner.hxx:45
sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
Definition: scanner.cxx:57
virtual css::awt::Size SAL_CALL getSize() override
Definition: scanunx.cxx:200
virtual Sequence< ScannerContext > SAL_CALL getAvailableScanners() override
Definition: scanunx.cxx:214
static void AcquireData()
Definition: scanunx.cxx:186
virtual ~ScannerManager() override
Definition: scanner.cxx:39
virtual ScanError SAL_CALL getError(const ScannerContext &scanner_context) override
Definition: scanunx.cxx:303
css::uno::Reference< css::awt::XWindow > mxDialogParent
Definition: scanner.hxx:44
void ReleaseData()
Definition: scanunx.cxx:193
virtual void SAL_CALL startScan(const ScannerContext &scanner_context, const Reference< css::lang::XEventListener > &rxListener) override
Definition: scanunx.cxx:275
virtual sal_Bool SAL_CALL configureScanner(ScannerContext &scanner_context) override
Definition: scanner.cxx:69
virtual Reference< css::awt::XBitmap > SAL_CALL getBitmap(const ScannerContext &scanner_context) override
Definition: scanunx.cxx:321
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: scanner.cxx:63
virtual sal_Bool SAL_CALL configureScannerAndScan(ScannerContext &scanner_context, const Reference< css::lang::XEventListener > &rxListener) override
Definition: scanunx.cxx:236
OUString SAL_CALL getImplementationName() override
Definition: scanner.cxx:51
std::unique_ptr< sal_Int32[]> pData
Reference< XInterface > ScannerManager_CreateInstance(const Reference< css::lang::XMultiServiceFactory > &rxFactory)
Definition: scanner.cxx:26
unsigned char sal_Bool