1 /* Generated by GIWS (version 2.0.2) with command:
2 giws --disable-return-size-array --output-dir src/jni/ --throws-exception-on-error --description-file src/jni/XlFontManager.giws.xml
3 */
4 /*
5 
6 This is generated code.
7 
8 This software is a computer program whose purpose is to hide the complexity
9 of accessing Java objects/methods from C++ code.
10 
11 Copyright (C) 2012 - 2016 - Scilab Enterprises
12 
13 This file is hereby licensed under the terms of the GNU GPL v2.0,
14 pursuant to article 5.3.4 of the CeCILL v.2.1.
15 This file was originally licensed under the terms of the CeCILL v2.1,
16 and continues to be available under such terms.
17 For more information, see the COPYING file which you should have received
18 along with this program.
19 */
20 
21 
22 #ifndef __ORG_SCILAB_MODULES_RENDERER_UTILS_TEXTRENDERING_XLFONTMANAGER__
23 #define __ORG_SCILAB_MODULES_RENDERER_UTILS_TEXTRENDERING_XLFONTMANAGER__
24 #include <iostream>
25 #include <string>
26 #include <string.h>
27 #include <stdlib.h>
28 #include <jni.h>
29 
30 #include "GiwsException.hxx"
31 
32         #if defined(_MSC_VER) /* Defined anyway with Visual */
33             #include <Windows.h>
34         #else
35             typedef signed char byte;
36         #endif
37 
38 
39 #ifndef GIWSEXPORT
40 # if defined(_MSC_VER) || defined(__WIN32__) || defined(__CYGWIN__)
41 #   if defined(STATIC_LINKED)
42 #     define GIWSEXPORT
43 #   else
44 #     define GIWSEXPORT __declspec(dllexport)
45 #   endif
46 # else
47 #   if __GNUC__ >= 4
48 #     define GIWSEXPORT __attribute__ ((visibility ("default")))
49 #   else
50 #     define GIWSEXPORT
51 #   endif
52 # endif
53 #endif
54 
55 namespace org_scilab_modules_renderer_utils_textRendering {
56 class GIWSEXPORT XlFontManager {
57 
58 private:
59 JavaVM * jvm;
60 
61 protected:
62 jmethodID jobjectArray_getInstalledFontsNameID; // cache method id
63 jmethodID jintgetSizeInstalledFontsNameID; // cache method id
64 jmethodID jintgetSizeAvailableFontsNameID; // cache method id
65 jmethodID jobjectArray_getAvailableFontsNameID; // cache method id
66 jmethodID jbooleanisAvailableFontNamejstringjava_lang_StringID; // cache method id
67 jmethodID jintaddFontjstringjava_lang_StringID; // cache method id
68 jmethodID jintchangeFontjintintjstringjava_lang_StringID; // cache method id
69 jmethodID jintchangeFontWithPropertyjintintjstringjava_lang_StringjbooleanbooleanjbooleanbooleanID; // cache method id
70 jmethodID voidresetXlFontManagerID; // cache method id
71 jmethodID jintaddFontFromFilenamejstringjava_lang_StringID; // cache method id
72 jmethodID jintchangeFontFromFilenamejintintjstringjava_lang_StringID; // cache method id
73 
74 
75 
76 jobject instance;
77 jclass instanceClass; // cache class
78 
79 
80 // Caching (if any)
81 
82 
83 /**
84 * Get the environment matching to the current thread.
85 */
86 virtual JNIEnv * getCurrentEnv();
87 
88 public:
89 // Constructor
90 /**
91 * Create a wrapping of the object from a JNIEnv.
92 * It will call the default constructor
93 * @param JEnv_ the Java Env
94 */
95 XlFontManager(JavaVM * jvm_);
96 
97 /**
98 * Create a wrapping of an already existing object from a JNIEnv.
99 * The object must have already been instantiated
100 * @param JEnv_ the Java Env
101 * @param JObj the object
102 */
103 XlFontManager(JavaVM * jvm_, jobject JObj);
104 
105 
106 /**
107 * This is a fake constructor to avoid the constructor
108 * chaining when dealing with extended giws classes
109 */
110 #ifdef FAKEGIWSDATATYPE
XlFontManager(fakeGiwsDataType::fakeGiwsDataType)111 XlFontManager(fakeGiwsDataType::fakeGiwsDataType /* unused */) {}
112 #endif
113 
114 // Destructor
115 ~XlFontManager();
116 
117 // Generic method
118 // Synchronization methods
119 /**
120 * Enter monitor associated with the object.
121 * Equivalent of creating a "synchronized(obj)" scope in Java.
122 */
123 void synchronize();
124 
125 /**
126 * Exit monitor associated with the object.
127 * Equivalent of ending a "synchronized(obj)" scope.
128 */
129 void endSynchronize();
130 
131 // Methods
132 char** getInstalledFontsName();
133 
134 int getSizeInstalledFontsName();
135 
136 int getSizeAvailableFontsName();
137 
138 char** getAvailableFontsName();
139 
140 bool isAvailableFontName(char const* fontname);
141 
142 int addFont(char const* fontName);
143 
144 int changeFont(int index, char const* fontName);
145 
146 int changeFontWithProperty(int index, char const* fontName, bool isBold, bool isItalic);
147 
148 void resetXlFontManager();
149 
150 int addFontFromFilename(char const* FontFilename);
151 
152 int changeFontFromFilename(int index, char const* FontFilename);
153 
154 
155                         /**
156                         * Get class name to use for static methods
157                         * @return class name to use for static methods
158                         */
159 
className()160                 static const std::string className()
161                 {
162                 return "org/scilab/modules/renderer/utils/textRendering/XlFontManager";
163                 }
164 
165 
166                         /**
167                         * Get class to use for static methods
168                         * @return class to use for static methods
169                         */
170 
initClass(JNIEnv * curEnv)171                 static jclass initClass(JNIEnv * curEnv)
172                 {
173                     static jclass cls = 0;
174 
175                     if (cls == 0)
176                     {
177                         jclass _cls = curEnv->FindClass(className().c_str());
178                         if (_cls)
179                         {
180                             cls = static_cast<jclass>(curEnv->NewGlobalRef(_cls));
181                         }
182                     }
183 
184                     return cls;
185                  }
186 
187 };
188 
189 
190 }
191 #endif
192