summaryrefslogtreecommitdiff
path: root/svl/source/numbers
AgeCommit message (Collapse)Author
2016-10-17let LanguageTag::convertToLocale() decide when to create a temporaryEike Rathke
Change-Id: Id4e718eb23d4acf2ee7bddc4da1cd4e8e811be78
2016-10-10tdf#36038 Import extended LCID from ExcelLaurent Balland-Poirier
Extended LCID were only supported for Thai. This commit import also for some other numerals and calendars. Change-Id: Id92a0ee2a32c5722e9674fe0ac5ff7028c84bca6 Reviewed-on: https://gerrit.libreoffice.org/28809 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-10-10tdf#36038 Export to Excel extended LCIDLaurent Balland-Poirier
Number format: extend export to Excel of long LCID for other languages and calendars than only Thai and Buddhist Change-Id: I826347302d14caa5b4463d28cd25f2c36ebfef5d Reviewed-on: https://gerrit.libreoffice.org/28666 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2016-10-07tdf#102370 Correctly export to Excel exponent without signLaurent Balland-Poirier
Exponent without sign in scientific notation is coded in Excel with a minus sign replacing plus sign: 0.00E-00 for instance This format is already correctly treated in Calc but was not correctly exported to Excel or ODF Change-Id: Ide117b04e0eb887c6cdd6699ae8ec723d1d29d50 Reviewed-on: https://gerrit.libreoffice.org/29198 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2016-10-07loplugin:staticmethods: svlStephan Bergmann
Change-Id: I5cadb5e19790a941c719253966bc65d54e2b60bd
2016-10-05tdf#102507 Left aligned denominatorLaurent Balland-Poirier
In denominator, move blanks at the end of string to have denominator left aligned Change-Id: Ic7ce45dc1ba8c343232a0d4fa1bed2bde58a0bc2 Reviewed-on: https://gerrit.libreoffice.org/29267 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-10-05Remove _TYPED suffix from tools/link.hxx macrosStephan Bergmann
...which was introduced with 3ead3ad52f9bb2f9d1d6cf8dfc73a0a25e6778ed "Gradually typed Link" to distinguish the new, typed versions from the old, untyped ones, but is no longer necessary since 382eb1a23c390154619c385414bdbe6f6e461173 "remove untyped Link<>" removed the old versions. Change-Id: I494025df486a16a45861fcd8192dfe0275b1103c
2016-09-26prevent adding duplicates in calls to GetCurrencyFormatStrings()Eike Rathke
Identical currency format codes popped up with fabb8f48dd89d71378daf293a974a412deccc961 that adds several currency symbols for the same ISO currency code, which of course also duplicates the format codes that use the ISO code. Do not offer them in UI which just looks confusing. Change-Id: I0bf039c400aa2e3bad946848ed4e57c8cfcb0fc3
2016-09-23Fix Cppcheck report: reduce scope of the variable 'fTemp'Laurent Balland-Poirier
Change-Id: I935de8e287f94f3219542dfe67f7bb4a05be14da Reviewed-on: https://gerrit.libreoffice.org/29200 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-22Missing "const"Stephan Bergmann
Change-Id: Ib0cd605cf8e71e94f4442c07300726aff1d9ce03
2016-09-22tdf#53698: Add a NumberFormatMapper member to SvNumberformatScanMaarten Bosmans
This way the NumberFormatMapper can cache subsequent getFormatCode calls. It improves performance in case LANG=en_US. Change-Id: I81922f219c29a5aa302e5ad3afead107dee463e3 Reviewed-on: https://gerrit.libreoffice.org/29135 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-22Remove NumberFormatCodeWrapperMaarten Bosmans
This class only adds a level of indirection, without any useful functionality. Change-Id: I806e1b9241caf025c62c12c93aad3101daac874a Reviewed-on: https://gerrit.libreoffice.org/29134 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-13loplugin:override: No more need for the "MSVC dtor override" workaroundStephan Bergmann
The issue of 362d4f0cd4e50111edfae9d30c90602c37ed65a2 "Explicitly mark overriding destructors as 'virtual'" appears to no longer be a problem with MSVC 2013. (The little change in the rewriting code of compilerplugins/clang/override.cxx was necessary to prevent an endless loop when adding "override" to OOO_DLLPUBLIC_CHARTTOOLS virtual ~CloseableLifeTimeManager(); in chart2/source/inc/LifeTime.hxx, getting stuck in the leading OOO_DLLPUBLIC_CHARTTOOLS macro. Can't remember what that isAtEndOfImmediateMacroExpansion thing was originally necessary for, anyway.) Change-Id: I534c634504d7216b9bb632c2775c04eaf27e927e
2016-09-09loplugin:constantparam in sot..svlNoel Grandin
Change-Id: I08db2db3b90725c556e3ba062da5d62d98f6e882 Reviewed-on: https://gerrit.libreoffice.org/28769 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-09-01tdf#79398 Insert LCID in the correct sub-formatLaurent Balland-Poirier
During XL export, LCID is insert in format if necessary. If there are several sub-formats ([>0];[<0];[0]) this commit insert LCID in the correct one. Change-Id: I016c38a3338634113bfc0aa7e20e028e2e01e201 Reviewed-on: https://gerrit.libreoffice.org/28427 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-08-30loplugin:stringconstant: adapt to improved OUStringLiteral1 (svl)Stephan Bergmann
Change-Id: I5b9c503fd28209b893688e81ddd00eb843b44e37
2016-08-23rename rNum to aNatNumEike Rathke
... since it is a copied instance now. Change-Id: Ied3845cde42cb39ecabafa660d3ba7f6b1ca8b48
2016-08-23tdf#79398 Add LCID with DBNum during export to XLLaurent Balland-Poirier
Change-Id: I64a01ef5eb7ada9bc5edbeb873e09fd348d8f6d4 Reviewed-on: https://gerrit.libreoffice.org/28256 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-08-22tdf#101636 Test index before reading OUStringLaurent Balland-Poirier
Change-Id: I0a4c02b172fc6d3273f6aa2cca855c27705b4d68 Reviewed-on: https://gerrit.libreoffice.org/28282 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-08-16Fraction Number Format: add UI/Sidebar optionsLaurent Balland-Poirier
Enable modification of fraction number format through dialog UI: - negative in red - "Decimal places" is replaced with "Denominator places" - leading zeros for integer part - thousand separator for integer part Update: options in Sidebar Thousand separator works, also for ' ' as thousand separator Change-Id: I0ed2952ed9cd8afb5444b44997526e5019a5858d Reviewed-on: https://gerrit.libreoffice.org/27268 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Laurent BP <laurent.balland-poirier@laposte.net>
2016-08-16loplugin:stringstaticStephan Bergmann
Change-Id: Icb05f681aa549a975ae4a1dee749e20ad4a215f0
2016-08-15properly move bLCIDInserted=true into the conditionEike Rathke
Change-Id: Iaad1b3cb2ee4e7dd293af00eb738cfd66c8b94d6
2016-08-15use SvNumberNatNum::IsComplete() instead of IsSet(), tdf#79398 follow-upEike Rathke
IsComplete() takes into account if the language was also set, output is transliterated only if complete. Change-Id: I1b7c2c8dbd308604c7af9aa5d1aa3ff0c1b436ca
2016-08-15tdf#79398 Export to XL DBNum codesLaurent Balland-Poirier
Change-Id: Ibe24b68b89909eecdf73fe4f7db19de26396194d Update: only if corresponding code exists Reviewed-on: https://gerrit.libreoffice.org/28090 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2016-08-15tdf#101462 tdf#79399 lcl_matchKeywordAndGetNumber returns integerLaurent Balland-Poirier
This prevent [DBNumX] format codes to be recognized Fix in the same time tdf#79399 (import of [DBNumX] from XL) Do NOT fix yet tdf#79398 (export of [DBNumX] to XL) Change-Id: I08817818bf0ff30b4704bb69b2ac9aa3890c7aa6 Reviewed-on: https://gerrit.libreoffice.org/28071 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2016-08-11Fix comments to match new reality: these are no longer optional parametersTor Lillqvist
Change-Id: Idf054aa4ef095ce37f05a01adf59cb450a6906c6
2016-08-11loplugin:countusersofdefaultparams in svl..unodevtoolsNoel Grandin
Change-Id: Ie3d2cf29e99b8a51b80246aafa23a92e6c3404b2 Reviewed-on: https://gerrit.libreoffice.org/28017 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-08-09remove the duplicated system locale checkEike Rathke
... which is handled by LanguageTag::convertToLanguageType() anyway. Change-Id: I26656d64fdccf9c06d24c53e1e473e355732e00f
2016-08-09do not resolve system locale when queried, rhbz#1364406 relatedEike Rathke
When loading older documents that calculated a number format on the fly an inherited but default format of a type could had been applied using the fixed resolved locale instead of the default system locale, which then was stored upon save and remained sticky. This because a format the formula depends on already was applied using the resolved system locale. http://bugs.documentfoundation.org/attachment.cgi?id=78559 of tdf#63267 exhibits the behavior on the hidden sheet 'Festwerte' when unprotected and inspecting number formats in column A under Datum. Change-Id: If23908f259458e988c5164cc5e268bfc9a6a6bcd
2016-08-05force integer display if numerator and denominator are equalEike Rathke
So with {# ?/?} format 1.96 is displayed as "2" insted of "1 1/1" Change-Id: I756deeb884d41726c7d476a236d3c68b89fe9cba
2016-08-05tdf#101147 New approach to fix minute/month detectionLaurent Balland-Poirier
Other formats may be differently interpreted HH YY/MM => Month expected HH DD/MM => Month expected Change-Id: Iabb17911bf2907c02b6b898052b6933692f8074a Reviewed-on: https://gerrit.libreoffice.org/27823 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-08-02break the Excel rule for YMD and DMY, tdf#101147 follow-upEike Rathke
Clearly in {HH YYYY-MM-DD} the MM should not be minute. Also not in {HH DD.MM.YY}. Don't follow every bullshit. Period. It is debatable how to treat MDY, {HH:MM DD/YY} should be different from {HH MM/DD/YY}, Excel ironically takes both as minute, even in an en-US locale. Change-Id: I13d39a36294e3c40cc0e9bf72026804b299bb264
2016-08-01tdf#101147 Improve (again) minute/month detectionLaurent Balland-Poirier
For format like HH:MM:SS MM/DD second MM is detected as minute: see tdf#95339 New rules: - first M following each H is minute - first M following first S is minute Detection Month/minute now fully compatible with Excel even with unwanted detection: SS:MM:HH DD/MM/YY second MM is minute even if user would expect month Change-Id: Ia789fbc2dbd6d2dcbe9b9c34d3f288674966dd10 Reviewed-on: https://gerrit.libreoffice.org/27560 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-07-29loplugin:countusersofdefaultparams in store..svtoolsNoel Grandin
Change-Id: I15b4400bddc5a4d0e3de5dfffe18b7e493f97df6 Reviewed-on: https://gerrit.libreoffice.org/27580 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-07-27tdf#100834 Extend ODF for integer/fraction delimiterLaurent Balland-Poirier
Any string can be used as delimiter between integer and fraction. It is now saved/loaded to/from ODF, as it was from XLS. Change-Id: Ie6364d1cdefc020ea615c18099118135c619f96b Reviewed-on: https://gerrit.libreoffice.org/27262 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-07-25obtain PreviousChar() only if necessaryEike Rathke
Change-Id: Ib23b34fd927eaecef1868fbeebde0a28399dc0c3
2016-07-25Resolves: tdf#101096 remove the "H after M" ruleEike Rathke
wrongly introduced with c9ed6e832213129cc579c1c309ce9dbd3593c57a Change-Id: Ic6c9c404ad0af11eb5d638f453150ee0da60e633
2016-07-25Revert "tdf#101096 Improve minute/month disambiguation"Eike Rathke
This reverts commit cb94d2fbd9596aca45d915a599caa671a261c2a2. There's an easier solution not leaving unhandled corner cases.
2016-07-25tdf#101096 Improve minute/month disambiguationLaurent Balland-Poirier
To fix tdf#95339 M-H was treated as minute-hour But for "D.M.H" it should be treated as day.month.hour THis commit extends test to detect if - in case of M.H: there is day or year previous M => M stands for month - in case of S.M: there is day or year after M => M stands for month Some ambiguous cases like S.M.D are now treated as it was previously (month) Change-Id: I048eb227a738b6c453e39d9208bef0d1fda136a0 Reviewed-on: https://gerrit.libreoffice.org/27493 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-07-22svl: fix loplugin:loopvartoosmall warningsMiklos Vajna
Change-Id: I003719f67e6c1f0f48580c414b2ef7a7a2a2abcb
2016-07-22tdf#100834 String between integer and fractionLaurent Balland-Poirier
Fraction number format Insert Blank delimiter string between Integer/Fraction only if both of them are present In other cases, replace string with blank string if there are some '?' in formats Else insert nothing. If there is no fraction part, insert blank instead of '/' if there are some '?' in formats Change-Id: Ib606bdaa2b3809f15ce23acc3b5b6ee3fdbd230d Reviewed-on: https://gerrit.libreoffice.org/27252 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-07-15tdf#100834 Treat string between integer and fraction as delimiterLaurent Balland-Poirier
In fraction number format, strings located between integer and fraction should be treated as blank delimiter Change-Id: I83e78fb0fe08178ee194fc2a213ee260ce15c639 Reviewed-on: https://gerrit.libreoffice.org/27128 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2016-07-15tdf#100755 Allow '0' for denominator symbolLaurent Balland-Poirier
Fraction number format Accept '0' in numerator and denominator format: 0 0/0 Represent integer 3 as: 3 0/1 Load and save format to Excel As it cannot (yet) be saved in ODF, replace 0 by ? during save to ODF Change-Id: I4721a751431d3f9b903b369d199146ddfb76b43d Reviewed-on: https://gerrit.libreoffice.org/27062 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-07-12tdf#100842 Do not insert things in the middle of the numberLaurent Balland-Poirier
With fraction number format, if number is longer than number of digits in format jump to the beginning of number before inserting extras: strings, blank, star filling Do not do this for exponent of scientific format as it may contain unwanted 0 at beginning. Change-Id: Ide99f5cba198f76541f0e4e17b29469a99b57b9f Reviewed-on: https://gerrit.libreoffice.org/27097 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-07-08Resolves: tdf#100452 class Date full (BCE,CE) proleptic Gregorian calendarEike Rathke
... implementing signed years with year 0 gap. Date(31,12,-1) last day BCE Date(1,1,1) first day CE New class Date member functions: * AddYears(sal_Int16) to be used instead of aDate.SetYear(aDate.GetYear()+sal_Int16) to handle year 0 gap. * convenience GetNextYear() to be used insted of GetYear()+1 * convenience GetPrevYear() to be used insted of GetYear()-1 * AddMonths(sal_Int32) * operator=(const css::util::Date&) New class DateTime member functions: * operator=(const css::util::DateTime&) Made some conversion ctors explicit, specifically Date(sal_Int32) Adapted hopefully all places that used a sal_uInt16 year to use sal_Int16 where appropriate. Eliminated some quirks in date handling found on the fly. Added era handling to i18npool icu calendar setting interface, which missing was responsible for 0001-01-01 entered in Calc being set as -0001-01-01, hence subtracting one day resulted in -0002-12-31. Change-Id: I77b39fba9599ebd5067d7864f6c9ebe01f6f578f Reviewed-on: https://gerrit.libreoffice.org/27049 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2016-07-05tdf#100754 Allow text after forced denominator fractionLaurent Balland-Poirier
For a fraction number format with forced denominator, stop detecting denominator value after digits Change-Id: I68281c5fc5b8a4c395932dff532179e694cf9827 Reviewed-on: https://gerrit.libreoffice.org/26907 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-07-04tdf#99996 New algorithm for fractionLaurent Balland-Poirier
This new algorithm, based on continued fraction representation: - is smarter (165 lines schrinked in 31) - gives same results for 1 to 3 digits for divider - gives better results for more than 3 digits for divider - is faster: 1.5% for 1 digit, 5% for 2 digits, 20% for 3 digits, 70% for 4 digits See details in bug report In addition - removed uncessary fonctions: ImpGGT and ImpGGTRound - forced denominator do not required anymore calculation of nFrac and nDiv - replace sal_uLong with sal_uInt32 for time - replace sal_uLong with sal_uInt64 for fraction Change-Id: I9bf3a54a5284104718a53406f8784379fd19f6e6 Reviewed-on: https://gerrit.libreoffice.org/26621 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-07-04remove comphelper::string::removeNoel Grandin
and replace it with OUString/OString::replaceAll Change-Id: I37b1c3b51251dfd9d749d6f1060c75b3a93d7f1a Reviewed-on: https://gerrit.libreoffice.org/26850 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-29tdf#100594 Calculate nFrac with fNumber for Forced DenominatorLaurent Balland-Poirier
nFrac was calculated with fraction value = nFrac/nDiv which could be rounded in case of few digits in nDiv Change-Id: I568121b0e7b5ea0b67bbff7bbbb37d2c272c3691 Reviewed-on: https://gerrit.libreoffice.org/26663 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-06-29tdf#100592 Add extra number formats for fractionLaurent Balland-Poirier
Change-Id: Ia3a5fa02029e06e083fcc10748b0deb3048dae79 Reviewed-on: https://gerrit.libreoffice.org/26675 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>