From 6a202cd758340a4ddccb6313c649a562ca72d762 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Tue, 12 Mar 2013 13:29:58 +0000 Subject: [PATCH] Trabalhando na extensão LibreOffice --- src/oxt/actions.cxx | 33 +++++++++++++++++++++++++++++++++ src/oxt/globals.hpp | 1 + 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/src/oxt/actions.cxx b/src/oxt/actions.cxx index 6d24020..db8cf0f 100644 --- a/src/oxt/actions.cxx +++ b/src/oxt/actions.cxx @@ -30,6 +30,7 @@ */ #include "globals.hpp" + #include #include /*---[ Implement ]-----------------------------------------------------------------------------------------*/ @@ -78,3 +79,35 @@ return cmpTextAt(row,col,text) == 0; } +::sal_Int16 SAL_CALL pw3270::uno_impl::waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException) +{ + time_t end = time(0) + seconds; + + osl_yieldThread(); + + while(time(0) < end) + { + switch(hSession->get_state()) + { + case LIB3270_MESSAGE_NONE: + return 0; + + case LIB3270_MESSAGE_DISCONNECTED: + return ENOTCONN; + + case LIB3270_MESSAGE_MINUS: + case LIB3270_MESSAGE_PROTECTED: + case LIB3270_MESSAGE_NUMERIC: + case LIB3270_MESSAGE_OVERFLOW: + case LIB3270_MESSAGE_INHIBIT: + case LIB3270_MESSAGE_KYBDLOCK: + return EPROTO; + + + } + + sleep(1); + } + + return ETIMEDOUT; +} diff --git a/src/oxt/globals.hpp b/src/oxt/globals.hpp index 494785c..0329cd1 100644 --- a/src/oxt/globals.hpp +++ b/src/oxt/globals.hpp @@ -152,6 +152,7 @@ virtual ::sal_Bool SAL_CALL isReady( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL hasTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& text ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException); private: -- libgit2 0.21.2