00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef BAKERY_DOCUMENT_H
00020 #define BAKERY_DOCUMENT_H
00021
00022 #include "bakery/View/View.h"
00023 #include <glibmm.h>
00024
00025 #include <iostream>
00026
00027 namespace Bakery
00028 {
00029
00034 class Document
00035 {
00036 public:
00037 Document();
00038 virtual ~Document();
00039
00040
00041
00042
00043
00044
00045
00046
00047 virtual bool save();
00048
00049
00050
00051
00052 virtual bool load();
00053
00054 virtual bool get_modified() const;
00055 virtual void set_modified(bool bVal = true);
00056
00058 virtual bool get_is_new() const;
00060 void set_is_new(bool bVal);
00061
00062 virtual Glib::ustring get_contents() const;
00063 virtual void set_contents(const Glib::ustring& strVal);
00064
00065 virtual Glib::ustring get_filepath() const;
00066 virtual void set_filepath(const Glib::ustring& strVal, bool bEnforceFileExtension = false);
00067
00069 virtual Glib::ustring get_name() const;
00070 static Glib::ustring util_filepath_get_name(const Glib::ustring& filePath);
00071
00072 virtual bool get_read_only() const;
00073 virtual void set_read_only(bool bVal);
00074
00076 virtual void set_view(ViewBase* pView);
00077 virtual ViewBase* get_view();
00078
00079 virtual void set_file_extension(const Glib::ustring& strVal);
00080 virtual Glib::ustring get_file_extension() const;
00081
00082
00083 typedef SigC::Signal0<void> type_signal_modified;
00084 type_signal_modified& signal_modified();
00085
00087
00088 protected:
00092 virtual bool load_after();
00093
00097 virtual bool save_before();
00098
00099 virtual bool read_from_disk();
00100 virtual bool write_to_disk();
00101
00102 Glib::ustring m_strContents;
00103 Glib::ustring m_strFilePath;
00104 Glib::ustring m_strFileExtension;
00105
00106 ViewBase* m_pView;
00107
00108 type_signal_modified signal_modified_;
00109
00110 bool m_bModified;
00111 bool m_bIsNew;
00112 bool m_bReadOnly;
00113 };
00114
00115 }
00116
00117 #endif //GNOME_APPWITHDOCS_DOCUMENT_H