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