func (document *Document) GetType() int {
	return int(C.get_document_type(document.handle))
}
GetType returns type of loaded document
package libreofficekit
import "C"
import (
	"fmt"
	"image"
	"strconv"
	"strings"
	"sync"
	"unsafe"
)
func TwipsToPixels(twips int, dpi int) int {
	return int(float32(twips) / 1440.0 * float32(dpi))
}
func PixelsToTwips(pixels int, dpi int) int {
	return int((float32(pixels) / float32(dpi)) * 1440.0)
}
func BGRA(p []uint8) {
	for i := 0; i < len(p); i += 4 {
		p[i+0], p[i+2] = p[i+2], p[i+0]
	}
}
type Office struct {
	handle *C.struct__LibreOfficeKit
	Mutex  *sync.Mutex
}
func NewOffice(path string) (*Office, error) {
	office := new(Office)
	cPath := C.CString(path)
	defer C.free(unsafe.Pointer(cPath))
	lokit := C.lok_init(cPath)
	if lokit == nil {
		return nil, fmt.Errorf("Failed to initialize LibreOfficeKit with path: '%s'", path)
	}
	office.handle = lokit
	office.Mutex = &sync.Mutex{}
	return office, nil
}
func (office *Office) Close() {
	C.destroy_office(office.handle)
}
func (office *Office) GetError() string {
	message := C.get_error(office.handle)
	return C.GoString(message)
}
func (office *Office) LoadDocument(path string) (*Document, error) {
	document := new(Document)
	cPath := C.CString(path)
	defer C.free(unsafe.Pointer(cPath))
	handle := C.document_load(office.handle, cPath)
	if handle == nil {
		return nil, fmt.Errorf("Failed to load document")
	}
	document.handle = handle
	return document, nil
}
func (office *Office) GetFilters() string {
	filters := C.get_filter_types(office.handle)
	defer C.free(unsafe.Pointer(filters))
	return C.GoString(filters)
}
const (
	TextDocument = iota
	SpreadsheetDocument
	PresentationDocument
	DrawingDocument
	OtherDocument
)
const (
	RGBATilemode = iota
	BGRATilemode
)
const (
	SetGraphicSelectionStart = iota
	SetGraphicSelectionEnd
)
type Document struct {
	handle *C.struct__LibreOfficeKitDocument
}
func (document *Document) Close() {
	C.destroy_document(document.handle)
}