Package ag.ion.bion.officelayer.text

Examples of ag.ion.bion.officelayer.text.IParagraph


      ITextContent textContent) throws TextException {
    try {
      XRelativeTextContentInsert xRelativeTextContentInsert = (XRelativeTextContentInsert) UnoRuntime
      .queryInterface(XRelativeTextContentInsert.class, xText);
      if (newTextContent instanceof ITextTable) {
        IParagraph paragraph = constructNewParagraph();
        xRelativeTextContentInsert.insertTextContentBefore(paragraph
            .getXTextContent(), textContent.getXTextContent());
        xText.insertTextContent(
            paragraph.getXTextContent().getAnchor(), newTextContent
            .getXTextContent(), false);
        xText.removeTextContent(paragraph.getXTextContent());
      } else {
        xRelativeTextContentInsert.insertTextContentBefore(
            newTextContent.getXTextContent(), textContent
            .getXTextContent());
        cleanupImage(textContent);
View Full Code Here


      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
View Full Code Here

      for(int i=0;i<allTexts2BePlaced.length;i++) {
        ITextCursor textCursor =
          textDocument.getTextService().getText().getTextCursorService().getTextCursor();
       
        textCursor.gotoEnd(false);     
        IParagraph paragraph =
          textDocument.getTextService().getTextContentService().constructNewParagraph();     
        textCursor.gotoEnd(false);
        textDocument.getTextService().getTextContentService().insertTextContent(textCursor.getEnd(),paragraph);
        StringBuffer bufferedString = new StringBuffer();
        for(int j=0;j<allTexts2BePlaced[i].length;j++ ) {
          bufferedString.append(allTexts2BePlaced[i][j] +"\n");
        }
       
        paragraph.setParagraphText(bufferedString.toString());
      }
     
      /* After we wrote the paragraphs down to the document we will fetch them again
       * out of the document and format them a little bit.
       * For sure it would have been easy for us just to store the newly created paragraphs
       * into an array or arraylist or something like that, but it makes sense as well
       * to use the already built-in functions of NOA.
       */
     
      IParagraph paragraphs[] =
        textDocument.getTextService().getText().getTextContentEnumeration().getParagraphs();
     
      // we actually know that there are only four paragraphs, the one that is
      // initially placed in the document and our own three added paras. The last
      // paragraph is of no interest for us, because it is the empty initial paragraph
View Full Code Here

      ITextContent textContent) throws TextException {
    try {
      XRelativeTextContentInsert xRelativeTextContentInsert = (XRelativeTextContentInsert) UnoRuntime
          .queryInterface(XRelativeTextContentInsert.class, xText);
      if (newTextContent instanceof ITextTable) {
        IParagraph paragraph = constructNewParagraph();
        xRelativeTextContentInsert.insertTextContentBefore(paragraph
            .getXTextContent(), textContent.getXTextContent());
        xText.insertTextContent(
            paragraph.getXTextContent().getAnchor(), newTextContent
                .getXTextContent(), false);
        xText.removeTextContent(paragraph.getXTextContent());
      } else {
        xRelativeTextContentInsert.insertTextContentBefore(
            newTextContent.getXTextContent(), textContent
                .getXTextContent());
        if (textContent instanceof ITextDocumentImage
View Full Code Here

      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
View Full Code Here

  private IClonedObject clonePreprocessor(IDestinationPosition position, boolean adoptContent, boolean generateReturnValue, PropertyKeysContainer propertyKeysContainer) throws CloneException{
    try {
      ITextService service = document.getTextService();
      ITextContentService contentService = service.getTextContentService();
      if (contentService != null) {
         IParagraph newParagraph = contentService.constructNewParagraph();
         ITextRange range = null;
         if (ITextRange.class.isAssignableFrom(position.getType())) {
            range = (ITextRange)position.getDestinationObject();
         }
         if (range != null) {
            contentService.insertTextContent(range, newParagraph);
         }
         else {
          contentService.insertTextContentAfter(paragraph,newParagraph);
         }
         if (adoptContent) {
            newParagraph.setParagraphText(paragraphText)
         }
        
         String[] propertyKeysToCopy = null;     
         if(propertyKeysContainer != null) {
           propertyKeysToCopy = propertyKeysContainer.getPropertyKeys(IParagraphProperties.TYPE_ID);       
         }
         else {
           //use default
           propertyKeysToCopy = ParagraphProperties.getDefaultPropertyKeys();
         }
         if(propertyKeysToCopy != null) {
           IParagraphProperties paragraphProperties = newParagraph.getParagraphProperties();
           ((IPropertyStore)paragraphPropertyStore).getProperties().copyTo(propertyKeysToCopy, paragraphProperties);
         }
        
         if(generateReturnValue)
           return new ClonedObject(newParagraph, newParagraph.getClass());
         else
           return null;
      }
      else {
        throw new CloneException("Error constructing TextContentService to clone paragraph");
View Full Code Here

   */
  public void insertTextContentBefore(ITextContent newTextContent, ITextContent textContent) throws TextException {
    try {
      XRelativeTextContentInsert xRelativeTextContentInsert = (XRelativeTextContentInsert)UnoRuntime.queryInterface(XRelativeTextContentInsert.class, xText);
      if(newTextContent instanceof ITextTable) {
        IParagraph paragraph = constructNewParagraph();
        xRelativeTextContentInsert.insertTextContentBefore(paragraph.getXTextContent(), textContent.getXTextContent());
        xText.insertTextContent(paragraph.getXTextContent().getAnchor(), newTextContent.getXTextContent(), false);
        xText.removeTextContent(paragraph.getXTextContent());
      }
      else {
        xRelativeTextContentInsert.insertTextContentBefore(newTextContent.getXTextContent(), textContent.getXTextContent());
        if(textContent instanceof ITextDocumentImage && imageToImageIds != null && xBitmapContainer != null) {
          String id = imageToImageIds.get(textContent);
View Full Code Here

   */
  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();
View Full Code Here

          cellClone.cloneToPositionNoReturn(destinationCell, adoptContent,propertyKeysContainer);               
        }
      }
     
      if (createSpace) {
        IParagraph paragraph = textContentService.constructNewParagraph();
        textContentService.insertTextContentBefore(paragraph,newTable);
      }
      if(generateReturnValue)
        return new ClonedObject(newTable, newTable.getClass());
      else
View Full Code Here

    try {
      ITextService service = document.getTextService();
      ITextContentService contentService = service
          .getTextContentService();
      if (contentService != null) {
        IParagraph newParagraph = contentService
            .constructNewParagraph();
        ITextRange range = null;
        if (ITextRange.class.isAssignableFrom(position.getType())) {
          range = (ITextRange) position.getDestinationObject();
        }
        if (range != null) {
          contentService.insertTextContent(range, newParagraph);
        } else {
          contentService.insertTextContentAfter(paragraph,
              newParagraph);
        }
        if (adoptContent) {
          newParagraph.setParagraphText(paragraphText);
        }

        String[] propertyKeysToCopy = null;
        if (propertyKeysContainer != null) {
          propertyKeysToCopy = propertyKeysContainer
              .getPropertyKeys(IParagraphProperties.TYPE_ID);
        } else {
          // use default
          propertyKeysToCopy = ParagraphProperties
              .getDefaultPropertyKeys();
        }
        if (propertyKeysToCopy != null) {
          IParagraphProperties paragraphProperties = newParagraph
              .getParagraphProperties();
          ((IPropertyStore) paragraphPropertyStore).getProperties()
              .copyTo(propertyKeysToCopy, paragraphProperties);
        }

        if (generateReturnValue)
          return new ClonedObject(newParagraph, newParagraph
              .getClass());
        else
          return null;
      } else {
        throw new CloneException(
View Full Code Here

TOP

Related Classes of ag.ion.bion.officelayer.text.IParagraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.