diff --git a/src/oxt/actions.cxx b/src/oxt/actions.cxx index 8159741..be5d9ca 100644 --- a/src/oxt/actions.cxx +++ b/src/oxt/actions.cxx @@ -54,19 +54,19 @@ return hSession->cmp_text_at((int) row, (int) col, rtl::OUStringToOString(text,hSession->get_encoding()).getStr()); } -::sal_Bool SAL_CALL isReady( ) throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL pw3270::uno_impl::isReady( ) throw (::com::sun::star::uno::RuntimeException) { - if(!isConnected()) - return FALSE; + if(!hSession->in_tn3270e()) + return false; - if(hSession->get_state() == ) - return TRUE; + if(hSession->get_state() == LIB3270_MESSAGE_NONE) + return true; - return FALSE; + return false; } -::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL pw3270::uno_impl::isConnected( ) throw (::com::sun::star::uno::RuntimeException) { - + return hSession->in_tn3270e() != 0; } diff --git a/src/oxt/globals.hpp b/src/oxt/globals.hpp index 61a3d4d..63a199c 100644 --- a/src/oxt/globals.hpp +++ b/src/oxt/globals.hpp @@ -65,12 +65,12 @@ virtual int enter(void) = 0; virtual int pfkey(int key) = 0; virtual int pakey(int key) = 0; - + virtual bool in_tn3270e() = 0; virtual void mem_free(void *) = 0; void sleep(int seconds = 1); - rtl_TextEncoding get_encoding(); + rtl_TextEncoding get_encoding(); }; @@ -86,6 +86,7 @@ virtual int connect(const char *uri); virtual int disconnect(void); virtual bool connected(void); + virtual bool in_tn3270e(void); virtual int enter(void); virtual int pfkey(int key); @@ -110,6 +111,7 @@ /* lib3270 entry points */ const char * (* _get_revision)(void); LIB3270_MESSAGE (* _get_program_message)(H3270 *); + int (* _in_tn3270e)(H3270 *); char * (* _get_text_at)(H3270 *,int,int,int); int (* _set_text_at)(H3270 *,int,int,const unsigned char *); int (* _cmp_text_at)(H3270 *,int,int,const char *); @@ -147,6 +149,8 @@ virtual ::sal_Int16 SAL_CALL pfkey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int16 SAL_CALL pakey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int16 SAL_CALL cmpTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& text ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isReady( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException); private: diff --git a/src/oxt/local.cxx b/src/oxt/local.cxx index 860c606..c0f32cb 100644 --- a/src/oxt/local.cxx +++ b/src/oxt/local.cxx @@ -57,12 +57,13 @@ { (void **) & _enter, "lib3270_enter" }, { (void **) & _pfkey, "lib3270_pfkey" }, { (void **) & _pakey, "lib3270_pakey" }, + { (void **) & _in_tn3270e, "lib3270_in_tn3270e" }, { (void **) & _get_program_message, "lib3270_get_program_message" }, { (void **) & _mem_free, "lib3270_free" } }; - void * (*lib3270_new)(const char *); + H3270 * (*lib3270_new)(const char *); hThread = NULL; hSession = NULL; @@ -76,7 +77,7 @@ *call[f].entry = (void *) osl_getAsciiFunctionSymbol(hModule,call[f].name); /* Get lib3270 session handle */ - lib3270_new = (void * (*)(const char *)) osl_getAsciiFunctionSymbol(hModule,"lib3270_session_new"); + lib3270_new = (H3270 * (*)(const char *)) osl_getAsciiFunctionSymbol(hModule,"lib3270_session_new"); hSession = lib3270_new(""); } @@ -210,10 +211,10 @@ return _pakey(hSession,key); } - int pw3270::lib3270_session::get_state(void) + LIB3270_MESSAGE pw3270::lib3270_session::get_state(void) { if(!hSession) - return -1; + return LIB3270_MESSAGE_DISCONNECTED; return _get_program_message(hSession); } @@ -242,3 +243,10 @@ return EINVAL; return _cmp_text_at(hSession,row,col,text); } + + bool pw3270::lib3270_session::in_tn3270e(void) + { + if(!hSession) + return false; + return _in_tn3270e(hSession) != 0; + } diff --git a/src/oxt/main.cxx b/src/oxt/main.cxx index 14fcb31..a2311fe 100644 --- a/src/oxt/main.cxx +++ b/src/oxt/main.cxx @@ -250,3 +250,5 @@ void pw3270::session::sleep(int seconds) salhelper::TTimeValue t = salhelper::TTimeValue(seconds,0); osl_waitThread(&t); } + + diff --git a/src/oxt/pw3270.idl b/src/oxt/pw3270.idl index 347226e..263b6c0 100644 --- a/src/oxt/pw3270.idl +++ b/src/oxt/pw3270.idl @@ -77,6 +77,7 @@ module br short getRevision(); short sleep([in] short seconds); boolean isReady(); +// boolean hasTextAt([in] short row, [in] short col, [in] string text); // short waitForReady([in] short seconds); // short waitForTextAt(in] short row, [in] short col, [in] string text, [in] short seconds); boolean isConnected(); -- libgit2 0.21.2