xref: /aoo41x/main/vcl/source/app/dbggui.cxx (revision 79aad27f)
1*9f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9f62ea84SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9f62ea84SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9f62ea84SAndrew Rist  * distributed with this work for additional information
6*9f62ea84SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9f62ea84SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9f62ea84SAndrew Rist  * "License"); you may not use this file except in compliance
9*9f62ea84SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9f62ea84SAndrew Rist  *
11*9f62ea84SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9f62ea84SAndrew Rist  *
13*9f62ea84SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9f62ea84SAndrew Rist  * software distributed under the License is distributed on an
15*9f62ea84SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9f62ea84SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9f62ea84SAndrew Rist  * specific language governing permissions and limitations
18*9f62ea84SAndrew Rist  * under the License.
19*9f62ea84SAndrew Rist  *
20*9f62ea84SAndrew Rist  *************************************************************/
21*9f62ea84SAndrew Rist 
22*9f62ea84SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <sal/config.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #ifdef DBG_UTIL
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <cstdio>
32cdf0e10cSrcweir #include <cstring>
33cdf0e10cSrcweir #include <cmath>
34cdf0e10cSrcweir #include <limits.h>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include "tools/debug.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include "vos/mutex.hxx"
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include "vcl/svapp.hxx"
41cdf0e10cSrcweir #include "vcl/event.hxx"
42cdf0e10cSrcweir #include "vcl/lstbox.hxx"
43cdf0e10cSrcweir #include "vcl/button.hxx"
44cdf0e10cSrcweir #include "vcl/edit.hxx"
45cdf0e10cSrcweir #include "vcl/fixed.hxx"
46cdf0e10cSrcweir #include "vcl/group.hxx"
47cdf0e10cSrcweir #include "vcl/field.hxx"
48cdf0e10cSrcweir #include "vcl/msgbox.hxx"
49cdf0e10cSrcweir #include "vcl/wrkwin.hxx"
50cdf0e10cSrcweir #include "vcl/sound.hxx"
51cdf0e10cSrcweir #include "vcl/threadex.hxx"
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #include "svdata.hxx"
54cdf0e10cSrcweir #include "dbggui.hxx"
55cdf0e10cSrcweir 
56cdf0e10cSrcweir #include "vcl/unohelp.hxx"
57cdf0e10cSrcweir #include "vcl/unohelp2.hxx"
58cdf0e10cSrcweir 
59cdf0e10cSrcweir #include "salinst.hxx"
60cdf0e10cSrcweir #include "svdata.hxx"
61cdf0e10cSrcweir #include "svsys.h"
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #include "com/sun/star/i18n/XCharacterClassification.hpp"
64cdf0e10cSrcweir 
65cdf0e10cSrcweir #include <map>
66cdf0e10cSrcweir #include <algorithm>
67cdf0e10cSrcweir 
68cdf0e10cSrcweir using namespace ::com::sun::star;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir // =======================================================================
71cdf0e10cSrcweir 
72cdf0e10cSrcweir static const sal_Char* pDbgHelpText[] =
73cdf0e10cSrcweir {
74cdf0e10cSrcweir "Object Test\n",
75cdf0e10cSrcweir "------------------------------------------\n",
76cdf0e10cSrcweir "\n",
77cdf0e10cSrcweir "--- Macros ---\n",
78cdf0e10cSrcweir "DBG_NAME( aName )\n",
79cdf0e10cSrcweir "Defines the administration data for a class. This macro may only be used "
80cdf0e10cSrcweir " in a source file with the same name.\n",
81cdf0e10cSrcweir "\n",
82cdf0e10cSrcweir "DBG_NAMEEX( aName )\n",
83cdf0e10cSrcweir "Like DBG_NAME, only for other source files.\n",
84cdf0e10cSrcweir "\n",
85cdf0e10cSrcweir "DBG_CTOR( aName, fTest )\n",
86cdf0e10cSrcweir "Must be used in all constructors of a class (also in the CopyCtor). "
87cdf0e10cSrcweir "The first parameter must be the registered name (best would be the "
88cdf0e10cSrcweir "class name) and the second parameter the test function or 0.\n",
89cdf0e10cSrcweir "\n",
90cdf0e10cSrcweir "DBG_DTOR( aName, fTest )\n",
91cdf0e10cSrcweir "Must be used in the destructor of the class. The first parameter is "
92cdf0e10cSrcweir "the registered name and the second parameter is the test function or "
93cdf0e10cSrcweir "0.\n",
94cdf0e10cSrcweir "\n",
95cdf0e10cSrcweir "DBG_CHKTHIS( aName, fTest )\n",
96cdf0e10cSrcweir "Can be used in methods of the class when constructors and the "
97cdf0e10cSrcweir "desctructor of the class are equiped with the corresponding macros. "
98cdf0e10cSrcweir "The first parameter is the registered name, the second parameter is "
99cdf0e10cSrcweir "the test function or 0.\n",
100cdf0e10cSrcweir "\n",
101cdf0e10cSrcweir "DBG_CHKOBJ( pObj, aName, fTest )\n",
102cdf0e10cSrcweir "Can be used on instances of a class where the constructors and the "
103cdf0e10cSrcweir "destructor of the class are equiped with the corresponding macros. "
104cdf0e10cSrcweir "The first parameter is the registered name, the second parameter is "
105cdf0e10cSrcweir "the test function or 0.\n",
106cdf0e10cSrcweir "\n",
107cdf0e10cSrcweir "To make the macros work DBG_UTIL must be defined.\n",
108cdf0e10cSrcweir "\n",
109cdf0e10cSrcweir "--- Options ---\n",
110cdf0e10cSrcweir "This\n",
111cdf0e10cSrcweir "The This pointer is validated. This way all objects that are equiped "
112cdf0e10cSrcweir "with it can be tested to make sure one is working with existing objects. "
113cdf0e10cSrcweir "This way it's easier to find bugs in case of multiple inheritence, "
114cdf0e10cSrcweir "alignment or compiler errors. Since almost all standard classes of SV "
115cdf0e10cSrcweir "(String, List, Pen, Brush, Polygon, ...) are equiped with DBG_CHKTHIS() "
116cdf0e10cSrcweir "a lot of errors are found, although this test will impact performance "
117cdf0e10cSrcweir "accordingly.\n",
118cdf0e10cSrcweir "\n",
119cdf0e10cSrcweir "Function\n",
120cdf0e10cSrcweir "When a function is passed with macros, it will be called.\n",
121cdf0e10cSrcweir "\n",
122cdf0e10cSrcweir "Exit\n",
123cdf0e10cSrcweir "This- and Func-Test will also run when exiting the function.\n",
124cdf0e10cSrcweir "\n",
125cdf0e10cSrcweir "Report\n",
126cdf0e10cSrcweir "At the end of the program the number of generated objects is produced "
127cdf0e10cSrcweir "as output. Because all important SV classes have at least DBG_CTOR() / "
128cdf0e10cSrcweir "DBG_DTOR() it can checked so called resource leaks (system objects which "
129cdf0e10cSrcweir " are not freed) exist. These include OutputDevice, Window, VirtualDevice, "
130cdf0e10cSrcweir " Printer and Menu. Note: Dtor calls of static objects are not taken into "
131cdf0e10cSrcweir " account. Therefor each SV program leaves 2 strings and a bitmap behind.\n",
132cdf0e10cSrcweir "\n",
133cdf0e10cSrcweir "Trace\n",
134cdf0e10cSrcweir "Creation, destruction and usage of objects which are equiped with "
135cdf0e10cSrcweir "DBG_XTOR is logged.\n",
136cdf0e10cSrcweir "\n",
137cdf0e10cSrcweir "\n",
138cdf0e10cSrcweir "Memory Test\n",
139cdf0e10cSrcweir "------------------------------------------\n",
140cdf0e10cSrcweir "\n",
141cdf0e10cSrcweir "--- Macros ---\n",
142cdf0e10cSrcweir "DBG_MEMTEST()\n",
143cdf0e10cSrcweir "Run the specified memory tests.\n",
144cdf0e10cSrcweir "\n",
145cdf0e10cSrcweir "DBG_MEMTEST_PTR( p )\n",
146cdf0e10cSrcweir "Runs the specified memory tests and validates the pointer that was "
147cdf0e10cSrcweir "passed if the pointer test is enabled.\n",
148cdf0e10cSrcweir "\n",
149cdf0e10cSrcweir "--- Options ---\n",
150cdf0e10cSrcweir "Initialize\n",
151cdf0e10cSrcweir "Allocated memory is initialized with 0x77 and free or freed memory "
152cdf0e10cSrcweir "is initialized with 0x33. This option has almost no impact on performance "
153cdf0e10cSrcweir "and should thus always be enabled during development. This will also "
154cdf0e10cSrcweir "make crashes more often reproducable.\n",
155cdf0e10cSrcweir "\n",
156cdf0e10cSrcweir "Overwrite\n",
157cdf0e10cSrcweir "This test check whether writes occur before or after the blocks. Before "
158cdf0e10cSrcweir "and after the block memory is initialized with 0x55. This option costs "
159cdf0e10cSrcweir "performance, but should be enabled once in a while to test for common "
160cdf0e10cSrcweir "memory overwrites (+-1 errors). This option should also be enabled if the "
161cdf0e10cSrcweir "program crashes in a new or delete operator.\n",
162cdf0e10cSrcweir "\n",
163cdf0e10cSrcweir "Free\n",
164cdf0e10cSrcweir "This checks whether writes occur in free memory. This option costs lots "
165cdf0e10cSrcweir " of performance and should thus only be used to test memory overwrites. "
166cdf0e10cSrcweir " This option should perhaps also be enabled when the program crashes "
167cdf0e10cSrcweir " in the new or delete operator.\n",
168cdf0e10cSrcweir "\n",
169cdf0e10cSrcweir "Pointer\n",
170cdf0e10cSrcweir "The pointer is tested with delete and DBG_MEMTEST_PTR() to see if it was "
171cdf0e10cSrcweir "created by new or SvMemAlloc(). When this option is enabled errors such as "
172cdf0e10cSrcweir "double deletes, deletes on stack objects or invalid pointers will be found. "
173cdf0e10cSrcweir "This option has an impact on performance and should therefor not be enabled "
174cdf0e10cSrcweir "all the time. However, testing should be done with this option enabled once "
175cdf0e10cSrcweir "in a while, because the memory manager does not always crash with delete and "
176cdf0e10cSrcweir "invalid pointers. This option should also be enabled if the program crashes "
177cdf0e10cSrcweir "in new or delete operators.\n",
178cdf0e10cSrcweir "\n",
179cdf0e10cSrcweir "Report\n",
180cdf0e10cSrcweir "At the end of the program a small statistic and memory that was not freed are "
181cdf0e10cSrcweir "output. Note: memory that is freed by global objects is also included in "
182cdf0e10cSrcweir "the leak list.\n",
183cdf0e10cSrcweir "\n",
184cdf0e10cSrcweir "Trace\n",
185cdf0e10cSrcweir "Allocating and freeing memory is logged.\n",
186cdf0e10cSrcweir "\n",
187cdf0e10cSrcweir "Leak report\n",
188cdf0e10cSrcweir "Produces under WNT at the end of the program a list of memory leaks with "
189cdf0e10cSrcweir "stack trace. Only blocks which were created inside Application::Execute() "
190cdf0e10cSrcweir "are included. When this option and Overwrite are both enabled a memory "
191cdf0e10cSrcweir "overwrite results in an attempt to output the stack where the block was "
192cdf0e10cSrcweir "created. The output is included in the log file after the error message.\n"
193cdf0e10cSrcweir "\n",
194cdf0e10cSrcweir "New/Delete\n",
195cdf0e10cSrcweir "Memory tests are performed on the entire memory with every new/delet. "
196cdf0e10cSrcweir "Warning: this option makes programs very slow and should only be enabled "
197cdf0e10cSrcweir "to track memory overwrites. Otherwise it is sufficient to enable "
198cdf0e10cSrcweir "seperate options because (if no leak is present) every detectable "
199cdf0e10cSrcweir "memory overwrite during run time should be found.\n",
200cdf0e10cSrcweir "\n",
201cdf0e10cSrcweir "Object Test\n",
202cdf0e10cSrcweir "Memory test are performed on the entire memory with every object test. "
203cdf0e10cSrcweir "Warning: this option makes programs very slow and should only be enabled "
204cdf0e10cSrcweir "to track memory overwrite. Otherwise it is sufficient to enable "
205cdf0e10cSrcweir "seperate options because (if no leak is present) every detectable "
206cdf0e10cSrcweir "memory overwrite during run time should be found.\n",
207cdf0e10cSrcweir "\n",
208cdf0e10cSrcweir "Windows 16-bit and debug tests\n",
209cdf0e10cSrcweir "Warning: when memory test are enabled (except for Initialize) memory with "
210cdf0e10cSrcweir "offset 0 is never (even not in case of >= 64KB) returned. If necessary the "
211cdf0e10cSrcweir "tests can be performed with 32-bit versions of the programs. To a certain "
212cdf0e10cSrcweir "extend it is sufficient to create 64KB - 64 bytes instead of 64KB because "
213cdf0e10cSrcweir "it will never come to a segment overflow.\n",
214cdf0e10cSrcweir "Memory and object test should only be enabled when only one SV application "
215cdf0e10cSrcweir "is running at one time. Otherwise uncontrolled errors may occur. In this "
216cdf0e10cSrcweir "case only the use of 32-bit programs can help."
217cdf0e10cSrcweir "\n",
218cdf0e10cSrcweir "\n",
219cdf0e10cSrcweir "\nOther tests and macros\n",
220cdf0e10cSrcweir "------------------------------------------\n",
221cdf0e10cSrcweir "\n",
222cdf0e10cSrcweir "Profiling\n",
223cdf0e10cSrcweir "DBG_PROFSTART() / DBG_PROFSTOP() / DBG_PROFCONTINUE() / DBG_PROFPAUSE() "
224cdf0e10cSrcweir "are evaluated and at the end of the program the number of run throughs "
225cdf0e10cSrcweir "and the time this took (including calls to children) in milliseconds is "
226cdf0e10cSrcweir "output. These macros can be used to check the same function runs over the "
227cdf0e10cSrcweir "entire development period, for example the startup speed. The registered name "
228cdf0e10cSrcweir "which was registered with DBG_NAME() must be passed to the macros.\n",
229cdf0e10cSrcweir "\n",
230cdf0e10cSrcweir "Resources\n",
231cdf0e10cSrcweir "In case of resource errors an error dialog is produced before the "
232cdf0e10cSrcweir "exception handler is called.\n",
233cdf0e10cSrcweir "\n",
234cdf0e10cSrcweir "Dialog\n",
235cdf0e10cSrcweir "FixedTexts, CheckBoxes, TriStateBoxes and RadioButtons are equiped with "
236cdf0e10cSrcweir "a different background color to determine the size of the controls. This "
237cdf0e10cSrcweir "test also shows whether controls overlap, whether the tab order is correct "
238cdf0e10cSrcweir "and whether the mnemonic characters are correctly assigned. With dialogs "
239cdf0e10cSrcweir "it is indicated when no default button or no OK/CancelButton is present. "
240cdf0e10cSrcweir "These tests are not 100% correct (e.g. too many warnings are given) and "
241cdf0e10cSrcweir "do not form any guarantee that all problematic cases are covered. For "
242cdf0e10cSrcweir "example only initial and only visible controls are tested. No errors are "
243cdf0e10cSrcweir "found which will occur during the use of a dialog.\n",
244cdf0e10cSrcweir "\n",
245cdf0e10cSrcweir "Bold AppFont\n",
246cdf0e10cSrcweir "The application font is set to bold to see if the position of texts is "
247cdf0e10cSrcweir "sufficient for other systems or other system settings. With very narrow "
248cdf0e10cSrcweir "fonts the dialogs are made wider because they otherwise appear too narrow.\n",
249cdf0e10cSrcweir "\n",
250cdf0e10cSrcweir "Trace output\n",
251cdf0e10cSrcweir "DBG_TRACE() can be use to produce TRACE output. DBG_TRACEFILE() also outputs "
252cdf0e10cSrcweir "the file and line number where the macro is located. DBG_TRACE1() to "
253cdf0e10cSrcweir "DBG_TRACE5() can be used to produce formatted output (printf format string) "
254cdf0e10cSrcweir "Trace output is enabled when the corresponding option is selected in the "
255cdf0e10cSrcweir "dropdown list.\n"
256cdf0e10cSrcweir "\n",
257cdf0e10cSrcweir "Warnings\n",
258cdf0e10cSrcweir "DBG_WARNING() can be used to output warnings. DBG_WARNINGFILE() also outputs "
259cdf0e10cSrcweir "the file and the line number where the macro is located. DBG_WARNING1() to "
260cdf0e10cSrcweir "DBG_WARNING5() can be used to produce formatted output (printf format string). "
261cdf0e10cSrcweir "In case you want to have conditional warnings DBG_ASSERTWARNING() can be "
262cdf0e10cSrcweir "used. The warning will be produced if the condition was not met. The first "
263cdf0e10cSrcweir "parameter is the condition and the second parameter is the message to be "
264cdf0e10cSrcweir "produced. Warnings are enabled if the corresponding option is selected in the "
265cdf0e10cSrcweir "dropdown box. When none are selected the condition with DBG_ASSERTWARNING() "
266cdf0e10cSrcweir "is not evaluated.\n",
267cdf0e10cSrcweir "\n",
268cdf0e10cSrcweir "Errors\n",
269cdf0e10cSrcweir "DBG_ERROR() can be used to produce error messages. DBG_ERRORFILE() also "
270cdf0e10cSrcweir "produces the file and the line number where the macro is located. "
271cdf0e10cSrcweir "DBG_ERROR1() bis DBG_ERROR5() can be used to produce formatted output "
272cdf0e10cSrcweir "(print format string). "
273cdf0e10cSrcweir "In case you want to have conditional warnings DBG_ASSERT() can be "
274cdf0e10cSrcweir "used. The warning will be produced if the condition was not met. The first "
275cdf0e10cSrcweir "parameter is the condition and the second parameter is the message to be "
276cdf0e10cSrcweir "produced. Warnings are enabled if the corresponding option is selected in the "
277cdf0e10cSrcweir "dropdown box. When none are selected the condition with DBG_ASSERT() "
278cdf0e10cSrcweir "is not evaluated.\n",
279cdf0e10cSrcweir "\n",
280cdf0e10cSrcweir "\n",
281cdf0e10cSrcweir "Output\n",
282cdf0e10cSrcweir "------------------------------------------\n",
283cdf0e10cSrcweir "\n",
284cdf0e10cSrcweir "Overwrite - CheckBox\n",
285cdf0e10cSrcweir "With every new program start the log file is overwritten if output has been "
286cdf0e10cSrcweir "generated.\n",
287cdf0e10cSrcweir "\n",
288cdf0e10cSrcweir "Include ObjectTest filters\n",
289cdf0e10cSrcweir "Only classes which contain one of the indicated filters are evaluated with "
290cdf0e10cSrcweir "the object test. Filters are seperated by ';' and are case sensitive. "
291cdf0e10cSrcweir "Wildcards are not supported. If no text is indicated the filters are not "
292cdf0e10cSrcweir "active.\n",
293cdf0e10cSrcweir "\n",
294cdf0e10cSrcweir "Exclude ObjectTest filters\n",
295cdf0e10cSrcweir "Only classes which do not contain one of the indicated filters are evaluated "
296cdf0e10cSrcweir "with the object test. Filters are seperated by ';' and are case sensitive. "
297cdf0e10cSrcweir "Wildcards are not supported. If no text is indicated the filters are not "
298cdf0e10cSrcweir "active.\n",
299cdf0e10cSrcweir "\n",
300cdf0e10cSrcweir "Include filters\n",
301cdf0e10cSrcweir "Only those texts which include the indicated filters are output. "
302cdf0e10cSrcweir "Filters are seperated by ';' and are case sensitive. "
303cdf0e10cSrcweir "Wildcards are not supported. The filter is used for all output (except for "
304cdf0e10cSrcweir "errors). If no text is indicated the filters are not active.\n",
305cdf0e10cSrcweir "\n",
306cdf0e10cSrcweir "Exclude filters\n",
307cdf0e10cSrcweir "Only those texts which do not include the indicated filters are output. "
308cdf0e10cSrcweir "Filters are seperated by ';' and are case sensitive. "
309cdf0e10cSrcweir "Wildcards are not supported. The filter is used for all output (except for "
310cdf0e10cSrcweir "errors). If no text is indicated the filters are not active.\n",
311cdf0e10cSrcweir "\n",
312cdf0e10cSrcweir "Furthermore you can indicate where the data will be output:\n",
313cdf0e10cSrcweir "\n",
314cdf0e10cSrcweir "None\n",
315cdf0e10cSrcweir "Output is surpressed.\n",
316cdf0e10cSrcweir "\n",
317cdf0e10cSrcweir "File\n",
318cdf0e10cSrcweir "Outputi n debug file. Filename can be entered in the Editfield.\n",
319cdf0e10cSrcweir "\n",
320cdf0e10cSrcweir "Window\n",
321cdf0e10cSrcweir "Output to a small debug window. The window size is stored if the debug "
322cdf0e10cSrcweir "dialog is closed with OK and if the window is visible. Each assertion text can "
323cdf0e10cSrcweir "be copied to the clipboard via the context menu of the respective entry.\n",
324cdf0e10cSrcweir "\n",
325cdf0e10cSrcweir "Shell\n",
326cdf0e10cSrcweir "Output to a debug system (Windows debug window) when available or under "
327cdf0e10cSrcweir "Unix in the shell window. Otherwise the same as Window.\n",
328cdf0e10cSrcweir "\n",
329cdf0e10cSrcweir "MessageBox\n",
330cdf0e10cSrcweir "Output to a MessageBox. In this case you can select whether the program "
331cdf0e10cSrcweir "must be continued, terminated (Application::Abort) or interrupted with "
332cdf0e10cSrcweir "CoreDump. Additionally on some systems you get a \"Copy\" button pressing which "
333cdf0e10cSrcweir "copies the text of the MessageBox to the clipboard. Because a MessageBox allows "
334cdf0e10cSrcweir "further event processing other errors caused by Paint, Activate/Deactivate, "
335cdf0e10cSrcweir "GetFocus/LoseFocus can cause more errors or incorrect errors and messages. "
336cdf0e10cSrcweir "Therefor the message should also be directed to a file/debugger in case of "
337cdf0e10cSrcweir "problems in order to produce the (right) error messages.\n",
338cdf0e10cSrcweir "\n",
339cdf0e10cSrcweir "TestTool\n",
340cdf0e10cSrcweir "When the TestTool runs messages will be redirected inside the TestTool.\n",
341cdf0e10cSrcweir "\n",
342cdf0e10cSrcweir "Debugger\n",
343cdf0e10cSrcweir "Attempt to activate the debugger and produce the message there, in order to "
344cdf0e10cSrcweir "always obtain the corresponding stack trace in the debugger.\n",
345cdf0e10cSrcweir "\n",
346cdf0e10cSrcweir "Abort\n",
347cdf0e10cSrcweir "Aborts the application\n",
348cdf0e10cSrcweir "\n",
349cdf0e10cSrcweir "\n",
350cdf0e10cSrcweir "Reroute osl messages - Checkbox\n",
351cdf0e10cSrcweir "OSL_ASSERT and similar messages can be intercepted by the general DBG GUI\n",
352cdf0e10cSrcweir "or handled system specific as per normal handling in the sal library.\n",
353cdf0e10cSrcweir "default is to reroute osl assertions\n",
354cdf0e10cSrcweir "\n",
355cdf0e10cSrcweir "\n",
356cdf0e10cSrcweir "Settings\n",
357cdf0e10cSrcweir "------------------------------------------\n",
358cdf0e10cSrcweir "\n",
359cdf0e10cSrcweir "Where by default the INI and LOG file is read and written the following "
360cdf0e10cSrcweir "can be set:\n",
361cdf0e10cSrcweir "\n",
362cdf0e10cSrcweir "WIN/WNT (WIN.INI, Group SV, Default: dbgsv.ini and dbgsv.log):\n",
363cdf0e10cSrcweir "INI: dbgsv\n",
364cdf0e10cSrcweir "LOG: dbgsvlog\n",
365cdf0e10cSrcweir "\n",
366cdf0e10cSrcweir "OS2 (OS2.INI, Application SV, Default: dbgsv.ini and dbgsv.log):\n",
367cdf0e10cSrcweir "INI: DBGSV\n",
368cdf0e10cSrcweir "LOG: DBGSVLOG\n",
369cdf0e10cSrcweir "\n",
370cdf0e10cSrcweir "UNIX (Environment variable, Default: .dbgsv.init and dbgsv.log):\n",
371cdf0e10cSrcweir "INI: DBGSV_INIT\n",
372cdf0e10cSrcweir "LOG: DBGSV_LOG\n",
373cdf0e10cSrcweir "\n",
374cdf0e10cSrcweir "MAC (Default: dbgsv.ini and dbgsv.log):\n",
375cdf0e10cSrcweir "INI: not possible\n",
376cdf0e10cSrcweir "LOG: only debug dialog settings\n",
377cdf0e10cSrcweir "\n",
378cdf0e10cSrcweir "The path and file name must always be specified. The name of the log "
379cdf0e10cSrcweir "file that was entered in the debug dialog has always priority.\n",
380cdf0e10cSrcweir "\n",
381cdf0e10cSrcweir "\n",
382cdf0e10cSrcweir "Example\n",
383cdf0e10cSrcweir "------------------------------------------\n",
384cdf0e10cSrcweir "\n",
385cdf0e10cSrcweir "DBG_NAME( String );\n",
386cdf0e10cSrcweir "\n",
387cdf0e10cSrcweir "#ifdef DBG_UTIL\n",
388cdf0e10cSrcweir "const sal_Char* DbgCheckString( const void* pString )\n",
389cdf0e10cSrcweir "{\n",
390cdf0e10cSrcweir "    String* p = (String*)pString;\n",
391cdf0e10cSrcweir "\n",
392cdf0e10cSrcweir "    if ( p->mpData->maStr[p->mpData->mnLen] != 0 )\n",
393cdf0e10cSrcweir "        return \"String damaged: aStr[nLen] != 0\";\n",
394cdf0e10cSrcweir "\n",
395cdf0e10cSrcweir "    return NULL;\n",
396cdf0e10cSrcweir "}\n",
397cdf0e10cSrcweir "#endif\n",
398cdf0e10cSrcweir "\n",
399cdf0e10cSrcweir "String::String()\n",
400cdf0e10cSrcweir "{\n",
401cdf0e10cSrcweir "    DBG_CTOR( String, DbgCheckString );\n",
402cdf0e10cSrcweir "    // ...\n",
403cdf0e10cSrcweir "}\n",
404cdf0e10cSrcweir "\n",
405cdf0e10cSrcweir "String::~String()\n",
406cdf0e10cSrcweir "{\n",
407cdf0e10cSrcweir "    DBG_DTOR( String, DbgCheckString );\n",
408cdf0e10cSrcweir "    //...\n",
409cdf0e10cSrcweir "}\n",
410cdf0e10cSrcweir "\n",
411cdf0e10cSrcweir "char& String::operator [] ( sal_uInt16 nIndex )\n",
412cdf0e10cSrcweir "{\n",
413cdf0e10cSrcweir "    DBG_CHKTHIS( String, DbgCheckString );\n",
414cdf0e10cSrcweir "    DBG_ASSERT( nIndex <= pData->nLen, \"String::[] : nIndex > Len\" );\n",
415cdf0e10cSrcweir "\n",
416cdf0e10cSrcweir "    //...\n",
417cdf0e10cSrcweir "}\n",
418cdf0e10cSrcweir "\n",
419cdf0e10cSrcweir "sal_uInt16 String::Search( const String& rStr, sal_uInt16 nIndex ) const\n",
420cdf0e10cSrcweir "{\n",
421cdf0e10cSrcweir "    DBG_CHKTHIS( String, DbgCheckString );\n",
422cdf0e10cSrcweir "    DBG_CHKOBJ( &rStr, String, DbgCheckString );\n",
423cdf0e10cSrcweir "\n",
424cdf0e10cSrcweir "    //...\n",
425cdf0e10cSrcweir "}",
426cdf0e10cSrcweir "\n",
427cdf0e10cSrcweir NULL
428cdf0e10cSrcweir };
429cdf0e10cSrcweir 
430cdf0e10cSrcweir // =======================================================================
431cdf0e10cSrcweir 
432cdf0e10cSrcweir namespace
433cdf0e10cSrcweir {
434cdf0e10cSrcweir     // -------------------------------------------------------------------
435cdf0e10cSrcweir     typedef ::std::map< XubString, DbgChannelId > UserDefinedChannels;
ImplDbgGetUserDefinedChannels()436cdf0e10cSrcweir     UserDefinedChannels& ImplDbgGetUserDefinedChannels()
437cdf0e10cSrcweir     {
438cdf0e10cSrcweir         static UserDefinedChannels s_aChannels;
439cdf0e10cSrcweir         return s_aChannels;
440cdf0e10cSrcweir     }
441cdf0e10cSrcweir 
442cdf0e10cSrcweir     // -------------------------------------------------------------------
ImplAppendUserDefinedChannels(ListBox & rList)443cdf0e10cSrcweir     void ImplAppendUserDefinedChannels( ListBox& rList )
444cdf0e10cSrcweir     {
445cdf0e10cSrcweir         const UserDefinedChannels& rChannels = ImplDbgGetUserDefinedChannels();
446cdf0e10cSrcweir         for ( UserDefinedChannels::const_iterator channel = rChannels.begin();
447cdf0e10cSrcweir               channel != rChannels.end();
448cdf0e10cSrcweir               ++channel
449cdf0e10cSrcweir             )
450cdf0e10cSrcweir         {
451cdf0e10cSrcweir             sal_uInt16 nEntryPos = rList.InsertEntry( channel->first );
452cdf0e10cSrcweir             rList.SetEntryData( nEntryPos, reinterpret_cast< void* >( channel->second ) );
453cdf0e10cSrcweir         }
454cdf0e10cSrcweir     }
455cdf0e10cSrcweir 
456cdf0e10cSrcweir     // -------------------------------------------------------------------
ImplSelectChannel(ListBox & rList,sal_uLong nChannelToSelect,sal_uInt16 nPositionOffset)457cdf0e10cSrcweir     void ImplSelectChannel( ListBox& rList, sal_uLong nChannelToSelect, sal_uInt16 nPositionOffset )
458cdf0e10cSrcweir     {
459cdf0e10cSrcweir         if ( nChannelToSelect < DBG_OUT_USER_CHANNEL_0 )
460cdf0e10cSrcweir             rList.SelectEntryPos( (sal_uInt16)( nChannelToSelect - nPositionOffset ) );
461cdf0e10cSrcweir         else
462cdf0e10cSrcweir         {
463cdf0e10cSrcweir             for ( sal_uInt16 pos = 0; pos < rList.GetEntryCount(); ++pos )
464cdf0e10cSrcweir             {
465cdf0e10cSrcweir                 DbgChannelId nChannelId = static_cast< DbgChannelId >( reinterpret_cast<sal_IntPtr>(rList.GetEntryData( pos )) );
466cdf0e10cSrcweir                 if ( nChannelId == nChannelToSelect )
467cdf0e10cSrcweir                 {
468cdf0e10cSrcweir                     rList.SelectEntryPos( pos );
469cdf0e10cSrcweir                     return;
470cdf0e10cSrcweir                 }
471cdf0e10cSrcweir             }
472cdf0e10cSrcweir         }
473cdf0e10cSrcweir     }
474cdf0e10cSrcweir     // -------------------------------------------------------------------
ImplGetChannelId(const ListBox & rList,sal_uInt16 nPositionOffset)475cdf0e10cSrcweir     DbgChannelId ImplGetChannelId( const ListBox& rList, sal_uInt16 nPositionOffset )
476cdf0e10cSrcweir     {
477cdf0e10cSrcweir         sal_uInt16 nSelectedChannelPos = rList.GetSelectEntryPos();
478cdf0e10cSrcweir         DbgChannelId nSelectedChannel = static_cast< DbgChannelId >( reinterpret_cast<sal_IntPtr>(rList.GetEntryData( nSelectedChannelPos )) );
479cdf0e10cSrcweir         if ( nSelectedChannel == 0)
480cdf0e10cSrcweir             return (DbgChannelId)( nSelectedChannelPos + nPositionOffset );
481cdf0e10cSrcweir         return nSelectedChannel;
482cdf0e10cSrcweir     }
483cdf0e10cSrcweir }
484cdf0e10cSrcweir 
485cdf0e10cSrcweir // =======================================================================
486cdf0e10cSrcweir 
487cdf0e10cSrcweir // -------------
488cdf0e10cSrcweir // - DbgWindow -
489cdf0e10cSrcweir // -------------
490cdf0e10cSrcweir 
491cdf0e10cSrcweir #define DBGWIN_MAXLINES     100
492cdf0e10cSrcweir 
493cdf0e10cSrcweir class DbgWindow : public WorkWindow
494cdf0e10cSrcweir {
495cdf0e10cSrcweir private:
496cdf0e10cSrcweir     ListBox         maLstBox;
497cdf0e10cSrcweir 
498cdf0e10cSrcweir public:
499cdf0e10cSrcweir                     DbgWindow();
500cdf0e10cSrcweir 
501cdf0e10cSrcweir     virtual sal_Bool    Close();
502cdf0e10cSrcweir     virtual void    Resize();
503cdf0e10cSrcweir     virtual long    PreNotify( NotifyEvent& rNEvt );
504cdf0e10cSrcweir     void            InsertLine( const XubString& rLine );
Update()505cdf0e10cSrcweir     void            Update() { WorkWindow::Update(); maLstBox.Update(); }
506cdf0e10cSrcweir 
507cdf0e10cSrcweir private:
508cdf0e10cSrcweir     void            GetAssertionEntryRange( sal_uInt16 nInbetweenEntry, sal_uInt16& nFirst, sal_uInt16& nLast );
509cdf0e10cSrcweir };
510cdf0e10cSrcweir 
511cdf0e10cSrcweir // -----------------
512cdf0e10cSrcweir // - DbgInfoDialog -
513cdf0e10cSrcweir // -----------------
514cdf0e10cSrcweir 
515cdf0e10cSrcweir class DbgInfoDialog : public ModalDialog
516cdf0e10cSrcweir {
517cdf0e10cSrcweir private:
518cdf0e10cSrcweir     ListBox         maListBox;
519cdf0e10cSrcweir     OKButton        maOKButton;
520cdf0e10cSrcweir     sal_Bool            mbHelpText;
521cdf0e10cSrcweir 
522cdf0e10cSrcweir public:
523cdf0e10cSrcweir                     DbgInfoDialog( Window* pParent, sal_Bool bHelpText = sal_False );
524cdf0e10cSrcweir 
525cdf0e10cSrcweir     void            SetInfoText( const XubString& rStr );
526cdf0e10cSrcweir };
527cdf0e10cSrcweir 
528cdf0e10cSrcweir // -------------
529cdf0e10cSrcweir // - DbgDialog -
530cdf0e10cSrcweir // -------------
531cdf0e10cSrcweir 
532cdf0e10cSrcweir class DbgDialog : public ModalDialog
533cdf0e10cSrcweir {
534cdf0e10cSrcweir private:
535cdf0e10cSrcweir     CheckBox        maXtorThis;
536cdf0e10cSrcweir     CheckBox        maXtorFunc;
537cdf0e10cSrcweir     CheckBox        maXtorExit;
538cdf0e10cSrcweir     CheckBox        maXtorReport;
539cdf0e10cSrcweir     CheckBox        maXtorTrace;
540cdf0e10cSrcweir     GroupBox        maBox1;
541cdf0e10cSrcweir 
542cdf0e10cSrcweir     CheckBox        maMemInit;
543cdf0e10cSrcweir     CheckBox        maMemOverwrite;
544cdf0e10cSrcweir     CheckBox        maMemOverwriteFree;
545cdf0e10cSrcweir     CheckBox        maMemPtr;
546cdf0e10cSrcweir     CheckBox        maMemReport;
547cdf0e10cSrcweir     CheckBox        maMemTrace;
548cdf0e10cSrcweir     CheckBox        maMemLeakReport;
549cdf0e10cSrcweir     CheckBox        maMemNewDel;
550cdf0e10cSrcweir     CheckBox        maMemXtor;
551cdf0e10cSrcweir     GroupBox        maBox2;
552cdf0e10cSrcweir 
553cdf0e10cSrcweir     CheckBox        maProf;
554cdf0e10cSrcweir     CheckBox        maRes;
555cdf0e10cSrcweir     CheckBox        maDialog;
556cdf0e10cSrcweir     CheckBox        maBoldAppFont;
557cdf0e10cSrcweir     GroupBox        maBox3;
558cdf0e10cSrcweir 
559cdf0e10cSrcweir     Edit            maDebugName;
560cdf0e10cSrcweir     CheckBox        maOverwrite;
561cdf0e10cSrcweir     FixedText       maInclClassText;
562cdf0e10cSrcweir     Edit            maInclClassFilter;
563cdf0e10cSrcweir     FixedText       maExclClassText;
564cdf0e10cSrcweir     Edit            maExclClassFilter;
565cdf0e10cSrcweir     FixedText       maInclText;
566cdf0e10cSrcweir     Edit            maInclFilter;
567cdf0e10cSrcweir     FixedText       maExclText;
568cdf0e10cSrcweir     Edit            maExclFilter;
569cdf0e10cSrcweir     FixedText       maTraceText;
570cdf0e10cSrcweir     ListBox         maTraceBox;
571cdf0e10cSrcweir     FixedText       maWarningText;
572cdf0e10cSrcweir     ListBox         maWarningBox;
573cdf0e10cSrcweir     FixedText       maErrorText;
574cdf0e10cSrcweir     ListBox         maErrorBox;
575cdf0e10cSrcweir     CheckBox        maHookOSLBox;
576cdf0e10cSrcweir     GroupBox        maBox4;
577cdf0e10cSrcweir 
578cdf0e10cSrcweir     OKButton        maOKButton;
579cdf0e10cSrcweir     CancelButton    maCancelButton;
580cdf0e10cSrcweir     PushButton      maInfoButton;
581cdf0e10cSrcweir     HelpButton      maHelpButton;
582cdf0e10cSrcweir     sal_uInt16          mnErrorOff;
583cdf0e10cSrcweir 
584cdf0e10cSrcweir public:
585cdf0e10cSrcweir                     DbgDialog();
586cdf0e10cSrcweir 
587cdf0e10cSrcweir                     DECL_LINK( ClickHdl, Button* );
588cdf0e10cSrcweir     void            RequestHelp( const HelpEvent& rHEvt );
589cdf0e10cSrcweir };
590cdf0e10cSrcweir 
591cdf0e10cSrcweir // =======================================================================
592cdf0e10cSrcweir 
593cdf0e10cSrcweir static sal_Char aDbgInfoBuf[12288];
594cdf0e10cSrcweir static sal_Char aDbgOutBuf[DBG_BUF_MAXLEN];
595cdf0e10cSrcweir 
596cdf0e10cSrcweir // =======================================================================
597cdf0e10cSrcweir 
DbgWindow()598cdf0e10cSrcweir DbgWindow::DbgWindow() :
599cdf0e10cSrcweir     WorkWindow( NULL, WB_STDWORK ),
600cdf0e10cSrcweir     maLstBox( this, WB_AUTOHSCROLL )
601cdf0e10cSrcweir {
602cdf0e10cSrcweir     DbgData* pData = DbgGetData();
603cdf0e10cSrcweir 
604cdf0e10cSrcweir     maLstBox.Show();
605cdf0e10cSrcweir     maLstBox.SetPosPixel( Point( 0, 0 ) );
606cdf0e10cSrcweir 
607cdf0e10cSrcweir     SetOutputSizePixel( Size( 600, 480 ) );
608cdf0e10cSrcweir     if ( pData->aDbgWinState )
609cdf0e10cSrcweir     {
610cdf0e10cSrcweir         ByteString aState( pData->aDbgWinState );
611cdf0e10cSrcweir         SetWindowState( aState );
612cdf0e10cSrcweir     }
613cdf0e10cSrcweir 
614cdf0e10cSrcweir     SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "StarView Debug Window" ) ) );
615cdf0e10cSrcweir     Show();
616cdf0e10cSrcweir     Update();
617cdf0e10cSrcweir }
618cdf0e10cSrcweir 
619cdf0e10cSrcweir // -----------------------------------------------------------------------
620cdf0e10cSrcweir 
Close()621cdf0e10cSrcweir sal_Bool DbgWindow::Close()
622cdf0e10cSrcweir {
623cdf0e10cSrcweir     // remember window position
624cdf0e10cSrcweir     ByteString aState( GetWindowState() );
625cdf0e10cSrcweir     DbgData* pData = DbgGetData();
626cdf0e10cSrcweir     size_t nCopy = (sizeof( pData->aDbgWinState ) < size_t(aState.Len() + 1U ))
627cdf0e10cSrcweir     ? sizeof( pData->aDbgWinState ) : size_t(aState.Len() + 1U );
628cdf0e10cSrcweir     strncpy( pData->aDbgWinState, aState.GetBuffer(), nCopy );
629cdf0e10cSrcweir     pData->aDbgWinState[ sizeof( pData->aDbgWinState ) - 1 ] = 0;
630cdf0e10cSrcweir     // and save for next session
631cdf0e10cSrcweir     DbgSaveData( *pData );
632cdf0e10cSrcweir 
633cdf0e10cSrcweir     delete this;
634cdf0e10cSrcweir     ImplGetSVData()->maWinData.mpDbgWin = NULL;
635cdf0e10cSrcweir     return sal_True;
636cdf0e10cSrcweir }
637cdf0e10cSrcweir 
638cdf0e10cSrcweir // -----------------------------------------------------------------------
639cdf0e10cSrcweir 
Resize()640cdf0e10cSrcweir void DbgWindow::Resize()
641cdf0e10cSrcweir {
642cdf0e10cSrcweir     maLstBox.SetSizePixel( GetOutputSizePixel() );
643cdf0e10cSrcweir }
644cdf0e10cSrcweir 
645cdf0e10cSrcweir // -----------------------------------------------------------------------
646cdf0e10cSrcweir 
GetAssertionEntryRange(sal_uInt16 nInbetweenEntry,sal_uInt16 & nFirst,sal_uInt16 & nLast)647cdf0e10cSrcweir void DbgWindow::GetAssertionEntryRange( sal_uInt16 nInbetweenEntry, sal_uInt16& nFirst, sal_uInt16& nLast )
648cdf0e10cSrcweir {
649cdf0e10cSrcweir     nFirst = nInbetweenEntry;
650cdf0e10cSrcweir     while ( nFirst > 0 )
651cdf0e10cSrcweir     {
652cdf0e10cSrcweir         if ( maLstBox.GetEntryData( nFirst ) != NULL )
653cdf0e10cSrcweir             break;
654cdf0e10cSrcweir         --nFirst;
655cdf0e10cSrcweir     }
656cdf0e10cSrcweir     sal_uInt16 nEntryCount = maLstBox.GetEntryCount();
657cdf0e10cSrcweir     nLast = nInbetweenEntry + 1;
658cdf0e10cSrcweir     while ( nLast < nEntryCount )
659cdf0e10cSrcweir     {
660cdf0e10cSrcweir         if ( maLstBox.GetEntryData( nLast ) != NULL )
661cdf0e10cSrcweir             break;
662cdf0e10cSrcweir         ++nLast;
663cdf0e10cSrcweir     }
664cdf0e10cSrcweir }
665cdf0e10cSrcweir 
666cdf0e10cSrcweir // -----------------------------------------------------------------------
667cdf0e10cSrcweir 
PreNotify(NotifyEvent & rNEvt)668cdf0e10cSrcweir long DbgWindow::PreNotify( NotifyEvent& rNEvt )
669cdf0e10cSrcweir {
670cdf0e10cSrcweir     if ( rNEvt.GetType() == EVENT_COMMAND )
671cdf0e10cSrcweir     {
672cdf0e10cSrcweir         if ( maLstBox.IsWindowOrChild( rNEvt.GetWindow() ) )
673cdf0e10cSrcweir         {
674cdf0e10cSrcweir             const CommandEvent& rCommand = *rNEvt.GetCommandEvent();
675cdf0e10cSrcweir             if ( rCommand.GetCommand() == COMMAND_CONTEXTMENU )
676cdf0e10cSrcweir             {
677cdf0e10cSrcweir                 PopupMenu aMenu;
678cdf0e10cSrcweir                 aMenu.InsertItem( 1, String::CreateFromAscii( "copy to clipboard" ) );
679cdf0e10cSrcweir 
680cdf0e10cSrcweir                 Point aPos;
681cdf0e10cSrcweir                 if ( rCommand.IsMouseEvent() )
682cdf0e10cSrcweir                     aPos = rCommand.GetMousePosPixel();
683cdf0e10cSrcweir                 else
684cdf0e10cSrcweir                 {
685cdf0e10cSrcweir                     Rectangle aEntryRect( maLstBox.GetBoundingRectangle( maLstBox.GetSelectEntryPos() ) );
686cdf0e10cSrcweir                     aPos = aEntryRect.Center();
687cdf0e10cSrcweir                 }
688cdf0e10cSrcweir                 sal_uInt16 nSelected = aMenu.Execute( rNEvt.GetWindow(), aPos );
689cdf0e10cSrcweir                 if ( nSelected == 1 )
690cdf0e10cSrcweir                 {
691cdf0e10cSrcweir                     // search all entries which belong to this assertion
692cdf0e10cSrcweir                     sal_uInt16 nAssertionFirst = 0;
693cdf0e10cSrcweir                     sal_uInt16 nAssertionLast = 0;
694cdf0e10cSrcweir                     GetAssertionEntryRange( maLstBox.GetSelectEntryPos(), nAssertionFirst, nAssertionLast );
695cdf0e10cSrcweir 
696cdf0e10cSrcweir                     // build the string to copy to the clipboard
697cdf0e10cSrcweir                     String sAssertion;
698cdf0e10cSrcweir                     String sLineFeed = String::CreateFromAscii( "\n" );
699cdf0e10cSrcweir                     sLineFeed.ConvertLineEnd( GetSystemLineEnd() );
700cdf0e10cSrcweir                     while ( nAssertionFirst < nAssertionLast )
701cdf0e10cSrcweir                     {
702cdf0e10cSrcweir                         sAssertion += maLstBox.GetEntry( nAssertionFirst++ );
703cdf0e10cSrcweir                         sAssertion += sLineFeed;
704cdf0e10cSrcweir                     }
705cdf0e10cSrcweir 
706cdf0e10cSrcweir                     ::vcl::unohelper::TextDataObject::CopyStringTo( sAssertion, GetClipboard() );
707cdf0e10cSrcweir                 }
708cdf0e10cSrcweir             }
709cdf0e10cSrcweir             return 1;   // handled
710cdf0e10cSrcweir         }
711cdf0e10cSrcweir     }
712cdf0e10cSrcweir     return WorkWindow::PreNotify( rNEvt );
713cdf0e10cSrcweir }
714cdf0e10cSrcweir 
715cdf0e10cSrcweir // -----------------------------------------------------------------------
716cdf0e10cSrcweir 
InsertLine(const XubString & rLine)717cdf0e10cSrcweir void DbgWindow::InsertLine( const XubString& rLine )
718cdf0e10cSrcweir {
719cdf0e10cSrcweir     XubString aStr = rLine;
720cdf0e10cSrcweir     aStr.ConvertLineEnd( LINEEND_LF );
721cdf0e10cSrcweir     xub_StrLen  nPos = aStr.Search( _LF );
722cdf0e10cSrcweir     sal_Bool bFirstEntry = sal_True;
723cdf0e10cSrcweir     while ( nPos != STRING_NOTFOUND )
724cdf0e10cSrcweir     {
725cdf0e10cSrcweir         if ( maLstBox.GetEntryCount() >= DBGWIN_MAXLINES )
726cdf0e10cSrcweir             maLstBox.RemoveEntry( 0 );
727cdf0e10cSrcweir 
728cdf0e10cSrcweir         sal_uInt16 nInsertionPos = maLstBox.InsertEntry( aStr.Copy( 0, nPos ) );
729cdf0e10cSrcweir         if ( bFirstEntry )
730cdf0e10cSrcweir             maLstBox.SetEntryData( nInsertionPos, reinterpret_cast< void* >( 0x00000001 ) );
731cdf0e10cSrcweir         bFirstEntry = sal_False;
732cdf0e10cSrcweir 
733cdf0e10cSrcweir         aStr.Erase( 0, nPos+1 );
734cdf0e10cSrcweir         nPos = aStr.Search( _LF );
735cdf0e10cSrcweir     }
736cdf0e10cSrcweir     if ( maLstBox.GetEntryCount() >= DBGWIN_MAXLINES )
737cdf0e10cSrcweir         maLstBox.RemoveEntry( 0 );
738cdf0e10cSrcweir     sal_uInt16 nInsertionPos = maLstBox.InsertEntry( aStr );
739cdf0e10cSrcweir     if ( bFirstEntry )
740cdf0e10cSrcweir         maLstBox.SetEntryData( nInsertionPos, reinterpret_cast< void* >( 0x00000001 ) );
741cdf0e10cSrcweir     maLstBox.SetTopEntry( DBGWIN_MAXLINES-1 );
742cdf0e10cSrcweir     maLstBox.Update();
743cdf0e10cSrcweir }
744cdf0e10cSrcweir 
745cdf0e10cSrcweir // =======================================================================
746cdf0e10cSrcweir 
DbgDialog()747cdf0e10cSrcweir DbgDialog::DbgDialog() :
748cdf0e10cSrcweir     ModalDialog( NULL, WB_STDMODAL | WB_SYSTEMWINDOW ),
749cdf0e10cSrcweir     maXtorThis( this ),
750cdf0e10cSrcweir     maXtorFunc( this ),
751cdf0e10cSrcweir     maXtorExit( this ),
752cdf0e10cSrcweir     maXtorReport( this ),
753cdf0e10cSrcweir     maXtorTrace( this ),
754cdf0e10cSrcweir     maBox1( this ),
755cdf0e10cSrcweir     maMemInit( this ),
756cdf0e10cSrcweir     maMemOverwrite( this ),
757cdf0e10cSrcweir     maMemOverwriteFree( this ),
758cdf0e10cSrcweir     maMemPtr( this ),
759cdf0e10cSrcweir     maMemReport( this ),
760cdf0e10cSrcweir     maMemTrace( this ),
761cdf0e10cSrcweir     maMemLeakReport( this ),
762cdf0e10cSrcweir     maMemNewDel( this ),
763cdf0e10cSrcweir     maMemXtor( this ),
764cdf0e10cSrcweir     maBox2( this ),
765cdf0e10cSrcweir     maProf( this ),
766cdf0e10cSrcweir     maRes( this ),
767cdf0e10cSrcweir     maDialog( this ),
768cdf0e10cSrcweir     maBoldAppFont( this ),
769cdf0e10cSrcweir     maBox3( this ),
770cdf0e10cSrcweir     maDebugName( this ),
771cdf0e10cSrcweir     maOverwrite( this ),
772cdf0e10cSrcweir     maInclClassText( this ),
773cdf0e10cSrcweir     maInclClassFilter( this ),
774cdf0e10cSrcweir     maExclClassText( this ),
775cdf0e10cSrcweir     maExclClassFilter( this ),
776cdf0e10cSrcweir     maInclText( this ),
777cdf0e10cSrcweir     maInclFilter( this ),
778cdf0e10cSrcweir     maExclText( this ),
779cdf0e10cSrcweir     maExclFilter( this ),
780cdf0e10cSrcweir     maTraceText( this ),
781cdf0e10cSrcweir     maTraceBox( this, WB_DROPDOWN ),
782cdf0e10cSrcweir     maWarningText( this ),
783cdf0e10cSrcweir     maWarningBox( this, WB_DROPDOWN ),
784cdf0e10cSrcweir     maErrorText( this ),
785cdf0e10cSrcweir     maErrorBox( this, WB_DROPDOWN ),
786cdf0e10cSrcweir     maHookOSLBox( this ),
787cdf0e10cSrcweir     maBox4( this ),
788cdf0e10cSrcweir     maOKButton( this, WB_DEFBUTTON ),
789cdf0e10cSrcweir     maCancelButton( this ),
790cdf0e10cSrcweir     maInfoButton( this ),
791cdf0e10cSrcweir     maHelpButton( this )
792cdf0e10cSrcweir {
793cdf0e10cSrcweir     DbgData*    pData = DbgGetData();
794cdf0e10cSrcweir     MapMode     aAppMap( MAP_APPFONT );
795cdf0e10cSrcweir     Size        aButtonSize = LogicToPixel( Size( 60, 12 ), aAppMap );
796cdf0e10cSrcweir 
797cdf0e10cSrcweir     {
798cdf0e10cSrcweir     maXtorThis.Show();
799cdf0e10cSrcweir     maXtorThis.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "T~his" ) ) );
800cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_XTOR_THIS )
801cdf0e10cSrcweir         maXtorThis.Check( sal_True );
802cdf0e10cSrcweir     maXtorThis.SetPosSizePixel( LogicToPixel( Point( 10, 15 ), aAppMap ),
803cdf0e10cSrcweir                                 aButtonSize );
804cdf0e10cSrcweir     }
805cdf0e10cSrcweir 
806cdf0e10cSrcweir     {
807cdf0e10cSrcweir     maXtorFunc.Show();
808cdf0e10cSrcweir     maXtorFunc.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Function" ) ) );
809cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_XTOR_FUNC )
810cdf0e10cSrcweir         maXtorFunc.Check( sal_True );
811cdf0e10cSrcweir     maXtorFunc.SetPosSizePixel( LogicToPixel( Point( 75, 15 ), aAppMap ),
812cdf0e10cSrcweir                                 aButtonSize );
813cdf0e10cSrcweir     }
814cdf0e10cSrcweir 
815cdf0e10cSrcweir     {
816cdf0e10cSrcweir     maXtorExit.Show();
817cdf0e10cSrcweir     maXtorExit.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "E~xit" ) ) );
818cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_XTOR_EXIT )
819cdf0e10cSrcweir         maXtorExit.Check( sal_True );
820cdf0e10cSrcweir     maXtorExit.SetPosSizePixel( LogicToPixel( Point( 140, 15 ), aAppMap ),
821cdf0e10cSrcweir                                 aButtonSize );
822cdf0e10cSrcweir     }
823cdf0e10cSrcweir 
824cdf0e10cSrcweir     {
825cdf0e10cSrcweir     maXtorReport.Show();
826cdf0e10cSrcweir     maXtorReport.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Report" ) ) );
827cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_XTOR_REPORT )
828cdf0e10cSrcweir         maXtorReport.Check( sal_True );
829cdf0e10cSrcweir     maXtorReport.SetPosSizePixel( LogicToPixel( Point( 205, 15 ), aAppMap ),
830cdf0e10cSrcweir                                   aButtonSize );
831cdf0e10cSrcweir     }
832cdf0e10cSrcweir 
833cdf0e10cSrcweir     {
834cdf0e10cSrcweir     maXtorTrace.Show();
835cdf0e10cSrcweir     maXtorTrace.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) );
836cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_XTOR_TRACE )
837cdf0e10cSrcweir         maXtorTrace.Check( sal_True );
838cdf0e10cSrcweir     maXtorTrace.SetPosSizePixel( LogicToPixel( Point( 270, 15 ), aAppMap ),
839cdf0e10cSrcweir                                  aButtonSize );
840cdf0e10cSrcweir     }
841cdf0e10cSrcweir 
842cdf0e10cSrcweir     {
843cdf0e10cSrcweir     maBox1.Show();
844cdf0e10cSrcweir     maBox1.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Object Tests" ) ) );
845cdf0e10cSrcweir     maBox1.SetPosSizePixel( LogicToPixel( Point( 5, 5 ), aAppMap ),
846cdf0e10cSrcweir                             LogicToPixel( Size( 330, 30 ), aAppMap ) );
847cdf0e10cSrcweir     }
848cdf0e10cSrcweir 
849cdf0e10cSrcweir     {
850cdf0e10cSrcweir     maMemInit.Show();
851cdf0e10cSrcweir     maMemInit.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Initialize" ) ) );
852cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_MEM_INIT )
853cdf0e10cSrcweir         maMemInit.Check( sal_True );
854cdf0e10cSrcweir     maMemInit.SetPosSizePixel( LogicToPixel( Point( 10, 50 ), aAppMap ),
855cdf0e10cSrcweir                                aButtonSize );
856cdf0e10cSrcweir     }
857cdf0e10cSrcweir 
858cdf0e10cSrcweir     {
859cdf0e10cSrcweir     maMemOverwrite.Show();
860cdf0e10cSrcweir     maMemOverwrite.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Overwrite" )) );
861cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_MEM_OVERWRITE )
862cdf0e10cSrcweir         maMemOverwrite.Check( sal_True );
863cdf0e10cSrcweir     maMemOverwrite.SetPosSizePixel( LogicToPixel( Point( 75, 50 ), aAppMap ),
864cdf0e10cSrcweir                                     aButtonSize );
865cdf0e10cSrcweir     }
866cdf0e10cSrcweir 
867cdf0e10cSrcweir     {
868cdf0e10cSrcweir     maMemOverwriteFree.Show();
869cdf0e10cSrcweir     maMemOverwriteFree.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Free" ) ) );
870cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_MEM_OVERWRITEFREE )
871cdf0e10cSrcweir         maMemOverwriteFree.Check( sal_True );
872cdf0e10cSrcweir     maMemOverwriteFree.SetPosSizePixel( LogicToPixel( Point( 140, 50 ), aAppMap ),
873cdf0e10cSrcweir                                         aButtonSize );
874cdf0e10cSrcweir     }
875cdf0e10cSrcweir 
876cdf0e10cSrcweir     {
877cdf0e10cSrcweir     maMemPtr.Show();
878cdf0e10cSrcweir     maMemPtr.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Pointer" ) ) );
879cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_MEM_POINTER )
880cdf0e10cSrcweir         maMemPtr.Check( sal_True );
881cdf0e10cSrcweir     maMemPtr.SetPosSizePixel( LogicToPixel( Point( 205, 50 ), aAppMap ),
882cdf0e10cSrcweir                               aButtonSize );
883cdf0e10cSrcweir     }
884cdf0e10cSrcweir 
885cdf0e10cSrcweir     {
886cdf0e10cSrcweir     maMemReport.Show();
887cdf0e10cSrcweir     maMemReport.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Report" ) ) );
888cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_MEM_REPORT )
889cdf0e10cSrcweir         maMemReport.Check( sal_True );
890cdf0e10cSrcweir     maMemReport.SetPosSizePixel( LogicToPixel( Point( 270, 50 ), aAppMap ),
891cdf0e10cSrcweir                                  aButtonSize );
892cdf0e10cSrcweir     }
893cdf0e10cSrcweir 
894cdf0e10cSrcweir     {
895cdf0e10cSrcweir     maMemTrace.Show();
896cdf0e10cSrcweir     maMemTrace.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) );
897cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_MEM_TRACE )
898cdf0e10cSrcweir         maMemTrace.Check( sal_True );
899cdf0e10cSrcweir     maMemTrace.SetPosSizePixel( LogicToPixel( Point( 10, 65 ), aAppMap ),
900cdf0e10cSrcweir                                 aButtonSize );
901cdf0e10cSrcweir     }
902cdf0e10cSrcweir 
903cdf0e10cSrcweir     {
904cdf0e10cSrcweir     maMemLeakReport.Show();
905cdf0e10cSrcweir     maMemLeakReport.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Leak-Report" ) ) );
906cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_MEM_LEAKREPORT )
907cdf0e10cSrcweir         maMemLeakReport.Check( sal_True );
908cdf0e10cSrcweir     maMemLeakReport.SetPosSizePixel( LogicToPixel( Point( 75, 65 ), aAppMap ),
909cdf0e10cSrcweir                                      aButtonSize );
910cdf0e10cSrcweir     }
911cdf0e10cSrcweir 
912cdf0e10cSrcweir     {
913cdf0e10cSrcweir     maMemNewDel.Show();
914cdf0e10cSrcweir     maMemNewDel.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~New/Delete" ) ) );
915cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_MEM_NEWDEL )
916cdf0e10cSrcweir         maMemNewDel.Check( sal_True );
917cdf0e10cSrcweir     maMemNewDel.SetPosSizePixel( LogicToPixel( Point( 140, 65 ), aAppMap ),
918cdf0e10cSrcweir                                  aButtonSize );
919cdf0e10cSrcweir     }
920cdf0e10cSrcweir 
921cdf0e10cSrcweir     {
922cdf0e10cSrcweir     maMemXtor.Show();
923cdf0e10cSrcweir     maMemXtor.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Ob~ject Test" ) ) );
924cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_MEM_XTOR )
925cdf0e10cSrcweir         maMemXtor.Check( sal_True );
926cdf0e10cSrcweir     maMemXtor.SetPosSizePixel( LogicToPixel( Point( 205, 65 ), aAppMap ),
927cdf0e10cSrcweir                                aButtonSize );
928cdf0e10cSrcweir     }
929cdf0e10cSrcweir 
930cdf0e10cSrcweir     {
931cdf0e10cSrcweir     maBox2.Show();
932cdf0e10cSrcweir     maBox2.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Memory Tests" ) ) );
933cdf0e10cSrcweir     maBox2.SetPosSizePixel( LogicToPixel( Point( 5, 40 ), aAppMap ),
934cdf0e10cSrcweir                             LogicToPixel( Size( 330, 40 ), aAppMap ) );
935cdf0e10cSrcweir     }
936cdf0e10cSrcweir 
937cdf0e10cSrcweir     {
938cdf0e10cSrcweir     maProf.Show();
939cdf0e10cSrcweir     maProf.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Profiling" ) ) );
940cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_PROFILING )
941cdf0e10cSrcweir         maProf.Check( sal_True );
942cdf0e10cSrcweir     maProf.SetPosSizePixel( LogicToPixel( Point( 10, 95 ), aAppMap ),
943cdf0e10cSrcweir                             aButtonSize );
944cdf0e10cSrcweir     }
945cdf0e10cSrcweir 
946cdf0e10cSrcweir     {
947cdf0e10cSrcweir     maRes.Show();
948cdf0e10cSrcweir     maRes.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Resourcen" ) ) );
949cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_RESOURCE )
950cdf0e10cSrcweir         maRes.Check( sal_True );
951cdf0e10cSrcweir     maRes.SetPosSizePixel( LogicToPixel( Point( 75, 95 ), aAppMap ),
952cdf0e10cSrcweir                            aButtonSize );
953cdf0e10cSrcweir     }
954cdf0e10cSrcweir 
955cdf0e10cSrcweir     {
956cdf0e10cSrcweir     maDialog.Show();
957cdf0e10cSrcweir     maDialog.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Dialog" ) ) );
958cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_DIALOG )
959cdf0e10cSrcweir         maDialog.Check( sal_True );
960cdf0e10cSrcweir     maDialog.SetPosSizePixel( LogicToPixel( Point( 140, 95 ), aAppMap ),
961cdf0e10cSrcweir                               aButtonSize );
962cdf0e10cSrcweir     }
963cdf0e10cSrcweir 
964cdf0e10cSrcweir     {
965cdf0e10cSrcweir     maBoldAppFont.Show();
966cdf0e10cSrcweir     maBoldAppFont.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Bold AppFont" ) ) );
967cdf0e10cSrcweir     if ( pData->nTestFlags & DBG_TEST_BOLDAPPFONT )
968cdf0e10cSrcweir         maBoldAppFont.Check( sal_True );
969cdf0e10cSrcweir     maBoldAppFont.SetPosSizePixel( LogicToPixel( Point( 205, 95 ), aAppMap ),
970cdf0e10cSrcweir                                    aButtonSize );
971cdf0e10cSrcweir     maBoldAppFont.SaveValue();
972cdf0e10cSrcweir     }
973cdf0e10cSrcweir 
974cdf0e10cSrcweir     {
975cdf0e10cSrcweir     maBox3.Show();
976cdf0e10cSrcweir     maBox3.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Test Options" ) ) );
977cdf0e10cSrcweir     maBox3.SetPosSizePixel( LogicToPixel( Point( 5, 85 ), aAppMap ),
978cdf0e10cSrcweir                             LogicToPixel( Size( 330, 30 ), aAppMap ) );
979cdf0e10cSrcweir     }
980cdf0e10cSrcweir 
981cdf0e10cSrcweir     {
982cdf0e10cSrcweir     maDebugName.Show();
983cdf0e10cSrcweir     maDebugName.SetText( XubString( pData->aDebugName, RTL_TEXTENCODING_UTF8 ) );
984cdf0e10cSrcweir     maDebugName.SetMaxTextLen( sizeof( pData->aDebugName ) );
985cdf0e10cSrcweir     maDebugName.SetPosSizePixel( LogicToPixel( Point( 10, 130 ), aAppMap ),
986cdf0e10cSrcweir                                  LogicToPixel( Size( 185, 14 ), aAppMap ) );
987cdf0e10cSrcweir     }
988cdf0e10cSrcweir 
989cdf0e10cSrcweir     {
990cdf0e10cSrcweir     maOverwrite.Show();
991cdf0e10cSrcweir     maOverwrite.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Overwrite ~File" ) ) );
992cdf0e10cSrcweir     if ( pData->bOverwrite )
993cdf0e10cSrcweir         maOverwrite.Check( sal_True );
994cdf0e10cSrcweir     maOverwrite.SetPosSizePixel( LogicToPixel( Point( 205, 130 ), aAppMap ),
995cdf0e10cSrcweir                                  aButtonSize );
996cdf0e10cSrcweir     }
997cdf0e10cSrcweir 
998cdf0e10cSrcweir     {
999cdf0e10cSrcweir     maHookOSLBox.Show();
1000cdf0e10cSrcweir     maHookOSLBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Reroute osl debug ~messages" ) ) );
1001cdf0e10cSrcweir     if ( pData->bHookOSLAssert )
1002cdf0e10cSrcweir         maHookOSLBox.Check( sal_True );
1003cdf0e10cSrcweir     maHookOSLBox.SetPosSizePixel( LogicToPixel( Point( 10, 240 ), aAppMap ),
1004cdf0e10cSrcweir                                   LogicToPixel( Size( 100, 12 ), aAppMap ) );
1005cdf0e10cSrcweir     }
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir     {
1008cdf0e10cSrcweir     maInclClassText.Show();
1009cdf0e10cSrcweir     maInclClassText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Include-ObjectTest-Filter" ) ) );
1010cdf0e10cSrcweir     maInclClassText.SetPosSizePixel( LogicToPixel( Point( 10, 150 ), aAppMap ),
1011cdf0e10cSrcweir                                      LogicToPixel( Size( 95, 9 ), aAppMap ) );
1012cdf0e10cSrcweir     }
1013cdf0e10cSrcweir 
1014cdf0e10cSrcweir     {
1015cdf0e10cSrcweir     maInclClassFilter.Show();
1016cdf0e10cSrcweir     maInclClassFilter.SetText( XubString( pData->aInclClassFilter, RTL_TEXTENCODING_UTF8 ) );
1017cdf0e10cSrcweir     maInclClassFilter.SetMaxTextLen( sizeof( pData->aInclClassFilter ) );
1018cdf0e10cSrcweir     maInclClassFilter.SetPosSizePixel( LogicToPixel( Point( 10, 160 ), aAppMap ),
1019cdf0e10cSrcweir                                        LogicToPixel( Size( 95, 14 ), aAppMap ) );
1020cdf0e10cSrcweir     }
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir     {
1023cdf0e10cSrcweir     maExclClassText.Show();
1024cdf0e10cSrcweir     maExclClassText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exclude-ObjectTest-Filter" ) ) );
1025cdf0e10cSrcweir     maExclClassText.SetPosSizePixel( LogicToPixel( Point( 115, 150 ), aAppMap ),
1026cdf0e10cSrcweir                                      LogicToPixel( Size( 95, 9 ), aAppMap ) );
1027cdf0e10cSrcweir     }
1028cdf0e10cSrcweir 
1029cdf0e10cSrcweir     {
1030cdf0e10cSrcweir     maExclClassFilter.Show();
1031cdf0e10cSrcweir     maExclClassFilter.SetText( XubString( pData->aExclClassFilter, RTL_TEXTENCODING_UTF8 ) );
1032cdf0e10cSrcweir     maExclClassFilter.SetMaxTextLen( sizeof( pData->aExclClassFilter ) );
1033cdf0e10cSrcweir     maExclClassFilter.SetPosSizePixel( LogicToPixel( Point( 115, 160 ), aAppMap ),
1034cdf0e10cSrcweir                                        LogicToPixel( Size( 95, 14 ), aAppMap ) );
1035cdf0e10cSrcweir     }
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir     {
1038cdf0e10cSrcweir     maInclText.Show();
1039cdf0e10cSrcweir     maInclText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Include-Filter" ) ) );
1040cdf0e10cSrcweir     maInclText.SetPosSizePixel( LogicToPixel( Point( 10, 180 ), aAppMap ),
1041cdf0e10cSrcweir                                 LogicToPixel( Size( 95, 9 ), aAppMap ) );
1042cdf0e10cSrcweir     }
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir     {
1045cdf0e10cSrcweir     maInclFilter.Show();
1046cdf0e10cSrcweir     maInclFilter.SetText( XubString( pData->aInclFilter, RTL_TEXTENCODING_UTF8 ) );
1047cdf0e10cSrcweir     maInclFilter.SetMaxTextLen( sizeof( pData->aInclFilter ) );
1048cdf0e10cSrcweir     maInclFilter.SetPosSizePixel( LogicToPixel( Point( 10, 190 ), aAppMap ),
1049cdf0e10cSrcweir                                   LogicToPixel( Size( 95, 14 ), aAppMap ) );
1050cdf0e10cSrcweir     }
1051cdf0e10cSrcweir 
1052cdf0e10cSrcweir     {
1053cdf0e10cSrcweir     maExclText.Show();
1054cdf0e10cSrcweir     maExclText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exclude-Filter" ) ) );
1055cdf0e10cSrcweir     maExclText.SetPosSizePixel( LogicToPixel( Point( 115, 180 ), aAppMap ),
1056cdf0e10cSrcweir                                 LogicToPixel( Size( 95, 9 ), aAppMap ) );
1057cdf0e10cSrcweir     }
1058cdf0e10cSrcweir 
1059cdf0e10cSrcweir     {
1060cdf0e10cSrcweir     maExclFilter.Show();
1061cdf0e10cSrcweir     maExclFilter.SetText( XubString( pData->aExclFilter, RTL_TEXTENCODING_UTF8 ) );
1062cdf0e10cSrcweir     maExclFilter.SetMaxTextLen( sizeof( pData->aExclFilter ) );
1063cdf0e10cSrcweir     maExclFilter.SetPosSizePixel( LogicToPixel( Point( 115, 190 ), aAppMap ),
1064cdf0e10cSrcweir                                   LogicToPixel( Size( 95, 14 ), aAppMap ) );
1065cdf0e10cSrcweir     }
1066cdf0e10cSrcweir 
1067cdf0e10cSrcweir     {
1068cdf0e10cSrcweir     maTraceText.Show();
1069cdf0e10cSrcweir     maTraceText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) );
1070cdf0e10cSrcweir     maTraceText.SetPosSizePixel( LogicToPixel( Point( 10, 210 ), aAppMap ),
1071cdf0e10cSrcweir                                  LogicToPixel( Size( 95, 9 ), aAppMap ) );
1072cdf0e10cSrcweir     }
1073cdf0e10cSrcweir 
1074cdf0e10cSrcweir     {
1075cdf0e10cSrcweir     maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
1076cdf0e10cSrcweir     maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) );
1077cdf0e10cSrcweir     maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Window" ) ) );
1078cdf0e10cSrcweir     maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Shell" ) ) );
1079cdf0e10cSrcweir     maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
1080cdf0e10cSrcweir     maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
1081cdf0e10cSrcweir     maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
1082cdf0e10cSrcweir     maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) ) );
1083cdf0e10cSrcweir     ImplAppendUserDefinedChannels( maTraceBox );
1084cdf0e10cSrcweir     ImplSelectChannel( maTraceBox, pData->nTraceOut, 0 );
1085cdf0e10cSrcweir     maTraceBox.Show();
1086cdf0e10cSrcweir     maTraceBox.SetPosSizePixel( LogicToPixel( Point( 10, 220 ), aAppMap ),
1087cdf0e10cSrcweir                                 LogicToPixel( Size( 95, 80 ), aAppMap ) );
1088cdf0e10cSrcweir     }
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir     {
1091cdf0e10cSrcweir     maWarningText.Show();
1092cdf0e10cSrcweir     maWarningText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Warning" ) ) );
1093cdf0e10cSrcweir     maWarningText.SetPosSizePixel( LogicToPixel( Point( 115, 210 ), aAppMap ),
1094cdf0e10cSrcweir                                    LogicToPixel( Size( 95, 9 ), aAppMap ) );
1095cdf0e10cSrcweir     }
1096cdf0e10cSrcweir 
1097cdf0e10cSrcweir     {
1098cdf0e10cSrcweir     maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
1099cdf0e10cSrcweir     maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) );
1100cdf0e10cSrcweir     maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Window" ) ) );
1101cdf0e10cSrcweir     maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Shell" ) ) );
1102cdf0e10cSrcweir     maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
1103cdf0e10cSrcweir     maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
1104cdf0e10cSrcweir     maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
1105cdf0e10cSrcweir     maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) ) );
1106cdf0e10cSrcweir     ImplAppendUserDefinedChannels( maWarningBox );
1107cdf0e10cSrcweir     ImplSelectChannel( maWarningBox, pData->nWarningOut, 0 );
1108cdf0e10cSrcweir     maWarningBox.Show();
1109cdf0e10cSrcweir     maWarningBox.SetPosSizePixel( LogicToPixel( Point( 115, 220 ), aAppMap ),
1110cdf0e10cSrcweir                                   LogicToPixel( Size( 95, 80 ), aAppMap ) );
1111cdf0e10cSrcweir     }
1112cdf0e10cSrcweir 
1113cdf0e10cSrcweir     {
1114cdf0e10cSrcweir     maErrorText.Show();
1115cdf0e10cSrcweir     maErrorText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Error" ) ) );
1116cdf0e10cSrcweir     maErrorText.SetPosSizePixel( LogicToPixel( Point( 220, 210 ), aAppMap ),
1117cdf0e10cSrcweir                                  LogicToPixel( Size( 95, 9 ), aAppMap ) );
1118cdf0e10cSrcweir     }
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir     {
1121cdf0e10cSrcweir     if ( DbgIsAllErrorOut() )
1122cdf0e10cSrcweir     {
1123cdf0e10cSrcweir         maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
1124cdf0e10cSrcweir         maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) );
1125cdf0e10cSrcweir         maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Window" ) ) );
1126cdf0e10cSrcweir         maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Shell" ) ) );
1127cdf0e10cSrcweir         mnErrorOff = 0;
1128cdf0e10cSrcweir     }
1129cdf0e10cSrcweir     else
1130cdf0e10cSrcweir         mnErrorOff = 4;
1131cdf0e10cSrcweir     maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
1132cdf0e10cSrcweir     maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
1133cdf0e10cSrcweir     maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
1134cdf0e10cSrcweir     maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) ) );
1135cdf0e10cSrcweir     ImplAppendUserDefinedChannels( maErrorBox );
1136cdf0e10cSrcweir     ImplSelectChannel( maErrorBox, pData->nErrorOut, mnErrorOff );
1137cdf0e10cSrcweir     maErrorBox.Show();
1138cdf0e10cSrcweir     maErrorBox.SetPosSizePixel( LogicToPixel( Point( 220, 220 ), aAppMap ),
1139cdf0e10cSrcweir                                 LogicToPixel( Size( 95, 80 ), aAppMap ) );
1140cdf0e10cSrcweir     }
1141cdf0e10cSrcweir 
1142cdf0e10cSrcweir     {
1143cdf0e10cSrcweir     maBox4.Show();
1144cdf0e10cSrcweir     maBox4.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Output" ) ) );
1145cdf0e10cSrcweir     maBox4.SetPosSizePixel( LogicToPixel( Point( 5, 120 ), aAppMap ),
1146cdf0e10cSrcweir                             LogicToPixel( Size( 330, 135 ), aAppMap ) );
1147cdf0e10cSrcweir     }
1148cdf0e10cSrcweir 
1149cdf0e10cSrcweir     {
1150cdf0e10cSrcweir     maOKButton.Show();
1151cdf0e10cSrcweir     maOKButton.SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
1152cdf0e10cSrcweir     maOKButton.SetPosSizePixel( LogicToPixel( Point( 10, 260 ), aAppMap ),
1153cdf0e10cSrcweir                                 LogicToPixel( Size( 50, 15 ), aAppMap ) );
1154cdf0e10cSrcweir     }
1155cdf0e10cSrcweir     {
1156cdf0e10cSrcweir     maCancelButton.Show();
1157cdf0e10cSrcweir     maCancelButton.SetPosSizePixel( LogicToPixel( Point( 70, 260 ), aAppMap ),
1158cdf0e10cSrcweir                                     LogicToPixel( Size( 50, 15 ), aAppMap ) );
1159cdf0e10cSrcweir     }
1160cdf0e10cSrcweir     {
1161cdf0e10cSrcweir     maInfoButton.Show();
1162cdf0e10cSrcweir     maInfoButton.SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
1163cdf0e10cSrcweir     maInfoButton.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Info..." ) ) );
1164cdf0e10cSrcweir     maInfoButton.SetPosSizePixel( LogicToPixel( Point( 130, 260 ), aAppMap ),
1165cdf0e10cSrcweir                                   LogicToPixel( Size( 50, 15 ), aAppMap ) );
1166cdf0e10cSrcweir     }
1167cdf0e10cSrcweir     {
1168cdf0e10cSrcweir     maHelpButton.Show();
1169cdf0e10cSrcweir     maHelpButton.SetPosSizePixel( LogicToPixel( Point( 190, 260 ), aAppMap ),
1170cdf0e10cSrcweir                                   LogicToPixel( Size( 50, 15 ), aAppMap ) );
1171cdf0e10cSrcweir     }
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir     {
1174cdf0e10cSrcweir     SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL Debug Options" ) ) );
1175cdf0e10cSrcweir     SetOutputSizePixel( LogicToPixel( Size( 340, 280 ), aAppMap ) );
1176cdf0e10cSrcweir     }
1177cdf0e10cSrcweir }
1178cdf0e10cSrcweir 
1179cdf0e10cSrcweir // -----------------------------------------------------------------------
1180cdf0e10cSrcweir 
IMPL_LINK(DbgDialog,ClickHdl,Button *,pButton)1181cdf0e10cSrcweir IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
1182cdf0e10cSrcweir {
1183cdf0e10cSrcweir     if ( pButton == &maOKButton )
1184cdf0e10cSrcweir     {
1185cdf0e10cSrcweir         DbgData aData;
1186cdf0e10cSrcweir 
1187cdf0e10cSrcweir         memcpy( &aData, DbgGetData(), sizeof( DbgData ) );
1188cdf0e10cSrcweir         aData.nTestFlags = 0;
1189cdf0e10cSrcweir 
1190cdf0e10cSrcweir         aData.nTraceOut   = ImplGetChannelId( maTraceBox, 0 );
1191cdf0e10cSrcweir         aData.nWarningOut = ImplGetChannelId( maWarningBox, 0 );
1192cdf0e10cSrcweir         aData.nErrorOut   = ImplGetChannelId( maErrorBox, mnErrorOff );
1193cdf0e10cSrcweir 
1194cdf0e10cSrcweir         strncpy( aData.aDebugName, ByteString( maDebugName.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aDebugName ) );
1195cdf0e10cSrcweir         strncpy( aData.aInclClassFilter, ByteString( maInclClassFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aInclClassFilter ) );
1196cdf0e10cSrcweir         strncpy( aData.aExclClassFilter, ByteString( maExclClassFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aExclClassFilter ) );
1197cdf0e10cSrcweir         strncpy( aData.aInclFilter, ByteString( maInclFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aInclFilter ) );
1198cdf0e10cSrcweir         strncpy( aData.aExclFilter, ByteString( maExclFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aExclFilter ) );
1199cdf0e10cSrcweir         aData.aDebugName[sizeof( aData.aDebugName )-1] = '\0';
1200cdf0e10cSrcweir         aData.aInclClassFilter[sizeof( aData.aInclClassFilter )-1] = '\0';
1201cdf0e10cSrcweir         aData.aExclClassFilter[sizeof( aData.aExclClassFilter )-1] = '\0';
1202cdf0e10cSrcweir         aData.aInclFilter[sizeof( aData.aInclFilter )-1] = '\0';
1203cdf0e10cSrcweir         aData.aExclFilter[sizeof( aData.aExclFilter )-1] = '\0';
1204cdf0e10cSrcweir 
1205cdf0e10cSrcweir         aData.bOverwrite = maOverwrite.IsChecked() ? sal_True : sal_False;
1206cdf0e10cSrcweir         aData.bHookOSLAssert = maHookOSLBox.IsChecked() ? sal_True : sal_False;
1207cdf0e10cSrcweir 
1208cdf0e10cSrcweir         if ( maXtorThis.IsChecked() )
1209cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_XTOR_THIS;
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir         if ( maXtorFunc.IsChecked() )
1212cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_XTOR_FUNC;
1213cdf0e10cSrcweir 
1214cdf0e10cSrcweir         if ( maXtorExit.IsChecked() )
1215cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_XTOR_EXIT;
1216cdf0e10cSrcweir 
1217cdf0e10cSrcweir         if ( maXtorReport.IsChecked() )
1218cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_XTOR_REPORT;
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir         if ( maXtorTrace.IsChecked() )
1221cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_XTOR_TRACE;
1222cdf0e10cSrcweir 
1223cdf0e10cSrcweir         if ( maMemInit.IsChecked() )
1224cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_MEM_INIT;
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir         if ( maMemOverwrite.IsChecked() )
1227cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_MEM_OVERWRITE;
1228cdf0e10cSrcweir 
1229cdf0e10cSrcweir         if ( maMemOverwriteFree.IsChecked() )
1230cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_MEM_OVERWRITEFREE;
1231cdf0e10cSrcweir 
1232cdf0e10cSrcweir         if ( maMemPtr.IsChecked() )
1233cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_MEM_POINTER;
1234cdf0e10cSrcweir 
1235cdf0e10cSrcweir         if ( maMemReport.IsChecked() )
1236cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_MEM_REPORT;
1237cdf0e10cSrcweir 
1238cdf0e10cSrcweir         if ( maMemTrace.IsChecked() )
1239cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_MEM_TRACE;
1240cdf0e10cSrcweir 
1241cdf0e10cSrcweir         if ( maMemLeakReport.IsChecked() )
1242cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_MEM_LEAKREPORT;
1243cdf0e10cSrcweir 
1244cdf0e10cSrcweir         if ( maMemNewDel.IsChecked() )
1245cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_MEM_NEWDEL;
1246cdf0e10cSrcweir 
1247cdf0e10cSrcweir         if ( maMemXtor.IsChecked() )
1248cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_MEM_XTOR;
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir         if ( maProf.IsChecked() )
1251cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_PROFILING;
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir         if ( maRes.IsChecked() )
1254cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_RESOURCE;
1255cdf0e10cSrcweir 
1256cdf0e10cSrcweir         if ( maDialog.IsChecked() )
1257cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_DIALOG;
1258cdf0e10cSrcweir 
1259cdf0e10cSrcweir         if ( maBoldAppFont.IsChecked() )
1260cdf0e10cSrcweir             aData.nTestFlags |= DBG_TEST_BOLDAPPFONT;
1261cdf0e10cSrcweir 
1262cdf0e10cSrcweir         // Daten speichern
1263cdf0e10cSrcweir         DbgSaveData( aData );
1264cdf0e10cSrcweir 
1265cdf0e10cSrcweir         // Umschalten der Laufzeitwerte
1266cdf0e10cSrcweir         DBG_INSTOUTTRACE( aData.nTraceOut );
1267cdf0e10cSrcweir         DBG_INSTOUTWARNING( aData.nWarningOut );
1268cdf0e10cSrcweir         DBG_INSTOUTERROR( aData.nErrorOut );
1269cdf0e10cSrcweir         DbgUpdateOslHook( &aData );
1270cdf0e10cSrcweir 
1271cdf0e10cSrcweir         DbgData* pData = DbgGetData();
1272cdf0e10cSrcweir         #define IMMEDIATE_FLAGS (DBG_TEST_MEM_INIT | DBG_TEST_RESOURCE | DBG_TEST_DIALOG | DBG_TEST_BOLDAPPFONT)
1273cdf0e10cSrcweir         pData->nTestFlags &= ~IMMEDIATE_FLAGS;
1274cdf0e10cSrcweir         pData->nTestFlags |= aData.nTestFlags & IMMEDIATE_FLAGS;
1275cdf0e10cSrcweir         strncpy( pData->aInclClassFilter, aData.aInclClassFilter, sizeof( pData->aInclClassFilter ) );
1276cdf0e10cSrcweir         strncpy( pData->aExclClassFilter, aData.aExclClassFilter, sizeof( pData->aExclClassFilter ) );
1277cdf0e10cSrcweir         strncpy( pData->aInclFilter, aData.aInclFilter, sizeof( pData->aInclFilter ) );
1278cdf0e10cSrcweir         strncpy( pData->aExclFilter, aData.aExclFilter, sizeof( pData->aExclFilter ) );
1279cdf0e10cSrcweir         if ( maBoldAppFont.GetSavedValue() != maBoldAppFont.IsChecked() )
1280cdf0e10cSrcweir         {
1281cdf0e10cSrcweir             AllSettings aSettings = Application::GetSettings();
1282cdf0e10cSrcweir             StyleSettings aStyleSettings = aSettings.GetStyleSettings();
1283cdf0e10cSrcweir             Font aFont = aStyleSettings.GetAppFont();
1284cdf0e10cSrcweir             if ( maBoldAppFont.IsChecked() )
1285cdf0e10cSrcweir                 aFont.SetWeight( WEIGHT_BOLD );
1286cdf0e10cSrcweir             else
1287cdf0e10cSrcweir                 aFont.SetWeight( WEIGHT_NORMAL );
1288cdf0e10cSrcweir             aStyleSettings.SetAppFont( aFont );
1289cdf0e10cSrcweir             aSettings.SetStyleSettings( aStyleSettings );
1290cdf0e10cSrcweir             Application::SetSettings( aSettings );
1291cdf0e10cSrcweir         }
1292cdf0e10cSrcweir         if( (aData.nTestFlags & ~IMMEDIATE_FLAGS) != (pData->nTestFlags & ~IMMEDIATE_FLAGS) )
1293cdf0e10cSrcweir         {
1294cdf0e10cSrcweir             InfoBox aBox( this, String( RTL_CONSTASCII_USTRINGPARAM(
1295cdf0e10cSrcweir                 "Some of the changed settings will only be active after "
1296cdf0e10cSrcweir                 "restarting the process"
1297cdf0e10cSrcweir                 ) ) );
1298cdf0e10cSrcweir             aBox.Execute();
1299cdf0e10cSrcweir         }
1300cdf0e10cSrcweir         EndDialog( sal_True );
1301cdf0e10cSrcweir     }
1302cdf0e10cSrcweir     else if ( pButton == &maInfoButton )
1303cdf0e10cSrcweir     {
1304cdf0e10cSrcweir         DbgInfoDialog aInfoDialog( this );
1305cdf0e10cSrcweir         aDbgInfoBuf[0] = '\0';
1306cdf0e10cSrcweir         DbgMemInfo( aDbgInfoBuf );
1307cdf0e10cSrcweir         DbgXtorInfo( aDbgInfoBuf );
1308cdf0e10cSrcweir         XubString aInfoText( aDbgInfoBuf, RTL_TEXTENCODING_UTF8 );
1309cdf0e10cSrcweir         aInfoDialog.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debug InfoReport" ) ) );
1310cdf0e10cSrcweir         aInfoDialog.SetInfoText( aInfoText );
1311cdf0e10cSrcweir         aInfoDialog.Execute();
1312cdf0e10cSrcweir     }
1313cdf0e10cSrcweir 
1314cdf0e10cSrcweir     return 0;
1315cdf0e10cSrcweir }
1316cdf0e10cSrcweir 
1317cdf0e10cSrcweir // -----------------------------------------------------------------------
1318cdf0e10cSrcweir 
RequestHelp(const HelpEvent & rHEvt)1319cdf0e10cSrcweir void DbgDialog::RequestHelp( const HelpEvent& rHEvt )
1320cdf0e10cSrcweir {
1321cdf0e10cSrcweir     if ( rHEvt.GetMode() & HELPMODE_CONTEXT )
1322cdf0e10cSrcweir     {
1323cdf0e10cSrcweir         DbgInfoDialog aInfoDialog( this, sal_True );
1324cdf0e10cSrcweir         XubString aHelpText;
1325cdf0e10cSrcweir         const sal_Char** pHelpStrs = pDbgHelpText;
1326cdf0e10cSrcweir         while ( *pHelpStrs )
1327cdf0e10cSrcweir         {
1328cdf0e10cSrcweir             aHelpText.AppendAscii( *pHelpStrs );
1329cdf0e10cSrcweir             pHelpStrs++;
1330cdf0e10cSrcweir         }
1331cdf0e10cSrcweir         aInfoDialog.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debug Hilfe" ) ) );
1332cdf0e10cSrcweir         aInfoDialog.SetInfoText( aHelpText );
1333cdf0e10cSrcweir         aInfoDialog.Execute();
1334cdf0e10cSrcweir     }
1335cdf0e10cSrcweir }
1336cdf0e10cSrcweir 
1337cdf0e10cSrcweir // =======================================================================
1338cdf0e10cSrcweir 
DbgInfoDialog(Window * pParent,sal_Bool bHelpText)1339cdf0e10cSrcweir DbgInfoDialog::DbgInfoDialog( Window* pParent, sal_Bool bHelpText ) :
1340cdf0e10cSrcweir     ModalDialog( pParent, WB_STDMODAL ),
1341cdf0e10cSrcweir     maListBox( this, WB_BORDER | WB_AUTOHSCROLL ),
1342cdf0e10cSrcweir     maOKButton( this, WB_DEFBUTTON )
1343cdf0e10cSrcweir {
1344cdf0e10cSrcweir     mbHelpText = bHelpText;
1345cdf0e10cSrcweir 
1346cdf0e10cSrcweir     if ( !bHelpText )
1347cdf0e10cSrcweir     {
1348cdf0e10cSrcweir         Font aFont = GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_ENGLISH_US, 0 );
1349cdf0e10cSrcweir         aFont.SetHeight( 8 );
1350cdf0e10cSrcweir         aFont.SetPitch( PITCH_FIXED );
1351cdf0e10cSrcweir         maListBox.SetControlFont( aFont );
1352cdf0e10cSrcweir     }
1353cdf0e10cSrcweir     maListBox.SetPosSizePixel( Point( 5, 5 ), Size( 630, 380 ) );
1354cdf0e10cSrcweir     maListBox.Show();
1355cdf0e10cSrcweir 
1356cdf0e10cSrcweir     maOKButton.SetPosSizePixel( Point( 290, 390 ), Size( 60, 25 ) );
1357cdf0e10cSrcweir     maOKButton.Show();
1358cdf0e10cSrcweir 
1359cdf0e10cSrcweir     SetOutputSizePixel( Size( 640, 420 ) );
1360cdf0e10cSrcweir }
1361cdf0e10cSrcweir 
1362cdf0e10cSrcweir // -----------------------------------------------------------------------
1363cdf0e10cSrcweir 
SetInfoText(const XubString & rStr)1364cdf0e10cSrcweir void DbgInfoDialog::SetInfoText( const XubString& rStr )
1365cdf0e10cSrcweir {
1366cdf0e10cSrcweir     maListBox.SetUpdateMode( sal_False );
1367cdf0e10cSrcweir     maListBox.Clear();
1368cdf0e10cSrcweir     XubString aStr = rStr;
1369cdf0e10cSrcweir     aStr.ConvertLineEnd( LINEEND_LF );
1370cdf0e10cSrcweir     sal_uInt16 nStrIndex = 0;
1371cdf0e10cSrcweir     sal_uInt16 nFoundIndex;
1372cdf0e10cSrcweir     do
1373cdf0e10cSrcweir     {
1374cdf0e10cSrcweir         nFoundIndex = aStr.Search( _LF, nStrIndex );
1375cdf0e10cSrcweir         XubString aTextParagraph = aStr.Copy( nStrIndex, nFoundIndex-nStrIndex );
1376cdf0e10cSrcweir         if ( mbHelpText )
1377cdf0e10cSrcweir         {
1378cdf0e10cSrcweir             long    nMaxWidth = maListBox.GetOutputSizePixel().Width()-30;
1379cdf0e10cSrcweir             sal_uInt16  nLastIndex = 0;
1380cdf0e10cSrcweir             sal_uInt16  nIndex = aTextParagraph.Search( ' ' );
1381cdf0e10cSrcweir             while ( nIndex != STRING_NOTFOUND )
1382cdf0e10cSrcweir             {
1383cdf0e10cSrcweir                 if ( maListBox.GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
1384cdf0e10cSrcweir                 {
1385cdf0e10cSrcweir                     if ( !nLastIndex )
1386cdf0e10cSrcweir                         nLastIndex = nIndex+1;
1387cdf0e10cSrcweir                     XubString aTempStr = aTextParagraph.Copy( 0, nLastIndex );
1388cdf0e10cSrcweir                     aTextParagraph.Erase( 0, nLastIndex );
1389cdf0e10cSrcweir                     maListBox.InsertEntry( aTempStr );
1390cdf0e10cSrcweir                     nLastIndex = 0;
1391cdf0e10cSrcweir                 }
1392cdf0e10cSrcweir                 else
1393cdf0e10cSrcweir                     nLastIndex = nIndex+1;
1394cdf0e10cSrcweir                 nIndex = aTextParagraph.Search( ' ', nLastIndex );
1395cdf0e10cSrcweir             }
1396cdf0e10cSrcweir 
1397cdf0e10cSrcweir             if ( maListBox.GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
1398cdf0e10cSrcweir             {
1399cdf0e10cSrcweir                 if ( !nLastIndex )
1400cdf0e10cSrcweir                     nLastIndex = nIndex+1;
1401cdf0e10cSrcweir                 XubString aTempStr = aTextParagraph.Copy( 0, nLastIndex );
1402cdf0e10cSrcweir                 aTextParagraph.Erase( 0, nLastIndex );
1403cdf0e10cSrcweir                 maListBox.InsertEntry( aTempStr );
1404cdf0e10cSrcweir             }
1405cdf0e10cSrcweir         }
1406cdf0e10cSrcweir         maListBox.InsertEntry( aTextParagraph );
1407cdf0e10cSrcweir         nStrIndex = nFoundIndex+1;
1408cdf0e10cSrcweir     }
1409cdf0e10cSrcweir     while ( nFoundIndex != STRING_NOTFOUND );
1410cdf0e10cSrcweir     maListBox.SetUpdateMode( sal_True );
1411cdf0e10cSrcweir }
1412cdf0e10cSrcweir 
1413cdf0e10cSrcweir // =======================================================================
1414cdf0e10cSrcweir 
DbgDialogTest(Window * pWindow)1415cdf0e10cSrcweir void DbgDialogTest( Window* pWindow )
1416cdf0e10cSrcweir {
1417cdf0e10cSrcweir     sal_Bool        aAccelBuf[65536];
1418cdf0e10cSrcweir     sal_uInt16      nChildCount = pWindow->GetChildCount();
1419cdf0e10cSrcweir     Window*     pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
1420cdf0e10cSrcweir     Window*     pChild;
1421cdf0e10cSrcweir     Point       aTabPos;
1422cdf0e10cSrcweir 
1423cdf0e10cSrcweir     if ( !pGetChild )
1424cdf0e10cSrcweir         return;
1425cdf0e10cSrcweir 
1426cdf0e10cSrcweir     Rectangle*  pRectAry = (Rectangle*)new long[(sizeof(Rectangle)*nChildCount)/sizeof(long)];
1427cdf0e10cSrcweir     memset( aAccelBuf, 0, sizeof( aAccelBuf ) );
1428cdf0e10cSrcweir     memset( pRectAry, 0, sizeof(Rectangle)*nChildCount );
1429cdf0e10cSrcweir 
1430cdf0e10cSrcweir     if ( pWindow->IsDialog() )
1431cdf0e10cSrcweir     {
1432cdf0e10cSrcweir         sal_Bool    bOKCancelButton = sal_False;
1433cdf0e10cSrcweir         sal_Bool    bDefPushButton = sal_False;
1434cdf0e10cSrcweir         sal_Bool    bButton = sal_False;
1435cdf0e10cSrcweir         pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
1436cdf0e10cSrcweir         while ( pGetChild )
1437cdf0e10cSrcweir         {
1438cdf0e10cSrcweir             pChild = pGetChild->ImplGetWindow();
1439cdf0e10cSrcweir 
1440cdf0e10cSrcweir             if ( pChild->ImplIsPushButton() )
1441cdf0e10cSrcweir             {
1442cdf0e10cSrcweir                 bButton = sal_True;
1443cdf0e10cSrcweir                 if ( (pChild->GetType() == WINDOW_OKBUTTON) || (pChild->GetType() == WINDOW_CANCELBUTTON) )
1444cdf0e10cSrcweir                     bOKCancelButton = sal_True;
1445cdf0e10cSrcweir                 if ( pChild->GetStyle() & WB_DEFBUTTON )
1446cdf0e10cSrcweir                     bDefPushButton = sal_True;
1447cdf0e10cSrcweir             }
1448cdf0e10cSrcweir 
1449cdf0e10cSrcweir             pGetChild = pGetChild->GetWindow( WINDOW_NEXT );
1450cdf0e10cSrcweir         }
1451cdf0e10cSrcweir 
1452cdf0e10cSrcweir         if ( bButton )
1453cdf0e10cSrcweir         {
1454cdf0e10cSrcweir             if ( !bOKCancelButton )
1455cdf0e10cSrcweir                 DbgError( "Dialogs should have a OK- or CancelButton" );
1456cdf0e10cSrcweir             if ( !bDefPushButton )
1457cdf0e10cSrcweir                 DbgError( "Dialogs should have a Button with WB_DEFBUTTON" );
1458cdf0e10cSrcweir         }
1459cdf0e10cSrcweir     }
1460cdf0e10cSrcweir 
1461cdf0e10cSrcweir     sal_uInt16 i = 0;
1462cdf0e10cSrcweir     pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
1463cdf0e10cSrcweir     while ( pGetChild )
1464cdf0e10cSrcweir     {
1465cdf0e10cSrcweir         pChild = pGetChild->ImplGetWindow();
1466cdf0e10cSrcweir 
1467cdf0e10cSrcweir         if ( (pChild->GetType() != WINDOW_TABCONTROL) &&
1468cdf0e10cSrcweir              (pChild->GetType() != WINDOW_TABPAGE) &&
1469cdf0e10cSrcweir              (pChild->GetType() != WINDOW_GROUPBOX) )
1470cdf0e10cSrcweir         {
1471cdf0e10cSrcweir             XubString       aText = pChild->GetText();
1472cdf0e10cSrcweir             XubString       aErrorText = aText;
1473cdf0e10cSrcweir             sal_uInt16          nAccelPos = STRING_NOTFOUND;
1474cdf0e10cSrcweir             xub_Unicode     cAccel = 0;
1475cdf0e10cSrcweir             if ( aErrorText.Len() > 128 )
1476cdf0e10cSrcweir             {
1477cdf0e10cSrcweir                 aErrorText.Erase( 128 );
1478cdf0e10cSrcweir                 aErrorText.AppendAscii( "..." );
1479cdf0e10cSrcweir             }
1480cdf0e10cSrcweir             if ( aText.Len() && (aText.Len() < 1024) )
1481cdf0e10cSrcweir             {
1482cdf0e10cSrcweir                 nAccelPos = aText.Search( '~' );
1483cdf0e10cSrcweir                 if ( nAccelPos != STRING_NOTFOUND )
1484cdf0e10cSrcweir                 {
1485cdf0e10cSrcweir                     const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale();
1486cdf0e10cSrcweir                     uno::Reference < i18n::XCharacterClassification > xCharClass = vcl::unohelper::CreateCharacterClassification();
1487cdf0e10cSrcweir                     XubString aUpperText = xCharClass->toUpper( aText, 0, aText.Len(), rLocale );
1488cdf0e10cSrcweir                     cAccel = aUpperText.GetChar( nAccelPos+1 );
1489cdf0e10cSrcweir                     if ( pChild->IsVisible() )
1490cdf0e10cSrcweir                     {
1491cdf0e10cSrcweir                         if ( aAccelBuf[cAccel] )
1492cdf0e10cSrcweir                             DbgOutTypef( DBG_OUT_ERROR, "Double mnemonic char: %c", cAccel );
1493cdf0e10cSrcweir                         else
1494cdf0e10cSrcweir                             aAccelBuf[cAccel] = sal_True;
1495cdf0e10cSrcweir                     }
1496cdf0e10cSrcweir                 }
1497cdf0e10cSrcweir             }
1498cdf0e10cSrcweir 
1499cdf0e10cSrcweir             if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
1500cdf0e10cSrcweir                  (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) ||
1501cdf0e10cSrcweir                  (pChild->GetType() == WINDOW_CHECKBOX) ||
1502cdf0e10cSrcweir                  (pChild->GetType() == WINDOW_TRISTATEBOX) ||
1503cdf0e10cSrcweir                  (pChild->GetType() == WINDOW_PUSHBUTTON) )
1504cdf0e10cSrcweir             {
1505cdf0e10cSrcweir                 if ( aText.Len() && !aText.EqualsAscii( "..." ) )
1506cdf0e10cSrcweir                 {
1507cdf0e10cSrcweir                     const char* pClass;
1508cdf0e10cSrcweir                     if ( pChild->GetType() == WINDOW_RADIOBUTTON )
1509cdf0e10cSrcweir                         pClass = "RadioButton";
1510cdf0e10cSrcweir                     else if ( pChild->GetType() == WINDOW_IMAGERADIOBUTTON )
1511cdf0e10cSrcweir                         pClass = "ImageRadioButton";
1512cdf0e10cSrcweir                     else if ( pChild->GetType() == WINDOW_CHECKBOX )
1513cdf0e10cSrcweir                         pClass = "CheckBox";
1514cdf0e10cSrcweir                     else if ( pChild->GetType() == WINDOW_TRISTATEBOX )
1515cdf0e10cSrcweir                         pClass = "TriStateBox";
1516cdf0e10cSrcweir                     else if ( pChild->GetType() == WINDOW_PUSHBUTTON )
1517cdf0e10cSrcweir                         pClass = "PushButton";
1518cdf0e10cSrcweir                     else
1519cdf0e10cSrcweir                         pClass = "Dontknow";
1520cdf0e10cSrcweir 					if( !cAccel )
1521cdf0e10cSrcweir 						DbgOutTypef( DBG_OUT_ERROR,
1522cdf0e10cSrcweir                                  "%s should have a mnemonic char (~): %s",
1523cdf0e10cSrcweir                                  pClass,
1524cdf0e10cSrcweir                                  ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1525cdf0e10cSrcweir 
1526cdf0e10cSrcweir 					// check text width
1527cdf0e10cSrcweir 					int aWidth=0;
1528cdf0e10cSrcweir 					switch( pChild->GetType() )
1529cdf0e10cSrcweir 					{
1530cdf0e10cSrcweir 						case WINDOW_RADIOBUTTON:
1531cdf0e10cSrcweir 						case WINDOW_IMAGERADIOBUTTON:
1532cdf0e10cSrcweir 							aWidth = ((RadioButton*)pChild)->CalcMinimumSize(0).Width();
1533cdf0e10cSrcweir 							break;
1534cdf0e10cSrcweir 						case WINDOW_CHECKBOX:
1535cdf0e10cSrcweir 						case WINDOW_TRISTATEBOX:
1536cdf0e10cSrcweir 							aWidth = ((CheckBox*)pChild)->CalcMinimumSize(0).Width();
1537cdf0e10cSrcweir 							break;
1538cdf0e10cSrcweir 						case WINDOW_PUSHBUTTON:
1539cdf0e10cSrcweir 							aWidth = ((PushButton*)pChild)->CalcMinimumSize(0).Width();
1540cdf0e10cSrcweir 							break;
1541cdf0e10cSrcweir 						default: break;
1542cdf0e10cSrcweir 					}
1543cdf0e10cSrcweir 					if( pChild->IsVisible() && pChild->GetSizePixel().Width() < aWidth )
1544cdf0e10cSrcweir 						DbgOutTypef( DBG_OUT_ERROR,
1545cdf0e10cSrcweir                                  "%s exceeds window width: %s",
1546cdf0e10cSrcweir                                  pClass,
1547cdf0e10cSrcweir                                  ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1548cdf0e10cSrcweir 				}
1549cdf0e10cSrcweir             }
1550cdf0e10cSrcweir 
1551cdf0e10cSrcweir             if ( pChild->GetType() == WINDOW_FIXEDLINE )
1552cdf0e10cSrcweir 			{
1553cdf0e10cSrcweir 				if ( pChild->GetSizePixel().Width() < pChild->GetTextWidth( aText ) )
1554cdf0e10cSrcweir 					DbgOutTypef( DBG_OUT_ERROR,
1555cdf0e10cSrcweir 								 "FixedLine exceeds window width: %s",
1556cdf0e10cSrcweir 								 ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1557cdf0e10cSrcweir 			}
1558cdf0e10cSrcweir 
1559cdf0e10cSrcweir             if ( pChild->GetType() == WINDOW_FIXEDTEXT )
1560cdf0e10cSrcweir             {
1561cdf0e10cSrcweir                 if ( (pChild->GetSizePixel().Height() >= pChild->GetTextHeight()*2) &&
1562cdf0e10cSrcweir                      !(pChild->GetStyle() & WB_WORDBREAK) )
1563cdf0e10cSrcweir                 {
1564cdf0e10cSrcweir                     DbgOutTypef( DBG_OUT_ERROR,
1565cdf0e10cSrcweir                                  "FixedText greater than one line, but WordBreak is not set: %s",
1566cdf0e10cSrcweir                                  ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1567cdf0e10cSrcweir                 }
1568cdf0e10cSrcweir 
1569cdf0e10cSrcweir                 if ( pChild->IsVisible() )
1570cdf0e10cSrcweir 				{
1571cdf0e10cSrcweir 					int aWidth=0;
1572cdf0e10cSrcweir 					if( nAccelPos != STRING_NOTFOUND )
1573cdf0e10cSrcweir 					{
1574cdf0e10cSrcweir 						aWidth = pChild->GetTextWidth( aText, 0, nAccelPos ) +
1575cdf0e10cSrcweir 								 pChild->GetTextWidth( aText, nAccelPos+1, aText.Len() - nAccelPos - 1);
1576cdf0e10cSrcweir 					}
1577cdf0e10cSrcweir 					else
1578cdf0e10cSrcweir 						aWidth = pChild->GetTextWidth( aText );
1579cdf0e10cSrcweir 
1580cdf0e10cSrcweir 					if ( pChild->GetSizePixel().Width() < aWidth && !(pChild->GetStyle() & WB_WORDBREAK) )
1581cdf0e10cSrcweir 						{
1582cdf0e10cSrcweir 							DbgOutTypef( DBG_OUT_ERROR,
1583cdf0e10cSrcweir 										 "FixedText exceeds window width: %s",
1584cdf0e10cSrcweir 										 ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1585cdf0e10cSrcweir 						}
1586cdf0e10cSrcweir 				}
1587cdf0e10cSrcweir 
1588cdf0e10cSrcweir                 if ( (i+1 < nChildCount) && aText.Len() )
1589cdf0e10cSrcweir                 {
1590cdf0e10cSrcweir                     Window* pTempChild = pGetChild->GetWindow( WINDOW_NEXT )->ImplGetWindow();
1591cdf0e10cSrcweir                     if ( (pTempChild->GetType() == WINDOW_EDIT) ||
1592cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_MULTILINEEDIT) ||
1593cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_SPINFIELD) ||
1594cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_PATTERNFIELD) ||
1595cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_NUMERICFIELD) ||
1596cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_METRICFIELD) ||
1597cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_CURRENCYFIELD) ||
1598cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_DATEFIELD) ||
1599cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_TIMEFIELD) ||
1600cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_LISTBOX) ||
1601cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_MULTILISTBOX) ||
1602cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_COMBOBOX) ||
1603cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_PATTERNBOX) ||
1604cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_NUMERICBOX) ||
1605cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_METRICBOX) ||
1606cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_CURRENCYBOX) ||
1607cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_DATEBOX) ||
1608cdf0e10cSrcweir                          (pTempChild->GetType() == WINDOW_TIMEBOX) )
1609cdf0e10cSrcweir                     {
1610cdf0e10cSrcweir                         if ( !cAccel )
1611cdf0e10cSrcweir                         {
1612cdf0e10cSrcweir                             DbgOutTypef( DBG_OUT_ERROR,
1613cdf0e10cSrcweir                                          "Labels befor Fields (Edit,ListBox,...) should have a mnemonic char (~): %s",
1614cdf0e10cSrcweir                                          ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1615cdf0e10cSrcweir                         }
1616cdf0e10cSrcweir                         if ( !pTempChild->IsEnabled() && pChild->IsEnabled() )
1617cdf0e10cSrcweir                         {
1618cdf0e10cSrcweir                             DbgOutTypef( DBG_OUT_ERROR,
1619cdf0e10cSrcweir                                          "Labels befor Fields (Edit,ListBox,...) should be disabled, when the field is disabled: %s",
1620cdf0e10cSrcweir                                          ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1621cdf0e10cSrcweir                         }
1622cdf0e10cSrcweir                     }
1623cdf0e10cSrcweir                 }
1624cdf0e10cSrcweir             }
1625cdf0e10cSrcweir 
1626cdf0e10cSrcweir             if ( pChild->GetType() == WINDOW_MULTILINEEDIT )
1627cdf0e10cSrcweir             {
1628cdf0e10cSrcweir                 if  (   ( 0 == ( pChild->GetStyle() & WB_IGNORETAB ) )
1629cdf0e10cSrcweir                     &&  ( 0 == ( pChild->GetStyle() & WB_READONLY ) )
1630cdf0e10cSrcweir                     )
1631cdf0e10cSrcweir                 {
1632cdf0e10cSrcweir                     DbgError( "editable MultiLineEdits in Dialogs should have the Style WB_IGNORETAB" );
1633cdf0e10cSrcweir                 }
1634cdf0e10cSrcweir             }
1635cdf0e10cSrcweir 
1636cdf0e10cSrcweir             if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
1637cdf0e10cSrcweir                  (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) ||
1638cdf0e10cSrcweir                  (pChild->GetType() == WINDOW_CHECKBOX) ||
1639cdf0e10cSrcweir                  (pChild->GetType() == WINDOW_TRISTATEBOX) ||
1640cdf0e10cSrcweir                  (pChild->GetType() == WINDOW_FIXEDTEXT) )
1641cdf0e10cSrcweir             {
1642cdf0e10cSrcweir                 pChild->SetBackground( Wallpaper( Color( COL_LIGHTGREEN ) ) );
1643cdf0e10cSrcweir             }
1644cdf0e10cSrcweir 
1645cdf0e10cSrcweir             if ( pChild->IsVisible() )
1646cdf0e10cSrcweir             {
1647cdf0e10cSrcweir                 sal_Bool bMaxWarning = sal_False;
1648cdf0e10cSrcweir                 if ( pChild->GetType() == WINDOW_NUMERICFIELD )
1649cdf0e10cSrcweir                 {
1650cdf0e10cSrcweir                     NumericField* pField = (NumericField*)pChild;
1651cdf0e10cSrcweir                     if ( pField->GetMax() == LONG_MAX )
1652cdf0e10cSrcweir                         bMaxWarning = sal_True;
1653cdf0e10cSrcweir                 }
1654cdf0e10cSrcweir                 else if ( pChild->GetType() == WINDOW_METRICFIELD )
1655cdf0e10cSrcweir                 {
1656cdf0e10cSrcweir                     MetricField* pField = (MetricField*)pChild;
1657cdf0e10cSrcweir                     if ( pField->GetMax() == LONG_MAX )
1658cdf0e10cSrcweir                         bMaxWarning = sal_True;
1659cdf0e10cSrcweir                 }
1660cdf0e10cSrcweir                 else if ( pChild->GetType() == WINDOW_CURRENCYFIELD )
1661cdf0e10cSrcweir                 {
1662cdf0e10cSrcweir                     CurrencyField* pField = (CurrencyField*)pChild;
1663cdf0e10cSrcweir                     if ( pField->GetMax() == LONG_MAX )
1664cdf0e10cSrcweir                         bMaxWarning = sal_True;
1665cdf0e10cSrcweir                 }
1666cdf0e10cSrcweir                 else if ( pChild->GetType() == WINDOW_TIMEFIELD )
1667cdf0e10cSrcweir                 {
1668cdf0e10cSrcweir                     TimeField* pField = (TimeField*)pChild;
1669cdf0e10cSrcweir                     if ( pField->GetMax() == Time( 23, 59, 59, 99 ) )
1670cdf0e10cSrcweir                         bMaxWarning = sal_True;
1671cdf0e10cSrcweir                 }
1672cdf0e10cSrcweir                 else if ( pChild->GetType() == WINDOW_DATEFIELD )
1673cdf0e10cSrcweir                 {
1674cdf0e10cSrcweir                     DateField* pField = (DateField*)pChild;
1675cdf0e10cSrcweir                     if ( pField->GetMax() == Date( 31, 12, 9999 ) )
1676cdf0e10cSrcweir                         bMaxWarning = sal_True;
1677cdf0e10cSrcweir                 }
1678cdf0e10cSrcweir                 else if ( pChild->GetType() == WINDOW_NUMERICBOX )
1679cdf0e10cSrcweir                 {
1680cdf0e10cSrcweir                     NumericBox* pBox = (NumericBox*)pChild;
1681cdf0e10cSrcweir                     if ( pBox->GetMax() == LONG_MAX )
1682cdf0e10cSrcweir                         bMaxWarning = sal_True;
1683cdf0e10cSrcweir                 }
1684cdf0e10cSrcweir                 else if ( pChild->GetType() == WINDOW_METRICBOX )
1685cdf0e10cSrcweir                 {
1686cdf0e10cSrcweir                     MetricBox* pBox = (MetricBox*)pChild;
1687cdf0e10cSrcweir                     if ( pBox->GetMax() == LONG_MAX )
1688cdf0e10cSrcweir                         bMaxWarning = sal_True;
1689cdf0e10cSrcweir                 }
1690cdf0e10cSrcweir                 else if ( pChild->GetType() == WINDOW_CURRENCYBOX )
1691cdf0e10cSrcweir                 {
1692cdf0e10cSrcweir                     CurrencyBox* pBox = (CurrencyBox*)pChild;
1693cdf0e10cSrcweir                     if ( pBox->GetMax() == LONG_MAX )
1694cdf0e10cSrcweir                         bMaxWarning = sal_True;
1695cdf0e10cSrcweir                 }
1696cdf0e10cSrcweir                 else if ( pChild->GetType() == WINDOW_TIMEBOX )
1697cdf0e10cSrcweir                 {
1698cdf0e10cSrcweir                     TimeBox* pBox = (TimeBox*)pChild;
1699cdf0e10cSrcweir                     if ( pBox->GetMax() == Time( 23, 59, 59, 99 ) )
1700cdf0e10cSrcweir                         bMaxWarning = sal_True;
1701cdf0e10cSrcweir                 }
1702cdf0e10cSrcweir                 else if ( pChild->GetType() == WINDOW_DATEBOX )
1703cdf0e10cSrcweir                 {
1704cdf0e10cSrcweir                     DateBox* pBox = (DateBox*)pChild;
1705cdf0e10cSrcweir                     if ( pBox->GetMax() == Date( 31, 12, 9999 ) )
1706cdf0e10cSrcweir                         bMaxWarning = sal_True;
1707cdf0e10cSrcweir                 }
1708cdf0e10cSrcweir                 if ( bMaxWarning )
1709cdf0e10cSrcweir                 {
1710cdf0e10cSrcweir                     DbgOutTypef( DBG_OUT_ERROR,
1711cdf0e10cSrcweir                                  "No Max-Value is set: %s",
1712cdf0e10cSrcweir                                  ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1713cdf0e10cSrcweir                 }
1714cdf0e10cSrcweir 
1715cdf0e10cSrcweir                 if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
1716cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) ||
1717cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_CHECKBOX) ||
1718cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_TRISTATEBOX) ||
1719cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_PUSHBUTTON) ||
1720cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_OKBUTTON) ||
1721cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_CANCELBUTTON) ||
1722cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_HELPBUTTON) ||
1723cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_IMAGEBUTTON) ||
1724cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_FIXEDTEXT) ||
1725cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_EDIT) ||
1726cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_MULTILINEEDIT) ||
1727cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_SPINFIELD) ||
1728cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_PATTERNFIELD) ||
1729cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_NUMERICFIELD) ||
1730cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_METRICFIELD) ||
1731cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_CURRENCYFIELD) ||
1732cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_DATEFIELD) ||
1733cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_TIMEFIELD) ||
1734cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_LISTBOX) ||
1735cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_MULTILISTBOX) ||
1736cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_COMBOBOX) ||
1737cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_PATTERNBOX) ||
1738cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_NUMERICBOX) ||
1739cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_METRICBOX) ||
1740cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_CURRENCYBOX) ||
1741cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_DATEBOX) ||
1742cdf0e10cSrcweir                      (pChild->GetType() == WINDOW_TIMEBOX) )
1743cdf0e10cSrcweir                 {
1744cdf0e10cSrcweir                     Point       aNewPos = pChild->GetPosPixel();
1745cdf0e10cSrcweir                     Rectangle   aChildRect( aNewPos, pChild->GetSizePixel() );
1746cdf0e10cSrcweir 
1747cdf0e10cSrcweir                     if ( cAccel || (pChild->GetStyle() & WB_TABSTOP) ||
1748cdf0e10cSrcweir                          (pChild->GetType() == WINDOW_RADIOBUTTON) ||
1749cdf0e10cSrcweir                          (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) )
1750cdf0e10cSrcweir                     {
1751cdf0e10cSrcweir                         if ( (aNewPos.X() <= aTabPos.X()) && (aNewPos.Y() <= aTabPos.Y()) )
1752cdf0e10cSrcweir                         {
1753cdf0e10cSrcweir                             DbgOutTypef( DBG_OUT_ERROR,
1754cdf0e10cSrcweir                                          "Possible wrong childorder for dialogcontrol: %s",
1755cdf0e10cSrcweir                                          ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1756cdf0e10cSrcweir                         }
1757cdf0e10cSrcweir                         aTabPos = aNewPos;
1758cdf0e10cSrcweir                     }
1759cdf0e10cSrcweir 
1760cdf0e10cSrcweir                     for ( sal_uInt16 j = 0; j < i; j++ )
1761cdf0e10cSrcweir                     {
1762cdf0e10cSrcweir                         if ( ((pRectAry[j].Right() != 0) || (pRectAry[j].Bottom() != 0)) &&
1763cdf0e10cSrcweir                              aChildRect.IsOver( pRectAry[j] ) )
1764cdf0e10cSrcweir                         {
1765cdf0e10cSrcweir                             DbgOutTypef( DBG_OUT_ERROR,
1766cdf0e10cSrcweir                                          "Window overlaps with sibling window: %s",
1767cdf0e10cSrcweir                                          ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
1768cdf0e10cSrcweir                         }
1769cdf0e10cSrcweir                     }
1770cdf0e10cSrcweir                     pRectAry[i] = aChildRect;
1771cdf0e10cSrcweir                 }
1772cdf0e10cSrcweir             }
1773cdf0e10cSrcweir         }
1774cdf0e10cSrcweir 
1775cdf0e10cSrcweir         pGetChild = pGetChild->GetWindow( WINDOW_NEXT );
1776cdf0e10cSrcweir         i++;
1777cdf0e10cSrcweir     }
1778cdf0e10cSrcweir 
1779cdf0e10cSrcweir     delete [] pRectAry;
1780cdf0e10cSrcweir }
1781cdf0e10cSrcweir 
1782cdf0e10cSrcweir // =======================================================================
1783cdf0e10cSrcweir #ifndef WNT
1784cdf0e10cSrcweir #define USE_VCL_MSGBOX
1785cdf0e10cSrcweir #define COPY_BUTTON_ID 25
1786cdf0e10cSrcweir 
1787cdf0e10cSrcweir class DbgMessageBox : public ErrorBox
1788cdf0e10cSrcweir {
1789cdf0e10cSrcweir     String m_aMessage;
1790cdf0e10cSrcweir     public:
DbgMessageBox(const String & rMessage)1791cdf0e10cSrcweir     DbgMessageBox( const String& rMessage ) :
1792cdf0e10cSrcweir        ErrorBox( NULL, WB_YES_NO_CANCEL | WB_DEF_NO, rMessage ),
1793cdf0e10cSrcweir        m_aMessage( rMessage )
1794cdf0e10cSrcweir     {
1795cdf0e10cSrcweir         SetText( String( RTL_CONSTASCII_USTRINGPARAM("Debug Output") ) );
1796cdf0e10cSrcweir         AddButton( String( RTL_CONSTASCII_USTRINGPARAM( "Copy" ) ), COPY_BUTTON_ID, 0 );
1797cdf0e10cSrcweir     }
1798cdf0e10cSrcweir 
Click()1799cdf0e10cSrcweir     virtual void Click()
1800cdf0e10cSrcweir     {
1801cdf0e10cSrcweir         if( GetCurButtonId() == COPY_BUTTON_ID )
1802cdf0e10cSrcweir             vcl::unohelper::TextDataObject::CopyStringTo( m_aMessage, GetClipboard() );
1803cdf0e10cSrcweir         else
1804cdf0e10cSrcweir             ErrorBox::Click();
1805cdf0e10cSrcweir     }
1806cdf0e10cSrcweir };
1807cdf0e10cSrcweir 
1808cdf0e10cSrcweir #endif
1809cdf0e10cSrcweir 
1810cdf0e10cSrcweir class SolarMessageBoxExecutor : public ::vcl::SolarThreadExecutor
1811cdf0e10cSrcweir {
1812cdf0e10cSrcweir private:
1813cdf0e10cSrcweir     String  m_sDebugMessage;
1814cdf0e10cSrcweir 
1815cdf0e10cSrcweir public:
SolarMessageBoxExecutor(const String & _rDebugMessage)1816cdf0e10cSrcweir     SolarMessageBoxExecutor( const String& _rDebugMessage )
1817cdf0e10cSrcweir         :m_sDebugMessage( _rDebugMessage )
1818cdf0e10cSrcweir     {
1819cdf0e10cSrcweir     }
1820cdf0e10cSrcweir 
1821cdf0e10cSrcweir protected:
1822cdf0e10cSrcweir     virtual long doIt();
1823cdf0e10cSrcweir };
1824cdf0e10cSrcweir 
doIt()1825cdf0e10cSrcweir long SolarMessageBoxExecutor::doIt()
1826cdf0e10cSrcweir {
1827cdf0e10cSrcweir     long nResult = RET_NO;
1828cdf0e10cSrcweir 
1829cdf0e10cSrcweir     // Tracking beenden und Mouse freigeben, damit die Boxen nicht haengen
1830cdf0e10cSrcweir     ImplSVData* pSVData = ImplGetSVData();
1831cdf0e10cSrcweir     if ( pSVData->maWinData.mpTrackWin )
1832cdf0e10cSrcweir         pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
1833cdf0e10cSrcweir     if ( pSVData->maWinData.mpCaptureWin )
1834cdf0e10cSrcweir         pSVData->maWinData.mpCaptureWin->ReleaseMouse();
1835cdf0e10cSrcweir 
1836cdf0e10cSrcweir #if ! defined USE_VCL_MSGBOX
1837cdf0e10cSrcweir #ifdef WNT
1838cdf0e10cSrcweir     sal_Bool bOldCallTimer = pSVData->mbNoCallTimer;
1839cdf0e10cSrcweir     pSVData->mbNoCallTimer = sal_True;
1840cdf0e10cSrcweir     MessageBeep( MB_ICONHAND );
1841cdf0e10cSrcweir     nResult = MessageBoxW( 0, (LPWSTR)m_sDebugMessage.GetBuffer(), L"Debug Output",
1842cdf0e10cSrcweir                                      MB_TASKMODAL | MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONSTOP );
1843cdf0e10cSrcweir     pSVData->mbNoCallTimer = bOldCallTimer;
1844cdf0e10cSrcweir     switch ( nResult )
1845cdf0e10cSrcweir     {
1846cdf0e10cSrcweir         case IDYES:
1847cdf0e10cSrcweir             nResult = RET_YES;
1848cdf0e10cSrcweir             break;
1849cdf0e10cSrcweir         case IDNO:
1850cdf0e10cSrcweir             nResult = RET_NO;
1851cdf0e10cSrcweir             break;
1852cdf0e10cSrcweir         case IDCANCEL:
1853cdf0e10cSrcweir             nResult = RET_CANCEL;
1854cdf0e10cSrcweir             break;
1855cdf0e10cSrcweir     }
1856cdf0e10cSrcweir #endif // WNT
1857cdf0e10cSrcweir #else
1858cdf0e10cSrcweir     sal_uInt16 nOldMode = Application::GetSystemWindowMode();
1859cdf0e10cSrcweir     Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE );
1860cdf0e10cSrcweir     DbgMessageBox aBox( m_sDebugMessage );
1861cdf0e10cSrcweir     Application::SetSystemWindowMode( nOldMode );
1862cdf0e10cSrcweir     nResult = aBox.Execute();
1863cdf0e10cSrcweir #endif
1864cdf0e10cSrcweir 
1865cdf0e10cSrcweir     return nResult;
1866cdf0e10cSrcweir }
1867cdf0e10cSrcweir 
DbgPrintMsgBox(const char * pLine)1868cdf0e10cSrcweir void DbgPrintMsgBox( const char* pLine )
1869cdf0e10cSrcweir {
1870cdf0e10cSrcweir     // are modal message boxes prohibited at the moment?
1871cdf0e10cSrcweir     if ( Application::IsDialogCancelEnabled() )
1872cdf0e10cSrcweir     {
1873cdf0e10cSrcweir #if defined( WNT )
1874cdf0e10cSrcweir         // TODO: Shouldn't this be a IsDebuggerPresent()?
1875cdf0e10cSrcweir         if ( GetSystemMetrics( SM_DEBUG ) )
1876cdf0e10cSrcweir         {
1877cdf0e10cSrcweir             MessageBeep( MB_ICONHAND );
1878cdf0e10cSrcweir             strcpy( aDbgOutBuf, pLine );
1879cdf0e10cSrcweir             strcat( aDbgOutBuf, "\r\n" );
1880cdf0e10cSrcweir             OutputDebugString( aDbgOutBuf );
1881cdf0e10cSrcweir             return;
1882cdf0e10cSrcweir         }
1883cdf0e10cSrcweir #endif
1884cdf0e10cSrcweir 
1885cdf0e10cSrcweir         Sound::Beep( SOUND_ERROR );
1886cdf0e10cSrcweir #ifdef UNX
1887cdf0e10cSrcweir         fprintf( stderr, "%s\n", pLine );
1888cdf0e10cSrcweir         return;
1889cdf0e10cSrcweir #else
1890cdf0e10cSrcweir         DbgPrintFile( pLine );
1891cdf0e10cSrcweir         return;
1892cdf0e10cSrcweir #endif
1893cdf0e10cSrcweir     }
1894cdf0e10cSrcweir 
1895cdf0e10cSrcweir     strcpy( aDbgOutBuf, pLine );
1896cdf0e10cSrcweir     strcat( aDbgOutBuf, "\nAbort ? (Yes=abort / No=ignore / Cancel=core dump)" );
1897cdf0e10cSrcweir 
1898cdf0e10cSrcweir     SolarMessageBoxExecutor aMessageBox( String( aDbgOutBuf, RTL_TEXTENCODING_UTF8 ) );
1899cdf0e10cSrcweir     TimeValue aTimeout; aTimeout.Seconds = 2; aTimeout.Nanosec = 0;
1900cdf0e10cSrcweir     long nResult = aMessageBox.execute( aTimeout );
1901cdf0e10cSrcweir 
1902cdf0e10cSrcweir     if ( aMessageBox.didTimeout() )
1903cdf0e10cSrcweir         DbgPrintShell( pLine );
1904cdf0e10cSrcweir     else if ( nResult == RET_YES )
1905cdf0e10cSrcweir         GetpApp()->Abort( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debug-Utilities-Error" ) ) );
1906cdf0e10cSrcweir     else if ( nResult == RET_CANCEL )
1907cdf0e10cSrcweir         DbgCoreDump();
1908cdf0e10cSrcweir }
1909cdf0e10cSrcweir 
1910cdf0e10cSrcweir // -----------------------------------------------------------------------
1911cdf0e10cSrcweir 
1912cdf0e10cSrcweir class SolarWindowPrinter : public ::vcl::SolarThreadExecutor
1913cdf0e10cSrcweir {
1914cdf0e10cSrcweir private:
1915cdf0e10cSrcweir     String  m_sDebugMessage;
1916cdf0e10cSrcweir 
1917cdf0e10cSrcweir public:
SolarWindowPrinter(const String & _rDebugMessage)1918cdf0e10cSrcweir     SolarWindowPrinter( const String& _rDebugMessage )
1919cdf0e10cSrcweir         :m_sDebugMessage( _rDebugMessage )
1920cdf0e10cSrcweir     {
1921cdf0e10cSrcweir     }
1922cdf0e10cSrcweir 
1923cdf0e10cSrcweir protected:
1924cdf0e10cSrcweir     virtual long doIt();
1925cdf0e10cSrcweir };
1926cdf0e10cSrcweir 
doIt()1927cdf0e10cSrcweir long SolarWindowPrinter::doIt()
1928cdf0e10cSrcweir {
1929cdf0e10cSrcweir     DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin;
1930cdf0e10cSrcweir     if ( !pDbgWindow )
1931cdf0e10cSrcweir     {
1932cdf0e10cSrcweir         pDbgWindow = new DbgWindow;
1933cdf0e10cSrcweir         ImplGetSVData()->maWinData.mpDbgWin = pDbgWindow;
1934cdf0e10cSrcweir     }
1935cdf0e10cSrcweir     pDbgWindow->InsertLine( m_sDebugMessage );
1936cdf0e10cSrcweir 
1937cdf0e10cSrcweir     return 0L;
1938cdf0e10cSrcweir }
1939cdf0e10cSrcweir 
1940cdf0e10cSrcweir // -----------------------------------------------------------------------
1941cdf0e10cSrcweir 
DbgPrintWindow(const char * pLine)1942cdf0e10cSrcweir void DbgPrintWindow( const char* pLine )
1943cdf0e10cSrcweir {
1944cdf0e10cSrcweir     static sal_Bool bIn = sal_False;
1945cdf0e10cSrcweir 
1946cdf0e10cSrcweir     // keine rekursiven Traces
1947cdf0e10cSrcweir     if ( bIn )
1948cdf0e10cSrcweir         return;
1949cdf0e10cSrcweir     bIn = sal_True;
1950cdf0e10cSrcweir 
1951cdf0e10cSrcweir     SolarWindowPrinter aPrinter( String( pLine, RTL_TEXTENCODING_UTF8 ) );
1952cdf0e10cSrcweir     TimeValue aTimeout; aTimeout.Seconds = 2; aTimeout.Nanosec = 0;
1953cdf0e10cSrcweir     aPrinter.execute( aTimeout );
1954cdf0e10cSrcweir 
1955cdf0e10cSrcweir     if ( aPrinter.didTimeout() )
1956cdf0e10cSrcweir         DbgPrintShell( pLine );
1957cdf0e10cSrcweir 
1958cdf0e10cSrcweir     bIn = sal_False;
1959cdf0e10cSrcweir }
1960cdf0e10cSrcweir 
1961cdf0e10cSrcweir // -----------------------------------------------------------------------
1962cdf0e10cSrcweir 
DbgAbort(char const * i_message)1963cdf0e10cSrcweir void DbgAbort( char const * i_message )
1964cdf0e10cSrcweir {
1965cdf0e10cSrcweir     ::rtl::OUString const message( i_message, strlen( i_message ), osl_getThreadTextEncoding() );
1966cdf0e10cSrcweir     Application::Abort( message );
1967cdf0e10cSrcweir }
1968cdf0e10cSrcweir 
1969cdf0e10cSrcweir // =======================================================================
1970cdf0e10cSrcweir 
ImplDbgTestSolarMutex()1971cdf0e10cSrcweir void ImplDbgTestSolarMutex()
1972cdf0e10cSrcweir {
1973cdf0e10cSrcweir     bool bCheck = ImplGetSVData()->mpDefInst->CheckYieldMutex();
1974cdf0e10cSrcweir     OSL_ENSURE( bCheck, "SolarMutex not locked" );
1975cdf0e10cSrcweir }
1976cdf0e10cSrcweir 
1977cdf0e10cSrcweir // =======================================================================
1978cdf0e10cSrcweir 
DbgGUIInit()1979cdf0e10cSrcweir void DbgGUIInit()
1980cdf0e10cSrcweir {
1981cdf0e10cSrcweir     DbgSetPrintMsgBox( DbgPrintMsgBox );
1982cdf0e10cSrcweir     DbgSetPrintWindow( DbgPrintWindow );
1983cdf0e10cSrcweir     DbgSetTestSolarMutex( ImplDbgTestSolarMutex );
1984cdf0e10cSrcweir     DbgSetAbort( DbgAbort );
1985cdf0e10cSrcweir }
1986cdf0e10cSrcweir 
1987cdf0e10cSrcweir // -----------------------------------------------------------------------
1988cdf0e10cSrcweir 
DbgGUIDeInit()1989cdf0e10cSrcweir void DbgGUIDeInit()
1990cdf0e10cSrcweir {
1991cdf0e10cSrcweir     DbgSetPrintMsgBox( NULL );
1992cdf0e10cSrcweir     DbgSetPrintWindow( NULL );
1993cdf0e10cSrcweir     DbgSetTestSolarMutex( NULL );
1994cdf0e10cSrcweir     DbgSetAbort( NULL );
1995cdf0e10cSrcweir 
1996cdf0e10cSrcweir     DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin;
1997cdf0e10cSrcweir     if ( pDbgWindow )
1998cdf0e10cSrcweir         delete pDbgWindow;
1999cdf0e10cSrcweir }
2000cdf0e10cSrcweir 
2001cdf0e10cSrcweir // -----------------------------------------------------------------------
2002cdf0e10cSrcweir 
DbgGUIStart()2003cdf0e10cSrcweir void DbgGUIStart()
2004cdf0e10cSrcweir {
2005cdf0e10cSrcweir     DbgData* pData = DbgGetData();
2006cdf0e10cSrcweir 
2007cdf0e10cSrcweir     if ( pData )
2008cdf0e10cSrcweir     {
2009cdf0e10cSrcweir         DbgDialog* pDialog = new DbgDialog;
2010cdf0e10cSrcweir         // Fuer den Debug-Dialog schalten wir Dialogtests aus
2011cdf0e10cSrcweir         sal_uLong nOldFlags = pData->nTestFlags;
2012cdf0e10cSrcweir         pData->nTestFlags &= ~DBG_TEST_DIALOG;
2013cdf0e10cSrcweir         if ( !pDialog->Execute() )
2014cdf0e10cSrcweir             pData->nTestFlags |= (nOldFlags & DBG_TEST_DIALOG);
2015cdf0e10cSrcweir         delete pDialog;
2016cdf0e10cSrcweir     }
2017cdf0e10cSrcweir     else
2018cdf0e10cSrcweir     {
2019cdf0e10cSrcweir         ErrorBox( 0, WB_OK,
2020cdf0e10cSrcweir                   XubString( RTL_CONSTASCII_USTRINGPARAM( "TOOLS Library has no Debug-Routines" ) ) ).Execute();
2021cdf0e10cSrcweir     }
2022cdf0e10cSrcweir }
2023cdf0e10cSrcweir 
2024cdf0e10cSrcweir // -----------------------------------------------------------------------
2025cdf0e10cSrcweir 
DbgRegisterNamedUserChannel(const XubString & _rChannelUIName,DbgPrintLine pProc)2026cdf0e10cSrcweir sal_uInt16 DbgRegisterNamedUserChannel( const XubString& _rChannelUIName, DbgPrintLine pProc )
2027cdf0e10cSrcweir {
2028cdf0e10cSrcweir     DbgChannelId nChannelId = DbgRegisterUserChannel( pProc );
2029cdf0e10cSrcweir     UserDefinedChannels& rChannels = ImplDbgGetUserDefinedChannels();
2030cdf0e10cSrcweir     rChannels[ _rChannelUIName ] = nChannelId;
2031cdf0e10cSrcweir     return nChannelId;
2032cdf0e10cSrcweir }
2033cdf0e10cSrcweir 
2034cdf0e10cSrcweir #endif // DBG_UTIL
2035