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/sequence.hxx>
25 #include <comphelper/property.hxx>
27 // =============================================================================
28 namespace reportdesign
30 // =============================================================================
31 using namespace com::sun::star
;
32 using namespace comphelper
;
33 //------------------------------------------------------------------------------
34 uno::Reference
< uno::XInterface
> OFunction::create(uno::Reference
< uno::XComponentContext
> const & xContext
)
36 return *(new OFunction(xContext
));
39 DBG_NAME( rpt_OFunction
)
40 // -----------------------------------------------------------------------------
41 OFunction::OFunction(uno::Reference
< uno::XComponentContext
> const & _xContext
)
42 :FunctionBase(m_aMutex
)
43 ,FunctionPropertySet(_xContext
,static_cast< Implements
>(IMPLEMENTS_PROPERTY_SET
),uno::Sequence
< OUString
>())
44 ,m_xContext(_xContext
)
45 ,m_bPreEvaluated(sal_False
)
46 ,m_bDeepTraversing(sal_False
)
48 m_sInitialFormula
.IsPresent
= sal_False
;
49 DBG_CTOR( rpt_OFunction
,NULL
);
51 // -----------------------------------------------------------------------------
52 OFunction::~OFunction()
54 DBG_DTOR( rpt_OFunction
,NULL
);
56 // -----------------------------------------------------------------------------
57 IMPLEMENT_FORWARD_XINTERFACE2(OFunction
,FunctionBase
,FunctionPropertySet
)
58 // -----------------------------------------------------------------------------
59 void SAL_CALL
OFunction::dispose() throw(uno::RuntimeException
)
61 FunctionPropertySet::dispose();
62 cppu::WeakComponentImplHelperBase::dispose();
64 // -----------------------------------------------------------------------------
65 OUString
OFunction::getImplementationName_Static( ) throw(uno::RuntimeException
)
67 return OUString("com.sun.star.comp.report.OFunction");
70 //--------------------------------------------------------------------------
71 OUString SAL_CALL
OFunction::getImplementationName( ) throw(uno::RuntimeException
)
73 return getImplementationName_Static();
75 //--------------------------------------------------------------------------
76 uno::Sequence
< OUString
> OFunction::getSupportedServiceNames_Static( ) throw(uno::RuntimeException
)
78 uno::Sequence
< OUString
> aServices(1);
79 aServices
.getArray()[0] = SERVICE_FUNCTION
;
83 //--------------------------------------------------------------------------
84 uno::Sequence
< OUString
> SAL_CALL
OFunction::getSupportedServiceNames( ) throw(uno::RuntimeException
)
86 return getSupportedServiceNames_Static();
88 //------------------------------------------------------------------------------
89 sal_Bool SAL_CALL
OFunction::supportsService(const OUString
& ServiceName
) throw( uno::RuntimeException
)
91 return ::comphelper::existsValue(ServiceName
,getSupportedServiceNames_Static());
93 // -----------------------------------------------------------------------------
94 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
OFunction::getPropertySetInfo( ) throw(uno::RuntimeException
)
96 return FunctionPropertySet::getPropertySetInfo();
98 // -----------------------------------------------------------------------------
99 void SAL_CALL
OFunction::setPropertyValue( const OUString
& aPropertyName
, const uno::Any
& aValue
) throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
101 FunctionPropertySet::setPropertyValue( aPropertyName
, aValue
);
103 // -----------------------------------------------------------------------------
104 uno::Any SAL_CALL
OFunction::getPropertyValue( const OUString
& PropertyName
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
106 return FunctionPropertySet::getPropertyValue( PropertyName
);
108 // -----------------------------------------------------------------------------
109 void SAL_CALL
OFunction::addPropertyChangeListener( const OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
>& xListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
111 FunctionPropertySet::addPropertyChangeListener( aPropertyName
, xListener
);
113 // -----------------------------------------------------------------------------
114 void SAL_CALL
OFunction::removePropertyChangeListener( const OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
116 FunctionPropertySet::removePropertyChangeListener( aPropertyName
, aListener
);
118 // -----------------------------------------------------------------------------
119 void SAL_CALL
OFunction::addVetoableChangeListener( const OUString
& PropertyName
, const uno::Reference
< beans::XVetoableChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
121 FunctionPropertySet::addVetoableChangeListener( PropertyName
, aListener
);
123 // -----------------------------------------------------------------------------
124 void SAL_CALL
OFunction::removeVetoableChangeListener( const OUString
& PropertyName
, const uno::Reference
< beans::XVetoableChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
126 FunctionPropertySet::removeVetoableChangeListener( PropertyName
, aListener
);
128 // -----------------------------------------------------------------------------
129 // report::XFunction:
130 ::sal_Bool SAL_CALL
OFunction::getPreEvaluated() throw (uno::RuntimeException
)
132 osl::MutexGuard
g(m_aMutex
);
133 return m_bPreEvaluated
;
135 // -----------------------------------------------------------------------------
137 void SAL_CALL
OFunction::setPreEvaluated(::sal_Bool the_value
) throw (uno::RuntimeException
)
139 set(PROPERTY_PREEVALUATED
,the_value
,m_bPreEvaluated
);
141 // -----------------------------------------------------------------------------
142 ::sal_Bool SAL_CALL
OFunction::getDeepTraversing() throw (uno::RuntimeException
)
144 osl::MutexGuard
g(m_aMutex
);
145 return m_bDeepTraversing
;
147 // -----------------------------------------------------------------------------
149 void SAL_CALL
OFunction::setDeepTraversing(::sal_Bool the_value
) throw (uno::RuntimeException
)
151 set(PROPERTY_DEEPTRAVERSING
,the_value
,m_bDeepTraversing
);
153 // -----------------------------------------------------------------------------
155 OUString SAL_CALL
OFunction::getName() throw (uno::RuntimeException
)
157 osl::MutexGuard
g(m_aMutex
);
160 // -----------------------------------------------------------------------------
162 void SAL_CALL
OFunction::setName(const OUString
& the_value
) throw (uno::RuntimeException
)
164 set(PROPERTY_NAME
,the_value
,m_sName
);
166 // -----------------------------------------------------------------------------
167 OUString SAL_CALL
OFunction::getFormula() throw (uno::RuntimeException
)
169 osl::MutexGuard
g(m_aMutex
);
172 // -----------------------------------------------------------------------------
173 void SAL_CALL
OFunction::setFormula(const OUString
& the_value
) throw (uno::RuntimeException
)
175 set(PROPERTY_FORMULA
,the_value
,m_sFormula
);
177 // -----------------------------------------------------------------------------
178 beans::Optional
< OUString
> SAL_CALL
OFunction::getInitialFormula() throw (uno::RuntimeException
)
180 osl::MutexGuard
g(m_aMutex
);
181 return m_sInitialFormula
;
183 // -----------------------------------------------------------------------------
184 void SAL_CALL
OFunction::setInitialFormula(const beans::Optional
< OUString
> & the_value
) throw (uno::RuntimeException
)
186 set(PROPERTY_INITIALFORMULA
,the_value
,m_sInitialFormula
);
188 // -----------------------------------------------------------------------------
190 uno::Reference
< uno::XInterface
> SAL_CALL
OFunction::getParent( ) throw (uno::RuntimeException
)
192 osl::MutexGuard
g(m_aMutex
);
195 // -----------------------------------------------------------------------------
196 void SAL_CALL
OFunction::setParent( const uno::Reference
< uno::XInterface
>& Parent
) throw (lang::NoSupportException
, uno::RuntimeException
)
198 osl::MutexGuard
g(m_aMutex
);
201 uno::Reference
< report::XFunctions
> xFunctions(Parent
,uno::UNO_QUERY_THROW
);
202 m_xParent
= xFunctions
;
205 m_xParent
= uno::WeakReference
< report::XFunctions
>();
207 // -----------------------------------------------------------------------------
209 // =============================================================================
210 } // namespace reportdesign
211 // =============================================================================
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */