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 
90  static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
92  static OUString getImplementationName_Static();
93  static css::uno::Reference< css::uno::XInterface >
94  create(css::uno::Reference< css::uno::XComponentContext > const & xContext);
95  // css::beans::XPropertySet
96  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
97  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
98  virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
99  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
100  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
101  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
102  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
103 
104  // css::report::XFunction:
105  virtual sal_Bool SAL_CALL getPreEvaluated() override;
106  virtual void SAL_CALL setPreEvaluated(sal_Bool the_value) override;
107  virtual sal_Bool SAL_CALL getDeepTraversing() override;
108  virtual void SAL_CALL setDeepTraversing(sal_Bool the_value) override;
109  virtual OUString SAL_CALL getName() override;
110  virtual void SAL_CALL setName(const OUString & the_value) override;
111  virtual OUString SAL_CALL getFormula() override;
112  virtual void SAL_CALL setFormula(const OUString & the_value) override;
113  virtual css::beans::Optional< OUString> SAL_CALL getInitialFormula() override;
114  virtual void SAL_CALL setInitialFormula(const css::beans::Optional< OUString> & the_value) override;
115 
116  // XComponent
117  virtual void SAL_CALL dispose() override;
118  virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
119  {
120  cppu::WeakComponentImplHelperBase::addEventListener(aListener);
121  }
122  virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
123  {
124  cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
125  }
126 
127  // XChild
128  virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
129  virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
130  };
131 }
132 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTION_HXX
133 
134 /* 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:156
virtual void SAL_CALL dispose() override
Definition: Function.cxx:49
virtual css::beans::Optional< OUString > SAL_CALL getInitialFormula() override
Definition: Function.cxx:167
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Function.cxx:113
OFunction & operator=(const OFunction &)=delete
virtual OUString SAL_CALL getName() override
Definition: Function.cxx:144
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: Function.cxx:93
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: Function.cxx:185
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: Function.cxx:179
virtual void SAL_CALL setName(const OUString &the_value) override
Definition: Function.cxx:151
mutable::osl::Mutex m_aMutex
virtual ~OFunction() override
Definition: Function.cxx:43
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:88
::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:108
virtual void SAL_CALL setInitialFormula(const css::beans::Optional< OUString > &the_value) override
Definition: Function.cxx:173
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: Function.cxx:98
implementation of a
Definition: Function.hxx:40
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: Function.cxx:78
virtual void SAL_CALL setPreEvaluated(sal_Bool the_value) override
Definition: Function.cxx:126
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Function.cxx:73
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Function.hxx:122
virtual OUString SAL_CALL getImplementationName() override
Definition: Function.cxx:61
virtual void SAL_CALL setDeepTraversing(sal_Bool the_value) override
Definition: Function.cxx:138
unsigned char sal_Bool
virtual sal_Bool SAL_CALL getPreEvaluated() override
Definition: Function.cxx:119
static css::uno::Reference< css::uno::XInterface > create(css::uno::Reference< css::uno::XComponentContext > const &xContext)
Definition: Function.cxx:28
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: Function.cxx:83
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:118
virtual void SAL_CALL setFormula(const OUString &the_value) override
Definition: Function.cxx:162
static OUString getImplementationName_Static()
Definition: Function.cxx:55
virtual sal_Bool SAL_CALL getDeepTraversing() override
Definition: Function.cxx:131
OFunction(const OFunction &)=delete
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
Definition: Function.cxx:66
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:103