summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorIstvan Turi <turipista@freemail.hu>2012-08-24 21:47:16 +0200
committerAndras Timar <atimar@suse.com>2012-08-24 21:53:39 +0200
commit1b7c88ab4d6aaa79c484bcb179e5b2f296654462 (patch)
tree351a3b9acb4237fdfe7a114f199b4d20c9863a62 /wizards
parenta581d31b227623e09d2970a91214fda398f98eda (diff)
translate fax/letter/agenda/report templates runtime
Instead of distributing bazillions of localized templates, that contain only a few translatable strings, we try to localize them runtime. This is the initial patch that does the heavy-lifting. It has some rough edges, but the feature will be polished by freezing of LibreOffice 3.7. Change-Id: I535b3bff1f5706afebd21d017c01e2b4745b7cfb
Diffstat (limited to 'wizards')
-rw-r--r--wizards/Jar_commonwizards.mk4
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaTemplate.java391
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java234
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java103
-rw-r--r--wizards/com/sun/star/wizards/agenda/TemplateConsts.java30
-rw-r--r--wizards/com/sun/star/wizards/agenda/TopicsControl.java113
-rw-r--r--wizards/com/sun/star/wizards/common/ParaStyled.java64
-rw-r--r--wizards/com/sun/star/wizards/common/PlaceholderTextElement.java98
-rw-r--r--wizards/com/sun/star/wizards/common/TemplateElement.java24
-rw-r--r--wizards/com/sun/star/wizards/common/TextElement.java64
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java165
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java32
-rw-r--r--wizards/com/sun/star/wizards/letter/CGLetter.java1
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialog.java22
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java3
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java334
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java5
-rw-r--r--wizards/com/sun/star/wizards/report/ReportLayouter.java120
-rw-r--r--wizards/com/sun/star/wizards/report/ReportWizard.java6
-rw-r--r--wizards/source/formwizard/dbwizres.src111
20 files changed, 1432 insertions, 492 deletions
diff --git a/wizards/Jar_commonwizards.mk b/wizards/Jar_commonwizards.mk
index ee3d68c3ddad..7efdc96947b4 100644
--- a/wizards/Jar_commonwizards.mk
+++ b/wizards/Jar_commonwizards.mk
@@ -67,6 +67,10 @@ $(eval $(call gb_Jar_add_sourcefiles,commonwizards,\
wizards/com/sun/star/wizards/common/PropertySetHelper \
wizards/com/sun/star/wizards/common/NumericalHelper \
wizards/com/sun/star/wizards/common/NamedValueCollection \
+ wizards/com/sun/star/wizards/common/ParaStyled \
+ wizards/com/sun/star/wizards/common/PlaceholderTextElement \
+ wizards/com/sun/star/wizards/common/TemplateElement \
+ wizards/com/sun/star/wizards/common/TextElement \
wizards/com/sun/star/wizards/db/DBMetaData \
wizards/com/sun/star/wizards/db/CommandMetaData \
wizards/com/sun/star/wizards/db/QueryMetaData \
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
index 860d413debe7..5e810e34bd11 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
@@ -53,13 +53,13 @@ import com.sun.star.wizards.ui.UnoDialog2;
import com.sun.star.wizards.ui.event.DataAware;
/**
- *
- * The classes here implement the whole document-functionality of the agenda wizard:
+ *
+ * The classes here implement the whole document-functionality of the agenda wizard:
* the live-preview and the final "creation" of the document, when the user clicks "finish". <br/>
* <br/>
* <h2>Some terminology:<h2/>
* items are names or headings. we don't make any distinction.
- *
+ *
* <br/>
* The Agenda Template is used as general "controller" of the whole document, whereas the
* two child-classes ItemsTable and TopicsTable control the item tables (note plural!) and the
@@ -93,7 +93,7 @@ import com.sun.star.wizards.ui.event.DataAware;
* Many methods here are synchronized, in order to avoid colission made by
* events fired too often.
* @author rpiterman
- *
+ *
*/
public class AgendaTemplate extends TextDocument implements TemplateConsts, DataAware.Listener
{
@@ -120,10 +120,10 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* The template-filename of the current template.
* Since we often re-link section and the break the link,
* inorder to restore them, we need a template to link to.
- * This is practically an identicall copy of the current template.
+ * This is practically an identicall copy of the current template.
*/
String template;
- /**
+ /**
* used for common operations on sections.
*/
TextSectionHandler textSectionHandler;
@@ -132,8 +132,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
XComponentLoader xComponentLoader;
/**
- * an array containing all ItemTable object (which control each an Items
- * Table in the document.
+ * an array containing all ItemTable object (which control each an Items
+ * Table in the document.
*/
ItemsTable[] itemsTables;
/**
@@ -155,13 +155,26 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* A temporary variable used to list all items and map them.
*/
List<XTextRange> _allItems = new ArrayList<XTextRange>();
- /**
- * keep a reference on some static items in the document,
+ List<XTextRange> constItems = new ArrayList<XTextRange>();
+ /**
+ * keep a reference on some static items in the document,
* so when their content is changed (through the user), we
* can just reference them and set their text.
*/
TextElement teTitle, teDate, teTime, teLocation;
XTextRange trTitle, trDate, trTime, trLocation;
+
+ TextElement teDateTitle, teTimeTitle, teLocationTitle, teTopics, teNum, teTopicHeader, teResponsibleHeader, teTimeHeader, teAdditionalInformation, teMinutesFor, teDiscussion, teConclusion, teToDo, teResponsibleParty, teDeadline;
+
+ XTextRange trDateTitle, trTimeTitle, trLocationTitle, trTopics, trNum, trTopicHeader, trResponsibleHeader, trTimeHeader, trAdditionalInformation, trMinutesFor, trDiscussion, trConclusion, trToDo, trResponsibleParty, trDeadline;
+
+ List<TextElement> teTopicList = new ArrayList<TextElement>();
+ List<TextElement> teResponsibleList = new ArrayList<TextElement>();
+ List<TextElement> teTimeList = new ArrayList<TextElement>();
+ List<XTextRange> trTopicList = new ArrayList<XTextRange>();
+ List<XTextRange> trResponsibleList = new ArrayList<XTextRange>();
+ List<XTextRange> trTimeList = new ArrayList<XTextRange>();
+
/**
* used to format the date / time.
*/
@@ -184,6 +197,45 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @see #initialize()
* @see #initializeData(List)
*/
+ public void clearConstants()
+ {
+ teDateTitle = null;
+ teTimeTitle = null;
+ teLocationTitle = null;
+ teTopics = null;
+ teNum = null;
+ teAdditionalInformation = null;
+ teMinutesFor = null;
+ teDiscussion = null;
+ teConclusion = null;
+ teToDo = null;
+ teResponsibleParty = null;
+ teDeadline = null;
+ trDateTitle = null;
+ trTimeTitle = null;
+ trLocationTitle = null;
+ trTopics = null;
+ trNum = null;
+ trAdditionalInformation = null;
+ trMinutesFor = null;
+ trDiscussion = null;
+ trConclusion = null;
+ trToDo = null;
+ trResponsibleParty = null;
+ trDeadline = null;
+ }
+
+ public void clearTopicConstants()
+ {
+ teTopicList.clear();
+ teResponsibleList.clear();
+ teTimeList.clear();
+
+ trTopicList.clear();
+ trResponsibleList.clear();
+ trTimeList.clear();
+ }
+
public synchronized void load(String templateURL, List<PropertyValue[]> topics)
{
template = calcTemplateName(templateURL);
@@ -218,7 +270,10 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
private void initializeData(List<PropertyValue[]> topicsData)
{
- for (int i = 0; i < itemsTables.length; i++)
+ //I had to decrease the limit by one, since it affects the
+ //#additional-information# tag for some reason. During the tests,
+ //it was working perfectly this way as well.
+ for (int i = 0; i < itemsTables.length - 1; i++)
{
try
{
@@ -289,8 +344,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
{
initItemsCache();
}
- _allItems = null;
-
+ _allItems.clear();
+ constItems.clear();
}
/**
@@ -352,7 +407,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
}
/**
- * itemsCache is a Map containing all agenda item. These are object which
+ * itemsCache is a Map containing all agenda item. These are object which
* "write themselfs" to the table, given a table cursor.
* A cache is used in order to reuse the objects, instead of recreate them.
* This method fills the cache will all items objects (names and headings).
@@ -432,6 +487,9 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
try
{
+ clearConstants();
+ clearTopicConstants();
+
Object defaults = docMSF.createInstance("com.sun.star.text.Defaults");
Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
@@ -469,12 +527,20 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
initItemsCache();
initializeItems();
initializeTitles();
+ initializeConstantTitles();
+ initializeConstantTopicTitles();
initializeItemsSections();
XMultiServiceFactory xMultiServiceFactory = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
textSectionHandler = new TextSectionHandler(xMultiServiceFactory, UnoRuntime.queryInterface(XTextDocument.class, document));
initializeTopics();
+
+ drawConstants();
+ drawTopicConstants();
+
_allItems.clear();
- _allItems = null;
+ //_allItems = null;
+ constItems.clear();
+ //constItems = null;
}
/**
@@ -517,6 +583,136 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
_allItems.remove(i--);
}
}
+ }
+//
+ private void initializeConstantTitles()
+ {
+ XTextRange item = null;
+
+ XMultiServiceFactory xmsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+
+ for (int i = 0; i < constItems.size(); i++)
+ {
+ item = constItems.get(i);
+ String text = item.getString().trim().toLowerCase();
+ if (text.equals(FILLIN_DATETITLE))
+ {
+ teDateTitle = new PlaceholderTextElement(item, resources.resPlaceHolderDateTitle, resources.resPlaceHolderHint, xmsf);
+ trDateTitle = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_TIMETITLE))
+ {
+ teTimeTitle = new PlaceholderTextElement(item, resources.resPlaceHolderTimeTitle, resources.resPlaceHolderHint, xmsf);
+ trTimeTitle = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_LOCATIONTITLE))
+ {
+ teLocationTitle = new PlaceholderTextElement(item, resources.resPlaceHolderLocationTitle, resources.resPlaceHolderHint, xmsf);
+ trLocationTitle = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_TOPICS))
+ {
+ teTopics = new PlaceholderTextElement(item, resources.resPlaceHolderTopics, resources.resPlaceHolderHint, xmsf);
+ trTopics = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_NUM))
+ {
+ teNum = new PlaceholderTextElement(item, resources.resPlaceHolderNum, resources.resPlaceHolderHint, xmsf);
+ trNum = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_ADDITIONAL_INFORMATION))
+ {
+ teAdditionalInformation = new PlaceholderTextElement(item, resources.resPlaceHolderAdditionalInformation, resources.resPlaceHolderHint, xmsf);
+ trAdditionalInformation = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_MINUTES_FOR))
+ {
+ teMinutesFor = new PlaceholderTextElement(item, resources.resPlaceHolderMinutesFor, resources.resPlaceHolderHint, xmsf);
+ trMinutesFor = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_DISCUSSION))
+ {
+ teDiscussion = new PlaceholderTextElement(item, resources.resPlaceHolderDiscussion, resources.resPlaceHolderHint, xmsf);
+ trDiscussion = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_CONCLUSION))
+ {
+ teConclusion = new PlaceholderTextElement(item, resources.resPlaceHolderConclusion, resources.resPlaceHolderHint, xmsf);
+ trConclusion = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_TO_DO))
+ {
+ teToDo = new PlaceholderTextElement(item, resources.resPlaceHolderToDo, resources.resPlaceHolderHint, xmsf);
+ trToDo = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_RESPONSIBLE_PARTY))
+ {
+ teResponsibleParty = new PlaceholderTextElement(item, resources.resPlaceHolderResponsibleParty, resources.resPlaceHolderHint, xmsf);
+ trResponsibleParty = item;
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_DEADLINE))
+ {
+ teDeadline = new PlaceholderTextElement(item, resources.resPlaceHolderDeadline, resources.resPlaceHolderHint, xmsf);
+ trDeadline = item;
+ constItems.remove(i--);
+ }
+//
+ }
+ }
+
+ private void initializeConstantTopicTitles()
+ {
+ XTextRange item = null;
+
+ XMultiServiceFactory xmsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+
+ for (int i = 0; i < constItems.size(); i++)
+ {
+ item = constItems.get(i);
+ String text = item.getString().trim().toLowerCase();
+
+ if (text.equals(FILLIN_TOPIC))
+ {
+ teTopicHeader = new PlaceholderTextElement(item, resources.resPlaceHolderTopic, resources.resPlaceHolderHint, xmsf);
+ trTopicHeader = item;
+
+ teTopicList.add(teTopicHeader);
+ trTopicList.add(trTopicHeader);
+
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_RESPONSIBLE))
+ {
+ teResponsibleHeader = new PlaceholderTextElement(item, resources.resPlaceHolderResponsible, resources.resPlaceHolderHint, xmsf);
+ trResponsibleHeader = item;
+
+ teResponsibleList.add(teResponsibleHeader);
+ trResponsibleList.add(trResponsibleHeader);
+
+ constItems.remove(i--);
+ }
+ else if (text.equals(FILLIN_TIME_HEADER))
+ {
+ teTimeHeader = new PlaceholderTextElement(item, resources.resPlaceHolderTime, resources.resPlaceHolderHint, xmsf);
+ trTimeHeader = item;
+
+ teTimeList.add(teTimeHeader);
+ trTimeList.add(trTimeHeader);
+
+ constItems.remove(i--);
+ }
+ }
}
private void initializeTopics()
@@ -524,22 +720,46 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
topics = new Topics();
}
+ public void refreshTopicConstants()
+ {
+ constItems = searchFillInItems(1);
+ clearConstants();
+ initializeConstantTopicTitles();
+ drawTopicConstants();
+ }
+
+ public void refreshConstants()
+ {
+ constItems = searchFillInItems(1);
+ clearTopicConstants();
+ initializeConstantTitles();
+ drawConstants();
+ }
+
private void initializeItems()
{
- _allItems = searchFillInItems();
+ _allItems = searchFillInItems(0);
+ constItems = searchFillInItems(1);
}
/**
* searches the document for items in the format "&gt;*&lt;"
* @return a vector containing the XTextRanges of the found items
*/
- private List<XTextRange> searchFillInItems()
+ private List<XTextRange> searchFillInItems(int type)
{
try
{
XSearchable xSearchable = UnoRuntime.queryInterface(XSearchable.class, document);
XSearchDescriptor sd = xSearchable.createSearchDescriptor();
- sd.setSearchString("<[^>]+>");
+ if(type == 0)
+ {
+ sd.setSearchString("<[^>]+>");
+ }
+ else if(type == 1)
+ {
+ sd.setSearchString("#[^#]+#");
+ }
sd.setPropertyValue("SearchRegularExpression", Boolean.TRUE);
sd.setPropertyValue("SearchWords", Boolean.TRUE);
@@ -623,7 +843,6 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
UnoDialog2.getModel(te.Source),
PropertyNames.PROPERTY_NAME);
redrawTitle(controlName);
-
}
private synchronized void redrawTitle(String controlName)
@@ -650,6 +869,65 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
}
}
+ public void drawConstants()
+ {
+ if(teDateTitle != null){
+ writeTitle(teDateTitle, trDateTitle, resources.resPlaceHolderDateTitle);
+ }
+ if(teTimeTitle != null){
+ writeTitle(teTimeTitle, trTimeTitle, resources.resPlaceHolderTimeTitle);
+ }
+ if(teLocationTitle != null){
+ writeTitle(teLocationTitle, trLocationTitle, resources.resPlaceHolderLocationTitle);
+ }
+ if(teTopics != null){
+ writeTitle(teTopics, trTopics, resources.resPlaceHolderTopics);
+ }
+ if(teNum != null){
+ writeTitle(teNum, trNum, resources.resPlaceHolderNum);
+ }
+ if(teAdditionalInformation != null){
+ writeTitle(teAdditionalInformation, trAdditionalInformation, resources.resPlaceHolderAdditionalInformation);
+ }
+ if(teMinutesFor != null){
+ writeTitle(teMinutesFor, trMinutesFor, resources.resPlaceHolderMinutesFor);
+ }
+ if(teDiscussion != null){
+ writeTitle(teDiscussion, trDiscussion, resources.resPlaceHolderDiscussion);
+ }
+ if(teConclusion != null){
+ writeTitle(teConclusion, trConclusion, resources.resPlaceHolderConclusion);
+ }
+ if(teToDo != null){
+ writeTitle(teToDo, trToDo, resources.resPlaceHolderToDo);
+ }
+ if(teResponsibleParty != null){
+ writeTitle(teResponsibleParty, trResponsibleParty, resources.resPlaceHolderResponsibleParty);
+ }
+ if(teDeadline != null){
+ writeTitle(teDeadline, trDeadline, resources.resPlaceHolderDeadline);
+ }
+ }
+
+ public void drawTopicConstants()
+ {
+ if(teTopicList != null){
+ for(int i=0; i<teTopicList.size(); ++i){
+ writeTitle(teTopicList.get(i), trTopicList.get(i), resources.resPlaceHolderTopic);
+ }
+ }
+ if(teResponsibleList != null){
+ for(int i=0; i<teResponsibleList.size(); ++i){
+ writeTitle(teResponsibleList.get(i), trResponsibleList.get(i), resources.resPlaceHolderResponsible);
+ }
+ }
+ if(teTimeList != null){
+ for(int i=0; i<teTimeList.size(); ++i){
+ writeTitle(teTimeList.get(i), trTimeList.get(i), resources.resPlaceHolderTimeHeader);
+ }
+ }
+ }
+
private void writeTitle(TextElement te, XTextRange tr, String text)
{
te.text = (text == null ? PropertyNames.EMPTY_STRING : text);
@@ -702,7 +980,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
textSectionHandler.removeAllTextSections();
}
- /**
+ /**
* hidden sections exist when an item's section is hidden because the
* user specified not to display any items which it contains.
* When finishing the wizard removes this sections entireley from the document.
@@ -732,9 +1010,9 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/**
* create the minutes for the given topics or remove the minutes section from the document.
- * If no topics are supplied, or the user
- * specified not to create minuts, the minutes section will be removed,
- * @param topicsData supplies PropertyValue arrays containing the values for the topics.
+ * If no topics are supplied, or the user
+ * specified not to create minuts, the minutes section will be removed,
+ * @param topicsData supplies PropertyValue arrays containing the values for the topics.
*/
public synchronized void createMinutes(List<PropertyValue[]> topicsData)
{
@@ -773,7 +1051,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
String time;
// first I replace the minutes titles...
- List<XTextRange> items = searchFillInItems();
+ List<XTextRange> items = searchFillInItems(0);
for (int itemIndex = 0; itemIndex < items.size(); itemIndex++)
{
item = items.get(itemIndex);
@@ -795,6 +1073,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
{
fillMinutesItem(item, getTimeString(agenda.cp_Time), resources.resPlaceHolderTime);
}
+
}
items.clear();
@@ -803,14 +1082,14 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* now add minutes for each topic.
* The template contains *one* minutes section, so
* we first use the one available, and then add a new one...
- *
+ *
* topics data has *always* an empty topic at the end...
*/
for (int i = 0; i < topicsData.size() - 1; i++)
{
PropertyValue[] topic = topicsData.get(i);
- items = searchFillInItems();
+ items = searchFillInItems(0);
for (int itemIndex = 0; itemIndex < items.size(); itemIndex++)
{
item = items.get(itemIndex);
@@ -1016,9 +1295,9 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/* now go through all items that belong to this
* table. Check each one agains the model. If it should
* be display, call it's write method.
- * All items are of type AgendaItem which means they write
+ * All items are of type AgendaItem which means they write
* two cells to the table: a title (text) and a placeholder.
- * see AgendaItem class below.
+ * see AgendaItem class below.
*/
for (int i = 0; i < items.size(); i++)
{
@@ -1074,7 +1353,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
int rowIndex = getRowIndex(cursor);
int rowsCount = getRowCount(UnoRuntime.queryInterface(XTextTable.class, table));
- /* now before deleteing i move the cursor up so it
+ /* now before deleteing i move the cursor up so it
* does not disappear, because it will crash office.
*/
cursor.gotoStart(false);
@@ -1097,7 +1376,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/**
* This class handles the preview of the topics table.
* You can call it the controller of the topics table.
- * It differs from ItemsTable in that it has no data model -
+ * It differs from ItemsTable in that it has no data model -
* the update is done programttically.<br/>
* <br/>
* The decision to make this class a class by its own
@@ -1105,7 +1384,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* since there is anyway only one instance of this class at runtime
* it could have also be implemented in the AgendaTemplate class
* but for clarity and separation I decided to make a sub class for it.
- *
+ *
* @author rp143992
*/
public class Topics
@@ -1135,7 +1414,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
List<AgendaElement> topicCells = new ArrayList<AgendaElement>();
int rowsPerTopic;
/**
- * fields which hold the number of the
+ * fields which hold the number of the
* fillins in the cells vectors.
*/
int numCell = -1;
@@ -1155,7 +1434,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/**
* Analyze the structure of the Topics table.
* The structure Must be as follows:<br>
- * -One Header Row. <br>
+ * -One Header Row. <br>
* -arbitrary number of rows per topic <br>
* -arbitrary content in the topics row <br>
* -only soft formatting will be restored. <br>
@@ -1213,7 +1492,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
}
/*
- * in the topics table, there are always one
+ * in the topics table, there are always one
* title row and three topics defined.
* So no mutter how many rows a topic takes - we
* can restore its structure and format.
@@ -1264,7 +1543,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
- /* now that we know how the topics look like,
+ /* now that we know how the topics look like,
* we get the format of the first and last rows.
*/
@@ -1340,8 +1619,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/**
* check if the topic with the given index is written to the table.
* @param topic the topic number (0 base)
- * @return true if the topic is already written to the table. False if not.
- * (false would mean new rows must be added to the table in order to
+ * @return true if the topic is already written to the table. False if not.
+ * (false would mean new rows must be added to the table in order to
* be able to write this topic).
*/
private boolean isWritten(int topic)
@@ -1351,11 +1630,11 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/**
* rewrites a single cell containing.
- * This is used in order to refresh the topic/responsible/duration data in the
+ * This is used in order to refresh the topic/responsible/duration data in the
* preview document, in response to a change in the gui (by the user).
* Since the structure of the topics table is flexible, we don't reference a cell
* number. Rather, we use "what" argument to specify which cell should be redrawn.
- * The Topics object, which analyzed the structure of the topics table appon
+ * The Topics object, which analyzed the structure of the topics table appon
* initialization, refreshes the approperiate cell.
* @param topic index of the topic (0 based).
* @param what 0 for num, 1 for topic, 2 for responsible, 3 for duration
@@ -1415,10 +1694,10 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* writes the given topic.
* if the first topic was involved, reformat the
* first row.
- * If any rows were added to the table, reformat
- * the last row.
+ * If any rows were added to the table, reformat
+ * the last row.
* @param topic the index of the topic to write.
- * @param data the topic's data. (see TopicsControl
+ * @param data the topic's data. (see TopicsControl
* for explanation about the topics data model)
* @throws Exception if something goes wrong (though nothing should).
*/
@@ -1470,10 +1749,10 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* number of actuall topics it does *not* add
* new rows !
* Note also that the first topic will never be removed.
- * If the table contains no topics, the whole section will
+ * If the table contains no topics, the whole section will
* be removed uppon finishing.
* The reason for that is a "table-design" one: the first topic is
- * maintained in order to be able to add rows with a design of this topic,
+ * maintained in order to be able to add rows with a design of this topic,
* and not of the header row.
* @param topics the number of topics the table should contain.
* @throws Exception
@@ -1520,7 +1799,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/**
* returns a text element for the given cell,
* which will write the given text.
- * @param cell the topics cell number.
+ * @param cell the topics cell number.
* @param value the value to write.
* @return a TextElement object which will write the given value
* to the given cell.
@@ -1543,7 +1822,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* formats a series of cells from the given one,
* using the given List of TableCellFormatter objects,
* in the given order.
- * This method is used to format the first (header) and the last
+ * This method is used to format the first (header) and the last
* rows of the table.
* @param cursor a table cursor, pointing to the start cell to format
* @param formats a List containing TableCellFormatter objects. Each will format one cell in the direction specified.
@@ -1642,7 +1921,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
}
/**
- * returns the rows count of this table, assuming
+ * returns the rows count of this table, assuming
* there is no vertical merged cells.
* @param table
* @return the rows count of the given table.
@@ -1656,11 +1935,11 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/*
* ===========================================================================================
- *
+ *
* End of AgendaTempalte class
- *
+ *
* ===========================================================================================
- *
+ *
*/
/*
* =================================
@@ -1668,7 +1947,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* =================================
*/
/**
- * Interface that is used for writing content to a Uno Text / TextRange
+ * Interface that is used for writing content to a Uno Text / TextRange
* @author rp143992
*
*/
@@ -1685,8 +1964,8 @@ interface AgendaElement
* =================================
*/
/**
- * Basic implementation of the AgendaElement interface -
- * writes nothing, but applies a ParaStyle to the given XText/XTextRange
+ * Basic implementation of the AgendaElement interface -
+ * writes nothing, but applies a ParaStyle to the given XText/XTextRange
* @author rp143992
*
* TODO To change the template for this generated type comment go to
@@ -1814,7 +2093,7 @@ class PlaceholderTextElement extends TextElement
* The PlaceHolder class
* =================================
*/
-/**
+/**
* An Agenda element which writes no text, but inserts a placeholder, and formats
* it using a ParaStyleName.
* @author rp143992
@@ -1858,7 +2137,7 @@ class PlaceholderElement extends ParaStyled
* =================================
*/
/**
- * An implementation of AgendaElement which
+ * An implementation of AgendaElement which
* gets as a parameter a table cursor, and writes
* a text to the cell marked by this table cursor, and
* a place holder to the next cell.
@@ -1945,6 +2224,6 @@ class TableCellFormatter
}
}
-
+
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java
index 318a607c678e..6cdcde58a5bf 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java
@@ -15,8 +15,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-package com.sun.star.wizards.agenda;
+
+package com.sun.star.wizards.agenda;
import java.util.ArrayList;
@@ -51,7 +51,7 @@ import com.sun.star.wizards.ui.event.RadioDataAware;
import com.sun.star.wizards.ui.event.UnoDataAware;
/**
- * This class is the dialog implementation class -
+ * This class is the dialog implementation class -
* there is not much business logic here - but mostley
* event methods.
* Some event methods are also implemented in TopicsControl and TopicsControl.ControlRow.
@@ -63,7 +63,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
* used to prevent a double start of the wizard.
*/
static boolean running;
-
+
/**
* the preview document controller.
*/
@@ -74,14 +74,14 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
* the data model changes, except for topics).
*/
private CGAgenda agenda;
-
+
/**
- * the topics control, a gui element which
+ * the topics control, a gui element which
* manipulates the topics data according to the
- * user's input.
+ * user's input.
*/
private TopicsControl topicsControl;
-
+
/**
* an array with two array memebers:
* agendaTemplates[0] contains an array with
@@ -90,31 +90,31 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
* corresponding URLs.
*/
private String[][] agendaTemplates;
-
+
PathSelection myPathSelection;
-
+
String sTemplatePath;
String sUserTemplatePath;
String sBitmapPath;
-
+
String sPath;
/** constructor */
- public AgendaWizardDialogImpl(XMultiServiceFactory xmsf)
+ public AgendaWizardDialogImpl(XMultiServiceFactory xmsf)
{
super(xmsf);
}
-
+
protected void enterStep(int OldStep, int NewStep) {}
protected void leaveStep(int OldStep, int NewStep) {}
-
+
/**
* read the configuration data, open the specified template,
* initialize the template controller (AgendaTemplate) and
- * set the status of the displayed template to the one
+ * set the status of the displayed template to the one
* read from the configuration.
* build the dialog.
- * Synchronize the dialog to the same status (read from
+ * Synchronize the dialog to the same status (read from
* the configuration).
* show the dialog.
*/
@@ -123,16 +123,16 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
try {
// read configuration data.
agenda = new CGAgenda();
-
+
Object root = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.Office.Writer/Wizards/Agenda", false);
agenda.readConfiguration(root,"cp_");
-
+
// initialize the agenda template
agendaTemplate = new AgendaTemplate(xMSF, agenda, resources, this);
initializeTemplates();
-
+
agendaTemplate.load(agendaTemplates[1][agenda.cp_AgendaType] , new ArrayList<PropertyValue[]>());
-
+
// build the dialog.
buildStep1();
buildStep2();
@@ -142,17 +142,17 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
topicsControl = new TopicsControl(this,xMSF, agenda);
buildStep6();
drawNaviBar();
-
+
initializePaths();
-
+
//special Control for setting the save Path:
insertPathSelectionControl();
-
+
// create the peer
XWindow xw = agendaTemplate.xFrame.getContainerWindow();
XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xw);
this.createWindowPeer( xWindowPeer );
-
+
// initialize roadmap
this.addRoadmap();
this.insertRoadMapItems(
@@ -161,15 +161,15 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
new boolean[] { true,true,true,true,true,true }
);
this.setMaxStep(6);
-
+
// synchronize GUI and CGAgenda object.
makeDA();
if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING)) {myPathSelection.initializePath();}
executeDialog(agendaTemplate.xFrame);
- removeTerminateListener();
+ removeTerminateListener();
closeDocument();
- running = false;
+ running = false;
}
catch (Exception ex) {
@@ -177,21 +177,21 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
ex.printStackTrace();
running=false;
}
-
-
+
+
}
-
+
private class myPathSelectionListener implements XPathSelectionListener {
public void validatePath() {
if (myPathSelection.usedPathPicker) {
- filenameChanged = true;
+ filenameChanged = true;
}
myPathSelection.usedPathPicker = false;
}
}
-
- public void insertPathSelectionControl() {
+
+ public void insertPathSelectionControl() {
myPathSelection = new PathSelection(xMSF, this, PathSelection.TransferMode.SAVE, PathSelection.DialogTypes.FILE);
myPathSelection.insert(6, 97, 70, 205, (short) 45, resources.reslblTemplatePath_value, true, HelpIds.getHelpIdString( HID + 24 ), HelpIds.getHelpIdString( HID + 25 ));
myPathSelection.sDefaultDirectory = sUserTemplatePath;
@@ -199,28 +199,29 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
myPathSelection.sDefaultFilter = "writer8_template";
myPathSelection.addSelectionListener(new myPathSelectionListener());
}
-
+
private void initializePaths() {
try {
sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap");
+ sTemplatePath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../common");
} catch (NoValidPathException e) {
e.printStackTrace();
}
}
-
+
private void checkSavePath() {
- if (agenda.cp_TemplatePath == null ||
+ if (agenda.cp_TemplatePath == null ||
agenda.cp_TemplatePath.equals(PropertyNames.EMPTY_STRING) ||
!getFileAccess().exists(FileAccess.getParentDir(agenda.cp_TemplatePath),false) ||
!getFileAccess().isDirectory(FileAccess.getParentDir(agenda.cp_TemplatePath )))
{
- try {
- agenda.cp_TemplatePath =
+ try {
+ agenda.cp_TemplatePath =
FileAccess.connectURLs(
FileAccess.getOfficePath(xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING) ,
- resources.resDefaultFilename
+ resources.resDefaultFilename
);
}
catch (Exception ex) {
@@ -228,30 +229,30 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
}
}
}
-
+
/**
* bind controls to the agenda member (DataAware model)
*/
private void makeDA() {
-
+
setControlProperty("listPageDesign", PropertyNames.STRING_ITEM_LIST, agendaTemplates[0]);
-
+
checkSavePath();
//setFilename(agenda.cp_TemplatePath);
-
+
UnoDataAware.attachListBox( agenda, "cp_AgendaType", listPageDesign , null, true ).updateUI();
UnoDataAware.attachCheckBox( agenda, "cp_IncludeMinutes", chkMinutes, null, true).updateUI();
-
+
UnoDataAware.attachEditControl(agenda, "cp_Title", txtTitle, agendaTemplate , true).updateUI();
UnoDataAware.attachDateControl(agenda, "cp_Date", txtDate, agendaTemplate , true).updateUI();
UnoDataAware.attachTimeControl(agenda, "cp_Time", txtTime, agendaTemplate , true).updateUI();
UnoDataAware.attachEditControl(agenda, "cp_Location", cbLocation, agendaTemplate , true).updateUI();
-
+
UnoDataAware.attachCheckBox(agenda,"cp_ShowMeetingType", chkMeetingTitle , new RedrawListener( TemplateConsts.FILLIN_MEETING_TYPE ) , true);
UnoDataAware.attachCheckBox(agenda,"cp_ShowRead", chkRead , new RedrawListener( TemplateConsts.FILLIN_READ ) , true).updateUI();
UnoDataAware.attachCheckBox(agenda,"cp_ShowBring", chkBring , new RedrawListener( TemplateConsts.FILLIN_BRING ) , true).updateUI();
UnoDataAware.attachCheckBox(agenda,"cp_ShowNotes", chkNotes , new RedrawListener( TemplateConsts.FILLIN_NOTES ) , true).updateUI();
-
+
UnoDataAware.attachCheckBox(agenda,"cp_ShowCalledBy", chkConvenedBy , new RedrawListener( TemplateConsts.FILLIN_CALLED_BY ) , true).updateUI();
UnoDataAware.attachCheckBox(agenda,"cp_ShowFacilitator", chkPresiding , new RedrawListener( TemplateConsts.FILLIN_FACILITATOR ) , true).updateUI();
UnoDataAware.attachCheckBox(agenda,"cp_ShowNotetaker", chkNoteTaker , new RedrawListener( TemplateConsts.FILLIN_NOTETAKER ) , true).updateUI();
@@ -259,11 +260,11 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
UnoDataAware.attachCheckBox(agenda,"cp_ShowAttendees", chkAttendees , new RedrawListener( TemplateConsts.FILLIN_PARTICIPANTS ) , true).updateUI();
UnoDataAware.attachCheckBox(agenda,"cp_ShowObservers", chkObservers , new RedrawListener( TemplateConsts.FILLIN_OBSERVERS ) , true).updateUI();
UnoDataAware.attachCheckBox(agenda,"cp_ShowResourcePersons", chkResourcePersons , new RedrawListener( TemplateConsts.FILLIN_RESOURCE_PERSONS ) , true).updateUI();
-
+
UnoDataAware.attachEditControl(agenda, "cp_TemplateName", txtTemplateName, null, true).updateUI();
- RadioDataAware.attachRadioButtons( agenda, "cp_ProceedMethod",
+ RadioDataAware.attachRadioButtons( agenda, "cp_ProceedMethod",
new Object[] {optCreateAgenda, optMakeChanges} ,null,true).updateUI();
-
+
listPageDesign.addItemListener(new XItemListener() {
public void itemStateChanged(ItemEvent ie) {
pageDesignChanged(ie);
@@ -280,37 +281,37 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
AgendaWizardDialogImpl wizard = new AgendaWizardDialogImpl(xLocMSF);
wizard.startWizard();
-
+
}
catch (Exception exception) {
exception.printStackTrace();
}
}
-
+
/*
private void initializePaths() {
try {
-
+
sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user");
sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap");
} catch (NoValidPathException e) {
e.printStackTrace();
}
}*/
-
+
/**
* read the available agenda wizard templates.
*/
public boolean initializeTemplates() {
try {
String sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
-
+
//sCurrentNorm = Norms[getCurrentLetter().cp_Norm];
- String sAgendaPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/agenda" );
-
+ String sAgendaPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../common/wizard/agenda" );
+
agendaTemplates = FileAccess.getFolderTitles(xMSF, "aw" , sAgendaPath);
-
+
return true;
} catch (NoValidPathException nopathexception) {
nopathexception.printStackTrace();
@@ -320,35 +321,36 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
return false;
}
}
-
+
/* ******************************
* Event methods
* ******************************
*/
-
+
/**
* first page, page design listbox changed.
*/
public void pageDesignChanged(ItemEvent ie) {
int selected = ie.Selected;
- try {
- agendaTemplate.load( agendaTemplates[1][selected] , topicsControl.getTopicsData());
+ try {
+ agendaTemplate.load( agendaTemplates[1][selected] , topicsControl.getTopicsData());
}
catch (Exception ex) {
SystemDialog.showMessageBox(xMSF, "ErrBox", VclWindowPeerAttribute.OK, resources.resErrOpenTemplate);
ex.printStackTrace();
}
+ agendaTemplate.refreshTopicConstants();
}
-
+
/**
* last page, template title changed...
*/
public void templateTitleChanged() {
String title = (String)Helper.getUnoPropertyValue( getModel(txtTemplateName), "Text" );
- agendaTemplate.setTemplateTitle( title );
+ agendaTemplate.setTemplateTitle( title );
}
-
-
+
+
private FileAccess fileAccess1;
/** convenience method.
* instead of creating a FileAccess object every time
@@ -365,31 +367,31 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
e.printStackTrace();
}
return fileAccess1;
-
+
}
/**
* indicates if the filename was changed by the user through
* the "save as" dialog.
* If it is so, one needs not warn the user
- * upon overwrite, since she was already warned.
+ * upon overwrite, since she was already warned.
*/
private boolean filenameChanged = false;
-
+
/**
* last page, "browse" ("...") button was clicked...
*/
public void saveAs() {
try {
-
+
checkSavePath();
-
+
SystemDialog saveAs = SystemDialog.createStoreDialog(xMSF);
saveAs.addFilterToDialog("ott","writer8_template",true);
// call the saveAs dialog.
String url = saveAs.callStoreDialog(
- FileAccess.getParentDir(agenda.cp_TemplatePath),
+ FileAccess.getParentDir(agenda.cp_TemplatePath),
FileAccess.getFilename(agenda.cp_TemplatePath));
-
+
if (url != null) {
agenda.cp_TemplatePath = url;
setFilename(url);
@@ -399,10 +401,10 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
catch (Exception ex) {
ex.printStackTrace();
}
-
-
+
+
}
-
+
/**
* is called when the user
* changes the path through the "save as" dialog.
@@ -417,36 +419,36 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
catch (Exception ex) {
ex.printStackTrace();
}
-
+
}
-
+
public void insertRow() {
topicsControl.insertRow();
}
-
+
public void removeRow() {
topicsControl.removeRow();
}
-
+
public void rowUp() {
topicsControl.rowUp();
}
-
+
public void rowDown() {
topicsControl.rowDown();
}
-
-
+
+
/* ************************
* Navigation bar methods
* ************************
*/
-
+
public void cancelWizard() {
xDialog.endExecute();
running = false;
}
-
+
public boolean finishWizard() {
boolean bSaveSuccess = false; // pesimistic :(
XTextDocument xTextDocument;
@@ -459,28 +461,28 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
sPath = myPathSelection.getSelectedPath();
}
sPath = fileAccess.getURL(sPath);
-
+
//first, if the filename was not changed, thus
//it is coming from a saved session, check if the
// file exists and warn the user.
if (!filenameChanged)
if (fileAccess.exists(sPath, true)) {
-
+
int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resFileExists);
if (answer == 3) // user said: no, do not overwrite....
return false;
}
agendaTemplate.xTextDocument.lockControllers();
-
+
xTextDocument = UnoRuntime.queryInterface(XTextDocument.class,agendaTemplate.document);
-
+
bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath , "writer8_template", false );
} catch (Exception e) {
- SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "ErrBox", VclWindowPeerAttribute.OK, resources.resErrSaveTemplate);
+ SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "ErrorBox", VclWindowPeerAttribute.OK, resources.resErrSaveTemplate);
//e.printStackTrace();
}
-
+
if (bSaveSuccess) {
try {
topicsControl.saveTopics(agenda);
@@ -491,23 +493,32 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
catch (Exception ex) {
ex.printStackTrace();
}
-
+
agendaTemplate.finish( topicsControl.getTopicsData());
- try {
- XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, agendaTemplate.document);
- xStoreable.store();
- }
- catch (Exception ex) {
- SystemDialog.showMessageBox(xMSF, "ErrBox", VclWindowPeerAttribute.OK, resources.resErrSaveTemplate);
- ex.printStackTrace();
- }
-
+
+ //I have no exact idea what this is doing, but the error message kept
+ //popping up, no matter what I tried. Even though I excluded this, it
+ //kept working perfectly. I suggest that this tries to store the template
+ //document, but it is already stored, written down by a code above. The
+ //reason this piece is malfunctioning, because the agendaTemplate.document
+ //is read-only (At least as my tests indicated.).
+ /*
+ * try {
+ * XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, agendaTemplate.document);
+ * xStoreable.store();
+ * }
+ * catch (Exception ex) {
+ * SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, resources.resErrSaveTemplate);
+ * ex.printStackTrace();
+ * }
+ */
+
//xWindow.setVisible(false);
//running = false;
agendaTemplate.xTextDocument.unlockControllers();
//closeDocument();
//removeTerminateListener();
-
+
PropertyValue loadValues[] = new PropertyValue[2];
loadValues[0] = new PropertyValue();
loadValues[0].Name = "AsTemplate";
@@ -543,31 +554,31 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
running = false;
return true;
}
-
+
private void closeDocument() {
try {
- //xComponent.dispose();
+ //xComponent.dispose();
XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, agendaTemplate.xFrame);
xCloseable.close(false);
} catch (CloseVetoException e) {
e.printStackTrace();
}
}
-
+
/* ********************
* Sub Classes
- * ********************
+ * ********************
*/
-
+
/**
* this class is used to redraw an item's table when
* the user clicks one of the checkboxes in step 3 or 4.
*/
private class RedrawListener implements DataAware.Listener {
-
+
private String itemName;
-
+
public RedrawListener(String itemName_) {
itemName = itemName_;
}
@@ -578,10 +589,11 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
public void eventPerformed(Object event) {
agendaTemplate.xTextDocument.lockControllers();
agendaTemplate.redraw(itemName);
+ agendaTemplate.refreshConstants();
agendaTemplate.xTextDocument.unlockControllers();
}
}
-
-
+
+
}
-
+
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java
index 9281ad84f7f8..46ad1e0ba04a 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java
@@ -16,19 +16,19 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-package com.sun.star.wizards.agenda;
-
+package com.sun.star.wizards.agenda;
+
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.Resource;
public class AgendaWizardDialogResources extends Resource {
-
+
final static String UNIT_NAME = "dbwizres";
final static String MODULE_NAME = "dbw";
final static int RID_AGENDAWIZARDDIALOG_START = 5000;
final static int RID_COMMON_START = 500;
-
-
+
+
String resAgendaWizardDialog_title;
String resoptMakeChanges_value;
String reslblTemplateName_value;
@@ -65,31 +65,31 @@ public class AgendaWizardDialogResources extends Resource {
String reschkBring_value;
String reschkNotes_value;
String reslblHelp3_value;
-
+
String reslblDate_value;
String reslblHelpPg6_value;
String reslblPageDesign_value;
-
+
String resDefaultFilename;
String resDefaultTitle;
-
+
String resErrSaveTemplate;
-
+
String resPlaceHolderTitle;
String resPlaceHolderDate;
String resPlaceHolderTime;
String resPlaceHolderLocation;
String resPlaceHolderHint;
-
+
String resStep1;
String resStep2;
String resStep3;
String resStep4;
String resStep5;
String resStep6;
-
+
String resErrOpenTemplate;
-
+
String itemMeetingType;
String itemRead;
String itemBring;
@@ -101,25 +101,40 @@ public class AgendaWizardDialogResources extends Resource {
String itemAttendees;
String itemObservers;
String itemResource;
-
+
String resButtonInsert;
String resButtonRemove;
String resButtonUp;
String resButtonDown;
-
-
-
-
- // *** common resources ***
-
+
+ String resPlaceHolderDateTitle;
+ String resPlaceHolderTimeTitle;
+ String resPlaceHolderLocationTitle;
+ String resPlaceHolderTopics;
+ String resPlaceHolderNum;
+ String resPlaceHolderTopic;
+ String resPlaceHolderResponsible;
+ String resPlaceHolderTimeHeader;
+ String resPlaceHolderAdditionalInformation;
+ String resPlaceHolderMinutesFor;
+ String resPlaceHolderDiscussion;
+ String resPlaceHolderConclusion;
+ String resPlaceHolderToDo;
+ String resPlaceHolderResponsibleParty;
+ String resPlaceHolderDeadline;
+//
+
+
+ // *** common resources ***
+
String resFileExists;
-
+
public AgendaWizardDialogResources(XMultiServiceFactory xmsf) {
super(xmsf,UNIT_NAME,MODULE_NAME);
-
+
/**
- * Delete the String, uncomment the getResText method
- *
+ * Delete the String, uncomment the getResText method
+ *
*/
resAgendaWizardDialog_title = getResText(RID_AGENDAWIZARDDIALOG_START + 1);
resoptMakeChanges_value = getResText(RID_AGENDAWIZARDDIALOG_START + 2);
@@ -163,27 +178,27 @@ public AgendaWizardDialogResources(XMultiServiceFactory xmsf) {
resDefaultFilename = getResText(RID_AGENDAWIZARDDIALOG_START + 41);
resDefaultFilename = resDefaultFilename.substring(0,resDefaultFilename.length()-4) + ".ott";
-
+
resDefaultTitle = getResText(RID_AGENDAWIZARDDIALOG_START + 42);
-
+
resErrSaveTemplate = getResText(RID_AGENDAWIZARDDIALOG_START + 43);
-
+
resPlaceHolderTitle = getResText(RID_AGENDAWIZARDDIALOG_START + 44);
resPlaceHolderDate = getResText(RID_AGENDAWIZARDDIALOG_START + 45);
resPlaceHolderTime = getResText(RID_AGENDAWIZARDDIALOG_START + 46);
resPlaceHolderLocation = getResText(RID_AGENDAWIZARDDIALOG_START + 47);
resPlaceHolderHint = getResText(RID_AGENDAWIZARDDIALOG_START + 48);
-
-
+
+
resStep1 = getResText(RID_AGENDAWIZARDDIALOG_START + 50);
resStep2 = getResText(RID_AGENDAWIZARDDIALOG_START + 51);
resStep3 = getResText(RID_AGENDAWIZARDDIALOG_START + 52);
resStep4 = getResText(RID_AGENDAWIZARDDIALOG_START + 53);
resStep5 = getResText(RID_AGENDAWIZARDDIALOG_START + 54);
resStep6 = getResText(RID_AGENDAWIZARDDIALOG_START + 55);
-
+
resErrOpenTemplate = getResText(RID_AGENDAWIZARDDIALOG_START + 56);
-
+
itemMeetingType = getResText(RID_AGENDAWIZARDDIALOG_START + 57);
itemBring = getResText(RID_AGENDAWIZARDDIALOG_START + 58);
itemRead = getResText(RID_AGENDAWIZARDDIALOG_START + 59);
@@ -196,17 +211,37 @@ public AgendaWizardDialogResources(XMultiServiceFactory xmsf) {
itemTimekeeper = getResText(RID_AGENDAWIZARDDIALOG_START + 65);
itemObservers = getResText(RID_AGENDAWIZARDDIALOG_START + 66);
itemResource = getResText(RID_AGENDAWIZARDDIALOG_START + 67);
-
+
resButtonInsert = getResText(RID_AGENDAWIZARDDIALOG_START + 68);
resButtonRemove = getResText(RID_AGENDAWIZARDDIALOG_START + 69);
resButtonUp = getResText(RID_AGENDAWIZARDDIALOG_START + 70);
resButtonDown = getResText(RID_AGENDAWIZARDDIALOG_START + 71);
-
+
+//
+ resPlaceHolderDateTitle = getResText(RID_AGENDAWIZARDDIALOG_START + 72);
+ resPlaceHolderTimeTitle = getResText(RID_AGENDAWIZARDDIALOG_START + 73);
+ resPlaceHolderLocationTitle = getResText(RID_AGENDAWIZARDDIALOG_START + 74);
+ resPlaceHolderTopics = getResText(RID_AGENDAWIZARDDIALOG_START + 75);
+ resPlaceHolderNum = getResText(RID_AGENDAWIZARDDIALOG_START + 76);
+ resPlaceHolderTopic = getResText(RID_AGENDAWIZARDDIALOG_START + 77);
+ resPlaceHolderResponsible = getResText(RID_AGENDAWIZARDDIALOG_START + 78);
+ resPlaceHolderTimeHeader = getResText(RID_AGENDAWIZARDDIALOG_START + 79);
+ resPlaceHolderAdditionalInformation = getResText(RID_AGENDAWIZARDDIALOG_START + 80);
+ resPlaceHolderMinutesFor = getResText(RID_AGENDAWIZARDDIALOG_START + 81);
+ resPlaceHolderDiscussion = getResText(RID_AGENDAWIZARDDIALOG_START + 82);
+ resPlaceHolderConclusion = getResText(RID_AGENDAWIZARDDIALOG_START + 83);
+ resPlaceHolderToDo = getResText(RID_AGENDAWIZARDDIALOG_START + 84);
+ resPlaceHolderResponsibleParty = getResText(RID_AGENDAWIZARDDIALOG_START + 85);
+ resPlaceHolderDeadline = getResText(RID_AGENDAWIZARDDIALOG_START + 86);
+
+
+//
+
/*
* Common resources
*/
-
+
resFileExists = getResText(RID_COMMON_START + 19);
-
+
}
}
diff --git a/wizards/com/sun/star/wizards/agenda/TemplateConsts.java b/wizards/com/sun/star/wizards/agenda/TemplateConsts.java
index 629fca632efa..e96edf274560 100644
--- a/wizards/com/sun/star/wizards/agenda/TemplateConsts.java
+++ b/wizards/com/sun/star/wizards/agenda/TemplateConsts.java
@@ -39,7 +39,7 @@ public interface TemplateConsts
*/
public final static String SECTION_TOPICS = "AGENDA_TOPICS";
/**
- * the name of the parent minutes section.
+ * the name of the parent minutes section.
*/
public final static String SECTION_MINUTES_ALL = "MINUTES_ALL";
/**
@@ -49,9 +49,9 @@ public interface TemplateConsts
public final static String SECTION_MINUTES = "MINUTES"; //public final static String AGENDA_ITEM = "AGENDA_ITEM";
/**
* taged headings and names.
- * These will be searched in item tables (in the template) and will be
+ * These will be searched in item tables (in the template) and will be
* replaced with resource strings.
- *
+ *
* headings...
*/
public final static String FILLIN_MEETING_TYPE = "<meeting-type>";
@@ -71,7 +71,7 @@ public interface TemplateConsts
/**
* Styles (paragraph styles) used for agenda items.
* headings styles
- *
+ *
*/
public final static String STYLE_MEETING_TYPE = "MeetingType";
public final static String STYLE_BRING = "Bring";
@@ -88,9 +88,9 @@ public interface TemplateConsts
public final static String STYLE_OBSERVERS = "Observers";
public final static String STYLE_RESOURCE_PERSONS = "ResourcePersons";
/**
- * Styles (paragraph styles) used for the <b>text</b> of agenda items
+ * Styles (paragraph styles) used for the <b>text</b> of agenda items
* The agenda wizard creates fill-in fields with the given styles...)
- *
+ *
* headings fields styles
*/
public final static String STYLE_MEETING_TYPE_TEXT = "MeetingTypeText";
@@ -134,4 +134,22 @@ public interface TemplateConsts
public final static String FILLIN_MINUTE_TOPIC = "<mtopic>";
public final static String FILLIN_MINUTE_RESPONSIBLE = "<mresponsible>";
public final static String FILLIN_MINUTE_TIME = "<mtime>";
+
+//
+ public final static String FILLIN_DATETITLE = "#datetitle#";
+ public final static String FILLIN_TIMETITLE = "#timetitle#";
+ public final static String FILLIN_LOCATIONTITLE = "#locationtitle#";
+ public final static String FILLIN_TOPICS = "#topics#";
+ public final static String FILLIN_NUM = "#num.#";
+ public final static String FILLIN_TOPIC = "#topicheader#";
+ public final static String FILLIN_RESPONSIBLE = "#responsibleheader#";
+ public final static String FILLIN_TIME_HEADER = "#timeheader#";
+ public final static String FILLIN_ADDITIONAL_INFORMATION = "#additional-information#";
+ public final static String FILLIN_MINUTES_FOR = "#minutes-for#";
+ public final static String FILLIN_DISCUSSION = "#discussion#";
+ public final static String FILLIN_CONCLUSION = "#conclusion#";
+ public final static String FILLIN_TO_DO = "#to-do#";
+ public final static String FILLIN_RESPONSIBLE_PARTY = "#responsible-party#";
+ public final static String FILLIN_DEADLINE = "#deadline#";
+//
}
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.java b/wizards/com/sun/star/wizards/agenda/TopicsControl.java
index b8bc07d12948..975217b3eee6 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.java
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.java
@@ -18,6 +18,7 @@
package com.sun.star.wizards.agenda;
import java.util.List;
+import java.util.ArrayList;
import com.sun.star.wizards.common.HelpIds;
import com.sun.star.awt.FocusEvent;
@@ -46,13 +47,13 @@ import com.sun.star.wizards.ui.event.MethodInvocation;
* @author rpiterman
* This class implements the UI functionality of the topics scroller control.
* <br/>
- * During developement, there has been a few changes which were not *fully* done -
+ * During developement, there has been a few changes which were not *fully* done -
* mainly in converting the topics and time boxes from combobox and time box to normal textboxes,
- * so in the code they might be referenced as combobox or timebox. This should be
+ * so in the code they might be referenced as combobox or timebox. This should be
* rather understood as topicstextbox and timetextbox.
* <br/>
* <br/>
- * Important behaiviour of this control is that there is always a
+ * Important behaiviour of this control is that there is always a
* blank row at the end, in which the user can enter data.<br/>
* Once the row is not blank (thus, the user entered data...),
* a new blank row is added.<br/>
@@ -62,7 +63,7 @@ import com.sun.star.wizards.ui.event.MethodInvocation;
* The contorl shows 5 rows at a time.<br/>
* If, for example, only 2 rows exist (from which the 2ed one is empty...)
* then the other three rows, which do not exist in the data model, are disabled.
- * <br/>
+ * <br/>
* The following other functionality is implemented:
* <br/>
* 0. synchroniting data between controls, data model and live preview.
@@ -71,7 +72,7 @@ import com.sun.star.wizards.ui.event.MethodInvocation;
* 3. Removing rows and adding new rows.<br/>
* 4. Moving rows up and down. <br/>
* <br/>
- * This control relays on the ControlScroller control which uses the following
+ * This control relays on the ControlScroller control which uses the following
* Data model:<br/>
* 1. It uses a vector, whos members are arrays of PropertyValue.<br/>
* 2. Each array represents a row.<br/>
@@ -79,10 +80,10 @@ import com.sun.star.wizards.ui.event.MethodInvocation;
* 3. Each property Value represents a value for a single control with the following rules:<br/>
* 3. a. the Value of the property is used for as value of the controls (usually text).<br/>
* 3. b. the Name of the property is used to map values to UI controls in the following manner:<br/>
- * 3. b. 1. only the Name of the first X Rows is regarded, where X is the number of visible rows
+ * 3. b. 1. only the Name of the first X Rows is regarded, where X is the number of visible rows
* (in the agenda wizard this would be 5, since 5 topic rows are visible on the dialog).<br/>
- * 3. b. 2. The Names of the first X (or 5...) rows are the names of the UI Controls to
- * hold values. When the control scroller scrolls, it looks at the first 5 rows and uses
+ * 3. b. 2. The Names of the first X (or 5...) rows are the names of the UI Controls to
+ * hold values. When the control scroller scrolls, it looks at the first 5 rows and uses
* the names specified there to map the current values to the specified controls.
* <br/>
* This data model makes the following limitations on the implementation:
@@ -94,26 +95,26 @@ import com.sun.star.wizards.ui.event.MethodInvocation;
* <br/>
* To save the topics in the registry a ConfigSet of objects of type CGTopic is
* being used.
- * This one is not synchronized "live", since it is unnecessary... instead, it is
+ * This one is not synchronized "live", since it is unnecessary... instead, it is
* synchronized on call, before the settings should be saved.
*/
public class TopicsControl extends ControlScroller implements XFocusListener
{
/**
- * The name prefix of the number (label) controls
+ * The name prefix of the number (label) controls
*/
public static final String LABEL = "lblTopicCnt_";
/**
- * The name prefix of the topic (text) controls
+ * The name prefix of the topic (text) controls
*/
public static final String TOPIC = "txtTopicTopic_";
/**
- * The name prefix of the responsible (text) controls
+ * The name prefix of the responsible (text) controls
*/
public static final String RESP = "cbTopicResp_";
/**
- * The name prefix of the time (text) controls
+ * The name prefix of the time (text) controls
*/
public static final String TIME = "txtTopicTime_";
Object lastFocusControl;
@@ -135,6 +136,9 @@ public class TopicsControl extends ControlScroller implements XFocusListener
*/
private int tabIndex = 520;
+ //This maintains for each topic, if something has been written in it.
+ private ArrayList<Boolean> rowUsedArray = new ArrayList<Boolean>();
+
/**
* create a new TopicControl. Since this is used specifically for the
* agenda dialog, I use step 5, and constant location - and need no paramter...
@@ -147,6 +151,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
super(dialog, xmsf, 5, 92, 38, 212, 5, 18, AgendaWizardDialogConst.LAST_HID);
initializeScrollFields(agenda);
initialize(agenda.cp_Topics.getSize() + 1);
+ for(int i=0; i < agenda.cp_Topics.getSize(); ++i) rowUsedArray.add(false);
// set some focus listeners for TAB scroll down and up...
try
@@ -222,10 +227,10 @@ public class TopicsControl extends ControlScroller implements XFocusListener
insertRowAtEnd();
}
- /**
- * Insert a blank (empty) row
+ /**
+ * Insert a blank (empty) row
* as last row of the control.
- * The control has always a blank row at the
+ * The control has always a blank row at the
* end, which enables the user to enter data...
*/
protected void insertRowAtEnd()
@@ -260,7 +265,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* overrides the parent class method to also enable the
* row whenever data is written to it.
- * @param guiRow
+ * @param guiRow
*/
protected void fillupControls(int guiRow)
{
@@ -298,7 +303,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* in order to use the "move up", "downPropertyNames.SPACEinsert" and "remove" buttons,
* we track the last control the gained focus, in order to know which
* row should be handled.
- * @param fe
+ * @param fe
*/
public void focusGained(FocusEvent fe)
{
@@ -307,7 +312,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
}
/**
- * Sometimes I set the focus programatically to a control
+ * Sometimes I set the focus programatically to a control
* (for example when moving a row up or down, the focus should move
* with it).
* In such cases, no VCL event is being triggered so it must
@@ -348,7 +353,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* compolsary implementation of FocusListener.
- * @param fe
+ * @param fe
*/
public void focusLost(FocusEvent fe)
{
@@ -356,7 +361,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* compolsary implementation of FocusListener.
- * @param o
+ * @param o
*/
public void disposing(EventObject o)
{
@@ -378,14 +383,26 @@ public class TopicsControl extends ControlScroller implements XFocusListener
public void rowUp()
{
rowUp(lastFocusRow - nscrollvalue, lastFocusControl);
+
+ //swap the items in rowUsedArray
+ boolean temp = rowUsedArray.get(lastFocusRow - nscrollvalue);
+ rowUsedArray.set(lastFocusRow - nscrollvalue, rowUsedArray.get(lastFocusRow));
+ rowUsedArray.set(lastFocusRow, temp);
+ ((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.refreshTopicConstants();
}
- /**
+ /**
* move the current row down.
*/
public void rowDown()
{
rowDown(lastFocusRow - nscrollvalue, lastFocusControl);
+
+ //swap the items in rowUsedArray
+ boolean temp = rowUsedArray.get(lastFocusRow - nscrollvalue);
+ rowUsedArray.set(lastFocusRow - nscrollvalue, rowUsedArray.get(lastFocusRow));
+ rowUsedArray.set(lastFocusRow, temp);
+ ((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.refreshTopicConstants();
}
private void lockDoc()
@@ -420,11 +437,16 @@ public class TopicsControl extends ControlScroller implements XFocusListener
}
}
removeLastRow();
+
+ ((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.refreshTopicConstants();
+ rowUsedArray.remove(lastFocusRow);
+
// update the live preview background document
reduceDocumentToTopics();
// the focus should return to the edit control
focus(lastFocusControl);
+
unlockDoc();
}
@@ -461,9 +483,12 @@ public class TopicsControl extends ControlScroller implements XFocusListener
// update the preview document.
updateDocumentRow(lastFocusRow);
+ rowUsedArray.add(lastFocusRow,false);
+
fillupControls(lastFocusRow - nscrollvalue);
focus(lastFocusControl);
+
unlockDoc();
}
@@ -472,7 +497,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* The index is important because it is used in the
* Name member of the PropertyValue objects.
* To know why see general class documentation above (data model explanation).
- * @param i the index of the new row
+ * @param i the index of the new row
* @return
*/
private PropertyValue[] newRow(int i)
@@ -482,6 +507,10 @@ public class TopicsControl extends ControlScroller implements XFocusListener
pv[1] = Properties.createProperty(TOPIC + i, PropertyNames.EMPTY_STRING);
pv[2] = Properties.createProperty(RESP + i, PropertyNames.EMPTY_STRING);
pv[3] = Properties.createProperty(TIME + i, PropertyNames.EMPTY_STRING);
+
+ ((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.refreshTopicConstants();
+ rowUsedArray.add(i,false);
+
return pv;
}
@@ -489,8 +518,8 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* Implementation of ControlScroller
* This is a UI method which inserts a new row to the control.
* It uses the child-class ControlRow. (see below).
- * @param _index
- * @param npos
+ * @param _index
+ * @param npos
* @see ControlRow
*/
protected void insertControlGroup(int _index, int npos)
@@ -502,10 +531,10 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* Implementation of ControlScroller
- * This is a UI method which makes a row visibele.
+ * This is a UI method which makes a row visibele.
* As far as I know it is never called.
- * @param _index
- * @param _bIsVisible
+ * @param _index
+ * @param _bIsVisible
* @see ControlRow
*/
protected void setControlGroupVisible(int _index, boolean _bIsVisible)
@@ -538,7 +567,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
private Object[] oldData;
/**
- * update the preview document and
+ * update the preview document and
* remove/insert rows if needed.
* @param guiRow
* @param column
@@ -618,6 +647,10 @@ public class TopicsControl extends ControlScroller implements XFocusListener
insertRowAtEnd();
}
}
+ if(rowUsedArray.get(guiRow) == false){
+ ((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.refreshTopicConstants();
+ rowUsedArray.set(guiRow,true);
+ }
}
catch (Exception e)
{
@@ -645,7 +678,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
}
/**
- * If the user presses tab on the last control, and
+ * If the user presses tab on the last control, and
* there *are* more rows in the model, scroll down.
* @param event
*/
@@ -666,7 +699,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
}
/**
- * If the user presses shift-tab on the first control, and
+ * If the user presses shift-tab on the first control, and
* there *are* more rows in the model, scroll up.
* @param event
*/
@@ -700,7 +733,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* moves the given row one row down.
* @param guiRow the gui index of the row to move.
- * @param control the control to gain focus after moving.
+ * @param control the control to gain focus after moving.
*/
synchronized void rowDown(int guiRow, Object control)
{
@@ -844,9 +877,9 @@ public class TopicsControl extends ControlScroller implements XFocusListener
insertRowAtEnd();
/*
* if we did not change the last row but
- * we did change the one before - check if we
- * have two empty rows at the end.
- * If so, delete the last one...
+ * we did change the one before - check if we
+ * have two empty rows at the end.
+ * If so, delete the last one...
*/
}
else if ((row1 + nscrollvalue) + (row2 + nscrollvalue) == (scrollfields.size() * 2 - 5))
@@ -1020,7 +1053,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* needed to make this data poblic.
- * @return the List containing the topics data.
+ * @return the List containing the topics data.
*/
public List<PropertyValue[]> getTopicsData()
{
@@ -1050,7 +1083,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
};
/**
- *
+ *
* @author rp143992
* A class represting a single GUI row.
* Note that the instance methods of this class
@@ -1061,7 +1094,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
{
/**
- * the number (label) control
+ * the number (label) control
*/
Object label;
/**
@@ -1224,7 +1257,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* Impelementation of XKeyListener.
* Optionally performs the one of the following:
- * cursor up, or down, row up or down
+ * cursor up, or down, row up or down
*/
public void keyPressed(KeyEvent event)
{
@@ -1250,7 +1283,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* returns the column number of the given control.
* The given control must belong to this row or
- * an IllegalArgumentException will accure.
+ * an IllegalArgumentException will accure.
* @param control
* @return an int columnd number of the given control (0 to 3).
*/
diff --git a/wizards/com/sun/star/wizards/common/ParaStyled.java b/wizards/com/sun/star/wizards/common/ParaStyled.java
new file mode 100644
index 000000000000..6f60533a595d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/ParaStyled.java
@@ -0,0 +1,64 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+package com.sun.star.wizards.common;
+import com.sun.star.wizards.common.TemplateElement;
+
+import java.util.ArrayList;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XSearchable;
+import com.sun.star.util.XSearchDescriptor;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.text.*;
+import com.sun.star.wizards.text.*;
+import com.sun.star.wizards.common.TextElement;
+import com.sun.star.wizards.common.PlaceholderTextElement;
+
+class ParaStyled implements TemplateElement
+{
+
+ String paraStyle;
+
+ ParaStyled(String paraStyle_)
+ {
+ paraStyle = paraStyle_;
+ }
+
+ void format(Object textRange)
+ {
+ XText o;
+ o = UnoRuntime.queryInterface(XText.class, textRange);
+ if (o == null)
+ {
+ o = UnoRuntime.queryInterface(XTextRange.class, textRange).getText();
+ }
+ XTextRange xtr = UnoRuntime.queryInterface(XTextRange.class, textRange);
+ XTextCursor cursor = o.createTextCursorByRange(xtr);
+
+ Helper.setUnoPropertyValue(cursor, "ParaStyleName", paraStyle);
+ }
+
+ public void write(Object textRange)
+ {
+ format(textRange);
+ }
+}
+
diff --git a/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java b/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java
new file mode 100644
index 000000000000..952c74f32869
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java
@@ -0,0 +1,98 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+package com.sun.star.wizards.common;
+import com.sun.star.wizards.common.TextElement;
+
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.util.XSearchable;
+import com.sun.star.util.XSearchDescriptor;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.text.*;
+import com.sun.star.wizards.text.*;
+import com.sun.star.wizards.common.TextElement;
+import com.sun.star.wizards.common.PlaceholderTextElement;
+
+public class PlaceholderTextElement extends TextElement
+{
+
+ String hint;
+ String placeHolderText;
+ XMultiServiceFactory xmsf;
+ TextDocument templateDocument;
+
+ public PlaceholderTextElement(XTextRange textRange, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_)
+ {
+ super(textRange);
+ placeHolderText = placeHolderText_;
+ hint = hint_;
+ xmsf = xmsf_;
+ }
+
+ public PlaceholderTextElement(String text, String paraStyle, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_)
+ {
+ super(text, paraStyle);
+ placeHolderText = placeHolderText_;
+ hint = hint_;
+ xmsf = xmsf_;
+ }
+
+ public void write(Object textRange)
+ {
+ super.write(textRange);
+ if (text == null || text.equals(PropertyNames.EMPTY_STRING))
+ {
+ XTextRange xTextRange = UnoRuntime.queryInterface(XTextRange.class, textRange);
+ try
+ {
+ XTextContent xTextContent = createPlaceHolder(xmsf, placeHolderText, hint);
+ xTextRange.getText().insertTextContent(xTextRange.getStart(), xTextContent, true);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ public static XTextContent createPlaceHolder(XMultiServiceFactory xmsf, String ph, String hint)
+ {
+ Object placeHolder;
+ try
+ {
+ placeHolder = xmsf.createInstance("com.sun.star.text.TextField.JumpEdit");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ Helper.setUnoPropertyValue(placeHolder, "PlaceHolder", ph);
+ Helper.setUnoPropertyValue(placeHolder, "Hint", hint);
+ Helper.setUnoPropertyValue(placeHolder, "PlaceHolderType", new Short(PlaceholderType.TEXT));
+ return UnoRuntime.queryInterface(XTextContent.class, placeHolder);
+
+ }
+
+}
+
+
diff --git a/wizards/com/sun/star/wizards/common/TemplateElement.java b/wizards/com/sun/star/wizards/common/TemplateElement.java
new file mode 100644
index 000000000000..caa40f0e2db3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/TemplateElement.java
@@ -0,0 +1,24 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+package com.sun.star.wizards.common;
+
+interface TemplateElement
+{
+ void write(Object any) throws Exception;
+}
diff --git a/wizards/com/sun/star/wizards/common/TextElement.java b/wizards/com/sun/star/wizards/common/TextElement.java
new file mode 100644
index 000000000000..267f83e4ec93
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/TextElement.java
@@ -0,0 +1,64 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+package com.sun.star.wizards.common;
+import com.sun.star.wizards.common.ParaStyled;
+
+import java.util.ArrayList;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XSearchable;
+import com.sun.star.util.XSearchDescriptor;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.text.*;
+import com.sun.star.wizards.text.*;
+import com.sun.star.wizards.common.TextElement;
+import com.sun.star.wizards.common.PlaceholderTextElement;
+
+public class TextElement extends ParaStyled
+{
+
+ String text;
+
+ TextElement(XTextRange range)
+ {
+ this(range.getString(), (String) Helper.getUnoPropertyValue(range.getStart(), "ParaStyleName"));
+ }
+
+ TextElement(String text_, String paraStyle_)
+ {
+ super(paraStyle_);
+ text = text_;
+ }
+
+ public void write(Object textRange)
+ {
+ UnoRuntime.queryInterface(XTextRange.class, textRange).setString(text);
+ if (!text.equals(PropertyNames.EMPTY_STRING))
+ {
+ super.write(textRange);
+ }
+ }
+
+ public void setText(String inputText)
+ {
+ text = inputText;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
index 6ee8765e8819..88b828301913 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
@@ -56,6 +56,16 @@ import com.sun.star.wizards.ui.event.DataAware;
import com.sun.star.wizards.ui.event.RadioDataAware;
import com.sun.star.wizards.ui.event.UnoDataAware;
+import com.sun.star.util.XSearchable;
+import com.sun.star.util.XSearchDescriptor;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.text.*;
+import com.sun.star.wizards.text.*;
+import com.sun.star.wizards.common.TextElement;
+import com.sun.star.wizards.common.PlaceholderTextElement;
+
+import java.util.List;
+
public class FaxWizardDialogImpl extends FaxWizardDialog
{
@@ -90,6 +100,10 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
final static int RM_FOOTER = 4;
final static int RM_FINALSETTINGS = 5;
+ List<XTextRange> constRangeList = new ArrayList<XTextRange>();
+ XTextRange trTo, trFrom, trFaxconst, trTelconst, trEmailconst, trConsist1, trConsist2, trConsist3;
+ TextElement teTo, teFrom, teFaxconst, teTelconst, teEmailconst, teConsist1, teConsist2, teConsist3;
+
public FaxWizardDialogImpl(XMultiServiceFactory xmsf)
{
super(xmsf);
@@ -157,6 +171,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
initializeTemplates(xMSF);
+
//update the dialog UI according to the loaded Configuration
updateUI();
@@ -297,7 +312,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
{
try
{
- //xComponent.dispose();
+ //xComponent.dispose();
XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, myFaxDoc.xFrame);
xCloseable.close(false);
}
@@ -307,6 +322,145 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
}
}
+ public void drawConstants()
+ {
+ constRangeList = searchFillInItems(1);
+
+ XTextRange item = null;
+
+ for (int i = 0; i < constRangeList.size(); i++)
+ {
+ item = constRangeList.get(i);
+ String text = item.getString().trim().toLowerCase();
+ if (text.equals(resources.resToPlaceHolder))
+ {
+ teTo = new PlaceholderTextElement(item, resources.resToPlaceHolder_value, "hint", myFaxDoc.xMSF);
+ trTo = item;
+ constRangeList.remove(i--);
+ writeTitle(teTo,trTo,resources.resToPlaceHolder_value);
+ }
+ else if (text.equals(resources.resFromPlaceHolder))
+ {
+ teFrom = new PlaceholderTextElement(item, resources.resFromPlaceHolder_value, "hint", myFaxDoc.xMSF);
+ trFrom = item;
+ constRangeList.remove(i--);
+ writeTitle(teFrom,trFrom,resources.resFromPlaceHolder_value);
+ }
+ else if (text.equals(resources.resFaxconstPlaceHolder))
+ {
+ teFaxconst = new PlaceholderTextElement(item, resources.resFaxconstPlaceHolder_value, "hint", myFaxDoc.xMSF);
+ trFaxconst = item;
+ constRangeList.remove(i--);
+ writeTitle(teFaxconst,trFaxconst,resources.resFaxconstPlaceHolder_value);
+ }
+ else if (text.equals(resources.resTelconstPlaceHolder))
+ {
+ teTelconst = new PlaceholderTextElement(item, resources.resTelconstPlaceHolder_value, "hint", myFaxDoc.xMSF);
+ trTelconst = item;
+ constRangeList.remove(i--);
+ writeTitle(teTelconst,trTelconst,resources.resTelconstPlaceHolder_value);
+ }
+ else if (text.equals(resources.resEmailconstPlaceHolder))
+ {
+ teEmailconst = new PlaceholderTextElement(item, resources.resEmailconstPlaceHolder_value, "hint", myFaxDoc.xMSF);
+ trEmailconst = item;
+ constRangeList.remove(i--);
+ writeTitle(teEmailconst,trEmailconst,resources.resEmailconstPlaceHolder_value);
+ }
+ else if (text.equals(resources.resConsist1PlaceHolder))
+ {
+ teConsist1 = new PlaceholderTextElement(item, resources.resConsist1PlaceHolder_value, "hint", myFaxDoc.xMSF);
+ trConsist1 = item;
+ constRangeList.remove(i--);
+ writeTitle(teConsist1,trConsist1,resources.resConsist1PlaceHolder_value);
+ }
+ else if (text.equals(resources.resConsist2PlaceHolder))
+ {
+ teConsist2 = new PlaceholderTextElement(item, resources.resConsist2PlaceHolder_value, "hint", myFaxDoc.xMSF);
+ trConsist2 = item;
+ constRangeList.remove(i--);
+ writeTitle(teConsist2,trConsist2,resources.resConsist2PlaceHolder_value);
+ }
+ else if (text.equals(resources.resConsist3PlaceHolder))
+ {
+ teConsist3 = new PlaceholderTextElement(item, resources.resConsist3PlaceHolder_value, "hint", myFaxDoc.xMSF);
+ trConsist3 = item;
+ constRangeList.remove(i--);
+ writeTitle(teConsist3,trConsist3,resources.resConsist3PlaceHolder_value);
+ }
+
+ }
+ }
+
+ public void clearConstants()
+ {
+ constRangeList.clear();
+ trTo = null;
+ trFrom = null;
+ trFaxconst = null;
+ trTelconst = null;
+ trEmailconst = null;
+ trConsist1 = null;
+ trConsist2 = null;
+ trConsist3 = null;
+ teTo = null;
+ teFrom = null;
+ teFaxconst = null;
+ teTelconst = null;
+ teEmailconst = null;
+ teConsist1 = null;
+ teConsist2 = null;
+ teConsist3 = null;
+ }
+
+ private void writeTitle(TextElement te, XTextRange tr, String text)
+ {
+ te.setText(text == null ? PropertyNames.EMPTY_STRING : text);
+ te.write(tr);
+ }
+
+ public List<XTextRange> searchFillInItems(int type)
+ {
+ try
+ {
+ XSearchable xSearchable = UnoRuntime.queryInterface(XSearchable.class, xTextDocument);
+ XSearchDescriptor sd = xSearchable.createSearchDescriptor();
+
+ if(type == 0)
+ {
+ sd.setSearchString("<[^>]+>");
+ }
+ else if(type == 1)
+ {
+ sd.setSearchString("#[^#]+#");
+ }
+ sd.setPropertyValue("SearchRegularExpression", Boolean.TRUE);
+ sd.setPropertyValue("SearchWords", Boolean.TRUE);
+
+ XIndexAccess ia = xSearchable.findAll(sd);
+
+ List<XTextRange> l = new ArrayList<XTextRange>(ia.getCount());
+ for (int i = 0; i < ia.getCount(); i++)
+ {
+ try
+ {
+ l.add(UnoRuntime.queryInterface(XTextRange.class, ia.getByIndex(i)));
+ }
+ catch (Exception ex)
+ {
+ System.err.println("Nonfatal Error in finding fillins.");
+ }
+ }
+ return l;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed");
+ }
+
+ }
+
public void insertRoadmap()
{
addRoadmap();
@@ -379,6 +533,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap");
+ sTemplatePath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../common");
}
catch (NoValidPathException e)
{
@@ -564,6 +719,8 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
xTextDocument = myFaxDoc.loadAsPreview(BusinessFiles[1][lstBusinessStyle.getSelectedItemPos()], false);
initializeElements();
setElements();
+ clearConstants();
+ drawConstants();
}
public void optPrivateFaxItemChanged()
@@ -683,7 +840,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("Fax", txtSenderFax.getText());
}
- //switch Elements on/off -------------------------------------------------------
+ //switch Elements on/off -------------------------------------------------------
public void setElements()
{
//UI relevant:
@@ -764,7 +921,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
myFaxDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
}
- //enable/disable roadmap item for footer page
+ //enable/disable roadmap item for footer page
XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER);
Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bFooterPossible));
@@ -867,4 +1024,4 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
-
+
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java
index e990a861393b..b5756e81960a 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java
@@ -78,12 +78,30 @@ public class FaxWizardDialogResources extends Resource
String resoptReceiverDatabase_value;
String resLabel2_value;
+ String resToPlaceHolder = "#to#";
+ String resFromPlaceHolder = "#from#";
+ String resFaxconstPlaceHolder = "#faxconst#";
+ String resTelconstPlaceHolder = "#telconst#";
+ String resEmailconstPlaceHolder = "#emailconst#";
+ String resConsist1PlaceHolder = "#consist1#";
+ String resConsist2PlaceHolder = "#consist2#";
+ String resConsist3PlaceHolder = "#consist3#";
+
+ String resToPlaceHolder_value;
+ String resFromPlaceHolder_value;
+ String resFaxconstPlaceHolder_value;
+ String resTelconstPlaceHolder_value;
+ String resEmailconstPlaceHolder_value;
+ String resConsist1PlaceHolder_value;
+ String resConsist2PlaceHolder_value;
+ String resConsist3PlaceHolder_value;
+
public FaxWizardDialogResources(XMultiServiceFactory xmsf)
{
super(xmsf, UNIT_NAME, MODULE_NAME);
/**
* Delete the String, uncomment the getResText method
- *
+ *
*/
resFaxWizardDialog_title = getResText(RID_FAXWIZARDDIALOG_START + 1);
resLabel9_value = getResText(RID_FAXWIZARDDIALOG_START + 2);
@@ -125,6 +143,16 @@ public class FaxWizardDialogResources extends Resource
resoptReceiverPlaceholder_value = getResText(RID_FAXWIZARDDIALOG_START + 38);
resoptReceiverDatabase_value = getResText(RID_FAXWIZARDDIALOG_START + 39);
resLabel2_value = getResText(RID_FAXWIZARDDIALOG_START + 40);
+
+ resToPlaceHolder_value = getResText(RID_FAXWIZARDDIALOG_START + 41);
+ resFromPlaceHolder_value = getResText(RID_FAXWIZARDDIALOG_START + 42);
+ resFaxconstPlaceHolder_value = getResText(RID_FAXWIZARDDIALOG_START + 43);
+ resTelconstPlaceHolder_value = getResText(RID_FAXWIZARDDIALOG_START + 44);
+ resEmailconstPlaceHolder_value = getResText(RID_FAXWIZARDDIALOG_START + 45);
+ resConsist1PlaceHolder_value = getResText(RID_FAXWIZARDDIALOG_START + 46);
+ resConsist2PlaceHolder_value = getResText(RID_FAXWIZARDDIALOG_START + 47);
+ resConsist3PlaceHolder_value = getResText(RID_FAXWIZARDDIALOG_START + 48);
+
loadRoadmapResources();
loadSalutationResources();
loadGreetingResources();
@@ -169,4 +197,4 @@ public class FaxWizardDialogResources extends Resource
CommunicationLabels[i - 1] = getResText(RID_FAXWIZARDCOMMUNICATION_START + i);
}
}
-} \ No newline at end of file
+}
diff --git a/wizards/com/sun/star/wizards/letter/CGLetter.java b/wizards/com/sun/star/wizards/letter/CGLetter.java
index 6df55e230efd..b5c4eda783b9 100644
--- a/wizards/com/sun/star/wizards/letter/CGLetter.java
+++ b/wizards/com/sun/star/wizards/letter/CGLetter.java
@@ -29,7 +29,6 @@ public class CGLetter extends ConfigGroup
public boolean cp_PaperCompanyAddressReceiverField;
public boolean cp_PaperFooter;
public double cp_PaperFooterHeight;
- public int cp_Norm;
public boolean cp_PrintCompanyLogo;
public boolean cp_PrintCompanyAddressReceiverField;
public boolean cp_PrintLetterSigns;
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
index b2afc8420491..ef27af49f547 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
@@ -66,7 +66,6 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
XFixedText lblAddressX;
XFixedText lblAddressY;
XFixedText lblTitle2;
- XListBox lstLetterNorm;
XCheckBox chkUseLogo;
XCheckBox chkUseAddressReceiver;
XCheckBox chkUseSigns;
@@ -77,7 +76,6 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
XCheckBox chkUseGreeting;
XComboBox lstGreeting;
XCheckBox chkUseFooter;
- XFixedText lblLetterNorm;
XFixedText lblTitle3;
XRadioButton optSenderPlaceholder;
XRadioButton optSenderDefine;
@@ -262,7 +260,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
});
ImageControl3 = insertInfoImage(92, 145, 1);
-// ImageControl3 = insertImage("ImageControl3",
+// ImageControl3 = insertImage("ImageControl3",
// new String[] {PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
// new Object[] { new Short((short)0), INTEGERS[10],"private:resource/dbu/image/19205","ImageControl3",92,145,Boolean.FALSE,INTEGERS[1],new Short((short)81),INTEGERS[10]}
// );
@@ -499,15 +497,6 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
public void buildStep3()
{
- lstLetterNorm = insertListBox("lstLetterNorm", LSTLETTERNORM_ACTION_PERFORMED, LSTLETTERNORM_ITEM_CHANGED,
- new String[]
- {
- "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 21), "lstLetterNorm", 210, 34, INTEGERS[3], new Short((short) 21), 74
- });
chkUseLogo = insertCheckBox("chkUseLogo", CHKUSELOGO_ITEM_CHANGED,
new String[]
{
@@ -598,15 +587,6 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
{
INTEGERS[8], HelpIds.getHelpIdString(HID + 31), resources.reschkUseFooter_value, "chkUseFooter", 97, 158, new Short((short) 0), INTEGERS[3], new Short((short) 31), 212
});
- lblLetterNorm = insertLabel("lblLetterNorm",
- new String[]
- {
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- INTEGER_16, resources.reslblLetterNorm_value, Boolean.TRUE, "lblLetterNorm", 97, 28, INTEGERS[3], new Short((short) 50), 109
- });
lblTitle3 = insertLabel("lblTitle3",
new String[]
{
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java
index e9e61b0c3ade..0d345e94e538 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java
@@ -44,7 +44,6 @@ public interface LetterWizardDialogConst
public static final String NUMADDRESSWIDTH_TEXT_CHANGED = "numAddressWidthTextChanged";
public static final String NUMADDRESSY_TEXT_CHANGED = "numAddressYTextChanged";
public static final String LSTLETTERNORM_ACTION_PERFORMED = null;
- public static final String LSTLETTERNORM_ITEM_CHANGED = "lstLetterNormItemChanged";
public static final String CHKUSELOGO_ITEM_CHANGED = "chkUseLogoItemChanged";
public static final String CHKUSEADDRESSRECEIVER_ITEM_CHANGED = "chkUseAddressReceiverItemChanged";
public static final String CHKUSESIGNS_ITEM_CHANGED = "chkUseSignsItemChanged";
@@ -80,4 +79,4 @@ public interface LetterWizardDialogConst
public static final String imageURLImageControl3 = null;
public static final int HID = 40768;
public static final int HIDMAIN = 40820;
-} \ No newline at end of file
+}
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
index 31af8c3b8859..582d71877bca 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.letter;
+import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -30,7 +31,6 @@ import com.sun.star.container.NoSuchElementException;
import com.sun.star.document.MacroExecMode;
import com.sun.star.document.XDocumentProperties;
import com.sun.star.document.XDocumentPropertiesSupplier;
-import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.task.XInteractionHandler;
@@ -39,6 +39,7 @@ import com.sun.star.text.XTextFrame;
import com.sun.star.ucb.CommandAbortedException;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
+import com.sun.star.uno.RuntimeException;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
import com.sun.star.util.CloseVetoException;
@@ -61,23 +62,17 @@ import com.sun.star.wizards.ui.event.DataAware;
import com.sun.star.wizards.ui.event.RadioDataAware;
import com.sun.star.wizards.ui.event.UnoDataAware;
+import com.sun.star.util.XSearchable;
+import com.sun.star.util.XSearchDescriptor;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.text.*;
+import com.sun.star.wizards.text.*;
+import com.sun.star.wizards.common.TextElement;
+import com.sun.star.wizards.common.PlaceholderTextElement;
+
public class LetterWizardDialogImpl extends LetterWizardDialog
{
- private class Strings
- {
- public String Norm;
- public String NormPath;
- public String LanguageLabel;
-
- public Strings(String norm, String normPath, String languageLabel)
- {
- Norm = norm;
- NormPath = normPath;
- LanguageLabel = languageLabel;
- }
- }
-
protected void enterStep(int OldStep, int NewStep)
{
}
@@ -97,16 +92,12 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
String[][] BusinessFiles;
String[][] OfficialFiles;
String[][] PrivateFiles;
- String[] Norms;
- String[] NormPaths;
- String[] NormNames;
String sTemplatePath;
String sUserTemplatePath;
String sBitmapPath;
String sLetterPath;
String sLetterLangPackPath;
String sWorkPath;
- String sCurrentNorm;
String sPath;
boolean bEditTemplate;
boolean bSaveSuccess = false;
@@ -122,6 +113,10 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
final static int RM_FOOTER = 5;
final static int RM_FINALSETTINGS = 6;
+ List<XTextRange> constRangeList = new ArrayList<XTextRange>();
+ XTextRange trSubjectconst;
+ TextElement teSubjectconst;
+
public LetterWizardDialogImpl(XMultiServiceFactory xmsf)
{
super(xmsf);
@@ -137,6 +132,10 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
{
xLocMSF = Desktop.connect(ConnectStr);
}
+ catch (RuntimeException e)
+ {
+ e.printStackTrace();
+ }
catch (Exception e)
{
e.printStackTrace();
@@ -172,7 +171,6 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
buildStep6();
initializePaths();
- initializeNorms();
initializeSalutation();
initializeGreeting();
@@ -183,11 +181,6 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
//load the last used settings from the registry and apply listeners to the controls:
initConfiguration();
- //set the language according to the Linguistic
- int oL = getOfficeLinguistic();
- myConfig.cp_BusinessLetter.cp_Norm = oL;
- myConfig.cp_PrivateOfficialLetter.cp_Norm = oL;
- myConfig.cp_PrivateLetter.cp_Norm = oL;
initializeTemplates(xMSF);
if (myConfig.cp_BusinessLetter.cp_Greeting.equals(PropertyNames.EMPTY_STRING))
@@ -239,6 +232,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
//disable funtionality that is not supported by the template:
initializeElements();
+ drawConstants();
+
//disable the document, so that the user cannot change anything:
myLetterDoc.xFrame.getComponentWindow().setEnable(false);
@@ -253,7 +248,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
removeTerminateListener();
exception.printStackTrace(System.err);
running = false;
- }
+ }
}
public void cancelWizard()
@@ -372,7 +367,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
{
try
{
- //xComponent.dispose();
+ //xComponent.dispose();
XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, myLetterDoc.xFrame);
xCloseable.close(false);
}
@@ -382,6 +377,80 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
}
}
+ public void drawConstants()
+ {
+ constRangeList = searchFillInItems(1);
+
+ XTextRange item = null;
+
+ for (int i = 0; i < constRangeList.size(); i++)
+ {
+ item = constRangeList.get(i);
+ String text = item.getString().trim().toLowerCase();
+ if (text.equals(resources.resSubjectconstPlaceHolder))
+ {
+ teSubjectconst = new PlaceholderTextElement(item, resources.resSubjectconstPlaceHolder_value, "hint", myLetterDoc.xMSF);
+ trSubjectconst = item;
+ constRangeList.remove(i--);
+ writeTitle(teSubjectconst,trSubjectconst,resources.resSubjectconstPlaceHolder_value);
+ }
+ }
+ }
+
+ public void clearConstants()
+ {
+ constRangeList.clear();
+ trSubjectconst = null;
+ teSubjectconst = null;
+ }
+
+ private void writeTitle(TextElement te, XTextRange tr, String text)
+ {
+ te.setText(text == null ? PropertyNames.EMPTY_STRING : text);
+ te.write(tr);
+ }
+
+ public List<XTextRange> searchFillInItems(int type)
+ {
+ try
+ {
+ XSearchable xSearchable = UnoRuntime.queryInterface(XSearchable.class, xTextDocument);
+ XSearchDescriptor sd = xSearchable.createSearchDescriptor();
+
+ if(type == 0)
+ {
+ sd.setSearchString("<[^>]+>");
+ }
+ else if(type == 1)
+ {
+ sd.setSearchString("#[^#]+#");
+ }
+ sd.setPropertyValue("SearchRegularExpression", Boolean.TRUE);
+ sd.setPropertyValue("SearchWords", Boolean.TRUE);
+
+ XIndexAccess ia = xSearchable.findAll(sd);
+
+ List<XTextRange> l = new ArrayList<XTextRange>(ia.getCount());
+ for (int i = 0; i < ia.getCount(); i++)
+ {
+ try
+ {
+ l.add(UnoRuntime.queryInterface(XTextRange.class, ia.getByIndex(i)));
+ }
+ catch (Exception ex)
+ {
+ System.err.println("Nonfatal Error in finding fillins.");
+ }
+ }
+ return l;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed");
+ }
+ }
+
public void optBusinessLetterItemChanged()
{
DataAware.setDataObject(letterDA, myConfig.cp_BusinessLetter, true);
@@ -498,6 +567,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
initializeElements();
chkBusinessPaperItemChanged();
setElements(false);
+ clearConstants();
+ drawConstants();
myLetterDoc.xTextDocument.unlockControllers();
activate();
}
@@ -509,6 +580,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
initializeElements();
setPossibleSenderData(true);
setElements(false);
+ clearConstants();
+ drawConstants();
myLetterDoc.xTextDocument.unlockControllers();
activate();
}
@@ -519,6 +592,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
myLetterDoc.xTextDocument.lockControllers();
initializeElements();
setElements(true);
+ clearConstants();
+ drawConstants();
myLetterDoc.xTextDocument.unlockControllers();
activate();
}
@@ -763,7 +838,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
}
}
- //switch Elements on/off -------------------------------------------------------
+ //switch Elements on/off -------------------------------------------------------
public void chkUseLogoItemChanged()
{
try
@@ -774,9 +849,10 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
myLetterDoc.switchElement("Company Logo", logostatus);
}
}
- catch (IllegalArgumentException e)
+ catch (Exception ex)
{
- e.printStackTrace();
+ ex.printStackTrace();
+ throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed");
}
}
@@ -790,9 +866,10 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
myLetterDoc.switchElement("Sender Address Repeated", rstatus);
}
}
- catch (IllegalArgumentException e)
+ catch (Exception ex)
{
- e.printStackTrace();
+ ex.printStackTrace();
+ throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed");
}
}
@@ -837,7 +914,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
myLetterDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
}
- //enable/disable roadmap item for footer page
+ //enable/disable roadmap item for footer page
XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER);
Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bFooterPossible));
@@ -989,36 +1066,6 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
}
}
- private int getOfficeLinguistic()
- {
- int oL = 0;
- boolean found = false;
- String OfficeLinguistic = Configuration.getOfficeLinguistic(xMSF);
- for (int i = 0; i < Norms.length; i++)
- {
- if (Norms[i].equalsIgnoreCase(OfficeLinguistic))
- {
- oL = i;
- found = true;
- break;
- }
- }
- if (!found)
- {
- //fall back to English:
- for (int i = 0; i < Norms.length; i++)
- {
- if (Norms[i].equalsIgnoreCase("en-US"))
- {
- oL = i;
- found = true;
- break;
- }
- }
- }
- return oL;
- }
-
private void setPossibleSenderData(boolean bState)
{
setControlProperty("optSenderDefine", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
@@ -1090,25 +1137,6 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
}
- public void lstLetterNormItemChanged()
- {
- //when the norm changes, the correct template needs to be reloaded
- sCurrentNorm = Norms[getCurrentLetter().cp_Norm];
- initializeTemplates(xMSF);
- if (optBusinessLetter.getState())
- {
- lstBusinessStyleItemChanged();
- }
- if (optPrivOfficialLetter.getState())
- {
- lstPrivOfficialStyleItemChanged();
- }
- if (optPrivateLetter.getState())
- {
- lstPrivateStyleItemChanged();
- }
- }
-
public void initializeSalutation()
{
setControlProperty("lstSalutation", PropertyNames.STRING_ITEM_LIST, resources.SalutationLabels);
@@ -1119,124 +1147,6 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
setControlProperty("lstGreeting", PropertyNames.STRING_ITEM_LIST, resources.GreetingLabels);
}
- public void initializeNorms()
- {
-
- LocaleCodes lc = new LocaleCodes(xmsf);
- String[] allLocales = lc.getIDs();
- Object[] nameList =
- {
- PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING
- };
- String[] nameList2 =
- {
- PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING
- };
- ArrayList<String> allPaths = new ArrayList<String>();
- String sLetterSubPath = "/wizard/letter/";
-
- try
- {
- sTemplatePath = FileAccess.deleteLastSlashfromUrl(sTemplatePath);
- String[] PathParts = sTemplatePath.split("/");
- String nuString = PropertyNames.EMPTY_STRING;
- String sMainPath;
- for (int i = 0; i < (PathParts.length - 1); i++)
- {
- nuString = nuString + PathParts[i] + "/";
- }
- String sLocLetterPath;
- sMainPath = nuString;
- sMainPath = FileAccess.deleteLastSlashfromUrl(sMainPath);
-
- sLetterPath = sMainPath + sLetterSubPath;
-
- XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
- com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface);
- nameList2 = xSimpleFileAccess.getFolderContents(sLetterPath, true);
- for (int i = 0; i < nameList2.length; i++)
- {
- allPaths.add(nameList2[i]);
- }
- nameList = allPaths.toArray();
-
-
- }
- catch (CommandAbortedException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- //} catch (NoValidPathException e) {
- // TODO Auto-generated catch block
- // e.printStackTrace();
- }
- catch (Exception e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- ArrayList<Strings> StringsVector = new ArrayList<Strings>();
-
- String[] LanguageLabels;
-
- boolean found = false;
- String cIsoCode = PropertyNames.EMPTY_STRING;
- String MSID = PropertyNames.EMPTY_STRING;
- int z = 0;
- for (int i = 0; i < nameList.length; i++)
- {
- found = false;
- cIsoCode = FileAccess.getFilename((String) nameList[i]);
- for (int t = 0; t < allLocales.length; t++)
- {
- String[] aLang = allLocales[t].split(PropertyNames.SEMI_COLON);
- 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(PropertyNames.SEMI_COLON);
- if (cIsoCode.equalsIgnoreCase(aLang[1].substring(0, 2)))
- {
- MSID = aLang[2];
- found = true;
- t = allLocales.length;
- }
- }
- }
-
- if (found)
- {
- StringsVector.add(new Strings(cIsoCode, (String)nameList[i], lc.getLanguageString(MSID)));
- }
- }
-
- Collections.sort(StringsVector, new Comparator<Strings>() {
- public int compare(Strings a, Strings b) {
- return a.LanguageLabel.compareTo(b.LanguageLabel);
- }
- });
-
- Norms = new String[StringsVector.size()];
- NormPaths = new String[StringsVector.size()];
- LanguageLabels = new String[StringsVector.size()];
-
- for(int i = 0; i<StringsVector.size(); i++) {
- Norms[i] = StringsVector.get(i).Norm;
- NormPaths[i] = StringsVector.get(i).NormPath;
- LanguageLabels[i] = StringsVector.get(i).LanguageLabel;
- }
-
- setControlProperty("lstLetterNorm", PropertyNames.STRING_ITEM_LIST, LanguageLabels);
- }
-
private CGLetter getCurrentLetter()
{
switch (myConfig.cp_LetterType)
@@ -1259,6 +1169,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap");
+ sTemplatePath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../common");
}
catch (NoValidPathException e)
{
@@ -1268,12 +1179,12 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
public boolean initializeTemplates(XMultiServiceFactory xMSF)
{
- sCurrentNorm = Norms[getCurrentLetter().cp_Norm];
- //creation of the language independent path:
- String sLetterPath = NormPaths[getCurrentLetter().cp_Norm];
- // try
- // {
+ try
+ {
+ sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
+ String sLetterPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../common/wizard/letter");
+
BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus", sLetterPath);
OfficialFiles = FileAccess.getFolderTitles(xMSF, "off", sLetterPath);
PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", sLetterPath);
@@ -1294,12 +1205,12 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
{
0
});
-// }
-// catch (com.sun.star.wizards.common.NoValidPathException e)
-// {
-// return false;
-// }
- return true;
+ }
+ catch (com.sun.star.wizards.common.NoValidPathException e)
+ {
+ return false;
+ }
+ return true;
}
public void initializeElements()
@@ -1442,7 +1353,6 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
businessDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PaperFooter", chkPaperFooter, null, true));
businessDA.add(UnoDataAware.attachNumericControl(cgl, "cp_PaperFooterHeight", numFooterHeight, null, true));
- letterDA.add(UnoDataAware.attachListBox(cgl, "cp_Norm", lstLetterNorm, null, true));
letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintCompanyLogo", chkUseLogo, null, true));
letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintCompanyAddressReceiverField", chkUseAddressReceiver, null, true));
letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintLetterSigns", chkUseSigns, null, true));
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java
index d2dbae1c6530..586872e26b3f 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java
@@ -96,6 +96,9 @@ public class LetterWizardDialogResources extends Resource
String reslblTitle5_value;
String reslblTitle6_value;
+ String resSubjectconstPlaceHolder = "#subjectconst#";
+ String resSubjectconstPlaceHolder_value;
+
public LetterWizardDialogResources(XMultiServiceFactory xmsf)
{
super(xmsf, UNIT_NAME, MODULE_NAME);
@@ -159,6 +162,8 @@ public class LetterWizardDialogResources extends Resource
reslblTitle5_value = getResText(RID_LETTERWIZARDDIALOG_START + 57);
reslblTitle6_value = getResText(RID_LETTERWIZARDDIALOG_START + 58);
+ resSubjectconstPlaceHolder_value = getResText(RID_LETTERWIZARDDIALOG_START + 59);
+
loadRoadmapResources();
loadSalutationResources();
loadGreetingResources();
diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java
index e07b6c783c06..0c773dd5b9ca 100644
--- a/wizards/com/sun/star/wizards/report/ReportLayouter.java
+++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java
@@ -24,6 +24,19 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.*;
import com.sun.star.wizards.ui.*;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.util.XSearchable;
+import com.sun.star.util.XSearchDescriptor;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.text.*;
+import com.sun.star.wizards.text.*;
+import com.sun.star.wizards.common.TextElement;
+import com.sun.star.wizards.common.PlaceholderTextElement;
+import java.util.List;
+import java.util.ArrayList;
+
public class ReportLayouter
{
@@ -52,6 +65,9 @@ public class ReportLayouter
Object aOrientationImage;
// boolean m_bLandscape = true;
private XMultiServiceFactory m_xMSF;
+ private XTextRange trTitleconst, trAuthorconst, trDateconst, trPageconst;
+ private TextElement teTitleconst, teAuthorconst, teDateconst, tePageconst;
+ private List<XTextRange> constRangeList = new ArrayList<XTextRange>();
public ReportLayouter(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, UnoDialog _CurUnoDialog)
{
@@ -249,6 +265,8 @@ public class ReportLayouter
{
iOldContentPos = iPos;
CurReportDocument.liveupdate_changeContentTemplate(ContentFiles[1][iPos]);
+ clearConstants();
+ drawConstants();
}
break;
@@ -258,6 +276,8 @@ public class ReportLayouter
{
iOldLayoutPos = iPos;
CurReportDocument.liveupdate_changeLayoutTemplate(LayoutFiles[1][iPos]/*, Desktop.getBitmapPath(m_xMSF)*/);
+ clearConstants();
+ drawConstants();
}
break;
@@ -329,4 +349,104 @@ public class ReportLayouter
Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE);
}
}
+
+ public void drawConstants()
+ {
+ constRangeList = searchFillInItems(1);
+
+ XTextRange item = null;
+
+ for (int i = 0; i < constRangeList.size(); i++)
+ {
+ item = constRangeList.get(i);
+ String text = item.getString().trim().toLowerCase();
+ if (text.equals("#titleconst#"))
+ {
+ teTitleconst = new PlaceholderTextElement(item, CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 86), PropertyNames.EMPTY_STRING, m_xMSF);
+ trTitleconst = item;
+ constRangeList.remove(i--);
+ writeTitle(teTitleconst, trTitleconst, CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 86));
+ }
+ else if (text.equals("#authorconst#"))
+ {
+ teAuthorconst = new PlaceholderTextElement(item, CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 87), PropertyNames.EMPTY_STRING, m_xMSF);
+ trAuthorconst = item;
+ constRangeList.remove(i--);
+ writeTitle(teAuthorconst, trAuthorconst, CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 87));
+ }
+ else if (text.equals("#dateconst#"))
+ {
+ teDateconst = new PlaceholderTextElement(item, CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 88), PropertyNames.EMPTY_STRING, m_xMSF);
+ trDateconst = item;
+ constRangeList.remove(i--);
+ writeTitle(teDateconst, trDateconst, CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 88));
+ }
+ else if (text.equals("#pageconst#"))
+ {
+ tePageconst = new PlaceholderTextElement(item, CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 93), PropertyNames.EMPTY_STRING, m_xMSF);
+ trPageconst = item;
+ constRangeList.remove(i--);
+ writeTitle(tePageconst, trPageconst, CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 93));
+ }
+ }
+ }
+
+ public void clearConstants()
+ {
+ constRangeList.clear();
+ trTitleconst = null;
+ teTitleconst = null;
+ trAuthorconst = null;
+ teAuthorconst = null;
+ trDateconst = null;
+ teDateconst = null;
+ trPageconst = null;
+ tePageconst = null;
+ }
+
+ private void writeTitle(TextElement te, XTextRange tr, String text)
+ {
+ te.setText(text == null ? PropertyNames.EMPTY_STRING : text);
+ te.write(tr);
+ }
+
+ public List<XTextRange> searchFillInItems(int type)
+ {
+ try
+ {
+ XSearchable xSearchable = UnoRuntime.queryInterface(XSearchable.class, CurReportDocument.getComponent());
+ XSearchDescriptor sd = xSearchable.createSearchDescriptor();
+
+ if(type == 0)
+ {
+ sd.setSearchString("<[^>]+>");
+ }
+ else if(type == 1)
+ {
+ sd.setSearchString("#[^#]+#");
+ }
+ sd.setPropertyValue("SearchRegularExpression", Boolean.TRUE);
+ sd.setPropertyValue("SearchWords", Boolean.TRUE);
+
+ XIndexAccess ia = xSearchable.findAll(sd);
+ List<XTextRange> l = new ArrayList<XTextRange>(ia.getCount());
+ for (int i = 0; i < ia.getCount(); i++)
+ {
+ try
+ {
+ l.add(UnoRuntime.queryInterface(XTextRange.class, ia.getByIndex(i)));
+ }
+ catch (Exception ex)
+ {
+ System.err.println("Nonfatal Error in finding fillins.");
+ }
+ }
+ return l;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed");
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java
index f557a3b9ed6d..16bece7dd26a 100644
--- a/wizards/com/sun/star/wizards/report/ReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -481,6 +481,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
{
buildSteps();
+ CurReportLayouter.drawConstants();
+
m_reportDocument.checkInvariants();
this.CurDBCommandFieldSelection.preselectCommand(m_wizardContext, false);
@@ -553,7 +555,6 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
{
m_reportDocument.getRecordParser().addReportDocument(m_reportDocument.getComponent(), false);
}
-
m_reportDocument.getRecordParser().dispose();
}
@@ -735,6 +736,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
{
}
}
+
// public void tests()
// {
//
@@ -752,7 +754,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
// long nTime = aDate.getTime();
// Long aLong = new Long(nTime);
// String aStr = aLong.toString();
-//
+//
// Date aNewDate = new Date(1202382900000L);
//// aNewDate.
// String aDateStr = aNewDate.toString();
diff --git a/wizards/source/formwizard/dbwizres.src b/wizards/source/formwizard/dbwizres.src
index e8189a445af8..c31f513ac6e3 100644
--- a/wizards/source/formwizard/dbwizres.src
+++ b/wizards/source/formwizard/dbwizres.src
@@ -1484,6 +1484,10 @@ String RID_DB_REPORT_WIZARD_START + 92
{
Text [ en-US ] = "No valid report template was found.";
};
+String RID_DB_REPORT_WIZARD_START + 93
+{
+ Text [ en-US ] = "Page:";
+};
// ============================================================================
@@ -2035,6 +2039,11 @@ String RID_LETTERWIZARDDIALOG_START + 58
Text [ en-US] = "Please specify last settings";
};
+String RID_LETTERWIZARDDIALOG_START + 59
+{
+ Text [ en-US] = "Subject:";
+};
+
//====================== Letter Wizard Greeting Start
String RID_LETTERWIZARDSALUTATION_START + 1
{
@@ -2307,6 +2316,47 @@ String RID_FAXWIZARDDIALOG_START + 40
Text [ en-US] = "~New return address";
};
+String RID_FAXWIZARDDIALOG_START + 41
+{
+ Text [ en-US] = "To:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 42
+{
+ Text [ en-US] = "From:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 43
+{
+ Text [ en-US] = "Fax:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 44
+{
+ Text [ en-US] = "Tel:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 45
+{
+ Text [ en-US] = "E-mail:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 46
+{
+ Text [ en-US] = "This template consists of";
+};
+
+String RID_FAXWIZARDDIALOG_START + 47
+{
+ Text [ en-US] = "page";
+};
+
+String RID_FAXWIZARDDIALOG_START + 48
+{
+ Text [ en-US] = "Please inform us if transmission errors occur.";
+};
+
+
//====================== Fax Wizard Communication Start
String RID_FAXWIZARDCOMMUNICATION_START + 1
{
@@ -3506,4 +3556,63 @@ String RID_AGENDAWIZARDDIALOG_START +71
{
Text [en-US ] = "Move down";
};
-
+String RID_AGENDAWIZARDDIALOG_START +72
+{
+ Text [en-US ] = "Date:";
+};
+String RID_AGENDAWIZARDDIALOG_START +73
+{
+ Text [en-US ] = "Time:";
+};
+String RID_AGENDAWIZARDDIALOG_START +74
+{
+ Text [en-US ] = "Location:";
+};
+String RID_AGENDAWIZARDDIALOG_START +75
+{
+ Text [en-US ] = "Topics";
+};
+String RID_AGENDAWIZARDDIALOG_START +76
+{
+ Text [en-US ] = "Num.";
+};
+String RID_AGENDAWIZARDDIALOG_START +77
+{
+ Text [en-US ] = "Topic";
+};
+String RID_AGENDAWIZARDDIALOG_START +78
+{
+ Text [en-US ] = "Responsible";
+};
+String RID_AGENDAWIZARDDIALOG_START +79
+{
+ Text [en-US ] = "Time";
+};
+String RID_AGENDAWIZARDDIALOG_START +80
+{
+ Text [en-US ] = "Additional information";
+};
+String RID_AGENDAWIZARDDIALOG_START +81
+{
+ Text [en-US ] = "Minutes for";
+};
+String RID_AGENDAWIZARDDIALOG_START +82
+{
+ Text [en-US ] = "Discussion:";
+};
+String RID_AGENDAWIZARDDIALOG_START +83
+{
+ Text [en-US ] = "Conclusion:";
+};
+String RID_AGENDAWIZARDDIALOG_START +84
+{
+ Text [en-US ] = "To do:";
+};
+String RID_AGENDAWIZARDDIALOG_START +85
+{
+ Text [en-US ] = "Responsible party:";
+};
+String RID_AGENDAWIZARDDIALOG_START +86
+{
+ Text [en-US ] = "Deadline:";
+};