1190118d0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3190118d0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4190118d0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5190118d0SAndrew Rist * distributed with this work for additional information 6190118d0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7190118d0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8190118d0SAndrew Rist * "License"); you may not use this file except in compliance 9190118d0SAndrew Rist * with the License. You may obtain a copy of the License at 10190118d0SAndrew Rist * 11190118d0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12190118d0SAndrew Rist * 13190118d0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14190118d0SAndrew Rist * software distributed under the License is distributed on an 15190118d0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16190118d0SAndrew Rist * KIND, either express or implied. See the License for the 17190118d0SAndrew Rist * specific language governing permissions and limitations 18190118d0SAndrew Rist * under the License. 19190118d0SAndrew Rist * 20190118d0SAndrew Rist *************************************************************/ 21190118d0SAndrew Rist 22190118d0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "precompiled_editeng.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <com/sun/star/i18n/WordType.hpp> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <svl/intitem.hxx> 31cdf0e10cSrcweir #include <editeng/editeng.hxx> 32cdf0e10cSrcweir #include <editeng/editview.hxx> 33cdf0e10cSrcweir #include <editeng/editdata.hxx> 34cdf0e10cSrcweir #include <editeng/eerdll.hxx> 35cdf0e10cSrcweir #include <editeng/lrspitem.hxx> 36cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <svl/style.hxx> 39cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir #define _OUTLINER_CXX 42cdf0e10cSrcweir #include <editeng/outliner.hxx> 43cdf0e10cSrcweir #include <outleeng.hxx> 44cdf0e10cSrcweir #include <paralist.hxx> 45cdf0e10cSrcweir #include <outlundo.hxx> 46cdf0e10cSrcweir #include <editeng/outlobj.hxx> 47cdf0e10cSrcweir #include <editeng/flditem.hxx> 48cdf0e10cSrcweir #include <editeng/flditem.hxx> 49cdf0e10cSrcweir #include <editeng/eeitem.hxx> 50cdf0e10cSrcweir #include <editeng/numitem.hxx> 51cdf0e10cSrcweir #include <vcl/window.hxx> 52cdf0e10cSrcweir #include <svl/itemset.hxx> 53*766ce4d0SZheng Fan #include <svl/eitem.hxx> 54cdf0e10cSrcweir #include <editeng/editstat.hxx> 55cdf0e10cSrcweir 56cdf0e10cSrcweir 57cdf0e10cSrcweir // Breite der Randzonen innerhalb derer beim D&D gescrollt wird 58cdf0e10cSrcweir #define OL_SCROLL_LRBORDERWIDTHPIX 10 59cdf0e10cSrcweir #define OL_SCROLL_TBBORDERWIDTHPIX 10 60cdf0e10cSrcweir 61cdf0e10cSrcweir // Wert, um den Fensterinhalt beim D&D gescrollt wird 62cdf0e10cSrcweir #define OL_SCROLL_HOROFFSET 20 /* in % von VisibleSize.Width */ 63cdf0e10cSrcweir #define OL_SCROLL_VEROFFSET 20 /* in % von VisibleSize.Height */ 64cdf0e10cSrcweir 65cdf0e10cSrcweir using namespace ::com::sun::star; 66cdf0e10cSrcweir 67cdf0e10cSrcweir DBG_NAME(OutlinerView) 68cdf0e10cSrcweir 69cdf0e10cSrcweir 70cdf0e10cSrcweir OutlinerView::OutlinerView( Outliner* pOut, Window* pWin ) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir DBG_CTOR( OutlinerView, 0 ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir pOwner = pOut; 75cdf0e10cSrcweir bDDCursorVisible = sal_False; 76cdf0e10cSrcweir bInDragMode = sal_False; 77cdf0e10cSrcweir nDDScrollLRBorderWidthWin = 0; 78cdf0e10cSrcweir nDDScrollTBBorderWidthWin = 0; 79cdf0e10cSrcweir pHorTabArrDoc = 0; 80cdf0e10cSrcweir 81cdf0e10cSrcweir pEditView = new EditView( pOut->pEditEngine, pWin ); 82cdf0e10cSrcweir pEditView->SetSelectionMode( EE_SELMODE_TXTONLY ); 83cdf0e10cSrcweir } 84cdf0e10cSrcweir 85cdf0e10cSrcweir OutlinerView::~OutlinerView() 86cdf0e10cSrcweir { 87cdf0e10cSrcweir DBG_DTOR(OutlinerView,0); 88cdf0e10cSrcweir delete pEditView; 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91a56bd57bSArmin Le Grand void OutlinerView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice ) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 94cdf0e10cSrcweir 95cdf0e10cSrcweir // beim ersten Paint/KeyInput/Drop wird aus einem leeren Outliner ein 96cdf0e10cSrcweir // Outliner mit genau einem Absatz 97cdf0e10cSrcweir if( pOwner->bFirstParaIsEmpty ) 98cdf0e10cSrcweir pOwner->Insert( String() ); 99cdf0e10cSrcweir 100a56bd57bSArmin Le Grand pEditView->Paint( rRect, pTargetDevice ); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt ) 104cdf0e10cSrcweir { 105cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir // beim ersten Paint/KeyInput/Drop wird aus einem leeren Outliner ein 108cdf0e10cSrcweir // Outliner mit genau einem Absatz 109cdf0e10cSrcweir if( pOwner->bFirstParaIsEmpty ) 110cdf0e10cSrcweir pOwner->Insert( String() ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir 113cdf0e10cSrcweir sal_Bool bKeyProcessed = sal_False; 114cdf0e10cSrcweir ESelection aSel( pEditView->GetSelection() ); 115cdf0e10cSrcweir sal_Bool bSelection = aSel.HasRange(); 116cdf0e10cSrcweir KeyCode aKeyCode = rKEvt.GetKeyCode(); 117cdf0e10cSrcweir KeyFuncType eFunc = aKeyCode.GetFunction(); 118cdf0e10cSrcweir sal_uInt16 nCode = aKeyCode.GetCode(); 119cdf0e10cSrcweir sal_Bool bReadOnly = IsReadOnly(); 120cdf0e10cSrcweir 121cdf0e10cSrcweir if( bSelection && ( nCode != KEY_TAB ) && EditEngine::DoesKeyChangeText( rKEvt ) ) 122cdf0e10cSrcweir { 123cdf0e10cSrcweir if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) ) 124cdf0e10cSrcweir return sal_True; 125cdf0e10cSrcweir } 126cdf0e10cSrcweir 127cdf0e10cSrcweir if ( eFunc != KEYFUNC_DONTKNOW ) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir switch ( eFunc ) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir case KEYFUNC_CUT: 132cdf0e10cSrcweir { 133cdf0e10cSrcweir if ( !bReadOnly ) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir Cut(); 136cdf0e10cSrcweir bKeyProcessed = sal_True; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir } 139cdf0e10cSrcweir break; 140cdf0e10cSrcweir case KEYFUNC_COPY: 141cdf0e10cSrcweir { 142cdf0e10cSrcweir Copy(); 143cdf0e10cSrcweir bKeyProcessed = sal_True; 144cdf0e10cSrcweir } 145cdf0e10cSrcweir break; 146cdf0e10cSrcweir case KEYFUNC_PASTE: 147cdf0e10cSrcweir { 148cdf0e10cSrcweir if ( !bReadOnly ) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir PasteSpecial(); 151cdf0e10cSrcweir bKeyProcessed = sal_True; 152cdf0e10cSrcweir } 153cdf0e10cSrcweir } 154cdf0e10cSrcweir break; 155cdf0e10cSrcweir case KEYFUNC_DELETE: 156cdf0e10cSrcweir { 157cdf0e10cSrcweir if( !bReadOnly && !bSelection && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) ) 158cdf0e10cSrcweir { 159cdf0e10cSrcweir if( aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) ) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir Paragraph* pNext = pOwner->pParaList->GetParagraph( aSel.nEndPara+1 ); 162cdf0e10cSrcweir if( pNext && pNext->HasFlag(PARAFLAG_ISPAGE) ) 163cdf0e10cSrcweir { 164cdf0e10cSrcweir if( !pOwner->ImpCanDeleteSelectedPages( this, aSel.nEndPara, 1 ) ) 165cdf0e10cSrcweir return sal_False; 166cdf0e10cSrcweir } 167cdf0e10cSrcweir } 168cdf0e10cSrcweir } 169cdf0e10cSrcweir } 170cdf0e10cSrcweir break; 171cdf0e10cSrcweir default: // wird dann evtl. unten bearbeitet. 172cdf0e10cSrcweir eFunc = KEYFUNC_DONTKNOW; 173cdf0e10cSrcweir } 174cdf0e10cSrcweir } 175cdf0e10cSrcweir if ( eFunc == KEYFUNC_DONTKNOW ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir switch ( nCode ) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir case KEY_TAB: 180cdf0e10cSrcweir { 181cdf0e10cSrcweir if ( !bReadOnly && !aKeyCode.IsMod1() && !aKeyCode.IsMod2() ) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir if ( ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) && 184cdf0e10cSrcweir ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TITLEOBJECT ) && 185cdf0e10cSrcweir ( bSelection || !aSel.nStartPos ) ) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir Indent( aKeyCode.IsShift() ? (-1) : (+1) ); 188cdf0e10cSrcweir bKeyProcessed = sal_True; 189cdf0e10cSrcweir } 190cdf0e10cSrcweir else if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) && 191cdf0e10cSrcweir !bSelection && !aSel.nEndPos && pOwner->ImplHasBullet( aSel.nEndPara ) ) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir Indent( aKeyCode.IsShift() ? (-1) : (+1) ); 194cdf0e10cSrcweir bKeyProcessed = sal_True; 195cdf0e10cSrcweir } 196cdf0e10cSrcweir } 197cdf0e10cSrcweir } 198cdf0e10cSrcweir break; 199cdf0e10cSrcweir case KEY_BACKSPACE: 200cdf0e10cSrcweir { 201cdf0e10cSrcweir if( !bReadOnly && !bSelection && aSel.nEndPara && !aSel.nEndPos ) 202cdf0e10cSrcweir { 203cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara ); 204cdf0e10cSrcweir Paragraph* pPrev = pOwner->pParaList->GetParagraph( aSel.nEndPara-1 ); 205cdf0e10cSrcweir if( !pPrev->IsVisible() ) 206cdf0e10cSrcweir return sal_True; 207cdf0e10cSrcweir if( !pPara->GetDepth() ) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir if(!pOwner->ImpCanDeleteSelectedPages(this, aSel.nEndPara , 1 ) ) 210cdf0e10cSrcweir return sal_True; 211cdf0e10cSrcweir } 212cdf0e10cSrcweir } 213cdf0e10cSrcweir } 214cdf0e10cSrcweir break; 215cdf0e10cSrcweir case KEY_RETURN: 216cdf0e10cSrcweir { 217cdf0e10cSrcweir if ( !bReadOnly ) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir // Sonderbehandlung: Hartes Return am Ende eines Absatzes, 220cdf0e10cSrcweir // der eingeklappte Unterabsaetze besitzt 221cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara ); 222cdf0e10cSrcweir 223cdf0e10cSrcweir if( !aKeyCode.IsShift() ) 224cdf0e10cSrcweir { 225cdf0e10cSrcweir // Nochmal ImpGetCursor ??? 226cdf0e10cSrcweir if( !bSelection && 227cdf0e10cSrcweir aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) ) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir sal_uLong nChilds = pOwner->pParaList->GetChildCount(pPara); 230cdf0e10cSrcweir if( nChilds && !pOwner->pParaList->HasVisibleChilds(pPara)) 231cdf0e10cSrcweir { 232cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_INSERT ); 233cdf0e10cSrcweir sal_uLong nTemp = aSel.nEndPara; 234cdf0e10cSrcweir nTemp += nChilds; 235cdf0e10cSrcweir nTemp++; // einfuegen ueber naechstem Non-Child 236cdf0e10cSrcweir pOwner->Insert( String(),nTemp,pPara->GetDepth()); 237cdf0e10cSrcweir // Cursor positionieren 238cdf0e10cSrcweir ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0); 239cdf0e10cSrcweir pEditView->SetSelection( aTmpSel ); 240cdf0e10cSrcweir pEditView->ShowCursor( sal_True, sal_True ); 241cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_INSERT ); 242cdf0e10cSrcweir bKeyProcessed = sal_True; 243cdf0e10cSrcweir } 244cdf0e10cSrcweir } 245cdf0e10cSrcweir } 246cdf0e10cSrcweir if( !bKeyProcessed && !bSelection && 247cdf0e10cSrcweir !aKeyCode.IsShift() && aKeyCode.IsMod1() && 248cdf0e10cSrcweir ( aSel.nEndPos == pOwner->pEditEngine->GetTextLen(aSel.nEndPara) ) ) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_INSERT ); 251cdf0e10cSrcweir sal_uLong nTemp = aSel.nEndPara; 252cdf0e10cSrcweir nTemp++; 253cdf0e10cSrcweir pOwner->Insert( String(), nTemp, pPara->GetDepth()+1 ); 254cdf0e10cSrcweir 255cdf0e10cSrcweir // Cursor positionieren 256cdf0e10cSrcweir ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0); 257cdf0e10cSrcweir pEditView->SetSelection( aTmpSel ); 258cdf0e10cSrcweir pEditView->ShowCursor( sal_True, sal_True ); 259cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_INSERT ); 260cdf0e10cSrcweir bKeyProcessed = sal_True; 261cdf0e10cSrcweir } 262cdf0e10cSrcweir } 263cdf0e10cSrcweir } 264cdf0e10cSrcweir break; 265cdf0e10cSrcweir } 266cdf0e10cSrcweir } 267cdf0e10cSrcweir 268cdf0e10cSrcweir return bKeyProcessed ? sal_True : pEditView->PostKeyEvent( rKEvt ); 269cdf0e10cSrcweir } 270cdf0e10cSrcweir 271cdf0e10cSrcweir 272cdf0e10cSrcweir sal_uLong OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget) 273cdf0e10cSrcweir { 274cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 275cdf0e10cSrcweir sal_uLong nPara = EE_PARA_NOT_FOUND; 276cdf0e10cSrcweir 277cdf0e10cSrcweir Point aMousePosWin = pEditView->GetWindow()->PixelToLogic( rPosPix ); 278cdf0e10cSrcweir if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir reTarget = MouseOutside; 281cdf0e10cSrcweir } 282cdf0e10cSrcweir else 283cdf0e10cSrcweir { 284cdf0e10cSrcweir reTarget = MouseText; 285cdf0e10cSrcweir 286cdf0e10cSrcweir Point aPaperPos( aMousePosWin ); 287cdf0e10cSrcweir Rectangle aOutArea = pEditView->GetOutputArea(); 288cdf0e10cSrcweir Rectangle aVisArea = pEditView->GetVisArea(); 289cdf0e10cSrcweir aPaperPos.X() -= aOutArea.Left(); 290cdf0e10cSrcweir aPaperPos.X() += aVisArea.Left(); 291cdf0e10cSrcweir aPaperPos.Y() -= aOutArea.Top(); 292cdf0e10cSrcweir aPaperPos.Y() += aVisArea.Top(); 293cdf0e10cSrcweir 294cdf0e10cSrcweir sal_Bool bBullet; 295cdf0e10cSrcweir if ( pOwner->IsTextPos( aPaperPos, 0, &bBullet ) ) 296cdf0e10cSrcweir { 297cdf0e10cSrcweir Point aDocPos = pOwner->GetDocPos( aPaperPos ); 298cdf0e10cSrcweir nPara = pOwner->pEditEngine->FindParagraph( aDocPos.Y() ); 299cdf0e10cSrcweir 300cdf0e10cSrcweir if ( bBullet ) 301cdf0e10cSrcweir { 302cdf0e10cSrcweir reTarget = MouseBullet; 303cdf0e10cSrcweir } 304cdf0e10cSrcweir else 305cdf0e10cSrcweir { 306cdf0e10cSrcweir // Check for hyperlink 307cdf0e10cSrcweir const SvxFieldItem* pFieldItem = pEditView->GetField( aMousePosWin ); 308cdf0e10cSrcweir if ( pFieldItem && pFieldItem->GetField() && pFieldItem->GetField()->ISA( SvxURLField ) ) 309cdf0e10cSrcweir reTarget = MouseHypertext; 310cdf0e10cSrcweir } 311cdf0e10cSrcweir } 312cdf0e10cSrcweir } 313cdf0e10cSrcweir return nPara; 314cdf0e10cSrcweir } 315cdf0e10cSrcweir 316cdf0e10cSrcweir sal_Bool __EXPORT OutlinerView::MouseMove( const MouseEvent& rMEvt ) 317cdf0e10cSrcweir { 318cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 319cdf0e10cSrcweir 320cdf0e10cSrcweir if( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode()) 321cdf0e10cSrcweir return pEditView->MouseMove( rMEvt ); 322cdf0e10cSrcweir 323cdf0e10cSrcweir Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) ); 324cdf0e10cSrcweir if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) 325cdf0e10cSrcweir return sal_False; 326cdf0e10cSrcweir 327cdf0e10cSrcweir Pointer aPointer = GetPointer( rMEvt.GetPosPixel() ); 328cdf0e10cSrcweir pEditView->GetWindow()->SetPointer( aPointer ); 329cdf0e10cSrcweir return pEditView->MouseMove( rMEvt ); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir 332cdf0e10cSrcweir 333cdf0e10cSrcweir sal_Bool __EXPORT OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 336cdf0e10cSrcweir if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() ) 337cdf0e10cSrcweir return pEditView->MouseButtonDown( rMEvt ); 338cdf0e10cSrcweir 339cdf0e10cSrcweir Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) ); 340cdf0e10cSrcweir if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) 341cdf0e10cSrcweir return sal_False; 342cdf0e10cSrcweir 343cdf0e10cSrcweir Pointer aPointer = GetPointer( rMEvt.GetPosPixel() ); 344cdf0e10cSrcweir pEditView->GetWindow()->SetPointer( aPointer ); 345cdf0e10cSrcweir 346cdf0e10cSrcweir MouseTarget eTarget; 347cdf0e10cSrcweir sal_uLong nPara = ImpCheckMousePos( rMEvt.GetPosPixel(), eTarget ); 348cdf0e10cSrcweir if ( eTarget == MouseBullet ) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 351cdf0e10cSrcweir sal_Bool bHasChilds = (pPara && pOwner->pParaList->HasChilds(pPara)); 352cdf0e10cSrcweir if( rMEvt.GetClicks() == 1 ) 353cdf0e10cSrcweir { 354cdf0e10cSrcweir sal_uLong nEndPara = nPara; 355cdf0e10cSrcweir if ( bHasChilds && pOwner->pParaList->HasVisibleChilds(pPara) ) 356cdf0e10cSrcweir nEndPara += pOwner->pParaList->GetChildCount( pPara ); 357cdf0e10cSrcweir // umgekehrt rum selektieren, damit EditEngine nicht scrollt 358cdf0e10cSrcweir ESelection aSel((sal_uInt16)nEndPara, 0xffff,(sal_uInt16)nPara, 0 ); 359cdf0e10cSrcweir pEditView->SetSelection( aSel ); 360cdf0e10cSrcweir } 361cdf0e10cSrcweir else if( rMEvt.GetClicks() == 2 && bHasChilds ) 362cdf0e10cSrcweir ImpToggleExpand( pPara ); 363cdf0e10cSrcweir 364cdf0e10cSrcweir aDDStartPosPix = rMEvt.GetPosPixel(); 365cdf0e10cSrcweir aDDStartPosRef=pEditView->GetWindow()->PixelToLogic( aDDStartPosPix,pOwner->GetRefMapMode()); 366cdf0e10cSrcweir return sal_True; 367cdf0e10cSrcweir } 368cdf0e10cSrcweir 369cdf0e10cSrcweir // special case for outliner view in impress, check if double click hits the page icon for toggle 370cdf0e10cSrcweir if( (nPara == EE_PARA_NOT_FOUND) && (pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEVIEW) && (eTarget == MouseText) && (rMEvt.GetClicks() == 2) ) 371cdf0e10cSrcweir { 372cdf0e10cSrcweir ESelection aSel( pEditView->GetSelection() ); 373cdf0e10cSrcweir nPara = aSel.nStartPara; 374cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 375cdf0e10cSrcweir if( (pPara && pOwner->pParaList->HasChilds(pPara)) && pPara->HasFlag(PARAFLAG_ISPAGE) ) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir ImpToggleExpand( pPara ); 378cdf0e10cSrcweir } 379cdf0e10cSrcweir } 380cdf0e10cSrcweir return pEditView->MouseButtonDown( rMEvt ); 381cdf0e10cSrcweir } 382cdf0e10cSrcweir 383cdf0e10cSrcweir 384cdf0e10cSrcweir sal_Bool __EXPORT OutlinerView::MouseButtonUp( const MouseEvent& rMEvt ) 385cdf0e10cSrcweir { 386cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 387cdf0e10cSrcweir if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() ) 388cdf0e10cSrcweir return pEditView->MouseButtonUp( rMEvt ); 389cdf0e10cSrcweir 390cdf0e10cSrcweir Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) ); 391cdf0e10cSrcweir if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) 392cdf0e10cSrcweir return sal_False; 393cdf0e10cSrcweir 394cdf0e10cSrcweir Pointer aPointer = GetPointer( rMEvt.GetPosPixel() ); 395cdf0e10cSrcweir pEditView->GetWindow()->SetPointer( aPointer ); 396cdf0e10cSrcweir 397cdf0e10cSrcweir return pEditView->MouseButtonUp( rMEvt ); 398cdf0e10cSrcweir } 399cdf0e10cSrcweir 400cdf0e10cSrcweir void OutlinerView::ImpHideDDCursor() 401cdf0e10cSrcweir { 402cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 403cdf0e10cSrcweir if ( bDDCursorVisible ) 404cdf0e10cSrcweir { 405cdf0e10cSrcweir bDDCursorVisible = sal_False; 406cdf0e10cSrcweir ImpPaintDDCursor(); 407cdf0e10cSrcweir } 408cdf0e10cSrcweir } 409cdf0e10cSrcweir 410cdf0e10cSrcweir void OutlinerView::ImpShowDDCursor() 411cdf0e10cSrcweir { 412cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 413cdf0e10cSrcweir if ( !bDDCursorVisible ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir bDDCursorVisible = sal_True; 416cdf0e10cSrcweir ImpPaintDDCursor(); 417cdf0e10cSrcweir } 418cdf0e10cSrcweir } 419cdf0e10cSrcweir 420cdf0e10cSrcweir void OutlinerView::ImpPaintDDCursor() 421cdf0e10cSrcweir { 422cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 423cdf0e10cSrcweir 424cdf0e10cSrcweir Window* pWindow = pEditView->GetWindow(); 425cdf0e10cSrcweir RasterOp eOldOp = pWindow->GetRasterOp(); 426cdf0e10cSrcweir pWindow->SetRasterOp( ROP_INVERT ); 427cdf0e10cSrcweir 428cdf0e10cSrcweir const Color& rOldLineColor = pWindow->GetLineColor(); 429cdf0e10cSrcweir pWindow->SetLineColor( Color( COL_BLACK ) ); 430cdf0e10cSrcweir 431cdf0e10cSrcweir Point aStartPointWin, aEndPointWin; 432cdf0e10cSrcweir Rectangle aOutputArWin = pEditView->GetOutputArea(); 433cdf0e10cSrcweir Rectangle aVisAreaRef = pEditView->GetVisArea(); 434cdf0e10cSrcweir 435cdf0e10cSrcweir if( bDDChangingDepth ) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir aStartPointWin.X() = pHorTabArrDoc[ nDDCurDepth ]; 438cdf0e10cSrcweir aStartPointWin.X() += aOutputArWin.Left(); 439cdf0e10cSrcweir aStartPointWin.Y() = aOutputArWin.Top(); 440cdf0e10cSrcweir aEndPointWin.X() = aStartPointWin.X(); 441cdf0e10cSrcweir aEndPointWin.Y() = aOutputArWin.Bottom(); 442cdf0e10cSrcweir } 443cdf0e10cSrcweir else 444cdf0e10cSrcweir { 445cdf0e10cSrcweir sal_uLong nPara = nDDCurPara; 446cdf0e10cSrcweir if ( nDDCurPara == LIST_APPEND ) 447cdf0e10cSrcweir { 448cdf0e10cSrcweir Paragraph* pTemp = pOwner->pParaList->LastVisible(); 449cdf0e10cSrcweir nPara = pOwner->pParaList->GetAbsPos( pTemp ); 450cdf0e10cSrcweir } 451cdf0e10cSrcweir aStartPointWin = pEditView->GetWindowPosTopLeft((sal_uInt16) nPara ); 452cdf0e10cSrcweir if ( nDDCurPara == LIST_APPEND ) 453cdf0e10cSrcweir { 454cdf0e10cSrcweir long nHeight = pOwner->pEditEngine->GetTextHeight((sal_uInt16)nPara ); 455cdf0e10cSrcweir aStartPointWin.Y() += nHeight; 456cdf0e10cSrcweir } 457cdf0e10cSrcweir aStartPointWin.X() = aOutputArWin.Left(); 458cdf0e10cSrcweir aEndPointWin.Y() = aStartPointWin.Y(); 459cdf0e10cSrcweir aEndPointWin.X() = aOutputArWin.Right(); 460cdf0e10cSrcweir } 461cdf0e10cSrcweir 462cdf0e10cSrcweir pWindow->DrawLine( aStartPointWin, aEndPointWin ); 463cdf0e10cSrcweir pWindow->SetLineColor( rOldLineColor ); 464cdf0e10cSrcweir pWindow->SetRasterOp( eOldOp ); 465cdf0e10cSrcweir } 466cdf0e10cSrcweir 467cdf0e10cSrcweir // Berechnet, ueber welchem Absatz eingefuegt werden muss 468cdf0e10cSrcweir 469cdf0e10cSrcweir sal_uLong OutlinerView::ImpGetInsertionPara( const Point& rPosPixel ) 470cdf0e10cSrcweir { 471cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 472cdf0e10cSrcweir sal_uLong nCurPara = pEditView->GetParagraph( rPosPixel ); 473cdf0e10cSrcweir ParagraphList* pParaList = pOwner->pParaList; 474cdf0e10cSrcweir 475cdf0e10cSrcweir if ( nCurPara == EE_PARA_NOT_FOUND ) 476cdf0e10cSrcweir nCurPara = LIST_APPEND; 477cdf0e10cSrcweir else 478cdf0e10cSrcweir { 479cdf0e10cSrcweir Point aPosWin = pEditView->GetWindow()->PixelToLogic( rPosPixel ); 480cdf0e10cSrcweir Point aParaPosWin = pEditView->GetWindowPosTopLeft((sal_uInt16)nCurPara); 481cdf0e10cSrcweir long nHeightRef = pOwner->pEditEngine->GetTextHeight((sal_uInt16)nCurPara); 482cdf0e10cSrcweir long nParaYOffs = aPosWin.Y() - aParaPosWin.Y(); 483cdf0e10cSrcweir 484cdf0e10cSrcweir if ( nParaYOffs > nHeightRef / 2 ) 485cdf0e10cSrcweir { 486cdf0e10cSrcweir Paragraph* p = pParaList->GetParagraph( nCurPara ); 487cdf0e10cSrcweir p = pParaList->NextVisible( p ); 488cdf0e10cSrcweir nCurPara = p ? pParaList->GetAbsPos( p ) : LIST_APPEND; 489cdf0e10cSrcweir } 490cdf0e10cSrcweir } 491cdf0e10cSrcweir return nCurPara; 492cdf0e10cSrcweir } 493cdf0e10cSrcweir 494cdf0e10cSrcweir 495cdf0e10cSrcweir void OutlinerView::ImpToggleExpand( Paragraph* pPara ) 496cdf0e10cSrcweir { 497cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 498cdf0e10cSrcweir 499cdf0e10cSrcweir sal_uInt16 nPara = (sal_uInt16) pOwner->pParaList->GetAbsPos( pPara ); 500cdf0e10cSrcweir pEditView->SetSelection( ESelection( nPara, 0, nPara, 0 ) ); 501cdf0e10cSrcweir ImplExpandOrCollaps( nPara, nPara, !pOwner->pParaList->HasVisibleChilds( pPara ) ); 502cdf0e10cSrcweir pEditView->ShowCursor(); 503cdf0e10cSrcweir } 504cdf0e10cSrcweir 505cdf0e10cSrcweir 506cdf0e10cSrcweir void OutlinerView::SetOutliner( Outliner* pOutliner ) 507cdf0e10cSrcweir { 508cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 509cdf0e10cSrcweir pOwner = pOutliner; 510cdf0e10cSrcweir pEditView->SetEditEngine( pOutliner->pEditEngine ); 511cdf0e10cSrcweir } 512cdf0e10cSrcweir 513cdf0e10cSrcweir 514cdf0e10cSrcweir 515cdf0e10cSrcweir sal_uLong OutlinerView::Select( Paragraph* pParagraph, sal_Bool bSelect, 516cdf0e10cSrcweir sal_Bool bWithChilds ) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 519cdf0e10cSrcweir 520cdf0e10cSrcweir sal_uLong nPara = pOwner->pParaList->GetAbsPos( pParagraph ); 521cdf0e10cSrcweir sal_uInt16 nEnd = 0; 522cdf0e10cSrcweir if ( bSelect ) 523cdf0e10cSrcweir nEnd = 0xffff; 524cdf0e10cSrcweir 525cdf0e10cSrcweir sal_uLong nChildCount = 0; 526cdf0e10cSrcweir if ( bWithChilds ) 527cdf0e10cSrcweir nChildCount = pOwner->pParaList->GetChildCount( pParagraph ); 528cdf0e10cSrcweir 529cdf0e10cSrcweir ESelection aSel( (sal_uInt16)nPara, 0,(sal_uInt16)(nPara+nChildCount), nEnd ); 530cdf0e10cSrcweir pEditView->SetSelection( aSel ); 531cdf0e10cSrcweir return nChildCount+1; 532cdf0e10cSrcweir } 533cdf0e10cSrcweir 534cdf0e10cSrcweir 535cdf0e10cSrcweir void OutlinerView::SetAttribs( const SfxItemSet& rAttrs ) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 538cdf0e10cSrcweir 539cdf0e10cSrcweir sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); 540cdf0e10cSrcweir pOwner->pEditEngine->SetUpdateMode( sal_False ); 541cdf0e10cSrcweir 542cdf0e10cSrcweir if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() ) 543cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_ATTR ); 544cdf0e10cSrcweir 545cdf0e10cSrcweir ParaRange aSel = ImpGetSelectedParagraphs( sal_False ); 546cdf0e10cSrcweir 547cdf0e10cSrcweir pEditView->SetAttribs( rAttrs ); 548cdf0e10cSrcweir 549cdf0e10cSrcweir // Bullet-Texte aktualisieren 550cdf0e10cSrcweir for( sal_uInt16 nPara= aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir pOwner->ImplCheckNumBulletItem( nPara ); 553cdf0e10cSrcweir pOwner->ImplCalcBulletText( nPara, sal_False, sal_False ); 554cdf0e10cSrcweir 555cdf0e10cSrcweir if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() ) 556cdf0e10cSrcweir pOwner->InsertUndo( new OutlinerUndoCheckPara( pOwner, nPara ) ); 557cdf0e10cSrcweir } 558cdf0e10cSrcweir 559cdf0e10cSrcweir if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() ) 560cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_ATTR ); 561cdf0e10cSrcweir 562cdf0e10cSrcweir pEditView->SetEditEngineUpdateMode( bUpdate ); 563cdf0e10cSrcweir } 564cdf0e10cSrcweir 565cdf0e10cSrcweir ParaRange OutlinerView::ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChilds ) 566cdf0e10cSrcweir { 567cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 ); 568cdf0e10cSrcweir 569cdf0e10cSrcweir ESelection aSel = pEditView->GetSelection(); 570cdf0e10cSrcweir ParaRange aParas( aSel.nStartPara, aSel.nEndPara ); 571cdf0e10cSrcweir aParas.Adjust(); 572cdf0e10cSrcweir 573cdf0e10cSrcweir // unsichtbare Childs des letzten Parents in Selektion mit aufnehmen 574cdf0e10cSrcweir if ( bIncludeHiddenChilds ) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir Paragraph* pLast = pOwner->pParaList->GetParagraph( aParas.nEndPara ); 577cdf0e10cSrcweir if ( pOwner->pParaList->HasHiddenChilds( pLast ) ) 578cdf0e10cSrcweir aParas.nEndPara = 579cdf0e10cSrcweir sal::static_int_cast< sal_uInt16 >( 580cdf0e10cSrcweir aParas.nEndPara + 581cdf0e10cSrcweir pOwner->pParaList->GetChildCount( pLast ) ); 582cdf0e10cSrcweir } 583cdf0e10cSrcweir return aParas; 584cdf0e10cSrcweir } 585cdf0e10cSrcweir 586cdf0e10cSrcweir // MT: Name sollte mal geaendert werden! 587cdf0e10cSrcweir void OutlinerView::AdjustDepth( short nDX ) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir Indent( nDX ); 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir void OutlinerView::Indent( short nDiff ) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 ); 595cdf0e10cSrcweir 596cdf0e10cSrcweir if( !nDiff || ( ( nDiff > 0 ) && ImpCalcSelectedPages( sal_True ) && !pOwner->ImpCanIndentSelectedPages( this ) ) ) 597cdf0e10cSrcweir return; 598cdf0e10cSrcweir 599cdf0e10cSrcweir const bool bOutlinerView = pOwner->pEditEngine->GetControlWord() & EE_CNTRL_OUTLINER; 600cdf0e10cSrcweir sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); 601cdf0e10cSrcweir pOwner->pEditEngine->SetUpdateMode( sal_False ); 602cdf0e10cSrcweir 603cdf0e10cSrcweir sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); 604cdf0e10cSrcweir 605cdf0e10cSrcweir if( bUndo ) 606cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_DEPTH ); 607cdf0e10cSrcweir 608cdf0e10cSrcweir sal_Int16 nMinDepth = -1; // Optimierung: Nicht unnoetig viele Absatze neu berechnen 609cdf0e10cSrcweir 610cdf0e10cSrcweir ParaRange aSel = ImpGetSelectedParagraphs( sal_True ); 611cdf0e10cSrcweir for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 614cdf0e10cSrcweir 615cdf0e10cSrcweir sal_Int16 nOldDepth = pPara->GetDepth(); 616cdf0e10cSrcweir sal_Int16 nNewDepth = nOldDepth + nDiff; 617cdf0e10cSrcweir 618cdf0e10cSrcweir if( bOutlinerView && nPara ) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir const bool bPage = pPara->HasFlag(PARAFLAG_ISPAGE); 621cdf0e10cSrcweir if( (bPage && (nDiff == +1)) || (!bPage && (nDiff == -1) && (nOldDepth <= 0)) ) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir // App benachrichtigen 624cdf0e10cSrcweir pOwner->nDepthChangedHdlPrevDepth = (sal_Int16)nOldDepth; 625cdf0e10cSrcweir pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags; 626cdf0e10cSrcweir pOwner->pHdlParagraph = pPara; 627cdf0e10cSrcweir 628cdf0e10cSrcweir if( bPage ) 629cdf0e10cSrcweir pPara->RemoveFlag( PARAFLAG_ISPAGE ); 630cdf0e10cSrcweir else 631cdf0e10cSrcweir pPara->SetFlag( PARAFLAG_ISPAGE ); 632cdf0e10cSrcweir 633cdf0e10cSrcweir pOwner->DepthChangedHdl(); 634cdf0e10cSrcweir pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) ); 635cdf0e10cSrcweir 636cdf0e10cSrcweir if( bUndo ) 637cdf0e10cSrcweir pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nPara, pOwner->mnDepthChangeHdlPrevFlags, pPara->nFlags ) ); 638cdf0e10cSrcweir 639cdf0e10cSrcweir continue; 640cdf0e10cSrcweir } 641cdf0e10cSrcweir } 642cdf0e10cSrcweir 643cdf0e10cSrcweir // do not switch off numeration with tab 644cdf0e10cSrcweir if( (nOldDepth == 0) && (nNewDepth == -1) ) 645cdf0e10cSrcweir continue; 646cdf0e10cSrcweir 647cdf0e10cSrcweir // do not indent if there is no numeration enabled 648cdf0e10cSrcweir if( nOldDepth == -1 ) 649cdf0e10cSrcweir continue; 650cdf0e10cSrcweir 651cdf0e10cSrcweir if ( nNewDepth < pOwner->nMinDepth ) 652cdf0e10cSrcweir nNewDepth = pOwner->nMinDepth; 653cdf0e10cSrcweir if ( nNewDepth > pOwner->nMaxDepth ) 654cdf0e10cSrcweir nNewDepth = pOwner->nMaxDepth; 655cdf0e10cSrcweir 656cdf0e10cSrcweir if( nOldDepth < nMinDepth ) 657cdf0e10cSrcweir nMinDepth = nOldDepth; 658cdf0e10cSrcweir if( nNewDepth < nMinDepth ) 659cdf0e10cSrcweir nMinDepth = nNewDepth; 660cdf0e10cSrcweir 661cdf0e10cSrcweir if( nOldDepth != nNewDepth ) 662cdf0e10cSrcweir { 663cdf0e10cSrcweir if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT )) 664cdf0e10cSrcweir { 665cdf0e10cSrcweir // Sonderfall: Der Vorgaenger eines eingerueckten Absatzes ist 666cdf0e10cSrcweir // unsichtbar und steht jetzt auf der gleichen Ebene wie der 667cdf0e10cSrcweir // sichtbare Absatz. In diesem Fall wird der naechste sichtbare 668cdf0e10cSrcweir // Absatz gesucht und aufgeplustert. 669cdf0e10cSrcweir #ifdef DBG_UTIL 670cdf0e10cSrcweir Paragraph* _pPara = pOwner->pParaList->GetParagraph( aSel.nStartPara ); 671cdf0e10cSrcweir DBG_ASSERT(_pPara->IsVisible(),"Selected Paragraph invisible ?!"); 672cdf0e10cSrcweir #endif 673cdf0e10cSrcweir Paragraph* pPrev= pOwner->pParaList->GetParagraph( aSel.nStartPara-1 ); 674cdf0e10cSrcweir 675cdf0e10cSrcweir if( !pPrev->IsVisible() && ( pPrev->GetDepth() == nNewDepth ) ) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir // Vorgaenger ist eingeklappt und steht auf gleicher Ebene 678cdf0e10cSrcweir // => naechsten sichtbaren Absatz suchen und expandieren 679cdf0e10cSrcweir pPrev = pOwner->pParaList->GetParent( pPrev ); 680cdf0e10cSrcweir while( !pPrev->IsVisible() ) 681cdf0e10cSrcweir pPrev = pOwner->pParaList->GetParent( pPrev ); 682cdf0e10cSrcweir 683cdf0e10cSrcweir pOwner->Expand( pPrev ); 684cdf0e10cSrcweir pOwner->InvalidateBullet( pPrev, pOwner->pParaList->GetAbsPos( pPrev ) ); 685cdf0e10cSrcweir } 686cdf0e10cSrcweir } 687cdf0e10cSrcweir 688cdf0e10cSrcweir pOwner->nDepthChangedHdlPrevDepth = (sal_Int16)nOldDepth; 689cdf0e10cSrcweir pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags; 690cdf0e10cSrcweir pOwner->pHdlParagraph = pPara; 691cdf0e10cSrcweir 692cdf0e10cSrcweir pOwner->ImplInitDepth( nPara, nNewDepth, sal_True, sal_False ); 693cdf0e10cSrcweir pOwner->ImplCalcBulletText( nPara, sal_False, sal_False ); 694cdf0e10cSrcweir 695cdf0e10cSrcweir if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) 696cdf0e10cSrcweir pOwner->ImplSetLevelDependendStyleSheet( nPara ); 697cdf0e10cSrcweir 698cdf0e10cSrcweir // App benachrichtigen 699cdf0e10cSrcweir pOwner->DepthChangedHdl(); 700cdf0e10cSrcweir } 701cdf0e10cSrcweir else 702cdf0e10cSrcweir { 703cdf0e10cSrcweir // Needs at least a repaint... 704cdf0e10cSrcweir pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) ); 705cdf0e10cSrcweir } 706cdf0e10cSrcweir } 707cdf0e10cSrcweir 708cdf0e10cSrcweir // MT 19.08.99: War mal fuer Optimierung (outliner.cxx#1.193), 709cdf0e10cSrcweir // hat aber zu zuviel Wartungsaufwand / doppelten Funktionen gefuehrt 710cdf0e10cSrcweir // und zu wenig gebracht: 711cdf0e10cSrcweir // pOwner->ImpSetBulletTextsFrom( aSel.nStartPara+1, nMinDepth ); 712cdf0e10cSrcweir // Wird jetzt direkt in Schleife mit ImplCalcBulletText() erledigt. 713cdf0e10cSrcweir // Jetzt fehlen nur noch die folgenden Ansaetze, die davon betroffen sind. 714cdf0e10cSrcweir sal_uInt16 nParas = (sal_uInt16)pOwner->pParaList->GetParagraphCount(); 715cdf0e10cSrcweir for ( sal_uInt16 n = aSel.nEndPara+1; n < nParas; n++ ) 716cdf0e10cSrcweir { 717cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( n ); 718cdf0e10cSrcweir if ( pPara->GetDepth() < nMinDepth ) 719cdf0e10cSrcweir break; 720cdf0e10cSrcweir pOwner->ImplCalcBulletText( n, sal_False, sal_False ); 721cdf0e10cSrcweir } 722cdf0e10cSrcweir 723cdf0e10cSrcweir if ( bUpdate ) 724cdf0e10cSrcweir { 725cdf0e10cSrcweir pEditView->SetEditEngineUpdateMode( sal_True ); 726cdf0e10cSrcweir pEditView->ShowCursor(); 727cdf0e10cSrcweir } 728cdf0e10cSrcweir 729cdf0e10cSrcweir if( bUndo ) 730cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_DEPTH ); 731cdf0e10cSrcweir } 732cdf0e10cSrcweir 733cdf0e10cSrcweir sal_Bool OutlinerView::AdjustHeight( long nDY ) 734cdf0e10cSrcweir { 735cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 736cdf0e10cSrcweir pEditView->MoveParagraphs( nDY ); 737cdf0e10cSrcweir return sal_True; // remove return value... 738cdf0e10cSrcweir } 739cdf0e10cSrcweir 740cdf0e10cSrcweir void OutlinerView::AdjustDepth( Paragraph* pPara, short nDX, sal_Bool bWithChilds) 741cdf0e10cSrcweir { 742cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 743cdf0e10cSrcweir sal_uLong nStartPara = pOwner->pParaList->GetAbsPos( pPara ); 744cdf0e10cSrcweir sal_uLong nEndPara = nStartPara; 745cdf0e10cSrcweir if ( bWithChilds ) 746cdf0e10cSrcweir nEndPara += pOwner->pParaList->GetChildCount( pPara ); 747cdf0e10cSrcweir ESelection aSel((sal_uInt16)nStartPara, 0,(sal_uInt16)nEndPara, 0xffff ); 748cdf0e10cSrcweir pEditView->SetSelection( aSel ); 749cdf0e10cSrcweir AdjustDepth( nDX ); 750cdf0e10cSrcweir } 751cdf0e10cSrcweir 752cdf0e10cSrcweir void OutlinerView::AdjustHeight( Paragraph* pPara, long nDY, sal_Bool bWithChilds ) 753cdf0e10cSrcweir { 754cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 755cdf0e10cSrcweir sal_uLong nStartPara = pOwner->pParaList->GetAbsPos( pPara ); 756cdf0e10cSrcweir sal_uLong nEndPara = nStartPara; 757cdf0e10cSrcweir if ( bWithChilds ) 758cdf0e10cSrcweir nEndPara += pOwner->pParaList->GetChildCount( pPara ); 759cdf0e10cSrcweir ESelection aSel( (sal_uInt16)nStartPara, 0, (sal_uInt16)nEndPara, 0xffff ); 760cdf0e10cSrcweir pEditView->SetSelection( aSel ); 761cdf0e10cSrcweir AdjustHeight( nDY ); 762cdf0e10cSrcweir } 763cdf0e10cSrcweir 764cdf0e10cSrcweir 765cdf0e10cSrcweir Rectangle OutlinerView::GetVisArea() const 766cdf0e10cSrcweir { 767cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 768cdf0e10cSrcweir return pEditView->GetVisArea(); 769cdf0e10cSrcweir } 770cdf0e10cSrcweir 771cdf0e10cSrcweir 772cdf0e10cSrcweir Point OutlinerView::ImpGetDocPos( const Point& rPosPixel ) 773cdf0e10cSrcweir { 774cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 775cdf0e10cSrcweir Rectangle aOutArWin = GetOutputArea(); 776cdf0e10cSrcweir // Position in der OutputArea berechnen 777cdf0e10cSrcweir Point aCurPosDoc( rPosPixel ); 778cdf0e10cSrcweir aCurPosDoc = pEditView->GetWindow()->PixelToLogic( aCurPosDoc ); 779cdf0e10cSrcweir aCurPosDoc -= aOutArWin.TopLeft(); 780cdf0e10cSrcweir aCurPosDoc += pEditView->GetVisArea().TopLeft(); 781cdf0e10cSrcweir return aCurPosDoc; 782cdf0e10cSrcweir } 783cdf0e10cSrcweir 784cdf0e10cSrcweir // MT 05/00: Wofuer dies ImpXXXScroll, sollte das nicht die EditEngine machen??? 785cdf0e10cSrcweir 786cdf0e10cSrcweir void OutlinerView::ImpDragScroll( const Point& rPosPix ) 787cdf0e10cSrcweir { 788cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 789cdf0e10cSrcweir Point aPosWin = pEditView->GetWindow()->PixelToLogic( rPosPix ); 790cdf0e10cSrcweir Rectangle aOutputArWin = pEditView->GetOutputArea(); 791cdf0e10cSrcweir if ( aPosWin.X() <= aOutputArWin.Left() + nDDScrollLRBorderWidthWin) 792cdf0e10cSrcweir ImpScrollLeft(); 793cdf0e10cSrcweir else if( aPosWin.X() >= aOutputArWin.Right()- nDDScrollLRBorderWidthWin) 794cdf0e10cSrcweir ImpScrollRight(); 795cdf0e10cSrcweir else if( aPosWin.Y() <= aOutputArWin.Top() + nDDScrollTBBorderWidthWin) 796cdf0e10cSrcweir ImpScrollUp(); 797cdf0e10cSrcweir else if(aPosWin.Y() >= aOutputArWin.Bottom() - nDDScrollTBBorderWidthWin) 798cdf0e10cSrcweir ImpScrollDown(); 799cdf0e10cSrcweir } 800cdf0e10cSrcweir 801cdf0e10cSrcweir 802cdf0e10cSrcweir void OutlinerView::ImpScrollLeft() 803cdf0e10cSrcweir { 804cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 805cdf0e10cSrcweir Rectangle aVisArea( pEditView->GetVisArea() ); 806cdf0e10cSrcweir long nMaxScrollOffs = aVisArea.Left(); 807cdf0e10cSrcweir if ( !nMaxScrollOffs ) 808cdf0e10cSrcweir return; 809cdf0e10cSrcweir long nScrollOffsRef = (aVisArea.GetWidth() * OL_SCROLL_HOROFFSET) / 100; 810cdf0e10cSrcweir if ( !nScrollOffsRef ) 811cdf0e10cSrcweir nScrollOffsRef = 1; 812cdf0e10cSrcweir if ( nScrollOffsRef > nMaxScrollOffs ) 813cdf0e10cSrcweir nScrollOffsRef = nMaxScrollOffs; 814cdf0e10cSrcweir 815cdf0e10cSrcweir ImpHideDDCursor(); 816cdf0e10cSrcweir Scroll( -nScrollOffsRef, 0 ); 817cdf0e10cSrcweir 818cdf0e10cSrcweir EditStatus aScrollStat; 819cdf0e10cSrcweir aScrollStat.GetStatusWord() = EE_STAT_HSCROLL; 820cdf0e10cSrcweir pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat ); 821cdf0e10cSrcweir } 822cdf0e10cSrcweir 823cdf0e10cSrcweir 824cdf0e10cSrcweir void OutlinerView::ImpScrollRight() 825cdf0e10cSrcweir { 826cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 827cdf0e10cSrcweir Rectangle aVisArea( pEditView->GetVisArea() ); 828cdf0e10cSrcweir long nMaxScrollOffs = pOwner->pEditEngine->GetPaperSize().Width() - 829cdf0e10cSrcweir aVisArea.Right(); 830cdf0e10cSrcweir if ( !nMaxScrollOffs ) 831cdf0e10cSrcweir return; 832cdf0e10cSrcweir long nScrollOffsRef = (aVisArea.GetWidth() * OL_SCROLL_HOROFFSET) / 100; 833cdf0e10cSrcweir if ( !nScrollOffsRef ) 834cdf0e10cSrcweir nScrollOffsRef = 1; 835cdf0e10cSrcweir if ( nScrollOffsRef > nMaxScrollOffs ) 836cdf0e10cSrcweir nScrollOffsRef = nMaxScrollOffs; 837cdf0e10cSrcweir 838cdf0e10cSrcweir ImpHideDDCursor(); 839cdf0e10cSrcweir Scroll( nScrollOffsRef, 0 ); 840cdf0e10cSrcweir 841cdf0e10cSrcweir EditStatus aScrollStat; 842cdf0e10cSrcweir aScrollStat.GetStatusWord() = EE_STAT_HSCROLL; 843cdf0e10cSrcweir pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat ); 844cdf0e10cSrcweir } 845cdf0e10cSrcweir 846cdf0e10cSrcweir 847cdf0e10cSrcweir void OutlinerView::ImpScrollDown() 848cdf0e10cSrcweir { 849cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 850cdf0e10cSrcweir Rectangle aVisArea( pEditView->GetVisArea() ); 851cdf0e10cSrcweir Size aDocSize( 0, (long)pOwner->pEditEngine->GetTextHeight() ); 852cdf0e10cSrcweir 853cdf0e10cSrcweir long nMaxScrollOffs = aDocSize.Height(); 854cdf0e10cSrcweir nMaxScrollOffs -= aVisArea.Top(); 855cdf0e10cSrcweir nMaxScrollOffs -= aVisArea.GetHeight(); 856cdf0e10cSrcweir if ( !nMaxScrollOffs ) 857cdf0e10cSrcweir return; 858cdf0e10cSrcweir 859cdf0e10cSrcweir long nScrollOffsRef = (aVisArea.GetHeight() * OL_SCROLL_VEROFFSET) / 100; 860cdf0e10cSrcweir 861cdf0e10cSrcweir if ( nScrollOffsRef > nMaxScrollOffs ) 862cdf0e10cSrcweir nScrollOffsRef = nMaxScrollOffs; 863cdf0e10cSrcweir if ( !nScrollOffsRef ) 864cdf0e10cSrcweir nScrollOffsRef = 1; 865cdf0e10cSrcweir 866cdf0e10cSrcweir ImpHideDDCursor(); 867cdf0e10cSrcweir Scroll( 0, -nScrollOffsRef ); 868cdf0e10cSrcweir 869cdf0e10cSrcweir EditStatus aScrollStat; 870cdf0e10cSrcweir aScrollStat.GetStatusWord() = EE_STAT_VSCROLL; 871cdf0e10cSrcweir pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat ); 872cdf0e10cSrcweir } 873cdf0e10cSrcweir 874cdf0e10cSrcweir 875cdf0e10cSrcweir void OutlinerView::ImpScrollUp() 876cdf0e10cSrcweir { 877cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 878cdf0e10cSrcweir Rectangle aVisArea( pEditView->GetVisArea() ); 879cdf0e10cSrcweir long nMaxScrollOffs = aVisArea.Top(); 880cdf0e10cSrcweir if ( !nMaxScrollOffs ) 881cdf0e10cSrcweir return; 882cdf0e10cSrcweir long nScrollOffsRef = (aVisArea.GetHeight() * OL_SCROLL_VEROFFSET) / 100; 883cdf0e10cSrcweir 884cdf0e10cSrcweir 885cdf0e10cSrcweir if ( nScrollOffsRef > nMaxScrollOffs ) 886cdf0e10cSrcweir nScrollOffsRef = nMaxScrollOffs; 887cdf0e10cSrcweir if ( !nScrollOffsRef ) 888cdf0e10cSrcweir nScrollOffsRef = 1; 889cdf0e10cSrcweir 890cdf0e10cSrcweir ImpHideDDCursor(); 891cdf0e10cSrcweir Scroll( 0, nScrollOffsRef ); 892cdf0e10cSrcweir 893cdf0e10cSrcweir EditStatus aScrollStat; 894cdf0e10cSrcweir aScrollStat.GetStatusWord() = EE_STAT_VSCROLL; 895cdf0e10cSrcweir pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat ); 896cdf0e10cSrcweir } 897cdf0e10cSrcweir 898cdf0e10cSrcweir 899cdf0e10cSrcweir void OutlinerView::Expand() 900cdf0e10cSrcweir { 901cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 ); 902cdf0e10cSrcweir ParaRange aParas = ImpGetSelectedParagraphs( sal_False ); 903cdf0e10cSrcweir ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_True ); 904cdf0e10cSrcweir } 905cdf0e10cSrcweir 906cdf0e10cSrcweir 907cdf0e10cSrcweir void OutlinerView::Collapse() 908cdf0e10cSrcweir { 909cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 ); 910cdf0e10cSrcweir ParaRange aParas = ImpGetSelectedParagraphs( sal_False ); 911cdf0e10cSrcweir ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_False ); 912cdf0e10cSrcweir } 913cdf0e10cSrcweir 914cdf0e10cSrcweir 915cdf0e10cSrcweir void OutlinerView::ExpandAll() 916cdf0e10cSrcweir { 917cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 ); 918cdf0e10cSrcweir ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_True ); 919cdf0e10cSrcweir } 920cdf0e10cSrcweir 921cdf0e10cSrcweir 922cdf0e10cSrcweir void OutlinerView::CollapseAll() 923cdf0e10cSrcweir { 924cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 925cdf0e10cSrcweir ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_False ); 926cdf0e10cSrcweir } 927cdf0e10cSrcweir 928cdf0e10cSrcweir void OutlinerView::ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand ) 929cdf0e10cSrcweir { 930cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 ); 931cdf0e10cSrcweir 932cdf0e10cSrcweir sal_Bool bUpdate = pOwner->GetUpdateMode(); 933cdf0e10cSrcweir pOwner->SetUpdateMode( sal_False ); 934cdf0e10cSrcweir 935cdf0e10cSrcweir sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); 936cdf0e10cSrcweir if( bUndo ) 937cdf0e10cSrcweir pOwner->UndoActionStart( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE ); 938cdf0e10cSrcweir 939cdf0e10cSrcweir for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ ) 940cdf0e10cSrcweir { 941cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 942cdf0e10cSrcweir sal_Bool bDone = bExpand ? pOwner->Expand( pPara ) : pOwner->Collapse( pPara ); 943cdf0e10cSrcweir if( bDone ) 944cdf0e10cSrcweir { 945cdf0e10cSrcweir // Der Strich unter dem Absatz muss verschwinden... 946cdf0e10cSrcweir pOwner->pEditEngine->QuickMarkToBeRepainted( nPara ); 947cdf0e10cSrcweir } 948cdf0e10cSrcweir } 949cdf0e10cSrcweir 950cdf0e10cSrcweir if( bUndo ) 951cdf0e10cSrcweir pOwner->UndoActionEnd( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE ); 952cdf0e10cSrcweir 953cdf0e10cSrcweir if ( bUpdate ) 954cdf0e10cSrcweir { 955cdf0e10cSrcweir pOwner->SetUpdateMode( sal_True ); 956cdf0e10cSrcweir pEditView->ShowCursor(); 957cdf0e10cSrcweir } 958cdf0e10cSrcweir } 959cdf0e10cSrcweir 960cdf0e10cSrcweir 961cdf0e10cSrcweir void OutlinerView::Expand( Paragraph* pPara) 962cdf0e10cSrcweir { 963cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 964cdf0e10cSrcweir pOwner->Expand( pPara ); 965cdf0e10cSrcweir } 966cdf0e10cSrcweir 967cdf0e10cSrcweir 968cdf0e10cSrcweir void OutlinerView::Collapse( Paragraph* pPara) 969cdf0e10cSrcweir { 970cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 971cdf0e10cSrcweir pOwner->Collapse( pPara ); 972cdf0e10cSrcweir } 973cdf0e10cSrcweir 974cdf0e10cSrcweir void OutlinerView::InsertText( const OutlinerParaObject& rParaObj ) 975cdf0e10cSrcweir { 976cdf0e10cSrcweir // MT: Wie Paste, nur EditView::Insert, statt EditView::Paste. 977cdf0e10cSrcweir // Eigentlich nicht ganz richtig, das evtl. Einrueckungen 978cdf0e10cSrcweir // korrigiert werden muessen, aber das kommt spaeter durch ein 979cdf0e10cSrcweir // allgemeingueltiges Import. 980cdf0e10cSrcweir // Dann wird im Inserted gleich ermittelt, was f�r eine Einrueckebene 981cdf0e10cSrcweir // Moegliche Struktur: 982cdf0e10cSrcweir // pImportInfo mit DestPara, DestPos, nFormat, pParaObj... 983cdf0e10cSrcweir // Evtl. Problematisch: 984cdf0e10cSrcweir // EditEngine, RTF => Absplittung des Bereichs, spaeter 985cdf0e10cSrcweir // zusammenfuehrung 986cdf0e10cSrcweir 987cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 988cdf0e10cSrcweir 989cdf0e10cSrcweir if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) ) 990cdf0e10cSrcweir return; 991cdf0e10cSrcweir 992cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_INSERT ); 993cdf0e10cSrcweir 994cdf0e10cSrcweir pOwner->pEditEngine->SetUpdateMode( sal_False ); 995cdf0e10cSrcweir sal_uLong nStart, nParaCount; 996cdf0e10cSrcweir nParaCount = pOwner->pEditEngine->GetParagraphCount(); 997cdf0e10cSrcweir sal_uInt16 nSize = ImpInitPaste( nStart ); 998cdf0e10cSrcweir pEditView->InsertText( rParaObj.GetTextObject() ); 999cdf0e10cSrcweir ImpPasted( nStart, nParaCount, nSize); 1000cdf0e10cSrcweir pEditView->SetEditEngineUpdateMode( sal_True ); 1001cdf0e10cSrcweir 1002cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_INSERT ); 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir pEditView->ShowCursor( sal_True, sal_True ); 1005cdf0e10cSrcweir } 1006cdf0e10cSrcweir 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir 1009cdf0e10cSrcweir void OutlinerView::Cut() 1010cdf0e10cSrcweir { 1011cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1012cdf0e10cSrcweir if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) ) 1013cdf0e10cSrcweir pEditView->Cut(); 1014cdf0e10cSrcweir } 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir void OutlinerView::Paste() 1017cdf0e10cSrcweir { 1018cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1019cdf0e10cSrcweir PasteSpecial(); // HACK(SD ruft nicht PasteSpecial auf) 1020cdf0e10cSrcweir } 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir void OutlinerView::PasteSpecial() 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1025cdf0e10cSrcweir if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) ) 1026cdf0e10cSrcweir { 1027cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_INSERT ); 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir pOwner->pEditEngine->SetUpdateMode( sal_False ); 1030cdf0e10cSrcweir pOwner->bPasting = sal_True; 1031cdf0e10cSrcweir pEditView->PasteSpecial(); 1032cdf0e10cSrcweir 1033cdf0e10cSrcweir if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) 1034cdf0e10cSrcweir { 1035cdf0e10cSrcweir const sal_uInt16 nParaCount = pOwner->pEditEngine->GetParagraphCount(); 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir for( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ ) 1038cdf0e10cSrcweir pOwner->ImplSetLevelDependendStyleSheet( nPara ); 1039cdf0e10cSrcweir } 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir pEditView->SetEditEngineUpdateMode( sal_True ); 1042cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_INSERT ); 1043cdf0e10cSrcweir pEditView->ShowCursor( sal_True, sal_True ); 1044cdf0e10cSrcweir } 1045cdf0e10cSrcweir } 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir List* OutlinerView::CreateSelectionList() 1048cdf0e10cSrcweir { 1049cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 ); 1050cdf0e10cSrcweir 1051cdf0e10cSrcweir ParaRange aParas = ImpGetSelectedParagraphs( sal_True ); 1052cdf0e10cSrcweir List* pSelList = new List; 1053cdf0e10cSrcweir for ( sal_uInt16 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++ ) 1054cdf0e10cSrcweir { 1055cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 1056cdf0e10cSrcweir pSelList->Insert( pPara, LIST_APPEND ); 1057cdf0e10cSrcweir } 1058cdf0e10cSrcweir return pSelList; 1059cdf0e10cSrcweir } 1060cdf0e10cSrcweir 1061cdf0e10cSrcweir SfxStyleSheet* OutlinerView::GetStyleSheet() const 1062cdf0e10cSrcweir { 1063cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1064cdf0e10cSrcweir return pEditView->GetStyleSheet(); 1065cdf0e10cSrcweir } 1066cdf0e10cSrcweir 1067cdf0e10cSrcweir void OutlinerView::SetStyleSheet( SfxStyleSheet* pStyle ) 1068cdf0e10cSrcweir { 1069cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1070cdf0e10cSrcweir pEditView->SetStyleSheet( pStyle ); 1071cdf0e10cSrcweir 1072cdf0e10cSrcweir ParaRange aSel = ImpGetSelectedParagraphs( sal_True ); 1073cdf0e10cSrcweir for( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) 1074cdf0e10cSrcweir { 1075cdf0e10cSrcweir pOwner->ImplCheckNumBulletItem( nPara ); 1076cdf0e10cSrcweir pOwner->ImplCalcBulletText( nPara, sal_False, sal_False ); 1077cdf0e10cSrcweir } 1078cdf0e10cSrcweir } 1079cdf0e10cSrcweir 1080cdf0e10cSrcweir Pointer OutlinerView::GetPointer( const Point& rPosPixel ) 1081cdf0e10cSrcweir { 1082cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1083cdf0e10cSrcweir 1084cdf0e10cSrcweir MouseTarget eTarget; 1085cdf0e10cSrcweir ImpCheckMousePos( rPosPixel, eTarget ); 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir PointerStyle ePointerStyle = POINTER_ARROW; 1088cdf0e10cSrcweir if ( eTarget == MouseText ) 1089cdf0e10cSrcweir { 1090cdf0e10cSrcweir ePointerStyle = GetOutliner()->IsVertical() ? POINTER_TEXT_VERTICAL : POINTER_TEXT; 1091cdf0e10cSrcweir } 1092cdf0e10cSrcweir else if ( eTarget == MouseHypertext ) 1093cdf0e10cSrcweir { 1094cdf0e10cSrcweir ePointerStyle = POINTER_REFHAND; 1095cdf0e10cSrcweir } 1096cdf0e10cSrcweir else if ( eTarget == MouseBullet ) 1097cdf0e10cSrcweir { 1098cdf0e10cSrcweir ePointerStyle = POINTER_MOVE; 1099cdf0e10cSrcweir } 1100cdf0e10cSrcweir 1101cdf0e10cSrcweir return Pointer( ePointerStyle ); 1102cdf0e10cSrcweir } 1103cdf0e10cSrcweir 1104cdf0e10cSrcweir 1105cdf0e10cSrcweir sal_uInt16 OutlinerView::ImpInitPaste( sal_uLong& rStart ) 1106cdf0e10cSrcweir { 1107cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1108cdf0e10cSrcweir pOwner->bPasting = sal_True; 1109cdf0e10cSrcweir ESelection aSelection( pEditView->GetSelection() ); 1110cdf0e10cSrcweir aSelection.Adjust(); 1111cdf0e10cSrcweir rStart = aSelection.nStartPara; 1112cdf0e10cSrcweir sal_uInt16 nSize = aSelection.nEndPara - aSelection.nStartPara + 1; 1113cdf0e10cSrcweir return nSize; 1114cdf0e10cSrcweir } 1115cdf0e10cSrcweir 1116cdf0e10cSrcweir 1117cdf0e10cSrcweir void OutlinerView::ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize) 1118cdf0e10cSrcweir { 1119cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1120cdf0e10cSrcweir pOwner->bPasting = sal_False; 1121cdf0e10cSrcweir sal_uLong nCurParaCount = (sal_uLong)pOwner->pEditEngine->GetParagraphCount(); 1122cdf0e10cSrcweir if( nCurParaCount < nPrevParaCount ) 1123cdf0e10cSrcweir nSize = sal::static_int_cast< sal_uInt16 >( 1124cdf0e10cSrcweir nSize - ( nPrevParaCount - nCurParaCount ) ); 1125cdf0e10cSrcweir else 1126cdf0e10cSrcweir nSize = sal::static_int_cast< sal_uInt16 >( 1127cdf0e10cSrcweir nSize + ( nCurParaCount - nPrevParaCount ) ); 1128cdf0e10cSrcweir pOwner->ImpTextPasted( nStart, nSize ); 1129cdf0e10cSrcweir } 1130cdf0e10cSrcweir 1131cdf0e10cSrcweir 1132cdf0e10cSrcweir void OutlinerView::Command( const CommandEvent& rCEvt ) 1133cdf0e10cSrcweir { 1134cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1135cdf0e10cSrcweir pEditView->Command( rCEvt ); 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir void OutlinerView::SelectRange( sal_uLong nFirst, sal_uInt16 nCount ) 1140cdf0e10cSrcweir { 1141cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1142cdf0e10cSrcweir sal_uLong nLast = nFirst+nCount; 1143cdf0e10cSrcweir nCount = (sal_uInt16)pOwner->pParaList->GetParagraphCount(); 1144cdf0e10cSrcweir if( nLast <= nCount ) 1145cdf0e10cSrcweir nLast = nCount - 1; 1146cdf0e10cSrcweir ESelection aSel( (sal_uInt16)nFirst, 0, (sal_uInt16)nLast, 0xffff ); 1147cdf0e10cSrcweir pEditView->SetSelection( aSel ); 1148cdf0e10cSrcweir } 1149cdf0e10cSrcweir 1150cdf0e10cSrcweir 1151cdf0e10cSrcweir sal_uInt16 OutlinerView::ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected ) 1152cdf0e10cSrcweir { 1153cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir ESelection aSel( pEditView->GetSelection() ); 1156cdf0e10cSrcweir aSel.Adjust(); 1157cdf0e10cSrcweir 1158cdf0e10cSrcweir sal_uInt16 nPages = 0; 1159cdf0e10cSrcweir sal_uInt16 nFirstPage = 0xFFFF; 1160cdf0e10cSrcweir sal_uInt16 nStartPara = aSel.nStartPara; 1161cdf0e10cSrcweir if ( !bIncludeFirstSelected ) 1162cdf0e10cSrcweir nStartPara++; // alle nach StartPara kommenden Absaetze werden geloescht 1163cdf0e10cSrcweir for ( sal_uInt16 nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ ) 1164cdf0e10cSrcweir { 1165cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 1166cdf0e10cSrcweir DBG_ASSERT(pPara, "ImpCalcSelectedPages: ungueltige Selection? "); 1167cdf0e10cSrcweir if( pPara->HasFlag(PARAFLAG_ISPAGE) ) 1168cdf0e10cSrcweir { 1169cdf0e10cSrcweir nPages++; 1170cdf0e10cSrcweir if( nFirstPage == 0xFFFF ) 1171cdf0e10cSrcweir nFirstPage = nPara; 1172cdf0e10cSrcweir } 1173cdf0e10cSrcweir } 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir if( nPages ) 1176cdf0e10cSrcweir { 1177cdf0e10cSrcweir pOwner->nDepthChangedHdlPrevDepth = nPages; 1178cdf0e10cSrcweir pOwner->pHdlParagraph = 0; 1179cdf0e10cSrcweir pOwner->mnFirstSelPage = nFirstPage; 1180cdf0e10cSrcweir } 1181cdf0e10cSrcweir 1182cdf0e10cSrcweir return nPages; 1183cdf0e10cSrcweir } 1184cdf0e10cSrcweir 1185cdf0e10cSrcweir 1186cdf0e10cSrcweir void OutlinerView::ToggleBullets() 1187cdf0e10cSrcweir { 1188cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_DEPTH ); 1189cdf0e10cSrcweir 1190cdf0e10cSrcweir ESelection aSel( pEditView->GetSelection() ); 1191cdf0e10cSrcweir aSel.Adjust(); 1192cdf0e10cSrcweir 1193cdf0e10cSrcweir const bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); 1194cdf0e10cSrcweir pOwner->pEditEngine->SetUpdateMode( sal_False ); 1195cdf0e10cSrcweir 1196cdf0e10cSrcweir sal_Int16 nDepth = -2; 1197cdf0e10cSrcweir 1198cdf0e10cSrcweir for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) 1199cdf0e10cSrcweir { 1200cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 1201cdf0e10cSrcweir DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); 1202cdf0e10cSrcweir 1203cdf0e10cSrcweir if( pPara ) 1204cdf0e10cSrcweir { 1205cdf0e10cSrcweir if( nDepth == -2 ) 1206cdf0e10cSrcweir nDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1; 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir pOwner->SetDepth( pPara, nDepth ); 1209cdf0e10cSrcweir 1210cdf0e10cSrcweir if( nDepth == -1 ) 1211cdf0e10cSrcweir { 1212cdf0e10cSrcweir const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara ); 1213cdf0e10cSrcweir if(rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET) 1214cdf0e10cSrcweir { 1215cdf0e10cSrcweir SfxItemSet aAttrs(rAttrs); 1216cdf0e10cSrcweir aAttrs.ClearItem( EE_PARA_BULLETSTATE ); 1217cdf0e10cSrcweir pOwner->SetParaAttribs( nPara, aAttrs ); 1218cdf0e10cSrcweir } 1219cdf0e10cSrcweir } 1220cdf0e10cSrcweir } 1221cdf0e10cSrcweir } 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir // --> OD 2009-03-10 #i100014# 1224cdf0e10cSrcweir // It is not a good idea to substract 1 from a count and cast the result 1225cdf0e10cSrcweir // to sal_uInt16 without check, if the count is 0. 1226cdf0e10cSrcweir sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount()); 1227cdf0e10cSrcweir // <-- 1228cdf0e10cSrcweir pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); 1229cdf0e10cSrcweir pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) ); 1230cdf0e10cSrcweir 1231cdf0e10cSrcweir pOwner->pEditEngine->SetUpdateMode( bUpdate ); 1232cdf0e10cSrcweir 1233cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_DEPTH ); 1234cdf0e10cSrcweir } 1235cdf0e10cSrcweir 1236*766ce4d0SZheng Fan sal_Bool OutlinerView::ToggleBullets(sal_Bool bBulletOnOff, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff) 1237*766ce4d0SZheng Fan { 1238*766ce4d0SZheng Fan pOwner->UndoActionStart( OLUNDO_DEPTH ); 1239*766ce4d0SZheng Fan 1240*766ce4d0SZheng Fan ESelection aSel( pEditView->GetSelection() ); 1241*766ce4d0SZheng Fan aSel.Adjust(); 1242*766ce4d0SZheng Fan 1243*766ce4d0SZheng Fan const bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); 1244*766ce4d0SZheng Fan pOwner->pEditEngine->SetUpdateMode( sal_False ); 1245*766ce4d0SZheng Fan 1246*766ce4d0SZheng Fan sal_Int16 nDepth = -2; 1247*766ce4d0SZheng Fan sal_Bool bRet = sal_False; 1248*766ce4d0SZheng Fan 1249*766ce4d0SZheng Fan //Modified by xuezhiy for bullet enhancement 1250*766ce4d0SZheng Fan bool bBulletOn = sal_True; 1251*766ce4d0SZheng Fan 1252*766ce4d0SZheng Fan if( bBulletOnOff ) 1253*766ce4d0SZheng Fan { 1254*766ce4d0SZheng Fan bool bHasBullet = sal_False; 1255*766ce4d0SZheng Fan for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) 1256*766ce4d0SZheng Fan { 1257*766ce4d0SZheng Fan bHasBullet = pOwner->ImplHasBullet(nPara); 1258*766ce4d0SZheng Fan if(bHasBullet) 1259*766ce4d0SZheng Fan break; 1260*766ce4d0SZheng Fan } 1261*766ce4d0SZheng Fan 1262*766ce4d0SZheng Fan if( bHasBullet ) 1263*766ce4d0SZheng Fan { 1264*766ce4d0SZheng Fan bBulletOn = sal_False; 1265*766ce4d0SZheng Fan 1266*766ce4d0SZheng Fan for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) 1267*766ce4d0SZheng Fan { 1268*766ce4d0SZheng Fan Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 1269*766ce4d0SZheng Fan DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); 1270*766ce4d0SZheng Fan 1271*766ce4d0SZheng Fan const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara ); 1272*766ce4d0SZheng Fan if( pPara ) 1273*766ce4d0SZheng Fan { 1274*766ce4d0SZheng Fan const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); 1275*766ce4d0SZheng Fan 1276*766ce4d0SZheng Fan if( !pFmt ) 1277*766ce4d0SZheng Fan { 1278*766ce4d0SZheng Fan // Has no Bullet paragraph 1279*766ce4d0SZheng Fan bBulletOn = sal_True; 1280*766ce4d0SZheng Fan break; 1281*766ce4d0SZheng Fan } 1282*766ce4d0SZheng Fan else if( ( pFmt->GetNumberingType() == SVX_NUM_BITMAP ) || ( pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL ) ) 1283*766ce4d0SZheng Fan { 1284*766ce4d0SZheng Fan // Normal ==>> Numbering 1285*766ce4d0SZheng Fan if( !bNormalBullet ) 1286*766ce4d0SZheng Fan { 1287*766ce4d0SZheng Fan bBulletOn = sal_True; 1288*766ce4d0SZheng Fan break; 1289*766ce4d0SZheng Fan } 1290*766ce4d0SZheng Fan } 1291*766ce4d0SZheng Fan else 1292*766ce4d0SZheng Fan { 1293*766ce4d0SZheng Fan // Numbering ==>> Normal 1294*766ce4d0SZheng Fan if( bNormalBullet ) 1295*766ce4d0SZheng Fan { 1296*766ce4d0SZheng Fan bBulletOn = sal_True; 1297*766ce4d0SZheng Fan break; 1298*766ce4d0SZheng Fan } 1299*766ce4d0SZheng Fan } 1300*766ce4d0SZheng Fan } 1301*766ce4d0SZheng Fan } 1302*766ce4d0SZheng Fan } 1303*766ce4d0SZheng Fan 1304*766ce4d0SZheng Fan } 1305*766ce4d0SZheng Fan if (bForceBulletOnOff) { 1306*766ce4d0SZheng Fan bBulletOn = bBulletOnOff; 1307*766ce4d0SZheng Fan } 1308*766ce4d0SZheng Fan for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) 1309*766ce4d0SZheng Fan { 1310*766ce4d0SZheng Fan Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 1311*766ce4d0SZheng Fan DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); 1312*766ce4d0SZheng Fan 1313*766ce4d0SZheng Fan if( pPara ) 1314*766ce4d0SZheng Fan { 1315*766ce4d0SZheng Fan bRet = sal_True; 1316*766ce4d0SZheng Fan 1317*766ce4d0SZheng Fan nDepth = pOwner->GetDepth(nPara); 1318*766ce4d0SZheng Fan 1319*766ce4d0SZheng Fan if( bBulletOn && nDepth == -1 ) 1320*766ce4d0SZheng Fan { 1321*766ce4d0SZheng Fan // Off ==>> On 1322*766ce4d0SZheng Fan nDepth = 0; 1323*766ce4d0SZheng Fan } 1324*766ce4d0SZheng Fan else if( !bBulletOn && nDepth == 0 ) 1325*766ce4d0SZheng Fan { 1326*766ce4d0SZheng Fan // On ==>> Off 1327*766ce4d0SZheng Fan nDepth = -1; 1328*766ce4d0SZheng Fan } 1329*766ce4d0SZheng Fan pOwner->SetDepth( pPara, nDepth ); 1330*766ce4d0SZheng Fan 1331*766ce4d0SZheng Fan const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara ); 1332*766ce4d0SZheng Fan // bool bBulletState = ((const SfxBoolItem&) rAttrs.Get( EE_PARA_BULLETSTATE ) ).GetValue(); 1333*766ce4d0SZheng Fan 1334*766ce4d0SZheng Fan SfxItemSet aAttrs(rAttrs); 1335*766ce4d0SZheng Fan aAttrs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, bBulletOn ) ); 1336*766ce4d0SZheng Fan 1337*766ce4d0SZheng Fan // Change bullet types 1338*766ce4d0SZheng Fan if( bBulletOn && pNumRule) 1339*766ce4d0SZheng Fan { 1340*766ce4d0SZheng Fan bool bSetBulletType = false; 1341*766ce4d0SZheng Fan if( !bBulletOnOff ) 1342*766ce4d0SZheng Fan { 1343*766ce4d0SZheng Fan // Not bullet on/off button 1344*766ce4d0SZheng Fan bSetBulletType = true; 1345*766ce4d0SZheng Fan } 1346*766ce4d0SZheng Fan else 1347*766ce4d0SZheng Fan { 1348*766ce4d0SZheng Fan const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); 1349*766ce4d0SZheng Fan 1350*766ce4d0SZheng Fan if( !pFmt ) 1351*766ce4d0SZheng Fan { 1352*766ce4d0SZheng Fan // Has no bullet 1353*766ce4d0SZheng Fan bSetBulletType = true; 1354*766ce4d0SZheng Fan } 1355*766ce4d0SZheng Fan else 1356*766ce4d0SZheng Fan { 1357*766ce4d0SZheng Fan sal_Int16 nNumType = pFmt->GetNumberingType(); 1358*766ce4d0SZheng Fan if( bNormalBullet && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL ) 1359*766ce4d0SZheng Fan { 1360*766ce4d0SZheng Fan // Set to Normal bullet, old bullet type is Numbering bullet 1361*766ce4d0SZheng Fan bSetBulletType = true; 1362*766ce4d0SZheng Fan } 1363*766ce4d0SZheng Fan else if( !bNormalBullet && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL) ) 1364*766ce4d0SZheng Fan { 1365*766ce4d0SZheng Fan // Set to Numbering bullet, old bullet type is Normal bullet 1366*766ce4d0SZheng Fan bSetBulletType = true; 1367*766ce4d0SZheng Fan } 1368*766ce4d0SZheng Fan } 1369*766ce4d0SZheng Fan } 1370*766ce4d0SZheng Fan 1371*766ce4d0SZheng Fan // Get old bullet space 1372*766ce4d0SZheng Fan SvxNumRule aNewRule( *pNumRule ); 1373*766ce4d0SZheng Fan 1374*766ce4d0SZheng Fan const SfxPoolItem* pPoolItem=NULL; 1375*766ce4d0SZheng Fan SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem); 1376*766ce4d0SZheng Fan if (eState != SFX_ITEM_SET) 1377*766ce4d0SZheng Fan { 1378*766ce4d0SZheng Fan // Use default value when has not contain bullet item 1379*766ce4d0SZheng Fan ESelection aSelection(nPara, 0); 1380*766ce4d0SZheng Fan SfxItemSet aTmpSet( pOwner->pEditEngine->GetAttribs( aSelection ) ); 1381*766ce4d0SZheng Fan pPoolItem = aTmpSet.GetItem( EE_PARA_NUMBULLET ); 1382*766ce4d0SZheng Fan } 1383*766ce4d0SZheng Fan 1384*766ce4d0SZheng Fan const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >( pPoolItem ); 1385*766ce4d0SZheng Fan //const SvxNumBulletItem& rNumBullet = (const SvxNumBulletItem&) rAttrs.Get( EE_PARA_NUMBULLET ); 1386*766ce4d0SZheng Fan if( pNumBulletItem ) 1387*766ce4d0SZheng Fan { 1388*766ce4d0SZheng Fan sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount(); 1389*766ce4d0SZheng Fan nLevelCnt = Min( nLevelCnt, pNumRule->GetLevelCount() ); 1390*766ce4d0SZheng Fan 1391*766ce4d0SZheng Fan for( sal_uInt16 nLevel = 0; nLevel < nLevelCnt; ++nLevel ) 1392*766ce4d0SZheng Fan { 1393*766ce4d0SZheng Fan const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get( nLevel ); 1394*766ce4d0SZheng Fan const SvxNumberFormat* pNewFmt = pNumRule->Get( nLevel ); 1395*766ce4d0SZheng Fan 1396*766ce4d0SZheng Fan if( pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() 1397*766ce4d0SZheng Fan || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace() ) ) 1398*766ce4d0SZheng Fan { 1399*766ce4d0SZheng Fan SvxNumberFormat* pNewFmtClone = new SvxNumberFormat( *pNewFmt ); 1400*766ce4d0SZheng Fan pNewFmtClone->SetFirstLineOffset( pOldFmt->GetFirstLineOffset() ); 1401*766ce4d0SZheng Fan pNewFmtClone->SetAbsLSpace( pOldFmt->GetAbsLSpace() ); 1402*766ce4d0SZheng Fan 1403*766ce4d0SZheng Fan aNewRule.SetLevel( nLevel, pNewFmtClone ); 1404*766ce4d0SZheng Fan delete pNewFmtClone; 1405*766ce4d0SZheng Fan } 1406*766ce4d0SZheng Fan } 1407*766ce4d0SZheng Fan } 1408*766ce4d0SZheng Fan 1409*766ce4d0SZheng Fan // Don't set bullet attribute to paragraph in Master view 1410*766ce4d0SZheng Fan // Because it will be set into style sheet 1411*766ce4d0SZheng Fan if( bSetBulletType && !bMasterView ) 1412*766ce4d0SZheng Fan aAttrs.Put(SvxNumBulletItem( aNewRule ), EE_PARA_NUMBULLET); 1413*766ce4d0SZheng Fan } 1414*766ce4d0SZheng Fan 1415*766ce4d0SZheng Fan pOwner->SetParaAttribs( nPara, aAttrs ); 1416*766ce4d0SZheng Fan 1417*766ce4d0SZheng Fan } 1418*766ce4d0SZheng Fan } 1419*766ce4d0SZheng Fan 1420*766ce4d0SZheng Fan // --> OD 2009-03-10 #i100014# 1421*766ce4d0SZheng Fan // It is not a good idea to substract 1 from a count and cast the result 1422*766ce4d0SZheng Fan // to sal_uInt16 without check, if the count is 0. 1423*766ce4d0SZheng Fan sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount()); 1424*766ce4d0SZheng Fan // <-- 1425*766ce4d0SZheng Fan pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); 1426*766ce4d0SZheng Fan pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) ); 1427*766ce4d0SZheng Fan 1428*766ce4d0SZheng Fan pOwner->pEditEngine->SetUpdateMode( bUpdate ); 1429*766ce4d0SZheng Fan 1430*766ce4d0SZheng Fan pOwner->UndoActionEnd( OLUNDO_DEPTH ); 1431*766ce4d0SZheng Fan 1432*766ce4d0SZheng Fan return bRet; 1433*766ce4d0SZheng Fan } 1434*766ce4d0SZheng Fan 1435cdf0e10cSrcweir void OutlinerView::EnableBullets() 1436cdf0e10cSrcweir { 1437cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_DEPTH ); 1438cdf0e10cSrcweir 1439cdf0e10cSrcweir ESelection aSel( pEditView->GetSelection() ); 1440cdf0e10cSrcweir aSel.Adjust(); 1441cdf0e10cSrcweir 1442cdf0e10cSrcweir const bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); 1443cdf0e10cSrcweir pOwner->pEditEngine->SetUpdateMode( sal_False ); 1444cdf0e10cSrcweir 1445cdf0e10cSrcweir for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) 1446cdf0e10cSrcweir { 1447cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 1448cdf0e10cSrcweir DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); 1449cdf0e10cSrcweir 1450cdf0e10cSrcweir if( pPara && (pOwner->GetDepth(nPara) == -1) ) 1451cdf0e10cSrcweir { 1452cdf0e10cSrcweir pOwner->SetDepth( pPara, 0 ); 1453cdf0e10cSrcweir } 1454cdf0e10cSrcweir } 1455cdf0e10cSrcweir 1456cdf0e10cSrcweir // --> OD 2009-03-10 #i100014# 1457cdf0e10cSrcweir // It is not a good idea to substract 1 from a count and cast the result 1458cdf0e10cSrcweir // to sal_uInt16 without check, if the count is 0. 1459cdf0e10cSrcweir sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount()); 1460cdf0e10cSrcweir // <-- 1461cdf0e10cSrcweir pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); 1462cdf0e10cSrcweir pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) ); 1463cdf0e10cSrcweir 1464cdf0e10cSrcweir pOwner->pEditEngine->SetUpdateMode( bUpdate ); 1465cdf0e10cSrcweir 1466cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_DEPTH ); 1467cdf0e10cSrcweir } 1468cdf0e10cSrcweir 1469*766ce4d0SZheng Fan sal_Bool OutlinerView::ToggleAllParagraphsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bToggleOn, sal_Bool bMasterView, SvxNumRule* pNumRule) 1470*766ce4d0SZheng Fan { 1471*766ce4d0SZheng Fan if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList) 1472*766ce4d0SZheng Fan { 1473*766ce4d0SZheng Fan return sal_False; 1474*766ce4d0SZheng Fan } 1475*766ce4d0SZheng Fan 1476*766ce4d0SZheng Fan sal_Bool bReturn = sal_False; 1477*766ce4d0SZheng Fan pOwner->UndoActionStart(OLUNDO_DEPTH); 1478*766ce4d0SZheng Fan const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); 1479*766ce4d0SZheng Fan pOwner->pEditEngine->SetUpdateMode(sal_False); 1480*766ce4d0SZheng Fan 1481*766ce4d0SZheng Fan sal_Int16 nDepth = -2; 1482*766ce4d0SZheng Fan sal_uInt16 nParaCount = (sal_uInt16)(pOwner->pParaList->GetParagraphCount()); 1483*766ce4d0SZheng Fan for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++) 1484*766ce4d0SZheng Fan { 1485*766ce4d0SZheng Fan Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara); 1486*766ce4d0SZheng Fan DBG_ASSERT(pPara, "OutlinerView::ToggleAllParagraphsBullets(), illegal selection?"); 1487*766ce4d0SZheng Fan 1488*766ce4d0SZheng Fan if (pPara) 1489*766ce4d0SZheng Fan { 1490*766ce4d0SZheng Fan bReturn = sal_True; 1491*766ce4d0SZheng Fan nDepth = pOwner->GetDepth(nPara); 1492*766ce4d0SZheng Fan if (bToggleOn && nDepth == -1) 1493*766ce4d0SZheng Fan { 1494*766ce4d0SZheng Fan // Off ==>> On 1495*766ce4d0SZheng Fan nDepth = 0; 1496*766ce4d0SZheng Fan } 1497*766ce4d0SZheng Fan else if (!bToggleOn && nDepth == 0) 1498*766ce4d0SZheng Fan { 1499*766ce4d0SZheng Fan // On ==>> Off 1500*766ce4d0SZheng Fan nDepth = -1; 1501*766ce4d0SZheng Fan } 1502*766ce4d0SZheng Fan pOwner->SetDepth(pPara, nDepth); 1503*766ce4d0SZheng Fan 1504*766ce4d0SZheng Fan const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara); 1505*766ce4d0SZheng Fan SfxItemSet aAttrs(rAttrs); 1506*766ce4d0SZheng Fan aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, bToggleOn)); 1507*766ce4d0SZheng Fan 1508*766ce4d0SZheng Fan // Change bullet types. 1509*766ce4d0SZheng Fan if (bToggleOn && pNumRule) 1510*766ce4d0SZheng Fan { 1511*766ce4d0SZheng Fan sal_Bool bSetBulletType = sal_False; 1512*766ce4d0SZheng Fan if (!bBulletOnOffMode) 1513*766ce4d0SZheng Fan { 1514*766ce4d0SZheng Fan // Not bullet on/off button. 1515*766ce4d0SZheng Fan bSetBulletType = sal_True; 1516*766ce4d0SZheng Fan } 1517*766ce4d0SZheng Fan else 1518*766ce4d0SZheng Fan { 1519*766ce4d0SZheng Fan const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); 1520*766ce4d0SZheng Fan if (!pFmt) 1521*766ce4d0SZheng Fan { 1522*766ce4d0SZheng Fan // Has no bullet. 1523*766ce4d0SZheng Fan bSetBulletType = sal_True; 1524*766ce4d0SZheng Fan } 1525*766ce4d0SZheng Fan else 1526*766ce4d0SZheng Fan { 1527*766ce4d0SZheng Fan sal_Int16 nNumType = pFmt->GetNumberingType(); 1528*766ce4d0SZheng Fan if (bNormalBullet && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL) 1529*766ce4d0SZheng Fan { 1530*766ce4d0SZheng Fan // Set to Normal bullet, old bullet type is Numbering bullet. 1531*766ce4d0SZheng Fan bSetBulletType = sal_True; 1532*766ce4d0SZheng Fan } 1533*766ce4d0SZheng Fan else if (!bNormalBullet && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL)) 1534*766ce4d0SZheng Fan { 1535*766ce4d0SZheng Fan // Set to Numbering bullet, old bullet type is Normal bullet. 1536*766ce4d0SZheng Fan bSetBulletType = sal_True; 1537*766ce4d0SZheng Fan } 1538*766ce4d0SZheng Fan } 1539*766ce4d0SZheng Fan } 1540*766ce4d0SZheng Fan 1541*766ce4d0SZheng Fan // Get old bullet space. 1542*766ce4d0SZheng Fan SvxNumRule aNewRule(*pNumRule); 1543*766ce4d0SZheng Fan const SfxPoolItem* pPoolItem=NULL; 1544*766ce4d0SZheng Fan SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem); 1545*766ce4d0SZheng Fan ESelection aSelection(nPara, 0); 1546*766ce4d0SZheng Fan SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection)); 1547*766ce4d0SZheng Fan if (eState != SFX_ITEM_SET) 1548*766ce4d0SZheng Fan { 1549*766ce4d0SZheng Fan // Use default value when has not contain bullet item. 1550*766ce4d0SZheng Fan pPoolItem = aTmpSet.GetItem(EE_PARA_NUMBULLET); 1551*766ce4d0SZheng Fan } 1552*766ce4d0SZheng Fan 1553*766ce4d0SZheng Fan const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem); 1554*766ce4d0SZheng Fan if (pNumBulletItem) 1555*766ce4d0SZheng Fan { 1556*766ce4d0SZheng Fan sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount(); 1557*766ce4d0SZheng Fan nLevelCnt = Min(nLevelCnt, pNumRule->GetLevelCount()); 1558*766ce4d0SZheng Fan 1559*766ce4d0SZheng Fan for (sal_uInt16 nLevel = 0; nLevel < nLevelCnt; nLevel++) 1560*766ce4d0SZheng Fan { 1561*766ce4d0SZheng Fan const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get(nLevel); 1562*766ce4d0SZheng Fan const SvxNumberFormat* pNewFmt = pNumRule->Get(nLevel); 1563*766ce4d0SZheng Fan if (pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace())) 1564*766ce4d0SZheng Fan { 1565*766ce4d0SZheng Fan SvxNumberFormat* pNewFmtClone = new SvxNumberFormat(*pNewFmt); 1566*766ce4d0SZheng Fan pNewFmtClone->SetFirstLineOffset(pOldFmt->GetFirstLineOffset()); 1567*766ce4d0SZheng Fan pNewFmtClone->SetAbsLSpace(pOldFmt->GetAbsLSpace()); 1568*766ce4d0SZheng Fan aNewRule.SetLevel(nLevel, pNewFmtClone); 1569*766ce4d0SZheng Fan delete pNewFmtClone; 1570*766ce4d0SZheng Fan } 1571*766ce4d0SZheng Fan } 1572*766ce4d0SZheng Fan } 1573*766ce4d0SZheng Fan 1574*766ce4d0SZheng Fan // Don't set bullet attribute to paragraph in Master view, because it will be set into style sheet. 1575*766ce4d0SZheng Fan if (bSetBulletType && !bMasterView) 1576*766ce4d0SZheng Fan aAttrs.Put(SvxNumBulletItem(aNewRule), EE_PARA_NUMBULLET); 1577*766ce4d0SZheng Fan } 1578*766ce4d0SZheng Fan pOwner->SetParaAttribs(nPara, aAttrs); 1579*766ce4d0SZheng Fan } 1580*766ce4d0SZheng Fan } 1581*766ce4d0SZheng Fan 1582*766ce4d0SZheng Fan pOwner->ImplCheckParagraphs(0, nParaCount); 1583*766ce4d0SZheng Fan pOwner->pEditEngine->QuickMarkInvalid(ESelection(0, 0, nParaCount, 0)); 1584*766ce4d0SZheng Fan pOwner->pEditEngine->SetUpdateMode(bUpdate); 1585*766ce4d0SZheng Fan pOwner->UndoActionEnd(OLUNDO_DEPTH); 1586*766ce4d0SZheng Fan 1587*766ce4d0SZheng Fan return bReturn; 1588*766ce4d0SZheng Fan } 1589cdf0e10cSrcweir 1590cdf0e10cSrcweir void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ) 1591cdf0e10cSrcweir { 1592cdf0e10cSrcweir RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ ); 1593cdf0e10cSrcweir } 1594cdf0e10cSrcweir 1595cdf0e10cSrcweir void OutlinerView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich, sal_Bool bKeepLanguages ) 1596cdf0e10cSrcweir { 1597cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1598cdf0e10cSrcweir sal_Bool bUpdate = pOwner->GetUpdateMode(); 1599cdf0e10cSrcweir pOwner->SetUpdateMode( sal_False ); 1600cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_ATTR ); 1601cdf0e10cSrcweir if (bKeepLanguages) 1602cdf0e10cSrcweir pEditView->RemoveAttribsKeepLanguages( bRemoveParaAttribs ); 1603cdf0e10cSrcweir else 1604cdf0e10cSrcweir pEditView->RemoveAttribs( bRemoveParaAttribs, nWhich ); 1605cdf0e10cSrcweir if ( bRemoveParaAttribs ) 1606cdf0e10cSrcweir { 1607cdf0e10cSrcweir // Ueber alle Absaetze, und Einrueckung und Level einstellen 1608cdf0e10cSrcweir ESelection aSel = pEditView->GetSelection(); 1609cdf0e10cSrcweir aSel.Adjust(); 1610cdf0e10cSrcweir for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) 1611cdf0e10cSrcweir { 1612cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); 1613cdf0e10cSrcweir pOwner->ImplInitDepth( nPara, pPara->GetDepth(), sal_False, sal_False ); 1614cdf0e10cSrcweir } 1615cdf0e10cSrcweir } 1616cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_ATTR ); 1617cdf0e10cSrcweir pOwner->SetUpdateMode( bUpdate ); 1618cdf0e10cSrcweir } 1619cdf0e10cSrcweir 1620cdf0e10cSrcweir 1621cdf0e10cSrcweir 1622cdf0e10cSrcweir // ===================================================================== 1623cdf0e10cSrcweir // ====================== Einfache Durchreicher ======================= 1624cdf0e10cSrcweir // ====================================================================== 1625cdf0e10cSrcweir 1626cdf0e10cSrcweir 1627cdf0e10cSrcweir void OutlinerView::InsertText( const XubString& rNew, sal_Bool bSelect ) 1628cdf0e10cSrcweir { 1629cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1630cdf0e10cSrcweir if( pOwner->bFirstParaIsEmpty ) 1631cdf0e10cSrcweir pOwner->Insert( String() ); 1632cdf0e10cSrcweir pEditView->InsertText( rNew, bSelect ); 1633cdf0e10cSrcweir } 1634cdf0e10cSrcweir 1635cdf0e10cSrcweir void OutlinerView::SetVisArea( const Rectangle& rRec ) 1636cdf0e10cSrcweir { 1637cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1638cdf0e10cSrcweir pEditView->SetVisArea( rRec ); 1639cdf0e10cSrcweir } 1640cdf0e10cSrcweir 1641cdf0e10cSrcweir 1642cdf0e10cSrcweir void OutlinerView::SetSelection( const ESelection& rSel ) 1643cdf0e10cSrcweir { 1644cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1645cdf0e10cSrcweir pEditView->SetSelection( rSel ); 1646cdf0e10cSrcweir } 1647cdf0e10cSrcweir 1648cdf0e10cSrcweir void OutlinerView::SetReadOnly( sal_Bool bReadOnly ) 1649cdf0e10cSrcweir { 1650cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1651cdf0e10cSrcweir pEditView->SetReadOnly( bReadOnly ); 1652cdf0e10cSrcweir } 1653cdf0e10cSrcweir 1654cdf0e10cSrcweir sal_Bool OutlinerView::IsReadOnly() const 1655cdf0e10cSrcweir { 1656cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1657cdf0e10cSrcweir return pEditView->IsReadOnly(); 1658cdf0e10cSrcweir } 1659cdf0e10cSrcweir 1660cdf0e10cSrcweir sal_Bool OutlinerView::HasSelection() const 1661cdf0e10cSrcweir { 1662cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1663cdf0e10cSrcweir return pEditView->HasSelection(); 1664cdf0e10cSrcweir } 1665cdf0e10cSrcweir 1666cdf0e10cSrcweir 1667cdf0e10cSrcweir void OutlinerView::ShowCursor( sal_Bool bGotoCursor ) 1668cdf0e10cSrcweir { 1669cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1670cdf0e10cSrcweir pEditView->ShowCursor( bGotoCursor ); 1671cdf0e10cSrcweir } 1672cdf0e10cSrcweir 1673cdf0e10cSrcweir 1674cdf0e10cSrcweir void OutlinerView::HideCursor() 1675cdf0e10cSrcweir { 1676cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1677cdf0e10cSrcweir pEditView->HideCursor(); 1678cdf0e10cSrcweir } 1679cdf0e10cSrcweir 1680cdf0e10cSrcweir 1681cdf0e10cSrcweir void OutlinerView::SetWindow( Window* pWin ) 1682cdf0e10cSrcweir { 1683cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1684cdf0e10cSrcweir pEditView->SetWindow( pWin ); 1685cdf0e10cSrcweir } 1686cdf0e10cSrcweir 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir Window* OutlinerView::GetWindow() const 1689cdf0e10cSrcweir { 1690cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1691cdf0e10cSrcweir return pEditView->GetWindow(); 1692cdf0e10cSrcweir } 1693cdf0e10cSrcweir 1694cdf0e10cSrcweir 1695cdf0e10cSrcweir void OutlinerView::SetOutputArea( const Rectangle& rRect ) 1696cdf0e10cSrcweir { 1697cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1698cdf0e10cSrcweir pEditView->SetOutputArea( rRect ); 1699cdf0e10cSrcweir } 1700cdf0e10cSrcweir 1701cdf0e10cSrcweir 1702cdf0e10cSrcweir Rectangle OutlinerView::GetOutputArea() const 1703cdf0e10cSrcweir { 1704cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1705cdf0e10cSrcweir return pEditView->GetOutputArea(); 1706cdf0e10cSrcweir } 1707cdf0e10cSrcweir 1708cdf0e10cSrcweir 1709cdf0e10cSrcweir XubString OutlinerView::GetSelected() const 1710cdf0e10cSrcweir { 1711cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1712cdf0e10cSrcweir return pEditView->GetSelected(); 1713cdf0e10cSrcweir } 1714cdf0e10cSrcweir 1715cdf0e10cSrcweir 1716cdf0e10cSrcweir void OutlinerView::RemoveCharAttribs( sal_uLong nPara, sal_uInt16 nWhich) 1717cdf0e10cSrcweir { 1718cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1719cdf0e10cSrcweir pEditView->RemoveCharAttribs( (sal_uInt16)nPara, nWhich); 1720cdf0e10cSrcweir } 1721cdf0e10cSrcweir 1722cdf0e10cSrcweir 1723cdf0e10cSrcweir void OutlinerView::CompleteAutoCorrect() 1724cdf0e10cSrcweir { 1725cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1726cdf0e10cSrcweir pEditView->CompleteAutoCorrect(); 1727cdf0e10cSrcweir } 1728cdf0e10cSrcweir 1729cdf0e10cSrcweir 1730cdf0e10cSrcweir EESpellState OutlinerView::StartSpeller( sal_Bool bMultiDoc ) 1731cdf0e10cSrcweir { 1732cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1733cdf0e10cSrcweir return pEditView->StartSpeller( bMultiDoc ); 1734cdf0e10cSrcweir } 1735cdf0e10cSrcweir 1736cdf0e10cSrcweir 1737cdf0e10cSrcweir EESpellState OutlinerView::StartThesaurus() 1738cdf0e10cSrcweir { 1739cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1740cdf0e10cSrcweir return pEditView->StartThesaurus(); 1741cdf0e10cSrcweir } 1742cdf0e10cSrcweir 1743cdf0e10cSrcweir 1744cdf0e10cSrcweir void OutlinerView::StartTextConversion( 1745cdf0e10cSrcweir LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, 1746cdf0e10cSrcweir sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ) 1747cdf0e10cSrcweir { 1748cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1749cdf0e10cSrcweir if ( 1750cdf0e10cSrcweir (LANGUAGE_KOREAN == nSrcLang && LANGUAGE_KOREAN == nDestLang) || 1751cdf0e10cSrcweir (LANGUAGE_CHINESE_SIMPLIFIED == nSrcLang && LANGUAGE_CHINESE_TRADITIONAL == nDestLang) || 1752cdf0e10cSrcweir (LANGUAGE_CHINESE_TRADITIONAL == nSrcLang && LANGUAGE_CHINESE_SIMPLIFIED == nDestLang) 1753cdf0e10cSrcweir ) 1754cdf0e10cSrcweir { 1755cdf0e10cSrcweir pEditView->StartTextConversion( nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc ); 1756cdf0e10cSrcweir } 1757cdf0e10cSrcweir else 1758cdf0e10cSrcweir { 1759cdf0e10cSrcweir DBG_ERROR( "unexpected language" ); 1760cdf0e10cSrcweir } 1761cdf0e10cSrcweir } 1762cdf0e10cSrcweir 1763cdf0e10cSrcweir 1764cdf0e10cSrcweir sal_uInt16 OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem ) 1765cdf0e10cSrcweir { 1766cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1767cdf0e10cSrcweir return pEditView->StartSearchAndReplace( rSearchItem ); 1768cdf0e10cSrcweir } 1769cdf0e10cSrcweir 1770cdf0e10cSrcweir void OutlinerView::TransliterateText( sal_Int32 nTransliterationMode ) 1771cdf0e10cSrcweir { 1772cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1773cdf0e10cSrcweir pEditView->TransliterateText( nTransliterationMode ); 1774cdf0e10cSrcweir } 1775cdf0e10cSrcweir 1776cdf0e10cSrcweir 1777cdf0e10cSrcweir 1778cdf0e10cSrcweir ESelection OutlinerView::GetSelection() 1779cdf0e10cSrcweir { 1780cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1781cdf0e10cSrcweir return pEditView->GetSelection(); 1782cdf0e10cSrcweir } 1783cdf0e10cSrcweir 1784cdf0e10cSrcweir 1785cdf0e10cSrcweir void OutlinerView::Scroll( long nHorzScroll, long nVertScroll ) 1786cdf0e10cSrcweir { 1787cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1788cdf0e10cSrcweir pEditView->Scroll( nHorzScroll, nVertScroll ); 1789cdf0e10cSrcweir } 1790cdf0e10cSrcweir 1791cdf0e10cSrcweir 1792cdf0e10cSrcweir void OutlinerView::SetControlWord( sal_uLong nWord ) 1793cdf0e10cSrcweir { 1794cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1795cdf0e10cSrcweir pEditView->SetControlWord( nWord ); 1796cdf0e10cSrcweir } 1797cdf0e10cSrcweir 1798cdf0e10cSrcweir 1799cdf0e10cSrcweir sal_uLong OutlinerView::GetControlWord() const 1800cdf0e10cSrcweir { 1801cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1802cdf0e10cSrcweir return pEditView->GetControlWord(); 1803cdf0e10cSrcweir } 1804cdf0e10cSrcweir 1805cdf0e10cSrcweir 1806cdf0e10cSrcweir void OutlinerView::SetAnchorMode( EVAnchorMode eMode ) 1807cdf0e10cSrcweir { 1808cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1809cdf0e10cSrcweir pEditView->SetAnchorMode( eMode ); 1810cdf0e10cSrcweir } 1811cdf0e10cSrcweir 1812cdf0e10cSrcweir 1813cdf0e10cSrcweir EVAnchorMode OutlinerView::GetAnchorMode() const 1814cdf0e10cSrcweir { 1815cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1816cdf0e10cSrcweir return pEditView->GetAnchorMode(); 1817cdf0e10cSrcweir } 1818cdf0e10cSrcweir 1819cdf0e10cSrcweir 1820cdf0e10cSrcweir void OutlinerView::Undo() 1821cdf0e10cSrcweir { 1822cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1823cdf0e10cSrcweir pEditView->Undo(); 1824cdf0e10cSrcweir } 1825cdf0e10cSrcweir 1826cdf0e10cSrcweir 1827cdf0e10cSrcweir void OutlinerView::Redo() 1828cdf0e10cSrcweir { 1829cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1830cdf0e10cSrcweir pEditView->Redo(); 1831cdf0e10cSrcweir } 1832cdf0e10cSrcweir 1833cdf0e10cSrcweir 1834cdf0e10cSrcweir void OutlinerView::EnablePaste( sal_Bool bEnable ) 1835cdf0e10cSrcweir { 1836cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1837cdf0e10cSrcweir pEditView->EnablePaste( bEnable ); 1838cdf0e10cSrcweir } 1839cdf0e10cSrcweir 1840cdf0e10cSrcweir 1841cdf0e10cSrcweir void OutlinerView::Copy() 1842cdf0e10cSrcweir { 1843cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1844cdf0e10cSrcweir pEditView->Copy(); 1845cdf0e10cSrcweir } 1846cdf0e10cSrcweir 1847cdf0e10cSrcweir 1848cdf0e10cSrcweir void OutlinerView::InsertField( const SvxFieldItem& rFld ) 1849cdf0e10cSrcweir { 1850cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1851cdf0e10cSrcweir pEditView->InsertField( rFld ); 1852cdf0e10cSrcweir } 1853cdf0e10cSrcweir 1854cdf0e10cSrcweir 1855cdf0e10cSrcweir const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer() const 1856cdf0e10cSrcweir { 1857cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1858cdf0e10cSrcweir return pEditView->GetFieldUnderMousePointer(); 1859cdf0e10cSrcweir } 1860cdf0e10cSrcweir 1861cdf0e10cSrcweir 1862cdf0e10cSrcweir const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer( sal_uInt16& nPara, sal_uInt16& nPos ) const 1863cdf0e10cSrcweir { 1864cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1865cdf0e10cSrcweir return pEditView->GetFieldUnderMousePointer( nPara, nPos ); 1866cdf0e10cSrcweir } 1867cdf0e10cSrcweir 1868cdf0e10cSrcweir 1869cdf0e10cSrcweir const SvxFieldItem* OutlinerView::GetFieldAtSelection() const 1870cdf0e10cSrcweir { 1871cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1872cdf0e10cSrcweir return pEditView->GetFieldAtSelection(); 1873cdf0e10cSrcweir } 1874cdf0e10cSrcweir 1875cdf0e10cSrcweir void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel ) 1876cdf0e10cSrcweir { 1877cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1878cdf0e10cSrcweir pEditView->SetInvalidateMore( nPixel ); 1879cdf0e10cSrcweir } 1880cdf0e10cSrcweir 1881cdf0e10cSrcweir 1882cdf0e10cSrcweir sal_uInt16 OutlinerView::GetInvalidateMore() const 1883cdf0e10cSrcweir { 1884cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1885cdf0e10cSrcweir return pEditView->GetInvalidateMore(); 1886cdf0e10cSrcweir } 1887cdf0e10cSrcweir 1888cdf0e10cSrcweir 1889cdf0e10cSrcweir sal_Bool OutlinerView::IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong ) 1890cdf0e10cSrcweir { 1891cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1892cdf0e10cSrcweir return pEditView->IsCursorAtWrongSpelledWord( bMarkIfWrong ); 1893cdf0e10cSrcweir } 1894cdf0e10cSrcweir 1895cdf0e10cSrcweir 1896cdf0e10cSrcweir sal_Bool OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong ) 1897cdf0e10cSrcweir { 1898cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1899cdf0e10cSrcweir return pEditView->IsWrongSpelledWordAtPos( rPosPixel, bMarkIfWrong ); 1900cdf0e10cSrcweir } 1901cdf0e10cSrcweir 1902cdf0e10cSrcweir 1903cdf0e10cSrcweir void OutlinerView::SpellIgnoreWord() 1904cdf0e10cSrcweir { 1905cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1906cdf0e10cSrcweir pEditView->SpellIgnoreWord(); 1907cdf0e10cSrcweir } 1908cdf0e10cSrcweir 1909cdf0e10cSrcweir 1910cdf0e10cSrcweir void OutlinerView::ExecuteSpellPopup( const Point& rPosPixel, Link* pStartDlg ) 1911cdf0e10cSrcweir { 1912cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1913cdf0e10cSrcweir pEditView->ExecuteSpellPopup( rPosPixel, pStartDlg ); 1914cdf0e10cSrcweir } 1915cdf0e10cSrcweir 1916cdf0e10cSrcweir sal_uLong OutlinerView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs ) 1917cdf0e10cSrcweir { 1918cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1919cdf0e10cSrcweir sal_uInt16 nOldParaCount = pEditView->GetEditEngine()->GetParagraphCount(); 1920cdf0e10cSrcweir ESelection aOldSel = pEditView->GetSelection(); 1921cdf0e10cSrcweir aOldSel.Adjust(); 1922cdf0e10cSrcweir 1923cdf0e10cSrcweir sal_uLong nRet = pEditView->Read( rInput, rBaseURL, eFormat, bSelect, pHTTPHeaderAttrs ); 1924cdf0e10cSrcweir 1925cdf0e10cSrcweir // MT 08/00: Hier sollte eigentlich das gleiche wie in PasteSpecial passieren! 1926cdf0e10cSrcweir // Mal anpassen, wenn dieses ImplInitPaste und ImpPasted-Geraffel ueberarbeitet ist. 1927cdf0e10cSrcweir 1928cdf0e10cSrcweir long nParaDiff = pEditView->GetEditEngine()->GetParagraphCount() - nOldParaCount; 1929cdf0e10cSrcweir sal_uInt16 nChangesStart = aOldSel.nStartPara; 1930cdf0e10cSrcweir sal_uInt16 nChangesEnd = sal::static_int_cast< sal_uInt16 >(nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara)); 1931cdf0e10cSrcweir 1932cdf0e10cSrcweir for ( sal_uInt16 n = nChangesStart; n <= nChangesEnd; n++ ) 1933cdf0e10cSrcweir { 1934cdf0e10cSrcweir if ( eFormat == EE_FORMAT_BIN ) 1935cdf0e10cSrcweir { 1936cdf0e10cSrcweir sal_uInt16 nDepth = 0; 1937cdf0e10cSrcweir const SfxItemSet& rAttrs = pOwner->GetParaAttribs( n ); 1938cdf0e10cSrcweir const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL ); 1939cdf0e10cSrcweir nDepth = rLevel.GetValue(); 1940cdf0e10cSrcweir pOwner->ImplInitDepth( n, nDepth, sal_False ); 1941cdf0e10cSrcweir } 1942cdf0e10cSrcweir 1943cdf0e10cSrcweir if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) 1944cdf0e10cSrcweir pOwner->ImplSetLevelDependendStyleSheet( n ); 1945cdf0e10cSrcweir } 1946cdf0e10cSrcweir 1947cdf0e10cSrcweir if ( eFormat != EE_FORMAT_BIN ) 1948cdf0e10cSrcweir { 1949cdf0e10cSrcweir pOwner->ImpFilterIndents( nChangesStart, nChangesEnd ); 1950cdf0e10cSrcweir } 1951cdf0e10cSrcweir 1952cdf0e10cSrcweir return nRet; 1953cdf0e10cSrcweir } 1954cdf0e10cSrcweir 1955cdf0e10cSrcweir sal_uLong OutlinerView::Write( SvStream& rOutput, EETextFormat eFormat ) 1956cdf0e10cSrcweir { 1957cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1958cdf0e10cSrcweir return pEditView->Write( rOutput, eFormat ); 1959cdf0e10cSrcweir } 1960cdf0e10cSrcweir 1961cdf0e10cSrcweir void OutlinerView::SetBackgroundColor( const Color& rColor ) 1962cdf0e10cSrcweir { 1963cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1964cdf0e10cSrcweir pEditView->SetBackgroundColor( rColor ); 1965cdf0e10cSrcweir } 1966cdf0e10cSrcweir 1967cdf0e10cSrcweir 1968cdf0e10cSrcweir Color OutlinerView::GetBackgroundColor() 1969cdf0e10cSrcweir { 1970cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1971cdf0e10cSrcweir return pEditView->GetBackgroundColor(); 1972cdf0e10cSrcweir } 1973cdf0e10cSrcweir 1974cdf0e10cSrcweir SfxItemSet OutlinerView::GetAttribs() 1975cdf0e10cSrcweir { 1976cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1977cdf0e10cSrcweir return pEditView->GetAttribs(); 1978cdf0e10cSrcweir } 1979cdf0e10cSrcweir 1980cdf0e10cSrcweir sal_uInt16 OutlinerView::GetSelectedScriptType() const 1981cdf0e10cSrcweir { 1982cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1983cdf0e10cSrcweir return pEditView->GetSelectedScriptType(); 1984cdf0e10cSrcweir } 1985cdf0e10cSrcweir 1986cdf0e10cSrcweir String OutlinerView::GetSurroundingText() const 1987cdf0e10cSrcweir { 1988cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1989cdf0e10cSrcweir return pEditView->GetSurroundingText(); 1990cdf0e10cSrcweir } 1991cdf0e10cSrcweir 1992cdf0e10cSrcweir Selection OutlinerView::GetSurroundingTextSelection() const 1993cdf0e10cSrcweir { 1994cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0); 1995cdf0e10cSrcweir return pEditView->GetSurroundingTextSelection(); 1996cdf0e10cSrcweir } 1997cdf0e10cSrcweir 1998cdf0e10cSrcweir 1999cdf0e10cSrcweir // ====================================================================== 2000cdf0e10cSrcweir // ===== some code for thesaurus sub menu within context menu 2001cdf0e10cSrcweir // ====================================================================== 2002cdf0e10cSrcweir 2003cdf0e10cSrcweir // returns: true if a word for thesaurus look-up was found at the current cursor position. 2004cdf0e10cSrcweir // The status string will be word + iso language string (e.g. "light#en-US") 2005cdf0e10cSrcweir bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( 2006cdf0e10cSrcweir String &rStatusVal, 2007cdf0e10cSrcweir LanguageType &rLang, 2008cdf0e10cSrcweir const EditView &rEditView ) 2009cdf0e10cSrcweir { 2010cdf0e10cSrcweir // get text and locale for thesaurus look up 2011cdf0e10cSrcweir String aText; 2012cdf0e10cSrcweir EditEngine *pEditEngine = rEditView.GetEditEngine(); 2013cdf0e10cSrcweir ESelection aTextSel( rEditView.GetSelection() ); 2014cdf0e10cSrcweir if (!aTextSel.HasRange()) 2015cdf0e10cSrcweir aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD ); 2016cdf0e10cSrcweir aText = pEditEngine->GetText( aTextSel ); 2017cdf0e10cSrcweir aTextSel.Adjust(); 2018cdf0e10cSrcweir LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos ); 2019cdf0e10cSrcweir String aLangText( MsLangId::convertLanguageToIsoString( nLang ) ); 2020cdf0e10cSrcweir 2021cdf0e10cSrcweir // set word and locale to look up as status value 2022cdf0e10cSrcweir String aStatusVal( aText ); 2023cdf0e10cSrcweir aStatusVal.AppendAscii( "#" ); 2024cdf0e10cSrcweir aStatusVal += aLangText; 2025cdf0e10cSrcweir 2026cdf0e10cSrcweir rStatusVal = aStatusVal; 2027cdf0e10cSrcweir rLang = nLang; 2028cdf0e10cSrcweir 2029cdf0e10cSrcweir return aText.Len() > 0; 2030cdf0e10cSrcweir } 2031cdf0e10cSrcweir 2032cdf0e10cSrcweir 2033cdf0e10cSrcweir void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ) 2034cdf0e10cSrcweir { 2035cdf0e10cSrcweir // get selection to use 2036cdf0e10cSrcweir ESelection aCurSel( rEditView.GetSelection() ); 2037cdf0e10cSrcweir if (!rEditView.HasSelection()) 2038cdf0e10cSrcweir { 2039cdf0e10cSrcweir // select the same word that was used in GetStatusValueForThesaurusFromContext by calling GetWord. 2040cdf0e10cSrcweir // (In the end both functions will call ImpEditEngine::SelectWord) 2041cdf0e10cSrcweir rEditView.SelectCurrentWord( i18n::WordType::DICTIONARY_WORD ); 2042cdf0e10cSrcweir aCurSel = rEditView.GetSelection(); 2043cdf0e10cSrcweir } 2044cdf0e10cSrcweir 2045cdf0e10cSrcweir // replace word ... 2046cdf0e10cSrcweir rEditView.InsertText( rSynonmText ); 2047cdf0e10cSrcweir rEditView.ShowCursor( sal_True, sal_False ); 2048cdf0e10cSrcweir } 2049cdf0e10cSrcweir 2050cdf0e10cSrcweir 2051