Line data Source code
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 :
22 : #include <cppuhelper/propertysetmixin.hxx>
23 : #include <com/sun/star/report/XFormatCondition.hpp>
24 : #include "ReportControlModel.hxx"
25 : #include <cppuhelper/compbase2.hxx>
26 : #include <comphelper/broadcasthelper.hxx>
27 : #include <com/sun/star/lang/XServiceInfo.hpp>
28 : #include "ReportHelperDefines.hxx"
29 :
30 : namespace reportdesign
31 : {
32 : typedef ::cppu::PropertySetMixin< com::sun::star::report::XFormatCondition > FormatConditionPropertySet;
33 : typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XFormatCondition
34 : ,com::sun::star::lang::XServiceInfo > FormatConditionBase;
35 :
36 : /** \class OFormatCondition Defines the implementation of a \interface com:::sun::star::report::XFormatCondition
37 : * \ingroup reportdesign_api
38 : *
39 : */
40 : class OFormatCondition : public comphelper::OBaseMutex,
41 : public FormatConditionBase,
42 : public FormatConditionPropertySet
43 : {
44 : OFormatProperties m_aFormatProperties;
45 : OUString m_sFormula;
46 : bool m_bEnabled;
47 : private:
48 : OFormatCondition(const OFormatCondition&);
49 : OFormatCondition& operator=(const OFormatCondition&);
50 :
51 0 : template <typename T> void set( const OUString& _sProperty
52 : ,const T& _Value
53 : ,T& _member)
54 : {
55 0 : BoundListeners l;
56 : {
57 0 : ::osl::MutexGuard aGuard(m_aMutex);
58 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
59 0 : _member = _Value;
60 : }
61 0 : l.notify();
62 0 : }
63 0 : void set( const OUString& _sProperty
64 : ,bool _Value
65 : ,bool& _member)
66 : {
67 0 : BoundListeners l;
68 : {
69 0 : ::osl::MutexGuard aGuard(m_aMutex);
70 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
71 0 : _member = _Value;
72 : }
73 0 : l.notify();
74 0 : }
75 : protected:
76 : virtual ~OFormatCondition();
77 : public:
78 : explicit OFormatCondition(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext
79 : );
80 :
81 : DECLARE_XINTERFACE( )
82 : // ::com::sun::star::lang::XServiceInfo
83 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 :
87 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
88 : static OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
89 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
90 : create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
91 : // com::sun::star::beans::XPropertySet
92 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 :
100 : // XFormatCondition
101 : virtual sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 : virtual OUString SAL_CALL getFormula() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : virtual void SAL_CALL setFormula( const OUString& _formula ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 :
106 : // XReportControlFormat
107 : REPORTCONTROLFORMAT_HEADER()
108 : // XComponent
109 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 0 : virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
111 : {
112 0 : cppu::WeakComponentImplHelperBase::addEventListener(aListener);
113 0 : }
114 0 : virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
115 : {
116 0 : cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
117 0 : }
118 : };
119 : }
120 : #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATCONDITION_HXX
121 :
122 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|