1*f6a9d5caSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6a9d5caSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6a9d5caSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6a9d5caSAndrew Rist * distributed with this work for additional information 6*f6a9d5caSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6a9d5caSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6a9d5caSAndrew Rist * "License"); you may not use this file except in compliance 9*f6a9d5caSAndrew Rist * with the License. You may obtain a copy of the License at 10*f6a9d5caSAndrew Rist * 11*f6a9d5caSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f6a9d5caSAndrew Rist * 13*f6a9d5caSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6a9d5caSAndrew Rist * software distributed under the License is distributed on an 15*f6a9d5caSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6a9d5caSAndrew Rist * KIND, either express or implied. See the License for the 17*f6a9d5caSAndrew Rist * specific language governing permissions and limitations 18*f6a9d5caSAndrew Rist * under the License. 19*f6a9d5caSAndrew Rist * 20*f6a9d5caSAndrew Rist *************************************************************/ 21*f6a9d5caSAndrew Rist 22*f6a9d5caSAndrew Rist 23cdf0e10cSrcweir #ifndef EDIT_HXX 24cdf0e10cSrcweir #define EDIT_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <vcl/window.hxx> 27cdf0e10cSrcweir #include <vcl/timer.hxx> 28cdf0e10cSrcweir #include <svtools/transfer.hxx> 29cdf0e10cSrcweir #include <editeng/editdata.hxx> 30cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir //#ifndef _ACCESSIBILITY_HXX_ 33cdf0e10cSrcweir //#include "accessibility.hxx" 34cdf0e10cSrcweir //#endif 35cdf0e10cSrcweir 36cdf0e10cSrcweir class SmDocShell; 37cdf0e10cSrcweir class SmViewShell; 38cdf0e10cSrcweir class EditView; 39cdf0e10cSrcweir class EditEngine; 40cdf0e10cSrcweir class EditStatus; 41cdf0e10cSrcweir class ScrollBar; 42cdf0e10cSrcweir class ScrollBarBox; 43cdf0e10cSrcweir class DataChangedEvent; 44cdf0e10cSrcweir class Menu; 45cdf0e10cSrcweir class SmCmdBoxWindow; 46cdf0e10cSrcweir class SmEditAccessible; 47cdf0e10cSrcweir class CommandEvent; 48cdf0e10cSrcweir 49cdf0e10cSrcweir /**************************************************************************/ 50cdf0e10cSrcweir 51cdf0e10cSrcweir void SmGetLeftSelectionPart(const ESelection aSelection, 52cdf0e10cSrcweir sal_uInt16 &nPara, sal_uInt16 &nPos); 53cdf0e10cSrcweir 54cdf0e10cSrcweir /**************************************************************************/ 55cdf0e10cSrcweir 56cdf0e10cSrcweir class SmEditWindow : public Window, public DropTargetHelper 57cdf0e10cSrcweir { 58cdf0e10cSrcweir ::com::sun::star::uno::Reference< 59cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible > xAccessible; 60cdf0e10cSrcweir SmEditAccessible * pAccessible; 61cdf0e10cSrcweir 62cdf0e10cSrcweir SmCmdBoxWindow &rCmdBox; 63cdf0e10cSrcweir EditView *pEditView; 64cdf0e10cSrcweir ScrollBar *pHScrollBar, 65cdf0e10cSrcweir *pVScrollBar; 66cdf0e10cSrcweir ScrollBarBox *pScrollBox; 67cdf0e10cSrcweir Timer aModifyTimer, 68cdf0e10cSrcweir aCursorMoveTimer; 69cdf0e10cSrcweir ESelection aOldSelection; 70cdf0e10cSrcweir 71cdf0e10cSrcweir virtual void KeyInput(const KeyEvent& rKEvt); 72cdf0e10cSrcweir virtual void Command(const CommandEvent& rCEvt); 73cdf0e10cSrcweir DECL_LINK(MenuSelectHdl, Menu *); 74cdf0e10cSrcweir DECL_LINK(ModifyTimerHdl, Timer *); 75cdf0e10cSrcweir DECL_LINK(CursorMoveTimerHdl, Timer *); 76cdf0e10cSrcweir 77cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& ); 78cdf0e10cSrcweir virtual void Resize(); 79cdf0e10cSrcweir virtual void MouseMove(const MouseEvent &rEvt); 80cdf0e10cSrcweir virtual void MouseButtonUp(const MouseEvent &rEvt); 81cdf0e10cSrcweir virtual void MouseButtonDown(const MouseEvent &rEvt); 82cdf0e10cSrcweir 83cdf0e10cSrcweir virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 84cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 85cdf0e10cSrcweir virtual void Paint(const Rectangle& rRect); 86cdf0e10cSrcweir 87cdf0e10cSrcweir DECL_LINK(EditStatusHdl ,EditStatus *); 88cdf0e10cSrcweir DECL_LINK(ScrollHdl, ScrollBar *); 89cdf0e10cSrcweir 90cdf0e10cSrcweir void CreateEditView(); 91cdf0e10cSrcweir 92cdf0e10cSrcweir Rectangle AdjustScrollBars(); 93cdf0e10cSrcweir void SetScrollBarRanges(); 94cdf0e10cSrcweir void InitScrollBars(); 95cdf0e10cSrcweir void InvalidateSlots(); 96cdf0e10cSrcweir 97cdf0e10cSrcweir public: 98cdf0e10cSrcweir SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ); 99cdf0e10cSrcweir ~SmEditWindow(); 100cdf0e10cSrcweir 101cdf0e10cSrcweir SmDocShell * GetDoc(); 102cdf0e10cSrcweir SmViewShell * GetView(); 103cdf0e10cSrcweir EditView * GetEditView() { return pEditView; } 104cdf0e10cSrcweir EditEngine * GetEditEngine(); 105cdf0e10cSrcweir SfxItemPool * GetEditEngineItemPool(); 106cdf0e10cSrcweir 107cdf0e10cSrcweir // Window 108cdf0e10cSrcweir virtual void SetText(const XubString &rText); 109cdf0e10cSrcweir virtual String GetText() const; 110cdf0e10cSrcweir virtual void GetFocus(); 111cdf0e10cSrcweir virtual void LoseFocus(); 112cdf0e10cSrcweir 113cdf0e10cSrcweir ESelection GetSelection() const; 114cdf0e10cSrcweir void SetSelection(const ESelection &rSel); 115cdf0e10cSrcweir 116cdf0e10cSrcweir sal_Bool IsEmpty() const; 117cdf0e10cSrcweir sal_Bool IsSelected() const; 118cdf0e10cSrcweir sal_Bool IsAllSelected() const; 119cdf0e10cSrcweir void Cut(); 120cdf0e10cSrcweir void Copy(); 121cdf0e10cSrcweir void Paste(); 122cdf0e10cSrcweir void Delete(); 123cdf0e10cSrcweir void SelectAll(); 124cdf0e10cSrcweir void InsertText(const String &rText); 125cdf0e10cSrcweir void InsertCommand(sal_uInt16 nCommand); 126cdf0e10cSrcweir void MarkError(const Point &rPos); 127cdf0e10cSrcweir void SelNextMark(); 128cdf0e10cSrcweir void SelPrevMark(); 129cdf0e10cSrcweir sal_Bool HasMark(const String &rText) const; 130cdf0e10cSrcweir 131cdf0e10cSrcweir void Flush(); 132cdf0e10cSrcweir void DeleteEditView( SmViewShell &rView ); 133cdf0e10cSrcweir 134cdf0e10cSrcweir void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg ); 135cdf0e10cSrcweir 136cdf0e10cSrcweir sal_Bool HandleWheelCommands( const CommandEvent &rCEvt ); 137cdf0e10cSrcweir 138cdf0e10cSrcweir // for Accessibility 139cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); 140cdf0e10cSrcweir 141cdf0e10cSrcweir using Window::GetAccessible; 142cdf0e10cSrcweir SmEditAccessible * GetAccessible() { return pAccessible; } 143cdf0e10cSrcweir }; 144cdf0e10cSrcweir 145cdf0e10cSrcweir 146cdf0e10cSrcweir #endif 147cdf0e10cSrcweir 148