Branch libreoffice-5-0-4
[LibreOffice.git] / include / LibreOfficeKit / LibreOfficeKit.h
blobe3b485052444a7ff8e260c9c8b2555526c4012d4
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
11 #define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
13 #include <stddef.h>
15 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
17 #ifdef __cplusplus
18 extern "C"
20 #endif
22 typedef struct _LibreOfficeKit LibreOfficeKit;
23 typedef struct _LibreOfficeKitClass LibreOfficeKitClass;
25 typedef struct _LibreOfficeKitDocument LibreOfficeKitDocument;
26 typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass;
28 // Do we have an extended member in this struct ?
29 #define LIBREOFFICEKIT_HAS_MEMBER(strct,member,nSize) \
30 (offsetof(strct, member) < (nSize))
32 #define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize)
34 struct _LibreOfficeKit
36 LibreOfficeKitClass* pClass;
39 struct _LibreOfficeKitClass
41 size_t nSize;
43 void (*destroy) (LibreOfficeKit* pThis);
45 LibreOfficeKitDocument* (*documentLoad) (LibreOfficeKit* pThis,
46 const char* pURL);
48 char* (*getError) (LibreOfficeKit* pThis);
50 LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis,
51 const char* pURL,
52 const char* pOptions);
53 #ifdef LOK_USE_UNSTABLE_API
54 void (*registerCallback) (LibreOfficeKit* pThis,
55 LibreOfficeKitCallback pCallback,
56 void* pData);
57 #endif
60 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
62 struct _LibreOfficeKitDocument
64 LibreOfficeKitDocumentClass* pClass;
67 struct _LibreOfficeKitDocumentClass
69 size_t nSize;
71 void (*destroy) (LibreOfficeKitDocument* pThis);
73 int (*saveAs) (LibreOfficeKitDocument* pThis,
74 const char* pUrl,
75 const char* pFormat,
76 const char* pFilterOptions);
78 #ifdef LOK_USE_UNSTABLE_API
79 /// @see lok::Document::getDocumentType().
80 int (*getDocumentType) (LibreOfficeKitDocument* pThis);
82 /// @see lok::Document::getParts().
83 int (*getParts) (LibreOfficeKitDocument* pThis);
85 /// @see lok::Document::getPart().
86 int (*getPart) (LibreOfficeKitDocument* pThis);
88 /// @see lok::Document::setPart().
89 void (*setPart) (LibreOfficeKitDocument* pThis,
90 int nPart);
92 /// @see lok::Document::getPartName().
93 char* (*getPartName) (LibreOfficeKitDocument* pThis,
94 int nPart);
96 /** Sets mode of the current part.
98 * @param nMode - element from the LibreOfficeKitPartMode enum.
100 void (*setPartMode) (LibreOfficeKitDocument* pThis,
101 int nMode);
103 /// @see lok::Document::paintTile().
104 void (*paintTile) (LibreOfficeKitDocument* pThis,
105 unsigned char* pBuffer,
106 const int nCanvasWidth,
107 const int nCanvasHeight,
108 const int nTilePosX,
109 const int nTilePosY,
110 const int nTileWidth,
111 const int nTileHeight);
113 /// @see lok::Document::getDocumentSize().
114 void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
115 long* pWidth,
116 long* pHeight);
118 /// @see lok::Document::initializeForRendering().
119 void (*initializeForRendering) (LibreOfficeKitDocument* pThis);
121 void (*registerCallback) (LibreOfficeKitDocument* pThis,
122 LibreOfficeKitCallback pCallback,
123 void* pData);
125 /// @see lok::Document::postKeyEvent
126 void (*postKeyEvent) (LibreOfficeKitDocument* pThis,
127 int nType,
128 int nCharCode,
129 int nKeyCode);
131 /// @see lok::Document::postMouseEvent
132 void (*postMouseEvent) (LibreOfficeKitDocument* pThis,
133 int nType,
134 int nX,
135 int nY,
136 int nCount);
138 /// @see lok::Document::postUnoCommand
139 void (*postUnoCommand) (LibreOfficeKitDocument* pThis,
140 const char* pCommand,
141 const char* pArguments);
143 /// @see lok::Document::setTextSelection
144 void (*setTextSelection) (LibreOfficeKitDocument* pThis,
145 int nType,
146 int nX,
147 int nY);
149 /// @see lok::Document::getTextSelection
150 char* (*getTextSelection) (LibreOfficeKitDocument* pThis,
151 const char* pMimeType,
152 char** pUsedMimeType);
154 /// @see lok::Document::setGraphicSelection
155 void (*setGraphicSelection) (LibreOfficeKitDocument* pThis,
156 int nType,
157 int nX,
158 int nY);
160 /// @see lok::Document::resetSelection
161 void (*resetSelection) (LibreOfficeKitDocument* pThis);
162 #endif // LOK_USE_UNSTABLE_API
165 #ifdef __cplusplus
167 #endif
169 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */