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 // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_i18npool.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <numberformatcode.hxx>
32*cdf0e10cSrcweir #include <com/sun/star/i18n/KNumberFormatUsage.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/i18n/KNumberFormatType.hpp>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir NumberFormatCodeMapper::NumberFormatCodeMapper(
38*cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference <
39*cdf0e10cSrcweir 				::com::sun::star::lang::XMultiServiceFactory >& rxMSF )
40*cdf0e10cSrcweir 		:
41*cdf0e10cSrcweir 		xMSF( rxMSF ),
42*cdf0e10cSrcweir 		bFormatsValid( sal_False )
43*cdf0e10cSrcweir {
44*cdf0e10cSrcweir }
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir NumberFormatCodeMapper::~NumberFormatCodeMapper()
48*cdf0e10cSrcweir {
49*cdf0e10cSrcweir }
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir ::com::sun::star::i18n::NumberFormatCode SAL_CALL
53*cdf0e10cSrcweir NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException)
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 	::rtl::OUString elementType	= mapElementTypeShortToString(formatType);
57*cdf0e10cSrcweir 	::rtl::OUString elementUsage = mapElementUsageShortToString(formatUsage);
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 	getFormats( rLocale );
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir 	for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) {
62*cdf0e10cSrcweir 		if(aFormatSeq[i].isDefault && aFormatSeq[i].formatType == elementType &&
63*cdf0e10cSrcweir 			aFormatSeq[i].formatUsage == elementUsage) {
64*cdf0e10cSrcweir 			com::sun::star::i18n::NumberFormatCode anumberFormatCode(formatType,
65*cdf0e10cSrcweir 																	formatUsage,
66*cdf0e10cSrcweir 																	aFormatSeq[i].formatCode,
67*cdf0e10cSrcweir 																	aFormatSeq[i].formatName,
68*cdf0e10cSrcweir 																	aFormatSeq[i].formatKey,
69*cdf0e10cSrcweir 																	aFormatSeq[i].formatIndex,
70*cdf0e10cSrcweir 																	sal_True);
71*cdf0e10cSrcweir 			return anumberFormatCode;
72*cdf0e10cSrcweir 		}
73*cdf0e10cSrcweir 	}
74*cdf0e10cSrcweir 	com::sun::star::i18n::NumberFormatCode defaultNumberFormatCode;
75*cdf0e10cSrcweir 	return defaultNumberFormatCode;
76*cdf0e10cSrcweir }
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir ::com::sun::star::i18n::NumberFormatCode SAL_CALL
81*cdf0e10cSrcweir NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException)
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir 	getFormats( rLocale );
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 	for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) {
86*cdf0e10cSrcweir 		if(aFormatSeq[i].formatIndex == formatIndex) {
87*cdf0e10cSrcweir 			com::sun::star::i18n::NumberFormatCode anumberFormatCode(mapElementTypeStringToShort(aFormatSeq[i].formatType),
88*cdf0e10cSrcweir 																	mapElementUsageStringToShort(aFormatSeq[i].formatUsage),
89*cdf0e10cSrcweir 																	aFormatSeq[i].formatCode,
90*cdf0e10cSrcweir 																	aFormatSeq[i].formatName,
91*cdf0e10cSrcweir 																	aFormatSeq[i].formatKey,
92*cdf0e10cSrcweir 																	aFormatSeq[i].formatIndex,
93*cdf0e10cSrcweir 																	aFormatSeq[i].isDefault);
94*cdf0e10cSrcweir 			return anumberFormatCode;
95*cdf0e10cSrcweir 		}
96*cdf0e10cSrcweir 	}
97*cdf0e10cSrcweir 	com::sun::star::i18n::NumberFormatCode defaultNumberFormatCode;
98*cdf0e10cSrcweir 	return defaultNumberFormatCode;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL
105*cdf0e10cSrcweir NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException)
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir 	getFormats( rLocale );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	sal_Int32 i, count;
110*cdf0e10cSrcweir 	count = 0;
111*cdf0e10cSrcweir 	for(i = 0; i < aFormatSeq.getLength(); i++) {
112*cdf0e10cSrcweir 		sal_Int16 elementUsage = mapElementUsageStringToShort(aFormatSeq[i].formatUsage);
113*cdf0e10cSrcweir 		if( elementUsage == formatUsage)
114*cdf0e10cSrcweir 			count++;
115*cdf0e10cSrcweir 	}
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 	::com::sun::star::uno::Sequence<com::sun::star::i18n::NumberFormatCode> seq(count);
118*cdf0e10cSrcweir 	sal_Int32 j = 0;
119*cdf0e10cSrcweir 	for(i = 0; i < aFormatSeq.getLength(); i++) {
120*cdf0e10cSrcweir 		sal_Int16 elementUsage = mapElementUsageStringToShort(aFormatSeq[i].formatUsage);
121*cdf0e10cSrcweir 		if( elementUsage == formatUsage) {
122*cdf0e10cSrcweir 			seq[j] = com::sun::star::i18n::NumberFormatCode(mapElementTypeStringToShort(aFormatSeq[i].formatType),
123*cdf0e10cSrcweir 															formatUsage,
124*cdf0e10cSrcweir 															aFormatSeq[i].formatCode,
125*cdf0e10cSrcweir 															aFormatSeq[i].formatName,
126*cdf0e10cSrcweir 															aFormatSeq[i].formatKey,
127*cdf0e10cSrcweir 															aFormatSeq[i].formatIndex,
128*cdf0e10cSrcweir 															aFormatSeq[i].isDefault);
129*cdf0e10cSrcweir 			j++;
130*cdf0e10cSrcweir 		}
131*cdf0e10cSrcweir 	}
132*cdf0e10cSrcweir 	return seq;
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir }
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL
138*cdf0e10cSrcweir NumberFormatCodeMapper::getAllFormatCodes( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException)
139*cdf0e10cSrcweir {
140*cdf0e10cSrcweir 	getFormats( rLocale );
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 	::com::sun::star::uno::Sequence<com::sun::star::i18n::NumberFormatCode> seq(aFormatSeq.getLength());
143*cdf0e10cSrcweir 	for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++)
144*cdf0e10cSrcweir 	{
145*cdf0e10cSrcweir 		seq[i] = com::sun::star::i18n::NumberFormatCode(mapElementTypeStringToShort(aFormatSeq[i].formatType),
146*cdf0e10cSrcweir 														mapElementUsageStringToShort(aFormatSeq[i].formatUsage),
147*cdf0e10cSrcweir 														aFormatSeq[i].formatCode,
148*cdf0e10cSrcweir 														aFormatSeq[i].formatName,
149*cdf0e10cSrcweir 														aFormatSeq[i].formatKey,
150*cdf0e10cSrcweir 														aFormatSeq[i].formatIndex,
151*cdf0e10cSrcweir 														aFormatSeq[i].isDefault);
152*cdf0e10cSrcweir 	}
153*cdf0e10cSrcweir 	return seq;
154*cdf0e10cSrcweir }
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir // --- private implementation -----------------------------------------
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir void NumberFormatCodeMapper::setupLocale( const ::com::sun::star::lang::Locale& rLocale )
160*cdf0e10cSrcweir {
161*cdf0e10cSrcweir 	if ( aLocale.Country	!= rLocale.Country
162*cdf0e10cSrcweir 	  || aLocale.Language	!= rLocale.Language
163*cdf0e10cSrcweir 	  || aLocale.Variant	!= rLocale.Variant )
164*cdf0e10cSrcweir 	{
165*cdf0e10cSrcweir 		bFormatsValid = sal_False;
166*cdf0e10cSrcweir 		aLocale = rLocale;
167*cdf0e10cSrcweir 	}
168*cdf0e10cSrcweir }
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir void NumberFormatCodeMapper::getFormats( const ::com::sun::star::lang::Locale& rLocale )
172*cdf0e10cSrcweir {
173*cdf0e10cSrcweir 	setupLocale( rLocale );
174*cdf0e10cSrcweir 	if ( !bFormatsValid )
175*cdf0e10cSrcweir 	{
176*cdf0e10cSrcweir 		createLocaleDataObject();
177*cdf0e10cSrcweir 		if( !xlocaleData.is() )
178*cdf0e10cSrcweir 			aFormatSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > (0);
179*cdf0e10cSrcweir 		else
180*cdf0e10cSrcweir 			aFormatSeq = xlocaleData->getAllFormats( aLocale );
181*cdf0e10cSrcweir 		bFormatsValid = sal_True;
182*cdf0e10cSrcweir 	}
183*cdf0e10cSrcweir }
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir ::rtl::OUString
187*cdf0e10cSrcweir NumberFormatCodeMapper::mapElementTypeShortToString(sal_Int16 formatType)
188*cdf0e10cSrcweir {
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 	switch ( formatType )
191*cdf0e10cSrcweir 	{
192*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatType::SHORT :
193*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "short" ) );
194*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatType::MEDIUM :
195*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "medium" ) );
196*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatType::LONG :
197*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "long" ) );
198*cdf0e10cSrcweir 	}
199*cdf0e10cSrcweir 	return ::rtl::OUString();
200*cdf0e10cSrcweir }
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir sal_Int16
203*cdf0e10cSrcweir NumberFormatCodeMapper::mapElementTypeStringToShort(const ::rtl::OUString& formatType)
204*cdf0e10cSrcweir {
205*cdf0e10cSrcweir 	if(formatType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "short" ) ))
206*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatType::SHORT;
207*cdf0e10cSrcweir 	if(formatType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "medium" ) ))
208*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatType::MEDIUM;
209*cdf0e10cSrcweir 	if(formatType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "long" ) ))
210*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatType::LONG;
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 	return com::sun::star::i18n::KNumberFormatType::SHORT;
213*cdf0e10cSrcweir }
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir ::rtl::OUString
216*cdf0e10cSrcweir NumberFormatCodeMapper::mapElementUsageShortToString(sal_Int16 formatUsage)
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir 	switch ( formatUsage )
219*cdf0e10cSrcweir 	{
220*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatUsage::DATE :
221*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DATE" ) );
222*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatUsage::TIME :
223*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TIME" ) );
224*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatUsage::DATE_TIME :
225*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DATE_TIME" ) );
226*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatUsage::FIXED_NUMBER :
227*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FIXED_NUMBER" ) );
228*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatUsage::FRACTION_NUMBER :
229*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FRACTION_NUMBER" ) );
230*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatUsage::PERCENT_NUMBER :
231*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PERCENT_NUMBER" ) );
232*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatUsage::CURRENCY :
233*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CURRENCY" ) );
234*cdf0e10cSrcweir 		case com::sun::star::i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER :
235*cdf0e10cSrcweir 			return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SCIENTIFIC_NUMBER" ) );
236*cdf0e10cSrcweir 	}
237*cdf0e10cSrcweir 	return ::rtl::OUString();
238*cdf0e10cSrcweir }
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir sal_Int16
242*cdf0e10cSrcweir NumberFormatCodeMapper::mapElementUsageStringToShort(const ::rtl::OUString& formatUsage)
243*cdf0e10cSrcweir {
244*cdf0e10cSrcweir 	if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DATE" ) ))
245*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatUsage::DATE;
246*cdf0e10cSrcweir 	if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TIME" ) ))
247*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatUsage::TIME;
248*cdf0e10cSrcweir 	if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DATE_TIME" ) ))
249*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatUsage::DATE_TIME;
250*cdf0e10cSrcweir 	if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FIXED_NUMBER" ) ))
251*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatUsage::FIXED_NUMBER;
252*cdf0e10cSrcweir 	if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FRACTION_NUMBER" ) ))
253*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatUsage::FRACTION_NUMBER;
254*cdf0e10cSrcweir 	if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PERCENT_NUMBER" ) ))
255*cdf0e10cSrcweir 		return  com::sun::star::i18n::KNumberFormatUsage::PERCENT_NUMBER;
256*cdf0e10cSrcweir 	if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CURRENCY" ) ))
257*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatUsage::CURRENCY;
258*cdf0e10cSrcweir 	if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SCIENTIFIC_NUMBER" ) ))
259*cdf0e10cSrcweir 		return com::sun::star::i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER;
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 	return 0;
262*cdf0e10cSrcweir }
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir void
266*cdf0e10cSrcweir NumberFormatCodeMapper::createLocaleDataObject() {
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 	if(xlocaleData.is())
269*cdf0e10cSrcweir 		return;
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 	::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >
272*cdf0e10cSrcweir 		xI = xMSF->createInstance(
273*cdf0e10cSrcweir 		::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.LocaleData" ) ));
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 	if ( xI.is() ) {
276*cdf0e10cSrcweir 		::com::sun::star::uno::Any x = xI->queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData >*)0) );
277*cdf0e10cSrcweir 			x >>= xlocaleData;
278*cdf0e10cSrcweir 	}
279*cdf0e10cSrcweir }
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir ::rtl::OUString SAL_CALL
282*cdf0e10cSrcweir NumberFormatCodeMapper::getImplementationName(void)
283*cdf0e10cSrcweir                 throw( ::com::sun::star::uno::RuntimeException )
284*cdf0e10cSrcweir {
285*cdf0e10cSrcweir     return ::rtl::OUString::createFromAscii("com.sun.star.i18n.NumberFormatCodeMapper");
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir const sal_Char cNumFormat[] = "com.sun.star.i18n.NumberFormatMapper";
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir sal_Bool SAL_CALL
291*cdf0e10cSrcweir NumberFormatCodeMapper::supportsService(const rtl::OUString& rServiceName)
292*cdf0e10cSrcweir                 throw( ::com::sun::star::uno::RuntimeException )
293*cdf0e10cSrcweir {
294*cdf0e10cSrcweir     return !rServiceName.compareToAscii(cNumFormat);
295*cdf0e10cSrcweir }
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
298*cdf0e10cSrcweir NumberFormatCodeMapper::getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException )
299*cdf0e10cSrcweir {
300*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1);
301*cdf0e10cSrcweir     aRet[0] = ::rtl::OUString::createFromAscii(cNumFormat);
302*cdf0e10cSrcweir     return aRet;
303*cdf0e10cSrcweir }
304*cdf0e10cSrcweir 
305