2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import com
.sun
.star
.awt
.Point
;
22 import com
.sun
.star
.beans
.PropertyValue
;
23 import com
.sun
.star
.drawing
.PolygonFlags
;
24 //import util.BitmapLoader;
25 import com
.sun
.star
.uno
.Enum
;
26 import java
.lang
.reflect
.Field
;
27 import java
.lang
.reflect
.Method
;
28 import java
.lang
.reflect
.Modifier
;
29 import java
.lang
.reflect
.Array
;
30 import com
.sun
.star
.uno
.Any
;
31 import com
.sun
.star
.uno
.AnyConverter
;
34 public class ValueChanger
{
37 // Method to change a Value, thought for properties
38 public static Object
changePValue( Object oldValue
) {
40 Object newValue
= null;
42 if (oldValue
instanceof com
.sun
.star
.uno
.Any
) {
44 oldValue
= AnyConverter
.toObject(((Any
) oldValue
).getType(),oldValue
);
45 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
52 if (oldValue
instanceof Boolean
) {
53 boolean oldbool
= ((Boolean
) oldValue
).booleanValue();
54 newValue
= new Boolean(!oldbool
);
57 if (oldValue
instanceof Integer
) {
58 int oldint
= ((Integer
) oldValue
).intValue();
59 newValue
= new Integer(oldint
+5);
62 if (oldValue
instanceof Long
) {
63 long oldlong
= ((Long
) oldValue
).longValue();
64 newValue
= new Long(oldlong
+ 15);
67 if (oldValue
instanceof Short
) {
68 short oldshort
= ((Short
) oldValue
).shortValue();
69 newValue
= new Short((short) (oldshort
+ 1));
72 if (oldValue
instanceof Byte
) {
73 byte oldbyte
= ((Byte
) oldValue
).byteValue();
74 newValue
= new Byte((byte) (oldbyte
+ 1));
77 if (oldValue
instanceof Float
) {
78 float oldfloat
= ((Float
) oldValue
).floatValue();
79 newValue
= new Float((float) (oldfloat
+ 16.7));
82 if (oldValue
instanceof Double
) {
83 double olddouble
= ((Double
) oldValue
).doubleValue();
84 newValue
= new Double(olddouble
+ 17.8);
87 if (oldValue
instanceof String
) {
88 String oldString
= (String
) oldValue
;
89 newValue
= oldString
+ "New";
93 if (oldValue
instanceof com
.sun
.star
.chart
.ChartAxisArrangeOrderType
) {
94 Object AO1
= com
.sun
.star
.chart
.ChartAxisArrangeOrderType
.AUTO
;
95 Object AO2
= com
.sun
.star
.chart
.ChartAxisArrangeOrderType
.SIDE_BY_SIDE
;
96 Object AO3
= com
.sun
.star
.chart
.ChartAxisArrangeOrderType
.STAGGER_EVEN
;
97 Object AO4
= com
.sun
.star
.chart
.ChartAxisArrangeOrderType
.STAGGER_ODD
;
99 if (oldValue
.equals(AO1
)) newValue
= AO2
;
100 if (oldValue
.equals(AO2
)) newValue
= AO3
;
101 if (oldValue
.equals(AO3
)) newValue
= AO4
;
102 if (oldValue
.equals(AO4
)) newValue
= AO1
;
105 if (oldValue
instanceof com
.sun
.star
.view
.PaperOrientation
) {
106 Object OR1
= com
.sun
.star
.view
.PaperOrientation
.LANDSCAPE
;
107 Object OR2
= com
.sun
.star
.view
.PaperOrientation
.PORTRAIT
;
109 if (oldValue
.equals(OR1
)) newValue
= OR2
;
113 if (oldValue
instanceof com
.sun
.star
.lang
.Locale
) {
114 Object Loc1
= new com
.sun
.star
.lang
.Locale("en","US","");
115 Object Loc2
= new com
.sun
.star
.lang
.Locale("de","DE","");
117 if (oldValue
.equals(Loc1
)) newValue
= Loc2
;
118 else newValue
= Loc1
;
121 if (oldValue
instanceof com
.sun
.star
.style
.ParagraphAdjust
) {
122 Object PA1
= com
.sun
.star
.style
.ParagraphAdjust
.LEFT
;
123 Object PA2
= com
.sun
.star
.style
.ParagraphAdjust
.CENTER
;
125 if (oldValue
.equals(PA1
)) newValue
= PA2
;
129 if (oldValue
instanceof com
.sun
.star
.style
.LineSpacing
) {
130 com
.sun
.star
.style
.LineSpacing LS
= new com
.sun
.star
.style
.LineSpacing();
131 com
.sun
.star
.style
.LineSpacing LSold
= (com
.sun
.star
.style
.LineSpacing
) oldValue
;
132 LS
.Height
= (short) ((LSold
.Height
)+1);
133 LS
.Mode
= (short) ((LSold
.Mode
)+1);
137 if (oldValue
instanceof com
.sun
.star
.drawing
.Direction3D
) {
138 com
.sun
.star
.drawing
.Direction3D D3D
= new com
.sun
.star
.drawing
.Direction3D();
139 com
.sun
.star
.drawing
.Direction3D D3Dold
= (com
.sun
.star
.drawing
.Direction3D
) oldValue
;
140 D3D
.DirectionX
= D3Dold
.DirectionX
+ .5;
141 D3D
.DirectionY
= D3Dold
.DirectionY
+ .5;
142 D3D
.DirectionZ
= D3Dold
.DirectionZ
+ .5;
146 if (oldValue
instanceof com
.sun
.star
.style
.GraphicLocation
) {
147 Object GL1
= com
.sun
.star
.style
.GraphicLocation
.AREA
;
148 Object GL2
= com
.sun
.star
.style
.GraphicLocation
.LEFT_BOTTOM
;
150 if (oldValue
.equals(GL1
)) newValue
= GL2
;
154 if (oldValue
instanceof com
.sun
.star
.style
.TabStop
) {
155 com
.sun
.star
.style
.TabStop TS
= new com
.sun
.star
.style
.TabStop();
156 com
.sun
.star
.style
.TabStop TSold
= (com
.sun
.star
.style
.TabStop
) oldValue
;
157 com
.sun
.star
.style
.TabAlign TA1
= com
.sun
.star
.style
.TabAlign
.CENTER
;
158 com
.sun
.star
.style
.TabAlign TA2
= com
.sun
.star
.style
.TabAlign
.RIGHT
;
160 if ((TSold
.Alignment
).equals(TA1
)) TS
.Alignment
= TA2
;
161 else TS
.Alignment
= TA1
;
163 TS
.Position
= ((TSold
.Position
)+1);
168 if (oldValue
instanceof com
.sun
.star
.style
.DropCapFormat
) {
169 com
.sun
.star
.style
.DropCapFormat DCF
= new com
.sun
.star
.style
.DropCapFormat();
170 com
.sun
.star
.style
.DropCapFormat DCFold
= (com
.sun
.star
.style
.DropCapFormat
) oldValue
;
171 DCF
.Count
= (byte) ((DCFold
.Count
)+1);
172 DCF
.Distance
= (short) ((DCFold
.Distance
)+1);
173 DCF
.Lines
= (byte) ((DCFold
.Lines
)+1);
177 if (oldValue
instanceof com
.sun
.star
.text
.TextContentAnchorType
) {
178 com
.sun
.star
.text
.TextContentAnchorType TCAT1
= com
.sun
.star
.text
.TextContentAnchorType
.AS_CHARACTER
;
179 com
.sun
.star
.text
.TextContentAnchorType TCAT2
= com
.sun
.star
.text
.TextContentAnchorType
.AT_CHARACTER
;
180 com
.sun
.star
.text
.TextContentAnchorType TCAT3
= com
.sun
.star
.text
.TextContentAnchorType
.AT_FRAME
;
181 com
.sun
.star
.text
.TextContentAnchorType TCAT4
= com
.sun
.star
.text
.TextContentAnchorType
.AT_PAGE
;
182 com
.sun
.star
.text
.TextContentAnchorType TCAT5
= com
.sun
.star
.text
.TextContentAnchorType
.AT_PARAGRAPH
;
183 if (oldValue
.equals(TCAT1
)) newValue
= TCAT2
;
184 if (oldValue
.equals(TCAT2
)) newValue
= TCAT3
;
185 if (oldValue
.equals(TCAT3
)) newValue
= TCAT4
;
186 if (oldValue
.equals(TCAT4
)) newValue
= TCAT5
;
187 if (oldValue
.equals(TCAT5
)) newValue
= TCAT1
;
190 if (oldValue
instanceof com
.sun
.star
.text
.WrapTextMode
) {
191 com
.sun
.star
.text
.WrapTextMode WTM1
= com
.sun
.star
.text
.WrapTextMode
.DYNAMIC
;
192 com
.sun
.star
.text
.WrapTextMode WTM2
= com
.sun
.star
.text
.WrapTextMode
.LEFT
;
193 com
.sun
.star
.text
.WrapTextMode WTM3
= com
.sun
.star
.text
.WrapTextMode
.NONE
;
194 com
.sun
.star
.text
.WrapTextMode WTM4
= com
.sun
.star
.text
.WrapTextMode
.PARALLEL
;
195 com
.sun
.star
.text
.WrapTextMode WTM5
= com
.sun
.star
.text
.WrapTextMode
.RIGHT
;
196 com
.sun
.star
.text
.WrapTextMode WTM6
= com
.sun
.star
.text
.WrapTextMode
.THROUGHT
;
197 if (oldValue
.equals(WTM1
)) newValue
= WTM2
;
198 if (oldValue
.equals(WTM2
)) newValue
= WTM3
;
199 if (oldValue
.equals(WTM3
)) newValue
= WTM4
;
200 if (oldValue
.equals(WTM4
)) newValue
= WTM5
;
201 if (oldValue
.equals(WTM5
)) newValue
= WTM6
;
202 if (oldValue
.equals(WTM6
)) newValue
= WTM1
;
205 if (oldValue
instanceof com
.sun
.star
.awt
.Size
) {
206 com
.sun
.star
.awt
.Size oldSize
= (com
.sun
.star
.awt
.Size
) oldValue
;
207 com
.sun
.star
.awt
.Size newSize
= new com
.sun
.star
.awt
.Size();
208 newSize
.Height
= oldSize
.Height
+1;
209 newSize
.Width
= oldSize
.Width
+1;
213 if (oldValue
instanceof com
.sun
.star
.awt
.Rectangle
) {
214 com
.sun
.star
.awt
.Rectangle oldRectangle
= (com
.sun
.star
.awt
.Rectangle
) oldValue
;
215 com
.sun
.star
.awt
.Rectangle newRectangle
= new com
.sun
.star
.awt
.Rectangle();
216 newRectangle
.Height
=oldRectangle
.Height
+1;
217 newRectangle
.Width
= oldRectangle
.Width
+1;
218 newRectangle
.X
=oldRectangle
.Y
+1;
219 newRectangle
.Y
= oldRectangle
.X
+1;
220 newValue
= newRectangle
;
223 if (oldValue
instanceof com
.sun
.star
.awt
.Point
) {
224 com
.sun
.star
.awt
.Point oldPoint
= (com
.sun
.star
.awt
.Point
) oldValue
;
225 com
.sun
.star
.awt
.Point newPoint
= new com
.sun
.star
.awt
.Point();
226 newPoint
.X
= oldPoint
.X
+1;
227 newPoint
.Y
= oldPoint
.Y
+1;
231 if (oldValue
instanceof com
.sun
.star
.table
.ShadowFormat
) {
232 com
.sun
.star
.table
.ShadowFormat SF
= new com
.sun
.star
.table
.ShadowFormat();
233 com
.sun
.star
.table
.ShadowFormat SFold
= (com
.sun
.star
.table
.ShadowFormat
) oldValue
;
234 SF
.IsTransparent
= (! SFold
.IsTransparent
);
235 SF
.ShadowWidth
= (short) ((SFold
.ShadowWidth
)+1);
239 if (oldValue
instanceof com
.sun
.star
.awt
.FontSlant
) {
240 com
.sun
.star
.awt
.FontSlant FS1
= com
.sun
.star
.awt
.FontSlant
.DONTKNOW
;
241 com
.sun
.star
.awt
.FontSlant FS2
= com
.sun
.star
.awt
.FontSlant
.ITALIC
;
242 com
.sun
.star
.awt
.FontSlant FS3
= com
.sun
.star
.awt
.FontSlant
.NONE
;
243 com
.sun
.star
.awt
.FontSlant FS4
= com
.sun
.star
.awt
.FontSlant
.OBLIQUE
;
244 com
.sun
.star
.awt
.FontSlant FS5
= com
.sun
.star
.awt
.FontSlant
.REVERSE_ITALIC
;
245 com
.sun
.star
.awt
.FontSlant FS6
= com
.sun
.star
.awt
.FontSlant
.REVERSE_OBLIQUE
;
246 if (oldValue
.equals(FS1
)) newValue
= FS2
;
247 if (oldValue
.equals(FS2
)) newValue
= FS3
;
248 if (oldValue
.equals(FS3
)) newValue
= FS4
;
249 if (oldValue
.equals(FS4
)) newValue
= FS5
;
250 if (oldValue
.equals(FS5
)) newValue
= FS6
;
251 if (oldValue
.equals(FS6
)) newValue
= FS1
;
254 if (oldValue
instanceof com
.sun
.star
.table
.CellHoriJustify
) {
255 com
.sun
.star
.table
.CellHoriJustify CHJ1
= com
.sun
.star
.table
.CellHoriJustify
.BLOCK
;
256 com
.sun
.star
.table
.CellHoriJustify CHJ2
= com
.sun
.star
.table
.CellHoriJustify
.CENTER
;
257 com
.sun
.star
.table
.CellHoriJustify CHJ3
= com
.sun
.star
.table
.CellHoriJustify
.LEFT
;
258 com
.sun
.star
.table
.CellHoriJustify CHJ4
= com
.sun
.star
.table
.CellHoriJustify
.REPEAT
;
259 com
.sun
.star
.table
.CellHoriJustify CHJ5
= com
.sun
.star
.table
.CellHoriJustify
.RIGHT
;
260 com
.sun
.star
.table
.CellHoriJustify CHJ6
= com
.sun
.star
.table
.CellHoriJustify
.STANDARD
;
261 if (oldValue
.equals(CHJ1
)) newValue
= CHJ2
;
262 if (oldValue
.equals(CHJ2
)) newValue
= CHJ3
;
263 if (oldValue
.equals(CHJ3
)) newValue
= CHJ4
;
264 if (oldValue
.equals(CHJ4
)) newValue
= CHJ5
;
265 if (oldValue
.equals(CHJ5
)) newValue
= CHJ6
;
266 if (oldValue
.equals(CHJ6
)) newValue
= CHJ1
;
269 if (oldValue
instanceof com
.sun
.star
.table
.CellVertJustify
) {
270 com
.sun
.star
.table
.CellVertJustify CVJ1
= com
.sun
.star
.table
.CellVertJustify
.BOTTOM
;
271 com
.sun
.star
.table
.CellVertJustify CVJ2
= com
.sun
.star
.table
.CellVertJustify
.CENTER
;
272 com
.sun
.star
.table
.CellVertJustify CVJ3
= com
.sun
.star
.table
.CellVertJustify
.STANDARD
;
273 com
.sun
.star
.table
.CellVertJustify CVJ4
= com
.sun
.star
.table
.CellVertJustify
.TOP
;
274 if (oldValue
.equals(CVJ1
)) newValue
= CVJ2
;
275 if (oldValue
.equals(CVJ2
)) newValue
= CVJ3
;
276 if (oldValue
.equals(CVJ3
)) newValue
= CVJ4
;
277 if (oldValue
.equals(CVJ4
)) newValue
= CVJ1
;
280 if (oldValue
instanceof com
.sun
.star
.table
.CellOrientation
) {
281 com
.sun
.star
.table
.CellOrientation CO1
= com
.sun
.star
.table
.CellOrientation
.BOTTOMTOP
;
282 com
.sun
.star
.table
.CellOrientation CO2
= com
.sun
.star
.table
.CellOrientation
.STACKED
;
283 com
.sun
.star
.table
.CellOrientation CO3
= com
.sun
.star
.table
.CellOrientation
.STANDARD
;
284 com
.sun
.star
.table
.CellOrientation CO4
= com
.sun
.star
.table
.CellOrientation
.TOPBOTTOM
;
285 if (oldValue
.equals(CO1
)) newValue
= CO2
;
286 if (oldValue
.equals(CO2
)) newValue
= CO3
;
287 if (oldValue
.equals(CO3
)) newValue
= CO4
;
288 if (oldValue
.equals(CO4
)) newValue
= CO1
;
291 if (oldValue
instanceof com
.sun
.star
.util
.CellProtection
) {
292 com
.sun
.star
.util
.CellProtection CP
= new com
.sun
.star
.util
.CellProtection();
293 com
.sun
.star
.util
.CellProtection CPold
= (com
.sun
.star
.util
.CellProtection
) oldValue
;
294 CP
.IsFormulaHidden
= (! CPold
.IsFormulaHidden
);
295 CP
.IsHidden
= (! CPold
.IsHidden
);
296 CP
.IsLocked
= (! CPold
.IsLocked
);
297 CP
.IsPrintHidden
= (! CPold
.IsPrintHidden
);
301 if (oldValue
instanceof com
.sun
.star
.table
.TableBorder
) {
302 com
.sun
.star
.table
.TableBorder TBold
= (com
.sun
.star
.table
.TableBorder
) oldValue
;
303 com
.sun
.star
.table
.TableBorder TB
= new com
.sun
.star
.table
.TableBorder();
304 TB
.IsBottomLineValid
= (! TBold
.IsBottomLineValid
);
305 TB
.IsDistanceValid
= (! TBold
.IsDistanceValid
);
306 TB
.IsRightLineValid
= (! TBold
.IsRightLineValid
);
307 TB
.IsTopLineValid
= (! TBold
.IsTopLineValid
);
311 if (oldValue instanceof com.sun.star.awt.XBitmap) {
312 newValue = new BitmapLoader();
315 if (oldValue
instanceof com
.sun
.star
.drawing
.FillStyle
) {
316 com
.sun
.star
.drawing
.FillStyle FS1
= com
.sun
.star
.drawing
.FillStyle
.NONE
;
317 com
.sun
.star
.drawing
.FillStyle FS2
= com
.sun
.star
.drawing
.FillStyle
.SOLID
;
318 com
.sun
.star
.drawing
.FillStyle FS3
= com
.sun
.star
.drawing
.FillStyle
.GRADIENT
;
319 com
.sun
.star
.drawing
.FillStyle FS4
= com
.sun
.star
.drawing
.FillStyle
.HATCH
;
320 com
.sun
.star
.drawing
.FillStyle FS5
= com
.sun
.star
.drawing
.FillStyle
.BITMAP
;
321 if (oldValue
.equals(FS1
)) newValue
= FS2
;
322 if (oldValue
.equals(FS2
)) newValue
= FS3
;
323 if (oldValue
.equals(FS3
)) newValue
= FS4
;
324 if (oldValue
.equals(FS4
)) newValue
= FS5
;
325 if (oldValue
.equals(FS5
)) newValue
= FS1
;
328 if (oldValue
instanceof com
.sun
.star
.awt
.Gradient
){
329 com
.sun
.star
.awt
.Gradient _newValue
= (com
.sun
.star
.awt
.Gradient
)oldValue
;
330 _newValue
.Angle
+= 10;
331 _newValue
.Border
+= 1;
332 _newValue
.EndColor
+= 1000;
333 _newValue
.EndIntensity
-= 10;
334 _newValue
.StartColor
+= 500;
335 _newValue
.StartIntensity
+= 10;
336 _newValue
.StepCount
+= 50;
337 _newValue
.Style
= com
.sun
.star
.awt
.GradientStyle
.RADIAL
;
338 _newValue
.XOffset
+= 10;
339 _newValue
.YOffset
+= 10;
340 newValue
= _newValue
;
343 if (oldValue
instanceof com
.sun
.star
.text
.GraphicCrop
){
344 com
.sun
.star
.text
.GraphicCrop _newValue
= (com
.sun
.star
.text
.GraphicCrop
)oldValue
;
345 _newValue
.Bottom
+= 10;
346 _newValue
.Left
+= 10;
347 _newValue
.Right
+= 10;
349 newValue
= _newValue
;
352 if (oldValue
instanceof com
.sun
.star
.drawing
.BitmapMode
){
353 com
.sun
.star
.drawing
.BitmapMode bm1
= com
.sun
.star
.drawing
.BitmapMode
.NO_REPEAT
;
354 com
.sun
.star
.drawing
.BitmapMode bm2
= com
.sun
.star
.drawing
.BitmapMode
.REPEAT
;
355 com
.sun
.star
.drawing
.BitmapMode bm3
= com
.sun
.star
.drawing
.BitmapMode
.STRETCH
;
356 if (oldValue
.equals(bm1
)) newValue
= bm2
;
357 if (oldValue
.equals(bm2
)) newValue
= bm3
;
358 if (oldValue
.equals(bm3
)) newValue
= bm3
;
361 if (oldValue
instanceof com
.sun
.star
.drawing
.TextAdjust
){
362 com
.sun
.star
.drawing
.TextAdjust TA1
= com
.sun
.star
.drawing
.TextAdjust
.BLOCK
;
363 com
.sun
.star
.drawing
.TextAdjust TA2
= com
.sun
.star
.drawing
.TextAdjust
.CENTER
;
364 com
.sun
.star
.drawing
.TextAdjust TA3
= com
.sun
.star
.drawing
.TextAdjust
.LEFT
;
365 com
.sun
.star
.drawing
.TextAdjust TA4
= com
.sun
.star
.drawing
.TextAdjust
.RIGHT
;
366 com
.sun
.star
.drawing
.TextAdjust TA5
= com
.sun
.star
.drawing
.TextAdjust
.STRETCH
;
367 if (oldValue
.equals(TA1
)) newValue
= TA2
;
368 if (oldValue
.equals(TA2
)) newValue
= TA3
;
369 if (oldValue
.equals(TA3
)) newValue
= TA4
;
370 if (oldValue
.equals(TA4
)) newValue
= TA5
;
371 if (oldValue
.equals(TA5
)) newValue
= TA1
;
373 if (oldValue
instanceof com
.sun
.star
.drawing
.TextFitToSizeType
){
374 com
.sun
.star
.drawing
.TextFitToSizeType TF1
= com
.sun
.star
.drawing
.TextFitToSizeType
.ALLLINES
;
375 com
.sun
.star
.drawing
.TextFitToSizeType TF2
= com
.sun
.star
.drawing
.TextFitToSizeType
.NONE
;
376 com
.sun
.star
.drawing
.TextFitToSizeType TF3
= com
.sun
.star
.drawing
.TextFitToSizeType
.PROPORTIONAL
;
377 com
.sun
.star
.drawing
.TextFitToSizeType TF4
= com
.sun
.star
.drawing
.TextFitToSizeType
.AUTOFIT
;
378 if (oldValue
.equals(TF1
)) newValue
= TF2
;
379 if (oldValue
.equals(TF2
)) newValue
= TF3
;
380 if (oldValue
.equals(TF3
)) newValue
= TF4
;
381 if (oldValue
.equals(TF4
)) newValue
= TF1
;
383 if (oldValue
instanceof com
.sun
.star
.drawing
.TextAnimationKind
){
384 com
.sun
.star
.drawing
.TextAnimationKind AK1
= com
.sun
.star
.drawing
.TextAnimationKind
.NONE
;
385 com
.sun
.star
.drawing
.TextAnimationKind AK2
= com
.sun
.star
.drawing
.TextAnimationKind
.SLIDE
;
386 com
.sun
.star
.drawing
.TextAnimationKind AK3
= com
.sun
.star
.drawing
.TextAnimationKind
.SCROLL
;
387 com
.sun
.star
.drawing
.TextAnimationKind AK4
= com
.sun
.star
.drawing
.TextAnimationKind
.BLINK
;
388 com
.sun
.star
.drawing
.TextAnimationKind AK5
= com
.sun
.star
.drawing
.TextAnimationKind
.ALTERNATE
;
390 if (oldValue
.equals(AK1
)) newValue
= AK2
;
391 if (oldValue
.equals(AK2
)) newValue
= AK3
;
392 if (oldValue
.equals(AK3
)) newValue
= AK4
;
393 if (oldValue
.equals(AK4
)) newValue
= AK5
;
394 if (oldValue
.equals(AK5
)) newValue
= AK1
;
396 if (oldValue
instanceof com
.sun
.star
.drawing
.TextAnimationDirection
){
397 com
.sun
.star
.drawing
.TextAnimationDirection AD1
= com
.sun
.star
.drawing
.TextAnimationDirection
.LEFT
;
398 com
.sun
.star
.drawing
.TextAnimationDirection AD2
= com
.sun
.star
.drawing
.TextAnimationDirection
.RIGHT
;
399 com
.sun
.star
.drawing
.TextAnimationDirection AD3
= com
.sun
.star
.drawing
.TextAnimationDirection
.DOWN
;
400 com
.sun
.star
.drawing
.TextAnimationDirection AD4
= com
.sun
.star
.drawing
.TextAnimationDirection
.UP
;
401 if (oldValue
.equals(AD1
)) newValue
= AD2
;
402 if (oldValue
.equals(AD2
)) newValue
= AD3
;
403 if (oldValue
.equals(AD3
)) newValue
= AD4
;
404 if (oldValue
.equals(AD4
)) newValue
= AD1
;
406 if (oldValue
instanceof com
.sun
.star
.drawing
.LineStyle
){
407 com
.sun
.star
.drawing
.LineStyle LS1
= com
.sun
.star
.drawing
.LineStyle
.NONE
;
408 com
.sun
.star
.drawing
.LineStyle LS2
= com
.sun
.star
.drawing
.LineStyle
.DASH
;
409 com
.sun
.star
.drawing
.LineStyle LS3
= com
.sun
.star
.drawing
.LineStyle
.SOLID
;
410 if (oldValue
.equals(LS1
)) newValue
= LS2
;
411 if (oldValue
.equals(LS2
)) newValue
= LS3
;
412 if (oldValue
.equals(LS3
)) newValue
= LS1
;
414 if (oldValue
instanceof com
.sun
.star
.drawing
.LineJoint
){
415 com
.sun
.star
.drawing
.LineJoint LJ1
= com
.sun
.star
.drawing
.LineJoint
.BEVEL
;
416 com
.sun
.star
.drawing
.LineJoint LJ2
= com
.sun
.star
.drawing
.LineJoint
.MIDDLE
;
417 com
.sun
.star
.drawing
.LineJoint LJ3
= com
.sun
.star
.drawing
.LineJoint
.MITER
;
418 com
.sun
.star
.drawing
.LineJoint LJ4
= com
.sun
.star
.drawing
.LineJoint
.NONE
;
419 com
.sun
.star
.drawing
.LineJoint LJ5
= com
.sun
.star
.drawing
.LineJoint
.ROUND
;
420 if (oldValue
.equals(LJ1
)) newValue
= LJ2
;
421 if (oldValue
.equals(LJ2
)) newValue
= LJ3
;
422 if (oldValue
.equals(LJ3
)) newValue
= LJ4
;
423 if (oldValue
.equals(LJ4
)) newValue
= LJ5
;
424 if (oldValue
.equals(LJ5
)) newValue
= LJ1
;
426 if (oldValue
instanceof com
.sun
.star
.drawing
.LineDash
){
427 com
.sun
.star
.drawing
.LineDash _newValue
= (com
.sun
.star
.drawing
.LineDash
)oldValue
;
428 _newValue
.Dashes
+= 1;
429 _newValue
.DashLen
+= 10;
430 _newValue
.Distance
+= 20;
431 _newValue
.DotLen
+= 10;
432 _newValue
.Dots
+= 10;
433 _newValue
.Style
= com
.sun
.star
.drawing
.DashStyle
.RECT
;
434 newValue
= _newValue
;
436 if (oldValue
instanceof com
.sun
.star
.drawing
.Hatch
){
437 com
.sun
.star
.drawing
.Hatch _newValue
= (com
.sun
.star
.drawing
.Hatch
) oldValue
;
438 _newValue
.Angle
+= 10;
439 _newValue
.Color
+= 1000;
440 _newValue
.Distance
+= 10;
441 _newValue
.Style
= com
.sun
.star
.drawing
.HatchStyle
.DOUBLE
;
443 if (oldValue
instanceof com
.sun
.star
.drawing
.RectanglePoint
){
444 com
.sun
.star
.drawing
.RectanglePoint RP1
= com
.sun
.star
.drawing
.RectanglePoint
.LEFT_BOTTOM
;
445 com
.sun
.star
.drawing
.RectanglePoint RP2
= com
.sun
.star
.drawing
.RectanglePoint
.LEFT_MIDDLE
;
446 com
.sun
.star
.drawing
.RectanglePoint RP3
= com
.sun
.star
.drawing
.RectanglePoint
.LEFT_TOP
;
447 com
.sun
.star
.drawing
.RectanglePoint RP4
= com
.sun
.star
.drawing
.RectanglePoint
.MIDDLE_BOTTOM
;
448 com
.sun
.star
.drawing
.RectanglePoint RP5
= com
.sun
.star
.drawing
.RectanglePoint
.MIDDLE_MIDDLE
;
449 com
.sun
.star
.drawing
.RectanglePoint RP6
= com
.sun
.star
.drawing
.RectanglePoint
.MIDDLE_TOP
;
450 com
.sun
.star
.drawing
.RectanglePoint RP7
= com
.sun
.star
.drawing
.RectanglePoint
.RIGHT_BOTTOM
;
451 com
.sun
.star
.drawing
.RectanglePoint RP8
= com
.sun
.star
.drawing
.RectanglePoint
.RIGHT_MIDDLE
;
452 com
.sun
.star
.drawing
.RectanglePoint RP9
= com
.sun
.star
.drawing
.RectanglePoint
.RIGHT_TOP
;
454 if (oldValue
.equals(RP1
)) newValue
= RP2
;
455 if (oldValue
.equals(RP2
)) newValue
= RP3
;
456 if (oldValue
.equals(RP3
)) newValue
= RP4
;
457 if (oldValue
.equals(RP4
)) newValue
= RP5
;
458 if (oldValue
.equals(RP5
)) newValue
= RP6
;
459 if (oldValue
.equals(RP6
)) newValue
= RP7
;
460 if (oldValue
.equals(RP7
)) newValue
= RP8
;
461 if (oldValue
.equals(RP8
)) newValue
= RP9
;
462 if (oldValue
.equals(RP9
)) newValue
= RP1
;
465 if (oldValue
instanceof com
.sun
.star
.chart
.ChartErrorCategory
){
466 com
.sun
.star
.chart
.ChartErrorCategory CC1
= com
.sun
.star
.chart
.ChartErrorCategory
.CONSTANT_VALUE
;
467 com
.sun
.star
.chart
.ChartErrorCategory CC2
= com
.sun
.star
.chart
.ChartErrorCategory
.ERROR_MARGIN
;
468 com
.sun
.star
.chart
.ChartErrorCategory CC3
= com
.sun
.star
.chart
.ChartErrorCategory
.NONE
;
469 com
.sun
.star
.chart
.ChartErrorCategory CC4
= com
.sun
.star
.chart
.ChartErrorCategory
.PERCENT
;
470 com
.sun
.star
.chart
.ChartErrorCategory CC5
= com
.sun
.star
.chart
.ChartErrorCategory
.STANDARD_DEVIATION
;
471 com
.sun
.star
.chart
.ChartErrorCategory CC6
= com
.sun
.star
.chart
.ChartErrorCategory
.VARIANCE
;
472 if (oldValue
.equals(CC1
)) newValue
= CC2
;
473 if (oldValue
.equals(CC2
)) newValue
= CC3
;
474 if (oldValue
.equals(CC3
)) newValue
= CC4
;
475 if (oldValue
.equals(CC4
)) newValue
= CC5
;
476 if (oldValue
.equals(CC5
)) newValue
= CC6
;
477 if (oldValue
.equals(CC6
)) newValue
= CC1
;
479 if (oldValue
instanceof com
.sun
.star
.chart
.ChartErrorIndicatorType
){
480 com
.sun
.star
.chart
.ChartErrorIndicatorType IT1
= com
.sun
.star
.chart
.ChartErrorIndicatorType
.LOWER
;
481 com
.sun
.star
.chart
.ChartErrorIndicatorType IT2
= com
.sun
.star
.chart
.ChartErrorIndicatorType
.NONE
;
482 com
.sun
.star
.chart
.ChartErrorIndicatorType IT3
= com
.sun
.star
.chart
.ChartErrorIndicatorType
.TOP_AND_BOTTOM
;
483 com
.sun
.star
.chart
.ChartErrorIndicatorType IT4
= com
.sun
.star
.chart
.ChartErrorIndicatorType
.UPPER
;
484 if (oldValue
.equals(IT1
)) newValue
= IT2
;
485 if (oldValue
.equals(IT2
)) newValue
= IT3
;
486 if (oldValue
.equals(IT3
)) newValue
= IT4
;
487 if (oldValue
.equals(IT4
)) newValue
= IT1
;
489 if (oldValue
instanceof com
.sun
.star
.chart
.ChartRegressionCurveType
){
490 com
.sun
.star
.chart
.ChartRegressionCurveType CT1
= com
.sun
.star
.chart
.ChartRegressionCurveType
.EXPONENTIAL
;
491 com
.sun
.star
.chart
.ChartRegressionCurveType CT2
= com
.sun
.star
.chart
.ChartRegressionCurveType
.LINEAR
;
492 com
.sun
.star
.chart
.ChartRegressionCurveType CT3
= com
.sun
.star
.chart
.ChartRegressionCurveType
.LOGARITHM
;
493 com
.sun
.star
.chart
.ChartRegressionCurveType CT4
= com
.sun
.star
.chart
.ChartRegressionCurveType
.NONE
;
494 com
.sun
.star
.chart
.ChartRegressionCurveType CT5
= com
.sun
.star
.chart
.ChartRegressionCurveType
.POLYNOMIAL
;
495 com
.sun
.star
.chart
.ChartRegressionCurveType CT6
= com
.sun
.star
.chart
.ChartRegressionCurveType
.POWER
;
496 if (oldValue
.equals(CT1
)) newValue
= CT2
;
497 if (oldValue
.equals(CT2
)) newValue
= CT3
;
498 if (oldValue
.equals(CT3
)) newValue
= CT4
;
499 if (oldValue
.equals(CT4
)) newValue
= CT5
;
500 if (oldValue
.equals(CT5
)) newValue
= CT6
;
501 if (oldValue
.equals(CT6
)) newValue
= CT1
;
504 if (oldValue
instanceof com
.sun
.star
.chart
.ChartDataRowSource
){
505 com
.sun
.star
.chart
.ChartDataRowSource RS1
= com
.sun
.star
.chart
.ChartDataRowSource
.COLUMNS
;
506 com
.sun
.star
.chart
.ChartDataRowSource RS2
= com
.sun
.star
.chart
.ChartDataRowSource
.ROWS
;
507 if (oldValue
.equals(RS1
)) newValue
= RS2
;
508 if (oldValue
.equals(RS2
)) newValue
= RS1
;
510 if (oldValue
instanceof com
.sun
.star
.awt
.FontDescriptor
){
511 com
.sun
.star
.awt
.FontDescriptor _newValue
= (com
.sun
.star
.awt
.FontDescriptor
)oldValue
;
512 _newValue
.CharacterWidth
+= 5;
513 _newValue
.CharSet
= com
.sun
.star
.awt
.CharSet
.ANSI
;
514 _newValue
.Family
= com
.sun
.star
.awt
.FontFamily
.DECORATIVE
;
515 _newValue
.Height
+= 2;
516 _newValue
.Kerning
= !_newValue
.Kerning
;
517 _newValue
.Name
= "Courier";
518 _newValue
.Orientation
+= 45;
519 _newValue
.Pitch
= com
.sun
.star
.awt
.FontPitch
.VARIABLE
;
520 _newValue
.Slant
= com
.sun
.star
.awt
.FontSlant
.REVERSE_ITALIC
;
521 _newValue
.Strikeout
= com
.sun
.star
.awt
.FontStrikeout
.X
;
522 _newValue
.StyleName
= "Bold";
523 _newValue
.Type
= com
.sun
.star
.awt
.FontType
.SCALABLE
;
524 _newValue
.Underline
= com
.sun
.star
.awt
.FontUnderline
.BOLDDASHDOTDOT
;
525 _newValue
.Weight
+= 5;
526 _newValue
.Width
+= 6;
527 _newValue
.WordLineMode
= !_newValue
.WordLineMode
;
529 newValue
= _newValue
;
531 if (oldValue
instanceof com
.sun
.star
.form
.NavigationBarMode
){
532 com
.sun
.star
.form
.NavigationBarMode BM1
= com
.sun
.star
.form
.NavigationBarMode
.CURRENT
;
533 com
.sun
.star
.form
.NavigationBarMode BM2
= com
.sun
.star
.form
.NavigationBarMode
.NONE
;
534 com
.sun
.star
.form
.NavigationBarMode BM3
= com
.sun
.star
.form
.NavigationBarMode
.PARENT
;
535 if (oldValue
.equals(BM1
)) newValue
= BM2
;
536 if (oldValue
.equals(BM2
)) newValue
= BM3
;
537 if (oldValue
.equals(BM3
)) newValue
= BM1
;
539 if (oldValue
instanceof com
.sun
.star
.form
.FormSubmitEncoding
){
540 com
.sun
.star
.form
.FormSubmitEncoding SE1
= com
.sun
.star
.form
.FormSubmitEncoding
.MULTIPART
;
541 com
.sun
.star
.form
.FormSubmitEncoding SE2
= com
.sun
.star
.form
.FormSubmitEncoding
.TEXT
;
542 com
.sun
.star
.form
.FormSubmitEncoding SE3
= com
.sun
.star
.form
.FormSubmitEncoding
.URL
;
543 if (oldValue
.equals(SE1
)) newValue
= SE2
;
544 if (oldValue
.equals(SE2
)) newValue
= SE3
;
545 if (oldValue
.equals(SE3
)) newValue
= SE1
;
547 if (oldValue
instanceof com
.sun
.star
.form
.FormSubmitMethod
){
548 com
.sun
.star
.form
.FormSubmitMethod FM1
= com
.sun
.star
.form
.FormSubmitMethod
.GET
;
549 com
.sun
.star
.form
.FormSubmitMethod FM2
= com
.sun
.star
.form
.FormSubmitMethod
.POST
;
550 if (oldValue
.equals(FM1
)) newValue
= FM2
;
551 if (oldValue
.equals(FM2
)) newValue
= FM1
;
554 if (oldValue
instanceof com
.sun
.star
.text
.SectionFileLink
){
555 com
.sun
.star
.text
.SectionFileLink _newValue
=
556 new com
.sun
.star
.text
.SectionFileLink();
558 _newValue
.FileURL
= util
.utils
.getFullTestURL("SwXTextSection.sdw");
562 if (oldValue
instanceof com
.sun
.star
.table
.BorderLine
){
563 com
.sun
.star
.table
.BorderLine _newValue
= (com
.sun
.star
.table
.BorderLine
)oldValue
;
564 _newValue
.Color
+= 2;
565 _newValue
.InnerLineWidth
+= 2;
566 _newValue
.LineDistance
+= 2;
567 _newValue
.OuterLineWidth
+= 3;
571 if (oldValue
instanceof com
.sun
.star
.text
.XTextColumns
){
572 com
.sun
.star
.text
.XTextColumns _newValue
= (com
.sun
.star
.text
.XTextColumns
)oldValue
;
573 _newValue
.setColumnCount((short)1);
577 if (oldValue
instanceof com
.sun
.star
.form
.FormButtonType
){
578 com
.sun
.star
.form
.FormButtonType BT1
= com
.sun
.star
.form
.FormButtonType
.PUSH
;
579 com
.sun
.star
.form
.FormButtonType BT2
= com
.sun
.star
.form
.FormButtonType
.RESET
;
580 com
.sun
.star
.form
.FormButtonType BT3
= com
.sun
.star
.form
.FormButtonType
.SUBMIT
;
581 com
.sun
.star
.form
.FormButtonType BT4
= com
.sun
.star
.form
.FormButtonType
.URL
;
583 if (oldValue
.equals(BT1
)) newValue
= BT2
;
584 if (oldValue
.equals(BT2
)) newValue
= BT3
;
585 if (oldValue
.equals(BT3
)) newValue
= BT4
;
586 if (oldValue
.equals(BT4
)) newValue
= BT1
;
589 if (oldValue
instanceof com
.sun
.star
.form
.ListSourceType
){
590 com
.sun
.star
.form
.ListSourceType ST1
= com
.sun
.star
.form
.ListSourceType
.QUERY
;
591 com
.sun
.star
.form
.ListSourceType ST2
= com
.sun
.star
.form
.ListSourceType
.SQL
;
592 com
.sun
.star
.form
.ListSourceType ST3
= com
.sun
.star
.form
.ListSourceType
.SQLPASSTHROUGH
;
593 com
.sun
.star
.form
.ListSourceType ST4
= com
.sun
.star
.form
.ListSourceType
.TABLE
;
594 com
.sun
.star
.form
.ListSourceType ST5
= com
.sun
.star
.form
.ListSourceType
.TABLEFIELDS
;
595 com
.sun
.star
.form
.ListSourceType ST6
= com
.sun
.star
.form
.ListSourceType
.VALUELIST
;
596 if (oldValue
.equals(ST1
)) newValue
= ST2
;
597 if (oldValue
.equals(ST2
)) newValue
= ST3
;
598 if (oldValue
.equals(ST3
)) newValue
= ST4
;
599 if (oldValue
.equals(ST4
)) newValue
= ST5
;
600 if (oldValue
.equals(ST5
)) newValue
= ST6
;
601 if (oldValue
.equals(ST6
)) newValue
= ST1
;
603 if (oldValue
instanceof com
.sun
.star
.table
.BorderLine
){
604 com
.sun
.star
.table
.BorderLine _newValue
= (com
.sun
.star
.table
.BorderLine
)oldValue
;
605 _newValue
.Color
+= 1000;
606 _newValue
.InnerLineWidth
+= 2;
607 _newValue
.LineDistance
+=3;
608 _newValue
.OuterLineWidth
+= 3;
609 newValue
= _newValue
;
611 if (oldValue
instanceof com
.sun
.star
.sheet
.DataPilotFieldOrientation
) {
612 com
.sun
.star
.sheet
.DataPilotFieldOrientation FO1
= com
.sun
.star
.sheet
.DataPilotFieldOrientation
.PAGE
;
613 com
.sun
.star
.sheet
.DataPilotFieldOrientation FO2
= com
.sun
.star
.sheet
.DataPilotFieldOrientation
.COLUMN
;
614 com
.sun
.star
.sheet
.DataPilotFieldOrientation FO3
= com
.sun
.star
.sheet
.DataPilotFieldOrientation
.DATA
;
615 com
.sun
.star
.sheet
.DataPilotFieldOrientation FO4
= com
.sun
.star
.sheet
.DataPilotFieldOrientation
.HIDDEN
;
616 com
.sun
.star
.sheet
.DataPilotFieldOrientation FO5
= com
.sun
.star
.sheet
.DataPilotFieldOrientation
.ROW
;
617 if (oldValue
.equals(FO1
)) newValue
= FO2
;
618 if (oldValue
.equals(FO2
)) newValue
= FO3
;
619 if (oldValue
.equals(FO3
)) newValue
= FO4
;
620 if (oldValue
.equals(FO4
)) newValue
= FO5
;
621 if (oldValue
.equals(FO5
)) newValue
= FO1
;
623 if (oldValue
instanceof com
.sun
.star
.sheet
.GeneralFunction
) {
624 com
.sun
.star
.sheet
.GeneralFunction GF1
= com
.sun
.star
.sheet
.GeneralFunction
.NONE
;
625 com
.sun
.star
.sheet
.GeneralFunction GF2
= com
.sun
.star
.sheet
.GeneralFunction
.AVERAGE
;
626 com
.sun
.star
.sheet
.GeneralFunction GF3
= com
.sun
.star
.sheet
.GeneralFunction
.COUNT
;
627 com
.sun
.star
.sheet
.GeneralFunction GF4
= com
.sun
.star
.sheet
.GeneralFunction
.COUNTNUMS
;
628 com
.sun
.star
.sheet
.GeneralFunction GF5
= com
.sun
.star
.sheet
.GeneralFunction
.MAX
;
629 com
.sun
.star
.sheet
.GeneralFunction GF6
= com
.sun
.star
.sheet
.GeneralFunction
.MIN
;
630 com
.sun
.star
.sheet
.GeneralFunction GF7
= com
.sun
.star
.sheet
.GeneralFunction
.AUTO
;
631 com
.sun
.star
.sheet
.GeneralFunction GF8
= com
.sun
.star
.sheet
.GeneralFunction
.PRODUCT
;
632 com
.sun
.star
.sheet
.GeneralFunction GF9
= com
.sun
.star
.sheet
.GeneralFunction
.STDEV
;
633 com
.sun
.star
.sheet
.GeneralFunction GF10
= com
.sun
.star
.sheet
.GeneralFunction
.STDEVP
;
634 com
.sun
.star
.sheet
.GeneralFunction GF11
= com
.sun
.star
.sheet
.GeneralFunction
.SUM
;
635 com
.sun
.star
.sheet
.GeneralFunction GF12
= com
.sun
.star
.sheet
.GeneralFunction
.VAR
;
636 com
.sun
.star
.sheet
.GeneralFunction GF13
= com
.sun
.star
.sheet
.GeneralFunction
.VARP
;
638 if (oldValue
.equals(GF1
)) newValue
= GF2
;
639 if (oldValue
.equals(GF2
)) newValue
= GF3
;
640 if (oldValue
.equals(GF3
)) newValue
= GF4
;
641 if (oldValue
.equals(GF4
)) newValue
= GF5
;
642 if (oldValue
.equals(GF5
)) newValue
= GF6
;
643 if (oldValue
.equals(GF6
)) newValue
= GF7
;
644 if (oldValue
.equals(GF7
)) newValue
= GF8
;
645 if (oldValue
.equals(GF8
)) newValue
= GF9
;
646 if (oldValue
.equals(GF9
)) newValue
= GF10
;
647 if (oldValue
.equals(GF10
)) newValue
= GF11
;
648 if (oldValue
.equals(GF11
)) newValue
= GF12
;
649 if (oldValue
.equals(GF12
)) newValue
= GF13
;
650 if (oldValue
.equals(GF13
)) newValue
= GF1
;
653 if (oldValue
instanceof com
.sun
.star
.table
.CellAddress
){
654 com
.sun
.star
.table
.CellAddress _newValue
= (com
.sun
.star
.table
.CellAddress
)oldValue
;
655 _newValue
.Column
+= 1;
657 newValue
= _newValue
;
660 if (oldValue
instanceof com
.sun
.star
.table
.TableOrientation
){
661 com
.sun
.star
.table
.TableOrientation TO1
= com
.sun
.star
.table
.TableOrientation
.COLUMNS
;
662 com
.sun
.star
.table
.TableOrientation TO2
= com
.sun
.star
.table
.TableOrientation
.ROWS
;
663 if (oldValue
.equals(TO1
)) newValue
= TO2
; else newValue
= TO1
;
666 if (oldValue
instanceof com
.sun
.star
.sheet
.DataImportMode
){
667 com
.sun
.star
.sheet
.DataImportMode DIM1
= com
.sun
.star
.sheet
.DataImportMode
.NONE
;
668 com
.sun
.star
.sheet
.DataImportMode DIM2
= com
.sun
.star
.sheet
.DataImportMode
.QUERY
;
669 com
.sun
.star
.sheet
.DataImportMode DIM3
= com
.sun
.star
.sheet
.DataImportMode
.SQL
;
670 com
.sun
.star
.sheet
.DataImportMode DIM4
= com
.sun
.star
.sheet
.DataImportMode
.TABLE
;
672 if (oldValue
.equals(DIM1
)) newValue
= DIM2
;
673 if (oldValue
.equals(DIM2
)) newValue
= DIM3
;
674 if (oldValue
.equals(DIM3
)) newValue
= DIM4
;
675 if (oldValue
.equals(DIM4
)) newValue
= DIM1
;
679 // if (oldValue instanceof com.sun.star.text.TableColumnSeparator[]){
680 // com.sun.star.text.TableColumnSeparator[] _newValue = (com.sun.star.text.TableColumnSeparator[]) oldValue;
681 // com.sun.star.text.TableColumnSeparator sep = new com.sun.star.text.TableColumnSeparator();
682 // sep.IsVisible = ! _newValue[0].IsVisible;
683 // _newValue[0] = sep;
684 // newValue = _newValue;
687 if (oldValue
instanceof com
.sun
.star
.style
.BreakType
){
688 com
.sun
.star
.style
.BreakType BT1
= com
.sun
.star
.style
.BreakType
.COLUMN_AFTER
;
689 com
.sun
.star
.style
.BreakType BT2
= com
.sun
.star
.style
.BreakType
.COLUMN_BEFORE
;
690 com
.sun
.star
.style
.BreakType BT3
= com
.sun
.star
.style
.BreakType
.COLUMN_BOTH
;
691 com
.sun
.star
.style
.BreakType BT4
= com
.sun
.star
.style
.BreakType
.PAGE_AFTER
;
692 com
.sun
.star
.style
.BreakType BT5
= com
.sun
.star
.style
.BreakType
.PAGE_BEFORE
;
693 com
.sun
.star
.style
.BreakType BT6
= com
.sun
.star
.style
.BreakType
.PAGE_BOTH
;
694 com
.sun
.star
.style
.BreakType BT7
= com
.sun
.star
.style
.BreakType
.NONE
;
695 if (oldValue
.equals(BT1
)) newValue
= BT2
;
696 if (oldValue
.equals(BT2
)) newValue
= BT3
;
697 if (oldValue
.equals(BT3
)) newValue
= BT4
;
698 if (oldValue
.equals(BT4
)) newValue
= BT5
;
699 if (oldValue
.equals(BT6
)) newValue
= BT6
;
700 if (oldValue
.equals(BT6
)) newValue
= BT7
;
701 if (oldValue
.equals(BT7
)) newValue
= BT1
;
703 if (oldValue
instanceof PropertyValue
){
704 PropertyValue newVal
= new PropertyValue();
705 newVal
.Name
= ((PropertyValue
)oldValue
).Name
;
706 newVal
.Value
= changePValue(((PropertyValue
)oldValue
).Value
);
709 if (oldValue
instanceof com
.sun
.star
.sheet
.ValidationAlertStyle
){
710 com
.sun
.star
.sheet
.ValidationAlertStyle VAS1
= com
.sun
.star
.sheet
.ValidationAlertStyle
.INFO
;
711 com
.sun
.star
.sheet
.ValidationAlertStyle VAS2
= com
.sun
.star
.sheet
.ValidationAlertStyle
.MACRO
;
712 com
.sun
.star
.sheet
.ValidationAlertStyle VAS3
= com
.sun
.star
.sheet
.ValidationAlertStyle
.STOP
;
713 com
.sun
.star
.sheet
.ValidationAlertStyle VAS4
= com
.sun
.star
.sheet
.ValidationAlertStyle
.WARNING
;
715 if (oldValue
.equals(VAS1
)) newValue
= VAS2
;
716 if (oldValue
.equals(VAS2
)) newValue
= VAS3
;
717 if (oldValue
.equals(VAS3
)) newValue
= VAS4
;
718 if (oldValue
.equals(VAS4
)) newValue
= VAS1
;
721 if (oldValue
instanceof com
.sun
.star
.sheet
.ValidationType
){
722 com
.sun
.star
.sheet
.ValidationType VT1
= com
.sun
.star
.sheet
.ValidationType
.ANY
;
723 com
.sun
.star
.sheet
.ValidationType VT2
= com
.sun
.star
.sheet
.ValidationType
.CUSTOM
;
724 com
.sun
.star
.sheet
.ValidationType VT3
= com
.sun
.star
.sheet
.ValidationType
.DATE
;
725 com
.sun
.star
.sheet
.ValidationType VT4
= com
.sun
.star
.sheet
.ValidationType
.DECIMAL
;
726 com
.sun
.star
.sheet
.ValidationType VT5
= com
.sun
.star
.sheet
.ValidationType
.LIST
;
727 com
.sun
.star
.sheet
.ValidationType VT6
= com
.sun
.star
.sheet
.ValidationType
.TEXT_LEN
;
728 com
.sun
.star
.sheet
.ValidationType VT7
= com
.sun
.star
.sheet
.ValidationType
.TIME
;
729 com
.sun
.star
.sheet
.ValidationType VT8
= com
.sun
.star
.sheet
.ValidationType
.WHOLE
;
731 if (oldValue
.equals(VT1
)) newValue
= VT2
;
732 if (oldValue
.equals(VT2
)) newValue
= VT3
;
733 if (oldValue
.equals(VT3
)) newValue
= VT4
;
734 if (oldValue
.equals(VT4
)) newValue
= VT5
;
735 if (oldValue
.equals(VT5
)) newValue
= VT6
;
736 if (oldValue
.equals(VT6
)) newValue
= VT7
;
737 if (oldValue
.equals(VT7
)) newValue
= VT8
;
738 if (oldValue
.equals(VT8
)) newValue
= VT1
;
741 if (oldValue
instanceof com
.sun
.star
.text
.WritingMode
){
742 if (oldValue
.equals(com
.sun
.star
.text
.WritingMode
.LR_TB
)) {
743 newValue
= com
.sun
.star
.text
.WritingMode
.TB_RL
;
745 newValue
= com
.sun
.star
.text
.WritingMode
.LR_TB
;
748 if (oldValue
instanceof com
.sun
.star
.uno
.Enum
) {
749 // universal changer for Enumerations
751 Class
<?
> enumClass
= oldValue
.getClass() ;
752 Field
[] flds
= enumClass
.getFields() ;
756 for (int i
= 0; i
< flds
.length
; i
++) {
757 if (Enum
.class.equals(flds
[i
].getType().getSuperclass())) {
759 Enum value
= (Enum
) flds
[i
].get(null) ;
760 if (newValue
== null && !value
.equals(oldValue
)) {
766 } catch (Exception e
) {
767 System
.err
.println("Exception occurred while changing Enumeration value:") ;
768 e
.printStackTrace(System
.err
) ;
770 if (newValue
== null) newValue
= oldValue
;
773 if (oldValue
instanceof com
.sun
.star
.style
.TabStop
[]){
774 com
.sun
.star
.style
.TabStop
[] _newValue
= (com
.sun
.star
.style
.TabStop
[]) oldValue
;
775 if (_newValue
.length
== 0) {
776 _newValue
= new com
.sun
.star
.style
.TabStop
[1];
778 com
.sun
.star
.style
.TabStop sep
= new com
.sun
.star
.style
.TabStop();
781 newValue
= _newValue
;
783 if (oldValue
instanceof short[]){
784 short[] oldArr
= (short[])oldValue
;
785 int len
= oldArr
.length
;
786 short[] newArr
= new short[len
+ 1];
787 for (int i
= 0; i
< len
; i
++) {
788 newArr
[i
] = (short)(oldArr
[i
] + 1);
793 if (oldValue
instanceof String
[]){
794 String
[] oldArr
= (String
[])oldValue
;
795 int len
= oldArr
.length
;
796 String
[] newArr
= new String
[len
+ 1];
797 for (int i
= 0; i
< len
; i
++) {
798 newArr
[i
] = "_" + oldArr
[i
];
800 newArr
[len
] = "_dummy";
803 if (oldValue
instanceof PropertyValue
){
804 PropertyValue newVal
= new PropertyValue();
805 newVal
.Name
= ((PropertyValue
)oldValue
).Name
;
806 newVal
.Value
= changePValue(((PropertyValue
)oldValue
).Value
);
809 if (oldValue
instanceof com
.sun
.star
.util
.Date
) {
810 com
.sun
.star
.util
.Date oldD
= (com
.sun
.star
.util
.Date
) oldValue
;
811 com
.sun
.star
.util
.Date newD
= new com
.sun
.star
.util
.Date();
812 newD
.Day
= (short) (oldD
.Day
+(short) 1);
815 if (oldValue
instanceof com
.sun
.star
.util
.DateTime
) {
816 com
.sun
.star
.util
.DateTime oldDT
= (com
.sun
.star
.util
.DateTime
) oldValue
;
817 com
.sun
.star
.util
.DateTime newDT
= new com
.sun
.star
.util
.DateTime();
818 newDT
.Day
= (short) (oldDT
.Day
+(short) 1);
819 newDT
.Hours
= (short) (oldDT
.Hours
+(short) 1);
822 if (oldValue
instanceof com
.sun
.star
.util
.Time
) {
823 com
.sun
.star
.util
.Time oldT
= (com
.sun
.star
.util
.Time
) oldValue
;
824 com
.sun
.star
.util
.Time newT
= new com
.sun
.star
.util
.Time();
825 newT
.Hours
= (short) (oldT
.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)) ;