Commit Graph
1042 Commits
Author SHA1 Message Date
Noel Grandin 9b0202bf43 loplugin:stringliteraldefine in xmloff
Change-Id: I9216c18d3ba4a4a528a49198fdfe547a66c06b6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126284
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-03 17:58:24 +01:00
Noel Grandin 5fe5ded723 simplify construction of XMLPropertyMapEntry
so we don't have to pass in the size of the string literal.

This is mostly a preparatory change, to make an another
patch of mine less noisy.

Change-Id: Idafcd68586b8b465e63dc89e4a4180d2e70ac3a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125080
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-12 10:55:07 +01:00
Mike Kaganski 8cb57be792 Prepare for removal of non-const operator[] from Sequence in xmloff
Change-Id: I7ea7964f76f0a5db678510ac3533003726dc49fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124416
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-01 07:11:36 +01:00
Mike Kaganski 2484de6728 Remove non-const Sequence::begin()/end() in internal code
... to avoid hidden cost of multiple COW checks, because they
call getArray() internally.
This obsoletes [loplugin:sequenceloop].

Also rename toNonConstRange to asNonConstRange, to reflect that
the result is a view of the sequence, not an independent object.

TODO: also drop non-const operator[], but introduce operator[]
in SequenceRange.

Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-15 10:36:36 +02:00
Mike Kaganski 8a017d25a6 Avoid COW overhead using css::uno::Sequence
The scenarios are:

1. Calling sequence's begin() and end() in pairs to pass to algorithms
   (both calls use getArray(), which does the COW checks)
2. In addition to #1, calling end() again when checking result of find
   algorithms, and/or begin() to calculate result's distance
3. Using non-const sequences in range-based for loops, which internally
   do #1
4. Assigning sequence to another sequence variable, and then modifying
   one of them

In many cases, the sequences could be made const, or treated as const
for the purposes of the algorithms (using std::as_const, std::cbegin,
and std::cend). Where algorithm modifies the sequence, it was changed
to only call getArray() once. For that, css::uno::toNonConstRange was
introduced, which returns a struct (sublclass of std::pair) with two
iterators [begin, end], that are calculated using one call to begin()
and one call to getLength().

To handle #4, css::uno::Sequence::swap was introduced, that swaps the
internal pointer to uno_Sequence. So when a local Sequence variable
should be assigned to another variable, and the latter will be modified
further, it's now possible to use swap instead, so the two sequences
are kept independent.

The modified places were found by temporarily removing non-const end().

Change-Id: I8fe2787f200eecb70744e8b77fbdf7a49653f628
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123542
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-14 06:00:49 +02:00
Noel Grandin f67392948d loplugin:moveparam in xmloff
Change-Id: I46c1c8dc46cd2b8470b69506f6609f8bd7e42211
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123347
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-10 21:03:18 +02:00
Mike Kaganski 4d82c1d8a3 Simplify SvXMLExport::AddAttribute overloads
Remove overloads taking const char* which were not needed, because
every their use eventually took a string literal convertible to
OUString directly.

Many other literals were converted to OUStringLiterals.

Change-Id: Ia1e742a8087776cd20bf5094dc415dafd9a8834a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123155
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-09 07:08:24 +02:00
Noel Grandin 0d56337387 clang-tidy:clang-analyzer-optin.performance.Padding
noting that XMLTokenEnum was already being treated as being limited to
32-bits, we bitmask it together with namespaces

Change-Id: Ic48f2a662452d1b8e022078d31a723d2ac65aef0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121707
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-06 11:58:09 +02:00
Stephan Bergmann 2bc1a0431b New loplugin:unusedcapturedefault
In sc/qa/unit/ucalc_formula.cxx, dropping the capture-default from the
lExpectedinF lambda revealed that MSVC in C++17 mode (i.e., when building
without --with-latest-c++) requires ROW_RANGE (a local const int variable from
the enclosing TestFormula::testTdf97369) to be captured, even though all uses of
that variable within the lambda body are constant expressions.  That is still
true at least for the latest Visual Studio 2019 version 16.11.1.  (This is not
an issue for the lExpectedinH and lExpectedinI lambdas a few lines further down,
as they, in addition to using that ROW_RANGE, also use the local const double
variables SHIFT1 and SHIFT2, whose uses are not constant expressions, so
they are implicitly captured and loplugin:unusedcapturedefault does not suggest
dropping those lambdas' capture-defaults in the first place.)

Change-Id: Iee7efb485187cbe8eba6a2d470afca4993eb1816
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120693
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-08-20 14:25:38 +02:00
Noel Grandin 303aa36685 unordered_map is better for pointer keys
Change-Id: Iaef42c9cc3526d1daa9ad6aaa840ea5a449173be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119816
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-01 20:06:40 +02:00
Noel Grandin 5678db6ff2 o3tl::sorted_vector is better for small sets of pointers
Change-Id: Ice284159b1666d930903eb53315e8a3c777c2a16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119815
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-01 20:06:21 +02:00
Stephan Bergmann af16aa6256 Improve loplugin:stringview
Issue the "instead of O[U]String, pass [u16]string_view" diagnostic also for
operator call arguments.  (The "rather than copy, pass subView()" diagnostic is
already part of handleSubExprThatCouldBeView, so no need to repeat it explicitly
for operator call arguments.)

(And many call sites don't even require an explicit [u16]string_view, esp. with
the recent ad48b2b02f "Optimized OString operator
+= overloads".  Just some test code in sal/qa/ that explicitly tests the
O[U]String functionality had to be excluded.)

Change-Id: I8d55ba5a7fa16a563f5ffe43d245125c88c793bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115589
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-14 13:11:50 +02:00
Tomaž Vajngerl eb6819e74a change usage of boost::hash_combine to o3tl::hash_combine
Change-Id: I840518a36ac43d36c95f38e09c7bfcfe1a25a525
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114984
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-05-11 12:28:24 +02:00
Michael Stahl 16de54a5c4 tdf#138209 ODF export: work around forms problem in LO < 7.0
LO without commit 519d96fd8b makes a mess
when storing form documents it has loaded from ODF 1.3 documents: the
XML parts are stored as ODF 1.2, but the storage (and therefore manifest
entry) keeps version 1.3.

To avoid this, store form documents as ODF 1.2 extended by default.

Unfortunately a bunch of ODF export code accesses the global
SvtSaveOptions variable; with this version override, only
SvXMLExport::getSaneDefaultVersion() must be used.

Change-Id: I5fa8e286f5103c578ed0d93da07a8a6cbe2f0ddd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115357
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-05-10 21:07:40 +02:00
Noel Grandin c7c6f0af6c loplugin:stringadd convert chained append to +
which can use the more efficient *StringConcat

Also fix a crash in stringview plugin which
started happening while I working on this.

Change-Id: I91a5b9b7707d1594d27d80b73930f5afac8ae608
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114568
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-27 14:07:56 +02:00
Noel Grandin 75997f13ee no need to create temporaries when appending number to O[U]StringBuffer
Change-Id: I36d82423b5f75010552696a66cec7e53ee265ce4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114395
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-22 21:42:14 +02:00
Noel eab3fa1f37 loplugin:unusedvarsglobal
Change-Id: Ie73c8bec0196c680311b0959f3a17c3af900ce88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113084
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-25 14:13:12 +01:00
Vincent LE GARREC aef40e7388 tdf#124176 Use pragma once in x*
xmlhelp, xmloff, xmlsecurity

Change-Id: I80c6fa806387f3dcba8be7f93fe2fef146b033e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112050
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2021-03-23 13:14:42 +01:00
Noel Grandin 67db5b7c8d tdf#140486 forms "empty string is null" setting not loaded
regression from
    commit 3de38e9556
    Date:   Tue Nov 10 19:20:06 2020 +0200
    use fastparser in forms

Change-Id: I1e679bdca17185f20c1f755da16f02aa5661e22f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111123
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-18 17:34:07 +01:00
Noel Grandin 63d14566ba tdf#140198 Base text field will not retain multi-line setting
regression due to a combination of
    commit 3de38e9556
    Date:   Tue Nov 10 19:20:06 2020 +0200
    use fastparser in forms
and
    commit 3d00847709
    Date:   Fri Dec 4 16:14:16 2020 +0200
    fastparser in a couple of random places
The first one introduced the bug, due to the fallback
paths from fast to slowparser, things kept working, until
the second one removed the fallback.

Change-Id: I1aaae902eda2aaf8f5151404ddb3577f4582757d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111101
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-18 12:08:23 +01:00
Noel 7943752b9e loplugin:referencecasting in xmloff
Change-Id: Ib601b7045d773ab612569a8fd00d76545dea13af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111055
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-17 13:15:11 +01:00
Caolán McNamara ac396f2f6b fix coverity parse errors
Change-Id: I3a1179947704452e3ffec02be59d0f7bf0b75ab0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109017
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-09 13:01:49 +01:00
Stephan Bergmann a3d0091d18 New loplugin:stringliteralvar
See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for
details.

(Turned some affected variables in included files into inline variables, to
avoid GCC warnings about unused variables.)

Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-26 14:51:15 +01:00
Noel 917338c6a8 use std::u16string_view in SvXMLTokenEnumerator
Change-Id: I1194441063047637adc20c8e37bb717fdb787714
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108073
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-21 11:34:17 +01:00
Noel Grandin 46c5de8328 make *String(string_view) constructors explicit
to make it more obvious when we are constructing heap OUStrings
code and potentially inadvertently throwing away performance.

And fix a handful of places so revealed.

Change-Id: I0cf390f78026f8a670aaab53424cd31510633051
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107923
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-19 17:53:06 +01:00
Julien Nabet e7fb2c18e9 Get rid of wrong warning in propertyexport (forms)
Create a brand new odt file, add an image with form Control then save
You'll notice this on console:
warn:legacy.osl:20299:20299:xmloff/source/forms/propertyexport.cxx:680: OPropertyExport::dbg_implCheckProperty: invalid property type!

it's wrong since most of the type the exported property should be a OUString (internal "string")
but it may also be a graphic::XGraphic and this case isn't dealt by DBG_CHECK_PROPERTY
since we only gave it "OUString()"

Change-Id: I268b8d5f79c84ea73acdac245ee1705ddd009ae9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107653
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-12-13 16:48:48 +01:00
Noel b541cd9a80 loplugin:unusedmethods
Change-Id: Ib51fd610c5188fe95872d509f004ae88f38c5417
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107351
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-07 16:59:28 +01:00
Noel 3d00847709 fastparser in a couple of random places
Change-Id: I9c88c826cfffa71f389f78f9d18d46e097e540ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107217
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-04 17:39:12 +01:00
Noel bea9187bb4 fastparser in propertyimport
Change-Id: I6922594367050e5aab4b3c0fa0b38dbd6fcd206c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106867
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-30 18:38:06 +01:00
Noel Grandin 3faf503b1a tdf#138507 error in loading form
regression from
    commit 3de38e9556
    Author: Noel Grandin <noelgrandin@gmail.com>
    Date:   Tue Nov 10 19:20:06 2020 +0200
    use fastparser in forms

Change-Id: I995677d4e381e8229e7f052cf54a134bdf49d378
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106708
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-27 08:05:58 +01:00
Noel bb06f51308 loplugin:stringviewparam extend to comparison operators
which means that some call sites have to change to use
unicode string literals i.e. u"foo" instead of "foo"

Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-24 09:45:04 +01:00
Noel 46aaf4e4e6 fastparser in forms
Change-Id: Ia5274bf6c200a5077bc9b7fdf16b7723337d353d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106165
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-19 19:31:17 +01:00
Philipp Hofer c927d6daa9 tdf#123936 Formatting files in module xmloff with clang-format
Change-Id: I4d9016a0e646da5d9f0044762f6ecce86ce1242b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105732
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-19 19:25:20 +01:00
Julien Nabet ef7abc0dc8 Fix SAL_WARN_IF in elementimport (xmloff)
Wrong from:
2012-05-17 5e0b52c189
-                    (0 == _rPropValue.Name.compareToAscii(PROPERTY_EFFECTIVE_VALUE))
-                ||  (0 == _rPropValue.Name.compareToAscii(PROPERTY_EFFECTIVE_DEFAULT)),
+                    (0 == _rPropValue.Name.equalsAsciiL(PROPERTY_EFFECTIVE_VALUE.ascii, PROPERTY_EFFECTIVE_VALUE.length))
+                ||  (0 == _rPropValue.Name.equalsAsciiL(PROPERTY_EFFECTIVE_DEFAULT.ascii, PROPERTY_EFFECTIVE_DEFAULT.length)),
since '"compareToAscii" returned 0 if both strings are equal'
whereas "equalsAsciiL" returned sal_Bool (so sal_True if both strings equal)

there have been different changes during some years.
But c2d808a5dd (2019-02-01) did also wrongly this:
-            OSL_ENSURE(
-                    _rPropValue.Name != PROPERTY_EFFECTIVE_VALUE
-                &&  _rPropValue.Name != PROPERTY_EFFECTIVE_DEFAULT,
-                "OControlImport::implTranslateValueProperty: invalid property type/name combination!");
+            SAL_WARN_IF(
+                    _rPropValue.Name == PROPERTY_EFFECTIVE_VALUE
+                ||  _rPropValue.Name == PROPERTY_EFFECTIVE_DEFAULT, "xmloff",
+                "OControlImport::implTranslateValueProperty: invalid property type/name combination, Any and " + _rPropValue.Name);

Indeed the comment (which has never changed since 2001) above indicates:
"we have exactly 2 properties where this type class is allowed"

In brief, we want to warn if "_rPropValue.Name" different from "PROPERTY_EFFECTIVE_VALUE" and "PROPERTY_EFFECTIVE_DEFAULT"

Change-Id: I576b2af2eaf96c53ae7950b352239ce1510ff03c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106080
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2020-11-19 12:17:06 +01:00
Julien Nabet acf7d8d1ab Avoid wrong warning in OElementImport::implApplyGenericProperties (xmloff)
When empty sequence, there's nothing to convert so no need to spend time here and
to indicate the following warning:
Avoid warn:legacy.osl:93722:93722:xmloff/source/forms/elementimport.cxx:364:
OElementImport::implApplyGenericProperties: conversion to sequences other than 'sequence< short >' not implemented, yet!

+ avoid these in the same time:
warn:xmloff.forms:88800:88800:xmloff/source/forms/elementimport.cxx:428: DBG_UNHANDLED_EXCEPTION in implApplyGenericProperties
exception: com.sun.star.lang.IllegalArgumentException message:
/home/julien/lo/libreoffice/include/cppuhelper/proptypehlp.hxx:35 ArgumentPosition: 0

In addition, convert 2 OSL_ENSURE of this block in SAL_WARN_IF

Change-Id: I047eb5afba6fd22249010791aa61ebd1f83f3c67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106082
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-19 10:17:42 +01:00
Noel 8ef6067596 loplugin:stringviewparam check methods too
not just functions

Change-Id: Icca295dd159002b428b73f2c95d40725434f04d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105789
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-17 09:57:35 +01:00
Noel d52f83c7db tdf#138144 Form wizard fails to save
fallout from
    commit 3de38e9556
    Date:   Tue Nov 10 19:20:06 2020 +0200
    use fastparser in forms

Change-Id: I4691786525132ef0cf98b6b177a2c022c4d7d032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105932
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-16 18:07:50 +01:00
Noel d9f0e8db9a loplugin:unusedmethods
Change-Id: I90d402a5c18ab16424a042bcea1470fa8a3a5839
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105629
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-12 16:54:19 +01:00
Noel Grandin 3de38e9556 use fastparser in forms
Change-Id: I7d09d64857e24267b4b4baddb563e28ceea92f2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105560
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-11 06:33:53 +01:00
Mike Kaganski 8ba9ecaaad Fix Windows build with --disable-pch
[build CXX] xmloff/source/forms/formlayerimport.cxx
C:\lo\src\core\include\cppu/unotype.hxx(296): error C2665: 'com::sun::star::beans::cppu_detail_getUnoType': none of the 28 overloads could convert all the argum
ent types
C:\lo\src\build\workdir\UnoApiHeadersTarget\udkapi\normal\com/sun/star/beans/XVetoableChangeListener.hpp(56): note: could be 'const com::sun::star::uno::Type &c
om::sun::star::beans::cppu_detail_getUnoType(const com::sun::star::beans::XVetoableChangeListener *)' [found using argument-dependent lookup]
C:\lo\src\build\workdir\UnoApiHeadersTarget\udkapi\normal\com/sun/star/beans/XPropertySetInfo.hpp(69): note: or       'const com::sun::star::uno::Type &com::sun
::star::beans::cppu_detail_getUnoType(const com::sun::star::beans::XPropertySetInfo *)' [found using argument-dependent lookup]
C:\lo\src\build\workdir\UnoApiHeadersTarget\udkapi\normal\com/sun/star/beans/Property.hpp(81): note: or       'const com::sun::star::uno::Type &com::sun::star::
beans::cppu_detail_getUnoType(const com::sun::star::beans::Property *)' [found using argument-dependent lookup]
C:\lo\src\build\workdir\UnoApiHeadersTarget\udkapi\normal\com/sun/star/beans/XPropertyChangeListener.hpp(55): note: or       'const com::sun::star::uno::Type &c
om::sun::star::beans::cppu_detail_getUnoType(const com::sun::star::beans::XPropertyChangeListener *)' [found using argument-dependent lookup]
C:\lo\src\build\workdir\UnoApiHeadersTarget\udkapi\normal\com/sun/star/beans/PropertyChangeEvent.hpp(92): note: or       'const com::sun::star::uno::Type &com::
sun::star::beans::cppu_detail_getUnoType(const com::sun::star::beans::PropertyChangeEvent *)' [found using argument-dependent lookup]
C:\lo\src\build\workdir\UnoApiHeadersTarget\udkapi\normal\com/sun/star/beans/UnknownPropertyException.hpp(54): note: or       'const com::sun::star::uno::Type &
com::sun::star::beans::cppu_detail_getUnoType(const com::sun::star::beans::UnknownPropertyException *)' [found using argument-dependent lookup]
C:\lo\src\build\workdir\UnoApiHeadersTarget\udkapi\normal\com/sun/star/beans/PropertyVetoException.hpp(54): note: or       'const com::sun::star::uno::Type &com
::sun::star::beans::cppu_detail_getUnoType(const com::sun::star::beans::PropertyVetoException *)' [found using argument-dependent lookup]
C:\lo\src\build\workdir\UnoApiHeadersTarget\udkapi\normal\com/sun/star/beans/XPropertySet.hpp(93): note: or       'const com::sun::star::uno::Type &com::sun::st
ar::beans::cppu_detail_getUnoType(const com::sun::star::beans::XPropertySet *)' [found using argument-dependent lookup]
C:\lo\src\core\include\cppu/unotype.hxx(249): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const com::sun::star::uno::X
Interface *)'
C:\lo\src\core\include\cppu/unotype.hxx(243): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const com::sun::star::uno::E
xception *)'
C:\lo\src\core\include\cppu/unotype.hxx(217): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const com::sun::star::uno::A
ny *)'
C:\lo\src\core\include\cppu/unotype.hxx(211): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const com::sun::star::uno::T
ype *)'
C:\lo\src\core\include\cppu/unotype.hxx(206): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const rtl::OUString *)'
C:\lo\src\core\include\cppu/unotype.hxx(200): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const sal_Unicode *)'
C:\lo\src\core\include\cppu/unotype.hxx(193): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const cppu::UnoCharType *)'
C:\lo\src\core\include\cppu/unotype.hxx(188): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const double *)'
C:\lo\src\core\include\cppu/unotype.hxx(183): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const float *)'
C:\lo\src\core\include\cppu/unotype.hxx(177): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const sal_uInt64 *)'
C:\lo\src\core\include\cppu/unotype.hxx(172): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const sal_Int64 *)'
C:\lo\src\core\include\cppu/unotype.hxx(166): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const sal_uInt32 *)'
C:\lo\src\core\include\cppu/unotype.hxx(161): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const sal_Int32 *)'
C:\lo\src\core\include\cppu/unotype.hxx(155): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const sal_uInt16 *)'
C:\lo\src\core\include\cppu/unotype.hxx(145): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const cppu::UnoUnsignedShort
Type *)'
C:\lo\src\core\include\cppu/unotype.hxx(140): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const sal_Int16 *)'
C:\lo\src\core\include\cppu/unotype.hxx(135): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const sal_Int8 *)'
C:\lo\src\core\include\cppu/unotype.hxx(130): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const sal_Bool *)'
C:\lo\src\core\include\cppu/unotype.hxx(125): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const bool *)'
C:\lo\src\core\include\cppu/unotype.hxx(120): note: or       'const com::sun::star::uno::Type &cppu::detail::cppu_detail_getUnoType(const cppu::UnoVoidType *)'
C:\lo\src\core\include\cppu/unotype.hxx(296): note: while trying to match the argument list '(T1 *)'
C:\lo\src\core\include\cppu/unotype.hxx(288): note: while compiling class template member function 'const com::sun::star::uno::Type &cppu::UnoType<T>::get(void)
'
with
[
T=com::sun::star::beans::PropertyValue
]
C:\lo\src\core\include\cppu/unotype.hxx(321): note: see reference to function template instantiation 'const com::sun::star::uno::Type &cppu::UnoType<T>::get(voi
d)' being compiled
with
[
T=com::sun::star::beans::PropertyValue
]
C:\lo\src\core\include\cppu/unotype.hxx(321): note: see reference to class template instantiation 'cppu::UnoType<T>' being compiled
with
[
T=com::sun::star::beans::PropertyValue
]
C:\lo\src\core\include\com/sun/star/uno/Sequence.hxx(291): note: see reference to function template instantiation 'const com::sun::star::uno::Type &cppu::getTyp
eFavourUnsigned<com::sun::star::beans::PropertyValue>(const T *)' being compiled
with
[
T=com::sun::star::beans::PropertyValue
]
C:\lo\src\core\include\com/sun/star/uno/Sequence.hxx(117): note: see reference to function template instantiation 'const com::sun::star::uno::Type &cppu::getTyp
eFavourUnsigned<com::sun::star::beans::PropertyValue>(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> *)' being compiled
C:\lo\src\core\include\com/sun/star/uno/Sequence.hxx(114): note: while compiling class template member function 'com::sun::star::uno::Sequence<com::sun::star::b
eans::PropertyValue>::~Sequence(void)'
C:/lo/src/core/xmloff/source/forms/formlayerimport.cxx(89): note: see reference to function template instantiation 'com::sun::star::uno::Sequence<com::sun::star
::beans::PropertyValue>::~Sequence(void)' being compiled
make[1]: *** [C:/lo/src/core/solenv/gbuild/LinkTarget.mk:301: C:/lo/src/build/workdir/CxxObject/xmloff/source/forms/formlayerimport.o] Error 2

Change-Id: Ib75f2da6393a7ba4aa1660bdf872dc4bf0fb796c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105478
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2020-11-09 14:28:05 +01:00
Noel 3940cf7d71 drop the SvXMLExport::EndElement method..
in favour of just using the endFastElement() method

Change-Id: Id95abb0b9e78bc44278c5e9e3cc8dee15185e2e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105175
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-02 17:08:47 +01:00
Noel 2764c334c3 drop the SvXMLExport::Characters method..
in favour of just using the characters() method

Change-Id: Iecb2773d488fcf4fa3c2202d0e889015a288fe2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105174
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-02 14:11:49 +01:00
Noel 8c5ffecf1d make SvXMLImport capable of mixing fast- and slow- contexts adhoc
so I can convert even *ImportContext subclasses in the middle of
a context stack, and thus break the cyclic dependency nature
of the writer import.

and adjust the xmlimport loplugin for the new rules.

As a consequence of the loplugin:xmlimport's checking, we remove
a bunch of now unnecessary overrides of startFastElement.

Change-Id: I97464522ede8ec5e345e928cdafa4b18364b1b80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104730
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-02 08:17:00 +01:00
Noel Grandin 917401207e std::set->o3tl::sorted_vector in xmloff
Change-Id: Iba07a9905f37c2fb00d59ac00703744e5f81b1c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104906
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-28 07:22:35 +01:00
Mike Kaganski 835dfcbbe5 use more TOOLS_WARN_EXCEPTION
Change-Id: Iaa8f006526be2b16767f34ac0d7cd567314a50e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103908
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-10-04 11:52:34 +02:00
Noel 7bd7ff5a8d loplugin:reducevarscope in xmloff
Change-Id: Ib67311f84a6a7a490afb392e642d74693fde3113
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103747
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-01 12:23:08 +02:00
Stephan Bergmann e6dfaf9f44 Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uString
...from which an OUString can cheaply be instantiated.  This is the OUString
equivalent of 4b9e440c51 "Turn OStringLiteral into
a consteval'ed, static-refcound rtl_String".  Most remarks about that commit
apply here too (this commit is just substantially bigger and a bit more
complicated because there were so much more uses of OUStringLiteral than of
OStringLiteral):

The one downside is that OUStringLiteral now needs to be a template abstracting
over the string length.  But any uses for which that is a problem (e.g., as the
element type of a container that would no longer be homogeneous, or in the
signature of a function that shall not be turned into a template for one reason
or another) can be replaced with std::u16string_view, without loss of efficiency
compared to the original OUStringLiteral, and without loss of expressivity.

The new OUStringLiteral ctor code would probably not be very efficient if it
were ever executed at runtime, but it is intended to be only executed at compile
time.  Where available, C++20 "consteval" is used to statically ensure that.

The intended use of the new OUStringLiteral is in all cases where an
object that shall itself not be an OUString (e.g., because it shall be a
global static variable for which the OUString ctor/dtor would be detrimental at
library load/unload) must be converted to an OUString instance in at least one
place.  Other string literal abstractions could use std::u16string_view (or just
plain char16_t const[N]), but interestingly OUStringLiteral might be more
efficient than constexpr std::u16string_view even for such cases, as it should
not need any relocations at library load time.  For now, no existing uses of
OUStringLiteral have been changed to some other abstraction (unless technically
necessary as discussed above), and no additional places that would benefit from
OUStringLiteral have been changed to use it.

Global constexpr OUStringLiteral variables defined in an included file would be
somewhat suboptimal, as each translation unit that uses them would create its
own, unshared instance.  The envisioned solution is to turn them into static
data members of some class (and there may be a loplugin coming to find and fix
affected places).  Another approach that has been taken here in a few cases
where such variables were only used in one .cxx anyway is to move their
definitions from the .hxx into that one .cxx (in turn causing some files to
become empty and get removed completely)---which also silenced some GCC
-Werror=unused-variable if a variable from a .hxx was not used in some .cxx
including it.

To keep individual commits reasonably manageable, some consumers of
OUStringLiteral in rtl/ustrbuf.hxx and rtl/ustring.hxx are left in a somewhat
odd state for now, where they don't take advantage of OUStringLiteral's
equivalence to rtl_uString, but just keep extracting its contents and copy it
elsewhere.  In follow-up commits, those consumers should be changed
appropriately, making them treat OUStringLiteral like an rtl_uString or
dropping the OUStringLiteral overload in favor of an existing (and cheap to use
now) OUString overload, etc.

In a similar vein, comparison operators between OUString and std::u16string_view
have been added to the existing plethora of comparison operator overloads.  It
would be nice to eventually consolidate them, esp. with the overloads taking
OUStringLiteral and/or char16_t const[N] string literals, but that appears
tricky to get right without introducing new ambiguities.  Also, a handful of
places across the code base use comparisons between OUString and OUStringNumber,
which are now ambiguous (converting the OUStringNumber to either OUString or
std::u16string_view).  For simplicity, those few places have manually been fixed
for now by adding explicit conversion to std::u16string_view.

Also some compilerplugins code needed to be adapted, and some of the
compilerplugins/test cases have become irrelevant (and have been removed), as
the tested code would no longer compile in the first place.

sal/qa/rtl/strings/test_oustring_concat.cxx documents a workaround for GCC bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96878> "Failed class template
argument deduction in unevaluated, parenthesized context".  That place, as well
as uses of OUStringLiteral in extensions/source/abpilot/fieldmappingimpl.cxx and
i18npool/source/localedata/localedata.cxx, which have been replaced with
OUString::Concat (and which is arguably a better choice, anyway), also caused
failures with at least Clang 5.0.2 (but would not have caused failures with at
least recent Clang 12 trunk, so appear to be bugs in Clang that have meanwhile
been fixed).

Change-Id: I34174462a28f2000cfeb2d219ffd533a767920b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102222
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-09-16 23:02:09 +02:00
Andrea Gelmini 0edc370ac5 Fix typo in code
It passed "make check" on Linux

Change-Id: I8bcc1598c7b885a025dd990eb2f75551e15b5c13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101794
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-09-01 15:28:58 +02:00
Andrea Gelmini 65aa9f9360 Fix typo in code
It passed "make check" on Linux

Change-Id: Iaa9bca078574b85182bdc8c002123178d074b650
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101622
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-31 08:31:14 +02:00
Stephan Bergmann 33ecd0d5c4 Change OUStringLiteral from char[] to char16_t[]
This is a prerequisite for making conversion from OUStringLiteral to OUString
more efficient at least for C++20 (by replacing its internals with a constexpr-
generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount,
conditionally for C++20 for now).

For a configure-wise bare-bones build on Linux, size reported by `du -bs
instdir` grew by 118792 bytes from 1155636636 to 1155755428.

In most places just a u"..." string literal prefix had to be added.  In some
places

  char const a[] = "...";

variables have been changed to char16_t, and a few places required even further
changes to code (which prompted the addition of include/o3tl/string_view.hxx
helper function o3tl::equalsIgnoreAsciiCase and the additional
OUString::createFromAscii overload).

For all uses of macros expanding to string literals, the relevant uses have been
rewritten as

  u"" MACRO

instead of changing the macro definitions.  It should be possible to change at
least some of those macro definitions (and drop the u"" from their call sites)
in follow-up commits.

Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-28 08:07:09 +02:00