From f46ef8de4492e932d33c5a27292a3f75fada3b03 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Tue, 1 Apr 2014 16:38:35 +0000 Subject: [PATCH] Implementando restante dos métodos --- src/loffice/get.cc | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/loffice/globals.hpp | 15 ++++++++++++++- src/loffice/init.cc | 19 +++++++++++++++++++ src/loffice/pw3270.idl | 19 +++++++++++++++++++ src/loffice/set.cc | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 221 insertions(+), 1 deletion(-) diff --git a/src/loffice/get.cc b/src/loffice/get.cc index 8d0ef40..ceb4a0d 100644 --- a/src/loffice/get.cc +++ b/src/loffice/get.cc @@ -86,3 +86,71 @@ return -1; } + + ::sal_Int32 SAL_CALL session_impl::getCursorAddress() throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->get_cursor_addr(); + + } catch(std::exception &e) + { + 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_Int32 SAL_CALL session_impl::getFieldStart( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->get_field_start(addr); + + } catch(std::exception &e) + { + 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_Int32 SAL_CALL session_impl::getFieldLen( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->get_field_len(addr); + + } catch(std::exception &e) + { + 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_Int32 SAL_CALL session_impl::getNextUnprotected( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->get_next_unprotected(addr); + + } catch(std::exception &e) + { + 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; + + } diff --git a/src/loffice/globals.hpp b/src/loffice/globals.hpp index 984f9ef..2d74476 100644 --- a/src/loffice/globals.hpp +++ b/src/loffice/globals.hpp @@ -116,12 +116,25 @@ // Screen contents virtual ::rtl::OUString SAL_CALL getTextAt( ::sal_Int16 row, ::sal_Int16 col, ::sal_Int16 size ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int16 SAL_CALL setTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getFieldStart( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getFieldLen( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getNextUnprotected( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException); // Wait virtual ::sal_Int16 SAL_CALL waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException); 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); - + // Actions + virtual ::sal_Int16 SAL_CALL enter() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL pfkey( ::sal_Int16 key ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL pakey( ::sal_Int16 key ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL quit() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL erase_eof() throw (::com::sun::star::uno::RuntimeException); + + // Cursor + virtual ::sal_Int32 SAL_CALL setCursorAt( ::sal_Int16 row, ::sal_Int16 col ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL setCursorAddress( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getCursorAddress() throw (::com::sun::star::uno::RuntimeException); private: h3270::session * hSession; diff --git a/src/loffice/init.cc b/src/loffice/init.cc index 2d19f8d..50c8c76 100644 --- a/src/loffice/init.cc +++ b/src/loffice/init.cc @@ -93,3 +93,22 @@ void session_impl::initialize( Sequence< Any > const & args ) throw (Exception) } return -1; } + + ::sal_Int16 SAL_CALL session_impl::quit() throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->quit(); + } catch(std::exception &e) + { + 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; + + } + + + diff --git a/src/loffice/pw3270.idl b/src/loffice/pw3270.idl index ad21cf6..79ad6dc 100644 --- a/src/loffice/pw3270.idl +++ b/src/loffice/pw3270.idl @@ -57,6 +57,25 @@ module pw3270 short setTextAt([in] short row, [in] short col, [in] string str); short waitForTextAt([in] short row, [in] short col, [in] string str, [in] short seconds); + // Cursor + long setCursorAt([in] short row, [in] short col); + long setCursorAddress([in] long addr); + long getCursorAddress(); + + // Field positioning + long getFieldStart([in] long addr); + long getFieldLen([in] long addr); + long getNextUnprotected([in] long addr); + + // Keyboard actions + short enter(); + short pfkey([in] short key); + short pakey([in] short key); + + // Misc actions + short quit(); + short erase_eof(); + // Misc Settings short setSessionName([in] string name); diff --git a/src/loffice/set.cc b/src/loffice/set.cc index b737d1c..3348130 100644 --- a/src/loffice/set.cc +++ b/src/loffice/set.cc @@ -141,3 +141,104 @@ } + ::sal_Int16 SAL_CALL session_impl::enter() throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->enter(); + + } catch(std::exception &e) + { + 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::pfkey( ::sal_Int16 key ) throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->pfkey(key); + + } catch(std::exception &e) + { + 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::pakey( ::sal_Int16 key ) throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->pakey(key); + + } catch(std::exception &e) + { + 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_Int32 SAL_CALL session_impl::setCursorAt( ::sal_Int16 row, ::sal_Int16 col ) throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->set_cursor_position(row,col); + + } catch(std::exception &e) + { + 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_Int32 SAL_CALL session_impl::setCursorAddress( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->set_cursor_addr(addr); + + } catch(std::exception &e) + { + 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::erase_eof() throw (::com::sun::star::uno::RuntimeException) + { + try + { + CHECK_SESSION_HANDLE + return hSession->erase_eof(); + + } catch(std::exception &e) + { + 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; + + } -- libgit2 0.21.2