~ubuntu-branches/ubuntu/quantal/libbonobo/quantal-201207170711

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
 * bonobo-persist.idl: Bonobo::Persist interfaces
 *
 * Copyright (C) 1999, 2000  Helix Code, Inc.
 *
 * Authors:
 *    Miguel de Icaza (miguel@gnu.org)
 *    Dan Winship     (danw@helixcode.com)
 */

#ifndef BONOBO_PERSIST_IDL
#define BONOBO_PERSIST_IDL

#include "Bonobo_Unknown.idl"
#include "Bonobo_Storage.idl"
#include "Bonobo_Exception.idl"

module Bonobo {

	interface Persist : Unknown {
		enum Status {
			SAVE_OK,
			SAVE_CANCEL,
			SAVE_FAILED
		};

		exception WrongDataType {};
		exception FileNotFound {};

		typedef string                ContentType;
		typedef sequence<ContentType> ContentTypeList;
		
		/**
		 * getContentTypes:
		 *
		 *  Gets a list of supported mime types that this
		 * persistor can save its data in. The default /
		 * preferred type being the first element.
		 */
		ContentTypeList getContentTypes ();

		typedef string                IID;
		
		/**
		 * getIId:
		 *
		 * Get the IID necessary to recreate the object whose
		 * internal state this interface represents
		 */
		IID getIId ();

		/**
		 * isDirty:
		 * 
		 * Indicates if a save is necessary.
		 */
		boolean isDirty ();
	
		void unImplemented1 ();
		void unImplemented2 ();
	};
	
	/*
	 * The PersistFile interface is somewhat mis-named it
	 * should be PersistURI.
	 *
	 * This allows applications to load and save documents
	 * via the Gnome VFS.
	 */
	interface PersistFile : Persist {

	        exception NoCurrentName {
			string extension;
		};

		/**
		 * load:
		 * @uri: URI to load from
		 * 
		 * Loads the document object from the file
		 * pointed in by @path
		 */
		void load (in string uri)
			raises (IOError, NotSupported,
				WrongDataType, FileNotFound);

		/**
		 * save:
		 * @uri: the URI to save to
		 * saves the document object to the file 
		 * pointed in by @path
		 */
		void save (in string uri)
			raises (IOError, NotSupported);
	
		/**
		 * getCurrentFile:
		 * 
		 * Returns the URI of the current file. 
		 */
		string getCurrentFile ()
			raises (NoCurrentName);

		void unImplemented3 ();
		void unImplemented4 ();
	};

	/*
	 * PersistStorage is implemented by BonoboObjects.
	 * 
	 * The methods are used by Bonobo and the container
	 * applications to manipulate the storage of a componet
	 */
	interface PersistStorage : Persist {
		
		/**
		 * load:
		 * @storage: The storage to load the state from
		 *
		 * The bonobo_object should load its state from the
		 * @storage provided
		 */
		void load (in Bonobo::Storage storage)
			raises (IOError, NotSupported,
				WrongDataType);

		/**
		 * save:
		 * @storage: The storage in which to save the state
		 * of the bonobo_object
		 * @same_as_loaded: if TRUE, this means the object
		 * is being saved to the same source used to load the object
		 *
		 * BonoboObjects should save their sate in the @storage
		 */
		void save (in Bonobo::Storage storage,
			   in boolean same_as_loaded)
			raises (IOError, NotSupported);
	};
	
	/*
	 * This interface is used by items which only need to store 
	 * information in a Stream ( monikers are the primary
	 * users of this ).  
	 *
	 * Unlike PersistStorage, the Stream passed is only valid
	 * during these calls (ie, you should not incref these
	 * and used them after this).
	 */
	interface PersistStream : Persist {
		
		/**
		 * load:
		 * @stream: Where to load the state from
		 * @type: the MIME content type of the data, or ""
		 * if it is unknown.
		 *
		 * Loads the status of the object from @stream
		 */
		void load (in Bonobo::Stream stream, in ContentType type)
			raises (IOError, NotSupported,
				WrongDataType);

		/**
		 * save:
		 * @stream: Where to save the state to.
		 * @type: the MIME content type to save the data in,
		 * or "" if any type is acceptable.
		 *
		 * If no exception was thrown the data in the stream has
		 * the requested content type; if no type was requested
		 * the first entry from getContentTypes is returned.
		 * Hence no return value is needed.
		 * 
		 * Saves the state of the object to the @stream
		 */
		void save (in Bonobo::Stream stream, in ContentType type)
			raises (IOError, NotSupported,
				WrongDataType);

		void unImplemented3 ();
		void unImplemented4 ();
	};
};

#endif /* BONOBO_PERSIST_IDL */