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 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
22 typedef struct _LibreOfficeKit LibreOfficeKit
;
23 typedef struct _LibreOfficeKitClass LibreOfficeKitClass
;
25 typedef struct _LibreOfficeKitDocument LibreOfficeKitDocument
;
26 typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass
;
28 // Do we have an extended member in this struct ?
29 #define LIBREOFFICEKIT_HAS_MEMBER(strct,member,nSize) \
30 (offsetof(strct, member) < (nSize))
32 #define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize)
34 struct _LibreOfficeKit
36 LibreOfficeKitClass
* pClass
;
39 struct _LibreOfficeKitClass
43 void (*destroy
) (LibreOfficeKit
* pThis
);
45 LibreOfficeKitDocument
* (*documentLoad
) (LibreOfficeKit
* pThis
,
48 char* (*getError
) (LibreOfficeKit
* pThis
);
50 LibreOfficeKitDocument
* (*documentLoadWithOptions
) (LibreOfficeKit
* pThis
,
52 const char* pOptions
);
53 #ifdef LOK_USE_UNSTABLE_API
54 void (*registerCallback
) (LibreOfficeKit
* pThis
,
55 LibreOfficeKitCallback pCallback
,
60 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
62 struct _LibreOfficeKitDocument
64 LibreOfficeKitDocumentClass
* pClass
;
67 struct _LibreOfficeKitDocumentClass
71 void (*destroy
) (LibreOfficeKitDocument
* pThis
);
73 int (*saveAs
) (LibreOfficeKitDocument
* pThis
,
76 const char* pFilterOptions
);
78 #ifdef LOK_USE_UNSTABLE_API
79 /// @see lok::Document::getDocumentType().
80 int (*getDocumentType
) (LibreOfficeKitDocument
* pThis
);
82 /// @see lok::Document::getParts().
83 int (*getParts
) (LibreOfficeKitDocument
* pThis
);
85 /// @see lok::Document::getPart().
86 int (*getPart
) (LibreOfficeKitDocument
* pThis
);
88 /// @see lok::Document::setPart().
89 void (*setPart
) (LibreOfficeKitDocument
* pThis
,
92 /// @see lok::Document::getPartName().
93 char* (*getPartName
) (LibreOfficeKitDocument
* pThis
,
96 /** Sets mode of the current part.
98 * @param nMode - element from the LibreOfficeKitPartMode enum.
100 void (*setPartMode
) (LibreOfficeKitDocument
* pThis
,
103 /// @see lok::Document::paintTile().
104 void (*paintTile
) (LibreOfficeKitDocument
* pThis
,
105 unsigned char* pBuffer
,
106 const int nCanvasWidth
,
107 const int nCanvasHeight
,
110 const int nTileWidth
,
111 const int nTileHeight
);
113 /// @see lok::Document::getDocumentSize().
114 void (*getDocumentSize
) (LibreOfficeKitDocument
* pThis
,
118 /// @see lok::Document::initializeForRendering().
119 void (*initializeForRendering
) (LibreOfficeKitDocument
* pThis
);
121 void (*registerCallback
) (LibreOfficeKitDocument
* pThis
,
122 LibreOfficeKitCallback pCallback
,
125 /// @see lok::Document::postKeyEvent
126 void (*postKeyEvent
) (LibreOfficeKitDocument
* pThis
,
131 /// @see lok::Document::postMouseEvent
132 void (*postMouseEvent
) (LibreOfficeKitDocument
* pThis
,
138 /// @see lok::Document::postUnoCommand
139 void (*postUnoCommand
) (LibreOfficeKitDocument
* pThis
,
140 const char* pCommand
,
141 const char* pArguments
);
143 /// @see lok::Document::setTextSelection
144 void (*setTextSelection
) (LibreOfficeKitDocument
* pThis
,
149 /// @see lok::Document::getTextSelection
150 char* (*getTextSelection
) (LibreOfficeKitDocument
* pThis
,
151 const char* pMimeType
,
152 char** pUsedMimeType
);
154 /// @see lok::Document::setGraphicSelection
155 void (*setGraphicSelection
) (LibreOfficeKitDocument
* pThis
,
160 /// @see lok::Document::resetSelection
161 void (*resetSelection
) (LibreOfficeKitDocument
* pThis
);
162 #endif // LOK_USE_UNSTABLE_API
169 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */