capi

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const UNOPATH = "\\..\\URE\\bin"

Variables

View Source
var (
	TARGET_LIB        string
	TARGET_MERGED_LIB string
)

Functions

func LokPreinit

func LokPreinit(installPath, userProfileURL string) (int, error)

LokPreinit runs the optional pre-initialization hook of the LibreOffice implementation library, mirroring lok_preinit() in LibreOfficeKitInit.h. It returns the hook's exit status (0 on success, -1 on failure).

Types

type LibreOfficeKit

type LibreOfficeKit struct {
	Class *LibreOfficeKitClass
}

func LokInit

func LokInit(installPath string) (*LibreOfficeKit, error)

LokInit initializes LibreOffice, mirroring lok_init() in LibreOfficeKitInit.h. It loads the implementation library from the given installation path, resolves the libreofficekit_hook_2 / libreofficekit_hook symbol and invokes it. The returned document-agnostic office handle is the root of all further LibreOfficeKit calls.

func LokInit2

func LokInit2(installPath, userProfileURL string) (*LibreOfficeKit, error)

LokInit2 initializes LibreOffice with an optional user profile, mirroring lok_init_2() in LibreOfficeKitInit.h.

userProfileURL must be a URL (a file: URL or a vnd.sun.star.pathname: URL), not a filesystem pathname.

type LibreOfficeKitCallback

type LibreOfficeKitCallback uintptr

func NewLibreOfficeKitCallback

func NewLibreOfficeKitCallback(fn func(nType int, payload, data uintptr)) LibreOfficeKitCallback

type LibreOfficeKitClass

type LibreOfficeKitClass struct {
	Size uint

	// void (*destroy) (LibreOfficeKit* pThis);
	Destroy cgo.Symbol

	// LibreOfficeKitDocument* (*documentLoad) (LibreOfficeKit* pThis, const char* pURL);
	DocumentLoad cgo.Symbol

	// char* (*getError) (LibreOfficeKit* pThis);
	GetError cgo.Symbol

	/// @since LibreOffice 5.0
	// LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis, const char* pURL, const char* pOptions);
	DocumentLoadWithOptions cgo.Symbol

	/// @since LibreOffice 5.2
	// void (*freeError) (char* pFree);
	FreeError cgo.Symbol

	/// @since LibreOffice 6.0
	// void (*registerCallback) (LibreOfficeKit* pThis, LibreOfficeKitCallback pCallback, void* pData);
	RegisterCallback cgo.Symbol

	// char* (*getFilterTypes) (LibreOfficeKit* pThis);
	GetFilterTypes cgo.Symbol

	// void (*setOptionalFeatures)(LibreOfficeKit* pThis, unsigned long long features);
	SetOptionalFeatures cgo.Symbol

	// void (*setDocumentPassword) (LibreOfficeKit* pThis, char const* pURL, char const* pPassword);
	SetDocumentPassword cgo.Symbol

	// char* (*getVersionInfo) (LibreOfficeKit* pThis);
	GetVersionInfo cgo.Symbol

	// int (*runMacro) (LibreOfficeKit *pThis, const char* pURL);
	RunMacro cgo.Symbol

	// bool (*signDocument) (LibreOfficeKit* pThis, const char* pUrl, const unsigned char* pCertificateBinary, const int nCertificateBinarySize, const unsigned char* pPrivateKeyBinary, const int nPrivateKeyBinarySize);
	SignDocument cgo.Symbol

	// void (*runLoop) (LibreOfficeKit* pThis, LibreOfficeKitPollCallback pPollCallback, LibreOfficeKitWakeCallback pWakeCallback, void* pData);
	RunLoop cgo.Symbol

	// void (*sendDialogEvent) (LibreOfficeKit* pThis, unsigned long long int nLOKWindowId, const char* pArguments);
	SendDialogEvent cgo.Symbol

	// void (*setOption) (LibreOfficeKit* pThis, const char* pOption, const char* pValue);
	SetOption cgo.Symbol
}

type LibreOfficeKitDocument

type LibreOfficeKitDocument struct {
	Class *LibreOfficeKitDocumentClass
}

type LibreOfficeKitDocumentClass

type LibreOfficeKitDocumentClass struct {
	Size uint

	// void (*destroy) (LibreOfficeKitDocument* pThis);
	Destroy cgo.Symbol

	// int (*saveAs) (LibreOfficeKitDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions);
	SaveAs cgo.Symbol

	// int (*getDocumentType) (LibreOfficeKitDocument* pThis);
	GetDocumentType cgo.Symbol

	// int (*getParts) (LibreOfficeKitDocument* pThis);
	GetParts cgo.Symbol

	// char* (*getPartPageRectangles) (LibreOfficeKitDocument* pThis);
	GetPartPageRectangles cgo.Symbol

	// int (*getPart) (LibreOfficeKitDocument* pThis);
	GetPart cgo.Symbol

	// void (*setPart) (LibreOfficeKitDocument* pThis, int nPart);
	SetPart cgo.Symbol

	// char* (*getPartName) (LibreOfficeKitDocument* pThis, int nPart);
	GetPartName cgo.Symbol

	// void (*setPartMode) (LibreOfficeKitDocument* pThis, int nMode);
	SetPartMode cgo.Symbol

	// void (*paintTile) (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, const int nCanvasWidth, const int nCanvasHeight, const int nTilePosX, const int nTilePosY, const int nTileWidth, const int nTileHeight);
	PaintTile cgo.Symbol

	// int (*getTileMode) (LibreOfficeKitDocument* pThis);
	GetTileMode cgo.Symbol

	// void (*getDocumentSize) (LibreOfficeKitDocument* pThis, long* pWidth, long* pHeight);
	GetDocumentSize cgo.Symbol

	// void (*initializeForRendering) (LibreOfficeKitDocument* pThis, const char* pArguments);
	InitializeForRendering cgo.Symbol

	// void (*registerCallback) (LibreOfficeKitDocument* pThis, LibreOfficeKitCallback pCallback, void* pData);
	RegisterCallback cgo.Symbol

	// void (*postKeyEvent) (LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode);
	PostKeyEvent cgo.Symbol

	// void (*postMouseEvent) (LibreOfficeKitDocument* pThis, int nType, int nX, int nY, int nCount, int nButtons, int nModifier);
	PostMouseEvent cgo.Symbol

	// void (*postUnoCommand) (LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished);
	PostUnoCommand cgo.Symbol

	// void (*setTextSelection) (LibreOfficeKitDocument* pThis, int nType, int nX, int nY);
	SetTextSelection cgo.Symbol

	// char* (*getTextSelection) (LibreOfficeKitDocument* pThis, const char* pMimeType, char** pUsedMimeType);
	GetTextSelection cgo.Symbol

	// bool (*paste) (LibreOfficeKitDocument* pThis, const char* pMimeType, const char* pData, size_t nSize);
	Paste cgo.Symbol

	// void (*setGraphicSelection) (LibreOfficeKitDocument* pThis, int nType, int nX, int nY);
	SetGraphicSelection cgo.Symbol

	// void (*resetSelection) (LibreOfficeKitDocument* pThis);
	ResetSelection cgo.Symbol

	//char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand);
	GetCommandValues cgo.Symbol

	// void (*setClientZoom) (LibreOfficeKitDocument* pThis, int nTilePixelWidth, int nTilePixelHeight, int nTileTwipWidth, int nTileTwipHeight);
	SetClientZoom cgo.Symbol

	// void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight);
	SetClientVisibleArea cgo.Symbol

	// int (*createView) (LibreOfficeKitDocument* pThis);
	CreateView cgo.Symbol

	// void (*destroyView) (LibreOfficeKitDocument* pThis, int nId);
	DestroyView cgo.Symbol

	// void (*setView) (LibreOfficeKitDocument* pThis, int nId);
	SetView cgo.Symbol

	// int (*getView) (LibreOfficeKitDocument* pThis);
	GetView cgo.Symbol

	// int (*getViewsCount) (LibreOfficeKitDocument* pThis);
	GetViewsCount cgo.Symbol

	// unsigned char* (*renderFont) (LibreOfficeKitDocument* pThis, const char* pFontName, const char* pChar, int* pFontWidth, int* pFontHeight);
	RenderFont cgo.Symbol

	// char* (*getPartHash) (LibreOfficeKitDocument* pThis, int nPart);
	GetPartHash cgo.Symbol

	/// Paints a tile from a specific part.
	// void (*paintPartTile) (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, const int nPart, const int nCanvasWidth, const int nCanvasHeight, const int nTilePosX, const int nTilePosY, const int nTileWidth, const int nTileHeight);
	PaintPartTile cgo.Symbol

	// bool (*getViewIds) (LibreOfficeKitDocument* pThis, int* pArray, size_t nSize);
	GetViewIds cgo.Symbol

	// void (*setOutlineState) (LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden);
	SetOutlineState cgo.Symbol

	/// Paints window with given id to the buffer
	// void (*paintWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, unsigned char* pBuffer, const int x, const int y, const int width, const int height);
	PaintWindow cgo.Symbol

	// void (*postWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nAction, const char* pData);
	PostWindow cgo.Symbol

	// void (*postWindowKeyEvent) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nType, int nCharCode, int nKeyCode);
	PostWindowKeyEvent cgo.Symbol

	// void (*postWindowMouseEvent) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier);
	PostWindowMouseEvent cgo.Symbol

	// void (*setViewLanguage) (LibreOfficeKitDocument* pThis, int nId, const char* language);
	SetViewLanguage cgo.Symbol

	// void (*postWindowExtTextInputEvent) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nType, const char* pText);
	PostWindowExtTextInputEvent cgo.Symbol

	// char* (*getPartInfo) (LibreOfficeKitDocument* pThis, int nPart);
	GetPartInfo cgo.Symbol

	/// Paints window with given id to the buffer with the give DPI scale
	/// (every pixel is dpiscale-times larger).
	// void (*paintWindowDPI) (LibreOfficeKitDocument* pThis, unsigned nWindowId, unsigned char* pBuffer, const int x, const int y, const int width, const int height, const double dpiscale);
	PaintWindowDPI cgo.Symbol

	// bool (*insertCertificate) (LibreOfficeKitDocument* pThis, const unsigned char* pCertificateBinary, const int nCertificateBinarySize, const unsigned char* pPrivateKeyBinary, const int nPrivateKeyBinarySize);
	InsertCertificate cgo.Symbol

	// bool (*addCertificate) (LibreOfficeKitDocument* pThis, const unsigned char* pCertificateBinary, const int nCertificateBinarySize);
	AddCertificate cgo.Symbol

	// int (*getSignatureState) (LibreOfficeKitDocument* pThis);
	GetSignatureState cgo.Symbol

	// size_t (*renderShapeSelection)(LibreOfficeKitDocument* pThis, char** pOutput);
	RenderShapeSelection cgo.Symbol

	// void (*postWindowGestureEvent) (LibreOfficeKitDocument* pThis, unsigned nWindowId, const char* pType, int nX, int nY, int nOffset);
	PostWindowGestureEvent cgo.Symbol

	// int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions);
	CreateViewWithOptions cgo.Symbol

	// void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect);
	SelectPart cgo.Symbol

	// void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
	MoveSelectedParts cgo.Symbol

	/// Resize window with given id.
	// void (*resizeWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, const int width, const int height);
	ResizeWindow cgo.Symbol

	/// Pass a nullptr terminated array of mime-type strings
	// int (*getClipboard) (LibreOfficeKitDocument* pThis, const char **pMimeTypes, size_t *pOutCount, char ***pOutMimeTypes, size_t **pOutSizes, char ***pOutStreams);
	GetClipboard cgo.Symbol

	// int (*setClipboard) (LibreOfficeKitDocument* pThis, const size_t nInCount, const char **pInMimeTypes, const size_t *pInSizes, const char **pInStreams);
	SetClipboard cgo.Symbol

	// int (*getSelectionType) (LibreOfficeKitDocument* pThis);
	GetSelectionType cgo.Symbol

	// void (*removeTextContext) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nBefore, int nAfter);
	RemoveTextContext cgo.Symbol

	// void (*sendDialogEvent) (LibreOfficeKitDocument* pThis, unsigned long long int nLOKWindowId, const char* pArguments);
	SendDialogEvent cgo.Symbol

	// unsigned char* (*renderFontOrientation) (LibreOfficeKitDocument* pThis, const char* pFontName, const char* pChar, int* pFontWidth, int* pFontHeight, int pOrientation);
	RenderFontOrientation cgo.Symbol

	/// Switches view to viewId if viewId >= 0, and paints window
	// void (*paintWindowForView) (LibreOfficeKitDocument* pThis, unsigned nWindowId, unsigned char* pBuffer, const int x, const int y, const int width, const int height, const double dpiscale, int viewId);
	PaintWindowForView cgo.Symbol

	// void (*completeFunction) (LibreOfficeKitDocument* pThis, const char* pFunctionName);
	CompleteFunction cgo.Symbol

	// void (*setWindowTextSelection) (LibreOfficeKitDocument* pThis, unsigned nWindowId, bool bSwap, int nX, int nY);
	SetWindowTextSelection cgo.Symbol

	// void (*sendFormFieldEvent) (LibreOfficeKitDocument* pThis, const char* pArguments);
	SendFormFieldEvent cgo.Symbol

	// void (*setBlockedCommandList) (LibreOfficeKitDocument* pThis, int nViewId, const char* blockedCommandList);
	SetBlockedCommandList cgo.Symbol

	// bool (*renderSearchResult) (LibreOfficeKitDocument* pThis, const char* pSearchResult, unsigned char** pBitmapBuffer, int* pWidth, int* pHeight, size_t* pByteSize);
	RenderSearchResult cgo.Symbol
}

type LibreOfficeKitPollCallback

type LibreOfficeKitPollCallback uintptr

func NewLibreOfficeKitPollCallback

func NewLibreOfficeKitPollCallback(fn func(pData uintptr, timeoutUs int) int) LibreOfficeKitPollCallback

type LibreOfficeKitWakeCallback

type LibreOfficeKitWakeCallback uintptr

func NewLibreOfficeKitWakeCallback

func NewLibreOfficeKitWakeCallback(fn func(pData uintptr)) LibreOfficeKitWakeCallback

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL