summaryrefslogtreecommitdiffstats
path: root/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls')
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/Makefile125
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls.odtbin0 -> 7793 bytes
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/FileDialog.xba90
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/FileDialogDlg.xdl29
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/MultiPage.xba303
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/MultiPageDlg.xdl92
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ProgressBar.xba93
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ProgressBarDlg.xdl28
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ScrollBar.xba103
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ScrollBarDlg.xdl30
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/dialog.xlb8
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/script.xlb8
12 files changed, 909 insertions, 0 deletions
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/Makefile b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/Makefile
new file mode 100644
index 000000000..bd3a43444
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/Makefile
@@ -0,0 +1,125 @@
+#*************************************************************************
+#
+# The Contents of this file are made available subject to the terms of
+# the BSD license.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Sun Microsystems, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#**************************************************************************
+
+# Builds the CreatingDialogs example of the Developers Guide.
+
+PRJ=../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+
+# Define non-platform/compiler specific settings
+SAMPLE_NAME=BaDToolkitControls
+SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
+
+COMP_NAME=ToolkitControls
+COMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME)
+COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
+COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
+COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml
+COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)devguide_basic_$(COMP_NAME)_register_component.flag
+
+COMP_LIBRARY_FILES=\
+ ToolkitControls/dialog.xlb\
+ ToolkitControls/FileDialog.xba\
+ ToolkitControls/FileDialogDlg.xdl\
+ ToolkitControls/MultiPage.xba\
+ ToolkitControls/MultiPageDlg.xdl\
+ ToolkitControls/ProgressBar.xba\
+ ToolkitControls/ProgressBarDlg.xdl\
+ ToolkitControls/script.xlb\
+ ToolkitControls/ScrollBar.xba\
+ ToolkitControls/ScrollBarDlg.xdl
+
+# Targets
+.PHONY: ALL
+ALL : $(SAMPLE_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+# rule for component package manifest
+$(COMP_GEN_OUT)/%/manifest.xml :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
+ @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.basic-library$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME)$(QM)"/$(CSEP) >> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component package file
+$(COMP_PACKAGE) : $(COMP_UNOPKG_MANIFEST) $(COMP_LIBRARY_FILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_ZIP) $@ ToolkitControls/dialog.xlb \
+ ToolkitControls/FileDialog.xba ToolkitControls/FileDialogDlg.xdl \
+ ToolkitControls/MultiPage.xba ToolkitControls/MultiPageDlg.xdl \
+ ToolkitControls/ProgressBar.xba ToolkitControls/ProgressBarDlg.xdl \
+ ToolkitControls/script.xlb ToolkitControls/ScrollBar.xba \
+ ToolkitControls/ScrollBarDlg.xdl
+ cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
+
+$(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
+ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
+ @echo flagged > $(subst /,$(PS),$@)
+else
+ @echo --------------------------------------------------------------------------------
+ @echo If you want to install your component automatically, please set the environment
+ @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
+ @echo possible if no office instance is running.
+ @echo --------------------------------------------------------------------------------
+endif
+
+$(SAMPLE_NAME) : $(COMP_REGISTERFLAG)
+ @echo --------------------------------------------------------------------------------
+ @echo The "$(QM)ToolkitControls$(QM)" library was installed in your office installation
+ @echo if SDK_AUTO_DEPLOYMENT = YES. You can use it in the BASIC IDE as a normal
+ @echo Basic library.
+ @echo You can also load the document "$(QM)$(COMP_NAME).odt$(QM)" and press a button
+ @echo to run one of the example macros.
+ @echo -
+ @echo $(MAKE) $(COMP_NAME).odt.load
+ @echo --------------------------------------------------------------------------------
+
+$(COMP_NAME).odt.load : $(COMP_REGISTERFLAG)
+ "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
+
+.PHONY: clean
+clean :
+ -$(DELRECURSIVE) $(subst /,$(PS),$(COMP_GEN_OUT))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls.odt b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls.odt
new file mode 100644
index 000000000..ffedaa756
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls.odt
Binary files differ
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/FileDialog.xba b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/FileDialog.xba
new file mode 100644
index 000000000..60f6a491f
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/FileDialog.xba
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="FileDialog" script:language="StarBasic">REM ***** BASIC *****
+
+Dim oDialog As Object
+
+Sub Main()
+
+ Dim oLibContainer As Object, oLib As Object
+ Dim oInputStreamProvider As Object
+
+ Const sLibName = &quot;ToolkitControls&quot;
+ Const sDialogName = &quot;FileDialogDlg&quot;
+
+ REM load/get library and input stream provider
+ oLibContainer = DialogLibraries
+ oLibContainer.loadLibrary( sLibName )
+ oLib = oLibContainer.getByName( sLibName )
+ oInputStreamProvider = oLib.getByName( sDialogName )
+
+ REM create dialog control
+ oDialog = CreateUnoDialog( oInputStreamProvider )
+
+ REM show the dialog
+ oDialog.execute()
+
+End Sub
+
+Sub OpenFileDialog()
+
+ Dim oFilePicker As Object, oSimpleFileAccess As Object
+ Dim oPathSettings As Object
+ Dim oTextField As Object, oTextFieldModel As Object
+ Dim sFileURL As String
+ Dim sFiles As Variant
+
+ REM file dialog
+ oFilePicker = CreateUnoService( &quot;com.sun.star.ui.dialogs.FilePicker&quot; )
+
+ REM set filter
+ oFilePicker.AppendFilter( &quot;All files&quot;, &quot;*.*&quot; )
+ oFilePicker.AppendFilter( &quot;StarOffice 6.0 Text Text Document&quot;, &quot;*.sxw&quot; )
+ oFilePicker.AppendFilter( &quot;StarOffice 6.0 Spreadsheet&quot;, &quot;*.sxc&quot; )
+ oFilePicker.SetCurrentFilter( &quot;All files&quot; )
+
+ REM if no file URL is set, get path settings from configuration
+ oTextFieldModel = oDialog.Model.TextField1
+ sFileURL = ConvertToURL( oTextFieldModel.Text )
+ If sFileURL = &quot;&quot; Then
+ oSettings = CreateUnoService( &quot;com.sun.star.frame.Settings&quot; )
+ oPathSettings = CreateUnoService( &quot;com.sun.star.util.PathSettings&quot; )
+ sFileURL = oPathSettings.getPropertyValue( &quot;Work&quot; )
+ End If
+
+ REM set display directory
+ oSimpleFileAccess = CreateUnoService( &quot;com.sun.star.ucb.SimpleFileAccess&quot; )
+ If oSimpleFileAccess.exists( sFileURL ) And oSimpleFileAccess.isFolder( sFileURL ) Then
+ oFilePicker.setDisplayDirectory( sFileURL )
+ End If
+
+ REM execute file dialog
+ If oFilePicker.execute() Then
+ sFiles = oFilePicker.getFiles()
+ sFileURL = sFiles(0)
+ If oSimpleFileAccess.exists( sFileURL ) Then
+ REM set file path in text field
+ oTextField = oDialog.GetControl(&quot;TextField1&quot;)
+ oTextField.SetText( ConvertFromURL( sFileURL ) )
+ End If
+ End If
+
+End Sub
+</script:module> \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/FileDialogDlg.xdl b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/FileDialogDlg.xdl
new file mode 100644
index 000000000..ec99f7b48
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/FileDialogDlg.xdl
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="FileDialogDlg" dlg:title="File Dialog Demo" dlg:left="138" dlg:top="80" dlg:width="203" dlg:height="157">
+ <dlg:bulletinboard>
+ <dlg:textfield dlg:id="TextField1" dlg:tab-index="0" dlg:left="6" dlg:top="35" dlg:width="168" dlg:height="12"/>
+ <dlg:button dlg:id="CommandButton1" dlg:tab-index="1" dlg:left="180" dlg:top="35" dlg:width="14" dlg:height="14" dlg:value="...">
+ <script:event script:event-name="on-performaction" script:location="application" script:macro-name="ToolkitControls.FileDialog.OpenFileDialog" script:language="StarBasic"/>
+ </dlg:button>
+ <dlg:text dlg:id="Label1" dlg:tab-index="2" dlg:left="6" dlg:top="20" dlg:width="80" dlg:height="10" dlg:value="Enter File Path"/>
+ <dlg:button dlg:id="CommandButton2" dlg:tab-index="3" dlg:left="8" dlg:top="116" dlg:width="44" dlg:height="16" dlg:value="Cancel" dlg:button-type="cancel"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/MultiPage.xba b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/MultiPage.xba
new file mode 100644
index 000000000..65f160614
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/MultiPage.xba
@@ -0,0 +1,303 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="MultiPage" script:language="StarBasic">REM ***** BASIC *****
+
+Dim oDialog As Object
+
+Sub Main()
+
+ Dim oLibContainer As Object, oLib As Object
+ Dim oInputStreamProvider As Object
+ Dim oDialogModel As Object
+
+ Const sLibName = &quot;ToolkitControls&quot;
+ Const sDialogName = &quot;MultiPageDlg&quot;
+
+ REM load/get library and input stream provider
+ oLibContainer = DialogLibraries
+ oLibContainer.loadLibrary( sLibName )
+ oLib = oLibContainer.getByName( sLibName )
+ oInputStreamProvider = oLib.getByName( sDialogName )
+
+ REM create dialog control
+ oDialog = CreateUnoDialog( oInputStreamProvider )
+
+ REM initialize dialog and controls
+ Initialize()
+
+ REM show the dialog
+ oDialog.execute()
+
+End Sub
+
+
+Sub Initialize()
+
+ Dim oDialogModel As Object
+ Dim oNextButton As Object, oNextButtonModel As Object
+ Dim oListBox As Object
+ Dim oCheckBoxModel As Object
+ Dim oOptionButtonModel As Object
+ Dim oCurrencyFieldModel As Object
+ Dim oNumericFieldModel As Object
+ Dim oComboBox As Object, oComboBoxModel As Object
+ Dim i As Integer
+ Dim sName As String
+ Dim sPizzas As Variant, sToppings As Variant
+ Dim sCreditCards As Variant
+ Dim sMonths As Variant
+ Dim iCount As Integer
+
+ REM dialog properties
+ oDialogModel = oDialog.Model
+ oDialogModel.Step = 1
+
+ REM next button properties
+ oNextButtonModel = oDialogModel.NextButton
+ oNextButtonModel.DefaultButton = True
+ oNextButton = oDialog.getControl(&quot;NextButton&quot;)
+ oNextButton.setFocus()
+
+ REM enable/disable back button, set label of next button
+ PageChanged()
+
+ REM set control properties on dialog page 1
+
+ REM pizzas in list box
+ oListBox = oDialog.getControl(&quot;ListBox1&quot;)
+ sPizzas = Array(&quot;Margarita&quot;,&quot;Vegetarian&quot;,&quot;Ham &amp; Pineapple&quot;,&quot;Mexican&quot;,&quot;Seafood&quot;)
+ oListBox.addItems( sPizzas, 0 )
+ oListBox.selectItem( sPizzas(0), True )
+
+ REM extra toppings
+ sToppings = Array(&quot;Extra Cheese&quot;,&quot;Corn&quot;,&quot;Onions&quot;,&quot;Olives&quot;)
+ For i = 0 To 3
+ sName = &quot;CheckBox&quot; + i
+ oCheckBoxModel = oDialogModel.getByName( sName )
+ oCheckBoxModel.Label = sToppings( i )
+ Next i
+
+ REM default pizza size
+ oOptionButtonModel = oDialogModel.OptionButton2
+ oOptionButtonModel.State = True
+
+ REM currency field properties
+ oCurrencyFieldModel = oDialogModel.CurrencyField1
+ oCurrencyFieldModel.ReadOnly = True
+ oCurrencyFieldModel.DecimalAccuracy = 2
+ oCurrencyFieldModel.CurrencySymbol = &quot;€&quot;
+ oCurrencyFieldModel.PrependCurrencySymbol = True
+
+ REM calculate prize for default settings
+ CalculatePrize()
+
+ REM set control properties on dialog page 2
+
+ REM numeric field properties
+ oNumericFieldModel = oDialogModel.NumericField1
+ oNumericFieldModel.DecimalAccuracy = 0
+
+ REM set control properties on dialog page 3
+
+ REM default payment method
+ oOptionButtonModel = oDialogModel.OptionButton4
+ oOptionButtonModel.State = True
+
+ REM credit cards in combo box
+ oComboBox = oDialog.getControl(&quot;ComboBox1&quot;)
+ sCreditCards = Array(&quot;Visa&quot;,&quot;Master/EuroCard&quot;,&quot;American Express&quot;)
+ oComboBox.addItems( sCreditCards, 0 )
+ oComboBoxModel = oDialogModel.ComboBox1
+ oComboBoxModel.Text = sCreditCards(0)
+
+ REM expiration month
+ oListBox = oDialog.getControl(&quot;ListBox2&quot;)
+ sMonths = Array(&quot;01&quot;,&quot;02&quot;,&quot;03&quot;,&quot;04&quot;,&quot;05&quot;,&quot;06&quot;,&quot;07&quot;,&quot;08&quot;,&quot;09&quot;,&quot;10&quot;,&quot;11&quot;,&quot;12&quot;)
+ oListBox.addItems( sMonths, 0 )
+ oListBox.selectItemPos( Month(Date())-1, True )
+
+ REM expiration year
+ oListBox = oDialog.getControl(&quot;ListBox3&quot;)
+ For i = Year(Date()) To Year(Date()) + 4
+ iCount = oListBox.getItemCount()
+ oListBox.addItem( Str( i ), iCount )
+ Next i
+ oListBox.selectItemPos( 0, True )
+
+End Sub
+
+
+Sub CalculatePrize()
+
+ Dim oDialogModel As Object
+ Dim oListBox As Object
+ Dim oCheckBoxModel As Object
+ Dim oCurrencyFieldModel As Object
+ Dim Position As Integer
+ Dim sName As String
+ Dim i As Integer, nChecked As Integer
+ Dim Prizes As Variant
+ Dim Prize As Double
+
+ REM prizes for medium size pizzas
+ Prizes = Array( 4, 5, 6, 6, 7 )
+
+ REM get the position of the currently selected pizza
+ oListBox = oDialog.getControl(&quot;ListBox1&quot;)
+ Position = oListBox.getSelectedItemPos()
+ Prize = Prizes( Position )
+
+ REM small pizzas are 1€ cheaper, large pizzas are 1€ more expensive
+ oDialogModel = oDialog.Model
+ If oDialogModel.OptionButton1.State = 1 Then
+ Prize = Prize - 1
+ ElseIf oDialogModel.OptionButton3.State = 1 Then
+ Prize = Prize + 1
+ End If
+
+ REM get the number of extra toppings (0.5€ per extra topping)
+ For i = 0 To 3
+ sName = &quot;CheckBox&quot; + i
+ oCheckBoxModel = oDialogModel.getByName( sName )
+ If oCheckBoxModel.State = 1 Then
+ nChecked = nChecked + 1
+ End If
+ Next i
+ Prize = Prize + nChecked * 0.5
+
+ REM set the value of the currency field
+ oCurrencyFieldModel = oDialogModel.CurrencyField1
+ oCurrencyFieldModel.Value = Prize
+
+End Sub
+
+
+Sub PaymentMethodChanged()
+
+ Dim oDialogModel As Object
+ Dim bEnabled As Boolean
+
+ REM get dialog model
+ oDialogModel = oDialog.getModel()
+
+ If oDialogModel.OptionButton4.State = 1 Then
+ REM enable controls for payment by credit card
+ bEnabled = True
+ ElseIf oDialogModel.OptionButton5.State = 1 Then
+ REM disable controls for payment by check
+ bEnabled = False
+ End If
+
+ REM enable/disable controls
+ With oDialogModel
+ .Label11.Enabled = bEnabled
+ .Label12.Enabled = bEnabled
+ .Label13.Enabled = bEnabled
+ .ComboBox1.Enabled = bEnabled
+ .TextField6.Enabled = bEnabled
+ .ListBox2.Enabled = bEnabled
+ .ListBox3.Enabled = bEnabled
+ .TextField7.Enabled = bEnabled
+ End With
+
+End Sub
+
+
+Sub NextPage()
+
+ Dim oDialogModel As Object
+
+ REM get dialog model
+ oDialogModel = oDialog.getModel()
+
+ If oDialogModel.Step &lt; 3 Then
+ REM next page
+ oDialogModel.Step = oDialogModel.Step + 1
+ REM enable/disable back button, set label of next button
+ PageChanged()
+ ElseIf oDialogModel.Step = 3 Then
+ REM submit order
+ SubmitOrder()
+ REM hide dialog
+ oDialog.endExecute()
+ End If
+
+End Sub
+
+
+Sub PreviousPage()
+
+ Dim oDialogModel As Object
+
+ REM get dialog model
+ oDialogModel = oDialog.getModel()
+
+ If oDialogModel.Step &gt; 1 Then
+ REM previous page
+ oDialogModel.Step = oDialogModel.Step - 1
+ REM enable/disable back button, set label of next button
+ PageChanged()
+ End If
+
+End Sub
+
+
+Sub PageChanged()
+
+ Dim oDialogModel As Object
+ Dim oBackButtonModel As Object
+ Dim oNextButtonModel As Object
+
+ Const sLabelNext = &quot;Next &gt;&gt;&quot;
+ Const sLabelSubmit = &quot;Submit&quot;
+
+ REM get dialog model
+ oDialogModel = oDialog.getModel()
+
+ REM get back button model
+ oBackButtonModel = oDialogModel.getByName(&quot;BackButton&quot;)
+
+ REM enable/disable back button
+ If oDialogModel.Step = 1 Then
+ oBackButtonModel.Enabled = False
+ Else
+ oBackButtonModel.Enabled = True
+ End If
+
+ REM get next button model
+ oNextButtonModel = oDialogModel.getByName(&quot;NextButton&quot;)
+
+ REM set label of next button
+ If oDialogModel.Step = 3 Then
+ oNextButtonModel.Label = sLabelSubmit
+ Else
+ oNextButtonModel.Label = sLabelNext
+ End If
+
+End Sub
+
+
+Sub SubmitOrder()
+
+ MsgBox &quot;Your pizza will be delivered in 45 minutes.&quot;
+
+End Sub
+
+</script:module>
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/MultiPageDlg.xdl b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/MultiPageDlg.xdl
new file mode 100644
index 000000000..f7b28aa33
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/MultiPageDlg.xdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="MultiPageDlg" dlg:title="Multi Page Dialog Demo" dlg:left="138" dlg:top="80" dlg:width="203" dlg:height="157" dlg:page="1">
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="CancelButton" dlg:tab-index="0" dlg:left="6" dlg:top="135" dlg:width="50" dlg:height="14" dlg:value="Cancel" dlg:button-type="cancel"/>
+ <dlg:button dlg:id="BackButton" dlg:tab-index="1" dlg:left="76" dlg:top="135" dlg:width="50" dlg:height="14" dlg:value="&lt; Back">
+ <script:event script:event-name="on-performaction" script:location="application" script:macro-name="ToolkitControls.MultiPage.PreviousPage" script:language="StarBasic"/>
+ </dlg:button>
+ <dlg:button dlg:id="NextButton" dlg:tab-index="2" dlg:left="147" dlg:top="135" dlg:width="50" dlg:height="14" dlg:value="Next &gt;">
+ <script:event script:event-name="on-performaction" script:location="application" script:macro-name="ToolkitControls.MultiPage.NextPage" script:language="StarBasic"/>
+ </dlg:button>
+ <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="3" dlg:left="6" dlg:top="6" dlg:width="185" dlg:height="9" dlg:page="1" dlg:value="Select a Pizza"/>
+ <dlg:text dlg:id="Label1" dlg:tab-index="4" dlg:left="11" dlg:top="22" dlg:width="57" dlg:height="9" dlg:page="1" dlg:value="~Pizza"/>
+ <dlg:menulist dlg:id="ListBox1" dlg:tab-index="5" dlg:left="11" dlg:top="35" dlg:width="60" dlg:height="12" dlg:page="1" dlg:spin="true">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.CalculatePrize" script:language="StarBasic"/>
+ </dlg:menulist>
+ <dlg:text dlg:id="Label2" dlg:tab-index="6" dlg:left="11" dlg:top="61" dlg:width="60" dlg:height="11" dlg:page="1" dlg:value="Extra Toppings"/>
+ <dlg:checkbox dlg:id="CheckBox0" dlg:tab-index="7" dlg:left="11" dlg:top="75" dlg:width="60" dlg:height="9" dlg:page="1" dlg:value="CheckBox0" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.CalculatePrize" script:language="StarBasic"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="CheckBox1" dlg:tab-index="8" dlg:left="11" dlg:top="88" dlg:width="60" dlg:height="9" dlg:page="1" dlg:value="CheckBox1" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.CalculatePrize" script:language="StarBasic"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="CheckBox2" dlg:tab-index="9" dlg:left="11" dlg:top="101" dlg:width="60" dlg:height="9" dlg:page="1" dlg:value="CheckBox2" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.CalculatePrize" script:language="StarBasic"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="CheckBox3" dlg:tab-index="10" dlg:left="11" dlg:top="114" dlg:width="60" dlg:height="9" dlg:page="1" dlg:value="CheckBox3" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.CalculatePrize" script:language="StarBasic"/>
+ </dlg:checkbox>
+ <dlg:fixedline dlg:id="FixedLine2" dlg:tab-index="11" dlg:left="96" dlg:top="22" dlg:width="9" dlg:height="106" dlg:page="1" dlg:align="vertical"/>
+ <dlg:text dlg:id="Label3" dlg:tab-index="12" dlg:left="120" dlg:top="22" dlg:width="60" dlg:height="9" dlg:page="1" dlg:value="Size"/>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="OptionButton1" dlg:tab-index="13" dlg:left="120" dlg:top="36" dlg:width="60" dlg:height="9" dlg:page="1" dlg:value="Small">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.CalculatePrize" script:language="StarBasic"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="OptionButton2" dlg:tab-index="14" dlg:left="120" dlg:top="49" dlg:width="60" dlg:height="9" dlg:page="1" dlg:value="Medium">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.CalculatePrize" script:language="StarBasic"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="OptionButton3" dlg:tab-index="15" dlg:left="120" dlg:top="62" dlg:width="60" dlg:height="9" dlg:page="1" dlg:value="Large">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.CalculatePrize" script:language="StarBasic"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:text dlg:id="Label4" dlg:tab-index="16" dlg:left="120" dlg:top="114" dlg:width="25" dlg:height="9" dlg:page="1" dlg:value="Prize"/>
+ <dlg:currencyfield dlg:id="CurrencyField1" dlg:tab-index="17" dlg:left="150" dlg:top="113" dlg:width="30" dlg:height="12" dlg:page="1"/>
+ <dlg:fixedline dlg:id="FixedLine3" dlg:tab-index="18" dlg:left="6" dlg:top="6" dlg:width="185" dlg:height="9" dlg:page="2" dlg:value="Enter the Delivery Address"/>
+ <dlg:text dlg:id="Label5" dlg:tab-index="19" dlg:left="11" dlg:top="27" dlg:width="50" dlg:height="9" dlg:page="2" dlg:value="Full Name"/>
+ <dlg:textfield dlg:id="TextField2" dlg:tab-index="20" dlg:left="70" dlg:top="25" dlg:width="110" dlg:height="12" dlg:page="2"/>
+ <dlg:text dlg:id="Label6" dlg:tab-index="21" dlg:left="11" dlg:top="47" dlg:width="50" dlg:height="9" dlg:page="2" dlg:value="Address"/>
+ <dlg:textfield dlg:id="TextField3" dlg:tab-index="22" dlg:left="70" dlg:top="45" dlg:width="110" dlg:height="12" dlg:page="2"/>
+ <dlg:text dlg:id="Label7" dlg:tab-index="23" dlg:left="11" dlg:top="67" dlg:width="50" dlg:height="9" dlg:page="2" dlg:value="City"/>
+ <dlg:textfield dlg:id="TextField4" dlg:tab-index="24" dlg:left="70" dlg:top="65" dlg:width="80" dlg:height="12" dlg:page="2"/>
+ <dlg:text dlg:id="Label8" dlg:tab-index="25" dlg:left="11" dlg:top="87" dlg:width="50" dlg:height="9" dlg:page="2" dlg:value="ZIP / Postal Code"/>
+ <dlg:numericfield dlg:id="NumericField1" dlg:tab-index="26" dlg:left="70" dlg:top="85" dlg:width="50" dlg:height="12" dlg:page="2"/>
+ <dlg:text dlg:id="Label9" dlg:tab-index="27" dlg:left="11" dlg:top="107" dlg:width="50" dlg:height="9" dlg:page="2" dlg:value="Phone Number"/>
+ <dlg:textfield dlg:id="TextField5" dlg:tab-index="28" dlg:left="70" dlg:top="105" dlg:width="80" dlg:height="12" dlg:page="2"/>
+ <dlg:fixedline dlg:id="FixedLine4" dlg:tab-index="29" dlg:left="6" dlg:top="6" dlg:width="185" dlg:height="9" dlg:page="3" dlg:value="Select a Payment Method"/>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="OptionButton4" dlg:tab-index="30" dlg:left="12" dlg:top="26" dlg:width="40" dlg:height="9" dlg:page="3" dlg:value="Credit Card">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.PaymentMethodChanged" script:language="StarBasic"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="OptionButton5" dlg:tab-index="31" dlg:left="12" dlg:top="110" dlg:width="40" dlg:height="9" dlg:page="3" dlg:value="Check">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="ToolkitControls.MultiPage.PaymentMethodChanged" script:language="StarBasic"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:combobox dlg:id="ComboBox1" dlg:tab-index="32" dlg:left="76" dlg:top="25" dlg:width="70" dlg:height="12" dlg:page="3" dlg:spin="true"/>
+ <dlg:text dlg:id="Label11" dlg:tab-index="33" dlg:left="21" dlg:top="46" dlg:width="50" dlg:height="9" dlg:page="3" dlg:value="Credit Card No."/>
+ <dlg:textfield dlg:id="TextField6" dlg:tab-index="34" dlg:left="76" dlg:top="45" dlg:width="70" dlg:height="12" dlg:page="3"/>
+ <dlg:text dlg:id="Label12" dlg:tab-index="35" dlg:left="21" dlg:top="66" dlg:width="50" dlg:height="9" dlg:page="3" dlg:value="Expiration Date"/>
+ <dlg:menulist dlg:id="ListBox2" dlg:tab-index="36" dlg:left="76" dlg:top="65" dlg:width="20" dlg:height="12" dlg:page="3" dlg:spin="true"/>
+ <dlg:menulist dlg:id="ListBox3" dlg:tab-index="37" dlg:left="100" dlg:top="65" dlg:width="27" dlg:height="12" dlg:page="3" dlg:spin="true"/>
+ <dlg:text dlg:id="Label13" dlg:tab-index="38" dlg:left="21" dlg:top="86" dlg:width="50" dlg:height="9" dlg:page="3" dlg:value="Cardholder&apos;s Name"/>
+ <dlg:textfield dlg:id="TextField7" dlg:tab-index="39" dlg:left="76" dlg:top="85" dlg:width="70" dlg:height="12" dlg:page="3"/>
+ <dlg:textfield dlg:id="TextField1" dlg:tab-index="40" dlg:left="-47" dlg:top="46" dlg:width="0" dlg:height="2" dlg:page="3"/>
+ </dlg:bulletinboard>
+</dlg:window>
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ProgressBar.xba b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ProgressBar.xba
new file mode 100644
index 000000000..8b34f0cc3
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ProgressBar.xba
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ProgressBar" script:language="StarBasic">REM ***** BASIC *****
+
+Dim oDialog As Object
+
+Sub Main()
+
+ Dim oLibContainer As Object, oLib As Object
+ Dim oInputStreamProvider As Object
+ Dim oProgressBar As Object
+
+ Const sLibName = &quot;ToolkitControls&quot;
+ Const sDialogName = &quot;ProgressBarDlg&quot;
+
+ REM load/get library and input stream provider
+ oLibContainer = DialogLibraries
+ oLibContainer.loadLibrary( sLibName )
+ oLib = oLibContainer.getByName( sLibName )
+ oInputStreamProvider = oLib.getByName( sDialogName )
+
+ REM create dialog control
+ oDialog = CreateUnoDialog( oInputStreamProvider )
+
+ REM hide progress bar
+ oProgressBar = oDialog.getControl(&quot;ProgressBar1&quot;)
+ oProgressBar.setVisible( False )
+
+ REM show the dialog
+ oDialog.execute()
+
+End Sub
+
+Sub ProgressBarDemo()
+
+ Dim oProgressBar As Object, oProgressBarModel As Object
+ Dim oCancelButtonModel As Object
+ Dim oStartButtonModel As Object
+ Dim ProgressValue As Long
+
+ REM progress bar settings
+ Const ProgressValueMin = 0
+ Const ProgressValueMax = 50
+ Const ProgressStep = 1
+
+ REM set minimum and maximum progress value
+ oProgressBarModel = oDialog.Model.ProgressBar1
+ oProgressBarModel.ProgressValueMin = ProgressValueMin
+ oProgressBarModel.ProgressValueMax = ProgressValueMax
+
+ REM disable cancel and start button
+ oCancelButtonModel = oDialog.Model.CommandButton1
+ oCancelButtonModel.Enabled = False
+ oStartButtonModel = oDialog.Model.CommandButton2
+ oStartButtonModel.Enabled = False
+
+ REM show progress bar
+ oProgressBar = oDialog.getControl(&quot;ProgressBar1&quot;)
+ oProgressBar.setVisible( True )
+
+ REM increase progress value every second
+ For ProgressValue = ProgressValueMin To ProgressValueMax Step ProgressStep
+ oProgressBarModel.ProgressValue = ProgressValue
+ Wait 40
+ Next ProgressValue
+
+ REM hide progress bar
+ oProgressBar.setVisible( False )
+
+ REM enable cancel and start button
+ oCancelButtonModel.Enabled = True
+ oStartButtonModel.Enabled = True
+
+End Sub
+
+</script:module> \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ProgressBarDlg.xdl b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ProgressBarDlg.xdl
new file mode 100644
index 000000000..4a5803273
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ProgressBarDlg.xdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="ProgressBarDlg" dlg:title="Progress Bar Demo" dlg:left="138" dlg:top="80" dlg:width="203" dlg:height="157">
+ <dlg:bulletinboard>
+ <dlg:progressmeter dlg:id="ProgressBar1" dlg:tab-index="0" dlg:left="6" dlg:top="70" dlg:width="190" dlg:height="9" dlg:value="0"/>
+ <dlg:button dlg:id="CommandButton1" dlg:tab-index="1" dlg:left="6" dlg:top="135" dlg:width="50" dlg:height="14" dlg:value="Cancel" dlg:button-type="cancel"/>
+ <dlg:button dlg:id="CommandButton2" dlg:tab-index="2" dlg:left="147" dlg:top="135" dlg:width="50" dlg:height="14" dlg:value="Start Demo">
+ <script:event script:event-name="on-performaction" script:location="application" script:macro-name="ToolkitControls.ProgressBar.ProgressBarDemo" script:language="StarBasic"/>
+ </dlg:button>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ScrollBar.xba b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ScrollBar.xba
new file mode 100644
index 000000000..db2dd7cdd
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ScrollBar.xba
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ScrollBar" script:language="StarBasic">REM ***** BASIC *****
+
+Dim oDialog As Object
+Const Border = 5
+
+Sub Main()
+
+ Dim oLibContainer As Object, oLib As Object
+ Dim oInputStreamProvider As Object
+ Dim oDialogModel As Object
+ Dim oScrollBarModel As Object
+ Dim oLabelModel As Object
+ Dim sLabel As String
+ Dim VisibleSize As Double
+
+ Const sLibName = &quot;ToolkitControls&quot;
+ Const sDialogName = &quot;ScrollBarDlg&quot;
+
+ REM load/get library and input stream provider
+ oLibContainer = DialogLibraries
+ oLibContainer.loadLibrary( sLibName )
+ oLib = oLibContainer.getByName( sLibName )
+ oInputStreamProvider = oLib.getByName( sDialogName )
+
+ REM create dialog control
+ oDialog = CreateUnoDialog( oInputStreamProvider )
+
+ REM set the label
+ sLabel = &quot;This Text exceeds the visible area of the dialog and can be&quot;
+ sLabel = sLabel + &quot; scrolled horizontally by clicking on the scroll bar.&quot;
+ oDialogModel = oDialog.Model
+ oLabelModel = oDialogModel.Label1
+ oLabelModel.Label = sLabel
+
+ REM scroll bar settings
+ oScrollBarModel = oDialog.Model.ScrollBar1
+ oScrollBarModel.ScrollValueMax = 100
+ VisibleSize = (oDialogModel.Width - Border - oLabelModel.PositionX) / oLabelModel.Width
+ VisibleSize = VisibleSize * oScrollBarModel.ScrollValueMax
+ oScrollBarModel.VisibleSize = VisibleSize
+ oScrollBarModel.BlockIncrement = oScrollBarModel.VisibleSize
+ oScrollBarModel.LineIncrement = oScrollBarModel.BlockIncrement / 20
+
+ REM show the dialog
+ oDialog.execute()
+
+End Sub
+
+Sub AdjustmentHandler()
+
+ Dim oLabelModel As Object
+ Dim oScrollBarModel As Object
+ Dim ScrollValue As Long, ScrollValueMax As Long
+ Dim VisibleSize As Long
+ Dim Factor As Double
+
+ Static bInit As Boolean
+ Static PositionX0 As Long
+ Static Offset As Long
+
+ REM get the model of the label control
+ oLabelModel = oDialog.Model.Label1
+
+ REM on initialization remember the position of the label control and calculate offset
+ If bInit = False Then
+ bInit = True
+ PositionX0 = oLabelModel.PositionX
+ OffSet = PositionX0 + oLabelModel.Width - (oDialog.Model.Width - Border)
+ End If
+
+ REM get the model of the scroll bar control
+ oScrollBarModel = oDialog.Model.ScrollBar1
+
+ REM get the actual scroll value
+ ScrollValue = oScrollBarModel.ScrollValue
+
+ REM calculate and set new position of the label control
+ ScrollValueMax = oScrollBarModel.ScrollValueMax
+ VisibleSize = oScrollBarModel.VisibleSize
+ Factor = Offset / (ScrollValueMax - VisibleSize)
+ oLabelModel.PositionX = PositionX0 - Factor * ScrollValue
+
+End Sub
+</script:module> \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ScrollBarDlg.xdl b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ScrollBarDlg.xdl
new file mode 100644
index 000000000..ae36d0000
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/ScrollBarDlg.xdl
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="ScrollBarDlg" dlg:title="Scroll Bar Demo" dlg:left="138" dlg:top="80" dlg:width="200" dlg:height="157">
+ <dlg:styles>
+ <dlg:style dlg:style-id="0" dlg:font-height="18"/>
+ </dlg:styles>
+ <dlg:bulletinboard>
+ <dlg:scrollbar dlg:id="ScrollBar1" dlg:tab-index="0" dlg:left="5" dlg:top="137" dlg:width="190" dlg:height="15">
+ <script:event script:event-name="on-adjustmentvaluechange" script:location="application" script:macro-name="ToolkitControls.ScrollBar.AdjustmentHandler" script:language="StarBasic"/>
+ </dlg:scrollbar>
+ <dlg:text dlg:style-id="0" dlg:id="Label1" dlg:tab-index="1" dlg:left="5" dlg:top="39" dlg:width="600" dlg:height="17" dlg:value="Label1"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/dialog.xlb b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/dialog.xlb
new file mode 100644
index 000000000..a74e020a1
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/dialog.xlb
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ToolkitControls" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="FileDialogDlg"/>
+ <library:element library:name="ProgressBarDlg"/>
+ <library:element library:name="ScrollBarDlg"/>
+ <library:element library:name="MultiPageDlg"/>
+</library:library> \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/script.xlb b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/script.xlb
new file mode 100644
index 000000000..03741ae35
--- /dev/null
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/ToolkitControls/ToolkitControls/script.xlb
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ToolkitControls" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="FileDialog"/>
+ <library:element library:name="ProgressBar"/>
+ <library:element library:name="ScrollBar"/>
+ <library:element library:name="MultiPage"/>
+</library:library> \ No newline at end of file