LibreOffice Module reportdesign (master)  1
Function.cxx
Go to the documentation of this file.
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 <strings.hxx>
22 
23 namespace reportdesign
24 {
25 
26  using namespace com::sun::star;
27 
28 
29 OFunction::OFunction(uno::Reference< uno::XComponentContext > const & _xContext)
31 ,FunctionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >())
32 ,m_bPreEvaluated(false)
33 ,m_bDeepTraversing(false)
34 {
35  m_sInitialFormula.IsPresent = false;
36 }
37 
39 {
40 }
41 
43 
44 void SAL_CALL OFunction::dispose()
45 {
47  cppu::WeakComponentImplHelperBase::dispose();
48 }
49 
51 {
52  return "com.sun.star.comp.report.OFunction";
53 }
54 
55 uno::Sequence< OUString > SAL_CALL OFunction::getSupportedServiceNames( )
56 {
57  return { SERVICE_FUNCTION };
58 }
59 
60 sal_Bool SAL_CALL OFunction::supportsService(const OUString& ServiceName)
61 {
62  return cppu::supportsService(this, ServiceName);
63 }
64 
65 uno::Reference< beans::XPropertySetInfo > SAL_CALL OFunction::getPropertySetInfo( )
66 {
68 }
69 
70 void SAL_CALL OFunction::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
71 {
72  FunctionPropertySet::setPropertyValue( aPropertyName, aValue );
73 }
74 
75 uno::Any SAL_CALL OFunction::getPropertyValue( const OUString& PropertyName )
76 {
77  return FunctionPropertySet::getPropertyValue( PropertyName);
78 }
79 
80 void SAL_CALL OFunction::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
81 {
82  FunctionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
83 }
84 
85 void SAL_CALL OFunction::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
86 {
87  FunctionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
88 }
89 
90 void SAL_CALL OFunction::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
91 {
92  FunctionPropertySet::addVetoableChangeListener( PropertyName, aListener );
93 }
94 
95 void SAL_CALL OFunction::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
96 {
97  FunctionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
98 }
99 
100 // report::XFunction:
102 {
103  osl::MutexGuard g(m_aMutex);
104  return m_bPreEvaluated;
105 }
106 
107 
108 void SAL_CALL OFunction::setPreEvaluated(sal_Bool the_value)
109 {
111 }
112 
114 {
115  osl::MutexGuard g(m_aMutex);
116  return m_bDeepTraversing;
117 }
118 
119 
120 void SAL_CALL OFunction::setDeepTraversing(sal_Bool the_value)
121 {
123 }
124 
125 
126 OUString SAL_CALL OFunction::getName()
127 {
128  osl::MutexGuard g(m_aMutex);
129  return m_sName;
130 }
131 
132 
133 void SAL_CALL OFunction::setName(const OUString & the_value)
134 {
135  set(PROPERTY_NAME,the_value,m_sName);
136 }
137 
138 OUString SAL_CALL OFunction::getFormula()
139 {
140  osl::MutexGuard g(m_aMutex);
141  return m_sFormula;
142 }
143 
144 void SAL_CALL OFunction::setFormula(const OUString & the_value)
145 {
146  set(PROPERTY_FORMULA,the_value,m_sFormula);
147 }
148 
149 beans::Optional< OUString> SAL_CALL OFunction::getInitialFormula()
150 {
151  osl::MutexGuard g(m_aMutex);
152  return m_sInitialFormula;
153 }
154 
155 void SAL_CALL OFunction::setInitialFormula(const beans::Optional< OUString> & the_value)
156 {
158 }
159 
160 // XChild
161 uno::Reference< uno::XInterface > SAL_CALL OFunction::getParent( )
162 {
163  osl::MutexGuard g(m_aMutex);
164  return m_xParent;
165 }
166 
167 void SAL_CALL OFunction::setParent( const uno::Reference< uno::XInterface >& Parent )
168 {
169  osl::MutexGuard g(m_aMutex);
170  if ( Parent.is() )
171  {
172  uno::Reference< report::XFunctions> xFunctions(Parent,uno::UNO_QUERY_THROW);
173  m_xParent = xFunctions;
174  }
175  else
176  m_xParent.clear();
177 }
178 
179 
180 } // namespace reportdesign
181 
182 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
184  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
185 {
186  return cppu::acquire(new reportdesign::OFunction(context));
187 }
188 
189 
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void set(const OUString &_sProperty, const T &Value, T &_member)
Definition: Function.hxx:54
virtual OUString SAL_CALL getFormula() override
Definition: Function.cxx:138
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
#define PROPERTY_DEEPTRAVERSING
Definition: strings.hxx:198
virtual css::beans::Optional< OUString > SAL_CALL getInitialFormula() override
Definition: Function.cxx:149
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Function.cxx:95
#define SERVICE_FUNCTION
Definition: strings.hxx:26
osl::Mutex m_aMutex
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() SAL_OVERRIDE
virtual OUString SAL_CALL getName() override
Definition: Function.cxx:126
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: Function.cxx:75
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: Function.cxx:167
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: Function.cxx:161
virtual void SAL_CALL setName(const OUString &the_value) override
Definition: Function.cxx:133
mutable::osl::Mutex m_aMutex
virtual ~OFunction() override
Definition: Function.cxx:38
css::beans::Optional< OUString > m_sInitialFormula
Definition: Function.hxx:44
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: Function.cxx:70
::cppu::PropertySetMixin< css::report::XFunction > FunctionPropertySet
Definition: Function.hxx:32
virtual void SAL_CALL removePropertyChangeListener(rtl::OUString const &propertyName, css::uno::Reference< css::beans::XPropertyChangeListener > const &listener) SAL_OVERRIDE
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Function.cxx:90
virtual void SAL_CALL setInitialFormula(const css::beans::Optional< OUString > &the_value) override
Definition: Function.cxx:155
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: Function.cxx:80
implementation of a
Definition: Function.hxx:40
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: Function.cxx:60
virtual void SAL_CALL setPropertyValue(rtl::OUString const &propertyName, css::uno::Any const &value) SAL_OVERRIDE
virtual void SAL_CALL setPreEvaluated(sal_Bool the_value) override
Definition: Function.cxx:108
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Function.cxx:55
#define PROPERTY_NAME
Definition: strings.hxx:36
virtual OUString SAL_CALL getImplementationName() override
Definition: Function.cxx:50
#define PROPERTY_FORMULA
Definition: strings.hxx:195
virtual void SAL_CALL setDeepTraversing(sal_Bool the_value) override
Definition: Function.cxx:120
unsigned char sal_Bool
virtual sal_Bool SAL_CALL getPreEvaluated() override
Definition: Function.cxx:101
virtual void SAL_CALL addPropertyChangeListener(rtl::OUString const &propertyName, css::uno::Reference< css::beans::XPropertyChangeListener > const &listener) SAL_OVERRIDE
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: Function.cxx:65
virtual void SAL_CALL setFormula(const OUString &the_value) override
Definition: Function.cxx:144
virtual css::uno::Any SAL_CALL getPropertyValue(rtl::OUString const &propertyName) SAL_OVERRIDE
virtual sal_Bool SAL_CALL getDeepTraversing() override
Definition: Function.cxx:113
#define PROPERTY_PREEVALUATED
Definition: strings.hxx:197
virtual void SAL_CALL addVetoableChangeListener(rtl::OUString const &propertyName, css::uno::Reference< css::beans::XVetoableChangeListener > const &listener) SAL_OVERRIDE
OFunction(const OFunction &)=delete
virtual void SAL_CALL removeVetoableChangeListener(rtl::OUString const &propertyName, css::uno::Reference< css::beans::XVetoableChangeListener > const &listener) SAL_OVERRIDE
css::uno::WeakReference< css::report::XFunctions > m_xParent
Definition: Function.hxx:45
::cppu::WeakComponentImplHelper< css::report::XFunction,css::lang::XServiceInfo > FunctionBase
Definition: Function.hxx:34
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * reportdesign_OFunction_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: Function.cxx:183
#define PROPERTY_INITIALFORMULA
Definition: strings.hxx:196
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: Function.cxx:85