|
Oxygen XML Editor 14.2 Author API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectro.sync.ecss.extensions.api.AuthorExternalObjectInsertionHandler
@API(type=EXTENDABLE, src=PUBLIC) public abstract class AuthorExternalObjectInsertionHandler
This class is notified when URLs are dropped or pasted to an Author Editor page
or when XHTML fragments are pasted or dropped from external applications (like web browsers or office applications) to the Author page.
If you want to use a stylesheet to convert the pasted XHTML to your own XML vocabulary you can just overwrite the method:
"ro.sync.ecss.extensions.api.AuthorExternalObjectInsertionHandler.getImporterStylesheetFileName(AuthorAccess)"
and return the file name of the stylesheet which will be applied. The path to the importer stylesheet must be added in the Classpath tab
in the Document Type Association edit dialog (as an example you can see the DITA and Docbook document types).
Field Summary | |
---|---|
static java.lang.String |
ONLY_TEXT_CONTENT_STYLESHEET
An XSLT stylesheet for extracting the entire text content (and only the text content) from any input XML, except the text from elements: xhtml:span[contains(@style, 'mso-list:Ignore')] |
Fields inherited from interface ro.sync.ecss.extensions.api.ExternalObjectInsertionSources |
---|
DND_DB_TREE, DND_DITA_MAPS_MANAGER, DND_EXTERNAL, DND_IMAGE_PREVIEW, DND_PROJECT_TREE, PASTE |
Constructor Summary | |
---|---|
AuthorExternalObjectInsertionHandler()
|
Method Summary | |
---|---|
boolean |
acceptSource(AuthorAccess authorAccess,
int source)
Confirm that the source of URLs is interesting to this handler. |
boolean |
acceptURLs(AuthorAccess authorAccess,
java.util.List<java.net.URL> urls,
int source)
Confirm that the list of URLs is interesting to this handler. |
protected boolean |
checkImportedXHTMLContentIsPreservedEntirely()
Overwrite this method if you want to check the text data is preserved on paste after applying the conversion XSL stylesheet. |
protected static boolean |
containOnlyImages(AuthorAccess authorAccess,
java.util.List<java.net.URL> urlList)
Verify if the provided URLs are only images. |
protected javax.xml.transform.stream.StreamSource |
createImporterStylesheetSource(AuthorAccess authorAccess)
Create the StreamSource for the main XSLT stylesheet which will do the importing
(transforming from the XHTML content to content valid in the current framework). |
protected javax.xml.transform.stream.StreamSource |
createListsPreprocessingStylesheet(AuthorAccess authorAccess)
Create the StreamSource for the XSLT stylesheet which creates nested lists
from a list of para elements in the input XHTML. |
protected javax.xml.transform.stream.StreamSource |
createSectionsPreprocessingStylesheet(AuthorAccess authorAccess)
Create the StreamSource for the XSLT stylesheet which creates nested sections
from a list of para elements in the input XHTML. |
protected java.net.URL |
getBaseURLAtCaretPosition(AuthorAccess authorAccess)
Get the base URL for the node located at caret position. |
protected static java.lang.String[] |
getContextPathNamesAndUris(AuthorAccess authorAccess)
Get the list of parent elements of insertion point in Author document. |
java.lang.String |
getDescription()
|
protected java.lang.String |
getImporterStylesheetFileName(AuthorAccess authorAccess)
Get the file name of the main Author paste stylesheet. |
protected java.lang.String |
getListsPreprocessingStylesheetFileName(AuthorAccess authorAccess)
Get the file name of the stylesheet for lists pre-processing. |
protected java.lang.String |
getOnlyTextContentStylesheet(AuthorAccess authorAccess)
Gets an XSLT stylesheet that can extract the entire text content (and only the text content) from any input XML. |
protected java.lang.String |
getSectionsPreprocessingStylesheetFileName(AuthorAccess authorAccess)
Get the file name of the stylesheet for sections pre-processing. |
void |
insertURLs(AuthorAccess authorAccess,
java.util.List<java.net.URL> urls,
int source)
A list of URLs need to be inserted at the caret position, probably as links. |
void |
insertXHTMLFragment(AuthorAccess authorAccess,
java.io.Reader xhtmlContentReader)
Insert an XHTML fragment |
static java.lang.String |
simpleTransform(AuthorAccess authorAccess,
java.lang.String xml,
javax.xml.transform.stream.StreamSource xsl)
Transform the specified XML input with the specified XSLT stylesheet using Saxon HE processor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ONLY_TEXT_CONTENT_STYLESHEET
Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
Constructor Detail |
---|
public AuthorExternalObjectInsertionHandler()
Method Detail |
---|
public void insertURLs(AuthorAccess authorAccess, java.util.List<java.net.URL> urls, int source) throws AuthorOperationException
source
of the insertion can be a paste event or a
drag and drop event.
acceptURLs(AuthorAccess, List, int)
returned true
for the same source
and urls
list.
authorAccess
- The author accessurls
- The list of URLs.source
- The source of the URLs, one of the AuthorExternalObjectInsertionHandler
constants.
AuthorOperationException
public boolean acceptURLs(AuthorAccess authorAccess, java.util.List<java.net.URL> urls, int source)
source
of the insertion can be a paste event or a
drag and drop event. If the source is of drag and drop type and
it is accepted, the caret will be moved to the drop position.
authorAccess
- The author access.urls
- The list of URLs.source
- The source of the URLs, one of the AuthorExternalObjectInsertionHandler
constants.
true
if the provided URLs are interesting.public boolean acceptSource(AuthorAccess authorAccess, int source)
source
of the insertion can be a paste event or a
drag and drop event. If the source is of drag and drop type and
it is accepted, the caret will be moved to the drag position.
authorAccess
- The author access.source
- The source of the URLs, one of the
AuthorExternalObjectInsertionHandler
constants (that represents a
paste or a drag and drop event)
true
if the insert URLs are interesting.protected static boolean containOnlyImages(AuthorAccess authorAccess, java.util.List<java.net.URL> urlList)
urlList
- The list of URLs
public void insertXHTMLFragment(AuthorAccess authorAccess, java.io.Reader xhtmlContentReader) throws AuthorOperationException
authorAccess
- The author accessxhtmlContentReader
- The XTHML content reader
AuthorOperationException
protected java.lang.String getOnlyTextContentStylesheet(AuthorAccess authorAccess)
authorAccess
- The author access
public static java.lang.String simpleTransform(AuthorAccess authorAccess, java.lang.String xml, javax.xml.transform.stream.StreamSource xsl) throws javax.xml.transform.TransformerException, java.io.IOException
authorAccess
- helper object for creating the transformerxml
- the input XML of the transformationxsl
- the input XSLT of the transformation
javax.xml.transform.TransformerException
- thrown during transformation
java.io.IOException
- thrown during writing the transform
result to the output stringprotected static java.lang.String[] getContextPathNamesAndUris(AuthorAccess authorAccess)
authorAccess
- The author access
protected javax.xml.transform.stream.StreamSource createImporterStylesheetSource(AuthorAccess authorAccess)
StreamSource
for the main XSLT stylesheet which will do the importing
(transforming from the XHTML content to content valid in the current framework). The main
stylesheet will be applied in a pipeline after the preprocessing stylesheets and generates
the markup of the current framework (DITA, DocBook, etc).
authorAccess
- The Author access API.
protected javax.xml.transform.stream.StreamSource createSectionsPreprocessingStylesheet(AuthorAccess authorAccess)
StreamSource
for the XSLT stylesheet which creates nested sections
from a list of para elements in the input XHTML.
authorAccess
- The Author access API.
Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
protected javax.xml.transform.stream.StreamSource createListsPreprocessingStylesheet(AuthorAccess authorAccess)
StreamSource
for the XSLT stylesheet which creates nested lists
from a list of para elements in the input XHTML.
authorAccess
- The Author access API.
Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
protected java.lang.String getSectionsPreprocessingStylesheetFileName(AuthorAccess authorAccess)
authorAccess
- The author access API.
Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
protected java.lang.String getListsPreprocessingStylesheetFileName(AuthorAccess authorAccess)
authorAccess
- The author access API.
Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
protected java.lang.String getImporterStylesheetFileName(AuthorAccess authorAccess)
authorAccess
- The author access API.
protected java.net.URL getBaseURLAtCaretPosition(AuthorAccess authorAccess)
authorAccess
- The author access
protected boolean checkImportedXHTMLContentIsPreservedEntirely()
false
by default.public java.lang.String getDescription()
getDescription
in interface Extension
Extension.getDescription()
|
Oxygen XML Editor 14.2 Author API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |