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
db_pretty_print(const String * str,int flags,char * fmt)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>
lcl_dbg_out_SvPtrArr(const T & rArr)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
dbg_out(const void * pVoid)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
dbg_out(const String & aStr)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
dbg_out(const::rtl::OUString & aStr)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 {
operator ()CompareUShort117 bool operator()(sal_uInt16 a, sal_uInt16 b) const
118 {
119 return a < b;
120 }
121 };
122
GetItemWhichMap()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_INPUTFIELD] = String("TXTATR_INPUTFIELD", 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_ANNOTATION] = String("TXTATR_ANNOTATION", 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
lcl_dbg_out(const SfxPoolItem & rItem)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
dbg_out(const SfxPoolItem & rItem)272 SW_DLLPUBLIC const char * dbg_out(const SfxPoolItem & rItem)
273 {
274 return dbg_out(lcl_dbg_out(rItem));
275 }
276
dbg_out(const SfxPoolItem * pItem)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
lcl_dbg_out(const SfxItemSet & rSet)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
dbg_out(const SfxItemSet & rSet)312 SW_DLLPUBLIC const char * dbg_out(const SfxItemSet & rSet)
313 {
314 return dbg_out(lcl_dbg_out(rSet));
315 }
316
lcl_dbg_out(const SwTxtAttr & rAttr)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.End());
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
dbg_out(const SwTxtAttr & rAttr)332 SW_DLLPUBLIC const char * dbg_out(const SwTxtAttr & rAttr)
333 {
334 return dbg_out(lcl_dbg_out(rAttr));
335 }
336
lcl_dbg_out(const SwpHints & rHints)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
dbg_out(const SwpHints & rHints)353 SW_DLLPUBLIC const char * dbg_out(const SwpHints &rHints)
354 {
355 return dbg_out(lcl_dbg_out(rHints));
356 }
357
lcl_dbg_out(const SwPosition & rPos)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
dbg_out(const SwPosition & rPos)374 SW_DLLPUBLIC const char * dbg_out(const SwPosition & rPos)
375 {
376 return dbg_out(lcl_dbg_out(rPos));
377 }
378
lcl_dbg_out(const SwPaM & rPam)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
dbg_out(const SwPaM & rPam)396 SW_DLLPUBLIC const char * dbg_out(const SwPaM & rPam)
397 {
398 return dbg_out(lcl_dbg_out(rPam));
399 }
400
lcl_dbg_out(const SwNodeNum &)401 String lcl_dbg_out(const SwNodeNum & )
402 {
403 return String();/*rNum.ToString();*/
404 }
405
dbg_out(const SwNodeNum & rNum)406 SW_DLLPUBLIC const char * dbg_out(const SwNodeNum & rNum)
407 {
408 return dbg_out(lcl_dbg_out(rNum));
409 }
410
lcl_dbg_out(const SwRect & rRect)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
dbg_out(const SwRect & rRect)428 SW_DLLPUBLIC const char * dbg_out(const SwRect & rRect)
429 {
430 return dbg_out(lcl_dbg_out(rRect));
431 }
432
lcl_dbg_out(const SwFrmFmt & rFrmFmt)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
dbg_out(const SwFrmFmt & rFrmFmt)455 SW_DLLPUBLIC const char * dbg_out(const SwFrmFmt & rFrmFmt)
456 {
457 return dbg_out(lcl_dbg_out(rFrmFmt));
458 }
459
lcl_AnchoredFrames(const SwNode & rNode)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
lcl_dbg_out_NumType(sal_Int16 nType)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
lcl_dbg_out(const SwNode & rNode)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)->IsAssignedToListLevelOfOutlineStyle()
639 ? static_cast<SwTxtFmtColl *>(pColl)->GetAssignedOutlineStyleLevel()
640 : 0);//<-end,zhaojianwei
641
642 const SwNumRuleItem & rItem =
643 static_cast<const SwNumRuleItem &>
644 (pColl->GetFmtAttr(RES_PARATR_NUMRULE));
645 const String sNumruleName = rItem.GetValue();
646
647 if (sNumruleName.Len() > 0)
648 {
649 aTmpStr += String(", ", RTL_TEXTENCODING_ASCII_US);
650 aTmpStr += sNumruleName;
651 }
652 aTmpStr += String(")", RTL_TEXTENCODING_ASCII_US);
653 aTmpStr += String("</coll>", RTL_TEXTENCODING_ASCII_US);
654 }
655
656 SwFmtColl * pCColl = pTxtNode->GetCondFmtColl();
657
658 if (pCColl)
659 {
660 aTmpStr += String("<ccoll>", RTL_TEXTENCODING_ASCII_US);
661 aTmpStr += pCColl->GetName();
662 aTmpStr += String("</ccoll>", RTL_TEXTENCODING_ASCII_US);
663 }
664
665 aTmpStr += String("<frms>", RTL_TEXTENCODING_ASCII_US);
666 aTmpStr += lcl_AnchoredFrames(rNode);
667 aTmpStr += String("</frms>", RTL_TEXTENCODING_ASCII_US);
668
669 if (bDbgOutPrintAttrSet)
670 {
671 aTmpStr += String("<attrs>", RTL_TEXTENCODING_ASCII_US);
672 aTmpStr += lcl_dbg_out(pTxtNode->GetSwAttrSet());
673 aTmpStr += String("</attrs>", RTL_TEXTENCODING_ASCII_US);
674 }
675 }
676 else if (rNode.IsStartNode())
677 {
678 aTmpStr += String("<start end=\"", RTL_TEXTENCODING_ASCII_US);
679
680 const SwStartNode * pStartNode = dynamic_cast<const SwStartNode *> (&rNode);
681 if (pStartNode != NULL)
682 aTmpStr += String::CreateFromInt32(pStartNode->EndOfSectionNode()->GetIndex());
683
684 aTmpStr += String("\"/>", RTL_TEXTENCODING_ASCII_US);
685 }
686 else if (rNode.IsEndNode())
687 aTmpStr += String("<end/>", RTL_TEXTENCODING_ASCII_US);
688
689 aTmpStr += String("</node>", RTL_TEXTENCODING_ASCII_US);
690
691 return aTmpStr;
692 }
693
dbg_out(const SwNode & rNode)694 SW_DLLPUBLIC const char * dbg_out(const SwNode & rNode)
695 {
696 return dbg_out(lcl_dbg_out(rNode));
697 }
698
dbg_out(const SwNode * pNode)699 SW_DLLPUBLIC const char * dbg_out(const SwNode * pNode)
700 {
701 if (NULL != pNode)
702 return dbg_out(*pNode);
703 else
704 return NULL;
705 }
706
dbg_out(const SwCntntNode * pNode)707 SW_DLLPUBLIC const char * dbg_out(const SwCntntNode * pNode)
708 {
709 if (NULL != pNode)
710 return dbg_out(*pNode);
711 else
712 return NULL;
713 }
714
dbg_out(const SwTxtNode * pNode)715 SW_DLLPUBLIC const char * dbg_out(const SwTxtNode * pNode)
716 {
717 if (NULL != pNode)
718 return dbg_out(*pNode);
719 else
720 return NULL;
721 }
722
lcl_dbg_add_node(const SwNodePtr & pNode,void * pArgs)723 sal_Bool lcl_dbg_add_node(const SwNodePtr & pNode, void * pArgs)
724 {
725 if (pNode)
726 {
727 (*((String *) pArgs)) += lcl_dbg_out(*pNode);
728 (*((String *) pArgs)) += String("\n", RTL_TEXTENCODING_ASCII_US);
729 }
730
731 //MBA: this code didn't compile, needed to add a return value
732 return sal_True;
733 }
734
lcl_dbg_nodes_inner(String & aStr,SwNodes & rNodes,sal_uLong & nIndex)735 void lcl_dbg_nodes_inner(String & aStr, SwNodes & rNodes, sal_uLong & nIndex)
736 {
737 SwNode * pNode = rNodes[nIndex];
738 SwStartNode * pStartNode = dynamic_cast<SwStartNode *> (pNode);
739
740 SwNode * pEndNode = NULL;
741 if (pStartNode != NULL)
742 pEndNode = pStartNode->EndOfSectionNode();
743
744 sal_uLong nCount = rNodes.Count();
745 sal_uLong nStartIndex = nIndex;
746
747 bool bDone = false;
748
749 String aTag;
750 if (pNode->IsTableNode())
751 aTag += String("table", RTL_TEXTENCODING_ASCII_US);
752 else if (pNode->IsSectionNode())
753 aTag += String("section", RTL_TEXTENCODING_ASCII_US);
754 else
755 aTag += String("nodes", RTL_TEXTENCODING_ASCII_US);
756
757 aStr += String("<", RTL_TEXTENCODING_ASCII_US);
758 aStr += aTag;
759 aStr += String(">", RTL_TEXTENCODING_ASCII_US);
760
761 while (! bDone)
762 {
763 if (pNode->IsStartNode() && nIndex != nStartIndex)
764 lcl_dbg_nodes_inner(aStr, rNodes, nIndex);
765 else
766 {
767 aStr += lcl_dbg_out(*pNode);
768 aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
769
770 nIndex++;
771 }
772
773 if (pNode == pEndNode || nIndex >= nCount)
774 bDone = true;
775 else
776 pNode = rNodes[nIndex];
777 }
778
779 aStr += String("</", RTL_TEXTENCODING_ASCII_US);
780 aStr += aTag;
781 aStr += String(">\n", RTL_TEXTENCODING_ASCII_US);
782 }
783
lcl_dbg_out(SwNodes & rNodes)784 String lcl_dbg_out(SwNodes & rNodes)
785 {
786 String aStr("<nodes-array>", RTL_TEXTENCODING_ASCII_US);
787
788 sal_uLong nIndex = 0;
789 sal_uLong nCount = rNodes.Count();
790
791 while (nIndex < nCount)
792 {
793 lcl_dbg_nodes_inner(aStr, rNodes, nIndex);
794 }
795
796 aStr += String("</nodes-array>\n", RTL_TEXTENCODING_ASCII_US);
797
798 return aStr;
799 }
800
dbg_out(SwNodes & rNodes)801 SW_DLLPUBLIC const char * dbg_out(SwNodes & rNodes)
802 {
803 return dbg_out(lcl_dbg_out(rNodes));
804 }
805
lcl_dbg_out(const SwUndo & rUndo)806 String lcl_dbg_out(const SwUndo & rUndo)
807 {
808 String aStr("[ ", RTL_TEXTENCODING_ASCII_US);
809
810 aStr += String::CreateFromInt32(
811 static_cast<SfxUndoAction const&>(rUndo).GetId());
812 aStr += String(": ", RTL_TEXTENCODING_ASCII_US);
813
814 aStr += rUndo.GetComment();
815 aStr += String(" ]", RTL_TEXTENCODING_ASCII_US);
816
817 return aStr;
818 }
819
dbg_out(const SwUndo & rUndo)820 SW_DLLPUBLIC const char * dbg_out(const SwUndo & rUndo)
821 {
822 return dbg_out(lcl_dbg_out(rUndo));
823 }
824
lcl_dbg_out(SwOutlineNodes & rNodes)825 String lcl_dbg_out(SwOutlineNodes & rNodes)
826 {
827 String aStr("[\n", RTL_TEXTENCODING_ASCII_US);
828
829 for (sal_uInt16 i = 0; i < rNodes.Count(); i++)
830 {
831 aStr += lcl_dbg_out(*rNodes[i]);
832 aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
833 }
834
835 aStr += String("]\n", RTL_TEXTENCODING_ASCII_US);
836
837 return aStr;
838 }
839
dbg_out(SwOutlineNodes & rNodes)840 SW_DLLPUBLIC const char * dbg_out(SwOutlineNodes & rNodes)
841 {
842 return dbg_out(lcl_dbg_out(rNodes));
843 }
844
lcl_dbg_out(const SwRewriter & rRewriter)845 String lcl_dbg_out(const SwRewriter & rRewriter)
846 {
847 (void) rRewriter;
848 String aResult;
849
850 //aResult = rRewriter.ToString();
851
852 return aResult;
853 }
854
dbg_out(const SwRewriter & rRewriter)855 SW_DLLPUBLIC const char * dbg_out(const SwRewriter & rRewriter)
856 {
857 return dbg_out(lcl_dbg_out(rRewriter));
858 }
859
lcl_dbg_out(const SvxNumberFormat & rFmt)860 String lcl_dbg_out(const SvxNumberFormat & rFmt)
861 {
862 String aResult;
863
864 aResult = lcl_dbg_out_NumType(rFmt.GetNumberingType());
865
866 return aResult;
867 }
868
lcl_dbg_out(const SwNumRule & rRule)869 String lcl_dbg_out(const SwNumRule & rRule)
870 {
871 String aResult("[ ", RTL_TEXTENCODING_ASCII_US);
872
873 aResult += rRule.GetName();
874 aResult += String(" [", RTL_TEXTENCODING_ASCII_US);
875
876 for (sal_uInt8 n = 0; n < MAXLEVEL; n++)
877 {
878 if (n > 0)
879 aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
880
881 aResult += lcl_dbg_out(rRule.Get(n));
882 }
883
884 aResult += String("]", RTL_TEXTENCODING_ASCII_US);
885
886 aResult += String("]", RTL_TEXTENCODING_ASCII_US);
887
888 return aResult;
889 }
890
dbg_out(const SwNumRule & rRule)891 SW_DLLPUBLIC const char * dbg_out(const SwNumRule & rRule)
892 {
893 return dbg_out(lcl_dbg_out(rRule));
894 }
895
lcl_dbg_out(const SwTxtFmtColl & rFmt)896 String lcl_dbg_out(const SwTxtFmtColl & rFmt)
897 {
898 String aResult(rFmt.GetName());
899
900 aResult += String("(", RTL_TEXTENCODING_ASCII_US);
901 aResult += String::CreateFromInt32(rFmt.GetAttrOutlineLevel());
902 aResult += String(")", RTL_TEXTENCODING_ASCII_US);
903
904 return aResult;
905 }
906
dbg_out(const SwTxtFmtColl & rFmt)907 SW_DLLPUBLIC const char * dbg_out(const SwTxtFmtColl & rFmt)
908 {
909 return dbg_out(lcl_dbg_out(rFmt));
910 }
911
lcl_dbg_out(const SwFrmFmts & rFrmFmts)912 String lcl_dbg_out(const SwFrmFmts & rFrmFmts)
913 {
914 return lcl_dbg_out_SvPtrArr<SwFrmFmts>(rFrmFmts);
915 }
916
dbg_out(const SwFrmFmts & rFrmFmts)917 SW_DLLPUBLIC const char * dbg_out(const SwFrmFmts & rFrmFmts)
918 {
919 return dbg_out(lcl_dbg_out(rFrmFmts));
920 }
921
lcl_dbg_out(const SwNumRuleTbl & rTbl)922 String lcl_dbg_out(const SwNumRuleTbl & rTbl)
923 {
924 String aResult("[", RTL_TEXTENCODING_ASCII_US);
925
926 for (sal_uInt16 n = 0; n < rTbl.Count(); n++)
927 {
928 if (n > 0)
929 aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
930
931 aResult += rTbl[n]->GetName();
932
933 char sBuffer[256];
934 sprintf(sBuffer, "(%p)", rTbl[n]);
935 aResult += String(sBuffer, RTL_TEXTENCODING_ASCII_US);
936 }
937
938 aResult += String("]", RTL_TEXTENCODING_ASCII_US);
939
940 return aResult;
941 }
942
dbg_out(const SwNumRuleTbl & rTbl)943 SW_DLLPUBLIC const char * dbg_out(const SwNumRuleTbl & rTbl)
944 {
945 return dbg_out(lcl_dbg_out(rTbl));
946 }
947
lcl_TokenType2Str(FormTokenType nType)948 String lcl_TokenType2Str(FormTokenType nType)
949 {
950 switch(nType)
951 {
952 case TOKEN_ENTRY_NO:
953 return String("NO", RTL_TEXTENCODING_ASCII_US);
954 case TOKEN_ENTRY_TEXT:
955 return String("ENTRY_TEXT", RTL_TEXTENCODING_ASCII_US);
956 case TOKEN_ENTRY:
957 return String("ENTRY", RTL_TEXTENCODING_ASCII_US);
958 case TOKEN_TAB_STOP:
959 return String("TAB_STOP", RTL_TEXTENCODING_ASCII_US);
960 case TOKEN_TEXT:
961 return String("TOKEN_TEXT", RTL_TEXTENCODING_ASCII_US);
962 case TOKEN_PAGE_NUMS:
963 return String("NUMS", RTL_TEXTENCODING_ASCII_US);
964 case TOKEN_CHAPTER_INFO:
965 return String("CHAPTER_INFO", RTL_TEXTENCODING_ASCII_US);
966 case TOKEN_LINK_START:
967 return String("LINK_START", RTL_TEXTENCODING_ASCII_US);
968 case TOKEN_LINK_END:
969 return String("LINK_END", RTL_TEXTENCODING_ASCII_US);
970 case TOKEN_AUTHORITY:
971 return String("AUTHORITY", RTL_TEXTENCODING_ASCII_US);
972 case TOKEN_END:
973 return String("END", RTL_TEXTENCODING_ASCII_US);
974 default:
975 return String("??", RTL_TEXTENCODING_ASCII_US);
976 }
977
978 ASSERT(false, "should not be reached");
979
980 return String("??", RTL_TEXTENCODING_ASCII_US);
981 }
982
lcl_dbg_out(const SwFormToken & rToken)983 String lcl_dbg_out(const SwFormToken & rToken)
984 {
985 return rToken.GetString();
986 }
987
dbg_out(const SwFormToken & rToken)988 SW_DLLPUBLIC const char * dbg_out(const SwFormToken & rToken)
989 {
990 return dbg_out(lcl_dbg_out(rToken));
991 }
992
lcl_dbg_out(const SwFormTokens & rTokens)993 String lcl_dbg_out(const SwFormTokens & rTokens)
994 {
995 String aStr("[", RTL_TEXTENCODING_ASCII_US);
996
997 SwFormTokens::const_iterator aIt;
998
999 for (aIt = rTokens.begin(); aIt != rTokens.end(); aIt++)
1000 {
1001 if (aIt != rTokens.begin())
1002 aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
1003
1004 aStr += lcl_TokenType2Str(aIt->eTokenType);
1005 aStr += String(": ", RTL_TEXTENCODING_ASCII_US);
1006 aStr += lcl_dbg_out(*aIt);
1007 }
1008
1009 aStr += String("]" , RTL_TEXTENCODING_ASCII_US);
1010
1011 return aStr;
1012 }
1013
dbg_out(const SwFormTokens & rTokens)1014 SW_DLLPUBLIC const char * dbg_out(const SwFormTokens & rTokens)
1015 {
1016 return dbg_out(lcl_dbg_out(rTokens));
1017 }
1018
lcl_dbg_out(const SwNodeRange & rRange)1019 String lcl_dbg_out(const SwNodeRange & rRange)
1020 {
1021 String aStr("[", RTL_TEXTENCODING_ASCII_US);
1022
1023 aStr += lcl_dbg_out(SwPosition(rRange.aStart));
1024 aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
1025 aStr += lcl_dbg_out(SwPosition(rRange.aEnd));
1026
1027 aStr += String("]" , RTL_TEXTENCODING_ASCII_US);
1028
1029 return aStr;
1030 }
1031
dbg_out(const SwNodeRange & rRange)1032 SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange)
1033 {
1034 return dbg_out(lcl_dbg_out(rRange));
1035 }
1036
1037 #endif // DEBUG
1038
1039