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