1 /* 2 * Copyright 2006-2007, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 #ifndef DOCUMENT_H 9 #define DOCUMENT_H 10 11 12 #include "Observable.h" 13 #include "RWLocker.h" 14 15 #include <String.h> 16 17 struct entry_ref; 18 19 namespace BPrivate { 20 namespace Icon { 21 22 class Icon; 23 24 } // namespace Icon 25 } // namespace BPrivate 26 27 class CommandStack; 28 class DocumentSaver; 29 class Selection; 30 31 class Document : public RWLocker, 32 public Observable { 33 public: 34 Document(const char* name = NULL); 35 virtual ~Document(); 36 37 inline ::CommandStack* CommandStack() const 38 { return fCommandStack; } 39 40 inline ::Selection* Selection() const 41 { return fSelection; } 42 43 void SetName(const char* name); 44 const char* Name() const; 45 46 void SetNativeSaver(::DocumentSaver* saver); 47 inline ::DocumentSaver* NativeSaver() const 48 { return fNativeSaver; } 49 50 void SetExportSaver(::DocumentSaver* saver); 51 inline ::DocumentSaver* ExportSaver() const 52 { return fExportSaver; } 53 54 void SetIcon(BPrivate::Icon::Icon* icon); 55 inline BPrivate::Icon::Icon* Icon() const 56 { return fIcon; } 57 58 void MakeEmpty(bool includingSavers = true); 59 60 bool IsEmpty() const; 61 62 private: 63 BPrivate::Icon::Icon* fIcon; 64 ::CommandStack* fCommandStack; 65 ::Selection* fSelection; 66 67 BString fName; 68 69 ::DocumentSaver* fNativeSaver; 70 ::DocumentSaver* fExportSaver; 71 }; 72 73 #endif // DOCUMENT_H 74