LCOV - code coverage report
Current view: top level - starmath/source - edit.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 564 0.0 %
Date: 2014-04-14 Functions: 0 63 0.0 %
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           0 : 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           0 :     if (    rSel.nStartPara <  rSel.nEndPara
      69           0 :         ||  (rSel.nStartPara == rSel.nEndPara  &&  rSel.nStartPos < rSel.nEndPos) )
      70           0 :     {   nPara = rSel.nStartPara;
      71           0 :         nPos  = rSel.nStartPos;
      72             :     }
      73             :     else
      74           0 :     {   nPara = rSel.nEndPara;
      75           0 :         nPos  = rSel.nEndPos;
      76             :     }
      77           0 : }
      78             : 
      79           0 : bool SmEditWindow::IsInlineEditEnabled()
      80             : {
      81           0 :     SmViewShell *pView = GetView();
      82           0 :     return pView ? pView->IsInlineEditEnabled() : false;
      83             : }
      84             : 
      85             : 
      86             : 
      87           0 : 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           0 :     pScrollBox          (0)
      96             : {
      97           0 :     SetHelpId(HID_SMA_COMMAND_WIN_EDIT);
      98           0 :     SetMapMode(MAP_PIXEL);
      99             : 
     100             :     // Even RTL languages don't use RTL for math
     101           0 :     rCmdBox.GetEditWindow()->EnableRTL( false );
     102             : 
     103           0 :     ApplyColorConfigValues( SM_MOD()->GetColorConfig() );
     104             : 
     105             :     // compare DataChanged
     106           0 :     SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
     107             : 
     108           0 :     aModifyTimer.SetTimeoutHdl(LINK(this, SmEditWindow, ModifyTimerHdl));
     109           0 :     aModifyTimer.SetTimeout(500);
     110             : 
     111           0 :     if (!IsInlineEditEnabled())
     112             :     {
     113           0 :         aCursorMoveTimer.SetTimeoutHdl(LINK(this, SmEditWindow, CursorMoveTimerHdl));
     114           0 :         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           0 :     Show();
     120           0 : }
     121             : 
     122             : 
     123           0 : SmEditWindow::~SmEditWindow()
     124             : {
     125           0 :     aModifyTimer.Stop();
     126             : 
     127           0 :     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           0 :     if (pAccessible)
     133           0 :         pAccessible->ClearWin();    // make Accessible defunctional
     134             :     // Note: memory for pAccessible will be freed when the reference
     135             :     // xAccessible is released.
     136             : 
     137           0 :     if (pEditView)
     138             :     {
     139           0 :         EditEngine *pEditEngine = pEditView->GetEditEngine();
     140           0 :         if (pEditEngine)
     141             :         {
     142           0 :             pEditEngine->SetStatusEventHdl( Link() );
     143           0 :             pEditEngine->RemoveView( pEditView );
     144             :         }
     145           0 :         delete pEditView;
     146             :     }
     147           0 :     delete pHScrollBar;
     148           0 :     delete pVScrollBar;
     149           0 :     delete pScrollBox;
     150           0 : }
     151             : 
     152           0 : void SmEditWindow::StartCursorMove()
     153             : {
     154           0 :     if (!IsInlineEditEnabled())
     155           0 :         aCursorMoveTimer.Stop();
     156           0 : }
     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           0 : SmViewShell * SmEditWindow::GetView()
     167             : {
     168           0 :     return rCmdBox.GetView();
     169             : }
     170             : 
     171             : 
     172           0 : SmDocShell * SmEditWindow::GetDoc()
     173             : {
     174           0 :     SmViewShell *pView = rCmdBox.GetView();
     175           0 :     return pView ? pView->GetDoc() : 0;
     176             : }
     177             : 
     178             : 
     179           0 : EditEngine * SmEditWindow::GetEditEngine()
     180             : {
     181           0 :     EditEngine *pEditEng = 0;
     182           0 :     if (pEditView)
     183           0 :         pEditEng = pEditView->GetEditEngine();
     184             :     else
     185             :     {
     186           0 :         SmDocShell *pDoc = GetDoc();
     187           0 :         if (pDoc)
     188           0 :             pEditEng = &pDoc->GetEditEngine();
     189             :     }
     190           0 :     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           0 : 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           0 :     SetTextColor( rColorCfg.GetColorValue(svtools::FONTCOLOR).nColor );
     207           0 :     Invalidate();
     208           0 : }
     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           0 : IMPL_LINK( SmEditWindow, ModifyTimerHdl, Timer *, EMPTYARG /*pTimer*/ )
     247             : {
     248           0 :     UpdateStatus();
     249           0 :     aModifyTimer.Stop();
     250           0 :     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           0 : void SmEditWindow::Resize()
     284             : {
     285           0 :     if (!pEditView)
     286           0 :         CreateEditView();
     287             : 
     288           0 :     if (pEditView)
     289             :     {
     290           0 :         pEditView->SetOutputArea(AdjustScrollBars());
     291           0 :         pEditView->ShowCursor();
     292             : 
     293             :         OSL_ENSURE( pEditView->GetEditEngine(), "EditEngine missing" );
     294           0 :         const long nMaxVisAreaStart = pEditView->GetEditEngine()->GetTextHeight() -
     295           0 :                                       pEditView->GetOutputArea().GetHeight();
     296           0 :         if (pEditView->GetVisArea().Top() > nMaxVisAreaStart)
     297             :         {
     298           0 :             Rectangle aVisArea(pEditView->GetVisArea() );
     299           0 :             aVisArea.Top() = (nMaxVisAreaStart > 0 ) ? nMaxVisAreaStart : 0;
     300           0 :             aVisArea.SetSize(pEditView->GetOutputArea().GetSize());
     301           0 :             pEditView->SetVisArea(aVisArea);
     302           0 :             pEditView->ShowCursor();
     303             :         }
     304           0 :         InitScrollBars();
     305             :     }
     306           0 :     Invalidate();
     307           0 : }
     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           0 : void SmEditWindow::Paint(const Rectangle& rRect)
     524             : {
     525           0 :     if (!pEditView)
     526           0 :         CreateEditView();
     527           0 :     pEditView->Paint(rRect);
     528           0 : }
     529             : 
     530           0 : void SmEditWindow::CreateEditView()
     531             : {
     532           0 :     EditEngine *pEditEngine = GetEditEngine();
     533             : 
     534             :     //! pEditEngine and pEditView may be 0.
     535             :     //! For example when the program is used by the document-converter
     536           0 :     if (!pEditView && pEditEngine)
     537             :     {
     538           0 :         pEditView = new EditView( pEditEngine, this );
     539           0 :         pEditEngine->InsertView( pEditView );
     540             : 
     541           0 :         if (!pVScrollBar)
     542           0 :             pVScrollBar = new ScrollBar(this, WinBits(WB_VSCROLL));
     543           0 :         if (!pHScrollBar)
     544           0 :             pHScrollBar = new ScrollBar(this, WinBits(WB_HSCROLL));
     545           0 :         if (!pScrollBox)
     546           0 :             pScrollBox  = new ScrollBarBox(this);
     547           0 :         pVScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
     548           0 :         pHScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
     549           0 :         pVScrollBar->EnableDrag( true );
     550           0 :         pHScrollBar->EnableDrag( true );
     551             : 
     552           0 :         pEditView->SetOutputArea(AdjustScrollBars());
     553             : 
     554           0 :         ESelection eSelection;
     555             : 
     556           0 :         pEditView->SetSelection(eSelection);
     557           0 :         Update();
     558           0 :         pEditView->ShowCursor(true, true);
     559             : 
     560           0 :         pEditEngine->SetStatusEventHdl( LINK(this, SmEditWindow, EditStatusHdl) );
     561           0 :         SetPointer(pEditView->GetPointer());
     562             : 
     563           0 :         SetScrollBarRanges();
     564             :     }
     565           0 : }
     566             : 
     567             : 
     568           0 : IMPL_LINK( SmEditWindow, EditStatusHdl, EditStatus *, EMPTYARG /*pStat*/ )
     569             : {
     570           0 :     if (!pEditView)
     571           0 :         return 1;
     572             :     else
     573             :     {
     574           0 :         Resize();
     575           0 :         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           0 : Rectangle SmEditWindow::AdjustScrollBars()
     594             : {
     595           0 :     const Size aOut( GetOutputSizePixel() );
     596           0 :     Point aPoint;
     597           0 :     Rectangle aRect( aPoint, aOut );
     598             : 
     599           0 :     if (pVScrollBar && pHScrollBar && pScrollBox)
     600             :     {
     601           0 :         const long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize();
     602           0 :         Point aPt( aRect.TopRight() ); aPt.X() -= nTmp -1L;
     603           0 :         pVScrollBar->SetPosSizePixel( aPt, Size(nTmp, aOut.Height() - nTmp));
     604             : 
     605           0 :         aPt = aRect.BottomLeft(); aPt.Y() -= nTmp - 1L;
     606           0 :         pHScrollBar->SetPosSizePixel( aPt, Size(aOut.Width() - nTmp, nTmp));
     607             : 
     608           0 :         aPt.X() = pHScrollBar->GetSizePixel().Width();
     609           0 :         aPt.Y() = pVScrollBar->GetSizePixel().Height();
     610           0 :         pScrollBox->SetPosSizePixel(aPt, Size(nTmp, nTmp ));
     611             : 
     612           0 :         aRect.Right()  = aPt.X() - 2;
     613           0 :         aRect.Bottom() = aPt.Y() - 2;
     614             :     }
     615           0 :     return aRect;
     616             : }
     617             : 
     618           0 : void SmEditWindow::SetScrollBarRanges()
     619             : {
     620             :     // Extra method, not InitScrollBars, since it's also being used for EditEngine events
     621           0 :     EditEngine *pEditEngine = GetEditEngine();
     622           0 :     if (pVScrollBar && pHScrollBar && pEditEngine && pEditView)
     623             :     {
     624           0 :         long nTmp = pEditEngine->GetTextHeight();
     625           0 :         pVScrollBar->SetRange(Range(0, nTmp));
     626           0 :         pVScrollBar->SetThumbPos(pEditView->GetVisArea().Top());
     627             : 
     628           0 :         nTmp = pEditEngine->GetPaperSize().Width();
     629           0 :         pHScrollBar->SetRange(Range(0,nTmp));
     630           0 :         pHScrollBar->SetThumbPos(pEditView->GetVisArea().Left());
     631             :     }
     632           0 : }
     633             : 
     634           0 : void SmEditWindow::InitScrollBars()
     635             : {
     636           0 :     if (pVScrollBar && pHScrollBar && pScrollBox && pEditView)
     637             :     {
     638           0 :         const Size aOut( pEditView->GetOutputArea().GetSize() );
     639           0 :         pVScrollBar->SetVisibleSize(aOut.Height());
     640           0 :         pVScrollBar->SetPageSize(aOut.Height() * 8 / 10);
     641           0 :         pVScrollBar->SetLineSize(aOut.Height() * 2 / 10);
     642             : 
     643           0 :         pHScrollBar->SetVisibleSize(aOut.Width());
     644           0 :         pHScrollBar->SetPageSize(aOut.Width() * 8 / 10);
     645           0 :         pHScrollBar->SetLineSize(SCROLL_LINE );
     646             : 
     647           0 :         SetScrollBarRanges();
     648             : 
     649           0 :         pVScrollBar->Show();
     650           0 :         pHScrollBar->Show();
     651           0 :         pScrollBox->Show();
     652             :     }
     653           0 : }
     654             : 
     655             : 
     656           0 : OUString SmEditWindow::GetText() const
     657             : {
     658           0 :     OUString aText;
     659           0 :     EditEngine *pEditEngine = const_cast< SmEditWindow* >(this)->GetEditEngine();
     660             :     OSL_ENSURE( pEditEngine, "EditEngine missing" );
     661           0 :     if (pEditEngine)
     662           0 :         aText = pEditEngine->GetText( LINEEND_LF );
     663           0 :     return aText;
     664             : }
     665             : 
     666             : 
     667           0 : void SmEditWindow::SetText(const OUString& rText)
     668             : {
     669           0 :     EditEngine *pEditEngine = GetEditEngine();
     670             :     OSL_ENSURE( pEditEngine, "EditEngine missing" );
     671           0 :     if (pEditEngine  &&  !pEditEngine->IsModified())
     672             :     {
     673           0 :         if (!pEditView)
     674           0 :             CreateEditView();
     675             : 
     676           0 :         ESelection eSelection = pEditView->GetSelection();
     677             : 
     678           0 :         pEditEngine->SetText(rText);
     679           0 :         pEditEngine->ClearModifyFlag();
     680             : 
     681             :         // Restarting the timer here, prevents calling the handlers for other (currently inactive)
     682             :         // math tasks
     683           0 :         aModifyTimer.Start();
     684             : 
     685           0 :         pEditView->SetSelection(eSelection);
     686             :     }
     687           0 : }
     688             : 
     689             : 
     690           0 : void SmEditWindow::GetFocus()
     691             : {
     692           0 :     Window::GetFocus();
     693             : 
     694           0 :     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           0 :     if (!pEditView)
     703           0 :          CreateEditView();
     704           0 :     EditEngine *pEditEngine = GetEditEngine();
     705           0 :     if (pEditEngine)
     706           0 :         pEditEngine->SetStatusEventHdl( LINK(this, SmEditWindow, EditStatusHdl) );
     707             : 
     708             :     //Let SmViewShell know we got focus
     709           0 :     if(GetView() && IsInlineEditEnabled())
     710           0 :         GetView()->SetInsertIntoEditWindow(true);
     711           0 : }
     712             : 
     713             : 
     714           0 : void SmEditWindow::LoseFocus()
     715             : {
     716           0 :     EditEngine *pEditEngine = GetEditEngine();
     717           0 :     if (pEditEngine)
     718           0 :         pEditEngine->SetStatusEventHdl( Link() );
     719             : 
     720           0 :     Window::LoseFocus();
     721             : 
     722           0 :     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           0 : }
     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           0 : void SmEditWindow::SelNextMark()
     838             : {
     839           0 :     EditEngine *pEditEngine = GetEditEngine();
     840             :     OSL_ENSURE( pEditView, "NULL pointer" );
     841             :     OSL_ENSURE( pEditEngine, "NULL pointer" );
     842           0 :     if (pEditEngine  &&  pEditView)
     843             :     {
     844           0 :         ESelection eSelection = pEditView->GetSelection();
     845           0 :         sal_Int32 nPos = eSelection.nEndPos;
     846           0 :         sal_Int32 nCounts = pEditEngine->GetParagraphCount();
     847             : 
     848           0 :         while (eSelection.nEndPara < nCounts)
     849             :         {
     850           0 :             OUString aText = pEditEngine->GetText(eSelection.nEndPara);
     851           0 :             nPos = aText.indexOf("<?>", nPos);
     852           0 :             if (nPos != -1)
     853             :             {
     854             :                 pEditView->SetSelection(ESelection(
     855           0 :                     eSelection.nEndPara, nPos, eSelection.nEndPara, nPos + 3));
     856           0 :                 break;
     857             :             }
     858             : 
     859           0 :             nPos = 0;
     860           0 :             eSelection.nEndPara++;
     861           0 :         }
     862             :     }
     863           0 : }
     864             : 
     865           0 : void SmEditWindow::SelPrevMark()
     866             : {
     867           0 :     EditEngine *pEditEngine = GetEditEngine();
     868             :     OSL_ENSURE( pEditEngine, "NULL pointer" );
     869             :     OSL_ENSURE( pEditView, "NULL pointer" );
     870           0 :     if (pEditEngine  &&  pEditView)
     871             :     {
     872           0 :         ESelection eSelection = pEditView->GetSelection();
     873           0 :         sal_Int32 nPos = -1;
     874           0 :         sal_Int32 nMax = eSelection.nStartPos;
     875           0 :         OUString aText(pEditEngine->GetText(eSelection.nStartPara));
     876           0 :         OUString aMark("<?>");
     877           0 :         sal_Int32 nCounts = pEditEngine->GetParagraphCount();
     878             : 
     879           0 :         do
     880             :         {
     881           0 :             sal_Int32 nMarkIndex = aText.indexOf(aMark);
     882           0 :             while ((nMarkIndex < nMax) && (nMarkIndex != -1))
     883             :             {
     884           0 :                 nPos = nMarkIndex;
     885           0 :                 nMarkIndex = aText.indexOf(aMark, nMarkIndex + 1);
     886             :             }
     887             : 
     888           0 :             if (nPos == -1)
     889             :             {
     890           0 :                 eSelection.nStartPara--;
     891           0 :                 aText = pEditEngine->GetText(eSelection.nStartPara);
     892           0 :                 nMax = aText.getLength();
     893             :             }
     894             :         }
     895           0 :         while ((eSelection.nStartPara < nCounts) &&
     896             :             (nPos == -1));
     897             : 
     898           0 :         if (nPos != -1)
     899             :         {
     900             :             pEditView->SetSelection(ESelection(
     901           0 :                 eSelection.nStartPara, nPos, eSelection.nStartPara, nPos + 3));
     902           0 :         }
     903             :     }
     904           0 : }
     905             : 
     906           0 : bool SmEditWindow::HasMark(const OUString& rText) const
     907             :     // returns true iff 'rText' contains a mark
     908             : {
     909           0 :     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           0 : 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           0 :     ESelection eSel;
     934           0 :     if (pEditView)
     935           0 :         eSel = pEditView->GetSelection();
     936           0 :     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           0 : bool SmEditWindow::IsEmpty() const
     948             : {
     949           0 :     EditEngine *pEditEngine = ((SmEditWindow *) this)->GetEditEngine();
     950           0 :     bool bEmpty = ( pEditEngine ? pEditEngine->GetTextLen() == 0 : false);
     951           0 :     return bEmpty;
     952             : }
     953             : 
     954           0 : bool SmEditWindow::IsSelected() const
     955             : {
     956           0 :     return pEditView ? pEditView->HasSelection() : false;
     957             : }
     958             : 
     959             : 
     960           0 : void SmEditWindow::UpdateStatus( bool bSetDocModified )
     961             : {
     962           0 :     SmModule *pMod = SM_MOD();
     963           0 :     if (pMod && pMod->GetConfig()->IsAutoRedraw())
     964           0 :         Flush();
     965           0 :     if ( bSetDocModified )
     966           0 :         GetDoc()->SetModified(true);
     967           0 : }
     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           0 : void SmEditWindow::Delete()
     997             : {
     998             :     OSL_ENSURE( pEditView, "EditView missing" );
     999           0 :     if (pEditView)
    1000             :     {
    1001           0 :         pEditView->DeleteSelected();
    1002           0 :         UpdateStatus(true);
    1003             :     }
    1004           0 : }
    1005             : 
    1006           0 : void SmEditWindow::InsertText(const OUString& rText)
    1007             : {
    1008             :     OSL_ENSURE( pEditView, "EditView missing" );
    1009           0 :     if (pEditView)
    1010             :     {
    1011             :         // Note: Insertion of a space in front of commands is done here and
    1012             :         // in SmEditWindow::InsertCommand.
    1013           0 :         ESelection aSelection = pEditView->GetSelection();
    1014           0 :         OUString aCurrentFormula = pEditView->GetEditEngine()->GetText();
    1015           0 :         sal_Int32 nStartIndex = 0;
    1016           0 :         sal_Int32 nEndIndex = 0;
    1017             : 
    1018             :         // get the start position (when we get a multi line formula)
    1019           0 :         for (sal_Int32 nParaPos = 0; nParaPos < aSelection.nStartPara; nParaPos++)
    1020           0 :              nStartIndex = aCurrentFormula.indexOf("\n", nStartIndex) + 1;
    1021             : 
    1022           0 :         nStartIndex += aSelection.nStartPos;
    1023             : 
    1024             :         // get the end position (when we get a multi line formula)
    1025           0 :         for (sal_Int32 nParaPos = 0; nParaPos < aSelection.nEndPara; nParaPos++)
    1026           0 :              nEndIndex = aCurrentFormula.indexOf("\n", nEndIndex) + 1;
    1027             : 
    1028           0 :         nEndIndex += aSelection.nEndPos;
    1029             : 
    1030             :         // TODO: unify this function with the InsertCommand: The do the same thing for different
    1031             :         // callers
    1032           0 :         OUString string(rText);
    1033             : 
    1034             :         // put a space before a new command if not in the beginning of a line
    1035           0 :         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           0 :         pVScrollBar->Hide();
    1044           0 :         pHScrollBar->Hide();
    1045           0 :         pEditView->InsertText(string);
    1046           0 :         AdjustScrollBars();
    1047           0 :         pVScrollBar->Show();
    1048           0 :         pHScrollBar->Show();
    1049             : 
    1050             :         // Remember start of the selection and move the cursor there afterwards.
    1051           0 :         aSelection.nEndPara = aSelection.nStartPara;
    1052           0 :         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           0 :             aSelection.nEndPos = aSelection.nStartPos + string.getLength();
    1061           0 :             aSelection.nStartPos = aSelection.nEndPos;
    1062           0 :             pEditView->SetSelection(aSelection);
    1063             :         }
    1064             : 
    1065           0 :         aModifyTimer.Start();
    1066           0 :         StartCursorMove();
    1067           0 :         GrabFocus();
    1068             :     }
    1069           0 : }
    1070             : 
    1071           0 : void SmEditWindow::Flush()
    1072             : {
    1073           0 :     EditEngine *pEditEngine = GetEditEngine();
    1074           0 :     if (pEditEngine  &&  pEditEngine->IsModified())
    1075             :     {
    1076           0 :         pEditEngine->ClearModifyFlag();
    1077           0 :         SmViewShell *pViewSh = rCmdBox.GetView();
    1078           0 :         if (pViewSh)
    1079             :         {
    1080             :             pViewSh->GetViewFrame()->GetDispatcher()->Execute(
    1081             :                     SID_TEXT, SFX_CALLMODE_STANDARD,
    1082           0 :                     new SfxStringItem(SID_TEXT, GetText()), 0L);
    1083             :         }
    1084             :     }
    1085           0 :     if (aCursorMoveTimer.IsActive())
    1086             :     {
    1087           0 :         aCursorMoveTimer.Stop();
    1088           0 :         CursorMoveTimerHdl(&aCursorMoveTimer);
    1089             :     }
    1090           0 : }
    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           0 : uno::Reference< XAccessible > SmEditWindow::CreateAccessible()
    1110             : {
    1111           0 :     if (!pAccessible)
    1112             :     {
    1113           0 :         pAccessible = new SmEditAccessible( this );
    1114           0 :         xAccessible = pAccessible;
    1115           0 :         pAccessible->Init();
    1116             :     }
    1117           0 :     return xAccessible;
    1118           0 : }
    1119             : 
    1120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10