Avoid potential negative array index access to cached text.
[LibreOffice.git] / extensions / source / scanner / scanner.cxx
blobb661a4f7e254ac96996541f2ef508f7ae8f798cd
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 #include "scanner.hxx"
22 #include <cppuhelper/supportsservice.hxx>
23 #include <comphelper/namedvaluecollection.hxx>
24 #include <com/sun/star/uno/XComponentContext.hpp>
26 Reference< XInterface > ScannerManager_CreateInstance( const Reference< css::lang::XMultiServiceFactory >& /*rxFactory*/ )
28 return *( new ScannerManager() );
32 ScannerManager::ScannerManager() :
33 mpData( nullptr )
35 AcquireData();
39 ScannerManager::~ScannerManager()
41 ReleaseData();
45 Sequence< sal_Int8 > SAL_CALL ScannerManager::getMaskDIB()
47 return Sequence< sal_Int8 >();
51 OUString ScannerManager::getImplementationName()
53 return "com.sun.star.scanner.ScannerManager";
57 sal_Bool ScannerManager::supportsService(OUString const & ServiceName)
59 return cppu::supportsService(this, ServiceName);
63 css::uno::Sequence<OUString> ScannerManager::getSupportedServiceNames()
65 return { "com.sun.star.scanner.ScannerManager" };
69 sal_Bool SAL_CALL ScannerManager::configureScanner( ScannerContext& rContext )
71 return configureScannerAndScan( rContext, nullptr );
74 void SAL_CALL ScannerManager::initialize(const css::uno::Sequence<css::uno::Any>& rArguments)
76 ::comphelper::NamedValueCollection aProperties(rArguments);
77 if (aProperties.has("ParentWindow"))
78 aProperties.get("ParentWindow") >>= mxDialogParent;
81 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
82 extensions_ScannerManager_get_implementation(
83 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
85 return cppu::acquire(new ScannerManager());
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */