LibreOffice Module sw (master)  1
dbgoutsw.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifdef DBG_UTIL
21 
22 #include <osl/diagnose.h>
23 #include <rtl/ustring.hxx>
24 #include <svl/poolitem.hxx>
25 #include <svl/itemiter.hxx>
26 #include <string>
27 #include <map>
28 #include <node.hxx>
29 #include <ndtxt.hxx>
30 #include <ndhints.hxx>
31 #include <txatbase.hxx>
32 #include <pam.hxx>
33 #include <docary.hxx>
34 #include <swundo.hxx>
35 #include <undobj.hxx>
36 #include <numrule.hxx>
37 #include <doc.hxx>
38 #include <frmfmt.hxx>
39 #include <fmtanchr.hxx>
40 #include <swrect.hxx>
41 #include <ndarr.hxx>
42 #include <paratr.hxx>
43 #include <SwNodeNum.hxx>
44 #include <dbgoutsw.hxx>
45 #include <iostream>
46 #include <cstdio>
47 
48 using namespace std;
49 
50 static OString aDbgOutResult;
51 bool bDbgOutStdErr = false;
52 bool bDbgOutPrintAttrSet = false;
53 
54 template<class T>
55 static OUString lcl_dbg_out_SvPtrArr(const T & rArr)
56 {
57  OUStringBuffer aStr("[ ");
58 
59  for (typename T::const_iterator i(rArr.begin()); i != rArr.end(); ++i)
60  {
61  if (i != rArr.begin())
62  aStr.append(", ");
63 
64  if (*i)
65  aStr.append(lcl_dbg_out(**i));
66  else
67  aStr.append("(null)");
68  }
69 
70  aStr.append(" ]");
71 
72  return aStr.makeStringAndClear();
73 }
74 
75 const char * dbg_out(const void * pVoid)
76 {
77  char sBuffer[1024];
78 
79  sprintf(sBuffer, "%p", pVoid);
80 
81  OUString aTmpStr(sBuffer, strlen(sBuffer), RTL_TEXTENCODING_ASCII_US);
82 
83  return dbg_out(aTmpStr);
84 }
85 
86 const char * dbg_out(const OUString & aStr)
87 {
88  aDbgOutResult = OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US);
89 
90  if (bDbgOutStdErr)
91  fprintf(stderr, "%s", aDbgOutResult.getStr());
92 
93  return aDbgOutResult.getStr();
94 }
95 
96 static map<sal_uInt16,OUString> & GetItemWhichMap()
97 {
98  static map<sal_uInt16,OUString> aItemWhichMap
99  {
100  { RES_CHRATR_CASEMAP , "CHRATR_CASEMAP" },
101  { RES_CHRATR_CHARSETCOLOR , "CHRATR_CHARSETCOLOR" },
102  { RES_CHRATR_COLOR , "CHRATR_COLOR" },
103  { RES_CHRATR_CONTOUR , "CHRATR_CONTOUR" },
104  { RES_CHRATR_CROSSEDOUT , "CHRATR_CROSSEDOUT" },
105  { RES_CHRATR_ESCAPEMENT , "CHRATR_ESCAPEMENT" },
106  { RES_CHRATR_FONT , "CHRATR_FONT" },
107  { RES_CHRATR_FONTSIZE , "CHRATR_FONTSIZE" },
108  { RES_CHRATR_KERNING , "CHRATR_KERNING" },
109  { RES_CHRATR_LANGUAGE , "CHRATR_LANGUAGE" },
110  { RES_CHRATR_POSTURE , "CHRATR_POSTURE" },
111  { RES_CHRATR_SHADOWED , "CHRATR_SHADOWED" },
112  { RES_CHRATR_UNDERLINE , "CHRATR_UNDERLINE" },
113  { RES_CHRATR_OVERLINE , "CHRATR_OVERLINE" },
114  { RES_CHRATR_WEIGHT , "CHRATR_WEIGHT" },
115  { RES_CHRATR_WORDLINEMODE , "CHRATR_WORDLINEMODE" },
116  { RES_CHRATR_AUTOKERN , "CHRATR_AUTOKERN" },
117  { RES_CHRATR_BLINK , "CHRATR_BLINK" },
118  { RES_CHRATR_NOHYPHEN , "CHRATR_NOHYPHEN" },
119  { RES_CHRATR_BACKGROUND , "CHRATR_BACKGROUND" },
120  { RES_CHRATR_HIGHLIGHT , "CHRATR_HIGHLIGHT" },
121  { RES_CHRATR_CJK_FONT , "CHRATR_CJK_FONT" },
122  { RES_CHRATR_CJK_FONTSIZE , "CHRATR_CJK_FONTSIZE" },
123  { RES_CHRATR_CJK_LANGUAGE , "CHRATR_CJK_LANGUAGE" },
124  { RES_CHRATR_CJK_POSTURE , "CHRATR_CJK_POSTURE" },
125  { RES_CHRATR_CJK_WEIGHT , "CHRATR_CJK_WEIGHT" },
126  { RES_CHRATR_CTL_FONT , "CHRATR_CTL_FONT" },
127  { RES_CHRATR_CTL_FONTSIZE , "CHRATR_CTL_FONTSIZE" },
128  { RES_CHRATR_CTL_LANGUAGE , "CHRATR_CTL_LANGUAGE" },
129  { RES_CHRATR_CTL_POSTURE , "CHRATR_CTL_POSTURE" },
130  { RES_CHRATR_CTL_WEIGHT , "CHRATR_CTL_WEIGHT" },
131  { RES_CHRATR_ROTATE , "CHRATR_ROTATE" },
132  { RES_CHRATR_EMPHASIS_MARK , "CHRATR_EMPHASIS_MARK" },
133  { RES_CHRATR_TWO_LINES , "CHRATR_TWO_LINES" },
134  { RES_CHRATR_SCALEW , "CHRATR_SCALEW" },
135  { RES_CHRATR_RELIEF , "CHRATR_RELIEF" },
136  { RES_CHRATR_HIDDEN , "CHRATR_HIDDEN" },
137  { RES_CHRATR_BOX , "CHRATR_BOX" },
138  { RES_CHRATR_SHADOW , "CHRATR_SHADOW" },
139  { RES_TXTATR_AUTOFMT , "TXTATR_AUTOFMT" },
140  { RES_TXTATR_INETFMT , "TXTATR_INETFMT" },
141  { RES_TXTATR_REFMARK , "TXTATR_REFMARK" },
142  { RES_TXTATR_TOXMARK , "TXTATR_TOXMARK" },
143  { RES_TXTATR_CHARFMT , "TXTATR_CHARFMT" },
144  { RES_TXTATR_INPUTFIELD , "RES_TXTATR_INPUTFIELD" },
145  { RES_TXTATR_CJK_RUBY , "TXTATR_CJK_RUBY" },
146  { RES_TXTATR_UNKNOWN_CONTAINER , "TXTATR_UNKNOWN_CONTAINER" },
147  { RES_TXTATR_META , "TXTATR_META" },
148  { RES_TXTATR_METAFIELD , "TXTATR_METAFIELD" },
149  { RES_TXTATR_FIELD , "TXTATR_FIELD" },
150  { RES_TXTATR_FLYCNT , "TXTATR_FLYCNT" },
151  { RES_TXTATR_FTN , "TXTATR_FTN" },
152  { RES_TXTATR_ANNOTATION , "TXTATR_ANNOTATION" },
153  { RES_TXTATR_DUMMY3 , "TXTATR_DUMMY3" },
154  { RES_TXTATR_DUMMY1 , "TXTATR_DUMMY1" },
155  { RES_TXTATR_DUMMY2 , "TXTATR_DUMMY2" },
156  { RES_PARATR_LINESPACING , "PARATR_LINESPACING" },
157  { RES_PARATR_ADJUST , "PARATR_ADJUST" },
158  { RES_PARATR_SPLIT , "PARATR_SPLIT" },
159  { RES_PARATR_ORPHANS , "PARATR_ORPHANS" },
160  { RES_PARATR_WIDOWS , "PARATR_WIDOWS" },
161  { RES_PARATR_TABSTOP , "PARATR_TABSTOP" },
162  { RES_PARATR_HYPHENZONE , "PARATR_HYPHENZONE" },
163  { RES_PARATR_DROP , "PARATR_DROP" },
164  { RES_PARATR_REGISTER , "PARATR_REGISTER" },
165  { RES_PARATR_NUMRULE , "PARATR_NUMRULE" },
166  { RES_PARATR_SCRIPTSPACE , "PARATR_SCRIPTSPACE" },
167  { RES_PARATR_HANGINGPUNCTUATION , "PARATR_HANGINGPUNCTUATION" },
168  { RES_PARATR_FORBIDDEN_RULES , "PARATR_FORBIDDEN_RULES" },
169  { RES_PARATR_VERTALIGN , "PARATR_VERTALIGN" },
170  { RES_PARATR_SNAPTOGRID , "PARATR_SNAPTOGRID" },
171  { RES_PARATR_CONNECT_BORDER , "PARATR_CONNECT_BORDER" },
172  { RES_FILL_ORDER , "FILL_ORDER" },
173  { RES_FRM_SIZE , "FRM_SIZE" },
174  { RES_PAPER_BIN , "PAPER_BIN" },
175  { RES_LR_SPACE , "LR_SPACE" },
176  { RES_UL_SPACE , "UL_SPACE" },
177  { RES_PAGEDESC , "PAGEDESC" },
178  { RES_BREAK , "BREAK" },
179  { RES_CNTNT , "CNTNT" },
180  { RES_HEADER , "HEADER" },
181  { RES_FOOTER , "FOOTER" },
182  { RES_PRINT , "PRINT" },
183  { RES_OPAQUE , "OPAQUE" },
184  { RES_PROTECT , "PROTECT" },
185  { RES_SURROUND , "SURROUND" },
186  { RES_VERT_ORIENT , "VERT_ORIENT" },
187  { RES_HORI_ORIENT , "HORI_ORIENT" },
188  { RES_ANCHOR , "ANCHOR" },
189  { RES_BACKGROUND , "BACKGROUND" },
190  { RES_BOX , "BOX" },
191  { RES_SHADOW , "SHADOW" },
192  { RES_FRMMACRO , "FRMMACRO" },
193  { RES_COL , "COL" },
194  { RES_KEEP , "KEEP" },
195  { RES_URL , "URL" },
196  { RES_EDIT_IN_READONLY , "EDIT_IN_READONLY" },
197  { RES_LAYOUT_SPLIT , "LAYOUT_SPLIT" },
198  { RES_CHAIN , "CHAIN" },
199  { RES_TEXTGRID , "TEXTGRID" },
200  { RES_LINENUMBER , "LINENUMBER" },
201  { RES_FTN_AT_TXTEND , "FTN_AT_TXTEND" },
202  { RES_END_AT_TXTEND , "END_AT_TXTEND" },
203  { RES_COLUMNBALANCE , "COLUMNBALANCE" },
204  { RES_FRAMEDIR , "FRAMEDIR" },
205  { RES_HEADER_FOOTER_EAT_SPACING , "HEADER_FOOTER_EAT_SPACING" },
206  { RES_ROW_SPLIT , "ROW_SPLIT" },
207  { RES_GRFATR_MIRRORGRF , "GRFATR_MIRRORGRF" },
208  { RES_GRFATR_CROPGRF , "GRFATR_CROPGRF" },
209  { RES_GRFATR_ROTATION , "GRFATR_ROTATION" },
210  { RES_GRFATR_LUMINANCE , "GRFATR_LUMINANCE" },
211  { RES_GRFATR_CONTRAST , "GRFATR_CONTRAST" },
212  { RES_GRFATR_CHANNELR , "GRFATR_CHANNELR" },
213  { RES_GRFATR_CHANNELG , "GRFATR_CHANNELG" },
214  { RES_GRFATR_CHANNELB , "GRFATR_CHANNELB" },
215  { RES_GRFATR_GAMMA , "GRFATR_GAMMA" },
216  { RES_GRFATR_INVERT , "GRFATR_INVERT" },
217  { RES_GRFATR_TRANSPARENCY , "GRFATR_TRANSPARENCY" },
218  { RES_GRFATR_DRAWMODE , "GRFATR_DRAWMODE" },
219  { RES_BOXATR_FORMAT , "BOXATR_FORMAT" },
220  { RES_BOXATR_FORMULA , "BOXATR_FORMULA" },
221  { RES_BOXATR_VALUE , "BOXATR_VALUE" },
222  };
223 
224  return aItemWhichMap;
225 }
226 
227 static OUString lcl_dbg_out(const SfxPoolItem & rItem)
228 {
229  OUString aStr("[ ");
230 
231  if (GetItemWhichMap().find(rItem.Which()) != GetItemWhichMap().end())
232  aStr += GetItemWhichMap()[rItem.Which()];
233  else
234  aStr += OUString::number(rItem.Which());
235 
236  aStr += " ]";
237 
238  return aStr;
239 }
240 
241 const char * dbg_out(const SfxPoolItem & rItem)
242 {
243  return dbg_out(lcl_dbg_out(rItem));
244 }
245 
246 const char * dbg_out(const SfxPoolItem * pItem)
247 {
248  return dbg_out(pItem ? lcl_dbg_out(*pItem) : OUString("(nil)"));
249 }
250 
251 static OUString lcl_dbg_out(const SfxItemSet & rSet)
252 {
253  SfxItemIter aIter(rSet);
254  bool bFirst = true;
255  OUStringBuffer aStr = "[ ";
256 
257  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
258  {
259  if (!bFirst)
260  aStr.append(", ");
261 
262  if (reinterpret_cast<sal_uIntPtr>(pItem) != SAL_MAX_SIZE)
263  aStr.append(lcl_dbg_out(*pItem));
264  else
265  aStr.append("invalid");
266 
267  bFirst = false;
268  }
269 
270  aStr.append(" ]");
271 
272  return aStr.makeStringAndClear();
273 }
274 
275 const char * dbg_out(const SfxItemSet & rSet)
276 {
277  return dbg_out(lcl_dbg_out(rSet));
278 }
279 
280 static OUString lcl_dbg_out(const SwTextAttr & rAttr)
281 {
282  OUString aStr =
283  "[ " +
284  OUString::number(rAttr.GetStart()) +
285  "->" +
286  OUString::number(*rAttr.End()) +
287  " " +
288  lcl_dbg_out(rAttr.GetAttr()) +
289  " ]";
290 
291  return aStr;
292 }
293 
294 const char * dbg_out(const SwTextAttr & rAttr)
295 {
296  return dbg_out(lcl_dbg_out(rAttr));
297 }
298 
299 static OUString lcl_dbg_out(const SwpHints & rHints)
300 {
301  OUStringBuffer aStr("[ SwpHints\n");
302 
303  for (size_t i = 0; i < rHints.Count(); ++i)
304  {
305  aStr.append(" ");
306  aStr.append(lcl_dbg_out(*rHints.Get(i)));
307  aStr.append("\n");
308  }
309 
310  aStr.append("]\n");
311 
312  return aStr.makeStringAndClear();
313 }
314 
315 const char * dbg_out(const SwpHints &rHints)
316 {
317  return dbg_out(lcl_dbg_out(rHints));
318 }
319 
320 static OUString lcl_dbg_out(const SwPosition & rPos)
321 {
322  OUString aStr =
323  "( " +
324  OUString::number(rPos.nNode.GetIndex()) +
325  ", " +
326  OUString::number(rPos.nContent.GetIndex()) +
327  ": " +
328  OUString::number(reinterpret_cast<sal_IntPtr>(rPos.nContent.GetIdxReg()), 16) +
329  " )";
330 
331  return aStr;
332 }
333 
334 const char * dbg_out(const SwPosition & rPos)
335 {
336  return dbg_out(lcl_dbg_out(rPos));
337 }
338 
339 static OUString lcl_dbg_out(const SwPaM & rPam)
340 {
341  OUString aStr =
342  "[ Pt: " +
343  lcl_dbg_out(*rPam.GetPoint());
344 
345  if (rPam.HasMark())
346  {
347  aStr += ", Mk: " + lcl_dbg_out(*rPam.GetMark());
348  }
349 
350  aStr += " ]";
351 
352  return aStr;
353 }
354 
355 const char * dbg_out(const SwPaM & rPam)
356 {
357  return dbg_out(lcl_dbg_out(rPam));
358 }
359 
360 static OUString lcl_dbg_out(const SwNodeNum & )
361 {
362  return OUString();/*rNum.ToString();*/
363 }
364 
365 const char * dbg_out(const SwNodeNum & rNum)
366 {
367  return dbg_out(lcl_dbg_out(rNum));
368 }
369 
370 static OUString lcl_dbg_out(const SwRect & rRect)
371 {
372  OUString aResult =
373  "[ [" +
374  OUString::number(rRect.Left()) +
375  ", " +
376  OUString::number(rRect.Top()) +
377  "], [" +
378  OUString::number(rRect.Right()) +
379  ", " +
380  OUString::number(rRect.Bottom()) +
381  "] ]";
382 
383  return aResult;
384 }
385 
386 const char * dbg_out(const SwRect & rRect)
387 {
388  return dbg_out(lcl_dbg_out(rRect));
389 }
390 
391 static OUString lcl_dbg_out(const SwFrameFormat & rFrameFormat)
392 {
393  char sBuffer[256];
394  sprintf(sBuffer, "%p", &rFrameFormat);
395 
396  OUString aResult = "[ " +
397  OUString(sBuffer, strlen(sBuffer), RTL_TEXTENCODING_ASCII_US) +
398  "(" +
399  rFrameFormat.GetName() + ")";
400 
401  if (rFrameFormat.IsAuto())
402  aResult += "*";
403 
404  aResult += " ," + lcl_dbg_out(rFrameFormat.FindLayoutRect()) + " ]";
405 
406  return aResult;
407 }
408 
409 const char * dbg_out(const SwFrameFormat & rFrameFormat)
410 {
411  return dbg_out(lcl_dbg_out(rFrameFormat));
412 }
413 
414 static OUString lcl_AnchoredFrames(const SwNode & rNode)
415 {
416  OUStringBuffer aResult("[");
417 
418  const SwDoc * pDoc = rNode.GetDoc();
419  if (pDoc)
420  {
421  const SwFrameFormats * pFrameFormats = pDoc->GetSpzFrameFormats();
422 
423  if (pFrameFormats)
424  {
425  bool bFirst = true;
426  for (SwFrameFormats::const_iterator i(pFrameFormats->begin());
427  i != pFrameFormats->end(); ++i)
428  {
429  const SwFormatAnchor & rAnchor = (*i)->GetAnchor();
430  const SwPosition * pPos = rAnchor.GetContentAnchor();
431 
432  if (pPos && &pPos->nNode.GetNode() == &rNode)
433  {
434  if (! bFirst)
435  aResult.append(", ");
436 
437  if (*i)
438  aResult.append(lcl_dbg_out(**i));
439  bFirst = false;
440  }
441  }
442  }
443  }
444 
445  aResult.append("]");
446 
447  return aResult.makeStringAndClear();
448 }
449 
450 static OUString lcl_dbg_out_NumType(sal_Int16 nType)
451 {
452  OUString aTmpStr;
453 
454  switch (nType)
455  {
456  case SVX_NUM_NUMBER_NONE:
457  aTmpStr += " NONE";
458 
459  break;
461  aTmpStr += " CHARS_UPPER_LETTER";
462 
463  break;
465  aTmpStr += " CHARS_LOWER_LETTER";
466 
467  break;
468  case SVX_NUM_ROMAN_UPPER:
469  aTmpStr += " ROMAN_UPPER";
470 
471  break;
472  case SVX_NUM_ROMAN_LOWER:
473  aTmpStr += " ROMAN_LOWER";
474 
475  break;
476  case SVX_NUM_ARABIC:
477  aTmpStr += " ARABIC";
478 
479  break;
480  default:
481  aTmpStr += " ??";
482 
483  break;
484  }
485 
486  return aTmpStr;
487 }
488 
489 static OUString lcl_dbg_out(const SwNode & rNode)
490 {
491  char aBuffer[128];
492  sprintf(aBuffer, "%p", &rNode);
493 
494  OUString aTmpStr = "<node "
495  "index=\"" +
496  OUString::number(rNode.GetIndex()) +
497  "\""
498  " serial=\"" +
499  OUString::number(rNode.GetSerial()) +
500  "\""
501  " type=\"" +
502  OUString::number(sal_Int32( rNode.GetNodeType() ) ) +
503  "\""
504  " pointer=\"" +
505  OUString(aBuffer, strlen(aBuffer), RTL_TEXTENCODING_ASCII_US) +
506  "\">";
507 
508  const SwTextNode * pTextNode = rNode.GetTextNode();
509 
510  if (rNode.IsTextNode())
511  {
512  const SfxItemSet * pAttrSet = pTextNode->GetpSwAttrSet();
513 
514  aTmpStr += "<txt>" + (pTextNode->GetText().getLength() > 10 ? pTextNode->GetText().copy(0, 10) : pTextNode->GetText()) + "</txt>";
515 
516  if (rNode.IsTableNode())
517  aTmpStr += "<tbl/>";
518 
519  aTmpStr += "<outlinelevel>" + OUString::number(pTextNode->GetAttrOutlineLevel()-1) + "</outlinelevel>";
520 
521  const SwNumRule * pNumRule = pTextNode->GetNumRule();
522 
523  if (pNumRule != nullptr)
524  {
525  aTmpStr += "<number>";
526  if ( pTextNode->GetNum() )
527  {
528  aTmpStr += lcl_dbg_out(*(pTextNode->GetNum()));
529  }
530  aTmpStr += "</number><rule>" +
531  pNumRule->GetName();
532 
533  const SfxPoolItem * pItem = nullptr;
534 
535  if (pAttrSet && SfxItemState::SET ==
536  pAttrSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem))
537  {
538  aTmpStr += "(" +
539  static_cast<const SwNumRuleItem *>(pItem)->GetValue() + ")*";
540  }
541 
542  const SwNumFormat * pNumFormat = nullptr;
543  aTmpStr += "</rule>";
544 
545  if (pTextNode->GetActualListLevel() > 0)
546  pNumFormat = pNumRule->GetNumFormat( static_cast< sal_uInt16 >(pTextNode->GetActualListLevel()) );
547 
548  if (pNumFormat)
549  {
550  aTmpStr += "<numformat>" +
551  lcl_dbg_out_NumType(pNumFormat->GetNumberingType()) + "</numformat>";
552  }
553  }
554 
555  if (pTextNode->IsCountedInList())
556  aTmpStr += "<counted/>";
557 
558  SwFormatColl * pColl = pTextNode->GetFormatColl();
559 
560  if (pColl)
561  {
562  aTmpStr += "<coll>" + pColl->GetName() + "(";
563 
564  SwTextFormatColl *pTextColl = static_cast<SwTextFormatColl*>(pColl);
565  if (pTextColl->IsAssignedToListLevelOfOutlineStyle())
566  {
567  aTmpStr += OUString::number(pTextColl->GetAssignedOutlineStyleLevel());
568  }
569  else
570  {
571  aTmpStr += OUString::number(-1);
572  }
573 
574  const SwNumRuleItem & rItem =
576  const OUString& sNumruleName = rItem.GetValue();
577 
578  if (!sNumruleName.isEmpty())
579  {
580  aTmpStr += ", " + sNumruleName;
581  }
582  aTmpStr += ")"
583  "</coll>";
584  }
585 
586  SwFormatColl * pCColl = pTextNode->GetCondFormatColl();
587 
588  if (pCColl)
589  {
590  aTmpStr += "<ccoll>" + pCColl->GetName() + "</ccoll>";
591  }
592 
593  aTmpStr += "<frms>" + lcl_AnchoredFrames(rNode) + "</frms>";
594 
596  {
597  aTmpStr += "<attrs>" + lcl_dbg_out(pTextNode->GetSwAttrSet()) + "</attrs>";
598  }
599  }
600  else if (rNode.IsStartNode())
601  {
602  aTmpStr += "<start end=\"";
603 
604  const SwStartNode * pStartNode = dynamic_cast<const SwStartNode *> (&rNode);
605  if (pStartNode != nullptr)
606  aTmpStr += OUString::number(pStartNode->EndOfSectionNode()->GetIndex());
607 
608  aTmpStr += "\"/>";
609  }
610  else if (rNode.IsEndNode())
611  aTmpStr += "<end/>";
612 
613  aTmpStr += "</node>";
614 
615  return aTmpStr;
616 }
617 
618 const char * dbg_out(const SwNode & rNode)
619 {
620  return dbg_out(lcl_dbg_out(rNode));
621 }
622 
623 const char * dbg_out(const SwNode * pNode)
624 {
625  if (nullptr != pNode)
626  return dbg_out(*pNode);
627  else
628  return nullptr;
629 }
630 
631 const char * dbg_out(const SwContentNode * pNode)
632 {
633  if (nullptr != pNode)
634  return dbg_out(*pNode);
635  else
636  return nullptr;
637 }
638 
639 const char * dbg_out(const SwTextNode * pNode)
640 {
641  if (nullptr != pNode)
642  return dbg_out(*pNode);
643  else
644  return nullptr;
645 }
646 
647 static OUString lcl_dbg_out(const SwUndo & rUndo)
648 {
649  return "[ " + OUString::number(static_cast<int>(rUndo.GetId()))
650  + ": " + rUndo.GetComment() + " ]";
651 }
652 
653 const char * dbg_out(const SwUndo & rUndo)
654 {
655  return dbg_out(lcl_dbg_out(rUndo));
656 }
657 
658 static OUString lcl_dbg_out(SwOutlineNodes const & rNodes)
659 {
660  OUStringBuffer aStr("[\n");
661 
662  for (size_t i = 0; i < rNodes.size(); i++)
663  {
664  aStr.append(lcl_dbg_out(*rNodes[i]));
665  aStr.append("\n");
666  }
667 
668  aStr.append("]\n");
669 
670  return aStr.makeStringAndClear();
671 }
672 
673 const char * dbg_out( SwOutlineNodes const & rNodes)
674 {
675  return dbg_out(lcl_dbg_out(rNodes));
676 }
677 
678 static OUString lcl_dbg_out(const SvxNumberFormat & rFormat)
679 {
680  OUString aResult = lcl_dbg_out_NumType(rFormat.GetNumberingType());
681  return aResult;
682 }
683 
684 static OUString lcl_dbg_out(const SwNumRule & rRule)
685 {
686  OUStringBuffer aResult("[ ");
687 
688  aResult.append(rRule.GetName());
689  aResult.append(" [");
690 
691  for (sal_uInt8 n = 0; n < MAXLEVEL; n++)
692  {
693  if (n > 0)
694  aResult.append(", ");
695 
696  aResult.append(lcl_dbg_out(rRule.Get(n)));
697  }
698 
699  aResult.append("]");
700 
701  aResult.append("]");
702 
703  return aResult.makeStringAndClear();
704 }
705 
706 const char * dbg_out(const SwNumRule & rRule)
707 {
708  return dbg_out(lcl_dbg_out(rRule));
709 }
710 
711 static OUString lcl_dbg_out(const SwTextFormatColl & rFormat)
712 {
713  return rFormat.GetName() + "(" +
714  OUString::number(rFormat.GetAttrOutlineLevel()) + ")";
715 }
716 
717 const char * dbg_out(const SwTextFormatColl & rFormat)
718 {
719  return dbg_out(lcl_dbg_out(rFormat));
720 }
721 
722 static OUString lcl_dbg_out(const SwFrameFormats & rFrameFormats)
723 {
724  return lcl_dbg_out_SvPtrArr<SwFrameFormats>(rFrameFormats);
725 }
726 
727 const char * dbg_out(const SwFrameFormats & rFrameFormats)
728 {
729  return dbg_out(lcl_dbg_out(rFrameFormats));
730 }
731 
732 static OUString lcl_dbg_out(const SwNumRuleTable & rTable)
733 {
734  OUStringBuffer aResult("[");
735 
736  for (size_t n = 0; n < rTable.size(); n++)
737  {
738  if (n > 0)
739  aResult.append(", ");
740 
741  aResult.append(rTable[n]->GetName());
742 
743  char sBuffer[256];
744  sprintf(sBuffer, "(%p)", rTable[n]);
745  aResult.appendAscii(sBuffer);
746  }
747 
748  aResult.append("]");
749 
750  return aResult.makeStringAndClear();
751 }
752 
753 const char * dbg_out(const SwNumRuleTable & rTable)
754 {
755  return dbg_out(lcl_dbg_out(rTable));
756 }
757 
758 static OUString lcl_TokenType2Str(FormTokenType nType)
759 {
760  switch(nType)
761  {
762  case TOKEN_ENTRY_NO:
763  return "NO";
764  case TOKEN_ENTRY_TEXT:
765  return "ENTRY_TEXT";
766  case TOKEN_ENTRY:
767  return "ENTRY";
768  case TOKEN_TAB_STOP:
769  return "TAB_STOP";
770  case TOKEN_TEXT:
771  return "TOKEN_TEXT";
772  case TOKEN_PAGE_NUMS:
773  return "NUMS";
774  case TOKEN_CHAPTER_INFO:
775  return "CHAPTER_INFO";
776  case TOKEN_LINK_START:
777  return "LINK_START";
778  case TOKEN_LINK_END:
779  return "LINK_END";
780  case TOKEN_AUTHORITY:
781  return "AUTHORITY";
782  case TOKEN_END:
783  return "END";
784  default:
785  OSL_FAIL("should not be reached");
786  return "??";
787  }
788 }
789 
790 static OUString lcl_dbg_out(const SwFormToken & rToken)
791 {
792  return rToken.GetString();
793 }
794 
795 const char * dbg_out(const SwFormToken & rToken)
796 {
797  return dbg_out(lcl_dbg_out(rToken));
798 }
799 
800 static OUString lcl_dbg_out(const SwFormTokens & rTokens)
801 {
802  OUStringBuffer aStr("[");
803 
804  SwFormTokens::const_iterator aIt;
805 
806  for (aIt = rTokens.begin(); aIt != rTokens.end(); ++aIt)
807  {
808  if (aIt != rTokens.begin())
809  aStr.append(", ");
810 
811  aStr.append(lcl_TokenType2Str(aIt->eTokenType));
812  aStr.append(": ");
813  aStr.append(lcl_dbg_out(*aIt));
814  }
815 
816  aStr.append("]");
817 
818  return aStr.makeStringAndClear();
819 }
820 
821 const char * dbg_out(const SwFormTokens & rTokens)
822 {
823  return dbg_out(lcl_dbg_out(rTokens));
824 }
825 
826 static OUString lcl_dbg_out(const SwNodeRange & rRange)
827 {
828  OUString aStr =
829  "[" +
830  lcl_dbg_out(SwPosition(rRange.aStart)) +
831  ", " +
832  lcl_dbg_out(SwPosition(rRange.aEnd)) +
833  "]";
834 
835  return aStr;
836 }
837 
838 const char * dbg_out(const SwNodeRange & rRange)
839 {
840  return dbg_out(lcl_dbg_out(rRange));
841 }
842 
843 #endif // DEBUG
844 
845 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxNumType GetNumberingType() const
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
std::vector< SwFormToken > SwFormTokens
Vector of tokens.
Definition: tox.hxx:249
Starts a section of nodes in the document model.
Definition: node.hxx:303
#define RES_FTN_AT_TXTEND
Definition: hintids.hxx:224
#define RES_CHRATR_WEIGHT
Definition: hintids.hxx:84
sal_uLong GetIndex() const
Definition: node.hxx:282
#define RES_FRM_SIZE
Definition: hintids.hxx:196
#define RES_COL
Definition: hintids.hxx:216
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:587
#define RES_URL
Definition: hintids.hxx:218
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
Marks a position in the document model.
Definition: pam.hxx:35
#define RES_EDIT_IN_READONLY
Definition: hintids.hxx:219
#define RES_END_AT_TXTEND
Definition: hintids.hxx:225
#define RES_CHRATR_CJK_LANGUAGE
Definition: hintids.hxx:93
#define RES_HEADER
Definition: hintids.hxx:203
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr) const
Definition: ndtxt.cxx:3967
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:77
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:79
static OUString lcl_dbg_out_SvPtrArr(const T &rArr)
Definition: dbgoutsw.cxx:55
#define RES_TXTATR_CJK_RUBY
Definition: hintids.hxx:144
#define RES_CHRATR_RELIEF
Definition: hintids.hxx:105
const OUString & GetText() const
Definition: ndtxt.hxx:210
#define RES_TXTATR_METAFIELD
Definition: hintids.hxx:140
#define RES_HORI_ORIENT
Definition: hintids.hxx:210
std::string GetValue
SwFormatColl * GetCondFormatColl() const
Definition: node.hxx:711
SwNodeIndex nNode
Definition: pam.hxx:37
const_iterator begin() const
Definition: docary.hxx:257
#define RES_CHRATR_CJK_POSTURE
Definition: hintids.hxx:94
#define RES_SHADOW
Definition: hintids.hxx:214
#define RES_CHRATR_WORDLINEMODE
Definition: hintids.hxx:85
#define RES_CHRATR_CHARSETCOLOR
Definition: hintids.hxx:71
static OString aDbgOutResult
Definition: dbgoutsw.cxx:50
SVX_NUM_NUMBER_NONE
#define RES_PARATR_VERTALIGN
Definition: hintids.hxx:175
#define RES_PARATR_FORBIDDEN_RULES
Definition: hintids.hxx:174
#define RES_FRAMEDIR
Definition: hintids.hxx:227
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: atrfrm.cxx:2647
const SwPosition * GetMark() const
Definition: pam.hxx:209
#define RES_SURROUND
Definition: hintids.hxx:208
SVX_NUM_CHARS_UPPER_LETTER
Definition: doc.hxx:185
#define RES_TXTATR_UNKNOWN_CONTAINER
Definition: hintids.hxx:145
#define RES_CHRATR_CJK_WEIGHT
Definition: hintids.hxx:95
#define RES_GRFATR_CHANNELB
Definition: hintids.hxx:249
#define RES_CHRATR_FONT
Definition: hintids.hxx:76
SwNode & GetNode() const
Definition: ndindex.hxx:119
const OUString & GetName() const
Definition: numrule.hxx:221
#define RES_PARATR_REGISTER
Definition: hintids.hxx:170
#define RES_CHRATR_BLINK
Definition: hintids.hxx:87
#define RES_CHRATR_CJK_FONT
Definition: hintids.hxx:91
#define RES_CHRATR_CJK_FONTSIZE
Definition: hintids.hxx:92
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
#define RES_TXTATR_CHARFMT
Definition: hintids.hxx:143
#define RES_PARATR_SPLIT
Definition: hintids.hxx:164
const_iterator end() const
Definition: docary.hxx:258
#define RES_CNTNT
Definition: hintids.hxx:202
SwUndoId GetId() const
Definition: undobj.hxx:100
#define RES_PROTECT
Definition: hintids.hxx:207
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4097
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:737
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4032
#define RES_CHRATR_TWO_LINES
Definition: hintids.hxx:103
#define RES_GRFATR_MIRRORGRF
Definition: hintids.hxx:241
static map< sal_uInt16, OUString > & GetItemWhichMap()
Definition: dbgoutsw.cxx:96
OSQLColumns::Vector::const_iterator find(const OSQLColumns::Vector::const_iterator &first, const OSQLColumns::Vector::const_iterator &last, const OUString &_rVal, const ::comphelper::UStringMixEqual &_rCase)
#define RES_PARATR_HANGINGPUNCTUATION
Definition: hintids.hxx:173
#define RES_PARATR_CONNECT_BORDER
Definition: hintids.hxx:177
#define RES_TXTATR_META
Definition: hintids.hxx:139
#define RES_COLUMNBALANCE
Definition: hintids.hxx:226
#define RES_CHAIN
Definition: hintids.hxx:221
const SfxPoolItem * NextItem()
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
void Top(const long nTop)
Definition: swrect.hxx:202
SwNodeType GetNodeType() const
Definition: node.hxx:144
#define RES_CHRATR_CTL_FONTSIZE
Definition: hintids.hxx:97
SwIndex nContent
Definition: pam.hxx:38
SwNodeIndex aStart
Definition: ndindex.hxx:132
static OUString lcl_AnchoredFrames(const SwNode &rNode)
Definition: dbgoutsw.cxx:414
#define RES_PARATR_TABSTOP
Definition: hintids.hxx:167
const OUString & GetName() const
Definition: format.hxx:111
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
SVX_NUM_ARABIC
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
#define RES_GRFATR_LUMINANCE
Definition: hintids.hxx:245
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
bool IsStartNode() const
Definition: node.hxx:624
#define RES_PAPER_BIN
Definition: hintids.hxx:197
SVX_NUM_ROMAN_UPPER
#define RES_UL_SPACE
Definition: hintids.hxx:199
SVX_NUM_ROMAN_LOWER
#define RES_PARATR_NUMRULE
Definition: hintids.hxx:171
#define RES_TXTATR_DUMMY2
Definition: hintids.hxx:157
#define RES_CHRATR_CASEMAP
Definition: hintids.hxx:70
#define RES_PARATR_SNAPTOGRID
Definition: hintids.hxx:176
void Right(const long nRight)
Definition: swrect.hxx:198
#define RES_PRINT
Definition: hintids.hxx:205
size_type size() const
#define RES_GRFATR_CONTRAST
Definition: hintids.hxx:246
#define RES_GRFATR_INVERT
Definition: hintids.hxx:251
Specific frame formats (frames, DrawObjects).
Definition: docary.hxx:201
#define RES_ROW_SPLIT
Definition: hintids.hxx:229
#define RES_BACKGROUND
Definition: hintids.hxx:212
#define RES_CHRATR_COLOR
Definition: hintids.hxx:72
bool bDbgOutStdErr
Definition: dbgoutsw.cxx:51
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
OUString GetString() const
Definition: tox.cxx:647
#define RES_CHRATR_NOHYPHEN
Definition: hintids.hxx:88
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:443
#define RES_FILL_ORDER
Definition: hintids.hxx:195
#define RES_GRFATR_DRAWMODE
Definition: hintids.hxx:253
Style of a layout element.
Definition: frmfmt.hxx:57
#define RES_CHRATR_OVERLINE
Definition: hintids.hxx:107
SVX_NUM_CHARS_LOWER_LETTER
size_t Count() const
Definition: ndhints.hxx:142
#define RES_GRFATR_CHANNELG
Definition: hintids.hxx:248
#define RES_CHRATR_BACKGROUND
Definition: hintids.hxx:90
#define RES_ANCHOR
Definition: hintids.hxx:211
SwTextAttr * Get(size_t nPos) const
Definition: ndhints.hxx:144
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define RES_CHRATR_CTL_FONT
Definition: hintids.hxx:96
const SwPosition * GetPoint() const
Definition: pam.hxx:207
#define RES_CHRATR_BOX
Definition: hintids.hxx:109
#define RES_TXTATR_FTN
Definition: hintids.hxx:153
bool bDbgOutPrintAttrSet
Definition: dbgoutsw.cxx:52
#define RES_GRFATR_ROTATION
Definition: hintids.hxx:244
#define RES_GRFATR_GAMMA
Definition: hintids.hxx:250
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
#define RES_VERT_ORIENT
Definition: hintids.hxx:209
int i
const OUString & GetValue() const
FlyAnchors.
Definition: fmtanchr.hxx:34
#define RES_PARATR_HYPHENZONE
Definition: hintids.hxx:168
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
#define RES_PARATR_ORPHANS
Definition: hintids.hxx:165
SwDoc * GetDoc()
Definition: node.hxx:702
#define RES_PARATR_SCRIPTSPACE
Definition: hintids.hxx:172
#define RES_TXTATR_DUMMY1
Definition: hintids.hxx:156
size_t size() const
Definition: docary.hxx:91
const char * dbg_out(const void *pVoid)
Definition: dbgoutsw.cxx:75
#define RES_LAYOUT_SPLIT
Definition: hintids.hxx:220
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2813
#define RES_CHRATR_UNDERLINE
Definition: hintids.hxx:83
#define RES_TXTATR_TOXMARK
Definition: hintids.hxx:138
#define RES_CHRATR_ESCAPEMENT
Definition: hintids.hxx:75
#define RES_LINENUMBER
Definition: hintids.hxx:223
bool IsEndNode() const
Definition: node.hxx:632
long GetSerial() const
Definition: node.hxx:125
#define RES_BOXATR_VALUE
Definition: hintids.hxx:265
virtual OUString GetComment() const override
Returns textual comment for this undo object.
Definition: undobj.cxx:653
#define RES_TXTATR_INETFMT
Definition: hintids.hxx:142
#define RES_CHRATR_CONTOUR
Definition: hintids.hxx:73
#define RES_CHRATR_KERNING
Definition: hintids.hxx:78
#define RES_LR_SPACE
Definition: hintids.hxx:198
static OUString lcl_dbg_out(const SfxPoolItem &rItem)
Definition: dbgoutsw.cxx:227
#define RES_FOOTER
Definition: hintids.hxx:204
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:77
#define RES_CHRATR_EMPHASIS_MARK
Definition: hintids.hxx:102
#define RES_CHRATR_SHADOW
Definition: hintids.hxx:110
void Left(const long nLeft)
Definition: swrect.hxx:193
#define RES_CHRATR_ROTATE
Definition: hintids.hxx:101
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void Bottom(const long nBottom)
Definition: swrect.hxx:207
#define RES_TXTATR_FIELD
Definition: hintids.hxx:151
#define RES_TXTATR_AUTOFMT
Definition: hintids.hxx:141
An SwTextAttr container, stores all directly formatted text portions for a text node.
Definition: ndhints.hxx:67
#define RES_TEXTGRID
Definition: hintids.hxx:222
ByPos::const_iterator const_iterator
Definition: docary.hxx:215
#define RES_CHRATR_CTL_LANGUAGE
Definition: hintids.hxx:98
unsigned char sal_uInt8
#define RES_CHRATR_POSTURE
Definition: hintids.hxx:80
#define RES_CHRATR_CTL_WEIGHT
Definition: hintids.hxx:100
#define RES_CHRATR_CTL_POSTURE
Definition: hintids.hxx:99
#define RES_TXTATR_ANNOTATION
Definition: hintids.hxx:154
#define RES_GRFATR_CHANNELR
Definition: hintids.hxx:247
#define RES_OPAQUE
Definition: hintids.hxx:206
sal_Int32 GetIndex() const
Definition: index.hxx:95
bool IsCountedInList() const
Definition: ndtxt.cxx:4240
#define RES_HEADER_FOOTER_EAT_SPACING
Definition: hintids.hxx:228
#define RES_KEEP
Definition: hintids.hxx:217
SwNodeIndex aEnd
Definition: ndindex.hxx:133
static OUString lcl_dbg_out_NumType(sal_Int16 nType)
Definition: dbgoutsw.cxx:450
const sal_Int32 * End() const
Definition: txatbase.hxx:148
#define RES_CHRATR_HIGHLIGHT
Definition: hintids.hxx:111
#define RES_GRFATR_CROPGRF
Definition: hintids.hxx:242
#define RES_PARATR_ADJUST
Definition: hintids.hxx:163
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:377
#define RES_GRFATR_TRANSPARENCY
Definition: hintids.hxx:252
#define RES_TXTATR_FLYCNT
Definition: hintids.hxx:152
#define RES_TXTATR_REFMARK
Definition: hintids.hxx:137
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:723
#define RES_CHRATR_SHADOWED
Definition: hintids.hxx:82
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:159
#define RES_PARATR_WIDOWS
Definition: hintids.hxx:166
#define RES_CHRATR_AUTOKERN
Definition: hintids.hxx:86
#define RES_CHRATR_HIDDEN
Definition: hintids.hxx:106
#define RES_BOX
Definition: hintids.hxx:213
#define RES_CHRATR_CROSSEDOUT
Definition: hintids.hxx:74
bool IsTableNode() const
Definition: node.hxx:640
static OUString lcl_TokenType2Str(FormTokenType nType)
Definition: dbgoutsw.cxx:758
SwFormatColl * GetFormatColl() const
Definition: node.hxx:447
#define RES_PARATR_DROP
Definition: hintids.hxx:169
#define RES_TXTATR_DUMMY3
Definition: hintids.hxx:155
#define RES_FRMMACRO
Definition: hintids.hxx:215
#define RES_CHRATR_SCALEW
Definition: hintids.hxx:104
int GetAttrOutlineLevel() const
Definition: fmtcol.cxx:582
const SwIndexReg * GetIdxReg() const
Definition: index.hxx:101
#define RES_PAGEDESC
Definition: hintids.hxx:200
#define RES_BREAK
Definition: hintids.hxx:201
bool IsTextNode() const
Definition: node.hxx:636
#define RES_TXTATR_INPUTFIELD
Definition: hintids.hxx:146
bool IsAuto() const
Query / set AutoFormat-flag.
Definition: format.hxx:158
aStr
FormTokenType
Definition: tox.hxx:191
sal_uInt16 Which() const
#define RES_BOXATR_FORMAT
Definition: hintids.hxx:263
const SfxPoolItem * GetCurItem() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
#define RES_PARATR_LINESPACING
Definition: hintids.hxx:162
#define RES_BOXATR_FORMULA
Definition: hintids.hxx:264
Base class of the Writer document model elements.
Definition: node.hxx:79