summaryrefslogtreecommitdiff
path: root/sw/qa/uibase/shells
AgeCommit message (Collapse)Author
2025-03-03Related: cool#11226 sw per-view redline on: fix ratio buttons of is-showMiklos Vajna
Redline recording is now per-view, but it would be even better to have UI where the user can decide how to record (don't record, record per-view, record in all views). While looking for an example to follow, I noticed that the redline show UI is similar, but the radio buttons always have a false state. Turns out simily the command state wasn't implemented in commit 6aeeef8807fef36295b65d0a300a21466bfbeda0 (tdf#116757 sw ChangesInMargin: add "Show Insertions in Margin", 2021-01-20), add this. Change-Id: Ie50c13c45c4e53fbfbb6befa36b6a29be084f2d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182427 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2025-02-20FillApi: fixed JSON validity issuesAttila Szűcs
Changed extract to always extract a valid JSON file. Extract changed in 2 place: At charts: old format: "DataValues": [ "Row.0": [ "22", "24"], "Row.1": [ "18", "16"], "Row.2": [ "32", "32"], "Row.3": [ "25", "23"] ] New: "DataValues": [ [ "22", "24"], [ "18", "16"], [ "32", "32"], [ "25", "23"] ] At Slides the following arrays changed to objects: "MasterSlides" [ -> "MasterSlides" { "Slides" [ -> "Slides" { "Objects" [ -> "Texts" { "Texts" [ -> "Texts" { Change-Id: I18180db714c0d0701380376a72e608cb080b67cd --- Transform will still accept the old not valid JSON files also, But for now, they will also accept a bit different JSON format file that is valid JSON. "Transforms" now can be an array and all of its element an object old: "Transforms": { "Charts.ByEmbedIndex.0": { new: "Transforms": [ { "Charts.ByEmbedIndex.0": { The same chanes was at : "Charts.????" "UserDefinedProperties" //at Document Properties --- These changes was needed only becsuse of 2 JSON rule: 1: Arrays can not conatin propertyes. (only values, and objects are allower) 2: Objects cannot have 2 property with the same name. Also updated unit tests. Change-Id: I70311b1c6da57305dc1d9e8ec1f29ab5aa93ee56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181934 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-01-14Add unit tests for .uno:DeleteContentControl commandcodewithvk
- Added tests for deleting Rich Text, Checkbox, Dropdown, and Date content controls. - TODO: Add test for Picture content control. Change-Id: Icf423ab85d6a28c6c33412677fd1eb44d0ae94f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176068 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-12-20SW: extract transform DocPropertiesAttila Szűcs
Implemented Document Properties extraction, and transformation. For UserDefinedProperties Properties you can use add, and delete commands. If the property already exist, "add" will delete that, before adding the new UserDefinedProperty see the unittest for an example. Change-Id: I036b73bf1539bc25f454aea64c319241177e167a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178918 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-10-30SwModelTestBase: add getSwTextDoc and use it everywhereXisco Fauli
Change-Id: I09f132a9c79f0aa4c3f4d3ca5f2fed233d0dcb06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175641 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-25sw/qa: use getSwDocShell() when possibleXisco Fauli
Change-Id: Ia2e3dad4e62fb084c3a88564deb137cbcc7728b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175573 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-21Optimize JsonToPropertyValues a bitMike Kaganski
1. Make it take string view: helps to avoid extra string allocation e.g. in desktop::jsonToPropertyValuesVector, and will help more, when C++26 stringstream ctor taking string view is available. 2. Factor out a function taking boost::property_tree::ptree, making implementation simpler for [][]com.sun.star.beans.PropertyValue and []com.sun.star.beans.PropertyValue, without writing a child node to a JSON string, and parsing it again. Change-Id: I16ac2641633ea67a7c9c054c9df09a790500e6fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175361 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-10-18SW: extract transform charts (using dialog code)Attila Szűcs
Implemented chart data extraction, and transformation added insert/delete/modify row/column, and the ability to set resize data table setcolumndesc / setrowdesc .. for 1 descriptor, or with multiple descriptor to set set 1 cell value, or set the whole table cells values. it will resize the table, but you can still use partial arrays like "data": [ [ 1,2,3,4 ], [ 2,3,4,5 ], [ 3 ], [ 4,5,6,7 ], [ 2,2,1 ], [ 5,6,7,8 ] ], that means the 3. row 2,3,4th cell will not be overwritten. for insert column, it call codes from DataBrowserModel. (used by dialog code) added tests, fixed a contentcontrol date problem 2. commit (made by Caolan) squashed into 1. commit: WIP hack this to link move stuff from chartcontroller to chartcore and adjust visibility until it links at least Change-Id: I5529f4da33f046eef7e947d755e29486fa966274 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172849 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175121 Tested-by: Jenkins
2024-08-09simplifyNoel Grandin
Change-Id: I7d8e8b13166537d0e9c60ff0be01f680a817ca5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171699 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-08-04simplify IMark hierarchy (6)Noel Grandin
merge IMark into MarkBase Change-Id: I5d3c648c950f97497c96912c25081906de434056 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171464 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-08-04simplify IMark hierarchy (5)Noel Grandin
merge into IFieldmark into Fieldmark Change-Id: Ide5c01fe49bae0be45746f6b581d72342da9c3a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171463 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-06-13loplugin:ostr in sw/qaNoel Grandin
Change-Id: Ib67997a3f491afaec380ef65bc60588362d9cc3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168812 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-23sw/qa: warning C6011: Dereferencing NULL pointerXisco Fauli
Change-Id: I2e84af9463b82600079660a1b136bc9a85d8eb0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167925 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-05-13Revert "reduce symbol visibility in sw"Thorsten Behrens
This reverts commit 1a6711276f0c8abeb0028a47cc345a7453374a38. After some discussion and experiments, it turned out this rather fundamentally breaks clang's PCH build. Conclusion was: this change is not significant enough to warrant making life harder for developers. Excerpt of errors (affected were vbaswobj, msword & swui libs): - ld.lld: error: undefined symbol: SwFormat::~SwFormat() >>> referenced by fmtcol.hxx:37 (sw/inc/fmtcol.hxx:37) >>> core/workdir/CxxObject/sw/inc/pch/precompiled_vbaswobj.o:(SwFormatColl::~SwFormatColl()) - ld.lld: error: undefined symbol: SwFrameFormat::SetPositionLayoutDir(short) >>> referenced by precompiled_msword.cxx >>> core/workdir/CxxObject/sw/inc/pch/precompiled_msword.o:(vtable for sw::SpzFrameFormat) - ld.lld: error: undefined symbol: SwFrameFormat::SetLayoutDir(SwFrameFormat::tLayoutDir) >>> referenced by precompiled_swui.cxx >>> core/workdir/CxxObject/sw/inc/pch/precompiled_swui.o:(vtable for sw::SpzFrameFormat) Change-Id: I1dcf115cc191b1ebf1f8d5023c0c5015f891287a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167549 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-04-11CppunitTest_sw_uibase_shells: turn on set_non_application_font_useMiklos Vajna
Similar to commit dc4d7500c9d283e26d1553ce11366a217cf1f69d (Fix CppunitTest_sd_import_tests-smartart non_application_font_use, 2023-10-23), got rid of 'MS 明朝' as suggested by the failing assert. Change-Id: I24dcf0bffa8c213f776c0483d53fdee64ff7a413 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165982 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2024-03-13reduce symbol visibility in swNoel Grandin
Change-Id: Ib3edefc365d3c605c3024e160572fa4030100ef1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164724 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-19Extended loplugin:ostr: swStephan Bergmann
Change-Id: I210f61f6d90776b086b7058fb1a831d235699fb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159670 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-25tdf#139141: Add UNO commands for variable date/time fieldsXisco Fauli
Impress already has both options in the menu Also re-enable test disable with fa569930a0968cdeba4441e19a68e7d78aa25cb4 "Revert "Resolves tdf#139141 - Make variable date/time field the default"" Change-Id: I1cec89b5901073555ffa31d2be24e1e62fbbdcb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158391 Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Tested-by: Jenkins
2023-10-23Revert "Resolves tdf#139141 - Make variable date/time field the default"Heiko Tietze
This reverts commit e37f06f534ac864f9fe8cd20b07a85c36e697d41. and ui test from Ia1a2387e137f8a672a24056b13234d4275a77ca4 Reason for revert: tdf#157337; macros rely on fix field values Change-Id: I7a638330aac9b71432556454c0104479fcd05b4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158041 Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2023-10-23Extended loplugin:ostr: Rewrite some O[U]StringLiteral -> O[U]StringStephan Bergmann
...in include files. This is a mix of automatic rewriting in include files and manual fixups (mostly addressing loplugin:redundantfcast) in source files that include those. Change-Id: I1f3cc1e67b9cabd2e9d61a4d9e9a01e587ea35cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158337 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-08-30tdf#77760 sw floattable: add support for footnotes, UIMiklos Vajna
Import filters could already create footnotes in floating tables, allow the same from the UI. Use IsFlySplitAllowed() as the check, because that already knows rejecting special anchor locations like footnotes/headers/footers in addition to actually decide if this is a split fly or not. Change-Id: Ib9bab7b29d1bea0c15f3d829d16c9edbf1455b6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156275 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-05-15tdf#148979 Added option to update selected fieldTokieSan
Added Uno command UpdateSelectedField, FN_UPDATE_SEL_FIELD to support updating a single selected field Change-Id: Ia1a2387e137f8a672a24056b13234d4275a77ca4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150450 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-04-20Allow Copy Hyperlink Location in protected fieldsVojtěch Doležal
This change aims to make it possible to copy hyperlinks from protected fields. That includes showing command and fixing it's broken behaviour, which wasn't detectable because it was hidden. Change-Id: I119e7617fcd7261e437411c86d4c920931e9fe84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150070 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-04-17Remove some unused includesMiklos Vajna
Mostly com/sun/star/frame/Desktop.hpp is unused after inheriting from UnoApiTest. Change-Id: I71b75fa5c880337ff294583b96af09c90b5059c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150514 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-02-23SwModelTestBase: add selectShape helperXisco Fauli
See discussion in https://gerrit.libreoffice.org/c/core/+/147506 Change-Id: If3f3b471d5053dbc1bf34383e64e9672d026aaae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147515 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-02-16SfxViewShell::GetViewFrame never returns null, change to a referenceCaolán McNamara
various null checks can be seen to be redundant and removed Change-Id: Icf49c1de4b0302795d2769a370af3abceaad0221 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147147 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-01-20sw: add a new .uno:DeleteSections UNO commandMiklos Vajna
This is similiar to commit 1d6593dd799ff4eb931ffbb5338e4856fb87f77f (sw: add a new .uno:DeleteFields UNO command, 2023-01-16), but that deleted refmarks (used for e.g. Zotero citations), while this deletes sections (used for e.g. Zotero bibliography). Implement the section "unlinking" (delete the section, but not its data) by deleting the section format: that will remove the matching section node as well, but not the content nodes. Change-Id: Ib00a8f592ddbb77c5e8e08ff94bb0eebfcf7cea8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145870 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-19sw, .uno:InsertField: handle Endnote as a value for the Wrapper parameterMiklos Vajna
This is similar to commit 43d80906c8693ca27c5b3077fbaa259df4004924 (sw: .uno:TextFormField: handle Endnote as a value for the Wrapper parameter, 2023-01-17), but that was for fieldmarks & endnotes, this is for refmarks & endnotes. Change-Id: I46512dd973508f51f7093521c40ad4100dd39ae6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145762 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-18sw, .uno:InsertField: add a new Wrapper parameterMiklos Vajna
This is similar to ceea8f3924f26d5f10adc41b9ea587c77c2fda74 (sw: .uno:TextFormField: add new Wrapper parameter, 2023-01-16), but that was for fieldmarks & footnotes, while this is for refmarks & footnotes. Also start a new test file as the one for the entire directory starts to grow too long. Change-Id: Ib7c0e03d6686a8a52a5691a4e2dbf97dcc2facba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145698 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-01-17sw: .uno:TextFormField: handle Endnote as a value for the Wrapper parameterMiklos Vajna
This is similar to the fieldmark-in-footnote case, but here we need to make sure that the layout is calculated before the cursor attempts to jump to the endnote, otherwise the fieldmark will be inserted before the endnote anchor, not in the endnote body. The move of StartAction() / EndAction() calls can be done unconditionally, it's not a problem for the existing footnote case. Change-Id: I772d27937456978ca6aa01148eff3163d8877208 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145660 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-17sw: .uno:TextFormField: add new Wrapper parameterMiklos Vajna
Currently all fieldmarks are inserted into the document body unconditionally when this UNO command is dispatched. Inserting at the current cursor position makes sense, but some citation styles want to insert the actual citation as footnotes, and only have the footnote anchor at the cursor position. Fix the problem by adding a new Wrapper parameter to this UNO command: currently the only interesting value it may have is Footnote, if this is specified then first we insert a footnote and the footnote content will host the fieldmark, not the original body text. The same will be wanted for endnotes as well, but that's not yet done in this commit. Change-Id: I5c96c7dc9ddaace09b1dbc21b8f12005a2934d04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145602 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-01-16sw: add a new .uno:DeleteFields UNO commandMiklos Vajna
This is similar to 40753de837b9776dd8b33e830be0cceef83f024a (sw: add a new .uno:DeleteBookmarks UNO command, 2023-01-13), but that was about deleting bookmarks matching a given prefix with their name, and this one is about reference marks (fields in general), matching a certain type & prefix with their name. Change-Id: Iec953034cd0e6875f173712b0fb10bfddf16ed3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145551 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-13sw: add a new .uno:DeleteBookmarks UNO commandMiklos Vajna
This is similar to commit c68d06dfa1498f862923eaddf3e5d247650a53d5 (sw: add a new .uno:DeleteTextFormFields UNO command, 2023-01-10), but that was for fieldmarks and this is for bookmarks. The primary use-case is to specify a prefix for the name, so e.g. all Zotero-related bookmarks can be removed, but it can be also used to remove all bookmarks when no prefix is specified. Change-Id: Ifc1f666f66d9fc3f6cd055f9263f0e4f949c191d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145458 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-13sw: add a new .uno:UpdateField UNO commandMiklos Vajna
This is similar to commit ea208f6004770eb4b81d28e6930cd0c7bd5d8f12 (sw: add a new .uno:UpdateBookmark UNO command, 2023-01-11, but that was for the bookmark under cursor, and this is for fields (refmarks as a start). Change-Id: I3e547b668361898b7ed734ea325fdf1d74e5dbb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145427 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-12sw: rename .uno:UpdateSections command fieldsPranam Lashkari
renamed fields name in JSON to be consistent with section insertion and getter Signed-off-by: Pranam Lashkari <lpranam@collabora.com> Change-Id: Icca0be155542b7dc6df1b29e6c7d4191db8659ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145315 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit cc4f876d05837679caa8c86ffd8be8598b8f429e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145308
2023-01-11sw: add a new .uno:UpdateBookmark UNO commandMiklos Vajna
It is possible to update all bookmarks (having a certain name prefix) and their contet, but one can't update the bookmark under the cursor, which is needed for Zotero citation clusters. Fix the problem by adding a new .uno:UpdateBookmark UNO command that can update the (innermost) bookmark under the current cursor. This can be implemented on top of the recently added IDocumentMarkAccess::getBookmarkFor(). The UNO command is intentionally hidden from the customize dialog since it only makes sense to invoke it from a macro / API with parameters, not interactively. Change-Id: I3e750dfb637f50716be1155a94bc986131b84f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145351 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-10sw: add a new .uno:DeleteTextFormFields UNO commandMiklos Vajna
Users sometimes want to "unlink" their citations, which means deleting the fieldmarks (if fieldmarks are used to represent citations, e.g. with Zotero), which means keeping the field result as-is, but removing the field metadata and the actual field start/seprator/end characters. Do this similar to .uno:TextFormFields, which can do an update of such fieldmarks, i.e. add the ability to filter for a certain type and field command prefix. This is meant to allow removal af all fieldmark that belongs to one one feature, e.g. Zotero. This is similar to 7765b442e13048f857fd7ee49ced1731caee297e (sw: add a new .uno:TextFormFields UNO command, 2022-11-28), but this is about deleting (the field commands, not the result), while that was about updating. The same for bookmarks & refmarks are not yet supported. Change-Id: I02548b030b1822f7b36d3bc5ff9553d728f065c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145272 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-10sw: add a new .uno:UpdateSections commandMiklos Vajna
There was LOK API to insert a new section with provided HTML content and to query it, but there was no LOK API to update such created section with new names/contents. This is needed in case Zotero wants to store citations with refmarks, in which case it wants to store the bibliography with sections. Introduce a .uno:UpdateSections UNO command that can do this: the sections will be renamed if necessary & the content will be updated. The content update is reasonably straightforward, because the section always contains at least one empty paragraph, so there is no danger in simply deleting the old content before inserting the new one. This is similar to babba472391d26aed68d7ac31c7a918c08e65256 (sw, UpdateFields: add new TypeName, NamePrefix and Fields parameters, 2023-01-04), but that was for refmarks / citations, this is for sections / bibliography. Change-Id: Idde6d5ed1b0f25f40df502bb6b7e7ca590ef9151 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145249 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-10sw, UpdateBookmarks: support renaming bookmarksMiklos Vajna
The problem was that the LOK API client wanted to change the name of the bookmark, but nothing happened, because we had a sanity check that made sure the provided vs existing bookmark names match. The intention was that the bookmark name is just an ID (you can store additional properties in per-doc custom properties, those can change), so we can require that bookmarks never get renamed when using this command. Fix the problem by dropping this requirement and rather use renameMark() to adjust the in-doc bookmark name if needed. This also handles undo/redo for us. Change-Id: I7a426c865ddf24f13741c0369fb3991da2e881b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145235 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-01-06sw: add a new .uno:UpdateTextFormField UNO commandMiklos Vajna
It is possible to update all fieldsmarks (of a certion type, of a certain field command prefix), but one can't update the fieldmark under the cursor, which is needed for Zotero citation clusters. To make this more complex, insertion inside an existing fieldmark is explicitly not wanted, see commit a178a2ac6df8dc63a7ab8d4a19b90ae8a17baca4 (sw UI: fix crash on inserting a fieldmark inside a fieldmark, 2023-01-02). Fix the problem by adding a new .uno:UpdateTextFormField UNO command that can update the (innermost) fieldmark under the current cursor. The uno command is intentionally hidden from the customize dialog since it only makes sense to invoke it from a macro / API with parameters, not interactively. Change-Id: I46fc4f701a20839945d765eb13aec7362ab83788 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145135 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-05sw update of refmarks: fix handling of ignored refmarksMiklos Vajna
As pointed out at <https://gerrit.libreoffice.org/c/core/+/145036/1#message-165c0282ace92160592c896c6867095d3558ee96>, it's not correct that UpdateFieldConents() uses a single index into both the provided fields/refmarks array and into the document's all refmarks array. We need a new index that counts the input fields/refmarks we got and which is not incremented for ignored refmarks. Extend the testcase to have 2 paragraphs in the document: the first paragraph has a refmark that is to be ignored and the second para has a refmark that is interesting to us. This makes the test fail. Then fix up UpdateFieldConents() to properly count how we iterate through all refmarks and the provided refmarks in parallel. Change-Id: I1fabf5b29beeabe9e8a126f1662ca8830e5c4e20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145068 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-04sw, UpdateFields: add new TypeName, NamePrefix and Fields parametersMiklos Vajna
Currently the .uno:InsertField command allows inserting a refmark with a provided name & content, but existing refmarks can't be updated similarly. This is a problem in case Zotero citations are to be modeled with refmarks. Another trouble is that refmarks don't have dummy characters and have to stay inside a single paragraph, so we need to be careful to replace the content in a way that keeps the refmark alive, a naive delete + insert will delete the refmark as well. Fix the problem by extending the existing .uno:UpdateFields command with 3 new optional parameters, somewhat similar to what commit 724180ec495a696c79332653cb6fb52ecfbccc29 (sw: add a new .uno:UpdateBookmarks UNO command, 2022-12-14) did. As usual, the provided new text is meant to be HTML, which allows formatted content. Change-Id: Ib0951aa1a39e1b47bcf8b47bc9d65c89e0853e96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145033 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-02sw UI: fix crash on inserting a fieldmark inside a fieldmarkMiklos Vajna
Inserting a fieldmark using .uno:TextFormField, then entering into that fieldmark using the cursor, finally doing in insertion again using .uno:TextFormField resulted in a crash. The problem is that lcl_SetFieldMarks() uses 3 IDocumentContentOperations().InsertString() calls to insert the field start/separator/end, but right after inserting the field start we already create an sw::InsertText hint, which works with an inconsistent string (the start is already inserted but not the separator / end). Fix the problem by just not allowing the insertion of fieldmarks inside fieldmarks on the UI: these are meant to be read-only for the user, so fieldmark insertion is OK to be not working, as long as a clear error message is provided. An alternative approach would be to insert the inner fieldmark in a way similar to how import filters can do it, but that would be more work. Change-Id: I7d1a7c638b179fd9149ccdc47215329e3433b6e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144947 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-12-14sw: add a new .uno:UpdateBookmarks UNO commandMiklos Vajna
Current the .uno:InsertBookmark command allows inserting a bookmark with a provided content into the document, but an existing bookmark can't be updated similarly. This is a problem in case Zotero citations are to be modeled with bookmarks. Another trouble is that bookmarks don't have dummy characters, so we need to be careful to replace the content in a way that maintains these bookmarks, a naive delete + insert will collapse them. Fix the problem by introducing a new .uno:UpdateBookmarks command, somewhat similar to what commit 7765b442e13048f857fd7ee49ced1731caee297e (sw: add a new .uno:TextFormFields UNO command, 2022-11-28) did. As usual, the provided new text is meant to be HTML, which allows multi-paragraph, formatted content. Change-Id: Id5bb3fd2fd9e147d98709b5a7e0c322e73c6d283 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144167 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-12-09sw: remove unused DocumentContentOperationsManager::InsertGraphicObject()Miklos Vajna
Only tests called it, migrate those to DocumentContentOperationsManager::InsertGraphic() instead, which is what SwFEShell::Insert() and SwXFrame::attachToRange() use. Change-Id: Ie05b501507f8722bc0a312c2e729ecd76154ce98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143836 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-12-08sw: introduce a .uno:GotoMark commandMiklos Vajna
This is meant to be used from macros, it does the same as manually opening the navigator, selecting a given bookmark and pressing enter. It also helps debugging when you want to jump somewhere, but the surrounding document content changes, so jumping to a certain page won't work due to the changing page number. Change-Id: I3bc08ae8023997bab89cf4732fb67233a6a1e134 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143825 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-12-06sw, .uno:InsertBookmark: add a new BookmarkText parameter and accept HTML thereMiklos Vajna
There was already an UNO command to insert a new bookmark with the provided name, in a non-interactive way. What was missing is to allow specifying the bookmark text, which is to some extent not part of the bookmark, but e.g. the bookmark dialog allows editing that still. Add a new BookmarkText parameter to .uno:InsertBookmark, in case it's specified then we interpret this as HTML and we create the bookmark on the imported content, not simply at the current cursor position. This is similar to commit 1c2ef850db29beb369dcc89a58fc73416ecd9c5c (sw, .uno:TextFormField command: accept HTML in the FieldResult parameter, 2022-11-16), but that was for the field mode, while this is for the bookmark mode of Zotero. Change-Id: I4928d173e197796d40fdb53f81e84b6bfd77cdc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143736 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-11-28sw: add a new .uno:TextFormFields UNO commandMiklos Vajna
Currently .uno:TextFormField can be used to insert a new fieldmark, but then there is no way to update it. Also, there is no way to update several fieldmarks at the same time. Given that the "ADDON" field type in a field mark can be used by extensions like Zotero, it's useful in case these fieldmarks can be not only inserted, but they can be also updated. This works by (in the LOK case) calling getCommandValues() with .uno:TextFormFields, and then once the client generates the new expanded values, there is no way to insert these updated expanded values into the document currently. Fix this by adding a new .uno:TextFormFields UNO command that can update all fieldmarks matching a certain prefix (looking at their field command). This allows e.g. updating all Zotero citations or the bibliography, but the API is generic to support any kind of ADDON fields. Similar to insertion, the content can be multi-paragraph, formatted HTML. This required adjusting SfxUnoAnyItem::CreateDefault(), this way an UNO command parameter can be an array of beans::PropertyValues, which is how the client can provide details of multiple fieldmarks. Change-Id: I44a1b1495ead79b92ccd0c9f6412a34cbec5d68b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143361 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-11-16sw, .uno:TextFormField command: accept HTML in the FieldResult parameterMiklos Vajna
- improve the calculation of the SwPaM that decides the start/end of the fieldmark: with HTML import the length of the content is not the length of the input string anymore - use SwTranslateHelper::PasteHTMLToPaM() to accept formatted content inside a single paragraph - avoid unwanted last empty paragraph from the HTML import - this builds on top of commit 6870c0c3385bf5d19e9c80bf973fca255ae38c08 (sw: add new FieldCode parameter for the .uno:TextFormField command, 2022-11-15), which introduced plain text support for FieldResult Change-Id: I8332f6ee532ab1e844a4b94f22b1f72d2406eb3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142756 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-11-15sw: add new FieldCode parameter for the .uno:TextFormField commandMiklos Vajna
The field code/command is the input of the field expand. Also allow setting a field result, given that the entire point of "unhandled" fieldmarks is that Writer itself doesn't know how to compute the field result / expanded string. Note that a field result can be a multi-paragraph and formatted content, so far we only allow single-paragraph plain text. Change-Id: I1739cb985d1d4ed8e45068f15a4e0d82fd118d83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142726 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins