19e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39e0e4191SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49e0e4191SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59e0e4191SAndrew Rist  * distributed with this work for additional information
69e0e4191SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79e0e4191SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89e0e4191SAndrew Rist  * "License"); you may not use this file except in compliance
99e0e4191SAndrew Rist  * with the License.  You may obtain a copy of the License at
109e0e4191SAndrew Rist  *
119e0e4191SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
129e0e4191SAndrew Rist  *
139e0e4191SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149e0e4191SAndrew Rist  * software distributed under the License is distributed on an
159e0e4191SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169e0e4191SAndrew Rist  * KIND, either express or implied.  See the License for the
179e0e4191SAndrew Rist  * specific language governing permissions and limitations
189e0e4191SAndrew Rist  * under the License.
199e0e4191SAndrew Rist  *
209e0e4191SAndrew Rist  *************************************************************/
219e0e4191SAndrew Rist 
229e0e4191SAndrew Rist 
23*b63233d8Sdamjan #include "precompiled_reportdesign.hxx"
24cdf0e10cSrcweir #include "FormatCondition.hxx"
25cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
26cdf0e10cSrcweir #include "corestrings.hrc"
27cdf0e10cSrcweir #include <tools/debug.hxx>
28cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
29cdf0e10cSrcweir #include <comphelper/sequence.hxx>
30cdf0e10cSrcweir #include <comphelper/property.hxx>
31cdf0e10cSrcweir #include "Tools.hxx"
32cdf0e10cSrcweir #include <com/sun/star/text/ParagraphVertAlign.hpp>
33cdf0e10cSrcweir #include "ReportHelperImpl.hxx"
34cdf0e10cSrcweir #include "corestrings.hrc"
35cdf0e10cSrcweir // =============================================================================
36cdf0e10cSrcweir namespace reportdesign
37cdf0e10cSrcweir {
38cdf0e10cSrcweir // =============================================================================
39cdf0e10cSrcweir 	using namespace com::sun::star;
40cdf0e10cSrcweir 	using namespace comphelper;
41cdf0e10cSrcweir //------------------------------------------------------------------------------
create(uno::Reference<uno::XComponentContext> const & xContext)42cdf0e10cSrcweir uno::Reference< uno::XInterface > OFormatCondition::create(uno::Reference< uno::XComponentContext > const & xContext)
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	return *(new OFormatCondition(xContext));
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
DBG_NAME(rpt_OFormatCondition)47cdf0e10cSrcweir DBG_NAME( rpt_OFormatCondition )
48cdf0e10cSrcweir // -----------------------------------------------------------------------------
49cdf0e10cSrcweir OFormatCondition::OFormatCondition(uno::Reference< uno::XComponentContext > const & _xContext)
50cdf0e10cSrcweir :FormatConditionBase(m_aMutex)
51cdf0e10cSrcweir ,FormatConditionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >())
52cdf0e10cSrcweir ,m_bEnabled(sal_True)
53cdf0e10cSrcweir {
54cdf0e10cSrcweir 	DBG_CTOR( rpt_OFormatCondition,NULL);
55cdf0e10cSrcweir }
56cdf0e10cSrcweir // -----------------------------------------------------------------------------
~OFormatCondition()57cdf0e10cSrcweir OFormatCondition::~OFormatCondition()
58cdf0e10cSrcweir {
59cdf0e10cSrcweir     DBG_DTOR( rpt_OFormatCondition,NULL);
60cdf0e10cSrcweir }
61cdf0e10cSrcweir // -----------------------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2(OFormatCondition,FormatConditionBase,FormatConditionPropertySet)62cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2(OFormatCondition,FormatConditionBase,FormatConditionPropertySet)
63cdf0e10cSrcweir // -----------------------------------------------------------------------------
64cdf0e10cSrcweir void SAL_CALL OFormatCondition::dispose() throw(uno::RuntimeException)
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	FormatConditionPropertySet::dispose();
67cdf0e10cSrcweir 	cppu::WeakComponentImplHelperBase::dispose();
68cdf0e10cSrcweir }
69cdf0e10cSrcweir // -----------------------------------------------------------------------------
getImplementationName_Static()70cdf0e10cSrcweir ::rtl::OUString OFormatCondition::getImplementationName_Static(  ) throw(uno::RuntimeException)
71cdf0e10cSrcweir {
72cdf0e10cSrcweir 	return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OFormatCondition"));
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir //--------------------------------------------------------------------------
getImplementationName()76cdf0e10cSrcweir ::rtl::OUString SAL_CALL OFormatCondition::getImplementationName(  ) throw(uno::RuntimeException)
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	return getImplementationName_Static();
79cdf0e10cSrcweir }
80cdf0e10cSrcweir //--------------------------------------------------------------------------
getSupportedServiceNames_Static()81cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > OFormatCondition::getSupportedServiceNames_Static(  ) throw(uno::RuntimeException)
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString > aServices(1);
84cdf0e10cSrcweir 	aServices.getArray()[0] = SERVICE_FORMATCONDITION;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	return aServices;
87cdf0e10cSrcweir }
88cdf0e10cSrcweir //--------------------------------------------------------------------------
getSupportedServiceNames()89cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL OFormatCondition::getSupportedServiceNames(  ) throw(uno::RuntimeException)
90cdf0e10cSrcweir {
91cdf0e10cSrcweir 	return getSupportedServiceNames_Static();
92cdf0e10cSrcweir }
93cdf0e10cSrcweir //------------------------------------------------------------------------------
supportsService(const::rtl::OUString & ServiceName)94cdf0e10cSrcweir sal_Bool SAL_CALL OFormatCondition::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException )
95cdf0e10cSrcweir {
96cdf0e10cSrcweir 	return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static());
97cdf0e10cSrcweir }
98cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPropertySetInfo()99cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL OFormatCondition::getPropertySetInfo(  ) throw(uno::RuntimeException)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir 	return FormatConditionPropertySet::getPropertySetInfo();
102cdf0e10cSrcweir }
103cdf0e10cSrcweir // -----------------------------------------------------------------------------
setPropertyValue(const::rtl::OUString & aPropertyName,const uno::Any & aValue)104cdf0e10cSrcweir void SAL_CALL OFormatCondition::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
105cdf0e10cSrcweir {
106cdf0e10cSrcweir 	FormatConditionPropertySet::setPropertyValue( aPropertyName, aValue );
107cdf0e10cSrcweir }
108cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPropertyValue(const::rtl::OUString & PropertyName)109cdf0e10cSrcweir uno::Any SAL_CALL OFormatCondition::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
110cdf0e10cSrcweir {
111cdf0e10cSrcweir 	return FormatConditionPropertySet::getPropertyValue( PropertyName);
112cdf0e10cSrcweir }
113cdf0e10cSrcweir // -----------------------------------------------------------------------------
addPropertyChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XPropertyChangeListener> & xListener)114cdf0e10cSrcweir void SAL_CALL OFormatCondition::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
115cdf0e10cSrcweir {
116cdf0e10cSrcweir 	FormatConditionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
117cdf0e10cSrcweir }
118cdf0e10cSrcweir // -----------------------------------------------------------------------------
removePropertyChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XPropertyChangeListener> & aListener)119cdf0e10cSrcweir void SAL_CALL OFormatCondition::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
120cdf0e10cSrcweir {
121cdf0e10cSrcweir 	FormatConditionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
122cdf0e10cSrcweir }
123cdf0e10cSrcweir // -----------------------------------------------------------------------------
addVetoableChangeListener(const::rtl::OUString & PropertyName,const uno::Reference<beans::XVetoableChangeListener> & aListener)124cdf0e10cSrcweir void SAL_CALL OFormatCondition::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
125cdf0e10cSrcweir {
126cdf0e10cSrcweir 	FormatConditionPropertySet::addVetoableChangeListener( PropertyName, aListener );
127cdf0e10cSrcweir }
128cdf0e10cSrcweir // -----------------------------------------------------------------------------
removeVetoableChangeListener(const::rtl::OUString & PropertyName,const uno::Reference<beans::XVetoableChangeListener> & aListener)129cdf0e10cSrcweir void SAL_CALL OFormatCondition::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
130cdf0e10cSrcweir {
131cdf0e10cSrcweir 	FormatConditionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
132cdf0e10cSrcweir }
133cdf0e10cSrcweir // -----------------------------------------------------------------------------
134cdf0e10cSrcweir // XFormatCondition
getEnabled()135cdf0e10cSrcweir ::sal_Bool SAL_CALL OFormatCondition::getEnabled() throw (uno::RuntimeException)
136cdf0e10cSrcweir {
137cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
138cdf0e10cSrcweir 	return m_bEnabled;
139cdf0e10cSrcweir }
140cdf0e10cSrcweir // -----------------------------------------------------------------------------
setEnabled(::sal_Bool _enabled)141cdf0e10cSrcweir void SAL_CALL OFormatCondition::setEnabled( ::sal_Bool _enabled ) throw (uno::RuntimeException)
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	set(PROPERTY_ENABLED,_enabled,m_bEnabled);
144cdf0e10cSrcweir }
145cdf0e10cSrcweir // -----------------------------------------------------------------------------
getFormula()146cdf0e10cSrcweir ::rtl::OUString SAL_CALL OFormatCondition::getFormula() throw (uno::RuntimeException)
147cdf0e10cSrcweir {
148cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
149cdf0e10cSrcweir 	return m_sFormula;
150cdf0e10cSrcweir }
151cdf0e10cSrcweir // -----------------------------------------------------------------------------
setFormula(const::rtl::OUString & _formula)152cdf0e10cSrcweir void SAL_CALL OFormatCondition::setFormula( const ::rtl::OUString& _formula ) throw (uno::RuntimeException)
153cdf0e10cSrcweir {
154cdf0e10cSrcweir 	set(PROPERTY_FORMULA,_formula,m_sFormula);
155cdf0e10cSrcweir }
156cdf0e10cSrcweir // -----------------------------------------------------------------------------
157cdf0e10cSrcweir // XReportControlFormat
158cdf0e10cSrcweir REPORTCONTROLFORMAT_IMPL(OFormatCondition,m_aFormatProperties)
159cdf0e10cSrcweir // =============================================================================
160cdf0e10cSrcweir } // namespace reportdesign
161cdf0e10cSrcweir // =============================================================================
162