[Libreoffice-commits] .: 4 commits - wizards/com
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Nov 24 13:22:07 PST 2012
wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py | 4
wizards/com/sun/star/wizards/common/FileAccess.py | 222 ----------
wizards/com/sun/star/wizards/document/OfficeDocument.py | 10
wizards/com/sun/star/wizards/fax/FaxDocument.py | 3
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py | 29 -
wizards/com/sun/star/wizards/letter/LetterDocument.py | 5
wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py | 29 -
wizards/com/sun/star/wizards/text/TextFieldHandler.py | 42 -
8 files changed, 76 insertions(+), 268 deletions(-)
New commits:
commit be3b55d5ec59e87edf93215fea91df312fa82dfb
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sat Nov 24 22:19:29 2012 +0100
pywizards: fix textfields
Change-Id: I6609c554ef161a0abafbdfa65f8076a42eec93b2
diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.py b/wizards/com/sun/star/wizards/fax/FaxDocument.py
index c99eb7d..215b355 100644
--- a/wizards/com/sun/star/wizards/fax/FaxDocument.py
+++ b/wizards/com/sun/star/wizards/fax/FaxDocument.py
@@ -95,8 +95,7 @@ class FaxDocument(TextDocument):
return False
def switchUserField(self, sFieldName, sNewContent, bState):
- myFieldHandler = TextFieldHandler(
- self.xMSF, self.xTextDocument)
+ myFieldHandler = TextFieldHandler( self.xMSF, self.xTextDocument)
if bState:
myFieldHandler.changeUserFieldContent(sFieldName, sNewContent)
else:
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.py b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
index 6732483..f6f251e 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
@@ -21,21 +21,17 @@ import unicodedata
from ..common.PropertyNames import PropertyNames
from com.sun.star.util import DateTime
+from com.sun.star.uno import RuntimeException
class TextFieldHandler(object):
- '''
- Creates a new instance of TextFieldHandler
- @param xMSF
- @param xTextDocument
- '''
xTextFieldsSupplierAux = None
+ arrayTextFields = []
+ dictTextFields = {}
def __init__(self, xMSF, xTextDocument):
self.xMSFDoc = xMSF
self.xTextFieldsSupplier = xTextDocument
- self.arrayTextFields = []
- self.dictTextFields = {}
if TextFieldHandler.xTextFieldsSupplierAux is not \
self.xTextFieldsSupplier:
self.__getTextFields()
@@ -93,10 +89,10 @@ class TextFieldHandler(object):
self.xTextFieldsSupplier.TextFields.createEnumeration()
while xEnum.hasMoreElements():
oTextField = xEnum.nextElement()
- self.arrayTextFields.append(oTextField)
+ TextFieldHandler.arrayTextFields.append(oTextField)
xPropertySet = oTextField.TextFieldMaster
if xPropertySet.Name:
- self.dictTextFields[xPropertySet.Name] = \
+ TextFieldHandler.dictTextFields[xPropertySet.Name] = \
oTextField
except Exception:
traceback.print_exc()
@@ -104,7 +100,7 @@ class TextFieldHandler(object):
def __getTextFieldsByProperty(
self, _PropertyName, _aPropertyValue):
try:
- xProperty = self.dictTextFields[_aPropertyValue]
+ xProperty = TextFieldHandler.dictTextFields[_aPropertyValue]
xPropertySet = xProperty.TextFieldMaster
if xPropertySet.PropertySetInfo.hasPropertyByName(
_PropertyName):
@@ -118,15 +114,18 @@ class TextFieldHandler(object):
return None
def changeUserFieldContent(self, _FieldName, _FieldContent):
- DependentTextFields = self.__getTextFieldsByProperty(
- PropertyNames.PROPERTY_NAME, _FieldName)
- if DependentTextFields is not None:
- DependentTextFields.TextFieldMaster.setPropertyValue("Content", _FieldContent)
- self.refreshTextFields()
+ try:
+ DependentTextFields = self.__getTextFieldsByProperty(
+ PropertyNames.PROPERTY_NAME, _FieldName)
+ if DependentTextFields is not None:
+ DependentTextFields.TextFieldMaster.setPropertyValue("Content", _FieldContent)
+ self.refreshTextFields()
+ except Exception:
+ traceback.print_exc()
def updateDocInfoFields(self):
try:
- for i in self.arrayTextFields:
+ for i in TextFieldHandler.arrayTextFields:
if i.supportsService(
"com.sun.star.text.TextField.ExtendedUser"):
i.update()
@@ -146,18 +145,21 @@ class TextFieldHandler(object):
dt.Year = time.strftime("%Y", now)
dt.Month = time.strftime("%m", now)
dt.Month += 1
- for i in self.arrayTextFields:
+ for i in TextFieldHandler.arrayTextFields:
if i.supportsService(
"com.sun.star.text.TextField.DateTime"):
- i.setPropertyValue("IsFixed", False)
- i.setPropertyValue("DateTimeValue", dt)
+ try:
+ i.setPropertyValue("IsFixed", False)
+ i.setPropertyValue("DateTimeValue", dt)
+ except RuntimeException:
+ pass
except Exception:
traceback.print_exc()
def fixDateFields(self, _bSetFixed):
try:
- for i in self.arrayTextFields:
+ for i in TextFieldHandler.arrayTextFields:
if i.supportsService(
"com.sun.star.text.TextField.DateTime"):
i.setPropertyValue("IsFixed", _bSetFixed)
commit a615abcd121bb0d6fd27a7ac883798d45b290970
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sat Nov 24 21:41:51 2012 +0100
pywizards: sort lists again
Change-Id: I9b3f1faba3eb3ffc59294b6bfe6816a19fc05185
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
index fbc0dc3..5fc5814 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
@@ -155,7 +155,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
self.setControlProperty(
"listPageDesign", "StringItemList",
- tuple(self.agendaTemplates.keys()))
+ tuple(self.agendaTemplates[0]))
UnoDataAware.attachListBox(
self.agenda, "cp_AgendaType", self.listPageDesign, True).updateUI()
UnoDataAware.attachCheckBox(
@@ -252,7 +252,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
if AgendaWizardDialogImpl.pageDesign is not SelectedItemPos:
AgendaWizardDialogImpl.pageDesign = SelectedItemPos
self.agendaTemplate.load(
- self.agendaTemplates.values()[SelectedItemPos],
+ self.agendaTemplates[1][SelectedItemPos],
self.topicsControl.scrollfields)
except Exception:
traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index 28374da..1a578c3 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -150,7 +150,7 @@ class FileAccess(object):
def getFolderTitles(self, xMSF, FilterName, FolderName, resDict=None):
#Returns and ordered dict containing the template's name and path
- LocLayoutFiles = {}
+ locLayoutFiles = []
try:
xDocInterface = xMSF.createInstance(
"com.sun.star.document.DocumentProperties")
@@ -162,6 +162,7 @@ class FileAccess(object):
else:
FilterName += "-"
+ locLayoutDict = {}
for i in nameList:
fileName = self.getFilename(i)
if FilterName is None or fileName.startswith(FilterName):
@@ -174,13 +175,20 @@ class FileAccess(object):
title = resDict[xDocInterface.Title]
else:
title = xDocInterface.Title
- LocLayoutFiles[title] = i
-
+ locLayoutDict[title] = i
+
+ #sort the dictionary and create a list containing the
+ #keys list and the values list
+ keysList = sorted(locLayoutDict.keys())
+ valuesList= []
+ for i in keysList:
+ valuesList.append(locLayoutDict[i])
+ locLayoutFiles.append(keysList)
+ locLayoutFiles.append(valuesList)
except Exception:
traceback.print_exc()
- #TODO: return it sorted
- return LocLayoutFiles
+ return locLayoutFiles
@classmethod
def addPath(self, _sPath, _sPath2):
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py
index 96148b7..bd138ca 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.py
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py
@@ -277,7 +277,6 @@ class OfficeDocument(object):
"com.sun.star.document.TypeDetection")
return typeDetect.getByName(type)
-
def showMessageBox(
self, xMSF, windowServiceName, windowAttribute, MessageText):
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index f3a1975..d93100d 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -280,9 +280,9 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.sFaxPath, self.resources.dictPrivateTemplate)
self.setControlProperty("lstBusinessStyle", "StringItemList",
- tuple(self.BusinessFiles.keys()))
+ tuple(self.BusinessFiles[0]))
self.setControlProperty("lstPrivateStyle", "StringItemList",
- tuple(self.PrivateFiles.keys()))
+ tuple(self.PrivateFiles[0]))
self.setControlProperty("lstBusinessStyle", "SelectedItems", (0,))
self.setControlProperty("lstPrivateStyle", "SelectedItems" , (0,))
return True
@@ -433,7 +433,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
if self.lstBusinessStylePos != selectedItemPos:
self.lstBusinessStylePos = selectedItemPos
self.myFaxDoc.loadAsPreview(
- self.BusinessFiles.values()[selectedItemPos], False)
+ self.BusinessFiles[1][selectedItemPos], False)
self.initializeElements()
self.setElements()
self.drawConstants()
@@ -458,7 +458,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
if self.lstPrivateStylePos != selectedItemPos:
self.lstPrivateStylePos = selectedItemPos
self.myFaxDoc.loadAsPreview(
- self.PrivateFiles.values()[selectedItemPos], False)
+ self.PrivateFiles[1][selectedItemPos], False)
self.initializeElements()
self.setElements()
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 0ea4d12..e8fe07a 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -381,7 +381,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
if self.lstBusinessStylePos != selectedItemPos:
self.lstBusinessStylePos = selectedItemPos
self.myLetterDoc.loadAsPreview(
- self.BusinessFiles.values()[selectedItemPos], False)
+ self.BusinessFiles[1][selectedItemPos], False)
self.initializeElements()
self.chkBusinessPaperItemChanged()
self.setElements(False)
@@ -392,7 +392,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
if self.lstPrivOfficialStylePos != selectedItemPos:
self.lstPrivOfficialStylePos = selectedItemPos
self.myLetterDoc.loadAsPreview(
- self.OfficialFiles.values()[selectedItemPos], False)
+ self.OfficialFiles[1][selectedItemPos], False)
self.initializeElements()
self.setPossibleSenderData(True)
self.setElements(False)
@@ -404,7 +404,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
self.lstPrivateStylePos = selectedItemPos
self.myLetterDoc.xTextDocument = \
self.myLetterDoc.loadAsPreview(
- self.PrivateFiles.values()[selectedItemPos], False)
+ self.PrivateFiles[1][selectedItemPos], False)
self.initializeElements()
self.setElements(True)
@@ -916,13 +916,13 @@ class LetterWizardDialogImpl(LetterWizardDialog):
xMSF, "pri", sLetterPath, self.resources.dictPrivateTemplate)
self.setControlProperty(
"lstBusinessStyle", "StringItemList",
- tuple(self.BusinessFiles.keys()))
+ tuple(self.BusinessFiles[0]))
self.setControlProperty(
"lstPrivOfficialStyle", "StringItemList",
- tuple(self.OfficialFiles.keys()))
+ tuple(self.OfficialFiles[0]))
self.setControlProperty(
"lstPrivateStyle", "StringItemList",
- tuple(self.PrivateFiles.keys()))
+ tuple(self.PrivateFiles[0]))
self.setControlProperty(
"lstBusinessStyle", "SelectedItems", (0,))
self.setControlProperty(
commit 63510b3c69761ec1de3c1acd30cf6e4e3a55184a
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sat Nov 24 20:13:49 2012 +0100
pywizards: better us os.path
Change-Id: Iae2bfba899ba23e743f72f5c675177771be66c7a
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index 6440c51..28374da 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -37,30 +37,11 @@ These Convenince methods include mainly Exception-handling.
class FileAccess(object):
- @classmethod
- def addOfficePath(self, xMSF, sPath, sAddPath):
- xSimpleFileAccess = None
- ResultPath = getOfficePath(xMSF, sPath, xSimpleFileAccess)
- '''
- As there are several conventions about the look of Url
- (e.g. with " " or with "%20") you cannot make a
- simple String comparison to find out, if a path
- is already in "ResultPath
- '''
- PathList = JavaTools.ArrayoutofString(ResultPath, ";")
- MaxIndex = PathList.length - 1
- CompAddPath = JavaTools.replaceSubString(sAddPath, "", "/")
- i = 0
- while i <= MaxIndex:
- CurPath = JavaTools.convertfromURLNotation(PathList[i])
- CompCurPath = JavaTools.replaceSubString(CurPath, "", "/")
- if CompCurPath.equals(CompAddPath):
- return
-
- i += 1
- ResultPath += ";" + sAddPath
- return
-
+ def __init__(self, xmsf):
+ #get the file identifier converter
+ self.filenameConverter = xmsf.createInstance(
+ "com.sun.star.ucb.FileContentProvider")
+
@classmethod
def deleteLastSlashfromUrl(self, _sPath):
if _sPath.endswith("/"):
@@ -148,18 +129,6 @@ class FileAccess(object):
return ResultPath
@classmethod
- def isPathValid(self, xMSF, _sPath):
- bExists = False
- try:
- xUcbInterface = xMSF.createInstance(
- "com.sun.star.ucb.SimpleFileAccess")
- bExists = xUcbInterface.exists(_sPath)
- except Exception:
- traceback.print_exc()
-
- return bExists
-
- @classmethod
def combinePaths(self, xMSF, _sFirstPath, _sSecondPath):
bexists = False
ReturnPath = ""
@@ -238,14 +207,6 @@ class FileAccess(object):
return sTitle
- def __init__(self, xmsf):
- #get a simple file access...
- self.fileAccess = xmsf.createInstance(
- "com.sun.star.ucb.SimpleFileAccess")
- #get the file identifier converter
- self.filenameConverter = xmsf.createInstance(
- "com.sun.star.ucb.FileContentProvider")
-
def getURL(self, path, childPath=None):
try:
f = open(path, 'w')
@@ -265,101 +226,6 @@ class FileAccess(object):
parentURL + string)
'''
- @author rpiterman
- @param filename
- @return the extension of the given filename.
- '''
-
- @classmethod
- def getExtension(self, filename):
- p = filename.indexOf(".")
- if p == -1:
- return ""
- else:
- while p > -1:
- filename = filename.substring(p + 1)
- p = filename.indexOf(".")
-
- return filename
-
- '''
- @author rpiterman
- @param s
- @return
- '''
-
- def mkdir(self, s):
- try:
- self.fileAccess.createFolder(s)
- return True
- except Exception:
- traceback.print_exc()
-
- return False
-
- '''
- @author rpiterman
- @param filename
- @param def what to return in case of an exception
- @return true if the given file exists or not.
- if an exception accures, returns the def value.
- '''
-
- def exists(self, filename, defe):
- try:
- return self.fileAccess.exists(filename)
- except Exception:
- traceback.print_exc()
-
- return defe
-
- '''
- @author rpiterman
- @param filename
- @return
- '''
-
- def isDirectory(self, filename):
- try:
- return self.fileAccess.isFolder(filename)
- except Exception:
- traceback.print_exc()
-
- return False
-
- '''
- lists the files in a given directory
- @author rpiterman
- @param dir
- @param includeFolders
- @return
- '''
-
- def listFiles(self, dir, includeFolders):
- try:
- return self.fileAccess.getFolderContents(dir, includeFolders)
- except Exception:
- traceback.print_exc()
-
- return range(0)
-
- '''
- @author rpiterman
- @param file
- @return
- '''
-
- def delete(self, file):
- try:
- self.fileAccess.kill(file)
- return True
- except Exception:
- traceback.print_exc()
-
- return False
-
-
- '''
return the filename out of a system-dependent path
@param path
@return
@@ -380,38 +246,6 @@ class FileAccess(object):
def getFilename(self, path, pathSeparator = "/"):
return path.split(pathSeparator)[-1]
- @classmethod
- def getBasename(self, path, pathSeparator):
- filename = self.getFilename(path, pathSeparator)
- sExtension = getExtension(filename)
- basename = filename.substring(0, filename.length() - \
- (sExtension.length() + 1))
- return basename
-
- '''
- @author rpiterman
- @param source
- @param target
- @return
- '''
-
- def copy(self, source, target):
- try:
- self.fileAccess.copy(source, target)
- return True
- except Exception:
- traceback.print_exc()
-
- return False
-
- def getLastModified(self, url):
- try:
- return self.fileAccess.getDateTimeModified(url)
- except Exception:
- traceback.print_exc()
-
- return None
-
'''
@param url
@return the parent dir of the given url.
@@ -424,34 +258,6 @@ class FileAccess(object):
url = hello[:-1]
return url[:url.rfind("/")]
- def createNewDir(self, parentDir, name):
- s = self.getNewFile(parentDir, name, "")
- if self.mkdir(s):
- return s
- else:
- return None
-
- def getNewFile(self, parentDir, name, extension):
- i = 0
- temp = True
- while temp:
- filename = self.filename(name, extension, i)
- url = parentDir + "/" + filename
- temp = self.exists(url, True)
- i += 1
- return url
-
- @classmethod
- def filename(self, name, ext, i):
- stringI = ""
- stringExt = ""
- if i != 0:
- stringI = str(i)
- if ext != "":
- stringExt = "." + ext
-
- return name + stringI + stringExt
-
@classmethod
def connectURLs(self, urlFolder, urlFilename):
stringFolder = ""
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py
index 9c443ef..96148b7 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.py
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py
@@ -277,15 +277,6 @@ class OfficeDocument(object):
"com.sun.star.document.TypeDetection")
return typeDetect.getByName(type)
- '''
- returns the count of slides in a presentation,
- or the count of pages in a draw document.
- @param model a presentation or a draw document
- @return the number of slides/pages in the given document.
- '''
-
- def getSlideCount(self, model):
- return model.getDrawPages().getCount()
def showMessageBox(
self, xMSF, windowServiceName, windowAttribute, MessageText):
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index c084938..f3a1975 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -16,6 +16,7 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import traceback
+import os.path
from .FaxWizardDialog import FaxWizardDialog, Helper, PropertyNames, uno, HID
from .CGFaxWizard import CGFaxWizard
from .FaxDocument import FaxDocument
@@ -150,7 +151,8 @@ class FaxWizardDialogImpl(FaxWizardDialog):
try:
fileAccess = FileAccess(self.xMSF)
self.sPath = self.myPathSelection.getSelectedPath()
- if not self.sPath:
+ print os.path.exists(self.sPath)
+ if not self.sPath or not os.path.exists(self.sPath):
self.myPathSelection.triggerPathPicker()
self.sPath = self.myPathSelection.getSelectedPath()
@@ -159,15 +161,14 @@ class FaxWizardDialogImpl(FaxWizardDialog):
#it is coming from a saved session, check if the
# file exists and warn the user.
if not self.filenameChanged:
- if fileAccess.exists(self.sPath, True):
- answer = SystemDialog.showMessageBox(
- self.xMSF, "MessBox", YES_NO + DEF_NO,
- self.resources.resOverwriteWarning,
- self.xUnoDialog.Peer)
- if answer == 3:
- # user said: no, do not overwrite...
- endWizard = False
- return False
+ answer = SystemDialog.showMessageBox(
+ self.xMSF, "MessBox", YES_NO + DEF_NO,
+ self.resources.resOverwriteWarning,
+ self.xUnoDialog.Peer)
+ if answer == 3:
+ # user said: no, do not overwrite...
+ endWizard = False
+ return False
self.myFaxDoc.setWizardTemplateDocInfo( \
self.resources.resFaxWizardDialog_title,
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 9e93916..0ea4d12 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -16,6 +16,7 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import traceback
+import os.path
from .LetterWizardDialog import LetterWizardDialog, Helper, \
PropertyNames, uno, HelpIds, HID
from .LetterDocument import LetterDocument, BusinessPaperObject
@@ -169,13 +170,12 @@ class LetterWizardDialogImpl(LetterWizardDialog):
try:
fileAccess = FileAccess(self.xMSF)
self.sPath = self.myPathSelection.getSelectedPath()
- if not self.sPath:
+ if not self.sPath or not os.path.exists(self.sPath):
self.myPathSelection.triggerPathPicker()
self.sPath = self.myPathSelection.getSelectedPath()
self.sPath = fileAccess.getURL(self.sPath)
if not self.filenameChanged:
- if fileAccess.exists(self.sPath, True):
answer = SystemDialog.showMessageBox(
self.xMSF, "MessBox", YES_NO + DEF_NO,
self.resources.resOverwriteWarning,
commit e5f040bf7c73104ad472c4fd959dc6f8d96b57c2
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sat Nov 24 18:38:56 2012 +0100
pyletter: Fix letterhead
Change-Id: I73977b203778dca42ef548b4c24412b794701e5a
diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.py b/wizards/com/sun/star/wizards/letter/LetterDocument.py
index 28711ce..ab29f7f 100644
--- a/wizards/com/sun/star/wizards/letter/LetterDocument.py
+++ b/wizards/com/sun/star/wizards/letter/LetterDocument.py
@@ -35,8 +35,6 @@ from com.sun.star.awt.FontWeight import BOLD
class LetterDocument(TextDocument):
- TextDocument = None
-
def __init__(self, xMSF, listener):
super(LetterDocument,self).__init__(xMSF, listener, None,
"WIZARD_LIVE_PREVIEW")
@@ -175,7 +173,8 @@ class LetterDocument(TextDocument):
class BusinessPaperObject(object):
- def __init__(self, FrameText, Width, Height, XPos, YPos):
+ def __init__(self, xTextDocument, FrameText, Width, Height, XPos, YPos):
+ self.xTextDocument = xTextDocument
self.iWidth = Width
self.iHeight = Height
self.iXPos = XPos
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index b4590f1..9e93916 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -454,7 +454,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
if self.numLogoHeight.Value == 0:
self.numLogoHeight.Value = 0.1
self.BusCompanyLogo = BusinessPaperObject(
- "Company Logo", int(self.numLogoWidth.Value * 1000),
+ self.myLetterDoc.xTextDocument, "Company Logo",
+ int(self.numLogoWidth.Value * 1000),
int(self.numLogoHeight.Value * 1000),
int(self.numLogoX.Value * 1000),
self.numLogoY.Value * 1000)
@@ -506,7 +507,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
self.numAddressHeight.Value = 0.1
self.BusCompanyAddress = BusinessPaperObject(
- "Company Address", int(self.numAddressWidth.Value * 1000),
+ self.myLetterDoc.xTextDocument, "Company Address",
+ int(self.numAddressWidth.Value * 1000),
int(self.numAddressHeight.Value * 1000),
int(self.numAddressX.Value * 1000),
int(self.numAddressY.Value * 1000))
@@ -576,8 +578,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
xReceiverFrame, "VertOrientPosition"))
iReceiverHeight = int(0.5 * 1000)
self.BusCompanyAddressReceiver = BusinessPaperObject(
- " ", iFrameWidth, iReceiverHeight, iFrameX,
- iFrameY - iReceiverHeight)
+ self.myLetterDoc.xTextDocument, " ", iFrameWidth, iReceiverHeight,
+ iFrameX, iFrameY - iReceiverHeight)
self.setPossibleAddressReceiver(False)
except NoSuchElementException:
traceback.print_exc()
@@ -605,7 +607,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
self.numFooterHeight.Value = 0.1
self.BusFooter = BusinessPaperObject(
- "Footer", self.myLetterDoc.DocSize.Width,
+ self.myLetterDoc.xTextDocument, "Footer",
+ self.myLetterDoc.DocSize.Width,
int(self.numFooterHeight.Value * 1000), 0,
int(self.myLetterDoc.DocSize.Height - \
(self.numFooterHeight.Value * 1000)))
More information about the Libreoffice-commits
mailing list