Commit Graph
3280 Commits
Author SHA1 Message Date
RMZeroFour 599b113b73 tdf#42982 Add error messages to thrown exceptions
As part of the efforts in #42982 to improve the UNO API
error reporting, this commit adds error messages in several
files to help improve debugging experience.

Change-Id: I7a51d4fd1e3a57798d70bc3464b034649948a287
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165253
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-03-30 13:32:16 +01:00
Noel Grandin 35d9d669f2 convert OXSDDataType to comphelper::WeakImplHelperBase
Change-Id: Idb299ea698480d0b98ac0deff9d1f9b87e749782
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165442
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-28 19:08:49 +01:00
Armin Le Grand (allotropia) cebbd5795d ITEM: Rename for more control over SlotID usages
Change-Id: I51585f1c15984a066262023184f668662853d20f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163556
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-02-18 21:37:52 +01:00
Armin Le Grand (allotropia) ca3c6d468f ITEM: ItemPool Rework (I)
Driving forward the Item reworks I now take the
ItemPool in focus: It now does not hold any items
anymore and should be renamed to something like
ItemInfoProvider/ItemHelper, since it's main purpose
is to provide the Defaults for the Item functionality.

There is that SfxItemInfo, only a struct and bundling
SlotID and ItemFlags. There are also the DefaultItems,
just handled as ptrs in an array. It is/was always
error-prone to keep these in sync. Remember that it's
also necessary for the order to not only being sorted
but being increments of one with no gaps allowed in
the WhichIDs to which the Items are bound.

I now bundled that to a new class ItemInfo that joins
WhichID, SlotID, ItemFlags and the default Item. This
is a pure virtual base class, it comes in three
derivations:

(1) ItemInfoStatic:
This is supposed to be global static and hosts the
Item in a std::unique_ptr to ensure cleanup. It is
designed to be constructed once during runtime and
being shared globally. It allows the ItemPtr to be
nullptr to mark as non-static (if initial static is
not possible for some reason) but still offers the
needed data. Most cases (95%+) are of that case.
The contained Item is owned by that instance. The
flag isStaticDefault() is set at the Item.

(2) ItemInfoDynamic:
This is supposed to be used for cases where the Item
cannot be static: Mainly for SfxSetItem (that needs
a Pool itself in the contained SfxItemSet, so lifetime
is bound to that Pool), but other cases showed up in
the transition. These instances live while the Pool
lives and get destructed when the Pool goes down.
Also uses std::unique_ptr for the Item instance for
as much automated cleanup as possible, the contained
Item is owned by that instance, the instance by the
Pool. The flag isDynamicDefault() is set at the Item.

(3) ItemInfoUser:
This is used for UserDefaults that can be set for
every ItemInfo entry to 'overshadow' the default
from the 'outside'. It uses a regular Item and
the central access methods implCreateItemEntry/
implCleanupItemEntry to manage the Item instance,
thus works like a SfxPoolItemHolder. The Item
instance can be globally shared and re-used even
when the Pool goes down. Instances belong to the
Pool and are cleaned up when the Pool goes down.
This Item does not need any further flag to be
set.

The ItemInfos are organized using a class
called ItemInfoPackage:

This bundles groups of ItemInfoStatic to
functional instances. There are derivations/
implementations of this e.g. for Writer ItemPool
bundling all the needed defaults for Writer,
similar for draw/impress, Calc and other usages.

These ItemInfoPackage can be 'registered' at an
ItemPool using it's method registerItemInfoPackage.
This does all the needed stuff to setup that
group of ItemInfos at the Pool (It even sets
internal vars First/LastWhich, that info can just
be derived from the buildup ItemInfo Ptrs).

The ItemInfoPackage has methods 'size()' and
'getItemInfo(index) to allow looping over it
and deliver the infos the Pool needs. The
(forced, pure virtual) overloads of getItemInfo
in the specific implementations check for the
ItemPtr being nullptr and create a exclusive
incarnation of ItemInfoDynamic for the Pool if
needed, returning that. The Pool owns the
ItemInfoDynamic incarnations and uses the
ItemInfoStatic directly. On shutdown it cleans
up the ItemInfoDynamic as needed.

The ItemInfoUser is used by the Pool when a
UserDefault is set/used: for SetUserDefaultItem,
GetUserDefaultItem, ResetUserDefaultItem. It
is not held in a 2nd list, but directly in the
list of ItemInfo'ptrs: To keep track of this
an unordered_map is used that helds the original
ItemInfo associated with the WhichID. That way
no two lookups (as before) are needed to get the
current Pool's default for any WhichID.

The derivations of ItemInfoPackage are
encapsulated and just allow access to an
ItemInfoPackage& with a single method as
return value. All use a static local instance
of a std::array<ItemInfoStatic, FIXED_SIZE>
which constructs all ItemInfoStatic and the
static Item instances - if already possible.
Sometimes it is necessary to overload the
constructor to set some static instances
for Items later than the lib init. These are
also just marked with nullptr as Item instance.
Some need to overload getItemInfo to complete
instances of ItemInfoStatic, if needed, or
create and deliver instances of ItemInfoDynamic.

The registerItemInfoPackage also offers a
optional lambda callback: there were two cases
where local data from the Pool was needed to
incarnate the item - just add that to the
call to registerItemInfoPackage if needed,
see examples in the adapted code.

For the re-use of Items this means that now
in SfxItemSet/SfxPoolItemHolder *true* static
Items can and will be used without RefCount
directly and globally. This is also the case
for dynamic Items, with the exception of
differing Pools for SfxSetItems which cannot
be done.

Future:
That design is already prepared to allow
solving that Pool-chaining problem: currently
there are master/sub-pools and all accesses
have to traverse that structure before even
doing anything.
For the future the idea is more to 'compose'
a Pool by registering ItemInfoPackages, e.g.
for Writer pool you may start with SfxItemPool,
register the writer-specific ItemInfoPackage,
then the one for DrawingLayer (if needed) and
the one for EditEngine.
It should also be possible to get to smaller
granularities of that packages. Ideas for
new ones will emerge. We might also think
about composing Pools which can e.g. run Writer
and Chart, so allowing to use Chart *without*
OLE stuff in Writer - just ideas...

More changes:
- Adapted all stuff, cleaned up old stuff/
  definitions
- Removed FreezeIdRanges, that can be done
  once per Pool on-demand (and cannot be
  forgotten to be called)
- Merged XOutdevItemPool with SdrItemPool
  and offered a ItemInfoPackage which joins
  both needed sets of Items
- All the cleanup hassle with Pools and
  defaults cleaned up
- Adapted all access methods of the pool
  to use that new stuff. Pool chaining
  currently stays, but I use a central
  method 'getTargetPool' instead of
  recursive calling to get the correct
  Pool for the action

Change-Id: I2b8d3d4c3cc80b1d0d0b3c0f4bd90d7656b4bab7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163157
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-02-12 10:35:33 +01:00
Armin Le Grand (allotropia) 4790ef5cb5 ITEM: Cleanup some Pool stuff with Defaults
Sorted out some methods at ItemPool which process
Defaults to make more clear what is going on and
what which method is doing.

Change-Id: I2568d3e03d0a56a14b6fe4e04521e1a8e22c000b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162643
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-01-27 19:02:54 +01:00
Mike Kaganski 0fa827dbb2 Drop std::as_const from css::uno::Sequence iterations
Obsoleted by commit 2484de6728 (Remove
non-const Sequence::begin()/end() in internal code, 2021-10-15) and
commit fb3c04bd19 (Drop non-const
Sequence::operator[] in internal code, 2021-11-05).

Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-27 12:43:48 +01:00
Tomaž Vajngerl 049bbd95c1 editeng: change EditEngine getter to ref in {Imp}EditView
{Imp}EditView always needs to have EditEngine set (or it would
crash otherwise), so we can change the getter to return a referece
instead of a pointer. This simplifies things a bit because we get
rid of all the nullptr checks and makes the interface more clear.

Also change direct access to mpEditEngine in {Imp}EditView to use
getEditEngine() and getImpEditEngine() (returning a reference)
instead.

Change-Id: Ib8f9c565b8364144bb9c35c3093c4975af1970c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162333
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-21 00:54:54 +01:00
Noel Grandin f54d9547c0 loplugin:unusedmethods
Change-Id: I24c429c7cb8283a384b72499d1c3f4c2f1457c33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162155
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-01-16 13:01:25 +01:00
Caolán McNamara f7327527d4 cid#1560053 Missing move assignment operator
and

cid#1560054 Missing move assignment operator

Change-Id: I438699b24ca7aa7726dbce3af310d80327b9a717
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161708
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-01-06 19:48:25 +01:00
Caolán McNamara 4b9a538418 cid#707862 Uninitialized pointer field
returned since

commit 04c3ef3c72
Date:   Sat Dec 30 15:08:30 2023 +0200

    ImgProdLockBytes is unnecessary

Change-Id: Iabd3cf1f64b87b8ffb8c73702ef138cf7b7d64a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161502
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-31 21:02:10 +01:00
Julien Nabet 7dcc4bf0d8 Replace "size() != 0 with !empty()" (forms)
Change-Id: I855c4868334c8890b00e78caa67bfc9c9c9ebd80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161485
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-31 16:03:09 +01:00
Andrea Gelmini 2ccb21c26f Remove duplicated include
Change-Id: I64436766ca0274e0877c861db3ffdb9d87f5e12a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161462
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-31 11:26:36 +01:00
Noel Grandin ec29db74bf no need to use SvLockBytes in OImageControlModel
we already have other, simpler facilities for wrapping streams

Change-Id: Ic6f88821e089951999395507bc84e68ea339d9de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161444
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-12-30 19:05:38 +01:00
Noel Grandin 04c3ef3c72 ImgProdLockBytes is unnecessary
we already have facilities for doing this kind of wrapping
(removes another instance of SvLockBytes)

Change-Id: Ie3546efe06580f9492d8f6ddbc1a2e904036465a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161443
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-12-30 19:05:29 +01:00
Noel Grandin 7de4661827 no need to use SvLockBytes in forms
Change-Id: Ide586997d504e0fbdb72aa1db77c49ba3d6007c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161437
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-12-30 13:45:53 +01:00
Caolán McNamara 6ef28599b2 cid#1545612 COPY_INSTEAD_OF_MOVE
and

cid#1545605 COPY_INSTEAD_OF_MOVE
cid#1545587 COPY_INSTEAD_OF_MOVE

Change-Id: Iafb1d81dbacfefe70fbddd84b29e827dc137ef07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161077
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-20 20:59:04 +01:00
Noel Grandin a214ac6774 simplify and modernise ScopedBitmapAccess
(*) Make all of it use a "Scoped" paradigm
(*) pass by value, no need to allocate on heap
(*) make all of the construction go via the *Access constructors, instead of it being some via the constructors and some via the Acquire*Access methods.
(*) take the Bitmap& by const& in the constructor, so we can avoid doing const_cast in random places.

Change-Id: Ie03a9145c0965980ee8df9a89b8714a425e18f74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160293
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-12-07 09:32:14 +01:00
Julien Nabet 67c2a47861 cid#1545597 Using invalid iterator
and :

cid#1545537 Using invalid iterator
cid#1545508 Using invalid iterator
cid#1545494 Using invalid iterator
cid#1545478 Using invalid iterator
cid#1545427 Using invalid iterator
cid#1545420 Using invalid iterator
cid#1545400 Using invalid iterator
cid#1545300 Using invalid iterator
cid#1545258 Using invalid iterator
cid#1545257 Using invalid iterator
cid#1545200 Using invalid iterator
cid#1545183 Using invalid iterator

Change-Id: Ibf3a41902f34286967195c5c3b22e337a4b06809
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160322
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-04 22:10:20 +01:00
Noel Grandin 0cea768b52 loplugin:fieldcast in Binding
Change-Id: Ia4bb341dba0c853b53c42a36fcb472e5948f1708
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159839
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-23 08:13:53 +01:00
Stephan Bergmann bd6fb0cd3e Extended loplugin:ostr: Rewrite some O[U]StringLiteral -> O[U]String
...in include files.  This is a mix of automatic rewriting in include files and
manual fixups (mostly addressing loplugin:redundantfcast) in source files that
include those.

Change-Id: I1f3cc1e67b9cabd2e9d61a4d9e9a01e587ea35cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158337
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-23 11:04:42 +02:00
Stephan Bergmann 6581f028f8 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: forms
Change-Id: Ifab0f06a776a9c505508781018300c7ce5d46436
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158194
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-19 20:21:47 +02:00
Mike Kaganski 176e8cf09a Use exception ctors, instead of setting members later
Avoids overwriting source location in message

Change-Id: Ia0290c7dd1ab3ea1357712a27ecab75c7b583dd4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157893
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-14 15:37:17 +02:00
Stephan Bergmann e0c33ec15f loplugin:ostr: automatic rewrite
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
2023-10-07 00:47:20 +02:00
Julien Nabet 74410e57bd Replace useless lcl_throwIllegalArgumentException function (forms)
Change-Id: Icad8c36ef91edd12da8cc533e3ce24c0000a8a28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157590
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-10-05 20:35:59 +02:00
Noel Grandin 81994cb2b8 Convert internal vcl bitmap formats transparency->alpha (II)
(Second attempt at landing this)

Image formats and graphics APIs use alpha, not transparency,
so change our internal formats and data structures to work directly
with alpha, so we don't need to modify data before we push it to
graphics APIs.

Add a couple of new Color constants to make the intention
of the vcl code clearer.

Notes
(*) On macOS, tweaking the logic in CreateWithSalBitmapAndMask
to more accurately reflect the requirements of the
CGImageCreateWithMask function seems to fix some
tests.

(*) The vcl code does not properly support gradients
with transparency. So the previous code was wrong, and this
change is going to result in slightly different wrongness.

Change-Id: I9e21c2e98d88ecfdc5f75db13bd1ffff7c38db98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114168
Tested-by: Jenkins
Reviewed-by: Patrick Luby <plubius@neooffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-25 08:38:12 +02:00
Michael Stahl 2295c2b17c sw, forms: some hacks to nerf time-fields so convwatch works better
This is useful for PDF-based layout-comparison regression testing
where date/time fields were updated upon PDF export and create
lots of false positives. Hopefully these can be eliminated this way,
at least from text documents.

To test:
Download https://bugs.documentfoundation.org/attachment.cgi?id=48452
from tdf#38703 and export it with:

STABLE_FIELDS_HACK=1 instdir/program/swriter --convert-to pdf DeleteStackSample.odt

The date and time fields are now reset to
30/12/1899 00:00:00

Change-Id: Ic89111615074adb50f16a605f920f9a89c437dfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/24442
Tested-by: Jenkins
Tested-by: Gabor Kelemen <kelemeng@ubuntu.com>
Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-07-24 18:56:40 +02:00
Noel Grandin 18446cdd60 loplugin:finalclasses
Change-Id: I62b094a3bd9a4f630cebdf538c04391e2920ff2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154064
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-05 21:39:51 +02:00
Noel Grandin 77befddec9 loplugin:unusedvarsglobal
Change-Id: Ia86c8bd0bdc85c375eb3837ba97f9e171d9dac6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153974
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-04 19:16:40 +02:00
Noel Grandin 0193b284e8 new loplugin:constexprliteral
OUStringLiteral should be declared constexpr, to enforce
that it is initialised at compile-time and not runtime.

This seems to make a different at least on Visual Studio

Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-26 13:12:31 +02:00
Noel Grandin 839c501024 use more TypedWhichId in editeng
Change-Id: I2eb2b50ef7002e23221c985ab3218617b3832aa7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152203
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-25 07:52:21 +02:00
Julien Nabet 45826e60d5 XML forms: remove duplicate addEventListener DOMAttrModified with capture true
since commit b2a54aa2e4
Author: Vladimir Glazounov <vg@openoffice.org>
Date:   Wed Mar 23 10:34:34 2005 +0000

Change-Id: I8f511d1efa0e2ee713d1e7c145cc60f4945aa8cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151983
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-19 21:19:31 +02:00
Julien Nabet 0138745f02 tdf#155123: XML Form: Deleting parts of user defined data type impossible
2 parts:
1) in extensions/source/propctrlr/standardcontrol.cxx
if value retrieved from the field is 0, let's return an empty Any var.

2) forms/source/xforms/datatypes.cxx
Allow to select 0 in the spinbox for String and URI ("hyperlink") datatypes
to be homogeneous

Change-Id: Ife9a94c279e8651623112c0bf8a64555cb9c556c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151740
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-18 12:40:03 +02:00
Julien Nabet 2811ffb4a5 tdf#154628: XML Form Document: Sending data with GET fires very often
See rationale here:
https://bugs.documentfoundation.org/show_bug.cgi?id=154628#c5

Change-Id: I26556baceec8823d2c3bed382d51731d18bd2ccd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151852
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2023-05-17 15:35:52 +02:00
Julien Nabet aa0cbe2c82 tdf#155121: XML Form Document: better take into account "not required"
Change-Id: Ibebdbc52f2bd7d09ec7aa5f072efef364249a291
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151733
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-14 14:17:00 +02:00
Caolán McNamara 63b8e8bda2 tdf#152974 revert change to ORichTextModel::getPropertyDefaultByHandle
properties that match the default are not exported, so we're basically
stuck with what is in there for compatibility with older versions, so
revert

commit ca46afebb7
Date:   Tue Oct 4 16:22:51 2022 +0100

    default to 'flat' instead of '3D Look' for form controls

and set m_nBorder to the desired new default in the ctor but
leave getPropertyDefaultByHandle as it always was

Change-Id: Ia862fc6851248fc9b16b3b4c505fdaf6fdb4b2ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151497
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-08 13:21:20 +02:00
Noel Grandin 1c7cbd6856 use AlphaMask for variables when calling GetAlphaMask
Right now this doesn't make any difference, since Bitmap is the
superclass of AlphaMask.
But when I switch to using alpha instead of transparency, passing
AlphaMask around is going to mean something different to passing plain
Bitmap around.

Change-Id: Ic1541e5f0a3b97331793cd23e23115faa7f382b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151463
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-07 20:17:16 +02:00
Caolán McNamara 9e745192f1 Resolves: tdf#154337 allow submitting to file: if user agrees
continue to allow submitting to http[s]: without further interaction.
Don't allow for other protocols, except for file: where the user has to
agree via dialog prompt.

Change-Id: Ia915f4f33d5dba621971ce69a156c339da933b55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151418
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-05 15:51:53 +02:00
Julien Nabet c4aa51f497 Related tdf#154769: XML Form add limits of length value for some datatype
length value for:
- year:4
- month and day:2

change ISO8601parseDate in unotools to return false when month or day length > 2

Change-Id: I807a8a784c8924750ae2c821de4be667e514e91f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151238
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-03 13:55:30 +02:00
Julien Nabet d0ecc80ca4 Related tdf#154769: XML forms add anyURI/hyperlink datatype
See https://www.w3.org/TR/xmlschema11-2/#anyURI

Since I copied-paste string datatype + add check url, I thought about deriving from string datatype
but seeing https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/datatypes.html#built-in-datatypes
anyURI doesn't derive from string

TODO: contrary to "string" which uses "preserve" for "whitespace" "anyURI" uses "collapse"
There's WhiteSpaceTreatment notion in datatypes.cxx and m_nWST associated,
WhiteSpaceTreatment::Preserve seems to be the default but when searching about it, it's seems not used.

Change-Id: Ifc2dc06072e40b9be168c2f40a9506fe7d267ce4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150822
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-26 09:36:53 +02:00
Gabor Kelemen 75ed566894 Add script to find unused using declarations
As a complementer to clang-tidy-12 --checks="-*,misc-unused-using-decls"
Pros:
- simple, fast!
- finds some more unused declarations, somehow
- works on non-linux specific parts of the code
- clang-tidy (for me) trips on files with external headers, this does not

Change-Id: If2db989114ac5c2841ed2e89ff7bd7a9e419f567
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150612
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-04-25 08:09:28 +02:00
Stephan Bergmann 29b3265a6e Fix some getImplementationName
...to match the corresponding .component entries

Change-Id: I4c2a838b7a88e3d21e230310c1a4057b427a7c7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150756
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-21 15:05:37 +02:00
Julien Nabet 50837fdd60 tdf#116451: XML Form: adding 2 values of decimal-fields gives wrong result
Since, depending of the localization decimal separator may be ",",
replace "," by "." before calling ::rtl::math::stringToDouble

Change-Id: I461f3bdf83019d066735e10b3b6b6784e006bc7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150750
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2023-04-21 13:46:11 +02:00
Gabor Kelemen 890bf59e0a Run clang-tidy with misc-unused-using-decls on modules [d-o]*
To remove unneeded using declarations.

Via the simple script:

for i in $(find $dirname -name "*cxx" -o -name "*hxx" ); do
    clang-tidy-12  --checks="-*,misc-unused-using-decls" "$i";
done

Change-Id: Idd8aa3d3cfec456c4babb65e89af712051b4deb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150609
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-04-20 13:14:37 +02:00
Julien Nabet 4d8a46b819 Related tdf#154769: XML form, detect misformed year/month/day
From https://www.w3.org/TR/xforms20/
"Data Binding Restrictions: Binds only the following list of datatypes,
 or datatypes derived by restriction from those in the list:
 xsd:duration, xsd:date, xsd:time, xsd:dateTime, xsd:gYearMonth,
 xsd:gYear, xsd:gMonthDay, xsd:gDay, xsd:gMonth, xsd:float, xsd:double, and xsd:decimal.
"

gYear: a number between 0 and 10000
From https://www.w3.org/TR/xmlschema11-2/#gYear + https://www.w3.org/TR/xmlschema11-2/#partial-implementation:
"All ·minimally conforming· processors must support nonnegative ·year· values less than 10000"
-> we could accept more but if other use this minimal requirement, they may wrongly consider LO as buggy here

gMonth: a number between 1 and 12, not some string like 'May' (see https://www.w3.org/TR/xmlschema11-2/#gMonth)

gDay: a number between 1 and 31, https://www.w3.org/TR/xmlschema11-2/#gDay

The first test in lcl_getValueyear is due to the fact that a failing conversion with "o3tl::toInt32" also returns 0.
So the goal is to consider this obvious case first.

Change-Id: Ifd8106b55419093a0223cff6a0afb9ccd3aa5efe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150652
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-20 08:03:38 +02:00
Julien Nabet 3b4982b9c7 Related tdf#154769: XML form, detect misformed date/datetime/time
Change-Id: Ied859703f906ef97c70be4518974ca6a0e482573
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150582
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-19 08:03:55 +02:00
Stephan Bergmann 7c36c5fdfd Some missing XServiceInfo implementations
Change-Id: I1cf871b40f9f4020147dac0456ebeed3de0438e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150533
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-18 07:38:29 +02:00
Julien Nabet 4829a85d07 tdf#154734: XML Form doc: all binded fields will be shown as fields...
with wrong content - except fields, which have wrong content

Regression of 14cfff500e (at 2021-08-05)
Pass context and resource string down to boost::locale separately
because this is often on a hot path, and we can avoid the splitting and
joining of strings like this.

Before the commit, it was:
return ( _validate( sValue ) == nullptr );

_validate methods return "TranslateId" variable which contain the reason why validity is wrong
so if this variable contains no reason it means everything is OK.

so just replace:
return bool(_validate( sValue ));
by:
return bool(!_validate( sValue ));

Change-Id: I76373d0825f86f9072217c96757252b6a891ecc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150433
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2023-04-14 22:58:09 +02:00
Julien Nabet 26012007e4 tdf#154658: XML Form Document: Fields doesnt calculate any more
Regression from 73334560b2
author	Julien Nabet <serval2412@yahoo.fr>	2021-11-07 15:40:37 +0100
committer	Julien Nabet <serval2412@yahoo.fr>	2021-11-07 21:58:53 +0100
commit	73334560b2 (patch)
tree	b5bc4f69dd
parent	6be03ac71e (diff)
Replace some macros in forms part 16

A big thank you to Raal for having spotted this!

Change-Id: Ib6f1878897b16b43df287702f82835824c1f766d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150174
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2023-04-10 12:01:57 +02:00
Noel Grandin 3a0c5b7820 loplugin:stringadd in editeng..framework
after my patch to merge the bufferadd loplugin into stringadd

Change-Id: Ieac16a01fde6467a2f6fe47864069304a3c44e47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149552
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-25 07:27:34 +00:00
Noel Grandin f5bfc127dd elide some temporary OUStrings
where we are calling
  append(OUString::createFromAscii(
and we can rather call
  appendAscii

Change-Id: I2366b518fe6d8d2484b00bb831cb79fb49bc0293
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149043
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-17 09:41:13 +00:00