1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _PRODUCE_HXX 25 #define _PRODUCE_HXX 26 27 #include <tools/link.hxx> 28 #include <tools/string.hxx> 29 #include <tools/list.hxx> 30 #include <com/sun/star/awt/ImageStatus.hpp> 31 #include <com/sun/star/awt/XImageConsumer.hpp> 32 #include <com/sun/star/awt/XImageProducer.hpp> 33 #include <com/sun/star/lang/XInitialization.hpp> 34 #include <cppuhelper/weak.hxx> 35 36 37 // ----------------- 38 // - ImageProducer - 39 // ----------------- 40 41 42 43 class SvStream; 44 class ImageConsumer; 45 class Graphic; 46 class GraphicFilter; 47 48 namespace com { namespace sun { namespace star { namespace io { 49 class XInputStream; 50 }}}} 51 52 53 class ImageProducer : public ::com::sun::star::awt::XImageProducer, 54 public ::com::sun::star::lang::XInitialization, 55 public ::cppu::OWeakObject 56 { 57 private: 58 59 ::rtl::OUString maURL; 60 List maConsList; 61 Graphic* mpGraphic; 62 SvStream* mpStm; 63 sal_uInt32 mnTransIndex; 64 sal_Bool mbConsInit; 65 Link maDoneHdl; 66 67 sal_Bool ImplImportGraphic( Graphic& rGraphic ); 68 void ImplUpdateData( const Graphic& rGraphic ); 69 void ImplInitConsumer( const Graphic& rGraphic ); 70 void ImplUpdateConsumer( const Graphic& rGraphic ); 71 72 public: 73 74 ImageProducer(); 75 ~ImageProducer(); 76 77 void SetImage( const ::rtl::OUString& rPath ); 78 void SetImage( SvStream& rStm ); 79 80 void NewDataAvailable(); 81 SetDoneHdl(const Link & i_rHdl)82 void SetDoneHdl( const Link& i_rHdl ) { maDoneHdl = i_rHdl; } GetDoneHdl() const83 const Link& GetDoneHdl() const { return maDoneHdl; } 84 85 // ::com::sun::star::uno::XInterface 86 ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); acquire()87 void SAL_CALL acquire() throw() { OWeakObject::acquire(); } release()88 void SAL_CALL release() throw() { OWeakObject::release(); } 89 90 // MT: ??? 91 void setImage( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > & rStmRef ); 92 93 // ::com::sun::star::awt::XImageProducer 94 void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException); 95 void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException); 96 void SAL_CALL startProduction( ) throw(::com::sun::star::uno::RuntimeException); 97 98 // ::com::sun::star::lang::XInitialization 99 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); 100 101 }; 102 103 #endif // _PRODUCE_HXX 104