summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorBehrend Cornelius <bc@openoffice.org>2001-06-06 08:51:05 +0000
committerBehrend Cornelius <bc@openoffice.org>2001-06-06 08:51:05 +0000
commit04bd4e5f5619ca64308654aa8f136eddd3e179d6 (patch)
treee3d30d565f518185e017086eae7b49b204285d43 /wizards
parent20375c718d17e5f5f31868dd026aea30646fbbd9 (diff)
#87606# saving document routine improved
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/formwizard/DBMeta.xba50
-rw-r--r--wizards/source/formwizard/FormWizard.xba34
-rw-r--r--wizards/source/formwizard/Language.xba68
-rw-r--r--wizards/source/formwizard/Layouter.xba10
-rw-r--r--wizards/source/formwizard/dbwizres.src11
5 files changed, 106 insertions, 67 deletions
diff --git a/wizards/source/formwizard/DBMeta.xba b/wizards/source/formwizard/DBMeta.xba
index 201df3103acf..00a81ebfa167 100644
--- a/wizards/source/formwizard/DBMeta.xba
+++ b/wizards/source/formwizard/DBMeta.xba
@@ -14,39 +14,61 @@ End Sub
Sub GetSelectedDBMetaData()
Dim NullList()
Dim OldsDBname as String
+Dim bGetConnection as Boolean
ToggleDatabasePage(False)
- GetDBMetaData(sDatabaseList(), oDialogModel.lstDatabases.SelectedItems(0) )
- With oDialogModel
- .lstTables.Enabled = True
- .lblTables.Enabled = True
- .lstTables.StringItemList() = AddListToList(TableNames(), QueryNames())
- .lstFields.StringItemList() = NullList()
- .lstSelFields.StringItemList() = NullList()
- End With
+ bGetConnection = GetDBMetaData(sDatabaseList(), oDialogModel.lstDatabases.SelectedItems(0) )
+ If bGetConnection Then
+ With oDialogModel
+ .lstTables.Enabled = True
+ .lblTables.Enabled = True
+ .lstTables.StringItemList() = AddListToList(TableNames(), QueryNames())
+ .lstFields.StringItemList() = NullList()
+ .lstSelFields.StringItemList() = NullList()
+ End With
+ End If
ToggleDatabasePage(True)
End Sub
-Sub GetDBMetaData(sDataBaseList(), DBIndex as Integer)
+Function GetDBMetaData(sDataBaseList(), DBIndex as Integer)
Dim oDatabase as Object
Dim oInteractionHandler as Object
Dim oDataSource as Object
+Dim bExitLoop as Boolean
+Dim iMsg as Integer
If oDBContext.HasElements Then
oDatabase = oDBContext.GetByName(sDatabaseList(DBIndex))
sDBName = oDatabase.Name
If Not oDatabase.IsPasswordRequired Then
oDBConnection = oDBContext.GetByName(sDatabaseList(DBIndex)).GetConnection(&quot;&quot;,&quot;&quot;)
+ bGetConnection = True
Else
oInteractionHandler = createUnoService(&quot;com.sun.star.sdb.InteractionHandler&quot;)
oDataSource = oDBContext.GetByName(sDatabaseList(DBIndex))
- oDBConnection = oDataSource.ConnectWithCompletion(oInteractionHandler)
+ On Local Error Goto NOCONNECTION
+ Do
+ bExitLoop = True
+ oDBConnection = oDataSource.ConnectWithCompletion(oInteractionHandler)
+
+ NOCONNECTION:
+ bGetConnection = Err = 0
+ If Not bGetConnection Then
+ iMsg = Msgbox (sMsgNoConnection,32 + 2, sMsgWizardName) &apos; &apos;?&apos; &amp; &apos; Repeat and Cancel&apos;
+ bExitLoop = iMsg = SBCANCEL
+ End If
+ On Local Error Goto 0
+ Loop Until bExitLoop
End If
- Tablenames() = oDBConnection.Tables.ElementNames()
- Querynames() = oDBConnection.Queries.ElementNames()
+ If bGetConnection Then
+ Tablenames() = oDBConnection.Tables.ElementNames()
+ Querynames() = oDBConnection.Queries.ElementNames()
+ End If
+ GetDBMetaData() = bGetConnection
Else
- MsgBox(Form_gErrNoDatabase$, 64, Form_gWizardName$)
+ MsgBox(sMsgErrNoDatabase, 64, sMsgWizardName)
+ GetDBMetaData = False
End If
-End Sub
+End Function
Sub GetTableMetaData()
diff --git a/wizards/source/formwizard/FormWizard.xba b/wizards/source/formwizard/FormWizard.xba
index b9863dd13c04..182dd745467e 100644
--- a/wizards/source/formwizard/FormWizard.xba
+++ b/wizards/source/formwizard/FormWizard.xba
@@ -61,7 +61,7 @@ Sub MainWithDefault()
GlobalError:
If Err &lt;&gt; 0 Then
ToggleWindow(True)
- MsgBox(Form_gErrMsg$ , 16, Form_gWizardName$)
+ MsgBox(sMsgErrMsg , 16, sMsgWizardName)
End If
End Sub
@@ -89,7 +89,7 @@ Dim i as Integer
Exit Sub
GlobalError:
- MsgBox(Form_gErrMsg$ , 16, Form_gWizardName$)
+ MsgBox(sMsgErrMsg , 16, sMsgWizardName)
ToggleWindow(True)
DlgFormDB.EndExecute()
Reset
@@ -136,7 +136,7 @@ Dim n as Integer
&apos; bNeedFieldRefresh = False
Exit Sub
no_fields:
- MsgBox Form_gErrCouldNotOpenObject$, 16, Form_gWizardName$
+ MsgBox sMsgErrCouldNotOpenObject, 16, sMsgWizardName
End Sub
@@ -198,29 +198,35 @@ Sub InitializeLayoutSettings()
ToggleAlignGroup(bControlsAreCreated)
ArrangeControls()
End If
-
- &apos; Todo: Hier die Grafik Urls der ImageControls setzen.
- &apos; Alternativ würde es vielleicht reichen die Border auf 3-D zu setzen
End Sub
Sub HandleCreatedDocument()
Dim sPath as String
Dim NoArgs() as new com.sun.star.beans.PropertyValue
+Dim DocTitle as String
+Dim sDirPath as String
On Local Error Goto NOSAVING
If oDialogModel.optSaveDocument.State = 1 Then
- sPath = oDialogModel.txtInputPath.Text
+ sDirPath = ConvertToUrl(oDialogModel.txtInputPath.Text)
+ sDirPath = RTrimStr(sDirPath,&quot;/&quot;)
+ DocTitle = oDialogModel.txtTitle.Text
+ sPath = sDirPath &amp; &quot;/&quot; &amp; DocTitle &amp; &quot;.sxw&quot;
+
oDocument.StoreToUrl(sPath,NoArgs()
- End If
- NOSAVING:
- If Err &lt;&gt; 0 Then
- Msgbox(&quot;Todo: Resourcen für fehlerhaftes Abspeichern suchen!&quot;, 16, GetProductname)
- Resume CLERROR
+ NOSAVING:
+ If Err &lt;&gt; 0 Then
+ Msgbox(&quot;Todo: Resourcen für fehlerhaftes Abspeichern suchen!&quot;, 16, GetProductname)
+ Resume CLERROR
+ Else
+ DlgFormDB.EndExecute()
+ oDocument.Dispose
+ End If
+ CLERROR:
Else
- oDocument.Dispose
+ DlgFormDB.EndExecute()
End If
- CLERROR:
End Sub
diff --git a/wizards/source/formwizard/Language.xba b/wizards/source/formwizard/Language.xba
index 0d1ff71d6a31..13a6d014f7af 100644
--- a/wizards/source/formwizard/Language.xba
+++ b/wizards/source/formwizard/Language.xba
@@ -4,52 +4,56 @@
Global Const RID_COMMON = 1000
Global Const RID_FORM = 2200
+Public Const SBCANCEL = 2
+Public Const SBREPEAT = 4
+
Public WizardTitle(1 To 3) as String
Public DlgFormDB as Object
Public oDialogModel as Object
&apos; Global Msg
-Dim Form_gWizardName$
-Dim Form_gErrMsg$
-Dim Form_gErrFormOpen$
-Dim Form_gErrNoDatabase$
-Dim Form_gErrNoTableInDatabase$
-Dim Form_gErrTitleSuggestedExist$
-Dim Form_gErrTitleSyntaxError$
-Dim Form_gErrTitleAsTableExist$
-Dim Form_gProgressText$
-Dim Form_gCreatedForm$
-Dim Form_gErrCouldNotOpenObject$
-Dim Form_gErrNameToLong$
+Dim sMsgWizardName as String
+Dim sMsgErrMsg as String
+Dim sMsgErrFormOpen as String
+Dim sMsgErrNoDatabase as String
+Dim sMsgErrNoTableInDatabase as String
+Dim sMsgErrTitleSuggestedExist as String
+Dim sMsgErrTitleSyntaxError as String
+Dim sMsgErrTitleAsTableExist as String
+Dim sMsgProgressText as String
+Dim sMsgCreatedForm as String
+Dim sMsgErrCouldNotOpenObject as String
+Dim sMsgErrNameToLong as String
&apos; Internal Logic
-Dim Form_ilFormTitleSuggestPrefix$
+Dim Form_ilFormTitleSuggestPrefix as String
-Dim Form_gDatetime_DateComponent$
-Dim Form_gDatetime_TimeComponent$
+Dim sMsgDatetime_DateComponent as String
+Dim sMsgDatetime_TimeComponent as String
Public sGoOn as String
Public sReady as String
+Public sMsgNoConnection as String
Sub LoadLanguage ()
- Form_gWizardName$ = GetResText(RID_FORM + 0)
- Form_gErrMsg$ = GetResText(RID_COMMON + 6)
- Form_gErrFormOpen$ = GetResText(RID_COMMON + 7)
- Form_gErrNoDatabase$ = GetResText(RID_COMMON + 8)
- Form_gErrNoTableInDatabase$ = GetResText(RID_COMMON + 9)
- Form_gErrTitleSuggestedExist$ = GetResText(RID_COMMON + 10)
- Form_gErrTitleAsTableExist$ = GetResText(RID_COMMON + 10)
- Form_gErrTitleSyntaxError$ = GetResText(RID_COMMON + 11)
-
- Form_gProgressText$ = GetResText(RID_FORM + 2)
- Form_gCreatedForm$ = GetResText(RID_FORM + 26)
- Form_gErrNameToLong$ = GetResText (RID_FORM + 27)
- Form_gErrCouldNotOpenObject$ = GetResText (RID_COMMON + 13)
+ sMsgWizardName = GetResText(RID_FORM + 0)
+ sMsgErrMsg = GetResText(RID_COMMON + 6)
+ sMsgErrFormOpen = GetResText(RID_COMMON + 7)
+ sMsgErrNoDatabase = GetResText(RID_COMMON + 8)
+ sMsgErrNoTableInDatabase = GetResText(RID_COMMON + 9)
+ sMsgErrTitleSuggestedExist = GetResText(RID_COMMON + 10)
+ sMsgErrTitleAsTableExist = GetResText(RID_COMMON + 10)
+ sMsgErrTitleSyntaxError = GetResText(RID_COMMON + 11)
+ sMsgNoConnection = GetResText(RID_COMMON + 14
+ sMsgProgressText = GetResText(RID_FORM + 2)
+ sMsgCreatedForm = GetResText(RID_FORM + 26)
+ sMsgErrNameToLong = GetResText (RID_FORM + 27)
+ sMsgErrCouldNotOpenObject = GetResText (RID_COMMON + 13)
&apos; Internal Logic
- Form_ilFormTitleSuggestPrefix$ = GetResText(RID_FORM + 3)
- Form_gDatetime_DateComponent$ = GetResText(RID_FORM + 4)
- Form_gDatetime_TimeComponent$ = GetResText(RID_FORM + 5)
+ Form_ilFormTitleSuggestPrefix = GetResText(RID_FORM + 3)
+ sMsgDatetime_DateComponent = GetResText(RID_FORM + 4)
+ sMsgDatetime_TimeComponent = GetResText(RID_FORM + 5)
sReady = GetResText(RID_COMMON + 0)
SetDialogLanguage()
@@ -61,7 +65,7 @@ Sub SetDialogLanguage ()
oDialogModel = DlgFormDB.Model
oDialogModel.cmdCancel.Label = GetResText(RID_COMMON + 1)
oDialogModel.cmdBack.Label = GetResText(RID_COMMON + 2)
- oDialogModel.cmdHelp.Label = GetResText(RID_COMMON + 14)
+ oDialogModel.cmdHelp.Label = GetResText(RID_COMMON + 20)
sGoOn = GetResText(RID_COMMON + 3)
oDialogModel.cmdGoOn.Label = sGoOn
oDialogModel.lblDatabases.Label = GetResText(RID_COMMON + 4)
diff --git a/wizards/source/formwizard/Layouter.xba b/wizards/source/formwizard/Layouter.xba
index 9b0fb139a2f1..3d3d2251dce0 100644
--- a/wizards/source/formwizard/Layouter.xba
+++ b/wizards/source/formwizard/Layouter.xba
@@ -115,7 +115,7 @@ Dim i as Integer
ErrorAndCloseForm:
ToggleWindow(True)
- MsgBox(Form_gErrMsg$, 16, Form_gWizardName$)
+ MsgBox(sMsgErrMsg, 16, sMsgWizardName)
oDocument.Dispose()
Stop
exit Function
@@ -164,7 +164,7 @@ Dim OldBorderType as Integer
Dim i as Integer
Dim oCurModel as Object
ToggleLayoutPage(False)
- oDocument.LockControllers
+&apos; oDocument.LockControllers
OldBorderType = CurBorderType
oModel = oEvent.Source.Model
CurBorderType = Val(Right(oModel.Name,1))
@@ -185,7 +185,7 @@ Dim oCurModel as Object
Next i
End If
End If
- oDocument.UnLockControllers
+&apos; oDocument.UnLockControllers
ToggleLayoutPage(True)
End Sub
@@ -196,7 +196,7 @@ Dim oCurModel as Object
Dim OldAlignMode as Integer
Dim oModel as Object
ToggleLayoutPage(False)
- oDocument.LockControllers()
+&apos; oDocument.LockControllers()
OldAlignMode = CurAlignMode
oModel = oEvent.Source.Model
CurAlignMode = Val(Right(oModel.Name,1))
@@ -208,7 +208,7 @@ Dim oModel as Object
oCurModel.Align = CurAlignmode
Next i
End If
- oDocument.UnlockControllers()
+&apos; oDocument.UnlockControllers()
ToggleLayoutPage(True)
End Sub
diff --git a/wizards/source/formwizard/dbwizres.src b/wizards/source/formwizard/dbwizres.src
index 38666696ec63..084f6129d6bc 100644
--- a/wizards/source/formwizard/dbwizres.src
+++ b/wizards/source/formwizard/dbwizres.src
@@ -2,9 +2,9 @@
*
* $RCSfile: dbwizres.src,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: bc $ $Date: 2001-06-05 15:26:14 $
+ * last change: $Author: bc $ $Date: 2001-06-06 09:51:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -442,6 +442,13 @@ String RID_DB_COMMON_START + 13
String RID_DB_COMMON_START + 14
{
+ Text = "Es konnte keine Verbindung zur Datenbank hergestellt werden!";
+ Text [ english ] = "A Connection to the database could not be established";
+ Text[ english_us ] = "A Connection to the database could not be established";
+};
+
+String RID_DB_COMMON_START + 20
+{
Text = "~Hilfe";
Text [ english ] = "~Help";
Text[ english_us ] = "~Help";