summaryrefslogtreecommitdiff
path: root/sw/source/core/text/pormulti.cxx
AgeCommit message (Collapse)AuthorFilesLines
2024-01-08cid#1545370 COPY_INSTEAD_OF_MOVECaolán McNamara1-1/+1
and cid#1545364 COPY_INSTEAD_OF_MOVE cid#1545363 COPY_INSTEAD_OF_MOVE cid#1545344 COPY_INSTEAD_OF_MOVE cid#1545299 COPY_INSTEAD_OF_MOVE cid#1545287 COPY_INSTEAD_OF_MOVE cid#1545267 COPY_INSTEAD_OF_MOVE cid#1545256 COPY_INSTEAD_OF_MOVE cid#1545226 COPY_INSTEAD_OF_MOVE cid#1545500 COPY_INSTEAD_OF_MOVE cid#1545538 COPY_INSTEAD_OF_MOVE cid#1545618 COPY_INSTEAD_OF_MOVE cid#1545681 COPY_INSTEAD_OF_MOVE cid#1545750 COPY_INSTEAD_OF_MOVE cid#1545778 COPY_INSTEAD_OF_MOVE cid#1545785 COPY_INSTEAD_OF_MOVE cid#1545799 COPY_INSTEAD_OF_MOVE cid#1545847 COPY_INSTEAD_OF_MOVE cid#1545958 COPY_INSTEAD_OF_MOVE cid#1545963 COPY_INSTEAD_OF_MOVE cid#1545990 COPY_INSTEAD_OF_MOVE cid#1546013 COPY_INSTEAD_OF_MOVE cid#1546029 COPY_INSTEAD_OF_MOVE cid#1546079 COPY_INSTEAD_OF_MOVE cid#1546104 COPY_INSTEAD_OF_MOVE cid#1546127 COPY_INSTEAD_OF_MOVE cid#1546133 COPY_INSTEAD_OF_MOVE cid#1546155 COPY_INSTEAD_OF_MOVE cid#1546190 COPY_INSTEAD_OF_MOVE cid#1546216 COPY_INSTEAD_OF_MOVE cid#1546273 COPY_INSTEAD_OF_MOVE cid#1546315 COPY_INSTEAD_OF_MOVE cid#1546326 COPY_INSTEAD_OF_MOVE cid#1546387 COPY_INSTEAD_OF_MOVE accept some reasonable suggestions Change-Id: I7b004086d490c7618d8fe7a21a53cfa8ac1f8408 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161748 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-28Flatten a bit: !pNode was excluded aboveMike Kaganski1-25/+23
Change-Id: If109ff4b5cfbb45ae7844765a4f615b6b77c6c03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161324 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-30use more SwTwips in CalcSpacingNoel Grandin1-3/+3
Change-Id: Ic7409c2993014f97531f3d77533cf7a82712707a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160122 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-07ITEM: Get away from classic 'poolable' Item flagArmin Le Grand (allotropia)1-2/+2
To understand this, some look back in history will be needed to see why it is as it is today. In some (reworked) comments 'poolable' is described as flag to hold Items in the ItemPool, also always having only one incarnation of each possible Item. This is not the original intention, but a side-effect. The reason is what the binary format in the office did: To save a document, the Objects & the Pool were saved, *not* individual Items *together* with the objects. The Pool was completely (binary) saved (and loaded) in one run. Temporary IDs were used to represent at the objects in file which Items were referenced. This *required* to have only one incarnation per item to have a minimal binary file size, thus this high effort was put into this. At doc load, the pool was loaded, all Items were set to RefCount 5000, the references from the objects were restored and then for each Item the RefCount was lowered by 5000 again and - if being zero - deleted. Items for UI were marked 'non-poolable' to *not* safe them with the document, so poolable was a flag to decide if that Info/Item was to be saved with the document - or more direct: if it is Model Data. Items are small, so if we prefer runtime it is okay to no longer being strict with this, anyways does not happen often and has only marginal memory effects - compared to runtime effects/savings. Other problems which this caused: One example is that objects in the UNDO stack were still in the pool, so e.g. deleted pictures were saved with the document despite no longer being used (!). That is the reason we have an UndoItemPool and a method MigrateItemPool to move stuff to that Pool when objects go to the UNDO stack - all of this is also no longer needed. Cleaning this up means to ideally have all items in the SfxItemSet, no longer at the Pool. The Pool should be reduced to a 'Default-Item- Holder' and a 'Slot-to-whichId-mapper'. This needs thorough cleanups/removals, but will be worth it because that massive simplification(s) will increase safety an runtime and make migrating to the goal of completely type-based ItemSet stuff easier for the future. Hopefully only view code in the office working with items will have to be changed for this. In this 1st step I already found that some 'compromizes' will be needed: - There are still Items that have to be at the pool to make the Surrogate-stuff working. This gives back all Items in a Pool of a type and is used in ca. 80 cases. Each one looks at these Items *without* context (e.g. a SfxItemSet at an Object would be a context), so if e.g. a dialog is open that temporarily uses Items of that type you would also get these - without knowing about it... To make that work there is still a mechanism to have Items at the Pool, but now just *registering* (and un-reg) them without any sort/search/ remove needs. Also only for Items that need that, so I evaluated the GetItemSurrogates calls and added some asserts when GetItemSurrogates tries to access an unregistered item type which needs to be added. - Another caveat is that there are about 250 places that directly put Items to the Pool (not all remove these, that is done at pool deletion, so some kind of silent 'garbage-collection' is in place). To have an overview I renamed the accessing methods to separate them from the same functionality at the SfxItemSet, which had the same names. An implementation does still add these directly to the pool, there is no way to cleanup those usages for now. In principle all these should be changed to hold the data at an SfxItemSet. I am still hunting problems. But you can build the office, all apps work (including chart) and you can do speed comparisons already. There are test throwing errors, so I hunt these now. It is hard to give an estimation about how much more changes/corrections will be needed. Completed adaptions to new registered Items at Pool, that reduces the failing tests. Still many that I need to hunt. Added stuff to work around that 'compromize' in ScDocumentPool: It overloads ::PutImpl of the pool to implement special handling for a single Item in SC, the ScPatternAttr. In former code that method was used from SfxItemSet and ::PutImpl at the pool directly, so it was only used in one place. I am not sure if it was used from the SfxItemSet functionality, but better offer it for now. To not waste too much runtime the callbacks depend on the boolean 'NewItemCallback' at the SfxPoolItem, it gets set for that single Item in SC and only then the callbacks trigger. I hope to get rid of those again, e.g. newItem_UseDirect is only needed since we have no 'real' StaticPoolDefaults currently - another thing that needs to be cleaned up in a next step. Since usages of impl(Create|Cleanup)ItemEntry and Direct(Put|Remove)ItemInPoolImpl got more and more similar I decided to unify that: move impl(Create|Cleanup)ItemEntry to tooling, make it globally available in svl and use it also directly for Direct(Put|Remove)ItemInPoolImpl. This slightly increases the failing tests again, but only since in Direct(Put|Remove)ItemInPoolImpl that fallback (e.g. tryToGetEqualItem) was used before, thus this is the same class of errors (SfxPoolItem ptr-compare) as the others which I will need to find anyways. Also fixed some missing stuff. Have now idenified and redirected all SfxPoolItem ptr-compares to be able to debug these - one cause for the remaining errors is probably that before with bPoolable those often were sufficient, but are no longer. Used the [loplugin:itemcompare] and a local clang build to do so, see https://gerrit.libreoffice.org/c/core/+/157172 Stabilized Direct(Put|Remove)ItemInPoolImpl forwards, added parameter to implCreateItemEntry to signal that it gets called from DirectPool stuff - currently needed. Hopefully when getting rid of that DirectPool stuff we can remove that again Added two more debug functionalities: - Added a SerialNumber to allow targeted debugging for deterministic cases - Added registering & listing of still-allocated SfxPoolItems at office shutdown Found PtrComp error in thints.cxx - POC, thanks to areSfxPoolItemPtrsEqual. Will hopefully help more with other tests Found some wrong asserts/warnings where I was too careful and not finding something/succeeding is OK, fixes some UnitTests for SC For SC I now just tried to replace all areSfxPoolItemPtrsEqual with the full-ptr-content compare SfxPoolItem::areSame. I also needed to experiment/adapt the newItem_Callback solution but got it working. Did that replacement now for SW too, found some places where the direct ptr compare is OK. Continued for the rest of occurrences, now all 160 places evaluated. Also done some cleanups. Massive cleanups of stuff no longer needed with this paradigm change. Also decided to keep tryToGetEqualItem/ITEM_CLASSIC_MODE for now. It is used for *one* Item (ScPatternAttr/ATTR_PATTERN) in SC that already needs many exceptions. Also useful for testing if errors come up on this change to test if it is related to this. Added forwarding of target Pool for ::Clone in SvxSetItem and SvxSetItem, simplified SfxStateCache::SetState_Impl and returned to simple ptr compares in SfxPoolItem::areSame to not do the test in areSfxPoolItemPtrsEqual. Debugged through UITest_calc_tests9 and found that in tdf133629 where BoxStyle is applied to fully selected empty calc the Item- reuse fallback has to be used not only for ATTR_PATTERN, see comment @implCreateItemEntry. Maybe more... Problem with test_tdf156611_insert_hyperlink_like_excel. Found that in ScEditShell::GetFirstURLFieldFromCell the correct SvxURLField is found and returned as ptr, but it's usage crashes. That is due to the SfxItemSet aEditSet used there gets destroyed at function return what again deletes the SvxFieldItem that is holding the SvxURLField that gets returned. This shows a more general problem: There is no 'SfxPoolItemHolder' that safely holds a single SfxPoolItem - like a SfxItemSet for a single Item (if Items would be shared_ptrs, that would be a safe return value). That will be needed in the future, but for now use another solution: Since I see no reason why EE_FEATURE_FIELD should not be shareable I wil change this for ow in the SfxItemInfo for EditCharAttribField. That way the Item returned will be shared (RefCnt > 1) and thus not be deleted. I changed the return value for GetURLField() and GetFirstURLFieldFromCell() in ScEditShell: At least for GetFirstURLFieldFromCell the return type/value was not safe: The SvxFieldItem accessed there and held in the local temporary SfxItemSet may be deleted with it, so return value can be corrupted/deleted. To avoid that, return a Clone of SvxFieldData as a unique_ptr. With all that UnitTest debugging and hunting and to get the paradigm change working to no longer rely on shared/pooled items I lost a little bit focus on speed, so I made an optimization round for the two central methods implCreateItemEntry/implCleanupItemEntry to get back to the speed improvements that I detected when starting this change. It was mainly lost due to that 'strange' chained pool stuff we have, so I added to detect the target pool (the one at which the WhichID is registered) directly and only once. Next thing to cleanup will/should be the pool and it's concept, all this is not needed and really costs runtime. Since implCreateItemEntry/implCleanupItemEntry are executed millions of times, each cycle counts here. Had an error in the last changes: pool::*_Impl methods use index instead of WhichID - most of them. Another bad trap, I really need to cleanup pool stuff next. Change-Id: I6295f332325b33268ec396ed46f8d0a1026e2d69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157559 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-11-02sw: PDF/UA export: produce Link SEs for RTL textMichael Stahl1-0/+5
This is a SwBidiPortion containing a nested SwLineLayout containing SwLinePortions for the link or text, and only the SwBidiPortion had a tag helper, so add one for the inner portion too. (Apparently this never worked before.) Change-Id: I803191dafe101a42e4dbe1c0167411c2f1f76a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158773 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-10-25vcl,sw: PDF/UA export: produce Ruby and Warichu SEsMichael Stahl1-1/+31
These need to generate multiple elements in SwTextPainter::PaintMultiPortion() and it's not altogether obvious. Change-Id: Ib5fd36c3ea8e15dff93a87bb231c3cc4f78b0089 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158398 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-10-16ofz#63295 Null-dereference READCaolán McNamara1-1/+1
Change-Id: Ib8bfa814099c1c1f3d65b18026ea812c80b6e9c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158058 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-09-25ofz#62688 Null-dereference READ in SwRubyPortion::SwRubyPortionCaolán McNamara1-4/+9
seen with fodt2pdf fuzzer Change-Id: If761f5ecc473f4c936db82f3fcb7dd891e82573f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157243 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-08-20ofz#61511 Direct-leakCaolán McNamara1-0/+3
Change-Id: Id1510fb8271a67cc924e2751d5081f54da209ae8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155869 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2022-10-27tdf#151736 writer direct formatting crashNoel Grandin1-5/+14
regression from commit 9a44807ff3a11afa8f7ce9857ae6a6144a61d481 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Wed Mar 2 17:58:31 2022 +0200 use SfxItemSet::GetItemIfSet in sw/source/core/txt Change-Id: I9db016d608300c603d0b1386962b188dddc85125 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141943 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-19unique_ptr->optional in SwFontSaveNoel Grandin1-7/+6
Change-Id: I57acbc3f43eed6db49e475377b18c0c497acc8c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138504 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-05Fix typosAndrea Gelmini1-1/+1
Change-Id: I77ad3b01dbb2e8f8438b6f4a30ca2239490fb8f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132537 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-04-01sw layout xml dump: handle hyph portionsMiklos Vajna1-5/+16
Also pass around the text frame's text / offset. This allows showing the text of the portions even inside multi-portions, which is not possible with the a11y-based approach. Change-Id: Ief8963ed0514fbe4b2abb24e93777865ec1d9242 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132366 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-03-15make CreateTextLayoutCache() cached (tdf#116400)Luboš Luňák1-1/+1
The result depends only on the string, so it's possible to cache it easily, and caching this for text drawing calls can have a good hit rate. Change-Id: I56c6e254cc176ab07afe0df24ed37b19579fe64d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131556 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-03use SfxItemSet::GetItemIfSet in sw/source/core/txtNoel Grandin1-30/+18
Change-Id: I386bc04447d8c900a4ae3a7caa44860731b1bf84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130880 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-27tdf#64991 speed up loading large RTL documentsNoel Grandin1-3/+5
takes load time from 20s to 17s for me Several loops are very hot, so store the count()/size() value, instead of calling it on every iteration. Change-Id: I8c0b01721d27e4335dd613cf276dcdd0103633ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120945 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-06tdf#144122 Use signed type to avoid stealthy underflowAron Budea1-7/+7
301278b656e76b6f42af5cf8a6f5c6c02acfffeb and 6fdd0a3f8b3448a9a246496191908c92156cc38b switched some sal_uInt16 types to sal_uInt32. Additional commits related to the change: 9e075acf2bf1ce6c43fdf5b601507ee0663bd691 and 2634bc59092b24217d984a5845365d703bdb08d2. A fallout from this change was tdf#144305, fixed via 0c3e47cc2f0570a7cd8ff4889763991a86b29f26. Instead of adding further casts to force conversion to signed to avoid unsigned types underflowing into large positive numbers, convert these types to signed SwTwips. Change-Id: Icb7fbae79621d452cd03bb01dc620f60a26f1db0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123014 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-09-17sw layout xml dump: show SwMultiPortionMiklos Vajna1-0/+14
This helped fixing tdf#144305. Change-Id: I736f12b06a69a1c11a55487dc1a3eec976250dcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122207 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-09-14tdf#144305 sw: fix rendering of ruby portions with non-default ruby alignmentMiklos Vajna1-1/+1
Regression from 301278b656e76b6f42af5cf8a6f5c6c02acfffeb (sw: allow the height of a line to be larger than 65536 twips, 2021-05-20), the problem was that changing from sal_uInt16 to sal_uInt32 broke SwRubyPortion::Adjust_(), which relied on integer promotion rules to have a negative diff. Old storage size was smaller than int, so got promoted to signed int, so the result could be a small negative number. New storage size is an unsigned int, so no promotion happens, so the new result was a large positive number. Fix this by casting to signed int explicitly. Change-Id: I8778c1bd0d62e27c99d4ceb1bb7bc6107a179803 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122048 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-08-30vcl: move TextLayoutCache into vcl::text namespaceChris Sherlock1-1/+1
Placed TextLayoutCache function into own source file and moved it into the new vcl::text namespace. With this patch we will have these vcl::* namespaces: namespace vcl::bitmap namespace vcl::CommandInfoProvider namespace vcl::detail namespace vcl::drawmode namespace vcl::fileregistration namespace vcl::filter namespace vcl::font namespace vcl::graphic namespace vcl::lok namespace vcl::pdf namespace vcl::table namespace vcl::test namespace vcl::text namespace vcl::unohelper namespace vcl::unotools Change-Id: Ia38c2d73715676a924cdbb0de6308a72a40ec3b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121206 Reviewed-by: Hossein <hossein@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2021-06-09sw: allow the width of a line portion to be larger than 65536 twipsMiklos Vajna1-1/+1
The line portion width can be quite large if the line contains an as-char image. Found by asking -fsanitize=implicit-unsigned-integer-truncation -fsanitize=implicit-signed-integer-truncation to flag the problematic conversions. Change-Id: I303b9c71dcd979d79b9c9aee5283b268cc4e3b8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116835 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-05-29no need to allocate these on the heapNoel Grandin1-54/+54
Change-Id: I07a1fd5833bc61eb97649ac5d85b1b0eb3054baa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116367 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-26fix leak in BuildMultiPortionNoel Grandin1-3/+4
Change-Id: I267d59bdc8ac2f17d223d0345c4bcb4ea40a8704 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116149 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-5/+5
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-21sw: eliminate recently added static_cast<SwTwips>() callsMiklos Vajna1-4/+4
This was added in commit 301278b656e76b6f42af5cf8a6f5c6c02acfffeb (sw: allow the height of a line to be larger than 65536 twips, 2021-05-20) to fix -Werror,-Wsign-compare problems, but 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: I2f62420457e3d053e6fbc3b787b3c224c6f0586c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115903 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-05-20sw: allow the height of a line to be larger than 65536 twipsMiklos Vajna1-5/+5
The line height can be quite large if the line contains an as-char image. Found by temporarily changing static_cast<sal_uInt16>() in sw/ to a template function to make these conversions implicit (excluding cases where the input and output types can't convert implicitly), then asking -fsanitize=implicit-unsigned-integer-truncation -fsanitize=implicit-signed-integer-truncation to flag the problematic conversions. The first hit was in SwFlyCntPortion::SetBase() (that's where 67408 turns into 1872), then the same pattern at many other places. Change-Id: Ie12f490ed8dd5c531f11506c97598ce4f7610e2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115873 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-03-17sw: prefix members of SwIsoRefPortion, SwIsoToxPortion, ...Miklos Vajna1-46/+45
... SwSoftHyphPortion and SwSpaceManipulator See tdf#94879 for motivation. Change-Id: Ib7034bfa158885d23cf51b9db2e8f7095885cf39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112595 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-02-01sw: prefix members of FormatLevel, SwNumberPortion, SwPostItsPortion and ...Miklos Vajna1-11/+11
... SwRubyPortion See tdf#94879 for motivation. Change-Id: I24bb59ea921cdea2888d5a1009db5030e4ee897a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110239 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-01-25sw: prefix members of SwBidiPortion, SwDoubleLinePortion, ...Miklos Vajna1-67/+67
... SwGrfNumPortion and SwSaveClip See tdf#94879 for motivation. Change-Id: Iade32e16fa36555aacbfe794895d015bee0226de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109866 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-12-24custom literal for Degree10Noel Grandin1-2/+2
Change-Id: Id13869138a622e62d9ffebf2c89bddccda6aff01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108238 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-28convert some more long -> tools::LongNoel1-2/+2
grepping for stuff in template params this time Change-Id: Ia37bfd85480b3a72c3c465489581d56ad8dde851 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104855 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-21new tools::Degree10 strong typedefNoel Grandin1-2/+2
partly to flush some use of "long" out the codebase, but also to make it obvious which units are being used for angle values. Change-Id: I1dc22494ca42c4677a63f685d5903f2b89886dc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104548 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-20use tools::Long in swNoel1-10/+10
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-07-31loplugin:flatten in sw/core/textNoel Grandin1-12/+12
Change-Id: I086860cefe9f26c3728fe0d8266c35dae37b9570 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99887 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-02crashtesting: fix abi11870-2.odt assert in SwBookmarkPortion::Unchain()Michael Stahl1-1/+7
This m_pPrevious pointer is a bad idea, should just use FindPrevPortion() to find it, which shouldn't take that long to iterate all the portions in the current line. (regression from 4ce8120f1e53f7b81e653b01d141643013bc69ab) Change-Id: Ibb5f2bb28d959958547ed27c51e5084cc746d642 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91622 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-03-02speedup sw build a littleNoel Grandin1-0/+1
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 GetCursorOfst -> GetModelPositionForViewPointNoel Grandin1-1/+1
Change-Id: Ia7202e009f635032178e5467a1ac0ab43f82ccf2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87953 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins
2020-01-30tdf#45589 sw: create and paint text portions for bookmarksMichael Stahl1-0/+14
Add a new SwBookmarkPortion, derived from SwControlCharPortion. There is no character for the bookmark in the text so the portion has length of 0, which makes things quite a bit more tricky. Formatting: * SwBookmarkPortion is created last in WhichFirstPortion(). * In an empty paragraph the SwTextFrame::FormatEmpty() must be disabled. * If there's a bookmark at the end of a paragraph, SwTextFormatter::CalcAscent() must use the font of the previous character, not the paragraph font, because that could grow the line if it's higher. * The SwMultiPortion complicates matters, because it uses a nested SwTextFormatInfo and thus we need some extra steps to prevent duplicate SwBookmarkPortions; this is particluarly a problem for rotated text portions. - SwTextFormatter::BuildPortions() must advance the outer SwTextFormatInfo's bookmark position because BuildMultiPortion() has already created the SwBookmarkPortion. - If a SwBookmarkPortion is at the start of a SwMultiPortion, it will be created before the SwMultiPortion but must be painted inside the SwMultiPortion because its font is going to be initialised as inside the SwMultiPortion (e.g. it will be rotated) so its position must also be adapted to be inside, and only SwTextPainter::PaintMultiPortion() does the setup for that; add a hack to move it in SwTextFormatter::BuildMultiPortion(). Painting: * Using the original font seems rather difficult, hard to predict what some character is going to look like, and how it scales if the size is increased; use OpenSymbol instead. Unfortunately OpenSymbol doesn't have a good glyph that could be used for both the end of a bookmark and start of another bookmark at the same position. * SwLinePortion::PrePaint() wants to avoid moving the portion half-outside the frame but often it looks better that way (previously it was misaligned, now it's half-outside). * Not sure if it makes sense to draw a field shading in SwTextPaintInfo::DrawViewOpt() too; let's try it out, but dependent on the same IsViewMetaChars() setting as the bookmark character itself, not on the field shading setting. Change-Id: I1ab94afb417221e278dbb3afd6c978a05fc78497 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87364 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Michael Stahl <michael.stahl@cib.de>
2019-12-11convert SwFrameSize to scoped enumNoel Grandin1-1/+1
Change-Id: I7e1e641ff180035c7dcefdcfdd185eadbae32142 Reviewed-on: https://gerrit.libreoffice.org/84850 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 Kelemen1-6/+0
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-26cppcheck: performing init in init list (sw/vcl/xmloff)Julien Nabet1-3/+3
Change-Id: I8e6c77847e1c2ec386c27c34b75160f4a44da2fe Reviewed-on: https://gerrit.libreoffice.org/83717 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann1-0/+7
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend loplugin:external to warn about enums". Cases where free functions were moved into an unnamed namespace along with a class, to not break ADL, are in: filter/source/svg/svgexport.cxx sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xilink.cxx svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx All other free functions mentioning moved classes appear to be harmless and not give rise to (silent, even) ADL breakage. (One remaining TODO in compilerplugins/clang/external.cxx is that derived classes are not covered by computeAffectedTypes, even though they could also be affected by ADL-breakage--- but don't seem to be in any acutal case across the code base.) For friend declarations using elaborate type specifiers, like class C1 {}; class C2 { friend class C1; }; * If C2 (but not C1) is moved into an unnamed namespace, the friend declaration must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither qualified nor a template-id and the declaration is a function or an elaborated-type-specifier, the lookup to determine whether the entity has been previously declared shall not consider any scopes outside the innermost enclosing namespace.") * If C1 (but not C2) is moved into an unnamed namespace, the friend declaration must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882> "elaborated-type-specifier friend not looked up in unnamed namespace". Apart from that, to keep changes simple and mostly mechanical (which should help avoid regressions), out-of-line definitions of class members have been left in the enclosing (named) namespace. But explicit specializations of class templates had to be moved into the unnamed namespace to appease <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of template from unnamed namespace using unqualified-id in enclosing namespace". Also, accompanying declarations (of e.g. typedefs or static variables) that could arguably be moved into the unnamed namespace too have been left alone. And in some cases, mention of affected types in blacklists in other loplugins needed to be adapted. And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is not moved into an unnamed namespace (because it is declared in sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler doesn’t give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions." (<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The warned-about classes also don't have multiple definitions in the given test, so disable the warning when including the .cxx. Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4 Reviewed-on: https://gerrit.libreoffice.org/83239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-21sw: prefix members of SwTextFormatterMiklos Vajna1-4/+4
See tdf#94879 for motivation. Change-Id: I65dd12dc738a1b3e8727832ba4c7dd47e3cbabfc Reviewed-on: https://gerrit.libreoffice.org/81205 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-09-01Fix '..'Andrea Gelmini1-1/+1
To complete this: https://gerrit.libreoffice.org/#/c/78312/ This is a massive replace for lines ending with ".." instead of "..." It passed "make check" on Linux. Change-Id: I07fa7b2e30ba9ea17a1f9a5e21c57216ba958efe Reviewed-on: https://gerrit.libreoffice.org/78356 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2019-08-05Fix typosAndrea Gelmini1-2/+2
Change-Id: I63ab268d908477f8847b315f44f6ffd543b17794 Reviewed-on: https://gerrit.libreoffice.org/76969 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-05-30GetAnyEnd does not need to return a pointerNoel Grandin1-4/+4
Change-Id: I1350a340eddad180447c46175b6b21ce787802f3 Reviewed-on: https://gerrit.libreoffice.org/72952 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-15improve loplugin simplifyconstructNoel Grandin1-2/+2
to find stuff like OUString s = OUString("xxx") Change-Id: Ie7ed074c1ae012734c67a2a89c564c1900a4ab04 Reviewed-on: https://gerrit.libreoffice.org/70697 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-01sw: prefix members of SwMultiPortionMiklos Vajna1-1/+1
Change-Id: I00625ac33876d541117592cfb385d3bbd981a9a6 Reviewed-on: https://gerrit.libreoffice.org/70045 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-02-10loplugin:indentation in swNoel Grandin1-1/+1
Change-Id: I4936284bff568b6bb47e5df3821f4ddd78260e92 Reviewed-on: https://gerrit.libreoffice.org/67568 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-18convert POR constants to scoped enumNoel Grandin1-1/+1
Change-Id: Ia146f1f932cf4437e2e7e20722b0957a458979fd Reviewed-on: https://gerrit.libreoffice.org/66514 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>