summaryrefslogtreecommitdiff
path: root/comphelper
AgeCommit message (Collapse)Author
2022-05-11use better default size for UNOMemoryStreamNoel Grandin
which means we don't need to re-allocate the buffer as often Change-Id: I81678af2ed4146b94eb200324459eef7016afd06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134196 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11reserve space for bulk operations in SequenceAsHashMapNoel Grandin
reduces the number of allocations we do Change-Id: If8e61c8b0dd1942278d7adc1fa87580734aeeb99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134157 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11cache the Sequence we return in comphelper::PropertySetInfo::getPropertiesNoel Grandin
Change-Id: If4e6e43be5d7380665e56bf95c446ff14e6a7213 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134155 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11avoid some OUString construction on some hot pathsNoel Grandin
Change-Id: I098b017d22b7a4502998a0901ddcfca08a57ee43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134115 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-10tdf#147590 update OLE object after document refreshJuergen Funk
Regression from b099da78a6f0b3e120f706714003b05d84d11e70 we didn't update linked OLE document after document reload Change-Id: I8e52f6430f454b276cb43449c6f7a3b0e07e909f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130692 Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> Tested-by: Jenkins
2022-05-09tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macroPragat Pandya
Change-Id: I54257e87da0cd66da59d820c7960c3e4b020fda3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134027 Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl> Tested-by: Jenkins
2022-05-07remove dead item cleanup from NumberedCollection::impl_searchFreeNumberNoel Grandin
which speeds it up a little, because WeakReferences are a little slow Change-Id: I76226b180ae4e11c4beb9e2f4ae12b05f980dcad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133960 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-07osl::Mutex->std::mutex in comphelper::GenericPropertySetNoel Grandin
Change-Id: Ifbb8e2f7e8923d7bdc333097d6f415f10670e0df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133970 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-06Only dereference iterators after checking themMike Kaganski
Was this way since commit edf11d28fafac50b6380c9372d0e6cf07a355616 Author Vladimir Glazounov <vg@openoffice.org> Date Thu Apr 24 16:27:52 2003 +0000 INTEGRATION: CWS uaa02 (1.3.44); FILE MERGED Surfaced after commit b1148c31ed2786396f0b018a988fce8288f1797d Author Noel Grandin <noel.grandin@collabora.co.uk> Date Wed Apr 27 16:47:53 2022 +0200 use more string_view in comphelper where the pointers were changed to iterators, which are checked in debug builds, failing an assertion. Change-Id: I87fce562aef8f50b94fb52ad6c2a79d2e84d6424 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133934 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-06tdf#128744 sw DOCX: unprotect change tracking with verificationLászló Németh
Unprotect change tracking only by password verification instead of 1) unprotecting without the password or 2) rejecting the correct password. I.e. now 1) clicking on Record changes icon of Track Changes toolbar or Edit->Track Changes->Record asks for a password, and 2) Unprotect Record changes on Security page of File->Properties... accepts the correct password with disabling record changes. Show also "Invalid password!" dialog disabling Record Changes by its icon or menu option, like Properties... dialog window does, if the password is invalid. Note: Still allow to unprotect OpenDocument export of a protected OOXML import document, because that doesn't contain the original password info, only a dummy RedlinePassword. (OpenDocument exports protect Track Changes with the simple RedlineProtectionKey configuration setting, so it's not possible to map the OOXML password info to OpenDocument without extending this.) Follow-up to commit d416250f4f1766e2d596ea3feef6a94b7adf29f4 "tdf#106843 DOCX: forbid disabling protected Record Changes". See also commit bfd7730f4cf002a79dc9c02c23286850fee3f12a "tdf#89383 DOCX import: fix permission for editing". Change-Id: Iafcf4a6b551a7e8485d4311aee889c2522526d71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133894 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-06comphelper: cleanup test_guards, add test for ValueRestorationGuardTomaž Vajngerl
Move each test case into its own test function. Also add the missing test for ValueRestorationGuard. Change-Id: I588ab67f82ba82ef67939dac3d22438e8799ce11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133917 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-06Remove duplicated includesAndrea Gelmini
Change-Id: I137707aaad44ffe42bb4b234a59ff69e4b2ecaa2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133884 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2022-05-05use more o3tl::getTokenNoel Grandin
found by inspecting call sites of OUString::getToken Change-Id: I4269c7476c7aa46fac39528227e350568f0eb34a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132644 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-05use more string_viewNoel Grandin
found by examining the call sites of OString::getToken which means I needed to add a new o3tl::equalsAscii function Change-Id: I7dc0ea1cf5ce8090a708d44f2cf7c938fa200c5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133826 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-04Just use Any ctor instead of makeAny in comphelperStephan Bergmann
Change-Id: Ib3edbef27c2d25dae8bac07e0199af071131170e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133839 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-03Adapt Base64::decodeSomeChars to change from OUString to std::u16string_viewStephan Bergmann
...in 9c95415de877af1430ab5b7123e11dedd0ea622c "Let comphelper::Base64::decode* take std::u16string_view" Change-Id: I42b1552fba80568b422cb60ccc99a7ab8664f2d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133711 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-30split comphelper::string::strip functions into String and view versionNoel Grandin
which is more obvious, from the perspective of the caller, and lets us avoid creating a new String if nothing needs to be stripped Change-Id: I66a980eaf4aa818251bec49bdb16c2dddb0745e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-29Check iterator before dereferenceMike Kaganski
... since commit b1148c31ed2786396f0b018a988fce8288f1797d Author Noel Grandin <noel.grandin@collabora.co.uk> Date Wed Apr 27 16:47:53 2022 +0200 use more string_view in comphelper Change-Id: I182bc507b5693048350d6e54bb7b6176389e2241 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133596 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-04-28use more string_view in comphelperNoel Grandin
Change-Id: I1544da756d8da074787bc19a98d2740058e36479 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133520 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-26add o3tl::toUInt32Noel Grandin
Change-Id: I07f11bf12fbe1d1c2d812fa0965d6e632e1e1aba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133437 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-26Use o3tl::make_unsigned in some placesStephan Bergmann
...where a signed and an unsigned value are compared, and the signed value has just been proven to be non-negative here Change-Id: I9665e6c2c4c5557f2d4cf1bb646f9fffc7bd7d30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133442 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-22use more string_view in comphelperNoel Grandin
Change-Id: Ib186d2c9aa8458ddbdd14dd44e2d3938f0f26ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133269 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-20loplugin:passstuffbyrefNoel Grandin
Change-Id: I336fd329b577b6fa141265d8bc7ce67784bd7306 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133210 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-17loplugin:stringviewparam convert methods using copy()Noel Grandin
which converts to std::string_view::substr() Change-Id: I3f42213b41a97e77ddcc79d84d512f49d68ca559 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132729 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin
for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-12Remove need for OPropertyAccessor default ctorStephan Bergmann
Change-Id: Ia5ae4e28aa880600ce80bd284cde5183c49e4b40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132929 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-12loplugin:stringview more o3tl conversionNoel Grandin
look for call sequences that can use string_view and the new o3tl functions in o3tl/string_view.hxx Also add a few more wrappers to said #include file Change-Id: I05d8752cc67a7b55b0b57e8eed803bd06bfcd9ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-11loplugin:stringview add check for getToken().toInt32Noel Grandin
where we can convert that to o3tl::toInt32(o3tl::getToken( and avoid the heap allocation of a temporary string Change-Id: Ib11c19c6e6cdc0de3e551affd3578d181e292de4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132810 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-10use more string_viewNoel Grandin
found by tweaking the loplugin:stringview and making it whitelist getLength Change-Id: Ic15d3703d1fb07658e99e1db1c89e2fa5bc70c19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132771 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-08loplugin:stringviewparam convert methods using trimNoel Grandin
for which we add a new o3tl::trim method Change-Id: I9d37b6264eea106aa2f3502bd24b8cccf7850938 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132658 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-05add tools::Guid class to generate, parse GUID valuesTomaž Vajngerl
Change-Id: Ie4d8fad4d8f22c8277c22c21b7a9eb3e7c9e4f1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132513 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-04-04use string_view in comphelper::string::splitNoel Grandin
Change-Id: I4afe8aee85905ee35ba195b00b454aefa0ba38af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132486 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-24comphelper : use std::mutex in traceeventArnaud VERSINI
Change-Id: I959b8c189a9ad073167cf3e0620947cbda77196c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129159 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-11Simplify ConfigurationWrapper singleton construction a bitStephan Bergmann
Change-Id: I8b0dd0e049ebeb3304673df3bdb9fe7c755b7750 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131335 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-07optimize ConfigurationProperty::get()Luboš Luňák
E.g. officecfg::Office::Common::Save::ODF::DefaultVersion::get() gets called quite often during ODS export, taking ~14% of total CPU time, ~%5 in comphelper::getProcessComponentContext (handled by previous commit) and the rest trying to read the property. But it's possible to cache the final property values if there's a notifier that clears the cache on any configuration change (it can't be hidden as a static in the file like the other data becase that way it'd get destroyed too late and crash). This gets it to ~3%, most of which is spent in computing the path hash (which could be presumably made const if the OUString hash function were constexpr). Change-Id: I29f3cefc8442716403d4df8bdf253f4fe847a09c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130705 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-07do not pass XComponentContext to officecfg::...::get() callsLuboš Luňák
It's used only for the ConfigurationWrapper singleton, so it's used only the first time and then ignored. It also causes calls to comphelper::getProcessComponentContext() for every single invocation despite the value not being needed, and the calls may not be cheap (it's ~5% CPU during ODS save because relatively frequent calls to officecfg::Office::Common::Save::ODF::DefaultVersion::get()). Change-Id: I02c17a1a9cb498aeef220ddd5a0bde5523cb0ffb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131056 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-02-17tdf#147086 OOXML export: don't save the empty editing passwordTünde Tóth
Saving with opening password, but without editing password resulted read-only documents (only on their original path: saving, i.e. copying the file in a different path was a workaround for the lost permission). Regression from commit 1b53c1dfc76f08ca7df40a0673aa50eca700d072 (tdf#144374 DOCX: export the password for editing). Change-Id: I2759dc876ee7668d00eee0aa81490c9d1e0c272b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129593 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-02-0322 characters needed to Base64-encode 16 bytesMike Kaganski
Change-Id: Ia7f6f1b72b487889c115b664fcc32a4955f4bc36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129345 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-21fix opengl slide transitionNoel Grandin
regression from commit 62efb188668a3296591dcfa3658185e2f982e356 use comphelper::WeakComponentImplHelper in SlideShowVie Switch notifyEach to leave the mutex locked after being called, because that seems to compose better - because after a call it is in the same state that was when we entered the call. Change-Id: I42e80cc7be1b65ed8cab24ab7c11210e056d916d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128723 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-21Fix typosAndrea Gelmini
Change-Id: I6ba7c7db6c58fde2e7648ccf32b93fc05f5eae65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128620 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-01-21comphelper: move JsonToPropertyValues() from desktop/Miklos Vajna
Because filter/ code will need this in a bit, and that can't depend on desktop/. Change-Id: I07f0f8ef30942a2d11388c6721c7f277e117bfba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128709 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-20comphelper: fix UAF in SequenceOutputStreamService dtorMichael Stahl
Change-Id: I91f77ee9ab4d509ebee3d04f94a3c63986de0ef1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128657 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-01-19WASM more initial bits and piecesJan-Marek Glogowski
All the small stuff, which is needed for the WASM build, but is not really worth an extra patch. * No soffice.sh script needed for WASM * WASM soffice.bin executable extension is html * Some small additional SAL_LOG output * Default to colibre icon theme * Test for qt5 even without X11 * Remove emconfigure artefacts at the end of the configure run * No oosplash for WASM * Disable the Office IPC thread * Suppress -Wno-enum-conversion for Cairo builds * Fix libnumbertext by using gb_EMSCRIPTEN_CPPFLAGS * Map EMSCRIPTEN to LINUX nls * No extra newlines for missing icon theme images * Print the missing dependency in some gbuild error messages * Copy Qt WASM loader, HTML template and SVG logo for binaries * Especially build the vcldemo for Emscripten Change-Id: I356370c72cc09357411e14d0c00762152877a800 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128584 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2022-01-14make comphelper::OInterfaceContainerHelper4 more threadsafeNoel Grandin
(*) make all the methods that require an external mutex take a std::unique_lock as a parameter, so that call sites cannot forget (*) make the forEach method drop the lock when firing listener methods, to reduce the odds of deadlock Change-Id: I0a80e3b3d1c1c03b7de4a658d31fcc2847690903 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-13Recheck modules [a-c]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I74a3c3a67c3639376e2251c3eb917fa4139dfbd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127808 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-10small cleanups to TempFile related codeNoel Grandin
unnecessary temporary variables Change-Id: Iefa6c9a6627311495e6cd2f01f5446082ae0589d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128208 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-09Simplify some TempFile service codeNoel Grandin
Change-Id: Id39be33dcc5aa9378e29c850cb71d3662093ab25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128189 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-09implement anyToHash() and use it for SdrCustomShapeGeometryItemLuboš Luňák
Using anyLess() still has quite some cost with bsc#1183308, this makes the cost almost unnoticeable. Since some values of Any are not handled, return empty std::optional for those cases. Change-Id: Ib45a81441e8bb456c4749f9bc53a981f09bbb1a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128109 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-01-09use C++ class handling ownership for anyToString()Luboš Luňák
This matches changes I did for anyLess() in my previous commit. Change-Id: Id38c49c10223340b7359765e1071d8a9f72ba92e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128046 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-01-09make anyLess() work also for compound types such as sequencesLuboš Luňák
The previous implementation used the specific predicates, which are not recursive. And since that'd require constructing Any instances, which copies, which would be slow, write new code based on anyToString() instead. Change-Id: I439f81d4b1efbd46c10d50d0725a5f6f40968b12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128045 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>