LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / forms / source / component / imgprod.hxx
blob0e746eb6bd5d3f820e843545ecc7648a44f8cc97
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 #pragma once
22 #include <tools/link.hxx>
23 #include <com/sun/star/awt/XImageConsumer.hpp>
24 #include <com/sun/star/awt/XImageProducer.hpp>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <cppuhelper/weak.hxx>
27 #include <memory>
28 #include <vector>
31 class SvStream;
32 class Graphic;
33 namespace com::sun::star::io { class XInputStream; }
36 class ImageProducer : public css::awt::XImageProducer,
37 public css::lang::XInitialization,
38 public ::cppu::OWeakObject
40 private:
42 typedef std::vector< css::uno::Reference< css::awt::XImageConsumer > > ConsumerList_t;
44 OUString maURL;
45 ConsumerList_t maConsList;
46 std::unique_ptr<Graphic>
47 mpGraphic;
48 std::unique_ptr<SvStream>
49 mpStm;
50 sal_uInt32 mnTransIndex;
51 bool mbConsInit;
52 Link<Graphic*,void> maDoneHdl;
54 bool ImplImportGraphic( Graphic& rGraphic );
55 void ImplUpdateData( const Graphic& rGraphic );
56 void ImplInitConsumer( const Graphic& rGraphic );
57 void ImplUpdateConsumer( const Graphic& rGraphic );
59 public:
61 ImageProducer();
62 virtual ~ImageProducer() override;
64 void SetImage( const OUString& rPath );
65 void SetImage( SvStream& rStm );
67 void NewDataAvailable();
69 void SetDoneHdl( const Link<Graphic*,void>& i_rHdl ) { maDoneHdl = i_rHdl; }
71 // css::uno::XInterface
72 css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
73 void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
74 void SAL_CALL release() noexcept override { OWeakObject::release(); }
76 // MT: ???
77 void setImage( css::uno::Reference< css::io::XInputStream > const & rStmRef );
79 // css::awt::XImageProducer
80 void SAL_CALL addConsumer( const css::uno::Reference< css::awt::XImageConsumer >& rxConsumer ) override;
81 void SAL_CALL removeConsumer( const css::uno::Reference< css::awt::XImageConsumer >& rxConsumer ) override;
82 void SAL_CALL startProduction( ) override;
84 // css::lang::XInitialization
85 void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */