2013-11-15 12:09:10 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
2014-06-09 11:33:25 +01:00
|
|
|
#ifndef INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_H
|
|
|
|
#define INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_H
|
2013-11-15 12:09:10 +00:00
|
|
|
|
2014-06-12 16:33:23 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2013-11-15 12:09:10 +00:00
|
|
|
#ifdef __cplusplus
|
2014-04-06 12:05:13 +02:00
|
|
|
extern "C"
|
|
|
|
{
|
2013-11-15 12:09:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-06-10 11:31:51 +01:00
|
|
|
typedef struct _LibreOfficeKit LibreOfficeKit;
|
2014-06-17 15:13:33 +01:00
|
|
|
typedef struct _LibreOfficeKitClass LibreOfficeKitClass;
|
|
|
|
|
2014-06-10 11:31:51 +01:00
|
|
|
typedef struct _LibreOfficeKitDocument LibreOfficeKitDocument;
|
2014-06-17 15:13:33 +01:00
|
|
|
typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass;
|
2013-11-15 12:09:10 +00:00
|
|
|
|
2014-06-12 13:28:26 +01:00
|
|
|
// Do we have an extended member in this struct ?
|
|
|
|
#define LIBREOFFICEKIT_HAS_MEMBER(strct,member,nSize) \
|
2014-06-12 14:28:17 +01:00
|
|
|
((((size_t)((unsigned char *)&((strct *) 0)->member) + \
|
|
|
|
sizeof ((strct *) 0)->member)) <= (nSize))
|
2014-06-12 13:28:26 +01:00
|
|
|
|
2014-06-17 15:13:33 +01:00
|
|
|
#define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize)
|
2014-06-12 13:28:26 +01:00
|
|
|
|
2014-05-09 14:37:27 +01:00
|
|
|
#ifdef LOK_USE_UNSTABLE_API
|
|
|
|
typedef enum
|
|
|
|
{
|
2014-06-13 15:00:42 +01:00
|
|
|
LOK_DOCTYPE_TEXT,
|
|
|
|
LOK_DOCTYPE_SPREADSHEET,
|
|
|
|
LOK_DOCTYPE_PRESENTATION,
|
|
|
|
LOK_DOCTYPE_DRAWING,
|
|
|
|
LOK_DOCTYPE_OTHER
|
2014-05-09 14:37:27 +01:00
|
|
|
}
|
|
|
|
LibreOfficeKitDocumentType;
|
2014-07-29 08:59:13 +02:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
LOK_PARTMODE_DEFAULT,
|
|
|
|
LOK_PARTMODE_SLIDE,
|
|
|
|
LOK_PARTMODE_NOTES,
|
|
|
|
LOK_PARTMODE_SLIDENOTES,
|
|
|
|
LOK_PARTMODE_EMBEDDEDOBJ
|
|
|
|
}
|
|
|
|
LibreOfficeKitPartMode;
|
2015-01-06 15:49:12 +01:00
|
|
|
|
2015-01-06 17:31:42 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Any tiles which are over the rectangle described in the payload are no
|
|
|
|
* longer valid.
|
|
|
|
*
|
|
|
|
* Rectangle format: "width,height,x,y", where all numbers are document
|
|
|
|
* coordinates, in twips.
|
|
|
|
*/
|
|
|
|
LOK_CALLBACK_INVALIDATE_TILES
|
|
|
|
}
|
|
|
|
LibreOfficeKitCallbackType;
|
|
|
|
|
2015-01-12 13:18:47 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/// A key on the keyboard is pressed.
|
|
|
|
LOK_KEYEVENT_KEYINPUT,
|
|
|
|
/// A key on the keyboard is released.
|
|
|
|
LOK_KEYEVENT_KEYUP
|
|
|
|
}
|
|
|
|
LibreOfficeKitKeyEventType;
|
|
|
|
|
2015-01-20 10:17:03 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/// A pressed gesture has started.
|
|
|
|
LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
|
|
|
|
/// A pressed gesture has finished.
|
|
|
|
LOK_MOUSEEVENT_MOUSEBUTTONUP,
|
|
|
|
/// A change has happened during a press gesture.
|
|
|
|
LOK_MOUSEEVENT_MOUSEMOVE
|
|
|
|
}
|
|
|
|
LibreOfficeKitMouseEventType;
|
|
|
|
|
2015-01-06 15:49:12 +01:00
|
|
|
typedef void (*LibreOfficeKitCallback)(int nType, const char* pPayload, void* pData);
|
2014-05-09 14:37:27 +01:00
|
|
|
#endif // LOK_USE_UNSTABLE_API
|
|
|
|
|
2014-06-10 11:31:51 +01:00
|
|
|
struct _LibreOfficeKit
|
2014-06-17 15:13:33 +01:00
|
|
|
{
|
|
|
|
LibreOfficeKitClass* pClass;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _LibreOfficeKitClass
|
2014-04-06 12:05:13 +02:00
|
|
|
{
|
2014-06-12 14:28:17 +01:00
|
|
|
size_t nSize;
|
2013-11-15 12:09:10 +00:00
|
|
|
|
2015-01-07 19:02:16 +09:00
|
|
|
void (*destroy) (LibreOfficeKit* pThis);
|
|
|
|
LibreOfficeKitDocument* (*documentLoad) (LibreOfficeKit* pThis, const char* pURL);
|
|
|
|
char* (*getError) (LibreOfficeKit* pThis);
|
2015-01-08 17:13:20 +01:00
|
|
|
void (*postKeyEvent) (LibreOfficeKit* pThis, int nType, int nCode);
|
2013-11-15 12:09:10 +00:00
|
|
|
};
|
|
|
|
|
2014-06-17 15:13:33 +01:00
|
|
|
#define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
|
2014-06-12 13:28:26 +01:00
|
|
|
|
2014-06-10 11:31:51 +01:00
|
|
|
struct _LibreOfficeKitDocument
|
2014-06-17 15:13:33 +01:00
|
|
|
{
|
|
|
|
LibreOfficeKitDocumentClass* pClass;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _LibreOfficeKitDocumentClass
|
2014-04-06 12:05:13 +02:00
|
|
|
{
|
2014-06-12 14:28:17 +01:00
|
|
|
size_t nSize;
|
2013-11-15 12:09:10 +00:00
|
|
|
|
2014-06-10 11:31:51 +01:00
|
|
|
void (*destroy) (LibreOfficeKitDocument* pThis);
|
|
|
|
int (*saveAs) (LibreOfficeKitDocument* pThis,
|
2015-01-07 19:02:16 +09:00
|
|
|
const char* pUrl,
|
|
|
|
const char* pFormat,
|
|
|
|
const char* pFilterOptions);
|
2014-05-09 14:37:27 +01:00
|
|
|
#ifdef LOK_USE_UNSTABLE_API
|
|
|
|
LibreOfficeKitDocumentType (*getDocumentType) (LibreOfficeKitDocument* pThis);
|
|
|
|
|
2015-01-07 19:02:16 +09:00
|
|
|
/** Get number of part that the document contains.
|
|
|
|
* Part refers to either indivual sheets in a Spreadsheet,
|
|
|
|
* or slides in a Slideshow, and has no relevance for
|
|
|
|
* writer documents.
|
|
|
|
*/
|
2014-07-08 15:23:06 +02:00
|
|
|
int (*getParts) (LibreOfficeKitDocument* pThis);
|
2014-05-09 14:37:27 +01:00
|
|
|
|
2015-01-07 19:02:16 +09:00
|
|
|
/** Get current part of the document */
|
2014-07-08 15:23:06 +02:00
|
|
|
int (*getPart) (LibreOfficeKitDocument* pThis);
|
2014-05-09 14:37:27 +01:00
|
|
|
void (*setPart) (LibreOfficeKitDocument* pThis,
|
|
|
|
int nPart);
|
|
|
|
|
2014-07-29 08:50:34 +02:00
|
|
|
char* (*getPartName) (LibreOfficeKitDocument* pThis,
|
|
|
|
int nPart);
|
|
|
|
|
2014-07-29 08:59:13 +02:00
|
|
|
void (*setPartMode) (LibreOfficeKitDocument* pThis,
|
|
|
|
LibreOfficeKitPartMode eMode);
|
|
|
|
|
2014-06-11 16:24:33 +01:00
|
|
|
void (*paintTile) (LibreOfficeKitDocument* pThis,
|
|
|
|
unsigned char* pBuffer,
|
2014-05-09 14:37:27 +01:00
|
|
|
const int nCanvasWidth,
|
|
|
|
const int nCanvasHeight,
|
2014-05-18 08:30:15 +01:00
|
|
|
int* pRowStride,
|
2014-05-09 14:37:27 +01:00
|
|
|
const int nTilePosX,
|
|
|
|
const int nTilePosY,
|
|
|
|
const int nTileWidth,
|
|
|
|
const int nTileHeight);
|
2014-05-18 08:36:16 +01:00
|
|
|
|
2015-01-07 19:02:16 +09:00
|
|
|
/** Get the document sizes in twips. */
|
2014-05-18 08:36:16 +01:00
|
|
|
void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
|
|
|
|
long* pWidth,
|
|
|
|
long* pHeight);
|
2014-12-29 16:10:48 +09:00
|
|
|
|
2015-01-07 19:02:16 +09:00
|
|
|
/** Initialize document for rendering.
|
|
|
|
* Sets the rendering and document parameters to default values
|
|
|
|
* that are needed to render the document correctly using
|
|
|
|
* tiled rendering.
|
|
|
|
*/
|
2014-12-29 16:10:48 +09:00
|
|
|
void (*initializeForRendering) (LibreOfficeKitDocument* pThis);
|
|
|
|
|
2015-01-06 15:49:12 +01:00
|
|
|
void (*registerCallback) (LibreOfficeKitDocument* pThis,
|
|
|
|
LibreOfficeKitCallback pCallback,
|
|
|
|
void* pData);
|
2015-01-21 12:42:08 +01:00
|
|
|
|
|
|
|
/// @see lok::Document::postMouseEvent
|
|
|
|
void (*postMouseEvent)(LibreOfficeKitDocument* pThis,
|
|
|
|
int nType,
|
|
|
|
int nX,
|
|
|
|
int nY);
|
2014-05-09 14:37:27 +01:00
|
|
|
#endif // LOK_USE_UNSTABLE_API
|
2013-11-15 12:09:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2014-04-08 17:39:10 +02:00
|
|
|
}
|
2013-11-15 12:09:10 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|