summaryrefslogtreecommitdiff
path: root/wizards/com
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2004-11-27 08:07:35 +0000
committerKurt Zenker <kz@openoffice.org>2004-11-27 08:07:35 +0000
commitc335d838d9b984427f44a645963d0a5b38cf714d (patch)
tree0b92e1d1359f96dcbdb2fff264ab84409633004b /wizards/com
parenta3cd93f10553f75a42fbfa08eed40babb7769367 (diff)
INTEGRATION: CWS qwizardsbf1 (1.2.40); FILE MERGED
2004/11/15 11:28:16 tv 1.2.40.3: #i35890# corrected month in updateDateFields() Issue number: Submitted by: Reviewed by: 2004/10/25 13:23:17 tv 1.2.40.2: #i35890# updated date in letter wizard and fax wizard preview 2004/10/13 12:06:02 tv 1.2.40.1: small bugfixes
Diffstat (limited to 'wizards/com')
-rw-r--r--wizards/com/sun/star/wizards/text/TextFieldHandler.java65
1 files changed, 63 insertions, 2 deletions
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
index 1ccffef52327..4951ff08b2cb 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
@@ -2,9 +2,9 @@
*
* $RCSfile: TextFieldHandler.java,v $
*
-* $Revision: 1.2 $
+* $Revision: 1.3 $
*
-* last change: $Author: kz $ $Date: 2004-05-19 12:48:50 $
+* last change: $Author: kz $ $Date: 2004-11-27 09:07:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,23 +60,37 @@
package com.sun.star.wizards.text;
+import java.awt.TextField;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
import java.util.Vector;
+import com.sun.star.text.UserDataPart;
import com.sun.star.text.XDependentTextField;
import com.sun.star.text.XTextContent;
import com.sun.star.text.XTextCursor;
import com.sun.star.text.XTextDocument;
import com.sun.star.text.XTextFieldsSupplier;
import com.sun.star.text.XTextRange;
+import com.sun.star.beans.Property;
import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.NoSuchElementException;
import com.sun.star.container.XEnumeration;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
import com.sun.star.uno.Any;
import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+import com.sun.star.util.DateTime;
import com.sun.star.util.XRefreshable;
+import com.sun.star.util.XUpdatable;
import com.sun.star.wizards.common.Helper;
public class TextFieldHandler {
@@ -206,6 +220,53 @@ public class TextFieldHandler {
}
+ public void updateDocInfoFields() {
+ try {
+ XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
+ while (xEnum.hasMoreElements()) {
+ Object oTextField = xEnum.nextElement();
+ XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
+
+ if (xSI.supportsService("com.sun.star.text.TextField.ExtendedUser")) {
+ XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
+ xUp.update();
+ }
+ if (xSI.supportsService("com.sun.star.text.TextField.User")) {
+ XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
+ xUp.update();
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ public void updateDateFields() {
+ try {
+ XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
+ Calendar cal = new GregorianCalendar();
+ DateTime dt = new DateTime();
+ dt.Day = (short) cal.get(Calendar.DAY_OF_MONTH);
+ dt.Year = (short) cal.get(Calendar.YEAR);
+ dt.Month = (short) cal.get(Calendar.MONTH);
+ dt.Month++;
+
+ while (xEnum.hasMoreElements()) {
+ Object oTextField = xEnum.nextElement();
+ XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
+
+ if (xSI.supportsService("com.sun.star.text.TextField.DateTime")) {
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTextField);
+ xPSet.setPropertyValue("DateTimeValue", dt);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
public void removeUserFieldByContent(String _FieldContent) {
try {
XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String");