summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2012-11-07 22:30:33 +0100
committerXisco Fauli <anistenis@gmail.com>2012-11-08 07:42:28 +0100
commita434b93b25c6aa652b925a8aaba1e3e0ec6986a9 (patch)
treef9557e809bbef71609cd223e1519ae68896289c1 /wizards
parent1d615feed25842544a5ab3ae4265dc9c2de6f107 (diff)
pyagenda: better refactor it little by little
Change-Id: I002a8e27139243172deb2868fdf2fca32944be03
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaTemplate.py310
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py2
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py8
-rw-r--r--wizards/com/sun/star/wizards/agenda/TemplateConsts.py144
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialog.py2
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py10
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py7
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.py7
8 files changed, 265 insertions, 225 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index bb85bcc3b484..95ca3daa420e 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -16,11 +16,13 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import uno
-from .TemplateConsts import *
+import traceback
from threading import RLock
-from ..text.TextDocument import *
+from .TemplateConsts import TemplateConsts
+from ..text.TextDocument import TextDocument
from ..common.FileAccess import FileAccess
from ..text.TextSectionHandler import TextSectionHandler
+from ..common.Helper import Helper
from datetime import date as dateTimeObject
@@ -76,7 +78,7 @@ 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.AgendaTemplate.document
+table.AgendaTemplate.xTextDocument
<br/><br/>
A note about threads:<br/>
Many methods here are synchronized, in order to avoid colission made by
@@ -90,7 +92,7 @@ class AgendaTemplate(TextDocument):
_allItems = []
items = []
itemsMap = {}
- document = None
+ templateConsts = None
textSectionHandler = None
template = None
agenda = None
@@ -98,7 +100,7 @@ class AgendaTemplate(TextDocument):
'''constructor. The document is *not* loaded here.
only some formal members are set.
- @param AgendaTemplate.document_ service factory.
+ @param AgendaTemplate.xTextDocument_ service factory.
@param agenda_ the data model (CGAgenda)
@param resources_ resources.
'''
@@ -107,6 +109,7 @@ class AgendaTemplate(TextDocument):
super(AgendaTemplate,self).__init__(xmsf_,listener, None,
"WIZARD_LIVE_PREVIEW")
AgendaTemplate.agenda = agenda_
+ AgendaTemplate.templateConsts = TemplateConsts
self.resources = resources_
if AgendaTemplate.itemsCache is None:
@@ -117,7 +120,7 @@ class AgendaTemplate(TextDocument):
@synchronized(lock)
def load(self, templateURL, topics):
AgendaTemplate.template = self.calcTemplateName(templateURL)
- AgendaTemplate.document = self.loadAsPreview(templateURL, False)
+ AgendaTemplate.xTextDocument = self.loadAsPreview(templateURL, False)
self.xFrame.ComponentWindow.Enable = False
self.xTextDocument.lockControllers()
self.initialize()
@@ -194,27 +197,27 @@ class AgendaTemplate(TextDocument):
@classmethod
def isShowItem(self, itemName):
- if itemName == FILLIN_MEETING_TYPE:
+ if itemName == AgendaTemplate.templateConsts.FILLIN_MEETING_TYPE:
return AgendaTemplate.agenda.cp_ShowMeetingType
- elif itemName == FILLIN_READ:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_READ:
return AgendaTemplate.agenda.cp_ShowRead
- elif itemName == FILLIN_BRING:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_BRING:
return AgendaTemplate.agenda.cp_ShowBring
- elif itemName == FILLIN_NOTES:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_NOTES:
return AgendaTemplate.agenda.cp_ShowNotes
- elif itemName == FILLIN_FACILITATOR:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_FACILITATOR:
return AgendaTemplate.agenda.cp_ShowFacilitator
- elif itemName == FILLIN_TIMEKEEPER:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_TIMEKEEPER:
return AgendaTemplate.agenda.cp_ShowTimekeeper
- elif itemName == FILLIN_NOTETAKER:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_NOTETAKER:
return AgendaTemplate.agenda.cp_ShowNotetaker
- elif itemName == FILLIN_PARTICIPANTS:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_PARTICIPANTS:
return AgendaTemplate.agenda.cp_ShowAttendees
- elif itemName == FILLIN_CALLED_BY:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_CALLED_BY:
return AgendaTemplate.agenda.cp_ShowCalledBy
- elif itemName == FILLIN_OBSERVERS:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_OBSERVERS:
return AgendaTemplate.agenda.cp_ShowObservers
- elif itemName == FILLIN_RESOURCE_PERSONS:
+ elif itemName == AgendaTemplate.templateConsts.FILLIN_RESOURCE_PERSONS:
return AgendaTemplate.agenda.cp_ShowResourcePersons
else:
raise ValueError("No such item")
@@ -228,71 +231,85 @@ class AgendaTemplate(TextDocument):
def initItemsCache(self):
AgendaTemplate.itemsCache = {}
# Headings
- AgendaTemplate.itemsCache[FILLIN_MEETING_TYPE] = AgendaItem(
- FILLIN_MEETING_TYPE,
- TextElement (self.resources.itemMeetingType),
- PlaceholderElement(
- self.resources.reschkMeetingTitle_value,
- self.resources.resPlaceHolderHint, self.xMSF))
- AgendaTemplate.itemsCache[FILLIN_BRING] = AgendaItem(
- FILLIN_BRING, TextElement (self.resources.itemBring),
- PlaceholderElement (
- self.resources.reschkBring_value,
- self.resources.resPlaceHolderHint, self.xMSF))
- AgendaTemplate.itemsCache[FILLIN_READ] = AgendaItem (
- FILLIN_READ, TextElement (self.resources.itemRead),
- PlaceholderElement (
- self.resources.reschkRead_value,
- self.resources.resPlaceHolderHint, self.xMSF))
- AgendaTemplate.itemsCache[FILLIN_NOTES] = AgendaItem (
- FILLIN_NOTES, TextElement (self.resources.itemNote),
- PlaceholderElement (
- self.resources.reschkNotes_value,
- self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_MEETING_TYPE] = \
+ AgendaItem(AgendaTemplate.templateConsts.FILLIN_MEETING_TYPE,
+ TextElement (self.resources.itemMeetingType),
+ PlaceholderElement(
+ self.resources.reschkMeetingTitle_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_BRING] = \
+ AgendaItem(AgendaTemplate.templateConsts.FILLIN_BRING,
+ TextElement (self.resources.itemBring),
+ PlaceholderElement (
+ self.resources.reschkBring_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_READ] = \
+ AgendaItem (AgendaTemplate.templateConsts.FILLIN_READ,
+ TextElement (self.resources.itemRead),
+ PlaceholderElement (
+ self.resources.reschkRead_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_NOTES] = \
+ AgendaItem (AgendaTemplate.templateConsts.FILLIN_NOTES,
+ TextElement (self.resources.itemNote),
+ PlaceholderElement (
+ self.resources.reschkNotes_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
# Names
- AgendaTemplate.itemsCache[FILLIN_CALLED_BY] = AgendaItem(
- FILLIN_CALLED_BY,
- TextElement (self.resources.itemCalledBy),
- PlaceholderElement (
- self.resources.reschkConvenedBy_value,
- self.resources.resPlaceHolderHint, self.xMSF))
- AgendaTemplate.itemsCache[FILLIN_FACILITATOR] = AgendaItem(
- FILLIN_FACILITATOR,
- TextElement (self.resources.itemFacilitator),
- PlaceholderElement (
- self.resources.reschkPresiding_value,
- self.resources.resPlaceHolderHint, self.xMSF))
- AgendaTemplate.itemsCache[FILLIN_PARTICIPANTS] = AgendaItem(
- FILLIN_PARTICIPANTS,
- TextElement (self.resources.itemAttendees),
- PlaceholderElement(
- self.resources.reschkAttendees_value,
- self.resources.resPlaceHolderHint, self.xMSF))
- AgendaTemplate.itemsCache[FILLIN_NOTETAKER] = AgendaItem(
- FILLIN_NOTETAKER,
- TextElement(self.resources.itemNotetaker),
- PlaceholderElement(
- self.resources.reschkNoteTaker_value,
- self.resources.resPlaceHolderHint, self.xMSF))
- AgendaTemplate.itemsCache[FILLIN_TIMEKEEPER] = AgendaItem(
- FILLIN_TIMEKEEPER,
- TextElement (self.resources.itemTimekeeper),
- PlaceholderElement(
- self.resources.reschkTimekeeper_value,
- self.resources.resPlaceHolderHint, self.xMSF))
- AgendaTemplate.itemsCache[FILLIN_OBSERVERS] = AgendaItem(
- FILLIN_OBSERVERS,
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_CALLED_BY] = \
+ AgendaItem(AgendaTemplate.templateConsts.FILLIN_CALLED_BY,
+ TextElement (self.resources.itemCalledBy),
+ PlaceholderElement (
+ self.resources.reschkConvenedBy_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_FACILITATOR] = \
+ AgendaItem(AgendaTemplate.templateConsts.FILLIN_FACILITATOR,
+ TextElement (self.resources.itemFacilitator),
+ PlaceholderElement (
+ self.resources.reschkPresiding_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_PARTICIPANTS] = \
+ AgendaItem(AgendaTemplate.templateConsts.FILLIN_PARTICIPANTS,
+ TextElement (self.resources.itemAttendees),
+ PlaceholderElement(
+ self.resources.reschkAttendees_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_NOTETAKER] = \
+ AgendaItem(AgendaTemplate.templateConsts.FILLIN_NOTETAKER,
+ TextElement(self.resources.itemNotetaker),
+ PlaceholderElement(
+ self.resources.reschkNoteTaker_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_TIMEKEEPER] = \
+ AgendaItem(AgendaTemplate.templateConsts.FILLIN_TIMEKEEPER,
+ TextElement (self.resources.itemTimekeeper),
+ PlaceholderElement(
+ self.resources.reschkTimekeeper_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_OBSERVERS] = \
+ AgendaItem(AgendaTemplate.templateConsts.FILLIN_OBSERVERS,
TextElement(self.resources.itemObservers),
- PlaceholderElement(
- self.resources.reschkObservers_value,
- self.resources.resPlaceHolderHint, self.xMSF))
- AgendaTemplate.itemsCache[FILLIN_RESOURCE_PERSONS] = AgendaItem(
- FILLIN_RESOURCE_PERSONS,
- TextElement(self.resources.itemResource),
- PlaceholderElement(
- self.resources.reschkResourcePersons_value,
- self.resources.resPlaceHolderHint, self.xMSF))
+ PlaceholderElement(
+ self.resources.reschkObservers_value,
+ self.resources.resPlaceHolderHint, self.xMSF))
+ AgendaTemplate.itemsCache[
+ AgendaTemplate.templateConsts.FILLIN_RESOURCE_PERSONS] = \
+ AgendaItem(AgendaTemplate.templateConsts.FILLIN_RESOURCE_PERSONS,
+ TextElement(self.resources.itemResource),
+ PlaceholderElement(
+ self.resources.reschkResourcePersons_value,
+ AgendaTemplate.templateConsts.resPlaceHolderHint, self.xMSF))
'''Initializes a template.<br/>
This method does the following tasks:<br/>
@@ -312,22 +329,24 @@ class AgendaTemplate(TextDocument):
and create the date and time formatters.
'''
AgendaTemplate.dateUtils = Helper.DateUtils(
- self.xMSF, AgendaTemplate.document)
+ self.xMSF, AgendaTemplate.xTextDocument)
AgendaTemplate.formatter = AgendaTemplate.dateUtils.formatter
- AgendaTemplate.dateFormat = AgendaTemplate.dateUtils.getFormat(DATE_SYSTEM_LONG)
- AgendaTemplate.timeFormat = AgendaTemplate.dateUtils.getFormat(TIME_HHMM)
+ AgendaTemplate.dateFormat = \
+ AgendaTemplate.dateUtils.getFormat(DATE_SYSTEM_LONG)
+ AgendaTemplate.timeFormat = \
+ AgendaTemplate.dateUtils.getFormat(TIME_HHMM)
'''
get the document properties object.
'''
- self.m_xDocProps = AgendaTemplate.document.DocumentProperties
+ self.m_xDocProps = AgendaTemplate.xTextDocument.DocumentProperties
self.initItemsCache()
- AgendaTemplate._allItems = self.searchFillInItems()
+ AgendaTemplate._allItems = self.searchFillInItems(0)
self.initializeTitles()
self.initializeItemsSections()
AgendaTemplate.textSectionHandler = TextSectionHandler(
- AgendaTemplate.document, AgendaTemplate.document)
+ AgendaTemplate.xTextDocument, AgendaTemplate.xTextDocument)
self.topics = Topics()
del AgendaTemplate._allItems[:]
AgendaTemplate._allItems = None
@@ -338,43 +357,36 @@ class AgendaTemplate(TextDocument):
'''
def initializeTitles(self):
- i = 0
- while i < len(AgendaTemplate._allItems):
- workwith = AgendaTemplate._allItems[i]
- text = workwith.String.lstrip().lower()
- if text == FILLIN_TITLE:
+ auxList = []
+ for i in AgendaTemplate._allItems:
+ text = i.String.lstrip().lower()
+ if text == AgendaTemplate.templateConsts.FILLIN_TITLE:
AgendaTemplate.teTitle = PlaceholderTextElement(
- workwith, self.resources.resPlaceHolderTitle,
+ i, self.resources.resPlaceHolderTitle,
self.resources.resPlaceHolderHint,
- AgendaTemplate.document)
- AgendaTemplate.trTitle = workwith
- del AgendaTemplate._allItems[i]
- i -= 1
- elif text == FILLIN_DATE:
+ AgendaTemplate.xTextDocument)
+ AgendaTemplate.trTitle = i
+ elif text == AgendaTemplate.templateConsts.FILLIN_DATE:
AgendaTemplate.teDate = PlaceholderTextElement(
- workwith, self.resources.resPlaceHolderDate,
+ i, self.resources.resPlaceHolderDate,
self.resources.resPlaceHolderHint,
- AgendaTemplate.document)
- AgendaTemplate.trDate = workwith
- del AgendaTemplate._allItems[i]
- i -= 1
- elif text == FILLIN_TIME:
+ AgendaTemplate.xTextDocument)
+ AgendaTemplate.trDate = i
+ elif text == AgendaTemplate.templateConsts.FILLIN_TIME:
AgendaTemplate.teTime = PlaceholderTextElement(
- workwith, self.resources.resPlaceHolderTime,
+ i, self.resources.resPlaceHolderTime,
self.resources.resPlaceHolderHint,
- AgendaTemplate.document)
- AgendaTemplate.trTime = workwith
- del AgendaTemplate._allItems[i]
- i -= 1
- elif text == FILLIN_LOCATION:
+ AgendaTemplate.xTextDocument)
+ AgendaTemplate.trTime = i
+ elif text == AgendaTemplate.templateConsts.FILLIN_LOCATION:
AgendaTemplate.teLocation = PlaceholderTextElement(
- workwith, self.resources.resPlaceHolderLocation,
+ i, self.resources.resPlaceHolderLocation,
self.resources.resPlaceHolderHint,
- AgendaTemplate.document)
- AgendaTemplate.trLocation = workwith
- del AgendaTemplate._allItems[i]
- i -= 1
- i += 1
+ AgendaTemplate.xTextDocument)
+ AgendaTemplate.trLocation = i
+ else:
+ auxList.append(i)
+ AgendaTemplate._allItems = auxList
'''
analyze the item sections in the template.
@@ -382,7 +394,8 @@ class AgendaTemplate(TextDocument):
'''
def initializeItemsSections(self):
- sections = self.getSections(AgendaTemplate.document, SECTION_ITEMS)
+ sections = self.getSections(
+ AgendaTemplate.xTextDocument, AgendaTemplate.templateConsts.SECTION_ITEMS)
# for each section - there is a table...
self.itemsTables = []
for i in sections:
@@ -402,11 +415,11 @@ class AgendaTemplate(TextDocument):
@classmethod
def getSection(self, name):
- return getattr(AgendaTemplate.document.TextSections, name)
+ return getattr(AgendaTemplate.xTextDocument.TextSections, name)
@classmethod
def getTable(self, name):
- return getattr(AgendaTemplate.document.TextTables, name)
+ return getattr(AgendaTemplate.xTextDocument.TextTables, name)
@classmethod
@synchronized(lock)
@@ -460,7 +473,8 @@ class AgendaTemplate(TextDocument):
time = int(s)
t = ((time / float(1000000)) / float(24)) \
+ ((time % 1000000) / float(1000000)) / float(35)
- return self.formatter.convertNumberToString(AgendaTemplate.timeFormat, t)
+ return self.formatter.convertNumberToString(
+ AgendaTemplate.timeFormat, t)
@synchronized(lock)
def finish(self, topics):
@@ -471,11 +485,12 @@ class AgendaTemplate(TextDocument):
'''
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.
+ When finishing the wizard removes this sections
+ entirely from the document.
'''
def deleteHiddenSections(self):
- allSections = AgendaTemplate.document.TextSections.ElementNames
+ allSections = AgendaTemplate.xTextDocument.TextSections.ElementNames
try:
for i in allSections:
self.section = self.getSection(i)
@@ -503,7 +518,8 @@ class AgendaTemplate(TextDocument):
if not AgendaTemplate.agenda.cp_IncludeMinutes \
or len(topicsData) <= 1:
try:
- minutesAllSection = self.getSection(SECTION_MINUTES_ALL)
+ minutesAllSection = self.getSection(
+ AgendaTemplate.templateConsts.SECTION_MINUTES_ALL)
minutesAllSection.Anchor.String = ""
except Exception, ex:
traceback.print_exc()
@@ -517,19 +533,23 @@ class AgendaTemplate(TextDocument):
itemIndex = 0
for item in self.items:
itemText = item.String.lstrip().lower()
- if itemText == FILLIN_MINUTES_TITLE:
+ if itemText == \
+ AgendaTemplate.templateConsts.FILLIN_MINUTES_TITLE:
self.fillMinutesItem(
item, AgendaTemplate.agenda.cp_Title,
self.resources.resPlaceHolderTitle)
- elif itemText == FILLIN_MINUTES_LOCATION:
+ elif itemText == \
+ AgendaTemplate.templateConsts.FILLIN_MINUTES_LOCATION:
self.fillMinutesItem(
item, AgendaTemplate.agenda.cp_Location,
self.resources.resPlaceHolderLocation)
- elif itemText == FILLIN_MINUTES_DATE:
+ elif itemText == \
+ AgendaTemplate.templateConsts.FILLIN_MINUTES_DATE:
self.fillMinutesItem(
item, getDateString(AgendaTemplate.agenda.cp_Date),
self.resources.resPlaceHolderDate)
- elif itemText == FILLIN_MINUTES_TIME:
+ elif itemText == \
+ AgendaTemplate.templateConsts.FILLIN_MINUTES_TIME:
self.fillMinutesItem(
item, getTimeString(AgendaTemplate.agenda.cp_Time),
self.resources.resPlaceHolderTime)
@@ -548,13 +568,17 @@ class AgendaTemplate(TextDocument):
itemIndex = 0
for item in self.items:
itemText = item.String.lstrip().lower()
- if itemText == FILLIN_MINUTE_NUM:
+ if itemText == \
+ AgendaTemplate.templateConsts.FILLIN_MINUTE_NUM:
fillMinutesItem(item, topic[0].Value, "")
- elif itemText == FILLIN_MINUTE_TOPIC:
+ elif itemText == \
+ AgendaTemplate.templateConsts.FILLIN_MINUTE_TOPIC:
fillMinutesItem(item, topic[1].Value, "")
- elif itemText == FILLIN_MINUTE_RESPONSIBLE:
+ elif itemText == \
+ AgendaTemplate.templateConsts.FILLIN_MINUTE_RESPONSIBLE:
fillMinutesItem(item, topic[2].Value, "")
- elif itemText == FILLIN_MINUTE_TIME:
+ elif itemText == \
+ AgendaTemplate.templateConsts.FILLIN_MINUTE_TIME:
topicTime = 0
try:
topicTime = topic[3].Value
@@ -575,11 +599,12 @@ class AgendaTemplate(TextDocument):
fillMinutesItem(item, time, "")
AgendaTemplate.textSectionHandler.removeTextSectionbyName(
- SECTION_MINUTES)
+ AgendaTemplate.templateConsts.SECTION_MINUTES)
# after the last section we do not insert a one.
if i < len(topicsData) - 2:
AgendaTemplate.textSectionHandler.insertTextSection(
- SECTION_MINUTES, AgendaTemplate.template, False)
+ AgendaTemplate.templateConsts.SECTION_MINUTES,
+ AgendaTemplate.template, False)
except Exception, ex:
traceback.print_exc()
@@ -601,7 +626,7 @@ class AgendaTemplate(TextDocument):
if text == None or text == "":
if placeholder != None and not placeholder == "":
placeHolder = createPlaceHolder(
- AgendaTemplate.document, placeholder,
+ AgendaTemplate.xTextDocument, placeholder,
self.resources.resPlaceHolderHint)
try:
Range.Start.Text.insertTextContent(
@@ -610,7 +635,7 @@ class AgendaTemplate(TextDocument):
traceback.print_exc()
'''creates a placeholder field with the given text and given hint.
- @param AgendaTemplate.document service factory
+ @param AgendaTemplate.xTextDocument service factory
@param ph place holder text
@param hint hint text
@return the place holder field.
@@ -838,12 +863,13 @@ class Topics(object):
self.firstRowFormat = []
# This is the topics table. say hallo :-)
try:
- Topics.table = AgendaTemplate.getTable(SECTION_TOPICS)
+ Topics.table = AgendaTemplate.getTable(
+ AgendaTemplate.templateConsts.SECTION_TOPICS)
except Exception, ex:
traceback.print_exc()
raise AttributeError (
"Fatal error while loading template: table " + \
- SECTION_TOPICS + " could not load.")
+ AgendaTemplate.templateConsts.SECTION_TOPICS + " could not load.")
'''
first I store all <*> ranges
@@ -895,13 +921,17 @@ class Topics(object):
'''
Topics.numCell = Topics.topicCells.index(
- self.topicItems[FILLIN_TOPIC_NUMBER])
+ self.topicItems[
+ AgendaTemplate.templateConsts.FILLIN_TOPIC_NUMBER])
Topics.topicCell = Topics.topicCells.index(
- self.topicItems[FILLIN_TOPIC_TOPIC])
+ self.topicItems[
+ AgendaTemplate.templateConsts.FILLIN_TOPIC_TOPIC])
Topics.responsibleCell = Topics.topicCells.index(
- self.topicItems[FILLIN_TOPIC_RESPONSIBLE])
+ self.topicItems[
+ AgendaTemplate.templateConsts.FILLIN_TOPIC_RESPONSIBLE])
Topics.timeCell = Topics.topicCells.index(
- self.topicItems[FILLIN_TOPIC_TIME])
+ self.topicItems[
+ AgendaTemplate.templateConsts.FILLIN_TOPIC_TIME])
'''@param topic the topic number to write
@param data the data of the topic.
@@ -1159,7 +1189,7 @@ class PlaceholderElement(object):
def write(self, textRange):
try:
xTextContent = AgendaTemplate.createPlaceHolder(
- AgendaTemplate.document, self.placeHolderText, self.hint)
+ AgendaTemplate.xTextDocument, self.placeHolderText, self.hint)
textRange.Text.insertTextContent(
textRange.Start, xTextContent, True)
except Exception, ex:
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
index e1e07655e7f5..d729f07e79c8 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
@@ -57,7 +57,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
"uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
xLocMSF = Desktop.connect(ConnectStr)
lw = AgendaWizardDialogImpl(xLocMSF)
- lw.startWizard()
+ lw.startWizard(xLocMSF)
except Exception as e:
print ("Wizard failure exception " + str(type(e)) +
" message " + str(e) + " args " + str(e.args) +
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
index 8ddc3abb2bd3..67056fb5a5ef 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
@@ -18,9 +18,14 @@
from wizards.common.Resource import Resource
class AgendaWizardDialogResources(Resource):
+
MODULE_NAME = "dbw"
RID_AGENDAWIZARDDIALOG_START = 5000
RID_COMMON_START = 500
+ SECTION_ITEMS = "AGENDA_ITEMS"
+ SECTION_TOPICS = "AGENDA_TOPICS"
+ SECTION_MINUTES_ALL = "MINUTES_ALL"
+ SECTION_MINUTES = "MINUTES"
def __init__(self, xmsf):
super(AgendaWizardDialogResources,self).__init__(xmsf,
@@ -164,7 +169,8 @@ class AgendaWizardDialogResources(Resource):
self.resButtonUp = self.getResText(
AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 70)
self.resButtonDown = self.getResText(
- AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 71)
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 71)
+ #Common Resources
self.resOverwriteWarning = self.getResText(
AgendaWizardDialogResources.RID_COMMON_START + 19)
diff --git a/wizards/com/sun/star/wizards/agenda/TemplateConsts.py b/wizards/com/sun/star/wizards/agenda/TemplateConsts.py
index 1736fce642d7..8d9f6697708d 100644
--- a/wizards/com/sun/star/wizards/agenda/TemplateConsts.py
+++ b/wizards/com/sun/star/wizards/agenda/TemplateConsts.py
@@ -15,76 +15,78 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
-FILLIN_TITLE = "<title>"
-FILLIN_TITLE = "<title>"
-FILLIN_DATE = "<date>"
-FILLIN_TIME = "<time>"
-FILLIN_LOCATION = "<location>"
-'''
-section name <b>prefix</b> for sections that contain items.
-this is also used as table name prefix, since each items section
-must contain a table whos name is identical name to the section's name.
-'''
-SECTION_ITEMS = "AGENDA_ITEMS"
-'''
-the name of the section which contains the topics.
-'''
-SECTION_TOPICS = "AGENDA_TOPICS"
-'''
-the name of the parent minutes section.
-'''
-SECTION_MINUTES_ALL = "MINUTES_ALL"
-'''
-the name of the child nimutes section.
-This section will be duplicated for each topic.
-'''
-SECTION_MINUTES = "MINUTES"
-'''
-taged headings and names.
-These will be searched in item tables (in the template) and will be
-replaced with resource strings.
-headings...
-'''
-FILLIN_MEETING_TYPE = "<meeting-type>"
-FILLIN_BRING = "<bring>"
-FILLIN_READ = "<read>"
-FILLIN_NOTES = "<notes>"
-'''
-names...
-'''
-FILLIN_CALLED_BY = "<called-by>"
-FILLIN_FACILITATOR = "<facilitator>"
-FILLIN_PARTICIPANTS = "<attendees>"
-FILLIN_NOTETAKER = "<notetaker>"
-FILLIN_TIMEKEEPER = "<timekeeper>"
-FILLIN_OBSERVERS = "<observers>"
-FILLIN_RESOURCE_PERSONS = "<resource-persons>"
+class TemplateConsts:
+ FILLIN_TITLE = "<title>"
+ FILLIN_TITLE = "<title>"
+ FILLIN_DATE = "<date>"
+ FILLIN_TIME = "<time>"
+ FILLIN_LOCATION = "<location>"
+ '''
+ section name <b>prefix</b> for sections that contain items.
+ this is also used as table name prefix, since each items section
+ must contain a table whos name is identical name to the section's name.
+ '''
+ SECTION_ITEMS = "AGENDA_ITEMS"
+ '''
+ the name of the section which contains the topics.
+ '''
+ SECTION_TOPICS = "AGENDA_TOPICS"
+ '''
+ the name of the parent minutes section.
+ '''
+ SECTION_MINUTES_ALL = "MINUTES_ALL"
+ '''
+ the name of the child nimutes section.
+ This section will be duplicated for each topic.
+ '''
+ SECTION_MINUTES = "MINUTES"
+ '''
+ taged headings and names.
+ These will be searched in item tables (in the template) and will be
+ replaced with resource strings.
-'''
-Fillins for the topic table.
-These strings will be searched inside the topic table as
-part of detecting its structure.
-'''
-FILLIN_TOPIC_NUMBER = "<num>"
-FILLIN_TOPIC_TOPIC = "<topic>"
-FILLIN_TOPIC_RESPONSIBLE = "<responsible>"
-FILLIN_TOPIC_TIME = "<topic-time>"
-'''
-fillins for minutes.
-These will be searched in the minutes section and will be replaced
-with the appropriate data.
-'''
-FILLIN_MINUTES_TITLE = "<minutes-title>"
-FILLIN_MINUTES_LOCATION = "<minutes-location>"
-FILLIN_MINUTES_DATE = "<minutes-date>"
-FILLIN_MINUTES_TIME = "<minutes-time>"
-'''
-Minutes-topic fillins
-These will be searched in the minutes-child-section, and
-will be replaced with topic data.
-'''
-FILLIN_MINUTE_NUM = "<mnum>"
-FILLIN_MINUTE_TOPIC = "<mtopic>"
-FILLIN_MINUTE_RESPONSIBLE = "<mresponsible>"
-FILLIN_MINUTE_TIME = "<mtime>"
+ headings...
+ '''
+ FILLIN_MEETING_TYPE = "<meeting-type>"
+ FILLIN_BRING = "<bring>"
+ FILLIN_READ = "<read>"
+ FILLIN_NOTES = "<notes>"
+ '''
+ names...
+ '''
+ FILLIN_CALLED_BY = "<called-by>"
+ FILLIN_FACILITATOR = "<facilitator>"
+ FILLIN_PARTICIPANTS = "<attendees>"
+ FILLIN_NOTETAKER = "<notetaker>"
+ FILLIN_TIMEKEEPER = "<timekeeper>"
+ FILLIN_OBSERVERS = "<observers>"
+ FILLIN_RESOURCE_PERSONS = "<resource-persons>"
+
+ '''
+ Fillins for the topic table.
+ These strings will be searched inside the topic table as
+ part of detecting its structure.
+ '''
+ FILLIN_TOPIC_NUMBER = "<num>"
+ FILLIN_TOPIC_TOPIC = "<topic>"
+ FILLIN_TOPIC_RESPONSIBLE = "<responsible>"
+ FILLIN_TOPIC_TIME = "<topic-time>"
+ '''
+ fillins for minutes.
+ These will be searched in the minutes section and will be replaced
+ with the appropriate data.
+ '''
+ FILLIN_MINUTES_TITLE = "<minutes-title>"
+ FILLIN_MINUTES_LOCATION = "<minutes-location>"
+ FILLIN_MINUTES_DATE = "<minutes-date>"
+ FILLIN_MINUTES_TIME = "<minutes-time>"
+ '''
+ Minutes-topic fillins
+ These will be searched in the minutes-child-section, and
+ will be replaced with topic data.
+ '''
+ FILLIN_MINUTE_NUM = "<mnum>"
+ FILLIN_MINUTE_TOPIC = "<mtopic>"
+ FILLIN_MINUTE_RESPONSIBLE = "<mresponsible>"
+ FILLIN_MINUTE_TIME = "<mtime>"
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
index 729d33c4b162..9f033d784557 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
@@ -16,7 +16,7 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
from .FaxWizardDialogResources import FaxWizardDialogResources
-from .FaxWizardDialogConst import FaxWizardDialogConst, HIDMAIN
+from .FaxWizardDialogConst import FaxWizardDialogConst, HIDMAIN, HID
from ..ui.WizardDialog import WizardDialog, uno, Helper, UIConsts, \
PropertyNames
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index 70993e17c216..0bae71ab56cc 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -16,10 +16,9 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import traceback
-from .FaxWizardDialog import FaxWizardDialog, Helper, PropertyNames, uno
+from .FaxWizardDialog import FaxWizardDialog, Helper, PropertyNames, uno, HID
from .CGFaxWizard import CGFaxWizard
from .FaxDocument import FaxDocument
-from .FaxWizardDialogConst import HID
from ..ui.PathSelection import PathSelection
from ..ui.event.UnoDataAware import UnoDataAware
from ..ui.event.RadioDataAware import RadioDataAware
@@ -234,10 +233,9 @@ class FaxWizardDialogImpl(FaxWizardDialog):
'''Localise the template'''
constRangeList = TextDocument.searchFillInItems(1)
- for i in xrange(constRangeList.Count):
- item = constRangeList.getByIndex(i)
- text = item.String.lower()
- aux = TextElement(item, self.resources.dictConstants[text],
+ for i in constRangeList:
+ text = i.String.lower()
+ aux = TextElement(i, self.resources.dictConstants[text],
"hint", self.xMSF)
aux.write()
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index bfdd6671ba4f..18fefbe24230 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -989,10 +989,9 @@ class LetterWizardDialogImpl(LetterWizardDialog):
'''Localise the template'''
constRangeList = TextDocument.searchFillInItems(1)
- for i in xrange(constRangeList.Count):
- item = constRangeList.getByIndex(i)
- text = item.String.lower()
- aux = TextElement(item, self.resources.dictConstants[text],
+ for i in constRangeList:
+ text = i.String.lower()
+ aux = TextElement(i, self.resources.dictConstants[text],
"hint", self.xMSF)
aux.write()
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py
index 0198d6d13735..5889f2c76e94 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -250,4 +250,9 @@ class TextDocument(object):
sd.setPropertyValue("SearchRegularExpression", True)
sd.setPropertyValue("SearchWords", True)
- return self.xTextDocument.findAll(sd)
+ auxList = []
+ allItems = self.xTextDocument.findAll(sd)
+ for i in xrange(allItems.Count):
+ auxList.append(allItems.getByIndex(i))
+
+ return auxList