Module: Gsf
- Defined in:
- lib/gsf/input.rb,
lib/gsf.rb,
lib/gsf/loader.rb
Overview
Copyright (C) 2016 Ruby-GNOME2 Project Team
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Defined Under Namespace
Modules: ClipFormat, ClipFormatWindows, Error, OutputCsvQuotingMode, XMLContent, ZipCompressionMethod Classes: Blob, ClipData, DocMetaData, DocPropVector, Infile, InfileMSOle, InfileMSVBA, InfileStdio, InfileTar, InfileZip, Input, InputGZip, InputGio, InputHTTP, InputMemory, InputProxy, InputStdio, InputTextline, Loader, ODFOut, Outfile, OutfileMSOle, OutfileOpenPkg, OutfileStdio, OutfileZip, Output, OutputBzip, OutputCsv, OutputGZip, OutputGio, OutputIOChannel, OutputIconv, OutputMemory, OutputStdio, SharedMemory, StructuredBlob, XMLOut
Constant Summary collapse
- META_NAME_BYTE_COUNT =
(Integer) Count of bytes in the document.
gsf:byte-count
- META_NAME_CASE_SENSITIVE =
(Unsigned Integer) Identifier representing the case-sensitiveness. of what ?? why is it an integer ??
gsf:case-sensitivity
- META_NAME_CATEGORY =
(String) Category of the document. example???
gsf:category
- META_NAME_CELL_COUNT =
(Integer) Count of cells in the spread-sheet document, if appropriate.
gsf:cell-count
- META_NAME_CHARACTER_COUNT =
(Integer) Count of characters in the document.
TODO See how to sync this with ODF's document-statistic
gsf:character-count
- META_NAME_CODEPAGE =
(UnsignedShort) The MS codepage to encode strings for metadata 1.14.0 Clarified that this is unique from _NAME_CODEPAGE in msole
msole:codepage
- META_NAME_COMPANY =
(String) Name of the company/organization that the "CREATOR" entity is associated with.
1.14.1 Moved from "gsf:company" to "dc:publisher".
dc:publisher
- META_NAME_CREATOR =
(String) An entity primarily responsible for making the content of the resource typically a person, organization, or service.
1.14.0 Moved from "gsf" to "dc".
dc:creator
- META_NAME_DATE_CREATED =
(Date as ISO String) A date associated with an event in the life cycle of the resource (creation/publication date). Moved from gsf:date-created to meta:creation-date. This way can be used correctly by OpenDocument and Gnumeric.
:creation-date
- META_NAME_DATE_MODIFIED =
(GsfTimestamp) The last time this document was saved.
1.14.0 Moved from dc:date-modified to dc:date.
dc:date
- META_NAME_DESCRIPTION =
(String) An account of the content of the resource.
dc:description
- META_NAME_DICTIONARY =
(None) Reserved name (PID) for Dictionary
gsf:dictionary
- META_NAME_DOCUMENT_PARTS =
(Vector of strings) Names of the 'interesting' parts of the document. In spreadsheets this is a list of the sheet names, and the named expressions. From MSOLE
gsf:document-parts
- META_NAME_EDITING_DURATION =
(Date as ISO String) The total-time taken until the last modification. Moved from "gsf" to "meta". This way can be used correctly by OpenDocument and Gnumeric.
:editing-duration
- META_NAME_GENERATOR =
(String) The application that generated this document. AbiWord, Gnumeric, etc...
1.14.0 Moved from "gsf" to "meta".
:generator
- META_NAME_HEADING_PAIRS =
(Vector of string value pairs stored in alternating elements) Store the counts of objects in the document as names 'worksheet' and count '4' From MSOLE
gsf:heading-pairs
- META_NAME_HIDDEN_SLIDE_COUNT =
(Integer) Count of hidden-slides in the presentation document.
gsf:hidden--count
- META_NAME_IMAGE_COUNT =
(Integer) Count of images in the document, if appropriate.
gsf:image-count
- META_NAME_INITIAL_CREATOR =
(String) Specifies the name of the person who created the document initially. 1.14.0 Moved from "gsf" to "meta".
:initial-creator
- META_NAME_KEYWORD =
(String) Searchable, indexable keywords. Similar to PDF keywords or HTML's meta block.
:keyword
- META_NAME_KEYWORDS =
(GsfDocPropVector of String) Searchable, indexable keywords. Similar to PDF keywords or HTML's meta block.
dc:keywords
- META_NAME_LANGUAGE =
(String) The locale language of the intellectual content of the resource (basically xx_YY form for us). 1.14.0 Clarified that this is unique from _NAME_CODEPAGE in msole
dc:language
- META_NAME_LAST_PRINTED =
(GSF_META_NAME_HEADING_PAIRS) The last time this document was printed.
1.14.0 Moved from "gsf" to "dc". 1.14.1 Moved back to "gsf" from "dc".
gsf:last-printed
- META_NAME_LAST_SAVED_BY =
(String) The entity that made the last change to the document, typically a person, organization, or service.
gsf:last-saved-by
- META_NAME_LINE_COUNT =
(Integer) Count of liness in the document.
gsf:line-count
- META_NAME_LINKS_DIRTY =
(Boolean) ???????
gsf:links-dirty
- META_NAME_LOCALE_SYSTEM_DEFAULT =
(Unsigned Integer) Identifier representing the default system locale.
gsf:default-locale
- META_NAME_MANAGER =
(String) Name of the manager of "CREATOR" entity.
gsf:manager
- META_NAME_MM_CLIP_COUNT =
(Integer) Count of "multi-media" clips in the document.
gsf:MM-clip-count
- META_NAME_MSOLE_UNKNOWN_17 =
(Unknown) User-defined name
msole:unknown-doc-17
- META_NAME_MSOLE_UNKNOWN_18 =
(Unknown) User-defined name
msole:unknown-doc-18
- META_NAME_MSOLE_UNKNOWN_19 =
(Boolean) User-defined name
msole:unknown-doc-19
- META_NAME_MSOLE_UNKNOWN_20 =
(Unknown) User-defined name
msole:unknown-doc-20
- META_NAME_MSOLE_UNKNOWN_21 =
(Unknown) User-defined name
msole:unknown-doc-21
- META_NAME_MSOLE_UNKNOWN_22 =
(Boolean) User-defined name
msole:unknown-doc-22
- META_NAME_MSOLE_UNKNOWN_23 =
(i4) User-defined name
msole:unknown-doc-23
- META_NAME_NOTE_COUNT =
(Integer) Count of "notes" in the document.
gsf:note-count
- META_NAME_OBJECT_COUNT =
(Integer) Count of objects (OLE and other graphics) in the document, if appropriate.
gsf:object-count
- META_NAME_PAGE_COUNT =
(Integer) Count of pages in the document, if appropriate.
gsf:page-count
- META_NAME_PARAGRAPH_COUNT =
(Integer) Count of paragraphs in the document, if appropriate.
gsf:paragraph-count
- META_NAME_PRESENTATION_FORMAT =
(String) Type of presentation, like "On-screen Show", "SlideView" etc.
gsf:presentation-format
- META_NAME_PRINTED_BY =
(String) Specifies the name of the last person who printed the document.
1.14.0 Moved from "gsf" to "meta".
:printed-by
- META_NAME_PRINT_DATE =
(GsfTimestamp) Specifies the date and time when the document was last printed.
:print-date
- META_NAME_REVISION_COUNT =
(Integer) Count of revision on the document, if appropriate. Moved from gsf:revision-count to meta:editing-cycles. This way can be used correctly by OpenDocument and Gnumeric.
:editing-cycles
- META_NAME_SCALE =
(Boolean) ?????
gsf:scale
- META_NAME_SECURITY =
(Integer) Level of security.
gsf:security
- META_NAME_SLIDE_COUNT =
(Integer) Count of slides in the presentation document.
gsf:slide-count
- META_NAME_SPREADSHEET_COUNT =
(Integer) Count of pages in the document, if appropriate.
gsf:spreadsheet-count
- META_NAME_SUBJECT =
(String) The topic of the content of the resource, typically including keywords.
dc:subject
- META_NAME_TABLE_COUNT =
(Integer) Count of tables in the document, if appropriate.
gsf:table-count
- META_NAME_TEMPLATE =
(String) The template file that is been used to generate this document.
1.14.0 Moved from "gsf" to "meta"
:template
- META_NAME_THUMBNAIL =
(GsfClipData) Thumbnail data of the document, typically a preview image of the document.
gsf:thumbnail
- META_NAME_TITLE =
(String) A formal name given to the resource.
dc:title
- META_NAME_WORD_COUNT =
(Integer) Count of words in the document.
gsf:word-count
- LOG_DOMAIN =
"Gsf"
Class Method Summary collapse
Instance Method Summary collapse
-
#base64_decode_simple(data, len) ⇒ Integer
Decodes a chunk of base64 encoded data from data back into data.
-
#base64_decode_step(in, len, out, state, save) ⇒ Integer
Decodes a chunk of base64 encoded data.
-
#base64_encode_close(in, inlen, break_lines, out, state, save) ⇒ Integer
This funcion should be called to when finished encoding everything, to flush off the last little bit.
-
#base64_encode_simple(data, len) ⇒ Integer
Encodes data from data back into data using base64 encoding.
-
#base64_encode_step(in, len, break_lines, out, state, save) ⇒ Integer
Performs an 'encode step', only encodes blocks of 3 characters from in into the output out at a time, saves left-over state in state and save (initialise to 0 on first invocation).
- #debug_flag(flag) ⇒ Boolean
-
#doc_meta_dump(meta) ⇒ nil
A debugging utility to dump the content of meta via g_print.
-
#error_quark ⇒ GLib::Quark
The #GQuark used to identify libgsf errors in #GError structures.
-
#extension_pointer(path) ⇒ String
Extracts the extension from the end of a filename (the part after the final '.' in the filename).
-
#filename_to_utf8(filename, quoted) ⇒ String
A utility wrapper to make sure filenames are valid utf8.
-
#iconv_close(handle) ⇒ nil
A utility wrapper to safely close an iconv handle.
-
#init ⇒ nil
Initializes the GSF library.
-
#init_dynamic(module) ⇒ nil
Initializes the GSF library and associates it with a type module mod.
-
#le_get_double(p) ⇒ Float
Interpret binary data as a double in little endian order.
-
#le_get_float(p) ⇒ Gsf::gfloat
Interpret binary data as a float in little endian order.
-
#le_get_guint64(p) ⇒ Integer
Interpret binary data as a guint64 (8 byte unsigned integer type) in little endian order.
-
#le_set_double(p, d) ⇒ nil
Store a value of type double in memory in little endian order.
-
#le_set_float(p, f) ⇒ nil
Store a value of type float in memory in little endian order.
-
#mem_dump(ptr, len) ⇒ nil
Dump len bytes from the memory location given by ptr.
- #msole_codepage_to_lid(codepage) ⇒ Integer
-
#msole_iconv_open_codepage_for_export(codepage_to) ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
-
#msole_iconv_open_codepage_for_import(to, codepage) ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
-
#msole_iconv_open_codepages_for_export(codepage_to, from) ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
-
#msole_iconv_open_for_export ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
-
#msole_iconv_open_for_import(codepage) ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
-
#msole_iconv_win_codepage ⇒ Integer
Our best guess at the applicable windows code page based on an environment variable or the current locale.
-
#msole_inflate(input, offset) ⇒ Array<Integer>
Decompresses an LZ compressed stream.
-
#msole_language_for_lid(lid) ⇒ String
xxx) for the given LID.
-
#msole_lid_for_language(lang) ⇒ Integer
The LID (Language Identifier) for the input language.
-
#msole_lid_to_codepage(lid) ⇒ Integer
Our best guess at the codepage for the given language id.
-
#msole_lid_to_codepage_str(lid) ⇒ String
LID.
-
#odf_get_ns ⇒ Gsf::XMLInNS
The used ODF namespace.
-
#odf_get_version ⇒ Gsf::gshort
Gives the ODF version used by libgsf when writing Open Document files.
-
#odf_get_version_string ⇒ String
Gives the ODF version used by libgsf when writing Open Document files.
- #open_pkg_error_id ⇒ Integer
-
#open_pkg_foreach_rel(opkg, func, user_data) ⇒ nil
New in 1.14.9.
-
#open_pkg_lookup_rel_by_id(opkg, id) ⇒ Gsf::OpenPkgRel
New in 1.14.6.
-
#open_pkg_lookup_rel_by_type(opkg, type) ⇒ Gsf::OpenPkgRel
New in 1.14.6.
-
#open_pkg_open_rel(opkg, rel) ⇒ Gsf::Input
A new Gsf::Input which the called needs to unref, or nil and sets err.
-
#open_pkg_open_rel_by_id(opkg, id) ⇒ Gsf::Input
New in 1.14.7.
-
#open_pkg_open_rel_by_type(opkg, type) ⇒ Gsf::Input
New in 1.14.9.
-
#open_pkg_parse_rel_by_id(xin, id, dtd, ns) ⇒ GLib::Error
Convenience function to parse a related part.
- #property_settings_collect(object_type, p_params, p_n_params, first_property_name, array) ⇒ nil
-
#property_settings_collect_valist(object_type, p_params, p_n_params, first_property_name, var_args) ⇒ nil
This function builds a GParameter array suitable for g_object_newv.
- #property_settings_find(name, params, n_params) ⇒ GObject::Parameter
- #property_settings_free(params, n_params) ⇒ nil
-
#shutdown ⇒ nil
De-intializes the GSF library Currently does nothing.
-
#shutdown_dynamic(module) ⇒ nil
De-intializes the GSF library from a type module.
-
#value_get_docprop_array(value) ⇒ Array<GObject::Value>
This function returns the array of values inside Gsf::DocPropVector.
- #value_get_docprop_varray(value) ⇒ GObject::ValueArray
-
#value_get_docprop_vector(value) ⇒ Gsf::DocPropVector
This function returns a pointer to the GsfDocPropVector structure in value.
-
#vba_inflate(input, offset, size, add_null_terminator) ⇒ Integer
Decompresses VBA stream.
-
#xml_gvalue_from_str(res, t, str) ⇒ Boolean
Try to parse str as a value of type t into res.
-
#xml_parser_context(input) ⇒ Gsf::
Create a libxml2 pull style parser context wrapper around gsf input input.
-
#xml_probe(input, func) ⇒ Boolean
TRUE on success.
-
#xmlDocFormatDump(output, cur, encoding, format) ⇒ Integer
Dumps the document cur into output.
Class Method Details
.const_missing(name) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/gsf.rb', line 26 def const_missing(name) init if const_defined?(name) const_get(name) else super end end |
.init ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/gsf.rb', line 35 def init class << self remove_method(:init) remove_method(:const_missing) end Gio.init if Gio.respond_to?(:init) loader = Loader.new(self) loader.load("Gsf") end |
Instance Method Details
#base64_decode_simple(data, len) ⇒ Integer
Decodes a chunk of base64 encoded data from data back into data.
#base64_decode_step(in, len, out, state, save) ⇒ Integer
Decodes a chunk of base64 encoded data
#base64_encode_close(in, inlen, break_lines, out, state, save) ⇒ Integer
This funcion should be called to when finished encoding everything, to flush off the last little bit.
#base64_encode_simple(data, len) ⇒ Integer
Encodes data from data back into data using base64 encoding.
#base64_encode_step(in, len, break_lines, out, state, save) ⇒ Integer
Performs an 'encode step', only encodes blocks of 3 characters from in into the output out at a time, saves left-over state in state and save (initialise to 0 on first invocation).
#debug_flag(flag) ⇒ Boolean
#doc_meta_dump(meta) ⇒ nil
A debugging utility to dump the content of meta via g_print
#error_quark ⇒ GLib::Quark
Returns the #GQuark used to identify libgsf errors in #GError structures. Specific error codes come from the Gsf::Error enumeration.
#extension_pointer(path) ⇒ String
Extracts the extension from the end of a filename (the part after the final '.' in the filename). filename, or a pointer to the end of the string if the filename does not have an extension.
#filename_to_utf8(filename, quoted) ⇒ String
A utility wrapper to make sure filenames are valid utf8. Caller must g_free the result.
#iconv_close(handle) ⇒ nil
A utility wrapper to safely close an iconv handle.
#init ⇒ nil
Initializes the GSF library
#init_dynamic(module) ⇒ nil
Initializes the GSF library and associates it with a type module mod.
#le_get_double(p) ⇒ Float
Interpret binary data as a double in little endian order.
#le_get_float(p) ⇒ Gsf::gfloat
Interpret binary data as a float in little endian order.
#le_get_guint64(p) ⇒ Integer
Interpret binary data as a guint64 (8 byte unsigned integer type) in little endian order.
#le_set_double(p, d) ⇒ nil
Store a value of type double in memory in little endian order
#le_set_float(p, f) ⇒ nil
Store a value of type float in memory in little endian order.
#mem_dump(ptr, len) ⇒ nil
Dump len bytes from the memory location given by ptr.
#msole_codepage_to_lid(codepage) ⇒ Integer
#msole_iconv_open_codepage_for_export(codepage_to) ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
#msole_iconv_open_codepage_for_import(to, codepage) ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
#msole_iconv_open_codepages_for_export(codepage_to, from) ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
#msole_iconv_open_for_export ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
#msole_iconv_open_for_import(codepage) ⇒ GLib::IConv
NOTE: skipped since GIConv is not exported to introspection.
#msole_iconv_win_codepage ⇒ Integer
Returns our best guess at the applicable windows code page based on an environment variable or the current locale.
#msole_inflate(input, offset) ⇒ Array<Integer>
Decompresses an LZ compressed stream.
#msole_language_for_lid(lid) ⇒ String
xxx) for the given LID. If the LID is not found, is set to 0x0400, or is set to 0x0000, will return "-none-"
#msole_lid_for_language(lang) ⇒ Integer
Returns the LID (Language Identifier) for the input language. If lang is nil, return 0x0400 ("-none-"), and not 0x0000 ("no proofing").
#msole_lid_to_codepage(lid) ⇒ Integer
Returns our best guess at the codepage for the given language id.
#msole_lid_to_codepage_str(lid) ⇒ String
LID.
#odf_get_ns ⇒ Gsf::XMLInNS
Returns the used ODF namespace.
#odf_get_version ⇒ Gsf::gshort
Gives the ODF version used by libgsf when writing Open Document files.
#odf_get_version_string ⇒ String
Gives the ODF version used by libgsf when writing Open Document files.
#open_pkg_error_id ⇒ Integer
#open_pkg_foreach_rel(opkg, func, user_data) ⇒ nil
New in 1.14.9
Walks each relationship associated with opkg and calls func with user_data.
#open_pkg_lookup_rel_by_id(opkg, id) ⇒ Gsf::OpenPkgRel
New in 1.14.6
Finds opkg's relation with id
NOTE: skipping because gsf_open_pkg_rel_get_type() does not return a GType.
#open_pkg_lookup_rel_by_type(opkg, type) ⇒ Gsf::OpenPkgRel
New in 1.14.6
Finds a relation of opkg with type (no order is guaranteed)
NOTE: skipping because gsf_open_pkg_rel_get_type() does not return a GType.
#open_pkg_open_rel(opkg, rel) ⇒ Gsf::Input
Returns a new Gsf::Input which the called needs to unref, or nil and sets err.
#open_pkg_open_rel_by_id(opkg, id) ⇒ Gsf::Input
New in 1.14.7
Open opkg's relation id
#open_pkg_open_rel_by_type(opkg, type) ⇒ Gsf::Input
New in 1.14.9
Open one of opkg's relationships with type=type.
#open_pkg_parse_rel_by_id(xin, id, dtd, ns) ⇒ GLib::Error
Convenience function to parse a related part.
#property_settings_collect(object_type, p_params, p_n_params, first_property_name, array) ⇒ nil
#property_settings_collect_valist(object_type, p_params, p_n_params, first_property_name, var_args) ⇒ nil
This function builds a GParameter array suitable for g_object_newv.
#property_settings_find(name, params, n_params) ⇒ GObject::Parameter
#property_settings_free(params, n_params) ⇒ nil
#shutdown ⇒ nil
De-intializes the GSF library Currently does nothing.
#shutdown_dynamic(module) ⇒ nil
De-intializes the GSF library from a type module. Currently does nothing.
#value_get_docprop_array(value) ⇒ Array<GObject::Value>
This function returns the array of values inside Gsf::DocPropVector. No additional references are created. of #GValue
#value_get_docprop_varray(value) ⇒ GObject::ValueArray
#value_get_docprop_vector(value) ⇒ Gsf::DocPropVector
This function returns a pointer to the GsfDocPropVector structure in value. No additional references are created.
#vba_inflate(input, offset, size, add_null_terminator) ⇒ Integer
Decompresses VBA stream.
#xml_gvalue_from_str(res, t, str) ⇒ Boolean
Try to parse str as a value of type t into res. false otherwise.
#xml_parser_context(input) ⇒ Gsf::
Create a libxml2 pull style parser context wrapper around gsf input input. This signature will probably change to supply a SAX structure.
This adds a reference to input. A simple wrapper around a cleaner implementation that will fold in when we add other api changes. Its not worth bumping just for this.
NOTE: skipped since xmlParserCtxt is not exported to introspection.
#xml_probe(input, func) ⇒ Boolean
Returns TRUE on success.
#xmlDocFormatDump(output, cur, encoding, format) ⇒ Integer
Dumps the document cur into output.