InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ITextLines.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Kevin Van Wiel
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __ITextLines__
25 #define __ITextLines__
26 
27 #include "IPMUnknown.h"
28 
29 #include "WritingModeUIID2.h"
30 #include "WritingModeID2.h"
31 #include "PMRect.h"
32 #include "IInterfaceColors.h"
33 #include "IFontMgr.h"
34 #include "UIDList.h"
35 #include "LineDescription.h"
36 #include "IDrawingStyle.h"
37 #include "IInCopyGalleySettingData.h"
38 #include "RangeData.h"
39 #include "K2Vector.h"
40 
41 
42 class VOS_Object;
43 class IGraphicsPort;
44 class IPMFont;
45 class IWaxLine;
46 class IFontInstance;
47 class WideString;
48 class SelectionExtension;
49 namespace InDesign { class TextRange;}
50 
52 {
53  public:
54  typedef base_type data_type;
55 
56  UIDRef storyUIDRef;
57  TextIndex startIndex;
58  int32 length;
59  PMReal composeWidth;
60 };
61 
62 
92 class ITextLines : public IPMUnknown
93 {
94  public:
95  enum { kDefaultIID = IID_ITEXTLINES };
96 
97  // ---------------- TEXTLINES GLOBAL ATTRIBUTES ------------------ //
98  enum LinesType { kLayoutLineEnds = 0, kWindowLineEnds }; // kLayoutLine ends is ALE, kWindowLineEnds is ILE
99  enum ExtendType { kDontExtend = 0, kExtendLeft, kExtendRight }; // used in some selection routines to control the highlight extension over nonprimary text runs
100 
106  virtual LinesType GetLinesType() = 0;
107 
114  virtual void SetLinesType(LinesType lType) = 0;
115 
123  virtual void UpdateFontInfo(const PMString *fontName, bool16 initializeLines) = 0;
124 
132  virtual void UpdateLeading() = 0;
133 
139  virtual PMString &GetDisplayFontName(IFontMgr::FontStyleBits styleBits = IFontMgr::kNormal) = 0;
140 
146  virtual PMReal GetDisplayFontSize(IDrawingStyle::CapitalizeMode capMode = IDrawingStyle::kCapNormal) = 0;
147 
153  virtual PMReal GetLineHeight(bool16 textOnly = kFalse) = 0;
154 
161  virtual IFontInstance *QueryDisplayFontInstance(IFontMgr::FontStyleBits styleBits, IDrawingStyle::CapitalizeMode capMode) = 0;
162 
166  virtual bool16 ComposeLayout() = 0;
167 
171  virtual void SetComposeLayout(bool16 shouldCompose) = 0;
172 
173 
174  // ---------------- LINEDESCRIPTION ACCESS ------------------ //
175 
181  virtual TextIndex GetLineStartOffsetAtLine(int32 at) = 0;
182 
188  virtual TextIndex GetLineEndOffsetAtLine(int32 at) = 0;
189 
196  virtual PMReal GetYPosition(int32 at) = 0;
197 
203  virtual PMReal GetYPosition(int32 storyIndex, int32 at) = 0;
204 
210  virtual PMReal GetXPosition(int32 at) = 0;
211 
219  virtual PMRect CalculateLineRect(int32 at) = 0;
220 
229  virtual PMRect CalculateLineRect(int32 storyIndex, int32 at) = 0;
230 
239  virtual const LineDescription GetLine(int32 at, bool16 returnRuns = kFalse) = 0;
240 
250  virtual const LineDescription GetLine(int32 storyIndex, int32 at, bool16 returnRuns) = 0;
251 
252 
253  // ---------------- LINE MAINTENANCE ------------------ //
254 
262  virtual void InitializeLines(const K2Vector<ComposeInformation> &composeInformation, bool16 forceInitialization = kFalse, bool16 scrollARangeIntoView = kFalse) = 0;
263 
270  virtual void AppendLine(const LineDescription &line, bool16 autoScroll = kTrue) = 0;
271 
279  virtual bool16 InsertLine(int32 beforeIndex, const LineDescription &line, bool16 autoScroll = kTrue) = 0;
280 
286  virtual bool16 DeleteLine(int32 at) = 0;
287 
292  virtual void DeleteAllLines() = 0;
293 
300  virtual bool16 ReplaceLine(int32 at, const LineDescription &line) = 0;
301 
313  virtual bool16 AddFrameDivider(IWaxLine *waxLine, int32 at, const PMPoint &atPosition, UID previousLineFrameUID, bool16 isFrontMost) = 0;
314 
325  virtual void AddLineFromLayoutLine(IWaxLine *waxLine, int32 at, const PMPoint &atPosition, int32 lineNumber, uint32 lineID, bool16 isFrontMost) = 0;
326 
336  virtual void RemoveExcessLines(int32 startIndex, bool16 isFrontMost, bool16 autoScroll = kTrue) = 0;
337 
347  virtual void UpdateLine(int32 at) = 0;
348 
359  virtual void UpdateLine(int32 storyIndex, int32 at) = 0;
360 
366  virtual void SetLastValidIndex(int32 index) = 0;
367 
372  virtual int32 GetLastValidIndex() = 0;
373 
379  virtual int32 GetLastValidIndex(int32 storyIndex) = 0;
380 
385  virtual int32 GetLastLineIndex() = 0;
386 
392  virtual int32 GetLastLineIndex(int32 storyIndex) = 0;
393 
398  virtual int32 GetFirstTrueTextLineIndex() = 0;
399 
405  virtual int32 GetFirstTrueTextLineIndex(int32 storyIndex) = 0;
406 
411  virtual void DeleteCacheForAllLines() = 0;
412 
419  virtual void SyncScrolling(bool16 lockRelativePosition = kFalse, bool16 scrollToASelectionRange = kFalse) = 0;
420 
421 
422  // ---------------- SEARCHING ------------------ //
429  virtual bool16 SetUniqueIDOfLine(int32 at, uint32 newID) = 0;
430 
436  virtual int32 FindIndexOfLineWithID(uint32 id) = 0;
437 
444  virtual int32 FindIndexOfLineWithID(int32 storyIndex, uint32 id) = 0;
445 
454  virtual int32 FindIndexOfLineAtTextOffset(TextIndex offset, int32 &offsetIntoLine, RangeData::Lean lean, bool16 checkRunBoundary = kFalse) = 0;
455 
463  virtual int32 FindIndexOfLineAtDisplayOffset( TextIndex offset, int32 &offsetIntoLine, RangeData::Lean lean) = 0;
464 
473  virtual int32 FindIndexOfLineAtDisplayOffset(int32 storyIndex, TextIndex offset, int32 &offsetIntoLine, RangeData::Lean lean) = 0;
474 
483  virtual void DisplayRangeToLineIndices( int32 storyIndex, const RangeData& range, int32* low, int32* high) = 0;
484 
490  virtual int32 FindIndexOfLineAtPoint( const PMPoint &point) = 0;
491 
497  virtual int32 FindIndexOfLineAtPoint(int32 storyIndex, const PMPoint &point) = 0;
498 
505  virtual PMReal GetXPositionOfDisplayOffsetCharacter( int32 atLineIndex, int32 displayOffsetIntoLine) = 0;
506 
514  virtual PMReal GetXPositionOfDisplayOffsetCharacter(int32 storyIndex, int32 atLineIndex, int32 displayOffsetIntoLine) = 0;
515 
526  virtual PMReal GetXPositionOfCharacter(int32 atLineIndex, int32 characterOffsetIntoLine, TextIndex absoluteTextOffset = -1,
527  bool16 isEndPosition = kFalse, ExtendType extend = kDontExtend, TextIndex absoluteTextEndOffset = -1) = 0;
528 
537  virtual PMReal GetXPositionOfCharacterInRun(int32 atLineIndex, int32 runIndex, int32 characterOffsetIntoRun) = 0;
538 
539 
552  virtual bool16 FindCharacterAtXPosition(int32 atLineIndex, PMReal &xPosition, int32 &offsetIntoLine) = 0;
553 
562  virtual PMReal HitTestText( int32 storyIndex, int32* lineIndex, const PMPoint &x, TextIndex *nextLine) = 0;
563 
564 
572  virtual int32 GetIndexOfFirstLineInRect(PMRect rectToFit, bool16 partialFitOK = kTrue) = 0;
573 
574  // ---------------- TEXT DISPLAY ------------------ //
575  // The following are for drawing hilite. Most likely will be moved to a separate interface.
579  virtual void SetHilite(TextIndex start, TextIndex end, bool16 drawHilite = kTrue, UID extendToDeletedUID = kInvalidUID) = 0;
580 
584  virtual void SetHilite(const RangeData& range, bool16 drawHilite = kTrue, UID extendToDeletedUID = kInvalidUID) = 0;
585 
593  virtual void GetHilite(TextIndex &start, TextIndex &end, SelectionExtension *extendToDeletedUIDs = nil) = 0;
594 
604  virtual void DrawTextHighlight( const InDesign::TextRange& newSelection, const InDesign::TextRange& oldSelection,
605  SelectionExtension *newExtension = nil, SelectionExtension *oldExtension = nil) = 0;
606 
618  virtual bool16 DrawLine(int32 at, IGraphicsPort *gPort, const PMRect &clipRect, const PMPoint &scrollCompensationValue,
619  IPMFont *displayFont, PMReal displaySize, bool16 topLineInDraw) = 0;
620 
621 
622  // ---------------- VIEW INVALING ------------------ //
623  // Methods to store up drawing invals independent of the system invals. Similar to layout view text drawing.
624  //
625 
632  virtual void InvalidateLine(int32 at, bool16 isFrontMost = kFalse) = 0;
633 
643  virtual void InvalidateRun(int32 at, int32 whichRun, TextIndex startOffsetInRun, TextIndex endOffsetInRun, bool16 isFrontMost = kFalse) = 0;
644 
649  virtual void ClearPendingInvalRect() = 0;
650 
656  virtual void AddToPendingInvalRect(const PMRect &rectToAdd) = 0;
657 
662  virtual PMRect GetPendingInvalRect() = 0;
663 
669  virtual void PlayPendingInvals(bool16 instantDraw = kFalse) = 0;
670 
671 
672  // !!! SuspendPlayInvals and ResumePlayInvals must be used in pairs !!!
677  virtual void SuspendPlayPendingInvals() = 0;
678 
683  virtual void ResumePlayPendingInvals() = 0;
684 
689  virtual bool16 GetPlayPendingInvals() const = 0;
690 
695  virtual void RecordUndoRedoPendingInvals(const PMRect& invals) = 0;
696 
700  virtual PMRect* GetPendingInvalsForUndoRedo() = 0;
701 
702 
703  // ---------------- PRINTING ------------------ //
704 
711  virtual int32 GetPages(PMRect rectToFit, int32 columns) = 0;
712 
718  virtual void SetRanges(PMString ranges) = 0;
719 
726  virtual void GetLineNumberStartEnd(int32& start, int32& end)=0;
727 
733  virtual void InitializeStoryCollapsedState(K2Vector<StoryState> & storyList)=0;
734 
735  // ---------------- TEXT OFFSET TYPE CONVERSION ------------------ //
736 
745  virtual TextIndex ModelOffsetToDisplayOffset( TextIndex modelOffset, int32 lineIndex, bool16 ignoreRunTypes = kFalse) = 0;
746 
752  virtual TextIndex ModelIndexToDisplayIndex( TextIndex modelIndex) = 0;
753 
760  virtual TextIndex ModelIndexToDisplayIndex( int32 storyIndex, TextIndex modelIndex) = 0;
761 
767  virtual TextIndex DisplayIndexToModelIndex( TextIndex displayIndex) = 0;
768 
775  virtual TextIndex DisplayIndexToModelIndex( int32 storyIndex, TextIndex displayIndex) = 0;
776 
777 
778  // ---------------- STORY MANAGEMENT ------------------- //
779 
787  virtual void SetCurrentStoryIndex(int32 i) = 0;
788 
793  virtual int32 GetCurrentStoryIndex() = 0;
794 
799  virtual int32 GetStoryCount() = 0;
800 
805  virtual UIDList *GetStoryRefList() = 0;
806 
813  virtual int32 FindIndexOfStoryAtYPosition(PMReal yPosition, bool16 ExtendLastLineOfLastStoryDown = kFalse) = 0;
814 
820  virtual const UIDRef &GetStoryRef(int32 storyIndex) = 0;
821 
828  virtual void SetStoryRef(const UIDRef &ref, int32 storyIndex) = 0;
829 
835  virtual PMReal GetStoryYDrawStart(int32 storyIndex) const = 0;
836 
843  virtual void SetStoryYDrawStart(PMReal yStartPosition, int32 storyIndex) = 0;
844 
850  virtual bool16 IsStoryCollapsed(int32 storyIndex) = 0;
851 
858  virtual void SetStoryCollapseState(const K2Vector<int32> &storyIndexes, bool16 collapse) = 0;
859 
865  virtual bool16 IsStoryBarSelected(int32 storyIndex) = 0;
866 
873  virtual void SetStoryBarSelected(int32 storyIndex, bool16 selected) = 0;
874 
879  virtual void RemoveAllStories() = 0;
880 
885  virtual bool8 GetUseTextRuns() = 0;
886 
887  // Other methods for story management live in the IStoryManager interface
888  friend class StoryManager;
889 private:
894  virtual K2Vector<StoryDescription> &GetStories() = 0;
895 
901  virtual void UpdateStoryStarts(bool16 redraw = kTrue) = 0;
902 public:
903 
911  virtual void DrawTextDisplayHighlight(int32 storyIndex, const RangeData& newRange, const RangeData& oldRange) = 0;
912 
919  virtual TextIndex DisplayIndexToModelIndex_( int32 storyIndex, TextIndex displayIndex) = 0;
920 
929  virtual RangeData ModelToDisplayRange( int32 storyIndex, const RangeData& modelRange, UID leftExtra, UID rightExtra) = 0;
930 
939  virtual RangeData DisplayToModelRange( int32 storyIndex, const RangeData& displayRange, UID* leftExtra, UID* rightExtra) = 0;
940 
948  virtual RangeData AtomicRange( int32 storyIndex, RangeData caret, const RangeData& relativeTo) = 0;
949 };
950 
951 #endif // __ITextLines__