xref: /trunk/main/sw/source/ui/inc/wrtsh.hxx (revision 52f1c2ee)
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 _WRTSH_HXX
24 #define _WRTSH_HXX
25 
26 #include <com/sun/star/embed/XEmbeddedObject.hpp>
27 #include "swdllapi.h"
28 #include <fesh.hxx>
29 #include <sortopt.hxx>
30 #include <swurl.hxx>
31 #include <IMark.hxx>
32 
33 class Window;
34 class OutputDevice;
35 class SbxArray;
36 class SwDoc;
37 class SpellCheck;
38 class SwViewOption;
39 class SwFlyFrmAttrMgr;
40 class SwField;
41 class SwTOXBase;
42 class SdrView;
43 class SwView;
44 class SvGlobalName;
45 class SwInputFieldList;
46 class SwSectionData;
47 class Timer;
48 class SvxMacro;
49 class SwFmtINetFmt;
50 class SvxINetBookmark;
51 class SvxAutoCorrect;
52 class NaviContentBookmark;
53 struct SwCallMouseEvent;
54 class DropEvent;
55 struct ChartSelectionInfo;
56 class SfxStringListItem;
57 class SfxRequest;
58 
59 namespace com { namespace sun { namespace star { namespace util {
60 	struct SearchOptions;
61 } } } }
62 
63 
64 typedef sal_Int32 SelectionType;
65 namespace nsSelectionType
66 {
67 	const SelectionType SEL_TXT 	  		= CNT_TXT; 	// Text, niemals auch Rahmen	0x0001
68 	const SelectionType SEL_GRF 	  		= CNT_GRF; 	// Grafik						0x0002
69 	const SelectionType SEL_OLE 	  		= CNT_OLE; 	// OLE 							0x0010
70 	const SelectionType SEL_FRM 	  		= 0x000020;	// Rahmen, keine Inhaltsform
71 	const SelectionType SEL_NUM 	  		= 0x000040;	// NumListe
72 	const SelectionType SEL_TBL 	  		= 0x000080;	// Cursor steht in Tabelle
73 	const SelectionType SEL_TBL_CELLS 		= 0x000100;	// Tabellenzellen sind selektiert
74 	const SelectionType SEL_DRW 	  		= 0x000200;	// Zeichenobjekte (Rechteck, Kreis...)
75 	const SelectionType SEL_DRW_TXT   		= 0x000400;	// Draw-Textobjekte im Editmode
76 	const SelectionType SEL_BEZ       		= 0x000800;	// Bezierobjekte editieren
77 	const SelectionType SEL_DRW_FORM  		= 0x001000;	// Zeichenobjekte: DB-Forms
78 	const SelectionType SEL_FOC_FRM_CTRL	= 0x002000; // a form control is focused. Neither set nor evaluated by the SwWrtShell itself, only by it's clients.
79 	const SelectionType SEL_MEDIA     		= 0x004000;	// Media object
80 	const SelectionType SEL_EXTRUDED_CUSTOMSHAPE = 0x008000; 	// extruded custom shape
81 	const SelectionType SEL_FONTWORK  		= 0x010000;	// fontwork
82 	const SelectionType SEL_POSTIT			= 0x020000;	//annotation
83 }
84 
85 
86 class SW_DLLPUBLIC SwWrtShell: public SwFEShell
87 {
88 private:
89     using SwCrsrShell::Left;
90     using SwCrsrShell::Right;
91     using SwCrsrShell::Up;
92     using SwCrsrShell::Down;
93     using SwCrsrShell::LeftMargin;
94     using SwCrsrShell::RightMargin;
95     using SwCrsrShell::SelectTxtAttr;
96     using SwCrsrShell::GotoPage;
97     using SwFEShell::InsertObject;
98     using SwEditShell::AutoCorrect;
99     using SwCrsrShell::GotoMark;
100 
101 public:
102 
103     using SwEditShell::Insert;
104 
105 	typedef long (SwWrtShell::*SELECTFUNC)(const Point *, sal_Bool bProp );
106 
107 	SELECTFUNC	fnDrag;
108 	SELECTFUNC	fnSetCrsr;
109 	SELECTFUNC	fnEndDrag;
110 	SELECTFUNC	fnKillSel;
111 
112 	// Alle Selektionen aufheben
113 	long ResetSelect( const Point *, sal_Bool );
114 
115 	//setzt den Cursorstack nach dem Bewegen mit PageUp/-Down
116 	//zurueck, falls ein Stack aufgebaut ist
117 	inline void ResetCursorStack();
118 	SelectionType 	GetSelectionType() const;
119 
IsModePushed() const120 	sal_Bool	IsModePushed() const { return 0 != pModeStack; }
121 	void	PushMode();
122 	void	PopMode();
123 
124 	void	SttSelect();
125 	void	EndSelect();
IsInSelect() const126 	sal_Bool	IsInSelect() const { return bInSelect; }
SetInSelect(sal_Bool bSel=sal_True)127 	void	SetInSelect(sal_Bool bSel = sal_True) { bInSelect = bSel; }
128 		// Liegt eine Text- oder Rahmenselektion vor?
HasSelection() const129     sal_Bool    HasSelection() const { return SwCrsrShell::HasSelection() ||
130                                         IsMultiSelection() || IsSelFrmMode() || IsObjSelected(); }
131 	sal_Bool Pop( sal_Bool bOldCrsr = sal_True );
132 
133 	void	EnterStdMode();
IsStdMode() const134 	sal_Bool	IsStdMode() const { return !bExtMode && !bAddMode && !bBlockMode; }
135 
136 	void	EnterExtMode();
137 	void	LeaveExtMode();
138 	long	ToggleExtMode();
IsExtMode() const139 	sal_Bool	IsExtMode() const { return bExtMode; }
140 
141 	void	EnterAddMode();
142 	void	LeaveAddMode();
143 	long	ToggleAddMode();
IsAddMode() const144 	sal_Bool	IsAddMode() const { return bAddMode; }
145 
146 	void	EnterBlockMode();
147 	void	LeaveBlockMode();
148 	long	ToggleBlockMode();
IsBlockMode() const149 	sal_Bool	IsBlockMode() const { return bBlockMode; }
150 
151 	void	SetInsMode( sal_Bool bOn = sal_True );
ToggleInsMode()152 	void	ToggleInsMode() { SetInsMode( !bIns ); }
IsInsMode() const153 	sal_Bool	IsInsMode() const { return bIns; }
154     void    SetRedlineModeAndCheckInsMode( sal_uInt16 eMode );
155 
156 	void	EnterSelFrmMode(const Point *pStartDrag = 0);
157 	void	LeaveSelFrmMode();
IsSelFrmMode() const158 	sal_Bool	IsSelFrmMode() const { return bLayoutMode; }
159 		// Selektion von Rahmen aufheben
160 	void	UnSelectFrm();
161 
162 	void	Invalidate();
163 
164 	// Tabellenzellen selektieren fuer Bearbeiten von Formeln in der Ribbonbar
165 	inline void SelTblCells( const Link &rLink, sal_Bool bMark = sal_True );
166 	inline void	EndSelTblCells();
167 
168 	//Wortweisen oder zeilenweisen Selektionsmodus verlassen. Wird
169 	//in der Regel in MB-Up gerufen.
IsExtSel() const170 	sal_Bool	IsExtSel() const { return bSelWrd || bSelLn; }
171 
172 	// erfrage, ob der akt. fnDrag - Pointer auf BeginDrag gesetzt ist
173 	// Wird fuer MouseMove gebraucht, um die Bugs 55592/55931 zu umgehen.
174 	inline sal_Bool	Is_FnDragEQBeginDrag() const;
175 
176 	//Basisabfragen
IsInWrd()177 	sal_Bool	IsInWrd() 			{ return IsInWord(); }
IsSttWrd()178 	sal_Bool	IsSttWrd()			{ return IsStartWord(); }
179 	sal_Bool	IsEndWrd();
IsSttOfPara() const180 	sal_Bool	IsSttOfPara() const { return IsSttPara(); }
IsEndOfPara() const181 	sal_Bool	IsEndOfPara() const { return IsEndPara(); }
182 
183 	//Word bzw. Satz selektieren.
184 	sal_Bool	SelNearestWrd();
185 	sal_Bool	SelWrd		(const Point * = 0, sal_Bool bProp=sal_False );
186     // --> FME 2004-07-30 #i32329# Enhanced selection
187     void    SelSentence (const Point * = 0, sal_Bool bProp=sal_False );
188     void    SelPara     (const Point * = 0, sal_Bool bProp=sal_False );
189     // <--
190 	long	SelAll();
191 
192 	//Basiscursortravelling
193 typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
194 	sal_Bool SimpleMove( FNSimpleMove, sal_Bool bSelect );
195 
196 	sal_Bool Left		( sal_uInt16 nMode, sal_Bool bSelect,
197                             sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_False );
198 	sal_Bool Right		( sal_uInt16 nMode, sal_Bool bSelect,
199                             sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_False );
200 	sal_Bool Up			( sal_Bool bSelect = sal_False, sal_uInt16 nCount = 1,
201 							sal_Bool bBasicCall = sal_False );
202 	sal_Bool Down		( sal_Bool bSelect = sal_False, sal_uInt16 nCount = 1,
203 							sal_Bool bBasicCall = sal_False );
NxtWrd(sal_Bool bSelect=sal_False)204 	sal_Bool NxtWrd		( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_NxtWrd, bSelect ); }
PrvWrd(sal_Bool bSelect=sal_False)205 	sal_Bool PrvWrd		( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_PrvWrd, bSelect ); }
206 
207 	sal_Bool LeftMargin	( sal_Bool bSelect, sal_Bool bBasicCall );
208 	sal_Bool RightMargin( sal_Bool bSelect, sal_Bool bBasicCall );
209 
210 	sal_Bool SttDoc		( sal_Bool bSelect = sal_False );
211 	sal_Bool EndDoc		( sal_Bool bSelect = sal_False );
212 
213 	sal_Bool SttNxtPg	( sal_Bool bSelect = sal_False );
214 	sal_Bool SttPrvPg	( sal_Bool bSelect = sal_False );
215 	sal_Bool EndNxtPg	( sal_Bool bSelect = sal_False );
216 	sal_Bool EndPrvPg	( sal_Bool bSelect = sal_False );
217 	sal_Bool SttPg		( sal_Bool bSelect = sal_False );
218 	sal_Bool EndPg		( sal_Bool bSelect = sal_False );
219 	sal_Bool SttPara	( sal_Bool bSelect = sal_False );
220 	sal_Bool EndPara	( sal_Bool bSelect = sal_False );
FwdPara(sal_Bool bSelect=sal_False)221 	sal_Bool FwdPara	( sal_Bool bSelect = sal_False )
222 				{ return SimpleMove( &SwWrtShell::_FwdPara, bSelect ); }
BwdPara(sal_Bool bSelect=sal_False)223 	sal_Bool BwdPara	( sal_Bool bSelect = sal_False )
224 				{ return SimpleMove( &SwWrtShell::_BwdPara, bSelect ); }
FwdSentence(sal_Bool bSelect=sal_False)225 	sal_Bool FwdSentence( sal_Bool bSelect = sal_False )
226 				{ return SimpleMove( &SwWrtShell::_FwdSentence, bSelect ); }
BwdSentence(sal_Bool bSelect=sal_False)227 	sal_Bool BwdSentence( sal_Bool bSelect = sal_False )
228 				{ return SimpleMove( &SwWrtShell::_BwdSentence, bSelect ); }
229 
230     // --> FME 2004-07-30 #i20126# Enhanced table selection
231     sal_Bool SelectTableRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
232     // <--
233     sal_Bool SelectTableRow();
234 	sal_Bool SelectTableCol();
235     sal_Bool SelectTableCell();
236 
237     sal_Bool SelectTxtAttr( sal_uInt16 nWhich, const SwTxtAttr* pAttr = 0 );
238 
239 	// Spaltenweise Spruenge
240 	sal_Bool StartOfColumn		( sal_Bool bSelect = sal_False );
241 	sal_Bool EndOfColumn		( sal_Bool bSelect = sal_False );
242 	sal_Bool StartOfNextColumn	( sal_Bool bSelect = sal_False );
243 	sal_Bool EndOfNextColumn	( sal_Bool bSelect = sal_False );
244 	sal_Bool StartOfPrevColumn	( sal_Bool bSelect = sal_False );
245 	sal_Bool EndOfPrevColumn	( sal_Bool bSelect = sal_False );
246 
247 	// setze den Cursor auf die Seite "nPage" an den Anfang
248 	// zusaetzlich zu der gleichnamigen Implementierung in crsrsh.hxx
249 	// werden hier alle bestehenden Selektionen vor dem Setzen des
250 	// Cursors aufgehoben
251 	sal_Bool	GotoPage( sal_uInt16 nPage, sal_Bool bRecord );
252 
253 	//setzen des Cursors; merken der alten Position fuer Zurueckblaettern.
254 	DECL_LINK( ExecFlyMac, void * );
255 
256 	sal_Bool	PageCrsr(SwTwips lOffset, sal_Bool bSelect);
257 
258 	// Felder Update
259 	void	UpdateInputFlds( SwInputFieldList* pLst = 0 );
260 
261 	void	NoEdit(sal_Bool bHideCrsr = sal_True);
262 	void	Edit();
IsNoEdit() const263 	sal_Bool	IsNoEdit() const { return bNoEdit; }
264 
IsRetainSelection() const265 	sal_Bool IsRetainSelection() const { return mbRetainSelection; }
SetRetainSelection(sal_Bool bRet)266 	void SetRetainSelection( sal_Bool bRet ) { mbRetainSelection = bRet; }
267 
268     // change current data base and notify
269     void ChgDBData(const SwDBData& SwDBData);
270 
271     // Loeschen
272 	long	DelToEndOfLine();
273 	long	DelToStartOfLine();
274 	long	DelLine();
275 	long	DelLeft();
276 
277 	// loescht auch Rahmen bzw. setzt den Cursor in den Rahmen,
278 	// wenn bDelFrm == sal_False ist
279     long    DelRight();
280 	long	DelToEndOfPara();
281 	long	DelToStartOfPara();
282 	long	DelToEndOfSentence();
283 	long	DelToStartOfSentence();
284 	long	DelNxtWord();
285 	long	DelPrvWord();
286 
287 	// Prueft, ob eine Wortselektion vorliegt.
288 	// Gemaess den Regeln fuer intelligentes Cut / Paste
289 	// werden umgebende Spaces rausgeschnitten.
290 	// Liefert Art der Wortselektion zurueck (siehe enum)
291 	enum word {
292 			NO_WORD = 0,
293 			WORD_SPACE_BEFORE = 1,
294 			WORD_SPACE_AFTER = 2,
295 			WORD_NO_SPACE = 3
296 		};
297 	int 	IntelligentCut(int nSelectionType, sal_Bool bCut = sal_True);
298 
299 	// Editieren
300     void Insert( SwField& rFld );
301 
302 	void	Insert(const String &);
303 
304 	// Graphic
305 	void	Insert( const String &rPath, const String &rFilter,
306 					const Graphic &, SwFlyFrmAttrMgr * = 0,
307 					sal_Bool bRule = sal_False );
308 
309 	void 	InsertByWord( const String & );
310 	void	InsertPageBreak(const String *pPageDesc = 0, sal_uInt16 nPgNum = 0 );
311 	void	InsertLineBreak();
312 	void	InsertColumnBreak();
313 	void	InsertFootnote(const String &, sal_Bool bEndNote = sal_False, sal_Bool bEdit = sal_True );
314 	void	SplitNode( sal_Bool bAutoFormat = sal_False, sal_Bool bCheckTableStart = sal_True );
315     bool    CanInsert();
316 
317 	// Verzeichnisse
318 	void	InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
319 	sal_Bool	UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
320 
321 	// Numerierung und Bullets
322     /**
323        Turns on numbering or bullets.
324 
325        @param bNum    sal_True: turn on numbering
326                       sal_False: turn on bullets
327     */
328 	void	NumOrBulletOn(sal_Bool bNum); // #i29560#
329 	void	NumOrBulletOff(); // #i29560#
330     void    NumOn();
331 	void	BulletOn();
332 
333 	//OLE
334     void    InsertObject(     /*SvInPlaceObjectRef *pObj, */       // != 0 fuer Clipboard
335                           const svt::EmbeddedObjectRef&,
336 						  SvGlobalName *pName = 0,		// != 0 entspr. Object erzeugen.
337 						  sal_Bool bActivate = sal_True,
338                           sal_uInt16 nSlotId = 0);       // SlotId fuer Dialog
339 
340     sal_Bool    InsertOleObject( const svt::EmbeddedObjectRef& xObj, SwFlyFrmFmt **pFlyFrmFmt = 0 );
341 	void	LaunchOLEObj( long nVerb = 0 );				// Server starten
IsOLEObj() const342 	sal_Bool	IsOLEObj() const { return GetCntType() == CNT_OLE;}
343 	virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
344     virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
345 								  const SwRect *pFlyPrtRect = 0,
346                                   const SwRect *pFlyFrmRect = 0,
347                                   const bool bNoTxtFrmPrtAreaChanged = false );
348     virtual void ConnectObj( svt::EmbeddedObjectRef&  xIPObj, const SwRect &rPrt,
349 							 const SwRect &rFrm );
350 
351 	// Vorlagen und Formate
352 
353 	// enum gibt an, was geschehen soll, wenn das Style nicht gefunden wurde
354 	enum GetStyle { GETSTYLE_NOCREATE, 			// keins anlegen
355 					GETSTYLE_CREATESOME,        // falls auf PoolId mapt anlegen
356 					GETSTYLE_CREATEANY };		// ggfs Standard returnen
357 
358 	SwTxtFmtColl*	GetParaStyle(const String &rCollName,
359 									GetStyle eCreate = GETSTYLE_NOCREATE);
360 	SwCharFmt*		GetCharStyle(const String &rFmtName,
361 									GetStyle eCreate = GETSTYLE_NOCREATE);
362 	SwFrmFmt*		GetTblStyle(const String &rFmtName);
363 
364 	void	SetPageStyle(const String &rCollName);
365 
366 	String	GetCurPageStyle( const sal_Bool bCalcFrm = sal_True ) const;
367 
368 	// Aktuelle Vorlage anhand der geltenden Attribute aendern
369 	void	QuickUpdateStyle();
370 
371 	enum DoType { UNDO, REDO, REPEAT };
372 
373 	void	Do( DoType eDoType, sal_uInt16 nCnt = 1 );
374 	String	GetDoString( DoType eDoType ) const;
375 	String	GetRepeatString() const;
376 	sal_uInt16 	GetDoStrings( DoType eDoType, SfxStringListItem& rStrLstItem ) const;
377 
378 	//Suchen oder Ersetzen
379 	sal_uLong SearchPattern(const com::sun::star::util::SearchOptions& rSearchOpt,
380 						 sal_Bool bSearchInNotes,
381 						 SwDocPositions eStart, SwDocPositions eEnde,
382 						 FindRanges eFlags = FND_IN_BODY,
383 						 int bReplace = sal_False );
384 
385 	sal_uLong SearchTempl  (const String &rTempl,
386 						 SwDocPositions eStart, SwDocPositions eEnde,
387 						 FindRanges eFlags = FND_IN_BODY,
388 						 const String* pReplTempl = 0 );
389 
390 	sal_uLong SearchAttr   (const SfxItemSet& rFindSet,
391 						 sal_Bool bNoColls,
392 						 SwDocPositions eStart,SwDocPositions eEnde,
393 						 FindRanges eFlags = FND_IN_BODY,
394 						 const com::sun::star::util::SearchOptions* pSearchOpt = 0,
395 						 const SfxItemSet* pReplaceSet = 0);
396 
397 	void AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar = ' ' );
398 
399 	// Aktion vor Cursorbewegung
400 	// Hebt gfs. Selektionen auf, triggert Timer und GCAttr()
401 	void	MoveCrsr( sal_Bool bWithSelect = sal_False );
402 
403 	// Eingabefelder updaten
404     sal_Bool    StartInputFldDlg(SwField*, sal_Bool bNextButton, Window* pParentWin = 0, ByteString* pWindowState = 0);
405     // update DropDown fields
406     sal_Bool    StartDropDownFldDlg(SwField*, sal_Bool bNextButton, ByteString* pWindowState = 0);
407 
408 	//"Handler" fuer Anederungen an der DrawView - fuer Controls.
409     virtual void DrawSelChanged( );
410 
411 	// springe zum Bookmark und setze die "Selections-Flags" wieder richtig
412 	sal_Bool GotoMark( const ::sw::mark::IMark* const pMark );
413 	sal_Bool GotoMark( const ::sw::mark::IMark* const pMark, sal_Bool bSelect, sal_Bool bStart );
414 	sal_Bool GotoMark( const ::rtl::OUString& rName );
415 	sal_Bool GoNextBookmark(); // sal_True, wenn's noch eine gab
416 	sal_Bool GoPrevBookmark();
417 
418     bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark);
419 
420 	sal_Bool GotoField( const SwFmtFld& rFld );
421 
422 	// jump to the next / previous hyperlink - inside text and also
423 	// on graphics
424 	sal_Bool SelectNextPrevHyperlink( sal_Bool bNext = sal_True );
425 
426 	// Zugehoerige SwView ermitteln
GetView() const427 	const SwView&		GetView() const { return rView; }
GetView()428 	SwView&				GetView() { return rView; }
429 
430 	//Weil es sonst keiner macht, gibt es hier eine ExecMacro()
431 	void ExecMacro( const SvxMacro& rMacro, String* pRet = 0, SbxArray* pArgs = 0 );
432 	// rufe ins dunkle Basic/JavaScript
433 	sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
434 						sal_Bool bCheckPtr = sal_False, SbxArray* pArgs = 0,
435 						const Link* pCallBack = 0 );
436 
437 	// ein Klick aus das angegebene Feld. Der Cursor steht auf diesem.
438 	// Fuehre die vor definierten Aktionen aus.
439     void ClickToField( const SwField& rFld );
440 	void ClickToINetAttr( const SwFmtINetFmt& rItem, sal_uInt16 nFilter = URLLOAD_NOFILTER );
441 	sal_Bool ClickToINetGrf( const Point& rDocPt, sal_uInt16 nFilter = URLLOAD_NOFILTER );
442 	inline sal_Bool IsInClickToEdit() const ;
443 
444 	// fall ein URL-Button selektiert ist, dessen URL returnen, ansonsten
445 	// einen LeerString
446 	sal_Bool GetURLFromButton( String& rURL, String& rDescr ) const;
447 
448 	void NavigatorPaste( const NaviContentBookmark& rBkmk,
449 						 const sal_uInt16 nAction );
450 
451 	virtual void ApplyViewOptions( const SwViewOption &rOpt );
452 
453 	// autom. Update von Vorlagen
454 	void AutoUpdateFrame(SwFrmFmt* pFmt, const SfxItemSet& rStyleSet);
455 	void AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet);
456 
457 	// Link fuers einfuegen von Bereichen uebers Drag&Drop/Clipboard
458     DECL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSectionData* );
459 
460 
461 	//ctoren, der erstere ist eine Art kontrollierter copy ctor fuer weitere
462 	//Sichten auf ein Dokument
463 	SwWrtShell( SwWrtShell&, Window *pWin, SwView &rShell);
464 	SwWrtShell( SwDoc& rDoc, Window *pWin, SwView &rShell,
465                 const SwViewOption *pViewOpt = 0);
466 	virtual ~SwWrtShell();
467 
468     sal_Bool TryRemoveIndent(); // #i23725#
469 
470     String GetSelDescr() const;
471 
472 private:
473 
474 	SW_DLLPRIVATE void	OpenMark();
475 	SW_DLLPRIVATE void	CloseMark( sal_Bool bOkFlag );
476 
477 	SW_DLLPRIVATE String	GetWrdDelim();
478 	SW_DLLPRIVATE String	GetSDelim();
479 	SW_DLLPRIVATE String	GetBothDelim();
480 
481 	struct ModeStack
482 	{
483 		ModeStack	*pNext;
484 		sal_Bool		bAdd,
485                     bBlock,
486 					bExt,
487 					bIns;
ModeStackSwWrtShell::ModeStack488 		ModeStack(ModeStack *pNextMode, sal_Bool _bIns, sal_Bool _bExt, sal_Bool _bAdd, sal_Bool _bBlock):
489 			pNext(pNextMode),
490             bAdd(_bAdd),
491             bBlock(_bBlock),
492             bExt(_bExt),
493             bIns(_bIns)
494              {}
495 	} *pModeStack;
496 
497 	// Cursor bei PageUp / -Down mitnehmen
498 	enum PageMove
499 	{
500 		MV_NO,
501 		MV_PAGE_UP,
502 		MV_PAGE_DOWN
503 	}  ePageMove;
504 
505 	struct CrsrStack
506 	{
507 		Point aDocPos;
508 		CrsrStack *pNext;
509 		sal_Bool bValidCurPos : 1;
510 		sal_Bool bIsFrmSel : 1;
511 		SwTwips lOffset;
512 
CrsrStackSwWrtShell::CrsrStack513 		CrsrStack( sal_Bool bValid, sal_Bool bFrmSel, const Point &rDocPos,
514 					SwTwips lOff, CrsrStack *pN )
515             : aDocPos(rDocPos),
516             pNext(pN),
517             bValidCurPos( bValid ),
518             bIsFrmSel( bFrmSel ),
519             lOffset(lOff)
520 		{
521 
522 
523 		}
524 
525 	} *pCrsrStack;
526 
527 	SwView	&rView;
528 
529 	Point	aDest;
530 	sal_Bool	bDestOnStack;
HasCrsrStack() const531 	sal_Bool	HasCrsrStack() const { return 0 != pCrsrStack; }
532 	SW_DLLPRIVATE sal_Bool	PushCrsr(SwTwips lOffset, sal_Bool bSelect);
533 	SW_DLLPRIVATE sal_Bool	PopCrsr(sal_Bool bUpdate, sal_Bool bSelect = sal_False);
534 
535 	// ENDE Cursor bei PageUp / -Down mitnehmen
536 	SW_DLLPRIVATE sal_Bool _SttWrd();
537 	SW_DLLPRIVATE sal_Bool _EndWrd();
538 	SW_DLLPRIVATE sal_Bool _NxtWrd();
539 	SW_DLLPRIVATE sal_Bool _PrvWrd();
540     // --> OD 2008-08-06 #i92468#
541     SW_DLLPRIVATE sal_Bool _NxtWrdForDelete();
542     SW_DLLPRIVATE sal_Bool _PrvWrdForDelete();
543     // <--
544     SW_DLLPRIVATE sal_Bool _FwdSentence();
545 	SW_DLLPRIVATE sal_Bool _BwdSentence();
546 	sal_Bool _FwdPara();
547 	SW_DLLPRIVATE sal_Bool _BwdPara();
548 
549 		//	Selektionen
550 	sal_Bool	bIns			:1;
551 	sal_Bool	bInSelect		:1;
552 	sal_Bool	bExtMode		:1;
553 	sal_Bool	bAddMode		:1;
554     sal_Bool    bBlockMode      :1;
555 	sal_Bool	bLayoutMode		:1;
556 	sal_Bool	bNoEdit			:1;
557 	sal_Bool	bCopy			:1;
558 	sal_Bool	bSelWrd			:1;
559 	sal_Bool	bSelLn			:1;
560 	sal_Bool	bIsInClickToEdit:1;
561 	sal_Bool 	bClearMark		:1;		// Selektion fuer ChartAutoPilot nicht loeschen
562     sal_Bool    mbRetainSelection :1; // Do not remove selections
563 
564 	Point	aStart;
565 	Link	aSelTblLink;
566 
567 	SELECTFUNC	fnLeaveSelect;
568 
569 	//setzt den Cursorstack nach dem Bewegen mit PageUp/-Down zurueck.
570 	SW_DLLPRIVATE void	_ResetCursorStack();
571 
572 	SW_DLLPRIVATE void	SttDragDrop(Timer *);
573 
574 	using SwCrsrShell::SetCrsr;
575 	SW_DLLPRIVATE long	SetCrsr(const Point *, sal_Bool bProp=sal_False );
576 
577 	SW_DLLPRIVATE long	SetCrsrKillSel(const Point *, sal_Bool bProp=sal_False );
578 
579 	SW_DLLPRIVATE long	StdSelect(const Point *, sal_Bool bProp=sal_False );
580 	SW_DLLPRIVATE long	BeginDrag(const Point *, sal_Bool bProp=sal_False );
581 	SW_DLLPRIVATE long	Drag(const Point *, sal_Bool bProp=sal_False );
582 	SW_DLLPRIVATE long	EndDrag(const Point *, sal_Bool bProp=sal_False );
583 
584 	SW_DLLPRIVATE long	ExtSelWrd(const Point *, sal_Bool bProp=sal_False );
585 	SW_DLLPRIVATE long	ExtSelLn(const Point *, sal_Bool bProp=sal_False );
586 
587 	//Verschieben von Text aus Drag and Drop; Point ist
588 	//Destination fuer alle Selektionen.
589 	SW_DLLPRIVATE long	MoveText(const Point *, sal_Bool bProp=sal_False );
590 
591 	SW_DLLPRIVATE long	BeginFrmDrag(const Point *, sal_Bool bProp=sal_False );
592 
593 	//nach SSize/Move eines Frames Update; Point ist Destination.
594 	SW_DLLPRIVATE long	UpdateLayoutFrm(const Point *, sal_Bool bProp=sal_False );
595 
596 	SW_DLLPRIVATE long	SttLeaveSelect(const Point *, sal_Bool bProp=sal_False );
597 	SW_DLLPRIVATE long	AddLeaveSelect(const Point *, sal_Bool bProp=sal_False );
598 	SW_DLLPRIVATE long	Ignore(const Point *, sal_Bool bProp=sal_False );
599 
LeaveExtSel()600 	SW_DLLPRIVATE void	LeaveExtSel() { bSelWrd = bSelLn = sal_False;}
601 	SW_DLLPRIVATE bool _CanInsert();
602 
603 	SW_DLLPRIVATE sal_Bool	GoStart(sal_Bool KeepArea = sal_False, sal_Bool * = 0,
604 			sal_Bool bSelect = sal_False, sal_Bool bDontMoveRegion = sal_False);
605 	SW_DLLPRIVATE sal_Bool	GoEnd(sal_Bool KeepArea = sal_False, sal_Bool * = 0);
606 
607 	enum BookMarkMove
608 	{
609 		BOOKMARK_INDEX,
610 		BOOKMARK_NEXT,
611 		BOOKMARK_PREV,
612 		BOOKMARK_LAST_LAST_ENTRY
613 	};
614 
615 	SW_DLLPRIVATE sal_Bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=NULL);
616 };
617 
ResetCursorStack()618 inline void SwWrtShell::ResetCursorStack()
619 {
620 	if ( HasCrsrStack() )
621 		_ResetCursorStack();
622 }
623 
SelTblCells(const Link & rLink,sal_Bool bMark)624 inline void SwWrtShell::SelTblCells(const Link &rLink, sal_Bool bMark )
625 {
626 	SetSelTblCells( sal_True );
627 	bClearMark = bMark;
628 	aSelTblLink = rLink;
629 }
EndSelTblCells()630 inline void SwWrtShell::EndSelTblCells()
631 {
632 	SetSelTblCells( sal_False );
633 	bClearMark = sal_True;
634 }
635 
IsInClickToEdit() const636 inline sal_Bool SwWrtShell::IsInClickToEdit() const { return bIsInClickToEdit; }
637 
Is_FnDragEQBeginDrag() const638 inline sal_Bool	SwWrtShell::Is_FnDragEQBeginDrag() const
639 {
640 #ifdef GCC
641 	SELECTFUNC	fnTmp = &SwWrtShell::BeginDrag;
642 	return fnDrag == fnTmp;
643 #else
644     return sal::static_int_cast< sal_Bool >(fnDrag == &SwWrtShell::BeginDrag);
645 #endif
646 }
647 
648 #endif
649