14c5491eaSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 34c5491eaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 44c5491eaSAndrew Rist * or more contributor license agreements. See the NOTICE file 54c5491eaSAndrew Rist * distributed with this work for additional information 64c5491eaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 74c5491eaSAndrew Rist * to you under the Apache License, Version 2.0 (the 84c5491eaSAndrew Rist * "License"); you may not use this file except in compliance 94c5491eaSAndrew Rist * with the License. You may obtain a copy of the License at 104c5491eaSAndrew Rist * 114c5491eaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 124c5491eaSAndrew Rist * 134c5491eaSAndrew Rist * Unless required by applicable law or agreed to in writing, 144c5491eaSAndrew Rist * software distributed under the License is distributed on an 154c5491eaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 164c5491eaSAndrew Rist * KIND, either express or implied. See the License for the 174c5491eaSAndrew Rist * specific language governing permissions and limitations 184c5491eaSAndrew Rist * under the License. 194c5491eaSAndrew Rist * 204c5491eaSAndrew Rist *************************************************************/ 214c5491eaSAndrew Rist 224c5491eaSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SVX_UNOEDSRC_HXX 25cdf0e10cSrcweir #define _SVX_UNOEDSRC_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/accessibility/TextSegment.hpp> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <tools/solar.h> 30cdf0e10cSrcweir #include <i18npool/lang.h> 31cdf0e10cSrcweir #include <tools/link.hxx> 32cdf0e10cSrcweir #include <tools/gen.hxx> 33cdf0e10cSrcweir #include <vcl/mapmod.hxx> 34cdf0e10cSrcweir #include <tools/string.hxx> 35cdf0e10cSrcweir #ifndef _SV_COLOR_HXX //autogen 36cdf0e10cSrcweir #include <tools/color.hxx> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #include <svl/poolitem.hxx> 39cdf0e10cSrcweir #include <svl/itempool.hxx> 40cdf0e10cSrcweir #include "editeng/editengdllapi.h" 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <list> 43cdf0e10cSrcweir 44cdf0e10cSrcweir struct ESelection; 45cdf0e10cSrcweir struct EFieldInfo; 46cdf0e10cSrcweir struct EBulletInfo; 47cdf0e10cSrcweir class OutputDevice; 48cdf0e10cSrcweir class String; 49cdf0e10cSrcweir class SfxItemSet; 50cdf0e10cSrcweir class SvUShorts; 51cdf0e10cSrcweir class SvxTextForwarder; 52cdf0e10cSrcweir class SvxViewForwarder; 53cdf0e10cSrcweir class SvxEditViewForwarder; 54cdf0e10cSrcweir class SvxFieldItem; 55cdf0e10cSrcweir class SfxBroadcaster; 56cdf0e10cSrcweir class EECharAttribArray; 57cdf0e10cSrcweir class SvxUnoTextRangeBase; 58cdf0e10cSrcweir 59cdf0e10cSrcweir typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList; 60cdf0e10cSrcweir 61cdf0e10cSrcweir /** Wrapper class for unified EditEngine/Outliner access 62cdf0e10cSrcweir 63cdf0e10cSrcweir This class wraps a textual object, which might or might not 64cdf0e10cSrcweir contain an EditEngine/Outliner. Is used e.g. for filling an 65cdf0e10cSrcweir EditEngine with the content of a cell, note page or page template. 66cdf0e10cSrcweir */ 67cdf0e10cSrcweir class EDITENG_DLLPUBLIC SvxEditSource 68cdf0e10cSrcweir { 69cdf0e10cSrcweir public: 70cdf0e10cSrcweir virtual ~SvxEditSource(); 71cdf0e10cSrcweir 72cdf0e10cSrcweir /// Returns a new reference to the same object. This is a shallow copy 73cdf0e10cSrcweir virtual SvxEditSource* Clone() const = 0; 74cdf0e10cSrcweir 75cdf0e10cSrcweir /** Query the text forwarder 76cdf0e10cSrcweir 77cdf0e10cSrcweir @return the text forwarder, or NULL if the underlying object is dead 78cdf0e10cSrcweir */ 79cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder() = 0; 80cdf0e10cSrcweir 81cdf0e10cSrcweir /** Query the view forwarder 82cdf0e10cSrcweir 83cdf0e10cSrcweir @return the view forwarder, or NULL if the underlying object 84cdf0e10cSrcweir is dead, or if no view is available 85cdf0e10cSrcweir 86cdf0e10cSrcweir @derive default implementation provided, overriding is optional 87cdf0e10cSrcweir */ 88cdf0e10cSrcweir virtual SvxViewForwarder* GetViewForwarder(); 89cdf0e10cSrcweir 90cdf0e10cSrcweir /** Query the edit view forwarder 91cdf0e10cSrcweir 92cdf0e10cSrcweir @param bCreate 93cdf0e10cSrcweir Determines whether an EditView should be created, if there is 94cdf0e10cSrcweir none active. If set to sal_True, and the underlying object is 95cdf0e10cSrcweir not in EditMode, the text forwarder changes and the object is 96cdf0e10cSrcweir set to EditMode. 97cdf0e10cSrcweir 98cdf0e10cSrcweir @return the edit view forwarder, or NULL if the underlying 99cdf0e10cSrcweir object is dead, or if no view is available (if bCreate is 100cdf0e10cSrcweir sal_False, NULL is also returned if the object is not in 101cdf0e10cSrcweir EditMode) 102cdf0e10cSrcweir 103cdf0e10cSrcweir @derive default implementation provided, overriding is optional 104cdf0e10cSrcweir 105cdf0e10cSrcweir @attention If this method is called with bCreate equal to 106cdf0e10cSrcweir sal_True, all previously returned text forwarder can become 107cdf0e10cSrcweir invalid 108cdf0e10cSrcweir */ 109cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir /// Write back data to model 112cdf0e10cSrcweir virtual void UpdateData() = 0; 113cdf0e10cSrcweir 114cdf0e10cSrcweir /** Returns broadcaster the underlying edit engine's events are sent from 115cdf0e10cSrcweir 116cdf0e10cSrcweir @derive default implementation provided, overriding is optional 117cdf0e10cSrcweir */ 118cdf0e10cSrcweir virtual SfxBroadcaster& GetBroadcaster() const; 119cdf0e10cSrcweir 120cdf0e10cSrcweir /** adds the given SvxUnoTextRangeBase to the text object 121cdf0e10cSrcweir capsulated by this SvxEditSource. This allows the text 122cdf0e10cSrcweir object to inform all created text ranges about changes 123cdf0e10cSrcweir and also allows to re use already created instances. 124cdf0e10cSrcweir All SvxUnoTextRangeBase must remove itself with 125cdf0e10cSrcweir removeRange() before theire deleted. */ 126cdf0e10cSrcweir virtual void addRange( SvxUnoTextRangeBase* pNewRange ); 127cdf0e10cSrcweir 128cdf0e10cSrcweir /** removes the given SvxUnoTextRangeBase from the text 129cdf0e10cSrcweir object capsulated by this SvxEditSource. This text range 130cdf0e10cSrcweir will not be informed any longer of changes on the underlying 131cdf0e10cSrcweir text and will also not re used anymore. */ 132cdf0e10cSrcweir virtual void removeRange( SvxUnoTextRangeBase* pOldRange ); 133cdf0e10cSrcweir 134cdf0e10cSrcweir /** returns a const list of all text ranges that are registered 135cdf0e10cSrcweir for the underlying text object. */ 136cdf0e10cSrcweir virtual const SvxUnoTextRangeBaseList& getRanges() const; 137cdf0e10cSrcweir }; 138cdf0e10cSrcweir 139cdf0e10cSrcweir 140cdf0e10cSrcweir /** Contains an EditEngine or an Outliner and unifies access to them. 141cdf0e10cSrcweir 142cdf0e10cSrcweir The EditEngine-UNO objects use this class only. To reflect changes 143cdf0e10cSrcweir not only in the EditEngine, but also in the model data, call 144cdf0e10cSrcweir SvxEditSource::UpdateData(). This copies back the data to the model's 145cdf0e10cSrcweir EditTextObject/OutlinerParaObject. 146cdf0e10cSrcweir */ 147cdf0e10cSrcweir class EDITENG_DLLPUBLIC SvxTextForwarder 148cdf0e10cSrcweir { 149cdf0e10cSrcweir public: 150cdf0e10cSrcweir virtual ~SvxTextForwarder(); 151cdf0e10cSrcweir 152cdf0e10cSrcweir virtual sal_uInt16 GetParagraphCount() const = 0; 153cdf0e10cSrcweir virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const = 0; 154cdf0e10cSrcweir virtual String GetText( const ESelection& rSel ) const = 0; 155cdf0e10cSrcweir virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const = 0; 156cdf0e10cSrcweir virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const = 0; 157cdf0e10cSrcweir virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) = 0; 158cdf0e10cSrcweir virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) = 0; 159cdf0e10cSrcweir virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const = 0; 160cdf0e10cSrcweir 161cdf0e10cSrcweir virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0; 162cdf0e10cSrcweir virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const = 0; 163cdf0e10cSrcweir 164cdf0e10cSrcweir virtual void QuickInsertText( const String& rText, const ESelection& rSel ) = 0; 165cdf0e10cSrcweir virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) = 0; 166cdf0e10cSrcweir virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0; 167cdf0e10cSrcweir virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0; 168cdf0e10cSrcweir 169cdf0e10cSrcweir virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0; 170cdf0e10cSrcweir virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ) = 0; 171cdf0e10cSrcweir 172cdf0e10cSrcweir virtual SfxItemPool* GetPool() const = 0; 173cdf0e10cSrcweir 174cdf0e10cSrcweir virtual const SfxItemSet* GetEmptyItemSetPtr() = 0; 175cdf0e10cSrcweir 176cdf0e10cSrcweir // implementation functions for XParagraphAppend and XTextPortionAppend 177cdf0e10cSrcweir virtual void AppendParagraph() = 0; 178cdf0e10cSrcweir virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ) = 0; 179cdf0e10cSrcweir 180cdf0e10cSrcweir // XTextCopy 181cdf0e10cSrcweir virtual void CopyText(const SvxTextForwarder& rSource) = 0; 182cdf0e10cSrcweir 183cdf0e10cSrcweir /** Query state of forwarder 184cdf0e10cSrcweir 185cdf0e10cSrcweir @return sal_False, if no longer valid 186cdf0e10cSrcweir */ 187cdf0e10cSrcweir virtual sal_Bool IsValid() const = 0; 188cdf0e10cSrcweir 189cdf0e10cSrcweir /** Query language of character at given position on the underlying edit engine 190cdf0e10cSrcweir 191cdf0e10cSrcweir @param nPara[0 .. n-1] 192cdf0e10cSrcweir Index of paragraph to query language in 193cdf0e10cSrcweir 194cdf0e10cSrcweir @param nIndex[0 .. m-1] 195cdf0e10cSrcweir Index of character to query language of 196cdf0e10cSrcweir */ 197cdf0e10cSrcweir virtual LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; 198cdf0e10cSrcweir 199cdf0e10cSrcweir /** Query number of fields in the underlying edit engine 200cdf0e10cSrcweir 201cdf0e10cSrcweir @param nPara[0 .. n-1] 202cdf0e10cSrcweir Index of paragraph to query field number in 203cdf0e10cSrcweir */ 204cdf0e10cSrcweir virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const = 0; 205cdf0e10cSrcweir 206cdf0e10cSrcweir /** Query information for given field number in the underlying edit engine 207cdf0e10cSrcweir 208cdf0e10cSrcweir @param nPara[0 .. n-1] 209cdf0e10cSrcweir Index of paragraph to query field info in 210cdf0e10cSrcweir 211cdf0e10cSrcweir @param nField[0 .. m-1] 212cdf0e10cSrcweir Index of field to query information of 213cdf0e10cSrcweir */ 214cdf0e10cSrcweir virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const = 0; 215cdf0e10cSrcweir 216cdf0e10cSrcweir /** Query information regarding bullets for given paragraph on the underlying edit engine 217cdf0e10cSrcweir 218cdf0e10cSrcweir @param nPara[0 .. n-1] 219cdf0e10cSrcweir Index of paragraph to query bullet info on 220cdf0e10cSrcweir */ 221cdf0e10cSrcweir virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const = 0; GetNumStr(sal_uInt16) const222*9b8096d0SSteve Yin virtual String GetNumStr(sal_uInt16) const { return XubString();}; 223*9b8096d0SSteve Yin //IAccessible2 migration fix SetUpdateModeForAcc(sal_Bool)224*9b8096d0SSteve Yin virtual void SetUpdateModeForAcc( sal_Bool ) {}; GetUpdateModeForAcc() const225*9b8096d0SSteve Yin virtual sal_Bool GetUpdateModeForAcc() const { return sal_True; }; 226cdf0e10cSrcweir /** Query the bounding rectangle of the given character 227cdf0e10cSrcweir 228cdf0e10cSrcweir @param nPara[0 .. n] 229cdf0e10cSrcweir Index of paragraph to query the bounds in. <p>The virtual 230cdf0e10cSrcweir character after the last character of the represented text, 231cdf0e10cSrcweir i.e. the one at position n is a special case. Because it does 232cdf0e10cSrcweir not represent an existing character its bounding box is 233cdf0e10cSrcweir defined in relation to preceding characters. It should be 234cdf0e10cSrcweir rougly equivalent to the bounding box of some character when 235cdf0e10cSrcweir inserted at the end of the text. Its height typically being 236cdf0e10cSrcweir the maximal height of all the characters in the text or the 237cdf0e10cSrcweir height of the preceding character, its width being at least 238cdf0e10cSrcweir one pixel so that the bounding box is not degenerate.<br> 239cdf0e10cSrcweir 240cdf0e10cSrcweir @param nIndex[0 .. m-1] 241cdf0e10cSrcweir Index of character to query the bounds of 242cdf0e10cSrcweir 243cdf0e10cSrcweir @return rectangle in logical coordinates, relative to upper 244cdf0e10cSrcweir left corner of text. The coordinates returned here are to be 245cdf0e10cSrcweir interpreted in the map mode given by GetMapMode(). 246cdf0e10cSrcweir */ 247cdf0e10cSrcweir virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; 248cdf0e10cSrcweir 249cdf0e10cSrcweir /** Query the bounding rectangle of the given paragraph 250cdf0e10cSrcweir 251cdf0e10cSrcweir @param nPara[0 .. n-1] 252cdf0e10cSrcweir Index of paragraph to query the bounds of 253cdf0e10cSrcweir 254cdf0e10cSrcweir @return rectangle in logical coordinates, relative to upper 255cdf0e10cSrcweir left corner of text. The coordinates returned here are to be 256cdf0e10cSrcweir interpreted in the map mode given by GetMapMode(). 257cdf0e10cSrcweir */ 258cdf0e10cSrcweir virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const = 0; 259cdf0e10cSrcweir 260cdf0e10cSrcweir /** Query the map mode of the underlying EditEngine/Outliner 261cdf0e10cSrcweir 262cdf0e10cSrcweir @return the map mode used on the EditEngine/Outliner. The 263cdf0e10cSrcweir values returned by GetParaBounds() and GetCharBounds() are to 264cdf0e10cSrcweir be interpreted in this map mode, the point given to 265cdf0e10cSrcweir GetIndexAtPoint() is interpreted in this map mode. 266cdf0e10cSrcweir */ 267cdf0e10cSrcweir virtual MapMode GetMapMode() const = 0; 268cdf0e10cSrcweir 269cdf0e10cSrcweir /** Query the reference output device of the underlying EditEngine/Outliner 270cdf0e10cSrcweir 271cdf0e10cSrcweir @return the OutputDevice used from the EditEngine/Outliner to 272cdf0e10cSrcweir format the text. It should be used when performing e.g. font 273cdf0e10cSrcweir calculations, since this is usually a printer with fonts and 274cdf0e10cSrcweir resolution different from the screen. 275cdf0e10cSrcweir */ 276cdf0e10cSrcweir virtual OutputDevice* GetRefDevice() const = 0; 277cdf0e10cSrcweir 278cdf0e10cSrcweir /** Query paragraph and character index of the character at the 279cdf0e10cSrcweir given point. Returns sal_True on success, sal_False otherwise 280cdf0e10cSrcweir 281cdf0e10cSrcweir @param rPoint 282cdf0e10cSrcweir Point to query text position of. Is interpreted in logical 283cdf0e10cSrcweir coordinates, relativ to the upper left corner of the text, and 284cdf0e10cSrcweir in the map mode given by GetMapMode() 285cdf0e10cSrcweir 286cdf0e10cSrcweir @param rPara[0 .. n-1] 287cdf0e10cSrcweir Index of paragraph the point is within 288cdf0e10cSrcweir 289cdf0e10cSrcweir @param rIndex[0 .. m-1] 290cdf0e10cSrcweir Index of character the point is over 291cdf0e10cSrcweir 292cdf0e10cSrcweir @return sal_True, if the point is over any text and both rPara and rIndex are valid 293cdf0e10cSrcweir 294cdf0e10cSrcweir */ 295cdf0e10cSrcweir virtual sal_Bool GetIndexAtPoint( const Point& rPoint, sal_uInt16& rPara, sal_uInt16& rIndex ) const = 0; 296cdf0e10cSrcweir 297cdf0e10cSrcweir /** Get the start and the end index of the word at the given index 298cdf0e10cSrcweir 299cdf0e10cSrcweir An index value on a word leads from the first character of 300cdf0e10cSrcweir that word up to and including the last space before the next 301cdf0e10cSrcweir word. The index values returned do not contain any leading or 302cdf0e10cSrcweir trailing white-space. If the input indices are invalid, 303cdf0e10cSrcweir sal_False is returned. 304cdf0e10cSrcweir 305cdf0e10cSrcweir @param nPara[0 .. n-1] 306cdf0e10cSrcweir Index of paragraph to start the search in 307cdf0e10cSrcweir 308cdf0e10cSrcweir @param nIndex[0 .. m-1] 309cdf0e10cSrcweir Index of character to query the search on 310cdf0e10cSrcweir 311cdf0e10cSrcweir @param rStart 312cdf0e10cSrcweir Start index (in the same paragraph) 313cdf0e10cSrcweir 314cdf0e10cSrcweir @param rEnd 315cdf0e10cSrcweir End index (in the same paragraph), this point to the last 316cdf0e10cSrcweir character still contained in the query 317cdf0e10cSrcweir 318cdf0e10cSrcweir @return sal_True, if the result is non-empty 319cdf0e10cSrcweir */ 320cdf0e10cSrcweir virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& rStart, sal_uInt16& rEnd ) const = 0; 321cdf0e10cSrcweir 322cdf0e10cSrcweir /** Query range of similar attributes 323cdf0e10cSrcweir 324cdf0e10cSrcweir Please note that the range returned is half-open: [nStartIndex,nEndIndex) 325cdf0e10cSrcweir 326cdf0e10cSrcweir @param nStartIndex 327cdf0e10cSrcweir Herein, the start index of the range of similar attributes is returned 328cdf0e10cSrcweir 329cdf0e10cSrcweir @param nEndIndex 330cdf0e10cSrcweir Herein, the end index (exclusive) of the range of similar attributes is returned 331cdf0e10cSrcweir 332cdf0e10cSrcweir @param nIndex 333cdf0e10cSrcweir The character index from which the range of similar attributed characters is requested 334cdf0e10cSrcweir 335cdf0e10cSrcweir @return sal_True, if the range has been successfully determined 336cdf0e10cSrcweir */ 337*9b8096d0SSteve Yin // virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; 338*9b8096d0SSteve Yin virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell = sal_False ) const = 0; 339cdf0e10cSrcweir 340cdf0e10cSrcweir /** Query number of lines in the formatted paragraph 341cdf0e10cSrcweir 342cdf0e10cSrcweir @param nPara[0 .. n-1] 343cdf0e10cSrcweir Index of paragraph to query number of lines in 344cdf0e10cSrcweir 345cdf0e10cSrcweir @return number of lines in given paragraph 346cdf0e10cSrcweir 347cdf0e10cSrcweir */ 348cdf0e10cSrcweir virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const = 0; 349cdf0e10cSrcweir 350cdf0e10cSrcweir /** Query line length 351cdf0e10cSrcweir 352cdf0e10cSrcweir @param nPara[0 .. n-1] 353cdf0e10cSrcweir Index of paragraph to query line length in 354cdf0e10cSrcweir 355cdf0e10cSrcweir @param nLine[0 .. m-1] 356cdf0e10cSrcweir Index of line in paragraph to query line length of 357cdf0e10cSrcweir 358cdf0e10cSrcweir */ 359cdf0e10cSrcweir virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const = 0; 360cdf0e10cSrcweir 361cdf0e10cSrcweir /** Query bounds of line in paragraph 362cdf0e10cSrcweir 363cdf0e10cSrcweir @param rStart [output param; 0 .. text_len] 364cdf0e10cSrcweir The index in the paragraph text that belongs to the chara at the start of the line 365cdf0e10cSrcweir 366cdf0e10cSrcweir @param rEnd [output param; 0 .. text_len] 367cdf0e10cSrcweir The index in the paragraph text that follows the last chara in the line 368cdf0e10cSrcweir 369cdf0e10cSrcweir @param nParagraph[0 .. n-1] 370cdf0e10cSrcweir Index of paragraph to query line length in 371cdf0e10cSrcweir 372cdf0e10cSrcweir @param nLine[0 .. m-1] 373cdf0e10cSrcweir Index of line in paragraph to query line length of 374cdf0e10cSrcweir 375cdf0e10cSrcweir */ 376cdf0e10cSrcweir virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const = 0; 377cdf0e10cSrcweir 378cdf0e10cSrcweir /** Query the line number for a index in the paragraphs text 379cdf0e10cSrcweir 380cdf0e10cSrcweir @param nPara[0 .. n-1] 381cdf0e10cSrcweir Index of paragraph to query line length in 382cdf0e10cSrcweir 383cdf0e10cSrcweir @param nIndex[0 .. m-1] 384cdf0e10cSrcweir Index of of the chara in the paragraph text 385cdf0e10cSrcweir 386cdf0e10cSrcweir @returns [0 .. k-1] 387cdf0e10cSrcweir The line number of the chara in the paragraph 388cdf0e10cSrcweir */ 389cdf0e10cSrcweir virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; 390cdf0e10cSrcweir 391cdf0e10cSrcweir /** Delete given text range and reformat text 392cdf0e10cSrcweir 393cdf0e10cSrcweir @param rSelection 394cdf0e10cSrcweir The text range to be deleted 395cdf0e10cSrcweir 396cdf0e10cSrcweir @return sal_True if text has been successfully deleted 397cdf0e10cSrcweir */ 398cdf0e10cSrcweir virtual sal_Bool Delete( const ESelection& rSelection ) = 0; 399cdf0e10cSrcweir 400cdf0e10cSrcweir /** Insert/Replace given text in given range and reformat text 401cdf0e10cSrcweir 402cdf0e10cSrcweir @param rText 403cdf0e10cSrcweir Text to insert/replace 404cdf0e10cSrcweir 405cdf0e10cSrcweir @param rSel 406cdf0e10cSrcweir Selection where text should be replaced. The empty selection inserts 407cdf0e10cSrcweir 408cdf0e10cSrcweir @return sal_True if text has been successfully inserted 409cdf0e10cSrcweir */ 410cdf0e10cSrcweir virtual sal_Bool InsertText( const String& rText, const ESelection& rSel ) = 0; 411cdf0e10cSrcweir 412cdf0e10cSrcweir /** Updates the formatting 413cdf0e10cSrcweir 414cdf0e10cSrcweir @see EditEngine::QuickFormatDoc() for details 415cdf0e10cSrcweir 416cdf0e10cSrcweir @return sal_True if text have been successfully reformatted 417cdf0e10cSrcweir */ 418cdf0e10cSrcweir virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ) = 0; 419cdf0e10cSrcweir 420cdf0e10cSrcweir /** Get the outline depth of given paragraph 421cdf0e10cSrcweir 422cdf0e10cSrcweir @param nPara 423cdf0e10cSrcweir Index of the paragraph to query the depth of 424cdf0e10cSrcweir 425cdf0e10cSrcweir @return the outline level of the given paragraph. The range is 426cdf0e10cSrcweir [0,n), where n is the maximal outline level. 427cdf0e10cSrcweir */ 428cdf0e10cSrcweir virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const = 0; 429cdf0e10cSrcweir 430cdf0e10cSrcweir /** Set the outline depth of given paragraph 431cdf0e10cSrcweir 432cdf0e10cSrcweir @param nPara 433cdf0e10cSrcweir Index of the paragraph to set the depth of 434cdf0e10cSrcweir 435cdf0e10cSrcweir @param nNewDepth 436cdf0e10cSrcweir The depth to set on the given paragraph. The range is 437cdf0e10cSrcweir [0,n), where n is the maximal outline level. 438cdf0e10cSrcweir 439cdf0e10cSrcweir @return sal_True, if depth could be successfully set. Reasons for 440cdf0e10cSrcweir failure are e.g. the text does not support outline level 441cdf0e10cSrcweir (EditEngine), or the depth range is exceeded. 442cdf0e10cSrcweir */ 443cdf0e10cSrcweir virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ) = 0; 444cdf0e10cSrcweir 445cdf0e10cSrcweir virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara ); 446cdf0e10cSrcweir virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue ); 447cdf0e10cSrcweir 448cdf0e10cSrcweir virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara ); 449cdf0e10cSrcweir virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart ); 450cdf0e10cSrcweir }; 451cdf0e10cSrcweir 452cdf0e10cSrcweir /** Encapsulates the document view for the purpose of unified 453cdf0e10cSrcweir EditEngine/Outliner access. 454cdf0e10cSrcweir 455cdf0e10cSrcweir This one has to be different from the SvxEditViewForwarder, since 456cdf0e10cSrcweir the latter is only valid in edit mode. 457cdf0e10cSrcweir */ 458cdf0e10cSrcweir class EDITENG_DLLPUBLIC SvxViewForwarder 459cdf0e10cSrcweir { 460cdf0e10cSrcweir public: 461cdf0e10cSrcweir virtual ~SvxViewForwarder(); 462cdf0e10cSrcweir 463cdf0e10cSrcweir /** Query state of forwarder 464cdf0e10cSrcweir 465cdf0e10cSrcweir @return sal_False, if no longer valid 466cdf0e10cSrcweir */ 467cdf0e10cSrcweir virtual sal_Bool IsValid() const = 0; 468cdf0e10cSrcweir 469cdf0e10cSrcweir /** Query visible area of the view containing the text 470cdf0e10cSrcweir 471cdf0e10cSrcweir @return the visible rectangle of the text, i.e. the part of 472cdf0e10cSrcweir the EditEngine or Outliner that is currently on screen. The 473cdf0e10cSrcweir values are already in screen coordinates (pixel), and have to 474cdf0e10cSrcweir be relative to the EditEngine/Outliner's upper left corner. 475cdf0e10cSrcweir */ 476cdf0e10cSrcweir virtual Rectangle GetVisArea() const = 0; 477cdf0e10cSrcweir 478cdf0e10cSrcweir /** Convert from logical, EditEngine-relative coordinates to screen coordinates 479cdf0e10cSrcweir 480cdf0e10cSrcweir @param rPoint 481cdf0e10cSrcweir Point in logical, EditEngine-relative coordinates. 482cdf0e10cSrcweir 483cdf0e10cSrcweir @param rMapMode 484cdf0e10cSrcweir The map mode to interpret the coordinates in. 485cdf0e10cSrcweir 486cdf0e10cSrcweir @return the point in screen coordinates 487cdf0e10cSrcweir */ 488cdf0e10cSrcweir virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const = 0; 489cdf0e10cSrcweir 490cdf0e10cSrcweir /** Convert from screen to logical, EditEngine-relative coordinates 491cdf0e10cSrcweir 492cdf0e10cSrcweir @param rPoint 493cdf0e10cSrcweir Point in screen coordinates 494cdf0e10cSrcweir 495cdf0e10cSrcweir @param rMapMode 496cdf0e10cSrcweir The map mode to interpret the coordinates in. 497cdf0e10cSrcweir 498cdf0e10cSrcweir @return the point in logical coordinates. 499cdf0e10cSrcweir */ 500cdf0e10cSrcweir virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const = 0; 501cdf0e10cSrcweir 502cdf0e10cSrcweir }; 503cdf0e10cSrcweir 504cdf0e10cSrcweir 505cdf0e10cSrcweir /** Encapsulates EditView and OutlinerView for the purpose of unified 506cdf0e10cSrcweir EditEngine/Outliner access 507cdf0e10cSrcweir */ 508cdf0e10cSrcweir class SvxEditViewForwarder : public SvxViewForwarder 509cdf0e10cSrcweir { 510cdf0e10cSrcweir public: 511cdf0e10cSrcweir 512cdf0e10cSrcweir /** Query current selection. 513cdf0e10cSrcweir 514cdf0e10cSrcweir @param rSelection 515cdf0e10cSrcweir Contains the current selection after method call 516cdf0e10cSrcweir 517cdf0e10cSrcweir @return sal_False, if there is no view or no selection (the empty selection _is_ a selection) 518cdf0e10cSrcweir 519cdf0e10cSrcweir */ 520cdf0e10cSrcweir virtual sal_Bool GetSelection( ESelection& rSelection ) const = 0; 521cdf0e10cSrcweir 522cdf0e10cSrcweir /** Set selection in view. 523cdf0e10cSrcweir 524cdf0e10cSrcweir @param rSelection 525cdf0e10cSrcweir The selection to set 526cdf0e10cSrcweir 527cdf0e10cSrcweir @return sal_False, if there is no view or selection is invalid 528cdf0e10cSrcweir */ 529cdf0e10cSrcweir virtual sal_Bool SetSelection( const ESelection& rSelection ) = 0; 530cdf0e10cSrcweir 531cdf0e10cSrcweir /** Copy current selection to clipboard. 532cdf0e10cSrcweir 533cdf0e10cSrcweir @return sal_False if no selection or no view (the empty selection _is_ a selection) 534cdf0e10cSrcweir */ 535cdf0e10cSrcweir virtual sal_Bool Copy() = 0; 536cdf0e10cSrcweir 537cdf0e10cSrcweir /** Cut current selection to clipboard. 538cdf0e10cSrcweir 539cdf0e10cSrcweir @eturn sal_False if no selection or no view (the empty selection _is_ a selection) 540cdf0e10cSrcweir */ 541cdf0e10cSrcweir virtual sal_Bool Cut() = 0; 542cdf0e10cSrcweir 543cdf0e10cSrcweir /** Paste clipboard into current selection. 544cdf0e10cSrcweir 545cdf0e10cSrcweir @return sal_False if no view or no selection (the empty selection _is_ a selection) 546cdf0e10cSrcweir */ 547cdf0e10cSrcweir virtual sal_Bool Paste() = 0; 548cdf0e10cSrcweir IsWrongSpelledWordAtPos(sal_Int32,sal_Int32)549*9b8096d0SSteve Yin virtual sal_Bool IsWrongSpelledWordAtPos( sal_Int32, sal_Int32 ) { return sal_False; }; IsShapeParaFocusable()550*9b8096d0SSteve Yin virtual sal_Bool IsShapeParaFocusable( ) { return sal_True; }; BreakParaWrongList(sal_Int32,sal_uInt16 &,sal_uInt16 &,sal_Int32)551*9b8096d0SSteve Yin virtual sal_Bool BreakParaWrongList(sal_Int32, sal_uInt16&, sal_uInt16&, sal_Int32){ return sal_False; }; 552cdf0e10cSrcweir }; 553cdf0e10cSrcweir 554cdf0e10cSrcweir #endif 555cdf0e10cSrcweir 556