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