Commit 509cd479e297d355664d50098906183d98e4fcab
1 parent
f4e1f2d4
Exists in
master
and in
5 other branches
Corrigindo segfault no acesso dbus, implementando módulo OpenOffice
Showing
14 changed files
with
280 additions
and
19 deletions
Show diff stats
src/classlib/classlib.cbp
src/classlib/remote.cc
... | ... | @@ -667,7 +667,9 @@ |
667 | 667 | |
668 | 668 | #elif defined(HAVE_DBUS) |
669 | 669 | |
670 | - rc = query_intval("connect", DBUS_TYPE_STRING, "", DBUS_TYPE_INVALID); | |
670 | + static const char * str = ""; | |
671 | + | |
672 | + rc = query_intval("connect", DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID); | |
671 | 673 | |
672 | 674 | #else |
673 | 675 | rc = -1; | ... | ... |
src/classlib/session.cc
... | ... | @@ -294,7 +294,7 @@ |
294 | 294 | return -1; |
295 | 295 | } |
296 | 296 | |
297 | - string * session::file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename) | |
297 | + string * session::file_chooser_dialog(int action, const char *title, const char *extension, const char *filename) | |
298 | 298 | { |
299 | 299 | return NULL; |
300 | 300 | } |
... | ... | @@ -463,7 +463,7 @@ |
463 | 463 | return string(ebc2asc(buffer,sz)); |
464 | 464 | } |
465 | 465 | |
466 | - int session::file_transfer(LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl, int blksize, int primspace, int secspace, int dft) | |
466 | + int session::file_transfer(LIB3270_FT_OPTION options, const char *local, const char *remote, int lrecl, int blksize, int primspace, int secspace, int dft) | |
467 | 467 | { |
468 | 468 | log("Can't transfer %s: File transfer is unavailable", local ? local : "file"); |
469 | 469 | return EINVAL; | ... | ... |
src/classlib/testprogram.cc
src/include/pw3270/class.h
... | ... | @@ -51,9 +51,15 @@ |
51 | 51 | #include <string> |
52 | 52 | #include <stdarg.h> |
53 | 53 | #include <lib3270.h> |
54 | - #include <gtk/gtk.h> | |
55 | 54 | #include <errno.h> |
56 | 55 | |
56 | + #ifdef DEBUG | |
57 | + #include <stdio.h> | |
58 | + #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | |
59 | + #else | |
60 | + #define trace(x, ...) // __VA_ARGS__ | |
61 | + #endif | |
62 | + | |
57 | 63 | #ifndef ETIMEDOUT |
58 | 64 | #define ETIMEDOUT 1238 |
59 | 65 | #endif // !ETIMEDOUT |
... | ... | @@ -191,10 +197,10 @@ |
191 | 197 | |
192 | 198 | // Dialogs |
193 | 199 | virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
194 | - virtual string * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); | |
200 | + virtual string * file_chooser_dialog(int action, const char *title, const char *extension, const char *filename); | |
195 | 201 | |
196 | 202 | // File transfer |
197 | - virtual int file_transfer(LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl = 0, int blksize = 0, int primspace = 0, int secspace = 0, int dft = 4096); | |
203 | + virtual int file_transfer(LIB3270_FT_OPTION options, const char *local, const char *remote, int lrecl = 0, int blksize = 0, int primspace = 0, int secspace = 0, int dft = 4096); | |
198 | 204 | |
199 | 205 | // Charset translation |
200 | 206 | string * get_3270_text(string *str); | ... | ... |
src/openoffice/Makefile.in
... | ... | @@ -25,9 +25,12 @@ |
25 | 25 | # |
26 | 26 | |
27 | 27 | PACKAGE_NAME=@PACKAGE_NAME@ |
28 | -SOURCES=info.cc get.cc service.cc init.cc | |
28 | +SOURCES=info.cc get.cc set.cc service.cc init.cc connect.cc | |
29 | + | |
30 | +UNO_CLASSES= /com/sun/star/uno/XWeak \ | |
31 | + /com/sun/star/uno/RuntimeException \ | |
32 | + /com/sun/star/lang/WrappedTargetException | |
29 | 33 | |
30 | -UNO_CLASSES=XWeak RuntimeException | |
31 | 34 | |
32 | 35 | #---[ LibreOffice SDK ]-------------------------------------------------------- |
33 | 36 | |
... | ... | @@ -73,6 +76,7 @@ BINRLS=$(BINDIR)/Release |
73 | 76 | |
74 | 77 | #---[ lib3270 common class ]--------------------------------------------------- |
75 | 78 | |
79 | +DEBUG_CFLAGS=-DDEBUG=1 -g -Wall | |
76 | 80 | PW3270_CFLAGS=-I../include |
77 | 81 | CLASSLIBDIR=../classlib |
78 | 82 | include $(CLASSLIBDIR)/class.mak |
... | ... | @@ -80,7 +84,7 @@ include $(CLASSLIBDIR)/class.mak |
80 | 84 | #---[ Build options ]---------------------------------------------------------- |
81 | 85 | |
82 | 86 | CPPUENV="gcc3" |
83 | -CXXFLAGS=@CXXFLAGS@ -fvisibility=hidden @DLL_CFLAGS@ -Wno-strict-aliasing -I./include -I$(includedir)/libreoffice -Wno-strict-aliasing -DCPPU_ENV=$(CPPUENV) -DLANGUAGE_BINDING_NAME=\"$(CPPUENV)\" | |
87 | +CXXFLAGS=@CXXFLAGS@ -fvisibility=hidden @DLL_CFLAGS@ -Wno-strict-aliasing -I../include -I./include -I$(includedir)/libreoffice -Wno-strict-aliasing -DCPPU_ENV=$(CPPUENV) -DLANGUAGE_BINDING_NAME=\"$(CPPUENV)\" | |
84 | 88 | |
85 | 89 | OO_LDFLAGS=-L$(OO_SDK_HOME)/lib -L$(OO_SDK_URE_HOME)/lib \ |
86 | 90 | -Wl,-rpath-link=$(OO_SDK_URE_HOME)/lib,-rpath=$(OO_SDK_URE_HOME)/lib \ |
... | ... | @@ -109,7 +113,7 @@ include/%.hpp: $(RDBDIR)/%.rdb |
109 | 113 | @$(CPPUMAKER) -O./include $(TYPES_RDB) $< |
110 | 114 | |
111 | 115 | $(OBJDBG)/%.o: %.cc include/$(PACKAGE_NAME)/lib3270.hpp \ |
112 | - $(foreach CLS, $(basename $(UNO_CLASSES)), include/com/sun/star/uno/$(CLS).hpp) \ | |
116 | + $(foreach CLS, $(UNO_CLASSES), include/$(CLS).hpp) \ | |
113 | 117 | *.hpp Makefile |
114 | 118 | @echo " CC `basename $@`" |
115 | 119 | @mkdir -p `dirname $@` |
... | ... | @@ -128,13 +132,13 @@ include/$(PACKAGE_NAME)/lib3270.hpp: $(RDBDIR)/$(PACKAGE_NAME).rdb |
128 | 132 | |
129 | 133 | Debug: $(BINDBG)/$(PACKAGE_NAME).oxt |
130 | 134 | |
131 | -add: $(BINDBG)/$(PACKAGE_NAME).oxt | |
135 | +run: $(BINDBG)/$(PACKAGE_NAME).oxt | |
132 | 136 | @SHARED=false $(UNOPKG) add --verbose --force $(BINDBG)/$(PACKAGE_NAME).oxt |
137 | + @libreoffice testmacros.odt | |
138 | + @SHARED=false $(UNOPKG) remove $(PACKAGE_NAME) | |
133 | 139 | |
134 | -$(BINDBG)/testprogram: $(OBJDBG)/testprogram@OBJEXT@ $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) | |
135 | - @echo $@ ... | |
136 | - @$(MKDIR) `dirname $@` | |
137 | - $(CXX) -shared $(LDFLAGS) $(OO_LDFLAGS) -o $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) | |
140 | +add: $(BINDBG)/$(PACKAGE_NAME).oxt | |
141 | + @SHARED=false $(UNOPKG) add --verbose --force $(BINDBG)/$(PACKAGE_NAME).oxt | |
138 | 142 | |
139 | 143 | $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@: \ |
140 | 144 | $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) \ |
... | ... | @@ -146,7 +150,7 @@ $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@: \ |
146 | 150 | |
147 | 151 | $(BINDBG)/$(PACKAGE_NAME).oxt: \ |
148 | 152 | $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ \ |
149 | - $(PACKAGE_NAME).rdb \ | |
153 | + $(RDBDIR)/$(PACKAGE_NAME).rdb \ | |
150 | 154 | description.xml \ |
151 | 155 | manifest.xml \ |
152 | 156 | description.txt |
... | ... | @@ -155,7 +159,7 @@ $(BINDBG)/$(PACKAGE_NAME).oxt: \ |
155 | 159 | |
156 | 160 | @$(MKDIR) $(BINDBG)/$(PACKAGE).oxt.tmp |
157 | 161 | |
158 | - @cp $(PACKAGE_NAME).rdb $(BINDBG)/$(PACKAGE).oxt.tmp | |
162 | + @cp $(RDBDIR)/$(PACKAGE_NAME).rdb $(BINDBG)/$(PACKAGE).oxt.tmp | |
159 | 163 | @cp $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ $(BINDBG)/$(PACKAGE).oxt.tmp |
160 | 164 | |
161 | 165 | @$(MKDIR) $(BINDBG)/$(PACKAGE).oxt.tmp/META-INF |
... | ... | @@ -167,7 +171,6 @@ $(BINDBG)/$(PACKAGE_NAME).oxt: \ |
167 | 171 | @$(CONVERT) ../$(PACKAGE_NAME)/pixmaps/$(PACKAGE_NAME).svg --format=png > $(BINDBG)/$(PACKAGE).oxt.tmp/$(PACKAGE_NAME).png |
168 | 172 | |
169 | 173 | @cp $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ $(BINDBG)/$(PACKAGE_NAME).oxt.tmp |
170 | - @cp $(PACKAGE_NAME).rdb $(BINDBG)/$(PACKAGE_NAME).oxt.tmp | |
171 | 174 | @cd $(BINDBG)/$(PACKAGE).oxt.tmp ; $(ZIP) -r -m ../$(PACKAGE_NAME).oxt . |
172 | 175 | @rm -fr $(BINDBG)/$(PACKAGE).oxt.tmp |
173 | 176 | @echo $@ Ok. |
... | ... | @@ -182,6 +185,7 @@ clean: |
182 | 185 | @rm -fr $(RDBDIR) |
183 | 186 | @rm -fr $(URDDIR) |
184 | 187 | @rm -fr include |
188 | + @rm -f *.rdb | |
185 | 189 | @rm -fr $(OBJDIR) |
186 | 190 | @rm -fr $(BINDIR) |
187 | 191 | ... | ... |
... | ... | @@ -0,0 +1,87 @@ |
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 connect.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 | + | |
31 | + #include "globals.hpp" | |
32 | + #include "pw3270/lib3270.hpp" | |
33 | + #include <exception> | |
34 | + #include <com/sun/star/uno/RuntimeException.hdl> | |
35 | + | |
36 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
37 | + | |
38 | + using namespace pw3270_impl; | |
39 | + | |
40 | + ::sal_Int16 SAL_CALL session_impl::Connect() throw (::com::sun::star::uno::RuntimeException) | |
41 | + { | |
42 | + trace("%s: hSession=%p",__FUNCTION__,hSession); | |
43 | + | |
44 | + try | |
45 | + { | |
46 | + if(!hSession) | |
47 | + hSession = h3270::session::get_default(); | |
48 | + | |
49 | + return hSession->connect(false); | |
50 | + | |
51 | + } catch(std::exception &e) | |
52 | + { | |
53 | + trace("%s failed: %s",__FUNCTION__,e.what()); | |
54 | + | |
55 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
56 | + | |
57 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
58 | + | |
59 | + } | |
60 | + | |
61 | + return -1; | |
62 | + | |
63 | + | |
64 | + } | |
65 | + | |
66 | + ::sal_Int16 SAL_CALL session_impl::Disconnect() throw (::com::sun::star::uno::RuntimeException) | |
67 | + { | |
68 | + try | |
69 | + { | |
70 | + if(!hSession) | |
71 | + hSession = h3270::session::get_default(); | |
72 | + | |
73 | + return hSession->disconnect(); | |
74 | + | |
75 | + } catch(std::exception &e) | |
76 | + { | |
77 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
78 | + | |
79 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
80 | + | |
81 | + } | |
82 | + | |
83 | + return -1; | |
84 | + | |
85 | + } | |
86 | + | |
87 | + | ... | ... |
src/openoffice/get.cc
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | */ |
33 | 33 | |
34 | 34 | #include "globals.hpp" |
35 | + #include <lib3270/config.h> | |
35 | 36 | #include "pw3270/lib3270.hpp" |
36 | 37 | |
37 | 38 | /*---[ Implement ]-----------------------------------------------------------------------------------------*/ |
... | ... | @@ -40,5 +41,12 @@ |
40 | 41 | |
41 | 42 | ::rtl::OUString session_impl::getVersion() throw (RuntimeException) |
42 | 43 | { |
43 | - return OUString( RTL_CONSTASCII_USTRINGPARAM("Testing") ); | |
44 | + trace("%s: hSession=%p",__FUNCTION__,hSession); | |
45 | + return OUString( RTL_CONSTASCII_USTRINGPARAM(PACKAGE_VERSION) ); | |
46 | + } | |
47 | + | |
48 | + ::rtl::OUString session_impl::getRevision() throw (RuntimeException) | |
49 | + { | |
50 | + trace("%s: hSession=%p",__FUNCTION__,hSession); | |
51 | + return OUString( RTL_CONSTASCII_USTRINGPARAM(PACKAGE_REVISION) ); | |
44 | 52 | } | ... | ... |
src/openoffice/globals.hpp
... | ... | @@ -60,7 +60,15 @@ |
60 | 60 | |
61 | 61 | #include <com/sun/star/uno/RuntimeException.hpp> |
62 | 62 | |
63 | + #ifdef DEBUG | |
64 | + #include <stdio.h> | |
65 | + #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | |
66 | + #else | |
67 | + #define trace(x, ...) // __VA_ARGS__ | |
68 | + #endif | |
69 | + | |
63 | 70 | #include <pw3270/lib3270.hpp> |
71 | + #include <pw3270/class.h> | |
64 | 72 | |
65 | 73 | #define DLL_PUBLIC __attribute__((visibility("default"))) |
66 | 74 | |
... | ... | @@ -68,6 +76,7 @@ |
68 | 76 | using namespace ::com::sun::star; // for sdk interfaces |
69 | 77 | using namespace ::com::sun::star::lang; // for sdk interfaces |
70 | 78 | using namespace ::com::sun::star::uno; // for basic types |
79 | + using namespace PW3270_NAMESPACE; | |
71 | 80 | |
72 | 81 | namespace pw3270_impl |
73 | 82 | { |
... | ... | @@ -76,6 +85,9 @@ |
76 | 85 | { |
77 | 86 | public: |
78 | 87 | |
88 | + session_impl(); | |
89 | + virtual ~session_impl(); | |
90 | + | |
79 | 91 | // XMain |
80 | 92 | virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aArguments ) throw (Exception); |
81 | 93 | |
... | ... | @@ -89,6 +101,16 @@ |
89 | 101 | |
90 | 102 | // lib3270 |
91 | 103 | virtual ::rtl::OUString SAL_CALL getVersion() throw (RuntimeException); |
104 | + virtual ::rtl::OUString SAL_CALL getRevision() throw (RuntimeException); | |
105 | + | |
106 | + virtual ::sal_Int16 SAL_CALL setSessionName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException); | |
107 | + | |
108 | + virtual ::sal_Int16 SAL_CALL setHost( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException); | |
109 | + virtual ::sal_Int16 SAL_CALL Connect() throw (::com::sun::star::uno::RuntimeException); | |
110 | + virtual ::sal_Int16 SAL_CALL Disconnect() throw (::com::sun::star::uno::RuntimeException); | |
111 | + | |
112 | + private: | |
113 | + h3270::session *hSession; | |
92 | 114 | |
93 | 115 | }; |
94 | 116 | ... | ... |
src/openoffice/init.cc
... | ... | @@ -39,6 +39,19 @@ |
39 | 39 | |
40 | 40 | using namespace pw3270_impl; |
41 | 41 | |
42 | + | |
43 | +session_impl::session_impl() | |
44 | +{ | |
45 | + this->hSession = NULL; | |
46 | +} | |
47 | + | |
48 | +session_impl::~session_impl() | |
49 | +{ | |
50 | + if(this->hSession) | |
51 | + delete this->hSession; | |
52 | +} | |
53 | + | |
54 | + | |
42 | 55 | // XInitialization implementation |
43 | 56 | void session_impl::initialize( Sequence< Any > const & args ) throw (Exception) |
44 | 57 | { |
... | ... | @@ -52,6 +65,9 @@ void session_impl::initialize( Sequence< Any > const & args ) throw (Exception) |
52 | 65 | |
53 | 66 | // Initialize |
54 | 67 | |
68 | + // TODO: Get arguments. | |
69 | + | |
70 | + | |
55 | 71 | } |
56 | 72 | |
57 | 73 | // XMain | ... | ... |
src/openoffice/loffice3270.cbp
... | ... | @@ -33,13 +33,16 @@ |
33 | 33 | <Add option="-Wall" /> |
34 | 34 | </Compiler> |
35 | 35 | <Unit filename="../../configure.ac" /> |
36 | + <Unit filename="../classlib/Makefile.in" /> | |
36 | 37 | <Unit filename="../classlib/class.mak" /> |
37 | 38 | <Unit filename="../classlib/class.mak.in" /> |
38 | 39 | <Unit filename="../classlib/exception.cc" /> |
39 | 40 | <Unit filename="../classlib/local.cc" /> |
40 | 41 | <Unit filename="../classlib/remote.cc" /> |
41 | 42 | <Unit filename="../classlib/session.cc" /> |
43 | + <Unit filename="../include/pw3270/class.h" /> | |
42 | 44 | <Unit filename="Makefile.in" /> |
45 | + <Unit filename="connect.cc" /> | |
43 | 46 | <Unit filename="get.cc" /> |
44 | 47 | <Unit filename="globals.hpp" /> |
45 | 48 | <Unit filename="include/pw3270/lib3270.hdl" /> |
... | ... | @@ -49,6 +52,7 @@ |
49 | 52 | <Unit filename="manifest.xml.in" /> |
50 | 53 | <Unit filename="pw3270.idl" /> |
51 | 54 | <Unit filename="service.cc" /> |
55 | + <Unit filename="set.cc" /> | |
52 | 56 | <Unit filename="testprogram.cc" /> |
53 | 57 | <Extensions> |
54 | 58 | <code_completion /> | ... | ... |
src/openoffice/pw3270.idl
... | ... | @@ -43,7 +43,17 @@ module pw3270 |
43 | 43 | */ |
44 | 44 | interface lib3270 : com::sun::star::uno::XInterface |
45 | 45 | { |
46 | + // Constants | |
46 | 47 | string getVersion(); |
48 | + string getRevision(); | |
49 | + | |
50 | + // Host definition | |
51 | + short setHost([in] string url); | |
52 | + short Connect(); | |
53 | + short Disconnect(); | |
54 | + | |
55 | + // Misc Settings | |
56 | + short setSessionName([in] string name); | |
47 | 57 | }; |
48 | 58 | |
49 | 59 | service session | ... | ... |
... | ... | @@ -0,0 +1,99 @@ |
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 | + * Referência: | |
29 | + * | |
30 | + * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes | |
31 | + * | |
32 | + */ | |
33 | + | |
34 | + #include "globals.hpp" | |
35 | + #include <exception> | |
36 | + #include <com/sun/star/uno/RuntimeException.hdl> | |
37 | + #include "pw3270/lib3270.hpp" | |
38 | + | |
39 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
40 | + | |
41 | + using namespace pw3270_impl; | |
42 | + using namespace com::sun::star::uno; | |
43 | + | |
44 | + ::sal_Int16 SAL_CALL session_impl::setSessionName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException) | |
45 | + { | |
46 | + if(hSession) | |
47 | + { | |
48 | + // Remove old session | |
49 | + delete hSession; | |
50 | + hSession = NULL; | |
51 | + } | |
52 | + | |
53 | + OString vlr = rtl::OUStringToOString( name , RTL_TEXTENCODING_UNICODE ); | |
54 | + | |
55 | + trace("%s(\"%s\")",__FUNCTION__,vlr.getStr()); | |
56 | + | |
57 | + try | |
58 | + { | |
59 | + | |
60 | + hSession = h3270::session::create(((const char *) vlr.getStr())); | |
61 | + trace("%s: hSession(\"%s\"=%p",__FUNCTION__,vlr.getStr(),hSession); | |
62 | + | |
63 | + } catch(std::exception &e) | |
64 | + { | |
65 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
66 | + | |
67 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
68 | + | |
69 | + return -1; | |
70 | + | |
71 | + } | |
72 | + | |
73 | + return 0; | |
74 | + | |
75 | + } | |
76 | + | |
77 | + ::sal_Int16 SAL_CALL session_impl::setHost( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException) | |
78 | + { | |
79 | + if(!hSession) | |
80 | + hSession = h3270::session::get_default(); | |
81 | + | |
82 | + OString vlr = rtl::OUStringToOString( url , RTL_TEXTENCODING_UNICODE ); | |
83 | + | |
84 | + try | |
85 | + { | |
86 | + | |
87 | + return hSession->set_url(vlr.getStr()); | |
88 | + | |
89 | + } catch(std::exception &e) | |
90 | + { | |
91 | + OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE); | |
92 | + | |
93 | + throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this)); | |
94 | + | |
95 | + } | |
96 | + | |
97 | + return -1; | |
98 | + } | |
99 | + | ... | ... |
src/openoffice/testmacros.odt
No preview for this file type