xref: /AOO41X/main/editeng/source/editeng/editdbg.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_editeng.hxx"
30 
31 #include <vcl/wrkwin.hxx>
32 #include <vcl/dialog.hxx>
33 #include <vcl/msgbox.hxx>
34 #include <vcl/svapp.hxx>
35 
36 #include <editeng/lspcitem.hxx>
37 #include <editeng/lrspitem.hxx>
38 #include <editeng/ulspitem.hxx>
39 #include <editeng/cntritem.hxx>
40 #include <editeng/colritem.hxx>
41 #include <editeng/fhgtitem.hxx>
42 #include <editeng/fontitem.hxx>
43 #include <editeng/adjitem.hxx>
44 #include <editeng/wghtitem.hxx>
45 #include <editeng/postitem.hxx>
46 #include <editeng/udlnitem.hxx>
47 #include <editeng/crsditem.hxx>
48 #include <editeng/shdditem.hxx>
49 #include <editeng/escpitem.hxx>
50 #include <editeng/kernitem.hxx>
51 #include <editeng/wrlmitem.hxx>
52 #include <editeng/akrnitem.hxx>
53 #include <editeng/langitem.hxx>
54 #include <editeng/emphitem.hxx>
55 #include <editeng/numitem.hxx>
56 #include <editeng/tstpitem.hxx>
57 #include <editeng/charscaleitem.hxx>
58 #include <editeng/charreliefitem.hxx>
59 #include <editeng/frmdiritem.hxx>
60 
61 #include <impedit.hxx>
62 #include <editeng/editeng.hxx>
63 #include <editeng/editview.hxx>
64 #include <editdoc.hxx>
65 #include <editdbg.hxx>
66 
67 #if defined( DBG_UTIL ) || ( OSL_DEBUG_LEVEL > 1 )
68 
69 ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem )
70 {
71 	ByteString aDebStr;
72 	switch ( rItem.Which() )
73 	{
74         case EE_PARA_WRITINGDIR:
75 			aDebStr += "WritingDir=";
76 			aDebStr += ByteString::CreateFromInt32( ((SvxFrameDirectionItem&)rItem).GetValue() );
77         break;
78 		case EE_PARA_OUTLLRSPACE:
79 		case EE_PARA_LRSPACE:
80 			aDebStr += "FI=";
81 			aDebStr += ByteString::CreateFromInt32( ((SvxLRSpaceItem&)rItem).GetTxtFirstLineOfst() );
82 			aDebStr += ", LI=";
83 			aDebStr += ByteString::CreateFromInt32( ((SvxLRSpaceItem&)rItem).GetTxtLeft() );
84 			aDebStr += ", RI=";
85 			aDebStr += ByteString::CreateFromInt32( ((SvxLRSpaceItem&)rItem).GetRight() );
86 		break;
87 		case EE_PARA_NUMBULLET:
88 			{
89 			aDebStr += "NumItem ";
90 			for ( sal_uInt16 nLevel = 0; nLevel < 3; nLevel++ )
91 			{
92 				aDebStr += "Level";
93 				aDebStr += ByteString::CreateFromInt32( nLevel );
94 				aDebStr += "=";
95 				const SvxNumberFormat* pFmt = ((const SvxNumBulletItem&)rItem).GetNumRule()->Get( nLevel );
96 				if ( pFmt )
97 				{
98 					aDebStr += "(";
99 					aDebStr += ByteString::CreateFromInt32( pFmt->GetFirstLineOffset() );
100 					aDebStr += ",";
101 					aDebStr += ByteString::CreateFromInt32( pFmt->GetAbsLSpace() );
102 					aDebStr += ",";
103 					if ( pFmt->GetNumberingType() == SVX_NUM_BITMAP )
104 					{
105 						aDebStr += "Bitmap";
106 					}
107 					else if( pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL )
108 					{
109 						aDebStr += "Number";
110 					}
111 					else
112 					{
113 						aDebStr += "Char=[";
114 						aDebStr += ByteString::CreateFromInt32( pFmt->GetBulletChar() );
115 						aDebStr += "]";
116 					}
117 					aDebStr += ") ";
118 				}
119 			}
120 			}
121 		break;
122 		case EE_PARA_BULLETSTATE:
123 			aDebStr += "ShowBullet=";
124 			aDebStr += ByteString::CreateFromInt32( ((SfxBoolItem&)rItem).GetValue() );
125 		break;
126 		case EE_PARA_HYPHENATE:
127 			aDebStr += "Hyphenate=";
128 			aDebStr += ByteString::CreateFromInt32( ((SfxBoolItem&)rItem).GetValue() );
129 		break;
130 		case EE_PARA_OUTLLEVEL:
131 			aDebStr += "Level=";
132 			aDebStr += ByteString::CreateFromInt32( ((SfxInt16Item&)rItem).GetValue() );
133 		break;
134 		case EE_PARA_ULSPACE:
135 			aDebStr += "SB=";
136 			aDebStr += ByteString::CreateFromInt32( ((SvxULSpaceItem&)rItem).GetUpper() );
137 			aDebStr += ", SA=";
138 			aDebStr += ByteString::CreateFromInt32( ((SvxULSpaceItem&)rItem).GetLower() );
139 		break;
140 		case EE_PARA_SBL:
141 			aDebStr += "SBL=";
142 			if ( ((SvxLineSpacingItem&)rItem).GetLineSpaceRule() == SVX_LINE_SPACE_MIN )
143 			{
144 				aDebStr += "Min: ";
145 				aDebStr += ByteString::CreateFromInt32( ((SvxLineSpacingItem&)rItem).GetInterLineSpace() );
146 			}
147 			else if ( ((SvxLineSpacingItem&)rItem).GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP )
148 			{
149 				aDebStr += "Prop: ";
150 				aDebStr += ByteString::CreateFromInt32( (sal_uLong)((SvxLineSpacingItem&)rItem).GetPropLineSpace() );
151 			}
152 			else
153 				aDebStr += "Unsupported Type!";
154 		break;
155 		case EE_PARA_JUST:
156 			aDebStr += "SvxAdust=";
157 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxAdjustItem&)rItem).GetAdjust() );
158 		break;
159 		case EE_PARA_TABS:
160         {
161 			aDebStr += "Tabs: ";
162 	        const SvxTabStopItem& rTabs = (const SvxTabStopItem&) rItem;
163             aDebStr += ByteString::CreateFromInt32( rTabs.Count() );
164             if ( rTabs.Count() )
165             {
166 			    aDebStr += "( ";
167 	            for ( sal_uInt16 i = 0; i < rTabs.Count(); i++ )
168 	            {
169 		            const SvxTabStop& rTab = rTabs[i];
170                     aDebStr += ByteString::CreateFromInt32( rTab.GetTabPos() );
171 			        aDebStr += " ";
172 	            }
173 			    aDebStr += ")";
174             }
175         }
176 		break;
177 		case EE_CHAR_LANGUAGE:
178 		case EE_CHAR_LANGUAGE_CJK:
179 		case EE_CHAR_LANGUAGE_CTL:
180 			aDebStr += "Language=";
181 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxLanguageItem&)rItem).GetLanguage() );
182 		break;
183 		case EE_CHAR_COLOR:
184 		{
185 			aDebStr += "Color= ";
186 			Color aColor( ((SvxColorItem&)rItem).GetValue() );
187 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)aColor.GetRed() );
188 			aDebStr += ", ";
189 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)aColor.GetGreen() );
190 			aDebStr += ", ";
191 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)aColor.GetBlue() );
192 		}
193 		break;
194 		case EE_CHAR_FONTINFO:
195 		case EE_CHAR_FONTINFO_CJK:
196 		case EE_CHAR_FONTINFO_CTL:
197 		{
198 			aDebStr += "Font=";
199 			aDebStr += ByteString( ((SvxFontItem&)rItem).GetFamilyName(), RTL_TEXTENCODING_ASCII_US );
200 			aDebStr += " (CharSet: ";
201 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxFontItem&)rItem).GetCharSet() );
202 			aDebStr += ')';
203 		}
204 		break;
205 		case EE_CHAR_FONTHEIGHT:
206 		case EE_CHAR_FONTHEIGHT_CJK:
207 		case EE_CHAR_FONTHEIGHT_CTL:
208 		{
209 			aDebStr += "Groesse=";
210 			aDebStr += ByteString::CreateFromInt32( ((SvxFontHeightItem&)rItem).GetHeight() );
211 			Size aSz( 0, ((SvxFontHeightItem&)rItem).GetHeight() );
212 			SfxMapUnit eUnit = rPool.GetMetric( rItem.Which() );
213 			MapMode aItemMapMode( (MapUnit) eUnit );
214 			MapMode aPntMap( MAP_POINT );
215 			aSz = OutputDevice::LogicToLogic( aSz, aItemMapMode, aPntMap );
216 			aDebStr += " Points=";
217 			aDebStr += ByteString::CreateFromInt32( aSz.Height() );
218 		}
219 		break;
220 		case EE_CHAR_FONTWIDTH:
221 		{
222 			aDebStr += "Breite=";
223 			aDebStr += ByteString::CreateFromInt32( ((SvxCharScaleWidthItem&)rItem).GetValue() );
224 			aDebStr += "%";
225 		}
226 		break;
227 		case EE_CHAR_WEIGHT:
228 		case EE_CHAR_WEIGHT_CJK:
229 		case EE_CHAR_WEIGHT_CTL:
230 			aDebStr += "FontWeight=";
231 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxWeightItem&)rItem).GetWeight() );
232 		break;
233 		case EE_CHAR_UNDERLINE:
234 			aDebStr += "FontUnderline=";
235 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxUnderlineItem&)rItem).GetLineStyle() );
236 		break;
237 		case EE_CHAR_OVERLINE:
238 			aDebStr += "FontOverline=";
239 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxOverlineItem&)rItem).GetLineStyle() );
240 		break;
241 		case EE_CHAR_EMPHASISMARK:
242 			aDebStr += "FontUnderline=";
243 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxEmphasisMarkItem&)rItem).GetEmphasisMark() );
244 		break;
245 		case EE_CHAR_RELIEF:
246 			aDebStr += "FontRelief=";
247 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxCharReliefItem&)rItem).GetValue() );
248 		break;
249 		case EE_CHAR_STRIKEOUT:
250 			aDebStr += "FontStrikeout=";
251 			aDebStr +=ByteString::CreateFromInt32(  (sal_uInt16)((SvxCrossedOutItem&)rItem).GetStrikeout() );
252 		break;
253 		case EE_CHAR_ITALIC:
254 		case EE_CHAR_ITALIC_CJK:
255 		case EE_CHAR_ITALIC_CTL:
256 			aDebStr += "FontPosture=";
257 			aDebStr +=ByteString::CreateFromInt32(  (sal_uInt16)((SvxPostureItem&)rItem).GetPosture() );
258 		break;
259 		case EE_CHAR_OUTLINE:
260 			aDebStr += "FontOutline=";
261 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxContourItem&)rItem).GetValue() );
262 		break;
263 		case EE_CHAR_SHADOW:
264 			aDebStr += "FontShadowed=";
265 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxShadowedItem&)rItem).GetValue() );
266 		break;
267 		case EE_CHAR_ESCAPEMENT:
268 			aDebStr += "Escape=";
269 			aDebStr += ByteString::CreateFromInt32( (short)((SvxEscapementItem&)rItem).GetEsc() );
270 			aDebStr += ", ";
271 			aDebStr += ByteString::CreateFromInt32( (short)((SvxEscapementItem&)rItem).GetProp() );
272 		break;
273 		case EE_CHAR_PAIRKERNING:
274 			aDebStr += "PairKerning=";
275 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxAutoKernItem&)rItem).GetValue() );
276 		break;
277 		case EE_CHAR_KERNING:
278 		{
279 			aDebStr += "Kerning=";
280 			aDebStr += ByteString::CreateFromInt32( (short)((SvxKerningItem&)rItem).GetValue() );
281 			Size aSz( 0, (short)((SvxKerningItem&)rItem).GetValue() );
282 			SfxMapUnit eUnit = rPool.GetMetric( rItem.Which() );
283 			MapMode aItemMapMode( (MapUnit) eUnit );
284 			MapMode aPntMap( MAP_POINT );
285 			aSz = OutputDevice::LogicToLogic( aSz, aItemMapMode, aPntMap );
286 			aDebStr += " Points=";
287 			aDebStr += ByteString::CreateFromInt32( aSz.Height() );
288 		}
289 		break;
290 		case EE_CHAR_WLM:
291 			aDebStr += "WordLineMode=";
292 			aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxWordLineModeItem&)rItem).GetValue() );
293 		break;
294 		case EE_CHAR_XMLATTRIBS:
295 			aDebStr += "XMLAttribs=...";
296 		break;
297 	}
298 	return aDebStr;
299 }
300 
301 void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, sal_Bool bSearchInParent, sal_Bool bShowALL )
302 {
303 	for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ )
304 	{
305 		fprintf( fp, "\nWhich: %i\t", nWhich );
306 		if ( rSet.GetItemState( nWhich, bSearchInParent ) == SFX_ITEM_OFF )
307 			fprintf( fp, "ITEM_OFF   " );
308 		else if ( rSet.GetItemState( nWhich, bSearchInParent ) == SFX_ITEM_DONTCARE )
309 			fprintf( fp, "ITEM_DC    " );
310 		else if ( rSet.GetItemState( nWhich, bSearchInParent ) == SFX_ITEM_ON )
311 			fprintf( fp, "ITEM_ON   *" );
312 
313 		if ( !bShowALL && ( rSet.GetItemState( nWhich, bSearchInParent ) != SFX_ITEM_ON ) )
314 			continue;
315 
316 		const SfxPoolItem& rItem = rSet.Get( nWhich, bSearchInParent );
317 		ByteString aDebStr = DbgOutItem( *rSet.GetPool(), rItem );
318 		fprintf( fp, "%s", aDebStr.GetBuffer() );
319 	}
320 }
321 
322 void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox )
323 {
324 #if defined UNX
325 	FILE* fp = fopen( "/tmp/debug.log", "w" );
326 #else
327 	FILE* fp = fopen( "d:\\debug.log", "w" );
328 #endif
329 	if ( fp == 0 )
330 	{
331 		DBG_ERROR( "Log-File konnte nicht angelegt werden!" );
332 		return;
333 	}
334 
335 	const SfxItemPool& rPool = *pEE->GetEmptyItemSet().GetPool();
336 
337 	fprintf( fp, "================================================================================" );
338 	fprintf( fp, "\n==================   Dokument   ================================================" );
339 	fprintf( fp, "\n================================================================================" );
340 	for ( sal_uInt16 nPortion = 0; nPortion < pEE->pImpEditEngine->GetParaPortions(). Count(); nPortion++)
341 	{
342 
343 		ParaPortion* pPPortion = pEE->pImpEditEngine->GetParaPortions().GetObject(nPortion );
344 		fprintf( fp, "\nAbsatz %i: Laenge = %i, Invalid = %i\nText = '%s'", nPortion, pPPortion->GetNode()->Len(), pPPortion->IsInvalid(), ByteString( *pPPortion->GetNode(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
345 		fprintf( fp, "\nVorlage:" );
346 		SfxStyleSheet* pStyle = pPPortion->GetNode()->GetStyleSheet();
347 		if ( pStyle )
348 			fprintf( fp, " %s", ByteString( pStyle->GetName(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
349 		fprintf( fp, "\nAbsatzattribute:" );
350 		DbgOutItemSet( fp, pPPortion->GetNode()->GetContentAttribs().GetItems(), sal_False, sal_False );
351 
352 		fprintf( fp, "\nZeichenattribute:" );
353 		sal_Bool bZeroAttr = sal_False;
354 		sal_uInt16 z;
355 		for ( z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); z++ )
356 		{
357 			EditCharAttrib* pAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs().GetObject( z );
358 			ByteString aCharAttribs;
359 			aCharAttribs += "\nA";
360 			aCharAttribs += ByteString::CreateFromInt32( nPortion );
361 			aCharAttribs += ":  ";
362 			aCharAttribs += ByteString::CreateFromInt32( pAttr->GetItem()->Which() );
363 			aCharAttribs += '\t';
364 			aCharAttribs += ByteString::CreateFromInt32( pAttr->GetStart() );
365 			aCharAttribs += '\t';
366 			aCharAttribs += ByteString::CreateFromInt32( pAttr->GetEnd() );
367 			if ( pAttr->IsEmpty() )
368 				bZeroAttr = sal_True;
369 			fprintf( fp, "%s => ", aCharAttribs.GetBuffer() );
370 
371 			ByteString aDebStr = DbgOutItem( rPool, *pAttr->GetItem() );
372 			fprintf( fp, "%s", aDebStr.GetBuffer() );
373 		}
374 		if ( bZeroAttr )
375 			fprintf( fp, "\nNULL-Attribute!" );
376 
377 		sal_uInt16 nTextPortions = pPPortion->GetTextPortions().Count();
378 		ByteString aPortionStr("\nTextportions: #");
379 		aPortionStr += ByteString::CreateFromInt32( nTextPortions );
380 		aPortionStr += " \nA";
381 		aPortionStr += ByteString::CreateFromInt32( nPortion );
382 		aPortionStr += ": Absatzlaenge = ";
383 		aPortionStr += ByteString::CreateFromInt32( pPPortion->GetNode()->Len() );
384 		aPortionStr += "\nA";
385 		aPortionStr += ByteString::CreateFromInt32( nPortion );
386 		aPortionStr += ": ";
387 		sal_uLong n = 0;
388 		for ( z = 0; z < nTextPortions; z++ )
389 		{
390 			TextPortion* pPortion = pPPortion->GetTextPortions().GetObject( z );
391 			aPortionStr += " ";
392 			aPortionStr += ByteString::CreateFromInt32( pPortion->GetLen() );
393 			aPortionStr += "(";
394 			aPortionStr += ByteString::CreateFromInt32( pPortion->GetSize().Width() );
395 			aPortionStr += ")";
396 			aPortionStr += "[";
397 			aPortionStr += ByteString::CreateFromInt32( (sal_uInt16)pPortion->GetKind() );
398 			aPortionStr += "]";
399 			aPortionStr += ";";
400 			n += pPortion->GetLen();
401 		}
402 		aPortionStr += "\nA";
403 		aPortionStr += ByteString::CreateFromInt32( nPortion );
404 		aPortionStr += ": Gesamtlaenge: ";
405 		aPortionStr += ByteString::CreateFromInt32( n );
406 		if ( pPPortion->GetNode()->Len() != n )
407 			aPortionStr += " => Fehler !!!";
408 		fprintf( fp, "%s", aPortionStr.GetBuffer() );
409 
410 
411 		fprintf( fp, "\n\nZeilen:" );
412 		// Erstmal die Inhalte...
413 		sal_uInt16 nLine;
414 		for ( nLine = 0; nLine < pPPortion->GetLines().Count(); nLine++ )
415 		{
416 			EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
417 
418 			ByteString aLine( *(pPPortion->GetNode()), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart(), RTL_TEXTENCODING_ASCII_US );
419 			fprintf( fp, "\nZeile %i\t>%s<", nLine, aLine.GetBuffer() );
420 		}
421 		// dann die internen Daten...
422 		for ( nLine = 0; nLine < pPPortion->GetLines().Count(); nLine++ )
423 		{
424 			EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
425 			fprintf( fp, "\nZeile %i:\tStart: %i,\tEnd: %i", nLine, pLine->GetStart(), pLine->GetEnd() );
426 			fprintf( fp, "\t\tPortions: %i - %i.\tHoehe: %i, Ascent=%i", pLine->GetStartPortion(), pLine->GetEndPortion(), pLine->GetHeight(), pLine->GetMaxAscent() );
427 		}
428 
429 		fprintf( fp, "\n-----------------------------------------------------------------------------" );
430 	}
431 
432 	if ( pEE->pImpEditEngine->GetStyleSheetPool() )
433 	{
434 		sal_uLong nStyles = pEE->pImpEditEngine->GetStyleSheetPool() ? pEE->pImpEditEngine->GetStyleSheetPool()->Count() : 0;
435 		fprintf( fp, "\n\n================================================================================" );
436 		fprintf( fp, "\n==================   Stylesheets   =============================================" );
437 		fprintf( fp, "\n================================================================================" );
438 		fprintf( fp, "\n#Vorlagen:   %lu\n", nStyles );
439 		SfxStyleSheetIterator aIter( pEE->pImpEditEngine->GetStyleSheetPool(), SFX_STYLE_FAMILY_ALL );
440 		SfxStyleSheetBase* pStyle = aIter.First();
441 		while ( pStyle )
442 		{
443 			fprintf( fp, "\nVorlage:   %s", ByteString( pStyle->GetName(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
444 			fprintf( fp, "\nParent:    %s", ByteString( pStyle->GetParent(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
445 			fprintf( fp, "\nFollow:    %s", ByteString( pStyle->GetFollow(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
446 			DbgOutItemSet( fp, pStyle->GetItemSet(), sal_False, sal_False );
447 			fprintf( fp, "\n----------------------------------" );
448 
449 			pStyle = aIter.Next();
450 		}
451 	}
452 
453 	fprintf( fp, "\n\n================================================================================" );
454 	fprintf( fp, "\n==================   Defaults   ================================================" );
455 	fprintf( fp, "\n================================================================================" );
456 	DbgOutItemSet( fp, pEE->pImpEditEngine->GetEmptyItemSet(), sal_True, sal_True );
457 
458 	fprintf( fp, "\n\n================================================================================" );
459 	fprintf( fp, "\n==================   EditEngine & Views   ======================================" );
460 	fprintf( fp, "\n================================================================================" );
461 	fprintf( fp, "\nControl: %"SAL_PRIxUINT32, pEE->GetControlWord() );
462 	fprintf( fp, "\nRefMapMode: %i", pEE->pImpEditEngine->pRefDev->GetMapMode().GetMapUnit() );
463 	fprintf( fp, "\nPaperSize: %li x %li", pEE->GetPaperSize().Width(), pEE->GetPaperSize().Height() );
464 	fprintf( fp, "\nMaxAutoPaperSize: %li x %li", pEE->GetMaxAutoPaperSize().Width(), pEE->GetMaxAutoPaperSize().Height() );
465 	fprintf( fp, "\nMinAutoPaperSize: %li x %li", pEE->GetMinAutoPaperSize().Width(), pEE->GetMinAutoPaperSize().Height() );
466 	fprintf( fp, "\nUpdate: %i", pEE->GetUpdateMode() );
467 	fprintf( fp, "\nAnzahl der Views: %i", pEE->GetViewCount() );
468 	for	( sal_uInt16 nView = 0; nView < pEE->GetViewCount(); nView++ )
469 	{
470 		EditView* pV = pEE->GetView( nView );
471 		DBG_ASSERT( pV, "View nicht gefunden!" );
472 		fprintf( fp, "\nView %i: Focus=%i", nView, pV->GetWindow()->HasFocus() );
473 		Rectangle aR( pV->GetOutputArea() );
474 		fprintf( fp, "\n  OutputArea: nX=%li, nY=%li, dX=%li, dY=%li, MapMode = %i", aR.TopLeft().X(), aR.TopLeft().Y(), aR.GetSize().Width(), aR.GetSize().Height() , pV->GetWindow()->GetMapMode().GetMapUnit() );
475 		aR = pV->GetVisArea();
476 		fprintf( fp, "\n  VisArea: nX=%li, nY=%li, dX=%li, dY=%li", aR.TopLeft().X(), aR.TopLeft().Y(), aR.GetSize().Width(), aR.GetSize().Height() );
477 		ESelection aSel = pV->GetSelection();
478 		fprintf( fp, "\n  Selektion: Start=%u,%u, End=%u,%u", aSel.nStartPara, aSel.nStartPos, aSel.nEndPara, aSel.nEndPos );
479 	}
480 	if ( pEE->GetActiveView() )
481 	{
482 		fprintf( fp, "\n\n================================================================================" );
483 		fprintf( fp, "\n==================   Aktuelle View   ===========================================" );
484 		fprintf( fp, "\n================================================================================" );
485 		DbgOutItemSet( fp, pEE->GetActiveView()->GetAttribs(), sal_True, sal_False );
486 	}
487 	fclose( fp );
488 	if ( bInfoBox )
489 		InfoBox(0, String( RTL_CONSTASCII_USTRINGPARAM( "D:\\DEBUG.LOG !" ) ) ).Execute();
490 }
491 
492 ByteString EditDbg::GetPortionInfo( ParaPortion* pPPortion )
493 {
494 	sal_uInt16 z;
495 
496 	ByteString aDebStr( "Absatzlaenge = " );
497 	aDebStr += ByteString::CreateFromInt32( pPPortion->GetNode()->Len() );
498 
499 	aDebStr += "\nZeichenattribute:";
500 	for ( z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); z++ )
501 	{
502 		EditCharAttrib* pAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs().GetObject( z );
503 		aDebStr += "\n  ";
504 		aDebStr += ByteString::CreateFromInt32( pAttr->GetItem()->Which() );
505 		aDebStr += '\t';
506 		aDebStr += ByteString::CreateFromInt32( pAttr->GetStart() );
507 		aDebStr += '\t';
508 		aDebStr += ByteString::CreateFromInt32( pAttr->GetEnd() );
509 	}
510 
511 	aDebStr += "\nTextportions:";
512 	sal_uInt16 n = 0;
513 	for ( z = 0; z < pPPortion->GetTextPortions().Count(); z++ )
514 	{
515 		TextPortion* pPortion = pPPortion->GetTextPortions().GetObject( z );
516 		aDebStr += " ";
517 		aDebStr += ByteString::CreateFromInt32( pPortion->GetLen() );
518 		aDebStr += "(";
519 		aDebStr += ByteString::CreateFromInt32( pPortion->GetSize().Width() );
520 		aDebStr += ")";
521 		aDebStr += ";";
522 		n = n + pPortion->GetLen();
523 	}
524 	aDebStr += "\nGesamtlaenge: ";
525 	aDebStr += ByteString::CreateFromInt32( n );
526 	aDebStr += "\nSortiert nach Start:";
527 	for ( sal_uInt16 x = 0; x < pPPortion->GetNode()->GetCharAttribs().Count(); x++ )
528 	{
529 		EditCharAttrib* pCurAttrib = pPPortion->GetNode()->GetCharAttribs().GetAttribs().GetObject( x );
530 		aDebStr += "\nStart: ";
531 		aDebStr += ByteString::CreateFromInt32( pCurAttrib->GetStart() );
532 		aDebStr += "\tEnde: ";
533 		aDebStr += ByteString::CreateFromInt32( pCurAttrib->GetEnd() );
534 	}
535 	return aDebStr;
536 }
537 
538 ByteString EditDbg::GetTextPortionInfo( TextPortionList& rPortions )
539 {
540 	ByteString aDebStr;
541 	for ( sal_uInt16 z = 0; z < rPortions.Count(); z++ )
542 	{
543 		TextPortion* pPortion = rPortions.GetObject( z );
544 		aDebStr += " ";
545 		aDebStr += ByteString::CreateFromInt32( pPortion->GetLen() );
546 		aDebStr += "(";
547 		aDebStr += ByteString::CreateFromInt32( pPortion->GetSize().Width() );
548 		aDebStr += ")";
549 		aDebStr += ";";
550 	}
551 	return aDebStr;
552 }
553 
554 void EditDbg::ShowPortionData( ParaPortion* pPortion )
555 {
556 	ByteString aDebStr( GetPortionInfo( pPortion ) );
557 	InfoBox( 0, String( aDebStr, RTL_TEXTENCODING_ASCII_US )  ).Execute();
558 }
559 
560 
561 sal_Bool ParaPortion::DbgCheckTextPortions()
562 {
563 	// pruefen, ob Portionlaenge ok:
564 	sal_uInt16 nXLen = 0;
565 	for ( sal_uInt16 nPortion = 0; nPortion < aTextPortionList.Count(); nPortion++  )
566 		nXLen = nXLen + aTextPortionList[nPortion]->GetLen();
567 	return nXLen == pNode->Len() ? sal_True : sal_False;
568 }
569 
570 sal_Bool CheckOrderedList( CharAttribArray& rAttribs, sal_Bool bStart )
571 {
572 	sal_uInt16 nPrev = 0;
573 	for ( sal_uInt16 nAttr = 0; nAttr < rAttribs.Count(); nAttr++ )
574 	{
575 		EditCharAttrib* pAttr = rAttribs[nAttr];
576 		sal_uInt16 nCur = bStart ? pAttr->GetStart() : pAttr->GetEnd();
577 		if ( nCur < nPrev )
578 			return sal_False;
579 
580 		nPrev = nCur;
581 	}
582 	return sal_True;
583 }
584 
585 #endif
586 
587