Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX
20 : #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX
21 :
22 : #include <cppuhelper/propertysetmixin.hxx>
23 : #include <com/sun/star/report/XImageControl.hpp>
24 : #include "ReportControlModel.hxx"
25 : #include <cppuhelper/compbase2.hxx>
26 : #include <comphelper/broadcasthelper.hxx>
27 : #include <com/sun/star/lang/XServiceInfo.hpp>
28 : #include "ReportHelperDefines.hxx"
29 :
30 : namespace reportdesign
31 : {
32 : typedef ::cppu::PropertySetMixin< com::sun::star::report::XImageControl > ImageControlPropertySet;
33 : typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XImageControl
34 : ,com::sun::star::lang::XServiceInfo > ImageControlBase;
35 :
36 : /** \class OImageControl Defines the implementation of a \interface com:::sun::star::report::XImageControl
37 : * \ingroup reportdesign_api
38 : *
39 : */
40 : class OImageControl : public comphelper::OBaseMutex,
41 : public ImageControlBase,
42 : public ImageControlPropertySet
43 : {
44 : friend class OShapeHelper;
45 : OReportControlModel m_aProps;
46 : OUString m_aImageURL;
47 : sal_Int16 m_nScaleMode;
48 : bool m_bPreserveIRI;
49 : private:
50 : OImageControl(const OImageControl&);
51 : OImageControl& operator=(const OImageControl&);
52 :
53 0 : template <typename T> void set( const OUString& _sProperty
54 : ,const T& _Value
55 : ,T& _member)
56 : {
57 0 : BoundListeners l;
58 : {
59 0 : ::osl::MutexGuard aGuard(m_aMutex);
60 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
61 0 : _member = _Value;
62 : }
63 0 : l.notify();
64 0 : }
65 0 : void set( const OUString& _sProperty
66 : ,bool _Value
67 : ,bool& _member)
68 : {
69 0 : BoundListeners l;
70 : {
71 0 : ::osl::MutexGuard aGuard(m_aMutex);
72 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
73 0 : _member = _Value;
74 : }
75 0 : l.notify();
76 0 : }
77 : void checkIndex(sal_Int32 _nIndex);
78 : protected:
79 : virtual ~OImageControl();
80 : public:
81 : explicit OImageControl(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext);
82 : explicit OImageControl(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext
83 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _xFactory
84 : ,::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _xShape);
85 :
86 : DECLARE_XINTERFACE( )
87 : // ::com::sun::star::lang::XServiceInfo
88 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
93 : static OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
94 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
95 : create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
96 : // com::sun::star::beans::XPropertySet
97 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual void SAL_CALL setPropertyValue( const 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, std::exception) SAL_OVERRIDE;
99 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 : virtual void SAL_CALL addPropertyChangeListener( const 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, std::exception) SAL_OVERRIDE;
101 : virtual void SAL_CALL removePropertyChangeListener( const 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, std::exception) SAL_OVERRIDE;
102 : virtual void SAL_CALL addVetoableChangeListener( const 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, std::exception) SAL_OVERRIDE;
103 : virtual void SAL_CALL removeVetoableChangeListener( const 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, std::exception) SAL_OVERRIDE;
104 :
105 : // XReportComponent
106 : REPORTCOMPONENT_HEADER()
107 : // XShape
108 : SHAPE_HEADER()
109 :
110 : // XShapeDescriptor
111 : virtual OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 :
113 : // XReportControlModel
114 : REPORTCONTROLMODEL_HEADER()
115 :
116 : // XReportControlFormat
117 : REPORTCONTROLFORMAT_HEADER()
118 :
119 : // XCloneable
120 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 :
122 : // XImageControl
123 : virtual OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 : virtual void SAL_CALL setImageURL( const OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 : virtual sal_Bool SAL_CALL getPreserveIRI() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 : virtual void SAL_CALL setPreserveIRI( sal_Bool _preserveiri ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 : virtual ::sal_Int16 SAL_CALL getScaleMode() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 : virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 :
130 : // XImageProducerSupplier
131 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > SAL_CALL getImageProducer( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 :
133 : // XComponent
134 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 0 : virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
136 : {
137 0 : cppu::WeakComponentImplHelperBase::addEventListener(aListener);
138 0 : }
139 0 : virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
140 : {
141 0 : cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
142 0 : }
143 :
144 : // XChild
145 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 : 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, std::exception) SAL_OVERRIDE;
147 : // XContainer
148 : virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 : virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 :
151 : // XElementAccess
152 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
153 : virtual sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
154 :
155 : // XIndexReplace
156 : 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, std::exception) SAL_OVERRIDE;
157 :
158 : // XIndexContainer
159 : 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, std::exception) SAL_OVERRIDE;
160 : virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 :
162 : // XIndexAccess
163 : virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
164 : 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, std::exception) SAL_OVERRIDE;
165 : };
166 : }
167 : #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX
168 :
169 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|