LCOV - code coverage report
Current view: top level - editeng/source/outliner - outlvw.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 70 628 11.1 %
Date: 2012-08-25 Functions: 17 81 21.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 42 939 4.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <com/sun/star/i18n/WordType.hpp>
      30                 :            : 
      31                 :            : #include <svl/intitem.hxx>
      32                 :            : #include <editeng/editeng.hxx>
      33                 :            : #include <editeng/editview.hxx>
      34                 :            : #include <editeng/editdata.hxx>
      35                 :            : #include <editeng/eerdll.hxx>
      36                 :            : #include <editeng/lrspitem.hxx>
      37                 :            : #include <editeng/fhgtitem.hxx>
      38                 :            : 
      39                 :            : #include <svl/style.hxx>
      40                 :            : #include <i18npool/mslangid.hxx>
      41                 :            : 
      42                 :            : #define _OUTLINER_CXX
      43                 :            : #include <editeng/outliner.hxx>
      44                 :            : #include <outleeng.hxx>
      45                 :            : #include <paralist.hxx>
      46                 :            : #include <outlundo.hxx>
      47                 :            : #include <editeng/outlobj.hxx>
      48                 :            : #include <editeng/flditem.hxx>
      49                 :            : #include <editeng/eeitem.hxx>
      50                 :            : #include <editeng/numitem.hxx>
      51                 :            : #include <vcl/window.hxx>
      52                 :            : #include <svl/itemset.hxx>
      53                 :            : #include <editeng/editstat.hxx>
      54                 :            : 
      55                 :            : using namespace ::com::sun::star;
      56                 :            : 
      57                 :            : DBG_NAME(OutlinerView)
      58                 :            : 
      59                 :            : 
      60                 :         18 : OutlinerView::OutlinerView( Outliner* pOut, Window* pWin )
      61                 :            : {
      62                 :            :     DBG_CTOR( OutlinerView, 0 );
      63                 :            : 
      64                 :         18 :     pOwner                      = pOut;
      65                 :         18 :     bDDCursorVisible            = sal_False;
      66                 :         18 :     bInDragMode                 = sal_False;
      67                 :         18 :     nDDScrollLRBorderWidthWin   = 0;
      68                 :         18 :     nDDScrollTBBorderWidthWin   = 0;
      69                 :         18 :     pHorTabArrDoc               = 0;
      70                 :            : 
      71         [ +  - ]:         18 :     pEditView = new EditView( pOut->pEditEngine, pWin );
      72                 :         18 :     pEditView->SetSelectionMode( EE_SELMODE_TXTONLY );
      73                 :         18 : }
      74                 :            : 
      75                 :         30 : OutlinerView::~OutlinerView()
      76                 :            : {
      77                 :            :     DBG_DTOR(OutlinerView,0);
      78         [ +  - ]:         15 :     delete pEditView;
      79         [ -  + ]:         30 : }
      80                 :            : 
      81                 :          0 : void OutlinerView::Paint( const Rectangle& rRect )
      82                 :            : {
      83                 :            :     DBG_CHKTHIS(OutlinerView,0);
      84                 :            : 
      85                 :            :     // For the first Paint/KeyInput/Drop an emty Outliner is turned into
      86                 :            :     // an Outliner with exactly one paragraph.
      87         [ #  # ]:          0 :     if( pOwner->bFirstParaIsEmpty )
      88         [ #  # ]:          0 :         pOwner->Insert( String() );
      89                 :            : 
      90                 :          0 :     pEditView->Paint( rRect );
      91                 :          0 : }
      92                 :            : 
      93                 :          0 : sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin )
      94                 :            : {
      95                 :            :     DBG_CHKTHIS( OutlinerView, 0 );
      96                 :            : 
      97                 :            :     // For the first Paint/KeyInput/Drop an emty Outliner is turned into
      98                 :            :     // an Outliner with exactly one paragraph.
      99         [ #  # ]:          0 :     if( pOwner->bFirstParaIsEmpty )
     100 [ #  # ][ #  # ]:          0 :         pOwner->Insert( String() );
                 [ #  # ]
     101                 :            : 
     102                 :            : 
     103                 :          0 :     sal_Bool bKeyProcessed = sal_False;
     104         [ #  # ]:          0 :     ESelection aSel( pEditView->GetSelection() );
     105                 :          0 :     sal_Bool bSelection = aSel.HasRange();
     106                 :          0 :     KeyCode aKeyCode = rKEvt.GetKeyCode();
     107         [ #  # ]:          0 :     KeyFuncType eFunc = aKeyCode.GetFunction();
     108                 :          0 :     sal_uInt16 nCode = aKeyCode.GetCode();
     109         [ #  # ]:          0 :     sal_Bool bReadOnly = IsReadOnly();
     110                 :            : 
     111 [ #  # ][ #  # ]:          0 :     if( bSelection && ( nCode != KEY_TAB ) && EditEngine::DoesKeyChangeText( rKEvt ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     112                 :            :     {
     113 [ #  # ][ #  # ]:          0 :         if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     114                 :          0 :             return sal_True;
     115                 :            :     }
     116                 :            : 
     117         [ #  # ]:          0 :     if ( eFunc != KEYFUNC_DONTKNOW )
     118                 :            :     {
     119   [ #  #  #  #  :          0 :         switch ( eFunc )
                      # ]
     120                 :            :         {
     121                 :            :             case KEYFUNC_CUT:
     122                 :            :             {
     123         [ #  # ]:          0 :                 if ( !bReadOnly )
     124                 :            :                 {
     125         [ #  # ]:          0 :                     Cut();
     126                 :          0 :                     bKeyProcessed = sal_True;
     127                 :            :                 }
     128                 :            :             }
     129                 :          0 :             break;
     130                 :            :             case KEYFUNC_COPY:
     131                 :            :             {
     132         [ #  # ]:          0 :                 Copy();
     133                 :          0 :                 bKeyProcessed = sal_True;
     134                 :            :             }
     135                 :          0 :             break;
     136                 :            :             case KEYFUNC_PASTE:
     137                 :            :             {
     138         [ #  # ]:          0 :                 if ( !bReadOnly )
     139                 :            :                 {
     140         [ #  # ]:          0 :                     PasteSpecial();
     141                 :          0 :                     bKeyProcessed = sal_True;
     142                 :            :                 }
     143                 :            :             }
     144                 :          0 :             break;
     145                 :            :             case KEYFUNC_DELETE:
     146                 :            :             {
     147 [ #  # ][ #  # ]:          0 :                 if( !bReadOnly && !bSelection && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) )
         [ #  # ][ #  # ]
     148                 :            :                 {
     149 [ #  # ][ #  # ]:          0 :                     if( aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
     150                 :            :                     {
     151         [ #  # ]:          0 :                         Paragraph* pNext = pOwner->pParaList->GetParagraph( aSel.nEndPara+1 );
     152 [ #  # ][ #  # ]:          0 :                         if( pNext && pNext->HasFlag(PARAFLAG_ISPAGE) )
                 [ #  # ]
     153                 :            :                         {
     154 [ #  # ][ #  # ]:          0 :                             if( !pOwner->ImpCanDeleteSelectedPages( this, aSel.nEndPara, 1 ) )
     155                 :          0 :                                 return sal_False;
     156                 :            :                         }
     157                 :            :                     }
     158                 :            :                 }
     159                 :            :             }
     160                 :          0 :             break;
     161                 :            :             default:    // is then possibly edited below.
     162                 :          0 :                         eFunc = KEYFUNC_DONTKNOW;
     163                 :            :         }
     164                 :            :     }
     165         [ #  # ]:          0 :     if ( eFunc == KEYFUNC_DONTKNOW )
     166                 :            :     {
     167   [ #  #  #  # ]:          0 :         switch ( nCode )
     168                 :            :         {
     169                 :            :             case KEY_TAB:
     170                 :            :             {
     171 [ #  # ][ #  # ]:          0 :                 if ( !bReadOnly && !aKeyCode.IsMod1() && !aKeyCode.IsMod2() )
         [ #  # ][ #  # ]
     172                 :            :                 {
     173   [ #  #  #  # ]:          0 :                     if ( ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) &&
         [ #  # ][ #  # ]
                 [ #  # ]
     174                 :          0 :                          ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TITLEOBJECT ) &&
     175                 :          0 :                          ( bSelection || !aSel.nStartPos ) )
     176                 :            :                     {
     177 [ #  # ][ #  # ]:          0 :                         Indent( aKeyCode.IsShift() ? (-1) : (+1) );
     178                 :          0 :                         bKeyProcessed = sal_True;
     179                 :            :                     }
     180 [ #  # ][ #  # ]:          0 :                     else if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) &&
         [ #  # ][ #  # ]
                 [ #  # ]
     181         [ #  # ]:          0 :                               !bSelection && !aSel.nEndPos && pOwner->ImplHasBullet( aSel.nEndPara ) )
     182                 :            :                     {
     183 [ #  # ][ #  # ]:          0 :                         Indent( aKeyCode.IsShift() ? (-1) : (+1) );
     184                 :          0 :                         bKeyProcessed = sal_True;
     185                 :            :                     }
     186                 :            :                 }
     187                 :            :             }
     188                 :          0 :             break;
     189                 :            :             case KEY_BACKSPACE:
     190                 :            :             {
     191 [ #  # ][ #  # ]:          0 :                 if( !bReadOnly && !bSelection && aSel.nEndPara && !aSel.nEndPos )
         [ #  # ][ #  # ]
     192                 :            :                 {
     193         [ #  # ]:          0 :                     Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara );
     194         [ #  # ]:          0 :                     Paragraph* pPrev = pOwner->pParaList->GetParagraph( aSel.nEndPara-1 );
     195         [ #  # ]:          0 :                     if( !pPrev->IsVisible()  )
     196                 :          0 :                         return sal_True;
     197         [ #  # ]:          0 :                     if( !pPara->GetDepth() )
     198                 :            :                     {
     199 [ #  # ][ #  # ]:          0 :                         if(!pOwner->ImpCanDeleteSelectedPages(this, aSel.nEndPara , 1 ) )
     200                 :          0 :                             return sal_True;
     201                 :            :                     }
     202                 :            :                 }
     203                 :            :             }
     204                 :          0 :             break;
     205                 :            :             case KEY_RETURN:
     206                 :            :             {
     207         [ #  # ]:          0 :                 if ( !bReadOnly )
     208                 :            :                 {
     209                 :            :                     // Special treatment: hard return at the end of a paragraph,
     210                 :            :                     // which has collapsed subparagraphs.
     211         [ #  # ]:          0 :                     Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara );
     212                 :            : 
     213         [ #  # ]:          0 :                     if( !aKeyCode.IsShift() )
     214                 :            :                     {
     215                 :            :                         // ImpGetCursor again???
     216 [ #  # ][ #  # ]:          0 :                         if( !bSelection &&
                 [ #  # ]
     217         [ #  # ]:          0 :                                 aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
     218                 :            :                         {
     219         [ #  # ]:          0 :                             sal_uLong nChildren = pOwner->pParaList->GetChildCount(pPara);
     220 [ #  # ][ #  # ]:          0 :                             if( nChildren && !pOwner->pParaList->HasVisibleChildren(pPara))
         [ #  # ][ #  # ]
     221                 :            :                             {
     222         [ #  # ]:          0 :                                 pOwner->UndoActionStart( OLUNDO_INSERT );
     223                 :          0 :                                 sal_uLong nTemp = aSel.nEndPara;
     224                 :          0 :                                 nTemp += nChildren;
     225                 :          0 :                                 nTemp++; // insert above next Non-Child
     226 [ #  # ][ #  # ]:          0 :                                 pOwner->Insert( String(),nTemp,pPara->GetDepth());
                 [ #  # ]
     227                 :            :                                 // Position the cursor
     228                 :          0 :                                 ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0);
     229         [ #  # ]:          0 :                                 pEditView->SetSelection( aTmpSel );
     230         [ #  # ]:          0 :                                 pEditView->ShowCursor( sal_True, sal_True );
     231         [ #  # ]:          0 :                                 pOwner->UndoActionEnd( OLUNDO_INSERT );
     232                 :          0 :                                 bKeyProcessed = sal_True;
     233                 :            :                             }
     234                 :            :                         }
     235                 :            :                     }
     236 [ #  # ][ #  #  :          0 :                     if( !bKeyProcessed && !bSelection &&
             #  #  #  # ]
         [ #  # ][ #  # ]
     237                 :          0 :                                 !aKeyCode.IsShift() && aKeyCode.IsMod1() &&
     238         [ #  # ]:          0 :                             ( aSel.nEndPos == pOwner->pEditEngine->GetTextLen(aSel.nEndPara) ) )
     239                 :            :                     {
     240         [ #  # ]:          0 :                         pOwner->UndoActionStart( OLUNDO_INSERT );
     241                 :          0 :                         sal_uLong nTemp = aSel.nEndPara;
     242                 :          0 :                         nTemp++;
     243 [ #  # ][ #  # ]:          0 :                         pOwner->Insert( String(), nTemp, pPara->GetDepth()+1 );
                 [ #  # ]
     244                 :            : 
     245                 :            :                         // Position the cursor
     246                 :          0 :                         ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0);
     247         [ #  # ]:          0 :                         pEditView->SetSelection( aTmpSel );
     248         [ #  # ]:          0 :                         pEditView->ShowCursor( sal_True, sal_True );
     249         [ #  # ]:          0 :                         pOwner->UndoActionEnd( OLUNDO_INSERT );
     250                 :          0 :                         bKeyProcessed = sal_True;
     251                 :            :                     }
     252                 :            :                 }
     253                 :            :             }
     254                 :          0 :             break;
     255                 :            :         }
     256                 :            :     }
     257                 :            : 
     258 [ #  # ][ #  # ]:          0 :     return bKeyProcessed ? sal_True : pEditView->PostKeyEvent( rKEvt, pFrameWin );
     259                 :            : 
     260                 :            : }
     261                 :            : 
     262                 :            : 
     263                 :          0 : sal_uLong OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget)
     264                 :            : {
     265                 :            :     DBG_CHKTHIS(OutlinerView,0);
     266                 :          0 :     sal_uLong nPara = EE_PARA_NOT_FOUND;
     267                 :            : 
     268 [ #  # ][ #  # ]:          0 :     Point aMousePosWin = pEditView->GetWindow()->PixelToLogic( rPosPix );
     269 [ #  # ][ #  # ]:          0 :     if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
                 [ #  # ]
     270                 :            :     {
     271                 :          0 :         reTarget = MouseOutside;
     272                 :            :     }
     273                 :            :     else
     274                 :            :     {
     275                 :          0 :         reTarget = MouseText;
     276                 :            : 
     277                 :          0 :         Point aPaperPos( aMousePosWin );
     278         [ #  # ]:          0 :         Rectangle aOutArea = pEditView->GetOutputArea();
     279         [ #  # ]:          0 :         Rectangle aVisArea = pEditView->GetVisArea();
     280                 :          0 :         aPaperPos.X() -= aOutArea.Left();
     281                 :          0 :         aPaperPos.X() += aVisArea.Left();
     282                 :          0 :         aPaperPos.Y() -= aOutArea.Top();
     283                 :          0 :         aPaperPos.Y() += aVisArea.Top();
     284                 :            : 
     285                 :            :         sal_Bool bBullet;
     286 [ #  # ][ #  # ]:          0 :         if ( pOwner->IsTextPos( aPaperPos, 0, &bBullet ) )
     287                 :            :         {
     288         [ #  # ]:          0 :             Point aDocPos = pOwner->GetDocPos( aPaperPos );
     289         [ #  # ]:          0 :             nPara = pOwner->pEditEngine->FindParagraph( aDocPos.Y() );
     290                 :            : 
     291         [ #  # ]:          0 :             if ( bBullet )
     292                 :            :             {
     293                 :          0 :                 reTarget = MouseBullet;
     294                 :            :             }
     295                 :            :             else
     296                 :            :             {
     297                 :            :                 // Check for hyperlink
     298         [ #  # ]:          0 :                 const SvxFieldItem* pFieldItem = pEditView->GetField( aMousePosWin );
     299 [ #  # ][ #  # ]:          0 :                 if ( pFieldItem && pFieldItem->GetField() && pFieldItem->GetField()->ISA( SvxURLField ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     300                 :          0 :                     reTarget = MouseHypertext;
     301                 :            :             }
     302                 :            :         }
     303                 :            :     }
     304                 :          0 :     return nPara;
     305                 :            : }
     306                 :            : 
     307                 :          0 : sal_Bool OutlinerView::MouseMove( const MouseEvent& rMEvt )
     308                 :            : {
     309                 :            :     DBG_CHKTHIS(OutlinerView,0);
     310                 :            : 
     311 [ #  # ][ #  # ]:          0 :     if( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode())
         [ #  # ][ #  # ]
                 [ #  # ]
     312         [ #  # ]:          0 :         return pEditView->MouseMove( rMEvt );
     313                 :            : 
     314 [ #  # ][ #  # ]:          0 :     Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
     315 [ #  # ][ #  # ]:          0 :     if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
                 [ #  # ]
     316                 :          0 :         return sal_False;
     317                 :            : 
     318         [ #  # ]:          0 :     Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
     319 [ #  # ][ #  # ]:          0 :     pEditView->GetWindow()->SetPointer( aPointer );
     320         [ #  # ]:          0 :     return pEditView->MouseMove( rMEvt );
     321                 :            : }
     322                 :            : 
     323                 :            : 
     324                 :          0 : sal_Bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
     325                 :            : {
     326                 :            :     DBG_CHKTHIS(OutlinerView,0);
     327 [ #  # ][ #  # ]:          0 :     if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() )
         [ #  # ][ #  # ]
                 [ #  # ]
     328         [ #  # ]:          0 :         return pEditView->MouseButtonDown( rMEvt );
     329                 :            : 
     330 [ #  # ][ #  # ]:          0 :     Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
     331 [ #  # ][ #  # ]:          0 :     if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
                 [ #  # ]
     332                 :          0 :         return sal_False;
     333                 :            : 
     334         [ #  # ]:          0 :     Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
     335 [ #  # ][ #  # ]:          0 :     pEditView->GetWindow()->SetPointer( aPointer );
     336                 :            : 
     337                 :            :     MouseTarget eTarget;
     338         [ #  # ]:          0 :     sal_uLong nPara = ImpCheckMousePos( rMEvt.GetPosPixel(), eTarget );
     339         [ #  # ]:          0 :     if ( eTarget == MouseBullet )
     340                 :            :     {
     341         [ #  # ]:          0 :         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     342 [ #  # ][ #  # ]:          0 :         sal_Bool bHasChildren = (pPara && pOwner->pParaList->HasChildren(pPara));
                 [ #  # ]
     343         [ #  # ]:          0 :         if( rMEvt.GetClicks() == 1 )
     344                 :            :         {
     345                 :          0 :             sal_uLong nEndPara = nPara;
     346 [ #  # ][ #  # ]:          0 :             if ( bHasChildren && pOwner->pParaList->HasVisibleChildren(pPara) )
         [ #  # ][ #  # ]
     347         [ #  # ]:          0 :                 nEndPara += pOwner->pParaList->GetChildCount( pPara );
     348                 :            :             // The selection is inverted, so that EditEngine does not scroll
     349                 :          0 :             ESelection aSel((sal_uInt16)nEndPara, 0xffff,(sal_uInt16)nPara, 0 );
     350         [ #  # ]:          0 :             pEditView->SetSelection( aSel );
     351                 :            :         }
     352 [ #  # ][ #  # ]:          0 :         else if( rMEvt.GetClicks() == 2 && bHasChildren )
                 [ #  # ]
     353         [ #  # ]:          0 :             ImpToggleExpand( pPara );
     354                 :            : 
     355                 :          0 :         aDDStartPosPix = rMEvt.GetPosPixel();
     356 [ #  # ][ #  # ]:          0 :         aDDStartPosRef=pEditView->GetWindow()->PixelToLogic( aDDStartPosPix,pOwner->GetRefMapMode());
         [ #  # ][ #  # ]
     357                 :          0 :         return sal_True;
     358                 :            :     }
     359                 :            : 
     360                 :            :     // special case for outliner view in impress, check if double click hits the page icon for toggle
     361 [ #  # ][ #  # ]:          0 :     if( (nPara == EE_PARA_NOT_FOUND) && (pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEVIEW) && (eTarget == MouseText) && (rMEvt.GetClicks() == 2) )
         [ #  # ][ #  # ]
                 [ #  # ]
     362                 :            :     {
     363         [ #  # ]:          0 :         ESelection aSel( pEditView->GetSelection() );
     364                 :          0 :         nPara = aSel.nStartPara;
     365         [ #  # ]:          0 :         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     366 [ #  # ][ #  # ]:          0 :         if( (pPara && pOwner->pParaList->HasChildren(pPara)) && pPara->HasFlag(PARAFLAG_ISPAGE) )
         [ #  # ][ #  # ]
                 [ #  # ]
     367                 :            :         {
     368         [ #  # ]:          0 :             ImpToggleExpand( pPara );
     369                 :            :         }
     370                 :            :     }
     371         [ #  # ]:          0 :     return pEditView->MouseButtonDown( rMEvt );
     372                 :            : }
     373                 :            : 
     374                 :            : 
     375                 :          0 : sal_Bool OutlinerView::MouseButtonUp( const MouseEvent& rMEvt )
     376                 :            : {
     377                 :            :     DBG_CHKTHIS(OutlinerView,0);
     378 [ #  # ][ #  # ]:          0 :     if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() )
         [ #  # ][ #  # ]
                 [ #  # ]
     379         [ #  # ]:          0 :         return pEditView->MouseButtonUp( rMEvt );
     380                 :            : 
     381 [ #  # ][ #  # ]:          0 :     Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
     382 [ #  # ][ #  # ]:          0 :     if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
                 [ #  # ]
     383                 :          0 :         return sal_False;
     384                 :            : 
     385         [ #  # ]:          0 :     Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
     386 [ #  # ][ #  # ]:          0 :     pEditView->GetWindow()->SetPointer( aPointer );
     387                 :            : 
     388         [ #  # ]:          0 :     return pEditView->MouseButtonUp( rMEvt );
     389                 :            : }
     390                 :            : 
     391                 :          0 : void OutlinerView::ImpToggleExpand( Paragraph* pPara )
     392                 :            : {
     393                 :            :     DBG_CHKTHIS(OutlinerView,0);
     394                 :            : 
     395                 :          0 :     sal_uInt16 nPara = (sal_uInt16) pOwner->pParaList->GetAbsPos( pPara );
     396         [ #  # ]:          0 :     pEditView->SetSelection( ESelection( nPara, 0, nPara, 0 ) );
     397                 :          0 :     ImplExpandOrCollaps( nPara, nPara, !pOwner->pParaList->HasVisibleChildren( pPara ) );
     398                 :          0 :     pEditView->ShowCursor();
     399                 :          0 : }
     400                 :            : 
     401                 :          0 : sal_uLong OutlinerView::Select( Paragraph* pParagraph, sal_Bool bSelect,
     402                 :            :     sal_Bool bWithChildren )
     403                 :            : {
     404                 :            :     DBG_CHKTHIS(OutlinerView,0);
     405                 :            : 
     406         [ #  # ]:          0 :     sal_uLong nPara = pOwner->pParaList->GetAbsPos( pParagraph );
     407                 :          0 :     sal_uInt16 nEnd = 0;
     408         [ #  # ]:          0 :     if ( bSelect )
     409                 :          0 :         nEnd = 0xffff;
     410                 :            : 
     411                 :          0 :     sal_uLong nChildCount = 0;
     412         [ #  # ]:          0 :     if ( bWithChildren )
     413         [ #  # ]:          0 :         nChildCount = pOwner->pParaList->GetChildCount( pParagraph );
     414                 :            : 
     415                 :          0 :     ESelection aSel( (sal_uInt16)nPara, 0,(sal_uInt16)(nPara+nChildCount), nEnd );
     416         [ #  # ]:          0 :     pEditView->SetSelection( aSel );
     417                 :          0 :     return nChildCount+1;
     418                 :            : }
     419                 :            : 
     420                 :            : 
     421                 :         42 : void OutlinerView::SetAttribs( const SfxItemSet& rAttrs )
     422                 :            : {
     423                 :            :     DBG_CHKTHIS(OutlinerView,0);
     424                 :            : 
     425         [ +  - ]:         42 :     sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
     426         [ +  - ]:         42 :     pOwner->pEditEngine->SetUpdateMode( sal_False );
     427                 :            : 
     428 [ +  - ][ +  - ]:         42 :     if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
         [ +  - ][ +  + ]
                 [ +  + ]
     429         [ +  - ]:         36 :         pOwner->UndoActionStart( OLUNDO_ATTR );
     430                 :            : 
     431         [ +  - ]:         42 :     ParaRange aSel = ImpGetSelectedParagraphs( sal_False );
     432                 :            : 
     433         [ +  - ]:         42 :     pEditView->SetAttribs( rAttrs );
     434                 :            : 
     435                 :            :     // Update Bullet text
     436         [ +  + ]:         84 :     for( sal_uInt16 nPara= aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
     437                 :            :     {
     438         [ +  - ]:         42 :         pOwner->ImplCheckNumBulletItem( nPara );
     439         [ +  - ]:         42 :         pOwner->ImplCalcBulletText( nPara, sal_False, sal_False );
     440                 :            : 
     441 [ +  - ][ +  - ]:         42 :         if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
         [ +  - ][ +  + ]
                 [ +  + ]
     442 [ +  - ][ +  - ]:         36 :             pOwner->InsertUndo( new OutlinerUndoCheckPara( pOwner, nPara ) );
                 [ +  - ]
     443                 :            :     }
     444                 :            : 
     445 [ +  - ][ +  - ]:         42 :     if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
         [ +  - ][ +  + ]
                 [ +  + ]
     446         [ +  - ]:         36 :         pOwner->UndoActionEnd( OLUNDO_ATTR );
     447                 :            : 
     448         [ +  - ]:         42 :     pEditView->SetEditEngineUpdateMode( bUpdate );
     449                 :         42 : }
     450                 :            : 
     451                 :         42 : ParaRange OutlinerView::ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChildren )
     452                 :            : {
     453                 :            :     DBG_CHKTHIS( OutlinerView, 0 );
     454                 :            : 
     455         [ +  - ]:         42 :     ESelection aSel = pEditView->GetSelection();
     456                 :         42 :     ParaRange aParas( aSel.nStartPara, aSel.nEndPara );
     457                 :         42 :     aParas.Adjust();
     458                 :            : 
     459                 :            :     // Record the  invisible Children of the last Parents in the selection
     460         [ -  + ]:         42 :     if ( bIncludeHiddenChildren )
     461                 :            :     {
     462         [ #  # ]:          0 :         Paragraph* pLast = pOwner->pParaList->GetParagraph( aParas.nEndPara );
     463 [ #  # ][ #  # ]:          0 :         if ( pOwner->pParaList->HasHiddenChildren( pLast ) )
     464                 :            :             aParas.nEndPara =
     465                 :            :                 sal::static_int_cast< sal_uInt16 >(
     466                 :            :                     aParas.nEndPara +
     467         [ #  # ]:         42 :                     pOwner->pParaList->GetChildCount( pLast ) );
     468                 :            :     }
     469                 :         42 :     return aParas;
     470                 :            : }
     471                 :            : 
     472                 :            : // TODO: Name should be changed!
     473                 :          0 : void OutlinerView::AdjustDepth( short nDX )
     474                 :            : {
     475                 :          0 :     Indent( nDX );
     476                 :          0 : }
     477                 :            : 
     478                 :          0 : void OutlinerView::Indent( short nDiff )
     479                 :            : {
     480                 :            :     DBG_CHKTHIS( OutlinerView, 0 );
     481                 :            : 
     482 [ #  # ][ #  # ]:          0 :     if( !nDiff || ( ( nDiff > 0 ) && ImpCalcSelectedPages( sal_True ) && !pOwner->ImpCanIndentSelectedPages( this ) ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     483                 :          0 :         return;
     484                 :            : 
     485         [ #  # ]:          0 :     const bool bOutlinerView = pOwner->pEditEngine->GetControlWord() & EE_CNTRL_OUTLINER;
     486         [ #  # ]:          0 :     sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
     487         [ #  # ]:          0 :     pOwner->pEditEngine->SetUpdateMode( sal_False );
     488                 :            : 
     489 [ #  # ][ #  # ]:          0 :     sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
         [ #  # ][ #  # ]
     490                 :            : 
     491         [ #  # ]:          0 :     if( bUndo )
     492         [ #  # ]:          0 :         pOwner->UndoActionStart( OLUNDO_DEPTH );
     493                 :            : 
     494                 :          0 :     sal_Int16 nMinDepth = -1;   // Optimization: Not to recalculate to manny parargaphs when not really needed.
     495                 :            : 
     496         [ #  # ]:          0 :     ParaRange aSel = ImpGetSelectedParagraphs( sal_True );
     497         [ #  # ]:          0 :     for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
     498                 :            :     {
     499         [ #  # ]:          0 :         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     500                 :            : 
     501                 :          0 :         sal_Int16 nOldDepth = pPara->GetDepth();
     502                 :          0 :         sal_Int16 nNewDepth = nOldDepth + nDiff;
     503                 :            : 
     504 [ #  # ][ #  # ]:          0 :         if( bOutlinerView && nPara )
     505                 :            :         {
     506                 :          0 :             const bool bPage = pPara->HasFlag(PARAFLAG_ISPAGE);
     507 [ #  # ][ #  # ]:          0 :             if( (bPage && (nDiff == +1)) || (!bPage && (nDiff == -1) && (nOldDepth <= 0))  )
         [ #  # ][ #  # ]
                 [ #  # ]
     508                 :            :             {
     509                 :            :                             // Notify App
     510                 :          0 :                 pOwner->nDepthChangedHdlPrevDepth = (sal_Int16)nOldDepth;
     511                 :          0 :                 pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
     512                 :          0 :                 pOwner->pHdlParagraph = pPara;
     513                 :            : 
     514         [ #  # ]:          0 :                 if( bPage )
     515                 :          0 :                     pPara->RemoveFlag( PARAFLAG_ISPAGE );
     516                 :            :                 else
     517                 :          0 :                     pPara->SetFlag( PARAFLAG_ISPAGE );
     518                 :            : 
     519         [ #  # ]:          0 :                 pOwner->DepthChangedHdl();
     520         [ #  # ]:          0 :                 pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) );
     521                 :            : 
     522         [ #  # ]:          0 :                 if( bUndo )
     523 [ #  # ][ #  # ]:          0 :                     pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nPara, pOwner->mnDepthChangeHdlPrevFlags, pPara->nFlags ) );
                 [ #  # ]
     524                 :            : 
     525                 :          0 :                 continue;
     526                 :            :             }
     527                 :            :         }
     528                 :            : 
     529                 :            :         // do not switch off numeration with tab
     530 [ #  # ][ #  # ]:          0 :         if( (nOldDepth == 0) && (nNewDepth == -1) )
     531                 :          0 :             continue;
     532                 :            : 
     533                 :            :         // do not indent if there is no numeration enabled
     534         [ #  # ]:          0 :         if( nOldDepth == -1 )
     535                 :          0 :             continue;
     536                 :            : 
     537         [ #  # ]:          0 :         if ( nNewDepth < pOwner->nMinDepth )
     538                 :          0 :             nNewDepth = pOwner->nMinDepth;
     539         [ #  # ]:          0 :         if ( nNewDepth > pOwner->nMaxDepth )
     540                 :          0 :             nNewDepth = pOwner->nMaxDepth;
     541                 :            : 
     542         [ #  # ]:          0 :         if( nOldDepth < nMinDepth )
     543                 :          0 :             nMinDepth = nOldDepth;
     544         [ #  # ]:          0 :         if( nNewDepth < nMinDepth )
     545                 :          0 :             nMinDepth = nNewDepth;
     546                 :            : 
     547         [ #  # ]:          0 :         if( nOldDepth != nNewDepth )
     548                 :            :         {
     549 [ #  # ][ #  # ]:          0 :             if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ))
         [ #  # ][ #  # ]
     550                 :            :             {
     551                 :            :                 // Special case: the predecessor of an indented paragraph is
     552                 :            :                 // invisible and is now on the same level as the visible
     553                 :            :                 // paragraph. In this case, the next visible paragraph is
     554                 :            :                 // searched for and fluffed.
     555                 :            : #ifdef DBG_UTIL
     556                 :            :                 Paragraph* _pPara = pOwner->pParaList->GetParagraph( aSel.nStartPara );
     557                 :            :                 DBG_ASSERT(_pPara->IsVisible(),"Selected Paragraph invisible ?!");
     558                 :            : #endif
     559         [ #  # ]:          0 :                 Paragraph* pPrev= pOwner->pParaList->GetParagraph( aSel.nStartPara-1 );
     560                 :            : 
     561 [ #  # ][ #  # ]:          0 :                 if( !pPrev->IsVisible() && ( pPrev->GetDepth() == nNewDepth ) )
                 [ #  # ]
     562                 :            :                 {
     563                 :            :                     // Predecessor is collapsed and is on the same level
     564                 :            :                     // => find next visible paragraph and expand it
     565         [ #  # ]:          0 :                     pPrev = pOwner->pParaList->GetParent( pPrev );
     566         [ #  # ]:          0 :                     while( !pPrev->IsVisible() )
     567         [ #  # ]:          0 :                         pPrev = pOwner->pParaList->GetParent( pPrev );
     568                 :            : 
     569         [ #  # ]:          0 :                     pOwner->Expand( pPrev );
     570 [ #  # ][ #  # ]:          0 :                     pOwner->InvalidateBullet( pPrev, pOwner->pParaList->GetAbsPos( pPrev ) );
     571                 :            :                 }
     572                 :            :             }
     573                 :            : 
     574                 :          0 :             pOwner->nDepthChangedHdlPrevDepth = (sal_Int16)nOldDepth;
     575                 :          0 :             pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
     576                 :          0 :             pOwner->pHdlParagraph = pPara;
     577                 :            : 
     578         [ #  # ]:          0 :             pOwner->ImplInitDepth( nPara, nNewDepth, sal_True, sal_False );
     579         [ #  # ]:          0 :             pOwner->ImplCalcBulletText( nPara, sal_False, sal_False );
     580                 :            : 
     581         [ #  # ]:          0 :             if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
     582         [ #  # ]:          0 :                 pOwner->ImplSetLevelDependendStyleSheet( nPara );
     583                 :            : 
     584                 :            :             // Notify App
     585         [ #  # ]:          0 :             pOwner->DepthChangedHdl();
     586                 :            :         }
     587                 :            :         else
     588                 :            :         {
     589                 :            :             // Needs at least a repaint...
     590         [ #  # ]:          0 :             pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) );
     591                 :            :         }
     592                 :            :     }
     593                 :            : 
     594                 :          0 :     sal_uInt16 nParas = (sal_uInt16)pOwner->pParaList->GetParagraphCount();
     595         [ #  # ]:          0 :     for ( sal_uInt16 n = aSel.nEndPara+1; n < nParas; n++ )
     596                 :            :     {
     597         [ #  # ]:          0 :         Paragraph* pPara = pOwner->pParaList->GetParagraph( n );
     598         [ #  # ]:          0 :         if ( pPara->GetDepth() < nMinDepth )
     599                 :          0 :             break;
     600         [ #  # ]:          0 :         pOwner->ImplCalcBulletText( n, sal_False, sal_False );
     601                 :            :     }
     602                 :            : 
     603         [ #  # ]:          0 :     if ( bUpdate )
     604                 :            :     {
     605         [ #  # ]:          0 :         pEditView->SetEditEngineUpdateMode( sal_True );
     606         [ #  # ]:          0 :         pEditView->ShowCursor();
     607                 :            :     }
     608                 :            : 
     609         [ #  # ]:          0 :     if( bUndo )
     610         [ #  # ]:          0 :         pOwner->UndoActionEnd( OLUNDO_DEPTH );
     611                 :            : }
     612                 :            : 
     613                 :          0 : sal_Bool OutlinerView::AdjustHeight( long nDY )
     614                 :            : {
     615                 :            :     DBG_CHKTHIS(OutlinerView,0);
     616                 :          0 :     pEditView->MoveParagraphs( nDY );
     617                 :          0 :     return sal_True;    // remove return value...
     618                 :            : }
     619                 :            : 
     620                 :         18 : Rectangle OutlinerView::GetVisArea() const
     621                 :            : {
     622                 :            :     DBG_CHKTHIS(OutlinerView,0);
     623                 :         18 :     return pEditView->GetVisArea();
     624                 :            : }
     625                 :            : 
     626                 :          0 : void OutlinerView::Expand()
     627                 :            : {
     628                 :            :     DBG_CHKTHIS( OutlinerView, 0 );
     629         [ #  # ]:          0 :     ParaRange aParas = ImpGetSelectedParagraphs( sal_False );
     630         [ #  # ]:          0 :     ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_True );
     631                 :          0 : }
     632                 :            : 
     633                 :            : 
     634                 :          0 : void OutlinerView::Collapse()
     635                 :            : {
     636                 :            :     DBG_CHKTHIS( OutlinerView, 0 );
     637         [ #  # ]:          0 :     ParaRange aParas = ImpGetSelectedParagraphs( sal_False );
     638         [ #  # ]:          0 :     ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_False );
     639                 :          0 : }
     640                 :            : 
     641                 :            : 
     642                 :          0 : void OutlinerView::ExpandAll()
     643                 :            : {
     644                 :            :     DBG_CHKTHIS( OutlinerView, 0 );
     645                 :          0 :     ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_True );
     646                 :          0 : }
     647                 :            : 
     648                 :            : 
     649                 :          0 : void OutlinerView::CollapseAll()
     650                 :            : {
     651                 :            :     DBG_CHKTHIS(OutlinerView,0);
     652                 :          0 :     ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_False );
     653                 :          0 : }
     654                 :            : 
     655                 :          0 : void OutlinerView::ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand )
     656                 :            : {
     657                 :            :     DBG_CHKTHIS( OutlinerView, 0 );
     658                 :            : 
     659                 :          0 :     sal_Bool bUpdate = pOwner->GetUpdateMode();
     660                 :          0 :     pOwner->SetUpdateMode( sal_False );
     661                 :            : 
     662 [ #  # ][ #  # ]:          0 :     sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
     663         [ #  # ]:          0 :     if( bUndo )
     664         [ #  # ]:          0 :         pOwner->UndoActionStart( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE );
     665                 :            : 
     666         [ #  # ]:          0 :     for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
     667                 :            :     {
     668                 :          0 :         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     669         [ #  # ]:          0 :         sal_Bool bDone = bExpand ? pOwner->Expand( pPara ) : pOwner->Collapse( pPara );
     670         [ #  # ]:          0 :         if( bDone )
     671                 :            :         {
     672                 :            :             // The line under the paragraph should disappear ...
     673                 :          0 :             pOwner->pEditEngine->QuickMarkToBeRepainted( nPara );
     674                 :            :         }
     675                 :            :     }
     676                 :            : 
     677         [ #  # ]:          0 :     if( bUndo )
     678         [ #  # ]:          0 :         pOwner->UndoActionEnd( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE );
     679                 :            : 
     680         [ #  # ]:          0 :     if ( bUpdate )
     681                 :            :     {
     682                 :          0 :         pOwner->SetUpdateMode( sal_True );
     683                 :          0 :         pEditView->ShowCursor();
     684                 :            :     }
     685                 :          0 : }
     686                 :            : 
     687                 :          0 : void OutlinerView::InsertText( const OutlinerParaObject& rParaObj )
     688                 :            : {
     689                 :            :     // Like Paste, only EditView::Insert, instead of EditView::Paste.
     690                 :            :     // Actually not quite true that possible indentations must be corrected,
     691                 :            :     // but that comes later by a universal import. The indentation level is
     692                 :            :     // then determined right in the Inserted method.
     693                 :            :     // Possible structure:
     694                 :            :     // pImportInfo with DestPara, DestPos, nFormat, pParaObj...
     695                 :            :     // Possibly problematic:
     696                 :            :     // EditEngine, RTF => Splitting the area, later join together.
     697                 :            : 
     698                 :            :     DBG_CHKTHIS(OutlinerView,0);
     699                 :            : 
     700 [ #  # ][ #  # ]:          0 :     if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     701                 :          0 :         return;
     702                 :            : 
     703         [ #  # ]:          0 :     pOwner->UndoActionStart( OLUNDO_INSERT );
     704                 :            : 
     705         [ #  # ]:          0 :     pOwner->pEditEngine->SetUpdateMode( sal_False );
     706                 :            :     sal_uLong nStart, nParaCount;
     707         [ #  # ]:          0 :     nParaCount = pOwner->pEditEngine->GetParagraphCount();
     708         [ #  # ]:          0 :     sal_uInt16 nSize = ImpInitPaste( nStart );
     709 [ #  # ][ #  # ]:          0 :     pEditView->InsertText( rParaObj.GetTextObject() );
     710         [ #  # ]:          0 :     ImpPasted( nStart, nParaCount, nSize);
     711         [ #  # ]:          0 :     pEditView->SetEditEngineUpdateMode( sal_True );
     712                 :            : 
     713         [ #  # ]:          0 :     pOwner->UndoActionEnd( OLUNDO_INSERT );
     714                 :            : 
     715         [ #  # ]:          0 :     pEditView->ShowCursor( sal_True, sal_True );
     716                 :            : }
     717                 :            : 
     718                 :            : 
     719                 :            : 
     720                 :          0 : void OutlinerView::Cut()
     721                 :            : {
     722                 :            :     DBG_CHKTHIS(OutlinerView,0);
     723 [ #  # ][ #  # ]:          0 :     if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) )
                 [ #  # ]
     724                 :          0 :         pEditView->Cut();
     725                 :          0 : }
     726                 :            : 
     727                 :          0 : void OutlinerView::Paste()
     728                 :            : {
     729                 :            :     DBG_CHKTHIS(OutlinerView,0);
     730                 :          0 :     PasteSpecial(); // HACK(SD does not call PasteSpecial)
     731                 :          0 : }
     732                 :            : 
     733                 :          0 : void OutlinerView::PasteSpecial()
     734                 :            : {
     735                 :            :     DBG_CHKTHIS(OutlinerView,0);
     736 [ #  # ][ #  # ]:          0 :     if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) )
                 [ #  # ]
     737                 :            :     {
     738                 :          0 :         pOwner->UndoActionStart( OLUNDO_INSERT );
     739                 :            : 
     740                 :          0 :         pOwner->pEditEngine->SetUpdateMode( sal_False );
     741                 :          0 :         pOwner->bPasting = sal_True;
     742                 :          0 :         pEditView->PasteSpecial();
     743                 :            : 
     744         [ #  # ]:          0 :         if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
     745                 :            :         {
     746                 :          0 :             const sal_uInt16 nParaCount = pOwner->pEditEngine->GetParagraphCount();
     747                 :            : 
     748         [ #  # ]:          0 :             for( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ )
     749                 :          0 :                 pOwner->ImplSetLevelDependendStyleSheet( nPara );
     750                 :            :         }
     751                 :            : 
     752                 :          0 :         pEditView->SetEditEngineUpdateMode( sal_True );
     753                 :          0 :         pOwner->UndoActionEnd( OLUNDO_INSERT );
     754                 :          0 :         pEditView->ShowCursor( sal_True, sal_True );
     755                 :            :     }
     756                 :          0 : }
     757                 :            : 
     758                 :          0 : void OutlinerView::CreateSelectionList (std::vector<Paragraph*> &aSelList)
     759                 :            : {
     760                 :            :     DBG_CHKTHIS( OutlinerView, 0 );
     761                 :            : 
     762         [ #  # ]:          0 :     ParaRange aParas = ImpGetSelectedParagraphs( sal_True );
     763                 :            : 
     764         [ #  # ]:          0 :     for ( sal_uInt16 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++ )
     765                 :            :     {
     766         [ #  # ]:          0 :         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     767         [ #  # ]:          0 :         aSelList.push_back(pPara);
     768                 :            :     }
     769                 :          0 : }
     770                 :            : 
     771                 :          0 : const SfxStyleSheet* OutlinerView::GetStyleSheet() const
     772                 :            : {
     773                 :            :     DBG_CHKTHIS(OutlinerView,0);
     774                 :          0 :     return pEditView->GetStyleSheet();
     775                 :            : }
     776                 :            : 
     777                 :          0 : SfxStyleSheet* OutlinerView::GetStyleSheet()
     778                 :            : {
     779                 :            :     DBG_CHKTHIS(OutlinerView,0);
     780                 :          0 :     return pEditView->GetStyleSheet();
     781                 :            : }
     782                 :            : 
     783                 :          0 : Pointer OutlinerView::GetPointer( const Point& rPosPixel )
     784                 :            : {
     785                 :            :     DBG_CHKTHIS(OutlinerView,0);
     786                 :            : 
     787                 :            :     MouseTarget eTarget;
     788         [ #  # ]:          0 :     ImpCheckMousePos( rPosPixel, eTarget );
     789                 :            : 
     790                 :          0 :     PointerStyle ePointerStyle = POINTER_ARROW;
     791         [ #  # ]:          0 :     if ( eTarget == MouseText )
     792                 :            :     {
     793 [ #  # ][ #  # ]:          0 :         ePointerStyle = GetOutliner()->IsVertical() ? POINTER_TEXT_VERTICAL : POINTER_TEXT;
     794                 :            :     }
     795         [ #  # ]:          0 :     else if ( eTarget == MouseHypertext )
     796                 :            :     {
     797                 :          0 :         ePointerStyle = POINTER_REFHAND;
     798                 :            :     }
     799         [ #  # ]:          0 :     else if ( eTarget == MouseBullet )
     800                 :            :     {
     801                 :          0 :         ePointerStyle = POINTER_MOVE;
     802                 :            :     }
     803                 :            : 
     804                 :          0 :     return Pointer( ePointerStyle );
     805                 :            : }
     806                 :            : 
     807                 :            : 
     808                 :          0 : sal_uInt16 OutlinerView::ImpInitPaste( sal_uLong& rStart )
     809                 :            : {
     810                 :            :     DBG_CHKTHIS(OutlinerView,0);
     811                 :          0 :     pOwner->bPasting = sal_True;
     812         [ #  # ]:          0 :     ESelection aSelection( pEditView->GetSelection() );
     813                 :          0 :     aSelection.Adjust();
     814                 :          0 :     rStart = aSelection.nStartPara;
     815                 :          0 :     sal_uInt16 nSize = aSelection.nEndPara - aSelection.nStartPara + 1;
     816                 :          0 :     return nSize;
     817                 :            : }
     818                 :            : 
     819                 :            : 
     820                 :          0 : void OutlinerView::ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize)
     821                 :            : {
     822                 :            :     DBG_CHKTHIS(OutlinerView,0);
     823                 :          0 :     pOwner->bPasting = sal_False;
     824                 :          0 :     sal_uLong nCurParaCount = (sal_uLong)pOwner->pEditEngine->GetParagraphCount();
     825         [ #  # ]:          0 :     if( nCurParaCount < nPrevParaCount )
     826                 :            :         nSize = sal::static_int_cast< sal_uInt16 >(
     827                 :          0 :             nSize - ( nPrevParaCount - nCurParaCount ) );
     828                 :            :     else
     829                 :            :         nSize = sal::static_int_cast< sal_uInt16 >(
     830                 :          0 :             nSize + ( nCurParaCount - nPrevParaCount ) );
     831                 :          0 :     pOwner->ImpTextPasted( nStart, nSize );
     832                 :          0 : }
     833                 :            : 
     834                 :            : 
     835                 :          0 : void OutlinerView::Command( const CommandEvent& rCEvt )
     836                 :            : {
     837                 :            :     DBG_CHKTHIS(OutlinerView,0);
     838                 :          0 :     pEditView->Command( rCEvt );
     839                 :          0 : }
     840                 :            : 
     841                 :            : 
     842                 :          0 : void OutlinerView::SelectRange( sal_uLong nFirst, sal_uInt16 nCount )
     843                 :            : {
     844                 :            :     DBG_CHKTHIS(OutlinerView,0);
     845                 :          0 :     sal_uLong nLast = nFirst+nCount;
     846                 :          0 :     nCount = (sal_uInt16)pOwner->pParaList->GetParagraphCount();
     847         [ #  # ]:          0 :     if( nLast <= nCount )
     848                 :          0 :         nLast = nCount - 1;
     849                 :          0 :     ESelection aSel( (sal_uInt16)nFirst, 0, (sal_uInt16)nLast, 0xffff );
     850         [ #  # ]:          0 :     pEditView->SetSelection( aSel );
     851                 :          0 : }
     852                 :            : 
     853                 :            : 
     854                 :          0 : sal_uInt16 OutlinerView::ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected )
     855                 :            : {
     856                 :            :     DBG_CHKTHIS(OutlinerView,0);
     857                 :            : 
     858         [ #  # ]:          0 :     ESelection aSel( pEditView->GetSelection() );
     859                 :          0 :     aSel.Adjust();
     860                 :            : 
     861                 :          0 :     sal_uInt16 nPages = 0;
     862                 :          0 :     sal_uInt16 nFirstPage = 0xFFFF;
     863                 :          0 :     sal_uInt16 nStartPara = aSel.nStartPara;
     864         [ #  # ]:          0 :     if ( !bIncludeFirstSelected )
     865                 :          0 :         nStartPara++;   // All paragraphs after StartPara will be deleted
     866         [ #  # ]:          0 :     for ( sal_uInt16 nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ )
     867                 :            :     {
     868         [ #  # ]:          0 :         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     869                 :            :         DBG_ASSERT(pPara, "ImpCalcSelectedPages: invalid Selection? ");
     870         [ #  # ]:          0 :         if( pPara->HasFlag(PARAFLAG_ISPAGE) )
     871                 :            :         {
     872                 :          0 :             nPages++;
     873         [ #  # ]:          0 :             if( nFirstPage == 0xFFFF )
     874                 :          0 :                 nFirstPage = nPara;
     875                 :            :         }
     876                 :            :     }
     877                 :            : 
     878         [ #  # ]:          0 :     if( nPages )
     879                 :            :     {
     880                 :          0 :         pOwner->nDepthChangedHdlPrevDepth = nPages;
     881                 :          0 :         pOwner->pHdlParagraph = 0;
     882                 :          0 :         pOwner->mnFirstSelPage = nFirstPage;
     883                 :            :     }
     884                 :            : 
     885                 :          0 :     return nPages;
     886                 :            : }
     887                 :            : 
     888                 :            : 
     889                 :          0 : void OutlinerView::ToggleBullets()
     890                 :            : {
     891         [ #  # ]:          0 :     pOwner->UndoActionStart( OLUNDO_DEPTH );
     892                 :            : 
     893         [ #  # ]:          0 :     ESelection aSel( pEditView->GetSelection() );
     894                 :          0 :     aSel.Adjust();
     895                 :            : 
     896         [ #  # ]:          0 :     const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
     897         [ #  # ]:          0 :     pOwner->pEditEngine->SetUpdateMode( sal_False );
     898                 :            : 
     899                 :          0 :     sal_Int16 nDepth = -2;
     900                 :            : 
     901         [ #  # ]:          0 :     for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
     902                 :            :     {
     903         [ #  # ]:          0 :         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     904                 :            :         DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
     905                 :            : 
     906         [ #  # ]:          0 :         if( pPara )
     907                 :            :         {
     908         [ #  # ]:          0 :             if( nDepth == -2 )
     909 [ #  # ][ #  # ]:          0 :                 nDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1;
     910                 :            : 
     911         [ #  # ]:          0 :             pOwner->SetDepth( pPara, nDepth );
     912                 :            : 
     913         [ #  # ]:          0 :             if( nDepth == -1 )
     914                 :            :             {
     915         [ #  # ]:          0 :                 const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
     916 [ #  # ][ #  # ]:          0 :                 if(rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET)
     917                 :            :                 {
     918         [ #  # ]:          0 :                     SfxItemSet aAttrs(rAttrs);
     919         [ #  # ]:          0 :                     aAttrs.ClearItem( EE_PARA_BULLETSTATE );
     920 [ #  # ][ #  # ]:          0 :                     pOwner->SetParaAttribs( nPara, aAttrs );
     921         [ #  # ]:          0 :                 }
     922                 :            :             }
     923                 :            :         }
     924                 :            :     }
     925                 :            : 
     926                 :            :     // #i100014#
     927                 :            :     // It is not a good idea to substract 1 from a count and cast the result
     928                 :            :     // to sal_uInt16 without check, if the count is 0.
     929                 :          0 :     sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
     930         [ #  # ]:          0 :     pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
     931         [ #  # ]:          0 :     pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
     932                 :            : 
     933         [ #  # ]:          0 :     pOwner->pEditEngine->SetUpdateMode( bUpdate );
     934                 :            : 
     935         [ #  # ]:          0 :     pOwner->UndoActionEnd( OLUNDO_DEPTH );
     936                 :          0 : }
     937                 :            : 
     938                 :          0 : void OutlinerView::EnableBullets()
     939                 :            : {
     940         [ #  # ]:          0 :     pOwner->UndoActionStart( OLUNDO_DEPTH );
     941                 :            : 
     942         [ #  # ]:          0 :     ESelection aSel( pEditView->GetSelection() );
     943                 :          0 :     aSel.Adjust();
     944                 :            : 
     945         [ #  # ]:          0 :     const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
     946         [ #  # ]:          0 :     pOwner->pEditEngine->SetUpdateMode( sal_False );
     947                 :            : 
     948         [ #  # ]:          0 :     for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
     949                 :            :     {
     950         [ #  # ]:          0 :         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     951                 :            :         DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
     952                 :            : 
     953 [ #  # ][ #  # ]:          0 :         if( pPara && (pOwner->GetDepth(nPara) == -1) )
         [ #  # ][ #  # ]
     954                 :            :         {
     955         [ #  # ]:          0 :             pOwner->SetDepth( pPara, 0 );
     956                 :            :         }
     957                 :            :     }
     958                 :            : 
     959                 :            :     // #i100014#
     960                 :            :     // It is not a good idea to substract 1 from a count and cast the result
     961                 :            :     // to sal_uInt16 without check, if the count is 0.
     962                 :          0 :     sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
     963                 :            : 
     964         [ #  # ]:          0 :     pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
     965         [ #  # ]:          0 :     pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
     966                 :            : 
     967         [ #  # ]:          0 :     pOwner->pEditEngine->SetUpdateMode( bUpdate );
     968                 :            : 
     969         [ #  # ]:          0 :     pOwner->UndoActionEnd( OLUNDO_DEPTH );
     970                 :          0 : }
     971                 :            : 
     972                 :            : 
     973                 :          0 : void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs )
     974                 :            : {
     975                 :          0 :     RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ );
     976                 :          0 : }
     977                 :            : 
     978                 :          0 : void OutlinerView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich, sal_Bool bKeepLanguages )
     979                 :            : {
     980                 :            :     DBG_CHKTHIS(OutlinerView,0);
     981                 :          0 :     sal_Bool bUpdate = pOwner->GetUpdateMode();
     982                 :          0 :     pOwner->SetUpdateMode( sal_False );
     983                 :          0 :     pOwner->UndoActionStart( OLUNDO_ATTR );
     984         [ #  # ]:          0 :     if (bKeepLanguages)
     985                 :          0 :         pEditView->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
     986                 :            :     else
     987                 :          0 :         pEditView->RemoveAttribs( bRemoveParaAttribs, nWhich );
     988         [ #  # ]:          0 :     if ( bRemoveParaAttribs )
     989                 :            :     {
     990                 :            :         // Loop through all paragraphs and set indentation and level
     991         [ #  # ]:          0 :         ESelection aSel = pEditView->GetSelection();
     992                 :          0 :         aSel.Adjust();
     993         [ #  # ]:          0 :         for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
     994                 :            :         {
     995         [ #  # ]:          0 :             Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     996         [ #  # ]:          0 :             pOwner->ImplInitDepth( nPara, pPara->GetDepth(), sal_False, sal_False );
     997                 :            :         }
     998                 :            :     }
     999                 :          0 :     pOwner->UndoActionEnd( OLUNDO_ATTR );
    1000                 :          0 :     pOwner->SetUpdateMode( bUpdate );
    1001                 :          0 : }
    1002                 :            : 
    1003                 :            : 
    1004                 :            : 
    1005                 :            : // ======================================================================
    1006                 :            : // ======================   Simple pass-through   =======================
    1007                 :            : // ======================================================================
    1008                 :            : 
    1009                 :            : 
    1010                 :          6 : void OutlinerView::InsertText( const XubString& rNew, sal_Bool bSelect )
    1011                 :            : {
    1012                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1013         [ +  - ]:          6 :     if( pOwner->bFirstParaIsEmpty )
    1014         [ +  - ]:          6 :         pOwner->Insert( String() );
    1015                 :          6 :     pEditView->InsertText( rNew, bSelect );
    1016                 :          6 : }
    1017                 :            : 
    1018                 :         18 : void OutlinerView::SetVisArea( const Rectangle& rRec )
    1019                 :            : {
    1020                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1021                 :         18 :     pEditView->SetVisArea( rRec );
    1022                 :         18 : }
    1023                 :            : 
    1024                 :            : 
    1025                 :         36 : void OutlinerView::SetSelection( const ESelection& rSel )
    1026                 :            : {
    1027                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1028                 :         36 :     pEditView->SetSelection( rSel );
    1029                 :         36 : }
    1030                 :            : 
    1031                 :         18 : void OutlinerView::SetReadOnly( sal_Bool bReadOnly )
    1032                 :            : {
    1033                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1034                 :         18 :     pEditView->SetReadOnly( bReadOnly );
    1035                 :         18 : }
    1036                 :            : 
    1037                 :          0 : sal_Bool OutlinerView::IsReadOnly() const
    1038                 :            : {
    1039                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1040                 :          0 :     return pEditView->IsReadOnly();
    1041                 :            : }
    1042                 :            : 
    1043                 :          0 : sal_Bool OutlinerView::HasSelection() const
    1044                 :            : {
    1045                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1046                 :          0 :     return pEditView->HasSelection();
    1047                 :            : }
    1048                 :            : 
    1049                 :            : 
    1050                 :         18 : void OutlinerView::ShowCursor( sal_Bool bGotoCursor )
    1051                 :            : {
    1052                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1053                 :         18 :     pEditView->ShowCursor( bGotoCursor );
    1054                 :         18 : }
    1055                 :            : 
    1056                 :            : 
    1057                 :          0 : void OutlinerView::HideCursor()
    1058                 :            : {
    1059                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1060                 :          0 :     pEditView->HideCursor();
    1061                 :          0 : }
    1062                 :            : 
    1063                 :            : 
    1064                 :         15 : void OutlinerView::SetWindow( Window* pWin )
    1065                 :            : {
    1066                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1067                 :         15 :     pEditView->SetWindow( pWin );
    1068                 :         15 : }
    1069                 :            : 
    1070                 :            : 
    1071                 :          0 : Window* OutlinerView::GetWindow() const
    1072                 :            : {
    1073                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1074                 :          0 :     return pEditView->GetWindow();
    1075                 :            : }
    1076                 :            : 
    1077                 :            : 
    1078                 :         36 : void OutlinerView::SetOutputArea( const Rectangle& rRect )
    1079                 :            : {
    1080                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1081                 :         36 :     pEditView->SetOutputArea( rRect );
    1082                 :         36 : }
    1083                 :            : 
    1084                 :            : 
    1085                 :          0 : Rectangle OutlinerView::GetOutputArea() const
    1086                 :            : {
    1087                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1088                 :          0 :     return pEditView->GetOutputArea();
    1089                 :            : }
    1090                 :            : 
    1091                 :            : 
    1092                 :          0 : XubString OutlinerView::GetSelected() const
    1093                 :            : {
    1094                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1095                 :          0 :     return pEditView->GetSelected();
    1096                 :            : }
    1097                 :            : 
    1098                 :         18 : EESpellState OutlinerView::StartSpeller( sal_Bool bMultiDoc )
    1099                 :            : {
    1100                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1101                 :         18 :     return pEditView->StartSpeller( bMultiDoc );
    1102                 :            : }
    1103                 :            : 
    1104                 :          0 : EESpellState OutlinerView::StartThesaurus()
    1105                 :            : {
    1106                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1107                 :          0 :     return pEditView->StartThesaurus();
    1108                 :            : }
    1109                 :            : 
    1110                 :            : 
    1111                 :          0 : void OutlinerView::StartTextConversion(
    1112                 :            :     LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont,
    1113                 :            :     sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc )
    1114                 :            : {
    1115                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1116 [ #  # ][ #  # ]:          0 :     if (
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1117                 :            :         (LANGUAGE_KOREAN == nSrcLang && LANGUAGE_KOREAN == nDestLang) ||
    1118                 :            :         (LANGUAGE_CHINESE_SIMPLIFIED  == nSrcLang && LANGUAGE_CHINESE_TRADITIONAL == nDestLang) ||
    1119                 :            :         (LANGUAGE_CHINESE_TRADITIONAL == nSrcLang && LANGUAGE_CHINESE_SIMPLIFIED  == nDestLang)
    1120                 :            :        )
    1121                 :            :     {
    1122                 :          0 :         pEditView->StartTextConversion( nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc );
    1123                 :            :     }
    1124                 :            :     else
    1125                 :            :     {
    1126                 :            :         OSL_FAIL( "unexpected language" );
    1127                 :            :     }
    1128                 :          0 : }
    1129                 :            : 
    1130                 :            : 
    1131                 :          0 : sal_uInt16 OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem )
    1132                 :            : {
    1133                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1134                 :          0 :     return pEditView->StartSearchAndReplace( rSearchItem );
    1135                 :            : }
    1136                 :            : 
    1137                 :          0 : void OutlinerView::TransliterateText( sal_Int32 nTransliterationMode )
    1138                 :            : {
    1139                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1140                 :          0 :     pEditView->TransliterateText( nTransliterationMode );
    1141                 :          0 : }
    1142                 :            : 
    1143                 :            : 
    1144                 :            : 
    1145                 :         18 : ESelection OutlinerView::GetSelection()
    1146                 :            : {
    1147                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1148                 :         18 :     return pEditView->GetSelection();
    1149                 :            : }
    1150                 :            : 
    1151                 :            : 
    1152                 :          0 : void OutlinerView::Scroll( long nHorzScroll, long nVertScroll )
    1153                 :            : {
    1154                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1155                 :          0 :     pEditView->Scroll( nHorzScroll, nVertScroll );
    1156                 :          0 : }
    1157                 :            : 
    1158                 :            : 
    1159                 :          0 : void OutlinerView::SetControlWord( sal_uLong nWord )
    1160                 :            : {
    1161                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1162                 :          0 :     pEditView->SetControlWord( nWord );
    1163                 :          0 : }
    1164                 :            : 
    1165                 :            : 
    1166                 :          0 : sal_uLong OutlinerView::GetControlWord() const
    1167                 :            : {
    1168                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1169                 :          0 :     return pEditView->GetControlWord();
    1170                 :            : }
    1171                 :            : 
    1172                 :            : 
    1173                 :          0 : void OutlinerView::SetAnchorMode( EVAnchorMode eMode )
    1174                 :            : {
    1175                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1176                 :          0 :     pEditView->SetAnchorMode( eMode );
    1177                 :          0 : }
    1178                 :            : 
    1179                 :            : 
    1180                 :          0 : EVAnchorMode OutlinerView::GetAnchorMode() const
    1181                 :            : {
    1182                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1183                 :          0 :     return pEditView->GetAnchorMode();
    1184                 :            : }
    1185                 :            : 
    1186                 :          0 : void OutlinerView::Copy()
    1187                 :            : {
    1188                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1189                 :          0 :     pEditView->Copy();
    1190                 :          0 : }
    1191                 :            : 
    1192                 :            : 
    1193                 :          0 : void OutlinerView::InsertField( const SvxFieldItem& rFld )
    1194                 :            : {
    1195                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1196                 :          0 :     pEditView->InsertField( rFld );
    1197                 :          0 : }
    1198                 :            : 
    1199                 :          0 : const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer() const
    1200                 :            : {
    1201                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1202                 :          0 :     return pEditView->GetFieldUnderMousePointer();
    1203                 :            : }
    1204                 :            : 
    1205                 :          0 : const SvxFieldItem* OutlinerView::GetFieldAtSelection() const
    1206                 :            : {
    1207                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1208                 :          0 :     return pEditView->GetFieldAtSelection();
    1209                 :            : }
    1210                 :            : 
    1211                 :          0 : void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel )
    1212                 :            : {
    1213                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1214                 :          0 :     pEditView->SetInvalidateMore( nPixel );
    1215                 :          0 : }
    1216                 :            : 
    1217                 :            : 
    1218                 :          0 : sal_uInt16 OutlinerView::GetInvalidateMore() const
    1219                 :            : {
    1220                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1221                 :          0 :     return pEditView->GetInvalidateMore();
    1222                 :            : }
    1223                 :            : 
    1224                 :            : 
    1225                 :          0 : sal_Bool OutlinerView::IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong )
    1226                 :            : {
    1227                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1228                 :          0 :     return pEditView->IsCursorAtWrongSpelledWord( bMarkIfWrong );
    1229                 :            : }
    1230                 :            : 
    1231                 :            : 
    1232                 :          0 : sal_Bool OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong )
    1233                 :            : {
    1234                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1235                 :          0 :     return pEditView->IsWrongSpelledWordAtPos( rPosPixel, bMarkIfWrong );
    1236                 :            : }
    1237                 :            : 
    1238                 :          0 : void OutlinerView::ExecuteSpellPopup( const Point& rPosPixel, Link* pStartDlg )
    1239                 :            : {
    1240                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1241                 :          0 :     pEditView->ExecuteSpellPopup( rPosPixel, pStartDlg );
    1242                 :          0 : }
    1243                 :            : 
    1244                 :          0 : sal_uLong OutlinerView::Read( SvStream& rInput,  const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs )
    1245                 :            : {
    1246                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1247 [ #  # ][ #  # ]:          0 :     sal_uInt16 nOldParaCount = pEditView->GetEditEngine()->GetParagraphCount();
    1248         [ #  # ]:          0 :     ESelection aOldSel = pEditView->GetSelection();
    1249                 :          0 :     aOldSel.Adjust();
    1250                 :            : 
    1251         [ #  # ]:          0 :     sal_uLong nRet = pEditView->Read( rInput, rBaseURL, eFormat, bSelect, pHTTPHeaderAttrs );
    1252                 :            : 
    1253 [ #  # ][ #  # ]:          0 :     long nParaDiff = pEditView->GetEditEngine()->GetParagraphCount() - nOldParaCount;
    1254                 :          0 :     sal_uInt16 nChangesStart = aOldSel.nStartPara;
    1255                 :          0 :     sal_uInt16 nChangesEnd = sal::static_int_cast< sal_uInt16 >(nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara));
    1256                 :            : 
    1257         [ #  # ]:          0 :     for ( sal_uInt16 n = nChangesStart; n <= nChangesEnd; n++ )
    1258                 :            :     {
    1259         [ #  # ]:          0 :         if ( eFormat == EE_FORMAT_BIN )
    1260                 :            :         {
    1261                 :          0 :             sal_uInt16 nDepth = 0;
    1262         [ #  # ]:          0 :             const SfxItemSet& rAttrs = pOwner->GetParaAttribs( n );
    1263         [ #  # ]:          0 :             const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL );
    1264                 :          0 :             nDepth = rLevel.GetValue();
    1265 [ #  # ][ #  # ]:          0 :             pOwner->ImplInitDepth( n, nDepth, sal_False );
    1266                 :            :         }
    1267                 :            : 
    1268         [ #  # ]:          0 :         if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
    1269         [ #  # ]:          0 :             pOwner->ImplSetLevelDependendStyleSheet( n );
    1270                 :            :     }
    1271                 :            : 
    1272         [ #  # ]:          0 :     if ( eFormat != EE_FORMAT_BIN )
    1273                 :            :     {
    1274         [ #  # ]:          0 :         pOwner->ImpFilterIndents( nChangesStart, nChangesEnd );
    1275                 :            :     }
    1276                 :            : 
    1277                 :          0 :     return nRet;
    1278                 :            : }
    1279                 :            : 
    1280                 :         18 : void OutlinerView::SetBackgroundColor( const Color& rColor )
    1281                 :            : {
    1282                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1283                 :         18 :     pEditView->SetBackgroundColor( rColor );
    1284                 :         18 : }
    1285                 :            : 
    1286                 :            : 
    1287                 :          0 : Color OutlinerView::GetBackgroundColor()
    1288                 :            : {
    1289                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1290                 :          0 :     return pEditView->GetBackgroundColor();
    1291                 :            : }
    1292                 :            : 
    1293                 :         18 : SfxItemSet OutlinerView::GetAttribs()
    1294                 :            : {
    1295                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1296                 :         18 :     return pEditView->GetAttribs();
    1297                 :            : }
    1298                 :            : 
    1299                 :          0 : sal_uInt16 OutlinerView::GetSelectedScriptType() const
    1300                 :            : {
    1301                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1302                 :          0 :     return pEditView->GetSelectedScriptType();
    1303                 :            : }
    1304                 :            : 
    1305                 :          0 : String OutlinerView::GetSurroundingText() const
    1306                 :            : {
    1307                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1308                 :          0 :     return pEditView->GetSurroundingText();
    1309                 :            : }
    1310                 :            : 
    1311                 :          0 : Selection OutlinerView::GetSurroundingTextSelection() const
    1312                 :            : {
    1313                 :            :     DBG_CHKTHIS(OutlinerView,0);
    1314                 :          0 :     return pEditView->GetSurroundingTextSelection();
    1315                 :            : }
    1316                 :            : 
    1317                 :            : 
    1318                 :            : // ======================================================================
    1319                 :            : // ===== some code for thesaurus sub menu within context menu
    1320                 :            : // ======================================================================
    1321                 :            : 
    1322                 :            : // returns: true if a word for thesaurus look-up was found at the current cursor position.
    1323                 :            : // The status string will be word + iso language string (e.g. "light#en-US")
    1324                 :          0 : bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(
    1325                 :            :     String &rStatusVal,
    1326                 :            :     LanguageType &rLang,
    1327                 :            :     const EditView &rEditView )
    1328                 :            : {
    1329                 :            :     // get text and locale for thesaurus look up
    1330         [ #  # ]:          0 :     String aText;
    1331         [ #  # ]:          0 :     EditEngine *pEditEngine = rEditView.GetEditEngine();
    1332         [ #  # ]:          0 :     ESelection aTextSel( rEditView.GetSelection() );
    1333         [ #  # ]:          0 :     if (!aTextSel.HasRange())
    1334         [ #  # ]:          0 :         aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD );
    1335 [ #  # ][ #  # ]:          0 :     aText = pEditEngine->GetText( aTextSel );
                 [ #  # ]
    1336                 :          0 :     aTextSel.Adjust();
    1337         [ #  # ]:          0 :     LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos );
    1338 [ #  # ][ #  # ]:          0 :     String aLangText( MsLangId::convertLanguageToIsoString( nLang ) );
    1339                 :            : 
    1340                 :            :     // set word and locale to look up as status value
    1341         [ #  # ]:          0 :     String aStatusVal( aText );
    1342         [ #  # ]:          0 :     aStatusVal.AppendAscii( "#" );
    1343         [ #  # ]:          0 :     aStatusVal += aLangText;
    1344                 :            : 
    1345         [ #  # ]:          0 :     rStatusVal  = aStatusVal;
    1346                 :          0 :     rLang       = nLang;
    1347                 :            : 
    1348 [ #  # ][ #  # ]:          0 :     return aText.Len() > 0;
                 [ #  # ]
    1349                 :            : }
    1350                 :            : 
    1351                 :            : 
    1352                 :          0 : void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText )
    1353                 :            : {
    1354                 :            :     // get selection to use
    1355         [ #  # ]:          0 :     ESelection aCurSel( rEditView.GetSelection() );
    1356 [ #  # ][ #  # ]:          0 :     if (!rEditView.HasSelection())
    1357                 :            :     {
    1358                 :            :         // select the same word that was used in GetStatusValueForThesaurusFromContext by calling GetWord.
    1359                 :            :         // (In the end both functions will call ImpEditEngine::SelectWord)
    1360         [ #  # ]:          0 :         rEditView.SelectCurrentWord( i18n::WordType::DICTIONARY_WORD );
    1361         [ #  # ]:          0 :         aCurSel = rEditView.GetSelection();
    1362                 :            :     }
    1363                 :            : 
    1364                 :            :     // replace word ...
    1365         [ #  # ]:          0 :     rEditView.InsertText( rSynonmText );
    1366         [ #  # ]:          0 :     rEditView.ShowCursor( sal_True, sal_False );
    1367                 :          0 : }
    1368                 :            : 
    1369                 :            : 
    1370                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10