Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
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>
26 : #include "Tools.hxx"
27 :
28 : namespace reportdesign
29 : {
30 :
31 : using namespace com::sun::star;
32 : using namespace comphelper;
33 :
34 1 : uno::Reference< uno::XInterface > OFunction::create(uno::Reference< uno::XComponentContext > const & xContext)
35 : {
36 1 : return *(new OFunction(xContext));
37 : }
38 :
39 :
40 1 : 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 1 : ,m_bDeepTraversing(false)
46 : {
47 1 : m_sInitialFormula.IsPresent = sal_False;
48 1 : }
49 :
50 2 : OFunction::~OFunction()
51 : {
52 2 : }
53 :
54 27 : IMPLEMENT_FORWARD_XINTERFACE2(OFunction,FunctionBase,FunctionPropertySet)
55 :
56 1 : void SAL_CALL OFunction::dispose() throw(uno::RuntimeException, std::exception)
57 : {
58 1 : FunctionPropertySet::dispose();
59 1 : cppu::WeakComponentImplHelperBase::dispose();
60 1 : }
61 :
62 9 : OUString OFunction::getImplementationName_Static( ) throw(uno::RuntimeException)
63 : {
64 9 : return OUString("com.sun.star.comp.report.OFunction");
65 : }
66 :
67 :
68 1 : OUString SAL_CALL OFunction::getImplementationName( ) throw(uno::RuntimeException, std::exception)
69 : {
70 1 : return getImplementationName_Static();
71 : }
72 :
73 2 : uno::Sequence< OUString > OFunction::getSupportedServiceNames_Static( ) throw(uno::RuntimeException)
74 : {
75 2 : uno::Sequence< OUString > aServices(1);
76 2 : aServices.getArray()[0] = SERVICE_FUNCTION;
77 :
78 2 : return aServices;
79 : }
80 :
81 1 : uno::Sequence< OUString > SAL_CALL OFunction::getSupportedServiceNames( ) throw(uno::RuntimeException, std::exception)
82 : {
83 1 : return getSupportedServiceNames_Static();
84 : }
85 :
86 0 : sal_Bool SAL_CALL OFunction::supportsService(const OUString& ServiceName) throw( uno::RuntimeException, std::exception )
87 : {
88 0 : return cppu::supportsService(this, ServiceName);
89 : }
90 :
91 0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL OFunction::getPropertySetInfo( ) throw(uno::RuntimeException, std::exception)
92 : {
93 0 : return FunctionPropertySet::getPropertySetInfo();
94 : }
95 :
96 0 : 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)
97 : {
98 0 : FunctionPropertySet::setPropertyValue( aPropertyName, aValue );
99 0 : }
100 :
101 0 : uno::Any SAL_CALL OFunction::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
102 : {
103 0 : return FunctionPropertySet::getPropertyValue( PropertyName);
104 : }
105 :
106 0 : void SAL_CALL OFunction::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
107 : {
108 0 : FunctionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
109 0 : }
110 :
111 0 : void SAL_CALL OFunction::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
112 : {
113 0 : FunctionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
114 0 : }
115 :
116 0 : void SAL_CALL OFunction::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
117 : {
118 0 : FunctionPropertySet::addVetoableChangeListener( PropertyName, aListener );
119 0 : }
120 :
121 0 : void SAL_CALL OFunction::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
122 : {
123 0 : FunctionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
124 0 : }
125 :
126 : // report::XFunction:
127 0 : sal_Bool SAL_CALL OFunction::getPreEvaluated() throw (uno::RuntimeException, std::exception)
128 : {
129 0 : osl::MutexGuard g(m_aMutex);
130 0 : return m_bPreEvaluated;
131 : }
132 :
133 :
134 0 : void SAL_CALL OFunction::setPreEvaluated(sal_Bool the_value) throw (uno::RuntimeException, std::exception)
135 : {
136 0 : set(PROPERTY_PREEVALUATED,the_value,m_bPreEvaluated);
137 0 : }
138 :
139 0 : sal_Bool SAL_CALL OFunction::getDeepTraversing() throw (uno::RuntimeException, std::exception)
140 : {
141 0 : osl::MutexGuard g(m_aMutex);
142 0 : return m_bDeepTraversing;
143 : }
144 :
145 :
146 0 : void SAL_CALL OFunction::setDeepTraversing(sal_Bool the_value) throw (uno::RuntimeException, std::exception)
147 : {
148 0 : set(PROPERTY_DEEPTRAVERSING,the_value,m_bDeepTraversing);
149 0 : }
150 :
151 :
152 0 : OUString SAL_CALL OFunction::getName() throw (uno::RuntimeException, std::exception)
153 : {
154 0 : osl::MutexGuard g(m_aMutex);
155 0 : return m_sName;
156 : }
157 :
158 :
159 0 : void SAL_CALL OFunction::setName(const OUString & the_value) throw (uno::RuntimeException, std::exception)
160 : {
161 0 : set(PROPERTY_NAME,the_value,m_sName);
162 0 : }
163 :
164 0 : OUString SAL_CALL OFunction::getFormula() throw (uno::RuntimeException, std::exception)
165 : {
166 0 : osl::MutexGuard g(m_aMutex);
167 0 : return m_sFormula;
168 : }
169 :
170 0 : void SAL_CALL OFunction::setFormula(const OUString & the_value) throw (uno::RuntimeException, std::exception)
171 : {
172 0 : set(PROPERTY_FORMULA,the_value,m_sFormula);
173 0 : }
174 :
175 0 : beans::Optional< OUString> SAL_CALL OFunction::getInitialFormula() throw (uno::RuntimeException, std::exception)
176 : {
177 0 : osl::MutexGuard g(m_aMutex);
178 0 : return m_sInitialFormula;
179 : }
180 :
181 0 : void SAL_CALL OFunction::setInitialFormula(const beans::Optional< OUString> & the_value) throw (uno::RuntimeException, std::exception)
182 : {
183 0 : set(PROPERTY_INITIALFORMULA,the_value,m_sInitialFormula);
184 0 : }
185 :
186 : // XChild
187 0 : uno::Reference< uno::XInterface > SAL_CALL OFunction::getParent( ) throw (uno::RuntimeException, std::exception)
188 : {
189 0 : osl::MutexGuard g(m_aMutex);
190 0 : return m_xParent;
191 : }
192 :
193 0 : void SAL_CALL OFunction::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException, std::exception)
194 : {
195 0 : osl::MutexGuard g(m_aMutex);
196 0 : if ( Parent.is() )
197 : {
198 0 : uno::Reference< report::XFunctions> xFunctions(Parent,uno::UNO_QUERY_THROW);
199 0 : m_xParent = xFunctions;
200 : }
201 : else
202 0 : m_xParent = uno::WeakReference< report::XFunctions >();
203 0 : }
204 :
205 :
206 :
207 : } // namespace reportdesign
208 :
209 :
210 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|