Package com.sun.star.container

Examples of com.sun.star.container.XNamed


    private void addTextSectionCopies(){
        CurReportDocument.setLayoutSectionsVisible(false);
        XTextCursor xTextCursor = ReportDocument.createTextCursor(CurReportDocument.xTextDocument.getText());
        xTextCursor.gotoStart(false);
        for (int i = 0; i < CurReportDocument.CurDBMetaData.GroupFieldNames.length; i++){
            XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, GROUPSECTION + Integer.toString(i + 1), null, null);
            xNamedTextSection.setName(COPYOFGROUPSECTION + (i+1));
            renameTableofLastSection(COPYOFTBLGROUPSECTION + (i+1));
        }  
        if( CurReportDocument.CurDBMetaData.RecordFieldNames.length > 0){
            XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, RECORDSECTION, null, null);
            xNamedTextSection.setName(COPYOFRECORDSECTION);
            renameTableofLastSection(COPYOFTBLRECORDSECTION);
        }
    }
View Full Code Here


    }


    private void renameTableofLastSection(String _snewname){
        XTextTable xTextTable = CurReportDocument.oTextTableHandler.getlastTextTable();
        XNamed xNamedTable = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
        xNamedTable.setName(_snewname);
    }
View Full Code Here

            jexception.printStackTrace(System.out);
        }
    }

    public XNamed addLinkedTextSection(XTextCursor xTextCursor, String sLinkRegion, DBColumn CurDBColumn, Object CurGroupValue) {
    XNamed xNamedTextSection = null;
    try {
        XInterface xTextSection = (XInterface) CurReportDocument.xMSFDoc.createInstance("com.sun.star.text.TextSection");
        XTextContent xTextSectionContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
        xNamedTextSection = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextSection);
        xTextCursor.gotoEnd(false);
View Full Code Here

        //Relations for XSelectionSupplier
        tEnv.addObjRelation("Selections", new Object[] { aControl, aControl2 });
        tEnv.addObjRelation("Comparer",
                            new Comparator() {
            public int compare(Object o1, Object o2) {
                XNamed named1 = (XNamed) UnoRuntime.queryInterface(
                                        XNamed.class, o1);
                XNamed named2 = (XNamed) UnoRuntime.queryInterface(
                                        XNamed.class, o2);

                if (named1.getName().equals(named2.getName())) {
                    return 0;
                }

                return -1;
            }
View Full Code Here

                // check whether the columns supplied by the query match what we expected
                assure( "invalid column count (found " + columns.getCount() + ", expected: " + expectedColumnNames[i].length + ") for query \"" + queryNames[i] + "\"",
                    columns.getCount() == expectedColumnNames[i].length );
                for ( int col = 0; col < columns.getCount(); ++col )
                {
                    XNamed columnName = (XNamed)UnoRuntime.queryInterface(
                        XNamed.class, columns.getByIndex(col) );
                    assure( "column no. " + col + " of query \"" + queryNames[i] + "\" not matching",
                        columnName.getName().equals( expectedColumnNames[i][col] ) );
                }
            }
        }
        catch ( Exception e )
        {
View Full Code Here

            XIndexAccess formElements1 = (XIndexAccess) UnoRuntime.queryInterface(
                                                 XIndexAccess.class,
                                                 forms.getByName("MyForm"));

            for (int i = 0; i < formElements1.getCount(); i++) {
                XNamed elemName = (XNamed) UnoRuntime.queryInterface(
                                          XNamed.class,
                                          formElements1.getByIndex(i));
                log.println("   '" + elemName.getName() + "'");
            }


            // END DEBUG
            //put something on the drawpage
            log.println("inserting some ControlShapes");
            oShapes = DrawTools.getShapes(WriterTools.getDrawPage(xTextDoc));
            shape1 = FormTools.createControlShape(xTextDoc, 3000, 4500, 15000,
                                                  1000, "CommandButton");
            shape2 = FormTools.createControlShape(xTextDoc, 5000, 3500, 7500,
                                                  5000, "TextField");

            XControlShape shape3 = FormTools.createControlShape(xTextDoc, 2000,
                                                                1500, 1000,
                                                                1000,
                                                                "CheckBox");
            oShapes.add((XShape) shape1);
            oShapes.add((XShape) shape2);
            oShapes.add(shape3);
        } catch (Exception e) {
            e.printStackTrace(log);
        }

        log.println("Forms after adding controls : ");
        formNames = forms.getElementNames();

        for (int i = 0; i < formNames.length; i++) {
            log.println("    '" + formNames[i] + "'");
        }

        try {
            log.println("Elements in the 'MyForm' :");

            XIndexAccess formElements1 = (XIndexAccess) UnoRuntime.queryInterface(
                                                 XIndexAccess.class,
                                                 forms.getByName("MyForm"));

            for (int i = 0; i < formElements1.getCount(); i++) {
                XNamed elemName = (XNamed) UnoRuntime.queryInterface(
                                          XNamed.class,
                                          formElements1.getByIndex(i));
                log.println("   '" + elemName.getName() + "'");
            }
        } catch (Exception e) {
            e.printStackTrace(log);
        }
View Full Code Here

                                    // Get the titles of all text blocks in this AutoText group
                                    String [] aBlockTitles = xGroup.getTitles();

                                    // Get the XNamed interface of the autotext group
                                    XNamed xGroupNamed = ( XNamed ) UnoRuntime.queryInterface (
                                             XNamed.class, xGroup );

                                    // Output the short cut and title of the random block
                                    //and the name of the group it's from
                                    System.out.println ( "Inserted the Autotext '" + aBlockTitles[nRandom]
                                            + "', shortcut '" + aBlockNames[nRandom] + "' from group '"
                                            + xGroupNamed.getName() );
                            }
                    }

                    // Go to the end of the document
                    mxDocCursor.gotoEnd( false );
View Full Code Here

                    // Move the cursor into the new paragraph
                    xParaCursor.gotoPreviousParagraph ( false );

                    // Create a new ReferenceMark and get it's XNamed interface
                    XNamed xRefMark = (XNamed) UnoRuntime.queryInterface( XNamed.class,
                            mxDocFactory.createInstance ( "com.sun.star.text.ReferenceMark" ) );

                    // Set the name to TableHeader
                    xRefMark.setName ( "TableHeader" );

                    // Get the TextTablesSupplier interface of the document
                    XTextTablesSupplier xTableSupplier = ( XTextTablesSupplier ) UnoRuntime.queryInterface
                                                            ( XTextTablesSupplier.class, mxDoc );
View Full Code Here

                            mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false );
                    mxDocText.insertControlCharacter (
                            mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, true );

                    // Create a new TextSection from the document factory and access it's XNamed interface
                    XNamed xChildNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class,
                            mxDocFactory.createInstance( "com.sun.star.text.TextSection" ) );
                    // Set the new sections name to 'Child_Section'
                    xChildNamed.setName ( "Child_Section" );

                    // Access the Child_Section's XTextContent interface and insert it into the document
                    XTextContent xChildSection = (XTextContent) UnoRuntime.queryInterface(
                            XTextContent.class, xChildNamed );
                    mxDocText.insertTextContent ( mxDocCursor, xChildSection, false );

                    // Access the XParagraphCursor interface of our text cursor
                    XParagraphCursor xParaCursor = (XParagraphCursor) UnoRuntime.queryInterface(
                            XParagraphCursor.class, mxDocCursor );

                    // Go back one paragraph (into Child_Section)
                    xParaCursor.gotoPreviousParagraph ( false );

                    // Insert a string into the Child_Section
                    mxDocText.insertString ( mxDocCursor, "This is a test", false );

                    // Go to the end of the document
                    mxDocCursor.gotoEnd( false );

                    // Go back two paragraphs
                    xParaCursor.gotoPreviousParagraph ( false );
                    xParaCursor.gotoPreviousParagraph ( false );
                    // Go to the end of the document, selecting the two paragraphs
                    mxDocCursor.gotoEnd ( true );

                    // Create another text section and access it's XNamed interface
                    XNamed xParentNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class,
                                    mxDocFactory.createInstance( "com.sun.star.text.TextSection" ) );

                    // Set this text section's name to Parent_Section
                    xParentNamed.setName ( "Parent_Section" );

                    // Access the Parent_Section's XTextContent interface ...
                    XTextContent xParentSection = (XTextContent) UnoRuntime.queryInterface(
                            XTextContent.class, xParentNamed );
                    // ...and insert it into the document
                    mxDocText.insertTextContent ( mxDocCursor, xParentSection, false );

                    // Go to the end of the document
                    mxDocCursor.gotoEnd ( false );
                    // Insert a new paragraph
                    mxDocText.insertControlCharacter (
                            mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false );
                    // And select the new pargraph
                    xParaCursor.gotoPreviousParagraph ( true );

                    // Create a new Text Section and access it's XNamed interface
                    XNamed xLinkNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class,
                            mxDocFactory.createInstance( "com.sun.star.text.TextSection" ) );
                    // Set the new text section's name to Linked_Section
                    xLinkNamed.setName ( "Linked_Section" );

                    // Access the Linked_Section's XTextContent interface
                    XTextContent xLinkedSection = (XTextContent) UnoRuntime.queryInterface(
                            XTextContent.class, xLinkNamed );
                    // And insert the Linked_Section into the document
View Full Code Here

                    // Then select all of the text
                    xParaCursor.gotoNextParagraph ( true );
                    xParaCursor.gotoNextParagraph ( true );

                    // Create a new text section and get it's XNamed interface
                    XNamed xSectionNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class,
                            mxDocFactory.createInstance( "com.sun.star.text.TextSection" ) );

                    // Set the name of our new section (appropiately) to 'Fish'
                    xSectionNamed.setName ( "Fish" );

                    // Create the TextColumns service and get it's XTextColumns interface
                    XTextColumns xColumns = (XTextColumns) UnoRuntime.queryInterface( XTextColumns.class,
                            mxDocFactory.createInstance ( "com.sun.star.text.TextColumns" ) );
View Full Code Here

TOP

Related Classes of com.sun.star.container.XNamed

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.