peter88213 / novelyst

A novel organizer for writers
https://peter88213.github.io/novelyst/
GNU General Public License v3.0
2 stars 0 forks source link

Navigate within the edited document. #20

Open peter88213 opened 1 year ago

peter88213 commented 1 year ago

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

peter88213 commented 10 months ago

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

peter88213 commented 10 months ago

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