merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / macros / debug / plugin.hxx
blobe4e1f8c64f7f3ab310036394aa8885d2e39f212f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: plugin.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_
32 #define __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_
34 //*****************************************************************************************************************
35 // special macros to debug asynchronous methods of plugin frame
36 //*****************************************************************************************************************
38 #ifdef ENABLE_PLUGINDEBUG
40 //_____________________________________________________________________________________________________________
41 // includes
42 //_____________________________________________________________________________________________________________
44 #ifndef _RTL_STRBUF_HXX_
45 #include <rtl/strbuf.hxx>
46 #endif
48 #ifndef _RTL_STRING_HXX_
49 #include <rtl/string.hxx>
50 #endif
52 /*_____________________________________________________________________________________________________________
53 LOGFILE_PLUGIN
55 For follow macros we need a special log file. If user forget to specify anyone, we must do it for him!
56 _____________________________________________________________________________________________________________*/
58 #ifndef LOGFILE_PLUGIN
59 #define LOGFILE_PLUGIN \
60 "plugin.log"
61 #endif
63 /*_____________________________________________________________________________________________________________
64 LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL )
66 Our plugin forward special url's to plugin dll, browser and webserver.
67 We convert internal url's to an external notation.
68 With this macro you can log some parameter of this operation.
69 _____________________________________________________________________________________________________________*/
71 #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) \
72 /* Use new scope to declare local private variables! */ \
73 { \
74 ::rtl::OStringBuffer sBuffer(1024); \
75 sBuffer.append( "PlugInFrame [ \"" ); \
76 sBuffer.append( SFRAMENAME ); \
77 sBuffer.append( "\" ] send " ); \
78 sBuffer.append( SSENDMODE ); \
79 sBuffer.append( "( internalURL=\"" ); \
80 sBuffer.append( U2B( SINTERNALURL ) ); \
81 sBuffer.append( "\", externalURL=\""); \
82 sBuffer.append( U2B( SEXTERNALURL ) ); \
83 sBuffer.append( "\" ) to browser.\n"); \
84 WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \
87 /*_____________________________________________________________________________________________________________
88 LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL )
90 A plugin frame can get a url request in two different modes.
91 1) newURL()
92 2) newStream()
93 We convert external url's to an internal notation.
94 With this macro you can log some parameter of this operations.
95 _____________________________________________________________________________________________________________*/
97 #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) \
98 /* Use new scope to declare local private variables! */ \
99 { \
100 ::rtl::OStringBuffer sBuffer(1024); \
101 sBuffer.append( "PlugInFrame [ \"" ); \
102 sBuffer.append( U2B( SFRAMENAME ) ); \
103 sBuffer.append( "\" ] receive " ); \
104 sBuffer.append( SRECEIVEMODE ); \
105 sBuffer.append( "( externalURL=\"" ); \
106 sBuffer.append( U2B( SEXTERNALURL ) ); \
107 sBuffer.append( "\", internalURL=\"" ); \
108 sBuffer.append( U2B( SINTERNALURL ) ); \
109 sBuffer.append( "\" ) from browser.\n" ); \
110 WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \
113 /*_____________________________________________________________________________________________________________
114 LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, AANY )
116 Log information about parameter of a newURL() at a plugin frame.
117 _____________________________________________________________________________________________________________*/
119 #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, sFILTER, AANY ) \
120 /* Use new scope to declare local private variables! */ \
122 ::rtl::OStringBuffer sBuffer(1024); \
123 sBuffer.append( "PlugInFrame [ \"" ); \
124 sBuffer.append( U2B( SFRAMENAME ) ); \
125 sBuffer.append( "\" ] called with newURL( \"" ); \
126 sBuffer.append( U2B( SMIMETYPE ) ); \
127 sBuffer.append( "\", \"" ); \
128 sBuffer.append( U2B( SURL ) ); \
129 sBuffer.append( "\", \"" ); \
130 sBuffer.append( U2B( SFILTER ) ); \
131 sBuffer.append( "\", " ); \
132 if( AANY.hasValue() == sal_True ) \
134 sBuffer.append( "filled Any )" ); \
136 else \
138 sBuffer.append( "empty Any )" ); \
140 sBuffer.append( "\n" ); \
141 WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \
144 /*_____________________________________________________________________________________________________________
145 LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, ASTREAM, AANY )
147 Log information about parameter of a newStream() at a plugin frame.
148 _____________________________________________________________________________________________________________*/
150 #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY ) \
151 /* Use new scope to declare local private variables! */ \
153 ::rtl::OStringBuffer sBuffer(1024); \
154 sBuffer.append( "PlugInFrame [ \"" ); \
155 sBuffer.append( U2B( SFRAMENAME ) ); \
156 sBuffer.append( "\" ] called with newStream( \""); \
157 sBuffer.append( U2B( SMIMETYPE ) ); \
158 sBuffer.append( "\", \"" ); \
159 sBuffer.append( U2B( SURL ) ); \
160 sBuffer.append( "\", \"" ); \
161 sBuffer.append( U2B( SFILTER ) ); \
162 sBuffer.append( "\", " ); \
163 if( XSTREAM.is() == sal_True ) \
165 sal_Int32 nBytes = XSTREAM->available(); \
166 OString sInfo("Stream with "); \
167 sInfo += OString::valueOf( (sal_Int32)nBytes ); \
168 sInfo += " Bytes, "; \
169 sBuffer.append( sInfo ); \
171 else \
173 sBuffer.append( "empty Stream, " ); \
175 if( AANY.hasValue() == sal_True ) \
177 sBuffer.append( "filled Any )" ); \
179 else \
181 sBuffer.append( "empty Any )" ); \
183 sBuffer.append( "\n" ); \
184 WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \
187 #else // #ifdef ENABLE_PLUGINDEBUG
189 /*_____________________________________________________________________________________________________________
190 If right testmode is'nt set - implements these macro empty!
191 _____________________________________________________________________________________________________________*/
193 #undef LOGFILE_PLUGIN
194 #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL )
195 #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL )
196 #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, SFILTER, AANY )
197 #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY )
199 #endif // #ifdef ENABLE_PLUGINDEBUG
201 //*****************************************************************************************************************
202 // end of file
203 //*****************************************************************************************************************
205 #endif // #ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_