Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_svx / editeng.hxx
blob7204232fc950f88878fc4d87f71bdf683aa3866e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: editeng.hxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 // MyEDITENG, wegen exportiertem EditEng
33 #ifndef _MyEDITENG_HXX
34 #define _MyEDITENG_HXX
35 class OutputDevice;
36 class String;
37 class MapMode;
38 class Color;
39 class Font;
40 class KeyEvent;
41 class PolyPolygon;
42 class Size;
43 class Point;
44 class Rectangle;
45 class SvStream;
46 class Link;
47 class OutputDevice;
48 namespace binfilter {
49 class SvKeyValueIterator;
50 class SvUShorts;
51 class SfxStyleSheetPool;
52 class SfxUndoManager;
53 class SfxItemPool;
54 class SfxStyleSheet;
55 class SfxUndoAction;
56 class SfxPoolItem;
57 class ImpEditEngine;
58 class EditView;
59 class EditUndo;
60 class SvxFont;
61 class SvxFieldItem;
62 class SvxCharSetColorItem;
63 class XPolyPolygon;
64 class SvxNumBulletItem;
65 class SvxBulletItem;
66 class SvxLRSpaceItem;
67 class SvxForbiddenCharactersTable;
68 }//end of namespace binfilter
69 #include <vos/ref.hxx>
71 #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
72 #include <com/sun/star/uno/Reference.h>
73 #endif
75 namespace com { namespace sun { namespace star {
76 namespace linguistic2 {
77 class XSpellChecker1;
78 class XHyphenator;
80 namespace datatransfer {
81 class XTransferable;
83 }}}
85 #ifndef _RSCSFX_HXX //autogen
86 #include <rsc/rscsfx.hxx>
87 #endif
88 #ifndef _EDITDATA_HXX
89 #include <bf_svx/editdata.hxx>
90 #endif
91 #ifndef INCLUDED_I18NPOOL_LANG_H
92 #include <i18npool/lang.h>
93 #endif
95 #include <tools/rtti.hxx> // wegen typedef TypeId
96 namespace binfilter {
97 /** values for GetAttribs
99 const sal_uInt8 EditEngineAttribs_All = 0; /// returns all attributes even when theire not set
100 const sal_uInt8 EditEngineAttribs_HardAndPara = 1; /// returns all attributes set on paragraph and on portions
101 const sal_uInt8 EditEngineAttribs_OnlyHard = 2; /// returns only attributes hard set on portions
103 #define GETATTRIBS_STYLESHEET (sal_uInt8)0x01
104 #define GETATTRIBS_PARAATTRIBS (sal_uInt8)0x02
105 #define GETATTRIBS_CHARATTRIBS (sal_uInt8)0x04
106 #define GETATTRIBS_ALL (sal_uInt8)0xFF
108 class EditEngine
110 friend class EditView;
111 friend class ImpEditView;
112 friend class EditDbg;
113 friend class Outliner;
115 private:
116 ImpEditEngine* pImpEditEngine;
118 EditEngine( const EditEngine& );
119 EditEngine& operator=( const EditEngine& );
121 #if _SOLAR__PRIVATE
122 BOOL PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView );
123 #endif
125 public:
126 EditEngine( SfxItemPool* pItemPool );
127 virtual ~EditEngine();
129 const SfxItemSet& GetEmptyItemSet();
131 void SetDefTab( USHORT nDefTab );
133 void SetRefDevice( OutputDevice* pRefDef );
134 OutputDevice* GetRefDevice() const;
136 void SetRefMapMode( const MapMode& rMapMode );
137 MapMode GetRefMapMode();
139 void SetUpdateMode( BOOL bUpdate );
140 BOOL GetUpdateMode() const;
142 void SetBackgroundColor( const Color& rColor );
143 Color GetAutoColor() const;
144 void EnableAutoColor( BOOL b );
145 BOOL IsForceAutoColor() const;
147 EditView* RemoveView( EditView* pEditView );
148 BOOL HasView( EditView* pView ) const;
150 void SetPaperSize( const Size& rSize );
151 const Size& GetPaperSize() const;
153 void SetVertical( BOOL bVertical );
154 BOOL IsVertical() const;
157 USHORT GetScriptType( const ESelection& rSelection ) const;
158 LanguageType GetLanguage( USHORT nPara, USHORT nPos ) const;
161 void SetAsianCompressionMode( USHORT nCompression );
163 void SetKernAsianPunctuation( BOOL bEnabled );
165 void ClearPolygon();
167 void SetMinAutoPaperSize( const Size& rSz );
169 void SetMaxAutoPaperSize( const Size& rSz );
171 String GetText( LineEnd eEnd = LINEEND_LF ) const;
172 String GetText( const ESelection& rSelection, const LineEnd eEnd = LINEEND_LF ) const;
173 sal_uInt32 GetTextHeight() const;
174 sal_uInt32 CalcTextWidth();
176 String GetText( USHORT nParagraph ) const;
177 xub_StrLen GetTextLen( USHORT nParagraph ) const;
178 sal_uInt32 GetTextHeight( USHORT nParagraph ) const;
180 USHORT GetParagraphCount() const;
182 USHORT GetLineCount( USHORT nParagraph ) const;
183 xub_StrLen GetLineLen( USHORT nParagraph, USHORT nLine ) const;
184 sal_uInt32 GetLineHeight( USHORT nParagraph, USHORT nLine = 0 );
185 USHORT GetFirstLineOffset( USHORT nParagraph );
186 ParagraphInfos GetParagraphInfos( USHORT nPara );
187 USHORT FindParagraph( long nDocPosY );
188 EPosition FindDocPosition( const Point& rDocPos ) const;
189 Rectangle GetCharacterBounds( const EPosition& rPos ) const;
192 ESelection GetWord( const ESelection& rSelection, USHORT nWordType ) const;
194 void Clear();
195 void SetText( const String& rStr );
197 EditTextObject* CreateTextObject();
198 EditTextObject* CreateTextObject( USHORT nPara, USHORT nParas = 1 );
199 void SetText( const EditTextObject& rTextObject );
201 void InsertParagraph( USHORT nPara, const String& rText);
203 void SetText( USHORT nPara, const String& rText);
205 void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet );
206 const SfxItemSet& GetParaAttribs( USHORT nPara ) const;
208 void GetCharAttribs( USHORT nPara, EECharAttribArray& rLst ) const;
210 SfxItemSet GetAttribs( USHORT nPara, USHORT nStart, USHORT nEnd, sal_uInt8 nFlags = 0xFF ) const;
211 SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = EditEngineAttribs_All );
213 BOOL HasParaAttrib( USHORT nPara, USHORT nWhich ) const;
214 const SfxPoolItem& GetParaAttrib( USHORT nPara, USHORT nWhich );
219 SfxUndoManager& GetUndoManager();
220 void UndoActionStart( USHORT nId );
221 void UndoActionEnd( USHORT nId );
222 BOOL IsInUndo();
224 void EnableUndo( BOOL bEnable );
225 BOOL IsUndoEnabled();
227 void SetModified();
228 BOOL IsModified() const;
230 Link GetModifyHdl() const;
233 void StripPortions();
234 void GetPortions( USHORT nPara, SvUShorts& rList );
236 Point GetDocPosTopLeft( USHORT nParagraph );
237 Point GetDocPos( const Point& rPaperPos ) const;
238 BOOL IsTextPos( const Point& rPaperPos, USHORT nBorder = 0 );
240 // StartDocPos entspr. VisArea.TopLeft().
242 void SetStatusEventHdl( const Link& rLink );
244 void SetNotifyHdl( const Link& rLink );
245 Link GetNotifyHdl() const;
248 // Flat-Mode: Keine Zeichenformatierung auswerten => Fuer Outliner
249 BOOL IsFlatMode() const;
251 void SetControlWord( sal_uInt32 nWord );
252 sal_uInt32 GetControlWord() const;
254 void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
255 void QuickRemoveCharAttribs( USHORT nPara, USHORT nWhich = 0 );
256 void QuickFormatDoc( BOOL bFull = FALSE );
257 void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
258 void QuickInsertLineBreak( const ESelection& rSel );
259 void QuickInsertText( const String& rText, const ESelection& rSel );
260 void QuickDelete( const ESelection& rSel );
262 void SetGlobalCharStretching( USHORT nX = 100, USHORT nY = 100 );
264 void SetEditTextObjectPool( SfxItemPool* pPool );
265 SfxItemPool* GetEditTextObjectPool() const;
267 void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
268 SfxStyleSheetPool* GetStyleSheetPool();
270 void SetStyleSheet( USHORT nPara, SfxStyleSheet* pStyle );
271 SfxStyleSheet* GetStyleSheet( USHORT nPara ) const;
273 void SetWordDelimiters( const String& rDelimiters );
274 String GetWordDelimiters() const;
279 void EraseVirtualDevice();
281 void SetSpeller( ::com::sun::star::uno::Reference<
282 ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
283 void SetHyphenator( ::com::sun::star::uno::Reference<
284 ::com::sun::star::linguistic2::XHyphenator >& xHyph );
286 void SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars );
288 void SetDefaultLanguage( LanguageType eLang );
290 BOOL HasOnlineSpellErrors() const;
291 void CompleteOnlineSpelling();
293 BOOL ShouldCreateBigTextObject() const;
295 // Zum schnellen Vorab-Pruefen ohne View:
297 BOOL UpdateFields();
299 USHORT GetFieldCount( USHORT nPara ) const;
300 EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const;
303 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
304 CreateTransferable( const ESelection& rSelection ) const;
306 // MT: Can't create new virtual functions like for ParagraphInserted/Deleted, musst be compatible in SRC638, change later...
307 void SetBeginMovingParagraphsHdl( const Link& rLink );
308 void SetEndMovingParagraphsHdl( const Link& rLink );
309 void SetBeginPasteOrDropHdl( const Link& rLink );
310 void SetEndPasteOrDropHdl( const Link& rLink );
312 virtual void PaintingFirstLine( USHORT nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev );
313 virtual void ParagraphInserted( USHORT nNewParagraph );
314 virtual void ParagraphDeleted( USHORT nDeletedParagraph );
315 virtual void ParaAttribsChanged( USHORT nParagraph );
316 virtual void ParagraphHeightChanged( USHORT nPara );
318 // #101498#
319 virtual void DrawingText( const Point& rStartPos, const String& rText, USHORT nTextStart, USHORT nTextLen, const sal_Int32* pDXArray, const SvxFont& rFont, USHORT nPara, xub_StrLen nIndex, BYTE nRightToLeft);
321 virtual String GetUndoComment( USHORT nUndoId ) const;
322 virtual BOOL FormattingParagraph( USHORT nPara );
323 virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
324 virtual Rectangle GetBulletArea( USHORT nPara );
326 static SfxItemPool* CreatePool( BOOL bLoadRefCounts = TRUE );
327 static Font CreateFontFromItemSet( const SfxItemSet& rItemSet, USHORT nScriptType );
328 static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet );
329 static void ImportBulletItem( SvxNumBulletItem& rNumBullet, USHORT nLevel, const SvxBulletItem* pOldBullet, const SvxLRSpaceItem* pOldLRSpace );
330 static BOOL IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); }
333 }//end of namespace binfilter
334 #endif // _MyEDITENG_HXX