![]() |
![]() |
![]() |
GOffice Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum GOFileFormatLevel; #define GO_TYPE_FILE_FORMAT_LEVEL enum GOFileSaveScope; GType go_file_save_scope_get_type (void
); #define GO_TYPE_FILE_SAVE_SCOPE GOFileOpenerClass; gboolean (*GOFileOpenerProbeFunc) (GOFileOpener const *fo
,GsfInput *input
,GOFileProbeLevel pl
); void (*GOFileOpenerOpenFunc) (GOFileOpener const *fo
,GOIOContext *io_context
,GoView *view
,GsfInput *input
); void (*GOFileOpenerOpenFuncWithEnc) (GOFileOpener const *fo
,gchar const *enc
,GOIOContext *io_context
,GoView *view
,GsfInput *input
); GType go_file_opener_get_type (void
); GOFileOpener * go_file_opener_new (char const *id
,char const *description
,GSList *suffixes
,GSList *mimes
,GOFileOpenerProbeFunc probe_func
,GOFileOpenerOpenFunc open_func
); GOFileOpener * go_file_opener_new_with_enc (char const *id
,char const *description
,GSList *suffixes
,GSList *mimes
,GOFileOpenerProbeFunc probe_func
,GOFileOpenerOpenFuncWithEnc open_func
); gboolean go_file_opener_probe (GOFileOpener const *fo
,GsfInput *input
,GOFileProbeLevel pl
); void go_file_opener_open (GOFileOpener const *fo
,gchar const *opt_enc
,GOIOContext *io_context
,GoView *view
,GsfInput *input
); char const * go_file_opener_get_id (GOFileOpener const *fo
); char const * go_file_opener_get_description (GOFileOpener const *fo
); gboolean go_file_opener_is_encoding_dependent (GOFileOpener const *fo
); gboolean go_file_opener_can_probe (GOFileOpener const *fo
,GOFileProbeLevel pl
); GSList const * go_file_opener_get_suffixes (GOFileOpener const *fo
); GSList const * go_file_opener_get_mimes (GOFileOpener const *fo
); GOFileSaverClass; #define GO_TYPE_FILE_SAVER #define GO_FILE_SAVER (obj) #define GO_IS_FILE_SAVER (obj) void (*GOFileSaverSaveFunc) (GOFileSaver const *fs
,GOIOContext *io_context
,GoView const *view
,GsfOutput *output
); GType go_file_saver_get_type (void
); GOFileSaver * go_file_saver_new (char const *id
,char const *extension
,char const *description
,GOFileFormatLevel level
,GOFileSaverSaveFunc save_func
); void go_file_saver_set_save_scope (GOFileSaver *fs
,GOFileSaveScope scope
); GOFileSaveScope go_file_saver_get_save_scope (GOFileSaver const *fs
); gboolean go_file_saver_set_export_options (GOFileSaver *fs
,GODoc *doc
,const char *options
,GError **err
); void go_file_saver_save (GOFileSaver const *fs
,GOIOContext *io_context
,GoView *view
,GsfOutput *output
); void go_file_saver_set_overwrite_files (GOFileSaver *fs
,gboolean overwrite
); char const * go_file_saver_get_id (GOFileSaver const *fs
); char const * go_file_saver_get_extension (GOFileSaver const *fs
); char const * go_file_saver_get_mime_type (GOFileSaver const *fs
); char const * go_file_saver_get_description (GOFileSaver const *fs
); GOFileFormatLevel go_file_saver_get_format_level (GOFileSaver const *fs
); GList * go_get_file_openers (void
); void go_file_opener_unregister (GOFileOpener *fo
); void go_file_opener_register (GOFileOpener *fo
,gint priority
); GOFileOpener * go_file_opener_for_id (char const *id
); GList * go_get_file_savers (void
); void go_file_saver_unregister (GOFileSaver *fs
); void go_file_saver_register (GOFileSaver *fs
); void go_file_saver_register_as_default (GOFileSaver *fs
,gint priority
); GOFileSaver * go_file_saver_get_default (void
); GOFileSaver * go_file_saver_for_mime_type (char const *mime_type
); GOFileSaver * go_file_saver_for_file_name (char const *file_name
); GOFileSaver * go_file_saver_for_id (char const *id
);
typedef enum { GO_FILE_FL_NONE, /* No name assigned, won't happen */ GO_FILE_FL_WRITE_ONLY, /* PostScript etc, won't be remembered */ GO_FILE_FL_NEW, /* Wb just created */ GO_FILE_FL_MANUAL, /* Save gets punted to save as */ GO_FILE_FL_MANUAL_REMEMBER, /* Ditto, but remember in history */ GO_FILE_FL_AUTO, /* Save will save to this filename */ GO_FILE_FL_LAST } GOFileFormatLevel;
no name assigned, won't happen. | |
PostScript etc, won't be remembered. | |
Wb just created. | |
Save gets punted to save as. | |
Ditto, but remember in history. | |
Save will save to this filename. | |
last value, won't happen. |
typedef enum { GO_FILE_SAVE_WORKBOOK, GO_FILE_SAVE_SHEET, GO_FILE_SAVE_RANGE, GO_FILE_SAVE_LAST } GOFileSaveScope;
typedef struct { GObjectClass parent_class; /* private */ gboolean (*can_probe) (GOFileOpener const *fo, GOFileProbeLevel pl); gboolean (*probe) (GOFileOpener const *fo, GsfInput *input, GOFileProbeLevel pl); void (*open) (GOFileOpener const *fo, gchar const *opt_enc, GOIOContext *io_context, GoView *view, GsfInput *input); } GOFileOpenerClass;
File opener base class.
GObjectClass |
parent class. |
returns TRUE if the files can be probed.
|
|
probes the file. | |
opens and reads the file. |
gboolean (*GOFileOpenerProbeFunc) (GOFileOpener const *fo
,GsfInput *input
,GOFileProbeLevel pl
);
|
|
|
|
|
|
Returns : |
void (*GOFileOpenerOpenFunc) (GOFileOpener const *fo
,GOIOContext *io_context
,GoView *view
,GsfInput *input
);
|
|
|
|
|
|
|
void (*GOFileOpenerOpenFuncWithEnc) (GOFileOpener const *fo
,gchar const *enc
,GOIOContext *io_context
,GoView *view
,GsfInput *input
);
|
|
|
|
|
|
|
|
|
GOFileOpener * go_file_opener_new (char const *id
,char const *description
,GSList *suffixes
,GSList *mimes
,GOFileOpenerProbeFunc probe_func
,GOFileOpenerOpenFunc open_func
);
Creates new GOFileOpener object. Optional id
will be used
after registering it with go_file_opener_register function.
|
Optional ID of the opener (or NULL) |
|
Description of supported file format |
|
List of suffixes to associate with the opener. [element-type char] |
|
List of mime types to associate with the opener. [element-type char] |
|
Optional pointer to "probe" function (or NULL). [scope async] |
|
Pointer to "open" function. [scope async] |
Returns : |
newly created GOFileOpener object. [transfer full] |
GOFileOpener * go_file_opener_new_with_enc (char const *id
,char const *description
,GSList *suffixes
,GSList *mimes
,GOFileOpenerProbeFunc probe_func
,GOFileOpenerOpenFuncWithEnc open_func
);
Creates new GOFileOpener object. Optional id
will be used
after registering it with go_file_opener_register function.
|
Optional ID of the opener (or NULL) |
|
Description of supported file format |
|
List of suffixes to associate with the opener. [element-type char] |
|
List of mime types to associate with the opener. [element-type char] |
|
Optional pointer to "probe" function (or NULL). [scope async] |
|
Pointer to "open" function. [scope async] |
Returns : |
newly created GOFileOpener object. [transfer full] |
gboolean go_file_opener_probe (GOFileOpener const *fo
,GsfInput *input
,GOFileProbeLevel pl
);
Checks if a given file is supported by the opener.
void go_file_opener_open (GOFileOpener const *fo
,gchar const *opt_enc
,GOIOContext *io_context
,GoView *view
,GsfInput *input
);
Reads content of file_name
file into workbook wbv
is attached to.
Results are reported using io_context
object, use
go_io_error_occurred to find out if operation was successful.
The state of wbv
and its workbook is undefined if operation fails, you
should destroy them in that case.
|
GOFileOpener object |
|
Optional encoding |
|
Context for i/o operation |
|
GoView |
|
Gsf input stream |
char const * go_file_opener_get_id (GOFileOpener const *fo
);
|
|
Returns : |
char const * go_file_opener_get_description (GOFileOpener const *fo
);
|
|
Returns : |
gboolean go_file_opener_is_encoding_dependent
(GOFileOpener const *fo
);
|
|
Returns : |
gboolean go_file_opener_can_probe (GOFileOpener const *fo
,GOFileProbeLevel pl
);
|
|
|
|
Returns : |
GSList const * go_file_opener_get_suffixes (GOFileOpener const *fo
);
|
GOFileOpener |
Returns : |
the suffixes for the supporte file types. [element-type char][transfer none char] |
GSList const * go_file_opener_get_mimes (GOFileOpener const *fo
);
|
GOFileOpener |
Returns : |
the supported mime types. [element-type char][transfer none char] |
typedef struct { GObjectClass parent_class; /* private */ void (*save) (GOFileSaver const *fs, GOIOContext *io_context, GoView const *view, GsfOutput *output); gboolean (*set_export_options) (GOFileSaver *fs, const char *options, GError **err); } GOFileSaverClass;
File saver base class.
GObjectClass |
parent class. |
saves the file. | |
set the options. |
#define GO_FILE_SAVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GO_TYPE_FILE_SAVER, GOFileSaver))
|
#define GO_IS_FILE_SAVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GO_TYPE_FILE_SAVER))
|
void (*GOFileSaverSaveFunc) (GOFileSaver const *fs
,GOIOContext *io_context
,GoView const *view
,GsfOutput *output
);
|
|
|
|
|
|
|
GOFileSaver * go_file_saver_new (char const *id
,char const *extension
,char const *description
,GOFileFormatLevel level
,GOFileSaverSaveFunc save_func
);
Creates new GOFileSaver object. Optional id
will be used
after registering it with go_file_saver_register or
go_file_saver_register_as_default function.
|
Optional ID of the saver (or NULL) |
|
Optional default extension of saved files (or NULL) |
|
Description of supported file format |
|
File format level |
|
Pointer to "save" function. [scope async] |
Returns : |
newly created GOFileSaver object. |
void go_file_saver_set_save_scope (GOFileSaver *fs
,GOFileSaveScope scope
);
|
|
|
GOFileSaveScope go_file_saver_get_save_scope (GOFileSaver const *fs
);
|
|
Returns : |
gboolean go_file_saver_set_export_options (GOFileSaver *fs
,GODoc *doc
,const char *options
,GError **err
);
|
|
|
|
|
|
|
|
Returns : |
void go_file_saver_save (GOFileSaver const *fs
,GOIOContext *io_context
,GoView *view
,GsfOutput *output
);
Saves wbv
and the workbook it is attached to into output
stream.
Results are reported using io_context
object, use
go_io_error_occurred to find out if operation was successful.
It's possible that file_name
is created and contain some data if
operation fails, you should remove the file in that case.
|
GOFileSaver object |
|
Context for i/o operation |
|
GoView |
|
Output stream |
void go_file_saver_set_overwrite_files (GOFileSaver *fs
,gboolean overwrite
);
Changes behaviour of the saver when saving a file. If overwrite
is set
to TRUE, existing file will be overwritten. Otherwise, the saver will
report an error without saving anything.
|
GOFileSaver object |
|
A boolean value saying whether the saver should overwrite existing files. |
char const * go_file_saver_get_extension (GOFileSaver const *fs
);
|
|
Returns : |
char const * go_file_saver_get_mime_type (GOFileSaver const *fs
);
|
|
Returns : |
char const * go_file_saver_get_description (GOFileSaver const *fs
);
|
|
Returns : |
GOFileFormatLevel go_file_saver_get_format_level (GOFileSaver const *fs
);
|
|
Returns : |
GList * go_get_file_openers (void
);
Returns : |
list of known GOFileOpener types (do not modify list). [element-type GOFileSaver][transfer none GOFileSaver] |
void go_file_opener_unregister (GOFileOpener *fo
);
Removes fo
opener from list of available file openers. Reference count
for the opener is decremented inside the function.
|
GOFileOpener object previously registered using go_file_opener_register |
void go_file_opener_register (GOFileOpener *fo
,gint priority
);
Adds fo
opener to the list of available file openers, making it
available for Gnumeric i/o routines. The opener is registered with given
priority
. The priority is used to determine the order in which openers
will be tried when reading a file. The higher the priority, the sooner it
will be tried. Default XML-based Gnumeric file opener is registered at
priority 50. Recommended range for priority
is [0, 100].
Reference count for the opener is incremented inside the function, but
you don't have to (and shouldn't) call g_object_unref on it if it's
floating object (for example, when you pass object newly created with
go_file_opener_new and not referenced anywhere).
|
GOFileOpener object |
|
Opener's priority |
GOFileOpener * go_file_opener_for_id (char const *id
);
Searches for file opener with given id
, registered using
go_file_opener_register
|
File opener's ID |
Returns : |
GOFileOpener object or NULL if opener cannot be found. [transfer none]
|
GList * go_get_file_savers (void
);
Returns : |
list of known GOFileSaver types (do not modify list). [element-type GOFileSaver][transfer none GOFileSaver] |
void go_file_saver_unregister (GOFileSaver *fs
);
Removes fs
saver from list of available file savers. Reference count
for the saver is decremented inside the function.
|
GOFileSaver object previously registered using go_file_saver_register or go_file_saver_register_as_default |
void go_file_saver_register (GOFileSaver *fs
);
Adds fs
saver to the list of available file savers, making it
available for the user when selecting file format for save.
|
GOFileSaver object |
void go_file_saver_register_as_default (GOFileSaver *fs
,gint priority
);
Adds fs
saver to the list of available file savers, making it
available for the user when selecting file format for save.
The saver is also marked as default saver with given priority.
When Gnumeric needs default file saver, it chooses the one with the
highest priority. Recommended range for priority
is [0, 100].
|
GOFileSaver object |
|
Saver's priority |
GOFileSaver * go_file_saver_get_default (void
);
Finds file saver registered as default saver with the highest priority. Reference count for the saver is NOT incremented.
Returns : |
GOFileSaver object or NULL if default saver is not available. [transfer none] |
GOFileSaver * go_file_saver_for_mime_type (char const *mime_type
);
|
A mime type |
Returns : |
A GOFileSaver object associated with mime_type , or NULL . [transfer none]
|
GOFileSaver * go_file_saver_for_file_name (char const *file_name
);
Searches for file saver with given filename
, registered using
go_file_opener_register
|
name |
Returns : |
GOFileSaver object or NULL if opener cannot be found. [transfer none] |