summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/defltuno.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-04-12 15:45:51 -0400
committerKohei Yoshida <kyoshida@novell.com>2010-04-12 15:45:51 -0400
commit4f0c1853cde2a99e8993b4f14d852a98357fd81e (patch)
treee7ecf2fd8216e3a900cae386052956cd26e7c43e /sc/source/ui/unoobj/defltuno.cxx
parent7bc8414f4c19cf5641600605de97b8adb2e5b860 (diff)
koheiautodecimal: #i110634# Don't export negative decimal-places esp. when the standard precision is "unlimited" (i.e. has an internval value of 65535 which would become -1 whne casted to *signed* 16-bit integer).
Diffstat (limited to 'sc/source/ui/unoobj/defltuno.cxx')
-rw-r--r--sc/source/ui/unoobj/defltuno.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx
index 7f4687bd4bba..d5bacf840292 100644
--- a/sc/source/ui/unoobj/defltuno.cxx
+++ b/sc/source/ui/unoobj/defltuno.cxx
@@ -49,6 +49,8 @@
#include "unonames.hxx"
#include "docoptio.hxx"
+#include <limits>
+
using namespace ::com::sun::star;
//------------------------------------------------------------------------
@@ -253,7 +255,12 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyValue( const rtl::OUString& aProp
if (pDoc)
{
const ScDocOptions& aDocOpt = pDoc->GetDocOptions();
- aRet <<= static_cast<sal_Int16> (aDocOpt.GetStdPrecision());
+ sal_uInt16 nPrec = aDocOpt.GetStdPrecision();
+ // the max value of unsigned 16-bit integer is used as the flag
+ // value for unlimited precision, c.f.
+ // SvNumberFormatter::UNLIMITED_PRECISION.
+ if (nPrec <= ::std::numeric_limits<sal_Int16>::max())
+ aRet <<= static_cast<sal_Int16> (nPrec);
}
else
throw uno::RuntimeException();