Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EvBrowserPlugin Class Reference

#include <EvBrowserPlugin.h>

+ Inheritance diagram for EvBrowserPlugin:
+ Collaboration diagram for EvBrowserPlugin:

Public Types

enum  SearchDirection { Next, Previous }
 

Public Member Functions

NPError initialize (NPMIMEType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *)
 
NPError setWindow (NPWindow *)
 
NPError newStream (NPMIMEType, NPStream *, NPBool seekable, uint16_t *stype)
 
NPError destroyStream (NPStream *, NPReason)
 
void streamAsFile (NPStream *, const char *fname)
 
int32_t writeReady (NPStream *)
 
int32_t write (NPStream *, int32_t offset, int32_t len, void *buffer)
 
void print (NPPrint *)
 
int16_t handleEvent (XEvent *)
 
void urlNotify (const char *url, NPReason, void *notifyData)
 
EvDocumentModelmodel () const
 
unsigned currentPage () const
 
unsigned pageCount () const
 
double zoom () const
 
void setZoom (double scale)
 
void goToPreviousPage ()
 
void goToNextPage ()
 
void goToPage (unsigned page)
 
void goToPage (const char *pageLabel)
 
void activateLink (EvLink *)
 
bool isContinuous () const
 
void setContinuous (bool)
 
void toggleContinuous ()
 
bool isDual () const
 
void setDual (bool)
 
void toggleDual ()
 
void zoomIn ()
 
void zoomOut ()
 
EvSizingMode sizingMode () const
 
void setSizingMode (EvSizingMode)
 
void download () const
 
void print () const
 
bool toolbarVisible () const
 
void setToolbarVisible (bool)
 
bool canDownload () const
 
void setSearchModeEnabled (bool)
 
void search (EvJobFind *)
 
void search (SearchDirection)
 
void clearSearch ()
 
void restartSearch ()
 

Static Public Member Functions

static EvBrowserPlugincreate (NPP)
 
static const char * nameString ()
 
static const char * descriptionString ()
 

Private Member Functions

 EvBrowserPlugin (NPP)
 
virtual ~EvBrowserPlugin ()
 

Static Private Member Functions

static NPObjectallocate (NPP, NPClass *)
 
static void deallocate (NPObject *)
 
static void invalidate (NPObject *)
 
static bool hasMethod (NPObject *, NPIdentifier name)
 
static bool invoke (NPObject *, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result)
 
static bool hasProperty (NPObject *, NPIdentifier name)
 
static bool getProperty (NPObject *, NPIdentifier name, NPVariant *)
 
static bool setProperty (NPObject *, NPIdentifier name, const NPVariant *)
 

Private Attributes

NPP m_NPP
 
GtkWidget * m_window
 
EvDocumentModelm_model
 
EvViewm_view
 
GtkWidget * m_toolbar
 
unique_gptr< char > m_url
 

Static Private Attributes

static EvBrowserPluginClass s_pluginClass
 

Additional Inherited Members

- Data Fields inherited from NPObject
NPClass_class
 
uint32_t referenceCount
 

Detailed Description

Definition at line 31 of file EvBrowserPlugin.h.

Member Enumeration Documentation

Enumerator
Next 
Previous 

Definition at line 80 of file EvBrowserPlugin.h.

80 { Next, Previous };

Constructor & Destructor Documentation

EvBrowserPlugin::EvBrowserPlugin ( NPP  instance)
private

Definition at line 89 of file EvBrowserPlugin.cpp.

90  : m_NPP(instance)
91  , m_window(nullptr)
92  , m_model(nullptr)
93  , m_view(nullptr)
94  , m_toolbar(nullptr)
95 {
96  m_NPP->pdata = this;
97 }

+ Here is the caller graph for this function:

EvBrowserPlugin::~EvBrowserPlugin ( )
privatevirtual

Definition at line 99 of file EvBrowserPlugin.cpp.

100 {
101  if (m_window)
102  gtk_widget_destroy(m_window);
103  g_clear_object(&m_model);
104  m_NPP->pdata = nullptr;
105 }

Member Function Documentation

void EvBrowserPlugin::activateLink ( EvLink link)

Definition at line 348 of file EvBrowserPlugin.cpp.

349 {
350  g_return_if_fail(EV_IS_VIEW(m_view));
351  g_return_if_fail(EV_IS_LINK(link));
353  gtk_widget_grab_focus(GTK_WIDGET(m_view));
354 }

+ Here is the caller graph for this function:

NPObject * EvBrowserPlugin::allocate ( NPP  instance,
NPClass  
)
staticprivate

Definition at line 517 of file EvBrowserPlugin.cpp.

518 {
519  return new EvBrowserPlugin(instance);
520 }
bool EvBrowserPlugin::canDownload ( ) const

Definition at line 461 of file EvBrowserPlugin.cpp.

462 {
463  // Download is only available for Epiphany for now.
464  return g_strrstr(NPN_UserAgent(m_NPP), "Epiphany");
465 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::clearSearch ( )

Definition at line 505 of file EvBrowserPlugin.cpp.

506 {
508  gtk_widget_queue_draw(GTK_WIDGET(m_view));
509 }

+ Here is the caller graph for this function:

EvBrowserPlugin * EvBrowserPlugin::create ( NPP  instance)
static

Definition at line 74 of file EvBrowserPlugin.cpp.

75 {
76  return s_pluginClass.createObject(instance);
77 }

+ Here is the caller graph for this function:

unsigned EvBrowserPlugin::currentPage ( ) const

Definition at line 298 of file EvBrowserPlugin.cpp.

299 {
300  g_return_val_if_fail(EV_IS_DOCUMENT_MODEL(m_model), 0);
302 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::deallocate ( NPObject npObject)
staticprivate

Definition at line 522 of file EvBrowserPlugin.cpp.

523 {
524  delete static_cast<EvBrowserPlugin *>(npObject);
525 }
const char * EvBrowserPlugin::descriptionString ( )
static

Definition at line 84 of file EvBrowserPlugin.cpp.

85 {
86  return "The <a href=\"http://wiki.gnome.org/Apps/Evince/\">Evince</a> " PACKAGE_VERSION " plugin handles documents inside the browser window.";
87 }

+ Here is the caller graph for this function:

NPError EvBrowserPlugin::destroyStream ( NPStream ,
NPReason   
)

Definition at line 247 of file EvBrowserPlugin.cpp.

248 {
249  return NPERR_NO_ERROR;
250 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::download ( ) const

Definition at line 418 of file EvBrowserPlugin.cpp.

419 {
420  g_return_if_fail(m_url);
421  // Since I don't know how to force a download in the browser, I use
422  // a special frame name here that Epiphany will check in the new window policy
423  // callback to start the download.
424  NPN_GetURL(m_NPP, m_url.get(), "_evince_download");
425 }

+ Here is the caller graph for this function:

bool EvBrowserPlugin::getProperty ( NPObject npObject,
NPIdentifier  name,
NPVariant value 
)
staticprivate

Definition at line 604 of file EvBrowserPlugin.cpp.

605 {
606  EvBrowserPlugin *plugin = static_cast<EvBrowserPlugin *>(npObject);
607 
608  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::CurrentPage]) {
609  INT32_TO_NPVARIANT(plugin->currentPage() + 1, *value);
610  return true;
611  }
612  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::PageCount]) {
613  INT32_TO_NPVARIANT(plugin->pageCount(), *value);
614  return true;
615  }
616  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::Zoom]) {
617  DOUBLE_TO_NPVARIANT(plugin->zoom(), *value);
618  return true;
619  }
620  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::ZoomMode]) {
621  const char *zoomMode;
622 
623  switch (plugin->sizingMode()) {
624  case EV_SIZING_FREE:
625  zoomMode = "none";
626  break;
627  case EV_SIZING_FIT_PAGE:
628  zoomMode = "fit-page";
629  break;
630  case EV_SIZING_FIT_WIDTH:
631  zoomMode = "fit-width";
632  break;
633  case EV_SIZING_AUTOMATIC:
634  zoomMode = "auto";
635  break;
636  default:
637  return false;
638  }
639 
640  size_t zoomModeLength = strlen(zoomMode);
641  char *result = static_cast<char *>(NPN_MemAlloc(zoomModeLength + 1));
642  memcpy(result, zoomMode, zoomModeLength);
643  result[zoomModeLength] = '\0';
644 
645  STRINGZ_TO_NPVARIANT(result, *value);
646 
647  return true;
648  }
649  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::Continuous]) {
650  BOOLEAN_TO_NPVARIANT(plugin->isContinuous(), *value);
651  return true;
652  }
653  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::Dual]) {
654  BOOLEAN_TO_NPVARIANT(plugin->isDual(), *value);
655  return true;
656  }
657  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::Toolbar]) {
658  BOOLEAN_TO_NPVARIANT(plugin->toolbarVisible(), *value);
659  return true;
660  }
661 
662  return false;
663 }
void EvBrowserPlugin::goToNextPage ( )

Definition at line 330 of file EvBrowserPlugin.cpp.

+ Here is the caller graph for this function:

void EvBrowserPlugin::goToPage ( unsigned  page)

Definition at line 336 of file EvBrowserPlugin.cpp.

337 {
338  g_return_if_fail(EV_IS_DOCUMENT_MODEL(m_model));
340 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::goToPage ( const char *  pageLabel)

Definition at line 342 of file EvBrowserPlugin.cpp.

343 {
344  g_return_if_fail(EV_IS_DOCUMENT_MODEL(m_model));
346 }
void EvBrowserPlugin::goToPreviousPage ( )

Definition at line 324 of file EvBrowserPlugin.cpp.

int16_t EvBrowserPlugin::handleEvent ( XEvent )

Definition at line 288 of file EvBrowserPlugin.cpp.

289 {
290  return 0;
291 }

+ Here is the caller graph for this function:

bool EvBrowserPlugin::hasMethod ( NPObject npObject,
NPIdentifier  name 
)
staticprivate

Definition at line 531 of file EvBrowserPlugin.cpp.

532 {
533  for (unsigned i = 0; i < EvBrowserPluginClass::Methods::NumMethodIdentifiers; ++i) {
535  if (i == EvBrowserPluginClass::Methods::Download)
536  return static_cast<EvBrowserPlugin *>(npObject)->canDownload();
537  return true;
538  }
539  }
540  return false;
541 }
bool EvBrowserPlugin::hasProperty ( NPObject npObject,
NPIdentifier  name 
)
staticprivate

Definition at line 595 of file EvBrowserPlugin.cpp.

596 {
597  for (unsigned i = 0; i < EvBrowserPluginClass::Properties::NumPropertyIdentifiers; ++i) {
599  return true;
600  }
601  return false;
602 }
NPError EvBrowserPlugin::initialize ( NPMIMEType  ,
uint16_t  mode,
int16_t  argc,
char *  argn[],
char *  argv[],
NPSavedData  
)

Definition at line 168 of file EvBrowserPlugin.cpp.

169 {
170  // Default values.
171  bool toolbarVisible = true;
172  unsigned currentPage = 1;
174  bool continuous = true;
175  bool dual = false;
176  double zoom = 0;
177 
178  for (int16_t i = 0; i < argc; ++i) {
179  if (g_ascii_strcasecmp(argn[i], "toolbar") == 0)
180  parseBoolean(argv[i], toolbarVisible);
181  else if (g_ascii_strcasecmp(argn[i], "currentpage") == 0)
182  parseInteger<unsigned>(argv[i], currentPage);
183  else if (g_ascii_strcasecmp(argn[i], "zoom") == 0)
184  parseDouble(argv[i], zoom);
185  else if (g_ascii_strcasecmp(argn[i], "zoommode") == 0)
186  parseZoomMode(argv[i], sizingMode);
187  else if (g_ascii_strcasecmp(argn[i], "continuous") == 0)
188  parseBoolean(argv[i], continuous);
189  else if (g_ascii_strcasecmp(argn[i], "dual") == 0)
190  parseBoolean(argv[i], dual);
191  }
192 
194  if (currentPage > 0)
195  ev_document_model_set_page(m_model, currentPage - 1);
198  if (zoom) {
201  } else
203 
206 
208  if (toolbarVisible)
209  gtk_widget_show(m_toolbar);
210 
211  return NPERR_NO_ERROR;
212 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::invalidate ( NPObject )
staticprivate

Definition at line 527 of file EvBrowserPlugin.cpp.

528 {
529 }
bool EvBrowserPlugin::invoke ( NPObject npObject,
NPIdentifier  name,
const NPVariant args,
uint32_t  argCount,
NPVariant result 
)
staticprivate

Definition at line 543 of file EvBrowserPlugin.cpp.

544 {
545  EvBrowserPlugin *plugin = static_cast<EvBrowserPlugin *>(npObject);
546 
547  if (name == s_pluginClass.methodIdentifiers[EvBrowserPluginClass::Methods::GoToPage]) {
548  if (argCount != 1)
549  return false;
550 
551  if (NPVARIANT_IS_DOUBLE(args[0]))
552  plugin->goToPage(static_cast<unsigned>(NPVARIANT_TO_DOUBLE(args[0])));
553  else if (NPVARIANT_IS_STRING(args[0])) {
554  unique_gptr<char> pageLabel(g_strndup(NPVARIANT_TO_STRING(args[0]).UTF8Characters, NPVARIANT_TO_STRING(args[0]).UTF8Length));
555  plugin->goToPage(pageLabel.get());
556  } else
557  return false;
558 
559  VOID_TO_NPVARIANT(*result);
560  return true;
561  }
562  if (name == s_pluginClass.methodIdentifiers[EvBrowserPluginClass::Methods::ToggleContinuous]) {
563  plugin->toggleContinuous();
564  VOID_TO_NPVARIANT(*result);
565  return true;
566  }
567  if (name == s_pluginClass.methodIdentifiers[EvBrowserPluginClass::Methods::ToggleDual]) {
568  plugin->toggleDual();
569  VOID_TO_NPVARIANT(*result);
570  return true;
571  }
572  if (name == s_pluginClass.methodIdentifiers[EvBrowserPluginClass::Methods::ZoomIn]) {
573  plugin->zoomIn();
574  VOID_TO_NPVARIANT(*result);
575  return true;
576  }
577  if (name == s_pluginClass.methodIdentifiers[EvBrowserPluginClass::Methods::ZoomOut]) {
578  plugin->zoomOut();
579  VOID_TO_NPVARIANT(*result);
580  return true;
581  }
582  if (name == s_pluginClass.methodIdentifiers[EvBrowserPluginClass::Methods::Download]) {
583  plugin->download();
584  VOID_TO_NPVARIANT(*result);
585  return true;
586  }
587  if (name == s_pluginClass.methodIdentifiers[EvBrowserPluginClass::Methods::Print]) {
588  plugin->print();
589  VOID_TO_NPVARIANT(*result);
590  return true;
591  }
592  return false;
593 }
bool EvBrowserPlugin::isContinuous ( ) const

Definition at line 356 of file EvBrowserPlugin.cpp.

357 {
358  g_return_val_if_fail(EV_IS_DOCUMENT_MODEL(m_model), false);
360 }

+ Here is the caller graph for this function:

bool EvBrowserPlugin::isDual ( ) const

Definition at line 374 of file EvBrowserPlugin.cpp.

375 {
376  g_return_val_if_fail(EV_IS_DOCUMENT_MODEL(m_model), false);
378 }

+ Here is the caller graph for this function:

EvDocumentModel* EvBrowserPlugin::model ( ) const
inline

Definition at line 51 of file EvBrowserPlugin.h.

51 { return m_model; }

+ Here is the caller graph for this function:

const char * EvBrowserPlugin::nameString ( )
static

Definition at line 79 of file EvBrowserPlugin.cpp.

80 {
81  return "Evince Browser Plugin";
82 }

+ Here is the caller graph for this function:

NPError EvBrowserPlugin::newStream ( NPMIMEType  ,
NPStream stream,
NPBool  seekable,
uint16_t *  stype 
)

Definition at line 240 of file EvBrowserPlugin.cpp.

241 {
242  m_url.reset(g_strdup(stream->url));
243  *stype = NP_ASFILEONLY;
244  return NPERR_NO_ERROR;
245 }

+ Here is the caller graph for this function:

unsigned EvBrowserPlugin::pageCount ( ) const

Definition at line 304 of file EvBrowserPlugin.cpp.

305 {
306  g_return_val_if_fail(EV_IS_DOCUMENT_MODEL(m_model), 0);
308  return document ? ev_document_get_n_pages(document) : 0;
309 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::print ( NPPrint )

Definition at line 283 of file EvBrowserPlugin.cpp.

284 {
285 
286 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::print ( ) const

Definition at line 427 of file EvBrowserPlugin.cpp.

428 {
429  g_return_if_fail(EV_IS_DOCUMENT_MODEL(m_model));
430 
432  if (!document)
433  return;
434 
435  EvPrintOperation *printOperation = ev_print_operation_new(document);
436  if (!printOperation)
437  return;
438 
439  unique_gptr<char> outputBasename(g_path_get_basename(m_url.get()));
440  if (char *dot = g_strrstr(outputBasename.get(), "."))
441  dot[0] = '\0';
442 
443  unique_gptr<char> unescapedBasename(g_uri_unescape_string(outputBasename.get(), nullptr));
444  // Set output basename for printing to file.
445  GtkPrintSettings *printSettings = gtk_print_settings_new();
446  gtk_print_settings_set(printSettings, GTK_PRINT_SETTINGS_OUTPUT_BASENAME, unescapedBasename.get());
447 
448  if (const char *title = ev_document_get_title(document))
449  ev_print_operation_set_job_name(printOperation, title);
452  ev_print_operation_set_print_settings(printOperation, printSettings);
453  g_object_unref(printSettings);
454 
455  g_signal_connect(printOperation, "done", G_CALLBACK(g_object_unref), nullptr);
456 
457  GtkWidget *toplevel = gtk_widget_get_toplevel(GTK_WIDGET(m_view));
458  ev_print_operation_run(printOperation, GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : nullptr);
459 }
void EvBrowserPlugin::restartSearch ( )

Definition at line 511 of file EvBrowserPlugin.cpp.

+ Here is the caller graph for this function:

void EvBrowserPlugin::search ( EvJobFind job)

Definition at line 487 of file EvBrowserPlugin.cpp.

488 {
491 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::search ( SearchDirection  direction)

Definition at line 493 of file EvBrowserPlugin.cpp.

494 {
495  switch (direction) {
496  case Next:
498  break;
499  case Previous:
501  break;
502  }
503 }
void EvBrowserPlugin::setContinuous ( bool  continuous)

Definition at line 362 of file EvBrowserPlugin.cpp.

363 {
364  g_return_if_fail(EV_IS_DOCUMENT_MODEL(m_model));
366 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::setDual ( bool  dual)

Definition at line 380 of file EvBrowserPlugin.cpp.

+ Here is the caller graph for this function:

bool EvBrowserPlugin::setProperty ( NPObject npObject,
NPIdentifier  name,
const NPVariant value 
)
staticprivate

Definition at line 665 of file EvBrowserPlugin.cpp.

666 {
667  EvBrowserPlugin *plugin = static_cast<EvBrowserPlugin *>(npObject);
668 
669  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::CurrentPage]) {
670  plugin->goToPage(static_cast<unsigned>(NPVARIANT_TO_DOUBLE(*value)));
671  return true;
672  }
673  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::Zoom]) {
674  plugin->setZoom(NPVARIANT_TO_DOUBLE(*value));
675  return true;
676  }
677  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::ZoomMode]) {
678  unique_gptr<char> zoomMode(g_strndup(NPVARIANT_TO_STRING(*value).UTF8Characters, NPVARIANT_TO_STRING(*value).UTF8Length));
679 
680  if (g_strcmp0(zoomMode.get(), "none") == 0)
681  plugin->setSizingMode(EV_SIZING_FREE);
682  else if (g_strcmp0(zoomMode.get(), "fit-page") == 0)
684  else if (g_strcmp0(zoomMode.get(), "fit-width") == 0)
686  else if (g_strcmp0(zoomMode.get(), "auto") == 0)
688  else
689  return false;
690 
691  return true;
692  }
693  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::Continuous]) {
694  plugin->setContinuous(NPVARIANT_TO_BOOLEAN(*value));
695  return true;
696  }
697  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::Dual]) {
698  plugin->setDual(NPVARIANT_TO_BOOLEAN(*value));
699  return true;
700  }
701  if (name == s_pluginClass.propertyIdentifiers[EvBrowserPluginClass::Properties::Toolbar]) {
702  plugin->setToolbarVisible(NPVARIANT_TO_BOOLEAN(*value));
703  return true;
704  }
705 
706  return false;
707 }
void EvBrowserPlugin::setSearchModeEnabled ( bool  enabled)

Definition at line 482 of file EvBrowserPlugin.cpp.

483 {
485 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::setSizingMode ( EvSizingMode  sizingMode)

Definition at line 412 of file EvBrowserPlugin.cpp.

413 {
414  g_return_if_fail(EV_IS_DOCUMENT_MODEL(m_model));
416 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::setToolbarVisible ( bool  isVisible)

Definition at line 473 of file EvBrowserPlugin.cpp.

474 {
475  g_return_if_fail(EV_IS_BROWSER_PLUGIN_TOOLBAR(m_toolbar));
476  if (isVisible)
477  gtk_widget_show(m_toolbar);
478  else
479  gtk_widget_hide(m_toolbar);
480 }

+ Here is the caller graph for this function:

NPError EvBrowserPlugin::setWindow ( NPWindow window)

Definition at line 214 of file EvBrowserPlugin.cpp.

215 {
216  if (!m_window) {
217  m_window = gtk_plug_new(reinterpret_cast<Window>(window->window));
218  gtk_widget_realize(m_window);
219 
220  GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
221  gtk_box_pack_start(GTK_BOX(vbox), m_toolbar, FALSE, FALSE, 0);
222 
223  GtkWidget *scrolledWindow = gtk_scrolled_window_new(nullptr, nullptr);
224  gtk_container_add(GTK_CONTAINER(scrolledWindow), GTK_WIDGET(m_view));
225  gtk_widget_show(GTK_WIDGET(m_view));
226 
227  gtk_box_pack_start(GTK_BOX(vbox), scrolledWindow, TRUE, TRUE, 0);
228  gtk_widget_show(scrolledWindow);
229 
230  gtk_container_add(GTK_CONTAINER(m_window), vbox);
231  gtk_widget_show(vbox);
232  }
233 
234  gtk_widget_set_size_request(m_window, window->width, window->height);
235  gtk_widget_show(m_window);
236 
237  return NPERR_NO_ERROR;
238 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::setZoom ( double  scale)

Definition at line 317 of file EvBrowserPlugin.cpp.

+ Here is the caller graph for this function:

EvSizingMode EvBrowserPlugin::sizingMode ( ) const

Definition at line 406 of file EvBrowserPlugin.cpp.

407 {
408  g_return_val_if_fail(EV_IS_DOCUMENT_MODEL(m_model), EV_SIZING_FREE);
410 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::streamAsFile ( NPStream ,
const char *  fname 
)

Definition at line 252 of file EvBrowserPlugin.cpp.

253 {
254  GFile *file = g_file_new_for_commandline_arg(fname);
255  unique_gptr<char> uri(g_file_get_uri(file));
256  g_object_unref(file);
257 
258  // Load the document synchronously here because the temporary file created by the browser
259  // is deleted when this function returns.
260  GError *error = nullptr;
262  if (!document) {
263  g_printerr("Error loading document %s: %s\n", uri.get(), error->message);
264  g_error_free(error);
265  } else {
267  g_object_unref(document);
268 
270  }
271 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::toggleContinuous ( )

Definition at line 368 of file EvBrowserPlugin.cpp.

+ Here is the caller graph for this function:

void EvBrowserPlugin::toggleDual ( )

Definition at line 386 of file EvBrowserPlugin.cpp.

+ Here is the caller graph for this function:

bool EvBrowserPlugin::toolbarVisible ( ) const

Definition at line 467 of file EvBrowserPlugin.cpp.

468 {
469  g_return_val_if_fail(EV_IS_BROWSER_PLUGIN_TOOLBAR(m_toolbar), false);
470  return gtk_widget_get_visible(m_toolbar);
471 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::urlNotify ( const char *  url,
NPReason  ,
void *  notifyData 
)

Definition at line 293 of file EvBrowserPlugin.cpp.

294 {
295 
296 }

+ Here is the caller graph for this function:

int32_t EvBrowserPlugin::write ( NPStream ,
int32_t  offset,
int32_t  len,
void *  buffer 
)

Definition at line 278 of file EvBrowserPlugin.cpp.

279 {
280  return 0;
281 }

+ Here is the caller graph for this function:

int32_t EvBrowserPlugin::writeReady ( NPStream )

Definition at line 273 of file EvBrowserPlugin.cpp.

274 {
275  return 0;
276 }

+ Here is the caller graph for this function:

double EvBrowserPlugin::zoom ( ) const

Definition at line 311 of file EvBrowserPlugin.cpp.

312 {
313  g_return_val_if_fail(EV_IS_DOCUMENT_MODEL(m_model), 1);
315 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::zoomIn ( )

Definition at line 392 of file EvBrowserPlugin.cpp.

393 {
394  g_return_if_fail(EV_IS_VIEW(m_view));
397 }

+ Here is the caller graph for this function:

void EvBrowserPlugin::zoomOut ( )

Definition at line 399 of file EvBrowserPlugin.cpp.

400 {
401  g_return_if_fail(EV_IS_VIEW(m_view));
404 }

+ Here is the caller graph for this function:

Field Documentation

EvDocumentModel* EvBrowserPlugin::m_model
private

Definition at line 101 of file EvBrowserPlugin.h.

NPP EvBrowserPlugin::m_NPP
private

Definition at line 99 of file EvBrowserPlugin.h.

GtkWidget* EvBrowserPlugin::m_toolbar
private

Definition at line 103 of file EvBrowserPlugin.h.

unique_gptr<char> EvBrowserPlugin::m_url
private

Definition at line 104 of file EvBrowserPlugin.h.

EvView* EvBrowserPlugin::m_view
private

Definition at line 102 of file EvBrowserPlugin.h.

GtkWidget* EvBrowserPlugin::m_window
private

Definition at line 100 of file EvBrowserPlugin.h.

EvBrowserPluginClass EvBrowserPlugin::s_pluginClass
staticprivate

Definition at line 106 of file EvBrowserPlugin.h.


The documentation for this class was generated from the following files: