summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/ui
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/ui')
-rw-r--r--wizards/com/sun/star/wizards/ui/ControlScroller.py230
-rw-r--r--wizards/com/sun/star/wizards/ui/DocumentPreview.py85
-rw-r--r--wizards/com/sun/star/wizards/ui/ImageList.py502
-rw-r--r--wizards/com/sun/star/wizards/ui/PathSelection.py121
-rw-r--r--wizards/com/sun/star/wizards/ui/PeerConfig.py62
-rw-r--r--wizards/com/sun/star/wizards/ui/UIConsts.py53
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog.py412
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog2.py239
-rw-r--r--wizards/com/sun/star/wizards/ui/WizardDialog.py489
-rw-r--r--wizards/com/sun/star/wizards/ui/XPathSelectionListener.py7
-rw-r--r--wizards/com/sun/star/wizards/ui/__init__.py1
-rw-r--r--wizards/com/sun/star/wizards/ui/event/CommonListener.py124
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAware.py114
-rw-r--r--wizards/com/sun/star/wizards/ui/event/ListModelBinder.py75
-rw-r--r--wizards/com/sun/star/wizards/ui/event/RadioDataAware.py37
-rw-r--r--wizards/com/sun/star/wizards/ui/event/UnoDataAware.py84
-rw-r--r--wizards/com/sun/star/wizards/ui/event/__init__.py0
17 files changed, 0 insertions, 2635 deletions
diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.py b/wizards/com/sun/star/wizards/ui/ControlScroller.py
deleted file mode 100644
index 9601400d3237..000000000000
--- a/wizards/com/sun/star/wizards/ui/ControlScroller.py
+++ /dev/null
@@ -1,230 +0,0 @@
-import uno
-import traceback
-from common.Desktop import Desktop
-from common.PropertyNames import PropertyNames
-from common.HelpIds import HelpIds
-from common.Helper import Helper
-from ui.UnoDialog import UnoDialog
-
-from com.sun.star.awt.ScrollBarOrientation import HORIZONTAL, VERTICAL
-
-class ControlScroller(object):
-
- SORELFIRSTPOSY = 3
- iScrollBarWidth = 10
- scrollfields = []
- CurUnoDialog = None
- iStep = None
- curHelpIndex = None
-
- # TODO add parameters for tabindices and helpindex
- def __init__(self, _CurUnoDialog, _xMSF, _iStep, _iCompPosX, _iCompPosY,
- _iCompWidth, _nblockincrement, _nlinedistance, _firsthelpindex):
- self.xMSF = _xMSF
- ControlScroller.nblockincrement = _nblockincrement
- ControlScroller.CurUnoDialog = _CurUnoDialog
- ControlScroller.iStep = _iStep
- ControlScroller.curHelpIndex = _firsthelpindex
- self.curtabindex = ControlScroller.iStep * 100
- self.linedistance = _nlinedistance
- self.iCompPosX = _iCompPosX
- self.iCompPosY = _iCompPosY
- self.iCompWidth = _iCompWidth
- self.iCompHeight = 2 * ControlScroller.SORELFIRSTPOSY + \
- ControlScroller.nblockincrement * self.linedistance
- self.iStartPosY = self.iCompPosY + ControlScroller.SORELFIRSTPOSY
- ScrollHeight = self.iCompHeight - 2
- self.nlineincrement = 1
- self.sincSuffix = Desktop.getIncrementSuffix(
- ControlScroller.CurUnoDialog.xDialogModel, "imgBackground")
- self.oImgControl = ControlScroller.CurUnoDialog.insertControlModel(
- "com.sun.star.awt.UnoControlImageControlModel",
- "imgBackground" + self.sincSuffix,
- ("Border", PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_WIDTH),
- (1, self.iCompHeight, self.iCompPosX,
- self.iCompPosY, ControlScroller.iStep, self.iCompWidth))
- self.oImgControl = ControlScroller.CurUnoDialog.xUnoDialog.getControl(
- "imgBackground" + self.sincSuffix)
- self.setComponentMouseTransparent()
- ControlScroller.xScrollBar = ControlScroller.CurUnoDialog.insertScrollBar(
- "TitleScrollBar" + self.sincSuffix,
- ("Border", PropertyNames.PROPERTY_ENABLED,
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_HELPURL, "Orientation",
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_WIDTH),
- (0, True, ScrollHeight,
- HelpIds.getHelpIdString(ControlScroller.curHelpIndex),
- VERTICAL, self.iCompPosX + self.iCompWidth - \
- ControlScroller.iScrollBarWidth - 1,
- self.iCompPosY + 1, ControlScroller.iStep,
- ControlScroller.iScrollBarWidth), 0, self)
- ControlScroller.nscrollvalue = 0
- ControlScroller.ControlGroupVector = []
- ypos = self.iStartPosY + ControlScroller.SORELFIRSTPOSY
- for i in xrange(ControlScroller.nblockincrement):
- self.insertControlGroup(i, ypos)
- ypos += self.linedistance
-
- def setComponentMouseTransparent(self):
- ControlScroller.CurUnoDialog.getPeerConfiguration().\
- setPeerProperties(self.oImgControl, "MouseTransparent", True)
-
- def setScrollBarOrientationHorizontal(self):
- Helper.setUnoPropertyValue(
- ControlScroller.xScrollBar, "Orientation", HORIZONTAL)
-
- @classmethod
- def fillupControls(self, binitialize):
- for i in xrange(ControlScroller.nblockincrement):
- if i < self.ncurfieldcount:
- self.fillupControl(i)
-
- if binitialize:
- ControlScroller.CurUnoDialog.repaintDialogStep()
-
- @classmethod
- def fillupControl(self, guiRow):
- nameProps = ControlScroller.scrollfields[guiRow]
- valueProps = ControlScroller.scrollfields[guiRow + ControlScroller.nscrollvalue]
- for index, item in enumerate(nameProps):
- if ControlScroller.CurUnoDialog.xDialogModel.hasByName(item.Name):
- self.setControlData(item.Name, valueProps[index].Value)
- else:
- raise AttributeError("No such control !")
-
- @classmethod
- def setScrollValue(self, _nscrollvalue, _ntotfieldcount=None):
- if _ntotfieldcount is not None:
- self.setTotalFieldCount(_ntotfieldcount)
- if _nscrollvalue >= 0:
- Helper.setUnoPropertyValue(
- ControlScroller.xScrollBar.Model, "ScrollValue", _nscrollvalue)
- self.scrollControls()
-
- @classmethod
- def setCurFieldCount(self):
- if self.ntotfieldcount > ControlScroller.nblockincrement:
- self.ncurfieldcount = ControlScroller.nblockincrement
- else:
- self.ncurfieldcount = self.ntotfieldcount
-
- @classmethod
- def setTotalFieldCount(self, _ntotfieldcount):
- self.ntotfieldcount = _ntotfieldcount
- self.setCurFieldCount()
- if self.ntotfieldcount > ControlScroller.nblockincrement:
- Helper.setUnoPropertyValues(
- ControlScroller.xScrollBar.Model,
- (PropertyNames.PROPERTY_ENABLED, "ScrollValueMax"),
- (True, self.ntotfieldcount - ControlScroller.nblockincrement))
- else:
- Helper.setUnoPropertyValue(ControlScroller.xScrollBar.Model,
- PropertyNames.PROPERTY_ENABLED, False)
-
- def toggleComponent(self, _bdoenable):
- bdoenable = _bdoenable and \
- (self.ntotfieldcount > ControlScroller.nblockincrement)
- ControlScroller.CurUnoDialog.setControlProperty(
- "TitleScrollBar" + self.sincSuffix,
- PropertyNames.PROPERTY_ENABLED, bdoenable)
-
- def toggleControls(self, _bdoenable):
- n = 0
- while n < ControlScroller.scrollfields.size():
- curproperties = ControlScroller.scrollfields.elementAt(n)
- m = 0
- while m < curproperties.length:
- curproperty = curproperties[m]
- ControlScroller.CurUnoDialog.setControlProperty(
- curproperty.Name, PropertyNames.PROPERTY_ENABLED, _bdoenable)
- m += 1
- n += 1
-
- @classmethod
- def scrollControls(self):
- try:
- ControlScroller.nscrollvalue = int(Helper.getUnoPropertyValue(
- ControlScroller.xScrollBar.Model, "ScrollValue"))
- if ControlScroller.nscrollvalue + ControlScroller.nblockincrement \
- >= self.ntotfieldcount:
- ControlScroller.nscrollvalue = \
- self.ntotfieldcount - ControlScroller.nblockincrement
- self.fillupControls(False)
- except Exception:
- traceback.print_exc()
-
- '''
- updates the corresponding data to
- the control in guiRow and column
- @param guiRow 0 based row index
- @param column 0 based column index
- @return the propertyValue object corresponding to
- this control.
- '''
-
- @classmethod
- def fieldInfo(self, guiRow, column):
- if guiRow + ControlScroller.nscrollvalue < len(ControlScroller.scrollfields):
- valueProp = (ControlScroller.scrollfields[guiRow + ControlScroller.nscrollvalue])[column]
- nameProp = (ControlScroller.scrollfields[guiRow])[column]
- if ControlScroller.CurUnoDialog.xDialogModel.hasByName(nameProp.Name):
- valueProp.Value = self.getControlData(nameProp.Name)
- else:
- valueProp.Value = nameProp.Value
- return valueProp
- else:
- return None
-
- @classmethod
- def unregisterControlGroup(self, _index):
- del ControlScroller.scrollfields[_index]
-
- @classmethod
- def registerControlGroup(self, _currowproperties, _i):
- if _i == 0:
- del ControlScroller.scrollfields[:]
-
- if _i >= len(ControlScroller.scrollfields):
- ControlScroller.scrollfields.append(_currowproperties)
- else:
- ControlScroller.scrollfields.insert(_currowproperties, _i)
-
- @classmethod
- def setControlData(self, controlname, newvalue):
- oControlModel = ControlScroller.CurUnoDialog.xUnoDialog.getControl(
- controlname).Model
- propertyname = UnoDialog.getDisplayProperty(oControlModel)
- if propertyname != "":
- ControlScroller.CurUnoDialog.setControlProperty(
- controlname, propertyname, newvalue)
-
- @classmethod
- def getControlData(self, controlname):
- oControlModel = ControlScroller.CurUnoDialog.xUnoDialog.getControl(
- controlname).Model
- propertyname = UnoDialog.getDisplayProperty(oControlModel)
- if propertyname != "":
- return ControlScroller.CurUnoDialog.getControlProperty(
- controlname, propertyname)
- else:
- return None
-
- def getScrollFieldValues(self):
- retproperties = [[ControlScroller.scrollfields.size()],[]]
- try:
- i = 0
- while i < ControlScroller.scrollfields.size():
- curproperties = ControlScroller.scrollfields.elementAt(i)
- retproperties[i] = curproperties
- i += 1
- return retproperties
- except java.lang.Exception, ex:
- ex.printStackTrace(System.out)
- return None
diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.py b/wizards/com/sun/star/wizards/ui/DocumentPreview.py
deleted file mode 100644
index b3842b85b7ae..000000000000
--- a/wizards/com/sun/star/wizards/ui/DocumentPreview.py
+++ /dev/null
@@ -1,85 +0,0 @@
-import traceback
-from common.Properties import Properties
-
-from com.sun.star.awt import WindowDescriptor
-from com.sun.star.awt import Rectangle
-from com.sun.star.awt.WindowClass import SIMPLE
-from com.sun.star.awt.VclWindowPeerAttribute import CLIPCHILDREN
-from com.sun.star.awt.WindowAttribute import SHOW
-
-'''
-@author rpiterman
-To change the template for this generated type comment go to
-Window>Preferences>Java>Code Generation>Code and Comments
-'''
-
-class DocumentPreview(object):
- PREVIEW_MODE = 1
-
- '''
- create new frame with window inside
- load a component as preview into this frame
- '''
-
- def __init__(self, xmsf, control):
- self.xControl = control
- self.createPreviewFrame(xmsf, self.xControl)
-
- def setDocument(self, url_, propNames, propValues=None):
- if propValues is None:
- if propNames == DocumentPreview.PREVIEW_MODE:
- self.setDocument(url_, ("Preview", "ReadOnly"), (True, True))
- else:
- self.loadArgs = propNames
- self.xFrame.activate()
- self.xComponent = self.xFrame.loadComponentFromURL(url_, "_self", 0, tuple(self.loadArgs))
- return self.xComponent
- else:
- self.url = url_
- ps = Properties()
- for index,item in enumerate(propNames):
- ps[item] = propValues[index]
- return self.setDocument(self.url, ps.getProperties(ps))
-
- 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)
-
- '''
- create a new frame with a new container window inside,
- which isnt part of the global frame tree.
-
- Attention:
- a) This frame wont be destroyed by the office. It must be closed by you!
- Do so - please call XCloseable::close().
- b) The container window is part of the frame. Dont hold it alive - nor try to kill it.
- It will be destroyed inside close().
- '''
-
- def createPreviewFrame(self, xmsf, xControl):
- controlPeer = xControl.Peer
- r = xControl.PosSize
- toolkit = xmsf.createInstance("com.sun.star.awt.Toolkit")
- aDescriptor = WindowDescriptor()
- aDescriptor.Type = SIMPLE
- aDescriptor.WindowServiceName = "window"
- aDescriptor.ParentIndex = -1
- aDescriptor.Parent = controlPeer
- #xWindowPeer; #argument !
- aDescriptor.Bounds = Rectangle(0, 0, r.Width, r.Height)
- aDescriptor.WindowAttributes = CLIPCHILDREN | SHOW
- self.xWindow = toolkit.createWindow(aDescriptor)
- self.xFrame = xmsf.createInstance("com.sun.star.frame.Frame")
- self.xFrame.initialize(self.xWindow)
- self.xWindow.setVisible(True)
-
- def dispose(self):
- try:
- self.closeFrame()
- except Exception:
- traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.py b/wizards/com/sun/star/wizards/ui/ImageList.py
deleted file mode 100644
index a8b40dcaf79b..000000000000
--- a/wizards/com/sun/star/wizards/ui/ImageList.py
+++ /dev/null
@@ -1,502 +0,0 @@
-from threading import RLock
-from com.sun.star.awt import Size
-from common.PropertyNames import *
-from PeerConfig import PeerConfig
-from common.HelpIds import HelpIds
-from common.Helper import Helper
-
-def synchronized(lock):
- ''' Synchronization decorator. '''
- def wrap(f):
- def newFunction(*args, **kw):
- lock.acquire()
- try:
- return f(*args, **kw)
- finally:
- lock.release()
- return newFunction
- return wrap
-
-class ImageList(object):
- NO_BORDER = 0
- BACKGROUND_COLOR = 16777216
- HIDE_PAGE = 99
- TRANSPARENT = -1
- LINE_HEIGHT = 8
- IMAGE_PROPS = ("Border", "BackgroundColor",
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_HELPURL,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y, "ScaleImage",
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_TABINDEX, "Tabstop",
- PropertyNames.PROPERTY_WIDTH)
- MOVE_SELECTION = (PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP)
- lock = RLock()
- listModel = []
- btnNext = None
- btnBack = None
-
- def __init__(self):
- self.benabled = True
- self.gap = Size(4, 4)
- self.cols = 4
- self.rows = 3
- self.imageSize = Size(20, 20)
- self.selectionGap = Size(2, 2)
- self.showButtons = True
- self.refreshOverNull = True
- self.imageTextLines = 1
- self.rowSelect = False
- self.scaleImages = True
- self.name = "il"
- self.selected = -1
- self.pageStart = 0
- self.helpURL = 0
- self.counterRenderer = self.SimpleCounterRenderer()
- self.MOVE_SELECTION_VALS = range(3)
-
- def create(self, dialog):
- self.oUnoDialog = dialog
- self.dialogModel = dialog.xDialogModel
- imageTextHeight = self.imageTextLines * ImageList.LINE_HEIGHT
- opeerConfig = PeerConfig(dialog)
- self.MOVE_SELECTION_VALS[2] = self.step
- imgContainer = dialog.insertImage(
- self.name + "lblContainer",
- ("BackgroundColor", "Border",
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_WIDTH),
- (ImageList.BACKGROUND_COLOR, 1,
- (self.imageSize.Height + self.gap.Height) \
- * self.rows + self.gap.Height + imageTextHeight + 1,
- self.pos.Width,self.pos.Height, self.step,
- (self.imageSize.Width + self.gap.Width) \
- * self.cols + self.gap.Width))
- opeerConfig.setPeerProperties(imgContainer,"MouseTransparent", True)
-
- if self.rowSelect:
- selectionWidth = (self.imageSize.Width + self.gap.Width) \
- * self.cols - self.gap.Width + (self.selectionGap.Width * 2)
- else:
- selectionWidth = self.imageSize.Width + (self.selectionGap.Width * 2)
-
- self.grbxSelectedImage = dialog.insertLabel(
- self.name + "_grbxSelected",
- ("BackgroundColor", "Border",
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP, "Tabstop",
- PropertyNames.PROPERTY_WIDTH),
- (ImageList.TRANSPARENT, 1,
- self.imageSize.Height + (self.selectionGap.Height * 2),
- 0, #height
- 0, #posx
- 0, #posy
- self.step, True, selectionWidth))
- xWindow = self.grbxSelectedImage
- xWindow.addMouseListener(None)
- pNames1 = (PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_HELPURL,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_TABINDEX, "Tabstop",
- PropertyNames.PROPERTY_WIDTH)
- self.lblImageText = dialog.insertLabel(
- self.name + "_imageText", pNames1,
- (imageTextHeight, "", self.pos.Width + 1,
- self.pos.Height + (self.imageSize.Height + self.gap.Height) \
- * self.rows + self.gap.Height, self.step, 0, False,
- self.cols * (self.imageSize.Width + self.gap.Width) \
- + self.gap.Width - 2))
- if self.showButtons:
- ImageList.btnBack = dialog.insertButton(
- self.name + "_btnBack", "prevPage", pNames1,
- (14, HelpIds.getHelpIdString((self.helpURL + 1)),
- self.pos.Width, self.pos.Height + \
- (self.imageSize.Height + self.gap.Height) * \
- self.rows + self.gap.Height + imageTextHeight + 1,
- self.step, self.tabIndex + 1, True, 14), self)
- ImageList.btnNext = dialog.insertButton(
- self.name + "_btnNext", "nextPage", pNames1,
- (14, HelpIds.getHelpIdString((self.helpURL + 1)),
- self.pos.Width + (self.imageSize.Width + self.gap.Width) * \
- self.cols + self.gap.Width - 14 + 1,
- self.pos.Height + (self.imageSize.Height + self.gap.Height) \
- * self.rows + self.gap.Height + imageTextHeight + 1,
- self.step, self.tabIndex + 2, True, 14), self)
- self.lblCounter = dialog.insertLabel(
- self.name + "_lblCounter", pNames1,
- (ImageList.LINE_HEIGHT, "", self.pos.Width + 14 + 1,
- self.pos.Height + (self.imageSize.Height + self.gap.Height) \
- * self.rows + self.gap.Height + imageTextHeight + \
- ((14 - ImageList.LINE_HEIGHT) / 2),
- self.step, 0, False, self.cols * \
- (self.imageSize.Width + self.gap.Width) + \
- self.gap.Width - 2 * 14 - 1))
- Helper.setUnoPropertyValue(self.lblCounter.Model, "Align", 1)
- Helper.setUnoPropertyValue(ImageList.btnBack.Model,
- PropertyNames.PROPERTY_LABEL, "<")
- Helper.setUnoPropertyValue(ImageList.btnNext.Model,
- PropertyNames.PROPERTY_LABEL, ">")
-
- self.m_aImages = [None] * (self.rows * self.cols)
-
- for r in xrange(self.rows):
- for c in xrange(self.cols):
- self.m_aImages[r * self.cols + c] = self.createImage(dialog, r, c)
-
- self.refreshImages()
- #COMMENTED
- #ImageList.listModel.addListDataListener(None)
-
- #used for optimization
-
- def createImage(self, dialog, _row, _col):
- imageName = self.name + "_image" + str(_row * self.cols + _col)
- image = dialog.insertImage(
- imageName, ImageList.IMAGE_PROPS,
- (ImageList.NO_BORDER, ImageList.BACKGROUND_COLOR,
- self.imageSize.Height,
- HelpIds.getHelpIdString(self.helpURL + 1),
- self.getImagePosX(_col), self.getImagePosY(_row),
- self.scaleImages, self.step, self.tabIndex,
- False, self.imageSize.Width))
- #COMMENTED
- image.addMouseListener(None)
- image.addKeyListener(None)
- return image
-
- def getImagePosX(self, col):
- return self.pos.Width + col * \
- (self.imageSize.Width + self.gap.Width) + self.gap.Width
-
- def getImagePosY(self, row):
- return self.pos.Height + row * \
- (self.imageSize.Height + self.gap.Height) + self.gap.Height
-
- def refreshImages(self):
- if self.showButtons:
- self.refreshCounterText()
-
- self.hideSelection()
- if self.refreshOverNull:
- i = 0
- for i in self.m_aImages:
- i.Visible = False
-
- focusable = True
- for index, item in enumerate(self.m_aImages):
- #COMMENTED
- oResources = None #self.renderer.getImageUrls(self.getObjectFor(index))
- if oResources is not None:
- if len(oResources) == 1:
- Helper.setUnoPropertyValue(item.Model,
- PropertyNames.PROPERTY_IMAGEURL, oResources[0])
- elif len(oResources) == 2:
- self.oUnoDialog.getPeerConfiguration().setImageUrl(
- item.Model, oResources[0], oResources[1])
-
- Helper.setUnoPropertyValue(
- item.Model, "Tabstop", bool(focusable))
- if self.refreshOverNull:
- item.Visible = True
-
- focusable = False
-
- self.refreshSelection()
-
- def refreshCounterText(self):
- Helper.setUnoPropertyValue(
- self.lblCounter.Model, PropertyNames.PROPERTY_LABEL,
- self.counterRenderer.render(
- self.Counter (self.pageStart + 1,
- self.pageEnd, len(ImageList.listModel))))
-
- def pageEnd(self):
- i = self.pageStart + self.cols * self.rows
- if i > ImageList.listModel.getSize() - 1:
- return ImageList.listModel.getSize()
- else:
- return i
-
- def refreshSelection(self):
- if self.selected < self.pageStart or \
- self.selected >= (self.pageStart + self.rows * self.cols):
- self.hideSelection()
- else:
- self.moveSelection(self.getImageIndexFor(self.selected))
-
- def hideSelection(self):
- Helper.setUnoPropertyValue(self.grbxSelectedImage.Model,
- PropertyNames.PROPERTY_STEP, ImageList.HIDE_PAGE)
- self.grbxSelectedImage.Visible = False
-
- '''
- Utility field holding list of ItemListeners.
- '''
-
- def moveSelection(self, image):
- self.grbxSelectedImage.Visible = False
- row = image / self.cols
- if self.rowSelect:
- col = 0
- else:
- col = image - (row * self.cols)
-
- self.MOVE_SELECTION_VALS[0] = \
- (self.getImagePosX(col) - self.selectionGap.Width)
- self.MOVE_SELECTION_VALS[1] = \
- (self.getImagePosY(row) - self.selectionGap.Height)
- Helper.setUnoPropertyValues(
- self.grbxSelectedImage.Model, ImageList.MOVE_SELECTION,
- self.MOVE_SELECTION_VALS)
- if (Helper.getUnoPropertyValue(self.dialogModel,
- PropertyNames.PROPERTY_STEP)) == self.step:
- self.grbxSelectedImage.Visible = True
- #now focus...
-
- for index,item in enumerate(self.m_aImages):
- if index != image:
- self.defocus(index)
- else:
- Helper.setUnoPropertyValue(
- self.m_aImages[image].Model, "Tabstop", True)
-
- '''
- @param i
- @return the Object in the list model corresponding to the given image index
- '''
-
- def getObjectFor(self, i):
- ii = self.getIndexFor(i)
- if ImageList.listModel.getSize() <= ii:
- return None
- else:
- return ImageList.listModel.getElementAt(ii)
-
- '''
- @param i
- @return the index in the listModel for the given image index.
- '''
-
- def getIndexFor(self, i):
- return self.pageStart + i
-
- def getImageIndexFor(self, i):
- return i - self.pageStart
-
- def intervalAdded(self, event):
- if event.getIndex0() <= self.selected:
- if event.getIndex1() <= self.selected:
- self.selected += event.getIndex1() - event.getIndex0() + 1
-
- if event.getIndex0() < self.pageStart or \
- event.getIndex1() < (self.pageStart + getRows() + getCols()):
- refreshImages()
-
- '''
- Registers ItemListener to receive events.
- @param listener The listener to register.
- '''
-
- @synchronized(lock)
- def addItemListener(self, listener):
- if self.itemListenerList == None:
- self.itemListenerList = java.util.ArrayList.ArrayList()
-
- self.itemListenerList.append(listener)
-
- '''
- Removes ItemListener from the list of listeners.
- @param listener The listener to remove.
- '''
-
- @synchronized(lock)
- def removeItemListener(self, listener):
- if self.itemListenerList != None:
- self.itemListenerList.remove(listener)
-
- '''
- Notifies all registered listeners about the event.
- @param event The event to be fired
- '''
-
- def fireItemSelected(self):
- with ImageList.lock:
- if self.itemListenerList is None:
- return
-
- auxlist = self.itemListenerList.clone()
-
- for i in auxlist:
- i.itemStateChanged(None)
-
- def setSelected(self, _object):
- if not isinstance(_object, int):
- _object = -1
- if _object is not None:
- for index, item in enumerate(ImageList.listModel):
- if item == _object:
- _object = index
- return
-
- if self.rowSelect and (_object >= 0):
- _object = (_object / self.cols) * self.cols
-
- if self.selected == _object:
- return
-
- self.selected = _object
- self.refreshImageText()
- self.refreshSelection()
- #COMMENTED
- #self.fireItemSelected()
-
- def refreshImageText(self):
- if self.selected >= 0:
- #COMMENTED
- item = None #ImageList.listModel.getElementAt(self.selected)
- else:
- item = None
-
- Helper.setUnoPropertyValue(
- self.lblImageText.Model, PropertyNames.PROPERTY_LABEL,
- " " + self.renderer.render(item))
-
-
- def nextPage(self):
- if self.pageStart < listModel().getSize() - self.rows * self.cols:
- setPageStart(self.pageStart + self.rows * self.cols)
-
- def prevPage(self):
- if self.pageStart == 0:
- return
-
- i = self.pageStart - self.rows * self.cols
- if i < 0:
- i = 0
-
- setPageStart(i)
-
- def enableButtons(self):
- self.enable(
- ImageList.btnNext,
- bool(self.pageStart + self.rows * self.cols < len(ImageList.listModel)))
- self.enable(ImageList.btnBack, bool(self.pageStart > 0))
-
- def enable(self, control, enable):
- Helper.setUnoPropertyValue(control.Model,
- PropertyNames.PROPERTY_ENABLED, enable)
-
- def setBorder(self, control, border):
- Helper.setUnoPropertyValue(control.Model, "Border", border)
-
- def getImageFromEvent(self, event):
- image = (event).Source
- controlName = Helper.getUnoPropertyValue(image.Model,
- PropertyNames.PROPERTY_NAME)
- return Integer.valueOf(controlName.substring(6 + self.name.length()))
-
- def mousePressed(self, event):
- image = getImageFromEvent(event)
- index = getIndexFor(image)
- if index < ImageList.listModel.getSize():
- focus(image)
- setSelected(index)
-
- def getSelectedObjects(self):
- return[listModel().getElementAt(self.selected)]
-
- class SimpleCounterRenderer:
-
- def render(self, counter):
- return \
- "" + (counter).start + ".." + (counter).end + "/" + (counter).max
-
- class Counter(object):
-
- def __init__(self, start_, end_, max_):
- self.start = start_
- self.end = end_
- self.max = max_
-
- def getSelectedObject(self):
- if self.selected >= 0:
- return listModel().getElementAt(self.selected)
- return None
-
- def showSelected(self):
- oldPageStart = self.pageStart
- if self.selected != -1:
- self.pageStart = \
- (self.selected / len(self.m_aImages)) * len(self.m_aImages)
-
- if oldPageStart != self.pageStart:
- #COMMENTED
- #self.enableButtons()
- self.refreshImages()
-
- def keyPressed(self, ke):
- image = getImageFromEvent(ke)
- r = image / getCols()
- c = image - (r * getCols())
- d = getKeyMove(ke, r, c)
- newImage = image + d
- if newImage == image:
- return
-
- if isFocusable(newImage):
- changeFocus(image, newImage)
-
- def isFocusable(self, image):
- return (image >= 0) and \
- (getIndexFor(image) < ImageList.listModel.getSize())
-
- def changeFocus(self, oldFocusImage, newFocusImage):
- focus(newFocusImage)
- defocus(oldFocusImage)
-
- def select(self, ke):
- setSelected(getIndexFor(getImageFromEvent(ke)))
-
- def focus(self, image):
- Helper.setUnoPropertyValue(
- self.m_aImages[image].Model, "Tabstop", True)
- xWindow = self.m_aImages[image]
- xWindow.setFocus()
-
- def defocus(self, image):
- Helper.setUnoPropertyValue(
- self.m_aImages[image].Model, "Tabstop", False)
-
- '''jump to the given item (display the screen
- that contains the given item).
- @param i
- '''
-
- def display(self, i):
- isAux = (getCols() * getRows())
- ps = (ImageList.listModel.getSize() / isAux) * isAux
- setPageStart(ps)
-
- def setenabled(self, b):
- i = 0
- while i < self.m_aImages.length:
- UnoDialog2.setEnabled(self.m_aImages[i], b)
- i += 1
- UnoDialog2.setEnabled(self.grbxSelectedImage, b)
- UnoDialog2.setEnabled(self.lblImageText, b)
- if self.showButtons:
- UnoDialog2.setEnabled(ImageList.btnBack, b)
- UnoDialog2.setEnabled(ImageList.btnNext, b)
- UnoDialog2.setEnabled(self.lblCounter, b)
-
- self.benabled = b
diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.py b/wizards/com/sun/star/wizards/ui/PathSelection.py
deleted file mode 100644
index 2be27ac836f9..000000000000
--- a/wizards/com/sun/star/wizards/ui/PathSelection.py
+++ /dev/null
@@ -1,121 +0,0 @@
-import traceback
-from common.PropertyNames import *
-from common.FileAccess import *
-from common.SystemDialog import SystemDialog
-
-class PathSelection(object):
-
- class DialogTypes(object):
- FOLDER = 0
- FILE = 1
-
- class TransferMode(object):
- SAVE = 0
- LOAD = 1
-
- def __init__(self, xMSF, CurUnoDialog, TransferMode, DialogType):
- self.CurUnoDialog = CurUnoDialog
- self.xMSF = xMSF
- self.iDialogType = DialogType
- self.iTransferMode = TransferMode
- self.sDefaultDirectory = ""
- self.sDefaultName = ""
- self.sDefaultFilter = ""
- self.usedPathPicker = False
- self.CMDSELECTPATH = 1
- self.TXTSAVEPATH = 1
-
- def insert(
- self, DialogStep, XPos, YPos, Width,
- CurTabIndex, LabelText, Enabled, TxtHelpURL, BtnHelpURL):
-
- self.CurUnoDialog.insertControlModel(
- "com.sun.star.awt.UnoControlFixedTextModel", "lblSaveAs",
- (PropertyNames.PROPERTY_ENABLED,
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_LABEL,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_TABINDEX,
- PropertyNames.PROPERTY_WIDTH),
- (Enabled, 8, LabelText, XPos, YPos, DialogStep,
- CurTabIndex, Width))
- self.xSaveTextBox = self.CurUnoDialog.insertTextField(
- "txtSavePath", "callXPathSelectionListener",
- (PropertyNames.PROPERTY_ENABLED,
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_HELPURL,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_TABINDEX,
- PropertyNames.PROPERTY_WIDTH),
- (Enabled, 12, TxtHelpURL, XPos, YPos + 10, DialogStep,
- (CurTabIndex + 1), Width - 26), self)
-
- self.CurUnoDialog.setControlProperty("txtSavePath",
- PropertyNames.PROPERTY_ENABLED, False )
- self.CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker",
- (PropertyNames.PROPERTY_ENABLED,
- 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),
- (Enabled, 14, BtnHelpURL, "...",XPos + Width - 16, YPos + 9,
- DialogStep, (CurTabIndex + 2), 16), self)
-
- def addSelectionListener(self, xAction):
- self.xAction = xAction
-
- def getSelectedPath(self):
- return self.xSaveTextBox.Text
-
- def initializePath(self):
- try:
- myFA = FileAccess(self.xMSF)
- self.xSaveTextBox.setText(
- myFA.getPath(self.sDefaultDirectory + \
- "/" + \
- self.sDefaultName, None))
- except Exception, e:
- traceback.print_exc()
-
- def triggerPathPicker(self):
- try:
- if self.iTransferMode == self.TransferMode.SAVE:
- if self.iDialogType == self.DialogTypes.FOLDER:
- #TODO: write code for picking a folder for saving
- return
- elif self.iDialogType == self.DialogTypes.FILE:
- self.usedPathPicker = True
- myFilePickerDialog = \
- SystemDialog.createStoreDialog(self.xMSF)
- myFilePickerDialog.callStoreDialog(
- self.sDefaultDirectory,
- self.sDefaultName, self.sDefaultFilter)
- sStorePath = myFilePickerDialog.sStorePath
- if sStorePath is not None:
- myFA = FileAccess(self.xMSF);
- self.xSaveTextBox.Text = myFA.getPath(sStorePath, None)
- self.sDefaultDirectory = \
- FileAccess.getParentDir(sStorePath)
- self.sDefaultName = myFA.getFilename(sStorePath)
- return
- elif iTransferMode == TransferMode.LOAD:
- if iDialogType == DialogTypes.FOLDER:
- #TODO: write code for picking a folder for loading
- return
- elif iDialogType == DialogTypes.FILE:
- #TODO: write code for picking a file for loading
- return
- except Exception, e:
- traceback.print_exc()
-
- def callXPathSelectionListener(self):
- if self.xAction != None:
- self.xAction.validatePath()
diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.py b/wizards/com/sun/star/wizards/ui/PeerConfig.py
deleted file mode 100644
index b43d8bd5cc13..000000000000
--- a/wizards/com/sun/star/wizards/ui/PeerConfig.py
+++ /dev/null
@@ -1,62 +0,0 @@
-from event.CommonListener import WindowListenerProcAdapter
-
-'''
-@author rpiterman
-To change the template for this generated type comment go to
-Window>Preferences>Java>Code Generation>Code and Comments
-'''
-
-class PeerConfig(object):
-
- def __init__(self, _oUnoDialog):
- self.oUnoDialog = _oUnoDialog
- self.oUnoDialog.xUnoDialog.addWindowListener(
- WindowListenerProcAdapter(self.windowShown))
- self.m_aPeerTasks = []
- self.aImageUrlTasks = []
-
- class PeerTask(object):
-
- def __init__(self, _xControl, _propNames, _propValues):
- self.propnames = _propNames
- self.propvalues = _propValues
- self.xControl = _xControl
-
- class ImageUrlTask(object):
-
- def __init__(self, _oModel, _oResource, _oHCResource):
- self.oModel = _oModel
- self.oResource = _oResource
- self.oHCResource = _oHCResource
-
- def windowShown(self):
- try:
- for i in self.m_aPeerTasks:
- xVclWindowPeer = i.xControl.Peer
- xVclWindowPeer.setProperty(i.propnames, i.propvalues)
-
- for i in self.aImageUrlTasks:
- if isinstance(aImageUrlTask.oResource, int):
- sImageUrl = oUnoDialog.getWizardImageUrl(aImageUrlTask.oResource, aImageUrlTask.oHCResource)
- elif isinstance(aImageUrlTask.oResource, str):
- sImageUrl = oUnoDialog.getImageUrl(aImageUrlTask.oResource, aImageUrlTask.oHCResource)
- if sImageUrl != "":
- Helper.setUnoPropertyValue(aImageUrlTask.oModel, PropertyNames.PROPERTY_IMAGEURL, sImageUrl)
-
- except Exception:
- traceback.print_exc()
-
- '''
- @param oAPIControl an API control that the interface
- XControl can be derived from
- @param _propnames
- @param _propvalues
- '''
-
- def setPeerProperties(self, _xControl, propnames, propvalues):
- oPeerTask = self.PeerTask(_xControl, propnames, propvalues)
- self.m_aPeerTasks.append(oPeerTask)
-
- def setImageUrl(self, _ocontrolmodel, _oResource, _oHCResource):
- oImageUrlTask = self.ImageUrlTask(_ocontrolmodel, _oResource, _oHCResource)
- self.aImageUrlTasks.append(oImageUrlTask)
diff --git a/wizards/com/sun/star/wizards/ui/UIConsts.py b/wizards/com/sun/star/wizards/ui/UIConsts.py
deleted file mode 100644
index a975ff4904d5..000000000000
--- a/wizards/com/sun/star/wizards/ui/UIConsts.py
+++ /dev/null
@@ -1,53 +0,0 @@
-RID_COMMON = 500
-RID_DB_COMMON = 1000
-RID_FORM = 2200
-RID_QUERY = 2300
-RID_REPORT = 2400
-RID_TABLE = 2500
-RID_IMG_REPORT = 1000
-RID_IMG_FORM = 1100
-RID_IMG_WEB = 1200
-INVISIBLESTEP = 99
-INFOIMAGEURL = "private:resource/dbu/image/19205"
-
-'''
-The tabindex of the navigation buttons in a wizard must be assigned a very
-high tabindex because on every step their taborder must appear at the end
-'''
-SOFIRSTWIZARDNAVITABINDEX = 30000
-
-#Steps of the QueryWizard
-
-SOFIELDSELECTIONPAGE = 1
-SOSORTINGPAGE = 2
-SOFILTERPAGE = 3
-SOAGGREGATEPAGE = 4
-SOGROUPSELECTIONPAGE = 5
-SOGROUPFILTERPAGE = 6
-SOTITLESPAGE = 7
-SOSUMMARYPAGE = 8
-
-class CONTROLTYPE():
-
- BUTTON = 1
- IMAGECONTROL = 2
- LISTBOX = 3
- COMBOBOX = 4
- CHECKBOX = 5
- RADIOBUTTON = 6
- DATEFIELD = 7
- EDITCONTROL = 8
- FILECONTROL = 9
- FIXEDLINE = 10
- FIXEDTEXT = 11
- FORMATTEDFIELD = 12
- GROUPBOX = 13
- HYPERTEXT = 14
- NUMERICFIELD = 15
- PATTERNFIELD = 16
- PROGRESSBAR = 17
- ROADMAP = 18
- SCROLLBAR = 19
- TIMEFIELD = 20
- CURRENCYFIELD = 21
- UNKNOWN = -1
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
deleted file mode 100644
index 53519ec30fec..000000000000
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ /dev/null
@@ -1,412 +0,0 @@
-import uno
-import traceback
-import UIConsts
-from common.PropertyNames import PropertyNames
-from common.Helper import Helper
-from ui.PeerConfig import PeerConfig
-
-from com.sun.star.awt import Rectangle
-from com.sun.star.awt import Rectangle
-from com.sun.star.awt.PosSize import POS
-
-class UnoDialog(object):
-
- createDict = False
- dictProperties = None
-
- def __init__(self, xMSF, PropertyNames, PropertyValues):
- try:
- self.xMSF = xMSF
- self.ControlList = {}
- self.xDialogModel = xMSF.createInstance(
- "com.sun.star.awt.UnoControlDialogModel")
- self.xDialogModel.setPropertyValues(PropertyNames, PropertyValues)
- self.xUnoDialog = xMSF.createInstance(
- "com.sun.star.awt.UnoControlDialog")
- self.xUnoDialog.setModel(self.xDialogModel)
- self.m_oPeerConfig = None
- self.xWindowPeer = None
- except Exception, e:
- traceback.print_exc()
-
- def getControlKey(self, EventObject, ControlList):
- xControlModel = EventObject.getModel()
- try:
- sName = xControlModel.getPropertyValue(
- PropertyNames.PROPERTY_NAME)
- iKey = ControlList.get(sName).intValue()
- except com.sun.star.uno.Exception, exception:
- traceback.print_exc()
- iKey = 2000
-
- return iKey
-
- def getPeerConfiguration(self):
- if self.m_oPeerConfig is None:
- self.m_oPeerConfig = PeerConfig(self)
- return self.m_oPeerConfig
-
- def setControlProperty(self, ControlName, PropertyName, PropertyValue):
- try:
- if PropertyValue is not None:
- if not self.xDialogModel.hasByName(ControlName):
- return
- xPSet = self.xDialogModel.getByName(ControlName)
- setattr(xPSet,PropertyName, PropertyValue)
-
- except Exception, exception:
- traceback.print_exc()
-
- def setControlProperties(
- self, ControlName, PropertyNames, PropertyValues):
- self.setControlProperty(ControlName, PropertyNames, PropertyValues)
-
- def getControlProperty(self, ControlName, PropertyName):
- try:
- xPSet = self.xDialogModel.getByName(ControlName)
- return xPSet.getPropertyValue(PropertyName)
- except Exception, exception:
- traceback.print_exc()
- return None
-
-
- def printControlProperties(self, ControlName):
- try:
- xControlModel = self.xDialogModel().getByName(ControlName)
- allProps = xControlModel.PropertySetInfo.Properties
- i = 0
- while i < allProps.length:
- sName = allProps[i].Name
- i += 1
- except Exception, exception:
- traceback.print_exc()
-
- def getMAPConversionFactor(self, ControlName):
- xControl2 = self.xUnoDialog.getControl(ControlName)
- aSize = xControl2.Size
- dblMAPWidth = Helper.getUnoPropertyValue(xControl2.Model,
- int(PropertyNames.PROPERTY_WIDTH))
- return (aSize.Width / dblMAPWidth)
-
- def getpreferredLabelSize(self, LabelName, sLabel):
- xControl2 = self.xUnoDialog.getControl(LabelName)
- OldText = xControl2.Text
- xControl2.setText(sLabel)
- aSize = xControl2.PreferredSize
- xControl2.setText(OldText)
- return aSize
-
- def removeSelectedItems(self, xListBox):
- SelList = xListBox.SelectedItemsPos
- Sellen = SelList.length
- i = Sellen - 1
- while i >= 0:
- xListBox.removeItems(SelList[i], 1)
- i -= 1
-
- def getListBoxItemCount(self, _xListBox):
- # This function may look ugly, but this is the only way to check
- # the count of values in the model,which is always right.
- # the control is only a view and could be right or not.
- fieldnames = Helper.getUnoPropertyValue(getModel(_xListBox),
- "StringItemList")
- return fieldnames.length
-
- def getSelectedItemPos(self, _xListBox):
- ipos = Helper.getUnoPropertyValue(getModel(_xListBox),
- "SelectedItems")
- return ipos[0]
-
- def isListBoxSelected(self, _xListBox):
- ipos = Helper.getUnoPropertyValue(getModel(_xListBox),
- "SelectedItems")
- return ipos.length > 0
-
- def addSingleItemtoListbox(self, xListBox, ListItem, iSelIndex):
- xListBox.addItem(ListItem, xListBox.getItemCount())
- if iSelIndex != -1:
- xListBox.selectItemPos(iSelIndex, True)
-
- '''
- The problem with setting the visibility of controls is that
- changing the current step of a dialog will automatically make
- all controls visible. The PropertyNames.PROPERTY_STEP property
- always wins against the property "visible".
- Therfor a control meant to be invisible is placed on a step far far away.
- Afterwards the step property of the dialog has to be set with
- "repaintDialogStep". As the performance of that method is very bad it
- should be used only once for all controls
- @param controlname the name of the control
- @param bIsVisible sets the control visible or invisible
- '''
-
- def setControlVisible(self, controlname, bIsVisible):
- try:
- iCurControlStep = int(getControlProperty(
- controlname, PropertyNames.PROPERTY_STEP))
- iCurDialogStep = int(Helper.getUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_STEP))
- if bIsVisible:
- setControlProperty(
- controlname, PropertyNames.PROPERTY_STEP, iCurDialogStep)
- else:
- setControlProperty(
- controlname, PropertyNames.PROPERTY_STEP,
- UIConsts.INVISIBLESTEP)
-
- except com.sun.star.uno.Exception, exception:
- traceback.print_exc()
-
- # repaints the currentDialogStep
-
- def repaintDialogStep(self):
- try:
- ncurstep = int(Helper.getUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_STEP))
- Helper.setUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_STEP, 99)
- Helper.setUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_STEP, ncurstep)
- except com.sun.star.uno.Exception, exception:
- traceback.print_exc()
-
- def insertControlModel(
- self, serviceName, componentName, sPropNames, oPropValues):
- try:
- xControlModel = self.xDialogModel.createInstance(serviceName)
- Helper.setUnoPropertyValues(
- xControlModel, sPropNames, oPropValues)
- self.xDialogModel.insertByName(componentName, xControlModel)
- Helper.setUnoPropertyValue(xControlModel,
- PropertyNames.PROPERTY_NAME, componentName)
- except Exception, ex:
- traceback.print_exc()
-
- aObj = self.xUnoDialog.getControl(componentName)
- return aObj
-
- def setFocus(self, ControlName):
- oFocusControl = self.xUnoDialog.getControl(ControlName)
- oFocusControl.setFocus()
-
- def combineListboxList(self, sFirstEntry, MainList):
- try:
- FirstList = [sFirstEntry]
- ResultList = [MainList.length + 1]
- System.arraycopy(FirstList, 0, ResultList, 0, 1)
- System.arraycopy(MainList, 0, ResultList, 1, len(MainList))
- return ResultList
- except java.lang.Exception, jexception:
- traceback.print_exc()
- return None
-
- def selectListBoxItem(self, xListBox, iFieldsSelIndex):
- if iFieldsSelIndex > -1:
- FieldCount = xListBox.getItemCount()
- if FieldCount > 0:
- if iFieldsSelIndex < FieldCount:
- xListBox.selectItemPos(iFieldsSelIndex, True)
- else:
- xListBox.selectItemPos((short)(iFieldsSelIndex - 1), True)
-
- # deselects a Listbox. MultipleMode is not supported
-
- def deselectListBox(self, _xBasisListBox):
- oListBoxModel = getModel(_xBasisListBox)
- sList = Helper.getUnoPropertyValue(oListBoxModel, "StringItemList")
- Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", [[],[]])
- Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", sList)
-
- def calculateDialogPosition(self, FramePosSize):
- # Todo:check if it would be useful or possible to create a dialog peer
- # that can be used for the messageboxes to
- # maintain modality when they pop up.
- CurPosSize = self.xUnoDialog.getPosSize()
- WindowHeight = FramePosSize.Height
- WindowWidth = FramePosSize.Width
- DialogWidth = CurPosSize.Width
- DialogHeight = CurPosSize.Height
- iXPos = ((WindowWidth / 2) - (DialogWidth / 2))
- iYPos = ((WindowHeight / 2) - (DialogHeight / 2))
- self.xUnoDialog.setPosSize(
- iXPos, iYPos, DialogWidth, DialogHeight, POS)
-
- '''
- @param FramePosSize
- @return 0 for cancel, 1 for ok
- @throws com.sun.star.uno.Exception
- '''
-
- def executeDialog(self, FramePosSize):
- if self.xUnoDialog.getPeer() == None:
- raise AttributeError(
- "Please create a peer, using your own frame")
-
- self.calculateDialogPosition(FramePosSize)
-
- if self.xWindowPeer == None:
- self.createWindowPeer()
- return self.xUnoDialog.execute()
-
- def setVisible(self, parent):
- self.calculateDialogPosition(parent.xWindow.getPosSize())
- if self.xWindowPeer == None:
- self.createWindowPeer()
-
- 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
- @throws com.sun.star.uno.Exception
- '''
-
- def executeDialogFromComponent(self, xComponent):
- if xComponent is not None:
- w = xComponent.ComponentWindow
- if w is not None:
- return self.executeDialog(w.PosSize)
-
- return self.executeDialog( Rectangle (0, 0, 640, 400))
-
- def modifyFontWeight(self, ControlName, FontWeight):
- oFontDesc = FontDescriptor.FontDescriptor()
- oFontDesc.Weight = FontWeight
- setControlProperty(ControlName, "FontDescriptor", oFontDesc)
-
- '''
- create a peer for this
- dialog, using the given
- peer as a parent.
- @param parentPeer
- @return
- @throws java.lang.Exception
- '''
-
- def createWindowPeer(self, parentPeer=None):
- self.xUnoDialog.setVisible(False)
- xToolkit = self.xMSF.createInstance("com.sun.star.awt.Toolkit")
- if parentPeer == None:
- parentPeer = xToolkit.getDesktopWindow()
-
- self.xUnoDialog.createPeer(xToolkit, parentPeer)
- 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):
- Helper.setUnoPropertyValue(
- control.Model, PropertyNames.PROPERTY_ENABLED, enabled)
-
- @classmethod
- def getControlModelType(self, xServiceInfo):
- if xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlFixedTextModel"):
- return UIConsts.CONTROLTYPE.FIXEDTEXT
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlButtonModel"):
- return UIConsts.CONTROLTYPE.BUTTON
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlCurrencyFieldModel"):
- return UIConsts.CONTROLTYPE.CURRENCYFIELD
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlDateFieldModel"):
- return UIConsts.CONTROLTYPE.DATEFIELD
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlFixedLineModel"):
- return UIConsts.CONTROLTYPE.FIXEDLINE
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlFormattedFieldModel"):
- return UIConsts.CONTROLTYPE.FORMATTEDFIELD
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlRoadmapModel"):
- return UIConsts.CONTROLTYPE.ROADMAP
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlNumericFieldModel"):
- return UIConsts.CONTROLTYPE.NUMERICFIELD
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlPatternFieldModel"):
- return UIConsts.CONTROLTYPE.PATTERNFIELD
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlHyperTextModel"):
- return UIConsts.CONTROLTYPE.HYPERTEXT
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlProgressBarModel"):
- return UIConsts.CONTROLTYPE.PROGRESSBAR
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlTimeFieldModel"):
- return UIConsts.CONTROLTYPE.TIMEFIELD
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlImageControlModel"):
- return UIConsts.CONTROLTYPE.IMAGECONTROL
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlRadioButtonModel"):
- return UIConsts.CONTROLTYPE.RADIOBUTTON
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlCheckBoxModel"):
- return UIConsts.CONTROLTYPE.CHECKBOX
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlEditModel"):
- return UIConsts.CONTROLTYPE.EDITCONTROL
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlComboBoxModel"):
- return UIConsts.CONTROLTYPE.COMBOBOX
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlListBoxModel"):
- return UIConsts.CONTROLTYPE.LISTBOX
- else:
- return UIConsts.CONTROLTYPE.UNKNOWN
-
- @classmethod
- def getDisplayProperty(self, oControlModel):
- itype = self.getControlModelType(oControlModel)
- if not UnoDialog.createDict:
- UnoDialog.createDict = True
- UnoDialog.dictProperties = {
- UIConsts.CONTROLTYPE.FIXEDTEXT:PropertyNames.PROPERTY_LABEL,
- UIConsts.CONTROLTYPE.BUTTON:PropertyNames.PROPERTY_LABEL,
- UIConsts.CONTROLTYPE.FIXEDLINE:PropertyNames.PROPERTY_LABEL,
- UIConsts.CONTROLTYPE.NUMERICFIELD:"Value",
- UIConsts.CONTROLTYPE.CURRENCYFIELD:"Value",
- UIConsts.CONTROLTYPE.FORMATTEDFIELD:"EffectiveValue",
- UIConsts.CONTROLTYPE.DATEFIELD:"Date",
- UIConsts.CONTROLTYPE.TIMEFIELD:"Time",
- UIConsts.CONTROLTYPE.SCROLLBAR:"ScrollValue",
- UIConsts.CONTROLTYPE.PROGRESSBAR:"ProgressValue",
- UIConsts.CONTROLTYPE.IMAGECONTROL:PropertyNames.PROPERTY_IMAGEURL,
- UIConsts.CONTROLTYPE.RADIOBUTTON:PropertyNames.PROPERTY_STATE,
- UIConsts.CONTROLTYPE.CHECKBOX:PropertyNames.PROPERTY_STATE,
- UIConsts.CONTROLTYPE.EDITCONTROL:"Text",
- UIConsts.CONTROLTYPE.COMBOBOX:"Text",
- UIConsts.CONTROLTYPE.PATTERNFIELD:"Text",
- UIConsts.CONTROLTYPE.LISTBOX:"SelectedItems"
- }
- try:
- return UnoDialog.dictProperties[itype]
- except KeyError:
- return ""
-
- def addResourceHandler(self, _Unit, _Module):
- self.m_oResource = Resource(self.xMSF, _Unit, _Module)
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.py b/wizards/com/sun/star/wizards/ui/UnoDialog2.py
deleted file mode 100644
index 45b6249a942f..000000000000
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.py
+++ /dev/null
@@ -1,239 +0,0 @@
-from UnoDialog import *
-from ui.event.CommonListener import *
-from common.Desktop import Desktop
-
-'''
-This class contains convenience methods for inserting components to a dialog.
-It was created for use with the automatic conversion of Basic XML Dialog
-description files to a Java class which builds
-the same dialog through the UNO API.<br/>
-It uses an Event-Listener method, which calls a method through reflection
-wenn an event on a component is trigered.
-see the classes CommonListener for details
-'''
-
-class UnoDialog2(UnoDialog):
-
- '''
- Override this method to return another listener.
- @return
- '''
-
- def __init__(self, xmsf):
- super(UnoDialog2,self).__init__(xmsf,(), ())
- ControlList = {}
-
- def insertButton(
- self, sName, actionPerformed, sPropNames, oPropValues, listener):
- xButton = self.insertControlModel(
- "com.sun.star.awt.UnoControlButtonModel",
- sName, sPropNames, oPropValues)
- if actionPerformed is not None:
- actionPerformed = getattr(listener, actionPerformed)
- xButton.addActionListener(
- ActionListenerProcAdapter(actionPerformed))
-
- return xButton
-
- def insertImageButton(
- self, sName, actionPerformed, sPropNames, oPropValues, listener):
- xButton = self.insertControlModel(
- "com.sun.star.awt.UnoControlButtonModel",
- sName, sPropNames, oPropValues)
- if actionPerformed is not None:
- actionPerformed = getattr(listener, actionPerformed)
- xButton.addActionListener(
- ActionListenerProcAdapter(actionPerformed))
-
- return xButton
-
- def insertCheckBox(
- self, sName, itemChanged, sPropNames, oPropValues, listener):
- xCheckBox = self.insertControlModel(
- "com.sun.star.awt.UnoControlCheckBoxModel",
- sName, sPropNames, oPropValues)
- if itemChanged is not None:
- itemChanged = getattr(listener, itemChanged)
- xCheckBox.addItemListener(ItemListenerProcAdapter(itemChanged))
-
- return xCheckBox
-
- def insertComboBox(
- self, sName, actionPerformed, itemChanged,
- textChanged, sPropNames, oPropValues, listener):
- xComboBox = self.insertControlModel(
- "com.sun.star.awt.UnoControlComboBoxModel",
- sName, sPropNames, oPropValues)
- if actionPerformed is not None:
- actionPerformed = getattr(listener, actionPerformed)
- xComboBox.addActionListener(
- ActionListenerProcAdapter(actionPerformed))
-
- if itemChanged is not None:
- itemChanged = getattr(listener, itemChanged)
- xComboBox.addItemListener(ItemListenerProcAdapter(itemChanged))
-
- if textChanged is not None:
- textChanged = getattr(listener, textChanged)
- xComboBox.addTextListener(TextListenerProcAdapter(textChanged))
-
- return xComboBox
-
- def insertListBox(
- self, sName, actionPerformed, itemChanged,
- sPropNames, oPropValues, listener):
- xListBox = self.insertControlModel(
- "com.sun.star.awt.UnoControlListBoxModel",
- sName, sPropNames, oPropValues)
-
- if itemChanged is not None:
- itemChanged = getattr(listener, itemChanged)
- xListBox.addItemListener(ItemListenerProcAdapter(itemChanged))
-
- return xListBox
-
- def insertRadioButton(
- self, sName, itemChanged, sPropNames, oPropValues, listener):
- xRadioButton = self.insertControlModel(
- "com.sun.star.awt.UnoControlRadioButtonModel",
- sName, sPropNames, oPropValues)
- if itemChanged is not None:
- itemChanged = getattr(listener, itemChanged)
- xRadioButton.addItemListener(
- ItemListenerProcAdapter(itemChanged))
-
- 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(
- sName, sTextChanged, "com.sun.star.awt.UnoControlEditModel",
- sPropNames, oPropValues, listener)
-
- def insertImage(self, sName, sPropNames, oPropValues):
- return self.insertControlModel(
- "com.sun.star.awt.UnoControlImageControlModel",
- sName, sPropNames, oPropValues)
-
- def insertInfoImage(self, _posx, _posy, _iStep):
- xImgControl = self.insertImage(
- Desktop.getUniqueName(self.xDialogModel, "imgHint"),
- ("Border",
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_IMAGEURL,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y, "ScaleImage",
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_WIDTH),
- (0, 10, UIConsts.INFOIMAGEURL, _posx, _posy, False, _iStep, 10))
- return xImgControl
-
- '''
- This method is used for creating Edit, Currency, Date, Formatted,
- Pattern, File and Time edit components.
- '''
-
- def insertEditField(
- self, sName, sTextChanged, sModelClass,
- sPropNames, oPropValues, listener):
- xField = self.insertControlModel(sModelClass,
- sName, sPropNames, oPropValues)
- if sTextChanged is not None:
- sTextChanged = getattr(listener, sTextChanged)
- 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(
- sName, sTextChanged,
- "com.sun.star.awt.UnoControlDateFieldModel",
- sPropNames, oPropValues, listener)
-
- def insertNumericField(
- self, sName, sTextChanged, sPropNames, oPropValues, listener):
- return self.insertEditField(
- sName, sTextChanged,
- "com.sun.star.awt.UnoControlNumericFieldModel",
- sPropNames, oPropValues, listener)
-
- def insertTimeField(
- self, sName, sTextChanged, sPropNames, oPropValues, listener):
- return self.insertEditField(
- sName, sTextChanged,
- "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(
- sName, sTextChanged,
- "com.sun.star.awt.UnoControlFormattedFieldModel",
- sPropNames, oPropValues, listener)
-
- def insertFixedLine(self, sName, sPropNames, oPropValues):
- oLine = self.insertControlModel(
- "com.sun.star.awt.UnoControlFixedLineModel",
- sName, sPropNames, oPropValues)
- return oLine
-
- def insertLabel(self, sName, sPropNames, oPropValues):
- oFixedText = self.insertControlModel(
- "com.sun.star.awt.UnoControlFixedTextModel",
- sName, sPropNames, oPropValues)
- return oFixedText
-
- def insertScrollBar(self, sName, sPropNames, oPropValues,
- iControlKey, listener):
- oScrollBar = self.insertControlModel(
- "com.sun.star.awt.UnoControlScrollBarModel",
- sName, sPropNames, oPropValues)
- if listener is not None:
- method = getattr(listener, "scrollControls")
- oScrollBar.addAdjustmentListener(
- AdjustmentListenerProcAdapter(method))
- if self.ControlList is not None:
- 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,
- windowServiceName, windowAttribute, MessageText)
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
deleted file mode 100644
index b2a687d1de5a..000000000000
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ /dev/null
@@ -1,489 +0,0 @@
-from UnoDialog2 import *
-from common.Resource import Resource
-from abc import ABCMeta, abstractmethod
-from common.HelpIds import *
-from document.OfficeDocument import OfficeDocument
-from text.TextDocument import TextDocument
-
-from com.sun.star.lang import NoSuchMethodException
-from com.sun.star.lang import IllegalArgumentException
-from com.sun.star.frame import TerminationVetoException
-from com.sun.star.awt.PushButtonType import HELP, STANDARD
-from ui.XPathSelectionListener import XPathSelectionListener
-
-class WizardDialog(UnoDialog2):
-
- __metaclass__ = ABCMeta
-
- __NEXT_ACTION_PERFORMED = "gotoNextAvailableStep"
- __BACK_ACTION_PERFORMED = "gotoPreviousAvailableStep"
- __FINISH_ACTION_PERFORMED = "finishWizard_1"
- __CANCEL_ACTION_PERFORMED = "cancelWizard_1"
- __HELP_ACTION_PERFORMED = None
-
- '''
- Creates a new instance of WizardDialog
- the hid is used as following :
- "HID:(hid)" - the dialog
- "HID:(hid+1) - the help button
- "HID:(hid+2)" - the back button
- "HID:(hid+3)" - the next button
- "HID:(hid+4)" - the create button
- "HID:(hid+5)" - the cancel button
- @param xMSF
- @param hid_
- '''
-
- def __init__(self, xMSF, hid_):
- super(WizardDialog,self).__init__(xMSF)
- self.__hid = hid_
- self.__iButtonWidth = 50
- self.nNewStep = 1
- self.nOldStep = 1
- self.nMaxStep = 1
- self.__bTerminateListenermustberemoved = True
- self.__oWizardResource = Resource(xMSF, "dbw")
- self.sMsgEndAutopilot = self.__oWizardResource.getResText(
- UIConsts.RID_DB_COMMON + 33)
- self.oRoadmap = None
-
- def itemStateChanged(self, itemEvent):
- try:
- self.nNewStep = itemEvent.ItemId
- self.nOldStep = int(Helper.getUnoPropertyValue(
- self.xDialogModel,
- PropertyNames.PROPERTY_STEP))
- if self.nNewStep != self.nOldStep:
- self.switchToStep()
-
- except IllegalArgumentException, exception:
- traceback.print_exc()
-
- def setRoadmapInteractive(self, _bInteractive):
- Helper.setUnoPropertyValue(self.oRoadmap, "Activated", _bInteractive)
-
- def setRoadmapComplete(self, bComplete):
- Helper.setUnoPropertyValue(self.oRoadmap, "Complete", bComplete)
-
- def isRoadmapComplete(self):
- try:
- return bool(Helper.getUnoPropertyValue(self.oRoadmap, "Complete"))
- except IllegalArgumentException, exception:
- traceback.print_exc()
- return False
-
- def setCurrentRoadmapItemID(self, ID):
- if self.oRoadmap is not None:
- nCurItemID = self.getCurrentRoadmapItemID()
- if nCurItemID != ID:
- Helper.setUnoPropertyValue(self.oRoadmap, "CurrentItemID",ID)
-
- def getCurrentRoadmapItemID(self):
- try:
- return int(Helper.getUnoPropertyValue(
- self.oRoadmap, "CurrentItemID"))
- except Exception, exception:
- traceback.print_exc()
- return -1
-
- def addRoadmap(self):
- try:
- iDialogHeight = Helper.getUnoPropertyValue(
- self.xDialogModel,
- PropertyNames.PROPERTY_HEIGHT)
- # the roadmap control has got no real TabIndex ever
- # that is not correct, but changing this would need time,
- # so it is used without TabIndex as before
-
- xRoadmapControl = self.insertControlModel(
- "com.sun.star.awt.UnoControlRoadmapModel",
- "rdmNavi",
- (PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_TABINDEX, "Tabstop",
- PropertyNames.PROPERTY_WIDTH),
- ((iDialogHeight - 26), 0, 0, 0,
- 0, True, 85))
- self.oRoadmap = xRoadmapControl.Model
- method = getattr(self, "itemStateChanged")
- xRoadmapControl.addItemListener(
- ItemListenerProcAdapter(method))
-
- Helper.setUnoPropertyValue(
- self.oRoadmap, "Text",
- self.__oWizardResource.getResText(UIConsts.RID_COMMON + 16))
- except NoSuchMethodException, ex:
- Resource.showCommonResourceError(xMSF)
- except Exception, jexception:
- traceback.print_exc()
-
- def setRMItemLabels(self, _oResource, StartResID):
- self.sRMItemLabels = _oResource.getResArray(
- StartResID, self.nMaxStep)
-
- def insertRoadmapItem(self, Index, _bEnabled, _sLabel, _CurItemID):
- try:
- if isinstance(_sLabel, int):
- _sLabel = self.sRMItemLabels(_sLabel)
- oRoadmapItem = self.oRoadmap.createInstance()
- Helper.setUnoPropertyValue(oRoadmapItem,
- PropertyNames.PROPERTY_LABEL, _sLabel)
- Helper.setUnoPropertyValue(oRoadmapItem,
- PropertyNames.PROPERTY_ENABLED, _bEnabled)
- Helper.setUnoPropertyValue(oRoadmapItem, "ID", _CurItemID)
- self.oRoadmap.insertByIndex(Index, oRoadmapItem)
- except Exception, exception:
- traceback.print_exc()
-
- def getRoadmapItemByID(self, _ID):
- try:
- getByIndex = self.oRoadmap.getByIndex
- for i in xrange(self.oRoadmap.Count):
- CurRoadmapItem = getByIndex(i)
- CurID = int(Helper.getUnoPropertyValue(CurRoadmapItem, "ID"))
- if CurID == _ID:
- return CurRoadmapItem
-
- return None
- except Exception, exception:
- traceback.print_exc()
- return None
-
- def switchToStep(self,_nOldStep=None, _nNewStep=None):
- if _nOldStep is not None and _nNewStep is not None:
- self.nOldStep = _nOldStep
- self.nNewStep = _nNewStep
-
- self.leaveStep(self.nOldStep, self.nNewStep)
- if self.nNewStep != self.nOldStep:
- if self.nNewStep == self.nMaxStep:
- self.setControlProperty(
- "btnWizardNext", "DefaultButton", False)
- self.setControlProperty(
- "btnWizardFinish", "DefaultButton", True)
- else:
- self.setControlProperty(
- "btnWizardNext", "DefaultButton", True)
- self.setControlProperty(
- "btnWizardFinish", "DefaultButton", False)
-
- self.changeToStep(self.nNewStep)
- self.enterStep(self.nOldStep, self.nNewStep)
- return True
-
- return False
-
- @abstractmethod
- def leaveStep(self, nOldStep, nNewStep):
- pass
-
- @abstractmethod
- def enterStep(self, nOldStep, nNewStep):
- pass
-
- def changeToStep(self, nNewStep):
- Helper.setUnoPropertyValue(self.xDialogModel,
- PropertyNames.PROPERTY_STEP, nNewStep)
- self.setCurrentRoadmapItemID(nNewStep)
- self.enableNextButton(self.getNextAvailableStep() > 0)
- self.enableBackButton(nNewStep != 1)
-
- def drawNaviBar(self):
- try:
- curtabindex = UIConsts.SOFIRSTWIZARDNAVITABINDEX
- iButtonWidth = self.__iButtonWidth
- iButtonHeight = 14
- iCurStep = 0
- iDialogHeight = Helper.getUnoPropertyValue(self.xDialogModel,
- PropertyNames.PROPERTY_HEIGHT)
- iDialogWidth = Helper.getUnoPropertyValue(self.xDialogModel,
- PropertyNames.PROPERTY_WIDTH)
- iHelpPosX = 8
- iBtnPosY = iDialogHeight - iButtonHeight - 6
- iCancelPosX = iDialogWidth - self.__iButtonWidth - 6
- iFinishPosX = iCancelPosX - 6 - self.__iButtonWidth
- iNextPosX = iFinishPosX - 6 - self.__iButtonWidth
- iBackPosX = iNextPosX - 3 - self.__iButtonWidth
- self.insertControlModel(
- "com.sun.star.awt.UnoControlFixedLineModel",
- "lnNaviSep",
- (PropertyNames.PROPERTY_HEIGHT, "Orientation",
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_WIDTH),
- (1, 0, 0, iDialogHeight - 26, iCurStep, iDialogWidth))
- self.insertControlModel(
- "com.sun.star.awt.UnoControlFixedLineModel",
- "lnRoadSep",
- (PropertyNames.PROPERTY_HEIGHT,
- "Orientation",
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_WIDTH),
- (iBtnPosY - 6, 1, 85, 0, iCurStep, 1))
- propNames = (PropertyNames.PROPERTY_ENABLED,
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_HELPURL,
- PropertyNames.PROPERTY_LABEL,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- "PushButtonType",
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_TABINDEX,
- PropertyNames.PROPERTY_WIDTH)
- Helper.setUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_HELPURL,
- HelpIds.getHelpIdString(self.__hid))
- self.insertButton("btnWizardHelp",
- WizardDialog.__HELP_ACTION_PERFORMED,
- (PropertyNames.PROPERTY_ENABLED,
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_LABEL,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- "PushButtonType",
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_TABINDEX,
- PropertyNames.PROPERTY_WIDTH),
- (True, iButtonHeight,
- self.__oWizardResource.getResText(UIConsts.RID_COMMON + 15),
- iHelpPosX, iBtnPosY,
- uno.Any("short",HELP), iCurStep,
- uno.Any("short",(curtabindex + 1)), iButtonWidth), self)
- self.insertButton("btnWizardBack",
- WizardDialog.__BACK_ACTION_PERFORMED, propNames,
- (False, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 2),
- self.__oWizardResource.getResText(UIConsts.RID_COMMON + 13),
- iBackPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep,
- uno.Any("short",(curtabindex + 1)), iButtonWidth), self)
- self.insertButton("btnWizardNext",
- WizardDialog.__NEXT_ACTION_PERFORMED, propNames,
- (True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 3),
- self.__oWizardResource.getResText(UIConsts.RID_COMMON + 14),
- iNextPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep,
- uno.Any("short",(curtabindex + 1)), iButtonWidth), self)
- self.insertButton("btnWizardFinish",
- WizardDialog.__FINISH_ACTION_PERFORMED, propNames,
- (True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 4),
- self.__oWizardResource.getResText(UIConsts.RID_COMMON + 12),
- iFinishPosX, iBtnPosY, uno.Any("short",STANDARD),
- iCurStep,
- uno.Any("short",(curtabindex + 1)),
- iButtonWidth), self)
- self.insertButton("btnWizardCancel",
- WizardDialog.__CANCEL_ACTION_PERFORMED, propNames,
- (True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 5),
- self.__oWizardResource.getResText(UIConsts.RID_COMMON + 11),
- iCancelPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep,
- uno.Any("short",(curtabindex + 1)),
- iButtonWidth), self)
- self.setControlProperty("btnWizardNext", "DefaultButton", True)
- except Exception, exception:
- traceback.print_exc()
-
- def insertRoadMapItems(self, enabled, items):
- for index, item in enumerate(items):
- self.insertRoadmapItem(index, enabled[index], item, index + 1)
-
- def setStepEnabled(self, _nStep, bEnabled, enableNextButton=None):
- xRoadmapItem = self.getRoadmapItemByID(_nStep)
- if xRoadmapItem is not None:
- Helper.setUnoPropertyValue(xRoadmapItem,
- PropertyNames.PROPERTY_ENABLED, bEnabled)
- if enableNextButton is not None:
- if self.getNextAvailableStep() > 0:
- self.enableNextButton(bEnabled)
-
- def enableNavigationButtons(
- self, _bEnableBack, _bEnableNext, _bEnableFinish):
- self.enableBackButton(_bEnableBack)
- self.enableNextButton(_bEnableNext)
- self.enableFinishButton(_bEnableFinish)
-
- def enableBackButton(self, enabled):
- self.setControlProperty("btnWizardBack",
- PropertyNames.PROPERTY_ENABLED, enabled)
-
- def enableNextButton(self, enabled):
- self.setControlProperty("btnWizardNext",
- PropertyNames.PROPERTY_ENABLED, enabled)
-
- def enableFinishButton(self, enabled):
- self.setControlProperty("btnWizardFinish",
- PropertyNames.PROPERTY_ENABLED, enabled)
-
- def enablefromStep(self, _iStep, _bDoEnable):
- if _iStep <= self.nMaxStep:
- for i in xrange(_iStep, self.nMaxStep):
- self.setStepEnabled(i, _bDoEnable)
- enableFinishButton(_bDoEnable)
- if not _bDoEnable:
- enableNextButton(_iStep > getCurrentStep() + 1)
- else:
- enableNextButton(not (getCurrentStep() == self.nMaxStep))
-
- def isStepEnabled(self, _nStep):
- try:
- xRoadmapItem = self.getRoadmapItemByID(_nStep)
- # Todo: In this case an exception should be thrown
- if xRoadmapItem is None:
- return False
- bIsEnabled = bool(Helper.getUnoPropertyValue(xRoadmapItem,
- PropertyNames.PROPERTY_ENABLED))
- return bIsEnabled
- except Exception, exception:
- traceback.print_exc()
- return False
-
- def gotoPreviousAvailableStep(self):
- try:
- if self.nNewStep > 1:
- self.nOldStep = self.nNewStep
- self.nNewStep -= 1
- while self.nNewStep > 0:
- bIsEnabled = self.isStepEnabled(self.nNewStep)
- if bIsEnabled:
- break;
-
- self.nNewStep -= 1
- if (self.nNewStep == 0):
- self.nNewStep = self.nOldStep
- self.switchToStep()
- except Exception, e:
- traceback.print_exc()
-
- #TODO discuss with rp
-
- def getNextAvailableStep(self):
- if self.isRoadmapComplete():
- i = self.nNewStep + 1
- while i <= self.nMaxStep:
- if self.isStepEnabled(i):
- return i
- i += 1
- return -1
-
- def gotoNextAvailableStep(self):
- try:
- self.nOldStep = self.nNewStep
- self.nNewStep = self.getNextAvailableStep()
- if self.nNewStep > -1:
- self.switchToStep()
- except Exception, e:
- traceback.print_exc()
-
- @abstractmethod
- def finishWizard(self):
- pass
-
- def finishWizard_1(self):
- '''This function will call
- if the finish button is pressed on the UI'''
- try:
- self.enableFinishButton(False)
- success = False
- try:
- success = self.finishWizard()
- finally:
- if not success:
- self.enableFinishButton(True)
-
- if success:
- self.removeTerminateListener()
- except Exception, e:
- traceback.print_exc()
-
- def getMaximalStep(self):
- return self.nMaxStep
-
- def getCurrentStep(self):
- try:
- return int(Helper.getUnoPropertyValue(self.xDialogModel,
- PropertyNames.PROPERTY_STEP))
- except Exception, exception:
- traceback.print_exc()
- return -1
-
- def setCurrentStep(self, _nNewstep):
- self.nNewStep = _nNewstep
- changeToStep(self.nNewStep)
-
- def setRightPaneHeaders(self, _oResource, StartResID, _nMaxStep):
- self.sRightPaneHeaders = _oResource.getResArray(StartResID, _nMaxStep)
- setRightPaneHeaders(self.sRightPaneHeaders)
-
- def setRightPaneHeaders(self, _sRightPaneHeaders):
- self.nMaxStep = _sRightPaneHeaders.length
- self.sRightPaneHeaders = _sRightPaneHeaders
- oFontDesc = FontDescriptor.FontDescriptor()
- oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD
- i = 0
- while i < self.sRightPaneHeaders.length:
- insertLabel("lblQueryTitle" + String.valueOf(i),("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),(
- oFontDesc, 16, self.sRightPaneHeaders(i),
- True, 91, 8, i + 1, 12, 212))
- i += 1
-
- def cancelWizard(self):
- #can be overwritten by extending class
- self.xUnoDialog.endExecute()
-
- def removeTerminateListener(self):
- if self.__bTerminateListenermustberemoved:
- Desktop.getDesktop(self.xMSF).removeTerminateListener( \
- TerminateListenerProcAdapter(self))
- self.__bTerminateListenermustberemoved = False
-
- '''
- called by the cancel button and
- by the window hidden event.
- if this method was not called before,
- perform a cancel.
- '''
-
- def cancelWizard_1(self):
- try:
- self.cancelWizard()
- self.removeTerminateListener()
- except Exception,e:
- traceback.print_exc()
-
- def queryTermination(self):
- self.activate()
- raise TerminationVetoException()
-
- def optCreateFromTemplateItemChanged(self):
- self.bEditTemplate = False
-
- def optMakeChangesItemChanged(self):
- self.bEditTemplate = True
-
- def optReceiverPlaceholderItemChanged(self):
- OfficeDocument.attachEventCall(
- TextDocument.xTextDocument, "OnNew", "StarBasic",
- "macro:///Template.Correspondence.Placeholder()")
-
- def optReceiverDatabaseItemChanged(self):
- OfficeDocument.attachEventCall(
- TextDocument.xTextDocument, "OnNew", "StarBasic",
- "macro:///Template.Correspondence.Database()")
-
- class myPathSelectionListener(XPathSelectionListener):
-
- def validatePath(self):
- if self.myPathSelection.usedPathPicker:
- self.filenameChanged = True
-
- self.myPathSelection.usedPathPicker = False
diff --git a/wizards/com/sun/star/wizards/ui/XPathSelectionListener.py b/wizards/com/sun/star/wizards/ui/XPathSelectionListener.py
deleted file mode 100644
index 1f065209d2ea..000000000000
--- a/wizards/com/sun/star/wizards/ui/XPathSelectionListener.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from abc import ABCMeta, abstractmethod
-
-class XPathSelectionListener(object):
-
- @abstractmethod
- def validatePath(self):
- pass
diff --git a/wizards/com/sun/star/wizards/ui/__init__.py b/wizards/com/sun/star/wizards/ui/__init__.py
deleted file mode 100644
index 51429ce86cfb..000000000000
--- a/wizards/com/sun/star/wizards/ui/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-"""UI"""
diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.py b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
deleted file mode 100644
index c94ae418036c..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/CommonListener.py
+++ /dev/null
@@ -1,124 +0,0 @@
-#**********************************************************************
-#
-# Danny.OOo.Listeners.ListenerProcAdapters.py
-#
-# A module to easily work with OpenOffice.org.
-#
-#**********************************************************************
-# Copyright (c) 2003-2004 Danny Brewer
-# d29583@groovegarden.com
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See: http://www.gnu.org/licenses/lgpl.html
-#
-#**********************************************************************
-# If you make changes, please append to the change log below.
-#
-# Change Log
-# Danny Brewer Revised 2004-06-05-01
-#
-#**********************************************************************
-
-# OOo's libraries
-import unohelper
-
-from com.sun.star.awt import XActionListener
-class ActionListenerProcAdapter( unohelper.Base, XActionListener ):
- def __init__( self, oProcToCall, tParams=() ):
- self.oProcToCall = oProcToCall # a python procedure
- self.tParams = tParams # a tuple
-
-
- # oActionEvent is a com.sun.star.awt.ActionEvent struct.
- def actionPerformed( self, oActionEvent ):
- if callable( self.oProcToCall ):
- apply( self.oProcToCall )
-
-from com.sun.star.awt import XItemListener
-class ItemListenerProcAdapter( unohelper.Base, XItemListener ):
- def __init__( self, oProcToCall, tParams=() ):
- self.oProcToCall = oProcToCall # a python procedure
- self.tParams = tParams # a tuple
-
- # oItemEvent is a com.sun.star.awt.ItemEvent struct.
- def itemStateChanged( self, oItemEvent ):
- if callable( self.oProcToCall ):
- try:
- apply( self.oProcToCall)
- except:
- apply( self.oProcToCall, (oItemEvent,) + self.tParams )
-
-from com.sun.star.awt import XTextListener
-class TextListenerProcAdapter( unohelper.Base, XTextListener ):
- def __init__( self, oProcToCall, tParams=() ):
- self.oProcToCall = oProcToCall # a python procedure
- self.tParams = tParams # a tuple
-
- # oTextEvent is a com.sun.star.awt.TextEvent struct.
- def textChanged( self, oTextEvent ):
- if callable( self.oProcToCall ):
- apply( self.oProcToCall )
-
-from com.sun.star.frame import XTerminateListener
-class TerminateListenerProcAdapter( unohelper.Base, XTerminateListener ):
- def __init__( self, oProcToCall, tParams=() ):
- self.oProcToCall = oProcToCall # a python procedure
- self.tParams = tParams # a tuple
-
- def queryTermination(self, TerminateEvent):
- self.oProcToCall = getattr(self.oProcToCall,"queryTermination")
- if callable( self.oProcToCall ):
- apply( self.oProcToCall )
-
-from com.sun.star.awt import XWindowListener
-class WindowListenerProcAdapter( unohelper.Base, XWindowListener ):
- def __init__( self, oProcToCall, tParams=() ):
- self.oProcToCall = oProcToCall # a python procedure
- self.tParams = tParams # a tuple
-
- def windowShown(self, TerminateEvent):
- if callable( self.oProcToCall ):
- apply( self.oProcToCall )
-
-from com.sun.star.awt import XAdjustmentListener
-class AdjustmentListenerProcAdapter( unohelper.Base, XAdjustmentListener ):
- def __init__( self, oProcToCall, tParams=() ):
- self.oProcToCall = oProcToCall # a python procedure
- self.tParams = tParams # a tuple
-
- def adjustmentValueChanged(self, TerminateEvent):
- if callable( self.oProcToCall ):
- apply( self.oProcToCall )
-
-from com.sun.star.awt import XFocusListener
-class FocusListenerProcAdapter( unohelper.Base, XFocusListener ):
- def __init__( self, oProcToCall, tParams=() ):
- self.oProcToCall = oProcToCall # a python procedure
- self.tParams = tParams # a tuple
-
- def focusGained(self, FocusEvent):
- if callable( self.oProcToCall ):
- apply( self.oProcToCall, (FocusEvent,) + self.tParams )
-
-from com.sun.star.awt import XKeyListener
-class KeyListenerProcAdapter( unohelper.Base, XKeyListener ):
- def __init__( self, oProcToCall, tParams=() ):
- self.oProcToCall = oProcToCall # a python procedure
- self.tParams = tParams # a tuple
-
- def keyPressed(self, KeyEvent):
- if callable( self.oProcToCall ):
- apply( self.oProcToCall, (KeyEvent,) + self.tParams )
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py
deleted file mode 100644
index 5f4df9585587..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.py
+++ /dev/null
@@ -1,114 +0,0 @@
-from common.PropertyNames import *
-from abc import ABCMeta, abstractmethod
-import traceback
-from ui.event.CommonListener import *
-
-'''
-@author rpiterman
-DataAware objects are used to live-synchronize UI and DataModel/DataObject.
-It is used as listener on UI events, to keep the DataObject up to date.
-This class, as a base abstract class, sets a frame of functionality,
-delegating the data Object get/set methods to a Value object,
-and leaving the UI get/set methods abstract.
-Note that event listenning is *not* a part of this model.
-the updateData() or updateUI() methods should be porogramatically called.
-in child classes, the updateData() will be binded to UI event calls.
-<br><br>
-This class holds references to a Data Object and a Value object.
-The Value object "knows" how to get and set a value from the
-Data Object.
-'''
-
-class DataAware(object):
- __metaclass__ = ABCMeta
-
- '''
- creates a DataAware object for the given data object and Value object.
- @param dataObject_
- @param value_
- '''
-
- def __init__(self, dataObject_, field_):
- self._dataObject = dataObject_
- self._field = field_
-
- def enableControls(self, value):
- pass
-
- '''
- sets the given value to the UI control
- @param newValue the value to set to the ui control.
- '''
- @abstractmethod
- def setToUI (self,newValue):
- pass
-
- '''
- gets the current value from the UI control.
- @return the current value from the UI control.
- '''
-
- @abstractmethod
- def getFromUI (self):
- pass
-
- '''
- updates the UI control according to the
- current state of the data object.
- '''
-
- def updateUI(self):
- data = getattr(self._dataObject, self._field)
- ui = self.getFromUI()
- if data is not ui:
- try:
- self.setToUI(data)
- except Exception, ex:
- traceback.print_exc()
- #TODO tell user...
- self.enableControls(data)
-
- '''
- 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.
- '''
-
- def updateData(self):
- try:
- data = getattr(self._dataObject, self._field)
- ui = self.getFromUI()
- if data is not ui:
- if isinstance(ui,tuple):
- #Selected Element listbox
- ui = ui[0]
- setattr(self._dataObject, self._field, ui)
- self.enableControls(ui)
- except Exception:
- traceback.print_exc()
-
- '''
- given a collection containing DataAware objects,
- calls updateUI() on each memebr 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/ListModelBinder.py b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py
deleted file mode 100644
index 183bab050139..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py
+++ /dev/null
@@ -1,75 +0,0 @@
-from common.Helper import Helper
-
-class ListModelBinder(object):
-
- def __init__(self, unoListBox, listModel_):
- self.unoList = unoListBox
- self.unoListModel = unoListBox.Model
- #COMMENTED
- #self.setListModel(listModel_)
-
- def setListModel(self, newListModel):
- if self.listModel is not None:
- self.listModel.removeListDataListener(self)
-
- self.listModel = newListModel
- self.listModel.addListDataListener(this)
-
- def contentsChanged(self, lde):
- selected = getSelectedItems()
- i = lde.getIndex0()
- while i <= lde.getIndex1():
- update(i)
- i += 1
- setSelectedItems(selected)
-
- def update(self, i):
- remove(i, i)
- insert(i)
-
- def remove(self, i1, i2):
- self.unoList.removeItems(i1, i2 - i1 + 1)
-
- def insert(self, i):
- self.unoList.addItem(getItemString(i), i)
-
- def getItemString(self, i):
- return getItemString(self.listModel.getElementAt(i))
-
- def getItemString(self, item):
- return self.renderer.render(item)
-
- def getSelectedItems(self):
- return Helper.getUnoPropertyValue(self.unoListModel, "SelectedItems")
-
- def setSelectedItems(self, selected):
- Helper.setUnoPropertyValue(self.unoListModel, "SelectedItems", selected)
-
- def intervalAdded(self, lde):
- for i in xrange(lde.Index0, lde.Index1):
- insert(i)
-
- def intervalRemoved(self, lde):
- remove(lde.Index0, lde.Index1)
-
- @classmethod
- def fillList(self, xlist, items, renderer):
- Helper.setUnoPropertyValue(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.cp_Name
- xlist.addItem(aux, index)
-
- @classmethod
- def fillComboBox(self, xComboBox, items, renderer):
- Helper.setUnoPropertyValue(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/RadioDataAware.py b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py
deleted file mode 100644
index 181662b19b5f..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from DataAware import *
-from UnoDataAware import *
-import time
-'''
-@author rpiterman
-To change the template for this generated type comment go to
-Window>Preferences>Java>Code Generation>Code and Comments
-'''
-
-class RadioDataAware(DataAware):
-
- def __init__(self, data, value, radioButtons):
- super(RadioDataAware,self).__init__(data, value)
- self.radioButtons = radioButtons
-
- def setToUI(self, value):
- selected = int(value)
- if selected == -1:
- for i in self.radioButtons:
- i.State = False
- else:
- self.radioButtons[selected].State = True
-
- def getFromUI(self):
- for index, workwith in enumerate(self.radioButtons):
- if workwith.State:
- return index
-
- return -1
-
- @classmethod
- def attachRadioButtons(self, data, prop, buttons, field):
- da = RadioDataAware(data, prop, buttons)
- method = getattr(da,"updateData")
- for i in da.radioButtons:
- i.addItemListener(ItemListenerProcAdapter(method))
- return da
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
deleted file mode 100644
index 483a56916afc..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+++ /dev/null
@@ -1,84 +0,0 @@
-from DataAware import *
-from common.Helper import *
-
-'''
-@author rpiterman
-This class suppoprts imple cases where a UI control can
-be directly synchronized with a data property.
-Such controls are: the different text controls
-(synchronizing the "Text" , "Value", "Date", "Time" property),
-Checkbox controls, Dropdown listbox controls (synchronizing the
-SelectedItems[] property.
-For those controls, static convenience methods are offered, to simplify use.
-'''
-
-class UnoDataAware(DataAware):
-
- disableObjects = []
-
- def __init__(self, dataObject, field, unoObject_, unoPropName_, isShort=False):
- super(UnoDataAware,self).__init__(dataObject, field)
- self.unoControl = unoObject_
- self.unoModel = self.unoControl.Model
- self.unoPropName = unoPropName_
- self.isShort = isShort
-
- def enableControls(self, value):
- for i in self.disableObjects:
- Helper.setUnoPropertyValue(
- i.Model, PropertyNames.PROPERTY_ENABLED, bool(value))
-
- def setToUI(self, value):
- if self.isShort:
- value = uno.Any("[]short", (value,))
- Helper.setUnoPropertyValue(self.unoModel, self.unoPropName, value)
-
- def getFromUI(self):
- return Helper.getUnoPropertyValue(self.unoModel, self.unoPropName)
-
- @classmethod
- def __attachTextControl(
- self, data, prop, unoText, unoProperty, field, value):
- uda = UnoDataAware(data, prop, unoText, unoProperty)
- method = getattr(uda,"updateData")
- unoText.addTextListener(TextListenerProcAdapter(method))
- return uda
-
- @classmethod
- def attachEditControl(self, data, prop, unoControl, field):
- return self.__attachTextControl(
- data, prop, unoControl, "Text", field, "")
-
- @classmethod
- def attachDateControl(self, data, prop, unoControl, field):
- return self.__attachTextControl(
- data, prop, unoControl, "Date", field, 0)
-
- @classmethod
- def attachTimeControl(self, data, prop, unoControl, field):
- return self.__attachTextControl(
- data, prop, unoControl, "Time", field, 0)
-
- @classmethod
- def attachNumericControl(self, data, prop, unoControl, field):
- return self.__attachTextControl(
- data, prop, unoControl, "Value", field, float(0))
-
- @classmethod
- def attachCheckBox(
- self, data, prop, checkBox, field):
- uda = UnoDataAware(data, prop, checkBox, PropertyNames.PROPERTY_STATE)
- method = getattr(uda,"updateData")
- 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)
- method = getattr(uda,"updateData")
- listBox.addItemListener(ItemListenerProcAdapter(method))
- return uda
diff --git a/wizards/com/sun/star/wizards/ui/event/__init__.py b/wizards/com/sun/star/wizards/ui/event/__init__.py
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/__init__.py
+++ /dev/null