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