Line data Source code
1 : /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #ifndef INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_H
11 : #define INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_H
12 :
13 : #include <stddef.h>
14 :
15 : #ifdef __cplusplus
16 : extern "C"
17 : {
18 : #endif
19 :
20 : typedef struct _LibreOfficeKit LibreOfficeKit;
21 : typedef struct _LibreOfficeKitClass LibreOfficeKitClass;
22 :
23 : typedef struct _LibreOfficeKitDocument LibreOfficeKitDocument;
24 : typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass;
25 :
26 : // Do we have an extended member in this struct ?
27 : #define LIBREOFFICEKIT_HAS_MEMBER(strct,member,nSize) \
28 : ((((size_t)((unsigned char *)&((strct *) 0)->member) + \
29 : sizeof ((strct *) 0)->member)) <= (nSize))
30 :
31 : #define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize)
32 :
33 : #ifdef LOK_USE_UNSTABLE_API
34 : typedef enum
35 : {
36 : LOK_DOCTYPE_TEXT,
37 : LOK_DOCTYPE_SPREADSHEET,
38 : LOK_DOCTYPE_PRESENTATION,
39 : LOK_DOCTYPE_DRAWING,
40 : LOK_DOCTYPE_OTHER
41 : }
42 : LibreOfficeKitDocumentType;
43 :
44 : typedef enum
45 : {
46 : LOK_PARTMODE_DEFAULT,
47 : LOK_PARTMODE_SLIDE,
48 : LOK_PARTMODE_NOTES,
49 : LOK_PARTMODE_SLIDENOTES,
50 : LOK_PARTMODE_EMBEDDEDOBJ
51 : }
52 : LibreOfficeKitPartMode;
53 : #endif // LOK_USE_UNSTABLE_API
54 :
55 0 : struct _LibreOfficeKit
56 : {
57 : LibreOfficeKitClass* pClass;
58 : };
59 :
60 : struct _LibreOfficeKitClass
61 : {
62 : size_t nSize;
63 :
64 : void (*destroy) (LibreOfficeKit *pThis);
65 : LibreOfficeKitDocument* (*documentLoad) (LibreOfficeKit *pThis, const char *pURL);
66 : char* (*getError) (LibreOfficeKit *pThis);
67 : };
68 :
69 : #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
70 :
71 0 : struct _LibreOfficeKitDocument
72 : {
73 : LibreOfficeKitDocumentClass* pClass;
74 : };
75 :
76 : struct _LibreOfficeKitDocumentClass
77 : {
78 : size_t nSize;
79 :
80 : void (*destroy) (LibreOfficeKitDocument* pThis);
81 : int (*saveAs) (LibreOfficeKitDocument* pThis,
82 : const char *pUrl,
83 : const char *pFormat,
84 : const char *pFilterOptions);
85 : #ifdef LOK_USE_UNSTABLE_API
86 : LibreOfficeKitDocumentType (*getDocumentType) (LibreOfficeKitDocument* pThis);
87 :
88 : // Part refers to either indivual sheets in a Spreadsheet, or slides
89 : // in a Slideshow, and has no relevance for writer documents.
90 : int (*getParts) (LibreOfficeKitDocument* pThis);
91 :
92 : int (*getPart) (LibreOfficeKitDocument* pThis);
93 : void (*setPart) (LibreOfficeKitDocument* pThis,
94 : int nPart);
95 :
96 : char* (*getPartName) (LibreOfficeKitDocument* pThis,
97 : int nPart);
98 :
99 : void (*setPartMode) (LibreOfficeKitDocument* pThis,
100 : LibreOfficeKitPartMode eMode);
101 :
102 : void (*paintTile) (LibreOfficeKitDocument* pThis,
103 : unsigned char* pBuffer,
104 : const int nCanvasWidth,
105 : const int nCanvasHeight,
106 : int* pRowStride,
107 : const int nTilePosX,
108 : const int nTilePosY,
109 : const int nTileWidth,
110 : const int nTileHeight);
111 :
112 : // Get the document sizes in twips.
113 : void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
114 : long* pWidth,
115 : long* pHeight);
116 : #endif // LOK_USE_UNSTABLE_API
117 : };
118 :
119 : #ifdef __cplusplus
120 : }
121 : #endif
122 :
123 : #endif
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|