Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _OUTLINER_HXX
20 : #define _OUTLINER_HXX
21 :
22 : #include <tools/gen.hxx>
23 : #include <tools/string.hxx>
24 :
25 : #include <svl/brdcst.hxx>
26 :
27 : #include <editeng/editdata.hxx>
28 : #include <i18npool/lang.h>
29 : #include <tools/color.hxx>
30 : #include <tools/contnr.hxx>
31 : #include <vcl/graph.hxx>
32 : #include <tools/link.hxx>
33 : #include <rsc/rscsfx.hxx>
34 : #include "editeng/editengdllapi.h"
35 : #include <com/sun/star/lang/Locale.hpp>
36 :
37 : #include <svtools/grfmgr.hxx>
38 :
39 : #include <tools/rtti.hxx> // due to typedef TypeId
40 : #include <vector>
41 :
42 : class OutlinerEditEng;
43 : class Outliner;
44 : class EditView;
45 : class EditUndo;
46 : class ParagraphList;
47 : class OutlinerParaObject;
48 : class SvStream;
49 : class SvxBulletItem;
50 : class SvxFont;
51 : class SvxSearchItem;
52 : class SvxFieldItem;
53 : class Window;
54 : class KeyEvent;
55 : class MouseEvent;
56 : class Pointer;
57 : class CommandEvent;
58 : class MapMode;
59 : class OutputDevice;
60 : class PolyPolygon;
61 : class SfxStyleSheetPool;
62 : class SfxStyleSheet;
63 : class SfxItemPool;
64 : class SfxItemSet;
65 : class SvxNumBulletItem;
66 : class SvxNumberFormat;
67 : class SvxLRSpaceItem;
68 : class EditEngine;
69 : class SvKeyValueIterator;
70 : class SvxForbiddenCharactersTable;
71 :
72 : namespace svl
73 : {
74 : class IUndoManager;
75 : }
76 :
77 : #include <com/sun/star/uno/Reference.h>
78 :
79 : #include <rtl/ref.hxx>
80 : #include <editeng/svxfont.hxx>
81 : #include <editeng/eedata.hxx>
82 : #include <editeng/paragraphdata.hxx>
83 :
84 : class SvxFieldData;
85 : //////////////////////////////////////////////////////////////////////////////
86 :
87 : namespace com { namespace sun { namespace star { namespace linguistic2 {
88 : class XSpellChecker1;
89 : class XHyphenator;
90 : }}}}
91 : namespace svx{
92 : struct SpellPortion;
93 : typedef std::vector<SpellPortion> SpellPortions;
94 : }
95 :
96 : namespace basegfx { class B2DPolyPolygon; }
97 :
98 : // internal use only!
99 : #define PARAFLAG_DROPTARGET 0x1000
100 : #define PARAFLAG_DROPTARGET_EMPTY 0x2000
101 : #define PARAFLAG_HOLDDEPTH 0x4000
102 : #define PARAFLAG_SETBULLETTEXT 0x8000
103 : #define PARAFLAG_ISPAGE 0x0100
104 :
105 : // Undo-Action-Ids
106 : #define OLUNDO_DEPTH EDITUNDO_USER
107 : // #define OLUNDO_HEIGHT EDITUNDO_USER+1
108 : #define OLUNDO_EXPAND EDITUNDO_USER+2
109 : #define OLUNDO_COLLAPSE EDITUNDO_USER+3
110 : // #define OLUNDO_REMOVE EDITUNDO_USER+4
111 : #define OLUNDO_ATTR EDITUNDO_USER+5
112 : #define OLUNDO_INSERT EDITUNDO_USER+6
113 : // #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7
114 : #define OLUNDO_CHECKPARA EDITUNDO_USER+8
115 :
116 : class Paragraph : protected ParagraphData
117 : {
118 : private:
119 : friend class Outliner;
120 : friend class ParagraphList;
121 : friend class OutlinerView;
122 : friend class OutlinerParaObject;
123 : friend class OutlinerEditEng;
124 : friend class OutlinerUndoCheckPara;
125 : friend class OutlinerUndoChangeParaFlags;
126 :
127 : Paragraph& operator=(const Paragraph& rPara );
128 :
129 : sal_uInt16 nFlags;
130 : rtl::OUString aBulText;
131 : Size aBulSize;
132 : sal_Bool bVisible;
133 :
134 24 : sal_Bool IsVisible() const { return bVisible; }
135 966 : void SetText( const rtl::OUString& rText ) { aBulText = rText; aBulSize.Width() = -1; }
136 67715 : void Invalidate() { aBulSize.Width() = -1; }
137 88571 : void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; }
138 109788 : const rtl::OUString& GetText() const { return aBulText; }
139 :
140 : Paragraph( sal_Int16 nDepth );
141 : Paragraph( const Paragraph& );
142 : Paragraph( const ParagraphData& );
143 : ~Paragraph();
144 :
145 211617 : sal_Int16 GetDepth() const { return nDepth; }
146 :
147 774 : sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; }
148 : void SetNumberingStartValue( sal_Int16 nNumberingStartValue );
149 :
150 0 : sal_Bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; }
151 : void SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart );
152 :
153 0 : void SetFlag( sal_uInt16 nFlag ) { nFlags |= nFlag; }
154 0 : void RemoveFlag( sal_uInt16 nFlag ) { nFlags &= ~nFlag; }
155 7 : bool HasFlag( sal_uInt16 nFlag ) const { return (nFlags & nFlag) != 0; }
156 : };
157 :
158 : struct ParaRange
159 : {
160 : sal_uInt16 nStartPara;
161 : sal_uInt16 nEndPara;
162 :
163 14 : ParaRange( sal_uInt16 nS, sal_uInt16 nE ) { nStartPara = nS, nEndPara = nE; }
164 :
165 : void Adjust();
166 : sal_uInt16 Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); }
167 : };
168 :
169 14 : inline void ParaRange::Adjust()
170 : {
171 14 : if ( nStartPara > nEndPara )
172 : {
173 0 : sal_uInt16 nTmp = nStartPara;
174 0 : nStartPara = nEndPara;
175 0 : nEndPara = nTmp;
176 : }
177 14 : }
178 :
179 : class EDITENG_DLLPUBLIC OutlinerView
180 : {
181 : friend class Outliner;
182 :
183 : private:
184 :
185 : Outliner* pOwner;
186 : EditView* pEditView;
187 :
188 : // Drag & Drop
189 : sal_Bool bBeginDragAtMove_OLDMEMBER;
190 : sal_Bool bInDragMode;
191 : Point aDDStartPosRef;
192 : Point aDDStartPosPix;
193 : sal_uLong nDDStartPara;
194 : sal_uLong nDDStartParaVisChildCount;
195 : sal_uLong nDDCurPara;
196 : sal_uInt16 nDDStartDepth;
197 : sal_uInt16 nDDCurDepth;
198 : sal_uInt16 nDDMaxDepth;
199 : sal_Bool bDDChangingDepth;
200 : sal_Bool bDDCursorVisible;
201 : long* pHorTabArrDoc;
202 : long nDDScrollLRBorderWidthWin; // Left Right
203 : long nDDScrollTBBorderWidthWin; // Top Bottom
204 : long nDDScrollLROffs;
205 : long nDDScrollTDOffs;
206 :
207 : void* pDummy;
208 : sal_uLong nDummy;
209 :
210 : enum MouseTarget {
211 : MouseText = 0,
212 : MouseBullet = 1,
213 : MouseHypertext = 2, // Outside OutputArea
214 : MouseOutside = 3, // Outside OutputArea
215 : MouseDontKnow = 4
216 : };
217 : MouseTarget OLD_ePrevMouseTarget;
218 :
219 : #ifdef _OUTLINER_CXX
220 :
221 : EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand );
222 :
223 : EDITENG_DLLPRIVATE sal_uLong ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget);
224 : EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara );
225 : EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChildren );
226 :
227 : EDITENG_DLLPRIVATE Pointer ImpGetMousePointer( MouseTarget eTarget );
228 : EDITENG_DLLPRIVATE sal_uInt16 ImpInitPaste( sal_uLong& rStart );
229 : EDITENG_DLLPRIVATE void ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize);
230 : EDITENG_DLLPRIVATE sal_uInt16 ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected );
231 : EDITENG_DLLPRIVATE sal_Bool ImpIsIndentingPages();
232 :
233 : #endif
234 :
235 : public:
236 : OutlinerView( Outliner* pOut, Window* pWindow );
237 : virtual ~OutlinerView();
238 :
239 18 : EditView& GetEditView() const { return *pEditView; }
240 :
241 : void Scroll( long nHorzScroll, long nVertScroll );
242 :
243 : void Paint( const Rectangle& rRect );
244 : sal_Bool PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL );
245 : sal_Bool MouseButtonDown( const MouseEvent& );
246 : sal_Bool MouseButtonUp( const MouseEvent& );
247 : sal_Bool MouseMove( const MouseEvent& );
248 :
249 : void ShowCursor( sal_Bool bGotoCursor = sal_True );
250 : void HideCursor();
251 :
252 0 : Outliner* GetOutliner() const { return pOwner; }
253 :
254 : void SetWindow( Window* pWindow );
255 : Window* GetWindow() const;
256 :
257 : void SetReadOnly( sal_Bool bReadOnly );
258 : sal_Bool IsReadOnly() const;
259 :
260 : void SetOutputArea( const Rectangle& rRect );
261 : Rectangle GetOutputArea() const;
262 :
263 : Rectangle GetVisArea() const;
264 :
265 : void CreateSelectionList (std::vector<Paragraph*> &aSelList) ;
266 :
267 : // Retruns the number of selected paragraphs
268 : sal_uLong Select( Paragraph* pParagraph,
269 : sal_Bool bSelect=sal_True,
270 : sal_Bool bWChildren=sal_True);
271 :
272 : String GetSelected() const;
273 : void SelectRange( sal_uLong nFirst, sal_uInt16 nCount );
274 : void SetAttribs( const SfxItemSet& );
275 : void Indent( short nDiff );
276 : void AdjustDepth( short nDX ); // Later replace with Indent!
277 :
278 : sal_Bool AdjustHeight( long nDY );
279 :
280 : sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
281 :
282 : void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
283 : void InsertText( const OutlinerParaObject& rParaObj );
284 : void Expand();
285 : void Collapse();
286 : void ExpandAll();
287 : void CollapseAll();
288 :
289 : void SetBackgroundColor( const Color& rColor );
290 : Color GetBackgroundColor();
291 :
292 : SfxItemSet GetAttribs();
293 :
294 : void Cut();
295 : void Copy();
296 : void Paste();
297 : void PasteSpecial();
298 :
299 : const SfxStyleSheet* GetStyleSheet() const;
300 : SfxStyleSheet* GetStyleSheet();
301 :
302 : void SetControlWord( sal_uLong nWord );
303 : sal_uLong GetControlWord() const;
304 :
305 : void SetAnchorMode( EVAnchorMode eMode );
306 : EVAnchorMode GetAnchorMode() const;
307 :
308 : Pointer GetPointer( const Point& rPosPixel );
309 : void Command( const CommandEvent& rCEvt );
310 :
311 : EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
312 : EESpellState StartThesaurus();
313 : sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
314 :
315 : // for text conversion
316 : void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
317 :
318 : void TransliterateText( sal_Int32 nTransliterationMode );
319 :
320 : ESelection GetSelection();
321 :
322 : sal_uInt16 GetSelectedScriptType() const;
323 :
324 : void SetVisArea( const Rectangle& rRec );
325 : void SetSelection( const ESelection& );
326 :
327 : void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0, sal_Bool bKeepLanguages = sal_False );
328 : void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs );
329 : sal_Bool HasSelection() const;
330 :
331 : void InsertField( const SvxFieldItem& rFld );
332 : const SvxFieldItem* GetFieldUnderMousePointer() const;
333 : const SvxFieldItem* GetFieldAtSelection() const;
334 :
335 : /** enables numbering for the selected paragraphs if the numbering of the first paragraph is off
336 : or disables numbering for the selected paragraphs if the numbering of the first paragraph is on
337 : */
338 : void ToggleBullets();
339 :
340 : /** enables numbering for the selected paragraphs that are not enabled and ignore all selected
341 : paragraphs that already have numbering enabled.
342 : */
343 : void EnableBullets();
344 :
345 : sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
346 : sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
347 : void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
348 :
349 : void SetInvalidateMore( sal_uInt16 nPixel );
350 : sal_uInt16 GetInvalidateMore() const;
351 :
352 : String GetSurroundingText() const;
353 : Selection GetSurroundingTextSelection() const;
354 : };
355 :
356 :
357 : // some thesaurus functionality to avoid code duplication in different projects...
358 : bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView );
359 : void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText );
360 :
361 : typedef ::std::vector< OutlinerView* > ViewList;
362 :
363 : class EDITENG_DLLPUBLIC DrawPortionInfo
364 : {
365 : public:
366 : const Point& mrStartPos;
367 : const String& mrText;
368 : sal_uInt16 mnTextStart;
369 : sal_uInt16 mnTextLen;
370 : sal_uInt16 mnPara;
371 : xub_StrLen mnIndex;
372 : const SvxFont& mrFont;
373 : const sal_Int32* mpDXArray;
374 :
375 : const EEngineData::WrongSpellVector* mpWrongSpellVector;
376 : const SvxFieldData* mpFieldData;
377 : const ::com::sun::star::lang::Locale* mpLocale;
378 : const Color maOverlineColor;
379 : const Color maTextLineColor;
380 :
381 : sal_uInt8 mnBiDiLevel;
382 :
383 : bool mbFilled;
384 : long mnWidthToFill;
385 :
386 : // bitfield
387 : unsigned mbEndOfLine : 1;
388 : unsigned mbEndOfParagraph : 1;
389 : unsigned mbEndOfBullet : 1;
390 :
391 : sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; }
392 : sal_Bool IsRTL() const;
393 :
394 322 : DrawPortionInfo(
395 : const Point& rPos,
396 : const String& rTxt,
397 : sal_uInt16 nTxtStart,
398 : sal_uInt16 nTxtLen,
399 : const SvxFont& rFnt,
400 : sal_uInt16 nPar,
401 : xub_StrLen nIdx,
402 : const sal_Int32* pDXArr,
403 : const EEngineData::WrongSpellVector* pWrongSpellVector,
404 : const SvxFieldData* pFieldData,
405 : const ::com::sun::star::lang::Locale* pLocale,
406 : const Color& rOverlineColor,
407 : const Color& rTextLineColor,
408 : sal_uInt8 nBiDiLevel,
409 : bool bFilled,
410 : long nWidthToFill,
411 : bool bEndOfLine,
412 : bool bEndOfParagraph,
413 : bool bEndOfBullet)
414 : : mrStartPos(rPos),
415 : mrText(rTxt),
416 : mnTextStart(nTxtStart),
417 : mnTextLen(nTxtLen),
418 : mnPara(nPar),
419 : mnIndex(nIdx),
420 : mrFont(rFnt),
421 : mpDXArray(pDXArr),
422 : mpWrongSpellVector(pWrongSpellVector),
423 : mpFieldData(pFieldData),
424 : mpLocale(pLocale),
425 : maOverlineColor(rOverlineColor),
426 : maTextLineColor(rTextLineColor),
427 : mnBiDiLevel(nBiDiLevel),
428 : mbFilled( bFilled ),
429 : mnWidthToFill( nWidthToFill ),
430 : mbEndOfLine(bEndOfLine),
431 : mbEndOfParagraph(bEndOfParagraph),
432 322 : mbEndOfBullet(bEndOfBullet)
433 322 : {}
434 : };
435 :
436 0 : class EDITENG_DLLPUBLIC DrawBulletInfo
437 : {
438 : public:
439 : const GraphicObject maBulletGraphicObject;
440 : Point maBulletPosition;
441 : Size maBulletSize;
442 :
443 0 : DrawBulletInfo(
444 : const GraphicObject& rBulletGraphicObject,
445 : const Point& rBulletPosition,
446 : const Size& rBulletSize)
447 : : maBulletGraphicObject(rBulletGraphicObject),
448 : maBulletPosition(rBulletPosition),
449 0 : maBulletSize(rBulletSize)
450 0 : {}
451 : };
452 :
453 : struct EDITENG_DLLPUBLIC PaintFirstLineInfo
454 : {
455 : sal_uInt16 mnPara;
456 : const Point& mrStartPos;
457 : long mnBaseLineY;
458 : const Point& mrOrigin;
459 : short mnOrientation;
460 : OutputDevice* mpOutDev;
461 :
462 0 : PaintFirstLineInfo( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
463 0 : : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev )
464 0 : {}
465 : };
466 :
467 : class SdrPage;
468 :
469 : class EditFieldInfo
470 : {
471 : private:
472 : Outliner* pOutliner;
473 : const SvxFieldItem& rFldItem;
474 :
475 : Color* pTxtColor;
476 : Color* pFldColor;
477 :
478 : String aRepresentation;
479 :
480 : sal_uInt16 nPara;
481 : xub_StrLen nPos;
482 : sal_Bool bSimpleClick;
483 :
484 : EditFieldInfo();
485 : EditFieldInfo( const EditFieldInfo& );
486 :
487 : SdrPage* mpSdrPage;
488 :
489 : public:
490 388 : EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_uInt16 nPa, xub_StrLen nPo )
491 388 : : rFldItem( rFItem )
492 : {
493 388 : pOutliner = pOutl;
494 388 : nPara = nPa; nPos = nPo;
495 388 : pTxtColor = 0; pFldColor = 0; bSimpleClick = sal_False;
496 388 : mpSdrPage = 0;
497 388 : }
498 388 : ~EditFieldInfo()
499 388 : {
500 388 : delete pTxtColor;
501 388 : delete pFldColor;
502 388 : }
503 :
504 776 : Outliner* GetOutliner() const { return pOutliner; }
505 :
506 388 : const SvxFieldItem& GetField() const { return rFldItem; }
507 :
508 388 : Color* GetTxtColor() const { return pTxtColor; }
509 0 : void SetTxtColor( const Color& rColor )
510 0 : { delete pTxtColor; pTxtColor = new Color( rColor ); }
511 :
512 388 : Color* GetFldColor() const { return pFldColor; }
513 0 : void SetFldColor( const Color& rColor )
514 0 : { delete pFldColor; pFldColor = new Color( rColor ); }
515 0 : void ClearFldColor()
516 0 : { delete pFldColor; pFldColor = 0; }
517 :
518 0 : sal_uInt16 GetPara() const { return nPara; }
519 0 : xub_StrLen GetPos() const { return nPos; }
520 :
521 : sal_Bool IsSimpleClick() const { return bSimpleClick; }
522 0 : void SetSimpleClick( sal_Bool bSimple ) { bSimpleClick = bSimple; }
523 :
524 : const String& GetRepresentation() const { return aRepresentation; }
525 388 : String& GetRepresentation() { return aRepresentation; }
526 388 : void SetRepresentation( const String& rStr ) { aRepresentation = rStr; }
527 :
528 0 : void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; }
529 388 : SdrPage* GetSdrPage() const { return mpSdrPage; }
530 : };
531 :
532 0 : struct EBulletInfo
533 : {
534 : sal_Bool bVisible;
535 : sal_uInt16 nType; // see SvxNumberType
536 : String aText;
537 : SvxFont aFont;
538 : Graphic aGraphic;
539 : sal_uInt16 nParagraph;
540 : Rectangle aBounds;
541 :
542 0 : EBulletInfo() : bVisible( sal_False ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {}
543 : };
544 :
545 : #define OUTLINERMODE_DONTKNOW 0x0000
546 : #define OUTLINERMODE_TEXTOBJECT 0x0001
547 : #define OUTLINERMODE_TITLEOBJECT 0x0002
548 : #define OUTLINERMODE_OUTLINEOBJECT 0x0003
549 : #define OUTLINERMODE_OUTLINEVIEW 0x0004
550 :
551 : #define OUTLINERMODE_USERMASK 0x00FF
552 :
553 : #define OUTLINERMODE_SUBTITLE (0x0100|OUTLINERMODE_TEXTOBJECT)
554 : #define OUTLINERMODE_NOTE (0x0200|OUTLINERMODE_TEXTOBJECT)
555 :
556 : class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
557 : {
558 : friend class OutlinerView;
559 : friend class OutlinerEditEng;
560 : friend class OutlinerParaObject;
561 : friend class OLUndoExpand;
562 : friend class OutlinerUndoChangeDepth;
563 : friend class OutlinerUndoCheckPara;
564 : friend class OutlinerUndoChangeParaFlags;
565 :
566 : OutlinerEditEng* pEditEngine;
567 :
568 : ParagraphList* pParaList;
569 : ViewList aViewList;
570 :
571 : Paragraph* pHdlParagraph;
572 : sal_uLong mnFirstSelPage;
573 : Link aDrawPortionHdl;
574 : Link aDrawBulletHdl;
575 : Link aExpandHdl;
576 : Link aParaInsertedHdl;
577 : Link aParaRemovingHdl;
578 : Link aDepthChangedHdl;
579 : Link aWidthArrReqHdl;
580 : Link aBeginMovingHdl;
581 : Link aEndMovingHdl;
582 : Link aIndentingPagesHdl;
583 : Link aRemovingPagesHdl;
584 : Link aFieldClickedHdl;
585 : Link aCalcFieldValueHdl;
586 : Link maPaintFirstLineHdl;
587 : Link maBeginPasteOrDropHdl;
588 : Link maEndPasteOrDropHdl;
589 :
590 : sal_Int16 nDepthChangedHdlPrevDepth;
591 : sal_uInt16 mnDepthChangeHdlPrevFlags;
592 : sal_Int16 nMaxDepth;
593 : const sal_Int16 nMinDepth;
594 : sal_uInt16 nFirstPage;
595 :
596 : sal_uInt16 nOutlinerMode;
597 :
598 : sal_Bool bIsExpanding; // Only valid in Expand/Collaps-Hdl, reset
599 : sal_Bool bFirstParaIsEmpty;
600 : sal_Bool bBlockInsCallback;
601 : sal_Bool bStrippingPortions;
602 : sal_Bool bPasting;
603 :
604 : sal_uLong nDummy;
605 :
606 : #ifdef _OUTLINER_CXX
607 :
608 : DECL_LINK( ParaVisibleStateChangedHdl, Paragraph* );
609 : DECL_LINK( BeginMovingParagraphsHdl, void* );
610 : DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo* );
611 : DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
612 : DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
613 : DECL_LINK( EditEngineNotifyHdl, EENotify* );
614 : void ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd );
615 : sal_Bool ImplHasBullet( sal_uInt16 nPara ) const;
616 : Size ImplGetBulletSize( sal_uInt16 nPara );
617 : sal_uInt16 ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt );
618 : void ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChildren );
619 : String ImplGetBulletText( sal_uInt16 nPara );
620 : void ImplCheckNumBulletItem( sal_uInt16 nPara );
621 : void ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False );
622 : void ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle = NULL );
623 :
624 : void ImplBlockInsertionCallbacks( sal_Bool b );
625 :
626 : void ImplCheckStyleSheet( sal_uInt16 nPara, sal_Bool bReplaceExistingStyle );
627 : void ImpRecalcBulletIndent( sal_uLong nPara );
628 :
629 : const SvxBulletItem& ImpGetBullet( sal_uLong nPara, sal_uInt16& );
630 : void ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara );
631 : bool ImpConvertEdtToOut( sal_uInt32 nPara, EditView* pView = 0 );
632 :
633 : void ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount );
634 : long ImpCalcMaxBulletWidth( sal_uInt16 nPara, const SvxBulletItem& rBullet );
635 : Font ImpCalcBulletFont( sal_uInt16 nPara ) const;
636 : Rectangle ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos );
637 : long ImpGetTextIndent( sal_uLong nPara );
638 : sal_Bool ImpCanIndentSelectedPages( OutlinerView* pCurView );
639 : sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView );
640 : sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_uInt16 nFirstPage, sal_uInt16 nPages );
641 :
642 51382 : sal_uInt16 ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
643 : void ImplCheckDepth( sal_Int16& rnDepth ) const;
644 : #endif
645 :
646 : protected:
647 : void ParagraphInserted( sal_uInt16 nParagraph );
648 : void ParagraphDeleted( sal_uInt16 nParagraph );
649 : void ParaAttribsChanged( sal_uInt16 nParagraph );
650 :
651 : virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
652 :
653 : void InvalidateBullet( Paragraph* pPara, sal_uLong nPara );
654 : void PaintBullet( sal_uInt16 nPara, const Point& rStartPos,
655 : const Point& rOrigin, short nOrientation,
656 : OutputDevice* pOutDev );
657 :
658 : // used by OutlinerEditEng. Allows Outliner objects to provide
659 : // bullet access to the EditEngine.
660 : virtual const SvxNumberFormat* GetNumberFormat( sal_uInt16 nPara ) const;
661 :
662 : public:
663 :
664 : Outliner( SfxItemPool* pPool, sal_uInt16 nOutlinerMode );
665 : virtual ~Outliner();
666 :
667 : void Init( sal_uInt16 nOutlinerMode );
668 9702 : sal_uInt16 GetMode() const { return nOutlinerMode; }
669 :
670 : void SetVertical( sal_Bool bVertical );
671 : sal_Bool IsVertical() const;
672 :
673 : void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
674 :
675 : void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
676 : EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
677 :
678 : sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
679 : LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const;
680 :
681 : void SetAsianCompressionMode( sal_uInt16 nCompressionMode );
682 :
683 : void SetKernAsianPunctuation( sal_Bool bEnabled );
684 :
685 : void SetAddExtLeading( sal_Bool b );
686 :
687 : size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) );
688 : OutlinerView* RemoveView( OutlinerView* pView );
689 : OutlinerView* RemoveView( size_t nIndex );
690 : OutlinerView* GetView( size_t nIndex ) const;
691 : size_t GetViewCount() const;
692 :
693 : Paragraph* Insert( const String& rText, sal_uLong nAbsPos = CONTAINER_APPEND, sal_Int16 nDepth = 0 );
694 : void SetText( const OutlinerParaObject& );
695 : void AddText( const OutlinerParaObject& );
696 : void SetText( const String& rText, Paragraph* pParagraph );
697 : String GetText( Paragraph* pPara, sal_uLong nParaCount=1 ) const;
698 :
699 : OutlinerParaObject* CreateParaObject( sal_uInt16 nStartPara = 0, sal_uInt16 nParaCount = 0xFFFF ) const;
700 :
701 : const SfxItemSet& GetEmptyItemSet() const;
702 :
703 : void SetRefMapMode( const MapMode& );
704 : MapMode GetRefMapMode() const;
705 :
706 : void SetBackgroundColor( const Color& rColor );
707 : Color GetBackgroundColor() const;
708 :
709 41670 : sal_Int16 GetMinDepth() const { return -1; }
710 :
711 : void SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParas = sal_False );
712 0 : sal_Int16 GetMaxDepth() const { return nMaxDepth; }
713 :
714 : void SetUpdateMode( sal_Bool bUpdate );
715 : sal_Bool GetUpdateMode() const;
716 :
717 : void Clear();
718 :
719 : void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
720 :
721 : sal_uLong GetParagraphCount() const;
722 : Paragraph* GetParagraph( sal_uLong nAbsPos ) const;
723 :
724 : sal_Bool HasParent( Paragraph* pParagraph ) const;
725 : sal_Bool HasChildren( Paragraph* pParagraph ) const;
726 : sal_uLong GetChildCount( Paragraph* pParent ) const;
727 : sal_Bool IsExpanded( Paragraph* pPara ) const;
728 : Paragraph* GetParent( Paragraph* pParagraph ) const;
729 : sal_uLong GetAbsPos( Paragraph* pPara );
730 :
731 : sal_Int16 GetDepth( sal_uLong nPara ) const;
732 : void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth );
733 :
734 : sal_Bool IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); }
735 :
736 : void EnableUndo( sal_Bool bEnable );
737 : sal_Bool IsUndoEnabled() const;
738 : void UndoActionStart( sal_uInt16 nId );
739 : void UndoActionEnd( sal_uInt16 nId );
740 : void InsertUndo( EditUndo* pUndo );
741 : sal_Bool IsInUndo();
742 :
743 : void ClearModifyFlag();
744 : sal_Bool IsModified() const;
745 :
746 0 : Paragraph* GetHdlParagraph() const { return pHdlParagraph; }
747 : sal_Bool IsExpanding() const { return bIsExpanding; }
748 :
749 : virtual void ExpandHdl();
750 : void SetExpandHdl( const Link& rLink ) { aExpandHdl = rLink; }
751 : Link GetExpandHdl() const { return aExpandHdl; }
752 :
753 : virtual void ParagraphInsertedHdl();
754 0 : void SetParaInsertedHdl(const Link& rLink){aParaInsertedHdl=rLink;}
755 0 : Link GetParaInsertedHdl() const { return aParaInsertedHdl; }
756 :
757 : virtual void ParagraphRemovingHdl();
758 0 : void SetParaRemovingHdl(const Link& rLink){aParaRemovingHdl=rLink;}
759 0 : Link GetParaRemovingHdl() const { return aParaRemovingHdl; }
760 :
761 : virtual void DepthChangedHdl();
762 0 : void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;}
763 0 : Link GetDepthChangedHdl() const { return aDepthChangedHdl; }
764 0 : sal_Int16 GetPrevDepth() const { return nDepthChangedHdlPrevDepth; }
765 0 : sal_uInt16 GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; }
766 :
767 : virtual long RemovingPagesHdl( OutlinerView* );
768 0 : void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;}
769 : Link GetRemovingPagesHdl() const { return aRemovingPagesHdl; }
770 : virtual long IndentingPagesHdl( OutlinerView* );
771 0 : void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;}
772 : Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; }
773 : // valid only in the two upper handlers
774 0 : sal_uInt16 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; }
775 :
776 : // valid only in the two upper handlers
777 : sal_uLong GetFirstSelPage() const { return mnFirstSelPage; }
778 :
779 3158 : void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; }
780 2492 : Link GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; }
781 :
782 : void SetFieldClickedHdl(const Link& rLink ) { aFieldClickedHdl= rLink; }
783 : Link GetFieldClickedHdl() const { return aFieldClickedHdl; }
784 :
785 218 : void SetDrawPortionHdl(const Link& rLink){aDrawPortionHdl=rLink;}
786 : Link GetDrawPortionHdl() const { return aDrawPortionHdl; }
787 :
788 218 : void SetDrawBulletHdl(const Link& rLink){aDrawBulletHdl=rLink;}
789 : Link GetDrawBulletHdl() const { return aDrawBulletHdl; }
790 :
791 0 : void SetPaintFirstLineHdl(const Link& rLink) { maPaintFirstLineHdl = rLink; }
792 : Link GetPaintFirstLineHdl() const { return maPaintFirstLineHdl; }
793 :
794 : void SetModifyHdl( const Link& rLink );
795 : Link GetModifyHdl() const;
796 :
797 : void SetNotifyHdl( const Link& rLink );
798 :
799 : void SetStatusEventHdl( const Link& rLink );
800 : Link GetStatusEventHdl() const;
801 :
802 : void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
803 : void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
804 :
805 : const Size& GetPaperSize() const;
806 : void SetPaperSize( const Size& rSize );
807 :
808 0 : void SetFirstPageNumber( sal_uInt16 n ) { nFirstPage = n; }
809 : sal_uInt16 GetFirstPageNumber() const { return nFirstPage; }
810 :
811 : void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
812 : void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
813 : void ClearPolygon();
814 :
815 : const Size& GetMinAutoPaperSize() const;
816 : void SetMinAutoPaperSize( const Size& rSz );
817 :
818 : const Size& GetMaxAutoPaperSize() const;
819 : void SetMaxAutoPaperSize( const Size& rSz );
820 :
821 : void SetDefTab( sal_uInt16 nTab );
822 :
823 : sal_Bool IsFlatMode() const;
824 : void SetFlatMode( sal_Bool bFlat );
825 :
826 : void EnableAutoColor( sal_Bool b );
827 :
828 : void ForceAutoColor( sal_Bool b );
829 : sal_Bool IsForceAutoColor() const;
830 :
831 : EBulletInfo GetBulletInfo( sal_uInt16 nPara );
832 :
833 : void SetWordDelimiters( const String& rDelimiters );
834 : String GetWordDelimiters() const;
835 : String GetWord( sal_uInt16 nPara, xub_StrLen nIndex );
836 :
837 : void StripPortions();
838 :
839 : virtual void DrawingText(
840 : const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen,
841 : const sal_Int32* pDXArray, const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
842 : const EEngineData::WrongSpellVector* pWrongSpellVector,
843 : const SvxFieldData* pFieldData,
844 : bool bEndOfLine,
845 : bool bEndOfParagraph,
846 : bool bEndOfBullet,
847 : const ::com::sun::star::lang::Locale* pLocale,
848 : const Color& rOverlineColor,
849 : const Color& rTextLineColor);
850 :
851 : virtual void DrawingTab(
852 : const Point& rStartPos, long nWidth, const String& rChar,
853 : const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
854 : bool bEndOfLine,
855 : bool bEndOfParagraph,
856 : const Color& rOverlineColor,
857 : const Color& rTextLineColor);
858 :
859 : Size CalcTextSize();
860 : Size CalcTextSizeNTP();
861 :
862 : void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
863 : SfxStyleSheetPool* GetStyleSheetPool();
864 :
865 : sal_Bool IsInSelectionMode() const;
866 :
867 : void SetStyleSheet( sal_uLong nPara, SfxStyleSheet* pStyle );
868 : SfxStyleSheet* GetStyleSheet( sal_uLong nPara );
869 :
870 : void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& );
871 : SfxItemSet GetParaAttribs( sal_uInt16 nPara );
872 :
873 : void Remove( Paragraph* pPara, sal_uLong nParaCount );
874 : sal_Bool Expand( Paragraph* );
875 : sal_Bool Collapse( Paragraph* );
876 :
877 : void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag );
878 : bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const;
879 :
880 : // Returns an array containing the widths of the Bullet Indentations
881 : // Last value must be -1. Is deleted by the outliner.
882 : Link GetWidthArrReqHdl() const{ return aWidthArrReqHdl; }
883 : void SetWidthArrReqHdl(const Link& rLink){aWidthArrReqHdl=rLink; }
884 :
885 : void SetControlWord( sal_uLong nWord );
886 : sal_uLong GetControlWord() const;
887 :
888 0 : Link GetBeginMovingHdl() const { return aBeginMovingHdl; }
889 0 : void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;}
890 0 : Link GetEndMovingHdl() const {return aEndMovingHdl;}
891 0 : void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;}
892 :
893 : sal_uLong GetLineCount( sal_uLong nParagraph ) const;
894 : sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const;
895 : sal_uLong GetLineHeight( sal_uLong nParagraph, sal_uLong nLine = 0 );
896 :
897 : // nFormat must be a value from the enum EETextFormat (due to CLOOKS)
898 : sal_uLong Read( SvStream& rInput, const String& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
899 :
900 : ::svl::IUndoManager&
901 : GetUndoManager();
902 :
903 : void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
904 : void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
905 : void QuickInsertLineBreak( const ESelection& rSel );
906 :
907 : // Only for EditEngine mode
908 : void QuickInsertText( const String& rText, const ESelection& rSel );
909 : void QuickDelete( const ESelection& rSel );
910 : void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
911 : void QuickFormatDoc( sal_Bool bFull = sal_False );
912 :
913 : sal_Bool UpdateFields();
914 : void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL );
915 :
916 : virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
917 : virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
918 : virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
919 :
920 : void SetSpeller( ::com::sun::star::uno::Reference<
921 : ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
922 : ::com::sun::star::uno::Reference<
923 : ::com::sun::star::linguistic2::XSpellChecker1 >
924 : GetSpeller();
925 : void SetHyphenator( ::com::sun::star::uno::Reference<
926 : ::com::sun::star::linguistic2::XHyphenator >& xHyph );
927 :
928 : void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
929 :
930 : // Depricated
931 : void SetDefaultLanguage( LanguageType eLang );
932 : LanguageType GetDefaultLanguage() const;
933 :
934 : void CompleteOnlineSpelling();
935 :
936 : EESpellState HasSpellErrors();
937 : sal_Bool HasText( const SvxSearchItem& rSearchItem );
938 : virtual sal_Bool SpellNextDocument();
939 :
940 : // for text conversion
941 : sal_Bool HasConvertibleTextPortion( LanguageType nLang );
942 : virtual sal_Bool ConvertNextDocument();
943 :
944 : void SetEditTextObjectPool( SfxItemPool* pPool );
945 : SfxItemPool* GetEditTextObjectPool() const;
946 :
947 : void SetRefDevice( OutputDevice* pRefDev );
948 : OutputDevice* GetRefDevice() const;
949 :
950 : sal_uLong GetTextHeight() const;
951 : sal_uLong GetTextHeight( sal_uLong nParagraph ) const;
952 : Point GetDocPosTopLeft( sal_uLong nParagraph );
953 : Point GetDocPos( const Point& rPaperPos ) const;
954 : sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
955 : sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBuuletPos );
956 :
957 : void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
958 : void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY );
959 : void EraseVirtualDevice();
960 :
961 : sal_Bool ShouldCreateBigTextObject() const;
962 :
963 37682 : const EditEngine& GetEditEngine() const { return *((EditEngine*)pEditEngine); }
964 :
965 : // this is needed for StarOffice Api
966 : void SetLevelDependendStyleSheet( sal_uInt16 nPara );
967 :
968 1134 : sal_uInt16 GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
969 :
970 : void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
971 : // spell and return a sentence
972 : bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
973 : // put spell position to start of current sentence
974 : void PutSpellingToSentenceStart( EditView& rEditView );
975 : // applies a changed sentence
976 : void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
977 :
978 : /** sets a link that is called at the beginning of a drag operation at an edit view */
979 : void SetBeginDropHdl( const Link& rLink );
980 :
981 : /** sets a link that is called at the end of a drag operation at an edit view */
982 : void SetEndDropHdl( const Link& rLink );
983 :
984 : /** sets a link that is called before a drop or paste operation. */
985 : void SetBeginPasteOrDropHdl( const Link& rLink );
986 : Link GetBeginPasteOrDropHdl() const { return maBeginPasteOrDropHdl; }
987 :
988 : /** sets a link that is called after a drop or paste operation. */
989 : void SetEndPasteOrDropHdl( const Link& rLink );
990 : Link GetEndPasteOrDropHdl() const { return maEndPasteOrDropHdl; }
991 :
992 : virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
993 : virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
994 :
995 : virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
996 : virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
997 : };
998 :
999 : #endif
1000 :
1001 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|