Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _IMPEDIT_HXX
29 : : #define _IMPEDIT_HXX
30 : :
31 : : #include <editdoc.hxx>
32 : : #include <editsel.hxx>
33 : : #include <editundo.hxx>
34 : : #include <editobj2.hxx>
35 : : #include <editstt2.hxx>
36 : : #include <editeng/editdata.hxx>
37 : : #include <editeng/svxacorr.hxx>
38 : : #include <editeng/SpellPortions.hxx>
39 : : #include <editeng/eedata.hxx>
40 : : #include "editeng/editeng.hxx"
41 : : #include <vcl/virdev.hxx>
42 : : #include <vcl/gdimtf.hxx>
43 : : #include <vcl/cursor.hxx>
44 : :
45 : : #include <vcl/dndhelp.hxx>
46 : : #include <svl/ondemand.hxx>
47 : : #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
48 : : #include <com/sun/star/linguistic2/SpellFailure.hpp>
49 : : #include <com/sun/star/linguistic2/XSpellChecker.hpp>
50 : : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
51 : : #include <com/sun/star/linguistic2/XHyphenator.hpp>
52 : : #include <com/sun/star/lang/Locale.hpp>
53 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
54 : : #include <com/sun/star/i18n/XBreakIterator.hpp>
55 : : #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
56 : : #include <com/sun/star/i18n/WordType.hpp>
57 : : #include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
58 : : #include <com/sun/star/uno/Sequence.hxx>
59 : :
60 : : #include <i18npool/lang.h>
61 : : #include <rtl/ref.hxx>
62 : :
63 : : #include <boost/noncopyable.hpp>
64 : :
65 : : DBG_NAMEEX( EditView )
66 : : DBG_NAMEEX( EditEngine )
67 : :
68 : : #define PIMPE pImpEditView->pEditEngine
69 : :
70 : : #define DEL_LEFT 1
71 : : #define DEL_RIGHT 2
72 : : #define TRAVEL_X_DONTKNOW 0xFFFFFFFF
73 : : #define CURSOR_BIDILEVEL_DONTKNOW 0xFFFF
74 : : #define MAXCHARSINPARA 0x3FFF-CHARPOSGROW // Max 16K, because WYSIWYG array
75 : :
76 : : #define ATTRSPECIAL_WHOLEWORD 1
77 : : #define ATTRSPECIAL_EDGE 2
78 : :
79 : : #define GETCRSR_TXTONLY 0x0001
80 : : #define GETCRSR_STARTOFLINE 0x0002
81 : : #define GETCRSR_ENDOFLINE 0x0004
82 : : #define GETCRSR_PREFERPORTIONSTART 0x0008
83 : :
84 : : #define LINE_SEP 0x0A
85 : :
86 : : class EditView;
87 : : class EditEngine;
88 : : class SvxColorList;
89 : :
90 : : class SvxSearchItem;
91 : : class SvxLRSpaceItem;
92 : : class TextRanger;
93 : : class SvKeyValueIterator;
94 : : class SvxForbiddenCharactersTable;
95 : : class SvtCTLOptions;
96 : : class Window;
97 : : class SvxNumberFormat;
98 : :
99 : :
100 : : namespace com {
101 : : namespace sun {
102 : : namespace star {
103 : : namespace datatransfer {
104 : : namespace clipboard {
105 : : class XClipboard;
106 : : }}}}}
107 : :
108 : : namespace svtools {
109 : : class ColorConfig;
110 : : }
111 : :
112 : : struct DragAndDropInfo
113 : : {
114 : : Rectangle aCurCursor;
115 : : Rectangle aCurSavedCursor;
116 : : sal_uInt16 nSensibleRange;
117 : : sal_uInt16 nCursorWidth;
118 : : ESelection aBeginDragSel;
119 : : EditPaM aDropDest;
120 : : sal_uInt16 nOutlinerDropDest;
121 : : ESelection aDropSel;
122 : : VirtualDevice* pBackground;
123 : : const SvxFieldItem* pField;
124 : : sal_Bool bVisCursor : 1;
125 : : sal_Bool bDroppedInMe : 1;
126 : : sal_Bool bStarterOfDD : 1;
127 : : sal_Bool bHasValidData : 1;
128 : : sal_Bool bUndoAction : 1;
129 : : sal_Bool bOutlinerMode : 1;
130 : : sal_Bool bDragAccepted : 1;
131 : :
132 : 0 : DragAndDropInfo()
133 : 0 : {
134 : 0 : pBackground = NULL; bVisCursor = sal_False; bDroppedInMe = sal_False; bStarterOfDD = sal_False;
135 : 0 : bHasValidData = sal_False; bUndoAction = sal_False; bOutlinerMode = sal_False;
136 : 0 : nSensibleRange = 0; nCursorWidth = 0; pField = 0; nOutlinerDropDest = 0; bDragAccepted = sal_False;
137 : 0 : }
138 : : };
139 : :
140 : : struct ImplIMEInfos
141 : : {
142 : : String aOldTextAfterStartPos;
143 : : sal_uInt16* pAttribs;
144 : : EditPaM aPos;
145 : : sal_uInt16 nLen;
146 : : sal_Bool bCursor;
147 : : sal_Bool bWasCursorOverwrite;
148 : :
149 : : ImplIMEInfos( const EditPaM& rPos, const String& rOldTextAfterStartPos );
150 : : ~ImplIMEInfos();
151 : :
152 : : void CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL );
153 : : void DestroyAttribs();
154 : : };
155 : :
156 : : // #i18881# to be able to identify the postions of changed words
157 : : // the positions of each portion need to be saved
158 : : typedef std::vector<EditSelection> SpellContentSelections;
159 : :
160 : 18 : struct SpellInfo
161 : : {
162 : : EESpellState eState;
163 : : EPaM aSpellStart;
164 : : EPaM aSpellTo;
165 : : EditPaM aCurSentenceStart;
166 : : sal_Bool bSpellToEnd;
167 : : sal_Bool bMultipleDoc;
168 : : ::svx::SpellPortions aLastSpellPortions;
169 : : SpellContentSelections aLastSpellContentSelections;
170 : 18 : SpellInfo()
171 [ + - ]: 18 : { bSpellToEnd = sal_True; eState = EE_SPELL_OK; bMultipleDoc = sal_False; }
172 : : };
173 : :
174 : : // used for text conversion
175 : : struct ConvInfo
176 : : {
177 : : EPaM aConvStart;
178 : : EPaM aConvTo;
179 : : EPaM aConvContinue; // position to start search for next text portion (word) with
180 : : sal_Bool bConvToEnd;
181 : : sal_Bool bMultipleDoc;
182 : :
183 : 0 : ConvInfo() { bConvToEnd = sal_True; bMultipleDoc = sal_False; }
184 : : };
185 : :
186 : : struct FormatterFontMetric
187 : : {
188 : : sal_uInt16 nMaxAscent;
189 : : sal_uInt16 nMaxDescent;
190 : :
191 : 418811 : FormatterFontMetric() { nMaxAscent = 0; nMaxDescent = 0; /* nMinLeading = 0xFFFF; */ }
192 : 418811 : sal_uInt16 GetHeight() const { return nMaxAscent+nMaxDescent; }
193 : : };
194 : :
195 : : class IdleFormattter : public Timer
196 : : {
197 : : private:
198 : : EditView* pView;
199 : : int nRestarts;
200 : :
201 : : public:
202 : : IdleFormattter();
203 : : ~IdleFormattter();
204 : :
205 : : void DoIdleFormat( EditView* pV );
206 : : void ForceTimeout();
207 : 0 : void ResetRestarts() { nRestarts = 0; }
208 : 0 : EditView* GetView() { return pView; }
209 : : };
210 : :
211 : : // ----------------------------------------------------------------------
212 : : // class ImpEditView
213 : : // ---------------------------------------------------------------------
214 : : class ImpEditView : public vcl::unohelper::DragAndDropClient
215 : : {
216 : : friend class EditView;
217 : : friend class EditEngine;
218 : : friend class ImpEditEngine;
219 : : using vcl::unohelper::DragAndDropClient::dragEnter;
220 : : using vcl::unohelper::DragAndDropClient::dragExit;
221 : : using vcl::unohelper::DragAndDropClient::dragOver;
222 : :
223 : : private:
224 : : EditView* pEditView;
225 : : Cursor* pCursor;
226 : : Color* pBackgroundColor;
227 : : EditEngine* pEditEngine;
228 : : Window* pOutWin;
229 : : Pointer* pPointer;
230 : : DragAndDropInfo* pDragAndDropInfo;
231 : :
232 : : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener > mxDnDListener;
233 : :
234 : :
235 : : long nInvMore;
236 : : sal_uLong nControl;
237 : : sal_uInt32 nTravelXPos;
238 : : sal_uInt16 nExtraCursorFlags;
239 : : sal_uInt16 nCursorBidiLevel;
240 : : sal_uInt16 nScrollDiffX;
241 : : sal_Bool bReadOnly;
242 : : sal_Bool bClickedInSelection;
243 : : sal_Bool bActiveDragAndDropListener;
244 : :
245 : : Point aAnchorPoint;
246 : : Rectangle aOutArea;
247 : : Point aVisDocStartPos;
248 : : EESelectionMode eSelectionMode;
249 : : EditSelection aEditSelection;
250 : : EVAnchorMode eAnchorMode;
251 : :
252 : : protected:
253 : :
254 : : // DragAndDropClient
255 : : void dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException);
256 : : void dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException);
257 : : void drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException);
258 : : void dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException);
259 : : void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException);
260 : : void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException);
261 : :
262 : : void ShowDDCursor( const Rectangle& rRect );
263 : : void HideDDCursor();
264 : :
265 : : void ImplDrawHighlightRect( Window* pOutWin, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, PolyPolygon* pPolyPoly );
266 : :
267 : : public:
268 : : ImpEditView( EditView* pView, EditEngine* pEng, Window* pWindow );
269 : : ~ImpEditView();
270 : :
271 : 142 : EditView* GetEditViewPtr() { return pEditView; }
272 : :
273 : 12 : sal_uInt16 GetScrollDiffX() const { return nScrollDiffX; }
274 : 349 : void SetScrollDiffX( sal_uInt16 n ) { nScrollDiffX = n; }
275 : :
276 : 1040 : sal_uInt16 GetCursorBidiLevel() const { return nCursorBidiLevel; }
277 : 0 : void SetCursorBidiLevel( sal_uInt16 n ) { nCursorBidiLevel = n; }
278 : :
279 : : Point GetDocPos( const Point& rWindowPos ) const;
280 : : Point GetWindowPos( const Point& rDocPos ) const;
281 : : Rectangle GetWindowPos( const Rectangle& rDocPos ) const;
282 : :
283 : : void SetOutputArea( const Rectangle& rRec );
284 : : void ResetOutputArea( const Rectangle& rRec );
285 : 2019 : const Rectangle& GetOutputArea() const { return aOutArea; }
286 : :
287 : : sal_Bool IsVertical() const;
288 : :
289 : : sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL );
290 : :
291 : : sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent );
292 : : sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent );
293 : : sal_Bool MouseMove( const MouseEvent& rMouseEvent );
294 : : void Command( const CommandEvent& rCEvt );
295 : :
296 : : void CutCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, sal_Bool bCut );
297 : : void Paste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, sal_Bool bUseSpecial = sal_False );
298 : :
299 : 98 : void SetVisDocStartPos( const Point& rPos ) { aVisDocStartPos = rPos; }
300 : : const Point& GetVisDocStartPos() const { return aVisDocStartPos; }
301 : :
302 : 5232 : long GetVisDocLeft() const { return aVisDocStartPos.X(); }
303 : 7312 : long GetVisDocTop() const { return aVisDocStartPos.Y(); }
304 [ + - ]: 2972 : long GetVisDocRight() const { return aVisDocStartPos.X() + ( !IsVertical() ? aOutArea.GetWidth() : aOutArea.GetHeight() ); }
305 [ + - ]: 5052 : long GetVisDocBottom() const { return aVisDocStartPos.Y() + ( !IsVertical() ? aOutArea.GetHeight() : aOutArea.GetWidth() ); }
306 : : Rectangle GetVisDocArea() const;
307 : :
308 : 749 : EditSelection& GetEditSelection() { return aEditSelection; }
309 : : void SetEditSelection( const EditSelection& rEditSelection );
310 : 453 : sal_Bool HasSelection() const { return aEditSelection.HasRange(); }
311 : :
312 [ + - ]: 1115 : void DrawSelection() { DrawSelection( aEditSelection ); }
313 : : void DrawSelection( EditSelection, Region* pRegion = NULL );
314 : :
315 : 3513 : Window* GetWindow() const { return pOutWin; }
316 : :
317 : 1115 : EESelectionMode GetSelectionMode() const { return eSelectionMode; }
318 : : void SetSelectionMode( EESelectionMode eMode );
319 : :
320 : : inline void SetPointer( const Pointer& rPointer );
321 : : inline const Pointer& GetPointer();
322 : :
323 : : inline void SetCursor( const Cursor& rCursor );
324 : : inline Cursor* GetCursor();
325 : :
326 : : void AddDragAndDropListeners();
327 : : void RemoveDragAndDropListeners();
328 : :
329 : : sal_Bool IsBulletArea( const Point& rPos, sal_uInt16* pPara );
330 : :
331 : : // For the Selection Engine...
332 : : void CreateAnchor();
333 : : void DeselectAll();
334 : : sal_Bool SetCursorAtPoint( const Point& rPointPixel );
335 : : sal_Bool IsSelectionAtPoint( const Point& rPosPixel );
336 : : sal_Bool IsInSelection( const EditPaM& rPaM );
337 : :
338 : :
339 : : void SetAnchorMode( EVAnchorMode eMode );
340 : 0 : EVAnchorMode GetAnchorMode() const { return eAnchorMode; }
341 : : void CalcAnchorPoint();
342 : : void RecalcOutputArea();
343 : :
344 : : void ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_Bool test );
345 : : void ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_uInt16 nShowCursorFlags = 0 );
346 : : Pair Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck = RGCHK_NEG );
347 : :
348 : : void SetInsertMode( sal_Bool bInsert );
349 : 2315 : sal_Bool IsInsertMode() const { return ( ( nControl & EV_CNTRL_OVERWRITE ) == 0 ); }
350 : :
351 : : void EnablePaste( sal_Bool bEnable ) { SetFlags( nControl, EV_CNTRL_ENABLEPASTE, bEnable ); }
352 : 0 : sal_Bool IsPasteEnabled() const { return ( ( nControl & EV_CNTRL_ENABLEPASTE ) != 0 ); }
353 : :
354 : 0 : sal_Bool DoSingleLinePaste() const { return ( ( nControl & EV_CNTRL_SINGLELINEPASTE ) != 0 ); }
355 : 1375 : sal_Bool DoAutoScroll() const { return ( ( nControl & EV_CNTRL_AUTOSCROLL ) != 0 ); }
356 : 355 : sal_Bool DoBigScroll() const { return ( ( nControl & EV_CNTRL_BIGSCROLL ) != 0 ); }
357 : 223 : sal_Bool DoAutoSize() const { return ( ( nControl & EV_CNTRL_AUTOSIZE ) != 0 ); }
358 : 0 : sal_Bool DoAutoWidth() const { return ( ( nControl & EV_CNTRL_AUTOSIZEX) != 0 ); }
359 : 80 : sal_Bool DoAutoHeight() const { return ( ( nControl & EV_CNTRL_AUTOSIZEY) != 0 ); }
360 : 254 : sal_Bool DoInvalidateMore() const { return ( ( nControl & EV_CNTRL_INVONEMORE ) != 0 ); }
361 : :
362 : : void SetBackgroundColor( const Color& rColor );
363 : 271 : const Color& GetBackgroundColor() const {
364 [ + + ]: 271 : return ( pBackgroundColor ? *pBackgroundColor : pOutWin->GetBackground().GetColor() ); }
365 : :
366 : : sal_Bool IsWrongSpelledWord( const EditPaM& rPaM, sal_Bool bMarkIfWrong );
367 : : String SpellIgnoreOrAddWord( sal_Bool bAdd );
368 : :
369 : : const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pPara, sal_uInt16* pPos ) const;
370 : : void DeleteSelected();
371 : :
372 : : // If possible invalidate more than OutputArea, for the DrawingEngine text frame
373 : 0 : void SetInvalidateMore( sal_uInt16 nPixel ) { nInvMore = nPixel; }
374 : 0 : sal_uInt16 GetInvalidateMore() const { return (sal_uInt16)nInvMore; }
375 : : };
376 : :
377 : : // ----------------------------------------------------------------------
378 : : // ImpEditEngine
379 : : // ----------------------------------------------------------------------
380 : :
381 : : class ImpEditEngine : public SfxListener, boost::noncopyable
382 : : {
383 : : friend class EditEngine;
384 : : friend class EditDbg;
385 : :
386 : : typedef EditEngine::ViewsType ViewsType;
387 : :
388 : : private:
389 : :
390 : : // ================================================================
391 : : // Data ...
392 : : // ================================================================
393 : :
394 : : // Document Specific data ...
395 : : ParaPortionList aParaPortionList; // Formatting
396 : : Size aPaperSize; // Layout
397 : : Size aMinAutoPaperSize; // Layout ?
398 : : Size aMaxAutoPaperSize; // Layout ?
399 : : EditDoc aEditDoc; // Document content
400 : :
401 : : // Engine Specific data ...
402 : : EditEngine* pEditEngine;
403 : : ViewsType aEditViews;
404 : : EditView* pActiveView;
405 : : TextRanger* pTextRanger;
406 : :
407 : : SfxStyleSheetPool* pStylePool;
408 : : SfxItemPool* pTextObjectPool;
409 : :
410 : : VirtualDevice* pVirtDev;
411 : : OutputDevice* pRefDev;
412 : :
413 : : svtools::ColorConfig* pColorConfig;
414 : : mutable SvtCTLOptions* pCTLOptions;
415 : :
416 : : SfxItemSet* pEmptyItemSet;
417 : : EditUndoManager* pUndoManager;
418 : : ESelection* pUndoMarkSelection;
419 : :
420 : : ImplIMEInfos* mpIMEInfos;
421 : :
422 : : std::vector<EENotify> aNotifyCache;
423 : :
424 : : XubString aWordDelimiters;
425 : : XubString aGroupChars;
426 : :
427 : : EditSelFunctionSet aSelFuncSet;
428 : : EditSelectionEngine aSelEngine;
429 : :
430 : : Color maBackgroundColor;
431 : :
432 : : sal_uInt32 nBlockNotifications;
433 : : sal_uInt16 nStretchX;
434 : : sal_uInt16 nStretchY;
435 : :
436 : : sal_uInt16 nAsianCompressionMode;
437 : :
438 : : EEHorizontalTextDirection eDefaultHorizontalTextDirection;
439 : :
440 : : sal_uInt16 nBigTextObjectStart;
441 : : ::com::sun::star::uno::Reference<
442 : : ::com::sun::star::linguistic2::XSpellChecker1 > xSpeller;
443 : : ::com::sun::star::uno::Reference<
444 : : ::com::sun::star::linguistic2::XHyphenator > xHyphenator;
445 : : SpellInfo* pSpellInfo;
446 : : mutable ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > xBI;
447 : : mutable ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > xISC;
448 : :
449 : : ConvInfo * pConvInfo;
450 : :
451 : : XubString aAutoCompleteText;
452 : :
453 : : InternalEditStatus aStatus;
454 : :
455 : : LanguageType eDefLanguage;
456 : :
457 : : OnDemandLocaleDataWrapper xLocaleDataWrapper;
458 : : OnDemandTransliterationWrapper xTransliterationWrapper;
459 : :
460 : : // For Formatting / Update ....
461 : : boost::ptr_vector<DeletedNodeInfo> aDeletedNodes;
462 : : Rectangle aInvalidRec;
463 : : sal_uInt32 nCurTextHeight;
464 : : sal_uInt32 nCurTextHeightNTP; // without trailing empty paragraphs
465 : : sal_uInt16 nOnePixelInRef;
466 : :
467 : : IdleFormattter aIdleFormatter;
468 : :
469 : : Timer aOnlineSpellTimer;
470 : :
471 : : // If it is detected at one point that the StatusHdl has to be called, but
472 : : // this should not happen immediately (critical section):
473 : : Timer aStatusTimer;
474 : : Link aStatusHdlLink;
475 : : Link aNotifyHdl;
476 : : Link aImportHdl;
477 : : Link aBeginMovingParagraphsHdl;
478 : : Link aEndMovingParagraphsHdl;
479 : : Link aBeginPasteOrDropHdl;
480 : : Link aEndPasteOrDropHdl;
481 : : Link aModifyHdl;
482 : : Link maBeginDropHdl;
483 : : Link maEndDropHdl;
484 : :
485 : : rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharsTable;
486 : :
487 : : bool bKernAsianPunctuation:1;
488 : : bool bAddExtLeading:1;
489 : : bool bIsFormatting:1;
490 : : bool bFormatted:1;
491 : : bool bInSelection:1;
492 : : bool bIsInUndo:1;
493 : : bool bUpdate:1;
494 : : bool bUndoEnabled:1;
495 : : bool bOwnerOfRefDev:1;
496 : : bool bDowning:1;
497 : : bool bUseAutoColor:1;
498 : : bool bForceAutoColor:1;
499 : : bool bCallParaInsertedOrDeleted:1;
500 : : bool bImpConvertFirstCall:1; // specifies if ImpConvert is called the very first time after Convert was called
501 : : bool bFirstWordCapitalization:1; // specifies if auto-correction should capitalize the first word or not
502 : : bool mbLastTryMerge:1;
503 : :
504 : : // ================================================================
505 : : // Methods...
506 : : // ================================================================
507 : :
508 : : void CursorMoved( ContentNode* pPrevNode );
509 : : void ParaAttribsChanged( ContentNode* pNode );
510 : : void TextModified();
511 : : void CalcHeight( ParaPortion* pPortion );
512 : :
513 : : void InsertUndo( EditUndo* pUndo, bool bTryMerge = false );
514 : : void ResetUndoManager();
515 [ + + ]: 717576 : sal_Bool HasUndoManager() const { return pUndoManager ? sal_True : sal_False; }
516 : :
517 : : EditUndoSetAttribs* CreateAttribUndo( EditSelection aSel, const SfxItemSet& rSet );
518 : :
519 : : EditPaM GetPaM( Point aDocPos, sal_Bool bSmart = sal_True );
520 : : EditPaM GetPaM( ParaPortion* pPortion, Point aPos, sal_Bool bSmart = sal_True );
521 : : long GetXPos(const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const;
522 : : long GetPortionXOffset(const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nTextPortion) const;
523 : : sal_uInt16 GetChar(const ParaPortion* pParaPortion, const EditLine* pLine, long nX, bool bSmart = true);
524 : : Range GetInvalidYOffsets( ParaPortion* pPortion );
525 : : Range GetLineXPosStartEnd( const ParaPortion* pParaPortion, const EditLine* pLine ) const;
526 : :
527 : : void SetParaAttrib( sal_uInt8 nFunc, EditSelection aSel, sal_uInt16 nValue );
528 : : sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel );
529 : : void SetCharAttrib( EditSelection aSel, const SfxPoolItem& rItem );
530 : : void ParaAttribsToCharAttribs( ContentNode* pNode );
531 : : void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
532 : :
533 : : EditTextObject* CreateBinTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 );
534 : : EditSelection InsertBinTextObject( BinTextObject&, EditPaM aPaM );
535 : : EditSelection InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxDataObj, const String& rBaseURL, const EditPaM& rPaM, sal_Bool bUseSpecial );
536 : :
537 : : EditPaM Clear();
538 : : EditPaM RemoveText();
539 : : EditPaM RemoveText( EditSelection aEditSelection );
540 : : sal_Bool CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY );
541 : : void CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uInt32 nStartPosY );
542 : : sal_Bool FinishCreateLines( ParaPortion* pParaPortion );
543 : : void CalcCharPositions( ParaPortion* pParaPortion );
544 : : void CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& rStartPos /*, sal_Bool bCreateBlockPortions */ );
545 : : void RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nStartPos, short nNewChars );
546 : : sal_uInt16 SplitTextPortion( ParaPortion* pParaPortion, sal_uInt16 nPos, EditLine* pCurLine = 0 );
547 : : void SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0 );
548 : : void RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics, SvxFont& rFont );
549 : : void CheckAutoPageSize();
550 : :
551 : : void ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, TextPortion* pPortion, sal_uInt16 nPortionStart, long nRemainingWidth, sal_Bool bCanHyphenate );
552 : : void ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, long nRemainingSpace );
553 : : EditPaM ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pRight, sal_Bool bBackward = sal_False );
554 : : EditPaM ImpDeleteSelection(const EditSelection& rCurSel);
555 : : EditPaM ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttribs = true );
556 : : EditPaM ImpInsertParaBreak( const EditSelection& rEditSelection, bool bKeepEndingAttribs = true );
557 : : EditPaM ImpInsertText(const EditSelection& aCurEditSelection, const String& rStr);
558 : : EditPaM ImpInsertFeature(const EditSelection& rCurSel, const SfxPoolItem& rItem);
559 : : void ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, EditUndoRemoveChars* pCurUndo = 0 );
560 : : void ImpRemoveParagraph( sal_uInt16 nPara );
561 : : EditSelection ImpMoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos );
562 : :
563 : : EditPaM ImpFastInsertText( EditPaM aPaM, const String& rStr );
564 : : EditPaM ImpFastInsertParagraph( sal_uInt16 nPara );
565 : :
566 : : sal_Bool ImpCheckRefMapMode();
567 : :
568 : : sal_Bool ImplHasText() const;
569 : :
570 : : void ImpFindKashidas( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, std::vector<sal_uInt16>& rArray );
571 : :
572 : : void InsertContent( ContentNode* pNode, sal_uInt16 nPos );
573 : : EditPaM SplitContent( sal_uInt16 nNode, sal_uInt16 nSepPos );
574 : : EditPaM ConnectContents( sal_uInt16 nLeftNode, sal_Bool bBackward );
575 : :
576 : : void ShowParagraph( sal_uInt16 nParagraph, bool bShow );
577 : :
578 : : EditPaM PageUp( const EditPaM& rPaM, EditView* pView);
579 : : EditPaM PageDown( const EditPaM& rPaM, EditView* pView);
580 : : EditPaM CursorUp( const EditPaM& rPaM, EditView* pEditView );
581 : : EditPaM CursorDown( const EditPaM& rPaM, EditView* pEditView );
582 : : EditPaM CursorLeft( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL );
583 : : EditPaM CursorRight( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL );
584 : : EditPaM CursorStartOfLine( const EditPaM& rPaM );
585 : : EditPaM CursorEndOfLine( const EditPaM& rPaM );
586 : : EditPaM CursorStartOfParagraph( const EditPaM& rPaM );
587 : : EditPaM CursorEndOfParagraph( const EditPaM& rPaM );
588 : : EditPaM CursorStartOfDoc();
589 : : EditPaM CursorEndOfDoc();
590 : : EditPaM WordLeft( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
591 : : EditPaM WordRight( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
592 : : EditPaM StartOfWord( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
593 : : EditPaM EndOfWord( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
594 : : EditSelection SelectWord( const EditSelection& rCurSelection, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_Bool bAcceptStartOfWord = sal_True );
595 : : EditSelection SelectSentence( const EditSelection& rCurSel ) const;
596 : : EditPaM CursorVisualLeftRight( EditView* pEditView, const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode, sal_Bool bToLeft );
597 : : EditPaM CursorVisualStartEnd( EditView* pEditView, const EditPaM& rPaM, sal_Bool bStart );
598 : :
599 : :
600 : : void InitScriptTypes( sal_uInt16 nPara );
601 : : sal_uInt16 GetScriptType( const EditPaM& rPaM, sal_uInt16* pEndPos = NULL ) const;
602 : : sal_uInt16 GetScriptType( const EditSelection& rSel ) const;
603 : : sal_Bool IsScriptChange( const EditPaM& rPaM ) const;
604 : : sal_Bool HasScriptType( sal_uInt16 nPara, sal_uInt16 nType ) const;
605 : :
606 : : sal_Bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_uInt16 nStartPos, sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, sal_Bool bManipulateDXArray );
607 : : void ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pParaPortion, long nRemainingWidth );
608 : :
609 : : void ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara, sal_uInt16 nIndex );
610 : : void ImplInitDigitMode( OutputDevice* pOutDev, String* pString, xub_StrLen nStt, xub_StrLen nLen, LanguageType eLang );
611 : :
612 : : EditPaM ReadText( SvStream& rInput, EditSelection aSel );
613 : : EditPaM ReadRTF( SvStream& rInput, EditSelection aSel );
614 : : EditPaM ReadXML( SvStream& rInput, EditSelection aSel );
615 : : EditPaM ReadHTML( SvStream& rInput, const String& rBaseURL, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs );
616 : : EditPaM ReadBin( SvStream& rInput, EditSelection aSel );
617 : : sal_uInt32 WriteText( SvStream& rOutput, EditSelection aSel );
618 : : sal_uInt32 WriteRTF( SvStream& rOutput, EditSelection aSel );
619 : : sal_uInt32 WriteXML( SvStream& rOutput, EditSelection aSel );
620 : : sal_uInt32 WriteHTML( SvStream& rOutput, EditSelection aSel );
621 : : sal_uInt32 WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicode = sal_False );
622 : :
623 : : void WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos,
624 : : std::vector<SvxFontItem*>& rFontTable, SvxColorList& rColorList );
625 : : sal_Bool WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos,
626 : : std::vector<SvxFontItem*>& rFontTable, SvxColorList& rColorList );
627 : : sal_Int32 LogicToTwips( sal_Int32 n );
628 : :
629 : : inline short GetXValue( short nXValue ) const;
630 : : inline sal_uInt16 GetXValue( sal_uInt16 nXValue ) const;
631 : : inline long GetXValue( long nXValue ) const;
632 : :
633 : : inline short GetYValue( short nYValue ) const;
634 : : inline sal_uInt16 GetYValue( sal_uInt16 nYValue ) const;
635 : :
636 : : ContentNode* GetPrevVisNode( ContentNode* pCurNode );
637 : : ContentNode* GetNextVisNode( ContentNode* pCurNode );
638 : :
639 : : const ParaPortion* GetPrevVisPortion( const ParaPortion* pCurPortion ) const;
640 : : const ParaPortion* GetNextVisPortion( const ParaPortion* pCurPortion ) const;
641 : :
642 : 51428 : void SetBackgroundColor( const Color& rColor ) { maBackgroundColor = rColor; }
643 : 183526 : Color GetBackgroundColor() const { return maBackgroundColor; }
644 : :
645 : : long CalcVertLineSpacing(Point& rStartPos) const;
646 : :
647 : : Color GetAutoColor() const;
648 : 3467 : void EnableAutoColor( bool b ) { bUseAutoColor = b; }
649 : 14482 : bool IsAutoColorEnabled() const { return bUseAutoColor; }
650 : 0 : void ForceAutoColor( bool b ) { bForceAutoColor = b; }
651 : 69106 : bool IsForceAutoColor() const { return bForceAutoColor; }
652 : :
653 : : inline VirtualDevice* GetVirtualDevice( const MapMode& rMapMode, sal_uLong nDrawMode );
654 : : inline void EraseVirtualDevice();
655 : :
656 : : DECL_LINK(StatusTimerHdl, void *);
657 : : DECL_LINK(IdleFormatHdl, void *);
658 : : DECL_LINK(OnlineSpellHdl, void *);
659 : : DECL_LINK( DocModified, void* );
660 : :
661 : : void CheckIdleFormatter();
662 : :
663 : : inline const ParaPortion* FindParaPortion( const ContentNode* pNode ) const;
664 : : inline ParaPortion* FindParaPortion( ContentNode* pNode );
665 : :
666 : : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferable( const EditSelection& rSelection );
667 : :
668 : : void SetValidPaperSize( const Size& rSz );
669 : :
670 : : ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const;
671 : : ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker() const;
672 : :
673 : : SpellInfo * CreateSpellInfo( bool bMultipleDocs );
674 : :
675 : : ImpEditEngine(); // disabled
676 : : ImpEditEngine(EditEngine* pEditEngine, SfxItemPool* pPool);
677 : : void InitDoc(bool bKeepParaAttribs);
678 : 848293 : EditDoc& GetEditDoc() { return aEditDoc; }
679 : 5692272 : const EditDoc& GetEditDoc() const { return aEditDoc; }
680 : :
681 : 1095972 : const ParaPortionList& GetParaPortions() const { return aParaPortionList; }
682 : 6823459 : ParaPortionList& GetParaPortions() { return aParaPortionList; }
683 : :
684 : : protected:
685 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
686 : :
687 : : public:
688 : : ~ImpEditEngine();
689 : :
690 : : inline EditUndoManager& GetUndoManager();
691 : :
692 : : void SetUpdateMode( bool bUp, EditView* pCurView = 0, sal_Bool bForceUpdate = sal_False );
693 : 5685717 : bool GetUpdateMode() const { return bUpdate; }
694 : :
695 : 2807 : ViewsType& GetEditViews() { return aEditViews; }
696 : : const ViewsType& GetEditViews() const { return aEditViews; }
697 : :
698 : 1051448 : const Size& GetPaperSize() const { return aPaperSize; }
699 : 0 : void SetPaperSize( const Size& rSz ) { aPaperSize = rSz; }
700 : :
701 : : void SetVertical( sal_Bool bVertical );
702 : 3481238 : sal_Bool IsVertical() const { return GetEditDoc().IsVertical(); }
703 : :
704 : : void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
705 : 935194 : sal_Bool IsFixedCellHeight() const { return GetEditDoc().IsFixedCellHeight(); }
706 : :
707 : 52692 : void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ) { eDefaultHorizontalTextDirection = eHTextDir; }
708 : 1488307 : EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const { return eDefaultHorizontalTextDirection; }
709 : :
710 : :
711 : : void InitWritingDirections( sal_uInt16 nPara );
712 : : sal_Bool IsRightToLeft( sal_uInt16 nPara ) const;
713 : : sal_uInt8 GetRightToLeft( sal_uInt16 nPara, sal_uInt16 nChar, sal_uInt16* pStart = NULL, sal_uInt16* pEnd = NULL );
714 : : sal_Bool HasDifferentRTLLevels( const ContentNode* pNode );
715 : :
716 : : void SetTextRanger( TextRanger* pRanger );
717 : 1289395 : TextRanger* GetTextRanger() const { return pTextRanger; }
718 : :
719 : 0 : const Size& GetMinAutoPaperSize() const { return aMinAutoPaperSize; }
720 : 369487 : void SetMinAutoPaperSize( const Size& rSz ) { aMinAutoPaperSize = rSz; }
721 : :
722 : 0 : const Size& GetMaxAutoPaperSize() const { return aMaxAutoPaperSize; }
723 : 380894 : void SetMaxAutoPaperSize( const Size& rSz ) { aMaxAutoPaperSize = rSz; }
724 : :
725 : : void FormatDoc();
726 : : void FormatFullDoc();
727 : : void UpdateViews( EditView* pCurView = 0 );
728 : : void Paint( ImpEditView* pView, const Rectangle& rRect, sal_Bool bUseVirtDev = sal_False );
729 : : void Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aStartPos, sal_Bool bStripOnly = sal_False, short nOrientation = 0 );
730 : :
731 : : sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent, EditView* pView );
732 : : sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent, EditView* pView );
733 : : sal_Bool MouseMove( const MouseEvent& rMouseEvent, EditView* pView );
734 : : void Command( const CommandEvent& rCEvt, EditView* pView );
735 : :
736 : 89 : EditSelectionEngine& GetSelEngine() { return aSelEngine; }
737 : : XubString GetSelected( const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF ) const;
738 : :
739 : : const SfxItemSet& GetEmptyItemSet();
740 : :
741 : : void UpdateSelections();
742 : :
743 : : void EnableUndo( bool bEnable );
744 : 3961198 : bool IsUndoEnabled() { return bUndoEnabled; }
745 : 0 : void SetUndoMode( bool b ) { bIsInUndo = b; }
746 : 5159415 : bool IsInUndo() { return bIsInUndo; }
747 : :
748 : 0 : void SetCallParaInsertedOrDeleted( bool b ) { bCallParaInsertedOrDeleted = b; }
749 : 571705 : bool IsCallParaInsertedOrDeleted() const { return bCallParaInsertedOrDeleted; }
750 : :
751 : 706543 : bool IsFormatted() const { return bFormatted; }
752 : 694357 : bool IsFormatting() const { return bIsFormatting; }
753 : :
754 : : void SetText( const String& rText );
755 : : EditPaM DeleteSelected( EditSelection aEditSelection);
756 : : EditPaM InsertText( const EditSelection& rCurEditSelection, sal_Unicode c, sal_Bool bOverwrite, sal_Bool bIsUserInput = sal_False );
757 : : EditPaM InsertText(const EditSelection& aCurEditSelection, const String& rStr);
758 : : EditPaM AutoCorrect( const EditSelection& rCurEditSelection, sal_Unicode c, sal_Bool bOverwrite, Window* pFrameWin = NULL );
759 : : EditPaM DeleteLeftOrRight( const EditSelection& rEditSelection, sal_uInt8 nMode, sal_uInt8 nDelMode = DELMODE_SIMPLE );
760 : : EditPaM InsertParaBreak( EditSelection aEditSelection );
761 : : EditPaM InsertLineBreak(const EditSelection& aEditSelection);
762 : : EditPaM InsertTab( EditSelection aEditSelection );
763 : : EditPaM InsertField(const EditSelection& rCurSel, const SvxFieldItem& rFld);
764 : : sal_Bool UpdateFields();
765 : :
766 : : EditPaM Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
767 : : void Write( SvStream& rOutput, EETextFormat eFormat, EditSelection aSel );
768 : :
769 : : EditTextObject* CreateTextObject();
770 : : EditTextObject* CreateTextObject( EditSelection aSel );
771 : : void SetText( const EditTextObject& rTextObject );
772 : : EditSelection InsertText( const EditTextObject& rTextObject, EditSelection aSel );
773 : :
774 : : EditSelection MoveCursor( const KeyEvent& rKeyEvent, EditView* pEditView );
775 : :
776 : : EditSelection MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos, EditView* pCurView );
777 : :
778 : : sal_uInt32 CalcTextHeight( sal_uInt32* pHeightNTP );
779 : : sal_uInt32 GetTextHeight() const;
780 : : sal_uInt32 GetTextHeightNTP() const;
781 : : sal_uInt32 CalcTextWidth( sal_Bool bIgnoreExtraSpace );
782 : : sal_uInt32 CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, sal_Bool bIgnoreExtraSpace );
783 : : sal_uInt16 GetLineCount( sal_uInt16 nParagraph ) const;
784 : : sal_uInt16 GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
785 : : void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
786 : : sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
787 : : sal_uInt16 GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine );
788 : : sal_uInt32 GetParaHeight( sal_uInt16 nParagraph );
789 : :
790 : : SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const;
791 : : SfxItemSet GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttrib = sal_False );
792 : : void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0 );
793 : : void RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich = 0 );
794 : : void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0, sal_Bool bRemoveFeatures = sal_False );
795 : : void SetFlatMode( sal_Bool bFlat );
796 : :
797 : : void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
798 : : const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const;
799 : :
800 : : bool HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
801 : : const SfxPoolItem& GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
802 : :
803 : : Rectangle PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags = 0 );
804 : : Rectangle GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex, sal_uInt16 nFlags = 0 );
805 : :
806 : 10 : sal_Bool IsModified() const { return aEditDoc.IsModified(); }
807 : 74 : void SetModifyFlag( sal_Bool b ) { aEditDoc.SetModified( b ); }
808 : 740 : void SetModifyHdl( const Link& rLink ) { aModifyHdl = rLink; }
809 : 18 : Link GetModifyHdl() const { return aModifyHdl; }
810 : :
811 : :
812 : 0 : bool IsInSelectionMode() { return bInSelection; }
813 : :
814 : : void IndentBlock( EditView* pView, sal_Bool bRight );
815 : :
816 : : // For Undo/Redo
817 : : sal_Bool Undo( EditView* pView );
818 : : sal_Bool Redo( EditView* pView );
819 : :
820 : : // OV-Special
821 : : void InvalidateFromParagraph( sal_uInt16 nFirstInvPara );
822 : : EditPaM InsertParagraph( sal_uInt16 nPara );
823 : : EditSelection* SelectParagraph( sal_uInt16 nPara );
824 : :
825 : 2638 : void SetStatusEventHdl( const Link& rLink ) { aStatusHdlLink = rLink; }
826 : 209 : Link GetStatusEventHdl() const { return aStatusHdlLink; }
827 : :
828 : 7988 : void SetNotifyHdl( const Link& rLink ) { aNotifyHdl = rLink; }
829 : 1956229 : Link GetNotifyHdl() const { return aNotifyHdl; }
830 : :
831 : : void FormatAndUpdate( EditView* pCurView = 0 );
832 : : inline void IdleFormatAndUpdate( EditView* pCurView = 0 );
833 : :
834 : : svtools::ColorConfig& GetColorConfig();
835 : : sal_Bool IsVisualCursorTravelingEnabled();
836 : : sal_Bool DoVisualCursorTraveling( const ContentNode* pNode );
837 : :
838 : : EditSelection ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos, sal_uInt16 nEndPara, sal_uInt16 nEndPos );
839 : : inline EPaM CreateEPaM( const EditPaM& rPaM );
840 : : inline EditPaM CreateEditPaM( const EPaM& rEPaM );
841 : : inline ESelection CreateESel( const EditSelection& rSel );
842 : : inline EditSelection CreateSel( const ESelection& rSel );
843 : :
844 : :
845 : : void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
846 : 159112 : SfxStyleSheetPool* GetStyleSheetPool() const { return pStylePool; }
847 : :
848 : : void SetStyleSheet( EditSelection aSel, SfxStyleSheet* pStyle );
849 : : void SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle );
850 : : const SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const;
851 : : SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara );
852 : :
853 : : void UpdateParagraphsWithStyleSheet( SfxStyleSheet* pStyle );
854 : : void RemoveStyleFromParagraphs( SfxStyleSheet* pStyle );
855 : :
856 : 2487002 : OutputDevice* GetRefDevice() const { return pRefDev; }
857 : : void SetRefDevice( OutputDevice* pRefDef );
858 : :
859 : 343 : const MapMode& GetRefMapMode() { return pRefDev->GetMapMode(); }
860 : : void SetRefMapMode( const MapMode& rMapMode );
861 : :
862 : 1467009 : InternalEditStatus& GetStatus() { return aStatus; }
863 : : void CallStatusHdl();
864 : 6 : void DelayedCallStatusHdl() { aStatusTimer.Start(); }
865 : :
866 : : void CallNotify( EENotify& rNotify );
867 : : void EnterBlockNotifications();
868 : : void LeaveBlockNotifications();
869 : :
870 : : void UndoActionStart( sal_uInt16 nId );
871 : : void UndoActionStart( sal_uInt16 nId, const ESelection& rSel );
872 : : void UndoActionEnd( sal_uInt16 nId );
873 : :
874 : 110555 : EditView* GetActiveView() const { return pActiveView; }
875 : : void SetActiveView( EditView* pView );
876 : :
877 : : ::com::sun::star::uno::Reference<
878 : : ::com::sun::star::linguistic2::XSpellChecker1 >
879 : : GetSpeller();
880 : 4281 : void SetSpeller( ::com::sun::star::uno::Reference<
881 : : ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl )
882 : 4281 : { xSpeller = xSpl; }
883 : : ::com::sun::star::uno::Reference<
884 : : ::com::sun::star::linguistic2::XHyphenator >
885 : 196160 : GetHyphenator() const { return xHyphenator; }
886 : 25886 : void SetHyphenator( ::com::sun::star::uno::Reference<
887 : : ::com::sun::star::linguistic2::XHyphenator > &xHyph )
888 : 25886 : { xHyphenator = xHyph; }
889 : 36 : SpellInfo* GetSpellInfo() const { return pSpellInfo; }
890 : :
891 : 14121 : void SetDefaultLanguage( LanguageType eLang ) { eDefLanguage = eLang; }
892 : 227187 : LanguageType GetDefaultLanguage() const { return eDefLanguage; }
893 : :
894 : :
895 : : LanguageType GetLanguage( const EditSelection &rSelection ) const;
896 : : LanguageType GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPos = NULL ) const;
897 : : ::com::sun::star::lang::Locale GetLocale( const EditPaM& rPaM ) const;
898 : :
899 : : void DoOnlineSpelling( ContentNode* pThisNodeOnly = 0, sal_Bool bSpellAtCursorPos = sal_False, sal_Bool bInteruptable = sal_True );
900 : : EESpellState Spell( EditView* pEditView, sal_Bool bMultipleDoc );
901 : : EESpellState HasSpellErrors();
902 : : EESpellState StartThesaurus( EditView* pEditView );
903 : : ::com::sun::star::uno::Reference<
904 : : ::com::sun::star::linguistic2::XSpellAlternatives >
905 : : ImpSpell( EditView* pEditView );
906 : :
907 : : // text conversion functions
908 : : void Convert( EditView* pEditView, LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
909 : : void ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtLang, EditView* pEditView, LanguageType nSrcLang, const ESelection &rConvRange,
910 : : sal_Bool bAllowImplicitChangesForNotConvertibleText, LanguageType nTargetLang, const Font *pTargetFont );
911 : 0 : ConvInfo * GetConvInfo() const { return pConvInfo; }
912 : : sal_Bool HasConvertibleTextPortion( LanguageType nLang );
913 : : void SetLanguageAndFont( const ESelection &rESel,
914 : : LanguageType nLang, sal_uInt16 nLangWhichId,
915 : : const Font *pFont, sal_uInt16 nFontWhichId );
916 : :
917 : : // returns true if input sequence checking should be applied
918 : : sal_Bool IsInputSequenceCheckingRequired( sal_Unicode nChar, const EditSelection& rCurSel ) const;
919 : :
920 : : //find the next error within the given selection - forward only!
921 : : ::com::sun::star::uno::Reference<
922 : : ::com::sun::star::linguistic2::XSpellAlternatives >
923 : : ImpFindNextError(EditSelection& rSelection);
924 : : //initialize sentence spelling
925 : : void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
926 : : //spell and return a sentence
927 : : bool SpellSentence(EditView& rView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
928 : : //put spelling back to start of current sentence - needed after switch of grammar support
929 : : void PutSpellingToSentenceStart( EditView& rEditView );
930 : : //applies a changed sentence
931 : : void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
932 : : //adds one or more portions of text to the SpellPortions depending on language changes
933 : : void AddPortionIterated(
934 : : EditView& rEditView,
935 : : const EditSelection &rSel,
936 : : ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > xAlt,
937 : : ::svx::SpellPortions& rToFill);
938 : : //adds one portion to the SpellPortions
939 : : void AddPortion(
940 : : const EditSelection &rSel,
941 : : ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > xAlt,
942 : : ::svx::SpellPortions& rToFill,
943 : : bool bIsField );
944 : :
945 : : sal_Bool Search( const SvxSearchItem& rSearchItem, EditView* pView );
946 : : sal_Bool ImpSearch( const SvxSearchItem& rSearchItem, const EditSelection& rSearchSelection, const EditPaM& rStartPos, EditSelection& rFoundSel );
947 : : sal_uInt16 StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem );
948 : : sal_Bool HasText( const SvxSearchItem& rSearchItem );
949 : :
950 : 32379 : void SetEditTextObjectPool( SfxItemPool* pP ) { pTextObjectPool = pP; }
951 : 64398 : SfxItemPool* GetEditTextObjectPool() const { return pTextObjectPool; }
952 : :
953 : : const SvxNumberFormat * GetNumberFormat( const ContentNode* pNode ) const;
954 : : sal_Int32 GetSpaceBeforeAndMinLabelWidth( const ContentNode *pNode, sal_Int32 *pnSpaceBefore = 0, sal_Int32 *pnMinLabelWidth = 0 ) const;
955 : :
956 : : const SvxLRSpaceItem& GetLRSpaceItem( ContentNode* pNode );
957 : : SvxAdjust GetJustification( sal_uInt16 nPara ) const;
958 : : SvxCellJustifyMethod GetJustifyMethod( sal_uInt16 nPara ) const;
959 : : SvxCellVerJustify GetVerJustification( sal_uInt16 nPara ) const;
960 : :
961 : : void SetCharStretching( sal_uInt16 nX, sal_uInt16 nY );
962 : : inline void GetCharStretching( sal_uInt16& rX, sal_uInt16& rY );
963 : :
964 : : void SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount ) { nBigTextObjectStart = nStartAtPortionCount; }
965 : 0 : sal_uInt16 GetBigTextObjectStart() const { return nBigTextObjectStart; }
966 : :
967 : 2935798 : inline EditEngine* GetEditEnginePtr() const { return pEditEngine; }
968 : :
969 : 27332 : void StartOnlineSpellTimer() { aOnlineSpellTimer.Start(); }
970 : 6230 : void StopOnlineSpellTimer() { aOnlineSpellTimer.Stop(); }
971 : :
972 : 0 : const XubString& GetAutoCompleteText() const { return aAutoCompleteText; }
973 : : void SetAutoCompleteText( const String& rStr, sal_Bool bUpdateTipWindow );
974 : :
975 : : EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
976 : : short ReplaceTextOnly( ContentNode* pNode, sal_uInt16 nCurrentStart, xub_StrLen nLen, const String& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rOffsets );
977 : :
978 : :
979 : : void SetAsianCompressionMode( sal_uInt16 n );
980 : 206873 : sal_uInt16 GetAsianCompressionMode() const { return nAsianCompressionMode; }
981 : :
982 : : void SetKernAsianPunctuation( bool b );
983 : 39018 : bool IsKernAsianPunctuation() const { return bKernAsianPunctuation; }
984 : :
985 : : void SetAddExtLeading( bool b );
986 : 463727 : bool IsAddExtLeading() const { return bAddExtLeading; }
987 : :
988 : : rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable( sal_Bool bGetInternal = sal_True ) const;
989 : : void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
990 : :
991 : : /** sets a link that is called at the beginning of a drag operation at an edit view */
992 : 0 : void SetBeginDropHdl( const Link& rLink ) { maBeginDropHdl = rLink; }
993 : 0 : Link GetBeginDropHdl() const { return maBeginDropHdl; }
994 : :
995 : : /** sets a link that is called at the end of a drag operation at an edit view */
996 : 0 : void SetEndDropHdl( const Link& rLink ) { maEndDropHdl = rLink; }
997 : 0 : Link GetEndDropHdl() const { return maEndDropHdl; }
998 : :
999 : : /// specifies if auto-correction should capitalize the first word or not (default is on)
1000 : 0 : void SetFirstWordCapitalization( bool bCapitalize ) { bFirstWordCapitalization = bCapitalize; }
1001 : 0 : bool IsFirstWordCapitalization() const { return bFirstWordCapitalization; }
1002 : : };
1003 : :
1004 : 26636 : inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )
1005 : : {
1006 : 26636 : const ContentNode* pNode = rPaM.GetNode();
1007 : 26636 : return EPaM( aEditDoc.GetPos( pNode ), rPaM.GetIndex() );
1008 : : }
1009 : :
1010 : 0 : inline EditPaM ImpEditEngine::CreateEditPaM( const EPaM& rEPaM )
1011 : : {
1012 : : DBG_ASSERT( rEPaM.nPara < aEditDoc.Count(), "CreateEditPaM: invalid paragraph" );
1013 : : DBG_ASSERT( aEditDoc[ rEPaM.nPara ]->Len() >= rEPaM.nIndex, "CreateEditPaM: invalid Index" );
1014 : 0 : return EditPaM( aEditDoc[ rEPaM.nPara], rEPaM.nIndex );
1015 : : }
1016 : :
1017 : 1865 : inline ESelection ImpEditEngine::CreateESel( const EditSelection& rSel )
1018 : : {
1019 : 1865 : const ContentNode* pStartNode = rSel.Min().GetNode();
1020 : 1865 : const ContentNode* pEndNode = rSel.Max().GetNode();
1021 : 1865 : ESelection aESel;
1022 : 1865 : aESel.nStartPara = aEditDoc.GetPos( pStartNode );
1023 : 1865 : aESel.nStartPos = rSel.Min().GetIndex();
1024 : 1865 : aESel.nEndPara = aEditDoc.GetPos( pEndNode );
1025 : 1865 : aESel.nEndPos = rSel.Max().GetIndex();
1026 : 1865 : return aESel;
1027 : : }
1028 : :
1029 : 3245 : inline EditSelection ImpEditEngine::CreateSel( const ESelection& rSel )
1030 : : {
1031 : : DBG_ASSERT( rSel.nStartPara < aEditDoc.Count(), "CreateSel: invalid start paragraph" );
1032 : : DBG_ASSERT( rSel.nEndPara < aEditDoc.Count(), "CreateSel: invalid end paragraph" );
1033 : 3245 : EditSelection aSel;
1034 : 3245 : aSel.Min().SetNode( aEditDoc[ rSel.nStartPara ] );
1035 : 3245 : aSel.Min().SetIndex( rSel.nStartPos );
1036 : 3245 : aSel.Max().SetNode( aEditDoc[ rSel.nEndPara ] );
1037 : 3245 : aSel.Max().SetIndex( rSel.nEndPos );
1038 : : DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "CreateSel: incorrect selection!" );
1039 : 3245 : return aSel;
1040 : : }
1041 : :
1042 : 271 : inline VirtualDevice* ImpEditEngine::GetVirtualDevice( const MapMode& rMapMode, sal_uLong nDrawMode )
1043 : : {
1044 [ + + ]: 271 : if ( !pVirtDev )
1045 [ + - ]: 223 : pVirtDev = new VirtualDevice;
1046 : :
1047 [ + + + - : 367 : if ( ( pVirtDev->GetMapMode().GetMapUnit() != rMapMode.GetMapUnit() ) ||
- + ][ + + ]
1048 : 48 : ( pVirtDev->GetMapMode().GetScaleX() != rMapMode.GetScaleX() ) ||
1049 : 48 : ( pVirtDev->GetMapMode().GetScaleY() != rMapMode.GetScaleY() ) )
1050 : : {
1051 [ + - ]: 223 : MapMode aMapMode( rMapMode );
1052 [ + - ]: 223 : aMapMode.SetOrigin( Point( 0, 0 ) );
1053 [ + - ][ + - ]: 223 : pVirtDev->SetMapMode( aMapMode );
1054 : : }
1055 : :
1056 : 271 : pVirtDev->SetDrawMode( nDrawMode );
1057 : :
1058 : 271 : return pVirtDev;
1059 : : }
1060 : :
1061 : 6690 : inline void ImpEditEngine::EraseVirtualDevice()
1062 : : {
1063 [ - + ]: 6690 : delete pVirtDev;
1064 : 6690 : pVirtDev = 0;
1065 : 6690 : }
1066 : :
1067 : 0 : inline void ImpEditEngine::IdleFormatAndUpdate( EditView* pCurView )
1068 : : {
1069 : 0 : aIdleFormatter.DoIdleFormat( pCurView );
1070 : 0 : }
1071 : :
1072 : 2374205 : inline EditUndoManager& ImpEditEngine::GetUndoManager()
1073 : : {
1074 [ + + ]: 2374205 : if ( !pUndoManager )
1075 [ + - ]: 23856 : pUndoManager = new EditUndoManager(pEditEngine);
1076 : 2374205 : return *pUndoManager;
1077 : : }
1078 : :
1079 : 0 : inline const ParaPortion* ImpEditEngine::FindParaPortion( const ContentNode* pNode ) const
1080 : : {
1081 : 0 : sal_uInt16 nPos = aEditDoc.GetPos( pNode );
1082 : : DBG_ASSERT( nPos < GetParaPortions().Count(), "Portionloser Node?" );
1083 : 0 : return GetParaPortions()[ nPos ];
1084 : : }
1085 : :
1086 : 552475 : inline ParaPortion* ImpEditEngine::FindParaPortion( ContentNode* pNode )
1087 : : {
1088 : 552475 : sal_uInt16 nPos = aEditDoc.GetPos( pNode );
1089 : : DBG_ASSERT( nPos < GetParaPortions().Count(), "Portionloser Node?" );
1090 : 552475 : return GetParaPortions()[ nPos ];
1091 : : }
1092 : :
1093 : 3127 : inline void ImpEditEngine::GetCharStretching( sal_uInt16& rX, sal_uInt16& rY )
1094 : : {
1095 : 3127 : rX = nStretchX;
1096 : 3127 : rY = nStretchY;
1097 : 3127 : }
1098 : :
1099 : 415076 : inline short ImpEditEngine::GetXValue( short nXValue ) const
1100 : : {
1101 [ + + ][ + - ]: 415076 : if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
[ + - ]
1102 : 415076 : return nXValue;
1103 : :
1104 : 415076 : return (short) ((long)nXValue*nStretchX/100);
1105 : : }
1106 : :
1107 : : inline sal_uInt16 ImpEditEngine::GetXValue( sal_uInt16 nXValue ) const
1108 : : {
1109 : : if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
1110 : : return nXValue;
1111 : :
1112 : : return (sal_uInt16) ((long)nXValue*nStretchX/100);
1113 : : }
1114 : :
1115 : 835681 : inline long ImpEditEngine::GetXValue( long nXValue ) const
1116 : : {
1117 [ + + ][ + - ]: 835681 : if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
[ + - ]
1118 : 835681 : return nXValue;
1119 : :
1120 : 835681 : return nXValue*nStretchX/100;
1121 : : }
1122 : :
1123 : 330 : inline short ImpEditEngine::GetYValue( short nYValue ) const
1124 : : {
1125 [ - + ][ # # ]: 330 : if ( !aStatus.DoStretch() || ( nStretchY == 100 ) )
[ + - ]
1126 : 330 : return nYValue;
1127 : :
1128 : 330 : return (short) ((long)nYValue*nStretchY/100);
1129 : : }
1130 : :
1131 : 383048 : inline sal_uInt16 ImpEditEngine::GetYValue( sal_uInt16 nYValue ) const
1132 : : {
1133 [ + + ][ + - ]: 383048 : if ( !aStatus.DoStretch() || ( nStretchY == 100 ) )
[ + - ]
1134 : 383048 : return nYValue;
1135 : :
1136 : 383048 : return (sal_uInt16) ((long)nYValue*nStretchY/100);
1137 : : }
1138 : :
1139 : : inline void ImpEditView::SetPointer( const Pointer& rPointer )
1140 : : {
1141 : : delete pPointer;
1142 : : pPointer = new Pointer( rPointer );
1143 : : }
1144 : :
1145 : 74 : inline const Pointer& ImpEditView::GetPointer()
1146 : : {
1147 [ + - ]: 74 : if ( !pPointer )
1148 : : {
1149 [ - + ]: 74 : pPointer = new Pointer( IsVertical() ? POINTER_TEXT_VERTICAL : POINTER_TEXT );
1150 : 74 : return *pPointer;
1151 : : }
1152 : :
1153 [ # # ][ # # ]: 0 : if(POINTER_TEXT == pPointer->GetStyle() && IsVertical())
[ # # ]
1154 : : {
1155 : 0 : delete pPointer;
1156 : 0 : pPointer = new Pointer(POINTER_TEXT_VERTICAL);
1157 : : }
1158 [ # # ][ # # ]: 0 : else if(POINTER_TEXT_VERTICAL == pPointer->GetStyle() && !IsVertical())
[ # # ]
1159 : : {
1160 : 0 : delete pPointer;
1161 : 0 : pPointer = new Pointer(POINTER_TEXT);
1162 : : }
1163 : :
1164 : 74 : return *pPointer;
1165 : : }
1166 : :
1167 : : inline void ImpEditView::SetCursor( const Cursor& rCursor )
1168 : : {
1169 : : delete pCursor;
1170 : : pCursor = new Cursor( rCursor );
1171 : : }
1172 : :
1173 : 6371 : inline Cursor* ImpEditView::GetCursor()
1174 : : {
1175 [ + + ]: 6371 : if ( !pCursor )
1176 [ + - ]: 297 : pCursor = new Cursor;
1177 : 6371 : return pCursor;
1178 : : }
1179 : :
1180 : : void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit );
1181 : : void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit = NULL, const MapUnit* pDestUnit = NULL );
1182 : : sal_uInt8 GetCharTypeForCompression( xub_Unicode cChar );
1183 : : Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin );
1184 : :
1185 : : #endif // _IMPEDIT_HXX
1186 : :
1187 : :
1188 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|