summaryrefslogtreecommitdiffstats
path: root/comphelper
Commit message (Collapse)AuthorAgeFilesLines
* tdf#138113: Base SQL syntax colouring issue with operators "/", "-"Julien Nabet2020-11-111-0/+4
| | | | | | | | | | | | Change-Id: If268d7731642a6503418ca187b4fe85a889d1d2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105581 (cherry picked from commit e2b290da0922246f8fb5fcd332bbd41ad165fd43) Change-Id: Ib359c8e024b4899b67e381a16f183232bfe88bec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105537 Reviewed-by: Lionel Mamane <lionel@mamane.lu> Tested-by: Jenkins
* tdf#81522 comphelper: just ignore disposed obj on saveJustin Luth2020-07-301-66/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Even if xObj.is(), it might be disposed, and then getCurrentState() will raise an exception, resulting in an ERRCODE_IO_GENERAL, and failing to save the entire document. Although it might not seem good to just ignore an error on save, the general attitude in that function already leans that way. In fact, the other ::StoreChildren() wraps the entire for-loop in a try-catch. Also, in this function a bad xPersist also breaks out of the loop and returns a false. So wrapping the entire xObj in an "ignore if errors" try-catch seems reasonable to me in this instance. The alternative is not to allow the user to save at all, which is much worse, especially since there is nothing he can do to fix the problem. Change-Id: I0372245563735ae7ac7976bf7ce6060e57a5eb87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99129 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Justin Luth <justin_luth@sil.org> (cherry picked from commit 91d1cd8687c00a639cb4ecc5759254c946efe4c1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99199
* replace hard-coded "1.2" ODF version stringsMichael Stahl2020-05-151-2/+3
| | | | | | | | | | | | | | | | | | Most of these are calls to DocumentDigitalSignatures::createWithVersion(), where it doesn't make a difference if "1.2" or "1.3" is passed in but maybe it will be different with "1.4". There is another ctor createDefault() which looks appropriate for non-ODF contexts and can also be used when no actual signing or verifying is done. In cases where there's an actual document its Storage has the version. Change-Id: Id636bbf965d9f96c7ed5f50774c509032525b2b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93091 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
* new loplugin:simplifypointertoboolNoel Grandin2020-05-101-1/+1
| | | | | | | Change-Id: Iff68e8f379614a6ab6a6e0d1bad18e70bc76d76a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91907 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* lok: set device form factor of the client on view creationMarco Cecchetti2020-05-101-36/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows the lok core to know about the device form facor of the client requesting the creation of new view, immediately instead of a later time. When a new view is needed a "DeviceFormFactor" parameter is forwarded to lo_documentLoadWithOptions and doc_createViewWithOptions from the client. This parameter can have one of the following values: 'desktop', 'tablet','mobile' and it is used to set a global variable accessible by SfxLokHelper::setDeviceFormFactor and SfxLokHelper::getDeviceFormFactor. This global variable is retrived in the SfxViewShell constructor for setting SfxViewShell::maLOKDeviceFormFactor attribute. In SfxViewShell we have the following 3 methods: - bool isLOKDesktop() - bool isLOKTablet() - bool isLOKMobilePhone() which replace the following boolean functions: - comphelper::LibreOfficeKit::isTablet - comphelper::LibreOfficeKit::::isMobilePhone Change-Id: I9b36f354278df8c216fcb90f6a9da8256ec9c1e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93340 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
* improve loplugin:referencecastingNoel Grandin2020-05-081-1/+1
| | | | | | | | | to catch a few more cases Change-Id: I0323fba51bb2b4ba255e1db5aa0d890c5c6a2e1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93726 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* compact namespace in canvas..cuiNoel Grandin2020-05-081-2/+2
| | | | | | | Change-Id: I7bd0c2a55b936896fcfe7e1a374871008a18618f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93706 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* allow disabling Skia's Vulkan use in safe mode (tdf#132439)Luboš Luňák2020-05-061-0/+5
| | | | | | | Change-Id: I2991ace387356f049fba1a730041bbb4c62c876c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93562 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
* fix leak in comphelper::TestHashNoel Grandin2020-05-042-0/+19
| | | | | | | | | by shutting down NSS at end of test Change-Id: I63694e9bc54e8c142592005be353af7ed95d444d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93427 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* tdf#131733 Show only CN part of X.509 subject infoGabor Kelemen2020-04-291-14/+5
| | | | | | | | | | | | | | | The problem was that the whole Subject info was returned from X.509 certs if they did not start with one of "CN", "OU", "O", "E" Instead of extending this list with random keys, pass the type of cert and only return the whole Subject info if it's an OpenGPG one, and process the info unconditionally if it's X.509 like before the OpenGPG integration Change-Id: I1aa5d7285e48b0f4a769a073cdfb7732e482792c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92675 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
* Make upcasting css::uno::Reference ctor require complete typesStephan Bergmann2020-04-272-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The main reason for the "home-grown" UpCast introduced with 904b3d1fceee5827076758ed2a81f80cb73493ca "Up-cast conversion constructor for css::uno::Reference" in 2013 was probably that we could not yet rely on C++11 std::is_base_of back then. A (welcome) side effect was that the derived class could be incomplete. However, specializations of UpCast relying on whether or not T2 is incomplete are obviously an ODR violation if the type is incomplete in some TUs and complete (and derived from T1) in others. And even if UpCast had internal linkage, it would still be brittle that its behavior depends on the completeness of T2 at the point of the template's instantiation, and not necessarily at the point of use. That means we should better base that ctor on std::is_base_of (which we can do now since 39a1edd6fec902ef378acce8af42c4d7fba280d0 "Make css::uno::Reference upcast ctor LIBO_INTERNAL_ONLY"), which causes a compilation error at least on Clang and GCC if the completeness requirements are not met. This change fixes all the cases where types need to be complete now, plus any resulting loplugin:referencecasting warnings ("the source reference is already a subtype of the destination reference"). Change-Id: Ieb9e3552e90adbf2c5a5af933dcb872e20661a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92950 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* update pchesCaolán McNamara2020-04-261-2/+2
| | | | | | | Change-Id: I83a61da7dda6c72552eecd377f1c3744c92a797e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92909 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
* uiobject.hxx only needs forward declaresCaolán McNamara2020-04-221-2/+3
| | | | | | | | | and update pches accordingly Change-Id: I411712532fd85961bffe6678416fcdc1d9c7f53d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92617 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
* loplugin:flatten in comphelperNoel Grandin2020-04-1816-507/+508
| | | | | | | Change-Id: I1a8db4dbd744b87406d1db5609585495f01f4403 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92478 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:buriedassign in c*Noel Grandin2020-04-141-3/+6
| | | | | | | Change-Id: Id14fed7e5c0f588ad3c927f12251432d12c1a7c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92190 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* Check call to NSS_NoDB_Init for successStephan Bergmann2020-03-261-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | I had run into this when prior to 23245f723fb29262b8543d6447d1b0bb69cb50fb "external/nss: Fix rpath for Linux et al" that call had failed at least for my Linux ASan+UBSan build, causing UITest_calc_tests to fail with > ../../lib/cryptohi/sechash.c:443:16: runtime error: member access within null pointer of type 'HASHContext' (aka 'struct HASHContextStr') > #0 in HASH_Begin at workdir/UnpackedTarball/nss/nss/out/Debug/../../lib/cryptohi/sechash.c:443:16 (instdir/program/libnss3.so +0x3c47eb) > #1 in comphelper::HashImpl::HashImpl(comphelper::HashType) at comphelper/source/misc/hash.cxx:78:9 (instdir/program/libcomphelper.so +0x149945a) > #2 in comphelper::Hash::Hash(comphelper::HashType) at comphelper/source/misc/hash.cxx:96:16 (instdir/program/libcomphelper.so +0x1496eb7) > #3 in vcl::PDFWriterImpl::PDFWriterImpl(vcl::PDFWriter::PDFWriterContext const&, com::sun::star::uno::Reference<com::sun::star::beans::XMaterialHolder> const&, vcl::PDFWriter&) at vcl/source/gdi/pdfwriter_impl.cxx:1137:9 (instdir/program/libvcllo.so +0x8f20d3c) because that HASH functionality was used even though initializing it had failed. Throwing a RuntimeException appears to be effective, even though conceptually not the best approach: at least doing "Export Directly as PDF" of a fresh Writer document fails cleanly with an error box "Error saving the document Untitled 1: General Error. General input/output error." Change-Id: I07564a7f27a7b44e535556032e0eeb267026f06d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91088 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* Simplify the LibreOfficeKit mobile phone and tablet APITor Lillqvist2020-03-241-4/+8
| | | | | | | | | | | | There is not need to ever change the kind of device a view is for, so why bother with the bool parameter to setMobilePhone() and setTablet(). Also, make sure just either of them is called, at most once, for a view. Change-Id: I9ac872f0ab4772e4a7c40c49f62b32fa7b1e47f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90968 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
* Rename isMobile to isMobilePhone and introduce a separate isTabletTor Lillqvist2020-03-201-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The intended semantics of isMobile() has been to say whether the device is a mobile phone ot not. Not whether it is a mobile device in general. So make that explicit. Adjust call sites as necessary. Also, in a couple of places where it is likely that what is relevant is whether it is a mobile device in general, not just whether it is a mobile phone, check both isMobile() and isTablet(). For stable interoperability with current Online, keep accepting also the .uno:LOKSetMobile "command" (and .uno:LOKUnSetMobile, except that Online never sends that). Online will eventually be changed to use .uno:LOKSetMobilePhone or .uno:LOGSetTablet only (and never the UnSet variants). Also drop the default value for the bool parameter to setMobilePhone(). Default bool parameters can be quite confusing, and it was especially silly in this case as there is one (1) call site. This is a work in progress and will be improved. Currently there are undefined corner cases. Change-Id: I2a71c37323ee151cbc671bd8e714e1dee10f8b1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90560 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90778 Tested-by: Jenkins
* comphelper::isDebuggerAttached must be defined irrespective of NDEBUGStephan Bergmann2020-03-181-1/+1
| | | | | | | | | | | | | | | | | ac9083f64fc064e4bad3dc522a90ca214b3f1c2f "make isDebuggerAttached() public comphelper API" had forgotten to drop the NDEBUG condition, causing --enable-dbgutil --disable-assert-always-abort builds like <https://ci.libreoffice.org//job/lo_tb_random_config_linux/2215/> to fail with > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /lo/home/tdf/lode/jenkins/workspace/lo_tb_random_config_linux/workdir/CxxObject/vcl/source/app/watchdog.o: in function `WatchdogThread::start()': > /lo/home/tdf/lode/jenkins/workspace/lo_tb_random_config_linux/vcl/source/app/watchdog.cxx:138: undefined reference to `comphelper::isDebuggerAttached()' > collect2: error: ld returned 1 exit status > /lo/home/tdf/lode/jenkins/workspace/lo_tb_random_config_linux/vcl/Library_vcl.mk:20: recipe for target '/lo/home/tdf/lode/jenkins/workspace/lo_tb_random_config_linux/instdir/program/libvcllo.so' failed Change-Id: Ia391881f0b6a79709fbebfd204097840a9890147 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90698 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* tdf#130975 replace `rtl::math::isNan` with `std::isnan`.Yukio Siraichi2020-03-141-1/+1
| | | | | | | Change-Id: I5d53e6369d35093445b2efd8936bbf8c6775ff47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90451 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
* comphelper: allow simple ad-hoc measuring with ProfileZonesMiklos Vajna2020-03-041-0/+9
| | | | | | | | | | | | | And then remove the manual measuring from the RTF import. Sample output: comphelper::ProfileZone: RtfFilter::filter finished in 180 ms Change-Id: I85e2e12d82ff491a2991a41e5a6f6d1410e12363 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89905 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
* change SAL_WARN to SAL_INFO when language is not setTomaž Vajngerl2020-02-281-2/+2
| | | | | | | | | | | | | Change this, so we don't fill the console with warnings. Change-Id: I089113207be99b50b15cf292cae3e929f9edff26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89556 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit af17b2cd26a1e36edf0b995f81a2e0757086dad1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89676 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
* Fix currency symbol selection in Calc on mobileTomaž Vajngerl2020-02-251-10/+63
| | | | | | | | | | | | | | | | | | | | | | | | In LOK we use one language identifier for both - UI language and the locale used. This is a problem when we determine that we a language for UI is not available and fall-back to the default "en-US" langauge, which also changes the locale. This introduces a separate variable that stores the language tag for the locale independently to the language. Another problem is that in some cases we don't reset the staticly initialized data, when the new document is loaded, which is on the other hand used to define which currency symbol is used as SYSTEM locale. That can in some cases select the wrong currency symbol even when we changed the locale to something else. This fix introduces a reset function, which is triggered on every document load. Change-Id: I55c7f467600a832895f94346f8bf11a6ef6a1e49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89320 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89343 Tested-by: Jenkins
* Drop o3tl::optional wrapperStephan Bergmann2020-02-213-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...now that macOS builds are guaranteed to have std::optional since 358146bbbd1b9775c12770fb5e497b6ec5adfc51 "Bump macOS build baseline to Xcode 11.3 and macOS 10.14.4". The change is done mostly mechanically with > for i in $(git grep -Fl optional); do > sed -i -e 's:<o3tl/optional\.hxx>\|\"o3tl/optional\.hxx\":<optional>:' \ > -e 's/\<o3tl::optional\>/std::optional/g' \ > -e 's/\<o3tl::make_optional\>/std::make_optional/g' "$i" > done > for i in $(git grep -Flw o3tl::nullopt); do > sed -i -e 's/\<o3tl::nullopt\>/std::nullopt/g' "$i" > done (though that causes some of the resulting #include <optional> to appear at different places relative to other includes than if they had been added manually), plus a few manual modifications: * adapt bin/find-unneeded-includes * adapt desktop/IwyuFilter_desktop.yaml * remove include/o3tl/optional.hxx * quote resulting "<"/">" as "&lt;"/"&gt;" in officecfg/registry/cppheader.xsl * and then solenv/clang-format/reformat-formatted-files Change-Id: I68833d9f7945e57aa2bc703349cbc5a56b342273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* inline some acquire/release callsNoel Grandin2020-02-171-10/+0
| | | | | | | | | | | because these are all on the hot path, and in the best case, with enough inlining, the compiler can skip the call altogether and just do a locked CMPXHG instruction Change-Id: I099d6385f602e40e1767f9f1002b7514ecf436e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88775 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* clang-format c*,d*,e* with under 5-percent lines of changeMuhammet Kara2020-02-161-2/+2
| | | | | | | | | | | | | | Files which could become clang-format conformant with under 5-percent lines of change relative to the total count of lines in the file are found by using bin/find-clang-format.py, and fixed with /opt/lo/bin/clang-format -i <path-of-the-file> There will be follow-up patches to fix all 'under-5-percent' files. Change-Id: I06087a1385ca9da6a28d36ea4c0d2e40bdbf8f03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88774 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
* android hunspell: All languages we pack are the supported ones.Jan Holesovsky2020-02-111-0/+5
| | | | | | | | | | | | Without this, we disable all the languages, because the env. variable is not set. Change-Id: If8f6a9ec6270391d1f8c2bf225c8ea4bb1aae688 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88220 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88367 Tested-by: Jenkins
* pack some data structuresNoel Grandin2020-02-081-2/+2
| | | | | | | Change-Id: I7ef990b8aa7b26c413b54186c360ed3f858d4e26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* make isDebuggerAttached() public comphelper APILuboš Luňák2020-02-073-30/+60
| | | | | | | | | So that it can be used also from other places. Change-Id: Iab90350fd02872ffde180ce74f01f7ff5e4448b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88009 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
* make update_pch also consider files in <module>/src/**/incLuboš Luňák2020-02-011-2/+2
| | | | | | | | | | | | With --enable-pch=full there's not much difference between a "public" header in <module>/inc and a private one in <module>/src/somewhere/inc . And since the script searches recursively, this apparently helps to find even more headers for lower pch levels. Change-Id: I8483d0aa5b4fea5a59107c20a8aa5f1ef694af0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87799 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
* new loplugin:namespaceindentationNoel Grandin2020-01-313-4/+4
| | | | | | | | | | | | | | | | check indentation of braces in namespace decls, and the comments that often appear with them. This is my penance for messing up the indentation with clang-tidy-modernize-namespaces. As such I have limited it to new-style namespaces for now, and the check is off by default. Change-Id: I4db7f10a81c79bc0eece8f8e3ee564da8bc7f168 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87723 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* New loplugin:unsignedcompareStephan Bergmann2020-01-282-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Find explicit casts from signed to unsigned integer in comparison against unsigned integer, where the cast is presumably used to avoid warnings about signed vs. unsigned comparisons, and could thus be replaced with o3tl::make_unsigned for clairty." (compilerplugins/clang/unsignedcompare.cxx) o3tl::make_unsigned requires its argument to be non-negative, and there is a chance that some original code like static_cast<sal_uInt32>(n) >= c used the explicit cast to actually force a (potentially negative) value of sal_Int32 to be interpreted as an unsigned sal_uInt32, rather than using the cast to avoid a false "signed vs. unsigned comparison" warning in a case where n is known to be non-negative. It appears that restricting this plugin to non- equality comparisons (<, >, <=, >=) and excluding equality comparisons (==, !=) is a useful heuristic to avoid such false positives. The only remainging false positive I found was 0288c8ffecff4956a52b9147d441979941e8b87f "Rephrase cast from sal_Int32 to sal_uInt32". But which of course does not mean that there were no further false positivies that I missed. So this commit may accidentally introduce some false hits of the assert in o3tl::make_unsigned. At least, it passed a full (Linux ASan+UBSan --enable-dbgutil) `make check && make screenshot`. It is by design that o3tl::make_unsigned only accepts signed integer parameter types (and is not defined as a nop for unsigned ones), to avoid unnecessary uses which would in general be suspicious. But the STATIC_ARRAY_SELECT macro in include/oox/helper/helper.hxx is used with both signed and unsigned types, so needs a little oox::detail::make_unsigned helper function for now. (The ultimate fix being to get rid of the macro in the first place.) Change-Id: Ia4adc9f44c70ad1dfd608784cac39ee922c32175 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87556 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* simplify InterfaceContainerHelper::clearNoel Grandin2020-01-261-7/+6
| | | | | | | | | instead of relying on side-effects from instantiating an iterator Change-Id: Ie66b9e7ceeb3c4a0f4243fdd0a5ac37af77e98ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87412 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* use osl::Guard instead of abusing rtl::ReferenceNoel Grandin2020-01-241-2/+5
| | | | | | | | | to make this code easier to read Change-Id: Ia1ea52cd713572be768f7b505080c08f15f6c542 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87290 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:makeshared in chart2..comphelperNoel Grandin2020-01-244-7/+7
| | | | | | | Change-Id: Ia25f5de3167fd554d463ce6111e8c5b0e7842907 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87275 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* Make TempFile destructor remove temp directory recursivelySamuel Mehrbrodt2020-01-213-223/+236
| | | | | | | Change-Id: Idcfa93ffe86112477ad81bcbf74b8e5b858423f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87080 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
* tdf#88205 Adapt uses of css::uno::Sequence to use initializer_list ctorMesut Çifci2020-01-163-6/+3
| | | | | | | Change-Id: Ic6ed5dcf6343a4ff59a1f69c77c82b03b4ee6198 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86904 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* clang-tidy modernize-concat-nested-namespace in codemaker..configmgrNoel Grandin2020-01-1510-32/+13
| | | | | | | Change-Id: I48452480fae169e11d60b125bbd0226b6a35a25c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86800 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* Revert "tdf#125662: disable parallel-zip if the memory..."Dennis Francis2020-01-132-141/+0
| | | | | | | | | | This reverts commit 0b8ae8725083eb0526a262d434cc06fb3f3e7336. A better fix will follow this patch. Change-Id: I4ff8d71bf2401bae2e2071c369e3746b8b7c72bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86595 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
* Improve loplugin:redundantcast for sal_Int... vs. ::sal_Int...Stephan Bergmann2020-01-091-1/+1
| | | | | | | Change-Id: I1548a76fdc03afee68f1e5c01bc665e616f2edf2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86501 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* loplugin:includeform (clang-cl)Stephan Bergmann2020-01-081-1/+1
| | | | | | | Change-Id: I30d1f3e67eafddb6334d0cb6cdc9bbe132057ea7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86415 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* loplugin:cstylecast (macOS)Stephan Bergmann2020-01-061-1/+2
| | | | | | | | | | | ...("from 'struct task_basic_info *' to 'task_info_t' (aka 'int *')", in code newly introduced with 0b8ae8725083eb0526a262d434cc06fb3f3e7336 "tdf#125662: disable parallel-zip if the memory...") Change-Id: I8ae16b4e6055b0841e9143b554bd832cb72346f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86243 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* tdf#125662: disable parallel-zip if the memory...Dennis Francis2020-01-042-0/+140
| | | | | | | | | | | | | | | required to carry it out will cause a breach of addressable memory limit. This can happen in 32bit OSes, where the physical memory limit is more than the process addressable memory limit. For example in Win32, a process can address only upto 2GB. More specifically, avoid using ZipOutputEntryParallel which rougly needs twice the memory compared to its counterparts. Change-Id: I4d1abbf75e928188bcf806fcf1e5872b1e51b502 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/84394 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
* tdf#93389: keep encryption information for autorecovered MS formatsMike Kaganski2020-01-041-1/+36
| | | | | | | | | | | | | | | | | | | | | | | The autorecovery data is stored in ODF, regardless of the original document format. When restoring, type detection generates ODF data, which is stored in the media descriptor attached to document, even after real filter was restored (see AutoRecovery::implts_openDocs). If real filter is not ODF, then at the save time, it doesn't find necessary information in encryption data, and makes not encrypted package. This patch adds both MS binary data, and OOXML data, to existing ODF data for recovered password-protected documents (regardless of their real filter). TODO: only add required information to encryption data: pass real filter name to DocPasswordHelper::requestAndVerifyDocPassword from AutoRecovery::implts_openDocs. Change-Id: I4749c5ec028ca61bddf7cd77bc5969a97b1de199 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86201 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
* desktop: unit-test to check SpellDialog works in multiple viewsAshod Nakashian2019-12-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, this isn't fully functional, but didn't want to lose the effort. The problem is that there is no proper config for languages in the unit-tests. So even when we set the language explicitly, it still doesn't apply to the SpellCheckerDispatcher, which is where it matters. This seems to be because the config is not properly propagated and broadcast. Below is the stacktrace as works on desktop. During the unittest the Broadcaster has no change listener for LngSvcMgr, so SpellCheckerDispatcher::SetServiceList doesn't get called. #0 0x00007f47f3fed7e6 in SpellCheckerDispatcher::SetServiceList(com::sun::star::lang::Locale const&, com::sun::star::uno::Sequence<rtl::OUString> const&) (this=0x5589de40e7a0, rLocale=..., rSvcImplNames=uno::Sequence of length 1 = {...}) at /home/ash/prj/master/linguistic/source/spelldsp.cxx:795 #1 0x00007f47f3fcc0ad in LngSvcMgr::Notify(com::sun::star::uno::Sequence<rtl::OUString> const&) (this=0x5589de43b4e0, rPropertyNames=uno::Sequence of length 4 = {...}) at /home/ash/prj/master/linguistic/source/lngsvcmgr.cxx:826 #2 0x00007f47fa2d3c8d in utl::ConfigItem::CallNotify(com::sun::star::uno::Sequence<rtl::OUString> const&) (this=0x5589de43b530, rPropertyNames=uno::Sequence of length 4 = {...}) at /home/ash/prj/master/unotools/source/config/configitem.cxx:181 #3 0x00007f47fa2d3946 in utl::ConfigChangeListener_Impl::changesOccurred(com::sun::star::util::ChangesEvent const&) (this=0x5589de464b90, rEvent=...) at /home/ash/prj/master/unotools/source/config/configitem.cxx:143 #4 0x00007f47e273bb61 in configmgr::Broadcaster::send() (this=0x7ffcc604c5b0) at /home/ash/prj/master/configmgr/source/broadcaster.cxx:182 #5 0x00007f47e277f002 in configmgr::RootAccess::commitChanges() (this=0x5589dd557400) at /home/ash/prj/master/configmgr/source/rootaccess.cxx:171 #6 0x00007f47fa2d80e3 in utl::ConfigItem::ReplaceSetProperties(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x5589dd5571b0, rNode="ServiceManager/SpellCheckerList", rValues=uno::Sequence of length 4 = {...}) at /home/ash/prj/master/unotools/source/config/configitem.cxx:1025 #7 0x00007f47fa339983 in SvtLinguConfig::ReplaceSetProperties(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x7ffcc604cb40, rNode="ServiceManager/SpellCheckerList", rValues=uno::Sequence of length 4 = {...}) at /home/ash/prj/master/unotools/source/config/lingucfg.cxx:847 #8 0x00007f47f3fcb88f in LngSvcMgr::UpdateAll() (this=0x5589de43b4e0) at /home/ash/prj/master/linguistic/source/lngsvcmgr.cxx:765 #9 0x00007f47f3fc9caa in LngSvcMgr::LngSvcMgr() (this=0x5589de43b4e0) at /home/ash/prj/master/linguistic/source/lngsvcmgr.cxx:438 #10 0x00007f47f3fd3baf in LngSvcMgr_CreateInstance(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&) () at /home/ash/prj/master/linguistic/source/lngsvcmgr.cxx:1967 #11 0x00007f4800e9656b in cppu::OSingleFactoryHelper::createInstanceEveryTime(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x5589de3ccfc8, xContext= uno::Reference to (cppu::ComponentContext *) 0x5589dbcca630) at /home/ash/prj/master/cppuhelper/source/factory.cxx:149 #12 0x00007f4800e96790 in cppu::OSingleFactoryHelper::createInstanceWithContext(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x5589de3ccfc8, xContext=uno::Reference to (cppu::ComponentContext *) 0x5589dbcca630) at /home/ash/prj/master/cppuhelper/source/factory.cxx:175 #13 0x00007f4800e97107 in cppu::OFactoryComponentHelper::createInstanceWithContext(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x5589de3ccf60, xContext=uno::Reference to (cppu::ComponentContext *) 0x5589dbcca630) at /home/ash/prj/master/cppuhelper/source/factory.cxx:374 #14 0x00007f4800eebc8f in cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool) (this=0x5589dbd2f030, context=uno::Reference to (cppu::ComponentContext *) 0x5589dbcca630, singletonRequest=false) at /home/ash/prj/master/cppuhelper/source/servicemanager.cxx:667 #15 0x00007f4800eee587 in cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x5589dbcbaaf0, aServiceSpecifier="com.sun.star.linguistic2.LinguServiceManager", Context=uno::Reference to (cppu::ComponentContext *) 0x5589dbcca630) at /home/ash/prj/master/cppuhelper/source/servicemanager.cxx:991 #16 0x00007f4800776778 in com::sun::star::linguistic2::LinguServiceManager::create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (the_context=uno::Reference to (cppu::ComponentContext *) 0x5589dbcca630) at /home/ash/prj/master/workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/linguistic2/LinguServiceManager.hpp:38 #17 0x00007f4800772d51 in GetLngSvcMgr_Impl() () at /home/ash/prj/master/editeng/source/misc/unolingu.cxx:66 #18 0x00007f4800773449 in SpellDummy_Impl::GetSpell_Impl() (this=0x5589dd82f420) at /home/ash/prj/master/editeng/source/misc/unolingu.cxx:217 #19 0x00007f4800773614 in SpellDummy_Impl::isValid(rtl::OUString const&, short, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x5589dd82f420, rWord="a", nLanguage=1033, rProperties=empty uno::Sequence) at /home/ash/prj/master/editeng/source/misc/unolingu.cxx:249 #20 0x00007f48006ae4c2 in ImpEditEngine::DoOnlineSpelling(ContentNode*, bool, bool) (this=0x5589de195060, pThisNodeOnly=0x0, bSpellAtCursorPos=false, bInterruptible=true) at /home/ash/prj/master/editeng/source/editeng/impedit4.cxx:2306 #21 0x00007f480067d0d2 in ImpEditEngine::OnlineSpellHdl(Timer*) (this=0x5589de195060) at /home/ash/prj/master/editeng/source/editeng/impedit3.cxx:322 Change-Id: Iffef03502c78311427aa8883739678120cc84931 (cherry picked from commit 4f77bd94028a140133814d735c0425bbd0de4839) Reviewed-on: https://gerrit.libreoffice.org/85007 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit 66c1f6bee6f463786540b2e73d52f35461063589) Reviewed-on: https://gerrit.libreoffice.org/85683 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
* sal_Char->char in comphelperNoel Grandin2019-12-189-20/+20
| | | | | | | Change-Id: I63488463f2255a013cb80a9318d22207cb0ed532 Reviewed-on: https://gerrit.libreoffice.org/85395 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* remove some useless comment linesNoel Grandin2019-12-031-1/+0
| | | | | | | | | which merely announce that the next declaration is a class Change-Id: Ifdb1398bcd99816b13e0b3769b46d0562bfbc1dc Reviewed-on: https://gerrit.libreoffice.org/84229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* Introduce o3tl::optional as an alias for std::optionalStephan Bergmann2019-12-013-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...with a boost::optional fallback for Xcode < 10 (as std::optional is only available starting with Xcode 10 according to <https://en.cppreference.com/w/cpp/compiler_support>, and our baseline for iOS and macOS is still Xcode 9.3 according to README.md). And mechanically rewrite all code to use o3tl::optional instead of boost::optional. One immediate benefit is that disabling -Wmaybe-uninitialized for GCC as per fed7c3deb3f4ec81f78967c2d7f3c4554398cb9d "Slience bogus -Werror=maybe-uninitialized" should no longer be necessary (and whose check happened to no longer trigger for GCC 10 trunk, even though that compiler would still emit bogus -Wmaybe-uninitialized for uses of boost::optional under --enable-optimized, which made me ponder whether this switch from boost::optional to std::optional would be a useful thing to do; I keep that configure.ac check for now, though, and will only remove it in a follow up commit). Another longer-term benefit is that the code is now already in good shape for an eventual switch to std::optional (a switch we would have done anyway once we no longer need to support Xcode < 10). Only desktop/qa/desktop_lib/test_desktop_lib.cxx heavily uses boost::property_tree::ptree::get_child_optional returning boost::optional, so let it keep using boost::optional for now. After a number of preceding commits have paved the way for this change, this commit is completely mechanical, done with > git ls-files -z | grep -vz -e '^bin/find-unneeded-includes$' -e '^configure.ac$' -e '^desktop/qa/desktop_lib/test_desktop_lib.cxx$' -e '^dictionaries$' -e '^external/' -e '^helpcontent2$' -e '^include/IwyuFilter_include.yaml$' -e '^sc/IwyuFilter_sc.yaml$' -e '^solenv/gdb/boost/optional.py$' -e '^solenv/vs/LibreOffice.natvis$' -e '^translations$' -e '\.svg$' | xargs -0 sed -i -E -e 's|\<boost(/optional)?/optional\.hpp\>|o3tl/optional.hxx|g' -e 's/\<boost(\s*)::(\s*)(make_)?optional\>/o3tl\1::\2\3optional/g' -e 's/\<boost(\s*)::(\s*)none\>/o3tl\1::\2nullopt/g' (before committing include/o3tl/optional.hxx, and relying on some GNU features). It excludes some files where mention of boost::optional et al should apparently not be changed (and the sub-repo directory stubs). It turned out that all uses of boost::none across the code base were in combination with boost::optional, so had all to be rewritten as o3tl::nullopt. Change-Id: Ibfd9f4b3d5a8aee6e6eed310b988c4e5ffd8b11b Reviewed-on: https://gerrit.libreoffice.org/84128 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* tdf#118639: store ODF encryption data for autorecoveryMike Kaganski2019-11-291-2/+28
| | | | | | | | | | | | | | | | | When saving autorecovery information, ODF is used. If the original document is password-protected, its autorecovery is also generated password-protected (since ef87ff6680f79362a431db6e7ef2f40cfc576219). But when the stored encryption data for non-ODF document does not contain "PackageSHA256UTF8EncryptionKey" value, following ZipPackage::GetEncryptionKey fails, so the whole save fails. So just generate and append ODF encryption keys where we still have user password. Change-Id: I776e28de784489521e4941d1075690f90c056014 Reviewed-on: https://gerrit.libreoffice.org/84052 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
* cppcheck: performing init in init list (comphelper/connectivity/cppu/cui)Julien Nabet2019-11-231-1/+1
| | | | | | | Change-Id: I786c2c10e8b37b48adf6d619c0fa6a905de1bf7f Reviewed-on: https://gerrit.libreoffice.org/83584 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>