1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
11 #define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_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
24 #include "LibreOfficeKitTypes.h"
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
52 void (*destroy
) (LibreOfficeKit
* pThis
);
54 LibreOfficeKitDocument
* (*documentLoad
) (LibreOfficeKit
* pThis
,
57 char* (*getError
) (LibreOfficeKit
* pThis
);
59 /// @since LibreOffice 5.0
60 LibreOfficeKitDocument
* (*documentLoadWithOptions
) (LibreOfficeKit
* pThis
,
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
,
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
,
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
,
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
,
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
174 void (*destroy
) (LibreOfficeKitDocument
* pThis
);
176 int (*saveAs
) (LibreOfficeKitDocument
* pThis
,
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
,
200 /// @see lok::Document::getPartName().
201 char* (*getPartName
) (LibreOfficeKitDocument
* pThis
,
204 /// @see lok::Document::setPartMode().
205 void (*setPartMode
) (LibreOfficeKitDocument
* pThis
,
208 /// @see lok::Document::paintTile().
209 void (*paintTile
) (LibreOfficeKitDocument
* pThis
,
210 unsigned char* pBuffer
,
211 const int nCanvasWidth
,
212 const int nCanvasHeight
,
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
,
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
,
235 /// @see lok::Document::postKeyEvent
236 void (*postKeyEvent
) (LibreOfficeKitDocument
* pThis
,
241 /// @see lok::Document::postMouseEvent
242 void (*postMouseEvent
) (LibreOfficeKitDocument
* pThis
,
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
,
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
,
273 /// @see lok::Document::setGraphicSelection
274 void (*setGraphicSelection
) (LibreOfficeKitDocument
* pThis
,
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
,
288 int nTilePixelHeight
,
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
,
313 /// @see lok::Document::getPartHash().
314 char* (*getPartHash
) (LibreOfficeKitDocument
* pThis
,
317 /// Paints a tile from a specific part.
318 /// @see lok::Document::paintTile().
319 void (*paintPartTile
) (LibreOfficeKitDocument
* pThis
,
320 unsigned char* pBuffer
,
323 const int nCanvasWidth
,
324 const int nCanvasHeight
,
327 const int nTileWidth
,
328 const int nTileHeight
);
330 /// @see lok::Document::getViewIds().
331 bool (*getViewIds
) (LibreOfficeKitDocument
* pThis
,
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
,
355 /// @see lok::Document::postWindowMouseEvent().
356 void (*postWindowMouseEvent
) (LibreOfficeKitDocument
* pThis
,
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
,
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
,
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
,
434 char ***pOutMimeTypes
,
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
,
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
,
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
,
476 /// @see lok::Document::completeFunction().
477 void (*completeFunction
) (LibreOfficeKitDocument
* pThis
, const char* pFunctionName
);
479 /// @see lok::Document::setWindowTextSelection
480 void (*setWindowTextSelection
) (LibreOfficeKitDocument
* pThis
,
486 /// @see lok::Document::sendFormFieldEvent
487 void (*sendFormFieldEvent
) (LibreOfficeKitDocument
* pThis
,
488 const char* pArguments
);
490 /// @see lok::Document::setBlockedCommandList
491 void (*setBlockedCommandList
) (LibreOfficeKitDocument
* pThis
,
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
,
509 char** pUsedMimeType
);
511 /// @see lok::Document::getDataArea().
512 void (*getDataArea
) (LibreOfficeKitDocument
* pThis
,
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
565 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
567 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */