Commit eb51279758c312fae0b8625c3eff6fc80c65a7f5

Authored by perry.werneck@gmail.com
1 parent 5ce34780

Implementando mais métodos na interface openoffice

src/oxt/actions.cxx
... ... @@ -54,19 +54,19 @@
54 54 return hSession->cmp_text_at((int) row, (int) col, rtl::OUStringToOString(text,hSession->get_encoding()).getStr());
55 55 }
56 56  
57   -::sal_Bool SAL_CALL isReady( ) throw (::com::sun::star::uno::RuntimeException)
  57 +::sal_Bool SAL_CALL pw3270::uno_impl::isReady( ) throw (::com::sun::star::uno::RuntimeException)
58 58 {
59   - if(!isConnected())
60   - return FALSE;
  59 + if(!hSession->in_tn3270e())
  60 + return false;
61 61  
62   - if(hSession->get_state() == )
63   - return TRUE;
  62 + if(hSession->get_state() == LIB3270_MESSAGE_NONE)
  63 + return true;
64 64  
65   - return FALSE;
  65 + return false;
66 66 }
67 67  
68   -::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException)
  68 +::sal_Bool SAL_CALL pw3270::uno_impl::isConnected( ) throw (::com::sun::star::uno::RuntimeException)
69 69 {
70   -
  70 + return hSession->in_tn3270e() != 0;
71 71 }
72 72  
... ...
src/oxt/globals.hpp
... ... @@ -65,12 +65,12 @@
65 65 virtual int enter(void) = 0;
66 66 virtual int pfkey(int key) = 0;
67 67 virtual int pakey(int key) = 0;
68   -
  68 + virtual bool in_tn3270e() = 0;
69 69 virtual void mem_free(void *) = 0;
70 70  
71 71 void sleep(int seconds = 1);
72 72  
73   - rtl_TextEncoding get_encoding();
  73 + rtl_TextEncoding get_encoding();
74 74  
75 75 };
76 76  
... ... @@ -86,6 +86,7 @@
86 86 virtual int connect(const char *uri);
87 87 virtual int disconnect(void);
88 88 virtual bool connected(void);
  89 + virtual bool in_tn3270e(void);
89 90  
90 91 virtual int enter(void);
91 92 virtual int pfkey(int key);
... ... @@ -110,6 +111,7 @@
110 111 /* lib3270 entry points */
111 112 const char * (* _get_revision)(void);
112 113 LIB3270_MESSAGE (* _get_program_message)(H3270 *);
  114 + int (* _in_tn3270e)(H3270 *);
113 115 char * (* _get_text_at)(H3270 *,int,int,int);
114 116 int (* _set_text_at)(H3270 *,int,int,const unsigned char *);
115 117 int (* _cmp_text_at)(H3270 *,int,int,const char *);
... ... @@ -147,6 +149,8 @@
147 149 virtual ::sal_Int16 SAL_CALL pfkey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException);
148 150 virtual ::sal_Int16 SAL_CALL pakey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException);
149 151 virtual ::sal_Int16 SAL_CALL cmpTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& text ) throw (::com::sun::star::uno::RuntimeException);
  152 + virtual ::sal_Bool SAL_CALL isReady( ) throw (::com::sun::star::uno::RuntimeException);
  153 + virtual ::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException);
150 154  
151 155 private:
152 156  
... ...
src/oxt/local.cxx
... ... @@ -57,12 +57,13 @@
57 57 { (void **) & _enter, "lib3270_enter" },
58 58 { (void **) & _pfkey, "lib3270_pfkey" },
59 59 { (void **) & _pakey, "lib3270_pakey" },
  60 + { (void **) & _in_tn3270e, "lib3270_in_tn3270e" },
60 61 { (void **) & _get_program_message, "lib3270_get_program_message" },
61 62 { (void **) & _mem_free, "lib3270_free" }
62 63  
63 64 };
64 65  
65   - void * (*lib3270_new)(const char *);
  66 + H3270 * (*lib3270_new)(const char *);
66 67  
67 68 hThread = NULL;
68 69 hSession = NULL;
... ... @@ -76,7 +77,7 @@
76 77 *call[f].entry = (void *) osl_getAsciiFunctionSymbol(hModule,call[f].name);
77 78  
78 79 /* Get lib3270 session handle */
79   - lib3270_new = (void * (*)(const char *)) osl_getAsciiFunctionSymbol(hModule,"lib3270_session_new");
  80 + lib3270_new = (H3270 * (*)(const char *)) osl_getAsciiFunctionSymbol(hModule,"lib3270_session_new");
80 81 hSession = lib3270_new("");
81 82  
82 83 }
... ... @@ -210,10 +211,10 @@
210 211 return _pakey(hSession,key);
211 212 }
212 213  
213   - int pw3270::lib3270_session::get_state(void)
  214 + LIB3270_MESSAGE pw3270::lib3270_session::get_state(void)
214 215 {
215 216 if(!hSession)
216   - return -1;
  217 + return LIB3270_MESSAGE_DISCONNECTED;
217 218 return _get_program_message(hSession);
218 219 }
219 220  
... ... @@ -242,3 +243,10 @@
242 243 return EINVAL;
243 244 return _cmp_text_at(hSession,row,col,text);
244 245 }
  246 +
  247 + bool pw3270::lib3270_session::in_tn3270e(void)
  248 + {
  249 + if(!hSession)
  250 + return false;
  251 + return _in_tn3270e(hSession) != 0;
  252 + }
... ...
src/oxt/main.cxx
... ... @@ -250,3 +250,5 @@ void pw3270::session::sleep(int seconds)
250 250 salhelper::TTimeValue t = salhelper::TTimeValue(seconds,0);
251 251 osl_waitThread(&t);
252 252 }
  253 +
  254 +
... ...
src/oxt/pw3270.idl
... ... @@ -77,6 +77,7 @@ module br
77 77 short getRevision();
78 78 short sleep([in] short seconds);
79 79 boolean isReady();
  80 +// boolean hasTextAt([in] short row, [in] short col, [in] string text);
80 81 // short waitForReady([in] short seconds);
81 82 // short waitForTextAt(in] short row, [in] short col, [in] string text, [in] short seconds);
82 83 boolean isConnected();
... ...