Commit eb51279758c312fae0b8625c3eff6fc80c65a7f5

Authored by perry.werneck@gmail.com
1 parent 5ce34780

Implementando mais métodos na interface openoffice

src/oxt/actions.cxx
@@ -54,19 +54,19 @@ @@ -54,19 +54,19 @@
54 return hSession->cmp_text_at((int) row, (int) col, rtl::OUStringToOString(text,hSession->get_encoding()).getStr()); 54 return hSession->cmp_text_at((int) row, (int) col, rtl::OUStringToOString(text,hSession->get_encoding()).getStr());
55 } 55 }
56 56
57 -::sal_Bool SAL_CALL isReady( ) throw (::com::sun::star::uno::RuntimeException) 57 +::sal_Bool SAL_CALL pw3270::uno_impl::isReady( ) throw (::com::sun::star::uno::RuntimeException)
58 { 58 {
59 - if(!isConnected())  
60 - return FALSE; 59 + if(!hSession->in_tn3270e())
  60 + return false;
61 61
62 - if(hSession->get_state() == )  
63 - return TRUE; 62 + if(hSession->get_state() == LIB3270_MESSAGE_NONE)
  63 + return true;
64 64
65 - return FALSE; 65 + return false;
66 } 66 }
67 67
68 -::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException) 68 +::sal_Bool SAL_CALL pw3270::uno_impl::isConnected( ) throw (::com::sun::star::uno::RuntimeException)
69 { 69 {
70 - 70 + return hSession->in_tn3270e() != 0;
71 } 71 }
72 72
src/oxt/globals.hpp
@@ -65,12 +65,12 @@ @@ -65,12 +65,12 @@
65 virtual int enter(void) = 0; 65 virtual int enter(void) = 0;
66 virtual int pfkey(int key) = 0; 66 virtual int pfkey(int key) = 0;
67 virtual int pakey(int key) = 0; 67 virtual int pakey(int key) = 0;
68 - 68 + virtual bool in_tn3270e() = 0;
69 virtual void mem_free(void *) = 0; 69 virtual void mem_free(void *) = 0;
70 70
71 void sleep(int seconds = 1); 71 void sleep(int seconds = 1);
72 72
73 - rtl_TextEncoding get_encoding(); 73 + rtl_TextEncoding get_encoding();
74 74
75 }; 75 };
76 76
@@ -86,6 +86,7 @@ @@ -86,6 +86,7 @@
86 virtual int connect(const char *uri); 86 virtual int connect(const char *uri);
87 virtual int disconnect(void); 87 virtual int disconnect(void);
88 virtual bool connected(void); 88 virtual bool connected(void);
  89 + virtual bool in_tn3270e(void);
89 90
90 virtual int enter(void); 91 virtual int enter(void);
91 virtual int pfkey(int key); 92 virtual int pfkey(int key);
@@ -110,6 +111,7 @@ @@ -110,6 +111,7 @@
110 /* lib3270 entry points */ 111 /* lib3270 entry points */
111 const char * (* _get_revision)(void); 112 const char * (* _get_revision)(void);
112 LIB3270_MESSAGE (* _get_program_message)(H3270 *); 113 LIB3270_MESSAGE (* _get_program_message)(H3270 *);
  114 + int (* _in_tn3270e)(H3270 *);
113 char * (* _get_text_at)(H3270 *,int,int,int); 115 char * (* _get_text_at)(H3270 *,int,int,int);
114 int (* _set_text_at)(H3270 *,int,int,const unsigned char *); 116 int (* _set_text_at)(H3270 *,int,int,const unsigned char *);
115 int (* _cmp_text_at)(H3270 *,int,int,const char *); 117 int (* _cmp_text_at)(H3270 *,int,int,const char *);
@@ -147,6 +149,8 @@ @@ -147,6 +149,8 @@
147 virtual ::sal_Int16 SAL_CALL pfkey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException); 149 virtual ::sal_Int16 SAL_CALL pfkey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException);
148 virtual ::sal_Int16 SAL_CALL pakey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException); 150 virtual ::sal_Int16 SAL_CALL pakey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException);
149 virtual ::sal_Int16 SAL_CALL cmpTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& text ) throw (::com::sun::star::uno::RuntimeException); 151 virtual ::sal_Int16 SAL_CALL cmpTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& text ) throw (::com::sun::star::uno::RuntimeException);
  152 + virtual ::sal_Bool SAL_CALL isReady( ) throw (::com::sun::star::uno::RuntimeException);
  153 + virtual ::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException);
150 154
151 private: 155 private:
152 156
src/oxt/local.cxx
@@ -57,12 +57,13 @@ @@ -57,12 +57,13 @@
57 { (void **) & _enter, "lib3270_enter" }, 57 { (void **) & _enter, "lib3270_enter" },
58 { (void **) & _pfkey, "lib3270_pfkey" }, 58 { (void **) & _pfkey, "lib3270_pfkey" },
59 { (void **) & _pakey, "lib3270_pakey" }, 59 { (void **) & _pakey, "lib3270_pakey" },
  60 + { (void **) & _in_tn3270e, "lib3270_in_tn3270e" },
60 { (void **) & _get_program_message, "lib3270_get_program_message" }, 61 { (void **) & _get_program_message, "lib3270_get_program_message" },
61 { (void **) & _mem_free, "lib3270_free" } 62 { (void **) & _mem_free, "lib3270_free" }
62 63
63 }; 64 };
64 65
65 - void * (*lib3270_new)(const char *); 66 + H3270 * (*lib3270_new)(const char *);
66 67
67 hThread = NULL; 68 hThread = NULL;
68 hSession = NULL; 69 hSession = NULL;
@@ -76,7 +77,7 @@ @@ -76,7 +77,7 @@
76 *call[f].entry = (void *) osl_getAsciiFunctionSymbol(hModule,call[f].name); 77 *call[f].entry = (void *) osl_getAsciiFunctionSymbol(hModule,call[f].name);
77 78
78 /* Get lib3270 session handle */ 79 /* Get lib3270 session handle */
79 - lib3270_new = (void * (*)(const char *)) osl_getAsciiFunctionSymbol(hModule,"lib3270_session_new"); 80 + lib3270_new = (H3270 * (*)(const char *)) osl_getAsciiFunctionSymbol(hModule,"lib3270_session_new");
80 hSession = lib3270_new(""); 81 hSession = lib3270_new("");
81 82
82 } 83 }
@@ -210,10 +211,10 @@ @@ -210,10 +211,10 @@
210 return _pakey(hSession,key); 211 return _pakey(hSession,key);
211 } 212 }
212 213
213 - int pw3270::lib3270_session::get_state(void) 214 + LIB3270_MESSAGE pw3270::lib3270_session::get_state(void)
214 { 215 {
215 if(!hSession) 216 if(!hSession)
216 - return -1; 217 + return LIB3270_MESSAGE_DISCONNECTED;
217 return _get_program_message(hSession); 218 return _get_program_message(hSession);
218 } 219 }
219 220
@@ -242,3 +243,10 @@ @@ -242,3 +243,10 @@
242 return EINVAL; 243 return EINVAL;
243 return _cmp_text_at(hSession,row,col,text); 244 return _cmp_text_at(hSession,row,col,text);
244 } 245 }
  246 +
  247 + bool pw3270::lib3270_session::in_tn3270e(void)
  248 + {
  249 + if(!hSession)
  250 + return false;
  251 + return _in_tn3270e(hSession) != 0;
  252 + }
src/oxt/main.cxx
@@ -250,3 +250,5 @@ void pw3270::session::sleep(int seconds) @@ -250,3 +250,5 @@ void pw3270::session::sleep(int seconds)
250 salhelper::TTimeValue t = salhelper::TTimeValue(seconds,0); 250 salhelper::TTimeValue t = salhelper::TTimeValue(seconds,0);
251 osl_waitThread(&t); 251 osl_waitThread(&t);
252 } 252 }
  253 +
  254 +
src/oxt/pw3270.idl
@@ -77,6 +77,7 @@ module br @@ -77,6 +77,7 @@ module br
77 short getRevision(); 77 short getRevision();
78 short sleep([in] short seconds); 78 short sleep([in] short seconds);
79 boolean isReady(); 79 boolean isReady();
  80 +// boolean hasTextAt([in] short row, [in] short col, [in] string text);
80 // short waitForReady([in] short seconds); 81 // short waitForReady([in] short seconds);
81 // short waitForTextAt(in] short row, [in] short col, [in] string text, [in] short seconds); 82 // short waitForTextAt(in] short row, [in] short col, [in] string text, [in] short seconds);
82 boolean isConnected(); 83 boolean isConnected();