GOffice.Doc

g GObject.Object GObject.Object GOffice.Doc GOffice.Doc GObject.Object->GOffice.Doc

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

add_image (id, image)

bump_state ()

end_read ()

get_dirty_time ()

get_image (id)

get_images ()

get_meta_data ()

get_modtime ()

get_saved_state ()

get_state ()

get_uri ()

image_fetch (id, type)

init_read (input)

init_write (output)

is_dirty ()

is_pristine ()

read (xin, attrs)

save_image (id)

save_resource (gp)

set_dirty (is_dirty)

set_dirty_time (t)

set_meta_data (data)

set_modtime (modtime)

set_pristine (pristine)

set_saved_state (state)

set_state (state)

set_uri (uri)

update_meta_data ()

write (output)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

dirty

bool

r/w

Whether the document has been changed.

dirty-time

int

r/w

When the document was first changed.

modtime

GLib.DateTime

r/w

The known file system modification time

pristine

bool

r/w

Whether the document is unchanged since it was created.

saved-state

int

r/w

State of document when last saved

state

int

r/w

Current state of document

uri

str

r/w

The URI associated with this document.

Signals

Inherited:

GObject.Object (1)

Name

Short Description

metadata-changed

metadata-update

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

base

GObject.Object

r

first_modification_time

int

r

images

{object: object}

r

meta_data

Gsf.DocMetaData

r

modified

bool

r

modtime

GLib.DateTime

r

pristine

bool

r

priv

object

r

uri

str

r

Class Details

class GOffice.Doc(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GOffice.DocClass

add_image(id, image)
Parameters:
Returns:

either image, in which case the document adds a reference on it, or an identical image for which the owner does not own a reference.

Return type:

GOffice.Image

Adds image to the document if no such image already exists. The name of the returned image might be different from id, even if given.

bump_state()

Sets the current state of the document to a fresh id.

end_read()
get_dirty_time()
Returns:

the time (as in GLib.get_real_time()) the document was first marked dirty.

Return type:

int

get_image(id)
Parameters:

id (str) – the image name

Returns:

the GOffice.Image is one exist with name id. The caller does not own a reference.

Return type:

GOffice.Image

get_images()
Returns:

the images registered inside the document

Return type:

{object: object}

get_meta_data()
Returns:

self's metadata

Return type:

Gsf.DocMetaData

get_modtime()
Returns:

the last known file system time stamp for the document, or None if unknown.

Return type:

GLib.DateTime

get_saved_state()
Returns:

the state at the last time the document was saved.

Return type:

int

get_state()
Returns:

the current state of the document.

Return type:

int

get_uri()
Return type:

str

image_fetch(id, type)
Parameters:
Returns:

the found or created GOffice.Image.

Return type:

GOffice.Image

Searches for a GOffice.Image with name id in the document image buffer and creates one if needed. The caller does not own a reference on the returned GOffice.Image. This function must be called after a call to GOffice.Doc.init_read(), otherwise it will emit a critical and return None.

init_read(input)
Parameters:

input (Gsf.Input) –

init_write(output)
Parameters:

output (Gsf.XMLOut) –

is_dirty()
Returns:

True if self has been modified.

Return type:

bool

is_pristine()
Returns:

True if we can discard this doc.

Return type:

bool

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

read(xin, attrs)
Parameters:
save_image(id)
Parameters:

id (str) – the Id of the GOffice.Image to save

Saves the image with the document. Each image will be saved only once.

save_resource(gp)
Parameters:

gp (GOffice.Persist) – the GOffice.Persist to save

Saves the resource with the document. Each resource will be saved only once.

set_dirty(is_dirty)
Parameters:

is_dirty (bool) – bool

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

set_dirty_time(t)
Parameters:

t (int) – a timestamp from GLib.get_real_time

Changes the dirty time, i.e., the time the document was first marked dirty.

set_meta_data(data)
Parameters:

data (Gsf.DocMetaData) – Gsf.DocMetaData

Adds a ref to data.

set_modtime(modtime)
Parameters:

modtime (GLib.DateTime or None) – new file system time stamp

Sets the last known file system time stamp for the document, None if unknown.

set_pristine(pristine)
Parameters:

pristine (bool) – a bool.

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.

set_saved_state(state)
Parameters:

state (int) – state at the time of last save

Sets the state at the last time the document was saved.

set_state(state)
Parameters:

state (int) – state of document

Sets the current state of the document as a serial number that is intended to be incremented for each document change.

Setting the state will set the document’s dirty status also, assuming both the state and the saved state are known.

set_uri(uri)
Parameters:

uri (str) – the uri for this worksheet.

Returns:

True if the name was set succesfully.

Return type:

bool

update_meta_data()

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

write(output)
Parameters:

output (Gsf.XMLOut) –

Signal Details

GOffice.Doc.signals.metadata_changed(doc)
Signal Name:

metadata-changed

Flags:

RUN_LAST

Parameters:

doc (GOffice.Doc) – The object which received the signal

GOffice.Doc.signals.metadata_update(doc)
Signal Name:

metadata-update

Flags:

RUN_LAST

Parameters:

doc (GOffice.Doc) – The object which received the signal

Property Details

GOffice.Doc.props.dirty
Name:

dirty

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the document has been changed.

GOffice.Doc.props.dirty_time
Name:

dirty-time

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

When the document was first changed.

GOffice.Doc.props.modtime
Name:

modtime

Type:

GLib.DateTime

Default Value:

None

Flags:

READABLE, WRITABLE

The known file system modification time

GOffice.Doc.props.pristine
Name:

pristine

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the document is unchanged since it was created.

GOffice.Doc.props.saved_state
Name:

saved-state

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

State of document when last saved

GOffice.Doc.props.state
Name:

state

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Current state of document

GOffice.Doc.props.uri
Name:

uri

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The URI associated with this document.