Commit 63ea402dd057fdd31a81d6bf4fd69ff92d735c6a

Authored by perry.werneck@gmail.com
1 parent c33f2614

Work in progress

src/oxt/Makefile.in
... ... @@ -24,7 +24,7 @@
24 24 # erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
25 25 #
26 26  
27   -SOURCES=info.cc
  27 +SOURCES=info.cc get.cc service.cc init.cc
28 28  
29 29 UNO_CLASSES=XWeak RuntimeException
30 30  
... ... @@ -70,7 +70,7 @@ BINRLS=$(BINDIR)/Release
70 70 #---[ Build options ]----------------------------------------------------------
71 71  
72 72 CPPUENV="gcc3"
73   -CXXFLAGS=@CXXFLAGS@ -Wno-strict-aliasing -I./include -I$(includedir)/libreoffice -Wno-strict-aliasing -DCPPU_ENV=$(CPPUENV) -DLANGUAGE_BINDING_NAME=\"$(CPPUENV)\"
  73 +CXXFLAGS=@CXXFLAGS@ @DLL_CFLAGS@ -Wno-strict-aliasing -I./include -I$(includedir)/libreoffice -Wno-strict-aliasing -DCPPU_ENV=$(CPPUENV) -DLANGUAGE_BINDING_NAME=\"$(CPPUENV)\"
74 74  
75 75 OO_LDFLAGS=-L$(OO_SDK_HOME)/lib -L$(OO_SDK_URE_HOME)/lib \
76 76 -Wl,-rpath-link=$(OO_SDK_URE_HOME)/lib,-rpath=$(OO_SDK_URE_HOME)/lib \
... ...
src/oxt/get.cc 0 → 100644
... ... @@ -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., 59 Temple
  19 + * Place, Suite 330, Boston, MA, 02111-1307, USA
  20 + *
  21 + * Este programa está nomeado como get.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 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  30 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  31 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  32 + *
  33 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  34 + *
  35 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  36 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  37 + * Free Software Foundation.
  38 + *
  39 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  40 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  41 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  42 + * obter mais detalhes.
  43 + *
  44 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  45 + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
  46 + * Place, Suite 330, Boston, MA, 02111-1307, USA
  47 + *
  48 + * Este programa está nomeado como info.cc e possui - linhas de código.
  49 + *
  50 + * Contatos:
  51 + *
  52 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  53 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  54 + *
  55 + * Referência:
  56 + *
  57 + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes
  58 + *
  59 + */
  60 +
  61 + #include "globals.hpp"
  62 + #include "pw3270/lib3270.hpp"
  63 +
  64 +/*---[ Implement ]-----------------------------------------------------------------------------------------*/
  65 +
  66 + using namespace pw3270_impl;
  67 +
  68 + ::rtl::OUString session_impl::getVersion() throw (RuntimeException)
  69 + {
  70 + return OUString( RTL_CONSTASCII_USTRINGPARAM("Testing") );
  71 + }
... ...
src/oxt/globals.hpp
... ... @@ -57,37 +57,35 @@
57 57 #include <pw3270/lib3270.hpp>
58 58  
59 59  
60   - using namespace ::rtl; // for OUString
61   - using namespace ::com::sun::star; // for sdk interfaces
62   - using namespace ::com::sun::star::uno; // for basic types
  60 + using namespace ::rtl; // for OUString
  61 + using namespace ::com::sun::star; // for sdk interfaces
  62 + using namespace ::com::sun::star::lang; // for sdk interfaces
  63 + using namespace ::com::sun::star::uno; // for basic types
63 64  
64 65  
65 66 namespace pw3270_impl
66 67 {
67 68 // https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes
68   - class session_impl : public ::cppu::WeakImplHelper3< ::pw3270::lib3270, lang::XServiceInfo, lang::XInitialization >
  69 + class session_impl : public ::cppu::WeakImplHelper3< ::pw3270::lib3270, XServiceInfo, XInitialization >
69 70 {
70 71 public:
71   - OUString getImplementationName() throw (RuntimeException);
  72 + // XInitialization will be called upon createInstanceWithArguments[AndContext]()
  73 + virtual void SAL_CALL initialize( Sequence< Any > const & args ) throw (Exception);
72 74  
73   - };
74   -
75   - /*
76   - // https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Implementing_without_Helpers
77   - class session_impl : public ::pw3270::lib3270, lang::XServiceInfo
78   - {
79   - private:
80   - oslInterlockedCount m_refcount;
81   - public:
  75 + // XServiceInfo
  76 + virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
  77 + virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName ) throw (RuntimeException);
  78 + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
82 79  
83   - inline session_impl() throw () : m_refcount( 0 ) { }
  80 + // lib3270
  81 + virtual ::rtl::OUString SAL_CALL getVersion() throw (RuntimeException);
84 82  
85   - // XInterface
86   - virtual Any SAL_CALL queryInterface( Type const & type ) throw (RuntimeException);
87   - virtual void SAL_CALL acquire() throw ();
88   - virtual void SAL_CALL release() throw ();
89 83 };
90   - */
  84 +
  85 + extern Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl();
  86 + extern OUString SAL_CALL getImplementationName_session_impl();
  87 + extern Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () );
  88 +
91 89 };
92 90  
93 91  
... ...
src/oxt/info.cc
... ... @@ -45,8 +45,6 @@ OUString session_impl::getImplementationName() throw (RuntimeException)
45 45 return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.pw3270_impl.session") );
46 46 }
47 47  
48   -/*
49   -
50 48 sal_Bool session_impl::supportsService( OUString const & serviceName ) throw (RuntimeException)
51 49 {
52 50 // this object only supports one service, so the test is simple
... ... @@ -55,6 +53,6 @@ sal_Bool session_impl::supportsService( OUString const &amp; serviceName ) throw (Ru
55 53  
56 54 Sequence< OUString > session_impl::getSupportedServiceNames() throw (RuntimeException)
57 55 {
58   - return getSupportedServiceNames_pw3270_impl();
  56 + return getSupportedServiceNames_session_impl();
59 57 }
60   -*/
  58 +
... ...
src/oxt/init.cc 0 → 100644
... ... @@ -0,0 +1,55 @@
  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 init.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 + * Referência:
  29 + *
  30 + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Create_Instance_with_Arguments
  31 + *
  32 + */
  33 +
  34 + #include "globals.hpp"
  35 + #include <com/sun/star/lang/IllegalArgumentException.hpp>
  36 + #include "pw3270/lib3270.hpp"
  37 +
  38 +/*---[ Implement ]-----------------------------------------------------------------------------------------*/
  39 +
  40 +using namespace pw3270_impl;
  41 +
  42 +// XInitialization implementation
  43 +void session_impl::initialize( Sequence< Any > const & args ) throw (Exception)
  44 +{
  45 + if (1 != args.getLength())
  46 + {
  47 + throw lang::IllegalArgumentException(
  48 + OUString( RTL_CONSTASCII_USTRINGPARAM("give a string instanciating this component!") ),
  49 + (::cppu::OWeakObject *)this,
  50 + 0 );
  51 + }
  52 +
  53 + // Initialize
  54 +
  55 +}
... ...
src/oxt/loffice3270.cbp
... ... @@ -38,9 +38,14 @@
38 38 <Unit filename="../classlib/remote.cc" />
39 39 <Unit filename="../classlib/session.cc" />
40 40 <Unit filename="Makefile.in" />
  41 + <Unit filename="get.cc" />
41 42 <Unit filename="globals.hpp" />
  43 + <Unit filename="include/pw3270/lib3270.hdl" />
  44 + <Unit filename="include/pw3270/lib3270.hpp" />
42 45 <Unit filename="info.cc" />
  46 + <Unit filename="init.cc" />
43 47 <Unit filename="pw3270.idl" />
  48 + <Unit filename="service.cc" />
44 49 <Unit filename="testprogram.cc" />
45 50 <Extensions>
46 51 <code_completion />
... ...
src/oxt/service.cc 0 → 100644
... ... @@ -0,0 +1,100 @@
  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 info.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 + * Referência:
  29 + *
  30 + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Providing_a_Single_Factory_Using_a_Helper_Method
  31 + *
  32 + */
  33 +
  34 + #include "globals.hpp"
  35 + #include <cppuhelper/implementationentry.hxx>
  36 + #include "pw3270/lib3270.hpp"
  37 +
  38 +/*---[ Implement ]-----------------------------------------------------------------------------------------*/
  39 +
  40 +using namespace pw3270_impl;
  41 +
  42 +Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl()
  43 +{
  44 + Sequence<OUString> names(1);
  45 + names[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("pw3270.session"));
  46 + return names;
  47 +}
  48 +
  49 +OUString SAL_CALL getImplementationName_session_impl()
  50 +{
  51 + return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.lib3270.session") );
  52 +}
  53 +
  54 +Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () )
  55 +{
  56 + return static_cast< lang::XTypeProvider * >( new session_impl() );
  57 +}
  58 +
  59 +namespace pw3270_impl
  60 +{
  61 + static struct ::cppu::ImplementationEntry s_component_entries [] =
  62 + {
  63 + {
  64 + create_session_impl,
  65 + getImplementationName_session_impl,
  66 + getSupportedServiceNames_session_impl,
  67 + ::cppu::createSingleComponentFactory,
  68 + 0,
  69 + 0
  70 + },
  71 + {
  72 + 0,
  73 + 0,
  74 + 0,
  75 + 0,
  76 + 0,
  77 + 0
  78 + }
  79 + };
  80 +
  81 +}
  82 +
  83 +extern "C"
  84 +{
  85 + void * SAL_CALL component_getFactory(sal_Char const * implName, lang::XMultiServiceFactory * xMgr,registry::XRegistryKey * xRegistry )
  86 + {
  87 + return ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry, ::pw3270_impl::s_component_entries );
  88 + }
  89 +
  90 + sal_Bool SAL_CALL component_writeInfo(lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry )
  91 + {
  92 + return ::cppu::component_writeInfoHelper(xMgr, xRegistry, ::pw3270_impl::s_component_entries );
  93 + }
  94 +
  95 + void SAL_CALL component_getImplementationEnvironment(sal_Char const ** ppEnvTypeName, uno_Environment ** ppEnv )
  96 + {
  97 + * ppEnvTypeName = LANGUAGE_BINDING_NAME;
  98 + }
  99 +
  100 +}
... ...