1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #include "Function.hxx"
20 #include <com/sun/star/beans/PropertyAttribute.hpp>
21 #include "corestrings.hrc"
22 #include <tools/debug.hxx>
23 #include <connectivity/dbtools.hxx>
24 #include <comphelper/property.hxx>
25 #include <cppuhelper/supportsservice.hxx>
28 namespace reportdesign
31 using namespace com::sun::star
;
32 using namespace comphelper
;
34 uno::Reference
< uno::XInterface
> OFunction::create(uno::Reference
< uno::XComponentContext
> const & xContext
)
36 return *(new OFunction(xContext
));
40 OFunction::OFunction(uno::Reference
< uno::XComponentContext
> const & _xContext
)
41 :FunctionBase(m_aMutex
)
42 ,FunctionPropertySet(_xContext
,static_cast< Implements
>(IMPLEMENTS_PROPERTY_SET
),uno::Sequence
< OUString
>())
43 ,m_xContext(_xContext
)
44 ,m_bPreEvaluated(false)
45 ,m_bDeepTraversing(false)
47 m_sInitialFormula
.IsPresent
= sal_False
;
50 OFunction::~OFunction()
54 IMPLEMENT_FORWARD_XINTERFACE2(OFunction
,FunctionBase
,FunctionPropertySet
)
56 void SAL_CALL
OFunction::dispose() throw(uno::RuntimeException
, std::exception
)
58 FunctionPropertySet::dispose();
59 cppu::WeakComponentImplHelperBase::dispose();
62 OUString
OFunction::getImplementationName_Static( ) throw(uno::RuntimeException
)
64 return OUString("com.sun.star.comp.report.OFunction");
68 OUString SAL_CALL
OFunction::getImplementationName( ) throw(uno::RuntimeException
, std::exception
)
70 return getImplementationName_Static();
73 uno::Sequence
< OUString
> OFunction::getSupportedServiceNames_Static( ) throw(uno::RuntimeException
)
75 uno::Sequence
< OUString
> aServices(1);
76 aServices
.getArray()[0] = SERVICE_FUNCTION
;
81 uno::Sequence
< OUString
> SAL_CALL
OFunction::getSupportedServiceNames( ) throw(uno::RuntimeException
, std::exception
)
83 return getSupportedServiceNames_Static();
86 sal_Bool SAL_CALL
OFunction::supportsService(const OUString
& ServiceName
) throw( uno::RuntimeException
, std::exception
)
88 return cppu::supportsService(this, ServiceName
);
91 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
OFunction::getPropertySetInfo( ) throw(uno::RuntimeException
, std::exception
)
93 return FunctionPropertySet::getPropertySetInfo();
96 void SAL_CALL
OFunction::setPropertyValue( const OUString
& aPropertyName
, const uno::Any
& aValue
) throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
98 FunctionPropertySet::setPropertyValue( aPropertyName
, aValue
);
101 uno::Any SAL_CALL
OFunction::getPropertyValue( const OUString
& PropertyName
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
103 return FunctionPropertySet::getPropertyValue( PropertyName
);
106 void SAL_CALL
OFunction::addPropertyChangeListener( const OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
>& xListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
108 FunctionPropertySet::addPropertyChangeListener( aPropertyName
, xListener
);
111 void SAL_CALL
OFunction::removePropertyChangeListener( const OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
113 FunctionPropertySet::removePropertyChangeListener( aPropertyName
, aListener
);
116 void SAL_CALL
OFunction::addVetoableChangeListener( const OUString
& PropertyName
, const uno::Reference
< beans::XVetoableChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
118 FunctionPropertySet::addVetoableChangeListener( PropertyName
, aListener
);
121 void SAL_CALL
OFunction::removeVetoableChangeListener( const OUString
& PropertyName
, const uno::Reference
< beans::XVetoableChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
123 FunctionPropertySet::removeVetoableChangeListener( PropertyName
, aListener
);
126 // report::XFunction:
127 sal_Bool SAL_CALL
OFunction::getPreEvaluated() throw (uno::RuntimeException
, std::exception
)
129 osl::MutexGuard
g(m_aMutex
);
130 return m_bPreEvaluated
;
134 void SAL_CALL
OFunction::setPreEvaluated(sal_Bool the_value
) throw (uno::RuntimeException
, std::exception
)
136 set(PROPERTY_PREEVALUATED
,the_value
,m_bPreEvaluated
);
139 sal_Bool SAL_CALL
OFunction::getDeepTraversing() throw (uno::RuntimeException
, std::exception
)
141 osl::MutexGuard
g(m_aMutex
);
142 return m_bDeepTraversing
;
146 void SAL_CALL
OFunction::setDeepTraversing(sal_Bool the_value
) throw (uno::RuntimeException
, std::exception
)
148 set(PROPERTY_DEEPTRAVERSING
,the_value
,m_bDeepTraversing
);
152 OUString SAL_CALL
OFunction::getName() throw (uno::RuntimeException
, std::exception
)
154 osl::MutexGuard
g(m_aMutex
);
159 void SAL_CALL
OFunction::setName(const OUString
& the_value
) throw (uno::RuntimeException
, std::exception
)
161 set(PROPERTY_NAME
,the_value
,m_sName
);
164 OUString SAL_CALL
OFunction::getFormula() throw (uno::RuntimeException
, std::exception
)
166 osl::MutexGuard
g(m_aMutex
);
170 void SAL_CALL
OFunction::setFormula(const OUString
& the_value
) throw (uno::RuntimeException
, std::exception
)
172 set(PROPERTY_FORMULA
,the_value
,m_sFormula
);
175 beans::Optional
< OUString
> SAL_CALL
OFunction::getInitialFormula() throw (uno::RuntimeException
, std::exception
)
177 osl::MutexGuard
g(m_aMutex
);
178 return m_sInitialFormula
;
181 void SAL_CALL
OFunction::setInitialFormula(const beans::Optional
< OUString
> & the_value
) throw (uno::RuntimeException
, std::exception
)
183 set(PROPERTY_INITIALFORMULA
,the_value
,m_sInitialFormula
);
187 uno::Reference
< uno::XInterface
> SAL_CALL
OFunction::getParent( ) throw (uno::RuntimeException
, std::exception
)
189 osl::MutexGuard
g(m_aMutex
);
193 void SAL_CALL
OFunction::setParent( const uno::Reference
< uno::XInterface
>& Parent
) throw (lang::NoSupportException
, uno::RuntimeException
, std::exception
)
195 osl::MutexGuard
g(m_aMutex
);
198 uno::Reference
< report::XFunctions
> xFunctions(Parent
,uno::UNO_QUERY_THROW
);
199 m_xParent
= xFunctions
;
202 m_xParent
= uno::WeakReference
< report::XFunctions
>();
207 } // namespace reportdesign
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */