cid#1636693 COPY_INSTEAD_OF_MOVE
[LibreOffice.git] / include / LibreOfficeKit / LibreOfficeKit.h
blobb06b978db16c4a8eb4213f61ecfda0e5b2164faf
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 "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);
135 /// @see lok::Office::startURP
136 void* (*startURP)(LibreOfficeKit* pThis,
137 void* pReceiveURPFromLOContext, void* pSendURPToLOContext,
138 int (*fnReceiveURPFromLO)(void* pContext, const signed char* pBuffer, int nLen),
139 int (*fnSendURPToLO)(void* pContext, signed char* pBuffer, int nLen));
141 /// @see lok::Office::stopURP
142 void (*stopURP)(LibreOfficeKit* pThis, void* pSendURPToLOContext);
144 /// @see lok::Office::joinThreads
145 int (*joinThreads)(LibreOfficeKit* pThis);
147 /// @see lok::Office::startThreads
148 void (*startThreads)(LibreOfficeKit* pThis);
150 /// @see lok::Office::setForkedChild
151 void (*setForkedChild)(LibreOfficeKit* pThis, bool bIsChild);
153 /** @see lok::Office::extractDocumentStructureRequest.
155 char* (*extractDocumentStructureRequest)(LibreOfficeKit* pThis, const char* pFilePath,
156 const char* pFilter);
158 /// @see lok::Office::registerAnyInputCallback()
159 void (*registerAnyInputCallback)(LibreOfficeKit* pThis,
160 LibreOfficeKitAnyInputCallback pCallback, void* pData);
163 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
165 struct _LibreOfficeKitDocument
167 LibreOfficeKitDocumentClass* pClass;
170 struct _LibreOfficeKitDocumentClass
172 size_t nSize;
174 void (*destroy) (LibreOfficeKitDocument* pThis);
176 int (*saveAs) (LibreOfficeKitDocument* pThis,
177 const char* pUrl,
178 const char* pFormat,
179 const char* pFilterOptions);
181 /** @see lok::Document::getDocumentType().
182 @since LibreOffice 6.0
184 int (*getDocumentType) (LibreOfficeKitDocument* pThis);
186 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
187 /// @see lok::Document::getParts().
188 int (*getParts) (LibreOfficeKitDocument* pThis);
190 /// @see lok::Document::getPartPageRectangles().
191 char* (*getPartPageRectangles) (LibreOfficeKitDocument* pThis);
193 /// @see lok::Document::getPart().
194 int (*getPart) (LibreOfficeKitDocument* pThis);
196 /// @see lok::Document::setPart().
197 void (*setPart) (LibreOfficeKitDocument* pThis,
198 int nPart);
200 /// @see lok::Document::getPartName().
201 char* (*getPartName) (LibreOfficeKitDocument* pThis,
202 int nPart);
204 /// @see lok::Document::setPartMode().
205 void (*setPartMode) (LibreOfficeKitDocument* pThis,
206 int nMode);
208 /// @see lok::Document::paintTile().
209 void (*paintTile) (LibreOfficeKitDocument* pThis,
210 unsigned char* pBuffer,
211 const int nCanvasWidth,
212 const int nCanvasHeight,
213 const int nTilePosX,
214 const int nTilePosY,
215 const int nTileWidth,
216 const int nTileHeight);
218 /// @see lok::Document::getTileMode().
219 int (*getTileMode) (LibreOfficeKitDocument* pThis);
221 /// @see lok::Document::getDocumentSize().
222 void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
223 long* pWidth,
224 long* pHeight);
226 /// @see lok::Document::initializeForRendering().
227 void (*initializeForRendering) (LibreOfficeKitDocument* pThis,
228 const char* pArguments);
230 /// @see lok::Document::registerCallback().
231 void (*registerCallback) (LibreOfficeKitDocument* pThis,
232 LibreOfficeKitCallback pCallback,
233 void* pData);
235 /// @see lok::Document::postKeyEvent
236 void (*postKeyEvent) (LibreOfficeKitDocument* pThis,
237 int nType,
238 int nCharCode,
239 int nKeyCode);
241 /// @see lok::Document::postMouseEvent
242 void (*postMouseEvent) (LibreOfficeKitDocument* pThis,
243 int nType,
244 int nX,
245 int nY,
246 int nCount,
247 int nButtons,
248 int nModifier);
250 /// @see lok::Document::postUnoCommand
251 void (*postUnoCommand) (LibreOfficeKitDocument* pThis,
252 const char* pCommand,
253 const char* pArguments,
254 bool bNotifyWhenFinished);
256 /// @see lok::Document::setTextSelection
257 void (*setTextSelection) (LibreOfficeKitDocument* pThis,
258 int nType,
259 int nX,
260 int nY);
262 /// @see lok::Document::getTextSelection
263 char* (*getTextSelection) (LibreOfficeKitDocument* pThis,
264 const char* pMimeType,
265 char** pUsedMimeType);
267 /// @see lok::Document::paste().
268 bool (*paste) (LibreOfficeKitDocument* pThis,
269 const char* pMimeType,
270 const char* pData,
271 size_t nSize);
273 /// @see lok::Document::setGraphicSelection
274 void (*setGraphicSelection) (LibreOfficeKitDocument* pThis,
275 int nType,
276 int nX,
277 int nY);
279 /// @see lok::Document::resetSelection
280 void (*resetSelection) (LibreOfficeKitDocument* pThis);
282 /// @see lok::Document::getCommandValues().
283 char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand);
285 /// @see lok::Document::setClientZoom().
286 void (*setClientZoom) (LibreOfficeKitDocument* pThis,
287 int nTilePixelWidth,
288 int nTilePixelHeight,
289 int nTileTwipWidth,
290 int nTileTwipHeight);
292 /// @see lok::Document::setVisibleArea).
293 void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight);
295 /// @see lok::Document::createView().
296 int (*createView) (LibreOfficeKitDocument* pThis);
297 /// @see lok::Document::destroyView().
298 void (*destroyView) (LibreOfficeKitDocument* pThis, int nId);
299 /// @see lok::Document::setView().
300 void (*setView) (LibreOfficeKitDocument* pThis, int nId);
301 /// @see lok::Document::getView().
302 int (*getView) (LibreOfficeKitDocument* pThis);
303 /// @see lok::Document::getViewsCount().
304 int (*getViewsCount) (LibreOfficeKitDocument* pThis);
306 /// @see lok::Document::renderFont().
307 unsigned char* (*renderFont) (LibreOfficeKitDocument* pThis,
308 const char* pFontName,
309 const char* pChar,
310 int* pFontWidth,
311 int* pFontHeight);
313 /// @see lok::Document::getPartHash().
314 char* (*getPartHash) (LibreOfficeKitDocument* pThis,
315 int nPart);
317 /// Paints a tile from a specific part.
318 /// @see lok::Document::paintTile().
319 void (*paintPartTile) (LibreOfficeKitDocument* pThis,
320 unsigned char* pBuffer,
321 const int nPart,
322 const int nMode,
323 const int nCanvasWidth,
324 const int nCanvasHeight,
325 const int nTilePosX,
326 const int nTilePosY,
327 const int nTileWidth,
328 const int nTileHeight);
330 /// @see lok::Document::getViewIds().
331 bool (*getViewIds) (LibreOfficeKitDocument* pThis,
332 int* pArray,
333 size_t nSize);
335 /// @see lok::Document::setOutlineState).
336 void (*setOutlineState) (LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden);
338 /// Paints window with given id to the buffer
339 /// @see lok::Document::paintWindow().
340 void (*paintWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
341 unsigned char* pBuffer,
342 const int x, const int y,
343 const int width, const int height);
345 /// @see lok::Document::postWindow().
346 void (*postWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nAction, const char* pData);
348 /// @see lok::Document::postWindowKeyEvent().
349 void (*postWindowKeyEvent) (LibreOfficeKitDocument* pThis,
350 unsigned nWindowId,
351 int nType,
352 int nCharCode,
353 int nKeyCode);
355 /// @see lok::Document::postWindowMouseEvent().
356 void (*postWindowMouseEvent) (LibreOfficeKitDocument* pThis,
357 unsigned nWindowId,
358 int nType,
359 int nX,
360 int nY,
361 int nCount,
362 int nButtons,
363 int nModifier);
365 /// @see lok::Document::setViewLanguage().
366 void (*setViewLanguage) (LibreOfficeKitDocument* pThis, int nId, const char* language);
368 /// @see lok::Document::postWindowExtTextInputEvent
369 void (*postWindowExtTextInputEvent) (LibreOfficeKitDocument* pThis,
370 unsigned nWindowId,
371 int nType,
372 const char* pText);
374 /// @see lok::Document::getPartInfo().
375 char* (*getPartInfo) (LibreOfficeKitDocument* pThis, int nPart);
377 /// Paints window with given id to the buffer with the give DPI scale
378 /// (every pixel is dpiscale-times larger).
379 /// @see lok::Document::paintWindow().
380 void (*paintWindowDPI) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
381 unsigned char* pBuffer,
382 const int x, const int y,
383 const int width, const int height,
384 const double dpiscale);
386 // CERTIFICATE AND SIGNING
388 /// @see lok::Document::insertCertificate().
389 bool (*insertCertificate) (LibreOfficeKitDocument* pThis,
390 const unsigned char* pCertificateBinary,
391 const int nCertificateBinarySize,
392 const unsigned char* pPrivateKeyBinary,
393 const int nPrivateKeyBinarySize);
395 /// @see lok::Document::addCertificate().
396 bool (*addCertificate) (LibreOfficeKitDocument* pThis,
397 const unsigned char* pCertificateBinary,
398 const int nCertificateBinarySize);
400 /// @see lok::Document::getSignatureState().
401 int (*getSignatureState) (LibreOfficeKitDocument* pThis);
402 // END CERTIFICATE AND SIGNING
404 /// @see lok::Document::renderShapeSelection
405 size_t (*renderShapeSelection)(LibreOfficeKitDocument* pThis, char** pOutput);
407 /// @see lok::Document::postWindowGestureEvent().
408 void (*postWindowGestureEvent) (LibreOfficeKitDocument* pThis,
409 unsigned nWindowId,
410 const char* pType,
411 int nX,
412 int nY,
413 int nOffset);
415 /// @see lok::Document::createViewWithOptions().
416 int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions);
418 /// @see lok::Document::selectPart().
419 void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect);
421 /// @see lok::Document::moveSelectedParts().
422 void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
424 /// Resize window with given id.
425 /// @see lok::Document::resizeWindow().
426 void (*resizeWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
427 const int width, const int height);
429 /// Pass a nullptr terminated array of mime-type strings
430 /// @see lok::Document::getClipboard for more details
431 int (*getClipboard) (LibreOfficeKitDocument* pThis,
432 const char **pMimeTypes,
433 size_t *pOutCount,
434 char ***pOutMimeTypes,
435 size_t **pOutSizes,
436 char ***pOutStreams);
438 /// @see lok::Document::setClipboard
439 int (*setClipboard) (LibreOfficeKitDocument* pThis,
440 const size_t nInCount,
441 const char **pInMimeTypes,
442 const size_t *pInSizes,
443 const char **pInStreams);
445 /// @see lok::Document::getSelectionType
446 int (*getSelectionType) (LibreOfficeKitDocument* pThis);
448 /// @see lok::Document::removeTextContext
449 void (*removeTextContext) (LibreOfficeKitDocument* pThis,
450 unsigned nWindowId,
451 int nBefore,
452 int nAfter);
454 /// @see lok::Document::sendDialogEvent
455 void (*sendDialogEvent) (LibreOfficeKitDocument* pThis,
456 unsigned long long int nLOKWindowId,
457 const char* pArguments);
459 /// @see lok::Document::renderFontOrientation().
460 unsigned char* (*renderFontOrientation) (LibreOfficeKitDocument* pThis,
461 const char* pFontName,
462 const char* pChar,
463 int* pFontWidth,
464 int* pFontHeight,
465 int pOrientation);
467 /// Switches view to viewId if viewId >= 0, and paints window
468 /// @see lok::Document::paintWindowDPI().
469 void (*paintWindowForView) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
470 unsigned char* pBuffer,
471 const int x, const int y,
472 const int width, const int height,
473 const double dpiscale,
474 int viewId);
476 /// @see lok::Document::completeFunction().
477 void (*completeFunction) (LibreOfficeKitDocument* pThis, const char* pFunctionName);
479 /// @see lok::Document::setWindowTextSelection
480 void (*setWindowTextSelection) (LibreOfficeKitDocument* pThis,
481 unsigned nWindowId,
482 bool bSwap,
483 int nX,
484 int nY);
486 /// @see lok::Document::sendFormFieldEvent
487 void (*sendFormFieldEvent) (LibreOfficeKitDocument* pThis,
488 const char* pArguments);
490 /// @see lok::Document::setBlockedCommandList
491 void (*setBlockedCommandList) (LibreOfficeKitDocument* pThis,
492 int nViewId,
493 const char* blockedCommandList);
495 /// @see lok::Document::renderSearchResult
496 bool (*renderSearchResult) (LibreOfficeKitDocument* pThis,
497 const char* pSearchResult,
498 unsigned char** pBitmapBuffer,
499 int* pWidth, int* pHeight, size_t* pByteSize);
501 /// @see lok::Document::sendContentControlEvent().
502 void (*sendContentControlEvent)(LibreOfficeKitDocument* pThis, const char* pArguments);
504 /// @see lok::Document::getSelectionTypeAndText
505 /// @since LibreOffice 7.4
506 int (*getSelectionTypeAndText) (LibreOfficeKitDocument* pThis,
507 const char* pMimeType,
508 char** pText,
509 char** pUsedMimeType);
511 /// @see lok::Document::getDataArea().
512 void (*getDataArea) (LibreOfficeKitDocument* pThis,
513 long nPart,
514 long* pCol,
515 long* pRow);
517 /// @see lok::Document::getEditMode().
518 int (*getEditMode) (LibreOfficeKitDocument* pThis);
520 /// @see lok::Document::setViewTimezone().
521 void (*setViewTimezone) (LibreOfficeKitDocument* pThis, int nId, const char* timezone);
523 /// @see lok::Document::setAccessibilityState().
524 void (*setAccessibilityState) (LibreOfficeKitDocument* pThis, int nId, bool nEnabled);
526 /// @see lok::Document::getA11yFocusedParagraph.
527 char* (*getA11yFocusedParagraph) (LibreOfficeKitDocument* pThis);
529 /// @see lok::Document::getA11yCaretPosition.
530 int (*getA11yCaretPosition) (LibreOfficeKitDocument* pThis);
532 /// @see lok::Document::setViewReadOnly().
533 void (*setViewReadOnly) (LibreOfficeKitDocument* pThis, int nId, const bool readOnly);
535 /// @see lok::Document::setAllowChangeComments().
536 void (*setAllowChangeComments) (LibreOfficeKitDocument* pThis, int nId, const bool allow);
538 /// @see lok::Document::getPresentationInfo
539 char* (*getPresentationInfo) (LibreOfficeKitDocument* pThis);
541 /// @see lok::Document::createSlideRenderer
542 bool (*createSlideRenderer) (
543 LibreOfficeKitDocument* pThis,
544 const char* pSlideHash,
545 int nSlideNumber, unsigned* nViewWidth, unsigned* nViewHeight,
546 bool bRenderBackground, bool bRenderMasterPage);
548 /// @see lok::Document::postSlideshowCleanup
549 void (*postSlideshowCleanup)(LibreOfficeKitDocument* pThis);
551 /// @see lok::Document::renderNextSlideLayer
552 bool (*renderNextSlideLayer)(
553 LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* bIsBitmapLayer, char** pJsonMessage);
555 /// @see lok::Document::setViewOption
556 void (*setViewOption)(LibreOfficeKitDocument* pThis, const char* pOption, const char* pValue);
558 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
561 #ifdef __cplusplus
563 #endif
565 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
567 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */