@API(type=EXTENDABLE, src=PUBLIC) public abstract class AuthorExternalObjectInsertionHandler extends java.lang.Object implements ExternalObjectInsertionSources, Extension
Modifier and Type | Field and Description |
---|---|
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')]
|
DND_DB_TREE, DND_DITA_MAPS_MANAGER, DND_EXTERNAL, DND_IMAGE_PREVIEW, DND_PROJECT_TREE, PASTE
Constructor and Description |
---|
AuthorExternalObjectInsertionHandler() |
Modifier and Type | Method and Description |
---|---|
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 |
containOnlyBinaryResources(AuthorAccess authorAccess,
java.util.List<java.net.URL> urlList)
Verify if the provided URLs are only binary rsources.
|
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 |
insertURLs(AuthorAccess authorAccess,
java.util.List<java.net.URL> urls,
java.util.List<ReferenceType> types,
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.
|
public static final java.lang.String ONLY_TEXT_CONTENT_STYLESHEET
public AuthorExternalObjectInsertionHandler()
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 void insertURLs(AuthorAccess authorAccess, java.util.List<java.net.URL> urls, java.util.List<ReferenceType> types, 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.types
- The type of the URL reference - if null, the type will be inferred.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 URLsprotected static boolean containOnlyBinaryResources(AuthorAccess authorAccess, java.util.List<java.net.URL> urlList)
urlList
- The list of URLspublic void insertXHTMLFragment(AuthorAccess authorAccess, java.io.Reader xhtmlContentReader) throws AuthorOperationException
authorAccess
- The author accessxhtmlContentReader
- The XTHML content readerAuthorOperationException
protected java.lang.String getOnlyTextContentStylesheet(AuthorAccess authorAccess)
authorAccess
- The author accesspublic 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 transformationjavax.xml.transform.TransformerException
- thrown during transformationjava.io.IOException
- thrown during writing the transform
result to the output stringprotected static java.lang.String[] getContextPathNamesAndUris(AuthorAccess authorAccess)
authorAccess
- The author accessprotected 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.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.protected java.lang.String getSectionsPreprocessingStylesheetFileName(AuthorAccess authorAccess)
authorAccess
- The author access API.protected java.lang.String getListsPreprocessingStylesheetFileName(AuthorAccess authorAccess)
authorAccess
- The author access API.protected java.lang.String getImporterStylesheetFileName(AuthorAccess authorAccess)
authorAccess
- The author access API.protected java.net.URL getBaseURLAtCaretPosition(AuthorAccess authorAccess)
authorAccess
- The author accessprotected boolean checkImportedXHTMLContentIsPreservedEntirely()
false
by default.public java.lang.String getDescription()
getDescription
in interface Extension
Extension.getDescription()
© Copyright SyncRO Soft SRL 2002 - 2016. All rights reserved.