summaryrefslogtreecommitdiff
path: root/comphelper
AgeCommit message (Collapse)Author
2023-02-06Revert "optimize ConfigurationProperty::get()"Xisco Fauli
This reverts commit 7df433cdc33b4d6ba38eafad9282d015571433ef and its follow-ups: * b4b63d0c46979ad6b6aae5d6a4ea6672ea248e10 "try to fix some shutdown crashes" * 203ad037ccb9fdebffea4f622229ded90635eb8b "try to fix shutdown crashes in ConfigurationWrapper" since it introduced a crash starting with LibreOffice 7.4 See https://crashreport.libreoffice.org/stats/signature/void%20rtl::str::release%3C_rtl_uString%3E(_rtl_uString*) Later, it was reverted in libreoffice-7-4 branch with df79a29ea20fb698d650be45a48c607f54476dea "Revert "optimize ConfigurationProperty::get()" (7.4 only)" so the crash is no longer reported in that branch. OTOH, Noel tried to fix it in master/libreoffice-7-5 branches with the two commits mentioned above but the crash is still being reported in LibreOffice 7.5 After talking to him, he suggested to revert it all Finally, adapt code to make loplugin:stringviewparam happy with getPropertyValue Change-Id: Id9fa97d2a81a590e53abd027e978d2d6179222b8 Change-Id: Id2e3475c342770be5705a74b9c0b45f45d6be5ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146586 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-31tdf#97362 Convert comphelper SequenceOutputStreamUnitTest to PythonChenxiong Qi
Signed-off-by: Chenxiong Qi <qcxhome@gmail.com> Change-Id: I72826fc8180fcb147ff84b10b88c16a4084799ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145690 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2023-01-31osl::Mutex->std::mutex in ImplEventAttacherManagerNoel Grandin
Change-Id: Id8a4d2d75b1be8f23f6b1260a7a7727ab6bbd27b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146368 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-29lok: support per-user timezoneAshod Nakashian
This adds support for user-specific timezone. When none is provided during loading, the system default is used. Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk> Change-Id: Ie863450687eb82bc475268a09c9112e9fd50020f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144816 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com> (cherry picked from commit abaf8c0af1c6c7fe01276fdf2ae62419c7b0f654) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146211 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
2023-01-25Use ImplInheritanceHelper in OAccessibleTextHelperStephan Bergmann
(Explicitly deleting the special member functions is needed to avoid MSVC > include\cppuhelper/implbase.hxx(152): error C2280: 'comphelper::OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper(comphelper::OAccessibleExtendedComponentHelper &&)': attempting to reference a deleted function > include\comphelper/accessiblecomponenthelper.hxx(220): note: see declaration of 'comphelper::OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper' > include\comphelper/accessiblecomponenthelper.hxx(220): note: 'comphelper::OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper(comphelper::OAccessibleExtendedComponentHelper &&)': function was explicitly deleted > include\comphelper/accessibletexthelper.hxx(133): note: see reference to function template instantiation 'cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper,com::sun::star::accessibility::XAccessibleText>::ImplInheritanceHelper<cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper,com::sun::star::accessibility::XAccessibleText>>(cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper,com::sun::star::accessibility::XAccessibleText> &&)' being compiled > include\comphelper/accessibletexthelper.hxx(133): note: see reference to function template instantiation 'cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper,com::sun::star::accessibility::XAccessibleText>::ImplInheritanceHelper<cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper,com::sun::star::accessibility::XAccessibleText>>(cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper,com::sun::star::accessibility::XAccessibleText> &&)' being compiled ) Change-Id: I00377be4a5fb44b2ef2b5001823ca0d89ead026b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146109 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-25Use ImplInheritanceHelper in OAccessibleSelectionHelperStephan Bergmann
(Explicitly deleting the special member functions is needed to avoid MSVC > include\cppuhelper/implbase.hxx(152): error C2280: 'comphelper::OAccessibleComponentHelper::OAccessibleComponentHelper(comphelper::OAccessibleComponentHelper &&)': attempting to reference a deleted function > include\comphelper/accessiblecomponenthelper.hxx(191): note: see declaration of 'comphelper::OAccessibleComponentHelper::OAccessibleComponentHelper' > include\comphelper/accessibleselectionhelper.hxx(120): note: see reference to function template instantiation 'cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,com::sun::star::accessibility::XAccessibleSelection>::ImplInheritanceHelper<cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,com::sun::star::accessibility::XAccessibleSelection>>(cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,com::sun::star::accessibility::XAccessibleSelection> &&)' being compiled > include\comphelper/accessibleselectionhelper.hxx(120): note: see reference to function template instantiation 'cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,com::sun::star::accessibility::XAccessibleSelection>::ImplInheritanceHelper<cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,com::sun::star::accessibility::XAccessibleSelection>>(cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,com::sun::star::accessibility::XAccessibleSelection> &&)' being compiled > include\cppuhelper/implbase.hxx(151): error C2248: 'comphelper::OAccessibleComponentHelper::OAccessibleComponentHelper': cannot access private member declared in class 'comphelper::OAccessibleComponentHelper' > include\comphelper/accessiblecomponenthelper.hxx(191): note: see declaration of 'comphelper::OAccessibleComponentHelper::OAccessibleComponentHelper' > include\comphelper/accessiblecomponenthelper.hxx(185): note: see declaration of 'comphelper::OAccessibleComponentHelper' ) Change-Id: I2414d9f777de42b62c33492a90299aa9a9d53699 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146108 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-25NSS initialization guardAndras Timar
Change-Id: I61a5886d0d13eaef6a61479e35d52a85937075ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142385 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146042 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
2023-01-25more detailed NSS error reportAndras Timar
Change-Id: I1b005a331aeed1c00d6bf18a6dff0ffa844ba6f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142286 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Aron Budea <aron.budea@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146041 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
2023-01-24Use ImplInheritanceHelper in OAccessibleExtendedComponentHelperStephan Bergmann
(Explicitly deleting the special member functions is needed to avoid MSVC > include\cppuhelper/implbase.hxx(152): error C2280: 'comphelper::OCommonAccessibleComponent::OCommonAccessibleComponent(const comphelper::OCommonAccessibleComponent &)': attempting to reference a deleted function > include\comphelper/accessiblecomponenthelper.hxx(176): note: compiler has generated 'comphelper::OCommonAccessibleComponent::OCommonAccessibleComponent' here > include\comphelper/accessiblecomponenthelper.hxx(176): note: 'comphelper::OCommonAccessibleComponent::OCommonAccessibleComponent(const comphelper::OCommonAccessibleComponent &)': function was implicitly deleted because a base class invokes a deleted or inaccessible function 'cppu::BaseMutex::BaseMutex(const cppu::BaseMutex &)' > include\cppuhelper/basemutex.hxx(43): note: 'cppu::BaseMutex::BaseMutex(const cppu::BaseMutex &)': function was implicitly deleted because a data member invokes a deleted or inaccessible function 'osl::Mutex::Mutex(const osl::Mutex &)' > include\osl/mutex.hxx(107): note: 'osl::Mutex::Mutex(const osl::Mutex &)': function was explicitly deleted > include\comphelper/accessiblecomponenthelper.hxx(228): note: see reference to function template instantiation 'cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleExtendedComponent>::ImplInheritanceHelper<cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleExtendedComponent>>(cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleExtendedComponent> &&)' being compiled > include\comphelper/accessiblecomponenthelper.hxx(228): note: see reference to function template instantiation 'cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleExtendedComponent>::ImplInheritanceHelper<cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleExtendedComponent>>(cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleExtendedComponent> &&)' being compiled ) Change-Id: Ia5a7b244dd018c1a63cc2940dba197c43827d563 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146062 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-24Use ImplInheritanceHelper in OAccessibleComponentHelperStephan Bergmann
(Explicitly deleting the special member functions is needed to avoid MSVC > include\cppuhelper/implbase.hxx(152): error C2280: 'comphelper::OCommonAccessibleComponent::OCommonAccessibleComponent(const comphelper::OCommonAccessibleComponent &)': attempting to reference a deleted function > include\comphelper/accessiblecomponenthelper.hxx(177): note: compiler has generated 'comphelper::OCommonAccessibleComponent::OCommonAccessibleComponent' here > include\comphelper/accessiblecomponenthelper.hxx(177): note: 'comphelper::OCommonAccessibleComponent::OCommonAccessibleComponent(const comphelper::OCommonAccessibleComponent &)': function was implicitly deleted because a base class invokes a deleted or inaccessible function 'cppu::BaseMutex::BaseMutex(const cppu::BaseMutex &)' > include\cppuhelper/basemutex.hxx(43): note: 'cppu::BaseMutex::BaseMutex(const cppu::BaseMutex &)': function was implicitly deleted because a data member invokes a deleted or inaccessible function 'osl::Mutex::Mutex(const osl::Mutex &)' > include\osl/mutex.hxx(107): note: 'osl::Mutex::Mutex(const osl::Mutex &)': function was explicitly deleted > include\comphelper/accessiblecomponenthelper.hxx(200): note: see reference to function template instantiation 'cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleComponent>::ImplInheritanceHelper<cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleComponent>>(cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleComponent> &&)' being compiled > include\comphelper/accessiblecomponenthelper.hxx(200): note: see reference to function template instantiation 'cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleComponent>::ImplInheritanceHelper<cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleComponent>>(cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent,com::sun::star::accessibility::XAccessibleComponent> &&)' being compiled ) Change-Id: Ide07c6a7c3660e469f16973d866c949d17fdf419 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146010 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-24AddAttribute may take 'namespace:full:uri^attribute_name'Mike Kaganski
... e.g., created in SaxNamespaceFilter::startElement, which calls XMLNamespaces::applyNSToAttributeName to make such a name. See https://gerrit.libreoffice.org/c/core/+/145526/comments/26536db2_d8fb1e1b, which notified that the assert from f2f008c52aaa88329c07f441de60d6fdfce9f0b3 ("Merge SvXMLAttributeList to comphelper::AttributeList", 2023-01-15) started to fail on some input. Change-Id: Ia0afc167aefac463bcd354dc009bff6e14a64dfa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146054 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-01-19Base OPropertyBag on WeakImplHelperStephan Bergmann
...rather than on the deprecated WeakAggImplHellper5 Change-Id: Id9e61341cba10c4a497500d41479629ff3af30ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145790 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-15Merge SvXMLAttributeList to comphelper::AttributeListMike Kaganski
And simplify the latter, to always use "CDATA" type (as the former did). "CDATA" was used in all cases but one, where an empty string was used. Change-Id: I1b3bfae40e29628e4094d9a6e58a69a66865874c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145526 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-01-14comphelper: check for nullptrXisco Fauli
See https://crashreport.libreoffice.org/stats/signature/comphelper::OSelectionChangeMultiplexer::dispose() Regression from 9931d6b1fb0406e16d56e186812884511738dcfa "tdf#150575: REPORTBUILDER: Crash when closing report when used report navigator" Change-Id: I6e4ada368254879d983f80026e9b42ddb4186c51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145461 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-13Simplify a bitMike Kaganski
Change-Id: Ie2435701078b0e111c1b04b77c857fd1923f2d59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145430 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-01-13XUnoTunnel->dynamic_cast in comphelper::ByteReader and comphelper::ByteWriterNoel Grandin
Change-Id: I1f8c864a939dff1252ba15f517f63b62d1a1e1fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145393 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-10OAccessibleImplementationAccess was apparently effectively unused by nowStephan Bergmann
...as there were no calls to its OAccessibleImplementationAccess::getUnoTunnelId so no code apparently made use of that XUnoTunnel Change-Id: I35d392999f1c28e81f7ff4bf395f63642eb17bce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145250 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-06Merge comphelper::OAccessibleContextHelper into ↵Stephan Bergmann
comphelper::OCommonAccessibleComponent Change-Id: I586ae8fe2842fd879ae2ae506c659d06dda16843 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145160 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-27try to fix shutdown crashes in ConfigurationWrapperNoel Grandin
associated with commit 7df433cdc33b4d6ba38eafad9282d015571433ef optimize ConfigurationProperty::get() it seems it introduced https://crashreport.libreoffice.org/stats/signature/void%20rtl::str::release%3C_rtl_uString%3E(_rtl_uString*) which, at the moment, is the most reported crash in https://crashreport.libreoffice.org/stats/version/7.4.3.2 We need to tie the lifetime of ConfigurationWrapper and the cache objects together, so they die as one unit, otherwise the unpredicatable ordering of destruction of static objects is a problem. Change-Id: I80db5a4c28510a68f40b919902b01f3981e32bfb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-17move and rename sanitizeString for reuseCaolán McNamara
Change-Id: I8378f3df79e511cf2d385ace1cd7964ab1c76e7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144388 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-12-06tdf#152380: add checks for names and values sequences length equalityMike Kaganski
Change-Id: Ibeef551126874bcfffb4e7736588e2e1873f5768 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143681 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-30sfx2: extend .uno:SetDocumentProperties to update custom doc propsMiklos Vajna
Scripting clients (like the LOK API) had a way to get all custom properties where the name matches a certain prefix, but setting such properties was not possible. .uno:SetDocumentProperties can already show a dialog to edit properties interactively and had a parameter to set some properties in a non-interactive way, but there doesn't seem to be a way to influence custom properties there without using the internal API. Fix the problem by adding a new UpdatedProperties parameter that allows removing all old custom properties matching the prefix and adding new ones with a single UNO command dispatch. This is meant to be the write side of the reading commit 5e8f6dcb8ce00d2d5e35b3cf5654187b3068276c (sw lok, .uno:SetDocumentProperties: expose value of custom document properties, 2022-11-29). Change-Id: Ib7450d4d21285d9a73758e1c172543521fc07cef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143491 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-11-25comphelper: support property values arrays in JsonToPropertyValues()Miklos Vajna
Needed for an uncoming .uno:TextFormFields uno command where one of the parameters has the []com.sun.star.beans.PropertyValues type at an UNO level, and we can't provide JSON at the moment that would express that. Change-Id: I288a540b2fcac0e5a4a82bca235199c559ba2d0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143302 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-11-24Make some date functions inline constexprMike Kaganski
Change-Id: Ibef0f650ce66030f28b59e4818f549d86415e2d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143198 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-22Calculate null-date days to assert only onceEike Rathke
Massively called it is really unnecessary to do that each and every time. The debug build is slow enough.. Change-Id: I06525e4ca1fa23a1d49dd735370eb157157800e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143127 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-11-22Related: tdf#152114 Move some tools' Date class algorithms to comphelper::dateEike Rathke
So they can be reused, specifically in connectivity/source/commontools/dbconversion.cxx Change-Id: I8b2b59e3cb078a73d5f670f0756404471009cf9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143114 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-11-21Drop comphelper::OWeakTypeObject, use cppu::WeakImplHelper<> insteadStephan Bergmann
Change-Id: Ie4152d7736ae3f2ffdd3489cd7a444e5035d2422 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143030 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-18Related tdf#104597, tdf#151546: Introduce comphelper::string::reverseCodePointsStephan Bergmann
69e9925ded584113e52f84ef0ed7c224079fa061 "sdext.pdfimport: resolves tdf#104597: RTL script text runs are reversed" and f6004e1c457ddab5e0c91e6159875d25130b108a "tdf#151546: RTL text is reversed (Writer pdfimport)" had introduced two calls to comphelper::string::reverseString into sdext. That function reverts on the basis of individual UTF-16 code units, not on the basis of Unicode code points. And while at least some pre-existing callers of that function want the former semantics (see below), these two new callers in sdext apparently want the latter semantics. Therefore, introduce an additional function comphelper::string::reverseCodePoints with the latter semantics. I identified three other places that call comphelper::string::reverseString: * SbRtl_StrReverse in basic/source/runtime/methods1.cxx apparently implements some StrReverse Basic function, where a (presumably non-existing) Basic spec would need to decide which of the two semantics is called for. So leave it alone for now. * SvtFileDialog::IsolateFilterFromPath_Impl in fpicker/source/office/iodlg.cxx reverts a string, operates on it, then reverts (parts of) it back. Whether or not that is the most elegant code, using the latter semantics here would apparently be wrong, as double invocation of comphelper::string::reverseCodePoints is not idempotent when the input is a malformed sequence of UTF-16 code units containing a low surrogate followed by a high surrogate. * AccessibleCell::getCellName in svx/source/table/accessiblecell.cxx apparently always operates on a string consisting only of Latin uppercase letters A--Z, for which both semantics are equivalent. (So we can just as well stick with the simpler comphelper::string::reverseString here.) (Extending the tests in comphelper/qa/string/test_string.cxx ran into an issue where loplugin:stringliteralvar warns about deliberate uses of sal_Unicode arrays rather than UTF-16 string literals wrapped in OUStringLiteral, as those arrays deliberately contain malformed UTF-16 code unit sequences and thus converting them into UTF-16 string literals might be considered inappropriate, see the newly added comment at StringLiteralVar::isPotentiallyInitializedWithMalformedUtf16 in compilerplugins/clang/stringliteralvar.cxx for details. So that loplugin had to be improved here, too.) Change-Id: I641cc32c76b0c5f6339ae44d8aa85df0022ffb05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-11Drop counterproductive top-level constStephan Bergmann
...that was apparently left by accident by 24c709655e5c1ca51c6c6da7ef0cb733354f6d20 "clang-tidy modernize-pass-by-value in comphelper", thwarting the use of std::move here. And clean up the declarations in the include file, too. (I came across this code with an upcoming loplugin:constmove that flags suspicious uses of std::move involving const-qualified types.) Change-Id: I8178ad09bc4e7d4f57c5dfd9b0e2103e6d4fa72a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142566 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-07TempFile: Initialise handleDr. David Alan Gilbert
If the tempfile creation fails, the handle is left uninitialised but we still try and close it, and we explode with various pthread locking corruptions. I think this could be the cause of a bunch of the: https://crashreport.libreoffice.org/stats/signature/osl_closeFile I can trigger it on Linux by setting TMPDIR to a bogus value, but I don't think that's all the cases that we see in the crash reports. Initialising it to null makes the close take a safe path. Change-Id: If66c5629b6bce62e6c4b18a97ecb901abedd4ea3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142343 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-27try to fix some shutdown crashesNoel Grandin
seen in 7.4 crash reports Change-Id: I4c88d485e2e1925895f23861232823ebe97c0c8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141936 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-14Remove unused comphelper::string::reverseString overloadStephan Bergmann
Change-Id: Ic1c56c7be9804685fd37b8f6a13aaab039e07afa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141361 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-09-16vcl: AnimationBitmap -> AnimationFrameChris Sherlock
The emphasis is not quite right. An animation is made up a sequence of *frames*, not bitmaps. A frame includes such things as position, size, timeout till the next frame *as well as* a bitmap. Note: had to regenerate a bunch of precompiled headers Change-Id: Ib1959452653857555f41e01ac0151d08c41a3b1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76460 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-09-14move ErrCode to comphelper and improve debug output stringNoel Grandin
need to move it, because modules "below" vcl want to use the debug output method Change-Id: Ibcaf4089a1e0b3fcc0b5189c7ebf1aae90f50b48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-02[API CHANGE] tdf#150683 a11y: Switch a11y child index to 64 bitMichael Weghorn
With 16k column support in Calc enabled by default in commit 4c5f8ccf0a2320432b8fe91add1dcadf54d9fd58 Date: Tue Mar 8 12:44:49 2022 +0100 change default Calc number of columns to 16384 (tdf#50916) , the number of Calc cells in a spreadsheet is larger than SAL_MAX_INT32, meaning that a 32-bit a11y child index is no more enough and using it resulted in integer overflows in methods handling corresponding Calc cells in the a11y layer. This e.g. had the effect of the Orca and NVDA screen readers not announcing focused or selected cells properly when their a11y child index was out of the 32-bit integer range. Switch the internal a11y child indices to 64 bit to be able to handle this properly internally. Since the platform APIs (at least AT-SPI on Linux and IAccessible2 on Windows; from what I can see LO's macOS a11y bridge doesn't directly expose the child index) are still restricted to 32 bit, larger child indices still cannot be exposed via the platform APIs. As a consequence, use of the the IAccessible2 and AT-SPI methods that use the child index remains problematic in those cases where the child index is larger. However, as an alternative to using the AT-SPI Table interface and the IAccessibleTable/ IAccessibleTable2 interfaces with the child index to retrieve information about a specific cell, both AT-SPI and IAccessible2 also provide interfaces to retrieve that information directly from the cell object (TableCell interface for AT-SPI, IAccessibleTableCell for IAccessible2). Those interfaces are already implemented/exposed for winaccessibility (s. `CAccTable`) and the qt5/qt6/kf5 VCL plugins (s. the `QAccessibleTableCellInterface` methods implemented in `QtAccessibleInterface`). With the switch to 64-bit internal a11y child indices, these now behave correctly for cells with a child index that doesn't fit into 32 bit as well. NVDA on Windows already uses the IAccessibleTableCell interface and thus announcing focused cells works fine with this change in place. Orca on Linux currently doesn't make use of the AT-SPI TableCell interface yet, but with a suggested change to do so [1], announcement of selected cells works with the qt6 VCL plugin with a current qtbase dev branch as well - when combined with the suggested changes to implement support for the AT-SPI TableCell interface in Qt [2] [3] and the LO change based on that [4] and a fix for a nullptr dereference [5]. The gtk3 VCL plugin doesn't expose the AT-SPI TableCell interface yet, but once it does so (via `AtkTableCell`), it also works with the suggested Orca change [1] in place. (Adding that is planned for an upcoming change, works with a local WIP patch.) For handling return values that are larger than what platform APIs support, the following approach has been chosen for now: 1) When the return value is for the count of (selected) children, the maximum value N supported by the platform API is returned. (This is what `ScAccessibleTableBase::getAccessibleChildCount` did previously.) The first N elements can be accessed by their actual (selection) indices. 2) When the return value is the child/cell index, -2 is returned for objects whose index is greater than the maximum value supported by the platform API. Using a non-negative value would mean that the index would refer to *another* actually existing child. A child index of -1 on the other hand tends to be interpreted as "child is invalid" or "object isn't actually a child of its (previous) parent any more)". For the Orca case, this would result in objects with a child index of -1 not being announced, as they are considered "zombies" [6]. What's still somewhat problematic is the case where more than 2^31 children are *selected*, since access to those children still happens by the index into the selection in the platform APIs, and not all selected items are accessible this way. (Screen readers usually just retrieve the first and last element from the selection and announce those.) Orca already seems to apply different handling for the case for fully selected rows and columns, so "All cells selected" or "Columns ... to ... selected" is announced just fine even if more than 2^31 cells are selected. (Side note: While Microsoft User Interface Automation - UIA - also uses 32-bit indices, it also has specific methods in the ISelectionProvider2 interface that allow to explicitly retrieve the first and last selected item, `ISelectionProvider2::get_FirstSelectedItem` and `ISelectionProvider2::get_LastSelectedItem`, but we currently don't support UIA on Windows.) Bound checks at the beginning of the methods from the `XAccessibleContext`, `XAccessibleSelection` and `XAccessibleTable` interfaces that take a child index (or in helper methods called by those) should generally already prevent too large indices from being passed to the methods in the lower layer code that take smaller integer types. Such bound checking has been been added in various places where it wasn't present yet. If there any remaining issues of this kind that show after this commit, they can probably be solved in a similar way (s.e.g. the change to `AccessibleBrowseBox::getAccessibleChild` in this commit). A few asserts were also added at places where my understanding is that values shouldn't be larger than what is supported by a called method anyway. A test case will be added in a following change. [1] https://gitlab.gnome.org/GNOME/orca/-/merge_requests/131 [2] https://codereview.qt-project.org/c/qt/qtbase/+/428566 [3] https://codereview.qt-project.org/c/qt/qtbase/+/428567 [4] https://gerrit.libreoffice.org/c/core/+/138750 [5] https://codereview.qt-project.org/c/qt/qtbase/+/430157 [6] https://gitlab.gnome.org/GNOME/orca/-/blob/82c8542002e36e0d3d918088d583162d25136143/src/orca/script_utilities.py#L5155 Change-Id: I3af590c988b0e6754fc72545918412f39e8fea07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139258 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-24tdf#150575: REPORTBUILDER: Crash when closing report when used report navigatorJulien Nabet
0 0x00007fe062bdda64 in comphelper::OSelectionChangeMultiplexer::disposing(com::sun::star::lang::EventObject const&) (this=0x55fe72b7b680, _rSource=...) at comphelper/source/misc/SelectionMultiplex.cxx:82 1 0x00007fdf90a97a6b in comphelper::OInterfaceContainerHelper3<com::sun::star::view::XSelectionChangeListener>::disposeAndClear(com::sun::star::lang::EventObject const&) (this=0x55fe6c94b6d0, rEvt=...) at include/comphelper/interfacecontainer3.hxx:362 2 0x00007fdf90a6ace4 in rptui::OReportController::disposing() (this=0x55fe6c94b200) at reportdesign/source/ui/report/ReportController.cxx:341 3 0x00007fe062539b5d in cppu::WeakComponentImplHelperBase::dispose() (this=0x55fe6c94b200) at cppuhelper/source/implbase.cxx:104 4 0x00007fe0393b76e5 in cppu::PartialWeakComponentImplHelper<com::sun::star::frame::XDispatch, com::sun::star::frame::XDispatchProviderInterceptor, com::sun::star::util::XModifyListener, com::sun::star::frame::XFrameActionListener, com::sun::star::lang::XInitialization, com::sun::star::lang::XServiceInfo, com::sun::star::frame::XDispatchInformationProvider, com::sun::star::frame::XController2, com::sun::star::frame::XTitle, com::sun::star::frame::XTitleChangeBroadcaster, com::sun::star::awt::XUserInputInterception>::dispose() (this=0x55fe6c94b200) at include/cppuhelper/compbase.hxx:90 5 0x00007fe0393af9d3 in dbaui::OGenericUnoController::dispose() (this=0x55fe6c94b200) at dbaccess/source/ui/browser/genericcontroller.cxx:1207 See full bt here: https://bugs.documentfoundation.org/attachment.cgi?id=181994 "addSelectionChangeListener" is called when "OSelectionChangeMultiplexer" is instantiated in "NavigatorTree" ctr 225 m_pSelectionListener = new OSelectionChangeMultiplexer(this,&m_rController); but "removeSelectionChangeListener" was never called so add the mechanism to call it. Change-Id: I157b147f7a17244dbbfa7d12743fc7d48e7d5f7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138773 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-08-22Optimize and deduplicate Base64::encode a bitMike Kaganski
Change-Id: Ic549c8bf938ae363f9d1b83b8e3f4e6ee10603d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138657 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-19Some more use of TOOLS_WARN_EXCEPTIONStephan Bergmann
CppunitTest_dbaccess_tdf126268 had oddly failed once for me with > [_RUN_____] Tdf126268Test::testNumbers > Fontconfig error: Cannot load default config file: No such file: (null) > warn:legacy.osl:4121315:4121315:dbaccess/source/core/dataaccess/ModelImpl.cxx:765: ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from! > warn:legacy.osl:4121315:4121315:dbaccess/source/core/dataaccess/ModelImpl.cxx:765: ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from! > warn:legacy.osl:4121315:4121315:dbaccess/source/core/dataaccess/ModelImpl.cxx:765: ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from! > warn:legacy.osl:4121315:4121315:comphelper/source/misc/logging.cxx:63: EventLogger_Impl::impl_createLogger_nothrow: caught an exception! > > > Fatal exception: Signal 6 > Stack: > workdir/LinkTarget/Executable/cppunittester(__interceptor_backtrace+0x5b)[0x5589724dcd5b] > instdir/program/libuno_sal.so.3(+0x62188d)[0x7fb0bba3888d] > instdir/program/libuno_sal.so.3(+0x6210a9)[0x7fb0bba380a9] > instdir/program/libuno_sal.so.3(+0x61eba6)[0x7fb0bba35ba6] > /lib64/libc.so.6(+0x3ea70)[0x7fb0baefea70] > /lib64/libc.so.6(+0x8ec4c)[0x7fb0baf4ec4c] > /lib64/libc.so.6(raise+0x16)[0x7fb0baefe9c6] > /lib64/libc.so.6(abort+0xcf)[0x7fb0baee87f4] > instdir/program/libEngine12.so(+0x3075ac9)[0x7fb029552ac9] > instdir/program/libEngine12.so(+0x3075c32)[0x7fb029552c32] > instdir/program/libEngine12.so(+0x318e53c)[0x7fb02966b53c] [...] and it might have been interesting to learn what that caught exception was. Change-Id: I3597ed22b4f02a8fa08f1cd36aa64d210e48356d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138509 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-18Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxxStephan Bergmann
...so that its TOOLS_WARN_EXCEPTION can be used in comphelper/source/misc/logging.cxx in a follow-up commit. (And while at it, rename from diangose_ex.h to the more appropriate diagnose_ex.hxx. The comphelper module is sufficiently low-level for this immediate use case, so use that at least for now; o3tl might be even more suitable but doesn't have a Library until now. Also, for the immediate use case it would have sufficed to only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION, TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of include/tools/diagnose_ex.h into an additional new include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move the complete include file as is.) Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-19Consolidate writeBytes functionsStephan Bergmann
Change-Id: I44db198967a37f8b11f1b185a8b093b0de2d500d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137205 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-18Drop leftover commentStephan Bergmann
...introduced by d203e3f35dc4547bb46151637ba6054d13025d01 "use comphelper::ByteWriter in UNOMemoryStream", made obsolete by 3ca1a169e571a829598a00a2ffef6e1018d2cb18 "Use boost::noinit_adaptor", forgotten to be removed in 3c7378d54b7a04e3f6dfc75a994744bdd953af7b "Fix mid-air collision" Change-Id: I0c98e2e5a9eaf5fcc6def605d6d068080de55c9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137194 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-18nNewSize is guaranteed to be non-negative hereStephan Bergmann
Change-Id: Idb427a0bd3bae94f056d3253682a024169b5288f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137172 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-18comphelper::ByteWriter::writeSomeBytes always writes all bytesStephan Bergmann
...so rename it to writeBytes for clarity, and drop the redundant return value. Also clarify that it has a narrow interface and requires nBytesToWrite to be non-negative. Change-Id: I76dee83fecd6350f473f55dcffb950c16aa22d93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137169 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-08[API CHANGE] Drop css::accessibility::XAccessibleStateSetNoel Grandin
which is internal API, unused (as far as I can tell) by external users. This state is purely a bitset (as implemented by utl::AccessibleStateSetHelper) so we can just return it as a 64-bit value. This shaves significant time off the performance profiles of code that loads very complex shapes, because this state is frequently used, and we no longer need to allocate a return value on the heap for every call. Change-Id: Icf1b3bd367c256646ae9015f9127025f59459c2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136786 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-08comphelper: replace tools::Long with size_tChris Sherlock
Change-Id: I1eba8e05bdc92fd689e368dd4fe0e79bc1f2b46f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135716 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-04tdf#137544 reduce cost of SolarMutex checkingNoel Grandin
the std::thread::id facilities are cheaper than the sal versions Change-Id: I5ccb7e54f3a1e4d715338faa1e9c0aae9449e46d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136800 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-15elide temporary string in comphelper::stripNoel Grandin
Change-Id: I093768c617490679d295cce37cc3ffe67c8e940a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135871 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-08Fix typoIlmari Lauhakangas
Change-Id: I56b36663a460eb6840968bc02e61371ace558fa7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135490 Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-06-02Use more appropriate type for LocationAccess::nOwnClassVectorIndexStephan Bergmann
Change-Id: Iba1709b60a27c331dcc6cf4e6f0966d94130a66c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135320 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-02Use o3tl::make_unsigned, location is already checked to be non-negative hereStephan Bergmann
Change-Id: Id052b9628e8df6d0e8b61b66f6ddc64d925427ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135321 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>