Package com.sun.star.lang

Examples of com.sun.star.lang.Locale


   
    public boolean hasLocale( Locale aLocale )
        throws com.sun.star.uno.RuntimeException
    {
        boolean bRes = false;
        if ( IsEqual( aLocale, new Locale( "de", "DE", "" ) )  ||
             IsEqual( aLocale, new Locale( "en", "US", "" ) ))
            bRes = true;
        return bRes;       
    }
View Full Code Here


    @Test public void checkSimpleStringAccess() throws com.sun.star.uno.Exception, java.lang.Exception
    {
        // default bundle (UI locale)
        m_bundle = m_loader.loadBundle_Default( "orl" );

        Locale resourceLocale = m_bundle.getLocale();

        String testString = (String)m_bundle.getByName( "string:1000" );

        if  (   resourceLocale.Language.equals( "en" )
            &&  resourceLocale.Country.equals( "US" )
View Full Code Here

    /* ------------------------------------------------------------------ */
    @Test public void checkLocales() throws com.sun.star.uno.Exception, java.lang.Exception
    {
        // en-US bundle (should always be built and thus present and thus found)
        m_bundle = m_loader.loadBundle( "orl", new Locale( "en", "US", "" ) );
        Locale resourceLocale = m_bundle.getLocale();
        assertTrue( "'en-US' could not be loaded",
            resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) );

        // some (invalid) locale which is usually no built, and should thus fallback to en-US
        m_bundle = m_loader.loadBundle( "orl", new Locale( "inv", "al", "id" ) );
        resourceLocale = m_bundle.getLocale();
        assertTrue( "non-existing locale request does not fallback to en-US",
            resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) );
    }
View Full Code Here

        oObj = (XInterface) oInterface;

        TestEnvironment tEnv = new TestEnvironment( oObj );

        tEnv.addObjRelation("Locale"new Locale("en", "US", ""));

        XTextDocument xDoc = (XTextDocument)UnoRuntime.queryInterface
            (XTextDocument.class, xTextDoc);
        XTextRange xTextRange = (XTextRange)xDoc.getText();
        tEnv.addObjRelation("UnicodeString", xTextRange.getString());
View Full Code Here

            case 8: someValue = UnoRuntime.queryInterface( XElementAccess.class, new DummyElementAccess() ); break;
            case 9: someValue = new com.sun.star.uno.Exception(); break;
            case 10: someValue = new com.sun.star.uno.RuntimeException(); break;
            case 11: someValue = new EventObject(); break;
            case 12: someValue = new ContainerEvent(); break;
            case 13: someValue = new Locale(); break;   // just use *any* value which does not conflict with the others
            default:
                fail( "internal error: wrong position for getSomeValue" );
        }
        return someValue;
    }
View Full Code Here

     *
     */
    public static int getNumberFormatterKey( Object numberFormatsSupplier, short type)
    {
        Object numberFormatTypes = UnoRuntime.queryInterface(XNumberFormatsSupplier.class,numberFormatsSupplier).getNumberFormats();
        Locale l = new Locale();
        return UnoRuntime.queryInterface(XNumberFormatTypes.class,numberFormatTypes).getFormatIndex(type, l);
    }
View Full Code Here

    {
        try
        {
            XPropertySet xNumberFormat = _oNumberFormatter.xNumberFormats.getByKey(_FormatKey); //CurDBField.DBFormatKey);
            String FormatString = AnyConverter.toString(Helper.getUnoPropertyValue(xNumberFormat, "FormatString"));
            Locale oLocale = (Locale) Helper.getUnoPropertyValue(xNumberFormat, "Locale");
            int NewFormatKey = defineNumberFormat(FormatString, oLocale);
            XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, _xFormatObject);
            xPSet.setPropertyValue("FormatsSupplier", _oNumberFormatter.xNumberFormatter.getNumberFormatsSupplier());
            if (xPSet.getPropertySetInfo().hasPropertyByName("NumberFormat"))
            {
View Full Code Here

        public DateUtils(XMultiServiceFactory xmsf, Object document) throws Exception
        {
            XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);

            Object defaults = docMSF.createInstance("com.sun.star.text.Defaults");
            Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");

            java.util.Locale jl = new java.util.Locale(
                    l.Language, l.Country, l.Variant);

            calendar = Calendar.getInstance(jl);
View Full Code Here

    public static String getOfficeLocaleString(XMultiServiceFactory xMSF)
    {
        String sLocale = PropertyNames.EMPTY_STRING;
        try
        {
            Locale aLocLocale = new Locale();
            Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
            sLocale = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
        }
        catch (Exception exception)
        {
View Full Code Here

        return sLocale;
    }

    public static Locale getOfficeLocale(XMultiServiceFactory xMSF)
    {
        Locale aLocLocale = new Locale();
        // Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
        // String sLocale = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
        String sLocale = getOfficeLocaleString(xMSF);
        String[] sLocaleList = JavaTools.ArrayoutofString(sLocale, "-");
        aLocLocale.Language = sLocaleList[0];
View Full Code Here

TOP

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

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.