Bump version to 6.4-15
[LibreOffice.git] / include / LibreOfficeKit / LibreOfficeKit.h
blobf4244def5a6b18142620747a894a9a92bb07bba5
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 // the unstable API needs C99's bool
16 // TODO remove the C99 types from the API before making stable
17 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
18 # ifndef _WIN32
19 # include <stdbool.h>
20 # endif
21 # include <stdint.h>
22 #endif
24 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
26 #ifdef __cplusplus
27 extern "C"
29 #endif
31 typedef struct _LibreOfficeKit LibreOfficeKit;
32 typedef struct _LibreOfficeKitClass LibreOfficeKitClass;
34 typedef struct _LibreOfficeKitDocument LibreOfficeKitDocument;
35 typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass;
37 // Do we have an extended member in this struct ?
38 #define LIBREOFFICEKIT_HAS_MEMBER(strct,member,nSize) \
39 (offsetof(strct, member) < (nSize))
41 #define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize)
43 struct _LibreOfficeKit
45 LibreOfficeKitClass* pClass;
48 struct _LibreOfficeKitClass
50 size_t nSize;
52 void (*destroy) (LibreOfficeKit* pThis);
54 LibreOfficeKitDocument* (*documentLoad) (LibreOfficeKit* pThis,
55 const char* pURL);
57 char* (*getError) (LibreOfficeKit* pThis);
59 /// @since LibreOffice 5.0
60 LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis,
61 const char* pURL,
62 const char* pOptions);
63 /// @since LibreOffice 5.2
64 void (*freeError) (char* pFree);
66 /// @since LibreOffice 6.0
67 void (*registerCallback) (LibreOfficeKit* pThis,
68 LibreOfficeKitCallback pCallback,
69 void* pData);
71 /** @see lok::Office::getFilterTypes().
72 @since LibreOffice 6.0
74 char* (*getFilterTypes) (LibreOfficeKit* pThis);
76 /** @see lok::Office::setOptionalFeatures().
77 @since LibreOffice 6.0
79 void (*setOptionalFeatures)(LibreOfficeKit* pThis, unsigned long long features);
81 /** @see lok::Office::setDocumentPassword().
82 @since LibreOffice 6.0
84 void (*setDocumentPassword) (LibreOfficeKit* pThis,
85 char const* pURL,
86 char const* pPassword);
88 /** @see lok::Office::getVersionInfo().
89 @since LibreOffice 6.0
91 char* (*getVersionInfo) (LibreOfficeKit* pThis);
93 /** @see lok::Office::runMacro().
94 @since LibreOffice 6.0
96 int (*runMacro) (LibreOfficeKit *pThis, const char* pURL);
98 /** @see lok::Office::signDocument().
99 @since LibreOffice 6.2
101 bool (*signDocument) (LibreOfficeKit* pThis,
102 const char* pUrl,
103 const unsigned char* pCertificateBinary,
104 const int nCertificateBinarySize,
105 const unsigned char* pPrivateKeyBinary,
106 const int nPrivateKeyBinarySize);
108 /// @see lok::Office::runLoop()
109 void (*runLoop) (LibreOfficeKit* pThis,
110 LibreOfficeKitPollCallback pPollCallback,
111 LibreOfficeKitWakeCallback pWakeCallback,
112 void* pData);
115 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
117 struct _LibreOfficeKitDocument
119 LibreOfficeKitDocumentClass* pClass;
122 struct _LibreOfficeKitDocumentClass
124 size_t nSize;
126 void (*destroy) (LibreOfficeKitDocument* pThis);
128 int (*saveAs) (LibreOfficeKitDocument* pThis,
129 const char* pUrl,
130 const char* pFormat,
131 const char* pFilterOptions);
133 /** @see lok::Document::getDocumentType().
134 @since LibreOffice 6.0
136 int (*getDocumentType) (LibreOfficeKitDocument* pThis);
138 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
139 /// @see lok::Document::getParts().
140 int (*getParts) (LibreOfficeKitDocument* pThis);
142 /// @see lok::Document::getPartPageRectangles().
143 char* (*getPartPageRectangles) (LibreOfficeKitDocument* pThis);
145 /// @see lok::Document::getPart().
146 int (*getPart) (LibreOfficeKitDocument* pThis);
148 /// @see lok::Document::setPart().
149 void (*setPart) (LibreOfficeKitDocument* pThis,
150 int nPart);
152 /// @see lok::Document::getPartName().
153 char* (*getPartName) (LibreOfficeKitDocument* pThis,
154 int nPart);
156 /// @see lok::Document::setPartMode().
157 void (*setPartMode) (LibreOfficeKitDocument* pThis,
158 int nMode);
160 /// @see lok::Document::paintTile().
161 void (*paintTile) (LibreOfficeKitDocument* pThis,
162 unsigned char* pBuffer,
163 const int nCanvasWidth,
164 const int nCanvasHeight,
165 const int nTilePosX,
166 const int nTilePosY,
167 const int nTileWidth,
168 const int nTileHeight);
170 /// @see lok::Document::getTileMode().
171 int (*getTileMode) (LibreOfficeKitDocument* pThis);
173 /// @see lok::Document::getDocumentSize().
174 void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
175 long* pWidth,
176 long* pHeight);
178 /// @see lok::Document::initializeForRendering().
179 void (*initializeForRendering) (LibreOfficeKitDocument* pThis,
180 const char* pArguments);
182 /// @see lok::Document::registerCallback().
183 void (*registerCallback) (LibreOfficeKitDocument* pThis,
184 LibreOfficeKitCallback pCallback,
185 void* pData);
187 /// @see lok::Document::postKeyEvent
188 void (*postKeyEvent) (LibreOfficeKitDocument* pThis,
189 int nType,
190 int nCharCode,
191 int nKeyCode);
193 /// @see lok::Document::postMouseEvent
194 void (*postMouseEvent) (LibreOfficeKitDocument* pThis,
195 int nType,
196 int nX,
197 int nY,
198 int nCount,
199 int nButtons,
200 int nModifier);
202 /// @see lok::Document::postUnoCommand
203 void (*postUnoCommand) (LibreOfficeKitDocument* pThis,
204 const char* pCommand,
205 const char* pArguments,
206 bool bNotifyWhenFinished);
208 /// @see lok::Document::setTextSelection
209 void (*setTextSelection) (LibreOfficeKitDocument* pThis,
210 int nType,
211 int nX,
212 int nY);
214 /// @see lok::Document::getTextSelection
215 char* (*getTextSelection) (LibreOfficeKitDocument* pThis,
216 const char* pMimeType,
217 char** pUsedMimeType);
219 /// @see lok::Document::paste().
220 bool (*paste) (LibreOfficeKitDocument* pThis,
221 const char* pMimeType,
222 const char* pData,
223 size_t nSize);
225 /// @see lok::Document::setGraphicSelection
226 void (*setGraphicSelection) (LibreOfficeKitDocument* pThis,
227 int nType,
228 int nX,
229 int nY);
231 /// @see lok::Document::resetSelection
232 void (*resetSelection) (LibreOfficeKitDocument* pThis);
234 /// @see lok::Document::getCommandValues().
235 char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand);
237 /// @see lok::Document::setClientZoom().
238 void (*setClientZoom) (LibreOfficeKitDocument* pThis,
239 int nTilePixelWidth,
240 int nTilePixelHeight,
241 int nTileTwipWidth,
242 int nTileTwipHeight);
244 /// @see lok::Document::setVisibleArea).
245 void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight);
247 /// @see lok::Document::createView().
248 int (*createView) (LibreOfficeKitDocument* pThis);
249 /// @see lok::Document::destroyView().
250 void (*destroyView) (LibreOfficeKitDocument* pThis, int nId);
251 /// @see lok::Document::setView().
252 void (*setView) (LibreOfficeKitDocument* pThis, int nId);
253 /// @see lok::Document::getView().
254 int (*getView) (LibreOfficeKitDocument* pThis);
255 /// @see lok::Document::getViewsCount().
256 int (*getViewsCount) (LibreOfficeKitDocument* pThis);
258 /// @see lok::Document::renderFont().
259 unsigned char* (*renderFont) (LibreOfficeKitDocument* pThis,
260 const char* pFontName,
261 const char* pChar,
262 int* pFontWidth,
263 int* pFontHeight);
265 /// @see lok::Document::getPartHash().
266 char* (*getPartHash) (LibreOfficeKitDocument* pThis,
267 int nPart);
269 /// Paints a tile from a specific part.
270 /// @see lok::Document::paintTile().
271 void (*paintPartTile) (LibreOfficeKitDocument* pThis,
272 unsigned char* pBuffer,
273 const int nPart,
274 const int nCanvasWidth,
275 const int nCanvasHeight,
276 const int nTilePosX,
277 const int nTilePosY,
278 const int nTileWidth,
279 const int nTileHeight);
281 /// @see lok::Document::getViewIds().
282 bool (*getViewIds) (LibreOfficeKitDocument* pThis,
283 int* pArray,
284 size_t nSize);
286 /// @see lok::Document::setOutlineState).
287 void (*setOutlineState) (LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden);
289 /// Paints window with given id to the buffer
290 /// @see lok::Document::paintWindow().
291 void (*paintWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
292 unsigned char* pBuffer,
293 const int x, const int y,
294 const int width, const int height);
296 /// @see lok::Document::postWindow().
297 void (*postWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nAction, const char* pData);
299 /// @see lok::Document::postWindowKeyEvent().
300 void (*postWindowKeyEvent) (LibreOfficeKitDocument* pThis,
301 unsigned nWindowId,
302 int nType,
303 int nCharCode,
304 int nKeyCode);
306 /// @see lok::Document::postWindowMouseEvent().
307 void (*postWindowMouseEvent) (LibreOfficeKitDocument* pThis,
308 unsigned nWindowId,
309 int nType,
310 int nX,
311 int nY,
312 int nCount,
313 int nButtons,
314 int nModifier);
316 /// @see lok::Document::setViewLanguage().
317 void (*setViewLanguage) (LibreOfficeKitDocument* pThis, int nId, const char* language);
319 /// @see lok::Document::postWindowExtTextInputEvent
320 void (*postWindowExtTextInputEvent) (LibreOfficeKitDocument* pThis,
321 unsigned nWindowId,
322 int nType,
323 const char* pText);
325 /// @see lok::Document::getPartInfo().
326 char* (*getPartInfo) (LibreOfficeKitDocument* pThis, int nPart);
328 /// Paints window with given id to the buffer with the give DPI scale
329 /// (every pixel is dpiscale-times larger).
330 /// @see lok::Document::paintWindow().
331 void (*paintWindowDPI) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
332 unsigned char* pBuffer,
333 const int x, const int y,
334 const int width, const int height,
335 const double dpiscale);
337 #ifdef IOS
338 /// @see lok::Document::paintTileToCGContext().
339 void (*paintTileToCGContext) (LibreOfficeKitDocument* pThis,
340 void* rCGContext,
341 const int nCanvasWidth,
342 const int nCanvasHeight,
343 const int nTilePosX,
344 const int nTilePosY,
345 const int nTileWidth,
346 const int nTileHeight);
347 #endif // IOS
349 // CERTIFICATE AND SIGNING
351 /// @see lok::Document::insertCertificate().
352 bool (*insertCertificate) (LibreOfficeKitDocument* pThis,
353 const unsigned char* pCertificateBinary,
354 const int nCertificateBinarySize,
355 const unsigned char* pPrivateKeyBinary,
356 const int nPrivateKeyBinarySize);
358 /// @see lok::Document::addCertificate().
359 bool (*addCertificate) (LibreOfficeKitDocument* pThis,
360 const unsigned char* pCertificateBinary,
361 const int nCertificateBinarySize);
363 /// @see lok::Document::getSignatureState().
364 int (*getSignatureState) (LibreOfficeKitDocument* pThis);
365 // END CERTIFICATE AND SIGNING
367 /// @see lok::Document::renderShapeSelection
368 size_t (*renderShapeSelection)(LibreOfficeKitDocument* pThis, char** pOutput);
370 /// @see lok::Document::postWindowGestureEvent().
371 void (*postWindowGestureEvent) (LibreOfficeKitDocument* pThis,
372 unsigned nWindowId,
373 const char* pType,
374 int nX,
375 int nY,
376 int nOffset);
378 /// @see lok::Document::createViewWithOptions().
379 int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions);
381 /// @see lok::Document::selectPart().
382 void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect);
384 /// @see lok::Document::moveSelectedParts().
385 void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
387 /// Resize window with given id.
388 /// @see lok::Document::resizeWindow().
389 void (*resizeWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
390 const int width, const int height);
392 /// Pass a nullptr terminated array of mime-type strings
393 /// @see lok::Document::getClipboard for more details
394 int (*getClipboard) (LibreOfficeKitDocument* pThis,
395 const char **pMimeTypes,
396 size_t *pOutCount,
397 char ***pOutMimeTypes,
398 size_t **pOutSizes,
399 char ***pOutStreams);
401 /// @see lok::Document::setClipboard
402 int (*setClipboard) (LibreOfficeKitDocument* pThis,
403 const size_t nInCount,
404 const char **pInMimeTypes,
405 const size_t *pInSizes,
406 const char **pInStreams);
408 /// @see lok::Document::getSelectionType
409 int (*getSelectionType) (LibreOfficeKitDocument* pThis);
411 /// @see lok::Document::removeTextContext
412 void (*removeTextContext) (LibreOfficeKitDocument* pThis,
413 unsigned nWindowId,
414 int nBefore,
415 int nAfter);
417 /// @see lok::Document::sendDialogEvent
418 void (*sendDialogEvent) (LibreOfficeKitDocument* pThis,
419 unsigned long long int nLOKWindowId,
420 const char* pArguments);
422 /// @see lok::Document::renderFontOrientation().
423 unsigned char* (*renderFontOrientation) (LibreOfficeKitDocument* pThis,
424 const char* pFontName,
425 const char* pChar,
426 int* pFontWidth,
427 int* pFontHeight,
428 int pOrientation);
430 /// Switches view to viewId if viewId >= 0, and paints window
431 /// @see lok::Document::paintWindowDPI().
432 void (*paintWindowForView) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
433 unsigned char* pBuffer,
434 const int x, const int y,
435 const int width, const int height,
436 const double dpiscale,
437 int viewId);
439 /// @see lok::Document::completeFunction().
440 void (*completeFunction) (LibreOfficeKitDocument* pThis, const char* pFunctionName);
442 /// @see lok::Document::setWindowTextSelection
443 void (*setWindowTextSelection) (LibreOfficeKitDocument* pThis,
444 unsigned nWindowId,
445 bool bSwap,
446 int nX,
447 int nY);
449 /// @see lok::Document::sendFormFieldEvent
450 void (*sendFormFieldEvent) (LibreOfficeKitDocument* pThis,
451 const char* pArguments);
453 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
456 #ifdef __cplusplus
458 #endif
460 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
462 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */