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,6 +30,7 @@ | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "globals.hpp" | 32 | #include "globals.hpp" |
33 | + #include <string.h> | ||
33 | 34 | ||
34 | /*---[ Implement ]-----------------------------------------------------------------------------------------*/ | 35 | /*---[ Implement ]-----------------------------------------------------------------------------------------*/ |
35 | 36 | ||
@@ -43,4 +44,19 @@ sal_Int16 SAL_CALL pw3270::uno_impl::getConnectionState( ) throw (::com::sun::s | @@ -43,4 +44,19 @@ sal_Int16 SAL_CALL pw3270::uno_impl::getConnectionState( ) throw (::com::sun::s | ||
43 | return hSession->get_state(); | 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,18 +51,20 @@ | ||
51 | public: | 51 | public: |
52 | session(); | 52 | session(); |
53 | virtual ~session(); | 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 | void sleep(int seconds = 1); | 69 | void sleep(int seconds = 1); |
68 | 70 | ||
@@ -87,6 +89,8 @@ | @@ -87,6 +89,8 @@ | ||
87 | virtual int pfkey(int key); | 89 | virtual int pfkey(int key); |
88 | virtual int pakey(int key); | 90 | virtual int pakey(int key); |
89 | 91 | ||
92 | + virtual char * get_text_at(int row, int col, int len); | ||
93 | + | ||
90 | virtual void mem_free(void *ptr); | 94 | virtual void mem_free(void *ptr); |
91 | 95 | ||
92 | private: | 96 | private: |
@@ -134,6 +138,7 @@ | @@ -134,6 +138,7 @@ | ||
134 | virtual ::sal_Int16 SAL_CALL Disconnect( ) throw (::com::sun::star::uno::RuntimeException); | 138 | virtual ::sal_Int16 SAL_CALL Disconnect( ) throw (::com::sun::star::uno::RuntimeException); |
135 | virtual ::sal_Int16 SAL_CALL getConnectionState( ) throw (::com::sun::star::uno::RuntimeException); | 139 | virtual ::sal_Int16 SAL_CALL getConnectionState( ) throw (::com::sun::star::uno::RuntimeException); |
136 | virtual ::sal_Int16 SAL_CALL sleep( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException); | 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 | private: | 143 | private: |
139 | 144 |
src/oxt/local.cxx
src/oxt/pw3270.idl
@@ -61,6 +61,9 @@ module br | @@ -61,6 +61,9 @@ module br | ||
61 | short Disconnect(); | 61 | short Disconnect(); |
62 | short getConnectionState(); | 62 | short getConnectionState(); |
63 | 63 | ||
64 | + /* Get */ | ||
65 | + string getTextAt([in] short row, [in] short col, [in] short size); | ||
66 | + | ||
64 | /* Misc */ | 67 | /* Misc */ |
65 | short getRevision(); | 68 | short getRevision(); |
66 | short sleep([in] short seconds); | 69 | short sleep([in] short seconds); |
src/oxt/testprogram.cxx
@@ -104,25 +104,26 @@ int SAL_CALL main(int argc, char **argv) | @@ -104,25 +104,26 @@ int SAL_CALL main(int argc, char **argv) | ||
104 | if(srv.is()) | 104 | if(srv.is()) |
105 | { | 105 | { |
106 | // Wait for commands | 106 | // Wait for commands |
107 | -// OString str; | 107 | + OString str; |
108 | 108 | ||
109 | printf("Revision:\t%d\n",srv->getRevision()); | 109 | printf("Revision:\t%d\n",srv->getRevision()); |
110 | 110 | ||
111 | printf("getConnectionState: %d\n", srv->getConnectionState()); | 111 | printf("getConnectionState: %d\n", srv->getConnectionState()); |
112 | printf("Connect(): %d\n" , srv->Connect(OUString::createFromAscii("L:3270.df.bb:9023"))); | 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 | printf("getConnectionState: %d\n", srv->getConnectionState()); | 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 | srv->Disconnect(); | 121 | srv->Disconnect(); |
119 | - srv->sleep(5); | 122 | + srv->sleep(2); |
120 | printf("getConnectionState: %d\n", srv->getConnectionState()); | 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 | printf("waitForStringAt(SISBB) returned %d\n",srv->waitForStringAt(20,39,OUString::createFromAscii("SISBB"),20)); | 129 | printf("waitForStringAt(SISBB) returned %d\n",srv->waitForStringAt(20,39,OUString::createFromAscii("SISBB"),20)); |