-
Notifications
You must be signed in to change notification settings - Fork 1
/
LibreOfficeWriter_Par.au3
2200 lines (1997 loc) · 174 KB
/
LibreOfficeWriter_Par.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 Writer
#include "LibreOfficeWriter_Constants.au3"
#include "LibreOfficeWriter_Helper.au3"
#include "LibreOfficeWriter_Internal.au3"
; Other includes for Writer
#include "LibreOfficeWriter_Cursor.au3"
#include "LibreOfficeWriter_Doc.au3"
#include "LibreOfficeWriter_Num.au3"
#include "LibreOfficeWriter_Page.au3"
; #INDEX# =======================================================================================================================
; Title .........: LibreOffice UDF
; AutoIt Version : v3.3.16.1
; Description ...: Provides basic functionality through AutoIt for Creating, Modifying, and Applying L.O. Writer Paragraph Styles.
; Author(s) .....: donnyh13, mLipok
; Dll ...........:
;
; ===============================================================================================================================
; #CURRENT# =====================================================================================================================
; _LOWriter_ParObjCopy
; _LOWriter_ParObjCreateList
; _LOWriter_ParObjDelete
; _LOWriter_ParObjPaste
; _LOWriter_ParObjSectionsGet
; _LOWriter_ParObjSelect
; _LOWriter_ParStyleAlignment
; _LOWriter_ParStyleBackColor
; _LOWriter_ParStyleBorderColor
; _LOWriter_ParStyleBorderPadding
; _LOWriter_ParStyleBorderStyle
; _LOWriter_ParStyleBorderWidth
; _LOWriter_ParStyleCreate
; _LOWriter_ParStyleDelete
; _LOWriter_ParStyleDropCaps
; _LOWriter_ParStyleEffect
; _LOWriter_ParStyleExists
; _LOWriter_ParStyleFont
; _LOWriter_ParStyleFontColor
; _LOWriter_ParStyleGetObj
; _LOWriter_ParStyleHyphenation
; _LOWriter_ParStyleIndent
; _LOWriter_ParStyleOrganizer
; _LOWriter_ParStyleOutLineAndList
; _LOWriter_ParStyleOverLine
; _LOWriter_ParStylePageBreak
; _LOWriter_ParStylePosition
; _LOWriter_ParStyleRotateScale
; _LOWriter_ParStyleSet
; _LOWriter_ParStylesGetNames
; _LOWriter_ParStyleShadow
; _LOWriter_ParStyleSpace
; _LOWriter_ParStyleSpacing
; _LOWriter_ParStyleStrikeOut
; _LOWriter_ParStyleTabStopCreate
; _LOWriter_ParStyleTabStopDelete
; _LOWriter_ParStyleTabStopList
; _LOWriter_ParStyleTabStopMod
; _LOWriter_ParStyleTxtFlowOpt
; _LOWriter_ParStyleUnderLine
; ===============================================================================================================================
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParObjCopy
; Description ...: "Copies" data selected by the ViewCursor, returning an Object for use in inserting later.
; Syntax ........: _LOWriter_ParObjCopy(ByRef $oDoc)
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOWriter_DocOpen, _LOWriter_DocConnect, or _LOWriter_DocCreate function.
; 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.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Failed to Copy Selected Data, make sure Data is selected using the ViewCursor.
; --Success--
; @Error 0 @Extended 0 Return Object = Success. Data was successfully copied, returning an Object for use in _LOWriter_ParObjPaste.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: Data you desire to be copied MUST be selected with the ViewCursor, see _LOWriter_ParObjSelect.
; This function works essentially the same as Copy/ Ctrl+C, except it doesn't use your clipboard.
; The Object returned is used in _LOWriter_ParObjPaste to insert the data again.
; Copying data this way works for Tables, Images, frames and Text, including with direct formatting, etc.
; Data copied can be inserted into the same or another document.
; Related .......: _LOWriter_ParObjPaste, _LOWriter_ParObjSelect, _LOWriter_DocGetViewCursor, _LOWriter_CursorMove
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParObjCopy(ByRef $oDoc)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $oObj
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
$oObj = $oDoc.CurrentController.getTransferable() ; Copy
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0)
Return SetError($__LO_STATUS_SUCCESS, 0, $oObj)
EndFunc ;==>_LOWriter_ParObjCopy
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParObjCreateList
; Description ...: Return Objects for every paragraph contained in a specific section of a document.
; Syntax ........: _LOWriter_ParObjCreateList(ByRef $oCursor[, $bTableCheck = False])
; Parameters ....: $oCursor - [in/out] an object. A Cursor Object returned from any Cursor Object creation Or retrieval functions. See Remarks
; $bTableCheck - [optional] a boolean value. Default is False. If True, returned array will be 2 dimensional, with the second column indicating if the paragraph object is a Table (True) or not (False).
; Return values .: Success: 1D or 2D Array
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oCursor not an Object.
; @Error 1 @Extended 2 Return 0 = $bTableCheck not a Boolean.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Failed to create Enumeration of Paragraphs.
; --Success--
; @Error 0 @Extended ? Return Array = Success. Returns an Array of Paragraph Objects, @Extended is set to the number of results.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: $oCursor can be either a ViewCursor or a TextCursor, the paragraphs are enumerated for the area the cursor is currently within, for example, the ViewCursor is currently in a Table, the enumeration of paragraphs would be for the Cell the cursor was presently in.
; In the main document the enumeration would be for the entire Text Body, in the Header, it would for the that Header for that Page Style etc.
; The different possible areas are: Text Body, Table Cell, Header, Footer, Footnote, Endnote, Frame.
; Returns an Array of objects for Direct Formatting paragraphs in a document, or for copying and inserting etc.
; Table Objects returned from this function can be used as a regular Table Object to modify the Table with.
; Related .......: _LOWriter_ParObjSectionsGet, _LOWriter_ParObjSelect, _LOWriter_ParObjDelete
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParObjCreateList(ByRef $oCursor, $bTableCheck = False)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $oEnum, $oPar
Local $iCount = 0
Local $aoParagraphs[1]
If Not IsObj($oCursor) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsBool($bTableCheck) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$oEnum = $oCursor.Text.createEnumeration()
If Not IsObj($oEnum) Then Return SetError($__LO_STATUS_INIT_ERROR, 1, 0)
If ($bTableCheck = True) Then ReDim $aoParagraphs[1][2]
While $oEnum.hasMoreElements()
$oPar = $oEnum.nextElement()
If ($bTableCheck = True) Then
If UBound($aoParagraphs) <= ($iCount) Then ReDim $aoParagraphs[UBound($aoParagraphs) * 2][2]
$aoParagraphs[$iCount][0] = $oPar
$aoParagraphs[$iCount][1] = ($oPar.supportsService("com.sun.star.text.TextTable"))
$iCount += 1
Else
If UBound($aoParagraphs) <= ($iCount) Then ReDim $aoParagraphs[UBound($aoParagraphs) * 2]
$aoParagraphs[$iCount] = $oPar
$iCount += 1
EndIf
Sleep((IsInt($iCount / $__LOWCONST_SLEEP_DIV) ? (10) : (0)))
WEnd
If ($bTableCheck = True) Then
ReDim $aoParagraphs[$iCount][2]
Else
ReDim $aoParagraphs[$iCount]
EndIf
Return SetError($__LO_STATUS_SUCCESS, $iCount, $aoParagraphs)
EndFunc ;==>_LOWriter_ParObjCreateList
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParObjDelete
; Description ...: Delete a Paragraph Object returned from _LOWriter_ParObjCreateList. See Remarks.
; Syntax ........: _LOWriter_ParObjDelete(ByRef $oParObj)
; Parameters ....: $oParObj - [in/out] an object. A Paragraph Object returned by _LOWriter_ParObjCreateList.
; Return values .: Success: Integer
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oParObj not an Object.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Paragraph was successfully deleted.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: You cannot delete the last paragraph contained in a Text area, it will cause a COM error.
; Related .......: _LOWriter_ParObjCreateList
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParObjDelete(ByRef $oParObj)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
If Not IsObj($oParObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If ($oParObj.supportsService("com.sun.star.text.TextTable")) Then
$oParObj.dispose()
Else
$oParObj.Text.removeTextContent($oParObj)
EndIf
Return SetError($__LO_STATUS_SUCCESS, 0, 1)
EndFunc ;==>_LOWriter_ParObjDelete
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParObjPaste
; Description ...: Inserts a ParObjCopy Object at the current ViewCursor location.
; Syntax ........: _LOWriter_ParObjPaste(ByRef $oDoc, ByRef $oParObj)
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOWriter_DocOpen, _LOWriter_DocConnect, or _LOWriter_DocCreate function.
; $oParObj - [in/out] an object. A Object returned from _LOWriter_ParObjCopy to insert.
; Return values .: Success: Integer
; 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 = $oParObj not an Object.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Data was successfully inserted at the ViewCursor location.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......: _LOWriter_ParObjCopy
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParObjPaste(ByRef $oDoc, ByRef $oParObj)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsObj($oParObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$oDoc.CurrentController.insertTransferable($oParObj)
Return SetError($__LO_STATUS_SUCCESS, 0, 1)
EndFunc ;==>_LOWriter_ParObjPaste
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParObjSectionsGet
; Description ...: Break a Paragraph Object into individual Sections for Direct Formatting etc. See Remarks.
; Syntax ........: _LOWriter_ParObjSectionsGet(ByRef $oParagraph)
; Parameters ....: $oParagraph - [in/out] an object. A Paragraph Object returned from _LOWriter_ParObjCreateList function. Make sure it's not a Table!
; Return values .: Success: Array
; Failure: 0 and sets the @Error and @Extended flags to non-zero.
; --Input Errors--
; @Error 1 @Extended 1 Return 0 = $oParagraph is not an Object.
; @Error 1 @Extended 2 Return 0 = $oParagraph does not support Paragraph service. Not a paragraph Object.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Error enumerating Paragraph sections.
; --Success--
; @Error 0 @Extended 0 Return Array = Success. A two column array. See remarks.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: A Paragraph in a Document may have more than one section if it contains direct formatting, foot/endnote anchors etc.
; The Array returned is a two column array with array[0][0] containing the section Object.
; The second column, array[0][1] contains the section data type column being one of the following possible types:
; |- Text – String content.
; |- TextField – TextField content.
; |- TextContent – Indicates that text content is anchored as or to a character that is not really part of the paragraph — for example, a text frame or a graphic object.
; |- ControlCharacter – Control character.
; |- Footnote – Footnote or Endnote. (This is just the anchor character for the footnote/Endnote, not the actual foot/endnote content.
; |- ReferenceMark – Reference mark.
; |- DocumentIndexMark – Document index mark.
; |- Bookmark – Bookmark.
; |- Redline – Redline portion, which is a result of the change-tracking feature.
; |- Ruby – a ruby attribute which is used in Asian text.
; |- Frame — a frame.
; |- SoftPageBreak — a soft page break.
; |- InContentMetadata — a text range with attached metadata.
; For Reference marks, document index marks, etc., 2 text portions will be generated, one for the start position and one for the end position.
; Related .......: _LOWriter_ParObjCreateList
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParObjSectionsGet(ByRef $oParagraph)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $oSecEnum, $oParSection
Local $aoSections[1][2]
Local $iCount = 0
If Not IsObj($oParagraph) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oParagraph.supportsService("com.sun.star.text.Paragraph") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$oSecEnum = $oParagraph.createEnumeration()
If Not IsObj($oSecEnum) Then Return SetError($__LO_STATUS_INIT_ERROR, 1, 0)
While $oSecEnum.hasMoreElements()
$oParSection = $oSecEnum.nextElement()
If UBound($aoSections) <= ($iCount + 1) Then ReDim $aoSections[UBound($aoSections) * 10][2]
$aoSections[$iCount][0] = $oParSection
$aoSections[$iCount][1] = $oParSection.TextPortionType
$iCount += 1
Sleep((IsInt($iCount / $__LOWCONST_SLEEP_DIV) ? (10) : (0)))
WEnd
ReDim $aoSections[$iCount][2]
Return SetError($__LO_STATUS_SUCCESS, $iCount, $aoSections)
EndFunc ;==>_LOWriter_ParObjSectionsGet
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParObjSelect
; Description ...: Causes a Paragraph Object to be selected by the ViewCursor.
; Syntax ........: _LOWriter_ParObjSelect(ByRef $oDoc, ByRef $oObj)
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOWriter_DocOpen, _LOWriter_DocConnect, or _LOWriter_DocCreate function.
; $oObj - [in/out] an object. A Paragraph Object returned from _LOWriter_ParObjCreateList, a Table or Frame Object, or a Text Cursor with data selected, can be used.
; Return values .: Success: Integer
; 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 = $oObj not an Object.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Failed to retrieve ViewCursor Object.
; @Error 3 @Extended 2 Return 0 = Failed to move ViewCursor.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Object was successfully selected.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: This function causes the ViewCursor to move and select a Paragraph, Table, Frame, TextCursor data, etc., usually in preparation for calling _LOWriter_ParObjCopy.
; Related .......: _LOWriter_ParObjCreateList, _LOWriter_ParObjCopy, _LOWriter_TableGetObjByName, _LOWriter_TableGetObjByCursor, _LOWriter_TableInsert, _LOWriter_FrameGetObjByCursor, _LOWriter_FrameGetObjByName, _LOWriter_DocGetViewCursor, _LOWriter_DocCreateTextCursor, _LOWriter_CellCreateTextCursor, _LOWriter_FrameCreateTextCursor, _LOWriter_DocHeaderGetTextCursor, _LOWriter_DocFooterGetTextCursor, _LOWriter_EndnoteGetTextCursor, _LOWriter_FootnoteGetTextCursor
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParObjSelect(ByRef $oDoc, ByRef $oObj)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $oViewCursor
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsObj($oObj) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$oDoc.CurrentController.Select($oObj)
If ($oObj.supportsService("com.sun.star.text.TextTable")) Then
$oViewCursor = _LOWriter_DocGetViewCursor($oDoc)
If (@error > 0) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0)
_LOWriter_CursorMove($oViewCursor, $LOW_VIEWCUR_GOTO_END, 1, True) ; Move and select to End of cell
If (@error > 0) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 2, 0)
_LOWriter_CursorMove($oViewCursor, $LOW_VIEWCUR_GOTO_END, 1, True) ; Move and select to End of Table
If (@error > 0) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 2, 0)
EndIf
Return SetError($__LO_STATUS_SUCCESS, 0, 1)
EndFunc ;==>_LOWriter_ParObjSelect
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleAlignment
; Description ...: Set and Retrieve Alignment settings for a paragraph style.
; Syntax ........: _LOWriter_ParStyleAlignment(ByRef $oParStyle[, $iHorAlign = Null[, $iVertAlign = Null[, $iLastLineAlign = Null[, $bExpandSingleWord = Null[, $bSnapToGrid = Null[, $iTxtDirection = Null]]]]]])
; Parameters ....: $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj function.
; $iHorAlign - [optional] an integer value (0-3). Default is Null. The Horizontal alignment of the paragraph. See Constants, $LOW_PAR_ALIGN_HOR_* as defined in LibreOfficeWriter_Constants.au3. See Remarks.
; $iVertAlign - [optional] an integer value (0-4). Default is Null. The Vertical alignment of the paragraph. See Constants, $LOW_PAR_ALIGN_VERT_* as defined in LibreOfficeWriter_Constants.au3.
; $iLastLineAlign - [optional] an integer value (0-3). Default is Null. The last line alignment for the paragraph. See Constants, $LOW_PAR_LAST_LINE_* as defined in LibreOfficeWriter_Constants.au3. See Remarks.
; $bExpandSingleWord - [optional] a boolean value. Default is Null. If True, and the last line of a justified paragraph consists of one word, the word is stretched to the width of the paragraph.
; $bSnapToGrid - [optional] a boolean value. Default is Null. If True, aligns the paragraph to a text grid (if one is active).
; $iTxtDirection - [optional] an integer value (0-5). Default is Null. The Text Writing Direction. See Constants, $LOW_TXT_DIR_* as defined in LibreOfficeWriter_Constants.au3. [Libre Office Default is 4]
; 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 = $oParStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oParStyle not a Paragraph Object.
; @Error 1 @Extended 3 Return 0 = Passed Object for internal function not an Object.
; @Error 1 @Extended 4 Return 0 = $iHorAlign not an integer, less than 0, or greater than 3. See constants, $LOW_PAR_ALIGN_HOR_* as defined in LibreOfficeWriter_Constants.au3.
; @Error 1 @Extended 5 Return 0 = $iVertAlign not an integer, less than 0, or greater than 4. See constants, $LOW_PAR_ALIGN_VERT_* as defined in LibreOfficeWriter_Constants.au3.
; @Error 1 @Extended 6 Return 0 = $iLastLineAlign not an integer, less than 0, or greater than 3. See constants, $LOW_PAR_LAST_LINE_* as defined in LibreOfficeWriter_Constants.au3.
; @Error 1 @Extended 7 Return 0 = $bExpandSingleWord not a Boolean.
; @Error 1 @Extended 8 Return 0 = $bSnapToGrid not a Boolean.
; @Error 1 @Extended 9 Return 0 = $iTxtDirection not an Integer, less than 0, or greater than 5, see constants, $LOW_TXT_DIR_* 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 $iHorAlign
; | 2 = Error setting $iVertAlign
; | 4 = Error setting $iLastLineALign
; | 8 = Error setting $bExpandSIngleWord
; | 16 = Error setting $bSnapToGrid
; | 32 = Error setting $iTxtDirection
; --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 6 Element Array with values in order of function parameters.
; Author ........: donnyh13
; Modified ......:
; Remarks .......: $iHorAlign must be set to $LOW_PAR_ALIGN_HOR_JUSTIFIED(2) before you can set $iLastLineAlign, and $iLastLineAlign must be set to $LOW_PAR_LAST_LINE_JUSTIFIED(2) before $bExpandSingleWord can be set.
; $iTxtDirection constants 2,3, and 5 may not be available depending on your language settings.
; 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 .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleAlignment(ByRef $oParStyle, $iHorAlign = Null, $iVertAlign = Null, $iLastLineAlign = Null, $bExpandSingleWord = Null, $bSnapToGrid = Null, $iTxtDirection = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oParStyle.supportsService("com.sun.star.style.ParagraphStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$vReturn = __LOWriter_ParAlignment($oParStyle, $iHorAlign, $iVertAlign, $iLastLineAlign, $bExpandSingleWord, $bSnapToGrid, $iTxtDirection)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOWriter_ParStyleAlignment
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleBackColor
; Description ...: Set or Retrieve background color settings for a Paragraph style.
; Syntax ........: _LOWriter_ParStyleBackColor(ByRef $oParStyle[, $iBackColor = Null[, $bBackTransparent = Null]])
; Parameters ....: $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj 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, $LOW_COLOR_* as defined in LibreOfficeWriter_Constants.au3. Set to $LOW_COLOR_OFF(-1), to turn Background color off.
; $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 = $oParStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oParStyle not a Paragraph Object.
; @Error 1 @Extended 3 Return 0 = Passed Object for internal function not an Object.
; @Error 1 @Extended 4 Return 0 = $iBackColor not an integer, less than -1, or greater than 16777215.
; @Error 1 @Extended 5 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 .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj, _LOWriter_ConvertColorFromLong, _LOWriter_ConvertColorToLong
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleBackColor(ByRef $oParStyle, $iBackColor = Null, $bBackTransparent = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oParStyle.supportsService("com.sun.star.style.ParagraphStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$vReturn = __LOWriter_ParBackColor($oParStyle, $iBackColor, $bBackTransparent)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOWriter_ParStyleBackColor
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleBorderColor
; Description ...: Set and Retrieve the Paragraph Style Border Line Color. Libre Office Version 3.4 and Up.
; Syntax ........: _LOWriter_ParStyleBorderColor(ByRef $oParStyle[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]])
; Parameters ....: $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj function.
; $iTop - [optional] an integer value (0-16777215). Default is Null. Set the Top Border Line Color of the Paragraph Style in Long Color code format. Can be a custom value, or one of the constants, $LOW_COLOR_* as defined in LibreOfficeWriter_Constants.au3.
; $iBottom - [optional] an integer value (0-16777215). Default is Null. Set the Bottom Border Line Color of the Paragraph Style in Long Color code format. Can be a custom value, or one of the constants, $LOW_COLOR_* as defined in LibreOfficeWriter_Constants.au3.
; $iLeft - [optional] an integer value (0-16777215). Default is Null. Set the Left Border Line Color of the Paragraph Style in Long Color code format. Can be a custom value, or one of the constants, $LOW_COLOR_* as defined in LibreOfficeWriter_Constants.au3.
; $iRight - [optional] an integer value (0-16777215). Default is Null. Set the Right Border Line Color of the Paragraph Style in Long Color code format. Can be a custom value, or one of the constants, $LOW_COLOR_* as defined in LibreOfficeWriter_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 = $oParStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oParStyle not a Paragraph 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.
; --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.4.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success.
; @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.
; Certain Error values are passed from the internal border setting function.
; Related .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj, _LOWriter_ConvertColorFromLong, _LOWriter_ConvertColorToLong, _LOWriter_ParStyleBorderWidth, _LOWriter_ParStyleBorderStyle, _LOWriter_ParStyleBorderPadding
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleBorderColor(ByRef $oParStyle, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oParStyle.supportsService("com.sun.star.style.ParagraphStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($iTop <> Null) And Not __LOWriter_IntIsBetween($iTop, $LOW_COLOR_BLACK, $LOW_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($iBottom <> Null) And Not __LOWriter_IntIsBetween($iBottom, $LOW_COLOR_BLACK, $LOW_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If ($iLeft <> Null) And Not __LOWriter_IntIsBetween($iLeft, $LOW_COLOR_BLACK, $LOW_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($iRight <> Null) And Not __LOWriter_IntIsBetween($iRight, $LOW_COLOR_BLACK, $LOW_COLOR_WHITE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$vReturn = __LOWriter_Border($oParStyle, False, False, True, $iTop, $iBottom, $iLeft, $iRight)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOWriter_ParStyleBorderColor
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleBorderPadding
; Description ...: Set or retrieve the Border Padding (spacing between the Paragraph and border) settings.
; Syntax ........: _LOWriter_ParStyleBorderPadding(ByRef $oParStyle[, $iAll = Null[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]]])
; Parameters ....: $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj 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 Paragraph in Micrometers(uM).
; $iBottom - [optional] an integer value. Default is Null. Set the Bottom Distance between the Border and Paragraph in Micrometers(uM).
; $iLeft - [optional] an integer value. Default is Null. Set the Left Distance between the Border and Paragraph in Micrometers(uM).
; $iRight - [optional] an integer value. Default is Null. Set the Right Distance between the Border and Paragraph 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 = $oParStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oParStyle not a Paragraph Object.
; @Error 1 @Extended 3 Return 0 = Passed Object to 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 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 .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj, _LOWriter_ConvertFromMicrometer, _LOWriter_ConvertToMicrometer, _LOWriter_ParStyleBorderWidth, _LOWriter_ParStyleBorderStyle, _LOWriter_ParStyleBorderColor
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleBorderPadding(ByRef $oParStyle, $iAll = Null, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oParStyle.supportsService("com.sun.star.style.ParagraphStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$vReturn = __LOWriter_ParBorderPadding($oParStyle, $iAll, $iTop, $iBottom, $iLeft, $iRight)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOWriter_ParStyleBorderPadding
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleBorderStyle
; Description ...: Set and retrieve the Paragraph Style Border Line style. Libre Office Version 3.4 and Up.
; Syntax ........: _LOWriter_ParStyleBorderStyle(ByRef $oParStyle[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null]]]])
; Parameters ....: $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj function.
; $iTop - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Top Border Line Style of the Paragraph Style using one of the line style constants, $LOW_BORDERSTYLE_* as defined in LibreOfficeWriter_Constants.au3.
; $iBottom - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Bottom Border Line Style of the Paragraph Style using one of the line style constants, $LOW_BORDERSTYLE_* as defined in LibreOfficeWriter_Constants.au3.
; $iLeft - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Left Border Line Style of the Paragraph Style using one of the line style constants, $LOW_BORDERSTYLE_* as defined in LibreOfficeWriter_Constants.au3.
; $iRight - [optional] an integer value (0x7FFF,0-17). Default is Null. Set the Right Border Line Style of the Paragraph Style using one of the line style constants, $LOW_BORDERSTYLE_* as defined in LibreOfficeWriter_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 = $oParStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oParStyle not a Paragraph 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.
; @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.
; @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.
; @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.
; --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.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 .......: 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.
; Certain Error values are passed from the internal border setting function.
; Related .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj, _LOWriter_ParStyleBorderWidth, _LOWriter_ParStyleBorderColor, _LOWriter_ParStyleBorderPadding
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleBorderStyle(ByRef $oParStyle, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oParStyle.supportsService("com.sun.star.style.ParagraphStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($iTop <> Null) And Not __LOWriter_IntIsBetween($iTop, $LOW_BORDERSTYLE_SOLID, $LOW_BORDERSTYLE_DASH_DOT_DOT, "", $LOW_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($iBottom <> Null) And Not __LOWriter_IntIsBetween($iBottom, $LOW_BORDERSTYLE_SOLID, $LOW_BORDERSTYLE_DASH_DOT_DOT, "", $LOW_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If ($iLeft <> Null) And Not __LOWriter_IntIsBetween($iLeft, $LOW_BORDERSTYLE_SOLID, $LOW_BORDERSTYLE_DASH_DOT_DOT, "", $LOW_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($iRight <> Null) And Not __LOWriter_IntIsBetween($iRight, $LOW_BORDERSTYLE_SOLID, $LOW_BORDERSTYLE_DASH_DOT_DOT, "", $LOW_BORDERSTYLE_NONE) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$vReturn = __LOWriter_Border($oParStyle, False, True, False, $iTop, $iBottom, $iLeft, $iRight)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOWriter_ParStyleBorderStyle
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleBorderWidth
; Description ...: Set and retrieve the Paragraph Style Border Line Width, or the Paragraph Style Connect Border option.
; Syntax ........: _LOWriter_ParStyleBorderWidth(ByRef $oParStyle[, $iTop = Null[, $iBottom = Null[, $iLeft = Null[, $iRight = Null[, $bConnectBorder = Null]]]]])
; Parameters ....: $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj function.
; $iTop - [optional] an integer value. Default is Null. Set the Top Border Line width of the Paragraph Style in Micrometers. Can be a custom value, or one of the constants, $LOW_BORDERWIDTH_* as defined in LibreOfficeWriter_Constants.au3. Libre Office Version 3.4 and Up.
; $iBottom - [optional] an integer value. Default is Null. Set the Bottom Border Line Width of the Paragraph Style in Micrometers. Can be a custom value, or one of the constants, $LOW_BORDERWIDTH_* as defined in LibreOfficeWriter_Constants.au3. Libre Office Version 3.4 and Up.
; $iLeft - [optional] an integer value. Default is Null. Set the Left Border Line width of the Paragraph Style in Micrometers. Can be a custom value, or one of the constants, $LOW_BORDERWIDTH_* as defined in LibreOfficeWriter_Constants.au3. Libre Office Version 3.4 and Up.
; $iRight - [optional] an integer value. Default is Null. Set the Right Border Line Width of the Paragraph Style in Micrometers. Can be a custom value, or one of the constants, $LOW_BORDERWIDTH_* as defined in LibreOfficeWriter_Constants.au3. Libre Office Version 3.4 and Up.
; $bConnectBorder - [optional] a boolean value. Default is Null. If True, borders set for a paragraph are merged with the next paragraph. Note: Borders are only merged if they are identical. Libre Office Version 3.4 and Up.
; 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 = $oParStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oParStyle not a Paragraph 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 = $bConnectBorder not a Boolean and Not set to Null.
; --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.4.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success.
; @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 .......: To "Turn Off" Borders, set them 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.
; Certain Error values are passed from the internal border setting function.
; Related .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj, _LOWriter_ConvertFromMicrometer, _LOWriter_ConvertToMicrometer, _LOWriter_ParStyleBorderStyle, _LOWriter_ParStyleBorderColor, _LOWriter_ParStyleBorderPadding
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleBorderWidth(ByRef $oParStyle, $iTop = Null, $iBottom = Null, $iLeft = Null, $iRight = Null, $bConnectBorder = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oParStyle.supportsService("com.sun.star.style.ParagraphStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If ($iTop <> Null) And Not __LOWriter_IntIsBetween($iTop, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($iBottom <> Null) And Not __LOWriter_IntIsBetween($iBottom, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If ($iLeft <> Null) And Not __LOWriter_IntIsBetween($iLeft, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($iRight <> Null) And Not __LOWriter_IntIsBetween($iRight, 0) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
If ($bConnectBorder <> Null) And Not IsBool($bConnectBorder) Then Return SetError($__LO_STATUS_INPUT_ERROR, 7, 0)
If __LOWriter_VarsAreNull($iTop, $iBottom, $iLeft, $iRight, $bConnectBorder) Then
$vReturn = __LOWriter_Border($oParStyle, True, False, False, $iTop, $iBottom, $iLeft, $iRight)
__LOWriter_AddTo1DArray($vReturn, $oParStyle.ParaIsConnectBorder())
Return SetError($__LO_STATUS_SUCCESS, 1, $vReturn)
ElseIf Not __LOWriter_VarsAreNull($iTop, $iBottom, $iLeft, $iRight) Then
$vReturn = __LOWriter_Border($oParStyle, True, False, False, $iTop, $iBottom, $iLeft, $iRight)
If @error Then Return SetError(@error, @extended, $vReturn)
EndIf
If ($bConnectBorder <> Null) Then $oParStyle.ParaIsConnectBorder = $bConnectBorder
Return SetError($__LO_STATUS_SUCCESS, 0, 1)
EndFunc ;==>_LOWriter_ParStyleBorderWidth
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleCreate
; Description ...: Create a new Paragraph Style in a Document.
; Syntax ........: _LOWriter_ParStyleCreate(ByRef $oDoc, $sParStyle)
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOWriter_DocOpen, _LOWriter_DocConnect, or _LOWriter_DocCreate function.
; $sParStyle - a string value. The Name of the new Paragraph 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 = $sParStyle not a String.
; @Error 1 @Extended 3 Return 0 = Paragraph Style name called in $sParStyle already exists in document.
; --Initialization Errors--
; @Error 2 @Extended 1 Return 0 = Error Creating "com.sun.star.style.ParagraphStyle" Object.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Error Retrieving "ParagraphStyle" Object.
; @Error 3 @Extended 2 Return 0 = Error creating new Paragraph Style by name.
; @Error 3 @Extended 3 Return 0 = Error Retrieving Created Paragraph Style Object.
; --Success--
; @Error 0 @Extended 0 Return Object = Success. New paragraph Style successfully created. Returning its Object.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......: _LOWriter_ParStyleDelete
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleCreate(ByRef $oDoc, $sParStyle)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $oParStyles, $oStyle, $oParStyle
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsString($sParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$oParStyles = $oDoc.StyleFamilies().getByName("ParagraphStyles")
If Not IsObj($oParStyles) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0)
If _LOWriter_ParStyleExists($oDoc, $sParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
$oStyle = $oDoc.createInstance("com.sun.star.style.ParagraphStyle")
If Not IsObj($oStyle) Then Return SetError($__LO_STATUS_INIT_ERROR, 1, 0)
$oParStyles.insertByName($sParStyle, $oStyle)
If Not $oParStyles.hasByName($sParStyle) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 2, 0)
$oParStyle = $oParStyles.getByName($sParStyle)
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 3, 0)
Return SetError($__LO_STATUS_SUCCESS, 0, $oParStyle)
EndFunc ;==>_LOWriter_ParStyleCreate
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleDelete
; Description ...: Delete a User-Created Paragraph Style from a Document.
; Syntax ........: _LOWriter_ParStyleDelete(ByRef $oDoc, $oParStyle[, $bForceDelete = False[, $sReplacementStyle = "Default Paragraph Style"]])
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOWriter_DocOpen, _LOWriter_DocConnect, or _LOWriter_DocCreate function.
; $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj function. Must be a User-Created Style, not a built-in Style native to LibreOffice.
; $bForceDelete - [optional] a boolean value. Default is False. If True, Paragraph style will be deleted regardless of whether it is in use or not.
; $sReplacementStyle - [optional] a string value. Default is "Default Paragraph Style". The Paragraph style to use instead of the one being deleted if the paragraph style being deleted is applied to text in the document.
; 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 = $oParStyle not an Object.
; @Error 1 @Extended 3 Return 0 = $oParStyle not a Paragraph Object.
; @Error 1 @Extended 4 Return 0 = $bForceDelete not a Boolean.
; @Error 1 @Extended 5 Return 0 = $sReplacementStyle not a String.
; @Error 1 @Extended 6 Return 0 = Paragraph Style called in $sReplacementStyle doesn't exist in Document.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Error retrieving "ParagraphStyles" Object.
; @Error 3 @Extended 2 Return 0 = Error retrieving Paragraph Style Name.
; @Error 3 @Extended 3 Return 0 = $oParStyle is not a User-Created Paragraph Style and cannot be deleted.
; @Error 3 @Extended 4 Return 0 = $oParStyle is in use and $bForceDelete is false.
; @Error 3 @Extended 5 Return 0 = $oParStyle still exists after deletion attempt.
; --Success--
; @Error 0 @Extended 0 Return 1 = Success. Paragraph Style called in $oParStyle was successfully deleted.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj, _LOWriter_ParStylesGetNames
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleDelete(ByRef $oDoc, ByRef $oParStyle, $bForceDelete = False, $sReplacementStyle = "Default Paragraph Style")
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $oParStyles
Local $sParStyle
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If Not $oParStyle.supportsService("com.sun.star.style.ParagraphStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If Not IsBool($bForceDelete) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
If Not IsString($sReplacementStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 5, 0)
If ($sReplacementStyle <> "") And Not _LOWriter_ParStyleExists($oDoc, $sReplacementStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 6, 0)
$oParStyles = $oDoc.StyleFamilies().getByName("ParagraphStyles")
If Not IsObj($oParStyles) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 1, 0)
$sParStyle = $oParStyle.Name()
If Not IsString($sParStyle) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 2, 0)
If Not $oParStyle.isUserDefined() Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 3, 0)
If $oParStyle.isInUse() And Not ($bForceDelete) Then Return SetError($__LO_STATUS_PROCESSING_ERROR, 4, 0) ; If Style is in use return an error unless force delete is true.
If ($oParStyle.getParentStyle() = Null) Or ($sReplacementStyle <> "Default Paragraph Style") Then $oParStyle.setParentStyle($sReplacementStyle)
; If Parent style is blank set it to "Default Paragraph Style", Or if not but User has called a specific style set it to that.
$oParStyles.removeByName($sParStyle)
Return ($oParStyles.hasByName($sParStyle)) ? (SetError($__LO_STATUS_PROCESSING_ERROR, 5, 0)) : (SetError($__LO_STATUS_SUCCESS, 0, 1))
EndFunc ;==>_LOWriter_ParStyleDelete
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleDropCaps
; Description ...: Set or Retrieve DropCaps settings for a Paragraph style.
; Syntax ........: _LOWriter_ParStyleDropCaps(ByRef $oDoc, $oParStyle[, $iNumChar = Null[, $iLines = Null[, $iSpcTxt = Null[, $bWholeWord = Null[, $sCharStyle = Null]]]]])
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOWriter_DocOpen, _LOWriter_DocConnect, or _LOWriter_DocCreate function.
; $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj function.
; $iNumChar - [optional] an integer value (0-9). Default is Null. The number of characters to make into DropCaps.
; $iLines - [optional] an integer value (0,2-9). Default is Null. The number of lines to drop down.
; $iSpcTxt - [optional] an integer value. Default is Null. The distance between the drop cap and the following text. in Micrometers.
; $bWholeWord - [optional] a boolean value. Default is Null. If True, DropCap the whole first word. (Nullifys $iNumChars.)
; $sCharStyle - [optional] a string value. Default is Null. The character style to use for the DropCaps. 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 1 Return 0 = $oDoc not an Object.
; @Error 1 @Extended 2 Return 0 = $oParStyle not an Object.
; @Error 1 @Extended 3 Return 0 = $oParStyle not a Paragraph Object.
; @Error 1 @Extended 4 Return 0 = Character Style called in $sCharStyle not found in document.
; @Error 1 @Extended 5 Return 0 = Passed Object for internal function not an Object.
; @Error 1 @Extended 6 Return 0 = $iNumChar not an integer, less than 0, or greater than 9.
; @Error 1 @Extended 7 Return 0 = $iLines not an Integer, less than 0, equal to 1, or greater than 9
; @Error 1 @Extended 8 Return 0 = $iSpaceTxt not an Integer, or less than 0.
; @Error 1 @Extended 9 Return 0 = $bWholeWord not a Boolean.
; @Error 1 @Extended 10 Return 0 = $sCharStyle not a String.
; --Processing Errors--
; @Error 3 @Extended 1 Return 0 = Error retrieving DropCap Format Object.
; --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 $iNumChar
; | 2 = Error setting $iLines
; | 4 = Error setting $iSpcTxt
; | 8 = Error setting $bWholeWord
; | 16 = Error setting $sCharStyle
; --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 .......: Set $iNumChars, $iLines, $iSpcTxt to 0 to disable DropCaps.
; I am unable to find a way to set Drop Caps character style to "None" as is available in the User Interface. When it is set to "None" Libre returns a blank string ("") but setting it to a blank string throws a COM error/Exception, even when attempting to set it to Libre's own return value without any in-between variables, in case I was mistaken as to it being a blank string, but this still caused a COM error. So consequently, you cannot set Character Style to "None", but you can still disable Drop Caps as noted above.
; 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 .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj, _LOWriter_ConvertFromMicrometer, _LOWriter_ConvertToMicrometer
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleDropCaps(ByRef $oDoc, ByRef $oParStyle, $iNumChar = Null, $iLines = Null, $iSpcTxt = Null, $bWholeWord = Null, $sCharStyle = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If Not $oParStyle.supportsService("com.sun.star.style.ParagraphStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 3, 0)
If ($sCharStyle <> Null) And Not _LOWriter_CharStyleExists($oDoc, $sCharStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 4, 0)
$vReturn = __LOWriter_ParDropCaps($oParStyle, $iNumChar, $iLines, $iSpcTxt, $bWholeWord, $sCharStyle)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOWriter_ParStyleDropCaps
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleEffect
; Description ...: Set or Retrieve the Font Effect settings for a Paragraph Style.
; Syntax ........: _LOWriter_ParStyleEffect(ByRef $oParStyle[, $iRelief = Null[, $iCase = Null[, $bHidden = Null[, $bOutline = Null[, $bShadow = Null]]]]])
; Parameters ....: $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj function.
; $iRelief - [optional] an integer value (0-2). Default is Null. The Character Relief style. See Constants, $LOW_RELIEF_* as defined in LibreOfficeWriter_Constants.au3.
; $iCase - [optional] an integer value (0-4). Default is Null. The Character Case Style. See Constants, $LOW_CASEMAP_* as defined in LibreOfficeWriter_Constants.au3.
; $bHidden - [optional] a boolean value. Default is Null. If True, the Characters are hidden.
; $bOutline - [optional] a boolean value. Default is Null. If True, the characters have an outline around the outside.
; $bShadow - [optional] a boolean value. Default is Null. 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 1 Return 0 = $oParStyle not an Object.
; @Error 1 @Extended 2 Return 0 = $oParStyle not a Paragraph Object.
; @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 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 .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleEffect(ByRef $oParStyle, $iRelief = Null, $iCase = Null, $bHidden = Null, $bOutline = Null, $bShadow = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
Local $vReturn
If Not IsObj($oParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not $oParStyle.supportsService("com.sun.star.style.ParagraphStyle") Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
$vReturn = __LOWriter_CharEffect($oParStyle, $iRelief, $iCase, $bHidden, $bOutline, $bShadow)
Return SetError(@error, @extended, $vReturn)
EndFunc ;==>_LOWriter_ParStyleEffect
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleExists
; Description ...: Check whether a Document contains a specific Paragraph Style by name.
; Syntax ........: _LOWriter_ParStyleExists(ByRef $oDoc, $sParStyle)
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOWriter_DocOpen, _LOWriter_DocConnect, or _LOWriter_DocCreate function.
; $sParStyle - a string value. The Paragraph 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 = $sParStyle not a String.
; --Success--
; @Error 0 @Extended 0 Return Boolean = Success. If the Document contains the Paragraph style called in $sParStyle, True is returned, else False.
; Author ........: donnyh13
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleExists(ByRef $oDoc, $sParStyle)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler
If Not IsObj($oDoc) Then Return SetError($__LO_STATUS_INPUT_ERROR, 1, 0)
If Not IsString($sParStyle) Then Return SetError($__LO_STATUS_INPUT_ERROR, 2, 0)
If $oDoc.StyleFamilies.getByName("ParagraphStyles").hasByName($sParStyle) Then Return SetError($__LO_STATUS_SUCCESS, 0, True)
Return SetError($__LO_STATUS_SUCCESS, 0, False)
EndFunc ;==>_LOWriter_ParStyleExists
; #FUNCTION# ====================================================================================================================
; Name ..........: _LOWriter_ParStyleFont
; Description ...: Set and Retrieve the Font Settings for a Paragraph Style.
; Syntax ........: _LOWriter_ParStyleFont(ByRef $oDoc, ByRef $oParStyle[, $sFontName = Null[, $nFontSize = Null[, $iPosture = Null[, $iWeight = Null]]]])
; Parameters ....: $oDoc - [in/out] an object. A Document object returned by a previous _LOWriter_DocOpen, _LOWriter_DocConnect, or _LOWriter_DocCreate function.
; $oParStyle - [in/out] an object. A Paragraph Style object returned by a previous _LOWriter_ParStyleCreate, or _LOWriter_ParStyleGetObj function.
; $sFontName - [optional] a string value. Default is Null. The Font Name to use.
; $nFontSize - [optional] a general number value. Default is Null. The new Font size.
; $iPosture - [optional] an integer value (0-5). Default is Null. The Font Italic setting. See Constants, $LOW_POSTURE_* as defined in LibreOfficeWriter_Constants.au3. Also see remarks.
; $iWeight - [optional] an integer value (0,50-200). Default is Null. The Font 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 1 Return 0 = $oDoc not an Object.
; @Error 1 @Extended 2 Return 0 = $oParStyle not an Object.
; @Error 1 @Extended 3 Return 0 = $oParStyle not a Paragraph Object.
; @Error 1 @Extended 4 Return 0 = Font called in $sFontName not available in current document.
; @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.
; @Error 1 @Extended 9 Return 0 = $iWeight less than 50 and not 0, or more than 200. See Constants.
; --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 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.
; 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 .......: _LOWriter_ParStyleCreate, _LOWriter_ParStyleGetObj, _LOWriter_FontsGetNames
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _LOWriter_ParStyleFont(ByRef $oDoc, ByRef $oParStyle, $sFontName = Null, $nFontSize = Null, $iPosture = Null, $iWeight = Null)
Local $oCOM_ErrorHandler = ObjEvent("AutoIt.Error", __LOWriter_InternalComErrorHandler)
#forceref $oCOM_ErrorHandler