summaryrefslogtreecommitdiff
path: root/wizards/source/euro
diff options
context:
space:
mode:
authorBehrend Cornelius <bc@openoffice.org>2001-06-25 18:03:49 +0000
committerBehrend Cornelius <bc@openoffice.org>2001-06-25 18:03:49 +0000
commit24751aa8b62a8067c18180bb74dc087674521a36 (patch)
treed3024acd29773d5546748db525382465fb55cbcb /wizards/source/euro
parentf58bd0d8af5214eb70e7bd853b56b6751e805402 (diff)
#88694# several changes
Diffstat (limited to 'wizards/source/euro')
-rw-r--r--wizards/source/euro/AutoPilotRun.xba112
-rw-r--r--wizards/source/euro/Common.xba25
-rw-r--r--wizards/source/euro/ConvertRun.xba19
-rw-r--r--wizards/source/euro/Init.xba32
-rw-r--r--wizards/source/euro/Protect.xba13
-rw-r--r--wizards/source/euro/Soft.xba3
6 files changed, 136 insertions, 68 deletions
diff --git a/wizards/source/euro/AutoPilotRun.xba b/wizards/source/euro/AutoPilotRun.xba
index bf233abaf7f5..24890618426b 100644
--- a/wizards/source/euro/AutoPilotRun.xba
+++ b/wizards/source/euro/AutoPilotRun.xba
@@ -40,17 +40,24 @@ End Sub
Sub ConvertDocuments()
Dim FilesList()
- Source = AssignFileName(DialogModel.txtSource.Text, DialogModel.lblSource.Label, True)
- TargetDir = AssignFileName(DialogModel.txtTarget.Text, DialogModel.lblTarget.Label, False)
If Source &lt;&gt; &quot;&quot; And TargetDir &lt;&gt; &quot;&quot; Then
- bRecursive = DialogModel.chkRecursive.State = 1
- InitializeThirdStep()
If DialogModel.optSingleFile.State = 1 Then
SourceFile = Source
TotDocCount = 1
Else
SourceDir = Source
TargetStemDir = TargetDir
+ FilterList(0) = &quot;application/x-starcalc&quot;
+ FilterList(1) = &quot;application/vnd.stardivision.calc&quot;
+ FilterList(2) = &quot;application/vnd.sun.xml.calc&quot;
+
+ If DialogModel.chkTextDocuments.State = 1 Then
+ ReDim Preserve FilterList(6) as String
+ FilterList(3) = &quot;application/x-starwriter&quot;
+ FilterList(4) = &quot;application/vnd.stardivision.writer&quot;
+ FilterList(5) = &quot;application/vnd.stardivision.writer/web&quot;
+ FilterList(6) = &quot;application/vnd.sun.xml.writer&quot;
+ End If
FilesList() = ReadDirectories(SourceDir, bRecursive, True, False, FilterList())
TotDocCount = Ubound(FilesList(),1) + 1
End If
@@ -90,10 +97,9 @@ Dim bIsReadOnly as Boolean
oDocument = OpenDocument(SourceFile, NoArgs(), StarDesktop)
bIsReadOnly = oDocument.IsReadOnly
If Not bIsReadOnly Then
- DoUnProtect = -6 * Int(DialogModel.chkProtect.State = 1)
RetrieveDocumentObjects()
sViewPath = CutPathView(SourceFile, 60)
- DialogModel.lblCurDocument.Label = Str(DocIndex) &amp; &quot;/&quot; &amp; sTotDocCount &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
+ DialogModel.lblCurDocument.Label = Str(DocIndex+1) &amp; &quot;/&quot; &amp; sTotDocCount &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
Else
Msgbox(sMsgDOCISREADONLY, 16, GetProductName())
End If
@@ -182,18 +188,22 @@ End Sub
Sub InitializeThirdStep()
Dim TextBoxText as String
+ Source = AssignFileName(DialogModel.txtSource.Text, DialogModel.lblSource.Label, True)
+ TargetDir = AssignFileName(DialogModel.txtTarget.Text, DialogModel.lblTarget.Label, False)
+ bRecursive = DialogModel.chkRecursive.State = 1
+ bDoUnprotect = DialogModel.chkProtect.State = 1
DialogModel.lblRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD
DialogModel.lblRetrieval.Label = sPrgsRETRIEVAL
DialogModel.lblCurProgress.Label = sPrgsCONVERTING
If DialogModel.optWholeDir.State = 1 Then
TextBoxText = sSOURCEDIR &amp; &quot; &quot; &amp; Source &amp; chr(13) &apos;&amp; &quot; &quot;
If DialogModel.chkRecursive.State = 1 Then
- TextBoxText = TextBoxText &amp; DeleteStr(sSUBDIR,&quot;&amp;&quot;) &amp; chr(13)&apos; &amp; &quot; &quot;
+ TextBoxText = TextBoxText &amp; DeleteStr(sInclusiveSubDir,&quot;~&quot;) &amp; chr(13)
End If
Else
- TextBoxText = sSOURCEFILE &amp; &quot; &quot; &amp; Source &amp; chr(13) &apos;&amp; &quot; &quot;
+ TextBoxText = sSOURCEFILE &amp; &quot; &quot; &amp; Source &amp; chr(13)
End If
- TextBoxText = TextBoxText &amp; sTARGETDIR &amp; &quot; &quot; &amp; TargetDir &amp; chr(13)&apos; &amp; &quot; &quot;
+ TextBoxText = TextBoxText &amp; sTARGETDIR &amp; &quot; &quot; &amp; TargetDir &amp; chr(13)
If DialogModel.chkProtect.State = 1 Then
TextBoxText = TextboxText &amp; sPrgsUNPROTECT
End If
@@ -205,9 +215,11 @@ End Sub
Sub ToggleProgressStep(Optional aEvent as Object)
Dim bMakeVisible as Boolean
Dim LocStep as Integer
+ &apos; If the Sub is call by the &apos;cmdBack&apos; Button then set the &apos;bMakeVisible&apos; variable accordingly
bMakeVisible = IsMissing(aEvent)
- DialogConvert.GetControl(&quot;lblCurrencies&quot;).Visible = bMakeVisible
- DialogConvert.GetControl(&quot;lstCurrencies&quot;).Visible = bMakeVisible
+ &apos; Todo: Wieso können die nicht unsichtbar gemacht werden?
+ DialogConvert.GetControl(&quot;lblCurrencies&quot;).Visible = Not bMakeVisible
+ DialogConvert.GetControl(&quot;lstCurrencies&quot;).Visible = Not bMakeVisible
DialogConvert.GetControl(&quot;cmdBack&quot;).Visible = bMakeVisible
DialogConvert.GetControl(&quot;cmdGoOn&quot;).Visible = bMakeVisible
If bMakeVisible Then
@@ -319,6 +331,84 @@ End Sub
Sub CallFilePicker()
If DialogModel.optSingleFile.State = 1 Then
+ Dim oMasterKey as Object
+ Dim oFilters() as Object
+
+ oMasterKey = GetRegistryKeyContent(&quot;org.openoffice.Office.TypeDetection/&quot;)
+ oFilters() = oMasterKey.Filters
+
+ If DialogModel.chkTextDocuments.State = 1 Then
+ Dim FilterNames(21,1) as String
+
+ FilterNames(9,0) = oFilters.GetByName(&quot;writer_StarOffice_XML_Writer&quot;).UIName
+ FilterNames(9,1) = &quot;*.sxw&quot;
+
+ FilterNames(10,0) = oFilters.GetByName(&quot;writer_StarOffice_XML_Writer_Template&quot;).UIName
+ FilterNames(10,1) = &quot;*.vor&quot;
+
+ FilterNames(11,0) = oFilters.GetByName(&quot;writer_StarWriter_10&quot;).UIName
+ FilterNames(11,1) = &quot;*.sdw&quot;
+
+ FilterNames(12,0) = oFilters.GetByName(&quot;writer_StarWriter_30&quot;).UIName
+ FilterNames(12,1) = &quot;*.sdw&quot;
+
+ FilterNames(13,0) = oFilters.GetByName(&quot;writer_StarWriter_30_VorlageTemplate&quot;).UIName
+ FilterNames(13,1) = &quot;*.vor&quot;
+
+ FilterNames(14,0) = oFilters.GetByName(&quot;writer_StarWriter_40&quot;).UIName
+ FilterNames(14,1) = &quot;*.sdw&quot;
+
+ FilterNames(15,0) = oFilters.GetByName(&quot;writer_StarWriter_40_VorlageTemplate&quot;).UIName
+ FilterNames(15,1) = &quot;*.vor&quot;
+
+ FilterNames(16,0) = oFilters.GetByName(&quot;writer_StarWriter_50&quot;).UIName
+ FilterNames(16,1) = &quot;*.sdw&quot;
+
+ FilterNames(17,0) = oFilters.GetByName(&quot;writer_StarWriter_50_VorlageTemplate&quot;).UIName
+ FilterNames(17,1) = &quot;*.vor&quot;
+
+ FilterNames(18,0) = oFilters.GetByName(&quot;writer_web_StarOffice_XML_Writer_Web_Template&quot;).UIName
+ FilterNames(18,1) = &quot;*.stw&quot;
+
+ FilterNames(19,0) = oFilters.GetByName(&quot;writer_web_StarWriterWeb_40_VorlageTemplate&quot;).UIName
+ FilterNames(19,1) = &quot;*.vor&quot;
+
+ FilterNames(20,0) = oFilters.GetByName(&quot;writer_web_StarWriterWeb_50_VorlageTemplate&quot;).UIName
+ FilterNames(20,1) = &quot;*.vor&quot;
+
+ FilterNames(21,0) = oFilters.GetByName(&quot;writer_web_HTML&quot;).UIName
+ FilterNames(21,1) = &quot;*.HTML&quot;
+
+ Else
+ ReDim FilterNames(8,1) as String
+ End If
+ FilterNames(0,0) = oFilters.GetByName(&quot;calc_StarOffice_XML_Calc&quot;).UIName
+ Filternames(0,1) = &quot;*.sxc&quot;
+
+ FilterNames(1,0) = oFilters.GetByName(&quot;calc_StarOffice_XML_Calc_Template&quot;).UIName
+ Filternames(1,1) = &quot;*.stw&quot;
+
+ FilterNames(2,0) = oFilters.GetByName(&quot;calc_StarCalc_10&quot;).UIName
+ Filternames(2,1) = &quot;*.sdc&quot;
+
+ FilterNames(3,0) = oFilters.GetByName(&quot;calc_StarCalc_30&quot;).UIName
+ Filternames(3,1) = &quot;*.sdc&quot;
+
+ FilterNames(4,0) = oFilters.GetByName(&quot;calc_StarCalc_30_VorlageTemplate&quot;).UIName
+ Filternames(4,1) = &quot;*.vor&quot;
+
+ FilterNames(5,0) = oFilters.GetByName(&quot;calc_StarCalc_40&quot;).UIName
+ Filternames(5,1) = &quot;*.sdc&quot;
+
+ FilterNames(6,0) = oFilters.GetByName(&quot;calc_StarCalc_40_VorlageTemplate&quot;).UIName
+ Filternames(6,1) = &quot;*.vor&quot;
+
+ FilterNames(7,0) = oFilters.GetByName(&quot;calc_StarCalc_50&quot;).UIName
+ Filternames(7,1) = &quot;*.sdc&quot;
+
+ FilterNames(8,0) = oFilters.GetByName(&quot;calc_StarCalc_50_VorlageTemplate&quot;).UIName
+ Filternames(8,1) = &quot;*.vor&quot;
+
GetFileName(DialogModel.txtSource, Filternames())
Else
GetFolderName(DialogModel.txtSource)
diff --git a/wizards/source/euro/Common.xba b/wizards/source/euro/Common.xba
index 822047a0e57d..8ac0d1496ad1 100644
--- a/wizards/source/euro/Common.xba
+++ b/wizards/source/euro/Common.xba
@@ -39,7 +39,7 @@ Function ConvertDocument()
If Instr(1, CurMimeType, &quot;calc&quot;) &lt;&gt; 0 Then
bDocHasProtectedSheets = CheckSheetProtection(oSheets)
If bDocHasProtectedSheets Then
- bDocHasProtectedSheets = UnprotectSheetsWithPassword(oSheets)
+ bDocHasProtectedSheets = UnprotectSheetsWithPassword(oSheets, bDoUnProtect)
End If
If Not bDocHasProtectedSheets Then
If Not bRangeListDefined Then
@@ -177,17 +177,18 @@ End Function
Sub StartConversion()
GoOn = True
- ToggleWindow(False)
- If DialogModel.Step = 2 Then
- ConvertDocuments()
- Else
- If DialogModel.chkComplete.State = 1 Then
- ConvertWholeDocument()
- Else
- ConvertRangesorStylesofDocument()
- End If
- End If
- ToggleWindow(True)
+&apos; ToggleWindow(False)
+ Select Case DialogModel.Step
+ Case 1
+ If DialogModel.chkComplete.State = 1 Then
+ ConvertWholeDocument()
+ Else
+ ConvertRangesorStylesofDocument()
+ End If
+ Case 2
+ InitializeThirdStep()
+ ConvertDocuments()
+ End Select
End Sub
diff --git a/wizards/source/euro/ConvertRun.xba b/wizards/source/euro/ConvertRun.xba
index c724890c5794..9d9548509576 100644
--- a/wizards/source/euro/ConvertRun.xba
+++ b/wizards/source/euro/ConvertRun.xba
@@ -10,7 +10,7 @@
Sub Main()
BasicLibraries.LoadLibrary(&quot;Tools&quot;)
If InitResources(&quot;Euro Converter&quot;, &quot;eur&quot;) Then
- DoUnProtect = 0
+ bDoUnProtect = False
bPreSelected = True
DocDisposed = False
oDocument = StarDesktop.CurrentFrame.Controller.Model
@@ -51,7 +51,7 @@ Dim MaxIndex as Integer
If DialogModel.optDocRanges.State = 1 Then
&apos; Document is the basis for the conversion
ListIndex = Listbox.SelectedItems(0)
- oCurSheet = RetrieveSheetoutofRangeName(ListIndex)
+ oCurSheet = RetrieveSheetoutofRangeName(Listbox.StringItemList(ListIndex))
oDocument.CurrentController.SetActiveSheet(oCurSheet)
Else
oCurSheet = oDocument.CurrentController.ActiveSheet
@@ -152,7 +152,7 @@ Dim SelList() as String
bDocHasProtectedSheets = CheckSheetProtection(oSheets)
If bDocHasProtectedSheets Then
- bDocHasProtectedSheets = UnprotectSheetsWithPassWord(oSheets)
+ bDocHasProtectedSheets = UnprotectSheetsWithPassWord(oSheets, bDoUnProtect)
DialogModel.cmdGoOn.Enabled = False
End If
If Not bDocHasProtectedSheets Then
@@ -167,8 +167,6 @@ Dim SelList() as String
AssignRangestoStyle(DialogModel.lstSelection.StringItemList(), SelList())
ConverttheSoftWay(SelList(), True)
Else
- &apos; Option &apos;Hard Formatation is selected
- SelectRange()
ConverttheHardWay(SelList(), False, True)
End If
oStatusline.End
@@ -184,15 +182,8 @@ Dim s as Integer
DialogModel.cmdGoOn.Enabled = False
DialogModel.chkComplete.Enabled = False
GoOn = ConvertDocument()
- If Ubound(DialogModel.lstSelection.StringItemList()) &gt; -1 AND GoOn Then
- EmptyListbox(DialogModel.lstSelection())
- EnableStep1DialogControls(True, True, True)
- Else
- &apos; The next time ask for unprotection again
- DoUnprotect = 0
- DialogModel.cmdGoOn.Enabled = True
- DialogModel.chkComplete.Enabled = True
- End If
+ EmptyListbox(DialogModel.lstSelection())
+ EnableStep1DialogControls(True, True, True)
End Sub
diff --git a/wizards/source/euro/Init.xba b/wizards/source/euro/Init.xba
index d6b75f90d41c..a188e64b10fe 100644
--- a/wizards/source/euro/Init.xba
+++ b/wizards/source/euro/Init.xba
@@ -17,8 +17,8 @@ Public StyleRangeAssignmentList(SBRANGEUBOUND)as String
Public SelRangeList(SBRANGEUBOUND) as String
Public RangeList(SBRANGEUBOUND, 1) as String
Public UnprotectList() as String
-Public FilterNames(7,1) as String
-
+Public FilterNames(2,1) as String
+Public bDoUnProtect as Boolean
Public sREADY as String
Public sPROTECT as String
@@ -78,6 +78,7 @@ Public sCurrSYSUNKNOWN as String
Public sPrgsRETRIEVAL as String
Public sPrgsCONVERTING as String
Public sPrgsUNPROTECT as String
+Public sInclusiveSubDir as String
Public Const SBCOUNTRYCOUNT = 12
Public CurMimeType as String
@@ -164,23 +165,6 @@ Sub InitializeResources()
.lblSelection.Label = sCURRRANGES
Else
.hlnExtent.Label = GetResText(1200)
-&apos;Todo: Diese Strings in Resourcen!!
- FilterNames(0,0) = &quot;Calc 6.0&quot;
- FilterNames(0,1) = &quot;*.sxc&quot;
- FilterNames(1,0) = &quot;Calc 6.0 Vorlage&quot;
- FilterNames(1,1) = &quot;*.stc&quot;
- FilterNames(2,0) = &quot;Star Calc 5.0&quot;
- FilterNames(2,1) = &quot;*.sdc&quot;
- FilterNames(3,0) = &quot;Star Calc 5.0 Vorlage&quot;
- FilterNames(3,1) = &quot;*.vor&quot;
- FilterNames(4,0) = &quot;Star Calc 4.0&quot;
- FilterNames(4,1) = &quot;*.sdc&quot;
- FilterNames(5,0) = &quot;Star Calc 4.0 Vorlage&quot;
- FilterNames(5,1) = &quot;*.vor&quot;
- FilterNames(6,0) = &quot;Star Calc 3.0&quot;
- FilterNames(6,1) = &quot;*.sdc&quot;
- FilterNames(7,0) = &quot;Star Calc 3.0 Vorlage&quot;
- FilterNames(7,1) = &quot;*.vor&quot;
.optSingleFile.Label = GetResText(1201) &apos;&quot;Einzelnes StarOffice -Dokument&quot;&apos;GetResText(1201)
.optWholeDir.Label = GetResText(1202)
.chkProtect.Label = GetResText(1207)
@@ -188,7 +172,8 @@ Sub InitializeResources()
sSOURCEFILE = GetResText(1203)
sSOURCEDIR = GetResText(1204)
.lblSource.Label = sSOURCEDIR
- .chkRecursive.Label = GetResText(1205)
+ sInclusiveSubDir = GetResText(1205)
+ .chkRecursive.Label = sInclusiveSubDir
sTARGETDIR = GetResText(1206)
.lblTarget.Label = STARGETDIR
.optWholeDir.State = 1
@@ -485,13 +470,6 @@ Dim Isthere as Boolean
InitializeLocales(oLocale)
InitializeCurrencies()
InitializeControls()
- FilterList(0) = &quot;application/x-starcalc&quot;
- FilterList(1) = &quot;application/x-starwriter&quot;
- FilterList(2) = &quot;application/vnd.stardivision.calc&quot;
- FilterList(3) = &quot;application/vnd.stardivision.writer&quot;
- FilterList(4) = &quot;application/vnd.stardivision.writer/web&quot;
- FilterList(5) = &quot;application/vnd.sun.xml.calc&quot;
- FilterList(6) = &quot;application/vnd.sun.xml.writer&quot;
BitmapDir = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/bitmap&quot;)
FillUpCurrencyListbox()
DialogModel.imgPreview.ImageUrl = BitmapDir &amp; &quot;euro_&quot; &amp; DialogModel.Step &amp; &quot;.bmp&quot;
diff --git a/wizards/source/euro/Protect.xba b/wizards/source/euro/Protect.xba
index 86ef4c87cff1..bfe470b183c3 100644
--- a/wizards/source/euro/Protect.xba
+++ b/wizards/source/euro/Protect.xba
@@ -5,14 +5,19 @@ Option Explicit
Dim PWIndex as Integer
-Function UnprotectSheetsWithPassWord(oSheets as Object)
+
+Function UnprotectSheetsWithPassWord(oSheets as Object, bDoUnProtect as Boolean)
Dim i as Integer
Dim MaxIndex as Integer
+Dim iMsgResult as Integer
PWIndex = -1
If bDocHasProtectedSheets Then
- &apos; At First query if sheets shall generally be unprotected
- DoUnprotect = Msgbox(sMsgUNPROTECT,36,sMsgDLGTITLE)
- If DoUnProtect = 6 Then
+ If Not bDoUnprotect Then
+ &apos; At First query if sheets shall generally be unprotected
+ iMsgResult = Msgbox(sMsgUNPROTECT,36,sMsgDLGTITLE)
+ bDoUnProtect = iMsgResult = 6
+ End If
+ If bDoUnProtect Then
MaxIndex = oSheets.Count-1
For i = 0 To MaxIndex
bDocHasProtectedSheets = Not UnprotectSheet(oSheets(i))
diff --git a/wizards/source/euro/Soft.xba b/wizards/source/euro/Soft.xba
index a18f521d6489..a3a2dde7a754 100644
--- a/wizards/source/euro/Soft.xba
+++ b/wizards/source/euro/Soft.xba
@@ -29,6 +29,9 @@ Dim Stylename as String
SwitchNumberFormat(ostyle, oFormats, sEuroSign)
End If
StyleIndex = StyleIndex + 1
+ If StyleIndex &gt; Ubound(StyleRangeAssignMentList()) Then
+ Redim Preserve StyleRangeAssignmentList(StyleIndex)
+ End If
StyleRangeAssignmentList(StyleIndex) = &quot;&lt;STYLENAME&gt;&quot; &amp; Stylename &amp; &quot;&lt;/STYLENAME&gt;&quot; &amp; _
&quot;&lt;DEFINED&gt;FALSE&lt;/DEFINED&gt;&quot; &amp; &quot;&lt;RANGES&gt;&lt;/RANGES&gt;&quot; &amp;_
&quot;&lt;CELLCOUNT&gt;0&lt;/CELLCOUNT&gt;&quot; &amp;_