InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VOSSimpleCursor.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: EricM
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 __VOSSIMPLECURSOR__
25 #define __VOSSIMPLECURSOR__
26 
27 #include "VOSObject.h"
28 
29 class IVOSDiskPage;
30 class VOS_SavedData;
31 
32 
33 
49 {
50  public:
52  VOS_SimpleCursor(IPMUnknown* cache, IVOSDiskPage* block, int32 offset);
53 
55 
56  VOS_SimpleCursor(const VOS_SimpleCursor& other);
57  VOS_SimpleCursor& operator=(const VOS_SimpleCursor& other);
58 
63  VOS_SimpleCursor GetPreviousSimple(bool16 *prevExists = nil) const;
68  VOS_SimpleCursor GetNextSimple(bool16 *nextExists = nil) const;
69 
73  bool16 MoveToNext();
77  bool16 MoveToPrevious();
78 
82  bool16 AtBeginning() const;
86  bool16 AtEnd() const;
87 
91  int32 LocalOffset() const
92  { return fObjOffset; }
93 
98  void IncrementOffset(int32 delta)
99  { fObjOffset += delta; ASSERT_MSG(fObjOffset >= 0, "offset should be positive"); }
100 
105  void SetOffset(int32 off)
106  { fObjOffset = off; ASSERT_MSG(fObjOffset >= 0, "offset should be positive"); }
107 
111  int32 ObjectLength() const
112  { return (fObject ? fObject->VirtualLength() : 0); }
113 
116  void DirtyObject()
117  { if (fObject) fObject->PreDirty(); }
118 
123  { if (fObject)
124  fObject->AddRef();
125  return fObject; }
126 
132  static void ReleaseObject(VOS_Object *obj)
133  { if (obj) obj->Release(); }
134 
138  bool16 IsEmpty() const
139  { return fObject == nil; }
140 
145  bool16 RemoveObject(bool16 deleteIt = kTrue);
146 
154  void RemoveObjects(int32 *pLen2Del, VOS_SavedData *data);
155 
163  void CopyObjects(int32 *pLen2Copy, VOS_SavedData *copyInto = nil);
164 
168  void Rationalize();
171  void Clear();
172 
177  { if (fOwner)
178  fOwner->AddRef();
179  return fOwner; }
180 
181  protected:
189  void AddUndoObject(bool16 front, VOS_SavedData *undo, bool16 *nextExists, int32 len2Del);
190 
198  void CopyObject(bool16 front, VOS_SavedData *copy, bool16 *nextExists, int32 len2Copy);
199 
206  void CopyPageRef(VOS_SavedData *copy, bool16 *unused, int32 len2Copy);
207 
208  IPMUnknown *fOwner;
209  VOS_Object *fObject;
210  int32 fObjOffset;
211 };
212 
213 
214 #endif // __VOSSIMPLECURSOR__