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_FUNCTION_HXX
20 : #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTION_HXX
21 :
22 : #include <cppuhelper/propertysetmixin.hxx>
23 : #include <com/sun/star/report/XFunction.hpp>
24 : #include <cppuhelper/basemutex.hxx>
25 : #include "ReportControlModel.hxx"
26 : #include <cppuhelper/compbase2.hxx>
27 : #include <com/sun/star/lang/XServiceInfo.hpp>
28 :
29 : namespace reportdesign
30 : {
31 : typedef ::cppu::PropertySetMixin< com::sun::star::report::XFunction > FunctionPropertySet;
32 : typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XFunction
33 : ,com::sun::star::lang::XServiceInfo > FunctionBase;
34 :
35 : /** \class OFunction Defines the implementation of a \interface com:::sun::star::report::XFunction
36 : * \ingroup reportdesign_api
37 : *
38 : */
39 : class OFunction : public cppu::BaseMutex,
40 : public FunctionBase,
41 : public FunctionPropertySet
42 : {
43 : com::sun::star::beans::Optional< OUString> m_sInitialFormula;
44 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
45 : ::com::sun::star::uno::WeakReference< ::com::sun::star::report::XFunctions > m_xParent;
46 : OUString m_sName;
47 : OUString m_sFormula;
48 : bool m_bPreEvaluated;
49 : bool m_bDeepTraversing;
50 : private:
51 : OFunction(const OFunction&);
52 : OFunction& operator=(const OFunction&);
53 :
54 0 : template <typename T> void set( const OUString& _sProperty
55 : ,const T& _Value
56 : ,T& _member)
57 : {
58 0 : BoundListeners l;
59 : {
60 0 : ::osl::MutexGuard aGuard(m_aMutex);
61 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
62 0 : _member = _Value;
63 : }
64 0 : l.notify();
65 0 : }
66 0 : void set( const OUString& _sProperty
67 : ,bool _Value
68 : ,bool& _member)
69 : {
70 0 : BoundListeners l;
71 : {
72 0 : ::osl::MutexGuard aGuard(m_aMutex);
73 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
74 0 : _member = _Value;
75 : }
76 0 : l.notify();
77 0 : }
78 : protected:
79 : virtual ~OFunction();
80 : public:
81 : explicit OFunction(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext);
82 :
83 : DECLARE_XINTERFACE( )
84 : // ::com::sun::star::lang::XServiceInfo
85 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 :
89 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
90 : static OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
91 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
92 : create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
93 : // com::sun::star::beans::XPropertySet
94 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : 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;
96 : 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;
97 : 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;
98 : 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;
99 : 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;
100 : 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;
101 :
102 : // ::com::sun::star::report::XFunction:
103 : virtual sal_Bool SAL_CALL getPreEvaluated() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : virtual void SAL_CALL setPreEvaluated(sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 : virtual sal_Bool SAL_CALL getDeepTraversing() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 : virtual void SAL_CALL setDeepTraversing(sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 : virtual OUString SAL_CALL getName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
108 : virtual void SAL_CALL setName(const OUString & the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 : virtual OUString SAL_CALL getFormula() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 : virtual void SAL_CALL setFormula(const OUString & the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 : virtual com::sun::star::beans::Optional< OUString> SAL_CALL getInitialFormula() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 : virtual void SAL_CALL setInitialFormula(const com::sun::star::beans::Optional< OUString> & the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 :
114 : // XComponent
115 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 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
117 : {
118 0 : cppu::WeakComponentImplHelperBase::addEventListener(aListener);
119 0 : }
120 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
121 : {
122 0 : cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
123 0 : }
124 :
125 : // XChild
126 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 : 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;
128 : };
129 : }
130 : #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTION_HXX
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|