diff --git a/src/oxt/Makefile.in b/src/oxt/Makefile.in index 1b64d06..ff329dc 100644 --- a/src/oxt/Makefile.in +++ b/src/oxt/Makefile.in @@ -24,7 +24,7 @@ # erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) # -SOURCES=info.cc +SOURCES=info.cc get.cc service.cc init.cc UNO_CLASSES=XWeak RuntimeException @@ -70,7 +70,7 @@ BINRLS=$(BINDIR)/Release #---[ Build options ]---------------------------------------------------------- CPPUENV="gcc3" -CXXFLAGS=@CXXFLAGS@ -Wno-strict-aliasing -I./include -I$(includedir)/libreoffice -Wno-strict-aliasing -DCPPU_ENV=$(CPPUENV) -DLANGUAGE_BINDING_NAME=\"$(CPPUENV)\" +CXXFLAGS=@CXXFLAGS@ @DLL_CFLAGS@ -Wno-strict-aliasing -I./include -I$(includedir)/libreoffice -Wno-strict-aliasing -DCPPU_ENV=$(CPPUENV) -DLANGUAGE_BINDING_NAME=\"$(CPPUENV)\" OO_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 \ diff --git a/src/oxt/get.cc b/src/oxt/get.cc new file mode 100644 index 0000000..297a3d5 --- /dev/null +++ b/src/oxt/get.cc @@ -0,0 +1,71 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA, 02111-1307, USA + * + * Este programa está nomeado como get.cc e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + /* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA, 02111-1307, USA + * + * Este programa está nomeado como info.cc e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + * Referência: + * + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes + * + */ + + #include "globals.hpp" + #include "pw3270/lib3270.hpp" + +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ + + using namespace pw3270_impl; + + ::rtl::OUString session_impl::getVersion() throw (RuntimeException) + { + return OUString( RTL_CONSTASCII_USTRINGPARAM("Testing") ); + } diff --git a/src/oxt/globals.hpp b/src/oxt/globals.hpp index 33bb264..a33dddb 100644 --- a/src/oxt/globals.hpp +++ b/src/oxt/globals.hpp @@ -57,37 +57,35 @@ #include - using namespace ::rtl; // for OUString - using namespace ::com::sun::star; // for sdk interfaces - using namespace ::com::sun::star::uno; // for basic types + using namespace ::rtl; // for OUString + using namespace ::com::sun::star; // for sdk interfaces + using namespace ::com::sun::star::lang; // for sdk interfaces + using namespace ::com::sun::star::uno; // for basic types namespace pw3270_impl { // https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes - class session_impl : public ::cppu::WeakImplHelper3< ::pw3270::lib3270, lang::XServiceInfo, lang::XInitialization > + class session_impl : public ::cppu::WeakImplHelper3< ::pw3270::lib3270, XServiceInfo, XInitialization > { public: - OUString getImplementationName() throw (RuntimeException); + // XInitialization will be called upon createInstanceWithArguments[AndContext]() + virtual void SAL_CALL initialize( Sequence< Any > const & args ) throw (Exception); - }; - - /* - // https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Implementing_without_Helpers - class session_impl : public ::pw3270::lib3270, lang::XServiceInfo - { - private: - oslInterlockedCount m_refcount; - public: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw (RuntimeException); + virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName ) throw (RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); - inline session_impl() throw () : m_refcount( 0 ) { } + // lib3270 + virtual ::rtl::OUString SAL_CALL getVersion() throw (RuntimeException); - // XInterface - virtual Any SAL_CALL queryInterface( Type const & type ) throw (RuntimeException); - virtual void SAL_CALL acquire() throw (); - virtual void SAL_CALL release() throw (); }; - */ + + extern Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl(); + extern OUString SAL_CALL getImplementationName_session_impl(); + extern Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () ); + }; diff --git a/src/oxt/info.cc b/src/oxt/info.cc index 9a25506..b47503c 100644 --- a/src/oxt/info.cc +++ b/src/oxt/info.cc @@ -45,8 +45,6 @@ OUString session_impl::getImplementationName() throw (RuntimeException) return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.pw3270_impl.session") ); } -/* - sal_Bool session_impl::supportsService( OUString const & serviceName ) throw (RuntimeException) { // this object only supports one service, so the test is simple @@ -55,6 +53,6 @@ sal_Bool session_impl::supportsService( OUString const & serviceName ) throw (Ru Sequence< OUString > session_impl::getSupportedServiceNames() throw (RuntimeException) { - return getSupportedServiceNames_pw3270_impl(); + return getSupportedServiceNames_session_impl(); } -*/ + diff --git a/src/oxt/init.cc b/src/oxt/init.cc new file mode 100644 index 0000000..f4061a9 --- /dev/null +++ b/src/oxt/init.cc @@ -0,0 +1,55 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA, 02111-1307, USA + * + * Este programa está nomeado como init.cc e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + * Referência: + * + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Create_Instance_with_Arguments + * + */ + + #include "globals.hpp" + #include + #include "pw3270/lib3270.hpp" + +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ + +using namespace pw3270_impl; + +// XInitialization implementation +void session_impl::initialize( Sequence< Any > const & args ) throw (Exception) +{ + if (1 != args.getLength()) + { + throw lang::IllegalArgumentException( + OUString( RTL_CONSTASCII_USTRINGPARAM("give a string instanciating this component!") ), + (::cppu::OWeakObject *)this, + 0 ); + } + + // Initialize + +} diff --git a/src/oxt/loffice3270.cbp b/src/oxt/loffice3270.cbp index 57753e8..2783c49 100644 --- a/src/oxt/loffice3270.cbp +++ b/src/oxt/loffice3270.cbp @@ -38,9 +38,14 @@ + + + + + diff --git a/src/oxt/service.cc b/src/oxt/service.cc new file mode 100644 index 0000000..d896c0f --- /dev/null +++ b/src/oxt/service.cc @@ -0,0 +1,100 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA, 02111-1307, USA + * + * Este programa está nomeado como info.cc e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + * Referência: + * + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Providing_a_Single_Factory_Using_a_Helper_Method + * + */ + + #include "globals.hpp" + #include + #include "pw3270/lib3270.hpp" + +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ + +using namespace pw3270_impl; + +Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl() +{ + Sequence names(1); + names[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("pw3270.session")); + return names; +} + +OUString SAL_CALL getImplementationName_session_impl() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.lib3270.session") ); +} + +Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () ) +{ + return static_cast< lang::XTypeProvider * >( new session_impl() ); +} + +namespace pw3270_impl +{ + static struct ::cppu::ImplementationEntry s_component_entries [] = + { + { + create_session_impl, + getImplementationName_session_impl, + getSupportedServiceNames_session_impl, + ::cppu::createSingleComponentFactory, + 0, + 0 + }, + { + 0, + 0, + 0, + 0, + 0, + 0 + } + }; + +} + +extern "C" +{ + void * SAL_CALL component_getFactory(sal_Char const * implName, lang::XMultiServiceFactory * xMgr,registry::XRegistryKey * xRegistry ) + { + return ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry, ::pw3270_impl::s_component_entries ); + } + + sal_Bool SAL_CALL component_writeInfo(lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry ) + { + return ::cppu::component_writeInfoHelper(xMgr, xRegistry, ::pw3270_impl::s_component_entries ); + } + + void SAL_CALL component_getImplementationEnvironment(sal_Char const ** ppEnvTypeName, uno_Environment ** ppEnv ) + { + * ppEnvTypeName = LANGUAGE_BINDING_NAME; + } + +} -- libgit2 0.21.2