android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / doc / dbgoutsw.cxx
bloba6edc6f0cc12a8e3d3c25c03eb1bbeaa228a05ac
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifdef DBG_UTIL
22 #include <osl/diagnose.h>
23 #include <rtl/ustring.hxx>
24 #include <svl/poolitem.hxx>
25 #include <svl/itemiter.hxx>
26 #include <map>
27 #include <node.hxx>
28 #include <ndtxt.hxx>
29 #include <ndhints.hxx>
30 #include <txatbase.hxx>
31 #include <pam.hxx>
32 #include <docary.hxx>
33 #include <undobj.hxx>
34 #include <numrule.hxx>
35 #include <doc.hxx>
36 #include <frmfmt.hxx>
37 #include <fmtanchr.hxx>
38 #include <swrect.hxx>
39 #include <ndarr.hxx>
40 #include <paratr.hxx>
41 #include <SwNodeNum.hxx>
42 #include <dbgoutsw.hxx>
43 #include <frameformats.hxx>
44 #include <cstdio>
46 static OString aDbgOutResult;
47 bool bDbgOutStdErr = false;
48 bool bDbgOutPrintAttrSet = false;
50 template<class T>
51 static OUString lcl_dbg_out_SvPtrArr(const T & rArr)
53 OUStringBuffer aStr("[ ");
55 for (typename T::const_iterator i(rArr.begin()); i != rArr.end(); ++i)
57 if (i != rArr.begin())
58 aStr.append(", ");
60 if (*i)
61 aStr.append(lcl_dbg_out(**i));
62 else
63 aStr.append("(null)");
66 aStr.append(" ]");
68 return aStr.makeStringAndClear();
71 const char * dbg_out(const void * pVoid)
73 return dbg_out(OUString::number(reinterpret_cast<sal_uIntPtr>(pVoid), 16));
76 const char * dbg_out(std::u16string_view aStr)
78 aDbgOutResult = OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US);
80 if (bDbgOutStdErr)
81 fprintf(stderr, "%s", aDbgOutResult.getStr());
83 return aDbgOutResult.getStr();
86 static std::map<sal_uInt16,OUString> & GetItemWhichMap()
88 static std::map<sal_uInt16,OUString> aItemWhichMap
90 { RES_CHRATR_CASEMAP , "CHRATR_CASEMAP" },
91 { RES_CHRATR_CHARSETCOLOR , "CHRATR_CHARSETCOLOR" },
92 { RES_CHRATR_COLOR , "CHRATR_COLOR" },
93 { RES_CHRATR_CONTOUR , "CHRATR_CONTOUR" },
94 { RES_CHRATR_CROSSEDOUT , "CHRATR_CROSSEDOUT" },
95 { RES_CHRATR_ESCAPEMENT , "CHRATR_ESCAPEMENT" },
96 { RES_CHRATR_FONT , "CHRATR_FONT" },
97 { RES_CHRATR_FONTSIZE , "CHRATR_FONTSIZE" },
98 { RES_CHRATR_KERNING , "CHRATR_KERNING" },
99 { RES_CHRATR_LANGUAGE , "CHRATR_LANGUAGE" },
100 { RES_CHRATR_POSTURE , "CHRATR_POSTURE" },
101 { RES_CHRATR_SHADOWED , "CHRATR_SHADOWED" },
102 { RES_CHRATR_UNDERLINE , "CHRATR_UNDERLINE" },
103 { RES_CHRATR_OVERLINE , "CHRATR_OVERLINE" },
104 { RES_CHRATR_WEIGHT , "CHRATR_WEIGHT" },
105 { RES_CHRATR_WORDLINEMODE , "CHRATR_WORDLINEMODE" },
106 { RES_CHRATR_AUTOKERN , "CHRATR_AUTOKERN" },
107 { RES_CHRATR_BLINK , "CHRATR_BLINK" },
108 { RES_CHRATR_NOHYPHEN , "CHRATR_NOHYPHEN" },
109 { RES_CHRATR_BACKGROUND , "CHRATR_BACKGROUND" },
110 { RES_CHRATR_HIGHLIGHT , "CHRATR_HIGHLIGHT" },
111 { RES_CHRATR_CJK_FONT , "CHRATR_CJK_FONT" },
112 { RES_CHRATR_CJK_FONTSIZE , "CHRATR_CJK_FONTSIZE" },
113 { RES_CHRATR_CJK_LANGUAGE , "CHRATR_CJK_LANGUAGE" },
114 { RES_CHRATR_CJK_POSTURE , "CHRATR_CJK_POSTURE" },
115 { RES_CHRATR_CJK_WEIGHT , "CHRATR_CJK_WEIGHT" },
116 { RES_CHRATR_CTL_FONT , "CHRATR_CTL_FONT" },
117 { RES_CHRATR_CTL_FONTSIZE , "CHRATR_CTL_FONTSIZE" },
118 { RES_CHRATR_CTL_LANGUAGE , "CHRATR_CTL_LANGUAGE" },
119 { RES_CHRATR_CTL_POSTURE , "CHRATR_CTL_POSTURE" },
120 { RES_CHRATR_CTL_WEIGHT , "CHRATR_CTL_WEIGHT" },
121 { RES_CHRATR_ROTATE , "CHRATR_ROTATE" },
122 { RES_CHRATR_EMPHASIS_MARK , "CHRATR_EMPHASIS_MARK" },
123 { RES_CHRATR_TWO_LINES , "CHRATR_TWO_LINES" },
124 { RES_CHRATR_SCALEW , "CHRATR_SCALEW" },
125 { RES_CHRATR_RELIEF , "CHRATR_RELIEF" },
126 { RES_CHRATR_HIDDEN , "CHRATR_HIDDEN" },
127 { RES_CHRATR_BOX , "CHRATR_BOX" },
128 { RES_CHRATR_SHADOW , "CHRATR_SHADOW" },
129 { RES_TXTATR_AUTOFMT , "TXTATR_AUTOFMT" },
130 { RES_TXTATR_INETFMT , "TXTATR_INETFMT" },
131 { RES_TXTATR_REFMARK , "TXTATR_REFMARK" },
132 { RES_TXTATR_TOXMARK , "TXTATR_TOXMARK" },
133 { RES_TXTATR_CHARFMT , "TXTATR_CHARFMT" },
134 { RES_TXTATR_INPUTFIELD , "RES_TXTATR_INPUTFIELD" },
135 { RES_TXTATR_CONTENTCONTROL , "RES_TXTATR_CONTENTCONTROL" },
136 { RES_TXTATR_CJK_RUBY , "TXTATR_CJK_RUBY" },
137 { RES_TXTATR_UNKNOWN_CONTAINER , "TXTATR_UNKNOWN_CONTAINER" },
138 { RES_TXTATR_META , "TXTATR_META" },
139 { RES_TXTATR_METAFIELD , "TXTATR_METAFIELD" },
140 { RES_TXTATR_FIELD , "TXTATR_FIELD" },
141 { RES_TXTATR_FLYCNT , "TXTATR_FLYCNT" },
142 { RES_TXTATR_FTN , "TXTATR_FTN" },
143 { RES_TXTATR_ANNOTATION , "TXTATR_ANNOTATION" },
144 { RES_TXTATR_LINEBREAK , "RES_TXTATR_LINEBREAK" },
145 { RES_TXTATR_DUMMY1 , "TXTATR_DUMMY1" },
146 { RES_PARATR_LINESPACING , "PARATR_LINESPACING" },
147 { RES_PARATR_ADJUST , "PARATR_ADJUST" },
148 { RES_PARATR_SPLIT , "PARATR_SPLIT" },
149 { RES_PARATR_ORPHANS , "PARATR_ORPHANS" },
150 { RES_PARATR_WIDOWS , "PARATR_WIDOWS" },
151 { RES_PARATR_TABSTOP , "PARATR_TABSTOP" },
152 { RES_PARATR_HYPHENZONE , "PARATR_HYPHENZONE" },
153 { RES_PARATR_DROP , "PARATR_DROP" },
154 { RES_PARATR_REGISTER , "PARATR_REGISTER" },
155 { RES_PARATR_NUMRULE , "PARATR_NUMRULE" },
156 { RES_PARATR_SCRIPTSPACE , "PARATR_SCRIPTSPACE" },
157 { RES_PARATR_HANGINGPUNCTUATION , "PARATR_HANGINGPUNCTUATION" },
158 { RES_PARATR_FORBIDDEN_RULES , "PARATR_FORBIDDEN_RULES" },
159 { RES_PARATR_VERTALIGN , "PARATR_VERTALIGN" },
160 { RES_PARATR_SNAPTOGRID , "PARATR_SNAPTOGRID" },
161 { RES_PARATR_CONNECT_BORDER , "PARATR_CONNECT_BORDER" },
162 { RES_FILL_ORDER , "FILL_ORDER" },
163 { RES_FRM_SIZE , "FRM_SIZE" },
164 { RES_PAPER_BIN , "PAPER_BIN" },
165 { RES_MARGIN_FIRSTLINE, "FIRSTLINE" },
166 { RES_MARGIN_TEXTLEFT, "TEXTLEFT" },
167 { RES_MARGIN_RIGHT, "RIGHT" },
168 { RES_MARGIN_LEFT, "LEFT" },
169 { RES_MARGIN_GUTTER, "GUTTER" },
170 { RES_MARGIN_GUTTER_RIGHT, "GUTTER_RIGHT" },
171 { RES_LR_SPACE , "LR_SPACE" },
172 { RES_UL_SPACE , "UL_SPACE" },
173 { RES_PAGEDESC , "PAGEDESC" },
174 { RES_BREAK , "BREAK" },
175 { RES_CNTNT , "CNTNT" },
176 { RES_HEADER , "HEADER" },
177 { RES_FOOTER , "FOOTER" },
178 { RES_PRINT , "PRINT" },
179 { RES_OPAQUE , "OPAQUE" },
180 { RES_PROTECT , "PROTECT" },
181 { RES_SURROUND , "SURROUND" },
182 { RES_VERT_ORIENT , "VERT_ORIENT" },
183 { RES_HORI_ORIENT , "HORI_ORIENT" },
184 { RES_ANCHOR , "ANCHOR" },
185 { RES_BACKGROUND , "BACKGROUND" },
186 { RES_BOX , "BOX" },
187 { RES_SHADOW , "SHADOW" },
188 { RES_FRMMACRO , "FRMMACRO" },
189 { RES_COL , "COL" },
190 { RES_KEEP , "KEEP" },
191 { RES_URL , "URL" },
192 { RES_EDIT_IN_READONLY , "EDIT_IN_READONLY" },
193 { RES_LAYOUT_SPLIT , "LAYOUT_SPLIT" },
194 { RES_CHAIN , "CHAIN" },
195 { RES_TEXTGRID , "TEXTGRID" },
196 { RES_LINENUMBER , "LINENUMBER" },
197 { RES_FTN_AT_TXTEND , "FTN_AT_TXTEND" },
198 { RES_END_AT_TXTEND , "END_AT_TXTEND" },
199 { RES_COLUMNBALANCE , "COLUMNBALANCE" },
200 { RES_FRAMEDIR , "FRAMEDIR" },
201 { RES_HEADER_FOOTER_EAT_SPACING , "HEADER_FOOTER_EAT_SPACING" },
202 { RES_ROW_SPLIT , "ROW_SPLIT" },
203 { RES_GRFATR_MIRRORGRF , "GRFATR_MIRRORGRF" },
204 { RES_GRFATR_CROPGRF , "GRFATR_CROPGRF" },
205 { RES_GRFATR_ROTATION , "GRFATR_ROTATION" },
206 { RES_GRFATR_LUMINANCE , "GRFATR_LUMINANCE" },
207 { RES_GRFATR_CONTRAST , "GRFATR_CONTRAST" },
208 { RES_GRFATR_CHANNELR , "GRFATR_CHANNELR" },
209 { RES_GRFATR_CHANNELG , "GRFATR_CHANNELG" },
210 { RES_GRFATR_CHANNELB , "GRFATR_CHANNELB" },
211 { RES_GRFATR_GAMMA , "GRFATR_GAMMA" },
212 { RES_GRFATR_INVERT , "GRFATR_INVERT" },
213 { RES_GRFATR_TRANSPARENCY , "GRFATR_TRANSPARENCY" },
214 { RES_GRFATR_DRAWMODE , "GRFATR_DRAWMODE" },
215 { RES_BOXATR_FORMAT , "BOXATR_FORMAT" },
216 { RES_BOXATR_FORMULA , "BOXATR_FORMULA" },
217 { RES_BOXATR_VALUE , "BOXATR_VALUE" },
220 return aItemWhichMap;
223 static OUString lcl_dbg_out(const SfxPoolItem & rItem)
225 OUString aStr("[ ");
227 if (GetItemWhichMap().find(rItem.Which()) != GetItemWhichMap().end())
228 aStr += GetItemWhichMap()[rItem.Which()];
229 else
230 aStr += OUString::number(rItem.Which());
232 aStr += " ]";
234 return aStr;
237 const char * dbg_out(const SfxPoolItem & rItem)
239 return dbg_out(lcl_dbg_out(rItem));
242 const char * dbg_out(const SfxPoolItem * pItem)
244 return dbg_out(pItem ? lcl_dbg_out(*pItem) : OUString("(nil)"));
247 static OUString lcl_dbg_out(const SfxItemSet & rSet)
249 SfxItemIter aIter(rSet);
250 bool bFirst = true;
251 OUStringBuffer aStr = "[ ";
253 for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
255 if (!bFirst)
256 aStr.append(", ");
258 if (reinterpret_cast<sal_uIntPtr>(pItem) != SAL_MAX_SIZE)
259 aStr.append(lcl_dbg_out(*pItem));
260 else
261 aStr.append("invalid");
263 bFirst = false;
266 aStr.append(" ]");
268 return aStr.makeStringAndClear();
271 const char * dbg_out(const SfxItemSet & rSet)
273 return dbg_out(lcl_dbg_out(rSet));
276 static OUString lcl_dbg_out(const SwTextAttr & rAttr)
278 OUString aStr =
279 "[ " +
280 OUString::number(rAttr.GetStart()) +
281 "->" +
282 OUString::number(*rAttr.End()) +
283 " " +
284 lcl_dbg_out(rAttr.GetAttr()) +
285 " ]";
287 return aStr;
290 const char * dbg_out(const SwTextAttr & rAttr)
292 return dbg_out(lcl_dbg_out(rAttr));
295 static OUString lcl_dbg_out(const SwpHints & rHints)
297 OUStringBuffer aStr("[ SwpHints\n");
299 for (size_t i = 0; i < rHints.Count(); ++i)
301 aStr.append(" " + lcl_dbg_out(*rHints.Get(i)) + "\n");
304 aStr.append("]\n");
306 return aStr.makeStringAndClear();
309 const char * dbg_out(const SwpHints &rHints)
311 return dbg_out(lcl_dbg_out(rHints));
314 static OUString lcl_dbg_out(const SwPosition & rPos)
316 OUString aStr =
317 "( " +
318 OUString::number(sal_Int32(rPos.GetNodeIndex())) +
319 ", " +
320 OUString::number(rPos.GetContentIndex()) +
321 ": " +
322 OUString::number(reinterpret_cast<sal_IntPtr>(rPos.GetContentNode()), 16) +
323 " )";
325 return aStr;
328 const char * dbg_out(const SwPosition & rPos)
330 return dbg_out(lcl_dbg_out(rPos));
333 static OUString lcl_dbg_out(const SwPaM & rPam)
335 OUString aStr =
336 "[ Pt: " +
337 lcl_dbg_out(*rPam.GetPoint());
339 if (rPam.HasMark())
341 aStr += ", Mk: " + lcl_dbg_out(*rPam.GetMark());
344 aStr += " ]";
346 return aStr;
349 const char * dbg_out(const SwPaM & rPam)
351 return dbg_out(lcl_dbg_out(rPam));
354 static OUString lcl_dbg_out(const SwNodeNum & )
356 return OUString();/*rNum.ToString();*/
359 const char * dbg_out(const SwNodeNum & rNum)
361 return dbg_out(lcl_dbg_out(rNum));
364 static OUString lcl_dbg_out(const SwRect & rRect)
366 OUString aResult =
367 "[ [" +
368 OUString::number(rRect.Left()) +
369 ", " +
370 OUString::number(rRect.Top()) +
371 "], [" +
372 OUString::number(rRect.Right()) +
373 ", " +
374 OUString::number(rRect.Bottom()) +
375 "] ]";
377 return aResult;
380 const char * dbg_out(const SwRect & rRect)
382 return dbg_out(lcl_dbg_out(rRect));
385 static OUString lcl_dbg_out(const SwFrameFormat & rFrameFormat)
387 OUString aResult = "[ " +
388 OUString::number(reinterpret_cast<sal_uIntPtr>(&rFrameFormat), 16) +
389 "(" +
390 rFrameFormat.GetName() + ")";
392 if (rFrameFormat.IsAuto())
393 aResult += "*";
395 aResult += " ," + lcl_dbg_out(rFrameFormat.FindLayoutRect()) + " ]";
397 return aResult;
400 const char * dbg_out(const SwFrameFormat & rFrameFormat)
402 return dbg_out(lcl_dbg_out(rFrameFormat));
405 static OUString lcl_AnchoredFrames(const SwNode & rNode)
407 OUStringBuffer aResult("[");
409 const SwDoc& rDoc = rNode.GetDoc();
410 const sw::SpzFrameFormats* pSpzs = rDoc.GetSpzFrameFormats();
412 if (pSpzs)
414 bool bFirst = true;
415 for(const sw::SpzFrameFormat* pSpz: *pSpzs)
417 const SwFormatAnchor& rAnchor = pSpz->GetAnchor();
418 const SwNode * pPos = rAnchor.GetAnchorNode();
420 if (pPos && *pPos == rNode)
422 if (! bFirst)
423 aResult.append(", ");
425 if (pSpz)
426 aResult.append(lcl_dbg_out(*pSpz));
427 bFirst = false;
432 aResult.append("]");
434 return aResult.makeStringAndClear();
437 static OUString lcl_dbg_out_NumType(sal_Int16 nType)
439 OUString aTmpStr;
441 switch (nType)
443 case SVX_NUM_NUMBER_NONE:
444 aTmpStr += " NONE";
446 break;
447 case SVX_NUM_CHARS_UPPER_LETTER:
448 aTmpStr += " CHARS_UPPER_LETTER";
450 break;
451 case SVX_NUM_CHARS_LOWER_LETTER:
452 aTmpStr += " CHARS_LOWER_LETTER";
454 break;
455 case SVX_NUM_ROMAN_UPPER:
456 aTmpStr += " ROMAN_UPPER";
458 break;
459 case SVX_NUM_ROMAN_LOWER:
460 aTmpStr += " ROMAN_LOWER";
462 break;
463 case SVX_NUM_ARABIC:
464 aTmpStr += " ARABIC";
466 break;
467 default:
468 aTmpStr += " ??";
470 break;
473 return aTmpStr;
476 static OUString lcl_dbg_out(const SwNode & rNode)
478 OUString aTmpStr = "<node "
479 "index=\"" +
480 OUString::number(sal_Int32(rNode.GetIndex())) +
481 "\""
482 " serial=\"" +
483 OUString::number(rNode.GetSerial()) +
484 "\""
485 " type=\"" +
486 OUString::number(sal_Int32( rNode.GetNodeType() ) ) +
487 "\""
488 " pointer=\"" +
489 OUString::number(reinterpret_cast<sal_uIntPtr>(&rNode), 16) +
490 "\">";
492 const SwTextNode * pTextNode = rNode.GetTextNode();
494 if (rNode.IsTextNode())
496 const SfxItemSet * pAttrSet = pTextNode->GetpSwAttrSet();
498 aTmpStr += "<txt>" + (pTextNode->GetText().getLength() > 10 ? pTextNode->GetText().copy(0, 10) : pTextNode->GetText()) + "</txt>";
500 if (rNode.IsTableNode())
501 aTmpStr += "<tbl/>";
503 aTmpStr += "<outlinelevel>" + OUString::number(pTextNode->GetAttrOutlineLevel()-1) + "</outlinelevel>";
505 const SwNumRule * pNumRule = pTextNode->GetNumRule();
507 if (pNumRule != nullptr)
509 aTmpStr += "<number>";
510 if ( pTextNode->GetNum() )
512 aTmpStr += lcl_dbg_out(*(pTextNode->GetNum()));
514 aTmpStr += "</number><rule>" +
515 pNumRule->GetName();
517 const SwNumRuleItem * pItem = nullptr;
519 if (pAttrSet &&
520 (pItem = pAttrSet->GetItemIfSet(RES_PARATR_NUMRULE, false)))
522 aTmpStr += "(" + pItem->GetValue() + ")*";
525 const SwNumFormat * pNumFormat = nullptr;
526 aTmpStr += "</rule>";
528 if (pTextNode->GetActualListLevel() > 0)
529 pNumFormat = pNumRule->GetNumFormat( static_cast< sal_uInt16 >(pTextNode->GetActualListLevel()) );
531 if (pNumFormat)
533 aTmpStr += "<numformat>" +
534 lcl_dbg_out_NumType(pNumFormat->GetNumberingType()) + "</numformat>";
538 if (pTextNode->IsCountedInList())
539 aTmpStr += "<counted/>";
541 SwFormatColl * pColl = pTextNode->GetFormatColl();
543 if (pColl)
545 aTmpStr += "<coll>" + pColl->GetName() + "(";
547 SwTextFormatColl *pTextColl = static_cast<SwTextFormatColl*>(pColl);
548 if (pTextColl->IsAssignedToListLevelOfOutlineStyle())
550 aTmpStr += OUString::number(pTextColl->GetAssignedOutlineStyleLevel());
552 else
554 aTmpStr += OUString::number(-1);
557 const SwNumRuleItem & rItem =
558 pColl->GetFormatAttr(RES_PARATR_NUMRULE);
559 const OUString& sNumruleName = rItem.GetValue();
561 if (!sNumruleName.isEmpty())
563 aTmpStr += ", " + sNumruleName;
565 aTmpStr += ")"
566 "</coll>";
569 SwFormatColl * pCColl = pTextNode->GetCondFormatColl();
571 if (pCColl)
573 aTmpStr += "<ccoll>" + pCColl->GetName() + "</ccoll>";
576 aTmpStr += "<frms>" + lcl_AnchoredFrames(rNode) + "</frms>";
578 if (bDbgOutPrintAttrSet)
580 aTmpStr += "<attrs>" + lcl_dbg_out(pTextNode->GetSwAttrSet()) + "</attrs>";
583 else if (rNode.IsStartNode())
585 aTmpStr += "<start end=\"";
587 const SwStartNode * pStartNode = rNode.GetStartNode();
588 if (pStartNode != nullptr)
589 aTmpStr += OUString::number(sal_Int32(pStartNode->EndOfSectionNode()->GetIndex()));
591 aTmpStr += "\"/>";
593 else if (rNode.IsEndNode())
594 aTmpStr += "<end/>";
596 aTmpStr += "</node>";
598 return aTmpStr;
601 const char * dbg_out(const SwNode & rNode)
603 return dbg_out(lcl_dbg_out(rNode));
606 const char * dbg_out(const SwNode * pNode)
608 if (nullptr != pNode)
609 return dbg_out(*pNode);
610 else
611 return nullptr;
614 const char * dbg_out(const SwContentNode * pNode)
616 if (nullptr != pNode)
617 return dbg_out(*pNode);
618 else
619 return nullptr;
622 const char * dbg_out(const SwTextNode * pNode)
624 if (nullptr != pNode)
625 return dbg_out(*pNode);
626 else
627 return nullptr;
630 static OUString lcl_dbg_out(const SwUndo & rUndo)
632 return "[ " + OUString::number(static_cast<int>(rUndo.GetId()))
633 + ": " + rUndo.GetComment() + " ]";
636 const char * dbg_out(const SwUndo & rUndo)
638 return dbg_out(lcl_dbg_out(rUndo));
641 static OUString lcl_dbg_out(SwOutlineNodes const & rNodes)
643 OUStringBuffer aStr("[\n");
645 for (size_t i = 0; i < rNodes.size(); i++)
647 aStr.append(lcl_dbg_out(*rNodes[i]) + "\n");
650 aStr.append("]\n");
652 return aStr.makeStringAndClear();
655 const char * dbg_out( SwOutlineNodes const & rNodes)
657 return dbg_out(lcl_dbg_out(rNodes));
660 static OUString lcl_dbg_out(const SvxNumberFormat & rFormat)
662 OUString aResult = lcl_dbg_out_NumType(rFormat.GetNumberingType());
663 return aResult;
666 static OUString lcl_dbg_out(const SwNumRule & rRule)
668 OUStringBuffer aResult("[ " + rRule.GetName() + " [");
670 for (sal_uInt8 n = 0; n < MAXLEVEL; n++)
672 if (n > 0)
673 aResult.append(", ");
675 aResult.append(lcl_dbg_out(rRule.Get(n)));
678 aResult.append("]]");
680 return aResult.makeStringAndClear();
683 const char * dbg_out(const SwNumRule & rRule)
685 return dbg_out(lcl_dbg_out(rRule));
688 static OUString lcl_dbg_out(const SwTextFormatColl & rFormat)
690 return rFormat.GetName() + "(" +
691 OUString::number(rFormat.GetAttrOutlineLevel()) + ")";
694 const char * dbg_out(const SwTextFormatColl & rFormat)
696 return dbg_out(lcl_dbg_out(rFormat));
699 static OUString lcl_dbg_out(const sw::FrameFormats<sw::SpzFrameFormat*>& rFrameFormats)
701 return lcl_dbg_out_SvPtrArr<sw::FrameFormats<sw::SpzFrameFormat*>>(rFrameFormats);
704 const char * dbg_out(const sw::FrameFormats<sw::SpzFrameFormat*>& rFrameFormats)
706 return dbg_out(lcl_dbg_out(rFrameFormats));
709 static OUString lcl_dbg_out(const SwNumRuleTable & rTable)
711 OUStringBuffer aResult("[");
713 for (size_t n = 0; n < rTable.size(); n++)
715 if (n > 0)
716 aResult.append(", ");
718 aResult.append(rTable[n]->GetName());
720 aResult.append("(" + OUString::number(reinterpret_cast<sal_uIntPtr>(rTable[n]), 16) + ")");
723 aResult.append("]");
725 return aResult.makeStringAndClear();
728 const char * dbg_out(const SwNumRuleTable & rTable)
730 return dbg_out(lcl_dbg_out(rTable));
733 static OUString lcl_TokenType2Str(FormTokenType nType)
735 switch(nType)
737 case TOKEN_ENTRY_NO:
738 return "NO";
739 case TOKEN_ENTRY_TEXT:
740 return "ENTRY_TEXT";
741 case TOKEN_ENTRY:
742 return "ENTRY";
743 case TOKEN_TAB_STOP:
744 return "TAB_STOP";
745 case TOKEN_TEXT:
746 return "TOKEN_TEXT";
747 case TOKEN_PAGE_NUMS:
748 return "NUMS";
749 case TOKEN_CHAPTER_INFO:
750 return "CHAPTER_INFO";
751 case TOKEN_LINK_START:
752 return "LINK_START";
753 case TOKEN_LINK_END:
754 return "LINK_END";
755 case TOKEN_AUTHORITY:
756 return "AUTHORITY";
757 case TOKEN_END:
758 return "END";
759 default:
760 OSL_FAIL("should not be reached");
761 return "??";
765 static OUString lcl_dbg_out(const SwFormToken & rToken)
767 return rToken.GetString();
770 const char * dbg_out(const SwFormToken & rToken)
772 return dbg_out(lcl_dbg_out(rToken));
775 static OUString lcl_dbg_out(const SwFormTokens & rTokens)
777 OUStringBuffer aStr("[");
779 SwFormTokens::const_iterator aIt;
781 for (aIt = rTokens.begin(); aIt != rTokens.end(); ++aIt)
783 if (aIt != rTokens.begin())
784 aStr.append(", ");
786 aStr.append(lcl_TokenType2Str(aIt->eTokenType) + ": " + lcl_dbg_out(*aIt));
789 aStr.append("]");
791 return aStr.makeStringAndClear();
794 const char * dbg_out(const SwFormTokens & rTokens)
796 return dbg_out(lcl_dbg_out(rTokens));
799 static OUString lcl_dbg_out(const SwNodeRange & rRange)
801 OUString aStr =
802 "[" +
803 lcl_dbg_out(SwPosition(rRange.aStart)) +
804 ", " +
805 lcl_dbg_out(SwPosition(rRange.aEnd)) +
806 "]";
808 return aStr;
811 const char * dbg_out(const SwNodeRange & rRange)
813 return dbg_out(lcl_dbg_out(rRange));
816 #endif // DEBUG
818 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */