Commit 6f9d18d0170ae184dcb22996de4d073f23242ce7
1 parent
8e6a7384
Exists in
master
and in
5 other branches
Iniciando implementação do módulo libreoffice
Showing
8 changed files
with
685 additions
and
1 deletions
Show diff stats
Makefile.in
| @@ -78,7 +78,7 @@ MAKENSIS=@MAKENSIS@ | @@ -78,7 +78,7 @@ MAKENSIS=@MAKENSIS@ | ||
| 78 | 78 | ||
| 79 | PLUGIN_RELEASE_ARGS=BINDIR="../../../$(BINDIR)" LIB3270_MODE=Release | 79 | PLUGIN_RELEASE_ARGS=BINDIR="../../../$(BINDIR)" LIB3270_MODE=Release |
| 80 | PLUGIN_DEBUG_ARGS=BINDIR="../../../$(BINDIR)" LIB3270_MODE=Debug | 80 | PLUGIN_DEBUG_ARGS=BINDIR="../../../$(BINDIR)" LIB3270_MODE=Debug |
| 81 | - | 81 | + |
| 82 | #---[ Rules ]------------------------------------------------------------------ | 82 | #---[ Rules ]------------------------------------------------------------------ |
| 83 | 83 | ||
| 84 | %.tar.bz2: %.tar | 84 | %.tar.bz2: %.tar |
| @@ -329,6 +329,7 @@ clean: | @@ -329,6 +329,7 @@ clean: | ||
| 329 | @make -C src/plugins/remotectl clean | 329 | @make -C src/plugins/remotectl clean |
| 330 | @make -C src/plugins/rx3270 clean | 330 | @make -C src/plugins/rx3270 clean |
| 331 | @make -C src/plugins/dbus3270 clean | 331 | @make -C src/plugins/dbus3270 clean |
| 332 | + @make -C src/oxt clean | ||
| 332 | @rm -f $(PACKAGE_NAME).png | 333 | @rm -f $(PACKAGE_NAME).png |
| 333 | @rm -f $(PACKAGE_NAME)-logo.png | 334 | @rm -f $(PACKAGE_NAME)-logo.png |
| 334 | @rm -f *.log | 335 | @rm -f *.log |
configure.ac
| @@ -430,6 +430,7 @@ AC_CONFIG_FILES([ | @@ -430,6 +430,7 @@ AC_CONFIG_FILES([ | ||
| 430 | src/lib3270/Makefile | 430 | src/lib3270/Makefile |
| 431 | src/lib3270/mkversion.sh | 431 | src/lib3270/mkversion.sh |
| 432 | src/pw3270/Makefile | 432 | src/pw3270/Makefile |
| 433 | + src/oxt/Makefile | ||
| 433 | src/pw3270/uiparser/Makefile | 434 | src/pw3270/uiparser/Makefile |
| 434 | src/tools/Makefile | 435 | src/tools/Makefile |
| 435 | src/plugins/remotectl/Makefile | 436 | src/plugins/remotectl/Makefile |
| @@ -0,0 +1,113 @@ | @@ -0,0 +1,113 @@ | ||
| 1 | + | ||
| 2 | +PACKAGE=@PACKAGE_NAME@ | ||
| 3 | + | ||
| 4 | +SOURCES=main.cxx | ||
| 5 | + | ||
| 6 | +prefix=/usr | ||
| 7 | +exec_prefix=@exec_prefix@ | ||
| 8 | +libdir=@libdir@ | ||
| 9 | + | ||
| 10 | +#---[ Paths ]------------------------------------------------------------------------------------------ | ||
| 11 | +ROOTDIR ?= . | ||
| 12 | +OBJDIR ?= $(ROOTDIR)/.obj | ||
| 13 | +BINDIR ?= $(ROOTDIR)/.bin | ||
| 14 | + | ||
| 15 | +BINDBG ?= $(BINDIR)/Debug | ||
| 16 | +BINRLS ?= $(BINDIR)/Release | ||
| 17 | +LIBDBG ?= $(BINDIR)/Debug/lib | ||
| 18 | + | ||
| 19 | +OBJDBG = $(OBJDIR)/Debug | ||
| 20 | +OBJRLS = $(OBJDIR)/Release | ||
| 21 | + | ||
| 22 | +#---[ Tools ]------------------------------------------------------------------------------------------ | ||
| 23 | +MKDIR=@MKDIR_P@ | ||
| 24 | +CXX=@CXX@ | ||
| 25 | + | ||
| 26 | +DBG_CFLAGS=-g -DDEBUG=1 | ||
| 27 | +RLS_CFLAGS=-DNDEBUG=1 | ||
| 28 | + | ||
| 29 | +#---[ LibreOffice SDK ]-------------------------------------------------------------------------------- | ||
| 30 | +COMID=gcc3 | ||
| 31 | +OO_SDK_NAME=openoffice.org3.5_sdk | ||
| 32 | +OFFICE_HOME=${libdir}/libreoffice | ||
| 33 | +OO_SDK_HOME=${OFFICE_HOME}/sdk | ||
| 34 | +OO_SDK_URE_HOME=${OFFICE_HOME}/ure | ||
| 35 | +OO_SDK_URE_BIN_DIR=${OO_SDK_URE_HOME}/bin | ||
| 36 | +OO_SDK_URE_LIB_DIR=${OO_SDK_URE_HOME}/lib | ||
| 37 | + | ||
| 38 | +TYPES_RDB=${OO_SDK_URE_HOME}/share/misc/types.rdb | ||
| 39 | + | ||
| 40 | +SALLIB=-luno_sal | ||
| 41 | +CPPULIB=-luno_cppu | ||
| 42 | +CPPUHELPERLIB=-luno_cppuhelper$(COMID) | ||
| 43 | +SALHELPERLIB=-luno_salhelper$(COMID) | ||
| 44 | +REGLIB=-lreg | ||
| 45 | +STORELIB=-lstore | ||
| 46 | + | ||
| 47 | +# Libre office tools | ||
| 48 | +IDLC=${OO_SDK_HOME}/bin/idlc | ||
| 49 | +REGMERGE=${OO_SDK_URE_BIN_DIR}/regmerge | ||
| 50 | +CPPUMAKER=${OO_SDK_HOME}/bin/cppumaker | ||
| 51 | + | ||
| 52 | +#---[ Rules ]------------------------------------------------------------------------------------------ | ||
| 53 | + | ||
| 54 | +DLL_CFLAGS=@DLL_CFLAGS@ | ||
| 55 | +DLL_FLAGS=-shared | ||
| 56 | + | ||
| 57 | +CXXFLAGS=-Wno-strict-aliasing -I$(OBJDIR)/uno/include -I$(OO_SDK_HOME)/include -I$(OBJDIR)/uno/include/br/com/bb | ||
| 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 \ | ||
| 59 | + $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) | ||
| 60 | + | ||
| 61 | +# CC_DEFINES=-DUNX -DGCC -DLINUX -DCPPU_ENV=$(CPPU_ENV) -DGXX_INCLUDE_PATH=$(SDK_GXX_INCLUDE_PATH) -DHAVE_GCC_VISIBILITY_FEATURE | ||
| 62 | + | ||
| 63 | + | ||
| 64 | +$(OBJDBG)/%.o: %.cxx $(OBJDIR)/uno/include/br/com/bb/$(PACKAGE).hpp Makefile | ||
| 65 | + @echo $< ... | ||
| 66 | + @$(MKDIR) `dirname $@` | ||
| 67 | + @$(CXX) $(DBG_CFLAGS) $(CXXFLAGS) $(DLL_CFLAGS) -o $@ -c $< | ||
| 68 | + | ||
| 69 | +%.urd: %.idl | ||
| 70 | + @echo $< ... | ||
| 71 | + @$(MKDIR) `dirname $@` | ||
| 72 | + @$(IDLC) -C -I$(OO_SDK_HOME)/idl -O`dirname $@` $< | ||
| 73 | + | ||
| 74 | +%.uno.rdb: %.urd $(TYPES_RDB) | ||
| 75 | + @echo $< ... | ||
| 76 | + @mkdir -p `dirname $@` | ||
| 77 | + @rm -f $@ | ||
| 78 | + $(REGMERGE) -v $@ / $(TYPES_RDB) | ||
| 79 | + $(REGMERGE) -v $@ /UCR $< | ||
| 80 | + $(REGMERGE) -v $@ / $< | ||
| 81 | + | ||
| 82 | +#---[ Targets ]---------------------------------------------------------------------------------------- | ||
| 83 | + | ||
| 84 | +Debug: $(BINDBG)/testprogram | ||
| 85 | + | ||
| 86 | +run: $(BINDBG)/testprogram | ||
| 87 | + @$(BINDBG)/testprogram | ||
| 88 | + | ||
| 89 | +$(BINDBG)/$(PACKAGE).uno@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC).o) | ||
| 90 | + @echo $@ ... | ||
| 91 | + @$(MKDIR) -p `dirname $@` | ||
| 92 | + @$(CXX) $(DLL_FLAGS) $(LDFLAGS) -o $@ $^ | ||
| 93 | + | ||
| 94 | +$(BINDBG)/testprogram: $(BINDBG)/$(PACKAGE).uno@DLLEXT@ $(OBJDBG)/testprogram.o | ||
| 95 | + @echo $@ ... | ||
| 96 | + @$(MKDIR) -p `dirname $@` | ||
| 97 | + @$(CXX) $(LDFLAGS) -o $@ $(OBJDBG)/testprogram.o | ||
| 98 | + | ||
| 99 | +$(OBJDIR)/uno/include/br/com/bb/$(PACKAGE).hpp: $(PACKAGE).uno.rdb | ||
| 100 | + @echo $< ... | ||
| 101 | + @rm -fr $(OBJDIR)/uno/include | ||
| 102 | + @$(MKDIR) $(OBJDIR)/uno/include | ||
| 103 | + @$(CPPUMAKER) -O$(OBJDIR)/uno/include -L -BUCR $< | ||
| 104 | + @touch $@ | ||
| 105 | + | ||
| 106 | +cleanDebug: clean | ||
| 107 | + | ||
| 108 | +clean: | ||
| 109 | + @rm -f *.urd | ||
| 110 | + @rm -f *.uno.rdb | ||
| 111 | + @rm -fr $(OBJDIR) | ||
| 112 | + @rm -fr $(BINDIR) | ||
| 113 | + |
| @@ -0,0 +1,77 @@ | @@ -0,0 +1,77 @@ | ||
| 1 | + | ||
| 2 | + | ||
| 3 | +#ifndef GLOBALS_HPP_INCLUDED | ||
| 4 | + | ||
| 5 | + #define GLOBALS_HPP_INCLUDED 1 | ||
| 6 | + #define UNX 1 | ||
| 7 | + #define GCC 1 | ||
| 8 | + #define LINUX 1 | ||
| 9 | + #define CPPU_ENV gcc3 | ||
| 10 | + #define HAVE_GCC_VISIBILITY_FEATURE 1 | ||
| 11 | + #define LANGUAGE_BINDING_NAME "gcc3" | ||
| 12 | + | ||
| 13 | + #include <stdio.h> | ||
| 14 | + | ||
| 15 | + #include <rtl/uuid.h> | ||
| 16 | + #include <osl/thread.hxx> | ||
| 17 | + | ||
| 18 | + #include <cppuhelper/implbase3.hxx> // "3" implementing three interfaces | ||
| 19 | + #include <cppuhelper/factory.hxx> | ||
| 20 | + #include <cppuhelper/implementationentry.hxx> | ||
| 21 | + | ||
| 22 | + #include <com/sun/star/lang/XServiceInfo.hpp> | ||
| 23 | + #include <com/sun/star/lang/XInitialization.hpp> | ||
| 24 | + #include <com/sun/star/lang/IllegalArgumentException.hpp> | ||
| 25 | + | ||
| 26 | + #include <pw3270intf.hpp> | ||
| 27 | + | ||
| 28 | + /*---[ Debug macros ]--------------------------------------------------------------------------------------*/ | ||
| 29 | + | ||
| 30 | + #ifdef DEBUG | ||
| 31 | + #define trace(fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | ||
| 32 | + #else | ||
| 33 | + #define trace( fmt, ... ) /* fmt __VA_ARGS__ */ | ||
| 34 | + #endif | ||
| 35 | + | ||
| 36 | + /*---[ Object implementation ]-----------------------------------------------------------------------------*/ | ||
| 37 | + | ||
| 38 | + #define IMPLNAME "br.com.bb.pw3270intf" | ||
| 39 | + #define SERVICENAME "br.com.bb.pw3270" | ||
| 40 | + | ||
| 41 | + using namespace br::com::bb; | ||
| 42 | + using namespace ::rtl; // for OUString | ||
| 43 | + using namespace ::com::sun::star; // for sdk interfaces | ||
| 44 | + using namespace ::com::sun::star::uno; // for basic types | ||
| 45 | + | ||
| 46 | + namespace pw3270 | ||
| 47 | + { | ||
| 48 | + | ||
| 49 | + class uno_impl : public ::cppu::WeakImplHelper3< br::com::bb::pw3270intf, com::sun::star::lang::XServiceInfo, com::sun::star::lang::XInitialization > | ||
| 50 | + { | ||
| 51 | + public: | ||
| 52 | + | ||
| 53 | + uno_impl( const com::sun::star::uno::Reference< XComponentContext > & xContext ); | ||
| 54 | + virtual ~uno_impl(); | ||
| 55 | + | ||
| 56 | + // XInitialization will be called upon createInstanceWithArguments[AndContext]() | ||
| 57 | + virtual void SAL_CALL initialize( Sequence< Any > const & args ) throw (Exception); | ||
| 58 | + | ||
| 59 | + // XServiceInfo implementation | ||
| 60 | + virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException); | ||
| 61 | + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); | ||
| 62 | + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException); | ||
| 63 | + | ||
| 64 | + // pw3270 implementation - Main | ||
| 65 | + virtual sal_Int16 SAL_CALL getRevision() throw (RuntimeException); | ||
| 66 | + | ||
| 67 | + private: | ||
| 68 | + | ||
| 69 | + // H3270 *hSession; | ||
| 70 | + | ||
| 71 | + }; | ||
| 72 | + | ||
| 73 | + }; | ||
| 74 | + | ||
| 75 | + | ||
| 76 | +#endif // GLOBALS_HPP_INCLUDED | ||
| 77 | + |
| @@ -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 main.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 | + | ||
| 34 | +#include <com/sun/star/registry/XRegistryKey.hpp> | ||
| 35 | +#include <com/sun/star/lang/XSingleComponentFactory.hpp> | ||
| 36 | + | ||
| 37 | +using namespace com::sun::star::registry; // for XRegistryKey | ||
| 38 | +using namespace com::sun::star::lang; // for XSingleComponentFactory | ||
| 39 | + | ||
| 40 | +/*---[ Statics ]-------------------------------------------------------------------------------------------*/ | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + | ||
| 44 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | ||
| 45 | + | ||
| 46 | +static Sequence< OUString > getSupportedServiceNames() | ||
| 47 | +{ | ||
| 48 | + Sequence<OUString> names(1); | ||
| 49 | + | ||
| 50 | + trace("%s returns: %s",__FUNCTION__, SERVICENAME); | ||
| 51 | + names[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME ) ); | ||
| 52 | + | ||
| 53 | + return names; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +static Reference< XInterface > SAL_CALL CreateInstance( const Reference< XComponentContext > & xContext ) | ||
| 57 | +{ | ||
| 58 | + return static_cast< XTypeProvider * >( new pw3270::uno_impl( xContext ) ); | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +/*---[ Implement exported calls ]--------------------------------------------------------------------------*/ | ||
| 62 | + | ||
| 63 | +/************************************************************** | ||
| 64 | + * Function to determine the environment of the implementation. | ||
| 65 | + * | ||
| 66 | + * If the environment is NOT session specific | ||
| 67 | + * (needs no additional context), then this function | ||
| 68 | + * should return the environment type name and leave ppEnv (0). | ||
| 69 | + * | ||
| 70 | + * @param ppEnvTypeName environment type name; | ||
| 71 | + * string must be constant | ||
| 72 | + * @param ppEnv function returns its environment | ||
| 73 | + * if the environment is session specific, | ||
| 74 | + * i.e. has special context | ||
| 75 | + */ | ||
| 76 | +extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv) | ||
| 77 | +{ | ||
| 78 | +#ifdef LANGUAGE_BINDING_NAME | ||
| 79 | + trace("%s set envtype to %s\n",__FUNCTION__,LANGUAGE_BINDING_NAME); | ||
| 80 | + *ppEnvTypeName = LANGUAGE_BINDING_NAME; | ||
| 81 | +#else | ||
| 82 | + trace("%s set envtype to %s\n",__FUNCTION__,"msci"); | ||
| 83 | + *ppEnvTypeName = "msci"; | ||
| 84 | +#endif | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +/************************************************************ | ||
| 88 | + * Optional function to retrieve a component description. | ||
| 89 | + * | ||
| 90 | + * @return an XML formatted string containing a short | ||
| 91 | + * component description | ||
| 92 | + */ | ||
| 93 | +// typedef const sal_Char * (SAL_CALL * component_getDescriptionFunc)(void); | ||
| 94 | + | ||
| 95 | +/********************************************************** | ||
| 96 | + * Writes component registry info, at least writing the | ||
| 97 | + * supported service names. | ||
| 98 | + * | ||
| 99 | + * @param pServiceManager a service manager | ||
| 100 | + * (the type is XMultiServiceFactory | ||
| 101 | + * to be used by the environment | ||
| 102 | + * returned by | ||
| 103 | + * component_getImplementationEnvironment) | ||
| 104 | + * | ||
| 105 | + * @param pRegistryKey a registry key | ||
| 106 | + * (the type is XRegistryKey to be used | ||
| 107 | + * by the environment returned by | ||
| 108 | + * component_getImplementationEnvironment) | ||
| 109 | + * | ||
| 110 | + * @return true if everything went fine | ||
| 111 | + */ | ||
| 112 | +extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey) | ||
| 113 | +{ | ||
| 114 | + sal_Bool result = sal_False; | ||
| 115 | + | ||
| 116 | + trace("%s",__FUNCTION__); | ||
| 117 | + | ||
| 118 | + if (pRegistryKey) | ||
| 119 | + { | ||
| 120 | + try | ||
| 121 | + { | ||
| 122 | + Reference< XRegistryKey > xNewKey( | ||
| 123 | + reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( | ||
| 124 | + OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) ); | ||
| 125 | + | ||
| 126 | + const Sequence< OUString > & rSNL = getSupportedServiceNames(); | ||
| 127 | + const OUString * pArray = rSNL.getConstArray(); | ||
| 128 | + | ||
| 129 | + for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) | ||
| 130 | + xNewKey->createKey( pArray[nPos] ); | ||
| 131 | + | ||
| 132 | + return sal_True; | ||
| 133 | + } | ||
| 134 | + catch (InvalidRegistryException &) | ||
| 135 | + { | ||
| 136 | + // we should not ignore exceptions | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + return result; | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +/********************************************************* | ||
| 144 | + * Retrieves a factory to create component instances. | ||
| 145 | + * | ||
| 146 | + * @param pImplName desired implementation name | ||
| 147 | + * | ||
| 148 | + * @param pServiceManager a service manager | ||
| 149 | + * (the type is XMultiServiceFactory | ||
| 150 | + * to be used by the environment | ||
| 151 | + * returned by | ||
| 152 | + * component_getImplementationEnvironment) | ||
| 153 | + * | ||
| 154 | + * @param pRegistryKey a registry key | ||
| 155 | + * (the type is XRegistryKey to be used | ||
| 156 | + * by the environment returned by | ||
| 157 | + * component_getImplementationEnvironment) | ||
| 158 | + * | ||
| 159 | + * @return acquired component factory | ||
| 160 | + * (the type is XInterface to be used by the | ||
| 161 | + * environment returned by | ||
| 162 | + * component_getImplementationEnvironment) | ||
| 163 | + */ | ||
| 164 | +extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey) | ||
| 165 | +{ | ||
| 166 | + void * pRet = 0; | ||
| 167 | + | ||
| 168 | + trace("%s",__FUNCTION__); | ||
| 169 | + | ||
| 170 | + if(pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) | ||
| 171 | + { | ||
| 172 | + Reference< XSingleComponentFactory > xFactory( ::cppu::createSingleComponentFactory( | ||
| 173 | + CreateInstance, OUString::createFromAscii( IMPLNAME ), getSupportedServiceNames() )); | ||
| 174 | + | ||
| 175 | + | ||
| 176 | + if (xFactory.is()) | ||
| 177 | + { | ||
| 178 | + xFactory->acquire(); | ||
| 179 | + pRet = xFactory.get(); | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + return pRet; | ||
| 184 | +} | ||
| 185 | + | ||
| 186 | +/*---[ Implement XInitialization ]-------------------------------------------------------------------------*/ | ||
| 187 | + | ||
| 188 | +void SAL_CALL pw3270::uno_impl::initialize( Sequence< Any > const & args ) throw (Exception) | ||
| 189 | +{ | ||
| 190 | + trace("%s",__FUNCTION__); | ||
| 191 | +} | ||
| 192 | + | ||
| 193 | +/*---[ Implement XServiceInfo ]----------------------------------------------------------------------------*/ | ||
| 194 | + | ||
| 195 | +OUString SAL_CALL pw3270::uno_impl::getImplementationName( ) throw(RuntimeException) | ||
| 196 | +{ | ||
| 197 | + trace("%s",__FUNCTION__); | ||
| 198 | + return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ); | ||
| 199 | +} | ||
| 200 | + | ||
| 201 | +sal_Bool SAL_CALL pw3270::uno_impl::supportsService( const OUString& ServiceName ) throw(RuntimeException) | ||
| 202 | +{ | ||
| 203 | + trace("%s",__FUNCTION__); | ||
| 204 | + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("IMPLNAME") ); | ||
| 205 | +} | ||
| 206 | + | ||
| 207 | +Sequence< OUString > pw3270::uno_impl::getSupportedServiceNames() throw (RuntimeException) | ||
| 208 | +{ | ||
| 209 | + return getSupportedServiceNames(); | ||
| 210 | +} | ||
| 211 | + | ||
| 212 | +/*---[ Implement pw3270 ]----------------------------------------------------------------------------------*/ | ||
| 213 | + | ||
| 214 | +pw3270::uno_impl::uno_impl( const Reference< XComponentContext > & xContext ) | ||
| 215 | +{ | ||
| 216 | + | ||
| 217 | +} | ||
| 218 | + | ||
| 219 | +pw3270::uno_impl::~uno_impl() | ||
| 220 | +{ | ||
| 221 | + trace("%s: Object deleted",__FUNCTION__); | ||
| 222 | +} | ||
| 223 | + | ||
| 224 | +sal_Int16 SAL_CALL pw3270::uno_impl::getRevision() throw (RuntimeException) | ||
| 225 | +{ | ||
| 226 | + return 0; | ||
| 227 | +} | ||
| 228 | + |
| @@ -0,0 +1,71 @@ | @@ -0,0 +1,71 @@ | ||
| 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., 51 Franklin | ||
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | + * | ||
| 21 | + * Este programa está nomeado como pw3270.idl 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 <com/sun/star/uno/XInterface.idl> | ||
| 33 | +#include <com/sun/star/lang/XTypeProvider.idl> | ||
| 34 | + | ||
| 35 | +/* | ||
| 36 | + | ||
| 37 | + Referências: | ||
| 38 | + | ||
| 39 | + http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp | ||
| 40 | + http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp#Specifying_an_interface | ||
| 41 | + | ||
| 42 | + */ | ||
| 43 | + | ||
| 44 | +module br | ||
| 45 | +{ | ||
| 46 | + module com | ||
| 47 | + { | ||
| 48 | + module bb | ||
| 49 | + { | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * Interface to pw3270. | ||
| 53 | + * | ||
| 54 | + * http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Default_Mappings | ||
| 55 | + * | ||
| 56 | + */ | ||
| 57 | + interface pw3270intf : com::sun::star::uno::XInterface | ||
| 58 | + { | ||
| 59 | + short getRevision(); | ||
| 60 | + }; | ||
| 61 | + | ||
| 62 | + service pw3270 | ||
| 63 | + { | ||
| 64 | + // exported interfaces: | ||
| 65 | + interface pw3270intf; | ||
| 66 | + }; | ||
| 67 | + | ||
| 68 | + }; | ||
| 69 | + }; | ||
| 70 | +}; | ||
| 71 | + |
| @@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
| 2 | +<CodeBlocks_project_file> | ||
| 3 | + <FileVersion major="1" minor="6" /> | ||
| 4 | + <Project> | ||
| 5 | + <Option title="pw3270 OXT" /> | ||
| 6 | + <Option makefile_is_custom="1" /> | ||
| 7 | + <Option pch_mode="2" /> | ||
| 8 | + <Option compiler="gcc" /> | ||
| 9 | + <Build> | ||
| 10 | + <Target title="Debug"> | ||
| 11 | + <Option output=".bin/Debug/pw3270 OXT" prefix_auto="1" extension_auto="1" /> | ||
| 12 | + <Option object_output=".obj/Debug/" /> | ||
| 13 | + <Option type="1" /> | ||
| 14 | + <Option compiler="gcc" /> | ||
| 15 | + <Compiler> | ||
| 16 | + <Add option="-g" /> | ||
| 17 | + </Compiler> | ||
| 18 | + </Target> | ||
| 19 | + <Target title="Release"> | ||
| 20 | + <Option output=".bin/Release/pw3270 OXT" prefix_auto="1" extension_auto="1" /> | ||
| 21 | + <Option object_output=".obj/Release/" /> | ||
| 22 | + <Option type="1" /> | ||
| 23 | + <Option compiler="gcc" /> | ||
| 24 | + <Compiler> | ||
| 25 | + <Add option="-O2" /> | ||
| 26 | + </Compiler> | ||
| 27 | + <Linker> | ||
| 28 | + <Add option="-s" /> | ||
| 29 | + </Linker> | ||
| 30 | + </Target> | ||
| 31 | + </Build> | ||
| 32 | + <Compiler> | ||
| 33 | + <Add option="-Wall" /> | ||
| 34 | + </Compiler> | ||
| 35 | + <Unit filename="Makefile.in" /> | ||
| 36 | + <Unit filename="globals.hpp" /> | ||
| 37 | + <Unit filename="main.cxx" /> | ||
| 38 | + <Unit filename="pw3270.idl" /> | ||
| 39 | + <Unit filename="testprogram.cxx" /> | ||
| 40 | + <Extensions> | ||
| 41 | + <code_completion /> | ||
| 42 | + <debugger /> | ||
| 43 | + </Extensions> | ||
| 44 | + </Project> | ||
| 45 | +</CodeBlocks_project_file> |
| @@ -0,0 +1,148 @@ | @@ -0,0 +1,148 @@ | ||
| 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 testprogram.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 <stdio.h> | ||
| 33 | +#ifdef WIN32 | ||
| 34 | + #include <windows.h> | ||
| 35 | + #define sleep(x) Sleep(x) | ||
| 36 | +#endif | ||
| 37 | + | ||
| 38 | +#define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | ||
| 39 | + | ||
| 40 | +#include "globals.hpp" | ||
| 41 | +#include <cppuhelper/bootstrap.hxx> | ||
| 42 | +#include <com/sun/star/registry/XSimpleRegistry.hpp> | ||
| 43 | +#include <com/sun/star/registry/XImplementationRegistration.hpp> | ||
| 44 | +#include <com/sun/star/lang/XComponent.hpp> | ||
| 45 | + | ||
| 46 | +using namespace com::sun::star::registry; | ||
| 47 | +using namespace com::sun::star::lang; | ||
| 48 | +using namespace cppu; | ||
| 49 | + | ||
| 50 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | ||
| 51 | + | ||
| 52 | +int SAL_CALL main(int argc, char **argv) | ||
| 53 | +{ | ||
| 54 | + Reference< XSimpleRegistry > xReg = createSimpleRegistry(); | ||
| 55 | + | ||
| 56 | + OSL_ENSURE( xReg.is(), "### cannot get service instance of \"com.sun.star.regiystry.SimpleRegistry\"!" ); | ||
| 57 | + | ||
| 58 | + xReg->open(OUString::createFromAscii("pw3270.uno.rdb"), sal_False, sal_False); | ||
| 59 | + | ||
| 60 | + OSL_ENSURE( xReg->isValid(), "### cannot open test registry \"pw3270.uno.rdb\"!" ); | ||
| 61 | + | ||
| 62 | + trace("%s","Calling bootstrap_InitialComponentContext"); | ||
| 63 | + Reference< XComponentContext > xContext = bootstrap_InitialComponentContext(xReg); | ||
| 64 | + OSL_ENSURE( xContext.is(), "### cannot creage intial component context!" ); | ||
| 65 | + | ||
| 66 | + trace("%s","Calling getServiceManager\n"); | ||
| 67 | + Reference< XMultiComponentFactory > xMgr = xContext->getServiceManager(); | ||
| 68 | + OSL_ENSURE( xMgr.is(), "### cannot get initial service manager!" ); | ||
| 69 | + | ||
| 70 | + // register my component | ||
| 71 | + trace("%s","Calling createInstanceWithContext"); | ||
| 72 | + | ||
| 73 | + Reference< XImplementationRegistration > xImplReg( | ||
| 74 | + xMgr->createInstanceWithContext(OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration"), xContext), UNO_QUERY); | ||
| 75 | + OSL_ENSURE( xImplReg.is(), "### cannot get service instance of \"com.sun.star.registry.ImplementationRegistration\"!" ); | ||
| 76 | + | ||
| 77 | + if (xImplReg.is()) | ||
| 78 | + { | ||
| 79 | + const char *libname = ".bin/Debug/pw3270.uno.so"; | ||
| 80 | + | ||
| 81 | + trace("Loading %s",libname); | ||
| 82 | + | ||
| 83 | + xImplReg->registerImplementation( | ||
| 84 | + OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), // loader for component | ||
| 85 | + OUString::createFromAscii(libname), // component location | ||
| 86 | + Reference< XSimpleRegistry >() // registry omitted, | ||
| 87 | + // defaulting to service manager registry used | ||
| 88 | + ); | ||
| 89 | + | ||
| 90 | + // get an object instance | ||
| 91 | + printf("Calling createInstanceWithContext(%s)\n",IMPLNAME); | ||
| 92 | + | ||
| 93 | + Reference< XInterface > xx ; | ||
| 94 | + xx = xMgr->createInstanceWithContext(OUString::createFromAscii(IMPLNAME), xContext); | ||
| 95 | + | ||
| 96 | + printf("Instance: %p\n",&xx); | ||
| 97 | + | ||
| 98 | + Reference< pw3270intf > srv( xx, UNO_QUERY ); | ||
| 99 | + | ||
| 100 | + OSL_ENSURE( srv.is(), "### cannot get service instance!"); | ||
| 101 | + | ||
| 102 | + printf("object.is(): %d\n",srv.is()); | ||
| 103 | + | ||
| 104 | + if(srv.is()) | ||
| 105 | + { | ||
| 106 | + // Wait for commands | ||
| 107 | +// OString str; | ||
| 108 | +// char buffer[80]; | ||
| 109 | +// printf("getConnectionState: %d\n", srv->getConnectionState()); | ||
| 110 | + | ||
| 111 | +// str = OUStringToOString( srv->getVersion(),RTL_TEXTENCODING_UTF8); | ||
| 112 | +// printf("Version:\t%s\n",str.pData->buffer); | ||
| 113 | + | ||
| 114 | + printf("Revision:\t%d\n",srv->getRevision()); | ||
| 115 | + | ||
| 116 | + // printf("Connect(): %d\n" , srv->Connect(OUString::createFromAscii("L:3270.df.bb:9023"),10)); | ||
| 117 | + | ||
| 118 | + // sleep(5); | ||
| 119 | + | ||
| 120 | + //str = OUStringToOString( srv->getScreenContentAt(20,39,5),RTL_TEXTENCODING_UTF8); | ||
| 121 | + //Trace("ContentsAt(20,39): \"%s\"",str.pData->buffer); | ||
| 122 | + | ||
| 123 | + /* | ||
| 124 | + printf("waitForStringAt(SISBB) returned %d\n",srv->waitForStringAt(20,39,OUString::createFromAscii("SISBB"),20)); | ||
| 125 | + printf("sendEnterKey() returned %d\n",srv->sendEnterKey()); | ||
| 126 | + printf("waitForStringAt(Senha) returned %d\n",srv->waitForStringAt(14,2,OUString::createFromAscii("Senha"),20)); | ||
| 127 | + printf("setStringAt returned %d\n",srv->setStringAt(13,21,OUString::createFromAscii("c1103788"))); | ||
| 128 | + | ||
| 129 | + str = OUStringToOString( srv->getScreenContent(),RTL_TEXTENCODING_UTF8); | ||
| 130 | + printf("Entire screen:\n%s\n",str.pData->buffer); | ||
| 131 | + | ||
| 132 | + printf("Enter to exit...\n"); | ||
| 133 | + fgets(buffer,80,stdin); | ||
| 134 | + | ||
| 135 | + printf("Disconnect(): %d\n" , srv->Disconnect()); | ||
| 136 | + | ||
| 137 | + sleep(5); | ||
| 138 | + | ||
| 139 | + */ | ||
| 140 | + | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + Reference< XComponent >::query( xContext )->dispose(); | ||
| 146 | + | ||
| 147 | + return 0; | ||
| 148 | +} |