Line data Source code
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 : #ifndef _PRODUCE_HXX
21 : #define _PRODUCE_HXX
22 :
23 : #include <boost/ptr_container/ptr_vector.hpp>
24 :
25 : #include <tools/link.hxx>
26 : #include <com/sun/star/awt/ImageStatus.hpp>
27 : #include <com/sun/star/awt/XImageConsumer.hpp>
28 : #include <com/sun/star/awt/XImageProducer.hpp>
29 : #include <com/sun/star/lang/XInitialization.hpp>
30 : #include <cppuhelper/weak.hxx>
31 :
32 :
33 : // -----------------
34 : // - ImageProducer -
35 : // -----------------
36 :
37 :
38 :
39 : class SvStream;
40 : class Graphic;
41 :
42 : namespace com { namespace sun { namespace star { namespace io {
43 : class XInputStream;
44 : }}}}
45 :
46 :
47 : class ImageProducer : public ::com::sun::star::awt::XImageProducer,
48 : public ::com::sun::star::lang::XInitialization,
49 : public ::cppu::OWeakObject
50 : {
51 : private:
52 :
53 : typedef boost::ptr_vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > ConsumerList_t;
54 :
55 : ::rtl::OUString maURL;
56 : ConsumerList_t maConsList;
57 : Graphic* mpGraphic;
58 : SvStream* mpStm;
59 : sal_uInt32 mnTransIndex;
60 : sal_Bool mbConsInit;
61 : Link maDoneHdl;
62 :
63 : sal_Bool ImplImportGraphic( Graphic& rGraphic );
64 : void ImplUpdateData( const Graphic& rGraphic );
65 : void ImplInitConsumer( const Graphic& rGraphic );
66 : void ImplUpdateConsumer( const Graphic& rGraphic );
67 :
68 : public:
69 :
70 : ImageProducer();
71 : ~ImageProducer();
72 :
73 : void SetImage( const ::rtl::OUString& rPath );
74 : void SetImage( SvStream& rStm );
75 :
76 : void NewDataAvailable();
77 :
78 0 : void SetDoneHdl( const Link& i_rHdl ) { maDoneHdl = i_rHdl; }
79 : const Link& GetDoneHdl() const { return maDoneHdl; }
80 :
81 : // ::com::sun::star::uno::XInterface
82 : ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
83 3 : void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
84 3 : void SAL_CALL release() throw() { OWeakObject::release(); }
85 :
86 : // MT: ???
87 : void setImage( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > & rStmRef );
88 :
89 : // ::com::sun::star::awt::XImageProducer
90 : void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException);
91 : void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException);
92 : void SAL_CALL startProduction( ) throw(::com::sun::star::uno::RuntimeException);
93 :
94 : // ::com::sun::star::lang::XInitialization
95 : void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
96 :
97 : };
98 :
99 : #endif // _PRODUCE_HXX
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|