peter88213/novelyst

Navigate within the edited document.

peter88213 opened this issue · 2 comments

Create a plugin that allows selecting scenes and chapters in LibreOffice from novelyst.

Control LibreOffice from outsides

Call LibreOffice:

"c:\Program Files\LibreOffice\program\soffice.exe" --writer --accept="socket,host=localhost,port=2002;urp;"

Call Python:

import socket  # only needed on win32-OOo3.0.0
import uno# get the uno component context from the PyUNO runtime
localContext = uno.getComponentContext()# create the UnoUrlResolver
resolver = localContext.ServiceManager.createInstanceWithContext(
				"com.sun.star.bridge.UnoUrlResolver", localContext )# connect to the running office
ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
smgr = ctx.ServiceManager# get the central desktop object
desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)# access the current writer document
model = desktop.getCurrentComponent()

See this link

Maybe establish a bridge to the LibreOffice Python interpreter with execnet?