From f6f4107149097fb2e8d294f80e34a9bee482cf84 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Wed, 29 Apr 2015 00:47:49 +0000 Subject: [PATCH] Atualizando interface libreoffice --- pw3270.cbp | 22 +++++++++++++++------- src/include/pw3270/class.h | 4 ++-- src/lib3270/connect.c | 8 +++++--- src/lib3270/iocalls.c | 2 ++ src/loffice/connect.cc | 34 ++++++++++++++++++++++++++++++++-- src/loffice/globals.hpp | 3 +-- src/loffice/pw3270.idl | 3 +-- src/loffice/set.cc | 2 ++ 8 files changed, 60 insertions(+), 18 deletions(-) diff --git a/pw3270.cbp b/pw3270.cbp index 45c4434..ba1b2b0 100644 --- a/pw3270.cbp +++ b/pw3270.cbp @@ -251,19 +251,27 @@ + + + + + + + + + + + + + + + - - - - - - - diff --git a/src/include/pw3270/class.h b/src/include/pw3270/class.h index 9aefb65..9d9ee79 100644 --- a/src/include/pw3270/class.h +++ b/src/include/pw3270/class.h @@ -134,8 +134,8 @@ virtual string get_display_charset(void); // Connection & Network - int connect(const char *host, time_t wait = 0); - int set_host(const char *host); + int connect(const char *host, time_t wait = 0); + int set_host(const char *host); virtual int connect(void) = 0; virtual int set_url(const char *hostname) = 0; virtual int disconnect(void) = 0; diff --git a/src/lib3270/connect.c b/src/lib3270/connect.c index cb17e7d..59f32c5 100644 --- a/src/lib3270/connect.c +++ b/src/lib3270/connect.c @@ -82,9 +82,11 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d int err; socklen_t len = sizeof(err); - trace("%s write=%p",__FUNCTION__,hSession->ns_write_id); - lib3270_remove_poll(hSession->ns_write_id); - hSession->ns_write_id = NULL; + if(hSession->ns_write_id) { + trace("%s write=%p",__FUNCTION__,hSession->ns_write_id); + lib3270_remove_poll(hSession->ns_write_id); + hSession->ns_write_id = NULL; + } if(getsockopt(hSession->sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len) < 0) { diff --git a/src/lib3270/iocalls.c b/src/lib3270/iocalls.c index e4ae777..c9124e3 100644 --- a/src/lib3270/iocalls.c +++ b/src/lib3270/iocalls.c @@ -628,6 +628,7 @@ void x_except_on(H3270 *h) { int reading = (h->ns_read_id != NULL); + debug("%s",__FUNCTION__); if(h->ns_exception_id) return; @@ -638,6 +639,7 @@ void x_except_on(H3270 *h) if(reading) h->ns_read_id = lib3270_add_poll_fd(h,h->sock,LIB3270_IO_FLAG_READ,net_input,0); + debug("%s",__FUNCTION__); } diff --git a/src/loffice/connect.cc b/src/loffice/connect.cc index e7393dc..5e34d29 100644 --- a/src/loffice/connect.cc +++ b/src/loffice/connect.cc @@ -37,16 +37,46 @@ using namespace pw3270_impl; - ::sal_Int16 SAL_CALL session_impl::Connect() throw (::com::sun::star::uno::RuntimeException) +/* +::sal_Int16 SAL_CALL session_impl::Reconnect() throw (::com::sun::star::uno::RuntimeException) + { + trace("%s: hSession=%p",__FUNCTION__,hSession); + + try + { + if(!hSession) + hSession = h3270::session::get_default(); + + return hSession->connect(); + + } catch(std::exception &e) + { + trace("%s failed: %s",__FUNCTION__,e.what()); + + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); + + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); + + } + + return -1; + + + } +*/ + + ::sal_Int16 SAL_CALL session_impl::Connect(const ::rtl::OUString& url, ::sal_Bool wait) throw (::com::sun::star::uno::RuntimeException) { trace("%s: hSession=%p",__FUNCTION__,hSession); + OString vlr = rtl::OUStringToOString( url , RTL_TEXTENCODING_UNICODE ); + try { if(!hSession) hSession = h3270::session::get_default(); - return hSession->connect(false); + return hSession->connect(vlr.getStr(),wait); } catch(std::exception &e) { diff --git a/src/loffice/globals.hpp b/src/loffice/globals.hpp index c6a07cc..5c15c45 100644 --- a/src/loffice/globals.hpp +++ b/src/loffice/globals.hpp @@ -105,8 +105,7 @@ virtual ::sal_Int16 SAL_CALL setSessionName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int16 SAL_CALL setHost( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int16 SAL_CALL Connect() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL Connect( const ::rtl::OUString& url, ::sal_Bool wait) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int16 SAL_CALL Disconnect() throw (::com::sun::star::uno::RuntimeException); // State diff --git a/src/loffice/pw3270.idl b/src/loffice/pw3270.idl index b0ec424..3ea59f3 100644 --- a/src/loffice/pw3270.idl +++ b/src/loffice/pw3270.idl @@ -47,8 +47,7 @@ module pw3270 string getRevision(); // Host definition - short setHost([in] string url); - short Connect(); + short Connect([in] string url, [in] boolean wait); short Disconnect(); short iterate([in] boolean wait); diff --git a/src/loffice/set.cc b/src/loffice/set.cc index 7f8e36c..fdfb1e9 100644 --- a/src/loffice/set.cc +++ b/src/loffice/set.cc @@ -100,6 +100,7 @@ } +/* ::sal_Int16 SAL_CALL session_impl::setHost( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException) { if(!hSession) @@ -122,6 +123,7 @@ return -1; } +*/ ::sal_Int16 SAL_CALL session_impl::setTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str ) throw (::com::sun::star::uno::RuntimeException) { -- libgit2 0.21.2