1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ef39d40dSAndrew Rist  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ef39d40dSAndrew Rist  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19*ef39d40dSAndrew Rist  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package util;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import com.sun.star.awt.Point;
27cdf0e10cSrcweir import com.sun.star.beans.PropertyValue;
28cdf0e10cSrcweir import com.sun.star.drawing.PolygonFlags;
29cdf0e10cSrcweir //import util.BitmapLoader;
30cdf0e10cSrcweir import com.sun.star.uno.Enum ;
31cdf0e10cSrcweir import java.lang.reflect.Field ;
32cdf0e10cSrcweir import java.lang.reflect.Method ;
33cdf0e10cSrcweir import java.lang.reflect.Modifier ;
34cdf0e10cSrcweir import java.lang.reflect.Array ;
35cdf0e10cSrcweir import com.sun.star.uno.Any;
36cdf0e10cSrcweir import com.sun.star.uno.AnyConverter;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir public class ValueChanger {
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 
42cdf0e10cSrcweir  // Method to change a Value, thought for properties
changePValue( Object oldValue )43cdf0e10cSrcweir  public static Object changePValue( Object oldValue ) {
44cdf0e10cSrcweir 
45cdf0e10cSrcweir    Object newValue = null;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.uno.Any) {
48cdf0e10cSrcweir      try {
49cdf0e10cSrcweir         oldValue = AnyConverter.toObject(((Any) oldValue).getType(),oldValue);
50cdf0e10cSrcweir      } catch (com.sun.star.lang.IllegalArgumentException iae) {
51cdf0e10cSrcweir      }
52cdf0e10cSrcweir    }
53cdf0e10cSrcweir 
54cdf0e10cSrcweir    if (oldValue == null)
55cdf0e10cSrcweir      return null;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir    if (oldValue instanceof Boolean) {
58cdf0e10cSrcweir      boolean oldbool = ((Boolean) oldValue).booleanValue();
59cdf0e10cSrcweir      newValue = new Boolean(!oldbool);
60cdf0e10cSrcweir    } else
61cdf0e10cSrcweir 
62cdf0e10cSrcweir    if (oldValue instanceof Integer) {
63cdf0e10cSrcweir      int oldint = ((Integer) oldValue).intValue();
64cdf0e10cSrcweir      newValue = new Integer(oldint+5);
65cdf0e10cSrcweir    } else
66cdf0e10cSrcweir 
67cdf0e10cSrcweir    if (oldValue instanceof Long) {
68cdf0e10cSrcweir      long oldlong = ((Long) oldValue).longValue();
69cdf0e10cSrcweir      newValue = new Long(oldlong + 15);
70cdf0e10cSrcweir    } else
71cdf0e10cSrcweir 
72cdf0e10cSrcweir    if (oldValue instanceof Short) {
73cdf0e10cSrcweir      short oldshort = ((Short) oldValue).shortValue();
74cdf0e10cSrcweir      newValue = new Short((short) (oldshort + 1));
75cdf0e10cSrcweir    } else
76cdf0e10cSrcweir 
77cdf0e10cSrcweir    if (oldValue instanceof Byte) {
78cdf0e10cSrcweir      byte oldbyte = ((Byte) oldValue).byteValue();
79cdf0e10cSrcweir      newValue = new Byte((byte) (oldbyte + 1));
80cdf0e10cSrcweir    } else
81cdf0e10cSrcweir 
82cdf0e10cSrcweir    if (oldValue instanceof Float) {
83cdf0e10cSrcweir      float oldfloat = ((Float) oldValue).floatValue();
84cdf0e10cSrcweir      newValue = new Float((float) (oldfloat + 16.7));
85cdf0e10cSrcweir    } else
86cdf0e10cSrcweir 
87cdf0e10cSrcweir    if (oldValue instanceof Double) {
88cdf0e10cSrcweir      double olddouble = ((Double) oldValue).doubleValue();
89cdf0e10cSrcweir      newValue = new Double(olddouble + 17.8);
90cdf0e10cSrcweir    } else
91cdf0e10cSrcweir 
92cdf0e10cSrcweir    if (oldValue instanceof String) {
93cdf0e10cSrcweir      String oldString = (String) oldValue;
94cdf0e10cSrcweir      newValue = oldString + "New";
95cdf0e10cSrcweir    } else
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 
98cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.chart.ChartAxisArrangeOrderType) {
99cdf0e10cSrcweir          Object AO1 = com.sun.star.chart.ChartAxisArrangeOrderType.AUTO;
100cdf0e10cSrcweir          Object AO2=  com.sun.star.chart.ChartAxisArrangeOrderType.SIDE_BY_SIDE;
101cdf0e10cSrcweir          Object AO3=  com.sun.star.chart.ChartAxisArrangeOrderType.STAGGER_EVEN;
102cdf0e10cSrcweir          Object AO4=  com.sun.star.chart.ChartAxisArrangeOrderType.STAGGER_ODD;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir          if (oldValue.equals(AO1)) newValue = AO2;
105cdf0e10cSrcweir          if (oldValue.equals(AO2)) newValue = AO3;
106cdf0e10cSrcweir          if (oldValue.equals(AO3)) newValue = AO4;
107cdf0e10cSrcweir          if (oldValue.equals(AO4)) newValue = AO1;
108cdf0e10cSrcweir    } else
109cdf0e10cSrcweir 
110cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.view.PaperOrientation) {
111cdf0e10cSrcweir          Object OR1 = com.sun.star.view.PaperOrientation.LANDSCAPE;
112cdf0e10cSrcweir          Object OR2 = com.sun.star.view.PaperOrientation.PORTRAIT;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir          if (oldValue.equals(OR1)) newValue = OR2;
115cdf0e10cSrcweir                              else newValue = OR1;
116cdf0e10cSrcweir    } else
117cdf0e10cSrcweir 
118cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.lang.Locale) {
119cdf0e10cSrcweir          Object Loc1 = new com.sun.star.lang.Locale("en","US","");
120cdf0e10cSrcweir          Object Loc2 = new com.sun.star.lang.Locale("de","DE","");
121cdf0e10cSrcweir 
122cdf0e10cSrcweir          if (oldValue.equals(Loc1)) newValue = Loc2;
123cdf0e10cSrcweir                              else newValue = Loc1;
124cdf0e10cSrcweir    } else
125cdf0e10cSrcweir 
126cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.style.ParagraphAdjust) {
127cdf0e10cSrcweir          Object PA1 = com.sun.star.style.ParagraphAdjust.LEFT;
128cdf0e10cSrcweir          Object PA2 = com.sun.star.style.ParagraphAdjust.CENTER;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir          if (oldValue.equals(PA1)) newValue = PA2;
131cdf0e10cSrcweir                              else newValue = PA1;
132cdf0e10cSrcweir    } else
133cdf0e10cSrcweir 
134cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.style.LineSpacing) {
135cdf0e10cSrcweir          com.sun.star.style.LineSpacing LS = new com.sun.star.style.LineSpacing();
136cdf0e10cSrcweir          com.sun.star.style.LineSpacing LSold = (com.sun.star.style.LineSpacing) oldValue;
137cdf0e10cSrcweir          LS.Height = (short) ((LSold.Height)+1);
138cdf0e10cSrcweir          LS.Mode = (short) ((LSold.Mode)+1);
139cdf0e10cSrcweir          newValue = LS;
140cdf0e10cSrcweir    } else
141cdf0e10cSrcweir 
142cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.drawing.Direction3D) {
143cdf0e10cSrcweir          com.sun.star.drawing.Direction3D D3D = new com.sun.star.drawing.Direction3D();
144cdf0e10cSrcweir          com.sun.star.drawing.Direction3D D3Dold = (com.sun.star.drawing.Direction3D) oldValue;
145cdf0e10cSrcweir          D3D.DirectionX = D3Dold.DirectionX + .5;
146cdf0e10cSrcweir          D3D.DirectionY = D3Dold.DirectionY + .5;
147cdf0e10cSrcweir          D3D.DirectionZ = D3Dold.DirectionZ + .5;
148cdf0e10cSrcweir          newValue = D3D;
149cdf0e10cSrcweir    } else
150cdf0e10cSrcweir 
151cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.style.GraphicLocation) {
152cdf0e10cSrcweir          Object GL1 = com.sun.star.style.GraphicLocation.AREA;
153cdf0e10cSrcweir          Object GL2 = com.sun.star.style.GraphicLocation.LEFT_BOTTOM;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir          if (oldValue.equals(GL1)) newValue = GL2;
156cdf0e10cSrcweir                              else newValue = GL1;
157cdf0e10cSrcweir    } else
158cdf0e10cSrcweir 
159cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.style.TabStop) {
160cdf0e10cSrcweir          com.sun.star.style.TabStop TS = new com.sun.star.style.TabStop();
161cdf0e10cSrcweir          com.sun.star.style.TabStop TSold = (com.sun.star.style.TabStop) oldValue;
162cdf0e10cSrcweir          com.sun.star.style.TabAlign TA1 = com.sun.star.style.TabAlign.CENTER;
163cdf0e10cSrcweir          com.sun.star.style.TabAlign TA2 = com.sun.star.style.TabAlign.RIGHT;
164cdf0e10cSrcweir 
165cdf0e10cSrcweir          if ((TSold.Alignment).equals(TA1)) TS.Alignment = TA2;
166cdf0e10cSrcweir                              else TS.Alignment = TA1;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir          TS.Position = ((TSold.Position)+1);
169cdf0e10cSrcweir 
170cdf0e10cSrcweir          newValue = TS;
171cdf0e10cSrcweir    } else
172cdf0e10cSrcweir 
173cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.style.DropCapFormat) {
174cdf0e10cSrcweir          com.sun.star.style.DropCapFormat DCF = new com.sun.star.style.DropCapFormat();
175cdf0e10cSrcweir          com.sun.star.style.DropCapFormat DCFold = (com.sun.star.style.DropCapFormat) oldValue;
176cdf0e10cSrcweir          DCF.Count = (byte) ((DCFold.Count)+1);
177cdf0e10cSrcweir          DCF.Distance = (short) ((DCFold.Distance)+1);
178cdf0e10cSrcweir          DCF.Lines = (byte) ((DCFold.Lines)+1);
179cdf0e10cSrcweir          newValue = DCF;
180cdf0e10cSrcweir    } else
181cdf0e10cSrcweir 
182cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.text.TextContentAnchorType) {
183cdf0e10cSrcweir          com.sun.star.text.TextContentAnchorType TCAT1 = com.sun.star.text.TextContentAnchorType.AS_CHARACTER;
184cdf0e10cSrcweir          com.sun.star.text.TextContentAnchorType TCAT2 = com.sun.star.text.TextContentAnchorType.AT_CHARACTER;
185cdf0e10cSrcweir          com.sun.star.text.TextContentAnchorType TCAT3 = com.sun.star.text.TextContentAnchorType.AT_FRAME;
186cdf0e10cSrcweir          com.sun.star.text.TextContentAnchorType TCAT4 = com.sun.star.text.TextContentAnchorType.AT_PAGE;
187cdf0e10cSrcweir          com.sun.star.text.TextContentAnchorType TCAT5 = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH;
188cdf0e10cSrcweir          if (oldValue.equals(TCAT1)) newValue = TCAT2;
189cdf0e10cSrcweir          if (oldValue.equals(TCAT2)) newValue = TCAT3;
190cdf0e10cSrcweir          if (oldValue.equals(TCAT3)) newValue = TCAT4;
191cdf0e10cSrcweir          if (oldValue.equals(TCAT4)) newValue = TCAT5;
192cdf0e10cSrcweir          if (oldValue.equals(TCAT5)) newValue = TCAT1;
193cdf0e10cSrcweir    } else
194cdf0e10cSrcweir 
195cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.text.WrapTextMode) {
196cdf0e10cSrcweir          com.sun.star.text.WrapTextMode WTM1 = com.sun.star.text.WrapTextMode.DYNAMIC;
197cdf0e10cSrcweir          com.sun.star.text.WrapTextMode WTM2 = com.sun.star.text.WrapTextMode.LEFT;
198cdf0e10cSrcweir          com.sun.star.text.WrapTextMode WTM3 = com.sun.star.text.WrapTextMode.NONE;
199cdf0e10cSrcweir          com.sun.star.text.WrapTextMode WTM4 = com.sun.star.text.WrapTextMode.PARALLEL;
200cdf0e10cSrcweir          com.sun.star.text.WrapTextMode WTM5 = com.sun.star.text.WrapTextMode.RIGHT;
201cdf0e10cSrcweir          com.sun.star.text.WrapTextMode WTM6 = com.sun.star.text.WrapTextMode.THROUGHT;
202cdf0e10cSrcweir          if (oldValue.equals(WTM1)) newValue = WTM2;
203cdf0e10cSrcweir          if (oldValue.equals(WTM2)) newValue = WTM3;
204cdf0e10cSrcweir          if (oldValue.equals(WTM3)) newValue = WTM4;
205cdf0e10cSrcweir          if (oldValue.equals(WTM4)) newValue = WTM5;
206cdf0e10cSrcweir          if (oldValue.equals(WTM5)) newValue = WTM6;
207cdf0e10cSrcweir          if (oldValue.equals(WTM6)) newValue = WTM1;
208cdf0e10cSrcweir    } else
209cdf0e10cSrcweir 
210cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.awt.Size) {
211cdf0e10cSrcweir          com.sun.star.awt.Size oldSize = (com.sun.star.awt.Size) oldValue;
212cdf0e10cSrcweir          com.sun.star.awt.Size newSize = new com.sun.star.awt.Size();
213cdf0e10cSrcweir          newSize.Height = oldSize.Height +1;
214cdf0e10cSrcweir          newSize.Width = oldSize.Width +1;
215cdf0e10cSrcweir          newValue = newSize;
216cdf0e10cSrcweir    } else
217cdf0e10cSrcweir 
218cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.awt.Rectangle) {
219cdf0e10cSrcweir          com.sun.star.awt.Rectangle oldRectangle = (com.sun.star.awt.Rectangle) oldValue;
220cdf0e10cSrcweir          com.sun.star.awt.Rectangle newRectangle = new com.sun.star.awt.Rectangle();
221cdf0e10cSrcweir          newRectangle.Height =oldRectangle.Height +1;
222cdf0e10cSrcweir          newRectangle.Width = oldRectangle.Width +1;
223cdf0e10cSrcweir          newRectangle.X =oldRectangle.Y +1;
224cdf0e10cSrcweir          newRectangle.Y = oldRectangle.X +1;
225cdf0e10cSrcweir          newValue = newRectangle;
226cdf0e10cSrcweir    } else
227cdf0e10cSrcweir 
228cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.awt.Point) {
229cdf0e10cSrcweir          com.sun.star.awt.Point oldPoint = (com.sun.star.awt.Point) oldValue;
230cdf0e10cSrcweir          com.sun.star.awt.Point newPoint = new com.sun.star.awt.Point();
231cdf0e10cSrcweir          newPoint.X = oldPoint.X +1;
232cdf0e10cSrcweir          newPoint.Y = oldPoint.Y +1;
233cdf0e10cSrcweir          newValue = newPoint;
234cdf0e10cSrcweir    } else
235cdf0e10cSrcweir 
236cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.table.ShadowFormat) {
237cdf0e10cSrcweir          com.sun.star.table.ShadowFormat SF = new com.sun.star.table.ShadowFormat();
238cdf0e10cSrcweir          com.sun.star.table.ShadowFormat SFold = (com.sun.star.table.ShadowFormat) oldValue;
239cdf0e10cSrcweir          SF.IsTransparent = (! SFold.IsTransparent);
240cdf0e10cSrcweir          SF.ShadowWidth = (short) ((SFold.ShadowWidth)+1);
241cdf0e10cSrcweir          newValue = SF;
242cdf0e10cSrcweir    } else
243cdf0e10cSrcweir 
244cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.awt.FontSlant) {
245cdf0e10cSrcweir          com.sun.star.awt.FontSlant FS1 = com.sun.star.awt.FontSlant.DONTKNOW;
246cdf0e10cSrcweir          com.sun.star.awt.FontSlant FS2 = com.sun.star.awt.FontSlant.ITALIC;
247cdf0e10cSrcweir          com.sun.star.awt.FontSlant FS3 = com.sun.star.awt.FontSlant.NONE;
248cdf0e10cSrcweir          com.sun.star.awt.FontSlant FS4 = com.sun.star.awt.FontSlant.OBLIQUE;
249cdf0e10cSrcweir          com.sun.star.awt.FontSlant FS5 = com.sun.star.awt.FontSlant.REVERSE_ITALIC;
250cdf0e10cSrcweir          com.sun.star.awt.FontSlant FS6 = com.sun.star.awt.FontSlant.REVERSE_OBLIQUE;
251cdf0e10cSrcweir          if (oldValue.equals(FS1)) newValue = FS2;
252cdf0e10cSrcweir          if (oldValue.equals(FS2)) newValue = FS3;
253cdf0e10cSrcweir          if (oldValue.equals(FS3)) newValue = FS4;
254cdf0e10cSrcweir          if (oldValue.equals(FS4)) newValue = FS5;
255cdf0e10cSrcweir          if (oldValue.equals(FS5)) newValue = FS6;
256cdf0e10cSrcweir          if (oldValue.equals(FS6)) newValue = FS1;
257cdf0e10cSrcweir    } else
258cdf0e10cSrcweir 
259cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.table.CellHoriJustify) {
260cdf0e10cSrcweir          com.sun.star.table.CellHoriJustify CHJ1 = com.sun.star.table.CellHoriJustify.BLOCK;
261cdf0e10cSrcweir          com.sun.star.table.CellHoriJustify CHJ2 = com.sun.star.table.CellHoriJustify.CENTER;
262cdf0e10cSrcweir          com.sun.star.table.CellHoriJustify CHJ3 = com.sun.star.table.CellHoriJustify.LEFT;
263cdf0e10cSrcweir          com.sun.star.table.CellHoriJustify CHJ4 = com.sun.star.table.CellHoriJustify.REPEAT;
264cdf0e10cSrcweir          com.sun.star.table.CellHoriJustify CHJ5 = com.sun.star.table.CellHoriJustify.RIGHT;
265cdf0e10cSrcweir          com.sun.star.table.CellHoriJustify CHJ6 = com.sun.star.table.CellHoriJustify.STANDARD;
266cdf0e10cSrcweir          if (oldValue.equals(CHJ1)) newValue = CHJ2;
267cdf0e10cSrcweir          if (oldValue.equals(CHJ2)) newValue = CHJ3;
268cdf0e10cSrcweir          if (oldValue.equals(CHJ3)) newValue = CHJ4;
269cdf0e10cSrcweir          if (oldValue.equals(CHJ4)) newValue = CHJ5;
270cdf0e10cSrcweir          if (oldValue.equals(CHJ5)) newValue = CHJ6;
271cdf0e10cSrcweir          if (oldValue.equals(CHJ6)) newValue = CHJ1;
272cdf0e10cSrcweir    } else
273cdf0e10cSrcweir 
274cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.table.CellVertJustify) {
275cdf0e10cSrcweir          com.sun.star.table.CellVertJustify CVJ1 = com.sun.star.table.CellVertJustify.BOTTOM;
276cdf0e10cSrcweir          com.sun.star.table.CellVertJustify CVJ2 = com.sun.star.table.CellVertJustify.CENTER;
277cdf0e10cSrcweir          com.sun.star.table.CellVertJustify CVJ3 = com.sun.star.table.CellVertJustify.STANDARD;
278cdf0e10cSrcweir          com.sun.star.table.CellVertJustify CVJ4 = com.sun.star.table.CellVertJustify.TOP;
279cdf0e10cSrcweir          if (oldValue.equals(CVJ1)) newValue = CVJ2;
280cdf0e10cSrcweir          if (oldValue.equals(CVJ2)) newValue = CVJ3;
281cdf0e10cSrcweir          if (oldValue.equals(CVJ3)) newValue = CVJ4;
282cdf0e10cSrcweir          if (oldValue.equals(CVJ4)) newValue = CVJ1;
283cdf0e10cSrcweir    } else
284cdf0e10cSrcweir 
285cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.table.CellOrientation) {
286cdf0e10cSrcweir          com.sun.star.table.CellOrientation CO1 = com.sun.star.table.CellOrientation.BOTTOMTOP;
287cdf0e10cSrcweir          com.sun.star.table.CellOrientation CO2 = com.sun.star.table.CellOrientation.STACKED;
288cdf0e10cSrcweir          com.sun.star.table.CellOrientation CO3 = com.sun.star.table.CellOrientation.STANDARD;
289cdf0e10cSrcweir          com.sun.star.table.CellOrientation CO4 = com.sun.star.table.CellOrientation.TOPBOTTOM;
290cdf0e10cSrcweir          if (oldValue.equals(CO1)) newValue = CO2;
291cdf0e10cSrcweir          if (oldValue.equals(CO2)) newValue = CO3;
292cdf0e10cSrcweir          if (oldValue.equals(CO3)) newValue = CO4;
293cdf0e10cSrcweir          if (oldValue.equals(CO4)) newValue = CO1;
294cdf0e10cSrcweir    } else
295cdf0e10cSrcweir 
296cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.util.CellProtection) {
297cdf0e10cSrcweir          com.sun.star.util.CellProtection CP = new com.sun.star.util.CellProtection();
298cdf0e10cSrcweir          com.sun.star.util.CellProtection CPold = (com.sun.star.util.CellProtection) oldValue;
299cdf0e10cSrcweir          CP.IsFormulaHidden = (! CPold.IsFormulaHidden);
300cdf0e10cSrcweir          CP.IsHidden = (! CPold.IsHidden);
301cdf0e10cSrcweir          CP.IsLocked = (! CPold.IsLocked);
302cdf0e10cSrcweir          CP.IsPrintHidden = (! CPold.IsPrintHidden);
303cdf0e10cSrcweir          newValue = CP;
304cdf0e10cSrcweir    } else
305cdf0e10cSrcweir 
306cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.table.TableBorder) {
307cdf0e10cSrcweir          com.sun.star.table.TableBorder TBold = (com.sun.star.table.TableBorder) oldValue;
308cdf0e10cSrcweir          com.sun.star.table.TableBorder TB = new com.sun.star.table.TableBorder();
309cdf0e10cSrcweir          TB.IsBottomLineValid = (! TBold.IsBottomLineValid);
310cdf0e10cSrcweir          TB.IsDistanceValid = (! TBold.IsDistanceValid);
311cdf0e10cSrcweir          TB.IsRightLineValid = (! TBold.IsRightLineValid);
312cdf0e10cSrcweir          TB.IsTopLineValid = (! TBold.IsTopLineValid);
313cdf0e10cSrcweir          newValue = TB;
314cdf0e10cSrcweir    } else
315cdf0e10cSrcweir /*
316cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.awt.XBitmap) {
317cdf0e10cSrcweir         newValue = new BitmapLoader();
318cdf0e10cSrcweir    }
319cdf0e10cSrcweir */
320cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.drawing.FillStyle) {
321cdf0e10cSrcweir          com.sun.star.drawing.FillStyle FS1 = com.sun.star.drawing.FillStyle.NONE;
322cdf0e10cSrcweir          com.sun.star.drawing.FillStyle FS2 = com.sun.star.drawing.FillStyle.SOLID;
323cdf0e10cSrcweir          com.sun.star.drawing.FillStyle FS3 = com.sun.star.drawing.FillStyle.GRADIENT;
324cdf0e10cSrcweir          com.sun.star.drawing.FillStyle FS4 = com.sun.star.drawing.FillStyle.HATCH;
325cdf0e10cSrcweir          com.sun.star.drawing.FillStyle FS5 = com.sun.star.drawing.FillStyle.BITMAP;
326cdf0e10cSrcweir          if (oldValue.equals(FS1)) newValue = FS2;
327cdf0e10cSrcweir          if (oldValue.equals(FS2)) newValue = FS3;
328cdf0e10cSrcweir          if (oldValue.equals(FS3)) newValue = FS4;
329cdf0e10cSrcweir          if (oldValue.equals(FS4)) newValue = FS5;
330cdf0e10cSrcweir          if (oldValue.equals(FS5)) newValue = FS1;
331cdf0e10cSrcweir    } else
332cdf0e10cSrcweir 
333cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.awt.Gradient){
334cdf0e10cSrcweir         com.sun.star.awt.Gradient _newValue = (com.sun.star.awt.Gradient)oldValue;
335cdf0e10cSrcweir         _newValue.Angle += 10;
336cdf0e10cSrcweir         _newValue.Border += 1;
337cdf0e10cSrcweir         _newValue.EndColor += 1000;
338cdf0e10cSrcweir         _newValue.EndIntensity -= 10;
339cdf0e10cSrcweir         _newValue.StartColor += 500;
340cdf0e10cSrcweir         _newValue.StartIntensity += 10;
341cdf0e10cSrcweir         _newValue.StepCount += 50;
342cdf0e10cSrcweir         _newValue.Style = com.sun.star.awt.GradientStyle.RADIAL;
343cdf0e10cSrcweir         _newValue.XOffset += 10;
344cdf0e10cSrcweir         _newValue.YOffset += 10;
345cdf0e10cSrcweir         newValue = _newValue;
346cdf0e10cSrcweir    } else
347cdf0e10cSrcweir 
348cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.text.GraphicCrop){
349cdf0e10cSrcweir         com.sun.star.text.GraphicCrop _newValue = (com.sun.star.text.GraphicCrop)oldValue;
350cdf0e10cSrcweir         _newValue.Bottom += 10;
351cdf0e10cSrcweir         _newValue.Left += 10;
352cdf0e10cSrcweir         _newValue.Right += 10;
353cdf0e10cSrcweir         _newValue.Top += 10;
354cdf0e10cSrcweir         newValue = _newValue;
355cdf0e10cSrcweir    } else
356cdf0e10cSrcweir 
357cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.drawing.BitmapMode){
358cdf0e10cSrcweir         com.sun.star.drawing.BitmapMode bm1 = com.sun.star.drawing.BitmapMode.NO_REPEAT;
359cdf0e10cSrcweir         com.sun.star.drawing.BitmapMode bm2 = com.sun.star.drawing.BitmapMode.REPEAT;
360cdf0e10cSrcweir         com.sun.star.drawing.BitmapMode bm3 = com.sun.star.drawing.BitmapMode.STRETCH;
361cdf0e10cSrcweir          if (oldValue.equals(bm1)) newValue = bm2;
362cdf0e10cSrcweir          if (oldValue.equals(bm2)) newValue = bm3;
363cdf0e10cSrcweir          if (oldValue.equals(bm3)) newValue = bm3;
364cdf0e10cSrcweir    } else
365cdf0e10cSrcweir 
366cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.drawing.TextAdjust){
367cdf0e10cSrcweir         com.sun.star.drawing.TextAdjust TA1 = com.sun.star.drawing.TextAdjust.BLOCK;
368cdf0e10cSrcweir         com.sun.star.drawing.TextAdjust TA2 = com.sun.star.drawing.TextAdjust.CENTER;
369cdf0e10cSrcweir         com.sun.star.drawing.TextAdjust TA3 = com.sun.star.drawing.TextAdjust.LEFT;
370cdf0e10cSrcweir         com.sun.star.drawing.TextAdjust TA4 = com.sun.star.drawing.TextAdjust.RIGHT;
371cdf0e10cSrcweir         com.sun.star.drawing.TextAdjust TA5 = com.sun.star.drawing.TextAdjust.STRETCH;
372cdf0e10cSrcweir         if (oldValue.equals(TA1)) newValue = TA2;
373cdf0e10cSrcweir         if (oldValue.equals(TA2)) newValue = TA3;
374cdf0e10cSrcweir         if (oldValue.equals(TA3)) newValue = TA4;
375cdf0e10cSrcweir         if (oldValue.equals(TA4)) newValue = TA5;
376cdf0e10cSrcweir         if (oldValue.equals(TA5)) newValue = TA1;
377cdf0e10cSrcweir    } else
378cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.TextFitToSizeType){
379cdf0e10cSrcweir         com.sun.star.drawing.TextFitToSizeType TF1 = com.sun.star.drawing.TextFitToSizeType.ALLLINES;
380cdf0e10cSrcweir         com.sun.star.drawing.TextFitToSizeType TF2 = com.sun.star.drawing.TextFitToSizeType.NONE;
381cdf0e10cSrcweir         com.sun.star.drawing.TextFitToSizeType TF3 = com.sun.star.drawing.TextFitToSizeType.PROPORTIONAL;
382cdf0e10cSrcweir         com.sun.star.drawing.TextFitToSizeType TF4 = com.sun.star.drawing.TextFitToSizeType.RESIZEATTR;
383cdf0e10cSrcweir         if (oldValue.equals(TF1)) newValue = TF2;
384cdf0e10cSrcweir         if (oldValue.equals(TF2)) newValue = TF3;
385cdf0e10cSrcweir         if (oldValue.equals(TF3)) newValue = TF4;
386cdf0e10cSrcweir         if (oldValue.equals(TF4)) newValue = TF1;
387cdf0e10cSrcweir     } else
388cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.TextAnimationKind){
389cdf0e10cSrcweir         com.sun.star.drawing.TextAnimationKind AK1 = com.sun.star.drawing.TextAnimationKind.NONE;
390cdf0e10cSrcweir         com.sun.star.drawing.TextAnimationKind AK2 = com.sun.star.drawing.TextAnimationKind.SLIDE;
391cdf0e10cSrcweir         com.sun.star.drawing.TextAnimationKind AK3 = com.sun.star.drawing.TextAnimationKind.SCROLL;
392cdf0e10cSrcweir         com.sun.star.drawing.TextAnimationKind AK4 = com.sun.star.drawing.TextAnimationKind.BLINK;
393cdf0e10cSrcweir         com.sun.star.drawing.TextAnimationKind AK5 = com.sun.star.drawing.TextAnimationKind.ALTERNATE;
394cdf0e10cSrcweir 
395cdf0e10cSrcweir         if (oldValue.equals(AK1)) newValue = AK2;
396cdf0e10cSrcweir         if (oldValue.equals(AK2)) newValue = AK3;
397cdf0e10cSrcweir         if (oldValue.equals(AK3)) newValue = AK4;
398cdf0e10cSrcweir         if (oldValue.equals(AK4)) newValue = AK5;
399cdf0e10cSrcweir         if (oldValue.equals(AK5)) newValue = AK1;
400cdf0e10cSrcweir     } else
401cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.TextAnimationDirection){
402cdf0e10cSrcweir         com.sun.star.drawing.TextAnimationDirection AD1 = com.sun.star.drawing.TextAnimationDirection.LEFT;
403cdf0e10cSrcweir         com.sun.star.drawing.TextAnimationDirection AD2 = com.sun.star.drawing.TextAnimationDirection.RIGHT;
404cdf0e10cSrcweir         com.sun.star.drawing.TextAnimationDirection AD3 = com.sun.star.drawing.TextAnimationDirection.DOWN;
405cdf0e10cSrcweir         com.sun.star.drawing.TextAnimationDirection AD4 = com.sun.star.drawing.TextAnimationDirection.UP;
406cdf0e10cSrcweir         if (oldValue.equals(AD1)) newValue = AD2;
407cdf0e10cSrcweir         if (oldValue.equals(AD2)) newValue = AD3;
408cdf0e10cSrcweir         if (oldValue.equals(AD3)) newValue = AD4;
409cdf0e10cSrcweir         if (oldValue.equals(AD4)) newValue = AD1;
410cdf0e10cSrcweir     } else
411cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.LineStyle){
412cdf0e10cSrcweir         com.sun.star.drawing.LineStyle LS1 = com.sun.star.drawing.LineStyle.NONE;
413cdf0e10cSrcweir         com.sun.star.drawing.LineStyle LS2 = com.sun.star.drawing.LineStyle.DASH;
414cdf0e10cSrcweir         com.sun.star.drawing.LineStyle LS3 = com.sun.star.drawing.LineStyle.SOLID;
415cdf0e10cSrcweir         if (oldValue.equals(LS1)) newValue = LS2;
416cdf0e10cSrcweir         if (oldValue.equals(LS2)) newValue = LS3;
417cdf0e10cSrcweir         if (oldValue.equals(LS3)) newValue = LS1;
418cdf0e10cSrcweir     } else
419cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.LineJoint){
420cdf0e10cSrcweir         com.sun.star.drawing.LineJoint LJ1 = com.sun.star.drawing.LineJoint.BEVEL;
421cdf0e10cSrcweir         com.sun.star.drawing.LineJoint LJ2 = com.sun.star.drawing.LineJoint.MIDDLE;
422cdf0e10cSrcweir         com.sun.star.drawing.LineJoint LJ3 = com.sun.star.drawing.LineJoint.MITER;
423cdf0e10cSrcweir         com.sun.star.drawing.LineJoint LJ4 = com.sun.star.drawing.LineJoint.NONE;
424cdf0e10cSrcweir         com.sun.star.drawing.LineJoint LJ5 = com.sun.star.drawing.LineJoint.ROUND;
425cdf0e10cSrcweir         if (oldValue.equals(LJ1)) newValue = LJ2;
426cdf0e10cSrcweir         if (oldValue.equals(LJ2)) newValue = LJ3;
427cdf0e10cSrcweir         if (oldValue.equals(LJ3)) newValue = LJ4;
428cdf0e10cSrcweir         if (oldValue.equals(LJ4)) newValue = LJ5;
429cdf0e10cSrcweir         if (oldValue.equals(LJ5)) newValue = LJ1;
430cdf0e10cSrcweir     } else
431cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.LineDash){
432cdf0e10cSrcweir         com.sun.star.drawing.LineDash _newValue = (com.sun.star.drawing.LineDash)oldValue;
433cdf0e10cSrcweir         _newValue.Dashes += 1;
434cdf0e10cSrcweir         _newValue.DashLen += 10;
435cdf0e10cSrcweir         _newValue.Distance += 20;
436cdf0e10cSrcweir         _newValue.DotLen += 10;
437cdf0e10cSrcweir         _newValue.Dots += 10;
438cdf0e10cSrcweir         _newValue.Style = com.sun.star.drawing.DashStyle.RECT;
439cdf0e10cSrcweir         newValue = _newValue;
440cdf0e10cSrcweir     } else
441cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.Hatch){
442cdf0e10cSrcweir         com.sun.star.drawing.Hatch _newValue = (com.sun.star.drawing.Hatch) oldValue;
443cdf0e10cSrcweir         _newValue.Angle += 10;
444cdf0e10cSrcweir         _newValue.Color += 1000;
445cdf0e10cSrcweir         _newValue.Distance += 10;
446cdf0e10cSrcweir         _newValue.Style = com.sun.star.drawing.HatchStyle.DOUBLE;
447cdf0e10cSrcweir     } else
448cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.RectanglePoint){
449cdf0e10cSrcweir         com.sun.star.drawing.RectanglePoint RP1 = com.sun.star.drawing.RectanglePoint.LEFT_BOTTOM;
450cdf0e10cSrcweir         com.sun.star.drawing.RectanglePoint RP2 = com.sun.star.drawing.RectanglePoint.LEFT_MIDDLE;
451cdf0e10cSrcweir         com.sun.star.drawing.RectanglePoint RP3 = com.sun.star.drawing.RectanglePoint.LEFT_TOP;
452cdf0e10cSrcweir         com.sun.star.drawing.RectanglePoint RP4 = com.sun.star.drawing.RectanglePoint.MIDDLE_BOTTOM;
453cdf0e10cSrcweir         com.sun.star.drawing.RectanglePoint RP5 = com.sun.star.drawing.RectanglePoint.MIDDLE_MIDDLE;
454cdf0e10cSrcweir         com.sun.star.drawing.RectanglePoint RP6 = com.sun.star.drawing.RectanglePoint.MIDDLE_TOP;
455cdf0e10cSrcweir         com.sun.star.drawing.RectanglePoint RP7 = com.sun.star.drawing.RectanglePoint.RIGHT_BOTTOM;
456cdf0e10cSrcweir         com.sun.star.drawing.RectanglePoint RP8 = com.sun.star.drawing.RectanglePoint.RIGHT_MIDDLE;
457cdf0e10cSrcweir         com.sun.star.drawing.RectanglePoint RP9 = com.sun.star.drawing.RectanglePoint.RIGHT_TOP;
458cdf0e10cSrcweir 
459cdf0e10cSrcweir         if (oldValue.equals(RP1)) newValue = RP2;
460cdf0e10cSrcweir         if (oldValue.equals(RP2)) newValue = RP3;
461cdf0e10cSrcweir         if (oldValue.equals(RP3)) newValue = RP4;
462cdf0e10cSrcweir         if (oldValue.equals(RP4)) newValue = RP5;
463cdf0e10cSrcweir         if (oldValue.equals(RP5)) newValue = RP6;
464cdf0e10cSrcweir         if (oldValue.equals(RP6)) newValue = RP7;
465cdf0e10cSrcweir         if (oldValue.equals(RP7)) newValue = RP8;
466cdf0e10cSrcweir         if (oldValue.equals(RP8)) newValue = RP9;
467cdf0e10cSrcweir         if (oldValue.equals(RP9)) newValue = RP1;
468cdf0e10cSrcweir 
469cdf0e10cSrcweir     } else
470cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.chart.ChartErrorCategory){
471cdf0e10cSrcweir         com.sun.star.chart.ChartErrorCategory CC1 = com.sun.star.chart.ChartErrorCategory.CONSTANT_VALUE;
472cdf0e10cSrcweir         com.sun.star.chart.ChartErrorCategory CC2 = com.sun.star.chart.ChartErrorCategory.ERROR_MARGIN;
473cdf0e10cSrcweir         com.sun.star.chart.ChartErrorCategory CC3 = com.sun.star.chart.ChartErrorCategory.NONE;
474cdf0e10cSrcweir         com.sun.star.chart.ChartErrorCategory CC4 = com.sun.star.chart.ChartErrorCategory.PERCENT;
475cdf0e10cSrcweir         com.sun.star.chart.ChartErrorCategory CC5 = com.sun.star.chart.ChartErrorCategory.STANDARD_DEVIATION;
476cdf0e10cSrcweir         com.sun.star.chart.ChartErrorCategory CC6 = com.sun.star.chart.ChartErrorCategory.VARIANCE;
477cdf0e10cSrcweir         if (oldValue.equals(CC1)) newValue = CC2;
478cdf0e10cSrcweir         if (oldValue.equals(CC2)) newValue = CC3;
479cdf0e10cSrcweir         if (oldValue.equals(CC3)) newValue = CC4;
480cdf0e10cSrcweir         if (oldValue.equals(CC4)) newValue = CC5;
481cdf0e10cSrcweir         if (oldValue.equals(CC5)) newValue = CC6;
482cdf0e10cSrcweir         if (oldValue.equals(CC6)) newValue = CC1;
483cdf0e10cSrcweir     } else
484cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.chart.ChartErrorIndicatorType){
485cdf0e10cSrcweir         com.sun.star.chart.ChartErrorIndicatorType IT1 = com.sun.star.chart.ChartErrorIndicatorType.LOWER;
486cdf0e10cSrcweir         com.sun.star.chart.ChartErrorIndicatorType IT2 = com.sun.star.chart.ChartErrorIndicatorType.NONE;
487cdf0e10cSrcweir         com.sun.star.chart.ChartErrorIndicatorType IT3 = com.sun.star.chart.ChartErrorIndicatorType.TOP_AND_BOTTOM;
488cdf0e10cSrcweir         com.sun.star.chart.ChartErrorIndicatorType IT4 = com.sun.star.chart.ChartErrorIndicatorType.UPPER;
489cdf0e10cSrcweir         if (oldValue.equals(IT1)) newValue = IT2;
490cdf0e10cSrcweir         if (oldValue.equals(IT2)) newValue = IT3;
491cdf0e10cSrcweir         if (oldValue.equals(IT3)) newValue = IT4;
492cdf0e10cSrcweir         if (oldValue.equals(IT4)) newValue = IT1;
493cdf0e10cSrcweir     } else
494cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.chart.ChartRegressionCurveType){
495cdf0e10cSrcweir         com.sun.star.chart.ChartRegressionCurveType CT1 = com.sun.star.chart.ChartRegressionCurveType.EXPONENTIAL;
496cdf0e10cSrcweir         com.sun.star.chart.ChartRegressionCurveType CT2 = com.sun.star.chart.ChartRegressionCurveType.LINEAR;
497cdf0e10cSrcweir         com.sun.star.chart.ChartRegressionCurveType CT3 = com.sun.star.chart.ChartRegressionCurveType.LOGARITHM;
498cdf0e10cSrcweir         com.sun.star.chart.ChartRegressionCurveType CT4 = com.sun.star.chart.ChartRegressionCurveType.NONE;
499cdf0e10cSrcweir         com.sun.star.chart.ChartRegressionCurveType CT5 = com.sun.star.chart.ChartRegressionCurveType.POLYNOMIAL;
500cdf0e10cSrcweir         com.sun.star.chart.ChartRegressionCurveType CT6 = com.sun.star.chart.ChartRegressionCurveType.POWER;
501cdf0e10cSrcweir         if (oldValue.equals(CT1)) newValue = CT2;
502cdf0e10cSrcweir         if (oldValue.equals(CT2)) newValue = CT3;
503cdf0e10cSrcweir         if (oldValue.equals(CT3)) newValue = CT4;
504cdf0e10cSrcweir         if (oldValue.equals(CT4)) newValue = CT5;
505cdf0e10cSrcweir         if (oldValue.equals(CT5)) newValue = CT6;
506cdf0e10cSrcweir         if (oldValue.equals(CT6)) newValue = CT1;
507cdf0e10cSrcweir 
508cdf0e10cSrcweir     } else
509cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.chart.ChartDataRowSource){
510cdf0e10cSrcweir         com.sun.star.chart.ChartDataRowSource RS1 = com.sun.star.chart.ChartDataRowSource.COLUMNS;
511cdf0e10cSrcweir         com.sun.star.chart.ChartDataRowSource RS2 = com.sun.star.chart.ChartDataRowSource.ROWS;
512cdf0e10cSrcweir         if (oldValue.equals(RS1)) newValue = RS2;
513cdf0e10cSrcweir         if (oldValue.equals(RS2)) newValue = RS1;
514cdf0e10cSrcweir     } else
515cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.awt.FontDescriptor){
516cdf0e10cSrcweir         com.sun.star.awt.FontDescriptor _newValue = (com.sun.star.awt.FontDescriptor)oldValue;
517cdf0e10cSrcweir         _newValue.CharacterWidth += 5;
518cdf0e10cSrcweir         _newValue.CharSet = com.sun.star.awt.CharSet.ANSI;
519cdf0e10cSrcweir         _newValue.Family = com.sun.star.awt.FontFamily.DECORATIVE;
520cdf0e10cSrcweir         _newValue.Height += 2;
521cdf0e10cSrcweir         _newValue.Kerning = !_newValue.Kerning;
522cdf0e10cSrcweir         _newValue.Name = "Courier";
523cdf0e10cSrcweir         _newValue.Orientation += 45;
524cdf0e10cSrcweir         _newValue.Pitch = com.sun.star.awt.FontPitch.VARIABLE;
525cdf0e10cSrcweir         _newValue.Slant = com.sun.star.awt.FontSlant.REVERSE_ITALIC;
526cdf0e10cSrcweir         _newValue.Strikeout = com.sun.star.awt.FontStrikeout.X;
527cdf0e10cSrcweir         _newValue.StyleName = "Bold";
528cdf0e10cSrcweir         _newValue.Type = com.sun.star.awt.FontType.SCALABLE;
529cdf0e10cSrcweir         _newValue.Underline = com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT;
530cdf0e10cSrcweir         _newValue.Weight += 5;
531cdf0e10cSrcweir         _newValue.Width += 6;
532cdf0e10cSrcweir         _newValue.WordLineMode = !_newValue.WordLineMode;
533cdf0e10cSrcweir 
534cdf0e10cSrcweir         newValue = _newValue;
535cdf0e10cSrcweir     } else
536cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.form.NavigationBarMode){
537cdf0e10cSrcweir         com.sun.star.form.NavigationBarMode BM1 = com.sun.star.form.NavigationBarMode.CURRENT;
538cdf0e10cSrcweir         com.sun.star.form.NavigationBarMode BM2 = com.sun.star.form.NavigationBarMode.NONE;
539cdf0e10cSrcweir         com.sun.star.form.NavigationBarMode BM3 = com.sun.star.form.NavigationBarMode.PARENT;
540cdf0e10cSrcweir         if (oldValue.equals(BM1)) newValue = BM2;
541cdf0e10cSrcweir         if (oldValue.equals(BM2)) newValue = BM3;
542cdf0e10cSrcweir         if (oldValue.equals(BM3)) newValue = BM1;
543cdf0e10cSrcweir     } else
544cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.form.FormSubmitEncoding){
545cdf0e10cSrcweir         com.sun.star.form.FormSubmitEncoding SE1 = com.sun.star.form.FormSubmitEncoding.MULTIPART;
546cdf0e10cSrcweir         com.sun.star.form.FormSubmitEncoding SE2 = com.sun.star.form.FormSubmitEncoding.TEXT;
547cdf0e10cSrcweir         com.sun.star.form.FormSubmitEncoding SE3 = com.sun.star.form.FormSubmitEncoding.URL;
548cdf0e10cSrcweir         if (oldValue.equals(SE1)) newValue = SE2;
549cdf0e10cSrcweir         if (oldValue.equals(SE2)) newValue = SE3;
550cdf0e10cSrcweir         if (oldValue.equals(SE3)) newValue = SE1;
551cdf0e10cSrcweir     } else
552cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.form.FormSubmitMethod){
553cdf0e10cSrcweir         com.sun.star.form.FormSubmitMethod FM1 = com.sun.star.form.FormSubmitMethod.GET;
554cdf0e10cSrcweir         com.sun.star.form.FormSubmitMethod FM2 = com.sun.star.form.FormSubmitMethod.POST;
555cdf0e10cSrcweir         if (oldValue.equals(FM1)) newValue = FM2;
556cdf0e10cSrcweir         if (oldValue.equals(FM2)) newValue = FM1;
557cdf0e10cSrcweir     } else
558cdf0e10cSrcweir 
559cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.text.SectionFileLink){
560cdf0e10cSrcweir         com.sun.star.text.SectionFileLink _newValue =
561cdf0e10cSrcweir                                     new com.sun.star.text.SectionFileLink();
562cdf0e10cSrcweir 
563cdf0e10cSrcweir         _newValue.FileURL = util.utils.getFullTestURL("SwXTextSection.sdw");
564cdf0e10cSrcweir         newValue=_newValue;
565cdf0e10cSrcweir     } else
566cdf0e10cSrcweir 
567cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.table.BorderLine){
568cdf0e10cSrcweir         com.sun.star.table.BorderLine _newValue = (com.sun.star.table.BorderLine)oldValue;
569cdf0e10cSrcweir     _newValue.Color += 2;
570cdf0e10cSrcweir         _newValue.InnerLineWidth += 2;
571cdf0e10cSrcweir         _newValue.LineDistance += 2;
572cdf0e10cSrcweir         _newValue.OuterLineWidth += 3;
573cdf0e10cSrcweir         newValue=_newValue;
574cdf0e10cSrcweir     } else
575cdf0e10cSrcweir 
576cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.text.XTextColumns){
577cdf0e10cSrcweir         com.sun.star.text.XTextColumns _newValue = (com.sun.star.text.XTextColumns)oldValue;
578cdf0e10cSrcweir     _newValue.setColumnCount((short)1);
579cdf0e10cSrcweir         newValue=_newValue;
580cdf0e10cSrcweir     } else
581cdf0e10cSrcweir 
582cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.form.FormButtonType){
583cdf0e10cSrcweir         com.sun.star.form.FormButtonType BT1 = com.sun.star.form.FormButtonType.PUSH;
584cdf0e10cSrcweir         com.sun.star.form.FormButtonType BT2 = com.sun.star.form.FormButtonType.RESET;
585cdf0e10cSrcweir         com.sun.star.form.FormButtonType BT3 = com.sun.star.form.FormButtonType.SUBMIT;
586cdf0e10cSrcweir         com.sun.star.form.FormButtonType BT4 = com.sun.star.form.FormButtonType.URL;
587cdf0e10cSrcweir 
588cdf0e10cSrcweir         if (oldValue.equals(BT1)) newValue = BT2;
589cdf0e10cSrcweir         if (oldValue.equals(BT2)) newValue = BT3;
590cdf0e10cSrcweir         if (oldValue.equals(BT3)) newValue = BT4;
591cdf0e10cSrcweir         if (oldValue.equals(BT4)) newValue = BT1;
592cdf0e10cSrcweir 
593cdf0e10cSrcweir    } else
594cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.form.ListSourceType){
595cdf0e10cSrcweir         com.sun.star.form.ListSourceType ST1 = com.sun.star.form.ListSourceType.QUERY;
596cdf0e10cSrcweir         com.sun.star.form.ListSourceType ST2 = com.sun.star.form.ListSourceType.SQL;
597cdf0e10cSrcweir         com.sun.star.form.ListSourceType ST3 = com.sun.star.form.ListSourceType.SQLPASSTHROUGH;
598cdf0e10cSrcweir         com.sun.star.form.ListSourceType ST4 = com.sun.star.form.ListSourceType.TABLE;
599cdf0e10cSrcweir         com.sun.star.form.ListSourceType ST5 = com.sun.star.form.ListSourceType.TABLEFIELDS;
600cdf0e10cSrcweir         com.sun.star.form.ListSourceType ST6 = com.sun.star.form.ListSourceType.VALUELIST;
601cdf0e10cSrcweir         if (oldValue.equals(ST1)) newValue = ST2;
602cdf0e10cSrcweir         if (oldValue.equals(ST2)) newValue = ST3;
603cdf0e10cSrcweir         if (oldValue.equals(ST3)) newValue = ST4;
604cdf0e10cSrcweir         if (oldValue.equals(ST4)) newValue = ST5;
605cdf0e10cSrcweir         if (oldValue.equals(ST5)) newValue = ST6;
606cdf0e10cSrcweir         if (oldValue.equals(ST6)) newValue = ST1;
607cdf0e10cSrcweir    } else
608cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.table.BorderLine){
609cdf0e10cSrcweir         com.sun.star.table.BorderLine _newValue = (com.sun.star.table.BorderLine)oldValue;
610cdf0e10cSrcweir         _newValue.Color += 1000;
611cdf0e10cSrcweir         _newValue.InnerLineWidth += 2;
612cdf0e10cSrcweir         _newValue.LineDistance +=3;
613cdf0e10cSrcweir         _newValue.OuterLineWidth += 3;
614cdf0e10cSrcweir         newValue = _newValue;
615cdf0e10cSrcweir    } else
616cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.sheet.DataPilotFieldOrientation) {
617cdf0e10cSrcweir         com.sun.star.sheet.DataPilotFieldOrientation FO1 = com.sun.star.sheet.DataPilotFieldOrientation.PAGE;
618cdf0e10cSrcweir         com.sun.star.sheet.DataPilotFieldOrientation FO2 = com.sun.star.sheet.DataPilotFieldOrientation.COLUMN;
619cdf0e10cSrcweir         com.sun.star.sheet.DataPilotFieldOrientation FO3 = com.sun.star.sheet.DataPilotFieldOrientation.DATA;
620cdf0e10cSrcweir         com.sun.star.sheet.DataPilotFieldOrientation FO4 = com.sun.star.sheet.DataPilotFieldOrientation.HIDDEN;
621cdf0e10cSrcweir         com.sun.star.sheet.DataPilotFieldOrientation FO5 = com.sun.star.sheet.DataPilotFieldOrientation.ROW;
622cdf0e10cSrcweir         if (oldValue.equals(FO1)) newValue = FO2;
623cdf0e10cSrcweir         if (oldValue.equals(FO2)) newValue = FO3;
624cdf0e10cSrcweir         if (oldValue.equals(FO3)) newValue = FO4;
625cdf0e10cSrcweir         if (oldValue.equals(FO4)) newValue = FO5;
626cdf0e10cSrcweir         if (oldValue.equals(FO5)) newValue = FO1;
627cdf0e10cSrcweir    } else
628cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.sheet.GeneralFunction) {
629cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF1 = com.sun.star.sheet.GeneralFunction.NONE;
630cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF2 = com.sun.star.sheet.GeneralFunction.AVERAGE;
631cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF3 = com.sun.star.sheet.GeneralFunction.COUNT;
632cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF4 = com.sun.star.sheet.GeneralFunction.COUNTNUMS;
633cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF5 = com.sun.star.sheet.GeneralFunction.MAX;
634cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF6 = com.sun.star.sheet.GeneralFunction.MIN;
635cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF7 = com.sun.star.sheet.GeneralFunction.AUTO;
636cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF8 = com.sun.star.sheet.GeneralFunction.PRODUCT;
637cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF9 = com.sun.star.sheet.GeneralFunction.STDEV;
638cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF10 = com.sun.star.sheet.GeneralFunction.STDEVP;
639cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF11 = com.sun.star.sheet.GeneralFunction.SUM;
640cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF12 = com.sun.star.sheet.GeneralFunction.VAR;
641cdf0e10cSrcweir         com.sun.star.sheet.GeneralFunction GF13 = com.sun.star.sheet.GeneralFunction.VARP;
642cdf0e10cSrcweir 
643cdf0e10cSrcweir         if (oldValue.equals(GF1)) newValue = GF2;
644cdf0e10cSrcweir         if (oldValue.equals(GF2)) newValue = GF3;
645cdf0e10cSrcweir         if (oldValue.equals(GF3)) newValue = GF4;
646cdf0e10cSrcweir         if (oldValue.equals(GF4)) newValue = GF5;
647cdf0e10cSrcweir         if (oldValue.equals(GF5)) newValue = GF6;
648cdf0e10cSrcweir         if (oldValue.equals(GF6)) newValue = GF7;
649cdf0e10cSrcweir         if (oldValue.equals(GF7)) newValue = GF8;
650cdf0e10cSrcweir         if (oldValue.equals(GF8)) newValue = GF9;
651cdf0e10cSrcweir         if (oldValue.equals(GF9)) newValue = GF10;
652cdf0e10cSrcweir         if (oldValue.equals(GF10)) newValue = GF11;
653cdf0e10cSrcweir         if (oldValue.equals(GF11)) newValue = GF12;
654cdf0e10cSrcweir         if (oldValue.equals(GF12)) newValue = GF13;
655cdf0e10cSrcweir         if (oldValue.equals(GF13)) newValue = GF1;
656cdf0e10cSrcweir    } else
657cdf0e10cSrcweir 
658cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.table.CellAddress){
659cdf0e10cSrcweir         com.sun.star.table.CellAddress _newValue = (com.sun.star.table.CellAddress)oldValue;
660cdf0e10cSrcweir         _newValue.Column += 1;
661cdf0e10cSrcweir         _newValue.Row += 1;
662cdf0e10cSrcweir         newValue = _newValue;
663cdf0e10cSrcweir    } else
664cdf0e10cSrcweir 
665cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.table.TableOrientation){
666cdf0e10cSrcweir         com.sun.star.table.TableOrientation TO1 = com.sun.star.table.TableOrientation.COLUMNS;
667cdf0e10cSrcweir         com.sun.star.table.TableOrientation TO2 = com.sun.star.table.TableOrientation.ROWS;
668cdf0e10cSrcweir         if (oldValue.equals(TO1)) newValue = TO2; else newValue = TO1;
669cdf0e10cSrcweir    } else
670cdf0e10cSrcweir 
671cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.sheet.DataImportMode){
672cdf0e10cSrcweir         com.sun.star.sheet.DataImportMode DIM1 = com.sun.star.sheet.DataImportMode.NONE;
673cdf0e10cSrcweir         com.sun.star.sheet.DataImportMode DIM2 = com.sun.star.sheet.DataImportMode.QUERY;
674cdf0e10cSrcweir         com.sun.star.sheet.DataImportMode DIM3 = com.sun.star.sheet.DataImportMode.SQL;
675cdf0e10cSrcweir         com.sun.star.sheet.DataImportMode DIM4 = com.sun.star.sheet.DataImportMode.TABLE;
676cdf0e10cSrcweir 
677cdf0e10cSrcweir         if (oldValue.equals(DIM1)) newValue = DIM2;
678cdf0e10cSrcweir         if (oldValue.equals(DIM2)) newValue = DIM3;
679cdf0e10cSrcweir         if (oldValue.equals(DIM3)) newValue = DIM4;
680cdf0e10cSrcweir         if (oldValue.equals(DIM4)) newValue = DIM1;
681cdf0e10cSrcweir 
682cdf0e10cSrcweir    } else
683cdf0e10cSrcweir 
684cdf0e10cSrcweir //   if (oldValue instanceof com.sun.star.text.TableColumnSeparator[]){
685cdf0e10cSrcweir //        com.sun.star.text.TableColumnSeparator[] _newValue = (com.sun.star.text.TableColumnSeparator[]) oldValue;
686cdf0e10cSrcweir //        com.sun.star.text.TableColumnSeparator sep = new com.sun.star.text.TableColumnSeparator();
687cdf0e10cSrcweir //        sep.IsVisible = ! _newValue[0].IsVisible;
688cdf0e10cSrcweir //        _newValue[0] = sep;
689cdf0e10cSrcweir //        newValue = _newValue;
690cdf0e10cSrcweir //   } else
691cdf0e10cSrcweir 
692cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.style.BreakType){
693cdf0e10cSrcweir         com.sun.star.style.BreakType BT1 = com.sun.star.style.BreakType.COLUMN_AFTER;
694cdf0e10cSrcweir         com.sun.star.style.BreakType BT2 = com.sun.star.style.BreakType.COLUMN_BEFORE;
695cdf0e10cSrcweir         com.sun.star.style.BreakType BT3 = com.sun.star.style.BreakType.COLUMN_BOTH;
696cdf0e10cSrcweir         com.sun.star.style.BreakType BT4 = com.sun.star.style.BreakType.PAGE_AFTER;
697cdf0e10cSrcweir         com.sun.star.style.BreakType BT5 = com.sun.star.style.BreakType.PAGE_BEFORE;
698cdf0e10cSrcweir         com.sun.star.style.BreakType BT6 = com.sun.star.style.BreakType.PAGE_BOTH;
699cdf0e10cSrcweir         com.sun.star.style.BreakType BT7 = com.sun.star.style.BreakType.NONE;
700cdf0e10cSrcweir         if (oldValue.equals(BT1)) newValue = BT2;
701cdf0e10cSrcweir         if (oldValue.equals(BT2)) newValue = BT3;
702cdf0e10cSrcweir         if (oldValue.equals(BT3)) newValue = BT4;
703cdf0e10cSrcweir         if (oldValue.equals(BT4)) newValue = BT5;
704cdf0e10cSrcweir         if (oldValue.equals(BT6)) newValue = BT6;
705cdf0e10cSrcweir         if (oldValue.equals(BT6)) newValue = BT7;
706cdf0e10cSrcweir         if (oldValue.equals(BT7)) newValue = BT1;
707cdf0e10cSrcweir    } else
708cdf0e10cSrcweir     if (oldValue instanceof PropertyValue){
709cdf0e10cSrcweir         PropertyValue newVal = new PropertyValue();
710cdf0e10cSrcweir         newVal.Name = ((PropertyValue)oldValue).Name;
711cdf0e10cSrcweir         newVal.Value = changePValue(((PropertyValue)oldValue).Value);
712cdf0e10cSrcweir         newValue = newVal;
713cdf0e10cSrcweir     } else
714cdf0e10cSrcweir    if (oldValue instanceof com.sun.star.sheet.ValidationAlertStyle){
715cdf0e10cSrcweir         com.sun.star.sheet.ValidationAlertStyle VAS1 = com.sun.star.sheet.ValidationAlertStyle.INFO;
716cdf0e10cSrcweir         com.sun.star.sheet.ValidationAlertStyle VAS2 = com.sun.star.sheet.ValidationAlertStyle.MACRO;
717cdf0e10cSrcweir         com.sun.star.sheet.ValidationAlertStyle VAS3 = com.sun.star.sheet.ValidationAlertStyle.STOP;
718cdf0e10cSrcweir         com.sun.star.sheet.ValidationAlertStyle VAS4 = com.sun.star.sheet.ValidationAlertStyle.WARNING;
719cdf0e10cSrcweir 
720cdf0e10cSrcweir         if (oldValue.equals(VAS1)) newValue = VAS2;
721cdf0e10cSrcweir         if (oldValue.equals(VAS2)) newValue = VAS3;
722cdf0e10cSrcweir         if (oldValue.equals(VAS3)) newValue = VAS4;
723cdf0e10cSrcweir         if (oldValue.equals(VAS4)) newValue = VAS1;
724cdf0e10cSrcweir 
725cdf0e10cSrcweir    } else
726cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.sheet.ValidationType){
727cdf0e10cSrcweir         com.sun.star.sheet.ValidationType VT1 = com.sun.star.sheet.ValidationType.ANY;
728cdf0e10cSrcweir         com.sun.star.sheet.ValidationType VT2 = com.sun.star.sheet.ValidationType.CUSTOM;
729cdf0e10cSrcweir         com.sun.star.sheet.ValidationType VT3 = com.sun.star.sheet.ValidationType.DATE;
730cdf0e10cSrcweir         com.sun.star.sheet.ValidationType VT4 = com.sun.star.sheet.ValidationType.DECIMAL;
731cdf0e10cSrcweir         com.sun.star.sheet.ValidationType VT5 = com.sun.star.sheet.ValidationType.LIST;
732cdf0e10cSrcweir         com.sun.star.sheet.ValidationType VT6 = com.sun.star.sheet.ValidationType.TEXT_LEN;
733cdf0e10cSrcweir         com.sun.star.sheet.ValidationType VT7 = com.sun.star.sheet.ValidationType.TIME;
734cdf0e10cSrcweir         com.sun.star.sheet.ValidationType VT8 = com.sun.star.sheet.ValidationType.WHOLE;
735cdf0e10cSrcweir 
736cdf0e10cSrcweir         if (oldValue.equals(VT1)) newValue = VT2;
737cdf0e10cSrcweir         if (oldValue.equals(VT2)) newValue = VT3;
738cdf0e10cSrcweir         if (oldValue.equals(VT3)) newValue = VT4;
739cdf0e10cSrcweir         if (oldValue.equals(VT4)) newValue = VT5;
740cdf0e10cSrcweir         if (oldValue.equals(VT5)) newValue = VT6;
741cdf0e10cSrcweir         if (oldValue.equals(VT6)) newValue = VT7;
742cdf0e10cSrcweir         if (oldValue.equals(VT7)) newValue = VT8;
743cdf0e10cSrcweir         if (oldValue.equals(VT8)) newValue = VT1;
744cdf0e10cSrcweir 
745cdf0e10cSrcweir     } else
746cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.text.WritingMode){
747cdf0e10cSrcweir         if (oldValue.equals(com.sun.star.text.WritingMode.LR_TB)) {
748cdf0e10cSrcweir             newValue = com.sun.star.text.WritingMode.TB_RL;
749cdf0e10cSrcweir         } else {
750cdf0e10cSrcweir             newValue = com.sun.star.text.WritingMode.LR_TB;
751cdf0e10cSrcweir         }
752cdf0e10cSrcweir     } else
753cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.uno.Enum) {
754cdf0e10cSrcweir         // universal changer for Enumerations
755cdf0e10cSrcweir         try {
756cdf0e10cSrcweir             Class enumClass = oldValue.getClass() ;
757cdf0e10cSrcweir             Field[] flds = enumClass.getFields() ;
758cdf0e10cSrcweir 
759cdf0e10cSrcweir             newValue = null ;
760cdf0e10cSrcweir 
761cdf0e10cSrcweir             for (int i = 0; i < flds.length; i++) {
762cdf0e10cSrcweir                 if (Enum.class.equals(flds[i].getType().getSuperclass())) {
763cdf0e10cSrcweir 
764cdf0e10cSrcweir                     Enum value = (Enum) flds[i].get(null) ;
765cdf0e10cSrcweir                     if (newValue == null && !value.equals(oldValue)) {
766cdf0e10cSrcweir                         newValue = value ;
767cdf0e10cSrcweir                         break ;
768cdf0e10cSrcweir                     }
769cdf0e10cSrcweir                 }
770cdf0e10cSrcweir             }
771cdf0e10cSrcweir         } catch (Exception e) {
772cdf0e10cSrcweir             System.err.println("Exception occured while changing Enumeration value:") ;
773cdf0e10cSrcweir             e.printStackTrace(System.err) ;
774cdf0e10cSrcweir         }
775cdf0e10cSrcweir         if (newValue == null) newValue = oldValue ;
776cdf0e10cSrcweir 
777cdf0e10cSrcweir     } else
778cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.style.TabStop[]){
779cdf0e10cSrcweir         com.sun.star.style.TabStop[] _newValue = (com.sun.star.style.TabStop[]) oldValue;
780cdf0e10cSrcweir         if (_newValue.length == 0) {
781cdf0e10cSrcweir             _newValue = new com.sun.star.style.TabStop[1];
782cdf0e10cSrcweir         }
783cdf0e10cSrcweir         com.sun.star.style.TabStop sep = new com.sun.star.style.TabStop();
784cdf0e10cSrcweir         sep.Position += 1;
785cdf0e10cSrcweir         _newValue[0] = sep;
786cdf0e10cSrcweir         newValue = _newValue;
787cdf0e10cSrcweir     } else
788cdf0e10cSrcweir     if (oldValue instanceof short[]){
789cdf0e10cSrcweir         short[] oldArr = (short[])oldValue;
790cdf0e10cSrcweir         int len = oldArr.length;
791cdf0e10cSrcweir         short[] newArr = new short[len + 1];
792cdf0e10cSrcweir         for (int i = 0; i < len; i++) {
793cdf0e10cSrcweir             newArr[i] = (short)(oldArr[i] + 1);
794cdf0e10cSrcweir         }
795cdf0e10cSrcweir         newArr[len] = 5;
796cdf0e10cSrcweir         newValue = newArr;
797cdf0e10cSrcweir     } else
798cdf0e10cSrcweir     if (oldValue instanceof String[]){
799cdf0e10cSrcweir         String[] oldArr = (String[])oldValue;
800cdf0e10cSrcweir         int len = oldArr.length;
801cdf0e10cSrcweir         String[] newArr = new String[len + 1];
802cdf0e10cSrcweir         for (int i = 0; i < len; i++) {
803cdf0e10cSrcweir             newArr[i] = "_" + oldArr[i];
804cdf0e10cSrcweir         }
805cdf0e10cSrcweir         newArr[len] = "_dummy";
806cdf0e10cSrcweir         newValue = newArr;
807cdf0e10cSrcweir     } else
808cdf0e10cSrcweir     if (oldValue instanceof PropertyValue){
809cdf0e10cSrcweir         PropertyValue newVal = new PropertyValue();
810cdf0e10cSrcweir         newVal.Name = ((PropertyValue)oldValue).Name;
811cdf0e10cSrcweir         newVal.Value = changePValue(((PropertyValue)oldValue).Value);
812cdf0e10cSrcweir         newValue = newVal;
813cdf0e10cSrcweir     } else
814cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.util.DateTime) {
815cdf0e10cSrcweir         com.sun.star.util.DateTime oldDT = (com.sun.star.util.DateTime) oldValue;
816cdf0e10cSrcweir         com.sun.star.util.DateTime newDT = new com.sun.star.util.DateTime();
817cdf0e10cSrcweir         newDT.Day = (short) (oldDT.Day+(short) 1);
818cdf0e10cSrcweir         newDT.Hours = (short) (oldDT.Hours+(short) 1);
819cdf0e10cSrcweir         newValue = newDT;
820cdf0e10cSrcweir     } else
821cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.text.TableColumnSeparator) {
822cdf0e10cSrcweir         com.sun.star.text.TableColumnSeparator oldTCS = (com.sun.star.text.TableColumnSeparator) oldValue;
823cdf0e10cSrcweir         com.sun.star.text.TableColumnSeparator newTCS = new com.sun.star.text.TableColumnSeparator();
824cdf0e10cSrcweir         newTCS.IsVisible = !(oldTCS.IsVisible);
825cdf0e10cSrcweir         newTCS.Position = (short) (oldTCS.Position+(short) 1);
826cdf0e10cSrcweir         newValue = newTCS;
827cdf0e10cSrcweir     } else
828cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.HomogenMatrix3) {
829cdf0e10cSrcweir         com.sun.star.drawing.HomogenMatrix3 oldHM = (com.sun.star.drawing.HomogenMatrix3) oldValue;
830cdf0e10cSrcweir         com.sun.star.drawing.HomogenMatrix3 newHM = new com.sun.star.drawing.HomogenMatrix3();
831cdf0e10cSrcweir         newHM.Line1.Column1 = oldHM.Line1.Column1+1;
832cdf0e10cSrcweir         newHM.Line2.Column2 = oldHM.Line2.Column2+1;
833cdf0e10cSrcweir         newHM.Line3.Column3 = oldHM.Line3.Column3+1;
834cdf0e10cSrcweir         newValue = newHM;
835cdf0e10cSrcweir     } else
836cdf0e10cSrcweir 
837cdf0e10cSrcweir     if (oldValue instanceof com.sun.star.drawing.PolyPolygonBezierCoords) {
838cdf0e10cSrcweir         com.sun.star.drawing.PolyPolygonBezierCoords oldPPC = (com.sun.star.drawing.PolyPolygonBezierCoords) oldValue;
839cdf0e10cSrcweir         com.sun.star.drawing.PolyPolygonBezierCoords newPPC = new com.sun.star.drawing.PolyPolygonBezierCoords();
840cdf0e10cSrcweir         newPPC.Coordinates = oldPPC.Coordinates;
841cdf0e10cSrcweir         newPPC.Flags = oldPPC.Flags;
842cdf0e10cSrcweir         PolygonFlags[][] fArray = new PolygonFlags[1][1];
843cdf0e10cSrcweir         PolygonFlags[] flags = new PolygonFlags[1];
844cdf0e10cSrcweir         flags[0] = PolygonFlags.NORMAL;
845cdf0e10cSrcweir         fArray[0] = flags;
846cdf0e10cSrcweir         Point[][] pArray = new Point[1][1];
847cdf0e10cSrcweir         Point[] points = new Point[1];
848cdf0e10cSrcweir         Point aPoint = new Point();
849cdf0e10cSrcweir         aPoint.X = 1;
850cdf0e10cSrcweir         aPoint.Y = 2;
851cdf0e10cSrcweir         points[0] = aPoint;
852cdf0e10cSrcweir         pArray[0] = points;
853cdf0e10cSrcweir         if ( oldPPC.Coordinates.length == 0 ) {
854cdf0e10cSrcweir             newPPC.Coordinates = pArray;
855cdf0e10cSrcweir             newPPC.Flags = fArray;
856cdf0e10cSrcweir         } else {
857cdf0e10cSrcweir             if ( oldPPC.Coordinates[0].length == 0 ) {
858cdf0e10cSrcweir                 newPPC.Coordinates = pArray;
859cdf0e10cSrcweir                 newPPC.Flags = fArray;
860cdf0e10cSrcweir             } else {
861cdf0e10cSrcweir                 newPPC.Coordinates[0][0].X = oldPPC.Coordinates[0][0].X +1;
862cdf0e10cSrcweir                 newPPC.Coordinates[0][0].Y = oldPPC.Coordinates[0][0].Y +1;
863cdf0e10cSrcweir             }
864cdf0e10cSrcweir         }
865cdf0e10cSrcweir         newValue = newPPC;
866cdf0e10cSrcweir     } else
867cdf0e10cSrcweir     if (oldValue.getClass().isArray()) {
868cdf0e10cSrcweir         // changer for arrays : changes all elements
869cdf0e10cSrcweir         Class arrType = oldValue.getClass().getComponentType() ;
870cdf0e10cSrcweir         newValue = Array.newInstance(arrType, Array.getLength(oldValue)) ;
871cdf0e10cSrcweir         for (int i = 0; i < Array.getLength(newValue); i++) {
872cdf0e10cSrcweir             if (!arrType.isPrimitive()) {
873cdf0e10cSrcweir                 Object elem = changePValue(Array.get(oldValue, i)) ;
874cdf0e10cSrcweir                 Array.set(newValue, i, elem);
875cdf0e10cSrcweir             } else {
876cdf0e10cSrcweir                 if (Boolean.TYPE.equals(arrType)) {
877cdf0e10cSrcweir                     Array.setBoolean(newValue, i, !Array.getBoolean(oldValue, i));
878cdf0e10cSrcweir                 } else
879cdf0e10cSrcweir                 if (Byte.TYPE.equals(arrType)) {
880cdf0e10cSrcweir                     Array.setByte(newValue, i,
881cdf0e10cSrcweir                         (byte) (Array.getByte(oldValue, i) + 1));
882cdf0e10cSrcweir                 } else
883cdf0e10cSrcweir                 if (Character.TYPE.equals(arrType)) {
884cdf0e10cSrcweir                     Array.setChar(newValue, i,
885cdf0e10cSrcweir                         (char) (Array.getChar(oldValue, i) + 1));
886cdf0e10cSrcweir                 } else
887cdf0e10cSrcweir                 if (Double.TYPE.equals(arrType)) {
888cdf0e10cSrcweir                     Array.setDouble(newValue, i, Array.getDouble(oldValue, i) + 1);
889cdf0e10cSrcweir                 } else
890cdf0e10cSrcweir                 if (Float.TYPE.equals(arrType)) {
891cdf0e10cSrcweir                     Array.setFloat(newValue, i, Array.getFloat(oldValue, i) + 1);
892cdf0e10cSrcweir                 } else
893cdf0e10cSrcweir                 if (Integer.TYPE.equals(arrType)) {
894cdf0e10cSrcweir                     Array.setInt(newValue, i, Array.getInt(oldValue, i) + 1);
895cdf0e10cSrcweir                 } else
896cdf0e10cSrcweir                 if (Long.TYPE.equals(arrType)) {
897cdf0e10cSrcweir                     Array.setLong(newValue, i, Array.getLong(oldValue, i) + 1);
898cdf0e10cSrcweir                 } else
899cdf0e10cSrcweir                 if (Short.TYPE.equals(arrType)) {
900cdf0e10cSrcweir                     Array.setShort(newValue, i,
901cdf0e10cSrcweir                         (short) (Array.getShort(oldValue, i) + 1));
902cdf0e10cSrcweir                 }
903cdf0e10cSrcweir             }
904cdf0e10cSrcweir         }
905cdf0e10cSrcweir     } else
906cdf0e10cSrcweir     if (isStructure(oldValue)) {
907cdf0e10cSrcweir         // universal changer for structures
908cdf0e10cSrcweir         Class clazz = oldValue.getClass() ;
909cdf0e10cSrcweir         try {
910cdf0e10cSrcweir             newValue = clazz.newInstance() ;
911cdf0e10cSrcweir             Field[] fields = clazz.getFields();
912cdf0e10cSrcweir             for (int i = 0; i < fields.length; i++) {
913cdf0e10cSrcweir                 if ((fields[i].getModifiers() & Modifier.PUBLIC) != 0) {
914cdf0e10cSrcweir                     Class fType = fields[i].getType() ;
915cdf0e10cSrcweir                     Field field = fields[i] ;
916cdf0e10cSrcweir                     if (!fType.isPrimitive()) {
917cdf0e10cSrcweir                         field.set(newValue, changePValue(field.get(oldValue)));
918cdf0e10cSrcweir                     } else {
919cdf0e10cSrcweir                         if (Boolean.TYPE.equals(fType)) {
920cdf0e10cSrcweir                             field.setBoolean(newValue, !field.getBoolean(oldValue));
921cdf0e10cSrcweir                         } else
922cdf0e10cSrcweir                         if (Byte.TYPE.equals(fType)) {
923cdf0e10cSrcweir                             field.setByte(newValue, (byte) (field.getByte(oldValue) + 1));
924cdf0e10cSrcweir                         } else
925cdf0e10cSrcweir                         if (Character.TYPE.equals(fType)) {
926cdf0e10cSrcweir                             field.setChar(newValue, (char) (field.getChar(oldValue) + 1));
927cdf0e10cSrcweir                         } else
928cdf0e10cSrcweir                         if (Double.TYPE.equals(fType)) {
929cdf0e10cSrcweir                             field.setDouble(newValue, field.getDouble(oldValue) + 1);
930cdf0e10cSrcweir                         } else
931cdf0e10cSrcweir                         if (Float.TYPE.equals(fType)) {
932cdf0e10cSrcweir                             field.setFloat(newValue, field.getFloat(oldValue) + 1);
933cdf0e10cSrcweir                         } else
934cdf0e10cSrcweir                         if (Integer.TYPE.equals(fType)) {
935cdf0e10cSrcweir                             field.setInt(newValue, field.getInt(oldValue) + 1);
936cdf0e10cSrcweir                         } else
937cdf0e10cSrcweir                         if (Long.TYPE.equals(fType)) {
938cdf0e10cSrcweir                             field.setLong(newValue, field.getLong(oldValue) + 1);
939cdf0e10cSrcweir                         } else
940cdf0e10cSrcweir                         if (Short.TYPE.equals(fType)) {
941cdf0e10cSrcweir                             field.setShort(newValue, (short) (field.getShort(oldValue) + 1));
942cdf0e10cSrcweir                         }
943cdf0e10cSrcweir                     }
944cdf0e10cSrcweir                 }
945cdf0e10cSrcweir             }
946cdf0e10cSrcweir         } catch (IllegalAccessException e) {
947cdf0e10cSrcweir             e.printStackTrace() ;
948cdf0e10cSrcweir         } catch (InstantiationException e) {
949cdf0e10cSrcweir             e.printStackTrace() ;
950cdf0e10cSrcweir         }
951cdf0e10cSrcweir 
952cdf0e10cSrcweir     } else
953cdf0e10cSrcweir     {
954cdf0e10cSrcweir         System.out.println("ValueChanger don't know type " + oldValue.getClass());
955cdf0e10cSrcweir     }
956cdf0e10cSrcweir 
957cdf0e10cSrcweir    return newValue;
958cdf0e10cSrcweir 
959cdf0e10cSrcweir  } // end of Change PValue
960cdf0e10cSrcweir 
961cdf0e10cSrcweir  /**
962cdf0e10cSrcweir   * Checks if the passed value is the API structure.
963cdf0e10cSrcweir   * The value assumed to be a structure if there are no public
964cdf0e10cSrcweir   * methods, and all public fields are not static or final.
965cdf0e10cSrcweir   *
966cdf0e10cSrcweir   * @param val the value to be checked.
967cdf0e10cSrcweir   * @return <code>true</code> if the value is acssumed to be a
968cdf0e10cSrcweir   * structure.
969cdf0e10cSrcweir   */
isStructure(Object val)970cdf0e10cSrcweir  private static boolean isStructure(Object val) {
971cdf0e10cSrcweir     boolean result = true ;
972cdf0e10cSrcweir 
973cdf0e10cSrcweir     Class clazz = val.getClass() ;
974cdf0e10cSrcweir 
975cdf0e10cSrcweir     Method[] meth = clazz.getDeclaredMethods() ;
976cdf0e10cSrcweir     for (int i = 0; i < meth.length; i++) {
977cdf0e10cSrcweir         result &= (meth[i].getModifiers() & Modifier.PUBLIC) == 0 ;
978cdf0e10cSrcweir     }
979cdf0e10cSrcweir 
980cdf0e10cSrcweir     Field[] fields = clazz.getDeclaredFields() ;
981cdf0e10cSrcweir     for (int i = 0; i < fields.length; i++) {
982cdf0e10cSrcweir         int mod = fields[i].getModifiers() ;
983cdf0e10cSrcweir         // If the field is PUBLIC it must not be STATIC or FINAL
984cdf0e10cSrcweir         result &= ((mod & Modifier.PUBLIC) == 0) ||
985cdf0e10cSrcweir             (((mod & Modifier.STATIC) == 0) && ((mod & Modifier.FINAL) == 0)) ;
986cdf0e10cSrcweir     }
987cdf0e10cSrcweir 
988cdf0e10cSrcweir     return result ;
989cdf0e10cSrcweir  }
990cdf0e10cSrcweir }
991