ConvertRun.xba (3e02b54d) ConvertRun.xba (b53bcc32)
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<!--***********************************************************
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<!--***********************************************************
4 *
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
12 *
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
21 *
22 ***********************************************************-->
23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ConvertRun" script:language="StarBasic">Option Explicit
24
25Public oPreSelRange as Object
26
27Sub Main()
28 BasicLibraries.LoadLibrary(&quot;Tools&quot;)
29 If InitResources(&quot;Euro Converter&quot;, &quot;eur&quot;) Then

--- 96 unchanged lines hidden (view full) ---

126End Sub
127
128
129Sub EnableStep1DialogControls(bCurrEnabled as Boolean, bFrameEnabled as Boolean, bButtonsEnabled as Boolean)
130Dim bCurrIsSelected as Boolean
131Dim bObjectIsSelected as Boolean
132Dim bConvertWholeDoc as Boolean
133Dim bDoEnableFrame as Boolean
22 ***********************************************************-->
23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ConvertRun" script:language="StarBasic">Option Explicit
24
25Public oPreSelRange as Object
26
27Sub Main()
28 BasicLibraries.LoadLibrary(&quot;Tools&quot;)
29 If InitResources(&quot;Euro Converter&quot;, &quot;eur&quot;) Then

--- 96 unchanged lines hidden (view full) ---

126End Sub
127
128
129Sub EnableStep1DialogControls(bCurrEnabled as Boolean, bFrameEnabled as Boolean, bButtonsEnabled as Boolean)
130Dim bCurrIsSelected as Boolean
131Dim bObjectIsSelected as Boolean
132Dim bConvertWholeDoc as Boolean
133Dim bDoEnableFrame as Boolean
134 bConvertWholeDoc = DialogModel.chkComplete.State = 1
134 bConvertWholeDoc = DialogModel.chkComplete.State = 1
135 bDoEnableFrame = bFrameEnabled And (NOT bConvertWholeDoc)
136
137 &apos; Controls around the Selection Listbox
138 With DialogModel
139 .lblCurrencies.Enabled = bCurrEnabled
140 .lstCurrencies.Enabled = bCurrEnabled
141 .lstSelection.Enabled = bDoEnableFrame
142 .lblSelection.Enabled = bDoEnableFrame
143 .hlnSelection.Enabled = bDoEnableFrame
144 .optCellTemplates.Enabled = bDoEnableFrame
145 .optSheetRanges.Enabled = bDoEnableFrame
146 .optDocRanges.Enabled = bDoEnableFrame
147 .optSelRange.Enabled = bDoEnableFrame
148 End With
149 &apos; The CheckBox has the Value &apos;1&apos; when the Controls in the Frame are disabled
150 If bButtonsEnabled Then
151 bCurrIsSelected = Ubound(DialogModel.lstCurrencies.SelectedItems()) &lt;&gt; -1
152 &apos; Enable GoOnButton only when Currency is selected
135 bDoEnableFrame = bFrameEnabled And (NOT bConvertWholeDoc)
136
137 &apos; Controls around the Selection Listbox
138 With DialogModel
139 .lblCurrencies.Enabled = bCurrEnabled
140 .lstCurrencies.Enabled = bCurrEnabled
141 .lstSelection.Enabled = bDoEnableFrame
142 .lblSelection.Enabled = bDoEnableFrame
143 .hlnSelection.Enabled = bDoEnableFrame
144 .optCellTemplates.Enabled = bDoEnableFrame
145 .optSheetRanges.Enabled = bDoEnableFrame
146 .optDocRanges.Enabled = bDoEnableFrame
147 .optSelRange.Enabled = bDoEnableFrame
148 End With
149 &apos; The CheckBox has the Value &apos;1&apos; when the Controls in the Frame are disabled
150 If bButtonsEnabled Then
151 bCurrIsSelected = Ubound(DialogModel.lstCurrencies.SelectedItems()) &lt;&gt; -1
152 &apos; Enable GoOnButton only when Currency is selected
153 DialogModel.cmdGoOn.Enabled = bCurrIsSelected
153 DialogModel.cmdGoOn.Enabled = bCurrIsSelected
154 DialogModel.chkComplete.Enabled = bCurrIsSelected
155 If bDoEnableFrame AND DialogModel.cmdGoOn.Enabled Then
156 &apos; If FrameControls are enabled, check if Listbox is Empty
157 bObjectIsSelected = Ubound(DialogModel.lstSelection.SelectedItems()) &lt;&gt; -1
158 DialogModel.cmdGoOn.Enabled = bObjectIsSelected
159 End If
160 Else
161 DialogModel.cmdGoOn.Enabled = False

--- 14 unchanged lines hidden (view full) ---

176 DialogModel.cmdGoOn.Enabled = False
177 End If
178 If Not bDocHasProtectedSheets Then
179 EnableStep1DialogControls(False, False, False)
180 InitializeProgressBar()
181 If DialogModel.optSelRange.State = 1 Then
182 SelectListItem()
183 End If
154 DialogModel.chkComplete.Enabled = bCurrIsSelected
155 If bDoEnableFrame AND DialogModel.cmdGoOn.Enabled Then
156 &apos; If FrameControls are enabled, check if Listbox is Empty
157 bObjectIsSelected = Ubound(DialogModel.lstSelection.SelectedItems()) &lt;&gt; -1
158 DialogModel.cmdGoOn.Enabled = bObjectIsSelected
159 End If
160 Else
161 DialogModel.cmdGoOn.Enabled = False

--- 14 unchanged lines hidden (view full) ---

176 DialogModel.cmdGoOn.Enabled = False
177 End If
178 If Not bDocHasProtectedSheets Then
179 EnableStep1DialogControls(False, False, False)
180 InitializeProgressBar()
181 If DialogModel.optSelRange.State = 1 Then
182 SelectListItem()
183 End If
184 SelList() = DialogConvert.GetControl(&quot;lstSelection&quot;).SelectedItems()
184 SelList() = DialogConvert.GetControl(&quot;lstSelection&quot;).SelectedItems()
185 If DialogModel.optCellTemplates.State = 1 Then
186 &apos; Option &apos;Soft&apos; Formatation is selected
187 AssignRangestoStyle(DialogModel.lstSelection.StringItemList(), SelList())
188 ConverttheSoftWay(SelList(), True)
189 ElseIf DialogModel.optSelRange.State = 1 Then
190 oSheetRanges = oPreSelRange.CellFormatRanges.createEnumeration
191 While oSheetRanges.hasMoreElements
192 oRange = oSheetRanges.NextElement

--- 59 unchanged lines hidden (view full) ---

252
253
254Sub GetPreSelectedRange()
255Dim i as Integer
256Dim OldCurrSymbolList(2) as String
257Dim OldCurrIndex as Integer
258Dim OldCurExtension(2) as String
259 oPreSelRange = AddSelectedRangeToSelRangesEnum()
185 If DialogModel.optCellTemplates.State = 1 Then
186 &apos; Option &apos;Soft&apos; Formatation is selected
187 AssignRangestoStyle(DialogModel.lstSelection.StringItemList(), SelList())
188 ConverttheSoftWay(SelList(), True)
189 ElseIf DialogModel.optSelRange.State = 1 Then
190 oSheetRanges = oPreSelRange.CellFormatRanges.createEnumeration
191 While oSheetRanges.hasMoreElements
192 oRange = oSheetRanges.NextElement

--- 59 unchanged lines hidden (view full) ---

252
253
254Sub GetPreSelectedRange()
255Dim i as Integer
256Dim OldCurrSymbolList(2) as String
257Dim OldCurrIndex as Integer
258Dim OldCurExtension(2) as String
259 oPreSelRange = AddSelectedRangeToSelRangesEnum()
260
260
261 DialogModel.chkComplete.State = Abs(Not(bPreSelected))
262 If bPreSelected Then
263 DialogModel.optSelRange.State = 1
264 AddRangeToListbox(oPreSelRange)
265 Else
261 DialogModel.chkComplete.State = Abs(Not(bPreSelected))
262 If bPreSelected Then
263 DialogModel.optSelRange.State = 1
264 AddRangeToListbox(oPreSelRange)
265 Else
266 DialogModel.optCellTemplates.State = 1
266 DialogModel.optCellTemplates.State = 1
267 CreateStyleEnumeration()
268 End If
269 EnableStep1DialogControls(True, bPreSelected, True)
270 DialogModel.optSelRange.Enabled = bPreSelected
271End Sub
272
273
274Sub AddRangeToListbox(oLocRange as Object)
275 EmptyListBox(DialogModel.lstSelection)
276 PreName = RetrieveRangeNamefromAddress(oLocRange)
277 AddSingleItemToListbox(DialogModel.lstSelection, Prename)&apos;, 0)
278 SelectListboxItem(DialogModel.lstCurrencies, CurrIndex)
279 TotCellCount = CountRangeCells(oLocRange)
280End Sub
281
282
283Sub CheckRangeSelection(Optional oEvent)
284 EmptySelection()
285 AddRangeToListbox(oPreSelRange)
267 CreateStyleEnumeration()
268 End If
269 EnableStep1DialogControls(True, bPreSelected, True)
270 DialogModel.optSelRange.Enabled = bPreSelected
271End Sub
272
273
274Sub AddRangeToListbox(oLocRange as Object)
275 EmptyListBox(DialogModel.lstSelection)
276 PreName = RetrieveRangeNamefromAddress(oLocRange)
277 AddSingleItemToListbox(DialogModel.lstSelection, Prename)&apos;, 0)
278 SelectListboxItem(DialogModel.lstCurrencies, CurrIndex)
279 TotCellCount = CountRangeCells(oLocRange)
280End Sub
281
282
283Sub CheckRangeSelection(Optional oEvent)
284 EmptySelection()
285 AddRangeToListbox(oPreSelRange)
286 oPreSelRange = AddSelectedRangeToSelRangesEnum()
286 oPreSelRange = AddSelectedRangeToSelRangesEnum()
287End Sub
288
289
290&apos; Checks if a Field (LocField) is already defined in an Array
291&apos; Returns &apos;True&apos; or &apos;False&apos;
292Function FieldinList(LocList(), MaxIndex as integer, ByVal LocField ) As Boolean
293Dim i as integer
287End Sub
288
289
290&apos; Checks if a Field (LocField) is already defined in an Array
291&apos; Returns &apos;True&apos; or &apos;False&apos;
292Function FieldinList(LocList(), MaxIndex as integer, ByVal LocField ) As Boolean
293Dim i as integer
294 LocField = Ucase(LocField)
294 LocField = UCase(LocField)
295 For i = Lbound(LocList()) to MaxIndex
295 For i = Lbound(LocList()) to MaxIndex
296 If Ucase(LocList(i)) = LocField then
296 If UCase(LocList(i)) = LocField then
297 FieldInList = True
298 Exit Function
299 End if
300 Next
301 FieldInList = False
302End Function
303
304

--- 33 unchanged lines hidden ---
297 FieldInList = True
298 Exit Function
299 End if
300 Next
301 FieldInList = False
302End Function
303
304

--- 33 unchanged lines hidden ---