1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: edit.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <vcl/window.hxx>
34 #include <vcl/timer.hxx>
35 #include <svtools/transfer.hxx>
36 #include <svx/editdata.hxx>
37 #include <svtools/colorcfg.hxx>
39 //#ifndef _ACCESSIBILITY_HXX_
40 //#include "accessibility.hxx"
50 class DataChangedEvent
;
53 class SmEditAccessible
;
56 /**************************************************************************/
58 void SmGetLeftSelectionPart(const ESelection aSelection
,
59 USHORT
&nPara
, USHORT
&nPos
);
61 /**************************************************************************/
63 class SmEditWindow
: public Window
, public DropTargetHelper
65 ::com::sun::star::uno::Reference
<
66 ::com::sun::star::accessibility::XAccessible
> xAccessible
;
67 SmEditAccessible
* pAccessible
;
69 SmCmdBoxWindow
&rCmdBox
;
71 ScrollBar
*pHScrollBar
,
73 ScrollBarBox
*pScrollBox
;
76 ESelection aOldSelection
;
78 virtual void KeyInput(const KeyEvent
& rKEvt
);
79 virtual void Command(const CommandEvent
& rCEvt
);
80 DECL_LINK(MenuSelectHdl
, Menu
*);
81 DECL_LINK(ModifyTimerHdl
, Timer
*);
82 DECL_LINK(CursorMoveTimerHdl
, Timer
*);
84 virtual void DataChanged( const DataChangedEvent
& );
85 virtual void Resize();
86 virtual void MouseMove(const MouseEvent
&rEvt
);
87 virtual void MouseButtonUp(const MouseEvent
&rEvt
);
88 virtual void MouseButtonDown(const MouseEvent
&rEvt
);
90 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
91 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
92 virtual void Paint(const Rectangle
& rRect
);
94 DECL_LINK(EditStatusHdl
,EditStatus
*);
95 DECL_LINK(ScrollHdl
, ScrollBar
*);
97 void CreateEditView();
99 Rectangle
AdjustScrollBars();
100 void SetScrollBarRanges();
101 void InitScrollBars();
102 void InvalidateSlots();
105 SmEditWindow( SmCmdBoxWindow
&rMyCmdBoxWin
);
108 SmDocShell
* GetDoc();
109 SmViewShell
* GetView();
110 EditView
* GetEditView() { return pEditView
; }
111 EditEngine
* GetEditEngine();
112 SfxItemPool
* GetEditEngineItemPool();
115 virtual void SetText(const XubString
&rText
);
116 virtual String
GetText() const;
117 virtual void GetFocus();
118 virtual void LoseFocus();
120 ESelection
GetSelection() const;
121 void SetSelection(const ESelection
&rSel
);
123 BOOL
IsEmpty() const;
124 BOOL
IsSelected() const;
125 BOOL
IsAllSelected() const;
131 void InsertText(const String
&rText
);
132 void InsertCommand(USHORT nCommand
);
133 void MarkError(const Point
&rPos
);
136 BOOL
HasMark(const String
&rText
) const;
139 void DeleteEditView( SmViewShell
&rView
);
141 void ApplyColorConfigValues( const svtools::ColorConfig
&rColorCfg
);
143 BOOL
HandleWheelCommands( const CommandEvent
&rCEvt
);
146 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> CreateAccessible();
148 using Window::GetAccessible
;
149 SmEditAccessible
* GetAccessible() { return pAccessible
; }