InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IPresentationList.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Dave Burnard
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 // Purpose: IPresentationList provides an interface for collecting a set of presentations. It also provides methods for opening
24 // and closing a presentation.
25 //
26 //========================================================================================
27 
28 #ifndef __IPRESENTATIONLIST__
29 #define __IPRESENTATIONLIST__
30 
31 #include "IPMUnknown.h"
32 #include "ShuksanID.h"
33 #include "AppUIID.h"
34 
35 #include "IDocumentPresentation.h"
36 
46 {
47 public:
48  enum {kDefaultIID = IID_IPRESENTATIONLIST};
49 
53  virtual void AddPresentation(IDocumentPresentation* newPres) = 0;
54 
59  virtual void PresentationHasOpened(IDocumentPresentation* pres) = 0;
60 
65  virtual void PresentationHasClosed(IDocumentPresentation* pres) = 0;
66 
70  virtual void CloseNthPresentation(int32 n) = 0;
71 
74  virtual void CloseAllPresentations() = 0;
75 
78  class iterator
79  {
80  friend class IPresentationList;
81  public:
82  typedef std::ptrdiff_t difference_type;
84  bool16 operator==(const iterator& rhs) const { return n == rhs.n && list == rhs.list;}
85  bool16 operator!=(const iterator& rhs) const { return !(*this == rhs);}
86  iterator& operator++() { ++n; return *this;}
87  IDocumentPresentation* operator*() const { return list->At(n);}
88  private:
89  IPresentationList* list;
90  int32 n;
91  iterator();
92  iterator(IPresentationList* inList, int32 inN) : list(inList), n(inN) {}
93  };
97  {
98  friend class IPresentationList;
99  public:
100  typedef std::ptrdiff_t difference_type;
102  bool16 operator==(const reverse_iterator& rhs) const { return n == rhs.n && list == rhs.list;}
103  bool16 operator!=(const reverse_iterator& rhs) const { return !(*this == rhs);}
104  reverse_iterator& operator++() { --n; return *this;}
105  IDocumentPresentation* operator*() const { return list->At(n-1);}
106  private:
107  IPresentationList* list;
108  int32 n;
110  reverse_iterator(IPresentationList* inList, int32 inN) : list(inList), n(inN) {}
111  };
112  friend class iterator;
113  friend class reverse_iterator;
114 
115  iterator begin() { return iterator(this, 0);}
116  iterator end(){ return iterator(this, size());}
117  reverse_iterator rbegin() { return reverse_iterator(this, size());}
118  reverse_iterator rend() { return reverse_iterator(this, 0);}
119  iterator find(IDocumentPresentation* it) { int32 index = Find(it); return (index == -1) ? end() : iterator(this, index);}
120  int32 size() const { return Length();}
121  int32 empty() const { return Length()==0;}
122  IDocumentPresentation* at(int32 n) { return At(n);}
123 
127  virtual int32 Find(IDocumentPresentation*) const = 0;
128  virtual int32 Length() const = 0;
129  virtual IDocumentPresentation* At(int32 index) const = 0;
130 
131  IDocumentPresentation* First() const { return At(0);}
132 };
133 
134 
135 #endif