LCOV - code coverage report
Current view: top level - starmath/source - edit.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 285 564 50.5 %
Date: 2014-04-11 Functions: 37 63 58.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/accessibility/XAccessible.hpp>
      21             : #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
      22             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      23             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      24             : #include <toolkit/helper/vclunohelper.hxx>
      25             : 
      26             : 
      27             : #include "starmath.hrc"
      28             : 
      29             : #include <vcl/menu.hxx>
      30             : #include <vcl/settings.hxx>
      31             : 
      32             : #include <editeng/editview.hxx>
      33             : #include <editeng/editeng.hxx>
      34             : #include <editeng/editstat.hxx>
      35             : #include <editeng/eeitem.hxx>
      36             : #include <sfx2/dispatch.hxx>
      37             : #include <svl/intitem.hxx>
      38             : #include <svl/itempool.hxx>
      39             : #include <svl/stritem.hxx>
      40             : #include <editeng/fhgtitem.hxx>
      41             : #include <editeng/wghtitem.hxx>
      42             : #include <editeng/lrspitem.hxx>
      43             : #include <svl/itemset.hxx>
      44             : #include <editeng/fontitem.hxx>
      45             : #include <sfx2/viewfrm.hxx>
      46             : 
      47             : #include "edit.hxx"
      48             : #include "view.hxx"
      49             : #include "document.hxx"
      50             : #include "config.hxx"
      51             : #include "accessibility.hxx"
      52             : 
      53             : #define SCROLL_LINE         24
      54             : 
      55             : 
      56             : using namespace com::sun::star::accessibility;
      57             : using namespace com::sun::star;
      58             : using namespace com::sun::star::uno;
      59             : 
      60             : 
      61             : 
      62             : 
      63          26 : void SmGetLeftSelectionPart(const ESelection &rSel,
      64             :                             sal_Int32 &nPara, sal_uInt16 &nPos)
      65             :     // returns paragraph number and position of the selections left part
      66             : {
      67             :     // compare start and end of selection and use the one that comes first
      68          26 :     if (    rSel.nStartPara <  rSel.nEndPara
      69          26 :         ||  (rSel.nStartPara == rSel.nEndPara  &&  rSel.nStartPos < rSel.nEndPos) )
      70           0 :     {   nPara = rSel.nStartPara;
      71           0 :         nPos  = rSel.nStartPos;
      72             :     }
      73             :     else
      74          26 :     {   nPara = rSel.nEndPara;
      75          26 :         nPos  = rSel.nEndPos;
      76             :     }
      77          26 : }
      78             : 
      79          70 : bool SmEditWindow::IsInlineEditEnabled()
      80             : {
      81          70 :     SmViewShell *pView = GetView();
      82          70 :     return pView ? pView->IsInlineEditEnabled() : false;
      83             : }
      84             : 
      85             : 
      86             : 
      87          25 : SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) :
      88             :     Window              (&rMyCmdBoxWin),
      89             :     DropTargetHelper    ( this ),
      90             :     pAccessible         (0),
      91             :     rCmdBox             (rMyCmdBoxWin),
      92             :     pEditView           (0),
      93             :     pHScrollBar         (0),
      94             :     pVScrollBar         (0),
      95          25 :     pScrollBox          (0)
      96             : {
      97          25 :     SetHelpId(HID_SMA_COMMAND_WIN_EDIT);
      98          25 :     SetMapMode(MAP_PIXEL);
      99             : 
     100             :     // Even RTL languages don't use RTL for math
     101          25 :     rCmdBox.GetEditWindow()->EnableRTL( false );
     102             : 
     103          25 :     ApplyColorConfigValues( SM_MOD()->GetColorConfig() );
     104             : 
     105             :     // compare DataChanged
     106          25 :     SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
     107             : 
     108          25 :     aModifyTimer.SetTimeoutHdl(LINK(this, SmEditWindow, ModifyTimerHdl));
     109          25 :     aModifyTimer.SetTimeout(500);
     110             : 
     111          25 :     if (!IsInlineEditEnabled())
     112             :     {
     113          25 :         aCursorMoveTimer.SetTimeoutHdl(LINK(this, SmEditWindow, CursorMoveTimerHdl));
     114          25 :         aCursorMoveTimer.SetTimeout(500);
     115             :     }
     116             : 
     117             :     // if not called explicitly the this edit window within the
     118             :     // command window will just show an empty gray panel.
     119          25 :     Show();
     120          25 : }
     121             : 
     122             : 
     123          54 : SmEditWindow::~SmEditWindow()
     124             : {
     125          25 :     aModifyTimer.Stop();
     126             : 
     127          25 :     StartCursorMove();
     128             : 
     129             :     // clean up of classes used for accessibility
     130             :     // must be done before EditView (and thus EditEngine) is no longer
     131             :     // available for those classes.
     132          25 :     if (pAccessible)
     133           2 :         pAccessible->ClearWin();    // make Accessible defunctional
     134             :     // Note: memory for pAccessible will be freed when the reference
     135             :     // xAccessible is released.
     136             : 
     137          25 :     if (pEditView)
     138             :     {
     139          25 :         EditEngine *pEditEngine = pEditView->GetEditEngine();
     140          25 :         if (pEditEngine)
     141             :         {
     142          25 :             pEditEngine->SetStatusEventHdl( Link() );
     143          25 :             pEditEngine->RemoveView( pEditView );
     144             :         }
     145          25 :         delete pEditView;
     146             :     }
     147          25 :     delete pHScrollBar;
     148          25 :     delete pVScrollBar;
     149          25 :     delete pScrollBox;
     150          29 : }
     151             : 
     152          28 : void SmEditWindow::StartCursorMove()
     153             : {
     154          28 :     if (!IsInlineEditEnabled())
     155          28 :         aCursorMoveTimer.Stop();
     156          28 : }
     157             : 
     158           0 : void SmEditWindow::InvalidateSlots()
     159             : {
     160           0 :     SfxBindings& rBind = GetView()->GetViewFrame()->GetBindings();
     161           0 :     rBind.Invalidate(SID_COPY);
     162           0 :     rBind.Invalidate(SID_CUT);
     163           0 :     rBind.Invalidate(SID_DELETE);
     164           0 : }
     165             : 
     166          91 : SmViewShell * SmEditWindow::GetView()
     167             : {
     168          91 :     return rCmdBox.GetView();
     169             : }
     170             : 
     171             : 
     172          28 : SmDocShell * SmEditWindow::GetDoc()
     173             : {
     174          28 :     SmViewShell *pView = rCmdBox.GetView();
     175          28 :     return pView ? pView->GetDoc() : 0;
     176             : }
     177             : 
     178             : 
     179         390 : EditEngine * SmEditWindow::GetEditEngine()
     180             : {
     181         390 :     EditEngine *pEditEng = 0;
     182         390 :     if (pEditView)
     183         365 :         pEditEng = pEditView->GetEditEngine();
     184             :     else
     185             :     {
     186          25 :         SmDocShell *pDoc = GetDoc();
     187          25 :         if (pDoc)
     188          25 :             pEditEng = &pDoc->GetEditEngine();
     189             :     }
     190         390 :     return pEditEng;
     191             : }
     192             : 
     193             : 
     194           0 : SfxItemPool * SmEditWindow::GetEditEngineItemPool()
     195             : {
     196           0 :     SmDocShell *pDoc = GetDoc();
     197           0 :     return pDoc ? &pDoc->GetEditEngineItemPool() : 0;
     198             : }
     199             : 
     200          25 : void SmEditWindow::ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg )
     201             : {
     202             :     // Note: SetBackground still done in SmEditWindow::DataChanged
     203             : #if OSL_DEBUG_LEVEL > 1
     204             : //   ColorData nVal = rColorCfg.GetColorValue(svtools::FONTCOLOR).nColor;
     205             : #endif
     206          25 :     SetTextColor( rColorCfg.GetColorValue(svtools::FONTCOLOR).nColor );
     207          25 :     Invalidate();
     208          25 : }
     209             : 
     210           0 : void SmEditWindow::DataChanged( const DataChangedEvent& )
     211             : {
     212           0 :     const StyleSettings aSettings( GetSettings().GetStyleSettings() );
     213             : 
     214           0 :     ApplyColorConfigValues( SM_MOD()->GetColorConfig() );
     215           0 :     SetBackground( aSettings.GetWindowColor() );
     216             : 
     217             :     // edit fields in other Applications use this font instead of
     218             :     // the application font thus we use this one too
     219           0 :     SetPointFont( aSettings.GetFieldFont() /*aSettings.GetAppFont()*/ );
     220             : 
     221           0 :     EditEngine  *pEditEngine = GetEditEngine();
     222           0 :     SfxItemPool *pEditEngineItemPool = GetEditEngineItemPool();
     223             : 
     224           0 :     if (pEditEngine && pEditEngineItemPool)
     225             :     {
     226             :         //!
     227             :         //! see also SmDocShell::GetEditEngine() !
     228             :         //!
     229             : 
     230           0 :         pEditEngine->SetDefTab(sal_uInt16(GetTextWidth(OUString("XXXX"))));
     231             : 
     232           0 :         SetEditEngineDefaultFonts(*pEditEngineItemPool);
     233             : 
     234             :         // forces new settings to be used
     235             :         // unfortunately this resets the whole edit engine
     236             :         // thus we need to save at least the text
     237           0 :         OUString aTxt( pEditEngine->GetText( LINEEND_LF ) );
     238           0 :         pEditEngine->Clear();   //incorrect font size
     239           0 :         pEditEngine->SetText( aTxt );
     240             :     }
     241             : 
     242           0 :     AdjustScrollBars();
     243           0 :     Resize();
     244           0 : }
     245             : 
     246           4 : IMPL_LINK( SmEditWindow, ModifyTimerHdl, Timer *, EMPTYARG /*pTimer*/ )
     247             : {
     248           2 :     UpdateStatus();
     249           2 :     aModifyTimer.Stop();
     250           2 :     return 0;
     251             : }
     252             : 
     253           0 : IMPL_LINK(SmEditWindow, CursorMoveTimerHdl, Timer *, EMPTYARG /*pTimer*/)
     254             :     // every once in a while check cursor position (selection) of edit
     255             :     // window and if it has changed (try to) set the formula-cursor
     256             :     // according to that.
     257             : {
     258           0 :     if (IsInlineEditEnabled())
     259           0 :         return 0;
     260             : 
     261           0 :     ESelection aNewSelection(GetSelection());
     262             : 
     263           0 :     if (!aNewSelection.IsEqual(aOldSelection))
     264             :     {
     265           0 :         SmViewShell *pView = rCmdBox.GetView();
     266           0 :         if (pView)
     267             :         {
     268             :             // get row and column to look for
     269             :             sal_Int32  nRow;
     270             :             sal_uInt16 nCol;
     271           0 :             SmGetLeftSelectionPart(aNewSelection, nRow, nCol);
     272           0 :             nRow++;
     273           0 :             nCol++;
     274           0 :             pView->GetGraphicWindow().SetCursorPos(static_cast<sal_uInt16>(nRow), nCol);
     275           0 :             aOldSelection = aNewSelection;
     276             :         }
     277             :     }
     278           0 :     aCursorMoveTimer.Stop();
     279             : 
     280           0 :     return 0;
     281             : }
     282             : 
     283          51 : void SmEditWindow::Resize()
     284             : {
     285          51 :     if (!pEditView)
     286          25 :         CreateEditView();
     287             : 
     288          51 :     if (pEditView)
     289             :     {
     290          51 :         pEditView->SetOutputArea(AdjustScrollBars());
     291          51 :         pEditView->ShowCursor();
     292             : 
     293             :         OSL_ENSURE( pEditView->GetEditEngine(), "EditEngine missing" );
     294         102 :         const long nMaxVisAreaStart = pEditView->GetEditEngine()->GetTextHeight() -
     295         102 :                                       pEditView->GetOutputArea().GetHeight();
     296          51 :         if (pEditView->GetVisArea().Top() > nMaxVisAreaStart)
     297             :         {
     298          22 :             Rectangle aVisArea(pEditView->GetVisArea() );
     299          22 :             aVisArea.Top() = (nMaxVisAreaStart > 0 ) ? nMaxVisAreaStart : 0;
     300          22 :             aVisArea.SetSize(pEditView->GetOutputArea().GetSize());
     301          22 :             pEditView->SetVisArea(aVisArea);
     302          22 :             pEditView->ShowCursor();
     303             :         }
     304          51 :         InitScrollBars();
     305             :     }
     306          51 :     Invalidate();
     307          51 : }
     308             : 
     309           0 : void SmEditWindow::MouseButtonUp(const MouseEvent &rEvt)
     310             : {
     311           0 :     if (pEditView)
     312           0 :         pEditView->MouseButtonUp(rEvt);
     313             :     else
     314           0 :         Window::MouseButtonUp (rEvt);
     315             : 
     316           0 :     if (!IsInlineEditEnabled())
     317           0 :         CursorMoveTimerHdl(&aCursorMoveTimer);
     318           0 :     InvalidateSlots();
     319           0 : }
     320             : 
     321           0 : void SmEditWindow::MouseButtonDown(const MouseEvent &rEvt)
     322             : {
     323           0 :     if (pEditView)
     324           0 :         pEditView->MouseButtonDown(rEvt);
     325             :     else
     326           0 :         Window::MouseButtonDown (rEvt);
     327             : 
     328           0 :     GrabFocus();
     329           0 : }
     330             : 
     331           0 : void SmEditWindow::Command(const CommandEvent& rCEvt)
     332             : {
     333           0 :     bool bForwardEvt = true;
     334           0 :     if (rCEvt.GetCommand() == COMMAND_CONTEXTMENU)
     335             :     {
     336           0 :         GetParent()->ToTop();
     337             : 
     338           0 :         Point aPoint = rCEvt.GetMousePosPixel();
     339           0 :         PopupMenu* pPopupMenu = new PopupMenu(SmResId(RID_COMMANDMENU));
     340             : 
     341             :         // added for replaceability of context menus
     342           0 :         Menu* pMenu = NULL;
     343           0 :         ::com::sun::star::ui::ContextMenuExecuteEvent aEvent;
     344           0 :         aEvent.SourceWindow = VCLUnoHelper::GetInterface( this );
     345           0 :         aEvent.ExecutePosition.X = aPoint.X();
     346           0 :         aEvent.ExecutePosition.Y = aPoint.Y();
     347           0 :         OUString sDummy;
     348           0 :         if ( GetView()->TryContextMenuInterception( *pPopupMenu, sDummy, pMenu, aEvent ) )
     349             :         {
     350           0 :             if ( pMenu )
     351             :             {
     352           0 :                 delete pPopupMenu;
     353           0 :                 pPopupMenu = (PopupMenu*) pMenu;
     354             :             }
     355             :         }
     356             : 
     357           0 :         pPopupMenu->SetSelectHdl(LINK(this, SmEditWindow, MenuSelectHdl));
     358             : 
     359           0 :         pPopupMenu->Execute( this, aPoint );
     360           0 :         delete pPopupMenu;
     361           0 :         bForwardEvt = false;
     362             :     }
     363           0 :     else if (rCEvt.GetCommand() == COMMAND_WHEEL)
     364           0 :         bForwardEvt = !HandleWheelCommands( rCEvt );
     365             : 
     366           0 :     if (bForwardEvt)
     367             :     {
     368           0 :         if (pEditView)
     369           0 :             pEditView->Command( rCEvt );
     370             :         else
     371           0 :             Window::Command (rCEvt);
     372             :     }
     373           0 : }
     374             : 
     375             : 
     376           0 : bool SmEditWindow::HandleWheelCommands( const CommandEvent &rCEvt )
     377             : {
     378           0 :     bool bCommandHandled = false;    // true if the CommandEvent needs not
     379             :                                     // to be passed on (because it has fully
     380             :                                     // been taken care of).
     381             : 
     382           0 :     const CommandWheelData* pWData = rCEvt.GetWheelData();
     383           0 :     if (pWData)
     384             :     {
     385           0 :         if (COMMAND_WHEEL_ZOOM == pWData->GetMode())
     386           0 :             bCommandHandled = true;     // no zooming in Command window
     387             :         else
     388           0 :             bCommandHandled = HandleScrollCommand( rCEvt, pHScrollBar, pVScrollBar);
     389             :     }
     390             : 
     391           0 :     return bCommandHandled;
     392             : }
     393             : 
     394             : 
     395           0 : IMPL_LINK_INLINE_START( SmEditWindow, MenuSelectHdl, Menu *, pMenu )
     396             : {
     397           0 :     SmViewShell *pViewSh = rCmdBox.GetView();
     398           0 :     if (pViewSh)
     399             :         pViewSh->GetViewFrame()->GetDispatcher()->Execute(
     400             :                 SID_INSERTCOMMAND, SFX_CALLMODE_STANDARD,
     401           0 :                 new SfxInt16Item(SID_INSERTCOMMAND, pMenu->GetCurItemId()), 0L);
     402           0 :     return 0;
     403             : }
     404           0 : IMPL_LINK_INLINE_END( SmEditWindow, MenuSelectHdl, Menu *, pMenu )
     405             : 
     406           0 : void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
     407             : {
     408           0 :     if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE)
     409             :     {
     410           0 :         bool bCallBase = true;
     411           0 :         SfxViewShell* pViewShell = GetView();
     412           0 :         if ( pViewShell && pViewShell->ISA(SmViewShell) )
     413             :         {
     414             :             // Terminate possible InPlace mode
     415           0 :             bCallBase = !pViewShell->Escape();
     416             :         }
     417           0 :         if ( bCallBase )
     418           0 :             Window::KeyInput( rKEvt );
     419             :     }
     420             :     else
     421             :     {
     422           0 :         StartCursorMove();
     423             : 
     424           0 :         bool autoClose = false;
     425           0 :         if (!pEditView)
     426           0 :             CreateEditView();
     427           0 :         ESelection aSelection = pEditView->GetSelection();
     428             :         // as we don't support RTL in Math, we need to swap values from selection when they were done
     429             :         // in RTL form
     430           0 :         aSelection.Adjust();
     431           0 :         OUString selected = pEditView->GetEditEngine()->GetText(aSelection);
     432             : 
     433           0 :         if (selected.trim() == "<?>")
     434           0 :             autoClose = true;
     435           0 :         else if (selected.isEmpty() && !aSelection.HasRange())
     436             :         {
     437           0 :             selected = pEditView->GetEditEngine()->GetText(aSelection.nEndPara);
     438           0 :             if (!selected.isEmpty())
     439             :             {
     440           0 :                 sal_Int32 index = selected.indexOf("\n", aSelection.nEndPos);
     441           0 :                 if (index != -1)
     442             :                 {
     443           0 :                     selected = selected.copy(index, sal_Int32(aSelection.nEndPos-index));
     444           0 :                     if (selected.trim().isEmpty())
     445           0 :                         autoClose = true;
     446             :                 }
     447             :                 else
     448             :                 {
     449           0 :                     sal_Int32 length = selected.getLength();
     450           0 :                     if (aSelection.nEndPos == length)
     451           0 :                         autoClose = true;
     452             :                     else
     453             :                     {
     454           0 :                         selected = selected.copy(aSelection.nEndPos);
     455           0 :                         if (selected.trim().isEmpty())
     456           0 :                             autoClose = true;
     457             :                     }
     458             :                 }
     459             :             }
     460             :             else
     461           0 :                 autoClose = true;
     462             :         }
     463             : 
     464           0 :         if ( !pEditView->PostKeyEvent(rKEvt) )
     465             :         {
     466           0 :             SmViewShell *pView = GetView();
     467           0 :             if ( pView && !pView->KeyInput(rKEvt) )
     468             :             {
     469             :                 // F1 (help) leads to the destruction of this
     470           0 :                 Flush();
     471           0 :                 if ( aModifyTimer.IsActive() )
     472           0 :                     aModifyTimer.Stop();
     473           0 :                 Window::KeyInput(rKEvt);
     474             :             }
     475             :             else
     476             :             {
     477             :                 // SFX has maybe called a slot of the view and thus (because of a hack in SFX)
     478             :                 // set the focus to the view
     479           0 :                 SfxViewShell* pVShell = GetView();
     480           0 :                 if ( pVShell && pVShell->ISA(SmViewShell) &&
     481           0 :                      ((SmViewShell*)pVShell)->GetGraphicWindow().HasFocus() )
     482             :                 {
     483           0 :                     GrabFocus();
     484             :                 }
     485             :             }
     486             :         }
     487             :         else
     488             :         {
     489             :             // have doc-shell modified only for formula input/change and not
     490             :             // cursor travelling and such things...
     491           0 :             SmDocShell *pDocShell = GetDoc();
     492           0 :             EditEngine *pEditEngine = GetEditEngine();
     493           0 :             if (pDocShell && pEditEngine)
     494           0 :                 pDocShell->SetModified(pEditEngine->IsModified());
     495           0 :             aModifyTimer.Start();
     496             :         }
     497             : 
     498             :         // get the current char of the key event
     499           0 :         sal_Unicode charCode = rKEvt.GetCharCode();
     500           0 :         OUString close;
     501             : 
     502           0 :         if (charCode == '{')
     503           0 :             close = "  }";
     504           0 :         else if (charCode == '[')
     505           0 :             close = "  ]";
     506           0 :         else if (charCode == '(')
     507           0 :             close = "  )";
     508             : 
     509             :         // auto close the current character only when needed
     510           0 :         if (!close.isEmpty() && autoClose)
     511             :         {
     512           0 :             pEditView->InsertText(close);
     513             :             // position it at center of brackets
     514           0 :             aSelection.nStartPos += 2;
     515           0 :             aSelection.nEndPos = aSelection.nStartPos;
     516           0 :             pEditView->SetSelection(aSelection);
     517             :         }
     518             : 
     519           0 :         InvalidateSlots();
     520             :     }
     521           0 : }
     522             : 
     523          27 : void SmEditWindow::Paint(const Rectangle& rRect)
     524             : {
     525          27 :     if (!pEditView)
     526           0 :         CreateEditView();
     527          27 :     pEditView->Paint(rRect);
     528          27 : }
     529             : 
     530          25 : void SmEditWindow::CreateEditView()
     531             : {
     532          25 :     EditEngine *pEditEngine = GetEditEngine();
     533             : 
     534             :     //! pEditEngine and pEditView may be 0.
     535             :     //! For example when the program is used by the document-converter
     536          25 :     if (!pEditView && pEditEngine)
     537             :     {
     538          25 :         pEditView = new EditView( pEditEngine, this );
     539          25 :         pEditEngine->InsertView( pEditView );
     540             : 
     541          25 :         if (!pVScrollBar)
     542          25 :             pVScrollBar = new ScrollBar(this, WinBits(WB_VSCROLL));
     543          25 :         if (!pHScrollBar)
     544          25 :             pHScrollBar = new ScrollBar(this, WinBits(WB_HSCROLL));
     545          25 :         if (!pScrollBox)
     546          25 :             pScrollBox  = new ScrollBarBox(this);
     547          25 :         pVScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
     548          25 :         pHScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
     549          25 :         pVScrollBar->EnableDrag( true );
     550          25 :         pHScrollBar->EnableDrag( true );
     551             : 
     552          25 :         pEditView->SetOutputArea(AdjustScrollBars());
     553             : 
     554          25 :         ESelection eSelection;
     555             : 
     556          25 :         pEditView->SetSelection(eSelection);
     557          25 :         Update();
     558          25 :         pEditView->ShowCursor(true, true);
     559             : 
     560          25 :         pEditEngine->SetStatusEventHdl( LINK(this, SmEditWindow, EditStatusHdl) );
     561          25 :         SetPointer(pEditView->GetPointer());
     562             : 
     563          25 :         SetScrollBarRanges();
     564             :     }
     565          25 : }
     566             : 
     567             : 
     568          18 : IMPL_LINK( SmEditWindow, EditStatusHdl, EditStatus *, EMPTYARG /*pStat*/ )
     569             : {
     570           9 :     if (!pEditView)
     571           0 :         return 1;
     572             :     else
     573             :     {
     574           9 :         Resize();
     575           9 :         return 0;
     576             :     }
     577             : }
     578             : 
     579           0 : IMPL_LINK_INLINE_START( SmEditWindow, ScrollHdl, ScrollBar *, EMPTYARG /*pScrollBar*/ )
     580             : {
     581             :     OSL_ENSURE(pEditView, "EditView missing");
     582           0 :     if (pEditView)
     583             :     {
     584             :         pEditView->SetVisArea(Rectangle(Point(pHScrollBar->GetThumbPos(),
     585             :                                             pVScrollBar->GetThumbPos()),
     586           0 :                                         pEditView->GetVisArea().GetSize()));
     587           0 :         pEditView->Invalidate();
     588             :     }
     589           0 :     return 0;
     590             : }
     591           0 : IMPL_LINK_INLINE_END( SmEditWindow, ScrollHdl, ScrollBar *, pScrollBar )
     592             : 
     593          79 : Rectangle SmEditWindow::AdjustScrollBars()
     594             : {
     595          79 :     const Size aOut( GetOutputSizePixel() );
     596          79 :     Point aPoint;
     597          79 :     Rectangle aRect( aPoint, aOut );
     598             : 
     599          79 :     if (pVScrollBar && pHScrollBar && pScrollBox)
     600             :     {
     601          79 :         const long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize();
     602          79 :         Point aPt( aRect.TopRight() ); aPt.X() -= nTmp -1L;
     603          79 :         pVScrollBar->SetPosSizePixel( aPt, Size(nTmp, aOut.Height() - nTmp));
     604             : 
     605          79 :         aPt = aRect.BottomLeft(); aPt.Y() -= nTmp - 1L;
     606          79 :         pHScrollBar->SetPosSizePixel( aPt, Size(aOut.Width() - nTmp, nTmp));
     607             : 
     608          79 :         aPt.X() = pHScrollBar->GetSizePixel().Width();
     609          79 :         aPt.Y() = pVScrollBar->GetSizePixel().Height();
     610          79 :         pScrollBox->SetPosSizePixel(aPt, Size(nTmp, nTmp ));
     611             : 
     612          79 :         aRect.Right()  = aPt.X() - 2;
     613          79 :         aRect.Bottom() = aPt.Y() - 2;
     614             :     }
     615          79 :     return aRect;
     616             : }
     617             : 
     618          76 : void SmEditWindow::SetScrollBarRanges()
     619             : {
     620             :     // Extra method, not InitScrollBars, since it's also being used for EditEngine events
     621          76 :     EditEngine *pEditEngine = GetEditEngine();
     622          76 :     if (pVScrollBar && pHScrollBar && pEditEngine && pEditView)
     623             :     {
     624          76 :         long nTmp = pEditEngine->GetTextHeight();
     625          76 :         pVScrollBar->SetRange(Range(0, nTmp));
     626          76 :         pVScrollBar->SetThumbPos(pEditView->GetVisArea().Top());
     627             : 
     628          76 :         nTmp = pEditEngine->GetPaperSize().Width();
     629          76 :         pHScrollBar->SetRange(Range(0,nTmp));
     630          76 :         pHScrollBar->SetThumbPos(pEditView->GetVisArea().Left());
     631             :     }
     632          76 : }
     633             : 
     634          51 : void SmEditWindow::InitScrollBars()
     635             : {
     636          51 :     if (pVScrollBar && pHScrollBar && pScrollBox && pEditView)
     637             :     {
     638          51 :         const Size aOut( pEditView->GetOutputArea().GetSize() );
     639          51 :         pVScrollBar->SetVisibleSize(aOut.Height());
     640          51 :         pVScrollBar->SetPageSize(aOut.Height() * 8 / 10);
     641          51 :         pVScrollBar->SetLineSize(aOut.Height() * 2 / 10);
     642             : 
     643          51 :         pHScrollBar->SetVisibleSize(aOut.Width());
     644          51 :         pHScrollBar->SetPageSize(aOut.Width() * 8 / 10);
     645          51 :         pHScrollBar->SetLineSize(SCROLL_LINE );
     646             : 
     647          51 :         SetScrollBarRanges();
     648             : 
     649          51 :         pVScrollBar->Show();
     650          51 :         pHScrollBar->Show();
     651          51 :         pScrollBox->Show();
     652             :     }
     653          51 : }
     654             : 
     655             : 
     656          12 : OUString SmEditWindow::GetText() const
     657             : {
     658          12 :     OUString aText;
     659          12 :     EditEngine *pEditEngine = const_cast< SmEditWindow* >(this)->GetEditEngine();
     660             :     OSL_ENSURE( pEditEngine, "EditEngine missing" );
     661          12 :     if (pEditEngine)
     662          12 :         aText = pEditEngine->GetText( LINEEND_LF );
     663          12 :     return aText;
     664             : }
     665             : 
     666             : 
     667           7 : void SmEditWindow::SetText(const OUString& rText)
     668             : {
     669           7 :     EditEngine *pEditEngine = GetEditEngine();
     670             :     OSL_ENSURE( pEditEngine, "EditEngine missing" );
     671           7 :     if (pEditEngine  &&  !pEditEngine->IsModified())
     672             :     {
     673           7 :         if (!pEditView)
     674           0 :             CreateEditView();
     675             : 
     676           7 :         ESelection eSelection = pEditView->GetSelection();
     677             : 
     678           7 :         pEditEngine->SetText(rText);
     679           7 :         pEditEngine->ClearModifyFlag();
     680             : 
     681             :         // Restarting the timer here, prevents calling the handlers for other (currently inactive)
     682             :         // math tasks
     683           7 :         aModifyTimer.Start();
     684             : 
     685           7 :         pEditView->SetSelection(eSelection);
     686             :     }
     687           7 : }
     688             : 
     689             : 
     690          17 : void SmEditWindow::GetFocus()
     691             : {
     692          17 :     Window::GetFocus();
     693             : 
     694          17 :     if (xAccessible.is())
     695             :     {
     696             :         // Note: will implicitly send the AccessibleStateType::FOCUSED event
     697           0 :         ::accessibility::AccessibleTextHelper *pHelper = pAccessible->GetTextHelper();
     698           0 :         if (pHelper)
     699           0 :             pHelper->SetFocus(true);
     700             :     }
     701             : 
     702          17 :     if (!pEditView)
     703           0 :          CreateEditView();
     704          17 :     EditEngine *pEditEngine = GetEditEngine();
     705          17 :     if (pEditEngine)
     706          17 :         pEditEngine->SetStatusEventHdl( LINK(this, SmEditWindow, EditStatusHdl) );
     707             : 
     708             :     //Let SmViewShell know we got focus
     709          17 :     if(GetView() && IsInlineEditEnabled())
     710           0 :         GetView()->SetInsertIntoEditWindow(true);
     711          17 : }
     712             : 
     713             : 
     714           1 : void SmEditWindow::LoseFocus()
     715             : {
     716           1 :     EditEngine *pEditEngine = GetEditEngine();
     717           1 :     if (pEditEngine)
     718           1 :         pEditEngine->SetStatusEventHdl( Link() );
     719             : 
     720           1 :     Window::LoseFocus();
     721             : 
     722           1 :     if (xAccessible.is())
     723             :     {
     724             :         // Note: will implicitly send the AccessibleStateType::FOCUSED event
     725           0 :         ::accessibility::AccessibleTextHelper *pHelper = pAccessible->GetTextHelper();
     726           0 :         if (pHelper)
     727           0 :             pHelper->SetFocus(false);
     728             :     }
     729           1 : }
     730             : 
     731             : 
     732           0 : bool SmEditWindow::IsAllSelected() const
     733             : {
     734           0 :     bool bRes = false;
     735           0 :     EditEngine *pEditEngine = ((SmEditWindow *) this)->GetEditEngine();
     736             :     OSL_ENSURE( pEditView, "NULL pointer" );
     737             :     OSL_ENSURE( pEditEngine, "NULL pointer" );
     738           0 :     if (pEditEngine  &&  pEditView)
     739             :     {
     740           0 :         ESelection eSelection( pEditView->GetSelection() );
     741           0 :         sal_Int32 nParaCnt = pEditEngine->GetParagraphCount();
     742           0 :         if (!(nParaCnt - 1))
     743             :         {
     744           0 :             sal_Int32 nTextLen = pEditEngine->GetText( LINEEND_LF ).getLength();
     745           0 :             bRes = !eSelection.nStartPos && (eSelection.nEndPos == nTextLen - 1);
     746             :         }
     747             :         else
     748             :         {
     749           0 :             bRes = !eSelection.nStartPara && (eSelection.nEndPara == nParaCnt - 1);
     750             :         }
     751             :     }
     752           0 :     return bRes;
     753             : }
     754             : 
     755           0 : void SmEditWindow::SelectAll()
     756             : {
     757             :     OSL_ENSURE( pEditView, "NULL pointer" );
     758           0 :     if (pEditView)
     759             :     {
     760             :         // ALL as last two parameters refers to the end of the text
     761           0 :         pEditView->SetSelection( ESelection( 0, 0, EE_PARA_ALL, EE_TEXTPOS_ALL ) );
     762             :     }
     763           0 : }
     764             : 
     765           0 : void SmEditWindow::InsertCommand(sal_uInt16 nCommand)
     766             : {
     767             :     OSL_ENSURE( pEditView, "EditView missing" );
     768           0 :     if (pEditView)
     769             :     {
     770           0 :         ESelection aSelection = pEditView->GetSelection();
     771             : 
     772             :         OSL_ENSURE( pEditView, "NULL pointer" );
     773           0 :         OUString aText = SM_RESSTR(nCommand);
     774             : 
     775           0 :         OUString aCurrentFormula = pEditView->GetEditEngine()->GetText();
     776           0 :         sal_Int32 nStartIndex = 0;
     777           0 :         sal_Int32 nEndIndex = 0;
     778             : 
     779             :         // get the start position (when we get a multi line formula)
     780           0 :         for (sal_Int32 nParaPos = 0; nParaPos < aSelection.nStartPara; nParaPos++)
     781           0 :              nStartIndex = aCurrentFormula.indexOf("\n", nStartIndex) + 1;
     782             : 
     783           0 :         nStartIndex += aSelection.nStartPos;
     784             : 
     785             :         // get the end position (when we get a multi line formula)
     786           0 :         for (sal_Int32 nParaPos = 0; nParaPos < aSelection.nEndPara; nParaPos++)
     787           0 :              nEndIndex = aCurrentFormula.indexOf("\n", nEndIndex) + 1;
     788             : 
     789           0 :         nEndIndex += aSelection.nEndPos;
     790             : 
     791             :         // remove right space of current symbol if there already is one
     792           0 :         if (nEndIndex < aCurrentFormula.getLength() &&
     793           0 :             aCurrentFormula[nEndIndex] == ' ')
     794           0 :             aText = aText.trim();
     795             : 
     796             :         // put a space before a new command if not in the beginning of a line
     797           0 :         if (aSelection.nStartPos > 0 && aCurrentFormula[nStartIndex - 1] != ' ')
     798           0 :             aText = " " + aText;
     799             : 
     800           0 :         pEditView->InsertText(aText);
     801             : 
     802             :         // Remember start of the selection and move the cursor there afterwards.
     803           0 :         aSelection.nEndPara = aSelection.nStartPara;
     804           0 :         if (HasMark(aText))
     805             :         {
     806           0 :             aSelection.nEndPos = aSelection.nStartPos;
     807           0 :             pEditView->SetSelection(aSelection);
     808           0 :             SelNextMark();
     809             :         }
     810             :         else
     811             :         {   // set selection after inserted text
     812           0 :             aSelection.nEndPos = aSelection.nStartPos + aText.getLength();
     813           0 :             aSelection.nStartPos = aSelection.nEndPos;
     814           0 :             pEditView->SetSelection(aSelection);
     815             :         }
     816             : 
     817           0 :         aModifyTimer.Start();
     818           0 :         StartCursorMove();
     819           0 :         GrabFocus();
     820             :     }
     821           0 : }
     822             : 
     823           0 : void SmEditWindow::MarkError(const Point &rPos)
     824             : {
     825             :     OSL_ENSURE( pEditView, "EditView missing" );
     826           0 :     if (pEditView)
     827             :     {
     828           0 :         const sal_uInt16        nCol = sal::static_int_cast< sal_uInt16 >(rPos.X());
     829           0 :         const sal_uInt16        nRow = sal::static_int_cast< sal_uInt16 >(rPos.Y() - 1);
     830             : 
     831           0 :         pEditView->SetSelection(ESelection(nRow, nCol - 1, nRow, nCol));
     832           0 :         GrabFocus();
     833             :     }
     834           0 : }
     835             : 
     836             : // Makes selection to next <?> symbol
     837           3 : void SmEditWindow::SelNextMark()
     838             : {
     839           3 :     EditEngine *pEditEngine = GetEditEngine();
     840             :     OSL_ENSURE( pEditView, "NULL pointer" );
     841             :     OSL_ENSURE( pEditEngine, "NULL pointer" );
     842           3 :     if (pEditEngine  &&  pEditView)
     843             :     {
     844           3 :         ESelection eSelection = pEditView->GetSelection();
     845           3 :         sal_Int32 nPos = eSelection.nEndPos;
     846           3 :         sal_Int32 nCounts = pEditEngine->GetParagraphCount();
     847             : 
     848           6 :         while (eSelection.nEndPara < nCounts)
     849             :         {
     850           3 :             OUString aText = pEditEngine->GetText(eSelection.nEndPara);
     851           3 :             nPos = aText.indexOf("<?>", nPos);
     852           3 :             if (nPos != -1)
     853             :             {
     854             :                 pEditView->SetSelection(ESelection(
     855           3 :                     eSelection.nEndPara, nPos, eSelection.nEndPara, nPos + 3));
     856           3 :                 break;
     857             :             }
     858             : 
     859           0 :             nPos = 0;
     860           0 :             eSelection.nEndPara++;
     861           0 :         }
     862             :     }
     863           3 : }
     864             : 
     865           1 : void SmEditWindow::SelPrevMark()
     866             : {
     867           1 :     EditEngine *pEditEngine = GetEditEngine();
     868             :     OSL_ENSURE( pEditEngine, "NULL pointer" );
     869             :     OSL_ENSURE( pEditView, "NULL pointer" );
     870           1 :     if (pEditEngine  &&  pEditView)
     871             :     {
     872           1 :         ESelection eSelection = pEditView->GetSelection();
     873           1 :         sal_Int32 nPos = -1;
     874           1 :         sal_Int32 nMax = eSelection.nStartPos;
     875           1 :         OUString aText(pEditEngine->GetText(eSelection.nStartPara));
     876           2 :         OUString aMark("<?>");
     877           1 :         sal_Int32 nCounts = pEditEngine->GetParagraphCount();
     878             : 
     879           1 :         do
     880             :         {
     881           1 :             sal_Int32 nMarkIndex = aText.indexOf(aMark);
     882           3 :             while ((nMarkIndex < nMax) && (nMarkIndex != -1))
     883             :             {
     884           1 :                 nPos = nMarkIndex;
     885           1 :                 nMarkIndex = aText.indexOf(aMark, nMarkIndex + 1);
     886             :             }
     887             : 
     888           1 :             if (nPos == -1)
     889             :             {
     890           0 :                 eSelection.nStartPara--;
     891           0 :                 aText = pEditEngine->GetText(eSelection.nStartPara);
     892           0 :                 nMax = aText.getLength();
     893             :             }
     894             :         }
     895           2 :         while ((eSelection.nStartPara < nCounts) &&
     896             :             (nPos == -1));
     897             : 
     898           1 :         if (nPos != -1)
     899             :         {
     900             :             pEditView->SetSelection(ESelection(
     901           1 :                 eSelection.nStartPara, nPos, eSelection.nStartPara, nPos + 3));
     902           1 :         }
     903             :     }
     904           1 : }
     905             : 
     906           3 : bool SmEditWindow::HasMark(const OUString& rText) const
     907             :     // returns true iff 'rText' contains a mark
     908             : {
     909           3 :     return rText.indexOf("<?>") != -1;
     910             : }
     911             : 
     912           0 : void SmEditWindow::MouseMove(const MouseEvent &rEvt)
     913             : {
     914           0 :     if (pEditView)
     915           0 :         pEditView->MouseMove(rEvt);
     916           0 : }
     917             : 
     918           0 : sal_Int8 SmEditWindow::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
     919             : {
     920           0 :     return pEditView ? /*pEditView->QueryDrop( rEvt )*/DND_ACTION_NONE: DND_ACTION_NONE;
     921             : }
     922             : 
     923           0 : sal_Int8 SmEditWindow::ExecuteDrop( const ExecuteDropEvent& /*rEvt*/ )
     924             : {
     925           0 :     return pEditView ? /*pEditView->Drop( rEvt )*/DND_ACTION_NONE : DND_ACTION_NONE;
     926             : }
     927             : 
     928          26 : ESelection SmEditWindow::GetSelection() const
     929             : {
     930             :     // pointer may be 0 when reloading a document and the old view
     931             :     // was already destroyed
     932             :     //(OSL_ENSURE( pEditView, "NULL pointer" );
     933          26 :     ESelection eSel;
     934          26 :     if (pEditView)
     935          26 :         eSel = pEditView->GetSelection();
     936          26 :     return eSel;
     937             : }
     938             : 
     939           0 : void SmEditWindow::SetSelection(const ESelection &rSel)
     940             : {
     941             :     OSL_ENSURE( pEditView, "NULL pointer" );
     942           0 :     if (pEditView)
     943           0 :         pEditView->SetSelection(rSel);
     944           0 :     InvalidateSlots();
     945           0 : }
     946             : 
     947          21 : bool SmEditWindow::IsEmpty() const
     948             : {
     949          21 :     EditEngine *pEditEngine = ((SmEditWindow *) this)->GetEditEngine();
     950          21 :     bool bEmpty = ( pEditEngine ? pEditEngine->GetTextLen() == 0 : false);
     951          21 :     return bEmpty;
     952             : }
     953             : 
     954          42 : bool SmEditWindow::IsSelected() const
     955             : {
     956          42 :     return pEditView ? pEditView->HasSelection() : false;
     957             : }
     958             : 
     959             : 
     960           5 : void SmEditWindow::UpdateStatus( bool bSetDocModified )
     961             : {
     962           5 :     SmModule *pMod = SM_MOD();
     963           5 :     if (pMod && pMod->GetConfig()->IsAutoRedraw())
     964           5 :         Flush();
     965           5 :     if ( bSetDocModified )
     966           3 :         GetDoc()->SetModified(true);
     967           5 : }
     968             : 
     969           0 : void SmEditWindow::Cut()
     970             : {
     971             :     OSL_ENSURE( pEditView, "EditView missing" );
     972           0 :     if (pEditView)
     973             :     {
     974           0 :         pEditView->Cut();
     975           0 :         UpdateStatus(true);
     976             :     }
     977           0 : }
     978             : 
     979           0 : void SmEditWindow::Copy()
     980             : {
     981             :     OSL_ENSURE( pEditView, "EditView missing" );
     982           0 :     if (pEditView)
     983           0 :         pEditView->Copy();
     984           0 : }
     985             : 
     986           0 : void SmEditWindow::Paste()
     987             : {
     988             :     OSL_ENSURE( pEditView, "EditView missing" );
     989           0 :     if (pEditView)
     990             :     {
     991           0 :         pEditView->Paste();
     992           0 :         UpdateStatus(true);
     993             :     }
     994           0 : }
     995             : 
     996           3 : void SmEditWindow::Delete()
     997             : {
     998             :     OSL_ENSURE( pEditView, "EditView missing" );
     999           3 :     if (pEditView)
    1000             :     {
    1001           3 :         pEditView->DeleteSelected();
    1002           3 :         UpdateStatus(true);
    1003             :     }
    1004           3 : }
    1005             : 
    1006           3 : void SmEditWindow::InsertText(const OUString& rText)
    1007             : {
    1008             :     OSL_ENSURE( pEditView, "EditView missing" );
    1009           3 :     if (pEditView)
    1010             :     {
    1011             :         // Note: Insertion of a space in front of commands is done here and
    1012             :         // in SmEditWindow::InsertCommand.
    1013           3 :         ESelection aSelection = pEditView->GetSelection();
    1014           3 :         OUString aCurrentFormula = pEditView->GetEditEngine()->GetText();
    1015           3 :         sal_Int32 nStartIndex = 0;
    1016           3 :         sal_Int32 nEndIndex = 0;
    1017             : 
    1018             :         // get the start position (when we get a multi line formula)
    1019           3 :         for (sal_Int32 nParaPos = 0; nParaPos < aSelection.nStartPara; nParaPos++)
    1020           0 :              nStartIndex = aCurrentFormula.indexOf("\n", nStartIndex) + 1;
    1021             : 
    1022           3 :         nStartIndex += aSelection.nStartPos;
    1023             : 
    1024             :         // get the end position (when we get a multi line formula)
    1025           3 :         for (sal_Int32 nParaPos = 0; nParaPos < aSelection.nEndPara; nParaPos++)
    1026           0 :              nEndIndex = aCurrentFormula.indexOf("\n", nEndIndex) + 1;
    1027             : 
    1028           3 :         nEndIndex += aSelection.nEndPos;
    1029             : 
    1030             :         // TODO: unify this function with the InsertCommand: The do the same thing for different
    1031             :         // callers
    1032           6 :         OUString string(rText);
    1033             : 
    1034             :         // put a space before a new command if not in the beginning of a line
    1035           3 :         if (aSelection.nStartPos > 0 && aCurrentFormula[nStartIndex - 1] != ' ')
    1036           0 :             string = " " + string;
    1037             : 
    1038             :         /*
    1039             :           fdo#65588 -  Elements Dock: Scrollbar moves into input window
    1040             :           This change "solves" the visual problem. But I don't think so
    1041             :           this is the best solution.
    1042             :         */
    1043           3 :         pVScrollBar->Hide();
    1044           3 :         pHScrollBar->Hide();
    1045           3 :         pEditView->InsertText(string);
    1046           3 :         AdjustScrollBars();
    1047           3 :         pVScrollBar->Show();
    1048           3 :         pHScrollBar->Show();
    1049             : 
    1050             :         // Remember start of the selection and move the cursor there afterwards.
    1051           3 :         aSelection.nEndPara = aSelection.nStartPara;
    1052           3 :         if (HasMark(string))
    1053             :         {
    1054           0 :             aSelection.nEndPos = aSelection.nStartPos;
    1055           0 :             pEditView->SetSelection(aSelection);
    1056           0 :             SelNextMark();
    1057             :         }
    1058             :         else
    1059             :         {   // set selection after inserted text
    1060           3 :             aSelection.nEndPos = aSelection.nStartPos + string.getLength();
    1061           3 :             aSelection.nStartPos = aSelection.nEndPos;
    1062           3 :             pEditView->SetSelection(aSelection);
    1063             :         }
    1064             : 
    1065           3 :         aModifyTimer.Start();
    1066           3 :         StartCursorMove();
    1067           6 :         GrabFocus();
    1068             :     }
    1069           3 : }
    1070             : 
    1071           8 : void SmEditWindow::Flush()
    1072             : {
    1073           8 :     EditEngine *pEditEngine = GetEditEngine();
    1074           8 :     if (pEditEngine  &&  pEditEngine->IsModified())
    1075             :     {
    1076           4 :         pEditEngine->ClearModifyFlag();
    1077           4 :         SmViewShell *pViewSh = rCmdBox.GetView();
    1078           4 :         if (pViewSh)
    1079             :         {
    1080             :             pViewSh->GetViewFrame()->GetDispatcher()->Execute(
    1081             :                     SID_TEXT, SFX_CALLMODE_STANDARD,
    1082           4 :                     new SfxStringItem(SID_TEXT, GetText()), 0L);
    1083             :         }
    1084             :     }
    1085           8 :     if (aCursorMoveTimer.IsActive())
    1086             :     {
    1087           0 :         aCursorMoveTimer.Stop();
    1088           0 :         CursorMoveTimerHdl(&aCursorMoveTimer);
    1089             :     }
    1090           8 : }
    1091             : 
    1092             : 
    1093           0 : void SmEditWindow::DeleteEditView( SmViewShell & /*rView*/ )
    1094             : {
    1095           0 :     if (pEditView)
    1096             :     {
    1097           0 :         EditEngine *pEditEngine = pEditView->GetEditEngine();
    1098           0 :         if (pEditEngine)
    1099             :         {
    1100           0 :             pEditEngine->SetStatusEventHdl( Link() );
    1101           0 :             pEditEngine->RemoveView( pEditView );
    1102             :         }
    1103           0 :         delete pEditView;
    1104           0 :         pEditView = 0;
    1105             :     }
    1106           0 : }
    1107             : 
    1108             : 
    1109           2 : uno::Reference< XAccessible > SmEditWindow::CreateAccessible()
    1110             : {
    1111           2 :     if (!pAccessible)
    1112             :     {
    1113           2 :         pAccessible = new SmEditAccessible( this );
    1114           2 :         xAccessible = pAccessible;
    1115           2 :         pAccessible->Init();
    1116             :     }
    1117           2 :     return xAccessible;
    1118          27 : }
    1119             : 
    1120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10