[Libreoffice-commits] .: Branch 'feature/gsoc2011_wizards' - 3 commits - wizards/com
Xisco Fauli
xfauli at kemper.freedesktop.org
Wed Jul 27 07:19:48 PDT 2011
wizards/com/sun/star/wizards/agenda/AgendaTemplate.py | 154 ++++++------------
wizards/com/sun/star/wizards/agenda/TemplateConsts.py | 38 ----
2 files changed, 59 insertions(+), 133 deletions(-)
New commits:
commit 93a6df8dd3a984a814f2bd123a5e27974e9eb5fe
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Jul 27 15:21:49 2011 +0200
I don't think we'll need it
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index 0b0130c..735c95c 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -214,67 +214,67 @@ class AgendaTemplate(TextDocument):
# Headings
AgendaTemplate.itemsCache[FILLIN_MEETING_TYPE] = AgendaItem(
FILLIN_MEETING_TYPE,
- TextElement (self.resources.itemMeetingType, STYLE_MEETING_TYPE),
- PlaceholderElement(STYLE_MEETING_TYPE_TEXT,
+ 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, STYLE_BRING),
- PlaceholderElement (STYLE_BRING_TEXT,
+ 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, STYLE_READ),
- PlaceholderElement (STYLE_READ_TEXT,
+ 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, STYLE_NOTES),
- PlaceholderElement (STYLE_NOTES_TEXT,
+ 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, STYLE_CALLED_BY),
- PlaceholderElement (STYLE_CALLED_BY_TEXT,
+ 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, STYLE_FACILITATOR),
- PlaceholderElement (STYLE_FACILITATOR_TEXT,
+ 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, STYLE_PARTICIPANTS),
- PlaceholderElement(STYLE_PARTICIPANTS_TEXT,
+ 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, STYLE_NOTETAKER),
- PlaceholderElement(STYLE_NOTETAKER_TEXT,
+ 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, STYLE_TIMEKEEPER),
- PlaceholderElement(STYLE_TIMEKEEPER_TEXT,
+ TextElement (self.resources.itemTimekeeper),
+ PlaceholderElement(
self.resources.reschkTimekeeper_value,
self.resources.resPlaceHolderHint, self.xMSF))
AgendaTemplate.itemsCache[FILLIN_OBSERVERS] = AgendaItem(
FILLIN_OBSERVERS,
- TextElement(self.resources.itemObservers, STYLE_OBSERVERS),
- PlaceholderElement(STYLE_OBSERVERS_TEXT,
+ 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, STYLE_RESOURCE_PERSONS),
- PlaceholderElement(STYLE_RESOURCE_PERSONS_TEXT,
+ TextElement(self.resources.itemResource),
+ PlaceholderElement(
self.resources.reschkResourcePersons_value,
self.resources.resPlaceHolderHint, self.xMSF))
@@ -1178,47 +1178,18 @@ class Topics(object):
cursor.goRight(1, False)
'''
-TODO To change the template for this generated type comment go to
-Window - Preferences - Java - Code Style - Code Templates
-'''
-class ParaStyled(object):
-
- def __init__(self, paraStyle_):
- self.paraStyle = paraStyle_
-
- def format(self, textRange):
- if textRange is None:
- textRange = textRange.Text
-
- cursor = textRange.createTextCursorByRange(textRange)
- Helper.setUnoPropertyValue(
- cursor, "ParaStyleName", self.paraStyle)
-
- def write(self, textRange):
- self.format(textRange)
-
-'''
A basic implementation of AgendaElement:
writes a String to the given XText/XTextRange, and applies
a ParaStyle to it (using the parent class).
@author rp143992
'''
-class TextElement(ParaStyled):
+class TextElement(object):
- def __init__(self, text_, paraStyle_=None):
- if paraStyle_ is None:
- self.text = text_.String
- paraStyle_ = Helper.getUnoPropertyValue(
- text_.Start, "ParaStyleName")
- else:
- self.text = text_
-
- super(TextElement,self).__init__(paraStyle_)
+ def __init__(self, text_):
+ self.text = text_
def write(self, textRange):
textRange.String = self.text
- if not self.text == "":
- super(TextElement,self).write(textRange)
'''
A Text element which, if the text to write is empty (null or "")
@@ -1252,10 +1223,9 @@ it using a ParaStyleName.
@author rp143992
'''
-class PlaceholderElement(ParaStyled):
+class PlaceholderElement(object):
- def __init__(self, paraStyle, placeHolderText_, hint_, xmsf_):
- super(PlaceholderElement,self).__init__(paraStyle)
+ def __init__(self, placeHolderText_, hint_, xmsf_):
self.placeHolderText = placeHolderText_
self.hint = hint_
self.xmsf = xmsf_
@@ -1266,7 +1236,6 @@ class PlaceholderElement(ParaStyled):
AgendaTemplate.document, self.placeHolderText, self.hint)
textRange.Text.insertTextContent(
textRange.Start, xTextContent, True)
- super(PlaceholderElement,self).write(textRange)
except Exception, ex:
traceback.print_exc()
@@ -1276,9 +1245,6 @@ 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.
@author rp143992
-
-TODO To change the template for this generated type comment go to
-Window - Preferences - Java - Code Style - Code Templates
'''
class AgendaItem(object):
diff --git a/wizards/com/sun/star/wizards/agenda/TemplateConsts.py b/wizards/com/sun/star/wizards/agenda/TemplateConsts.py
index 364d3d8..3095f31 100644
--- a/wizards/com/sun/star/wizards/agenda/TemplateConsts.py
+++ b/wizards/com/sun/star/wizards/agenda/TemplateConsts.py
@@ -42,45 +42,7 @@ FILLIN_NOTETAKER = "<notetaker>"
FILLIN_TIMEKEEPER = "<timekeeper>"
FILLIN_OBSERVERS = "<observers>"
FILLIN_RESOURCE_PERSONS = "<resource-persons>"
-'''
-Styles (paragraph styles) used for agenda items.
-headings styles
-
-'''
-STYLE_MEETING_TYPE = "MeetingType"
-STYLE_BRING = "Bring"
-STYLE_READ = "Read"
-STYLE_NOTES = "Notes"
-'''
-names styles
-'''
-STYLE_CALLED_BY = "CalledBy"
-STYLE_FACILITATOR = "Facilitator"
-STYLE_PARTICIPANTS = "Attendees"
-STYLE_NOTETAKER = "Notetaker"
-STYLE_TIMEKEEPER = "Timekeeper"
-STYLE_OBSERVERS = "Observers"
-STYLE_RESOURCE_PERSONS = "ResourcePersons"
-'''
-Styles (paragraph styles) used for the <b>text</b> of agenda items
-The agenda wizard creates fill-in fields with the given styles...)
-headings fields styles
-'''
-STYLE_MEETING_TYPE_TEXT = "MeetingTypeText"
-STYLE_BRING_TEXT = "BringText"
-STYLE_READ_TEXT = "ReadText"
-STYLE_NOTES_TEXT = "NotesText"
-'''
-names field styles
-'''
-STYLE_CALLED_BY_TEXT = "CalledByText"
-STYLE_FACILITATOR_TEXT = "FacilitatorText"
-STYLE_PARTICIPANTS_TEXT = "AttendeesText"
-STYLE_NOTETAKER_TEXT = "NotetakerText"
-STYLE_TIMEKEEPER_TEXT = "TimekeeperText"
-STYLE_OBSERVERS_TEXT = "ObserversText"
-STYLE_RESOURCE_PERSONS_TEXT = "ResourcePersonsText"
'''
Fillins for the topic table.
These strings will be searched inside the topic table as
commit 9bcf7e64958db128b641f2fdfc7ef065442bdc79
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Jul 27 14:46:11 2011 +0200
Show AgendaItems properly
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index 517aeb9..0b0130c 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -1296,7 +1296,8 @@ class AgendaItem(object):
#second field is actually always null...
# this is a preparation for adding placeholders.
if self.field is not None:
- self.field.write(cell)
+ self.field.write(Topics.table.getCellByName(
+ tableCursor.RangeName))
'''
reads/write a table cell format from/to a table cell or a group of cells.
commit 5fec6c16968cc10b43d54a37272b74f32c89f966
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Jul 27 14:06:37 2011 +0200
Fix Show/Hide tables
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index 54c482c..517aeb9 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -68,7 +68,6 @@ events fired too often.
'''
class AgendaTemplate(TextDocument):
- DAY_IN_MILLIS = (24 * 60 * 60 * 1000)
writtenTopics = []
itemsCache = None
_allItems = []
@@ -79,7 +78,6 @@ class AgendaTemplate(TextDocument):
template = None
agenda = None
lock = RLock()
- initDictionary = False
'''constructor. The document is *not* loaded here.
only some formal members are set.
@@ -94,9 +92,6 @@ class AgendaTemplate(TextDocument):
AgendaTemplate.agenda = agenda_
self.resources = resources_
- if not AgendaTemplate.initDictionary:
- self.initializeDictionary()
-
if AgendaTemplate.itemsCache is None:
self.initItemsCache()
@@ -175,20 +170,6 @@ class AgendaTemplate(TextDocument):
def setTemplateTitle(self, newTitle):
self.m_xDocProps.Title = newTitle
- def initializeDictionary(self):
- AgendaTemplate.isShowItemDict = \
- {FILLIN_MEETING_TYPE:AgendaTemplate.agenda.cp_ShowMeetingType,
- FILLIN_READ:AgendaTemplate.agenda.cp_ShowRead,
- FILLIN_BRING:AgendaTemplate.agenda.cp_ShowBring,
- FILLIN_NOTES:AgendaTemplate.agenda.cp_ShowNotes,
- FILLIN_FACILITATOR:AgendaTemplate.agenda.cp_ShowFacilitator,
- FILLIN_TIMEKEEPER:AgendaTemplate.agenda.cp_ShowTimekeeper,
- FILLIN_NOTETAKER:AgendaTemplate.agenda.cp_ShowNotetaker,
- FILLIN_PARTICIPANTS:AgendaTemplate.agenda.cp_ShowAttendees,
- FILLIN_CALLED_BY:AgendaTemplate.agenda.cp_ShowCalledBy,
- FILLIN_OBSERVERS:AgendaTemplate.agenda.cp_ShowObservers,
- FILLIN_RESOURCE_PERSONS:AgendaTemplate.agenda.cp_ShowResourcePersons}
-
'''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).
@@ -197,9 +178,29 @@ class AgendaTemplate(TextDocument):
@classmethod
def isShowItem(self, itemName):
- try:
- return AgendaTemplate.isShowItemDict[itemName]
- except KeyError:
+ if itemName == FILLIN_MEETING_TYPE:
+ return AgendaTemplate.agenda.cp_ShowMeetingType
+ elif itemName == FILLIN_READ:
+ return AgendaTemplate.agenda.cp_ShowRead
+ elif itemName == FILLIN_BRING:
+ return AgendaTemplate.agenda.cp_ShowBring
+ elif itemName == FILLIN_NOTES:
+ return AgendaTemplate.agenda.cp_ShowNotes
+ elif itemName == FILLIN_FACILITATOR:
+ return AgendaTemplate.agenda.cp_ShowFacilitator
+ elif itemName == FILLIN_TIMEKEEPER:
+ return AgendaTemplate.agenda.cp_ShowTimekeeper
+ elif itemName == FILLIN_NOTETAKER:
+ return AgendaTemplate.agenda.cp_ShowNotetaker
+ elif itemName == FILLIN_PARTICIPANTS:
+ return AgendaTemplate.agenda.cp_ShowAttendees
+ elif itemName == FILLIN_CALLED_BY:
+ return AgendaTemplate.agenda.cp_ShowCalledBy
+ elif itemName == FILLIN_OBSERVERS:
+ return AgendaTemplate.agenda.cp_ShowObservers
+ elif itemName == FILLIN_RESOURCE_PERSONS:
+ return AgendaTemplate.agenda.cp_ShowResourcePersons
+ else:
raise ValueError("No such item")
'''itemsCache is a Map containing all agenda item. These are object which
@@ -702,10 +703,12 @@ class ItemsTable(object):
'''
the items in the table.
'''
+ items = []
def __init__(self, section_, table_):
Topics.table = table_
self.section = section_
+ self.items = []
'''
go through all <*> items in the document
and each one if it is in this table.
@@ -719,13 +722,14 @@ class ItemsTable(object):
t = Helper.getUnoPropertyValue(workwith, "TextTable")
if t == Topics.table:
iText = workwith.String.lower().lstrip()
- ai = AgendaTemplate.itemsCache.get(iText)
+ ai = AgendaTemplate.itemsCache[iText]
if ai is not None:
- AgendaTemplate.items.append(ai)
+ self.items.append(ai)
del AgendaTemplate._allItems[i]
AgendaTemplate.itemsMap[iText] = self
i -= 1
i += 1
+
'''
link the section to the template. this will restore the original table
with all the items.<br/>
@@ -763,7 +767,7 @@ class ItemsTable(object):
two cells to the table: a title (text) and a placeholder.
see AgendaItem class below.
'''
- for i in AgendaTemplate.items:
+ for i in self.items:
if AgendaTemplate.isShowItem(i.name):
visible = True
i.table = Topics.table
@@ -1179,10 +1183,8 @@ Window - Preferences - Java - Code Style - Code Templates
'''
class ParaStyled(object):
- paraStyle = ""
-
def __init__(self, paraStyle_):
- ParaStyled.paraStyle = paraStyle_
+ self.paraStyle = paraStyle_
def format(self, textRange):
if textRange is None:
@@ -1190,7 +1192,7 @@ class ParaStyled(object):
cursor = textRange.createTextCursorByRange(textRange)
Helper.setUnoPropertyValue(
- cursor, "ParaStyleName", ParaStyled.paraStyle)
+ cursor, "ParaStyleName", self.paraStyle)
def write(self, textRange):
self.format(textRange)
@@ -1215,17 +1217,13 @@ class TextElement(ParaStyled):
def write(self, textRange):
textRange.String = self.text
- #COMMENTED
- #if not self.text == "":
- # super(TextElement,self).write(textRange)
+ if not self.text == "":
+ super(TextElement,self).write(textRange)
'''
A Text element which, if the text to write is empty (null or "")
inserts a placeholder instead.
@author rp143992
-
-TODO To change the template for this generated type comment go to
-Window - Preferences - Java - Code Style - Code Templates
'''
class PlaceholderTextElement(TextElement):
@@ -1238,7 +1236,7 @@ class PlaceholderTextElement(TextElement):
self.xmsf = xmsf_
def write(self, textRange):
- super(PlaceholderTextElement,self).write(textRange)
+ textRange.String = self.text
if self.text is None or self.text == "":
try:
xTextContent = AgendaTemplate.createPlaceHolder(
@@ -1248,7 +1246,6 @@ class PlaceholderTextElement(TextElement):
except Exception, ex:
traceback.print_exc()
-
'''
An Agenda element which writes no text, but inserts a placeholder, and formats
it using a ParaStyleName.
More information about the Libreoffice-commits
mailing list