1*f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e07b45SAndrew Rist  * distributed with this work for additional information
6*f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f8e07b45SAndrew Rist  *
11*f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f8e07b45SAndrew Rist  *
13*f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15*f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18*f8e07b45SAndrew Rist  * under the License.
19*f8e07b45SAndrew Rist  *
20*f8e07b45SAndrew Rist  *************************************************************/
21*f8e07b45SAndrew Rist 
22*f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //*****************************************************************************************************************
28cdf0e10cSrcweir //	special macros for targeting of frames
29cdf0e10cSrcweir //*****************************************************************************************************************
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #ifdef	ENABLE_TARGETINGDEBUG
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 	//_____________________________________________________________________________________________________________
34cdf0e10cSrcweir 	//	includes
35cdf0e10cSrcweir 	//_____________________________________________________________________________________________________________
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 	#ifndef _RTL_STRBUF_HXX_
38cdf0e10cSrcweir 	#include <rtl/strbuf.hxx>
39cdf0e10cSrcweir 	#endif
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	/*_____________________________________________________________________________________________________________
42cdf0e10cSrcweir 		LOGFILE_TARGETING
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 		For follow macros we need a special log file. If user forget to specify anyone, we must do it for him!
45cdf0e10cSrcweir 	_____________________________________________________________________________________________________________*/
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	#ifndef	LOGFILE_TARGETING
48cdf0e10cSrcweir 		#define	LOGFILE_TARGETSTEPS		"targetsteps.log"
49cdf0e10cSrcweir 		#define	LOGFILE_TARGETPARAM		"targetparam.log"
50cdf0e10cSrcweir 	#endif
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	/*_____________________________________________________________________________________________________________
53cdf0e10cSrcweir 		LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS )
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 		Log format for parameter e.g.: Desktop::findFrame( "frame1", 23 ) my name is "desktop"
56cdf0e10cSrcweir 		Log format for steps     e.g.: desktop--
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 		With this macro you can log informations about search parameter of method "findFrame()" of an service.
59cdf0e10cSrcweir 		Use it at beginning of search only!
60cdf0e10cSrcweir 	_____________________________________________________________________________________________________________*/
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 	#define	LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS )							\
63cdf0e10cSrcweir 				/* Use new scope to prevent code against multiple variable defines! */							\
64cdf0e10cSrcweir 				{																								\
65cdf0e10cSrcweir 					::rtl::OStringBuffer sBufferParam(256);														\
66cdf0e10cSrcweir 					::rtl::OStringBuffer sBufferSteps(256);														\
67cdf0e10cSrcweir 					sBufferParam.append( SSERVICE												);				\
68cdf0e10cSrcweir 					sBufferParam.append( "::findFrame( \""										);				\
69cdf0e10cSrcweir 					sBufferParam.append( U2B( STARGETNAME )										);				\
70cdf0e10cSrcweir 					sBufferParam.append( "\", "													);				\
71cdf0e10cSrcweir 					sBufferParam.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) )	);				\
72cdf0e10cSrcweir 					sBufferParam.append( " ) my name is \""										);				\
73cdf0e10cSrcweir 					sBufferParam.append( U2B( SFRAMENAME )										);				\
74cdf0e10cSrcweir 					sBufferParam.append( "\"\n"													);				\
75cdf0e10cSrcweir 					sBufferSteps.append( U2B( SFRAMENAME )										);				\
76cdf0e10cSrcweir 					sBufferSteps.append( "--"													);				\
77cdf0e10cSrcweir 					WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear() )						\
78cdf0e10cSrcweir 					WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear() )						\
79cdf0e10cSrcweir 				}
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	/*_____________________________________________________________________________________________________________
82cdf0e10cSrcweir 		LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS )
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 		With this macro you can log informations about search parameter of method "queryDispatch()" of an service.
85cdf0e10cSrcweir 		Use it at beginning of search only!
86cdf0e10cSrcweir 	_____________________________________________________________________________________________________________*/
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	#define	LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS )						\
89cdf0e10cSrcweir 				/* Use new scope to prevent code against multiple variable defines! */									\
90cdf0e10cSrcweir 				{																										\
91cdf0e10cSrcweir 					::rtl::OStringBuffer sBuffer(1024);																	\
92cdf0e10cSrcweir 					sBuffer.append( "[ "													);							\
93cdf0e10cSrcweir 					sBuffer.append( U2B( SFRAMENAME )										);							\
94cdf0e10cSrcweir 					sBuffer.append( "] "													);							\
95cdf0e10cSrcweir 					sBuffer.append( SSERVICE												);							\
96cdf0e10cSrcweir 					sBuffer.append( "::queryDispatch( \""									);							\
97cdf0e10cSrcweir 					sBuffer.append( U2B( AURL.Complete )									);							\
98cdf0e10cSrcweir 					sBuffer.append( "\", \""												);							\
99cdf0e10cSrcweir 					sBuffer.append( U2B( STARGETNAME )										);							\
100cdf0e10cSrcweir 					sBuffer.append( "\", "													);							\
101cdf0e10cSrcweir 					sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) )	);							\
102cdf0e10cSrcweir 					sBuffer.append( " )\n"													);							\
103cdf0e10cSrcweir 					WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() )									\
104cdf0e10cSrcweir 				}
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	/*_____________________________________________________________________________________________________________
107cdf0e10cSrcweir 		LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER )
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 		With this macro you can log informations about search parameter of method "loadComponentFromURL()" of an service.
110cdf0e10cSrcweir 		Use it at beginning of search only!
111cdf0e10cSrcweir 	_____________________________________________________________________________________________________________*/
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	#define	LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER )	\
114cdf0e10cSrcweir 				/* Use new scope to prevent code against multiple variable defines! */									\
115cdf0e10cSrcweir 				{																										\
116cdf0e10cSrcweir 					::rtl::OStringBuffer sBuffer(1024);																	\
117cdf0e10cSrcweir 					sBuffer.append( "[ "													);							\
118cdf0e10cSrcweir 					sBuffer.append( U2B( SFRAMENAME )										);							\
119cdf0e10cSrcweir 					sBuffer.append( "] "													);							\
120cdf0e10cSrcweir 					sBuffer.append( SSERVICE												);							\
121cdf0e10cSrcweir 					sBuffer.append( "::loadComponentFromURL( \""							);							\
122cdf0e10cSrcweir 					sBuffer.append( U2B( SURL )												);							\
123cdf0e10cSrcweir 					sBuffer.append( "\", \""												);							\
124cdf0e10cSrcweir 					sBuffer.append( U2B( STARGETNAME )										);							\
125cdf0e10cSrcweir 					sBuffer.append( "\", "													);							\
126cdf0e10cSrcweir 					sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) )	);							\
127cdf0e10cSrcweir 					sBuffer.append( ", "													);							\
128cdf0e10cSrcweir 					sal_Int32 nCount = SEQPARAMETER.getLength();														\
129cdf0e10cSrcweir 					for( sal_Int32 nParameter=0; nParameter<nCount; ++nParameter )										\
130cdf0e10cSrcweir 					{																									\
131cdf0e10cSrcweir 						sBuffer.append( U2B( SEQPARAMETER[nParameter].Name ));											\
132cdf0e10cSrcweir 						if( nParameter<(nCount-1) )																		\
133cdf0e10cSrcweir 						{																								\
134cdf0e10cSrcweir 							sBuffer.append( " | " );																	\
135cdf0e10cSrcweir 						}																								\
136cdf0e10cSrcweir 					}																									\
137cdf0e10cSrcweir 					sBuffer.append( " )\n"													);							\
138cdf0e10cSrcweir 					WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() )									\
139cdf0e10cSrcweir 				}
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	/*_____________________________________________________________________________________________________________
142cdf0e10cSrcweir 		LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME )
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 		With this macro you can log informations about search result of "findFrame()".
145cdf0e10cSrcweir 		Use it at the end of this method only!
146cdf0e10cSrcweir 	_____________________________________________________________________________________________________________*/
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	#define	LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME )														\
149cdf0e10cSrcweir 				/* Use new scope to prevent code against multiple variable defines! */									\
150cdf0e10cSrcweir 				{																										\
151cdf0e10cSrcweir 					::rtl::OStringBuffer sBufferParam(256);																\
152cdf0e10cSrcweir 					::rtl::OStringBuffer sBufferSteps(256);																\
153cdf0e10cSrcweir 					sBufferParam.append( SSERVICE				);														\
154cdf0e10cSrcweir 					sBufferParam.append( "::findFrame() at \""	);														\
155cdf0e10cSrcweir 					sBufferParam.append( U2B( SFRAMENAME )		);														\
156cdf0e10cSrcweir 					sBufferParam.append( "\" "					);														\
157cdf0e10cSrcweir 					if( XFRAME.is() == sal_True )																		\
158cdf0e10cSrcweir 					{																									\
159cdf0e10cSrcweir 						sBufferParam.append( "return with valid frame.\n"		);										\
160cdf0e10cSrcweir 						sBufferSteps.append( "OK ["								);										\
161cdf0e10cSrcweir 						sBufferSteps.append( U2B( XFRAME->getName() )			);										\
162cdf0e10cSrcweir 						sBufferSteps.append( "]\n"								);										\
163cdf0e10cSrcweir 					}																									\
164cdf0e10cSrcweir 					else																								\
165cdf0e10cSrcweir 					{																									\
166cdf0e10cSrcweir 						sBufferParam.append( "return with NULL frame!\n");												\
167cdf0e10cSrcweir 						sBufferSteps.append( "??\n"						);												\
168cdf0e10cSrcweir 					}																									\
169cdf0e10cSrcweir 					WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear() )								\
170cdf0e10cSrcweir 					WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear() )								\
171cdf0e10cSrcweir 				}
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 	/*_____________________________________________________________________________________________________________
174cdf0e10cSrcweir 		LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER )
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 		With this macro you can log informations about search result of "queryDispatch()".
177cdf0e10cSrcweir 		Use it at the end of this method only!
178cdf0e10cSrcweir 	_____________________________________________________________________________________________________________*/
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 	#define	LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER )												\
181cdf0e10cSrcweir 				/* Use new scope to prevent code against multiple variable defines! */									\
182cdf0e10cSrcweir 				{																										\
183cdf0e10cSrcweir 					::rtl::OStringBuffer sBuffer(1024);																	\
184cdf0e10cSrcweir 					sBuffer.append( "[ "				);																\
185cdf0e10cSrcweir 					sBuffer.append( U2B( SFRAMENAME )	);																\
186cdf0e10cSrcweir 					sBuffer.append( "] "				);																\
187cdf0e10cSrcweir 					sBuffer.append( SSERVICE			);																\
188cdf0e10cSrcweir 					if( XDISPATCHER.is() == sal_True )																	\
189cdf0e10cSrcweir 					{																									\
190cdf0e10cSrcweir 						sBuffer.append( "::queryDispatch() return with valid dispatcher."	);							\
191cdf0e10cSrcweir 					}																									\
192cdf0e10cSrcweir 					else																								\
193cdf0e10cSrcweir 					{																									\
194cdf0e10cSrcweir 						sBuffer.append( "::queryDispatch() return with NULL dispatcher!"	);							\
195cdf0e10cSrcweir 					}																									\
196cdf0e10cSrcweir 					sBuffer.append( "\n" );																				\
197cdf0e10cSrcweir 					WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() )									\
198cdf0e10cSrcweir 				}
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 	/*_____________________________________________________________________________________________________________
201cdf0e10cSrcweir 		LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT )
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 		With this macro you can log informations about search result of "loadComponentFromURL()".
204cdf0e10cSrcweir 		Use it at the end of this method only!
205cdf0e10cSrcweir 	_____________________________________________________________________________________________________________*/
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 	#define	LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT )											\
208cdf0e10cSrcweir 				/* Use new scope to prevent code against multiple variable defines! */									\
209cdf0e10cSrcweir 				{																										\
210cdf0e10cSrcweir 					::rtl::OStringBuffer sBuffer(1024);																	\
211cdf0e10cSrcweir 					sBuffer.append( "[ "				);																\
212cdf0e10cSrcweir 					sBuffer.append( U2B( SFRAMENAME )	);																\
213cdf0e10cSrcweir 					sBuffer.append( "] "				);																\
214cdf0e10cSrcweir 					sBuffer.append( SSERVICE			);																\
215cdf0e10cSrcweir 					if( XCOMPONENT.is() == sal_True )																	\
216cdf0e10cSrcweir 					{																									\
217cdf0e10cSrcweir 						sBuffer.append( "::loadComponentFromURL() return with valid component."	);						\
218cdf0e10cSrcweir 					}																									\
219cdf0e10cSrcweir 					else																								\
220cdf0e10cSrcweir 					{																									\
221cdf0e10cSrcweir 						sBuffer.append( "::loadComponentFromURL() return with NULL component!"	);						\
222cdf0e10cSrcweir 					}																									\
223cdf0e10cSrcweir 					sBuffer.append( "\n" );																				\
224cdf0e10cSrcweir 					WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() )									\
225cdf0e10cSrcweir 				}
226cdf0e10cSrcweir 
227cdf0e10cSrcweir #else	// #ifdef ENABLE_TARGETINGDEBUG
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 	/*_____________________________________________________________________________________________________________
230cdf0e10cSrcweir 		If right testmode is'nt set - implements these macro empty!
231cdf0e10cSrcweir 	_____________________________________________________________________________________________________________*/
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 	#undef	LOGFILE_TARGETPARAM
234cdf0e10cSrcweir 	#undef	LOGFILE_TARGETSTEPS
235cdf0e10cSrcweir 	#define	LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS )
236cdf0e10cSrcweir 	#define	LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS )
237cdf0e10cSrcweir 	#define	LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER )
238cdf0e10cSrcweir 	#define	LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME )
239cdf0e10cSrcweir 	#define	LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER )
240cdf0e10cSrcweir 	#define	LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT )
241cdf0e10cSrcweir 
242cdf0e10cSrcweir #endif	// #ifdef ENABLE_TARGETINGDEBUG
243cdf0e10cSrcweir 
244cdf0e10cSrcweir //*****************************************************************************************************************
245cdf0e10cSrcweir //	end of file
246cdf0e10cSrcweir //*****************************************************************************************************************
247cdf0e10cSrcweir 
248cdf0e10cSrcweir #endif	// #ifndef __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_
249