Examples of XTextViewCursor


Examples of com.sun.star.text.XTextViewCursor

    public static int getPageCount(Object model)
    {
        XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, model);
        XController xController = xModel.getCurrentController();
        XTextViewCursorSupplier xTextVCS = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
        XTextViewCursor xTextVC = xTextVCS.getViewCursor();
        XPageCursor xPC = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class, xTextVC);
        xPC.jumpToLastPage();
        return xPC.getPage();
    }
View Full Code Here

Examples of com.sun.star.text.XTextViewCursor

     * Has <b> OK </b> status if the method returns not
     * <code>null</code> value.
     */
    public void _getViewCursor(){

        XTextViewCursor oTVC = oObj.getViewCursor();
        tRes.tested("getViewCursor()", oTVC != null);

    } // finish _getViewCursor()
View Full Code Here

Examples of com.sun.star.text.XTextViewCursor

        XController xController = xModel.getCurrentController();
        // the controller gives us the TextViewCursor
        XTextViewCursorSupplier xViewCursorSupplier =
            (XTextViewCursorSupplier)UnoRuntime.queryInterface(
                XTextViewCursorSupplier.class, xController);
        XTextViewCursor xViewCursor = xViewCursorSupplier.getViewCursor();
       
        // query its XPropertySet interface, we want to set character and paragraph properties
        XPropertySet xCursorPropertySet = (XPropertySet)UnoRuntime.queryInterface(
            XPropertySet.class, xViewCursor);
        // set the appropriate properties for character and paragraph style
        xCursorPropertySet.setPropertyValue("CharStyleName", "Quotation");
        xCursorPropertySet.setPropertyValue("ParaStyleName", "Quotations");
        // print the current page number
        XPageCursor xPageCursor = (XPageCursor)UnoRuntime.queryInterface(
            XPageCursor.class, xViewCursor);
        System.out.println("The current page number is " + xPageCursor.getPage());
        // the model cursor is much more powerful, so
        // we create a model cursor at the current view cursor position with the following steps:
        // get the Text service from the TextViewCursor, it is an XTextRange:
         XText xDocumentText = xViewCursor.getText();
        // create a model cursor from the viewcursor
        XTextCursor xModelCursor = xDocumentText.createTextCursorByRange(xViewCursor.getStart());
        // now we could query XWordCursor, XSentenceCursor and XParagraphCursor
        // or XDocumentInsertable, XSortable or XContentEnumerationAccess
        // and work with the properties of com.sun.star.text.TextCursor
        // in this case we just go to the end of the paragraph and add some text.
        XParagraphCursor xParagraphCursor = (XParagraphCursor)UnoRuntime.queryInterface(
View Full Code Here

Examples of com.sun.star.text.XTextViewCursor

  XTextCursor xTextCursor = createTextCursor(xTextDocument.getText());
  xTextCursor.gotoStart(false);
  Tools.setUNOPropertyValue(xTextCursor, "PageDescName", "First Page");
  xTextCursor.setString(ScaleString);
  XTextViewCursorSupplier xViewCursor = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
  XTextViewCursor xTextViewCursor = xViewCursor.getViewCursor();
  xTextViewCursor.gotoStart(false);
  int iFirstPos = xTextViewCursor.getPosition().X;
  xTextViewCursor.gotoEnd(false);
  int iLastPos = xTextViewCursor.getPosition().X;
  iScale = (iLastPos-iFirstPos)/iScaleLen;
  xTextCursor.gotoStart(false);
  xTextCursor.gotoEnd(true);
  xTextCursor.setString("");
  xTextDocument.unlockControllers();
View Full Code Here

Examples of com.sun.star.text.XTextViewCursor

    final XPropertySet xCursorProps;
    try {
      final XModel model = UnoRuntime.queryInterface(XModel.class, xComponent);
      final XTextViewCursorSupplier xViewCursorSupplier =
          UnoRuntime.queryInterface(XTextViewCursorSupplier.class, model.getCurrentController());
      final XTextViewCursor xCursor = xViewCursorSupplier.getViewCursor();
      if (xCursor.isCollapsed()) { // no text selection
        xCursorProps = UnoRuntime.queryInterface(XPropertySet.class, xCursor);
      } else { // text is selected, need to create another cursor
        // as multiple languages can occur here - we care only
        // about character under the cursor, which might be wrong
        // but it applies only to the checking dialog to be removed
        xCursorProps = UnoRuntime.queryInterface(
            XPropertySet.class,
            xCursor.getText().createTextCursorByRange(xCursor.getStart()));
      }

      // The CharLocale and CharLocaleComplex properties may both be set, so we still cannot know
      // whether the text is e.g. Khmer or Tamil (the only "complex text layout (CTL)" languages we support so far).
      // Thus we check the text itself:
      if (new KhmerDetector().isThisLanguage(xCursor.getText().getString())) {
        return Language.getLanguageForShortName("km");
      }
      if (new TamilDetector().isThisLanguage(xCursor.getText().getString())) {
        return Language.getLanguageForShortName("ta");
      }

      final Object obj = xCursorProps.getPropertyValue("CharLocale");
      if (obj == null) {
View Full Code Here

Examples of com.sun.star.text.XTextViewCursor

        xViewSettingsSupplier.getViewSettings().setPropertyValue(Setting, Value);
    }

    public void collapseViewCursorToStart()
    {
        XTextViewCursor xTextViewCursor = xTextViewCursorSupplier.getViewCursor();
        xTextViewCursor.collapseToStart();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.