diff options
author | Xisco Fauli <anistenis@gmail.com> | 2012-12-19 19:28:46 +0100 |
---|---|---|
committer | Xisco Fauli <anistenis@gmail.com> | 2012-12-19 19:28:46 +0100 |
commit | 8d340f4b15c530f3d8de8c2e7473eee2489a1654 (patch) | |
tree | a1c34e1bef46518888333152b6985f9d75083222 /wizards | |
parent | 1f6b7857f417815fd8754d8e3da2f41f61531438 (diff) |
pywizards: These files aren't use in libreoffice-4-0 branch
Change-Id: I6a8bd9f29b1d24a4a25eae3c7b6b96925320d90a
Diffstat (limited to 'wizards')
23 files changed, 0 insertions, 7100 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py deleted file mode 100644 index c16dd7c20ee4..000000000000 --- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py +++ /dev/null @@ -1,1149 +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 . -# -import uno -import traceback -from ..text.TextElement import TextElement -from ..text.TextDocument import TextDocument -from ..common.FileAccess import FileAccess -from ..text.TextSectionHandler import TextSectionHandler - -from datetime import date as dateTimeObject - -from com.sun.star.text.PlaceholderType import TEXT -from com.sun.star.i18n.NumberFormatIndex import TIME_HHMM, DATE_SYSTEM_LONG - -''' -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.self.xTextDocument -<br/><br/> -A note about threads:<br/> -Many methods here are synchronized, in order to avoid colission made by -events fired too often. -@author rpiterman -''' -class AgendaTemplate(TextDocument): - - ''' - constructor. The document is *not* loaded here. - only some formal members are set. - ''' - - def __init__(self, xmsf, agenda, resources, templateConsts, listener): - super(AgendaTemplate,self).__init__(xmsf,listener, None, - "WIZARD_LIVE_PREVIEW") - self.agenda = agenda - self.templateConsts = templateConsts - self.resources = resources - self.itemsMap = {} - self.allItems = [] - - def load(self, templateURL, topics): - self.template = self.calcTemplateName(templateURL) - self.loadAsPreview(templateURL, False) - self.xFrame.ComponentWindow.Enable = False - self.xTextDocument.lockControllers() - self.initialize() - self.initializeData(topics) - self.xTextDocument.unlockControllers() - - ''' - The agenda templates are in format of aw-XXX.ott - the templates name is then XXX.ott. - This method calculates it. - ''' - - def calcTemplateName(self, url): - return FileAccess.connectURLs( - FileAccess.getParentDir(url), FileAccess.getFilename(url)[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). - information (it is only actualized on save) the given list - supplies this information. - ''' - - def initializeData(self, topicsData): - for i in self.itemsTables: - try: - i.write("") - except Exception: - traceback.print_exc() - - self.redrawTitle("txtTitle") - self.redrawTitle("txtDate") - self.redrawTitle("txtTime") - self.redrawTitle("cbLocation") - - ''' - 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. - ''' - - def redraw(self, itemName): - self.xTextDocument.lockControllers() - try: - # get the table in which the item is... - itemsTable = self.itemsMap[itemName] - # rewrite the table. - itemsTable.write(None) - except Exception: - traceback.print_exc() - self.xTextDocument.unlockControllers() - - ''' - checks the data model if the - item corresponding to the given string should be shown - ''' - - def isShowItem(self, itemName): - if itemName == self.templateConsts.FILLIN_MEETING_TYPE: - return self.agenda.cp_ShowMeetingType - elif itemName == self.templateConsts.FILLIN_READ: - return self.agenda.cp_ShowRead - elif itemName == self.templateConsts.FILLIN_BRING: - return self.agenda.cp_ShowBring - elif itemName == self.templateConsts.FILLIN_NOTES: - return self.agenda.cp_ShowNotes - elif itemName == self.templateConsts.FILLIN_FACILITATOR: - return self.agenda.cp_ShowFacilitator - elif itemName == self.templateConsts.FILLIN_TIMEKEEPER: - return self.agenda.cp_ShowTimekeeper - elif itemName == self.templateConsts.FILLIN_NOTETAKER: - return self.agenda.cp_ShowNotetaker - elif itemName == self.templateConsts.FILLIN_PARTICIPANTS: - return self.agenda.cp_ShowAttendees - elif itemName == self.templateConsts.FILLIN_CALLED_BY: - return self.agenda.cp_ShowCalledBy - elif itemName == self.templateConsts.FILLIN_OBSERVERS: - return self.agenda.cp_ShowObservers - elif itemName == self.templateConsts.FILLIN_RESOURCE_PERSONS: - return self.agenda.cp_ShowResourcePersons - else: - raise ValueError("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). - ''' - - def initItemsCache(self): - self.itemsCache = {} - # Headings - self.itemsCache[ - self.templateConsts.FILLIN_MEETING_TYPE] = \ - AgendaItem(self.templateConsts.FILLIN_MEETING_TYPE, - self.resources.itemMeetingType, - PlaceholderElement( - self.resources.reschkMeetingTitle_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - self.itemsCache[ - self.templateConsts.FILLIN_BRING] = \ - AgendaItem(self.templateConsts.FILLIN_BRING, - self.resources.itemBring, - PlaceholderElement ( - self.resources.reschkBring_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - self.itemsCache[ - self.templateConsts.FILLIN_READ] = \ - AgendaItem (self.templateConsts.FILLIN_READ, - self.resources.itemRead, - PlaceholderElement ( - self.resources.reschkRead_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - self.itemsCache[ - self.templateConsts.FILLIN_NOTES] = \ - AgendaItem (self.templateConsts.FILLIN_NOTES, - self.resources.itemNote, - PlaceholderElement ( - self.resources.reschkNotes_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - - # Names - self.itemsCache[ - self.templateConsts.FILLIN_CALLED_BY] = \ - AgendaItem(self.templateConsts.FILLIN_CALLED_BY, - self.resources.itemCalledBy, - PlaceholderElement ( - self.resources.reschkConvenedBy_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - self.itemsCache[ - self.templateConsts.FILLIN_FACILITATOR] = \ - AgendaItem(self.templateConsts.FILLIN_FACILITATOR, - self.resources.itemFacilitator, - PlaceholderElement ( - self.resources.reschkPresiding_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - self.itemsCache[ - self.templateConsts.FILLIN_PARTICIPANTS] = \ - AgendaItem(self.templateConsts.FILLIN_PARTICIPANTS, - self.resources.itemAttendees, - PlaceholderElement( - self.resources.reschkAttendees_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - self.itemsCache[ - self.templateConsts.FILLIN_NOTETAKER] = \ - AgendaItem(self.templateConsts.FILLIN_NOTETAKER, - self.resources.itemNotetaker, - PlaceholderElement( - self.resources.reschkNoteTaker_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - self.itemsCache[ - self.templateConsts.FILLIN_TIMEKEEPER] = \ - AgendaItem(self.templateConsts.FILLIN_TIMEKEEPER, - self.resources.itemTimekeeper, - PlaceholderElement( - self.resources.reschkTimekeeper_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - self.itemsCache[ - self.templateConsts.FILLIN_OBSERVERS] = \ - AgendaItem(self.templateConsts.FILLIN_OBSERVERS, - self.resources.itemObservers, - PlaceholderElement( - self.resources.reschkObservers_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - self.itemsCache[ - self.templateConsts.FILLIN_RESOURCE_PERSONS] = \ - AgendaItem(self.templateConsts.FILLIN_RESOURCE_PERSONS, - self.resources.itemResource, - PlaceholderElement( - self.resources.reschkResourcePersons_value, - self.resources.resPlaceHolderHint, self.xTextDocument)) - - '''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 - ''' - - def initialize(self): - ''' - Get the default locale of the document, - and create the date and time formatters. - ''' - AgendaTemplate.dateUtils = self.DateUtils( - self.xMSF, self.xTextDocument) - AgendaTemplate.formatter = AgendaTemplate.dateUtils.formatter - AgendaTemplate.dateFormat = \ - AgendaTemplate.dateUtils.getFormat(DATE_SYSTEM_LONG) - AgendaTemplate.timeFormat = \ - AgendaTemplate.dateUtils.getFormat(TIME_HHMM) - - self.initItemsCache() - self.allItems = self.searchFillInItems(0) - self.initializeTitles() - self.initializeItemsSections() - self.textSectionHandler = TextSectionHandler( - self.xTextDocument, self.xTextDocument) - self.topics = Topics(self) - - ''' - locates the titles (name, location, date, time) - and saves a reference to thier Text ranges. - ''' - - def initializeTitles(self): - auxList = [] - for i in self.allItems: - text = i.String.lstrip().lower() - if text == self.templateConsts.FILLIN_TITLE: - AgendaTemplate.teTitle = PlaceholderTextElement( - i, self.resources.resPlaceHolderTitle, - self.resources.resPlaceHolderHint, - self.xTextDocument) - AgendaTemplate.trTitle = i - elif text == self.templateConsts.FILLIN_DATE: - AgendaTemplate.teDate = PlaceholderTextElement( - i, self.resources.resPlaceHolderDate, - self.resources.resPlaceHolderHint, - self.xTextDocument) - AgendaTemplate.trDate = i - elif text == self.templateConsts.FILLIN_TIME: - AgendaTemplate.teTime = PlaceholderTextElement( - i, self.resources.resPlaceHolderTime, - self.resources.resPlaceHolderHint, - self.xTextDocument) - AgendaTemplate.trTime = i - elif text == self.templateConsts.FILLIN_LOCATION: - AgendaTemplate.teLocation = PlaceholderTextElement( - i, self.resources.resPlaceHolderLocation, - self.resources.resPlaceHolderHint, - self.xTextDocument) - AgendaTemplate.trLocation = i - else: - auxList.append(i) - self.allItems = auxList - - ''' - analyze the item sections in the template. - delegates the analyze of each table to the ItemsTable class. - ''' - - def initializeItemsSections(self): - sections = self.getSections( - self.xTextDocument, self.templateConsts.SECTION_ITEMS) - # for each section - there is a table... - self.itemsTables = [] - for i in sections: - try: - self.itemsTables.append( - ItemsTable(self.getSection(i), self.getTable(i), self)) - except Exception: - traceback.print_exc() - raise AttributeError ( - "Fatal Error while initialilzing \ - Template: items table in section " + i) - - - def getSections(self, document, s): - allSections = document.TextSections.ElementNames - return self.getNamesWhichStartWith(allSections, s) - - def getSection(self, name): - return getattr(self.xTextDocument.TextSections, name) - - def getTable(self, name): - return getattr(self.xTextDocument.TextTables, name) - - def redrawTitle(self, controlName): - try: - if controlName == "txtTitle": - self.writeTitle( - AgendaTemplate.teTitle, AgendaTemplate.trTitle, - self.agenda.cp_Title) - elif controlName == "txtDate": - self.writeTitle( - AgendaTemplate.teDate, AgendaTemplate.trDate, - self.getDateString(self.agenda.cp_Date)) - elif controlName == "txtTime": - self.writeTitle( - AgendaTemplate.teTime, AgendaTemplate.trTime, - self.getTimeString(self.agenda.cp_Time)) - elif controlName == "cbLocation": - self.writeTitle( - AgendaTemplate.teLocation, AgendaTemplate.trLocation, - self.agenda.cp_Location) - 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 == "": - return "" - date = int(d) - year = int(date / 10000) - month = int((date % 10000) / 100) - day = int(date % 100) - dateObject = dateTimeObject(year, month, day) - return AgendaTemplate.dateUtils.format( - AgendaTemplate.dateFormat, dateObject) - - @classmethod - def getTimeString(self, s): - if s is None or s == "": - return "" - time = int(s) - t = ((time / float(1000000)) / float(24)) \ - + ((time % 1000000) / float(1000000)) / float(35) - return self.formatter.convertNumberToString( - AgendaTemplate.timeFormat, t) - - def finish(self, topics): - self.createMinutes(topics) - self.deleteHiddenSections() - self.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 - entirely from the document. - ''' - - def deleteHiddenSections(self): - allSections = self.xTextDocument.TextSections.ElementNames - try: - for i in allSections: - self.section = self.getSection(i) - visible = bool(self.section.IsVisible) - if not visible: - self.section.Anchor.String = "" - - except Exception: - traceback.print_exc() - - ''' - 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. - ''' - - def createMinutes(self, topicsData): - # if the minutes section should be removed (the - # user did not check "create minutes") - if not self.agenda.cp_IncludeMinutes \ - or len(topicsData) <= 1: - try: - minutesAllSection = self.getSection( - self.templateConsts.SECTION_MINUTES_ALL) - minutesAllSection.Anchor.String = "" - except Exception: - traceback.print_exc() - - # the user checked "create minutes" - else: - try: - topicStartTime = int(self.agenda.cp_Time) - #first I replace the minutes titles... - self.items = self.searchFillInItems() - itemIndex = 0 - for item in self.items: - itemText = item.String.lstrip().lower() - if itemText == \ - self.templateConsts.FILLIN_MINUTES_TITLE: - self.fillMinutesItem( - item, self.agenda.cp_Title, - self.resources.resPlaceHolderTitle) - elif itemText == \ - self.templateConsts.FILLIN_MINUTES_LOCATION: - self.fillMinutesItem( - item, self.agenda.cp_Location, - self.resources.resPlaceHolderLocation) - elif itemText == \ - self.templateConsts.FILLIN_MINUTES_DATE: - self.fillMinutesItem( - item, getDateString(self.agenda.cp_Date), - self.resources.resPlaceHolderDate) - elif itemText == \ - self.templateConsts.FILLIN_MINUTES_TIME: - self.fillMinutesItem( - item, getTimeString(self.agenda.cp_Time), - self.resources.resPlaceHolderTime) - - self.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 one... - topics data has *always* an empty topic at the end... - ''' - - for i in xrange(len(topicsData) - 1): - topic = topicsData[i] - items = self.searchFillInItems() - itemIndex = 0 - for item in items: - itemText = item.String.lstrip().lower() - if itemText == \ - self.templateConsts.FILLIN_MINUTE_NUM: - fillMinutesItem(item, topic[0].Value, "") - elif itemText == \ - self.templateConsts.FILLIN_MINUTE_TOPIC: - fillMinutesItem(item, topic[1].Value, "") - elif itemText == \ - self.templateConsts.FILLIN_MINUTE_RESPONSIBLE: - fillMinutesItem(item, topic[2].Value, "") - elif itemText == \ - self.templateConsts.FILLIN_MINUTE_TIME: - topicTime = 0 - try: - topicTime = topic[3].Value - except Exception: - pass - - ''' - if the topic has no time, we do not - display any time here. - ''' - if topicTime == 0 or topicStartTime == 0: - time = topic[3].Value - else: - time = getTimeString(str(topicStartTime)) + " - " - topicStartTime += topicTime * 1000 - time += getTimeString(str(topicStartTime)) - - fillMinutesItem(item, time, "") - - self.textSectionHandler.removeTextSectionbyName( - self.templateConsts.SECTION_MINUTES) - # after the last section we do not insert a one. - if i < len(topicsData) - 2: - self.textSectionHandler.insertTextSection( - self.templateConsts.SECTION_MINUTES, - self.template, False) - - except Exception: - traceback.print_exc() - - '''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 "") - ''' - - def fillMinutesItem(self, Range, text, placeholder): - paraStyle = Range.ParaStyleName - Range.setString(text) - Range.ParaStyleName = paraStyle - if text == None or text == "": - if placeholder != None and not placeholder == "": - placeHolder = createPlaceHolder( - self.xTextDocument, placeholder, - self.resources.resPlaceHolderHint) - try: - Range.Start.Text.insertTextContent( - Range.Start, placeHolder, True) - except Exception: - traceback.print_exc() - - ''' - creates a placeholder field with the given text and given hint. - ''' - - @classmethod - def createPlaceHolder(self, xmsf, ph, hint): - try: - placeHolder = xmsf.createInstance( - "com.sun.star.text.TextField.JumpEdit") - except Exception: - traceback.print_exc() - return None - - placeHolder.PlaceHolder = ph - placeHolder.Hint = hint - placeHolder.PlaceHolderType = uno.Any("short",TEXT) - return placeHolder - - def getNamesWhichStartWith(self, allNames, prefix): - v = [] - for i in allNames: - if i.startswith(prefix): - v.append(i) - return v - - ''' - Convenience method for inserting some cells into a table. - ''' - - @classmethod - def insertTableRows(self, table, start, count): - rows = table.Rows - rows.insertByIndex(start, count) - - '''returns the row index for this cell name. - @param cellName - @return the row index for this cell name. - ''' - - @classmethod - def getRowIndex(self, cellName): - return int(cellName.RangeName[1:]) - - ''' - returns the rows count of this table, assuming - there is no vertical merged cells. - ''' - - @classmethod - def getRowCount(self, table): - cells = table.getCellNames() - return int(cells[len(cells) - 1][1:]) - -class ItemsTable(object): - ''' - the items in the table. - ''' - items = [] - table = None - - def __init__(self, section, table, agenda): - self.agenda = agenda - ItemsTable.table = table - self.section = section - self.items = [] - ''' - 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. - ''' - i = 0 - while i < len(self.agenda.allItems): - workwith = self.agenda.allItems[i] - t = workwith.TextTable - if t == ItemsTable.table: - iText = workwith.String.lower().lstrip() - ai = self.agenda.itemsCache[iText] - if ai is not None: - self.items.append(ai) - del self.agenda.allItems[i] - self.agenda.itemsMap[iText] = self - i -= 1 - i += 1 - - ''' - 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 - ''' - - def write(self, dummy): - name = self.section.Name - # link and unlink the section to the template. - self.agenda.textSectionHandler.linkSectiontoTemplate( - self.agenda.template, name, self.section) - self.agenda.textSectionHandler.breakLinkOfTextSection( - self.section) - # we need to get a instance after linking. - ItemsTable.table = self.agenda.getTable(name) - self.section = self.agenda.getSection(name) - cursor = ItemsTable.table.createCursorByCellName("A1") - # should this section be visible? - visible = False - # write items - # =========== - cellName = "" - ''' - 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 i in self.items: - if self.agenda.isShowItem(i.name): - visible = True - i.table = ItemsTable.table - i.write(cursor) - # I store the cell name which was last written... - cellName = cursor.RangeName - cursor.goRight(1, False) - - if visible: - boolean = True - else: - boolean = False - self.section.IsVisible = boolean - 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, - I call the goRight method. - If it did not go right, it means its the last cell. - ''' - - if cellName == cursor.RangeName: - return - ''' - if not, we continue and clear all cells until - we are at the end of the row. - ''' - - while not cellName == cursor.RangeName and \ - not cursor.RangeName.startswith("A"): - cell = ItemsTable.table.getCellByName(cursor.RangeName) - cell.String = "" - cellName = cursor.RangeName - cursor.goRight(1, False) - - ''' - again: if we are at the end of the table, end here. - ''' - if cellName == cursor.RangeName: - return - - rowIndex = AgendaTemplate.getRowIndex(cursor) - rowsCount = AgendaTemplate.getRowCount(ItemsTable.table) - ''' - now before deleteing i move the cursor up so it - does not disappear, because it will crash office. - ''' - cursor.gotoStart(False) - -''' -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. - -@author rp143992 -''' - -class Topics(object): - '''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. - ''' - table = None - lastRowFormat = [] - numCell = -1 - topicCell = -1 - responsibleCell = -1 - timeCell = -1 - rowsPerTopic = None - topicCells = [] - - def __init__(self, agenda): - self.topicItems = {} - self.firstRowFormat = [] - self.agenda = agenda - ''' - 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...); - ''' - self.writtenTopics = [] - try: - Topics.table = self.agenda.getTable( - self.agenda.templateConsts.SECTION_TOPICS) - except Exception: - traceback.print_exc() - raise AttributeError ( - "Fatal error while loading template: table " + \ - self.agenda.templateConsts.SECTION_TOPICS + " could not load.") - - ''' - 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. - ''' - try: - items = {} - for i in self.agenda.allItems: - t = i.TextTable - if t == Topics.table: - cell = i.Cell - iText = cell.CellName - items[iText] = i - - ''' - 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. - ''' - rows = self.agenda.getRowCount(Topics.table) - Topics.rowsPerTopic = int((rows - 1) / 3) - - firstCell = "A" + str(1 + Topics.rowsPerTopic + 1) - afterLastCell = "A" + str(1 + (Topics.rowsPerTopic * 2) + 1) - # go to the first row of the 2. topic - - cursor = Topics.table.createCursorByCellName(firstCell) - # analyze the structure of the topic rows. - while not cursor.RangeName == afterLastCell: - cell = Topics.table.getCellByName(cursor.RangeName) - # if the cell contains a relevant <...> - # i add the text element to the hash, - # so it's text can be updated later. - try: - if items[cell.CellName] is not None: - self.topicItems[cell.String.lower().lstrip()] = cell - except KeyError: - pass - - Topics.topicCells.append(cell) - # goto next cell. - cursor.goRight(1, False) - ''' - now - in which cell is every fillin? - ''' - - Topics.numCell = Topics.topicCells.index( - self.topicItems[ - self.agenda.templateConsts.FILLIN_TOPIC_NUMBER]) - Topics.topicCell = Topics.topicCells.index( - self.topicItems[ - self.agenda.templateConsts.FILLIN_TOPIC_TOPIC]) - Topics.responsibleCell = Topics.topicCells.index( - self.topicItems[ - self.agenda.templateConsts.FILLIN_TOPIC_RESPONSIBLE]) - Topics.timeCell = Topics.topicCells.index( - self.topicItems[ - self.agenda.templateConsts.FILLIN_TOPIC_TIME]) - except Exception: - traceback.print_exc() - - '''@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. - ''' - - def write2(self, topic, data): - if topic >= len(self.writtenTopics): - size = topic - len(self.writtenTopics) - self.writtenTopics += [None] * size - self.writtenTopics.insert(topic, "") - # make sure threr are enough rows for me... - rows = self.agenda.getRowCount(Topics.table) - reqRows = 1 + (topic + 1) * Topics.rowsPerTopic - firstRow = reqRows - Topics.rowsPerTopic + 1 - diff = reqRows - rows - if diff > 0: - self.agenda.insertTableRows(Topics.table, rows, diff) - # set the item's text... - - self.setItemText(Topics.numCell, data[0].Value) - self.setItemText(Topics.topicCell, data[1].Value) - self.setItemText(Topics.responsibleCell, data[2].Value) - self.setItemText(Topics.timeCell, data[3].Value) - # now write ! - cursor = Topics.table.createCursorByCellName("A" + str(firstRow)) - for i in Topics.topicCells: - i.write(Topics.table.getCellByName(cursor.RangeName)) - cursor.goRight(1, False) - # now format ! - cursor.gotoCellByName("A" + str(firstRow), 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 rows must be added to the table in order to - be able to write this topic). - ''' - - def isWritten(self, topic): - return (len(self.writtenTopics) > topic \ - and self.writtenTopics[topic] is not None) - - '''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) - ''' - - def writeCell(self, topic, what, data): - # if the whole row should be written... - if not self.isWritten(topic): - self.write(topic, data) - # write only the "what" cell. - else: - # calculate the table row. - firstRow = 1 + (topic * Topics.rowsPerTopic) + 1 - # go to the first cell of this topic. - cursor = Topics.table.createCursorByCellName("A" + str(firstRow)) - te = None - cursorMoves = 0 - if what == 0: - te = self.setItemText(Topics.numCell, data[0].Value) - cursorMoves = Topics.numCell - elif what == 1: - te = self.setItemText(Topics.topicCell, data[1].Value) - cursorMoves = Topics.topicCell - elif what == 2: - te = self.setItemText(Topics.responsibleCell, data[2].Value) - cursorMoves = Topics.responsibleCell - elif what == 3: - te = self.setItemText(Topics.timeCell, data[3].Value) - cursorMoves = Topics.timeCell - - # move the cursor to the needed cell... - cursor.goRight(cursorMoves, False) - xc = Topics.table.getCellByName(cursor.RangeName) - # and write it ! - te.write(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). - ''' - - def write(self, topic, data): - diff = self.write2(topic, data) - '''if the first topic has been written, - one needs to reformat the first row. - ''' - if topic == 0: - self.formatFirstRow() - ''' - if any rows were added, one needs to format - the whole table again. - ''' - - if diff > 0: - self.formatLastRow() - - '''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 - 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 - ''' - - def reduceDocumentTo(self, topics): - # we never remove the first topic... - if topics <= 0: - topics = 1 - - tableRows = Topics.table.Rows - targetNumOfRows = topics * Topics.rowsPerTopic + 1 - '''if tableRows.Count > targetNumOfRows: - tableRows.removeByIndex( - targetNumOfRows, tableRows.Count - targetNumOfRows)''' - - self.formatLastRow() - while len(self.writtenTopics) > topics: - del self.writtenTopics[topics] - - '''reapply the format of the first (header) row. - ''' - - def formatFirstRow(self): - cursor = Topics.table.createCursorByCellName("A1") - self.formatTable(cursor, self.firstRowFormat, False) - - '''reaply the format of the last row. - ''' - @classmethod - def formatLastRow(self): - cursor = Topics.table.createCursorByCellName("A1") - cursor.gotoEnd(False) - self.formatTable(cursor, Topics.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. - ''' - - @classmethod - def setItemText(self, cell, value): - if cell >= 0: - te = Topics.topicCells[cell] - if te is not None: - te.Text = str(value) - return te - - return None - - '''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). - ''' - @classmethod - def formatTable(self, cursor, formats, reverse): - for i in formats: - i.format(Topics.table.getCellByName(cursor.RangeName)) - if reverse: - cursor.goLeft(1, False) - else: - cursor.goRight(1, False) - -''' -A Text element which, if the text to write is empty (null or "") -inserts a placeholder instead. -@author rp143992 -''' - -class PlaceholderTextElement(TextElement): - - def __init__(self, textRange, placeHolderText_, hint_, xmsf_): - super(PlaceholderTextElement,self).__init__(textRange, "") - - self.text = placeHolderText_ - self.hint = hint_ - self.xmsf = xmsf_ - - def write(self, textRange): - textRange.String = self.placeHolderText - if self.placeHolderText is None or self.placeHolderText == "": - try: - xTextContent = AgendaTemplate.createPlaceHolder( - self.xmsf, self.text, self.hint) - textRange.Text.insertTextContent( - textRange.Start, xTextContent, True) - except Exception: - traceback.print_exc() - -''' -An Agenda element which writes no text, but inserts a placeholder, and formats -it using a ParaStyleName. -@author rp143992 -''' - -class PlaceholderElement(object): - - def __init__(self, placeHolderText_, hint_, textDocument): - self.placeHolderText = placeHolderText_ - self.hint = hint_ - self.textDocument = textDocument - - def write(self, textRange): - try: - xTextContent = AgendaTemplate.createPlaceHolder( - self.textDocument, self.placeHolderText, self.hint) - textRange.Text.insertTextContent( - textRange.Start, xTextContent, True) - except Exception: - traceback.print_exc() - -''' -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. -@author rp143992 -''' - -class AgendaItem(object): - - def __init__(self, name_, te, f): - self.name = name_ - self.field = f - self.textElement = te - - def write(self, tableCursor): - cellname = tableCursor.RangeName - cell = ItemsTable.table.getCellByName(cellname) - cell.String = self.textElement - tableCursor.goRight(1, False) - #second field is actually always null... - # this is a preparation for adding placeholders. - if self.field is not None: - self.field.write(ItemsTable.table.getCellByName( - tableCursor.RangeName)) diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py deleted file mode 100644 index b7f428e8cedd..000000000000 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py +++ /dev/null @@ -1,340 +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 . -# -from ..ui.WizardDialog import WizardDialog, uno, UIConsts, PropertyNames -from .AgendaWizardDialogConst import AgendaWizardDialogConst, HID -from .AgendaWizardDialogResources import AgendaWizardDialogResources - -from com.sun.star.awt.FontUnderline import SINGLE - -class AgendaWizardDialog(WizardDialog): - - def __init__(self, xmsf): - super(AgendaWizardDialog,self).__init__(xmsf, HID ) - - #Load Resources - self.resources = AgendaWizardDialogResources(xmsf) - - #set dialog properties... - uno.invoke(self.xDialogModel, "setPropertyValues", - (("Closeable", - PropertyNames.PROPERTY_HEIGHT, - "Moveable", PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - "Title", PropertyNames.PROPERTY_WIDTH), - (True, 210, True, 200, 52, 1, 1, - self.resources.resAgendaWizardDialog_title,310))) - - self.PROPS_LIST = ("Dropdown", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - self.PROPS_LABEL_B = ("FontDescriptor", - 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) - self.PROPS_CHECK = (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) - self.PROPS_BUTTON = (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) - self.PROPS_X = (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - self.PROPS_TEXTAREA = (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) - self.PROPS_TEXT = (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - self.PROPS_IMAGE = ("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) - - self.fontDescriptor1 = \ - uno.createUnoStruct('com.sun.star.awt.FontDescriptor') - self.fontDescriptor2 = \ - uno.createUnoStruct('com.sun.star.awt.FontDescriptor') - self.fontDescriptor4 = \ - uno.createUnoStruct('com.sun.star.awt.FontDescriptor') - - #Set member- FontDescriptors... - self.fontDescriptor1.Weight = 150 - self.fontDescriptor1.Underline = SINGLE - self.fontDescriptor2.Weight = 100 - self.fontDescriptor4.Weight = 150 - - ''' - build components - ''' - def buildStep1(self): - self.insertLabel("lblTitle1", self.PROPS_LABEL_B, - (self.fontDescriptor4, 16, self.resources.reslblTitle1_value, - True, 91, 8, 1, 100,212)) - self.insertLabel("lblPageDesign", self.PROPS_TEXT, - (8, self.resources.reslblPageDesign_value, 97, 32, 1, 101, 66)) - self.listPageDesign = self.insertListBox("listPageDesign", - None, AgendaWizardDialogConst.LISTPAGEDESIGN_ACTION_PERFORMED, - self.PROPS_LIST, - (True, 12, AgendaWizardDialogConst.LISTPAGEDESIGN_HID, - 166, 30, 1, 102, 70), self) - self.chkMinutes = self.insertCheckBox("chkMinutes", None, - self.PROPS_CHECK, (9, AgendaWizardDialogConst.CHKMINUTES_HID, - self.resources.reschkMinutes_value, 97, 50, 0, 1, 103, 203), self) - self.insertImage("imgHelp1", self.PROPS_IMAGE, - (0, 10, "", UIConsts.INFOIMAGEURL, 92, 145, False, 1, 104, 10)) - self.insertLabel("lblHelp1", self.PROPS_TEXTAREA, - (39, self.resources.reslblHelp1_value, - True, 104, 145, 1, 105, 199)) - - def buildStep2(self): - self.insertLabel("lblTitle2", self.PROPS_LABEL_B, - (self.fontDescriptor4, 16, self.resources.reslblTitle2_value, - True, 91, 8, 2, 200, 212)) - self.insertLabel("lblDate", self.PROPS_TEXT, - (8, self.resources.reslblDate_value, 97, 32, 2, 201,66)) - self.txtDate = self.insertDateField( - "txtDate", AgendaWizardDialogConst.TXTDATE_TEXT_CHANGED, - self.PROPS_LIST, - (True, 12, AgendaWizardDialogConst.TXTDATE_HID, - 166,30, 2, 202, 70), self) - self.insertLabel("lblTime", self.PROPS_TEXT, - (8, self.resources.reslblTime_value, 97, 50, 2, 203, 66)) - self.txtTime = self.insertTimeField("txtTime", - AgendaWizardDialogConst.TXTTIME_TEXT_CHANGED, - (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - "StrictFormat", - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (12, AgendaWizardDialogConst.TXTTIME_HID, - 166, 48, 2, True, 204, 70), self) - self.insertLabel("lblTitle", self.PROPS_TEXT, - (8, self.resources.reslblTitle_value, 97, 68, 2, 205, 66)) - self.txtTitle = self.insertTextField( - "txtTitle", AgendaWizardDialogConst.TXTTITLE_TEXT_CHANGED, - (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), - (26, AgendaWizardDialogConst.TXTTITLE_HID, - True, 166, 66, 2, 206, 138), self) - self.insertLabel("lblLocation", self.PROPS_TEXT, - (8, self.resources.reslblLocation_value, 97, 100, 2, 207, 66)) - self.cbLocation = self.insertTextField( - "cbLocation", AgendaWizardDialogConst.TXTLOCATION_TEXT_CHANGED, - (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), - (34, AgendaWizardDialogConst.CBLOCATION_HID, - True, 166,98, 2, 208, 138), self) - self.insertImage("imgHelp2", self.PROPS_IMAGE, - (0, 10, "", UIConsts.INFOIMAGEURL, 92, 145, False, 2, 209, 10)) - self.insertLabel("lblHelp2", self.PROPS_TEXTAREA, - (39, self.resources.reslblHelp2_value, - True, 104, 145, 2, 210, 199)) - - def buildStep3(self): - self.insertLabel("lblTitle3", self.PROPS_LABEL_B, - (self.fontDescriptor4, 16, self.resources.reslblTitle3_value, - True, 91, 8, 3, 300,212)) - self.chkMeetingTitle = self.insertCheckBox("chkMeetingTitle", - AgendaWizardDialogConst.CHKUSEMEETINGTYPE_ITEM_CHANGED, - self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKMEETINGTITLE_HID, - self.resources.reschkMeetingTitle_value, - 97, 32, 1, 3, 301, 69), self) - self.chkRead = self.insertCheckBox("chkRead", - AgendaWizardDialogConst.CHKUSEREAD_ITEM_CHANGED, self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKREAD_HID, - self.resources.reschkRead_value, 97, 46, 0, 3, 302, 162), self) - self.chkBring = self.insertCheckBox("chkBring", - AgendaWizardDialogConst.CHKUSEBRING_ITEM_CHANGED, self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKBRING_HID, - self.resources.reschkBring_value, - 97, 60, 0, 3, 303, 162), self) - self.chkNotes = self.insertCheckBox("chkNotes", - AgendaWizardDialogConst.CHKUSENOTES_ITEM_CHANGED, self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKNOTES_HID, - self.resources.reschkNotes_value, - 97, 74, 1, 3, 304, 160), self) - self.insertImage("imgHelp3", self.PROPS_IMAGE, (0, 10, - "", UIConsts.INFOIMAGEURL, 92, 145, False, 3, 305, 10)) - self.insertLabel("lblHelp3", self.PROPS_TEXTAREA, - (39, self.resources.reslblHelp3_value, True,104, 145, 3, 306, 199)) - - def buildStep4(self): - self.insertLabel("lblTitle5", self.PROPS_LABEL_B, - (self.fontDescriptor4, 16, self.resources.reslblTitle5_value, - True, 91, 8, 4, 400, 212)) - self.chkConvenedBy = self.insertCheckBox("chkConvenedBy", - AgendaWizardDialogConst.CHKUSECALLEDBYNAME_ITEM_CHANGED, - self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKCONVENEDBY_HID, - self.resources.reschkConvenedBy_value, - 97, 32, 1, 4, 401, 150), self) - self.chkPresiding = self.insertCheckBox("chkPresiding", - AgendaWizardDialogConst.CHKUSEFACILITATOR_ITEM_CHANGED, - self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKPRESIDING_HID, - self.resources.reschkPresiding_value, - 97, 46, 0, 4, 402, 150), self) - self.chkNoteTaker = self.insertCheckBox("chkNoteTaker", - AgendaWizardDialogConst.CHKUSENOTETAKER_ITEM_CHANGED, - self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKNOTETAKER_HID, - self.resources.reschkNoteTaker_value, - 97, 60, 0, 4, 403, 150), self) - self.chkTimekeeper = self.insertCheckBox("chkTimekeeper", - AgendaWizardDialogConst.CHKUSETIMEKEEPER_ITEM_CHANGED, - self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKTIMEKEEPER_HID, - self.resources.reschkTimekeeper_value, - 97, 74, 0, 4, 404, 150), self) - self.chkAttendees = self.insertCheckBox("chkAttendees", - AgendaWizardDialogConst.CHKUSEATTENDEES_ITEM_CHANGED, - self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKATTENDEES_HID, - self.resources.reschkAttendees_value, - 97, 88, 1, 4, 405, 150), self) - self.chkObservers = self.insertCheckBox("chkObservers", - AgendaWizardDialogConst.CHKUSEOBSERVERS_ITEM_CHANGED, - self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKOBSERVERS_HID, - self.resources.reschkObservers_value, - 97, 102, 0, 4, 406, 150), self) - self.chkResourcePersons = self.insertCheckBox("chkResourcePersons", - AgendaWizardDialogConst.CHKUSERESOURCEPERSONS_ITEM_CHANGED, - self.PROPS_CHECK, - (8, AgendaWizardDialogConst.CHKRESOURCEPERSONS_HID, - self.resources.reschkResourcePersons_value, - 97, 116, 0, 4, 407, 150), self) - self.insertImage("imgHelp4", self.PROPS_IMAGE, - (0, 10, "", UIConsts.INFOIMAGEURL, - 92, 145, False, 4, 408, 10)) - self.insertLabel("lblHelp4", self.PROPS_TEXTAREA, - (39, self.resources.reslblHelp4_value, True, 104, 145, 4, 409, 199)) - - def buildStep5(self): - self.insertLabel("lblTitle4", self.PROPS_LABEL_B, - (self.fontDescriptor4, 16, self.resources.reslblTitle4_value, - True, 91, 8, 5, 500, 212)) - self.insertLabel("lblTopic", self.PROPS_TEXT, - (8, self.resources.reslblTopic_value, 107, 28, 5, 71, 501)) - self.insertLabel("lblResponsible", self.PROPS_TEXT, - (8, self.resources.reslblResponsible_value, 195, 28, 5, 72, 502)) - self.insertLabel("lblDuration", self.PROPS_TEXT, - (8, self.resources.reslblDuration_value, 267, 28, 5, 73, 503)) - self.btnInsert = self.insertButton("btnInsert", - AgendaWizardDialogConst.BTNINSERT_ACTION_PERFORMED, - self.PROPS_BUTTON, (14, AgendaWizardDialogConst.BTNINSERT_HID, - self.resources.resButtonInsert, 92, 136, 5, 580, 40), self) - self.btnRemove = self.insertButton("btnRemove", - AgendaWizardDialogConst.BTNREMOVE_ACTION_PERFORMED, - self.PROPS_BUTTON, (14, AgendaWizardDialogConst.BTNREMOVE_HID, - self.resources.resButtonRemove, 134, 136, 5, 581, 40), self) - self.btnUp = self.insertButton("btnUp", - AgendaWizardDialogConst.BTNUP_ACTION_PERFORMED, - self.PROPS_BUTTON, (14, AgendaWizardDialogConst.BTNUP_HID, - self.resources.resButtonUp, 202, 136, 5, 582, 50), self) - self.btnDown = self.insertButton("btnDown", - AgendaWizardDialogConst.BTNDOWN_ACTION_PERFORMED, - self.PROPS_BUTTON, (14, AgendaWizardDialogConst.BTNDOWN_HID, - self.resources.resButtonDown, 254, 136, 5, 583, 50), self) - - def buildStep6(self): - self.insertLabel("lblTitle6", self.PROPS_LABEL_B, - (self.fontDescriptor4, 16, self.resources.reslblTitle6_value, - True, 91, 8, 6, 600, 212)) - self.insertLabel("lblHelpPg6", self.PROPS_TEXTAREA, - (24, self.resources.reslblHelpPg6_value, True, - 97, 32, 6, 601,204)) - self.insertLabel("lblTemplateName", self.PROPS_TEXT, - (8, self.resources.reslblTemplateName_value, - 97, 62, 6, 602, 101)) - self.txtTemplateName = self.insertTextField("txtTemplateName", - None, self.PROPS_X, - (12, AgendaWizardDialogConst.TXTTEMPLATENAME_HID, - 202, 60, 6, 603, 100), self) - self.insertLabel("lblProceed", self.PROPS_TEXT, - (8, self.resources.reslblProceed_value, 97, 101, 6, 607,204)) - self.optCreateAgenda = self.insertRadioButton("optCreateAgenda", None, - self.PROPS_CHECK, (8, AgendaWizardDialogConst.OPTCREATEAGENDA_HID, - self.resources.resoptCreateAgenda_value, - 103, 113, 1, 6, 608, 198), self) - self.optMakeChanges = self.insertRadioButton("optMakeChanges", None, - self.PROPS_BUTTON, (8, AgendaWizardDialogConst.OPTMAKECHANGES_HID, - self.resources.resoptMakeChanges_value, - 103, 125, 6, 609, 198), self) - self.insertImage("imgHelp6", self.PROPS_IMAGE, (0, 10, "", - UIConsts.INFOIMAGEURL, 92, 145, False, 6, 610, 10)) - self.insertLabel("lblHelp6", self.PROPS_TEXTAREA, - (39, self.resources.reslblHelp6_value, True, 104, 145, 6, 611, 199)) diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py deleted file mode 100644 index e4370a416b70..000000000000 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py +++ /dev/null @@ -1,77 +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 . -# -from ..common.HelpIds import HelpIds - -HID = 41051 - -class AgendaWizardDialogConst: - - TXTTITLE_TEXT_CHANGED = "txtTitleTextChanged" - TXTDATE_TEXT_CHANGED = "txtDateTextChanged" - TXTTIME_TEXT_CHANGED = "txtTimeTextChanged" - TXTLOCATION_TEXT_CHANGED = "txtLocationTextChanged" - CHKMINUTES_ITEM_CHANGED = "chkMinutesItemChanged" - CHKUSEMEETINGTYPE_ITEM_CHANGED = "chkUseMeetingTypeItemChanged" - CHKUSEREAD_ITEM_CHANGED = "chkUseReadItemChanged" - CHKUSEBRING_ITEM_CHANGED = "chkUseBringItemChanged" - CHKUSENOTES_ITEM_CHANGED = "chkUseNotesItemChanged" - CHKUSECALLEDBYNAME_ITEM_CHANGED = "chkUseCalledByItemChanged" - CHKUSEFACILITATOR_ITEM_CHANGED = "chkUseFacilitatorItemChanged" - CHKUSENOTETAKER_ITEM_CHANGED = "chkUseNoteTakerItemChanged" - CHKUSETIMEKEEPER_ITEM_CHANGED = "chkUseTimeKeeperItemChanged" - CHKUSEATTENDEES_ITEM_CHANGED = "chkUseAttendeesItemChanged" - CHKUSEOBSERVERS_ITEM_CHANGED = "chkUseObserversItemChanged" - CHKUSERESOURCEPERSONS_ITEM_CHANGED = "chkUseResourcePersonsItemChanged" - LISTPAGEDESIGN_ACTION_PERFORMED = "pageDesignChanged" - BTNTEMPLATEPATH_ACTION_PERFORMED = "saveAs" - BTNINSERT_ACTION_PERFORMED = "insertRow" - BTNREMOVE_ACTION_PERFORMED = "removeRow" - BTNUP_ACTION_PERFORMED = "rowUp" - BTNDOWN_ACTION_PERFORMED = "rowDown" - - LISTPAGEDESIGN_HID = HelpIds.getHelpIdString(HID + 6) - CHKMINUTES_HID = HelpIds.getHelpIdString(HID + 7) - TXTTIME_HID = HelpIds.getHelpIdString(HID + 8) - TXTDATE_HID = HelpIds.getHelpIdString(HID + 9) - TXTTITLE_HID = HelpIds.getHelpIdString(HID + 10) - CBLOCATION_HID = HelpIds.getHelpIdString(HID + 11) - - CHKMEETINGTITLE_HID = HelpIds.getHelpIdString(HID + 12) - CHKREAD_HID = HelpIds.getHelpIdString(HID + 13) - CHKBRING_HID = HelpIds.getHelpIdString(HID + 14) - CHKNOTES_HID = HelpIds.getHelpIdString(HID + 15) - - CHKCONVENEDBY_HID = HelpIds.getHelpIdString(HID + 16) - CHKPRESIDING_HID = HelpIds.getHelpIdString(HID + 17) - CHKNOTETAKER_HID = HelpIds.getHelpIdString(HID + 18) - CHKTIMEKEEPER_HID = HelpIds.getHelpIdString(HID + 19) - CHKATTENDEES_HID = HelpIds.getHelpIdString(HID + 20) - CHKOBSERVERS_HID = HelpIds.getHelpIdString(HID + 21) - CHKRESOURCEPERSONS_HID = HelpIds.getHelpIdString(HID + 22) - - TXTTEMPLATENAME_HID = HelpIds.getHelpIdString(HID + 23) - TXTTEMPLATEPATH_HID = HelpIds.getHelpIdString(HID + 24) - BTNTEMPLATEPATH_HID = HelpIds.getHelpIdString(HID + 25) - - OPTCREATEAGENDA_HID = HelpIds.getHelpIdString(HID + 26) - OPTMAKECHANGES_HID = HelpIds.getHelpIdString(HID + 27) - - BTNINSERT_HID = HelpIds.getHelpIdString(HID + 28) - BTNREMOVE_HID = HelpIds.getHelpIdString(HID + 29) - BTNUP_HID = HelpIds.getHelpIdString(HID + 30) - BTNDOWN_HID = HelpIds.getHelpIdString(HID + 31) diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py deleted file mode 100644 index 2dbcea7e098b..000000000000 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py +++ /dev/null @@ -1,409 +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 . -# -import traceback -from .AgendaWizardDialog import AgendaWizardDialog, uno -from .AgendaWizardDialogConst import HID -from .AgendaTemplate import AgendaTemplate, FileAccess -from .TemplateConsts import TemplateConsts -from .TopicsControl import TopicsControl -from .CGAgenda import CGAgenda -from ..ui.PathSelection import PathSelection -from ..ui.event.UnoDataAware import UnoDataAware -from ..ui.event.RadioDataAware import RadioDataAware -from ..common.NoValidPathException import NoValidPathException -from ..common.SystemDialog import SystemDialog -from ..common.Desktop import Desktop -from ..common.HelpIds import HelpIds -from ..common.Configuration import Configuration -from ..document.OfficeDocument import OfficeDocument -from ..text.ViewHandler import ViewHandler - -from com.sun.star.view.DocumentZoomType import OPTIMAL -from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO -from com.sun.star.awt.VclWindowPeerAttribute import OK - -class AgendaWizardDialogImpl(AgendaWizardDialog): - - pageDesign = None - - def __init__(self, xmsf): - super(AgendaWizardDialogImpl, self).__init__(xmsf) - self.filenameChanged = False - - def enterStep(self, OldStep, NewStep): - pass - - def leaveStep(self, OldStep, NewStep): - pass - - @classmethod - def main(self): - #Call the wizard remotely(see README) - try: - ConnectStr = \ - "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" - xLocMSF = Desktop.connect(ConnectStr) - lw = AgendaWizardDialogImpl(xLocMSF) - lw.startWizard(xLocMSF) - except Exception as e: - print ("Wizard failure exception " + str(type(e)) + - " message " + str(e) + " args " + str(e.args) + - traceback.format_exc()) - - def startWizard(self, xMSF): - self.running = True - try: - #Number of steps on WizardDialog - self.nMaxStep = 6 - - # initialize the agenda template - self.agenda = CGAgenda() - - self.templateConsts = TemplateConsts - self.agendaTemplate = AgendaTemplate( - self.xMSF, self.agenda, self.resources, - self.templateConsts, self) - - # build the dialog. - self.drawNaviBar() - - self.buildStep1() - self.buildStep2() - self.buildStep3() - self.buildStep4() - self.buildStep5() - self.buildStep6() - - self.topicsControl = TopicsControl(self, self.xMSF, self.agenda) - - self.initializePaths() - #special Control for setting the save Path: - self.insertPathSelectionControl() - - self.initializeTemplates() - - # synchronize GUI and CGAgenda object. - self.initConfiguration() - - if self.myPathSelection.xSaveTextBox.Text.lower() == "": - self.myPathSelection.initializePath() - - # create the peer - xContainerWindow = self.agendaTemplate.xFrame.ContainerWindow - self.createWindowPeer(xContainerWindow) - - # initialize roadmap - self.insertRoadmap() - - self.pageDesignChanged() - - self.executeDialogFromComponent(self.agendaTemplate.xFrame) - self.removeTerminateListener() - self.closeDocument() - self.running = False - except Exception: - self.removeTerminateListener() - traceback.print_exc() - self.running = False - return - - def insertPathSelectionControl(self): - self.myPathSelection = PathSelection( - self.xMSF, self, PathSelection.TransferMode.SAVE, - PathSelection.DialogTypes.FILE) - self.myPathSelection.insert(6, 97, 70, 205, 45, - self.resources.reslblTemplatePath_value, True, - HelpIds.getHelpIdString(HID + 24), - HelpIds.getHelpIdString(HID + 25)) - self.myPathSelection.sDefaultDirectory = self.sUserTemplatePath - self.myPathSelection.sDefaultName = "myAgendaTemplate.ott" - self.myPathSelection.sDefaultFilter = "writer8_template" - self.myPathSelection.addSelectionListener(self) - - def initializePaths(self): - try: - self.sTemplatePath = FileAccess.getOfficePath2( - self.xMSF, "Template", "share", "/wizard") - self.sUserTemplatePath = FileAccess.getOfficePath2( - self.xMSF, "Template", "user", "") - except NoValidPathException: - traceback.print_exc() - - ''' - bind controls to the agenda member (DataAware model) - ''' - - def initConfiguration(self): - # read configuration data. - root = Configuration.getConfigurationRoot( - self.xMSF, "/org.openoffice.Office.Writer/Wizards/Agenda", False) - self.agenda.readConfiguration(root, "cp_") - - self.setControlProperty( - "listPageDesign", "StringItemList", - tuple(self.agendaTemplates[0])) - UnoDataAware.attachListBox( - self.agenda, "cp_AgendaType", self.listPageDesign, True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_IncludeMinutes", self.chkMinutes, True).updateUI() - UnoDataAware.attachEditControl( - self.agenda, "cp_Title", self.txtTitle, True).updateUI() - UnoDataAware.attachDateControl( - self.agenda, "cp_Date", self.txtDate, True).updateUI() - UnoDataAware.attachTimeControl( - self.agenda, "cp_Time", self.txtTime, True).updateUI() - UnoDataAware.attachEditControl( - self.agenda, "cp_Location", self.cbLocation, True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowMeetingType", self.chkMeetingTitle, - True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowRead", self.chkRead, True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowBring", self.chkBring, True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowNotes", self.chkNotes, True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowCalledBy", self.chkConvenedBy, - True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowFacilitator", self.chkPresiding, - True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowNotetaker", self.chkNoteTaker, - True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowTimekeeper", self.chkTimekeeper, - True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowAttendees", self.chkAttendees, - True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowObservers", self.chkObservers, - True).updateUI() - UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowResourcePersons",self.chkResourcePersons, - True).updateUI() - UnoDataAware.attachEditControl( - self.agenda, "cp_TemplateName", self.txtTemplateName, - True).updateUI() - RadioDataAware.attachRadioButtons( - self.agenda, "cp_ProceedMethod", - (self.optCreateAgenda, self.optMakeChanges), True).updateUI() - - def saveConfiguration(self): - root = Configuration.getConfigurationRoot( - self.xMSF, "/org.openoffice.Office.Writer/Wizards/Agenda", True) - self.agenda.writeConfiguration(root, "cp_") - root.commitChanges() - - def insertRoadmap(self): - self.addRoadmap() - - self.insertRoadMapItems( - [True, True, True, True, True, True], - [self.resources.resStep1, self.resources.resStep2, - self.resources.resStep3, self.resources.resStep4, - self.resources.resStep5, self.resources.resStep6]) - - self.setRoadmapInteractive(True) - self.setRoadmapComplete(True) - self.setCurrentRoadmapItemID(1) - - ''' - read the available agenda wizard templates. - ''' - - def initializeTemplates(self): - try: - self.sTemplatePath = FileAccess.getOfficePath2( - self.xMSF, "Template", "share", "/wizard") - sAgendaPath = FileAccess.combinePaths( - self.xMSF, self.sTemplatePath, "/wizard/agenda") - self.agendaTemplates = FileAccess.getFolderTitles( - self.xMSF, "aw", sAgendaPath) - return True - except NoValidPathException: - traceback.print_exc() - return False - - ''' - first page, page design listbox changed. - ''' - - def pageDesignChanged(self): - try: - SelectedItemPos = self.listPageDesign.SelectedItemPos - #avoid to load the same item again - if AgendaWizardDialogImpl.pageDesign is not SelectedItemPos: - AgendaWizardDialogImpl.pageDesign = SelectedItemPos - self.agendaTemplate.load( - self.agendaTemplates[1][SelectedItemPos], - self.topicsControl.scrollfields) - except Exception: - traceback.print_exc() - - #textFields listeners - def txtTitleTextChanged(self): - self.agendaTemplate.redrawTitle("txtTitle") - - def txtDateTextChanged(self): - self.agendaTemplate.redrawTitle("txtDate") - - def txtTimeTextChanged(self): - self.agendaTemplate.redrawTitle("txtTime") - - def txtLocationTextChanged(self): - self.agendaTemplate.redrawTitle("cbLocation") - - #checkbox listeners - def chkUseMeetingTypeItemChanged(self): - self.agendaTemplate.agenda.cp_IncludeMinutes = bool(self.chkMinutes.State) - - def chkUseMeetingTypeItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_MEETING_TYPE) - - def chkUseReadItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_READ) - - def chkUseBringItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_BRING) - - def chkUseNotesItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_NOTES) - - def chkUseCalledByItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_CALLED_BY) - - def chkUseFacilitatorItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_FACILITATOR) - - def chkUseNoteTakerItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_NOTETAKER) - - def chkUseTimeKeeperItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_TIMEKEEPER) - - def chkUseAttendeesItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_PARTICIPANTS) - - def chkUseObserversItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_OBSERVERS) - - def chkUseResourcePersonsItemChanged(self): - self.agendaTemplate.redraw(self.templateConsts.FILLIN_RESOURCE_PERSONS) - - def insertRow(self): - self.topicsControl.insertRow() - - def removeRow(self): - self.topicsControl.removeRow() - - def rowUp(self): - self.topicsControl.rowUp() - - def rowDown(self): - self.topicsControl.rowDown() - - def cancelWizard(self): - self.xUnoDialog.endExecute() - self.running = False - - def finishWizard(self): - self.switchToStep(self.getCurrentStep(), self.nMaxStep) - bSaveSuccess = False - endWizard = True - try: - fileAccess = FileAccess(self.xMSF) - self.sPath = self.myPathSelection.getSelectedPath() - if not self.sPath: - self.myPathSelection.triggerPathPicker() - self.sPath = self.myPathSelection.getSelectedPath() - - self.sPath = fileAccess.getURL(self.sPath) - #first, if the filename was not changed, thus - #it is coming from a saved session, check if the - # file exists and warn the user. - if not self.filenameChanged: - if fileAccess.exists(self.sPath, True): - answer = SystemDialog.showMessageBox( - self.xMSF, "MessBox", YES_NO + DEF_NO, - self.resources.resOverwriteWarning, - self.xUnoDialog.Peer) - if answer == 3: - # user said: no, do not overwrite - endWizard = False - return False - - xDocProps = self.agendaTemplate.xTextDocument.DocumentProperties - xDocProps.Title = self.txtTemplateName.Text - self.agendaTemplate.setWizardTemplateDocInfo( \ - self.resources.resAgendaWizardDialog_title, - self.resources.resTemplateDescription) - bSaveSuccess = OfficeDocument.store( - self.xMSF, self.agendaTemplate.xTextDocument, self.sPath, - "writer8_template") - - if bSaveSuccess: - self.saveConfiguration() - - self.agendaTemplate.finish(self.topicsControl.scrollfields) - - loadValues = range(2) - loadValues[0] = uno.createUnoStruct( \ - 'com.sun.star.beans.PropertyValue') - loadValues[0].Name = "AsTemplate" - if self.agenda.cp_ProceedMethod == 1: - loadValues[0].Value = True - else: - loadValues[0].Value = False - - loadValues[1] = uno.createUnoStruct( \ - 'com.sun.star.beans.PropertyValue') - loadValues[1].Name = "InteractionHandler" - - xIH = self.xMSF.createInstance( - "com.sun.star.comp.uui.UUIInteractionHandler") - loadValues[1].Value = xIH - - oDoc = OfficeDocument.load( - Desktop.getDesktop(self.xMSF), - self.sPath, "_default", loadValues) - myViewHandler = ViewHandler(self.xMSF, oDoc) - myViewHandler.setViewSetting("ZoomType", OPTIMAL) - else: - pass - - except Exception: - traceback.print_exc() - finally: - if endWizard: - self.xUnoDialog.endExecute() - self.running = False - return True - - def closeDocument(self): - try: - xCloseable = self.agendaTemplate.xFrame.close(False) - except CloseVetoException: - traceback.print_exc() - - def validatePath(self): - if self.myPathSelection.usedPathPicker: - self.filenameChanged = True - self.myPathSelection.usedPathPicker = False diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py deleted file mode 100644 index a88b7f4c2ca6..000000000000 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py +++ /dev/null @@ -1,178 +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 . -# -from ..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, - AgendaWizardDialogResources.MODULE_NAME) - #Delete the String, uncomment the getResText method - self.resAgendaWizardDialog_title = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 1) - self.resoptMakeChanges_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 2) - self.reslblTemplateName_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 3) - self.reslblTemplatePath_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 4) - self.reslblProceed_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 5) - self.reslblTitle1_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 6) - self.reslblTitle3_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 7) - self.reslblTitle2_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 8) - self.reslblTitle4_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 9) - self.reslblTitle5_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 10) - self.reslblTitle6_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 11) - self.reschkMinutes_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 12) - self.reslblHelp1_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 13) - self.reslblTime_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 14) - self.reslblTitle_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 15) - self.reslblLocation_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 16) - self.reslblHelp2_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 17) - self.resbtnTemplatePath_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 18) - self.resoptCreateAgenda_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 19) - self.reslblHelp6_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 20) - self.reslblTopic_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 21) - self.reslblResponsible_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 22) - self.reslblDuration_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 23) - self.reschkConvenedBy_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 24) - self.reschkPresiding_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 25) - self.reschkNoteTaker_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 26) - self.reschkTimekeeper_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 27) - self.reschkAttendees_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 28) - self.reschkObservers_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 29) - self.reschkResourcePersons_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 30) - self.reslblHelp4_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 31) - self.reschkMeetingTitle_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 32) - self.reschkRead_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 33) - self.reschkBring_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 34) - self.reschkNotes_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 35) - self.reslblHelp3_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 36) - self.reslblDate_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 38) - self.reslblHelpPg6_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 39) - self.reslblPageDesign_value = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 40) - self.resDefaultFilename = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 41) - self.resDefaultFilename = self.resDefaultFilename[:-4] + ".ott" - self.resDefaultTitle = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 42) - self.resErrSaveTemplate = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 43) - self.resPlaceHolderTitle = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 44) - self.resPlaceHolderDate = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 45) - self.resPlaceHolderTime = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 46) - self.resPlaceHolderLocation = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 47) - self.resPlaceHolderHint = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 48) - self.resStep1 = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 50) - self.resStep2 = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 51) - self.resStep3 = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 52) - self.resStep4 = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 53) - self.resStep5 = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 54) - self.resStep6 = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 55) - self.resErrOpenTemplate = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 56) - self.itemMeetingType = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 57) - self.itemBring = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 58) - self.itemRead = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 59) - self.itemNote = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 60) - self.itemCalledBy = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 61) - self.itemFacilitator = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 62) - self.itemAttendees = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 63) - self.itemNotetaker = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 64) - self.itemTimekeeper = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 65) - self.itemObservers = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 66) - self.itemResource = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 67) - self.resButtonInsert = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 68) - self.resButtonRemove = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 69) - self.resButtonUp = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 70) - self.resButtonDown = self.getResText( - AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 71) - - #Common Resources - self.resOverwriteWarning = self.getResText( - AgendaWizardDialogResources.RID_COMMON_START + 19) - self.resTemplateDescription = self.getResText( - AgendaWizardDialogResources.RID_COMMON_START + 20) diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.py b/wizards/com/sun/star/wizards/agenda/CGAgenda.py deleted file mode 100644 index 32d033ed3803..000000000000 --- a/wizards/com/sun/star/wizards/agenda/CGAgenda.py +++ /dev/null @@ -1,44 +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 . -# -from ..common.ConfigGroup import ConfigGroup -from ..common.ConfigSet import ConfigSet -from .CGTopic import CGTopic - -class CGAgenda(ConfigGroup): - cp_AgendaType = int() - cp_IncludeMinutes = bool() - cp_Title = "" - cp_Date = str() - cp_Time = str() - cp_Location = "" - cp_ShowMeetingType = bool() - cp_ShowRead = bool() - cp_ShowBring = bool() - cp_ShowNotes = bool() - cp_ShowCalledBy = bool() - cp_ShowFacilitator = bool() - cp_ShowNotetaker = bool() - cp_ShowTimekeeper = bool() - cp_ShowAttendees = bool() - cp_ShowObservers = bool() - cp_ShowResourcePersons = bool() - cp_TemplateName = str() - cp_TemplatePath = str() - cp_ProceedMethod = int() - - cp_Topics = ConfigSet(CGTopic()) diff --git a/wizards/com/sun/star/wizards/agenda/CGTopic.py b/wizards/com/sun/star/wizards/agenda/CGTopic.py deleted file mode 100644 index 50ebc4d1d03a..000000000000 --- a/wizards/com/sun/star/wizards/agenda/CGTopic.py +++ /dev/null @@ -1,62 +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 . -# -from ..common.ConfigGroup import ConfigGroup - -''' -CGTopic means: Configuration Group Topic. -This object encapsulates a configuration group with topic information. -Since the topics gui conftrol uses its own data model, there is -also code here to convert from the data model to CGTopic object (the constructor) -and vice versa (setDataToRow method - used when loading the last session...) -''' - -class CGTopic(ConfigGroup): - - cp_Index = int() - cp_Topic = str() - cp_Responsible = str() - cp_Time = str() - - ''' - create a new CGTopic object with data from the given row. - the row object is a PropertyValue array, as used - by the TopicsControl's data model. - @param row PropertyValue array as used by the TopicsControl data model. - ''' - - def __init__(self, row=None): - if row is None: - return - num = row[0].Value - CGTopic.cp_Index = int(row[0].Value[:-1]) - CGTopic.cp_Topic = row[1].Value - CGTopic.cp_Responsible = row[2].Value - CGTopic.cp_Time = row[3].Value - - ''' - copies the data in this CGTopic object - to the given row. - @param row the row object (PropertyValue array) to - copy the data to. - ''' - - def setDataToRow(self, row): - row[0].Value = "" + str(CGTopic.cp_Index) + "." - row[1].Value = CGTopic.cp_Topic - row[2].Value = CGTopic.cp_Responsible - row[3].Value = CGTopic.cp_Time diff --git a/wizards/com/sun/star/wizards/agenda/CallWizard.py b/wizards/com/sun/star/wizards/agenda/CallWizard.py deleted file mode 100644 index 5c76249d4c7f..000000000000 --- a/wizards/com/sun/star/wizards/agenda/CallWizard.py +++ /dev/null @@ -1,50 +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 . -# -import unohelper -import traceback - -from .AgendaWizardDialogImpl import AgendaWizardDialogImpl - -from com.sun.star.task import XJobExecutor - -# implement a UNO component by deriving from the standard unohelper.Base class -# and from the interface(s) you want to implement. -class CallWizard(unohelper.Base, XJobExecutor): - def __init__(self, ctx): - # store the component context for later use - self.ctx = ctx - - def trigger(self, args): - try: - fw = AgendaWizardDialogImpl(self.ctx.ServiceManager) - fw.startWizard(self.ctx.ServiceManager) - except Exception as e: - print ("Wizard failure exception " + str(type(e)) + - " message " + str(e) + " args " + str(e.args) + - traceback.format_exc()) - -# pythonloader looks for a static g_ImplementationHelper variable -g_ImplementationHelper = unohelper.ImplementationHelper() - -g_ImplementationHelper.addImplementation( \ - CallWizard, # UNO object class - "com.sun.star.wizards.agenda.CallWizard", # implemenation name - ("com.sun.star.task.Job",),) # list of implemented services - # (the only service) - -# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/wizards/com/sun/star/wizards/agenda/TemplateConsts.py b/wizards/com/sun/star/wizards/agenda/TemplateConsts.py deleted file mode 100644 index 8d9f6697708d..000000000000 --- a/wizards/com/sun/star/wizards/agenda/TemplateConsts.py +++ /dev/null @@ -1,92 +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 . -# - -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. - - 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/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py deleted file mode 100644 index b934a6ab9570..000000000000 --- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py +++ /dev/null @@ -1,885 +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 . -# -import uno -from .CGTopic import CGTopic -from ..ui.ControlScroller import ControlScroller, PropertyNames, traceback, \ - HelpIds, UnoDialog -from .AgendaWizardDialogConst import HID -from ..common.Properties import Properties -from ..ui.event.CommonListener import FocusListenerProcAdapter, \ - KeyListenerProcAdapter - -from com.sun.star.awt.Key import DOWN, UP, TAB -from com.sun.star.awt.KeyModifier import SHIFT, MOD1 - -''' -@author rpiterman -This class implements the UI functionality of the topics scroller control. -<br/> -During developement, there has been a few changes which were not *fully* done -mainly in converting the topics and time boxes -from combobox and time box to normal textboxes, -so in the code they might be referenced as combobox or timebox. This should be -rather understood as topicstextbox and timetextbox.<br/><br/> -Important behaiviour of this control is that there is always a -blank row at the end, in which the user can enter data.<br/> -Once the row is not blank (thus, the user entered data...), -a new blank row is added.<br/> -Once the user removes the last *unempty* row, binsertRowy deleteing its data, it becomes -the *last empty row* and the one after is being automatically removed.<br/><br/> -The contorl shows 5 rows at a time.<br/> -If, for example, only 2 rows exist (from which the 2ed one is empty...) -then the other three rows, which do not exist in the data model, are disabled. -<br/> -The following other functionality is implemented: -<br/> -0. synchroniting data between controls, data model and live preview. -1. Tab scrolling.<br/> -2. Keyboard scrolling.<br/> -3. Removing rows and adding new rows.<br/> -4. Moving rows up and down. <br/> -<br/> -This control relays on the ControlScroller control which uses the following -Data model:<br/> -1. It uses a vector, whos members are arrays of PropertyValue.<br/> -2. Each array represents a row.<br/> -(Note: the Name and Value memebrs of the PropertyValue object are being used) -3. Each property Value represents a value -for a single control with the following rules:<br/> -3. a. the Value of the property is used for as value -of the controls (usually text).<br/> -3. b. the Name of the property is used to map values -to UI controls in the following manner:<br/> -3. b. 1. only the Name of the first X Rows is regarded, -where X is the number of visible rows (in the ainsertRowgenda wizard this would be 5, -since 5 topic rows are visible on the dialog).<br/> -3. b. 2. The Names of the first X (or 5...) rows are the names -of the UI Controls to hold values. When the control scroller scrolls, -it looks at the first 5 rows and uses the names specified there to map the -current values to the specified controls. <br/> -This data model makes the following limitations on the implementation: -When moving rows, only the values should be moved. The Rows objects, -which contain also the Names of the controls should not be switched. <br/> -also when deleting or inserting rows, attention should be paid that no rows -should be removed or inserted. Instead, only the Values should rotate. <br/><br/> -To save the topics in the registry a ConfigSet of objects of type CGTopic is -being used. -This one is not synchronized "live", since it is unnecessary... instead, it is -synchronized on call, before the settings should be saved. -''' - -class TopicsControl(ControlScroller): - - LABEL = "lblTopicCnt_" - TOPIC = "txtTopicTopic_" - RESP = "cbTopicResp_" - TIME = "txtTopicTime_" - nscrollvalue = 0 - LABEL_PROPS = (PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - TEXT_PROPS = (PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - lastFocusRow = 0 - lastFocusControl = None - - def __init__(self, dialog, xmsf, agenda): - try: - super(TopicsControl, self).__init__( - dialog, xmsf, 5, 92, 38, 212, 5, 18, HID + 32) - self.initializeScrollFields(agenda) - # set some focus listeners for TAB scroll down and up... - # prepare scroll down on tab press... - self.lastTime = \ - self.ControlGroupVector[self.nblockincrement - 1].timebox - - self.lastTime.addKeyListener(KeyListenerProcAdapter( - self.lastControlKeyPressed)) - #prepare scroll up on tab press... - self.firstTopic = self.ControlGroupVector[0].textbox - self.firstTopic.addKeyListener(KeyListenerProcAdapter( - self.firstControlKeyPressed)) - self.enableButtons() - except Exception: - traceback.print_exc() - - ''' - initializes the data of the control. - @param agenda - ''' - - def initializeScrollFields(self, agenda): - # create a row for each topic with the given values.... - for i in range(agenda.cp_Topics.getSize()): - row = self.newRow(i) - agenda.cp_Topics.getElementAt(i).setDataToRow(row) - # a parent class method - self.registerControlGroup(row, i) - self.updateDocumentRow(i) - # inserts a blank row at the end... - self.insertRowAtEnd() - - ''' - Insert a blank (empty) row - as last row of the control. - The control has always a blank row at the - end, which enables the user to enter data... - ''' - - @classmethod - def insertRowAtEnd(self): - l = len(ControlScroller.scrollfields) - self.registerControlGroup(self.newRow(l), l) - self.setTotalFieldCount(l + 1) - # if the new row is visible, it must have been disabled - # so it should be now enabled... - if l - ControlScroller.nscrollvalue < self.nblockincrement: - self.ControlGroupVector[l - ControlScroller.nscrollvalue].\ - setEnabled(True) - - ''' - remove the last row - ''' - - @classmethod - def removeLastRow(self): - l = len(ControlScroller.scrollfields) - # if we should scroll up... - if (l - ControlScroller.nscrollvalue) >= 1 \ - and (l - ControlScroller.nscrollvalue) <= self.nblockincrement \ - and ControlScroller.nscrollvalue > 0: - while (l - ControlScroller.nscrollvalue >= 1) \ - and l - ControlScroller.nscrollvalue <= self.nblockincrement \ - and ControlScroller.nscrollvalue > 0: - self.setScrollValue(ControlScroller.nscrollvalue - 1) - # if we should disable a row... - elif ControlScroller.nscrollvalue == 0 and l - 1 < self.nblockincrement: - self.ControlGroupVector[l - 1].setEnabled(False) - - self.unregisterControlGroup(l - 1) - self.setTotalFieldCount(l - 1) - - ''' - in order to use the "move up", "down" "insert" and "remove" buttons, - we track the last control the gained focus, in order to know which - row should be handled. - @param fe - ''' - - @classmethod - def focusGained(self, fe): - xc = fe.Source - self.focusGained2(xc) - - ''' - Sometimes I set the focus programatically to a control - (for example when moving a row up or down, the focus should move - with it). - In such cases, no VCL event is being triggered so it must - be called programtically. - This is done by this method. - @param control - ''' - - @classmethod - def focusGained2(self, control): - try: - #calculate in which row we are... - name = control.Model.Name - num = name[name.index("_") + 1:] - TopicsControl.lastFocusRow = int(num) + ControlScroller.nscrollvalue - TopicsControl.lastFocusControl = control - # enable/disable the buttons... - self.enableButtons() - except Exception: - traceback.print_exc() - - ''' - enable or disable the buttons according to the - current row we are in. - ''' - - @classmethod - def enableButtons(self): - UnoDialog.setEnabled( - ControlScroller.CurUnoDialog.btnInsert, - TopicsControl.lastFocusRow < len(ControlScroller.scrollfields)) - UnoDialog.setEnabled( - ControlScroller.CurUnoDialog.btnRemove, - TopicsControl.lastFocusRow < len(ControlScroller.scrollfields) - 1) - if TopicsControl.lastFocusControl is not None: - UnoDialog.setEnabled( - ControlScroller.CurUnoDialog.btnUp, TopicsControl.lastFocusRow > 0) - UnoDialog.setEnabled( - ControlScroller.CurUnoDialog.btnDown, - TopicsControl.lastFocusRow < len(ControlScroller.scrollfields) - 1) - else: - UnoDialog.setEnabled( - ControlScroller.CurUnoDialog.btnUp, False) - UnoDialog.setEnabled( - ControlScroller.CurUnoDialog.btnDown, False) - - ''' - Removes the current row. - See general class documentation explanation about the - data model used and the limitations which explain the implementation here. - ''' - - def removeRow(self): - try: - for i in range(TopicsControl.lastFocusRow, - len(ControlScroller.scrollfields) - 1): - pv1 = ControlScroller.scrollfields[i] - pv2 = ControlScroller.scrollfields[i + 1] - pv1[1].Value = pv2[1].Value - pv1[2].Value = pv2[2].Value - pv1[3].Value = pv2[3].Value - self.updateDocumentRow(i) - if i - ControlScroller.nscrollvalue < self.nblockincrement: - self.fillupControl(i - ControlScroller.nscrollvalue) - - self.removeLastRow() - # update the live preview background document - self.reduceDocumentToTopics() - self.enableButtons() - if TopicsControl.lastFocusControl is not None: - # the focus should return to the edit control - self.focus(TopicsControl.lastFocusControl) - except Exception: - traceback.print_exc() - - ''' - Inserts a row before the current row. - See general class documentation explanation about the - data model used and the limitations which explain the implementation here. - ''' - - def insertRow(self): - try: - self.insertRowAtEnd() - for i in range(len(ControlScroller.scrollfields) - 2, - TopicsControl.lastFocusRow, -1): - pv1 = ControlScroller.scrollfields[i] - pv2 = ControlScroller.scrollfields[i - 1] - pv1[1].Value = pv2[1].Value - pv1[2].Value = pv2[2].Value - pv1[3].Value = pv2[3].Value - self.updateDocumentRow(i) - if i - ControlScroller.nscrollvalue < self.nblockincrement: - self.fillupControl(i - ControlScroller.nscrollvalue) - - # after rotating all the properties from this row on, - # we clear the row, so it is practically a new one... - pv1 = ControlScroller.scrollfields[TopicsControl.lastFocusRow] - pv1[1].Value = "" - pv1[2].Value = "" - pv1[3].Value = "" - # update the preview document. - self.updateDocumentRow(TopicsControl.lastFocusRow) - self.fillupControl( - TopicsControl.lastFocusRow - ControlScroller.nscrollvalue) - self.enableButtons() - - if TopicsControl.lastFocusControl is not None: - self.focus(TopicsControl.lastFocusControl) - except Exception: - traceback.print_exc() - - ''' - create a new row with the given index. - The index is important because it is used in the - Name member of the PropertyValue objects. - To know why see general class documentation above (data model explanation) - @param i the index of the new row - @return - ''' - - @classmethod - def newRow(self, i): - pv = [None] * 4 - pv[0] = Properties.createProperty( - TopicsControl.LABEL + str(i), "" + str(i + 1) + ".") - pv[1] = Properties.createProperty(TopicsControl.TOPIC + str(i), "") - pv[2] = Properties.createProperty(TopicsControl.RESP + str(i), "") - pv[3] = Properties.createProperty(TopicsControl.TIME + str(i), "") - return pv - - ''' - Implementation of ControlScroller - This is a UI method which inserts a new row to the control. - It uses the child-class ControlRow. (see below). - @param _index - @param npos - @see ControlRow - ''' - - def insertControlGroup(self, _index, npos): - oControlRow = ControlRow( - ControlScroller.CurUnoDialog, self.iCompPosX, npos, _index, - ControlRow.tabIndex) - self.ControlGroupVector.append(oControlRow) - ControlRow.tabIndex += 4 - - ''' - Checks if a row is empty. - This is used when the last row is changed. - If it is empty, the next row (which is always blank) is removed. - If it is not empty, a next row must exist. - @param row the index number of the row to check. - @return true if empty. false if not. - ''' - - @classmethod - def isRowEmpty(self, row): - data = self.getTopicData(row) - # now - is this row empty? - return data[1].Value and data[2].Value and data[3].Value - - ''' - update the preview document and - remove/insert rows if needed. - @param guiRow - @param column - ''' - oldData = [] - - @classmethod - def fieldChanged(self, guiRow, column): - try: - # First, I update the document - data = self.getTopicData(guiRow + ControlScroller.nscrollvalue) - if data is None: - return - - dataValue = [i.Value for i in data] - if dataValue == TopicsControl.oldData: - return - else: - TopicsControl.oldData = dataValue - - self.updateDocumentCell( - guiRow + ControlScroller.nscrollvalue, column, data) - if self.isRowEmpty(guiRow + ControlScroller.nscrollvalue): - ''' - if this is the row before the last one - (the last row is always empty) - delete the last row... - ''' - if (guiRow + ControlScroller.nscrollvalue) \ - == len(ControlScroller.scrollfields) - 2: - self.removeLastRow() - '''now consequentially check the last two rows, - and remove the last one if they are both empty. - (actually I check always the "before last" row, - because the last one is always empty... - ''' - while len(ControlScroller.scrollfields) > 1 \ - and self.isRowEmpty(len(ControlScroller.scrollfields) - 2): - removeLastRow() - cr = self.ControlGroupVector[ - ControlScroller.scrollfields.size - ControlScroller.nscrollvalue - 1] - # if a remove was performed, set focus - #to the last row with some data in it... - self.focus(getControl(cr, column)) - # update the preview document. - self.reduceDocumentToTopics() - - else: - # row contains data - # is this the last row? - if (guiRow + ControlScroller.nscrollvalue + 1) \ - == len(ControlScroller.scrollfields): - self.insertRowAtEnd() - - except Exception: - traceback.print_exc() - - ''' - return the corresponding row data for the given index. - @param topic index of the topic to get. - @return a PropertyValue array with the data for the given topic. - ''' - - @classmethod - def getTopicData(self, topic): - if topic < len(ControlScroller.scrollfields): - return ControlScroller.scrollfields[topic] - else: - return None - - ''' - If the user presses tab on the last control, and - there *are* more rows in the model, scroll down. - @param event - ''' - - def lastControlKeyPressed(self, event): - # if tab without shift was pressed... - try: - if event.KeyCode == TAB and event.Modifiers == 0: - # if there is another row... - if (self.nblockincrement + ControlScroller.nscrollvalue) \ - < len(ControlScroller.scrollfields): - self.setScrollValue(ControlScroller.nscrollvalue + 1) - self.focus(self.getControlByIndex(self.ControlGroupVector[4], 1)) - except Exception: - traceback.print_exc() - - ''' - If the user presses shift-tab on the first control, and - there *are* more rows in the model, scroll up. - @param event - ''' - - def firstControlKeyPressed(self, event): - # if tab with shift was pressed... - if (event.KeyCode == TAB) and \ - (event.Modifiers == SHIFT): - if ControlScroller.nscrollvalue > 0: - setScrollValue(ControlScroller.nscrollvalue - 1) - focus(self.lastTime) - - ''' - sets focus to the given control. - @param textControl - ''' - - @classmethod - def focus(self, textControl): - textControl.setFocus() - text = textControl.Text - textControl.Selection = uno.createUnoStruct( \ - 'com.sun.star.awt.Selection', 0, len(text)) - self.focusGained2(textControl) - - ''' - moves the given row one row down. - @param guiRow the gui index of the row to move. - @param control the control to gain focus after moving. - ''' - - def rowDown(self, guiRow=None, control=None): - try: - if guiRow is None and control is None: - guiRow = TopicsControl.lastFocusRow - ControlScroller.nscrollvalue - control = TopicsControl.lastFocusControl - # only perform if this is not the last row. - actuallRow = guiRow + ControlScroller.nscrollvalue - if actuallRow + 1 < len(ControlScroller.scrollfields): - # get the current selection - selection = control.Selection - # the last row should scroll... - scroll = (guiRow == self.nblockincrement - 1) - if scroll: - self.setScrollValue(ControlScroller.nscrollvalue + 1) - - scroll1 = ControlScroller.nscrollvalue - if scroll: - aux = -1 - else: - aux = 1 - self.switchRows(guiRow, guiRow + aux) - if ControlScroller.nscrollvalue != scroll1: - guiRow += (ControlScroller.nscrollvalue - scroll1) - - self.setSelection(guiRow + (not scroll), control, selection) - except Exception: - traceback.print_exc() - - ''' - move the current row up - ''' - - def rowUp(self, guiRow=None, control=None): - try: - if guiRow is None and control is None: - guiRow = TopicsControl.lastFocusRow - ControlScroller.nscrollvalue - control = TopicsControl.lastFocusControl - # only perform if this is not the first row - actuallRow = guiRow + ControlScroller.nscrollvalue - if actuallRow > 0: - # get the current selection - selection = control.Selection - # the last row should scroll... - scroll = (guiRow == 0) - if scroll: - self.setScrollValue(ControlScroller.nscrollvalue - 1) - if scroll: - aux = 1 - else: - aux = -1 - self.switchRows(guiRow, guiRow + aux) - self.setSelection(guiRow - (not scroll), control, selection) - except Exception: - traceback.print_exc() - - ''' - moves the cursor up. - @param guiRow - @param control - ''' - - @classmethod - def cursorUp(self, guiRow, control): - # is this the last full row ? - actuallRow = guiRow + ControlScroller.nscrollvalue - #if this is the first row - if actuallRow == 0: - return - # the first row should scroll... - - scroll = (guiRow == 0) - if scroll: - self.setScrollValue(ControlScroller.nscrollvalue - 1) - upperRow = self.ControlGroupVector[guiRow] - else: - upperRow = self.ControlGroupVector[guiRow - 1] - - self.focus(self.getControl(upperRow, control)) - - ''' - moves the cursor down - @param guiRow - @param control - ''' - - @classmethod - def cursorDown(self, guiRow, control): - # is this the last full row ? - actuallRow = guiRow + ControlScroller.nscrollvalue - #if this is the last row, exit - if actuallRow == len(ControlScroller.scrollfields) - 1: - return - # the first row should scroll... - - scroll = (guiRow == self.nblockincrement - 1) - if scroll: - self.setScrollValue(ControlScroller.nscrollvalue + 1) - lowerRow = self.ControlGroupVector[guiRow] - else: - # if we scrolled we are done... - #otherwise.. - lowerRow = self.ControlGroupVector[guiRow + 1] - - self.focus(self.getControl(lowerRow, control)) - - ''' - changes the values of the given rows with eachother - @param row1 one can figure out what this parameter is... - @param row2 one can figure out what this parameter is... - ''' - - def switchRows(self, row1, row2): - o1 = ControlScroller.scrollfields[row1 + ControlScroller.nscrollvalue] - o2 = ControlScroller.scrollfields[row2 + ControlScroller.nscrollvalue] - temp = None - for i in range(1, len(o1)): - temp = o1[i].Value - o1[i].Value = o2[i].Value - o2[i].Value = temp - self.fillupControl(row1) - self.fillupControl(row2) - self.updateDocumentRow(row1 + ControlScroller.nscrollvalue, o1) - self.updateDocumentRow(row2 + ControlScroller.nscrollvalue, o2) - - ''' - if we changed the last row, add another one... - ''' - if (row1 + ControlScroller.nscrollvalue + 1 == \ - len(ControlScroller.scrollfields)) \ - or (row2 + ControlScroller.nscrollvalue + 1 == \ - len(ControlScroller.scrollfields)): - - self.insertRowAtEnd() - ''' - if we did not change the last row but - we did change the one before - check if we - have two empty rows at the end. - If so, delete the last one... - ''' - elif (row1 + ControlScroller.nscrollvalue) + \ - (row2 + ControlScroller.nscrollvalue) \ - == (len(ControlScroller.scrollfields) * 2 - 5): - if self.isRowEmpty(len(ControlScroller.scrollfields) - 2) \ - and self.isRowEmpty(len(ControlScroller.scrollfields) - 1): - self.removeLastRow() - self.reduceDocumentToTopics() - - ''' - sets a text selection to a given control. - This is used when one moves a row up or down. - After moving row X to X+/-1, the selection (or cursor position) of the - last focused control should be restored. - The control's row is the given guiRow. - The control's column is detecte4d according to the given event. - This method is called as subsequent to different events, - thus it is comfortable to use the event here to detect the column, - rather than in the different event methods. - @param guiRow the row of the control to set the selection to. - @param eventSource helps to detect - the control's column to set the selection to. - @param s the selection object to set. - ''' - - def setSelection(self, guiRow, eventSource, s): - cr = self.ControlGroupVector[guiRow] - control = self.getControl(cr, eventSource) - control.setFocus() - control.setSelection(s) - - ''' - returns a control out of the given row, according to a column number. - @param cr control row object. - @param column the column number. - @return the control... - ''' - - @classmethod - def getControlByIndex(self, cr, column): - tmp_switch_var1 = column - if tmp_switch_var1 == 0: - return cr.label - elif tmp_switch_var1 == 1: - return cr.textbox - elif tmp_switch_var1 == 2: - return cr.combobox - elif tmp_switch_var1 == 3: - return cr.timebox - else: - raise IllegalArgumentException ("No such column"); - - '''getControl - returns a control out of the given row, which is - in the same column as the given control. - @param cr control row object - @param control a control indicating a column. - @return - ''' - - @classmethod - def getControl(self, cr, control): - column = self.getColumn(control) - return self.getControlByIndex(cr, column) - - ''' - returns the column number of the given control. - @param control - @return - ''' - - @classmethod - def getColumn(self, control): - name = control.Model.Name - if name.startswith(TopicsControl.TOPIC): - return 1 - if name.startswith(TopicsControl.RESP): - return 2 - if name.startswith(TopicsControl.TIME): - return 3 - if name.startswith(TopicsControl.LABEL): - return 0 - return -1 - - ''' - update the given row in the preview document with the given data. - @param row - @param data - ''' - - def updateDocumentRow(self, row, data=None): - if data is None: - data = ControlScroller.scrollfields[row] - try: - ControlScroller.CurUnoDialog.agendaTemplate.topics.write( - row, data) - except Exception: - traceback.print_exc() - - ''' - updates a single cell in the preview document. - Is called when a single value is changed, since we really - don't have to update the whole row for one small changhe... - @param row the data row to update (topic number). - @param column the column to update (a gui column, not a document column). - @param data the data of the entire row. - ''' - - @classmethod - def updateDocumentCell(self, row, column, data): - try: - ControlScroller.CurUnoDialog.agendaTemplate.topics.writeCell( - row, column, data) - except Exception: - traceback.print_exc() - - ''' - when removeing rows, this method updates - the preview document to show the number of rows - according to the data model. - ''' - - def reduceDocumentToTopics(self): - try: - ControlScroller.CurUnoDialog.agendaTemplate.topics.reduceDocumentTo( - len(ControlScroller.scrollfields) - 1) - except Exception: - traceback.print_exc() - -''' -@author rp143992 -A class represting a single GUI row. -Note that the instance methods of this class -are being called and handle controls of -a single row. -''' - -class ControlRow(object): - - tabIndex = 520 - ''' - constructor. Create the row in the given dialog given cordinates, - with the given offset (row number) and tabindex. - Note that since I use this specifically for the agenda wizard, - the step and all control coordinates inside the - row are constant (5). - @param dialog the agenda dialog - @param x x coordinates - @param y y coordinates - @param i the gui row index - @param tabindex first tab index for this row. - ''' - - def __init__(self, dialog, x, y, i, tabindex): - self.offset = i - self.dialog = dialog - self.label = self.dialog.insertLabel( - TopicsControl.LABEL + str(i), - TopicsControl.LABEL_PROPS, - (8, "" + str(i + 1) + ".", - x + 4, y + 2, ControlScroller.iStep, tabindex, 10)) - self.textbox = self.dialog.insertTextField( - TopicsControl.TOPIC + str(i), "topicTextChanged", - TopicsControl.TEXT_PROPS, - (12, HelpIds.getHelpIdString(ControlScroller.curHelpIndex + i * 3 + 1), - x + 15, y, ControlScroller.iStep, tabindex + 1, 84), self) - self.combobox = self.dialog.insertTextField( - TopicsControl.RESP + str(i), "responsibleTextChanged", - TopicsControl.TEXT_PROPS, - (12, HelpIds.getHelpIdString(ControlScroller.curHelpIndex + i * 3 + 2), - x + 103, y, ControlScroller.iStep, tabindex + 2, 68), self) - self.timebox = self.dialog.insertTextField( - TopicsControl.TIME + str(i), "timeTextChanged", - TopicsControl.TEXT_PROPS, - (12, HelpIds.getHelpIdString(ControlScroller.curHelpIndex + i * 3 + 3), - x + 175, y, ControlScroller.iStep, tabindex + 3, 20), self) - self.setEnabled(False) - self.textbox.addKeyListener(KeyListenerProcAdapter(self.keyPressed)) - self.combobox.addKeyListener(KeyListenerProcAdapter(self.keyPressed)) - self.timebox.addKeyListener(KeyListenerProcAdapter(self.keyPressed)) - self.textbox.addFocusListener(FocusListenerProcAdapter( - TopicsControl.focusGained)) - self.combobox.addFocusListener(FocusListenerProcAdapter( - TopicsControl.focusGained)) - self.timebox.addFocusListener(FocusListenerProcAdapter( - TopicsControl.focusGained)) - - def topicTextChanged(self): - try: - # update the data model - ControlScroller.fieldInfo(self.offset, 1) - # update the preview document - TopicsControl.fieldChanged(self.offset, 1) - except Exception: - traceback.print_exc() - - ''' - called through an event listener when the - responsible text is changed by the user. - updates the data model and the preview document. - ''' - - def responsibleTextChanged(self): - try: - # update the data model - ControlScroller.fieldInfo(self.offset, 2) - # update the preview document - TopicsControl.fieldChanged(self.offset, 2) - except Exception: - traceback.print_exc() - - ''' - called through an event listener when the - time text is changed by the user. - updates the data model and the preview document. - ''' - - def timeTextChanged(self): - try: - # update the data model - ControlScroller.fieldInfo(self.offset, 3) - # update the preview document - TopicsControl.fieldChanged(self.offset, 3) - except Exception: - traceback.print_exc() - - ''' - enables/disables the row. - @param enabled true for enable, false for disable. - ''' - - def setEnabled(self, enabled): - self.dialog.setEnabled(self.label, enabled) - self.dialog.setEnabled(self.textbox, enabled) - self.dialog.setEnabled(self.combobox, enabled) - self.dialog.setEnabled(self.timebox, enabled) - - ''' - Impelementation of XKeyListener. - Optionally performs the one of the following: - cursor up, or down, row up or down - ''' - - def keyPressed(self, event): - try: - if self.isMoveDown(event): - TopicsControl.rowDown(self.offset, event.Source) - elif self.isMoveUp(event): - TopicsControl.rowUp(self.offset, event.Source) - elif self.isDown(event): - TopicsControl.cursorDown(self.offset, event.Source) - elif self.isUp(event): - TopicsControl.cursorUp(self.offset, event.Source) - - TopicsControl.enableButtons() - except Exception: - traceback.print_exc() - - def isMoveDown(self, e): - return (e.KeyCode == DOWN) and (e.Modifiers == MOD1) - - def isMoveUp(self, e): - return (e.KeyCode == UP) and (e.Modifiers == MOD1) - - def isDown(self, e): - return (e.KeyCode == DOWN) and (e.Modifiers == 0) - - def isUp(self, e): - return (e.KeyCode == UP) and (e.Modifiers == 0) diff --git a/wizards/com/sun/star/wizards/agenda/__init__.py b/wizards/com/sun/star/wizards/agenda/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/wizards/com/sun/star/wizards/agenda/__init__.py +++ /dev/null diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.py b/wizards/com/sun/star/wizards/web/BackgroundsDialog.py deleted file mode 100644 index 9d100b0b7d4e..000000000000 --- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.py +++ /dev/null @@ -1,212 +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 . -# -from ImageListDialog import * -from ImageListDialog import * -from WWHID import HID_BG -from common.SystemDialog import SystemDialog -from common.FileAccess import FileAccess - -class BackgroundsDialog(ImageListDialog): - - def __init__(self, xmsf, set_, resources): - super(BackgroundsDialog, self).__init__(xmsf, HID_BG, - (resources.resBackgroundsDialog, - resources.resBackgroundsDialogCaption, - resources.resOK, - resources.resCancel, - resources.resHelp, - resources.resDeselect, - resources.resOther, - resources.resCounter)) - self.sd = SystemDialog.createOpenDialog(xmsf) - self.sd.addFilter( - resources.resImages, "*.jpg;*.jpeg;*.jpe;*.gif", True) - self.sd.addFilter(resources.resAllFiles, "*.*", False) - self.settings = set_.root - self.fileAccess = FileAccess(xmsf) - #COMMENTED - #self.il.setListModel(Model(set_)) - self.il.imageSize = Size (40, 40) - #self.il.setRenderer(BGRenderer (0)) - self.build() - - ''' - trigered when the user clicks the "other" button. - opens a "file open" dialog, adds the selected - image to the list and to the web wizard configuration, - and then jumps to the new image, selecting it in the list. - @see add(String) - ''' - - def other(self): - filename = self.sd.callOpenDialog( - False, self.settings.cp_DefaultSession.cp_InDirectory) - if filename != None and filename.length > 0 and filename[0] != None: - self.settings.cp_DefaultSession.cp_InDirectory = \ - FileAccess.getParentDir(filename[0]) - i = add(filename[0]) - il.setSelected(i) - il.display(i) - - ''' - adds the given image to the image list (to the model) - and to the web wizard configuration. - @param s - @return - ''' - - def add(self, s): - #first i check the item does not already exists in the list... - i = 0 - while i < il.getListModel().getSize(): - if il.getListModel().getElementAt(i).equals(s): - return i - - i += 1 - il.getListModel().addElement(s) - try: - configView = Configuration.getConfigurationRoot( - self.xMSF, FileAccess.connectURLs( - WebWizardConst.CONFIG_PATH, "BackgroundImages"), True) - i = Configuration.getChildrenNames(configView).length + 1 - o = Configuration.addConfigNode(configView, "" + i) - Configuration.set(s, "Href", o) - Configuration.commit(configView) - except Exception, ex: - ex.printStackTrace() - - return il.getListModel().getSize() - 1 - - ''' - an ImageList Imagerenderer implemtation. - The image URL is the object given from the list model. - the image name, got from the "render" method is - the filename portion of the url. - @author rpiterman - ''' - - class BGRenderer(object): - - def __init__(self, cut_): - ImageListDialog.ImageListDialog_body() - self.cut = cut_ - - def getImageUrls(self, listItem): - if listItem != None: - sRetUrls = range(1) - sRetUrls[0] = listItem - return sRetUrls - - return None - - def render(self, _object): - if _object is None: - return "" - else: - return FileAccess.getPathFilename( - self.fileAccess.getPath(_object, None)) - - ''' - This is a list model for the image list of the - backgrounds dialog. - It takes the Backgrounds config set as an argument, - and "parses" it to a list of files: - It goes through each image in the set, and checks it: - if it is a directory it lists all image files in this directory. - if it is a file, it adds the file to the list. - @author rpiterman - ''' - - class Model(object): - ''' - constructor. </br> - see class description for a description of - the handling of the given model - @param model the configuration set of the background images. - ''' - - def __init__(self, model): - try: - i = 0 - while i < model.getSize(): - image = model.getElementAt(i) - path = self.sd.xStringSubstitution.substituteVariables( - image.cp_Href, False) - if self.fileAccess.exists(path, False): - addDir(path) - else: - remove(model.getKey(image)) - - i += 1 - except Exception, ex: - ex.printStackTrace() - - ''' - when instanciating the model, it checks if each image - exists. If it doesnot, it will be removed from - the configuration. - This is what this method does... - @param imageName - ''' - - def remove(self, imageName): - try: - conf = Configuration.getConfigurationRoot( - self.xMSF, WebWizardConst.CONFIG_PATH + "/BackgroundImages", - True) - Configuration.removeNode(conf, imageName) - except Exception, ex: - ex.printStackTrace() - - ''' - if the given url is a directory - adds the images in the given directory, - otherwise (if it is a file) adds the file to the list. - @param url - ''' - - def addDir(self, url): - if self.fileAccess.isDirectory(url): - add(self.fileAccess.listFiles(url, False)) - else: - add(url) - - ''' - adds the given filenames (urls) to - the list - @param filenames - ''' - - def add(self, filenames): - i = 0 - while i < filenames.length: - add(filenames[i]) - i += 1 - - ''' - adds the given image url to the list. - if and only if it ends with jpg, jpeg or gif - (case insensitive) - @param filename image url. - ''' - - def add(self, filename): - lcase = filename.toLowerCase() - if lcase.endsWith("jpg") or lcase.endsWith("jpeg") or \ - lcase.endsWith("gif"): - Model.this.addElement(filename) diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.py b/wizards/com/sun/star/wizards/web/IconsDialog.py deleted file mode 100644 index efac5858d216..000000000000 --- a/wizards/com/sun/star/wizards/web/IconsDialog.py +++ /dev/null @@ -1,114 +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 . -# -from ImageListDialog import * -from ImageListDialog import * -from WWHID import HID_IS -from common.FileAccess import FileAccess - -''' -@author rpiterman -The dialog class for choosing an icon set. -This class simulates a model, though it does not functions really as one, -since it does not cast events. -It also implements the ImageList.ImageRenderer interface, to handle -its own objects. -''' - -class IconsDialog(ImageListDialog): - - def __init__(self, xmsf, set_, resources): - super(IconsDialog, self).__init__(xmsf, HID_IS, - (resources.resIconsDialog, - resources.resIconsDialogCaption, - resources.resOK, - resources.resCancel, - resources.resHelp, - resources.resDeselect, - resources.resOther, - resources.resCounter)) - self.htmlexpDirectory = FileAccess.getOfficePath2( - xmsf, "Gallery", "share", "") - self.icons = \ - ["firs", "prev", "next", "last", "nav", "text", "up", "down"] - self.set = set_ - self.objects = (self.set.getSize() * len(self.icons),) - - self.il.listModel = self - self.il.renderer = self - self.il.rows = 4 - self.il.cols = 8 - self.il.ImageSize = Size (20, 20) - self.il.showButtons = False - self.il.rowSelect = True - self.il.scaleImages = False - self.showDeselectButton = True - self.showOtherButton = False - self.build() - - def getIconset(self): - if getSelected() == None: - return None - else: - return self.set.getKey((getSelected()) / len(self.icons)) - - def setIconset(self, iconset): - #COMMENTED - icon = 0 #self.set.getIndexOf(self.set.getElement(iconset)) * len(self.icons) - aux = None - if icon >=0: - aux = self.objects[icon] - self.setSelected(aux) - - def getSize(self): - return self.set.getSize() * len(self.icons) - - def getElementAt(self, arg0): - return self.objects[arg0] - - def getImageUrls(self, listItem): - i = (listItem).intValue() - iset = getIconsetNum(i) - icon = getIconNum(i) - sRetUrls = range(2) - sRetUrls[0] = self.htmlexpDirectory + "/htmlexpo/" \ - + getIconsetPref(iset) + self.icons[icon] + getIconsetPostfix(iset) - sRetUrls[1] = sRetUrls[0] - return sRetUrls - - def render(self, object): - if object == None: - return "" - - i = (object).intValue() - iset = getIconsetNum(i) - return getIconset(iset).cp_Name - - def getIconsetNum(self, i): - return i / self.icons.length - - def getIconNum(self, i): - return i % self.icons.length - - def getIconsetPref(self, iconset): - return getIconset(iconset).cp_FNPrefix - - def getIconsetPostfix(self, iconset): - return getIconset(iconset).cp_FNPostfix - - def getIconset(self, i): - return self.set.getElementAt(i) diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.py b/wizards/com/sun/star/wizards/web/ImageListDialog.py deleted file mode 100644 index d9dcf61c66b0..000000000000 --- a/wizards/com/sun/star/wizards/web/ImageListDialog.py +++ /dev/null @@ -1,229 +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 . -# -from ui.UnoDialog2 import * -from ui.UnoDialog2 import * -from ui.ImageList import ImageList -from common.HelpIds import HelpIds - -from com.sun.star.awt import FontDescriptor -from com.sun.star.awt.PushButtonType import OK, CANCEL, HELP, STANDARD -from com.sun.star.awt import Size - -''' -This class is a general implementation for a -dialog which displays a choice of images. -The model and the renderer are -still abstract in this class. -To use the class one should extend it, -in the constructor then set the imageList -properties (member name il) like image size, grid size, -model renderer aso, and then call "build". -This class uses a counter renderer which -gets an expression which contains %START %END %TOTAL and replaces -them with the actual numbers. -<BR/> -two buttons: "other" and "none" which are there -to enable choosing images that are not in the list and -"no image" respectivley, are optional, with default to True, -so dialogs which do not need those, should set the corresponding -members showDeselectButton and/or showOtherButton to false. -<br/> -the consturctor should recieve, among others, an Array of String resources -see constructor documentation for details. - -@author rpiterman -''' - -class ImageListDialog(UnoDialog2): - RES_TITLE = 0 - RES_LABEL = 1 - RES_OK = 2 - RES_CANCEL = 3 - RES_HELP = 4 - RES_DESELECT = 5 - RES_OTHER = 6 - RES_COUNTER = 7 - START = "%START" - END = "%END" - TOTAL = "%TOTAL" - - ''' - @param xmsf - @param resources_ a string array with the following strings : - dialog title, label text, ok, cancel, help, deselect, other. - <br/> if "deselect" and "other" are not displayed, - the array can also be shorter. but if "other" is displayed - and "deselect" not, both must be there :-( - ''' - - def __init__(self, xmsf, hid_, resources_): - super(ImageListDialog, self).__init__(xmsf) - self.hid = hid_ - self.cutFilename = 0 - self.showDeselectButton = True - self.showOtherButton = True - self.fontDescriptor1 = FontDescriptor() - self.resources = resources_ - self.il = ImageList() - self.il.counterRenderer = self.ARenderer( - self.resources[ImageListDialog.RES_COUNTER]) - - ''' - adds the controls to the dialog, depending on - the size of the image list. - This method should be called by subclasses after setting - the il ImageList member properties - ''' - - def build(self): - #set dialog properties... - ilWidth = (self.il.imageSize.Width + self.il.gap.Width) \ - * self.il.cols + self.il.gap.Width - ilHeight = (self.il.imageSize.Height + self.il.gap.Height) \ - * self.il.rows + self.il.gap.Height - dialogWidth = 6 + ilWidth + 6 + 50 + 6 - dialogHeight = 3 + 16 + 3 + (ilHeight + 8 + 14) + 6 - Helper.setUnoPropertyValues( - self.xDialogModel, - ("Closeable", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - "Moveable", - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - "Title", - PropertyNames.PROPERTY_WIDTH), - (True, dialogHeight, HelpIds.getHelpIdString(self.hid), True, - "imgDialog", 59, 24, 1, - self.resources[ImageListDialog.RES_TITLE],dialogWidth)) - #Set member- FontDescriptors... - self.fontDescriptor1.Weight = 150 - PROPNAMES = ("DefaultButton", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - "PushButtonType", - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - iButtonsX = 6 + ilWidth + 6 - self.btnOK = self.insertButton( - "btnOK", None, PROPNAMES, - (True, 14, HelpIds.getHelpIdString(self.hid + 3), - self.resources[ImageListDialog.RES_OK], "btnOK", - iButtonsX, 22, uno.Any("short", OK), 7, 50), self) - self.btnCancel = self.insertButton( - "btnCancel", None, PROPNAMES, - (False, 14, HelpIds.getHelpIdString(self.hid + 4), - self.resources[ImageListDialog.RES_CANCEL], "btnCancel", - iButtonsX, 41, uno.Any("short", CANCEL), 8, 50), self) - self.btnHelp = self.insertButton( - "btnHelp", None, PROPNAMES, - (False, 14, "", self.resources[ImageListDialog.RES_HELP], - "CommandButton3", iButtonsX, 71, - uno.Any("short", HELP), 9, 50), self) - if self.showOtherButton: - aux = 0 - if self.showDeselectButton: - aux = 19 - otherY = 22 + ilHeight - 14 - aux - self.btnOther = self.insertButton( - "btnOther", "other", PROPNAMES, - (False, 14, HelpIds.getHelpIdString(self.hid + 1), - self.resources[ImageListDialog.RES_OTHER], "btnOther", - iButtonsX, otherY, - uno.Any("short", STANDARD), 5, 50), self) - - if self.showDeselectButton: - deselectY = 22 + ilHeight - 14 - self.btnDeselect = self.insertButton( - "btnNoImage", "deselect", PROPNAMES, - (False, 14, HelpIds.getHelpIdString(self.hid + 2), - self.resources[ImageListDialog.RES_DESELECT], "btnNoImage", - iButtonsX, deselectY, - uno.Any("short", STANDARD), 4, 50), self) - - self.il.step = 1 - self.il.pos = Size(6, 22) - self.il.helpURL = self.hid + 5 - self.il.tabIndex = 1 - self.il.create(self) - self.lblTitle = self.insertLabel("lblTitle", - ("FontDescriptor", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (self.fontDescriptor1, 8, - self.resources[ImageListDialog.RES_LABEL], - "lblTitle", 6, 6, 1, 4, 216)) - - ''' - is called when the user clicks "none" - ''' - - def deselect(self): - self.il.setSelected(-1) - - ''' - @return the currently elected object. - ''' - - def getSelected(self): - return self.il.getSelectedObject() - - ''' - sets the currently selected object. - @param obj the object (out of the model) to be selected. - ''' - - def setSelected(self, obj): - self.il.setSelected(obj) - self.il.showSelected() - - ''' - The counter renderer, which uses a template. - The template replaces the Strings "%START", "%END" and - "%TOTAL" with the respective values. - @author rpiterman - ''' - class ARenderer(object): - - ''' - @param aTempalte a template for this renderer. - The strings %START, %END ,%TOTAL will be replaced - with the actual values. - ''' - - def __init__(self, aTemplate): - self.template = aTemplate - - def render(self, counter): - s = self.template.replace(ImageListDialog.START, "" + \ - str(counter.start)) - s = s.replace(ImageListDialog.END, "" + str(counter.end)) - s = s.replace(ImageListDialog.TOTAL, "" + str(counter.max)) - return s diff --git a/wizards/com/sun/star/wizards/web/StylePreview.py b/wizards/com/sun/star/wizards/web/StylePreview.py deleted file mode 100644 index eb9510f1c110..000000000000 --- a/wizards/com/sun/star/wizards/web/StylePreview.py +++ /dev/null @@ -1,93 +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 . -# -from common.FileAccess import FileAccess -import traceback - -''' -@author rpiterman -the style preview, which is a OOo Document Preview in -an Image Control. -This class copies the files needed for this -preview from the web wizard work directory -to a given temporary directory, and updates them -on request, according to the current style/background selection -of the user. -''' - -class StylePreview(object): - - ''' - copies the html file to the temp directory, and calculates the - destination names of the background and css files. - @param wwRoot is the root directory of the web wizard files ( - usually [oo]/share/template/[lang]/wizard/web - ''' - - def __init__(self, xmsf, wwRoot_): - self.fileAccess = FileAccess(xmsf) - self.tempDir = self.createTempDir(xmsf) - self.htmlFilename = FileAccess.connectURLs( - self.tempDir, "wwpreview.html") - self.cssFilename = FileAccess.connectURLs(self.tempDir, "style.css") - self.backgroundFilename = FileAccess.connectURLs( - self.tempDir, "images/background.gif") - self.wwRoot = wwRoot_ - self.fileAccess.copy(FileAccess.connectURLs( - self.wwRoot, "preview.html"), self.htmlFilename) - - ''' - copies the given style and background files to the temporary - directory. - @param style - @param background - @throws Exception - ''' - - def refresh(self, style, background): - css = FileAccess.connectURLs(self.wwRoot, "styles/" + style.cp_CssHref) - if background is None or background == "": - #delete the background image - if self.fileAccess.exists(self.backgroundFilename, False): - self.fileAccess.delete(self.backgroundFilename) - else: - # a solaris bug workaround - # TODO - #copy the background image to the temp directory. - self.fileAccess.copy(background, self.backgroundFilename) - - #copy the actual css to the temp directory - self.fileAccess.copy(css, self.cssFilename) - - def cleanup(self): - try: - self.fileAccess.delete(self.tempDir) - except Exception: - traceback.print_exc() - - ''' - creates a temporary directory. - @param xmsf - @return the url of the new directory. - @throws Exception - ''' - - def createTempDir(self, xmsf): - tempPath = FileAccess.getOfficePath2(xmsf, "Temp", "", "") - s = self.fileAccess.createNewDir(tempPath, "wwiz") - self.fileAccess.createNewDir(s, "images") - return s diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py deleted file mode 100644 index 9b48cebc785f..000000000000 --- a/wizards/com/sun/star/wizards/web/WWD_Events.py +++ /dev/null @@ -1,954 +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 . -# -import traceback -from common.Desktop import Desktop -from WWD_Startup import * -from BackgroundsDialog import BackgroundsDialog -from IconsDialog import IconsDialog - -''' -This class implements the ui-events of the -web wizard. -it is therfore sorted to steps. -not much application-logic here - just plain -methods which react to events. -The only exception are the finish methods with the save -session methods. -''' - -class WWD_Events(WWD_Startup): - - iconsDialog = None - bgDialog = None - - ''' - He - my constructor ! - I add a window listener, which, when - the window closes, deltes the temp directory. - ''' - - def __init__(self, xmsf): - super(WWD_Events, self).__init__(xmsf) - self.chkFTP.addKeyListener(None) - self.chkLocalDir.addKeyListener(None) - self.chkZip.addKeyListener(None) - self.currentSession = "" - self.exitOnCreate = True - self.time = 0 - self.count = 0 - - @classmethod - def main(self, args): - ConnectStr = \ - "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" - try: - xmsf = Desktop.connect(ConnectStr) - ww = WWD_Events(xmsf) - ww.show() - ww.cleanup() - except Exception: - traceback.print_exc() - - def leaveStep(self, nOldStep, nNewStep): - pass - - def enterStep(self, old, newStep): - if old == 1: - sessionToLoad = "" - s = Helper.getUnoPropertyValue(lstLoadWWD_Startup.settings.Model, "SelectedItems") - if s.length == 0 or s[0] == 0: - sessionToLoad = "" - else: - sessionToLoad = \ - WWD_Startup.settings.cp_SavedSessions.getElementAt(s[0]).cp_Name - - if not sessionToLoad.equals(self.currentSession): - loadSession(sessionToLoad) - - ''' - ************** - STEP 1 - ************** - ''' - - ''' - Called from the Uno event dispatcher when the - user selects a saved session. - ''' - def sessionSelected(self): - s = Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems") - setEnabled(btnDelSession, s.length > 0 and s[0] > 0) - - ''' - Ha ! the session should be loaded :-) - ''' - - def loadSession(self, sessionToLoad): - try: - sd = self.getStatusDialog() - #task = Task("LoadDocs", "", 10) - sd.execute(this, task, resources.resLoadingSession) - #task.start() - self.setSelectedDoc(WWD_Events.EMPTY_SHORT_ARRAY) - Helper.setUnoPropertyValue( - lstDocuments.Model, "SelectedItems", WWD_Events.EMPTY_SHORT_ARRAY) - Helper.setUnoPropertyValue( - lstDocuments.Model, "StringItemList", WWD_Events.EMPTY_STRING_ARRAY) - if not sessionToLoad: - view = Configuration.getConfigurationRoot( - xMSF, CONFIG_PATH + "/DefaultSession", False) - else: - view = Configuration.getConfigurationRoot( - xMSF, CONFIG_PATH + "/SavedSessions", False) - view = Configuration.getNode(sessionToLoad, view) - - session = CGSession() - session.root = settings - session.readConfiguration(view, CONFIG_READ_PARAM) - #task.setMax(session.cp_Content.cp_Documents.getSize() * 5 + 7) - #task.advance(True) - if sessionToLoad == "": - setSaveSessionName(session) - - mount(session, task, False, sd.self.xUnoDialog) - checkSteps() - self.currentSession = sessionToLoad - '''while task.getStatus() <= task.getMax(): - task.advance(False) - task.removeTaskListener(sd)''' - except Exception, ex: - unexpectedError(ex) - - try: - refreshStylePreview() - updateIconsetText() - except Exception, e: - # TODO Auto-generated catch block - e.printStackTrace() - - ''' - hmm. the user clicked the delete button. - ''' - - def delSession(self): - selected = Helper.getUnoPropertyValue( - lstLoadWWD_Startup.settings.Model, "SelectedItems") - if selected.length == 0: - return - - if selected[0] == 0: - return - - confirm = AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, resources.resDelSessionConfirm, - ErrorHandler.ERROR_QUESTION_NO) - if confirm: - try: - name = WWD_Startup.settings.cp_SavedSessions.getKey(selected[0]) - # first delete the session from the registry/configuration. - Configuration.removeNode( - self.xMSF, CONFIG_PATH + "/SavedSessions", name) - # then delete WWD_Startup.settings.cp_SavedSessions - WWD_Startup.settings.cp_SavedSessions.remove(selected[0]) - WWD_Startup.settings.savedSessions.remove(selected[0] - 1) - nextSelected = [0] - # We try to select the same item index again, if possible - if WWD_Startup.settings.cp_SavedSessions.getSize() > selected[0]: - nextSelected[0] = selected[0] - else: - # this will always be available because - # the user can not remove item 0. - nextSelected[0] = (short)(selected[0] - 1) - # if the <none> session will - # be selected, disable the remove button... - if nextSelected[0] == 0: - Helper.setUnoPropertyValue( - btnDelSession.Model, - PropertyNames.PROPERTY_ENABLED, False) - # select... - - Helper.setUnoPropertyValue( - lstLoadWWD_Startup.settings.Model, "SelectedItems", nextSelected) - - except Exception, ex: - ex.printStackTrace() - unexpectedError(ex) - - ''' - ************** - STEP 2 - ************** - ''' - - ''' - when the user clicks another document - in the listbox, this method is called, - and couses the display in - the textboxes title,description, author and export format - to change - ''' - - def setSelectedDoc(self, s): - oldDoc = self.getDoc([WWD_Startup.selectedDoc]) - doc = self.getDoc(s) - if doc is None: - self.fillExportList([]) - #I try to avoid refreshing the export list if - #the same type of document is chosen. - elif oldDoc is None or oldDoc.appType != doc.appType: - self.fillExportList(WWD_Startup.settings.getExporters(doc.appType)) - - WWD_Startup.selectedDoc = s - self.mountList(doc, self.docAware) - self.disableDocUpDown() - - ''' - The user clicks the "Add" button. - This will open a "FileOpen" dialog, - and, if the user chooses more than one file, - will open a status dialog, when validating each document. - ''' - - def addDocument(self): - try: - files = self.getDocAddDialog().callOpenDialog( - True, WWD_Startup.settings.cp_DefaultSession.cp_InDirectory) - if files is None: - return - - task = None #Task("", "", len(files) * 5) - ''' - If more than a certain number - of documents have been added, - open the status dialog. - ''' - if (len(files) > MIN_ADD_FILES_FOR_DIALOG): - sd = self.getStatusDialog() - sd.setLabel(resources.resValidatingDocuments) - sd.execute(this, task, resources.prodName) - oLoadDocs = self.LoadDocs(self.xMSF, self.xUnoDialog, files, self) - oLoadDocs.loadDocuments() - #task.removeTaskListener(sd) - else: - ''' - When adding a single document, do not use a - status dialog... - ''' - oLoadDocs = self.LoadDocs(self.xMSF, self.xUnoDialog, files, self) - oLoadDocs.loadDocuments() - except Exception: - traceback.print_exc() - - ''' - The user clicked delete. - ''' - - def removeDocument(self): - if WWD_Startup.selectedDoc.length == 0: - return - - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( - WWD_Startup.selectedDoc[0]) - # update the selected document - while WWD_Startup.selectedDoc[0] >= getDocsCount(): - WWD_Startup.selectedDoc[0] -= 1 - # if there are no documents... - if WWD_Startup.selectedDoc[0] == -1: - WWD_Startup.selectedDoc = WWD_Events.EMPTY_SHORT_ARRAY - # update the list to show the right selection. - - docListDA.updateUI() - # disables all the next steps, if the list of docuemnts - # is empty. - checkSteps() - - ''' - doc up. - ''' - - def docUp(self): - doc = WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt( - WWD_Startup.selectedDoc[0]) - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( - WWD_Startup.selectedDoc[0]) - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.add( - WWD_Startup.selectedDoc[0] - 1, doc) - docListDA.updateUI() - self.disableDocUpDown() - - ''' - doc down - ''' - - def docDown(self): - doc = WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt( - WWD_Startup.selectedDoc[0]) - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( - WWD_Startup.selectedDoc[0]) - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.add( - (WWD_Startup.selectedDoc[0] + 1), doc) - docListDA.updateUI() - self.disableDocUpDown() - - ''' - ************** - STEP 5 - ************** - ''' - - ''' - the user clicked the "backgrounds" button - ''' - - def chooseBackground(self): - try: - self.setEnabled(self.btnBackgrounds, False) - if WWD_Events.bgDialog is None: - WWD_Events.bgDialog = BackgroundsDialog( - self.xMSF, WWD_Startup.settings.cp_BackgroundImages, - self.resources) - WWD_Events.bgDialog.createWindowPeer(self.xUnoDialog.Peer) - - WWD_Events.bgDialog.setSelected( - WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage) - i = WWD_Events.bgDialog.executeDialogFromParent(self) - if i == 1: - #ok - setBackground(WWD_Events.bgDialog.getSelected()) - except Exception: - traceback.print_exc() - finally: - self.setEnabled(btnBackgrounds, True) - - ''' - invoked when the BackgorundsDialog is "OKed". - ''' - - def setBackground(self, background): - if background == None: - background = "" - - WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage \ - = background - refreshStylePreview() - - ''' - is called when the user clicks "Icon sets" button. - ''' - - def chooseIconset(self): - try: - self.setEnabled(self.btnIconSets, False) - if WWD_Events.iconsDialog is None: - WWD_Events.iconsDialog = IconsDialog( - self.xMSF, WWD_Startup.settings.cp_IconSets, - self.resources) - WWD_Events.iconsDialog.createWindowPeer(self.xUnoDialog.Peer) - - WWD_Events.iconsDialog.setIconset( - WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_IconSet) - i = WWD_Events.iconsDialog.executeDialogFromParent(self) - if i == 1: - #ok - self.setIconset(WWD_Events.iconsDialog.getIconset()) - except Exception: - traceback.print_exc() - finally: - self.setEnabled(btnIconSets, True) - - ''' - invoked when the Iconsets Dialog is OKed. - ''' - - def setIconset(self, icon): - WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_IconSet = icon - updateIconsetText() - - ''' - ************** - STEP 7 - ************** - ''' - - ''' - sets the publishing url of either a local/zip or ftp publisher. - updates the ui.... - ''' - def setPublishUrl(self, publisher, url, number): - if url == None: - return None - - p = getPublisher(publisher) - p.cp_URL = url - p.cp_Publish = True - updatePublishUI(number) - p.overwriteApproved = True - return p - - ''' - updates the ui of a certain publisher - (the text box url) - @param number - ''' - - def updatePublishUI(self, number): - (pubAware.get(number)).updateUI() - (pubAware.get(number + 1)).updateUI() - checkPublish() - - ''' - The user clicks the local "..." button. - ''' - - def setPublishLocalDir(self): - dir = showFolderDialog( - "Local destination directory", "", - WWD_Startup.settings.cp_DefaultSession.cp_OutDirectory) - #if ok was pressed... - setPublishUrl(LOCAL_PUBLISHER, dir, 0) - - ''' - The user clicks the "Configure" FTP button. - ''' - - def setFTPPublish(self): - if showFTPDialog(getPublisher(FTP_PUBLISHER)): - getPublisher - (FTP_PUBLISHER).cp_Publish = True - updatePublishUI(2) - - ''' - show the ftp dialog - @param pub - @return true if OK was pressed, otherwise false. - ''' - - def showFTPDialog(self, pub): - try: - return getFTPDialog(pub).execute(this) == 1 - except Exception, ex: - ex.printStackTrace() - return False - - ''' - the user clicks the zip "..." button. - Choose a zip file... - ''' - - def setZipFilename(self): - sd = getZipDialog() - zipFile = sd.callStoreDialog( - WWD_Startup.settings.cp_DefaultSession.cp_OutDirectory, - resources.resDefaultArchiveFilename) - setPublishUrl(ZIP_PUBLISHER, zipFile, 4) - getPublisher - (ZIP_PUBLISHER).overwriteApproved = True - - ''' - the user clicks the "Preview" button. - ''' - - def documentPreview(self): - try: - if self.docPreview == None: - self.docPreview = TOCPreview( - self.xMSF, settings, resources, - stylePreview.tempDir, myFrame) - - self.docPreview.refresh(settings) - except Exception, ex: - unexpectedError(ex) - - ''' - ************** - FINISH - ************** - ''' - - ''' - This method checks if the given target's path, - added the pathExtension argument, exists, - and asks the user what to do about it. - If the user says its all fine, then the target will - be replaced. - @return true if "create" should continue. false if "create" should abort. - ''' - def publishTargetApproved(self): - result = True - # 1. check local publish target - p = getPublisher(LOCAL_PUBLISHER) - # should publish ? - if (p.cp_Publish): - path = getFileAccess().getPath(p.url, None) - # target exists? - if getFileAccess().exists(p.url, False): - #if its a directory - if getFileAccess().isDirectory(p.url): - #check if its empty - files = getFileAccess().listFiles(p.url, True) - if files.length > 0: - ''' - it is not empty :-( - it either a local publisher or an ftp - (zip uses no directories as target...) - ''' - message = resources.resLocalTragetNotEmpty.replace( - "%FILENAME", path) - result = AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.MESSAGE_WARNING, - ErrorHandler.BUTTONS_YES_NO, ErrorHandler.DEF_NO, - ErrorHandler.RESULT_YES) - if not result: - return result - - else: - #not a directory, but still exists - message = resources.resLocalTargetExistsAsfile.replace( - "%FILENAME", path) - AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.ERROR_PROCESS_FATAL) - return False - - # try to write to the path... - else: - # the local target directory does not exist. - message = resources.resLocalTargetCreate.replace( - "%FILENAME", path) - try: - result = AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.ERROR_QUESTION_YES) - except Exception, ex: - ex.printStackTrace() - - if not result: - return result - # try to create the directory... - - try: - getFileAccess().fileAccess.createFolder(p.cp_URL) - except Exception, ex: - message = resources.resLocalTargetCouldNotCreate.replace( - "%FILENAME", path) - AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.ERROR_PROCESS_FATAL) - return False - - p = getPublisher(ZIP_PUBLISHER) - if p.cp_Publish: - path = getFileAccess().getPath(p.cp_URL, None) - # target exists? - if getFileAccess().exists(p.cp_URL, False): - #if its a directory - if getFileAccess().isDirectory(p.cp_URL): - message = resources.resZipTargetIsDir.replace( - "%FILENAME", path) - AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.ERROR_PROCESS_FATAL) - return False - else: - #not a directory, but still exists ( a file...) - if not p.overwriteApproved: - message = resources.resZipTargetExists.replace( - "%FILENAME", path) - result = AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.ERROR_QUESTION_YES) - if not result: - return False - # 3. check FTP - - p = getPublisher(FTP_PUBLISHER) - # should publish ? - if p.cp_Publish: - path = getFileAccess().getPath(p.cp_URL, None) - # target exists? - if getFileAccess().exists(p.url, False): - #if its a directory - if getFileAccess().isDirectory(p.url): - #check if its empty - files = getFileAccess().listFiles(p.url, True) - if files.length > 0: - ''' - it is not empty :-( - it either a local publisher or an ftp - (zip uses no directories as target...) - ''' - message = resources.resFTPTargetNotEmpty.replace( - "%FILENAME", path) - result = AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.ERROR_QUESTION_CANCEL) - if not result: - return result - - else: - #not a directory, but still exists (as a file) - message = resources.resFTPTargetExistsAsfile.replace( - "%FILENAME", path) - AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.ERROR_PROCESS_FATAL) - return False - - # try to write to the path... - else: - # the ftp target directory does not exist. - message = resources.resFTPTargetCreate.replace( - "%FILENAME", path) - result = AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.ERROR_QUESTION_YES) - if not result: - return result - # try to create the directory... - - try: - getFileAccess().fileAccess.createFolder(p.url) - except Exception, ex: - message = resources.resFTPTargetCouldNotCreate.replace( - "%FILENAME", path) - AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, - ErrorHandler.ERROR_PROCESS_FATAL) - return False - - return True - - ''' - return false if "create" should be aborted. true if everything is fine. - ''' - - def saveSession(self): - try: - node = None - name = getSessionSaveName() - #set documents index field. - docs = WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents - i = 0 - while i < docs.getSize(): - (docs.getElementAt(i)).cp_Index = i - i += 1 - conf = Configuration.getConfigurationRoot( - self.xMSF, CONFIG_PATH + "/SavedSessions", True) - # first I check if a session with the given name exists - try: - node = Configuration.getNode(name, conf) - if node != None: - if not AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, - resources.resSessionExists.replace("${NAME}", name), - ErrorHandler.ERROR_NORMAL_IGNORE): - return False - #remove the old session - - Configuration.removeNode(conf, name) - except NoSuchElementException, nsex: - traceb - - WWD_Startup.settings.cp_DefaultSession.cp_Index = 0; - node = Configuration.addConfigNode(conf, name) - WWD_Startup.settings.cp_DefaultSession.cp_Name = name; - WWD_Startup.settings.cp_DefaultSession.writeConfiguration( - node, CONFIG_READ_PARAM) - WWD_Startup.settings.cp_SavedSessions.reindexSet(conf, name, "Index") - Configuration.commit(conf) - # now I reload the sessions to actualize the list/combo - # boxes load/save sessions. - WWD_Startup.settings.cp_SavedSessions.clear() - confView = Configuration.getConfigurationRoot( - self.xMSF, CONFIG_PATH + "/SavedSessions", False) - WWD_Startup.settings.cp_SavedSessions.readConfiguration( - confView, CONFIG_READ_PARAM) - WWD_Startup.settings.cp_LastSavedSession = name; - self.currentSession = name - # now save the name of the last saved session... - WWD_Startup.settings.cp_LastSavedSession = name; - # TODO add the <none> session... - prepareSessionLists() - ListModelBinder.fillList( - lstLoadSettings, WWD_Startup.settings.cp_SavedSessions.items(), None) - ListModelBinder.fillComboBox( - cbSaveSettings, WWD_Startup.settings.savedSessions.items(), None) - selectSession() - self.currentSession = WWD_Startup.settings.cp_LastSavedSession - return True - except Exception, ex: - ex.printStackTrace() - return False - - def targetStringFor(self, publisher): - p = getPublisher(publisher) - if p.cp_Publish: - return "\n" + getFileAccess().getPath(p.cp_URL, None) - else: - return "" - - ''' - this method will be called when the Status Dialog - is hidden. - It checks if the "Process" was successfull, and if so, - it closes the wizard dialog. - ''' - - def finishWizardFinished(self): - if self.process.getResult(): - targets = targetStringFor(LOCAL_PUBLISHER) + \ - targetStringFor(ZIP_PUBLISHER) + \ - targetStringFor(FTP_PUBLISHER) - message = resources.resFinishedSuccess.replace( - "%FILENAME", targets) - AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, message, ErrorHandler.ERROR_MESSAGE) - if self.exitOnCreate: - self.xDialog.endExecute() - - else: - AbstractErrorHandler.showMessage( - self.xMSF, self.xUnoDialog.Peer, resources.resFinishedNoSuccess, - ErrorHandler.ERROR_WARNING) - - def cancel(self): - xDialog.endExecute() - - ''' - the user clicks the finish/create button. - ''' - - def finishWizard(self): - finishWizard(True) - return True - - ''' - finish the wizard - @param exitOnCreate_ should the wizard close after - a successfull create. - Default is true, - I have a hidden feature which enables false here - ''' - - def finishWizard(self, exitOnCreate_): - self.exitOnCreate = exitOnCreate_ - ''' - First I check if ftp password was set, if not - the ftp dialog pops up - This may happen when a session is loaded, since the - session saves the ftp url and username, but not the password. - ''' - p = getPublisher(FTP_PUBLISHER) - # if ftp is checked, and no proxies are set, and password is empty... - if p.cp_Publish and not proxies and p.password == None or \ - p.password == "": - if showFTPDialog(p): - updatePublishUI(2) - #now continue... - finishWizard2() - - else: - finishWizard2() - - ''' - this method is only called - if ftp-password was eather set, or - the user entered one in the FTP Dialog which - popped up when clicking "Create". - ''' - - def finishWizard2(self): - p = getPublisher(LOCAL_PUBLISHER) - p.url = p.cp_URL - ''' - zip publisher is using another url form... - ''' - p = getPublisher(ZIP_PUBLISHER) - #replace the '%' with '%25' - url1 = JavaTools.replaceSubString(p.cp_URL, "%25", "%") - #replace all '/' with '%2F' - url1 = JavaTools.replaceSubString(url1, "%2F", "/") - p.url = "vnd.sun.star.zip:#" + url1 + "/"; - ''' - and now ftp... - ''' - p = getPublisher(FTP_PUBLISHER) - p.url = FTPDialog.getFullURL(p); - ''' first we check the publishing targets. If they exist we warn and - ask what to do. a False here means the user said "cancel" - (or rather:clicked) - ''' - if not publishTargetApproved(): - return - ''' - In order to save the session correctly, - I return the value of the ftp publisher cp_Publish - property to its original value... - ''' - - p.cp_Publish = __ftp; - #if the "save settings" checkbox is on... - - if isSaveSession(): - # if canceled by user - if not saveSession(): - return - - else: - WWD_Startup.settings.cp_LastSavedSession = "" - - try: - conf = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH, True) - Configuration.set( - WWD_Startup.settings.cp_LastSavedSession, "LastSavedSession", conf) - Configuration.commit(conf) - except Exception, ex: - ex.printStackTrace() - - ''' - again, if proxies are on, I disable ftp before the creation process - starts. - ''' - if proxies: - p.cp_Publish = False - ''' - There is currently a bug, which crashes office when - writing folders to an existing zip file, after deleting - its content, so I "manually" delete it here... - ''' - - p = getPublisher(ZIP_PUBLISHER) - if getFileAccess().exists(p.cp_URL, False): - getFileAccess().delete(p.cp_URL) - - try: - eh = ProcessErrorHandler(xMSF, self.xUnoDialog.Peer, resources) - self.process = Process(settings, xMSF, eh) - pd = getStatusDialog() - pd.setRenderer(ProcessStatusRenderer (resources)) - pd.execute(self, self.process.myTask, resources.prodName) - #process, - self.process.runProcess() - finishWizardFinished() - self.process.myTask.removeTaskListener(pd) - except Exception, ex: - ex.printStackTrace() - - ''' - is called on the WindowHidden event, - deletes the temporary directory. - ''' - - def cleanup(self): - try: - self.dpStylePreview.dispose() - self.stylePreview.cleanup() - - if WWD_Events.bgDialog is not None: - WWD_Events.bgDialog.xComponent.dispose() - - if WWD_Events.iconsDialog is not None: - WWD_Events.iconsDialog.xComponent.dispose() - - if ftpDialog is not None: - ftpDialog.xComponent.dispose() - - xComponent.dispose() - - if ProcessStatusRenderer is not None: - ProcessStatusRenderer.close(False) - - except Exception, ex: - traceback.print_exc() - - class LoadDocs(object): - - def __init__(self,xmsf, xC_, files_, parent_): - self.xMSF = xmsf - self.xC = xC_ - self.files = files_ - self.parent = parent_ - - def loadDocuments(self): - if len(WWD_Startup.selectedDoc) > 0: - offset = WWD_Startup.selectedDoc[0] + 1 - else: - offset = WWD_General.getDocsCount() - - ''' - if the user chose one file, the list starts at 0, - if he chose more than one, the first entry is a directory name, - all the others are filenames. - ''' - if len(self.files) > 1: - start = 1 - else: - start = 0 - - #Number of documents failed to validate. - failed = 0 - - # store the directory - if start == 1: - WWD_General.settings.cp_DefaultSession.cp_InDirectory = files[0] - else: - WWD_General.settings.cp_DefaultSession.cp_InDirectory = \ - FileAccess.getParentDir(self.files[0]) - - ''' - Here i go through each file, and validate it. - If its ok, I add it to the ListModel/ConfigSet - ''' - - for i in xrange(start, len(self.files)): - doc = CGDocument() - - if start == 0: - doc.cp_URL = self.files[i] - else: - doc.cp_URL = FileAccess.connectURLs(files[0], files[i]) - - ''' - so - i check each document and if it is ok I add it. - The failed variable is used only to calculate the place to add - - Error reporting to the user is (or should (-: ) - done in the checkDocument(...) method - ''' - if WWD_Startup.checkDocument(self.xMSF, doc, None, self.xC): - WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.add( - offset + i - failed - start, doc) - else: - failed += 1 - - # if any documents where added, - # set the first one to be the current-selected document. - if len(self.files) > start + failed: - self.parent.setSelectedDoc([offset]) - - # update the ui... - self.parent.docListDA.updateUI(); - # this enables/disables the next steps. - # when no documents in the list, all next steps are disabled - self.parent.checkSteps() - ''' - a small insurance that the status dialog will - really close... - ''' - - #while (self.task.getStatus() < self.task.getMax()): - # self.task.advance(false) diff --git a/wizards/com/sun/star/wizards/web/WWD_General.py b/wizards/com/sun/star/wizards/web/WWD_General.py deleted file mode 100644 index 72a18b9915b2..000000000000 --- a/wizards/com/sun/star/wizards/web/WWD_General.py +++ /dev/null @@ -1,276 +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 . -# -from WebWizardDialog import * -from WebWizardDialog import * -from common.SystemDialog import SystemDialog -from ui.event.ListModelBinder import ListModelBinder - -''' -@author rpiterman -This class implements general methods, used by different sub-classes -(either WWD_Sturtup, or WWD_Events) or both. -''' - -class WWD_General(WebWizardDialog): - - settings = None - - def __init__(self, xmsf): - super(WWD_General, self).__init__(xmsf) - self.xStringSubstitution = SystemDialog.createStringSubstitution(xmsf) - - def getStatusDialog(self): - statusDialog = StatusDialog( - self.xMSF, StatusDialog.STANDARD_WIDTH, - self.resources.resLoadingSession, False, - [self.resources.prodName, "", "", "", "", ""], - HelpIds.getHelpIdString(HID0_STATUS_DIALOG)) - try: - statusDialog.createWindowPeer(xControl.Peer) - except Exception: - traceback.print_exc() - - return statusDialog - - ''' - File Dialog methods - ''' - - def getDocAddDialog(self): - self.docAddDialog = SystemDialog.createOpenDialog(self.xMSF) - for i in xrange(WWD_General.settings.cp_Filters.getSize()): - f = WWD_General.settings.cp_Filters.getElementAt(i) - if f is not None: - self.docAddDialog.addFilter( - f.cp_Name.replace("%PRODNAME", self.resources.prodName), - f.cp_Filter, i == 0) - return self.docAddDialog - - def getZipDialog(self): - if self.zipDialog is None: - self.zipDialog = SystemDialog.createStoreDialog(xMSF) - self.zipDialog.addFilter(self.resources.resZipFiles, "*.zip", True) - - return self.zipDialog - - def getFTPDialog(self, pub): - if self.ftpDialog is None: - try: - self.ftpDialog = FTPDialog.FTPDialog_unknown(xMSF, pub) - self.ftpDialog.createWindowPeer(xControl.getPeer()) - except Exception: - traceback.print_exc() - - return self.ftpDialog - - def showFolderDialog(self, title, description, dir): - if self.folderDialog is None: - self.folderDialog = SystemDialog.createFolderDialog(xMSF) - - return self.folderDialog.callFolderDialog(title, description, dir) - - ''' - returns the document specified - by the given short array. - @param s - @return - ''' - - @classmethod - def getDoc(self, s): - if len(s) == 0: - return None - elif WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() <= s[0]: - return None - else: - return \ - WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.childrenList[s[0]] - - ''' - how many documents are in the list? - @return the number of documents in the docs list. - ''' - - @classmethod - def getDocsCount(self): - return WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() - - ''' - fills the export listbox. - @param listContent - ''' - - def fillExportList(self, listContent): - ListModelBinder.fillList(self.lstDocTargetType, listContent, None) - - ''' - returns a publisher object for the given name - @param name one of the WebWizardConst constants : FTP - @return - ''' - - def getPublisher(self, name): - return WWD_General.settings.cp_DefaultSession.cp_Publishing.getElement(name) - - ''' - @return true if the checkbox "save session" is checked. - ''' - - def isSaveSession(self): - return int(Helper.getUnoPropertyValue( - chkSaveSettings.Model, PropertyNames.PROPERTY_STATE) == 1) - - ''' - @return the name to save the session (step 7) - ''' - - def getSessionSaveName(self): - return Helper.getUnoPropertyValue(getModel(cbSaveSettings), "Text") - - ''' - This method checks the status of the wizards and - enables or disables the 'next' and the 'create' button. - ''' - - def checkSteps(self): - ''' - first I check the document list. - If it is empty, then step3 and on are disabled. - ''' - if self.checkDocList(): - self.checkPublish() - - ''' - enables/disables the steps 3 to 7) - @param enabled true = enabled, false = disabled. - ''' - - def enableSteps(self, enabled): - if not enabled and not self.isStepEnabled(3): - #disbale steps 3-7 - return - - for i in xrange(3,8): - self.setStepEnabled(i, enabled, True) - ''' - in this place i just disable the finish button. - later, in the checkPublish, which is only performed if - this one is true, it will be enabled (if the check - is positive) - ''' - - if not enabled: - self.enableFinishButton(False) - - ''' - Checks if the documents list is - empty. If it is, disables the steps 3-7, and the - create button. - @return - ''' - - def checkDocList(self): - if WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() \ - == 0: - self.enableSteps(False) - return False - else: - self.enableSteps(True) - return True - - ''' - check if the save-settings input is ok. - (eather the checkbox is unmarked, or, - if it is marked, a session name exists. - ''' - - def checkSaveSession(self): - return (not isSaveSession() or not getSessionSaveName() == "") - - ''' - @return false if this publisher is not active, or, if it - active, returns true if the url is not empty... - if the url is empty, throws an exception - ''' - - def checkPublish2(self, s, text, _property): - p = self.getPublisher(s) - if p.cp_Publish: - url = Helper.getUnoPropertyValue(text.Model, _property) - if url is None or url == "": - raise IllegalArgumentException () - else: - return True - - else: - return False - - ''' - - @return false either if publishing input is wrong or there - are no publishing targets chosen. returns true when at least - one target is chosen, *and* all - which are chosen are legal. - If proxies are on, ftp publisher is ignored. - ''' - - def checkPublish_(self): - try: - return \ - self.checkPublish2(LOCAL_PUBLISHER, self.txtLocalDir, "Text") \ - or (not self.proxies and self.checkPublish( - FTP_PUBLISHER, lblFTP, PropertyNames.PROPERTY_LABEL) \ - or self.checkPublish2(ZIP_PUBLISHER, self.txtZip, "Text")) \ - and self.checkSaveSession() - except IllegalArgumentException, ex: - return False - - ''' - This method checks if the publishing - input is ok, and enables and disables - the 'create' button. - public because it is called from - an event listener object. - ''' - - def checkPublish(self): - self.enableFinishButton(self.checkPublish_()) - - ''' - shows a message box "Unexpected Error... " :-) - @param ex - ''' - - def unexpectedError(self, ex): - ex.printStackTrace() - peer = xControl.getPeer() - AbstractErrorHandler.showMessage( - self.xMSF, peer, self.resources.resErrUnexpected, - ErrorHandler.ERROR_PROCESS_FATAL) - - ''' - substitutes path variables with the corresponding values. - @param path a path, which might contain OOo path variables. - @return the path, after substituing path variables. - ''' - - def substitute(self, path): - try: - return self.xStringSubstitution.substituteVariables(path, False) - except Exception, ex: - return path diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py deleted file mode 100644 index 8b00112e4965..000000000000 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.py +++ /dev/null @@ -1,679 +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 . -# -from WWD_General import * -from WWD_General import * -from common.Configuration import Configuration -from common.FileAccess import FileAccess -from data.CGSettings import CGSettings -from data.CGSessionName import CGSessionName -from ui.event.ListModelBinder import ListModelBinder -from ui.event.UnoDataAware import UnoDataAware -from ui.event.RadioDataAware import RadioDataAware -from data.CGDocument import CGDocument -from ui.DocumentPreview import DocumentPreview -from StylePreview import StylePreview -from ui.event.DataAware import DataAware - -from com.sun.star.lang import IllegalArgumentException - -''' -Web Wizard Dialog implementation : Startup. -This class contains the startup implementation and session mounting methods. -<h2> Data Aware Concept </h2> -<p> I use DataAware objects, which synchronize -UI and Data. A DataAware object a kind of interface -between a Value and a UI element. -</P> -<p> -A Value is either a JavaBean property with -a Getter and a Setter or a public class Memeber. -</P> -When the UI Control changes, the Value changes correspondingly. -This depends on WWD_General.settings a Listener which calls the updateData() -method od the DataAware object. -When the Value changes, the UI Control changes respopndingly. -This also depends on WWD_General.settings a Listener which calls the updateUI -method of the DataAware object. -</P> -<P> -here I use only UI Listeners, and keep calling -the updateUI() method whenever I change the Value. -</P> -To contain the Data, I use the Configuration Data Objects -which read themselfs out of the Configuration. they are all located under -the data package. -<p/> -Different groups of DataAware objects are grouped into vectors. -Each group (all elements of a vector) uses the same DataObject, -so when I change the underlying dataObject, I change the whole vector's -DataObject, thus actualizing UI.<br/> -This is what happends when a session loads: I Load the session into -a tree of DataObjects, and change the DataAware's DataObject. <br/> -One could also look at this as a kind of "View-Model" relationship. -The controls are the View, The DataObjects are the Model, containing the -Data rad directly from the configuration, and the DataAware objects -are the controller inbetween. - -@author rpiterman -''' - -class WWD_Startup(WWD_General): - - selectedDoc = () - - ''' - He - my constructor ! - I call/do here in this order: <br/> - Check if ftp http proxy is set, and warn user he can not use - ftp if it is.<br/> - draw NaviBar and steps 1 to 7, incl. Step X, - which is the Layouts ImageList on step 3.<br/> - load the WWD_General.settings from the configuration. <br/> - set the default save session name to the first - available one (sessionX or something like that). <br/> - set the Layouts ImageList ListModel, and call - its "create()" method. <br/> - check the content (documents) specified in the default session.<br/> - fill the list boxes (saved sessions, styles, combobox save session). <br/> - make data aware. <br/> - updateUI (refreshes the display to crrespond to the data in - the default session.)<br/> - fill the documents listbox. <br/> - if proxies are set, disable the ftp controls in step 7. - ''' - - def __init__(self, xmsf): - super(WWD_Startup, self).__init__(xmsf) - self.sda = None - self.docAware = [] - self.designAware = [] - self.genAware = [] - self.pubAware = [] - self.proxies = self.getOOProxies() - soTemplateDir = FileAccess.getOfficePath2( - xmsf, "Template", "share", "/wizard") - exclamationURL = FileAccess.connectURLs( - soTemplateDir, "../wizard/bitmap/caution_16.png") - self.drawNaviBar() - self.buildStep1() - self.buildStep2() - self.buildStep3() - self.buildStep4() - self.buildStep5() - self.buildStep6() - self.buildStep7(self.proxies, exclamationURL) - self.buildStepX() - self.xMSF = xmsf - xDesktop = Desktop.getDesktop(xmsf) - self.myFrame = OfficeDocument.createNewFrame(xmsf, self) - doc = OfficeDocument.createNewDocument( - self.myFrame, "swriter", False, True) - self.loadSettings(doc) - self.setSaveSessionName(WWD_General.settings.cp_DefaultSession) - self.ilLayouts.listModel = WWD_General.settings.cp_Layouts - self.ilLayouts.create(self) - #COMMENTED - self.checkContent(WWD_General.settings.cp_DefaultSession.cp_Content, None, self.xUnoDialog) - #saved sessions, styles, combobox save session. - # also set the chosen saved session... - self.fillLists() - self.makeDataAware() - - self.updateUI() - - # fill the documents listbox. - self.fillDocumentList(self.settings.cp_DefaultSession.cp_Content) - - if self.proxies: - self.setEnabled(btnFTP, False) - self.setEnabled(chkFTP, False) - - ''' - return true if http proxies or other proxies - which do not enable ftp to function correctly are set. - @return true if (http) proxies are on. - @throws Exception - ''' - - def getOOProxies(self): - node = Configuration.getConfigurationRoot( - self.xMSF, "org.openoffice.Inet/Settings", False) - i = int(node.getByName("ooInetProxyType")) - if i== 0: - #no proxies - return False - elif i == 2: - #http proxies - return True - else: - return True - - ''' - calculates the first available session name, - and sets the current session name to it. - The combobox text in step 7 will be updated - automatically when updateUI() is called. - ''' - - def setSaveSessionName(self, session): - maxValue = 0 - length = self.resources.resSessionName - # traverse between the sessions and find the one that - # has the biggest number. - for i in xrange(WWD_General.settings.cp_SavedSessions.getSize()): - sessionName = \ - WWD_General.settings.cp_SavedSessions.getElementAt(i).cp_Name - if sessionName.startswith(self.resources.resSessionName): - maxValue = max(maxValue, int(sessionName[length:])) - - ''' - fills the road map, and sets the necessary properties, - like MaxStep, Complete, Interactive- - Disables the finbihButton. - ''' - - def addRoadMapItems(self): - self.insertRoadMapItems( - [True, True, False, False, False, False, False], - [self.resources.resStep1, self.resources.resStep2, - self.resources.resStep3, self.resources.resStep4, - self.resources.resStep5, self.resources.resStep6, - self.resources.resStep7]) - self.setRoadmapInteractive(True) - self.setRoadmapComplete(True) - self.setCurrentRoadmapItemID(1) - self.nMaxStep = 7 - self.enableFinishButton(False) - - ''' - This method goes through all - the DataAware vectors and objects and - calls their updateUI() method. - In response, the UI is synchronized to - the state of the corresponding data objects. - ''' - def updateUI(self): - DataAware.updateUIs(self.designAware) - DataAware.updateUIs(self.genAware) - DataAware.updateUIs(self.pubAware) - self.sessionNameDA.updateUI() - self.checkPublish() - - ''' - create the peer, add roadmap, - add roadmap items, add style-preview, - disable the steps 3 to 7 if no documents are - on the list, and... show the dialog! - ''' - - def show(self): - try: - xContainerWindow = self.myFrame.getComponentWindow() - self.createWindowPeer(xContainerWindow) - self.addRoadmap() - self.addRoadMapItems() - self.addStylePreview() - self.checkSteps() - self.executeDialogFromComponent(self.myFrame) - self.removeTerminateListener() - except Exception: - traceback.print_exc() - - ''' - initializes the style preview. - ''' - - def addStylePreview(self): - try: - self.dpStylePreview = DocumentPreview(self.xMSF, self.imgPreview) - self.stylePreview = StylePreview( - self.xMSF, WWD_General.settings.workPath) - self.stylePreview.refresh( - WWD_General.settings.cp_DefaultSession.getStyle(), - WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage) - self.dpStylePreview.setDocument( - self.stylePreview.htmlFilename, DocumentPreview.PREVIEW_MODE) - except Exception: - traceback.print_exc() - - ''' - Loads the web wizard WWD_General.settings from the registry. - ''' - - def loadSettings(self, document): - try: - # instanciate - WWD_General.settingsResources = \ - [self.resources.resPages, self.resources.resSlides, - self.resources.resCreatedTemplate, - self.resources.resUpdatedTemplate, - self.resources.resSizeTemplate] - - WWD_General.settings = CGSettings( - self.xMSF, WWD_General.settingsResources, document) - # get configuration view - confRoot = Configuration.getConfigurationRoot( - self.xMSF, CONFIG_PATH, False) - # read - WWD_General.settings.readConfiguration( - confRoot, CONFIG_READ_PARAM) - configSet = WWD_General.settings.cp_DefaultSession.cp_Publishing - # now if path variables are used in publisher paths, they - # are getting replaced here... - for i in xrange(configSet.getSize()): - p = configSet.getElementAt(i) - p.cp_URL = self.substitute(p.cp_URL) - # initialize the WWD_General.settings. - WWD_General.settings.configure(self.xMSF) - # set resource needed for web page. - # sort the styles alphabetically - #COMMENTED - WWD_General.settings.cp_Styles.sort(None) - self.prepareSessionLists() - if self.proxies: - self.__ftp = self.getPublisher(FTP_PUBLISHER).cp_Publish - self.getPublisher(FTP_PUBLISHER).cp_Publish = False - - except Exception: - traceback.print_exc() - - def prepareSessionLists(self): - # now copy the sessions list... - sessions = WWD_General.settings.cp_SavedSessions.childrenList - - WWD_General.settings.savedSessions.clear() - for index,item in enumerate(sessions): - WWD_General.settings.savedSessions.add(index, item) - # add an empty session to the saved session - # list which apears in step 1 - sn = CGSessionName() - sn.cp_Name = self.resources.resSessionNameNone - WWD_General.settings.cp_SavedSessions.add(0, sn) - - ''' - fills the saved session list, the styles list, - and save session combo box. - Also set the selected "load" session to the last session - which was saved. - ''' - - def fillLists(self): - # fill the saved session list. - - ListModelBinder.fillList(self.lstLoadSettings, - WWD_General.settings.cp_SavedSessions.childrenList, None) - # set the selected session to load. (step 1) - self.selectSession() - # fill the styles list. - ListModelBinder.fillList(self.lstStyles, - WWD_General.settings.cp_Styles.childrenList, None) - # fill the save session combobox (step 7) - ListModelBinder.fillComboBox(self.cbSaveSettings, - WWD_General.settings.savedSessions.childrenList, None) - - def selectSession(self): - selectedSession = 0 - if WWD_General.settings.cp_LastSavedSession is not None \ - and not WWD_General.settings.cp_LastSavedSession == "": - ses = WWD_General.settings.cp_SavedSessions.getElement( - settings.cp_LastSavedSession) - if ses is not None: - selectedSession = \ - WWD_General.settings.cp_SavedSessions.getIndexOf(ses) - - Helper.setUnoPropertyValue( - self.lstLoadSettings.Model, "SelectedItems", (selectedSession,)) - - ''' - attaches to each ui-data-control (like checkbox, groupbox or - textbox, no buttons though), a DataObject's JavaBean Property, - or class member. - ''' - - def makeDataAware(self): - #page 1 - ListModelBinder( - self.lstLoadSettings, WWD_General.settings.cp_SavedSessions) - #page 2 : document properties - self.docListDA = UnoDataAware.attachListBox( - self, "selectedDoc", self.lstDocuments, False) - self.docListDA.disableObjects = \ - [self.lnDocsInfo, self.btnRemoveDoc, self.lblDocTitle, - self.txtDocTitle, self.lblDocInfo, self.txtDocInfo, - self.lblDocAuthor, self.txtDocAuthor, self.lblDocExportFormat, - self.lstDocTargetType] - self.docListDA.updateUI() - doc = CGDocument - #dummy - self.docsBinder = ListModelBinder(self.lstDocuments, - WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents) - self.docAware.append(UnoDataAware.attachEditControl( - doc, "cp_Title", self.txtDocTitle, True)) - self.docAware.append(UnoDataAware.attachEditControl( - doc, "cp_Description", self.txtDocInfo, True)) - self.docAware.append(UnoDataAware.attachEditControl( - doc, "cp_Author", self.txtDocAuthor, True)) - self.docAware.append(UnoDataAware.attachListBox( - doc, "Exporter", self.lstDocTargetType, False)) - #page 3 : Layout - design = WWD_General.settings.cp_DefaultSession.cp_Design - - #COMMENTED - #self.sda = SimpleDataAware.SimpleDataAware_unknown(design, DataAware.PropertyValue ("Layout", design), ilLayouts, DataAware.PropertyValue ("Selected", ilLayouts)) - - #self.ilLayouts.addItemListener(None) - #page 4 : layout 2 - self.designAware.append(UnoDataAware.attachCheckBox( - design, "cp_DisplayDescription", self.chbDocDesc, True)) - self.designAware.append(UnoDataAware.attachCheckBox( - design, "cp_DisplayAuthor", self.chbDocAuthor, True)) - self.designAware.append(UnoDataAware.attachCheckBox( - design, "cp_DisplayCreateDate", self.chkDocCreated, True)) - self.designAware.append(UnoDataAware.attachCheckBox( - design, "cp_DisplayUpdateDate", self.chkDocChanged, True)) - self.designAware.append(UnoDataAware.attachCheckBox( - design, "cp_DisplayFilename", self.chkDocFilename, True)) - self.designAware.append(UnoDataAware.attachCheckBox( - design, "cp_DisplayFileFormat", self.chkDocFormat, True)) - self.designAware.append(UnoDataAware.attachCheckBox( - design, "cp_DisplayFormatIcon", self.chkDocFormatIcon, True)) - self.designAware.append(UnoDataAware.attachCheckBox( - design, "cp_DisplayPages", self.chkDocPages, True)) - self.designAware.append(UnoDataAware.attachCheckBox( - design, "cp_DisplaySize", self.chkDocSize, True)) - self.designAware.append(RadioDataAware.attachRadioButtons( - WWD_General.settings.cp_DefaultSession.cp_Design, - "cp_OptimizeDisplaySize", - (self.optOptimize640x480, self.optOptimize800x600, - self.optOptimize1024x768), True)) - #page 5 : Style - ''' - note : on style change, i do not call here refresh ,but rather on - a special method which will perform some display, background and Iconsets changes. - ''' - self.designAware.append(UnoDataAware.attachListBox( - WWD_General.settings.cp_DefaultSession.cp_Design, - "cp_Style", self.lstStyles, False)) - #page 6 : site general props - self.genAware.append(UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, - "cp_Title", self.txtSiteTitle, True)) - self.genAware.append(UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, - "cp_Description", self.txtSiteDesc, True)) - self.genAware.append(UnoDataAware.attachDateControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, - "cp_CreationDate", self.dateSiteCreated, False)) - self.genAware.append(UnoDataAware.attachDateControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, - "cp_UpdateDate", self.dateSiteUpdate, False)) - self.genAware.append(UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, - "cp_Email", self.txtEmail, True)) - self.genAware.append(UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, - "cp_Copyright", self.txtCopyright, True)) - #page 7 : publishing - self.pubAware_( - LOCAL_PUBLISHER, self.chkLocalDir, self.txtLocalDir, False) - self.pubAware_( - FTP_PUBLISHER, self.chkFTP, self.lblFTP, True) - self.pubAware_( - ZIP_PUBLISHER, self.chkZip, self.txtZip, False) - self.sessionNameDA = UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession, "cp_Name", - self.cbSaveSettings, True) - - ''' - A help method to attach a Checkbox and a TextBox to - a CGPublish object properties/class members, - @param publish - @param checkbox - @param textbox - ''' - - def pubAware_(self, publish, checkbox, textbox, isLabel): - p = WWD_General.settings.cp_DefaultSession.cp_Publishing.getElement(publish) - uda = UnoDataAware.attachCheckBox(p, "cp_Publish", checkbox, True) - uda.Inverse = True - uda.disableObjects = [textbox] - self.pubAware.append(uda) - if isLabel: - aux = UnoDataAware.attachLabel(p, "cp_URL", textbox, False) - else: - aux = UnoDataAware.attachEditControl(p, "cp_URL", textbox, False) - self.pubAware.append(aux) - - ''' - Session load methods - (are used both on the start of the wizard and - when the user loads a session) - - Is called when a new session/settings is - loaded. <br/> - Checks the documents (validate), fills the - documents listbox, and changes the - DataAware data objects to the - new session's objects.<br/> - Task advances 4 times in the mount method, - and ??? times for each document in the session. - ''' - - def mount(self, session, task, refreshStyle, xC): - ''' - This checks the documents. If the user - chooses to cancel, the session is not loaded. - ''' - checkContent(session.cp_Content, task, xC) - settings.cp_DefaultSession = session; - mount(session.cp_Content) - task.advance(True) - mount(session.cp_Design, self.designAware) - mount(session.cp_GeneralInfo, self.genAware) - task.advance(True) - mount(session.cp_Publishing.getElement(LOCAL_PUBLISHER), 0) - mount(session.cp_Publishing.getElement(FTP_PUBLISHER), 1) - mount(session.cp_Publishing.getElement(ZIP_PUBLISHER), 2) - task.advance(True) - self.sessionNameDA.setDataObject(session, True) - Helper.setUnoPropertyValue( - chkSaveSettings.Model, PropertyNames.PROPERTY_STATE, 1) - self.docListDA.updateUI() - task.advance(True) - if refreshStyle: - self.refreshStylePreview() - self.updateIconsetText() - - ''' - used to mount the publishing objects. This is somehow cryptic - - there are 6 DataAware objects, 2 for each Publishing Object (CGPublish). - All 6 reside on one Vector (pubAware). - Since, otherwise than other DataAware objects, different - Objects on the same Vector need different DataObjectBinding, - I use this method... - @param data the CGPublish object - @param i the number of the object (0 = local, 1 = ftp, 2 = zip) - ''' - - def mountDataAware(self, data, i): - self.pubAware.get(i * 2).setDataObject(data, True) - self.pubAware.get(i * 2 + 1).setDataObject(data, True) - - ''' - Fills the documents listbox. - @param root the CGContent object - that contains the documents (a ListModel) - ''' - - def fillDocumentList(self, root): - ListModelBinder.fillList(self.lstDocuments, root.cp_Documents.childrenList, None) - #COMMENTED - #self.docsBinder.setListModel(root.cp_Documents) - self.disableDocUpDown() - - ''' - changes the DataAwares Objects' (in - the gioen list) DataObject to the - @param data - @param list - ''' - - def mountList(self, data, _list): - for i in _list: - i.setDataObject(data, True) - - ''' - Checks if the document specified by the given CGDocument - object (cp_URL) exists. Calls also the validate(...) method - of this document. - If the document does not exist, it asks the user whether - to specify a new URL, or forget about this document. - @param doc the document to check. - @param task while loading a session, a status is - displayed, using the Task object to monitor progress. - @return true if the document is ok (a file exists in the given url). - ''' - - @classmethod - def checkDocument(self,xmsf, doc, task, xC): - doc.validate(xmsf, task) - return True - '''except IOError: - relocate = SystemDialog.showMessageBox( - self.xMSF, xC.Peer, "WarningBox", - VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, - getFileAccess().getPath(doc.cp_URL, "") + "\n\n" + \ - self.resources.resSpecifyNewFileLocation) - if relocate == 2: - _file = getDocAddDialog().callOpenDialog( - False, FileAccess.getParentDir(doc.cp_URL)) - if _file is None: - return False - else: - doc.cp_URL = _file[0] - return checkDocument(doc, task, xC) - - else: - return False - - except IllegalArgumentException, iaex: - #file is a directory - SystemDialog.showMessage( - self.xMSF, xControl.Peer, - self.resources.resErrIsDirectory.replace( - "%FILENAME", getFileAccess().getPath(doc.cp_URL, "")), - ErrorHandler.ERROR_PROCESS_FATAL) - return False - except Exception: - #something went wrong. - traceback.print_exc() - SystemDialog.showMessage( - self.xMSF, xControl.Peer, - self.resources.resErrDocValidate.replace( - "%FILENAME", getFileAccess().getPath(doc.cp_URL, "")), - ErrorHandler.ERROR_PROCESS_FATAL) - return False - ''' - - ''' - Checks the documents contained in this content. - @param content - @param task - ''' - - def checkContent(self, content, task, xC): - i = 0 - while i < content.cp_Documents.getSize(): - if not checkDocument(content.cp_Documents.getElementAt(i), task, xC): - # I use here 'i--' since, when the document is removed - # an index change accures - content.cp_Documents.remove(i) - i -= 1 - i += 1 - - ''' - Disables/enables the docUpDown buttons (step 2) - according to the currently selected document - (no doc selected - both disbaled, last doc selected, - down disabled and so on...) - ''' - - def disableDocUpDown(self): - try: - if len(WWD_Startup.selectedDoc) == 0: - aux = False - aux2 = False - else: - if WWD_Startup.selectedDoc[0] == 0: - aux = False - else: - aux = True - - if WWD_Startup.selectedDoc[0] + 1 < \ - WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize(): - aux2 = True - else: - aux2 = False - - self.setEnabled(self.btnDocUp, aux) - self.setEnabled(self.btnDocDown, aux2) - except Exception: - traceback.print_exc() - - def updateBackgroundText(self): - bg = \ - WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage - if bg is None or bg == "": - bg = self.resources.resBackgroundNone - else: - bg = FileAccess.getPathFilename(getFileAccess().getPath(bg, None)) - - Helper.setUnoPropertyValue( - self.txtBackground.Model, PropertyNames.PROPERTY_LABEL, bg) - - def updateIconsetText(self): - iconset = WWD_General.settings.cp_DefaultSession.cp_Design.cp_IconSet - if iconset is None or iconset == "": - iconsetName = self.resources.resIconsetNone - else: - IconSet = WWD_General.settings.cp_IconSets.getElement(iconset) - if IconSet is None: - iconsetName = self.resources.resIconsetNone - else: - iconsetName = IconSet.cp_Name - - Helper.setUnoPropertyValue( - txtIconset.Model, PropertyNames.PROPERTY_LABEL, iconsetName) - - ''' - refreshes the style preview. - I also call here "updateBackgroundtext", because always - when the background is changed, this method - has to be called, so I am walking on the safe side here... - ''' - - def refreshStylePreview(self): - try: - WWD_General.settings.cp_DefaultSession.cp_Design.cp_Style = \ - "style" + \ - str(WWD_General.settings.cp_DefaultSession.cp_Design.cp_Style) - self.updateBackgroundText() - self.stylePreview.refresh(WWD_General.settings.cp_DefaultSession.getStyle(), WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage) - self.dpStylePreview.reload(self.xMSF) - except Exception: - traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/web/WWHID.py b/wizards/com/sun/star/wizards/web/WWHID.py deleted file mode 100644 index acb3ef43e2d8..000000000000 --- a/wizards/com/sun/star/wizards/web/WWHID.py +++ /dev/null @@ -1,154 +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 . -# -HID0_WEBWIZARD = 34200 + 0 -HID0_WEBWIZARD = 34200 + 0 -HID0_HELP = 34200 + 1 -HID0_NEXT = 34200 + 2 -HID0_PREV = 34200 + 3 -HID0_CREATE = 34200 + 4 -HID0_CANCEL = 34200 + 5 -HID0_STATUS_DIALOG = 34200 + 6 #step 1 -HID1_LST_SESSIONS = 34200 + 7 -HID1_BTN_DEL_SES = 34200 + 9 #step 2 -HID2_LST_DOCS = 34200 + 10 -HID2_BTN_ADD_DOC = 34200 + 11 -HID2_BTN_REM_DOC = 34200 + 12 -HID2_BTN_DOC_UP = 34200 + 13 -HID2_BTN_DOC_DOWN = 34200 + 14 -HID2_TXT_DOC_TITLE = 34200 + 15 -HID2_TXT_DOC_DESC = 34200 + 16 -HID2_TXT_DOC_AUTHOR = 34200 + 17 -HID2_LST_DOC_EXPORT = 34200 + 18 -HID2_STATUS_ADD_DOCS = 34200 + 19 #step 3 -HID3_IL_LAYOUTS_IMG1 = 34200 + 20 -HID3_IL_LAYOUTS_IMG2 = 34200 + 21 -HID3_IL_LAYOUTS_IMG3 = 34200 + 22 -HID3_IL_LAYOUTS_IMG4 = 34200 + 23 -HID3_IL_LAYOUTS_IMG5 = 34200 + 24 -HID3_IL_LAYOUTS_IMG6 = 34200 + 25 -HID3_IL_LAYOUTS_IMG7 = 34200 + 26 -HID3_IL_LAYOUTS_IMG8 = 34200 + 27 -HID3_IL_LAYOUTS_IMG9 = 34200 + 28 -HID3_IL_LAYOUTS_IMG10 = 34200 + 29 -HID3_IL_LAYOUTS_IMG11 = 34200 + 30 -HID3_IL_LAYOUTS_IMG12 = 34200 + 31 -HID3_IL_LAYOUTS_IMG13 = 34200 + 32 -HID3_IL_LAYOUTS_IMG14 = 34200 + 33 -HID3_IL_LAYOUTS_IMG15 = 34200 + 34 #step 4 -HID4_CHK_DISPLAY_FILENAME = 34200 + 35 -HID4_CHK_DISPLAY_DESCRIPTION = 34200 + 36 -HID4_CHK_DISPLAY_AUTHOR = 34200 + 37 -HID4_CHK_DISPLAY_CR_DATE = 34200 + 38 -HID4_CHK_DISPLAY_UP_DATE = 34200 + 39 -HID4_CHK_DISPLAY_FORMAT = 34200 + 40 -HID4_CHK_DISPLAY_F_ICON = 34200 + 41 -HID4_CHK_DISPLAY_PAGES = 34200 + 42 -HID4_CHK_DISPLAY_SIZE = 34200 + 43 -HID4_GRP_OPTIMAIZE_640 = 34200 + 44 -HID4_GRP_OPTIMAIZE_800 = 34200 + 45 -HID4_GRP_OPTIMAIZE_1024 = 34200 + 46 #step 5 -HID5_LST_STYLES = 34200 + 47 -HID5_BTN_BACKGND = 34200 + 48 -HID5_BTN_ICONS = 34200 + 49 #step 6 -HID6_TXT_SITE_TITLE = 34200 + 50 -HID6_TXT_SITE_ICON = 34200 + 51 -HID6_BTN_SITE_ICON = 34200 + 52 -HID6_TXT_SITE_DESC = 34200 + 53 -HID6_TXT_SITE_KEYWRDS = 34200 + 54 -HID6_DATE_SITE_CREATED = 34200 + 55 -HID6_DATE_SITE_UPDATED = 34200 + 56 -HID6_NUM_SITE_REVISTS = 34200 + 57 -HID6_TXT_SITE_EMAIL = 34200 + 58 -HID6_TXT_SITE_COPYRIGHT = 34200 + 59 #step 7 -HID7_BTN_PREVIEW = 34200 + 60 -HID7_CHK_PUBLISH_LOCAL = 34200 + 61 -HID7_TXT_LOCAL = 34200 + 62 -HID7_BTN_LOCAL = 34200 + 63 -HID7_CHK_PUBLISH_ZIP = 34200 + 64 -HID7_TXT_ZIP = 34200 + 65 -HID7_BTN_ZIP = 34200 + 66 -HID7_CHK_PUBLISH_FTP = 34200 + 67 -HID7_BTN_FTP = 34200 + 69 -HID7_CHK_SAVE = 34200 + 70 -HID7_TXT_SAVE = 34200 + 71 #web wizard backgrounds dialog -HID_BG = 34200 + 90 -HID_BG_BTN_OTHER = 34200 + 91 -HID_BG_BTN_NONE = 34200 + 92 -HID_BG_BTN_OK = 34200 + 93 -HID_BG_BTN_CANCEL = 34200 + 94 -HID_BG_BTN_BACK = 34200 + 95 -HID_BG_BTN_FW = 34200 + 96 -HID_BG_BTN_IMG1 = 34200 + 97 -HID_BG_BTN_IMG2 = 34200 + 98 -HID_BG_BTN_IMG3 = 34200 + 99 -HID_BG_BTN_IMG4 = 34200 + 100 -HID_BG_BTN_IMG5 = 34200 + 101 -HID_BG_BTN_IMG6 = 34200 + 102 -HID_BG_BTN_IMG7 = 34200 + 103 -HID_BG_BTN_IMG8 = 34200 + 104 -HID_BG_BTN_IMG9 = 34200 + 105 -HID_BG_BTN_IMG10 = 34200 + 106 -HID_BG_BTN_IMG11 = 34200 + 107 -HID_BG_BTN_IMG12 = 34200 + 108 #web wizard icons sets dialog -HID_IS = 41000 + 0 -HID_IS_ICONSETS = 41000 + 1 -HID_IS_BTN_NONE = 41000 + 2 -HID_IS_BTN_OK = 41000 + 3 -HID_IS_BTN_IMG1 = 41000 + 5 -HID_IS_BTN_IMG2 = 41000 + 6 -HID_IS_BTN_IMG3 = 41000 + 7 -HID_IS_BTN_IMG4 = 41000 + 8 -HID_IS_BTN_IMG5 = 41000 + 9 -HID_IS_BTN_IMG6 = 41000 + 10 -HID_IS_BTN_IMG7 = 41000 + 11 -HID_IS_BTN_IMG8 = 41000 + 12 -HID_IS_BTN_IMG9 = 41000 + 13 -HID_IS_BTN_IMG10 = 41000 + 14 -HID_IS_BTN_IMG11 = 41000 + 15 -HID_IS_BTN_IMG12 = 41000 + 16 -HID_IS_BTN_IMG13 = 41000 + 17 -HID_IS_BTN_IMG14 = 41000 + 18 -HID_IS_BTN_IMG15 = 41000 + 19 -HID_IS_BTN_IMG16 = 41000 + 20 -HID_IS_BTN_IMG17 = 41000 + 21 -HID_IS_BTN_IMG18 = 41000 + 22 -HID_IS_BTN_IMG19 = 41000 + 23 -HID_IS_BTN_IMG20 = 41000 + 24 -HID_IS_BTN_IMG21 = 41000 + 25 -HID_IS_BTN_IMG22 = 41000 + 26 -HID_IS_BTN_IMG23 = 41000 + 27 -HID_IS_BTN_IMG24 = 41000 + 28 -HID_IS_BTN_IMG25 = 41000 + 29 -HID_IS_BTN_IMG26 = 41000 + 30 -HID_IS_BTN_IMG27 = 41000 + 31 -HID_IS_BTN_IMG28 = 41000 + 32 -HID_IS_BTN_IMG29 = 41000 + 33 -HID_IS_BTN_IMG30 = 41000 + 34 -HID_IS_BTN_IMG31 = 41000 + 35 -HID_IS_BTN_IMG32 = 41000 + 36 - -# web wizard ftp dialog -HID_FTP = 41000 + 40 -HID_FTP_SERVER = 41000 + 41 -HID_FTP_USERNAME = 41000 + 42 -HID_FTP_PASS = 41000 + 43 -HID_FTP_TEST = 41000 + 44 -HID_FTP_TXT_PATH = 41000 + 45 -HID_FTP_BTN_PATH = 41000 + 46 -HID_FTP_OK = 41000 + 47 -HID_FTP_CANCEL = 41000 + 48 diff --git a/wizards/com/sun/star/wizards/web/WebWizardConst.py b/wizards/com/sun/star/wizards/web/WebWizardConst.py deleted file mode 100644 index 7af2518441f0..000000000000 --- a/wizards/com/sun/star/wizards/web/WebWizardConst.py +++ /dev/null @@ -1,57 +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 . -# -LSTLOADSETTINGS_ITEM_CHANGED = "sessionSelected" # "lstLoadSettingsItemChanged" -LSTLOADSETTINGS_ITEM_CHANGED = "sessionSelected" # "lstLoadSettingsItemChanged" -BTNLOADSESSION_ACTION_PERFORMED = "loadSession" # "btnLoadSessionActionPerformed" -BTNDELSESSION_ACTION_PERFORMED = "delSession" # "btnDelSessionActionPerformed" -BTNADDDOC_ACTION_PERFORMED = "addDocument" # "btnAddDocActionPerformed" -BTNREMOVEDOC_ACTION_PERFORMED = "removeDocument" # "btnRemoveDocActionPerformed" -BTNDOCUP_ACTION_PERFORMED = "docUp" # "btnDocUpActionPerformed" -BTNDOCDOWN_ACTION_PERFORMED = "docDown" # "btnDocDownActionPerformed" -LSTSTYLES_ITEM_CHANGED = "refreshStylePreview" # "lstStylesItemChanged" -BTNBACKGROUNDS_ACTION_PERFORMED = "chooseBackground" # "btnBackgroundsActionPerformed" -BTNICONSETS_ACTION_PERFORMED = "chooseIconset" # "btnIconSetsActionPerformed" -BTNFAVICON_ACTION_PERFORMED = "chooseFavIcon" # "btnFavIconActionPerformed" -BTNPREVIEW_ACTION_PERFORMED = "documentPreview" # "btnPreviewActionPerformed" -BTNFTP_ACTION_PERFORMED = "setFTPPublish" # "btnFTPActionPerformed" -CHKLOCALDIR_ITEM_CHANGED = "checkPublish" # "chkLocalDirItemChanged" -CHKSAVESETTINGS_ITEM_CHANGED = "checkPublish" # "chkSaveSettingsItemChanged" -TXTSAVESETTINGS_TEXT_CHANGED = "checkPublish" # "txtSaveSettingsTextChanged" -BTNLOCALDIR_ACTION_PERFORMED = "setPublishLocalDir" # "btnLocalDirActionPerformed" -BTNZIP_ACTION_PERFORMED = "setZipFilename" # "btnZipActionPerformed" -CONFIG_PATH = "/org.openoffice.Office.WebWizard/WebWizard" -CONFIG_READ_PARAM = "cp_" -TASK = "WWIZ" -TASK_PREPARE = "t-prep" -LOCAL_PUBLISHER = "local" -FTP_PUBLISHER = "ftp" -ZIP_PUBLISHER = "zip" -TASK_EXPORT = "t_exp" -TASK_EXPORT_PREPARE = "t_exp_prep" -TASK_EXPORT_DOCUMENTS = "t_exp_docs" -TASK_GENERATE_PREPARE = "t_gen_prep" -TASK_GENERATE_XSL = "t_gen_x" -TASK_GENERATE_COPY = "t_gen_cp" -TASK_PUBLISH_PREPARE = "t_pub_prep" -TASK_FINISH = "t_fin" - -''' -when the user adds more than this number -of documents to the list, a status dialog opens. -''' -MIN_ADD_FILES_FOR_DIALOG = 2 diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.py b/wizards/com/sun/star/wizards/web/WebWizardDialog.py deleted file mode 100644 index 0fd86c4c8261..000000000000 --- a/wizards/com/sun/star/wizards/web/WebWizardDialog.py +++ /dev/null @@ -1,731 +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 . -# -from ui.WizardDialog import * -from ui.WizardDialog import * -from WebWizardDialogResources import WebWizardDialogResources -from WebWizardConst import * -from WWHID import * -from ui.ImageList import ImageList -from com.sun.star.awt import Size -from com.sun.star.awt.FontUnderline import SINGLE -from com.sun.star.awt.FontFamily import ROMAN -from com.sun.star.awt.FontSlant import ITALIC -from com.sun.star.awt.ImageAlign import LEFT - -class WebWizardDialog(WizardDialog): - PROPNAMES_LBL = (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - PROPNAMES_CHKBOX = (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STATE, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - PROPNAMES_BUTTON = (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - PROPNAMES_TXT = (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - PROPNAMES_TXT_2 = (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, "ReadOnly", - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - PROPNAMES_TITLE = ("FontDescriptor", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_MULTILINE, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH) - - def __init__(self, xmsf): - super(WebWizardDialog, self).__init__(xmsf, HID0_WEBWIZARD) - #Load Resources - self.resources = WebWizardDialogResources(xmsf) - #set dialog properties... - Helper.setUnoPropertyValues(self.xDialogModel,( - "Closeable", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, "Moveable", - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, "Title", - PropertyNames.PROPERTY_WIDTH), - (True, 210, HelpIds.getHelpIdString(HID0_WEBWIZARD), True, - "WebWizardDialog", 102, 52, 1, 6, - self.resources.resWebWizardDialog_title, 330)) - self.fontDescriptor0 = \ - uno.createUnoStruct('com.sun.star.awt.FontDescriptor') - self.fontDescriptor1 = \ - uno.createUnoStruct('com.sun.star.awt.FontDescriptor') - self.fontDescriptor4 = \ - uno.createUnoStruct('com.sun.star.awt.FontDescriptor') - self.fontDescriptor5 = \ - uno.createUnoStruct('com.sun.star.awt.FontDescriptor') - self.fontDescriptor6 = \ - uno.createUnoStruct('com.sun.star.awt.FontDescriptor') - self.fontDescriptor7 = \ - uno.createUnoStruct('com.sun.star.awt.FontDescriptor') - self.imgIconsPrev = range(8) - #Set member- self.fontDescriptors... - self.fontDescriptor0.Weight = 100 - self.fontDescriptor1.Weight = 150 - self.fontDescriptor1.Underline = SINGLE - self.fontDescriptor4.Weight = 150 - self.fontDescriptor5.Name = "Angsana New" - self.fontDescriptor5.Height = 16 - self.fontDescriptor5.StyleName = "Regular" - self.fontDescriptor5.Family = ROMAN - self.fontDescriptor5.Weight = 100 - self.fontDescriptor6.Name = "Andalus" - self.fontDescriptor6.Height = 22 - self.fontDescriptor6.StyleName = "Bold Italic" - self.fontDescriptor6.Weight = 150 - self.fontDescriptor6.Slant = ITALIC - self.fontDescriptor7.Name = "StarSymbol" - self.fontDescriptor7.Height = 9 - self.fontDescriptor7.StyleName = "Regular" - self.fontDescriptor7.Weight = 100 - - #build components - - def buildStep1(self): - tabIndex = 100 - self.insertLabel("lbIntroTitle", WebWizardDialog.PROPNAMES_TITLE, - (self.fontDescriptor4, 16, self.resources.reslbIntroTitle_value, - True, "lbIntroTitle", 91, 8, 1, tabIndex + 1, 232)) - self.insertLabel("lblIntroduction", - (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_MULTILINE, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (119, self.resources.reslblIntroduction_value, True, - "lblIntroduction", 97, 28, 1, tabIndex + 1, 226)) - self.insertFixedLine("lnLoadSettings", WebWizardDialog.PROPNAMES_TXT, - (2, "", "lnLoadSettings", 91, 147, 1, tabIndex + 1, 234)) - self.lblLoadSettings = self.insertLabel("lblLoadSettings", - (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_MULTILINE, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (8, self.resources.reslblLoadSettings_value, True, - "lblLoadSettings", 97, 153, 1, tabIndex + 1, 226)) - self.lstLoadSettings = self.insertListBox( - "lstLoadSettings", None, LSTLOADSETTINGS_ITEM_CHANGED,("Dropdown", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, "LineCount", - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (True, 12, HelpIds.getHelpIdString(HID1_LST_SESSIONS), 14, - "lstLoadSettings", 97, 165, 1, tabIndex + 1, 173), self) - self.btnDelSession = self.insertButton( - "btnDelSession", BTNDELSESSION_ACTION_PERFORMED, - (PropertyNames.PROPERTY_ENABLED, - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, "ImageAlign", - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (False, 14, HelpIds.getHelpIdString(HID1_BTN_DEL_SES), LEFT, - self.resources.resbtnDelSession_value, "btnDelSession", - 274, 164, 1, tabIndex + 1, 50), self) - - def buildStep2(self): - tabIndex = 200 - self.lblContentTitle = self.insertLabel( - "lblContentTitle", WebWizardDialog.PROPNAMES_TITLE, - (self.fontDescriptor4, 16, self.resources.reslblContentTitle_value, - True, "lblContentTitle", 91, 8, 2, tabIndex + 1, 232)) - self.lblSiteContent = self.insertLabel( - "lblSiteContent", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblSiteContent_value, - "lblSiteContent", 97, 28, 2, tabIndex + 1, 105)) - self.lstDocuments = self.insertListBox( - "lstDocuments", None, None, - (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - "LineCount", - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (123, HelpIds.getHelpIdString(HID2_LST_DOCS), - 9, "lstDocuments", 97, 38, 2, tabIndex + 1, 103), self) - self.btnAddDoc = self.insertButton( - "btnAddDoc", BTNADDDOC_ACTION_PERFORMED, - WebWizardDialog.PROPNAMES_BUTTON, - (14, HelpIds.getHelpIdString(HID2_BTN_ADD_DOC), - self.resources.resbtnAddDoc_value, "btnAddDoc", 97, 165, 2, - tabIndex + 1, 50), self) - self.btnRemoveDoc = self.insertButton( - "btnRemoveDoc", BTNREMOVEDOC_ACTION_PERFORMED, - WebWizardDialog.PROPNAMES_BUTTON, - (14, HelpIds.getHelpIdString(HID2_BTN_REM_DOC), - self.resources.resbtnRemoveDoc_value, "btnRemoveDoc", 150, 165, - 2, tabIndex + 1, 50), self) - self.btnDocUp = self.insertButton( - "btnDocUp", BTNDOCUP_ACTION_PERFORMED, - ("FontDescriptor", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (self.fontDescriptor7, 14, HelpIds.getHelpIdString(HID2_BTN_DOC_UP), - self.resources.resbtnDocUp_value, "btnDocUp", - 205, 87, 2, tabIndex + 1, 18), self) - self.btnDocDown = self.insertButton( - "btnDocDown", BTNDOCDOWN_ACTION_PERFORMED,( - "FontDescriptor", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (self.fontDescriptor7, 14, HelpIds.getHelpIdString(HID2_BTN_DOC_DOWN), - self.resources.resbtnDocDown_value, "btnDocDown", 205, - 105, 2, tabIndex + 1, 18), self) - self.lblDocExportFormat = self.insertLabel( - "lblDocExportFormat", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblDocExportFormat_value, - "lblDocExportFormat", 235, 28, 2, tabIndex + 1, 89)) - self.lstDocTargetType = self.insertListBox("lstDocTargetType", None, None, - ("Dropdown", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, "LineCount", - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (True, 12, HelpIds.getHelpIdString(HID2_LST_DOC_EXPORT), 14, - "lstDocTargetType", 235, 38, 2, tabIndex + 1, 89), self) - self.lnDocsInfo = self.insertFixedLine( - "lnDocsInfo", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslnDocsInfo_value, "lnDocsInfo", - 235, 66, 2, tabIndex + 1, 90)) - self.lblDocTitle = self.insertLabel( - "lblDocTitle", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblDocTitle_value, "lblDocTitle", - 235, 78, 2, tabIndex + 1, 89)) - self.txtDocTitle = self.insertTextField( - "txtDocTitle", None, WebWizardDialog.PROPNAMES_TXT, - (12, HelpIds.getHelpIdString(HID2_TXT_DOC_TITLE), "txtDocTitle", - 235, 88, 2, tabIndex + 1, 89), self) - self.lblDocInfo = self.insertLabel( - "lblDocInfo", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblDocInfo_value, "lblDocInfo", - 235, 103, 2, tabIndex + 1, 89)) - self.txtDocInfo = self.insertTextField( - "txtDocInfo", None,(PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_MULTILINE, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (40, HelpIds.getHelpIdString(HID2_TXT_DOC_DESC), True, - "txtDocInfo", 235, 113, 2, tabIndex + 1, 89), self) - self.lblDocAuthor = self.insertLabel( - "lblDocAuthor", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblDocAuthor_value, "lblDocAuthor", - 235, 155, 2, tabIndex + 1, 89)) - self.txtDocAuthor = self.insertTextField( - "txtDocAuthor", None, WebWizardDialog.PROPNAMES_TXT, - (12, HelpIds.getHelpIdString(HID2_TXT_DOC_AUTHOR), - "txtDocAuthor", 235, 165, 2, tabIndex + 1, 89), self) - - def buildStep3(self): - self.insertLabel("lblLayoutTitle", WebWizardDialog.PROPNAMES_TITLE, - (self.fontDescriptor4, 16, self.resources.reslblLayoutTitle_value, - True, "lblLayoutTitle", 91, 8, 3, 29, 232)) - self.lblLayouts = self.insertLabel("lblLayouts", - WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblLayouts_value, "lblLayouts", - 97, 28, 3, 30, 206)) - - def buildStep4(self): - self.insertLabel("lblLayout2Title", WebWizardDialog.PROPNAMES_TITLE, - (self.fontDescriptor4, 16, self.resources.reslblLayout2Title_value, - True, "lblLayout2Title", 91, 8, 4, 33, 232)) - self.lnDisplay = self.insertLabel("lblDisplay", - (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_MULTILINE, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (16, self.resources.reslblDisplay_value, True, - "lblDisplay", 97, 28, 4, 34, 226)) - self.chkDocFilename = self.insertCheckBox("chkDocFilename", None, - WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FILENAME), - self.resources.reschkDocFilename_value, "chkDocFilename", - 103, 50, 0, 4, 35, 99), self) - self.chbDocDesc = self.insertCheckBox( - "chbDocDesc", None, WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID4_CHK_DISPLAY_DESCRIPTION), - self.resources.reschbDocDesc_value, "chbDocDesc", - 103, 60, 0, 4, 36, 99), self) - self.chbDocAuthor = self.insertCheckBox( - "chbDocAuthor", None, WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID4_CHK_DISPLAY_AUTHOR), - self.resources.reschbDocAuthor_value, "chbDocAuthor", - 103, 70, 0, 4, 37, 99), self) - self.chkDocCreated = self.insertCheckBox( - "chkDocCreated", None, WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID4_CHK_DISPLAY_CR_DATE), - self.resources.reschkDocCreated_value, "chkDocCreated", - 103, 80, 0, 4, 38, 99), self) - self.chkDocChanged = self.insertCheckBox( - "chkDocChanged", None, WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID4_CHK_DISPLAY_UP_DATE), - self.resources.reschkDocChanged_value, "chkDocChanged", - 103, 90, 0, 4, 39, 99), self) - self.chkDocFormat = self.insertCheckBox( - "chkDocFormat", None, WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FORMAT), - self.resources.reschkDocFormat_value, "chkDocFormat", - 200, 50, 0, 4, 40, 110), self) - self.chkDocFormatIcon = self.insertCheckBox( - "chkDocFormatIcon", None, WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID4_CHK_DISPLAY_F_ICON), - self.resources.reschkDocFormatIcon_value, "chkDocFormatIcon", - 200, 60, 0, 4, 41, 110), self) - self.chkDocPages = self.insertCheckBox( - "chkDocPages", None, WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID4_CHK_DISPLAY_PAGES), - self.resources.reschkDocPages_value, "chkDocPages", - 200,70, 0, 4, 42, 110), self) - self.chkDocSize = self.insertCheckBox( - "chkDocSize", None, WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID4_CHK_DISPLAY_SIZE), - self.resources.reschkDocSize_value, "chkDocSize", - 200, 80, 0, 4, 43, 110), self) - self.insertLabel("lblOptimizeFor", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblOptimizeFor_value, "lblOptimizeFor", - 97, 113, 4, 44, 226)) - self.optOptimize640x480 = self.insertRadioButton( - "optOptimize640x480", None, WebWizardDialog.PROPNAMES_BUTTON, - (10, HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_640), - self.resources.resoptOptimize640x480_value, - "optOptimize640x480", 103, 133, 4, 45, 44), self) - self.optOptimize800x600 = self.insertRadioButton( - "optOptimize800x600", None, WebWizardDialog.PROPNAMES_BUTTON, - (10, HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_800), - self.resources.resoptOptimize800x600_value, - "optOptimize800x600", 103, 146, 4, 46, 44), self) - self.optOptimize1024x768 = self.insertRadioButton( - "optOptimize1024x768", None, WebWizardDialog.PROPNAMES_BUTTON, - (10, HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_1024), - self.resources.resoptOptimize1024x768_value, - "optOptimize1024x768", 103, 158, 4, 47, 44), self) - - def buildStep5(self): - self.lblStyleTitle = self.insertLabel( - "lblStyleTitle", WebWizardDialog.PROPNAMES_TITLE, - (self.fontDescriptor4, 16, self.resources.reslblStyleTitle_value, - True, "lblStyleTitle", 91, 8, 5, 50, 232)) - self.lblStyle = self.insertLabel( - "lblStyle", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblStyle_value, - "lblStyle", 97, 28, 5, 51, 80)) - self.lstStyles = self.insertListBox( - "lstStyles", None, LSTSTYLES_ITEM_CHANGED,( - "Dropdown", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, "LineCount", - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (True, 12, HelpIds.getHelpIdString(HID5_LST_STYLES), - 14, "lstStyles", 179, 26, 5, 52, 145), self) - self.insertLabel("lblBackground", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblBackground, "lblBackground", - 97, 46, 5, 51, 70)) - self.txtBackground = self.insertLabel("txtBackground", - ("Border", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (1, 12, self.resources.resBackgroundNone, - "txtBackground", 179, 44, 5, 52, 90)) - self.btnBackgrounds = self.insertButton( - "btnBackgrounds", BTNBACKGROUNDS_ACTION_PERFORMED, - WebWizardDialog.PROPNAMES_BUTTON, - (14, HelpIds.getHelpIdString(HID5_BTN_BACKGND), - self.resources.resBtnChooseBackground, "btnBackgrounds", - 274, 43, 5, 53, 50), self) - self.insertLabel("lblIconset", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblIconset, "lblIconset", 97, 64, 5, 51, 70)) - self.insertLabel("txtIconset", - ("Border", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (1, 12, self.resources.resIconsetNone, "txtIconset", - 179, 62, 5, 52, 90)) - self.btnIconSets = self.insertButton( - "btnIconSets", BTNICONSETS_ACTION_PERFORMED, - WebWizardDialog.PROPNAMES_BUTTON, - (14, HelpIds.getHelpIdString(HID5_BTN_ICONS), - self.resources.resBtnChooseIconset, "btnIconSets", - 274, 61, 5, 54, 50), self) - self.insertLabel("lblIconsetInfo", - (PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_MULTILINE, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (16, self.resources.reslblIconSetInfo, True, "lblIconsetInfo", - 179, 78, 5, 51, 145)) - self.imgPreview = self.insertImage("imgPreview", - ("BackgroundColor", - PropertyNames.PROPERTY_ENABLED, - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_IMAGEURL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (0, False, 78, "", "imgPreview", 91, 100, False, 5, 55, 232)) - - def buildStep6(self): - tabIndex = 60 - self.insertLabel("lblTitleGeneralPage", - WebWizardDialog.PROPNAMES_TITLE, - (self.fontDescriptor4, 8, - self.resources.reslblTitleGeneralPage_value, True, - "lblTitleGeneralPage", 90, 9, 6, tabIndex + 1, 232)) - self.insertLabel("lblSiteTitle", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblSiteTitle_value, "lblSiteTitle", - 97, 28, 6, tabIndex + 1, 80)) - self.txtSiteTitle = self.insertTextField( - "txtSiteTitle", None, WebWizardDialog.PROPNAMES_TXT, - (12, HelpIds.getHelpIdString(HID6_TXT_SITE_TITLE), - "txtSiteTitle", 179, 26, 6, tabIndex + 1, 145), self) - self.insertFixedLine( - "FixedLineMetaData", WebWizardDialog.PROPNAMES_LBL, - (9, self.resources.reslblMetaData, "FixedLineMetaData", - 97, 56, 6, tabIndex + 1, 228)) - self.insertLabel("lblSiteDesc", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblSiteDesc_value, "lblSiteDesc", - 103, 72, 6, tabIndex + 1, 80)) - self.txtSiteDesc = self.insertTextField( - "txtSiteDesc", None, WebWizardDialog.PROPNAMES_TXT, - (12, HelpIds.getHelpIdString(HID6_TXT_SITE_DESC), "txtSiteDesc", - 179, 70, 6, tabIndex + 1, 145), self) - self.insertLabel( - "lblEmail", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblEmail_value, "lblEmail", - 103, 90, 6, tabIndex + 1, 80)) - self.txtEmail = self.insertTextField( - "txtEmail", None, WebWizardDialog.PROPNAMES_TXT, - (12, HelpIds.getHelpIdString(HID6_TXT_SITE_EMAIL), "txtEmail", - 179, 87, 6, tabIndex + 1, 145), self) - self.insertLabel("lblCopyright", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblCopyright_value, "lblCopyright", - 103, 108, 6, tabIndex + 1, 80)) - self.txtCopyright = self.insertTextField( - "txtCopyright", None, WebWizardDialog.PROPNAMES_TXT, - (12, HelpIds.getHelpIdString(HID6_TXT_SITE_COPYRIGHT), - "txtCopyright", 179, 106, 6, tabIndex + 1, 145), self) - self.insertLabel("lblSiteCreated", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblSiteCreated_value, "lblSiteCreated", - 103, 126, 6, tabIndex + 1, 80)) - self.dateSiteCreated = self.insertDateField("dateSiteCreated", None, - ("Dropdown", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (True, 12, HelpIds.getHelpIdString(HID6_DATE_SITE_CREATED), - "dateSiteCreated", 179, 124, 6, tabIndex + 1, 49), self) - self.insertLabel("lblSiteUpdated", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblSiteUpdated_value, "lblSiteUpdated", - 103, 144, 6, tabIndex + 1, 80)) - self.dateSiteUpdate = self.insertDateField("dateSiteUpdate", None, - ("Dropdown", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (True, 12, HelpIds.getHelpIdString(HID6_DATE_SITE_UPDATED), - "dateSiteUpdate", 179, 142, 6, tabIndex + 1, 49), self) - - def buildStep7(self, disableFTP, exclamationURL): - tabIndex = 700 - self.lblTitlePublish = self.insertLabel( - "lblTitlePublish", WebWizardDialog.PROPNAMES_TITLE, - (self.fontDescriptor4, 16, self.resources.reslblTitlePublish_value, - True, "lblTitlePublish", 91, 8, 7, tabIndex + 1, 232)) - self.FixedLine1 = self.insertFixedLine( - "FixedLine1", WebWizardDialog.PROPNAMES_LBL, - (9, self.resources.resFixedLine1_value, "FixedLine1", - 97, 28, 7, tabIndex + 1, 228)) - self.btnPreview = self.insertButton( - "btnPreview", BTNPREVIEW_ACTION_PERFORMED, - WebWizardDialog.PROPNAMES_BUTTON, - (14, HelpIds.getHelpIdString(HID7_BTN_PREVIEW), - self.resources.resbtnPreview_value, "btnPreview", - 103, 40, 7, tabIndex + 1, 50), self) - self.insertFixedLine( - "lblCreateSite", WebWizardDialog.PROPNAMES_LBL, - (9, self.resources.reslblCreateSite_value, "lblCreateSite", - 97, 56, 7, tabIndex + 1, 228)) - self.chkLocalDir = self.insertCheckBox( - "chkLocalDir", CHKLOCALDIR_ITEM_CHANGED, - WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID7_CHK_PUBLISH_LOCAL), - self.resources.reschkLocalDir_value, "chkLocalDir", - 103, 68, 0, 7, tabIndex + 1, 215), self) - self.txtLocalDir = self.insertTextField( - "txtLocalDir", None, WebWizardDialog.PROPNAMES_TXT, - (12, HelpIds.getHelpIdString(HID7_TXT_LOCAL), "txtLocalDir", - 113, 78, 7, tabIndex + 1, 190), self) - self.btnLocalDir = self.insertButton( - "btnLocalDir", BTNLOCALDIR_ACTION_PERFORMED, - WebWizardDialog.PROPNAMES_BUTTON, - (14, HelpIds.getHelpIdString(HID7_BTN_LOCAL), - self.resources.resbtnLocalDir_value, "btnLocalDir", - 308, 77, 7, tabIndex + 1, 16), self) - self.chkZip = self.insertCheckBox( - "chkZip", None, WebWizardDialog.PROPNAMES_CHKBOX, - (9, HelpIds.getHelpIdString(HID7_CHK_PUBLISH_ZIP), - self.resources.reschkZip_value, "chkZip", 103, 96, 0, 7, - tabIndex + 1, 215), self) - self.txtZip = self.insertTextField( - "txtZip", None, WebWizardDialog.PROPNAMES_TXT, - (12, HelpIds.getHelpIdString(HID7_TXT_ZIP), "txtZip", - 113, 108, 7, tabIndex + 1, 190), self) - self.btnZip = self.insertButton( - "btnZip", BTNZIP_ACTION_PERFORMED, - WebWizardDialog.PROPNAMES_BUTTON, - (14, HelpIds.getHelpIdString(HID7_BTN_ZIP), - self.resources.resbtnZip_value, "btnZip", 308, 107, 7, - tabIndex + 1, 16), self) - self.chkFTP = self.insertCheckBox( - "chkFTP", None, WebWizardDialog.PROPNAMES_CHKBOX, - (8, HelpIds.getHelpIdString(HID7_CHK_PUBLISH_FTP), - self.resources.reschkFTP_value, "chkFTP", 103, 124, 0, 7, - tabIndex + 1, 215), self) - if disableFTP: - FTP_STEP = 99 - else: - FTP_STEP = 7 - - self.lblFTP = self.insertLabel( - "lblFTP", ("Border", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (1, 12, "txtFTP", 113, 134, FTP_STEP, tabIndex + 1, 156)) - self.btnFTP = self.insertButton( - "btnFTP", BTNFTP_ACTION_PERFORMED, - WebWizardDialog.PROPNAMES_BUTTON, - (14, HelpIds.getHelpIdString(HID7_BTN_FTP), - self.resources.resbtnFTP_value, "btnFTP", 274, 133, - FTP_STEP, tabIndex + 1, 50), self) - if disableFTP: - self.insertImage( - "imgFTPDisabled",("BackgroundColor", "Border", - PropertyNames.PROPERTY_ENABLED, - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_IMAGEURL, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (-1, 0, False, 10, exclamationURL, "imgFTPDisabled", 115, - 135, False, 7, tabIndex + 1, 8)) - self.insertLabel( - "lblFTPDisabled",("BackgroundColor", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_LABEL, - PropertyNames.PROPERTY_MULTILINE, - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (-1, 8, self.resources.reslblFTPDisabled, True, - "lblFTPDisabled", 125, 136, 7, tabIndex + 1, 226)) - - self.insertFixedLine( - "lnSaveSetting", WebWizardDialog.PROPNAMES_TXT, - (2, "", "lnSaveSetting", 97, 151, 7, tabIndex + 1, 228)) - self.chkSaveSettings = self.insertCheckBox( - "chkSaveSettings", CHKSAVESETTINGS_ITEM_CHANGED, - WebWizardDialog.PROPNAMES_CHKBOX, - (9, HelpIds.getHelpIdString(HID7_CHK_SAVE), - self.resources.reschkSaveSettings_value, "chkSaveSettings", - 97, 157, 1, 7, tabIndex + 1, 215), self) - self.insertLabel( - "lblSaveSettings", WebWizardDialog.PROPNAMES_LBL, - (8, self.resources.reslblSaveSettings_value, "lblSaveSettings", - 107, 169, 7, tabIndex + 1, 45)) - self.cbSaveSettings = self.insertComboBox( - "txtSaveSettings", TXTSAVESETTINGS_TEXT_CHANGED, - TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED, - ("Autocomplete", "Dropdown", - PropertyNames.PROPERTY_HEIGHT, - PropertyNames.PROPERTY_HELPURL, "LineCount", - PropertyNames.PROPERTY_NAME, - PropertyNames.PROPERTY_POSITION_X, - PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, - PropertyNames.PROPERTY_TABINDEX, - PropertyNames.PROPERTY_WIDTH), - (True, True, 12, HelpIds.getHelpIdString(HID7_TXT_SAVE), - 14, "txtSaveSettings", 179, 167, 7, tabIndex + 1, 145), self) - - ''' - builds the layouts image list. - ''' - - def buildStepX(self): - self.ilLayouts = ImageList() - self.ilLayouts.pos = Size (97, 38) - self.ilLayouts.imageSize = Size (34, 30) - self.ilLayouts.cols = 5 - self.ilLayouts.rows = 3 - self.ilLayouts.step = 3 - self.ilLayouts.showButtons = False - self.ilLayouts.renderer = self.LayoutRenderer() - self.ilLayouts.scaleImages = False - self.ilLayouts.tabIndex = 31 - self.ilLayouts.helpURL = HID3_IL_LAYOUTS_IMG1 - - - ''' - renders the images and titles of - the layouts - @author rpiterman - ''' - - class LayoutRenderer: - - def getImageUrls(self, listItem): - oResIds = None - if listItem != None: - oResIds = listItem.getImageUrls() - - return oResIds - - def render(self, listItem): - print "implementar" - #return listItem == None ? "" : (listItem).cp_Name diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.py b/wizards/com/sun/star/wizards/web/WebWizardDialogResources.py deleted file mode 100644 index ca295de05161..000000000000 --- a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.py +++ /dev/null @@ -1,315 +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 . -# -import traceback -from common.Resource import Resource -from common.Configuration import Configuration -from common.Properties import Properties -from document.OfficeDocument import OfficeDocument - -class WebWizardDialogResources(Resource): - UNIT_NAME = "dbwizres" - MODULE_NAME = "dbw" - RID_WEBWIZARDDIALOG_START = 4000 - RID_COMMON_START = 500 - RID_DB_COMMON_START = 1000 - - def __init__(self, xmsf): - super(WebWizardDialogResources,self).__init__(xmsf, - WebWizardDialogResources.MODULE_NAME) - self.resbtnDocUp_value = str(8743) - self.resbtnDocDown_value = str(8744) - - #Delete the String, uncomment the getResText method - self.resWebWizardDialog_title = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 1) - self.reslblIntroduction_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 2) - self.resbtnDelSession_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 4) - self.reslbIntroTitle_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 5) - self.reslblContentTitle_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 6) - self.reslnDocsInfo_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 8) - self.reslblDocTitle_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 9) - self.reslblDocInfo_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 10) - self.reslblDocAuthor_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 11) - self.reslblDocExportFormat_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 12) - self.reslblTitleGeneralPage_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 13) - self.reslblSiteTitle_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 14) - self.reslblSiteDesc_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 16) - self.reslblSiteCreated_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 18) - self.reslblEmail_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 20) - self.reslblCopyright_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 21) - self.reslblSiteUpdated_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 22) - self.resbtnPreview_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 24) - self.reslblTitlePublish_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 25) - self.reslblCreateSite_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 26) - self.reschkLocalDir_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 27) - self.resbtnLocalDir_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 28) - self.reschkFTP_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 29) - - self.resbtnFTP_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 31) - self.reschkZip_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 32) - self.resbtnZip_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 33) - self.reschkSaveSettings_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 34) - self.reslblSaveSettings_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 35) - self.reslblLoadSettings_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 36) - self.reslblSiteContent_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 37) - self.resbtnAddDoc_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 38) - self.resbtnRemoveDoc_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 39) - self.reslblLayoutTitle_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 40) - self.reslblStyleTitle_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 41) - self.reslblStyle_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 42) - - self.reslblLayouts_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 48) - - self.reschbDocDesc_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 50) - self.reschbDocAuthor_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 51) - self.reschkDocCreated_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 52) - self.reschkDocChanged_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 53) - self.reschkDocFilename_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 54) - self.reschkDocFormat_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 55) - self.reschkDocFormatIcon_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 56) - self.reschkDocPages_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 57) - self.reschkDocSize_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 58) - self.resFixedLine1_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 59) - self.reslblLayout2Title_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 60) - self.reslblDisplay_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 61) - self.reslblOptimizeFor_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 62) - self.resoptOptimize640x480_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 64) - self.resoptOptimize800x600_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 65) - self.resoptOptimize1024x768_value = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 66) - - self.resStatusDialogTitle = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 70) - self.resCounter = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 71) - self.resPublishDir = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 72) - self.resFTPTargetExistsAsfile = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 73) - self.resLocalTargetExistsAsfile = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 74) - self.resZipTargetExists = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 75) - self.resFTPTargetNotEmpty = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 76) - self.resLocalTragetNotEmpty = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 77) - self.resSessionExists = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 78) - self.resTaskExportDocs = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 79) - self.resTaskExportPrepare = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 80) - self.resTaskGenerateCopy = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 81) - self.resTaskGeneratePrepare = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 82) - self.resTaskGenerateXsl = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 83) - self.resTaskPrepare = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 84) - self.resTaskPublishPrepare = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 86) - self.resTaskPublishLocal = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 87) - self.resTaskPublishFTP = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 88) - self.resTaskPublishZip = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 89) - self.resTaskFinish = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 90) - - self.resImages = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 94) - self.resAllFiles = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 95) - self.resZipFiles = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 96) - self.resBackgroundsDialog = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 98) - self.resBackgroundsDialogCaption = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 99) - self.resIconsDialog = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 100) - self.resIconsDialogCaption = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 101) - self.resOther = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 102) - self.resDeselect = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 103) - self.resFinishedSuccess = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 104) - self.resFinishedNoSuccess = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 105) - self.resErrTOC = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 106) - self.resErrTOCMedia = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 107) - self.resErrDocInfo = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 108) - self.resErrDocExport = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 109) - self.resErrMkDir = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 110) - self.resErrSecurity = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 111) - self.resErrExportIO = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 112) - self.resErrPublishMedia = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 113) - self.resErrPublish = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 114) - self.resErrUnknown = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 115) - self.resErrDocValidate = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 116) - self.resErrIsDirectory = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 117) - self.resLoadingSession = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 118) - self.resErrUnexpected = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 119) - self.resValidatingDocuments = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 120) - self.resDefaultArchiveFilename = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 121) - self.resStep1 = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 122) - self.resStep2 = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 123) - self.resStep3 = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 124) - self.resStep4 = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 125) - self.resStep5 = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 126) - self.resStep6 = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 127) - self.resStep7 = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 128) - self.resDelSessionConfirm = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 130) - self.resPages = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 131) - self.resSlides = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 132) - self.resCreatedTemplate = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 133) - self.resUpdatedTemplate = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 134) - self.resSessionName = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 135) - self.reslblBackground = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 136) - self.reslblIconset = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 137) - self.reslblIconSetInfo = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 138) - self.reslblMetaData = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 139) - self.resBtnChooseBackground = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 140) - self.resBtnChooseIconset = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 141) - self.resSessionNameNone = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 142) - self.reslblFTPDisabled = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 143) - self.resBackgroundNone = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 144) - self.resIconsetNone = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 145) - self.resFTPTargetCouldNotCreate = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 146) - self.resFTPTargetCreate = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 147) - self.resZipTargetIsDir = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 148) - self.resLocalTargetCouldNotCreate = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 149) - self.resLocalTargetCreate = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 150) - self.resSizeTemplate = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 151) - self.resSpecifyNewFileLocation = self.getResText( - WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 152) - self.resClose = self.getResText( - WebWizardDialogResources.RID_COMMON_START + 17) - self.resCancel = self.getResText( - WebWizardDialogResources.RID_COMMON_START + 11) - self.resOK = self.getResText( - WebWizardDialogResources.RID_COMMON_START + 18) - self.resHelp = self.getResText( - WebWizardDialogResources.RID_COMMON_START + 15) - try: - self.prodName = Configuration.getProductName(xmsf) - self.resGifFiles = Properties.getPropertyValue( - OfficeDocument.getTypeMediaDescriptor( - xmsf, "gif_Graphics_Interchange"), "UIName") - except Exception, ex: - traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/web/__init__.py b/wizards/com/sun/star/wizards/web/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/wizards/com/sun/star/wizards/web/__init__.py +++ /dev/null |