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