#include <gr_EmbedManager.h>
Public Member Functions | |
GR_EmbedManager (GR_Graphics *pG) | |
virtual | ~GR_EmbedManager () |
virtual const char * | getObjectType (void) const |
virtual const char * | getMimeType (void) const |
virtual const char * | getMimeTypeDescription (void) const |
virtual const char * | getMimeTypeSuffix (void) const |
virtual GR_EmbedManager * | create (GR_Graphics *pG) |
virtual void | initialize (void) |
GR_Graphics * | getGraphics (void) |
virtual void | setGraphics (GR_Graphics *pG) |
virtual UT_sint32 | makeEmbedView (AD_Document *pDoc, UT_uint32 api, const char *szDataID) |
virtual void | setColor (UT_sint32 uid, const UT_RGBColor &c) |
virtual UT_sint32 | getWidth (UT_sint32 uid) |
virtual UT_sint32 | getAscent (UT_sint32 uid) |
virtual UT_sint32 | getDescent (UT_sint32 uid) |
virtual void | loadEmbedData (UT_sint32 uid) |
virtual void | setDefaultFontSize (UT_sint32 uid, UT_sint32) |
virtual void | render (UT_sint32 uid, UT_Rect &rec) |
virtual void | releaseEmbedView (UT_sint32 uid) |
virtual void | initializeEmbedView (UT_sint32 uid) |
virtual void | makeSnapShot (UT_sint32 uid, UT_Rect &rec) |
virtual bool | isDefault (void) |
virtual bool | modify (UT_sint32 uid) |
virtual bool | changeAPI (UT_sint32 uid, UT_uint32 api) |
virtual bool | convert (UT_uint32 iConvType, const UT_ConstByteBufPtr &pFrom, const UT_ByteBufPtr &pTo) |
virtual bool | isEdittable (UT_sint32 uid) |
virtual bool | isResizeable (UT_sint32 uid) |
virtual void | setRun (UT_sint32 uid, fp_Run *run) |
virtual void | updateData (UT_sint32 uid, UT_sint32 api) |
virtual EV_EditMouseContext | getContextualMenu (void) const |
virtual bool | setFont (UT_sint32 uid, const GR_Font *pFont) |
virtual void | setDisplayMode (UT_sint32 uid, AbiDisplayMode mode) |
Private Attributes | |
GR_Graphics * | m_pG |
UT_GenericVector< GR_EmbedView * > | m_vecSnapshots |
GR_EmbedManager::GR_EmbedManager | ( | GR_Graphics * | pG | ) |
Create the EmbedManager class. pG is a pointer to the graphics class that will be drawn into.
References UT_GenericVector< T >::clear(), and m_vecSnapshots.
Referenced by create().
GR_EmbedManager::~GR_EmbedManager | ( | ) | [virtual] |
This method is called whenever there is a changeSpan or changeObject call on the embedded object. The properties of the object will be re-calculated.
References DELETEP, UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), GR_EmbedView::m_pPreview, m_vecSnapshots, UT_ASSERT, and UT_SHOULD_NOT_HAPPEN.
bool GR_EmbedManager::convert | ( | UT_uint32 | iConvType, | |
const UT_ConstByteBufPtr & | pFrom, | |||
const UT_ByteBufPtr & | pTo | |||
) | [virtual] |
Some plugins might want to transform data types. eg The Math plugin can transfrom Latex to MathML. This method enables this. Returns true if the conversion was successful.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by AP_Dialog_Latex::convertLatexToMathML().
GR_EmbedManager * GR_EmbedManager::create | ( | GR_Graphics * | pG | ) | [virtual] |
Create a new instance of the manager and cast it to the base GR_EmbedManager class.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
References GR_EmbedManager().
Referenced by XAP_App::getEmbeddableManager().
Get the ascent (height from the baseline to top of the element) in AbiWord Logical units.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
References getGraphics(), UT_GenericVector< T >::getNthItem(), GR_EmbedView::m_bHasPNGSnapshot, GR_EmbedView::m_PNGBuf, m_vecSnapshots, GR_Graphics::tlu(), and UT_PNG_getDimensions().
Referenced by fp_MathRun::_lookupProperties(), and fp_EmbedRun::_lookupProperties().
virtual EV_EditMouseContext GR_EmbedManager::getContextualMenu | ( | void | ) | const [inline, virtual] |
Reimplemented in GR_GOChartManager.
Referenced by fp_EmbedRun::getContextualMenu().
Get the descent (distance from the baseline to the bottom of the element) in AbiWord Logical units.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by fp_MathRun::_lookupProperties(), and fp_EmbedRun::_lookupProperties().
GR_Graphics * GR_EmbedManager::getGraphics | ( | void | ) |
The graphics class used by the EmbedManager.
References m_pG.
Referenced by getAscent(), getWidth(), makeEmbedView(), render(), LasemMathView::render(), GOComponentView::render(), and GOChartView::render().
const char * GR_EmbedManager::getMimeType | ( | void | ) | const [virtual] |
Return a const char string describing the mime type of data the plugin can render. Defaults arbitrarly to text.
const char * GR_EmbedManager::getMimeTypeDescription | ( | void | ) | const [virtual] |
Referenced by Defun1().
const char * GR_EmbedManager::getMimeTypeSuffix | ( | void | ) | const [virtual] |
Referenced by Defun1().
const char * GR_EmbedManager::getObjectType | ( | void | ) | const [virtual] |
Return a const char string describing the type of data the plugin can render.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by XAP_App::getEmbeddableManager(), FL_DocLayout::getEmbedManager(), FL_DocLayout::getQuickPrintEmbedManager(), and XAP_App::registerEmbeddable().
Get the width of the embedded element in AbiWord logical units.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
References getGraphics(), UT_GenericVector< T >::getNthItem(), GR_EmbedView::m_bHasPNGSnapshot, GR_EmbedView::m_PNGBuf, m_vecSnapshots, GR_Graphics::tlu(), and UT_PNG_getDimensions().
Referenced by fp_MathRun::_lookupProperties(), and fp_EmbedRun::_lookupProperties().
void GR_EmbedManager::initialize | ( | void | ) | [virtual] |
Perform any initializations needed by plugin manager.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by FL_DocLayout::getEmbedManager(), and FL_DocLayout::getQuickPrintEmbedManager().
void GR_EmbedManager::initializeEmbedView | ( | UT_sint32 | uid | ) | [virtual] |
Perform any specific View Initializations after creating it. The view is accessed via uid.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by fp_MathRun::_lookupProperties(), and fp_EmbedRun::_lookupProperties().
bool GR_EmbedManager::isDefault | ( | void | ) | [virtual] |
Returns true if the EmbedManager is the Default (Base) class. Returns false otherwise.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by fp_MathRun::_draw(), fp_MathRun::_lookupProperties(), AP_Dialog_Latex::convertLatexToMathML(), dlgEditLatexEquation(), makeSnapShot(), and setGraphics().
bool GR_EmbedManager::isEdittable | ( | UT_sint32 | uid | ) | [virtual] |
Returns true if the plugin can be editted via the modify method. The default implementation cannot be editted so we return false.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by fp_EmbedRun::isEdittable().
bool GR_EmbedManager::isResizeable | ( | UT_sint32 | uid | ) | [virtual] |
Returns true if the plugin can be resized. Subclasses overide if they need to
Reimplemented in GR_GOComponentManager.
Referenced by fp_EmbedRun::isResizeable().
void GR_EmbedManager::loadEmbedData | ( | UT_sint32 | uid | ) | [virtual] |
OK these load the data from data-item in the associated with the object. This data could be:
MathML for a the GtkMathView plugin Gnumeric XML for a Gnumeric plugin Postscript text for a postscript plugin
Some generic bonobo XML data for a generic bonobo plugin. Whatever you like... The data is acquired from the main AbiWord PieceTable via the dataID Attribute.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by fp_MathRun::_lookupProperties(), fp_EmbedRun::_lookupProperties(), and fp_EmbedRun::update().
UT_sint32 GR_EmbedManager::makeEmbedView | ( | AD_Document * | pDoc, | |
UT_uint32 | api, | |||
const char * | szDataID | |||
) | [virtual] |
This method makes a specific instance of the render for the object in question. It returns an integer which is an index (a "handle") to the specific instance of the renderer. The PD_Document and PT_AttrPropIndex index are used to determine specific attributes of the object as well as being used to make snapshots of the renderer.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
References UT_GenericVector< T >::addItem(), getGraphics(), UT_GenericVector< T >::getItemCount(), GR_EmbedView::getSnapShots(), GR_Graphics::getZoomPercentage(), GR_EmbedView::m_iZoom, GR_EmbedView::m_sDataID, and m_vecSnapshots.
Referenced by fp_MathRun::_lookupProperties(), and fp_EmbedRun::_lookupProperties().
Make a snapshot of the current view. This snapshot can be either in SVG or PNG form. SVG is clearly prefered. The snapshot data is stored in the PD_Document as a data item. The attribute/value is recorded for the PTO_Embed object as either: "snapshot-svg:dataitem-val#" or "snapshot-png:dataitem-val#"
Where dataitem-val# is some unique string to identify the object.
The idea is that if a document loaded by an instance of AbiWord without the plugin, the default implementation can render the snapshot of the object.
I will make a PNG snapshotter which just takes a screenshot of the object.
Once the SVG backend for gnome-print is in wide use, any printable document which employs gnome-print can be snapshotted into SVG.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
References UT_GenericVector< T >::getItemCount(), isDefault(), m_vecSnapshots, UT_ASSERT, and UT_SHOULD_NOT_HAPPEN.
Referenced by fp_MathRun::_draw(), and fp_EmbedRun::_draw().
bool GR_EmbedManager::modify | ( | UT_sint32 | uid | ) | [virtual] |
Executing this method edits the object. This can be a simple fork/exec with the contents of the description passed to the external program. After a save operation the altered contents are re-rendered on screen via a changeObject(..) call to the PD_Document. This causes the object and surrounding text to be re-rendered.
Reimplemented in GR_GOChartManager, and GR_GOComponentManager.
Referenced by Defun1().
void GR_EmbedManager::releaseEmbedView | ( | UT_sint32 | uid | ) | [virtual] |
Delete renderer specified by uid
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
References DELETEP, UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_vecSnapshots, and UT_GenericVector< T >::setNthItem().
Referenced by fp_MathRun::_lookupProperties(), fp_EmbedRun::_lookupProperties(), fp_MathRun::_recalcWidth(), fp_EmbedRun::_recalcWidth(), fp_MathRun::updateVerticalMetric(), fp_EmbedRun::updateVerticalMetric(), fp_EmbedRun::~fp_EmbedRun(), and fp_MathRun::~fp_MathRun().
Draw the object given by uid into rectangle UT_Rect & rec in the graphics class. All units are in AbiWord logical units. (0,0) is the top left corner of the graphics class
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
References GR_Graphics::createNewImage(), DELETEP, GR_Painter::drawImage(), getGraphics(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), GR_Graphics::getZoomPercentage(), UT_Rect::height, UT_Rect::left, GR_EmbedView::m_bHasPNGSnapshot, GR_EmbedView::m_bHasSVGSnapshot, GR_EmbedView::m_iZoom, GR_EmbedView::m_PNGBuf, GR_EmbedView::m_pPreview, GR_EmbedView::m_sDataID, GR_EmbedView::m_SVGBuf, m_vecSnapshots, GR_Graphics::tlu(), UT_Rect::top, UT_ASSERT, UT_PNG_getDimensions(), UT_SHOULD_NOT_HAPPEN, UT_SVG_getDimensions(), UT_UTF8String::utf8_str(), and UT_Rect::width.
Referenced by fp_MathRun::_draw(), and fp_EmbedRun::_draw().
void GR_EmbedManager::setColor | ( | UT_sint32 | uid, | |
const UT_RGBColor & | c | |||
) | [virtual] |
Set the colour of any text rendered by the view specified by uid.
Reimplemented in GR_LasemMathManager.
Referenced by fp_MathRun::_draw(), fp_EmbedRun::_draw(), and fp_MathRun::_lookupProperties().
Set the default font size used by the plugin view to the point size given
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by fp_MathRun::_lookupProperties(), and fp_EmbedRun::_lookupProperties().
void GR_EmbedManager::setDisplayMode | ( | UT_sint32 | uid, | |
AbiDisplayMode | mode | |||
) | [virtual] |
Reimplemented in GR_LasemMathManager.
Referenced by fp_MathRun::_lookupProperties().
Reimplemented in GR_GOComponentManager, and GR_LasemMathManager.
Referenced by fp_MathRun::_lookupProperties(), and fp_EmbedRun::_lookupProperties().
void GR_EmbedManager::setGraphics | ( | GR_Graphics * | pG | ) | [virtual] |
Change the graphics class to this new class. Used when zooming the document.
References DELETEP, UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), isDefault(), m_pG, GR_EmbedView::m_pPreview, and m_vecSnapshots.
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by fp_MathRun::_lookupProperties(), and fp_EmbedRun::_lookupProperties().
Reimplemented in GR_GOChartManager, GR_GOComponentManager, and GR_LasemMathManager.
Referenced by fp_EmbedRun::update().
GR_Graphics* GR_EmbedManager::m_pG [private] |
Referenced by getGraphics(), and setGraphics().
UT_GenericVector<GR_EmbedView *> GR_EmbedManager::m_vecSnapshots [private] |
Referenced by changeAPI(), getAscent(), getWidth(), GR_EmbedManager(), makeEmbedView(), makeSnapShot(), releaseEmbedView(), render(), setGraphics(), and ~GR_EmbedManager().