Package com.sun.star.lang

Examples of com.sun.star.lang.XComponent


            if ( frameName == null ) {
                    frameName = "_blank";
            }
            // load a blank a doc
            XComponent oDoc = oCLoader.loadComponentFromURL(
                            "private:factory/"+kind, frameName, 40, mediaDescriptor );

    return oDoc;

    } // finished openDoc
View Full Code Here


        // get a soffice factory object
        SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());

        try {
            log.println( "creating a chartdocument" );
            XComponent xComp = SOF.loadDocument(
                             utils.getFullTestURL("TransparencyChart.sxs"));
            xChartDoc = (XChartDocument)
                UnoRuntime.queryInterface(XChartDocument.class,xComp);
        } catch (com.sun.star.uno.Exception e) {
            // Some exception occures.FAILED
View Full Code Here

     * Be aware, the ownership of the document gets to you, you have to close it.
     */
    public static XComponent loadFromURL(GraphicalTestArguments _aGTA,
                                         String _sInputURL)
        {
            XComponent aDoc = null;
            try
            {
                if (_aGTA.getMultiServiceFactory() == null)
                {
                    GlobalLogWriter.get().println("MultiServiceFactory in GraphicalTestArgument not set.");
View Full Code Here

    public static boolean storeAsPDF(GraphicalTestArguments _aGTA,
                                     String _sInputURL,
                                     String _sOutputURL)
        {
            boolean bBack = false;
            XComponent aDoc = loadFromURL(_aGTA, _sInputURL);
               
            if (aDoc == null)
            {
                GlobalLogWriter.get().println("Can't load document.");
                return bBack;
            }
            bBack = storeAsPDF(_aGTA, aDoc, _sOutputURL);
            createInfoFile(_sOutputURL, _aGTA, "as pdf");

            GlobalLogWriter.get().println("Close document.");
            aDoc.dispose();
            return bBack;
        }
View Full Code Here

                                             String _sPrintFileURL)
        {
            // waitInSeconds(1);
            boolean bBack = false;
           
            XComponent aDoc = loadFromURL(_aGTA, _sInputURL);
            if (aDoc != null)
            {
                if ( _sInputURL.equals(_sOutputURL) )
                {
                    // don't store document
                    // input and output are equal OR
                    GlobalLogWriter.get().println("Warning: Inputpath and Outputpath are equal. Document will not stored again.");
                    _aGTA.disallowStore();
                }
                bBack = impl_printToFileWithOOo(_aGTA, aDoc, _sOutputURL, _sPrintFileURL);
               
                GlobalLogWriter.get().println("Close document.");
                aDoc.dispose();
            }
            else
            {
                GlobalLogWriter.get().println("loadDocumentFromURL() failed with document: " + _sInputURL);
            }
View Full Code Here

                            _aGTA.getPerformance().stopTime(PerformanceContainer.Store);

                            GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Store document done.");
                            TimeHelper.waitInSeconds(2, "After store as URL to:" + _sOutputURL);
                            GlobalLogWriter.get().println("Reload stored file test.");
                            XComponent aDoc = loadFromURL(_aGTA, _sOutputURL);
                            if (aDoc == null)
                            {
                                GlobalLogWriter.get().println("Reload stored file test failed, can't reload file: " + _sOutputURL);
                            }
                        }
View Full Code Here

                return;
            }
           
            String sInputURL = URLHelper.getFileURLFromSystemPath(_sInputFile);
            // showType(sInputURL, xMSF);
            XComponent aDoc = loadFromURL( _aGTA, sInputURL);
            if (aDoc == null)
            {
                GlobalLogWriter.get().println("Can't load document '"+ sInputURL + "'");
                return;
            }
View Full Code Here

        // get a soffice factory object
        SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());

        try {
            log.println( "creating a chartdocument" );
            XComponent xComp = SOF.loadDocument(
                             utils.getFullTestURL("TransparencyChart.sxs"));
            xChartDoc = (XChartDocument)
                UnoRuntime.queryInterface(XChartDocument.class,xComp);
        } catch (com.sun.star.uno.Exception e) {
            // Some exception occures.FAILED
View Full Code Here

            Debug.logInfo("stringOutFile: "+stringOutFile, module);
            // Storing and converting the document
            xstorable.storeToURL(stringOutFile, propertyvalue);

            // Getting the method dispose() for closing the document
            XComponent xcomponent = (XComponent) UnoRuntime.queryInterface(XComponent.class,
            xstorable);

            // Closing the converted document
            xcomponent.dispose();

            Map results = ServiceUtil.returnSuccess();
            return results;
        } catch (Exception e) {
            Debug.logError(e, "Error in OpenOffice operation: ", module);
View Full Code Here

        boolean localRes = checkNameContainer(xCList.getDictionaryContainer());
        res &= localRes;
        assure("getDictionaryContainer didn't work as expected", localRes);

        String FileToLoad = util.utils.getFullTestURL("hangulhanja.sxc");
        XComponent xDoc = DesktopTools.loadDoc(xMSF, FileToLoad,
                                               new PropertyValue[] {  });
        XSpreadsheet xSheet = getSheet(xDoc);
        boolean done = false;
        int counter = 0;
        int numberOfWords = 0;
        String wordToCheck = "";
        String expectedConversion = "";

        while (!done) {
            String[] HangulHanja = getLeftAndRight(counter, xSheet);
            done = (HangulHanja[0].equals(""));
            counter++;

            if (!done) {
                numberOfWords++;

                try {
                    xDict.addEntry(HangulHanja[0], HangulHanja[1]);
                    wordToCheck += HangulHanja[0];
                    expectedConversion += HangulHanja[1];
                } catch (com.sun.star.lang.IllegalArgumentException e) {
                    e.printStackTrace();
                    res = false;
                    assure("Exception while checking adding entry", false);
                } catch (com.sun.star.container.ElementExistException e) {
                    //ignored
                }
            }
        }

        try {
            xDict.addEntry(wordToCheck, expectedConversion);
        } catch (com.sun.star.lang.IllegalArgumentException e) {
            e.printStackTrace();
            res = false;
            assure("Exception while checking adding entry", false);
        } catch (com.sun.star.container.ElementExistException e) {
            //ignored
        }

        localRes = xCList.queryMaxCharCount(aLocale, dictType,
                                            ConversionDirection.FROM_LEFT) == 42;
        res &= localRes;
        assure("queryMaxCharCount returned the wrong value", localRes);

        String[] conversion = null;

        try {
            conversion = xCList.queryConversions(wordToCheck, 0,
                                                 wordToCheck.length(), aLocale,
                                                 dictType,
                                                 ConversionDirection.FROM_LEFT,
                                                 TextConversionOption.NONE);
        } catch (com.sun.star.lang.IllegalArgumentException e) {
            res = false;
            assure("Exception while calling queryConversions", false);
        } catch (com.sun.star.lang.NoSupportException e) {
            res = false;
            assure("Exception while calling queryConversions", false);
        }

        localRes = conversion[0].equals(expectedConversion);
        res &= localRes;
        assure("queryConversions didn't work as expected", localRes);

        try {
            xCList.getDictionaryContainer().removeByName("addNewDictionary");
        } catch (com.sun.star.container.NoSuchElementException e) {
            res = false;
            assure("exception while removing Dictionary again", false);
        } catch (com.sun.star.lang.WrappedTargetException e) {
            res = false;
            assure("exception while removing Dictionary again", false);
        }

        localRes = !xCList.getDictionaryContainer()
                          .hasByName("addNewDictionary");
        res &= localRes;
        assure("Dictionary hasn't been removed properly", localRes);

        XComponent dicList = (XComponent) UnoRuntime.queryInterface(
                                     XComponent.class, xCList);
        XEventListener listen = new EventListener();
        dicList.addEventListener(listen);
        dicList.dispose();
        assure("dispose didn't work", disposed);
        dicList.removeEventListener(listen);

        DesktopTools.closeDoc(xDoc);

        return res;
    }
View Full Code Here

TOP

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

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.