sync master with lastest vba changes
[ooovba.git] / reportdesign / source / core / api / FormatCondition.cxx
blob1f9df34f21a52fb32f67a3d328c2515cb25c762f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FormatCondition.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "FormatCondition.hxx"
31 #include <com/sun/star/beans/PropertyAttribute.hpp>
32 #ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC
33 #include "corestrings.hrc"
34 #endif
35 #include <tools/debug.hxx>
36 #include <connectivity/dbtools.hxx>
37 #include <comphelper/sequence.hxx>
38 #include <comphelper/property.hxx>
39 #include "Tools.hxx"
40 #include <com/sun/star/text/ParagraphVertAlign.hpp>
41 #include "ReportHelperImpl.hxx"
42 #include "corestrings.hrc"
43 // =============================================================================
44 namespace reportdesign
46 // =============================================================================
47 using namespace com::sun::star;
48 using namespace comphelper;
49 //------------------------------------------------------------------------------
50 uno::Reference< uno::XInterface > OFormatCondition::create(uno::Reference< uno::XComponentContext > const & xContext)
52 return *(new OFormatCondition(xContext));
55 DBG_NAME( rpt_OFormatCondition )
56 // -----------------------------------------------------------------------------
57 OFormatCondition::OFormatCondition(uno::Reference< uno::XComponentContext > const & _xContext)
58 :FormatConditionBase(m_aMutex)
59 ,FormatConditionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >())
60 ,m_bEnabled(sal_True)
62 DBG_CTOR( rpt_OFormatCondition,NULL);
64 // -----------------------------------------------------------------------------
65 OFormatCondition::~OFormatCondition()
67 DBG_DTOR( rpt_OFormatCondition,NULL);
69 // -----------------------------------------------------------------------------
70 IMPLEMENT_FORWARD_XINTERFACE2(OFormatCondition,FormatConditionBase,FormatConditionPropertySet)
71 // -----------------------------------------------------------------------------
72 void SAL_CALL OFormatCondition::dispose() throw(uno::RuntimeException)
74 FormatConditionPropertySet::dispose();
75 cppu::WeakComponentImplHelperBase::dispose();
77 // -----------------------------------------------------------------------------
78 ::rtl::OUString OFormatCondition::getImplementationName_Static( ) throw(uno::RuntimeException)
80 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OFormatCondition"));
83 //--------------------------------------------------------------------------
84 ::rtl::OUString SAL_CALL OFormatCondition::getImplementationName( ) throw(uno::RuntimeException)
86 return getImplementationName_Static();
88 //--------------------------------------------------------------------------
89 uno::Sequence< ::rtl::OUString > OFormatCondition::getSupportedServiceNames_Static( ) throw(uno::RuntimeException)
91 uno::Sequence< ::rtl::OUString > aServices(1);
92 aServices.getArray()[0] = SERVICE_FORMATCONDITION;
94 return aServices;
96 //--------------------------------------------------------------------------
97 uno::Sequence< ::rtl::OUString > SAL_CALL OFormatCondition::getSupportedServiceNames( ) throw(uno::RuntimeException)
99 return getSupportedServiceNames_Static();
101 //------------------------------------------------------------------------------
102 sal_Bool SAL_CALL OFormatCondition::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException )
104 return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static());
106 // -----------------------------------------------------------------------------
107 uno::Reference< beans::XPropertySetInfo > SAL_CALL OFormatCondition::getPropertySetInfo( ) throw(uno::RuntimeException)
109 return FormatConditionPropertySet::getPropertySetInfo();
111 // -----------------------------------------------------------------------------
112 void SAL_CALL OFormatCondition::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
114 FormatConditionPropertySet::setPropertyValue( aPropertyName, aValue );
116 // -----------------------------------------------------------------------------
117 uno::Any SAL_CALL OFormatCondition::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
119 return FormatConditionPropertySet::getPropertyValue( PropertyName);
121 // -----------------------------------------------------------------------------
122 void SAL_CALL OFormatCondition::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
124 FormatConditionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
126 // -----------------------------------------------------------------------------
127 void SAL_CALL OFormatCondition::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
129 FormatConditionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
131 // -----------------------------------------------------------------------------
132 void SAL_CALL OFormatCondition::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
134 FormatConditionPropertySet::addVetoableChangeListener( PropertyName, aListener );
136 // -----------------------------------------------------------------------------
137 void SAL_CALL OFormatCondition::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
139 FormatConditionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
141 // -----------------------------------------------------------------------------
142 // XFormatCondition
143 ::sal_Bool SAL_CALL OFormatCondition::getEnabled() throw (uno::RuntimeException)
145 ::osl::MutexGuard aGuard(m_aMutex);
146 return m_bEnabled;
148 // -----------------------------------------------------------------------------
149 void SAL_CALL OFormatCondition::setEnabled( ::sal_Bool _enabled ) throw (uno::RuntimeException)
151 set(PROPERTY_ENABLED,_enabled,m_bEnabled);
153 // -----------------------------------------------------------------------------
154 ::rtl::OUString SAL_CALL OFormatCondition::getFormula() throw (uno::RuntimeException)
156 ::osl::MutexGuard aGuard(m_aMutex);
157 return m_sFormula;
159 // -----------------------------------------------------------------------------
160 void SAL_CALL OFormatCondition::setFormula( const ::rtl::OUString& _formula ) throw (uno::RuntimeException)
162 set(PROPERTY_FORMULA,_formula,m_sFormula);
164 // -----------------------------------------------------------------------------
165 // XReportControlFormat
166 REPORTCONTROLFORMAT_IMPL(OFormatCondition,m_aFormatProperties)
167 // =============================================================================
168 } // namespace reportdesign
169 // =============================================================================