bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / LibreOfficeKit / LibreOfficeKit.hxx
blob70fdab298e860088a69df7508d4818193ddf6656
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_HXX
11 #define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_HXX
13 #include <cstddef>
15 #include <LibreOfficeKit/LibreOfficeKit.h>
16 #include <LibreOfficeKit/LibreOfficeKitInit.h>
19 * The reasons this C++ code is not as pretty as it could be are:
20 * a) provide a pure C API - that's useful for some people
21 * b) allow ABI stability - C++ vtables are not good for that.
22 * c) avoid C++ types as part of the API.
24 namespace lok
27 /// The lok::Document class represents one loaded document instance.
28 class Document
30 private:
31 LibreOfficeKitDocument* mpDoc;
33 public:
34 /// A lok::Document is typically created by the lok::Office::documentLoad() method.
35 Document(LibreOfficeKitDocument* pDoc) :
36 mpDoc(pDoc)
39 ~Document()
41 mpDoc->pClass->destroy(mpDoc);
44 /**
45 * Stores the document's persistent data to a URL and
46 * continues to be a representation of the old URL.
48 * @param pUrl the location where to store the document
49 * @param pFormat the format to use while exporting, when omitted, then deducted from pURL's extension
50 * @param pFilterOptions options for the export filter, e.g. SkipImages.
51 * Another useful FilterOption is "TakeOwnership". It is consumed
52 * by the saveAs() itself, and when provided, the document identity
53 * changes to the provided pUrl - meaning that '.uno:ModifiedStatus'
54 * is triggered as with the "Save As..." in the UI.
55 * "TakeOwnership" mode must not be used when saving to PNG or PDF.
57 bool saveAs(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL)
59 return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat, pFilterOptions) != 0;
62 /// Gives access to the underlying C pointer.
63 LibreOfficeKitDocument *get() { return mpDoc; }
65 /**
66 * Get document type.
68 * @since LibreOffice 6.0
69 * @return an element of the LibreOfficeKitDocumentType enum.
71 int getDocumentType()
73 return mpDoc->pClass->getDocumentType(mpDoc);
76 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
77 /**
78 * Get number of part that the document contains.
80 * Part refers to either individual sheets in a Calc, or slides in Impress,
81 * and has no relevance for Writer.
83 int getParts()
85 return mpDoc->pClass->getParts(mpDoc);
88 /**
89 * Get the logical rectangle of each part in the document.
91 * A part refers to an individual page in Writer and has no relevant for
92 * Calc or Impress.
94 * @return a rectangle list, using the same format as
95 * LOK_CALLBACK_TEXT_SELECTION.
97 char* getPartPageRectangles()
99 return mpDoc->pClass->getPartPageRectangles(mpDoc);
102 /// Get the current part of the document.
103 int getPart()
105 return mpDoc->pClass->getPart(mpDoc);
108 /// Set the current part of the document.
109 void setPart(int nPart)
111 mpDoc->pClass->setPart(mpDoc, nPart);
114 /// Get the current part's name.
115 char* getPartName(int nPart)
117 return mpDoc->pClass->getPartName(mpDoc, nPart);
120 /// Get the current part's hash.
121 char* getPartHash(int nPart)
123 return mpDoc->pClass->getPartHash(mpDoc, nPart);
126 void setPartMode(int nMode)
128 mpDoc->pClass->setPartMode(mpDoc, nMode);
132 * Renders a subset of the document to a pre-allocated buffer.
134 * Note that the buffer size and the tile size implicitly supports
135 * rendering at different zoom levels, as the number of rendered pixels and
136 * the rendered rectangle of the document are independent.
138 * @param pBuffer pointer to the buffer, its size is determined by nCanvasWidth and nCanvasHeight.
139 * @param nCanvasWidth number of pixels in a row of pBuffer.
140 * @param nCanvasHeight number of pixels in a column of pBuffer.
141 * @param nTilePosX logical X position of the top left corner of the rendered rectangle, in TWIPs.
142 * @param nTilePosY logical Y position of the top left corner of the rendered rectangle, in TWIPs.
143 * @param nTileWidth logical width of the rendered rectangle, in TWIPs.
144 * @param nTileHeight logical height of the rendered rectangle, in TWIPs.
146 void paintTile(unsigned char* pBuffer,
147 const int nCanvasWidth,
148 const int nCanvasHeight,
149 const int nTilePosX,
150 const int nTilePosY,
151 const int nTileWidth,
152 const int nTileHeight)
154 return mpDoc->pClass->paintTile(mpDoc, pBuffer, nCanvasWidth, nCanvasHeight,
155 nTilePosX, nTilePosY, nTileWidth, nTileHeight);
159 * Renders a window (dialog, popup, etc.) with give id
161 * @param nWindowId
162 * @param pBuffer Buffer with enough memory allocated to render any dialog
163 * @param x x-coordinate from where the dialog should start painting
164 * @param y y-coordinate from where the dialog should start painting
165 * @param width The width of the dialog image to be painted
166 * @param height The height of the dialog image to be painted
167 * @param dpiscale The dpi scale value used by the client. Please note
168 * that the x, y, width, height are supposed to be the
169 * values with dpiscale applied (ie. dialog covering
170 * 100x100 "normal" pixels with dpiscale '2' will have
171 * 200x200 width x height), so that it is easy to compute
172 * the buffer sizes etc.
174 void paintWindow(unsigned nWindowId,
175 unsigned char* pBuffer,
176 const int x,
177 const int y,
178 const int width,
179 const int height,
180 const double dpiscale = 1.0)
182 return mpDoc->pClass->paintWindowDPI(mpDoc, nWindowId, pBuffer,
183 x, y, width, height, dpiscale);
187 * Posts a command to the window (dialog, popup, etc.) with given id
189 * @param nWindowid
191 void postWindow(unsigned nWindowId, int nAction, const char* pData = nullptr)
193 return mpDoc->pClass->postWindow(mpDoc, nWindowId, nAction, pData);
197 * Gets the tile mode: the pixel format used for the pBuffer of paintTile().
199 * @return an element of the LibreOfficeKitTileMode enum.
201 int getTileMode()
203 return mpDoc->pClass->getTileMode(mpDoc);
206 /// Get the document sizes in TWIPs.
207 void getDocumentSize(long* pWidth, long* pHeight)
209 mpDoc->pClass->getDocumentSize(mpDoc, pWidth, pHeight);
213 * Initialize document for rendering.
215 * Sets the rendering and document parameters to default values that are
216 * needed to render the document correctly using tiled rendering. This
217 * method has to be called right after documentLoad() in case any of the
218 * tiled rendering methods are to be used later.
220 * Example argument string for text documents:
223 * ".uno:HideWhitespace":
225 * "type": "boolean",
226 * "value": "true"
230 * @param pArguments arguments of the rendering
232 void initializeForRendering(const char* pArguments = NULL)
234 mpDoc->pClass->initializeForRendering(mpDoc, pArguments);
238 * Registers a callback. LOK will invoke this function when it wants to
239 * inform the client about events.
241 * @param pCallback the callback to invoke
242 * @param pData the user data, will be passed to the callback on invocation
244 void registerCallback(LibreOfficeKitCallback pCallback, void* pData)
246 mpDoc->pClass->registerCallback(mpDoc, pCallback, pData);
250 * Posts a keyboard event to the focused frame.
252 * @param nType Event type, like press or release.
253 * @param nCharCode contains the Unicode character generated by this event or 0
254 * @param nKeyCode contains the integer code representing the key of the event (non-zero for control keys)
256 void postKeyEvent(int nType, int nCharCode, int nKeyCode)
258 mpDoc->pClass->postKeyEvent(mpDoc, nType, nCharCode, nKeyCode);
262 * Posts a keyboard event to the dialog
264 * @param nWindowId
265 * @param nType Event type, like press or release.
266 * @param nCharCode contains the Unicode character generated by this event or 0
267 * @param nKeyCode contains the integer code representing the key of the event (non-zero for control keys)
269 void postWindowKeyEvent(unsigned nWindowId, int nType, int nCharCode, int nKeyCode)
271 mpDoc->pClass->postWindowKeyEvent(mpDoc, nWindowId, nType, nCharCode, nKeyCode);
275 * Posts a mouse event to the document.
277 * @param nType Event type, like down, move or up.
278 * @param nX horizontal position in document coordinates
279 * @param nY vertical position in document coordinates
280 * @param nCount number of clicks: 1 for single click, 2 for double click
281 * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
282 * @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
284 void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
286 mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount, nButtons, nModifier);
290 * Posts a mouse event to the window with given id.
292 * @param nWindowId
293 * @param nType Event type, like down, move or up.
294 * @param nX horizontal position in document coordinates
295 * @param nY vertical position in document coordinates
296 * @param nCount number of clicks: 1 for single click, 2 for double click
297 * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
298 * @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
300 void postWindowMouseEvent(unsigned nWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
302 mpDoc->pClass->postWindowMouseEvent(mpDoc, nWindowId, nType, nX, nY, nCount, nButtons, nModifier);
306 * Posts a UNO command to the document.
308 * Example argument string:
311 * "SearchItem.SearchString":
313 * "type": "string",
314 * "value": "foobar"
315 * },
316 * "SearchItem.Backward":
318 * "type": "boolean",
319 * "value": "false"
323 * @param pCommand uno command to be posted to the document, like ".uno:Bold"
324 * @param pArguments arguments of the uno command.
326 void postUnoCommand(const char* pCommand, const char* pArguments = NULL, bool bNotifyWhenFinished = false)
328 mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished);
332 * Sets the start or end of a text selection.
334 * @param nType @see LibreOfficeKitSetTextSelectionType
335 * @param nX horizontal position in document coordinates
336 * @param nY vertical position in document coordinates
338 void setTextSelection(int nType, int nX, int nY)
340 mpDoc->pClass->setTextSelection(mpDoc, nType, nX, nY);
344 * Gets the currently selected text.
346 * @param pMimeType suggests the return format, for example text/plain;charset=utf-8.
347 * @param pUsedMimeType output parameter to inform about the determined format (suggested one or plain text).
349 char* getTextSelection(const char* pMimeType, char** pUsedMimeType = NULL)
351 return mpDoc->pClass->getTextSelection(mpDoc, pMimeType, pUsedMimeType);
355 * Pastes content at the current cursor position.
357 * @param pMimeType format of pData, for example text/plain;charset=utf-8.
358 * @param pData the actual data to be pasted.
359 * @return if the supplied data was pasted successfully.
361 bool paste(const char* pMimeType, const char* pData, size_t nSize)
363 return mpDoc->pClass->paste(mpDoc, pMimeType, pData, nSize);
367 * Adjusts the graphic selection.
369 * @param nType @see LibreOfficeKitSetGraphicSelectionType
370 * @param nX horizontal position in document coordinates
371 * @param nY vertical position in document coordinates
373 void setGraphicSelection(int nType, int nX, int nY)
375 mpDoc->pClass->setGraphicSelection(mpDoc, nType, nX, nY);
379 * Gets rid of any text or graphic selection.
381 void resetSelection()
383 mpDoc->pClass->resetSelection(mpDoc);
387 * Returns a json mapping of the possible values for the given command
388 * e.g. {commandName: ".uno:StyleApply", commandValues: {"familyName1" : ["list of style names in the family1"], etc.}}
389 * @param pCommand a uno command for which the possible values are requested
390 * @return {commandName: unoCmd, commandValues: {possible_values}}
392 char* getCommandValues(const char* pCommand)
394 return mpDoc->pClass->getCommandValues(mpDoc, pCommand);
398 * Save the client's view so that we can compute the right zoom level
399 * for the mouse events. This only affects CALC.
400 * @param nTilePixelWidth - tile width in pixels
401 * @param nTilePixelHeight - tile height in pixels
402 * @param nTileTwipWidth - tile width in twips
403 * @param nTileTwipHeight - tile height in twips
405 void setClientZoom(
406 int nTilePixelWidth,
407 int nTilePixelHeight,
408 int nTileTwipWidth,
409 int nTileTwipHeight)
411 mpDoc->pClass->setClientZoom(mpDoc, nTilePixelWidth, nTilePixelHeight, nTileTwipWidth, nTileTwipHeight);
415 * Inform core about the currently visible area of the document on the
416 * client, so that it can perform e.g. page down (which depends on the
417 * visible height) in a sane way.
419 * @param nX - top left corner horizontal position
420 * @param nY - top left corner vertical position
421 * @param nWidth - area width
422 * @param nHeight - area height
424 void setClientVisibleArea(int nX, int nY, int nWidth, int nHeight)
426 mpDoc->pClass->setClientVisibleArea(mpDoc, nX, nY, nWidth, nHeight);
430 * Show/Hide a single row/column header outline for Calc documents.
432 * @param bColumn - if we are dealing with a column or row group
433 * @param nLevel - the level to which the group belongs
434 * @param nIndex - the group entry index
435 * @param bHidden - the new group state (collapsed/expanded)
437 void setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden)
439 mpDoc->pClass->setOutlineState(mpDoc, bColumn, nLevel, nIndex, bHidden);
443 * Create a new view for an existing document with
444 * options similar to documentLoadWithOptions.
445 * By default a loaded document has 1 view.
446 * @return the ID of the new view.
448 int createView(const char* pOptions = nullptr)
450 if (LIBREOFFICEKIT_DOCUMENT_HAS(mpDoc, createViewWithOptions))
451 return mpDoc->pClass->createViewWithOptions(mpDoc, pOptions);
452 else
453 return mpDoc->pClass->createView(mpDoc);
457 * Destroy a view of an existing document.
458 * @param nId a view ID, returned by createView().
460 void destroyView(int nId)
462 mpDoc->pClass->destroyView(mpDoc, nId);
466 * Set an existing view of an existing document as current.
467 * @param nId a view ID, returned by createView().
469 void setView(int nId)
471 mpDoc->pClass->setView(mpDoc, nId);
475 * Get the current view.
476 * @return a view ID, previously returned by createView().
478 int getView()
480 return mpDoc->pClass->getView(mpDoc);
484 * Get number of views of this document.
486 int getViewsCount()
488 return mpDoc->pClass->getViewsCount(mpDoc);
492 * Paints a font name or character if provided to be displayed in the font list
493 * @param pFontName the font to be painted
495 unsigned char* renderFont(const char *pFontName,
496 const char *pChar,
497 int *pFontWidth,
498 int *pFontHeight)
500 return mpDoc->pClass->renderFont(mpDoc, pFontName, pChar, pFontWidth, pFontHeight);
504 * Renders a subset of the document's part to a pre-allocated buffer.
506 * @param nPart the part number of the document of which the tile is painted.
507 * @see paintTile.
509 void paintPartTile(unsigned char* pBuffer,
510 const int nPart,
511 const int nCanvasWidth,
512 const int nCanvasHeight,
513 const int nTilePosX,
514 const int nTilePosY,
515 const int nTileWidth,
516 const int nTileHeight)
518 return mpDoc->pClass->paintPartTile(mpDoc, pBuffer, nPart,
519 nCanvasWidth, nCanvasHeight,
520 nTilePosX, nTilePosY,
521 nTileWidth, nTileHeight);
525 * Returns the viewID for each existing view. Since viewIDs are not reused,
526 * viewIDs are not the same as the index of the view in the view array over
527 * time. Use getViewsCount() to know the minimal nSize that's large enough.
529 * @param pArray the array to write the viewIDs into
530 * @param nSize the size of pArray
531 * @returns true if pArray was large enough and result is written, false
532 * otherwise.
534 bool getViewIds(int* pArray,
535 size_t nSize)
537 return mpDoc->pClass->getViewIds(mpDoc, pArray, nSize);
541 * Set the language tag of the window with the specified nId.
543 * @param nId a view ID, returned by createView().
544 * @param language Bcp47 languageTag, like en-US or so.
546 void setViewLanguage(int nId, const char* language)
548 mpDoc->pClass->setViewLanguage(mpDoc, nId, language);
552 * Post the text input from external input window, like IME, to given windowId
554 * @param nWindowId Specify the window id to post the input event to. If
555 * nWindow is 0, the event is posted into the document
556 * @param nType see LibreOfficeKitExtTextInputType
557 * @param pText Text for LOK_EXT_TEXTINPUT
559 void postWindowExtTextInputEvent(unsigned nWindowId, int nType, const char* pText)
561 mpDoc->pClass->postWindowExtTextInputEvent(mpDoc, nWindowId, nType, pText);
564 #ifdef IOS
566 * Renders a subset of the document to a Core Graphics context.
568 * Note that the buffer size and the tile size implicitly supports
569 * rendering at different zoom levels, as the number of rendered pixels and
570 * the rendered rectangle of the document are independent.
572 * @param rCGContext the CGContextRef, cast to a void*.
573 * @param nCanvasHeight number of pixels in a column of pBuffer.
574 * @param nTilePosX logical X position of the top left corner of the rendered rectangle, in TWIPs.
575 * @param nTilePosY logical Y position of the top left corner of the rendered rectangle, in TWIPs.
576 * @param nTileWidth logical width of the rendered rectangle, in TWIPs.
577 * @param nTileHeight logical height of the rendered rectangle, in TWIPs.
579 void paintTileToCGContext(void* rCGContext,
580 const int nCanvasWidth,
581 const int nCanvasHeight,
582 const int nTilePosX,
583 const int nTilePosY,
584 const int nTileWidth,
585 const int nTileHeight)
587 return mpDoc->pClass->paintTileToCGContext(mpDoc, rCGContext, nCanvasWidth, nCanvasHeight,
588 nTilePosX, nTilePosY, nTileWidth, nTileHeight);
590 #endif // IOS
593 * Insert certificate (in binary form) to the certificate store.
595 bool insertCertificate(const unsigned char* pCertificateBinary,
596 const int pCertificateBinarySize,
597 const unsigned char* pPrivateKeyBinary,
598 const int nPrivateKeyBinarySize)
600 return mpDoc->pClass->insertCertificate(mpDoc,
601 pCertificateBinary, pCertificateBinarySize,
602 pPrivateKeyBinary, nPrivateKeyBinarySize);
606 * Add the certificate (in binary form) to the certificate store.
609 bool addCertificate(const unsigned char* pCertificateBinary,
610 const int pCertificateBinarySize)
612 return mpDoc->pClass->addCertificate(mpDoc,
613 pCertificateBinary, pCertificateBinarySize);
617 * Verify signature of the document.
619 * Check possible values in include/sfx2/signaturestate.hxx
621 int getSignatureState()
623 return mpDoc->pClass->getSignatureState(mpDoc);
627 * Gets an image of the selected shapes.
628 * @param pOutput contains the result; use free to deallocate.
629 * @return the size ouf *pOutput in bytes.
631 size_t renderShapeSelection(char** pOutput)
633 return mpDoc->pClass->renderShapeSelection(mpDoc, pOutput);
637 * Posts a gesture event to the window with given id.
639 * @param nWindowId
640 * @param pType Event type, like panStart, panEnd, panUpdate.
641 * @param nX horizontal position in document coordinates
642 * @param nY vertical position in document coordinates
643 * @param nOffset difference value from when the gesture started to current value
645 void postWindowGestureEvent(unsigned nWindowId,
646 const char* pType,
647 int nX, int nY, int nOffset)
649 return mpDoc->pClass->postWindowGestureEvent(mpDoc, nWindowId, pType, nX, nY, nOffset);
651 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
654 /// The lok::Office class represents one started LibreOfficeKit instance.
655 class Office
657 private:
658 LibreOfficeKit* mpThis;
660 public:
661 /// A lok::Office is typically created by the lok_cpp_init() function.
662 Office(LibreOfficeKit* pThis) :
663 mpThis(pThis)
666 ~Office()
668 mpThis->pClass->destroy(mpThis);
672 * Loads a document from a URL.
674 * @param pUrl the URL of the document to load
675 * @param pFilterOptions options for the import filter, e.g. SkipImages.
676 * Another useful FilterOption is "Language=...". It is consumed
677 * by the documentLoad() itself, and when provided, LibreOfficeKit
678 * switches the language accordingly first.
679 * @since pFilterOptions argument added in LibreOffice 5.0
681 Document* documentLoad(const char* pUrl, const char* pFilterOptions = NULL)
683 LibreOfficeKitDocument* pDoc = NULL;
685 if (LIBREOFFICEKIT_HAS(mpThis, documentLoadWithOptions))
686 pDoc = mpThis->pClass->documentLoadWithOptions(mpThis, pUrl, pFilterOptions);
687 else
688 pDoc = mpThis->pClass->documentLoad(mpThis, pUrl);
690 if (pDoc == NULL)
691 return NULL;
693 return new Document(pDoc);
696 /// Returns the last error as a string, the returned pointer has to be freed by the caller.
697 char* getError()
699 return mpThis->pClass->getError(mpThis);
703 * Frees the memory pointed to by pFree.
705 * @since LibreOffice 5.2
707 void freeError(char* pFree)
709 mpThis->pClass->freeError(pFree);
713 * Registers a callback. LOK will invoke this function when it wants to
714 * inform the client about events.
716 * @since LibreOffice 6.0
717 * @param pCallback the callback to invoke
718 * @param pData the user data, will be passed to the callback on invocation
720 void registerCallback(LibreOfficeKitCallback pCallback, void* pData)
722 mpThis->pClass->registerCallback(mpThis, pCallback, pData);
726 * Returns details of filter types.
728 * Example returned string:
731 * "writer8": {
732 * "MediaType": "application/vnd.oasis.opendocument.text"
733 * },
734 * "calc8": {
735 * "MediaType": "application/vnd.oasis.opendocument.spreadsheet"
739 * @since LibreOffice 6.0
741 char* getFilterTypes()
743 return mpThis->pClass->getFilterTypes(mpThis);
747 * Set bitmask of optional features supported by the client.
749 * @since LibreOffice 6.0
750 * @see LibreOfficeKitOptionalFeatures
752 void setOptionalFeatures(unsigned long long features)
754 return mpThis->pClass->setOptionalFeatures(mpThis, features);
758 * Set password required for loading or editing a document.
760 * Loading the document is blocked until the password is provided.
762 * @param pURL the URL of the document, as sent to the callback
763 * @param pPassword the password, nullptr indicates no password
765 * In response to LOK_CALLBACK_DOCUMENT_PASSWORD, a valid password
766 * will continue loading the document, an invalid password will
767 * result in another LOK_CALLBACK_DOCUMENT_PASSWORD request,
768 * and a NULL password will abort loading the document.
770 * In response to LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY, a valid
771 * password will continue loading the document, an invalid password will
772 * result in another LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY request,
773 * and a NULL password will continue loading the document in read-only
774 * mode.
776 * @since LibreOffice 6.0
778 void setDocumentPassword(char const* pURL, char const* pPassword)
780 mpThis->pClass->setDocumentPassword(mpThis, pURL, pPassword);
784 * Get version information of the LOKit process
786 * @since LibreOffice 6.0
787 * @returns JSON string containing version information in format:
788 * {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
790 * Eg: {"ProductName": "LibreOffice",
791 * "ProductVersion": "5.3",
792 * "ProductExtension": ".0.0.alpha0",
793 * "BuildId": "<full 40 char git hash>"}
795 char* getVersionInfo()
797 return mpThis->pClass->getVersionInfo(mpThis);
801 * Run a macro.
803 * Same syntax as on command line is permissible (ie. the macro:// URI forms)
805 * @since LibreOffice 6.0
806 * @param pURL macro url to run
809 bool runMacro( const char* pURL)
811 return mpThis->pClass->runMacro( mpThis, pURL );
815 * Exports the document and signes its content.
817 bool signDocument(const char* pURL,
818 const unsigned char* pCertificateBinary, const int nCertificateBinarySize,
819 const unsigned char* pPrivateKeyBinary, const int nPrivateKeyBinarySize)
821 return mpThis->pClass->signDocument(mpThis, pURL,
822 pCertificateBinary, nCertificateBinarySize,
823 pPrivateKeyBinary, nPrivateKeyBinarySize);
827 * Runs the main-loop in the current thread. To trigger this
828 * mode you need to putenv a SAL_LOK_OPTIONS containing 'unipoll'.
829 * The @pPollCallback is called to poll for events from the Kit client
830 * and the @pWakeCallback can be called by internal LibreOfficeKit threads
831 * to wake the caller of 'runLoop' ie. the main thread.
833 * it is expected that runLoop does not return until Kit exit.
835 * @pData is a context/closure passed to both methods.
837 void runLoop(LibreOfficeKitPollCallback pPollCallback,
838 LibreOfficeKitWakeCallback pWakeCallback,
839 void* pData)
841 mpThis->pClass->runLoop(mpThis, pPollCallback, pWakeCallback, pData);
845 /// Factory method to create a lok::Office instance.
846 inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfileUrl = NULL)
848 LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfileUrl);
849 if (pThis == NULL || pThis->pClass->nSize == 0)
850 return NULL;
851 return new ::lok::Office(pThis);
856 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_HXX
858 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */