AutoPilotRun.xba (3e02b54d) AutoPilotRun.xba (79ff0626)
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="AutoPilotRun" script:language="StarBasic">Option Explicit
24
25Public SourceDir as String
26Public TargetDir as String
27Public TargetStemDir as String
28Public SourceFile as String
29Public TargetFile as String

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

49 BasicLibraries.LoadLibrary(&quot;Tools&quot;)
50 BasicLibraries.LoadLibrary(&quot;ImportWizard&quot;)
51 If InitResources(&quot;Euro Converter&quot;, &quot;eur&quot;) Then
52 oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
53 oLocale = GetStarOfficeLocale()
54 InitializeConverter(oLocale, 2)
55 ToggleGoOnButton()
56 oFactoryKey = GetRegistryKeyContent(&quot;org.openoffice.Setup/Office/Factories&quot;)
22 ***********************************************************-->
23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="AutoPilotRun" script:language="StarBasic">Option Explicit
24
25Public SourceDir as String
26Public TargetDir as String
27Public TargetStemDir as String
28Public SourceFile as String
29Public TargetFile as String

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

49 BasicLibraries.LoadLibrary(&quot;Tools&quot;)
50 BasicLibraries.LoadLibrary(&quot;ImportWizard&quot;)
51 If InitResources(&quot;Euro Converter&quot;, &quot;eur&quot;) Then
52 oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
53 oLocale = GetStarOfficeLocale()
54 InitializeConverter(oLocale, 2)
55 ToggleGoOnButton()
56 oFactoryKey = GetRegistryKeyContent(&quot;org.openoffice.Setup/Office/Factories&quot;)
57 DialogModel.chkTextDocuments.Enabled = oFactoryKey.hasbyName(&quot;com.sun.star.text.TextDocument&quot;)
57 DialogModel.chkTextDocuments.Enabled = oFactoryKey.hasbyName(&quot;com.sun.star.text.TextDocument&quot;)
58 DialogModel.cmdGoOn.DefaultButton = True
59 DialogModel.lstCurrencies.TabIndex = 12
60 DialogConvert.GetControl(&quot;optWholeDir&quot;).SetFocus()
61 DialogConvert.Execute()
62 DialogConvert.Dispose()
63 End If
64End Sub
65

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

142 oDocument = OpenDocument(SourceFile, OpenProperties(), bDisposable)
143 If (oDocument.IsReadOnly) AND (UCase(SourceFile) = UCase(TargetFile)) Then
144 bIsReadOnly = True
145 Msgbox(sMsgDOCISREADONLY, 16, GetProductName())
146 Else
147 bIsReadOnly = False
148 RetrieveDocumentObjects()
149 sViewPath = CutPathView(SourceFile, 60)
58 DialogModel.cmdGoOn.DefaultButton = True
59 DialogModel.lstCurrencies.TabIndex = 12
60 DialogConvert.GetControl(&quot;optWholeDir&quot;).SetFocus()
61 DialogConvert.Execute()
62 DialogConvert.Dispose()
63 End If
64End Sub
65

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

142 oDocument = OpenDocument(SourceFile, OpenProperties(), bDisposable)
143 If (oDocument.IsReadOnly) AND (UCase(SourceFile) = UCase(TargetFile)) Then
144 bIsReadOnly = True
145 Msgbox(sMsgDOCISREADONLY, 16, GetProductName())
146 Else
147 bIsReadOnly = False
148 RetrieveDocumentObjects()
149 sViewPath = CutPathView(SourceFile, 60)
150 DialogModel.lblCurDocument.Label = Str(DocIndex+1) &amp; &quot;/&quot; &amp; sTotDocCount &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
150 DialogModel.lblCurDocument.Label = Str(DocIndex+1) &amp; &quot;/&quot; &amp; sTotDocCount &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
151 End If
152 InitializeDocument() = Not bIsReadOnly
153 Else
154 InitializeDocument() = False
155 End If
156 Else
157 InitializeDocument() = False
158 End If

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

241 DialogModel.lblRetrieval.Label = sPrgsRETRIEVAL
242 DialogModel.lblCurProgress.Label = sPrgsCONVERTING
243 If DialogModel.optWholeDir.State = 1 Then
244 TextBoxText = sSOURCEDIR &amp; &quot; &quot; &amp; ConvertFromUrl(Source) &amp; chr(13)
245 If DialogModel.chkRecursive.State = 1 Then
246 TextBoxText = TextBoxText &amp; DeleteStr(sInclusiveSubDir,&quot;~&quot;) &amp; chr(13)
247 End If
248 Else
151 End If
152 InitializeDocument() = Not bIsReadOnly
153 Else
154 InitializeDocument() = False
155 End If
156 Else
157 InitializeDocument() = False
158 End If

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

241 DialogModel.lblRetrieval.Label = sPrgsRETRIEVAL
242 DialogModel.lblCurProgress.Label = sPrgsCONVERTING
243 If DialogModel.optWholeDir.State = 1 Then
244 TextBoxText = sSOURCEDIR &amp; &quot; &quot; &amp; ConvertFromUrl(Source) &amp; chr(13)
245 If DialogModel.chkRecursive.State = 1 Then
246 TextBoxText = TextBoxText &amp; DeleteStr(sInclusiveSubDir,&quot;~&quot;) &amp; chr(13)
247 End If
248 Else
249 TextBoxText = sSOURCEFILE &amp; &quot; &quot; &amp; ConvertFromUrl(Source) &amp; chr(13)
249 TextBoxText = sSOURCEFILE &amp; &quot; &quot; &amp; ConvertFromUrl(Source) &amp; chr(13)
250 End If
251 TextBoxText = TextBoxText &amp; sTARGETDIR &amp; &quot; &quot; &amp; ConvertFromUrl(TargetDir) &amp; chr(13)
252 If DialogModel.chkProtect.State = 1 Then
253 TextBoxText = TextboxText &amp; sPrgsUNPROTECT
254 End If
255 DialogModel.txtConfig.Text = TextBoxText
256 ToggleProgressStep()
250 End If
251 TextBoxText = TextBoxText &amp; sTARGETDIR &amp; &quot; &quot; &amp; ConvertFromUrl(TargetDir) &amp; chr(13)
252 If DialogModel.chkProtect.State = 1 Then
253 TextBoxText = TextboxText &amp; sPrgsUNPROTECT
254 End If
255 DialogModel.txtConfig.Text = TextBoxText
256 ToggleProgressStep()
257 DialogModel.cmdGoOn.Enabled = False
258 InitializeThirdStep() = True
257 DialogModel.cmdGoOn.Enabled = False
258 InitializeThirdStep() = True
259 Else
260 InitializeThirdStep() = False
261 End If
262End Function
263
264
265Sub ToggleProgressStep(Optional aEvent as Object)
266Dim bMakeVisible as Boolean

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

271 DialogModel.Step = 3
272 Else
273 DialogModel.Step = 2
274 End If
275 DialogConvert.GetControl(&quot;lblCurrencies&quot;).Visible = Not bMakeVisible
276 DialogConvert.GetControl(&quot;lstCurrencies&quot;).Visible = Not bMakeVisible
277 DialogConvert.GetControl(&quot;cmdBack&quot;).Visible = bMakeVisible
278 DialogConvert.GetControl(&quot;cmdGoOn&quot;).Visible = bMakeVisible
259 Else
260 InitializeThirdStep() = False
261 End If
262End Function
263
264
265Sub ToggleProgressStep(Optional aEvent as Object)
266Dim bMakeVisible as Boolean

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

271 DialogModel.Step = 3
272 Else
273 DialogModel.Step = 2
274 End If
275 DialogConvert.GetControl(&quot;lblCurrencies&quot;).Visible = Not bMakeVisible
276 DialogConvert.GetControl(&quot;lstCurrencies&quot;).Visible = Not bMakeVisible
277 DialogConvert.GetControl(&quot;cmdBack&quot;).Visible = bMakeVisible
278 DialogConvert.GetControl(&quot;cmdGoOn&quot;).Visible = bMakeVisible
279 DialogModel.imgPreview.ImageUrl = BitmapDir &amp; &quot;euro_&quot; &amp; DialogModel.Step &amp; &quot;.bmp&quot;
279 DialogModel.imgPreview.ImageUrl = BitmapDir &amp; &quot;euro_&quot; &amp; DialogModel.Step &amp; &quot;.png&quot;
280End Sub
281
282
283Sub EnableStep2DialogControls(OnValue as Boolean)
284 With DialogModel
285 .hlnExtent.Enabled = OnValue
286 .optWholeDir.Enabled = OnValue
287 .optSingleFile.Enabled = OnValue

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

325 bIsValid = oUcb.Exists(sPath)
326 If bIsValid Then
327 If DialogModel.optSingleFile.State = 1 Then
328 If bCheckFileType Then
329 sLocMimeType = GetRealFileContent(sPath)
330 If DialogModel.chkTextDocuments.State = 1 Then
331 If (Instr(1, sLocMimeType, &quot;text&quot;) = 0) And (Instr(1, sLocMimeType, &quot;calc&quot;) = 0) Then
332 Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
280End Sub
281
282
283Sub EnableStep2DialogControls(OnValue as Boolean)
284 With DialogModel
285 .hlnExtent.Enabled = OnValue
286 .optWholeDir.Enabled = OnValue
287 .optSingleFile.Enabled = OnValue

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

325 bIsValid = oUcb.Exists(sPath)
326 If bIsValid Then
327 If DialogModel.optSingleFile.State = 1 Then
328 If bCheckFileType Then
329 sLocMimeType = GetRealFileContent(sPath)
330 If DialogModel.chkTextDocuments.State = 1 Then
331 If (Instr(1, sLocMimeType, &quot;text&quot;) = 0) And (Instr(1, sLocMimeType, &quot;calc&quot;) = 0) Then
332 Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
333 bIsValid = False
334 End If
333 bIsValid = False
334 End If
335 Else
336 If (Instr(1, sLocMimeType, &quot;spreadsheet&quot;) = 0) And (Instr(1, sLocMimeType, &quot;calc&quot;)) = 0 Then
337 Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
338 bIsValid = False
339 End If
340 End If
341 End If
342 Else
343 If Not oUcb.IsFolder(sPath) Then
344 sNoDirMessage = ReplaceString(sMsgNODIRECTORY,sPath,&quot;&lt;1&gt;&quot;)
345 Msgbox(sNoDirMessage,48, sMsgDLGTITLE)
346 bIsValid = False
347 Else
348 sPath = RTrimStr(sPath,&quot;/&quot;)
349 sPath = sPath &amp; &quot;/&quot;
350 End If
351 End if
352 Else
335 Else
336 If (Instr(1, sLocMimeType, &quot;spreadsheet&quot;) = 0) And (Instr(1, sLocMimeType, &quot;calc&quot;)) = 0 Then
337 Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
338 bIsValid = False
339 End If
340 End If
341 End If
342 Else
343 If Not oUcb.IsFolder(sPath) Then
344 sNoDirMessage = ReplaceString(sMsgNODIRECTORY,sPath,&quot;&lt;1&gt;&quot;)
345 Msgbox(sNoDirMessage,48, sMsgDLGTITLE)
346 bIsValid = False
347 Else
348 sPath = RTrimStr(sPath,&quot;/&quot;)
349 sPath = sPath &amp; &quot;/&quot;
350 End If
351 End if
352 Else
353 Msgbox(HeaderString &amp; &quot; &apos;&quot; &amp; ConvertFromUrl(sPath) &amp; &quot;&apos; &quot; &amp; sMsgNOTTHERE,48, sMsgDLGTITLE)
353 Msgbox(HeaderString &amp; &quot; &apos;&quot; &amp; ConvertFromUrl(sPath) &amp; &quot;&apos; &quot; &amp; sMsgNOTTHERE,48, sMsgDLGTITLE)
354 End If
355 If bIsValid Then
356 AssignFileName() = sPath
357 Else
358 AssignFilename() = &quot;&quot;
359 End If
360End Function
361
362
363Sub ToggleGoOnButton()
354 End If
355 If bIsValid Then
356 AssignFileName() = sPath
357 Else
358 AssignFilename() = &quot;&quot;
359 End If
360End Function
361
362
363Sub ToggleGoOnButton()
364Dim bDoEnable as Boolean
364Dim bDoEnable as Boolean
365Dim sLocMimeType as String
366Dim sPath as String
367 bDoEnable = Ubound(DialogModel.lstCurrencies.SelectedItems()) &gt; -1
368 If bDoEnable Then
369 &apos; Check if Source is set correctly
370 sPath = ConvertToUrl(Trim(DialogModel.txtSource.Text))
371 bDoEnable = oUcb.Exists(sPath)
372 End If
373 DialogModel.cmdGoOn.Enabled = bDoEnable
374End Sub
375
376
377Sub CallFolderPicker()
378 GetFolderName(DialogModel.txtTarget)
365Dim sLocMimeType as String
366Dim sPath as String
367 bDoEnable = Ubound(DialogModel.lstCurrencies.SelectedItems()) &gt; -1
368 If bDoEnable Then
369 &apos; Check if Source is set correctly
370 sPath = ConvertToUrl(Trim(DialogModel.txtSource.Text))
371 bDoEnable = oUcb.Exists(sPath)
372 End If
373 DialogModel.cmdGoOn.Enabled = bDoEnable
374End Sub
375
376
377Sub CallFolderPicker()
378 GetFolderName(DialogModel.txtTarget)
379 ToggleGoOnButton()
379 ToggleGoOnButton()
380End Sub
381
382
383Sub CallFilePicker()
384 If DialogModel.optSingleFile.State = 1 Then
385 Dim oMasterKey as Object
386 Dim oTypes() as Object
387 Dim oUIKey() as Object
380End Sub
381
382
383Sub CallFilePicker()
384 If DialogModel.optSingleFile.State = 1 Then
385 Dim oMasterKey as Object
386 Dim oTypes() as Object
387 Dim oUIKey() as Object
388
388
389 oMasterKey = GetRegistryKeyContent(&quot;org.openoffice.TypeDetection.Types&quot;)
390 oTypes() = oMasterKey.Types
391 oUIKey = GetRegistryKeyContent(&quot;org.openoffice.Office.UI/FilterClassification/LocalFilters&quot;)
392 If DialogModel.chkTextDocuments.State = 1 Then
393 Dim FilterNames(11,1) as String
394 FilterNames(6,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer&quot;).UIName
395 FilterNames(6,1) = &quot;*.sxw&quot;
396 FilterNames(7,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer_Template&quot;).UIName

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

401 Filternames(9,1) = &quot;*.vor&quot;
402 FilterNames(10,0) = oTypes.GetByName(&quot;writer8&quot;).UIName
403 FilterNames(10,1) = &quot;*.odt&quot;
404 FilterNames(11,0) = oTypes.GetByName(&quot;writer8_template&quot;).UIName
405 FilterNames(11,1) = &quot;*.ott&quot;
406 Else
407 ReDim FilterNames(5,1) as String
408 End If
389 oMasterKey = GetRegistryKeyContent(&quot;org.openoffice.TypeDetection.Types&quot;)
390 oTypes() = oMasterKey.Types
391 oUIKey = GetRegistryKeyContent(&quot;org.openoffice.Office.UI/FilterClassification/LocalFilters&quot;)
392 If DialogModel.chkTextDocuments.State = 1 Then
393 Dim FilterNames(11,1) as String
394 FilterNames(6,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer&quot;).UIName
395 FilterNames(6,1) = &quot;*.sxw&quot;
396 FilterNames(7,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer_Template&quot;).UIName

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

401 Filternames(9,1) = &quot;*.vor&quot;
402 FilterNames(10,0) = oTypes.GetByName(&quot;writer8&quot;).UIName
403 FilterNames(10,1) = &quot;*.odt&quot;
404 FilterNames(11,0) = oTypes.GetByName(&quot;writer8_template&quot;).UIName
405 FilterNames(11,1) = &quot;*.ott&quot;
406 Else
407 ReDim FilterNames(5,1) as String
408 End If
409 FilterNames(0,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc&quot;).UIName
409 FilterNames(0,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc&quot;).UIName
410 Filternames(0,1) = &quot;*.sxc&quot;
411 FilterNames(1,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc_Template&quot;).UIName
412 Filternames(1,1) = &quot;*.stc&quot;
413 FilterNames(2,0) = oUIKey.Classes.GetByName(&quot;sc345&quot;).DisplayName
414 FilterNames(2,1) = &quot;*.sdc&quot;
415 FilterNames(3,0) = oUIKey.Classes.GetByName(&quot;sc345templ&quot;).DisplayName
416 Filternames(3,1) = &quot;*.vor&quot;
410 Filternames(0,1) = &quot;*.sxc&quot;
411 FilterNames(1,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc_Template&quot;).UIName
412 Filternames(1,1) = &quot;*.stc&quot;
413 FilterNames(2,0) = oUIKey.Classes.GetByName(&quot;sc345&quot;).DisplayName
414 FilterNames(2,1) = &quot;*.sdc&quot;
415 FilterNames(3,0) = oUIKey.Classes.GetByName(&quot;sc345templ&quot;).DisplayName
416 Filternames(3,1) = &quot;*.vor&quot;
417 FilterNames(4,0) = oTypes.GetByName(&quot;calc8&quot;).UIName
417 FilterNames(4,0) = oTypes.GetByName(&quot;calc8&quot;).UIName
418 Filternames(4,1) = &quot;*.ods&quot;
418 Filternames(4,1) = &quot;*.ods&quot;
419 FilterNames(5,0) = oTypes.GetByName(&quot;calc8_template&quot;).UIName
419 FilterNames(5,0) = oTypes.GetByName(&quot;calc8_template&quot;).UIName
420 Filternames(5,1) = &quot;*.ots&quot;
421 GetFileName(DialogModel.txtSource, Filternames())
422 Else
423 GetFolderName(DialogModel.txtSource)
424 End If
425 ToggleGoOnButton()
426End Sub
427
428
429Sub PreviousStep()
430 DialogModel.Step = 2
420 Filternames(5,1) = &quot;*.ots&quot;
421 GetFileName(DialogModel.txtSource, Filternames())
422 Else
423 GetFolderName(DialogModel.txtSource)
424 End If
425 ToggleGoOnButton()
426End Sub
427
428
429Sub PreviousStep()
430 DialogModel.Step = 2
431 DialogModel.cmdGoOn.Label = sGOON
431 DialogModel.cmdGoOn.Label = sGOON
432 DialogModel.cmdCancel.Label = sCANCEL
433End Sub
434</script:module>
432 DialogModel.cmdCancel.Label = sCANCEL
433End Sub
434</script:module>