https://bugs.documentfoundation.org/show_bug.cgi?id=151710
--- Comment #10 from Jim Raykowski <[email protected]> --- An article that illustrates how to add an UNO command for Calc[1] Examples of two UNO commands added to Writer[2] officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs contains information on properties used in the .xcu file. There is also information about commands here[3]. Decide on a name for the command. It probably should be generic to allow other than enclosing selected text with parenthesis. Perhaps something like .uno:EncloseText or .uno:SurroundText. Loop through the cursor ring[3] to get each cursor selection PaM[4] and text. Create an enclosed string by placing the selection text between open and close parenthesis, adding optional enclosures is an advanced hack that can be done for bonus points after implementing the parens request :-), then use the IDocumentContentOperations::ReplaceRange function[5] to replace the text at the PaM with the created enclosure string. [1] https://dev.blog.documentfoundation.org/2022/02/23/adding-a-new-uno-command/ [2] https://gerrit.libreoffice.org/c/core/+/91605 [3] for (SwPaM& rPaM : SwWrtShell::GetCursor()->GetRingContainer()) [4] sw/inc/pam.hxx [5] sw/source/core/view/viewsh.cxx SwViewShell::getIDocumentContentOperations() hint: SwWrtShell is derived from SwViewShell -- You are receiving this mail because: You are the assignee for the bug.
