1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
|
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: crsrsh.hxx,v $
*
* $Revision: 1.32 $
*
* last change: $Author: rt $ $Date: 2005-09-09 01:37:40 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#ifndef _CRSRSH_HXX
#define _CRSRSH_HXX
#ifndef _STRING_HXX //autogen
#include <tools/string.hxx>
#endif
#ifndef _LINK_HXX //autogen
#include <tools/link.hxx>
#endif
#ifndef _RTTI_HXX //autogen
#include <tools/rtti.hxx>
#endif
#ifndef INCLUDED_SWDLLAPI_H
#include "swdllapi.h"
#endif
#ifndef _SWTYPES_HXX
#include <swtypes.hxx> // fuer SWPOSDOC
#endif
#ifndef _VIEWSH_HXX
#include <viewsh.hxx> // fuer ViewShell
#endif
#ifndef _CALBCK_HXX
#include <calbck.hxx> // fuer SwClient
#endif
#ifndef _CSHTYP_HXX
#include <cshtyp.hxx> // fuer die CursorShell Typen
#endif
#ifndef _CRSTATE_HXX
#include <crstate.hxx> // fuer die CursorMove-Staties
#endif
#ifndef _BKMRKE_HXX //autogen
#include <bkmrke.hxx>
#endif
#ifndef _TOXE_HXX
#include <toxe.hxx> // SwTOXSearchDir
#endif
#ifndef _TBLSEL_HXX
#include <tblsel.hxx> //SwTblSearchType
#endif
#if defined(PRODUCT) && !defined(WIN)
// fuer die Inline-Methoden
#ifndef _VISCRS_HXX
#include <viscrs.hxx>
#endif
#ifndef _NODE_HXX
#include <node.hxx>
#endif
#define CRSR_INLINE inline
#else
#define CRSR_INLINE
#endif
#ifndef _TBLSEL_HXX
#include <tblsel.hxx>
#endif
// einige Forward Deklarationen
class KeyCode;
class Region;
class SfxItemSet;
class SfxPoolItem;
class SpellCheck;
class SwBookmark;
class SwCntntFrm;
class SwCrsrShell;
class SwCursor;
class SwField;
class SwFieldType;
class SwFmt;
class SwFmtFld;
class SwIndex;
class SwNodeIndex;
class SwNode;
class SwNodes;
class SwPaM;
class SwSelBoxes;
class SwShellCrsr;
class SwShellTableCrsr;
class SwTableNode;
class SwTxtFmtColl;
class SwVisCrsr;
class SwTxtINetFmt;
class SwFmtINetFmt;
class SwTxtAttr;
class SwTableBox;
class SwCellFrms;
class SwTOXMark;
class SwRedline;
class SwCntntNode; // #i23726#
struct SwPosition;
namespace com { namespace sun { namespace star { namespace util {
struct SearchOptions;
} } } }
// enum und struktur, um ueber die Doc-Position Informationen zu erfragen
struct SwContentAtPos
{
enum IsAttrAtPos
{
SW_NOTHING = 0x0000,
SW_FIELD = 0x0001,
SW_CLICKFIELD = 0x0002,
SW_FTN = 0x0004,
SW_INETATTR = 0x0008,
SW_TABLEBOXFML = 0x0010,
SW_REDLINE = 0x0020,
SW_OUTLINE = 0x0040,
SW_TOXMARK = 0x0080,
SW_REFMARK = 0x0100,
SW_NUMLABEL = 0x0200 // #i23726#
#ifndef PRODUCT
,SW_CURR_ATTRS = 0x4000 // nur zum Debuggen
,SW_TABLEBOXVALUE = 0x8000 // nur zum Debuggen
#endif
} eCntntAtPos;
union {
const SwField* pFld;
const SfxPoolItem* pAttr;
const SwRedline* pRedl;
SwCntntNode * pNode; // #i23726#
} aFnd;
int nDist; // #i23726#
String sStr;
const SwTxtAttr* pFndTxtAttr;
SwContentAtPos( int eGetAtPos = 0xffff )
: eCntntAtPos( (IsAttrAtPos)eGetAtPos )
{
aFnd.pFld = 0;
pFndTxtAttr = 0;
nDist = 0; // #i23726#
}
// befindet sich der Node in einem geschuetzten Bereich?
FASTBOOL IsInProtectSect() const;
bool IsInRTLText()const;
};
// ReturnWerte von SetCrsr (werden verodert)
const int CRSR_NOERROR = 0x00,
CRSR_POSOLD = 0x01, // Cursor bleibt an alter Doc-Position
CRSR_POSCHG = 0x02; // Position vom Layout veraendert
// die Cursor - Shell
class SW_DLLPUBLIC SwCrsrShell : public ViewShell, public SwModify
{
friend class SwCallLink;
friend class SwVisCrsr;
friend class SwSelPaintRects;
friend class SwChgLinkFlag;
//Braucht den Crsr als IntrnlCrsr.
friend void GetTblSel( const SwCrsrShell& rShell, SwSelBoxes& rBoxes,
const SwTblSearchType eSearchType);
friend BOOL GetAutoSumSel( const SwCrsrShell&, SwCellFrms& );
public: // public, damit defaultet werden kann !!
/* ein enum fuer den Aufruf von UpdateCrsr */
enum CrsrFlag {
UPDOWN = (1 << 0), // Up/Down auf Spalte halten
SCROLLWIN = (1 << 1), // Window Scrollen
CHKRANGE = (1 << 2), // ueberpruefen von ueberlappenden PaM's
NOCALRECT = (1 << 3), // CharRect nicht neu berechnen
READONLY = (1 << 4) // Sichtbar machen trotz Readonly
};
private:
SwRect aCharRect; // Char-SRectangle auf dem der Cursor steht
Point aCrsrHeight; // Hohe&Offset von sichtbaren Cursor
Point aOldRBPos; // Right/Bottom von letzter VisArea
// (wird im Invalidate vom Cursor benutzt)
// um event. Macro was anhaengt auszufuehren.
Link aFlyMacroLnk; // Link will be called, if the Crsr is set
// into a fly. A macro can be then becalled
Link aChgLnk; // link will be called by every attribut/
// format changes at cursor position.
Link aGrfArrivedLnk; // Link calls to UI if a grafik is arrived
SwShellCrsr* pCurCrsr; // der aktuelle Cursor
SwShellCrsr* pCrsrStk; // Stack fuer den Cursor
SwVisCrsr *pVisCrsr; // der Sichtbare-Cursor
SwShellTableCrsr* pTblCrsr; // Tabellen-Crsr; nur in Tabellen, wenn
// die Selection ueber 2 Spalten liegt
SwNodeIndex* pBoxIdx; // fuers erkennen der veraenderten
SwTableBox* pBoxPtr; // Tabellen-Zelle
long nUpDownX; // versuche den Cursor bei Up/Down immer in
// der gleichen Spalte zu bewegen
long nLeftFrmPos;
ULONG nAktNode; // save CursorPos at Start-Action
xub_StrLen nAktCntnt;
USHORT nAktNdTyp;
bool bAktSelection;
/*
* Mit den Methoden SttCrsrMove und EndCrsrMove wird dieser Zaehler
* Inc-/Decrementiert. Solange der Zaehler ungleich 0 ist, erfolgt
* auf den akt. Cursor kein Update. Dadurch koennen "komplizierte"
* Cursorbewegungen (ueber Find()) realisiert werden.
*/
USHORT nCrsrMove;
USHORT nBasicActionCnt; // Actions, die vom Basic geklammert wurden
CrsrMoveState eMvState; // Status fuers Crsr-Travelling - GetCrsrOfst
// -> #i27615#
/**
marked numbering rule
If a numbering level/rule are marked, changes to character
attributes are propagated to the according numbering style.
*/
String sMarkedNumRule;
/**
marked numbering level
If a numbering level/rule are marked, changes to character
attributes are propagated to the according numbering style.
*/
BYTE nMarkedNumLevel;
// <- #i27615#
BOOL bHasFocus : 1; // Shell ist in einem Window "aktiv"
BOOL bSVCrsrVis : 1; // SV-Cursor Un-/Sichtbar
BOOL bChgCallFlag : 1; // Attributaenderung innerhalb von
// Start- und EndAction
BOOL bVisPortChgd : 1; // befindet sich im VisPortChg-Aufruf
// (wird im Invalidate vom Cursor benutzt)
BOOL bCallChgLnk : 1; // Flag fuer abgeleitete Klassen:
// TRUE -> ChgLnk callen
// Zugriff nur ueber SwChgLinkFlag
BOOL bAllProtect : 1; // Flag fuer Bereiche
// TRUE -> alles geschuetzt / versteckt
BOOL bInCMvVisportChgd : 1; // Flag fuer CrsrMoves
// TRUE -> die Sicht wurde verschoben
BOOL bGCAttr : 1; // TRUE -> es existieren nichtaufgespannte Attr.
BOOL bIgnoreReadonly : 1; // TRUE -> Beim naechsten EndAction trotz
// Readonly den Crsr sichtbar machen.
BOOL bSelTblCells : 1; // TRUE -> Zellen uebers InputWin selektieren
BOOL bAutoUpdateCells : 1; // TRUE -> Zellen werden autoformatiert
BOOL bBasicHideCrsr : 1; // TRUE -> HideCrsr vom Basic
BOOL bSetCrsrInReadOnly : 1;// TRUE -> Cursor darf in ReadOnly-Bereiche
BOOL bOverwriteCrsr : 1; // TRUE -> show Overwrite Crsr
// OD 11.02.2003 #100556# - flag to allow/avoid execution of marcos (default: true)
bool mbMacroExecAllowed : 1;
SW_DLLPRIVATE void UpdateCrsr( USHORT eFlags
=SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE,
BOOL bIdleEnd = FALSE );
SW_DLLPRIVATE void _ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing );
// -> #i27615#
/**
Updates the marked numbering level stored in this shell
according to the cursor.
*/
SW_DLLPRIVATE void UpdateMarkedNumLevel();
/**
Set the marked numbering level stored in this shell.
@param sNumRule the name of the marked numbering rule
@param nLevel the marked numbering level
The empty string denotes that no numbering rule is marked.
*/
SW_DLLPRIVATE void SetMarkedNumLevel(const String & sNumRule, BYTE nLevel);
// <- #i27615#
// private method(s) accessed from public inline method(s) must be exported.
FASTBOOL LeftRight( BOOL, USHORT, USHORT, BOOL );
SW_DLLPRIVATE FASTBOOL UpDown( BOOL, USHORT );
SW_DLLPRIVATE FASTBOOL LRMargin( BOOL, BOOL bAPI = FALSE );
SW_DLLPRIVATE FASTBOOL IsAtLRMargin( BOOL, BOOL bAPI = FALSE ) const;
FASTBOOL SttEndDoc( BOOL bStt );
#ifdef BIDI
SW_DLLPRIVATE short GetTextDirection( const Point* pPt = 0 ) const;
#endif
typedef FASTBOOL (SwCursor:: *FNCrsr)();
SW_DLLPRIVATE FASTBOOL CallCrsrFN( FNCrsr );
SW_DLLPRIVATE const SwRedline* _GotoRedline( USHORT nArrPos, BOOL bSelect );
protected:
CRSR_INLINE SwMoveFnCollection* MakeFindRange( USHORT, USHORT, SwPaM* ) const;
/*
* Compare-Methode for the StackCursor and the current Cursor.
* The Methods return -1, 0, 1 for lower, equal, greater. The enum
* CrsrCompareType says which position is compared.
*/
enum CrsrCompareType {
StackPtStackMk,
StackPtCurrPt,
StackPtCurrMk,
StackMkCurrPt,
StackMkCurrMk,
CurrPtCurrMk
};
int CompareCursor( CrsrCompareType eType ) const;
USHORT IncBasicAction() { return ++nBasicActionCnt; }
USHORT DecBasicAction() { return --nBasicActionCnt; }
// Setzt alle PaMs in OldNode auf NewPos + Offset
void PaMCorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos,
const xub_StrLen nOffset = 0 );
// Setzt alle PaMs im Bereich von [StartNode, EndNode] nach NewPos
void PaMCorrAbs(const SwNodeIndex &rStartNode, const SwNodeIndex &rEndNode,
const SwPosition &rNewPos );
// --> FME 2004-07-30 #i32329# Enhanced table selection
FASTBOOL _SelTblRowOrCol( bool bRow, bool bRowSimple = false );
// <--
// --> FME 2005-01-31 #i41424# Only update the marked number levels if necessary
bool SetInFrontOfLabel( FASTBOOL bNew );
// <--
public:
TYPEINFO();
SwCrsrShell( SwDoc& rDoc, Window *pWin,
SwRootFrm * = 0, const SwViewOption *pOpt = 0 );
// verkleideter Copy-Constructor
SwCrsrShell( SwCrsrShell& rShell, Window *pWin );
virtual ~SwCrsrShell();
virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
// neuen Cusror erzeugen und den alten anhaengen
SwPaM * CreateCrsr();
// loesche den aktuellen Cursor und der folgende wird zum Aktuellen
FASTBOOL DestroyCrsr();
// TableCursor in normale Cursor verwandeln, Tablemode aufheben
void TblCrsrToCursor();
SwPaM* GetCrsr( FASTBOOL bMakeTblCrsr = TRUE ) const;
CRSR_INLINE SwCursor* GetSwCrsr( FASTBOOL bMakeTblCrsr = TRUE ) const;
// nur den akt. Cursor returnen
SwShellCrsr* _GetCrsr() { return pCurCrsr; }
const SwShellCrsr* _GetCrsr() const { return pCurCrsr; }
// uebergebenen Cursor anzeigen - fuer UNO
void SetSelection(const SwPaM& rCrsr);
// alle Cursor aus den ContentNodes entfernen und auf 0 setzen.
// Wurde aus der FEShell hierher verschoben.
void ParkCrsr( const SwNodeIndex &rIdx );
// gebe den akt. Cursor-Stack zurueck.
// ( Wird in der EditShell beim Loeschen von Inhalten benoetigt! )
CRSR_INLINE SwPaM* GetStkCrsr() const;
// Start der Klammerung, SV-Cursor und selektierte Bereiche hiden
void StartAction();
// Ende der Klammerung, SV-Cursor und selektierte Bereiche anzeigen
void EndAction( const BOOL bIdleEnd = FALSE );
USHORT GetBasicActionCnt() const { return nBasicActionCnt; }
// Basiscursortravelling
long GetUpDownX() const { return nUpDownX; }
FASTBOOL Left( USHORT nCnt, USHORT nMode, BOOL bAllowVisual = FALSE )
{ return LeftRight( TRUE, nCnt, nMode, bAllowVisual ); }
FASTBOOL Right( USHORT nCnt, USHORT nMode, BOOL bAllowVisual = FALSE )
{ return LeftRight( FALSE, nCnt, nMode, bAllowVisual ); }
FASTBOOL Up( USHORT nCnt = 1 ) { return UpDown( TRUE, nCnt ); }
FASTBOOL Down( USHORT nCnt = 1 ) { return UpDown( FALSE, nCnt ); }
FASTBOOL LeftMargin() { return LRMargin( TRUE ); }
FASTBOOL RightMargin(BOOL bAPI = FALSE) { return LRMargin( FALSE, bAPI ); }
FASTBOOL SttDoc() { return SttEndDoc( TRUE ); }
FASTBOOL EndDoc() { return SttEndDoc( FALSE ); }
FASTBOOL MovePage( SwWhichPage, SwPosPage );
FASTBOOL MovePara( SwWhichPara, SwPosPara );
FASTBOOL MoveSection( SwWhichSection, SwPosSection );
FASTBOOL MoveTable( SwWhichTable, SwPosTable );
FASTBOOL MoveColumn( SwWhichColumn, SwPosColumn );
FASTBOOL MoveRegion( SwWhichRegion, SwPosRegion );
// die Suchfunktionen
ULONG Find( const com::sun::star::util::SearchOptions& rSearchOpt,
SwDocPositions eStart, SwDocPositions eEnde,
BOOL& bCancel,
FindRanges eRng, int bReplace = FALSE );
ULONG Find( const SwTxtFmtColl& rFmtColl,
SwDocPositions eStart, SwDocPositions eEnde,
BOOL& bCancel,
FindRanges eRng, const SwTxtFmtColl* pReplFmt = 0 );
ULONG Find( const SfxItemSet& rSet, FASTBOOL bNoCollections,
SwDocPositions eStart, SwDocPositions eEnde,
BOOL& bCancel,
FindRanges eRng,
const com::sun::star::util::SearchOptions* pSearchOpt = 0,
const SfxItemSet* rReplSet = 0 );
// Positionieren des Cursors
// returnt
// CRSR_POSCHG: wenn der ob der SPoint vom Layout korrigiert wurde.
// CRSR_POSOLD: wenn der Crsr nicht veraendert wurde
int SetCrsr( const Point &rPt, BOOL bOnlyText = FALSE );
/*
* Benachrichtung, dass der sichtbare Bereich sich geaendert
* hat. aVisArea wird neu gesetzt, anschliessend wird
* gescrollt. Das uebergebene Rectangle liegt auf
* Pixelgrenzen, um Pixelfehler beim Scrollen zu vermeiden.
*/
virtual void VisPortChgd( const SwRect & );
/*
* Virtuelle PaintMethode, damit die Selection nach dem Paint wieder
* sichtbar wird.
*/
void Paint( const Rectangle & rRect );
// Bereiche
CRSR_INLINE void SetMark();
CRSR_INLINE FASTBOOL HasMark();
void ClearMark();
/**
Ensure point and mark of the current PaM are in a specific order.
@param bPointFirst TRUE: If the point is behind the mark then
swap the PaM. FALSE: If the mark is behind the point then swap
the PaM.
*/
void NormalizePam(BOOL bPointFirst = TRUE);
void SwapPam();
FASTBOOL ChgCurrPam( const Point & rPt,
BOOL bTstOnly = TRUE, //Nur testen, nicht setzen
BOOL bTstHit = FALSE ); //Nur genaue Treffer
void KillPams();
// erzeuge eine Kopie vom Cursor und speicher diese im Stack
void Push();
/*
* Loescht einen Cursor (gesteuert durch bOldCrsr)
* - vom Stack oder ( bOldCrsr = TRUE )
* - den aktuellen und der auf dem Stack stehende wird zum aktuellen
*
* Return: es war auf dem Stack noch einer vorhanden
*/
FASTBOOL Pop( BOOL bOldCrsr = TRUE );
/*
* Verbinde zwei Cursor miteinander.
* Loesche vom Stack den obersten und setzen dessen Mark im Aktuellen.
*/
void Combine();
#if defined( PRODUCT )
void SttCrsrMove() { ++nCrsrMove; StartAction(); }
void EndCrsrMove( const BOOL bIdleEnd = FALSE )
{ EndAction( bIdleEnd ); --nCrsrMove; }
#else
void SttCrsrMove();
void EndCrsrMove( const BOOL bIdleEnd = FALSE );
#endif
/*
* Beim Abgeben des Focuses werden die selektierten Bereiche nicht mehr
* angezeigt; andererseits beim Erhalten des Focuses, werden alle selek-
* tierten Bereiche wieder angezeigt. (Bereiche muessen neu berechnet
* werden!)
*/
BOOL HasShFcs() const { return bHasFocus; }
void ShLooseFcs();
void ShGetFcs( BOOL bUpdate = TRUE );
// Methoden zum Anzeigen bzw. Verstecken des sichtbaren Text-Cursors
void ShowCrsr();
void HideCrsr();
// Methoden zum Anzeigen bzw. Verstecken der selektierten Bereiche mit
// dem sichtbaren Cursor
void ShowCrsrs( BOOL bCrsrVis );
void HideCrsrs();
// Methoden zum Anzeigen bzw. Verstecken der selektierten Bereiche mit
// dem sichtbaren Cursor
void BasicShowCrsrs()
{ bBasicHideCrsr = FALSE; bSVCrsrVis = TRUE; ShowCrsrs(TRUE); }
void BasicHideCrsrs()
{ HideCrsrs(); bBasicHideCrsr = TRUE; bSVCrsrVis = FALSE; }
FASTBOOL IsBasicHideCrsr() const { return bBasicHideCrsr; }
FASTBOOL IsOverwriteCrsr() const { return bOverwriteCrsr; }
void SetOverwriteCrsr( FASTBOOL bFlag ) { bOverwriteCrsr = bFlag; }
// gebe den aktuellen Frame, in dem der Cursor steht, zurueck
SwCntntFrm *GetCurrFrm( const BOOL bCalcFrm = TRUE ) const;
//TRUE wenn der Crsr wenn der Crsr wegen Readonly gehidet ist,
//FALSE wenn der arbeitet (trotz Readonly).
FASTBOOL IsCrsrReadonly() const;
// Cursor steht in etwas geschuetztem oder in die Selektion umspannt
// etwas geschuetztes.
FASTBOOL HasReadonlySel() const;
// darf der Cursor in ReadOnlyBereiche?
FASTBOOL IsReadOnlyAvailable() const { return bSetCrsrInReadOnly; }
void SetReadOnlyAvailable( BOOL bFlag );
FASTBOOL IsOverReadOnlyPos( const Point& rPt ) const;
// Methoden fuer aFlyMacroLnk
void SetFlyMacroLnk( const Link& rLnk ) { aFlyMacroLnk = rLnk; }
const Link& GetFlyMacroLnk() const { return aFlyMacroLnk; }
// Methoden geben/aendern den Link fuer die Attribut/Format-Aenderungen
void SetChgLnk( const Link &rLnk ) { aChgLnk = rLnk; }
const Link& GetChgLnk() const { return aChgLnk; }
// Methoden geben/aendern den Link fuers "Grafik vollstaendig geladen"
void SetGrfArrivedLnk( const Link &rLnk ) { aGrfArrivedLnk = rLnk; }
const Link& GetGrfArrivedLnk() const { return aGrfArrivedLnk; }
//ChgLink callen, innerhalb einer Action wird der Ruf verzoegert.
void CallChgLnk();
// Abfrage, ob der aktuelle Cursor eine Selektion aufspannt,
// also, ob Mark gesetzt und SPoint und Mark unterschiedlich sind.
FASTBOOL HasSelection() const;
// Abfrage, ob ueberhaupt eine Selektion existiert, sprich der akt. Cursor
// aufgespannt oder nicht der einzigste ist.
CRSR_INLINE FASTBOOL IsSelection() const;
// returns if multiple cursors are available
CRSR_INLINE FASTBOOL IsMultiSelection() const;
// Abfrage, ob ein kompletter Absatz selektiert wurde
FASTBOOL IsSelFullPara() const;
// Abfrage, ob die Selektion in einem Absatz ist
CRSR_INLINE FASTBOOL IsSelOnePara() const;
//Sollte fuer das Clipboard der WaitPtr geschaltet werden.
FASTBOOL ShouldWait() const;
/*
* liefert das SRectangle, auf dem der Cursor steht.
*/
const SwRect &GetCharRect() const { return aCharRect; }
/*
* liefert zurueck, ob der Cursor sich ganz oder teilweise im
* sichtbaren Bereich befindet.
*/
FASTBOOL IsCrsrVisible() const { return VisArea().IsOver( GetCharRect() ); }
// gebe die aktuelle Seitennummer zurueck:
// TRUE: in der der Cursor steht
// FALSE: die am oberen Rand sichtbar ist
void GetPageNum( USHORT &rnPhyNum, USHORT &rnVirtNum,
BOOL bAtCrsrPos = TRUE, const BOOL bCalcFrm = TRUE );
// bestimme in welche Richtung "leere Seiten" behandelt werden!
// (wird benutzt im PhyPage.. )
USHORT GetNextPrevPageNum( BOOL bNext = TRUE );
// setze den Cursor auf die Seite "nPage" an den Anfang
FASTBOOL GotoPage( USHORT nPage );
// gebe alle Dokumentseiten zurueck
USHORT GetPageCnt();
// Gehe zur naechsten Selection
FASTBOOL GoNextCrsr();
// gehe zur vorherigen Selection
FASTBOOL GoPrevCrsr();
// am CurCrsr.SPoint
FASTBOOL SetBookmark( const KeyCode&, const String& rName,
const String& rShortName, BOOKMARK_TYPE eMark = BOOKMARK );
FASTBOOL GotoBookmark( USHORT ); // setzt CurCrsr.SPoint
FASTBOOL GotoBookmark( USHORT nPos, BOOL bAtStart ); //
FASTBOOL GoNextBookmark(); // TRUE, wenn's noch eine gab
FASTBOOL GoPrevBookmark();
USHORT GetBookmarkCnt(BOOL bBkmrk = FALSE) const;
SwBookmark& GetBookmark( USHORT, BOOL bBkmrk = FALSE );
void DelBookmark( USHORT );
void DelBookmark( const String& rName );
USHORT FindBookmark( const String& rName );
// erzeugt einen eindeutigen Namen. Der Name selbst muss vorgegeben
// werden, es wird dann bei gleichen Namen nur durchnumeriert.
void MakeUniqueBookmarkName( String& rNm );
// aktualisiere den Crsrs, d.H. setze ihn wieder in den Content.
// Das sollte nur aufgerufen werden, wenn der Cursor z.B. beim
// Loeschen von Rahmen irgendwohin gesetzt wurde. Die Position
// ergibt sich aus seiner aktuellen Position im Layout !!
void UpdateCrsrPos();
// returne den am akt. Cursor selektierten Text. Dieser wird mit
// Felder etc. aufgefuellt!!
String GetSelTxt() const;
// gebe nur den Text ab der akt. Cursor Position zurueck (bis zum NodeEnde)
String GetText() const;
// pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen
CRSR_INLINE const SwTableNode* IsCrsrInTbl( BOOL bIsPtInTbl = TRUE ) const;
// erfrage die Document - Layout - Position vom akt. Crsr
CRSR_INLINE Point& GetCrsrDocPos( BOOL bPoint = TRUE ) const;
CRSR_INLINE FASTBOOL IsCrsrPtAtEnd() const;
CRSR_INLINE const SwPaM* GetTblCrs() const;
CRSR_INLINE SwPaM* GetTblCrs();
FASTBOOL IsTblComplex() const;
FASTBOOL IsTblComplexForChart();
// erfrage die akt. TabellenSelektion als Text
String GetBoxNms() const;
// setze Crsr in die naechsten/vorherigen Celle
FASTBOOL GoNextCell( BOOL bAppendLine = TRUE );
FASTBOOL GoPrevCell();
// gehe zu dieser Box (wenn vorhanden und in Tabelle!)
FASTBOOL GotoTable( const String& rName );
FASTBOOL GotoTblBox( const String& rName );
// select a table row, column or box (based on the current cursor)
FASTBOOL SelTblRow() { return _SelTblRowOrCol( true ); }
FASTBOOL SelTblCol() { return _SelTblRowOrCol( false ); }
FASTBOOL SelTblBox();
// --> FME 2004-07-30 #i32329# Enhanced table selection
FASTBOOL SelTbl();
// <--
// zum naechsten/vorhergehenden Punkt auf gleicher Ebene
FASTBOOL GotoNextNum();
FASTBOOL GotoPrevNum();
// zu diesem Gliederungspunkt
FASTBOOL GotoOutline( const String& rName );
// zum naechsten/vorhergehenden oder angegebenen OultineNode
void GotoOutline( USHORT nIdx );
// suche die "Outline-Position" im Nodes-Array vom akt. Kaiptel
USHORT GetOutlinePos( BYTE nLevel = UCHAR_MAX );
// selektiere den angeben Bereich von OutlineNodes. Optional
// inclusive der Childs. Die USHORT sind die Positionen im
// OutlineNds-Array!! (EditShell)
FASTBOOL MakeOutlineSel( USHORT nSttPos, USHORT nEndPos,
BOOL bWithChilds = FALSE );
FASTBOOL GotoNextOutline(); // naechster Node mit Outline-Num.
FASTBOOL GotoPrevOutline(); // vorheriger Node mit Outline-Num.
// ist der Crsr in einer Tabelle und ist die Selection ueber
// zwei Spalten
FASTBOOL IsTableMode() const { return 0 != pTblCrsr; }
// erfrage den Tabellen Crsr; ausserhalb von Tabellen immer 0
const SwShellTableCrsr* GetTableCrsr() const { return pTblCrsr; }
SwShellTableCrsr* GetTableCrsr() { return pTblCrsr; }
USHORT UpdateTblSelBoxes();
FASTBOOL GotoFtnTxt(); // springe aus dem Content zur Fussnote
FASTBOOL GotoFtnAnchor(); // springe aus der Fussnote zum Anker
FASTBOOL GotoPrevFtnAnchor();
FASTBOOL GotoNextFtnAnchor();
FASTBOOL GotoFlyAnchor(); // springe aus dem Rahmen zum Anker
FASTBOOL GotoHeaderTxt(); // springe aus dem Content zum Header
FASTBOOL GotoFooterTxt(); // springe aus dem Content zum Footer
// springe in den Header/Footer des angegebenen oder akt. PageDesc
FASTBOOL SetCrsrInHdFt( USHORT nDescNo = USHRT_MAX,
FASTBOOL bInHeader = TRUE );
// is point of cursor in header/footer. pbInHeader return TRUE if it is
// in a headerframe otherwise in a footerframe
FASTBOOL IsInHeaderFooter( FASTBOOL* pbInHeader = 0 ) const;
// springe zum naechsten Verzeichnis [mit dem Namen]
FASTBOOL GotoNextTOXBase( const String* = 0 );
// springe zum vorherigen Verzeichnis [mit dem Namen]
FASTBOOL GotoPrevTOXBase( const String* = 0 );
FASTBOOL GotoTOXMarkBase(); // springe zum Verzeichnis vom TOXMark
// springe zum naechsten (vorherigen) Verzeichniseintrag
FASTBOOL GotoNxtPrvTOXMark( BOOL bNext = TRUE );
// Zur naechsten/ vorherigen Verzeichnismarke dieses Typs traveln
const SwTOXMark& GotoTOXMark( const SwTOXMark& rStart, SwTOXSearch eDir );
// springe zum naechsten (vorherigen) Tabellenformel
// optional auch nur zu kaputten Formeln springen
FASTBOOL GotoNxtPrvTblFormula( BOOL bNext = TRUE,
BOOL bOnlyErrors = FALSE );
// jump to the next / previous hyperlink - inside text and also
// on graphics
FASTBOOL SelectNxtPrvHyperlink( BOOL bNext = TRUE );
// springe zu dieser Refmark
FASTBOOL GotoRefMark( const String& rRefMark, USHORT nSubType = 0,
USHORT nSeqNo = 0 );
// hole vom Start/Ende der akt. Selection das nte Zeichen
sal_Unicode GetChar( BOOL bEnd = TRUE, long nOffset = 0 );
// erweiter die akt. Selection am Anfang/Ende um n Zeichen
FASTBOOL ExtendSelection( BOOL bEnd = TRUE, xub_StrLen nCount = 1 );
// setze nur den sichtbaren Cursor an die angegebene Dokument-Pos.
// returnt FALSE: wenn der ob der SPoint vom Layout korrigiert wurde.
// (wird zum Anzeigen von Drag&Drop/Copy-Cursor benoetigt)
FASTBOOL SetVisCrsr( const Point &rPt );
CRSR_INLINE void UnSetVisCrsr();
// springe zum nachsten/vorherigen Feld des entsprechenden Types
FASTBOOL MoveFldType( const SwFieldType* pFldType, BOOL bNext,
USHORT nSubType = USHRT_MAX,
USHORT nResType = USHRT_MAX );
// springe genau zu diesem Feld
FASTBOOL GotoFld( const SwFmtFld& rFld );
// returne die Anzahl der Cursor im Ring (Flag besagt ob man nur
// aufgepspannte haben will - sprich etwas selektiert ist (Basic))
USHORT GetCrsrCnt( BOOL bAll = TRUE ) const;
// Char Travelling - Methoden (in crstrvl1.cxx)
FASTBOOL GoStartWord();
FASTBOOL GoEndWord();
FASTBOOL GoNextWord();
FASTBOOL GoPrevWord();
FASTBOOL GoNextSentence();
FASTBOOL GoPrevSentence();
FASTBOOL GoStartSentence();
FASTBOOL GoEndSentence();
FASTBOOL GoStartPara();
FASTBOOL SelectWord( const Point* pPt = 0 );
// Abfrage vom CrsrTravelling Status
CrsrMoveState GetMoveState() const { return eMvState; }
// Position vom akt. Cursor erfragen
FASTBOOL IsStartWord()const;
FASTBOOL IsEndWord() const;
FASTBOOL IsInWord() const;
FASTBOOL IsStartSentence() const;
FASTBOOL IsEndSentence() const;
FASTBOOL IsSttPara() const;
FASTBOOL IsEndPara() const;
FASTBOOL IsStartOfDoc() const;
FASTBOOL IsEndOfDoc() const;
FASTBOOL IsInFrontOfLabel() const;
FASTBOOL IsAtLeftMargin() const { return IsAtLRMargin( TRUE ); }
FASTBOOL IsAtRightMargin(BOOL bAPI = FALSE) const { return IsAtLRMargin( FALSE, bAPI ); }
// loesche alle erzeugten Crsr, setze den Tabellen-Crsr und den letzten
// Cursor auf seinen TextNode (oder StartNode?).
// Beim naechsten ::GetCrsr werden sie wieder alle erzeugt.
// Wird fuers Drag&Drop/ClipBorad-Paste in Tabellen benoetigt.
FASTBOOL ParkTblCrsr();
// erfrage die selektierte "Region" aller Cursor (fuer D&D auf Mac)
Region GetCrsrRegion() const;
// gibt es nicht aufgespannte Attribute?
FASTBOOL IsGCAttr() const { return bGCAttr; }
void ClearGCAttr() { bGCAttr = FALSE; }
void UpdateAttr() { bGCAttr = TRUE; }
// ist das gesamte Dokument geschuetzt/versteckt?? (fuer UI,..)
FASTBOOL IsAllProtect() const { return bAllProtect; }
#ifdef SW_CRSR_TIMER
// setze das Flag am VisCrsr, ob dieser ueber Timer getriggert (TRUE)
// oder direkt (FALSE) angezeigt wird. (default ist Timer getriggert)
FASTBOOL ChgCrsrTimerFlag( BOOL bTimerOn = TRUE );
#endif
BOOL BasicActionPend() const { return nBasicActionCnt != nStartAction; }
// springe zum benannten Bereich
FASTBOOL GotoRegion( const String& rName );
// zeige die aktuelle Selektion an
virtual void MakeSelVisible();
// setzte den Cursor auf einen NICHT geschuetzten/versteckten Node
FASTBOOL FindValidCntntNode( BOOL bOnlyText = FALSE );
FASTBOOL GetContentAtPos( const Point& rPt,
SwContentAtPos& rCntntAtPos,
FASTBOOL bSetCrsr = FALSE,
SwRect* pFldRect = 0 );
FASTBOOL IsPageAtPos( const Point &rPt ) const;
// Attribut selelktieren
FASTBOOL SelectTxtAttr( USHORT nWhich, BOOL bExpand = FALSE,
const SwTxtAttr* pAttr = 0 );
FASTBOOL GotoINetAttr( const SwTxtINetFmt& rAttr );
const SwFmtINetFmt* FindINetAttr( const String& rName ) const;
FASTBOOL CheckTblBoxCntnt( const SwPosition* pPos = 0 );
void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
void ClearTblBoxCntnt();
FASTBOOL EndAllTblBoxEdit();
// wird gerufen, wenn eine Tabellenselektion im UpdateCrsr erzeugt wird,
// ohne das die UI davon etaws weiss
virtual void NewCoreSelection();
void SetSelTblCells( BOOL bFlag ) { bSelTblCells = bFlag; }
BOOL IsSelTblCells() const { return bSelTblCells; }
BOOL IsAutoUpdateCells() const { return bAutoUpdateCells; }
void SetAutoUpdateCells( BOOL bFlag ) { bAutoUpdateCells = bFlag; }
FASTBOOL GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode,
SwRect& rRect, SwHoriOrient& rOrient );
FASTBOOL SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode );
const SwRedline* SelNextRedline();
const SwRedline* SelPrevRedline();
const SwRedline* GotoRedline( USHORT nArrPos, BOOL bSelect = FALSE );
// is cursor or the point in/over a vertical formatted text?
FASTBOOL IsInVerticalText( const Point* pPt = 0 ) const;
// is cursor or the point in/over a right to left formatted text?
FASTBOOL IsInRightToLeftText( const Point* pPt = 0 ) const;
// If the current cursor position is inside a hidden range, the hidden range
// is selected and true is returned:
bool SelectHiddenRange();
// remove all invalid cursors
void ClearUpCrsrs();
// OD 11.02.2003 #100556# - set/get flag to allow/avoid execution of macros
inline void SetMacroExecAllowed( const bool _bMacroExecAllowed )
{
mbMacroExecAllowed = _bMacroExecAllowed;
}
inline bool IsMacroExecAllowed()
{
return mbMacroExecAllowed;
}
// #111827#
/**
Returns textual description of the current selection.
- If the current selection is a multi-selection the result is
STR_MULTISEL.
- Else the result is the text of the selection.
@return the textual description of the current selection
*/
String GetCrsrDescr() const;
};
class SwChgLinkFlag
{
BOOL bOldFlag;
SwCrsrShell& rCrsrShell;
long nLeftFrmPos;
public:
SwChgLinkFlag( SwCrsrShell& rShell );
~SwChgLinkFlag();
};
// Cursor Inlines:
#if defined(PRODUCT) && !defined(WIN)
inline SwMoveFnCollection* SwCrsrShell::MakeFindRange(
USHORT nStt, USHORT nEnd, SwPaM* pPam ) const
{
return pCurCrsr->MakeFindRange( (SwDocPositions)nStt, (SwDocPositions)nEnd, pPam );
}
inline SwCursor* SwCrsrShell::GetSwCrsr( FASTBOOL bMakeTblCrsr ) const
{
return (SwCursor*)GetCrsr( bMakeTblCrsr );
}
inline SwPaM* SwCrsrShell::GetStkCrsr() const { return pCrsrStk; }
inline void SwCrsrShell::SetMark() { pCurCrsr->SetMark(); }
inline FASTBOOL SwCrsrShell::HasMark() { return( pCurCrsr->HasMark() ); }
inline FASTBOOL SwCrsrShell::IsSelection() const
{
return IsTableMode() || pCurCrsr->HasMark() ||
pCurCrsr->GetNext() != pCurCrsr;
}
inline FASTBOOL SwCrsrShell::IsMultiSelection() const
{
return pCurCrsr->GetNext() != pCurCrsr;
}
inline FASTBOOL SwCrsrShell::IsSelOnePara() const
{
return pCurCrsr == pCurCrsr->GetNext() &&
pCurCrsr->GetPoint()->nNode == pCurCrsr->GetMark()->nNode;
}
inline const SwTableNode* SwCrsrShell::IsCrsrInTbl( BOOL bIsPtInTbl ) const
{
return pCurCrsr->GetNode( bIsPtInTbl )->FindTableNode();
}
inline FASTBOOL SwCrsrShell::IsCrsrPtAtEnd() const
{
return pCurCrsr->End() == pCurCrsr->GetPoint();
}
inline Point& SwCrsrShell::GetCrsrDocPos( BOOL bPoint ) const
{
return bPoint ? pCurCrsr->GetPtPos() : pCurCrsr->GetMkPos();
}
inline const SwPaM* SwCrsrShell::GetTblCrs() const
{
return pTblCrsr;
}
inline SwPaM* SwCrsrShell::GetTblCrs()
{
return pTblCrsr;
}
inline void SwCrsrShell::UnSetVisCrsr()
{
pVisCrsr->Hide();
pVisCrsr->SetDragCrsr( FALSE );
}
#endif
#endif // _CRSRSH_HXX
|