diff options
author | Behrend Cornelius <bc@openoffice.org> | 2001-06-25 18:03:49 +0000 |
---|---|---|
committer | Behrend Cornelius <bc@openoffice.org> | 2001-06-25 18:03:49 +0000 |
commit | 24751aa8b62a8067c18180bb74dc087674521a36 (patch) | |
tree | d3024acd29773d5546748db525382465fb55cbcb /wizards/source/euro | |
parent | f58bd0d8af5214eb70e7bd853b56b6751e805402 (diff) |
#88694# several changes
Diffstat (limited to 'wizards/source/euro')
-rw-r--r-- | wizards/source/euro/AutoPilotRun.xba | 112 | ||||
-rw-r--r-- | wizards/source/euro/Common.xba | 25 | ||||
-rw-r--r-- | wizards/source/euro/ConvertRun.xba | 19 | ||||
-rw-r--r-- | wizards/source/euro/Init.xba | 32 | ||||
-rw-r--r-- | wizards/source/euro/Protect.xba | 13 | ||||
-rw-r--r-- | wizards/source/euro/Soft.xba | 3 |
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 <> "" And TargetDir <> "" Then - bRecursive = DialogModel.chkRecursive.State = 1 - InitializeThirdStep() If DialogModel.optSingleFile.State = 1 Then SourceFile = Source TotDocCount = 1 Else SourceDir = Source TargetStemDir = TargetDir + FilterList(0) = "application/x-starcalc" + FilterList(1) = "application/vnd.stardivision.calc" + FilterList(2) = "application/vnd.sun.xml.calc" + + If DialogModel.chkTextDocuments.State = 1 Then + ReDim Preserve FilterList(6) as String + FilterList(3) = "application/x-starwriter" + FilterList(4) = "application/vnd.stardivision.writer" + FilterList(5) = "application/vnd.stardivision.writer/web" + FilterList(6) = "application/vnd.sun.xml.writer" + 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) & "/" & sTotDocCount & " (" & sViewPath & ")" + DialogModel.lblCurDocument.Label = Str(DocIndex+1) & "/" & sTotDocCount & " (" & sViewPath & ")" 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 & " " & Source & chr(13) '& " " If DialogModel.chkRecursive.State = 1 Then - TextBoxText = TextBoxText & DeleteStr(sSUBDIR,"&") & chr(13)' & " " + TextBoxText = TextBoxText & DeleteStr(sInclusiveSubDir,"~") & chr(13) End If Else - TextBoxText = sSOURCEFILE & " " & Source & chr(13) '& " " + TextBoxText = sSOURCEFILE & " " & Source & chr(13) End If - TextBoxText = TextBoxText & sTARGETDIR & " " & TargetDir & chr(13)' & " " + TextBoxText = TextBoxText & sTARGETDIR & " " & TargetDir & chr(13) If DialogModel.chkProtect.State = 1 Then TextBoxText = TextboxText & sPrgsUNPROTECT End If @@ -205,9 +215,11 @@ End Sub Sub ToggleProgressStep(Optional aEvent as Object) Dim bMakeVisible as Boolean Dim LocStep as Integer + ' If the Sub is call by the 'cmdBack' Button then set the 'bMakeVisible' variable accordingly bMakeVisible = IsMissing(aEvent) - DialogConvert.GetControl("lblCurrencies").Visible = bMakeVisible - DialogConvert.GetControl("lstCurrencies").Visible = bMakeVisible + ' Todo: Wieso können die nicht unsichtbar gemacht werden? + DialogConvert.GetControl("lblCurrencies").Visible = Not bMakeVisible + DialogConvert.GetControl("lstCurrencies").Visible = Not bMakeVisible DialogConvert.GetControl("cmdBack").Visible = bMakeVisible DialogConvert.GetControl("cmdGoOn").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("org.openoffice.Office.TypeDetection/") + oFilters() = oMasterKey.Filters + + If DialogModel.chkTextDocuments.State = 1 Then + Dim FilterNames(21,1) as String + + FilterNames(9,0) = oFilters.GetByName("writer_StarOffice_XML_Writer").UIName + FilterNames(9,1) = "*.sxw" + + FilterNames(10,0) = oFilters.GetByName("writer_StarOffice_XML_Writer_Template").UIName + FilterNames(10,1) = "*.vor" + + FilterNames(11,0) = oFilters.GetByName("writer_StarWriter_10").UIName + FilterNames(11,1) = "*.sdw" + + FilterNames(12,0) = oFilters.GetByName("writer_StarWriter_30").UIName + FilterNames(12,1) = "*.sdw" + + FilterNames(13,0) = oFilters.GetByName("writer_StarWriter_30_VorlageTemplate").UIName + FilterNames(13,1) = "*.vor" + + FilterNames(14,0) = oFilters.GetByName("writer_StarWriter_40").UIName + FilterNames(14,1) = "*.sdw" + + FilterNames(15,0) = oFilters.GetByName("writer_StarWriter_40_VorlageTemplate").UIName + FilterNames(15,1) = "*.vor" + + FilterNames(16,0) = oFilters.GetByName("writer_StarWriter_50").UIName + FilterNames(16,1) = "*.sdw" + + FilterNames(17,0) = oFilters.GetByName("writer_StarWriter_50_VorlageTemplate").UIName + FilterNames(17,1) = "*.vor" + + FilterNames(18,0) = oFilters.GetByName("writer_web_StarOffice_XML_Writer_Web_Template").UIName + FilterNames(18,1) = "*.stw" + + FilterNames(19,0) = oFilters.GetByName("writer_web_StarWriterWeb_40_VorlageTemplate").UIName + FilterNames(19,1) = "*.vor" + + FilterNames(20,0) = oFilters.GetByName("writer_web_StarWriterWeb_50_VorlageTemplate").UIName + FilterNames(20,1) = "*.vor" + + FilterNames(21,0) = oFilters.GetByName("writer_web_HTML").UIName + FilterNames(21,1) = "*.HTML" + + Else + ReDim FilterNames(8,1) as String + End If + FilterNames(0,0) = oFilters.GetByName("calc_StarOffice_XML_Calc").UIName + Filternames(0,1) = "*.sxc" + + FilterNames(1,0) = oFilters.GetByName("calc_StarOffice_XML_Calc_Template").UIName + Filternames(1,1) = "*.stw" + + FilterNames(2,0) = oFilters.GetByName("calc_StarCalc_10").UIName + Filternames(2,1) = "*.sdc" + + FilterNames(3,0) = oFilters.GetByName("calc_StarCalc_30").UIName + Filternames(3,1) = "*.sdc" + + FilterNames(4,0) = oFilters.GetByName("calc_StarCalc_30_VorlageTemplate").UIName + Filternames(4,1) = "*.vor" + + FilterNames(5,0) = oFilters.GetByName("calc_StarCalc_40").UIName + Filternames(5,1) = "*.sdc" + + FilterNames(6,0) = oFilters.GetByName("calc_StarCalc_40_VorlageTemplate").UIName + Filternames(6,1) = "*.vor" + + FilterNames(7,0) = oFilters.GetByName("calc_StarCalc_50").UIName + Filternames(7,1) = "*.sdc" + + FilterNames(8,0) = oFilters.GetByName("calc_StarCalc_50_VorlageTemplate").UIName + Filternames(8,1) = "*.vor" + 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, "calc") <> 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) +' 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("Tools") If InitResources("Euro Converter", "eur") 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 ' 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 - ' Option '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()) > -1 AND GoOn Then - EmptyListbox(DialogModel.lstSelection()) - EnableStep1DialogControls(True, True, True) - Else - ' 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) -'Todo: Diese Strings in Resourcen!! - FilterNames(0,0) = "Calc 6.0" - FilterNames(0,1) = "*.sxc" - FilterNames(1,0) = "Calc 6.0 Vorlage" - FilterNames(1,1) = "*.stc" - FilterNames(2,0) = "Star Calc 5.0" - FilterNames(2,1) = "*.sdc" - FilterNames(3,0) = "Star Calc 5.0 Vorlage" - FilterNames(3,1) = "*.vor" - FilterNames(4,0) = "Star Calc 4.0" - FilterNames(4,1) = "*.sdc" - FilterNames(5,0) = "Star Calc 4.0 Vorlage" - FilterNames(5,1) = "*.vor" - FilterNames(6,0) = "Star Calc 3.0" - FilterNames(6,1) = "*.sdc" - FilterNames(7,0) = "Star Calc 3.0 Vorlage" - FilterNames(7,1) = "*.vor" .optSingleFile.Label = GetResText(1201) '"Einzelnes StarOffice -Dokument"'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) = "application/x-starcalc" - FilterList(1) = "application/x-starwriter" - FilterList(2) = "application/vnd.stardivision.calc" - FilterList(3) = "application/vnd.stardivision.writer" - FilterList(4) = "application/vnd.stardivision.writer/web" - FilterList(5) = "application/vnd.sun.xml.calc" - FilterList(6) = "application/vnd.sun.xml.writer" BitmapDir = GetOfficeSubPath("Template", "wizard/bitmap") FillUpCurrencyListbox() DialogModel.imgPreview.ImageUrl = BitmapDir & "euro_" & DialogModel.Step & ".bmp" 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 - ' At First query if sheets shall generally be unprotected - DoUnprotect = Msgbox(sMsgUNPROTECT,36,sMsgDLGTITLE) - If DoUnProtect = 6 Then + If Not bDoUnprotect Then + ' 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 > Ubound(StyleRangeAssignMentList()) Then + Redim Preserve StyleRangeAssignmentList(StyleIndex) + End If StyleRangeAssignmentList(StyleIndex) = "<STYLENAME>" & Stylename & "</STYLENAME>" & _ "<DEFINED>FALSE</DEFINED>" & "<RANGES></RANGES>" &_ "<CELLCOUNT>0</CELLCOUNT>" &_ |