Commit Graph

382 Commits

Author SHA1 Message Date
Stephan Bergmann
cc20344010 tdf#111313: Honor bWriteNoLenParam in !bCompatibility, too
e8deba22e8 "INTEGRATION: CWS ab26" had added
the bCompatibility case with all the argument checking ("2006/05/04 08:33:46 ab
1.66.10.3: #111951# Changed Mid runtime behaviour only for
CompatibilityMode(true)"), and it was probably an oversight that, for
!bCompatibility, it left the bWriteNoLenParam case (triggered by Basic code like

  s = "abc"
  Mid(s,1) = "d"

) calling OUStringBuffer::remove with an illegal argument of len=-1.

Change that so that only setting ERRCODE_BASIC_BAD_ARGUMENT is controlled by
bCompatibility, while all the other checks (that are probably all necessary to
not call rtl string functions with illegal arguments) are done in both modes.

Also, the check

  nStartPos + 1 > nArgLen

should probably be

  nStartPos > nArgLen

instead, as nStartPos has already been decremented from the one-based Basic
index to the zero-baesd rtl string index.

Change-Id: I75deec0acf75b8677aa89f91897c06c1caa5614d
Reviewed-on: https://gerrit.libreoffice.org/52500
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-06 14:56:20 +02:00
Caolán McNamara
d75144cf44 convert remaining InfoBox to weld::MessageDialog
Change-Id: I91d828e38d96264cf4a76f30940942556b8f78d8
Reviewed-on: https://gerrit.libreoffice.org/50205
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-25 20:03:26 +01:00
Stephan Bergmann
9af8f190ed More loplugin:cstylecast on Windows
Automatic rewrite (of loplugin:cstylecast and loplugin:unnecessaryparen) after
cab0427cad "Enable loplugin:cstylecast for some
more cases" and a409d32e7f "More
loplugin:cstylecast"

Change-Id: Ib3355159dd08333e1b7a8d091caf2069cdcc7862
Reviewed-on: https://gerrit.libreoffice.org/48317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-23 07:54:51 +01:00
Noel Grandin
5954878448 loplugin:useuniqueptr in SbiGlobals
Change-Id: I0ebec3193b4369039f90be4223ebdf6d048b8478
2018-01-19 08:58:46 +02:00
Stephan Bergmann
3a40d3de89 More loplugin:cstylecast: basic
Change-Id: I0bb219632da384ab047a2b1fc3f2b041dacaf2cb
2018-01-15 09:07:14 +01:00
Stephan Bergmann
6070aaa47d More loplugin:cstylecast: basic
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I20b38196ee1b6a34384dc46d9de1b6e1b44947ae
2018-01-12 20:29:14 +01:00
Noel Grandin
00bc5a0973 wrap scoped enum around css::util::NumberFormat
Change-Id: Icab5ded8bccdb95f79b3fa35ea164f47919c68fa
Reviewed-on: https://gerrit.libreoffice.org/46339
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
2017-12-19 22:08:26 +01:00
Eike Rathke
ef6940a480 Save an unnecessary duplicate GetObject() call
Change-Id: Ib0efc84ad2cedc1a149fa57996bc0481bd64591b
2017-12-05 20:06:07 +01:00
Eike Rathke
36493607d8 Simplify the IsObject()/GetObject() logic here
Change-Id: I816b15b6795b4946b1bfed0d1f6d103a6a1aba4f
2017-12-05 18:30:22 +01:00
Eike Rathke
d1cd68fac3 Rather call GetObject() only if IsObject(), tdf#112571 follow-up
Which effectively is what GetObject() internally also does to
determine whether to set an error, so resetting an error here is
moot (or might even hide a nested error?).

Change-Id: I8736d16e386d1833126965538f96aaa1fd73dfd6
2017-12-05 18:17:06 +01:00
Eike Rathke
863e269cd3 Resolves: tdf#114232 reset error after unsuccessful GetObject() query
Probably broken already since

    commit 0b21b8b146
    Date:   Wed Oct 6 10:16:27 2010 +0100

        initial commit for vba blob ( not including container_control stuff )

Change-Id: Iecce564851a76921b491ff101365c70883ad7475
2017-12-05 17:27:57 +01:00
Eike Rathke
2f8174594d Aaand another one.. SvNumberFormatter instance
... just to parse with LANGUAGE_ENGLISH_US if system locale failed..

Change-Id: Id9b7cfb5b5f21c46789f30e8e8c72a7524491e95
Reviewed-on: https://gerrit.libreoffice.org/45238
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-11-24 21:32:01 +01:00
Eike Rathke
4b98e352e5 Make the SbiInstance SvNumberFormatter shared_ptr
In preparation to get rid of the per call locally created
SvNumberFormatter instances..

Change-Id: Ic7db3bbb655aa18e939f5722964655a20f2eadf2
Reviewed-on: https://gerrit.libreoffice.org/45227
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-11-24 21:30:02 +01:00
Caolán McNamara
2161d04688 drop duplicate method
Change-Id: Idadd0a64e41cd02f5167b275081c3576a6224b12
Reviewed-on: https://gerrit.libreoffice.org/45075
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-22 13:33:25 +01:00
Noel Grandin
5d618d73ed loplugin:constantparam in basic,basctl
Change-Id: If918c42d4b82d78c07786cfa47c74d0dfb7493d6
Reviewed-on: https://gerrit.libreoffice.org/44131
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-01 07:14:13 +01:00
Mike Kaganski
daf7c3e732 basic: consistently use "" and <> in include directives
Change-Id: I147c0e9b9b1e09af593f54799e45e1348cd40716
Reviewed-on: https://gerrit.libreoffice.org/43298
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-10 07:43:46 +02:00
Mike Kaganski
1944e3ddc0 Rename and move SAL_U/W to o3tl::toU/W
Previosly (since commit 9ac98e6e34)
it was expected to gradually remove SAL_U/W usage in Windows code
by replacing with reinterpret_cast or changing to some bettertypes.
But as it's useful to make use of fact that LibreOffice and Windows
use compatible representation of strings, this commit puts these
functions to a better-suited o3tl, and recommends that the functions
be consistently used throughout Windows-specific code to reflect the
compatibility and keep the casts safe.

Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6
Reviewed-on: https://gerrit.libreoffice.org/43150
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-05 16:02:52 +02:00
Mike Kaganski
c3609f107b Use SAL_W/SAL_U instead of reinterpret_cast btwn wchar_t* and sal_Unicode*
This is type-safe, and allows to catch cases where a source type
is changed for some reason, but reinterpret_cast masks that

Change-Id: Ib64b6fa2e22d94a6bba890f0ccc3e20325c6f0a1
Reviewed-on: https://gerrit.libreoffice.org/42961
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-30 19:08:28 +02:00
Mike Kaganski
362a21d3a1 Use explicit function names for fooA/fooW WinAPI; prefer fooW
We should only use generic foo function name when it takes params
that are also dependent on UNICODE define, like
LoadCursor( nullptr, IDC_ARROW )
where IDC_ARROW is defined in MSVC headers synchronised with
LoadCursor definition.

We should always use Unicode API for any file paths operations,
because otherwise we will get "?" for any character in path that
is not in current non-unicode codepage, which will result in failed
file operations.

Change-Id: I3a7f453ca0f893002d8a9764318919709fd8b633
Reviewed-on: https://gerrit.libreoffice.org/42935
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-30 11:23:41 +02:00
Julien Nabet
5c0ab63e7d Replace list by vector in methods.cxx (basic)
Change-Id: I75ad4d22dd6ff95e244fbffc1fc20ae208b2ecd1
Reviewed-on: https://gerrit.libreoffice.org/41796
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-09-01 19:50:46 +02:00
Noel Grandin
4e70d0b6bf rename SBX errorcodes to BASIC
Change-Id: Ia6c2d2379a2f6e9b1109e2c04edd5cdd9dcf242f
Reviewed-on: https://gerrit.libreoffice.org/41706
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-29 19:50:11 +02:00
Armin Le Grand
db6b703d39 Allow non-modal Dialogs during FileImport/Load
When opening a file that triggers Dialogs (e.g. cannot
read/repair/FileType) the Frame from which it was
initialized gets blocked. This irritates quite some
people. Changed this to a non-modal Dialog so that
the user can continue to work with all opened docs,
open new ones, close and print/PDF/export these.

Change-Id: I048d3de3369527cec20d26396b87439254764b8a
Reviewed-on: https://gerrit.libreoffice.org/41534
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
2017-08-25 11:31:42 +02:00
Noel Grandin
dcc667ac5e convert message box style bits to scoped enum
and fix harmless bug in ImpSVGDialog::ImpSVGDialog, which there since

    commit 6456f1d810
    Date:   Fri Feb 4 14:52:54 2011 +0100
    ka102: added/removed files for SVG import and module cleanup

Change-Id: I66b2ec2b029431ab453e54e962863e4ed7d78962
Reviewed-on: https://gerrit.libreoffice.org/41412
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-23 08:47:52 +02:00
Noel Grandin
9881bea8d4 remove unnecessary use of OUString::getStr
Change-Id: I3d13e1c0bb6aa4a7aacc463198747c1368ebc9b4
Reviewed-on: https://gerrit.libreoffice.org/38114
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-17 11:55:13 +02:00
Noel Grandin
2e8acde112 remove UL/L suffixes from integer constants on the RHS of expressions
Change-Id: I899a8126c9d971601fea6c77eca165718aea0ac5
Reviewed-on: https://gerrit.libreoffice.org/41237
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-17 11:25:21 +02:00
Eike Rathke
fcd0361d6b Eliminate Date::operator+=() and -=() and replace with Date::AddDays()
Clarifies code and gets rid of explicitly casting the operand to sal_Int32.

Also in preparation of removing DateTime::operator+=(sal_Int32) that is
confusingly similar to DateTime::operator+=(double) and just depends on type.

Change-Id: I83422e2940fbb017978db9b5734b4966228af3de
Reviewed-on: https://gerrit.libreoffice.org/40248
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-07-21 12:24:27 +02:00
Caolán McNamara
00657aef09 migrate to boost::gettext
* all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl
* all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string")
* ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching
  MODULE .mo files
* UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui
  goes from l10n target to normal one, so the res/lang.zips of UI files go away
* translation via Translation::get(hrc-define-key, imbued-std::locale)
* python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there
  to keep finding the .hrc file uniform) so magic numbers can go away there
* java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation
  mechanism
* en-US res files go away, their strings are now the .hrc keys in the source code
* remaining .res files are replaced by .mo files
* in .res/.ui-lang-zip files, the old scheme missing translations of strings
  results in inserting the english original so something can be found, now the
  standard fallback of using the english original from the source key is used, so
  partial translations shrink dramatically in size
* extract .hrc strings with hrcex which backs onto
   xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap
* extract .ui strings with uiex which backs onto
   xgettext --add-comments --no-wrap
* qtz for gettext translations is generated at runtime as ascii-ified crc32 of
   content + "|" + msgid
* [API CHANGE] remove deprecated binary .res resouce loader related uno apis
      com::sun::resource::OfficeResourceLoader
      com::sun::resource::XResourceBundleLoader
      com::sun::resource::XResourceBundle
    when translating strings via uno apis
      com.sun.star.resource.StringResourceWithLocation
    can continue to be used

Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
2017-07-21 08:20:50 +01:00
Noel Grandin
6d829ae4f2 loplugin:constparams in basic
Change-Id: Idf55f63f2d56be4997a8cdc6afc5690eacac9a60
Reviewed-on: https://gerrit.libreoffice.org/40214
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-20 12:01:08 +02:00
Eike Rathke
772b846c46 Change the most obvious Date+=(long)... to Date+=static_cast<sal_Int32>(...)
Simple search
git grep -l 'Date.*[+-].*[(<] *long *[>)]'

Since

    commit f5b0cc2a36
    Date:   Sat Jul 1 16:01:15 2017 +0200

Date operators +,-,+=,-= have sal_Int32 operands instead of long.

Change-Id: I2387cbceadcb056831225e4111353980d50a94d4
Reviewed-on: https://gerrit.libreoffice.org/40163
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-07-19 20:12:58 +02:00
Stephan Bergmann
9f08211d24 loplugin:unnecessaryparen: basic (clang-cl)
Change-Id: Id6e339a4d1bc775826ff434bc77beb05fe353324
2017-07-17 17:16:51 +02:00
Noel Grandin
4b2262ab5b new loplugin unnecessaryparen
Change-Id: Ic883a07b30069ca6342d7521c8ad890f4326f0ec
Reviewed-on: https://gerrit.libreoffice.org/39549
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-05 11:08:48 +02:00
Stephan Bergmann
56dcc7b65f loplugin:casttovoid in RTLFUNC
Change-Id: I810278640936e9b3c73f56a37e8c4786fd2790e3
2017-07-04 08:15:07 +02:00
Stephan Bergmann
c8fd385d61 loplugin:casttovoid: basic
Change-Id: I4e70accf67d4d812b8998b0baa07cd04c27216ad
2017-07-02 22:35:38 +02:00
Noel Grandin
6ee9f2c188 loplugin:oncevar accessibility..basic
Change-Id: I8fb41b658ef0f6ad1774ea897eace3dc9bb12de6
Reviewed-on: https://gerrit.libreoffice.org/38969
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-20 07:50:06 +02:00
Noel Grandin
7aee0ea7c5 replace SbxError typedef with ErrCode
part of a larger patch to convert ErrCode to strong_int

Change-Id: Ia56e5d6d8c4217d6f258e2113d20ce737977892f
Reviewed-on: https://gerrit.libreoffice.org/38813
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-15 09:48:11 +02:00
Noel Grandin
3059ede409 drop SbError typedef
in favour of ErrCode.
Part of a larger patch to convert ErrCode to strong_int

Change-Id: Ia846bfc93c58c85c6a6cec79e9d19b9ecbd1c05f
Reviewed-on: https://gerrit.libreoffice.org/38783
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-15 08:25:22 +02:00
Noel Grandin
a6aa57ff59 use ERRCODE_NONE instead of 0
peeling off a small chunk of my ErrCode strong_int conversion

Change-Id: Idc89e8496083beed7608cba705cd981139eb7111
Reviewed-on: https://gerrit.libreoffice.org/38777
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-14 15:42:31 +02:00
Noel Grandin
de8caac6be replace SVSTREAM_OK with ERRCODE_NONE
since the first is #define'd to the second, and offers no extra value

Change-Id: I2c67e09ea3aa5361b8e7dfe7a20858c6ae054450
Reviewed-on: https://gerrit.libreoffice.org/38406
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-06 08:15:57 +02:00
Noel Grandin
2e51afc77c loplugin:comparisonwithconstant in basic
Change-Id: Ie34a17d2fb465ffbe675ba4e99917d23959f1fb5
Reviewed-on: https://gerrit.libreoffice.org/37809
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-19 12:53:34 +02:00
Johnny_M
2c3f58eff2 Translate German comments and debug strings (leftovers in dirs a... to c...)
Translates all (leftovers) found using a custom regex, in directories not
shown by /bin/find-german-comments and beginning with "a" to "c".

Change-Id: I3b0152ee78ad80a29d714cbd98bf888f31be4763
Reviewed-on: https://gerrit.libreoffice.org/37573
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-05-15 15:27:52 +02:00
Noel Grandin
389da66dfc remove unused uno::Reference vars
found by temporarily marking Reference as SAL_WARN_UNUSED.

Change-Id: I18809b62654467f890016adcc92576980ced393b
Reviewed-on: https://gerrit.libreoffice.org/37511
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-12 09:56:01 +02:00
Eike Rathke
cc0ea8bb25 More likely month pos first
Change-Id: I0033c176071642f8df245307af79b8505644a004
2017-05-03 16:37:50 +02:00
Eike Rathke
e0eb3f5edd CDateFromIso: accept YYMMDD two digit year for compatibility
Some may even rely on that..

Change-Id: Icdaf9b2917aa0b1ca5e76c5220022c65fc654d86
2017-05-03 16:13:21 +02:00
Eike Rathke
6d424f0770 Replace mouth-painted "inaccurate around leap year" rollover algorithm
... with proper tools::Date methods Normalize() and AddMonths().

Also prepare functionality to easily switch on rollover for StarBASIC as well,
i.e. when called by DateSerial() runtime function.

For StarBASIC, invalid date for day > daysinmonthofyear is now (or better since
a previous commit 94bb96ada421b423e9ed30526fe5a6aac95f00b9 from today) properly
detected, not just dumb 1<=day<=31.

Change-Id: Ibb44f7247726f1e1168f0e66c5ae18e073d19f08
2017-05-02 23:12:34 +02:00
Eike Rathke
b5483b46f6 SbiRuntime::isVBAEnabled() needs to be guarded with #if HAVE_FEATURE_SCRIPTING
Change-Id: I7fab0c946c13a9779fad05f88be6ae6a9da93775
2017-05-02 16:06:51 +02:00
Eike Rathke
1b13548f33 BASIC: handle the full tools::Date range from -32768-01-01 to 32767-12-31
* Input of two-digit years only possible through CDateFromIso() though to
  maintain compatibility with previous behavior and also VBA mode.
* VBA mode restricted to years 1..9999

Change-Id: Ia9574c3bf136619b4831b349d263c96b162d1ed4
2017-05-02 15:56:20 +02:00
Eike Rathke
38d9919432 CDateToIso: larger buffer for possible year range
Theoretically tools::Date can hold five digits years and even negative,
though Basic internally accepts only 100<=year<=9999. Might be that some
date calculations may result in years out of those margins, so at least
don't truncate those.

Change-Id: I3c217cc42476ce1cf8f9046111a1281288dc5bb6
2017-04-29 00:23:14 +02:00
Eike Rathke
d6fd4252bf Use invalid parameter error for malformed input, tdf#106956 follow-up
... instead of invalid procedure call.

Change-Id: I812f4c7041db9a116e65a24afb85164b4dd498b6
2017-04-28 16:13:36 +02:00
Eike Rathke
cdcbdf88b7 Resolves: tdf#106956 CDateFromIso accept also YYYY-MM-DD form
Previous implementation was over-simplified and accepted all sort of malformed
input to yield some arbitrary date, including longer and shorter and not
strictly numeric strings.

Change-Id: I2158429aeff7431f5ec5a1c9125018a5455a4730
2017-04-28 15:46:33 +02:00
Noel Grandin
c70d49c7c8 use strong_int for LanguageType
Change-Id: If99a944f7032180355da291ad283b4cfcea4f448
Reviewed-on: https://gerrit.libreoffice.org/36629
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-26 08:50:54 +02:00