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