Commit 32b35febe4c859660a1eafe81be6a18fab831bb0

Authored by perry.werneck@gmail.com
1 parent 0c585ebf

Remodelando interface libreoffice

src/oxt/Makefile.in
... ... @@ -32,6 +32,15 @@ REGMERGE=@REGMERGE@
32 32 CPPUMAKER=@CPPUMAKER@
33 33 TYPES_RDB=@OO_SDK_URE_HOME@/share/misc/types.rdb
34 34  
  35 +#---[ Paths ]------------------------------------------------------------------
  36 +
  37 +prefix=@prefix@
  38 +exec_prefix=@exec_prefix@
  39 +bindir=@bindir@
  40 +sbindir=@sbindir@
  41 +libdir=@libdir@
  42 +includedir=@includedir@
  43 +
35 44 #---[ Tools ]------------------------------------------------------------------
36 45  
37 46 CXX=@CXX@
... ... @@ -42,6 +51,22 @@ MKDIR=@MKDIR_P@
42 51 CLASSLIBDIR=../classlib
43 52 include $(CLASSLIBDIR)/class.mak
44 53  
  54 +#---[ lib3270 common class ]---------------------------------------------------
  55 +
  56 +OBJDIR=.obj
  57 +BINDIR=.bin
  58 +
  59 +OBJDBG=$(OBJDIR)/Debug
  60 +BINDBG=$(BINDIR)/Debug
  61 +
  62 +OBJRLS=$(OBJDIR)/Release
  63 +BINRLS=$(BINDIR)/Release
  64 +
  65 +#---[ Build options ]----------------------------------------------------------
  66 +
  67 +CPPUENV="gcc3"
  68 +CXXFLAGS=@CXXFLAGS@ -Wno-strict-aliasing -I./include -I$(includedir)/libreoffice -Wno-strict-aliasing -DCPPU_ENV=$(CPPUENV) -DLANGUAGE_BINDING_NAME=\"$(CPPUENV)\"
  69 +
45 70 #---[ Rules ]------------------------------------------------------------------
46 71  
47 72 %.urd: %.idl
... ... @@ -54,6 +79,13 @@ include $(CLASSLIBDIR)/class.mak
54 79 @$(MKDIR) `dirname $@`
55 80 @$(REGMERGE) $@ /UCR $<
56 81  
  82 +$(OBJDBG)/%.o: %.cc include/pw3270/lib3270.hpp Makefile
  83 + @echo $< ...
  84 + @mkdir -p `dirname $@`
  85 + $(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ $<
  86 +# $(DBG_CFLAGS) $(CXXFLAGS) $(LIB3270_CFLAGS) -DLIBNAME=\"$(BINDBG)/$(PROGRAM_NAME).uno@DLLEXT@\" -o $@ -c $<
  87 +
  88 +
57 89 #---[ UNO targets ]------------------------------------------------------------
58 90  
59 91 include/pw3270/lib3270.hpp: pw3270.rdb
... ... @@ -62,6 +94,13 @@ include/pw3270/lib3270.hpp: pw3270.rdb
62 94 @$(CPPUMAKER) -O./include -Tpw3270.lib3270 $(TYPES_RDB) $<
63 95  
64 96  
  97 +#---[ Debug targets ]----------------------------------------------------------
  98 +
  99 +Debug: $(OBJDBG)/testprogram.o
  100 +
  101 +cleanDebug: clean
  102 +
  103 +
65 104 #---[ Misc targets ]-----------------------------------------------------------
66 105  
67 106 all: include/pw3270/lib3270.hpp
... ... @@ -70,5 +109,7 @@ clean:
70 109 @rm -f *.urd
71 110 @rm -f *.rdb
72 111 @rm -fr include
  112 + @rm -fr $(OBJDIR)
  113 + @rm -fr $(BINDIR)
73 114  
74 115  
... ...
src/oxt/globals.hpp 0 → 100644
... ... @@ -0,0 +1,69 @@
  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 globals.hpp 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 de Mendonça)
  27 + *
  28 + */
  29 +
  30 +#ifndef PW3270_OXT_GLOBALS_HPP_INCLUDED
  31 +
  32 + #define PW3270_OXT_GLOBALS_HPP_INCLUDED 1
  33 +
  34 + #define CPPUENV "gcc3"
  35 +
  36 + #ifdef _WIN32
  37 + #define SAL_W32
  38 + #else
  39 + #define UNX 1
  40 + #define GCC 1
  41 + #define LINUX 1
  42 + #endif
  43 +
  44 +
  45 + #include <cppuhelper/implbase2.hxx> // "3" implementing three interfaces
  46 + #include <cppuhelper/factory.hxx>
  47 + #include <cppuhelper/implementationentry.hxx>
  48 +
  49 + #include <com/sun/star/lang/XServiceInfo.hpp>
  50 + #include <com/sun/star/lang/IllegalArgumentException.hpp>
  51 + #include <pw3270/lib3270.hpp>
  52 +
  53 +
  54 + using namespace ::rtl; // for OUString
  55 + using namespace ::com::sun::star; // for sdk interfaces
  56 + using namespace ::com::sun::star::uno; // for basic types
  57 +
  58 +
  59 + namespace pw3270_impl
  60 + {
  61 +
  62 + class sessionImpl : public ::cppu::WeakImplHelper2< ::pw3270::lib3270,lang::XServiceInfo >
  63 + {
  64 +
  65 + };
  66 + }
  67 +
  68 +
  69 +#endif // PW3270_OXT_GLOBALS_HPP_INCLUDED
... ...
src/oxt/loffice3270.cbp 0 → 100644
... ... @@ -0,0 +1,51 @@
  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 LibreOffice" />
  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 LibreOffice" 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 LibreOffice" 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="../classlib/class.mak.in" />
  36 + <Unit filename="../classlib/exception.cc" />
  37 + <Unit filename="../classlib/local.cc" />
  38 + <Unit filename="../classlib/remote.cc" />
  39 + <Unit filename="../classlib/session.cc" />
  40 + <Unit filename="Makefile.in" />
  41 + <Unit filename="globals.hpp" />
  42 + <Unit filename="pw3270.idl" />
  43 + <Unit filename="testprogram.cc" />
  44 + <Extensions>
  45 + <code_completion />
  46 + <envvars />
  47 + <debugger />
  48 + <lib_finder disable_auto="1" />
  49 + </Extensions>
  50 + </Project>
  51 +</CodeBlocks_project_file>
... ...
src/oxt/pw3270.idl
... ... @@ -45,7 +45,7 @@ module pw3270
45 45 string getVersion();
46 46 };
47 47  
48   - service host
  48 + service session
49 49 {
50 50 interface lib3270;
51 51 };
... ...
src/oxt/testprogram.cc 0 → 100644
... ... @@ -0,0 +1,135 @@
  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.cc 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 + *
  28 + */
  29 +
  30 + #include "globals.hpp"
  31 + #include "pw3270/lib3270.hpp"
  32 +
  33 +/*---[ Implement ]-----------------------------------------------------------------------------------------*/
  34 +
  35 +using namespace com::sun::star::uno;
  36 +
  37 +int SAL_CALL main(int argc, char **argv)
  38 +{
  39 +
  40 +/*
  41 + Reference< XSimpleRegistry > xReg = createSimpleRegistry();
  42 +
  43 + OSL_ENSURE( xReg.is(), "### cannot get service instance of \"SimpleRegistry\"!" );
  44 +
  45 + xReg->open(OUString::createFromAscii("pw3270.rdb"), sal_False, sal_False);
  46 +
  47 + OSL_ENSURE( xReg->isValid(), "### cannot open test registry \"pw3270.rdb\"!" );
  48 +
  49 +
  50 + TRACE("%s","Calling bootstrap_InitialComponentContext");
  51 + Reference< XComponentContext > xContext = bootstrap_InitialComponentContext(xReg);
  52 + OSL_ENSURE( xContext.is(), "### cannot creage intial component context!" );
  53 +
  54 + TRACE("%s","Calling getServiceManager\n");
  55 + Reference< XMultiComponentFactory > xMgr = xContext->getServiceManager();
  56 + OSL_ENSURE( xMgr.is(), "### cannot get initial service manager!" );
  57 +
  58 + // register my component
  59 + TRACE("%s","Calling createInstanceWithContext");
  60 +
  61 + Reference< XImplementationRegistration > xImplReg(
  62 + xMgr->createInstanceWithContext(OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration"), xContext), UNO_QUERY);
  63 + OSL_ENSURE( xImplReg.is(), "### cannot get service instance of \"com.sun.star.registry.ImplementationRegistration\"!" );
  64 +
  65 + if (xImplReg.is())
  66 + {
  67 + const char *libname = LIBNAME;
  68 +
  69 + TRACE("Loading %s",libname);
  70 +
  71 + xImplReg->registerImplementation(
  72 + OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), // loader for component
  73 + OUString::createFromAscii(libname), // component location
  74 + Reference< XSimpleRegistry >() // registry omitted,
  75 + // defaulting to service manager registry used
  76 + );
  77 +
  78 + // get an object instance
  79 + printf("Calling createInstanceWithContext(%s)\n",IMPLNAME);
  80 +
  81 + Reference< XInterface > xx ;
  82 + xx = xMgr->createInstanceWithContext(OUString::createFromAscii(IMPLNAME), xContext);
  83 +
  84 + printf("Instance: %p\n",&xx);
  85 +
  86 + Reference< pw3270intf > srv( xx, UNO_QUERY );
  87 +
  88 + OSL_ENSURE( srv.is(), "### cannot get service instance!");
  89 +
  90 + printf("object.is(): %d\n",srv.is());
  91 +
  92 + if(srv.is())
  93 + {
  94 + // Wait for commands
  95 + OString str;
  96 + char buffer[80];
  97 + printf("getConnectionState: %d\n", srv->getConnectionState());
  98 +
  99 + str = OUStringToOString( srv->getVersion(),RTL_TEXTENCODING_UTF8);
  100 + printf("Version:\t%s\n",str.pData->buffer);
  101 +
  102 + str = OUStringToOString( srv->getRevision(),RTL_TEXTENCODING_UTF8);
  103 + printf("Revision:\t%s\n",str.pData->buffer);
  104 +
  105 + printf("Connect(): %d\n" , srv->Connect(OUString::createFromAscii("L:3270.df.bb:9023"),10));
  106 +
  107 + sleep(5);
  108 +
  109 + //str = OUStringToOString( srv->getScreenContentAt(20,39,5),RTL_TEXTENCODING_UTF8);
  110 + //Trace("ContentsAt(20,39): \"%s\"",str.pData->buffer);
  111 + printf("waitForStringAt(SISBB) returned %d\n",srv->waitForStringAt(20,39,OUString::createFromAscii("SISBB"),20));
  112 + printf("sendEnterKey() returned %d\n",srv->sendEnterKey());
  113 + printf("waitForStringAt(Senha) returned %d\n",srv->waitForStringAt(14,2,OUString::createFromAscii("Senha"),20));
  114 + printf("setStringAt returned %d\n",srv->setStringAt(13,21,OUString::createFromAscii("c1103788")));
  115 +
  116 + str = OUStringToOString( srv->getScreenContent(),RTL_TEXTENCODING_UTF8);
  117 + printf("Entire screen:\n%s\n",str.pData->buffer);
  118 +
  119 + printf("Enter to exit...\n");
  120 + fgets(buffer,80,stdin);
  121 +
  122 + printf("Disconnect(): %d\n" , srv->Disconnect());
  123 +
  124 + sleep(5);
  125 +
  126 + }
  127 + }
  128 +
  129 +
  130 + Reference< XComponent >::query( xContext )->dispose();
  131 +
  132 +*/
  133 +
  134 + return 0;
  135 +}
... ...