1 {***********************************************************************
3 * The Contents of this file are made available subject to the terms of
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *************************************************************************}
38 uses Windows
, SysUtils
, Classes
, Graphics
, Forms
, Controls
, StdCtrls
,
39 Buttons
, ExtCtrls
, SampleCode
, ComCtrls
;
42 TOKBottomDlg
= class(TForm
)
62 StatusBar1
: TStatusBar
;
65 procedure OnConnect(Sender
: TObject
);
66 procedure OnDisconnect(Sender
: TObject
);
67 procedure OnCreateDocument(Sender
: TObject
);
68 procedure OnInsertTable(Sender
: TObject
);
69 procedure OnGetDatabasePointer(Sender
: TObject
);
70 procedure OnGetCellContent(Sender
: TObject
);
72 { Private declarations }
74 { Public declarations }
78 OKBottomDlg
: TOKBottomDlg
;
84 procedure TOKBottomDlg
.OnConnect(Sender
: TObject
);
86 StatusBar1
.SimpleText
:= 'Connection to StarOffice ...';
87 Sample
:= TSampleCode
.Create();
88 if Sample
.Connect() then
90 Button1
.Enabled
:= false;
91 Button2
.Enabled
:= true;
92 Button3
.Enabled
:= true;
93 Button4
.Enabled
:= false;
94 Button5
.Enabled
:= false;
95 Button6
.Enabled
:= false;
97 StatusBar1
.SimpleText
:= 'Ready';
100 procedure TOKBottomDlg
.OnDisconnect(Sender
: TObject
);
102 StatusBar1
.SimpleText
:= 'Disconnection from StarOffice ...';
104 Button1
.Enabled
:= true;
105 Button2
.Enabled
:= false;
106 Button3
.Enabled
:= false;
107 Button4
.Enabled
:= false;
108 Button5
.Enabled
:= false;
109 Button6
.Enabled
:= false;
110 StatusBar1
.SimpleText
:= 'Ready';
113 procedure TOKBottomDlg
.OnCreateDocument(Sender
: TObject
);
115 StatusBar1
.SimpleText
:= 'Creating new text document ...';
117 if Sample
.CreateDocument(false) then
119 Button4
.Enabled
:= true;
120 Button5
.Enabled
:= true;
121 Button6
.Enabled
:= true;
123 StatusBar1
.SimpleText
:= 'Ready';
125 StatusBar1
.SimpleText
:= 'Error';
129 procedure TOKBottomDlg
.OnInsertTable(Sender
: TObject
);
132 StatusBar1
.SimpleText
:= 'Inserting Table ...';
133 Sample
.InsertTable(Edit2
.Text, Edit1
.Text);
134 StatusBar1
.SimpleText
:= 'Ready';
136 StatusBar1
.SimpleText
:= 'Error';
140 procedure TOKBottomDlg
.OnGetDatabasePointer(Sender
: TObject
);
145 StatusBar1
.SimpleText
:= 'Getting database pointer ...';
146 res
:= Sample
.getDatabasePointer(Edit4
.Text, Edit3
.Text);
147 Application
.MessageBox(PChar('the pointer: ' + res
), PChar('Result'), ID_OK
);
148 StatusBar1
.SimpleText
:= 'Ready';
150 StatusBar1
.SimpleText
:= 'Error';
154 procedure TOKBottomDlg
.OnGetCellContent(Sender
: TObject
);
159 StatusBar1
.SimpleText
:= 'Getting cell content ...';
160 res
:= Sample
.getCellContent(Edit6
.Text);
161 Application
.MessageBox(PChar('the content: ' + res
), PChar('Result'), ID_OK
);
162 StatusBar1
.SimpleText
:= 'Ready';
164 StatusBar1
.SimpleText
:= 'Error';