1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sw.hxx" 30 #ifdef DEBUG 31 32 #include <tools/string.hxx> 33 #include <svl/poolitem.hxx> 34 #include <svl/itemiter.hxx> 35 #include <string> 36 #include <map> 37 #include <node.hxx> 38 #include <ndtxt.hxx> 39 #include <ndhints.hxx> 40 #include <txatbase.hxx> 41 #include <pam.hxx> 42 #include <docary.hxx> 43 #include <swundo.hxx> 44 #include <undobj.hxx> 45 #include <numrule.hxx> 46 #include <doc.hxx> 47 #include <frmfmt.hxx> 48 #include <fmtanchr.hxx> 49 #include <swrect.hxx> 50 #include <ndarr.hxx> 51 #include <paratr.hxx> 52 #include <SwNodeNum.hxx> 53 #include <dbgoutsw.hxx> 54 #include <SwRewriter.hxx> 55 #include <iostream> 56 #include <cstdio> 57 58 using namespace std; 59 60 static ByteString aDbgOutResult; 61 bool bDbgOutStdErr = false; 62 bool bDbgOutPrintAttrSet = false; 63 64 char* db_pretty_print(const String* str, int flags, char* fmt) 65 { 66 (void) fmt; 67 (void) flags; 68 return const_cast<char*>(dbg_out(*str)); 69 } 70 71 template<class T> 72 String lcl_dbg_out_SvPtrArr(const T & rArr) 73 { 74 String aStr("[ ", RTL_TEXTENCODING_ASCII_US); 75 76 for (sal_Int16 n = 0; n < rArr.Count(); n++) 77 { 78 if (n > 0) 79 aStr += String(", ", RTL_TEXTENCODING_ASCII_US); 80 81 if (rArr[n]) 82 aStr += lcl_dbg_out(*rArr[n]); 83 else 84 aStr += String("(null)", RTL_TEXTENCODING_ASCII_US); 85 } 86 87 aStr += String(" ]", RTL_TEXTENCODING_ASCII_US); 88 89 return aStr; 90 } 91 92 SW_DLLPUBLIC const char * dbg_out(const void * pVoid) 93 { 94 char sBuffer[1024]; 95 96 sprintf(sBuffer, "%p", pVoid); 97 98 String aTmpStr(sBuffer, RTL_TEXTENCODING_ASCII_US); 99 100 return dbg_out(aTmpStr); 101 } 102 103 SW_DLLPUBLIC const char * dbg_out(const String & aStr) 104 { 105 aDbgOutResult = ByteString(aStr, RTL_TEXTENCODING_ASCII_US); 106 107 if (bDbgOutStdErr) 108 fprintf(stderr, "%s", aDbgOutResult.GetBuffer()); 109 110 return aDbgOutResult.GetBuffer(); 111 } 112 113 SW_DLLPUBLIC const char * dbg_out(const ::rtl::OUString & aStr) 114 { 115 return OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US).getStr(); 116 } 117 118 119 struct CompareUShort 120 { 121 bool operator()(sal_uInt16 a, sal_uInt16 b) const 122 { 123 return a < b; 124 } 125 }; 126 127 map<sal_uInt16,String,CompareUShort> & GetItemWhichMap() 128 { 129 static map<sal_uInt16,String,CompareUShort> aItemWhichMap; 130 static bool bInitialized = false; 131 132 if (! bInitialized) 133 { 134 aItemWhichMap[RES_CHRATR_CASEMAP] = String("CHRATR_CASEMAP", RTL_TEXTENCODING_ASCII_US); 135 aItemWhichMap[RES_CHRATR_CHARSETCOLOR] = String("CHRATR_CHARSETCOLOR", RTL_TEXTENCODING_ASCII_US); 136 aItemWhichMap[RES_CHRATR_COLOR] = String("CHRATR_COLOR", RTL_TEXTENCODING_ASCII_US); 137 aItemWhichMap[RES_CHRATR_CONTOUR] = String("CHRATR_CONTOUR", RTL_TEXTENCODING_ASCII_US); 138 aItemWhichMap[RES_CHRATR_CROSSEDOUT] = String("CHRATR_CROSSEDOUT", RTL_TEXTENCODING_ASCII_US); 139 aItemWhichMap[RES_CHRATR_ESCAPEMENT] = String("CHRATR_ESCAPEMENT", RTL_TEXTENCODING_ASCII_US); 140 aItemWhichMap[RES_CHRATR_FONT] = String("CHRATR_FONT", RTL_TEXTENCODING_ASCII_US); 141 aItemWhichMap[RES_CHRATR_FONTSIZE] = String("CHRATR_FONTSIZE", RTL_TEXTENCODING_ASCII_US); 142 aItemWhichMap[RES_CHRATR_KERNING] = String("CHRATR_KERNING", RTL_TEXTENCODING_ASCII_US); 143 aItemWhichMap[RES_CHRATR_LANGUAGE] = String("CHRATR_LANGUAGE", RTL_TEXTENCODING_ASCII_US); 144 aItemWhichMap[RES_CHRATR_POSTURE] = String("CHRATR_POSTURE", RTL_TEXTENCODING_ASCII_US); 145 aItemWhichMap[RES_CHRATR_PROPORTIONALFONTSIZE] = String("CHRATR_PROPORTIONALFONTSIZE", RTL_TEXTENCODING_ASCII_US); 146 aItemWhichMap[RES_CHRATR_SHADOWED] = String("CHRATR_SHADOWED", RTL_TEXTENCODING_ASCII_US); 147 aItemWhichMap[RES_CHRATR_UNDERLINE] = String("CHRATR_UNDERLINE", RTL_TEXTENCODING_ASCII_US); 148 aItemWhichMap[RES_CHRATR_OVERLINE] = String("CHRATR_OVERLINE", RTL_TEXTENCODING_ASCII_US); 149 aItemWhichMap[RES_CHRATR_WEIGHT] = String("CHRATR_WEIGHT", RTL_TEXTENCODING_ASCII_US); 150 aItemWhichMap[RES_CHRATR_WORDLINEMODE] = String("CHRATR_WORDLINEMODE", RTL_TEXTENCODING_ASCII_US); 151 aItemWhichMap[RES_CHRATR_AUTOKERN] = String("CHRATR_AUTOKERN", RTL_TEXTENCODING_ASCII_US); 152 aItemWhichMap[RES_CHRATR_BLINK] = String("CHRATR_BLINK", RTL_TEXTENCODING_ASCII_US); 153 aItemWhichMap[RES_CHRATR_NOHYPHEN] = String("CHRATR_NOHYPHEN", RTL_TEXTENCODING_ASCII_US); 154 aItemWhichMap[RES_CHRATR_NOLINEBREAK] = String("CHRATR_NOLINEBREAK", RTL_TEXTENCODING_ASCII_US); 155 aItemWhichMap[RES_CHRATR_BACKGROUND] = String("CHRATR_BACKGROUND", RTL_TEXTENCODING_ASCII_US); 156 aItemWhichMap[RES_CHRATR_CJK_FONT] = String("CHRATR_CJK_FONT", RTL_TEXTENCODING_ASCII_US); 157 aItemWhichMap[RES_CHRATR_CJK_FONTSIZE] = String("CHRATR_CJK_FONTSIZE", RTL_TEXTENCODING_ASCII_US); 158 aItemWhichMap[RES_CHRATR_CJK_LANGUAGE] = String("CHRATR_CJK_LANGUAGE", RTL_TEXTENCODING_ASCII_US); 159 aItemWhichMap[RES_CHRATR_CJK_POSTURE] = String("CHRATR_CJK_POSTURE", RTL_TEXTENCODING_ASCII_US); 160 aItemWhichMap[RES_CHRATR_CJK_WEIGHT] = String("CHRATR_CJK_WEIGHT", RTL_TEXTENCODING_ASCII_US); 161 aItemWhichMap[RES_CHRATR_CTL_FONT] = String("CHRATR_CTL_FONT", RTL_TEXTENCODING_ASCII_US); 162 aItemWhichMap[RES_CHRATR_CTL_FONTSIZE] = String("CHRATR_CTL_FONTSIZE", RTL_TEXTENCODING_ASCII_US); 163 aItemWhichMap[RES_CHRATR_CTL_LANGUAGE] = String("CHRATR_CTL_LANGUAGE", RTL_TEXTENCODING_ASCII_US); 164 aItemWhichMap[RES_CHRATR_CTL_POSTURE] = String("CHRATR_CTL_POSTURE", RTL_TEXTENCODING_ASCII_US); 165 aItemWhichMap[RES_CHRATR_CTL_WEIGHT] = String("CHRATR_CTL_WEIGHT", RTL_TEXTENCODING_ASCII_US); 166 aItemWhichMap[RES_CHRATR_ROTATE] = String("CHRATR_ROTATE", RTL_TEXTENCODING_ASCII_US); 167 aItemWhichMap[RES_CHRATR_EMPHASIS_MARK] = String("CHRATR_EMPHASIS_MARK", RTL_TEXTENCODING_ASCII_US); 168 aItemWhichMap[RES_CHRATR_TWO_LINES] = String("CHRATR_TWO_LINES", RTL_TEXTENCODING_ASCII_US); 169 aItemWhichMap[RES_CHRATR_SCALEW] = String("CHRATR_SCALEW", RTL_TEXTENCODING_ASCII_US); 170 aItemWhichMap[RES_CHRATR_RELIEF] = String("CHRATR_RELIEF", RTL_TEXTENCODING_ASCII_US); 171 aItemWhichMap[RES_CHRATR_HIDDEN] = String("CHRATR_HIDDEN", RTL_TEXTENCODING_ASCII_US); 172 aItemWhichMap[RES_TXTATR_AUTOFMT] = String("TXTATR_AUTOFMT", RTL_TEXTENCODING_ASCII_US); 173 aItemWhichMap[RES_TXTATR_INETFMT] = String("TXTATR_INETFMT", RTL_TEXTENCODING_ASCII_US); 174 aItemWhichMap[RES_TXTATR_REFMARK] = String("TXTATR_REFMARK", RTL_TEXTENCODING_ASCII_US); 175 aItemWhichMap[RES_TXTATR_TOXMARK] = String("TXTATR_TOXMARK", RTL_TEXTENCODING_ASCII_US); 176 aItemWhichMap[RES_TXTATR_CHARFMT] = String("TXTATR_CHARFMT", RTL_TEXTENCODING_ASCII_US); 177 aItemWhichMap[RES_TXTATR_DUMMY5] = String("TXTATR_DUMMY5", RTL_TEXTENCODING_ASCII_US); 178 aItemWhichMap[RES_TXTATR_CJK_RUBY] = String("TXTATR_CJK_RUBY", RTL_TEXTENCODING_ASCII_US); 179 aItemWhichMap[RES_TXTATR_UNKNOWN_CONTAINER] = String("TXTATR_UNKNOWN_CONTAINER", RTL_TEXTENCODING_ASCII_US); 180 aItemWhichMap[RES_TXTATR_META] = String("TXTATR_META", RTL_TEXTENCODING_ASCII_US); 181 aItemWhichMap[RES_TXTATR_METAFIELD] = String("TXTATR_METAFIELD", RTL_TEXTENCODING_ASCII_US); 182 aItemWhichMap[RES_TXTATR_FIELD] = String("TXTATR_FIELD", RTL_TEXTENCODING_ASCII_US); 183 aItemWhichMap[RES_TXTATR_FLYCNT] = String("TXTATR_FLYCNT", RTL_TEXTENCODING_ASCII_US); 184 aItemWhichMap[RES_TXTATR_FTN] = String("TXTATR_FTN", RTL_TEXTENCODING_ASCII_US); 185 aItemWhichMap[RES_TXTATR_DUMMY4] = String("TXTATR_DUMMY4", RTL_TEXTENCODING_ASCII_US); 186 aItemWhichMap[RES_TXTATR_DUMMY3] = String("TXTATR_DUMMY3", RTL_TEXTENCODING_ASCII_US); 187 aItemWhichMap[RES_TXTATR_DUMMY1] = String("TXTATR_DUMMY1", RTL_TEXTENCODING_ASCII_US); 188 aItemWhichMap[RES_TXTATR_DUMMY2] = String("TXTATR_DUMMY2", RTL_TEXTENCODING_ASCII_US); 189 aItemWhichMap[RES_PARATR_LINESPACING] = String("PARATR_LINESPACING", RTL_TEXTENCODING_ASCII_US); 190 aItemWhichMap[RES_PARATR_ADJUST] = String("PARATR_ADJUST", RTL_TEXTENCODING_ASCII_US); 191 aItemWhichMap[RES_PARATR_SPLIT] = String("PARATR_SPLIT", RTL_TEXTENCODING_ASCII_US); 192 aItemWhichMap[RES_PARATR_ORPHANS] = String("PARATR_ORPHANS", RTL_TEXTENCODING_ASCII_US); 193 aItemWhichMap[RES_PARATR_WIDOWS] = String("PARATR_WIDOWS", RTL_TEXTENCODING_ASCII_US); 194 aItemWhichMap[RES_PARATR_TABSTOP] = String("PARATR_TABSTOP", RTL_TEXTENCODING_ASCII_US); 195 aItemWhichMap[RES_PARATR_HYPHENZONE] = String("PARATR_HYPHENZONE", RTL_TEXTENCODING_ASCII_US); 196 aItemWhichMap[RES_PARATR_DROP] = String("PARATR_DROP", RTL_TEXTENCODING_ASCII_US); 197 aItemWhichMap[RES_PARATR_REGISTER] = String("PARATR_REGISTER", RTL_TEXTENCODING_ASCII_US); 198 aItemWhichMap[RES_PARATR_NUMRULE] = String("PARATR_NUMRULE", RTL_TEXTENCODING_ASCII_US); 199 aItemWhichMap[RES_PARATR_SCRIPTSPACE] = String("PARATR_SCRIPTSPACE", RTL_TEXTENCODING_ASCII_US); 200 aItemWhichMap[RES_PARATR_HANGINGPUNCTUATION] = String("PARATR_HANGINGPUNCTUATION", RTL_TEXTENCODING_ASCII_US); 201 aItemWhichMap[RES_PARATR_FORBIDDEN_RULES] = String("PARATR_FORBIDDEN_RULES", RTL_TEXTENCODING_ASCII_US); 202 aItemWhichMap[RES_PARATR_VERTALIGN] = String("PARATR_VERTALIGN", RTL_TEXTENCODING_ASCII_US); 203 aItemWhichMap[RES_PARATR_SNAPTOGRID] = String("PARATR_SNAPTOGRID", RTL_TEXTENCODING_ASCII_US); 204 aItemWhichMap[RES_PARATR_CONNECT_BORDER] = String("PARATR_CONNECT_BORDER", RTL_TEXTENCODING_ASCII_US); 205 aItemWhichMap[RES_FILL_ORDER] = String("FILL_ORDER", RTL_TEXTENCODING_ASCII_US); 206 aItemWhichMap[RES_FRM_SIZE] = String("FRM_SIZE", RTL_TEXTENCODING_ASCII_US); 207 aItemWhichMap[RES_PAPER_BIN] = String("PAPER_BIN", RTL_TEXTENCODING_ASCII_US); 208 aItemWhichMap[RES_LR_SPACE] = String("LR_SPACE", RTL_TEXTENCODING_ASCII_US); 209 aItemWhichMap[RES_UL_SPACE] = String("UL_SPACE", RTL_TEXTENCODING_ASCII_US); 210 aItemWhichMap[RES_PAGEDESC] = String("PAGEDESC", RTL_TEXTENCODING_ASCII_US); 211 aItemWhichMap[RES_BREAK] = String("BREAK", RTL_TEXTENCODING_ASCII_US); 212 aItemWhichMap[RES_CNTNT] = String("CNTNT", RTL_TEXTENCODING_ASCII_US); 213 aItemWhichMap[RES_HEADER] = String("HEADER", RTL_TEXTENCODING_ASCII_US); 214 aItemWhichMap[RES_FOOTER] = String("FOOTER", RTL_TEXTENCODING_ASCII_US); 215 aItemWhichMap[RES_PRINT] = String("PRINT", RTL_TEXTENCODING_ASCII_US); 216 aItemWhichMap[RES_OPAQUE] = String("OPAQUE", RTL_TEXTENCODING_ASCII_US); 217 aItemWhichMap[RES_PROTECT] = String("PROTECT", RTL_TEXTENCODING_ASCII_US); 218 aItemWhichMap[RES_SURROUND] = String("SURROUND", RTL_TEXTENCODING_ASCII_US); 219 aItemWhichMap[RES_VERT_ORIENT] = String("VERT_ORIENT", RTL_TEXTENCODING_ASCII_US); 220 aItemWhichMap[RES_HORI_ORIENT] = String("HORI_ORIENT", RTL_TEXTENCODING_ASCII_US); 221 aItemWhichMap[RES_ANCHOR] = String("ANCHOR", RTL_TEXTENCODING_ASCII_US); 222 aItemWhichMap[RES_BACKGROUND] = String("BACKGROUND", RTL_TEXTENCODING_ASCII_US); 223 aItemWhichMap[RES_BOX] = String("BOX", RTL_TEXTENCODING_ASCII_US); 224 aItemWhichMap[RES_SHADOW] = String("SHADOW", RTL_TEXTENCODING_ASCII_US); 225 aItemWhichMap[RES_FRMMACRO] = String("FRMMACRO", RTL_TEXTENCODING_ASCII_US); 226 aItemWhichMap[RES_COL] = String("COL", RTL_TEXTENCODING_ASCII_US); 227 aItemWhichMap[RES_KEEP] = String("KEEP", RTL_TEXTENCODING_ASCII_US); 228 aItemWhichMap[RES_URL] = String("URL", RTL_TEXTENCODING_ASCII_US); 229 aItemWhichMap[RES_EDIT_IN_READONLY] = String("EDIT_IN_READONLY", RTL_TEXTENCODING_ASCII_US); 230 aItemWhichMap[RES_LAYOUT_SPLIT] = String("LAYOUT_SPLIT", RTL_TEXTENCODING_ASCII_US); 231 aItemWhichMap[RES_CHAIN] = String("CHAIN", RTL_TEXTENCODING_ASCII_US); 232 aItemWhichMap[RES_TEXTGRID] = String("TEXTGRID", RTL_TEXTENCODING_ASCII_US); 233 aItemWhichMap[RES_LINENUMBER ] = String("LINENUMBER ", RTL_TEXTENCODING_ASCII_US); 234 aItemWhichMap[RES_FTN_AT_TXTEND] = String("FTN_AT_TXTEND", RTL_TEXTENCODING_ASCII_US); 235 aItemWhichMap[RES_END_AT_TXTEND] = String("END_AT_TXTEND", RTL_TEXTENCODING_ASCII_US); 236 aItemWhichMap[RES_COLUMNBALANCE] = String("COLUMNBALANCE", RTL_TEXTENCODING_ASCII_US); 237 aItemWhichMap[RES_FRAMEDIR] = String("FRAMEDIR", RTL_TEXTENCODING_ASCII_US); 238 aItemWhichMap[RES_HEADER_FOOTER_EAT_SPACING] = String("HEADER_FOOTER_EAT_SPACING", RTL_TEXTENCODING_ASCII_US); 239 aItemWhichMap[RES_ROW_SPLIT] = String("ROW_SPLIT", RTL_TEXTENCODING_ASCII_US); 240 aItemWhichMap[RES_GRFATR_MIRRORGRF] = String("GRFATR_MIRRORGRF", RTL_TEXTENCODING_ASCII_US); 241 aItemWhichMap[RES_GRFATR_CROPGRF] = String("GRFATR_CROPGRF", RTL_TEXTENCODING_ASCII_US); 242 aItemWhichMap[RES_GRFATR_ROTATION] = String("GRFATR_ROTATION", RTL_TEXTENCODING_ASCII_US); 243 aItemWhichMap[RES_GRFATR_LUMINANCE] = String("GRFATR_LUMINANCE", RTL_TEXTENCODING_ASCII_US); 244 aItemWhichMap[RES_GRFATR_CONTRAST] = String("GRFATR_CONTRAST", RTL_TEXTENCODING_ASCII_US); 245 aItemWhichMap[RES_GRFATR_CHANNELR] = String("GRFATR_CHANNELR", RTL_TEXTENCODING_ASCII_US); 246 aItemWhichMap[RES_GRFATR_CHANNELG] = String("GRFATR_CHANNELG", RTL_TEXTENCODING_ASCII_US); 247 aItemWhichMap[RES_GRFATR_CHANNELB] = String("GRFATR_CHANNELB", RTL_TEXTENCODING_ASCII_US); 248 aItemWhichMap[RES_GRFATR_GAMMA] = String("GRFATR_GAMMA", RTL_TEXTENCODING_ASCII_US); 249 aItemWhichMap[RES_GRFATR_INVERT] = String("GRFATR_INVERT", RTL_TEXTENCODING_ASCII_US); 250 aItemWhichMap[RES_GRFATR_TRANSPARENCY] = String("GRFATR_TRANSPARENCY", RTL_TEXTENCODING_ASCII_US); 251 aItemWhichMap[RES_GRFATR_DRAWMODE] = String("GRFATR_DRAWMODE", RTL_TEXTENCODING_ASCII_US); 252 aItemWhichMap[RES_BOXATR_FORMAT] = String("BOXATR_FORMAT", RTL_TEXTENCODING_ASCII_US); 253 aItemWhichMap[RES_BOXATR_FORMULA] = String("BOXATR_FORMULA", RTL_TEXTENCODING_ASCII_US); 254 aItemWhichMap[RES_BOXATR_VALUE] = String("BOXATR_VALUE", RTL_TEXTENCODING_ASCII_US); 255 256 bInitialized = true; 257 } 258 259 return aItemWhichMap; 260 } 261 262 const String lcl_dbg_out(const SfxPoolItem & rItem) 263 { 264 String aStr("[ ", RTL_TEXTENCODING_ASCII_US); 265 266 if (GetItemWhichMap().find(rItem.Which()) != GetItemWhichMap().end()) 267 aStr += GetItemWhichMap()[rItem.Which()]; 268 else 269 aStr += String::CreateFromInt32(rItem.Which()); 270 271 aStr += String(" ]", RTL_TEXTENCODING_ASCII_US); 272 273 return aStr; 274 } 275 276 SW_DLLPUBLIC const char * dbg_out(const SfxPoolItem & rItem) 277 { 278 return dbg_out(lcl_dbg_out(rItem)); 279 } 280 281 SW_DLLPUBLIC const char * dbg_out(const SfxPoolItem * pItem) 282 { 283 return dbg_out(pItem ? lcl_dbg_out(*pItem) : 284 String("(nil)", RTL_TEXTENCODING_ASCII_US)); 285 } 286 287 SW_DLLPUBLIC const String lcl_dbg_out(const SfxItemSet & rSet) 288 { 289 SfxItemIter aIter(rSet); 290 const SfxPoolItem * pItem; 291 bool bFirst = true; 292 String aStr = String("[ ", RTL_TEXTENCODING_ASCII_US); 293 294 pItem = aIter.FirstItem(); 295 296 while (pItem ) 297 { 298 if (!bFirst) 299 aStr += String(", ", RTL_TEXTENCODING_ASCII_US); 300 301 if ((sal_uIntPtr)pItem != SAL_MAX_SIZE) 302 aStr += lcl_dbg_out(*pItem); 303 else 304 aStr += String("invalid", RTL_TEXTENCODING_ASCII_US); 305 306 bFirst = false; 307 308 pItem = aIter.NextItem(); 309 } 310 311 aStr += String(" ]", RTL_TEXTENCODING_ASCII_US); 312 313 return aStr; 314 } 315 316 SW_DLLPUBLIC const char * dbg_out(const SfxItemSet & rSet) 317 { 318 return dbg_out(lcl_dbg_out(rSet)); 319 } 320 321 const String lcl_dbg_out(const SwTxtAttr & rAttr) 322 { 323 String aStr("[ ", RTL_TEXTENCODING_ASCII_US); 324 325 aStr += String::CreateFromInt32(*rAttr.GetStart()); 326 aStr += String("->", RTL_TEXTENCODING_ASCII_US); 327 aStr += String::CreateFromInt32(*rAttr.GetEnd()); 328 aStr += String(" ", RTL_TEXTENCODING_ASCII_US); 329 aStr += lcl_dbg_out(rAttr.GetAttr()); 330 331 aStr += String(" ]", RTL_TEXTENCODING_ASCII_US); 332 333 return aStr; 334 } 335 336 SW_DLLPUBLIC const char * dbg_out(const SwTxtAttr & rAttr) 337 { 338 return dbg_out(lcl_dbg_out(rAttr)); 339 } 340 341 const String lcl_dbg_out(const SwpHints & rHints) 342 { 343 String aStr("[ SwpHints\n", RTL_TEXTENCODING_ASCII_US); 344 345 for (sal_uInt16 i = 0; i < rHints.Count(); i++) 346 { 347 aStr += String(" ", RTL_TEXTENCODING_ASCII_US); 348 aStr += lcl_dbg_out(*rHints[i]); 349 aStr += String("\n", RTL_TEXTENCODING_ASCII_US); 350 } 351 352 aStr += String("]\n", RTL_TEXTENCODING_ASCII_US); 353 354 return aStr; 355 } 356 357 SW_DLLPUBLIC const char * dbg_out(const SwpHints &rHints) 358 { 359 return dbg_out(lcl_dbg_out(rHints)); 360 } 361 362 String lcl_dbg_out(const SwPosition & rPos) 363 { 364 String aStr("( ", RTL_TEXTENCODING_ASCII_US); 365 366 aStr += String::CreateFromInt32(rPos.nNode.GetIndex()); 367 aStr += String(", ", RTL_TEXTENCODING_ASCII_US); 368 aStr += String::CreateFromInt32(rPos.nContent.GetIndex()); 369 aStr += String(": ", RTL_TEXTENCODING_ASCII_US); 370 aStr += String::CreateFromInt32 371 (reinterpret_cast<sal_IntPtr>(rPos.nContent.GetIdxReg()), 16); 372 373 aStr += String(" )", RTL_TEXTENCODING_ASCII_US); 374 375 return aStr; 376 } 377 378 SW_DLLPUBLIC const char * dbg_out(const SwPosition & rPos) 379 { 380 return dbg_out(lcl_dbg_out(rPos)); 381 } 382 383 String lcl_dbg_out(const SwPaM & rPam) 384 { 385 String aStr("[ Pt: ", RTL_TEXTENCODING_ASCII_US); 386 387 aStr += lcl_dbg_out(*rPam.GetPoint()); 388 389 if (rPam.HasMark()) 390 { 391 aStr += String(", Mk: ", RTL_TEXTENCODING_ASCII_US); 392 aStr += lcl_dbg_out(*rPam.GetMark()); 393 } 394 395 aStr += String(" ]", RTL_TEXTENCODING_ASCII_US); 396 397 return aStr; 398 } 399 400 SW_DLLPUBLIC const char * dbg_out(const SwPaM & rPam) 401 { 402 return dbg_out(lcl_dbg_out(rPam)); 403 } 404 405 String lcl_dbg_out(const SwNodeNum & ) 406 { 407 return String();/*rNum.ToString();*/ 408 } 409 410 SW_DLLPUBLIC const char * dbg_out(const SwNodeNum & rNum) 411 { 412 return dbg_out(lcl_dbg_out(rNum)); 413 } 414 415 String lcl_dbg_out(const SwRect & rRect) 416 { 417 String aResult("[ [", RTL_TEXTENCODING_ASCII_US); 418 419 aResult += String::CreateFromInt32(rRect.Left()); 420 aResult += String(", ", RTL_TEXTENCODING_ASCII_US); 421 aResult += String::CreateFromInt32(rRect.Top()); 422 aResult += String("], [", RTL_TEXTENCODING_ASCII_US); 423 aResult += String::CreateFromInt32(rRect.Right()); 424 aResult += String(", ", RTL_TEXTENCODING_ASCII_US); 425 aResult += String::CreateFromInt32(rRect.Bottom()); 426 427 aResult += String("] ]", RTL_TEXTENCODING_ASCII_US); 428 429 return aResult; 430 } 431 432 SW_DLLPUBLIC const char * dbg_out(const SwRect & rRect) 433 { 434 return dbg_out(lcl_dbg_out(rRect)); 435 } 436 437 String lcl_dbg_out(const SwFrmFmt & rFrmFmt) 438 { 439 String aResult("[ ", RTL_TEXTENCODING_ASCII_US); 440 441 char sBuffer[256]; 442 sprintf(sBuffer, "%p", &rFrmFmt); 443 444 aResult += String(sBuffer, RTL_TEXTENCODING_ASCII_US); 445 aResult += String("(", RTL_TEXTENCODING_ASCII_US); 446 aResult += rFrmFmt.GetName(); 447 aResult += String(")", RTL_TEXTENCODING_ASCII_US); 448 449 if (rFrmFmt.IsAuto()) 450 aResult += String("*", RTL_TEXTENCODING_ASCII_US); 451 452 aResult += String(" ,", RTL_TEXTENCODING_ASCII_US); 453 aResult += lcl_dbg_out(rFrmFmt.FindLayoutRect()); 454 aResult += String(" ]", RTL_TEXTENCODING_ASCII_US); 455 456 return aResult; 457 } 458 459 SW_DLLPUBLIC const char * dbg_out(const SwFrmFmt & rFrmFmt) 460 { 461 return dbg_out(lcl_dbg_out(rFrmFmt)); 462 } 463 464 const String lcl_AnchoredFrames(const SwNode & rNode) 465 { 466 String aResult("[", RTL_TEXTENCODING_ASCII_US); 467 468 const SwDoc * pDoc = rNode.GetDoc(); 469 if (pDoc) 470 { 471 const SwSpzFrmFmts * pFrmFmts = pDoc->GetSpzFrmFmts(); 472 473 if (pFrmFmts) 474 { 475 bool bFirst = true; 476 for (sal_uInt16 nI = 0; nI < pFrmFmts->Count(); nI++) 477 { 478 const SwFmtAnchor & rAnchor = (*pFrmFmts)[nI]->GetAnchor(); 479 const SwPosition * pPos = rAnchor.GetCntntAnchor(); 480 481 if (pPos && &pPos->nNode.GetNode() == &rNode) 482 { 483 if (! bFirst) 484 aResult += String(", ", RTL_TEXTENCODING_ASCII_US); 485 486 if ((*pFrmFmts)[nI]) 487 aResult += lcl_dbg_out(*(*pFrmFmts)[nI]); 488 bFirst = false; 489 } 490 } 491 } 492 } 493 494 aResult += String("]", RTL_TEXTENCODING_ASCII_US); 495 496 return aResult; 497 } 498 499 String lcl_dbg_out_NumType(sal_Int16 nType) 500 { 501 String aTmpStr; 502 503 switch (nType) 504 { 505 case SVX_NUM_NUMBER_NONE: 506 aTmpStr += String(" NONE", RTL_TEXTENCODING_ASCII_US); 507 508 break; 509 case SVX_NUM_CHARS_UPPER_LETTER: 510 aTmpStr += String(" CHARS_UPPER_LETTER", 511 RTL_TEXTENCODING_ASCII_US); 512 513 break; 514 case SVX_NUM_CHARS_LOWER_LETTER: 515 aTmpStr += String(" CHARS_LOWER_LETTER", 516 RTL_TEXTENCODING_ASCII_US); 517 518 break; 519 case SVX_NUM_ROMAN_UPPER: 520 aTmpStr += String(" ROMAN_UPPER", 521 RTL_TEXTENCODING_ASCII_US); 522 523 break; 524 case SVX_NUM_ROMAN_LOWER: 525 aTmpStr += String(" ROMAN_LOWER", 526 RTL_TEXTENCODING_ASCII_US); 527 528 break; 529 case SVX_NUM_ARABIC: 530 aTmpStr += String(" ARABIC", 531 RTL_TEXTENCODING_ASCII_US); 532 533 break; 534 default: 535 aTmpStr += String(" ??", 536 RTL_TEXTENCODING_ASCII_US); 537 538 break; 539 } 540 541 return aTmpStr; 542 } 543 544 String lcl_dbg_out(const SwNode & rNode) 545 { 546 String aTmpStr; 547 548 aTmpStr += String("<node ", RTL_TEXTENCODING_ASCII_US); 549 aTmpStr += String("index=\"", RTL_TEXTENCODING_ASCII_US); 550 aTmpStr += String::CreateFromInt32(rNode.GetIndex()); 551 aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US); 552 553 #ifdef DBG_UTIL 554 aTmpStr += String(" serial=\"", RTL_TEXTENCODING_ASCII_US); 555 aTmpStr += String::CreateFromInt32(rNode.GetSerial()); 556 aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US); 557 #endif 558 559 aTmpStr += String(" type=\"", RTL_TEXTENCODING_ASCII_US); 560 aTmpStr += String::CreateFromInt32(sal_Int32( rNode.GetNodeType() ) ); 561 aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US); 562 563 aTmpStr += String(" pointer=\"", RTL_TEXTENCODING_ASCII_US); 564 565 char aBuffer[128]; 566 sprintf(aBuffer, "%p", &rNode); 567 aTmpStr += String(aBuffer, RTL_TEXTENCODING_ASCII_US); 568 569 aTmpStr += String("\">", RTL_TEXTENCODING_ASCII_US); 570 571 const SwTxtNode * pTxtNode = rNode.GetTxtNode(); 572 573 if (rNode.IsTxtNode()) 574 { 575 const SfxItemSet * pAttrSet = pTxtNode->GetpSwAttrSet(); 576 577 aTmpStr += String("<txt>", RTL_TEXTENCODING_ASCII_US); 578 aTmpStr += pTxtNode->GetTxt().Copy(0, 10); 579 aTmpStr += String("</txt>", RTL_TEXTENCODING_ASCII_US); 580 581 if (rNode.IsTableNode()) 582 aTmpStr += String("<tbl/>", RTL_TEXTENCODING_ASCII_US); 583 584 aTmpStr += String("<outlinelevel>", RTL_TEXTENCODING_ASCII_US); 585 aTmpStr += String::CreateFromInt32(pTxtNode->GetAttrOutlineLevel()-1); 586 aTmpStr += String("</outlinelevel>", RTL_TEXTENCODING_ASCII_US); 587 588 const SwNumRule * pNumRule = pTxtNode->GetNumRule(); 589 590 if (pNumRule != NULL) 591 { 592 aTmpStr += String("<number>", RTL_TEXTENCODING_ASCII_US); 593 if ( pTxtNode->GetNum() ) 594 { 595 aTmpStr += lcl_dbg_out(*(pTxtNode->GetNum())); 596 } 597 aTmpStr += String("</number>", RTL_TEXTENCODING_ASCII_US); 598 599 aTmpStr += String("<rule>", RTL_TEXTENCODING_ASCII_US); 600 aTmpStr += pNumRule->GetName(); 601 602 const SfxPoolItem * pItem = NULL; 603 604 if (pAttrSet && SFX_ITEM_SET == 605 pAttrSet->GetItemState(RES_PARATR_NUMRULE, sal_False, &pItem)) 606 { 607 aTmpStr += String("(", RTL_TEXTENCODING_ASCII_US); 608 aTmpStr += 609 static_cast<const SwNumRuleItem *>(pItem)->GetValue(); 610 aTmpStr += String(")", RTL_TEXTENCODING_ASCII_US); 611 aTmpStr += String("*", RTL_TEXTENCODING_ASCII_US); 612 } 613 614 const SwNumFmt * pNumFmt = NULL; 615 aTmpStr += String("</rule>", RTL_TEXTENCODING_ASCII_US); 616 617 if (pTxtNode->GetActualListLevel() > 0) 618 pNumFmt = pNumRule->GetNumFmt( static_cast< sal_uInt16 >(pTxtNode->GetActualListLevel()) ); 619 620 if (pNumFmt) 621 { 622 aTmpStr += String("<numformat>", RTL_TEXTENCODING_ASCII_US); 623 aTmpStr += 624 lcl_dbg_out_NumType(pNumFmt->GetNumberingType()); 625 aTmpStr += String("</numformat>", RTL_TEXTENCODING_ASCII_US); 626 } 627 } 628 629 if (pTxtNode->IsCountedInList()) 630 aTmpStr += String("<counted/>", RTL_TEXTENCODING_ASCII_US); 631 632 SwFmtColl * pColl = pTxtNode->GetFmtColl(); 633 634 if (pColl) 635 { 636 aTmpStr += String("<coll>", RTL_TEXTENCODING_ASCII_US); 637 aTmpStr += pColl->GetName(); 638 639 aTmpStr += String("(", RTL_TEXTENCODING_ASCII_US); 640 aTmpStr += String::CreateFromInt32 641 //(static_cast<SwTxtFmtColl *>(pColl)->GetOutlineLevel());//#outline level,zhaojianwei 642 (static_cast<SwTxtFmtColl *>(pColl)->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei 643 644 const SwNumRuleItem & rItem = 645 static_cast<const SwNumRuleItem &> 646 (pColl->GetFmtAttr(RES_PARATR_NUMRULE)); 647 const String sNumruleName = rItem.GetValue(); 648 649 if (sNumruleName.Len() > 0) 650 { 651 aTmpStr += String(", ", RTL_TEXTENCODING_ASCII_US); 652 aTmpStr += sNumruleName; 653 } 654 aTmpStr += String(")", RTL_TEXTENCODING_ASCII_US); 655 aTmpStr += String("</coll>", RTL_TEXTENCODING_ASCII_US); 656 } 657 658 SwFmtColl * pCColl = pTxtNode->GetCondFmtColl(); 659 660 if (pCColl) 661 { 662 aTmpStr += String("<ccoll>", RTL_TEXTENCODING_ASCII_US); 663 aTmpStr += pCColl->GetName(); 664 aTmpStr += String("</ccoll>", RTL_TEXTENCODING_ASCII_US); 665 } 666 667 aTmpStr += String("<frms>", RTL_TEXTENCODING_ASCII_US); 668 aTmpStr += lcl_AnchoredFrames(rNode); 669 aTmpStr += String("</frms>", RTL_TEXTENCODING_ASCII_US); 670 671 if (bDbgOutPrintAttrSet) 672 { 673 aTmpStr += String("<attrs>", RTL_TEXTENCODING_ASCII_US); 674 aTmpStr += lcl_dbg_out(pTxtNode->GetSwAttrSet()); 675 aTmpStr += String("</attrs>", RTL_TEXTENCODING_ASCII_US); 676 } 677 } 678 else if (rNode.IsStartNode()) 679 { 680 aTmpStr += String("<start end=\"", RTL_TEXTENCODING_ASCII_US); 681 682 const SwStartNode * pStartNode = dynamic_cast<const SwStartNode *> (&rNode); 683 if (pStartNode != NULL) 684 aTmpStr += String::CreateFromInt32(pStartNode->EndOfSectionNode()->GetIndex()); 685 686 aTmpStr += String("\"/>", RTL_TEXTENCODING_ASCII_US); 687 } 688 else if (rNode.IsEndNode()) 689 aTmpStr += String("<end/>", RTL_TEXTENCODING_ASCII_US); 690 691 aTmpStr += String("</node>", RTL_TEXTENCODING_ASCII_US); 692 693 return aTmpStr; 694 } 695 696 SW_DLLPUBLIC const char * dbg_out(const SwNode & rNode) 697 { 698 return dbg_out(lcl_dbg_out(rNode)); 699 } 700 701 SW_DLLPUBLIC const char * dbg_out(const SwNode * pNode) 702 { 703 if (NULL != pNode) 704 return dbg_out(*pNode); 705 else 706 return NULL; 707 } 708 709 SW_DLLPUBLIC const char * dbg_out(const SwCntntNode * pNode) 710 { 711 if (NULL != pNode) 712 return dbg_out(*pNode); 713 else 714 return NULL; 715 } 716 717 SW_DLLPUBLIC const char * dbg_out(const SwTxtNode * pNode) 718 { 719 if (NULL != pNode) 720 return dbg_out(*pNode); 721 else 722 return NULL; 723 } 724 725 sal_Bool lcl_dbg_add_node(const SwNodePtr & pNode, void * pArgs) 726 { 727 if (pNode) 728 { 729 (*((String *) pArgs)) += lcl_dbg_out(*pNode); 730 (*((String *) pArgs)) += String("\n", RTL_TEXTENCODING_ASCII_US); 731 } 732 733 //MBA: this code didn't compile, needed to add a return value 734 return sal_True; 735 } 736 737 void lcl_dbg_nodes_inner(String & aStr, SwNodes & rNodes, sal_uLong & nIndex) 738 { 739 SwNode * pNode = rNodes[nIndex]; 740 SwStartNode * pStartNode = dynamic_cast<SwStartNode *> (pNode); 741 742 SwNode * pEndNode = NULL; 743 if (pStartNode != NULL) 744 pEndNode = pStartNode->EndOfSectionNode(); 745 746 sal_uLong nCount = rNodes.Count(); 747 sal_uLong nStartIndex = nIndex; 748 749 bool bDone = false; 750 751 String aTag; 752 if (pNode->IsTableNode()) 753 aTag += String("table", RTL_TEXTENCODING_ASCII_US); 754 else if (pNode->IsSectionNode()) 755 aTag += String("section", RTL_TEXTENCODING_ASCII_US); 756 else 757 aTag += String("nodes", RTL_TEXTENCODING_ASCII_US); 758 759 aStr += String("<", RTL_TEXTENCODING_ASCII_US); 760 aStr += aTag; 761 aStr += String(">", RTL_TEXTENCODING_ASCII_US); 762 763 while (! bDone) 764 { 765 if (pNode->IsStartNode() && nIndex != nStartIndex) 766 lcl_dbg_nodes_inner(aStr, rNodes, nIndex); 767 else 768 { 769 aStr += lcl_dbg_out(*pNode); 770 aStr += String("\n", RTL_TEXTENCODING_ASCII_US); 771 772 nIndex++; 773 } 774 775 if (pNode == pEndNode || nIndex >= nCount) 776 bDone = true; 777 else 778 pNode = rNodes[nIndex]; 779 } 780 781 aStr += String("</", RTL_TEXTENCODING_ASCII_US); 782 aStr += aTag; 783 aStr += String(">\n", RTL_TEXTENCODING_ASCII_US); 784 } 785 786 String lcl_dbg_out(SwNodes & rNodes) 787 { 788 String aStr("<nodes-array>", RTL_TEXTENCODING_ASCII_US); 789 790 sal_uLong nIndex = 0; 791 sal_uLong nCount = rNodes.Count(); 792 793 while (nIndex < nCount) 794 { 795 lcl_dbg_nodes_inner(aStr, rNodes, nIndex); 796 } 797 798 aStr += String("</nodes-array>\n", RTL_TEXTENCODING_ASCII_US); 799 800 return aStr; 801 } 802 803 SW_DLLPUBLIC const char * dbg_out(SwNodes & rNodes) 804 { 805 return dbg_out(lcl_dbg_out(rNodes)); 806 } 807 808 String lcl_dbg_out(const SwUndo & rUndo) 809 { 810 String aStr("[ ", RTL_TEXTENCODING_ASCII_US); 811 812 aStr += String::CreateFromInt32( 813 static_cast<SfxUndoAction const&>(rUndo).GetId()); 814 aStr += String(": ", RTL_TEXTENCODING_ASCII_US); 815 816 aStr += rUndo.GetComment(); 817 aStr += String(" ]", RTL_TEXTENCODING_ASCII_US); 818 819 return aStr; 820 } 821 822 SW_DLLPUBLIC const char * dbg_out(const SwUndo & rUndo) 823 { 824 return dbg_out(lcl_dbg_out(rUndo)); 825 } 826 827 String lcl_dbg_out(SwOutlineNodes & rNodes) 828 { 829 String aStr("[\n", RTL_TEXTENCODING_ASCII_US); 830 831 for (sal_uInt16 i = 0; i < rNodes.Count(); i++) 832 { 833 aStr += lcl_dbg_out(*rNodes[i]); 834 aStr += String("\n", RTL_TEXTENCODING_ASCII_US); 835 } 836 837 aStr += String("]\n", RTL_TEXTENCODING_ASCII_US); 838 839 return aStr; 840 } 841 842 SW_DLLPUBLIC const char * dbg_out(SwOutlineNodes & rNodes) 843 { 844 return dbg_out(lcl_dbg_out(rNodes)); 845 } 846 847 String lcl_dbg_out(const SwRewriter & rRewriter) 848 { 849 (void) rRewriter; 850 String aResult; 851 852 //aResult = rRewriter.ToString(); 853 854 return aResult; 855 } 856 857 SW_DLLPUBLIC const char * dbg_out(const SwRewriter & rRewriter) 858 { 859 return dbg_out(lcl_dbg_out(rRewriter)); 860 } 861 862 String lcl_dbg_out(const SvxNumberFormat & rFmt) 863 { 864 String aResult; 865 866 aResult = lcl_dbg_out_NumType(rFmt.GetNumberingType()); 867 868 return aResult; 869 } 870 871 String lcl_dbg_out(const SwNumRule & rRule) 872 { 873 String aResult("[ ", RTL_TEXTENCODING_ASCII_US); 874 875 aResult += rRule.GetName(); 876 aResult += String(" [", RTL_TEXTENCODING_ASCII_US); 877 878 for (sal_uInt8 n = 0; n < MAXLEVEL; n++) 879 { 880 if (n > 0) 881 aResult += String(", ", RTL_TEXTENCODING_ASCII_US); 882 883 aResult += lcl_dbg_out(rRule.Get(n)); 884 } 885 886 aResult += String("]", RTL_TEXTENCODING_ASCII_US); 887 888 aResult += String("]", RTL_TEXTENCODING_ASCII_US); 889 890 return aResult; 891 } 892 893 SW_DLLPUBLIC const char * dbg_out(const SwNumRule & rRule) 894 { 895 return dbg_out(lcl_dbg_out(rRule)); 896 } 897 898 String lcl_dbg_out(const SwTxtFmtColl & rFmt) 899 { 900 String aResult(rFmt.GetName()); 901 902 aResult += String("(", RTL_TEXTENCODING_ASCII_US); 903 aResult += String::CreateFromInt32(rFmt.GetAttrOutlineLevel()); 904 aResult += String(")", RTL_TEXTENCODING_ASCII_US); 905 906 return aResult; 907 } 908 909 SW_DLLPUBLIC const char * dbg_out(const SwTxtFmtColl & rFmt) 910 { 911 return dbg_out(lcl_dbg_out(rFmt)); 912 } 913 914 String lcl_dbg_out(const SwFrmFmts & rFrmFmts) 915 { 916 return lcl_dbg_out_SvPtrArr<SwFrmFmts>(rFrmFmts); 917 } 918 919 SW_DLLPUBLIC const char * dbg_out(const SwFrmFmts & rFrmFmts) 920 { 921 return dbg_out(lcl_dbg_out(rFrmFmts)); 922 } 923 924 String lcl_dbg_out(const SwNumRuleTbl & rTbl) 925 { 926 String aResult("[", RTL_TEXTENCODING_ASCII_US); 927 928 for (sal_uInt16 n = 0; n < rTbl.Count(); n++) 929 { 930 if (n > 0) 931 aResult += String(", ", RTL_TEXTENCODING_ASCII_US); 932 933 aResult += rTbl[n]->GetName(); 934 935 char sBuffer[256]; 936 sprintf(sBuffer, "(%p)", rTbl[n]); 937 aResult += String(sBuffer, RTL_TEXTENCODING_ASCII_US); 938 } 939 940 aResult += String("]", RTL_TEXTENCODING_ASCII_US); 941 942 return aResult; 943 } 944 945 SW_DLLPUBLIC const char * dbg_out(const SwNumRuleTbl & rTbl) 946 { 947 return dbg_out(lcl_dbg_out(rTbl)); 948 } 949 950 String lcl_TokenType2Str(FormTokenType nType) 951 { 952 switch(nType) 953 { 954 case TOKEN_ENTRY_NO: 955 return String("NO", RTL_TEXTENCODING_ASCII_US); 956 case TOKEN_ENTRY_TEXT: 957 return String("ENTRY_TEXT", RTL_TEXTENCODING_ASCII_US); 958 case TOKEN_ENTRY: 959 return String("ENTRY", RTL_TEXTENCODING_ASCII_US); 960 case TOKEN_TAB_STOP: 961 return String("TAB_STOP", RTL_TEXTENCODING_ASCII_US); 962 case TOKEN_TEXT: 963 return String("TOKEN_TEXT", RTL_TEXTENCODING_ASCII_US); 964 case TOKEN_PAGE_NUMS: 965 return String("NUMS", RTL_TEXTENCODING_ASCII_US); 966 case TOKEN_CHAPTER_INFO: 967 return String("CHAPTER_INFO", RTL_TEXTENCODING_ASCII_US); 968 case TOKEN_LINK_START: 969 return String("LINK_START", RTL_TEXTENCODING_ASCII_US); 970 case TOKEN_LINK_END: 971 return String("LINK_END", RTL_TEXTENCODING_ASCII_US); 972 case TOKEN_AUTHORITY: 973 return String("AUTHORITY", RTL_TEXTENCODING_ASCII_US); 974 case TOKEN_END: 975 return String("END", RTL_TEXTENCODING_ASCII_US); 976 default: 977 return String("??", RTL_TEXTENCODING_ASCII_US); 978 } 979 980 ASSERT(false, "should not be reached"); 981 982 return String("??", RTL_TEXTENCODING_ASCII_US); 983 } 984 985 String lcl_dbg_out(const SwFormToken & rToken) 986 { 987 return rToken.GetString(); 988 } 989 990 SW_DLLPUBLIC const char * dbg_out(const SwFormToken & rToken) 991 { 992 return dbg_out(lcl_dbg_out(rToken)); 993 } 994 995 String lcl_dbg_out(const SwFormTokens & rTokens) 996 { 997 String aStr("[", RTL_TEXTENCODING_ASCII_US); 998 999 SwFormTokens::const_iterator aIt; 1000 1001 for (aIt = rTokens.begin(); aIt != rTokens.end(); aIt++) 1002 { 1003 if (aIt != rTokens.begin()) 1004 aStr += String(", ", RTL_TEXTENCODING_ASCII_US); 1005 1006 aStr += lcl_TokenType2Str(aIt->eTokenType); 1007 aStr += String(": ", RTL_TEXTENCODING_ASCII_US); 1008 aStr += lcl_dbg_out(*aIt); 1009 } 1010 1011 aStr += String("]" , RTL_TEXTENCODING_ASCII_US); 1012 1013 return aStr; 1014 } 1015 1016 SW_DLLPUBLIC const char * dbg_out(const SwFormTokens & rTokens) 1017 { 1018 return dbg_out(lcl_dbg_out(rTokens)); 1019 } 1020 1021 String lcl_dbg_out(const SwNodeRange & rRange) 1022 { 1023 String aStr("[", RTL_TEXTENCODING_ASCII_US); 1024 1025 aStr += lcl_dbg_out(SwPosition(rRange.aStart)); 1026 aStr += String(", ", RTL_TEXTENCODING_ASCII_US); 1027 aStr += lcl_dbg_out(SwPosition(rRange.aEnd)); 1028 1029 aStr += String("]" , RTL_TEXTENCODING_ASCII_US); 1030 1031 return aStr; 1032 } 1033 1034 SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange) 1035 { 1036 return dbg_out(lcl_dbg_out(rRange)); 1037 } 1038 1039 #endif // DEBUG 1040 1041