update credits
[LibreOffice.git] / include / editeng / editview.hxx
blob1eaec52c4b7a0408b73564741625ee04e7cd3e63
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 // MyEDITVIEW, due to exported EditView
20 #ifndef _MyEDITVIEW_HXX
21 #define _MyEDITVIEW_HXX
23 #include <com/sun/star/i18n/WordType.hpp>
25 #include <rsc/rscsfx.hxx>
26 #include <i18nlangtag/lang.h>
27 #include <tools/color.hxx>
28 #include <tools/gen.hxx>
30 class EditEngine;
31 class ImpEditEngine;
32 class ImpEditView;
33 class SvxSearchItem;
34 class SvxFieldItem;
35 class Window;
36 class Pointer;
37 class Cursor;
38 class KeyEvent;
39 class MouseEvent;
40 class DropEvent;
41 class CommandEvent;
42 class Rectangle;
43 class Link;
44 class Pair;
45 class Point;
46 class Range;
47 class SvStream;
48 class SvKeyValueIterator;
49 class SfxStyleSheet;
50 class Font;
51 class FontList;
52 class OutputDevice;
54 #include <editeng/editdata.hxx>
55 #include <com/sun/star/uno/Reference.h>
56 #include "editeng/editengdllapi.h"
58 namespace com {
59 namespace sun {
60 namespace star {
61 namespace datatransfer {
62 class XTransferable;
64 namespace linguistic2 {
65 class XSpellChecker1;
66 class XLanguageGuessing;
68 }}}
70 class EDITENG_DLLPUBLIC EditView
72 friend class EditEngine;
73 friend class ImpEditEngine;
74 friend class EditSelFunctionSet;
76 public: // Needed for Undo
77 ImpEditView* GetImpEditView() const { return pImpEditView; }
78 ImpEditEngine* GetImpEditEngine() const;
80 private:
81 ImpEditView* pImpEditView;
82 String aDicNameSingle;
84 EDITENG_DLLPRIVATE EditView( const EditView& );
85 EDITENG_DLLPRIVATE EditView& operator=( const EditView& );
87 public:
88 EditView( EditEngine* pEng, Window* pWindow );
89 virtual ~EditView();
91 void SetEditEngine( EditEngine* pEditEngine );
92 EditEngine* GetEditEngine() const;
94 void SetWindow( Window* pWin );
95 Window* GetWindow() const;
97 void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
98 void Invalidate();
99 Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG );
101 void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True );
102 void HideCursor();
104 void SetSelectionMode( EESelectionMode eMode );
106 void SetReadOnly( sal_Bool bReadOnly );
107 sal_Bool IsReadOnly() const;
109 sal_Bool HasSelection() const;
110 ESelection GetSelection() const;
111 void SetSelection( const ESelection& rNewSel );
112 sal_Bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
114 sal_Bool IsInsertMode() const;
115 void SetInsertMode( sal_Bool bInsert );
117 void ReplaceSelected( const String& rStr );
118 String GetSelected();
119 void DeleteSelected();
121 sal_uInt16 GetSelectedScriptType() const;
123 // VisArea position of the Output window.
124 // A size change also affects the VisArea
125 void SetOutputArea( const Rectangle& rRect );
126 const Rectangle& GetOutputArea() const;
128 // Document position.
129 // A size change also affects the VisArea
130 void SetVisArea( const Rectangle& rRect );
131 const Rectangle& GetVisArea() const;
133 const Pointer& GetPointer() const;
135 Cursor* GetCursor() const;
137 void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
139 sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL );
141 sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent );
142 sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent );
143 sal_Bool MouseMove( const MouseEvent& rMouseEvent );
144 void Command( const CommandEvent& rCEvt );
146 void Cut();
147 void Copy();
148 void Paste();
149 void PasteSpecial();
151 void Undo();
152 void Redo();
154 // especially for Oliver Specht
155 Point GetWindowPosTopLeft( sal_Int32 nParagraph );
156 void MoveParagraphs( Range aParagraphs, sal_Int32 nNewPos );
157 void MoveParagraphs( long nDiff );
159 const SfxItemSet& GetEmptyItemSet();
160 SfxItemSet GetAttribs();
161 void SetAttribs( const SfxItemSet& rSet );
162 void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0 );
163 void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich = 0 );
164 void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs = sal_False );
166 sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
168 void SetBackgroundColor( const Color& rColor );
169 Color GetBackgroundColor() const;
171 void SetControlWord( sal_uInt32 nWord );
172 sal_uInt32 GetControlWord() const;
174 EditTextObject* CreateTextObject();
175 void InsertText( const EditTextObject& rTextObject );
176 void InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial );
178 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable();
180 // An EditView, so that when TRUE the update will be free from flickering:
181 void SetEditEngineUpdateMode( sal_Bool bUpdate );
182 void ForceUpdate();
184 const SfxStyleSheet* GetStyleSheet() const;
185 SfxStyleSheet* GetStyleSheet();
187 void SetAnchorMode( EVAnchorMode eMode );
188 EVAnchorMode GetAnchorMode() const;
190 void CompleteAutoCorrect( Window* pFrameWin = NULL );
192 EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
193 EESpellState StartThesaurus();
194 sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
196 // for text conversion
197 void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
198 sal_Bool HasConvertibleTextPortion( LanguageType nLang );
200 void TransliterateText( sal_Int32 nTransliterationMode );
202 sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
203 sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
204 void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
206 void InsertField( const SvxFieldItem& rFld );
207 const SvxFieldItem* GetFieldUnderMousePointer() const;
208 const SvxFieldItem* GetFieldUnderMousePointer( sal_Int32& nPara, xub_StrLen& nPos ) const;
209 const SvxFieldItem* GetField( const Point& rPos, sal_Int32* pnPara = NULL, xub_StrLen* pnPos = NULL ) const;
211 const SvxFieldItem* GetFieldAtSelection() const;
213 void SetInvalidateMore( sal_uInt16 nPixel );
214 sal_uInt16 GetInvalidateMore() const;
216 // grows or shrinks the font height for the current selection
217 void ChangeFontSize( bool bGrow, const FontList* pList );
219 static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList );
221 String GetSurroundingText() const;
222 Selection GetSurroundingTextSelection() const;
224 /** Tries to determine the language of 'rText', returning a matching known
225 locale if possible, or a fallback, or LANGUAGE_NONE if nothing found or
226 matched.
228 @param bIsParaText
229 If TRUE, rText is a paragraph and the language is obtained by
230 passing the text to xLangGuess.
231 IF FALSE, a language match is tried for, in order,
232 1. the default document language (non-CTL, non-CJK, aka LATIN)
233 2. the UI language (Tools->Options->LanguageSettings->Languages User Interface)
234 3. the locale (Tools->Options->LanguageSettings->Languages Locale)
235 4. en-US
236 If nothing matched, LANGUAGE_NONE is returned.
238 static LanguageType CheckLanguage(
239 const OUString &rText,
240 com::sun::star::uno::Reference< com::sun::star::linguistic2::XSpellChecker1 > xSpell,
241 com::sun::star::uno::Reference< com::sun::star::linguistic2::XLanguageGuessing > xLangGuess,
242 bool bIsParaText );
245 #endif // _MyEDITVIEW_HXX
247 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */