Package com.sun.star.container

Examples of com.sun.star.container.XNameAccess


        // get page styles
        XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier)
            UnoRuntime.queryInterface(
                XStyleFamiliesSupplier.class,
                xSpreadsheetDoc );
        XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
        XStyle StdStyle = null;

        try{
            Object o = StyleFamNames.getByName("PageStyles");
            XNameAccess PageStyles = (XNameAccess)AnyConverter.toObject(
                            new com.sun.star.uno.Type(XNameAccess.class), o);

            o = PageStyles.getByName("Default");
            StdStyle = (XStyle)AnyConverter.toObject(
                            new com.sun.star.uno.Type(XStyle.class), o);
        } catch(com.sun.star.lang.IllegalArgumentException e) {
            failed(e.getMessage());
        } catch(com.sun.star.lang.WrappedTargetException e){
View Full Code Here


        //setting property 'PrintHeaders' of the style 'Default'
        XStyleFamiliesSupplier xSFS = (XStyleFamiliesSupplier)
            UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
                                                            xSpreadsheetDoc);
        XNameAccess xNA = xSFS.getStyleFamilies();
        XPropertySet xPropSet = null;
        try {
            Object oPageStyles = xNA.getByName("PageStyles");
            xNA = (XNameAccess)
                UnoRuntime.queryInterface(XNameAccess.class, oPageStyles);
            Object oDefStyle = xNA.getByName("Default");
            xPropSet = (XPropertySet)
                UnoRuntime.queryInterface(XPropertySet.class, oDefStyle);
        } catch(com.sun.star.lang.WrappedTargetException e) {
            failed(e.getMessage());
            return;
View Full Code Here

            {"end", "office:styles"},
            {"end", "office:document-styles"}} ;

        tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;

        XNameAccess styles = null ;
        try {
            XStyleFamiliesSupplier sup = (XStyleFamiliesSupplier)
                UnoRuntime.queryInterface
                (XStyleFamiliesSupplier.class, xSheetDoc);
            XNameAccess oStyleFamilies = sup.getStyleFamilies();
            Object family = oStyleFamilies.getByName("CellStyles") ;
            styles = (XNameAccess) UnoRuntime.queryInterface
                (XNameAccess.class, family) ;
            log.println("Styles before:") ;
            String[] names = styles.getElementNames() ;
            for (int i = 0; i < names.length; i++) {
                log.println("  " + names[i]) ;
            }
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log) ;
        }
        final XNameAccess stylesF = styles ;
        final PrintWriter logF = log ;

        tEnv.addObjRelation("XDocumentHandler.ImportChecker",
            new ifc.xml.sax._XDocumentHandler.ImportChecker() {
                public boolean checkImport() {
                    logF.println("Styles after:") ;
                    String[] names = stylesF.getElementNames() ;
                    for (int i = 0; i < names.length; i++) {
                        logF.println("  " + names[i]) ;
                    }
                    return stylesF.hasByName(impStyleName) ;
                }
            }) ;

        return tEnv ;
    }
View Full Code Here

       
        XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier)
            UnoRuntime.queryInterface(
                XStyleFamiliesSupplier.class,
                xSpreadsheetDoc );
        XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
        XStyle StdStyle = null;
       
        try{
            XNameAccess PageStyles = (XNameAccess) AnyConverter.toObject(
                            new Type(XNameAccess.class),
                                        StyleFamNames.getByName("PageStyles"));
            StdStyle = (XStyle) AnyConverter.toObject(
                new Type(XStyle.class), PageStyles.getByName("Default"));
        } catch(com.sun.star.lang.WrappedTargetException e){
            e.printStackTrace(log);
            throw new StatusException("Couldn't get by name", e);
        } catch(com.sun.star.container.NoSuchElementException e){
            e.printStackTrace(log);
View Full Code Here

        // get the drawpage of drawing here
        log.println( "getting LayerManager" );
        XLayerSupplier oLS = (XLayerSupplier)
            UnoRuntime.queryInterface(XLayerSupplier.class, xDrawDoc);
        XNameAccess oNA = oLS.getLayerManager();
        oLM = (XLayerManager)
            UnoRuntime.queryInterface(XLayerManager.class, oNA);
        XIndexAccess oIA = (XIndexAccess)
            UnoRuntime.queryInterface(XIndexAccess.class,oLM);
        log.println( "getting LayerManager" );
View Full Code Here

     * one element.
     */
    public void _getTextFrames() {
        boolean res = false;

        XNameAccess the_frames = oObj.getTextFrames();
        log.println("Found: ");
        util.dbg.printArray(the_frames.getElementNames());
        res = the_frames.getElementNames().length>0;

        tRes.tested("getTextFrames()",res);
    }
View Full Code Here

    public void _setRecentFunctionIds() {
        requiredMethod("getMaxRecentFunctions()");

        boolean bResult = true;
        int[] IDs = new int[0];       
        XNameAccess functionList = null;

        log.println("First, get the set of available functions.");
        functionList = (XNameAccess)tEnv.getObjRelation("FUNCTIONLIST");
        if (functionList == null) throw new StatusException(Status.failed
            ("Relation 'FUNCTIONLIST' not found"));

        log.println("Now trying to set empty list.");
        oObj.setRecentFunctionIds(IDs);
        bResult &= (oObj.getRecentFunctionIds().length == 0);

        log.println("Now trying to set list of maximum size.");
        String[] names = functionList.getElementNames();
        Random rnd = new Random();

        IDs = new int[iMaxNumber];
        int startIdx = rnd.nextInt(names.length - iMaxNumber - 1) + 1;

        try {
            for (int i = startIdx; i < startIdx + iMaxNumber; i++) {
                PropertyValue[] propVals = (PropertyValue[])
                    functionList.getByName(names[i]);
                for (int j = 0; j < propVals.length; j++) {
                    String propName = (String)propVals[j].Name;
                    if (propName.equals("Id")) {
                        IDs[i - startIdx] =
                            ((Integer)propVals[j].Value).intValue();
View Full Code Here

  public XIndexAccess getCollection() {
    return xIA;
  }

  private XIndexAccess createCollection() {
    XNameAccess oNA = null;

    if ( iDsc instanceof TableDsc ) {
      XTextTablesSupplier oTTS = (XTextTablesSupplier)
          UnoRuntime.queryInterface(
                    XTextTablesSupplier.class, xParent );
View Full Code Here

                GlobalLogWriter.get().println("Can't get com.sun.star.document.FilterFactory.");
                return null;
            }
            if (aObj != null)
            {
                XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aObj);
                if (aNameAccess != null)
                {
                   
                    // if (_sFilterName.toLowerCase().equals("help"))
                    // {
                    //     System.out.println("Show all possible ElementNames from current version." );
                    // String[] aElementNames = aNameAccess.getElementNames();
                    // for (int i = 0; i<aElementNames.length; i++)
                    // {
                    //     System.out.println(aElementNames[i]);
                    // }
                    //     System.out.println("Must quit.");
                    //     System.out.exit(1);
                    // }
               
                    if (! aNameAccess.hasByName(_sFilterName))
                    {
                        GlobalLogWriter.get().println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" );
                        return null;
                    }
                       
                    Object[] aElements = null;
                    String[] aExtensions;
                    try
                    {
                        aElements = (Object[]) aNameAccess.getByName(_sFilterName);
                        if (aElements != null)
                        {
                            String sInternalFilterName = null;
                            // System.out.println("getByName().length: " + String.valueOf(aElements.length));
                            for (int i=0;i<aElements.length; i++)
View Full Code Here

                GlobalLogWriter.get().println("Can't get com.sun.star.document.FilterFactory.");
                return null;
            }
            if (aObj != null)
            {
                XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aObj);
                if (aNameAccess != null)
                {                   
                    if (! aNameAccess.hasByName(_sFilterName))
                    {
                        GlobalLogWriter.get().println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" );
                        return null;
                    }
                       
                    Object[] aElements = null;
                    String[] aExtensions;
                    try
                    {
                        aElements = (Object[]) aNameAccess.getByName(_sFilterName);
                        if (aElements != null)
                        {
                            String sServiceName = null;
                            // System.out.println("getByName().length: " + String.valueOf(aElements.length));
                            for (int i=0;i<aElements.length; i++)
View Full Code Here

TOP

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

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.