GODoc

## GODoc GODoc |

## Synopsis

    #define             GO_TYPE_DOC
    #define             GO_DOC                              (o)
    #define             GO_IS_DOC                           (o)
                        GODoc;
                        GODocClass;
    GType               go_doc_get_type                     (void);
    GODoc *             go_doc_new_from_input               (GsfInput *input,
                                                             GODocImporter const *fmt,
                                                             XXXGOIOContext *context,
                                                             gchar const *encoding);
    GODoc *             go_doc_new_from_uri                 (char const *uri,
                                                             GnmFileOpener const *fmt,
                                                             XXXGOIOContext *context,
                                                             gchar const *encoding);
    gboolean            go_doc_save                         (GODoc *doc,
                                                             XXXGOIOContext *context);
    gboolean            go_doc_save_as                      (GODoc *doc,
                                                             GODocExporter *fmt,
                                                             char const *uri,
                                                             XXXGOIOContext *cc);
    gboolean            go_doc_sendto                       (GODoc *doc,
                                                             XXXGOIOContext *cc);
    GsfDocMetaData *    go_doc_get_meta_data                (GODoc const *doc);
    char const	*        go_doc_get_uri                      (GODoc const *doc);
    gboolean            go_doc_is_dirty                     (GODoc const *doc);
    gboolean            go_doc_is_pristine                  (GODoc const *doc);
    void                go_doc_set_dirty                    (GODoc *doc,
                                                             gboolean is_dirty);
    void                go_doc_set_meta_data                (GODoc *doc,
                                                             GsfDocMetaData *data);
    void                go_doc_set_pristine                 (GODoc *doc,
                                                             gboolean pristine);
    gboolean            go_doc_set_uri                      (GODoc *doc,
                                                             char const *uri);
    void                go_doc_update_meta_data             (GODoc *doc);
    GOImage *           go_doc_get_image                    (GODoc *doc,
                                                             char const *id);
    GOImage *           go_doc_add_image                    (GODoc *doc,
                                                             char const *id,
                                                             GOImage *image);
    GHashTable *        go_doc_get_images                   (GODoc *doc);
    void                go_doc_init_write                   (GODoc *doc,
                                                             GsfXMLOut *output);
    void                go_doc_write                        (GODoc *doc,
                                                             GsfXMLOut *output);
    void                go_doc_save_image                   (GODoc *doc,
                                                             char const *id);
    void                go_doc_init_read                    (GODoc *doc,
                                                             GsfInput *input);
    void                go_doc_read                         (GODoc *doc,
                                                             GsfXMLIn *xin,
                                                             xmlChar const **attrs);
    void                go_doc_end_read                     (GODoc *doc);
    GOImage *           go_doc_image_fetch                  (GODoc *doc,
                                                             char const *id);

## Object Hierarchy

      GObject
       +----GODoc

## Properties

      "dirty"                    gboolean              : Read / Write
      "pristine"                 gboolean              : Read / Write
      "uri"                      gchar*                : Read / Write

## Signals

      "metadata-changed"                               : Run Last
      "metadata-update"                                : Run Last

## Description

## Details

### GO_TYPE_DOC

    #define GO_TYPE_DOC	    (go_doc_get_type ())

### GO_DOC()

    #define GO_DOC(o)	    (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_TYPE_DOC, GODoc))

`o` : |

### GO_IS_DOC()

    #define GO_IS_DOC(o)	    (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_TYPE_DOC))

`o` : |

### GODoc

    typedef struct _GODoc GODoc;

### GODocClass

    typedef struct {
    	GObjectClass base;

    	struct {
    		/* Reload doc statistics and update linked values */
    		void (*update)  (GODoc *doc);
    		void (*changed) (GODoc *doc);
    	} meta_data;
    } GODocClass;

### go_doc_get_type ()

    GType               go_doc_get_type                     (void);

Returns : |

### go_doc_new_from_input ()

    GODoc *             go_doc_new_from_input               (GsfInput *input,
                                                             GODocImporter const *fmt,
                                                             XXXGOIOContext *context,
                                                             gchar const *encoding);

`input` : |
`fmt` : |
`context` : |
`encoding` : |
Returns : |

### go_doc_new_from_uri ()

    GODoc *             go_doc_new_from_uri                 (char const *uri,
                                                             GnmFileOpener const *fmt,
                                                             XXXGOIOContext *context,
                                                             gchar const *encoding);

`uri` : |
`fmt` : |
`context` : |
`encoding` : |
Returns : |

### go_doc_save ()

    gboolean            go_doc_save                         (GODoc *doc,
                                                             XXXGOIOContext *context);

`doc` : |
`context` : |
Returns : |

### go_doc_save_as ()

    gboolean            go_doc_save_as                      (GODoc *doc,
                                                             GODocExporter *fmt,
                                                             char const *uri,
                                                             XXXGOIOContext *cc);

`doc` : |
`fmt` : |
`uri` : |
`cc` : |
Returns : |

### go_doc_sendto ()

    gboolean            go_doc_sendto                       (GODoc *doc,
                                                             XXXGOIOContext *cc);

`doc` : |
`cc` : |
Returns : |

### go_doc_get_meta_data ()

    GsfDocMetaData *    go_doc_get_meta_data                (GODoc const *doc);

`doc` : |
Returns : |

### go_doc_get_uri ()

    char const	*        go_doc_get_uri                      (GODoc const *doc);

`doc` : |
Returns : |

### go_doc_is_dirty ()

    gboolean            go_doc_is_dirty                     (GODoc const *doc);

`doc` : | GODoc
Returns : | TRUE if `doc` has been modified.

### go_doc_is_pristine ()

    gboolean            go_doc_is_pristine                  (GODoc const *doc);

This checks to see if the doc has ever been used ( approximately )

`doc` : | GODoc
Returns : | `TRUE` if we can discard this doc.

### go_doc_set_dirty ()

    void                go_doc_set_dirty                    (GODoc *doc,
                                                             gboolean is_dirty);

Changes the dirty state of `doc` to `is_dirty` and clears the pristine state no matter what.

`doc` : | GODoc
`is_dirty` : | bool

### go_doc_set_meta_data ()

    void                go_doc_set_meta_data                (GODoc *doc,
                                                             GsfDocMetaData *data);

Adds a ref to `data`.

`doc` : | GODoc
`data` : | GsfDocMetaData

### go_doc_set_pristine ()

    void                go_doc_set_pristine                 (GODoc *doc,
                                                             gboolean pristine);

Sets the indication of whether this document is unchanged since it was created. Note: if both "dirty" and "pristine" are being set, set "pristine" last.

`doc` : | GODoc
`pristine` : | a gboolean.

### go_doc_set_uri ()

    gboolean            go_doc_set_uri                      (GODoc *doc,
                                                             char const *uri);

`doc` : | the document to modify
`uri` : | the uri for this worksheet.
Returns : | TRUE if the name was set succesfully.

### go_doc_update_meta_data ()

    void                go_doc_update_meta_data             (GODoc *doc);

Signal that `doc`'s metadata should be updated - statistics (sheet count, word count) - content (sheet names, bookmarks) - reloading linked items

`doc` : | GODoc

### go_doc_get_image ()

    GOImage *           go_doc_get_image                    (GODoc *doc,
                                                             char const *id);

`doc` : |
`id` : |
Returns : |

### go_doc_add_image ()

    GOImage *           go_doc_add_image                    (GODoc *doc,
                                                             char const *id,
                                                             GOImage *image);

`doc` : |
`id` : |
`image` : |
Returns : |

### go_doc_get_images ()

    GHashTable *        go_doc_get_images                   (GODoc *doc);

`doc` : |
Returns : |

### go_doc_init_write ()

    void                go_doc_init_write                   (GODoc *doc,
                                                             GsfXMLOut *output);

`doc` : |
`output` : |

### go_doc_write ()

    void                go_doc_write                        (GODoc *doc,
                                                             GsfXMLOut *output);

`doc` : |
`output` : |

### go_doc_save_image ()

    void                go_doc_save_image                   (GODoc *doc,
                                                             char const *id);

`doc` : |
`id` : |

### go_doc_init_read ()

    void                go_doc_init_read                    (GODoc *doc,
                                                             GsfInput *input);

`doc` : |
`input` : |

### go_doc_read ()

    void                go_doc_read                         (GODoc *doc,
                                                             GsfXMLIn *xin,
                                                             xmlChar const **attrs);

`doc` : |
`xin` : |
`attrs` : |

### go_doc_end_read ()

    void                go_doc_end_read                     (GODoc *doc);

`doc` : |

### go_doc_image_fetch ()

    GOImage *           go_doc_image_fetch                  (GODoc *doc,
                                                             char const *id);

`doc` : |
`id` : |
Returns : |

## Property Details

### The `"dirty"` property

      "dirty"                    gboolean              : Read / Write

Whether the document has been changed.

Default value: FALSE

### The `"pristine"` property

      "pristine"                 gboolean              : Read / Write

Whether the document is unchanged since it was created.

Default value: FALSE

### The `"uri"` property

      "uri"                      gchar*                : Read / Write

The URI associated with this document.

Default value: NULL

## Signal Details

### The `"metadata-changed"` signal

    void                user_function                      (GODoc   *godoc,
                                                            gpointer user_data)      : Run Last

`godoc` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"metadata-update"` signal

    void                user_function                      (GODoc   *godoc,
                                                            gpointer user_data)      : Run Last

`godoc` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.