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