Commit a65fb47e6d564a569e91bfc7e17234fcfe8c444e
1 parent
50cd676a
Exists in
master
and in
5 other branches
Trabalhando na interface LibreOffice
Showing
5 changed files
with
48 additions
and
16 deletions
Show diff stats
src/oxt/get.cxx
| ... | ... | @@ -30,6 +30,7 @@ |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | 32 | #include "globals.hpp" |
| 33 | + #include <string.h> | |
| 33 | 34 | |
| 34 | 35 | /*---[ Implement ]-----------------------------------------------------------------------------------------*/ |
| 35 | 36 | |
| ... | ... | @@ -43,4 +44,19 @@ sal_Int16 SAL_CALL pw3270::uno_impl::getConnectionState( ) throw (::com::sun::s |
| 43 | 44 | return hSession->get_state(); |
| 44 | 45 | } |
| 45 | 46 | |
| 47 | +::rtl::OUString SAL_CALL pw3270::uno_impl::getTextAt( ::sal_Int16 row, ::sal_Int16 col, ::sal_Int16 size ) throw (::com::sun::star::uno::RuntimeException) | |
| 48 | +{ | |
| 49 | + char * ptr = hSession->get_text_at(row,col,size); | |
| 50 | + OUString ret; | |
| 51 | + | |
| 52 | + if(!ptr) | |
| 53 | + return OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) ); | |
| 54 | + | |
| 55 | + ret = OUString(ptr, strlen(ptr), hSession->get_encoding(), RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
| 56 | + | |
| 57 | + hSession->mem_free(ptr); | |
| 58 | + | |
| 59 | + return ret; | |
| 60 | +} | |
| 61 | + | |
| 46 | 62 | ... | ... |
src/oxt/globals.hpp
| ... | ... | @@ -51,18 +51,20 @@ |
| 51 | 51 | public: |
| 52 | 52 | session(); |
| 53 | 53 | virtual ~session(); |
| 54 | - virtual int get_revision(void) = 0; | |
| 55 | - virtual int get_state(void) = 0; | |
| 54 | + virtual int get_revision(void) = 0; | |
| 55 | + virtual int get_state(void) = 0; | |
| 56 | + virtual char * get_text_at(int row, int col, int len) = 0; | |
| 56 | 57 | |
| 57 | - virtual int connect(const char *uri) = 0; | |
| 58 | - virtual int disconnect(void) = 0; | |
| 59 | - virtual bool connected(void) = 0; | |
| 60 | 58 | |
| 61 | - virtual int enter(void) = 0; | |
| 62 | - virtual int pfkey(int key) = 0; | |
| 63 | - virtual int pakey(int key) = 0; | |
| 59 | + virtual int connect(const char *uri) = 0; | |
| 60 | + virtual int disconnect(void) = 0; | |
| 61 | + virtual bool connected(void) = 0; | |
| 64 | 62 | |
| 65 | - virtual void mem_free(void *) = 0; | |
| 63 | + virtual int enter(void) = 0; | |
| 64 | + virtual int pfkey(int key) = 0; | |
| 65 | + virtual int pakey(int key) = 0; | |
| 66 | + | |
| 67 | + virtual void mem_free(void *) = 0; | |
| 66 | 68 | |
| 67 | 69 | void sleep(int seconds = 1); |
| 68 | 70 | |
| ... | ... | @@ -87,6 +89,8 @@ |
| 87 | 89 | virtual int pfkey(int key); |
| 88 | 90 | virtual int pakey(int key); |
| 89 | 91 | |
| 92 | + virtual char * get_text_at(int row, int col, int len); | |
| 93 | + | |
| 90 | 94 | virtual void mem_free(void *ptr); |
| 91 | 95 | |
| 92 | 96 | private: |
| ... | ... | @@ -134,6 +138,7 @@ |
| 134 | 138 | virtual ::sal_Int16 SAL_CALL Disconnect( ) throw (::com::sun::star::uno::RuntimeException); |
| 135 | 139 | virtual ::sal_Int16 SAL_CALL getConnectionState( ) throw (::com::sun::star::uno::RuntimeException); |
| 136 | 140 | virtual ::sal_Int16 SAL_CALL sleep( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException); |
| 141 | + virtual ::rtl::OUString SAL_CALL getTextAt( ::sal_Int16 row, ::sal_Int16 col, ::sal_Int16 size ) throw (::com::sun::star::uno::RuntimeException); | |
| 137 | 142 | |
| 138 | 143 | private: |
| 139 | 144 | ... | ... |
src/oxt/local.cxx
src/oxt/pw3270.idl
src/oxt/testprogram.cxx
| ... | ... | @@ -104,25 +104,26 @@ int SAL_CALL main(int argc, char **argv) |
| 104 | 104 | if(srv.is()) |
| 105 | 105 | { |
| 106 | 106 | // Wait for commands |
| 107 | -// OString str; | |
| 107 | + OString str; | |
| 108 | 108 | |
| 109 | 109 | printf("Revision:\t%d\n",srv->getRevision()); |
| 110 | 110 | |
| 111 | 111 | printf("getConnectionState: %d\n", srv->getConnectionState()); |
| 112 | 112 | printf("Connect(): %d\n" , srv->Connect(OUString::createFromAscii("L:3270.df.bb:9023"))); |
| 113 | 113 | |
| 114 | - srv->sleep(5); | |
| 114 | + srv->sleep(2); | |
| 115 | 115 | printf("getConnectionState: %d\n", srv->getConnectionState()); |
| 116 | - srv->sleep(5); | |
| 116 | + srv->sleep(2); | |
| 117 | + | |
| 118 | + str = OUStringToOString( srv->getTextAt(1,1,2000),RTL_TEXTENCODING_UTF8); | |
| 119 | + printf("ContentsAt(1,1):\n%s\n",str.pData->buffer); | |
| 117 | 120 | |
| 118 | 121 | srv->Disconnect(); |
| 119 | - srv->sleep(5); | |
| 122 | + srv->sleep(2); | |
| 120 | 123 | printf("getConnectionState: %d\n", srv->getConnectionState()); |
| 121 | 124 | |
| 122 | - srv->sleep(5); | |
| 125 | + srv->sleep(2); | |
| 123 | 126 | |
| 124 | - //str = OUStringToOString( srv->getScreenContentAt(20,39,5),RTL_TEXTENCODING_UTF8); | |
| 125 | - //Trace("ContentsAt(20,39): \"%s\"",str.pData->buffer); | |
| 126 | 127 | |
| 127 | 128 | /* |
| 128 | 129 | printf("waitForStringAt(SISBB) returned %d\n",srv->waitForStringAt(20,39,OUString::createFromAscii("SISBB"),20)); | ... | ... |