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 RPT_FIXEDTEXT_HXX
25 #define RPT_FIXEDTEXT_HXX
26 
27 #include <cppuhelper/propertysetmixin.hxx>
28 #include <com/sun/star/report/XFixedText.hpp>
29 #include "ReportControlModel.hxx"
30 #include <cppuhelper/compbase2.hxx>
31 #include <comphelper/broadcasthelper.hxx>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include "ReportHelperDefines.hxx"
34 
35 
36 namespace reportdesign
37 {
38 	typedef ::cppu::PropertySetMixin<		 com::sun::star::report::XFixedText	> FixedTextPropertySet;
39 	typedef ::cppu::WeakComponentImplHelper2<    com::sun::star::report::XFixedText
40 												,com::sun::star::lang::XServiceInfo	> FixedTextBase;
41 
42     /** \class OFixedText Defines the implementation of a \interface com:::sun::star::report::XFixedText
43 	 * \ingroup reportdesign_api
44 	 *
45 	 */
46 	class OFixedText :	public comphelper::OBaseMutex,
47 							public FixedTextBase,
48 							public FixedTextPropertySet
49 	{
50         friend class OShapeHelper;
51 		OReportControlModel		            m_aProps;
52 		::rtl::OUString			            m_sLabel;
53 	private:
54 		OFixedText(const OFixedText&);
55 		OFixedText& operator=(const OFixedText&);
56 
set(const::rtl::OUString & _sProperty,const T & _Value,T & _member)57 		template <typename T> void set(	 const ::rtl::OUString& _sProperty
58 										,const T& _Value
59 										,T& _member)
60 		{
61 			BoundListeners l;
62 			{
63 				::osl::MutexGuard aGuard(m_aMutex);
64                 if ( _member != _Value )
65                 {
66 				    prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
67 				    _member = _Value;
68                 }
69 			}
70 			l.notify();
71 		}
72         void checkIndex(sal_Int32 _nIndex);
73 	protected:
74 		virtual ~OFixedText();
75 	public:
76 		explicit OFixedText(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext);
77         explicit OFixedText(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext
78                             ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _xFactory
79                             ,::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _xShape);
80 
81 		DECLARE_XINTERFACE( )
82 		// ::com::sun::star::lang::XServiceInfo
83 		virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
84 		virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
85 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
86 
87 		static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
88 		static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
89         static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
90 			create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
91 		// com::sun::star::beans::XPropertySet
92 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
93 		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);
94 		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);
95 		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);
96 		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);
97 		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);
98 		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);
99 
100 		// XReportComponent
101 		REPORTCOMPONENT_HEADER()
102         // XShape
103         SHAPE_HEADER()
104 
105         // XShapeDescriptor
106         virtual ::rtl::OUString SAL_CALL getShapeType(  ) throw (::com::sun::star::uno::RuntimeException);
107 
108 		// XReportControlModel
109 		REPORTCONTROLMODEL_HEADER()
110 
111 		// XCloneable
112 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(  ) throw (::com::sun::star::uno::RuntimeException);
113 
114 		// XFixedText
115 		virtual ::rtl::OUString SAL_CALL getLabel() throw (::com::sun::star::uno::RuntimeException);
116 		virtual void SAL_CALL setLabel( const ::rtl::OUString& _label ) throw (::com::sun::star::uno::RuntimeException);
117 
118         // ::com::sun::star::report::XReportControlFormat
119         REPORTCONTROLFORMAT_HEADER()
120 
121 		// XComponent
122 		virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
addEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)123 		virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
124 		{
125 			cppu::WeakComponentImplHelperBase::addEventListener(aListener);
126 		}
removeEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)127 		virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
128 		{
129 			cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
130 		}
131 
132 		// XChild
133 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent(  ) throw (::com::sun::star::uno::RuntimeException);
134 		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);
135         // XContainer
136 		virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
137 		virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
138 
139 		// XElementAccess
140 		virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException);
141 		virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException);
142 
143 		// XIndexReplace
144 		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);
145 
146 		// XIndexContainer
147 		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);
148 		virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
149 
150 		// XIndexAccess
151 		virtual ::sal_Int32 SAL_CALL getCount(  ) throw (::com::sun::star::uno::RuntimeException);
152 		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);
153 	};
154 }
155 #endif //RPT_FIXEDTEXT_HXX
156 
157