lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / reportdesign / source / core / inc / FormatCondition.hxx
blob409b1198f7efb4bedd11d6fa84cc7c491af1e9d3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATCONDITION_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATCONDITION_HXX
22 #include <cppuhelper/propertysetmixin.hxx>
23 #include <com/sun/star/report/XFormatCondition.hpp>
24 #include "ReportControlModel.hxx"
25 #include <comphelper/uno3.hxx>
26 #include <cppuhelper/compbase.hxx>
27 #include <cppuhelper/basemutex.hxx>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <ReportHelperDefines.hxx>
31 namespace reportdesign
33 typedef ::cppu::PropertySetMixin< css::report::XFormatCondition > FormatConditionPropertySet;
34 typedef ::cppu::WeakComponentImplHelper< css::report::XFormatCondition
35 ,css::lang::XServiceInfo > FormatConditionBase;
37 /** \class OFormatCondition Defines the implementation of a \interface com:::sun::star::report::XFormatCondition
38 * \ingroup reportdesign_api
41 class OFormatCondition : public cppu::BaseMutex,
42 public FormatConditionBase,
43 public FormatConditionPropertySet
45 OFormatProperties m_aFormatProperties;
46 OUString m_sFormula;
47 bool m_bEnabled;
48 private:
49 OFormatCondition(const OFormatCondition&) = delete;
50 OFormatCondition& operator=(const OFormatCondition&) = delete;
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)
57 BoundListeners l;
59 ::osl::MutexGuard aGuard(m_aMutex);
60 if ( static_cast<sal_Int16>(_member) != Value )
62 prepareSet(_sProperty, css::uno::makeAny(static_cast<sal_Int16>(_member)), css::uno::makeAny(Value), &l);
63 _member = static_cast<css::style::ParagraphAdjust>(Value);
66 l.notify();
68 template <typename T> void set( const OUString& _sProperty
69 ,const T& Value
70 ,T& _member)
72 BoundListeners l;
74 ::osl::MutexGuard aGuard(m_aMutex);
75 if ( _member != Value )
77 prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
78 _member = Value;
81 l.notify();
83 void set( const OUString& _sProperty
84 ,bool Value
85 ,bool& _member)
87 BoundListeners l;
89 ::osl::MutexGuard aGuard(m_aMutex);
90 if ( _member != Value )
92 prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
93 _member = Value;
96 l.notify();
98 protected:
99 virtual ~OFormatCondition() override;
100 public:
101 explicit OFormatCondition(css::uno::Reference< css::uno::XComponentContext > const & _xContext
104 DECLARE_XINTERFACE( )
105 // css::lang::XServiceInfo
106 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
107 virtual OUString SAL_CALL getImplementationName( ) override;
108 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
110 /// @throws css::uno::RuntimeException
111 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
112 /// @throws css::uno::RuntimeException
113 static OUString getImplementationName_Static();
114 static css::uno::Reference< css::uno::XInterface >
115 create(css::uno::Reference< css::uno::XComponentContext > const & xContext);
116 // css::beans::XPropertySet
117 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
118 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
119 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
120 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
121 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
122 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
123 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
125 // XFormatCondition
126 virtual sal_Bool SAL_CALL getEnabled() override;
127 virtual void SAL_CALL setEnabled( sal_Bool _enabled ) override;
128 virtual OUString SAL_CALL getFormula() override;
129 virtual void SAL_CALL setFormula( const OUString& _formula ) override;
131 // XReportControlFormat
132 REPORTCONTROLFORMAT_HEADER()
133 // XComponent
134 virtual void SAL_CALL dispose() override;
135 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
137 cppu::WeakComponentImplHelperBase::addEventListener(aListener);
139 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
141 cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
145 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATCONDITION_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */