INTEGRATION: CWS qwizardsbf6 (1.10.14); FILE MERGED

2005/09/20 14:07:23 tv 1.10.14.4: #i47887# suppress macro attaching when creating personal letters
Issue number:
Submitted by:
Reviewed by:
2005/08/30 14:25:06 tv 1.10.14.3: #i53714# activate dialog after exchanging content in the preview frame - to avoid focus problems
Issue number:
Submitted by:
Reviewed by:
2005/08/15 15:31:56 tv 1.10.14.2: #i49215# correct default path

Issue number:
Submitted by:
Reviewed by:
2005/07/19 11:52:40 tv 1.10.14.1: #i48944# dynamically check installed letter wizard template and display the languages accordingly
This commit is contained in:
Jens-Heiner Rechtien
2005-09-23 14:31:33 +00:00
parent c31fed32e6
commit 79a5be91e6

View File

@@ -2,7 +2,6 @@ package com.sun.star.wizards.letter;
import java.util.Vector; import java.util.Vector;
import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.Locale;
import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.Configuration;
@@ -21,7 +20,6 @@ import com.sun.star.document.XDocumentInfoSupplier;
import com.sun.star.ucb.CommandAbortedException; import com.sun.star.ucb.CommandAbortedException;
import com.sun.star.uno.AnyConverter; import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception; import com.sun.star.uno.Exception;
import com.sun.star.uno.RuntimeException;
import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.text.*; import com.sun.star.wizards.text.*;
import com.sun.star.wizards.common.*; import com.sun.star.wizards.common.*;
@@ -34,7 +32,6 @@ import com.sun.star.wizards.document.*;
import com.sun.star.wizards.ui.*; import com.sun.star.wizards.ui.*;
import com.sun.star.wizards.ui.event.*; import com.sun.star.wizards.ui.event.*;
import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.Resource;
public class LetterWizardDialogImpl extends LetterWizardDialog { public class LetterWizardDialogImpl extends LetterWizardDialog {
@@ -42,6 +39,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog {
static LetterDocument myLetterDoc; static LetterDocument myLetterDoc;
static boolean running; static boolean running;
XMultiServiceFactory xmsf;
XTextDocument xTextDocument; XTextDocument xTextDocument;
PathSelection myPathSelection; PathSelection myPathSelection;
@@ -82,6 +81,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog {
public LetterWizardDialogImpl(XMultiServiceFactory xmsf) { public LetterWizardDialogImpl(XMultiServiceFactory xmsf) {
super(xmsf); super(xmsf);
this.xmsf = xmsf;
} }
public static void main(String args[]) { public static void main(String args[]) {
@@ -287,6 +287,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog {
lstBusinessStyleItemChanged(); lstBusinessStyleItemChanged();
enableSenderReceiver(); enableSenderReceiver();
setPossibleFooter(true); setPossibleFooter(true);
if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
} }
public void optPrivOfficialLetterItemChanged() { public void optPrivOfficialLetterItemChanged() {
@@ -302,6 +303,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog {
disableBusinessPaper(); disableBusinessPaper();
enableSenderReceiver(); enableSenderReceiver();
setPossibleFooter(true); setPossibleFooter(true);
if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
} }
public void optPrivateLetterItemChanged() { public void optPrivateLetterItemChanged() {
@@ -317,6 +319,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog {
disableBusinessPaper(); disableBusinessPaper();
disableSenderReceiver(); disableSenderReceiver();
setPossibleFooter(false); setPossibleFooter(false);
if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
} }
public void optSenderPlaceholderItemChanged() { public void optSenderPlaceholderItemChanged() {
@@ -368,24 +371,27 @@ public class LetterWizardDialogImpl extends LetterWizardDialog {
myLetterDoc.xTextDocument.lockControllers(); myLetterDoc.xTextDocument.lockControllers();
initializeElements(); initializeElements();
chkBusinessPaperItemChanged(); chkBusinessPaperItemChanged();
setElements(); setElements(false);
myLetterDoc.xTextDocument.unlockControllers(); myLetterDoc.xTextDocument.unlockControllers();
activate();
} }
public void lstPrivOfficialStyleItemChanged() { public void lstPrivOfficialStyleItemChanged() {
xTextDocument = myLetterDoc.loadAsPreview(OfficialFiles[1][lstPrivOfficialStyle.getSelectedItemPos()] , false ); xTextDocument = myLetterDoc.loadAsPreview(OfficialFiles[1][lstPrivOfficialStyle.getSelectedItemPos()] , false );
myLetterDoc.xTextDocument.lockControllers(); myLetterDoc.xTextDocument.lockControllers();
initializeElements(); initializeElements();
setElements(); setElements(false);
myLetterDoc.xTextDocument.unlockControllers(); myLetterDoc.xTextDocument.unlockControllers();
activate();
} }
public void lstPrivateStyleItemChanged() { public void lstPrivateStyleItemChanged() {
xTextDocument = myLetterDoc.loadAsPreview(PrivateFiles[1][lstPrivateStyle.getSelectedItemPos()] , false ); xTextDocument = myLetterDoc.loadAsPreview(PrivateFiles[1][lstPrivateStyle.getSelectedItemPos()] , false );
myLetterDoc.xTextDocument.lockControllers(); myLetterDoc.xTextDocument.lockControllers();
initializeElements(); initializeElements();
setElements(); setElements(true);
myLetterDoc.xTextDocument.unlockControllers(); myLetterDoc.xTextDocument.unlockControllers();
activate();
} }
public void numLogoHeightTextChanged() { public void numLogoHeightTextChanged() {
@@ -849,51 +855,68 @@ public class LetterWizardDialogImpl extends LetterWizardDialog {
} }
public void initializeNorms() { public void initializeNorms() {
//To add new Languages please modify this method and LetterWizardDialogResources.java
//I know, this is ugly. I will implement a more elegant solution in Product Update 1
String ProdName = Configuration.getProductName(xMSF); LocaleCodes lc = new LocaleCodes(xmsf);
String [] allLocales = lc.getIDs();
String[] nameList = {"",""};
String sLetterSubPath = "/wizard/letter/";
if (ProdName.startsWith("Open")) { try {
//Add Languages for OpenOffice.org sLetterPath = FileAccess.deleteLastSlashfromUrl(sTemplatePath);
Norms = new String[16]; String [] PathParts = sLetterPath.split("/");
String nuString ="";
for (int i=0; i<(PathParts.length -1); i++) {
nuString = nuString + PathParts[i] + "/";
}
sLetterPath = nuString;
sLetterPath = FileAccess.deleteLastSlashfromUrl(sLetterPath);
sLetterPath = sLetterPath + sLetterSubPath;
sLetterLangPackPath = FileAccess.combinePaths(xMSF, sTemplatePath, sLetterSubPath);
Norms[0] = "en-US"; XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
Norms[1] = "de"; com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = (com.sun.star.ucb.XSimpleFileAccess) UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface);
Norms[2] = "fr"; nameList = xSimpleFileAccess.getFolderContents(sLetterPath, true);
Norms[3] = "es"; } catch (CommandAbortedException e) {
Norms[4] = "it"; // TODO Auto-generated catch block
Norms[5] = "pt-BR"; e.printStackTrace();
Norms[6] = "sv"; } catch (NoValidPathException e) {
Norms[7] = "ja"; // TODO Auto-generated catch block
Norms[8] = "ko"; e.printStackTrace();
Norms[9] = "zh-CN"; } catch (Exception e) {
Norms[10] = "zh-TW"; // TODO Auto-generated catch block
Norms[11] = "cs"; e.printStackTrace();
Norms[12] = "bg";
Norms[13] = "da";
Norms[14] = "hu";
Norms[15] = "hr";
} else {
Norms = new String[11];
Norms[0] = "en-US";
Norms[1] = "de";
Norms[2] = "fr";
Norms[3] = "es";
Norms[4] = "it";
Norms[5] = "pt-BR";
Norms[6] = "sv";
Norms[7] = "ja";
Norms[8] = "ko";
Norms[9] = "zh-CN";
Norms[10] = "zh-TW";
} }
Norms = new String[nameList.length];
String [] LanguageLabels; String [] LanguageLabels;
LanguageLabels = new String[Norms.length]; LanguageLabels = new String[Norms.length];
for (int i=0;i < Norms.length; i++) {
LanguageLabels[i] = resources.LanguageLabels[i]; boolean found = false;
String cIsoCode = "";
String MSID = "";
for (int i=0; i < nameList.length; i++) {
found = false;
cIsoCode = FileAccess.getFilename(nameList[i]);
for (int t=0; t < allLocales.length; t++) {
String [] aLang = allLocales[t].split(";");
if (cIsoCode.equalsIgnoreCase(aLang[1])) {
MSID= aLang[2];
found = true;
t = allLocales.length;
}
}
if (!found) {
for (int t=0; t < allLocales.length; t++) {
String [] aLang = allLocales[t].split(";");
if (cIsoCode.equalsIgnoreCase(aLang[1].substring(0,2))) {
MSID= aLang[2];
found = true;
t = allLocales.length;
}
}
}
Norms[i] = cIsoCode;
LanguageLabels[i] = lc.getLanguageString(MSID);
} }
setControlProperty("lstLetterNorm", "StringItemList", LanguageLabels); setControlProperty("lstLetterNorm", "StringItemList", LanguageLabels);
@@ -970,7 +993,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog {
} }
} }
public void setElements() { public void setElements(boolean privLetter) {
//UI relevant: //UI relevant:
if (optSenderDefine.getState()) {optSenderDefineItemChanged();} if (optSenderDefine.getState()) {optSenderDefineItemChanged();}
if (optSenderPlaceholder.getState()) {optSenderPlaceholderItemChanged();} if (optSenderPlaceholder.getState()) {optSenderPlaceholderItemChanged();}
@@ -983,8 +1006,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog {
txtTemplateNameTextChanged(); txtTemplateNameTextChanged();
//not UI relevant: //not UI relevant:
if (optReceiverDatabase.getState()) {optReceiverDatabaseItemChanged();} if (optReceiverDatabase.getState() && !privLetter) {optReceiverDatabaseItemChanged();}
if (optReceiverPlaceholder.getState()) {optReceiverPlaceholderItemChanged();} if (optReceiverPlaceholder.getState() && !privLetter) {optReceiverPlaceholderItemChanged();}
if (optCreateLetter.getState()) {optCreateLetterItemChanged();} if (optCreateLetter.getState()) {optCreateLetterItemChanged();}
if (optMakeChanges.getState()) {optMakeChangesItemChanged();} if (optMakeChanges.getState()) {optMakeChangesItemChanged();}
} }