merge the formfield patch from ooo-build
[ooovba.git] / sw / source / ui / inc / edtwin.hxx
blob467cbe70230ce101b1facb1037a3c9461e93cd3e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: edtwin.hxx,v $
10 * $Revision: 1.32 $
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 ************************************************************************/
30 #ifndef _EDTWIN_HXX
31 #define _EDTWIN_HXX
33 #include <svx/svdobj.hxx>
34 #include <tools/link.hxx>
35 #include <vcl/timer.hxx>
36 #include <vcl/window.hxx>
37 #include <svtools/transfer.hxx>
38 #include <swevent.hxx>
40 #define _SVSTDARR_STRINGSISORTDTOR
41 #include <svtools/svstdarr.hxx>
43 class SwWrtShell;
44 class SwView;
45 class SwRect;
46 class ViewShell;
47 class SwAnchorMarker;
48 class SdrObject;
49 class SwShadowCursor;
50 class DataChangedEvent;
51 class SvxAutoCorrCfg;
52 class SvxAutoCorrect;
53 class SwPaM;
54 struct SwApplyTemplate;
55 struct QuickHelpData;
56 class SdrDropMarkerOverlay;
58 /*--------------------------------------------------------------------
59 Beschreibung: Eingabe-Fenster
60 --------------------------------------------------------------------*/
62 class SwEditWin: public Window,
63 public DropTargetHelper, public DragSourceHelper
65 friend void ScrollMDI(ViewShell* pVwSh, const SwRect&,
66 USHORT nRangeX, USHORT nRangeY);
67 friend BOOL IsScrollMDI(ViewShell* pVwSh, const SwRect&);
69 friend void SizeNotify(ViewShell* pVwSh, const Size &);
71 friend void PageNumNotify( ViewShell* pVwSh,
72 USHORT nPhyNum,
73 USHORT nVirtNum,
74 const String& rPg );
76 static QuickHelpData* pQuickHlpData;
78 static BOOL bReplaceQuote;
79 static long nDDStartPosX, nDDStartPosY;
81 static Color aTextColor; //Textfarbe, fuer die Giesskanne
82 static BOOL bTransparentBackColor; // Hintergrund transparent
83 static Color aTextBackColor; //Texthintergrundfarbe, fuer die Giesskanne
86 * Timer und Handler fuer das Weiterscrollen, wenn der
87 * Mauspointer innerhalb eines Drag-Vorgangs ausserhalb des
88 * EditWin stehen bleibt. In regelmaessigen Intervallen wird
89 * die Selektion in Richtung der Mausposition vergroessert.
91 AutoTimer aTimer;
92 // Timer fuer verschachtelte KeyInputs (z.B. fuer Tabellen)
93 Timer aKeyInputTimer;
94 // timer for ANY-KeyInut question without a following KeyInputEvent
95 Timer aKeyInputFlushTimer;
97 String aInBuffer;
98 LanguageType eBufferLanguage;
99 Point aStartPos;
100 Point aMovePos;
101 Point aRszMvHdlPt;
102 Timer aTemplateTimer;
104 // Type/Objecte ueber dem der MousePointer steht
105 SwCallMouseEvent aSaveCallEvent;
107 SwApplyTemplate *pApplyTempl;
108 SwAnchorMarker *pAnchorMarker; // zum Verschieben eines Ankers
110 SdrDropMarkerOverlay *pUserMarker;
111 SdrObject *pUserMarkerObj;
112 SwShadowCursor *pShadCrsr;
113 Point *pRowColumnSelectionStart; // save position where table row/column selection has been started
115 SwView &rView;
117 int aActHitType; // aktueller Mauspointer
119 ULONG m_nDropFormat; //Format aus dem letzten QueryDrop
120 USHORT m_nDropAction; //Action aus dem letzten QueryDrop
121 USHORT m_nDropDestination; //Ziel aus dem letzten QueryDrop
123 UINT16 eBezierMode;
124 UINT16 nInsFrmColCount; //Spaltenzahl fuer interaktiven Rahmen
125 SdrObjKind eDrawMode;
126 BOOL bLinkRemoved : 1,
127 bMBPressed : 1,
128 bInsDraw : 1,
129 bInsFrm : 1,
130 bIsInMove : 1,
131 bIsInDrag : 1, //StartExecuteDrag nich doppelt ausfuehren
132 bOldIdle : 1, //Zum abschalten des Idle'ns
133 bOldIdleSet : 1, //waehrend QeueryDrop
134 bTblInsDelMode : 1, //
135 bTblIsInsMode : 1, //
136 bTblIsColMode : 1, //
137 bChainMode : 1, //Rahmen verbinden
138 bWasShdwCrsr : 1, //ShadowCrsr war im MouseButtonDown an
139 bLockInput : 1, //Lock waehrend die Rechenleiste aktiv ist
140 bIsRowDrag : 1, //selection of rows is used, in combination with pRowColumnSelectionStart
141 /** #i42732# display status of font size/name depending on either the input language or the
142 selection position depending on what has changed lately
144 bUseInputLanguage: 1,
145 bObjectSelect : 1;
148 USHORT nKS_NUMDOWN_Count; // #i23725#
149 USHORT nKS_NUMINDENTINC_Count;
151 void LeaveArea(const Point &);
152 void JustifyAreaTimer();
153 inline void EnterArea();
155 void RstMBDownFlags();
157 void ChangeFly( BYTE nDir, BOOL bWeb = FALSE );
158 void ChangeDrawing( BYTE nDir );
160 BOOL EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos);
161 BOOL RulerColumnDrag( const MouseEvent& rMEvt, BOOL bVerticalMode);
163 //Hilfsfunktionen fuer D&D
164 void DropCleanup();
165 void CleanupDropUserMarker();
166 USHORT GetDropDestination( const Point& rPixPnt,
167 SdrObject ** ppObj = 0 );
168 //select the object/cursor at the mouse position of the context menu request
169 BOOL SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos );
172 * Handler fuer das Weiterscrollen, wenn der Mauspointer innerhalb eines
173 * Drag-Vorgangs ausserhalb des EditWin stehen bleibt. In regelmaessigen
174 * Intervallen wird die Selektion in Richtung der Mausposition
175 * vergroessert.
177 DECL_LINK( TimerHandler, Timer * );
178 void StartDDTimer();
179 void StopDDTimer(SwWrtShell *, const Point &);
180 DECL_LINK( DDHandler, Timer * );
182 // timer for ANY-KeyInut question without a following KeyInputEvent
183 DECL_LINK( KeyInputFlushHandler, Timer * );
185 // Timer fuer verschachtelte KeyInputs (z.B. fuer Tabellen)
186 DECL_LINK( KeyInputTimerHandler, Timer * );
188 // Timer fuer das ApplyTemplates per Maus (verkapptes Drag&Drop)
189 DECL_LINK( TemplateTimerHdl, Timer* );
191 using OutputDevice::GetTextColor;
193 protected:
195 virtual void DataChanged( const DataChangedEvent& );
196 virtual void PrePaint();
197 virtual void Paint( const Rectangle& rRect );
198 virtual void KeyInput(const KeyEvent &rKEvt);
200 virtual void GetFocus();
201 virtual void LoseFocus();
204 virtual void MouseMove(const MouseEvent& rMEvt);
205 virtual void MouseButtonDown(const MouseEvent& rMEvt);
206 virtual void MouseButtonUp(const MouseEvent& rMEvt);
207 virtual void RequestHelp(const HelpEvent& rEvt);
209 virtual void Command( const CommandEvent& rCEvt );
211 // Drag & Drop Interface
212 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
213 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
214 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
216 virtual XubString GetSurroundingText() const;
217 virtual Selection GetSurroundingTextSelection() const;
219 void ShowAutoTextCorrectQuickHelp( const String& rWord, SvxAutoCorrCfg* pACfg,
220 SvxAutoCorrect* pACorr, sal_Bool bFromIME = sal_False );
221 public:
223 void UpdatePointer(const Point &, USHORT nButtons = 0);
225 BOOL IsDrawSelMode();
226 BOOL IsDrawAction() { return (bInsDraw); }
227 void SetDrawAction(BOOL bFlag) { bInsDraw = bFlag; }
229 void SetObjectSelect( BOOL bVal ) { bObjectSelect = bVal; }
230 BOOL IsObjectSelect() const { return bObjectSelect; }
232 inline SdrObjKind GetSdrDrawMode(/*BOOL bBuf = FALSE*/) const { return eDrawMode; }
233 inline void SetSdrDrawMode( SdrObjKind eSdrObjectKind ) { eDrawMode = eSdrObjectKind; SetObjectSelect( FALSE ); }
234 void StdDrawMode( SdrObjKind eSdrObjectKind, BOOL bObjSelect );
236 BOOL IsFrmAction() { return (bInsFrm); }
237 inline UINT16 GetBezierMode() { return eBezierMode; }
238 void SetBezierMode(UINT16 eBezMode) { eBezierMode = eBezMode; }
239 void EnterDrawTextMode(const Point& aDocPos); // DrawTextEditMode einschalten
240 void InsFrm(USHORT nCols);
241 void StopInsFrm();
242 UINT16 GetFrmColCount() const {return nInsFrmColCount;} //Spaltenzahl fuer interaktiven Rahmen
245 void SetChainMode( BOOL bOn );
246 BOOL IsChainMode() const { return bChainMode; }
248 void FlushInBuffer();
249 BOOL IsInputSequenceCheckingRequired( const String &rText, const SwPaM& rCrsr ) const;
252 static void SetReplaceQuote(BOOL bOn = TRUE) { bReplaceQuote = bOn; }
253 static BOOL IsReplaceQuote() { return bReplaceQuote; }
255 void SetApplyTemplate(const SwApplyTemplate &);
256 SwApplyTemplate* GetApplyTemplate() const { return pApplyTempl; }
258 void StartExecuteDrag();
259 void DragFinished();
260 USHORT GetDropAction() const { return m_nDropAction; }
261 ULONG GetDropFormat() const { return m_nDropFormat; }
263 Color GetTextColor() { return aTextColor; }
265 void SetTextColor(const Color& rCol ) { aTextColor = rCol; }
267 Color GetTextBackColor()
268 { return aTextBackColor; }
269 void SetTextBackColor(const Color& rCol )
270 { aTextBackColor = rCol; }
271 void SetTextBackColorTransparent(BOOL bSet)
272 { bTransparentBackColor = bSet; }
273 BOOL IsTextBackColorTransparent()
274 { return bTransparentBackColor; }
275 void LockKeyInput(BOOL bSet){bLockInput = bSet;}
277 const SwView &GetView() const { return rView; }
278 SwView &GetView() { return rView; }
280 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
282 // Tipfenster loeschen
283 static void ClearTip();
285 static inline long GetDDStartPosX() { return nDDStartPosX; }
286 static inline long GetDDStartPosY() { return nDDStartPosY; }
288 static void _InitStaticData();
289 static void _FinitStaticData();
291 //#i3370# remove quick help to prevent saving of autocorrection suggestions
292 void StopQuickHelp();
294 // --> OD 2005-02-18 #i42921# - add parameter <bVerticalMode>
295 BOOL RulerMarginDrag( const MouseEvent& rMEvt,
296 const bool bVerticalMode );
297 // <--
299 /** #i42732# display status of font size/name depending on either the input
300 language or the selection position depending on what has changed lately
302 void SetUseInputLanguage( sal_Bool bNew );
303 sal_Bool IsUseInputLanguage() const { return bUseInputLanguage; }
305 SwEditWin(Window *pParent, SwView &);
306 virtual ~SwEditWin();
309 #endif