xref: /aoo41x/main/forms/source/component/imgprod.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _PRODUCE_HXX
29 #define _PRODUCE_HXX
30 
31 #include <tools/link.hxx>
32 #include <tools/string.hxx>
33 #include <tools/list.hxx>
34 #include <com/sun/star/awt/ImageStatus.hpp>
35 #include <com/sun/star/awt/XImageConsumer.hpp>
36 #include <com/sun/star/awt/XImageProducer.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 #include <cppuhelper/weak.hxx>
39 
40 
41 // -----------------
42 // - ImageProducer -
43 // -----------------
44 
45 
46 
47 class SvStream;
48 class ImageConsumer;
49 class Graphic;
50 class GraphicFilter;
51 
52 namespace com { namespace sun { namespace star { namespace io {
53 	class XInputStream;
54 }}}}
55 
56 
57 class ImageProducer :	public ::com::sun::star::awt::XImageProducer,
58 						public ::com::sun::star::lang::XInitialization,
59 						public ::cppu::OWeakObject
60 {
61 private:
62 
63 	::rtl::OUString	maURL;
64 	List			maConsList;
65 	Graphic*		mpGraphic;
66 	SvStream*		mpStm;
67 	sal_uInt32		mnTransIndex;
68 	sal_Bool		mbConsInit;
69     Link            maDoneHdl;
70 
71 	sal_Bool		ImplImportGraphic( Graphic& rGraphic );
72 	void			ImplUpdateData( const Graphic& rGraphic );
73 	void			ImplInitConsumer( const Graphic& rGraphic );
74 	void			ImplUpdateConsumer( const Graphic& rGraphic );
75 
76 public:
77 
78 					ImageProducer();
79 					~ImageProducer();
80 
81 	void			SetImage( const ::rtl::OUString& rPath );
82 	void			SetImage( SvStream& rStm );
83 
84 	void			NewDataAvailable();
85 
86     void            SetDoneHdl( const Link& i_rHdl ) { maDoneHdl = i_rHdl; }
87     const Link&     GetDoneHdl() const { return maDoneHdl; }
88 
89 	// ::com::sun::star::uno::XInterface
90     ::com::sun::star::uno::Any					SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
91 	void										SAL_CALL acquire() throw()	{ OWeakObject::acquire(); }
92 	void										SAL_CALL release() throw()	{ OWeakObject::release(); }
93 
94 	// MT: ???
95 	void			setImage( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > & rStmRef );
96 
97 	// ::com::sun::star::awt::XImageProducer
98     void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException);
99     void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException);
100     void SAL_CALL startProduction(  ) throw(::com::sun::star::uno::RuntimeException);
101 
102     // ::com::sun::star::lang::XInitialization
103 	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);
104 
105 };
106 
107 #endif // _PRODUCE_HXX
108