Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _WRTSH_HXX
29 : : #define _WRTSH_HXX
30 : :
31 : : #include <com/sun/star/embed/XEmbeddedObject.hpp>
32 : : #include "swdllapi.h"
33 : : #include <fesh.hxx>
34 : : #include <sortopt.hxx>
35 : : #include <swurl.hxx>
36 : : #include <IMark.hxx>
37 : : #include "navmgr.hxx"
38 : :
39 : : class Window;
40 : : class SbxArray;
41 : : class SwDoc;
42 : : class SwViewOption;
43 : : class SwFlyFrmAttrMgr;
44 : : class SwField;
45 : : class SwTOXBase;
46 : : class SwView;
47 : : class SvGlobalName;
48 : : class SwInputFieldList;
49 : : class SwSectionData;
50 : : class Timer;
51 : : class SvxMacro;
52 : : class SwFmtINetFmt;
53 : : class SvxAutoCorrect;
54 : : class NaviContentBookmark;
55 : : struct SwCallMouseEvent;
56 : : class SfxStringListItem;
57 : :
58 : : namespace com { namespace sun { namespace star { namespace util {
59 : : struct SearchOptions;
60 : : } } } }
61 : :
62 : :
63 : : typedef sal_Int32 SelectionType;
64 : : namespace nsSelectionType
65 : : {
66 : : const SelectionType SEL_TXT = CNT_TXT; // text, never frames too 0x0001
67 : : const SelectionType SEL_GRF = CNT_GRF; // graphic 0x0002
68 : : const SelectionType SEL_OLE = CNT_OLE; // OLE 0x0010
69 : : const SelectionType SEL_FRM = 0x000020; // frame, no content type
70 : : const SelectionType SEL_NUM = 0x000040; // NumList
71 : : const SelectionType SEL_TBL = 0x000080; // cursor is in table
72 : : const SelectionType SEL_TBL_CELLS = 0x000100; // table cells are selected
73 : : const SelectionType SEL_DRW = 0x000200; // drawing objects (rectangle, circle...)
74 : : const SelectionType SEL_DRW_TXT = 0x000400; // draw-textobjects in edit mode
75 : : const SelectionType SEL_BEZ = 0x000800; // edit ornament objects
76 : : const SelectionType SEL_DRW_FORM = 0x001000; // drawing objects: DB-Forms
77 : : 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.
78 : : const SelectionType SEL_MEDIA = 0x004000; // Media object
79 : : const SelectionType SEL_EXTRUDED_CUSTOMSHAPE = 0x008000; // extruded custom shape
80 : : const SelectionType SEL_FONTWORK = 0x010000; // fontwork
81 : : const SelectionType SEL_POSTIT = 0x020000; //annotation
82 : : }
83 : :
84 : :
85 : : class SW_DLLPUBLIC SwWrtShell: public SwFEShell
86 : : {
87 : : private:
88 : : using SwCrsrShell::Left;
89 : : using SwCrsrShell::Right;
90 : : using SwCrsrShell::Up;
91 : : using SwCrsrShell::Down;
92 : : using SwCrsrShell::LeftMargin;
93 : : using SwCrsrShell::RightMargin;
94 : : using SwCrsrShell::SelectTxtAttr;
95 : : using SwCrsrShell::GotoPage;
96 : : using SwFEShell::InsertObject;
97 : : using SwEditShell::AutoCorrect;
98 : : using SwCrsrShell::GotoMark;
99 : :
100 : : typedef long (SwWrtShell::*SELECTFUNC)(const Point *, sal_Bool bProp );
101 : :
102 : : SELECTFUNC fnDrag;
103 : : SELECTFUNC fnSetCrsr;
104 : : SELECTFUNC fnEndDrag;
105 : : SELECTFUNC fnKillSel;
106 : :
107 : : public:
108 : :
109 : : using SwEditShell::Insert;
110 : :
111 [ # # ]: 0 : long SetCursor (const Point* pPt, bool bProp) { return (this->*fnSetCrsr)(pPt, bProp); }
112 [ # # ]: 0 : long Drag (const Point* pPt, bool bProp) { return (this->*fnDrag)(pPt, bProp); }
113 [ # # ]: 0 : long EndDrag (const Point* pPt, bool bProp) { return (this->*fnEndDrag)(pPt, bProp); }
114 [ # # ]: 0 : long KillSelection(const Point* pPt, bool bProp) { return (this->*fnKillSel)(pPt, bProp); }
115 : :
116 : : // reset all selections
117 : : long ResetSelect( const Point *, sal_Bool );
118 : :
119 : : // resets the cursorstack after movement with PageUp/-Down if a stack is built up
120 : : inline void ResetCursorStack();
121 : : SelectionType GetSelectionType() const;
122 : :
123 : 1231 : sal_Bool IsModePushed() const { return 0 != pModeStack; }
124 : : void PushMode();
125 : : void PopMode();
126 : :
127 : : void SttSelect();
128 : : void EndSelect();
129 : 0 : sal_Bool IsInSelect() const { return bInSelect; }
130 : 0 : void SetInSelect(sal_Bool bSel = sal_True) { bInSelect = bSel; }
131 : : // is there a text- or frameselection?
132 : 9478 : sal_Bool HasSelection() const { return SwCrsrShell::HasSelection() ||
133 [ + - ][ + - ]: 9478 : IsMultiSelection() || IsSelFrmMode() || IsObjSelected(); }
[ - + ][ + + ]
134 : : sal_Bool Pop( sal_Bool bOldCrsr = sal_True );
135 : :
136 : : void EnterStdMode();
137 [ + - ][ + - ]: 1366 : sal_Bool IsStdMode() const { return !bExtMode && !bAddMode && !bBlockMode; }
[ + - ]
138 : :
139 : : void EnterExtMode();
140 : : void LeaveExtMode();
141 : : long ToggleExtMode();
142 : 0 : sal_Bool IsExtMode() const { return bExtMode; }
143 : :
144 : : void EnterAddMode();
145 : : void LeaveAddMode();
146 : : long ToggleAddMode();
147 : 0 : sal_Bool IsAddMode() const { return bAddMode; }
148 : :
149 : : void EnterBlockMode();
150 : : void LeaveBlockMode();
151 : : long ToggleBlockMode();
152 : 0 : sal_Bool IsBlockMode() const { return bBlockMode; }
153 : :
154 : : void SetInsMode( sal_Bool bOn = sal_True );
155 : 0 : void ToggleInsMode() { SetInsMode( !bIns ); }
156 : 1356 : sal_Bool IsInsMode() const { return bIns; }
157 : : void SetRedlineModeAndCheckInsMode( sal_uInt16 eMode );
158 : :
159 : : void EnterSelFrmMode(const Point *pStartDrag = 0);
160 : : void LeaveSelFrmMode();
161 : 9552 : sal_Bool IsSelFrmMode() const { return bLayoutMode; }
162 : : // reset selection of frames
163 : : void UnSelectFrm();
164 : :
165 : : void Invalidate();
166 : :
167 : : // select table cells for editing of formulas in the ribbonbar
168 : : inline void SelTblCells( const Link &rLink, sal_Bool bMark = sal_True );
169 : : inline void EndSelTblCells();
170 : :
171 : : // leave per word or per line selection mode. Is usually called in MB-Up.
172 [ # # ][ # # ]: 0 : sal_Bool IsExtSel() const { return bSelWrd || bSelLn; }
173 : :
174 : : // query whether the active fnDrag pointer is set to BeginDrag
175 : : // is needed for MouseMove to work around bugs 55592/55931
176 : : inline sal_Bool Is_FnDragEQBeginDrag() const;
177 : :
178 : : // base requests
179 : 0 : sal_Bool IsInWrd() { return IsInWord(); }
180 : 0 : sal_Bool IsSttWrd() { return IsStartWord(); }
181 : : sal_Bool IsEndWrd();
182 : 0 : sal_Bool IsSttOfPara() const { return IsSttPara(); }
183 : 0 : sal_Bool IsEndOfPara() const { return IsEndPara(); }
184 : :
185 : : // select word / sentense
186 : : sal_Bool SelNearestWrd();
187 : : sal_Bool SelWrd (const Point * = 0, sal_Bool bProp=sal_False );
188 : : // #i32329# Enhanced selection
189 : : void SelSentence (const Point * = 0, sal_Bool bProp=sal_False );
190 : : void SelPara (const Point * = 0, sal_Bool bProp=sal_False );
191 : : long SelAll();
192 : :
193 : : // basecursortravelling
194 : : typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
195 : : sal_Bool SimpleMove( FNSimpleMove, sal_Bool bSelect );
196 : :
197 : : sal_Bool Left ( sal_uInt16 nMode, sal_Bool bSelect,
198 : : sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_False );
199 : : sal_Bool Right ( sal_uInt16 nMode, sal_Bool bSelect,
200 : : sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_False );
201 : : sal_Bool Up ( sal_Bool bSelect = sal_False, sal_uInt16 nCount = 1,
202 : : sal_Bool bBasicCall = sal_False );
203 : : sal_Bool Down ( sal_Bool bSelect = sal_False, sal_uInt16 nCount = 1,
204 : : sal_Bool bBasicCall = sal_False );
205 : 0 : sal_Bool NxtWrd ( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_NxtWrd, bSelect ); }
206 : 0 : sal_Bool PrvWrd ( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_PrvWrd, bSelect ); }
207 : :
208 : : sal_Bool LeftMargin ( sal_Bool bSelect, sal_Bool bBasicCall );
209 : : sal_Bool RightMargin( sal_Bool bSelect, sal_Bool bBasicCall );
210 : :
211 : : sal_Bool SttDoc ( sal_Bool bSelect = sal_False );
212 : : sal_Bool EndDoc ( sal_Bool bSelect = sal_False );
213 : :
214 : : sal_Bool SttNxtPg ( sal_Bool bSelect = sal_False );
215 : : sal_Bool SttPrvPg ( sal_Bool bSelect = sal_False );
216 : : sal_Bool EndNxtPg ( sal_Bool bSelect = sal_False );
217 : : sal_Bool EndPrvPg ( sal_Bool bSelect = sal_False );
218 : : sal_Bool SttPg ( sal_Bool bSelect = sal_False );
219 : : sal_Bool EndPg ( sal_Bool bSelect = sal_False );
220 : : sal_Bool SttPara ( sal_Bool bSelect = sal_False );
221 : : sal_Bool EndPara ( sal_Bool bSelect = sal_False );
222 : 0 : sal_Bool FwdPara ( sal_Bool bSelect = sal_False )
223 : 0 : { return SimpleMove( &SwWrtShell::_FwdPara, bSelect ); }
224 : 0 : sal_Bool BwdPara ( sal_Bool bSelect = sal_False )
225 : 0 : { return SimpleMove( &SwWrtShell::_BwdPara, bSelect ); }
226 : 0 : sal_Bool FwdSentence( sal_Bool bSelect = sal_False )
227 : 0 : { return SimpleMove( &SwWrtShell::_FwdSentence, bSelect ); }
228 : 0 : sal_Bool BwdSentence( sal_Bool bSelect = sal_False )
229 : 0 : { return SimpleMove( &SwWrtShell::_BwdSentence, bSelect ); }
230 : :
231 : : // #i20126# Enhanced table selection
232 : : sal_Bool SelectTableRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
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 : : // per column jumps
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 : : // set the cursor to page "nPage" at the beginning
248 : : // additionally to a identically named implementation in crsrsh.hxx
249 : : // here all existing selections are being reset before setting the
250 : : // cursor
251 : : sal_Bool GotoPage( sal_uInt16 nPage, sal_Bool bRecord );
252 : :
253 : : // setting the cursor; remember the old position for turning back
254 : : DECL_LINK( ExecFlyMac, void * );
255 : :
256 : : sal_Bool PageCrsr(SwTwips lOffset, sal_Bool bSelect);
257 : :
258 : : // update fields
259 : : void UpdateInputFlds( SwInputFieldList* pLst = 0, sal_Bool bOnlyInSel = sal_False );
260 : :
261 : : void NoEdit(sal_Bool bHideCrsr = sal_True);
262 : : void Edit();
263 : : sal_Bool IsNoEdit() const { return bNoEdit; }
264 : :
265 : 53 : sal_Bool IsRetainSelection() const { return mbRetainSelection; }
266 : 0 : void SetRetainSelection( sal_Bool bRet ) { mbRetainSelection = bRet; }
267 : :
268 : : // change current data base and notify
269 : : void ChgDBData(const SwDBData& SwDBData);
270 : :
271 : : // delete
272 : : long DelToEndOfLine();
273 : : long DelToStartOfLine();
274 : : long DelLine();
275 : : long DelLeft();
276 : :
277 : : // also deletes the frame or sets the cursor in the frame when bDelFrm == sal_False
278 : : long DelRight();
279 : : long DelToEndOfPara();
280 : : long DelToStartOfPara();
281 : : long DelToEndOfSentence();
282 : : long DelToStartOfSentence();
283 : : long DelNxtWord();
284 : : long DelPrvWord();
285 : :
286 : : // checks whether a word selection exists.
287 : : // According to the rules for intelligent Cut / Paste
288 : : // surrounding spaces are cut out.
289 : : // returns type of word selection (see enum)
290 : : enum word {
291 : : NO_WORD = 0,
292 : : WORD_SPACE_BEFORE = 1,
293 : : WORD_SPACE_AFTER = 2,
294 : : WORD_NO_SPACE = 3
295 : : };
296 : : int IntelligentCut(int nSelectionType, sal_Bool bCut = sal_True);
297 : :
298 : : // edit
299 : : void Insert(SwField &, SwPaM *pCommentRange = NULL);
300 : : void Insert(const String &);
301 : : // graphic
302 : : void Insert( const String &rPath, const String &rFilter,
303 : : const Graphic &, SwFlyFrmAttrMgr * = 0,
304 : : sal_Bool bRule = sal_False );
305 : :
306 : : void InsertByWord( const String & );
307 : : void InsertPageBreak(const String *pPageDesc = 0, sal_uInt16 nPgNum = 0 );
308 : : void InsertLineBreak();
309 : : void InsertColumnBreak();
310 : : void InsertFootnote(const String &, sal_Bool bEndNote = sal_False, sal_Bool bEdit = sal_True );
311 : : void SplitNode( sal_Bool bAutoFormat = sal_False, sal_Bool bCheckTableStart = sal_True );
312 : : sal_Bool CanInsert();
313 : :
314 : : // indexes
315 : : void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
316 : : sal_Bool UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
317 : :
318 : : // numbering and bullets
319 : : /**
320 : : Turns on numbering or bullets.
321 : :
322 : : @param bNum sal_True: turn on numbering
323 : : sal_False: turn on bullets
324 : : */
325 : : void NumOrBulletOn(sal_Bool bNum); // #i29560#
326 : : void NumOrBulletOff(); // #i29560#
327 : : void NumOn();
328 : : void BulletOn();
329 : :
330 : : //OLE
331 : : void InsertObject( /*SvInPlaceObjectRef *pObj, */ // != 0 for clipboard
332 : : const svt::EmbeddedObjectRef&,
333 : : SvGlobalName *pName = 0, // != 0 create object accordingly
334 : : sal_Bool bActivate = sal_True,
335 : : sal_uInt16 nSlotId = 0); // SlotId for dialog
336 : :
337 : : sal_Bool InsertOleObject( const svt::EmbeddedObjectRef& xObj, SwFlyFrmFmt **pFlyFrmFmt = 0 );
338 : : void LaunchOLEObj( long nVerb = 0 ); // start server
339 : : sal_Bool IsOLEObj() const { return GetCntType() == CNT_OLE;}
340 : : virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
341 : : virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
342 : : const SwRect *pFlyPrtRect = 0,
343 : : const SwRect *pFlyFrmRect = 0,
344 : : const bool bNoTxtFrmPrtAreaChanged = false );
345 : : virtual void ConnectObj( svt::EmbeddedObjectRef& xIPObj, const SwRect &rPrt,
346 : : const SwRect &rFrm );
347 : :
348 : : // styles and formats
349 : :
350 : : // enum tells when should happen when the style was not found
351 : : enum GetStyle { GETSTYLE_NOCREATE, // create none
352 : : GETSTYLE_CREATESOME, // if on PoolId create mapt
353 : : GETSTYLE_CREATEANY }; // return standard if applicable
354 : :
355 : : SwTxtFmtColl* GetParaStyle(const String &rCollName,
356 : : GetStyle eCreate = GETSTYLE_NOCREATE);
357 : : SwCharFmt* GetCharStyle(const String &rFmtName,
358 : : GetStyle eCreate = GETSTYLE_NOCREATE);
359 : : SwFrmFmt* GetTblStyle(const String &rFmtName);
360 : :
361 : : void SetPageStyle(const String &rCollName);
362 : :
363 : : String GetCurPageStyle( const sal_Bool bCalcFrm = sal_True ) const;
364 : :
365 : : // change current style using the attributes in effect
366 : : void QuickUpdateStyle();
367 : :
368 : : enum DoType { UNDO, REDO, REPEAT };
369 : :
370 : : void Do( DoType eDoType, sal_uInt16 nCnt = 1 );
371 : : String GetDoString( DoType eDoType ) const;
372 : : String GetRepeatString() const;
373 : : sal_uInt16 GetDoStrings( DoType eDoType, SfxStringListItem& rStrLstItem ) const;
374 : :
375 : : // search and replace
376 : : sal_uLong SearchPattern(const com::sun::star::util::SearchOptions& rSearchOpt,
377 : : sal_Bool bSearchInNotes,
378 : : SwDocPositions eStart, SwDocPositions eEnde,
379 : : FindRanges eFlags = FND_IN_BODY,
380 : : int bReplace = sal_False );
381 : :
382 : : sal_uLong SearchTempl (const String &rTempl,
383 : : SwDocPositions eStart, SwDocPositions eEnde,
384 : : FindRanges eFlags = FND_IN_BODY,
385 : : const String* pReplTempl = 0 );
386 : :
387 : : sal_uLong SearchAttr (const SfxItemSet& rFindSet,
388 : : sal_Bool bNoColls,
389 : : SwDocPositions eStart,SwDocPositions eEnde,
390 : : FindRanges eFlags = FND_IN_BODY,
391 : : const com::sun::star::util::SearchOptions* pSearchOpt = 0,
392 : : const SfxItemSet* pReplaceSet = 0);
393 : :
394 : : void AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar = ' ' );
395 : :
396 : : // action ahead of cursor movement
397 : : // resets selection if applicable, triggers timer and GCAttr()
398 : : void MoveCrsr( sal_Bool bWithSelect = sal_False );
399 : :
400 : : // update input fields
401 : : sal_Bool StartInputFldDlg(SwField*, sal_Bool bNextButton, Window* pParentWin = 0, rtl::OString* pWindowState = 0);
402 : : // update DropDown fields
403 : : sal_Bool StartDropDownFldDlg(SwField*, sal_Bool bNextButton, rtl::OString* pWindowState = 0);
404 : :
405 : : //"Handler" for changes at DrawView - for controls.
406 : : virtual void DrawSelChanged( );
407 : :
408 : : // jump to bookmark and set the "selctions-flags" correctly again
409 : : sal_Bool GotoMark( const ::sw::mark::IMark* const pMark );
410 : : sal_Bool GotoMark( const ::sw::mark::IMark* const pMark, sal_Bool bSelect, sal_Bool bStart );
411 : : sal_Bool GotoMark( const ::rtl::OUString& rName );
412 : : sal_Bool GoNextBookmark(); // sal_True when there still was one
413 : : sal_Bool GoPrevBookmark();
414 : :
415 : : bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark);
416 : :
417 : : sal_Bool GotoField( const SwFmtFld& rFld );
418 : :
419 : : // jump to the next / previous hyperlink - inside text and also
420 : : // on graphics
421 : : sal_Bool SelectNextPrevHyperlink( sal_Bool bNext = sal_True );
422 : :
423 : : // determine corresponding SwView
424 : 29893 : const SwView& GetView() const { return rView; }
425 : 56624 : SwView& GetView() { return rView; }
426 : :
427 : : // Because nobody else is doing it, here is a ExecMacro()
428 : : void ExecMacro( const SvxMacro& rMacro, String* pRet = 0, SbxArray* pArgs = 0 );
429 : : // call into the dark Basic/JavaScript
430 : : sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
431 : : sal_Bool bCheckPtr = sal_False, SbxArray* pArgs = 0,
432 : : const Link* pCallBack = 0 );
433 : :
434 : : // a click at the given field. the cursor is on it.
435 : : // execute the predefined actions.
436 : : void ClickToField( const SwField& rFld );
437 : : void ClickToINetAttr( const SwFmtINetFmt& rItem, sal_uInt16 nFilter = URLLOAD_NOFILTER );
438 : : sal_Bool ClickToINetGrf( const Point& rDocPt, sal_uInt16 nFilter = URLLOAD_NOFILTER );
439 : : inline sal_Bool IsInClickToEdit() const ;
440 : :
441 : : // if a URL-Button is selected, return its URL; otherwise an empty string
442 : : sal_Bool GetURLFromButton( String& rURL, String& rDescr ) const;
443 : :
444 : : void NavigatorPaste( const NaviContentBookmark& rBkmk,
445 : : const sal_uInt16 nAction );
446 : :
447 : : virtual void ApplyViewOptions( const SwViewOption &rOpt );
448 : : virtual void SetReadonlyOption( sal_Bool bSet );
449 : :
450 : : // automatic update of styles
451 : : void AutoUpdateFrame(SwFrmFmt* pFmt, const SfxItemSet& rStyleSet);
452 : : void AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM = NULL );
453 : :
454 : : // link for inserting ranges via Drag&Drop/Clipboard
455 : : DECL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSectionData* );
456 : :
457 : :
458 : : // ctor, the first one is a kind of a controlled copy ctor for more views of a document
459 : : SwWrtShell( SwWrtShell&, Window *pWin, SwView &rShell);
460 : : SwWrtShell( SwDoc& rDoc, Window *pWin, SwView &rShell,
461 : : const SwViewOption *pViewOpt = 0);
462 : : virtual ~SwWrtShell();
463 : :
464 : : sal_Bool TryRemoveIndent(); // #i23725#
465 : :
466 : : String GetSelDescr() const;
467 : :
468 : : SwNavigationMgr& GetNavigationMgr();
469 : : void addCurrentPosition();
470 : : sal_Bool GotoFly( const String& rName, FlyCntType eType = FLYCNTTYPE_ALL,
471 : : sal_Bool bSelFrame = sal_True );
472 : : sal_Bool GotoINetAttr( const SwTxtINetFmt& rAttr );
473 : : void GotoOutline( sal_uInt16 nIdx );
474 : : sal_Bool GotoOutline( const String& rName );
475 : : sal_Bool GotoRegion( const String& rName );
476 : : sal_Bool GotoRefMark( const String& rRefMark, sal_uInt16 nSubType = 0,
477 : : sal_uInt16 nSeqNo = 0 );
478 : : sal_Bool GotoNextTOXBase( const String* pName = 0);
479 : : sal_Bool GotoTable( const String& rName );
480 : : sal_Bool GotoFld( const SwFmtFld& rFld );
481 : : const SwRedline* GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect = sal_False);
482 : :
483 : : void ChangeHeaderOrFooter(const String& rStyleName, sal_Bool bHeader, sal_Bool bOn, sal_Bool bShowWarning);
484 : : virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow );
485 : :
486 : : private:
487 : :
488 : : SW_DLLPRIVATE void OpenMark();
489 : : SW_DLLPRIVATE void CloseMark( sal_Bool bOkFlag );
490 : :
491 : : SW_DLLPRIVATE String GetWrdDelim();
492 : : SW_DLLPRIVATE String GetSDelim();
493 : : SW_DLLPRIVATE String GetBothDelim();
494 : :
495 : : struct ModeStack
496 : : {
497 : : ModeStack *pNext;
498 : : sal_Bool bAdd,
499 : : bBlock,
500 : : bExt,
501 : : bIns;
502 : 0 : ModeStack(ModeStack *pNextMode, sal_Bool _bIns, sal_Bool _bExt, sal_Bool _bAdd, sal_Bool _bBlock):
503 : : pNext(pNextMode),
504 : : bAdd(_bAdd),
505 : : bBlock(_bBlock),
506 : : bExt(_bExt),
507 : 0 : bIns(_bIns)
508 : 0 : {}
509 : : } *pModeStack;
510 : :
511 : : // carry cursor along when PageUp / -Down
512 : : enum PageMove
513 : : {
514 : : MV_NO,
515 : : MV_PAGE_UP,
516 : : MV_PAGE_DOWN
517 : : } ePageMove;
518 : :
519 : : struct CrsrStack
520 : : {
521 : : Point aDocPos;
522 : : CrsrStack *pNext;
523 : : sal_Bool bValidCurPos : 1;
524 : : sal_Bool bIsFrmSel : 1;
525 : : SwTwips lOffset;
526 : :
527 : 0 : CrsrStack( sal_Bool bValid, sal_Bool bFrmSel, const Point &rDocPos,
528 : : SwTwips lOff, CrsrStack *pN )
529 : : : aDocPos(rDocPos),
530 : : pNext(pN),
531 : : bValidCurPos( bValid ),
532 : : bIsFrmSel( bFrmSel ),
533 : 0 : lOffset(lOff)
534 : : {
535 : :
536 : :
537 : 0 : }
538 : :
539 : : } *pCrsrStack;
540 : :
541 : : SwView &rView;
542 : : SwNavigationMgr aNavigationMgr;
543 : :
544 : : Point aDest;
545 : : sal_Bool bDestOnStack;
546 : 2972 : sal_Bool HasCrsrStack() const { return 0 != pCrsrStack; }
547 : : SW_DLLPRIVATE sal_Bool PushCrsr(SwTwips lOffset, sal_Bool bSelect);
548 : : SW_DLLPRIVATE sal_Bool PopCrsr(sal_Bool bUpdate, sal_Bool bSelect = sal_False);
549 : :
550 : : // take END cursor along when PageUp / -Down
551 : : SW_DLLPRIVATE sal_Bool _SttWrd();
552 : : SW_DLLPRIVATE sal_Bool _EndWrd();
553 : : SW_DLLPRIVATE sal_Bool _NxtWrd();
554 : : SW_DLLPRIVATE sal_Bool _PrvWrd();
555 : : // #i92468#
556 : : SW_DLLPRIVATE sal_Bool _NxtWrdForDelete();
557 : : SW_DLLPRIVATE sal_Bool _PrvWrdForDelete();
558 : : SW_DLLPRIVATE sal_Bool _FwdSentence();
559 : : SW_DLLPRIVATE sal_Bool _BwdSentence();
560 : : sal_Bool _FwdPara();
561 : : SW_DLLPRIVATE sal_Bool _BwdPara();
562 : :
563 : : // selections
564 : : sal_Bool bIns :1;
565 : : sal_Bool bInSelect :1;
566 : : sal_Bool bExtMode :1;
567 : : sal_Bool bAddMode :1;
568 : : sal_Bool bBlockMode :1;
569 : : sal_Bool bLayoutMode :1;
570 : : sal_Bool bNoEdit :1;
571 : : sal_Bool bCopy :1;
572 : : sal_Bool bSelWrd :1;
573 : : sal_Bool bSelLn :1;
574 : : sal_Bool bIsInClickToEdit:1;
575 : : sal_Bool bClearMark :1; // don't delete selection for ChartAutoPilot
576 : : sal_Bool mbRetainSelection :1; // Do not remove selections
577 : :
578 : : Point aStart;
579 : : Link aSelTblLink;
580 : :
581 : : // resets the cursor stack after movement by PageUp/-Down
582 : : SW_DLLPRIVATE void _ResetCursorStack();
583 : :
584 : : SW_DLLPRIVATE void SttDragDrop(Timer *);
585 : :
586 : : using SwCrsrShell::SetCrsr;
587 : : SW_DLLPRIVATE long SetCrsr(const Point *, sal_Bool bProp=sal_False );
588 : :
589 : : SW_DLLPRIVATE long SetCrsrKillSel(const Point *, sal_Bool bProp=sal_False );
590 : :
591 : : SW_DLLPRIVATE long StdSelect(const Point *, sal_Bool bProp=sal_False );
592 : : SW_DLLPRIVATE long BeginDrag(const Point *, sal_Bool bProp=sal_False );
593 : : SW_DLLPRIVATE long Drag(const Point *, sal_Bool bProp=sal_False );
594 : : SW_DLLPRIVATE long EndDrag(const Point *, sal_Bool bProp=sal_False );
595 : :
596 : : SW_DLLPRIVATE long ExtSelWrd(const Point *, sal_Bool bProp=sal_False );
597 : : SW_DLLPRIVATE long ExtSelLn(const Point *, sal_Bool bProp=sal_False );
598 : :
599 : : // move text from Drag and Drop; Point is destination for all selections.
600 : : SW_DLLPRIVATE long MoveText(const Point *, sal_Bool bProp=sal_False );
601 : :
602 : : SW_DLLPRIVATE long BeginFrmDrag(const Point *, sal_Bool bProp=sal_False );
603 : :
604 : : // after SSize/Move of a frame update; Point is destination.
605 : : SW_DLLPRIVATE long UpdateLayoutFrm(const Point *, sal_Bool bProp=sal_False );
606 : :
607 : : SW_DLLPRIVATE long SttLeaveSelect(const Point *, sal_Bool bProp=sal_False );
608 : : SW_DLLPRIVATE long AddLeaveSelect(const Point *, sal_Bool bProp=sal_False );
609 : : SW_DLLPRIVATE long Ignore(const Point *, sal_Bool bProp=sal_False );
610 : :
611 : 0 : SW_DLLPRIVATE void LeaveExtSel() { bSelWrd = bSelLn = sal_False;}
612 : :
613 : : SW_DLLPRIVATE sal_Bool GoStart(sal_Bool KeepArea = sal_False, sal_Bool * = 0,
614 : : sal_Bool bSelect = sal_False, sal_Bool bDontMoveRegion = sal_False);
615 : : SW_DLLPRIVATE sal_Bool GoEnd(sal_Bool KeepArea = sal_False, sal_Bool * = 0);
616 : :
617 : : enum BookMarkMove
618 : : {
619 : : BOOKMARK_INDEX,
620 : : BOOKMARK_NEXT,
621 : : BOOKMARK_PREV,
622 : : BOOKMARK_LAST_LAST_ENTRY
623 : : };
624 : :
625 : : SW_DLLPRIVATE sal_Bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=NULL);
626 : : };
627 : :
628 : 2972 : inline void SwWrtShell::ResetCursorStack()
629 : : {
630 [ - + ]: 2972 : if ( HasCrsrStack() )
631 : 0 : _ResetCursorStack();
632 : 2972 : }
633 : :
634 : 0 : inline void SwWrtShell::SelTblCells(const Link &rLink, sal_Bool bMark )
635 : : {
636 : 0 : SetSelTblCells( sal_True );
637 : 0 : bClearMark = bMark;
638 : 0 : aSelTblLink = rLink;
639 : 0 : }
640 : 0 : inline void SwWrtShell::EndSelTblCells()
641 : : {
642 : 0 : SetSelTblCells( sal_False );
643 : 0 : bClearMark = sal_True;
644 : 0 : }
645 : :
646 : 0 : inline sal_Bool SwWrtShell::IsInClickToEdit() const { return bIsInClickToEdit; }
647 : :
648 : 0 : inline sal_Bool SwWrtShell::Is_FnDragEQBeginDrag() const
649 : : {
650 : : #ifdef GCC
651 : 0 : SELECTFUNC fnTmp = &SwWrtShell::BeginDrag;
652 [ # # ][ # # ]: 0 : return fnDrag == fnTmp;
[ # # ]
653 : : #else
654 : : return sal::static_int_cast< sal_Bool >(fnDrag == &SwWrtShell::BeginDrag);
655 : : #endif
656 : : }
657 : :
658 : : #endif
659 : :
660 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|