LibreOffice Module reportdesign (master)  1
Function.hxx
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 #ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTION_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTION_HXX
21 
22 #include <comphelper/uno3.hxx>
24 #include <com/sun/star/report/XFunction.hpp>
25 #include <com/sun/star/report/XFunctions.hpp>
26 #include <cppuhelper/basemutex.hxx>
27 #include <cppuhelper/compbase.hxx>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 
30 namespace reportdesign
31 {
32  typedef ::cppu::PropertySetMixin< css::report::XFunction > FunctionPropertySet;
33  typedef ::cppu::WeakComponentImplHelper< css::report::XFunction
34  ,css::lang::XServiceInfo > FunctionBase;
35 
40  class OFunction : public cppu::BaseMutex,
41  public FunctionBase,
42  public FunctionPropertySet
43  {
44  css::beans::Optional< OUString> m_sInitialFormula;
45  css::uno::WeakReference< css::report::XFunctions > m_xParent;
46  OUString m_sName;
47  OUString m_sFormula;
50  private:
51  OFunction(const OFunction&) = delete;
52  OFunction& operator=(const OFunction&) = delete;
53 
54  template <typename T> void set( const OUString& _sProperty
55  ,const T& Value
56  ,T& _member)
57  {
58  BoundListeners l;
59  {
60  ::osl::MutexGuard aGuard(m_aMutex);
61  prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
62  _member = Value;
63  }
64  l.notify();
65  }
66  void set( const OUString& _sProperty
67  ,bool Value
68  ,bool& _member)
69  {
70  BoundListeners l;
71  {
72  ::osl::MutexGuard aGuard(m_aMutex);
73  prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
74  _member = Value;
75  }
76  l.notify();
77  }
78  protected:
79  virtual ~OFunction() override;
80  public:
81  explicit OFunction(css::uno::Reference< css::uno::XComponentContext > const & _xContext);
82 
84  // css::lang::XServiceInfo
85  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
86  virtual OUString SAL_CALL getImplementationName( ) override;
87  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
88 
89  // css::beans::XPropertySet
90  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
91  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
92  virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
93  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
94  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
95  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
96  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
97 
98  // css::report::XFunction:
99  virtual sal_Bool SAL_CALL getPreEvaluated() override;
100  virtual void SAL_CALL setPreEvaluated(sal_Bool the_value) override;
101  virtual sal_Bool SAL_CALL getDeepTraversing() override;
102  virtual void SAL_CALL setDeepTraversing(sal_Bool the_value) override;
103  virtual OUString SAL_CALL getName() override;
104  virtual void SAL_CALL setName(const OUString & the_value) override;
105  virtual OUString SAL_CALL getFormula() override;
106  virtual void SAL_CALL setFormula(const OUString & the_value) override;
107  virtual css::beans::Optional< OUString> SAL_CALL getInitialFormula() override;
108  virtual void SAL_CALL setInitialFormula(const css::beans::Optional< OUString> & the_value) override;
109 
110  // XComponent
111  virtual void SAL_CALL dispose() override;
112  virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
113  {
114  cppu::WeakComponentImplHelperBase::addEventListener(aListener);
115  }
116  virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
117  {
118  cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
119  }
120 
121  // XChild
122  virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
123  virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
124  };
125 }
126 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTION_HXX
127 
128 /* 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
virtual void SAL_CALL dispose() override
Definition: Function.cxx:44
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
OFunction & operator=(const OFunction &)=delete
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 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
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 setPreEvaluated(sal_Bool the_value) override
Definition: Function.cxx:108
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Function.cxx:55
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Function.hxx:116
virtual OUString SAL_CALL getImplementationName() override
Definition: Function.cxx:50
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 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: Function.cxx:65
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Function.hxx:112
virtual void SAL_CALL setFormula(const OUString &the_value) override
Definition: Function.cxx:144
virtual sal_Bool SAL_CALL getDeepTraversing() override
Definition: Function.cxx:113
OFunction(const OFunction &)=delete
void set(const OUString &_sProperty, bool Value, bool &_member)
Definition: Function.hxx:66
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
#define DECLARE_XINTERFACE()
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: Function.cxx:85