1*9e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*9e0e4191SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*9e0e4191SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*9e0e4191SAndrew Rist * distributed with this work for additional information
6*9e0e4191SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*9e0e4191SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*9e0e4191SAndrew Rist * "License"); you may not use this file except in compliance
9*9e0e4191SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*9e0e4191SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*9e0e4191SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*9e0e4191SAndrew Rist * software distributed under the License is distributed on an
15*9e0e4191SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9e0e4191SAndrew Rist * KIND, either express or implied. See the License for the
17*9e0e4191SAndrew Rist * specific language governing permissions and limitations
18*9e0e4191SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*9e0e4191SAndrew Rist *************************************************************/
21*9e0e4191SAndrew Rist
22*9e0e4191SAndrew Rist
23cdf0e10cSrcweir #include "Function.hxx"
24cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
25cdf0e10cSrcweir #ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC
26cdf0e10cSrcweir #include "corestrings.hrc"
27cdf0e10cSrcweir #endif
28cdf0e10cSrcweir #include <tools/debug.hxx>
29cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
30cdf0e10cSrcweir #include <comphelper/sequence.hxx>
31cdf0e10cSrcweir #include <comphelper/property.hxx>
32cdf0e10cSrcweir #include "Tools.hxx"
33cdf0e10cSrcweir #include "corestrings.hrc"
34cdf0e10cSrcweir // =============================================================================
35cdf0e10cSrcweir namespace reportdesign
36cdf0e10cSrcweir {
37cdf0e10cSrcweir // =============================================================================
38cdf0e10cSrcweir using namespace com::sun::star;
39cdf0e10cSrcweir using namespace comphelper;
40cdf0e10cSrcweir //------------------------------------------------------------------------------
create(uno::Reference<uno::XComponentContext> const & xContext)41cdf0e10cSrcweir uno::Reference< uno::XInterface > OFunction::create(uno::Reference< uno::XComponentContext > const & xContext)
42cdf0e10cSrcweir {
43cdf0e10cSrcweir return *(new OFunction(xContext));
44cdf0e10cSrcweir }
45cdf0e10cSrcweir
DBG_NAME(rpt_OFunction)46cdf0e10cSrcweir DBG_NAME( rpt_OFunction )
47cdf0e10cSrcweir // -----------------------------------------------------------------------------
48cdf0e10cSrcweir OFunction::OFunction(uno::Reference< uno::XComponentContext > const & _xContext)
49cdf0e10cSrcweir :FunctionBase(m_aMutex)
50cdf0e10cSrcweir ,FunctionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >())
51cdf0e10cSrcweir ,m_xContext(_xContext)
52cdf0e10cSrcweir ,m_bPreEvaluated(sal_False)
53cdf0e10cSrcweir ,m_bDeepTraversing(sal_False)
54cdf0e10cSrcweir {
55cdf0e10cSrcweir m_sInitialFormula.IsPresent = sal_False;
56cdf0e10cSrcweir DBG_CTOR( rpt_OFunction,NULL);
57cdf0e10cSrcweir }
58cdf0e10cSrcweir // -----------------------------------------------------------------------------
~OFunction()59cdf0e10cSrcweir OFunction::~OFunction()
60cdf0e10cSrcweir {
61cdf0e10cSrcweir DBG_DTOR( rpt_OFunction,NULL);
62cdf0e10cSrcweir }
63cdf0e10cSrcweir // -----------------------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2(OFunction,FunctionBase,FunctionPropertySet)64cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2(OFunction,FunctionBase,FunctionPropertySet)
65cdf0e10cSrcweir // -----------------------------------------------------------------------------
66cdf0e10cSrcweir void SAL_CALL OFunction::dispose() throw(uno::RuntimeException)
67cdf0e10cSrcweir {
68cdf0e10cSrcweir FunctionPropertySet::dispose();
69cdf0e10cSrcweir cppu::WeakComponentImplHelperBase::dispose();
70cdf0e10cSrcweir }
71cdf0e10cSrcweir // -----------------------------------------------------------------------------
getImplementationName_Static()72cdf0e10cSrcweir ::rtl::OUString OFunction::getImplementationName_Static( ) throw(uno::RuntimeException)
73cdf0e10cSrcweir {
74cdf0e10cSrcweir return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OFunction"));
75cdf0e10cSrcweir }
76cdf0e10cSrcweir
77cdf0e10cSrcweir //--------------------------------------------------------------------------
getImplementationName()78cdf0e10cSrcweir ::rtl::OUString SAL_CALL OFunction::getImplementationName( ) throw(uno::RuntimeException)
79cdf0e10cSrcweir {
80cdf0e10cSrcweir return getImplementationName_Static();
81cdf0e10cSrcweir }
82cdf0e10cSrcweir //--------------------------------------------------------------------------
getSupportedServiceNames_Static()83cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > OFunction::getSupportedServiceNames_Static( ) throw(uno::RuntimeException)
84cdf0e10cSrcweir {
85cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aServices(1);
86cdf0e10cSrcweir aServices.getArray()[0] = SERVICE_FUNCTION;
87cdf0e10cSrcweir
88cdf0e10cSrcweir return aServices;
89cdf0e10cSrcweir }
90cdf0e10cSrcweir //--------------------------------------------------------------------------
getSupportedServiceNames()91cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL OFunction::getSupportedServiceNames( ) throw(uno::RuntimeException)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir return getSupportedServiceNames_Static();
94cdf0e10cSrcweir }
95cdf0e10cSrcweir //------------------------------------------------------------------------------
supportsService(const::rtl::OUString & ServiceName)96cdf0e10cSrcweir sal_Bool SAL_CALL OFunction::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException )
97cdf0e10cSrcweir {
98cdf0e10cSrcweir return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static());
99cdf0e10cSrcweir }
100cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPropertySetInfo()101cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL OFunction::getPropertySetInfo( ) throw(uno::RuntimeException)
102cdf0e10cSrcweir {
103cdf0e10cSrcweir return FunctionPropertySet::getPropertySetInfo();
104cdf0e10cSrcweir }
105cdf0e10cSrcweir // -----------------------------------------------------------------------------
setPropertyValue(const::rtl::OUString & aPropertyName,const uno::Any & aValue)106cdf0e10cSrcweir void SAL_CALL OFunction::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir FunctionPropertySet::setPropertyValue( aPropertyName, aValue );
109cdf0e10cSrcweir }
110cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPropertyValue(const::rtl::OUString & PropertyName)111cdf0e10cSrcweir uno::Any SAL_CALL OFunction::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
112cdf0e10cSrcweir {
113cdf0e10cSrcweir return FunctionPropertySet::getPropertyValue( PropertyName);
114cdf0e10cSrcweir }
115cdf0e10cSrcweir // -----------------------------------------------------------------------------
addPropertyChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XPropertyChangeListener> & xListener)116cdf0e10cSrcweir void SAL_CALL OFunction::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
117cdf0e10cSrcweir {
118cdf0e10cSrcweir FunctionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
119cdf0e10cSrcweir }
120cdf0e10cSrcweir // -----------------------------------------------------------------------------
removePropertyChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XPropertyChangeListener> & aListener)121cdf0e10cSrcweir void SAL_CALL OFunction::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
122cdf0e10cSrcweir {
123cdf0e10cSrcweir FunctionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
124cdf0e10cSrcweir }
125cdf0e10cSrcweir // -----------------------------------------------------------------------------
addVetoableChangeListener(const::rtl::OUString & PropertyName,const uno::Reference<beans::XVetoableChangeListener> & aListener)126cdf0e10cSrcweir void SAL_CALL OFunction::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
127cdf0e10cSrcweir {
128cdf0e10cSrcweir FunctionPropertySet::addVetoableChangeListener( PropertyName, aListener );
129cdf0e10cSrcweir }
130cdf0e10cSrcweir // -----------------------------------------------------------------------------
removeVetoableChangeListener(const::rtl::OUString & PropertyName,const uno::Reference<beans::XVetoableChangeListener> & aListener)131cdf0e10cSrcweir void SAL_CALL OFunction::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
132cdf0e10cSrcweir {
133cdf0e10cSrcweir FunctionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
134cdf0e10cSrcweir }
135cdf0e10cSrcweir // -----------------------------------------------------------------------------
136cdf0e10cSrcweir // report::XFunction:
getPreEvaluated()137cdf0e10cSrcweir ::sal_Bool SAL_CALL OFunction::getPreEvaluated() throw (uno::RuntimeException)
138cdf0e10cSrcweir {
139cdf0e10cSrcweir osl::MutexGuard g(m_aMutex);
140cdf0e10cSrcweir return m_bPreEvaluated;
141cdf0e10cSrcweir }
142cdf0e10cSrcweir // -----------------------------------------------------------------------------
143cdf0e10cSrcweir
setPreEvaluated(::sal_Bool the_value)144cdf0e10cSrcweir void SAL_CALL OFunction::setPreEvaluated(::sal_Bool the_value) throw (uno::RuntimeException)
145cdf0e10cSrcweir {
146cdf0e10cSrcweir set(PROPERTY_PREEVALUATED,the_value,m_bPreEvaluated);
147cdf0e10cSrcweir }
148cdf0e10cSrcweir // -----------------------------------------------------------------------------
getDeepTraversing()149cdf0e10cSrcweir ::sal_Bool SAL_CALL OFunction::getDeepTraversing() throw (uno::RuntimeException)
150cdf0e10cSrcweir {
151cdf0e10cSrcweir osl::MutexGuard g(m_aMutex);
152cdf0e10cSrcweir return m_bDeepTraversing;
153cdf0e10cSrcweir }
154cdf0e10cSrcweir // -----------------------------------------------------------------------------
155cdf0e10cSrcweir
setDeepTraversing(::sal_Bool the_value)156cdf0e10cSrcweir void SAL_CALL OFunction::setDeepTraversing(::sal_Bool the_value) throw (uno::RuntimeException)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir set(PROPERTY_DEEPTRAVERSING,the_value,m_bDeepTraversing);
159cdf0e10cSrcweir }
160cdf0e10cSrcweir // -----------------------------------------------------------------------------
161cdf0e10cSrcweir
getName()162cdf0e10cSrcweir ::rtl::OUString SAL_CALL OFunction::getName() throw (uno::RuntimeException)
163cdf0e10cSrcweir {
164cdf0e10cSrcweir osl::MutexGuard g(m_aMutex);
165cdf0e10cSrcweir return m_sName;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir // -----------------------------------------------------------------------------
168cdf0e10cSrcweir
setName(const::rtl::OUString & the_value)169cdf0e10cSrcweir void SAL_CALL OFunction::setName(const ::rtl::OUString & the_value) throw (uno::RuntimeException)
170cdf0e10cSrcweir {
171cdf0e10cSrcweir set(PROPERTY_NAME,the_value,m_sName);
172cdf0e10cSrcweir }
173cdf0e10cSrcweir // -----------------------------------------------------------------------------
getFormula()174cdf0e10cSrcweir ::rtl::OUString SAL_CALL OFunction::getFormula() throw (uno::RuntimeException)
175cdf0e10cSrcweir {
176cdf0e10cSrcweir osl::MutexGuard g(m_aMutex);
177cdf0e10cSrcweir return m_sFormula;
178cdf0e10cSrcweir }
179cdf0e10cSrcweir // -----------------------------------------------------------------------------
setFormula(const::rtl::OUString & the_value)180cdf0e10cSrcweir void SAL_CALL OFunction::setFormula(const ::rtl::OUString & the_value) throw (uno::RuntimeException)
181cdf0e10cSrcweir {
182cdf0e10cSrcweir set(PROPERTY_FORMULA,the_value,m_sFormula);
183cdf0e10cSrcweir }
184cdf0e10cSrcweir // -----------------------------------------------------------------------------
getInitialFormula()185cdf0e10cSrcweir beans::Optional< ::rtl::OUString> SAL_CALL OFunction::getInitialFormula() throw (uno::RuntimeException)
186cdf0e10cSrcweir {
187cdf0e10cSrcweir osl::MutexGuard g(m_aMutex);
188cdf0e10cSrcweir return m_sInitialFormula;
189cdf0e10cSrcweir }
190cdf0e10cSrcweir // -----------------------------------------------------------------------------
setInitialFormula(const beans::Optional<::rtl::OUString> & the_value)191cdf0e10cSrcweir void SAL_CALL OFunction::setInitialFormula(const beans::Optional< ::rtl::OUString> & the_value) throw (uno::RuntimeException)
192cdf0e10cSrcweir {
193cdf0e10cSrcweir set(PROPERTY_INITIALFORMULA,the_value,m_sInitialFormula);
194cdf0e10cSrcweir }
195cdf0e10cSrcweir // -----------------------------------------------------------------------------
196cdf0e10cSrcweir // XChild
getParent()197cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL OFunction::getParent( ) throw (uno::RuntimeException)
198cdf0e10cSrcweir {
199cdf0e10cSrcweir osl::MutexGuard g(m_aMutex);
200cdf0e10cSrcweir return m_xParent;
201cdf0e10cSrcweir }
202cdf0e10cSrcweir // -----------------------------------------------------------------------------
setParent(const uno::Reference<uno::XInterface> & Parent)203cdf0e10cSrcweir void SAL_CALL OFunction::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException)
204cdf0e10cSrcweir {
205cdf0e10cSrcweir osl::MutexGuard g(m_aMutex);
206cdf0e10cSrcweir if ( Parent.is() )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir uno::Reference< report::XFunctions> xFunctions(Parent,uno::UNO_QUERY_THROW);
209cdf0e10cSrcweir m_xParent = xFunctions;
210cdf0e10cSrcweir }
211cdf0e10cSrcweir else
212cdf0e10cSrcweir m_xParent = uno::WeakReference< report::XFunctions >();
213cdf0e10cSrcweir }
214cdf0e10cSrcweir // -----------------------------------------------------------------------------
215cdf0e10cSrcweir
216cdf0e10cSrcweir // =============================================================================
217cdf0e10cSrcweir } // namespace reportdesign
218cdf0e10cSrcweir // =============================================================================
219