1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 // MyEDITVIEW, wegen exportiertem EditView 24 #ifndef _MyEDITVIEW_HXX 25 #define _MyEDITVIEW_HXX 26 27 #include <com/sun/star/i18n/WordType.hpp> 28 29 #include <rsc/rscsfx.hxx> 30 #include <i18npool/lang.h> 31 #include <tools/color.hxx> 32 #include <tools/gen.hxx> 33 34 class EditEngine; 35 class ImpEditEngine; 36 class ImpEditView; 37 class SvxSearchItem; 38 class SvxFieldItem; 39 class Window; 40 class Pointer; 41 class Cursor; 42 class KeyEvent; 43 class MouseEvent; 44 class DropEvent; 45 class CommandEvent; 46 class Rectangle; 47 class Link; 48 class Pair; 49 class Point; 50 class Range; 51 class SvStream; 52 class SvKeyValueIterator; 53 class SfxStyleSheet; 54 class Font; 55 class FontList; 56 class OutputDevice; 57 58 #ifndef _EDITDATA_HXX 59 #include <editeng/editdata.hxx> 60 #endif 61 #include <com/sun/star/uno/Reference.h> 62 #include "editeng/editengdllapi.h" 63 64 namespace com { 65 namespace sun { 66 namespace star { 67 namespace datatransfer { 68 class XTransferable; 69 }}}} 70 71 class EDITENG_DLLPUBLIC EditView 72 { 73 friend class EditEngine; 74 friend class ImpEditEngine; 75 friend class EditSelFunctionSet; 76 77 public: // brauche ich fuer Undo 78 ImpEditView* GetImpEditView() const { return pImpEditView; } 79 ImpEditEngine* GetImpEditEngine() const; 80 81 private: 82 ImpEditView* pImpEditView; 83 84 EDITENG_DLLPRIVATE EditView( const EditView& ); 85 EDITENG_DLLPRIVATE EditView& operator=( const EditView& ); 86 87 public: 88 EditView( EditEngine* pEng, Window* pWindow ); 89 virtual ~EditView(); 90 91 void SetEditEngine( EditEngine* pEditEngine ); 92 EditEngine* GetEditEngine() const; 93 94 void SetWindow( Window* pWin ); 95 Window* GetWindow() const; 96 97 void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 ); 98 void Invalidate(); 99 Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG ); 100 101 void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True ); 102 void HideCursor(); 103 104 EESelectionMode GetSelectionMode() const; 105 void SetSelectionMode( EESelectionMode eMode ); 106 107 void SetReadOnly( sal_Bool bReadOnly ); 108 sal_Bool IsReadOnly() const; 109 110 sal_Bool HasSelection() const; 111 ESelection GetSelection() const; 112 void SetSelection( const ESelection& rNewSel ); 113 sal_Bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); 114 115 void IndentBlock(); 116 void UnindentBlock(); 117 118 sal_Bool IsInsertMode() const; 119 void SetInsertMode( sal_Bool bInsert ); 120 121 void ReplaceSelected( const String& rStr ); 122 String GetSelected(); 123 void DeleteSelected(); 124 125 sal_uInt16 GetSelectedScriptType() const; 126 127 // Position der VisArea im Ausgabefenster. 128 // Eine Groessenaenderung betrifft auch die VisArea 129 void SetOutputArea( const Rectangle& rRec ); 130 const Rectangle& GetOutputArea() const; 131 132 // Dokumentposition. 133 // Eine Groessenaenderung betrifft auch die VisArea 134 void SetVisArea( const Rectangle& rRec ); 135 const Rectangle& GetVisArea() const; 136 137 void SetPointer( const Pointer& rPointer ); 138 const Pointer& GetPointer() const; 139 140 void SetCursor( const Cursor& rCursor ); 141 Cursor* GetCursor() const; 142 143 void InsertText( const String& rNew, sal_Bool bSelect = sal_False ); 144 145 sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent ); 146 147 sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent ); 148 sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent ); 149 sal_Bool MouseMove( const MouseEvent& rMouseEvent ); 150 void Command( const CommandEvent& rCEvt ); 151 152 sal_Bool Drop( const DropEvent& rEvt ); 153 sal_Bool QueryDrop( DropEvent& rEvt ); 154 ESelection GetDropPos(); 155 156 void Cut(); 157 void Copy(); 158 void Paste(); 159 void PasteSpecial(); 160 161 void EnablePaste( sal_Bool bEnable ); 162 sal_Bool IsPasteEnabled() const; 163 164 void Undo(); 165 void Redo(); 166 167 // speziell fuer Olli 168 sal_uInt16 GetParagraph( const Point& rMousePosPixel ); 169 Point GetWindowPosTopLeft( sal_uInt16 nParagraph ); 170 void MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos ); 171 void MoveParagraphs( long nDiff ); 172 173 const SfxItemSet& GetEmptyItemSet(); 174 SfxItemSet GetAttribs(); 175 void SetAttribs( const SfxItemSet& rSet ); 176 void SetParaAttribs( const SfxItemSet& rSet, sal_uInt16 nPara ); 177 void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0 ); 178 void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 ); 179 void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs = sal_False ); 180 181 sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); 182 sal_uLong Write( SvStream& rOutput, EETextFormat eFormat ); 183 184 void SetBackgroundColor( const Color& rColor ); 185 Color GetBackgroundColor() const; 186 187 void SetControlWord( sal_uInt32 nWord ); 188 sal_uInt32 GetControlWord() const; 189 190 EditTextObject* CreateTextObject(); 191 void InsertText( const EditTextObject& rTextObject ); 192 void InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial ); 193 194 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable(); 195 196 // An EditView, damit bei sal_True flackerfreies Update: 197 void SetEditEngineUpdateMode( sal_Bool bUpdate ); 198 void ForceUpdate(); 199 200 SfxStyleSheet* GetStyleSheet() const; 201 void SetStyleSheet( SfxStyleSheet* pStyle ); 202 203 void SetAnchorMode( EVAnchorMode eMode ); 204 EVAnchorMode GetAnchorMode() const; 205 206 sal_Bool MatchGroup(); 207 208 void CompleteAutoCorrect(); 209 210 EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False ); 211 EESpellState StartThesaurus(); 212 sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); 213 214 // for text conversion 215 void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ); 216 sal_Bool HasConvertibleTextPortion( LanguageType nLang ); 217 218 void TransliterateText( sal_Int32 nTransliterationMode ); 219 220 sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False ); 221 sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False ); 222 sal_Bool IsShapeParaFocusable( ) ; 223 sal_Bool WrongSpelledBreakPara(sal_Int32 nPara,sal_uInt16& nStartIndex, sal_uInt16& nEndIndex,sal_Int32 nIndex); 224 void SpellIgnoreWord(); 225 void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 ); 226 227 void InsertField( const SvxFieldItem& rFld ); 228 const SvxFieldItem* GetFieldUnderMousePointer() const; 229 const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const; 230 const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pnPara = NULL, xub_StrLen* pnPos = NULL ) const; 231 232 const SvxFieldItem* GetFieldAtSelection() const; 233 234 String GetWordUnderMousePointer() const; 235 String GetWordUnderMousePointer( Rectangle& rWordRect ) const; 236 237 void SetInvalidateMore( sal_uInt16 nPixel ); 238 sal_uInt16 GetInvalidateMore() const; 239 240 // grows or shrinks the font height for the current selection 241 void ChangeFontSize( bool bGrow, const FontList* pList ); 242 243 static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList ); 244 245 String GetSurroundingText() const; 246 Selection GetSurroundingTextSelection() const; 247 }; 248 249 #endif // _MyEDITVIEW_HXX 250