* @author Andreas Br�ker
*/
public void insertTextContentAfter(ITextContent newTextContent,
ITextContent textContent) throws TextException {
try {
XRelativeTextContentInsert xRelativeTextContentInsert = (XRelativeTextContentInsert) UnoRuntime
.queryInterface(XRelativeTextContentInsert.class, xText);
if (newTextContent instanceof ITextTable) {
IParagraph paragraph = constructNewParagraph();
XTextContent oldXTextContent = textContent.getXTextContent();
xRelativeTextContentInsert.insertTextContentAfter(paragraph
.getXTextContent(), oldXTextContent);
xText.insertTextContent(
paragraph.getXTextContent().getAnchor(), newTextContent
.getXTextContent(), false);
xText.removeTextContent(paragraph.getXTextContent());
} else if (newTextContent instanceof IParagraph) {
if (textContent instanceof ITextTable) {
XTextContent newXTextContent = newTextContent
.getXTextContent();
XTextContent oldXTextContent = textContent
.getXTextContent();
xRelativeTextContentInsert.insertTextContentAfter(
newXTextContent, oldXTextContent);
} else {
Object object = xMultiServiceFactory
.createInstance("com.sun.star.text.TextTable");
XTextTable xTable = (XTextTable) UnoRuntime.queryInterface(
XTextTable.class, object);
xTable.initialize(1, 1);
xText.insertTextContent(textContent.getXTextContent()
.getAnchor(), xTable, false);
xRelativeTextContentInsert.insertTextContentAfter(
newTextContent.getXTextContent(), xTable);
xText.removeTextContent(xTable);
}
} else {
XTextContent newContent = newTextContent.getXTextContent();
XTextContent successor = textContent.getXTextContent();
xRelativeTextContentInsert.insertTextContentAfter(newContent,
successor);
// xRelativeTextContentInsert.insertTextContentAfter(textContent.getXTextContent(),
// newTextContent.getXTextContent());
if (textContent instanceof ITextDocumentImage
&& imageToImageIds != null && xBitmapContainer != null) {