LibreOffice Module reportdesign (master) 1
FormatCondition.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_FORMATCONDITION_HXX
20#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATCONDITION_HXX
21
23#include <com/sun/star/report/XFormatCondition.hpp>
25#include <comphelper/uno3.hxx>
28#include <com/sun/star/lang/XServiceInfo.hpp>
30
31namespace reportdesign
32{
33 typedef ::cppu::PropertySetMixin< css::report::XFormatCondition > FormatConditionPropertySet;
34 typedef ::cppu::WeakComponentImplHelper< css::report::XFormatCondition
35 ,css::lang::XServiceInfo > FormatConditionBase;
36
41 class OFormatCondition final : public cppu::BaseMutex,
44 {
46 OUString m_sFormula;
48 private:
51
52 // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16
53 void set( const OUString& _sProperty
54 ,sal_Int16 Value
55 ,css::style::ParagraphAdjust& _member)
56 {
57 BoundListeners l;
58 {
59 ::osl::MutexGuard aGuard(m_aMutex);
60 if ( static_cast<sal_Int16>(_member) != Value )
61 {
62 prepareSet(_sProperty, css::uno::Any(static_cast<sal_Int16>(_member)), css::uno::Any(Value), &l);
63 _member = static_cast<css::style::ParagraphAdjust>(Value);
64 }
65 }
66 l.notify();
67 }
68 template <typename T> void set( const OUString& _sProperty
69 ,const T& Value
70 ,T& _member)
71 {
72 BoundListeners l;
73 {
74 ::osl::MutexGuard aGuard(m_aMutex);
75 if ( _member != Value )
76 {
77 prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
78 _member = Value;
79 }
80 }
81 l.notify();
82 }
83 void set( const OUString& _sProperty
84 ,bool Value
85 ,bool& _member)
86 {
87 BoundListeners l;
88 {
89 ::osl::MutexGuard aGuard(m_aMutex);
90 if ( _member != Value )
91 {
92 prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
93 _member = Value;
94 }
95 }
96 l.notify();
97 }
98 virtual ~OFormatCondition() override;
99 public:
100 explicit OFormatCondition(css::uno::Reference< css::uno::XComponentContext > const & _xContext
101 );
102
104 // css::lang::XServiceInfo
105 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
106 virtual OUString SAL_CALL getImplementationName( ) override;
107 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
108
110 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
112 static OUString getImplementationName_Static();
113 static css::uno::Reference< css::uno::XInterface >
114 create(css::uno::Reference< css::uno::XComponentContext > const & xContext);
115 // css::beans::XPropertySet
116 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
117 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
118 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
119 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
120 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
121 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
122 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
123
124 // XFormatCondition
125 virtual sal_Bool SAL_CALL getEnabled() override;
126 virtual void SAL_CALL setEnabled( sal_Bool _enabled ) override;
127 virtual OUString SAL_CALL getFormula() override;
128 virtual void SAL_CALL setFormula( const OUString& _formula ) override;
129
130 // XReportControlFormat
132 // XComponent
133 virtual void SAL_CALL dispose() override;
134 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
135 {
136 cppu::WeakComponentImplHelperBase::addEventListener(aListener);
137 }
138 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
139 {
140 cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
141 }
142 };
143}
144#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATCONDITION_HXX
145
146/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define REPORTCONTROLFORMAT_HEADER()
mutable::osl::Mutex m_aMutex
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
OFormatProperties m_aFormatProperties
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
void set(const OUString &_sProperty, bool Value, bool &_member)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
OFormatCondition(css::uno::Reference< css::uno::XComponentContext > const &_xContext)
virtual void SAL_CALL dispose() override
virtual OUString SAL_CALL getImplementationName() override
void set(const OUString &_sProperty, const T &Value, T &_member)
OFormatCondition(const OFormatCondition &)=delete
virtual ~OFormatCondition() override
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
static css::uno::Reference< css::uno::XInterface > create(css::uno::Reference< css::uno::XComponentContext > const &xContext)
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL setFormula(const OUString &_formula) override
void set(const OUString &_sProperty, sal_Int16 Value, css::style::ParagraphAdjust &_member)
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual sal_Bool SAL_CALL getEnabled() override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
static OUString getImplementationName_Static()
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getFormula() override
virtual void SAL_CALL setEnabled(sal_Bool _enabled) override
OFormatCondition & operator=(const OFormatCondition &)=delete
Value
::cppu::PropertySetMixin< css::report::XFormatCondition > FormatConditionPropertySet
::cppu::WeakComponentImplHelper< css::report::XFormatCondition,css::lang::XServiceInfo > FormatConditionBase
unsigned char sal_Bool
#define DECLARE_XINTERFACE()