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 RPT_FORMATCONDITION_HXX
20 : #define RPT_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 : ::rtl::OUString m_sFormula;
46 : sal_Bool m_bEnabled;
47 : private:
48 : OFormatCondition(const OFormatCondition&);
49 : OFormatCondition& operator=(const OFormatCondition&);
50 :
51 0 : template <typename T> void set( const ::rtl::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 : protected:
64 : virtual ~OFormatCondition();
65 : public:
66 : explicit OFormatCondition(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext
67 : );
68 :
69 : DECLARE_XINTERFACE( )
70 : // ::com::sun::star::lang::XServiceInfo
71 : virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
72 : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
73 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
74 :
75 : static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
76 : static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
77 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
78 : create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
79 : // com::sun::star::beans::XPropertySet
80 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
81 : virtual void SAL_CALL setPropertyValue( const ::rtl::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);
82 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
83 : virtual void SAL_CALL addPropertyChangeListener( const ::rtl::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);
84 : virtual void SAL_CALL removePropertyChangeListener( const ::rtl::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);
85 : virtual void SAL_CALL addVetoableChangeListener( const ::rtl::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);
86 : virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::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);
87 :
88 : // XFormatCondition
89 : virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
90 : virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException);
91 : virtual ::rtl::OUString SAL_CALL getFormula() throw (::com::sun::star::uno::RuntimeException);
92 : virtual void SAL_CALL setFormula( const ::rtl::OUString& _formula ) throw (::com::sun::star::uno::RuntimeException);
93 :
94 : // XReportControlFormat
95 : REPORTCONTROLFORMAT_HEADER()
96 : // XComponent
97 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
98 0 : virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
99 : {
100 0 : cppu::WeakComponentImplHelperBase::addEventListener(aListener);
101 0 : }
102 0 : virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
103 : {
104 0 : cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
105 0 : }
106 : };
107 : }
108 : #endif //RPT_FORMATCONDITION_HXX
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|