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