Commit graph

475196 commits

Author SHA1 Message Date
Stephan Bergmann
b125784fa5 Drop an obsolete configure check
We require at least GCC 7.0.0 anyway, per README.md

Change-Id: Ib974690ef4e4a1861a43f33157fde9f4bb3ac8ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134080
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-09 18:38:55 +02:00
Xisco Fauli
7251f9c1b8 basic: remove commented out line
Introduced in 90d33f5945
"tdf#148358 - Compare Non-ASCII variable names case-insensitive"

Change-Id: I5bccb3f2f54ac61f2fbf960e78e3d4e4a0893f85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134081
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-05-09 18:30:35 +02:00
Stephan Bergmann
57b58d4fb8 URE Library_boostrap should not depend on Library_comphelper
...and apparently doesn't need to, even though that dependency got added with
6ffdc88e79 "Simplify Sequence iterations in
shell..svgio"

Change-Id: I7cb67dc48d11e426d5d5f7912eca13e25a32dbc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134079
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-09 17:58:29 +02:00
Stephan Bergmann
52bd9c25d1 SvFileStream needs an absolute file URL
...and fail loudly if writing the file fails for any reason

Change-Id: I1e6d2e3da4d2ef643f4d27067845184dbf2e40a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134076
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-09 17:57:29 +02:00
Stephan Bergmann
c5e38abb10 URE Library_io should not depend on Library_comphelper
...and apparently doesn't need to, even though that dependency got added with
6af2e7d21c "use more
comphelper::OInterfaceContainerHelper2"

Change-Id: I74a4d04be9a37291bc37d908173381eb341b6df4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134077
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-09 17:56:47 +02:00
Stephan Bergmann
81d55a0a8b Revert "prevent using O[U]String::subView on temporaties"
This reverts commit 59059d00c2, as it effectively
did nothing, as rvalues can bind to `const &` just fine.
<https://gerrit.libreoffice.org/c/core/+/133747> "Acutally do prevent using
O[U]String::subView on temporaties" would have fixed that, but (a) it didn't
find any actual mis-uses and (b) rather would have required a handful of
legitimate cases to be dressed up with o3tl::temporary now, so is arguably not
worth it.

Change-Id: I923d0db2646dc8ea66d1b2a8b709ee2cd7a60ed4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134058
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-09 17:55:16 +02:00
Mike Kaganski
7c8f27e3d8 sal_Int32 cast to tools::Long to pass to a function taking sal_Int32
Change-Id: I81bb794e6a154dd3d022b34ce1348f32c854f52b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134059
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-09 17:52:11 +02:00
Alain Romedenne
7f987c7218 Update git submodules
* Update helpcontent2 from branch 'master'
  to 084d84f09882ec35007ad4566247932a30899799
  - tdf#141474 tdf#148466 Choose function accepts keyword arguments
    
    Change-Id: I82407ecc20b66c385f17509aa703222d2d2d10e6
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/132390
    Tested-by: Jenkins
    Reviewed-by: Alain Romedenne <alain.romedenne@libreoffice.org>
2022-05-09 17:43:37 +02:00
Caolán McNamara
10f3cb6aa8 ofz#46070 Out-of-memory
Change-Id: Ie7417f5f7e0ed49cfc3b38eda3117d53c8a2a59e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134053
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-09 16:07:01 +02:00
Xisco Fauli
7d0b19f3ea tdf#148843: sc_mathematical_functions: Add unittest
Change-Id: Iea71c3fd92a471814c27bebda74bbe8b30d706f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134040
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-05-09 16:01:24 +02:00
Xisco Fauli
8bd91a40ea tdf#148948: sc_statistical_functions: Add unittest
Change-Id: I9dd5010931991001215102a2764f7faa67412676
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134038
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-05-09 14:18:03 +02:00
Caolán McNamara
247f4aefb9 Resolves: tdf#148985 crash on searching for non-existing prefix
Change-Id: Ib89af12e75910adbd32abab5afceb9013dc51df2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134039
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-09 12:36:33 +02:00
Miklos Vajna
0db2cd321f sw content controls: only try to insert placeholders if there is no selection
The logic is that in case there is no selection, we insert a placeholder
like "type here", but if there is a selection, that can be a custom
placeholder.

Without this fix, we would hit an assertion failure on inserting content
control when there is a selection, as the placeholder is empty and
operator[](0) is not allowed for empty OUStrings.

Change-Id: I8370b8d74415faf0e76dccb574aa29bea1947bb8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134041
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-05-09 12:27:54 +02:00
Mike Kaganski
0c87c0b87a Fix --disable-pch build: explicitly delete move constructor
Without this, the implicitly created constructor is exported by MSVC
for the DLLPUBLIC class, and requires that VirtualDevice is defined,
resulting in this error in PCH-disabled builds:

  [build CXX] vcl/source/animate/Animation.cxx
  C:\lo\src\core\include\rtl/ref.hxx(129): error C2027: use of undefined type 'VirtualDevice'
  C:\lo\src\core\vcl\inc\impanmvw.hxx(29): note: see declaration of 'VirtualDevice'
  C:\lo\src\core\include\rtl/ref.hxx(127): note: while compiling class template member function 'rtl::Reference<reference_type>::~Reference(void)'
  with
  [
  reference_type=VirtualDevice
  ]
  C:\lo\src\core\include\vcl/vclptr.hxx(216): note: see reference to function template instantiation 'rtl::Reference<reference_type>::~Reference(void)' being comp
  iled
  with
  [
  reference_type=VirtualDevice
  ]
  C:\lo\src\core\include\vcl/vclptr.hxx(64): note: see reference to class template instantiation 'rtl::Reference<reference_type>' being compiled
  with
  [
  reference_type=VirtualDevice
  ]
  C:\lo\src\core\include\vcl/outdev.hxx(202): note: see reference to class template instantiation 'VclPtr<VirtualDevice>' being compiled
  make[1]: *** [C:/lo/src/core/solenv/gbuild/LinkTarget.mk:337: C:/lo/src/build/workdir/CxxObject/vcl/source/animate/Animation.o] Error 2

Change-Id: I78723ce7d00667595aff39bcab22169ff347098f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134036
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-09 11:57:06 +02:00
Miklos Vajna
c3f4c43694 sw content controls, drop-down: add ODT filter
Map each list item to a dedicated XML element:

<loext:list-item loext:display-text="..." loext:value="...">

And do the opposite on import.

Change-Id: I59a536a8317a3bb24919107b4449f858d5f6de96
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134034
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-05-09 11:16:54 +02:00
Bartosz Kosiorek
32cb4e4fe5 tdf#89331 EMF/WMF Fix holes in lines created with LINETO
If the lines are created with MOVETO, LINETO, LINETO...
then Line Join NONE is applied. As a result the charts are looks ugly,
with the holes inside it.
For example:
https://bugs.documentfoundation.org/attachment.cgi?id=179962
and
https://bugs.documentfoundation.org/attachment.cgi?id=179837

Additinally commit changed default line join style to miter,
as during experimenting with MS Paint and MS Word,
it appear that default Join Style is PS_JOIN_MITER and
Line Cap is Flat/Butter.

The PDF export tests has been updated, as there is less number
of PDF object after using joiners.
The size of the exported tdf145873.pptx to PDF,
was slighltly decreased from 22.8kB to 22.0KB

Change-Id: I131cc3c5e90f827d67d2360eb18167eed6315abb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133624
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2022-05-09 11:08:25 +02:00
Caolán McNamara
d4ec15d5b7 rsc is no more, but concat-deps leaks instead so still need this
Change-Id: I06474f973c1858ed0740232dc75cfd75b8c4706e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134031
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-09 10:22:05 +02:00
Noel Grandin
90523fd368 osl::Mutex->std::mutex in SalUserEventList
Change-Id: I463f1620e28bf71b8b7ad61a9da074ff6ee7f0f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133912
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-09 10:18:41 +02:00
Noel Grandin
7537c81fd6 osl::Mutex->std::mutex in desktop::Acceptor
Change-Id: I450734e615c4c214f18641a3ac79f6810d98922c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134030
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-09 10:17:38 +02:00
Noel Grandin
9277faf14a osl::Mutex->std::mutex in cppuhelper::ServiceManager
Change-Id: I2d30fb3c81e791eb554780b5abf4923a33cc884e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134029
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-09 10:16:39 +02:00
Noel Grandin
f0ed5d4637 osl::Mutex->std::mutex in cppu::MappingsData
Change-Id: I34292537e9724d7667ba099285c87a32ae13ffad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134028
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-09 10:15:24 +02:00
Miklos Vajna
c06b2ac50e sw: prefix members of RTFSurround, SwMSConvertControls, ww8::WW8Sttb and ...
... wwFontHelper

See tdf#94879 for motivation.

Change-Id: Ib5ee24b6ed599041b0c2724931742d86ee9b360c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134033
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-05-09 10:13:13 +02:00
Pranam Lashkari
db6c5c7f9d svx: calculate object range before using it
Change-Id: I01f0176542e9d6f36a2f7bbc870a9e337705a5a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133454
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit b604f17732)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133486
Tested-by: Jenkins
Reviewed-by: Pranam Lashkari <lpranam@collabora.com>
2022-05-09 10:05:42 +02:00
Eike Rathke
920a083f38 Resolves: tdf#148948 Use QueryBy(Non)Empty for "=" and "<>" criteria
Change-Id: I94e29370076fff977b6552d10883878633bee313
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134000
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
2022-05-09 09:46:18 +02:00
Luboš Luňák
b06663135f enable Skia on big-endian too
Without this the build will #error out, and despite the disclaimer
it reportedly works fine.
https://lists.freedesktop.org/archives/libreoffice/2022-May/088838.html

Change-Id: I0e87b31647fe5107bca9b58d8f4af5fc0c67cd65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134032
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-09 09:14:11 +02:00
Luboš Luňák
c0f9157cf6 remove HAVE_LIBCPP_DEBUG (libc++ debug mode)
It's currently too broken (https://reviews.llvm.org/D125184),
but they're working on fixing it, so hopefully somewhen later.

Change-Id: I3ca243a57d41bd9d8c4cdbdc4a6a3b5fdc49e4c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134023
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-09 09:13:41 +02:00
Noel Grandin
cdf8e971d5 osl::Mutex->std::mutex in SaxExpatParser
Change-Id: I9d99497dfbc67cd4dd690da9db58aab0db114d36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134021
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-08 20:50:34 +02:00
Noel Grandin
34948e6777 osl::Mutex->std::mutex in Pump
Change-Id: Idb25603ba5659b3d8cabbdddb00df60e43045b52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134020
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-08 20:50:12 +02:00
Noel Grandin
cb65f89db8 osl::Mutex->std::mutex in OMarkableInputStream
Change-Id: I935573e63471e5f38e719df51b3510992347fe09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134019
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-08 20:49:47 +02:00
Noel Grandin
0daeb60f4f osl::Mutex->std::mutex in OMarkableOutputStream
Change-Id: Ie39f8cd7f8de8dfe647d006d0fd0c62fddc72a8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134018
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-08 20:49:22 +02:00
Caolán McNamara
fd4a089df6 ofz#46607 Integer-overflow
Change-Id: Id759423176b2e47fc00b8e7babd936b480956617
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134025
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-08 20:33:58 +02:00
Noel Grandin
e8b38f7700 osl::Mutex->std::mutex in OAcceptor
Change-Id: I0fa5628ff601a89ed9c74212b4986689957eab1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134017
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-08 19:56:03 +02:00
Mike Kaganski
5393dbec55 No need to use std::optional here
Change-Id: I7129178ca4639aafabe7401dd6e3dc831e7e9562
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133873
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-08 17:51:52 +02:00
Caolán McNamara
233b1409f5 drop special fuzzing path
Change-Id: Ifa47253b1122f6f84f2c082b2f71b04451ec5162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134026
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-08 17:45:27 +02:00
Martin Srebotnjak
1fae699cc5 Update git submodules
* Update translations from branch 'master'
  to d317ea9b3412438e83f716001d7fda3a62516855
  - Updated Slovenian translation
    
    Change-Id: I2edec53223e0c5c09cff8fc58265f32d6aa3da8e
2022-05-08 17:41:41 +02:00
Stephan Bergmann
7e1ff1cee5 external/firebird: Implicit int in configure check
...so that with Clang 15 trunk after
<2cb2cd242c>
"Change the behavior of implicit int diagnostics" the check now failed to
compile with

> configure:21471: checking alignment of long
[...]
> conftest.c:166:2: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]

with consequences the same as in f6be6cd82b
"external/firebird: Missing include in configure check" (so rename the existing
configure-include.patch, as it now covers various kinds of C99 violations)

Change-Id: I64e7c13945a3ede3900cc6a84da575e35bdce953
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133994
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-08 16:45:13 +02:00
Noel Grandin
9974ed792a osl::Mutex->std::mutex in slideshow::EventQueue
Change-Id: Ie9e53e5dc2c842e11457846b5f177fc55683e0d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134016
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-08 16:38:52 +02:00
Noel Grandin
40b0cf86c2 osl::Mutex->std::mutex in sfx2::PreventDuplicateInteraction
Change-Id: I4abc1462b4d691dc699a9716573d23824897176b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134015
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-08 16:38:31 +02:00
Noel Grandin
df63d1aa9c osl::Mutex->std::mutex in framework::ToolBarManager
Change-Id: I6908dc61cbd6e6e4d11c52dfface1d863cd7e5c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133977
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-08 12:34:40 +02:00
xuenhua
e92536bac2 Delete CJK-style mnemonics on macOS
Delete CJK-style mnemonics for the dropdown menu of the 'New button' and lower menu of 'File > New' on macOS

Change-Id: Idd0ab671cd75151095c92b37e5b6b5e81ddae7e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133973
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-08 10:57:11 +02:00
Stephan Bergmann
ed977f0b6c external/openldap: Implicit int in configure check
...causing

> checking for compatible POSIX regex... no
> configure: error: broken POSIX regex!
> make[1]: *** [external/openldap/ExternalProject_openldap.mk:40: workdir/ExternalProject/openldap/build] Error 1

due to

> conftest.c:88:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]

with Clang 15 trunk after
<2cb2cd242c>
"Change the behavior of implicit int diagnostics"

Change-Id: I8fb70ce21a73293e20bbc5b09c133141aa9b0ca1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133995
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-08 10:37:32 +02:00
Seth Chaiklin
93d0c905fe tdf#127294 add new ToD about deleting arrow styles
Change-Id: I5e6c3878f2c73f7136baf9a1cfaa6ac8aa1030d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133479
Tested-by: Jenkins
Reviewed-by: Seth Chaiklin <sdc.blanco@youmail.dk>
2022-05-08 08:53:54 +02:00
Michael Weghorn
1bb9036e90 android: Don't use res Id in switch-case (ToolbarController)
Like Change-Id I9d563b6ad4ed70a891c583a82331dd80db5956dc,
"android: Avoid using res ID in switch-case (FormattingController)",
but for `TollbarController`.

Change-Id: I40f23b6a91ddf0bb7e90c3b3b690fe332cd874ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133999
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:29:20 +02:00
Michael Weghorn
dcc6b286ea android: Don't use res ID in switch-case (SearchController)
Addresses this Lint warning:

> ../../src/java/org/libreoffice/SearchController.java:73: Resource IDs
> will be non-final by default in Android Gradle Plugin version 8.0, avoid
> using them in switch case statements

There's no need to explicitly set `SearchDirection.DOWN`
for `R.id.button_search_down` since it has previously been
set as default value anyway.

Change-Id: I283c00b97e1417f5dc3a48922238df7a29032137
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133998
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:28:38 +02:00
Michael Weghorn
1c5a8b5eaf android: Avoid using res ID in switch-case (FormattingController)
Adresses Lint warnings like this in FormattingController:

> ../../src/java/org/libreoffice/FormattingController.java:89: Resource
> IDs will be non-final by default in Android Gradle Plugin version 8.0,
> avoid using them in switch case statements
>
>   86
>   87      switch(button.getId()) {
>   88
>   89          case R.id.button_insertFormatListBullets:
>   90              LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:DefaultBullet"));
>   91              break;

Change-Id: I9d563b6ad4ed70a891c583a82331dd80db5956dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133997
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:27:52 +02:00
Michael Weghorn
e1381521c5 android: Allow setting auto font/bg color
Add a button in the color palette UI
(that can be found in the bottom toolbar
under "Styles" -> "Font Color"/"Highlight Color"
when experimental editing mode is enabled) which
allows setting auto color for the font
or the highlighting/background.
This allows to unset any explicitly set color and
use the automatic color.

This is equivalent to the "Automatic"/"No fill color"
items in the font color and character highlighting
color popups in the desktop version.

Add a `boolean keepAlpha` param to
`sendFont{,Back}ColorChange` to be able
to distinguish between "auto color" and white
when -1/0xFFFFFFFF is passed as color.
See also previous commit
Change-Id I2e6512f32e671f92c8d31b2780c350dd74fb0747,
"android: Handle auto color as such", for some more
context.

Change-Id: I05182a2adbc00e64b1925ff52861a51ba8dcc21f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133996
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:27:05 +02:00
Michael Weghorn
5c50d8f7ee android: Handle auto color as such
When no color is explicitly set for the font/background
(i.e. automatic color is used which would e.g. be black
for the font if no background color is set or white
if a black highlight color is set in Writer), the value
for the color sent in the ".uno:Color" event for the font
color and similarly for the background/highlight color
(".uno:BackgroundColor" in Calc, ".uno:CharBackColor"
in Impress, ".uno:BackColor" in Writer) is -1.

The previous handling of that special value was problematic:

1) Where handled specifically, -1 was interpreted as "black color"
rather than "auto/no color".

2) The color handled by the above-mentioned UNO events
does not contain/handle the alpha channel, while Android
does, so a conversion happens to add/remove the alpha
layer.
However, the anonymous `ColorPaletteListener`s that handle font
and background color updates in their `updateColorPickerPosition`
methods were not doing a logical or to add an alpha channel to
the LO-provided color, but *adding* 0xFF000000 instead, which is
the same for actual colors without an alpha channel set, but
the actual special value of -1 (0xFFFFFFFF) would then
be converted to 0xFEFFFFFF and no longer be treated as
special.

The way of treating -1 as black would also have the
side effect that an explicit white color (0x00FFFFFF) would
be converted to 0xFFFFFFFF, which is -1, and
would therefore be treated as black.
(So setting font color to white would result in black
being shown as font color in the font color UI in experimental
mode instead...)

In order to actually handle auto color as such, handle
the special value of -1 right in the `updateColorPickerPosition`
methods: In that case, unselect any explicitly selected color
(and set color to transparent for the buttons in the "Style"
tab of the toolbar, `font_color_picker_button`
and `font_back_color_picker_button` in `toolbar_bottom.xml`).
Also, do a logical or to add the alpha layer instead
of adding 0xFF000000.

While at it, unify the code in the two
`updateColorPickerPosition` methods a bit.

Change-Id: I2e6512f32e671f92c8d31b2780c350dd74fb0747
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133992
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:25:36 +02:00
Michael Weghorn
bc762b702d android: Don't show any color in palette as selected if none matches
In Android Viewer with experimental editing mode enabled,
doing the following resulted in black still being marked as
the current font color in the "Style" -> "Font Color" UI.

1) create a new Writer doc in the desktop version with one
   paragraph that has the font color explicitly set to black
   and one with "Dark Brick 2"
2) open the doc in Android Viewer with experimental mode enabled
3) tap on the first paragraph with font color explicitly set to
   black
4) open the "Style" -> "Font Color" UI where the color could be
   changed (layout file: `toolbar_color_picker.xml`)
-> black is marked as current font color (OK)
5) tap on the paragraph which has font color "Dark Brick 2" set
-> black is still marked as current font color (NOK)

This is because the indices of the previously set
color would just remain set if the new color
was not found in any of the palettes which contain
a set of predefined colors.

Change that to set the index for the `upperSelectedBox`
palette to 0 (i.e. switch to the first palette), and the
index of the `selectedBox` (i.e. color within the palette)
to the special value of '-1' and don't mark any palette
or color as selected in that case.

The newly introduced `ColorPickerAdapter#unselectColors`
will be used from elsewhere in a follow-up commit, so
make it public right away.

The two `ImageButton`s right in the "Style" tab
in the toolbar (i.e. `font_color_picker_button` and
 `font_back_color_picker_button` in `toolbar_bottom.xml`)
remain unchanged and keep showing the actual color, since
those are not restricted to predefined colors in the
palettes.

For the case where no explicit font color is set
(i.e. use of automatic font color, e.g. black if no background
is set, but white if the background is set to black), the
value '-1' is sent from the C++ side, and no color should
be marked as selected in Android Viewer, which also works
with this change in place in general.
However, the current handling for the "automatic color" case
on Android Viewer side looks suspicious in more ways that will
be addressed in a follow-up commit.

Change-Id: I228d57ace5341bd311761f40c477441d1e511d5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133989
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:24:20 +02:00
Michael Weghorn
9a249103de android: Switch order of these if/else statements
I find

    if (a == b) {
        // statement 1
    } else {
        // statement 2
    }

more straightforward than

    if ( a != b) {
        // statement 2
    } else {
        // statement 1
    }

since it doesn't require logically negating twice
(else block is for `!(a != b)`) in the second form), and this
also prepares for a follow-up commit where one of the conditions
will be extended further.

Change-Id: I1d2177bdcf662994e757b626983a9f9626c66aa1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133988
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:23:29 +02:00
Michael Weghorn
5c452ad4c3 android: Don't store selected pos in ColorPickerAdapter
The position is already set and used in `ColorPaletteAdapter`
as its `upperSelectedBox` member, so stop doing the
double bookkeeping in both classes and retrieve it
from there instead.

Change-Id: I59896b85f5d5a0285076f61599be64638fa71121
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133987
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:22:26 +02:00