summaryrefslogtreecommitdiff
path: root/svx/inc/svx/editview.hxx
blob: c7c9bd975428052fde326ce8b73349e1228255d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: editview.hxx,v $
 * $Revision: 1.4.198.1 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
// MyEDITVIEW, wegen exportiertem EditView
#ifndef _MyEDITVIEW_HXX
#define _MyEDITVIEW_HXX

#include <rsc/rscsfx.hxx>
#include <i18npool/lang.h>
#include <tools/color.hxx>

class EditEngine;
class ImpEditEngine;
class ImpEditView;
class SvxSearchItem;
class SvxFieldItem;
class Window;
class Pointer;
class Cursor;
class KeyEvent;
class MouseEvent;
class DropEvent;
class CommandEvent;
class Rectangle;
class Link;
class Pair;
class Point;
class Range;
class SvStream;
class SvKeyValueIterator;
class SfxStyleSheet;
class Font;
class FontList;

#ifndef _EDITDATA_HXX
#include <svx/editdata.hxx>
#endif
#include <com/sun/star/uno/Reference.h>
#include "svx/svxdllapi.h"

namespace com {
namespace sun {
namespace star {
namespace datatransfer {
    class XTransferable;
}}}}

class SVX_DLLPUBLIC EditView
{
    friend class EditEngine;
    friend class ImpEditEngine;
    friend class EditSelFunctionSet;

public: // brauche ich fuer Undo
    ImpEditView*    GetImpEditView() const      { return pImpEditView; }
    ImpEditEngine*  GetImpEditEngine() const;

private:
    ImpEditView*    pImpEditView;

                    SVX_DLLPRIVATE EditView( const EditView& );
    SVX_DLLPRIVATE EditView&        operator=( const EditView& );

public:
                    EditView( EditEngine* pEng, Window* pWindow );
    virtual         ~EditView();

    void            SetEditEngine( EditEngine* pEditEngine );
    EditEngine*     GetEditEngine() const;

    void            SetWindow( Window* pWin );
    Window*         GetWindow() const;

    void            Paint( const Rectangle& rRect );
    void            Invalidate();
    Pair            Scroll( long nHorzScroll, long nVertScroll, BYTE nRangeCheck = RGCHK_NEG );

    void            ShowCursor( BOOL bGotoCursor = TRUE, BOOL bForceVisCursor = TRUE );
    void            HideCursor();

    EESelectionMode GetSelectionMode() const;
    void            SetSelectionMode( EESelectionMode eMode );

    void            SetReadOnly( BOOL bReadOnly );
    BOOL            IsReadOnly() const;

    BOOL            HasSelection() const;
    ESelection      GetSelection() const;
    void            SetSelection( const ESelection& rNewSel );
    BOOL            SelectCurrentWord();

    void            IndentBlock();
    void            UnindentBlock();

    BOOL            IsInsertMode() const;
    void            SetInsertMode( BOOL bInsert );

    void            ReplaceSelected( const String& rStr );
    String          GetSelected();
    void            DeleteSelected();

    USHORT          GetSelectedScriptType() const;

                        // Position der VisArea im Ausgabefenster.
                        // Eine Groessenaenderung betrifft auch die VisArea
    void                SetOutputArea( const Rectangle& rRec );
    const Rectangle&    GetOutputArea() const;

                        // Dokumentposition.
                        // Eine Groessenaenderung betrifft auch die VisArea
    void                SetVisArea( const Rectangle& rRec );
    const Rectangle&    GetVisArea() const;

    void            SetPointer( const Pointer& rPointer );
    const Pointer&  GetPointer() const;

    void            SetCursor( const Cursor& rCursor );
    Cursor*         GetCursor() const;

    void            InsertText( const String& rNew, BOOL bSelect = FALSE );

    BOOL            PostKeyEvent( const KeyEvent& rKeyEvent );

    BOOL            MouseButtonUp( const MouseEvent& rMouseEvent );
    BOOL            MouseButtonDown( const MouseEvent& rMouseEvent );
    BOOL            MouseMove( const MouseEvent& rMouseEvent );
    void            Command( const CommandEvent& rCEvt );

    BOOL            Drop( const DropEvent& rEvt );
    BOOL            QueryDrop( DropEvent& rEvt );
    ESelection      GetDropPos();

    void            Cut();
    void            Copy();
    void            Paste();
    void            PasteSpecial();

    void            EnablePaste( BOOL bEnable );
    BOOL            IsPasteEnabled() const;

    void            Undo();
    void            Redo();

    // speziell fuer Olli
    USHORT          GetParagraph( const Point& rMousePosPixel );
    Point           GetWindowPosTopLeft( USHORT nParagraph );
    void            MoveParagraphs( Range aParagraphs, USHORT nNewPos );
    void            MoveParagraphs( long nDiff );

    const SfxItemSet&   GetEmptyItemSet();
    SfxItemSet          GetAttribs();
    void                SetAttribs( const SfxItemSet& rSet );
    void                SetParaAttribs( const SfxItemSet& rSet, USHORT nPara );
    void                RemoveAttribs( BOOL bRemoveParaAttribs = FALSE, USHORT nWhich = 0 );
    void                RemoveCharAttribs( USHORT nPara, USHORT nWhich = 0 );
    void                RemoveAttribsKeepLanguages( BOOL bRemoveParaAttribs = FALSE );

    ULONG           Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, BOOL bSelect = FALSE, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
    ULONG           Write( SvStream& rOutput, EETextFormat eFormat );

    void            SetBackgroundColor( const Color& rColor );
    Color           GetBackgroundColor() const;

    void            SetControlWord( sal_uInt32 nWord );
    sal_uInt32      GetControlWord() const;

    EditTextObject* CreateTextObject();
    void            InsertText( const EditTextObject& rTextObject );
    void            InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, BOOL bUseSpecial );

    ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable();

    // An EditView, damit bei TRUE flackerfreies Update:
    void            SetEditEngineUpdateMode( BOOL bUpdate );
    void            ForceUpdate();

    SfxStyleSheet*  GetStyleSheet() const;
    void            SetStyleSheet( SfxStyleSheet* pStyle );

    void            SetAnchorMode( EVAnchorMode eMode );
    EVAnchorMode    GetAnchorMode() const;

    BOOL            MatchGroup();

    void            CompleteAutoCorrect();

    EESpellState    StartSpeller( BOOL bMultipleDoc = FALSE );
    EESpellState    StartThesaurus();
    USHORT          StartSearchAndReplace( const SvxSearchItem& rSearchItem );

    // for text conversion
    void            StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, INT32 nOptions, BOOL bIsInteractive, BOOL bMultipleDoc );
    sal_Bool        HasConvertibleTextPortion( LanguageType nLang );

    void            TransliterateText( sal_Int32 nTransliterationMode );

    BOOL            IsCursorAtWrongSpelledWord( BOOL bMarkIfWrong = FALSE );
    BOOL            IsWrongSpelledWordAtPos( const Point& rPosPixel, BOOL bMarkIfWrong = FALSE );
    void            SpellIgnoreWord();
    void            ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );

    void                InsertField( const SvxFieldItem& rFld );
    const SvxFieldItem* GetFieldUnderMousePointer() const;
    const SvxFieldItem* GetFieldUnderMousePointer( USHORT& nPara, xub_StrLen& nPos ) const;
    const SvxFieldItem* GetField( const Point& rPos, USHORT* pnPara = NULL, xub_StrLen* pnPos = NULL ) const;

    const SvxFieldItem* GetFieldAtSelection() const;

    String          GetWordUnderMousePointer() const;
    String          GetWordUnderMousePointer( Rectangle& rWordRect ) const;

    void            SetInvalidateMore( USHORT nPixel );
    USHORT          GetInvalidateMore() const;

    // grows or shrinks the font height for the current selection
    void            ChangeFontSize( bool bGrow, const FontList* pList );

    static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList );
};

#endif // _MyEDITVIEW_HXX