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