Package ag.ion.bion.officelayer.text

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


   */
  public void setFontColor(int color) throws TextException {
    try {
      getXPropertySet().setPropertyValue("CharColor", new Integer(color));
    } catch (Exception excep) {
      TextException textException = new TextException(excep.getMessage());
      textException.initCause(excep);
      throw textException;
    }
  }
View Full Code Here


  public String getFontName() throws TextException {
    try {
      return getXPropertySet().getPropertyValue("CharFontName")
          .toString();
    } catch (Exception exception) {
      TextException textException = new TextException(exception
          .getMessage());
      textException.initCause(exception);
      throw textException;
    }
  }
View Full Code Here

   */
  public void setFontName(String font) throws TextException {
    try {
      getXPropertySet().setPropertyValue("CharFontName", font);
    } catch (Exception excep) {
      TextException textException = new TextException(excep.getMessage());
      textException.initCause(excep);
      throw textException;
    }
  }
View Full Code Here

  public ITextContentEnumeration getTextContentEnumeration()
      throws TextException {
    try {
      return new TextContentEnumeration(textDocument, xText);
    } catch (Exception exception) {
      TextException textException = new TextException(exception
          .getMessage());
      textException.initCause(exception);
      throw textException;
    }
  }
View Full Code Here

   */
  public ITextCursorService getTextCursorService() throws TextException {
    try {
      return new TextCursorService(textDocument, xText);
    } catch (Exception exception) {
      TextException textException = new TextException(exception
          .getMessage());
      textException.initCause(exception);
      throw textException;
    }
  }
View Full Code Here

   * @author Andreas Br�ker
   */
  public IParagraph constructNewParagraph() throws TextException {
    try {
      if (xMultiServiceFactory == null)
        throw new TextException(
        "OpenOffice.org XMultiServiceFactory inteface not valid.");
      Object object = xMultiServiceFactory
      .createInstance("com.sun.star.text.Paragraph");
      XTextContent xTextContent = (XTextContent) UnoRuntime
      .queryInterface(XTextContent.class, object);

      return new Paragraph(textDocument, xTextContent);
    } catch (Exception exception) {
      TextException textException = new TextException(exception
          .getMessage());
      textException.initCause(exception);
      throw textException;
    }
  }
View Full Code Here

   */
  public ITextDocumentImage constructNewImage(GraphicInfo graphicInfo)
  throws TextException {
    try {
      if (xMultiServiceFactory == null)
        throw new TextException(
        "OpenOffice.org XMultiServiceFactory inteface not valid.");

      if (xBitmapContainer == null)
        xBitmapContainer = (XNameContainer) UnoRuntime
        .queryInterface(
            XNameContainer.class,
            xMultiServiceFactory
            .createInstance("com.sun.star.drawing.BitmapTable"));

      XTextContent xImage = (XTextContent) UnoRuntime
      .queryInterface(
          XTextContent.class,
          xMultiServiceFactory
          .createInstance("com.sun.star.text.TextGraphicObject"));

      XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(
          XPropertySet.class, xImage);

      String tempId = "tempImageId" + System.currentTimeMillis();
      xBitmapContainer.insertByName(tempId, graphicInfo.getUrl());
      String internalURL = AnyConverter.toString(xBitmapContainer
          .getByName(tempId));

      xProps.setPropertyValue("AnchorType", graphicInfo.getAnchor());
      xProps.setPropertyValue("GraphicURL", internalURL);
      xProps.setPropertyValue("Width", Integer.valueOf(graphicInfo
          .getWidth()));
      xProps.setPropertyValue("Height", Integer.valueOf(graphicInfo
          .getHeight()));
      xProps.setPropertyValue("HoriOrient", Short.valueOf(graphicInfo
          .getHorizontalAlignment()));
      xProps.setPropertyValue("VertOrient", Short.valueOf(graphicInfo
          .getVerticalAlignment()));

      ITextDocumentImage textDocumentImage = new TextDocumentImage(
          textDocument, xImage, graphicInfo);

      if (imageToImageIds == null)
        imageToImageIds = new HashMap<ITextDocumentImage, String>();
      imageToImageIds.put(textDocumentImage, tempId);

      return textDocumentImage;
    } catch (Exception exception) {
      TextException textException = new TextException(exception
          .getMessage());
      textException.initCause(exception);
      throw textException;
    }
  }
View Full Code Here

  @Override
  public ITextDocumentTextShape constructNewTextShape(TextInfo textInfo)
  throws TextException {
    try {
      if (xMultiServiceFactory == null)
        throw new TextException(
        "OpenOffice.org XMultiServiceFactory interface not valid.");

      if (xTextShapeContainer == null)
        xTextShapeContainer = (XNameContainer) UnoRuntime
        .queryInterface(
            XNameContainer.class,
            xMultiServiceFactory
            .createInstance("com.sun.star.drawing.MarkerTable"));

      Object textShape = xMultiServiceFactory.createInstance( "com.sun.star.text.TextFrame" );           
      XShape xWriterShape  = (XShape) UnoRuntime.queryInterface(XShape.class, textShape);
      ///////
      xWriterShape.setSize(new Size(200, 200));

      XPropertySet xShapeProps = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, textShape );
      xShapeProps.setPropertyValue("HoriOrient", Short.valueOf(textInfo.getHorizontalAlignment()));
      xShapeProps.setPropertyValue("VertOrient", Short.valueOf(textInfo.getVerticalAlignment()));
     
      ///////

      XTextContent  xTextShape = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, textShape);

      XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextShape);

      String tempId = "tempTextShapeId" + System.currentTimeMillis();
      xTextShapeContainer.insertByName(tempId, textInfo.getID());

      xProps.setPropertyValue("AnchorType", textInfo.getAnchor());
      xProps.setPropertyValue("FrameIsAutomaticHeight", Boolean.TRUE);
      xProps.setPropertyValue("WidthType", new Short((short)2)); // magic value for automatic width
      xProps.setPropertyValue("ContentProtected", Boolean.TRUE );
//      xProps.setPropertyValue("BackColor", new Integer(0x11334466));
      xProps.setPropertyValue("HoriOrient", Short.valueOf(textInfo.getHorizontalAlignment()));
      xProps.setPropertyValue("VertOrient", Short.valueOf(textInfo.getVerticalAlignment()));
      xProps.setPropertyValue("BackColor", new Integer(0xffffffff));
      xProps.setPropertyValue("BackColorTransparency", new Short(( short ) 100));

      ITextDocumentTextShape textDocumentTextShape = new TextDocumentTextShape(
          textDocument, xTextShape, textInfo);

      ////////
      XText xShapeText = ( XText ) UnoRuntime.queryInterface(XText.class, textShape);
      textDocumentTextShape.setXText(xShapeText);
      ////////
     
      if (textShapeToTextShapeIds == null)
        textShapeToTextShapeIds = new HashMap<ITextDocumentTextShape, String>();
      textShapeToTextShapeIds.put(textDocumentTextShape, tempId);

      return textDocumentTextShape;
    } catch (Exception exception) {
      TextException textException = new TextException(exception
          .getMessage());
      textException.initCause(exception);
      throw textException;
    }
  }
View Full Code Here

  public ITextRange constructNewTextRange(IDocument doc, XTextRange xTextRange) throws TextException{
    try {
      TextRange range = new TextRange(doc, xTextRange);
      return range;
    } catch (Exception e) {
      TextException textException = new TextException(e.getMessage());
      textException.initCause(e);
      throw textException;
    }
  }
View Full Code Here

          .getXTextContent(), true);
      cleanupImage(textContent);
      cleanupTextShape(textContent);

    } catch (Exception exception) {
      TextException textException = new TextException(exception
          .getMessage());
      textException.initCause(exception);
      throw textException;
    }
  }
View Full Code Here

TOP

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

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.