path: root/sw/source/core
AgeCommit message (Collapse)AuthorFilesLines
12 hoursFix typosAndrea Gelmini1-1/+1
Change-Id: I48d173ab697425bcff663f7f7d0bbc404a950bb2 Reviewed-on: Tested-by: Jenkins Reviewed-by: Julien Nabet <>
14 hourstdf#149710 sw_redlinenum: update numbering at deletionLászló Németh1-0/+12
in Show Changes mode. Follow-up to commit 2413f213625253a9c2b1787b3b9fe859d724a9bd "tdf#115523 sw_redlinenum: show correct, also original numbering". Change-Id: Iebf54775f3850e668ac5b12ecbd9f010b4e93ee4 Reviewed-on: Tested-by: Jenkins Reviewed-by: László Németh <>
17 hourstdf#43100 tdf#104683 tdf#120715 sw: cursor on spaces over marginAttila Szűcs8-27/+63
Allow cursor movement on spaces over margin (or clicking it it to position the cursor), like MSO does instead of stopping cursor before the stripped (from the typesetting) spaces. This way it's possible to follow the modification of these characters, e.g. removing spaces or inserting other characters at the cursor position. Follow-up to commit 8741fd0e0ae9e346de2e09887f0668b831c9b48b "tdf#43244 sw: show stripped line-end spaces on margin". Details: extend SwHolePortion to calculate its width, that can be used for cursor movement, even over the right margin. Removed some code that not allowed cursor to be positioned over the right margin. Layout calculation uses m_nWidth variable (that was 0) to make frames. To keep the layout unchanged, this new width calculated into m_nExtraBlankWidth temporarily, and this extra width is added to m_nWidth only after the layout calculation is finished. (Ideally this 2 width values could be stored and used separately, but that would require a bigger refactor of the cursor calculation.) Known regression: lost selection at Search & Replace, e.g. searching double spaces: there was a narrow selection at end of the line showing the position. Other issues: when a different character inserted on the margin resulting new line break, space formatting marks aren't updated according to the less spaces. Removing the inserted character by Backspace results losing of the cursor movement on the spaces. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I94b4ed40b8c560e1ef32f4d0d3537e070c08666f Reviewed-on: Reviewed-by: László Németh <> Tested-by: László Németh <>
21 hourssw: fix crash in SwLayoutFrame::GetContentPosXisco Fauli1-5/+19
FindPageFrame might return nullptr See,bool,bool,SwCursorMoveState%20*,bool) Change-Id: Ic69d26de4ab234ebd6283ace640d689f0ebe8eb3 Reviewed-on: Tested-by: Jenkins Reviewed-by: Xisco Fauli <>
22 hourstdf#115523 sw_redlinenum: show correct, also original numberingLászló Németh3-31/+111
in Show Changes mode, according to the name "Show Changes" and according to the interoperability requirements. Instead of the fake numbering which counted the deleted list items in Show Changes mode, e.g.: "3. This was the third originally, but now it's the second list item." now show the correct number followed by the original number within braces: "2.[3.] This was the third originally, but now it's the second list item." Note: the tabulators after the longer numbering are replaced with spaces to avoid messy indentation in Show Changes mode. New enum values for the alternative lists: SwListRedlineType::SHOW - the original (fake) numbering in Show Changes mode SwListRedlineType::HIDDEN - the original numbering of Hide Changes mode, and new numbering in Show Changes mode SwListRedlineType::ORIGTEXT - the new numbering of Show Changes mode to show the original numbering of the deleted or inserted list items Follow-up to commit c180c9447256588fe5e7991e06642883574760ae "sw_redlinehide_3: add second SwNodeNum to SwTextNode". Change-Id: Ieaca550561c5d5a7ac5d9defb9c7fa283d6aa674 Reviewed-on: Tested-by: Jenkins Reviewed-by: László Németh <>
23 hoursCppunitTest_sw_layoutwriter: use more SwParaPortion::dumpAsXml()Miklos Vajna1-0/+6
See commit feeed3e762cf077fbd9cf48f82e949365108ccc1 (CppunitTest_sw_layoutwriter: avoid some a11y-based layout testing, 2022-04-07) for motivation. Change-Id: I8d621a735cb269d9d3ab425351af7b2b7052a3e1 Reviewed-on: Tested-by: Jenkins Reviewed-by: Miklos Vajna <>
3 daystdf#134759 sw: do CopyToModify() for both start and end nodeMichael Stahl3-48/+2
... in SwNodes::MoveRange(). SwRangeRedline::Hide() does CopyToSection()/DelCopyOfSection() so the previous commit fixed it, and SwRangeRedline::Show() does MoveFromSection() so hopefully this should fix it to restore the situation before hiding. This caused several tests to fail, and the reason appears to be that they pretty much tested exactly the problem that's being fixed with this commit, but the pre-existing fixes and the new one cancel each other out. In all cases the pre-exising fix moves all redlines and moves them back again, which is the sort of thing that sw_redlinehide wanted to get rid of; not sure why i didn't notice this earlier. The check for the 3rd paragraph where the style was applied still succeeds with the new bugfix, but the one for the 1st paragraph fails; it is unclear why applying a style to the 3rd paragraph should have an effect on the 1st one. Hence: Revert code changes of commit 1d65ffc5a37be21e0316019b1c96eb9a1c871ac0 "tdf#105413 track changes: keep paragraph styles" Revert code changes of commit d97fc64a819f834302e384792668507df4cc412c "tdf#122893 track changes: keep paragraph alignment" Revert code changes of commit 6a54dd844d1821165642bbcc16bd12a01a23393d "tdf#122901 track changes: keep paragraph top and bottom borders" Change-Id: I0b70134902a7993c7bb11a3c619e45742764c8ae Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
3 daysMake code a bit more explicitStephan Bergmann1-17/+13
...and avoid the ugly unsigned short vs. SvxAdjust mismatch Change-Id: Ie820b5fda00942d258668535598027f9d878c013 Reviewed-on: Tested-by: Jenkins Reviewed-by: Stephan Bergmann <>
3 daysUse proper type for aSvxToUnoAdjustStephan Bergmann1-8/+8
...following up on a comment in the commit message of 37ec4442d70339dc8ec5fb8e4ec8984420b6e14d "o3tl: ensure that the initializer of enumarray contains enough elements": "In sw/source/core/unocore/unosett.cxx with its odd mix of saL_Int16 and USHRT_MAX, lets keep things that way for now (probably awaiting later clean up) and use casts to avoid the implicit narrowing." The USHRT_MAX values always mapped to -1 when the elements of aSvxToUnoAdjust are used to initialize sal_Int16 nINT16 later on, so make that explicit here (but an explicit cast from int to sal_Int16 is still needed for them, to avoid narrowing failures from within the enumarray ctor). Change-Id: Ib401ff94c429f8415199a5d35997d17266e04279 Reviewed-on: Tested-by: Jenkins Reviewed-by: Stephan Bergmann <>
5 daysSwDoc::IsUsed(const SwNumRule&) can be constCaolán McNamara1-1/+1
Change-Id: I9966c2d71670d53375e27090e1ad3dffb780f81e Reviewed-on: Tested-by: Jenkins Reviewed-by: Caolán McNamara <>
5 daysfix SwViewShellImp::AddPaintRect() for sub-rects (tdf#146536)Luboš Luňák1-3/+4
Using just two corners to build the new resulting rect works only if the new rectangle actually really extends the previous one, but the <= means that this may compress also rects that are already contained in the previous rect, in which case it's necessary to make sure to use union to get the larger coordinate). Change-Id: Ie4303dfef903bded6d63625531e424a32cc01b06 Reviewed-on: Tested-by: Luboš Luňák <> Reviewed-by: Luboš Luňák <>
6 dayssw: prefix namespace Justify with sw.Mark Hung3-12/+12
Change-Id: Ia813b93dc719a5715804aa06b555c99eaf99b039 Reviewed-on: Tested-by: Jenkins Reviewed-by: Mark Hung <>
7 dayso3tl: ensure that the initializer of enumarray contains enough elementsMichael Stahl1-6/+6
Currently this silently succeeds. Turns out oox already contains some too-short initializers, let's guess the missing properties are all invalid. One downside of the templated parameter pack approach in the enumarray ctor, as witnessed in vcl/win/window/salframe.cxx, is that argument types can no longer be implicitly deduced and thus need to be spelled explicitly now in certain cases. There were also three uses of enumarry with V being unsigned short (aka sal_uInt16) that started to cause narrowing conversion errors now and needed to be adapted: In editeng/source/uno/unonrule.cxx the obvious fix was to use the proper type for V. In sw/source/core/unocore/unosett.cxx with its odd mix of saL_Int16 and USHRT_MAX, lets keep things that way for now (probably awaiting later clean up) and use casts to avoid the implicit narrowing. And in sw/source/filter/ww8/wrtw8esh.cxx the ESCHER_Prop_* values, while presumably conceptionally of type sal_uInt16, are plain #defines (thus of type int), so rather than changing V to int it looked more consistent to explicitly cast the ESCHER_Prop_* vlaues to sal_uInt16. (And in tools/source/fsys/urlobj.cxx the poor loplugin:redundantfcast started to unhelpfully kick in for (only) the first argument now.) Change-Id: If06c29e673ec7e565e283c6f447889cf1f777cb7 Co-authored-by: Stephan Bergmann <> Reviewed-on: Tested-by: Jenkins Reviewed-by: Stephan Bergmann <>
8 daystdf#134759 sw: clear items in SwAttrSet::CopyToModify()Michael Stahl1-0/+17
Setting new items but not clearing existing items smells like an obvious omission. Why would we want a union of two nodes' items? This improves things a bit for the bugdoc, but now it ends up with a different wrong list on the node 254. Change-Id: I3f5db0a4f81ac6e9af56d1faaefc2cb107dff597 Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
9 daystdf#149524: fix crash in Writer after a label has just been createdJulien Nabet1-2/+2
see bt here: Change-Id: Iba461ffe65392a7e0e779f68d1f0737a444ae724 Reviewed-on: Tested-by: Jenkins Tested-by: Heiko Tietze <> Reviewed-by: Heiko Tietze <> Reviewed-by: Xisco Fauli <>
9 daystdf#149089 snap to grid if IsSnapToChars() is falseMark Hung1-5/+8
for non-CJK scripts. Non Asian text was centered within as many cells as required according to ODF1.2 20.301. But it also required that text should be snapped to grid if style:layout-grid-snap-to is true ( i.e. IsSnapToChars() is false ) per ODF1.2 20.305. That means ODF1.2 20.301 ruled. This patch changes the width of inserted SwKernGridPortion so that non-CJK text aligns to the edge of text grid to make ODF1.2 20.301 rule, an provide more consistent layout result as expected. Change-Id: Id6b4d2b965e20670eb9ddf657d36b8a49073f32a Reviewed-on: Tested-by: Jenkins Reviewed-by: Mark Hung <>
9 daysloplugin:moveitNoel Grandin3-10/+10
Change-Id: Ic593974a44d9e327e0385c7ffaaa6d42576ae01a Reviewed-on: Tested-by: Jenkins Reviewed-by: Noel Grandin <>
9 daystdf#147084 sw a11y: Ensure focus event gets sent when moving to tableMichael Weghorn1-3/+0
The code responsible for sending an a11y focus event when the cursor moves from elsewhere into e.g. a table cell depends on the fact that the cursor was previously not in that object, i.e. the previous/old cursor/caret position is -1, s. e.g. `SwAccessibleParagraph::InvalidateCursorPos_`. Already setting `m_nOldCaretPos` to the the actual cursor position instead of -1 in the `SwAccessibleParagraph` ctor resulted in that assumption no longer holding when initially moving the cursor into a table (cell), so no focus event would get sent and the NVDA screen reader on Windows would therefore also not refer to the correct a11y object when handling the subsequent CARET_CHANGED event and fail to retrieve the caret position in the previously focused object (because focus/cursor have moved on). Make focus announcement work by only setting `m_nOldCaretPos` to the actual cursor position when processing the corresponding events related to change of cursor position, not in the ctor. Setting the cursor pos already in the ctor had been added to fix an issue with IM handling in commit 817da76529aa39f641d76805d429b09681348811 Date: Sat Nov 8 19:37:22 2014 +0300 fdo#85912 Delete surrounding text failing for input method calls regression. When Apache OpenOffice code was merged in, a few lines were removed for no apparent reason. This just adds the code back in, and resolves the bug. See the comments in fdo#85912 for details about this bug. It is hard for majority language users to reproduce since they don't use ibus/kmfl to type their language's letters. The issue mentioned in the referenced tdf#85912 (== fdo#85912) is not reproducible for me with this change here in place either, neither with the gtk3 VCL plugin nor with kf5 (for which the relevant IM handling has been added in the context of tdf#149255, which has some more information on the ibus/kmfl setup needed to reproduce the original bug). The bug report already mentioned that the issue was reproducible with Linux 13 Mint and LibreOffice, but not Linux 17 Mint with exactly the same LO version, so without being able to analyze this any further, the best explanation I can come up with is that the root cause for tdf#85912 was somewhere else and has been fixed in the meanwhile. In hindsight, comment 5 in tdf#85912 already has further information on why adding the assignment back to the ctor was problematic: > Reviewed OpenOffice code as well. The missing lines exist (but are > commented out) in the current AOO code. The commenting out > occurred when Steven Ying implemented his huge "AOO IA2 enabled draft > version 1" change on 27 Sep 2013. > > > The current AOO comment is > // If this object has the focus, then it is remembered by the map itself. > // not necessary to remember this pos here. Generally, the pos will be updated in invalidateXXX method, which may fire the > //Focus event based on the difference of new & old caret pos. > //nOldCaretPos = GetCaretPos(); Change-Id: If8cd4e92bc1f6233775ccc2834230f3a388ccadb Reviewed-on: Reviewed-by: Justin Luth <> Tested-by: Jenkins Reviewed-by: Michael Weghorn <>
9 daystdf#135976 sw: preserve flys on backspace/delete with redlining enabledMichael Stahl5-6/+47
This is a continuation of commit 85376a02348810812d515ee72140dbf56f2b6040 for the case when redlining is turned on. Also try to restore the anchors in SwUndoRedlineDelete. (regression from commit 3345feb67f2c49a1b76639965b56968e1c5f03ee) Change-Id: I4199f5755398d469a606618c037ad9756cb7aeba Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
9 dayssw: fix odd m_bCanGroup check in SwUndoRedlineDeleteMichael Stahl1-1/+1
This looks like copypasta, presumably both flags must be true to allow grouping. Change-Id: I96afeac98f94b122a3b1a155940776a3aa44b0a2 Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
9 dayssw_redlinehide: skip unnecessary updates when undoing redlined deleteMichael Stahl1-0/+6
When reproducing tdf#135976 and then Undo, an UAF crash happens here: assert(!pFrame->GetDrawObjs() || !pObjs->Contains(*pObj)); The pObjs was actually deleted and then re-created, because the pObj was removed from the frame and added again to the same frame. This is a bit unexpected, so prevent it by taking a shortcut in the caller UpdateFramesForRemoveDeleteRedline() to insert a check that had been removed in commit 14e87a4b15d31a34e6053f6194688f3aa23af991. If the rPam is inside a single node, the sw::RedlineUnDelText hint that was sent to the SwTextFrame should be sufficient to update it and the rest of the code in the loop that deals with newly split paragraph can be skipped. Change-Id: I5f36eb91bc20003887ee0bad03ea4a6e67135de9 Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
9 daystdf#145151 sw IsTableMode GetNumRuleAtCurrCursorPos: unselected cellsJustin Luth1-1/+13
...shouldn't be treated as if the cursor was there. Change-Id: Ida435635aab4442b93f969d6f473aacf3f229e02 Reviewed-on: Tested-by: Jenkins Reviewed-by: Justin Luth <>
10 daysremove unused sw UNO_NAME_CHARACTER_FORMAT_NONEJustin Luth1-2/+1
CharacterFormatNone seems to be orphaned code. Was this ever written out to file? If not, then it should be removable because I don't see anywhere that it can be set. I found this while working on tdf#75297. Change-Id: I3212ab7dcda3c46adfe638ee1ae412a3ede8762c Reviewed-on: Tested-by: Jenkins Reviewed-by: Justin Luth <> Reviewed-by: Michael Stahl <>
10 daystdf#145151 sw IsTableMode SelectionHasNumber: unselected cellsJustin Luth1-55/+44
...shouldn't be checked This followup patch checks the proper cells to see if numbering or bullets are turned on. There is one side effect here. Picture this scenario where you select some paragraphs (_ indicates blank paragraph) _ _ 1. some numbered text _ In this non-empty case, SectionHasNumber is true, showing numbering on in the toolbar. Prior to this patch, the following scenario was "false", showing numbering off in the toolbar. - - 1._ _ and the result was that all the blank lines toggled on. Now it acts just like the non-empty case. Although one can dispute that this is the correct action, consistency is nice... Change-Id: I8a1b8ee0fe947a7bfe7906a0add3aaf2d8e7b232 Reviewed-on: Tested-by: Jenkins Reviewed-by: Justin Luth <>
11 daystdf#149507 sw: don't delete bookmarks in SwUndoInsLayFormat::UndoImpl()Michael Stahl1-7/+4
The problem is that the CorrAbs() here deletes the bookmarks in the fly, and this isn't supposed to happen at this point, because DelFly() will call SaveSection(), which saves the bookmarks in the m_pHistory via DelContentIndex(), so that they can be re-inserted in Redo/InsFly(). Also change the code that was inserted in commit 0ee28fdf3e9a0bd8763eda6299af1d5c873a9dcf to not call CorrAbs(). (although this bug has existed forever, crashing is a regression from commit 657de5fba12b0e9afcdee361654d2a2d0dbd7311) Change-Id: Iabac0ccf5587d5d974e88cbbc3e05bbaed3526f3 Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
11 daysRemove some unused includesMiklos Vajna2-2/+0
See tdf#42949 for motivation. Change-Id: I157b331195cc8262e6bd1dcc536cb653587fc45f Reviewed-on: Tested-by: Jenkins Reviewed-by: Miklos Vajna <>
12 daystdf#139982 sw: preserve flys in Replace with redlining enabledMichael Stahl3-3/+12
The problem is that there isn't a redline type "Replace" so it's represented as Delete+Insert. To prevent the flys anchored in the text from being deleted, move the anchors to the point between the old (deleted) and new (inserted) text. (regression from commit 28b77c89dfcafae82cf2a6d85731b643ff9290e5) Change-Id: Ib600c9dbfb9421917e4b8d61195c48cf0b364f06 Reviewed-on: Tested-by: Michael Stahl <> Reviewed-by: Michael Stahl <>
12 daystdf#145151 sw IsTableMode NumRule: unselected cellsJustin Luth1-10/+11
...should not be affected when setting or deleting numbering. This patch depends on follow-up patches to properly detect if numbering is turned on or off in some cases. This patch prevents numbering from "leaking" into the previous cell if the cells were selected backwards. Perhaps it would be better to fix the selection code itself instead of handling all of these edge cases, but doing that might have unintended consequences that I wouldn't have any insight into. So this is safer. Change-Id: I98e18d6056e93a4d89fdbe75b6237daca7832f41 Reviewed-on: Tested-by: Jenkins Reviewed-by: Justin Luth <> Reviewed-by: Miklos Vajna <>
12 dayssw content controls: reject typing inside checkbox or picture content controlsMiklos Vajna1-0/+26
Content controls are editable by default (and not only editable, but also capable of hosting rich text content), and Writer doesn't limit the possibility to edit explicitly, either. Certain content control types (checkbox and picture for now) limit the hosted content though: checkbox overwrites the content on click and picture is meant to host a single as-char anchored image. So far the simple implementation Writer didn't enforce these limits, leading the unexpected behavior when clicking on checkbox content controls (possibly not only a checked/non-checked checkmark was toggled, but other content was removed). Fix the problem by making these content control types read-only: this is what also Word does and this way you can't loose the content when you can't enter it earlier. We may want to also do this for dropdowns in the future, once combo boxes will be supported. Change-Id: I9d44206b3c719a64ec552f2fa0a076901094163e Reviewed-on: Tested-by: Jenkins Reviewed-by: Miklos Vajna <>
2022-06-10tdf#75297 sw uno: override default num char style when NONEJustin Luth1-1/+2
The problem was during ODT import. When no text:style-name is provided, or if it is an empty string, then the default "Numbering symbols" character style remained active, preventing the ability to round-trip a NONE char style. Since this depends on the built-in name (and that name can easily enough change) there is not much point in creating a unit test. Change-Id: Id942060abd3e024758f93f3d279ef8b561cfc5a9 Reviewed-on: Reviewed-by: Justin Luth <> Tested-by: Jenkins
2022-06-10tdf#140007 sw: fix SwUndoReplaceMichael Stahl1-2/+3
(regression from commit d6b0e84b236b78f4b21bd16e46dda3fa0876096d) Change-Id: I1facf1584a349d1d087438f4e6fd3a63a80c6f7e Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
2022-06-10sw doc model xml dump: show table row propertiesMiklos Vajna2-7/+27
Also extract SwTableNode::dumpAsXml() from SwStartNode::dumpAsXml(), ideally dumpAsXml() should only dump own members, not members of other classes. Change-Id: I5ef3e90d0cdd23ba44c192de1802844acad64cc4 Reviewed-on: Tested-by: Jenkins Reviewed-by: Miklos Vajna <>
2022-06-10new loplugin:moveitNoel Grandin7-12/+9
look for local variables that can be std::move'd to parameters off by default, since it doesn't do proper data flow analysis Change-Id: I3403a0fcffd165bdea6a772528bc53995c5fdb40 Reviewed-on: Tested-by: Jenkins Reviewed-by: Noel Grandin <>
2022-06-10sw: fix use-after-free in SwFrame::ImplFindPageFrame()Miklos Vajna1-5/+11
Header-footer controls have a non-owning pointer to their page frames in Writer views, so whenever a page frame gets deleted, we need to manually make sure that the header-footer control doesn't have a pointer to the deleted page frame. This already works with a single view, but in case one view has a visible header-footer control and an other view deletes the page frame that is known to the header-footer control, then we have a problem. Fix the problematic outdated SwFrameMenuButtonBase::m_pFrame by extending SwPageFrame::DestroyImpl(), so it un-registers itself (before deletion) not only from the current view, but from all views. Found by online.git's: tst=/tmp/testfoo.odt cp test/data/hello-world.odt $tst ./coolstress wss://localhost:9980 $tst test/traces/writer-hello-shape.txt $tst test/traces/writer-document-edit.txt $tst test/traces/writer-mash-text-table.txt $tst test/traces/writer-rambling-text-table.txt $tst test/traces/writer-add-bullet.txt although also reproducible on the desktop, in case you have two views (windows), do cltr-enter to have 2 pages, go to the 2nd page in both views, view 1 clicks on the 2nd page's header, view 2 deletes the page (backspace) and finally view 1 clicks in the body text of the current page. Change-Id: I35e5d82256ab5db8e5f0ba198f5d2638cbff7d3c Reviewed-on: Reviewed-by: Miklos Vajna <> Tested-by: Jenkins
2022-06-10Add asserts to those places where I fixed a EXCEPTION_INT_DIVIDE_BY_ZEROXisco Fauli3-0/+4
I found those crashes scraping so those are blind fixes basically. Add these asserts, hoping one day someone will hit them so we can find the root cause. See 7c8b9fa98f4c5f7f5620e797dbbe24081e252548 fae937b6859517bd9fe8e400cad3c84561ff98ab ce39195e533336ce1482e2be6b1bec2b7f992125 23e3bff528ab38c8d5c6d401b672a0033cef2bd4 ea4cd397300120a0f825752182eb3b943eb8a1b2 Change-Id: I175f47361e07961417c87cc8f3d7d4d1fb50fb2c Reviewed-on: Tested-by: Jenkins Reviewed-by: Xisco Fauli <>
2022-06-09sw content controls: fix crash on trying to insert nested dropdownMiklos Vajna1-2/+5
This went wrong in commit 3dd4f3691458ea537bc1867386269694775cfbcb (sw content controls: add document model, 2022-03-30). Change-Id: I8040e02975d1f98cc01ef6f8a22745f27afa5276 Reviewed-on: Reviewed-by: Miklos Vajna <> Tested-by: Jenkins
2022-06-09loplugin:unusedmethodsNoel Grandin3-68/+0
Change-Id: Ib89ab59f7ad7e90b2a44ddd122176cde904fba4d Reviewed-on: Tested-by: Jenkins Reviewed-by: Noel Grandin <>
2022-06-08(related: tdf#139514) sw: fix Undo of delete with at-para flyMichael Stahl1-4/+8
Nonobviously, there are situations where the anchor node must be preserved and restored when it's not on the node that is being deleted. (probably regression from commit 91b2325808a75174f284c48c8b8afc118fad74e4) Change-Id: I39f09ddb631204c8ad522f9ec7068d235ca94ad2 Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
2022-06-08tdf#133957 sw: don't delete flys on Backspace/Delete keysMichael Stahl16-54/+77
Also fixes: tdf#134007 tdf#138835 tdf#139514 When a character is deleted via the keyboard by Backspace or Delete key, an artificial selection is created in SwWrtShell::DelLeft()/DelRight(). Ideally this should not delete flys that may be anchored to the paragraphs, but unfortunately this may happen if there are only 2 empty paragraphs in the section, because then the artificial selection cannot be distinguished by the SwDoc implementation from a selection from Ctrl+A (Select All), which *should* delete the flys. So introduce a new flag that needs to be passed down multiple layers so that SwUndoDelete can use it to determine if flys should be deleted, and translating it to a flag that had been introduced to preserve flys in ReplaceRange() previously. There are a couple more callers that look like they want to "replace" some text, so guess a bit at where to set this new flag. (note: of course fly anchored *as char* must be deleted via keys.) (regression from commit e75dd1fc992f168f24d66595265a978071cdd277) Change-Id: Ib4467476b12a12aefbbcb74ab9802f9318cf9aa0 Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
2022-06-08sw: fix crash in SwFEShell::SelectObj()Miklos Vajna1-1/+1
Fatal signal received: SIGSEGV code: 1 for address: 0x0 SwLayoutFrame::Lower() const sw/source/core/inc/layfrm.hxx:101 SwFEShell::SelectObj(Point const&, unsigned char, SdrObject*) sw/source/core/frmedt/feshview.cxx:317 SwEditWin::MouseButtonDown(MouseEvent const&) sw/source/uibase/docvw/edtwin.cxx:? Change-Id: I6c4076eef21dd80381b37ed89aa2dc8bc20fbc98 Reviewed-on: Reviewed-by: Miklos Vajna <> Tested-by: Jenkins
2022-06-08tdf#149089 fix extra mini space in text grid.Mark Hung3-218/+84
1. Create Justify::SnapToGridEdge() to adjust kern array under CJK textgrid GRID_LINES_CHARS mode when snap to chars is off. This function can handle a) Unicode IVS b) rInf.GetSpace() like what CJKJustify() does. c) rInf.GetKern() value for letter spacing. Excluded parts comparing to original kern array adjustment: a) Kana compression under textgrid mode has been removed. Kana compression is used to compress space of punctuation. It doesn't make sense to perform that under textgrid node. b) Inserting nSpaceAdd for CH_BLANK is removed. I don't know its purpose. 2. Use Justify::SnapToGridEdge() in GetTextSize(), GetTextBreak(), DrawText(), GetModelPositionForViewPoint() to adjust kern array consistently. Change-Id: I136a92f513fae05af2fb429e747356ba7eedec7f Reviewed-on: Tested-by: Jenkins Reviewed-by: Miklos Vajna <>
2022-06-08Fix typosAndrea Gelmini1-1/+1
Change-Id: If282a3a9f68de2cf0f1576ea34b56b9316f03ef6 Reviewed-on: Tested-by: Jenkins Reviewed-by: Julien Nabet <>
2022-06-07tdf#43244 sw: show stripped line-end spaces on marginAttila Szűcs1-2/+13
in View->Formatting Marks mode instead of hiding them This way it's possible to avoid interoperability issues better, when these (now visible) spaces are stripped only in Writer, but not in MSO, resulting different layout, i.e. bad paragraph alignment, because the users can notice the extra spaces and remove them in Writer. Extend SwHolePortion::Paint() to paint its text, what is probably just a bunch of spaces. It's an initial fix for tdf#43100, tdf#120715 and tdf#104683 (cursor movement on the hidden spaces, end of paragraph sign before the hidden spaces, unable to select spaces after the margin). Follow-up to commit 93d7bdcb855362b88cdcfcb18ea401d89da973fb "fdo#33167, i#20878: Show spaces at the end of line". Co-authored-by: Tibor Nagy (NISZ) Change-Id: I48df3b41af37c77fd594bb6776ca30e845c51490 Reviewed-on: Tested-by: László Németh <> Reviewed-by: László Németh <>
2022-06-07fix SwViewShellImp::AddPaintRect() rectangle compression (tdf#148255)Luboš Luňák1-1/+1
Both the checks test whether a follow-up rectangle can be merged with the previous one by merging it at the bottom or the right of it, so the previous one should be always the top-left and the follow-up one should be the bottom-right. Change-Id: Ie5809595ec9bf28bd169fc503a6b391c6188d0b2 Reviewed-on: Tested-by: Jenkins Reviewed-by: Luboš Luňák <>
2022-06-07sw: Divide-by-zeroXisco Fauli1-3/+3
follow-up of aeeb0141aca4f1698b09bc8f06ded41247b54279 "sw: avoid another EXCEPTION_INT_DIVIDE_BY_ZERO" Change-Id: I0b5cc10c4f7976a611f222f3d4c8764c5d04dba0 Reviewed-on: Tested-by: Jenkins Reviewed-by: Xisco Fauli <>
2022-06-07sw: fix pasting multiple flys in SwFEShell::Paste()Michael Stahl1-15/+30
This was most recently fixed in 3cfd63cb55ab1a7e6df53eaeb2a7623be05983d0 but that didn't take into account that now with Ctrl+A multiple flys can be selected and copied, and all of them should be pasted; remove the odd restriction to paste only one text frame. This reveals that pasting a text frame will actually select the text frame, so subsequent flys end up anchored inside the text frame; delay selection until all flys have been pasted. Change-Id: I049f60ca9656e5075d481d4501bb1ffdd28a4e21 Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
2022-06-07tdf#149365 tdf#149214 handle IVS and mix width charsMark Hung3-122/+109
in Justify::SnapToGrid correctly, and use it in SwFntObj::GetTextBreak() and SwFntObj::GetModelPositionForViewPoint() to get correct text positions before any further calculation. In fntcache.cxx a simple formula was used to calculate the average width of text grids occupied by ideographs. That's incorrect because 1) for strings containing Unicode IVS, a ideograph is composed of several sal_Unicode and the length of the string is not the same as the number of ideographs contained. 2) The average width doesn't work because character width varies, like ideograph and half-width kana in the test case. Change-Id: I863e8d8e346f555ff184a2f47d615e513b965b34 Reviewed-on: Tested-by: Jenkins Reviewed-by: Miklos Vajna <>
2022-06-07sw layout: allow negative page border distancesMiklos Vajna1-2/+2
Writer follows the CSS box model when it comes to page borders: there can be a positive distance between the edge of the page and the border, and again a positive distance between the border and the body frame. This ensures that the page border never intersect with the body frame, which is usually what users expect. Word, however, can work with 2 distances for border and text, both measured from the edge of the page, leading to a page border, which is inside the body text. This is described at great detail at <>. Fix the problem by allowing negative border distances: this doesn't influence the position or the size of the body frame, but it gives us a way to position the border more towards the center of the page, leading the matching layout between Writer and Word. The doc model (to allow negative border distances), UNO API and DOCX filter is updated in this commit. The ODT filter works without explicit effort. Other filters are not yet updated in this commit. Change-Id: I723e1bdb8dc6391129f1686f88826cc089f6fd67 Reviewed-on: Reviewed-by: Miklos Vajna <> Tested-by: Jenkins
2022-06-03tdf#148309 sw_redlinehide: fix mail merge performance regressionMichael Stahl1-0/+6
The problem is that in the call to pTargetShell->EndAllAction(), the cursor is on the node before the newly appended one that has the page break, and only this node is formatted (via GetFormatted()), so no new page frames are inserted in the layout, which then creates massive performance problems later, particularly since the bugdoc contains multiple at-page anchored flys. (regression from commit 42448f48bb48a13d6618a181b12840db6d85c574) Change-Id: I05cd2a515a7f67132ab1c8c6fa0d675252ea3a15 Reviewed-on: Tested-by: Michael Stahl <> Reviewed-by: Michael Stahl <>
2022-06-02std::move SfxPoolItem into SfxItemSet where possibleNoel Grandin8-16/+16
found with the help of a temporary loplugin (which i have put into the store/ folder) Change-Id: Ide40d09bef6993ace50039a8fd0439b7e29c09a6 Reviewed-on: Tested-by: Jenkins Reviewed-by: Noel Grandin <>