本文整理汇总了C++中EvDocumentClass类的典型用法代码示例。如果您正苦于以下问题:C++ EvDocumentClass类的具体用法?C++ EvDocumentClass怎么用?C++ EvDocumentClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EvDocumentClass类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _ev_document_get_n_pages
static gint
_ev_document_get_n_pages (EvDocument *document)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
return klass->get_n_pages (document);
}
示例2: _ev_document_get_info
static EvDocumentInfo *
_ev_document_get_info (EvDocument *document)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
return klass->get_info (document);
}
示例3: ev_document_load_gfile
/**
* ev_document_load_gfile:
* @document: a #EvDocument
* @file: a #GFile
* @flags: flags from #EvDocumentLoadFlags
* @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): a #GError location to store an error, or %NULL
*
* Synchronously loads the document from @file.
* See ev_document_load() for more information.
*
* Returns: %TRUE if loading succeeded, or %FALSE on error with @error filled in
*
* Since: 3.6
*/
gboolean
ev_document_load_gfile (EvDocument *document,
GFile *file,
EvDocumentLoadFlags flags,
GCancellable *cancellable,
GError **error)
{
EvDocumentClass *klass;
EvDocumentPrivate *priv;
g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
klass = EV_DOCUMENT_GET_CLASS (document);
if (!klass->load_gfile) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"Backend does not support loading from GFile");
return FALSE;
}
if (!klass->load_gfile (document, file, flags, cancellable, error))
return FALSE;
ev_document_setup_cache (document);
priv = document->priv;
priv->uri = g_file_get_uri (file);
priv->info = _ev_document_get_info (document);
return TRUE;
}
示例4: _ev_document_support_synctex
static gboolean
_ev_document_support_synctex (EvDocument *document)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
return klass->support_synctex ? klass->support_synctex (document) : FALSE;
}
示例5: ev_document_load_stream
/**
* ev_document_load_stream:
* @document: a #EvDocument
* @stream: a #GInputStream
* @flags: flags from #EvDocumentLoadFlags
* @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): a #GError location to store an error, or %NULL
*
* Synchronously loads the document from @stream.
* See ev_document_load() for more information.
*
* Returns: %TRUE if loading succeeded, or %FALSE on error with @error filled in
*
* Since: 3.6
*/
gboolean
ev_document_load_stream (EvDocument *document,
GInputStream *stream,
EvDocumentLoadFlags flags,
GCancellable *cancellable,
GError **error)
{
EvDocumentClass *klass;
g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE);
g_return_val_if_fail (G_IS_INPUT_STREAM (stream), FALSE);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
klass = EV_DOCUMENT_GET_CLASS (document);
if (!klass->load_stream) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"Backend does not support loading from stream");
return FALSE;
}
if (!klass->load_stream (document, stream, flags, cancellable, error))
return FALSE;
ev_document_setup_cache (document);
return TRUE;
}
示例6: ev_document_load
/**
* ev_document_load:
* @document: a #EvDocument
* @uri: the document's URI
* @error: a #GError location to store an error, or %NULL
*
* Loads @document from @uri.
*
* On failure, %FALSE is returned and @error is filled in.
* If the document is encrypted, EV_DEFINE_ERROR_ENCRYPTED is returned.
* If the backend cannot load the specific document, EV_DOCUMENT_ERROR_INVALID
* is returned. Other errors are possible too, depending on the backend
* used to load the document and the URI, e.g. #GIOError, #GFileError, and
* #GConvertError.
*
* Returns: %TRUE on success, or %FALSE on failure.
*/
gboolean
ev_document_load (EvDocument *document,
const char *uri,
GError **error)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
gboolean retval;
GError *err = NULL;
retval = klass->load (document, uri, &err);
if (!retval) {
if (err) {
g_propagate_error (error, err);
} else {
g_warning ("%s::EvDocument::load returned FALSE but did not fill in @error; fix the backend!\n",
G_OBJECT_TYPE_NAME (document));
/* So upper layers don't crash */
g_set_error_literal (error,
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
"Internal error in backend");
}
} else {
ev_document_setup_cache (document);
document->priv->uri = g_strdup (uri);
ev_document_initialize_synctex (document, uri);
}
return retval;
}
示例7: ev_document_render
cairo_surface_t *
ev_document_render (EvDocument *document,
EvRenderContext *rc)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
return klass->render (document, rc);
}
示例8: ev_document_get_page
/**
* ev_document_get_page:
* @document: a #EvDocument
* @index: index of page
*
* Returns: (transfer full): Newly created #EvPage for the given index.
*/
EvPage *
ev_document_get_page (EvDocument *document,
gint index)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
return klass->get_page (document, index);
}
示例9: _ev_document_get_page_label
static gchar *
_ev_document_get_page_label (EvDocument *document,
EvPage *page)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
return klass->get_page_label ?
klass->get_page_label (document, page) : NULL;
}
示例10: ev_document_save
/**
* ev_document_save:
* @document: a #EvDocument
* @uri: the target URI
* @error: a #GError location to store an error, or %NULL
*
* Saves @document to @uri.
*
* Returns: %TRUE on success, or %FALSE on error with @error filled in
*/
gboolean
ev_document_save (EvDocument *document,
const char *uri,
GError **error)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
return klass->save (document, uri, error);
}
示例11: _ev_document_get_page_size
static void
_ev_document_get_page_size (EvDocument *document,
EvPage *page,
double *width,
double *height)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
klass->get_page_size (document, page, width, height);
}
示例12: ev_document_get_thumbnail
/**
* ev_document_get_thumbnail:
* @document: an #EvDocument
* @rc: an #EvRenderContext
*
* Returns: (transfer full): a #GdkPixbuf
*/
GdkPixbuf *
ev_document_get_thumbnail (EvDocument *document,
EvRenderContext *rc)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
if (klass->get_thumbnail)
return klass->get_thumbnail (document, rc);
return _ev_document_get_thumbnail (document, rc);
}
示例13: ev_document_get_backend_info
gboolean
ev_document_get_backend_info (EvDocument *document, EvDocumentBackendInfo *info)
{
g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE);
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
if (klass->get_backend_info == NULL)
return FALSE;
return klass->get_backend_info (document, info);
}
示例14: ev_document_load
/**
* ev_document_load:
* @document: a #EvDocument
* @uri: the document's URI
* @error: a #GError location to store an error, or %NULL
*
* Loads @document from @uri.
*
* On failure, %FALSE is returned and @error is filled in.
* If the document is encrypted, EV_DEFINE_ERROR_ENCRYPTED is returned.
* If the backend cannot load the specific document, EV_DOCUMENT_ERROR_INVALID
* is returned. Other errors are possible too, depending on the backend
* used to load the document and the URI, e.g. #GIOError, #GFileError, and
* #GConvertError.
*
* Returns: %TRUE on success, or %FALSE on failure.
*/
gboolean
ev_document_load (EvDocument *document,
const char *uri,
GError **error)
{
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
gboolean retval;
GError *err = NULL;
retval = klass->load (document, uri, &err);
if (!retval) {
if (err) {
g_propagate_error (error, err);
} else {
g_warning ("%s::EvDocument::load returned FALSE but did not fill in @error; fix the backend!\n",
G_OBJECT_TYPE_NAME (document));
/* So upper layers don't crash */
g_set_error_literal (error,
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
"Internal error in backend");
}
} else {
EvDocumentPrivate *priv = document->priv;
ev_document_setup_cache (document);
priv->uri = g_strdup (uri);
priv->info = _ev_document_get_info (document);
if (_ev_document_support_synctex (document)) {
gchar *filename;
filename = g_filename_from_uri (uri, NULL, NULL);
if (filename != NULL) {
priv->synctex_scanner =
synctex_scanner_new_with_output_file (filename, NULL, 1);
g_free (filename);
}
}
}
return retval;
}