1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ImageControl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef RPT_IMAGECONTROL_HXX
31 #define RPT_IMAGECONTROL_HXX
33 #include <cppuhelper/propertysetmixin.hxx>
34 #include <com/sun/star/report/XImageControl.hpp>
35 #include "ReportControlModel.hxx"
36 #include <cppuhelper/compbase2.hxx>
37 #include <comphelper/broadcasthelper.hxx>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include "ReportHelperDefines.hxx"
41 namespace reportdesign
43 typedef ::cppu::PropertySetMixin
< com::sun::star::report::XImageControl
> ImageControlPropertySet
;
44 typedef ::cppu::WeakComponentImplHelper2
< com::sun::star::report::XImageControl
45 ,com::sun::star::lang::XServiceInfo
> ImageControlBase
;
47 /** \class OImageControl Defines the implementation of a \interface com:::sun::star::report::XImageControl
48 * \ingroup reportdesign_api
51 class OImageControl
: public comphelper::OBaseMutex
,
52 public ImageControlBase
,
53 public ImageControlPropertySet
55 friend class OShapeHelper
;
56 OReportControlModel m_aProps
;
57 ::rtl::OUString m_aImageURL
;
58 sal_Int16 m_nScaleMode
;
59 ::sal_Bool m_bPreserveIRI
;
61 OImageControl(const OImageControl
&);
62 OImageControl
& operator=(const OImageControl
&);
64 template <typename T
> void set( const ::rtl::OUString
& _sProperty
70 ::osl::MutexGuard
aGuard(m_aMutex
);
71 prepareSet(_sProperty
, ::com::sun::star::uno::makeAny(_member
), ::com::sun::star::uno::makeAny(_Value
), &l
);
76 void checkIndex(sal_Int32 _nIndex
);
78 virtual ~OImageControl();
80 explicit OImageControl(::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> const & _xContext
);
81 explicit OImageControl(::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> const & _xContext
82 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> & _xFactory
83 ,::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& _xShape
);
86 // ::com::sun::star::lang::XServiceInfo
87 virtual ::sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
88 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw(::com::sun::star::uno::RuntimeException
);
89 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException
);
91 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException
);
92 static ::rtl::OUString
getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException
);
93 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
94 create(::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> const & xContext
);
95 // com::sun::star::beans::XPropertySet
96 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
97 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
98 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const ::rtl::OUString
& PropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
99 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
100 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
101 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
102 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
105 REPORTCOMPONENT_HEADER()
110 virtual ::rtl::OUString SAL_CALL
getShapeType( ) throw (::com::sun::star::uno::RuntimeException
);
112 // XReportControlModel
113 REPORTCONTROLMODEL_HEADER()
115 // XReportControlFormat
116 REPORTCONTROLFORMAT_HEADER()
119 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XCloneable
> SAL_CALL
createClone( ) throw (::com::sun::star::uno::RuntimeException
);
122 virtual ::rtl::OUString SAL_CALL
getImageURL() throw (::com::sun::star::uno::RuntimeException
);
123 virtual void SAL_CALL
setImageURL( const ::rtl::OUString
& _imageurl
) throw (::com::sun::star::uno::RuntimeException
);
124 virtual ::sal_Bool SAL_CALL
getPreserveIRI() throw (::com::sun::star::uno::RuntimeException
);
125 virtual void SAL_CALL
setPreserveIRI( ::sal_Bool _preserveiri
) throw (::com::sun::star::uno::RuntimeException
);
126 virtual ::sal_Int16 SAL_CALL
getScaleMode() throw (::com::sun::star::uno::RuntimeException
);
127 virtual void SAL_CALL
setScaleMode( ::sal_Int16 _scalemode
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
129 // XImageProducerSupplier
130 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XImageProducer
> SAL_CALL
getImageProducer( ) throw (::com::sun::star::uno::RuntimeException
);
133 virtual void SAL_CALL
dispose() throw(::com::sun::star::uno::RuntimeException
);
134 virtual void SAL_CALL
addEventListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & aListener
) throw(::com::sun::star::uno::RuntimeException
)
136 cppu::WeakComponentImplHelperBase::addEventListener(aListener
);
138 virtual void SAL_CALL
removeEventListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & aListener
) throw(::com::sun::star::uno::RuntimeException
)
140 cppu::WeakComponentImplHelperBase::removeEventListener(aListener
);
144 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
getParent( ) throw (::com::sun::star::uno::RuntimeException
);
145 virtual void SAL_CALL
setParent( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& Parent
) throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
147 virtual void SAL_CALL
addContainerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XContainerListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
148 virtual void SAL_CALL
removeContainerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XContainerListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
151 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw (::com::sun::star::uno::RuntimeException
);
152 virtual ::sal_Bool SAL_CALL
hasElements( ) throw (::com::sun::star::uno::RuntimeException
);
155 virtual void SAL_CALL
replaceByIndex( ::sal_Int32 Index
, const ::com::sun::star::uno::Any
& Element
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
158 virtual void SAL_CALL
insertByIndex( ::sal_Int32 Index
, const ::com::sun::star::uno::Any
& Element
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
159 virtual void SAL_CALL
removeByIndex( ::sal_Int32 Index
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
162 virtual ::sal_Int32 SAL_CALL
getCount( ) throw (::com::sun::star::uno::RuntimeException
);
163 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( ::sal_Int32 Index
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
166 #endif //RPT_IMAGECONTROL_HXX