1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svtools.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <svtools/xtextedt.hxx> 32*cdf0e10cSrcweir #include <vcl/svapp.hxx> // International 33*cdf0e10cSrcweir #include <unotools/textsearch.hxx> 34*cdf0e10cSrcweir #include <com/sun/star/util/SearchOptions.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/util/SearchFlags.hpp> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir using namespace ::com::sun::star; 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir // ------------------------------------------------------------------------- 42*cdf0e10cSrcweir // class ExtTextEngine 43*cdf0e10cSrcweir // ------------------------------------------------------------------------- 44*cdf0e10cSrcweir ExtTextEngine::ExtTextEngine() : maGroupChars( String::CreateFromAscii( "(){}[]", 6 ) ) 45*cdf0e10cSrcweir { 46*cdf0e10cSrcweir } 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir ExtTextEngine::~ExtTextEngine() 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir } 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir TextSelection aSel( rCursor ); 55*cdf0e10cSrcweir sal_uInt16 nPos = rCursor.GetIndex(); 56*cdf0e10cSrcweir sal_uLong nPara = rCursor.GetPara(); 57*cdf0e10cSrcweir sal_uLong nParas = GetParagraphCount(); 58*cdf0e10cSrcweir if ( ( nPara < nParas ) && ( nPos < GetTextLen( nPara ) ) ) 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir sal_uInt16 nMatchChar = maGroupChars.Search( GetText( rCursor.GetPara() ).GetChar( nPos ) ); 61*cdf0e10cSrcweir if ( nMatchChar != STRING_NOTFOUND ) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir if ( ( nMatchChar % 2 ) == 0 ) 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir // Vorwaerts suchen... 66*cdf0e10cSrcweir sal_Unicode nSC = maGroupChars.GetChar( nMatchChar ); 67*cdf0e10cSrcweir sal_Unicode nEC = maGroupChars.GetChar( nMatchChar+1 ); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir sal_uInt16 nCur = nPos+1; 70*cdf0e10cSrcweir sal_uInt16 nLevel = 1; 71*cdf0e10cSrcweir while ( nLevel && ( nPara < nParas ) ) 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir XubString aStr = GetText( nPara ); 74*cdf0e10cSrcweir while ( nCur < aStr.Len() ) 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir if ( aStr.GetChar( nCur ) == nSC ) 77*cdf0e10cSrcweir nLevel++; 78*cdf0e10cSrcweir else if ( aStr.GetChar( nCur ) == nEC ) 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir nLevel--; 81*cdf0e10cSrcweir if ( !nLevel ) 82*cdf0e10cSrcweir break; // while nCur... 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir nCur++; 85*cdf0e10cSrcweir } 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir if ( nLevel ) 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir nPara++; 90*cdf0e10cSrcweir nCur = 0; 91*cdf0e10cSrcweir } 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir if ( nLevel == 0 ) // gefunden 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir aSel.GetStart() = rCursor; 96*cdf0e10cSrcweir aSel.GetEnd() = TextPaM( nPara, nCur+1 ); 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir } 99*cdf0e10cSrcweir else 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir // Rueckwaerts suchen... 102*cdf0e10cSrcweir xub_Unicode nEC = maGroupChars.GetChar( nMatchChar ); 103*cdf0e10cSrcweir xub_Unicode nSC = maGroupChars.GetChar( nMatchChar-1 ); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir sal_uInt16 nCur = rCursor.GetIndex()-1; 106*cdf0e10cSrcweir sal_uInt16 nLevel = 1; 107*cdf0e10cSrcweir while ( nLevel ) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir if ( GetTextLen( nPara ) ) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir XubString aStr = GetText( nPara ); 112*cdf0e10cSrcweir while ( nCur ) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir if ( aStr.GetChar( nCur ) == nSC ) 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir nLevel--; 117*cdf0e10cSrcweir if ( !nLevel ) 118*cdf0e10cSrcweir break; // while nCur... 119*cdf0e10cSrcweir } 120*cdf0e10cSrcweir else if ( aStr.GetChar( nCur ) == nEC ) 121*cdf0e10cSrcweir nLevel++; 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir nCur--; 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir if ( nLevel ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir if ( nPara ) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir nPara--; 132*cdf0e10cSrcweir nCur = GetTextLen( nPara )-1; // egal ob negativ, weil if Len() 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir else 135*cdf0e10cSrcweir break; 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir if ( nLevel == 0 ) // gefunden 140*cdf0e10cSrcweir { 141*cdf0e10cSrcweir aSel.GetStart() = rCursor; 142*cdf0e10cSrcweir aSel.GetStart().GetIndex()++; // hinter das Zeichen 143*cdf0e10cSrcweir aSel.GetEnd() = TextPaM( nPara, nCur ); 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir return aSel; 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir sal_Bool ExtTextEngine::Search( TextSelection& rSel, const util::SearchOptions& rSearchOptions, sal_Bool bForward ) 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir TextSelection aSel( rSel ); 154*cdf0e10cSrcweir aSel.Justify(); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir sal_Bool bSearchInSelection = (0 != (rSearchOptions.searchFlag & util::SearchFlags::REG_NOT_BEGINOFLINE) ); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir TextPaM aStartPaM( aSel.GetEnd() ); 159*cdf0e10cSrcweir if ( aSel.HasRange() && ( ( bSearchInSelection && bForward ) || ( !bSearchInSelection && !bForward ) ) ) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir aStartPaM = aSel.GetStart(); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir bool bFound = false; 165*cdf0e10cSrcweir sal_uLong nStartNode, nEndNode; 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir if ( bSearchInSelection ) 168*cdf0e10cSrcweir nEndNode = bForward ? aSel.GetEnd().GetPara() : aSel.GetStart().GetPara(); 169*cdf0e10cSrcweir else 170*cdf0e10cSrcweir nEndNode = bForward ? (GetParagraphCount()-1) : 0; 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir nStartNode = aStartPaM.GetPara(); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir util::SearchOptions aOptions( rSearchOptions ); 175*cdf0e10cSrcweir aOptions.Locale = Application::GetSettings().GetLocale(); 176*cdf0e10cSrcweir utl::TextSearch aSearcher( rSearchOptions ); 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir // ueber die Absaetze iterieren... 179*cdf0e10cSrcweir for ( sal_uLong nNode = nStartNode; 180*cdf0e10cSrcweir bForward ? ( nNode <= nEndNode) : ( nNode >= nEndNode ); 181*cdf0e10cSrcweir bForward ? nNode++ : nNode-- ) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir String aText = GetText( nNode ); 184*cdf0e10cSrcweir sal_uInt16 nStartPos = 0; 185*cdf0e10cSrcweir sal_uInt16 nEndPos = aText.Len(); 186*cdf0e10cSrcweir if ( nNode == nStartNode ) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir if ( bForward ) 189*cdf0e10cSrcweir nStartPos = aStartPaM.GetIndex(); 190*cdf0e10cSrcweir else 191*cdf0e10cSrcweir nEndPos = aStartPaM.GetIndex(); 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir if ( ( nNode == nEndNode ) && bSearchInSelection ) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir if ( bForward ) 196*cdf0e10cSrcweir nEndPos = aSel.GetEnd().GetIndex(); 197*cdf0e10cSrcweir else 198*cdf0e10cSrcweir nStartPos = aSel.GetStart().GetIndex(); 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir if ( bForward ) 202*cdf0e10cSrcweir bFound = aSearcher.SearchFrwrd( aText, &nStartPos, &nEndPos ); 203*cdf0e10cSrcweir else 204*cdf0e10cSrcweir bFound = aSearcher.SearchBkwrd( aText, &nEndPos, &nStartPos ); 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir if ( bFound ) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir rSel.GetStart().GetPara() = nNode; 209*cdf0e10cSrcweir rSel.GetStart().GetIndex() = nStartPos; 210*cdf0e10cSrcweir rSel.GetEnd().GetPara() = nNode; 211*cdf0e10cSrcweir rSel.GetEnd().GetIndex() = nEndPos; 212*cdf0e10cSrcweir // Ueber den Absatz selektieren? 213*cdf0e10cSrcweir // Select over the paragraph? 214*cdf0e10cSrcweir // FIXME This should be max long... 215*cdf0e10cSrcweir if( nEndPos == sal::static_int_cast<sal_uInt16>(-1) ) // sal_uInt16 for 0 and -1 ! 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir if ( (rSel.GetEnd().GetPara()+1) < GetParagraphCount() ) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir rSel.GetEnd().GetPara()++; 220*cdf0e10cSrcweir rSel.GetEnd().GetIndex() = 0; 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir else 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir rSel.GetEnd().GetIndex() = nStartPos; 225*cdf0e10cSrcweir bFound = false; 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir break; 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir if ( !bForward && !nNode ) // Bei rueckwaertsuche, wenn nEndNode = 0: 233*cdf0e10cSrcweir break; 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir return bFound; 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir // ------------------------------------------------------------------------- 241*cdf0e10cSrcweir // class ExtTextView 242*cdf0e10cSrcweir // ------------------------------------------------------------------------- 243*cdf0e10cSrcweir ExtTextView::ExtTextView( ExtTextEngine* pEng, Window* pWindow ) 244*cdf0e10cSrcweir : TextView( pEng, pWindow ) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir ExtTextView::~ExtTextView() 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir sal_Bool ExtTextView::MatchGroup() 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir TextSelection aTmpSel( GetSelection() ); 255*cdf0e10cSrcweir aTmpSel.Justify(); 256*cdf0e10cSrcweir if ( ( aTmpSel.GetStart().GetPara() != aTmpSel.GetEnd().GetPara() ) || 257*cdf0e10cSrcweir ( ( aTmpSel.GetEnd().GetIndex() - aTmpSel.GetStart().GetIndex() ) > 1 ) ) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir return sal_False; 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir TextSelection aMatchSel = ((ExtTextEngine*)GetTextEngine())->MatchGroup( aTmpSel.GetStart() ); 263*cdf0e10cSrcweir if ( aMatchSel.HasRange() ) 264*cdf0e10cSrcweir SetSelection( aMatchSel ); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir return aMatchSel.HasRange() ? sal_True : sal_False; 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir sal_Bool ExtTextView::Search( const util::SearchOptions& rSearchOptions, sal_Bool bForward ) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir sal_Bool bFound = sal_False; 272*cdf0e10cSrcweir TextSelection aSel( GetSelection() ); 273*cdf0e10cSrcweir if ( ((ExtTextEngine*)GetTextEngine())->Search( aSel, rSearchOptions, bForward ) ) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir bFound = sal_True; 276*cdf0e10cSrcweir // Erstmal den Anfang des Wortes als Selektion einstellen, 277*cdf0e10cSrcweir // damit das ganze Wort in den sichtbaren Bereich kommt. 278*cdf0e10cSrcweir SetSelection( aSel.GetStart() ); 279*cdf0e10cSrcweir ShowCursor( sal_True, sal_False ); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir else 282*cdf0e10cSrcweir { 283*cdf0e10cSrcweir aSel = GetSelection().GetEnd(); 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir SetSelection( aSel ); 287*cdf0e10cSrcweir ShowCursor(); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir return bFound; 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir sal_uInt16 ExtTextView::Replace( const util::SearchOptions& rSearchOptions, sal_Bool bAll, sal_Bool bForward ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir sal_uInt16 nFound = 0; 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir if ( !bAll ) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir if ( GetSelection().HasRange() ) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir InsertText( rSearchOptions.replaceString ); 301*cdf0e10cSrcweir nFound = 1; 302*cdf0e10cSrcweir Search( rSearchOptions, bForward ); // gleich zum naechsten 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir else 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir if( Search( rSearchOptions, bForward ) ) 307*cdf0e10cSrcweir nFound = 1; 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir else 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir // Der Writer ersetzt alle, vom Anfang bis Ende... 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir ExtTextEngine* pTextEngine = (ExtTextEngine*)GetTextEngine(); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir // HideSelection(); 317*cdf0e10cSrcweir TextSelection aSel; 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir sal_Bool bSearchInSelection = (0 != (rSearchOptions.searchFlag & util::SearchFlags::REG_NOT_BEGINOFLINE) ); 320*cdf0e10cSrcweir if ( bSearchInSelection ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir aSel = GetSelection(); 323*cdf0e10cSrcweir aSel.Justify(); 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir TextSelection aSearchSel( aSel ); 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir sal_Bool bFound = pTextEngine->Search( aSel, rSearchOptions, sal_True ); 329*cdf0e10cSrcweir if ( bFound ) 330*cdf0e10cSrcweir pTextEngine->UndoActionStart(); 331*cdf0e10cSrcweir while ( bFound ) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir nFound++; 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir TextPaM aNewStart = pTextEngine->ImpInsertText( aSel, rSearchOptions.replaceString ); 336*cdf0e10cSrcweir aSel = aSearchSel; 337*cdf0e10cSrcweir aSel.GetStart() = aNewStart; 338*cdf0e10cSrcweir bFound = pTextEngine->Search( aSel, rSearchOptions, sal_True ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir if ( nFound ) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir SetSelection( aSel.GetStart() ); 343*cdf0e10cSrcweir pTextEngine->FormatAndUpdate( this ); 344*cdf0e10cSrcweir pTextEngine->UndoActionEnd(); 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir return nFound; 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir sal_Bool ExtTextView::ImpIndentBlock( sal_Bool bRight ) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir sal_Bool bDone = sal_False; 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir TextSelection aSel = GetSelection(); 355*cdf0e10cSrcweir aSel.Justify(); 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir HideSelection(); 358*cdf0e10cSrcweir GetTextEngine()->UndoActionStart(); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir sal_uLong nStartPara = aSel.GetStart().GetPara(); 361*cdf0e10cSrcweir sal_uLong nEndPara = aSel.GetEnd().GetPara(); 362*cdf0e10cSrcweir if ( aSel.HasRange() && !aSel.GetEnd().GetIndex() ) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir nEndPara--; // den dann nicht einruecken... 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir for ( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ ) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir if ( bRight ) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir // Tabs hinzufuegen 372*cdf0e10cSrcweir GetTextEngine()->ImpInsertText( TextPaM( nPara, 0 ), '\t' ); 373*cdf0e10cSrcweir bDone = sal_True; 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir else 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir // Tabs/Blanks entfernen 378*cdf0e10cSrcweir String aText = GetTextEngine()->GetText( nPara ); 379*cdf0e10cSrcweir if ( aText.Len() && ( 380*cdf0e10cSrcweir ( aText.GetChar( 0 ) == '\t' ) || 381*cdf0e10cSrcweir ( aText.GetChar( 0 ) == ' ' ) ) ) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir GetTextEngine()->ImpDeleteText( TextSelection( TextPaM( nPara, 0 ), TextPaM( nPara, 1 ) ) ); 384*cdf0e10cSrcweir bDone = sal_True; 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir GetTextEngine()->UndoActionEnd(); 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir sal_Bool bRange = aSel.HasRange(); 392*cdf0e10cSrcweir if ( bRight ) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir aSel.GetStart().GetIndex()++; 395*cdf0e10cSrcweir if ( bRange && ( aSel.GetEnd().GetPara() == nEndPara ) ) 396*cdf0e10cSrcweir aSel.GetEnd().GetIndex()++; 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir else 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir if ( aSel.GetStart().GetIndex() ) 401*cdf0e10cSrcweir aSel.GetStart().GetIndex()--; 402*cdf0e10cSrcweir if ( bRange && aSel.GetEnd().GetIndex() ) 403*cdf0e10cSrcweir aSel.GetEnd().GetIndex()--; 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir ImpSetSelection( aSel ); 407*cdf0e10cSrcweir GetTextEngine()->FormatAndUpdate( this ); 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir return bDone; 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir sal_Bool ExtTextView::IndentBlock() 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir return ImpIndentBlock( sal_True ); 415*cdf0e10cSrcweir } 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir sal_Bool ExtTextView::UnindentBlock() 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir return ImpIndentBlock( sal_False ); 420*cdf0e10cSrcweir } 421*cdf0e10cSrcweir 422