InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IRedlineDataStrand.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Eric Menninga
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 __IRedlineDataStrand__
25 #define __IRedlineDataStrand__
26 
27 #include "IPMUnknown.h"
28 #include "InCopySharedID.h"
29 #include "K2Vector.h"
30 #include "VOSRedline.h"
31 #include "ICommand.h"
32 
33 class ITextModel;
34 class RedlineIterator;
35 
37 {
38  public:
39  enum { kDefaultIID = IID_IREDLINEDATASTRAND };
40 
41  virtual bool16 DoSyncToStory(UID story) = 0;
42  virtual UID GetTextModelUID() const = 0;
43 
44  virtual void ApplyRedlineChange(VOSRedlineChange::RedlineChangeType type, TextIndex position,
45  const uint64& time, bool16 moved, int32 len, const PMString& user) = 0;
46  // Applies a change with the indicated data this redline strand, splits strand object and attaches appropriate record
47 
48  virtual void UndoChange(TextIndex pos, RedlineChangeUndo *undo, int32 changeLen, bool16 inserted, bool16 undoReject) = 0;
49  virtual RedlineChangeUndo* DoAcceptChange(TextIndex position, const VOSRedlineChange& change, int32 *changeLen) = 0;
50  virtual RedlineChangeUndo* DoRejectChange(TextIndex position, const VOSRedlineChange& change, int32 *changeLen, bool16 *inserted) = 0;
51 
52  virtual void DoAcceptRedlineChangeRange(TextIndex position, int32 len) = 0;
53  // Accepts just the range from position to position+len, indicates if was necessary to divide at front and/or back of the object
54  virtual void UndoAcceptRedlineChangeFront(TextIndex position, int32 len) = 0;
55  virtual void UndoAcceptRedlineChangeBack(TextIndex position, int32 len) = 0;
56  virtual void UndoAcceptRedlineChangeMiddle(TextIndex position, int32 len) = 0;
57  // Undo the accept range
58 
59  virtual void RemoveRedlineChange(TextIndex objPosition, const VOSRedlineChange& changeToRemove) = 0;
60  // Removes a change with the indicated data from the redline object at the specified text position.
61  virtual void ClearRedlineChanges(TextIndex objPosition) = 0;
62  // Clears all changes from the redline object at the specified text position.
63 
64  typedef enum {
65 
66  // phases are used to "tweak" the results of various user actions and commands
67  // (including undo/redo) so that the redline strand is kept in good condition
68  // it is difficult to tell where the delete/insert originated from so we use
69  // this technique to provide the needed information
70 
71  kPhase_Normal,
72  kPhase_Storage,
73  kPhase_Rejecting, // so we don't track deletes as a result of rejecting an insert change
74  kPhase_MovingStory, // to prevent deletions resulting from movestoryrangecmd being put into backing storage
75  kPhase_MovingStoryAndPreserve, // kPhase_MovingStory and indicate preserve track changes data (i.e. place InCopy story vs. text file)
76  kPhase_CreatingNote, // so we can match to tracking state of text receiving the note
77  kPhase_XMLDeleteMarker, // so we avoid tracking delete of xml marker (i.e. during untag or convert to note)
78  kPhase_XMLInsertMarker, // so we avoid tracking insert of xml marker (i.e. during tag or convert to note)
79  kPhase_TrackConvertNote, // so we track text converted from text if changes are being tracked
80  kPhase_ConvertingNote, // so deletion of note is not tracked when converting note to text
81  kPhase_SkipTable, // so deletion of table is not tracked when done via table menu delete - table has been dismantled so not safe to track
82  kPhase_IMEInsertResult, // so we only track the ime insert result not the delete of temp chars
83  kPhase_IMEInsertComp // so we don't track ime temp chars insert and delete
84  } RedlinePhase;
85 
86  virtual void PushPhase(RedlinePhase phase) = 0;
87  virtual void PopPhase() = 0;
88  virtual RedlinePhase CurrentPhase() = 0;
89 
96  virtual RedlineIterator* NewRedlineIterator(TextIndex startingAt = 0, int32 atChange= -1) = 0;
97 
104  virtual RedlineIterator* NewRedlineDisplayOrderIterator(TextIndex startingAt = 0, int32 atChange= -1) = 0;
105 
111  virtual bool16 StoryHasChanges() const = 0;
112 
113  typedef enum
114  {
115  kCST_Unknown, // unknown change, update all
116  kCST_Insert, // a new change is inserted
117  kCST_Remove // an existing change is removed
118  } ChangeStateTransition;
119 
123  virtual void UpdateChangeStatus(ChangeStateTransition transition) = 0;
124 };
125 
126 #endif
127  // __IRedlineDataStrand__
128