summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode/thints.cxx
AgeCommit message (Collapse)Author
2022-05-24comments: reassign ID when copy commentPranam Lashkari
reassigning new ID will make all the comments have unique IDs this will also ensure there is no mixup when working with comments ID Signed-off-by: Pranam Lashkari <lpranam@collabora.com> Change-Id: I94b433130c68354ab94d4d6e9b86751038b31af5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134686 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> (cherry picked from commit 0d3bba5c383ef8b9f62c121a26fed4445c813949) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134792 Tested-by: Jenkins
2022-05-11sw content controls: introduce a word breaking dummy char at the endMiklos Vajna
- this way double-clicking on the last word of a content control or the first word after the content control selects the correct text range, similar to how the same at the start of content control already worked - this allows not touching the expand flag in the SwTextContentControl ctor, which was overwritten by the ODT import (when the content control was at the end of the paragraph) anyway - hide this dummy character when accessing the paragraph content via the UNO API or the text export - still need to audit a few more places in follow-up commits to maintain the invariant that content controls have the same dummy char at the attribute start and end -- somwhat similar to how SwTextInputField does it with CH_TXT_ATR_INPUTFIELDSTART/END Change-Id: I88763d6db84afedbb865b680f040994c4d6ab7d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134151 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-03-30sw content controls: add document modelMiklos Vajna
This is meant to represent inline structured document tags (<w:sdt> elements in DOCX) or content controls (as Word users know this). Don't confuse this with block-level, cell-level or table-level content controls, which are not covered here. You may wonder why fields or fieldmarks can't be used to represent this. The problems are: - a fieldmark can contain a paragraph break, inline content controls can't - content controls must be a well-formed XML element, while fieldmarks can start/end at random document model positions - fieldmarks are supposed to have a field command and a result result (with a separator between the two), but content controls don't have a field command - mapping to a field has the problem that Writer fields can only have a single text portion / run, but content controls can have multiple ones So model content controls with a meta-like text attribute which covers all these cases. SwContentControl is mostly empty as a start, it can track more data in follow-up commits. SwTextContentControl and SwFormatContentControl are the matching text attr and pool item subclasses. Change-Id: I1e57f7756cf87041975371483ec4fc8abf875dfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132291 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-03-28Recheck sw/ cxx files with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I8a8df68946297fad517b753d73e4373203a45ed6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132150 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-03-03use SfxItemSet::GetItemIfSet in sw/source/core/txtnodeNoel Grandin
Change-Id: I3b6315e987899476ec46b3d7ec98f085a5cd598e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130881 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-02sw clearing breaks: add UNO API to insert this with custom clear / char propsMiklos Vajna
- if (character) properties are specified when the text content itself is inserted, then format the anchor ("dummy") character like that - add the ability to specify a clear type (none/left/right/all) on the line break object itself before insertion Change-Id: I219a1031e53c2e0368ff329d45b7e3fff0934038 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130818 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-03-01sw clearing breaks: add UNO API to insert thisMiklos Vajna
This only allows the clear=all break type, the others are not yet handled. Change-Id: Id4981b3cc0a8faca2166ad93827ae547f5539095 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130741 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-02-28sw clearing breaks: add document modelMiklos Vajna
This is meant to represent clearing breaks, as in HTML's <br clear="..."> and DOCX's <w:br w:type="textWrapping" w:clear="...">. The new pool item is in the RES_TXTATR_NOEND section as this property can be only specified on a single document model position: linebreak characters. Change-Id: I6c86097a049e489e1292f42fc8446eb7282c816a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130687 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-02-18improve the SfxItemSet::CloneAsValue checkNoel Grandin
to prevent object slicing. Which reveals a problems with commit 044fa30a4c77013c87a7e2a6dd9022a2f6599778 Author: Noel Grandin <noelgrandin@gmail.com> Date: Thu Sep 23 18:44:42 2021 +0200 no need to allocate this SfxItemSet on the heap and commit 044fa30a4c77013c87a7e2a6dd9022a2f6599778 Author: Noel Grandin <noelgrandin@gmail.com> Date: Thu Sep 23 18:44:42 2021 +0200 no need to allocate this SfxItemSet on the heap so revert the problematic bits of those commits Change-Id: I5eeba1d5bdb91f4e539850516f2b1c11e69ff2c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130127 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-02-08no need to take copies of the shared_ptr hereNoel Grandin
and copying shared_ptr is fairly slow Change-Id: I0bf06056f867494319c087e113b3f77b5a5632c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129656 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-03tdf#145062 sw: really destroy text attribute when insertion failsMichael Stahl
SwTextNode::InsertHint() is documented to destroy its argument SwTextAttr in case insertion fails, but it doesn't do it on all branches. Change-Id: I270df9acf36993d894899c20c86a6bc43d782001 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126190 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-11-23O[U]String::replaceAt overloads that take string_viewNoel Grandin
which results in lots of nice string_view improvements picked up by the plugins Change-Id: Ib0ec3887816b3d4436d003b739d9814f83e244b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-22tdf#64991 speed up loading large RTL documentsNoel Grandin
only insert the bounds we are interested in takes load time from 1m51 to 1min39 for me Change-Id: I5a267ae3cf3fe7691481f83b591b02d939931c07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124074 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-22tdf#64991 speed up loading large RTL documentsNoel Grandin
takes load time from 2min49 to 2min5 for me Use a vector for the PortionMap since that has better cache density, and we always add to the end of it, and always in the correct order, so no sorting is necessary Change-Id: Id28e86144a86f0f1361ef4e828f925694eb3bb11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120942 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-21introduce SwNodeOffset strong typedefNoel Grandin
for indexing into node children. Replaces various usage of sal_uLong, tools::Long, sal_uInt32 with an underlying type of sal_Int32. Also add a NODE_OFFSET_MAX constant to replace usage of ULONG_MAX Change-Id: I2f466922e1ebc19029bb2883d2b29aa4c0614170 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123892 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-20loplugin:indentation check for indent inside blockNoel Grandin
look for places where the statements inside a block are not indented Change-Id: I0cbfa7e0b6fb194b2aff6fa7e070fb907d70ca2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123885 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-10use SfxItemSetFixed in swNoel Grandin
Change-Id: I69e188d7599b7fc439f613cec0a0967ccb748b7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-24no need to allocate this SfxItemSet on the heapNoel Grandin
Change-Id: I973d6ef5d3ddcb1b3cd0506c59ee63411e80a4ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122539 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-25tdf#64991 speed up loading large RTL documentsNoel Grandin
takes load time from 3min49 to 2min59 for me Use std::vector<bool> for RsidOnlyAutoFormatFlagMap, we only add values to the end so it is easy to correctly size this; and std::vectior<bool> is way more cache-dense Change-Id: Ia607c6a4d80a49a25d487d9ddde5041c166e966c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121009 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-19Move svl::Items to include/svl/whichranges.hxx, and unify its usageMike Kaganski
... in WhichRangesContainer and SfxItemSet ctors. Now it's not needed to explicitly use 'value' in WhichRangesContainer's ctor, or create an instance for use in SfxItemSet ctor (svl::Items is already defined as a template value of corresponding type). Instead of WhichRangesContainer Foo(svl::Items<1, 2>::value); SfxItemSet Bar(rItemPool, svl::Items<1, 2>{}); now use: WhichRangesContainer Foo(svl::Items<1, 2>); SfxItemSet Bar(rItemPool, svl::Items<1, 2>); Change-Id: I4681d952b6442732025e5a26768098878907a238 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119157 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-15WhichRangesContainer, reduce malloc in SfxItemSetNoel Grandin
SfxItemSet shows up in perf profiles frequently, and the hottest part is the malloc of the two arrays we need. But most of the time, one of those arrays is a compile-time constant. So this change introduces (*) WhichRangesContainer, which manages whether the SfxItemSet owns the array it points at or not. (*) a static const member in svl::Items (idea from mkaganski) to store the data. Change-Id: Icb8cdbc4d54fd76739565c575e16a744515e5355 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118703 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-12try to restore SwpHints::MergePortions (2nd attempt)Noel Grandin
seems commit 4a93efcf6e7982146fb71e4d32760a07a0f984c2 Author: Noel Grandin <noelgrandin@gmail.com> Date: Thu Jul 8 15:16:29 2021 +0200 try to restore SwpHints::MergePortions... was not good enough Change-Id: Ic5b9d9d7081ab3bc814388332672ff950fb84802 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118772 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
2021-07-10try to restore SwpHints::MergePortions...Noel Grandin
... logic to how it was trying to work before I started messing with it in commit 568b820bc2d52c007ee08ad7a3849c94a458115d Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Tue Dec 17 15:11:34 2019 +0200 tdf#119227 fix freeze when copying a large bulleted list freeze goes from 5 seconds to about 1 second for me (1) used unordered_map instead of map (2) don't create temporary SfxItemSet's just to check equality and then I tried to fix that in commit 18e4367c33f327cf09985105bde583cdcc7b2a46 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Thu Sep 3 14:40:32 2020 +0200 tdf#132688 diacritics broken in lines with punctuation regression from commit 4b2d4f3c4a68361a6bc03c9ab110ce9376b14b20 tdf#119227 fix freeze when copying a large bulleted list and then Andreas tried some more in commit 003d65ef1305eefb43315f93bdf10cee787f90f0 Author: Andreas Heinisch <andreas.heinisch@yahoo.de> Date: Mon Jul 5 22:32:52 2021 +0200 tdf#140197 - Letter cut off at certain zoom-level regression from commit 4b2d4f3c4a68361a6bc03c9ab110ce9376b14b20 tdf#119227 fix freeze when copying a large bulleted list Change-Id: Id9d04f96ccbe496ed809cf08e7aab25d6464913f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118643 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-10make SwpHints::MergePortions a little easier to readNoel Grandin
by extracting the attribute to a separate function, where we can use early return to exit the loops more naturally. Change-Id: Ibd189065f0e435be398db232b317f025192b3ee9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118589 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-06tdf#140197 - Letter cut off at certain zoom-levelAndreas Heinisch
regression from commit 4b2d4f3c4a68361a6bc03c9ab110ce9376b14b20 tdf#119227 fix freeze when copying a large bulleted list Change-Id: Ib69af488fcd30553b4aa4fd3f4b35b5a08d67adc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118455 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-14tdf#108518 revert OOo hack: Fix issue #i119405: Numbering text styleJustin Luth
...changed after importing the *.doc 2012 commit 1c22545edf9085b9f2656ca92781158b6b123db3 This hack has been made irrelevant by layout support for copying paragraph CR formatting to the numbering. It can be improved even more for DOC by supporting RES_PARATR_LIST_AUTOFMT. The OOo guys who made this knew it was a hack. They document in https://bz.apache.org/ooo/show_bug.cgi?id=119405#c11 > Negative Impact: > Although most common user scenarios can be met by the solution, > there are still negative impacts. Because the attributes of > paragraph end mark(0x0D) will be set to the character style > binding to the given level of a number rule, > it will have the global impact. > Other paragraphs that are applied with the same number rule's > level will also be changed. > Generally, MS Word users will have their numbering/bullets > the same attributes/style when using the same level's > of number rule, correspondingly,the impacted scenarios are rarely. So, the bad thing that was happening was that any paragraph's CR formatting could change every instance of the numbering level's formatting - not just that one paragraph's number. The first instance of the defined formatting won. tdf#133410: Also, it spammed a new char style for every numbering level. This patch depends on an earlier commit. The unit test ensures that this earlier commit exists. It was the only example I found where reverting the hack failed. Change-Id: I43b88b8219c9dbc882f57d1a282749d7c0ab2a19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112320 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-05-30std::unique_ptr -> std::optionalNoel Grandin
Change-Id: I78e5995b1a5cccff9c632ef4bcf75ea3ec01ff65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116382 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 Vajna
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-02-23tdf#135774, tdf#114799 Char highlight: apply to numberingJustin Luth
This is a partial revert of LO 7.0's commit 315d56582f8a56d8f2d3ea6cda63ea4832249608 The character background is exported as either w:highlight or w:shd, based on a user setting. w:shd does not affect numbering in MS Word, only the 16 color w:highlight does. (tools - options - Load/Save - Microsoft Office - Character highlighting export as: Highlight or Shading) I replaced tdf114799.docx with a version that uses w:highlight instead of w:shd. The test was doing it backwards - MS Word was NOT highlighting the numbering in the original unit test. I added another test using the original unit test to ensure that the numbering was not affected by the paragraph's char shading. There are many other "Char highlight:" patches in 7.2 that are not going to be backported. See http://wiki.documentfoundation.org/Documentation/CharHighlight for more details about this topic. Change-Id: I38b6f700895e29f634f07430f6c7a13722ffa4f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111201 Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
2021-01-11Revert "Revert "NotifyClients no more""Bjoern Michaelsen
- ... and ensure caching gets checked in SwFormat this time. This reverts commit d988b0cdeb54d84a0347a036a277c21c12544ab9. Change-Id: Iea887f841c47cde4a025a305eb0984392e3bb5cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109037 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2021-01-05Revert "NotifyClients no more"Stephan Bergmann
This reverts commit 96bafa464ebdbce3ef04bec9beae5e745bb37794. It started to cause an ASan heap-use-after-free during CppunitTest_sw_uiwriter, see the comments starting at <https://gerrit.libreoffice.org/c/core/+/108604/ 5#message-681a6100cff11cb51d20e5a2b2fb38da1f92ab32> "NotifyClients no more". Change-Id: Id0eef2e75ea047d4b337c51df929eea81fb69f5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108717 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-01-03NotifyClients no moreBjoern Michaelsen
... and prevent recursive invalidation in SwAnchoredObject. Change-Id: I6f386f3ffded29663fcc74c2679b76c1b839f367 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108604 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-11-24tdf#42949 Fix new IWYU warnings in directory swGabor Kelemen
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-17sw_fieldmarkhide: replace IsHideRedlines() with HasMergedParas()Michael Stahl
... where obvious. Change-Id: Id941d59feea5a3539da9006725ef376b14bc7d1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105982 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-01std::set->o3tl::sorted_vector in SwpHintsNoel Grandin
Change-Id: I6affafb9733495c07c322abc9ac7456862df1332 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105134 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-01sw/source/core/doc: Stop abusing observer pattern for code obfuscation.Bjoern Michaelsen
The old SwClient/SwModify combo is a questionable implementation of the observer pattern (among other things). The one thing the observer pattern is good for is dependency inversion: The creator of the message does not need to know the type of the receiver. Calling the message handling on the receiver directly introduces tight coupling and entirely defeats the purpose, leaving us with the worst of both worlds. In such case, at least be honest about the tight coupling and call a somewhat more explicit member function of the target. Thus introduce SwFootNoteInfo::UpdateFormatOrAttr, SwContentNode::UpdateAttr, remove some useless SwFormatChg clutter in Set{Foot,End}NodeInfo, and check for some invariants in SwContentNode::SwClientNotify to limit some of the "a message are two void pointers" madness. Change-Id: I32a8d6973231bb5f65c9e144be72d5bcf98f3f44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105104 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-10-30tdf#98868 re-register cloned TOXMark if the dest doc is differentCaolán McNamara
if the SwTOXType is from a different document that the target, re-register the TOXMark against a matching SwTOXType from the target document instead Change-Id: Ib9e5a2c437a7510712a10f41c551f0813a8323db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104910 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-30SwNode::GetDoc can return a reference insteadCaolán McNamara
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-29SwNodes never passed a null SwDoc*Caolán McNamara
and some more like that Change-Id: I02dae666d8935a90afd9c43cfb32a048c69a1d4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103628 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-22OUStringLiteral/OStringLiteral coverity PARSE_ERROR workaroundCaolán McNamara
do more like commit 121771e37f7e2de41cd5643475861062bf25627b Date: Mon Sep 21 09:17:54 2020 +0200 Make some OUStringLiteral vars constexpr cause coverity can live with that Change-Id: I9efd7f848289c4865997a44c6780373068422227 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103147 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-03tdf#132688 diacritics broken in lines with punctuationNoel Grandin
regression from commit 4b2d4f3c4a68361a6bc03c9ab110ce9376b14b20 tdf#119227 fix freeze when copying a large bulleted list Change-Id: I7d54b19c7a02c717426edce7896caaadf909154e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102000 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2020-08-28Change OUStringLiteral from char[] to char16_t[]Stephan Bergmann
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-13loplugin:stringstatic also look for local staticsNoel Grandin
Add some API to O*StringLiteral, to make it easier to use in some places that were using O*String Change-Id: I1fb93bd47ac2065c9220d509aad3f4320326d99e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100270 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-31loplugin:flatten in sw/core/txtnodeNoel Grandin
Change-Id: I0003a190cbc42845274d71f8f157977e598a3fd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99859 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-26Fix loplugin:simplifypointertobool for libstdc++ std::shared_ptrStephan Bergmann
...where the get member function is defined on a std::__shared_ptr base class, so loplugin:simplifypointertobool used to miss those until now. (While e.g. using libc++ on macOS found those cases.) 366d08f2f6d4de922f6099c62bb81b49d89e0a68 "new loplugin:simplifypointertobool" was mistaken in breaking isSmartPointerType(const clang::Type* t) out of isSmartPointerType(const Expr* e); c874294ad9fb178df47c66875bfbdec466e39763 "Fix detection of std::unique_ptr/shared_ptr in loplugin:redundantpointerops" had introduced that indivisible two-step algorithm on purpose. The amount of additional hits (on Linux) apparently asked for turning loplugin:simplifypointertobool into a rewriting plugin. Which in turn showed that the naive adivce to just "drop the get()" is not sufficient in places that are not contextually converted to bool, as those places need to be wrapped in a bool(...) functional cast now. If the expression was already wrapped in parentheses, those could be reused as part of the functional cast, but implementing that showed that such cases are not yet found at all by the existing loplugin:simplifypointertobool. Lets leave that TODO for another commit. Besides the changes to compilerplugins/ itself, this change has been generated fully automatically with the rewriting plugin on Linux. Change-Id: I83107d6f634fc9ac232986f49044d7017df83e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94888 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2020-03-02speedup sw build a littleNoel Grandin
from 11m46 to 11m21 Used ClangBuildAnalyzer to find headers that took a long time to parse (in total, across all modules). (*) moved the boost stuff out of sw/inc/docary into a new header. (*) make sw/inc/ndtxt no longer include doc.hxx Change-Id: Ia1d4ebddb4ddd4ec4ffbc011f4a5e24a42b46d3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89808 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-02-04rename Set/GetTextFirstLineOfst->Set/GetTextFirstLineOffsetNoel Grandin
Change-Id: Iaeb3c17fe157dec82cd70991122c08ee1e215752 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87955 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-18tdf#119227 fix freeze when copying a large bulleted listNoel Grandin
freeze goes from 5 seconds to about 1 second for me (1) used unordered_map instead of map (2) don't create temporary SfxItemSet's just to check equality Change-Id: I17939adb9ffd53bc56339d7a62ef217ade26de36 Reviewed-on: https://gerrit.libreoffice.org/85298 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-02tdf#42949 Fix IWYU warnings in sw/source/core/[o-t]*/*cxxGabor Kelemen
Also drop a duplicated blacklist rule found with: grep :$ sw/IwyuFilter_sw.yaml | sort | uniq -cd Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ied72f3f086ed4c1eb7ff4bcdbcf8aee73ddd4f7c Reviewed-on: https://gerrit.libreoffice.org/83250 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann
...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>