-
Notifications
You must be signed in to change notification settings - Fork 1
/
LibreOfficeWriter_Internal.au3
8887 lines (7425 loc) · 487 KB
/
LibreOfficeWriter_Internal.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
#include-once
; Main LibreOffice Includes
#include "LibreOffice_Constants.au3"
; Common includes for Writer
#include "LibreOfficeWriter_Constants.au3"
#include "LibreOfficeWriter_Helper.au3"
; Required AutoIt Include
#include <WinAPIGdiDC.au3>
; #INDEX# =======================================================================================================================
; Title .........: LibreOffice UDF
; AutoIt Version : v3.3.16.1
; Description ...: Various functions for internal data processing, data retrieval, retrieving and applying settings for LibreOffice UDF.
; Author(s) .....: donnyh13, mLipok
; Dll ...........:
;
; ===============================================================================================================================
; #INTERNAL_USE_ONLY# ===========================================================================================================
; __LOWriter_AddTo1DArray
; __LOWriter_AddTo2DArray
; __LOWriter_AnyAreDefault
; __LOWriter_ArrayFill
; __LOWriter_Border
; __LOWriter_CharBorder
; __LOWriter_CharBorderPadding
; __LOWriter_CharEffect
; __LOWriter_CharFont
; __LOWriter_CharFontColor
; __LOWriter_CharOverLine
; __LOWriter_CharPosition
; __LOWriter_CharRotateScale
; __LOWriter_CharShadow
; __LOWriter_CharSpacing
; __LOWriter_CharStrikeOut
; __LOWriter_CharStyleNameToggle
; __LOWriter_CharUnderLine
; __LOWriter_ColorRemoveAlpha
; __LOWriter_CreatePoint
; __LOWriter_CreateStruct
; __LOWriter_CursorGetText
; __LOWriter_DateStructCompare
; __LOWriter_DirFrmtCheck
; __LOWriter_FieldCountType
; __LOWriter_FieldsGetList
; __LOWriter_FieldTypeServices
; __LOWriter_FilterNameGet
; __LOWriter_FindFormatAddSetting
; __LOWriter_FindFormatDeleteSetting
; __LOWriter_FindFormatRetrieveSetting
; __LOWriter_FooterBorder
; __LOWriter_GetPrinterSetting
; __LOWriter_GetShapeName
; __LOWriter_GradientNameInsert
; __LOWriter_GradientPresets
; __LOWriter_HeaderBorder
; __LOWriter_ImageGetSuggestedSize
; __LOWriter_Internal_CursorGetDataType
; __LOWriter_Internal_CursorGetType
; __LOWriter_InternalComErrorHandler
; __LOWriter_IntIsBetween
; __LOWriter_IsCellRange
; __LOWriter_IsTableInDoc
; __LOWriter_NumIsBetween
; __LOWriter_NumStyleCreateScript
; __LOWriter_NumStyleDeleteScript
; __LOWriter_NumStyleInitiateDocument
; __LOWriter_NumStyleListFormat
; __LOWriter_NumStyleModify
; __LOWriter_NumStyleRetrieve
; __LOWriter_ObjRelativeSize
; __LOWriter_PageStyleNameToggle
; __LOWriter_ParAlignment
; __LOWriter_ParBackColor
; __LOWriter_ParBorderPadding
; __LOWriter_ParDropCaps
; __LOWriter_ParHasTabStop
; __LOWriter_ParHyphenation
; __LOWriter_ParIndent
; __LOWriter_ParOutLineAndList
; __LOWriter_ParPageBreak
; __LOWriter_ParShadow
; __LOWriter_ParSpace
; __LOWriter_ParStyleNameToggle
; __LOWriter_ParTabStopCreate
; __LOWriter_ParTabStopDelete
; __LOWriter_ParTabStopList
; __LOWriter_ParTabStopMod
; __LOWriter_ParTxtFlowOpt
; __LOWriter_RegExpConvert
; __LOWriter_SetPropertyValue
; __LOWriter_Shape_CreateArrow
; __LOWriter_Shape_CreateBasic
; __LOWriter_Shape_CreateCallout
; __LOWriter_Shape_CreateFlowchart
; __LOWriter_Shape_CreateLine
; __LOWriter_Shape_CreateStars
; __LOWriter_Shape_CreateSymbol
; __LOWriter_Shape_GetCustomType
; __LOWriter_ShapeArrowStyleName
; __LOWriter_ShapeLineStyleName
; __LOWriter_ShapePointGetSettings
; __LOWriter_ShapePointModify
; __LOWriter_TableBorder
; __LOWriter_TableCursorMove
; __LOWriter_TableHasCellName
; __LOWriter_TableHasColumnRange
; __LOWriter_TableHasRowRange
; __LOWriter_TableRowSplitToggle
; __LOWriter_TextCursorMove
; __LOWriter_TransparencyGradientConvert
; __LOWriter_TransparencyGradientNameInsert
; __LOWriter_UnitConvert
; __LOWriter_VarsAreDefault
; __LOWriter_VarsAreNull
; __LOWriter_VersionCheck
; __LOWriter_ViewCursorMove
; ===============================================================================================================================
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_AddTo1DArray
; Description ...: Add data to a 1 Dimensional array.
; Syntax ........: __LOWriter_AddTo1DArray(ByRef $aArray, $vData[, $bCountInFirst = False])
; Parameters ....: $aArray - [in/out] an array of unknowns. The Array to directly add data to. Array will be directly modified.
; $vData - a variant value. The Data to add to the Array.
; $bCountInFirst - [optional] a boolean value. Default is False. If True the first element of the array is a count of contained elements.
; Return values .: Success: 1
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $aArray not an Array
; @Error 1 @Extended 2 Return 0 = $bCountinFirst not a Boolean.
; @Error 1 @Extended 3 Return 0 = $aArray contains too many columns.
; @Error 1 @Extended 4 Return 0 = $aArray[0] contains non integer data or is not empty, and $bCountInFirst is set to True.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Array item was successfully added.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_AddTo1DArray(ByRef $aArray, $vData, $bCountInFirst = False)
Local Const $UBOUND_COLUMNS = 2
If Not IsArray($aArray) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsBool($bCountInFirst) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If UBound($aArray, $UBOUND_COLUMNS) > 1 Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0) ; Too many columns
If $bCountInFirst And (UBound($aArray) = 0) Then
ReDim $aArray[1]
$aArray[0] = 0
EndIf
If $bCountInFirst And (($aArray[0] <> "") And Not IsInt($aArray[0])) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
ReDim $aArray[UBound($aArray) + 1]
$aArray[UBound($aArray) - 1] = $vData
If $bCountInFirst Then $aArray[0] += 1
Return SetError($__LO_STATUS_SUCCESS, 0, 1)
EndFunc ;==>__LOWriter_AddTo1DArray
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_AddTo2DArray
; Description ...: Add data to a 2 Dimensional array.
; Syntax ........: __LOWriter_AddTo2DArray(ByRef $aArray, $vDataCol1, $vDataCol2[, $bCountInFirst = False])
; Parameters ....: $aArray - [in/out] an array of unknowns. The Array to directly add data to. Array will be directly modified.
; $vDataCol1 - a variant value. The Data to add to the first column of the Array.
; $vDataCol2 - a variant value. The Data to add to the Second column of the Array.
; $bCountInFirst - [optional] a boolean value. Default is False. If True the first element of the array is a count of contained elements.
; Return values .: Success: 1
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $aArray not an Array
; @Error 1 @Extended 2 Return 0 = $bCountinFirst not a Boolean.
; @Error 1 @Extended 3 Return 0 = $aArray does not contain two columns.
; @Error 1 @Extended 4 Return 0 = $aArray[0][0] contains non integer data or is not empty, and $bCountInFirst is set to True.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Array item was successfully added.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_AddTo2DArray(ByRef $aArray, $vDataCol1, $vDataCol2, $bCountInFirst = False)
Local Const $UBOUND_COLUMNS = 2
If Not IsArray($aArray) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsBool($bCountInFirst) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If UBound($aArray, $UBOUND_COLUMNS) <> 2 Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0) ; Too many or too few columns
If $bCountInFirst And (UBound($aArray) = 0) Then
ReDim $aArray[1][2]
$aArray[0][0] = 0
EndIf
If $bCountInFirst And (($aArray[0][0] <> "") And Not IsInt($aArray[0][0])) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
ReDim $aArray[UBound($aArray) + 1][2]
$aArray[UBound($aArray) - 1][0] = $vDataCol1
$aArray[UBound($aArray) - 1][1] = $vDataCol2
If $bCountInFirst Then $aArray[0][0] += 1
Return SetError($__LO_STATUS_SUCCESS, 0, 1)
EndFunc ;==>__LOWriter_AddTo2DArray
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_AnyAreDefault
; Description ...: Tests whether any input parameters are equal to Default keyword.
; Syntax ........: __LOWriter_AnyAreDefault($vVar1[, $vVar2 = Null[, $vVar3 = Null[, $vVar4 = Null[, $vVar5 = Null[, $vVar6 = Null[, $vVar7 = Null[, $vVar8 = Null]]]]]]])
; Parameters ....: $vVar1 - a variant value.
; $vVar2 - [optional] a variant value. Default is Null.
; $vVar3 - [optional] a variant value. Default is Null.
; $vVar4 - [optional] a variant value. Default is Null.
; $vVar5 - [optional] a variant value. Default is Null.
; $vVar6 - [optional] a variant value. Default is Null.
; $vVar7 - [optional] a variant value. Default is Null.
; $vVar8 - [optional] a variant value. Default is Null.
; Return values .: Success: Boolean
; Failure: False
; --Success--
; @Error 0 @Extended 0 Return Boolean = If Any parameters are equal to Default, True is returned. Else False.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_AnyAreDefault($vVar1, $vVar2 = Null, $vVar3 = Null, $vVar4 = Null, $vVar5 = Null, $vVar6 = Null, $vVar7 = Null, $vVar8 = Null)
Local $bAnyDefault1, $bAnyDefault2
$bAnyDefault1 = (($vVar1 = Default) Or ($vVar2 = Default) Or ($vVar3 = Default) Or ($vVar4 = Default)) ? (True) : (False)
$bAnyDefault2 = (($vVar5 = Default) Or ($vVar6 = Default) Or ($vVar7 = Default) Or ($vVar8 = Default)) ? (True) : (False)
Return ($bAnyDefault1 Or $bAnyDefault2) ? (SetError($__LO_STATUS_SUCCESS, 0, True)) : (SetError($__LO_STATUS_SUCCESS, 0, False))
EndFunc ;==>__LOWriter_AnyAreDefault
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_ArrayFill
; Description ...: Fill an Array with data.
; Syntax ........: __LOWriter_ArrayFill(ByRef $aArrayToFill[, $vVar1 = Null[, $vVar2 = Null[, $vVar3 = Null[, $vVar4 = Null[, $vVar5 = Null[, $vVar6 = Null[, $vVar7 = Null[, $vVar8 = Null[, $vVar9 = Null[, $vVar10 = Null[, $vVar11 = Null[, $vVar12 = Null[, $vVar13 = Null[, $vVar14 = Null[, $vVar15 = Null[, $vVar16 = Null[, $vVar17 = Null[, $vVar18 = Null]]]]]]]]]]]]]]]]]])
; Parameters ....: $aArrayToFill - [in/out] an array of unknowns. The Array to Fill. Array will be directly modified.
; $vVar1 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar2 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar3 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar4 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar5 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar6 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar7 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar8 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar9 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar10 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar11 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar12 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar13 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar14 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar15 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar16 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar17 - [optional] a variant value. Default is Null. The Data to add to the Array.
; $vVar18 - [optional] a variant value. Default is Null. The Data to add to the Array.
; Return values .: None
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Call only how many you parameters you need to add to the Array. Automatically resizes the Array if it is the incorrect size.
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_ArrayFill(ByRef $aArrayToFill, $vVar1 = Null, $vVar2 = Null, $vVar3 = Null, $vVar4 = Null, $vVar5 = Null, $vVar6 = Null, $vVar7 = Null, $vVar8 = Null, $vVar9 = Null, $vVar10 = Null, $vVar11 = Null, $vVar12 = Null, $vVar13 = Null, $vVar14 = Null, $vVar15 = Null, $vVar16 = Null, $vVar17 = Null, $vVar18 = Null)
#forceref $vVar1, $vVar2, $vVar3, $vVar4, $vVar5, $vVar6, $vVar7, $vVar8, $vVar9, $vVar10, $vVar11, $vVar12, $vVar13, $vVar14, $vVar15, $vVar16, $vVar17, $vVar18
If UBound($aArrayToFill) < (@NumParams - 1) Then ReDim $aArrayToFill[@NumParams - 1]
For $i = 0 To @NumParams - 2
$aArrayToFill[$i] = Eval("vVar" & $i + 1)
Next
EndFunc ;==>__LOWriter_ArrayFill
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_Border
; Description ...: Border Setting Internal function. Libre Office Version 3.4 and Up.
; Syntax ........: __LOWriter_Border(ByRef $oObj, $bWid, $bSty, $bCol, $iTop, $iBottom, $iLeft, $iRight)
; Parameters ....: $oObj - [in/out] an object. An Object that implements BorderLine2 service for border properties.
; $bWid - a boolean value. If True, the calling function is for setting Border Line Width.
; $bSty - a boolean value. If True, the calling function is for setting Border Line Style.
; $bCol - a boolean value. If True, the calling function is for setting Border Line Color.
; $iTop - an integer value. See Border Style, Width, and Color functions for possible values.
; $iBottom - an integer value. See Border Style, Width, and Color functions for possible values.
; $iLeft - an integer value. See Border Style, Width, and Color functions for possible values.
; $iRight - an integer value. See Border Style, Width, and Color functions for possible values.
; 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 = $oObj 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/Color when Top Border width not set.
; @Error 4 @Extended 2 Return 0 = Cannot set Bottom Border style/Color when Bottom Border width not set.
; @Error 4 @Extended 3 Return 0 = Cannot set Left Border style/Color when Left Border width not set.
; @Error 4 @Extended 4 Return 0 = Cannot set Right Border style/Color when Right Border width not set.
; --Version Related Errors--
; @Error 7 @Extended 1 Return 0 = Current Libre Office version lower than 3.4.
; --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 .......: Call this function with all other parameters set to Null keyword, and $bWid, or $bSty, or $bCol set to true to get the corresponding current settings.
; All distance values are set in Micrometers. Call any optional parameter with Null keyword to skip it.
; Related .......: _LOWriter_ConvertFromMicrometer, _LOWriter_ConvertToMicrometer
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_Border(ByRef $oObj, $bWid, $bSty, $bCol, $iTop, $iBottom, $iLeft, $iRight)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $avBorder[4]
Local $tBL2
If Not __LOWriter_VersionCheck(3.4) Then Return SetError($__LO_STATUS_VER_ERROR, 1, 0)
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If (($bWid + $bSty + $bCol) <> 1) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0) ; If more than one Boolean is true = error
If __LOWriter_VarsAreNull($iTop, $iBottom, $iLeft, $iRight) Then
If $bWid Then
__LOWriter_ArrayFill($avBorder, $oObj.TopBorder.LineWidth(), $oObj.BottomBorder.LineWidth(), $oObj.LeftBorder.LineWidth(), _
$oObj.RightBorder.LineWidth())
ElseIf $bSty Then
__LOWriter_ArrayFill($avBorder, $oObj.TopBorder.LineStyle(), $oObj.BottomBorder.LineStyle(), $oObj.LeftBorder.LineStyle(), _
$oObj.RightBorder.LineStyle())
ElseIf $bCol Then
__LOWriter_ArrayFill($avBorder, $oObj.TopBorder.Color(), $oObj.BottomBorder.Color(), $oObj.LeftBorder.Color(), $oObj.RightBorder.Color())
EndIf
Return SetError($__LO_STATUS_SUCCESS, 1, $avBorder)
EndIf
$tBL2 = __LOWriter_CreateStruct("com.sun.star.table.BorderLine2")
If Not IsObj($tBL2) Then Return SetError($__LO_STATUS_INIT_ERROR, 1, 0)
If $iTop <> Null Then
If Not $bWid And ($oObj.TopBorder.LineWidth() = 0) Then Return SetError($__LO_STATUS_PROP_SETTING_ERROR, 1, 0) ; If Width not set, cant set color or style.
; Top Line
$tBL2.LineWidth = ($bWid) ? ($iTop) : ($oObj.TopBorder.LineWidth()) ; copy Line Width over to new size structure
$tBL2.LineStyle = ($bSty) ? ($iTop) : ($oObj.TopBorder.LineStyle()) ; copy Line style over to new size structure
$tBL2.Color = ($bCol) ? ($iTop) : ($oObj.TopBorder.Color()) ; copy Color over to new size structure
$oObj.TopBorder = $tBL2
EndIf
If $iBottom <> Null Then
If Not $bWid And ($oObj.BottomBorder.LineWidth() = 0) Then Return SetError($__LO_STATUS_PROP_SETTING_ERROR, 2, 0) ; If Width not set, cant set color or style.
; Bottom Line
$tBL2.LineWidth = ($bWid) ? ($iBottom) : ($oObj.BottomBorder.LineWidth()) ; copy Line Width over to new size structure
$tBL2.LineStyle = ($bSty) ? ($iBottom) : ($oObj.BottomBorder.LineStyle()) ; copy Line style over to new size structure
$tBL2.Color = ($bCol) ? ($iBottom) : ($oObj.BottomBorder.Color()) ; copy Color over to new size structure
$oObj.BottomBorder = $tBL2
EndIf
If $iLeft <> Null Then
If Not $bWid And ($oObj.LeftBorder.LineWidth() = 0) Then Return SetError($__LO_STATUS_PROP_SETTING_ERROR, 3, 0) ; If Width not set, cant set color or style.
; Left Line
$tBL2.LineWidth = ($bWid) ? ($iLeft) : ($oObj.LeftBorder.LineWidth()) ; copy Line Width over to new size structure
$tBL2.LineStyle = ($bSty) ? ($iLeft) : ($oObj.LeftBorder.LineStyle()) ; copy Line style over to new size structure
$tBL2.Color = ($bCol) ? ($iLeft) : ($oObj.LeftBorder.Color()) ; copy Color over to new size structure
$oObj.LeftBorder = $tBL2
EndIf
If $iRight <> Null Then
If Not $bWid And ($oObj.RightBorder.LineWidth() = 0) Then Return SetError($__LO_STATUS_PROP_SETTING_ERROR, 4, 0) ; If Width not set, cant set color or style.
; Right Line
$tBL2.LineWidth = ($bWid) ? ($iRight) : ($oObj.RightBorder.LineWidth()) ; copy Line Width over to new size structure
$tBL2.LineStyle = ($bSty) ? ($iRight) : ($oObj.RightBorder.LineStyle()) ; copy Line style over to new size structure
$tBL2.Color = ($bCol) ? ($iRight) : ($oObj.RightBorder.Color()) ; copy Color over to new size structure
$oObj.RightBorder = $tBL2
EndIf
Return SetError($__LO_STATUS_SUCCESS, 0, 1)
EndFunc ;==>__LOWriter_Border
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_CharBorder
; Description ...: Character Border Setting and retrieving Internal function.
; Syntax ........: __LOWriter_CharBorder(ByRef $oObj, $bWid, $bSty, $bCol, $iTop, $iBottom, $iLeft, $iRight)
; Parameters ....: $oObj - [in/out] an object. An Object that supports "com.sun.star.text.Paragraph" Or "com.sun.star.text.TextPortion" services, such as a Cursor with data selected or paragraph section.
; $bWid - a boolean value. If True, the calling function is for setting Border Line Width.
; $bSty - a boolean value. If True, the calling function is for setting Border Line Style.
; $bCol - a boolean value. If True, the calling function is for setting Border Line Color.
; $iTop - an integer value. See Border Style, Width, and Color functions for possible values.
; $iBottom - an integer value. See Border Style, Width, and Color functions for possible values.
; $iLeft - an integer value. See Border Style, Width, and Color functions for possible values.
; $iRight - an integer value. See Border Style, Width, and Color functions for possible values.
; 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 = $oObj Variable not Object type variable.
; --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/Color when Top Border width not set.
; @Error 4 @Extended 2 Return 0 = Cannot set Bottom Border style/Color when Bottom Border width not set.
; @Error 4 @Extended 3 Return 0 = Cannot set Left Border style/Color when Left Border width not set.
; @Error 4 @Extended 4 Return 0 = Cannot set Right Border style/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 .......: Call this function with only the Object parameter and all other parameters set to Null keyword, and $bWid, or $bSty, or $bCol set to true to get the corresponding current settings.
; All distance values are set in Micrometers.
; Call any optional parameter with Null keyword to skip it.
; Related .......: _LOWriter_ConvertFromMicrometer, _LOWriter_ConvertToMicrometer
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_CharBorder(ByRef $oObj, $bWid, $bSty, $bCol, $iTop, $iBottom, $iLeft, $iRight)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $avBorder[4]
Local $tBL2
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If (($bWid + $bSty + $bCol) <> 1) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0) ; If more than one Boolean is true = error
If __LOWriter_VarsAreNull($iTop, $iBottom, $iLeft, $iRight) Then
If $bWid Then
__LOWriter_ArrayFill($avBorder, $oObj.CharTopBorder.LineWidth(), $oObj.CharBottomBorder.LineWidth(), $oObj.CharLeftBorder.LineWidth(), _
$oObj.CharRightBorder.LineWidth())
ElseIf $bSty Then
__LOWriter_ArrayFill($avBorder, $oObj.CharTopBorder.LineStyle(), $oObj.CharBottomBorder.LineStyle(), $oObj.CharLeftBorder.LineStyle(), _
$oObj.CharRightBorder.LineStyle())
ElseIf $bCol Then
__LOWriter_ArrayFill($avBorder, $oObj.CharTopBorder.Color(), $oObj.CharBottomBorder.Color(), $oObj.CharLeftBorder.Color(), _
$oObj.CharRightBorder.Color())
EndIf
Return SetError($__LO_STATUS_SUCCESS, 1, $avBorder)
EndIf
$tBL2 = __LOWriter_CreateStruct("com.sun.star.table.BorderLine2")
If Not IsObj($tBL2) Then Return SetError($__LO_STATUS_INIT_ERROR, 1, 0)
If $iTop <> Null Then
If Not $bWid And ($oObj.CharTopBorder.LineWidth() = 0) Then Return SetError($__LO_STATUS_PROP_SETTING_ERROR, 1, 0) ; If Width not set, cant set color or style.
; Top Line
$tBL2.LineWidth = ($bWid) ? ($iTop) : ($oObj.CharTopBorder.LineWidth()) ; copy Line Width over to new size structure
$tBL2.LineStyle = ($bSty) ? ($iTop) : ($oObj.CharTopBorder.LineStyle()) ; copy Line style over to new size structure
$tBL2.Color = ($bCol) ? ($iTop) : ($oObj.CharTopBorder.Color()) ; copy Color over to new size structure
$oObj.CharTopBorder = $tBL2
EndIf
If $iBottom <> Null Then
If Not $bWid And ($oObj.CharBottomBorder.LineWidth() = 0) Then Return SetError($__LO_STATUS_PROP_SETTING_ERROR, 2, 0) ; If Width not set, cant set color or style.
; Bottom Line
$tBL2.LineWidth = ($bWid) ? ($iBottom) : ($oObj.CharBottomBorder.LineWidth()) ; copy Line Width over to new size structure
$tBL2.LineStyle = ($bSty) ? ($iBottom) : ($oObj.CharBottomBorder.LineStyle()) ; copy Line style over to new size structure
$tBL2.Color = ($bCol) ? ($iBottom) : ($oObj.CharBottomBorder.Color()) ; copy Color over to new size structure
$oObj.CharBottomBorder = $tBL2
EndIf
If $iLeft <> Null Then
If Not $bWid And ($oObj.CharLeftBorder.LineWidth() = 0) Then Return SetError($__LO_STATUS_PROP_SETTING_ERROR, 3, 0) ; If Width not set, cant set color or style.
; Left Line
$tBL2.LineWidth = ($bWid) ? ($iLeft) : ($oObj.CharLeftBorder.LineWidth()) ; copy Line Width over to new size structure
$tBL2.LineStyle = ($bSty) ? ($iLeft) : ($oObj.CharLeftBorder.LineStyle()) ; copy Line style over to new size structure
$tBL2.Color = ($bCol) ? ($iLeft) : ($oObj.CharLeftBorder.Color()) ; copy Color over to new size structure
$oObj.CharLeftBorder = $tBL2
EndIf
If $iRight <> Null Then
If Not $bWid And ($oObj.CharRightBorder.LineWidth() = 0) Then Return SetError($__LO_STATUS_PROP_SETTING_ERROR, 4, 0) ; If Width not set, cant set color or style.
; Right Line
$tBL2.LineWidth = ($bWid) ? ($iRight) : ($oObj.CharRightBorder.LineWidth()) ; copy Line Width over to new size structure
$tBL2.LineStyle = ($bSty) ? ($iRight) : ($oObj.CharRightBorder.LineStyle()) ; copy Line style over to new size structure
$tBL2.Color = ($bCol) ? ($iRight) : ($oObj.CharRightBorder.Color()) ; copy Color over to new size structure
$oObj.CharRightBorder = $tBL2
EndIf
Return SetError($__LO_STATUS_SUCCESS, 0, 1)
EndFunc ;==>__LOWriter_CharBorder
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_CharBorderPadding
; Description ...: Set and retrieve the distance between the border and the characters.
; Syntax ........: __LOWriter_CharBorderPadding(ByRef $oObj, $iAll, $iTop, $iBottom, $iLeft, $iRight)
; Parameters ....: $oObj - [in/out] an object. An Object that supports "com.sun.star.text.Paragraph" Or "com.sun.star.text.TextPortion" services, such as a Cursor with data selected or paragraph section.
; $iAll - an integer value. Set all four padding values to the same value. When used, all other parameters are ignored. In Micrometers.
; $iTop - an integer value. Set the Top border distance in Micrometers.
; $iBottom - an integer value. Set the Bottom border distance in Micrometers.
; $iLeft - an integer value. Set the left border distance in Micrometers.
; $iRight - an integer value. Set the Right border distance in Micrometers.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 3 Return 0 = Passed Object for internal function not an Object.
; @Error 1 @Extended 4 Return 0 = $iAll not an Integer.
; @Error 1 @Extended 5 Return 0 = $iTop not an Integer.
; @Error 1 @Extended 6 Return 0 = $iBottom not an Integer.
; @Error 1 @Extended 7 Return 0 = $Left not an Integer.
; @Error 1 @Extended 8 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 Object parameter and all other parameters set to Null keyword, to get the current settings.
; All distance values are set in Micrometers. Call any optional parameter with Null keyword to skip it.
; Related .......: _LOWriter_ConvertFromMicrometer, _LOWriter_ConvertToMicrometer
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_CharBorderPadding(ByRef $oObj, $iAll, $iTop, $iBottom, $iLeft, $iRight)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $aiBPadding[5]
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If __LOWriter_VarsAreNull($iAll, $iTop, $iBottom, $iLeft, $iRight) Then
__LOWriter_ArrayFill($aiBPadding, $oObj.CharBorderDistance(), $oObj.CharTopBorderDistance(), $oObj.CharBottomBorderDistance(), _
$oObj.CharLeftBorderDistance(), $oObj.CharRightBorderDistance())
Return SetError($__LO_STATUS_SUCCESS, 1, $aiBPadding)
EndIf
If ($iAll <> Null) Then
If Not __LOWriter_IntIsBetween($iAll, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
$oObj.CharBorderDistance = $iAll
$iError = (__LOWriter_IntIsBetween($oObj.CharBorderDistance(), $iAll - 1, $iAll + 1)) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($iTop <> Null) Then
If Not __LOWriter_IntIsBetween($iTop, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
$oObj.CharTopBorderDistance = $iTop
$iError = (__LOWriter_IntIsBetween($oObj.CharTopBorderDistance(), $iTop - 1, $iTop + 1)) ? ($iError) : (BitOR($iError, 2))
EndIf
If ($iBottom <> Null) Then
If Not __LOWriter_IntIsBetween($iBottom, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$oObj.CharBottomBorderDistance = $iBottom
$iError = (__LOWriter_IntIsBetween($oObj.CharBottomBorderDistance(), $iBottom - 1, $iBottom + 1)) ? ($iError) : (BitOR($iError, 4))
EndIf
If ($iLeft <> Null) Then
If Not __LOWriter_IntIsBetween($iLeft, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 7, 0)
$oObj.CharLeftBorderDistance = $iLeft
$iError = (__LOWriter_IntIsBetween($oObj.CharLeftBorderDistance(), $iLeft - 1, $iLeft + 1)) ? ($iError) : (BitOR($iError, 8))
EndIf
If ($iRight <> Null) Then
If Not __LOWriter_IntIsBetween($iRight, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 8, 0)
$oObj.CharRightBorderDistance = $iRight
$iError = (__LOWriter_IntIsBetween($oObj.CharRightBorderDistance(), $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 ;==>__LOWriter_CharBorderPadding
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_CharEffect
; Description ...: Set or Retrieve the Font Effect settings.
; Syntax ........: __LOWriter_CharEffect(ByRef $oObj, $iRelief, $iCase, $bHidden, $bOutline, $bShadow)
; Parameters ....: $oObj - [in/out] an object. An Object that supports "com.sun.star.text.Paragraph" Or "com.sun.star.text.TextPortion" services, such as a Cursor with data selected or paragraph section.
; $iRelief - an integer value (0-2). The Character Relief style. See Constants, $LOW_RELIEF_* as defined in LibreOfficeWriter_Constants.au3.
; $iCase - an integer value (0-4). The Character Case Style. See Constants, $LOW_CASEMAP_* as defined in LibreOfficeWriter_Constants.au3.
; $bHidden - a boolean value. If True, the Characters are hidden.
; $bOutline - a boolean value. If True, the characters have an outline around the outside.
; $bShadow - a boolean value. If True, the characters have a shadow.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 3 Return 0 = Passed Object for internal function not an Object.
; @Error 1 @Extended 4 Return 0 = $iRelief not an integer or less than 0, or greater than 2. See Constants, $LOW_RELIEF_* as defined in LibreOfficeWriter_Constants.au3.
; @Error 1 @Extended 5 Return 0 = $iCase not an integer or less than 0, or greater than 4. See Constants, $LOW_CASEMAP_* as defined in LibreOfficeWriter_Constants.au3.
; @Error 1 @Extended 6 Return 0 = $bHidden not a Boolean.
; @Error 1 @Extended 7 Return 0 = $bOutline not a Boolean.
; @Error 1 @Extended 8 Return 0 = $bShadow 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 $iRelief
; | 2 = Error setting $iCase
; | 4 = Error setting $bHidden
; | 8 = Error setting $bOutline
; | 16 = Error setting $bShadow
; --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 Object parameter and all other parameters set to Null keyword, to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_CharEffect(ByRef $oObj, $iRelief, $iCase, $bHidden, $bOutline, $bShadow)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $avEffect[5]
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If __LOWriter_VarsAreNull($iRelief, $iCase, $bHidden, $bOutline, $bShadow) Then
__LOWriter_ArrayFill($avEffect, $oObj.CharRelief(), $oObj.CharCaseMap(), $oObj.CharHidden(), $oObj.CharContoured(), $oObj.CharShadowed())
Return SetError($__LO_STATUS_SUCCESS, 1, $avEffect)
EndIf
If ($iRelief <> Null) Then
If Not __LOWriter_IntIsBetween($iRelief, $LOW_RELIEF_NONE, $LOW_RELIEF_ENGRAVED) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
$oObj.CharRelief = $iRelief
$iError = ($oObj.CharRelief() = $iRelief) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($iCase <> Null) Then
If Not __LOWriter_IntIsBetween($iCase, $LOW_CASEMAP_NONE, $LOW_CASEMAP_SM_CAPS) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
$oObj.CharCaseMap = $iCase
$iError = ($oObj.CharCaseMap() = $iCase) ? ($iError) : (BitOR($iError, 2))
EndIf
If ($bHidden <> Null) Then
If Not IsBool($bHidden) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$oObj.CharHidden = $bHidden
$iError = ($oObj.CharHidden() = $bHidden) ? ($iError) : (BitOR($iError, 4))
EndIf
If ($bOutline <> Null) Then
If Not IsBool($bOutline) Then Return SetError($__LO_STATUS_INPUT_ERROR, 7, 0)
$oObj.CharContoured = $bOutline
$iError = ($oObj.CharContoured() = $bOutline) ? ($iError) : (BitOR($iError, 8))
EndIf
If ($bShadow <> Null) Then
If Not IsBool($bShadow) Then Return SetError($__LO_STATUS_INPUT_ERROR, 8, 0)
$oObj.CharShadowed = $bShadow
$iError = ($oObj.CharShadowed() = $bShadow) ? ($iError) : (BitOR($iError, 16))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>__LOWriter_CharEffect
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_CharFont
; Description ...: Set and Retrieve the Font Settings
; Syntax ........: __LOWriter_CharFont(ByRef $oObj, $sFontName, $nFontSize, $iPosture, $iWeight)
; Parameters ....: $oObj - [in/out] an object. An Object that supports "com.sun.star.text.Paragraph" Or "com.sun.star.text.TextPortion" services, such as a Cursor with data selected or paragraph section.
; $sFontName - a string value. The Font Name to change to.
; $nFontSize - a general number value. The new Font size.
; $iPosture - an integer value (0-5). Italic setting. See Constants, $LOW_POSTURE_* as defined in LibreOfficeWriter_Constants.au3. Also see remarks.
; $iWeight - an integer value (0,50-200). Bold settings see Constants, $LOW_WEIGHT_* as defined in LibreOfficeWriter_Constants.au3. Also see remarks.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 5 Return 0 = Passed Object for internal function not an Object.
; @Error 1 @Extended 6 Return 0 = $sFontName not a String.
; @Error 1 @Extended 7 Return 0 = $nFontSize not a Number.
; @Error 1 @Extended 8 Return 0 = $iPosture not an Integer, less than 0, or greater than 5. See Constants, $LOW_POSTURE_* as defined in LibreOfficeWriter_Constants.au3.
; @Error 1 @Extended 9 Return 0 = $iWeight less than 50 and not 0, or more than 200. See Constants, $LOW_WEIGHT_* as defined in LibreOfficeWriter_Constants.au3.
; --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 $sFontName
; | 2 = Error setting $nFontSize
; | 4 = Error setting $iPosture
; | 8 = Error setting $iWeight
; --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 .......: Call this function with only the Object parameter and all other parameters set to Null keyword, to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Not every font accepts Bold and Italic settings, and not all settings for bold and Italic are accepted, such as oblique, ultra Bold etc.
; Libre Writer accepts only the predefined weight values, any other values are changed automatically to an acceptable value, which could trigger a settings error.
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_CharFont(ByRef $oObj, $sFontName, $nFontSize, $iPosture, $iWeight)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $avFont[4]
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If __LOWriter_VarsAreNull($sFontName, $nFontSize, $iPosture, $iWeight) Then
__LOWriter_ArrayFill($avFont, $oObj.CharFontName(), $oObj.CharHeight(), $oObj.CharPosture(), $oObj.CharWeight())
Return SetError($__LO_STATUS_SUCCESS, 1, $avFont)
EndIf
If ($sFontName <> Null) Then
If Not IsString($sFontName) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$oObj.CharFontName = $sFontName
$iError = ($oObj.CharFontName() = $sFontName) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($nFontSize <> Null) Then
If Not IsNumber($nFontSize) Then Return SetError($__LO_STATUS_INPUT_ERROR, 7, 0)
$oObj.CharHeight = $nFontSize
$iError = ($oObj.CharHeight() = $nFontSize) ? ($iError) : (BitOR($iError, 2))
EndIf
If ($iPosture <> Null) Then
If Not __LOWriter_IntIsBetween($iPosture, $LOW_POSTURE_NONE, $LOW_POSTURE_ITALIC) Then Return SetError($__LO_STATUS_INPUT_ERROR, 8, 0)
$oObj.CharPosture = $iPosture
$iError = ($oObj.CharPosture() = $iPosture) ? ($iError) : (BitOR($iError, 4))
EndIf
If ($iWeight <> Null) Then
If Not __LOWriter_IntIsBetween($iWeight, $LOW_WEIGHT_THIN, $LOW_WEIGHT_BLACK, "", $LOW_WEIGHT_DONT_KNOW) Then Return SetError($__LO_STATUS_INPUT_ERROR, 9, 0)
$oObj.CharWeight = $iWeight
$iError = ($oObj.CharWeight() = $iWeight) ? ($iError) : (BitOR($iError, 8))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>__LOWriter_CharFont
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_CharFontColor
; Description ...: Set or retrieve the font color, transparency and highlighting values.
; Syntax ........: __LOWriter_CharFontColor(ByRef $oObj, $iFontColor, $iTransparency, $iHighlight)
; Parameters ....: $oObj - [in/out] an object. An Object that supports "com.sun.star.text.Paragraph" Or "com.sun.star.text.TextPortion" services, such as a Cursor with data selected or paragraph section.
; $iFontColor - an integer value (-1-16777215). The desired font Color value in Long Integer format, can a custom value, or one of the constants, $LOW_COLOR_* as defined in LibreOfficeWriter_Constants.au3. Set to $LOW_COLOR_OFF(-1) for Auto color.
; $iTransparency - an integer value (0-100). Transparency percentage. 0 is visible, 100 is invisible. Available for Libre Office 7.0 and up.
; $iHighlight - an integer value (-1-16777215). The highlight Color value in Long Integer format, can a custom value, or one of the constants, $LOW_COLOR_* as defined in LibreOfficeWriter_Constants.au3. Set to $LOW_COLOR_OFF(-1) for No color.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 3 Return 0 = Passed Object for internal function not an Object.
; @Error 1 @Extended 4 Return 0 = $iFontColor not an integer, less than -1, or greater than 16777215.
; @Error 1 @Extended 5 Return 0 = $iTransparency not an Integer, or less than 0, or greater than 100%.
; @Error 1 @Extended 6 Return 0 = $iHighlight not an integer, less than -1, or greater than 16777215.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Failed to retrieve old Transparency 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 $FontColor
; | 2 = Error setting $iTransparency.
; | 4 = Error setting $iHighlight
; --Version Related Errors--
; @Error 7 @Extended 1 Return 0 = Current Libre Office version lower than 7.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 2 or 3 Element Array with values in order of function parameters. If The current Libre Office version is below 7.0 the returned array will contain 2 elements, because $iTransparency is not available.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Call this function with only the Object parameter and all other parameters set to Null keyword, to get the current settings.
; Related .......: _LOWriter_ConvertColorFromLong, _LOWriter_ConvertColorToLong
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_CharFontColor(ByRef $oObj, $iFontColor, $iTransparency, $iHighlight)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0, $iOldTransparency
Local $avColor[2]
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If __LOWriter_VarsAreNull($iFontColor, $iTransparency, $iHighlight) Then
If __LOWriter_VersionCheck(7.0) Then
__LOWriter_ArrayFill($avColor, __LOWriter_ColorRemoveAlpha($oObj.CharColor()), $oObj.CharTransparence(), $oObj.CharBackColor())
Else
__LOWriter_ArrayFill($avColor, __LOWriter_ColorRemoveAlpha($oObj.CharColor()), $oObj.CharBackColor())
EndIf
Return SetError($__LO_STATUS_SUCCESS, 1, $avColor)
EndIf
If ($iFontColor <> Null) Then
If Not __LOWriter_IntIsBetween($iFontColor, $LOW_COLOR_OFF, $LOW_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If __LOWriter_VersionCheck(7.0) Then
$iOldTransparency = $oObj.CharTransparence()
If Not IsInt($iOldTransparency) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0)
EndIf
$oObj.CharColor = $iFontColor
$iError = ($oObj.CharColor() = $iFontColor) ? ($iError) : (BitOR($iError, 1))
If IsInt($iOldTransparency) Then $oObj.CharTransparence = $iOldTransparency
EndIf
If ($iTransparency <> Null) Then
If Not __LOWriter_IntIsBetween($iTransparency, 0, 100) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If Not __LOWriter_VersionCheck(7.0) Then Return SetError($__LO_STATUS_VER_ERROR, 1, 0)
$oObj.CharTransparence = $iTransparency
$iError = ($oObj.CharTransparence() = $iTransparency) ? ($iError) : (BitOR($iError, 2))
EndIf
If ($iHighlight <> Null) Then
If Not __LOWriter_IntIsBetween($iHighlight, $LOW_COLOR_OFF, $LOW_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
; CharHighlight; same as CharBackColor---Libre seems to use back color for highlighting however, so using that for setting.
;~ If Not __LOWriter_VersionCheck(4.2) Then Return SetError($__LO_STATUS_VER_ERROR, 2, 0)
;~ $oObj.CharHighlight = $iHighlight ;-- keeping old method in case.
;~ $iError = ($oObj.CharHighlight() = $iHighlight) ? ($iError) : (BitOR($iError, 4)
$oObj.CharBackColor = $iHighlight
$iError = ($oObj.CharBackColor() = $iHighlight) ? ($iError) : (BitOR($iError, 4))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>__LOWriter_CharFontColor
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_CharOverLine
; Description ...: Set and retrieve the OverLine settings.
; Syntax ........: __LOWriter_CharOverLine(ByRef $oObj, $bWordOnly, $iOverLineStyle, $bOLHasColor, $iOLColor)
; Parameters ....: $oObj - [in/out] an object. An Object that supports "com.sun.star.text.Paragraph" Or "com.sun.star.text.TextPortion" services, such as a Cursor with data selected or paragraph section.
; $bWordOnly - a boolean value. If true, white spaces are not Overlined.
; $iOverLineStyle - an integer value (0-18). The line style of the Overline, see constants, $LOW_UNDERLINE_* as defined in LibreOfficeWriter_Constants.au3. See Remarks.
; $bOLHasColor - a boolean value. If True, the Overline is colored, must be set to true in order to set the Overline color.
; $iOLColor - an integer value (-1-16777215). The color of the Overline, set in Long integer format. Can be a custom value, or one of the constants, $LOW_COLOR_* as defined in LibreOfficeWriter_Constants.au3. Set to $LOW_COLOR_OFF(-1) for automatic color mode.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 3 Return 0 = Passed Object for internal function not an Object.
; @Error 1 @Extended 4 Return 0 = $bWordOnly not a Boolean.
; @Error 1 @Extended 5 Return 0 = $iOverLineStyle not an Integer, or less than 0, or greater than 18. See constants, $LOW_UNDERLINE_* as defined in LibreOfficeWriter_Constants.au3.
; @Error 1 @Extended 6 Return 0 = $bOLHasColor not a Boolean.
; @Error 1 @Extended 7 Return 0 = $iOLColor not an Integer, or less than -1, or greater than 16777215.
; --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 $bWordOnly
; | 2 = Error setting $iOverLineStyle
; | 4 = Error setting $OLHasColor
; | 8 = Error setting $iOLColor
; --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 .......: OverLine line style uses the same constants as underline style.
; Call this function with only the Object parameter and all other parameters set to Null keyword, to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; $bOLHasColor must be set to true in order to set the Overline color.
; Related .......: _LOWriter_ConvertColorFromLong, _LOWriter_ConvertColorToLong
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_CharOverLine(ByRef $oObj, $bWordOnly, $iOverLineStyle, $bOLHasColor, $iOLColor)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $avOverLine[4]
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If __LOWriter_VarsAreNull($bWordOnly, $iOverLineStyle, $bOLHasColor, $iOLColor) Then
__LOWriter_ArrayFill($avOverLine, $oObj.CharWordMode(), $oObj.CharOverline(), $oObj.CharOverlineHasColor(), $oObj.CharOverlineColor())
Return SetError($__LO_STATUS_SUCCESS, 1, $avOverLine)
EndIf
If ($bWordOnly <> Null) Then
If Not IsBool($bWordOnly) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
$oObj.CharWordMode = $bWordOnly
$iError = ($oObj.CharWordMode() = $bWordOnly) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($iOverLineStyle <> Null) Then
If Not __LOWriter_IntIsBetween($iOverLineStyle, $LOW_UNDERLINE_NONE, $LOW_UNDERLINE_BOLD_WAVE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
$oObj.CharOverline = $iOverLineStyle
$iError = ($oObj.CharOverline() = $iOverLineStyle) ? ($iError) : (BitOR($iError, 2))
EndIf
If ($bOLHasColor <> Null) Then
If Not IsBool($bOLHasColor) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$oObj.CharOverlineHasColor = $bOLHasColor
$iError = ($oObj.CharOverlineHasColor() = $bOLHasColor) ? ($iError) : (BitOR($iError, 4))
EndIf
If ($iOLColor <> Null) Then
If Not __LOWriter_IntIsBetween($iOLColor, $LOW_COLOR_OFF, $LOW_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 7, 0)
$oObj.CharOverlineColor = $iOLColor
$iError = ($oObj.CharOverlineColor() = $iOLColor) ? ($iError) : (BitOR($iError, 8))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>__LOWriter_CharOverLine
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_CharPosition
; Description ...: Set and retrieve settings related to Sub/Super Script and relative size.
; Syntax ........: __LOWriter_CharPosition(ByRef $oObj, $bAutoSuper, $iSuperScript, $bAutoSub, $iSubScript, $iRelativeSize)
; Parameters ....: $oObj - [in/out] an object. An Object that supports "com.sun.star.text.Paragraph" Or "com.sun.star.text.TextPortion" services, such as a Cursor with data selected or paragraph section.
; $bAutoSuper - a boolean value. If True, automatic sizing for Superscript is active.
; $iSuperScript - an integer value. The Superscript percentage value. See Remarks.
; $bAutoSub - a boolean value. If True, automatic sizing for Subscript is active.
; $iSubScript - an integer value. The Subscript percentage value. See Remarks.
; $iRelativeSize - an integer value (1-100). The size percentage relative to current font size.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 3 Return 0 = Passed Object for internal function not an Object.
; @Error 1 @Extended 4 Return 0 = $bAutoSuper not a Boolean.
; @Error 1 @Extended 5 Return 0 = $bAutoSub not a Boolean.
; @Error 1 @Extended 6 Return 0 = $iSuperScript not an integer, less than 0, higher than 100 and Not 14000.
; @Error 1 @Extended 7 Return 0 = $iSubScript not an integer, less than -100, higher than 100 and Not 14000.
; @Error 1 @Extended 8 Return 0 = $iRelativeSize not an integer, or less than 1, higher than 100.
; --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 $iSuperScript
; | 2 = Error setting $iSubScript
; | 4 = Error setting $iRelativeSize.
; --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 Object parameter and all other parameters set to Null keyword, to get the current settings.
; Call any optional parameter with Null keyword to skip it.
; Set either $iSubScript or $iSuperScript to 0 to return it to Normal setting.
; The way LibreOffice is set up Super/Subscript are set in the same setting, Super is a positive number from 1 to 100 (percentage), Subscript is a negative number set to 1 to 100 percentage.
; For the user's convenience this function accepts both positive and negative numbers for Subscript, if a positive number is called for Subscript, it is automatically set to a negative.
; Automatic Superscript has a integer value of 14000, Auto Subscript has a integer value of -14000. There is no settable setting of Automatic Super/Sub Script, though one exists, it is read-only in LibreOffice, consequently I have made two separate parameters to be able to determine if the user wants to automatically set Superscript or Subscript.
; If you set both Auto Superscript to True and Auto Subscript to True, or $iSuperScript to an integer and $iSubScript to an integer, Subscript will be set as it is the last in the line to be set in this function, and thus will over-write any Superscript settings.
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __LOWriter_CharPosition(ByRef $oObj, $bAutoSuper, $iSuperScript, $bAutoSub, $iSubScript, $iRelativeSize)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $iError = 0
Local $avPosition[5]
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If __LOWriter_VarsAreNull($bAutoSuper, $iSuperScript, $bAutoSub, $iSubScript, $iRelativeSize) Then
__LOWriter_ArrayFill($avPosition, ($oObj.CharEscapement() = 14000) ? (True) : (False), ($oObj.CharEscapement() > 0) ? ($oObj.CharEscapement()) : (0), _
($oObj.CharEscapement() = -14000) ? (True) : (False), ($oObj.CharEscapement() < 0) ? ($oObj.CharEscapement()) : (0), $oObj.CharEscapementHeight())
Return SetError($__LO_STATUS_SUCCESS, 1, $avPosition)
EndIf
If ($bAutoSuper <> Null) Then
If Not IsBool($bAutoSuper) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
; If $bAutoSuper = True set it to 14000 (automatic Superscript) else if $iSuperScript is set, let that overwrite
; the current setting, else if subscript is true or set to an integer, it will overwrite the setting. If nothing
; else set Subscript to 1
$iSuperScript = ($bAutoSuper) ? (14000) : ((IsInt($iSuperScript)) ? ($iSuperScript) : ((IsInt($iSubScript) Or ($bAutoSub = True)) ? ($iSuperScript) : (1)))
EndIf
If ($bAutoSub <> Null) Then
If Not IsBool($bAutoSub) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
; If $bAutoSub = True set it to -14000 (automatic Subscript) else if $iSubScript is set, let that overwrite
; the current setting, else if superscript is true or set to an integer, it will overwrite the setting.
$iSubScript = ($bAutoSub) ? (-14000) : ((IsInt($iSubScript)) ? ($iSubScript) : ((IsInt($iSuperScript)) ? ($iSubScript) : (1)))
EndIf
If ($iSuperScript <> Null) Then
If Not __LOWriter_IntIsBetween($iSuperScript, 0, 100, "", 14000) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$oObj.CharEscapement = $iSuperScript
$iError = ($oObj.CharEscapement() = $iSuperScript) ? ($iError) : (BitOR($iError, 1))
EndIf
If ($iSubScript <> Null) Then
If Not __LOWriter_IntIsBetween($iSubScript, -100, 100, "", "-14000:14000") Then Return SetError($__LO_STATUS_INPUT_ERROR, 7, 0)
$iSubScript = ($iSubScript > 0) ? Int("-" & $iSubScript) : $iSubScript
$oObj.CharEscapement = $iSubScript
$iError = ($oObj.CharEscapement() = $iSubScript) ? ($iError) : (BitOR($iError, 2))
EndIf
If ($iRelativeSize <> Null) Then
If Not __LOWriter_IntIsBetween($iRelativeSize, 1, 100) Then Return SetError($__LO_STATUS_INPUT_ERROR, 8, 0)
$oObj.CharEscapementHeight = $iRelativeSize
$iError = ($oObj.CharEscapementHeight() = $iRelativeSize) ? ($iError) : (BitOR($iError, 4))
EndIf
Return ($iError > 0) ? (SetError($__LO_STATUS_PROP_SETTING_ERROR, $iError, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>__LOWriter_CharPosition
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __LOWriter_CharRotateScale
; Description ...: Set or retrieve the character rotational and Scale settings.
; Syntax ........: __LOWriter_CharRotateScale(ByRef $oObj, $iRotation, $iScaleWidth[, $bRotateFitLine = Null])
; Parameters ....: $oObj - [in/out] an object. An Object that supports "com.sun.star.text.Paragraph" Or "com.sun.star.text.TextPortion" services, such as a Cursor with data selected or paragraph section.
; $iRotation - an integer value (0,90,270). Degrees to rotate the text.
; $iScaleWidth - an integer value (1-100). The percentage to horizontally stretch or compress the text. 100 is normal sizing.
; $bRotateFitLine - [optional] a boolean value. Default is Null. If True, Stretches or compresses the selected text so that it fits between the line that is above the text and the line that is below the text. Only works with Direct Formatting.
; Return values .: Success: 1 or Array.
; Failure: 0 and sets the @Error and @Extended flags to non-zero.