***
There is an interface XTextRangeMover
https://www.openoffice.org/api/docs/com ... eTextRangemakes it possible to move a text range (e.g. a paragraph by itself) within this text.
The movement is specified by the number of paragraphs within the order of paragraphs.
moveTextRange moves the contents to which xRange refers forward or backward.
Mri lists this as an interface for thiscomponent.text but moveTextRange doesn't appear in the list of methods.
***
There is the ".uno:MoveDown" dispatch call which is the same as Ctrl+Alt+down (or up) arrow. This just moves the paragraphs up or down 1 paragraph though. I've attempted various names for a property that might move the paragraphs more than 1 at a time... but it seems that's all it can do.
Code: Select all
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ParagraphNumber" 'TRIED VARIOUS THINGS HERE
args1(0).Value = 2
dispatcher.executeDispatch(document, ".uno:MoveDown", "", 0, args1())
I know there's copy and paste and gettransferable but these all involve deleting and reinserting.
Edit: And drag and drop and using the navigator - but these aren't by code.