Commit d3143661311432b736efdef4120294660cbecc0c
1 parent
e2f2fd02
Exists in
master
and in
5 other branches
Reimplementando extensão libreoffice, corrigindo bugs encontrados na interface DBUS
Showing
41 changed files
with
1478 additions
and
1329 deletions
Show diff stats
src/classlib/local.cc
... | ... | @@ -454,18 +454,18 @@ |
454 | 454 | return 0; |
455 | 455 | } |
456 | 456 | |
457 | - string * get_text_at(int row, int col, size_t sz) | |
457 | + string get_text_at(int row, int col, size_t sz) | |
458 | 458 | { |
459 | + string rc; | |
459 | 460 | char * ptr = _get_text_at(hSession,row,col,sz); |
460 | 461 | |
461 | 462 | if(ptr) |
462 | 463 | { |
463 | - string *s = new string(ptr); | |
464 | + rc.assign(ptr); | |
464 | 465 | _free(ptr); |
465 | - return s; | |
466 | 466 | } |
467 | 467 | |
468 | - return new string(""); | |
468 | + return rc; | |
469 | 469 | } |
470 | 470 | |
471 | 471 | int set_text_at(int row, int col, const char *str) |
... | ... | @@ -478,18 +478,18 @@ |
478 | 478 | return _cmp_text_at(hSession,row,col,text); |
479 | 479 | } |
480 | 480 | |
481 | - string * get_text(int offset, size_t len) | |
481 | + string get_text(int offset, size_t len) | |
482 | 482 | { |
483 | - char *ptr = _get_text(hSession,offset,len); | |
483 | + string rc; | |
484 | + char * ptr = _get_text(hSession,offset,len); | |
484 | 485 | |
485 | 486 | if(ptr) |
486 | 487 | { |
487 | - string *s = new string(ptr); | |
488 | + rc.assign(ptr); | |
488 | 489 | _free(ptr); |
489 | - return s; | |
490 | 490 | } |
491 | 491 | |
492 | - return new string(""); | |
492 | + return rc; | |
493 | 493 | } |
494 | 494 | |
495 | 495 | int set_cursor_position(int row, int col) |
... | ... | @@ -561,9 +561,9 @@ |
561 | 561 | return 0; |
562 | 562 | } |
563 | 563 | |
564 | - string * get_display_charset(void) | |
564 | + string get_display_charset(void) | |
565 | 565 | { |
566 | - return new string(_get_display_charset(hSession)); | |
566 | + return string(_get_display_charset(hSession)); | |
567 | 567 | } |
568 | 568 | |
569 | 569 | int set_host_charset(const char *charset) |
... | ... | @@ -571,9 +571,9 @@ |
571 | 571 | return _set_host_charset(hSession,charset); |
572 | 572 | } |
573 | 573 | |
574 | - string * get_host_charset(void) | |
574 | + string get_host_charset(void) | |
575 | 575 | { |
576 | - return new string(_get_host_charset(hSession)); | |
576 | + return string(_get_host_charset(hSession)); | |
577 | 577 | } |
578 | 578 | |
579 | 579 | int erase_eof(void) | ... | ... |
src/classlib/remote.cc
... | ... | @@ -214,8 +214,10 @@ |
214 | 214 | return reply; |
215 | 215 | } |
216 | 216 | |
217 | - string * get_string(DBusMessage * msg) | |
217 | + string get_string(DBusMessage * msg) | |
218 | 218 | { |
219 | + string rc; | |
220 | + | |
219 | 221 | if(msg) |
220 | 222 | { |
221 | 223 | DBusMessageIter iter; |
... | ... | @@ -224,11 +226,10 @@ |
224 | 226 | { |
225 | 227 | if(dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_STRING) |
226 | 228 | { |
227 | - string * rc; | |
228 | 229 | const char * str; |
229 | 230 | dbus_message_iter_get_basic(&iter, &str); |
230 | 231 | trace("Response: [%s]",str); |
231 | - rc = new string(str); | |
232 | + rc.assign(str); | |
232 | 233 | dbus_message_unref(msg); |
233 | 234 | return rc; |
234 | 235 | } |
... | ... | @@ -242,10 +243,10 @@ |
242 | 243 | |
243 | 244 | } |
244 | 245 | |
245 | - return NULL; | |
246 | + return rc; | |
246 | 247 | } |
247 | 248 | |
248 | - string * query_string(const char *method) | |
249 | + string query_string(const char *method) | |
249 | 250 | { |
250 | 251 | return get_string(call(create_message(method))); |
251 | 252 | } |
... | ... | @@ -863,7 +864,7 @@ |
863 | 864 | #endif |
864 | 865 | } |
865 | 866 | |
866 | - string * get_text_at(int row, int col, size_t sz) | |
867 | + string get_text_at(int row, int col, size_t sz) | |
867 | 868 | { |
868 | 869 | #if defined(WIN32) |
869 | 870 | |
... | ... | @@ -888,7 +889,7 @@ |
888 | 889 | |
889 | 890 | #else |
890 | 891 | |
891 | - return NULL; | |
892 | + return string(); | |
892 | 893 | |
893 | 894 | #endif |
894 | 895 | |
... | ... | @@ -978,7 +979,7 @@ |
978 | 979 | return ETIMEDOUT; |
979 | 980 | } |
980 | 981 | |
981 | - string * get_text(int baddr, size_t len) | |
982 | + string get_text(int baddr, size_t len) | |
982 | 983 | { |
983 | 984 | #if defined(WIN32) |
984 | 985 | struct hllapi_packet_query_offset query = { HLLAPI_PACKET_GET_TEXT_AT_OFFSET, (unsigned short) baddr, (unsigned short) len }; |
... | ... | @@ -999,7 +1000,7 @@ |
999 | 1000 | return get_string(call(msg)); |
1000 | 1001 | #else |
1001 | 1002 | throw exception("%s","IPC support is unavailable"); |
1002 | - return NULL; | |
1003 | + return string(); | |
1003 | 1004 | #endif |
1004 | 1005 | } |
1005 | 1006 | |
... | ... | @@ -1248,7 +1249,7 @@ |
1248 | 1249 | #endif |
1249 | 1250 | } |
1250 | 1251 | |
1251 | - string * get_host_charset(void) | |
1252 | + string get_host_charset(void) | |
1252 | 1253 | { |
1253 | 1254 | #if defined(WIN32) |
1254 | 1255 | |
... | ... | @@ -1268,7 +1269,7 @@ |
1268 | 1269 | |
1269 | 1270 | |
1270 | 1271 | #if defined(HAVE_DBUS) |
1271 | - string * get_clipboard(void) | |
1272 | + string get_clipboard(void) | |
1272 | 1273 | { |
1273 | 1274 | return query_string("getClipboard"); |
1274 | 1275 | } |
... | ... | @@ -1278,7 +1279,7 @@ |
1278 | 1279 | return query_intval("setClipboard", DBUS_TYPE_STRING, &text, DBUS_TYPE_INVALID); |
1279 | 1280 | } |
1280 | 1281 | |
1281 | - string * get_display_charset(void) | |
1282 | + string get_display_charset(void) | |
1282 | 1283 | { |
1283 | 1284 | return query_string("getDisplayCharset"); |
1284 | 1285 | } | ... | ... |
src/classlib/session.cc
... | ... | @@ -124,7 +124,7 @@ |
124 | 124 | void session::set_display_charset(const char *remote, const char *local) |
125 | 125 | { |
126 | 126 | #ifdef HAVE_ICONV |
127 | - string *display_charset = this->get_display_charset(); | |
127 | + string display_charset = this->get_display_charset(); | |
128 | 128 | |
129 | 129 | if(this->conv2Local != (iconv_t) (-1)) |
130 | 130 | iconv_close(this->conv2Local); |
... | ... | @@ -133,7 +133,7 @@ |
133 | 133 | iconv_close(this->conv2Host); |
134 | 134 | |
135 | 135 | if(!remote) |
136 | - remote = display_charset->c_str(); | |
136 | + remote = display_charset.c_str(); | |
137 | 137 | |
138 | 138 | if(strcmp(local,remote)) |
139 | 139 | { |
... | ... | @@ -146,14 +146,18 @@ |
146 | 146 | conv2Local = conv2Host = (iconv_t)(-1); |
147 | 147 | } |
148 | 148 | |
149 | - delete display_charset; | |
150 | 149 | #endif |
151 | 150 | |
152 | 151 | } |
153 | 152 | |
154 | - string * session::get_display_charset(void) | |
153 | + string session::get_display_charset(void) | |
155 | 154 | { |
156 | - return new string("ISO-8859-1"); | |
155 | + return string(get_encoding()); | |
156 | + } | |
157 | + | |
158 | + const char * session::get_encoding(void) | |
159 | + { | |
160 | + return "ISO-8859-1"; | |
157 | 161 | } |
158 | 162 | |
159 | 163 | // 3270 methods |
... | ... | @@ -209,13 +213,13 @@ |
209 | 213 | return EINVAL; |
210 | 214 | } |
211 | 215 | |
212 | - string * session::get_copy(void) | |
216 | + string session::get_copy(void) | |
213 | 217 | { |
214 | 218 | errno = EINVAL; |
215 | - return NULL; | |
219 | + return string(); | |
216 | 220 | } |
217 | 221 | |
218 | - string * session::get_clipboard(void) | |
222 | + string session::get_clipboard(void) | |
219 | 223 | { |
220 | 224 | #if defined(WIN32) |
221 | 225 | |
... | ... | @@ -239,7 +243,7 @@ |
239 | 243 | return NULL; |
240 | 244 | } |
241 | 245 | |
242 | - string *text = new string ( pszText ); | |
246 | + string text = string ( pszText ); | |
243 | 247 | |
244 | 248 | GlobalUnlock( hData ); |
245 | 249 | |
... | ... | @@ -294,69 +298,75 @@ |
294 | 298 | return -1; |
295 | 299 | } |
296 | 300 | |
297 | - string * session::file_chooser_dialog(int action, const char *title, const char *extension, const char *filename) | |
301 | + string session::file_chooser_dialog(int action, const char *title, const char *extension, const char *filename) | |
298 | 302 | { |
299 | - return NULL; | |
303 | + return string(""); | |
300 | 304 | } |
301 | 305 | |
302 | - string * session::get_3270_text(string *str) | |
306 | + string session::get_3270_text(const char *str) | |
303 | 307 | { |
308 | + string rc; | |
309 | + | |
304 | 310 | #ifdef HAVE_ICONV |
305 | - if(str && conv2Host != (iconv_t)(-1)) | |
311 | + size_t in = strlen(str); | |
312 | + | |
313 | + if(in && conv2Host != (iconv_t)(-1)) | |
306 | 314 | { |
307 | - size_t in = str->length(); | |
308 | 315 | size_t out = (in << 1); |
309 | 316 | char * ptr; |
310 | 317 | char * outBuffer = (char *) malloc(out); |
311 | - ICONV_CONST char * inBuffer = (ICONV_CONST char *) str->c_str(); | |
318 | + ICONV_CONST char * inBuffer = (ICONV_CONST char *) str; | |
312 | 319 | |
313 | 320 | memset(ptr=outBuffer,0,out); |
314 | 321 | |
315 | 322 | iconv(conv2Host,NULL,NULL,NULL,NULL); // Reset state |
316 | 323 | |
317 | 324 | if(iconv(conv2Host,&inBuffer,&in,&ptr,&out) != ((size_t) -1)) |
318 | - str->assign(outBuffer); | |
325 | + rc.assign(outBuffer); | |
319 | 326 | |
320 | 327 | free(outBuffer); |
321 | 328 | } |
329 | +#else | |
330 | + rc = str; | |
322 | 331 | #endif // HAVE_ICONV |
323 | 332 | |
324 | - return str; | |
333 | + return rc; | |
325 | 334 | } |
326 | 335 | |
327 | - string * session::get_local_text(string *str) | |
336 | + string session::get_local_text(const char *str) | |
328 | 337 | { |
338 | + string rc; | |
339 | + | |
329 | 340 | #ifdef HAVE_ICONV |
330 | - if(str && conv2Local != (iconv_t)(-1)) | |
341 | + size_t in = strlen(str); | |
342 | + | |
343 | + if(in && conv2Local != (iconv_t)(-1)) | |
331 | 344 | { |
332 | - size_t in = str->length(); | |
333 | 345 | size_t out = (in << 1); |
334 | 346 | char * ptr; |
335 | 347 | char * outBuffer = (char *) malloc(out); |
336 | - ICONV_CONST char * inBuffer = (ICONV_CONST char *) str->c_str(); | |
348 | + ICONV_CONST char * inBuffer = (ICONV_CONST char *) str; | |
337 | 349 | |
338 | 350 | memset(ptr=outBuffer,0,out); |
339 | 351 | |
340 | 352 | iconv(conv2Local,NULL,NULL,NULL,NULL); // Reset state |
341 | 353 | |
342 | 354 | if(iconv(conv2Local,&inBuffer,&in,&ptr,&out) != ((size_t) -1)) |
343 | - str->assign(outBuffer); | |
355 | + rc.assign(outBuffer); | |
344 | 356 | |
345 | 357 | free(outBuffer); |
346 | 358 | } |
359 | +#else | |
360 | + rc = str; | |
347 | 361 | #endif // HAVE_ICONV |
348 | 362 | |
349 | - return str; | |
363 | + return rc; | |
350 | 364 | } |
351 | 365 | |
352 | - string * session::get_string_at(int row, int col, size_t sz) | |
366 | + string session::get_string_at(int row, int col, size_t sz) | |
353 | 367 | { |
354 | - string *str = this->get_text_at(row,col,sz); | |
355 | - | |
356 | - if(str) | |
357 | - return this->get_local_text(str); | |
358 | - | |
359 | - return 0; | |
368 | + string str = this->get_text_at(row,col,sz); | |
369 | + return this->get_local_text(str.c_str()); | |
360 | 370 | } |
361 | 371 | |
362 | 372 | int session::set_string_at(int row, int col, const char *str) |
... | ... | @@ -427,23 +437,17 @@ |
427 | 437 | |
428 | 438 | int session::cmp_string_at(int row, int col, const char *text) |
429 | 439 | { |
430 | - string * str = get_3270_text(new string(text)); | |
431 | - int rc = cmp_text_at(row,col,str->c_str()); | |
432 | - delete str; | |
433 | - return rc; | |
440 | + return cmp_text_at(row,col,get_3270_text(text).c_str()); | |
434 | 441 | } |
435 | 442 | |
436 | 443 | int session::wait_for_string_at(int row, int col, const char *key, int timeout) |
437 | 444 | { |
438 | - string * str = get_3270_text(new string(key)); | |
439 | - int rc = wait_for_text_at(row,col,str->c_str(),timeout); | |
440 | - delete str; | |
441 | - return rc; | |
445 | + return wait_for_text_at(row,col,get_3270_text(key).c_str(),timeout); | |
442 | 446 | } |
443 | 447 | |
444 | - string * session::get_string(int baddr, size_t len) | |
448 | + string session::get_string(int baddr, size_t len) | |
445 | 449 | { |
446 | - return get_local_text(get_text(baddr,len)); | |
450 | + return get_local_text(get_text(baddr,len).c_str()); | |
447 | 451 | } |
448 | 452 | |
449 | 453 | string session::asc2ebc(string &str) | ... | ... |
src/classlib/testprogram.cc
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | { |
41 | 41 | |
42 | 42 | { |
43 | - string *s; | |
43 | + string s; | |
44 | 44 | session *session = session::start("pw3270:a"); |
45 | 45 | // session *session = session::start("new"); |
46 | 46 | |
... | ... | @@ -55,12 +55,10 @@ |
55 | 55 | cout << "\tSession state: " << session->get_cstate() << endl; |
56 | 56 | |
57 | 57 | s = session->get_display_charset(); |
58 | - cout << "\tDisplay charset: " << s->c_str() << endl; | |
59 | - delete s; | |
58 | + cout << "\tDisplay charset: " << s.c_str() << endl; | |
60 | 59 | |
61 | 60 | s = session->get_host_charset(); |
62 | - cout << "\tHost charset: " << s->c_str() << endl; | |
63 | - delete s; | |
61 | + cout << "\tHost charset: " << s.c_str() << endl; | |
64 | 62 | |
65 | 63 | session->connect(false); |
66 | 64 | delete session; | ... | ... |
src/include/pw3270/class.h
... | ... | @@ -130,8 +130,8 @@ |
130 | 130 | #endif // WIN32 |
131 | 131 | |
132 | 132 | virtual int set_host_charset(const char *charset) = 0; |
133 | - virtual string * get_host_charset(void) = 0; | |
134 | - virtual string * get_display_charset(void); | |
133 | + virtual string get_host_charset(void) = 0; | |
134 | + virtual string get_display_charset(void); | |
135 | 135 | |
136 | 136 | // Connection & Network |
137 | 137 | int connect(const char *host, bool wait = true); |
... | ... | @@ -144,8 +144,8 @@ |
144 | 144 | virtual int iterate(bool wait = true) = 0; |
145 | 145 | |
146 | 146 | // Get/Set/Test without charset translation |
147 | - virtual string * get_text(int baddr, size_t len) = 0; | |
148 | - virtual string * get_text_at(int row, int col, size_t sz) = 0; | |
147 | + virtual string get_text(int baddr, size_t len) = 0; | |
148 | + virtual string get_text_at(int row, int col, size_t sz) = 0; | |
149 | 149 | virtual int set_text_at(int row, int col, const char *str) = 0; |
150 | 150 | virtual int cmp_text_at(int row, int col, const char *text) = 0; |
151 | 151 | virtual int wait_for_text_at(int row, int col, const char *key, int timeout); |
... | ... | @@ -158,8 +158,8 @@ |
158 | 158 | string ebc2asc(string &str); |
159 | 159 | |
160 | 160 | // Get/Set/Test with charset translation |
161 | - string * get_string(int baddr, size_t len); | |
162 | - string * get_string_at(int row, int col, size_t sz); | |
161 | + string get_string(int baddr, size_t len); | |
162 | + string get_string_at(int row, int col, size_t sz); | |
163 | 163 | int set_string_at(int row, int col, const char *str); |
164 | 164 | int cmp_string_at(int row, int col, const char *text); |
165 | 165 | int wait_for_string_at(int row, int col, const char *key, int timeout); |
... | ... | @@ -190,21 +190,23 @@ |
190 | 190 | |
191 | 191 | // Clipboard management |
192 | 192 | virtual int set_copy(const char *text); |
193 | - virtual string * get_copy(void); | |
193 | + virtual string get_copy(void); | |
194 | 194 | |
195 | - virtual string * get_clipboard(void); | |
195 | + virtual string get_clipboard(void); | |
196 | 196 | virtual int set_clipboard(const char *text); |
197 | 197 | |
198 | 198 | // Dialogs |
199 | 199 | virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
200 | - virtual string * file_chooser_dialog(int action, const char *title, const char *extension, const char *filename); | |
200 | + virtual string file_chooser_dialog(int action, const char *title, const char *extension, const char *filename); | |
201 | 201 | |
202 | 202 | // File transfer |
203 | 203 | virtual int file_transfer(LIB3270_FT_OPTION options, const char *local, const char *remote, int lrecl = 0, int blksize = 0, int primspace = 0, int secspace = 0, int dft = 4096); |
204 | 204 | |
205 | 205 | // Charset translation |
206 | - string * get_3270_text(string *str); | |
207 | - string * get_local_text(string *str); | |
206 | + const char * get_encoding(void); | |
207 | + | |
208 | + string get_3270_text(const char *str); | |
209 | + string get_local_text(const char *str); | |
208 | 210 | |
209 | 211 | protected: |
210 | 212 | session(); | ... | ... |
... | ... | @@ -0,0 +1,192 @@ |
1 | +# | |
2 | +# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | +# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | +# aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | +# | |
6 | +# Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | +# | |
8 | +# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | +# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | +# Free Software Foundation. | |
11 | +# | |
12 | +# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | +# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | +# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | +# obter mais detalhes. | |
16 | +# | |
17 | +# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | +# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | +# Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | +# | |
21 | +# Contatos: | |
22 | +# | |
23 | +# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
24 | +# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
25 | +# | |
26 | + | |
27 | +PACKAGE_NAME=@PACKAGE_NAME@ | |
28 | +SOURCES=info.cc get.cc set.cc service.cc init.cc connect.cc | |
29 | + | |
30 | +UNO_CLASSES= /com/sun/star/uno/XWeak \ | |
31 | + /com/sun/star/uno/RuntimeException \ | |
32 | + /com/sun/star/lang/WrappedTargetException | |
33 | + | |
34 | + | |
35 | +#---[ LibreOffice SDK ]-------------------------------------------------------- | |
36 | + | |
37 | +OO_SDK_HOME=@OO_SDK_HOME@ | |
38 | +OO_SDK_URE_HOME=@OO_SDK_URE_HOME@ | |
39 | + | |
40 | +UNO=@UNO@ | |
41 | +UNOPKG=@UNOPKG@ | |
42 | +IDLC=@IDLC@ | |
43 | +REGMERGE=@REGMERGE@ | |
44 | +CPPUMAKER=@CPPUMAKER@ | |
45 | +CONVERT=@CONVERT@ | |
46 | +ZIP=@ZIP@ | |
47 | + | |
48 | +TYPES_RDB=@OO_SDK_URE_HOME@/share/misc/types.rdb | |
49 | + | |
50 | +#---[ Paths ]------------------------------------------------------------------ | |
51 | + | |
52 | +prefix=@prefix@ | |
53 | +exec_prefix=@exec_prefix@ | |
54 | +bindir=@bindir@ | |
55 | +sbindir=@sbindir@ | |
56 | +libdir=@libdir@ | |
57 | +includedir=@includedir@ | |
58 | + | |
59 | +#---[ Tools ]------------------------------------------------------------------ | |
60 | + | |
61 | +CXX=@CXX@ | |
62 | +MKDIR=@MKDIR_P@ | |
63 | + | |
64 | +#---[ Paths ]------------------------------------------------------------------ | |
65 | + | |
66 | +OBJDIR=.obj | |
67 | +BINDIR=.bin | |
68 | +RDBDIR=.rdb | |
69 | +URDDIR=.urd | |
70 | + | |
71 | +OBJDBG=$(OBJDIR)/Debug | |
72 | +BINDBG=$(BINDIR)/Debug | |
73 | + | |
74 | +OBJRLS=$(OBJDIR)/Release | |
75 | +BINRLS=$(BINDIR)/Release | |
76 | + | |
77 | +#---[ lib3270 common class ]--------------------------------------------------- | |
78 | + | |
79 | +DEBUG_CFLAGS=-DDEBUG=1 -g -Wall | |
80 | +PW3270_CFLAGS=-I../include | |
81 | +CLASSLIBDIR=../classlib | |
82 | +include $(CLASSLIBDIR)/class.mak | |
83 | + | |
84 | +#---[ Build options ]---------------------------------------------------------- | |
85 | + | |
86 | +CPPUENV="gcc3" | |
87 | +CXXFLAGS=@CXXFLAGS@ -fvisibility=hidden @DLL_CFLAGS@ -Wno-strict-aliasing -I../include -I./include -I$(includedir)/libreoffice -Wno-strict-aliasing -DCPPU_ENV=$(CPPUENV) -DLANGUAGE_BINDING_NAME=\"$(CPPUENV)\" | |
88 | + | |
89 | +OO_LDFLAGS=-L$(OO_SDK_HOME)/lib -L$(OO_SDK_URE_HOME)/lib \ | |
90 | + -Wl,-rpath-link=$(OO_SDK_URE_HOME)/lib,-rpath=$(OO_SDK_URE_HOME)/lib \ | |
91 | + -luno_cppu -luno_cppuhelpergcc3 -luno_salhelpergcc3 | |
92 | + | |
93 | +#---[ Rules ]------------------------------------------------------------------ | |
94 | + | |
95 | +$(URDDIR)/%.urd: %.idl | |
96 | + @echo " IDLC `basename $@`" | |
97 | + @$(MKDIR) `dirname $@` | |
98 | + @$(IDLC) -C -I$(OO_SDK_HOME)/idl -O`dirname $@` $< | |
99 | + | |
100 | +$(URDDIR)/%.urd: /usr/share/idl/libreoffice/%.idl | |
101 | + @echo " IDLC `basename $@`" | |
102 | + @$(MKDIR) `dirname $@` | |
103 | + @$(IDLC) -C -I$(OO_SDK_HOME)/idl -O`dirname $@` $< | |
104 | + | |
105 | +$(RDBDIR)/%.rdb: $(URDDIR)/%.urd | |
106 | + @echo " REGM `basename $@`" | |
107 | + @$(MKDIR) `dirname $@` | |
108 | + @$(REGMERGE) $@ /UCR $< | |
109 | + | |
110 | +include/%.hpp: $(RDBDIR)/%.rdb | |
111 | + @echo " CPPU `basename $@`" | |
112 | + @$(MKDIR) `dirname $@` | |
113 | + @$(CPPUMAKER) -O./include $(TYPES_RDB) $< | |
114 | + | |
115 | +$(OBJDBG)/%.o: %.cc include/$(PACKAGE_NAME)/lib3270.hpp \ | |
116 | + $(foreach CLS, $(UNO_CLASSES), include/$(CLS).hpp) \ | |
117 | + *.hpp Makefile | |
118 | + @echo " CC `basename $@`" | |
119 | + @mkdir -p `dirname $@` | |
120 | + @$(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ -c $< | |
121 | +# $(DBG_CFLAGS) $(CXXFLAGS) $(LIB3270_CFLAGS) -DLIBNAME=\"$(BINDBG)/$(PROGRAM_NAME).uno@DLLEXT@\" -o $@ -c $< | |
122 | + | |
123 | +#---[ UNO targets ]------------------------------------------------------------ | |
124 | + | |
125 | +include/$(PACKAGE_NAME)/lib3270.hpp: $(RDBDIR)/$(PACKAGE_NAME).rdb | |
126 | + @echo " CPPU `basename $@`" | |
127 | + @$(MKDIR) `dirname $@` | |
128 | + @$(CPPUMAKER) -O./include -T$(PACKAGE_NAME).lib3270 $(TYPES_RDB) $< | |
129 | + | |
130 | + | |
131 | +#---[ Debug targets ]---------------------------------------------------------- | |
132 | + | |
133 | +Debug: $(BINDBG)/$(PACKAGE_NAME).oxt | |
134 | + | |
135 | +run: $(BINDBG)/$(PACKAGE_NAME).oxt | |
136 | + @SHARED=false $(UNOPKG) add --verbose --force $(BINDBG)/$(PACKAGE_NAME).oxt | |
137 | + @libreoffice testmacros.odt | |
138 | + @SHARED=false $(UNOPKG) remove $(PACKAGE_NAME) | |
139 | + | |
140 | +add: $(BINDBG)/$(PACKAGE_NAME).oxt | |
141 | + @SHARED=false $(UNOPKG) add --verbose --force $(BINDBG)/$(PACKAGE_NAME).oxt | |
142 | + | |
143 | +$(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@: \ | |
144 | + $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) \ | |
145 | + $(CLASS_DEBUG_OBJECTS) | |
146 | + @echo " LD `basename $@`" | |
147 | + @$(MKDIR) `dirname $@` | |
148 | + $(CXX) -shared $(LDFLAGS) $(OO_LDFLAGS) $(CLASS_LIBS) -o $@ $^ | |
149 | + | |
150 | + | |
151 | +$(BINDBG)/$(PACKAGE_NAME).oxt: \ | |
152 | + $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ \ | |
153 | + $(RDBDIR)/$(PACKAGE_NAME).rdb \ | |
154 | + description.xml \ | |
155 | + manifest.xml \ | |
156 | + description.txt | |
157 | + @rm -f $@ | |
158 | + @$(MKDIR) `dirname $@` | |
159 | + | |
160 | + @$(MKDIR) $(BINDBG)/$(PACKAGE).oxt.tmp | |
161 | + | |
162 | + @cp $(RDBDIR)/$(PACKAGE_NAME).rdb $(BINDBG)/$(PACKAGE).oxt.tmp | |
163 | + @cp $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ $(BINDBG)/$(PACKAGE).oxt.tmp | |
164 | + | |
165 | + @$(MKDIR) $(BINDBG)/$(PACKAGE).oxt.tmp/META-INF | |
166 | + @cp manifest.xml $(BINDBG)/$(PACKAGE).oxt.tmp/META-INF | |
167 | + | |
168 | + @cp description.xml $(BINDBG)/$(PACKAGE).oxt.tmp | |
169 | + @cp description.txt $(BINDBG)/$(PACKAGE).oxt.tmp | |
170 | + | |
171 | + @$(CONVERT) ../$(PACKAGE_NAME)/pixmaps/$(PACKAGE_NAME).svg --format=png > $(BINDBG)/$(PACKAGE).oxt.tmp/$(PACKAGE_NAME).png | |
172 | + | |
173 | + @cp $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ $(BINDBG)/$(PACKAGE_NAME).oxt.tmp | |
174 | + @cd $(BINDBG)/$(PACKAGE).oxt.tmp ; $(ZIP) -r -m ../$(PACKAGE_NAME).oxt . | |
175 | + @rm -fr $(BINDBG)/$(PACKAGE).oxt.tmp | |
176 | + @echo $@ Ok. | |
177 | + | |
178 | + | |
179 | +#---[ Misc targets ]----------------------------------------------------------- | |
180 | + | |
181 | +cleanDebug: clean | |
182 | + | |
183 | +clean: | |
184 | + @rm -f *.urd | |
185 | + @rm -fr $(RDBDIR) | |
186 | + @rm -fr $(URDDIR) | |
187 | + @rm -fr include | |
188 | + @rm -f *.rdb | |
189 | + @rm -fr $(OBJDIR) | |
190 | + @rm -fr $(BINDIR) | |
191 | + | |
192 | + | ... | ... |
... | ... | @@ -0,0 +1,145 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | + * | |
21 | + * Este programa está nomeado como connect.cc e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + * | |
29 | + */ | |
30 | + | |
31 | + #include "globals.hpp" | |
32 | + #include "pw3270/lib3270.hpp" | |
33 | + #include <exception> | |
34 | + #include <com/sun/star/uno/RuntimeException.hdl> | |
35 | + | |
36 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
37 | + | |
38 | + using namespace pw3270_impl; | |
39 | + | |
40 | + ::sal_Int16 SAL_CALL session_impl::Connect() throw (::com::sun::star::uno::RuntimeException) | |
41 | + { | |
42 | + trace("%s: hSession=%p",__FUNCTION__,hSession); | |
43 | + | |
44 | + try | |
45 | + { | |
46 | + if(!hSession) | |
47 | + hSession = h3270::session::get_default(); | |
48 | + | |
49 | + return hSession->connect(false); | |
50 | + | |
51 | + } catch(std::exception &e) | |
52 | + { | |
53 | + trace("%s failed: %s",__FUNCTION__,e.what()); | |
54 | + | |
55 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
56 | + | |
57 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
58 | + | |
59 | + } | |
60 | + | |
61 | + return -1; | |
62 | + | |
63 | + | |
64 | + } | |
65 | + | |
66 | + ::sal_Int16 SAL_CALL session_impl::Disconnect() throw (::com::sun::star::uno::RuntimeException) | |
67 | + { | |
68 | + try | |
69 | + { | |
70 | + CHECK_SESSION_HANDLE | |
71 | + | |
72 | + return hSession->disconnect(); | |
73 | + | |
74 | + } catch(std::exception &e) | |
75 | + { | |
76 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
77 | + | |
78 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
79 | + | |
80 | + } | |
81 | + | |
82 | + return -1; | |
83 | + | |
84 | + } | |
85 | + | |
86 | + ::sal_Bool SAL_CALL session_impl::isConnected() throw (::com::sun::star::uno::RuntimeException) | |
87 | + { | |
88 | + try | |
89 | + { | |
90 | + CHECK_SESSION_HANDLE | |
91 | + | |
92 | + return hSession->is_connected(); | |
93 | + | |
94 | + } catch(std::exception &e) | |
95 | + { | |
96 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
97 | + | |
98 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
99 | + | |
100 | + } | |
101 | + | |
102 | + return -1; | |
103 | + } | |
104 | + | |
105 | + ::sal_Bool SAL_CALL session_impl::isReady() throw (::com::sun::star::uno::RuntimeException) | |
106 | + { | |
107 | + try | |
108 | + { | |
109 | + CHECK_SESSION_HANDLE | |
110 | + | |
111 | + return hSession->is_ready(); | |
112 | + | |
113 | + } catch(std::exception &e) | |
114 | + { | |
115 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
116 | + | |
117 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
118 | + | |
119 | + } | |
120 | + | |
121 | + return -1; | |
122 | + | |
123 | + } | |
124 | + | |
125 | + ::sal_Int16 SAL_CALL session_impl::waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException) | |
126 | + { | |
127 | + try | |
128 | + { | |
129 | + CHECK_SESSION_HANDLE | |
130 | + | |
131 | + return hSession->wait_for_ready(seconds); | |
132 | + | |
133 | + } catch(std::exception &e) | |
134 | + { | |
135 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
136 | + | |
137 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
138 | + | |
139 | + } | |
140 | + | |
141 | + return -1; | |
142 | + | |
143 | + } | |
144 | + | |
145 | + | ... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<description xmlns="http://openoffice.org/extensions/description/2006" | |
3 | +xmlns:d="http://openoffice.org/extensions/description/2006" | |
4 | +xmlns:xlink="http://www.w3.org/1999/xlink"> | |
5 | + | |
6 | + <version value="@PACKAGE_VERSION@" /> | |
7 | + | |
8 | + <identifier value="@PACKAGE_NAME@" /> | |
9 | + | |
10 | + <platform value="linux_@host_cpu@" /> | |
11 | + | |
12 | + <dependencies> | |
13 | + <OpenOffice.org-minimal-version value="2.2" d:name="OpenOffice.org 2.2"/> | |
14 | + </dependencies> | |
15 | + | |
16 | + <display-name> | |
17 | + <name lang="en">3270 access extension</name> | |
18 | + </display-name> | |
19 | + | |
20 | + <icon> | |
21 | + <default xlink:href="@PACKAGE_NAME@.png" /> | |
22 | + </icon> | |
23 | + | |
24 | + <extension-description> | |
25 | + <src xlink:href="description.txt" lang="en" /> | |
26 | + </extension-description> | |
27 | + | |
28 | + | |
29 | + | |
30 | +</description> | ... | ... |
... | ... | @@ -0,0 +1,88 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | + * | |
21 | + * Este programa está nomeado como get.cc e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + * Referência: | |
29 | + * | |
30 | + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes | |
31 | + * | |
32 | + */ | |
33 | + | |
34 | + #include "globals.hpp" | |
35 | + #include <lib3270/config.h> | |
36 | + #include "pw3270/lib3270.hpp" | |
37 | + | |
38 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
39 | + | |
40 | + using namespace pw3270_impl; | |
41 | + | |
42 | + ::rtl::OUString session_impl::getVersion() throw (RuntimeException) | |
43 | + { | |
44 | + trace("%s: hSession=%p",__FUNCTION__,hSession); | |
45 | + return OUString( RTL_CONSTASCII_USTRINGPARAM(PACKAGE_VERSION) ); | |
46 | + } | |
47 | + | |
48 | + ::rtl::OUString session_impl::getRevision() throw (RuntimeException) | |
49 | + { | |
50 | + trace("%s: hSession=%p",__FUNCTION__,hSession); | |
51 | + return OUString( RTL_CONSTASCII_USTRINGPARAM(PACKAGE_REVISION) ); | |
52 | + } | |
53 | + | |
54 | + ::rtl::OUString SAL_CALL session_impl::getTextAt( ::sal_Int16 row, ::sal_Int16 col, ::sal_Int16 size ) throw (::com::sun::star::uno::RuntimeException) | |
55 | + { | |
56 | + string s; | |
57 | + | |
58 | + try | |
59 | + { | |
60 | + CHECK_SESSION_HANDLE | |
61 | + s = hSession->get_text_at(row,col,size); | |
62 | + | |
63 | + } catch(std::exception &e) | |
64 | + { | |
65 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
66 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
67 | + } | |
68 | + | |
69 | + return OUString(s.c_str(), s.length(), encoding, RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
70 | + } | |
71 | + | |
72 | + ::sal_Int16 SAL_CALL session_impl::waitForTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str, ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException) | |
73 | + { | |
74 | + try | |
75 | + { | |
76 | + CHECK_SESSION_HANDLE | |
77 | + OString vlr = rtl::OUStringToOString(str,encoding); | |
78 | + return hSession->wait_for_text_at(row,col,vlr.getStr(),seconds); | |
79 | + | |
80 | + } catch(std::exception &e) | |
81 | + { | |
82 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
83 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
84 | + } | |
85 | + | |
86 | + return -1; | |
87 | + | |
88 | + } | ... | ... |
... | ... | @@ -0,0 +1,143 @@ |
1 | +/* | |
2 | + * "Software PW3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | + * | |
21 | + * Este programa está nomeado como globals.hpp e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
27 | + * | |
28 | + * Referências: | |
29 | + * | |
30 | + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/C%2B%2B_Component | |
31 | + * | |
32 | + * | |
33 | + */ | |
34 | + | |
35 | +#ifndef PW3270_OXT_GLOBALS_HPP_INCLUDED | |
36 | + | |
37 | + #define PW3270_OXT_GLOBALS_HPP_INCLUDED 1 | |
38 | + | |
39 | + #define CPPUENV "gcc3" | |
40 | + | |
41 | + #ifdef _WIN32 | |
42 | + #define SAL_W32 | |
43 | + #else | |
44 | + #define UNX 1 | |
45 | + #define GCC 1 | |
46 | + #define LINUX 1 | |
47 | + #define HAVE_GCC_VISIBILITY_FEATURE 1 | |
48 | + #endif | |
49 | + | |
50 | + | |
51 | + #include <cppuhelper/implbase4.hxx> // "3" implementing three interfaces | |
52 | + #include <cppuhelper/factory.hxx> | |
53 | + #include <com/sun/star/lang/XInitialization.hpp> | |
54 | +// #include <cppuhelper/implementationentry.hxx> | |
55 | + #include <com/sun/star/lang/XServiceInfo.hpp> | |
56 | + | |
57 | +#ifdef DEBUG | |
58 | + #include <com/sun/star/lang/XMain.hpp> | |
59 | +#endif // DEBUG | |
60 | + | |
61 | + #include <com/sun/star/uno/RuntimeException.hpp> | |
62 | + | |
63 | + #ifdef DEBUG | |
64 | + #include <stdio.h> | |
65 | + #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | |
66 | + #else | |
67 | + #define trace(x, ...) // __VA_ARGS__ | |
68 | + #endif | |
69 | + | |
70 | + #include <pw3270/lib3270.hpp> | |
71 | + #include <pw3270/class.h> | |
72 | + | |
73 | + #define DLL_PUBLIC __attribute__((visibility("default"))) | |
74 | + | |
75 | + #define CHECK_SESSION_HANDLE if(!hSession) hSession = h3270::session::get_default(); | |
76 | + | |
77 | + | |
78 | + using namespace ::rtl; // for OUString | |
79 | + using namespace ::com::sun::star; // for sdk interfaces | |
80 | + using namespace ::com::sun::star::lang; // for sdk interfaces | |
81 | + using namespace ::com::sun::star::uno; // for basic types | |
82 | + using namespace PW3270_NAMESPACE; | |
83 | + | |
84 | + namespace pw3270_impl | |
85 | + { | |
86 | + // https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes | |
87 | + class DLL_PUBLIC session_impl : public ::cppu::WeakImplHelper4< ::pw3270::lib3270, XServiceInfo, XMain, XInitialization > | |
88 | + { | |
89 | + public: | |
90 | + | |
91 | + session_impl(); | |
92 | + virtual ~session_impl(); | |
93 | + | |
94 | + // XMain | |
95 | + virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aArguments ) throw (Exception); | |
96 | + | |
97 | + // XInitialization will be called upon createInstanceWithArguments[AndContext]() | |
98 | + virtual void SAL_CALL initialize( Sequence< Any > const & args ) throw (Exception); | |
99 | + | |
100 | + // XServiceInfo | |
101 | + virtual OUString SAL_CALL getImplementationName() throw (RuntimeException); | |
102 | + virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName ) throw (RuntimeException); | |
103 | + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); | |
104 | + | |
105 | + // lib3270 | |
106 | + virtual ::rtl::OUString SAL_CALL getVersion() throw (RuntimeException); | |
107 | + virtual ::rtl::OUString SAL_CALL getRevision() throw (RuntimeException); | |
108 | + virtual ::sal_Int16 SAL_CALL iterate( ::sal_Bool wait ) throw (::com::sun::star::uno::RuntimeException); | |
109 | + | |
110 | + virtual ::sal_Int16 SAL_CALL setSessionName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException); | |
111 | + | |
112 | + virtual ::sal_Int16 SAL_CALL setHost( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException); | |
113 | + virtual ::sal_Int16 SAL_CALL Connect() throw (::com::sun::star::uno::RuntimeException); | |
114 | + virtual ::sal_Int16 SAL_CALL Disconnect() throw (::com::sun::star::uno::RuntimeException); | |
115 | + | |
116 | + // State | |
117 | + virtual ::sal_Bool SAL_CALL isConnected() throw (::com::sun::star::uno::RuntimeException); | |
118 | + virtual ::sal_Bool SAL_CALL isReady() throw (::com::sun::star::uno::RuntimeException); | |
119 | + | |
120 | + // Screen contents | |
121 | + virtual ::rtl::OUString SAL_CALL getTextAt( ::sal_Int16 row, ::sal_Int16 col, ::sal_Int16 size ) throw (::com::sun::star::uno::RuntimeException); | |
122 | + virtual ::sal_Int16 SAL_CALL setTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str ) throw (::com::sun::star::uno::RuntimeException); | |
123 | + | |
124 | + // Wait | |
125 | + virtual ::sal_Int16 SAL_CALL waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException); | |
126 | + virtual ::sal_Int16 SAL_CALL waitForTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str, ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException); | |
127 | + | |
128 | + | |
129 | + | |
130 | + private: | |
131 | + h3270::session * hSession; | |
132 | + rtl_TextEncoding encoding; | |
133 | + | |
134 | + }; | |
135 | + | |
136 | + extern Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl(); | |
137 | + extern OUString SAL_CALL getImplementationName_session_impl(); | |
138 | + extern Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () ); | |
139 | + | |
140 | + }; | |
141 | + | |
142 | + | |
143 | +#endif // PW3270_OXT_GLOBALS_HPP_INCLUDED | ... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | + * | |
21 | + * Este programa está nomeado como info.cc e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + * Referência: | |
29 | + * | |
30 | + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes | |
31 | + * | |
32 | + */ | |
33 | + | |
34 | + #include "globals.hpp" | |
35 | + #include "pw3270/lib3270.hpp" | |
36 | + | |
37 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
38 | + | |
39 | +using namespace pw3270_impl; | |
40 | + | |
41 | +// XServiceInfo implementation | |
42 | +OUString session_impl::getImplementationName() throw (RuntimeException) | |
43 | +{ | |
44 | + // unique implementation name | |
45 | + return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.pw3270_impl.session") ); | |
46 | +} | |
47 | + | |
48 | +sal_Bool session_impl::supportsService( OUString const & serviceName ) throw (RuntimeException) | |
49 | +{ | |
50 | + // this object only supports one service, so the test is simple | |
51 | + return serviceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("pw3270.session") ); | |
52 | +} | |
53 | + | |
54 | +Sequence< OUString > session_impl::getSupportedServiceNames() throw (RuntimeException) | |
55 | +{ | |
56 | + return getSupportedServiceNames_session_impl(); | |
57 | +} | |
58 | + | ... | ... |
... | ... | @@ -0,0 +1,95 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | + * | |
21 | + * Este programa está nomeado como init.cc e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + * Referência: | |
29 | + * | |
30 | + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Create_Instance_with_Arguments | |
31 | + * | |
32 | + */ | |
33 | + | |
34 | + #include "globals.hpp" | |
35 | + #include <com/sun/star/lang/IllegalArgumentException.hpp> | |
36 | + #include "pw3270/lib3270.hpp" | |
37 | + | |
38 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
39 | + | |
40 | +using namespace pw3270_impl; | |
41 | + | |
42 | + | |
43 | +session_impl::session_impl() | |
44 | +{ | |
45 | + this->hSession = NULL; | |
46 | + this->encoding = RTL_TEXTENCODING_ISO_8859_1; | |
47 | +} | |
48 | + | |
49 | +session_impl::~session_impl() | |
50 | +{ | |
51 | + if(this->hSession) | |
52 | + delete this->hSession; | |
53 | +} | |
54 | + | |
55 | + | |
56 | +// XInitialization implementation | |
57 | +void session_impl::initialize( Sequence< Any > const & args ) throw (Exception) | |
58 | +{ | |
59 | + if (1 != args.getLength()) | |
60 | + { | |
61 | + throw lang::IllegalArgumentException( | |
62 | + OUString( RTL_CONSTASCII_USTRINGPARAM("give a string instanciating this component!") ), | |
63 | + (::cppu::OWeakObject *)this, | |
64 | + 0 ); | |
65 | + } | |
66 | + | |
67 | + // Initialize | |
68 | + | |
69 | + // TODO: Get arguments. | |
70 | + | |
71 | + | |
72 | +} | |
73 | + | |
74 | +// XMain | |
75 | +::sal_Int32 SAL_CALL session_impl::run( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aArguments ) throw (Exception) | |
76 | +{ | |
77 | + | |
78 | + | |
79 | + return 0; | |
80 | +} | |
81 | + | |
82 | +::sal_Int16 SAL_CALL session_impl::iterate( ::sal_Bool wait ) throw (::com::sun::star::uno::RuntimeException) | |
83 | +{ | |
84 | + try | |
85 | + { | |
86 | + CHECK_SESSION_HANDLE | |
87 | + return hSession->iterate(wait); | |
88 | + | |
89 | + } catch(std::exception &e) | |
90 | + { | |
91 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
92 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
93 | + } | |
94 | + return -1; | |
95 | +} | ... | ... |
... | ... | @@ -0,0 +1,64 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | |
2 | +<CodeBlocks_project_file> | |
3 | + <FileVersion major="1" minor="6" /> | |
4 | + <Project> | |
5 | + <Option title="pw3270 openOffice" /> | |
6 | + <Option makefile_is_custom="1" /> | |
7 | + <Option pch_mode="2" /> | |
8 | + <Option compiler="gcc" /> | |
9 | + <Build> | |
10 | + <Target title="Debug"> | |
11 | + <Option output=".bin/Debug/pw3270 LibreOffice" prefix_auto="1" extension_auto="1" /> | |
12 | + <Option object_output=".obj/Debug/" /> | |
13 | + <Option type="1" /> | |
14 | + <Option compiler="gcc" /> | |
15 | + <Compiler> | |
16 | + <Add option="-g" /> | |
17 | + </Compiler> | |
18 | + </Target> | |
19 | + <Target title="Release"> | |
20 | + <Option output=".bin/Release/pw3270 LibreOffice" prefix_auto="1" extension_auto="1" /> | |
21 | + <Option object_output=".obj/Release/" /> | |
22 | + <Option type="1" /> | |
23 | + <Option compiler="gcc" /> | |
24 | + <Compiler> | |
25 | + <Add option="-O2" /> | |
26 | + </Compiler> | |
27 | + <Linker> | |
28 | + <Add option="-s" /> | |
29 | + </Linker> | |
30 | + </Target> | |
31 | + </Build> | |
32 | + <Compiler> | |
33 | + <Add option="-Wall" /> | |
34 | + </Compiler> | |
35 | + <Unit filename="../../configure.ac" /> | |
36 | + <Unit filename="../classlib/Makefile.in" /> | |
37 | + <Unit filename="../classlib/class.mak" /> | |
38 | + <Unit filename="../classlib/class.mak.in" /> | |
39 | + <Unit filename="../classlib/exception.cc" /> | |
40 | + <Unit filename="../classlib/local.cc" /> | |
41 | + <Unit filename="../classlib/remote.cc" /> | |
42 | + <Unit filename="../classlib/session.cc" /> | |
43 | + <Unit filename="../include/pw3270/class.h" /> | |
44 | + <Unit filename="Makefile.in" /> | |
45 | + <Unit filename="connect.cc" /> | |
46 | + <Unit filename="get.cc" /> | |
47 | + <Unit filename="globals.hpp" /> | |
48 | + <Unit filename="include/pw3270/lib3270.hdl" /> | |
49 | + <Unit filename="include/pw3270/lib3270.hpp" /> | |
50 | + <Unit filename="info.cc" /> | |
51 | + <Unit filename="init.cc" /> | |
52 | + <Unit filename="manifest.xml.in" /> | |
53 | + <Unit filename="pw3270.idl" /> | |
54 | + <Unit filename="service.cc" /> | |
55 | + <Unit filename="set.cc" /> | |
56 | + <Unit filename="testprogram.cc" /> | |
57 | + <Extensions> | |
58 | + <code_completion /> | |
59 | + <envvars /> | |
60 | + <debugger /> | |
61 | + <lib_finder disable_auto="1" /> | |
62 | + </Extensions> | |
63 | + </Project> | |
64 | +</CodeBlocks_project_file> | ... | ... |
... | ... | @@ -0,0 +1,6 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<manifest:manifest> | |
3 | +<manifest:file-entry manifest:media-type= "application/vnd.sun.star.uno-component;type=native;platform=Linux_@host_cpu@" manifest:full-path="@PACKAGE_NAME@.uno.so"/> | |
4 | +<manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB" manifest:full-path="@PACKAGE_NAME@.rdb"/> | |
5 | +</manifest:manifest> | |
6 | + | ... | ... |
... | ... | @@ -0,0 +1,79 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como pw3270.idl e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + * Referências: | |
29 | + * | |
30 | + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C++/C++_Component | |
31 | + * | |
32 | + */ | |
33 | + | |
34 | +#include <com/sun/star/uno/XInterface.idl> | |
35 | +#include <com/sun/star/lang/XInitialization.idl> | |
36 | +#include <com/sun/star/lang/XMain.idl> | |
37 | + | |
38 | +module pw3270 | |
39 | +{ | |
40 | + /* | |
41 | + * Interface to lib3270 | |
42 | + */ | |
43 | + interface lib3270 : com::sun::star::uno::XInterface | |
44 | + { | |
45 | + // Constants | |
46 | + string getVersion(); | |
47 | + string getRevision(); | |
48 | + | |
49 | + // Host definition | |
50 | + short setHost([in] string url); | |
51 | + short Connect(); | |
52 | + short Disconnect(); | |
53 | + short iterate([in] boolean wait); | |
54 | + | |
55 | + // Screen contents | |
56 | + string getTextAt([in] short row, [in] short col, [in] short size); | |
57 | + short setTextAt([in] short row, [in] short col, [in] string str); | |
58 | + short waitForTextAt([in] short row, [in] short col, [in] string str, [in] short seconds); | |
59 | + | |
60 | + // Misc Settings | |
61 | + short setSessionName([in] string name); | |
62 | + | |
63 | + // State | |
64 | + boolean isConnected(); | |
65 | + boolean isReady(); | |
66 | + | |
67 | + // Waiting | |
68 | + short waitForReady([in] short seconds); | |
69 | + | |
70 | + }; | |
71 | + | |
72 | + service session | |
73 | + { | |
74 | + interface lib3270; | |
75 | + interface com::sun::star::lang::XInitialization; | |
76 | + interface com::sun::star::lang::XMain; | |
77 | + }; | |
78 | +}; | |
79 | + | ... | ... |
... | ... | @@ -0,0 +1,44 @@ |
1 | +#!/bin/bash | |
2 | + | |
3 | +OO_SDK_HOME=/usr/lib64/libreoffice/sdk | |
4 | +IDLC=/usr/lib64/libreoffice/sdk/bin/idlc | |
5 | +CPPUMAKER=/usr/lib64/libreoffice/sdk/bin/cppumaker | |
6 | +TYPES_RDB=/usr/lib64/libreoffice/ure/share/misc/types.rdb | |
7 | +REGMERGE=/usr/lib64/libreoffice/ure/bin/regmerge | |
8 | + | |
9 | +$IDLC -C -I$OO_SDK_HOME/idl -O. pw3270.idl | |
10 | +if [ "$?" != "0" ]; then | |
11 | + exit -1 | |
12 | +fi | |
13 | + | |
14 | + | |
15 | +$REGMERGE pw3270.rdb /UCR pw3270.urd | |
16 | +if [ "$?" != "0" ]; then | |
17 | + exit -1 | |
18 | +fi | |
19 | + | |
20 | + | |
21 | +$CPPUMAKER -O./include -Tpw3270.lib3270 $TYPES_RDB pw3270.rdb | |
22 | +if [ "$?" != "0" ]; then | |
23 | + exit -1 | |
24 | +fi | |
25 | + | |
26 | +# XWeak | |
27 | +$IDLC -C -I$OO_SDK_HOME/idl -O. /usr/share/idl/libreoffice/com/sun/star/uno/XWeak.idl | |
28 | +if [ "$?" != "0" ]; then | |
29 | + exit -1 | |
30 | +fi | |
31 | + | |
32 | +$REGMERGE XWeak.rdb /UCR XWeak.urd | |
33 | +if [ "$?" != "0" ]; then | |
34 | + exit -1 | |
35 | +fi | |
36 | + | |
37 | +$CPPUMAKER -O./include $TYPES_RDB XWeak.rdb | |
38 | +if [ "$?" != "0" ]; then | |
39 | + exit -1 | |
40 | +fi | |
41 | + | |
42 | + | |
43 | +echo ok | |
44 | + | ... | ... |
... | ... | @@ -0,0 +1,98 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | + * | |
21 | + * Este programa está nomeado como info.cc e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + * Referência: | |
29 | + * | |
30 | + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Providing_a_Single_Factory_Using_a_Helper_Method | |
31 | + * | |
32 | + */ | |
33 | + | |
34 | + #include "globals.hpp" | |
35 | + #include <cppuhelper/implementationentry.hxx> | |
36 | + #include "pw3270/lib3270.hpp" | |
37 | + | |
38 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
39 | + | |
40 | +namespace pw3270_impl | |
41 | +{ | |
42 | + Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl() | |
43 | + { | |
44 | + Sequence<OUString> names(1); | |
45 | + names[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("pw3270.session")); | |
46 | + return names; | |
47 | + } | |
48 | + | |
49 | + OUString SAL_CALL getImplementationName_session_impl() | |
50 | + { | |
51 | + return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.lib3270.session") ); | |
52 | + } | |
53 | + | |
54 | + Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () ) | |
55 | + { | |
56 | + return static_cast< lang::XTypeProvider * >( new session_impl() ); | |
57 | + } | |
58 | + | |
59 | + static struct ::cppu::ImplementationEntry s_component_entries [] = | |
60 | + { | |
61 | + { | |
62 | + create_session_impl, | |
63 | + getImplementationName_session_impl, | |
64 | + getSupportedServiceNames_session_impl, | |
65 | + ::cppu::createSingleComponentFactory, | |
66 | + 0, | |
67 | + 0 | |
68 | + }, | |
69 | + { | |
70 | + 0, | |
71 | + 0, | |
72 | + 0, | |
73 | + 0, | |
74 | + 0, | |
75 | + 0 | |
76 | + } | |
77 | + }; | |
78 | + | |
79 | +} | |
80 | + | |
81 | +extern "C" | |
82 | +{ | |
83 | + DLL_PUBLIC void * SAL_CALL component_getFactory(sal_Char const * implName, lang::XMultiServiceFactory * xMgr,registry::XRegistryKey * xRegistry ) | |
84 | + { | |
85 | + return ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry, ::pw3270_impl::s_component_entries ); | |
86 | + } | |
87 | + | |
88 | + DLL_PUBLIC sal_Bool SAL_CALL component_writeInfo(lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry ) | |
89 | + { | |
90 | + return ::cppu::component_writeInfoHelper(xMgr, xRegistry, ::pw3270_impl::s_component_entries ); | |
91 | + } | |
92 | + | |
93 | + DLL_PUBLIC void SAL_CALL component_getImplementationEnvironment(sal_Char const ** ppEnvTypeName, uno_Environment ** ppEnv ) | |
94 | + { | |
95 | + * ppEnvTypeName = LANGUAGE_BINDING_NAME; | |
96 | + } | |
97 | + | |
98 | +} | ... | ... |
... | ... | @@ -0,0 +1,143 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | + * | |
21 | + * Este programa está nomeado como get.cc e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + * Referência: | |
29 | + * | |
30 | + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes | |
31 | + * | |
32 | + */ | |
33 | + | |
34 | + #include "globals.hpp" | |
35 | + #include <exception> | |
36 | + #include <com/sun/star/uno/RuntimeException.hdl> | |
37 | + #include <com/sun/star/lang/IllegalArgumentException.hpp> | |
38 | + #include "pw3270/lib3270.hpp" | |
39 | + | |
40 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
41 | + | |
42 | + using namespace pw3270_impl; | |
43 | + using namespace com::sun::star::uno; | |
44 | + | |
45 | + ::sal_Int16 SAL_CALL session_impl::setSessionName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException) | |
46 | + { | |
47 | + if(hSession) | |
48 | + { | |
49 | + // Remove old session | |
50 | + delete hSession; | |
51 | + hSession = NULL; | |
52 | + } | |
53 | + | |
54 | + OString vlr = rtl::OUStringToOString( name , RTL_TEXTENCODING_UNICODE ); | |
55 | + | |
56 | + trace("%s(\"%s\")",__FUNCTION__,vlr.getStr()); | |
57 | + | |
58 | + try | |
59 | + { | |
60 | + string charset; | |
61 | + | |
62 | + hSession = h3270::session::create(((const char *) vlr.getStr())); | |
63 | + | |
64 | + trace("%s: hSession(\"%s\"=%p",__FUNCTION__,vlr.getStr(),hSession); | |
65 | + | |
66 | + } catch(std::exception &e) | |
67 | + { | |
68 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
69 | + | |
70 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
71 | + | |
72 | + return -1; | |
73 | + | |
74 | + } | |
75 | + | |
76 | + string charset = hSession->get_display_charset(); | |
77 | + | |
78 | + trace("Charset=\"%s\"",charset.c_str()); | |
79 | + | |
80 | + if(!charset.compare("ISO-8859-1")) | |
81 | + { | |
82 | + encoding = RTL_TEXTENCODING_ISO_8859_1; | |
83 | + } | |
84 | + else if(!charset.compare("UTF-8")) | |
85 | + { | |
86 | + encoding = RTL_TEXTENCODING_UTF8; | |
87 | + } | |
88 | + else | |
89 | + { | |
90 | + string s = "Unable to convert the host's display charset " + charset + "."; | |
91 | + | |
92 | + throw lang::IllegalArgumentException( | |
93 | + OUString( RTL_CONSTASCII_USTRINGPARAM(s.c_str()) ), | |
94 | + (::cppu::OWeakObject *)this, | |
95 | + 0 ); | |
96 | + | |
97 | + } | |
98 | + | |
99 | + return 0; | |
100 | + | |
101 | + } | |
102 | + | |
103 | + ::sal_Int16 SAL_CALL session_impl::setHost( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException) | |
104 | + { | |
105 | + if(!hSession) | |
106 | + hSession = h3270::session::get_default(); | |
107 | + | |
108 | + OString vlr = rtl::OUStringToOString( url , RTL_TEXTENCODING_UNICODE ); | |
109 | + | |
110 | + try | |
111 | + { | |
112 | + | |
113 | + return hSession->set_url(vlr.getStr()); | |
114 | + | |
115 | + } catch(std::exception &e) | |
116 | + { | |
117 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
118 | + | |
119 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
120 | + | |
121 | + } | |
122 | + | |
123 | + return -1; | |
124 | + } | |
125 | + | |
126 | + ::sal_Int16 SAL_CALL session_impl::setTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str ) throw (::com::sun::star::uno::RuntimeException) | |
127 | + { | |
128 | + try | |
129 | + { | |
130 | + CHECK_SESSION_HANDLE | |
131 | + OString vlr = rtl::OUStringToOString(str,encoding); | |
132 | + return hSession->set_text_at(row,col,vlr.getStr()); | |
133 | + | |
134 | + } catch(std::exception &e) | |
135 | + { | |
136 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
137 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
138 | + } | |
139 | + | |
140 | + return -1; | |
141 | + | |
142 | + } | |
143 | + | ... | ... |
No preview for this file type
... | ... | @@ -0,0 +1,148 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | + * | |
21 | + * Este programa está nomeado como testprogram.cc e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
29 | + | |
30 | + #include "globals.hpp" | |
31 | + | |
32 | + #include <cppuhelper/bootstrap.hxx> | |
33 | + #include <com/sun/star/bridge/XUnoUrlResolver.hpp> | |
34 | + #include <com/sun/star/lang/XMultiServiceFactory.hpp> | |
35 | + | |
36 | + #include "pw3270/lib3270.hpp" | |
37 | + | |
38 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
39 | + | |
40 | +using namespace com::sun::star::uno; | |
41 | +using namespace com::sun::star::lang; | |
42 | +using namespace com::sun::star::bridge; | |
43 | +using namespace rtl; | |
44 | +using namespace cppu; | |
45 | + | |
46 | +int SAL_CALL main(int argc, char **argv) | |
47 | +{ | |
48 | + Reference< XComponentContext > rComponentContext = defaultBootstrap_InitialComponentContext(); | |
49 | + OSL_ENSURE( xContext.is(), "### cannot creage intial component context!" ); | |
50 | + | |
51 | +/* | |
52 | + Reference< XSimpleRegistry > xReg = DefaultRegistry(); | |
53 | + | |
54 | + Reference< XSimpleRegistry > xReg = createSimpleRegistry(); | |
55 | + | |
56 | + OSL_ENSURE( xReg.is(), "### cannot get service instance of \"SimpleRegistry\"!" ); | |
57 | + | |
58 | + xReg->open(OUString::createFromAscii("pw3270.rdb"), sal_False, sal_False); | |
59 | + | |
60 | + OSL_ENSURE( xReg->isValid(), "### cannot open test registry \"pw3270.rdb\"!" ); | |
61 | + | |
62 | + | |
63 | + TRACE("%s","Calling bootstrap_InitialComponentContext"); | |
64 | + Reference< XComponentContext > xContext = bootstrap_InitialComponentContext(xReg); | |
65 | + OSL_ENSURE( xContext.is(), "### cannot creage intial component context!" ); | |
66 | + | |
67 | + TRACE("%s","Calling getServiceManager\n"); | |
68 | + Reference< XMultiComponentFactory > xMgr = xContext->getServiceManager(); | |
69 | + OSL_ENSURE( xMgr.is(), "### cannot get initial service manager!" ); | |
70 | + | |
71 | + // register my component | |
72 | + TRACE("%s","Calling createInstanceWithContext"); | |
73 | + | |
74 | + Reference< XImplementationRegistration > xImplReg( | |
75 | + xMgr->createInstanceWithContext(OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration"), xContext), UNO_QUERY); | |
76 | + OSL_ENSURE( xImplReg.is(), "### cannot get service instance of \"com.sun.star.registry.ImplementationRegistration\"!" ); | |
77 | + | |
78 | + if (xImplReg.is()) | |
79 | + { | |
80 | + const char *libname = LIBNAME; | |
81 | + | |
82 | + TRACE("Loading %s",libname); | |
83 | + | |
84 | + xImplReg->registerImplementation( | |
85 | + OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), // loader for component | |
86 | + OUString::createFromAscii(libname), // component location | |
87 | + Reference< XSimpleRegistry >() // registry omitted, | |
88 | + // defaulting to service manager registry used | |
89 | + ); | |
90 | + | |
91 | + // get an object instance | |
92 | + printf("Calling createInstanceWithContext(%s)\n",IMPLNAME); | |
93 | + | |
94 | + Reference< XInterface > xx ; | |
95 | + xx = xMgr->createInstanceWithContext(OUString::createFromAscii(IMPLNAME), xContext); | |
96 | + | |
97 | + printf("Instance: %p\n",&xx); | |
98 | + | |
99 | + Reference< pw3270intf > srv( xx, UNO_QUERY ); | |
100 | + | |
101 | + OSL_ENSURE( srv.is(), "### cannot get service instance!"); | |
102 | + | |
103 | + printf("object.is(): %d\n",srv.is()); | |
104 | + | |
105 | + if(srv.is()) | |
106 | + { | |
107 | + // Wait for commands | |
108 | + OString str; | |
109 | + char buffer[80]; | |
110 | + printf("getConnectionState: %d\n", srv->getConnectionState()); | |
111 | + | |
112 | + str = OUStringToOString( srv->getVersion(),RTL_TEXTENCODING_UTF8); | |
113 | + printf("Version:\t%s\n",str.pData->buffer); | |
114 | + | |
115 | + str = OUStringToOString( srv->getRevision(),RTL_TEXTENCODING_UTF8); | |
116 | + printf("Revision:\t%s\n",str.pData->buffer); | |
117 | + | |
118 | + printf("Connect(): %d\n" , srv->Connect(OUString::createFromAscii("L:3270.df.bb:9023"),10)); | |
119 | + | |
120 | + sleep(5); | |
121 | + | |
122 | + //str = OUStringToOString( srv->getScreenContentAt(20,39,5),RTL_TEXTENCODING_UTF8); | |
123 | + //Trace("ContentsAt(20,39): \"%s\"",str.pData->buffer); | |
124 | + printf("waitForStringAt(SISBB) returned %d\n",srv->waitForStringAt(20,39,OUString::createFromAscii("SISBB"),20)); | |
125 | + printf("sendEnterKey() returned %d\n",srv->sendEnterKey()); | |
126 | + printf("waitForStringAt(Senha) returned %d\n",srv->waitForStringAt(14,2,OUString::createFromAscii("Senha"),20)); | |
127 | + printf("setStringAt returned %d\n",srv->setStringAt(13,21,OUString::createFromAscii("c1103788"))); | |
128 | + | |
129 | + str = OUStringToOString( srv->getScreenContent(),RTL_TEXTENCODING_UTF8); | |
130 | + printf("Entire screen:\n%s\n",str.pData->buffer); | |
131 | + | |
132 | + printf("Enter to exit...\n"); | |
133 | + fgets(buffer,80,stdin); | |
134 | + | |
135 | + printf("Disconnect(): %d\n" , srv->Disconnect()); | |
136 | + | |
137 | + sleep(5); | |
138 | + | |
139 | + } | |
140 | + } | |
141 | + | |
142 | + | |
143 | + Reference< XComponent >::query( xContext )->dispose(); | |
144 | + | |
145 | +*/ | |
146 | + | |
147 | + return 0; | |
148 | +} | ... | ... |
src/openoffice/Makefile.in
... | ... | @@ -1,192 +0,0 @@ |
1 | -# | |
2 | -# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | -# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | -# aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | -# | |
6 | -# Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | -# | |
8 | -# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | -# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | -# Free Software Foundation. | |
11 | -# | |
12 | -# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | -# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | -# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | -# obter mais detalhes. | |
16 | -# | |
17 | -# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | -# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | -# Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | -# | |
21 | -# Contatos: | |
22 | -# | |
23 | -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
24 | -# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
25 | -# | |
26 | - | |
27 | -PACKAGE_NAME=@PACKAGE_NAME@ | |
28 | -SOURCES=info.cc get.cc set.cc service.cc init.cc connect.cc | |
29 | - | |
30 | -UNO_CLASSES= /com/sun/star/uno/XWeak \ | |
31 | - /com/sun/star/uno/RuntimeException \ | |
32 | - /com/sun/star/lang/WrappedTargetException | |
33 | - | |
34 | - | |
35 | -#---[ LibreOffice SDK ]-------------------------------------------------------- | |
36 | - | |
37 | -OO_SDK_HOME=@OO_SDK_HOME@ | |
38 | -OO_SDK_URE_HOME=@OO_SDK_URE_HOME@ | |
39 | - | |
40 | -UNO=@UNO@ | |
41 | -UNOPKG=@UNOPKG@ | |
42 | -IDLC=@IDLC@ | |
43 | -REGMERGE=@REGMERGE@ | |
44 | -CPPUMAKER=@CPPUMAKER@ | |
45 | -CONVERT=@CONVERT@ | |
46 | -ZIP=@ZIP@ | |
47 | - | |
48 | -TYPES_RDB=@OO_SDK_URE_HOME@/share/misc/types.rdb | |
49 | - | |
50 | -#---[ Paths ]------------------------------------------------------------------ | |
51 | - | |
52 | -prefix=@prefix@ | |
53 | -exec_prefix=@exec_prefix@ | |
54 | -bindir=@bindir@ | |
55 | -sbindir=@sbindir@ | |
56 | -libdir=@libdir@ | |
57 | -includedir=@includedir@ | |
58 | - | |
59 | -#---[ Tools ]------------------------------------------------------------------ | |
60 | - | |
61 | -CXX=@CXX@ | |
62 | -MKDIR=@MKDIR_P@ | |
63 | - | |
64 | -#---[ Paths ]------------------------------------------------------------------ | |
65 | - | |
66 | -OBJDIR=.obj | |
67 | -BINDIR=.bin | |
68 | -RDBDIR=.rdb | |
69 | -URDDIR=.urd | |
70 | - | |
71 | -OBJDBG=$(OBJDIR)/Debug | |
72 | -BINDBG=$(BINDIR)/Debug | |
73 | - | |
74 | -OBJRLS=$(OBJDIR)/Release | |
75 | -BINRLS=$(BINDIR)/Release | |
76 | - | |
77 | -#---[ lib3270 common class ]--------------------------------------------------- | |
78 | - | |
79 | -DEBUG_CFLAGS=-DDEBUG=1 -g -Wall | |
80 | -PW3270_CFLAGS=-I../include | |
81 | -CLASSLIBDIR=../classlib | |
82 | -include $(CLASSLIBDIR)/class.mak | |
83 | - | |
84 | -#---[ Build options ]---------------------------------------------------------- | |
85 | - | |
86 | -CPPUENV="gcc3" | |
87 | -CXXFLAGS=@CXXFLAGS@ -fvisibility=hidden @DLL_CFLAGS@ -Wno-strict-aliasing -I../include -I./include -I$(includedir)/libreoffice -Wno-strict-aliasing -DCPPU_ENV=$(CPPUENV) -DLANGUAGE_BINDING_NAME=\"$(CPPUENV)\" | |
88 | - | |
89 | -OO_LDFLAGS=-L$(OO_SDK_HOME)/lib -L$(OO_SDK_URE_HOME)/lib \ | |
90 | - -Wl,-rpath-link=$(OO_SDK_URE_HOME)/lib,-rpath=$(OO_SDK_URE_HOME)/lib \ | |
91 | - -luno_cppu -luno_cppuhelpergcc3 -luno_salhelpergcc3 | |
92 | - | |
93 | -#---[ Rules ]------------------------------------------------------------------ | |
94 | - | |
95 | -$(URDDIR)/%.urd: %.idl | |
96 | - @echo " IDLC `basename $@`" | |
97 | - @$(MKDIR) `dirname $@` | |
98 | - @$(IDLC) -C -I$(OO_SDK_HOME)/idl -O`dirname $@` $< | |
99 | - | |
100 | -$(URDDIR)/%.urd: /usr/share/idl/libreoffice/%.idl | |
101 | - @echo " IDLC `basename $@`" | |
102 | - @$(MKDIR) `dirname $@` | |
103 | - @$(IDLC) -C -I$(OO_SDK_HOME)/idl -O`dirname $@` $< | |
104 | - | |
105 | -$(RDBDIR)/%.rdb: $(URDDIR)/%.urd | |
106 | - @echo " REGM `basename $@`" | |
107 | - @$(MKDIR) `dirname $@` | |
108 | - @$(REGMERGE) $@ /UCR $< | |
109 | - | |
110 | -include/%.hpp: $(RDBDIR)/%.rdb | |
111 | - @echo " CPPU `basename $@`" | |
112 | - @$(MKDIR) `dirname $@` | |
113 | - @$(CPPUMAKER) -O./include $(TYPES_RDB) $< | |
114 | - | |
115 | -$(OBJDBG)/%.o: %.cc include/$(PACKAGE_NAME)/lib3270.hpp \ | |
116 | - $(foreach CLS, $(UNO_CLASSES), include/$(CLS).hpp) \ | |
117 | - *.hpp Makefile | |
118 | - @echo " CC `basename $@`" | |
119 | - @mkdir -p `dirname $@` | |
120 | - @$(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ -c $< | |
121 | -# $(DBG_CFLAGS) $(CXXFLAGS) $(LIB3270_CFLAGS) -DLIBNAME=\"$(BINDBG)/$(PROGRAM_NAME).uno@DLLEXT@\" -o $@ -c $< | |
122 | - | |
123 | -#---[ UNO targets ]------------------------------------------------------------ | |
124 | - | |
125 | -include/$(PACKAGE_NAME)/lib3270.hpp: $(RDBDIR)/$(PACKAGE_NAME).rdb | |
126 | - @echo " CPPU `basename $@`" | |
127 | - @$(MKDIR) `dirname $@` | |
128 | - @$(CPPUMAKER) -O./include -T$(PACKAGE_NAME).lib3270 $(TYPES_RDB) $< | |
129 | - | |
130 | - | |
131 | -#---[ Debug targets ]---------------------------------------------------------- | |
132 | - | |
133 | -Debug: $(BINDBG)/$(PACKAGE_NAME).oxt | |
134 | - | |
135 | -run: $(BINDBG)/$(PACKAGE_NAME).oxt | |
136 | - @SHARED=false $(UNOPKG) add --verbose --force $(BINDBG)/$(PACKAGE_NAME).oxt | |
137 | - @libreoffice testmacros.odt | |
138 | - @SHARED=false $(UNOPKG) remove $(PACKAGE_NAME) | |
139 | - | |
140 | -add: $(BINDBG)/$(PACKAGE_NAME).oxt | |
141 | - @SHARED=false $(UNOPKG) add --verbose --force $(BINDBG)/$(PACKAGE_NAME).oxt | |
142 | - | |
143 | -$(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@: \ | |
144 | - $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) \ | |
145 | - $(CLASS_DEBUG_OBJECTS) | |
146 | - @echo " LD `basename $@`" | |
147 | - @$(MKDIR) `dirname $@` | |
148 | - $(CXX) -shared $(LDFLAGS) $(OO_LDFLAGS) $(CLASS_LIBS) -o $@ $^ | |
149 | - | |
150 | - | |
151 | -$(BINDBG)/$(PACKAGE_NAME).oxt: \ | |
152 | - $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ \ | |
153 | - $(RDBDIR)/$(PACKAGE_NAME).rdb \ | |
154 | - description.xml \ | |
155 | - manifest.xml \ | |
156 | - description.txt | |
157 | - @rm -f $@ | |
158 | - @$(MKDIR) `dirname $@` | |
159 | - | |
160 | - @$(MKDIR) $(BINDBG)/$(PACKAGE).oxt.tmp | |
161 | - | |
162 | - @cp $(RDBDIR)/$(PACKAGE_NAME).rdb $(BINDBG)/$(PACKAGE).oxt.tmp | |
163 | - @cp $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ $(BINDBG)/$(PACKAGE).oxt.tmp | |
164 | - | |
165 | - @$(MKDIR) $(BINDBG)/$(PACKAGE).oxt.tmp/META-INF | |
166 | - @cp manifest.xml $(BINDBG)/$(PACKAGE).oxt.tmp/META-INF | |
167 | - | |
168 | - @cp description.xml $(BINDBG)/$(PACKAGE).oxt.tmp | |
169 | - @cp description.txt $(BINDBG)/$(PACKAGE).oxt.tmp | |
170 | - | |
171 | - @$(CONVERT) ../$(PACKAGE_NAME)/pixmaps/$(PACKAGE_NAME).svg --format=png > $(BINDBG)/$(PACKAGE).oxt.tmp/$(PACKAGE_NAME).png | |
172 | - | |
173 | - @cp $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ $(BINDBG)/$(PACKAGE_NAME).oxt.tmp | |
174 | - @cd $(BINDBG)/$(PACKAGE).oxt.tmp ; $(ZIP) -r -m ../$(PACKAGE_NAME).oxt . | |
175 | - @rm -fr $(BINDBG)/$(PACKAGE).oxt.tmp | |
176 | - @echo $@ Ok. | |
177 | - | |
178 | - | |
179 | -#---[ Misc targets ]----------------------------------------------------------- | |
180 | - | |
181 | -cleanDebug: clean | |
182 | - | |
183 | -clean: | |
184 | - @rm -f *.urd | |
185 | - @rm -fr $(RDBDIR) | |
186 | - @rm -fr $(URDDIR) | |
187 | - @rm -fr include | |
188 | - @rm -f *.rdb | |
189 | - @rm -fr $(OBJDIR) | |
190 | - @rm -fr $(BINDIR) | |
191 | - | |
192 | - |
src/openoffice/connect.cc
... | ... | @@ -1,87 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | - * | |
21 | - * Este programa está nomeado como connect.cc e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - * | |
29 | - */ | |
30 | - | |
31 | - #include "globals.hpp" | |
32 | - #include "pw3270/lib3270.hpp" | |
33 | - #include <exception> | |
34 | - #include <com/sun/star/uno/RuntimeException.hdl> | |
35 | - | |
36 | -/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
37 | - | |
38 | - using namespace pw3270_impl; | |
39 | - | |
40 | - ::sal_Int16 SAL_CALL session_impl::Connect() throw (::com::sun::star::uno::RuntimeException) | |
41 | - { | |
42 | - trace("%s: hSession=%p",__FUNCTION__,hSession); | |
43 | - | |
44 | - try | |
45 | - { | |
46 | - if(!hSession) | |
47 | - hSession = h3270::session::get_default(); | |
48 | - | |
49 | - return hSession->connect(false); | |
50 | - | |
51 | - } catch(std::exception &e) | |
52 | - { | |
53 | - trace("%s failed: %s",__FUNCTION__,e.what()); | |
54 | - | |
55 | - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
56 | - | |
57 | - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
58 | - | |
59 | - } | |
60 | - | |
61 | - return -1; | |
62 | - | |
63 | - | |
64 | - } | |
65 | - | |
66 | - ::sal_Int16 SAL_CALL session_impl::Disconnect() throw (::com::sun::star::uno::RuntimeException) | |
67 | - { | |
68 | - try | |
69 | - { | |
70 | - if(!hSession) | |
71 | - hSession = h3270::session::get_default(); | |
72 | - | |
73 | - return hSession->disconnect(); | |
74 | - | |
75 | - } catch(std::exception &e) | |
76 | - { | |
77 | - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
78 | - | |
79 | - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
80 | - | |
81 | - } | |
82 | - | |
83 | - return -1; | |
84 | - | |
85 | - } | |
86 | - | |
87 | - |
src/openoffice/description.txt
src/openoffice/description.xml.in
... | ... | @@ -1,30 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<description xmlns="http://openoffice.org/extensions/description/2006" | |
3 | -xmlns:d="http://openoffice.org/extensions/description/2006" | |
4 | -xmlns:xlink="http://www.w3.org/1999/xlink"> | |
5 | - | |
6 | - <version value="@PACKAGE_VERSION@" /> | |
7 | - | |
8 | - <identifier value="@PACKAGE_NAME@" /> | |
9 | - | |
10 | - <platform value="linux_@host_cpu@" /> | |
11 | - | |
12 | - <dependencies> | |
13 | - <OpenOffice.org-minimal-version value="2.2" d:name="OpenOffice.org 2.2"/> | |
14 | - </dependencies> | |
15 | - | |
16 | - <display-name> | |
17 | - <name lang="en">3270 access extension</name> | |
18 | - </display-name> | |
19 | - | |
20 | - <icon> | |
21 | - <default xlink:href="@PACKAGE_NAME@.png" /> | |
22 | - </icon> | |
23 | - | |
24 | - <extension-description> | |
25 | - <src xlink:href="description.txt" lang="en" /> | |
26 | - </extension-description> | |
27 | - | |
28 | - | |
29 | - | |
30 | -</description> |
src/openoffice/get.cc
... | ... | @@ -1,52 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | - * | |
21 | - * Este programa está nomeado como get.cc e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - * Referência: | |
29 | - * | |
30 | - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes | |
31 | - * | |
32 | - */ | |
33 | - | |
34 | - #include "globals.hpp" | |
35 | - #include <lib3270/config.h> | |
36 | - #include "pw3270/lib3270.hpp" | |
37 | - | |
38 | -/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
39 | - | |
40 | - using namespace pw3270_impl; | |
41 | - | |
42 | - ::rtl::OUString session_impl::getVersion() throw (RuntimeException) | |
43 | - { | |
44 | - trace("%s: hSession=%p",__FUNCTION__,hSession); | |
45 | - return OUString( RTL_CONSTASCII_USTRINGPARAM(PACKAGE_VERSION) ); | |
46 | - } | |
47 | - | |
48 | - ::rtl::OUString session_impl::getRevision() throw (RuntimeException) | |
49 | - { | |
50 | - trace("%s: hSession=%p",__FUNCTION__,hSession); | |
51 | - return OUString( RTL_CONSTASCII_USTRINGPARAM(PACKAGE_REVISION) ); | |
52 | - } |
src/openoffice/globals.hpp
... | ... | @@ -1,124 +0,0 @@ |
1 | -/* | |
2 | - * "Software PW3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | - * | |
21 | - * Este programa está nomeado como globals.hpp e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
27 | - * | |
28 | - * Referências: | |
29 | - * | |
30 | - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/C%2B%2B_Component | |
31 | - * | |
32 | - * | |
33 | - */ | |
34 | - | |
35 | -#ifndef PW3270_OXT_GLOBALS_HPP_INCLUDED | |
36 | - | |
37 | - #define PW3270_OXT_GLOBALS_HPP_INCLUDED 1 | |
38 | - | |
39 | - #define CPPUENV "gcc3" | |
40 | - | |
41 | - #ifdef _WIN32 | |
42 | - #define SAL_W32 | |
43 | - #else | |
44 | - #define UNX 1 | |
45 | - #define GCC 1 | |
46 | - #define LINUX 1 | |
47 | - #define HAVE_GCC_VISIBILITY_FEATURE 1 | |
48 | - #endif | |
49 | - | |
50 | - | |
51 | - #include <cppuhelper/implbase4.hxx> // "3" implementing three interfaces | |
52 | - #include <cppuhelper/factory.hxx> | |
53 | - #include <com/sun/star/lang/XInitialization.hpp> | |
54 | -// #include <cppuhelper/implementationentry.hxx> | |
55 | - #include <com/sun/star/lang/XServiceInfo.hpp> | |
56 | - | |
57 | -#ifdef DEBUG | |
58 | - #include <com/sun/star/lang/XMain.hpp> | |
59 | -#endif // DEBUG | |
60 | - | |
61 | - #include <com/sun/star/uno/RuntimeException.hpp> | |
62 | - | |
63 | - #ifdef DEBUG | |
64 | - #include <stdio.h> | |
65 | - #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | |
66 | - #else | |
67 | - #define trace(x, ...) // __VA_ARGS__ | |
68 | - #endif | |
69 | - | |
70 | - #include <pw3270/lib3270.hpp> | |
71 | - #include <pw3270/class.h> | |
72 | - | |
73 | - #define DLL_PUBLIC __attribute__((visibility("default"))) | |
74 | - | |
75 | - using namespace ::rtl; // for OUString | |
76 | - using namespace ::com::sun::star; // for sdk interfaces | |
77 | - using namespace ::com::sun::star::lang; // for sdk interfaces | |
78 | - using namespace ::com::sun::star::uno; // for basic types | |
79 | - using namespace PW3270_NAMESPACE; | |
80 | - | |
81 | - namespace pw3270_impl | |
82 | - { | |
83 | - // https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes | |
84 | - class DLL_PUBLIC session_impl : public ::cppu::WeakImplHelper4< ::pw3270::lib3270, XServiceInfo, XMain, XInitialization > | |
85 | - { | |
86 | - public: | |
87 | - | |
88 | - session_impl(); | |
89 | - virtual ~session_impl(); | |
90 | - | |
91 | - // XMain | |
92 | - virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aArguments ) throw (Exception); | |
93 | - | |
94 | - // XInitialization will be called upon createInstanceWithArguments[AndContext]() | |
95 | - virtual void SAL_CALL initialize( Sequence< Any > const & args ) throw (Exception); | |
96 | - | |
97 | - // XServiceInfo | |
98 | - virtual OUString SAL_CALL getImplementationName() throw (RuntimeException); | |
99 | - virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName ) throw (RuntimeException); | |
100 | - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); | |
101 | - | |
102 | - // lib3270 | |
103 | - virtual ::rtl::OUString SAL_CALL getVersion() throw (RuntimeException); | |
104 | - virtual ::rtl::OUString SAL_CALL getRevision() throw (RuntimeException); | |
105 | - | |
106 | - virtual ::sal_Int16 SAL_CALL setSessionName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException); | |
107 | - | |
108 | - virtual ::sal_Int16 SAL_CALL setHost( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException); | |
109 | - virtual ::sal_Int16 SAL_CALL Connect() throw (::com::sun::star::uno::RuntimeException); | |
110 | - virtual ::sal_Int16 SAL_CALL Disconnect() throw (::com::sun::star::uno::RuntimeException); | |
111 | - | |
112 | - private: | |
113 | - h3270::session *hSession; | |
114 | - | |
115 | - }; | |
116 | - | |
117 | - extern Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl(); | |
118 | - extern OUString SAL_CALL getImplementationName_session_impl(); | |
119 | - extern Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () ); | |
120 | - | |
121 | - }; | |
122 | - | |
123 | - | |
124 | -#endif // PW3270_OXT_GLOBALS_HPP_INCLUDED |
src/openoffice/info.cc
... | ... | @@ -1,58 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | - * | |
21 | - * Este programa está nomeado como info.cc e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - * Referência: | |
29 | - * | |
30 | - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes | |
31 | - * | |
32 | - */ | |
33 | - | |
34 | - #include "globals.hpp" | |
35 | - #include "pw3270/lib3270.hpp" | |
36 | - | |
37 | -/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
38 | - | |
39 | -using namespace pw3270_impl; | |
40 | - | |
41 | -// XServiceInfo implementation | |
42 | -OUString session_impl::getImplementationName() throw (RuntimeException) | |
43 | -{ | |
44 | - // unique implementation name | |
45 | - return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.pw3270_impl.session") ); | |
46 | -} | |
47 | - | |
48 | -sal_Bool session_impl::supportsService( OUString const & serviceName ) throw (RuntimeException) | |
49 | -{ | |
50 | - // this object only supports one service, so the test is simple | |
51 | - return serviceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("pw3270.session") ); | |
52 | -} | |
53 | - | |
54 | -Sequence< OUString > session_impl::getSupportedServiceNames() throw (RuntimeException) | |
55 | -{ | |
56 | - return getSupportedServiceNames_session_impl(); | |
57 | -} | |
58 | - |
src/openoffice/init.cc
... | ... | @@ -1,79 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | - * | |
21 | - * Este programa está nomeado como init.cc e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - * Referência: | |
29 | - * | |
30 | - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Create_Instance_with_Arguments | |
31 | - * | |
32 | - */ | |
33 | - | |
34 | - #include "globals.hpp" | |
35 | - #include <com/sun/star/lang/IllegalArgumentException.hpp> | |
36 | - #include "pw3270/lib3270.hpp" | |
37 | - | |
38 | -/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
39 | - | |
40 | -using namespace pw3270_impl; | |
41 | - | |
42 | - | |
43 | -session_impl::session_impl() | |
44 | -{ | |
45 | - this->hSession = NULL; | |
46 | -} | |
47 | - | |
48 | -session_impl::~session_impl() | |
49 | -{ | |
50 | - if(this->hSession) | |
51 | - delete this->hSession; | |
52 | -} | |
53 | - | |
54 | - | |
55 | -// XInitialization implementation | |
56 | -void session_impl::initialize( Sequence< Any > const & args ) throw (Exception) | |
57 | -{ | |
58 | - if (1 != args.getLength()) | |
59 | - { | |
60 | - throw lang::IllegalArgumentException( | |
61 | - OUString( RTL_CONSTASCII_USTRINGPARAM("give a string instanciating this component!") ), | |
62 | - (::cppu::OWeakObject *)this, | |
63 | - 0 ); | |
64 | - } | |
65 | - | |
66 | - // Initialize | |
67 | - | |
68 | - // TODO: Get arguments. | |
69 | - | |
70 | - | |
71 | -} | |
72 | - | |
73 | -// XMain | |
74 | -::sal_Int32 SAL_CALL session_impl::run( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aArguments ) throw (Exception) | |
75 | -{ | |
76 | - | |
77 | - | |
78 | - return 0; | |
79 | -} |
src/openoffice/loffice3270.cbp
... | ... | @@ -1,64 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | |
2 | -<CodeBlocks_project_file> | |
3 | - <FileVersion major="1" minor="6" /> | |
4 | - <Project> | |
5 | - <Option title="pw3270 openOffice" /> | |
6 | - <Option makefile_is_custom="1" /> | |
7 | - <Option pch_mode="2" /> | |
8 | - <Option compiler="gcc" /> | |
9 | - <Build> | |
10 | - <Target title="Debug"> | |
11 | - <Option output=".bin/Debug/pw3270 LibreOffice" prefix_auto="1" extension_auto="1" /> | |
12 | - <Option object_output=".obj/Debug/" /> | |
13 | - <Option type="1" /> | |
14 | - <Option compiler="gcc" /> | |
15 | - <Compiler> | |
16 | - <Add option="-g" /> | |
17 | - </Compiler> | |
18 | - </Target> | |
19 | - <Target title="Release"> | |
20 | - <Option output=".bin/Release/pw3270 LibreOffice" prefix_auto="1" extension_auto="1" /> | |
21 | - <Option object_output=".obj/Release/" /> | |
22 | - <Option type="1" /> | |
23 | - <Option compiler="gcc" /> | |
24 | - <Compiler> | |
25 | - <Add option="-O2" /> | |
26 | - </Compiler> | |
27 | - <Linker> | |
28 | - <Add option="-s" /> | |
29 | - </Linker> | |
30 | - </Target> | |
31 | - </Build> | |
32 | - <Compiler> | |
33 | - <Add option="-Wall" /> | |
34 | - </Compiler> | |
35 | - <Unit filename="../../configure.ac" /> | |
36 | - <Unit filename="../classlib/Makefile.in" /> | |
37 | - <Unit filename="../classlib/class.mak" /> | |
38 | - <Unit filename="../classlib/class.mak.in" /> | |
39 | - <Unit filename="../classlib/exception.cc" /> | |
40 | - <Unit filename="../classlib/local.cc" /> | |
41 | - <Unit filename="../classlib/remote.cc" /> | |
42 | - <Unit filename="../classlib/session.cc" /> | |
43 | - <Unit filename="../include/pw3270/class.h" /> | |
44 | - <Unit filename="Makefile.in" /> | |
45 | - <Unit filename="connect.cc" /> | |
46 | - <Unit filename="get.cc" /> | |
47 | - <Unit filename="globals.hpp" /> | |
48 | - <Unit filename="include/pw3270/lib3270.hdl" /> | |
49 | - <Unit filename="include/pw3270/lib3270.hpp" /> | |
50 | - <Unit filename="info.cc" /> | |
51 | - <Unit filename="init.cc" /> | |
52 | - <Unit filename="manifest.xml.in" /> | |
53 | - <Unit filename="pw3270.idl" /> | |
54 | - <Unit filename="service.cc" /> | |
55 | - <Unit filename="set.cc" /> | |
56 | - <Unit filename="testprogram.cc" /> | |
57 | - <Extensions> | |
58 | - <code_completion /> | |
59 | - <envvars /> | |
60 | - <debugger /> | |
61 | - <lib_finder disable_auto="1" /> | |
62 | - </Extensions> | |
63 | - </Project> | |
64 | -</CodeBlocks_project_file> |
src/openoffice/manifest.xml.in
... | ... | @@ -1,6 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<manifest:manifest> | |
3 | -<manifest:file-entry manifest:media-type= "application/vnd.sun.star.uno-component;type=native;platform=Linux_@host_cpu@" manifest:full-path="@PACKAGE_NAME@.uno.so"/> | |
4 | -<manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB" manifest:full-path="@PACKAGE_NAME@.rdb"/> | |
5 | -</manifest:manifest> | |
6 | - |
src/openoffice/pw3270.idl
... | ... | @@ -1,66 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | - * | |
21 | - * Este programa está nomeado como pw3270.idl e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - * | |
29 | - * Referências: | |
30 | - * | |
31 | - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C++/C++_Component | |
32 | - * | |
33 | - */ | |
34 | - | |
35 | -#include <com/sun/star/uno/XInterface.idl> | |
36 | -#include <com/sun/star/lang/XInitialization.idl> | |
37 | -#include <com/sun/star/lang/XMain.idl> | |
38 | - | |
39 | -module pw3270 | |
40 | -{ | |
41 | - /* | |
42 | - * Interface to lib3270 | |
43 | - */ | |
44 | - interface lib3270 : com::sun::star::uno::XInterface | |
45 | - { | |
46 | - // Constants | |
47 | - string getVersion(); | |
48 | - string getRevision(); | |
49 | - | |
50 | - // Host definition | |
51 | - short setHost([in] string url); | |
52 | - short Connect(); | |
53 | - short Disconnect(); | |
54 | - | |
55 | - // Misc Settings | |
56 | - short setSessionName([in] string name); | |
57 | - }; | |
58 | - | |
59 | - service session | |
60 | - { | |
61 | - interface lib3270; | |
62 | - interface com::sun::star::lang::XInitialization; | |
63 | - interface com::sun::star::lang::XMain; | |
64 | - }; | |
65 | -}; | |
66 | - |
src/openoffice/research.sh
... | ... | @@ -1,44 +0,0 @@ |
1 | -#!/bin/bash | |
2 | - | |
3 | -OO_SDK_HOME=/usr/lib64/libreoffice/sdk | |
4 | -IDLC=/usr/lib64/libreoffice/sdk/bin/idlc | |
5 | -CPPUMAKER=/usr/lib64/libreoffice/sdk/bin/cppumaker | |
6 | -TYPES_RDB=/usr/lib64/libreoffice/ure/share/misc/types.rdb | |
7 | -REGMERGE=/usr/lib64/libreoffice/ure/bin/regmerge | |
8 | - | |
9 | -$IDLC -C -I$OO_SDK_HOME/idl -O. pw3270.idl | |
10 | -if [ "$?" != "0" ]; then | |
11 | - exit -1 | |
12 | -fi | |
13 | - | |
14 | - | |
15 | -$REGMERGE pw3270.rdb /UCR pw3270.urd | |
16 | -if [ "$?" != "0" ]; then | |
17 | - exit -1 | |
18 | -fi | |
19 | - | |
20 | - | |
21 | -$CPPUMAKER -O./include -Tpw3270.lib3270 $TYPES_RDB pw3270.rdb | |
22 | -if [ "$?" != "0" ]; then | |
23 | - exit -1 | |
24 | -fi | |
25 | - | |
26 | -# XWeak | |
27 | -$IDLC -C -I$OO_SDK_HOME/idl -O. /usr/share/idl/libreoffice/com/sun/star/uno/XWeak.idl | |
28 | -if [ "$?" != "0" ]; then | |
29 | - exit -1 | |
30 | -fi | |
31 | - | |
32 | -$REGMERGE XWeak.rdb /UCR XWeak.urd | |
33 | -if [ "$?" != "0" ]; then | |
34 | - exit -1 | |
35 | -fi | |
36 | - | |
37 | -$CPPUMAKER -O./include $TYPES_RDB XWeak.rdb | |
38 | -if [ "$?" != "0" ]; then | |
39 | - exit -1 | |
40 | -fi | |
41 | - | |
42 | - | |
43 | -echo ok | |
44 | - |
src/openoffice/service.cc
... | ... | @@ -1,98 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | - * | |
21 | - * Este programa está nomeado como info.cc e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - * Referência: | |
29 | - * | |
30 | - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Providing_a_Single_Factory_Using_a_Helper_Method | |
31 | - * | |
32 | - */ | |
33 | - | |
34 | - #include "globals.hpp" | |
35 | - #include <cppuhelper/implementationentry.hxx> | |
36 | - #include "pw3270/lib3270.hpp" | |
37 | - | |
38 | -/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
39 | - | |
40 | -namespace pw3270_impl | |
41 | -{ | |
42 | - Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl() | |
43 | - { | |
44 | - Sequence<OUString> names(1); | |
45 | - names[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("pw3270.session")); | |
46 | - return names; | |
47 | - } | |
48 | - | |
49 | - OUString SAL_CALL getImplementationName_session_impl() | |
50 | - { | |
51 | - return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.lib3270.session") ); | |
52 | - } | |
53 | - | |
54 | - Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () ) | |
55 | - { | |
56 | - return static_cast< lang::XTypeProvider * >( new session_impl() ); | |
57 | - } | |
58 | - | |
59 | - static struct ::cppu::ImplementationEntry s_component_entries [] = | |
60 | - { | |
61 | - { | |
62 | - create_session_impl, | |
63 | - getImplementationName_session_impl, | |
64 | - getSupportedServiceNames_session_impl, | |
65 | - ::cppu::createSingleComponentFactory, | |
66 | - 0, | |
67 | - 0 | |
68 | - }, | |
69 | - { | |
70 | - 0, | |
71 | - 0, | |
72 | - 0, | |
73 | - 0, | |
74 | - 0, | |
75 | - 0 | |
76 | - } | |
77 | - }; | |
78 | - | |
79 | -} | |
80 | - | |
81 | -extern "C" | |
82 | -{ | |
83 | - DLL_PUBLIC void * SAL_CALL component_getFactory(sal_Char const * implName, lang::XMultiServiceFactory * xMgr,registry::XRegistryKey * xRegistry ) | |
84 | - { | |
85 | - return ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry, ::pw3270_impl::s_component_entries ); | |
86 | - } | |
87 | - | |
88 | - DLL_PUBLIC sal_Bool SAL_CALL component_writeInfo(lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry ) | |
89 | - { | |
90 | - return ::cppu::component_writeInfoHelper(xMgr, xRegistry, ::pw3270_impl::s_component_entries ); | |
91 | - } | |
92 | - | |
93 | - DLL_PUBLIC void SAL_CALL component_getImplementationEnvironment(sal_Char const ** ppEnvTypeName, uno_Environment ** ppEnv ) | |
94 | - { | |
95 | - * ppEnvTypeName = LANGUAGE_BINDING_NAME; | |
96 | - } | |
97 | - | |
98 | -} |
src/openoffice/set.cc
... | ... | @@ -1,99 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | - * | |
21 | - * Este programa está nomeado como get.cc e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - * Referência: | |
29 | - * | |
30 | - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes | |
31 | - * | |
32 | - */ | |
33 | - | |
34 | - #include "globals.hpp" | |
35 | - #include <exception> | |
36 | - #include <com/sun/star/uno/RuntimeException.hdl> | |
37 | - #include "pw3270/lib3270.hpp" | |
38 | - | |
39 | -/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
40 | - | |
41 | - using namespace pw3270_impl; | |
42 | - using namespace com::sun::star::uno; | |
43 | - | |
44 | - ::sal_Int16 SAL_CALL session_impl::setSessionName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException) | |
45 | - { | |
46 | - if(hSession) | |
47 | - { | |
48 | - // Remove old session | |
49 | - delete hSession; | |
50 | - hSession = NULL; | |
51 | - } | |
52 | - | |
53 | - OString vlr = rtl::OUStringToOString( name , RTL_TEXTENCODING_UNICODE ); | |
54 | - | |
55 | - trace("%s(\"%s\")",__FUNCTION__,vlr.getStr()); | |
56 | - | |
57 | - try | |
58 | - { | |
59 | - | |
60 | - hSession = h3270::session::create(((const char *) vlr.getStr())); | |
61 | - trace("%s: hSession(\"%s\"=%p",__FUNCTION__,vlr.getStr(),hSession); | |
62 | - | |
63 | - } catch(std::exception &e) | |
64 | - { | |
65 | - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
66 | - | |
67 | - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
68 | - | |
69 | - return -1; | |
70 | - | |
71 | - } | |
72 | - | |
73 | - return 0; | |
74 | - | |
75 | - } | |
76 | - | |
77 | - ::sal_Int16 SAL_CALL session_impl::setHost( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException) | |
78 | - { | |
79 | - if(!hSession) | |
80 | - hSession = h3270::session::get_default(); | |
81 | - | |
82 | - OString vlr = rtl::OUStringToOString( url , RTL_TEXTENCODING_UNICODE ); | |
83 | - | |
84 | - try | |
85 | - { | |
86 | - | |
87 | - return hSession->set_url(vlr.getStr()); | |
88 | - | |
89 | - } catch(std::exception &e) | |
90 | - { | |
91 | - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
92 | - | |
93 | - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
94 | - | |
95 | - } | |
96 | - | |
97 | - return -1; | |
98 | - } | |
99 | - |
src/openoffice/testmacros.odt
No preview for this file type
src/openoffice/testprogram.cc
... | ... | @@ -1,148 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | - * | |
21 | - * Este programa está nomeado como testprogram.cc e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - */ | |
29 | - | |
30 | - #include "globals.hpp" | |
31 | - | |
32 | - #include <cppuhelper/bootstrap.hxx> | |
33 | - #include <com/sun/star/bridge/XUnoUrlResolver.hpp> | |
34 | - #include <com/sun/star/lang/XMultiServiceFactory.hpp> | |
35 | - | |
36 | - #include "pw3270/lib3270.hpp" | |
37 | - | |
38 | -/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
39 | - | |
40 | -using namespace com::sun::star::uno; | |
41 | -using namespace com::sun::star::lang; | |
42 | -using namespace com::sun::star::bridge; | |
43 | -using namespace rtl; | |
44 | -using namespace cppu; | |
45 | - | |
46 | -int SAL_CALL main(int argc, char **argv) | |
47 | -{ | |
48 | - Reference< XComponentContext > rComponentContext = defaultBootstrap_InitialComponentContext(); | |
49 | - OSL_ENSURE( xContext.is(), "### cannot creage intial component context!" ); | |
50 | - | |
51 | -/* | |
52 | - Reference< XSimpleRegistry > xReg = DefaultRegistry(); | |
53 | - | |
54 | - Reference< XSimpleRegistry > xReg = createSimpleRegistry(); | |
55 | - | |
56 | - OSL_ENSURE( xReg.is(), "### cannot get service instance of \"SimpleRegistry\"!" ); | |
57 | - | |
58 | - xReg->open(OUString::createFromAscii("pw3270.rdb"), sal_False, sal_False); | |
59 | - | |
60 | - OSL_ENSURE( xReg->isValid(), "### cannot open test registry \"pw3270.rdb\"!" ); | |
61 | - | |
62 | - | |
63 | - TRACE("%s","Calling bootstrap_InitialComponentContext"); | |
64 | - Reference< XComponentContext > xContext = bootstrap_InitialComponentContext(xReg); | |
65 | - OSL_ENSURE( xContext.is(), "### cannot creage intial component context!" ); | |
66 | - | |
67 | - TRACE("%s","Calling getServiceManager\n"); | |
68 | - Reference< XMultiComponentFactory > xMgr = xContext->getServiceManager(); | |
69 | - OSL_ENSURE( xMgr.is(), "### cannot get initial service manager!" ); | |
70 | - | |
71 | - // register my component | |
72 | - TRACE("%s","Calling createInstanceWithContext"); | |
73 | - | |
74 | - Reference< XImplementationRegistration > xImplReg( | |
75 | - xMgr->createInstanceWithContext(OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration"), xContext), UNO_QUERY); | |
76 | - OSL_ENSURE( xImplReg.is(), "### cannot get service instance of \"com.sun.star.registry.ImplementationRegistration\"!" ); | |
77 | - | |
78 | - if (xImplReg.is()) | |
79 | - { | |
80 | - const char *libname = LIBNAME; | |
81 | - | |
82 | - TRACE("Loading %s",libname); | |
83 | - | |
84 | - xImplReg->registerImplementation( | |
85 | - OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), // loader for component | |
86 | - OUString::createFromAscii(libname), // component location | |
87 | - Reference< XSimpleRegistry >() // registry omitted, | |
88 | - // defaulting to service manager registry used | |
89 | - ); | |
90 | - | |
91 | - // get an object instance | |
92 | - printf("Calling createInstanceWithContext(%s)\n",IMPLNAME); | |
93 | - | |
94 | - Reference< XInterface > xx ; | |
95 | - xx = xMgr->createInstanceWithContext(OUString::createFromAscii(IMPLNAME), xContext); | |
96 | - | |
97 | - printf("Instance: %p\n",&xx); | |
98 | - | |
99 | - Reference< pw3270intf > srv( xx, UNO_QUERY ); | |
100 | - | |
101 | - OSL_ENSURE( srv.is(), "### cannot get service instance!"); | |
102 | - | |
103 | - printf("object.is(): %d\n",srv.is()); | |
104 | - | |
105 | - if(srv.is()) | |
106 | - { | |
107 | - // Wait for commands | |
108 | - OString str; | |
109 | - char buffer[80]; | |
110 | - printf("getConnectionState: %d\n", srv->getConnectionState()); | |
111 | - | |
112 | - str = OUStringToOString( srv->getVersion(),RTL_TEXTENCODING_UTF8); | |
113 | - printf("Version:\t%s\n",str.pData->buffer); | |
114 | - | |
115 | - str = OUStringToOString( srv->getRevision(),RTL_TEXTENCODING_UTF8); | |
116 | - printf("Revision:\t%s\n",str.pData->buffer); | |
117 | - | |
118 | - printf("Connect(): %d\n" , srv->Connect(OUString::createFromAscii("L:3270.df.bb:9023"),10)); | |
119 | - | |
120 | - sleep(5); | |
121 | - | |
122 | - //str = OUStringToOString( srv->getScreenContentAt(20,39,5),RTL_TEXTENCODING_UTF8); | |
123 | - //Trace("ContentsAt(20,39): \"%s\"",str.pData->buffer); | |
124 | - printf("waitForStringAt(SISBB) returned %d\n",srv->waitForStringAt(20,39,OUString::createFromAscii("SISBB"),20)); | |
125 | - printf("sendEnterKey() returned %d\n",srv->sendEnterKey()); | |
126 | - printf("waitForStringAt(Senha) returned %d\n",srv->waitForStringAt(14,2,OUString::createFromAscii("Senha"),20)); | |
127 | - printf("setStringAt returned %d\n",srv->setStringAt(13,21,OUString::createFromAscii("c1103788"))); | |
128 | - | |
129 | - str = OUStringToOString( srv->getScreenContent(),RTL_TEXTENCODING_UTF8); | |
130 | - printf("Entire screen:\n%s\n",str.pData->buffer); | |
131 | - | |
132 | - printf("Enter to exit...\n"); | |
133 | - fgets(buffer,80,stdin); | |
134 | - | |
135 | - printf("Disconnect(): %d\n" , srv->Disconnect()); | |
136 | - | |
137 | - sleep(5); | |
138 | - | |
139 | - } | |
140 | - } | |
141 | - | |
142 | - | |
143 | - Reference< XComponent >::query( xContext )->dispose(); | |
144 | - | |
145 | -*/ | |
146 | - | |
147 | - return 0; | |
148 | -} |
src/plugins/dbus3270/gobject.c
... | ... | @@ -481,7 +481,8 @@ void pw3270_dbus_get_host_charset(PW3270Dbus *object, DBusGMethodInvocation *con |
481 | 481 | |
482 | 482 | void pw3270_dbus_get_display_charset(PW3270Dbus *object, DBusGMethodInvocation *context) |
483 | 483 | { |
484 | - dbus_g_method_return(context,lib3270_get_display_charset(pw3270_dbus_get_session_handle(object))); | |
484 | + // Allways return UTF-8 to avoid double conversion | |
485 | + dbus_g_method_return(context,"UTF-8"); | |
485 | 486 | } |
486 | 487 | |
487 | 488 | void pw3270_dbus_set_host_charset(PW3270Dbus *object, const gchar *charset, DBusGMethodInvocation *context) | ... | ... |
src/plugins/rx3270/pluginmain.cc
... | ... | @@ -100,8 +100,8 @@ |
100 | 100 | int wait(int seconds); |
101 | 101 | int wait_for_ready(int seconds); |
102 | 102 | |
103 | - string * get_text(int baddr, size_t len); | |
104 | - string * get_text_at(int row, int col, size_t sz); | |
103 | + string get_text(int baddr, size_t len); | |
104 | + string get_text_at(int row, int col, size_t sz); | |
105 | 105 | int cmp_text_at(int row, int col, const char *text); |
106 | 106 | int set_text_at(int row, int col, const char *str); |
107 | 107 | |
... | ... | @@ -124,17 +124,17 @@ |
124 | 124 | int get_next_unprotected(int baddr = -1); |
125 | 125 | |
126 | 126 | int set_copy(const char *text); |
127 | - string * get_copy(void); | |
127 | + string get_copy(void); | |
128 | 128 | |
129 | - string * get_clipboard(void); | |
129 | + string get_clipboard(void); | |
130 | 130 | int set_clipboard(const char *text); |
131 | 131 | |
132 | 132 | int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
133 | - string * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); | |
133 | + string file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); | |
134 | 134 | |
135 | 135 | int set_host_charset(const char *charset); |
136 | - string * get_host_charset(void); | |
137 | - string * get_display_charset(void); | |
136 | + string get_host_charset(void); | |
137 | + string get_display_charset(void); | |
138 | 138 | |
139 | 139 | const char * asc2ebc(unsigned char *str, int sz = -1); |
140 | 140 | const char * ebc2asc(unsigned char *str, int sz = -1); |
... | ... | @@ -588,18 +588,18 @@ extern "C" |
588 | 588 | return lib3270_wait_for_ready(hSession,seconds); |
589 | 589 | } |
590 | 590 | |
591 | - string * plugin::get_text_at(int row, int col, size_t sz) | |
591 | + string plugin::get_text_at(int row, int col, size_t sz) | |
592 | 592 | { |
593 | - char * ptr = lib3270_get_text_at(hSession,row,col,(int) sz); | |
593 | + string rc; | |
594 | + char * ptr = lib3270_get_text_at(hSession,row,col,(int) sz); | |
594 | 595 | |
595 | 596 | if(ptr) |
596 | 597 | { |
597 | - string *s = new string(ptr); | |
598 | + rc.assign(ptr); | |
598 | 599 | lib3270_free(ptr); |
599 | - return s; | |
600 | 600 | } |
601 | 601 | |
602 | - return new string(""); | |
602 | + return rc; | |
603 | 603 | } |
604 | 604 | |
605 | 605 | int plugin::cmp_text_at(int row, int col, const char *text) |
... | ... | @@ -632,17 +632,18 @@ extern "C" |
632 | 632 | lib3270_write_va_log(hSession,"REXX",fmt,args); |
633 | 633 | } |
634 | 634 | |
635 | - string * plugin::get_text(int baddr, size_t len) | |
635 | + string plugin::get_text(int baddr, size_t len) | |
636 | 636 | { |
637 | - char *ptr = lib3270_get_text(hSession,baddr,len); | |
637 | + string rc; | |
638 | + char * ptr = lib3270_get_text(hSession,baddr,len); | |
639 | + | |
638 | 640 | if(ptr) |
639 | 641 | { |
640 | - string *s = new string(ptr); | |
642 | + rc.assign(ptr); | |
641 | 643 | lib3270_free(ptr); |
642 | - return s; | |
643 | 644 | } |
644 | 645 | |
645 | - return new string(""); | |
646 | + return rc; | |
646 | 647 | } |
647 | 648 | |
648 | 649 | int plugin::get_field_start(int baddr) |
... | ... | @@ -661,32 +662,32 @@ extern "C" |
661 | 662 | return 0; |
662 | 663 | } |
663 | 664 | |
664 | - string * plugin::get_copy(void) | |
665 | + string plugin::get_copy(void) | |
665 | 666 | { |
666 | - gchar *ptr = v3270_get_copy(GTK_WIDGET(lib3270_get_widget(hSession))); | |
667 | + string rc; | |
668 | + gchar * ptr = v3270_get_copy(GTK_WIDGET(lib3270_get_widget(hSession))); | |
667 | 669 | |
668 | 670 | if(ptr) |
669 | 671 | { |
670 | - string *ret = new string((char *) ptr); | |
672 | + rc.assign(ptr); | |
671 | 673 | g_free(ptr); |
672 | - return ret; | |
673 | 674 | } |
674 | 675 | |
675 | - return NULL; | |
676 | + return rc; | |
676 | 677 | } |
677 | 678 | |
678 | - string * plugin::get_clipboard(void) | |
679 | + string plugin::get_clipboard(void) | |
679 | 680 | { |
680 | - gchar *ptr = gtk_clipboard_wait_for_text(gtk_widget_get_clipboard(pw3270_get_toplevel(),GDK_SELECTION_CLIPBOARD)); | |
681 | + string rc; | |
682 | + gchar * ptr = gtk_clipboard_wait_for_text(gtk_widget_get_clipboard(pw3270_get_toplevel(),GDK_SELECTION_CLIPBOARD)); | |
681 | 683 | |
682 | 684 | if(ptr) |
683 | 685 | { |
684 | - string *ret = new string((char *) ptr); | |
686 | + rc.assign(ptr); | |
685 | 687 | g_free(ptr); |
686 | - return ret; | |
687 | 688 | } |
688 | 689 | |
689 | - return NULL; | |
690 | + return rc; | |
690 | 691 | } |
691 | 692 | |
692 | 693 | int plugin::set_clipboard(const char *text) |
... | ... | @@ -729,18 +730,18 @@ int plugin::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *mess |
729 | 730 | return 0; |
730 | 731 | } |
731 | 732 | |
732 | -string * plugin::file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename) | |
733 | +string plugin::file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename) | |
733 | 734 | { |
734 | - gchar *ptr = pw3270_file_chooser(action, script_name ? script_name : "rexx", title, filename, extension); | |
735 | + string rc; | |
736 | + gchar * ptr = pw3270_file_chooser(action, script_name ? script_name : "rexx", title, filename, extension); | |
735 | 737 | |
736 | 738 | if(ptr) |
737 | 739 | { |
738 | - string *s = new string((char *) ptr); | |
740 | + rc.assign((char *) ptr); | |
739 | 741 | g_free(ptr); |
740 | - return s; | |
741 | 742 | } |
742 | 743 | |
743 | - return NULL; | |
744 | + return rc; | |
744 | 745 | } |
745 | 746 | |
746 | 747 | int plugin::quit(void) |
... | ... | @@ -754,14 +755,14 @@ int plugin::set_host_charset(const char *charset) |
754 | 755 | return lib3270_set_host_charset(hSession,charset); |
755 | 756 | } |
756 | 757 | |
757 | -string * plugin::get_host_charset(void) | |
758 | +string plugin::get_host_charset(void) | |
758 | 759 | { |
759 | - return new string(lib3270_get_host_charset(hSession)); | |
760 | + return string(lib3270_get_host_charset(hSession)); | |
760 | 761 | } |
761 | 762 | |
762 | -string * plugin::get_display_charset(void) | |
763 | +string plugin::get_display_charset(void) | |
763 | 764 | { |
764 | - return new string(lib3270_get_display_charset(hSession)); | |
765 | + return string(lib3270_get_display_charset(hSession)); | |
765 | 766 | } |
766 | 767 | |
767 | 768 | int plugin::erase_eof(void) | ... | ... |
src/plugins/rx3270/rexx_methods.cc
... | ... | @@ -207,14 +207,8 @@ RexxMethod4(RexxStringObject, rx3270_method_get_text_at, CSELF, sessionPtr, int, |
207 | 207 | try |
208 | 208 | { |
209 | 209 | session * hSession = (session *) sessionPtr; |
210 | - string * str = hSession->get_string_at(row,col,sz); | |
211 | - | |
212 | - if(str) | |
213 | - { | |
214 | - RexxStringObject ret = context->String((CSTRING) str->c_str()); | |
215 | - delete str; | |
216 | - return ret; | |
217 | - } | |
210 | + string str = hSession->get_string_at(row,col,sz); | |
211 | + return context->String((CSTRING) str.c_str()); | |
218 | 212 | |
219 | 213 | } |
220 | 214 | catch(std::exception &e) |
... | ... | @@ -363,12 +357,8 @@ RexxMethod4(logical_t, rx3270_method_test, CSELF, sessionPtr, CSTRING, key, int, |
363 | 357 | |
364 | 358 | if(hSession->is_ready()) |
365 | 359 | { |
366 | - bool rc = false; | |
367 | - string * str = hSession->get_string_at(row,col,strlen(key)); | |
368 | - if(str) | |
369 | - rc = (strcasecmp(str->c_str(),key) == 0); | |
370 | - delete str; | |
371 | - return rc; | |
360 | + string str = hSession->get_string_at(row,col,strlen(key)); | |
361 | + return (strcasecmp(str.c_str(),key) == 0); | |
372 | 362 | } |
373 | 363 | |
374 | 364 | } |
... | ... | @@ -401,14 +391,8 @@ RexxMethod3(RexxStringObject, rx3270_method_get_text, CSELF, sessionPtr, OPTIONA |
401 | 391 | try |
402 | 392 | { |
403 | 393 | session * hSession = (session *) sessionPtr; |
404 | - string * str = hSession->get_string(baddr,sz > 0 ? sz : -1); | |
405 | - | |
406 | - if(str) | |
407 | - { | |
408 | - RexxStringObject ret = context->String((CSTRING) str->c_str()); | |
409 | - delete str; | |
410 | - return ret; | |
411 | - } | |
394 | + string str = hSession->get_string(baddr,sz > 0 ? sz : -1); | |
395 | + return context->String((CSTRING) str.c_str()); | |
412 | 396 | } |
413 | 397 | catch(std::exception &e) |
414 | 398 | { |
... | ... | @@ -452,14 +436,8 @@ RexxMethod1(RexxStringObject, rx3270_method_get_selection, CSELF, sessionPtr) |
452 | 436 | { |
453 | 437 | try |
454 | 438 | { |
455 | - string *str = ((session *) sessionPtr)->get_copy(); | |
456 | - | |
457 | - if(str) | |
458 | - { | |
459 | - RexxStringObject ret = context->String((CSTRING) str->c_str()); | |
460 | - delete str; | |
461 | - return ret; | |
462 | - } | |
439 | + string str = ((session *) sessionPtr)->get_copy(); | |
440 | + return context->String((CSTRING) str.c_str()); | |
463 | 441 | |
464 | 442 | } |
465 | 443 | catch(std::exception &e) |
... | ... | @@ -490,14 +468,8 @@ RexxMethod1(RexxStringObject, rx3270_method_get_clipboard, CSELF, sessionPtr) |
490 | 468 | |
491 | 469 | if(hSession) |
492 | 470 | { |
493 | - string *str = hSession->get_clipboard(); | |
494 | - | |
495 | - if(str) | |
496 | - { | |
497 | - RexxStringObject ret = context->String((CSTRING) str->c_str()); | |
498 | - delete str; | |
499 | - return ret; | |
500 | - } | |
471 | + string str = hSession->get_clipboard(); | |
472 | + return context->String((CSTRING) str.c_str()); | |
501 | 473 | } |
502 | 474 | |
503 | 475 | trace("%s","rx3270_method_get_clipboard: Clipboard is empty"); |
... | ... | @@ -560,7 +532,7 @@ RexxMethod5(RexxStringObject, rx3270_method_get_filename, CSELF, sessionPtr, CST |
560 | 532 | }; |
561 | 533 | |
562 | 534 | GtkFileChooserAction id = GTK_FILE_CHOOSER_ACTION_OPEN; |
563 | - string * ret; | |
535 | + string ret; | |
564 | 536 | |
565 | 537 | for(int f=0;f<5;f++) |
566 | 538 | { |
... | ... | @@ -572,14 +544,8 @@ RexxMethod5(RexxStringObject, rx3270_method_get_filename, CSELF, sessionPtr, CST |
572 | 544 | } |
573 | 545 | |
574 | 546 | ret = ((session *) sessionPtr)->file_chooser_dialog(id, title, extension,filename); |
575 | - if(ret) | |
576 | - { | |
577 | - RexxStringObject obj = context->String(ret->c_str()); | |
578 | - delete ret; | |
579 | - return obj; | |
580 | - } | |
581 | 547 | |
582 | - return context->String(""); | |
548 | + return context->String(ret.c_str()); | |
583 | 549 | } |
584 | 550 | |
585 | 551 | RexxMethod2(int, rx3270_method_set_host_charset, CSELF, sessionPtr, CSTRING, text) |
... | ... | @@ -589,17 +555,13 @@ RexxMethod2(int, rx3270_method_set_host_charset, CSELF, sessionPtr, CSTRING, tex |
589 | 555 | |
590 | 556 | RexxMethod1(RexxStringObject, rx3270_method_get_host_charset, CSELF, sessionPtr) |
591 | 557 | { |
592 | - string * ret = ((session *) sessionPtr)->get_host_charset(); | |
593 | - RexxStringObject obj = context->String(ret->c_str()); | |
594 | - delete ret; | |
595 | - return obj; | |
558 | + string ret = ((session *) sessionPtr)->get_host_charset(); | |
559 | + return context->String(ret.c_str()); | |
596 | 560 | } |
597 | 561 | |
598 | 562 | RexxMethod1(RexxStringObject, rx3270_method_get_display_charset, CSELF, sessionPtr) |
599 | 563 | { |
600 | - string * ret = ((session *) sessionPtr)->get_display_charset(); | |
601 | - RexxStringObject obj = context->String(ret->c_str()); | |
602 | - delete ret; | |
603 | - return obj; | |
564 | + string ret = ((session *) sessionPtr)->get_display_charset(); | |
565 | + return context->String(ret.c_str()); | |
604 | 566 | } |
605 | 567 | ... | ... |
src/plugins/rx3270/typed_routines.cc
... | ... | @@ -150,14 +150,8 @@ RexxRoutine3(RexxStringObject, rx3270GetStringAt, int, row, int, col, int, sz) |
150 | 150 | { |
151 | 151 | try |
152 | 152 | { |
153 | - string *str = session::get_default()->get_string_at(row,col,(int) sz); | |
154 | - | |
155 | - if(str) | |
156 | - { | |
157 | - RexxStringObject ret = context->String((CSTRING) str->c_str()); | |
158 | - delete str; | |
159 | - return ret; | |
160 | - } | |
153 | + string str = session::get_default()->get_string_at(row,col,(int) sz); | |
154 | + return context->String((CSTRING) str.c_str()); | |
161 | 155 | } |
162 | 156 | catch(std::exception &e) |
163 | 157 | { | ... | ... |