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 : // MyEDITVIEW, due to exported EditView
20 : #ifndef _MyEDITVIEW_HXX
21 : #define _MyEDITVIEW_HXX
22 :
23 : #include <com/sun/star/i18n/WordType.hpp>
24 :
25 : #include <rsc/rscsfx.hxx>
26 : #include <i18npool/lang.h>
27 : #include <tools/color.hxx>
28 : #include <tools/gen.hxx>
29 :
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 :
53 : #include <editeng/editdata.hxx>
54 : #include <com/sun/star/uno/Reference.h>
55 : #include "editeng/editengdllapi.h"
56 :
57 : namespace com {
58 : namespace sun {
59 : namespace star {
60 : namespace datatransfer {
61 : class XTransferable;
62 : }}}}
63 :
64 : class EDITENG_DLLPUBLIC EditView
65 : {
66 : friend class EditEngine;
67 : friend class ImpEditEngine;
68 : friend class EditSelFunctionSet;
69 :
70 : public: // Needed for Undo
71 19 : ImpEditView* GetImpEditView() const { return pImpEditView; }
72 : ImpEditEngine* GetImpEditEngine() const;
73 :
74 : private:
75 : ImpEditView* pImpEditView;
76 : String aDicNameSingle;
77 :
78 : EDITENG_DLLPRIVATE EditView( const EditView& );
79 : EDITENG_DLLPRIVATE EditView& operator=( const EditView& );
80 :
81 : public:
82 : EditView( EditEngine* pEng, Window* pWindow );
83 : virtual ~EditView();
84 :
85 : void SetEditEngine( EditEngine* pEditEngine );
86 : EditEngine* GetEditEngine() const;
87 :
88 : void SetWindow( Window* pWin );
89 : Window* GetWindow() const;
90 :
91 : void Paint( const Rectangle& rRect );
92 : void Invalidate();
93 : Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG );
94 :
95 : void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True );
96 : void HideCursor();
97 :
98 : void SetSelectionMode( EESelectionMode eMode );
99 :
100 : void SetReadOnly( sal_Bool bReadOnly );
101 : sal_Bool IsReadOnly() const;
102 :
103 : sal_Bool HasSelection() const;
104 : ESelection GetSelection() const;
105 : void SetSelection( const ESelection& rNewSel );
106 : sal_Bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
107 :
108 : sal_Bool IsInsertMode() const;
109 : void SetInsertMode( sal_Bool bInsert );
110 :
111 : void ReplaceSelected( const String& rStr );
112 : String GetSelected();
113 : void DeleteSelected();
114 :
115 : sal_uInt16 GetSelectedScriptType() const;
116 :
117 : // VisArea position of the Output window.
118 : // A size change also affects the VisArea
119 : void SetOutputArea( const Rectangle& rRec );
120 : const Rectangle& GetOutputArea() const;
121 :
122 : // Document position.
123 : // A size change also affects the VisArea
124 : void SetVisArea( const Rectangle& rRec );
125 : const Rectangle& GetVisArea() const;
126 :
127 : const Pointer& GetPointer() const;
128 :
129 : Cursor* GetCursor() const;
130 :
131 : void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
132 :
133 : sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL );
134 :
135 : sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent );
136 : sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent );
137 : sal_Bool MouseMove( const MouseEvent& rMouseEvent );
138 : void Command( const CommandEvent& rCEvt );
139 :
140 : void Cut();
141 : void Copy();
142 : void Paste();
143 : void PasteSpecial();
144 :
145 : void Undo();
146 : void Redo();
147 :
148 : // especially for Oliver Specht
149 : Point GetWindowPosTopLeft( sal_uInt16 nParagraph );
150 : void MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos );
151 : void MoveParagraphs( long nDiff );
152 :
153 : const SfxItemSet& GetEmptyItemSet();
154 : SfxItemSet GetAttribs();
155 : void SetAttribs( const SfxItemSet& rSet );
156 : void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0 );
157 : void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
158 : void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs = sal_False );
159 :
160 : sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
161 :
162 : void SetBackgroundColor( const Color& rColor );
163 : Color GetBackgroundColor() const;
164 :
165 : void SetControlWord( sal_uInt32 nWord );
166 : sal_uInt32 GetControlWord() const;
167 :
168 : EditTextObject* CreateTextObject();
169 : void InsertText( const EditTextObject& rTextObject );
170 : void InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial );
171 :
172 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable();
173 :
174 : // An EditView, so that when TRUE the update will be free from flickering:
175 : void SetEditEngineUpdateMode( sal_Bool bUpdate );
176 : void ForceUpdate();
177 :
178 : const SfxStyleSheet* GetStyleSheet() const;
179 : SfxStyleSheet* GetStyleSheet();
180 :
181 : void SetAnchorMode( EVAnchorMode eMode );
182 : EVAnchorMode GetAnchorMode() const;
183 :
184 : void CompleteAutoCorrect( Window* pFrameWin = NULL );
185 :
186 : EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
187 : EESpellState StartThesaurus();
188 : sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
189 :
190 : // for text conversion
191 : void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
192 : sal_Bool HasConvertibleTextPortion( LanguageType nLang );
193 :
194 : void TransliterateText( sal_Int32 nTransliterationMode );
195 :
196 : sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
197 : sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
198 : void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
199 :
200 : void InsertField( const SvxFieldItem& rFld );
201 : const SvxFieldItem* GetFieldUnderMousePointer() const;
202 : const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const;
203 : const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pnPara = NULL, xub_StrLen* pnPos = NULL ) const;
204 :
205 : const SvxFieldItem* GetFieldAtSelection() const;
206 :
207 : void SetInvalidateMore( sal_uInt16 nPixel );
208 : sal_uInt16 GetInvalidateMore() const;
209 :
210 : // grows or shrinks the font height for the current selection
211 : void ChangeFontSize( bool bGrow, const FontList* pList );
212 :
213 : static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList );
214 :
215 : String GetSurroundingText() const;
216 : Selection GetSurroundingTextSelection() const;
217 : };
218 :
219 : #endif // _MyEDITVIEW_HXX
220 :
221 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|