summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star')
-rw-r--r--wizards/com/sun/star/wizards/common/Configuration.java42
-rw-r--r--wizards/com/sun/star/wizards/db/DBMetaData.java4
-rw-r--r--wizards/com/sun/star/wizards/table/CGTable.java2
-rw-r--r--wizards/com/sun/star/wizards/table/ScenarioSelector.java2
-rw-r--r--wizards/com/sun/star/wizards/table/TableWizard.java4
-rw-r--r--wizards/com/sun/star/wizards/ui/CommandFieldSelection.java2
6 files changed, 33 insertions, 23 deletions
diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java
index bba2a79ffd83..3983f82f505a 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.java
+++ b/wizards/com/sun/star/wizards/common/Configuration.java
@@ -200,26 +200,30 @@ public abstract class Configuration
}
}
- public static String getOfficeLocaleString(XMultiServiceFactory xMSF)
+ public static String getLocaleString(XMultiServiceFactory xMSF, String root, String key)
{
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");
+ Object oMasterKey = getConfigurationRoot(xMSF, root, false);
+ sLocale = (String) Helper.getUnoObjectbyName(oMasterKey, key);
}
catch (Exception exception)
{
exception.printStackTrace(System.err);
}
+ if (sLocale.length() == 0 && (!key.equals("Locale") || !root.equals("org.openoffice.System/L10N/")))
+ {
+ return getLocaleString(xMSF, "org.openoffice.System/L10N/", "Locale");
+ }
return sLocale;
}
- public static Locale getOfficeLocale(XMultiServiceFactory xMSF)
+ public static Locale getLocale(XMultiServiceFactory xMSF, String root, String key)
{
Locale aLocLocale = new Locale();
- String sLocale = getOfficeLocaleString(xMSF);
+ String sLocale = getLocaleString(xMSF, root, key);
String[] sLocaleList = JavaTools.ArrayoutofString(sLocale, "-");
aLocLocale.Language = sLocaleList[0];
if (sLocaleList.length > 1)
@@ -229,18 +233,24 @@ public abstract class Configuration
return aLocLocale;
}
- public static String getOfficeLinguistic(XMultiServiceFactory xMSF)
+ public static Locale getLocale(XMultiServiceFactory xMSF)
{
- try
- {
- Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
- return (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
- }
- catch (Exception exception)
- {
- exception.printStackTrace();
- return null;
- }
+ return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale");
+ }
+
+ public static Locale getUILocale(XMultiServiceFactory xMSF)
+ {
+ return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooLocale");
+ }
+
+ public static String getLocaleString(XMultiServiceFactory xMSF)
+ {
+ return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale");
+ }
+
+ public static String getUILocaleString(XMultiServiceFactory xMSF)
+ {
+ return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooLocale");
}
/**
diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java
index 93b42e01dd8d..39c4f84f7871 100644
--- a/wizards/com/sun/star/wizards/db/DBMetaData.java
+++ b/wizards/com/sun/star/wizards/db/DBMetaData.java
@@ -169,7 +169,7 @@ public class DBMetaData
{
XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) AnyConverter.toObject(XNumberFormatsSupplier.class, xDataSourcePropertySet.getPropertyValue("NumberFormatsSupplier"));
//TODO get the locale from the datasource
- aLocale = Configuration.getOfficeLocale(xMSF);
+ aLocale = Configuration.getLocale(xMSF);
oNumberFormatter = new NumberFormatter(xMSF, xNumberFormatsSupplier, aLocale);
lDateCorrection = oNumberFormatter.getNullDateCorrection();
}
@@ -529,7 +529,7 @@ public class DBMetaData
}
if (this.isSQL92CheckEnabled())
{
- return Desktop.removeSpecialCharacters(xMSF, Configuration.getOfficeLocale(xMSF), _sname);
+ return Desktop.removeSpecialCharacters(xMSF, Configuration.getLocale(xMSF), _sname);
}
return _sname;
}
diff --git a/wizards/com/sun/star/wizards/table/CGTable.java b/wizards/com/sun/star/wizards/table/CGTable.java
index 9237901c4b07..6e10598076b7 100644
--- a/wizards/com/sun/star/wizards/table/CGTable.java
+++ b/wizards/com/sun/star/wizards/table/CGTable.java
@@ -74,7 +74,7 @@ public class CGTable
}
for (int i = 0; i < fieldnames.length; i++)
{
- fieldnames[i] = Desktop.removeSpecialCharacters(xMSF, Configuration.getOfficeLocale(xMSF), fieldnames[i]);
+ fieldnames[i] = Desktop.removeSpecialCharacters(xMSF, Configuration.getLocale(xMSF), fieldnames[i]);
}
return fieldnames;
}
diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
index 5d505c903e60..7ae2bd016768 100644
--- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java
+++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
@@ -70,7 +70,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
super(_CurUnoDialog, TableWizard.SOMAINPAGE, 91, 108, 230, 80, _reslblFields, _reslblSelFields, 41209, true);
CurTableWizardUnoDialog = _CurUnoDialog;
xMSF = CurUnoDialog.xMSF;
- aLocale = Configuration.getOfficeLocale(xMSF);
+ aLocale = Configuration.getLocale(xMSF);
curtabledescriptor = _curtabledescriptor;
imaxcolumnchars = this.curtabledescriptor.getMaxColumnNameLength();
bcolumnnameislimited = (imaxcolumnchars > 0) && (imaxcolumnchars < 16);
diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java
index ddd4be3d65bb..70ce06bccaa2 100644
--- a/wizards/com/sun/star/wizards/table/TableWizard.java
+++ b/wizards/com/sun/star/wizards/table/TableWizard.java
@@ -283,7 +283,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
scomposedtablename = curFinalizer.getComposedTableName(tablename);
if (this.curTableDescriptor.isSQL92CheckEnabled())
{
- Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getOfficeLocale(this.curTableDescriptor.xMSF), tablename);
+ Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getLocale(this.curTableDescriptor.xMSF), tablename);
}
if ( tablename.length() > 0 )
{
@@ -422,7 +422,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
{
Object otextcomponent = UnoDialog.getModel(aTextEvent.Source);
String sName = (String) Helper.getUnoPropertyValue(otextcomponent, "Text");
- sName = Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getOfficeLocale(curTableDescriptor.xMSF), sName);
+ sName = Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getLocale(curTableDescriptor.xMSF), sName);
Helper.setUnoPropertyValue(otextcomponent, "Text", sName);
}
}
diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
index a52edad88b70..082bd36e631d 100644
--- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
@@ -326,7 +326,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
{
if (this.aCollator == null)
{
- com.sun.star.lang.Locale aOfficeLocale = Configuration.getOfficeLocale(this.CurDBMetaData.xMSF);
+ com.sun.star.lang.Locale aOfficeLocale = Configuration.getLocale(this.CurDBMetaData.xMSF);
java.util.Locale aJavaLocale = new java.util.Locale(aOfficeLocale.Language, aOfficeLocale.Country, aOfficeLocale.Variant);
//Get the Collator for US English and set its strength to PRIMARY
this.aCollator = Collator.getInstance(aJavaLocale);