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