[Libreoffice-commits] core.git: 3 commits - officecfg/registry postprocess/Rdb_services.mk scp2/source wizards/com wizards/Jar_agenda.mk wizards/Module_wizards.mk
Xisco Fauli
anistenis at gmail.com
Wed Feb 13 15:55:47 PST 2013
officecfg/registry/data/org/openoffice/Office/Common.xcu | 2
postprocess/Rdb_services.mk | 2
scp2/source/ooo/directory_ooo.scp | 6
scp2/source/ooo/file_ooo.scp | 6
wizards/Jar_agenda.mk | 59
wizards/Module_wizards.mk | 2
wizards/com/sun/star/wizards/agenda/AgendaDocument.py | 6
wizards/com/sun/star/wizards/agenda/AgendaTemplate.java | 2207 ----------
wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java | 376 -
wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java | 100
wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java | 570 --
wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py | 70
wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java | 247 -
wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py | 33
wizards/com/sun/star/wizards/agenda/CGAgenda.java | 75
wizards/com/sun/star/wizards/agenda/CGTopic.java | 79
wizards/com/sun/star/wizards/agenda/CallWizard.java | 213
wizards/com/sun/star/wizards/agenda/MANIFEST.MF | 2
wizards/com/sun/star/wizards/agenda/TemplateConsts.java | 149
wizards/com/sun/star/wizards/agenda/TopicsControl.java | 1327 ------
wizards/com/sun/star/wizards/agenda/TopicsControl.py | 6
wizards/com/sun/star/wizards/agenda/agenda.component | 8
22 files changed, 96 insertions(+), 5449 deletions(-)
New commits:
commit f4dc5247fca29f93a2d19b7e526d30d4b022b0ee
Author: Xisco Fauli <anistenis at gmail.com>
Date: Thu Feb 14 00:54:03 2013 +0100
fdo#38820: bye bye java agenda wizard
Hasta la vista, baby!
Change-Id: Idb6b5f383667960918a8f1b9db653edbfc89c232
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
deleted file mode 100644
index a022c34..0000000
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
+++ /dev/null
@@ -1,2207 +0,0 @@
-/*
- * 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.agenda;
-
-import java.util.*;
-import com.sun.star.awt.TextEvent;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.container.NoSuchElementException;
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.container.XNamed;
-import com.sun.star.document.XDocumentProperties;
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.frame.XTerminateListener;
-import com.sun.star.i18n.NumberFormatIndex;
-import com.sun.star.lang.Locale;
-import com.sun.star.lang.WrappedTargetException;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.table.XCell;
-import com.sun.star.table.XTableRows;
-import com.sun.star.text.*;
-import com.sun.star.uno.Any;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XNumberFormatsSupplier;
-import com.sun.star.util.XNumberFormatter;
-import com.sun.star.util.XSearchDescriptor;
-import com.sun.star.util.XSearchable;
-import com.sun.star.wizards.common.FileAccess;
-import com.sun.star.wizards.common.Helper;
-import com.sun.star.wizards.common.JavaTools;
-import com.sun.star.wizards.common.NumberFormatter;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.document.OfficeDocument;
-import com.sun.star.wizards.text.TextDocument;
-import com.sun.star.wizards.text.TextSectionHandler;
-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 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
- * topics table (note singular).
- * <br/> <br/>
- * Other small classes are used to abstract the handling of cells and text and we
- * try to use them as components.
- * <br/><br/>
- * We tried to keep the Agenda Template as flexible as possible, though there
- * must be many limitations, because it is generated dynamically.<br/><br/>
- * To keep the template flexible the following decisions were made:<br/>
- * 1. Item tables.<br/>
- * 1.a. there might be arbitrary number of Item tables.<br/>
- * 1.b. Item tables design (bordewr, background) is arbitrary.<br/>
- * 1.c. Items text styles are individual, and use stylelist styles with predefined names.<br/>
- * As result the following limitations:<br/>
- * Pairs of Name->value for each item.<br/>
- * Tables contain *only* those pairs.<br/>
- * 2. Topics table.<br/>
- * 2.a. arbitrary structure.<br/>
- * 2.b. design is arbitrary.<br/>
- * As result the following limitations:<br/>
- * No column merge is allowed.<br/>
- * One compolsary Heading row.<br/>
- * <br/><br/>
- * To let the template be flexible, we use a kind of "detection": we look where
- * the items are read the design of each table, reaplying it after writing the
- * table.
- * <br/><br/>
- * A note about threads:<br/>
- * Many methods here are synchronized, in order to avoid colission made by
- * events fired too often.
- *
- */
-public class AgendaTemplate extends TextDocument implements TemplateConsts, DataAware.Listener
-{
-
- /**
- * resources.
- */
- AgendaWizardDialogResources resources;
- /**
- * data model. This keeps the status of the agenda document, and
- * every redraw is done according to this data.
- * Exception: topic data is written programatically, event-oriented.
- */
- CGAgenda agenda;
- /**
- * the UNO Text Document serrvice
- */
- Object document;
- /**
- * Service Factory
- */
- XMultiServiceFactory docMSF;
- /**
- * 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.
- */
- String template;
- /**
- * used for common operations on sections.
- */
- TextSectionHandler textSectionHandler;
- /**
- * a component loader.
- */
- XComponentLoader xComponentLoader;
- /**
- * an array containing all ItemTable object (which control each an Items
- * Table in the document.
- */
- ItemsTable[] itemsTables;
- /**
- * the controller of the topics table.
- */
- Topics topics;
- /**
- * Stores reusable OOo Placeholder TextFields to insert to the document.
- */
- Map<String, AgendaItem> itemsCache;
- /**
- * This map is used to find which tables contains a certain Item, so
- * the keys are the different Items, the Objects are the ItemTable controllers.
- * When an Item must be redrawn (because the user checked or uncheced it),
- * the controller is retrieved from this Map, and a redraw is issued on this controller.
- */
- Map<String, ItemsTable> itemsMap = new HashMap<String, ItemsTable>(11);
- /**
- * A temporary variable used to list all items and map them.
- */
- List<XTextRange> _allItems = new ArrayList<XTextRange>();
- 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.
- */
- int dateFormat, timeFormat;
- XNumberFormatter dateFormatter, timeFormatter;
- /**
- * used to transfare time from VCL to UNO.
- */
- long docNullTime;
- Calendar calendar;
- /**
- * used to set the document title property (step 6).
- */
- private XDocumentProperties m_xDocProps;
-
- /**
- * loads the given template, and analyze its structure.
- * @param templateURL
- * @param topics
- * @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);
- document = loadAsPreview(templateURL, false);
- docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
- xFrame.getComponentWindow().setEnable(false);
- xTextDocument.lockControllers();
- initialize();
- initializeData(topics);
- xTextDocument.unlockControllers();
- }
-
- /**
- * The agenda templates are in format of aw-XXX.ott
- * the templates name is then XXX.ott.
- * This method calculates it.
- * @param url
- * @return the template name without the "aw-" at the beginning.
- */
- private String calcTemplateName(String url)
- {
- return FileAccess.connectURLs(FileAccess.getParentDir(url), FileAccess.getFilename(url).substring(3));
- }
-
- /**
- * synchronize the document to the model.<br/>
- * this method rewrites all titles, item tables , and the topics table-
- * thus synchronizing the document to the data model (CGAgenda).
- * @param topicsData since the model does not contain Topics
- * information (it is only actualized on save) the given list
- * supplies this information.
- */
- private void initializeData(List<PropertyValue[]> topicsData)
- {
- //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
- {
- itemsTables[i].write(PropertyNames.EMPTY_STRING);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- redrawTitle("txtTitle");
- redrawTitle("txtDate");
- redrawTitle("txtTime");
- redrawTitle("cbLocation");
-
- topics.writeAll(topicsData);
-
- setTemplateTitle(agenda.cp_TemplateName);
-
- }
-
- /**
- * redraws/rewrites the table which contains the given item
- * This method is called when the user checks/unchecks an item.
- * The table is being found, in which the item is, and redrawn.
- * @param itemName
- */
- public synchronized void redraw(String itemName)
- {
- try
- {
- // get the table in which the item is...
- Object itemsTable =
- itemsMap.get(itemName);
- // rewrite the table.
- ((ItemsTable) itemsTable).write(null);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- /**
- * update the documents title property to the given title
- * @param newTitle new title.
- */
- synchronized void setTemplateTitle(String newTitle)
- {
- m_xDocProps.setTitle(newTitle);
- }
-
- /**
- * constructor. The document is *not* loaded here.
- * only some formal members are set.
- * @param xmsf_ service factory.
- * @param agenda_ the data model (CGAgenda)
- * @param resources_ resources.
- */
- AgendaTemplate(XMultiServiceFactory xmsf_, CGAgenda agenda_, AgendaWizardDialogResources resources_, XTerminateListener listener)
- {
- super(xmsf_, listener, "WIZARD_LIVE_PREVIEW");
-
- agenda = agenda_;
- resources = resources_;
-
- if (itemsCache == null)
- {
- initItemsCache();
- }
- _allItems.clear();
- constItems.clear();
- }
-
- /**
- * checks the data model if the
- * item corresponding to the given string should be shown
- * @param itemName a string representing an Item (name or heading).
- * @return true if the model specifies that the item should be displayed.
- */
- boolean isShowItem(String itemName)
- {
- if (itemName.equals(FILLIN_MEETING_TYPE))
- {
- return agenda.cp_ShowMeetingType;
- }
- else if (itemName.equals(FILLIN_READ))
- {
- return agenda.cp_ShowRead;
- }
- else if (itemName.equals(FILLIN_BRING))
- {
- return agenda.cp_ShowBring;
- }
- else if (itemName.equals(FILLIN_NOTES))
- {
- return agenda.cp_ShowNotes;
- }
- else if (itemName.equals(FILLIN_FACILITATOR))
- {
- return agenda.cp_ShowFacilitator;
- }
- else if (itemName.equals(FILLIN_TIMEKEEPER))
- {
- return agenda.cp_ShowTimekeeper;
- }
- else if (itemName.equals(FILLIN_NOTETAKER))
- {
- return agenda.cp_ShowNotetaker;
- }
- else if (itemName.equals(FILLIN_PARTICIPANTS))
- {
- return agenda.cp_ShowAttendees;
- }
- else if (itemName.equals(FILLIN_CALLED_BY))
- {
- return agenda.cp_ShowCalledBy;
- }
- else if (itemName.equals(FILLIN_OBSERVERS))
- {
- return agenda.cp_ShowObservers;
- }
- else if (itemName.equals(FILLIN_RESOURCE_PERSONS))
- {
- return agenda.cp_ShowResourcePersons;
- }
- else
- {
- throw new IllegalArgumentException("No such item");
- }
- }
-
- /**
- * 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).
- */
- private void initItemsCache()
- {
- itemsCache = new HashMap<String, AgendaItem>(11);
-
- XMultiServiceFactory xmsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
- // Headings
-
- itemsCache.put(FILLIN_MEETING_TYPE,
- new AgendaItem(FILLIN_MEETING_TYPE, new TextElement(resources.itemMeetingType, STYLE_MEETING_TYPE),
- new PlaceholderElement(STYLE_MEETING_TYPE_TEXT, resources.reschkMeetingTitle_value, resources.resPlaceHolderHint, xmsf)));
-
- itemsCache.put(FILLIN_BRING,
- new AgendaItem(FILLIN_BRING, new TextElement(resources.itemBring, STYLE_BRING),
- new PlaceholderElement(STYLE_BRING_TEXT, resources.reschkBring_value, resources.resPlaceHolderHint, xmsf)));
-
- itemsCache.put(FILLIN_READ,
- new AgendaItem(FILLIN_READ, new TextElement(resources.itemRead, STYLE_READ),
- new PlaceholderElement(STYLE_READ_TEXT, resources.reschkRead_value, resources.resPlaceHolderHint, xmsf)));
-
- itemsCache.put(FILLIN_NOTES,
- new AgendaItem(FILLIN_NOTES, new TextElement(resources.itemNote, STYLE_NOTES),
- new PlaceholderElement(STYLE_NOTES_TEXT, resources.reschkNotes_value, resources.resPlaceHolderHint, xmsf)));
-
- // Names
-
- itemsCache.put(FILLIN_CALLED_BY,
- new AgendaItem(FILLIN_CALLED_BY, new TextElement(resources.itemCalledBy, STYLE_CALLED_BY),
- new PlaceholderElement(STYLE_CALLED_BY_TEXT, resources.reschkConvenedBy_value, resources.resPlaceHolderHint, xmsf)));
-
- itemsCache.put(FILLIN_FACILITATOR,
- new AgendaItem(FILLIN_FACILITATOR, new TextElement(resources.itemFacilitator, STYLE_FACILITATOR),
- new PlaceholderElement(STYLE_FACILITATOR_TEXT, resources.reschkPresiding_value, resources.resPlaceHolderHint, xmsf)));
-
- itemsCache.put(FILLIN_PARTICIPANTS,
- new AgendaItem(FILLIN_PARTICIPANTS, new TextElement(resources.itemAttendees, STYLE_PARTICIPANTS),
- new PlaceholderElement(STYLE_PARTICIPANTS_TEXT, resources.reschkAttendees_value, resources.resPlaceHolderHint, xmsf)));
-
- itemsCache.put(FILLIN_NOTETAKER,
- new AgendaItem(FILLIN_NOTETAKER, new TextElement(resources.itemNotetaker, STYLE_NOTETAKER),
- new PlaceholderElement(STYLE_NOTETAKER_TEXT, resources.reschkNoteTaker_value, resources.resPlaceHolderHint, xmsf)));
-
- itemsCache.put(FILLIN_TIMEKEEPER,
- new AgendaItem(FILLIN_TIMEKEEPER, new TextElement(resources.itemTimekeeper, STYLE_TIMEKEEPER),
- new PlaceholderElement(STYLE_TIMEKEEPER_TEXT, resources.reschkTimekeeper_value, resources.resPlaceHolderHint, xmsf)));
-
- itemsCache.put(FILLIN_OBSERVERS,
- new AgendaItem(FILLIN_OBSERVERS, new TextElement(resources.itemObservers, STYLE_OBSERVERS),
- new PlaceholderElement(STYLE_OBSERVERS_TEXT, resources.reschkObservers_value, resources.resPlaceHolderHint, xmsf)));
-
- itemsCache.put(FILLIN_RESOURCE_PERSONS,
- new AgendaItem(FILLIN_RESOURCE_PERSONS, new TextElement(resources.itemResource, STYLE_RESOURCE_PERSONS),
- new PlaceholderElement(STYLE_RESOURCE_PERSONS_TEXT, resources.reschkResourcePersons_value, resources.resPlaceHolderHint, xmsf)));
-
- }
-
- /**
- * Initializes a template.<br/>
- * This method does the following tasks:<br/>
- * Get a Time and Date format for the document, and retrieve the null date of the document (which is
- * document-specific).<br/>
- * Initializes the Items Cache map.
- * Analyses the document:<br/>
- * -find all "fille-ins" (apear as >xxx< in the document).
- * -analyze all items sections (and the tables in them).
- * -locate the titles and actualize them
- * -analyze the topics table
- */
- private void initialize()
- {
- /*
- * Get the default locale of the document, and create the date and time formatters.
- */
- 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");
-
- java.util.Locale jl = new java.util.Locale(
- l.Language, l.Country, l.Variant);
-
- calendar = Calendar.getInstance(jl);
-
- XNumberFormatsSupplier nfs = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document);
- Object formatSettings = nfs.getNumberFormatSettings();
- com.sun.star.util.Date date = (com.sun.star.util.Date) Helper.getUnoPropertyValue(formatSettings, "NullDate");
-
- calendar.set(date.Year, date.Month - 1, date.Day);
-
- docNullTime = JavaTools.getTimeInMillis(calendar);
-
- dateFormat = NumberFormatter.getNumberFormatterKey(nfs, NumberFormatIndex.DATE_SYSTEM_LONG);
- timeFormat = NumberFormatter.getNumberFormatterKey(nfs, NumberFormatIndex.TIME_HHMM);
-
-
- dateFormatter = NumberFormatter.createNumberFormatter(xMSF, nfs);
- timeFormatter = NumberFormatter.createNumberFormatter(xMSF, nfs);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- throw new NullPointerException("Fatal Error: could not initialize locale or date/time formats.");
- }
-
- /*
- * get the document properties object.
- */
- m_xDocProps = OfficeDocument.getDocumentProperties(document);
-
- 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();
- constItems.clear();
- }
-
- /**
- * locates the titles (name, location, date, time) and saves a reference to thier Text ranges.
- *
- */
- private void initializeTitles()
- {
- XTextRange item = null;
-
- XMultiServiceFactory xmsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
-
- for (int i = 0; i < _allItems.size(); i++)
- {
- item = _allItems.get(i);
- String text = item.getString().trim().toLowerCase();
- if (text.equals(FILLIN_TITLE))
- {
-
- teTitle = new PlaceholderTextElement(item, resources.resPlaceHolderTitle, resources.resPlaceHolderHint, xmsf);
- trTitle = item;
- _allItems.remove(i--);
- }
- else if (text.equals(FILLIN_DATE))
- {
- teDate = new PlaceholderTextElement(item, resources.resPlaceHolderDate, resources.resPlaceHolderHint, xmsf);
- trDate = item;
- _allItems.remove(i--);
- }
- else if (text.equals(FILLIN_TIME))
- {
- teTime = new PlaceholderTextElement(item, resources.resPlaceHolderTime, resources.resPlaceHolderHint, xmsf);
- trTime = item;
- _allItems.remove(i--);
- }
- else if (text.equals(FILLIN_LOCATION))
- {
- teLocation = new PlaceholderTextElement(item, resources.resPlaceHolderLocation, resources.resPlaceHolderHint, xmsf);
- trLocation = item;
- _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()
- {
- 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(0);
- constItems = searchFillInItems(1);
- }
-
- /**
- * searches the document for items in the format ">*<"
- * @return a vector containing the XTextRanges of the found items
- */
- private List<XTextRange> searchFillInItems(int type)
- {
- try
- {
- XSearchable xSearchable = UnoRuntime.queryInterface(XSearchable.class, document);
- 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");
- }
- }
-
- /**
- * analyze the item sections in the template. delegates the analyze of each table to the
- * ItemsTable class.
- */
- private void initializeItemsSections()
- {
- String[] sections = getSections(document, TemplateConsts.SECTION_ITEMS);
-
- // for each section - there is a table...
- itemsTables = new ItemsTable[sections.length];
-
- for (int i = 0; i < itemsTables.length; i++)
- {
- try
- {
- itemsTables[i] = new ItemsTable(getSection(sections[i]), getTable(sections[i]));
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- throw new IllegalArgumentException("Fatal Error while initialilzing Template: items table in section " + sections[i]);
- }
- }
-
- }
-
- private String[] getSections(Object document, String s)
- {
- XTextSectionsSupplier xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, document);
- String[] allSections = xTextSectionsSupplier.getTextSections().getElementNames();
- return getNamesWhichStartWith(allSections, s);
- }
-
- Object getSection(String name) throws NoSuchElementException, WrappedTargetException
- {
- XTextSectionsSupplier xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, document);
- return ((Any) (xTextSectionsSupplier.getTextSections().getByName(name))).getObject();
- }
-
- Object getTable(String name) throws NoSuchElementException, WrappedTargetException
- {
- XTextTablesSupplier xTextTablesSupplier = UnoRuntime.queryInterface(XTextTablesSupplier.class, document);
- return ((Any) xTextTablesSupplier.getTextTables().getByName(name)).getObject();
- }
-
- /**
- * implementation of DataAware.Listener, is
- * called when title/date/time or location are
- * changed.
- */
- public synchronized void eventPerformed(Object param)
- {
- TextEvent te = (TextEvent) param;
- String controlName = (String) Helper.getUnoPropertyValue(
- UnoDialog2.getModel(te.Source),
- PropertyNames.PROPERTY_NAME);
- redrawTitle(controlName);
- }
-
- private synchronized void redrawTitle(String controlName)
- {
- if (controlName.equals("txtTitle"))
- {
- writeTitle(teTitle, trTitle, agenda.cp_Title);
- }
- else if (controlName.equals("txtDate"))
- {
- writeTitle(teDate, trDate, getDateString(agenda.cp_Date));
- }
- else if (controlName.equals("txtTime"))
- {
- writeTitle(teTime, trTime, getTimeString(agenda.cp_Time));
- }
- else if (controlName.equals("cbLocation"))
- {
- writeTitle(teLocation, trLocation, agenda.cp_Location);
- }
- else
- {
- throw new IllegalArgumentException("No such title control...");
- }
- }
-
- 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);
- te.write(tr);
- }
- private static long DAY_IN_MILLIS = (24 * 60 * 60 * 1000);
-
- private String getDateString(String d)
- {
- if (d == null || d.equals(PropertyNames.EMPTY_STRING))
- {
- return PropertyNames.EMPTY_STRING;
- }
- int date = Integer.parseInt(d);
- calendar.clear();
- calendar.set(date / 10000,
- (date % 10000) / 100 - 1,
- date % 100);
-
- long date1 = JavaTools.getTimeInMillis(calendar);
- /*
- * docNullTime and date1 are in millis, but
- * I need a day...
- */
- double daysDiff = (date1 - docNullTime) / DAY_IN_MILLIS + 1;
-
- return dateFormatter.convertNumberToString(dateFormat, daysDiff);
- }
-
- private String getTimeString(String s)
- {
- if (s == null || s.equals(PropertyNames.EMPTY_STRING))
- {
- return PropertyNames.EMPTY_STRING;
- }
- int time = Integer.parseInt(s);
-
- double t = ((double) (time / 1000000) / 24) + ((double) ((time % 1000000) / 1000) / (24 * 60));
- return timeFormatter.convertNumberToString(timeFormat, t);
- }
-
- /* *******************************************
- * F I N I S H
- *********************************************/
- /** the user clicked finish **/
- public synchronized void finish(List<PropertyValue[]> topics)
- {
- createMinutes(topics);
- deleteHiddenSections();
- 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.
- */
- private void deleteHiddenSections()
- {
- XTextSectionsSupplier xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, document);
- String[] allSections = xTextSectionsSupplier.getTextSections().getElementNames();
- try
- {
- for (int i = 0; i < allSections.length; i++)
- {
- Object section = getSection(allSections[i]);
- boolean visible = ((Boolean) Helper.getUnoPropertyValue(section, "IsVisible")).booleanValue();
- if (!visible)
- {
- UnoRuntime.queryInterface(XTextContent.class, section).getAnchor().setString(PropertyNames.EMPTY_STRING);
- }
- }
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- /**
- * 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.
- */
- public synchronized void createMinutes(List<PropertyValue[]> topicsData)
- {
-
- // if the minutes section should be removed (the
- // user did not check "create minutes")
- if (!agenda.cp_IncludeMinutes || (topicsData.size() <= 1))
- {
- try
- {
- Object minutesAllSection = getSection(SECTION_MINUTES_ALL);
- XTextSection xTextSection = UnoRuntime.queryInterface(XTextSection.class, minutesAllSection);
- xTextSection.getAnchor().setString(PropertyNames.EMPTY_STRING);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- // the user checked "create minutes"
- else
- {
- try
- {
- String itemText;
- XTextRange item;
- int topicStartTime = 0;
- try
- {
- topicStartTime = Integer.parseInt(agenda.cp_Time);
- }
- catch (Exception ex)
- {
- }
-
- String time;
-
- // first I replace the minutes titles...
- List<XTextRange> items = searchFillInItems(0);
- for (int itemIndex = 0; itemIndex < items.size(); itemIndex++)
- {
- item = items.get(itemIndex);
- itemText = item.getString().trim().toLowerCase();
-
- if (itemText.equals(FILLIN_MINUTES_TITLE))
- {
- fillMinutesItem(item, agenda.cp_Title, resources.resPlaceHolderTitle);
- }
- else if (itemText.equals(FILLIN_MINUTES_LOCATION))
- {
- fillMinutesItem(item, agenda.cp_Location, resources.resPlaceHolderLocation);
- }
- else if (itemText.equals(FILLIN_MINUTES_DATE))
- {
- fillMinutesItem(item, getDateString(agenda.cp_Date), resources.resPlaceHolderDate);
- }
- else if (itemText.equals(FILLIN_MINUTES_TIME))
- {
- fillMinutesItem(item, getTimeString(agenda.cp_Time), resources.resPlaceHolderTime);
- }
-
- }
-
- items.clear();
-
- /*
- * 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(0);
- for (int itemIndex = 0; itemIndex < items.size(); itemIndex++)
- {
- item = items.get(itemIndex);
- itemText = item.getString().trim().toLowerCase();
-
- if (itemText.equals(FILLIN_MINUTE_NUM))
- {
- fillMinutesItem(item, topic[0].Value, PropertyNames.EMPTY_STRING);
- }
- else if (itemText.equals(FILLIN_MINUTE_TOPIC))
- {
- fillMinutesItem(item, topic[1].Value, PropertyNames.EMPTY_STRING);
- }
- else if (itemText.equals(FILLIN_MINUTE_RESPONSIBLE))
- {
- fillMinutesItem(item, topic[2].Value, PropertyNames.EMPTY_STRING);
- }
- else if (itemText.equals(FILLIN_MINUTE_TIME))
- {
- int topicTime = 0;
-
- try
- {
- topicTime = (new Integer((String) topic[3].Value)).intValue();
- }
- catch (Exception ex)
- {
- }
- // if the topic has no time, we do not display any time here.
- if (topicTime == 0 || topicStartTime == 0)
- {
- time = (String) topic[3].Value;
- }
- else
- {
- time = getTimeString(String.valueOf(topicStartTime)) + " - ";
- topicStartTime += topicTime * 1000;
- time += getTimeString(String.valueOf(topicStartTime));
- }
- fillMinutesItem(item, time, PropertyNames.EMPTY_STRING);
- }
- }
-
- textSectionHandler.removeTextSectionbyName(SECTION_MINUTES);
-
- // after the last section we do not insert a new one.
- if (i < topicsData.size() - 2)
- {
- textSectionHandler.insertTextSection(SECTION_MINUTES, template, false);
- }
- }
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- }
-
- /**
- * given a text range and a text, fills the given
- * text range with the given text.
- * If the given text is empty, uses a placeholder with the giveb placeholder text.
- * @param range text range to fill
- * @param text the text to fill to the text range object.
- * @param placeholder the placeholder text to use, if the text argument is empty (null or PropertyNames.EMPTY_STRING)
- */
- private void fillMinutesItem(XTextRange range, Object text, String placeholder)
- {
- String paraStyle = (String) Helper.getUnoPropertyValue(range, "ParaStyleName");
- range.setString((String) text);
- Helper.setUnoPropertyValue(range, "ParaStyleName", paraStyle);
- if (text == null || text.equals(PropertyNames.EMPTY_STRING))
- {
- if (placeholder != null && !placeholder.equals(PropertyNames.EMPTY_STRING))
- {
- XTextContent placeHolder = createPlaceHolder(docMSF, placeholder, resources.resPlaceHolderHint);
- try
- {
- range.getStart().getText().insertTextContent(range.getStart(), placeHolder, true);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- }
- }
-
- /**
- * creates a placeholder field with the given text and given hint.
- * @param xmsf service factory
- * @param ph place holder text
- * @param hint hint text
- * @return the place holder field.
- */
- 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);
-
- }
-
- /*
- * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- * =================================
- * The ItemTable class
- * =================================
- * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- */
- public class ItemsTable
- {
-
- Object table;
- Object section;
- /**
- * the items in the table.
- */
- List<AgendaItem> items = new ArrayList<AgendaItem>(6);
-
- public ItemsTable(Object section_, Object table_)
- {
-
- table = table_;
- section = section_;
-
- AgendaItem ai;
- XTextRange item;
- String iText;
-
- /* go through all <*> items in the document
- * and each one if it is in this table.
- * If they are, register them to belong here, notice their order
- * and remove them from the list of all <*> items, so the next
- * search will be faster.
- */
- for (int i = 0; i < _allItems.size(); i++)
- {
- item = _allItems.get(i);
- Object t = Helper.getUnoPropertyValue(item, "TextTable");
- if ((t instanceof Any) && ((Any) t).getObject() == table)
- {
- iText = item.getString().toLowerCase().trim();
- ai = itemsCache.get(item.getString().toLowerCase().trim());
- if (ai != null)
- {
- items.add(ai);
- _allItems.remove(i--);
- itemsMap.put(iText, this);
- }
- }
- }
-
- }
-
- /**
- * link the section to the template. this will restore the original table
- * with all the items.<br/>
- * then break the link, to make the section editable.<br/>
- * then, starting at cell one, write all items that should be visible.
- * then clear the rest and remove obsolete rows.
- * If no items are visible, hide the section.
- * @param dummy we need a param to make this an Implementation of AgendaElement.
- * @throws Exception
- */
- public synchronized void write(Object dummy) throws Exception
- {
- synchronized(this)
- {
- String name = getName(section);
-
- // link and unlink the section to the template.
- textSectionHandler.linkSectiontoTemplate(section, template, name);
- textSectionHandler.breakLinkOfTextSection(section);
-
- // we need to get a new instance after linking.
- table = getTable(name);
- section = getSection(name);
-
- XTextTable xTextTable = UnoRuntime.queryInterface(XTextTable.class, table);
- XTextTableCursor cursor = xTextTable.createCursorByCellName("A1");
- AgendaItem ai;
- // should this section be visible?
- boolean visible = false;
-
- // write items
- // ===========
- String cellName = PropertyNames.EMPTY_STRING;
-
- /* 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
- * two cells to the table: a title (text) and a placeholder.
- * see AgendaItem class below.
- */
- for (int i = 0; i < items.size(); i++)
- {
- ai = items.get(i);
- if (isShowItem(ai.name))
- {
- visible = true;
- ai.table = table;
- ai.write(cursor);
- // I store the cell name which was last written...
- cellName = cursor.getRangeName();
-
- cursor.goRight((short) 1, false);
-
- }
- }
-
- Helper.setUnoPropertyValue(section, "IsVisible", visible ? Boolean.TRUE : Boolean.FALSE);
- if (!visible)
- {
- return;
- /* remove obsolete rows
- * ====================
- * if the cell that was last written is the current cell,
- * it means this is the end of the table, so we end here.
- * (because after getting the cellName above, I call the goRight method.
- * If it did not go right, it means its the last cell.
- */
- }
- if (cellName.equals(cursor.getRangeName()))
- {
- return;
- /*
- * if not, we continue and clear all cells until we are at the end of the row.
- */
- }
- Object cell;
- while ((!cellName.equals(cursor.getRangeName()) && (!cursor.getRangeName().startsWith("A"))))
- {
- cell = xTextTable.getCellByName(cursor.getRangeName());
- UnoRuntime.queryInterface(XTextRange.class, cell).setString(PropertyNames.EMPTY_STRING);
- cellName = cursor.getRangeName();
- cursor.goRight((short) 1, false);
- }
-
- /*
- * again: if we are at the end of the table, end here.
- */
- if (cellName.equals(cursor.getRangeName()))
- {
- return;
- }
- int rowIndex = getRowIndex(cursor);
- int rowsCount = getRowCount(UnoRuntime.queryInterface(XTextTable.class, table));
-
- /* now before deleteing i move the cursor up so it
- * does not disappear, because it will crash office.
- */
- cursor.gotoStart(false);
-
- if (rowsCount >= rowIndex)
- {
- removeTableRows(table, rowIndex - 1, (rowsCount - rowIndex) + 1);
- }
- }
- }
- }
-
- /*
- * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- * =================================
- * The Topics class
- * =================================
- * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- */
- /**
- * 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 -
- * the update is done programttically.<br/>
- * <br/>
- * The decision to make this class a class by its own
- * was done out of logic reasons and not design/functionality reasons,
- * 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.
- */
- public class Topics
- {
-
- /**
- * the topics table
- */
- XTextTable table;
- /**
- * A List of Cell Formatters for the first row.
- */
- List<TableCellFormatter> firstRowFormat = new ArrayList<TableCellFormatter>();
- /**
- * A List of Cell Formatters for the last row.
- * (will contain them in reverse order)
- */
- List<TableCellFormatter> lastRowFormat = new ArrayList<TableCellFormatter>();
- /**
- * the format of the cell of each topic cell.
- */
- List<TableCellFormatter> topicCellFormats = new ArrayList<TableCellFormatter>();
- /**
- * for each topic cell there is
- * a member in this vector
- */
- List<AgendaElement> topicCells = new ArrayList<AgendaElement>();
- int rowsPerTopic;
- /**
- * fields which hold the number of the
- * fillins in the cells vectors.
- */
- int numCell = -1;
- int topicCell = -1;
- int responsibleCell = -1;
- int timeCell = -1;
- /**
- * this is a list which traces which topics were written to the document
- * and which not. When a cell needs to be actualized, it is checked that the
- * whole topic is already present in the document, using this vector.
- * The vector contains nulls for topics which were not written, and
- * empty strings for topics which were written (though any other
- * object would also do - i check only if it is a null or not...);
- */
- List<String> writtenTopics = new ArrayList<String>();
-
- /**
- * Analyze the structure of the Topics table.
- * The structure Must be as follows:<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>
- * -the topic rows must repeat three times. <br>
- * -in the topics rows, placeholders for number, topic, responsible, and duration
- * must be placed.<br>
- * <br>
- * A word about table format: to reconstruct the format of the
- * table we hold to the following formats: first row (header), topic, and last row.
- * We hold the format of the last row, because one might wish to give it
- * a special format, other than the one on the bottom of each topic.
- * The left and right borders of the whole table are, on the other side,
- * part of the topics rows format, and need not be preserved seperateley.
- */
- public Topics()
- {
- Object t;
-
- Map<String, AgendaElement> topicItems = new HashMap<String, AgendaElement>(4);
-
- // This is the topics table. say hallo :-)
- try
- {
- t = getTable(SECTION_TOPICS);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- throw new IllegalArgumentException("Fatal error while loading template: table " + SECTION_TOPICS + " could not load.");
- }
-
- // and this is the XTable.
- table = UnoRuntime.queryInterface(XTextTable.class, t);
-
- /* first I store all <*> ranges
- * which are in the topics table.
- * I store each <*> range in this - the key
- * is the cell it is in. Later when analyzing the topic,
- * cell by cell, I check in this map to know
- * if a cell contains a <*> or not.
- */
- HashMap<Object, XTextRange> items = new HashMap<Object, XTextRange>();
-
- XTextRange item;
- Object cell;
- for (int i = 0; i < _allItems.size(); i++)
- {
- item = _allItems.get(i);
- t = Helper.getUnoPropertyValue(item, "TextTable");
- if ((t instanceof Any) && ((Any) t).getObject() == table)
- {
- cell = Helper.getUnoPropertyValue(item, "Cell");
- items.put(((Any) cell).getObject(), item);
- }
- }
-
- /*
- * 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.
- */
- int rows = getRowCount(table);
-
- rowsPerTopic = (rows - 1) / 3;
-
- String firstCell = "A" + (1 + rowsPerTopic + 1);
- String afterLastCell = "A" + (1 + (rowsPerTopic * 2) + 1);
-
- // go to the first row of the 2. topic
- XTextTableCursor cursor = table.createCursorByCellName(firstCell);
- XTextRange range;
-
- // analyze the structure of the topic rows.
- while (!cursor.getRangeName().equals(afterLastCell))
- {
- cell = table.getCellByName(cursor.getRangeName());
- XTextRange xTextRange = UnoRuntime.queryInterface(XTextRange.class, cell);
- // first I store the content and para style of the cell
- AgendaElement ae = new TextElement(xTextRange);
- // if the cell contains a relevant <...>
- // i add the text element to the hash,
- // so it's text can be updated later.
- range = items.get(cell);
- if (range != null)
- {
- topicItems.put(xTextRange.getString().toLowerCase().trim(), ae);
- }
-
- topicCells.add(ae);
-
- // and store the format of the cell.
- topicCellFormats.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
-
- // goto next cell.
- cursor.goRight((short) 1, false);
- }
-
- /*
- * now - in which cell is every fillin?
- */
- numCell = topicCells.indexOf(topicItems.get(FILLIN_TOPIC_NUMBER));
- topicCell = topicCells.indexOf(topicItems.get(FILLIN_TOPIC_TOPIC));
- responsibleCell = topicCells.indexOf(topicItems.get(FILLIN_TOPIC_RESPONSIBLE));
- timeCell = topicCells.indexOf(topicItems.get(FILLIN_TOPIC_TIME));
-
-
-
- /* now that we know how the topics look like,
- * we get the format of the first and last rows.
- */
-
- // format of first row
- cursor.gotoStart(false);
- do
- {
- firstRowFormat.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
- cursor.goRight((short) 1, false);
- }
- while (!cursor.getRangeName().startsWith("A"));
-
- // format of the last row
- cursor.gotoEnd(false);
- while (!cursor.getRangeName().startsWith("A"))
- {
- lastRowFormat.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
- cursor.goLeft((short) 1, false);
- }
- // we missed the A cell - so we have to add it also..
- lastRowFormat.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
-
- removeTableRows(table, 1 + rowsPerTopic, rows - rowsPerTopic - 1);
-
- }
-
- /**
- * @param topic the topic number to write
- * @param data the data of the topic.
- * @return the number of rows that have been added
- * to the table. 0 or a negative number: no rows added.
- */
- private int write2(int topic, PropertyValue[] data) throws Exception
- {
- while (topic >= writtenTopics.size())
- {
- writtenTopics.add(null);
- }
- writtenTopics.set(topic, PropertyNames.EMPTY_STRING);
-
- // make sure threr are enough rows for me...
- int rows = getRowCount(table);
- int reqRows = 1 + (topic + 1) * rowsPerTopic;
- int firstRow = reqRows - rowsPerTopic + 1;
- int diff = reqRows - rows;
- if (diff > 0)
- {
- insertTableRows(table, rows, diff); // set the item's text...
- }
- setItemText(numCell, data[0].Value);
- setItemText(topicCell, data[1].Value);
- setItemText(responsibleCell, data[2].Value);
- setItemText(timeCell, data[3].Value);
-
- // now write !
- XTextTableCursor cursor = table.createCursorByCellName("A" + firstRow);
-
- for (int i = 0; i < topicCells.size(); i++)
- {
- topicCells.get(i).write(table.getCellByName(cursor.getRangeName()));
- cursor.goRight((short) 1, false);
- }
-
- // now format !
- cursor.gotoCellByName("A" + firstRow, false);
-
- formatTable(cursor, topicCellFormats, false);
-
- return diff;
-
- }
-
- /**
- * 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
- * be able to write this topic).
- */
- private boolean isWritten(int topic)
- {
- return (writtenTopics.size() > topic && writtenTopics.get(topic) != null);
- }
-
- /**
- * rewrites a single cell containing.
- * 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
- * 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
- * @param data the row's data.
- * @throws Exception if something goes wrong (thow nothing should)
- */
- public void writeCell(int topic, int what, PropertyValue[] data) throws Exception
- {
- // if the whole row should be written...
- if (!isWritten(topic))
- {
- write(topic, data);
- // write only the "what" cell.
- }
- else
- {
- // calculate the table row.
- int firstRow = 1 + (topic * rowsPerTopic) + 1;
- // go to the first cell of this topic.
- XTextTableCursor cursor = table.createCursorByCellName("A" + firstRow);
-
- TextElement te = null;
- int cursorMoves = 0;
-
- switch (what)
- {
- case 0:
- te = setItemText(numCell, data[0].Value);
- cursorMoves = numCell;
- break;
- case 1:
- te = setItemText(topicCell, data[1].Value);
- cursorMoves = topicCell;
- break;
- case 2:
- te = setItemText(responsibleCell, data[2].Value);
- cursorMoves = responsibleCell;
- break;
- case 3:
- te = setItemText(timeCell, data[3].Value);
- cursorMoves = timeCell;
- break;
- }
- // move the cursor to the needed cell...
- if ( te != null)
- {
- cursor.goRight((short) cursorMoves, false);
- XCell xc = table.getCellByName(cursor.getRangeName());
- // and write it !
- te.write(xc);
- topicCellFormats.get(cursorMoves).format(xc);
- }
- }
- }
-
- /**
- * 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.
- * @param topic the index of the topic to write.
- * @param data the topic's data. (see TopicsControl
- * for explanation about the topics data model)
- * @throws Exception if something goes wrong (though nothing should).
- */
- public void write(int topic, PropertyValue[] data) throws Exception
- {
- int diff = write2(topic, data);
- /* if the first topic has been written,
- * one needs to reformat the first row.
- */
- if (topic == 0)
- {
- formatFirstRow();
- }
- /*
- * if any rows were added, one needs to format
- * the whole table again.
- */
- if (diff > 0)
- {
- formatLastRow();
- }
- }
-
- /**
- * Writes all the topics to thetopics table.
- * @param topicsData a List containing all Topic's Data.
- */
- public void writeAll(List<PropertyValue[]> topicsData)
- {
- try
- {
- for (int i = 0; i < topicsData.size() - 1; i++)
- {
- write2(i, topicsData.get(i));
- }
- formatLastRow();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- /**
- * removes obsolete rows, reducing the
- * topics table to the given number of topics.
- * Note this method does only reducing - if
- * the number of topics given is greater than the
- * 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
- * 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,
- * and not of the header row.
- * @param topics the number of topics the table should contain.
- * @throws Exception
- */
- public void reduceDocumentTo(int topics) throws Exception
- {
- // we never remove the first topic...
- if (topics <= 0)
- {
- topics = 1;
- }
- XTableRows tableRows = table.getRows();
- int targetNumOfRows = topics * rowsPerTopic + 1;
- formatLastRow();
- while (writtenTopics.size() > topics)
- {
- writtenTopics.remove(topics);
- }
- }
-
- /**
- * reapply the format of the first (header) row.
- */
- private void formatFirstRow()
- {
- XTextTableCursor cursor = table.createCursorByCellName("A1");
- formatTable(cursor, firstRowFormat, false);
- }
-
- /**
- * reaply the format of the last row.
- */
- private void formatLastRow()
- {
- XTextTableCursor cursor = table.createCursorByCellName("A1");
- cursor.gotoEnd(false);
- formatTable(cursor, lastRowFormat, true);
- }
-
- /**
- * returns a text element for the given cell,
- * which will write the given text.
- * @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.
- */
- private TextElement setItemText(int cell, Object value)
- {
- if (cell >= 0)
- {
- TextElement te = ((TextElement) topicCells.get(cell));
- if (te != null)
- {
- te.text = value.toString();
- }
- return te;
- }
- return null;
- }
-
- /**
- * 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
- * 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.
- * @param reverse if true the cursor will move left, formatting in reverse order (used for the last row).
- */
- private void formatTable(XTextTableCursor cursor, List<TableCellFormatter> formats, boolean reverse)
- {
- for (int i = 0; i < formats.size(); i++)
- {
- formats.get(i).format(table.getCellByName(cursor.getRangeName()));
- if (reverse)
- {
- cursor.goLeft((short) 1, false);
- }
- else
- {
- cursor.goRight((short) 1, false);
- }
- }
- }
- }
-
-
- /*
- * =================================
- * Here are some static help methods
- * =================================
- */
- public static String[] getNamesWhichStartWith(String[] allNames, String prefix)
- {
- ArrayList<String> v = new ArrayList<String>();
- for (int i = 0; i < allNames.length; i++)
- {
- if (allNames[i].startsWith(prefix))
- {
- v.add(allNames[i]);
- }
- }
- String[] s = new String[v.size()];
- return v.toArray(s);
- }
-
- /**
- * Convenience method, costs the given object to an XNamed, and returnes its name.
- * @param obj an XNamed object.
- * @return the name of the given object.
- */
- public static String getName(Object obj)
- {
- return UnoRuntime.queryInterface(XNamed.class, obj).getName();
- }
-
- /**
- * convenience method, for removing a number of cells from a table.
- * @param table
- * @param start
- * @param count
- */
- public static void removeTableRows(Object table, int start, int count)
- {
- XTableRows rows = UnoRuntime.queryInterface(XTextTable.class, table).getRows();
- }
-
- /**
- * Convenience method for inserting some cells into a table.
- * @param table
- * @param start
- * @param count
- */
- public static void insertTableRows(Object table, int start, int count)
- {
- XTableRows rows = UnoRuntime.queryInterface(XTextTable.class, table).getRows();
- rows.insertByIndex(start, count);
- }
-
- /**
- * returns the row index for this cursor, assuming
- * the cursor points to a single cell.
- * @param cursor
- * @return the row index in which the cursor is.
- */
- public static int getRowIndex(XTextTableCursor cursor)
- {
- return getRowIndex(cursor.getRangeName());
- }
-
- /**
- * returns the row index for this cell name.
- * @param cellName
- * @return the row index for this cell name.
- */
- public static int getRowIndex(String cellName)
- {
- return Integer.parseInt(cellName.substring(1));
- }
-
- /**
- * returns the rows count of this table, assuming
- * there is no vertical merged cells.
- * @param table
- * @return the rows count of the given table.
- */
- public static int getRowCount(XTextTable table)
- {
- String[] cells = table.getCellNames();
- return getRowIndex(cells[cells.length - 1]);
- }
-}
-
-/*
- * ===========================================================================================
- *
- * End of AgendaTempalte class
- *
- * ===========================================================================================
- *
- */
-/*
- * =================================
- * The AgendaElement interface
- * =================================
- */
-/**
- * Interface that is used for writing content to a Uno Text / TextRange
- */
-interface AgendaElement
-{
-
- void write(Object any) throws Exception;
-}
-
-
-/*
- * =================================
- * The ParaStyled class
- * =================================
- */
-/**
- * Basic implementation of the AgendaElement interface -
- * writes nothing, but applies a ParaStyle to the given XText/XTextRange
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-class ParaStyled implements AgendaElement
-{
-
- 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);
- }
-}
-
-/*
- * =================================
- * The TextElement class
- * =================================
- */
-/**
- * A basic implementation of AgendaElement:
- * writes a String to the given XText/XTextRange, and applies
- * a ParaStyle to it (using the parent class).
- */
-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);
- }
- }
-}
-
-/**
- * A Text element which, if the text to write is empty (null or PropertyNames.EMPTY_STRING)
- * inserts a placeholder instead.
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-class PlaceholderTextElement extends TextElement
-{
-
- String hint;
- String placeHolderText;
- XMultiServiceFactory xmsf;
-
- PlaceholderTextElement(XTextRange textRange, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_)
- {
- super(textRange);
- placeHolderText = placeHolderText_;
- hint = hint_;
- xmsf = xmsf_;
- }
-
- 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 = AgendaTemplate.createPlaceHolder(xmsf, placeHolderText, hint);
- xTextRange.getText().insertTextContent(xTextRange.getStart(), xTextContent, true);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- }
-}
-
-/*
- * =================================
- * The PlaceHolder class
- * =================================
- */
-/**
- * An Agenda element which writes no text, but inserts a placeholder, and formats
- * it using a ParaStyleName.
- *
- */
-class PlaceholderElement extends ParaStyled
-{
-
- String hint;
- String placeHolderText;
- XMultiServiceFactory xmsf;
-
- PlaceholderElement(String paraStyle, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_)
- {
- super(paraStyle);
- placeHolderText = placeHolderText_;
- hint = hint_;
- xmsf = xmsf_;
- }
-
- public void write(Object textRange)
- {
- XTextRange xTextRange = UnoRuntime.queryInterface(XTextRange.class, textRange);
- try
- {
- XTextContent xTextContent = AgendaTemplate.createPlaceHolder(xmsf, placeHolderText, hint);
- xTextRange.getText().insertTextContent(xTextRange.getStart(), xTextContent, true);
- super.write(textRange);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-}
-
-
-/*
- * =================================
- * The AgendaItem class
- * =================================
- */
-/**
- * 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.
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-class AgendaItem implements AgendaElement
-{
-
- TextElement textElement;
- AgendaElement field;
- public Object table;
- String name;
-
- AgendaItem(String name_, TextElement te, AgendaElement f)
- {
- name = name_;
- field = f;
- textElement = te;
- }
-
- public void write(Object tableCursor) throws Exception
- {
- XTextTableCursor xTextTableCursor = UnoRuntime.queryInterface(XTextTableCursor.class, tableCursor);
- XTextTable xTextTable = UnoRuntime.queryInterface(XTextTable.class, table);
-
- String cellname = xTextTableCursor.getRangeName();
- Object cell = xTextTable.getCellByName(cellname);
-
- textElement.write(cell);
-
- xTextTableCursor.goRight((short) 1, false);
-
- //second field is actually always null...
- // this is a preparation for adding placeholders.
- if (field != null)
- {
- field.write(xTextTable.getCellByName(xTextTableCursor.getRangeName()));
- }
- }
-}
-
-/*
- * =================================
- * The TableCellFormatter class
- * =================================
- */
-/**
- * reads/write a table cell format from/to a table cell or a group of cells.
- *
- */
-class TableCellFormatter
-{
-
- static String[] properties = new String[]
- {
- "BackColor",
- "BackTransparent",
- "BorderDistance",
- "BottomBorder",
- "BottomBorderDistance",
- "LeftBorder",
- "LeftBorderDistance",
- "RightBorder",
- "RightBorderDistance",
- "TopBorder",
- "TopBorderDistance"
- };
- private Object[] values = new Object[properties.length];
-
- public TableCellFormatter(Object tableCell)
- {
- for (int i = 0; i < properties.length; i++)
- {
- values[i] = Helper.getUnoPropertyValue(tableCell, properties[i]);
- }
- }
-
- public void format(Object tableCell)
- {
- Helper.setUnoPropertyValues(tableCell, properties, values);
- }
-}
-
-
-
-
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java
deleted file mode 100644
index 755651f..0000000
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * 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.agenda;
-
-import com.sun.star.awt.FontDescriptor;
-import com.sun.star.awt.XButton;
-import com.sun.star.awt.XCheckBox;
-import com.sun.star.awt.XControl;
-import com.sun.star.awt.XDateField;
-import com.sun.star.awt.XFixedText;
-import com.sun.star.awt.XListBox;
-import com.sun.star.awt.XRadioButton;
-import com.sun.star.awt.XTextComponent;
-import com.sun.star.awt.XTimeField;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.wizards.common.Helper;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.ui.UIConsts;
-import com.sun.star.wizards.ui.WizardDialog;
-
-/**
- * This class is generated Automatically....
- * bla bla bla
- */
-public abstract class AgendaWizardDialog extends WizardDialog implements AgendaWizardDialogConst, UIConsts {
- //GUI Components as Class members.
- XFixedText lblTitle1;
- XCheckBox chkMinutes;
- XFixedText lblHelp1;
- XFixedText lblPageDesign;
- XListBox listPageDesign;
- //Image Control
- XControl imgHelp1;
- XControl imgHelp2;
- XControl imgHelp3;
- XControl imgHelp4;
- XControl imgHelp6;
- XFixedText lblTitle2;
- XFixedText lblTime;
- XFixedText lblTitle;
- XFixedText lblLocation;
- XTextComponent cbLocation;
- XTimeField txtTime;
- XTextComponent txtTitle;
- XFixedText lblHelp2;
- XFixedText lblDate;
- XDateField txtDate;
- XFixedText lblTitle3;
- XCheckBox chkMeetingTitle;
- XCheckBox chkRead;
- XCheckBox chkBring;
- XCheckBox chkNotes;
- XFixedText lblHelp3;
- XFixedText lblTitle5;
- XCheckBox chkConvenedBy;
- XCheckBox chkPresiding;
- XCheckBox chkNoteTaker;
- XCheckBox chkTimekeeper;
- XCheckBox chkAttendees;
- XCheckBox chkObservers;
- XCheckBox chkResourcePersons;
- XFixedText lblHelp4;
- XFixedText lblTitle4;
- XFixedText lblTopic;
- XFixedText lblResponsible;
- XFixedText lblDuration;
- //XFixedText lblHelp5;
- XTextComponent txtTemplateName;
- XRadioButton optCreateAgenda;
- XRadioButton optMakeChanges;
- XFixedText lblProceed;
- XFixedText lblTemplateName;
- XFixedText lblTemplatePath;
- XFixedText lblTitle6;
- XTextComponent txtTemplatePath;
- XButton btnTemplatePath;
- XFixedText lblHelp6;
- XFixedText lblHelpPg6;
- XButton btnInsert;
- XButton btnRemove;
- XButton btnUp;
- XButton btnDown;
-
- final private String IMGHELP1_HID = PropertyNames.EMPTY_STRING;
-
-
- //Font Descriptors as Class members.
- FontDescriptor fontDescriptor1 = new FontDescriptor();
- FontDescriptor fontDescriptor2 = new FontDescriptor();
- FontDescriptor fontDescriptor4 = new FontDescriptor();
-
- //Resources Object
- AgendaWizardDialogResources resources;
-
- private String[] PROPS_LIST = new String[] {"Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
- private String[] PROPS_LABEL_B = new String[] {PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
- private String[] PROPS_CHECK = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
- private String[] PROPS_BUTTON = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
- private String[] PROPS_X = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
- private String[] PROPS_TEXTAREA = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
- private String[] PROPS_TEXT = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
- private String[] PROPS_IMAGE = new String[] {PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
-
- private static final Short NO_BORDER = new Short((short)0);
-
- public AgendaWizardDialog(XMultiServiceFactory xmsf) {
- super(xmsf,HID);
- //Load Resources
- resources = new AgendaWizardDialogResources(xmsf);
-
- //set dialog properties...
- Helper.setUnoPropertyValues(xDialogModel,
- new String[] { PropertyNames.PROPERTY_CLOSEABLE,PropertyNames.PROPERTY_HEIGHT,PropertyNames.PROPERTY_MOVEABLE,PropertyNames.PROPERTY_POSITION_X,PropertyNames.PROPERTY_POSITION_Y,PropertyNames.PROPERTY_STEP,PropertyNames.PROPERTY_TABINDEX,PropertyNames.PROPERTY_TITLE,PropertyNames.PROPERTY_WIDTH},
- new Object[] { Boolean.TRUE,210,Boolean.TRUE,200,52,INTEGERS[1],new Short((short)1),resources.resAgendaWizardDialog_title,310}
- );
-
- //Set member- FontDescriptors...
- fontDescriptor1.Weight = 150;
- fontDescriptor1.Underline = com.sun.star.awt.FontUnderline.SINGLE;
- fontDescriptor2.Weight = 100;
- fontDescriptor4.Weight = 150;
- }
-
- //build components
- public void buildStep1() {
- lblTitle1 = insertLabel("lblTitle1",
- PROPS_LABEL_B,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle1_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[1],new Short((short)100),212}
- );
- lblPageDesign = insertLabel("lblPageDesign",
- PROPS_TEXT,
- new Object[] { INTEGERS[8],resources.reslblPageDesign_value,97,32,INTEGERS[1],new Short((short)101),66}
- );
- listPageDesign = insertListBox("listPageDesign", null, null,
- PROPS_LIST,
- new Object[] { Boolean.TRUE,INTEGER_12,LISTPAGEDESIGN_HID,166,30,INTEGERS[1],new Short((short)102),70}
- );
- chkMinutes = insertCheckBox("chkMinutes", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[9],CHKMINUTES_HID,resources.reschkMinutes_value,97,50,new Short((short)0),INTEGERS[1],new Short((short)103),203}
- );
- imgHelp1 = insertImage("imgHelp1",
- PROPS_IMAGE,
- new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID, AgendaWizardDialogConst.INFO_IMAGE_URL, 92,145, Boolean.FALSE, INTEGERS[1], new Short((short)104),INTEGERS[10]}
- );
- lblHelp1 = insertLabel("lblHelp1",
- PROPS_TEXTAREA,
- new Object[] { 39,resources.reslblHelp1_value,Boolean.TRUE,104,145,INTEGERS[1],new Short((short)105),199}
- );
-
- }
-
- public void buildStep2() {
- lblTitle2 = insertLabel("lblTitle2",
- PROPS_LABEL_B,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle2_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[2],new Short((short)200),212}
- );
- lblDate = insertLabel("lblDate",
- PROPS_TEXT,
- new Object[] { INTEGERS[8],resources.reslblDate_value,97,32,INTEGERS[2],new Short((short)201),66}
- );
- txtDate = insertDateField("txtDate", null,
- PROPS_LIST,
- new Object[] { Boolean.TRUE,INTEGER_12,TXTDATE_HID,166,30,INTEGERS[2],new Short((short)202),70}
- );
- lblTime = insertLabel("lblTime",
- PROPS_TEXT,
- new Object[] { INTEGERS[8],resources.reslblTime_value,97,50,INTEGERS[2],new Short((short)203),66}
- );
- txtTime = insertTimeField("txtTime", null,
- new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "StrictFormat", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
- new Object[] { INTEGER_12,TXTTIME_HID,166,48,INTEGERS[2],Boolean.TRUE,new Short((short)204),70}
- );
-
- lblTitle = insertLabel("lblTitle",
- PROPS_TEXT,
- new Object[] { INTEGERS[8],resources.reslblTitle_value,97,68,INTEGERS[2],new Short((short)205),66}
- );
- txtTitle = insertTextField("txtTitle", null,
- new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
- new Object[] { 26,TXTTITLE_HID,Boolean.TRUE,166,66,INTEGERS[2],new Short((short)206),138}
- );
- lblLocation = insertLabel("lblLocation",
- PROPS_TEXT,
- new Object[] { INTEGERS[8],resources.reslblLocation_value,97,100,INTEGERS[2],new Short((short)207),66}
- );
- cbLocation = insertTextField("cbLocation", null,null,
- new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
- new Object[] { 34,CBLOCATION_HID,Boolean.TRUE,166,98,INTEGERS[2],new Short((short)208),138}
- );
-
- imgHelp2 = insertImage("imgHelp2",
- PROPS_IMAGE,
- new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,145,Boolean.FALSE, INTEGERS[2],new Short((short)209),INTEGERS[10]}
- );
- lblHelp2 = insertLabel("lblHelp2",
- PROPS_TEXTAREA,
- new Object[] { 39,resources.reslblHelp2_value,Boolean.TRUE,104,145,INTEGERS[2],new Short((short)210),199}
- );
-
- }
-
- public void buildStep3() {
- lblTitle3 = insertLabel("lblTitle3",
- PROPS_LABEL_B,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle3_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[3],new Short((short)300),212}
- );
- chkMeetingTitle = insertCheckBox("chkMeetingTitle", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKMEETINGTITLE_HID,resources.reschkMeetingTitle_value,97,32,new Short((short)1),INTEGERS[3],new Short((short)301),69}
- );
- chkRead = insertCheckBox("chkRead", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKREAD_HID,resources.reschkRead_value,97,46,new Short((short)0),INTEGERS[3],new Short((short)302),162}
- );
- chkBring = insertCheckBox("chkBring", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKBRING_HID,resources.reschkBring_value,97,60,new Short((short)0),INTEGERS[3],new Short((short)303),162}
- );
- chkNotes = insertCheckBox("chkNotes", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKNOTES_HID,resources.reschkNotes_value,97,74,new Short((short)1),INTEGERS[3],new Short((short)304),160}
- );
- imgHelp3 = insertImage("imgHelp3",
- PROPS_IMAGE,
- new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,145,Boolean.FALSE, INTEGERS[3],new Short((short)305),INTEGERS[10]}
- );
- lblHelp3 = insertLabel("lblHelp3",
- PROPS_TEXTAREA,
- new Object[] { 39,resources.reslblHelp3_value,Boolean.TRUE,104,145,INTEGERS[3],new Short((short)306),199}
- );
- }
-
- public void buildStep4() {
- lblTitle5 = insertLabel("lblTitle5",
- PROPS_LABEL_B,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle5_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[4],new Short((short)400),212}
- );
- chkConvenedBy = insertCheckBox("chkConvenedBy", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKCONVENEDBY_HID,resources.reschkConvenedBy_value,97,32,new Short((short)1),INTEGERS[4],new Short((short)401),150}
- );
- chkPresiding = insertCheckBox("chkPresiding", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKPRESIDING_HID,resources.reschkPresiding_value,97,46,new Short((short)0),INTEGERS[4],new Short((short)402),150}
- );
- chkNoteTaker = insertCheckBox("chkNoteTaker", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKNOTETAKER_HID,resources.reschkNoteTaker_value,97,60,new Short((short)0),INTEGERS[4],new Short((short)403),150}
- );
- chkTimekeeper = insertCheckBox("chkTimekeeper", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKTIMEKEEPER_HID,resources.reschkTimekeeper_value,97,74,new Short((short)0),INTEGERS[4],new Short((short)404),150}
- );
- chkAttendees = insertCheckBox("chkAttendees", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKATTENDEES_HID,resources.reschkAttendees_value,97,88,new Short((short)1),INTEGERS[4],new Short((short)405),150}
- );
- chkObservers = insertCheckBox("chkObservers", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKOBSERVERS_HID,resources.reschkObservers_value,97,102,new Short((short)0),INTEGERS[4],new Short((short)406),150}
- );
- chkResourcePersons = insertCheckBox("chkResourcePersons", null,
- PROPS_CHECK,
- new Object[] { INTEGERS[8],CHKRESOURCEPERSONS_HID,resources.reschkResourcePersons_value,97,116,new Short((short)0),INTEGERS[4],new Short((short)407),150}
- );
- imgHelp4 = insertImage("imgHelp4",
- PROPS_IMAGE,
- new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,145,Boolean.FALSE, INTEGERS[4],new Short((short)408),INTEGERS[10]}
- );
- lblHelp4 = insertLabel("lblHelp4",
- PROPS_TEXTAREA,
- new Object[] { 39,resources.reslblHelp4_value,Boolean.TRUE,104,145,INTEGERS[4],new Short((short)409),199}
- );
- }
-
- public void buildStep5() {
- lblTitle4 = insertLabel("lblTitle4",
- PROPS_LABEL_B,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle4_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[5],new Short((short)500),212}
- );
- lblTopic = insertLabel("lblTopic",
- PROPS_TEXT,
- new Object[] { INTEGERS[8],resources.reslblTopic_value,107,28,INTEGERS[5],new Short((short)71),501}
- );
- lblResponsible = insertLabel("lblResponsible",
- PROPS_TEXT,
- new Object[] { INTEGERS[8],resources.reslblResponsible_value,195,28,INTEGERS[5],new Short((short)72),502}
- );
- lblDuration = insertLabel("lblDuration",
- PROPS_TEXT,
- new Object[] { INTEGERS[8],resources.reslblDuration_value,267,28,INTEGERS[5],new Short((short)73),503}
- );
-
-
-
-
-
- btnInsert = insertButton("btnInsert", BTNINSERT_ACTION_PERFORMED,
- PROPS_BUTTON,
- new Object[] { INTEGER_14,BTNINSERT_HID,resources.resButtonInsert,92,136,INTEGERS[5],new Short((short)580),INTEGER_40}
- );
- btnRemove = insertButton("btnRemove", BTNREMOVE_ACTION_PERFORMED,
- PROPS_BUTTON,
- new Object[] { INTEGER_14,BTNREMOVE_HID,resources.resButtonRemove,134,136,INTEGERS[5],new Short((short)581),INTEGER_40}
- );
- btnUp = insertButton("btnUp", BTNUP_ACTION_PERFORMED,
- PROPS_BUTTON,
- new Object[] { INTEGER_14,BTNUP_HID,resources.resButtonUp,202,136,INTEGERS[5],new Short((short)582),INTEGER_50}
- );
- btnDown = insertButton("btnDown", BTNDOWN_ACTION_PERFORMED,
- PROPS_BUTTON,
- new Object[] { INTEGER_14,BTNDOWN_HID,resources.resButtonDown,254,136,INTEGERS[5],new Short((short)583),INTEGER_50}
- );
-
-
- }
-
- public void buildStep6() {
-
- lblTitle6 = insertLabel("lblTitle6",
- PROPS_LABEL_B,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list