Commit 5ce3478069f6d387b4676fab616bfd0f7c8e558d
1 parent
5b9b55e0
Exists in
master
and in
5 other branches
Trabalhando na extensão LibreOffice
Showing
5 changed files
with
74 additions
and
36 deletions
Show diff stats
src/oxt/Makefile.in
@@ -51,10 +51,12 @@ CPPUMAKER=${OO_SDK_HOME}/bin/cppumaker | @@ -51,10 +51,12 @@ CPPUMAKER=${OO_SDK_HOME}/bin/cppumaker | ||
51 | 51 | ||
52 | #---[ Rules ]------------------------------------------------------------------------------------------ | 52 | #---[ Rules ]------------------------------------------------------------------------------------------ |
53 | 53 | ||
54 | +LIB3270_CFLAGS ?= `pkg-config --cflags lib3270` | ||
55 | + | ||
54 | DLL_CFLAGS=@DLL_CFLAGS@ | 56 | DLL_CFLAGS=@DLL_CFLAGS@ |
55 | DLL_FLAGS=-shared | 57 | DLL_FLAGS=-shared |
56 | 58 | ||
57 | -CXXFLAGS=-Wno-strict-aliasing -I$(OBJDIR)/uno/include -I$(OO_SDK_HOME)/include -I$(OBJDIR)/uno/include/br/com/bb | 59 | +CXXFLAGS=-Wno-strict-aliasing -I$(OBJDIR)/uno/include -I$(OO_SDK_HOME)/include -I$(OBJDIR)/uno/include/br/com/bb $(LIB3270_CFLAGS) |
58 | LDFLAGS=-L${OO_SDK_HOME}/lib -L${OO_SDK_URE_HOME}/lib -Wl,-rpath-link=${OO_SDK_URE_HOME}/lib,-rpath=${OO_SDK_URE_HOME}/lib \ | 60 | LDFLAGS=-L${OO_SDK_HOME}/lib -L${OO_SDK_URE_HOME}/lib -Wl,-rpath-link=${OO_SDK_URE_HOME}/lib,-rpath=${OO_SDK_URE_HOME}/lib \ |
59 | $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) | 61 | $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) |
60 | 62 | ||
@@ -64,7 +66,7 @@ LDFLAGS=-L${OO_SDK_HOME}/lib -L${OO_SDK_URE_HOME}/lib -Wl,-rpath-link=${OO_SDK_U | @@ -64,7 +66,7 @@ LDFLAGS=-L${OO_SDK_HOME}/lib -L${OO_SDK_URE_HOME}/lib -Wl,-rpath-link=${OO_SDK_U | ||
64 | $(OBJDBG)/%.o: %.cxx $(OBJDIR)/uno/include/br/com/bb/$(PACKAGE).hpp Makefile | 66 | $(OBJDBG)/%.o: %.cxx $(OBJDIR)/uno/include/br/com/bb/$(PACKAGE).hpp Makefile |
65 | @echo $< ... | 67 | @echo $< ... |
66 | @$(MKDIR) `dirname $@` | 68 | @$(MKDIR) `dirname $@` |
67 | - @$(CXX) $(DBG_CFLAGS) $(CXXFLAGS) $(DLL_CFLAGS) -o $@ -c $< | 69 | + @$(CXX) $(DBG_CFLAGS) $(CXXFLAGS) $(LIB3270_CFLAGS) $(DLL_CFLAGS) -o $@ -c $< |
68 | 70 | ||
69 | %.urd: %.idl | 71 | %.urd: %.idl |
70 | @echo $< ... | 72 | @echo $< ... |
src/oxt/actions.cxx
@@ -48,3 +48,25 @@ | @@ -48,3 +48,25 @@ | ||
48 | { | 48 | { |
49 | return hSession->pakey((int) keycode); | 49 | return hSession->pakey((int) keycode); |
50 | } | 50 | } |
51 | + | ||
52 | +::sal_Int16 SAL_CALL pw3270::uno_impl::cmpTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& text ) throw (::com::sun::star::uno::RuntimeException) | ||
53 | +{ | ||
54 | + return hSession->cmp_text_at((int) row, (int) col, rtl::OUStringToOString(text,hSession->get_encoding()).getStr()); | ||
55 | +} | ||
56 | + | ||
57 | +::sal_Bool SAL_CALL isReady( ) throw (::com::sun::star::uno::RuntimeException) | ||
58 | +{ | ||
59 | + if(!isConnected()) | ||
60 | + return FALSE; | ||
61 | + | ||
62 | + if(hSession->get_state() == ) | ||
63 | + return TRUE; | ||
64 | + | ||
65 | + return FALSE; | ||
66 | +} | ||
67 | + | ||
68 | +::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException) | ||
69 | +{ | ||
70 | + | ||
71 | +} | ||
72 | + |
src/oxt/globals.hpp
@@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
11 | #define LANGUAGE_BINDING_NAME "gcc3" | 11 | #define LANGUAGE_BINDING_NAME "gcc3" |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
14 | + #include <lib3270.h> | ||
14 | 15 | ||
15 | #include <rtl/uuid.h> | 16 | #include <rtl/uuid.h> |
16 | #include <osl/thread.hxx> | 17 | #include <osl/thread.hxx> |
@@ -51,22 +52,23 @@ | @@ -51,22 +52,23 @@ | ||
51 | public: | 52 | public: |
52 | session(); | 53 | session(); |
53 | virtual ~session(); | 54 | virtual ~session(); |
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; | ||
57 | - virtual int set_text_at(int row, int col, const char *text) = 0; | 55 | + virtual int get_revision(void) = 0; |
56 | + virtual LIB3270_MESSAGE get_state(void) = 0; | ||
57 | + virtual char * get_text_at(int row, int col, int len) = 0; | ||
58 | + virtual int set_text_at(int row, int col, const char *text) = 0; | ||
59 | + virtual int cmp_text_at(int row, int col, const char *text) = 0; | ||
58 | 60 | ||
59 | - virtual int connect(const char *uri) = 0; | ||
60 | - virtual int disconnect(void) = 0; | ||
61 | - virtual bool connected(void) = 0; | 61 | + virtual int connect(const char *uri) = 0; |
62 | + virtual int disconnect(void) = 0; | ||
63 | + virtual bool connected(void) = 0; | ||
62 | 64 | ||
63 | - virtual int enter(void) = 0; | ||
64 | - virtual int pfkey(int key) = 0; | ||
65 | - virtual int pakey(int key) = 0; | 65 | + virtual int enter(void) = 0; |
66 | + virtual int pfkey(int key) = 0; | ||
67 | + virtual int pakey(int key) = 0; | ||
66 | 68 | ||
67 | - virtual void mem_free(void *) = 0; | 69 | + virtual void mem_free(void *) = 0; |
68 | 70 | ||
69 | - void sleep(int seconds = 1); | 71 | + void sleep(int seconds = 1); |
70 | 72 | ||
71 | rtl_TextEncoding get_encoding(); | 73 | rtl_TextEncoding get_encoding(); |
72 | 74 | ||
@@ -78,43 +80,43 @@ | @@ -78,43 +80,43 @@ | ||
78 | lib3270_session(); | 80 | lib3270_session(); |
79 | virtual ~lib3270_session(); | 81 | virtual ~lib3270_session(); |
80 | 82 | ||
81 | - virtual int get_revision(void); | ||
82 | - virtual int get_state(void); | 83 | + virtual int get_revision(void); |
84 | + virtual LIB3270_MESSAGE get_state(void); | ||
83 | 85 | ||
84 | - virtual int connect(const char *uri); | ||
85 | - virtual int disconnect(void); | ||
86 | - virtual bool connected(void); | 86 | + virtual int connect(const char *uri); |
87 | + virtual int disconnect(void); | ||
88 | + virtual bool connected(void); | ||
87 | 89 | ||
88 | - virtual int enter(void); | ||
89 | - virtual int pfkey(int key); | ||
90 | - virtual int pakey(int key); | 90 | + virtual int enter(void); |
91 | + virtual int pfkey(int key); | ||
92 | + virtual int pakey(int key); | ||
91 | 93 | ||
92 | - virtual char * get_text_at(int row, int col, int len); | ||
93 | - virtual int set_text_at(int row, int col, const char *text); | 94 | + virtual char * get_text_at(int row, int col, int len); |
95 | + virtual int set_text_at(int row, int col, const char *text); | ||
96 | + virtual int cmp_text_at(int row, int col, const char *text); | ||
94 | 97 | ||
95 | - virtual void mem_free(void *ptr); | 98 | + virtual void mem_free(void *ptr); |
96 | 99 | ||
97 | private: | 100 | private: |
98 | bool enabled; | 101 | bool enabled; |
99 | oslModule hModule; | 102 | oslModule hModule; |
100 | oslThread hThread; | 103 | oslThread hThread; |
101 | - void * hSession; | 104 | + H3270 * hSession; |
102 | 105 | ||
103 | /* Internal calls */ | 106 | /* Internal calls */ |
104 | static void start_connect(lib3270_session *session); | 107 | static void start_connect(lib3270_session *session); |
105 | void network_loop(void); | 108 | void network_loop(void); |
106 | 109 | ||
107 | /* lib3270 entry points */ | 110 | /* lib3270 entry points */ |
108 | - const char * (* _get_revision)(void); | ||
109 | - int (* _get_program_message)(void *); | ||
110 | - char * (* _get_text_at)(void *,int,int,int); | ||
111 | - int (* _set_text_at)(void *,int,int,const unsigned char *); | ||
112 | - int (* _cmp_text_at)(void *,int,int,const char *); | ||
113 | - int (* _enter)(void *); | ||
114 | - int (* _pfkey)(void *, int); | ||
115 | - int (* _pakey)(void *, int); | ||
116 | - void * (* _mem_free)(void *); | ||
117 | - | 111 | + const char * (* _get_revision)(void); |
112 | + LIB3270_MESSAGE (* _get_program_message)(H3270 *); | ||
113 | + char * (* _get_text_at)(H3270 *,int,int,int); | ||
114 | + int (* _set_text_at)(H3270 *,int,int,const unsigned char *); | ||
115 | + int (* _cmp_text_at)(H3270 *,int,int,const char *); | ||
116 | + int (* _enter)(H3270 *); | ||
117 | + int (* _pfkey)(H3270 *, int); | ||
118 | + int (* _pakey)(H3270 *, int); | ||
119 | + void * (* _mem_free)(void *); | ||
118 | 120 | ||
119 | }; | 121 | }; |
120 | 122 | ||
@@ -144,6 +146,7 @@ | @@ -144,6 +146,7 @@ | ||
144 | virtual ::sal_Int16 SAL_CALL enter( ) throw (::com::sun::star::uno::RuntimeException); | 146 | virtual ::sal_Int16 SAL_CALL enter( ) throw (::com::sun::star::uno::RuntimeException); |
145 | virtual ::sal_Int16 SAL_CALL pfkey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException); | 147 | virtual ::sal_Int16 SAL_CALL pfkey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException); |
146 | virtual ::sal_Int16 SAL_CALL pakey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException); | 148 | virtual ::sal_Int16 SAL_CALL pakey( ::sal_Int16 keycode ) throw (::com::sun::star::uno::RuntimeException); |
149 | + virtual ::sal_Int16 SAL_CALL cmpTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& text ) throw (::com::sun::star::uno::RuntimeException); | ||
147 | 150 | ||
148 | private: | 151 | private: |
149 | 152 |
src/oxt/local.cxx
@@ -236,3 +236,9 @@ | @@ -236,3 +236,9 @@ | ||
236 | return _set_text_at(hSession,row,col,(const unsigned char *) text); | 236 | return _set_text_at(hSession,row,col,(const unsigned char *) text); |
237 | } | 237 | } |
238 | 238 | ||
239 | + int pw3270::lib3270_session::cmp_text_at(int row, int col,const char *text) | ||
240 | + { | ||
241 | + if(!hSession) | ||
242 | + return EINVAL; | ||
243 | + return _cmp_text_at(hSession,row,col,text); | ||
244 | + } |
src/oxt/pw3270.idl
@@ -68,6 +68,7 @@ module br | @@ -68,6 +68,7 @@ module br | ||
68 | short setTextAt([in] short row, [in] short col, [in] string text); | 68 | short setTextAt([in] short row, [in] short col, [in] string text); |
69 | 69 | ||
70 | /* Actions */ | 70 | /* Actions */ |
71 | + short cmpTextAt([in] short row, [in] short col, [in] string text); | ||
71 | short enter(); | 72 | short enter(); |
72 | short pfkey([in] short keycode); | 73 | short pfkey([in] short keycode); |
73 | short pakey([in] short keycode); | 74 | short pakey([in] short keycode); |
@@ -75,6 +76,10 @@ module br | @@ -75,6 +76,10 @@ module br | ||
75 | /* Misc */ | 76 | /* Misc */ |
76 | short getRevision(); | 77 | short getRevision(); |
77 | short sleep([in] short seconds); | 78 | short sleep([in] short seconds); |
79 | + boolean isReady(); | ||
80 | +// short waitForReady([in] short seconds); | ||
81 | +// short waitForTextAt(in] short row, [in] short col, [in] string text, [in] short seconds); | ||
82 | + boolean isConnected(); | ||
78 | 83 | ||
79 | }; | 84 | }; |
80 | 85 |