summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/document
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-05-27 20:39:30 +0200
committerJan Holesovsky <kendy@suse.cz>2011-05-27 20:39:30 +0200
commit88c1a56d1127376284095465cf85f5b4e71a08e5 (patch)
tree4b7ae852d8a8b86f9125b9218d36faf574b9a1a7 /wizards/com/sun/star/wizards/document
parent779b389116e7112c7ca29cb08e56cfcb043ecc4d (diff)
parent84d9f0ceb2048550acf763879993348fb1cfb473 (diff)
Merge remote-tracking branch 'origin/integration/dev300_m106'
Conflicts: extensions/source/svg/svgaction.cxx extensions/source/svg/svguno.cxx package/source/xstor/owriteablestream.cxx package/source/xstor/xstorage.cxx package/source/zippackage/ZipPackageStream.cxx setup_native/source/win32/customactions/shellextensions/registerextensions.cxx wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
Diffstat (limited to 'wizards/com/sun/star/wizards/document')
-rw-r--r--wizards/com/sun/star/wizards/document/Control.java12
-rw-r--r--wizards/com/sun/star/wizards/document/DatabaseControl.java12
-rw-r--r--wizards/com/sun/star/wizards/document/FormHandler.java137
-rw-r--r--wizards/com/sun/star/wizards/document/GridControl.java2
-rw-r--r--wizards/com/sun/star/wizards/document/OfficeDocument.java72
-rw-r--r--wizards/com/sun/star/wizards/document/Shape.java10
-rw-r--r--wizards/com/sun/star/wizards/document/TimeStampControl.java11
7 files changed, 129 insertions, 127 deletions
diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java
index 96485cdf84ce..ce4afe5a3022 100644
--- a/wizards/com/sun/star/wizards/document/Control.java
+++ b/wizards/com/sun/star/wizards/document/Control.java
@@ -131,7 +131,7 @@ public class Control extends Shape
{
if (xFormName != null)
{
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xFormName);
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xFormName);
String sControlName = Desktop.getUniqueName(xNameAccess, getControlName(_fieldname));
xPropertySet.setPropertyValue(PropertyNames.PROPERTY_NAME, sControlName);
xFormName.insertByName(sControlName, xControlModel);
@@ -145,7 +145,7 @@ public class Control extends Shape
public String getControlName(String _fieldname)
{
- String controlname = "";
+ String controlname = PropertyNames.EMPTY_STRING;
switch (getControlType())
{
case FormHandler.SOLABEL:
@@ -280,7 +280,7 @@ public class Control extends Shape
*/
public XLayoutConstrains getPeer()
{
- return (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, xControl.getPeer());
+ return UnoRuntime.queryInterface(XLayoutConstrains.class, xControl.getPeer());
}
public Size getPeerSize()
@@ -314,13 +314,13 @@ public class Control extends Shape
}
else if (getControlType() == FormHandler.SODATECONTROL)
{
- xPropertySet.setPropertyValue("Date", new Integer(4711)); //TODO find a better date
+ xPropertySet.setPropertyValue("Date", 4711); //TODO find a better date
aPreferredSize = getPeer().getPreferredSize();
xPropertySet.setPropertyValue("Date", com.sun.star.uno.Any.VOID);
}
else if (getControlType() == FormHandler.SOTIMECONTROL)
{
- xPropertySet.setPropertyValue("Time", new Integer(47114)); //TODO find a better time
+ xPropertySet.setPropertyValue("Time", 47114); //TODO find a better time
aPreferredSize = getPeer().getPreferredSize();
xPropertySet.setPropertyValue("Time", com.sun.star.uno.Any.VOID);
}
@@ -338,7 +338,7 @@ public class Control extends Shape
}
xPropertySet.setPropertyValue("Text", stext);
aPreferredSize = getPeer().getPreferredSize();
- xPropertySet.setPropertyValue("Text", "");
+ xPropertySet.setPropertyValue("Text", PropertyNames.EMPTY_STRING);
}
return aPreferredSize;
}
diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java
index 67a85c436f6f..5e8877374c9b 100644
--- a/wizards/com/sun/star/wizards/document/DatabaseControl.java
+++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java
@@ -90,10 +90,10 @@ public class DatabaseControl extends Control
{
bHidden = true;
}
- xPropColumn.setPropertyValue("Hidden", new Boolean(bHidden));
+ xPropColumn.setPropertyValue("Hidden", Boolean.valueOf(bHidden));
xPropColumn.setPropertyValue("DataField", sFieldName);
xPropColumn.setPropertyValue(PropertyNames.PROPERTY_LABEL, _columntitle);
- xPropColumn.setPropertyValue(PropertyNames.PROPERTY_WIDTH, new Integer(0)); // Width of column is adjusted to Columname
+ xPropColumn.setPropertyValue(PropertyNames.PROPERTY_WIDTH, 0); // Width of column is adjusted to Columname
XPropertySetInfo xPSI = xPropColumn.getPropertySetInfo();
if ( xPSI.hasPropertyByName( "MouseWheelBehavior" ) )
@@ -152,7 +152,7 @@ public class DatabaseControl extends Control
return FormHandler.oControlData[i].GridColumnName;
}
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public int getControlHeight()
@@ -160,16 +160,14 @@ public class DatabaseControl extends Control
if (getControlType() == FormHandler.SOIMAGECONTROL)
{
// return oFormHandler.getImageControlHeight();
- final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4;
- return nMemofieldheight;
+ return oFormHandler.getControlReferenceHeight() * 4;
}
else
{
if (getFieldType() == DataType.LONGVARCHAR)
{
// Helper.setUnoPropertyValue(xControlModel, PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE);
- final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4;
- return nMemofieldheight;
+ return oFormHandler.getControlReferenceHeight() * 4;
}
else if (getControlType() == FormHandler.SOCHECKBOX)
{
diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java
index 17dece81a03e..828ae4fc67f0 100644
--- a/wizards/com/sun/star/wizards/document/FormHandler.java
+++ b/wizards/com/sun/star/wizards/document/FormHandler.java
@@ -59,9 +59,17 @@ import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.container.XNamed;
+import java.util.logging.Level;
+import java.util.logging.Logger;
public class FormHandler
{
+ private static final String CHECKBOX = "CheckBox";
+ private static final String DATEFIELD = "DateField";
+ private static final String FORMATTEDFIELD = "FormattedField";
+ private static final String IMAGECONTROL = "ImageControl";
+ private static final String TEXTFIELD = "TextField";
+ private static final String TIMEFIELD = "TimeField";
public XFormsSupplier xFormsSupplier;
public XMultiServiceFactory xMSFDoc;
@@ -108,12 +116,12 @@ public class FormHandler
public FormHandler(XMultiServiceFactory _xMSF, XTextDocument xTextDocument)
{
this.xMSF = _xMSF;
- xDrawPageSupplier = (XDrawPageSupplier) UnoRuntime.queryInterface(XDrawPageSupplier.class, xTextDocument);
+ xDrawPageSupplier = UnoRuntime.queryInterface(XDrawPageSupplier.class, xTextDocument);
xDrawPage = xDrawPageSupplier.getDrawPage();
- xFormsSupplier = (XFormsSupplier) UnoRuntime.queryInterface(XFormsSupplier.class, xDrawPage);
- xShapeGrouper = (XShapeGrouper) UnoRuntime.queryInterface(XShapeGrouper.class, xDrawPage);
- xControlAccess = (XControlAccess) UnoRuntime.queryInterface(XControlAccess.class, xTextDocument.getCurrentController());
- xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xFormsSupplier = UnoRuntime.queryInterface(XFormsSupplier.class, xDrawPage);
+ xShapeGrouper = UnoRuntime.queryInterface(XShapeGrouper.class, xDrawPage);
+ xControlAccess = UnoRuntime.queryInterface(XControlAccess.class, xTextDocument.getCurrentController());
+ xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
sModelServices[SOLABEL] = "com.sun.star.form.component.FixedText";
sModelServices[SOTEXTBOX] = "com.sun.star.form.component.TextField";
sModelServices[SOCHECKBOX] = "com.sun.star.form.component.CheckBox";
@@ -124,30 +132,30 @@ public class FormHandler
sModelServices[SOIMAGECONTROL] = "com.sun.star.form.component.DatabaseImageControl";
oControlData = new ControlData[22];
- oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, "CheckBox", "CheckBox", false);
- oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, "CheckBox", "CheckBox", false);
- oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
- oControlData[3] = createControlData(DataType.SMALLINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
- oControlData[4] = createControlData(DataType.INTEGER, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
- oControlData[5] = createControlData(DataType.BIGINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
- oControlData[6] = createControlData(DataType.FLOAT, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
- oControlData[7] = createControlData(DataType.REAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
- oControlData[8] = createControlData(DataType.DOUBLE, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
- oControlData[9] = createControlData(DataType.NUMERIC, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
- oControlData[10] = createControlData(DataType.DECIMAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
- oControlData[11] = createControlData(DataType.CHAR, SOTEXTBOX, "TextField", "TextField", false);
- oControlData[12] = createControlData(DataType.VARCHAR, SOTEXTBOX, "TextField", "TextField", true);
- oControlData[13] = createControlData(DataType.LONGVARCHAR, SOTEXTBOX, "TextField", "TextField", true);
- oControlData[14] = createControlData(DataType.DATE, SODATECONTROL, "DateField", "DateField", false);
- oControlData[15] = createControlData(DataType.TIME, SOTIMECONTROL, "TimeField", "TimeField", false);
- oControlData[16] = createControlData(DataType.TIMESTAMP, SODATECONTROL, "DateField", "TextField", false);
+ oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, CHECKBOX, CHECKBOX, false);
+ oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, CHECKBOX, CHECKBOX, false);
+ oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false);
+ oControlData[3] = createControlData(DataType.SMALLINT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false);
+ oControlData[4] = createControlData(DataType.INTEGER, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false);
+ oControlData[5] = createControlData(DataType.BIGINT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false);
+ oControlData[6] = createControlData(DataType.FLOAT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false);
+ oControlData[7] = createControlData(DataType.REAL, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false);
+ oControlData[8] = createControlData(DataType.DOUBLE, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false);
+ oControlData[9] = createControlData(DataType.NUMERIC, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false);
+ oControlData[10] = createControlData(DataType.DECIMAL, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false);
+ oControlData[11] = createControlData(DataType.CHAR, SOTEXTBOX, TEXTFIELD, TEXTFIELD, false);
+ oControlData[12] = createControlData(DataType.VARCHAR, SOTEXTBOX, TEXTFIELD, TEXTFIELD, true);
+ oControlData[13] = createControlData(DataType.LONGVARCHAR, SOTEXTBOX, TEXTFIELD, TEXTFIELD, true);
+ oControlData[14] = createControlData(DataType.DATE, SODATECONTROL, DATEFIELD, DATEFIELD, false);
+ oControlData[15] = createControlData(DataType.TIME, SOTIMECONTROL, TIMEFIELD, TIMEFIELD, false);
+ oControlData[16] = createControlData(DataType.TIMESTAMP, SODATECONTROL, DATEFIELD, TEXTFIELD, false);
// oImageControlData = new ControlData[4];
- oControlData[17] = createControlData(DataType.BINARY, SOIMAGECONTROL, "ImageControl", "TextField", false);
- oControlData[18] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false);
- oControlData[19] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false);
- oControlData[20] = createControlData(DataType.BLOB, SOIMAGECONTROL, "ImageControl", "TextField", false);
+ oControlData[17] = createControlData(DataType.BINARY, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false);
+ oControlData[18] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false);
+ oControlData[19] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false);
+ oControlData[20] = createControlData(DataType.BLOB, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false);
- oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, "ImageControl", "TextField", false);
+ oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false);
}
public int getControlType(int _fieldtype)
@@ -156,8 +164,7 @@ public class FormHandler
{
if (oControlData[i].DataType == _fieldtype)
{
- final int nType = oControlData[i].ControlType;
- return nType;
+ return oControlData[i].ControlType;
}
}
return -1;
@@ -184,7 +191,7 @@ public class FormHandler
public void initializeBasicControlValues()
{
Control oLabelControl = new Control(this, SOLABEL, new Point(), new Size());
- XDevice xDevice = (XDevice) UnoRuntime.queryInterface(XDevice.class, oLabelControl.xWindowPeer);
+ XDevice xDevice = UnoRuntime.queryInterface(XDevice.class, oLabelControl.xWindowPeer);
iXPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterX);
iYPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterY);
@@ -209,8 +216,7 @@ public class FormHandler
public XNameContainer getDocumentForms()
{
- XNameContainer xNamedForms = xFormsSupplier.getForms();
- return xNamedForms;
+ return xFormsSupplier.getForms();
}
public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName, String sMsg) throws com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException
@@ -219,8 +225,7 @@ public class FormHandler
{
if (xNamedForm.hasByName(ControlName))
{
- String ControlValue = AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
- return ControlValue;
+ return AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
}
else
{
@@ -238,7 +243,7 @@ public class FormHandler
try
{
XInterface xHiddenControl;
- if (xNameAccess.hasByName(ControlName) == true)
+ if (xNameAccess.hasByName(ControlName))
{
xHiddenControl = (XInterface) AnyConverter.toObject(new Type(XInterface.class), xNameAccess.getByName(ControlName));
}
@@ -249,9 +254,9 @@ public class FormHandler
}
Helper.setUnoPropertyValue(xHiddenControl, "HiddenValue", ControlValue);
}
- catch (Exception exception)
+ catch (Exception ex)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -260,7 +265,7 @@ public class FormHandler
public UnknownHiddenControlException(XNameAccess xNamedForm, String ControlName, String sMsgHiddenControlisMissing)
{
- XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xNamedForm);
+ XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xNamedForm);
String FormName = xNamed.getName();
sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, FormName, "<REPORTFORM>");
sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, ControlName, "<CONTROLNAME>");
@@ -271,7 +276,7 @@ public class FormHandler
public boolean hasFormByName(String _FormName)
{
xNamedFormContainer = getDocumentForms();
- xNamedForms = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNamedFormContainer);
+ xNamedForms = UnoRuntime.queryInterface(XNameAccess.class, xNamedFormContainer);
return xNamedForms.hasByName(_FormName);
}
@@ -285,9 +290,9 @@ public class FormHandler
xNamedFormContainer.removeByName(_FormName);
}
}
- catch (com.sun.star.uno.Exception exception)
+ catch (com.sun.star.uno.Exception ex)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -299,14 +304,14 @@ public class FormHandler
{
if (belongsToForm(xDrawPage.getByIndex(i), _FormName))
{
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
xDrawPage.remove(xShape);
}
}
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -318,26 +323,26 @@ public class FormHandler
}
catch ( WrappedTargetException e )
{
- e.printStackTrace( System.err );
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
catch( final NoSuchElementException e )
{
- e.printStackTrace( System.err );
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
public boolean belongsToForm(Object _oDrawPageElement, String _FormName)
{
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement);
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement);
if (xServiceInfo.supportsService("com.sun.star.drawing.ControlShape"))
{
- XControlShape xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, _oDrawPageElement);
+ XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, _oDrawPageElement);
XControlModel xControlModel = xControlShape.getControl();
- xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xControlShape.getControl());
+ xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, xControlShape.getControl());
if (xServiceInfo.supportsService("com.sun.star.form.FormComponent"))
{
- XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, xControlModel);
- XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xChild.getParent());
+ XChild xChild = UnoRuntime.queryInterface(XChild.class, xControlModel);
+ XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xChild.getParent());
String sName = xNamed.getName();
return _FormName.equals(sName);
}
@@ -355,7 +360,7 @@ public class FormHandler
oDBForm = xMSFDoc.createInstance("com.sun.star.form.component.Form");
_xNamedFormContainer.insertByName(_FormName, oDBForm);
XNameContainer xNamedForm;
- xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
+ xNamedForm = UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
return xNamedForm;
}
else
@@ -363,9 +368,9 @@ public class FormHandler
return getFormByName(_FormName);
}
}
- catch (com.sun.star.uno.Exception exception)
+ catch (com.sun.star.uno.Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
return null;
}
}
@@ -388,12 +393,12 @@ public class FormHandler
if (xNamedForms.hasByName(_sname))
{
Object oDBForm = AnyConverter.toObject(new Type(XInterface.class), Helper.getUnoObjectbyName(xNamedForms, _sname));
- xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
+ xNamedForm = UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
}
}
catch (IllegalArgumentException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
return xNamedForm;
}
@@ -484,13 +489,13 @@ public class FormHandler
{
for (int i = 0; i < this.xDrawPage.getCount(); i++)
{
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
xShape.setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos));
}
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -498,7 +503,7 @@ public class FormHandler
{
for (int i = this.xDrawPage.getCount(); i > -1; i--)
{
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
removeShape(xShape);
}
}
@@ -510,7 +515,7 @@ public class FormHandler
public void removeShape(XShape _xShape)
{
xDrawPage.remove(_xShape);
- XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _xShape);
+ XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, _xShape);
xComponent.dispose();
}
// Destroy all Shapes in Nirwana
@@ -518,7 +523,7 @@ public class FormHandler
{
for (int i = this.xDrawPage.getCount(); i > -1; i--)
{
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
if (xShape.getPosition().Y < this.iYNirwanaPos)
{
xDrawPage.remove(xShape);
@@ -531,14 +536,14 @@ public class FormHandler
try
{
Object oGroupShape = _xMSF.createInstance("com.sun.star.drawing.ShapeCollection");
- XShapes xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, oGroupShape);
+ XShapes xShapes = UnoRuntime.queryInterface(XShapes.class, oGroupShape);
xShapes.add(_xLabelShape);
xShapes.add(_xControlShape);
return this.xShapeGrouper.group(xShapes);
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
return null;
}
}
@@ -583,12 +588,12 @@ public class FormHandler
{
try
{
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, this.xMSFDoc.createInstance("com.sun.star.text.DocumentSettings"));
- xPropertySet.setPropertyValue("DoNotCaptureDrawObjsOnPage", new Boolean(!_bCaptureObjects));
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, this.xMSFDoc.createInstance("com.sun.star.text.DocumentSettings"));
+ xPropertySet.setPropertyValue("DoNotCaptureDrawObjsOnPage", Boolean.valueOf(!_bCaptureObjects));
}
- catch (Exception ex)
+ catch (Exception e)
{
- ex.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
}
diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java
index ef13d5c12a66..284dc5ef4309 100644
--- a/wizards/com/sun/star/wizards/document/GridControl.java
+++ b/wizards/com/sun/star/wizards/document/GridControl.java
@@ -76,7 +76,7 @@ public class GridControl extends Shape
FieldColumn curfieldcolumn = fieldcolumns[i];
if (curfieldcolumn.getFieldType() == DataType.TIMESTAMP)
{
- TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, "", "dbw"), this, curfieldcolumn);
+ TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, PropertyNames.EMPTY_STRING, "dbw"), this, curfieldcolumn);
}
else
{
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java
index ea132453bb30..074ff5350a39 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.java
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java
@@ -81,13 +81,13 @@ public class OfficeDocument
{
try
{
- XEventsSupplier xEventsSuppl = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class, xComponent);
+ XEventsSupplier xEventsSuppl = UnoRuntime.queryInterface(XEventsSupplier.class, xComponent);
PropertyValue[] oEventProperties = new PropertyValue[2];
oEventProperties[0] = new PropertyValue();
oEventProperties[0].Name = "EventType";
oEventProperties[0].Value = EventType; // "Service", "StarBasic"
oEventProperties[1] = new PropertyValue();
- oEventProperties[1].Name = "Script"; //"URL";
+ oEventProperties[1].Name = "Script"; //PropertyNames.URL;
oEventProperties[1].Value = EventURL;
xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties);
}
@@ -103,8 +103,8 @@ public class OfficeDocument
{
if (xComponent != null)
{
- XModifiable xModified = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xComponent);
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
+ XModifiable xModified = UnoRuntime.queryInterface(XModifiable.class, xComponent);
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent);
XFrame xFrame = xModel.getCurrentController().getFrame();
if (xModified.isModified())
{
@@ -131,7 +131,7 @@ public class OfficeDocument
PropertyValue[] loadValues = new PropertyValue[2];
loadValues[0] = new PropertyValue();
- loadValues[0].Name = "ReadOnly";
+ loadValues[0].Name = PropertyNames.READ_ONLY;
loadValues[0].Value = readonly ? Boolean.TRUE : Boolean.FALSE;
loadValues[1] = new PropertyValue();
loadValues[1].Name = "Preview";
@@ -144,18 +144,18 @@ public class OfficeDocument
try
{
- xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, frame);
- /*if (frame.getName() == null || frame.getName().equals(""));
+ xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, frame);
+ /*if (frame.getName() == null || frame.getName().equals(PropertyNames.EMPTY_STRING));
frame.setName("T" + System.currentTimeMillis());*/
XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, "_self", 0, loadValues);
- if (sDocumentType == "swriter")
+ if (sDocumentType.equals("swriter"))
{
- oDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ oDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent);
}
- else if (sDocumentType == "scalc")
+ else if (sDocumentType.equals("scalc"))
{
- oDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
+ oDocument = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
//TODO:
// else if (sDocumentType == "simpress")
// else if (sDocumentType == "sdraw")
@@ -182,14 +182,14 @@ public class OfficeDocument
}
else
{
- XFrame xF = (XFrame) UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xMSF));
+ XFrame xF = UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xMSF));
xFrame = xF.findFrame(FrameName, 0);
if (listener != null)
{
- XFramesSupplier xFS = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xF);
+ XFramesSupplier xFS = UnoRuntime.queryInterface(XFramesSupplier.class, xF);
XFrames xFF = xFS.getFrames();
xFF.remove(xFrame);
- XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xF);
+ XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, xF);
xDesktop.addTerminateListener(listener);
}
}
@@ -201,7 +201,7 @@ public class OfficeDocument
XToolkit xToolkit = null;
try
{
- xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, xMSF.createInstance("com.sun.star.awt.Toolkit"));
+ xToolkit = UnoRuntime.queryInterface(XToolkit.class, xMSF.createInstance("com.sun.star.awt.Toolkit"));
}
catch (Exception e)
{
@@ -226,14 +226,14 @@ public class OfficeDocument
XWindowPeer xPeer = null;
try
{
- xPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xToolkit.createWindow(aDescriptor));
+ xPeer = UnoRuntime.queryInterface(XWindowPeer.class, xToolkit.createWindow(aDescriptor));
}
catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xPeer);
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xPeer);
//define some further properties of the frame window
//if it's needed .-)
@@ -243,7 +243,7 @@ public class OfficeDocument
XFrame xFrame = null;
try
{
- xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, xMSF.createInstance("com.sun.star.frame.Frame"));
+ xFrame = UnoRuntime.queryInterface(XFrame.class, xMSF.createInstance("com.sun.star.frame.Frame"));
}
catch (Exception e)
{
@@ -273,13 +273,13 @@ public class OfficeDocument
//XInterface xInterface = null;
try
{
- xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xInterface);
+ xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, xInterface);
com.sun.star.lang.XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, sFrame, 0, xValues);
- XServiceInfo xComponentService = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xComponent);
+ XServiceInfo xComponentService = UnoRuntime.queryInterface(XServiceInfo.class, xComponent);
if (xComponentService.supportsService("com.sun.star.text.TextDocument"))
{
- oDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent); //TODO: write if clauses for Calc, Impress and Draw
+ oDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); //TODO: write if clauses for Calc, Impress and Draw
}
}
catch (Exception exception)
@@ -293,7 +293,7 @@ public class OfficeDocument
{
try
{
- XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xComponent);
+ XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, xComponent);
PropertyValue[] oStoreProperties;
if (FilterName.length() > 0)
{
@@ -303,13 +303,13 @@ public class OfficeDocument
oStoreProperties[0].Value = FilterName;
oStoreProperties[1] = new PropertyValue();
oStoreProperties[1].Name = "InteractionHandler";
- oStoreProperties[1].Value = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
+ oStoreProperties[1].Value = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
}
else
{
oStoreProperties = new PropertyValue[0];
}
- if (bStoreToUrl == true)
+ if (bStoreToUrl)
{
xStoreable.storeToURL(StorePath, oStoreProperties);
}
@@ -330,11 +330,11 @@ public class OfficeDocument
public static boolean close(XComponent xComponent)
{
boolean bState = false;
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent);
if (xModel != null)
{
- XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, xModel);
+ XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, xModel);
if (xCloseable != null)
{
@@ -351,7 +351,7 @@ public class OfficeDocument
}
else
{
- XComponent xDisposeable = (XComponent) UnoRuntime.queryInterface(XComponent.class, xModel);
+ XComponent xDisposeable = UnoRuntime.queryInterface(XComponent.class, xModel);
xDisposeable.dispose();
bState = true;
}
@@ -369,9 +369,9 @@ public class OfficeDocument
int colcount = datalist[0].length;
if (colcount > 0)
{
- XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oTable);
+ XCellRange xCellRange = UnoRuntime.queryInterface(XCellRange.class, oTable);
XCellRange xNewRange = xCellRange.getCellRangeByPosition(xpos, ypos, (colcount + xpos) - 1, (rowcount + ypos) - 1);
- XCellRangeData xDataArray = (XCellRangeData) UnoRuntime.queryInterface(XCellRangeData.class, xNewRange);
+ XCellRangeData xDataArray = UnoRuntime.queryInterface(XCellRangeData.class, xNewRange);
xDataArray.setDataArray(datalist);
}
}
@@ -389,13 +389,13 @@ public class OfficeDocument
PropertyValue[][] mediaDescr = new PropertyValue[1][1];
mediaDescr[0][0] = new PropertyValue();
- mediaDescr[0][0].Name = "URL";
+ mediaDescr[0][0].Name = PropertyNames.URL;
mediaDescr[0][0].Value = url;
- String type = ((XTypeDetection) UnoRuntime.queryInterface(XTypeDetection.class, typeDetect)).queryTypeByDescriptor(mediaDescr, true);
+ String type = UnoRuntime.queryInterface(XTypeDetection.class, typeDetect).queryTypeByDescriptor(mediaDescr, true);
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
- if (type.equals(""))
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
+ if (type.equals(PropertyNames.EMPTY_STRING))
{
return null;
}
@@ -409,7 +409,7 @@ public class OfficeDocument
throws Exception
{
Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
return (PropertyValue[]) xNameAccess.getByName(type);
}
@@ -421,13 +421,13 @@ public class OfficeDocument
*/
public static int getSlideCount(Object model)
{
- XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier) UnoRuntime.queryInterface(XDrawPagesSupplier.class, model);
+ XDrawPagesSupplier xDrawPagesSupplier = UnoRuntime.queryInterface(XDrawPagesSupplier.class, model);
return xDrawPagesSupplier.getDrawPages().getCount();
}
public static XDocumentProperties getDocumentProperties(Object document)
{
- XDocumentPropertiesSupplier xDocumentPropertiesSupplier = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, document);
+ XDocumentPropertiesSupplier xDocumentPropertiesSupplier = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, document);
return xDocumentPropertiesSupplier.getDocumentProperties();
}
diff --git a/wizards/com/sun/star/wizards/document/Shape.java b/wizards/com/sun/star/wizards/document/Shape.java
index b2ef1a27e662..990fe68cb916 100644
--- a/wizards/com/sun/star/wizards/document/Shape.java
+++ b/wizards/com/sun/star/wizards/document/Shape.java
@@ -73,8 +73,8 @@ public class Shape
this.aSize = _aSize;
this.oFormHandler = _oFormHandler;
Object oShape = oFormHandler.xMSF.createInstance(_sServiceName);
- xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, oShape);
- xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oShape);
+ xShapes = UnoRuntime.queryInterface(XShapes.class, oShape);
+ xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oShape);
}
catch (Exception e)
{
@@ -92,7 +92,7 @@ public class Shape
{
xMSF = oFormHandler.xMSFDoc;
Object oShape = xMSF.createInstance(sServiceName);
- xShape = (XShape) UnoRuntime.queryInterface(XShape.class, oShape);
+ xShape = UnoRuntime.queryInterface(XShape.class, oShape);
xShape.setPosition(aPoint);
if (aSize != null)
{
@@ -103,8 +103,8 @@ public class Shape
xShape.setSize(new Size(1000, 100));
}
Helper.setUnoPropertyValue(xShape, "AnchorType", TextContentAnchorType.AT_PARAGRAPH);
- xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xShape);
- xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, xShape);
+ xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, xShape);
+ xControlShape = UnoRuntime.queryInterface(XControlShape.class, xShape);
}
catch (Exception e)
diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java
index fb5c328aef23..3f0e3609e654 100644
--- a/wizards/com/sun/star/wizards/document/TimeStampControl.java
+++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java
@@ -75,7 +75,7 @@ public class TimeStampControl extends DatabaseControl
xShapes.add(oDateControl.xShape);
xShapes.add(oTimeControl.xShape);
xShapeGroup = _oFormHandler.xShapeGrouper.group(xShapes);
- xShapeGroup = (XShape) UnoRuntime.queryInterface(XShape.class, xShapeGroup);
+ xShapeGroup = UnoRuntime.queryInterface(XShape.class, xShapeGroup);
nreldatewidth = 1.0 / ((double) getSize().Width / (double) nDateWidth);
nreltimewidth = 1.0 - nreldatewidth;
}
@@ -87,9 +87,8 @@ public class TimeStampControl extends DatabaseControl
if (_i < xShapes.getCount())
{
Object oControl = xShapes.getByIndex(_i);
- XControlShape xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, oControl);
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlShape.getControl());
- return xPropertySet;
+ XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, oControl);
+ return UnoRuntime.queryInterface(XPropertySet.class, xControlShape.getControl());
}
}
catch (Exception e)
@@ -105,8 +104,8 @@ public class TimeStampControl extends DatabaseControl
oResource = _oResource;
sDateAppendix = oResource.getResText(UIConsts.RID_FORM + 88);
sTimeAppendix = oResource.getResText(UIConsts.RID_FORM + 89);
- oDateControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.DATE, _curfieldcolumn.getFieldTitle() + " " + sDateAppendix);
- oTimeControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.TIME, _curfieldcolumn.getFieldTitle() + " " + sTimeAppendix);
+ oDateControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.DATE, _curfieldcolumn.getFieldTitle() + PropertyNames.SPACE + sDateAppendix);
+ oTimeControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.TIME, _curfieldcolumn.getFieldTitle() + PropertyNames.SPACE + sTimeAppendix);
}
public void setPropertyValue(String _sPropertyName, Object _aPropertyValue) throws Exception