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 <LibreOfficeKit/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
,
115 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
117 struct _LibreOfficeKitDocument
119 LibreOfficeKitDocumentClass
* pClass
;
122 struct _LibreOfficeKitDocumentClass
126 void (*destroy
) (LibreOfficeKitDocument
* pThis
);
128 int (*saveAs
) (LibreOfficeKitDocument
* pThis
,
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
,
152 /// @see lok::Document::getPartName().
153 char* (*getPartName
) (LibreOfficeKitDocument
* pThis
,
156 /// @see lok::Document::setPartMode().
157 void (*setPartMode
) (LibreOfficeKitDocument
* pThis
,
160 /// @see lok::Document::paintTile().
161 void (*paintTile
) (LibreOfficeKitDocument
* pThis
,
162 unsigned char* pBuffer
,
163 const int nCanvasWidth
,
164 const int nCanvasHeight
,
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
,
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
,
187 /// @see lok::Document::postKeyEvent
188 void (*postKeyEvent
) (LibreOfficeKitDocument
* pThis
,
193 /// @see lok::Document::postMouseEvent
194 void (*postMouseEvent
) (LibreOfficeKitDocument
* pThis
,
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
,
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
,
225 /// @see lok::Document::setGraphicSelection
226 void (*setGraphicSelection
) (LibreOfficeKitDocument
* pThis
,
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
,
240 int nTilePixelHeight
,
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
,
265 /// @see lok::Document::getPartHash().
266 char* (*getPartHash
) (LibreOfficeKitDocument
* pThis
,
269 /// Paints a tile from a specific part.
270 /// @see lok::Document::paintTile().
271 void (*paintPartTile
) (LibreOfficeKitDocument
* pThis
,
272 unsigned char* pBuffer
,
274 const int nCanvasWidth
,
275 const int nCanvasHeight
,
278 const int nTileWidth
,
279 const int nTileHeight
);
281 /// @see lok::Document::getViewIds().
282 bool (*getViewIds
) (LibreOfficeKitDocument
* pThis
,
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
,
306 /// @see lok::Document::postWindowMouseEvent().
307 void (*postWindowMouseEvent
) (LibreOfficeKitDocument
* pThis
,
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
,
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
);
338 /// @see lok::Document::paintTileToCGContext().
339 void (*paintTileToCGContext
) (LibreOfficeKitDocument
* pThis
,
341 const int nCanvasWidth
,
342 const int nCanvasHeight
,
345 const int nTileWidth
,
346 const int nTileHeight
);
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
,
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
,
397 char ***pOutMimeTypes
,
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
,
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
,
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
,
439 /// @see lok::Document::completeFunction().
440 void (*completeFunction
) (LibreOfficeKitDocument
* pThis
, const char* pFunctionName
);
442 /// @see lok::Document::setWindowTextSelection
443 void (*setWindowTextSelection
) (LibreOfficeKitDocument
* pThis
,
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
460 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
462 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */