Public Member Functions | Private Member Functions | Private Attributes

PD_RDFSemanticItemViewSite Class Reference

Handling a specific reference to a semantic item in the document text. More...

#include <pd_DocumentRDF.h>

List of all members.

Public Member Functions

 PD_RDFSemanticItemViewSite (PD_RDFSemanticItemHandle si, const std::string &xmlid)
 Performing actions on a specific reference to a semantic item in the document.
 PD_RDFSemanticItemViewSite (PD_RDFSemanticItemHandle si, PT_DocPosition pos)
 ~PD_RDFSemanticItemViewSite ()
PD_RDFSemanticStylesheetHandle stylesheet () const
 The stylesheet that has been set for this view site.
void disassociateStylesheet ()
 If there is a stylesheet set for this view site it is forgotten and the reference can be freely edited by the user.
void applyStylesheet (FV_View *pView, PD_RDFSemanticStylesheetHandle ss)
 Apply a stylesheet for the semantic item.
void setStylesheetWithoutReflow (PD_RDFSemanticStylesheetHandle ss)
 Remember that a specific stylesheet should be applied for this semantic item.
void reflowUsingCurrentStylesheet (FV_View *pView)
 Reflow the text that shows the user this semantic item in the document.
void select (FV_View *pView)
 Select this view of the semantic item in the document.

Private Member Functions

PD_URI linkingSubject () const
 This is similar to the linkingSubject() used by PD_RDFSemanticItem in that you have:
std::string getProperty (const std::string &prop, const std::string &defval) const
 Convenience method to get a specific property from the Rdf model.
void setProperty (const std::string &prop, const std::string &v)
 Set the single value for the Rdf predicate prop.
void selectRange (FV_View *pView, std::pair< PT_DocPosition, PT_DocPosition > range)
 Convenience method to select a range in the document view.

Private Attributes

std::string m_xmlid
PD_RDFSemanticItemHandle m_semItem

Detailed Description

Handling a specific reference to a semantic item in the document text.

Author:
Ben Martin

There can be many references to a single PD_RDFSemanticItem in a document. One can consider PD_RDFSemanticItem to be the model and this class the view/controller (delegate).

For example: foaf pkg:idref frodo1 foaf pkg:idref frodo2

the foaf/contact data is the PD_RDFSemanticItem (model) and each xml:id, the frodo1 and frodo2 above, are PD_RDFSemanticItemViewSite instances. This class allows different stylesheets to offer different formatting for each presentation of the same PD_RDFSemanticItem (model).


Constructor & Destructor Documentation

PD_RDFSemanticItemViewSite::PD_RDFSemanticItemViewSite ( PD_RDFSemanticItemHandle  si,
const std::string &  xmlid 
)

Performing actions on a specific reference to a semantic item in the document.

PD_RDFSemanticItemViewSite::PD_RDFSemanticItemViewSite ( PD_RDFSemanticItemHandle  si,
PT_DocPosition  pos 
)

References m_semItem, and m_xmlid.

PD_RDFSemanticItemViewSite::~PD_RDFSemanticItemViewSite (  ) 

Member Function Documentation

void PD_RDFSemanticItemViewSite::applyStylesheet ( FV_View pView,
PD_RDFSemanticStylesheetHandle  ss 
)

Apply a stylesheet for the semantic item.

Note that the setting is rememebered for this site too.

The application can be done separately using the setStylesheetWithoutReflow() and reflowUsingCurrentStylesheet() methods. Performing the stylesheet application in two parts is convenient if you are applying a stylesheet to many semantic items at once, or to all the locations in the document which reference a single semanti item.

See also:
setStylesheetWithoutReflow()
reflowUsingCurrentStylesheet()

References m_xmlid, reflowUsingCurrentStylesheet(), setStylesheetWithoutReflow(), and UT_DEBUGMSG.

Referenced by _rdfApplyStylesheet().

void PD_RDFSemanticItemViewSite::disassociateStylesheet (  ) 

If there is a stylesheet set for this view site it is forgotten and the reference can be freely edited by the user.

References m_xmlid, setProperty(), and UT_DEBUGMSG.

std::string PD_RDFSemanticItemViewSite::getProperty ( const std::string &  prop,
const std::string &  defval 
) const [private]

Convenience method to get a specific property from the Rdf model.

There should be either zero or only one value for X in the triple:

linkingSubject(), prop, X

if the property does not exist defval is returned.

References linkingSubject(), and m_semItem.

Referenced by stylesheet().

PD_URI PD_RDFSemanticItemViewSite::linkingSubject (  )  const [private]

This is similar to the linkingSubject() used by PD_RDFSemanticItem in that you have:

linkingSubject() common::idref xml:id

but metadata about the site at xml:id is stored as properties off the PD_RDFSemanticItemViewSite::linkingSubject() subject.

The difference between this linkingSubject() and PD_RDFSemanticItem is that this is for RDF describing a single xml:id site in the document, the PD_RDFSemanticItem::linkingSubject() is the model for the semanitc item itself which can be referenced by many xml:id sites.

References m_semItem, and m_xmlid.

Referenced by getProperty(), and setProperty().

void PD_RDFSemanticItemViewSite::reflowUsingCurrentStylesheet ( FV_View pView  ) 

Reflow the text that shows the user this semantic item in the document.

See also:
applyStylesheet()

References m_semItem, m_xmlid, and stylesheet().

Referenced by ApplySemanticStylesheets(), and applyStylesheet().

void PD_RDFSemanticItemViewSite::select ( FV_View pView  ) 

Select this view of the semantic item in the document.

References m_semItem, and m_xmlid.

Referenced by Defun1().

void PD_RDFSemanticItemViewSite::selectRange ( FV_View pView,
std::pair< PT_DocPosition, PT_DocPosition range 
) [private]

Convenience method to select a range in the document view.

References FV_View::selectRange().

void PD_RDFSemanticItemViewSite::setProperty ( const std::string &  prop,
const std::string &  v 
) [private]

Set the single value for the Rdf predicate prop.

See also:
getProperty()

References linkingSubject(), and m_semItem.

Referenced by disassociateStylesheet(), and setStylesheetWithoutReflow().

void PD_RDFSemanticItemViewSite::setStylesheetWithoutReflow ( PD_RDFSemanticStylesheetHandle  ss  ) 

Remember that a specific stylesheet should be applied for this semantic item.

No reflow of the document is performed and thus no layout or user visible changes occur.

See also:
applyStylesheet()

References m_xmlid, setProperty(), and UT_DEBUGMSG.

Referenced by ApplySemanticStylesheets(), and applyStylesheet().

PD_RDFSemanticStylesheetHandle PD_RDFSemanticItemViewSite::stylesheet (  )  const

Member Data Documentation

std::string PD_RDFSemanticItemViewSite::m_xmlid [private]

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