1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef EDIT_HXX 28*cdf0e10cSrcweir #define EDIT_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <vcl/window.hxx> 31*cdf0e10cSrcweir #include <vcl/timer.hxx> 32*cdf0e10cSrcweir #include <svtools/transfer.hxx> 33*cdf0e10cSrcweir #include <editeng/editdata.hxx> 34*cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir //#ifndef _ACCESSIBILITY_HXX_ 37*cdf0e10cSrcweir //#include "accessibility.hxx" 38*cdf0e10cSrcweir //#endif 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir class SmDocShell; 41*cdf0e10cSrcweir class SmViewShell; 42*cdf0e10cSrcweir class EditView; 43*cdf0e10cSrcweir class EditEngine; 44*cdf0e10cSrcweir class EditStatus; 45*cdf0e10cSrcweir class ScrollBar; 46*cdf0e10cSrcweir class ScrollBarBox; 47*cdf0e10cSrcweir class DataChangedEvent; 48*cdf0e10cSrcweir class Menu; 49*cdf0e10cSrcweir class SmCmdBoxWindow; 50*cdf0e10cSrcweir class SmEditAccessible; 51*cdf0e10cSrcweir class CommandEvent; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir /**************************************************************************/ 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir void SmGetLeftSelectionPart(const ESelection aSelection, 56*cdf0e10cSrcweir sal_uInt16 &nPara, sal_uInt16 &nPos); 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir /**************************************************************************/ 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir class SmEditWindow : public Window, public DropTargetHelper 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir ::com::sun::star::uno::Reference< 63*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible > xAccessible; 64*cdf0e10cSrcweir SmEditAccessible * pAccessible; 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir SmCmdBoxWindow &rCmdBox; 67*cdf0e10cSrcweir EditView *pEditView; 68*cdf0e10cSrcweir ScrollBar *pHScrollBar, 69*cdf0e10cSrcweir *pVScrollBar; 70*cdf0e10cSrcweir ScrollBarBox *pScrollBox; 71*cdf0e10cSrcweir Timer aModifyTimer, 72*cdf0e10cSrcweir aCursorMoveTimer; 73*cdf0e10cSrcweir ESelection aOldSelection; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir virtual void KeyInput(const KeyEvent& rKEvt); 76*cdf0e10cSrcweir virtual void Command(const CommandEvent& rCEvt); 77*cdf0e10cSrcweir DECL_LINK(MenuSelectHdl, Menu *); 78*cdf0e10cSrcweir DECL_LINK(ModifyTimerHdl, Timer *); 79*cdf0e10cSrcweir DECL_LINK(CursorMoveTimerHdl, Timer *); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& ); 82*cdf0e10cSrcweir virtual void Resize(); 83*cdf0e10cSrcweir virtual void MouseMove(const MouseEvent &rEvt); 84*cdf0e10cSrcweir virtual void MouseButtonUp(const MouseEvent &rEvt); 85*cdf0e10cSrcweir virtual void MouseButtonDown(const MouseEvent &rEvt); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 88*cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 89*cdf0e10cSrcweir virtual void Paint(const Rectangle& rRect); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir DECL_LINK(EditStatusHdl ,EditStatus *); 92*cdf0e10cSrcweir DECL_LINK(ScrollHdl, ScrollBar *); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir void CreateEditView(); 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir Rectangle AdjustScrollBars(); 97*cdf0e10cSrcweir void SetScrollBarRanges(); 98*cdf0e10cSrcweir void InitScrollBars(); 99*cdf0e10cSrcweir void InvalidateSlots(); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir public: 102*cdf0e10cSrcweir SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ); 103*cdf0e10cSrcweir ~SmEditWindow(); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir SmDocShell * GetDoc(); 106*cdf0e10cSrcweir SmViewShell * GetView(); 107*cdf0e10cSrcweir EditView * GetEditView() { return pEditView; } 108*cdf0e10cSrcweir EditEngine * GetEditEngine(); 109*cdf0e10cSrcweir SfxItemPool * GetEditEngineItemPool(); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir // Window 112*cdf0e10cSrcweir virtual void SetText(const XubString &rText); 113*cdf0e10cSrcweir virtual String GetText() const; 114*cdf0e10cSrcweir virtual void GetFocus(); 115*cdf0e10cSrcweir virtual void LoseFocus(); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir ESelection GetSelection() const; 118*cdf0e10cSrcweir void SetSelection(const ESelection &rSel); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir sal_Bool IsEmpty() const; 121*cdf0e10cSrcweir sal_Bool IsSelected() const; 122*cdf0e10cSrcweir sal_Bool IsAllSelected() const; 123*cdf0e10cSrcweir void Cut(); 124*cdf0e10cSrcweir void Copy(); 125*cdf0e10cSrcweir void Paste(); 126*cdf0e10cSrcweir void Delete(); 127*cdf0e10cSrcweir void SelectAll(); 128*cdf0e10cSrcweir void InsertText(const String &rText); 129*cdf0e10cSrcweir void InsertCommand(sal_uInt16 nCommand); 130*cdf0e10cSrcweir void MarkError(const Point &rPos); 131*cdf0e10cSrcweir void SelNextMark(); 132*cdf0e10cSrcweir void SelPrevMark(); 133*cdf0e10cSrcweir sal_Bool HasMark(const String &rText) const; 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir void Flush(); 136*cdf0e10cSrcweir void DeleteEditView( SmViewShell &rView ); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg ); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir sal_Bool HandleWheelCommands( const CommandEvent &rCEvt ); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir // for Accessibility 143*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir using Window::GetAccessible; 146*cdf0e10cSrcweir SmEditAccessible * GetAccessible() { return pAccessible; } 147*cdf0e10cSrcweir }; 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir #endif 151*cdf0e10cSrcweir 152