xref: /AOO41X/main/sc/source/ui/vba/vbaformatconditions.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include <ooo/vba/excel/XRange.hpp>
29*cdf0e10cSrcweir #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
30*cdf0e10cSrcweir #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
31*cdf0e10cSrcweir #include <vector>
32*cdf0e10cSrcweir #include "vbaformatconditions.hxx"
33*cdf0e10cSrcweir #include "vbaformatcondition.hxx"
34*cdf0e10cSrcweir #include "vbaworkbook.hxx"
35*cdf0e10cSrcweir #include "vbastyles.hxx"
36*cdf0e10cSrcweir #include "vbaglobals.hxx"
37*cdf0e10cSrcweir using namespace ::ooo::vba;
38*cdf0e10cSrcweir using namespace ::com::sun::star;
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir typedef std::vector< beans::PropertyValue > VecPropValues;
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir static rtl::OUString OPERATOR( RTL_CONSTASCII_USTRINGPARAM("Operator") );
43*cdf0e10cSrcweir static rtl::OUString FORMULA1( RTL_CONSTASCII_USTRINGPARAM("Formula1") );
44*cdf0e10cSrcweir static rtl::OUString FORMULA2( RTL_CONSTASCII_USTRINGPARAM("Formula2") );
45*cdf0e10cSrcweir static rtl::OUString STYLENAME( RTL_CONSTASCII_USTRINGPARAM("StyleName") );
46*cdf0e10cSrcweir static rtl::OUString sStyleNamePrefix( RTL_CONSTASCII_USTRINGPARAM("Excel_CondFormat") );
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir ScVbaFormatConditions::ScVbaFormatConditions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< sheet::XSheetConditionalEntries >& _xSheetConditionalEntries, const uno::Reference< frame::XModel >& /*xModel*/ ) : ScVbaFormatConditions_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( _xSheetConditionalEntries, uno::UNO_QUERY_THROW ) ), mxSheetConditionalEntries( _xSheetConditionalEntries )
49*cdf0e10cSrcweir {
50*cdf0e10cSrcweir 	mxRangeParent.set( xParent, uno::UNO_QUERY_THROW );
51*cdf0e10cSrcweir     uno::Reference< excel::XApplication> xApp( Application(), uno::UNO_QUERY_THROW );
52*cdf0e10cSrcweir     mxStyles.set( xApp->getThisWorkbook()->Styles( uno::Any() ), uno::UNO_QUERY_THROW );
53*cdf0e10cSrcweir 	uno::Reference< sheet::XCellRangeAddressable > xCellRange( mxRangeParent->getCellRange(), uno::UNO_QUERY_THROW );
54*cdf0e10cSrcweir 	mxParentRangePropertySet.set( xCellRange, uno::UNO_QUERY_THROW );
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 	table::CellRangeAddress rangeAddress = xCellRange->getRangeAddress();
57*cdf0e10cSrcweir 	maCellAddress = table::CellAddress( rangeAddress.Sheet, rangeAddress.StartColumn,  rangeAddress.StartRow );
58*cdf0e10cSrcweir }
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir void SAL_CALL
61*cdf0e10cSrcweir ScVbaFormatConditions::Delete(  ) throw (script::BasicErrorException, uno::RuntimeException)
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir 	try
64*cdf0e10cSrcweir 	{
65*cdf0e10cSrcweir 		ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( mxStyles.get() );
66*cdf0e10cSrcweir 		if ( !pStyles )
67*cdf0e10cSrcweir 			DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
68*cdf0e10cSrcweir 		sal_Int32 nCount = mxSheetConditionalEntries->getCount();
69*cdf0e10cSrcweir 		for (sal_Int32 i = nCount - 1; i >= 0; i--)
70*cdf0e10cSrcweir 		{
71*cdf0e10cSrcweir 			uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry( mxSheetConditionalEntries->getByIndex(i), uno::UNO_QUERY_THROW );
72*cdf0e10cSrcweir 			pStyles->Delete(xSheetConditionalEntry->getStyleName());
73*cdf0e10cSrcweir 			mxSheetConditionalEntries->removeByIndex(i);
74*cdf0e10cSrcweir 		}
75*cdf0e10cSrcweir 		notifyRange();
76*cdf0e10cSrcweir 	}
77*cdf0e10cSrcweir 	catch (uno::Exception& )
78*cdf0e10cSrcweir 	{
79*cdf0e10cSrcweir 		DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
80*cdf0e10cSrcweir 	}
81*cdf0e10cSrcweir }
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir uno::Type SAL_CALL
84*cdf0e10cSrcweir ScVbaFormatConditions::getElementType() throw (css::uno::RuntimeException)
85*cdf0e10cSrcweir {
86*cdf0e10cSrcweir 	return excel::XFormatCondition::static_type(0);
87*cdf0e10cSrcweir }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir uno::Any xSheetConditionToFormatCondition( const uno::Reference< XHelperInterface >& xRangeParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< excel::XStyles >& xStyles, const uno::Reference< excel::XFormatConditions >& xFormatConditions, const uno::Reference< beans::XPropertySet >& xRangeProps,  const uno::Any& aObject )
91*cdf0e10cSrcweir {
92*cdf0e10cSrcweir 	uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry;
93*cdf0e10cSrcweir 	aObject >>= xSheetConditionalEntry;
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 	uno::Reference< excel::XStyle > xStyle( xStyles->Item( uno::makeAny( xSheetConditionalEntry->getStyleName() ), uno::Any() ), uno::UNO_QUERY_THROW );
96*cdf0e10cSrcweir 	uno::Reference< excel::XFormatCondition > xCondition = new ScVbaFormatCondition( xRangeParent, xContext,  xSheetConditionalEntry, xStyle, xFormatConditions, xRangeProps );
97*cdf0e10cSrcweir 	return uno::makeAny( xCondition );
98*cdf0e10cSrcweir }
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir uno::Any
101*cdf0e10cSrcweir ScVbaFormatConditions::createCollectionObject(const uno::Any& aObject )
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir 	return xSheetConditionToFormatCondition( uno::Reference< XHelperInterface >( mxRangeParent, uno::UNO_QUERY_THROW ), mxContext, mxStyles, this, mxParentRangePropertySet, aObject );
104*cdf0e10cSrcweir }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir class EnumWrapper : public EnumerationHelper_BASE
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir         uno::Reference<container::XIndexAccess > m_xIndexAccess;
109*cdf0e10cSrcweir         uno::Reference<excel::XRange > m_xParentRange;
110*cdf0e10cSrcweir         uno::Reference<uno::XComponentContext > m_xContext;
111*cdf0e10cSrcweir         uno::Reference<excel::XStyles > m_xStyles;
112*cdf0e10cSrcweir         uno::Reference<excel::XFormatConditions > m_xParentCollection;
113*cdf0e10cSrcweir         uno::Reference<beans::XPropertySet > m_xProps;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir         sal_Int32 nIndex;
116*cdf0e10cSrcweir public:
117*cdf0e10cSrcweir         EnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference<excel::XRange >& xRange, const uno::Reference<uno::XComponentContext >& xContext, const uno::Reference<excel::XStyles >& xStyles, const uno::Reference< excel::XFormatConditions >& xCollection, const uno::Reference<beans::XPropertySet >& xProps  ) : m_xIndexAccess( xIndexAccess ), m_xParentRange( xRange ), m_xContext( xContext ), m_xStyles( xStyles ), m_xParentCollection( xCollection ), m_xProps( xProps ), nIndex( 0 ) {}
118*cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
119*cdf0e10cSrcweir         {
120*cdf0e10cSrcweir                 return ( nIndex < m_xIndexAccess->getCount() );
121*cdf0e10cSrcweir         }
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir         virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
124*cdf0e10cSrcweir         {
125*cdf0e10cSrcweir                 if ( nIndex < m_xIndexAccess->getCount() )
126*cdf0e10cSrcweir                         return xSheetConditionToFormatCondition( uno::Reference< XHelperInterface >( m_xParentRange, uno::UNO_QUERY_THROW ), m_xContext, m_xStyles, m_xParentCollection, m_xProps, m_xIndexAccess->getByIndex( nIndex++ ) );
127*cdf0e10cSrcweir                 throw container::NoSuchElementException();
128*cdf0e10cSrcweir         }
129*cdf0e10cSrcweir };
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir uno::Reference< excel::XFormatCondition > SAL_CALL
132*cdf0e10cSrcweir ScVbaFormatConditions::Add( ::sal_Int32 _nType, const uno::Any& _aOperator, const uno::Any& _aFormula1, const uno::Any& _aFormula2 ) throw (script::BasicErrorException, uno::RuntimeException)
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir 	return Add( _nType, _aOperator, _aFormula1, _aFormula2, uno::Reference< excel::XStyle >() );
135*cdf0e10cSrcweir }
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir uno::Reference< excel::XFormatCondition >
138*cdf0e10cSrcweir ScVbaFormatConditions::Add( ::sal_Int32 _nType, const uno::Any& _aOperator, const uno::Any& _aFormula1, const uno::Any& _aFormula2, const css::uno::Reference< excel::XStyle >& _xStyle  ) throw (script::BasicErrorException, uno::RuntimeException)
139*cdf0e10cSrcweir {
140*cdf0e10cSrcweir 	// #TODO
141*cdf0e10cSrcweir 	// #FIXME
142*cdf0e10cSrcweir 	// This method will NOT handle r1c1 formulas [*]and only assumes that
143*cdf0e10cSrcweir 	// the formulas are _xlA1 based ( need to hook into calc work ths should
144*cdf0e10cSrcweir 	// address this )
145*cdf0e10cSrcweir 	// [*] reason: getA1Formula method below is just a hook and just
146*cdf0e10cSrcweir 	// returns whats it gets ( e.g. doesn't convert anything )
147*cdf0e10cSrcweir 	uno::Reference< excel::XStyle > xStyle( _xStyle );
148*cdf0e10cSrcweir 	uno::Reference< excel::XFormatCondition > xFormatCondition;
149*cdf0e10cSrcweir 	try
150*cdf0e10cSrcweir 	{
151*cdf0e10cSrcweir 		rtl::OUString sStyleName;
152*cdf0e10cSrcweir 		if ( !xStyle.is() )
153*cdf0e10cSrcweir 		{
154*cdf0e10cSrcweir 			sStyleName = getStyleName();
155*cdf0e10cSrcweir 			xStyle = mxStyles->Add(sStyleName, uno::Any() );
156*cdf0e10cSrcweir 		}
157*cdf0e10cSrcweir 		else
158*cdf0e10cSrcweir 		{
159*cdf0e10cSrcweir 			sStyleName = xStyle->getName();
160*cdf0e10cSrcweir 		}
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 		VecPropValues aPropertyValueVector;
163*cdf0e10cSrcweir 		sheet::ConditionOperator aType = ScVbaFormatCondition::retrieveAPIType(_nType, uno::Reference< sheet::XSheetCondition >() );
164*cdf0e10cSrcweir 		uno::Any aValue;
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 		if ( aType == sheet::ConditionOperator_FORMULA)
167*cdf0e10cSrcweir 			aValue = uno::makeAny( sheet::ConditionOperator_FORMULA );
168*cdf0e10cSrcweir 		else
169*cdf0e10cSrcweir 			aValue = uno::makeAny( ScVbaFormatCondition::retrieveAPIOperator(_aOperator) );
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 		beans::PropertyValue aProperty( OPERATOR, 0, aValue, beans::PropertyState_DIRECT_VALUE );
172*cdf0e10cSrcweir 		aPropertyValueVector.push_back( aProperty );
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 		if ( _aFormula1.hasValue() )
175*cdf0e10cSrcweir 		{
176*cdf0e10cSrcweir 			beans::PropertyValue aProp( FORMULA1, 0, uno::makeAny( getA1Formula( _aFormula1 ) ), beans::PropertyState_DIRECT_VALUE );
177*cdf0e10cSrcweir 			aPropertyValueVector.push_back( aProp );
178*cdf0e10cSrcweir 		}
179*cdf0e10cSrcweir 		if ( _aFormula2.hasValue() )
180*cdf0e10cSrcweir 		{
181*cdf0e10cSrcweir 			beans::PropertyValue aProp( FORMULA2, 0, uno::makeAny( getA1Formula( _aFormula2 ) ), beans::PropertyState_DIRECT_VALUE );
182*cdf0e10cSrcweir 			aPropertyValueVector.push_back( aProp );
183*cdf0e10cSrcweir 		}
184*cdf0e10cSrcweir 		aProperty.Name = STYLENAME;
185*cdf0e10cSrcweir 		aProperty.Value = uno::makeAny( sStyleName );
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 		// convert vector to sequence
188*cdf0e10cSrcweir 		uno::Sequence< beans::PropertyValue > aPropertyValueList(aPropertyValueVector.size());
189*cdf0e10cSrcweir 		VecPropValues::iterator it = aPropertyValueVector.begin();
190*cdf0e10cSrcweir 		VecPropValues::iterator it_end = aPropertyValueVector.end();
191*cdf0e10cSrcweir 		for ( sal_Int32 index=0; it != it_end; ++it )
192*cdf0e10cSrcweir 			aPropertyValueList[ index++ ] = *it;
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir 		mxSheetConditionalEntries->addNew(aPropertyValueList);
195*cdf0e10cSrcweir 		for (sal_Int32 i = mxSheetConditionalEntries->getCount()-1; i >= 0; i--)
196*cdf0e10cSrcweir 		{
197*cdf0e10cSrcweir 			uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry( mxSheetConditionalEntries->getByIndex(i), uno::UNO_QUERY_THROW );
198*cdf0e10cSrcweir 			if (xSheetConditionalEntry->getStyleName().equals(sStyleName))
199*cdf0e10cSrcweir 			{
200*cdf0e10cSrcweir 				xFormatCondition =  new ScVbaFormatCondition(uno::Reference< XHelperInterface >( mxRangeParent, uno::UNO_QUERY_THROW ), mxContext, xSheetConditionalEntry, xStyle, this, mxParentRangePropertySet);
201*cdf0e10cSrcweir 				notifyRange();
202*cdf0e10cSrcweir 				return xFormatCondition;
203*cdf0e10cSrcweir 			}
204*cdf0e10cSrcweir 		}
205*cdf0e10cSrcweir 	}
206*cdf0e10cSrcweir 	catch (uno::Exception& )
207*cdf0e10cSrcweir 	{
208*cdf0e10cSrcweir 	}
209*cdf0e10cSrcweir 	DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
210*cdf0e10cSrcweir 	return xFormatCondition;
211*cdf0e10cSrcweir }
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir uno::Reference< container::XEnumeration > SAL_CALL
215*cdf0e10cSrcweir ScVbaFormatConditions::createEnumeration() throw (uno::RuntimeException)
216*cdf0e10cSrcweir {
217*cdf0e10cSrcweir 	return new EnumWrapper( m_xIndexAccess, mxRangeParent, mxContext, mxStyles, this, mxParentRangePropertySet  );
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir void
222*cdf0e10cSrcweir ScVbaFormatConditions::notifyRange() throw ( script::BasicErrorException )
223*cdf0e10cSrcweir {
224*cdf0e10cSrcweir 	try
225*cdf0e10cSrcweir 	{
226*cdf0e10cSrcweir 		mxParentRangePropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ConditionalFormat")), uno::makeAny( mxSheetConditionalEntries ));
227*cdf0e10cSrcweir 	}
228*cdf0e10cSrcweir 	catch (uno::Exception& )
229*cdf0e10cSrcweir 	{
230*cdf0e10cSrcweir 		DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
231*cdf0e10cSrcweir 	}
232*cdf0e10cSrcweir }
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir rtl::OUString
235*cdf0e10cSrcweir ScVbaFormatConditions::getA1Formula(const css::uno::Any& _aFormula) throw ( script::BasicErrorException )
236*cdf0e10cSrcweir {
237*cdf0e10cSrcweir 	// #TODO, #FIXME hook-in proper formula conversion detection & logic
238*cdf0e10cSrcweir 	rtl::OUString sFormula;
239*cdf0e10cSrcweir 	if ( !( _aFormula >>= sFormula ) )
240*cdf0e10cSrcweir 		DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
241*cdf0e10cSrcweir 	return sFormula;
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir rtl::OUString
245*cdf0e10cSrcweir ScVbaFormatConditions::getStyleName()
246*cdf0e10cSrcweir {
247*cdf0e10cSrcweir 	ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( mxStyles.get() );
248*cdf0e10cSrcweir 	if ( !pStyles )
249*cdf0e10cSrcweir 		DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
250*cdf0e10cSrcweir 	uno::Sequence< rtl::OUString > sCellStyleNames = pStyles->getStyleNames();
251*cdf0e10cSrcweir 	return ContainerUtilities::getUniqueName(sCellStyleNames, sStyleNamePrefix, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_") ));
252*cdf0e10cSrcweir }
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir void
255*cdf0e10cSrcweir ScVbaFormatConditions::removeFormatCondition( const rtl::OUString& _sStyleName, sal_Bool _bRemoveStyle) throw ( script::BasicErrorException )
256*cdf0e10cSrcweir {
257*cdf0e10cSrcweir 	try
258*cdf0e10cSrcweir 	{
259*cdf0e10cSrcweir 		sal_Int32 nElems = mxSheetConditionalEntries->getCount();
260*cdf0e10cSrcweir 		for (sal_Int32 i = 0; i < nElems; i++)
261*cdf0e10cSrcweir 		{
262*cdf0e10cSrcweir 			uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry( mxSheetConditionalEntries->getByIndex(i), uno::UNO_QUERY_THROW );
263*cdf0e10cSrcweir 			if (_sStyleName.equals(xSheetConditionalEntry->getStyleName()))
264*cdf0e10cSrcweir 			{
265*cdf0e10cSrcweir 				mxSheetConditionalEntries->removeByIndex(i);
266*cdf0e10cSrcweir 				if (_bRemoveStyle)
267*cdf0e10cSrcweir 				{
268*cdf0e10cSrcweir 					ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( mxStyles.get() );
269*cdf0e10cSrcweir 					if ( !pStyles )
270*cdf0e10cSrcweir 						DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
271*cdf0e10cSrcweir 					pStyles->Delete( _sStyleName );
272*cdf0e10cSrcweir 				}
273*cdf0e10cSrcweir 				return;
274*cdf0e10cSrcweir 			}
275*cdf0e10cSrcweir 		}
276*cdf0e10cSrcweir 	}
277*cdf0e10cSrcweir 	catch (uno::Exception& )
278*cdf0e10cSrcweir 	{
279*cdf0e10cSrcweir 		DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
280*cdf0e10cSrcweir 	}
281*cdf0e10cSrcweir }
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir rtl::OUString&
284*cdf0e10cSrcweir ScVbaFormatConditions::getServiceImplName()
285*cdf0e10cSrcweir {
286*cdf0e10cSrcweir 	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFormatConditions") );
287*cdf0e10cSrcweir 	return sImplName;
288*cdf0e10cSrcweir }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir uno::Sequence< rtl::OUString >
291*cdf0e10cSrcweir ScVbaFormatConditions::getServiceNames()
292*cdf0e10cSrcweir {
293*cdf0e10cSrcweir 	static uno::Sequence< rtl::OUString > aServiceNames;
294*cdf0e10cSrcweir 	if ( aServiceNames.getLength() == 0 )
295*cdf0e10cSrcweir 	{
296*cdf0e10cSrcweir 		aServiceNames.realloc( 1 );
297*cdf0e10cSrcweir 		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.FormatConditions" ) );
298*cdf0e10cSrcweir 	}
299*cdf0e10cSrcweir 	return aServiceNames;
300*cdf0e10cSrcweir }
301*cdf0e10cSrcweir 
302