diff options
author | Xisco Fauli <anistenis@gmail.com> | 2011-07-25 23:03:16 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-18 02:57:43 +0200 |
commit | f601dd95dcab2314977c2c756823f56d01ad93ce (patch) | |
tree | 81463301f290dfb34bfa27dfdb94987c9cc9ccc9 | |
parent | 5cf673d4782605da4b7e6bef984797bd1683b193 (diff) |
Remove duplicate code, clean imports and fix a problem
10 files changed, 55 insertions, 76 deletions
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java index f80bdde324ba..dcc1a7918f4f 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.java +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java @@ -81,7 +81,7 @@ public class OfficeDocument { try { - XEventsSupplier xEventsSuppl = UnoRuntime.queryInterface(XEventsSupplier.class, xComponent); + XEventsSupplier xEventssSuppl = UnoRuntime.queryInterface(XEventsSupplier.class, xComponent); PropertyValue[] oEventProperties = new PropertyValue[2]; oEventProperties[0] = new PropertyValue(); oEventProperties[0].Name = "EventType"; @@ -89,7 +89,7 @@ public class OfficeDocument oEventProperties[1] = new PropertyValue(); oEventProperties[1].Name = "Script"; //PropertyNames.URL; oEventProperties[1].Value = EventURL; - xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties); + xEventssSuppl.getEvents().replaceByName(EventName, oEventProperties); } catch (Exception exception) { diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py index 41dc11e3e18e..70e6487b594d 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.py +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py @@ -1,12 +1,12 @@ -from com.sun.star.awt.WindowClass import TOP -import traceback import uno +import traceback +import unohelper from ui.event.CommonListener import TerminateListenerProcAdapter from common.Desktop import Desktop + from com.sun.star.awt import WindowDescriptor from com.sun.star.awt import Rectangle -import unohelper - +from com.sun.star.awt.WindowClass import TOP from com.sun.star.task import ErrorCodeIOException #Window Constants diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.py b/wizards/com/sun/star/wizards/fax/FaxDocument.py index 9ee53cd434d9..b5fee838796b 100644 --- a/wizards/com/sun/star/wizards/fax/FaxDocument.py +++ b/wizards/com/sun/star/wizards/fax/FaxDocument.py @@ -1,7 +1,5 @@ from text.TextDocument import * from text.TextSectionHandler import TextSectionHandler -from text.TextFieldHandler import TextFieldHandler -from common.Configuration import Configuration from common.PropertyNames import PropertyNames from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.py index 680a9e3de3bd..e5a72e195033 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.py @@ -38,7 +38,7 @@ CHKFOOTERNEXTPAGES_ITEM_CHANGED = "chkFooterNextPagesItemChanged" CHKFOOTERPAGENUMBERS_ITEM_CHANGED = "chkFooterPageNumbersItemChanged" TXTTEMPLATENAME_TEXT_CHANGED = "txtTemplateNameTextChanged" FILETEMPLATEPATH_TEXT_CHANGED = None # "fileTemplatePathTextChanged" -OPTCREATEFAX_ITEM_CHANGED = "optCreateFaxItemChanged" +OPTCREATEFAX_ITEM_CHANGED = "optCreateFromTemplateItemChanged" OPTMAKECHANGES_ITEM_CHANGED = "optMakeChangesItemChanged" imageURLImageControl2 = None #"images/ImageControl2" imageURLImageControl3 = None #"images/ImageControl3" diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py index 071d4cf4f0a7..499cfababe2f 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py @@ -1,19 +1,17 @@ from FaxWizardDialog import * from CGFaxWizard import * from FaxDocument import * -from ui.PathSelection import * -from common.FileAccess import * -from ui.event.UnoDataAware import * -from ui.event.RadioDataAware import * -from common.Configuration import * -from document.OfficeDocument import OfficeDocument +from ui.PathSelection import PathSelection +from common.FileAccess import FileAccess +from ui.event.UnoDataAware import UnoDataAware +from ui.event.RadioDataAware import RadioDataAware from text.TextFieldHandler import TextFieldHandler -from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO +from common.SystemDialog import SystemDialog +from common.NoValidPathException import NoValidPathException -from common.NoValidPathException import * +from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO from com.sun.star.uno import RuntimeException from com.sun.star.util import CloseVetoException - from com.sun.star.view.DocumentZoomType import OPTIMAL from com.sun.star.document.UpdateDocMode import FULL_UPDATE from com.sun.star.document.MacroExecMode import ALWAYS_EXECUTE @@ -495,20 +493,6 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.txtSenderCityTextChanged() self.txtSenderFaxTextChanged() - 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()") - - def optCreateFaxItemChanged(self): - self.bEditTemplate = False - - def optMakeChangesItemChanged(self): - self.bEditTemplate = True - def txtSenderNameTextChanged(self): self.myFieldHandler.changeUserFieldContent( "Company", self.txtSenderName.Text) @@ -555,13 +539,13 @@ class FaxWizardDialogImpl(FaxWizardDialog): if self.optReceiverDatabase.State: self.optReceiverDatabaseItemChanged() - if self.optReceiverPlaceholder.State: + elif self.optReceiverPlaceholder.State: self.optReceiverPlaceholderItemChanged() if self.optCreateFax.State: - self.optCreateFaxItemChanged() + self.optCreateFromTemplateItemChanged() - if self.optMakeChanges.State: + elif self.optMakeChanges.State: self.optMakeChangesItemChanged() def chkUseLogoItemChanged(self): diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.py b/wizards/com/sun/star/wizards/letter/LetterDocument.py index 517d0c669adb..f2603956ceb5 100644 --- a/wizards/com/sun/star/wizards/letter/LetterDocument.py +++ b/wizards/com/sun/star/wizards/letter/LetterDocument.py @@ -1,6 +1,5 @@ from text.TextDocument import * from text.TextSectionHandler import TextSectionHandler -from text.TextFieldHandler import TextFieldHandler from com.sun.star.table import BorderLine from common.PropertyNames import PropertyNames diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.py index 5efa78eea662..c44c6dc40eee 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.py +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.py @@ -50,7 +50,7 @@ TXTFOOTER_TEXT_CHANGED = "txtFooterTextChanged" CHKFOOTERNEXTPAGES_ITEM_CHANGED = "chkFooterNextPagesItemChanged" CHKFOOTERPAGENUMBERS_ITEM_CHANGED = "chkFooterPageNumbersItemChanged" TXTTEMPLATENAME_TEXT_CHANGED = "txtTemplateNameTextChanged" -OPTCREATELETTER_ITEM_CHANGED = "optCreateLetterItemChanged" +OPTCREATELETTER_ITEM_CHANGED = "optCreateFromTemplateItemChanged" OPTMAKECHANGES_ITEM_CHANGED = "optMakeChangesItemChanged" FILETEMPLATEPATH_TEXT_CHANGED = None imageURLImageControl1 = None diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py index 599d14da0a92..d2ca5f7150f7 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py @@ -1,18 +1,17 @@ -import traceback from LetterWizardDialog import * from LetterDocument import * -from common.NoValidPathException import * -from common.FileAccess import * +from common.NoValidPathException import NoValidPathException +from common.FileAccess import FileAccess from LocaleCodes import LocaleCodes -from ui.PathSelection import * -from common.Configuration import * +from ui.PathSelection import PathSelection +from common.Configuration import Configuration from CGLetterWizard import CGLetterWizard -from ui.event.UnoDataAware import * -from ui.event.RadioDataAware import * -from document.OfficeDocument import OfficeDocument +from ui.event.UnoDataAware import UnoDataAware +from ui.event.RadioDataAware import RadioDataAware from text.TextFieldHandler import TextFieldHandler -from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO +from common.SystemDialog import SystemDialog +from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO from com.sun.star.view.DocumentZoomType import OPTIMAL from com.sun.star.document.UpdateDocMode import FULL_UPDATE from com.sun.star.document.MacroExecMode import ALWAYS_EXECUTE @@ -359,22 +358,6 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.txtSenderStateTextChanged() self.txtSenderCityTextChanged() - def optCreateLetterItemChanged(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()") - def lstBusinessStyleItemChanged(self): selectedItemPos = self.lstBusinessStyle.SelectedItemPos if LetterWizardDialogImpl.lstBusinessStylePos is not selectedItemPos: @@ -1064,7 +1047,7 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.optReceiverPlaceholderItemChanged() if self.optCreateLetter.State: - self.optCreateLetterItemChanged() + self.optCreateFromTemplateItemChanged() if self.optMakeChanges.State: self.optMakeChangesItemChanged() diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py index 0f5465a11750..194bea1ac960 100644 --- a/wizards/com/sun/star/wizards/text/TextDocument.py +++ b/wizards/com/sun/star/wizards/text/TextDocument.py @@ -1,19 +1,21 @@ import uno +import traceback +import time +from datetime import date as dateTimeObject + from common.Desktop import Desktop -from com.sun.star.view.DocumentZoomType import ENTIRE_PAGE -from com.sun.star.beans.PropertyState import DIRECT_VALUE from common.Helper import Helper from document.OfficeDocument import OfficeDocument -import traceback from text.ViewHandler import ViewHandler from text.TextFieldHandler import TextFieldHandler +from common.Configuration import Configuration + from com.sun.star.container import NoSuchElementException from com.sun.star.lang import WrappedTargetException -from common.Configuration import Configuration -import time -from datetime import date as dateTimeObject from com.sun.star.util import DateTime from com.sun.star.i18n.NumberFormatIndex import DATE_SYS_DDMMYY +from com.sun.star.view.DocumentZoomType import ENTIRE_PAGE +from com.sun.star.beans.PropertyState import DIRECT_VALUE class TextDocument(object): @@ -277,9 +279,3 @@ class TextDocument(object): return xTD.TextFrames.getByName(sFrameName) return None - - ''' - Possible Values for "OptionString" are: "LoadCellStyles", - "LoadTextStyles", "LoadFrameStyles", - "LoadPageStyles", "LoadNumberingStyles", "OverwriteStyles" - ''' diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py index fb12051191aa..d29366ab9b91 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.py +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py @@ -1,10 +1,13 @@ 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 common.HelpIds import * from com.sun.star.awt.PushButtonType import HELP, STANDARD from ui.XPathSelectionListener import XPathSelectionListener @@ -468,6 +471,22 @@ class WizardDialog(UnoDialog2): 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): |