Package com.sun.star.text

Examples of com.sun.star.text.XTextRange


                                     int intColumn, String stringDate ) {
            try {
                // Getting the cell holding the information on the day to start
                XCell xcellStartDate = xcellrange.getCellByPosition( intColumn, intRow );
                // Querying for the interface XTextRange on the XCell
                XTextRange xtextrange = (XTextRange)
                    UnoRuntime.queryInterface( XTextRange.class, xcellStartDate );
                // Setting the new start date
                xtextrange.setString( stringDate );
            }
            catch( Exception exception ) {
                this.showExceptionMessage( exception );
            }
        }
View Full Code Here


   *
   * @return the currently selected text as a String
   */
  public String getSelection()
  {
    XTextRange xTextRange = null;
    String s = "";

    try {
      xTextRange = queryCurrentPosition();
      if (xTextRange != null)
        s = xTextRange.getString();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    return s;
View Full Code Here

   * @throws Exception element could not be retrieved
   */
  private XTextRange queryCurrentPosition()
    throws java.lang.Exception
  {
    XTextRange xTextRange = null;

    try {
      XIndexAccess xIndexAccess = getSelectionIndex();
      if(xIndexAccess != null) {
        XInterface xInterfaceText = (XInterface)UnoRuntime.queryInterface(
View Full Code Here

            // insert the new Paragraph style in the Paragraph style collection
            xParaStyleCollection.insertByName( "myheading", xPropertySet );
            System.out.println( "create new paragraph style, with the values from the Propertyset");
           
            // get the Textrange from the document
            XTextRange xTextRange = xTextDocument.getText().getStart();
           
            // get the PropertySet from the current paragraph
            XPropertySet xParagraphPropertySet = (XPropertySet) UnoRuntime.queryInterface(
                XPropertySet.class, xTextRange );
            // change the value from the property 'ParaStyle' to apply the Paragraph style
View Full Code Here

                UnoRuntime.queryInterface(
                XIndexAccess.class, objectSelection );
               
                for ( int intCounter = 0; intCounter < xindexaccess.getCount();
                intCounter++ ) {
                    XTextRange xtextrange = ( XTextRange )
                    UnoRuntime.queryInterface(
                    XTextRange.class, xindexaccess.getByIndex( intCounter ) );
                   
                    System.out.println( "You have selected a text range: \""
                    + xtextrange.getString() + "\"." );
                }
            }
           
            if ( xserviceinfo.supportsService(
            "com.sun.star.text.TextGraphicObject" )
View Full Code Here

    {
        try {
            System.out.println("Checking RDFa gunk...");

            String content = "behold, for i am the content.";
            XTextRange xTR = new TestRange(content);
            XMetadatable xM = (XMetadatable) xTR;

            Pair<Statement[], Boolean> result =
                xRep.getStatementRDFa((XMetadatable)xTR);
            assertTrue("RDFa: get: not empty (initial)",
                0 == result.First.length);

            try {
                xRep.setStatementRDFa(foo, new XURI[] {}, xM, "", null);
                fail("RDFa: set: no predicate");
            } catch (IllegalArgumentException e) {
                // ignore
            }

            try {
                xRep.setStatementRDFa(foo, new XURI[] {bar}, null, "", null);
                fail("RDFa: set: null");
            } catch (IllegalArgumentException e) {
                // ignore
            }

            XLiteral trlit = Literal.create(xContext, content);
            Statement x_FooBarTRLit = new Statement(foo, bar, trlit, null);
            xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "", null);

            result = xRep.getStatementRDFa((XMetadatable)xTR);
            assertTrue("RDFa: get: without content",
                !result.Second && (1 == result.First.length)
                && eq(result.First[0], x_FooBarTRLit));

            //FIXME: do this?
            xTR.setString(lit.getStringValue());
/*
            Statement xFooBarLit = new Statement(foo, bar, lit, null);
            result = xRep.getStatementRDFa((XMetadatable)xTR);
            assertTrue("RDFa: get: change",
                eq((Statement)result.First, xFooBarLit) && null == result.Second);
*/

            Statement x_FooBarLittype = new Statement(foo, bar, littype, null);
            xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "42", uint);

            result = xRep.getStatementRDFa((XMetadatable)xTR);
            assertTrue("RDFa: get: with content",
                result.Second &&
                (1 == result.First.length) &&
                eq(result.First[0], x_FooBarLittype));

            //FIXME: do this?
            xTR.setString(content);
/*
            Statement xFooLabelTRLit = new Statement(foo, rdfslabel, trlit, null);
            result = xRep.getStatementRDFa((XMetadatable)xTR);
            assertTrue("RDFa: get: change (label)",
                eq((Statement)result.First, xFooBarLittype) &&
View Full Code Here

        tEnv.addObjRelation("Locale"new Locale("en", "US", ""));

        XTextDocument xDoc = (XTextDocument)UnoRuntime.queryInterface
            (XTextDocument.class, xTextDoc);
        XTextRange xTextRange = (XTextRange)xDoc.getText();
        tEnv.addObjRelation("UnicodeString", xTextRange.getString());

        return tEnv;
    } // finish method getTestEnvironment
View Full Code Here

            log.println("AutoTextEntryNames[" + i + "]: " + oENames[i]);
        }
       
        XText oText = xTextDoc.getText();
        oText.insertString(oText.getStart(), "New AutoText", true);
        XTextRange oTextRange = (XTextRange) oText;
        try {
            if ( oGroup.hasByName("NewEntryName") ) {
                oGroup.removeByName("NewEntryName");
                log.println("Element 'NewEntryName' exists, removing...");
            }
View Full Code Here

            Object oPageStyles = xStyleFamiliesSupplier.getStyleFamilies().getByName("PageStyles");
            XNameAccess xName = UnoRuntime.queryInterface(XNameAccess.class, oPageStyles);
            Object oPageStyle = xName.getByName("First Page");
            XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
            XTextContent xTextTable = UnoRuntime.queryInterface(XTextContent.class, xAllTextTables.getByIndex(0));
            XTextRange xRange = UnoRuntime.queryInterface(XTextRange.class, xTextTable.getAnchor().getText());
            xViewTextCursor.gotoRange(xRange, false);
//            if (xPageCursor.getPage() == (short) 1) {
//                Helper.setUnoPropertyValue(xTextTable, "PageDescName", "First Page");
//                TextTableHandler.resetBreakTypeofTextTable(xTextTable);
//            }
            //      }
            XTextRange xHeaderRange = (XTextRange) Helper.getUnoPropertyValue(oPageStyle, "HeaderText", XTextRange.class);
            if (!com.sun.star.uno.AnyConverter.isVoid(xHeaderRange))
            {
                xViewTextCursor.gotoRange(xHeaderRange, false);
                xViewTextCursor.collapseToStart();
            }
View Full Code Here

    private boolean assignCells(int _nColumn, boolean _bforce)
    {
        try
        {
            XCell xCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 0);
            XTextRange xTextCell = UnoRuntime.queryInterface(XTextRange.class, xCell);
            String CompString = "Column";
            XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
            if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString) || (_bforce))
            {
                xNameCell = xCell;
View Full Code Here

TOP

Related Classes of com.sun.star.text.XTextRange

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.