summaryrefslogtreecommitdiff
path: root/unotools
AgeCommit message (Collapse)AuthorFilesLines
2020-05-18officecfg,unotools,cui: add ODF 1.2 Extended / ODF 1.3 versionsMichael Stahl1-0/+4
... to configuration and UI. The new default is ODF 1.3 Extended, which is now ODFVER_LATEST and stored as value "3" in configuration. Adapt a few places related to DocumentDigitalSignatures etc. to new default. Change-Id: I420da4f7787cc864c6bd88470d61b146b9399aa1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93177 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-05-10compact namespace in ucb..uuiNoel Grandin3-4/+4
Change-Id: I644d5e418028b4b4e66cf67b20a1155a689acab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93906 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-07tdf#132796: use LO language settings to set default XLS languageMike Kaganski1-0/+6
This partially reverts fixes for i#63105 and i#71033, i.e. parts of commits 6ca96e7aee937affef218e0bb892e6904f4ef358 and 35777f0b401ba7bee21a24c32739e86598ba608b. Instead of using hard-coded Win-1252 for Excel files by default, use LibreOffice locale language or default document language (as used for old WMF, DXF and RTF files - see 20f6a6b159c69771dc0e087f63b6c701908e32e2, 1a9a77f84cac68bd5374df3e9ee4df88dc87a0ac, and f26bbdb386f9e66b1a154d0589b1a446ea2dd8d5). When a font in XLS specifies ANSI_CHARSET (0), allow using the default encoding, not the corresponding Win-1252. This mimics Excel behaviour for such fonts. Do not use first font's encoding as file default encoding, as Excel doesn't do that. Do not consider font-specified encoding in ImportExcel::Rstring to mimic Excel behaviour for cell number formats (but keep using it in ImportExcel::ReadLabel for cell content). Change-Id: I9860013a1244dc12f06f30c81a67909012c04913 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93612 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-04-27Extract getting default locale for filters into separate unotools functionMike Kaganski2-0/+28
Change-Id: Ic97b1a4507d5629963f360147ecc20eb10f5d391 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92957 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-04-27Make upcasting css::uno::Reference ctor require complete typesStephan Bergmann1-0/+1
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>
2020-04-27Don't convert OUString to char*Mike Kaganski1-105/+87
Change-Id: I3bfcc6fedb782b12be1fb1d42981756287f29f82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92956 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-04-21Fix warning when compiling for iOS: unused parameter 'bCreateParentDirs'Tor Lillqvist1-0/+1
Change-Id: I3d27837ea49ad964a40f53083d90f2a287bae8a0
2020-04-17loplugin:buriedassign in tools..xmloffNoel Grandin2-75/+93
Change-Id: I31df6c4fd82c6f6d15bbe5228e92e5171cacba51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92410 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-17Fix autorecovery using wrong directorySamuel Mehrbrodt1-11/+12
Autorecovery should save in the user profile in the "backup" directory. However, when that directory did not exist, the temp directory was used instead. Fix this, and create the requested directory if it did not exist. Change-Id: Ie298855a740932bc6e6c9f62d4b4bf1b52b80c58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92402 Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2020-03-31Translate German variable namesJohnny_M1-3/+3
Ende -> End Change-Id: Ia3df5ee48e0d61051d99ac93e62c8a6dceafb41d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91218 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2020-03-25Remove unused using declarations in oox...xmlsecurityGabor Kelemen2-3/+0
Found by: run-clang-tidy-10 -checks=-*,misc-unused-using-decls Change-Id: I3e95791e223ef01e140a6217e29a9efae428a784 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90876 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-03-21tdf#128276 Font names are not localized on macOS CatalinaTomofumi Yagi2-4/+23
1. We would like to call CTFontDescriptorCopyLocalizedAttribute function simply. We don't need to compare language settings of LibreOffice UI to OS lang- uage settings. This comparison was a way to save users from confusion, but it was bad idea. Because CTFontDescriptorCopyLocalizedAttribute function before macOS Catalina returns RFC 3066 bis as a language tag, but LibreOffice and macOS Catalina uses BCP 47 as a language tag. CTFontDescriptorCopyLocalizedAttribute function use the language setting for the operating system, therefore Users will change it if needed. 2. Fix font aliases on macOS Catalina I added some entries because I notice that those doesn't working with a Hiragino Sans font alias. Change-Id: Ie05a96f45cba13a19fcc1b855bd908f397e585a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/81145 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-18tdf#131069 always produce utf-8 from gettextCaolán McNamara1-0/+3
Change-Id: I311e647f08b4d541825e7790d971b98b5b5bfe40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90668 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-03-16Revert "loplugin:constfields in unotools..uui"Noel Grandin7-17/+17
This reverts commit d8ac55e3e53564aca4b0bade5a5b5cb01b4519b1. Change-Id: Ib7cf67d5d0b7780dfde9453cdddb8f11ca5d3a6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90542 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-02-27tdf#42982 added description on RuntimeException for unotoolsAlanTang1-4/+4
Change-Id: I528d0bd7408ab9761de2d6fe8e60a5a521dda4dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89414 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins
2020-02-25Fix currency symbol selection in Calc on mobileTomaž Vajngerl1-1/+1
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
2020-02-21Drop o3tl::optional wrapperStephan Bergmann2-5/+5
...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>
2020-02-19use FILE_ATTRIBUTE_TEMPORARY on Windows for temp filesNoel Grandin1-1/+1
which acts as a hint to the OS that these files do not need persistent storage. If there is sufficient system RAM, these files will never even hit disk. Change-Id: I25b83aad67fda58ec39cead8bd1eb038892d3cde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88124 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-02-17inline some acquire/release callsNoel Grandin1-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>
2020-02-12tdf#126700 allow replacing the default documentsJan-Marek Glogowski1-0/+6
Per default, a document opened by a user action will always open in a new frame. For tdf#83722, this behaviour was extended to documents created from templates. But this currently also affects the default factory templates, if these are replaced by a config setting with a real template, which was not intentional. So this patch introduces a new MediaDescriptor property, which allows to mark a document as replaceable and automatically sets it for factory default documents. If this property is set to true, a document just acts as a placeholder while it's unmodified. I.e. the next opened document from its frame will close and replace it. Change-Id: I45ffa8709f7cdda949fac78f3b363f120f0c4a03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88257 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-02-04deb#949754: unotools,officecfg: don't ODF export using ODFVER_UNKNOWNMichael Stahl1-2/+4
The problem was that commit ef39938dea14666a5835b6ae85091c1010f8ae8d temporarily added ODF 1.3 version strings to the optsavepage.ui, just to get translations for them; unfortunately the dialog itself was not adapted to the new values, so when you select them the result is 0, or ODFVER_UNKNOWN... fortunately this was reverted before 6.4.0.3. The value ODFVER_UNKNOWN is very dubious and without an obvious purpose; http://specs.openoffice.org/appwide/odf/odf_1-2_migration.odt mentions it but provides no details. Hence let's interpret it the same as ODFVER_LATEST for export purposes. Also add the value ODFVER_012_EXT_COMPAT to the configuration, because this is actually used. Also fix a copypasta in SvtSaveOptions_Impl::IsReadOnly(), where the wrong flag is checked for OdfDefaultVersion. Change-Id: Ie276f0ef3cead3ffa016ba939aede74581fb0257 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87900 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-01-28New loplugin:unsignedcompareStephan Bergmann4-4/+8
"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>
2020-01-25tdf#130137 Replace remaining uses of WNT define checks with _WIN32A_GAN1-2/+2
Change-Id: If95f1ea5a81de62eb4f725e5fcb30ccb8530062a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87372 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-01-24loplugin:makeshared in svgio..writerperfectNoel Grandin2-3/+3
Change-Id: I0f8de0f78c7a8fb78d47ee5dfed09019b4eb5288 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87357 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-24use osl::Guard instead of abusing rtl::ReferenceNoel Grandin1-1/+1
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>
2020-01-21Make TempFile destructor remove temp directory recursivelySamuel Mehrbrodt1-2/+2
Change-Id: Idcfa93ffe86112477ad81bcbf74b8e5b858423f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87080 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2020-01-18fix unotools/source/i18n/resmgr.cxx build with PCH on MacLuboš Luňák1-1/+6
When a PCH is used, those #defines come too late if they are in the source file, set them using the command line. Change-Id: I361503db7c9e51c2cf5fdcdda2861d1377b81fa5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87020 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-15convert OSL_ASSERT to assertNoel Grandin1-1/+2
and fix the one place triggering it Change-Id: I87ec57c6a92ed89fdacfcb0d650525eaeaa266b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86822 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-01android: Use correct path for the .mo resource files.Jan Holesovsky1-0/+8
They are read by boost::locale, so we cannot have them as normal assets, instead we have to have them in asset's 'unpack', so that they are unpacked to the filesystem and can be read as normal files. Change-Id: I5e902ee4b5294d1f693f51993b8bc2069f1c835a Reviewed-on: https://gerrit.libreoffice.org/85442 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85458 Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-12-26use more TOOLS_WARN_EXCEPTIONNoel Grandin2-3/+5
so we get more useful log messages when stuff goes wrong Change-Id: Ia55db7ab1a4d79b0f281673fbbb06c61745fa89e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85829 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-24sal_Char->char in unoxmlNoel Grandin6-7/+7
Change-Id: Ie14ea8349e5dc698a11b3447429b3ca7cbab9bb3 Reviewed-on: https://gerrit.libreoffice.org/85774 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-17loplugin:expandablemethodsNoel Grandin1-1/+1
Change-Id: Ifc269d9996928085a3ab78033788465b4f029368 Reviewed-on: https://gerrit.libreoffice.org/85255 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-03remove some useless comment linesNoel Grandin1-2/+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>
2019-12-01Introduce o3tl::optional as an alias for std::optionalStephan Bergmann2-5/+5
...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>
2019-12-01boost::optional: replace uses of get_value_or with value_orStephan Bergmann1-1/+1
...in preparation for wholesale replacement of boost::optional with o3tl::optional, which will be an alias for either std::optional or boost::optional, and std::optional only has value_or. boost::optional::value_or was added with <https://github.com/boostorg/optional/ commit/3984c9f9a157ef116cea69bc8bb20f433320eb61> "Added function value_or()", which according to git-describe first appeared in tag boost-1.56.0. We appear to have no strict Boost baseline (the closest we get is with > [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)] in configure.ac), and at least CentOS 7 TDF machine tb76 only has boost-devel-1.53.0-27.el7.x86_64. However, any environment using Xcode < 10 that needs to make o3tl::optional fall back to boost::optional should use --without-system-boost, and external/boost is currently at 1.69.0, so should be safe. ATTENTION: In isolation, this commit will break in any environment that uses Boost older than 1.56.0. It requires the following commit introducing o3tl::optional. (But doing these changes in individual commits was deemed more valuable than supporting a hypothetical future git-bisect against an old Boost.) Change-Id: Ib31affa3eebf0d0029d8620dc6abb7a60f6c7629 Reviewed-on: https://gerrit.libreoffice.org/84127 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann16-2/+117
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend loplugin:external to warn about enums". Cases where free functions were moved into an unnamed namespace along with a class, to not break ADL, are in: filter/source/svg/svgexport.cxx sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xilink.cxx svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx All other free functions mentioning moved classes appear to be harmless and not give rise to (silent, even) ADL breakage. (One remaining TODO in compilerplugins/clang/external.cxx is that derived classes are not covered by computeAffectedTypes, even though they could also be affected by ADL-breakage--- but don't seem to be in any acutal case across the code base.) For friend declarations using elaborate type specifiers, like class C1 {}; class C2 { friend class C1; }; * If C2 (but not C1) is moved into an unnamed namespace, the friend declaration must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither qualified nor a template-id and the declaration is a function or an elaborated-type-specifier, the lookup to determine whether the entity has been previously declared shall not consider any scopes outside the innermost enclosing namespace.") * If C1 (but not C2) is moved into an unnamed namespace, the friend declaration must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882> "elaborated-type-specifier friend not looked up in unnamed namespace". Apart from that, to keep changes simple and mostly mechanical (which should help avoid regressions), out-of-line definitions of class members have been left in the enclosing (named) namespace. But explicit specializations of class templates had to be moved into the unnamed namespace to appease <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of template from unnamed namespace using unqualified-id in enclosing namespace". Also, accompanying declarations (of e.g. typedefs or static variables) that could arguably be moved into the unnamed namespace too have been left alone. And in some cases, mention of affected types in blacklists in other loplugins needed to be adapted. And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is not moved into an unnamed namespace (because it is declared in sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler doesn’t give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions." (<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The warned-about classes also don't have multiple definitions in the given test, so disable the warning when including the .cxx. Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4 Reviewed-on: https://gerrit.libreoffice.org/83239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-20tdf#128434 free the BasicManager event listenerJan-Marek Glogowski1-2/+1
This gets rid of the last 72 lost bytes I could identify in the huge valgrind logs to look like its PDF generation related. Change-Id: Idda3c2c5b7f5ce0211199b86503037b74438ccf2 Reviewed-on: https://gerrit.libreoffice.org/83302 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-11-17Extend loplugin:external to warn about enumsStephan Bergmann3-0/+13
To mitigate the dangers of silently breaking ADL when moving enums into unnamed namespaces (see the commit message of 206b5b2661be37efdff3c6aedb6f248c4636be79 "New loplugin:external"), note all functions that are affected. (The plan is to extend loplugin:external further to also warn about classes and class templates, and the code to identify affected functions already takes that into account, so some parts of that code are not actually relevant for enums.) But it appears that none of the functions that are actually affected by the changes in this commit relied on being found through ADL, so no adaptions were necessary for them. (clang::DeclContext::collectAllContexts is non-const, which recursively means that External's Visit... functions must take non-const Decl*. Which required compilerplugins/clang/sharedvisitor/analyzer.cxx to be generalized to support such Visit... functions with non-const Decl* parameters.) Change-Id: Ia215291402bf850d43defdab3cff4db5b270d1bd Reviewed-on: https://gerrit.libreoffice.org/83001 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-06loplugin:indentation find broken if statementsNoel Grandin1-16/+16
so I don't read the "then" block as being a sequential statements Change-Id: Ib2004acd3518bd4ebd2246f02a26c2c0a8bbab4c Reviewed-on: https://gerrit.libreoffice.org/82069 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-03size some stringbuffer to prevent re-allocNoel Grandin2-2/+2
I started with 32 and kept doubling the size until the site did not need re-alloc, but clamped it at 512. Change-Id: I55fe36b31cd3d40f86e5729337a927cf920f2af6 Reviewed-on: https://gerrit.libreoffice.org/81960 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-21size some stringbuffer to prevent re-allocNoel Grandin1-1/+1
found by the simple expidient of putting asserts in the resize routine. Where an explicit const size is used, I started with 32 and kept doubling until that site did not need resizing anymore. Change-Id: I998787edc940d0a3ba23b5ac37131ab9ecd300f4 Reviewed-on: https://gerrit.libreoffice.org/81138 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-19Replace some uses of OUStringChar with string literalsStephan Bergmann1-2/+2
Change-Id: I763f9a3f57efcd47643ca4651e2454e95c6921c9 Reviewed-on: https://gerrit.libreoffice.org/81127 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-19loplugin:unusedmethodsNoel Grandin1-6/+0
Change-Id: I95e63105654952d12c1dfd62f51593de114be569 Reviewed-on: https://gerrit.libreoffice.org/81077 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-18make bin/update_pch.s always include code in trivial #if'sLuboš Luňák1-25/+4
E.g. #ifdef LIBO_INTERNAL_ONLY is always true for code that builds with our PCHs. Change-Id: I3cf311ea3621b909105754cfea2cb0116b8b67f5 Reviewed-on: https://gerrit.libreoffice.org/80961 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-17Remaining loplugin:bufferaddStephan Bergmann3-18/+3
...that had been missing because the plugin didn't implement postRun, so it didn't report anything when run as part of the shared plugin. (But did report the expected warnings when run as a standalone plugin during CompilerTest_compilerplugins_clang.) Most fixes are straightforward. A noteworthy one is PreparedStatement::setBytes in connectivity/source/drivers/postgresql/pq_preparedstatement.cxx: The old preallocation of a 20 character OStringBuffer might have prevented buf.append( reinterpret_cast<char *>(escapedString), len -1 ); from potentially throwing std::bad_alloc, which would have caused escapedString to be leaked. Even though that 20-character preallocation was likely just random junk and not meant to address the potential leak, lets address it now. Change-Id: Ib506332d061684a22a74e5e39e591539fd2c4900 Reviewed-on: https://gerrit.libreoffice.org/80925 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-17Rename OUStringLiteral1 to OUStringCharStephan Bergmann3-8/+8
It started out as a wrapper around character literals, but has by now become a wrapper around arbitrary single characters. Besides updating the documentation, this change is a mechanical for i in $(git grep -Fl OUStringLiteral1); do sed -i -e s/OUStringLiteral1/OUStringChar/g "$i"; done Change-Id: I1b9eaa4b3fbc9025ce4a4bffea3db1c16188b76f Reviewed-on: https://gerrit.libreoffice.org/80892 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-15new loplugin:bufferaddNoel Grandin1-3/+3
look for OUStringBuffer append sequences that can be turned into creating an OUString with + operations Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6 Reviewed-on: https://gerrit.libreoffice.org/80809 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-14loplugin:stringadd look for unnecessary temporariesNoel Grandin1-1/+1
which defeat the *StringConcat optimisation. Also make StringConcat conversions treat a nullptr as an empty string, to match the O*String(char*) constructors. Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b Reviewed-on: https://gerrit.libreoffice.org/80724 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-14Add document-level option to lock down content extractionSamuel Mehrbrodt1-0/+6
Setting this option will prevent copying/dragging any content from LO to another program or even another LO window. Change-Id: Ifbc032a4fa69ac1a17d4b500f5a30f5399d84ed7 Reviewed-on: https://gerrit.libreoffice.org/80586 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2019-10-02loplugin:stringadd in tools..unotoolsNoel Grandin2-9/+3
Change-Id: I441a5ccef6adc8be8029178e304ff3044e812e2a Reviewed-on: https://gerrit.libreoffice.org/79986 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>