diff --git a/wizards/Pyuno_commonwizards.mk b/wizards/Pyuno_commonwizards.mk index 578555c6c5eb..1c139950d963 100644 --- a/wizards/Pyuno_commonwizards.mk +++ b/wizards/Pyuno_commonwizards.mk @@ -25,8 +25,6 @@ $(eval $(call gb_Pyuno_add_files,commonwizards,wizards,\ common/SystemDialog.py \ common/IRenderer.py \ common/UCB.py \ - common/XMLHelper.py \ - common/XMLProvider.py \ common/ListModel.py \ common/__init__.py \ document/OfficeDocument.py \ @@ -50,12 +48,9 @@ $(eval $(call gb_Pyuno_add_files,commonwizards,wizards,\ ui/event/ListModelBinder.py \ ui/event/RadioDataAware.py \ ui/event/UnoDataAware.py \ - ui/event/SimpleDataAware.py \ ui/event/Task.py \ ui/event/TaskEvent.py \ ui/event/TaskListener.py \ - ui/event/ListDataEvent.py \ - ui/event/ListDataListener.py \ ui/event/EventListenerList.py \ ui/event/__init__.py \ )) diff --git a/wizards/com/sun/star/wizards/common/Configuration.py b/wizards/com/sun/star/wizards/common/Configuration.py index e63d20827542..91274e0b288c 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.py +++ b/wizards/com/sun/star/wizards/common/Configuration.py @@ -54,46 +54,10 @@ class Configuration(object): def getNode(self, name, parent): return parent.getByName(name) - # This method creates a new configuration node and adds it - # to the given view. Note that if a node with the given name - # already exists it will be completely removed from - # the configuration. - # @param configView - # @param name - # @return the new created configuration node. - # @throws com.sun.star.lang.WrappedTargetException - # @throws ElementExistException - # @throws NoSuchElementException - # @throws com.sun.star.uno.Exception - @classmethod - def addConfigNode(self, configView, name): - try: - node = configView.getByName(name) - except Exception: - node = None - if (node is not None): - return node - else: - # create a new detached set element (instance of DataSourceDescription) - # the new element is the result ! - node = configView.createInstance() - # insert it - this also names the element - configView.insertByName(name, node) - return node - - @classmethod - def removeNode(self, configView, name): - if (configView.hasByName(name)): - configView.removeByName(name) - @classmethod def commit(self, configView): configView.commitChanges() - @classmethod - def getChildrenNames(self, configView): - return configView.getElementNames() - @classmethod def getInt(self, name, parent): o = getNode(name, parent) diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py index af0efd6413ed..dc49ab05e914 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.py +++ b/wizards/com/sun/star/wizards/common/FileAccess.py @@ -39,7 +39,7 @@ class FileAccess(object): "com.sun.star.ucb.FileContentProvider") self.xInterface = xmsf.createInstance( "com.sun.star.ucb.SimpleFileAccess") - + @classmethod def deleteLastSlashfromUrl(self, _sPath): if _sPath.endswith("/"): @@ -69,62 +69,6 @@ class FileAccess(object): traceback.print_exc() return "" - ''' - Further information on arguments value see in OO Developer Guide, - chapter 6.2.7 - @param xMSF - @param sPath - @param sType use "share" or "user". Set to "" - f not needed eg for the WorkPath; - In the return Officepath a possible slash at the end is cut off - @param sSearchDir - @return - @throws NoValidPathException - ''' - - @classmethod - def getOfficePath2(self, xMSF, sPath, sType, sSearchDir): - #This method currently only works with sPath="Template" - bexists = False - try: - xPathInterface = xMSF.createInstance( - "com.sun.star.util.PathSettings") - ResultPath = "" - ReadPaths = () - xUcbInterface = xMSF.createInstance( - "com.sun.star.ucb.SimpleFileAccess") - Template_writable = xPathInterface.getPropertyValue( - sPath + "_writable") - Template_internal = xPathInterface.getPropertyValue( - sPath + "_internal") - Template_user = xPathInterface.getPropertyValue( - sPath + "_user") - if not hasattr(Template_internal, '__dict__'): - ReadPaths = ReadPaths + Template_internal - if not hasattr(Template_user, '__dict__'): - ReadPaths = ReadPaths + Template_user - ReadPaths = ReadPaths + (Template_writable,) - if sType.lower() == "user": - ResultPath = Template_writable - bexists = True - else: - #find right path using the search sub path - for i in ReadPaths: - tmpPath = i + sSearchDir - if xUcbInterface.exists(tmpPath): - ResultPath = i - bexists = True - break - - ResultPath = self.deleteLastSlashfromUrl(ResultPath) - except Exception: - traceback.print_exc() - ResultPath = "" - - if not bexists: - raise NoValidPathException (xMSF, "") - return ResultPath - @classmethod def combinePaths(self, xMSF, _sFirstPath, _sSecondPath): bexists = False @@ -146,7 +90,7 @@ class FileAccess(object): @classmethod def getFolderTitles(self, xMSF, FilterName, FolderName, resDict=None): #Returns and ordered dict containing the template's name and path - + locLayoutFiles = [] try: xDocInterface = xMSF.createInstance( @@ -158,7 +102,7 @@ class FileAccess(object): FilterName = None else: FilterName += "-" - + locLayoutDict = {} for i in nameList: fileName = self.getFilename(i) @@ -173,7 +117,7 @@ class FileAccess(object): else: title = xDocInterface.Title locLayoutDict[title] = i - + #sort the dictionary and create a list containing the #keys list and the values list keysList = sorted(locLayoutDict.keys()) @@ -181,7 +125,7 @@ class FileAccess(object): for i in keysList: valuesList.append(locLayoutDict[i]) locLayoutFiles.append(keysList) - locLayoutFiles.append(valuesList) + locLayoutFiles.append(valuesList) except Exception: traceback.print_exc() @@ -234,20 +178,6 @@ class FileAccess(object): traceback.print_exc() return default - def isDirectory(self, filename): - try: - return self.xInterface.isFolder(filename) - except Exception: - traceback.print_exc() - return False - - def getLastModified(self, url): - try: - return self.xInterface.getDateTimeModified(url) - except Exception: - traceback.print_exc() - return None - def delete(self, filename): try: self.xInterface.kill(filename) @@ -267,24 +197,6 @@ class FileAccess(object): traceback.print_exc() return [""] - # - # @param s - # @return - def mkdir(self, s): - try: - self.xInterface.createFolder(s) - return True - except Exception: - traceback.print_exc() - return False - - def createNewDir(self, parentDir, name): - s = self.getNewFile(parentDir, name, "") - if (self.mkdir(s)): - return s - else: - return None - def getSize(self, url): try: return self.xInterface.getSize(url) @@ -292,17 +204,6 @@ class FileAccess(object): traceback.print_exc() return -1 - def getNewFile(self, parentDir, name, extension): - i = 0 - url = "" - while (True): - filename = self.filename(name, extension, i) - url = self.getURL(parentDir, filename) - if (not self.exists(url, True)): - break - i += 1 - return url - def getURL(self, parentURL, childPath): if len(childPath) > 0 and childPath[0] == "/": path = parentURL + childPath @@ -310,14 +211,6 @@ class FileAccess(object): path = parentURL + "/" + childPath return path - ''' - return the filename out of a system-dependent path - ''' - - @classmethod - def getPathFilename(self, path): - return self.getFilename(path, FileSeparator) - @classmethod def getFilename(self, path, pathSeparator = "/"): return path.split(pathSeparator)[-1] diff --git a/wizards/com/sun/star/wizards/common/ListModel.py b/wizards/com/sun/star/wizards/common/ListModel.py index 7a14f143c745..e0eaf5de3ccf 100644 --- a/wizards/com/sun/star/wizards/common/ListModel.py +++ b/wizards/com/sun/star/wizards/common/ListModel.py @@ -28,10 +28,6 @@ class ListModel(object): def getElementAt(self, arg0): pass - @abstractmethod - def elements(self): - pass - def addListDataListener(self, listener): pass diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py index 2450208f8402..5dccd8231102 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.py +++ b/wizards/com/sun/star/wizards/common/SystemDialog.py @@ -49,21 +49,6 @@ class SystemDialog(object): xmsf, "com.sun.star.ui.dialogs.FilePicker", FILESAVE_AUTOEXTENSION) - @classmethod - def createOpenDialog(self, xmsf): - return SystemDialog( - xmsf, "com.sun.star.ui.dialogs.FilePicker", FILEOPEN_SIMPLE) - - @classmethod - def createFolderDialog(self, xmsf): - return SystemDialog( - xmsf, "com.sun.star.ui.dialogs.FolderPicker", 0) - - @classmethod - def createOfficeFolderDialog(self, xmsf): - return SystemDialog( - xmsf, "com.sun.star.ui.dialogs.OfficeFolderPicker", 0) - def subst(self, path): try: s = self.xStringSubstitution.substituteVariables(path, False) @@ -90,36 +75,9 @@ class SystemDialog(object): return self.sStorePath - def callFolderDialog(self, title, description, displayDir): - try: - self.systemDialog.setDisplayDirectory( - self.subst(displayDir)) - except IllegalArgumentException as iae: - traceback.print_exc() - raise AttributeError(iae.getMessage()); - - self.systemDialog.setTitle(title) - self.systemDialog.setDescription(description) - if self.execute(self.systemDialog): - return self.systemDialog.getDirectory() - else: - return None - def execute(self, execDialog): return execDialog.execute() == 1 - def callOpenDialog(self, multiSelect, displayDirectory): - try: - self.systemDialog.setMultiSelectionMode(multiSelect) - self.systemDialog.setDisplayDirectory(self.subst(displayDirectory)) - if self.execute(self.systemDialog): - return self.systemDialog.getSelectedFiles() - - except Exception: - traceback.print_exc() - - return None - def addFilterToDialog(self, sExtension, filterName, setToDefault): try: #get the localized filtername diff --git a/wizards/com/sun/star/wizards/common/UCB.py b/wizards/com/sun/star/wizards/common/UCB.py index 4d97c01f3cc8..84d951f73f54 100644 --- a/wizards/com/sun/star/wizards/common/UCB.py +++ b/wizards/com/sun/star/wizards/common/UCB.py @@ -47,13 +47,6 @@ class UCB(object): self.fa = FileAccess(xmsf) self.xmsf = xmsf - def deleteDirContent(self, folder): - if (not self.fa.exists(folder, True)): - return - l = self.listFiles(folder, None) - for i in range(len(l)): - self.delete(FileAccess.connectURLs(folder, l[i])) - def delete(self, filename): # System.out.println("UCB.delete(" + filename) self.executeCommand(self.getContent(filename),"delete", True) @@ -71,14 +64,6 @@ class UCB(object): self.fa.xInterface.createFolder(targetDir) self.executeCommand(self.ucb, "globalTransfer", self.copyArg(sourceDir, filename, targetDir, targetName)) - # @deprecated - # @param sourceDir - # @param filename - # @param targetDir - # @throws Exception - def copy3(self, sourceDir, filename, targetDir): - self.copy2(sourceDir, filename, targetDir, "") - # target name can be PropertyNames.EMPTY_STRING, in which case the name stays lige the source name # @param sourceDir # @param sourceFilename @@ -148,24 +133,6 @@ class UCB(object): files.pop(i) # FIXME !!! dangerous return files - def getContentProperty(self, content, propName, classType): - pv = [Property()] - pv[0].Name = propName - pv[0].Handle = -1 - - row = self.executeCommand(content, "getPropertyValues", - uno.Any("[]com.sun.star.beans.Property", tuple(pv))) - if (isinstance(classType, str)): - return row.getString(1) - elif (isinstance(classType, bool)): - return True if (row.getBoolean(1)) else False - elif (isinstance(classType, int)): - return row.getInt(1) - elif (isinstance(classType, int)): - return row.getShort(1) - else: - return None - def getContent(self, path): try: ident = self.ucb.createContentIdentifier(path) diff --git a/wizards/com/sun/star/wizards/common/XMLHelper.py b/wizards/com/sun/star/wizards/common/XMLHelper.py deleted file mode 100644 index 0af198cf3e0b..000000000000 --- a/wizards/com/sun/star/wizards/common/XMLHelper.py +++ /dev/null @@ -1,34 +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 XMLHelper: - - @classmethod - def addElement(self, parent, name, attNames, attValues): - doc = parent.getOwnerDocument() - if (doc is None): - doc = parent - e = doc.createElement(name) - for i in range(len(attNames)): - if (not (attValues[i] is None or (attValues[i] == ""))): - e.setAttribute(attNames[i], attValues[i]) - parent.appendChild(e) - return e - - @classmethod - def addElement1(self, parent, name, attName, attValue): - return self.addElement(parent, name, [attName], [attValue]) diff --git a/wizards/com/sun/star/wizards/common/XMLProvider.py b/wizards/com/sun/star/wizards/common/XMLProvider.py deleted file mode 100644 index 46272383cbc5..000000000000 --- a/wizards/com/sun/star/wizards/common/XMLProvider.py +++ /dev/null @@ -1,24 +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 abc import abstractmethod - -class XMLProvider: - - @abstractmethod - def createDOM(parent): - pass diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py index ba3b0976bd31..6ebb7d389fed 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.py +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py @@ -73,44 +73,6 @@ class OfficeDocument(object): except PropertyVetoException: traceback.print_exc() - ''' - Create a new office document, attached to the given frame. - @param desktop - @param frame - @param sDocumentType e.g. swriter, scalc, ( simpress, scalc : not tested) - @return the document Component - (implements XComponent) object ( XTextDocument, or XSpreadsheedDocument ) - ''' - - @classmethod - def createNewDocument(self, frame, sDocumentType, preview, readonly): - loadValues = list(range(2)) - loadValues[0] = uno.createUnoStruct( - 'com.sun.star.beans.PropertyValue') - loadValues[0].Name = "ReadOnly" - if readonly: - loadValues[0].Value = True - else: - loadValues[0].Value = False - - loadValues[1] = uno.createUnoStruct( - 'com.sun.star.beans.PropertyValue') - loadValues[1].Name = "Preview" - if preview: - loadValues[1].Value = True - else: - loadValues[1].Value = False - sURL = "private:factory/" + sDocumentType - xComponent = None - try: - xComponent = frame.loadComponentFromURL( - sURL, "_self", 0, tuple(loadValues)) - - except Exception: - traceback.print_exc() - - return xComponent - @classmethod def createNewFrame(self, xMSF, listener, FrameName="_blank"): xFrame = None @@ -205,7 +167,7 @@ class OfficeDocument(object): oStoreProperties[1].Value = xMSF.createInstance( "com.sun.star.comp.uui.UUIInteractionHandler") else: - oStoreProperties = list(range(0)) + oStoreProperties = list(range(0)) StorePath = systemPathToFileUrl(StorePath) sPath = StorePath[:(StorePath.rfind("/") + 1)] @@ -214,7 +176,7 @@ class OfficeDocument(object): absolutize(sPath, sFile), tuple(oStoreProperties)) return True except ErrorCodeIOException: - #Throw this exception when trying to save a file + #Throw this exception when trying to save a file #which is already opened in Libreoffice #TODO: handle it properly return True @@ -253,27 +215,6 @@ class OfficeDocument(object): except Exception: traceback.print_exc() - @classmethod - def getFileMediaDecriptor(self, xmsf, url): - typeDetect = xmsf.createInstance( - "com.sun.star.document.TypeDetection") - mediaDescr = list(range(1)) - mediaDescr[0] = uno.createUnoStruct( - 'com.sun.star.beans.PropertyValue') - mediaDescr[0].Name = "URL" - mediaDescr[0].Value = url - Type = typeDetect.queryTypeByDescriptor(tuple(mediaDescr), True)[0] - if Type == "": - return None - else: - return typeDetect.getByName(Type) - - @classmethod - def getTypeMediaDescriptor(self, xmsf, type): - typeDetect = xmsf.createInstance( - "com.sun.star.document.TypeDetection") - return typeDetect.getByName(type) - def showMessageBox( self, xMSF, windowServiceName, windowAttribute, MessageText): diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py index 7c460f7dee4c..66c0e33457b5 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py @@ -83,7 +83,7 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.buildStep4() self.buildStep5() self.buildStep6() - + self.initializePaths() self.initializeSalutation() self.initializeGreeting() @@ -330,7 +330,7 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.chkBusinessPaperItemChanged() self.setElements(False) self.drawConstants() - + def lstPrivOfficialStyleItemChanged(self): selectedItemPos = self.lstPrivOfficialStyle.SelectedItemPos if self.lstPrivOfficialStylePos != selectedItemPos: @@ -741,16 +741,6 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.xDialogModel.lstGreeting.StringItemList = \ tuple(self.resources.GreetingLabels) - def getCurrentLetter(self): - if self.myConfig.cp_LetterType == 0: - return self.myConfig.cp_BusinessLetter - elif self.myConfig.cp_LetterType == 1: - return self.myConfig.cp_PrivateOfficialLetter - elif self.myConfig.cp_LetterType == 2: - return self.myConfig.cp_PrivateLetter - else: - return None - def initializeTemplates(self, xMSF): sLetterPath = self.sTemplatePath + "/wizard/letter" self.BusinessFiles = \ @@ -805,7 +795,7 @@ class LetterWizardDialogImpl(LetterWizardDialog): OfficeDocument.attachEventCall( self.myLetterDoc.xTextDocument, "OnNew", "StarBasic", "macro:///Template.Correspondence.Database()") - + def setElements(self, privLetter): if self.optSenderDefine.State: self.optSenderDefineItemChanged() @@ -831,16 +821,16 @@ class LetterWizardDialogImpl(LetterWizardDialog): if self.optMakeChanges.State: self.optMakeChangesItemChanged() - + def drawConstants(self): '''Localise the template''' constRangeList = self.myLetterDoc.searchFillInItems(1) - + for i in constRangeList: text = i.String.lower() aux = TextElement(i, self.resources.dictConstants[text]) aux.write() - + def insertRoadmap(self): self.addRoadmap() self.insertRoadMapItems( diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py index 3119b16f2297..d4c7d67b5e9b 100644 --- a/wizards/com/sun/star/wizards/text/TextDocument.py +++ b/wizards/com/sun/star/wizards/text/TextDocument.py @@ -146,7 +146,7 @@ class TextDocument(object): myFieldHandler = TextFieldHandler(self.xMSF, self.xTextDocument) myFieldHandler.updateDocInfoFields() return self.xTextDocument - + def getPageSize(self): try: xNameAccess = self.xTextDocument.StyleFamilies @@ -203,21 +203,6 @@ class TextDocument(object): except Exception: traceback.print_exc() - ''' - Apparently there is no other way to get the - page count of a text document other than using a cursor and - making it jump to the last page... - @param model the document model. - @return the page count of the document. - ''' - - @classmethod - def getPageCount(self, model): - xController = model.getCurrentController() - xPC = xController.getViewCursor() - xPC.jumpToLastPage() - return xPC.getPage() - @classmethod def getFrameByName(self, sFrameName, xTD): if xTD.TextFrames.hasByName(sFrameName): @@ -227,20 +212,20 @@ class TextDocument(object): def searchFillInItems(self, typeSearch): sd = self.xTextDocument.createSearchDescriptor() - + if typeSearch == 0: sd.setSearchString("<[^>]+>") elif typeSearch == 1: sd.setSearchString("#[^#]+#") - + sd.setPropertyValue("SearchRegularExpression", True) sd.setPropertyValue("SearchWords", True) - + auxList = [] allItems = self.xTextDocument.findAll(sd) for i in list(range(allItems.Count)): auxList.append(allItems.getByIndex(i)) - + return auxList class DateUtils(object): diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.py b/wizards/com/sun/star/wizards/ui/DocumentPreview.py index 92c4444d1e02..6b22d07a8739 100644 --- a/wizards/com/sun/star/wizards/ui/DocumentPreview.py +++ b/wizards/com/sun/star/wizards/ui/DocumentPreview.py @@ -58,11 +58,6 @@ class DocumentPreview(object): ps[item] = propValues[index] return self.setDocument(self.url, ps.getProperties1()) - def reload(self, xmsf): - self.closeFrame() - self.createPreviewFrame(xmsf, self.xControl) - self.setDocument(self.url, self.loadArgs) - def closeFrame(self): if self.xFrame is not None: self.xFrame.close(False) diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py index d73f828a4116..0c9b8f9b333e 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.py +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py @@ -201,15 +201,6 @@ class UnoDialog(object): self.xUnoDialog.setVisible(True) - ''' - @param parent - @return 0 for cancel, 1 for ok - @throws com.sun.star.uno.Exception - ''' - - def executeDialogFromParent(self, parent): - return self.executeDialog(parent.xUnoDialog.PosSize) - ''' @param XComponent @return 0 for cancel, 1 for ok @@ -248,19 +239,6 @@ class UnoDialog(object): self.xWindowPeer = self.xUnoDialog.getPeer() return self.xUnoDialog.getPeer() - # deletes the first entry when this is equal to "DelEntryName" - # returns true when a new item is selected - - def deletefirstListboxEntry(self, ListBoxName, DelEntryName): - xListBox = self.xUnoDialog.getControl(ListBoxName) - FirstItem = xListBox.getItem(0) - if FirstItem.equals(DelEntryName): - SelPos = xListBox.getSelectedItemPos() - xListBox.removeItems(0, 1) - if SelPos > 0: - setControlProperty(ListBoxName, "SelectedItems", [SelPos]) - xListBox.selectItemPos((short)(SelPos - 1), True) - @classmethod def setEnabled(self, control, enabled): control.Model.Enabled = enabled @@ -321,7 +299,7 @@ class UnoDialog(object): return "SelectedItems" else: return "" - + def isHighContrastModeActivated(self): if (self.xVclWindowPeer is not None): if (self.BisHighContrastModeActivated is None): diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.py b/wizards/com/sun/star/wizards/ui/UnoDialog2.py index e7d91dc04ae7..e8acece8866b 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.py +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.py @@ -124,12 +124,6 @@ class UnoDialog2(UnoDialog): return xRadioButton - def insertTitledBox(self, sName, sPropNames, oPropValues): - oTitledBox = self.insertControlModel( - "com.sun.star.awt.UnoControlGroupBoxModel", - sName, sPropNames, oPropValues) - return oTitledBox - def insertTextField( self, sName, sTextChanged, sPropNames, oPropValues, listener): return self.insertEditField( @@ -169,19 +163,6 @@ class UnoDialog2(UnoDialog): xField.addTextListener(TextListenerProcAdapter(sTextChanged)) return xField - def insertFileControl( - self, sName, sTextChanged, sPropNames, oPropValues, listener): - return self.insertEditField(sName, sTextChanged, - "com.sun.star.awt.UnoControlFileControlModel", - sPropNames, oPropValues, listener) - - def insertCurrencyField( - self, sName, sTextChanged, sPropNames, oPropValues, listener): - return self.insertEditField( - sName, sTextChanged, - "com.sun.star.awt.UnoControlCurrencyFieldModel", - sPropNames, oPropValues, listener) - def insertDateField( self, sName, sTextChanged, sPropNames, oPropValues, listener): return self.insertEditField( @@ -203,12 +184,6 @@ class UnoDialog2(UnoDialog): "com.sun.star.awt.UnoControlTimeFieldModel", sPropNames, oPropValues, listener) - def insertPatternField( - self, sName, sTextChanged, oPropValues, listener): - return self.insertEditField(sName, sTextChanged, - "com.sun.star.awt.UnoControlPatternFieldModel", - sPropNames, oPropValues, listener) - def insertFormattedField( self, sName, sTextChanged, sPropNames, oPropValues, listener): return self.insertEditField( @@ -241,18 +216,6 @@ class UnoDialog2(UnoDialog): self.ControlList[sName] = iControlKey return oScrollBar - def insertProgressBar(self, sName, sPropNames, oPropValues): - oProgressBar = self.insertControlModel( - "com.sun.star.awt.UnoControlProgressBarModel", - sName, sPropNames, oPropValues) - return oProgressBar - - def insertGroupBox(self, sName, sPropNames, oPropValues): - oGroupBox = self.insertControlModel( - "com.sun.star.awt.UnoControlGroupBoxModel", - sName, sPropNames, oPropValues) - return oGroupBox - def showMessageBox(self, windowServiceName, windowAttribute, MessageText): return SystemDialog.showMessageBox( xMSF, self.xControl.Peer, diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py index 7603d6bad436..1874145a13f8 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.py +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py @@ -86,18 +86,18 @@ class WizardDialog(UnoDialog2): def setDialogProperties(self, closeable, height, moveable, position_x, position_Y, step, tabIndex, title, width): uno.invoke(self.xDialogModel, "setPropertyValues", - ((PropertyNames.PROPERTY_CLOSEABLE, - PropertyNames.PROPERTY_HEIGHT, + ((PropertyNames.PROPERTY_CLOSEABLE, + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, - PropertyNames.PROPERTY_STEP, + PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH), - (closeable, height, moveable, position_x, position_Y, step, - tabIndex, title, width))) - + (closeable, height, moveable, position_x, position_Y, step, + tabIndex, title, width))) + def setRoadmapInteractive(self, _bInteractive): self.oRoadmap.Activated = _bInteractive @@ -139,7 +139,7 @@ class WizardDialog(UnoDialog2): break if self.sTemplatePath == "": raise Exception("could not find wizard templates") - + def addRoadmap(self): try: iDialogHeight = self.xDialogModel.Height @@ -322,7 +322,7 @@ class WizardDialog(UnoDialog2): self.oRoadmap.insertByIndex(index, oRoadmapItem) except Exception: traceback.print_exc() - + def setStepEnabled(self, _nStep, bEnabled, enableNextButton=None): xRoadmapItem = self.getRoadmapItemByID(_nStep) if xRoadmapItem is not None: @@ -424,9 +424,6 @@ class WizardDialog(UnoDialog2): except Exception: traceback.print_exc() - def getMaximalStep(self): - return self.nMaxStep - def getCurrentStep(self): try: return int(self.xDialogModel.Step) diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.py b/wizards/com/sun/star/wizards/ui/event/CommonListener.py index 94cafac672c2..c131195711ad 100644 --- a/wizards/com/sun/star/wizards/ui/event/CommonListener.py +++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.py @@ -123,53 +123,3 @@ class KeyListenerProcAdapter( unohelper.Base, XKeyListener ): def disposing(self, Event): # TODO: Implement ? pass - -from com.sun.star.awt import XMouseListener -class OMouseListenerProcAdapter( unohelper.Base, XMouseListener ): - def __init__(self, oProcToCall): - self.oProcToCall = oProcToCall - - def mousePressed(self, MouseEvent): - if callable( self.oProcToCall ): - self.oProcToCall(MouseEvent) - - def mouseEntered(self, MouseEvent): - # TODO: Implement ? - pass - - def mouseExited(self, MouseEvent): - # TODO: Implement ? - pass - - def mouseReleased(self, MouseEvent): - # TODO: Implement ? - pass - - def disposing(self, Event): - # TODO: Implement ? - pass - -from com.sun.star.io import XStreamListener -class StreamListenerProcAdapter( unohelper.Base, XStreamListener ): - def __init__(self, parent, terminatedCall, startedCall, closedCall, errorCall): - self.parent = parent - self.terminatedCall = terminatedCall - self.startedCall = startedCall - self.closedCall = closedCall - self.errorCall = errorCall - - def terminated(self): - if callable( self. terminatedCall): - self.terminatedCall(self, self.parent) - - def started(self): - if callable( self.startedCall ): - self.startedCall(self, self.parent) - - def closed(self): - if callable( self.closedCall ): - self.closedCall(self, self.parent) - - def error(self, aException): - if callable( self.errorCall ): - self.errorCall(self, aException) diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py index ce97ebc96f41..d6e5262d8849 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.py +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py @@ -86,22 +86,6 @@ class DataAware(object): except Exception: traceback.print_exc() - ''' - sets a new data object. Optionally - update the UI. - @param obj the new data object. - @param updateUI if true updateUI() will be called. - ''' - - def setDataObject(self, obj, updateUI): - #if obj is not None and not isinstance(obj, type(self._field)): - # return - - self._dataObject = obj - - if updateUI: - self.updateUI() - ''' updates the DataObject according to the current state of the UI control. @@ -132,14 +116,3 @@ class DataAware(object): setattr(self._dataObject, self._field, ui) except Exception: traceback.print_exc() - - ''' - given a collection containing DataAware objects, - calls updateUI() on each member of the collection. - @param dataAwares a collection containing DataAware objects. - ''' - - @classmethod - def updateUIs(self, dataAwares): - for i in dataAwares: - i.updateUI() diff --git a/wizards/com/sun/star/wizards/ui/event/EventListenerList.py b/wizards/com/sun/star/wizards/ui/event/EventListenerList.py index 9b475a77bd00..e30536044b6c 100644 --- a/wizards/com/sun/star/wizards/ui/event/EventListenerList.py +++ b/wizards/com/sun/star/wizards/ui/event/EventListenerList.py @@ -25,6 +25,3 @@ class EventListenerList(object): def remove(self, listener): self.list.remove(listener) - - def getListenerList(self): - return self.list diff --git a/wizards/com/sun/star/wizards/ui/event/ListDataEvent.py b/wizards/com/sun/star/wizards/ui/event/ListDataEvent.py deleted file mode 100644 index 50588dd289f1..000000000000 --- a/wizards/com/sun/star/wizards/ui/event/ListDataEvent.py +++ /dev/null @@ -1,36 +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 ListDataEvent: - - INTERVAL_ADDED = 1 - INTERVAL_REMOVED = 2 - CONTENTS_CHANGED = 3 - - # general constructor - - # @param source - # @param type_ - def __init__(self, source_, type_, i0, i1): - #super(TaskEvent, self).__init__(source) - self.index0 = i0 - self.index1 = i1 - - def getIndex0(self): - return self.index0 - - def getIndex1(self): - return self.index1 diff --git a/wizards/com/sun/star/wizards/ui/event/ListDataListener.py b/wizards/com/sun/star/wizards/ui/event/ListDataListener.py deleted file mode 100644 index e3f74659fab5..000000000000 --- a/wizards/com/sun/star/wizards/ui/event/ListDataListener.py +++ /dev/null @@ -1,32 +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 abc import abstractmethod - -class ListDataListener(): - - @abstractmethod - def intervalAdded(self, lde): - pass - - @abstractmethod - def intervalRemoved(self, lde): - pass - - @abstractmethod - def contentsChanged(self, lde): - pass diff --git a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py index 863a696b97fb..a6f13e77dfd5 100644 --- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py +++ b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py @@ -36,14 +36,6 @@ class ListModelBinder(ListDataListener): self.listModel = newListModel self.listModel.addListDataListener(self) - def contentsChanged(self, lde): - selected = self.getSelectedItems() - i = lde.getIndex0() - while i <= lde.getIndex1(): - self.update(i) - i += 1 - self.setSelectedItems(selected) - def update(self, i): self.remove(i, i) self.insert(i) @@ -63,18 +55,6 @@ class ListModelBinder(ListDataListener): def getSelectedItems(self): return self.unoListModel.SelectedItems - def setSelectedItems(self, selected): - self.unoListModel.SelectedItems = selected; - - def intervalAdded(self, lde): - i = lde.getIndex0() - while (i <= lde.getIndex1()): - self.insert(i) - i += 1 - - def intervalRemoved(self, lde): - self.remove(lde.getIndex0(), lde.getIndex1()) - class Renderer: @abstractmethod @@ -85,25 +65,3 @@ class ListModelBinder(ListDataListener): return str(item) else: return item.toString() - - @classmethod - def fillList(self, xlist, items, renderer): - xlist.Model.StringItemList = () - for index,item in enumerate(items): - if item is not None: - if renderer is not None: - aux = renderer.render(index) - else: - aux = item.toString() - xlist.addItem(aux, index) - - @classmethod - def fillComboBox(self, xComboBox, items, renderer): - xComboBox.Model.StringItemList = () - for index,item in enumerate(items): - if item is not None: - if renderer is not None: - aux = renderer.render(index) - else: - aux = item.toString() - xComboBox.addItem(aux, index) diff --git a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.py b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.py deleted file mode 100644 index cb1cdc3806b3..000000000000 --- a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.py +++ /dev/null @@ -1,33 +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 .DataAware import DataAware - -class SimpleDataAware(DataAware): - - def __init__(self, dataObject, field, control_, controlField_): - super(SimpleDataAware, self).__init__(dataObject, field) - self.control = control_ - self.controlField = controlField_ - - def setToUI(self, value): - uno.invoke(self.control, "set" + self.controlField, (value,)) - - def getFromUI(self): - return uno.invoke(self.control, "get" + self.controlField, ()) diff --git a/wizards/com/sun/star/wizards/ui/event/Task.py b/wizards/com/sun/star/wizards/ui/event/Task.py index 90d182c119fa..aa44ed314e1e 100644 --- a/wizards/com/sun/star/wizards/ui/event/Task.py +++ b/wizards/com/sun/star/wizards/ui/event/Task.py @@ -55,23 +55,6 @@ class Task: if (self.failed + self.successful == self.maximum): self.fireTaskFinished() - def advance1(self, success_, nextSubtaskName): - self.advance(success_) - self.setSubtaskName(nextSubtaskName) - - def getStatus(self): - return self.successful + self.failed - - def addTaskListener(self, tl): - self.listeners.append(tl) - - def removeTaskListener(self, tl): - try: - index = self.listeners.index(tl) - self.listeners.pop(index) - except Exception: - traceback.print_exc() - def fireTaskStatusChanged(self): te = TaskEvent(self, TaskEvent.TASK_STATUS_CHANGED) for i in range(len(self.listeners)): @@ -91,24 +74,3 @@ class Task: te = TaskEvent(self, TaskEvent.TASK_FINISHED) for i in range(len(self.listeners)): self.listeners[i].taskFinished(te) - - def fireSubtaskNameChanged(self): - te = TaskEvent(self, TaskEvent.SUBTASK_NAME_CHANGED) - for i in range(len(self.listeners)): - self.listeners[i].subtaskNameChanged(te) - - def getSubtaskName(self): - return self.subtaskName - - def getTaskName(self): - return self.taskName - - def setSubtaskName(self, s): - self.subtaskName = s - self.fireSubtaskNameChanged() - - def getFailed(self): - return self.failed - - def getSuccessfull(self): - return self.successful diff --git a/wizards/com/sun/star/wizards/ui/event/TaskEvent.py b/wizards/com/sun/star/wizards/ui/event/TaskEvent.py index 69eaec8cf320..765bb07c9444 100644 --- a/wizards/com/sun/star/wizards/ui/event/TaskEvent.py +++ b/wizards/com/sun/star/wizards/ui/event/TaskEvent.py @@ -32,9 +32,3 @@ class TaskEvent: #super(TaskEvent, self).__init__(source) self.taskType = type_ self.source = source_ - - def getTask(self): - return self.getSource() - - def getSource(self): - return self.source diff --git a/wizards/com/sun/star/wizards/ui/event/TaskListener.py b/wizards/com/sun/star/wizards/ui/event/TaskListener.py index 9cd86e946b6c..210bac4db7b6 100644 --- a/wizards/com/sun/star/wizards/ui/event/TaskListener.py +++ b/wizards/com/sun/star/wizards/ui/event/TaskListener.py @@ -33,7 +33,3 @@ class TaskListener(EventListener): @abstractmethod def taskStatusChanged(self, te): pass - - @abstractmethod - def subtaskNameChanged(self, te): - pass diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py index 195c7da23006..fbeba1178f8a 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py @@ -53,7 +53,7 @@ class UnoDataAware(DataAware): elif self.unoPropName == "Time": t = datetime.strptime(value, '%H:%M') value = Time(0, 0, t.minute, t.hour, False) - + setattr(self.unoModel, self.unoPropName, value) else: uno.invoke(self.unoModel, "set" + self.unoPropName, (value,)) @@ -97,10 +97,6 @@ class UnoDataAware(DataAware): checkBox.addItemListener(ItemListenerProcAdapter(method)) return uda - @classmethod - def attachLabel(self, data, prop, label, field): - return UnoDataAware(data, prop, label, PropertyNames.PROPERTY_LABEL) - @classmethod def attachListBox(self, data, prop, listBox, field): uda = UnoDataAware(data, prop, listBox, "SelectedItems", True)