Package com.sun.star.text

Examples of com.sun.star.text.XTextRange


    }


    public String getUserFieldContent(XTextCursor xTextCursor) {
        try {
            XTextRange xTextRange = xTextCursor.getEnd();
            Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
            if (com.sun.star.uno.AnyConverter.isVoid(oTextField))
                return "";
            else {
                XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
View Full Code Here


        // First, create a small table.
        log.println("Creating a small table.");
        try {
            XCell cell = null;
            XTextRange textrange = null;

            for (int i = 1; i < 4; i++) {
                cell = oSheet.getCellByPosition(0, i);
                textrange = (XTextRange)UnoRuntime.
                                    queryInterface(XTextRange.class, cell);
                textrange.setString("Row" + i);

                cell = oSheet.getCellByPosition(i, 0);
                textrange = (XTextRange)UnoRuntime.
                                    queryInterface(XTextRange.class, cell);
                textrange.setString("Column" + i);
            }

            for (int i = 1; i < 4; i++)
                for (int j = 1; j < 4; j++) {
                    cell = oSheet.getCellByPosition(i, j);
                    textrange = (XTextRange)UnoRuntime.
                                    queryInterface(XTextRange.class, cell);
                    textrange.setString("Val" + ((j - 1) * 3 + i));
                }
            log.println("Finished creating table.");
            log.println("Creating new ranges from titles");

            CellRangeAddress CRA = new CellRangeAddress((short)0, 0, 0, 3, 3);
View Full Code Here

        oObj.outputList(CA);

        try {
            for (int i = 0; i < elementsCount; i++) {
                XCell cell = oSheet.getCellByPosition(0, i);
                XTextRange textrange = (XTextRange)
                    UnoRuntime.queryInterface(XTextRange.class, cell);
                String str = textrange.getString();
                bResult &= oObj.hasByName(str);
            }
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
            e.printStackTrace(log);
            bResult = false;
View Full Code Here

     */
    public void _attach() {
        requiredMethod("getAnchor()");       
        try {
            XTextContent aContent = (XTextContent) tEnv.getObjRelation("CONTENT");           
            XTextRange aRange = (XTextRange) tEnv.getObjRelation("RANGE");

            if ( aContent !=null) {               
                aContent.attach(aRange);
            } else {               
                oObj.attach(aRange);
View Full Code Here

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

        {
            this.oTextTableHandler = _oTextTableHandler;
            this.CurDBMetaData = _CurDBMetaData;
            CurDBField = CurDBMetaData.getFieldColumnByFieldName(_FieldName);
            bIsGroupColumn = true;
            XTextRange xTextCell;
            XCell xCell;
            getTableColumns(TableName);
           
            XTableRows xRows = null;
            try
View Full Code Here

    private boolean isNameCell(XTextCursor xCellCursor, String CurFieldName, String CompString)
        {
            try
            {
                xCellCursor.gotoStart(false);
                XTextRange xTextRange = xCellCursor.getEnd();
                Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
                if (AnyConverter.isVoid(oTextField))
                {
                    return false;
                }
View Full Code Here

    {
        try {
            log.println("Checking RDFa gunk...");

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

            Statement[] result = xRep.getStatementRDFa((XMetadatable)xTR);
            assure("RDFa: get: not empty (initial)",
                0 == result.length);

            try {
                xRep.setStatementRDFa(foo, bar, null, "", null);
                assure("RDFa: set: null", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }

            XLiteral trlit = Literal.create(xContext, content);
            Statement x_FooBarTRLit = new Statement(foo, bar, trlit, null);
            xRep.setStatementRDFa(foo, bar, xTR, "", null);

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

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

            Statement x_FooBarLittype = new Statement(foo, bar, littype, null);
            Statement x_FooLabelLit = new Statement(foo, rdfslabel, lit, null);
            xRep.setStatementRDFa(foo, bar, xTR, "42", uint);

            result = xRep.getStatementRDFa((XMetadatable)xTR);
            assure("RDFa: get: with content",
                2 == result.length && eq((Statement)result[0], x_FooBarLittype)
                && eq((Statement)result[1], x_FooLabelLit));

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

  static void testWriter(XComponent rCmp) throws IOException {
    XTextDocument rTextDoc = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, rCmp);

    XText rText = (XText)UnoRuntime.queryInterface(XText.class, rTextDoc.getText());
    XTextCursor rCursor = (XTextCursor)UnoRuntime.queryInterface(XTextCursor.class, rText.createTextCursor());
    XTextRange rRange = (XTextRange)UnoRuntime.queryInterface(XTextRange.class, rCursor);

    byte pcText[] = new byte[1024];
    pcText[0] = 0;
    System.err.println("pleast type any text\n");
    while(true)  {
View Full Code Here

        try {
            oSheet = (XCellRange) AnyConverter.toObject(
                    new Type(XCellRange.class),oIndexAccess.getByIndex(0));

            XCell oCell_1 = (XCell)oSheet.getCellByPosition(0, 0);
            XTextRange oTextRange = (XTextRange)
                UnoRuntime.queryInterface(XTextRange.class, oCell_1);

            oTextRange.setString("ScCellsObj test 1");

            XCell oCell_2 = (XCell)oSheet.getCellByPosition(5, 1);
            oCell_2.setValue(15);

            XCell oCell_3 = (XCell)oSheet.getCellByPosition(3, 9);
            oTextRange = (XTextRange)
                UnoRuntime.queryInterface(XTextRange.class, oCell_3);

            oTextRange.setString("ScCellsObj test 2");

            cellArr[0] = oCell_1;
            cellArr[2] = oCell_2;
            cellArr[1] = oCell_3;
        } catch(com.sun.star.lang.WrappedTargetException e) {
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.