[Libreoffice-commits] core.git: 3 commits - wizards/com
Xisco Fauli
anistenis at gmail.com
Sun Feb 10 13:21:23 PST 2013
wizards/com/sun/star/wizards/agenda/AgendaDocument.py | 93 +++++++-----------
1 file changed, 38 insertions(+), 55 deletions(-)
New commits:
commit efa0451d8eab878812e2bbacc4319d7490d0f333
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sun Feb 10 22:14:45 2013 +0100
pyagenda: remove placeholder when text is not empty
Change-Id: I06ae1815ec1bd904e944929f1b50a0ee95a6a5ae
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
index c993d62..07b3f35 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
@@ -662,7 +662,6 @@ class ItemsTable(object):
# should this section be visible?
visible = False
# write items
- # ===========
cellName = ""
'''
now go through all items that belong to this
@@ -689,8 +688,6 @@ class ItemsTable(object):
if not 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,
@@ -889,6 +886,7 @@ class PlaceholderTextElement(TextElement):
self.text = placeHolderText_
self.hint = hint_
self.xmsf = xmsf_
+ self.xTextContentList = []
def write(self, textRange):
textRange.String = self.placeHolderText
@@ -896,11 +894,16 @@ class PlaceholderTextElement(TextElement):
try:
xTextContent = AgendaDocument.createPlaceHolder(
self.xmsf, self.text, self.hint)
+ self.xTextContentList.append(xTextContent)
textRange.Text.insertTextContent(
textRange.Start, xTextContent, True)
except Exception:
traceback.print_exc()
-
+ else:
+ if self.xTextContentList:
+ for i in self.xTextContentList:
+ textRange.Text.removeTextContent(i)
+ self.xTextContentList = []
'''
An Agenda element which writes no text, but inserts a placeholder, and formats
it using a ParaStyleName.
commit 2f7bd777d9724ff3b6c7697bf7c02d32eb661214
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sun Feb 10 21:15:19 2013 +0100
pyagenda: This shouldn't be commented
Change-Id: I95dde2a3673f3304969329623af7f615b7388654
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
index eb57f97..c993d62 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
@@ -872,9 +872,9 @@ class Topics(object):
tableRows = Topics.table.Rows
targetNumOfRows = topics * Topics.rowsPerTopic + 1
- '''if tableRows.Count > targetNumOfRows:
+ if tableRows.Count > targetNumOfRows:
tableRows.removeByIndex(
- targetNumOfRows, tableRows.Count - targetNumOfRows)'''
+ targetNumOfRows, tableRows.Count - targetNumOfRows)
'''
A Text element which, if the text to write is empty (null or "")
commit b4743abd03fb584cfc05361dff1b93eae4cf9867
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sun Feb 10 18:26:04 2013 +0100
pyagenda: use local variables
Change-Id: I9fe8eae42c942823df3d200ebb0a0ae1c478d29a
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
index 25ecf04..eb57f97 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
@@ -280,13 +280,10 @@ class AgendaDocument(TextDocument):
Get the default locale of the document,
and create the date and time formatters.
'''
- AgendaDocument.dateUtils = self.DateUtils(
- self.xMSF, self.xTextDocument)
- AgendaDocument.formatter = AgendaDocument.dateUtils.formatter
- AgendaDocument.dateFormat = \
- AgendaDocument.dateUtils.getFormat(DATE_SYSTEM_LONG)
- AgendaDocument.timeFormat = \
- AgendaDocument.dateUtils.getFormat(TIME_HHMM)
+ self.dateUtils = self.DateUtils(self.xMSF, self.xTextDocument)
+ self.formatter = self.dateUtils.formatter
+ self.dateFormat = self.dateUtils.getFormat(DATE_SYSTEM_LONG)
+ self.timeFormat = self.dateUtils.getFormat(TIME_HHMM)
self.initItemsCache()
self.allItems = self.searchFillInItems(0)
@@ -306,29 +303,25 @@ class AgendaDocument(TextDocument):
for i in self.allItems:
text = i.String.lstrip().lower()
if text == self.templateConsts.FILLIN_TITLE:
- AgendaDocument.teTitle = PlaceholderTextElement(
+ self.teTitle = PlaceholderTextElement(
i, self.resources.resPlaceHolderTitle,
- self.resources.resPlaceHolderHint,
- self.xTextDocument)
- AgendaDocument.trTitle = i
+ self.resources.resPlaceHolderHint, self.xTextDocument)
+ self.trTitle = i
elif text == self.templateConsts.FILLIN_DATE:
- AgendaDocument.teDate = PlaceholderTextElement(
+ self.teDate = PlaceholderTextElement(
i, self.resources.resPlaceHolderDate,
- self.resources.resPlaceHolderHint,
- self.xTextDocument)
- AgendaDocument.trDate = i
+ self.resources.resPlaceHolderHint, self.xTextDocument)
+ self.trDate = i
elif text == self.templateConsts.FILLIN_TIME:
- AgendaDocument.teTime = PlaceholderTextElement(
+ self.teTime = PlaceholderTextElement(
i, self.resources.resPlaceHolderTime,
- self.resources.resPlaceHolderHint,
- self.xTextDocument)
- AgendaDocument.trTime = i
+ self.resources.resPlaceHolderHint, self.xTextDocument)
+ self.trTime = i
elif text == self.templateConsts.FILLIN_LOCATION:
- AgendaDocument.teLocation = PlaceholderTextElement(
+ self.teLocation = PlaceholderTextElement(
i, self.resources.resPlaceHolderLocation,
- self.resources.resPlaceHolderHint,
- self.xTextDocument)
- AgendaDocument.trLocation = i
+ self.resources.resPlaceHolderHint, self.xTextDocument)
+ self.trLocation = i
else:
auxList.append(i)
self.allItems = auxList
@@ -367,47 +360,34 @@ class AgendaDocument(TextDocument):
def redrawTitle(self, controlName):
try:
if controlName == "txtTitle":
- self.writeTitle(
- AgendaDocument.teTitle, AgendaDocument.trTitle,
- self.agenda.cp_Title)
+ self.teTitle.placeHolderText = self.agenda.cp_Title
+ self.teTitle.write(self.trTitle)
elif controlName == "txtDate":
- self.writeTitle(
- AgendaDocument.teDate, AgendaDocument.trDate,
- self.getDateString(self.agenda.cp_Date))
+ self.teDate.placeHolderText = \
+ self.getDateString(self.agenda.cp_Date)
+ self.teDate.write(self.trDate)
elif controlName == "txtTime":
- self.writeTitle(
- AgendaDocument.teTime, AgendaDocument.trTime,
- self.getTimeString(self.agenda.cp_Time))
+ self.teTime.placeHolderText = \
+ self.getTimeString(self.agenda.cp_Time)
+ self.teTime.write(self.trTime)
elif controlName == "cbLocation":
- self.writeTitle(
- AgendaDocument.teLocation, AgendaDocument.trLocation,
- self.agenda.cp_Location)
+ self.teLocation.placeHolderText = self.agenda.cp_Location
+ self.teLocation.write(self.trLocation)
else:
raise IllegalArgumentException ("No such title control...")
except Exception:
traceback.print_exc()
- @classmethod
- def writeTitle(self, te, tr, text):
- if text is None:
- te.placeHolderText = ""
- else:
- te.placeHolderText = text
- te.write(tr)
-
- @classmethod
def getDateString(self, d):
- if d is None or d == "":
+ if not d:
return ""
date = int(d)
year = int(date / 10000)
month = int((date % 10000) / 100)
day = int(date % 100)
dateObject = dateTimeObject(year, month, day)
- return AgendaDocument.dateUtils.format(
- AgendaDocument.dateFormat, dateObject)
+ return self.dateUtils.format(self.dateFormat, dateObject)
- @classmethod
def getTimeString(self, s):
if s is None or s == "":
return ""
@@ -415,7 +395,7 @@ class AgendaDocument(TextDocument):
t = ((time / float(1000000)) / float(24)) \
+ ((time % 1000000) / float(1000000)) / float(35)
return self.formatter.convertNumberToString(
- AgendaDocument.timeFormat, t)
+ self.timeFormat, t)
def finish(self, topics):
self.createMinutes(topics)
More information about the Libreoffice-commits
mailing list