summaryrefslogtreecommitdiff
path: root/sw/source/core/access
AgeCommit message (Collapse)AuthorFilesLines
2021-05-26CoreToPixel should take a SwRect argumentNoel Grandin4-16/+16
Change-Id: Idbed2a8fc6b4bc289c3bb0e761931f0b3d672620 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116121 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-26make SwRect(Rectangle) constructor explicitNoel Grandin1-1/+1
Change-Id: I715aa9499598c483ccf907f829c9ba3540edf216 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116120 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-21sw: replace most static_cast<sal_uInt16>() calls with o3tl::narrowing()Miklos Vajna1-1/+1
o3tl::narrowing() is a better way to handle this, as that way the integer conversion is still implicit, which allows detecting integer truncation at runtime (with suitable compiler flags). Change-Id: I499abda3be6943e8c111c56df390e72939586221 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115948 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-05-17split OutputDevice from WindowNoel Grandin1-3/+3
as part of a longer-term goal of doing our widget rendering only inside a top-level render- context. I moved all of the OutputDevice-related code that existed in vcl::Window into a new subclass of OutputDevice called WindowOutputDevice. Notes for further work (*) not sure why we are getting an 1x1 surface in SvpSalGraphics::releaseCairoContext, but to fix it I clamp the size there (*) might have to dump VCLXDevice, and move it's code down into VCLXWindow and VCLXVirtualDevice (*) can we remove use of VCLXDevice in other places, in favour of just talking to the VCL code? Change-Id: I105946377f5322677d6f7d0c1c23847178a720b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113204 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-12tdf#141307: adapt null-checkBjoern Michaelsen1-1/+1
- if we check pNd for nullptr, we need to expect it to be nullptr - in that case we shouldnt use the pointer before the null check Change-Id: Ia9d11abe32fac10f36fdbfcefeadd51891f1834e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115264 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2021-05-09clang-tidy Undefined or garbage value returned to callerNoel Grandin1-2/+2
[clang-analyzer-core.uninitialized.UndefReturn,-warnings-as-errors] Change-Id: Idc8f2f4a3189a3a65c95740a12387d5df7c0bea6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115266 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-02throw() -> noexcept, part 2/3: Automatic loplugin:noexcept rewriteStephan Bergmann9-18/+18
Change-Id: I076f16d0536b534abf0ced4d76051eadb4c0e033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-04-15store ptr to the original entries in SfxItemPropertyMapNoel Grandin1-9/+9
instead of copying them to a new data structure that is practically identical. Helps startup time since we build a ton of these when loading documents. And use o3tl::sorted_vector as a dense map data structure to reduce allocations and improve cache friendliness, since this is a build-once thing. Change-Id: I950be03b1a21c0c81c40f2677d4215f5e8e256cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114015 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-15loplugin:stringliteralvar look for assignmentsNoel Grandin1-1/+1
to O[U]String from char array literals, we can convert the char literals to O[U]StringLiteral and avoid a runtime allocation Change-Id: I15d8dddb2cd428b90740e39f20daf98e0941aa6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-12less copying in SfxItemPropertyMap::getPropertyEntriesNoel Grandin1-10/+8
we can just expose the map now, and avoid copying all the properties Change-Id: Icb22975508582268dfa96e41eb98ac01e7f51317 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113982 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-26loplugin:flattenNoel1-15/+14
Change-Id: Ib7a895fba66f8dc9b6501e61631c02694053b7fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113157 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-11remove some unneeded vcl/window.hxx includesCaolán McNamara1-47/+0
Change-Id: I2b716371e2bebe7390e7f0c7b747140d9f4bdec6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112330 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-11use some forward declares to reduce includesCaolán McNamara1-0/+1
Change-Id: Ic3a6d9a9569f909a7480d9da09709dbd60259e97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112323 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-07loplugin:staticdynamic now with extra saltNoel4-13/+5
because it wasn't quite there yet - now checks for casts with and without const, because const doesn't really matter here. Change-Id: I319025b2095a803fcaad2a7a696d2730b7fd2f81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112098 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-06loplugin:staticdynamic look for static after dynamicNoel1-4/+2
Change-Id: Ic3066d9a9441e369370cc6aa0fbffb9a321bc928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111985 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-20loplugin:refcounting in swNoel8-18/+13
Change-Id: I56f2f5aa4d9105e93f28701b8352d1fb97829ead Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111215 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-15loplugin:referencecasting in swNoel2-4/+4
Change-Id: Ie923fc8baaa26938378407f6e5f3c50b2cea7cca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110815 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-28simplify code, use more subView()Noel1-1/+1
Change-Id: I569c7f34acbdf8451cd5c9acf1abd334637072d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110051 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-16make the Color constructors explicitly specify transparencyNoel4-11/+11
to reduce the churn, we leave the existing constructor in place, and add a clang plugin to detect when the value passed to the existing constructor may contain transparency/alpha data. i.e. we leave expressions like Color(0xffffff) alone, but warn about any non-constant expression, and any expression like Color(0xff000000) Change-Id: Id2ce58e08882d9b7bd0b9f88eca97359dcdbcc8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109362 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-11Related tdf#123632: fix crash in accdoc (sw)Julien Nabet1-1/+1
Make sure to use gtk3 rendering - Open https://bugs.documentfoundation.org/attachment.cgi?id=149492 - Click F5 to open the navigator - Go to Images - Try double click the third and last image at least 15 times -> crash, here's part of bt: Thread 1 "soffice.bin" received signal SIGSEGV, Segmentation fault. SwFrame::IsInTab (this=0x0) at sw/source/core/inc/frame.hxx:938 938 if ( mbInfInvalid ) (gdb) bt 0 SwFrame::IsInTab() const (this=0x0) at sw/source/core/inc/frame.hxx:938 1 0x00007fd7e78caf9c in SwAccessibleDocument::getExtendedAttributes() (this=0x7e4e090) at sw/source/core/access/accdoc.cxx:596 2 0x00007fd7e78cbf9d in non-virtual thunk to SwAccessibleDocument::getExtendedAttributes() () at sw/source/core/access/accdoc.cxx:708 3 0x00007fd7f18f90ad in attribute_set_new_from_extended_attributes(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleExtendedAttributes> const&) (rExtendedAttributes=uno::Reference to (SwAccessibleDocument *) 0x7e4e180) at vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx:1229 4 0x00007fd7f19113f3 in wrapper_get_attributes(_AtkObject*) (atk_obj=0x7df37d0) at vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx:394 I put "Related" because I don't know if it corresponds to the initial bug but I used the attached file of the bugtracker Change-Id: Ief9fda9f7bcf277d18490169eee2e43fb046a1bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109051 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-01-09fix coverity parse errorsCaolán McNamara10-14/+14
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-09AccessibleShapeTreeInfo needs a vcl::WindowNoel Grandin1-1/+1
no point in passing an OutputDevice there Change-Id: I6da9b29a0e6f57ad6a8ebcb6113987ee25419483 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108988 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-08use more IsTransparentNoel Grandin1-1/+1
Change-Id: I3ef18a2601a51d56614b5da9b56e871bd33ec79e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108942 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-02SwFrame: Modify no moreBjoern Michaelsen1-1/+1
Change-Id: I8e2c89f2c897535013d64720b6c2c5bbac602b14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108551 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-12-26vcl: use Color:IsTransparent() where appropriateChris Sherlock1-2/+2
Change-Id: I37bbab5f22f91faad65be8ef79734ce1ee6355d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108249 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-26New loplugin:stringliteralvarStephan Bergmann10-14/+20
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-11-24tdf#42949 Fix new IWYU warnings in directory swGabor Kelemen7-6/+3
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I4bb84c3f401aba8a3dede9cec3a7f2187a2ba02a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106473 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-22tdf#124176: Use pragma once instead of include guardsGökhan Özeloğlu1-3/+1
Change-Id: Idb778188a0a2f0c26e007dc919adbffe3af6e435 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106331 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-11-20tdf#138108 terminate on uncaught exception in a11y callbackCaolán McNamara1-1/+1
#1 0x00007ffff5d3fafe in accessibility::AccessibleContextBase::ThrowIfDisposed() (this=0x85de440) at editeng/source/accessibility/AccessibleContextBase.cxx:513 #2 0x00007ffff5d3fbee in accessibility::AccessibleContextBase::getAccessibleParent() (this=0x85de440) at editeng/source/accessibility/AccessibleContextBase.cxx:203 #3 0x00007fff999cad24 in SwAccessibleMap::DoInvalidateShapeSelection(bool) (this=0x687e610, bInvalidateFocusMode=false) at sw/source/core/access/accmap.cxx:1647 #4 0x00007fff999cc5a5 in SwAccessibleMap::InvalidateShapeSelection() (this=0x687e610) at sw/source/core/access/accmap.cxx:1152 #5 0x00007fff999d78b0 in SwAccessibleMap::InvalidateCursorPosition(SwFrame const*) (this=0x687e610, pFrame=0x5a3faa0) at sw/source/core/access/accmap.cxx:2744 #6 0x00007fff9aae5c32 in SwViewShellImp::InvalidateAccessibleCursorPosition(SwFrame const*) (this=0x6594330, pFrame=0x5a3faa0) at sw/source/core/view/viewimp.cxx:345 #7 0x00007fff99b01fcd in SwCursorShell::UpdateCursor(unsigned short, bool) (this=0x6594840, eFlags=7, bIdleEnd=false) at sw/source/core/crsr/crsrsh.cxx:2020 #8 0x00007fff99b02db4 in SwCursorShell::EndAction(bool, bool) (this=0x6594840, bIdleEnd=false, DoSetPosX=false) at sw/source/core/crsr/crsrsh.cxx:279 #9 0x00007fff9a2249b2 in SwFEShell::SelectObj(Point const&, unsigned char, SdrObject*) (this=0x6594840, rPt=Point = {...}, nFlag=0 '\000', pObj=0x0) at sw/source/core/frmedt/feshview.cxx:323 #10 0x00007fff9b30eacb in SwWrtShell::UnSelectFrame() (this=0x6594840) at sw/source/uibase/wrtsh/select.cxx:326 Change-Id: I122d087b67c3615afb0c34aa714bc1066946c8c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106190 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-11-19tdf#123936 Formatting files in module sw with clang-formatPhilipp Hofer1-13/+9
Change-Id: I6243bc95129bf81a124d006ce0fc1aa1b5f618bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105718 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Jenkins
2020-11-12New loplugin:stringviewparamStephan Bergmann1-6/+7
...to "Find functions that take rtl::O[U]String parameters that can be generalized to take std::[u16]string_view instead." (Which in turn can avoid costly O[U]String constructions, see e.g. loplugin:stringview and subView.) Some of those functions' call sites, passing plain char string literals, needed to be adapted when converting them. Change-Id: I644ab546d7a0ce9e470ab9b3196e3e60d1e812bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105622 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-09tdf#138052 Added a check for fontworks.Ivan Stefanenko1-0/+13
Fontworks should be warned about coz they reprezent a stylized text, which is hard to recognize for digital readers. Check is added to checkObject() function as fontwork is an object. Change-Id: I2ed5a5784dfe96bbf05ec7cf4c09dc97e1fb29d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105436 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-05tdf#137968 Added check for the headings orderIvan Stefanenko1-0/+43
Headings' levels order is important for readers and converters. Check firstly finds out if the node is a TextNode, then gets it's OutlineLevel. If it is greater than 0, i.e. the node is a heading, then it checks if node's heading level is greater then previous one's by more than 1. If so, warning is thrown. So the first heading level is always 1 and no heading levels are greater then previous by more than 1. Change-Id: I39d230d747699eddd36610193bde9b23f348e257 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105274 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2020-10-30convert some tools::Long->sal_Int32Noel1-3/+3
in places where it is obvious we only need a sal_Int32, because we are dealing with rows and columns, and not even calc needs more than 32 bits for that. Change-Id: I114417e639c224d45bfd9fc6838122ab195eefa3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104584 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-26std::unique_ptr -> std::optionalNoel1-4/+4
Change-Id: I48195e5bd61f9b662481da0efc6165ced794600c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104801 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-20use tools::Long in swNoel3-12/+12
Change-Id: I44be72b3a9b14823ec37a3c799cffb4fb4d6e1de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104527 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-12sw: prefix members of SwFormatAnchor, SwXDocumentPropertyHelper, ...Miklos Vajna1-4/+4
... SwXLinkNameAccessWrapper and TableHeadingCheck See tdf#94879 for motivation. Change-Id: I1108abc0d4ee6179c0b4d4dbe18af0730edbd2ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104200 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-10-06loplugin:const* make some params and methods constNoel1-1/+2
Change-Id: I3c8ca72b2b41a4f82ee20cbe025b41425f32e715 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104028 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-30Fix typosAndrea Gelmini1-1/+1
Change-Id: Ie6146de848b7c5bb7a8edc76a0652c9c623b7024 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103723 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2020-09-30AccessibilityIssue::setDoc never passed a null ScDoc*Caolán McNamara2-5/+5
Change-Id: I88d11b8252723ee5b493d0effc9ed24757aed3b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103691 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-30SwPosition::GetDoc can return a referenceCaolán McNamara1-1/+1
and remove discovered redundant null checks Change-Id: I90e2a84b260bfaf283b787db055cd1ed54dab4ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103676 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-30SwPaM::GetDoc can return a reference insteadCaolán McNamara1-3/+3
and remove discovered redundant null checks Change-Id: Iac8ad7821d9acfcc9550a96402c02ac248f16f2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103672 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-30loplugin:reducevarscope in swNoel1-5/+3
Change-Id: Ifed7220c6acf7049b2985f1911a806b37a54d794 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103646 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-30tdf#137104 Added a check for headings in tablesIvan Stefanenko1-0/+35
New check checks if a node is a heading and if it is in a table. Change-Id: I53938ddb57573f80c7823b05bff2d1dd2cee1b8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103014 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-09-30SwNode::GetDoc can return a reference insteadCaolán McNamara2-17/+17
and remove discovered redundant null checks Change-Id: I6b8bc9593434f38947e399a48888a8fa0d4f7e77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103640 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-27Move default way to find Which to an inline functionBjoern Michaelsen4-4/+4
Change-Id: Ie3aa3f8a2c34c510a391d729f3dc2286f735111a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103066 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-09-25tdf#101830 sw: show field name for inline input fields tooMichael Stahl2-8/+7
Currently if the View->Field Names is toggled, SwViewShell::ImplApplyViewOptions() will call Reformat() and throw away all existing portions. So we can just create a different kind of portion altogether depending on the value of the setting, and avoid complex multi-inheritance portion or copying lots of code around. This requires correcting a few assumptions that a SwFieldPortion has a length of 0 or 1; for the input field, its length is the length of the entire input field including CH_TXT_ATR_INPUTFIELDSTART/END (unless it's a follow/rest portion, those are length 0 as always). For the cursor travelling, LeftRight() works similar to f6a60ce214117946eef222701023dca612bf0a2b, while UpDown() and mouse click positioning need tweaks in SwTextCursor::GetModelPositionForViewPoint() to take the field length into account. Due to the previous point, mouse click related functions in edtwin.cxx require checking the position at the start now. When enabling Field Names, move any shell cursors out of input fields. Change-Id: I1304f419bd6fa20f0c55fd1b13165c4866d64000 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103155 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-16Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uStringStephan Bergmann1-1/+1
...from which an OUString can cheaply be instantiated. This is the OUString equivalent of 4b9e440c51be3e40326bc90c33ae69885bfb51e4 "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-08tdf#136468 Added a new check for objects and nodes.Stefanenko1-0/+34
Floating objects with text create problems with reading order A new check for floating text field inserted into checkObject function and into node-checking mechanism. Change-Id: Ice97d8a3e24de21ee6c6d2b0a6f89c348f665c8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101994 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2020-09-03tdf#136399 AccessibilityCheck: Inserted a new checkStefanenko1-0/+39
A new check responsible for checking if the input forms are not formed by manual typing consecutive "_", "..." or "…". Made a new check class and inserted it into the main checking mechanism, also added a related string. Change-Id: I6ecc3878114dc432d43ce1ad27ea45d512366320 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101921 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>