summaryrefslogtreecommitdiff
path: root/chart2/source/view/main/NumberFormatterWrapper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/view/main/NumberFormatterWrapper.cxx')
-rw-r--r--chart2/source/view/main/NumberFormatterWrapper.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/chart2/source/view/main/NumberFormatterWrapper.cxx b/chart2/source/view/main/NumberFormatterWrapper.cxx
index a36f13793a2b..2a01d2f1cde3 100644
--- a/chart2/source/view/main/NumberFormatterWrapper.cxx
+++ b/chart2/source/view/main/NumberFormatterWrapper.cxx
@@ -40,6 +40,7 @@
#include <tools/color.hxx>
#include <i18npool/mslangid.hxx>
#include <tools/debug.hxx>
+#include <com/sun/star/util/DateTime.hpp>
//.............................................................................
namespace chart
@@ -83,6 +84,10 @@ NumberFormatterWrapper::NumberFormatterWrapper( const uno::Reference< util::XNum
, m_pNumberFormatter(NULL)
{
+ uno::Reference<beans::XPropertySet> xProp(m_xNumberFormatsSupplier,uno::UNO_QUERY);
+ rtl::OUString sNullDate( RTL_CONSTASCII_USTRINGPARAM("NullDate"));
+ if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(sNullDate) )
+ m_aNullDate = xProp->getPropertyValue(sNullDate);
SvNumberFormatsSupplierObj* pSupplierObj = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
if( pSupplierObj )
m_pNumberFormatter = pSupplierObj->GetNumberFormatter();
@@ -108,8 +113,27 @@ rtl::OUString NumberFormatterWrapper::getFormattedString(
DBG_ERROR("Need a NumberFormatter");
return aText;
}
+ // i99104 handle null date correctly
+ USHORT nYear = 1899,nDay = 30,nMonth = 12;
+ if ( m_aNullDate.hasValue() )
+ {
+ Date* pDate = m_pNumberFormatter->GetNullDate();
+ if ( pDate )
+ {
+ nYear = pDate->GetYear();
+ nMonth = pDate->GetMonth();
+ nDay = pDate->GetDay();
+ } // if ( pDate )
+ util::DateTime aNewNullDate;
+ m_aNullDate >>= aNewNullDate;
+ m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year);
+ }
m_pNumberFormatter->GetOutputString(
fValue, nNumberFormatKey, aText, &pTextColor);
+ if ( m_aNullDate.hasValue() )
+ {
+ m_pNumberFormatter->ChangeNullDate(nDay,nMonth,nYear);
+ }
rtl::OUString aRet( aText );
if(pTextColor)