diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-01-28 13:01:14 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-01-28 13:01:14 +0000 |
commit | 7934e15a0ccbb23478b737d27655f0ace6390f14 (patch) | |
tree | b37b7bdd25af999b5a84c2a854187022f0ffb472 /basic | |
parent | ee4a50e5dbaba32cfa24f407867c79d983793d32 (diff) |
INTEGRATION: CWS ab42 (1.11.12); FILE MERGED
2007/12/21 13:41:59 ab 1.11.12.2: #i81674# Use sb res manager to access predefined format resource strings
2007/12/21 11:16:36 ab 1.11.12.1: #151250# Support date/time formats
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/sbx/sbxscan.cxx | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 2e74f389d4fa..b7e292d401fb 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sbxscan.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: rt $ $Date: 2007-11-13 15:23:45 $ + * last change: $Author: vg $ $Date: 2008-01-28 14:01:14 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -62,6 +62,10 @@ #include "basrid.hxx" +#include <svtools/zforlist.hxx> +#include <comphelper/processfactory.hxx> + + void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep ) { SvtSysLocale aSysLocale; @@ -640,7 +644,7 @@ ResMgr* implGetResMgr( void ) if( !pResMgr ) { ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); - pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(stt), aLocale ); + pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(sb), aLocale ); } return pResMgr; } @@ -658,6 +662,38 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const { short nComma = 0; double d = 0; + + // Check for date format + if( pFmt && !SbxBasicFormater::isBasicFormat( *pFmt ) ) + { + LanguageType eLangType = GetpApp()->GetSettings().GetLanguage(); + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > + xFactory = comphelper::getProcessServiceFactory(); + SvNumberFormatter aFormatter( xFactory, eLangType ); + + sal_uInt32 nIndex; + xub_StrLen nCheckPos = 0; + short nType; + + String aFmtStr = *pFmt; + aFormatter.PutandConvertEntry( aFmtStr, + nCheckPos, + nType, + nIndex, + LANGUAGE_ENGLISH, + eLangType ); + + if( nType == NUMBERFORMAT_DATE || + nType == NUMBERFORMAT_TIME || + nType == NUMBERFORMAT_DATETIME ) + { + double dt = GetDate(); + Color* pColor; + aFormatter.GetOutputString( dt, nIndex, rRes, &pColor ); + return; + } + } + SbxDataType eType = GetType(); switch( eType ) { |