summaryrefslogtreecommitdiff
path: root/svl/source/numbers/zforfind.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-11-22 14:29:35 +0100
committerEike Rathke <erack@redhat.com>2011-11-22 14:52:41 +0100
commit3b5ee26d2c27b9fb8d3836c470832fc81cda721f (patch)
treefae2e2fce03aaf000a18ae253493d50b68f377de /svl/source/numbers/zforfind.cxx
parent734bfe16bdfe7c80fa8c0c71d680746353686961 (diff)
added partitive case month names
* Locale data: * nominative (nouns) month names always given in <MonthsOfYear> element * optional genitive case month names in <GenitiveMonths> element, following the <MonthsOfYear> element; if not given take nominative names * optional partitive case month names in <PartitiveMonths> element, following the <GenitiveMonths> element, or following the <MonthsOfYear> element if the <GenitiveMonths> element is not present; if not given take genitive case names, or nominative if genitive names aren't defined * currently known partitive case matters in Finnish locales * Rules for use of nominative / genitive / partitive case month names in number formatter: * no day of month (D or DD) present in format code => MMM or MMMM display nominative month name (noun) * day of month (D or DD) after MMM or MMMM => genitive name * no genitive names defined => nominative names * day of month (D or DD) before MMM or MMMM => partitive name * no partitive names defined => genitive names * no genitive names defined => nominative names
Diffstat (limited to 'svl/source/numbers/zforfind.cxx')
-rw-r--r--svl/source/numbers/zforfind.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 3fa6908b1d4f..cfad6e2b7483 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -87,6 +87,8 @@ ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP )
pUpperAbbrevMonthText( NULL ),
pUpperGenitiveMonthText( NULL ),
pUpperGenitiveAbbrevMonthText( NULL ),
+ pUpperPartitiveMonthText( NULL ),
+ pUpperPartitiveAbbrevMonthText( NULL ),
pUpperDayText( NULL ),
pUpperAbbrevDayText( NULL ),
eScannedType( NUMBERFORMAT_UNDEFINED ),
@@ -111,6 +113,8 @@ ImpSvNumberInputScan::~ImpSvNumberInputScan()
delete [] pUpperAbbrevMonthText;
delete [] pUpperGenitiveMonthText;
delete [] pUpperGenitiveAbbrevMonthText;
+ delete [] pUpperPartitiveMonthText;
+ delete [] pUpperPartitiveAbbrevMonthText;
delete [] pUpperDayText;
delete [] pUpperAbbrevDayText;
}
@@ -573,6 +577,18 @@ short ImpSvNumberInputScan::GetMonth( const String& rString, xub_StrLen& nPos )
res = sal::static_int_cast< short >(-(i+1)); // negative
break; // for
}
+ else if ( StringContains( pUpperPartitiveMonthText[i], rString, nPos ) )
+ { // partitive full names
+ nPos = nPos + pUpperPartitiveMonthText[i].Len();
+ res = i+1;
+ break; // for
+ }
+ else if ( StringContains( pUpperPartitiveAbbrevMonthText[i], rString, nPos ) )
+ { // partitive abbreviated
+ nPos = nPos + pUpperPartitiveAbbrevMonthText[i].Len();
+ res = sal::static_int_cast< short >(-(i+1)); // negative
+ break; // for
+ }
else if ( StringContains( pUpperMonthText[i], rString, nPos ) )
{ // noun full names
nPos = nPos + pUpperMonthText[i].Len();
@@ -2455,6 +2471,18 @@ void ImpSvNumberInputScan::InitText()
pUpperGenitiveAbbrevMonthText[j] = pChrCls->upper( xElems[j].AbbrevName );
}
+ delete [] pUpperPartitiveMonthText;
+ delete [] pUpperPartitiveAbbrevMonthText;
+ xElems = pCal->getPartitiveMonths();
+ nElems = xElems.getLength();
+ pUpperPartitiveMonthText = new String[nElems];
+ pUpperPartitiveAbbrevMonthText = new String[nElems];
+ for ( j=0; j<nElems; j++ )
+ {
+ pUpperPartitiveMonthText[j] = pChrCls->upper( xElems[j].FullName );
+ pUpperPartitiveAbbrevMonthText[j] = pChrCls->upper( xElems[j].AbbrevName );
+ }
+
delete [] pUpperDayText;
delete [] pUpperAbbrevDayText;
xElems = pCal->getDays();