summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/letter
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2012-11-13 23:16:01 +0100
committerXisco Fauli <anistenis@gmail.com>2012-11-13 23:17:07 +0100
commit923bcb6ad44812faf78d9d8a34be2bf8cfc625d9 (patch)
tree9aab222f61ab22f6d868a1e063334f746d26dc16 /wizards/com/sun/star/wizards/letter
parent29f0cbffd0001b9df75969b11b0658a80b1f56af (diff)
pywizards: Use local variables
Change-Id: I334244d1729376f25c361327b4103fb59ccc2d09
Diffstat (limited to 'wizards/com/sun/star/wizards/letter')
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterDocument.py42
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py47
2 files changed, 48 insertions, 41 deletions
diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.py b/wizards/com/sun/star/wizards/letter/LetterDocument.py
index 61baa5b643f7..28711ce5f279 100644
--- a/wizards/com/sun/star/wizards/letter/LetterDocument.py
+++ b/wizards/com/sun/star/wizards/letter/LetterDocument.py
@@ -49,7 +49,7 @@ class LetterDocument(TextDocument):
def switchElement(self, sElement, bState):
try:
mySectionHandler = TextSectionHandler(
- self.xMSF, TextDocument.xTextDocument)
+ self.xMSF, self.xTextDocument)
oSection = \
mySectionHandler.xTextDocument.TextSections.getByName(sElement)
Helper.setUnoPropertyValue(oSection, "IsVisible", bState)
@@ -58,14 +58,14 @@ class LetterDocument(TextDocument):
def updateDateFields(self):
FH = TextFieldHandler(
- TextDocument.xTextDocument, TextDocument.xTextDocument)
+ self.xTextDocument, self.xTextDocument)
FH.updateDateFields()
def switchFooter(self, sPageStyle, bState, bPageNumber, sText):
- if TextDocument.xTextDocument != None:
+ if self.xTextDocument != None:
try:
- TextDocument.xTextDocument.lockControllers()
- xNameAccess = TextDocument.xTextDocument.StyleFamilies
+ self.xTextDocument.lockControllers()
+ xNameAccess = self.xTextDocument.StyleFamilies
xPageStyleCollection = xNameAccess.getByName("PageStyles")
xPageStyle = xPageStyleCollection.getByName(sPageStyle)
if bState:
@@ -82,7 +82,7 @@ class LetterDocument(TextDocument):
myCursor.setPropertyValue("ParaAdjust", CENTER )
xPageNumberField = \
- TextDocument.xTextDocument.createInstance(
+ self.xTextDocument.createInstance(
"com.sun.star.text.TextField.PageNumber")
xPageNumberField.setPropertyValue("SubType", CURRENT)
xPageNumberField.NumberingType = ARABIC
@@ -93,20 +93,20 @@ class LetterDocument(TextDocument):
Helper.setUnoPropertyValue(
xPageStyle, "FooterIsOn", False)
- TextDocument.xTextDocument.unlockControllers()
+ self.xTextDocument.unlockControllers()
except Exception:
traceback.print_exc()
def hasElement(self, sElement):
- if TextDocument.xTextDocument != None:
- SH = TextSectionHandler(self.xMSF, TextDocument.xTextDocument)
+ if self.xTextDocument != None:
+ SH = TextSectionHandler(self.xMSF, self.xTextDocument)
return SH.hasTextSectionByName(sElement)
else:
return False
def switchUserField(self, sFieldName, sNewContent, bState):
myFieldHandler = TextFieldHandler(
- self.xMSF, TextDocument.xTextDocument)
+ self.xMSF, self.xTextDocument)
if bState:
myFieldHandler.changeUserFieldContent(sFieldName, sNewContent)
else:
@@ -115,7 +115,7 @@ class LetterDocument(TextDocument):
def fillSenderWithUserData(self):
try:
myFieldHandler = TextFieldHandler(
- TextDocument.xTextDocument, TextDocument.xTextDocument)
+ self.xTextDocument, self.xTextDocument)
oUserDataAccess = Configuration.getConfigurationRoot(
self.xMSF, "org.openoffice.UserProfile/Data", False)
myFieldHandler.changeUserFieldContent(
@@ -135,38 +135,38 @@ class LetterDocument(TextDocument):
def killEmptyUserFields(self):
myFieldHandler = TextFieldHandler(
- self.xMSF, TextDocument.xTextDocument)
+ self.xMSF, self.xTextDocument)
myFieldHandler.removeUserFieldByContent("")
def killEmptyFrames(self):
try:
if not self.keepLogoFrame:
xTF = self.getFrameByName(
- "Company Logo", TextDocument.xTextDocument)
+ "Company Logo", self.xTextDocument)
if xTF != None:
xTF.dispose()
if not self.keepBendMarksFrame:
xTF = self.getFrameByName(
- "Bend Marks", TextDocument.xTextDocument)
+ "Bend Marks", self.xTextDocument)
if xTF != None:
xTF.dispose()
if not self.keepLetterSignsFrame:
xTF = self.getFrameByName(
- "Letter Signs", TextDocument.xTextDocument)
+ "Letter Signs", self.xTextDocument)
if xTF != None:
xTF.dispose()
if not self.keepSenderAddressRepeatedFrame:
xTF = self.getFrameByName(
- "Sender Address Repeated", TextDocument.xTextDocument)
+ "Sender Address Repeated", self.xTextDocument)
if xTF != None:
xTF.dispose()
if not self.keepAddressFrame:
xTF = self.getFrameByName(
- "Sender Address", TextDocument.xTextDocument)
+ "Sender Address", self.xTextDocument)
if xTF != None:
xTF.dispose()
@@ -183,7 +183,7 @@ class BusinessPaperObject(object):
self.xFrame = None
try:
self.xFrame = \
- TextDocument.xTextDocument.createInstance(
+ self.xTextDocument.createInstance(
"com.sun.star.text.TextFrame")
self.setFramePosition()
Helper.setUnoPropertyValue(
@@ -221,9 +221,9 @@ class BusinessPaperObject(object):
self.xFrame,
"Print", False)
xTextCursor = \
- TextDocument.xTextDocument.Text.createTextCursor()
+ self.xTextDocument.Text.createTextCursor()
xTextCursor.gotoEnd(True)
- xText = TextDocument.xTextDocument.Text
+ xText = self.xTextDocument.Text
xText.insertTextContent(
xTextCursor, self.xFrame,
False)
@@ -271,7 +271,7 @@ class BusinessPaperObject(object):
def removeFrame(self):
if self.xFrame is not None:
try:
- TextDocument.xTextDocument.Text.removeTextContent(
+ self.xTextDocument.Text.removeTextContent(
self.xFrame)
except Exception:
traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 8f294771603a..b4590f1a1777 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -29,7 +29,6 @@ from ..ui.PathSelection import PathSelection
from ..ui.event.UnoDataAware import UnoDataAware
from ..ui.event.RadioDataAware import RadioDataAware
from ..text.TextElement import TextElement
-from ..text.TextDocument import TextDocument
from ..text.ViewHandler import ViewHandler
from ..text.TextFieldHandler import TextFieldHandler
from ..document.OfficeDocument import OfficeDocument
@@ -213,7 +212,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
self.myLetterDoc.killEmptyFrames()
self.bSaveSuccess = \
OfficeDocument.store(
- self.xMSF, TextDocument.xTextDocument,
+ self.xMSF, self.myLetterDoc.xTextDocument,
self.sPath, "writer8_template")
if self.bSaveSuccess:
self.saveConfiguration()
@@ -381,9 +380,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
selectedItemPos = self.lstBusinessStyle.SelectedItemPos
if self.lstBusinessStylePos != selectedItemPos:
self.lstBusinessStylePos = selectedItemPos
- TextDocument.xTextDocument = \
- self.myLetterDoc.loadAsPreview(
- self.BusinessFiles.values()[selectedItemPos], False)
+ self.myLetterDoc.loadAsPreview(
+ self.BusinessFiles.values()[selectedItemPos], False)
self.initializeElements()
self.chkBusinessPaperItemChanged()
self.setElements(False)
@@ -393,9 +391,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
selectedItemPos = self.lstPrivOfficialStyle.SelectedItemPos
if self.lstPrivOfficialStylePos != selectedItemPos:
self.lstPrivOfficialStylePos = selectedItemPos
- TextDocument.xTextDocument = \
- self.myLetterDoc.loadAsPreview(
- self.OfficialFiles.values()[selectedItemPos], False)
+ self.myLetterDoc.loadAsPreview(
+ self.OfficialFiles.values()[selectedItemPos], False)
self.initializeElements()
self.setPossibleSenderData(True)
self.setElements(False)
@@ -405,9 +402,9 @@ class LetterWizardDialogImpl(LetterWizardDialog):
selectedItemPos = self.lstPrivateStyle.SelectedItemPos
if self.lstPrivateStylePos != selectedItemPos:
self.lstPrivateStylePos = selectedItemPos
- TextDocument.xTextDocument = \
- self.myLetterDoc.loadAsPreview(
- self.PrivateFiles.values()[selectedItemPos], False)
+ self.myLetterDoc.xTextDocument = \
+ self.myLetterDoc.loadAsPreview(
+ self.PrivateFiles.values()[selectedItemPos], False)
self.initializeElements()
self.setElements(True)
@@ -569,8 +566,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
xReceiverFrame = None
if self.chkCompanyReceiver.State != 0:
try:
- xReceiverFrame = TextDocument.getFrameByName(
- "Receiver Address", TextDocument.xTextDocument)
+ xReceiverFrame = self.myLetterDoc.getFrameByName(
+ "Receiver Address", self.myLetterDoc.xTextDocument)
iFrameWidth = int(Helper.getUnoPropertyValue(
xReceiverFrame, PropertyNames.PROPERTY_WIDTH))
iFrameX = int(Helper.getUnoPropertyValue(
@@ -722,36 +719,36 @@ class LetterWizardDialogImpl(LetterWizardDialog):
def txtSenderNameTextChanged(self):
myFieldHandler = TextFieldHandler(
- self.myLetterDoc.xMSF, TextDocument.xTextDocument)
+ self.myLetterDoc.xMSF, self.myLetterDoc.xTextDocument)
myFieldHandler.changeUserFieldContent(
"Company", self.txtSenderName.Text)
def txtSenderStreetTextChanged(self):
myFieldHandler = TextFieldHandler(
- self.myLetterDoc.xMSF, TextDocument.xTextDocument)
+ self.myLetterDoc.xMSF, self.myLetterDoc.xTextDocument)
myFieldHandler.changeUserFieldContent(
"Street", self.txtSenderStreet.Text)
def txtSenderCityTextChanged(self):
myFieldHandler = TextFieldHandler(
- self.myLetterDoc.xMSF, TextDocument.xTextDocument)
+ self.myLetterDoc.xMSF, self.myLetterDoc.xTextDocument)
myFieldHandler.changeUserFieldContent(
"City", self.txtSenderCity.Text)
def txtSenderPostCodeTextChanged(self):
myFieldHandler = TextFieldHandler(
- self.myLetterDoc.xMSF, TextDocument.xTextDocument)
+ self.myLetterDoc.xMSF, self.myLetterDoc.xTextDocument)
myFieldHandler.changeUserFieldContent(
"PostCode", self.txtSenderPostCode.Text)
def txtSenderStateTextChanged(self):
myFieldHandler = TextFieldHandler(
- self.myLetterDoc.xMSF, TextDocument.xTextDocument)
+ self.myLetterDoc.xMSF, self.myLetterDoc.xTextDocument)
myFieldHandler.changeUserFieldContent(
PropertyNames.PROPERTY_STATE, self.txtSenderState.Text)
def txtTemplateNameTextChanged(self):
- xDocProps = TextDocument.xTextDocument.DocumentProperties
+ xDocProps = self.myLetterDoc.xTextDocument.DocumentProperties
TitleName = self.txtTemplateName.Text
xDocProps.Title = TitleName
@@ -959,6 +956,16 @@ class LetterWizardDialogImpl(LetterWizardDialog):
elif self.optPrivateLetter.State:
self.optPrivateLetterItemChanged()
+ def optReceiverPlaceholderItemChanged(self):
+ OfficeDocument.attachEventCall(
+ self.myLetterDoc.xTextDocument, "OnNew", "StarBasic",
+ "macro:///Template.Correspondence.Placeholder()")
+
+ def optReceiverDatabaseItemChanged(self):
+ OfficeDocument.attachEventCall(
+ self.myLetterDoc.xTextDocument, "OnNew", "StarBasic",
+ "macro:///Template.Correspondence.Database()")
+
def setElements(self, privLetter):
if self.optSenderDefine.State:
self.optSenderDefineItemChanged()
@@ -987,7 +994,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
def drawConstants(self):
'''Localise the template'''
- constRangeList = TextDocument.searchFillInItems(1)
+ constRangeList = self.myLetterDoc.searchFillInItems(1)
for i in constRangeList:
text = i.String.lower()