xref: /aoo41x/main/sw/source/ui/inc/edtwin.hxx (revision 4d7c9de0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _EDTWIN_HXX
24 #define _EDTWIN_HXX
25 
26 #include <svx/svdobj.hxx>
27 #include <tools/link.hxx>
28 #include <vcl/timer.hxx>
29 #include <vcl/window.hxx>
30 #include <svtools/transfer.hxx>
31 #include <swevent.hxx>
32 
33 #define _SVSTDARR_STRINGSISORTDTOR
34 #include <svl/svstdarr.hxx>
35 
36 class	SwWrtShell;
37 class 	SwView;
38 class 	SwRect;
39 class	ViewShell;
40 class	SwAnchorMarker;
41 class	SdrObject;
42 class	SwShadowCursor;
43 class	DataChangedEvent;
44 class   SvxAutoCorrCfg;
45 class   SvxAutoCorrect;
46 class   SwPaM;
47 struct	SwApplyTemplate;
48 struct 	QuickHelpData;
49 class SdrDropMarkerOverlay;
50 
51 /*--------------------------------------------------------------------
52 	Beschreibung:	Eingabe-Fenster
53  --------------------------------------------------------------------*/
54 
55 class SwEditWin: public Window,
56 				public DropTargetHelper, public DragSourceHelper
57 {
58 friend void 	ScrollMDI(ViewShell* pVwSh, const SwRect&,
59 						  sal_uInt16 nRangeX, sal_uInt16 nRangeY);
60 friend sal_Bool 	IsScrollMDI(ViewShell* pVwSh, const SwRect&);
61 
62 friend void 	SizeNotify(ViewShell* pVwSh, const Size &);
63 
64 friend void 	PageNumNotify( 	ViewShell* pVwSh,
65 								sal_uInt16 nPhyNum,
66 								sal_uInt16 nVirtNum,
67 								const String& rPg );
68 
69 	static  QuickHelpData* pQuickHlpData;
70 
71 	static	sal_Bool	bReplaceQuote;
72 	static	long 	nDDStartPosX, nDDStartPosY;
73 
74 	static 	Color	aTextColor; 	//Textfarbe, fuer die Giesskanne
75 	static 	sal_Bool	bTransparentBackColor; // Hintergrund transparent
76 	static 	Color	aTextBackColor; //Texthintergrundfarbe, fuer die Giesskanne
77 
78 	/*
79 	 * Timer und Handler fuer das Weiterscrollen, wenn der
80 	 * Mauspointer innerhalb eines Drag-Vorgangs ausserhalb des
81 	 * EditWin stehen bleibt.  In regelmaessigen Intervallen wird
82 	 * die Selektion in Richtung der Mausposition vergroessert.
83 	 */
84 	AutoTimer 		aTimer;
85 	// Timer fuer verschachtelte KeyInputs (z.B. fuer Tabellen)
86 	Timer 			aKeyInputTimer;
87 	// timer for ANY-KeyInut question without a following KeyInputEvent
88 	Timer 			aKeyInputFlushTimer;
89 
90 	String			aInBuffer;
91     LanguageType    eBufferLanguage;
92 	Point			aStartPos;
93 	Point			aMovePos;
94 	Point			aRszMvHdlPt;
95 	Timer 			aTemplateTimer;
96 
97 	// Type/Objecte ueber dem der MousePointer steht
98 	SwCallMouseEvent aSaveCallEvent;
99 
100 	SwApplyTemplate 	*pApplyTempl;
101 	SwAnchorMarker		*pAnchorMarker; // zum Verschieben eines Ankers
102 
103 	SdrDropMarkerOverlay	*pUserMarker;
104 	SdrObject				*pUserMarkerObj;
105 	SwShadowCursor			*pShadCrsr;
106     Point					*pRowColumnSelectionStart; // save position where table row/column selection has been started
107 
108 	SwView		   &rView;
109 
110 	int		 		aActHitType;	// aktueller Mauspointer
111 
112     sal_uLong           m_nDropFormat;   //Format aus dem letzten QueryDrop
113     sal_uInt16          m_nDropAction;   //Action aus dem letzten QueryDrop
114     sal_uInt16          m_nDropDestination;  //Ziel aus dem letzten QueryDrop
115 
116 	sal_uInt16			eBezierMode;
117 	sal_uInt16			nInsFrmColCount; //Spaltenzahl fuer interaktiven Rahmen
118 	SdrObjKind		eDrawMode;
119 	sal_Bool			bLinkRemoved	: 1,
120 					bMBPressed		: 1,
121 					bInsDraw 		: 1,
122 					bInsFrm 		: 1,
123 					bIsInMove		: 1,
124 					bIsInDrag		: 1, //StartExecuteDrag nich doppelt ausfuehren
125 					bOldIdle		: 1, //Zum abschalten des Idle'ns
126 					bOldIdleSet		: 1, //waehrend QeueryDrop
127 					bTblInsDelMode	: 1, //
128 					bTblIsInsMode	: 1, //
129 					bTblIsColMode	: 1, //
130 					bChainMode		: 1, //Rahmen verbinden
131 					bWasShdwCrsr	: 1, //ShadowCrsr war im MouseButtonDown an
132                     bLockInput      : 1, //Lock waehrend die Rechenleiste aktiv ist
133                     bIsRowDrag      : 1, //selection of rows is used, in combination with pRowColumnSelectionStart
134                     /** #i42732# display status of font size/name depending on either the input language or the
135                         selection position depending on what has changed lately
136                      */
137                     bUseInputLanguage: 1,
138 					bObjectSelect	: 1;
139 
140 
141     sal_uInt16          nKS_NUMDOWN_Count; // #i23725#
142     sal_uInt16          nKS_NUMINDENTINC_Count;
143 
144 	void			LeaveArea(const Point &);
145 	void			JustifyAreaTimer();
146 	inline void		EnterArea();
147 
148 	void			RstMBDownFlags();
149 
150 	void			ChangeFly( sal_uInt8 nDir, sal_Bool bWeb = sal_False );
151     void            ChangeDrawing( sal_uInt8 nDir );
152 
153 	sal_Bool			EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos);
154     sal_Bool            RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode);
155 
156 	//Hilfsfunktionen fuer D&D
157 	void			DropCleanup();
158 	void			CleanupDropUserMarker();
159 	sal_uInt16			GetDropDestination( const Point& rPixPnt,
160 										SdrObject ** ppObj = 0 );
161     //select the object/cursor at the mouse position of the context menu request
162     sal_Bool            SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos );
163 
164 	/*
165 	 * Handler fuer das Weiterscrollen, wenn der Mauspointer innerhalb eines
166 	 * Drag-Vorgangs ausserhalb des EditWin stehen bleibt. In regelmaessigen
167 	 * Intervallen wird die Selektion in Richtung der Mausposition
168 	 * vergroessert.
169 	 */
170 	DECL_LINK( TimerHandler, Timer * );
171 	void			StartDDTimer();
172 	void			StopDDTimer(SwWrtShell *, const Point &);
173 	DECL_LINK( DDHandler, Timer * );
174 
175 	// timer for ANY-KeyInut question without a following KeyInputEvent
176 	DECL_LINK( KeyInputFlushHandler, Timer * );
177 
178 	// Timer fuer verschachtelte KeyInputs (z.B. fuer Tabellen)
179 	DECL_LINK( KeyInputTimerHandler, Timer * );
180 
181 	// Timer fuer das ApplyTemplates per Maus (verkapptes Drag&Drop)
182 	DECL_LINK( TemplateTimerHdl, Timer* );
183 
184     using OutputDevice::GetTextColor;
185 
186 protected:
187 
188 	virtual void	DataChanged( const DataChangedEvent& );
189 	virtual void	PrePaint();
190 	virtual void	Paint( const Rectangle& rRect );
191 	virtual void 	KeyInput(const KeyEvent &rKEvt);
192 
193 	virtual void 	GetFocus();
194 	virtual void 	LoseFocus();
195 
196 
197 	virtual void 	MouseMove(const MouseEvent& rMEvt);
198 	virtual void 	MouseButtonDown(const MouseEvent& rMEvt);
199 	virtual void 	MouseButtonUp(const MouseEvent& rMEvt);
200 	virtual void	RequestHelp(const HelpEvent& rEvt);
201 
202 	virtual void	Command( const CommandEvent& rCEvt );
203 
204 								// Drag & Drop Interface
205 	virtual sal_Int8 	AcceptDrop( const AcceptDropEvent& rEvt );
206 	virtual sal_Int8 	ExecuteDrop( const ExecuteDropEvent& rEvt );
207 	virtual void		StartDrag( sal_Int8 nAction, const Point& rPosPixel );
208 
209     virtual XubString GetSurroundingText() const;
210     virtual Selection GetSurroundingTextSelection() const;
211 
212     void    ShowAutoTextCorrectQuickHelp( const String& rWord, SvxAutoCorrCfg* pACfg,
213                                 SvxAutoCorrect* pACorr, sal_Bool bFromIME = sal_False );
214 public:
215 
216 	void			UpdatePointer(const Point &, sal_uInt16 nButtons = 0);
217 
218 	sal_Bool			IsDrawSelMode();
IsDrawAction()219 	sal_Bool			IsDrawAction() 					{ return (bInsDraw); }
SetDrawAction(sal_Bool bFlag)220 	void			SetDrawAction(sal_Bool bFlag) 		{ bInsDraw = bFlag; }
221 
SetObjectSelect(sal_Bool bVal)222 	void			SetObjectSelect( sal_Bool bVal )	{ bObjectSelect = bVal; }
IsObjectSelect() const223 	sal_Bool			IsObjectSelect() const			{ return bObjectSelect; }
224 
GetSdrDrawMode() const225 	inline SdrObjKind	GetSdrDrawMode(/*sal_Bool bBuf = sal_False*/) const { return eDrawMode; }
SetSdrDrawMode(SdrObjKind eSdrObjectKind)226 	inline void			SetSdrDrawMode( SdrObjKind eSdrObjectKind )	{ eDrawMode = eSdrObjectKind; SetObjectSelect( sal_False ); }
227 	void				StdDrawMode( SdrObjKind eSdrObjectKind, sal_Bool bObjSelect );
228 
IsFrmAction()229 	sal_Bool			IsFrmAction() 					{ return (bInsFrm); }
GetBezierMode()230 	inline sal_uInt16	GetBezierMode() 				{ return eBezierMode; }
SetBezierMode(sal_uInt16 eBezMode)231 	void			SetBezierMode(sal_uInt16 eBezMode)	{ eBezierMode = eBezMode; }
232 	void			EnterDrawTextMode(const Point& aDocPos); // DrawTextEditMode einschalten
233 	void			InsFrm(sal_uInt16 nCols);
234 	void 			StopInsFrm();
GetFrmColCount() const235 	sal_uInt16			GetFrmColCount() const {return nInsFrmColCount;} //Spaltenzahl fuer interaktiven Rahmen
236 
237 
238 	void			SetChainMode( sal_Bool bOn );
IsChainMode() const239 	sal_Bool			IsChainMode() const				{ return bChainMode; }
240 
241     void            FlushInBuffer();
242     sal_Bool            IsInputSequenceCheckingRequired( const String &rText, const SwPaM& rCrsr ) const;
243 
244 
SetReplaceQuote(sal_Bool bOn=sal_True)245 	static	void 	SetReplaceQuote(sal_Bool bOn = sal_True) { bReplaceQuote = bOn; }
IsReplaceQuote()246 	static	sal_Bool 	IsReplaceQuote() { return bReplaceQuote; }
247 
248 	void 			 SetApplyTemplate(const SwApplyTemplate &);
GetApplyTemplate() const249 	SwApplyTemplate* GetApplyTemplate() const { return pApplyTempl; }
250 
251 	void			StartExecuteDrag();
252 	void			DragFinished();
GetDropAction() const253     sal_uInt16          GetDropAction() const { return m_nDropAction; }
GetDropFormat() const254     sal_uLong           GetDropFormat() const { return m_nDropFormat; }
255 
GetTextColor()256 	Color 			GetTextColor() { return aTextColor; }
257 
SetTextColor(const Color & rCol)258 	void 			SetTextColor(const Color& rCol ) { aTextColor = rCol; }
259 
GetTextBackColor()260 	Color 			GetTextBackColor()
261 											{ return aTextBackColor; }
SetTextBackColor(const Color & rCol)262 	void 			SetTextBackColor(const Color& rCol )
263 											{ aTextBackColor = rCol; }
SetTextBackColorTransparent(sal_Bool bSet)264 	void			SetTextBackColorTransparent(sal_Bool bSet)
265 									{ bTransparentBackColor = bSet; }
IsTextBackColorTransparent()266 	sal_Bool			IsTextBackColorTransparent()
267 									{ return bTransparentBackColor; }
LockKeyInput(sal_Bool bSet)268 	void			LockKeyInput(sal_Bool bSet){bLockInput = bSet;}
269 
GetView() const270 	const SwView &GetView() const { return rView; }
GetView()271 		  SwView &GetView() 	  { return rView; }
272 
273     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
274 
275 	// Tipfenster loeschen
276 	static void ClearTip();
277 
GetDDStartPosX()278 	static inline long GetDDStartPosX() { return nDDStartPosX; }
GetDDStartPosY()279 	static inline long GetDDStartPosY() { return nDDStartPosY; }
280 
281 	static void	_InitStaticData();
282 	static void	_FinitStaticData();
283 
284     //#i3370# remove quick help to prevent saving of autocorrection suggestions
285     void StopQuickHelp();
286 
287     // --> OD 2005-02-18 #i42921# - add parameter <bVerticalMode>
288     sal_Bool RulerMarginDrag( const MouseEvent& rMEvt,
289                                      const bool bVerticalMode );
290     // <--
291 
292     /** #i42732# display status of font size/name depending on either the input
293         language or the selection position depending on what has changed lately
294      */
295     void        SetUseInputLanguage( sal_Bool bNew );
IsUseInputLanguage() const296     sal_Bool    IsUseInputLanguage() const { return bUseInputLanguage; }
297 
298     SwEditWin(Window *pParent, SwView &);
299 	virtual ~SwEditWin();
300 	virtual void SwitchView();
301 };
302 
303 #endif
304 
305