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: Function.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_FUNCTION_HXX
31 #define RPT_FUNCTION_HXX
33 #include <cppuhelper/propertysetmixin.hxx>
34 #ifndef _COM_SUN_STAR_REPORT_XFunction_HPP_
35 #include <com/sun/star/report/XFunction.hpp>
37 #include <cppuhelper/basemutex.hxx>
38 #include "ReportControlModel.hxx"
39 #include <cppuhelper/compbase2.hxx>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
42 namespace reportdesign
44 typedef ::cppu::PropertySetMixin
< com::sun::star::report::XFunction
> FunctionPropertySet
;
45 typedef ::cppu::WeakComponentImplHelper2
< com::sun::star::report::XFunction
46 ,com::sun::star::lang::XServiceInfo
> FunctionBase
;
48 /** \class OFunction Defines the implementation of a \interface com:::sun::star::report::XFunction
49 * \ingroup reportdesign_api
52 class OFunction
: public cppu::BaseMutex
,
54 public FunctionPropertySet
56 com::sun::star::beans::Optional
< ::rtl::OUString
> m_sInitialFormula
;
57 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
58 ::com::sun::star::uno::WeakReference
< ::com::sun::star::report::XFunctions
> m_xParent
;
59 ::rtl::OUString m_sName
;
60 ::rtl::OUString m_sFormula
;
61 ::sal_Bool m_bPreEvaluated
;
62 ::sal_Bool m_bDeepTraversing
;
64 OFunction(const OFunction
&);
65 OFunction
& operator=(const OFunction
&);
67 template <typename T
> void set( const ::rtl::OUString
& _sProperty
73 ::osl::MutexGuard
aGuard(m_aMutex
);
74 prepareSet(_sProperty
, ::com::sun::star::uno::makeAny(_member
), ::com::sun::star::uno::makeAny(_Value
), &l
);
82 explicit OFunction(::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> const & _xContext
);
85 // ::com::sun::star::lang::XServiceInfo
86 virtual ::sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
87 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw(::com::sun::star::uno::RuntimeException
);
88 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException
);
90 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException
);
91 static ::rtl::OUString
getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException
);
92 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
93 create(::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> const & xContext
);
94 // com::sun::star::beans::XPropertySet
95 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
96 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
);
97 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
);
98 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
);
99 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
);
100 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
);
101 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
);
103 // ::com::sun::star::report::XFunction:
104 virtual ::sal_Bool SAL_CALL
getPreEvaluated() throw (::com::sun::star::uno::RuntimeException
);
105 virtual void SAL_CALL
setPreEvaluated(::sal_Bool the_value
) throw (::com::sun::star::uno::RuntimeException
);
106 virtual ::sal_Bool SAL_CALL
getDeepTraversing() throw (::com::sun::star::uno::RuntimeException
);
107 virtual void SAL_CALL
setDeepTraversing(::sal_Bool the_value
) throw (::com::sun::star::uno::RuntimeException
);
108 virtual ::rtl::OUString SAL_CALL
getName() throw (::com::sun::star::uno::RuntimeException
);
109 virtual void SAL_CALL
setName(const ::rtl::OUString
& the_value
) throw (::com::sun::star::uno::RuntimeException
);
110 virtual ::rtl::OUString SAL_CALL
getFormula() throw (::com::sun::star::uno::RuntimeException
);
111 virtual void SAL_CALL
setFormula(const ::rtl::OUString
& the_value
) throw (::com::sun::star::uno::RuntimeException
);
112 virtual com::sun::star::beans::Optional
< ::rtl::OUString
> SAL_CALL
getInitialFormula() throw (::com::sun::star::uno::RuntimeException
);
113 virtual void SAL_CALL
setInitialFormula(const com::sun::star::beans::Optional
< ::rtl::OUString
> & the_value
) throw (::com::sun::star::uno::RuntimeException
);
116 virtual void SAL_CALL
dispose() throw(::com::sun::star::uno::RuntimeException
);
117 virtual void SAL_CALL
addEventListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & aListener
) throw(::com::sun::star::uno::RuntimeException
)
119 cppu::WeakComponentImplHelperBase::addEventListener(aListener
);
121 virtual void SAL_CALL
removeEventListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & aListener
) throw(::com::sun::star::uno::RuntimeException
)
123 cppu::WeakComponentImplHelperBase::removeEventListener(aListener
);
127 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
getParent( ) throw (::com::sun::star::uno::RuntimeException
);
128 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
);
131 #endif //RPT_FUNCTION_HXX