bump product version to 7.6.3.2-android
[LibreOffice.git] / include / LibreOfficeKit / LibreOfficeKit.h
blobba51c5afeea9e8267b2ef58ba684e76985b14ebd
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);
114 /// @see lok::Office::sendDialogEvent
115 void (*sendDialogEvent) (LibreOfficeKit* pThis,
116 unsigned long long int nLOKWindowId,
117 const char* pArguments);
119 /// @see lok::Office::setOption
120 void (*setOption) (LibreOfficeKit* pThis, const char* pOption, const char* pValue);
122 /// @see lok::Office::dumpState
123 /// @since LibreOffice 7.5
124 void (*dumpState) (LibreOfficeKit* pThis, const char* pOptions, char** pState);
126 /** @see lok::Office::extractRequest.
128 char* (*extractRequest) (LibreOfficeKit* pThis,
129 const char* pFilePath);
131 /// @see lok::Office::trimMemory
132 /// @since LibreOffice 7.6
133 void (*trimMemory) (LibreOfficeKit* pThis, int nTarget);
136 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
138 struct _LibreOfficeKitDocument
140 LibreOfficeKitDocumentClass* pClass;
143 struct _LibreOfficeKitDocumentClass
145 size_t nSize;
147 void (*destroy) (LibreOfficeKitDocument* pThis);
149 int (*saveAs) (LibreOfficeKitDocument* pThis,
150 const char* pUrl,
151 const char* pFormat,
152 const char* pFilterOptions);
154 /** @see lok::Document::getDocumentType().
155 @since LibreOffice 6.0
157 int (*getDocumentType) (LibreOfficeKitDocument* pThis);
159 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
160 /// @see lok::Document::getParts().
161 int (*getParts) (LibreOfficeKitDocument* pThis);
163 /// @see lok::Document::getPartPageRectangles().
164 char* (*getPartPageRectangles) (LibreOfficeKitDocument* pThis);
166 /// @see lok::Document::getPart().
167 int (*getPart) (LibreOfficeKitDocument* pThis);
169 /// @see lok::Document::setPart().
170 void (*setPart) (LibreOfficeKitDocument* pThis,
171 int nPart);
173 /// @see lok::Document::getPartName().
174 char* (*getPartName) (LibreOfficeKitDocument* pThis,
175 int nPart);
177 /// @see lok::Document::setPartMode().
178 void (*setPartMode) (LibreOfficeKitDocument* pThis,
179 int nMode);
181 /// @see lok::Document::paintTile().
182 void (*paintTile) (LibreOfficeKitDocument* pThis,
183 unsigned char* pBuffer,
184 const int nCanvasWidth,
185 const int nCanvasHeight,
186 const int nTilePosX,
187 const int nTilePosY,
188 const int nTileWidth,
189 const int nTileHeight);
191 /// @see lok::Document::getTileMode().
192 int (*getTileMode) (LibreOfficeKitDocument* pThis);
194 /// @see lok::Document::getDocumentSize().
195 void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
196 long* pWidth,
197 long* pHeight);
199 /// @see lok::Document::initializeForRendering().
200 void (*initializeForRendering) (LibreOfficeKitDocument* pThis,
201 const char* pArguments);
203 /// @see lok::Document::registerCallback().
204 void (*registerCallback) (LibreOfficeKitDocument* pThis,
205 LibreOfficeKitCallback pCallback,
206 void* pData);
208 /// @see lok::Document::postKeyEvent
209 void (*postKeyEvent) (LibreOfficeKitDocument* pThis,
210 int nType,
211 int nCharCode,
212 int nKeyCode);
214 /// @see lok::Document::postMouseEvent
215 void (*postMouseEvent) (LibreOfficeKitDocument* pThis,
216 int nType,
217 int nX,
218 int nY,
219 int nCount,
220 int nButtons,
221 int nModifier);
223 /// @see lok::Document::postUnoCommand
224 void (*postUnoCommand) (LibreOfficeKitDocument* pThis,
225 const char* pCommand,
226 const char* pArguments,
227 bool bNotifyWhenFinished);
229 /// @see lok::Document::setTextSelection
230 void (*setTextSelection) (LibreOfficeKitDocument* pThis,
231 int nType,
232 int nX,
233 int nY);
235 /// @see lok::Document::getTextSelection
236 char* (*getTextSelection) (LibreOfficeKitDocument* pThis,
237 const char* pMimeType,
238 char** pUsedMimeType);
240 /// @see lok::Document::paste().
241 bool (*paste) (LibreOfficeKitDocument* pThis,
242 const char* pMimeType,
243 const char* pData,
244 size_t nSize);
246 /// @see lok::Document::setGraphicSelection
247 void (*setGraphicSelection) (LibreOfficeKitDocument* pThis,
248 int nType,
249 int nX,
250 int nY);
252 /// @see lok::Document::resetSelection
253 void (*resetSelection) (LibreOfficeKitDocument* pThis);
255 /// @see lok::Document::getCommandValues().
256 char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand);
258 /// @see lok::Document::setClientZoom().
259 void (*setClientZoom) (LibreOfficeKitDocument* pThis,
260 int nTilePixelWidth,
261 int nTilePixelHeight,
262 int nTileTwipWidth,
263 int nTileTwipHeight);
265 /// @see lok::Document::setVisibleArea).
266 void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight);
268 /// @see lok::Document::createView().
269 int (*createView) (LibreOfficeKitDocument* pThis);
270 /// @see lok::Document::destroyView().
271 void (*destroyView) (LibreOfficeKitDocument* pThis, int nId);
272 /// @see lok::Document::setView().
273 void (*setView) (LibreOfficeKitDocument* pThis, int nId);
274 /// @see lok::Document::getView().
275 int (*getView) (LibreOfficeKitDocument* pThis);
276 /// @see lok::Document::getViewsCount().
277 int (*getViewsCount) (LibreOfficeKitDocument* pThis);
279 /// @see lok::Document::renderFont().
280 unsigned char* (*renderFont) (LibreOfficeKitDocument* pThis,
281 const char* pFontName,
282 const char* pChar,
283 int* pFontWidth,
284 int* pFontHeight);
286 /// @see lok::Document::getPartHash().
287 char* (*getPartHash) (LibreOfficeKitDocument* pThis,
288 int nPart);
290 /// Paints a tile from a specific part.
291 /// @see lok::Document::paintTile().
292 void (*paintPartTile) (LibreOfficeKitDocument* pThis,
293 unsigned char* pBuffer,
294 const int nPart,
295 const int nMode,
296 const int nCanvasWidth,
297 const int nCanvasHeight,
298 const int nTilePosX,
299 const int nTilePosY,
300 const int nTileWidth,
301 const int nTileHeight);
303 /// @see lok::Document::getViewIds().
304 bool (*getViewIds) (LibreOfficeKitDocument* pThis,
305 int* pArray,
306 size_t nSize);
308 /// @see lok::Document::setOutlineState).
309 void (*setOutlineState) (LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden);
311 /// Paints window with given id to the buffer
312 /// @see lok::Document::paintWindow().
313 void (*paintWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
314 unsigned char* pBuffer,
315 const int x, const int y,
316 const int width, const int height);
318 /// @see lok::Document::postWindow().
319 void (*postWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nAction, const char* pData);
321 /// @see lok::Document::postWindowKeyEvent().
322 void (*postWindowKeyEvent) (LibreOfficeKitDocument* pThis,
323 unsigned nWindowId,
324 int nType,
325 int nCharCode,
326 int nKeyCode);
328 /// @see lok::Document::postWindowMouseEvent().
329 void (*postWindowMouseEvent) (LibreOfficeKitDocument* pThis,
330 unsigned nWindowId,
331 int nType,
332 int nX,
333 int nY,
334 int nCount,
335 int nButtons,
336 int nModifier);
338 /// @see lok::Document::setViewLanguage().
339 void (*setViewLanguage) (LibreOfficeKitDocument* pThis, int nId, const char* language);
341 /// @see lok::Document::postWindowExtTextInputEvent
342 void (*postWindowExtTextInputEvent) (LibreOfficeKitDocument* pThis,
343 unsigned nWindowId,
344 int nType,
345 const char* pText);
347 /// @see lok::Document::getPartInfo().
348 char* (*getPartInfo) (LibreOfficeKitDocument* pThis, int nPart);
350 /// Paints window with given id to the buffer with the give DPI scale
351 /// (every pixel is dpiscale-times larger).
352 /// @see lok::Document::paintWindow().
353 void (*paintWindowDPI) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
354 unsigned char* pBuffer,
355 const int x, const int y,
356 const int width, const int height,
357 const double dpiscale);
359 // CERTIFICATE AND SIGNING
361 /// @see lok::Document::insertCertificate().
362 bool (*insertCertificate) (LibreOfficeKitDocument* pThis,
363 const unsigned char* pCertificateBinary,
364 const int nCertificateBinarySize,
365 const unsigned char* pPrivateKeyBinary,
366 const int nPrivateKeyBinarySize);
368 /// @see lok::Document::addCertificate().
369 bool (*addCertificate) (LibreOfficeKitDocument* pThis,
370 const unsigned char* pCertificateBinary,
371 const int nCertificateBinarySize);
373 /// @see lok::Document::getSignatureState().
374 int (*getSignatureState) (LibreOfficeKitDocument* pThis);
375 // END CERTIFICATE AND SIGNING
377 /// @see lok::Document::renderShapeSelection
378 size_t (*renderShapeSelection)(LibreOfficeKitDocument* pThis, char** pOutput);
380 /// @see lok::Document::postWindowGestureEvent().
381 void (*postWindowGestureEvent) (LibreOfficeKitDocument* pThis,
382 unsigned nWindowId,
383 const char* pType,
384 int nX,
385 int nY,
386 int nOffset);
388 /// @see lok::Document::createViewWithOptions().
389 int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions);
391 /// @see lok::Document::selectPart().
392 void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect);
394 /// @see lok::Document::moveSelectedParts().
395 void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
397 /// Resize window with given id.
398 /// @see lok::Document::resizeWindow().
399 void (*resizeWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
400 const int width, const int height);
402 /// Pass a nullptr terminated array of mime-type strings
403 /// @see lok::Document::getClipboard for more details
404 int (*getClipboard) (LibreOfficeKitDocument* pThis,
405 const char **pMimeTypes,
406 size_t *pOutCount,
407 char ***pOutMimeTypes,
408 size_t **pOutSizes,
409 char ***pOutStreams);
411 /// @see lok::Document::setClipboard
412 int (*setClipboard) (LibreOfficeKitDocument* pThis,
413 const size_t nInCount,
414 const char **pInMimeTypes,
415 const size_t *pInSizes,
416 const char **pInStreams);
418 /// @see lok::Document::getSelectionType
419 int (*getSelectionType) (LibreOfficeKitDocument* pThis);
421 /// @see lok::Document::removeTextContext
422 void (*removeTextContext) (LibreOfficeKitDocument* pThis,
423 unsigned nWindowId,
424 int nBefore,
425 int nAfter);
427 /// @see lok::Document::sendDialogEvent
428 void (*sendDialogEvent) (LibreOfficeKitDocument* pThis,
429 unsigned long long int nLOKWindowId,
430 const char* pArguments);
432 /// @see lok::Document::renderFontOrientation().
433 unsigned char* (*renderFontOrientation) (LibreOfficeKitDocument* pThis,
434 const char* pFontName,
435 const char* pChar,
436 int* pFontWidth,
437 int* pFontHeight,
438 int pOrientation);
440 /// Switches view to viewId if viewId >= 0, and paints window
441 /// @see lok::Document::paintWindowDPI().
442 void (*paintWindowForView) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
443 unsigned char* pBuffer,
444 const int x, const int y,
445 const int width, const int height,
446 const double dpiscale,
447 int viewId);
449 /// @see lok::Document::completeFunction().
450 void (*completeFunction) (LibreOfficeKitDocument* pThis, const char* pFunctionName);
452 /// @see lok::Document::setWindowTextSelection
453 void (*setWindowTextSelection) (LibreOfficeKitDocument* pThis,
454 unsigned nWindowId,
455 bool bSwap,
456 int nX,
457 int nY);
459 /// @see lok::Document::sendFormFieldEvent
460 void (*sendFormFieldEvent) (LibreOfficeKitDocument* pThis,
461 const char* pArguments);
463 /// @see lok::Document::setBlockedCommandList
464 void (*setBlockedCommandList) (LibreOfficeKitDocument* pThis,
465 int nViewId,
466 const char* blockedCommandList);
468 /// @see lok::Document::renderSearchResult
469 bool (*renderSearchResult) (LibreOfficeKitDocument* pThis,
470 const char* pSearchResult,
471 unsigned char** pBitmapBuffer,
472 int* pWidth, int* pHeight, size_t* pByteSize);
474 /// @see lok::Document::sendContentControlEvent().
475 void (*sendContentControlEvent)(LibreOfficeKitDocument* pThis, const char* pArguments);
477 /// @see lok::Document::getSelectionTypeAndText
478 /// @since LibreOffice 7.4
479 int (*getSelectionTypeAndText) (LibreOfficeKitDocument* pThis,
480 const char* pMimeType,
481 char** pText,
482 char** pUsedMimeType);
484 /// @see lok::Document::getDataArea().
485 void (*getDataArea) (LibreOfficeKitDocument* pThis,
486 long nPart,
487 long* pCol,
488 long* pRow);
490 /// @see lok::Document::getEditMode().
491 int (*getEditMode) (LibreOfficeKitDocument* pThis);
493 /// @see lok::Document::setViewTimezone().
494 void (*setViewTimezone) (LibreOfficeKitDocument* pThis, int nId, const char* timezone);
496 /// @see lok::Document::setAccessibilityState().
497 void (*setAccessibilityState) (LibreOfficeKitDocument* pThis, int nId, bool nEnabled);
499 /// @see lok::Document::getA11yFocusedParagraph.
500 char* (*getA11yFocusedParagraph) (LibreOfficeKitDocument* pThis);
502 /// @see lok::Document::getA11yCaretPosition.
503 int (*getA11yCaretPosition) (LibreOfficeKitDocument* pThis);
505 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
508 #ifdef __cplusplus
510 #endif
512 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
514 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */