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
|
'encoding UTF-8 Do not remove or change this line!
'*******************************************************************************
'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'*
'* Copyright 2008 by Sun Microsystems, Inc.
'*
'* OpenOffice.org - a multi-platform office productivity suite
'*
'* $RCSfile: w_tool5.inc,v $
'*
'* $Revision: 1.2 $
'*
'* last change: $Author: vg $ $Date: 2008-08-18 12:43:52 $
'*
'* This file is part of OpenOffice.org.
'*
'* OpenOffice.org is free software: you can redistribute it and/or modify
'* it under the terms of the GNU Lesser General Public License version 3
'* only, as published by the Free Software Foundation.
'*
'* OpenOffice.org is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'* GNU Lesser General Public License version 3 for more details
'* (a copy is included in the LICENSE file that accompanied this code).
'*
'* You should have received a copy of the GNU Lesser General Public License
'* version 3 along with OpenOffice.org. If not, see
'* <http://www.openoffice.org/license.html>
'* for a copy of the LGPLv3 License.
'*
'/******************************************************************************
'*
'* owner : helge.delfs@sun.com
'*
'* short description : Description of file
'*
'\******************************************************************************
function hLevelContent () as String
' presupposition: just stay in line with the to check content
' easy to enhance; on demand you can add text to the paragraph and only have to chage this function
' input : -
' output: paragraph content
dim sTemp as string
wTypeKeys "<end><shift home>" 'select line
editcopy
sTemp = GetClipboardText()
'i don't need the first '-', so i start searching at 2. char
hLevelContent = Right(sTemp, Len(sTemp)-InStr(2,sTemp,"-")
end function
'------------------------------------------------------------------------------
function hLevelChange(aL() as integer,i as integer,x as integer ,y as integer, sublevel as boolean ) as boolean
' ALSO boolean, if it schould be checked, if it got changed! else don't adjust array!!!
' input: level Nr., how many levels +/-
' return: false, if wrong paragraph
dim itemp as integer
dim xtemp as integer
dim ytemp as integer
dim stemp as integer
dim j as integer
if (hLevelOk (i)) then
if (aL (i,1) + x) > 0 then ' CHG <-> level 'stufen'
' has to work for +/- x
xTemp = aL (i,1)
aL (i,1) = aL (i,1) + x
if (sublevel) then
iTemp = i+1
do while (aL (iTemp,1) > xTemp)
aL (iTemp,1) = aL (iTemp,1) + x
iTemp=iTemp + 1
loop
end if
else
'warnlog "This makes no sense; you trie to 'move to the left'; it doesn't go further! Entry: "+i
end if
iTemp = 1
do while (i <> aL(itemp,2))
inc iTemp
loop
printlog "CHG: found i="+i+" at: "+iTemp
' move entry without sublevels
if (y < -1) OR (y > 1) then warnlog "y ! aus (-1,1) is not implemented :-( yet !"
if (y > 0) then
xtemp = aL( itemp+y ,1)
aL( itemp+y ,1) = aL( itemp ,1)
aL( itemp ,1) = xtemp
xtemp = aL( itemp+y ,2)
aL( itemp+y ,2) = aL( itemp ,2)
aL( itemp ,2) = xtemp
if (sublevel) then ' with sublevel
yTemp = aL( iTemp+y ,1) ' save hor <-> level in yTemp
sTemp = 2
do while (aL (iTemp ,1) > yTemp)
xtemp = aL( itemp+sTemp ,1)
aL( itemp+sTemp ,1) = aL( itemp ,1)
aL( itemp ,1) = xtemp
xtemp = aL( itemp+sTemp ,2)
aL( itemp+sTemp ,2) = aL( itemp ,2)
aL( itemp ,2) = xtemp
inc sTemp
loop
end if
else
if (y < 0) then
for j=-1 to y
xtemp = aL( itemp+j ,1) ' hori <-> level copy
aL( itemp+j ,1) = aL( itemp+j+1 ,1)
aL( itemp+j+1 ,1) = xtemp ' ^
xtemp = aL( itemp+j ,2) ' vert | level copy
aL( itemp+j ,2) = aL( itemp+j+1 ,2) ' v
aL( itemp+j+1 ,2) = xtemp
next j
if (sublevel) then ' with sublevel
yTemp = aL( iTemp+y ,1) ' save hor <-> level in yTemp
iTemp = itemp+1
do while (aL (iTemp,1) > yTemp)
xtemp = aL( itemp+y ,1)
aL( itemp+y ,1) = aL( itemp+y+1 ,1)
aL( itemp+y+1 ,1) = xtemp
xtemp = aL( itemp+y ,2)
aL( itemp+y ,2) = aL( itemp+y+1 ,2)
aL( itemp+y+1 ,2) = xtemp
iTemp=iTemp + 1
loop
end if
else ' 0
end if
end if
end if
end function
'------------------------------------------------------------------------------
function hLevelPrint (aL()as integer) as boolean
dim sTemp as string
dim iTemp as integer
dim i,j as integer
' how big is this array??!!! pd: it has to be in aL(0,0)
printlog "---------------------------------------------------------------------"
for i=1 to aL(0,0)
sTemp = ""
for j=1 to aL(i,1)
sTemp = sTemp + "..."
next j
printlog sTemp + i + " "+aL(i,2)+ " +1: "+aL(i,1)
next i
printlog "---------------------------------------------------------------------"
end function
'------------------------------------------------------------------------------
function hIsNumberingBullets () as Boolean
'/// am i in a NumberingBullets area ?? ///'
'/// Output: True / False (as Boolean) ///'
dim NOerror as Boolean
hIsNumberingBullets = false
NOerror = false
sleep (1)
try
FormatNumberingBullets
NOerror = true
catch
Warnlog "w_tool5.inc::hIsNumberingBullets::Slot not available"
NOerror = false
endcatch
if NOerror then
Kontext
Active.SetPage TabBullet
Kontext "TabBullet"
sleep (1)
if (remove.isEnabled) then
hIsNumberingBullets = true
else
hIsNumberingBullets = false
end if
TabBullet.cancel
end if
sleep (1)
end function
'------------------------------------------------------------------------------
sub hFormatParagraphNumbering (sStyle as string,bRestart as integer,sStartW as string)
FormatParagraph
Kontext
Active.SetPage TabNumerierungAbsatz
Kontext "TabNumerierungAbsatz"
try
if (sStyle <> "") then
Vorlage.Select sStyle
else
Vorlage.Select 2
end if
if (bRestart <> -1) then
select case bRestart
case 0: NumerierungNeuBeginnen.UnCheck
case 1: NumerierungNeuBeginnen.Check
case 2: NumerierungNeuBeginnen.TriState
end select
end if
if (sStartW <> -1) then
select case sStartW
case 0: NumerierungBeginnenBei.UnCheck
case 1: NumerierungBeginnenBei.Check
end select
end if
catch
Warnlog "Not possible; wrong style=none??"
endcatch
TabNumerierungAbsatz.OK
end sub
'------------------------------------------------------------------------------
function hFindInDocument (sTempSearch as string) as boolean
dim sTemp as string
hFindInDocument = FALSE
Call hFindeImDokument (sTempSearch, 1)
EditCopy
sTemp = right (GetClipboardText(), len(sTempSearch))
if (sTemp <> sTempSearch) then
Warnlog "Found: '" & sTemp & "' and not: " & sTempSearch
hFindInDocument = FALSE
else
hFindInDocument = TRUE
end if
end function
|