bump product version to 4.2.0.1
[LibreOffice.git] / include / vcl / textview.hxx
blob628132d2afeb243d1c217d787d88c93910267d13
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 .
20 #ifndef INCLUDED_VCL_TEXTVIEW_HXX
21 #define INCLUDED_VCL_TEXTVIEW_HXX
23 #include <tools/gen.hxx>
24 #include <tools/lineend.hxx>
25 #include <vcl/dllapi.h>
26 #include <vcl/dndhelp.hxx>
27 #include <vcl/textdata.hxx>
29 class TextEngine;
30 class OutputDevice;
31 class Window;
32 class Cursor;
33 class KeyEvent;
34 class MouseEvent;
35 class CommandEvent;
36 class TextSelFunctionSet;
37 class SelectionEngine;
38 class VirtualDevice;
39 struct TextDDInfo;
41 namespace com {
42 namespace sun {
43 namespace star {
44 namespace datatransfer {
45 namespace clipboard {
46 class XClipboard;
47 }}}}}
49 struct ImpTextView;
51 class VCL_DLLPUBLIC TextView : public vcl::unohelper::DragAndDropClient
53 friend class TextEngine;
54 friend class TextUndo;
55 friend class TextUndoManager;
56 friend class TextSelFunctionSet;
57 friend class ExtTextView;
59 private:
60 ImpTextView* mpImpl;
62 TextView( const TextView& ) : vcl::unohelper::DragAndDropClient() {}
63 TextView& operator=( const TextView& ) { return *this; }
65 protected:
66 void ShowSelection();
67 void HideSelection();
68 void ShowSelection( const TextSelection& rSel );
69 void ImpShowHideSelection( sal_Bool bShow, const TextSelection* pRange = NULL );
71 TextSelection ImpMoveCursor( const KeyEvent& rKeyEvent );
72 TextPaM ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode );
73 void ImpSetSelection( const TextSelection& rNewSel, sal_Bool bUI );
74 sal_Bool IsInSelection( const TextPaM& rPaM );
76 void ImpPaint( OutputDevice* pOut, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange = 0, TextSelection const* pSelection = 0 );
77 void ImpPaint( const Rectangle& rRect, sal_Bool bUseVirtDev );
78 void ImpShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_Bool bEndKey );
79 void ImpHighlight( const TextSelection& rSel );
80 void ImpSetSelection( const TextSelection& rSelection );
81 Point ImpGetOutputStartPos( const Point& rStartDocPos ) const;
83 void ImpHideDDCursor();
84 void ImpShowDDCursor();
86 bool ImplTruncateNewText( OUString& rNewText ) const;
87 sal_Bool ImplCheckTextLen( const OUString& rNewText );
89 VirtualDevice* GetVirtualDevice();
91 // DragAndDropClient
92 virtual void dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException);
93 virtual void dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException);
94 virtual void drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException);
95 virtual void dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException);
96 virtual void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException);
97 virtual void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException);
99 using DragAndDropClient::dragEnter;
100 using DragAndDropClient::dragExit;
101 using DragAndDropClient::dragOver;
103 public:
104 TextView( TextEngine* pEng, Window* pWindow );
105 virtual ~TextView();
107 TextEngine* GetTextEngine() const;
108 Window* GetWindow() const;
110 void Invalidate();
111 void Scroll( long nHorzScroll, long nVertScroll );
113 void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True );
114 void HideCursor();
116 void EnableCursor( sal_Bool bEnable );
117 sal_Bool IsCursorEnabled() const;
119 const TextSelection& GetSelection() const;
120 TextSelection& GetSelection();
121 void SetSelection( const TextSelection& rNewSel );
122 void SetSelection( const TextSelection& rNewSel, sal_Bool bGotoCursor );
123 sal_Bool HasSelection() const;
125 OUString GetSelected();
126 OUString GetSelected( LineEnd aSeparator );
127 void DeleteSelected();
129 void InsertText( const OUString& rNew, sal_Bool bSelect = sal_False );
131 sal_Bool KeyInput( const KeyEvent& rKeyEvent );
132 void Paint( const Rectangle& rRect );
133 void MouseButtonUp( const MouseEvent& rMouseEvent );
134 void MouseButtonDown( const MouseEvent& rMouseEvent );
135 void MouseMove( const MouseEvent& rMouseEvent );
136 void Command( const CommandEvent& rCEvt );
138 void Cut();
139 void Copy();
140 void Paste();
142 void Copy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
143 void Paste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
145 void Undo();
146 void Redo();
148 sal_Bool Read( SvStream& rInput );
150 void SetStartDocPos( const Point& rPos );
151 const Point& GetStartDocPos() const;
153 Point GetDocPos( const Point& rWindowPos ) const;
154 Point GetWindowPos( const Point& rDocPos ) const;
156 void SetInsertMode( sal_Bool bInsert );
157 sal_Bool IsInsertMode() const;
159 void SetAutoIndentMode( sal_Bool bAutoIndent );
161 void SetReadOnly( sal_Bool bReadOnly );
162 sal_Bool IsReadOnly() const;
164 void SetAutoScroll( sal_Bool bAutoScroll );
165 sal_Bool IsAutoScroll() const;
167 sal_Bool SetCursorAtPoint( const Point& rPointPixel );
168 sal_Bool IsSelectionAtPoint( const Point& rPointPixel );
170 void SetPaintSelection( sal_Bool bPaint);
172 void EraseVirtualDevice();
174 // aus dem protected Teil hierher verschoben
175 // For 'SvtXECTextCursor' (TL). Must ggf nochmal anders gel?st werden.
176 TextPaM PageUp( const TextPaM& rPaM );
177 TextPaM PageDown( const TextPaM& rPaM );
178 TextPaM CursorUp( const TextPaM& rPaM );
179 TextPaM CursorDown( const TextPaM& rPaM );
180 TextPaM CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIteratorMode );
181 TextPaM CursorRight( const TextPaM& rPaM, sal_uInt16 nCharacterIteratorMode );
182 TextPaM CursorWordLeft( const TextPaM& rPaM );
183 TextPaM CursorWordRight( const TextPaM& rPaM );
184 TextPaM CursorStartOfLine( const TextPaM& rPaM );
185 TextPaM CursorEndOfLine( const TextPaM& rPaM );
186 TextPaM CursorStartOfParagraph( const TextPaM& rPaM );
187 TextPaM CursorEndOfParagraph( const TextPaM& rPaM );
188 TextPaM CursorStartOfDoc();
189 TextPaM CursorEndOfDoc();
192 Drag and Drop, deleting and selection regards all text that has an attribute
193 TEXTATTR_PROTECTED set as one entitity. Drag and dropped text is automatically
194 attibuted as protected.
196 void SupportProtectAttribute(sal_Bool bSupport);
199 Returns the number in paragraph of the line in which the cursor is blinking
200 if enabled, -1 otherwise.
202 sal_Int32 GetLineNumberOfCursorInSelection() const;
205 #endif
207 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */