00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef BAKERY_APP_WITHDOC_H
00020 #define BAKERY_APP_WITHDOC_H
00021
00022 #include <bakery/App/App.h>
00023 #include <bakery/Document/Document.h>
00024
00025 namespace Bakery
00026 {
00027
00056 class App_WithDoc : virtual public App
00057 {
00058 public:
00060 App_WithDoc(const Glib::ustring& appname = "");
00061
00062 virtual ~App_WithDoc();
00063
00064 virtual void init();
00065
00066 enum enumSaveChanges
00067 {
00068 SAVECHANGES_Save,
00069 SAVECHANGES_Cancel,
00070 SAVECHANGES_Discard
00071 };
00072
00073 protected:
00074 virtual void init_create_document();
00075
00080 static void add_mime_type(const Glib::ustring& mime_type);
00081
00083 virtual Document* get_document();
00084
00086 virtual const Document* get_document() const ;
00087
00088 virtual void set_document_modified(bool bModified = true);
00089
00091 virtual bool open_document(const Glib::ustring& file_uri);
00092
00093 virtual void document_history_add(const Glib::ustring& file_uri);
00094 virtual void document_history_remove(const Glib::ustring& file_uri);
00095
00096 public:
00097
00098
00099
00100
00101 virtual void on_menu_file_open();
00102 virtual void on_menu_file_saveas();
00103 virtual void offer_saveas();
00104 virtual void on_menu_file_save();
00105 virtual void on_menu_file_close();
00106
00107 virtual void on_menu_edit_copy();
00108 virtual void on_menu_edit_paste();
00109 virtual void on_menu_edit_clear();
00110
00111 protected:
00112
00114 virtual void on_document_modified(bool modified);
00115
00117 virtual bool on_document_load();
00118
00119
00120 virtual void offer_to_save_changes();
00121
00123 virtual void cancel_close_or_exit();
00124
00126 virtual void close_mark_or_destroy();
00127
00128 virtual void update_window_title();
00129
00130 virtual void after_successful_save();
00131
00132 virtual void ui_warning(const Glib::ustring& text) = 0;
00133 virtual Glib::ustring ui_file_select_open() = 0;
00134
00139 virtual Glib::ustring ui_file_select_save(const Glib::ustring& old_file_uri) = 0;
00140
00141 virtual void ui_show_modification_status() = 0;
00142
00143 virtual enumSaveChanges ui_offer_to_save_changes() = 0;
00144
00145 virtual bool ui_ask_overwrite(const std::string& file_uri) = 0;
00146
00147 static Glib::ustring get_conf_fullkey(const Glib::ustring& key);
00148
00149
00150
00151 Document* m_pDocument;
00152 bool m_bCloseAfterSave;
00153
00154
00155 typedef std::list<Glib::ustring> type_list_strings;
00156 static type_list_strings m_mime_types;
00157 };
00158
00159 }
00160
00161 #endif //BAKERY_APP_WITHDOC_H