lokit: make parts of unstable API public for 6.0

[API CHANGE] publish all of LibreOfficeKitClass, and the
getDocumentType callback for the LibreOfficeKitDocumentClass

Change-Id: I4d6529a71b29a0014053b797c67255df53a6ccde
Reviewed-on: https://gerrit.libreoffice.org/42243
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index a4035c7..34b67ac 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -12,13 +12,11 @@

#include <stddef.h>

#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
# ifndef _WIN32
#ifndef _WIN32
// the unstable API needs C99's bool
#  include <stdbool.h>
# endif
# include <stdint.h>
# include <stdbool.h>
#endif
#include <stdint.h>

#include <LibreOfficeKit/LibreOfficeKitTypes.h>

@@ -62,28 +60,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, uint64_t 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);

    /** @see lok::Office::runMacro().
        @since LibreOffice 6.0
     */
    bool (*runMacro) (LibreOfficeKit *pThis, const char* pURL);
#endif

};

#define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
@@ -104,10 +111,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);

diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 46a32a4..18122a7 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -62,10 +62,10 @@ public:
    /// Gives access to the underlying C pointer.
    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.
     */
    int getDocumentType()
@@ -73,6 +73,7 @@ public:
        return mpDoc->pClass->getDocumentType(mpDoc);
    }

#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
    /**
     * Get number of part that the document contains.
     *
@@ -513,11 +514,11 @@ public:
        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
     */
@@ -539,6 +540,8 @@ public:
     *         "MediaType": "application/vnd.oasis.opendocument.spreadsheet"
     *     }
     * }
     *
     * @since LibreOffice 6.0
     */
    char* getFilterTypes()
    {
@@ -548,6 +551,7 @@ public:
    /**
     * Set bitmask of optional features supported by the client.
     *
     * @since LibreOffice 6.0
     * @see LibreOfficeKitOptionalFeatures
     */
    void setOptionalFeatures(uint64_t features)
@@ -573,6 +577,8 @@ public:
     * 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
     */
    void setDocumentPassword(char const* pURL, char const* pPassword)
    {
@@ -582,6 +588,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: <>}
     *
@@ -600,6 +607,7 @@ public:
     *
     * Same syntax as on command line is permissible (ie. the macro:// URI forms)
     *
     * @since LibreOffice 6.0
     * @param pURL macro url to run
     */

@@ -607,7 +615,6 @@ public:
    {
        return mpThis->pClass->runMacro( mpThis, pURL );
    }
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};

/// Factory method to create a lok::Office instance.
diff --git a/include/LibreOfficeKit/LibreOfficeKitTypes.h b/include/LibreOfficeKit/LibreOfficeKitTypes.h
index 3383944..2e9078f 100644
--- a/include/LibreOfficeKit/LibreOfficeKitTypes.h
+++ b/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
}