summaryrefslogtreecommitdiff
path: root/sw/inc
AgeCommit message (Collapse)Author
7 dayscool#11785 sw lok: only start idling after the idle jobs timer stoppedMiklos Vajna
Open a 300 pages document with simple content, the load itself only takes ~100 ms, but the time between the end of load and start of rendering tiles is a lot more than that: debug:32053:31994: lo_documentLoadWithOptions: end @ 2092810770 debug:32053:31994: DocumentTimerManager::DoIdleJobs: finished in 3152 ms debug:32053:31994: doc_paintPartTile: start @ 2092814038 -> 3268 ms Looking at the flamegraph in the issue shows that we start processing idle jobs, part of that is sw::DocumentTimerManager::DoIdleJobs(). That used to do ~no layout work since layout was fully done as part of document load before commit bba965b655a9181c07e5cfb6d3a59363e49e650b (cool#11064 sw lok: allow specifying the visible area during doc load, 2025-02-13). Now some layout can be done on idle, and as part of that we call SpellCheckerDispatcher::isValid(), which takes a lot of time, and is not interrupted as a tile request comes in. Fix the problem by extending the delay effort of commit 349748e63c698076bb44f75da9eaa104489e959c (sw lok: delay processing idle jobs to let LOK finish initialization, 2018-12-03), which already had a 1s delay of idle jobs, but it didn't work, because sw::DocumentTimerManager::StartIdling() is also called from e.g. SwRootFrame::SetIdleFlags(), so the idle jobs still started. Now we explicitly don't start idling till m_aFireIdleJobsTimer is active (started, but not yet invoked). With this, the first tiles are rendered much faster after load: debug:14058:13996: lo_documentLoadWithOptions: end @ 2095914924 debug:14058:13996: doc_paintPartTile: start @ 2095915224 -> 300 ms This also means that two tests now don't get idle jobs done after Scheduler::ProcessEventsToIdle() (and this is wanted by default), so explicitly stop m_aFireIdleJobsTimer in those tests to be able to assert what would happen after waiting for long enough. Change-Id: I8398dc7687d8ac0858f804e687593c5cb7c4e47b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184809 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
8 daysSwChildWinWrapper: simplify codeXisco Fauli
Since SwChildWinWrapper::ReInitDlg doesn't have any parameter, the condition m_pDocSh != GetOldDocShell() is always false. Since commit 9f2a362ed67451cda56f89ad57bcaf2bc809b408 Author: Jens-Heiner Rechtien <hr@openoffice.org> Date: Thu Sep 27 10:49:33 2007 +0000 INTEGRATION: CWS swwarnings (1.4.222); FILE MERGED Change-Id: I2c42e813dce3a9cee067d00b81c488cf61569123 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184707 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
12 dayssw a11y: Return vector instead of using out paramMichael Weghorn
Change-Id: I23ef959b5744d1730f3937b876a0ceb187096d2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184605 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
12 dayssw: Rename IsAttrAtPos::Ftn -> IsAttrAtPos::FootnoteMichael Weghorn
Make name less cryptic. See also commit 441e51dcfdcf7263cc945928bc4da24211c44bea Author: Michael Weghorn <m.weghorn@posteo.de> Date: Thu Apr 24 13:03:23 2025 +0200 sw: Rename SwFrameType::Ftn -> Footnote, FtnCont -> FootnoteContainer doing the same in another enum class. Change-Id: Iddc35b2bb14dd177a910187e75e9c0635076aeeb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184601 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
12 daysrename ReferenceMarkerName to SwMarkNameNoel Grandin
as per vmiklos request at https://gerrit.libreoffice.org/c/core/+/184192/comment/dcdeab88_b56fb1ce?usp=email Change-Id: I57883da79db3ffb9c2f0e5c1ca3eaa535610eb7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184615 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
12 daystdf#126154 sw offapi xmloff cui: add min/max word spacingLászló Németh
To avoid of rivers and too much hyphenation, add minimum and maximum word spacing options, similar to XSL-FO/CSS and DTP software. Only limiting hyphenation was implemented: hyphenation of the words are disabled, if it's possible to expand or shrink the spaces of the line within the values specified by the maximum and minimum word spacing. First try to apply the minimum word spacing, and if not possible, then the maximum word spacing. Note: maximum allowed shrinking has been applied for the hyphenated lines instead of the minimum to remove the hyphenation, yet. With the suggested default word spacing values, this results no or minimal differences. New UNO paragraph properties: com::sun::star::text::ParaWordSpacingMinimum com::sun::star::text::ParaWordSpacingMaximum New ODF paragraph attributes: loext:word-spacing-minimum loext:word-spacing-maximum New paragraph settings on Text Align pane: Minimum word spacing Maximum word spacing While the desired word spacing got "Desired" label. Note: suggested values of minimum, desired and maximum word spacing are 80%, 100% and 133% (default values e.g. in Adobe InDesign), in narrow columns e.g. 60%, 100% and 150%. Follow-up to commit 7d6696757dcdfa3cee481ac7795a91b2b47da363 "tdf#159923 sw cui offapi xmloff: add custom word spacing". Change-Id: I7f2a07f7fdb634cb16cdd8c2c937ca911b968405 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184595 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: Jenkins
12 dayssw a11y: Pass frame by ref to SwAccessibleMap::InvalidateRelationSet_Michael Weghorn
Change-Id: I6468df09f1e7447e1837aee64701dccbad637f42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184586 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
12 dayssw a11y: Pass frames by ref to SwViewShellImp::InvalidateRelationSetMichael Weghorn
... and SwAccessibleMap::InvalidateRelationSet. Change-Id: Ifd2c9a4b2fe48cc641ccf31736e886a807fe19b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184585 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-04-23sw a11y: Don't use unique_ptr for selected shape mapMichael Weghorn
This is similar to Change-Id: I383b49fb84fc77ace80053355e9e69b144e6c72b Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Apr 22 14:57:59 2025 +0200 sw a11y: No longer use unique_ptr for frame map , but now for SwAccessibleMap::mpSelectedFrameMap. Change-Id: I590936e5c4460a5066daf36a6dffa8562e70b03d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184446 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-04-23sw a11y: No longer use unique_ptr for frame mapMichael Weghorn
I can see no particular reason for using a std::unique_ptr<SwAccessibleContextMap> for SwAccessibleMap::mpFrameMap, instead of just a SwAccessibleContextMap. So far, an empty map was created if `mpFrameMap` was null in both, SwAccessibleMap::GetContextImpl and SwAccessibleMap::GetDocumentView_, and the member was reset in either the dtor or in SwAccessibleMap::RemoveContext when the map became empty. I don't see any particular reason to have an explicit null value (and check for it in multiple places) instead of simply having an empty map by default. Therefore, switch to using the latter, which simplifies the code. For most places, the previous null check can simply be dropped as the overall logic remains the same with an empty map (e.g. still nothing happens in case of an empty map in most methods because no corresponding entry is found in the empty map.), but keep an expclicit check for these cases: * At the beginning of SwAccessibleMap::BuildSelectedParas, replace the previous null check by checking for an empty map instead of just dropping the check, to avoid unnecessarily iterating over text frames. * In the SwAccessibleMap dtor, also replace the previous null check by a check whether the map is empty. Change-Id: I383b49fb84fc77ace80053355e9e69b144e6c72b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184441 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-04-18sw: Make CompareSwSelBoxes::operator() params constMichael Weghorn
... and drop some const_casts in Writer accessibility code that are no longer needed now. Change-Id: Ifd462ae4a7501d197b6a3678c75ecb967030454d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184360 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-04-18sw a11y: Drop SwShapeList_Impl typedefMichael Weghorn
It is only used a single time, so just specify the full type there. Also move the comment to SwAccessibleMap::mvShapes where it belongs, since it describes the semantics of that class member, not the type in more general terms. Change-Id: I131acd3d144a81d536aa736d07ceed5c1fcf3cb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184339 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-04-18sw a11y: Use std::unordered map directly instead of wrapperMichael Weghorn
No longer use the SwAccessibleContextMap_Impl class that is effectively just a wrapper around std::unordered_map, but use std::unordered_map directly instead, and use SwAccessibleContextMap as an alias/typedef. Change-Id: I14a873076746c81c4fe628810654995f5d8cb9d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184332 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-04-17sw: Pass SwViewShell by ref to some helper functionsMichael Weghorn
It's non-null for all callers and unconditionally dereferenced in the function implementations. Change-Id: I6f82edc7ed05f069c0c05486a8175117e8c40794 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184273 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2025-04-16Make UINames and Programmatic Names typesafeNoel Grandin
by wrapping up OUStrings inside some type-safe wrappers to make it obvious in the code what kind of name we are dealing with. The new classes are in sw/inc/names.hxx Note that I spun the names for table formats out into their own name class TableStyleName, becuase they are weird. Most of the time they are UINames, but not always. Change-Id: Iaf320639fd1aae8ba0f99866ff206906544c42be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178839 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-04-15sw a11y: Return ref in SwAccessibleContext::GetShellMichael Weghorn
Return a ref instad of a pointer in SwAccessibleContext::GetShell and also switch the SwViewShell param for LoadURL to a reference. This also allows to drop the // The shell could be 0 also!!!!! comment in that method. Change-Id: I9a817fb33f79a10f1baccb8c6264dafd9677731a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184231 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-04-15sw a11y: Use ref for SwAccessibleMap's SwViewShellMichael Weghorn
After Change-Id: Iccb2549bfaef37d14f3f7a4b9c691c583b189bb3 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Apr 15 15:31:55 2025 +0200 sw: Let SwViewShellImp hold/return ref instead of pointer to its SwViewShell , it is clear that the SwViewShell passed in the SwAccessibleMap ctor is always non-null. Switch to a reference for the corresponding class member and getter as well. This makes clear that it's always non-null and allows to drop a few null checks/assert/`OSL_ENSURE`s. Change-Id: Id4219064bdde476a331e343c8d6dea4a5af5b23d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184230 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-04-15tdf#159923 sw cui offapi xmloff: add custom word spacingLászló Németh
Add com::sun::star::text::ParaWordSpacing UNO and loext:word-spacing ODF extensions to set desired word spacing of a justified paragraph relative to the width of the space character, like DTP software do. Add Justification section and "Word spacing" spin box to the Text Align pane of paragraph settings. This extends not only the smart justify interoperability feature for custom shrinking (until 0%), but for custom expansion, too, until 1000%, like Adobe InDesign do. Note: this value hasn't been applied in the last paragraph line, yet. See also XSL-FO/CSS word-spacing and commit 7d08767b890e723cd502b1c61d250924f695eb98 "tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt." Change-Id: I06f771335135e4682a1d1abfc9a247dbe4bc6b66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184187 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: Jenkins
2025-04-15replace TabName -> TableName in swNoel Grandin
Change-Id: Ic3e3c8cc8921405cc79abc6e02678426e49e7d7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184224 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-04-15Avoid some casting in ScChildrenShapesNoel Grandin
Change-Id: Ic57ffd1d932f9613716b63902d5565f1f8f6ef0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184145 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-04-15Make reference marker names typesafeNoel Grandin
by creating a wrapper class, to make it obvious in the code what kind of name we are dealing with. The new class is in sw/inc/names.hxx Change-Id: I889c3a56c1cbc451a9a88c4e4340fe4b3183cc2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184192 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2025-04-15sw a11y: Pass concrete type to SwAccessibleMap::InvalidateCursorPositionMichael Weghorn
... instead of passing a Reference<XAccessible> and unconditionally casting that to SwAccessibleContext. Change-Id: I0a41ee0296b08870db241e1971919fe166aaaec8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184140 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-04-11cool#11592 sw lok: fix sometimes lost comments on loadMiklos Vajna
Load a document with the LOK API, execute getCommandValues(".uno:ViewAnnotations"), then listen for comment changes. If the document is complex enough, some comments won't be included anyhwere: neither in the initial comment list, nor as a notification later. What happens is that SwXTextDocument::getPostIts() iterates over the postits of the postit manager, but in case the comment is not yet laid out (pWin is nullptr), then we just ignore that comment when creating the initial comment list. But then SwPostItMgr::LayoutPostIts() won't emit notifications about these comments, either -- assuming these comments are not new. So if the LOK client is fast enough to execute getCommandValues() and the core is slow enough with the layout of the comments, then some initial comments in the documents are lost (they are in the document, but they are not visible). Fix the problem by extending SwPostItMgr::GetOrCreateAnnotationWindow() to give info when it created the annotation window, and then in SwPostItMgr::LayoutPostIts() notify about both freshly laid out comments and about explicitly inserted comments. Adding a bit of debug output confirms that now comments show up even if we hit the unlucky "no annotation window yet" case when testing manually: debug:31555:31497: SwXTextDocument::getPostIts: pWin is 0 debug:31555:31497: SwPostItMgr::LayoutPostIts: lok notify, type is add The first is the state right after load, the second is called by SwPostItMgr::CalcHdl() as a user event ("on idle"); Change-Id: I32082d0014454bd492d2ae87fea42e28b639e8e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184014 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-04-07cool#11226 sw per-view redline on: fix bad record mode change on undoMiklos Vajna
Have 2 Writer views, enable recording for "this view", type a few characters, undo. The recording is now enabled for all views, not just this view. The problem is that sw::DocumentRedlineManager::SetRedlineFlags_intern() only gets flags, so in case UndoRedoRedlineGuard sets new temporary flags & then restores those flags later, then that guard assumes that we return to the old state, but it implicitly calls SetRedlineFlags_intern() with 'bRecordAllViews = true', so the record mode changes from "this view" to "all views" at the end. Fix the problem by changing the RecordAllViews boolean to an enum and introducing a "view agnostic" mode: here we don't care too much about views, since these calls are typically just temporary, but what we care is that 1) if they enable recording, then IsRedlineOn() reports true and 2) if they set new flags & later restore the old flags, the state is unchanged. Alternatives considered: - It would be possible to just touch the model in the "view agnostic" case, but then IsRedlineOn() would still get the recording bool from the view, leading to a stack overflow: lcl_DoWithBreaks() -> sw::DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl() -> sw::DocumentRedlineManager::AppendRedline() -> sw::DocumentContentOperationsManager::DeleteAndJoin() -> lcl_DoWithBreaks() again. - It would be possible to fix this on the undo side (to query the record mode and restore that mode explicitly when restoring flags), but we have many other use-cases for setting & restoring flags: e.g. autocorrect or autoformat. Change-Id: I75697c6b5b3767ad8db899cda080be312eb6c821 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183792 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-04-01tdf#165984 sw cui xmloff: add Paragraph/Column/Page/Spread end zoneLászló Németh
Add new hyphenation options to adjust hyphenation, like DTP software do in accordance with typographic requirements: – Paragraph/Column/Page/Spread end zone spin boxes to Hyphenate Across section of Text Flow pane of paragraph settings; – loext:hyphenation-zone-always, loext:hyphenation-zone-column, loext:hyphenation-zone-page and loext:hyphenation-zone-spread ODF extensions; – widorp.cxx, guess.cxx: handle Column/Page/Spread end zones; – guess.cxx: handle Paragraph end zone (without portions, yet). According to their typography, languages with long words need better adjustment of line break of the last full paragraph/column/page/spread lines, than simply disabling hyphenation by the recent ODF hyphenation- keep or its equivalent MS Word OOXML extension. DTP software use paragraph and column/page/spread end zones to adjust the hyphenation zones in the last lines, for example, setting Column end zone to the 150% percent of the Hyphenation zone, resulting less hyphenation, also less short words parts at the end of the columns, pages and spreads, increasing readability. Note: the default OOXML hyphenation zone 18 pt (or its MS Word variants, for example 21.25 pt) disables single letter or narrow 2-letter (li-, fi-, i.e. fi ligature) hyphenations at 12 pt font height. Setting 27 pt for Column end zone, all 2-letter hyphenation is disabled in last lines of columns and pages. Note: textflow.ui needs multiple adjustment definitions for correct work of the multiple spin boxes. Change-Id: I37bbb4da30de0ec75eb8636f70d8e16588c56ed1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183565 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2025-04-01cool#11357 sw redline reinstate: fix undo string for a single redlineMiklos Vajna
Open a document with an insert redline, reinstate, check the undo stack, it says we have a "delete" on it. This is technically true, but the user did a reinstate, which happens to be implemented as a delete for inserts. Fix the problem by adding a dedicated SwUndoId::REINSTATE_REDLINE and use that when reinstating a single redline. The "reinstate multiple redlines at once" case still needs fixing. Change-Id: Ib2c58ac41fcb86b2f947b041ada318ea2a361e8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183589 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2025-03-31cool#11357 sw redline reinstate: add a reinstate-all commandMiklos Vajna
Accept and reject can be invoked for all redlines in a document, the same doesn't work with reinstate. Additional problem is that sw::DocumentRedlineManager::AcceptAllRedline() iterates over redlines by consuming them, but reinstate creates new redlines, so just naively doing the same would create an infinite loop. Fix the problem by reusing SwEditShell::ReinstateRedlinesInSelection() for reinstating all redlines: we can easily select the entire document and reinstate the selection's redlines. Change-Id: I24c84c1e5add59d94958bccff65261b5940d3104 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183530 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-03-28loplugin:constparam in swNoel Grandin
Change-Id: Ic169c3c090d5617fb22d9dbb6c09dc3ec69e57fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183431 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-03-28cool#11357 sw redline reinstate: add a reinstate-and-next commandMiklos Vajna
Accept and reject has a way to do their action & move to the next redline, reinstate is missing this combo. This is because these versions are separate UNO commands and reinstate just has the direct .uno:ReinstateTrackedChange. Fix the problem by adding a new .uno:ReinstateTrackedChangeToNext that does this, together with the command state. Also add it to the menubar. Change-Id: Ica2358b3fc38cc66e801292ab13f8ba3ec4e9ece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183410 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-03-27tdf#88908 sw: Add BalanceSpacesAndIdeographicSpaces compat optionJonathan Clark
Added a new Writer compatibility option, as noted. When enabled, Writer adjusts the width of certain normal space characters to one half the width of a CJK ideographic space. This adjustment is only applied to leading and trailing spaces, multiple sequential spaces, and spaces between CJK characters. This flag is enabled automatically when importing DOCX files with the w:balanceSingleByteDoubleByteWidth option enabled. This flag is also enabled automatically when importing DOC files with the fDntBlnSbDbWid compatibility flag unset. Change-Id: I1c666a9894f2e0f302df57203b1cf488cc13000b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183412 Tested-by: Jenkins Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2025-03-27tdf#165918: Avoid bookmarks correction when removing temporary nodesMike Kaganski
When loading a table, each cell contains an extra node, which is dropped when finalizing the cell. The removal of the node calls SwDoc::CorrAbs, which it turn calls MarkManager::correctMarksAbsolute. The latter looks through all existing bookmarks, checking if they need to be corrected. In documents with lots of tables and lots of bookmarks, the time taken by eack following call to SwDoc::CorrAbs grows quadratically. We know, that these extra nodes in cells do not affect bookmarks, and it is safe to just skip these specific nodes from bookmark correction. This speeds up loading bugdoc by 40% in my testing. Change-Id: I61b587d04c9ae2301d9fef497885fb76c2d3ae74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183348 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-03-26tdf#165910: use sal_Int32 for match countMike Kaganski
This is what all the functions called from SwView::FUNC_Search return: SwWrtShell::SearchAttr, SwWrtShell::SearchTempl, SwWrtShell::SearchPattern; and all of them use SAL_MAX_INT32 to denote 'cancel' state. Change-Id: Icec9c6b33ebfc856e4a67320f3442324db7459d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183324 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-03-24cool#11357 sw redline reinstate: handle a single rich deleteMiklos Vajna
In case the cursor is inside a delete redline (single-paragraph, plain text), then .uno:ReinstateTrackedChange works for that change. If the change contains formatting, then that formatting is not copied to the insertion. This is simply because SwEditShell::ReinstatePaM() gets the content of the delete redline as an OUString. Doing a rich copy would preserve formatting, but then sw::DocumentContentOperationsManager::CopyImplImpl() would use lcl_DeleteRedlines() to strip away content which is inside a delete redline, so that won't work out of the box, either. Fix the problem by copying the content of the delete redline to a clipboard doc and inserting from there, and by introducing a new bDeleteRedlines flag (defaults to true). When that flag is off, the copy does what we need here: it preserves formatting, but doesn't strip away content which was originally inside a delete redline. Go via SwTransferable instead of invoking sw::DocumentContentOperationsManager::CopyRange() directly, because this way the inserted content will be inside an insert redline & we get working undo/redo out of the box. Change-Id: Id853844b7282c6b1c36cb0f4f8cc75d968e53dcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183270 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2025-03-21tdf#165827 Assign id to ConvertFieldToText undo actionOliver Specht
Fixes "Replace $1 $2 $3" entry in undo dropdown. Change-Id: I108cf408ac4f703677d1b013864e6295f7b52e6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183173 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2025-03-21Revert "tdf#164490 Use stronger typed SwClient"Ilmari Lauhakangas
This reverts commit 13c5a3b07e4dd66a80bd20556dffbd96a910bb74. No improvement. Change-Id: Ib2c315b0b464068998b299e4f73fffda2a1a4688 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183153 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2025-03-20cool#11357 sw redline reinstate: handle inserts in selectionMiklos Vajna
In case the cursor is inside an insert redline, then .uno:ReinstateTrackedChange works for that change, but if multiple inserts are selected, then this simply results in a reject with no history. This happens because SwView::Execute() has a bool for the accept, so if we have accept/reject/reinstate slots, then by default reinstate is handled as a reject (this is not terrible, reinstate is meant to be "reject with history"). Fix the problem by adding a new SwEditShell::ReinstateRedlinesInSelection() which can decide what redlines are in the selection and then by invoking reinstate on these redlines. Similar to accept/reject, it works to only partially select a redline, which results in a split: the non-selected part is left unchanged and we invoke the action on the selected part. Change-Id: I21a5896f9bd983d8ca8e2480826421c6bffbe556 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183170 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-03-20tdf#164490 Use stronger typed SwClientAkshay Kumar Dubey
Change-Id: I2afe819dee8fbc9b2a5cfeb6de80f7fc72d33ae9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182208 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2025-03-19cool#11357 sw redline reinstate: implement this for a single insertMiklos Vajna
When reviewing a document with tracked changes, sometimes we want to reject a change with history, which is currently hard to do on the UI. For a single insert, a workaround is to select the insert redline and then press delete, that'll create a delete redline on top of the insert one. Fix the problem by adding a new .uno:ReinstateTrackedChange UNO command that does this for the insert redline under cursor. More cases (e.g. handle all selected insert redlines) are still to be handled. Change-Id: I61dbe38bcfffc9a0a9cf009531d8bf28cfd1e13b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183115 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2025-03-19tdf#149825 Add command to insert a paragraph break before tableUjjawal Kumar
Change-Id: I7af1a4bba7222f7989aa99bc158f6e4081aad226 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182873 Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Tested-by: Jenkins
2025-03-18tdf#162343 speedup redline documentNoel Grandin
we spend a lot of time searching for changes by calling GetTextOfArea. Speed that up by avoiding intermediate OUString and OUStringBuffer creation. Takes load time from 19 sec to 4 sec for me. Change-Id: Iae124d3668ddb874ddf12e209348c1f696e5549b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183101 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-03-17tdf#45946 Add function to convert field to textOliver Specht
The current field can be converted to it's representing text. Exceptions are fields in header or footer that have multiple representations like page number or chapter fields. Change-Id: I62b92b2d0b2ed766a2722ffd804496008b72e792 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167900 Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2025-03-17tdf#164797 - sw a11y: add new check of links and references in Header/FooterBalazs Varga
to warn users about PAC "Link annotation is not nested inside a Link structure element." errors, so they can avoid them. Change-Id: I8d1fc7042e2ee34a5777c3a448d2379038ea24e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182868 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
2025-03-14cool#1125 Reduce cost of spell checking in writerNoel Grandin
Loading a new CharClass for each NextWord() call can add up. Change-Id: Ie15f2adcd4c603074320b49d5c0276f558aab3e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182919 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2025-03-13tdf#165701 sw: fix unexpected list level change on inserting new bulletMiklos Vajna
Go to the end of the 3rd paragraph of the bugdoc, press Enter, list level of both the old and new paragraphs change from 5 to 4, unexpectedly. It seems what happens is that the paragraph in question has a style which has its outline level set to 4. So once the node is split, the newly inserted node will host the old text (so need to set the style on it to the old style, which sets list level to the outline level from the style as a side effect) and the old node will host what looks like a new bullet point on the UI, so there we need to set the paragraph style to the follow style. This second set-style also drops the list level direct formatting and takes the outline level from the style. Fix the problem by keeping the old scenario (paragraph style with a different follow style) unchanged, since a different list level on an actual paragraph style change can be expected -- but avoid setting a list level when this is a simple node split with just the same style on both nodes. That's not seen as an explicit "set style" by the user, so changing the list level there is confusing. In fact the list level is fine after copying the text node's item set from the old node to the new node, just make sure that SwTextNode::ChgTextCollUpdateNum() doesn't set a new list level in the "effectively no style change" case. Make sure to not set a new list level at both places (SwTextNode::MakeNewTextNode() does this for the previous node, SwTextNode::ChgFormatColl() does this for the next node). Change-Id: Ifdf9048f01fef7bb8e99098ebeb5d1ec339fdaa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182869 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-03-11cool#11226 sw per-view redline on: support this-view <-> all-views transitionMiklos Vajna
Have 2 views, enable "this view" recording in view 1, then try to transition to "all views" still in view 1, nothing happens. This is because SwEditShell::SetRedlineFlags() checks if the redline flags would change (for this view) and since they don't change, we return early. Fix the problem by passing a "record mode change" bool around, which is set when when we keep recording on, but would switch between this-view vs all-views to still update the various views accordingly. Note that we have 3 states here, with the following intention: - off: if we transition to this, all views go to off - this view: transitioning to this from "off" just enables the current view, but transitioning to this from "all-views" turns off all views - all-views: if we transition to this, all views go to on Now all the 6 transitions between the 3 states is meant to work without surprises. Change-Id: I6e4d9e40f7008f680c476825a4d15dab12c6dadc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182764 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2025-03-08tdf#71583 Add page count of ranges with consecutive page numberingOliver Specht
Adds a field that counts the pages in ranges defined by page number restarts Change-Id: Ie0727ab20c81464918ad5fb9aa42046bf00aa63c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178141 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Tested-by: Jenkins
2025-03-05cool#11226 sw per-view redline on: state for the per-view and per-doc commandsMiklos Vajna
The UI for recording is one toolbar button (toggle) with a dropdown that has 2 radio buttons. The expectation is that once the toggle is on, one of the radio buttons report enabled state. So this is a tri-state: the record status is off, per-view or per-doc on the UI. At a code level, we have a per-doc flag and we have a boolean in each view. The requirements: 1) Compatibility: if the dropdown menu is not used, then clicking on the old toggle should enable recording for all views & once it's enabled (either per-view or per-doc), clicking on it should disable the recording. 2) If recording is on, the exactly one of per-view or per-doc radio button in the submenu should report enabled status. This leads to a not entirely symmetric behavior if you compare the enable, status and disable parts of this commands, and this is wanted to result in the least amount of surprise. Fix the problem by: 1) Enable: the toolbar button enables recording for all views (to stay compatible), the dropdown menu allows choosing between this view vs all views. 2) Status: the toolbar button reports enabled status if recording is on for this view for any reason; the "this view" command reports enabled status if recording is on in this view but not in all views; the "all views" command reports enabled status if recording is on in this view and no other view has it disabled. 3) Disable is almost the opposite of enabled, but the toolbar toggle can always disable recording, so a per-view -> off -> all-views transition is possible by clicking on the toggle twice. This required a single change to testTrackChangesPerViewEnableOne, because now going back to the no-record state is doable by clicking on the enabled toolbar button, i.e. by dispatching the .uno:TrackChanges command; dispatching .uno:TrackChangesInThisView always changes to the per-view recording. Change-Id: Iacc984f832b4c08e0e100a67774e1e559729d82a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182539 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-03-05cool#11226 sw per-view redline on: allow both per-view and per-docMiklos Vajna
Have two windows for a document, record changes in one view, and be surprised that now this is not turned on in the other view since commit ae6d396552cd3cebd7fba4942e6ca2fd5de579af (cool#11226 sw per-view redline on: add view-aware getter, 2025-03-03). Adding the ability to record changes per-view is intentional, but it was not a deliberate choice to also remove the old per-document recording. Fix this by turning the "is recording on" UI into a tristate, so the user can enable recording for all document windows or just the current document window -- similar to how showing changes can be off, inline and there are also 2 more on-margin options. The state of the new UNO commands still has to be implemented. Change-Id: I1e5271d4cc8900a28c7a8da8d34e00fec9e2e1b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182527 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2025-03-03tdf#155050 Replaces the Bibliography entries with Citationbruh
The patch replaces Bibliography entries in Tables Of Contents and Index and bibliography dialog box with Citation. Left some of the entries in sw/uiconfig/swriter/ui/bibliographyentry.ui and sw/uiconfig/swriter/ui/createauthorentry.ui unchanged as per the discussion on the bug page, where it was mentioned not to modify them. Change-Id: I34c0051806a799b50d546841960c5d5a04b60196 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181224 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2025-03-03cool#11226 sw per-view redline on: add view-aware getterMiklos Vajna
Have 2 views, view 1 enables tracked changes recording by dispatching .uno:TrackChanges, view 2 does not. The result is that this gets enabled in both views, including the toolbar button state, insertion recording, deletion recording. The toolbar button state behavior was introduced in commit d890ec2f130188af9d998abf5968f06e7218b7a4 (tdf#101592 sw: track changes state is doc-specific, not view-specific, 2016-08-19), but there the motivation was that *if* the setting is per-doc, then all views should show the same toolbar button state. Fix the problem by: - improving SwDocShell::IsChangeRecording(), so it takes a hitn on what is the relevant view; the relevant view is the view where the state is updated, it may not be the current view - using sw::DocumentRedlineManager::GetRedlineFlags() everywhere, so we'll have a central points for reading these flags - extending sw::DocumentRedlineManager::GetRedlineFlags() to try to take the "is recording" setting from the current view (if there is such a view) - improving SwEditShell::GetRedlineFlags() to pass itself to sw::DocumentRedlineManager::GetRedlineFlags(), so the entire chain of calls for the toolbar button work with the correct view Also add tests to make sure all of uno command state, insert & delete works. Drop the desktop/ test that is now redundant -- and testing per-view callbacks there is harder than in sw/. Change-Id: I6dbd826ea27facb9f8d06029efe805c637b7e080 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182423 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>