-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLibreOfficeCalc_Page.au3
2786 lines (2458 loc) · 203 KB
/
LibreOfficeCalc_Page.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#Tidy_Parameters=/sf
#include-once
; Main LibreOffice Includes
#include "LibreOffice_Constants.au3"
; Common includes for Calc
#include "LibreOfficeCalc_Internal.au3"
; Other includes for Calc
; #INDEX# =======================================================================================================================
; Title .........: LibreOffice UDF
; AutoIt Version : v3.3.16.1
; Description ...: Provides basic functionality through AutoIt for Creating, Modifying, Removing, applying etc. L.O. Calc Page Styles.
; Author(s) .....: donnyh13, mLipok
; Dll ...........:
;
; ===============================================================================================================================
; #CURRENT# =====================================================================================================================
; _LOCalc_PageStyleAreaColor
; _LOCalc_PageStyleBorderColor
; _LOCalc_PageStyleBorderPadding
; _LOCalc_PageStyleBorderStyle
; _LOCalc_PageStyleBorderWidth
; _LOCalc_PageStyleCreate
; _LOCalc_PageStyleDelete
; _LOCalc_PageStyleExists
; _LOCalc_PageStyleFooter
; _LOCalc_PageStyleFooterAreaColor
; _LOCalc_PageStyleFooterBorderColor
; _LOCalc_PageStyleFooterBorderPadding
; _LOCalc_PageStyleFooterBorderStyle
; _LOCalc_PageStyleFooterBorderWidth
; _LOCalc_PageStyleFooterCreateTextCursor
; _LOCalc_PageStyleFooterObj
; _LOCalc_PageStyleFooterShadow
; _LOCalc_PageStyleGetObj
; _LOCalc_PageStyleHeader
; _LOCalc_PageStyleHeaderAreaColor
; _LOCalc_PageStyleHeaderBorderColor
; _LOCalc_PageStyleHeaderBorderPadding
; _LOCalc_PageStyleHeaderBorderStyle
; _LOCalc_PageStyleHeaderBorderWidth
; _LOCalc_PageStyleHeaderCreateTextCursor
; _LOCalc_PageStyleHeaderObj
; _LOCalc_PageStyleHeaderShadow
; _LOCalc_PageStyleLayout
; _LOCalc_PageStyleMargins
; _LOCalc_PageStyleOrganizer
; _LOCalc_PageStylePaperFormat
; _LOCalc_PageStyleSet
; _LOCalc_PageStylesGetNames
; _LOCalc_PageStyleShadow
; _LOCalc_PageStyleSheetPageOrder
; _LOCalc_PageStyleSheetPrint
; _LOCalc_PageStyleSheetScale
; ===============================================================================================================================
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleAreaColor
; Description ...: Set or Retrieve background color settings for a Page style.
; Syntax ........: _LOCalc_PageStyleAreaColor(ByRef $oPageStyle[, $iBackColor = Null[, $bBackTransparent = Null]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iBackColor - [optional] an integer value (-1-16777215). Default is Null. The color to make the background. Set in Long integer format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3. Set to $LOC_COLOR_OFF(-1) for "None".
; $bBackTransparent - [optional] a boolean value. Default is Null. If True, the background color is transparent.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iBackColor not an integer, less than -1, or greater than 16777215.
; @Error 1 @Extended 4 Return 0 = $bBackTransparent not a Boolean.
; --Property Setting Errors--
; @Error 4 @Extended ? Return 0 = Some settings were not successfully set. Use BitAND to test @Extended for the following values:
; | 1 = Error setting $iBackColor
; | 2 = Error setting $bBackTransparent
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 2 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_ConvertColorFromLong, _LOCalc_ConvertColorToLong
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleAreaColor(ByRef $oPageStyle, $iBackColor = Null, $bBackTransparent = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $avColor[2]
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If __LOCalc_VarsAreNull($iBackColor, $bBackTransparent) Then
__LOCalc_ArrayFill($avColor, $oPageStyle.BackColor(), $oPageStyle.BackTransparent())
Return SetError($__LO_STATUS_SUCCESS, 1, $avColor)
EndIf
If ($iBackColor <> Null) Then
If Not __LOCalc_IntIsBetween($iBackColor, $LOC_COLOR_OFF, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
$oPageStyle.BackColor = $iBackColor
$iError = ($oPageStyle.BackColor() = $iBackColor) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($bBackTransparent <> Null) Then
If Not IsBool($bBackTransparent) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
$oPageStyle.BackTransparent = $bBackTransparent
$iError = ($oPageStyle.BackTransparent() = $bBackTransparent) ? ($iError) : (BitOR($iError, 2))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>_LOCalc_PageStyleAreaColor
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleBorderColor
; Description ...: Set the Page Style Border Line Color. Libre Office Version 3.6 and Up.
; Syntax ........: _LOCalc_PageStyleBorderColor(ByRef $oPageStyle[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iTop - [optional] an integer value (0-16777215). Default is Null. Set the Top Border Line Color of the Page in Long Color code format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3.
; $iBottom - [optional] an integer value (0-16777215). Default is Null. Set the Bottom Border Line Color of the Page in Long Color code format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3.
; $iLeft - [optional] an integer value (0-16777215). Default is Null. Set the Left Border Line Color of the Page in Long Color code format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3.
; $iRight - [optional] an integer value (0-16777215). Default is Null. Set the Right Border Line Color of the Page in Long Color code format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iTop not an integer, or set to less than 0, or greater than 16,777,215.
; @Error 1 @Extended 4 Return 0 = $iBottom not an integer, or set to less than 0, or greater than 16,777,215.
; @Error 1 @Extended 5 Return 0 = $iLeft not an integer, or set to less than 0, or greater than 16,777,215.
; @Error 1 @Extended 6 Return 0 = $iRight not an integer, or set to less than 0, or greater than 16,777,215.
; @Error 1 @Extended 7 Return 0 = Variable passed to internal function not an Object.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Error Creating Object "com.sun.star.table.BorderLine2"
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Internal command error. More than one set to True. UDF Must be fixed.
; --Property Setting Errors--
; @Error 4 @Extended 1 Return 0 = Cannot set Top Border Color when Top Border width not set.
; @Error 4 @Extended 2 Return 0 = Cannot set Bottom Border Color when Bottom Border width not set.
; @Error 4 @Extended 3 Return 0 = Cannot set Left Border Color when Left Border width not set.
; @Error 4 @Extended 4 Return 0 = Cannot set Right Border Color when Right Border width not set.
; --Version Related Errors--
; @Error 7 @Extended 1 Return 0 = Current Libre Office version lower than 3.6.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 4 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Border Width must be set first to be able to set Border Style and Color.
; Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_ConvertColorFromLong, _LOCalc_ConvertColorToLong, _LOCalc_PageStyleBorderWidth, _LOCalc_PageStyleBorderStyle, _LOCalc_PageStyleBorderPadding
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleBorderColor(ByRef $oPageStyle, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($iTop <> Null) And Not __LOCalc_IntIsBetween($iTop, $LOC_COLOR_BLACK, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($iBottom <> Null) And Not __LOCalc_IntIsBetween($iBottom, $LOC_COLOR_BLACK, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If ($iLeft <> Null) And Not __LOCalc_IntIsBetween($iLeft, $LOC_COLOR_BLACK, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($iRight <> Null) And Not __LOCalc_IntIsBetween($iRight, $LOC_COLOR_BLACK, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$vReturn = __LOCalc_PageStyleBorder($oPageStyle, False, False, True, $iTop, $iBottom, $iLeft, $iRight)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOCalc_PageStyleBorderColor
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleBorderPadding
; Description ...: Set or retrieve the Page Style Border Padding settings.
; Syntax ........: _LOCalc_PageStyleBorderPadding(ByRef $oPageStyle[, $iAll = Null[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iAll - [optional] an integer value. Default is Null. Set all four padding distances to one distance in Micrometers (uM).
; $iTop - [optional] an integer value. Default is Null. Set the Top Distance between the Border and Page contents in Micrometers(uM).
; $iBottom - [optional] an integer value. Default is Null. Set the Bottom Distance between the Border and Page contents in Micrometers(uM).
; $iLeft - [optional] an integer value. Default is Null. Set the Left Distance between the Border and Page contents in Micrometers(uM).
; $iRight - [optional] an integer value. Default is Null. Set the Right Distance between the Border and Page contents in Micrometers(uM).
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iAll not an Integer.
; @Error 1 @Extended 4 Return 0 = $iTop not an Integer.
; @Error 1 @Extended 5 Return 0 = $iBottom not an Integer.
; @Error 1 @Extended 6 Return 0 = $Left not an Integer.
; @Error 1 @Extended 7 Return 0 = $iRight not an Integer.
; --Property Setting Errors--
; @Error 4 @Extended ? Return 0 = Some settings were not successfully set. Use BitAND to test @Extended for the following values:
; | 1 = Error setting $iAll border distance
; | 2 = Error setting $iTop border distance
; | 4 = Error setting $iBottom border distance
; | 8 = Error setting $iLeft border distance
; | 16 = Error setting $iRight border distance
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 5 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_ConvertFromMicrometer, _LOCalc_ConvertToMicrometer, _LOCalc_PageStyleBorderWidth, _LOCalc_PageStyleBorderStyle, _LOCalc_PageStyleBorderColor
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleBorderPadding(ByRef $oPageStyle, $iAll = Null, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $aiBPadding[5]
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If __LOCalc_VarsAreNull($iAll, $iTop, $iBottom, $iLeft, $iRight) Then
__LOCalc_ArrayFill($aiBPadding, $oPageStyle.BorderDistance(), $oPageStyle.TopBorderDistance(), _
$oPageStyle.BottomBorderDistance(), $oPageStyle.LeftBorderDistance(), $oPageStyle.RightBorderDistance())
Return SetError($__LO_STATUS_SUCCESS, 1, $aiBPadding)
EndIf
If ($iAll <> Null) Then
If Not __LOCalc_IntIsBetween($iAll, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
$oPageStyle.BorderDistance = $iAll
$iError = (__LOCalc_IntIsBetween($oPageStyle.BorderDistance(), $iAll - 1, $iAll + 1)) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($iTop <> Null) Then
If Not __LOCalc_IntIsBetween($iTop, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
$oPageStyle.TopBorderDistance = $iTop
$iError = (__LOCalc_IntIsBetween($oPageStyle.TopBorderDistance(), $iTop - 1, $iTop + 1)) ? ($iError) : (BitOR($iError, 2))
EndIf
If ($iBottom <> Null) Then
If Not __LOCalc_IntIsBetween($iBottom, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
$oPageStyle.BottomBorderDistance = $iBottom
$iError = (__LOCalc_IntIsBetween($oPageStyle.BottomBorderDistance(), $iBottom - 1, $iBottom + 1)) ? ($iError) : (BitOR($iError, 4))
EndIf
If ($iLeft <> Null) Then
If Not __LOCalc_IntIsBetween($iLeft, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$oPageStyle.LeftBorderDistance = $iLeft
$iError = (__LOCalc_IntIsBetween($oPageStyle.LeftBorderDistance(), $iLeft - 1, $iLeft + 1)) ? ($iError) : (BitOR($iError, 8))
EndIf
If ($iRight <> Null) Then
If Not __LOCalc_IntIsBetween($iRight, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 7, 0)
$oPageStyle.RightBorderDistance = $iRight
$iError = (__LOCalc_IntIsBetween($oPageStyle.RightBorderDistance(), $iRight - 1, $iRight + 1)) ? ($iError) : (BitOR($iError, 16))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>_LOCalc_PageStyleBorderPadding
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleBorderStyle
; Description ...: Set or Retrieve the Page Style Border Line style. Libre Office Version 3.6 and Up.
; Syntax ........: _LOCalc_PageStyleBorderStyle(ByRef $oPageStyle[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iTop - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Top Border Line Style of the Page using one of the line style constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; $iBottom - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Bottom Border Line Style of the Page using one of the line style constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; $iLeft - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Left Border Line Style of the Page using one of the line style constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; $iRight - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Right Border Line Style of the Page using one of the line style constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iTop not an integer, or set to higher than 17, and not equal to 0x7FFF, or less than 0. See constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; @Error 1 @Extended 4 Return 0 = $iBottom not an integer, or set to higher than 17, and not equal to 0x7FFF, or less than 0. See constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; @Error 1 @Extended 5 Return 0 = $iLeft not an integer, or set to higher than 17, and not equal to 0x7FFF, or less than 0. See constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; @Error 1 @Extended 6 Return 0 = $iRight not an integer, or set to higher than 17, and not equal to 0x7FFF, or less than 0. See constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; @Error 1 @Extended 7 Return 0 = Variable passed to internal function not an Object.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Error Creating Object "com.sun.star.table.BorderLine2"
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Internal command error. More than one set to True. UDF Must be fixed.
; --Property Setting Errors--
; @Error 4 @Extended 1 Return 0 = Cannot set Top Border Style when Top Border width not set.
; @Error 4 @Extended 2 Return 0 = Cannot set Bottom Border Style when Bottom Border width not set.
; @Error 4 @Extended 3 Return 0 = Cannot set Left Border Style when Left Border width not set.
; @Error 4 @Extended 4 Return 0 = Cannot set Right Border Style when Right Border width not set.
; --Version Related Errors--
; @Error 7 @Extended 1 Return 0 = Current Libre Office version lower than 3.6.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 4 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Border Width must be set first to be able to set Border Style and Color.
; Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_PageStyleBorderWidth, _LOCalc_PageStyleBorderColor, _LOCalc_PageStyleBorderPadding
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleBorderStyle(ByRef $oPageStyle, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($iTop <> Null) And Not __LOCalc_IntIsBetween($iTop, $LOC_BORDERSTYLE_SOLID, $LOC_BORDERSTYLE_DASH_DOT_DOT, "", $LOC_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($iBottom <> Null) And Not __LOCalc_IntIsBetween($iBottom, $LOC_BORDERSTYLE_SOLID, $LOC_BORDERSTYLE_DASH_DOT_DOT, "", $LOC_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If ($iLeft <> Null) And Not __LOCalc_IntIsBetween($iLeft, $LOC_BORDERSTYLE_SOLID, $LOC_BORDERSTYLE_DASH_DOT_DOT, "", $LOC_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($iRight <> Null) And Not __LOCalc_IntIsBetween($iRight, $LOC_BORDERSTYLE_SOLID, $LOC_BORDERSTYLE_DASH_DOT_DOT, "", $LOC_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$vReturn = __LOCalc_PageStyleBorder($oPageStyle, False, True, False, $iTop, $iBottom, $iLeft, $iRight)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOCalc_PageStyleBorderStyle
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleBorderWidth
; Description ...: Set or Retrieve the Page Style Border Line Width. Libre Office Version 3.6 and Up.
; Syntax ........: _LOCalc_PageStyleBorderWidth(ByRef $oPageStyle[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iTop - [optional] an integer value. Default is Null. Set the Top Border Line width of the Page in Micrometers. Can be a custom value, or one of the constants, $LOC_BORDERWIDTH_* as defined in LibreOfficeCalc_Constants.au3.
; $iBottom - [optional] an integer value. Default is Null. Set the Bottom Border Line Width of the Page in Micrometers. Can be a custom value, or one of the constants, $LOC_BORDERWIDTH_* as defined in LibreOfficeCalc_Constants.au3.
; $iLeft - [optional] an integer value. Default is Null. Set the Left Border Line width of the Page in Micrometers. Can be a custom value, or one of the constants, $LOC_BORDERWIDTH_* as defined in LibreOfficeCalc_Constants.au3.
; $iRight - [optional] an integer value. Default is Null. Set the Right Border Line Width of the Page in Micrometers. Can be a custom value, or one of the constants, $LOC_BORDERWIDTH_* as defined in LibreOfficeCalc_Constants.au3.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iTop not an integer, or set to less than 0.
; @Error 1 @Extended 4 Return 0 = $iBottom not an integer, or set to less than 0.
; @Error 1 @Extended 5 Return 0 = $iLeft not an integer, or set to less than 0.
; @Error 1 @Extended 6 Return 0 = $iRight not an integer, or set to less than 0.
; @Error 1 @Extended 7 Return 0 = Variable passed to internal function not an Object.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Error Creating Object "com.sun.star.table.BorderLine2"
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Internal command error. More than one set to True. UDF Must be fixed.
; --Version Related Errors--
; @Error 7 @Extended 1 Return 0 = Current Libre Office version lower than 3.6.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 4 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: To "Turn Off" Borders, set Width to 0
; Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_ConvertFromMicrometer, _LOCalc_ConvertToMicrometer, _LOCalc_PageStyleBorderStyle, _LOCalc_PageStyleBorderColor, _LOCalc_PageStyleBorderPadding
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleBorderWidth(ByRef $oPageStyle, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($iTop <> Null) And Not __LOCalc_IntIsBetween($iTop, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($iBottom <> Null) And Not __LOCalc_IntIsBetween($iBottom, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If ($iLeft <> Null) And Not __LOCalc_IntIsBetween($iLeft, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($iRight <> Null) And Not __LOCalc_IntIsBetween($iRight, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$vReturn = __LOCalc_PageStyleBorder($oPageStyle, True, False, False, $iTop, $iBottom, $iLeft, $iRight)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOCalc_PageStyleBorderWidth
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleCreate
; Description ...: Create a new Page Style in a Document.
; Syntax ........: _LOCalc_PageStyleCreate(ByRef $oDoc, $sPageStyle)
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOCalc_DocOpen, _LOCalc_DocConnect, or _LOCalc_DocCreate function.
; $sPageStyle - a string value. The Name of the new Page Style to create.
; Return values .: Success: Object
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oDoc not an Object.
; @Error 1 @Extended 2 Return 0 = $sPageStyle not a String.
; @Error 1 @Extended 3 Return 0 = Page Style name called in $sPageStyle already exists in document.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Error Creating "com.sun.star.style.PageStyle" Object.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Error Retrieving "PageStyle" Object.
; @Error 3 @Extended 2 Return 0 = Error creating new Page Style by name.
; @Error 3 @Extended 3 Return 0 = Error Retrieving Created Page Style Object.
; --Success--
; @Error 0 @Extended 0 Return Object = Success. New page Style successfully created. Returning its Object.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......: _LOCalc_PageStyleDelete
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleCreate(ByRef $oDoc, $sPageStyle)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $oPageStyles, $oStyle, $oPageStyle
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsString($sPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$oPageStyles = $oDoc.StyleFamilies().getByName("PageStyles")
If Not IsObj($oPageStyles) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0)
If _LOCalc_PageStyleExists($oDoc, $sPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
$oStyle = $oDoc.createInstance("com.sun.star.style.PageStyle")
If Not IsObj($oStyle) Then Return SetError($__LO_STATUS_INIT_ERROR, 1, 0)
$oPageStyles.insertByName($sPageStyle, $oStyle)
If Not $oPageStyles.hasByName($sPageStyle) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 2, 0)
$oPageStyle = $oPageStyles.getByName($sPageStyle)
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 3, 0)
Return SetError($__LO_STATUS_SUCCESS, 0, $oPageStyle)
EndFunc ;==>_LOCalc_PageStyleCreate
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleDelete
; Description ...: Delete a User-Created Page Style from a Document.
; Syntax ........: _LOCalc_PageStyleDelete(ByRef $oDoc, $oPageStyle)
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOCalc_DocOpen, _LOCalc_DocConnect, or _LOCalc_DocCreate function.
; $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function. Must be User-Created, not a built-in Style native to LibreOffice.
; Return values .: Success: 1
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oDoc not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 3 Return 0 = $oPageStyle not a Page Style Object.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Error retrieving "PageStyles" Object.
; @Error 3 @Extended 2 Return 0 = Error retrieving Page Style Name.
; @Error 3 @Extended 3 Return 0 = $oPageStyle is not a User-Created Page Style and cannot be deleted.
; @Error 3 @Extended 4 Return 0 = $oPageStyle is in use and cannot be deleted.
; @Error 3 @Extended 5 Return 0 = $oPageStyle still exists after deletion attempt.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Page Style called in $oPageStyle was successfully deleted.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleDelete(ByRef $oDoc, ByRef $oPageStyle)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $oPageStyles
Local $sPageStyle
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
$oPageStyles = $oDoc.StyleFamilies().getByName("PageStyles")
If Not IsObj($oPageStyles) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0)
$sPageStyle = $oPageStyle.Name()
If Not IsString($sPageStyle) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 2, 0)
If Not $oPageStyle.isUserDefined() Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 3, 0)
If $oPageStyle.isInUse() Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 4, 0) ; If Style is in use return an error.
$oPageStyles.removeByName($sPageStyle)
Return ($oPageStyles.hasByName($sPageStyle)) ? (SetError($__LO_STATUS_PROCESSING_ERROR, 5, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>_LOCalc_PageStyleDelete
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleExists
; Description ...: Check whether a document contains the requested Page Style by Name.
; Syntax ........: _LOCalc_PageStyleExists(ByRef $oDoc, $sPageStyle)
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOCalc_DocOpen, _LOCalc_DocConnect, or _LOCalc_DocCreate function.
; $sPageStyle - a string value. The Page Style Name to search for.
; Return values .: Success: Boolean
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oDoc not an Object,
; @Error 1 @Extended 2 Return 0 = $sPageStyle not a String
; --Success--
; @Error 0 @Extended 0 Return Boolean = Success. If Page Style name exists, then True is returned, else False.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleExists(ByRef $oDoc, $sPageStyle)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsString($sPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If $oDoc.StyleFamilies.getByName("PageStyles").hasByName($sPageStyle) Then Return SetError($__LO_STATUS_SUCCESS, 0, True)
Return SetError($__LO_STATUS_SUCCESS, 0, False)
EndFunc ;==>_LOCalc_PageStyleExists
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleFooter
; Description ...: Modify or retrieve Footer settings for a page style.
; Syntax ........: _LOCalc_PageStyleFooter(ByRef $oPageStyle[, $bFooterOn = Null[, $bSameLeftRight = Null[, $bSameOnFirst = Null[, $iLeftMargin = Null[, $iRightMargin = Null[, $iSpacing = Null[, $iHeight = Null[, $bAutoHeight = Null]]]]]]]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $bFooterOn - [optional] a boolean value. Default is Null. If True, adds a footer to the page style.
; $bSameLeftRight - [optional] a boolean value. Default is Null. If True, Even and odd pages share the same content.
; $bSameOnFirst - [optional] a boolean value. Default is Null. If True, First and even/odd pages share the same content. LibreOffice 4.0 and up.
; $iLeftMargin - [optional] an integer value. Default is Null. The amount of space to leave between the left edge of the page and the left edge of the footer. Set in Micrometers.
; $iRightMargin - [optional] an integer value. Default is Null. The amount of space to leave between the right edge of the page and the right edge of the footer. Set in Micrometers.
; $iSpacing - [optional] an integer value. Default is Null. The amount of space that you want to maintain between the bottom edge of the document text and the top edge of the footer. Set in Micrometers.
; $iHeight - [optional] an integer value. Default is Null. The height of the footer. Set in Micrometers.
; $bAutoHeight - [optional] a boolean value. Default is Null. If True, automatically adjusts the height of the footer to fit the contents.
; Return values .: Success: 1
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $bFooterOn not a Boolean value.
; @Error 1 @Extended 4 Return 0 = $bSameLeftRight not a Boolean value.
; @Error 1 @Extended 5 Return 0 = $bSameOnFirst not a Boolean value.
; @Error 1 @Extended 6 Return 0 = $iLeftMargin not an Integer.
; @Error 1 @Extended 7 Return 0 = $iRightMargin not an Integer.
; @Error 1 @Extended 8 Return 0 = $iSpacing not an Integer.
; @Error 1 @Extended 9 Return 0 = $iHeight not an Integer.
; @Error 1 @Extended 10 Return 0 = $bAutoHeight not a Boolean value.
; --Property Setting Errors--
; @Error 4 @Extended ? Return 0 = Some settings were not successfully set. Use BitAND to test @Extended for the following values:
; | 1 = Error setting $bFooterOn
; | 2 = Error setting $bSameLeftRight
; | 4 = Error setting $bSameOnFirst
; | 8 = Error setting $iLeftMargin
; | 16 = Error setting $iRightMargin
; | 32 = Error setting $iSpacing
; | 64 = Error setting $iHeight
; | 128 = Error setting $bAutoHeight
; --Version Related Errors--
; @Error 7 @Extended 1 Return 0 = Current Libre Office version lower than 4.0.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 7 or 8 Element Array with values in order of function parameters. If Libre Office version is less than 4.0, then the Array returned will contain 7 elements, because $bSameOnFirst will not be available.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_ConvertFromMicrometer, _LOCalc_ConvertToMicrometer
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleFooter(ByRef $oPageStyle, $bFooterOn = Null, $bSameLeftRight = Null, $bSameOnFirst = Null, $iLeftMargin = Null, $iRightMargin = Null, $iSpacing = Null, $iHeight = Null, $bAutoHeight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $avFooter[7]
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If __LOCalc_VarsAreNull($bFooterOn, $bSameLeftRight, $bSameOnFirst, $iLeftMargin, $iRightMargin, $iSpacing, $iHeight, $bAutoHeight) Then
If __LOCalc_VersionCheck(4.0) Then
__LOCalc_ArrayFill($avFooter, $oPageStyle.FooterIsOn(), $oPageStyle.FooterIsShared(), $oPageStyle.FirstPageFooterIsShared(), $oPageStyle.FooterLeftMargin(), _
$oPageStyle.FooterRightMargin(), $oPageStyle.FooterBodyDistance(), $oPageStyle.FooterHeight(), $oPageStyle.FooterIsDynamicHeight())
Else
__LOCalc_ArrayFill($avFooter, $oPageStyle.FooterIsOn(), $oPageStyle.FooterIsShared(), $oPageStyle.FooterLeftMargin(), _
$oPageStyle.FooterRightMargin(), $oPageStyle.FooterBodyDistance(), $oPageStyle.FooterHeight(), $oPageStyle.FooterIsDynamicHeight())
EndIf
Return SetError($__LO_STATUS_SUCCESS, 1, $avFooter)
EndIf
If ($bFooterOn <> Null) Then
If Not IsBool($bFooterOn) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
$oPageStyle.FooterIsOn = $bFooterOn
$iError = ($oPageStyle.FooterIsOn() = $bFooterOn) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($bSameLeftRight <> Null) Then
If Not IsBool($bSameLeftRight) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
$oPageStyle.FooterIsShared = $bSameLeftRight
$iError = ($oPageStyle.FooterIsShared() = $bSameLeftRight) ? ($iError) : (BitOR($iError, 2))
EndIf
If ($bSameOnFirst <> Null) Then
If Not IsBool($bSameOnFirst) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If Not __LOCalc_VersionCheck(4.0) Then Return SetError($__LO_STATUS_VER_ERROR, 1, 0)
$oPageStyle.FirstPageFooterIsShared = $bSameOnFirst
$iError = ($oPageStyle.FirstPageFooterIsShared() = $bSameOnFirst) ? ($iError) : (BitOR($iError, 4))
EndIf
If ($iLeftMargin <> Null) Then
If Not IsInt($iLeftMargin) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$oPageStyle.FooterLeftMargin = $iLeftMargin
$iError = (__LOCalc_IntIsBetween($oPageStyle.FooterLeftMargin(), $iLeftMargin - 1, $iLeftMargin + 1)) ? ($iError) : (BitOR($iError, 8))
EndIf
If ($iRightMargin <> Null) Then
If Not IsInt($iRightMargin) Then Return SetError($__LO_STATUS_INPUT_ERROR, 7, 0)
$oPageStyle.FooterRightMargin = $iRightMargin
$iError = (__LOCalc_IntIsBetween($oPageStyle.FooterRightMargin(), $iRightMargin - 1, $iRightMargin + 1)) ? ($iError) : (BitOR($iError, 16))
EndIf
If ($iSpacing <> Null) Then
If Not IsInt($iSpacing) Then Return SetError($__LO_STATUS_INPUT_ERROR, 8, 0)
$oPageStyle.FooterBodyDistance = $iSpacing
$iError = (__LOCalc_IntIsBetween($oPageStyle.FooterBodyDistance(), $iSpacing - 1, $iSpacing + 1)) ? ($iError) : (BitOR($iError, 32))
EndIf
If ($iHeight <> Null) Then
If Not IsInt($iHeight) Then Return SetError($__LO_STATUS_INPUT_ERROR, 9, 0)
$oPageStyle.FooterHeight = $iHeight
$iError = (__LOCalc_IntIsBetween($oPageStyle.FooterHeight(), $iHeight - 1, $iHeight + 1)) ? ($iError) : (BitOR($iError, 64))
EndIf
If ($bAutoHeight <> Null) Then
If Not IsBool($bAutoHeight) Then Return SetError($__LO_STATUS_INPUT_ERROR, 10, 0)
$oPageStyle.FooterIsDynamicHeight = $bAutoHeight
$iError = ($oPageStyle.FooterIsDynamicHeight() = $bAutoHeight) ? ($iError) : (BitOR($iError, 128))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>_LOCalc_PageStyleFooter
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleFooterAreaColor
; Description ...: Set or Retrieve background color settings for a Page style Footer.
; Syntax ........: _LOCalc_PageStyleFooterAreaColor(ByRef $oPageStyle[, $iBackColor = Null[, $bBackTransparent = Null]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iBackColor - [optional] an integer value (-1-16777215). Default is Null. The background color. Set in Long integer format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3. Set to $LOC_COLOR_OFF(-1) for "None".
; $bBackTransparent - [optional] a boolean value. Default is Null. If True, the background color is transparent.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iBackColor not an integer, less than -1, or greater than 16777215.
; @Error 1 @Extended 4 Return 0 = $bBackTransparent not a Boolean.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Footers are not enabled for this Page Style.
; --Property Setting Errors--
; @Error 4 @Extended ? Return 0 = Some settings were not successfully set. Use BitAND to test @Extended for the following values:
; | 1 = Error setting $iBackColor
; | 2 = Error setting $bBackTransparent
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 2 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_ConvertColorFromLong, _LOCalc_ConvertColorToLong
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleFooterAreaColor(ByRef $oPageStyle, $iBackColor = Null, $bBackTransparent = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $avColor[2]
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($oPageStyle.FooterIsOn() = False) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0)
If __LOCalc_VarsAreNull($iBackColor, $bBackTransparent) Then
__LOCalc_ArrayFill($avColor, $oPageStyle.FooterBackColor(), $oPageStyle.FooterBackTransparent())
Return SetError($__LO_STATUS_SUCCESS, 1, $avColor)
EndIf
If ($iBackColor <> Null) Then
If Not __LOCalc_IntIsBetween($iBackColor, $LOC_COLOR_OFF, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
$oPageStyle.FooterBackColor = $iBackColor
$iError = ($oPageStyle.FooterBackColor() = $iBackColor) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($bBackTransparent <> Null) Then
If Not IsBool($bBackTransparent) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
$oPageStyle.FooterBackTransparent = $bBackTransparent
$iError = ($oPageStyle.FooterBackTransparent() = $bBackTransparent) ? ($iError) : (BitOR($iError, 2))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>_LOCalc_PageStyleFooterAreaColor
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleFooterBorderColor
; Description ...: Set and Retrieve the Page Style Footer Border Line Color.
; Syntax ........: _LOCalc_PageStyleFooterBorderColor(ByRef $oPageStyle[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iTop - [optional] an integer value (0-16777215). Default is Null. Set the Top Border Line Color of the Page Style in Long Color code format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3.
; $iBottom - [optional] an integer value (0-16777215). Default is Null. Set the Bottom Border Line Color of the Page Style in Long Color code format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3.
; $iLeft - [optional] an integer value (0-16777215). Default is Null. Set the Left Border Line Color of the Page Style in Long Color code format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3.
; $iRight - [optional] an integer value (0-16777215). Default is Null. Set the Right Border Line Color of the Page Style in Long Color code format. Can be a custom value, or one of the constants, $LOC_COLOR_* as defined in LibreOfficeCalc_Constants.au3.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iTop not an integer, or less than 0, or greater than 16,777,215.
; @Error 1 @Extended 4 Return 0 = $iBottom not an integer, or less than 0, or greater than 16,777,215.
; @Error 1 @Extended 5 Return 0 = $iLeft not an integer, or less than 0, or greater than 16,777,215.
; @Error 1 @Extended 6 Return 0 = $iRight not an integer, or less than 0, or greater than 16,777,215.
; @Error 1 @Extended 7 Return 0 = Variable passed to internal function not an Object.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Error Creating Object "com.sun.star.table.BorderLine2"
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Internal command error. More than one set to True. UDF Must be fixed.
; @Error 3 @Extended 2 Return 0 = Footers are not enabled for this Page Style.
; --Property Setting Errors--
; @Error 4 @Extended 1 Return 0 = Cannot set Top Border Color when Top Border width not set.
; @Error 4 @Extended 2 Return 0 = Cannot set Bottom Border Color when Bottom Border width not set.
; @Error 4 @Extended 3 Return 0 = Cannot set Left Border Color when Left Border width not set.
; @Error 4 @Extended 4 Return 0 = Cannot set Right Border Color when Right Border width not set.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 4 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Border Width must be set first to be able to set Border Style and Color.
; Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_ConvertColorFromLong, _LOCalc_ConvertColorToLong, _LOCalc_PageStyleFooterBorderWidth, _LOCalc_PageStyleFooterBorderStyle, _LOCalc_PageStyleFooterBorderPadding
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleFooterBorderColor(ByRef $oPageStyle, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($oPageStyle.FooterIsOn() = False) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 2, 0)
If ($iTop <> Null) And Not __LOCalc_IntIsBetween($iTop, $LOC_COLOR_BLACK, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($iBottom <> Null) And Not __LOCalc_IntIsBetween($iBottom, $LOC_COLOR_BLACK, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If ($iLeft <> Null) And Not __LOCalc_IntIsBetween($iLeft, $LOC_COLOR_BLACK, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($iRight <> Null) And Not __LOCalc_IntIsBetween($iRight, $LOC_COLOR_BLACK, $LOC_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$vReturn = __LOCalc_PageStyleFooterBorder($oPageStyle, False, False, True, $iTop, $iBottom, $iLeft, $iRight)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOCalc_PageStyleFooterBorderColor
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleFooterBorderPadding
; Description ...: Set or retrieve the Footer Border Padding settings.
; Syntax ........: _LOCalc_PageStyleFooterBorderPadding(ByRef $oPageStyle[, $iAll = Null[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iAll - [optional] an integer value. Default is Null. Set all four padding distances to one distance in Micrometers (uM).
; $iTop - [optional] an integer value. Default is Null. Set the Top Distance between the Border and Page contents in Micrometers(uM).
; $iBottom - [optional] an integer value. Default is Null. Set the Bottom Distance between the Border and Page contents in Micrometers(uM).
; $iLeft - [optional] an integer value. Default is Null. Set the Left Distance between the Border and Page contents in Micrometers(uM).
; $iRight - [optional] an integer value. Default is Null. Set the Right Distance between the Border and Page contents in Micrometers(uM).
; Return values .: Success: 1 or Array, see Remarks.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iAll not an Integer.
; @Error 1 @Extended 4 Return 0 = $iTop not an Integer.
; @Error 1 @Extended 5 Return 0 = $iBottom not an Integer.
; @Error 1 @Extended 6 Return 0 = $Left not an Integer.
; @Error 1 @Extended 7 Return 0 = $iRight not an Integer.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Footers are not enabled for this Page Style.
; --Property Setting Errors--
; @Error 4 @Extended ? Return 0 = Some settings were not successfully set. Use BitAND to test @Extended for the following values:
; | 1 = Error setting $iAll border distance
; | 2 = Error setting $iTop border distance
; | 4 = Error setting $iBottom border distance
; | 8 = Error setting $iLeft border distance
; | 16 = Error setting $iRight border distance
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 5 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_ConvertFromMicrometer, _LOCalc_ConvertToMicrometer, _LOCalc_PageStyleFooterBorderWidth, _LOCalc_PageStyleFooterBorderStyle, _LOCalc_PageStyleFooterBorderColor
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleFooterBorderPadding(ByRef $oPageStyle, $iAll = Null, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $aiBPadding[5]
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($oPageStyle.FooterIsOn() = False) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0)
If __LOCalc_VarsAreNull($iAll, $iTop, $iBottom, $iLeft, $iRight) Then
__LOCalc_ArrayFill($aiBPadding, $oPageStyle.FooterBorderDistance(), $oPageStyle.FooterTopBorderDistance(), _
$oPageStyle.FooterBottomBorderDistance(), $oPageStyle.FooterLeftBorderDistance(), $oPageStyle.FooterRightBorderDistance())
Return SetError($__LO_STATUS_SUCCESS, 1, $aiBPadding)
EndIf
If ($iAll <> Null) Then
If Not (IsInt($iAll) Or ($iAll > 0)) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
$oPageStyle.FooterBorderDistance = $iAll
$iError = (__LOCalc_IntIsBetween($oPageStyle.FooterBorderDistance(), $iAll - 1, $iAll + 1)) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($iTop <> Null) Then
If Not (IsInt($iTop) Or ($iTop > 0)) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
$oPageStyle.FooterTopBorderDistance = $iTop
$iError = (__LOCalc_IntIsBetween($oPageStyle.FooterTopBorderDistance(), $iTop - 1, $iTop + 1)) ? ($iError) : (BitOR($iError, 2))
EndIf
If ($iBottom <> Null) Then
If Not (IsInt($iBottom) Or ($iBottom > 0)) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
$oPageStyle.FooterBottomBorderDistance = $iBottom
$iError = (__LOCalc_IntIsBetween($oPageStyle.FooterBottomBorderDistance(), $iBottom - 1, $iBottom + 1)) ? ($iError) : (BitOR($iError, 4))
EndIf
If ($iLeft <> Null) Then
If Not (IsInt($iLeft) Or ($iLeft > 0)) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$oPageStyle.FooterLeftBorderDistance = $iLeft
$iError = (__LOCalc_IntIsBetween($oPageStyle.FooterLeftBorderDistance(), $iLeft - 1, $iLeft + 1)) ? ($iError) : (BitOR($iError, 8))
EndIf
If ($iRight <> Null) Then
If Not (IsInt($iRight) Or ($iRight > 0)) Then Return SetError($__LO_STATUS_INPUT_ERROR, 7, 0)
$oPageStyle.FooterRightBorderDistance = $iRight
$iError = (__LOCalc_IntIsBetween($oPageStyle.FooterRightBorderDistance(), $iRight - 1, $iRight + 1)) ? ($iError) : (BitOR($iError, 16))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>_LOCalc_PageStyleFooterBorderPadding
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleFooterBorderStyle
; Description ...: Set and retrieve the Page Style Footer Border Line style.
; Syntax ........: _LOCalc_PageStyleFooterBorderStyle(ByRef $oPageStyle[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iTop - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Top Border Line Style of the Page Style using one of the line style constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; $iBottom - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Bottom Border Line Style of the Page Style using one of the line style constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; $iLeft - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Left Border Line Style of the Page Style using one of the line style constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; $iRight - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Right Border Line Style of the Page Style using one of the line style constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iTop not an integer, set to higher than 17, and not equal to 0x7FFF, Or is set to less than 0. See constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; @Error 1 @Extended 4 Return 0 = $iBottom not an integer, set to higher than 17, and not equal to 0x7FFF, Or is set to less than 0. See constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; @Error 1 @Extended 5 Return 0 = $iLeft not an integer, set to higher than 17, and not equal to 0x7FFF, Or is set to less than 0. See constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; @Error 1 @Extended 6 Return 0 = $iRight not an integer, set to higher than 17, and not equal to 0x7FFF, Or is set to less than 0. See constants, $LOC_BORDERSTYLE_* as defined in LibreOfficeCalc_Constants.au3.
; @Error 1 @Extended 7 Return 0 = Variable passed to internal function not an Object.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Error Creating Object "com.sun.star.table.BorderLine2"
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Internal command error. More than one set to True. UDF Must be fixed.
; @Error 3 @Extended 2 Return 0 = Footers are not enabled for this Page Style.
; --Property Setting Errors--
; @Error 4 @Extended 1 Return 0 = Cannot set Top Border Style when Top Border width not set.
; @Error 4 @Extended 2 Return 0 = Cannot set Bottom Border Style when Bottom Border width not set.
; @Error 4 @Extended 3 Return 0 = Cannot set Left Border Style when Left Border width not set.
; @Error 4 @Extended 4 Return 0 = Cannot set Right Border Style when Right Border width not set.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 4 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Border Width must be set first to be able to set Border Style and Color.
; Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_PageStyleFooterBorderWidth, _LOCalc_PageStyleFooterBorderColor, _LOCalc_PageStyleFooterBorderPadding
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleFooterBorderStyle(ByRef $oPageStyle, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($oPageStyle.FooterIsOn() = False) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 2, 0)
If ($iTop <> Null) And Not __LOCalc_IntIsBetween($iTop, $LOC_BORDERSTYLE_SOLID, $LOC_BORDERSTYLE_DASH_DOT_DOT, "", $LOC_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($iBottom <> Null) And Not __LOCalc_IntIsBetween($iBottom, $LOC_BORDERSTYLE_SOLID, $LOC_BORDERSTYLE_DASH_DOT_DOT, "", $LOC_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If ($iLeft <> Null) And Not __LOCalc_IntIsBetween($iLeft, $LOC_BORDERSTYLE_SOLID, $LOC_BORDERSTYLE_DASH_DOT_DOT, "", $LOC_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($iRight <> Null) And Not __LOCalc_IntIsBetween($iRight, $LOC_BORDERSTYLE_SOLID, $LOC_BORDERSTYLE_DASH_DOT_DOT, "", $LOC_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$vReturn = __LOCalc_PageStyleFooterBorder($oPageStyle, False, True, False, $iTop, $iBottom, $iLeft, $iRight)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOCalc_PageStyleFooterBorderStyle
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleFooterBorderWidth
; Description ...: Set and retrieve the Page Style Footer Border Line Width.
; Syntax ........: _LOCalc_PageStyleFooterBorderWidth(ByRef $oPageStyle[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]])
; Parameters ....: $oPageStyle - [in/out] an object. A Page Style object returned by a previous _LOCalc_PageStyleCreate, or _LOCalc_PageStyleGetObj function.
; $iTop - [optional] an integer value. Default is Null. Set the Top Border Line width of the Page Style in Micrometers. Can be a custom value, or one of the constants, $LOC_BORDERWIDTH_* as defined in LibreOfficeCalc_Constants.au3.
; $iBottom - [optional] an integer value. Default is Null. Set the Bottom Border Line Width of the Page Style in Micrometers. Can be a custom value, or one of the constants, $LOC_BORDERWIDTH_* as defined in LibreOfficeCalc_Constants.au3.
; $iLeft - [optional] an integer value. Default is Null. Set the Left Border Line width of the Page Style in Micrometers. Can be a custom value, or one of the constants, $LOC_BORDERWIDTH_* as defined in LibreOfficeCalc_Constants.au3.
; $iRight - [optional] an integer value. Default is Null. Set the Right Border Line Width of the Page Style in Micrometers. Can be a custom value, or one of the constants, $LOC_BORDERWIDTH_* as defined in LibreOfficeCalc_Constants.au3.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oPageStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oPageStyle not a Page Style Object.
; @Error 1 @Extended 3 Return 0 = $iTop not an integer, or less than 0.
; @Error 1 @Extended 4 Return 0 = $iBottom not an integer, or less than 0.
; @Error 1 @Extended 5 Return 0 = $iLeft not an integer, or less than 0.
; @Error 1 @Extended 6 Return 0 = $iRight not an integer, or less than 0.
; @Error 1 @Extended 7 Return 0 = Variable passed to internal function not an Object.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Error Creating Object "com.sun.star.table.BorderLine2"
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Internal command error. More than one set to True. UDF Must be fixed.
; @Error 3 @Extended 2 Return 0 = Footers are not enabled for this Page Style.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Settings were successfully set.
; @Error 0 @Extended 1 Return Array = Success. All optional parameters were set to Null, returning current settings in a 4 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: To "Turn Off" Borders, set Width to 0.
; Call this function with only the required parameters (or with all other parameters set to Null keyword), to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOCalc_PageStyleCreate, _LOCalc_PageStyleGetObj, _LOCalc_ConvertFromMicrometer, _LOCalc_ConvertToMicrometer, _LOCalc_PageStyleFooterBorderStyle, _LOCalc_PageStyleFooterBorderColor, _LOCalc_PageStyleFooterBorderPadding
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleFooterBorderWidth(ByRef $oPageStyle, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oPageStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oPageStyle.supportsService("com.sun.star.style.PageStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($oPageStyle.FooterIsOn() = False) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 2, 0)
If ($iTop <> Null) And Not __LOCalc_IntIsBetween($iTop, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($iBottom <> Null) And Not __LOCalc_IntIsBetween($iBottom, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If ($iLeft <> Null) And Not __LOCalc_IntIsBetween($iLeft, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($iRight <> Null) And Not __LOCalc_IntIsBetween($iRight, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$vReturn = __LOCalc_PageStyleFooterBorder($oPageStyle, True, False, False, $iTop, $iBottom, $iLeft, $iRight)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOCalc_PageStyleFooterBorderWidth
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOCalc_PageStyleFooterCreateTextCursor
; Description ...: Create a Text Cursor in a Footer area.
; Syntax ........: _LOCalc_PageStyleFooterCreateTextCursor(ByRef $oFooter[, $bAtEnd = False[, $bLeftArea = False[, $bCenterArea = False[, $bRightArea = False]]]])
; Parameters ....: $oFooter - [in/out] an object. A Footer Object from a previous _LOCalc_PageStyleFooterObj function.
; $bAtEnd - [optional] a boolean value. Default is False. If True, the Text Cursor is created at the end of the Text, else it will be created at the beginning.
; $bLeftArea - [optional] a boolean value. Default is False. If True, the Text Cursor will be created in the Left Area of the Footer.
; $bCenterArea - [optional] a boolean value. Default is False. If True, the Text Cursor will be created in the Center Area of the Footer.
; $bRightArea - [optional] a boolean value. Default is False. If True, the Text Cursor will be created in the Right Area of the Footer.
; Return values .: Success: Object
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oFooter not an Object.
; @Error 1 @Extended 2 Return 0 = $oFooter not a Header/Footer Object.
; @Error 1 @Extended 3 Return 0 = $bAtEnd not a Boolean.
; @Error 1 @Extended 4 Return 0 = $bLeftArea not a Boolean.
; @Error 1 @Extended 5 Return 0 = $bCenterArea not a Boolean.
; @Error 1 @Extended 6 Return 0 = $bRightArea not a Boolean.
; @Error 1 @Extended 7 Return 0 = Either more than one of the following are set to True, or all are False, $bLeftArea, $bCenterArea, $bRightArea.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Failed to create a Text Cursor.
; --Success--
; @Error 0 @Extended 0 Return Object = Success. Successfully created a Text Cursor in the requested Footer area, returning the Text Cursor Object.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: You can only create a Text Cursor in one area at a time per function call.
; Related .......: _LOCalc_TextCursorMove, _LOCalc_PageStyleFooterObj
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOCalc_PageStyleFooterCreateTextCursor(ByRef $oFooter, $bAtEnd = False, $bLeftArea = False, $bCenterArea = False, $bRightArea = False)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOCalc_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler