00001 #ifndef _DLPAGE_H_ 00002 #define _DLPAGE_H_ 00003 00004 //#include "DLDocument.h" 00005 //#include "DLZone.h" 00006 #include "DLImage.h" 00007 #include "DLTagList.h" 00008 #include "DLConst.h" 00009 #include "DLException.h" 00010 00011 #include <list> 00012 #include <string> 00013 00014 class DLDocument; 00015 class DLZone; 00016 00017 using namespace std; 00018 00019 00061 class DLPage 00062 { 00063 friend class DLDocument; 00064 friend class DLZone; 00065 00066 public: 00067 00075 typedef std::list <DLZone*>::iterator DLZonePtrIterator; 00076 00081 DLZonePtrIterator begin() { return pageZones.begin(); } 00082 00090 DLZonePtrIterator end() { return pageZones.end(); } 00091 00096 bool dlIsZoneIteratorValid(DLZonePtrIterator zoneIter); 00097 00101 DLPage(); 00102 00108 DLPage(const DLImage &pageImage, const string &pageID); 00109 00123 DLPage(const DLPage &right); 00124 00128 virtual ~DLPage(); 00129 00134 bool operator == (const DLPage &right); 00135 00149 DLPage& operator=(const DLPage &right); 00150 00151 00156 string dlGetPageID() const { return pageID; }; 00157 00162 void dlSetPageID(const string &pgID) { pageID = pgID; }; 00163 00168 int dlGetPageWidth() const { return pageImage.dlGetWidth(); }; 00169 00174 int dlGetPageHeight() const { return pageImage.dlGetHeight(); }; 00175 00180 int dlGetNumZones() const { return static_cast<int>(pageZones.size()); }; 00181 00186 bool dlHasZones() const { return (!pageZones.empty()); }; 00187 00199 void dlAppendZone(DLZone *pageZone); 00200 00205 void dlAppendZoneCopy(const DLZone &pageZone); 00206 00213 void dlAppendZoneList(list <DLZone*> zoneList); 00214 00223 void dlInsertZone(DLZonePtrIterator zoneIter, DLZone *pageZone); 00224 00235 void dlInsertZone(int cursorPosition, DLZone *pageZone); 00236 00242 void dlInsertZoneCopy(DLZonePtrIterator zoneIter, const DLZone &pageZone); 00243 00251 void dlInsertZoneCopy(int cursorPosition, const DLZone &pageZone); 00252 00260 void dlInsertZoneList(DLZonePtrIterator zoneIter, list <DLZone*> zoneList); 00261 00271 void dlInsertZoneList(int cursorPosition, list <DLZone*> zoneList); 00272 00277 void dlDeleteZone(DLZonePtrIterator zoneIter); 00278 00284 void dlDeleteZone(int cursorPosition); 00285 00290 void dlDeleteZone(DLZone *deletedZone); 00291 00295 void dlClearZones(); 00296 00301 DLImage dlGetImage() { return pageImage; }; 00302 00307 bool dlCheckPageImageData(); 00308 00310 00311 00317 string dlGetTag(string tagKey) const; 00318 00329 void dlSetTag(string tagKey, string tagValue, bool overwriteEnabled = false); 00330 00335 void dlDeleteTag(string tagKey); 00336 00340 void dlClearTags() { pageTags.tagMap.clear(); }; 00341 00347 bool dlIsTagSet(string tagKey) const; 00348 00353 bool dlIsTagListEmpty() const { return pageTags.tagMap.empty(); }; 00354 00359 DLTagList::iterator dlFindTag ( string tagKey ) { return pageTags.tagMap.find(tagKey); } 00360 00362 00363 protected: 00364 00365 string pageID; 00366 00367 DLImage pageImage; 00368 00369 DLDocument* pageDocument; 00370 00371 // list of attributes 00372 DLTagList pageTags; 00373 00374 // list of zones 00375 list <DLZone*> pageZones; 00376 00377 // list of zones whose DLPage *zonePage point to this page 00378 // this enables the DLPage to keep track of its associated DLZones when its destructor is invoked 00379 list <DLZone*> zoneBackPointers; 00380 00389 DLPage* dlClone(); 00390 00396 void dlSetDocumentPointer(DLDocument *pgDocument); 00397 00398 }; //end class 00399 00400 #endif //_DLPAGE_H_