[Libreoffice-commits] online.git: bundled/include

Pranav Kant pranavk at collabora.co.uk
Mon Oct 30 11:41:20 UTC 2017


 bundled/include/LibreOfficeKit/LibreOfficeKit.h      |   80 +++++--
 bundled/include/LibreOfficeKit/LibreOfficeKit.hxx    |  216 +++++++++++++------
 bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h |   26 ++
 bundled/include/LibreOfficeKit/LibreOfficeKitInit.h  |  109 +++++----
 bundled/include/LibreOfficeKit/LibreOfficeKitTypes.h |    5 
 5 files changed, 307 insertions(+), 129 deletions(-)

New commits:
commit 3483a519736a51bf54407db0cb64019460aa801a
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Oct 30 16:57:18 2017 +0530

    Update bundled headers
    
    Change-Id: I292dac1d6c801914960b73e951b6565cc36df1e9

diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.h b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
index fab12da1..cc4752e0 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
@@ -12,10 +12,13 @@
 
 #include <stddef.h>
 
-#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 // the unstable API needs C99's bool
-#include <stdbool.h>
-#include <stdint.h>
+// TODO remove the C99 types from the API before making stable
+#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+# ifndef _WIN32
+#  include <stdbool.h>
+# endif
+# include <stdint.h>
 #endif
 
 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
@@ -60,26 +63,37 @@ struct _LibreOfficeKitClass
     /// @since LibreOffice 5.2
     void (*freeError) (char* pFree);
 
-#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+    /// @since LibreOffice 6.0
     void (*registerCallback) (LibreOfficeKit* pThis,
                               LibreOfficeKitCallback pCallback,
                               void* pData);
 
-    /// @see lok::Office::getFilterTypes().
+    /** @see lok::Office::getFilterTypes().
+        @since LibreOffice 6.0
+     */
     char* (*getFilterTypes) (LibreOfficeKit* pThis);
 
-    /// @see lok::Office::setOptionalFeatures().
+    /** @see lok::Office::setOptionalFeatures().
+        @since LibreOffice 6.0
+     */
     void (*setOptionalFeatures)(LibreOfficeKit* pThis, unsigned long long features);
 
-    /// @see lok::Office::setDocumentPassword().
+    /** @see lok::Office::setDocumentPassword().
+        @since LibreOffice 6.0
+     */
     void (*setDocumentPassword) (LibreOfficeKit* pThis,
             char const* pURL,
             char const* pPassword);
 
-    /// @see lok::Office::getVersionInfo().
+    /** @see lok::Office::getVersionInfo().
+        @since LibreOffice 6.0
+     */
     char* (*getVersionInfo) (LibreOfficeKit* pThis);
-#endif
 
+    /** @see lok::Office::runMacro().
+        @since LibreOffice 6.0
+     */
+    int (*runMacro) (LibreOfficeKit *pThis, const char* pURL);
 };
 
 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
@@ -100,10 +114,12 @@ struct _LibreOfficeKitDocumentClass
                    const char* pFormat,
                    const char* pFilterOptions);
 
-#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
-    /// @see lok::Document::getDocumentType().
+    /** @see lok::Document::getDocumentType().
+        @since LibreOffice 6.0
+     */
     int (*getDocumentType) (LibreOfficeKitDocument* pThis);
 
+#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
     /// @see lok::Document::getParts().
     int (*getParts) (LibreOfficeKitDocument* pThis);
 
@@ -250,15 +266,39 @@ struct _LibreOfficeKitDocumentClass
                        int* pArray,
                        size_t nSize);
 
-    /// Starts a batch of operations.
-    /// Events are emmitted only after ending the batch.
-    /// @see lok::Document::endBatch();
-    void (*beginBatch) (LibreOfficeKitDocument* pThis);
-
-    /// Ends a batch of operations.
-    /// @see lok::Document::beginBatch();
-    void (*endBatch) (LibreOfficeKitDocument* pThis);
-
+    /// Paints dialog with given dialog id to the buffer
+    /// @see lok::Document::paintDialog().
+    void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* nHeight);
+
+    /// @see lok::Document::paintActiveFloatingWindow().
+    void (*paintActiveFloatingWindow) (LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
+
+    /// @see lok::Document::postDialogKeyEvent().
+    void (*postDialogKeyEvent) (LibreOfficeKitDocument* pThis,
+                                const char* pDialogId,
+                                int nType,
+                                int nCharCode,
+                                int nKeyCode);
+
+    /// @see lok::Document::postDialogMouseEvent().
+    void (*postDialogMouseEvent) (LibreOfficeKitDocument* pThis,
+                                  const char* pDialogId,
+                                  int nType,
+                                  int nX,
+                                  int nY,
+                                  int nCount,
+                                  int nButtons,
+                                  int nModifier);
+
+    /// @see lok::Document::postDialogChildMouseEvent().
+    void (*postDialogChildMouseEvent) (LibreOfficeKitDocument* pThis,
+                                       const char* pDialogId,
+                                       int nType,
+                                       int nX,
+                                       int nY,
+                                       int nCount,
+                                       int nButtons,
+                                       int nModifier);
 
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
index 46ecb5f4..9534bf3d 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -32,11 +32,11 @@ private:
 
 public:
     /// A lok::Document is typically created by the lok::Office::documentLoad() method.
-    inline Document(LibreOfficeKitDocument* pDoc) :
+    Document(LibreOfficeKitDocument* pDoc) :
         mpDoc(pDoc)
     {}
 
-    inline ~Document()
+    ~Document()
     {
         mpDoc->pClass->destroy(mpDoc);
     }
@@ -54,32 +54,33 @@ public:
      *        is triggered as with the "Save As..." in the UI.
      *        "TakeOwnership" mode must not be used when saving to PNG or PDF.
      */
-    inline bool saveAs(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL)
+    bool saveAs(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL)
     {
         return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat, pFilterOptions) != 0;
     }
 
     /// Gives access to the underlying C pointer.
-    inline LibreOfficeKitDocument *get() { return mpDoc; }
+    LibreOfficeKitDocument *get() { return mpDoc; }
 
-#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
     /**
      * Get document type.
      *
+     * @since LibreOffice 6.0
      * @return an element of the LibreOfficeKitDocumentType enum.
      */
-    inline int getDocumentType()
+    int getDocumentType()
     {
         return mpDoc->pClass->getDocumentType(mpDoc);
     }
 
+#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
     /**
      * Get number of part that the document contains.
      *
      * Part refers to either individual sheets in a Calc, or slides in Impress,
      * and has no relevance for Writer.
      */
-    inline int getParts()
+    int getParts()
     {
         return mpDoc->pClass->getParts(mpDoc);
     }
@@ -93,36 +94,36 @@ public:
      * @return a rectangle list, using the same format as
      * LOK_CALLBACK_TEXT_SELECTION.
      */
-    inline char* getPartPageRectangles()
+    char* getPartPageRectangles()
     {
         return mpDoc->pClass->getPartPageRectangles(mpDoc);
     }
 
     /// Get the current part of the document.
-    inline int getPart()
+    int getPart()
     {
         return mpDoc->pClass->getPart(mpDoc);
     }
 
     /// Set the current part of the document.
-    inline void setPart(int nPart)
+    void setPart(int nPart)
     {
         mpDoc->pClass->setPart(mpDoc, nPart);
     }
 
     /// Get the current part's name.
-    inline char* getPartName(int nPart)
+    char* getPartName(int nPart)
     {
         return mpDoc->pClass->getPartName(mpDoc, nPart);
     }
 
     /// Get the current part's hash.
-    inline char* getPartHash(int nPart)
+    char* getPartHash(int nPart)
     {
         return mpDoc->pClass->getPartHash(mpDoc, nPart);
     }
 
-    inline void setPartMode(int nMode)
+    void setPartMode(int nMode)
     {
         mpDoc->pClass->setPartMode(mpDoc, nMode);
     }
@@ -142,7 +143,7 @@ public:
      * @param nTileWidth logical width of the rendered rectangle, in TWIPs.
      * @param nTileHeight logical height of the rendered rectangle, in TWIPs.
      */
-    inline void paintTile(unsigned char* pBuffer,
+    void paintTile(unsigned char* pBuffer,
                           const int nCanvasWidth,
                           const int nCanvasHeight,
                           const int nTilePosX,
@@ -155,17 +156,58 @@ public:
     }
 
     /**
+     * Renders a dialog with give dialog id and writes the width and height of the rendered dialog
+     *
+     * Client must truncate pBuffer according to the nWidth and nHeight returned after the call.
+     *
+     * @param pDialogId Unique dialog id to be painted
+     * @param pBuffer Buffer with enough memory allocated to render any dialog
+     * @param pDialogTitle output parameter pointing to a dialog title
+     * string. Should be freed by the caller.
+     * @param nWidth output parameter returning the width of the rendered dialog.
+     * @param nHeight output parameter returning the height of the rendered dialog
+     */
+    void paintDialog(const char* pDialogId,
+                     unsigned char* pBuffer,
+                     char** pDialogTitle,
+                     int& nWidth,
+                     int& nHeight)
+    {
+        return mpDoc->pClass->paintDialog(mpDoc, pDialogId, pBuffer,
+                                          pDialogTitle, &nWidth, &nHeight);
+    }
+
+    /**
+     * Renders the active floating window of a dialog
+     *
+     * Client must truncate pBuffer according to the nWidth and nHeight returned after the call.
+     *
+     * @param pDialogId Unique dialog id
+     * @param pBuffer Buffer with enough memory allocated to render any dialog
+     * @param nWidth output parameter returning the width of the rendered dialog.
+     * @param nHeight output parameter returning the height of the rendered dialog
+     */
+    void paintActiveFloatingWindow(const char* pDialogId,
+                                   unsigned char* pBuffer,
+                                   int& nWidth,
+                                   int& nHeight)
+    {
+        return mpDoc->pClass->paintActiveFloatingWindow(mpDoc, pDialogId, pBuffer,
+                                                        &nWidth, &nHeight);
+    }
+
+    /**
      * Gets the tile mode: the pixel format used for the pBuffer of paintTile().
      *
      * @return an element of the LibreOfficeKitTileMode enum.
      */
-    inline int getTileMode()
+    int getTileMode()
     {
         return mpDoc->pClass->getTileMode(mpDoc);
     }
 
     /// Get the document sizes in TWIPs.
-    inline void getDocumentSize(long* pWidth, long* pHeight)
+    void getDocumentSize(long* pWidth, long* pHeight)
     {
         mpDoc->pClass->getDocumentSize(mpDoc, pWidth, pHeight);
     }
@@ -190,7 +232,7 @@ public:
      *
      * @param pArguments arguments of the rendering
      */
-    inline void initializeForRendering(const char* pArguments = NULL)
+    void initializeForRendering(const char* pArguments = NULL)
     {
         mpDoc->pClass->initializeForRendering(mpDoc, pArguments);
     }
@@ -202,7 +244,7 @@ public:
      * @param pCallback the callback to invoke
      * @param pData the user data, will be passed to the callback on invocation
      */
-    inline void registerCallback(LibreOfficeKitCallback pCallback, void* pData)
+    void registerCallback(LibreOfficeKitCallback pCallback, void* pData)
     {
         mpDoc->pClass->registerCallback(mpDoc, pCallback, pData);
     }
@@ -214,12 +256,25 @@ public:
      * @param nCharCode contains the Unicode character generated by this event or 0
      * @param nKeyCode contains the integer code representing the key of the event (non-zero for control keys)
      */
-    inline void postKeyEvent(int nType, int nCharCode, int nKeyCode)
+    void postKeyEvent(int nType, int nCharCode, int nKeyCode)
     {
         mpDoc->pClass->postKeyEvent(mpDoc, nType, nCharCode, nKeyCode);
     }
 
     /**
+     * Posts a keyboard event to the dialog
+     *
+     * @param pDialogId Dialog id on which key event should be posted
+     * @param nType Event type, like press or release.
+     * @param nCharCode contains the Unicode character generated by this event or 0
+     * @param nKeyCode contains the integer code representing the key of the event (non-zero for control keys)
+     */
+    void postDialogKeyEvent(const char* pDialogId, int nType, int nCharCode, int nKeyCode)
+    {
+        mpDoc->pClass->postDialogKeyEvent(mpDoc, pDialogId, nType, nCharCode, nKeyCode);
+    }
+
+    /**
      * Posts a mouse event to the document.
      *
      * @param nType Event type, like down, move or up.
@@ -227,14 +282,47 @@ public:
      * @param nY vertical position in document coordinates
      * @param nCount number of clicks: 1 for single click, 2 for double click
      * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
-     * @param nModifier: which keyboard modifier: (see include/rsc/rsc-vcl-shared-types.hxx for possible values)
+     * @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
      */
-    inline void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+    void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
     {
         mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount, nButtons, nModifier);
     }
 
     /**
+     * Posts a mouse event to the dialog with given id.
+     *
+     * @param pDialogId Dialog id where mouse event is to be posted
+     * @param nType Event type, like down, move or up.
+     * @param nX horizontal position in document coordinates
+     * @param nY vertical position in document coordinates
+     * @param nCount number of clicks: 1 for single click, 2 for double click
+     * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
+     * @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
+     */
+    void postDialogMouseEvent(const char* pDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+    {
+        mpDoc->pClass->postDialogMouseEvent(mpDoc, pDialogId, nType, nX, nY, nCount, nButtons, nModifier);
+    }
+
+    /**
+     * Posts a mouse event to the child of a dialog with given id.
+     *
+     * @param aDialogId Dialog id
+     * @param nType Event type, like down, move or up.
+     * @param nX horizontal position in document coordinates
+     * @param nY vertical position in document coordinates
+     * @param nCount number of clicks: 1 for single click, 2 for double click
+     * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
+     * @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
+     */
+    void postDialogChildMouseEvent(const char* pDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+    {
+        mpDoc->pClass->postDialogChildMouseEvent(mpDoc, pDialogId, nType, nX, nY, nCount, nButtons, nModifier);
+    }
+
+
+    /**
      * Posts an UNO command to the document.
      *
      * Example argument string:
@@ -255,7 +343,7 @@ public:
      * @param pCommand uno command to be posted to the document, like ".uno:Bold"
      * @param pArguments arguments of the uno command.
      */
-    inline void postUnoCommand(const char* pCommand, const char* pArguments = NULL, bool bNotifyWhenFinished = false)
+    void postUnoCommand(const char* pCommand, const char* pArguments = NULL, bool bNotifyWhenFinished = false)
     {
         mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished);
     }
@@ -267,7 +355,7 @@ public:
      * @param nX horizontal position in document coordinates
      * @param nY vertical position in document coordinates
      */
-    inline void setTextSelection(int nType, int nX, int nY)
+    void setTextSelection(int nType, int nX, int nY)
     {
         mpDoc->pClass->setTextSelection(mpDoc, nType, nX, nY);
     }
@@ -278,7 +366,7 @@ public:
      * @param pMimeType suggests the return format, for example text/plain;charset=utf-8.
      * @param pUsedMimeType output parameter to inform about the determined format (suggested one or plain text).
      */
-    inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType = NULL)
+    char* getTextSelection(const char* pMimeType, char** pUsedMimeType = NULL)
     {
         return mpDoc->pClass->getTextSelection(mpDoc, pMimeType, pUsedMimeType);
     }
@@ -290,7 +378,7 @@ public:
      * @param pData the actual data to be pasted.
      * @return if the supplied data was pasted successfully.
      */
-    inline bool paste(const char* pMimeType, const char* pData, size_t nSize)
+    bool paste(const char* pMimeType, const char* pData, size_t nSize)
     {
         return mpDoc->pClass->paste(mpDoc, pMimeType, pData, nSize);
     }
@@ -302,7 +390,7 @@ public:
      * @param nX horizontal position in document coordinates
      * @param nY vertical position in document coordinates
      */
-    inline void setGraphicSelection(int nType, int nX, int nY)
+    void setGraphicSelection(int nType, int nX, int nY)
     {
         mpDoc->pClass->setGraphicSelection(mpDoc, nType, nX, nY);
     }
@@ -310,7 +398,7 @@ public:
     /**
      * Gets rid of any text or graphic selection.
      */
-    inline void resetSelection()
+    void resetSelection()
     {
         mpDoc->pClass->resetSelection(mpDoc);
     }
@@ -321,7 +409,7 @@ public:
      * @param pCommand a uno command for which the possible values are requested
      * @return {commandName: unoCmd, commandValues: {possible_values}}
      */
-    inline char* getCommandValues(const char* pCommand)
+    char* getCommandValues(const char* pCommand)
     {
         return mpDoc->pClass->getCommandValues(mpDoc, pCommand);
     }
@@ -334,7 +422,7 @@ public:
      * @param nTileTwipWidth - tile width in twips
      * @param nTileTwipHeight - tile height in twips
      */
-    inline void setClientZoom(
+    void setClientZoom(
             int nTilePixelWidth,
             int nTilePixelHeight,
             int nTileTwipWidth,
@@ -353,7 +441,7 @@ public:
      * @param nWidth - area width
      * @param nHeight - area height
      */
-    inline void setClientVisibleArea(int nX, int nY, int nWidth, int nHeight)
+    void setClientVisibleArea(int nX, int nY, int nWidth, int nHeight)
     {
         mpDoc->pClass->setClientVisibleArea(mpDoc, nX, nY, nWidth, nHeight);
     }
@@ -398,7 +486,7 @@ public:
     /**
      * Get number of views of this document.
      */
-    inline int getViewsCount()
+    int getViewsCount()
     {
         return mpDoc->pClass->getViewsCount(mpDoc);
     }
@@ -407,7 +495,7 @@ public:
      * Paints a font name or character if provided to be displayed in the font list
      * @param pFontName the font to be painted
      */
-    inline unsigned char* renderFont(const char *pFontName,
+    unsigned char* renderFont(const char *pFontName,
                           const char *pChar,
                           int *pFontWidth,
                           int *pFontHeight)
@@ -421,7 +509,7 @@ public:
      * @param nPart the part number of the document of which the tile is painted.
      * @see paintTile.
      */
-    inline void paintPartTile(unsigned char* pBuffer,
+    void paintPartTile(unsigned char* pBuffer,
                               const int nPart,
                               const int nCanvasWidth,
                               const int nCanvasHeight,
@@ -446,22 +534,12 @@ public:
      * @returns true if pArray was large enough and result is written, false
      * otherwise.
      */
-    inline bool getViewIds(int* pArray,
+    bool getViewIds(int* pArray,
                            size_t nSize)
     {
         return mpDoc->pClass->getViewIds(mpDoc, pArray, nSize);
     }
 
-    inline void beginBatch()
-    {
-        mpDoc->pClass->beginBatch(mpDoc);
-    }
-
-    inline void endBatch()
-    {
-        mpDoc->pClass->endBatch(mpDoc);
-    }
-
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
@@ -473,11 +551,11 @@ private:
 
 public:
     /// A lok::Office is typically created by the lok_cpp_init() function.
-    inline Office(LibreOfficeKit* pThis) :
+    Office(LibreOfficeKit* pThis) :
         mpThis(pThis)
     {}
 
-    inline ~Office()
+    ~Office()
     {
         mpThis->pClass->destroy(mpThis);
     }
@@ -487,9 +565,12 @@ public:
      *
      * @param pUrl the URL of the document to load
      * @param pFilterOptions options for the import filter, e.g. SkipImages.
+     *        Another useful FilterOption is "Language=...".  It is consumed
+     *        by the documentLoad() itself, and when provided, LibreOfficeKit
+     *        switches the language accordingly first.
      * @since pFilterOptions argument added in LibreOffice 5.0
      */
-    inline Document* documentLoad(const char* pUrl, const char* pFilterOptions = NULL)
+    Document* documentLoad(const char* pUrl, const char* pFilterOptions = NULL)
     {
         LibreOfficeKitDocument* pDoc = NULL;
 
@@ -505,7 +586,7 @@ public:
     }
 
     /// Returns the last error as a string, the returned pointer has to be freed by the caller.
-    inline char* getError()
+    char* getError()
     {
         return mpThis->pClass->getError(mpThis);
     }
@@ -515,20 +596,20 @@ public:
      *
      * @since LibreOffice 5.2
      */
-    inline void freeError(char* pFree)
+    void freeError(char* pFree)
     {
         mpThis->pClass->freeError(pFree);
     }
 
-#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
     /**
      * Registers a callback. LOK will invoke this function when it wants to
      * inform the client about events.
      *
+     * @since LibreOffice 6.0
      * @param pCallback the callback to invoke
      * @param pData the user data, will be passed to the callback on invocation
      */
-    inline void registerCallback(LibreOfficeKitCallback pCallback, void* pData)
+    void registerCallback(LibreOfficeKitCallback pCallback, void* pData)
     {
         mpThis->pClass->registerCallback(mpThis, pCallback, pData);
     }
@@ -546,8 +627,10 @@ public:
      *         "MediaType": "application/vnd.oasis.opendocument.spreadsheet"
      *     }
      * }
+     *
+     * @since LibreOffice 6.0
      */
-    inline char* getFilterTypes()
+    char* getFilterTypes()
     {
         return mpThis->pClass->getFilterTypes(mpThis);
     }
@@ -555,9 +638,10 @@ public:
     /**
      * Set bitmask of optional features supported by the client.
      *
+     * @since LibreOffice 6.0
      * @see LibreOfficeKitOptionalFeatures
      */
-    void setOptionalFeatures(uint64_t features)
+    void setOptionalFeatures(unsigned long long features)
     {
         return mpThis->pClass->setOptionalFeatures(mpThis, features);
     }
@@ -570,18 +654,20 @@ public:
      * @param pURL      the URL of the document, as sent to the callback
      * @param pPassword the password, nullptr indicates no password
      *
-     * In response to LOK_CALLBACK_DOCUMENT_PASSWORD, a vaild password
+     * In response to LOK_CALLBACK_DOCUMENT_PASSWORD, a valid password
      * will continue loading the document, an invalid password will
      * result in another LOK_CALLBACK_DOCUMENT_PASSWORD request,
      * and a NULL password will abort loading the document.
      *
-     * In response to LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY, a vaild
+     * In response to LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY, a valid
      * password will continue loading the document, an invalid password will
      * result in another LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY request,
      * and a NULL password will continue loading the document in read-only
      * mode.
+     *
+     * @since LibreOffice 6.0
      */
-    inline void setDocumentPassword(char const* pURL, char const* pPassword)
+    void setDocumentPassword(char const* pURL, char const* pPassword)
     {
         mpThis->pClass->setDocumentPassword(mpThis, pURL, pPassword);
     }
@@ -589,6 +675,7 @@ public:
     /**
      * Get version information of the LOKit process
      *
+     * @since LibreOffice 6.0
      * @returns JSON string containing version information in format:
      * {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
      *
@@ -597,11 +684,24 @@ public:
      * "ProductExtension": ".0.0.alpha0",
      * "BuildId": "<full 40 char git hash>"}
      */
-    inline char* getVersionInfo()
+    char* getVersionInfo()
     {
         return mpThis->pClass->getVersionInfo(mpThis);
     }
-#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+
+    /**
+     * Run a macro.
+     *
+     * Same syntax as on command line is permissible (ie. the macro:// URI forms)
+     *
+     * @since LibreOffice 6.0
+     * @param pURL macro url to run
+     */
+
+    bool runMacro( const char* pURL)
+    {
+        return mpThis->pClass->runMacro( mpThis, pURL );
+    }
 };
 
 /// Factory method to create a lok::Office instance.
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 477b6f4d..62b9faf7 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -501,12 +501,10 @@ typedef enum
      * The payload says if we are invalidating a row or column header.
      */
     LOK_CALLBACK_INVALIDATE_HEADER = 33,
-
     /**
      * The text content of the address field in Calc.
      */
     LOK_CALLBACK_CELL_ADDRESS = 34,
-
     /**
      * The key ruler related properties on change are reported by this.
      *
@@ -523,8 +521,30 @@ typedef enum
      *
      * Here all aproperties are same as described in svxruler.
      */
-    LOK_CALLBACK_RULER_UPDATE = 35
+    LOK_CALLBACK_RULER_UPDATE = 35,
+    /**
+     * Dialog invalidation
+     */
+    LOK_CALLBACK_DIALOG = 36,
 
+    /**
+     * Invalidation corresponding to dialog's children.
+     * Eg: Floating window etc.
+     *
+     * Payload example:
+     * {
+     *   "dialogID": "SpellDialog",
+     *   "action": "close"
+     * }
+     *
+     * - dialogID is the UNO command of the dialog
+     * - action can be
+     *   - close, means dialog child window is closed now
+     *   - invalidate, means dialog child window is invalidated
+     *     It also means that dialog child window is created if it's the first
+     *     invalidate
+     */
+    LOK_CALLBACK_DIALOG_CHILD = 37
 }
 LibreOfficeKitCallbackType;
 
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h b/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
index 322ba8be..73e2bbb8 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -42,7 +42,8 @@ extern "C"
     #endif
     #define SEPARATOR         '/'
 
-    inline void *lok_loadlib(const char *pFN)
+#if !defined(TARGET_OS_IPHONE)
+        static void *lok_loadlib(const char *pFN)
     {
         return dlopen(pFN, RTLD_LAZY
 #if defined LOK_LOADLIB_GLOBAL
@@ -51,103 +52,115 @@ extern "C"
                       );
     }
 
-#ifndef __OBJC__
-    inline
-#endif
-    char *lok_dlerror(void)
+    static char *lok_dlerror(void)
     {
         return dlerror();
     }
 
-#ifndef __OBJC__
-    inline
-#endif
-    void *lok_dlsym(void *Hnd, const char *pName)
+    // This function must be called to release memory allocated by lok_dlerror()
+    static void lok_dlerror_free(char *pErrMessage)
     {
-        return dlsym(Hnd, pName);
+        (void)pErrMessage;
+        // Do nothing for return of dlerror()
     }
 
-#ifndef __OBJC__
-    inline
-#endif
-    int lok_dlclose(void *Hnd)
+    static void extendUnoPath(const char *pPath)
     {
-        return dlclose(Hnd);
+        (void)pPath;
     }
+#endif // TARGET_OS_IPHONE
 
-#ifndef __OBJC__
-    inline
-#endif
-    void extendUnoPath(const char *pPath)
+    static void *lok_dlsym(void *Hnd, const char *pName)
     {
-        (void)pPath;
+        return dlsym(Hnd, pName);
+    }
+
+    static int lok_dlclose(void *Hnd)
+    {
+        return dlclose(Hnd);
     }
 
-#else
 
+#else
+    #pragma warning(disable:4996)
+    #if !defined WIN32_LEAN_AND_MEAN
+        #define WIN32_LEAN_AND_MEAN
+    #endif
     #include  <windows.h>
     #define TARGET_LIB        "sofficeapp" ".dll"
     #define TARGET_MERGED_LIB "mergedlo" ".dll"
     #define SEPARATOR         '\\'
     #define UNOPATH           "\\..\\URE\\bin"
 
-    void *lok_loadlib(const char *pFN)
+    static void *lok_loadlib(const char *pFN)
     {
         return (void *) LoadLibraryA(pFN);
     }
 
-    char *lok_dlerror(void)
+    static char *lok_dlerror(void)
     {
         LPSTR buf = NULL;
         FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, reinterpret_cast<LPSTR>(&buf), 0, NULL);
         return buf;
     }
 
-    void *lok_dlsym(void *Hnd, const char *pName)
+    // This function must be called to release memory allocated by lok_dlerror()
+    static void lok_dlerror_free(char *pErrMessage)
+    {
+        HeapFree(GetProcessHeap(), 0, pErrMessage);
+    }
+
+    static void *lok_dlsym(void *Hnd, const char *pName)
     {
         return reinterpret_cast<void *>(GetProcAddress((HINSTANCE) Hnd, pName));
     }
 
-    int lok_dlclose(void *Hnd)
+    static int lok_dlclose(void *Hnd)
     {
         return FreeLibrary((HINSTANCE) Hnd);
     }
 
-    void extendUnoPath(const char *pPath)
+    static void extendUnoPath(const char *pPath)
     {
+        char *sNewPath = NULL, *sEnvPath = NULL;
+        size_t size_sEnvPath = 0, buffer_size = 0;
+        DWORD cChars;
+
         if (!pPath)
             return;
 
-        char* sEnvPath = NULL;
-        DWORD  cChars = GetEnvironmentVariableA("PATH", sEnvPath, 0);
+        cChars = GetEnvironmentVariableA("PATH", sEnvPath, 0);
         if (cChars > 0)
         {
-            sEnvPath = new char[cChars];
+            sEnvPath = (char *) malloc(cChars);
             cChars = GetEnvironmentVariableA("PATH", sEnvPath, cChars);
             //If PATH is not set then it is no error
             if (cChars == 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND)
             {
-                delete[] sEnvPath;
+                free(sEnvPath);
                 return;
             }
         }
         //prepare the new PATH. Add the Ure/bin directory at the front.
         //note also adding ';'
-        char * sNewPath = new char[strlen(sEnvPath) + strlen(pPath) * 2 + strlen(UNOPATH) + 4];
+        if(sEnvPath)
+            size_sEnvPath = strlen(sEnvPath);
+        buffer_size = size_sEnvPath + 2*strlen(pPath) + strlen(UNOPATH) + 4;
+        sNewPath = (char *) malloc(buffer_size);
         sNewPath[0] = L'\0';
-        strcat(sNewPath, pPath);     // program to PATH
-        strcat(sNewPath, ";");
-        strcat(sNewPath, UNOPATH);   // UNO to PATH
-        if (strlen(sEnvPath))
+        strcat_s(sNewPath, buffer_size, pPath);     // program to PATH
+        strcat_s(sNewPath, buffer_size, ";");
+        strcat_s(sNewPath, buffer_size, UNOPATH);   // UNO to PATH
+        if (size_sEnvPath > 0)
         {
-            strcat(sNewPath, ";");
-            strcat(sNewPath, sEnvPath);
+            strcat_s(sNewPath, buffer_size, ";");
+            strcat_s(sNewPath, buffer_size, sEnvPath);
         }
 
         SetEnvironmentVariableA("PATH", sNewPath);
 
-        delete[] sEnvPath;
-        delete[] sNewPath;
+        free(sNewPath);
+        free(sEnvPath);
     }
 #endif
 
@@ -156,15 +169,15 @@ static void *lok_dlopen( const char *install_path, char ** _imp_lib )
     char *imp_lib;
     void *dlhandle;
 
-    *_imp_lib = NULL;
+#if !defined(TARGET_OS_IPHONE)
+    size_t partial_length, imp_lib_size;
+    struct stat dir_st;
 
-#if !(defined(__APPLE__) && (defined(__arm__) || defined(__arm64__)))
-    size_t partial_length;
+    *_imp_lib = NULL;
 
     if (!install_path)
         return NULL;
 
-    struct stat dir_st;
     if (stat(install_path, &dir_st) != 0)
     {
         fprintf(stderr, "installation path \"%s\" does not exist\n", install_path);
@@ -173,7 +186,7 @@ static void *lok_dlopen( const char *install_path, char ** _imp_lib )
 
     // allocate large enough buffer
     partial_length = strlen(install_path);
-    size_t imp_lib_size = partial_length + sizeof(TARGET_LIB) + sizeof(TARGET_MERGED_LIB) + 2;
+    imp_lib_size = partial_length + sizeof(TARGET_LIB) + sizeof(TARGET_MERGED_LIB) + 2;
     imp_lib = (char *) malloc(imp_lib_size);
     if (!imp_lib)
     {
@@ -198,8 +211,10 @@ static void *lok_dlopen( const char *install_path, char ** _imp_lib )
         struct stat st;
         if (stat(imp_lib, &st) == 0 && st.st_size > 100)
         {
+            char *pErrMessage = lok_dlerror();
             fprintf(stderr, "failed to open library '%s': %s\n",
-                    imp_lib, lok_dlerror());
+                    imp_lib, pErrMessage);
+            lok_dlerror_free(pErrMessage);
             free(imp_lib);
             return NULL;
         }
@@ -209,8 +224,10 @@ static void *lok_dlopen( const char *install_path, char ** _imp_lib )
         dlhandle = lok_loadlib(imp_lib);
         if (!dlhandle)
         {
+            char *pErrMessage = lok_dlerror();
             fprintf(stderr, "failed to open library '%s': %s\n",
-                    imp_lib, lok_dlerror());
+                    imp_lib, pErrMessage);
+            lok_dlerror_free(pErrMessage);
             free(imp_lib);
             return NULL;
         }
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitTypes.h b/bundled/include/LibreOfficeKit/LibreOfficeKitTypes.h
index 33839445..2e9078ff 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitTypes.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitTypes.h
@@ -17,9 +17,10 @@ extern "C"
 {
 #endif
 
-#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+/** @see lok::Office::registerCallback().
+    @since LibreOffice 6.0
+ */
 typedef void (*LibreOfficeKitCallback)(int nType, const char* pPayload, void* pData);
-#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 
 #ifdef __cplusplus
 }


More information about the Libreoffice-commits mailing list