Package ag.ion.bion.officelayer.text

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


        ITextContentEnumeration textEnumeration = textDocument
            .getTextService().getText().getTextContentEnumeration();
        IParagraph[] paragraphs = textEnumeration.getParagraphs();

        ITextRange newTextRange = textDocument.getViewCursorService()
            .getViewCursor().getStartTextRange();
        XTextCursor cursor = newTextRange.getXTextRange().getText()
            .createTextCursor();
        cursor.gotoEnd(false);
        newTextRange = new TextRange(textDocument, cursor);
        paragraphs[0].getCloneService().cloneToPosition(
            new CloneDestinationPosition(newTextRange, newTextRange
                .getClass()), true, null);

        textDocument.close();
        localOfficeApplication.deactivate();
      }
View Full Code Here


   * @author Markus Kr�ger
   */
  public short compareRange(ITextRange textRangeToCompare)
      throws TextException {
    try {
      ITextRange thisCompareRange = this;
      if (document instanceof ITextDocument) {
        ITextDocument textDocument = (ITextDocument) document;
        ITextTableCell thisCompareRangeCell = thisCompareRange
            .getCell();
        ITextTableCell textRangeToCompareCell = textRangeToCompare
            .getCell();
        if (thisCompareRangeCell != null
            && textRangeToCompareCell == null) {
          XTextContent textTable = thisCompareRangeCell
              .getTextTable().getXTextContent();
          XSelectionSupplier selectionSupplier = (XSelectionSupplier) UnoRuntime
              .queryInterface(XSelectionSupplier.class,
                  textDocument.getXTextDocument()
                      .getCurrentController());
          selectionSupplier.select(textTable);
          XTextViewCursorSupplier xTextViewCursorSupplier = (XTextViewCursorSupplier) UnoRuntime
              .queryInterface(XTextViewCursorSupplier.class,
                  textDocument.getXTextDocument()
                      .getCurrentController());
          xTextViewCursorSupplier.getViewCursor().goLeft((short) 1,
              false);
          thisCompareRange = textDocument.getViewCursorService()
              .getViewCursor().getTextCursorFromEnd().getEnd();
        } else if (textRangeToCompareCell != null
            && thisCompareRangeCell == null) {
          XTextContent textTable = textRangeToCompareCell
              .getTextTable().getXTextContent();
          XSelectionSupplier selectionSupplier = (XSelectionSupplier) UnoRuntime
              .queryInterface(XSelectionSupplier.class,
                  textDocument.getXTextDocument()
                      .getCurrentController());
          selectionSupplier.select(textTable);
          XTextViewCursorSupplier xTextViewCursorSupplier = (XTextViewCursorSupplier) UnoRuntime
              .queryInterface(XTextViewCursorSupplier.class,
                  textDocument.getXTextDocument()
                      .getCurrentController());
          xTextViewCursorSupplier.getViewCursor().goLeft((short) 1,
              false);
          textRangeToCompare = textDocument.getViewCursorService()
              .getViewCursor().getTextCursorFromEnd().getEnd();
        } else if (thisCompareRangeCell != null
            && textRangeToCompareCell != null) {
          XTextContent thisCompareRangeTable = thisCompareRangeCell
              .getTextTable().getXTextContent();
          XTextContent textRangeToCompareTable = textRangeToCompareCell
              .getTextTable().getXTextContent();
          boolean sameTable = UnoRuntime.areSame(
              thisCompareRangeTable, textRangeToCompareTable);
          if (sameTable) {
            ITextTableCellName thisCompareRangeCellName = thisCompareRangeCell
                .getName();
            ITextTableCellName textRangeToCompareCellName = textRangeToCompareCell
                .getName();
            int thisCompareRangeCellRow = thisCompareRangeCellName
                .getRowIndex();
            int thisCompareRangeCellCol = thisCompareRangeCellName
                .getColumnIndex();
            int textRangeToCompareCellRow = textRangeToCompareCellName
                .getRowIndex();
            int textRangeToCompareCellCol = textRangeToCompareCellName
                .getColumnIndex();
            if (thisCompareRangeCellRow < textRangeToCompareCellRow)
              return 1;
            else if (thisCompareRangeCellRow > textRangeToCompareCellRow)
              return -1;
            else {
              if (thisCompareRangeCellCol < textRangeToCompareCellCol)
                return 1;
              else if (thisCompareRangeCellCol > textRangeToCompareCellCol)
                return -1;
            }
          } else {
            XSelectionSupplier selectionSupplier = (XSelectionSupplier) UnoRuntime
                .queryInterface(XSelectionSupplier.class,
                    textDocument.getXTextDocument()
                        .getCurrentController());
            selectionSupplier.select(thisCompareRangeTable);
            XTextViewCursorSupplier xTextViewCursorSupplier = (XTextViewCursorSupplier) UnoRuntime
                .queryInterface(XTextViewCursorSupplier.class,
                    textDocument.getXTextDocument()
                        .getCurrentController());
            xTextViewCursorSupplier.getViewCursor().goLeft(
                (short) 1, false);
            thisCompareRange = textDocument.getViewCursorService()
                .getViewCursor().getTextCursorFromEnd()
                .getEnd();

            selectionSupplier = (XSelectionSupplier) UnoRuntime
                .queryInterface(XSelectionSupplier.class,
                    textDocument.getXTextDocument()
                        .getCurrentController());
            selectionSupplier.select(textRangeToCompareTable);
            xTextViewCursorSupplier = (XTextViewCursorSupplier) UnoRuntime
                .queryInterface(XTextViewCursorSupplier.class,
                    textDocument.getXTextDocument()
                        .getCurrentController());
            xTextViewCursorSupplier.getViewCursor().goLeft(
                (short) 1, false);
            textRangeToCompare = textDocument
                .getViewCursorService().getViewCursor()
                .getTextCursorFromEnd().getEnd();
          }
        }
      }
      XText text = thisCompareRange.getXTextRange().getText();
      XTextRangeCompare comparator = (XTextRangeCompare) UnoRuntime
          .queryInterface(XTextRangeCompare.class, text);
      try {
        return comparator.compareRegionStarts(thisCompareRange
            .getXTextRange().getStart(), textRangeToCompare
            .getXTextRange().getStart());
      } catch (Exception exception) {
        throw new TextException(exception);
      }
View Full Code Here

   */
  public boolean nextMatch() {
    if(maxIndex != -1) {
      index++;
      if(index <= maxIndex) {       
      ITextRange textRange = getTextRange(index);
        try {
          document.setSelection(new TextRangeSelection(textRange));
          return true;
        }
        catch(NOAException exception) {
View Full Code Here

   */
  public boolean previousMatch() {
    if(maxIndex != -1) {
      index--;
      if(index >= 0) {     
        ITextRange textRange = getTextRange(index);
        try {
          document.setSelection(new TextRangeSelection(textRange));
          return true;
        }
        catch(NOAException exception) {
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);
View Full Code Here

   * @author Sebastian R�sgen
   * @author Markus Kr�ger
   */
  private IClonedObject clonePreprocessor (IDestinationPosition position, boolean adoptContent, boolean createSpace, boolean generateReturnValue, PropertyKeysContainer propertyKeysContainer) throws CloneException {
    try {
      ITextRange range = null;
      if (position.getType() != null && ITextRange.class.isAssignableFrom(position.getType())) {
        range = (ITextRange)position.getDestinationObject();
      }
      ITextDocument textDocument = textTable.getTextDocument();
      ITextContentService textContentService = textDocument.getTextService().getTextContentService();
View Full Code Here

       
        ITextContentEnumeration textEnumeration = textDocument.getTextService().getText().getTextContentEnumeration();
        IParagraph[] paragraphs = textEnumeration.getParagraphs();
       
       
        ITextRange newTextRange = textDocument.getViewCursorService().getViewCursor().getStartTextRange();
        XTextCursor cursor = newTextRange.getXTextRange().getText().createTextCursor();
        cursor.gotoEnd(false);
        newTextRange = new TextRange(textDocument, cursor);
        paragraphs[0].getCloneService().cloneToPosition(new CloneDestinationPosition(newTextRange, newTextRange.getClass()), true, null);
               
        textDocument.close();
        localOfficeApplication.deactivate();
      }
    }
View Full Code Here

        CloneException cloneException =  new CloneException("No valid type for the position.");
        throw cloneException;
      }
     
      if(ITextRange.class.isAssignableFrom(position.getType())) {
        ITextRange range = (ITextRange)position.getDestinationObject();
        if(textTableService == null)
          textTableService = textDocument.getTextTableService();
        newTable = (ITextTable)textTableService.constructTextTable(rowCount, columnCount);
        newTable.getProperties().setRepeatHeadline(textTablePropertyStore.repeatHeadline());
        if(textContentService == null)
View Full Code Here

   *
   * @author Markus Kr�ger
   */
  public short compareRange(ITextRange textRangeToCompare) throws TextException {
    try {
      ITextRange thisCompareRange = this;
      if(document instanceof ITextDocument) {
        ITextDocument textDocument = (ITextDocument)document;
        ITextTableCell thisCompareRangeCell = thisCompareRange.getCell();
        ITextTableCell textRangeToCompareCell = textRangeToCompare.getCell();
        if(thisCompareRangeCell != null && textRangeToCompareCell == null) {
          XTextContent textTable = thisCompareRangeCell.getTextTable().getXTextContent();  
          XSelectionSupplier selectionSupplier = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, textDocument.getXTextDocument().getCurrentController());
          selectionSupplier.select(textTable);
          XTextViewCursorSupplier xTextViewCursorSupplier = (XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, textDocument.getXTextDocument().getCurrentController());
          xTextViewCursorSupplier.getViewCursor().goLeft((short)1,false);
          thisCompareRange = textDocument.getViewCursorService().getViewCursor().getTextCursorFromEnd().getEnd();
        }
        else if(textRangeToCompareCell != null && thisCompareRangeCell == null) {
          XTextContent textTable = textRangeToCompareCell.getTextTable().getXTextContent();  
          XSelectionSupplier selectionSupplier = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, textDocument.getXTextDocument().getCurrentController());
          selectionSupplier.select(textTable);
          XTextViewCursorSupplier xTextViewCursorSupplier = (XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, textDocument.getXTextDocument().getCurrentController());
          xTextViewCursorSupplier.getViewCursor().goLeft((short)1,false);
          textRangeToCompare = textDocument.getViewCursorService().getViewCursor().getTextCursorFromEnd().getEnd();
        }
        else if(thisCompareRangeCell != null && textRangeToCompareCell != null) {
          XTextContent thisCompareRangeTable = thisCompareRangeCell.getTextTable().getXTextContent();
          XTextContent textRangeToCompareTable = textRangeToCompareCell.getTextTable().getXTextContent();
          boolean sameTable = UnoRuntime.areSame(
              thisCompareRangeTable,textRangeToCompareTable);
          if(sameTable) {
            ITextTableCellName thisCompareRangeCellName = thisCompareRangeCell.getName();
            ITextTableCellName textRangeToCompareCellName = textRangeToCompareCell.getName();
            int thisCompareRangeCellRow = thisCompareRangeCellName.getRowIndex();
            int thisCompareRangeCellCol = thisCompareRangeCellName.getColumnIndex();
            int textRangeToCompareCellRow = textRangeToCompareCellName.getRowIndex();
            int textRangeToCompareCellCol = textRangeToCompareCellName.getColumnIndex();
            if(thisCompareRangeCellRow < textRangeToCompareCellRow)
              return 1;
            else if(thisCompareRangeCellRow > textRangeToCompareCellRow)
              return -1;
            else {
              if(thisCompareRangeCellCol < textRangeToCompareCellCol)
                return 1;
              else if(thisCompareRangeCellCol > textRangeToCompareCellCol)
                return -1;
            }
          }
          else {
            XSelectionSupplier selectionSupplier = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, textDocument.getXTextDocument().getCurrentController());
            selectionSupplier.select(thisCompareRangeTable);
            XTextViewCursorSupplier xTextViewCursorSupplier = (XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, textDocument.getXTextDocument().getCurrentController());
            xTextViewCursorSupplier.getViewCursor().goLeft((short)1,false);
            thisCompareRange = textDocument.getViewCursorService().getViewCursor().getTextCursorFromEnd().getEnd();
            
            selectionSupplier = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, textDocument.getXTextDocument().getCurrentController());
            selectionSupplier.select(textRangeToCompareTable);
            xTextViewCursorSupplier = (XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, textDocument.getXTextDocument().getCurrentController());
            xTextViewCursorSupplier.getViewCursor().goLeft((short)1,false);
            textRangeToCompare = textDocument.getViewCursorService().getViewCursor().getTextCursorFromEnd().getEnd();
          }
        }
      }
      XText text = thisCompareRange.getXTextRange().getText();   
      XTextRangeCompare comparator = (XTextRangeCompare) UnoRuntime.queryInterface(XTextRangeCompare.class, text);
      try {
        return comparator.compareRegionStarts(thisCompareRange.getXTextRange().getStart(), textRangeToCompare.getXTextRange().getStart());
      }
      catch (Exception exception) {
        throw new TextException(exception);
      }
    }
View Full Code Here

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

TOP

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

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.