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