summaryrefslogtreecommitdiff
path: root/sw/source/core/edit
AgeCommit message (Collapse)AuthorFilesLines
5 daysloplugin:constantparam in swNoel Grandin1-6/+4
Change-Id: Ia1379762ba957097a1a2134c5d206f254e22683b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
5 daysloplugin:constantparam in swNoel Grandin1-10/+4
Change-Id: Idf7d3abd464b7be87d109d14adf94357a5d49dd5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166312 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-10tdf#146619 Drop unused 'using namespace' in: sw/Gabor Kelemen2-2/+0
Change-Id: I56463130ab617b0e11e237718cb8456913373818 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165696 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-03-21ITEM: Remove InvalidateAllItems()Armin Le Grand (allotropia)1-2/+1
I checked if this is used, but it can be replaced using Clear() -> all. This prevents that the whole array of Items in an ItemSet gets set to INVALID_POOL_ITEM. I also checked if INVALID_POOL_ITEM/IsInvalidItem is needed at all representing SfxItemState::DONTCARE but it is and still will need to be set for individual Items. At last checked if SfxItemState::UNKNOWN and ::DISABLED really need to be separate states, but indeed there are some rare cases that need that. To make things more consistent I also renamed SfxItemState::DONTCARE to SfxItemState::INVALID to better match Set/IsInvalid calls at ItemSet. The build showed a missing UT and led to a problem due to the hand-made ItemSet-like SearchAttrItemList. The state 'invalid' seems to be used as 'unused' marker. It should be changed to use SfxPoolItemHolder and not need that. For now, set by using an own loop to set to that state. Change-Id: Ifc51aad60570569a1e37d3084a5e307eed47d06c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165035 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-03-09tdf#160095: fix crash when using ALT+RETURN twiceJulien Nabet1-0/+3
Change-Id: Idc4c84039115c8d88418246a17e281c26fb49b70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164592 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-06sw: SelectAll of section with RES_PAGEDESC corner-caseMichael Stahl1-0/+8
The main problem here is that if a document has a RES_PAGEDESC on its first body text node, and you paste a section whose first text node also has a RES_PAGEDESC, the result inevitably has a page break that wasn't there before, and which is unwanted. SwEditShell::CopySelToDoc() needs a change to include the end node of a section at the start, so it is copied. Change CopyImplImpl() to insert a non-textnode *before* a text node at the insert position, instead of after it. This simplifies the implementation: only SwFEShell::Paste() needs to care about removing an empty trailing paragraph, but SwEditShell::CopySelToDoc() needs no changes; both functions would need to delete the empty paragraph when inserting after. Several tests such as CppunitTest_sw_ooxmlexport3 testCrashWhileSave fail because of this, which can be solved by removing the DelFullPara() call in SwXText::copyText() that is now unnecessary. Generalise and simplify the "bAfterTable" code in CopyImplImpl(): it doesn't really matter what is before the insert position, what matters is if the pasted text starts with a table or section. Also, the fly-anchor-correction code (both here and in SwUndoInserts::RedoImpl()) needs to move to the first text node also in case a section was inserted (but the equal-looking code *before* inserting remains as is!), in the situation where the last node will be deleted. Now there are some test failures: unowriter.cxx:430:Assertion Test name: (anonymous namespace)::testSectionAnchorCopyTableAtStart::TestBody equality assertion failed - Expected: quux foo bar - Actual : quux foo This is because the end position was created from SwNodeIndex aInsPos only, it needs to take also the aDestIdx from the "if (pEndTextNd)" branch. testTdf134250::TestBody finished in: 867ms uiwriter2.cxx:462:Assertion Test name: testTdf134250::TestBody equality assertion failed - Expected: 1 - Actual : 2 The section is pasted now, so there are 2. uiwriter3.cxx:1519:Assertion Test name: testTdf135733::TestBody equality assertion failed - Expected: 1 - Actual : 2 Table is now inserted before the first paragraph, which has a RES_PAGEDESC. (presumably regression from commit 9667e5ffd18d6167344e102b89a393bc981644ec) Change-Id: I820e381113fee90a81249afbc2280bfc3ddb7647 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164401 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-03-03cid#1592910 Dereference null return valueCaolán McNamara1-1/+4
Change-Id: I7524c3e91447f4421083dfda10d3dd1c3a6e482d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164300 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-03-03cid#1592908 Dereference null return valueCaolán McNamara1-1/+2
Change-Id: Ic729d455047f31983425b3483deeb8d7448f5cd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164299 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-03-01tdf#146356 insert new paragraph before table of contentsOliver Specht1-61/+86
Alt+Enter inserts the new paragraph before the content section of a table of contents. At the same time protected indexes now also have the header protected. Change-Id: Iff267691d96796158c1593c4269b76226840c952 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164050 Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-02-18ITEM: Rename for more control over SlotID usagesArmin Le Grand (allotropia)1-1/+1
Change-Id: I51585f1c15984a066262023184f668662853d20f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163556 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-02-17Generalize search algorithms in sorted_vectorMike Kaganski1-2/+1
This allows to simplify the code somewhat, and also to relax requirements to the arguments, e.g. allowing to pass const objects to search in vector containing non-const objects. Change-Id: Id34911a8694bbdec275d22b51ca4a0845c9fa4c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163519 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-16Deduplicate and unify SwNodes::Go(Next|Prev)(Section)Mike Kaganski6-9/+8
The "Next" methods are made static, just as "Prev" ones. Overloads taking SwNodeIndex and SwPosition are implemented using a common implementation function, to avoid code duplication. Change-Id: I4035188b5c29d19824cd6d031e05d668d5cf1e86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163443 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-14tdf#159565 prerequisite: make hidden sections have zero-height framesMike Kaganski1-1/+1
As mentioned in commit bb733957dd39e6f0b9d80bb59eb0177188794797 (tdf#114973 sw: enable SelectAll with hidden para at start/end, 2023-01-27), the hidden sections didn't have frames. That prevented correct handling of the case when such a frame was in the beginning of the document. This change re-implements the hidden section to use 0-height frames, like hidden paragraphs, as a pre-requisite for a follow-up change. Some layout breakages noticed while working on this are unit-tested now. This change needed to handle the case when the first section is hidden, and then goes a page break with page style. In this case, the page style must apply to the very first page of the document. Implementing this now, when the frame that defines the page style is not the first in the document, I accidentally fixed also the previously broken case when the first paragraph was hidden. Now the page style defined in the second paragraph's page break will apply correctly. This change makes hidden sections break outer section's frames. This means that when text borders are shown, there will be an artifact in the place of the hidden sections (a horizontal line breaking outer frame). I suppose it's not a problem, actually helping to see the layout better, so in line with the "show text borders" helper functionality. If this proves to be problematic, this can be handled specially in a follow-up. Change-Id: I14ebf0559b463186aba28902cd10c5cc978ba456 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163151 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-27ITEM: Cleanup some Pool stuff with DefaultsArmin Le Grand (allotropia)1-1/+1
Sorted out some methods at ItemPool which process Defaults to make more clear what is going on and what which method is doing. Change-Id: I2568d3e03d0a56a14b6fe4e04521e1a8e22c000b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162643 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-01-27Drop std::as_const from css::uno::Sequence iterationsMike Kaganski1-2/+2
Obsoleted by commit 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and commit fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code, 2021-11-05). Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-18tdf#109272: make sure that Delete / Backspace move cursor correctlyMike Kaganski1-3/+5
... in change tracking mode. Cursor's end position now doesn't depend on the selection direction; it is at the deletion's beginning in case of Backspace, and at deletion's end in case of Delete. Change-Id: I9cb7af235a066bea2c7b21b8ff515dcdd52218c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162240 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-12ITEM: No longer register Items at PoolArmin Le Grand (allotropia)1-2/+6
The issue is that the flag RegisteredAtPool at the SfxPoolItem is Pool-dependent: It marks that the Item is registeres at *one* Pool/Model. This makes it Pool-dependent. Due to this there is no way to share Items that need to be registered globally/ in multiple Pools/Models what is one of the goals for optimal sharing. We can also not live without having access to all Items associated with the Pool, due to mechanisms in place like the Surrogate stuff. This again is used for two purposes: (1) Access all Items associated with one Pool/Model, at least that is the assumption. This is not valid since it gets corrupted with a single ItemSet/Holder used that does not host model data, e.g. an open Dialog or the Sidebar (or...). But works in principle. (2) Access extra-Items that are held nowhere and are created using DirectPutItemInPool, e.g. infos for a Dialog. These would need a instance/place to host them, the Pool is (ab)used for that. Both are 'compromizes' (to not use a more bad word) and should not exist. (1) should iterate over the Model and do actions. There are even places that use (1) to *change* Items, by casting them to non-const, even RefCounted ones, so having no control over what all might be changed doing so. Since we talk about ca. 100+ places there is no way to get away from this - I can imagine how this happened: The 'poolable' attr traditionally needed for the old binary format was one day 'used' to not need to iterate over the Model, an API was added to access and this usage was copied. Sigh.. It is even used when ODF is loaded: E.g. the FillStyle is imported from XML, interpreted, and put into an ItemSet. Then it gets set at the XShape using UNO API and a *name* -> that name and the Surrogate mechanism is used to find and set the FillStyle at the Model Object. The FillStyle could probably just be set using UNO API and the data directly. The association between Model/Pool and Item is created by the object hosting the Item, these are ItemSets and ItemHolders. Thus it is possible to register these at the Pool. This allows to iterate and collect the Items associated with the Pool and keep the Surrogate mechanism alive. This is the main change done here. It limits the registrations to Items for which (at the Pool) the NeedsPoolRegistration is set, also Item-independent. Speed is okay, I saw no big changes in my tests here. The registration is just pointers, no ownership or RefCounting needed here. The advantage is that Items get closer to be shared office-wide, they can be referenced by multiple ItemSets (RefCnt) associated with different Pools/Models. NOTE: This is not true for SfxSetItems, these are and will stay Pool-dependent due to their need to a Pool in the contained ItemSet. Note that we have ca. six deivations of SfxSetItem, but ca. 500+ Item derivations, so not too bad. For the usages of Surrogates to change existing, RefCounted Items: These can now at least be changed - if they show up to be problematic - to iterate over the registered ItemSets and change Items there the correct way: Set a changed one at the ItemSet. That also allows Objects to *react* on ItemChanges, there is no way to do that with the existing 'compromize'... UnitTests show that this already works well for SC and SD, but SW has still some issues. I will put this to gerrit now, but there will be additional work. A involved problem is the current DefaultItem handling and the state the Pool implementation is in. E.g. StaticDefaults are not really static, Pools hard-delete the DefaultItems (forcing the RefCnt to zero to not have the destructor complain) and other quirks. Looking at that right now, hoping to get this change done without having to change that too much. I thought about adapting PoolItemTest to this, but it is only related to DirectPutItemInPool which is mostly gone and hopefully completely soon. Nonetheless I adapted that mechanism to use a list of SfxPoolItemHolder at the Pool. That makes it safe and abandons the need for indirect garbage collection removal at the Pool. Change-Id: Ib47f21dafa989202930919eace5f7e9c5632ce96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161896 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-12-30move IsFuzzing to comphelperCaolán McNamara1-1/+1
and try something a bit more generic Change-Id: I1d8256576cd02f0a589df350ba7b53059dd586a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161250 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-28Use emplace_back instead of push_back (sw)Julien Nabet1-18/+18
Change-Id: I0a7f70ca0e5cc022425bee3661495cf1104f6521 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161384 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-20tdf#158794: do not try to insert DDE table into footnotes / endnotesMike Kaganski1-0/+4
Until tdf#76007 is fixed, of course. Change-Id: Iad7fb0de679e024a8cebdd005ac5a66af3ace163 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161078 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-18tdf#158703: return updated position from FnAddNonBrkSpaceMike Kaganski1-3/+4
The paragraph text may become shorter after the function succeeds, because it may remove arbitrary number of preceding spaces; since the position may then be used to access data in the string in the caller, we need to update it, to avoid use of old position (which may point beyond the string, and produce a crash; or it may point to a wrong position in it). Change-Id: Ib1b4b63cbd7150e0f69c97032e3410db7dadd4dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160924 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-18tdf#111969 sw: acknowledge that last half-character in Get*CorrectionJustin Luth1-0/+2
This fixes right-clicking on the last half-character of a mis-spelled word, which previously did not pull up a spelling suggestion list. This is a suggested follow-up to right-clicking on a selection, which had the same problem. Probably everywhere that calls GetModelPositionForViewPoint without eTmpState.m_bPosMatchesBounds should be suspected of being wrong. Patchset 2 contains a unit test that ONLY passes on machines that have spell checking dictionaries on them. The concept in general is already tested is another patch, so I'll just drop this unit test that checks the spell-checking code path. It would easily break other people's development setups if they don't have en-US dictionaries. Change-Id: I3faa87d16eb3452f863052ea851a43a871125060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160872 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2023-12-11tdf#117651 Fix AutoCorrect crash for italic, strike, bold, and underlineMatt K1-5/+11
This change fixes correction of indices when autocorrecting for one of the categories of bold, italic, strike, or underline. Previously, the code would hit a debug assert when selecting "Apply" because of incorrect indices into the string being autocorrected. Change-Id: I5484c589ff43cd2fc78332cdc0d63e74cdc8e256 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160547 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-11tdf#117651 Fix AutoCorrect support for italic, strike, bold, and underlineMatt K1-1/+3
The previous change for italic had a "break" for "/", but it turns out that code path is hit when trying to "Apply" with slashes around some text, so we just move the "break" inside the check for French language handling. Note that trying "Apply" with this change will crash on a debug build -- there is another fix for that problem in a subsequent change. Change-Id: I4bd76505b3fdfc9f5660eb6ae4a5c5c23e9672ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160529 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-28Proof reading suggestions:Gökay Şatır1-1/+2
* When user right clicks an underlined part of the sentence, we are checking if there is a suggestion list. * Then we show the suggestions. Sometimes spell checker algorithms send 2 lists for the same part of the sentence. And we saw that one of these lists can be empty (no suggestions). But since we check if there is a list, the empty list is shown to the user. I updated the checks here and added a new condition: Now we take the list if the list is not empty. This way, we can find the not-empty list which may come after an empty list (for the same part of the sentence). Signed-off-by: Gökay Şatır <gokaysatir@collabora.com> Change-Id: Ib3b498b98a8d44f8a7ead99593a71adcefa87a82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158832 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> (cherry picked from commit 4c6c60d44b0056cbe08b6e75baacbc0df0cd1742) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159908 Tested-by: Jenkins
2023-11-25Convert SwHashTable to std::unordered_mapNoel Grandin1-1/+1
Change-Id: I88b082dc61c05761fd162ea4cf1d30940c2dfccd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159941 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-21tdf#117651 Add AutoCorrect support for italic and strikethroughMatt K1-0/+40
The AutoCorrect "Apply" command calls SwAutoFormat::AutoCorrect in sw/source/core/edit/autofmt.cxx, as mentioned in the bug comments. This change just adds new cases for "/" (italic) and "-" (strikethrough), so that when "Tools" -> "AutoCorrect" -> "Apply" is invoked it changes any text between 2 "/"s or 2 "-"s (assuming your AutoCorrect options enable the setting for this). The new code is just mostly copied from the case statement above it (for bold and underline), and the only additional changes that were needed were to add the comment strings for the 2 new cases. Change-Id: I02238690a40fd0113e3e9acbecf93ef5c34e0785 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154207 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-20c++20: use std::erase(_if) instead of std::remove(_if)+erase (sw)Julien Nabet1-4/+2
Change-Id: I67c231441b56f05da001beab5b893bc6a6a6a392 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159704 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-11-07use more TypedWhichIdNoel Grandin1-2/+2
Change-Id: I37683d59e4994546ad4591d213b825ab080940eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159059 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-10-20Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: swStephan Bergmann1-17/+17
Change-Id: I85fff7ed6932c5fc196e18f24fa01074ba4837e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158241 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-16Simplify a bitMike Kaganski1-2/+2
Non-negative nCommentPos implies non-empty selection. Change-Id: Id3e5701fbddca3159d81513d8c7d54816e45e4c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158060 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-15tdf#156250: sw: Keep comments when spell correction replaces a wordEMartinGube2-14/+47
New method SwEditShell:ReplaceKeepComments for comment preserving spell correction. Change-Id: Ifdb9d5664ab8d457a16ad8f7ec62dd968c89d580 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154761 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-14tdf#157662 SW: redline: accept/reject done for all partsAttila Szűcs1-2/+2
Tracked changes divided into smaller parts when they are overlapping. But if the Author, and Change time, and some more is equal, then they can be combined into 1 change later.. Modified AcceptRedline / RejectRedline, to seek for all these parts that are neightbour to each other, and can be combined, and reject/accept them all at once. Even those that are deepen in the tree. i.e.: insert that have a delete redline too. when rejecting an insert redline, that have a delete redline too, the delete redline is accepted instead. (have the same result.) when accepting an insert redline, that have a delete redline too, The delete redline remains, while the insert is deleted. (=accepted) made some limitations to lessen the probability of regression: No anonym, No table, No seqNo, and dont use it in RejectAll/AcceptAll Added unittest to check that accept/reject handle more redlines at once, but not too many.. Change-Id: Ibd0a39f7847b22b279a797babb30ba162e70a513 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157950 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-03tdf#157315 Don't set mark after inserting a file in a Master documentJim Raykowski1-1/+0
Removes setting a mark after inserting a file. Setting a mark here causes a selection to be made on mouse click in the document after inserting a file which probably isn't what is expected. Change-Id: I3e7597dfecb04c9b3cfba8081fa74dffcf0d78dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157032 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
2023-09-17remove unnecessary dynamic_cast around SwXTextNoel Grandin1-4/+4
Unusually, we cannot use rtl::Reference to hold SwXText, because rtl::Reference assumes that its pointee is a subclass of OWeakObject, which SwXText is not (and we cannot make it so because the UNO bridge does not support virtual base classes). So we have to use css::uno::Reference<SwXText> and carve out an exception in loplugin:refcounting. Change-Id: If3a1307e30fdcd3b47aa665252be081fb5063400 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156982 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-07Autocorrect: Add option for autoformat bulleted lists after spaceDarshan-upadhyay11101-11/+35
Enable option in Autocoorect => bulleted lists after pressing space Example: press * or - and space will change into bullets Change-Id: I9741ad4c3eb4123074f06b762b58fe7ffdb44613 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156616 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2023-08-10tdf#156492 sw: fix alt-Enter in cells merged verticallyLászló Németh1-1/+20
Inserting empty paragragh after the tables didn't work, if the bottom right corner of the table contains cells merged vertically. Manual test: positionate the text cursor at the end of the last paragraph of the bottom right cell of the table (which contains also cells merged vertically), and press alt-Enter to insert an empty paragraph after the table. Note: SpecialInsert, i.e. inserting empty paragraph by pressing alt-Enter is the quick and sometimes the only possible way to insert an empty paragraph before or after tables and sections. Change-Id: Ic845c3d683a561784afe69588b3b1538e82c35c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155556 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2023-07-26tdf#156368: Fix setting watermark font for CJK/CTL textKhaled Hosny1-0/+2
We were setting only Western font when getting the shape, so if there is no Western characters in the text the default font would be used. There is no separate setting for CJK/CTL fonts, so we sets the same font for all the three. Change-Id: If2ba2a206f95e0efe9139b9d092b1d6dbf05967c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154894 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-03No need to name the temporariesMike Kaganski1-2/+2
Change-Id: Idadb3473afd7890d329cc8effff7ec985d06c2e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153846 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-07-02Drop redundant assignmentMike Kaganski1-1/+0
Assigned the same value a couple lines above. Change-Id: Id1117189142fab373f5057f8f48a49b265a07fe7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153842 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-28Drop i18nutil::SearchOptionsMike Kaganski1-1/+0
It was mostly unused by now, only remained in a couple of function arguments, where callers actually passed SearchOptions2, and where internally it was converted back to SearchOptions2. Change-Id: Ib188ec3bf0de6d1f70a04eb90fb3a577df8b3d98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153687 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-26new loplugin:constexprliteralNoel Grandin1-1/+1
OUStringLiteral should be declared constexpr, to enforce that it is initialised at compile-time and not runtime. This seems to make a different at least on Visual Studio Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-23tdf#142437: Fix word boundary detection in autocorrectBaole Fang1-1/+1
Marks (combining and spacing) were incorrectly considered word separators, because isLetterNumeric() matches only for letters and numbers. The new isBase() matches any character with BASE_FORM character class, which covers letters, numbers, and marks. Change-Id: I27ec2f7fb8d360791a280d10aba9b6d16e7cfb71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153509 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-15tdf#155685 sw: ExtendedSelectAll with tables, group the Undo objectsMichael Stahl1-0/+10
Change-Id: I2fba70968c97cd9704212cd799b333d2d158a042 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153115 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-06-06tdf#155685 sw: fix crash on undo of ExtendedSelectAll with table at endMichael Stahl2-9/+14
While the selection with table at the end works for Copy, unfortunately it doesn't work for Delete, because SwUndoDelete can't handle it, and an empty SwTableNode+SwEndNode pair remains. This needs some extra code, extract a SwDoc::DelTable() out of SwDoc::DeleteRowCol() and call it from SwEditShell::DeleteSel() to create separate SwUndoDelete objects per table, which appears to work. (regression from commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda) Change-Id: I1534b100d31bc279bce298d3c2bd235cffc1f9d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152628 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-06-05tdf#152431 Fix line count resets to zero after 65535Bogdan B1-2/+2
GetLineCount was a sal_uInt16 value, that allows only 65535 lines to be counted. This is changed to sal_Int32 and also the underlying data type for the lines number is changed from sal_uLong to sal_Int32, but not for pages number. With this change, the maximum possible line number is now increased to 2^31-1 = 2,147,483,647. Change-Id: Ibee2d24e638204133f0ef085564016543f73d351 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143173 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2023-06-02tdf#90507: Prevent changing default style in AutoCorrectBaole Fang1-1/+6
Change-Id: I3bc7d99daf49ff32d9d80fcbbb7538cc036bc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151213 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-19Fix "AddressSanitizer: heap-use-after-free"Mike Kaganski1-0/+4
https://github.com/CollaboraOnline/online/issues/6380 Commit 7481e8b5500e86626be5f8eae1e7f48b7f51e21a (sw_redlinehide_4a: SwEditShell::AutoCorrect() etc., 2018-11-28) explicitly relied upon the reference to the node text being updated on editing operations. Commit 14f6700fefa945c4cf995c09af9326c2a022f886 (use more string_view in editeng, 2022-04-14) converted the argument of FnChgToEnEmDash to a string view, which means that any change in the underlying OUString frees the memory referenced by the view. But in this method, we really don't want to have the text updated; so use a local OUString copy for later reference. Partially revert commit 14f6700fefa945c4cf995c09af9326c2a022f886. And copy mst's commit 7481e8b5500e86626be5f8eae1e7f48b7f51e21a message to document the assumptions in SwEditShell::AutoCorrect. Change-Id: I0ff02958c8de9566d774f366d905aa9bb603055c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151970 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-18improved B2DHomMatrixNoel Grandin1-6/+7
since we know that this is a matrix only used for 2D transforms, we know that the last row of the matrix is always { 0, 0, 1 }. Therefore, we don't need to store that information, and we can simplify some of the computations. Also remove operations like operator+ which are not legal for such a matrix. Change-Id: I482de9a45ebbedf79e3b6033575aab590e61c2d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151909 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-13use more optional for CharClassNoel Grandin1-4/+4
Change-Id: I67984321b8f38928bfab9fb0b624620e7d286a11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151722 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>