Commit 256992946b90fefe071b9096d4199d573b9f5729
1 parent
6673a6f7
Exists in
master
and in
5 other branches
Iniciando implementacao de IPC no modulo libreoffice
Showing
6 changed files
with
284 additions
and
19 deletions
Show diff stats
src/oxt/Makefile.in
| 1 | 1 | ||
| 2 | PACKAGE=@PACKAGE_NAME@ | 2 | PACKAGE=@PACKAGE_NAME@ |
| 3 | 3 | ||
| 4 | -SOURCES=main.cxx local.cxx connection.cxx get.cxx set.cxx actions.cxx | 4 | +SOURCES=main.cxx local.cxx connection.cxx get.cxx set.cxx actions.cxx remote.cxx |
| 5 | 5 | ||
| 6 | prefix=/usr | 6 | prefix=/usr |
| 7 | exec_prefix=@exec_prefix@ | 7 | exec_prefix=@exec_prefix@ |
src/oxt/globals.hpp
| @@ -29,10 +29,10 @@ | @@ -29,10 +29,10 @@ | ||
| 29 | /*---[ Debug macros ]--------------------------------------------------------------------------------------*/ | 29 | /*---[ Debug macros ]--------------------------------------------------------------------------------------*/ |
| 30 | 30 | ||
| 31 | #ifdef DEBUG | 31 | #ifdef DEBUG |
| 32 | - #define trace(fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | 32 | + #define trace(fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); |
| 33 | #else | 33 | #else |
| 34 | #define trace( fmt, ... ) /* fmt __VA_ARGS__ */ | 34 | #define trace( fmt, ... ) /* fmt __VA_ARGS__ */ |
| 35 | - #endif | 35 | + #endif |
| 36 | 36 | ||
| 37 | /*---[ Object implementation ]-----------------------------------------------------------------------------*/ | 37 | /*---[ Object implementation ]-----------------------------------------------------------------------------*/ |
| 38 | 38 | ||
| @@ -128,6 +128,31 @@ | @@ -128,6 +128,31 @@ | ||
| 128 | 128 | ||
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | + class ipc3270_session : public session | ||
| 132 | + { | ||
| 133 | + public: | ||
| 134 | + ipc3270_session(const char *name); | ||
| 135 | + virtual ~ipc3270_session(); | ||
| 136 | + virtual int get_revision(void); | ||
| 137 | + virtual LIB3270_MESSAGE get_state(void); | ||
| 138 | + virtual char * get_text_at(int row, int col, int len); | ||
| 139 | + virtual int set_text_at(int row, int col, const char *text); | ||
| 140 | + virtual int cmp_text_at(int row, int col, const char *text); | ||
| 141 | + virtual void set_toggle(LIB3270_TOGGLE toggle, bool state); | ||
| 142 | + | ||
| 143 | + virtual int connect(const char *uri); | ||
| 144 | + virtual int disconnect(void); | ||
| 145 | + virtual bool connected(void); | ||
| 146 | + | ||
| 147 | + virtual int enter(void); | ||
| 148 | + virtual int pfkey(int key); | ||
| 149 | + virtual int pakey(int key); | ||
| 150 | + virtual bool in_tn3270e(); | ||
| 151 | + virtual void mem_free(void *); | ||
| 152 | + | ||
| 153 | + }; | ||
| 154 | + | ||
| 155 | + | ||
| 131 | class uno_impl : public ::cppu::WeakImplHelper3< br::com::bb::pw3270intf, com::sun::star::lang::XServiceInfo, com::sun::star::lang::XInitialization > | 156 | class uno_impl : public ::cppu::WeakImplHelper3< br::com::bb::pw3270intf, com::sun::star::lang::XServiceInfo, com::sun::star::lang::XInitialization > |
| 132 | { | 157 | { |
| 133 | public: | 158 | public: |
| @@ -163,6 +188,7 @@ | @@ -163,6 +188,7 @@ | ||
| 163 | virtual ::sal_Int16 SAL_CALL waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException); | 188 | virtual ::sal_Int16 SAL_CALL waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException); |
| 164 | virtual ::sal_Int16 SAL_CALL dsTrace( ::sal_Bool state ) throw (::com::sun::star::uno::RuntimeException); | 189 | virtual ::sal_Int16 SAL_CALL dsTrace( ::sal_Bool state ) throw (::com::sun::star::uno::RuntimeException); |
| 165 | virtual ::sal_Int16 SAL_CALL screenTrace( ::sal_Bool state ) throw (::com::sun::star::uno::RuntimeException); | 190 | virtual ::sal_Int16 SAL_CALL screenTrace( ::sal_Bool state ) throw (::com::sun::star::uno::RuntimeException); |
| 191 | + virtual ::sal_Int16 SAL_CALL setSession( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException); | ||
| 166 | 192 | ||
| 167 | private: | 193 | private: |
| 168 | 194 |
src/oxt/main.cxx
| @@ -79,13 +79,13 @@ static Reference< XInterface > SAL_CALL CreateInstance( const Reference< XCompon | @@ -79,13 +79,13 @@ static Reference< XInterface > SAL_CALL CreateInstance( const Reference< XCompon | ||
| 79 | * i.e. has special context | 79 | * i.e. has special context |
| 80 | */ | 80 | */ |
| 81 | extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv) | 81 | extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv) |
| 82 | -{ | ||
| 83 | -#ifdef LANGUAGE_BINDING_NAME | 82 | +{ |
| 83 | +#ifdef LANGUAGE_BINDING_NAME | ||
| 84 | trace("%s set envtype to %s\n",__FUNCTION__,LANGUAGE_BINDING_NAME); | 84 | trace("%s set envtype to %s\n",__FUNCTION__,LANGUAGE_BINDING_NAME); |
| 85 | - *ppEnvTypeName = LANGUAGE_BINDING_NAME; | ||
| 86 | -#else | ||
| 87 | - trace("%s set envtype to %s\n",__FUNCTION__,"msci"); | ||
| 88 | - *ppEnvTypeName = "msci"; | 85 | + *ppEnvTypeName = LANGUAGE_BINDING_NAME; |
| 86 | +#else | ||
| 87 | + trace("%s set envtype to %s\n",__FUNCTION__,"msci"); | ||
| 88 | + *ppEnvTypeName = "msci"; | ||
| 89 | #endif | 89 | #endif |
| 90 | } | 90 | } |
| 91 | 91 | ||
| @@ -115,10 +115,10 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char * | @@ -115,10 +115,10 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char * | ||
| 115 | * @return true if everything went fine | 115 | * @return true if everything went fine |
| 116 | */ | 116 | */ |
| 117 | extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey) | 117 | extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey) |
| 118 | -{ | ||
| 119 | - sal_Bool result = sal_False; | ||
| 120 | - | ||
| 121 | - trace("%s",__FUNCTION__); | 118 | +{ |
| 119 | + sal_Bool result = sal_False; | ||
| 120 | + | ||
| 121 | + trace("%s",__FUNCTION__); | ||
| 122 | 122 | ||
| 123 | if (pRegistryKey) | 123 | if (pRegistryKey) |
| 124 | { | 124 | { |
| @@ -141,8 +141,8 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * | @@ -141,8 +141,8 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * | ||
| 141 | // we should not ignore exceptions | 141 | // we should not ignore exceptions |
| 142 | } | 142 | } |
| 143 | } | 143 | } |
| 144 | - | ||
| 145 | - return result; | 144 | + |
| 145 | + return result; | ||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | /********************************************************* | 148 | /********************************************************* |
| @@ -171,7 +171,7 @@ extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void | @@ -171,7 +171,7 @@ extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void | ||
| 171 | void * pRet = 0; | 171 | void * pRet = 0; |
| 172 | 172 | ||
| 173 | trace("%s",__FUNCTION__); | 173 | trace("%s",__FUNCTION__); |
| 174 | - | 174 | + |
| 175 | if(pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) | 175 | if(pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) |
| 176 | { | 176 | { |
| 177 | Reference< XSingleComponentFactory > xFactory( ::cppu::createSingleComponentFactory( | 177 | Reference< XSingleComponentFactory > xFactory( ::cppu::createSingleComponentFactory( |
| @@ -184,7 +184,7 @@ extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void | @@ -184,7 +184,7 @@ extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void | ||
| 184 | pRet = xFactory.get(); | 184 | pRet = xFactory.get(); |
| 185 | } | 185 | } |
| 186 | } | 186 | } |
| 187 | - | 187 | + |
| 188 | return pRet; | 188 | return pRet; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| @@ -285,3 +285,12 @@ void pw3270::session::log(const char *fmt, const char *msg) | @@ -285,3 +285,12 @@ void pw3270::session::log(const char *fmt, const char *msg) | ||
| 285 | #endif // HAVE_SYSLOG | 285 | #endif // HAVE_SYSLOG |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | +::sal_Int16 SAL_CALL pw3270::uno_impl::setSession( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException) | ||
| 289 | +{ | ||
| 290 | + OString str = rtl::OUStringToOString( name , hSession->get_encoding() ); | ||
| 291 | + | ||
| 292 | + delete this->hSession; | ||
| 293 | + this->hSession = new ipc3270_session(str.getStr()); | ||
| 294 | + | ||
| 295 | + return 0; | ||
| 296 | +} |
src/oxt/pw3270.idl
| @@ -74,6 +74,7 @@ module br | @@ -74,6 +74,7 @@ module br | ||
| 74 | short pakey([in] short keycode); | 74 | short pakey([in] short keycode); |
| 75 | 75 | ||
| 76 | /* Misc */ | 76 | /* Misc */ |
| 77 | + short setSession([in] string name); | ||
| 77 | short getRevision(); | 78 | short getRevision(); |
| 78 | string getVersion(); | 79 | string getVersion(); |
| 79 | short log([in] string msg); | 80 | short log([in] string msg); |
| @@ -83,8 +84,8 @@ module br | @@ -83,8 +84,8 @@ module br | ||
| 83 | short waitForReady([in] short seconds); | 84 | short waitForReady([in] short seconds); |
| 84 | // short waitForTextAt(in] short row, [in] short col, [in] string text, [in] short seconds); | 85 | // short waitForTextAt(in] short row, [in] short col, [in] string text, [in] short seconds); |
| 85 | boolean isConnected(); | 86 | boolean isConnected(); |
| 86 | - short dsTrace([in] boolean mode); | ||
| 87 | - short screenTrace([in] boolean mode); | 87 | + short dsTrace([in] boolean mode); |
| 88 | + short screenTrace([in] boolean mode); | ||
| 88 | 89 | ||
| 89 | }; | 90 | }; |
| 90 | 91 |
src/oxt/pw3270OXT.cbp
| @@ -42,6 +42,7 @@ | @@ -42,6 +42,7 @@ | ||
| 42 | <Unit filename="main.cxx" /> | 42 | <Unit filename="main.cxx" /> |
| 43 | <Unit filename="manifest.xml.in" /> | 43 | <Unit filename="manifest.xml.in" /> |
| 44 | <Unit filename="pw3270.idl" /> | 44 | <Unit filename="pw3270.idl" /> |
| 45 | + <Unit filename="remote.cxx" /> | ||
| 45 | <Unit filename="set.cxx" /> | 46 | <Unit filename="set.cxx" /> |
| 46 | <Unit filename="testprogram.cxx" /> | 47 | <Unit filename="testprogram.cxx" /> |
| 47 | <Extensions> | 48 | <Extensions> |
| @@ -0,0 +1,228 @@ | @@ -0,0 +1,228 @@ | ||
| 1 | +/* | ||
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
| 5 | + * | ||
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
| 7 | + * | ||
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
| 10 | + * Free Software Foundation. | ||
| 11 | + * | ||
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
| 15 | + * obter mais detalhes. | ||
| 16 | + * | ||
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
| 19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
| 20 | + * | ||
| 21 | + * Este programa está nomeado como remote.cxx e possui - linhas de código. | ||
| 22 | + * | ||
| 23 | + * Contatos: | ||
| 24 | + * | ||
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
| 27 | + * licinio@bb.com.br (Licínio Luis Branco) | ||
| 28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | ||
| 29 | + * | ||
| 30 | + */ | ||
| 31 | + | ||
| 32 | + #include "globals.hpp" | ||
| 33 | + #include <errno.h> | ||
| 34 | + #include <string.h> | ||
| 35 | + | ||
| 36 | +/*---[ Statics ]-------------------------------------------------------------------------------------------*/ | ||
| 37 | + | ||
| 38 | + | ||
| 39 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | ||
| 40 | + | ||
| 41 | +pw3270::ipc3270_session::ipc3270_session(const char *name) : pw3270::session() | ||
| 42 | +{ | ||
| 43 | +#ifdef HAVE_DBUS | ||
| 44 | + | ||
| 45 | +#else | ||
| 46 | + | ||
| 47 | +#endif // HAVE_DBUS | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +pw3270::ipc3270_session::~ipc3270_session() | ||
| 51 | +{ | ||
| 52 | +#ifdef HAVE_DBUS | ||
| 53 | + | ||
| 54 | +#endif // HAVE_DBUS | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +int pw3270::ipc3270_session::get_revision(void) | ||
| 58 | +{ | ||
| 59 | +#ifdef HAVE_DBUS | ||
| 60 | + | ||
| 61 | + return -1; | ||
| 62 | + | ||
| 63 | +#else | ||
| 64 | + | ||
| 65 | + return -1; | ||
| 66 | + | ||
| 67 | +#endif // HAVE_DBUS | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +LIB3270_MESSAGE pw3270::ipc3270_session::get_state(void) | ||
| 71 | +{ | ||
| 72 | +#ifdef HAVE_DBUS | ||
| 73 | + | ||
| 74 | + return (LIB3270_MESSAGE) -1; | ||
| 75 | + | ||
| 76 | +#else | ||
| 77 | + | ||
| 78 | + return (LIB3270_MESSAGE) -1; | ||
| 79 | + | ||
| 80 | +#endif // HAVE_DBUS | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +char * pw3270::ipc3270_session::get_text_at(int row, int col, int len) | ||
| 84 | +{ | ||
| 85 | +#ifdef HAVE_DBUS | ||
| 86 | + | ||
| 87 | + return NULL; | ||
| 88 | + | ||
| 89 | +#else | ||
| 90 | + | ||
| 91 | + return NULL; | ||
| 92 | + | ||
| 93 | +#endif // HAVE_DBUS | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +int pw3270::ipc3270_session::set_text_at(int row, int col, const char *text) | ||
| 97 | +{ | ||
| 98 | +#ifdef HAVE_DBUS | ||
| 99 | + | ||
| 100 | + return -1; | ||
| 101 | + | ||
| 102 | +#else | ||
| 103 | + | ||
| 104 | + return -1; | ||
| 105 | + | ||
| 106 | +#endif // HAVE_DBUS | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +int pw3270::ipc3270_session::cmp_text_at(int row, int col, const char *text) | ||
| 110 | +{ | ||
| 111 | +#ifdef HAVE_DBUS | ||
| 112 | + | ||
| 113 | + return -1; | ||
| 114 | + | ||
| 115 | +#else | ||
| 116 | + | ||
| 117 | + return -1; | ||
| 118 | + | ||
| 119 | +#endif // HAVE_DBUS | ||
| 120 | +} | ||
| 121 | + | ||
| 122 | +void pw3270::ipc3270_session::set_toggle(LIB3270_TOGGLE toggle, bool state) | ||
| 123 | +{ | ||
| 124 | +} | ||
| 125 | + | ||
| 126 | +int pw3270::ipc3270_session::connect(const char *uri) | ||
| 127 | +{ | ||
| 128 | +#ifdef HAVE_DBUS | ||
| 129 | + | ||
| 130 | + return -1; | ||
| 131 | + | ||
| 132 | +#else | ||
| 133 | + | ||
| 134 | + return -1; | ||
| 135 | + | ||
| 136 | +#endif // HAVE_DBUS | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +int pw3270::ipc3270_session::disconnect(void) | ||
| 140 | +{ | ||
| 141 | +#ifdef HAVE_DBUS | ||
| 142 | + | ||
| 143 | + return -1; | ||
| 144 | + | ||
| 145 | +#else | ||
| 146 | + | ||
| 147 | + return -1; | ||
| 148 | + | ||
| 149 | +#endif // HAVE_DBUS | ||
| 150 | +} | ||
| 151 | + | ||
| 152 | +bool pw3270::ipc3270_session::connected(void) | ||
| 153 | +{ | ||
| 154 | +#ifdef HAVE_DBUS | ||
| 155 | + | ||
| 156 | + return false; | ||
| 157 | + | ||
| 158 | +#else | ||
| 159 | + | ||
| 160 | + return false; | ||
| 161 | + | ||
| 162 | +#endif // HAVE_DBUS | ||
| 163 | +} | ||
| 164 | + | ||
| 165 | +int pw3270::ipc3270_session::enter(void) | ||
| 166 | +{ | ||
| 167 | +#ifdef HAVE_DBUS | ||
| 168 | + | ||
| 169 | + return -1; | ||
| 170 | + | ||
| 171 | +#else | ||
| 172 | + | ||
| 173 | + return -1; | ||
| 174 | + | ||
| 175 | +#endif // HAVE_DBUS | ||
| 176 | +} | ||
| 177 | + | ||
| 178 | +int pw3270::ipc3270_session::pfkey(int key) | ||
| 179 | +{ | ||
| 180 | +#ifdef HAVE_DBUS | ||
| 181 | + | ||
| 182 | + return -1; | ||
| 183 | + | ||
| 184 | +#else | ||
| 185 | + | ||
| 186 | + return -1; | ||
| 187 | + | ||
| 188 | +#endif // HAVE_DBUS | ||
| 189 | +} | ||
| 190 | + | ||
| 191 | +int pw3270::ipc3270_session::pakey(int key) | ||
| 192 | +{ | ||
| 193 | +#ifdef HAVE_DBUS | ||
| 194 | + | ||
| 195 | + return -1; | ||
| 196 | + | ||
| 197 | +#else | ||
| 198 | + | ||
| 199 | + return -1; | ||
| 200 | + | ||
| 201 | +#endif // HAVE_DBUS | ||
| 202 | +} | ||
| 203 | + | ||
| 204 | +bool pw3270::ipc3270_session::in_tn3270e() | ||
| 205 | +{ | ||
| 206 | +#ifdef HAVE_DBUS | ||
| 207 | + | ||
| 208 | + return false; | ||
| 209 | + | ||
| 210 | +#else | ||
| 211 | + | ||
| 212 | + return false; | ||
| 213 | + | ||
| 214 | +#endif // HAVE_DBUS | ||
| 215 | +} | ||
| 216 | + | ||
| 217 | +void pw3270::ipc3270_session::mem_free(void *ptr) | ||
| 218 | +{ | ||
| 219 | +#ifdef HAVE_DBUS | ||
| 220 | + | ||
| 221 | + | ||
| 222 | +#else | ||
| 223 | + | ||
| 224 | + | ||
| 225 | +#endif // HAVE_DBUS | ||
| 226 | +} | ||
| 227 | + | ||
| 228 | + |