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 : // MyEDITENG, due to exported EditEng
20 : #ifndef INCLUDED_EDITENG_EDITENG_HXX
21 : #define INCLUDED_EDITENG_EDITENG_HXX
22 :
23 : #include <rtl/ref.hxx>
24 : #include <vector>
25 : #include <com/sun/star/uno/Reference.h>
26 : #include <com/sun/star/i18n/WordType.hpp>
27 : #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
28 :
29 : #include <rsc/rscsfx.hxx>
30 : #include <editeng/editdata.hxx>
31 : #include <editeng/editstat.hxx>
32 : #include <editeng/editengdllapi.h>
33 : #include <i18nlangtag/lang.h>
34 :
35 : #include <tools/lineend.hxx>
36 : #include <tools/link.hxx>
37 : #include <tools/rtti.hxx>
38 :
39 : #include <editeng/eedata.hxx>
40 : #include <o3tl/typed_flags_set.hxx>
41 : #include <svl/languageoptions.hxx>
42 :
43 : namespace com { namespace sun { namespace star {
44 : namespace linguistic2 {
45 : class XSpellChecker1;
46 : class XHyphenator;
47 : }
48 : namespace datatransfer {
49 : class XTransferable;
50 : }
51 : namespace lang {
52 : struct Locale;
53 : }
54 : }}}
55 :
56 : namespace svx {
57 : struct SpellPortion;
58 : typedef std::vector<SpellPortion> SpellPortions;
59 : }
60 :
61 : namespace svl { class IUndoManager; }
62 : namespace basegfx { class B2DPolyPolygon; }
63 : namespace editeng {
64 : struct MisspellRanges;
65 : }
66 :
67 : class ImpEditEngine;
68 : class EditView;
69 : class OutputDevice;
70 : class EditUndo;
71 : class SvxFont;
72 : class SfxItemPool;
73 : class SfxStyleSheet;
74 : class SfxStyleSheetPool;
75 : class SvxSearchItem;
76 : class SvxFieldItem;
77 : class SvxCharSetColorItem;
78 : class SfxUndoAction;
79 : class MapMode;
80 : class Color;
81 : namespace vcl { class Font; }
82 : class KeyEvent;
83 : namespace tools { class PolyPolygon; }
84 : class Size;
85 : class Point;
86 : class Rectangle;
87 : class SvStream;
88 : class OutputDevice;
89 : namespace vcl { class Window; }
90 : class SfxPoolItem;
91 : class SvxNumBulletItem;
92 : class SvxBulletItem;
93 : class SvxLRSpaceItem;
94 : class SvKeyValueIterator;
95 : class SvxForbiddenCharactersTable;
96 : class SvxNumberFormat;
97 : class FontList;
98 : class SvxFieldData;
99 : class ContentNode;
100 : class ParaPortion;
101 : class EditSelection;
102 : class EditPaM;
103 : class EditLine;
104 : class InternalEditStatus;
105 : class EditSelectionEngine;
106 : class EditDoc;
107 : struct PasteOrDropInfos;
108 : class Range;
109 : struct EPaM;
110 : class DeletedNodeInfo;
111 : class ParaPortionList;
112 :
113 :
114 :
115 : /** values for:
116 : SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs_All );
117 : */
118 : enum EditEngineAttribs {
119 : EditEngineAttribs_All, /// returns all attributes even when theire not set
120 : EditEngineAttribs_HardAndPara, /// returns all attributes set on paragraph and on portions
121 : EditEngineAttribs_OnlyHard /// returns only attributes hard set on portions
122 : };
123 :
124 : /** values for:
125 : SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const;
126 : */
127 : enum class GetAttribsFlags
128 : {
129 : NONE = 0x00,
130 : STYLESHEET = 0x01,
131 : PARAATTRIBS = 0x02,
132 : CHARATTRIBS = 0x04,
133 : ALL = 0x07,
134 : };
135 : namespace o3tl
136 : {
137 : template<> struct typed_flags<GetAttribsFlags> : is_typed_flags<GetAttribsFlags, 0x07> {};
138 : }
139 :
140 : class SdrObject;
141 : class EDITENG_DLLPUBLIC EditEngine
142 : {
143 : friend class EditView;
144 : friend class ImpEditView;
145 : friend class EditDbg;
146 : friend class Outliner;
147 :
148 : public:
149 : typedef std::vector<EditView*> ViewsType;
150 :
151 : private:
152 : ImpEditEngine* pImpEditEngine;
153 :
154 : EditEngine( const EditEngine& ) SAL_DELETED_FUNCTION;
155 : EditEngine& operator=( const EditEngine& ) SAL_DELETED_FUNCTION;
156 : EDITENG_DLLPRIVATE bool PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, vcl::Window* pFrameWin = NULL );
157 :
158 : EDITENG_DLLPRIVATE void CursorMoved(ContentNode* pPrevNode);
159 : EDITENG_DLLPRIVATE void CheckIdleFormatter();
160 : EDITENG_DLLPRIVATE bool IsIdleFormatterActive() const;
161 : EDITENG_DLLPRIVATE ParaPortion* FindParaPortion(ContentNode* pNode);
162 : EDITENG_DLLPRIVATE const ParaPortion* FindParaPortion(ContentNode* pNode) const;
163 : EDITENG_DLLPRIVATE const ParaPortion* GetPrevVisPortion(const ParaPortion* pCurPortion) const;
164 :
165 : EDITENG_DLLPRIVATE com::sun::star::uno::Reference<
166 : com::sun::star::datatransfer::XTransferable>
167 : CreateTransferable(const EditSelection& rSelection);
168 :
169 : EDITENG_DLLPRIVATE EditSelection InsertText(
170 : com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable >& rxDataObj,
171 : const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial);
172 :
173 : EDITENG_DLLPRIVATE EditPaM EndOfWord(
174 : const EditPaM& rPaM, sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES);
175 :
176 : EDITENG_DLLPRIVATE EditPaM GetPaM(const Point& aDocPos, bool bSmart = true);
177 :
178 : EDITENG_DLLPRIVATE EditSelection SelectWord(
179 : const EditSelection& rCurSelection,
180 : sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES,
181 : bool bAcceptStartOfWord = true);
182 :
183 : EDITENG_DLLPRIVATE long GetXPos(
184 : const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false) const;
185 :
186 : EDITENG_DLLPRIVATE Range GetLineXPosStartEnd(
187 : const ParaPortion* pParaPortion, const EditLine* pLine) const;
188 :
189 : EDITENG_DLLPRIVATE sal_uInt16 GetOnePixelInRef() const;
190 : EDITENG_DLLPRIVATE InternalEditStatus& GetInternalEditStatus();
191 :
192 : EDITENG_DLLPRIVATE void HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos);
193 : EDITENG_DLLPRIVATE void HandleEndPasteOrDrop(PasteOrDropInfos& rInfos);
194 : EDITENG_DLLPRIVATE bool HasText() const;
195 : EDITENG_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const;
196 : EDITENG_DLLPRIVATE void SetInSelectionMode(bool b);
197 :
198 : protected:
199 :
200 :
201 : public:
202 : EditEngine( SfxItemPool* pItemPool );
203 : virtual ~EditEngine();
204 :
205 : const SfxItemSet& GetEmptyItemSet();
206 :
207 : void SetDefTab( sal_uInt16 nDefTab );
208 :
209 : void SetRefDevice( OutputDevice* pRefDef );
210 : OutputDevice* GetRefDevice() const;
211 :
212 : void SetRefMapMode( const MapMode& rMapMode );
213 : MapMode GetRefMapMode();
214 :
215 : void SetUpdateMode( bool bUpdate );
216 : bool GetUpdateMode() const;
217 : void SetUpdateModeForAcc( bool bUp);
218 : bool GetUpdateModeForAcc( ) const;
219 :
220 : void SetBackgroundColor( const Color& rColor );
221 : Color GetBackgroundColor() const;
222 : Color GetAutoColor() const;
223 : void EnableAutoColor( bool b );
224 : void ForceAutoColor( bool b );
225 : bool IsForceAutoColor() const;
226 :
227 : void InsertView(EditView* pEditView, size_t nIndex = EE_APPEND);
228 : EditView* RemoveView( EditView* pEditView );
229 : EditView* RemoveView(size_t nIndex = EE_APPEND);
230 : EditView* GetView(size_t nIndex = 0) const;
231 : size_t GetViewCount() const;
232 : bool HasView( EditView* pView ) const;
233 : EditView* GetActiveView() const;
234 : void SetActiveView(EditView* pView);
235 :
236 : void SetPaperSize( const Size& rSize );
237 : const Size& GetPaperSize() const;
238 :
239 : void SetVertical( bool bVertical );
240 : bool IsVertical() const;
241 :
242 : void SetFixedCellHeight( bool bUseFixedCellHeight );
243 :
244 : void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
245 : EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
246 :
247 : SvtScriptType GetScriptType( const ESelection& rSelection ) const;
248 : LanguageType GetLanguage(const EditPaM& rPaM) const;
249 : LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const;
250 :
251 : void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode );
252 : EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
253 :
254 : void SetAsianCompressionMode( sal_uInt16 nCompression );
255 :
256 : void SetKernAsianPunctuation( bool bEnabled );
257 :
258 : void SetAddExtLeading( bool b );
259 :
260 : void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
261 : void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
262 : void ClearPolygon();
263 :
264 : const Size& GetMinAutoPaperSize() const;
265 : void SetMinAutoPaperSize( const Size& rSz );
266 :
267 : const Size& GetMaxAutoPaperSize() const;
268 : void SetMaxAutoPaperSize( const Size& rSz );
269 :
270 : OUString GetText( LineEnd eEnd = LINEEND_LF ) const;
271 : OUString GetText( const ESelection& rSelection, const LineEnd eEnd = LINEEND_LF ) const;
272 : sal_uInt32 GetTextLen() const;
273 : sal_uInt32 GetTextHeight() const;
274 : sal_uInt32 GetTextHeightNTP() const;
275 : sal_uInt32 CalcTextWidth();
276 :
277 : OUString GetText( sal_Int32 nParagraph ) const;
278 : sal_Int32 GetTextLen( sal_Int32 nParagraph ) const;
279 : sal_uInt32 GetTextHeight( sal_Int32 nParagraph ) const;
280 :
281 : sal_Int32 GetParagraphCount() const;
282 :
283 : sal_Int32 GetLineCount( sal_Int32 nParagraph ) const;
284 : sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const;
285 : void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const;
286 : sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const;
287 : sal_uInt32 GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine = 0 );
288 : ParagraphInfos GetParagraphInfos( sal_Int32 nPara );
289 : sal_Int32 FindParagraph( long nDocPosY );
290 : EPosition FindDocPosition( const Point& rDocPos ) const;
291 : Rectangle GetCharacterBounds( const EPosition& rPos ) const;
292 :
293 : OUString GetWord(sal_Int32 nPara, sal_Int32 nIndex);
294 :
295 : ESelection GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const;
296 :
297 : void Clear();
298 : void SetText( const OUString& rStr );
299 :
300 : EditTextObject* CreateTextObject();
301 : EditTextObject* CreateTextObject( sal_Int32 nPara, sal_Int32 nParas = 1 );
302 : EditTextObject* CreateTextObject( const ESelection& rESelection );
303 : void SetText( const EditTextObject& rTextObject );
304 :
305 : void RemoveParagraph(sal_Int32 nPara);
306 : void InsertParagraph(sal_Int32 nPara, const EditTextObject& rTxtObj);
307 : void InsertParagraph(sal_Int32 nPara, const OUString& rText);
308 :
309 : void SetText(sal_Int32 nPara, const OUString& rText);
310 :
311 : virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet );
312 : const SfxItemSet& GetParaAttribs( sal_Int32 nPara ) const;
313 :
314 : void GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const;
315 :
316 : SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const;
317 : SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs_All );
318 :
319 : bool HasParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const;
320 : const SfxPoolItem& GetParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich );
321 :
322 : vcl::Font GetStandardFont( sal_Int32 nPara );
323 : SvxFont GetStandardSvxFont( sal_Int32 nPara );
324 :
325 : void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich );
326 :
327 : void ShowParagraph( sal_Int32 nParagraph, bool bShow = true );
328 :
329 : ::svl::IUndoManager& GetUndoManager();
330 : ::svl::IUndoManager* SetUndoManager(::svl::IUndoManager* pNew);
331 : void UndoActionStart( sal_uInt16 nId );
332 : void UndoActionStart(sal_uInt16 nId, const ESelection& rSel);
333 : void UndoActionEnd( sal_uInt16 nId );
334 : bool IsInUndo();
335 :
336 : void EnableUndo( bool bEnable );
337 : bool IsUndoEnabled();
338 :
339 : /** returns the value last used for bTryMerge while calling ImpEditEngine::InsertUndo
340 : This is currently used in a bad but needed hack to get undo actions merged in the
341 : OutlineView in impress. Do not use it unless you want to sell your soul too! */
342 : bool HasTriedMergeOnLastAddUndo() const;
343 :
344 : void ClearModifyFlag();
345 : void SetModified();
346 : bool IsModified() const;
347 :
348 : void SetModifyHdl( const Link<>& rLink );
349 : Link<> GetModifyHdl() const;
350 :
351 : bool IsInSelectionMode() const;
352 :
353 : void StripPortions();
354 : void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList );
355 :
356 : long GetFirstLineStartX( sal_Int32 nParagraph );
357 : Point GetDocPosTopLeft( sal_Int32 nParagraph );
358 : Point GetDocPos( const Point& rPaperPos ) const;
359 : bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
360 :
361 : // StartDocPos corrresponds to VisArea.TopLeft().
362 : void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
363 : void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos );
364 : void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos, bool bClip );
365 : void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
366 :
367 : // sal_uInt32: Error code of the stream.
368 : sal_uLong Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
369 : sal_uLong Write( SvStream& rOutput, EETextFormat );
370 :
371 : void SetStatusEventHdl( const Link<>& rLink );
372 : Link<> GetStatusEventHdl() const;
373 :
374 : void SetNotifyHdl( const Link<>& rLink );
375 : Link<> GetNotifyHdl() const;
376 :
377 : void SetImportHdl( const Link<>& rLink );
378 : Link<> GetImportHdl() const;
379 :
380 : // Do not evaluate font formatting => For Outliner
381 : bool IsFlatMode() const;
382 : void SetFlatMode( bool bFlat );
383 :
384 : void SetControlWord( EEControlBits nWord );
385 : EEControlBits GetControlWord() const;
386 :
387 : void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
388 : void QuickMarkInvalid( const ESelection& rSel );
389 : void QuickFormatDoc( bool bFull = false );
390 : void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
391 : void QuickInsertLineBreak( const ESelection& rSel );
392 : void QuickInsertText(const OUString& rText, const ESelection& rSel);
393 : void QuickDelete( const ESelection& rSel );
394 : void QuickMarkToBeRepainted( sal_Int32 nPara );
395 :
396 : void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
397 : void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const;
398 :
399 : void SetEditTextObjectPool( SfxItemPool* pPool );
400 : SfxItemPool* GetEditTextObjectPool() const;
401 :
402 : void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
403 : SfxStyleSheetPool* GetStyleSheetPool();
404 :
405 : void SetStyleSheet(const EditSelection& aSel, SfxStyleSheet* pStyle);
406 : void SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle );
407 : const SfxStyleSheet* GetStyleSheet( sal_Int32 nPara ) const;
408 : SfxStyleSheet* GetStyleSheet( sal_Int32 nPara );
409 :
410 : void SetWordDelimiters( const OUString& rDelimiters );
411 : OUString GetWordDelimiters() const;
412 :
413 : void EraseVirtualDevice();
414 :
415 : void SetSpeller( ::com::sun::star::uno::Reference<
416 : ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
417 : ::com::sun::star::uno::Reference<
418 : ::com::sun::star::linguistic2::XSpellChecker1 >
419 : GetSpeller();
420 : void SetHyphenator( ::com::sun::star::uno::Reference<
421 : ::com::sun::star::linguistic2::XHyphenator >& xHyph );
422 :
423 : void GetAllMisspellRanges( std::vector<editeng::MisspellRanges>& rRanges ) const;
424 : void SetAllMisspellRanges( const std::vector<editeng::MisspellRanges>& rRanges );
425 :
426 : static void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
427 :
428 : void SetDefaultLanguage( LanguageType eLang );
429 : LanguageType GetDefaultLanguage() const;
430 :
431 : bool HasOnlineSpellErrors() const;
432 : void CompleteOnlineSpelling();
433 :
434 : bool ShouldCreateBigTextObject() const;
435 :
436 : // For fast Pre-Test without view:
437 : EESpellState HasSpellErrors();
438 : void ClearSpellErrors();
439 : bool HasText( const SvxSearchItem& rSearchItem );
440 :
441 : //initialize sentence spelling
442 : void StartSpelling(EditView& rEditView, bool bMultipleDoc);
443 : //spell and return a sentence
444 : bool SpellSentence(EditView& rEditView, svx::SpellPortions& rToFill, bool bIsGrammarChecking );
445 : // put spell position to start of current sentence
446 : void PutSpellingToSentenceStart( EditView& rEditView );
447 : //applies a changed sentence
448 : void ApplyChangedSentence(EditView& rEditView, const svx::SpellPortions& rNewPortions, bool bRecheck );
449 :
450 : // for text conversion (see also HasSpellErrors)
451 : bool HasConvertibleTextPortion( LanguageType nLang );
452 : virtual bool ConvertNextDocument();
453 :
454 : bool UpdateFields();
455 : bool UpdateFieldsOnly();
456 : void RemoveFields( bool bKeepFieldText, TypeId aType = NULL );
457 :
458 : sal_uInt16 GetFieldCount( sal_Int32 nPara ) const;
459 : EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const;
460 :
461 : bool IsRightToLeft( sal_Int32 nPara ) const;
462 :
463 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
464 : CreateTransferable( const ESelection& rSelection ) const;
465 :
466 : // MT: Can't create new virtual functions like for ParagraphInserted/Deleted, musst be compatible in SRC638, change later...
467 : void SetBeginMovingParagraphsHdl( const Link<>& rLink );
468 : void SetEndMovingParagraphsHdl( const Link<>& rLink );
469 : void SetBeginPasteOrDropHdl( const Link<>& rLink );
470 : void SetEndPasteOrDropHdl( const Link<>& rLink );
471 :
472 : virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev );
473 : virtual void ParagraphInserted( sal_Int32 nNewParagraph );
474 : virtual void ParagraphDeleted( sal_Int32 nDeletedParagraph );
475 : virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph );
476 : virtual void ParaAttribsChanged( sal_Int32 nParagraph );
477 : virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
478 : void ParagraphHeightChanged( sal_Int32 nPara );
479 :
480 : virtual void DrawingText( const Point& rStartPos, const OUString& rText,
481 : sal_Int32 nTextStart, sal_Int32 nTextLen,
482 : const long* pDXArray, const SvxFont& rFont,
483 : sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft,
484 : const EEngineData::WrongSpellVector* pWrongSpellVector,
485 : const SvxFieldData* pFieldData,
486 : bool bEndOfLine,
487 : bool bEndOfParagraph,
488 : bool bEndOfBullet,
489 : const ::com::sun::star::lang::Locale* pLocale,
490 : const Color& rOverlineColor,
491 : const Color& rTextLineColor);
492 :
493 : virtual void DrawingTab( const Point& rStartPos, long nWidth, const OUString& rChar,
494 : const SvxFont& rFont, sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft,
495 : bool bEndOfLine,
496 : bool bEndOfParagraph,
497 : const Color& rOverlineColor,
498 : const Color& rTextLineColor);
499 : virtual OUString GetUndoComment( sal_uInt16 nUndoId ) const;
500 : virtual bool SpellNextDocument();
501 : virtual void FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos );
502 : virtual void FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos );
503 : virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor );
504 :
505 : // override this if access to bullet information needs to be provided
506 : virtual const SvxNumberFormat * GetNumberFormat( sal_Int32 nPara ) const;
507 :
508 : virtual Rectangle GetBulletArea( sal_Int32 nPara );
509 :
510 : static SfxItemPool* CreatePool( bool bLoadRefCounts = true );
511 : static SfxItemPool& GetGlobalItemPool();
512 : static bool DoesKeyChangeText( const KeyEvent& rKeyEvent );
513 : static bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent );
514 : static bool IsSimpleCharInput( const KeyEvent& rKeyEvent );
515 : static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const vcl::Font& rFont );
516 : static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const SvxFont& rFont );
517 : static vcl::Font CreateFontFromItemSet( const SfxItemSet& rItemSet, SvtScriptType nScriptType );
518 : static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet );
519 3 : static bool IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); }
520 : static bool HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable );
521 : /** sets a link that is called at the beginning of a drag operation at an edit view */
522 : void SetBeginDropHdl( const Link<>& rLink );
523 : Link<> GetBeginDropHdl() const;
524 :
525 : /** sets a link that is called at the end of a drag operation at an edit view */
526 : void SetEndDropHdl( const Link<>& rLink );
527 : Link<> GetEndDropHdl() const;
528 :
529 : /// specifies if auto-correction should capitalize the first word or not (default is on)
530 : void SetFirstWordCapitalization( bool bCapitalize );
531 :
532 : EditDoc& GetEditDoc();
533 : const EditDoc& GetEditDoc() const;
534 :
535 : ParaPortionList& GetParaPortions();
536 : const ParaPortionList& GetParaPortions() const;
537 :
538 : bool IsFormatted() const;
539 : bool IsImportHandlerSet() const;
540 : bool IsImportRTFStyleSheetsSet() const;
541 :
542 : void CallImportHandler(ImportInfo& rInfo);
543 :
544 : void ParaAttribsToCharAttribs(ContentNode* pNode);
545 :
546 : EditPaM CreateEditPaM(const EPaM& rEPaM);
547 : EditPaM ConnectParagraphs(
548 : ContentNode* pLeft, ContentNode* pRight, bool bBackward = false);
549 :
550 : EditPaM InsertField(const EditSelection& rEditSelection, const SvxFieldItem& rFld);
551 : EditPaM InsertText(const EditSelection& aCurEditSelection, const OUString& rStr);
552 : EditSelection InsertText(const EditTextObject& rTextObject, const EditSelection& rSel);
553 : EditPaM InsertParaBreak(
554 : const EditSelection& rEditSelection, bool bKeepEndingAttribs = true);
555 : EditPaM InsertLineBreak(const EditSelection& rEditSelection);
556 :
557 : EditPaM CursorLeft(
558 : const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL);
559 : EditPaM CursorRight(
560 : const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL);
561 :
562 : void SeekCursor(
563 : ContentNode* pNode, sal_Int32 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0);
564 :
565 : EditPaM DeleteSelection(const EditSelection& rSel);
566 :
567 : ESelection CreateESelection(const EditSelection& rSel);
568 : EditSelection CreateSelection(const ESelection& rSel);
569 :
570 : const SfxItemSet& GetBaseParaAttribs(sal_Int32 nPara) const;
571 : void SetParaAttribsOnly(sal_Int32 nPara, const SfxItemSet& rSet);
572 : void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0);
573 :
574 : OUString GetSelected(const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF) const;
575 : EditPaM DeleteSelected(const EditSelection& rSel);
576 :
577 : SvtScriptType GetScriptType(const EditSelection& rSel) const;
578 :
579 : void RemoveParaPortion(sal_Int32 nNode);
580 :
581 : void SetCallParaInsertedOrDeleted(bool b);
582 : bool IsCallParaInsertedOrDeleted() const;
583 :
584 : void AppendDeletedNodeInfo(DeletedNodeInfo* pInfo);
585 : void UpdateSelections();
586 :
587 : void InsertContent(ContentNode* pNode, sal_Int32 nPos);
588 : EditPaM SplitContent(sal_Int32 nNode, sal_Int32 nSepPos);
589 : EditPaM ConnectContents(sal_Int32 nLeftNode, bool bBackward);
590 :
591 : EditPaM InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem);
592 :
593 : EditSelection MoveParagraphs(const Range& rParagraphs, sal_Int32 nNewPos, EditView* pCurView);
594 :
595 : void RemoveCharAttribs(sal_Int32 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false);
596 : void RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAttribs, sal_uInt16 nWhich = 0);
597 :
598 : ViewsType& GetEditViews();
599 : const ViewsType& GetEditViews() const;
600 :
601 : void SetUndoMode(bool b);
602 : void FormatAndUpdate(EditView* pCurView = NULL);
603 :
604 : bool Undo(EditView* pView);
605 : bool Redo(EditView* pView);
606 : };
607 :
608 : #endif // INCLUDED_EDITENG_EDITENG_HXX
609 :
610 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|