[Libreoffice-commits] .: Branch 'feature/gsoc2011_wizards' - wizards/com

Xisco Fauli xfauli at kemper.freedesktop.org
Mon Jul 25 14:04:10 PDT 2011


 wizards/com/sun/star/wizards/document/OfficeDocument.java      |    4 -
 wizards/com/sun/star/wizards/document/OfficeDocument.py        |    8 +-
 wizards/com/sun/star/wizards/fax/FaxDocument.py                |    2 
 wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.py       |    2 
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py        |   36 ++--------
 wizards/com/sun/star/wizards/letter/LetterDocument.py          |    1 
 wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.py |    2 
 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py  |   35 ++-------
 wizards/com/sun/star/wizards/text/TextDocument.py              |   20 ++---
 wizards/com/sun/star/wizards/ui/WizardDialog.py                |   21 +++++
 10 files changed, 55 insertions(+), 76 deletions(-)

New commits:
commit 059c797f700bc56825a37450911bacea1dd4b876
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Jul 25 23:03:16 2011 +0200

    Remove duplicate code, clean imports and fix a problem

diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java
index f80bdde..dcc1a79 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 7831512..f0a07fd 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 9ee53cd..b5fee83 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 680a9e3..e5a72e1 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 071d4cf..499cfab 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 ea79721..6729a33 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 5efa78e..c44c6dc 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 599d14d..d2ca5f7 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 0f5465a..194bea1 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 fb12051..d29366a 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):


More information about the Libreoffice-commits mailing list