CCInfoPlugin Class Reference

Base class for Creative Common Information Acrobat plugins. More...

#include <CCInfoPlugin.h>

Inherits AcrobatPluginInfo.

Inherited by CCInfoFullPlugin.

Collaboration diagram for CCInfoPlugin:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CCInfoPlugin ()
 Default constructor.
virtual ASBool PluginInit ()
 Called when the plugin is initialized; registers the command.
virtual ASBool ImportReplaceAndRegister ()
 Called after plugin is loaded but before it is initialized; registers notifications.
bool HasDocument () const
 Checks if there is currently a document.
bool HasLicense () const
 Checks if the current document has a license.
std::string GetLicenseText (bool *pbHasLicense=NULL)
 Retrieves the license text for the current document.
std::string GetLicenseURL () const
 Retrieves the license URL for the current document.
std::string GetStatementURL () const
 Retrieves the license statement URL for the current document.
virtual void ShowLicense ()=0
 Displays the license dialog.
virtual std::string GetPluginName () const =0
 Retrieve the plugin name.
virtual std::string GetPluginUIName () const =0
 Retrieve the displayed plugin name.
virtual void ShowAbout ()=0
 Retrieve the plugin name.

Protected Member Functions

void FrontDocChanged (AVDoc doc)
 Called when the Acrobat active document is changed.
void DocumentXAPChanged (PDDoc doc, ASText metadata)
 Called when the document's XAP data changes (reloads the license information).
void Clear ()
 Clears the cached document's data.
void UpdateMetadata (ASText metadata)
 Updates the cached document's license data from the XAP data sent.

Static Protected Member Functions

static void OnAppFrontDocDidChange (AVDoc doc, void *clientData)
 Acrobat callaback, called when the active document is replaced.
static void OnDocumentXAPChanged (PDDoc doc, ASText metadata, void *pClientData)
 Acrobat callaback, called when the XAP metadata is changed for the document.

Protected Attributes

XDoc m_docInfo
 Cached information about the current document's license.
bool m_bHasDocument
 true if there's a current document, false if not

Detailed Description

Base class for Creative Common Information Acrobat plugins.

Definition at line 88 of file CCInfoPlugin.h.


Member Function Documentation

void CCInfoPlugin::DocumentXAPChanged ( PDDoc  doc,
ASText  metadata 
) [protected]

Called when the document's XAP data changes (reloads the license information).

Parameters:
doc Reference to the Acrobat document that has been changed
metadata 

Definition at line 261 of file CCInfoPlugin.cpp.

References m_docInfo, and UpdateMetadata().

void CCInfoPlugin::FrontDocChanged ( AVDoc  doc  )  [protected]

Called when the Acrobat active document is changed.

Parameters:
doc Reference to the Acrobat document

Definition at line 213 of file CCInfoPlugin.cpp.

References Clear(), m_bHasDocument, and UpdateMetadata().

std::string CCInfoPlugin::GetLicenseText ( bool *  pbHasDocument = NULL  ) 

Retrieves the license text for the current document.

Parameters:
pbHasDocument Pointer to a flag to set if there's an active Acrobat document
Returns:
The text of the license, or "No License" if there's no license

Definition at line 279 of file CCInfoPlugin.cpp.

References AcrobatPluginInfo::LoadStringFromResource(), m_bHasDocument, m_docInfo, XML_DC_RIGHTS, XML_RDF_ALT, and XML_RDF_LI.

Referenced by LicenseDialog::UpdateLicenseInfo().

std::string CCInfoPlugin::GetLicenseURL (  )  const

Retrieves the license URL for the current document.

Returns:
The active Acrobat document's license URL (empty string if not found)

Definition at line 373 of file CCInfoPlugin.cpp.

References HasLicense(), m_docInfo, XML_CCLICENSE, and XML_RDF_RESROUCE.

Referenced by LicenseDialog::UpdateLicenseInfo().

std::string CCInfoPlugin::GetStatementURL (  )  const

Retrieves the license statement URL for the current document.

Returns:
The active Acrobat document's license statement URL (empty string if not found)

Definition at line 395 of file CCInfoPlugin.cpp.

References HasLicense(), m_docInfo, XML_RDF_DESCRIPTION, and XML_XAPRIGHTS_STATEMENT.

Referenced by LicenseDialog::UpdateLicenseInfo().

bool CCInfoPlugin::HasDocument (  )  const [inline]

Checks if there is currently a document.

Returns:
true if there's an active document in the Acrobat, false if not

Definition at line 116 of file CCInfoPlugin.h.

References m_bHasDocument.

Referenced by HasLicense(), and CCInfoFullPlugin::UpdateLicense().

bool CCInfoPlugin::HasLicense (  )  const

Checks if the current document has a license.

Returns:
true if the Acrobat's active document has license information, false if not

Definition at line 312 of file CCInfoPlugin.cpp.

References HasDocument(), m_docInfo, XML_RDF_DESCRIPTION, and XML_XAPRIGHTS_MARKED.

Referenced by GetLicenseURL(), and GetStatementURL().

ASBool CCInfoPlugin::ImportReplaceAndRegister (  )  [virtual]

Called after plugin is loaded but before it is initialized; registers notifications.

Returns:
true if initialized successfully, false if failed

Reimplemented from AcrobatPluginInfo.

Definition at line 168 of file CCInfoPlugin.cpp.

References AcrobatPluginInfo::ImportReplaceAndRegister(), OnAppFrontDocDidChange(), OnDocumentXAPChanged(), and AcrobatPluginInfo::RegisterNotification().

static void CCInfoPlugin::OnAppFrontDocDidChange ( AVDoc  doc,
void *  clientData 
) [inline, static, protected]

Acrobat callaback, called when the active document is replaced.

Parameters:
doc Acrobat document reference
clientData Pointer to client data (CCInfoPluginInfo in this case)

Definition at line 166 of file CCInfoPlugin.h.

Referenced by ImportReplaceAndRegister().

static void CCInfoPlugin::OnDocumentXAPChanged ( PDDoc  doc,
ASText  metadata,
void *  pClientData 
) [inline, static, protected]

Acrobat callaback, called when the XAP metadata is changed for the document.

Parameters:
doc Acrobat document reference
metadata The new metadata
pClientData Pointer to client data (CCInfoPluginInfo in this case)

Definition at line 173 of file CCInfoPlugin.h.

Referenced by ImportReplaceAndRegister().

ASBool CCInfoPlugin::PluginInit (  )  [virtual]

Called when the plugin is initialized; registers the command.

Returns:
true if initialized successfully, false if failed

Reimplemented from AcrobatPluginInfo.

Reimplemented in CCInfoFullPlugin.

Definition at line 190 of file CCInfoPlugin.cpp.

References AcrobatPluginInfo::m_commands, and AcrobatPluginInfo::PluginInit().

Referenced by CCInfoFullPlugin::PluginInit().

void CCInfoPlugin::UpdateMetadata ( ASText  metadata  )  [protected]

Updates the cached document's license data from the XAP data sent.

Parameters:
metadata The metadata as an Acrobat string object

Definition at line 333 of file CCInfoPlugin.cpp.

References m_docInfo.

Referenced by DocumentXAPChanged(), and FrontDocChanged().


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

Generated on Thu Dec 17 17:37:11 2009 for CCInfo PDF Plugin by doxygen 1.6.1