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
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
|
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org 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 version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _OUTLINER_HXX
#define _OUTLINER_HXX
#include <tools/gen.hxx>
#include <tools/string.hxx>
#include <tools/debug.hxx>
#include <svl/brdcst.hxx>
#include <editeng/editdata.hxx>
#include <i18npool/lang.h>
#include <tools/color.hxx>
#include <vcl/graph.hxx>
#include <tools/list.hxx>
#include <tools/link.hxx>
#include <rsc/rscsfx.hxx>
#include "editeng/editengdllapi.h"
#include <svtools/grfmgr.hxx>
#include <tools/rtti.hxx> // wegen typedef TypeId
#include <vector>
class OutlinerEditEng;
class Outliner;
class EditView;
class EditUndo;
class ParagraphList;
class OutlinerParaObject;
class SvStream;
class SvxBulletItem;
class SvxFont;
class SvxSearchItem;
class SvxFieldItem;
class OLUndoRemove;
class Window;
class KeyEvent;
class MouseEvent;
class Pointer;
class CommandEvent;
class MapMode;
class OutputDevice;
class PolyPolygon;
class SfxStyleSheetPool;
class SfxStyleSheet;
class SfxItemPool;
class SfxItemSet;
class SvxNumBulletItem;
class SvxNumberFormat;
class SvxLRSpaceItem;
class SfxUndoManager;
class EditEngine;
class SvKeyValueIterator;
class SvxForbiddenCharactersTable;
#include <com/sun/star/uno/Reference.h>
#include <vos/ref.hxx>
#include <editeng/svxfont.hxx>
#include <editeng/eedata.hxx>
#include <editeng/paragraphdata.hxx>
class SvxFieldData;
//////////////////////////////////////////////////////////////////////////////
namespace com { namespace sun { namespace star { namespace linguistic2 {
class XSpellChecker1;
class XHyphenator;
}}}}
namespace svx{
struct SpellPortion;
typedef std::vector<SpellPortion> SpellPortions;
}
namespace basegfx { class B2DPolyPolygon; }
// nur interner Gebrauch!
#define PARAFLAG_DROPTARGET 0x1000
#define PARAFLAG_DROPTARGET_EMPTY 0x2000
#define PARAFLAG_HOLDDEPTH 0x4000
#define PARAFLAG_SETBULLETTEXT 0x8000
#define PARAFLAG_ISPAGE 0x0100
// Undo-Action-Ids
#define OLUNDO_DEPTH EDITUNDO_USER
// #define OLUNDO_HEIGHT EDITUNDO_USER+1
#define OLUNDO_EXPAND EDITUNDO_USER+2
#define OLUNDO_COLLAPSE EDITUNDO_USER+3
// #define OLUNDO_REMOVE EDITUNDO_USER+4
#define OLUNDO_ATTR EDITUNDO_USER+5
#define OLUNDO_INSERT EDITUNDO_USER+6
// #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7
#define OLUNDO_CHECKPARA EDITUNDO_USER+8
class Paragraph : protected ParagraphData
{
private:
friend class Outliner;
friend class ParagraphList;
friend class OutlinerView;
friend class OutlinerParaObject;
friend class OutlinerEditEng;
friend class OLUndoDepth;
friend class OutlinerUndoCheckPara;
friend class OutlinerUndoChangeParaFlags;
Paragraph& operator=(const Paragraph& rPara );
USHORT nFlags;
XubString aBulText;
Size aBulSize;
BOOL bVisible;
BOOL IsVisible() const { return bVisible; }
void SetText( const XubString& rText ) { aBulText = rText; aBulSize.Width() = -1; }
void Invalidate() { aBulSize.Width() = -1; }
void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; }
const XubString& GetText() const { return aBulText; }
Paragraph( sal_Int16 nDepth );
Paragraph( const Paragraph& );
Paragraph( const ParagraphData& );
~Paragraph();
sal_Int16 GetDepth() const { return nDepth; }
sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; }
void SetNumberingStartValue( sal_Int16 nNumberingStartValue );
sal_Bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; }
void SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart );
void SetFlag( USHORT nFlag ) { nFlags |= nFlag; }
void RemoveFlag( USHORT nFlag ) { nFlags &= ~nFlag; }
bool HasFlag( USHORT nFlag ) const { return (nFlags & nFlag) != 0; }
};
struct ParaRange
{
USHORT nStartPara;
USHORT nEndPara;
ParaRange( USHORT nS, USHORT nE ) { nStartPara = nS, nEndPara = nE; }
void Adjust();
USHORT Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); }
};
inline void ParaRange::Adjust()
{
if ( nStartPara > nEndPara )
{
USHORT nTmp = nStartPara;
nStartPara = nEndPara;
nEndPara = nTmp;
}
}
#define OL_ROOTPARENT (Paragraph*)NULL
class EDITENG_DLLPUBLIC OutlinerView
{
friend class Outliner;
private:
Outliner* pOwner;
EditView* pEditView;
// Drag & Drop
BOOL bBeginDragAtMove_OLDMEMBER;
BOOL bInDragMode;
Point aDDStartPosRef;
Point aDDStartPosPix;
ULONG nDDStartPara;
ULONG nDDStartParaVisChildCount;
ULONG nDDCurPara;
USHORT nDDStartDepth;
USHORT nDDCurDepth;
USHORT nDDMaxDepth;
BOOL bDDChangingDepth;
BOOL bDDCursorVisible;
long* pHorTabArrDoc;
long nDDScrollLRBorderWidthWin; // Left Right
long nDDScrollTBBorderWidthWin; // Top Bottom
long nDDScrollLROffs;
long nDDScrollTDOffs;
void* pDummy;
ULONG nDummy;
enum MouseTarget {
MouseText = 0,
MouseBullet = 1,
MouseHypertext = 2, // ausserhalb OutputArea
MouseOutside = 3, // ausserhalb OutputArea
MouseDontKnow = 4
};
MouseTarget OLD_ePrevMouseTarget;
#ifdef _OUTLINER_CXX
EDITENG_DLLPRIVATE void ImplExpandOrCollaps( USHORT nStartPara, USHORT nEndPara, BOOL bExpand );
EDITENG_DLLPRIVATE ULONG ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget);
EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara );
EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( BOOL bIncludeHiddenChilds );
EDITENG_DLLPRIVATE void ImpHideDDCursor();
EDITENG_DLLPRIVATE void ImpShowDDCursor();
EDITENG_DLLPRIVATE void ImpPaintDDCursor();
EDITENG_DLLPRIVATE void ImpDragScroll( const Point& rPosPix );
EDITENG_DLLPRIVATE void ImpScrollLeft();
EDITENG_DLLPRIVATE void ImpScrollRight();
EDITENG_DLLPRIVATE void ImpScrollUp();
EDITENG_DLLPRIVATE void ImpScrollDown();
EDITENG_DLLPRIVATE ULONG ImpGetInsertionPara( const Point& rPosPixel );
EDITENG_DLLPRIVATE Point ImpGetDocPos( const Point& rPosPixel );
EDITENG_DLLPRIVATE Pointer ImpGetMousePointer( MouseTarget eTarget );
EDITENG_DLLPRIVATE USHORT ImpInitPaste( ULONG& rStart );
EDITENG_DLLPRIVATE void ImpPasted( ULONG nStart, ULONG nPrevParaCount, USHORT nSize);
EDITENG_DLLPRIVATE USHORT ImpCalcSelectedPages( BOOL bIncludeFirstSelected );
EDITENG_DLLPRIVATE BOOL ImpIsIndentingPages();
#endif
public:
OutlinerView( Outliner* pOut, Window* pWindow );
virtual ~OutlinerView();
EditView& GetEditView() const { return *pEditView; }
void Scroll( long nHorzScroll, long nVertScroll );
void Paint( const Rectangle& rRect );
BOOL PostKeyEvent( const KeyEvent& rKEvt );
BOOL MouseButtonDown( const MouseEvent& );
BOOL MouseButtonUp( const MouseEvent& );
BOOL MouseMove( const MouseEvent& );
void ShowCursor( BOOL bGotoCursor = TRUE );
void HideCursor();
void SetOutliner( Outliner* pOutliner );
Outliner* GetOutliner() const { return pOwner; }
void SetWindow( Window* pWindow );
Window* GetWindow() const;
void SetReadOnly( BOOL bReadOnly );
BOOL IsReadOnly() const;
void SetOutputArea( const Rectangle& rRect );
Rectangle GetOutputArea() const;
Rectangle GetVisArea() const;
List* CreateSelectionList();
// gibt Anzahl selektierter Absaetze zurueck
// MT 07/00: Who needs this?
ULONG Select( Paragraph* pParagraph,
BOOL bSelect=TRUE,
BOOL bWChilds=TRUE);
String GetSelected() const;
void SelectRange( ULONG nFirst, USHORT nCount );
void SetAttribs( const SfxItemSet& );
void Indent( short nDiff );
void AdjustDepth( short nDX ); // Spaeter gegeb Indent ersetzen!
BOOL AdjustHeight( long nDY );
void AdjustDepth( Paragraph* pPara, short nDX,
BOOL bWithChilds = FALSE );
void AdjustHeight( Paragraph* pPara, long nDY,
BOOL bWithChilds=FALSE );
ULONG Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, BOOL bSelect = FALSE, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
ULONG Write( SvStream& rOutput, EETextFormat eFormat );
void InsertText( const String& rNew, BOOL bSelect = FALSE );
void InsertText( const OutlinerParaObject& rParaObj );
void Expand();
void Collapse();
void Expand( Paragraph* );
void Collapse( Paragraph* );
void ExpandAll();
void CollapseAll();
void SetBackgroundColor( const Color& rColor );
Color GetBackgroundColor();
SfxItemSet GetAttribs();
void Cut();
void Copy();
void Paste();
void PasteSpecial();
void EnablePaste( BOOL bEnable );
void Undo();
void Redo();
void SetStyleSheet( SfxStyleSheet* );
SfxStyleSheet* GetStyleSheet() const;
void SetControlWord( ULONG nWord );
ULONG GetControlWord() const;
void SetAnchorMode( EVAnchorMode eMode );
EVAnchorMode GetAnchorMode() const;
Pointer GetPointer( const Point& rPosPixel );
void Command( const CommandEvent& rCEvt );
void RemoveCharAttribs( ULONG nPara, USHORT nWhich = 0 );
void CompleteAutoCorrect();
EESpellState StartSpeller( BOOL bMultipleDoc = FALSE );
EESpellState StartThesaurus();
USHORT StartSearchAndReplace( const SvxSearchItem& rSearchItem );
// for text conversion
void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, INT32 nOptions, BOOL bIsInteractive, BOOL bMultipleDoc );
void TransliterateText( sal_Int32 nTransliterationMode );
ESelection GetSelection();
USHORT GetSelectedScriptType() const;
void SetVisArea( const Rectangle& rRec );
void SetSelection( const ESelection& );
void RemoveAttribs( BOOL bRemoveParaAttribs = FALSE, USHORT nWhich = 0, BOOL bKeepLanguages = FALSE );
void RemoveAttribsKeepLanguages( BOOL bRemoveParaAttribs );
BOOL HasSelection() const;
void InsertField( const SvxFieldItem& rFld );
const SvxFieldItem* GetFieldUnderMousePointer() const;
const SvxFieldItem* GetFieldUnderMousePointer( USHORT& nPara, xub_StrLen& nPos ) const;
const SvxFieldItem* GetFieldAtSelection() const;
/** enables numbering for the selected paragraphs if the numbering of the first paragraph is off
or disables numbering for the selected paragraphs if the numbering of the first paragraph is on
*/
void ToggleBullets();
/** enables numbering for the selected paragraphs that are not enabled and ignore all selected
paragraphs that already have numbering enabled.
*/
void EnableBullets();
BOOL IsCursorAtWrongSpelledWord( BOOL bMarkIfWrong = FALSE );
BOOL IsWrongSpelledWordAtPos( const Point& rPosPixel, BOOL bMarkIfWrong = FALSE );
void SpellIgnoreWord();
void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
void SetInvalidateMore( USHORT nPixel );
USHORT GetInvalidateMore() const;
String GetSurroundingText() const;
Selection GetSurroundingTextSelection() const;
};
//#if 0 // _SOLAR__PRIVATE
DECLARE_LIST(ViewList,OutlinerView*)
//#else
//typedef List ViewList;
//#endif
class EDITENG_DLLPUBLIC DrawPortionInfo
{
public:
const Point& mrStartPos;
const String& mrText;
sal_uInt16 mnTextStart;
sal_uInt16 mnTextLen;
sal_uInt16 mnPara;
xub_StrLen mnIndex;
const SvxFont& mrFont;
const sal_Int32* mpDXArray;
const EEngineData::WrongSpellVector* mpWrongSpellVector;
const SvxFieldData* mpFieldData;
const ::com::sun::star::lang::Locale* mpLocale;
const Color maOverlineColor;
const Color maTextLineColor;
// #101498# BiDi level needs to be transported, too.
BYTE mnBiDiLevel;
// bitfield
unsigned mbEndOfLine : 1;
unsigned mbEndOfParagraph : 1;
unsigned mbEndOfBullet : 1;
BYTE GetBiDiLevel() const { return mnBiDiLevel; }
sal_Bool IsRTL() const;
DrawPortionInfo(
const Point& rPos,
const String& rTxt,
sal_uInt16 nTxtStart,
sal_uInt16 nTxtLen,
const SvxFont& rFnt,
sal_uInt16 nPar,
xub_StrLen nIdx,
const sal_Int32* pDXArr,
const EEngineData::WrongSpellVector* pWrongSpellVector,
const SvxFieldData* pFieldData,
const ::com::sun::star::lang::Locale* pLocale,
const Color& rOverlineColor,
const Color& rTextLineColor,
BYTE nBiDiLevel,
bool bEndOfLine,
bool bEndOfParagraph,
bool bEndOfBullet)
: mrStartPos(rPos),
mrText(rTxt),
mnTextStart(nTxtStart),
mnTextLen(nTxtLen),
mnPara(nPar),
mnIndex(nIdx),
mrFont(rFnt),
mpDXArray(pDXArr),
mpWrongSpellVector(pWrongSpellVector),
mpFieldData(pFieldData),
mpLocale(pLocale),
maOverlineColor(rOverlineColor),
maTextLineColor(rTextLineColor),
mnBiDiLevel(nBiDiLevel),
mbEndOfLine(bEndOfLine),
mbEndOfParagraph(bEndOfParagraph),
mbEndOfBullet(bEndOfBullet)
{}
};
class EDITENG_DLLPUBLIC DrawBulletInfo
{
public:
const GraphicObject maBulletGraphicObject;
Point maBulletPosition;
Size maBulletSize;
DrawBulletInfo(
const GraphicObject& rBulletGraphicObject,
const Point& rBulletPosition,
const Size& rBulletSize)
: maBulletGraphicObject(rBulletGraphicObject),
maBulletPosition(rBulletPosition),
maBulletSize(rBulletSize)
{}
};
struct EDITENG_DLLPUBLIC PaintFirstLineInfo
{
USHORT mnPara;
const Point& mrStartPos;
long mnBaseLineY;
const Point& mrOrigin;
short mnOrientation;
OutputDevice* mpOutDev;
PaintFirstLineInfo( USHORT nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
: mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev )
{}
};
class SdrPage;
class EditFieldInfo
{
private:
Outliner* pOutliner;
const SvxFieldItem& rFldItem;
Color* pTxtColor;
Color* pFldColor;
String aRepresentation;
USHORT nPara;
xub_StrLen nPos;
BOOL bSimpleClick;
EditFieldInfo();
EditFieldInfo( const EditFieldInfo& );
SdrPage* mpSdrPage;
public:
EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, USHORT nPa, xub_StrLen nPo )
: rFldItem( rFItem )
{
pOutliner = pOutl;
nPara = nPa; nPos = nPo;
pTxtColor = 0; pFldColor = 0; bSimpleClick = FALSE;
mpSdrPage = 0;
}
~EditFieldInfo()
{
delete pTxtColor;
delete pFldColor;
}
Outliner* GetOutliner() const { return pOutliner; }
const SvxFieldItem& GetField() const { return rFldItem; }
Color* GetTxtColor() const { return pTxtColor; }
void SetTxtColor( const Color& rColor )
{ delete pTxtColor; pTxtColor = new Color( rColor ); }
Color* GetFldColor() const { return pFldColor; }
void SetFldColor( const Color& rColor )
{ delete pFldColor; pFldColor = new Color( rColor ); }
void ClearFldColor()
{ delete pFldColor; pFldColor = 0; }
USHORT GetPara() const { return nPara; }
xub_StrLen GetPos() const { return nPos; }
BOOL IsSimpleClick() const { return bSimpleClick; }
void SetSimpleClick( BOOL bSimple ) { bSimpleClick = bSimple; }
const String& GetRepresentation() const { return aRepresentation; }
String& GetRepresentation() { return aRepresentation; }
void SetRepresentation( const String& rStr ) { aRepresentation = rStr; }
void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; }
SdrPage* GetSdrPage() const { return mpSdrPage; }
};
struct EBulletInfo
{
BOOL bVisible;
USHORT nType; // see SvxNumberType
String aText;
SvxFont aFont;
Graphic aGraphic;
USHORT nParagraph;
Rectangle aBounds;
EBulletInfo() : bVisible( FALSE ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {}
};
#define OUTLINERMODE_DONTKNOW 0x0000
#define OUTLINERMODE_TEXTOBJECT 0x0001
#define OUTLINERMODE_TITLEOBJECT 0x0002
#define OUTLINERMODE_OUTLINEOBJECT 0x0003
#define OUTLINERMODE_OUTLINEVIEW 0x0004
#define OUTLINERMODE_USERMASK 0x00FF
#define OUTLINERMODE_SUBTITLE (0x0100|OUTLINERMODE_TEXTOBJECT)
#define OUTLINERMODE_NOTE (0x0200|OUTLINERMODE_TEXTOBJECT)
class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
{
friend class OutlinerView;
friend class OutlinerEditEng;
friend class OutlinerParaObject;
friend class OLUndoExpand;
friend class OutlinerUndoChangeDepth;
friend class OutlinerUndoCheckPara;
friend class OutlinerUndoChangeParaFlags;
OutlinerEditEng* pEditEngine;
ParagraphList* pParaList;
ViewList aViewList;
Paragraph* pHdlParagraph;
ULONG mnFirstSelPage;
Link aDrawPortionHdl;
Link aDrawBulletHdl;
Link aExpandHdl;
Link aParaInsertedHdl;
Link aParaRemovingHdl;
Link aDepthChangedHdl;
Link aWidthArrReqHdl;
Link aBeginMovingHdl;
Link aEndMovingHdl;
Link aIndentingPagesHdl;
Link aRemovingPagesHdl;
Link aFieldClickedHdl;
Link aCalcFieldValueHdl;
Link maPaintFirstLineHdl;
Link maBeginPasteOrDropHdl;
Link maEndPasteOrDropHdl;
sal_Int16 nDepthChangedHdlPrevDepth;
USHORT mnDepthChangeHdlPrevFlags;
sal_Int16 nMaxDepth;
const sal_Int16 nMinDepth;
USHORT nFirstPage;
USHORT nOutlinerMode;
BOOL bIsExpanding; // Nur in Expand/Collaps-Hdl gueltig, mal umstellen
BOOL bFirstParaIsEmpty;
BOOL bBlockInsCallback;
BOOL bStrippingPortions;
BOOL bPasting;
ULONG nDummy;
#ifdef _OUTLINER_CXX
DECL_LINK( ParaVisibleStateChangedHdl, Paragraph* );
DECL_LINK( BeginMovingParagraphsHdl, MoveParagraphsInfo* );
DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo* );
DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
DECL_LINK( EditEngineNotifyHdl, EENotify* );
void ImplCheckParagraphs( USHORT nStart, USHORT nEnd );
BOOL ImplHasBullet( USHORT nPara ) const;
Size ImplGetBulletSize( USHORT nPara );
sal_uInt16 ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pParaFmt );
void ImplCalcBulletText( USHORT nPara, BOOL bRecalcLevel, BOOL bRecalcChilds );
String ImplGetBulletText( USHORT nPara );
void ImplCheckNumBulletItem( USHORT nPara );
void ImplInitDepth( USHORT nPara, sal_Int16 nDepth, BOOL bCreateUndo, BOOL bUndoAction = FALSE );
void ImplSetLevelDependendStyleSheet( USHORT nPara, SfxStyleSheet* pLevelStyle = NULL );
void ImplBlockInsertionCallbacks( BOOL b );
void ImplCheckStyleSheet( USHORT nPara, BOOL bReplaceExistingStyle );
void ImpRecalcBulletIndent( ULONG nPara );
const SvxBulletItem& ImpGetBullet( ULONG nPara, USHORT& );
void ImpFilterIndents( ULONG nFirstPara, ULONG nLastPara );
bool ImpConvertEdtToOut( sal_uInt32 nPara, EditView* pView = 0 );
void ImpTextPasted( ULONG nStartPara, USHORT nCount );
long ImpCalcMaxBulletWidth( USHORT nPara, const SvxBulletItem& rBullet );
Font ImpCalcBulletFont( USHORT nPara ) const;
Rectangle ImpCalcBulletArea( USHORT nPara, BOOL bAdjust, BOOL bReturnPaperPos );
long ImpGetTextIndent( ULONG nPara );
BOOL ImpCanIndentSelectedPages( OutlinerView* pCurView );
BOOL ImpCanDeleteSelectedPages( OutlinerView* pCurView );
BOOL ImpCanDeleteSelectedPages( OutlinerView* pCurView, USHORT nFirstPage, USHORT nPages );
USHORT ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
void ImplCheckDepth( sal_Int16& rnDepth ) const;
#endif
protected:
void ParagraphInserted( USHORT nParagraph );
void ParagraphDeleted( USHORT nParagraph );
void ParaAttribsChanged( USHORT nParagraph );
virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
void InvalidateBullet( Paragraph* pPara, ULONG nPara );
void PaintBullet( USHORT nPara, const Point& rStartPos,
const Point& rOrigin, short nOrientation,
OutputDevice* pOutDev );
// used by OutlinerEditEng. Allows Outliner objects to provide
// bullet access to the EditEngine.
virtual const SvxNumberFormat* GetNumberFormat( USHORT nPara ) const;
public:
Outliner( SfxItemPool* pPool, USHORT nOutlinerMode );
virtual ~Outliner();
void Init( USHORT nOutlinerMode );
USHORT GetMode() const { return nOutlinerMode; }
void SetVertical( BOOL bVertical );
BOOL IsVertical() const;
void SetFixedCellHeight( BOOL bUseFixedCellHeight );
BOOL IsFixedCellHeight() const;
void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
USHORT GetScriptType( const ESelection& rSelection ) const;
LanguageType GetLanguage( USHORT nPara, USHORT nPos ) const;
void SetAsianCompressionMode( USHORT nCompressionMode );
USHORT GetAsianCompressionMode() const;
void SetKernAsianPunctuation( BOOL bEnabled );
BOOL IsKernAsianPunctuation() const;
void SetAddExtLeading( BOOL b );
BOOL IsAddExtLeading() const;
ULONG InsertView( OutlinerView* pView, ULONG nIndex=LIST_APPEND);
OutlinerView* RemoveView( OutlinerView* pView );
OutlinerView* RemoveView( ULONG nIndex );
OutlinerView* GetView( ULONG nIndex ) const;
ULONG GetViewCount() const;
Paragraph* Insert( const String& rText, ULONG nAbsPos = LIST_APPEND, sal_Int16 nDepth = 0 );
void SetText( const OutlinerParaObject& );
void AddText( const OutlinerParaObject& );
void SetText( const String& rText, Paragraph* pParagraph );
String GetText( Paragraph* pPara, ULONG nParaCount=1 ) const;
OutlinerParaObject* CreateParaObject( USHORT nStartPara = 0, USHORT nParaCount = 0xFFFF ) const;
const SfxItemSet& GetEmptyItemSet() const;
void SetRefMapMode( const MapMode& );
MapMode GetRefMapMode() const;
void SetBackgroundColor( const Color& rColor );
Color GetBackgroundColor() const;
sal_Int16 GetMinDepth() const { return -1; }
void SetMaxDepth( sal_Int16 nDepth, BOOL bCheckParas = FALSE );
sal_Int16 GetMaxDepth() const { return nMaxDepth; }
void SetUpdateMode( BOOL bUpdate );
BOOL GetUpdateMode() const;
void Clear();
void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
ULONG GetParagraphCount() const;
Paragraph* GetParagraph( ULONG nAbsPos ) const;
BOOL HasParent( Paragraph* pParagraph ) const;
BOOL HasChilds( Paragraph* pParagraph ) const;
ULONG GetChildCount( Paragraph* pParent ) const;
BOOL IsExpanded( Paragraph* pPara ) const;
// Paragraph* GetParagraph( Paragraph* pParent, ULONG nRelPos ) const;
Paragraph* GetParent( Paragraph* pParagraph ) const;
// ULONG GetRelPos( Paragraph* pParent, Paragraph* pPara ) const;
ULONG GetAbsPos( Paragraph* pPara );
sal_Int16 GetDepth( ULONG nPara ) const;
void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth );
void SetVisible( Paragraph* pPara, BOOL bVisible );
BOOL IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); }
void EnableUndo( BOOL bEnable );
BOOL IsUndoEnabled() const;
void UndoActionStart( USHORT nId );
void UndoActionEnd( USHORT nId );
void InsertUndo( EditUndo* pUndo );
BOOL IsInUndo();
void ClearModifyFlag();
BOOL IsModified() const;
Paragraph* GetHdlParagraph() const { return pHdlParagraph; }
BOOL IsExpanding() const { return bIsExpanding; }
virtual void ExpandHdl();
void SetExpandHdl( const Link& rLink ) { aExpandHdl = rLink; }
Link GetExpandHdl() const { return aExpandHdl; }
virtual void ParagraphInsertedHdl();
void SetParaInsertedHdl(const Link& rLink){aParaInsertedHdl=rLink;}
Link GetParaInsertedHdl() const { return aParaInsertedHdl; }
virtual void ParagraphRemovingHdl();
void SetParaRemovingHdl(const Link& rLink){aParaRemovingHdl=rLink;}
Link GetParaRemovingHdl() const { return aParaRemovingHdl; }
virtual void DepthChangedHdl();
void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;}
Link GetDepthChangedHdl() const { return aDepthChangedHdl; }
sal_Int16 GetPrevDepth() const { return nDepthChangedHdlPrevDepth; }
USHORT GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; }
virtual long RemovingPagesHdl( OutlinerView* );
void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;}
Link GetRemovingPagesHdl() const { return aRemovingPagesHdl; }
virtual long IndentingPagesHdl( OutlinerView* );
void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;}
Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; }
// nur gueltig in den beiden oberen Handlern
USHORT GetSelPageCount() const { return nDepthChangedHdlPrevDepth; }
// nur gueltig in den beiden oberen Handlern
ULONG GetFirstSelPage() const { return mnFirstSelPage; }
void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; }
Link GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; }
void SetFieldClickedHdl(const Link& rLink ) { aFieldClickedHdl= rLink; }
Link GetFieldClickedHdl() const { return aFieldClickedHdl; }
void SetDrawPortionHdl(const Link& rLink){aDrawPortionHdl=rLink;}
Link GetDrawPortionHdl() const { return aDrawPortionHdl; }
void SetDrawBulletHdl(const Link& rLink){aDrawBulletHdl=rLink;}
Link GetDrawBulletHdl() const { return aDrawBulletHdl; }
void SetPaintFirstLineHdl(const Link& rLink) { maPaintFirstLineHdl = rLink; }
Link GetPaintFirstLineHdl() const { return maPaintFirstLineHdl; }
void SetModifyHdl( const Link& rLink );
Link GetModifyHdl() const;
void SetNotifyHdl( const Link& rLink );
Link GetNotifyHdl() const;
void SetStatusEventHdl( const Link& rLink );
Link GetStatusEventHdl() const;
void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos );
void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
const Size& GetPaperSize() const;
void SetPaperSize( const Size& rSize );
void SetFirstPageNumber( USHORT n ) { nFirstPage = n; }
USHORT GetFirstPageNumber() const { return nFirstPage; }
void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
void ClearPolygon();
const PolyPolygon* GetPolygon();
const Size& GetMinAutoPaperSize() const;
void SetMinAutoPaperSize( const Size& rSz );
const Size& GetMaxAutoPaperSize() const;
void SetMaxAutoPaperSize( const Size& rSz );
void SetDefTab( USHORT nTab );
USHORT GetDefTab() const;
BOOL IsFlatMode() const;
void SetFlatMode( BOOL bFlat );
void EnableAutoColor( BOOL b );
BOOL IsAutoColorEnabled() const;
void ForceAutoColor( BOOL b );
BOOL IsForceAutoColor() const;
EBulletInfo GetBulletInfo( USHORT nPara );
void SetWordDelimiters( const String& rDelimiters );
String GetWordDelimiters() const;
String GetWord( USHORT nPara, xub_StrLen nIndex );
void StripPortions();
// #101498#
virtual void DrawingText(
const Point& rStartPos, const String& rText, USHORT nTextStart, USHORT nTextLen,
const sal_Int32* pDXArray, const SvxFont& rFont, USHORT nPara, xub_StrLen nIndex, BYTE nRightToLeft,
const EEngineData::WrongSpellVector* pWrongSpellVector,
const SvxFieldData* pFieldData,
bool bEndOfLine,
bool bEndOfParagraph,
bool bEndOfBullet,
const ::com::sun::star::lang::Locale* pLocale,
const Color& rOverlineColor,
const Color& rTextLineColor);
Size CalcTextSize();
Point GetDocPos( Paragraph* pPara );
void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
SfxStyleSheetPool* GetStyleSheetPool();
BOOL IsInSelectionMode() const;
void SetStyleSheet( ULONG nPara, SfxStyleSheet* pStyle );
SfxStyleSheet* GetStyleSheet( ULONG nPara );
void SetParaAttribs( USHORT nPara, const SfxItemSet& );
SfxItemSet GetParaAttribs( USHORT nPara );
void Remove( Paragraph* pPara, ULONG nParaCount );
BOOL Expand( Paragraph* );
BOOL Collapse( Paragraph* );
void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag );
void RemoveParaFlag( Paragraph* pPara, sal_uInt16 nFlag );
bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const;
// gibt ein Array mit den Bulletbreiten der n Einrueckebenen
// zurueck. Letzter Wert muss -1 sein. Wird vom Outliner geloescht.
Link GetWidthArrReqHdl() const{ return aWidthArrReqHdl; }
void SetWidthArrReqHdl(const Link& rLink){aWidthArrReqHdl=rLink; }
void SetControlWord( ULONG nWord );
ULONG GetControlWord() const;
Link GetBeginMovingHdl() const { return aBeginMovingHdl; }
void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;}
Link GetEndMovingHdl() const {return aEndMovingHdl;}
void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;}
ULONG GetLineCount( ULONG nParagraph ) const;
USHORT GetLineLen( ULONG nParagraph, USHORT nLine ) const;
ULONG GetLineHeight( ULONG nParagraph, ULONG nLine = 0 );
// nFormat muss ein Wert aus dem enum EETextFormat sein (wg.CLOOKS)
ULONG Read( SvStream& rInput, const String& rBaseURL, USHORT, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
SfxUndoManager& GetUndoManager();
void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
void QuickInsertLineBreak( const ESelection& rSel );
// nur fuer EditEngine-Modus
void QuickInsertText( const String& rText, const ESelection& rSel );
void QuickDelete( const ESelection& rSel );
void QuickRemoveCharAttribs( USHORT nPara, USHORT nWhich = 0 );
void QuickFormatDoc( BOOL bFull = FALSE );
BOOL UpdateFields();
void RemoveFields( BOOL bKeepFieldText, TypeId aType = NULL );
virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos );
virtual void FieldSelected( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos );
virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
void SetSpeller( ::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellChecker1 >
GetSpeller();
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XHyphenator >
GetHyphenator() const;
void SetHyphenator( ::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XHyphenator >& xHyph );
void SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars );
vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const;
// Depricated
void SetDefaultLanguage( LanguageType eLang );
LanguageType GetDefaultLanguage() const;
BOOL HasOnlineSpellErrors() const;
void CompleteOnlineSpelling();
EESpellState HasSpellErrors();
BOOL HasText( const SvxSearchItem& rSearchItem );
virtual BOOL SpellNextDocument();
// for text conversion
sal_Bool HasConvertibleTextPortion( LanguageType nLang );
virtual BOOL ConvertNextDocument();
void SetEditTextObjectPool( SfxItemPool* pPool );
SfxItemPool* GetEditTextObjectPool() const;
void SetRefDevice( OutputDevice* pRefDev );
OutputDevice* GetRefDevice() const;
USHORT GetFirstLineOffset( ULONG nParagraph );
ULONG GetTextHeight() const;
ULONG GetTextHeight( ULONG nParagraph ) const;
Point GetDocPosTopLeft( ULONG nParagraph );
Point GetDocPos( const Point& rPaperPos ) const;
BOOL IsTextPos( const Point& rPaperPos, USHORT nBorder = 0 );
BOOL IsTextPos( const Point& rPaperPos, USHORT nBorder, BOOL* pbBuuletPos );
void SetGlobalCharStretching( USHORT nX = 100, USHORT nY = 100 );
void GetGlobalCharStretching( USHORT& rX, USHORT& rY );
void DoStretchChars( USHORT nX, USHORT nY );
void EraseVirtualDevice();
void SetBigTextObjectStart( USHORT nStartAtPortionCount );
USHORT GetBigTextObjectStart() const;
BOOL ShouldCreateBigTextObject() const;
const EditEngine& GetEditEngine() const { return *((EditEngine*)pEditEngine); }
// this is needed for StarOffice Api
void SetLevelDependendStyleSheet( USHORT nPara );
USHORT GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
//spell and return a sentence
bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
// put spell position to start of current sentence
void PutSpellingToSentenceStart( EditView& rEditView );
//applies a changed sentence
void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bIsGrammarChecking );
void EndSpelling();
/** sets a link that is called at the beginning of a drag operation at an edit view */
void SetBeginDropHdl( const Link& rLink );
Link GetBeginDropHdl() const;
/** sets a link that is called at the end of a drag operation at an edit view */
void SetEndDropHdl( const Link& rLink );
Link GetEndDropHdl() const;
/** sets a link that is called before a drop or paste operation. */
void SetBeginPasteOrDropHdl( const Link& rLink );
Link GetBeginPasteOrDropHdl() const { return maBeginPasteOrDropHdl; }
/** sets a link that is called after a drop or paste operation. */
void SetEndPasteOrDropHdl( const Link& rLink );
Link GetEndPasteOrDropHdl() const { return maEndPasteOrDropHdl; }
virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
};
#endif
|