Package com.sun.star.lang

Examples of com.sun.star.lang.XServiceInfo


        }

    private String getFormatExtension(Object _xComponent /* int _nType*/ )
         {
             String sExtension;
             XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, _xComponent );
             if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
             {
                 // calc
                 sExtension = ".ods";
             }
             else if (xServiceInfo.supportsService("com.sun.star.text.TextDocument"))
             {
                 //writer
                 sExtension = ".odt";
             }
             else
View Full Code Here


            return aDoc;
        }
   
    static boolean exportToPDF(XComponent _xComponent, String _sDestinationName)
        {
            XServiceInfo xServiceInfo =
                (XServiceInfo) UnoRuntime.queryInterface(
                    XServiceInfo.class, _xComponent
                    );
           
            ArrayList aPropertyList = new ArrayList();
View Full Code Here

                    //     nProperties ++;
                    // }
                    // int nPropsCount = 0;
                   
                    // If we are a SpreadSheet (calc), we need to set PrintAllSheets property to 'true'
                    XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, _aDoc );
                    if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
                    {
                        XMultiServiceFactory xMSF = _aGTA.getMultiServiceFactory();
                        Object aSettings = xMSF.createInstance( "com.sun.star.sheet.GlobalSheetSettings" );
                        if (aSettings != null)
                        {
View Full Code Here

                return;
            }
//  TODO: Do we need to wait?
            TimeHelper.waitInSeconds(1, "wait after loadFromURL.");

            XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, aDoc );
            // String sFilter = getFilterName_forExcel(xServiceInfo);
            // System.out.println("Filter is " + sFilter);

            // store the document in an other directory
            XStorable xStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, aDoc);
            if (xStorable == null)
            {
                GlobalLogWriter.get().println("com.sun.star.frame.XStorable is null");
                return;
            }
               
            String sFilterName = _aGTA.getExportFilterName();

            // check how many Properties should initialize
            int nPropertyCount = 0;
            // if (sFilterName != null && sFilterName.length() > 0)
            // {
            //     nPropertyCount ++;
            // }
           
            // initialize PropertyArray
            // PropertyValue [] aStoreProps = new PropertyValue[ nPropertyCount ];
            // int nPropertyIndex = 0;
            ArrayList aPropertyList = new ArrayList();
           
            String sExtension = "";

            if (sFilterName != null && sFilterName.length() > 0)
            {
                String sInternalFilterName = getInternalFilterName(sFilterName, xMSF);
                String sServiceName = getServiceNameFromFilterName(sFilterName, xMSF);
                   
                GlobalLogWriter.get().println("Filter detection:");
                // check if service name from file filter is the same as from the loaded document
                boolean bServiceFailed = false;
                if (sServiceName == null || sInternalFilterName == null)
                {
                    GlobalLogWriter.get().println("Given FilterName '" + sFilterName + "' seems to be unknown.");
                    bServiceFailed = true;
                }
                if (! xServiceInfo.supportsService(sServiceName))
                {
                    GlobalLogWriter.get().println("Service from FilterName '" + sServiceName + "' is not supported by loaded document.");
                    bServiceFailed = true;
                }
                if (bServiceFailed == true)
View Full Code Here

    }
   
    //==============================================================================================
    static void service_info_test( Object inst )
    {
        XServiceInfo xInfo = UnoRuntime.queryInterface( XServiceInfo.class, inst );
       
        if (! xInfo.getImplementationName().equals( m_impl_name ))
        {
            System.err.println( "Factory_Test: err -- 1" );
            System.exit( 1 );
        }
        String supported_services [] = xInfo.getSupportedServiceNames();
        if (supported_services.length != m_supported_services.length)
        {
            System.err.println( "Factory_Test: err -- 2" );
            System.exit( 1 );
        }
        for ( int nPos = 0; nPos < supported_services.length; ++nPos )
        {
            if (! supported_services[ nPos ].equals( m_supported_services[ nPos ] ))
            {
                System.err.println( "Factory_Test: err -- 3" );
                System.exit( 1 );
            }
            if (! xInfo.supportsService( m_supported_services[ nPos ] ))
            {
                System.err.println( "Factory_Test: err -- 4" );
                System.exit( 1 );
            }
        }
View Full Code Here

        throws com.sun.star.uno.RuntimeException
    {
            if (object == null)
              throw new com.sun.star.uno.RuntimeException("The parameter must not been null");
           
            XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, object);
           
            if (xServiceInfo != null) {
                return UnoRuntime.areSame(factoriesByImplNames.get(xServiceInfo.getImplementationName()), object);
            }  
       
    return false;
  }
View Full Code Here

               com.sun.star.container.ElementExistException,
               com.sun.star.uno.RuntimeException
    {
        if (object == null) throw new com.sun.star.lang.IllegalArgumentException();
       
        XServiceInfo xServiceInfo =
                UnoRuntime.queryInterface(XServiceInfo.class, object);
       
        if (xServiceInfo == null)
            throw new com.sun.star.lang.IllegalArgumentException(
                "The given object does not implement the XServiceInfo interface."
            );
           
        if ( factoriesByImplNames.containsKey( xServiceInfo.getImplementationName() ) ) {
            throw new com.sun.star.container.ElementExistException(
                xServiceInfo.getImplementationName() + " already registred"
            );
        }
       
        DEBUG("add factory " + object.toString() + " for " + xServiceInfo.getImplementationName());
        factoriesByImplNames.put( xServiceInfo.getImplementationName(), object );
       
           
        String[] serviceNames = xServiceInfo.getSupportedServiceNames();
        java.util.Vector vec = null;
           
        for (int i=0; i<serviceNames.length; i++) {               
            if ( !factoriesByServiceNames.containsKey( serviceNames[i] ) ) {
              DEBUG("> no registered services found under " + serviceNames[i] + ": adding..." );
                factoriesByServiceNames.put(serviceNames[i], new java.util.Vector());
            }
               
            vec = (java.util.Vector) factoriesByServiceNames.get( serviceNames[i] );                                                 
           
            if ( vec.contains( object ) )
                System.err.println("The implementation " + xServiceInfo.getImplementationName() +
                    " already registered for the service " + serviceNames[i] + " - ignoring!");
            else               
                vec.addElement(object);
        }       
  }
View Full Code Here

        if (object == null)
            throw new com.sun.star.lang.IllegalArgumentException(
                    "The given object must not be null."
            );
       
        XServiceInfo xServiceInfo =
            UnoRuntime.queryInterface(XServiceInfo.class, object);
       
        if (xServiceInfo == null)
            throw new com.sun.star.lang.IllegalArgumentException(
                    "The given object does not implement the XServiceInfo interface."
            );
       
        XSingleServiceFactory xSingleServiceFactory =
            UnoRuntime.queryInterface(XSingleServiceFactory.class, object);
       
        if (xSingleServiceFactory == null)
            throw new com.sun.star.lang.IllegalArgumentException(
                    "The given object does not implement the XSingleServiceFactory interface."
            );
       
        if ( factoriesByImplNames.remove( xServiceInfo.getImplementationName() ) == null )
            throw new com.sun.star.container.NoSuchElementException(
                    xServiceInfo.getImplementationName() +
                    " is not registered as an implementation."
            );
       
        String[] serviceNames = xServiceInfo.getSupportedServiceNames();
       
        for ( int i=0; i<serviceNames.length; i++ ) {
            if ( factoriesByServiceNames.containsKey( serviceNames[i] ) ) {
                java.util.Vector vec = (java.util.Vector) factoriesByServiceNames.get(serviceNames[i]);
               
                if ( !vec.removeElement(object) )
                    System.err.println("The implementation " + xServiceInfo.getImplementationName() +
                        " is not registered for the service " + serviceNames[i] + " - ignoring!");
               
                if ( vec.isEmpty() ) // remove the vector if no implementations aviable for the service
                    factoriesByServiceNames.remove( serviceNames[i] );  
            }                   
View Full Code Here

     * </ul>
     * or <CODE>null</CODE>
     */
    public static String getDocumentType(XComponent xComponent)
    {
        XServiceInfo sInfo = (XServiceInfo) UnoRuntime.queryInterface(
                XServiceInfo.class, xComponent);

        if (sInfo == null)
        {
            return "";
        }
        else if (sInfo.supportsService("com.sun.star.sheet.SpreadsheetDocument"))
        {
            return "scalc";
        }
        else if (sInfo.supportsService("com.sun.star.text.TextDocument"))
        {
            return "swriter";
        }
        else if (sInfo.supportsService("com.sun.star.drawing.DrawingDocument"))
        {
            return "sdraw";
        }
        else if (sInfo.supportsService("com.sun.star.presentation.PresentationDocument"))
        {
            return "simpress";
        }
        else if (sInfo.supportsService("com.sun.star.formula.FormulaProperties"))
        {
            return "smath";
        }
        else
        {
View Full Code Here

            parentContext = at.getAccessibleObjectForRole(
                                        xRoot, AccessibleRole.STATUS_BAR, "");
            shortWait();
            log.println("...OK.");

            XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface(
                                        XServiceInfo.class,parentContext);
            String[] services = xSI.getSupportedServiceNames();
            log.println("*****");
            log.println("* Implementation Name: " + xSI.getImplementationName());
            for (int i=0; i<services.length; i++)
                log.println("* ServiceName "+i+": "+ services[i]);
            log.println("*****");
            testObject=parentContext;
        }
View Full Code Here

TOP

Related Classes of com.sun.star.lang.XServiceInfo

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.