Class odf.OdfCanvas
Defined in: OdfCanvas.js.
Constructor Attributes | Constructor Name and Description |
---|---|
odf.OdfCanvas(element, viewport)
This class manages a loaded ODF document that is shown in an element.
|
Method Attributes | Method Name and Description |
---|---|
addAnnotation(annotation)
Adds an annotation for the annotaiton manager to track
and wraps and highlights it
|
|
addCssForFrameWithImage(frame)
Add additional css rules for newly inserted draw:frame and draw:image.
|
|
<inner> |
addEventListener(eventType, eventHandler)
Register an event handler
|
addListener(eventName, handler)
|
|
destroy(callback,)
|
|
enableAnnotations(allow, showRemoveButton)
Allows / disallows annotations
|
|
<inner> |
fireEvent(eventType, args)
Fire an event
|
fitSmart(width, height)
|
|
fitToContainingElement(width, height)
|
|
fitToHeight(height)
|
|
fitToWidth(width)
|
|
<inner> | |
forgetAnnotation(annotation)
Stops an annotation and unwraps it
|
|
getSizer()
This returns the element inside the canvas which can be zoomed with
CSS and which contains the ODF document and the annotation sidebar.
|
|
<inner> |
handleAnnotations(odfnode)
This should create an annotations pane if non existent, and then populate it with annotations
If annotations are disallowed, it should remove the pane and all annotations
|
<inner> |
handleContent(container, odfnode)
A new content.xml has been loaded.
|
<inner> |
load(url)
|
<inner> |
loadImages(container, odffragment, stylesheet)
Load all the images that are inside an odf element.
|
<inner> |
loadVideos(container, odffragment)
Load all the video that are inside an odf element.
|
<inner> | |
Unstyles and untracks all annotations present in the document,
and then tracks them again with fresh rendering
|
|
Updates the CSS rules to match the ODF document styles and also
updates the size of the canvas to match the new layout.
|
|
<inner> |
refreshOdf(suppressEvent)
|
Updates the size of the canvas to the size of the content.
|
|
Re-renders all annotations if enabled
|
|
save(callback)
|
|
setOdfContainer(container, suppressEvent)
Set a odfcontainer manually.
|
|
setZoomLevel(zoom)
|
|
showPage(n)
|
|
Class Detail
odf.OdfCanvas(element, viewport)
This class manages a loaded ODF document that is shown in an element.
It takes care of giving visual feedback on loading, ensures that the
stylesheets are loaded.
- Parameters:
- {!HTMLElement} element
- Put and ODF Canvas inside this element.
- {!gui.Viewport=} viewport
- Viewport used for scrolling elements and ranges into view
Method Detail
{undefined}
addAnnotation(annotation)
Adds an annotation for the annotaiton manager to track
and wraps and highlights it
- Parameters:
- {!odf.AnnotationElement} annotation
- Returns:
- {undefined}
addCssForFrameWithImage(frame)
Add additional css rules for newly inserted draw:frame and draw:image. eg. position, dimensions and background image
- Parameters:
- {!Element} frame
<inner>
{undefined}
addEventListener(eventType, eventHandler)
Register an event handler
- Parameters:
- {!string} eventType
- {!Function} eventHandler
- Returns:
- {undefined}
{undefined}
addListener(eventName, handler)
- Parameters:
- {!string} eventName
- {!function(*)} handler
- Returns:
- {undefined}
{undefined}
destroy(callback,)
- Parameters:
- {!function(!Error=)} callback,
- passing an error object in case of error
- Returns:
- {undefined}
{undefined}
enableAnnotations(allow, showRemoveButton)
Allows / disallows annotations
- Parameters:
- {!boolean} allow
- {!boolean} showRemoveButton
- Returns:
- {undefined}
<inner>
{undefined}
fireEvent(eventType, args)
Fire an event
- Parameters:
- {!string} eventType
- {Array. args
- Returns:
- {undefined}
{undefined}
fitSmart(width, height)
- Parameters:
- {!number} width
- {!number} height
- Returns:
- {undefined}
{undefined}
fitToContainingElement(width, height)
- Parameters:
- {!number} width
- {!number} height
- Returns:
- {undefined}
{undefined}
fitToHeight(height)
- Parameters:
- {!number} height
- Returns:
- {undefined}
{undefined}
fitToWidth(width)
- Parameters:
- {!number} width
- Returns:
- {undefined}
<inner>
{undefined}
fixContainerSize()
- Returns:
- {undefined}
{undefined}
forgetAnnotation(annotation)
Stops an annotation and unwraps it
- Parameters:
- {!odf.AnnotationElement} annotation
- Returns:
- {undefined}
{gui.AnnotationViewManager}
getAnnotationViewManager()
- Returns:
- {gui.AnnotationViewManager}
{!HTMLElement}
getElement()
- Returns:
- {!HTMLElement}
{!odf.Formatting}
getFormatting()
- Returns:
- {!odf.Formatting}
{!HTMLElement}
getSizer()
This returns the element inside the canvas which can be zoomed with
CSS and which contains the ODF document and the annotation sidebar.
- Returns:
- {!HTMLElement}
{!gui.Viewport}
getViewport()
- Returns:
- {!gui.Viewport}
{!gui.ZoomHelper}
getZoomHelper()
- Returns:
- {!gui.ZoomHelper}
{!number}
getZoomLevel()
- Returns:
- {!number}
<inner>
handleAnnotations(odfnode)
This should create an annotations pane if non existent, and then populate it with annotations
If annotations are disallowed, it should remove the pane and all annotations
- Parameters:
- {!odf.ODFDocumentElement} odfnode
<inner>
{undefined}
handleContent(container, odfnode)
A new content.xml has been loaded. Update the live document with it.
- Parameters:
- {!odf.OdfContainer} container
- {!odf.ODFDocumentElement} odfnode
- Returns:
- {undefined}
<inner>
{undefined}
load(url)
- Parameters:
- {string} url
- Returns:
- {undefined}
<inner>
{undefined}
loadImages(container, odffragment, stylesheet)
Load all the images that are inside an odf element.
- Parameters:
- {!odf.OdfContainer} container
- {!Element} odffragment
- {!CSSStyleSheet} stylesheet
- Returns:
- {undefined}
<inner>
{undefined}
loadVideos(container, odffragment)
Load all the video that are inside an odf element.
- Parameters:
- {!odf.OdfContainer} container
- {!Element} odffragment
- Returns:
- {undefined}
{!odf.OdfContainer}
odfContainer()
- Returns:
- {!odf.OdfContainer}
<inner>
{undefined}
redrawContainer()
- Returns:
- {undefined}
{undefined}
refreshAnnotations()
Unstyles and untracks all annotations present in the document,
and then tracks them again with fresh rendering
- Returns:
- {undefined}
{undefined}
refreshCSS()
Updates the CSS rules to match the ODF document styles and also
updates the size of the canvas to match the new layout.
Needs to be called after changes to the styles of the ODF document.
- Returns:
- {undefined}
<inner>
{undefined}
refreshOdf(suppressEvent)
- Parameters:
- {boolean} suppressEvent
- Suppress the statereadychange event from firing. Used for refreshing the OdtContainer
- Returns:
- {undefined}
{undefined}
refreshSize()
Updates the size of the canvas to the size of the content.
Needs to be called after changes to the content of the ODF document.
- Returns:
- {undefined}
{undefined}
rerenderAnnotations()
Re-renders all annotations if enabled
- Returns:
- {undefined}
{undefined}
save(callback)
- Parameters:
- {function(?string):undefined} callback
- Returns:
- {undefined}
{undefined}
setOdfContainer(container, suppressEvent)
Set a odfcontainer manually.
- Parameters:
- {!odf.OdfContainer} container
- {boolean=} suppressEvent
- Default value is false
- Returns:
- {undefined}
{undefined}
setZoomLevel(zoom)
- Parameters:
- {!number} zoom
- Returns:
- {undefined}
{undefined}
showFirstPage()
- Returns:
- {undefined}
{undefined}
showNextPage()
- Returns:
- {undefined}
{undefined}
showPage(n)
- Parameters:
- {!number} n
- number of the page
- Returns:
- {undefined}
{undefined}
showPreviousPage()
- Returns:
- {undefined}