1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_FORMS_SOURCE_COMPONENT_IMGPROD_HXX
21 #define INCLUDED_FORMS_SOURCE_COMPONENT_IMGPROD_HXX
23 #include <boost/ptr_container/ptr_vector.hpp>
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>
42 namespace com
{ namespace sun
{ namespace star
{ namespace io
{
47 class ImageProducer
: public ::com::sun::star::awt::XImageProducer
,
48 public ::com::sun::star::lang::XInitialization
,
49 public ::cppu::OWeakObject
53 typedef boost::ptr_vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XImageConsumer
> > ConsumerList_t
;
56 ConsumerList_t maConsList
;
59 sal_uInt32 mnTransIndex
;
63 bool ImplImportGraphic( Graphic
& rGraphic
);
64 void ImplUpdateData( const Graphic
& rGraphic
);
65 void ImplInitConsumer( const Graphic
& rGraphic
);
66 void ImplUpdateConsumer( const Graphic
& rGraphic
);
71 virtual ~ImageProducer();
73 void SetImage( const OUString
& rPath
);
74 void SetImage( SvStream
& rStm
);
76 void NewDataAvailable();
78 void SetDoneHdl( const Link
<>& i_rHdl
) { maDoneHdl
= i_rHdl
; }
79 const Link
<>& GetDoneHdl() const { return maDoneHdl
; }
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
, std::exception
) SAL_OVERRIDE
;
83 void SAL_CALL
acquire() throw() SAL_OVERRIDE
{ OWeakObject::acquire(); }
84 void SAL_CALL
release() throw() SAL_OVERRIDE
{ OWeakObject::release(); }
87 void setImage( ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> & rStmRef
);
89 // ::com::sun::star::awt::XImageProducer
90 void SAL_CALL
addConsumer( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XImageConsumer
>& rxConsumer
)
91 throw(::com::sun::star::uno::RuntimeException
,
92 std::exception
) SAL_OVERRIDE
;
93 void SAL_CALL
removeConsumer( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XImageConsumer
>& rxConsumer
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 void SAL_CALL
startProduction( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 // ::com::sun::star::lang::XInitialization
97 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
, std::exception
) SAL_OVERRIDE
;
101 #endif // INCLUDED_FORMS_SOURCE_COMPONENT_IMGPROD_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */