summaryrefslogtreecommitdiff
path: root/toolkit/workben/layout
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/workben/layout')
-rw-r--r--toolkit/workben/layout/.gitignore4
-rw-r--r--toolkit/workben/layout/README43
-rwxr-xr-xtoolkit/workben/layout/TEST11
-rw-r--r--toolkit/workben/layout/adjust.xml44
-rw-r--r--toolkit/workben/layout/align-test.xml30
-rw-r--r--toolkit/workben/layout/align.xml44
-rw-r--r--toolkit/workben/layout/boxtest.xml36
-rw-r--r--toolkit/workben/layout/dialogbuttons-ok.xml49
-rw-r--r--toolkit/workben/layout/dialogbuttons-reset.xml54
-rw-r--r--toolkit/workben/layout/dialogbuttons-save.xml49
-rw-r--r--toolkit/workben/layout/dialogbuttons-yes.xml49
-rw-r--r--toolkit/workben/layout/editor-normal.xml53
-rw-r--r--toolkit/workben/layout/editor.cxx1853
-rw-r--r--toolkit/workben/layout/editor.hxx51
-rw-r--r--toolkit/workben/layout/editor.xml52
-rw-r--r--toolkit/workben/layout/empty.xml26
-rw-r--r--toolkit/workben/layout/flow-container.xml48
-rw-r--r--toolkit/workben/layout/flow.xml17
-rw-r--r--toolkit/workben/layout/insert-sheet.xml57
-rw-r--r--toolkit/workben/layout/interactable-containers.xml49
-rw-r--r--toolkit/workben/layout/layout-flat.xml14
-rw-r--r--toolkit/workben/layout/layout.xml15
-rw-r--r--toolkit/workben/layout/message-box.xml41
-rw-r--r--toolkit/workben/layout/more.xml19
-rw-r--r--toolkit/workben/layout/move-copy-sheet.xml21
-rw-r--r--toolkit/workben/layout/non-interactable-containers.xml41
-rw-r--r--toolkit/workben/layout/number-format.xml65
-rw-r--r--toolkit/workben/layout/numeric.xml10
-rw-r--r--toolkit/workben/layout/ooo-patch7
-rw-r--r--toolkit/workben/layout/paragraph.xml77
-rw-r--r--toolkit/workben/layout/plugin.cxx68
-rw-r--r--toolkit/workben/layout/plugin.hxx59
-rw-r--r--toolkit/workben/layout/plugin.xml29
-rw-r--r--toolkit/workben/layout/radio-groups.xml21
-rw-r--r--toolkit/workben/layout/recover.cxx113
-rw-r--r--toolkit/workben/layout/recover.hxx81
-rw-r--r--toolkit/workben/layout/recover.xml67
-rw-r--r--toolkit/workben/layout/refresh7
-rw-r--r--toolkit/workben/layout/run-s2x6
-rw-r--r--toolkit/workben/layout/scroller.xml32
-rw-r--r--toolkit/workben/layout/sequence.xml13
-rw-r--r--toolkit/workben/layout/shutdown.xml54
-rw-r--r--toolkit/workben/layout/simple-paragraph.cxx183
-rw-r--r--toolkit/workben/layout/simple-paragraph.hxx55
-rw-r--r--toolkit/workben/layout/simple-paragraph.xml11
-rw-r--r--toolkit/workben/layout/sort-options.xml40
-rw-r--r--toolkit/workben/layout/sortdlg.cxx72
-rw-r--r--toolkit/workben/layout/sortdlg.hrc71
-rw-r--r--toolkit/workben/layout/sortdlg.hxx76
-rw-r--r--toolkit/workben/layout/sortdlg.src331
-rw-r--r--toolkit/workben/layout/sortdlg.xml65
-rw-r--r--toolkit/workben/layout/splitter.xml13
-rw-r--r--toolkit/workben/layout/string-input.xml16
-rw-r--r--toolkit/workben/layout/tab-dialog.xml20
-rw-r--r--toolkit/workben/layout/tabcontrol.xml18
-rw-r--r--toolkit/workben/layout/table.xml15
-rw-r--r--toolkit/workben/layout/test.cxx369
-rw-r--r--toolkit/workben/layout/test.xml12
-rw-r--r--toolkit/workben/layout/testrc.in12
-rw-r--r--toolkit/workben/layout/tpsort.cxx1107
-rw-r--r--toolkit/workben/layout/tpsort.hxx219
-rw-r--r--toolkit/workben/layout/un-test.sh14
-rw-r--r--toolkit/workben/layout/uno.hxx109
-rw-r--r--toolkit/workben/layout/wordcount-plain.xml37
-rw-r--r--toolkit/workben/layout/wordcount-tight.xml43
-rw-r--r--toolkit/workben/layout/wordcount.xml59
-rw-r--r--toolkit/workben/layout/wordcountdialog.cxx111
-rw-r--r--toolkit/workben/layout/wordcountdialog.hxx70
-rw-r--r--toolkit/workben/layout/zoom-1.xml38
-rw-r--r--toolkit/workben/layout/zoom-2.xml39
-rw-r--r--toolkit/workben/layout/zoom-indent.xml41
-rw-r--r--toolkit/workben/layout/zoom-plain.xml20
-rw-r--r--toolkit/workben/layout/zoom.cxx614
-rw-r--r--toolkit/workben/layout/zoom.hrc53
-rw-r--r--toolkit/workben/layout/zoom.hxx121
-rw-r--r--toolkit/workben/layout/zoom.xml60
-rw-r--r--toolkit/workben/layout/zoom_def.hxx38
77 files changed, 7651 insertions, 0 deletions
diff --git a/toolkit/workben/layout/.gitignore b/toolkit/workben/layout/.gitignore
new file mode 100644
index 000000000000..142ba57c1444
--- /dev/null
+++ b/toolkit/workben/layout/.gitignore
@@ -0,0 +1,4 @@
+/de
+/en-US
+/nl
+/ja \ No newline at end of file
diff --git a/toolkit/workben/layout/README b/toolkit/workben/layout/README
new file mode 100644
index 000000000000..3b83bbfc00cd
--- /dev/null
+++ b/toolkit/workben/layout/README
@@ -0,0 +1,43 @@
+Testing workbench and editor for Layout engine.
+
+* Configure using --enable-layout.
+
+* [d]make all
+
+* export OOO_INSTALL_PREFIX=$(pwd)/ooo-layout
+
+* [d]make install DESTDIR=$OOO_INSTALL_PREFIX
+
+* Compile test program in toolkit/workben/layout
+
+ cd toolkit/workben/layout && dmake all
+
+* FIXME: New three layer install/rpath feature needs these workarounds
+|
+| test -d $OOO_INSTALL_PREFIX/openoffice.org3 && export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX/openoffice.org3 || export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX
+| cp -f ../..$INPATH/lib/libtkx.so $OOO_PREFIX/openoffice.org/basis3.0/program
+| export LD_LIBRARY_PATH=$OOO_PREFIX_BRAND/basis-link/program:$OOO_PREFIX_BRAND/basis-link/ure-link/lib
+|
+| (see source/layout/helper.cxx)
+
+* Run it on any .xml file
+
+ ../../$INPATH/bin/test [--inst $OOO_INSTALL_PREFIX] zoom.xml
+
+* Run it for specific dialogs, see test.cxx
+
+ ../../$INPATH/bin/test [--inst $OOO_INSTALL_PREFIX] --test zoom
+ ../../$INPATH/bin/test [--inst $OOO_INSTALL_PREFIX] --test wordcount
+
+* Or source refresh in workben/layout, do something like
+
+ cd toolkit/workben/layout && . ./refresh [--inst $OOO_INSTALL_PREFIX]
+
+Integration into OOo:
+
+* After instaling, run
+
+ cd ooo-cvs/program
+ ./soffice.bin
+
+ Start a [Writer] document and choose View/Zoom or Extra/Word count.
diff --git a/toolkit/workben/layout/TEST b/toolkit/workben/layout/TEST
new file mode 100755
index 000000000000..8a04a6628da8
--- /dev/null
+++ b/toolkit/workben/layout/TEST
@@ -0,0 +1,11 @@
+#! /bin/sh
+for d in $(cd ../../../../.. && pwd)/ooo-svn /usr/lib/ooo3/; do
+ if test -d $d; then
+ export OOO_INSTALL_PREFIX=$d
+ break
+ fi
+done
+export SAL_ALLOW_LINKOO_SYMLINKS=1
+test -d $OOO_INSTALL_PREFIX/openoffice.org3 && export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX/openoffice.org3 || export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX
+export LD_LIBRARY_PATH="$OOO_PREFIX_BRAND/basis-link/program:$OOO_PREFIX_BRAND/basis-link/ure-link/lib"
+../../unx*.pro/bin/test "$@"
diff --git a/toolkit/workben/layout/adjust.xml b/toolkit/workben/layout/adjust.xml
new file mode 100644
index 000000000000..186a94bf5e6a
--- /dev/null
+++ b/toolkit/workben/layout/adjust.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ id="window1" title="Text Editor" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <!-- Ver Top -->
+ <hbox>
+ <align v-align="0" h-align="0" v-fill="0" h-fill="0">
+ <pushbutton label="Top Left" />
+ </align>
+ <align>
+ <pushbutton label="Top Middle" v-align="0" h-align="0.5" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Top Right" v-align="0" h-align="1" v-fill="0" h-fill="0" />
+ </align>
+ </hbox>
+ <!-- Ver Middle -->
+ <hbox>
+ <align>
+ <pushbutton label="Middle Left" v-align="0.5" h-align="0" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Middle Middle" v-align="0.5" h-align="0.5" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Middle Right" v-align="0.5" h-align="1" v-fill="0" h-fill="0" />
+ </align>
+ </hbox>
+ <!-- Ver Bottom -->
+ <hbox>
+ <align>
+ <pushbutton label="Bottom Left" v-align="1" h-align="0" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Bottom Middle" v-align="1" h-align="0.5" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Bottom Right" v-align="1" h-align="1" v-fill="0" h-fill="0" />
+ </align>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/align-test.xml b/toolkit/workben/layout/align-test.xml
new file mode 100644
index 000000000000..60c34b4655a5
--- /dev/null
+++ b/toolkit/workben/layout/align-test.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Align Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5">
+ <fixedline/>
+ <hbox spacing="0" border="0">
+ <vbox spacing="5" border="5">
+ <fixedline _text="X" cnt:expand="false"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ </vbox>
+ <vbox spacing="5" border="5">
+ <fixedline _text="X" cnt:expand="false"/>
+ <pushbutton label="bar"/>
+ </vbox>
+ </hbox>
+ <fixedline/>
+ <min-size cnt:spacing="0" min-width="200"/>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/align.xml b/toolkit/workben/layout/align.xml
new file mode 100644
index 000000000000..85aee220fc78
--- /dev/null
+++ b/toolkit/workben/layout/align.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Align Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <!-- Ver Top -->
+ <hbox>
+ <align halign="0" valign="0">
+ <pushbutton label="Top Left" />
+ </align>
+ <align halign="0.5" valign="0">
+ <pushbutton label="Top Middle" />
+ </align>
+ <align halign="1" valign="0">
+ <pushbutton label="Top Right" />
+ </align>
+ </hbox>
+ <!-- Ver Middle -->
+ <hbox>
+ <align halign="0" valign="0.5">
+ <pushbutton label="Middle Left" />
+ </align>
+ <align halign="0.5" valign="0.5">
+ <pushbutton label="Middle Middle" />
+ </align>
+ <align halign="1" valign="0.5">
+ <pushbutton label="Middle Right" />
+ </align>
+ </hbox>
+ <!-- Ver Bottom -->
+ <hbox>
+ <align halign="0" valign="1">
+ <pushbutton label="Bottom Left" />
+ </align>
+ <align halign="0.5" valign="1">
+ <pushbutton label="Bottom Middle" />
+ </align>
+ <align halign="1" valign="1">
+ <pushbutton label="Bottom Right" />
+ </align>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/boxtest.xml b/toolkit/workben/layout/boxtest.xml
new file mode 100644
index 000000000000..24ead837c057
--- /dev/null
+++ b/toolkit/workben/layout/boxtest.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Box Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <table>
+ <vbox>
+ <hbox cnt:expand="false" cnt:fill="false">
+ <pushbutton label="XML Left"
+ cnt:expand="false" cnt:fill="false"/>
+ <pushbutton label="XML Middle"
+ cnt:expand="true" cnt:fill="false"/>
+ <pushbutton label="XML Right"
+ cnt:expand="true" cnt:fill="true"/>
+ </hbox>
+ <hbox cnt:expand="true" cnt:fill="false">
+ <pushbutton label="XML Left"
+ cnt:expand="false" cnt:fill="false"/>
+ <pushbutton label="XML Middle"
+ cnt:expand="true" cnt:fill="false"/>
+ <pushbutton label="XML Right"
+ cnt:expand="true" cnt:fill="true"/>
+ </hbox>
+ <hbox cnt:expand="true" cnt:fill="true">
+ <pushbutton label="XML Left"
+ cnt:expand="false" cnt:fill="false"/>
+ <pushbutton label="XML Middle"
+ cnt:expand="true" cnt:fill="false"/>
+ <pushbutton label="XML Right"
+ cnt:expand="true" cnt:fill="true"/>
+ </hbox>
+ </vbox>
+ </table>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/dialogbuttons-ok.xml b/toolkit/workben/layout/dialogbuttons-ok.xml
new file mode 100644
index 000000000000..86c7a1b13818
--- /dev/null
+++ b/toolkit/workben/layout/dialogbuttons-ok.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Dialog Button Ordering" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windows">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/dialogbuttons-reset.xml b/toolkit/workben/layout/dialogbuttons-reset.xml
new file mode 100644
index 000000000000..6c1c613fe96d
--- /dev/null
+++ b/toolkit/workben/layout/dialogbuttons-reset.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Dialog Button Ordering" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windows">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/dialogbuttons-save.xml b/toolkit/workben/layout/dialogbuttons-save.xml
new file mode 100644
index 000000000000..38bd90773d0e
--- /dev/null
+++ b/toolkit/workben/layout/dialogbuttons-save.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Dialog Button Ordering" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windows">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/dialogbuttons-yes.xml b/toolkit/workben/layout/dialogbuttons-yes.xml
new file mode 100644
index 000000000000..78845598bffc
--- /dev/null
+++ b/toolkit/workben/layout/dialogbuttons-yes.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Dialog Button Ordering" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windows">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/editor-normal.xml b/toolkit/workben/layout/editor-normal.xml
new file mode 100644
index 000000000000..7f0dc0b69e74
--- /dev/null
+++ b/toolkit/workben/layout/editor-normal.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Would be cool to have others Editor layouts (e.g. Glade-like with
+ a window for each function). -->
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Layout Editor" sizeable="true" >
+ <vbox>
+ <hbox>
+ <min-size min-width="120" cnt:expand="false">
+ <vbox>
+ <fixedtext label="Layout:" cnt:expand="false" />
+ <hbox>
+ <listbox id="layout-tree" has_border="true" />
+ <vbox cnt:expand="false">
+ <pushbutton id="layout-up-button" cnt:expand="false" />
+ <pushbutton id="layout-down-button" cnt:expand="false" />
+ <fixedtext cnt:expand="true" />
+ <pushbutton id="layout-remove-button" cnt:expand="false" />
+ </vbox>
+ </hbox>
+ </vbox>
+ </min-size>
+ <min-size min-width="120">
+ <vbox>
+ <fixedtext label="Preview:" cnt:expand="false" />
+ <vbox border="50">
+ <bin id="preview-box" />
+ </vbox>
+ </vbox>
+ </min-size>
+ <min-size min-width="120" cnt:expand="false">
+ <vbox>
+ <fixedtext label="Properties:" cnt:expand="false" />
+ <table id="properties-box" columns="3" />
+ </vbox>
+ </min-size>
+ </hbox>
+ <hfixedline cnt:expand="false" />
+ <vbox cnt:expand="false">
+ <fixedtext label="Create widgets:" cnt:expand="false" />
+ <flow id="create-widget" homogeneous="true" spacing="2" />
+ <fixedtext label="Create containers:" cnt:expand="false" />
+ <flow id="create-container" homogeneous="true" spacing="2" />
+ </vbox>
+ <hbox cnt:expand="false">
+ <vbox><fixedline /><fixedline /><fixedline /><fixedline /></vbox>
+<!-- <pushbutton id="import-button" label="Import..." cnt:expand="false"/>-->
+ <pushbutton id="export-button" label="Export (stdout)" cnt:expand="false"/>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/editor.cxx b/toolkit/workben/layout/editor.cxx
new file mode 100644
index 000000000000..27a8987ec1ba
--- /dev/null
+++ b/toolkit/workben/layout/editor.cxx
@@ -0,0 +1,1853 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "editor.hxx"
+
+#undef NDEBUG
+
+/*
+#include <stdio.h>
+#include <string.h>
+*/
+
+#include <cassert>
+#include <cstdio>
+#include <cstring>
+#include <list>
+#include <vector>
+
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XLayoutContainer.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <toolkit/helper/property.hxx>
+#include <vcl/lstbox.h>
+
+using namespace layout::css;
+
+using rtl::OUString;
+
+// FIXME:
+//#define FILEDLG
+
+#include <layout/core/helper.hxx>
+#include <layout/core/root.hxx>
+#include <layout/core/helper.hxx>
+
+// TODO: automatically generated
+struct WidgetSpec {
+ const char *pLabel, *pName, *pIconName;
+ bool bIsContainer; };
+static const WidgetSpec WIDGETS_SPECS[] = {
+ { "Label", "fixedtext" , "sc_label.png", false },
+ { "Button", "pushbutton" , "sc_pushbutton.png", false },
+ { "Radio Button", "radiobutton" , "sc_radiobutton.png", false },
+ { "Check Box", "checkbox" , "sc_checkbox.png", false },
+ { "Line Edit", "edit" , "sc_edit.png", false },
+ { "Numeric Field", "numericfield", "sc_numericfield.png", false },
+ { "List Box ", "listbox" , NULL, false },
+ // containers
+ { "Hor Box", "hbox" , NULL, true },
+ { "Ver Box", "vbox" , NULL, true },
+ { "Table", "table" , NULL, true },
+ { "Alignment", "align" , NULL, true },
+ { "Tab Control", "tabcontrol" , NULL, true },
+ { "Hor Splitter", "hsplitter" , NULL, true },
+ { "Ver Splitter", "vsplitter" , NULL, true },
+ { "Scroller", "scroller" , NULL, true },
+};
+const int WIDGETS_SPECS_LEN = sizeof (WIDGETS_SPECS) / sizeof (WidgetSpec);
+
+using namespace layout;
+using namespace layoutimpl;
+namespace css = ::com::sun::star;
+
+static rtl::OUString anyToString (uno::Any value)
+{
+ try
+ {
+ switch (value.getValueTypeClass()) {
+ case uno::TypeClass_STRING:
+ return value.get<rtl::OUString>();
+ case uno::TypeClass_CONSTANT:
+ return rtl::OUString::valueOf (value.get<sal_Int32>());
+ case uno::TypeClass_LONG:
+ return rtl::OUString::valueOf (value.get<sal_Int64>());
+ case uno::TypeClass_SHORT:
+ // FIXME: seems broken
+ return rtl::OUString::valueOf ((sal_Int32) value.get<short>());
+
+ case uno::TypeClass_FLOAT:
+ return rtl::OUString::valueOf (value.get<float>());
+ case uno::TypeClass_DOUBLE:
+ return rtl::OUString::valueOf (value.get<double>());
+
+ case uno::TypeClass_BOOLEAN:
+ {
+ bool val = value.get<sal_Bool>();
+ return rtl::OUString( val ? "1" : "0", 1, RTL_TEXTENCODING_ASCII_US );
+/* if ( val )
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
+ else
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );*/
+ }
+ default:
+ break;
+ }
+ }
+ catch(...) {}
+ return rtl::OUString();
+}
+
+static inline long anyToNatural (uno::Any value)
+{ return sal::static_int_cast<long>(anyToString( value ).toInt64()); }
+static inline double anyToDecimal (uno::Any value)
+{ return anyToString( value ).toDouble(); }
+
+/* XLayoutContainer/XLayoutConstrains are a bit of a hasle to work with.
+ Let's wrap them. */
+class Widget : public layoutimpl::LayoutWidget
+{
+ friend class EditorRoot;
+
+ Widget *mpParent;
+ std::vector< Widget *> maChildren;
+ bool mbForeign;
+
+ rtl::OUString mrId;
+ rtl::OUString mrLabel, mrUnoName;
+
+// TODO: store original properties. And some property handling methods.
+ long mnOriAttrbs;
+ layoutimpl::PropList maOriProps, maOriChildProps;
+
+public:
+
+ // to be used to wrap the root
+ Widget( uno::Reference< awt::XLayoutConstrains > xImport, const char *label )
+ : mpParent( 0 ), mbForeign( true )
+ {
+ mxWidget = xImport;
+ mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
+
+ mrLabel = rtl::OUString( label, strlen( label ), RTL_TEXTENCODING_UTF8 );
+ }
+
+ Widget( rtl::OUString id, uno::Reference< awt::XToolkit > xToolkit,
+ uno::Reference< awt::XLayoutContainer > xParent,
+ rtl::OUString unoName, long nAttrbs )
+ : mpParent( 0 ), mbForeign( false ), mrId( id ),
+ mnOriAttrbs( nAttrbs )
+ {
+ while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() )
+ {
+ uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY );
+ OSL_ASSERT( xContainer.is() );
+ xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY );
+ }
+
+ mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, nAttrbs );
+ OSL_ASSERT( mxWidget.is() );
+ mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
+
+ mrLabel = mrUnoName = unoName;
+ // try to get a nicer label for the widget
+ for ( int i = 0; i < WIDGETS_SPECS_LEN; i++ )
+ if ( unoName.equalsAscii( WIDGETS_SPECS[ i ].pName ) )
+ {
+ const char *label = WIDGETS_SPECS[ i ].pLabel;
+ mrLabel = rtl::OUString( label, strlen( label ), RTL_TEXTENCODING_UTF8 );
+ break;
+ }
+
+ // set default Text property
+ // TODO: disable editing of text fields, check boxes selected, etc...
+
+
+ // store original properties
+ {
+ PropertyIterator it( this, WINDOW_PROPERTY );
+ while ( it.hasNext() )
+ {
+ beans::Property prop = it.next();
+ rtl::OUString name( prop.Name );
+ rtl::OUString value( getProperty( name, WINDOW_PROPERTY ) );
+#if DEBUG_PRINT
+ fprintf(stderr, "original property: %s = %s\n", OUSTRING_CSTR(name), OUSTRING_CSTR(value));
+#endif
+ std::pair< rtl::OUString, rtl::OUString > pair( name, value );
+ maOriProps.push_back( pair );
+ }
+ }
+
+ }
+
+ ~Widget()
+ {
+ for ( std::vector< Widget *>::const_iterator it = maChildren.begin();
+ it != maChildren.end(); ++it )
+ delete *it;
+ if ( !mbForeign )
+ {
+ uno::Reference< lang::XComponent > xComp( mxWidget, uno::UNO_QUERY );
+ if ( xComp.is() )
+ // some widgets, like our containers, don't implement this interface...
+ xComp->dispose();
+ }
+ }
+
+ uno::Reference< awt::XLayoutConstrains > impl()
+ {
+ return mxWidget;
+ }
+
+ // LayoutWidget
+ virtual bool addChild( LayoutWidget *pChild )
+ {
+ return addChild( static_cast< Widget * >( pChild ) );
+ }
+
+ virtual void setProperties( const PropList &rProps )
+ {
+// maOriProps = rProps;
+ LayoutWidget::setProperties( rProps );
+ }
+
+ virtual void setChildProperties( LayoutWidget *pChild, const PropList &rProps )
+ {
+ maOriChildProps = rProps;
+ LayoutWidget::setChildProperties( pChild, rProps );
+ }
+
+ // tree travel
+ Widget *up()
+ {
+ return mpParent;
+ }
+
+ Widget *down()
+ {
+ if ( maChildren.empty() )
+ return NULL;
+ return maChildren.front();
+ }
+
+ Widget *next()
+ {
+ if ( mpParent )
+ {
+ int pos = mpParent->getChildPos( this );
+ return mpParent->getChild( pos+1 );
+ }
+ return NULL;
+ }
+
+ Widget *prev()
+ {
+ if ( mpParent )
+ {
+ int pos = mpParent->getChildPos( this );
+ return mpParent->getChild( pos-1 );
+ }
+ return NULL;
+ }
+
+ // handle
+ bool addChild( Widget *pChild, int pos = 0xffff )
+ {
+ if ( !mxContainer.is() )
+ return false;
+
+ uno::Sequence< uno::Reference < awt::XLayoutConstrains > > aChildren;
+ aChildren = mxContainer->getChildren();
+ int nChildrenLen = aChildren.getLength();
+
+ // ugly, but let's check if the container is next to full...
+ try {
+ mxContainer->addChild( pChild->mxWidget );
+ }
+ catch( awt::MaxChildrenException ex ) {
+ return false;
+ }
+
+ if ( pos < nChildrenLen )
+ { // if its on the middle, we need to make space for it
+ mxContainer->removeChild( pChild->mxWidget );
+ for ( int i = pos; i < nChildrenLen; i++ )
+ mxContainer->removeChild( aChildren[ i ] );
+ mxContainer->addChild( pChild->mxWidget );
+ for ( int i = pos; i < nChildrenLen; i++ )
+ mxContainer->addChild( aChildren[ i ] );
+ maChildren.insert( maChildren.begin()+pos, pChild );
+ }
+ else
+ maChildren.push_back( pChild );
+
+ OSL_ASSERT( pChild->mpParent == NULL );
+ pChild->mpParent = this;
+
+ // store container props
+ {
+ pChild->maOriChildProps.clear();
+ PropertyIterator it( pChild, CONTAINER_PROPERTY );
+ while ( it.hasNext() )
+ {
+ beans::Property prop = it.next();
+ rtl::OUString name( prop.Name );
+ try {
+ rtl::OUString value( pChild->getProperty( name, CONTAINER_PROPERTY ) );
+ std::pair< rtl::OUString, rtl::OUString > pair( name, value );
+ pChild->maOriChildProps.push_back( pair );
+ } catch ( beans::UnknownPropertyException &rEx ) {
+ fprintf (stderr, "ERROR: widget reports that it has a property it cannot return: '%s' this normally means that someone screwed up their PROPERTY_SET_INFO macro usage.\n",
+ rtl::OUStringToOString (rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool removeChild( Widget *pChild )
+ {
+ if ( !mxContainer.is() || pChild->mpParent != this )
+ return false;
+
+ mxContainer->removeChild( pChild->mxWidget );
+
+ unsigned int pos = getChildPos( pChild );
+ if ( pos < maChildren.size() )
+ maChildren.erase( maChildren.begin()+pos );
+ pChild->mpParent = NULL;
+
+ return true;
+ }
+
+ bool swapWithChild( Widget *pChild )
+ {
+ if ( !pChild->isContainer() )
+ return false;
+
+ // remove all child's childrens, and try to add them here
+ removeChild( pChild );
+
+ // keep a copy for failure
+ std::vector< Widget *> aChildren = maChildren;
+ std::vector< Widget *> aChildChildren = pChild->maChildren;
+
+ for ( std::vector< Widget *>::const_iterator it = aChildChildren.begin();
+ it != aChildChildren.end(); ++it )
+ pChild->removeChild( *it );
+
+ for ( std::vector< Widget *>::const_iterator it = aChildChildren.begin();
+ it != aChildChildren.end(); ++it )
+ if ( !addChild( *it ) )
+ { // failure
+ for ( std::vector< Widget *>::const_iterator jt = aChildChildren.begin();
+ jt != it; ++jt )
+ removeChild( *jt );
+ for ( std::vector< Widget *>::const_iterator jt = aChildChildren.begin();
+ jt != aChildChildren.end(); ++jt )
+ pChild->addChild( *jt );
+ return false;
+ }
+
+ Widget *pParent = up();
+
+ if ( pParent )
+ {
+ pParent->removeChild( this );
+ pParent->addChild( pChild );
+ }
+ pChild->addChild( this );
+ return true;
+ }
+
+ unsigned int getChildPos( Widget *pChild )
+ {
+ int i = 0;
+ for ( std::vector< Widget *>::const_iterator it = maChildren.begin();
+ it != maChildren.end(); ++it, ++i )
+ if ( *it == pChild )
+ break;
+ return i;
+ }
+
+ Widget *getChild( int pos )
+ {
+ if ( pos >= 0 && pos < (signed) maChildren.size() )
+ return *(maChildren.begin() + pos);
+ return NULL;
+ }
+
+ bool isContainer()
+ { return mxContainer.is(); }
+ unsigned int getChildrenLen()
+ { return maChildren.size(); }
+
+ rtl::OUString getLabel() const
+ { return mrLabel; }
+ rtl::OUString getUnoName() const
+ { return mrUnoName; }
+
+ int getDepth()
+ {
+ int depth = 0;
+ for ( Widget *pWidget = mpParent; pWidget; pWidget = pWidget->mpParent )
+ depth++;
+ return depth;
+ }
+
+ enum PropertyKind {
+ WINDOW_PROPERTY, CONTAINER_PROPERTY, WINBITS_PROPERTY
+ };
+
+ static rtl::OUString findProperty( const PropList &props, rtl::OUString propName )
+ {
+ for ( PropList::const_iterator it = props.begin(); it != props.end(); ++it )
+ if ( it->first.equalsIgnoreAsciiCase( propName ) )
+ return it->second;
+#if DEBUG_PRINT
+ fprintf(stderr, "Serious error: property '%s' not found\n", OUSTRING_CSTR(propName));
+#endif
+ return rtl::OUString();
+ }
+
+ rtl::OUString getOriginalProperty( rtl::OUString rPropName, PropertyKind rKind )
+ {
+ rtl::OUString rValue;
+ switch ( rKind ) {
+ case WINDOW_PROPERTY:
+ rValue = findProperty( maOriProps, rPropName );
+ break;
+ case CONTAINER_PROPERTY:
+ rValue = findProperty( maOriChildProps, rPropName );
+ break;
+ case WINBITS_PROPERTY:
+ // TODO
+ break;
+ }
+
+ return rValue;
+ }
+
+ rtl::OUString getProperty( rtl::OUString rPropName, PropertyKind rKind )
+ {
+ rtl::OUString rValue;
+ switch ( rKind ) {
+ case WINDOW_PROPERTY:
+ rValue = anyToString( layoutimpl::prophlp::getProperty( mxWidget, rPropName ) );
+ break;
+ case CONTAINER_PROPERTY:
+ if ( mpParent )
+ rValue = anyToString( layoutimpl::prophlp::getProperty(
+ mpParent->mxContainer->getChildProperties( mxWidget ), rPropName ) );
+ break;
+ case WINBITS_PROPERTY:
+ // TODO
+ break;
+ }
+
+ return rValue;
+ }
+
+ bool isPropertyTouched( rtl::OUString propName, PropertyKind rKind )
+ {
+ rtl::OUString oriValue = getOriginalProperty( propName, rKind );
+ rtl::OUString newValue = getProperty( propName, rKind );
+ bool isTouched = oriValue != newValue;
+#if DEBUG_PRINT
+ fprintf(stderr, "is property '%s' touched? %s (%s vs %s)\n", OUSTRING_CSTR(propName), isTouched ? "yes" : "no", OUSTRING_CSTR(oriValue), OUSTRING_CSTR(newValue));
+#endif
+ return isTouched;
+ }
+
+ using LayoutWidget::setProperty;
+
+ void setProperty( rtl::OUString rPropName, PropertyKind rKind, uno::Any rValue )
+ {
+ switch ( rKind ) {
+ case WINDOW_PROPERTY:
+ layoutimpl::prophlp::setProperty( mxWidget, rPropName, rValue );
+ break;
+ case CONTAINER_PROPERTY:
+ if ( mpParent )
+ layoutimpl::prophlp::setProperty(
+ mpParent->mxContainer->getChildProperties( mxWidget ), rPropName, rValue );
+ break;
+ case WINBITS_PROPERTY:
+ // TODO
+ break;
+ }
+ }
+
+ struct PropertyIterator {
+ friend class Widget;
+ PropertyKind mrKind;
+ uno::Sequence< beans::Property > maProps;
+ int nPropIt;
+
+ PropertyIterator( Widget *pWidget, PropertyKind rKind )
+ : mrKind( rKind ), nPropIt( 0 )
+ {
+ switch ( rKind )
+ {
+ case WINDOW_PROPERTY:
+ if ( layoutimpl::prophlp::canHandleProps( pWidget->mxWidget ) )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo
+ = layoutimpl::prophlp::queryPropertyInfo( pWidget->mxWidget );
+ if ( !xInfo.is() )
+ return;
+
+ maProps = xInfo->getProperties();
+ }
+ break;
+ case CONTAINER_PROPERTY:
+ if ( pWidget->mpParent )
+ {
+ uno::Reference< beans::XPropertySet >xParentSet(
+ pWidget->mpParent->mxContainer->getChildProperties( pWidget->mxWidget ) );
+ if ( xParentSet.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( xParentSet->getPropertySetInfo() );
+ if ( xInfo.is() )
+ maProps = xInfo->getProperties();
+ }
+ }
+ break;
+ case WINBITS_PROPERTY:
+ // TODO
+ break;
+ }
+ }
+
+ bool hasNext()
+ {
+ return nPropIt < maProps.getLength();
+ }
+
+ beans::Property next()
+ {
+/* rtl::OUString propName, propValue;
+ propName = maProps[ nPropIt ];
+ propValue = getProperty( propName, mrKind, false);
+ nPropIt++;
+ return std::pair< rtl::OUString, rtl::OUString > propPair( propName, propValue );*/
+ return maProps[ nPropIt++ ];
+ }
+ };
+};
+
+class EditorRoot : public layoutimpl::LayoutRoot {
+ Widget *mpParent;
+
+public:
+ EditorRoot( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ Widget *pParent )
+ : layoutimpl::LayoutRoot( xFactory ), mpParent( pParent )
+ {
+ }
+
+ // generation
+ virtual layoutimpl::LayoutWidget *create( rtl::OUString id, const rtl::OUString unoName,
+ long attrbs, uno::Reference< awt::XLayoutContainer > xParent )
+ {
+ if ( unoName.compareToAscii( "dialog" ) == 0 )
+ return mpParent;
+
+ // TODO: go through specs to map unoName to a more human-readable label
+ Widget *pWidget = new Widget( id, mxToolkit, xParent, unoName, attrbs );
+ if ( !mxWindow.is() )
+ mxWindow = uno::Reference< awt::XWindow >( pWidget->getPeer(), uno::UNO_QUERY );
+
+ if ( pWidget->mxContainer.is() )
+ pWidget->mxContainer->setLayoutUnit( mpParent->mxContainer->getLayoutUnit() );
+
+ return pWidget;
+ }
+};
+
+/* Working with the layout in 1D, as if it was a flat list. */
+namespace FlatLayout
+{
+Widget *next( Widget *pWidget )
+{
+ Widget *pNext;
+ pNext = pWidget->down();
+ if ( pNext ) return pNext;
+ pNext = pWidget->next();
+ if ( pNext ) return pNext;
+ for ( Widget *pUp = pWidget->up(); pUp != NULL; pUp = pUp->up() )
+ if ( (pNext = pUp->next()) != NULL )
+ return pNext;
+ return NULL;
+}
+
+/*
+ Widget *prev( Widget *pWidget )
+ {
+ Widget *pPrev;
+ pPrev = pWidget->prev();
+ if ( !pPrev )
+ return pWidget->up();
+
+ Widget *pBottom = pPrev->down();
+ if ( pBottom )
+ {
+ while ( pBottom->down() || pBottom->next() )
+ {
+ for ( Widget *pNext = pBottom->next(); pNext; pNext = pNext->next() )
+ pBottom = pNext;
+ Widget *pDown = pBottom->down();
+ if ( pDown )
+ pBottom = pDown;
+ }
+ return pBottom;
+ }
+ return pPrev;
+ }
+*/
+
+bool moveWidget( Widget *pWidget, bool up /*or down*/ )
+{
+ // Keep child parent&pos for in case of failure
+ Widget *pOriContainer = pWidget->up();
+ unsigned int oriChildPos = pOriContainer->getChildPos( pWidget );
+
+ // Get parent&sibling before removing it, since relations get cut
+ Widget *pSibling = up ? pWidget->prev() : pWidget->next();
+ Widget *pContainer = pWidget->up();
+ if ( !pContainer )
+ return false;
+
+ // try to swap with parent or child
+ // We need to allow for this at least for the root node...
+ if ( !pSibling )
+ {
+ if ( up )
+ {
+ if ( pContainer->swapWithChild( pWidget ) )
+ return true;
+ }
+ else
+ {
+ }
+ }
+
+ pContainer->removeChild( pWidget );
+
+ // if has up sibling -- append to it, else swap with it
+ if ( pSibling )
+ {
+ if ( pSibling->addChild( pWidget, up ? 0xffff : 0 ) )
+ return true;
+
+ unsigned int childPos = pContainer->getChildPos( pSibling );
+ if ( pContainer->addChild( pWidget, childPos + (up ? 0 : 1) ) )
+ return true; // should always be succesful
+ }
+ // go through parents -- try to get prepended to them
+ else
+ {
+ for ( ; pContainer && pContainer->up(); pContainer = pContainer->up() )
+ {
+ unsigned int childPos = pContainer->up()->getChildPos( pContainer );
+ if ( pContainer->up()->addChild( pWidget, childPos + (up ? 0 : 1) ) )
+ return true;
+ }
+ }
+
+ // failed -- try to get it to its old position
+ if ( !pOriContainer->addChild( pWidget, oriChildPos ) )
+ {
+ // a parent should never reject a child back. but if it ever
+ // happens, just kill it, we don't run an orphanate here ;P
+ delete pWidget;
+ return true;
+ }
+ return false;
+}
+
+// NOTE: root is considered to be number -1
+Widget *get( Widget *pRoot, int nb )
+{
+ Widget *it;
+ for ( it = pRoot; it != NULL && nb >= 0; it = next( it ) )
+ nb--;
+ return it;
+}
+
+int get( Widget *pRoot, Widget *pWidget )
+{
+ int nRet = -1;
+ Widget *it;
+ for ( it = pRoot; it != NULL && it != pWidget; it = next( it ) )
+ nRet++;
+ return nRet;
+}
+}
+
+//** PropertiesList widget
+
+class PropertiesList : public layout::Table
+{
+ class PropertyEntry
+ {
+ friend class PropertiesList;
+
+ /* wrapper between the widget and Any */
+ struct AnyWidget
+ {
+ DECL_LINK( ApplyPropertyHdl, layout::Window* );
+ DECL_LINK( FlagToggledHdl, layout::CheckBox* );
+
+ AnyWidget( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind )
+ : mpWidget( pWidget ), maPropName( aPropName ), maPropKind( aPropKind )
+ {
+ mpFlag = 0;
+ mbBlockFlagCallback = false;
+ bFirstGet = true;
+ }
+
+ virtual ~AnyWidget()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "~AnyWidget\n");
+#endif
+ }
+
+ void save( uno::Any aValue )
+ {
+ mpWidget->setProperty( maPropName, maPropKind, aValue );
+ checkProperty();
+ }
+
+ void checkProperty()
+ {
+ bool flag = mpWidget->isPropertyTouched( maPropName, maPropKind );
+
+ if ( mpFlag && mpFlag->IsChecked() != (BOOL)flag )
+ {
+ CheckFlag( flag, true );
+ }
+ }
+
+ void CheckFlag( bool bValue, bool bBlockCallback )
+ {
+ if ( bBlockCallback )
+ mbBlockFlagCallback = true;
+ mpFlag->Check( bValue );
+ mbBlockFlagCallback = false;
+ }
+
+ bool bFirstGet; // HACK
+ rtl::OUString getValue()
+ {
+// return mpWidget->getOriProperty( maPropName );
+ rtl::OUString value;
+ if ( bFirstGet ) // king of ugliness
+ value = mpWidget->getProperty( maPropName, maPropKind );
+ else
+ value = mpWidget->getOriginalProperty( maPropName, maPropKind );
+ bFirstGet = false;
+ return value;
+ }
+
+ // FIXME: wrapper should have a base class for this...
+ virtual layout::Window *getWindow() = 0;
+ virtual layout::Container *getContainer() { return NULL; }
+
+ virtual void load() = 0;
+ virtual void store() = 0;
+
+ Widget *mpWidget;
+ rtl::OUString maPropName;
+ Widget::PropertyKind maPropKind;
+ layout::CheckBox *mpFlag;
+ bool mbBlockFlagCallback;
+ };
+
+ struct AnyEdit : public AnyWidget, layout::HBox
+ {
+ layout::Edit *mpEdit;
+ bool mbMultiLine;
+ layout::PushButton *mpExpand;
+ DECL_LINK( ExpandEditHdl, layout::PushButton* );
+
+ // so we can create widgets (like transforming the Edit into a
+ // MultiLineEdit)
+ layout::Window *mpWinParent;
+
+ AnyEdit( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, layout::Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), layout::HBox( 0, false ), mpWinParent( pWinParent )
+ {
+ mpEdit = NULL;
+ mpExpand = new layout::PushButton( pWinParent, WB_TOGGLE );
+ mpExpand->SetToggleHdl( LINK( this, AnyEdit, ExpandEditHdl ) );
+ setAsMultiLine( false );
+
+ load();
+ }
+
+ virtual ~AnyEdit()
+ {
+ delete mpEdit;
+ delete mpExpand;
+ }
+
+ virtual layout::Window *getWindow()
+ { return NULL; }
+ virtual layout::Container *getContainer()
+ { return this; }
+
+ void setAsMultiLine( bool bMultiLine )
+ {
+ Clear();
+ XubString text;
+ if ( mpEdit )
+ {
+ text = mpEdit->GetText();
+ printf("Remove mpEdit and expand\n");
+ Remove( mpEdit );
+ Remove( mpExpand );
+ delete mpEdit;
+ }
+
+ if ( bMultiLine )
+ {
+ mpEdit = new layout::Edit( mpWinParent, WB_BORDER );
+ mpExpand->SetText( String::CreateFromAscii( "-" ) );
+ }
+ else
+ {
+ mpEdit = new layout::Edit( mpWinParent, WB_BORDER );
+ mpExpand->SetText( String::CreateFromAscii( "+" ) );
+ }
+
+ mpEdit->SetText( text );
+ mpEdit->SetModifyHdl( LINK( this, AnyEdit, ApplyPropertyHdl ) );
+
+ Add( mpEdit, true, true, 0 );
+ Add( mpExpand, false, true, 0 );
+
+ mbMultiLine = bMultiLine;
+ }
+
+ virtual void load()
+ {
+ mpEdit->SetText( getValue() );
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+ save( uno::makeAny( (rtl::OUString) mpEdit->GetText() ) );
+ }
+ };
+
+ struct AnyInteger : public AnyWidget, NumericField
+ {
+ AnyInteger( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), NumericField( pWinParent, WB_SPIN|WB_BORDER )
+ {
+ load();
+ SetModifyHdl( LINK( this, AnyInteger, ApplyPropertyHdl ) );
+ }
+
+ virtual Window *getWindow()
+ { return this; }
+
+ virtual void load()
+ {
+ OUString text = getValue();
+ SetText( text.getStr() );
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "store number: %ld\n", rtl::OUString( GetText() ).toInt64());
+#endif
+ save( uno::makeAny( rtl::OUString( GetText() ).toInt64() ) );
+ }
+ };
+
+ struct AnyFloat : public AnyInteger
+ {
+ AnyFloat( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyInteger( pWidget, aPropName, aPropKind, pWinParent )
+ {}
+
+ virtual void store()
+ {
+ save( uno::makeAny( rtl::OUString( GetText() ).toDouble() ) );
+ }
+ };
+
+ struct AnyCheckBox : public AnyWidget, layout::CheckBox
+ {
+ AnyCheckBox( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, layout::Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), layout::CheckBox( pWinParent )
+ {
+ // adding some whitespaces to make the hit area larger
+// SetText( String::CreateFromAscii( "" ) );
+ load();
+ SetToggleHdl( LINK( this, AnyWidget, ApplyPropertyHdl ) );
+ }
+
+ virtual ~AnyCheckBox()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "~AnyCheckBox\n");
+#endif
+ }
+
+ virtual layout::Window *getWindow()
+ { return this; }
+
+ virtual void load()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "loading boolean value\n");
+#endif
+ Check( getValue().toInt64() != 0 );
+ setLabel();
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+ save( uno::makeAny( IsChecked() ) );
+ setLabel();
+ }
+
+ void setLabel()
+ {
+ SetText( String::CreateFromAscii( IsChecked() ? "true" : "false" ) );
+ }
+ };
+
+ struct AnyListBox : public AnyWidget, layout::ListBox
+ {
+ AnyListBox( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), layout::ListBox( pWinParent, WB_DROPDOWN )
+ {
+ SetSelectHdl( LINK( this, AnyWidget, ApplyPropertyHdl ) );
+ }
+
+ virtual layout::Window *getWindow()
+ { return this; }
+
+ virtual void load()
+ {
+ SelectEntryPos( sal::static_int_cast< USHORT >( getValue().toInt32() ) );
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+ save( uno::makeAny( (short) GetSelectEntryPos() ) );
+ }
+ };
+
+ struct AnyAlign : public AnyListBox
+ {
+ AnyAlign( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyListBox( pWidget, aPropName, aPropKind, pWinParent )
+ {
+ InsertEntry( XubString::CreateFromAscii( "Left" ) );
+ InsertEntry( XubString::CreateFromAscii( "Center" ) );
+ InsertEntry( XubString::CreateFromAscii( "Right" ) );
+ load();
+ }
+ };
+
+ /* AnyListBox and AnyComboBox different in that a ComboBox allows the user
+ to add other options, operating in strings, instead of constants.
+ (its more like a suggestive AnyEdit) */
+ struct AnyComboBox : public AnyWidget, layout::ComboBox
+ {
+ AnyComboBox( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), layout::ComboBox( pWinParent, WB_DROPDOWN )
+ {
+ SetModifyHdl( LINK( this, AnyComboBox, ApplyPropertyHdl ) );
+ }
+
+ virtual layout::Window *getWindow()
+ { return this; }
+
+ virtual void load()
+ {
+ SetText( getValue() );
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+ save( uno::makeAny( (rtl::OUString) GetText() ) );
+ }
+ };
+
+ struct AnyFontStyle : public AnyComboBox
+ {
+ AnyFontStyle( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyComboBox( pWidget, aPropName, aPropKind, pWinParent )
+ {
+ InsertEntry( XubString::CreateFromAscii( "Bold" ) );
+ InsertEntry( XubString::CreateFromAscii( "Italic" ) );
+ InsertEntry( XubString::CreateFromAscii( "Bold Italic" ) );
+ InsertEntry( XubString::CreateFromAscii( "Fett" ) );
+ load();
+ }
+ };
+
+ layout::FixedText *mpLabel;
+ layout::CheckBox *mpFlag;
+ AnyWidget *mpValue;
+
+ public:
+ PropertyEntry( layout::Window *pWinParent, AnyWidget *pAnyWidget )
+ {
+ mpLabel = new layout::FixedText( pWinParent );
+ {
+ // append ':' to aPropName
+ rtl::OUStringBuffer buf( pAnyWidget->maPropName );
+ buf.append( sal_Unicode (':') );
+ mpLabel->SetText( buf.makeStringAndClear() );
+ }
+ mpValue = pAnyWidget;
+ mpFlag = new layout::CheckBox( pWinParent );
+ mpFlag->SetToggleHdl( LINK( mpValue, AnyWidget, FlagToggledHdl ) );
+ mpValue->mpFlag = mpFlag;
+ }
+
+ ~PropertyEntry()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "REMOVING label, flag and value\n");
+#endif
+ delete mpLabel;
+ delete mpFlag;
+ delete mpValue;
+ }
+
+ // Use this factory rather than the constructor -- check for NULL
+ static PropertyEntry *construct( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, sal_uInt16 nType,
+ layout::Window *pWinParent )
+ {
+ AnyWidget *pAnyWidget;
+ switch (nType) {
+ case uno::TypeClass_STRING:
+ if ( aPropName.compareToAscii( "FontStyleName" ) == 0 )
+ {
+ pAnyWidget = new AnyFontStyle( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ }
+ pAnyWidget = new AnyEdit( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ case uno::TypeClass_SHORT:
+ if ( aPropName.compareToAscii( "Align" ) == 0 )
+ {
+ pAnyWidget = new AnyAlign( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ }
+ // otherwise, treat as any other number...
+ case uno::TypeClass_LONG:
+ case uno::TypeClass_UNSIGNED_LONG:
+ pAnyWidget = new AnyInteger( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ case uno::TypeClass_FLOAT:
+ case uno::TypeClass_DOUBLE:
+ pAnyWidget = new AnyFloat( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ case uno::TypeClass_BOOLEAN:
+ pAnyWidget = new AnyCheckBox( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ default:
+ return NULL;
+ }
+ return new PropertyEntry( pWinParent, pAnyWidget );
+ }
+ };
+
+ layout::Window *mpParentWindow;
+
+ std::list< PropertyEntry* > maPropertiesList;
+ layout::FixedLine *mpSeparator;
+
+ // some properties are obscure, or simply don't make sense in this
+ // context. Let's just ignore them.
+ // Maybe we could offer them in an expander or something...
+ static bool toIgnore( rtl::OUString prop )
+ {
+ // binary search -- keep the list sorted alphabetically
+ static char const *toIgnoreList[] = {
+ "DefaultControl", "FocusOnClick", "FontCharWidth", "FontCharset",
+ "FontEmphasisMark", "FontFamily", "FontHeight", "FontKerning", "FontName",
+ "FontOrientation", "FontPitch", "FontRelief", "FontSlant", "FontStrikeout",
+ "FontType", "FontWordLineMode", "HelpText", "HelpURL", "MultiLine",
+ "Printable", "Repeat", "RepeatDelay", "Tabstop"
+ };
+
+ int min = 0, max = sizeof( toIgnoreList )/sizeof( char * ) - 1, mid, cmp;
+ do {
+ mid = min + (max - min)/2;
+ cmp = prop.compareToAscii( toIgnoreList[ mid ] );
+ if ( cmp > 0 )
+ min = mid+1;
+ else if ( cmp < 0 )
+ max = mid-1;
+ else
+ return true;
+ } while ( min <= max );
+ return false;
+ }
+
+public:
+ PropertiesList( layout::Dialog *dialog )
+ : layout::Table( dialog, "properties-box" )
+ , mpParentWindow( dialog ), mpSeparator( 0 )
+ {
+ }
+
+ ~PropertiesList()
+ {
+ clear();
+ }
+
+private:
+ // auxiliary, add properties from the peer to the list
+ void addProperties( Widget *pWidget, Widget::PropertyKind rKind )
+ {
+ Widget::PropertyIterator it( pWidget, rKind );
+ while ( it.hasNext() )
+ {
+ beans::Property prop = it.next();
+ rtl::OUString name( prop.Name );
+ if ( toIgnore( name ) )
+ continue;
+ sal_uInt16 type = static_cast< sal_uInt16 >( prop.Type.getTypeClass() );
+
+ PropertyEntry *propEntry = PropertyEntry::construct(
+ pWidget, name, rKind, type, mpParentWindow );
+
+ if ( propEntry )
+ {
+ Add( propEntry->mpLabel, false, false );
+
+ // HACK: one of these will return Null...
+ Add( propEntry->mpValue->getWindow(), true, false );
+ Add( propEntry->mpValue->getContainer(), true, false );
+
+ Add( propEntry->mpFlag, false, false );
+ maPropertiesList.push_back( propEntry );
+ }
+ }
+ }
+
+public:
+ void selectedWidget( Widget *pWidget )
+ {
+ clear();
+
+ if ( !pWidget )
+ return;
+
+ addProperties( pWidget, Widget::CONTAINER_PROPERTY );
+
+ mpSeparator = new layout::FixedLine( mpParentWindow );
+ // TODO: we may want to have to separate list widgets here...
+ Add( mpSeparator, false, false, 3, 1 );
+
+ addProperties( pWidget, Widget::WINDOW_PROPERTY );
+
+ ShowAll( true );
+ }
+
+ void clear()
+ {
+ ///FIXME: crash
+ Container::Clear();
+
+ for ( std::list< PropertyEntry* >::iterator it = maPropertiesList.begin();
+ it != maPropertiesList.end(); ++it)
+ delete *it;
+ maPropertiesList.clear();
+
+ delete mpSeparator;
+ mpSeparator = NULL;
+ }
+};
+
+IMPL_LINK( PropertiesList::PropertyEntry::AnyWidget, ApplyPropertyHdl, layout::Window *, pWin )
+{
+ (void) pWin;
+ store();
+ return 0;
+}
+
+IMPL_LINK( PropertiesList::PropertyEntry::AnyWidget, FlagToggledHdl, layout::CheckBox *, pCheck )
+{
+#if DEBUG_PRINT
+ fprintf(stderr, "Property flag pressed -- is: %d\n", pCheck->IsChecked());
+#endif
+ if ( !mbBlockFlagCallback )
+ {
+ bool checked = pCheck->IsChecked();
+ if ( !checked ) // revert
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "revert\n");
+#endif
+ load();
+ }
+ else
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "user can't dirty the flag!\n");
+#endif
+ // User can't flag the property as dirty
+ // Actually, we may want to allow the designer to force a property to be stored.
+ // Could be useful when the default value of some new property wasn't yet decided...
+ CheckFlag( false, true );
+ }
+ }
+#if DEBUG_PRINT
+ else
+ fprintf(stderr, "Property flag pressed -- BLOCKED\n");
+#endif
+ return 0;
+}
+
+IMPL_LINK( PropertiesList::PropertyEntry::AnyEdit, ExpandEditHdl, layout::PushButton *, pBtn )
+{
+ setAsMultiLine( pBtn->IsChecked() );
+ return 0;
+}
+
+//** SortListBox auxiliary widget
+
+class SortListBox
+{ // For a manual sort ListBox; asks for a ListBox and Up/Down/Remove
+ // buttons to wrap
+ DECL_LINK( ItemSelectedHdl, layout::ListBox* );
+ DECL_LINK( UpPressedHdl, layout::Button* );
+ DECL_LINK( DownPressedHdl, layout::Button* );
+ DECL_LINK( RemovePressedHdl, layout::Button* );
+ layout::PushButton *mpUpButton, *mpDownButton, *mpRemoveButton;
+
+protected:
+ layout::ListBox *mpListBox;
+
+ virtual void upPressed( USHORT nPos )
+ {
+ XubString str = mpListBox->GetSelectEntry();
+ mpListBox->RemoveEntry( nPos );
+ nPos = mpListBox->InsertEntry( str, nPos-1 );
+ mpListBox->SelectEntryPos( nPos );
+ }
+
+ virtual void downPressed( USHORT nPos )
+ {
+ XubString str = mpListBox->GetSelectEntry();
+ mpListBox->RemoveEntry( nPos );
+ nPos = mpListBox->InsertEntry( str, nPos+1 );
+ mpListBox->SelectEntryPos( nPos );
+ }
+
+ virtual void removePressed( USHORT nPos )
+ {
+ mpListBox->RemoveEntry( nPos );
+ }
+
+ virtual void itemSelected( USHORT nPos )
+ {
+ // if we had some XLayoutContainer::canAdd() or maxChildren() function
+ // we could make a function to check if we can move selected and enable/
+ // /disable the move buttons as appropriate
+
+ if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ {
+ mpUpButton->Disable();
+ mpDownButton->Disable();
+ mpRemoveButton->Disable();
+ }
+ else
+ {
+ mpUpButton->Enable();
+ mpDownButton->Enable();
+ mpRemoveButton->Enable();
+ }
+ }
+
+public:
+ SortListBox( layout::ListBox *pListBox, layout::PushButton *pUpButton, layout::PushButton *pDownButton,
+ layout::PushButton *pRemoveButton )
+ : mpUpButton( pUpButton), mpDownButton( pDownButton), mpRemoveButton( pRemoveButton ),
+ mpListBox( pListBox )
+ {
+ mpListBox->SetSelectHdl( LINK( this, SortListBox, ItemSelectedHdl ) );
+
+ mpUpButton->SetModeImage( layout::Image ( "res/commandimagelist/lc_moveup.png" ) );
+ mpUpButton->SetImageAlign( IMAGEALIGN_LEFT );
+ mpUpButton->SetClickHdl( LINK( this, SortListBox, UpPressedHdl ) );
+
+ mpDownButton->SetModeImage( layout::Image ( "res/commandimagelist/lc_movedown.png" ) );
+ mpDownButton->SetImageAlign( IMAGEALIGN_LEFT );
+ mpDownButton->SetClickHdl( LINK( this, SortListBox, DownPressedHdl ) );
+
+ // "res/commandimagelist/lch_delete.png", "res/commandimagelist/lc_delete.png"
+ mpRemoveButton->SetModeImage( layout::Image ( "res/commandimagelist/sc_closedoc.png" ) );
+ mpRemoveButton->SetImageAlign( IMAGEALIGN_LEFT );
+ mpRemoveButton->SetClickHdl( LINK( this, SortListBox, RemovePressedHdl ) );
+
+ // fire an un-select event
+ itemSelected( LISTBOX_ENTRY_NOTFOUND );
+ }
+
+ virtual ~SortListBox();
+};
+
+SortListBox::~SortListBox()
+{
+ delete mpListBox;
+ delete mpUpButton;
+ delete mpDownButton;
+ delete mpRemoveButton;
+}
+
+IMPL_LINK( SortListBox, UpPressedHdl, layout::Button *, pBtn )
+{
+ (void) pBtn;
+ USHORT pos = mpListBox->GetSelectEntryPos();
+ if ( pos > 0 && pos != LISTBOX_ENTRY_NOTFOUND )
+ upPressed( pos );
+ return 0;
+}
+
+IMPL_LINK( SortListBox, DownPressedHdl, layout::Button *, pBtn )
+{
+ (void) pBtn;
+ USHORT pos = mpListBox->GetSelectEntryPos();
+ if ( pos < mpListBox->GetEntryCount() && pos != LISTBOX_ENTRY_NOTFOUND )
+ downPressed( pos );
+ return 0;
+}
+
+IMPL_LINK( SortListBox, RemovePressedHdl, layout::Button *, pBtn )
+{
+ (void) pBtn;
+ USHORT pos = mpListBox->GetSelectEntryPos();
+ if ( pos != LISTBOX_ENTRY_NOTFOUND )
+ removePressed( pos );
+ return 0;
+}
+
+IMPL_LINK( SortListBox, ItemSelectedHdl, layout::ListBox *, pList )
+{
+ (void) pList;
+ USHORT pos = mpListBox->GetSelectEntryPos();
+ itemSelected( pos );
+ return 0;
+}
+
+//** LayoutTree widget
+
+class LayoutTree : public SortListBox
+{
+public:
+ struct Listener
+ {
+ virtual void widgetSelected( Widget *pWidget ) = 0;
+ };
+
+private:
+ Listener *mpListener;
+
+public:
+ Widget *mpRootWidget;
+
+ LayoutTree( layout::Dialog *dialog )
+ : SortListBox( new layout::ListBox( dialog, "layout-tree" ),
+ new layout::PushButton( dialog, "layout-up-button" ),
+ new layout::PushButton( dialog, "layout-down-button" ),
+ new layout::PushButton( dialog, "layout-remove-button" ) )
+ {
+ layout::PeerHandle handle = dialog->GetPeerHandle( "preview-box" );
+ uno::Reference< awt::XLayoutConstrains > xWidget( handle, uno::UNO_QUERY );
+ mpRootWidget = new Widget( xWidget, "root" );
+ }
+
+ virtual ~LayoutTree();
+
+ Widget *getWidget( int nPos )
+ {
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return FlatLayout::get( mpRootWidget, nPos );
+ return NULL;
+ }
+
+ Widget *getSelectedWidget()
+ {
+ Widget *pWidget = getWidget( mpListBox->GetSelectEntryPos() );
+ if ( !pWidget ) // return root, if none selected
+ pWidget = mpRootWidget;
+ return pWidget;
+ }
+
+ void selectWidget( Widget *pWidget )
+ {
+ int pos = FlatLayout::get( mpRootWidget, pWidget );
+ if ( pos == -1 )
+ // if asked to select hidden root, select visible root
+ pos = 0;
+ mpListBox->SelectEntryPos( sal::static_int_cast< USHORT >( pos ) );
+ }
+
+ void rebuild()
+ {
+ struct inner
+ {
+ // pads a string with whitespaces
+ static rtl::OUString padString( rtl::OUString name, int depth )
+ {
+ rtl::OStringBuffer aBuf( depth * 4 + name.getLength() + 2 );
+ for (int i = 0; i < depth; i++)
+ aBuf.append( " " );
+ aBuf.append( rtl::OUStringToOString( name, RTL_TEXTENCODING_ASCII_US ) );
+ return rtl::OUString( aBuf.getStr(), aBuf.getLength(),
+ RTL_TEXTENCODING_UTF8 );
+ }
+ };
+
+ mpListBox->Clear();
+ for ( Widget *i = FlatLayout::next( mpRootWidget ); i; i = FlatLayout::next( i ) )
+ mpListBox->InsertEntry( inner::padString( i->getLabel(), i->getDepth()-1 ) );
+
+ // any selection, no longer is. ListBox doesn't fire the event on this case;
+ // force it.
+ itemSelected( LISTBOX_ENTRY_NOTFOUND );
+ }
+
+ void setListener( Listener *pListener )
+ { mpListener = pListener; }
+
+ // print in XML format...
+
+ static rtl::OUString toXMLNaming (const rtl::OUString &string)
+ {
+ rtl::OUStringBuffer buffer (string.getLength());
+ sal_Unicode *str = string.pData->buffer;
+ for (int i = 0; i < string.getLength(); i++) {
+ if ( str[i] >= 'A' && str[i] <= 'Z' )
+ {
+ if ( i > 0 )
+ buffer.append ((sal_Unicode) '-');
+ buffer.append ((sal_Unicode) (str[i] - 'A' + 'a'));
+ }
+ else
+ buffer.append ((sal_Unicode) str[i]);
+ }
+
+ return buffer.makeStringAndClear();
+ }
+
+ void print()
+ {
+ printf("\t\tExport:\n");
+ printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<dialog xmlns=\"http://openoffice.org/2007/layout\"\n"
+ " xmlns:cnt=\"http://openoffice.org/2007/layout/container\"\n"
+ " id=\"dialog\" title=\"Unnamed\" sizeable=\"true\" >\n");
+
+ for ( Widget *i = FlatLayout::next( mpRootWidget ); i; i = FlatLayout::next( i ) )
+ {
+ for ( int d = i->getDepth(); d > 0; d-- )
+ printf(" ");
+ printf("<%s ", OUSTRING_CSTR( i->getUnoName() ) );
+
+ for ( int kind = 0; kind < 2; kind++ )
+ {
+ Widget::PropertyKind wKind = kind == 0 ? Widget::WINDOW_PROPERTY
+ : Widget::CONTAINER_PROPERTY;
+ Widget::PropertyIterator it( i, wKind );
+ while ( it.hasNext() )
+ {
+ beans::Property prop = it.next();
+ if ( !i->isPropertyTouched( prop.Name, wKind ) )
+ continue;
+
+ rtl::OUString value = i->getProperty( prop.Name, wKind );
+ if ( prop.Type.getTypeClass() == uno::TypeClass_BOOLEAN )
+ {
+ if ( value.compareToAscii( "0" ) )
+ value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("false") );
+ else
+ value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("true") );
+ }
+
+ if ( value.getLength() > 0 )
+ printf("%s%s=\"%s\" ",
+ kind == 0 ? "" : "cnt:",
+ OUSTRING_CSTR( toXMLNaming( prop.Name ) ), OUSTRING_CSTR( value )
+ );
+
+ }
+ }
+ printf("/>\n");
+ }
+ printf("</dialog>\n");
+ }
+
+protected:
+ virtual void upPressed( USHORT nPos )
+ {
+ Widget *pWidget = getWidget( nPos );
+ if ( FlatLayout::moveWidget( pWidget, true ) )
+ rebuild();
+ selectWidget( pWidget );
+ }
+
+ virtual void downPressed( USHORT nPos )
+ {
+ Widget *pWidget = getWidget( nPos );
+ if ( FlatLayout::moveWidget( pWidget, false ) )
+ rebuild();
+ selectWidget( pWidget );
+ }
+
+ virtual void removePressed( USHORT nPos )
+ {
+ Widget *pWidget = getWidget( nPos );
+ if ( pWidget )
+ {
+ pWidget->up()->removeChild( pWidget );
+ delete pWidget;
+ rebuild();
+ }
+ }
+
+ virtual void itemSelected( USHORT nPos )
+ {
+ mpListener->widgetSelected( getWidget( nPos ) );
+ SortListBox::itemSelected( nPos );
+ }
+};
+
+LayoutTree::~LayoutTree()
+{
+ delete mpRootWidget;
+}
+
+//** EditorImpl
+
+class EditorImpl : public LayoutTree::Listener
+{
+ void createWidget( const char *unoName );
+
+ PropertiesList *mpPropertiesList;
+ LayoutTree *mpLayoutTree;
+
+ layout::PushButton *pImportButton, *pExportButton;
+#ifdef FILEDLG
+ FileDialog *pImportDialog;
+#endif
+ DECL_LINK( ImportButtonHdl, layout::PushButton* );
+ DECL_LINK( ExportButtonHdl, layout::PushButton* );
+#ifdef FILEDLG
+ DECL_LINK( ImportDialogHdl, FileDialog* );
+#endif
+
+ // framework stuff
+ uno::Reference< lang::XMultiServiceFactory > mxFactory;
+ uno::Reference< awt::XToolkit > mxToolkit;
+ uno::Reference< awt::XWindow > mxToplevel;
+
+ virtual void widgetSelected( Widget *pWidget );
+ DECL_LINK( CreateWidgetHdl, layout::Button* );
+
+ std::list< layout::PushButton *> maCreateButtons;
+
+public:
+
+ EditorImpl( layout::Dialog *dialog,
+ // we should probable open this channel (or whatever its called) ourselves
+ uno::Reference< lang::XMultiServiceFactory > xMSF );
+ virtual ~EditorImpl();
+
+ void loadFile( const rtl::OUString &aTestFile );
+};
+
+EditorImpl::EditorImpl( layout::Dialog *dialog,
+ uno::Reference< lang::XMultiServiceFactory > xFactory )
+ : mxFactory( xFactory )
+ , mxToplevel( dialog->GetPeerHandle( "dialog" ), uno::UNO_QUERY )
+ // FIXME: any of these should work
+ //dialog->getContext()->getRoot(), uno::UNO_QUERY )
+ // dialog->GetPeer(), uno::UNO_QUERY )
+{
+#if DEBUG_PRINT
+ fprintf (stderr, "EditorImpl()\n");
+#endif
+ // framework
+ mxToolkit = uno::Reference< awt::XToolkit >(
+ mxFactory->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ),
+ uno::UNO_QUERY );
+ OSL_ASSERT( mxToolkit.is() );
+
+ // custom widgets
+#if DEBUG_PRINT
+ fprintf (stderr, "custom widgets\n");
+#endif
+ mpPropertiesList = new PropertiesList( dialog );
+
+ mpLayoutTree = new LayoutTree( dialog );
+ mpLayoutTree->setListener( this );
+
+/* if ( xImport.is() )
+ mpLayoutTree->getWidget( -1 )->addChild( new Widget( xImport, "import" ) );*/
+
+ // create buttons
+ layout::Container aWidgets( dialog, "create-widget" );
+ layout::Container aContainers( dialog, "create-container" );
+ for ( int i = 0; i < WIDGETS_SPECS_LEN; i++ )
+ {
+ layout::PushButton *pBtn = new layout::PushButton( (layout::Window *) dialog );
+ pBtn->SetText( rtl::OUString::createFromAscii( WIDGETS_SPECS[ i ].pLabel ) );
+ pBtn->SetClickHdl( LINK( this, EditorImpl, CreateWidgetHdl ) );
+ if ( WIDGETS_SPECS[ i ].pIconName != NULL )
+ {
+ rtl::OString aPath ("res/commandimagelist/");
+ aPath += WIDGETS_SPECS[ i ].pIconName;
+ layout::Image aImg( aPath );
+ pBtn->SetModeImage( aImg );
+ pBtn->SetImageAlign( IMAGEALIGN_LEFT );
+ }
+ pBtn->Show();
+ maCreateButtons.push_back( pBtn );
+ layout::Container *pBox = WIDGETS_SPECS[ i ].bIsContainer ? &aContainers : &aWidgets;
+ pBox->Add( pBtn );
+ }
+
+#ifdef FILEDLG
+ fprintf(stderr,"creating file dialog\n");
+ pImportDialog = new FileDialog( NULL/*(layout::Window *) dialog*/, 0 );
+ fprintf(stderr,"connecting it\n");
+ pImportDialog->SetFileSelectHdl( LINK( this, EditorImpl, ImportDialogHdl ) );
+ fprintf(stderr,"done file dialog\n");
+#endif
+
+/* pImportButton = new layout::PushButton( dialog, "import-button" );
+ pImportButton->SetClickHdl( LINK( this, EditorImpl, ImportButtonHdl ) );*/
+ pExportButton = new layout::PushButton( dialog, "export-button" );
+ pExportButton->SetClickHdl( LINK( this, EditorImpl, ExportButtonHdl ) );
+}
+
+EditorImpl::~EditorImpl()
+{
+ delete mpPropertiesList;
+ delete mpLayoutTree;
+ for ( std::list< layout::PushButton * >::const_iterator i = maCreateButtons.begin();
+ i != maCreateButtons.end(); ++i)
+ delete *i;
+ delete pImportButton;
+ delete pExportButton;
+#ifdef FILEDLG
+ delete pImportDialog;
+#endif
+}
+
+void EditorImpl::loadFile( const rtl::OUString &aTestFile )
+{
+ fprintf( stderr, "TEST: layout instance\n" );
+ uno::Reference< awt::XLayoutRoot > xRoot
+ ( new EditorRoot( mxFactory, mpLayoutTree->mpRootWidget ) );
+
+/*
+ mxMSF->createInstance
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Layout")) ),
+ uno::UNO_QUERY );
+*/
+ if ( !xRoot.is() )
+ {
+ throw uno::RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("could not create awt Layout component!") ),
+ uno::Reference< uno::XInterface >() );
+ }
+
+#if DEBUG_PRINT
+ fprintf( stderr, "TEST: initing root\n" );
+#endif
+
+ uno::Reference< lang::XInitialization > xInit( xRoot, uno::UNO_QUERY );
+ if ( !xInit.is() )
+ {
+ throw uno::RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Layout has no XInitialization!") ),
+ uno::Reference< uno::XInterface >() );
+ }
+
+#if DEBUG_PRINT
+ fprintf( stderr, "TEST: running parser\n" );
+#endif
+ uno::Sequence< uno::Any > aParams( 1 );
+ aParams[0] <<= aTestFile;
+#if DEBUG_PRINT
+ fprintf( stderr, "TEST: do it\n" );
+#endif
+ xInit->initialize( aParams );
+#if DEBUG_PRINT
+ fprintf( stderr, "TEST: file loaded\n" );
+#endif
+
+ mpLayoutTree->rebuild();
+}
+
+void EditorImpl::createWidget( const char *name )
+{
+ Widget *pWidget = mpLayoutTree->getSelectedWidget();
+
+ Widget *pChild = new Widget( rtl::OUString(), mxToolkit, uno::Reference< awt::XLayoutContainer >( mxToplevel, uno::UNO_QUERY ), rtl::OUString::createFromAscii( name ), awt::WindowAttribute::SHOW );
+ if ( !pWidget->addChild( pChild ) )
+ {
+ delete pChild;
+ // we may want to popup an error message
+ }
+ else
+ {
+ mpLayoutTree->rebuild();
+ mpLayoutTree->selectWidget( pWidget );
+ }
+}
+
+void EditorImpl::widgetSelected( Widget *pWidget )
+{
+ // we know can't add widget to a non-container, so let's disable the create
+ // buttons then. Would be nice to have a method to check if a container is
+ // full as well...
+ if ( !pWidget || pWidget->isContainer() )
+ {
+ for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin();
+ it != maCreateButtons.end(); ++it)
+ (*it)->Enable();
+ }
+ else
+ {
+ for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin();
+ it != maCreateButtons.end(); ++it)
+ (*it)->Disable();
+ }
+
+ mpPropertiesList->selectedWidget( pWidget );
+}
+
+IMPL_LINK( EditorImpl, CreateWidgetHdl, layout::Button *, pBtn )
+{
+ int i = 0;
+ for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin();
+ it != maCreateButtons.end(); ++it, ++i )
+ {
+ if ( pBtn == *it )
+ break;
+ }
+ OSL_ASSERT( i < WIDGETS_SPECS_LEN );
+ createWidget( WIDGETS_SPECS[i].pName );
+ return 0;
+}
+
+IMPL_LINK( EditorImpl, ImportButtonHdl, layout::PushButton *, pBtn )
+{
+ (void) pBtn;
+#if DEBUG_PRINT
+ fprintf(stderr, "IMPORT!\n");
+#endif
+#ifdef FILEDLG
+ pImportDialog->Execute();
+#endif
+
+ return 0;
+}
+
+#ifdef FILEDLG
+IMPL_LINK( EditorImpl, ImportDialogHdl, FileDialog *, pDialog )
+{
+ UniString path = pDialog->GetPath();
+//fprintf(stderr, "Executing import dialog!\n");
+
+#if DEBUG_PRINT
+ fprintf(stderr, "got import file: %s\n",rtl::OUStringToOString( path, RTL_TEXTENCODING_ASCII_US ).getStr() );
+#endif
+
+ return 0;
+}
+#endif
+
+IMPL_LINK( EditorImpl, ExportButtonHdl, layout::PushButton *, pBtn )
+{
+ (void) pBtn;
+ mpLayoutTree->print();
+ return 0;
+}
+
+//** Editor, the Dialog
+
+Editor::Editor( uno::Reference< lang::XMultiServiceFactory > xFactory,
+ rtl::OUString aFile )
+ : layout::Dialog( (Window*) (NULL), "editor.xml", "dialog" )
+ , mpImpl( new EditorImpl( this, xFactory ) )
+{
+ if ( aFile.getLength() )
+ mpImpl->loadFile( aFile );
+
+ // parent:
+ FreeResource();
+}
+
+Editor::~Editor()
+{
+ delete mpImpl;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/editor.hxx b/toolkit/workben/layout/editor.hxx
new file mode 100644
index 000000000000..c977941703fa
--- /dev/null
+++ b/toolkit/workben/layout/editor.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef EDITOR_HXX
+#define EDITOR_HXX
+
+#include <layout/layout.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+class EditorImpl;
+
+class Editor : public layout::Dialog
+{
+EditorImpl *mpImpl;
+
+public:
+ Editor( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xMSF,
+ rtl::OUString aFile );
+ ~Editor();
+
+ void loadFile( const rtl::OUString &aTestFile );
+};
+
+#endif /*EDITOR_HXX*/
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/editor.xml b/toolkit/workben/layout/editor.xml
new file mode 100644
index 000000000000..4126dea8b289
--- /dev/null
+++ b/toolkit/workben/layout/editor.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Normal skin -->
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Layout Editor" sizeable="true">
+ <vbox>
+ <hbox>
+ <min-size min-width="120" cnt:expand="false">
+ <vbox>
+ <fixedtext label="Layout:" cnt:expand="false" />
+ <hbox>
+ <listbox id="layout-tree" has_border="true" />
+ <vbox cnt:expand="false">
+ <pushbutton id="layout-up-button" cnt:expand="false" />
+ <pushbutton id="layout-down-button" cnt:expand="false" />
+ <fixedtext cnt:expand="true" />
+ <pushbutton id="layout-remove-button" cnt:expand="false" />
+ </vbox>
+ </hbox>
+ </vbox>
+ </min-size>
+ <min-size min-width="120">
+ <vbox>
+ <fixedtext label="Preview:" cnt:expand="false" />
+ <vbox border="50">
+ <bin id="preview-box" />
+ </vbox>
+ </vbox>
+ </min-size>
+ <min-size min-width="120" cnt:expand="false">
+ <vbox>
+ <fixedtext label="Properties:" cnt:expand="false" />
+ <table id="properties-box" columns="3" />
+ </vbox>
+ </min-size>
+ </hbox>
+ <hfixedline cnt:expand="false" />
+ <vbox cnt:expand="false">
+ <fixedtext label="Create widgets:" cnt:expand="false" />
+ <flow id="create-widget" homogeneous="true" spacing="2" />
+ <fixedtext label="Create containers:" cnt:expand="false" />
+ <flow id="create-container" homogeneous="true" spacing="2" />
+ </vbox>
+ <hbox cnt:expand="false">
+ <vbox><fixedline /><fixedline /><fixedline /><fixedline /></vbox>
+<!-- <pushbutton id="import-button" label="Import..." cnt:expand="false"/>-->
+ <pushbutton id="export-button" label="Export (stdout)" cnt:expand="false"/>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/empty.xml b/toolkit/workben/layout/empty.xml
new file mode 100644
index 000000000000..a8408e55719e
--- /dev/null
+++ b/toolkit/workben/layout/empty.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Empty Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="1" border="10">
+ <min-size min-width="200"/>
+ <fixedline height="1"/>
+ <vbox spacing="10">
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ </vbox>
+ <fixedline height="1"/>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/flow-container.xml b/toolkit/workben/layout/flow-container.xml
new file mode 100644
index 000000000000..3d48b1683216
--- /dev/null
+++ b/toolkit/workben/layout/flow-container.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Interactable Containers" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <flow>
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ </flow>
+ <hbox cnt:expand="false">
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="0" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="0.3" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="0.5" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="0.7" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="1" />
+ </align>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/flow.xml b/toolkit/workben/layout/flow.xml
new file mode 100644
index 000000000000..03e879bb13c1
--- /dev/null
+++ b/toolkit/workben/layout/flow.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Flowing" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5">
+ <flow>
+ <pushbutton label="Button 1" />
+ <pushbutton label="Button 2" />
+ <pushbutton label="Button 3" />
+ <pushbutton label="Button 4" />
+ <pushbutton label="Button 5" />
+ <pushbutton label="Button 6" />
+ <pushbutton label="Button 7" />
+ </flow>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/insert-sheet.xml b/toolkit/workben/layout/insert-sheet.xml
new file mode 100644
index 000000000000..2350da9aec77
--- /dev/null
+++ b/toolkit/workben/layout/insert-sheet.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog sizeable="true" closeable="true" moveable="true" output-size="true" id="RID_SCDLG_INSERT_TABLE" sv-look="true" _title="Insert Sheet" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox spacing="5" border="5">
+ <fixedline id="FL_POSITION" _text="Position"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <radiobutton radiogroup="insert-sheet-position" id="RB_BEFORE" tabstop="true" _label="B~efore current sheet"/>
+ <radiobutton radiogroup="insert-sheet-position" id="RB_BEHIND" tabstop="true" _label="~After current sheet"/>
+ </vbox>
+ </hbox>
+ <fixedline id="FL_TABLE" _text="Sheet"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <radiobutton radiogroup="insert-sheet-source" id="RB_NEW" _label="~New sheet"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5" cnt:fill="false" cnt:expand="false">
+ <fixedtext id="FT_COUNT" _label="N~o. of sheets"/>
+ <fixedtext id="FT_NAME" _label="Na~me"/>
+ </vbox>
+ <vbox>
+ <hbox>
+ <numericfield has_border="true" maximum="256" minimum="1" repeat="true" id="NF_COUNT" spin="true" spin-size="1" tabstop="true" value="1" cnt:fill="true" cnt:expand="false"/>
+ </hbox>
+ <edit has_border="true" id="ED_TABNAME" cnt:fill="true" cnt:expand="true"/>
+ </vbox>
+ </hbox>
+ </vbox>
+ </hbox>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <radiobutton radiogroup="insert-sheet-source" id="RB_FROMFILE" _label="~From file"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <hbox>
+ <multilistbox auto-hscroll="true" has_border="true" id="LB_TABLES" simple-mode="true" string-item-list=" : : : : " cnt:fill="true" cnt:expand="true"/>
+ <vbox cnt:fill="false" cnt:expand="false" spacing="5">
+ <pushbutton id="BTN_BROWSE" _label="~Browse..." cnt:expand="false"/>
+ <checkbox id="CB_LINK" _label="Lin~k" cnt:expand="false"/>
+ <flow/>
+ </vbox>
+ </hbox>
+ <fixedtext id="FT_PATH" label="FT-PATH"/>
+ </vbox>
+ </hbox>
+ </vbox>
+ </hbox>
+ <dialogbuttonhbox border="5" spacing="5">
+ <okbutton defbutton="true" id="BTN_OK"/>
+ <cancelbutton id="BTN_CANCEL"/>
+ <helpbutton id="BTN_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/interactable-containers.xml b/toolkit/workben/layout/interactable-containers.xml
new file mode 100644
index 000000000000..afb663951d6c
--- /dev/null
+++ b/toolkit/workben/layout/interactable-containers.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Interactable Containers" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <hsplitter>
+ <scroller>
+ <vbox>
+ <pushbutton label="Some Label" />
+ <edit has_border="true" text="Some Text" />
+ <listbox has_border="true" string-item-list="Item One:Item Two:Item Three:Item Four:Item Five:Item Six:Item Seven" />
+ <combobox has_border="true" string-item-list="Item One:Item Two:Item Three" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ </vbox>
+ </scroller>
+ <vsplitter>
+ <pushbutton label="Corner" />
+ <tabcontrol>
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <vbox cnt:title="Page 2">
+ <pushbutton label="1" />
+ <pushbutton label="2" />
+ <pushbutton label="3" />
+ <pushbutton label="4" />
+ </vbox>
+ <pushbutton label="Content 3" cnt:title="Page 3" />
+ <pushbutton label="Content 4" cnt:title="Page 4" />
+ <pushbutton label="Content 5" cnt:title="Page 5" />
+ </tabcontrol>
+ </vsplitter>
+ </hsplitter>
+</dialog>
diff --git a/toolkit/workben/layout/layout-flat.xml b/toolkit/workben/layout/layout-flat.xml
new file mode 100644
index 000000000000..0d3b969020fb
--- /dev/null
+++ b/toolkit/workben/layout/layout-flat.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<framewindow xmlns="http://openoffice.org/2007/layout"
+ id="window1" title="Test-Dialog" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true"
+ width="800" height="300">
+ <pushbutton label="XML Left" toggle="true" show="true"
+ x="10" y="10" width="400" height="200"/>
+ <pushbutton label="XML Right" toggle="true" show="true"
+ x="420" y="10" width="400" height="200"/>
+ <checkbox label="XML cool ?" enabled="true" show="true"
+ state="1" tristate="true" align="1"
+ x="10" y="210" width="800" height="100"/>
+</framewindow> \ No newline at end of file
diff --git a/toolkit/workben/layout/layout.xml b/toolkit/workben/layout/layout.xml
new file mode 100644
index 000000000000..4d9e71bbc5b9
--- /dev/null
+++ b/toolkit/workben/layout/layout.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="window1" title="Test-Dialog" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <hbox border="20" spacing="10" homogeneous="true">
+ <pushbutton label="XML Left"
+ cnt:expand="true" cnt:fill="true" />
+ <pushbutton label="XML Center"
+ cnt:expand="true" cnt:fill="false" />
+ <pushbutton label="XML Right"
+ cnt:expand="false" cnt:fill="false" />
+ </hbox>
+</dialog>
diff --git a/toolkit/workben/layout/message-box.xml b/toolkit/workben/layout/message-box.xml
new file mode 100644
index 000000000000..61305e443fa3
--- /dev/null
+++ b/toolkit/workben/layout/message-box.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="message-box" _title="" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true" closeable="true">
+ <vbox border="5" spacing="5">
+ <hbox border="5" spacing="20">
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-error.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-info.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-query.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-warning.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedtext id="FT_MESSAGE" _label="FT-LABEL" cnt:v-align="0.5" cnt:v-fill="0" />
+ </align>
+ <flow/>
+ </hbox>
+ <dialogbuttonhbox border="0" spacing="5">
+ <flow/>
+ <!-- deprecoted vcl/MsgBox compatibility !-->
+ <retrybutton id="BTN_RETRY" />
+ <ignorebutton id="BTN_IGNORE" />
+
+ <yesbutton id="BTN_YES"/>
+ <cancelbutton id="BTN_CANCEL"/>
+ <helpbutton id="BTN_HELP"/>
+ <nobutton id="BTN_NO" xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/more.xml b/toolkit/workben/layout/more.xml
new file mode 100644
index 000000000000..79e9c8214356
--- /dev/null
+++ b/toolkit/workben/layout/more.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="RID_SVXDLG_MORE" _title="Test More" optimumsize="true"
+ help-id="SID_ATTR_RESTORE"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5" width="640">
+ <fixedtext id="FT_ONE" _label="One"/>
+ <fixedtext id="FT_TWO" _label="Two"/>
+ <hbox border="5">
+ <flow/>
+ <morebutton id="PB_MORE" cnt:expand="false" _label="More..."/>
+ </hbox>
+ <fixedtext id="FT_THREE" _label="Three"/>
+ <fixedtext id="FT_FOUR" _label="Four"/>
+ </vbox>
+</modaldialog>
+
diff --git a/toolkit/workben/layout/move-copy-sheet.xml b/toolkit/workben/layout/move-copy-sheet.xml
new file mode 100644
index 000000000000..3d26db1aa73d
--- /dev/null
+++ b/toolkit/workben/layout/move-copy-sheet.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog sizeable="true" closeable="true" help-id="FID_TAB_MOVE" moveable="true" output-size="true" id="RID_SCDLG_MOVETAB" sv-look="true" _title="Move/Copy Sheet" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox spacing="5" border="5">
+ <string id="STR_NEWDOC" _text="- new document -"/>
+ <fixedtext id="FT_DEST" _label="To ~document"/>
+ <listbox has_border="true" dropdown="true" id="LB_DEST" tabstop="true"/>
+ <fixedtext id="FT_INSERT" _label="~Insert before"/>
+ <listbox has_border="true" id="LB_INSERT" tabstop="true" string-item-list=" : : : : " />
+ <checkbox id="BTN_COPY" tabstop="true" _label="~Copy"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <cancelbutton id="BTN_CANCEL" tabstop="true"/>
+ <helpbutton id="BTN_HELP" tabstop="true"/>
+ <okbutton defbutton="true" id="BTN_OK" tabstop="true"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/non-interactable-containers.xml b/toolkit/workben/layout/non-interactable-containers.xml
new file mode 100644
index 000000000000..29b37b6a7a49
--- /dev/null
+++ b/toolkit/workben/layout/non-interactable-containers.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Interactable Containers" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="10">
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <hfixedline/>
+ <flow cnt:expand="false">
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ </flow>
+ <hfixedline/>
+ <hbox cnt:expand="false">
+<!-- <align>
+ <okbutton cnt:hfill="0.2" cnt:halign="0.2" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0.8" cnt:halign="0.2" />
+ </align>-->
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/number-format.xml b/toolkit/workben/layout/number-format.xml
new file mode 100644
index 000000000000..77460ea79ceb
--- /dev/null
+++ b/toolkit/workben/layout/number-format.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<tabpage help-id="HID_NUMBERFORMAT" show="false" id="RID_SVXPAGE_NUMBERFORMAT" _title="Number Format" _text="Number Format" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container" sizeable="true">
+ <!--
+ <imagelist prefix="nu" id="IL_ICON">
+ <maskcolor blue="0xFFFF" green="0x0000" red="0xFFFF" type="Color"/>
+ <idlist none="IID_INFO"/>
+ <idcount none="3"/>
+ </imagelist>
+ !-->
+ <vbox spacing="5" border="5">
+ <string id="STR_EUROPE" _text="Europe"/>
+ <string id="STR_AUTO_ENTRY" _text="Automatic"/>
+ <hbox spacing="5">
+ <vbox spacing="5" cnt:fill="true" cnt:expand="true">
+ <fixedtext id="FT_CATEGORY" _label="~Category"/>
+ <listbox line-count="8" auto-hscroll="true" has_border="true" id="LB_CATEGORY" _string-item-list="All:User-defined:Number:Percent:Currency:Date:Time:Scientific:Fraction:Boolean Value:Text"/>
+ <flow/>
+ </vbox>
+ <vbox spacing="5" cnt:fill="true" cnt:expand="true">
+ <fixedtext id="FT_FORMAT" _label="F~ormat"/>
+ <listbox has_border="true" line-count="7" dropdown="true" id="LB_CURRENCY" tabstop="true" _string-item-list="Automatically" cnt:expand="false" cnt:fill="false"/>
+ <svxfontlistbox line-count="7" dropdown="false" has_border="true" help-id="HID_NUMBERFORMAT_LB_FORMAT" id="LB_FORMAT" tabstop="true" string-item-list=" : : : : : : : : : : : : : : : "/>
+ </vbox>
+ <vbox spacing="5" cnt:fill="true" cnt:expand="true">
+ <fixedtext id="FT_LANGUAGE" _label="~Language" cnt:expand="false" cnt:fill="false"/>
+ <svxlanguagebox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" string-item-list="Dutch:" cnt:expand="false" cnt:fill="false"/>
+ <checkbox id="CB_SOURCEFORMAT" show="false" _label="So~urce format" cnt:expand="false" cnt:fill="false"/>
+ <flow cnt:expand="true" cnt:fill="true"/>
+ <window has_border="true" help-id="HID_NUMBERFORMAT_WND_NUMBER_PREVIEW" id="WND_NUMBER_PREVIEW" sv-look="true"/>
+ </vbox>
+ </hbox>
+ <fixedline id="FL_OPTIONS" _text="Options"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <hbox spacing="5">
+ <vbox spacing="5" cnt:fill="false" cnt:expand="false">
+ <fixedtext id="FT_DECIMALS" _label="~Decimal places"/>
+ <fixedtext id="FT_LEADZEROES" _label="Leading ~zeroes"/>
+ </vbox>
+ <vbox spacing="5" cnt:fill="false" cnt:expand="false">
+ <numericfield has_border="true" first="0" last="15" minimum="0" value="2" maximum="20" repeat="true" id="ED_DECIMALS" spin="true" spin-size="1" strict-format="true" cnt:expand="false"/>
+ <numericfield has_border="true" first="0" last="15" minimum="0" value="1" maximum="20" repeat="true" id="ED_LEADZEROES" spin="true" spin-size="1" strict-format="true" cnt:fill="false"/>
+ </vbox>
+ <vbox spacing="5" cnt:fill="false" cnt:expand="false">
+ <checkbox id="BTN_NEGRED" _label="~Negative numbers red"/>
+ <checkbox id="BTN_THOUSAND" _label="~Thousands separator"/>
+ </vbox>
+ </hbox>
+ </vbox>
+ </hbox>
+ <fixedtext id="FT_EDFORMAT" _label="~Format code"/>
+ <hbox spacing="5" cnt:expand="false">
+ <edit has_border="true" id="ED_FORMAT"/>
+ <imagebutton cnt:expand="false" cnt:fill="false" help-id="HID_NUMBERFORMAT_TBI_ADD" quick-help-text="Add" id="IB_ADD" sv-look="true" graphic="svx/res/nu01.png"/>
+ <imagebutton cnt:expand="false" help-id="HID_NUMBERFORMAT_TBI_INFO" quick-help-text="Edit Comment" id="IB_INFO" sv-look="true" graphic="svx/res/nu03.png"/>
+ <imagebutton cnt:expand="false" help-id="HID_NUMBERFORMAT_TBI_REMOVE" quick-help-text="Remove" id="IB_REMOVE" sv-look="true" graphic="svx/res/nu02.png"/>
+ </hbox>
+ <fixedtext no-label="true" show="false" id="FT_COMMENT" word-break="true" cnt:expand="false"/>
+ <edit has_border="true" show="false" id="ED_COMMENT" cnt:expand="false"/>
+ </vbox>
+</tabpage>
diff --git a/toolkit/workben/layout/numeric.xml b/toolkit/workben/layout/numeric.xml
new file mode 100644
index 000000000000..becab18cdf9b
--- /dev/null
+++ b/toolkit/workben/layout/numeric.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<framewindow xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="window1" title="Test-Dialog" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <numericfield text="5" spin="true" enforce-format="false" value-min="5.3" value-max="17.8"/>
+ <pushbutton />
+ </vbox>
+</framewindow>
diff --git a/toolkit/workben/layout/ooo-patch b/toolkit/workben/layout/ooo-patch
new file mode 100644
index 000000000000..89fc58db8748
--- /dev/null
+++ b/toolkit/workben/layout/ooo-patch
@@ -0,0 +1,7 @@
+#! /bin/sh
+commit=${1-3249db59} # m5
+
+git diff $commit layout | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-layout.diff
+git diff $commit config_office scp2 | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-config_office-scp2.diff
+git diff $commit svx sw | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-svx-sw.diff
+git diff $commit transex3 | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-transex3.diff
diff --git a/toolkit/workben/layout/paragraph.xml b/toolkit/workben/layout/paragraph.xml
new file mode 100644
index 000000000000..847e04ec0568
--- /dev/null
+++ b/toolkit/workben/layout/paragraph.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Paragraph" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+<vbox>
+ <tabcontrol>
+ <vbox cnt:title="Indents and Spacing">
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_INDENT" label="Indent" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <table columns="2" cnt:expand="false">
+ <fixedtext id="FT_LEFTINDENT" label="Before text" />
+ <metricfield id="ED_LEFTINDENT" spin="true" has_border="true"/>
+ <fixedtext id="FT_RIGHTINDENT" label="After text" />
+ <metricfield id="ED_RIGHTINDENT" spin="true" has_border="true"/>
+ <fixedtext id="FT_FLINEINDENT" label="First line" />
+ <metricfield id="ED_FLINEINDENT" spin="true" has_border="true" />
+ <checkbox id="CB_AUTO" label="Automatic" cnt:col-span="2" />
+ </table>
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_DIST" label="Spacing" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <table columns="2" cnt:expand="false">
+ <fixedtext id="FT_TOPDIST" label="Above paragraph" />
+ <numericfield id="ED_TOPDIST" spin="true" has_border="true" />
+ <fixedtext id="FT_BOTTOMDIST" label="Below paragraph" />
+ <numericfield id="ED_BOTTOMDIST" spin="true" has_border="true" />
+ </table>
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_LINEDIST" label="Line spacing" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <hbox cnt:expand="false">
+ <listbox id="LB_LINEDIST" dropdown="true"
+ string-item-list="Single:1.5 lines:Double:Proportional"
+ cnt:expand="false"/>
+ <fixedtext id="FT_LINEDIST" label="of" cnt:expand="true" />
+ <numericfield id="ED_LINEDISTPERCENT" value="0" />
+ </hbox>
+ <hbox id="FL_REGISTER" cnt:expand="false">
+ <fixedtext label="Register-true" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <checkbox id="CB_REGISTER" cnt:expand="false" label="Activate" />
+ </vbox>
+
+ <vbox cnt:title="Alignment">
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_ALIGN" label="Options" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <radiobutton id="BTN_LEFTALIGN" label="Left" cnt:expand="false" />
+ <radiobutton id="BTN_RIGHTALIGN" label="Right" cnt:expand="false" />
+ <radiobutton id="BTN_CENTERALIGN" label="Center" cnt:expand="false" />
+ <radiobutton id="BTN_JUSTIFYALIGN" label="Justify" cnt:expand="false" />
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_ALIGN" label="Last line" cnt:expand="false" />
+ <listbox dropdown="true" string-item-list="Left:Centered:Justified"
+ id="LB_LASTLINE" />
+ </hbox>
+ </vbox>
+ </tabcontrol>
+
+ <align cnt:expand="false">
+ <hbox cnt:expand="false" cnt:hfill="0" cnt:halign="1">
+ <pushbutton label="OK" />
+ <pushbutton label="Cancel" />
+ <pushbutton label="Help" />
+ <pushbutton label="Reset" />
+ </hbox>
+ </align>
+</vbox>
+</dialog>
diff --git a/toolkit/workben/layout/plugin.cxx b/toolkit/workben/layout/plugin.cxx
new file mode 100644
index 000000000000..65af2e510021
--- /dev/null
+++ b/toolkit/workben/layout/plugin.cxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define _LAYOUT_PLUGIN_CXX
+
+#include "plugin.hxx"
+
+#include <com/sun/star/awt/XDialog2.hpp>
+#include <dialcontrol.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+
+#include <layout/layout-pre.hxx>
+
+using namespace com::sun::star;
+
+#define LAYOUT_RES(x) #x
+
+#undef ModalDialog
+#define ModalDialog( parent, id ) Dialog( parent, "plugin.xml", id )
+
+PluginDialog::PluginDialog( Window* pParent )
+ : ModalDialog( pParent, LAYOUT_RES( RID_DLG_PLUGIN ) )
+ , aHeaderImage( this, LAYOUT_RES( FI_HEADER ) )
+ , aHeaderText( this, LAYOUT_RES( FT_HEADER ) )
+ , aHeaderLine( this, LAYOUT_RES( FL_HEADER ) )
+ , aPlugin( this, LAYOUT_RES( PL_DIAL ),
+// FIXME: width=, height=, are not recognized as properties.
+// new svx::DialControl( LAYOUT_DIALOG_PARENT, Size( 0, 0 ), 0 ) )
+ new svx::DialControl( LAYOUT_DIALOG_PARENT, Size( 80, 80 ), 0 ) )
+ //, aDialControl( static_cast<svx::DialControl&> ( aPlugin.GetPlugin() ) )
+ , aDialControl( static_cast<svx::DialControl&> ( *aPlugin.mpPlugin ) )
+ , aOKBtn( this, LAYOUT_RES( BTN_OK ) )
+ , aCancelBtn( this, LAYOUT_RES( BTN_CANCEL ) )
+ , aHelpBtn( this, LAYOUT_RES( BTN_HELP ) )
+{
+ aDialControl.SetRotation( 425 );
+}
+
+PluginDialog::~PluginDialog()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/plugin.hxx b/toolkit/workben/layout/plugin.hxx
new file mode 100644
index 000000000000..862e6f6dc85a
--- /dev/null
+++ b/toolkit/workben/layout/plugin.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LAYOUT_PLUGIN_HXX
+#define _LAYOUT_PLUGIN_HXX
+
+#include <layout/layout.hxx>
+#include <layout/layout-pre.hxx>
+
+namespace svx {
+class DialControl;
+}
+
+class PluginDialog : public ModalDialog
+{
+private:
+ FixedImage aHeaderImage;
+ FixedText aHeaderText;
+ FixedLine aHeaderLine;
+ Plugin aPlugin;
+ svx::DialControl& aDialControl;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+public:
+ PluginDialog( Window* pParent );
+ ~PluginDialog();
+};
+
+#include <layout/layout-post.hxx>
+
+#endif /* _LAYOUT_PLUGIN_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/plugin.xml b/toolkit/workben/layout/plugin.xml
new file mode 100644
index 000000000000..c5f1b2abe040
--- /dev/null
+++ b/toolkit/workben/layout/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="RID_DLG_PLUGIN" _title="Plugin Test" optimumsize="true"
+ help-id="SID_ATTR_PLUGIN"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5">
+ <hbox spacing="5" cnt:expand="false">
+ <fixedimage id="FI_HEADER" cnt:expand="false" graphic="res/commandimagelist/sc_apply.png" />
+ <fixedtext id="FT_HEADER" _label="Plugin Test"/>
+ </hbox>
+ <fixedline id="FL_HEADER"/>
+ <hbox>
+ <flow cnt:padding="80"/>
+ <plugin id="PL_DIAL" width="80" height="80"/>
+ </hbox>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton defbutton="true" id="BTN_OK"/>
+ <cancelbutton id="BTN_CANCEL" />
+ <helpbutton id="BTN_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
+
diff --git a/toolkit/workben/layout/radio-groups.xml b/toolkit/workben/layout/radio-groups.xml
new file mode 100644
index 000000000000..43a1372297ee
--- /dev/null
+++ b/toolkit/workben/layout/radio-groups.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Radio Groups Test"
+ optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <hbox>
+ <radiobutton group="1" label="Group 1"
+ cnt:expand="false" cnt:fill="false" />
+ <radiobutton group="2" label="Group 2"
+ cnt:expand="true" cnt:fill="true" />
+ <radiobutton group="2" label="Group 2"
+ cnt:expand="true" cnt:fill="false" />
+ <radiobutton group="1" label="Group 1 (default)" state="1"
+ cnt:expand="false" cnt:fill="false" />
+ </hbox>
+ <radiobutton group="1" label="Group 1" state="0"
+ cnt:expand="false" cnt:fill="false" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/recover.cxx b/toolkit/workben/layout/recover.cxx
new file mode 100644
index 000000000000..c776ec0bd8d2
--- /dev/null
+++ b/toolkit/workben/layout/recover.cxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+
+#if TEST_LAYOUT
+#include <cstdio>
+#endif /* TEST_LAYOUT */
+#include <com/sun/star/awt/XDialog2.hpp>
+#include <tools/shl.hxx>
+#include <svtools/itemset.hxx>
+#include <svtools/itempool.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+
+
+#include <com/sun/star/awt/PosSize.hpp> //redrawAlready
+
+using namespace com::sun::star;
+
+#define _SVX_RECOVER_CXX
+
+#include "recover.hxx"
+
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "recover.xml", id )
+#endif /* ENABLE_LAYOUT */
+
+#if TEST_LAYOUT
+SvxRecoverDialog::SvxRecoverDialog( Window* pParent )
+#else /* !TEST_LAYOUT */
+SvxRecoverDialog::SvxRecoverDialog( Window* pParent, const SfxItemSet& rCoreSet )
+#endif /* !TEST_LAYOUT */
+: SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_RECOVER ) )
+
+ , aHeaderImage( this, SVX_RES( FI_HEADER ) )
+ , aHeaderText( this, SVX_RES( FT_HEADER ) )
+ , aHeaderLine( this, SVX_RES( FL_HEADER ) )
+ , aRecoverText( this, SVX_RES( FT_RECOVER ) )
+ , aTextAdvanced( this, SVX_RES( FT_ADVANCED ) )
+
+ , aCheckBoxDoc( this, SVX_RES( CB_DOC ) )
+ , aImageDoc( this, SVX_RES( FI_DOC ) )
+ , aTextDoc( this, SVX_RES( FT_DOC ) )
+
+ , aCheckBoxSheet( this, SVX_RES( CB_SHEET ) )
+ , aImageSheet( this, SVX_RES( FI_SHEET ) )
+ , aTextSheet( this, SVX_RES( FT_SHEET ) )
+
+ , aCheckBoxDraw( this, SVX_RES( CB_DRAW ) )
+ , aImageDraw( this, SVX_RES( FI_DRAW ) )
+ , aTextDraw( this, SVX_RES( FT_DRAW ) )
+
+ , aCheckBoxPresent( this, SVX_RES( CB_PRESENT ) )
+ , aImagePresent( this, SVX_RES( FI_PRESENT ) )
+ , aTextPresent( this, SVX_RES( FT_PRESENT ) )
+
+ , aButtonAdvanced( this, SVX_RES( PB_ADVANCED ) )
+
+ , aProgressText( this, SVX_RES( FT_PROGRESS ) )
+ , aProgressBar( this, SVX_RES( PB_RECOVER ) )
+ , aCheckBoxLogFile( this, SVX_RES( CH_LOGFILE ) )
+ , aOKBtn( this, SVX_RES( BTN_OK ) )
+ , aCancelBtn( this, SVX_RES( BTN_CANCEL ) )
+ , aHelpBtn( this, SVX_RES( BTN_HELP ) )
+{
+ aButtonAdvanced.AddAdvanced( &aTextAdvanced );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxDoc );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxSheet );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxDraw );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxPresent );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxLogFile );
+}
+
+
+SvxRecoverDialog::~SvxRecoverDialog()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/recover.hxx b/toolkit/workben/layout/recover.hxx
new file mode 100644
index 000000000000..de3a63c84510
--- /dev/null
+++ b/toolkit/workben/layout/recover.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_RECOVER_HXX
+#define _SVX_RECOVER_HXX
+
+#include <layout/layout.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <layout/core/box.hxx>
+#include <layout/layout-pre.hxx>
+
+class SvxRecoverDialog : public SfxModalDialog
+{
+private:
+ FixedImage aHeaderImage;
+ FixedText aHeaderText;
+ FixedLine aHeaderLine;
+ FixedText aRecoverText;
+ FixedText aTextAdvanced;
+
+ CheckBox aCheckBoxDoc;
+ FixedImage aImageDoc;
+ FixedText aTextDoc;
+ CheckBox aCheckBoxSheet;
+ FixedImage aImageSheet;
+ FixedText aTextSheet;
+ CheckBox aCheckBoxDraw;
+ FixedImage aImageDraw;
+ FixedText aTextDraw;
+ CheckBox aCheckBoxPresent;
+ FixedImage aImagePresent;
+ FixedText aTextPresent;
+ AdvancedButton aButtonAdvanced;
+
+ FixedText aProgressText;
+ ProgressBar aProgressBar;
+ CheckBox aCheckBoxLogFile;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+public:
+#if TEST_LAYOUT
+ SvxRecoverDialog( Window* pParent );
+#else /* !TEST_LAYOUT */
+ SvxRecoverDialog( Window* pParent, const SfxItemSet& rCoreSet );
+#endif /* !TEST_LAYOUT */
+ ~SvxRecoverDialog();
+};
+
+#include <layout/layout-post.hxx>
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/recover.xml b/toolkit/workben/layout/recover.xml
new file mode 100644
index 000000000000..b7387b687de2
--- /dev/null
+++ b/toolkit/workben/layout/recover.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="RID_SVXDLG_RECOVER" _title="OpenOffice.org Document Restore -- questions to sigi(at)novell.com--" optimumsize="true"
+ help-id="SID_ATTR_RESTORE"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5" width="640">
+ <hbox spacing="5" cnt:expand="false">
+ <fixedimage id="FI_HEADER" cnt:expand="false" graphic="res/commandimagelist/sc_apply.png" />
+ <fixedtext id="FT_HEADER" _label="OpenOffice.org Document Restore"/>
+ </hbox>
+ <fixedline id="FL_HEADER"/>
+ <!-- mockup: fixedtext multiline=true" does not work?
+ <multilineedit id="MLE_RECOVER" has_border="false" foobar="x" _text="At least one document was found that was not stored safely to the media. Uncheck any documents you do not want to restore (information may be lost)."/>
+ <fixedtext id="FT_RECOVER" has_border="false" multi-line="true" font-word-line-mode="true" word-break="true" _label="At least one document was found that was not stored safely to the media. Uncheck any documents you do not want to restore (information may be lost).
+LINE TEST"/>
+ !-->
+ <fixedtext id="FT_RECOVER" has_border="false" multi-line="true" font-word-line-mode="true" _label="At least one document was not stored safely and must be recovered."/>
+ <fixedtext id="FT_ADVANCED" has_border="false" multi-line="true" font-word-line-mode="true" word-break="true" _label="Uncheck any documents you do not want to restore (information may be lost)."/>
+ <vbox cnt:fill="true" cnt:expand="true" cnt:padding="20" border="20" spacing="20">
+ <hbox>
+ <checkbox id="CB_DOC" state="1" cnt:expand="false" scale="false"/>
+ <fixedimage id="FI_DOC" cnt:v-align="0.5" image-align="0.5" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_insertdoc.png"/>
+ <fixedtext id="FT_DOC" _label="My document"/>
+ </hbox>
+ <hbox>
+ <checkbox id="CB_SHEET" state="1" cnt:expand="false" scale="false" />
+ <fixedimage id="FI_SHEET" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_inserttable.png" />
+ <fixedtext id="FT_SHEET" _label="My spreadsheet"/>
+ </hbox>
+ <hbox>
+ <checkbox id="CB_DRAW" state="1" cnt:expand="false" scale="false"/>
+ <fixedimage id="FI_DRAW" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_insertdraw.png" />
+ <fixedtext id="FT_DRAW" _label="My drawing"/>
+ </hbox>
+ <hbox>
+ <checkbox id="CB_PRESENT" state="1" cnt:expand="false" scale="false" />
+ <fixedimage id="FI_PRESENT" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_insertvideo.png" />
+ <fixedtext id="FT_PRESENT" _label="My presentation"/>
+ </hbox>
+ <hbox border="5">
+ <flow/>
+ <advancedbutton id="PB_ADVANCED" cnt:expand="false" _label="Advanced..."/>
+ </hbox>
+ </vbox>
+ <vbox>
+ <fixedtext id="FT_PROGRESS" _label="Restore progress (idle)"/>
+ <hbox height="40" cnt:expand="true">
+ <progressbar cnt:expand="true" cnt:fill="true" id="PB_RECOVER" has_border="true" border="10" fill-color="#ccccff" background-color="#ffffff" progress-value-min="0" progress-value-max="100" progress-value="50" />
+ <!-- FIXME: cannot set progress bar's height, use space as strut... !-->
+ <fixedtext label="" height="10" cnt:expand="false" cnt:fill="false"/>
+ </hbox>
+ </vbox>
+ <checkbox id="CH_LOGFILE" _label="Open additional text document to display the restore logfile"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton defbutton="true" id="BTN_OK" _label="Restore"/>
+ <cancelbutton id="BTN_CANCEL" />
+ <helpbutton id="BTN_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
+
diff --git a/toolkit/workben/layout/refresh b/toolkit/workben/layout/refresh
new file mode 100644
index 000000000000..796999549c36
--- /dev/null
+++ b/toolkit/workben/layout/refresh
@@ -0,0 +1,7 @@
+echo "source me ..."
+test -n "${INPATH}" && rm -Rf ../../${INPATH}
+build debug=true\
+ && cp ../../${INPATH}/lib/*.so ../../../solver/300/${INPATH}/lib \
+ && cp -f ../..$INPATH/lib/libtkx.so $OOO_INSTALL_PREFIX/openoffice.org/basis3.0/program \
+ && dmake debug=true \
+ && ../../${INPATH}/bin/test "$@"
diff --git a/toolkit/workben/layout/run-s2x b/toolkit/workben/layout/run-s2x
new file mode 100644
index 000000000000..926addf49047
--- /dev/null
+++ b/toolkit/workben/layout/run-s2x
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+SRC=${1-../../svx/source/dialog/zoom.src}
+SRC=${1-../../sw/source/ui/dialog/wordcountdialog.src}
+
+../src2xml/source/src2xml.py --ignore-includes --post-process --output-dir=. $SRC
diff --git a/toolkit/workben/layout/scroller.xml b/toolkit/workben/layout/scroller.xml
new file mode 100644
index 000000000000..44e63d15df5e
--- /dev/null
+++ b/toolkit/workben/layout/scroller.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Scroll Test" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <scroller>
+ <vbox>
+ <pushbutton label="Button 1" />
+ <edit has_border="true" text="Edit 1" />
+ <pushbutton label="Button 2" />
+ <pushbutton label="Button 3" />
+ <pushbutton label="Button 4" />
+ <pushbutton label="Button 5" />
+ <pushbutton label="Button 6" />
+ <pushbutton label="Button 7" />
+ <pushbutton label="Button 8" />
+ <pushbutton label="Button 9" />
+ <pushbutton label="Button 10" />
+ <pushbutton label="Button 11" />
+ <pushbutton label="Button 12" />
+ <pushbutton label="Button 13" />
+ <pushbutton label="Button 14" />
+ <pushbutton label="Button 15" />
+ <pushbutton label="Button 16" />
+ <pushbutton label="Button 17" />
+ </vbox>
+ </scroller>
+ <okbutton cnt:expand="false" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/sequence.xml b/toolkit/workben/layout/sequence.xml
new file mode 100644
index 000000000000..e89db54db2dc
--- /dev/null
+++ b/toolkit/workben/layout/sequence.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<framewindow xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ xmlns:style="http://openoffice.org/2007/layout/style"
+ title="Sequence Test" style:optimumsize="true"
+ style:has_border="true" style:sizeable="true" style:moveable="true">
+ <vbox>
+ <multilistbox linecount="5" string-item-list=":a:b::c:::d::::e:as:"
+ selected-items="0:1" />
+ <okbutton cnt:expand="false" />
+ </vbox>
+</framewindow>
diff --git a/toolkit/workben/layout/shutdown.xml b/toolkit/workben/layout/shutdown.xml
new file mode 100644
index 000000000000..fbe49e046cb4
--- /dev/null
+++ b/toolkit/workben/layout/shutdown.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Shutdown Dialog" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windowsg">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/simple-paragraph.cxx b/toolkit/workben/layout/simple-paragraph.cxx
new file mode 100644
index 000000000000..4cd204d107f7
--- /dev/null
+++ b/toolkit/workben/layout/simple-paragraph.cxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+// include ---------------------------------------------------------------
+
+#include <cstdio>
+#include <tools/shl.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <cstdio>
+
+namespace SVX {
+#include <svx/paraprev.hxx> // Preview
+};
+
+#include "simple-paragraph.hxx"
+
+#include <assert.h>
+
+
+
+
+
+// StandardTabPage ----------------------------------------------------------
+
+#define FT_LEFTINDENT 10
+#define ED_LEFTINDENT 11
+#define FT_FLINEINDENT 12
+#define ED_FLINEINDENT 13
+#define FT_RIGHTINDENT 14
+#define ED_RIGHTINDENT 15
+#define FL_INDENT 16
+
+#define FT_TOPDIST 20
+#define ED_TOPDIST 21
+#define FT_BOTTOMDIST 22
+#define ED_BOTTOMDIST 23
+#define FL_DIST 24
+
+#define BTN_LEFTALIGN 30
+#define BTN_RIGHTALIGN 31
+#define BTN_CENTERALIGN 32
+#define BTN_JUSTIFYALIGN 33
+#define FL_ALIGN 34
+#define FL_VERTALIGN 35
+#define LB_VERTALIGN 36
+#define FL_VERTEX 37
+#define CB_SNAP 38
+#define FT_VERTALIGN 39
+
+
+#define LB_LINEDIST 40
+#define FT_LINEDIST 41
+#define ED_LINEDISTPERCENT 42
+#define ED_LINEDISTMETRIC 43
+#define FL_LINEDIST 44
+#define WN_EXAMPLE 46
+
+#define CB_AUTO 48
+#define FT_LASTLINE 49
+#define LB_LASTLINE 50
+#define CB_EXPAND 51
+#define ST_LINEDIST_ABS 52
+#define ST_LEFTALIGN_ASIAN 53
+#define ST_RIGHTALIGN_ASIAN 54
+
+// ExtendedTabPage ----------------------------------------------------------
+
+#define BTN_HYPHEN 50
+#define ED_HYPHENBEFORE 52
+#define FT_HYPHENBEFORE 53
+#define ED_HYPHENAFTER 55
+#define FT_HYPHENAFTER 56
+#define FL_HYPHEN 57
+
+#define BTN_PAGEBREAK 60
+#define FT_BREAKTYPE 61
+#define LB_BREAKTYPE 62
+#define FT_BREAKPOSITION 63
+#define LB_BREAKPOSITION 64
+#define BTN_PAGECOLL 65
+#define LB_PAGECOLL 66
+#define BTN_KEEPTOGETHER 67
+#define BTN_WIDOWS 68
+#define ED_WIDOWS 69
+#define FT_WIDOWS 70
+#define BTN_ORPHANS 71
+#define ED_ORPHANS 72
+#define FT_ORPHANS 73
+#define FL_OPTIONS 74
+#define FT_PAGENUM 75
+#define ED_PAGENUM 76
+#define FL_BREAKS 77
+
+#define CB_KEEPTOGETHER 80
+#define FT_MAXHYPH 81
+#define ED_MAXHYPH 83
+
+#define CB_REGISTER 84
+#define FL_REGISTER 85
+#define FL_PROPERTIES 90
+#define FT_TEXTDIRECTION 91
+#define LB_TEXTDIRECTION 92
+
+
+//asian typography
+#define FL_AS_OPTIONS 1
+#define CB_AS_HANG_PUNC 2
+#define CB_AS_ALLOW_WORD_BREAK 3
+#define CB_AS_FORBIDDEN 4
+#define FL_AS_CHAR_DIST 5
+#define CB_AS_PUNCTUATION 6
+#define CB_AS_SCRIPT_SPACE 7
+#define CB_AS_ADJUST_NUMBERS 8
+
+
+
+
+
+
+
+
+SvxSimpleParagraphDialog::SvxSimpleParagraphDialog( Window* pParent )
+ : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr )
+ , Dialog( pParent, "simple-paragraph.xml", "dialog" )
+ , aLineSpacingList( this, "line-spacing-list" )
+ , pPrevWin(NULL)
+{
+fprintf(stderr, "creating res mgr\n");
+ pMgr = ResMgr::CreateResMgr("SOME_NAME");
+fprintf(stderr, "getting parent\n");
+ VCLXWindow *pCompParent = VCLXWindow::GetImplementation( GetPeer() );
+ assert( pCompParent != NULL );
+ assert( pCompParent->GetWindow() != NULL );
+fprintf(stderr, "creating foreign vcl widget\n");
+/* pPrevWin = new SVX::SvxParaPrevWindow(
+ pCompParent->GetWindow(),
+ ResId(1234, *pMgr)
+ );*/
+
+fprintf(stderr, "done\n");
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxSimpleParagraphDialog::~SvxSimpleParagraphDialog()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/simple-paragraph.hxx b/toolkit/workben/layout/simple-paragraph.hxx
new file mode 100644
index 000000000000..d4feff479135
--- /dev/null
+++ b/toolkit/workben/layout/simple-paragraph.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SIMPLE_PARAGRAPH_HXX
+#define _SVX_SIMPLE_PARAGRAPH_HXX
+
+#include <layout/layout.hxx>
+
+#include <svx/paraprev.hxx> // Preview
+
+namespace SVX {
+ class SvxParaPrevWindow;
+};
+class ResMgr;
+
+class SvxSimpleParagraphDialog : public SfxTabPage, public layout::Dialog
+{
+private:
+ ListBox aLineSpacingList;
+ SVX::SvxParaPrevWindow *pPrevWin;
+ ResMgr *pMgr;
+
+public:
+ SvxSimpleParagraphDialog( Window* pParent );
+ ~SvxSimpleParagraphDialog();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/simple-paragraph.xml b/toolkit/workben/layout/simple-paragraph.xml
new file mode 100644
index 000000000000..e07909dc8a39
--- /dev/null
+++ b/toolkit/workben/layout/simple-paragraph.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Paragraph test" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <listbox id="line-spacing-list" dropdown="true" cnt:expand="false"
+ string-item-list="Single:1.5 lines:Double:Proportional" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/sort-options.xml b/toolkit/workben/layout/sort-options.xml
new file mode 100644
index 000000000000..a409ac2d530a
--- /dev/null
+++ b/toolkit/workben/layout/sort-options.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<tabpage help-id="HID_SCPAGE_SORT_OPTIONS"
+ id="RID_SCPAGE_SORT_OPTIONS"
+ sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"
+ optimumsize="true"
+ sizeable="true" moveable="true">
+ <vbox spacing="4" border="5">
+ <string id="STR_COL_LABEL" _text="Range contains column la~bels"/>
+ <string id="STR_ROW_LABEL" _text="Range contains ~row labels"/>
+ <string id="SCSTR_UNDEFINED" _text="- undefined -"/>
+ <vbox spacing="4" border="5">
+ <checkbox id="BTN_CASESENSITIVE" tabstop="true" _label="Case ~sensitive"/>
+ <checkbox id="BTN_LABEL" tabstop="true"/>
+ <checkbox id="BTN_FORMATS" tabstop="true" _label="Include ~formats"/>
+ <checkbox id="BTN_NATURALSORT" tabstop="true" _label="Enable ~natural sort"/>
+ <checkbox id="BTN_COPYRESULT" tabstop="true" _label="~Copy sort results to:"/>
+ <hbox>
+ <listbox has_border="true" dropdown="true" id="LB_OUTAREA" tabstop="true"/>
+ <edit has_border="true" disable="true" id="ED_OUTAREA" tabstop="true"/>
+ </hbox>
+ <checkbox id="BTN_SORT_USER" tabstop="true" _label="Custom sort ~order"/>
+ <listbox has_border="true" disable="true" dropdown="true" id="LB_SORT_USER" tabstop="true"/>
+ <hbox>
+ <fixedtext id="FT_LANGUAGE" _label="~Language"/>
+ <fixedtext id="FT_ALGORITHM" _label="O~ptions"/>
+ </hbox>
+ <hbox>
+ <svxlanguagebox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" tabstop="true" _string-item-list="Default"/>
+ <listbox has_border="true" dropdown="true" id="LB_ALGORITHM" tabstop="true"/>
+ </hbox>
+ <fixedline id="FL_DIRECTION" _text="Direction"/>
+ <radiobutton id="BTN_TOP_DOWN" radiogroup="sort-options" tabstop="true" _label="~Top to bottom (sort rows)"/>
+ <radiobutton id="BTN_LEFT_RIGHT" radiogroup="sort-options" tabstop="true" _label="L~eft to right (sort columns)"/>
+ </vbox>
+ </vbox>
+</tabpage>
diff --git a/toolkit/workben/layout/sortdlg.cxx b/toolkit/workben/layout/sortdlg.cxx
new file mode 100644
index 000000000000..ecc18da4fbc8
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.cxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#if !TEST_LAYOUT
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+#endif /*! TEST_LAYOUT */
+
+#undef SC_DLLIMPLEMENTATION
+
+
+
+#include "tpsort.hxx"
+#include "sortdlg.hxx"
+#include "scresid.hxx"
+#include "sortdlg.hrc"
+
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <layout/layout-pre.hxx>
+#endif
+
+ScSortDlg::ScSortDlg( Window* pParent,
+ const SfxItemSet* pArgSet ) :
+ SfxTabDialog( pParent,
+ ScResId( RID_SCDLG_SORT ),
+ pArgSet ),
+ bIsHeaders ( FALSE ),
+ bIsByRows ( FALSE )
+
+{
+#if LAYOUT_SFX_TABDIALOG_BROKEN
+ AddTabPage( TP_FIELDS, ScTabPageSortFields::Create, 0 );
+ AddTabPage( TP_OPTIONS, ScTabPageSortOptions::Create, 0 );
+#else /* !LAYOUT_SFX_TABDIALOG_BROKEN */
+ String fields(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("fields")));
+ AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, FALSE, TAB_APPEND);
+ String options(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("options")));
+ AddTabPage( TP_OPTIONS, options, ScTabPageSortOptions::Create, 0, FALSE, TAB_APPEND);
+#endif /* !LAYOUT_SFX_TABDIALOG_BROKEN */
+ FreeResource();
+}
+
+ScSortDlg::~ScSortDlg()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/sortdlg.hrc b/toolkit/workben/layout/sortdlg.hrc
new file mode 100644
index 000000000000..1b62f3f8cbac
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.hrc
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "sc.hrc" // -> RID_SCDLG_SORT
+ // -> RID_SCPAGE_SORT_FIELDS
+ // -> RID_SCPAGE_SORT_OPTIONS
+ // -> SCSTR_NONAME
+ // -> SCSTR_UNDEFINED
+ // -> SCSTR_FIELD
+
+#define TP_FIELDS 1
+#define TP_OPTIONS 2
+
+// TP_SORT_FIELDS:
+#define FL_SORT1 1
+#define FL_SORT2 2
+#define FL_SORT3 3
+#define LB_SORT1 4
+#define LB_SORT2 5
+#define LB_SORT3 6
+#define BTN_UP1 7
+#define BTN_UP2 8
+#define BTN_UP3 9
+#define BTN_DOWN1 10
+#define BTN_DOWN2 11
+#define BTN_DOWN3 12
+
+// TP_SORT_OPTIONS:
+#define FL_DIRECTION 1
+#define LB_SORT_USER 2
+#define LB_OUTAREA 3
+#define ED_OUTAREA 4
+#define BTN_SORT_USER 7
+#define BTN_CASESENSITIVE 8
+#define BTN_LABEL 9
+#define BTN_FORMATS 10
+#define BTN_COPYRESULT 11
+#define BTN_TOP_DOWN 12
+#define BTN_LEFT_RIGHT 13
+#define STR_COL_LABEL 14
+#define STR_ROW_LABEL 15
+#define FT_LANGUAGE 16
+#define LB_LANGUAGE 17
+#define FT_ALGORITHM 18
+#define LB_ALGORITHM 19
+#define BTN_NATURALSORT 20
diff --git a/toolkit/workben/layout/sortdlg.hxx b/toolkit/workben/layout/sortdlg.hxx
new file mode 100644
index 000000000000..c63f24989aca
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_SORTDLG_HXX
+#define SC_SORTDLG_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+#if TEST_LAYOUT
+#define LAYOUT_SFX_TABDIALOG_BROKEN 0
+#else /* !TEST_LAYOUT */
+#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
+#define LAYOUT_SFX_TABDIALOG_BROKEN 1
+#endif /* !LAYOUT_SFX_TABDIALOG_BROKEN */
+#endif /* !TEST_LAYOUT */
+
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <sfx2/layout.hxx>
+#include <layout/layout-pre.hxx>
+#endif
+
+class ScSortDlg : public SfxTabDialog
+{
+public:
+ ScSortDlg( Window* pParent,
+ const SfxItemSet* pArgSet );
+ ~ScSortDlg();
+
+ void SetHeaders( BOOL bHeaders );
+ void SetByRows ( BOOL bByRows );
+ BOOL GetHeaders() const;
+ BOOL GetByRows () const;
+
+
+private:
+ BOOL bIsHeaders;
+ BOOL bIsByRows;
+};
+
+inline void ScSortDlg::SetHeaders( BOOL bHeaders ) { bIsHeaders = bHeaders; }
+inline void ScSortDlg::SetByRows ( BOOL bByRows ) { bIsByRows = bByRows; }
+inline BOOL ScSortDlg::GetHeaders() const { return bIsHeaders; }
+inline BOOL ScSortDlg::GetByRows () const { return bIsByRows; }
+
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <layout/layout-post.hxx>
+#endif
+
+#endif // SC_SORTDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/sortdlg.src b/toolkit/workben/layout/sortdlg.src
new file mode 100644
index 000000000000..f52758f61785
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.src
@@ -0,0 +1,331 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "sortdlg.hrc"
+TabPage RID_SCPAGE_SORT_FIELDS
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpId = HID_SCPAGE_SORT_FIELDS ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ ListBox LB_SORT1
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_FIELDS:LB_SORT1";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 19 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP1
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_UP1";
+ Pos = MAP_APPFONT ( 172 , 14 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "~Ascending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN1
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_DOWN1";
+ Pos = MAP_APPFONT ( 172 , 28 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "~Descending" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SORT1
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Sort ~by" ;
+ };
+ ListBox LB_SORT2
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_FIELDS:LB_SORT2";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP2
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_UP2";
+ Pos = MAP_APPFONT ( 172 , 55 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "A~scending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN2
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_DOWN2";
+ Pos = MAP_APPFONT ( 172 , 69 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "D~escending" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SORT2
+ {
+ Pos = MAP_APPFONT ( 6 , 44 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Then b~y" ;
+ };
+ ListBox LB_SORT3
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_FIELDS:LB_SORT3";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 101 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP3
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_UP3";
+ Pos = MAP_APPFONT ( 172 , 96 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "As~cending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN3
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_DOWN3";
+ Pos = MAP_APPFONT ( 172 , 110 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "Desce~nding" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SORT3
+ {
+ Pos = MAP_APPFONT ( 6 , 85 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "T~hen by" ;
+ };
+};
+
+TabPage RID_SCPAGE_SORT_OPTIONS
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpId = HID_SCPAGE_SORT_OPTIONS ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ CheckBox BTN_CASESENSITIVE
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_CASESENSITIVE";
+ Pos = MAP_APPFONT ( 12 , 6 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Case ~sensitive" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_LABEL
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_LABEL";
+ Pos = MAP_APPFONT ( 12 , 20 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_COL_LABEL
+ {
+ Text [ en-US ] = "Range contains column la~bels" ;
+ };
+ String STR_ROW_LABEL
+ {
+ Text [ en-US ] = "Range contains ~row labels" ;
+ };
+ CheckBox BTN_FORMATS
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_FORMATS";
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Include ~formats" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_NATURALSORT
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_NATURALSORT";
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ de ] = "Enable ~natural sort" ;
+ Text [ en-US ] = "Enable ~natural sort" ;
+ Text [ cs ] = "Aktivovat přirozené třídění" ;
+ Text [ sk ] = "Aktivovať prirodzené triedenie" ;
+ TabStop = TRUE ;
+ Text [ x-comment ] = " " ;
+ };
+ CheckBox BTN_COPYRESULT
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_COPYRESULT";
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "~Copy sort results to:" ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_OUTAREA
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_OPTIONS:LB_OUTAREA";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 20 , 73 ) ;
+ Size = MAP_APPFONT ( 93 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ Edit ED_OUTAREA
+ {
+ HelpID = "toolkit:Edit:RID_SCPAGE_SORT_OPTIONS:ED_OUTAREA";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 119 , 73 ) ;
+ Size = MAP_APPFONT ( 132 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_SORT_USER
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_SORT_USER";
+ Pos = MAP_APPFONT ( 12 , 89 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Custom sort ~order" ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_SORT_USER
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_OPTIONS:LB_SORT_USER";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 20 , 100 ) ;
+ Size = MAP_APPFONT ( 231 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 12 , 118 ) ;
+ Size = MAP_APPFONT ( 101 , 8 ) ;
+ Text [ en-US ] = "~Language";
+ };
+ ListBox LB_LANGUAGE
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_OPTIONS:LB_LANGUAGE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 129 ) ;
+ Size = MAP_APPFONT ( 101 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_ALGORITHM
+ {
+ Pos = MAP_APPFONT ( 119 , 118 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "O~ptions";
+ };
+ ListBox LB_ALGORITHM
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_OPTIONS:LB_ALGORITHM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 119 , 129 ) ;
+ Size = MAP_APPFONT ( 132 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedLine FL_DIRECTION
+ {
+ Pos = MAP_APPFONT ( 6 , 147 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Direction" ;
+ };
+ RadioButton BTN_TOP_DOWN
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_OPTIONS:BTN_TOP_DOWN";
+ Pos = MAP_APPFONT ( 12 , 158 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "~Top to bottom (sort rows)" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_LEFT_RIGHT
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_OPTIONS:BTN_LEFT_RIGHT";
+ Pos = MAP_APPFONT ( 12 , 172 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "L~eft to right (sort columns)" ;
+ TabStop = TRUE ;
+ };
+};
+
+TabDialog RID_SCDLG_SORT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 220 , 175 ) ;
+ Text [ en-US ] = "Sort" ;
+ Moveable = TRUE ;
+ Closeable = FALSE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 210 , 170 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FIELDS ;
+ PageResID = TP_FIELDS ;
+ Text [ en-US ] = "Sort Criteria" ;
+ };
+ PageItem
+ {
+ Identifier = TP_OPTIONS ;
+ PageResID = TP_OPTIONS ;
+ Text [ en-US ] = "Options" ;
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 3 , 157 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 49 , 157 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 137 , 157 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 94 , 157 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ };
+};
diff --git a/toolkit/workben/layout/sortdlg.xml b/toolkit/workben/layout/sortdlg.xml
new file mode 100644
index 000000000000..ce45a60ff1ee
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<tabpage help-id="HID_SCPAGE_SORT_FIELDS" hide="true" id="RID_SCPAGE_SORT_FIELDS" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox>
+ <fixedline id="FL_SORT1" text="Sort ~by"/>
+ <radiobutton id="BTN_UP1" tabstop="true" label="~Ascending"/>
+ <listbox has_border="true" dropdown="true" id="LB_SORT1" tabstop="true"/>
+ <radiobutton id="BTN_DOWN1" tabstop="true" label="~Descending"/>
+ <fixedline id="FL_SORT2" text="Then b~y"/>
+ <radiobutton id="BTN_UP2" tabstop="true" label="A~scending"/>
+ <listbox has_border="true" dropdown="true" id="LB_SORT2" tabstop="true"/>
+ <radiobutton id="BTN_DOWN2" tabstop="true" label="D~escending"/>
+ <fixedline id="FL_SORT3" text="T~hen by"/>
+ <radiobutton id="BTN_UP3" tabstop="true" label="As~cending"/>
+ <listbox has_border="true" dropdown="true" id="LB_SORT3" tabstop="true"/>
+ <radiobutton id="BTN_DOWN3" tabstop="true" label="Desce~nding"/>
+ </vbox>
+</tabpage>
+<tabpage help-id="HID_SCPAGE_SORT_OPTIONS" hide="true" id="RID_SCPAGE_SORT_OPTIONS" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <string id="STR_COL_LABEL" text="Range contains column la~bels"/>
+ <string id="STR_ROW_LABEL" text="Range contains ~row labels"/>
+ <vbox>
+ <checkbox id="BTN_CASESENSITIVE" tabstop="true" label="Case ~sensitive"/>
+ <checkbox id="BTN_LABEL" tabstop="true"/>
+ <checkbox id="BTN_FORMATS" tabstop="true" label="Include ~formats"/>
+ <checkbox id="BTN_NATURALSORT" tabstop="true" label=" "/>
+ <checkbox id="BTN_COPYRESULT" tabstop="true" label="~Copy sort results to:"/>
+ <hbox>
+ <listbox has_border="true" dropdown="true" id="LB_OUTAREA" tabstop="true"/>
+ <edit has_border="true" disable="true" id="ED_OUTAREA" tabstop="true"/>
+ </hbox>
+ <checkbox id="BTN_SORT_USER" tabstop="true" label="Custom sort ~order"/>
+ <listbox has_border="true" disable="true" dropdown="true" id="LB_SORT_USER" tabstop="true"/>
+ <hbox>
+ <fixedtext id="FT_LANGUAGE" label="~Language"/>
+ <fixedtext id="FT_ALGORITHM" label="O~ptions"/>
+ </hbox>
+ <hbox>
+ <listbox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" tabstop="true"/>
+ <listbox has_border="true" dropdown="true" id="LB_ALGORITHM" tabstop="true"/>
+ </hbox>
+ <fixedline id="FL_DIRECTION" text="Direction"/>
+ <radiobutton id="BTN_TOP_DOWN" tabstop="true" label="~Top to bottom (sort rows)"/>
+ <radiobutton id="BTN_LEFT_RIGHT" tabstop="true" label="L~eft to right (sort columns)"/>
+ </vbox>
+</tabpage>
+<tabdialog closeable="false" moveable="true" output-size="true" id="RID_SCDLG_SORT" sv-look="true" text="Sort" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox>
+ <tabcontrol output-size="true" id="1">
+ <pagelist>
+ <pageitem identifier="TP_FIELDS" page-res-id="TP_FIELDS" text="Sort Criteria"/>
+ <pageitem identifier="TP_OPTIONS" page-res-id="TP_OPTIONS" text="Options"/>
+ </pagelist>
+ </tabcontrol>
+ <hbox>
+ <okbutton defbutton="true" id="1" tabstop="true"/>
+ <cancelbutton id="1" tabstop="true"/>
+ <helpbutton id="1" tabstop="true"/>
+ <pushbutton id="1" tabstop="true"/>
+ </hbox>
+ </vbox>
+</tabdialog>
diff --git a/toolkit/workben/layout/splitter.xml b/toolkit/workben/layout/splitter.xml
new file mode 100644
index 000000000000..634ad829b001
--- /dev/null
+++ b/toolkit/workben/layout/splitter.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Splitter Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <hsplitter>
+ <pushbutton label="Left" />
+ <pushbutton label="Right" />
+ </hsplitter>
+ <okbutton cnt:expand="false" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/string-input.xml b/toolkit/workben/layout/string-input.xml
new file mode 100644
index 000000000000..b1aed5197c17
--- /dev/null
+++ b/toolkit/workben/layout/string-input.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog sizeable="true" closeable="false" moveable="true" output-size="true" id="RID_SCDLG_STRINPUT" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container" title="Insert String">
+ <vbox spacing="5" border="5">
+ <fixedtext id="FT_LABEL" label="FT-LABEL"/>
+ <edit has_border="true" id="ED_INPUT" tabstop="true"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <okbutton defbutton="true" id="BTN_OK" tabstop="true"/>
+ <cancelbutton id="BTN_CANCEL" tabstop="true"/>
+ <helpbutton id="BTN_HELP" tabstop="true"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/tab-dialog.xml b/toolkit/workben/layout/tab-dialog.xml
new file mode 100644
index 000000000000..da75f03e9df5
--- /dev/null
+++ b/toolkit/workben/layout/tab-dialog.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ _title="layout::TabDialog" optimumsize="true"
+ id="tab-dialog"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5">
+ <tabcontrol id="ID_TABCONTROL"/>
+ <dialogbuttonhbox border="5" spacing="5" cnt:expand="false">
+ <flow/>
+ <okbutton defbutton="true" id="BTN_OK" show="false"/>
+ <pushbutton id="BTN_USER" _label="&lt;User&gt;" show="false"/>
+ <cancelbutton id="BTN_CANCEL" show="false"/>
+ <helpbutton id="BTN_HELP" show="false"/>
+ <resetbutton id="BTN_RESET" show="false"/>
+ <pushbutton id="BTN_BASEFMT" _label="&lt;Base Format&gt;" show="false"/>
+ </dialogbuttonhbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/tabcontrol.xml b/toolkit/workben/layout/tabcontrol.xml
new file mode 100644
index 000000000000..2986f1f9e0d9
--- /dev/null
+++ b/toolkit/workben/layout/tabcontrol.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="TabControl Test" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <tabcontrol>
+ <pushbutton label="Child 1" cnt:title="Page 1" />
+ <edit has_border="true" text="Child 2" cnt:title="Page 2" />
+ <vbox cnt:title="Page 3">
+ <pushbutton label="Child 3"/>
+ <edit has_border="true" text="Child 4" />
+ </vbox>
+ </tabcontrol>
+ <okbutton cnt:expand="false" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/table.xml b/toolkit/workben/layout/table.xml
new file mode 100644
index 000000000000..673bd85ddab3
--- /dev/null
+++ b/toolkit/workben/layout/table.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Table Test" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <table columns="3">
+ <!-- row 0 -->
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <!-- row 1 -->
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+</dialog>
diff --git a/toolkit/workben/layout/test.cxx b/toolkit/workben/layout/test.cxx
new file mode 100644
index 000000000000..f90317a5ae37
--- /dev/null
+++ b/toolkit/workben/layout/test.cxx
@@ -0,0 +1,369 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <vcl/svapp.hxx>
+
+// This works and was used before for standalone test, not sure why
+// we'd want it.
+#define LAYOUT_WEAK 1
+#include "uno.hxx"
+
+#include <cstdio>
+#include <cstdlib>
+#include <sys/stat.h>
+
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <rtl/ustring.hxx>
+#include <ucbhelper/configurationkeys.hxx>
+#include <ucbhelper/contentbroker.hxx>
+
+#define SORT_DLG 1 /* requires sfx2, svx to be compiled */
+#if SORT_DLG
+#include "scitems.hxx"
+#include "uiitems.hxx"
+#endif /* SORT_DLG */
+
+#include "editor.hxx"
+
+#include "plugin.hxx"
+#undef _LAYOUT_POST_HXX
+
+#include "recover.hxx"
+#undef _LAYOUT_POST_HXX
+
+#if SORT_DLG
+#include "sortdlg.hxx"
+#undef _LAYOUT_POST_HXX
+#endif /* SORT_DLG */
+
+#include "wordcountdialog.hxx"
+#undef _LAYOUT_POST_HXX
+
+#include "zoom.hxx"
+#undef _LAYOUT_POST_HXX
+
+#include <layout/layout-pre.hxx>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+class LayoutTest : public Application
+{
+ Reference< XComponentContext > mxContext;
+ Reference< lang::XMultiServiceFactory > mxMSF;
+ OUString mInstallDir;
+ OUString mTestDialog;
+ bool mEditMode;
+ std::list< OUString > mFiles;
+
+public:
+ LayoutTest( char const* installDir );
+
+ void RunEditor();
+ void RunFiles();
+ void ExceptionalMain();
+ void Init();
+ void InitUCB();
+ void LoadFile( OUString const &aName );
+ void Main();
+ void ParseCommandLine();
+};
+
+static void usage()
+{
+ fprintf (stderr, "usage: test [--inst OOO_INSTALL_PREFIX] [DIALOG.XML]... | --test [DIALOG.XML]\n" );
+ exit( 2 );
+}
+
+static uno::Reference< lang::XSingleServiceFactory > get_factory( char const *service )
+{
+ uno::Reference< lang::XSingleServiceFactory > xFactory(
+ comphelper::createProcessComponent(
+ rtl::OUString::createFromAscii( service ) ), uno::UNO_QUERY );
+
+ if ( !xFactory.is() )
+ fprintf( stderr, "error loading: %s\n", service );
+ return xFactory;
+}
+
+#define GET_FACTORY(x) get_factory( #x )
+
+void LayoutTest::LoadFile( const OUString &aTestFile )
+{
+ fprintf( stderr, "TEST: layout instance\n" );
+
+ uno::Reference< lang::XSingleServiceFactory > xFactory
+ = GET_FACTORY( com.sun.star.awt.Layout );
+ if ( !xFactory.is() )
+ {
+ fprintf( stderr, "Layout engine not installed\n" );
+ throw uno::RuntimeException(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Layout engine not installed" ) ),
+ uno::Reference< uno::XInterface >() );
+ }
+ fprintf( stderr, "TEST: initing root\n" );
+
+ uno::Sequence< uno::Any > aParams( 1 );
+ aParams[0] <<= aTestFile;
+
+ uno::Reference< awt::XLayoutRoot > xRoot (
+ xFactory->createInstanceWithArguments( aParams ),
+ uno::UNO_QUERY );
+
+ fprintf( stderr, "TEST: file loaded\n" );
+}
+
+void LayoutTest::InitUCB()
+{
+ OUString aEmpty;
+ Sequence< Any > aArgs( 6 );
+ aArgs[0]
+ <<= OUString(RTL_CONSTASCII_USTRINGPARAM( UCB_CONFIGURATION_KEY1_LOCAL ));
+ aArgs[1]
+ <<= OUString(RTL_CONSTASCII_USTRINGPARAM( UCB_CONFIGURATION_KEY2_OFFICE ));
+ aArgs[2] <<= OUString(RTL_CONSTASCII_USTRINGPARAM("PIPE"));
+ aArgs[3] <<= aEmpty;
+ aArgs[4] <<= OUString(RTL_CONSTASCII_USTRINGPARAM("PORTAL"));
+ aArgs[5] <<= aEmpty;
+
+ if ( !::ucbhelper::ContentBroker::initialize( mxMSF, aArgs ) )
+ {
+ fprintf( stderr, "Failed to init content broker\n" );
+ fprintf( stderr, "arg[0]: %s\n", UCB_CONFIGURATION_KEY1_LOCAL );
+ fprintf( stderr, "arg[1]: %s\n", UCB_CONFIGURATION_KEY2_OFFICE );
+ }
+}
+
+static void support_upstream_brand_prefix ()
+{
+ if ( char const* inst = getenv( "OOO_INSTALL_PREFIX" ) )
+ {
+ char const *brand_prefix = "/openoffice.org3";
+ OUString brand_dir = OUString::createFromAscii( inst )
+ + OUString::createFromAscii( brand_prefix );
+ struct stat stat_info;
+ if ( !stat ( OUSTRING_CSTR( brand_dir ), &stat_info ) )
+ {
+ OSL_TRACE( "Appending %s to OOO_INSTALL_PREFIX", brand_prefix );
+ setenv( "OOO_INSTALL_PREFIX", OUSTRING_CSTR( brand_dir ), 1 );
+ }
+ }
+}
+
+void LayoutTest::Init()
+{
+ ParseCommandLine();
+ setenv( "OOO_INSTALL_PREFIX", OUSTRING_CSTR( mInstallDir ), 0 );
+ support_upstream_brand_prefix ();
+ OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) );
+
+ mxContext = defaultBootstrap_InitialComponentContext();
+ mxMSF = new UnoBootstrapLayout( Reference< lang::XMultiServiceFactory >( mxContext->getServiceManager(), UNO_QUERY ) );
+ ::comphelper::setProcessServiceFactory( mxMSF );
+ InitUCB();
+}
+
+void LayoutTest::ParseCommandLine()
+{
+ printf ("%s\n", __PRETTY_FUNCTION__);
+ for ( sal_uInt16 i = 0; i < GetCommandLineParamCount(); i++ )
+ {
+ OUString aParam = OUString( GetCommandLineParam( i ) );
+ if ( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-h" ) ) || aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--help" ) ) )
+ usage();
+ if ( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--inst" ) ) )
+ {
+ if ( i >= GetCommandLineParamCount() - 1)
+ usage();
+ mInstallDir = GetCommandLineParam( ++i );
+ setenv( "OOO_INSTALL_PREFIX", OUSTRING_CSTR( mInstallDir ), 1 );
+ }
+ else if ( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--test" ) ) )
+ {
+ mTestDialog = OUString(RTL_CONSTASCII_USTRINGPARAM("zoom"));
+ if (i + 1 < GetCommandLineParamCount())
+ mTestDialog = GetCommandLineParam( ++i );
+ }
+ else if ( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--editor" ) ) )
+ mEditMode = true;
+ else
+ mFiles.push_back( aParam );
+ }
+
+ if ( mFiles.size() <= 0 )
+ mFiles.push_back( OUString(RTL_CONSTASCII_USTRINGPARAM("layout.xml")) );
+}
+
+void LayoutTest::RunEditor()
+{
+ OUString aFile;
+ if ( !mFiles.empty()
+ && mFiles.front().compareToAscii( "layout.xml" ) != 0 )
+ aFile = mFiles.front();
+ Editor editor( mxMSF, aFile );
+ editor.Show();
+ editor.Execute();
+}
+
+short RunDialog( Dialog& dialog )
+{
+ dialog.Show();
+ short result = dialog.Execute();
+ fprintf( stderr, "Done: dialog execute exited:%d\n", result);
+ return result;
+}
+
+#undef Dialog
+short RunDialog( ::Dialog& dialog )
+{
+ dialog.Show();
+ short result = dialog.Execute();
+ fprintf( stderr, "Done: dialog execute exited:%d\n", result);
+ return result;
+}
+
+#if SORT_DLG
+static void LoadSC()
+{
+ get_factory( "com.sun.star.comp.sfx2.DocumentTemplates" );
+ get_factory( "com.sun.star.comp.Calc.SpreadsheetDocument" );
+ GET_FACTORY( com.sun.star.i18n.Transliteration.l10n );
+}
+#endif /* SORT_DLG */
+
+void TestDialog( OUString const& name )
+{
+ if ( 0 )
+ ;
+ else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "plugin" ) ) )
+ {
+ PluginDialog plugin ( 0 );
+ RunDialog( plugin );
+ }
+ else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "query" ) ) )
+ {
+ QueryBox query ( 0, "Do you want to do?", "do");
+ RunDialog( query );
+ }
+ else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "query-compat" ) ) )
+ {
+ QueryBox query ( 0,
+ WinBits( WB_YES_NO | WB_DEF_YES ),
+// WinBits( WB_ABORT_RETRY_IGNORE ),
+ OUString(RTL_CONSTASCII_USTRINGPARAM ("Do you want to do?")));
+ RunDialog( query );
+ }
+ else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "recover" ) ) )
+ {
+ SvxRecoverDialog recover ( 0 );
+ RunDialog( recover );
+ }
+#if SORT_DLG
+ else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sort" ) ) )
+ {
+ LoadSC();
+ ScSortDlg sort (0, 0);
+ RunDialog( sort );
+ }
+#endif /* SORT_DLG */
+ else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "wordcount" ) ) )
+ {
+ SwWordCountDialog words ( 0 );
+ RunDialog( words );
+ }
+ else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "zoom" ) ) )
+ {
+ SvxZoomDialog zoom( 0 );
+ RunDialog( zoom );
+ }
+}
+
+void LayoutTest::RunFiles()
+{
+ fprintf( stderr, "TEST: loading files\n" );
+ for ( std::list< OUString >::iterator i = mFiles.begin(); i != mFiles.end(); ++i )
+ LoadFile( *i );
+ fprintf( stderr, "TEST: executing\n" );
+ Execute();
+ fprintf( stderr, "TEST: done executing\n" );
+}
+
+void LayoutTest::ExceptionalMain()
+{
+ if ( mTestDialog.getLength() )
+ TestDialog( mTestDialog );
+ else if ( mEditMode )
+ RunEditor();
+ else
+ RunFiles();
+}
+
+void LayoutTest::Main()
+{
+ try
+ {
+ ExceptionalMain();
+ }
+ catch (xml::sax::SAXException & rExc)
+ {
+ OString aStr( OUStringToOString( rExc.Message,
+ RTL_TEXTENCODING_ASCII_US ) );
+ uno::Exception exc;
+ if (rExc.WrappedException >>= exc)
+ {
+ aStr += OString( " >>> " );
+ aStr += OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US );
+ }
+ fprintf (stderr, "Parsing error: '%s'\n", aStr.getStr());
+ OSL_FAIL( aStr.getStr() );
+ }
+ catch ( uno::Exception & rExc )
+ {
+ OString aStr( OUStringToOString( rExc.Message,
+ RTL_TEXTENCODING_ASCII_US ) );
+ fprintf (stderr, "UNO error: '%s'\n", aStr.getStr());
+ OSL_FAIL( aStr.getStr() );
+ }
+
+ Reference< lang::XComponent > xComp( mxContext, UNO_QUERY );
+ if ( xComp.is() )
+ xComp->dispose();
+}
+
+LayoutTest::LayoutTest( char const* installDir )
+ : mInstallDir( OUString::createFromAscii ( installDir ) )
+{
+}
+
+LayoutTest layout_test( "/usr/local/lib/ooo" );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/test.xml b/toolkit/workben/layout/test.xml
new file mode 100644
index 000000000000..d0b4f9062912
--- /dev/null
+++ b/toolkit/workben/layout/test.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Interactable Containers" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <tabcontrol>
+ <tabpage cnt:title="Page">
+ <pushbutton label="Test" />
+ </tabpage>
+ </tabcontrol>
+</dialog>
diff --git a/toolkit/workben/layout/testrc.in b/toolkit/workben/layout/testrc.in
new file mode 100644
index 000000000000..00ae5eb3cd5e
--- /dev/null
+++ b/toolkit/workben/layout/testrc.in
@@ -0,0 +1,12 @@
+OOO_INSTALL_PREFIX_URL=file://${OOO_INSTALL_PREFIX}
+OOO_BASIS_URL=${OOO_INSTALL_PREFIX_URL}/basis-link
+OOO_BASIS_BIN_URL=${OOO_BASIS_URL}/program
+OOO_URE_URL=${OOO_BASIS_URL}/ure-link
+#
+#CFG_INIFILE=${OOO_BASIS_BIN_URL}/configmgrrc
+#BaseInstallation=${OOO_BASIS_URL}
+BRAND_BASE_DIR=${OOO_INSTALL_PREFIX_URL}
+OOO_BASE_DIR=${OOO_BASIS_URL}
+#
+UNO_TYPES=${OOO_URE_URL}/share/misc/types.rdb ${OOO_BASIS_BIN_URL}/offapi.rdb
+UNO_SERVICES=${OOO_URE_URL}/share/misc/services.rdb ${OOO_BASIS_BIN_URL}/services.rdb
diff --git a/toolkit/workben/layout/tpsort.cxx b/toolkit/workben/layout/tpsort.cxx
new file mode 100644
index 000000000000..ff8526c890aa
--- /dev/null
+++ b/toolkit/workben/layout/tpsort.cxx
@@ -0,0 +1,1107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#if !TEST_LAYOUT
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+#endif /* !TEST_LAYOUT */
+
+#undef SC_DLLIMPLEMENTATION
+
+
+
+#include <vcl/msgbox.hxx>
+#include <i18npool/mslangid.hxx>
+#include <svtools/collatorres.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include "scitems.hxx"
+#include "uiitems.hxx"
+#include "viewdata.hxx"
+#include "document.hxx"
+#include "global.hxx"
+#include "dbcolect.hxx"
+#include "userlist.hxx"
+#include "rangeutl.hxx"
+#include "scresid.hxx"
+#include "sc.hrc" // -> Slot IDs
+#include "globstr.hrc"
+
+#include "sortdlg.hxx"
+#include "sortdlg.hrc"
+
+#define _TPSORT_CXX
+#include "tpsort.hxx"
+#undef _TPSORT_CXX
+
+using namespace com::sun::star;
+
+// STATIC DATA -----------------------------------------------------------
+
+static USHORT pSortRanges[] =
+{
+ SID_SORT,
+ SID_SORT,
+ 0
+};
+
+// -----------------------------------------------------------------------
+
+/*
+ * Da sich Einstellungen auf der zweiten TabPage (Optionen) auf
+ * die erste TabPage auswirken, muss es die Moeglichkeit geben,
+ * dies der jeweils anderen Seite mitzuteilen.
+ *
+ * Im Moment wird dieses Problem ueber zwei Datenmember des TabDialoges
+ * geloest. Wird eine Seite Aktiviert/Deaktiviert, so gleicht sie diese
+ * Datenmember mit dem eigenen Zustand ab (->Activate()/Deactivate()).
+ *
+ * 31.01.95:
+ * Die Klasse SfxTabPage bietet mittlerweile ein Verfahren an:
+ *
+ * virtual BOOL HasExchangeSupport() const; -> return TRUE;
+ * virtual void ActivatePage(const SfxItemSet &);
+ * virtual int DeactivatePage(SfxItemSet * = 0);
+ *
+ * muss noch geaendert werden!
+ */
+
+//========================================================================
+//========================================================================
+// Sortierkriterien-Tabpage:
+
+ScTabPageSortFields::ScTabPageSortFields( Window* pParent,
+ const SfxItemSet& rArgSet )
+
+ : SfxTabPage ( pParent,
+ ScResId( RID_SCPAGE_SORT_FIELDS ),
+ rArgSet ),
+ //
+ aFlSort1 ( this, ScResId( FL_SORT1 ) ),
+ aLbSort1 ( this, ScResId( LB_SORT1 ) ),
+ aBtnUp1 ( this, ScResId( BTN_UP1 ) ),
+ aBtnDown1 ( this, ScResId( BTN_DOWN1 ) ),
+ //
+ aFlSort2 ( this, ScResId( FL_SORT2 ) ),
+ aLbSort2 ( this, ScResId( LB_SORT2 ) ),
+ aBtnUp2 ( this, ScResId( BTN_UP2 ) ),
+ aBtnDown2 ( this, ScResId( BTN_DOWN2 ) ),
+ //
+ aFlSort3 ( this, ScResId( FL_SORT3 ) ),
+ aLbSort3 ( this, ScResId( LB_SORT3 ) ),
+ aBtnUp3 ( this, ScResId( BTN_UP3 ) ),
+ aBtnDown3 ( this, ScResId( BTN_DOWN3 ) ),
+
+ aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ),
+ aStrColumn ( ScResId( SCSTR_COLUMN ) ),
+ aStrRow ( ScResId( SCSTR_ROW ) ),
+ //
+#if !TEST_LAYOUT
+ nWhichSort ( rArgSet.GetPool()->GetWhich( SID_SORT ) ),
+#else /* TEST_LAYOUT */
+ nWhichSort ( 0 ),
+#endif /* TEST_LAYOUT */
+ pDlg ( (ScSortDlg*)(GetParent()->GetParent()) ),
+ pViewData ( NULL ),
+#if !TEST_LAYOUT
+ rSortData ( ((const ScSortItem&)
+ rArgSet.Get( nWhichSort )).
+ GetSortData() ),
+#else /* TEST_LAYOUT */
+ rSortData ( *new ScSortParam() ),
+#endif /* TEST_LAYOUT */
+ nFieldCount ( 0 ),
+ bHasHeader ( FALSE ),
+ bSortByRows ( FALSE )
+{
+ Init();
+ FreeResource();
+ SetExchangeSupport();
+}
+
+// -----------------------------------------------------------------------
+
+ScTabPageSortFields::~ScTabPageSortFields()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortFields::Init()
+{
+#if !TEST_LAYOUT
+ const ScSortItem& rSortItem = (const ScSortItem&)
+ GetItemSet().Get( nWhichSort );
+
+ pViewData = rSortItem.GetViewData();
+
+ DBG_ASSERT( pViewData, "ViewData not found!" );
+#endif /* !TEST_LAYOUT */
+
+ nFieldArr[0] = 0;
+ nFirstCol = 0;
+ nFirstRow = 0;
+
+ aLbSort1.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
+ aLbSort2.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
+ aLbSort3.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
+ aLbSort1.Clear();
+ aLbSort2.Clear();
+ aLbSort3.Clear();
+
+ aSortLbArr[0] = &aLbSort1;
+ aSortLbArr[1] = &aLbSort2;
+ aSortLbArr[2] = &aLbSort3;
+ aDirBtnArr[0][0] = &aBtnUp1;
+ aDirBtnArr[0][1] = &aBtnDown1;
+ aDirBtnArr[1][0] = &aBtnUp2;
+ aDirBtnArr[1][1] = &aBtnDown2;
+ aDirBtnArr[2][0] = &aBtnUp3;
+ aDirBtnArr[2][1] = &aBtnDown3;
+ aFlArr[0] = &aFlSort1;
+ aFlArr[1] = &aFlSort2;
+ aFlArr[2] = &aFlSort3;
+}
+
+//------------------------------------------------------------------------
+
+USHORT* ScTabPageSortFields::GetRanges()
+{
+ return pSortRanges;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* ScTabPageSortFields::Create( Window* pParent,
+ const SfxItemSet& rArgSet )
+{
+ return ( new ScTabPageSortFields( pParent, rArgSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
+{
+ bSortByRows = rSortData.bByRow;
+ bHasHeader = rSortData.bHasHeader;
+
+ if ( aLbSort1.GetEntryCount() == 0 )
+ FillFieldLists();
+
+ // Selektieren der ListBoxen:
+
+ if ( rSortData.bDoSort[0] )
+ {
+ for ( USHORT i=0; i<3; i++ )
+ {
+ if ( rSortData.bDoSort[i] )
+ {
+ aSortLbArr[i]->SelectEntryPos(
+ GetFieldSelPos( rSortData.nField[i] ) );
+
+ (rSortData.bAscending[i])
+ ? aDirBtnArr[i][0]->Check() // Up
+ : aDirBtnArr[i][1]->Check(); // Down
+ }
+ else
+ {
+ aSortLbArr[i]->SelectEntryPos( 0 ); // "keiner" selektieren
+ aDirBtnArr[i][0]->Check(); // Up
+ }
+ }
+
+ EnableField( 1 );
+ EnableField( 2 );
+ EnableField( 3 );
+ if ( aLbSort1.GetSelectEntryPos() == 0 )
+ DisableField( 2 );
+ if ( aLbSort2.GetSelectEntryPos() == 0 )
+ DisableField( 3 );
+ }
+ else
+ {
+ aLbSort1.SelectEntryPos( 1 );
+ aLbSort2.SelectEntryPos( 0 );
+ aLbSort3.SelectEntryPos( 0 );
+ aBtnUp1.Check();
+ aBtnUp2.Check();
+ aBtnUp3.Check();
+ EnableField ( 1 );
+ EnableField ( 2 );
+ DisableField( 3 );
+ }
+
+ if ( pDlg )
+ {
+ pDlg->SetByRows ( bSortByRows );
+ pDlg->SetHeaders( bHasHeader );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet )
+{
+ ScSortParam theSortData = rSortData;
+ if (pDlg)
+ {
+ const SfxItemSet* pExample = pDlg->GetExampleSet();
+ const SfxPoolItem* pItem;
+ if ( pExample && pExample->GetItemState( nWhichSort, TRUE, &pItem ) == SFX_ITEM_SET )
+ theSortData = ((const ScSortItem*)pItem)->GetSortData();
+ }
+
+ USHORT nSort1Pos = aLbSort1.GetSelectEntryPos();
+ USHORT nSort2Pos = aLbSort2.GetSelectEntryPos();
+ USHORT nSort3Pos = aLbSort3.GetSelectEntryPos();
+
+ DBG_ASSERT( (nSort1Pos <= SC_MAXFIELDS)
+ && (nSort2Pos <= SC_MAXFIELDS)
+ && (nSort3Pos <= SC_MAXFIELDS),
+ "Array-Range Fehler!" );
+
+ if ( nSort1Pos == LISTBOX_ENTRY_NOTFOUND ) nSort1Pos = 0;
+ if ( nSort2Pos == LISTBOX_ENTRY_NOTFOUND ) nSort2Pos = 0;
+ if ( nSort3Pos == LISTBOX_ENTRY_NOTFOUND ) nSort3Pos = 0;
+
+ if ( nSort1Pos > 0 )
+ {
+ theSortData.bDoSort[0] = (nSort1Pos > 0);
+ theSortData.bDoSort[1] = (nSort2Pos > 0);
+ theSortData.bDoSort[2] = (nSort3Pos > 0);
+
+ // wenn auf Optionen-Seite "OK" gewaehlt wurde und
+ // dabei die Sortierrichtung umgestellt wurde, so
+ // wird das erste Feld der jeweiligen Richtung als
+ // Sortierkriterium gewaehlt (steht in nFieldArr[0]):
+ if ( bSortByRows != pDlg->GetByRows() )
+ {
+ theSortData.nField[0] =
+ theSortData.nField[1] =
+ theSortData.nField[2] = ( bSortByRows ?
+ static_cast<SCCOLROW>(nFirstRow) :
+ static_cast<SCCOLROW>(nFirstCol) );
+ }
+ else
+ {
+ theSortData.nField[0] = nFieldArr[nSort1Pos];
+ theSortData.nField[1] = nFieldArr[nSort2Pos];
+ theSortData.nField[2] = nFieldArr[nSort3Pos];
+ }
+
+ theSortData.bAscending[0] = aBtnUp1.IsChecked();
+ theSortData.bAscending[1] = aBtnUp2.IsChecked();
+ theSortData.bAscending[2] = aBtnUp3.IsChecked();
+ // bHasHeader ist in ScTabPageSortOptions::FillItemSet, wo es hingehoert
+ }
+ else
+ {
+ theSortData.bDoSort[0] =
+ theSortData.bDoSort[1] =
+ theSortData.bDoSort[2] = FALSE;
+ }
+
+ rArgSet.Put( ScSortItem( SCITEM_SORTDATA, NULL, &theSortData ) );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+// fuer Datenaustausch ohne Dialog-Umweg: (! noch zu tun !)
+// void ScTabPageSortFields::ActivatePage( const SfxItemSet& rSet )
+
+void ScTabPageSortFields::ActivatePage()
+{
+ if ( pDlg )
+ {
+ if ( bHasHeader != pDlg->GetHeaders()
+ || bSortByRows != pDlg->GetByRows() )
+ {
+ USHORT nCurSel1 = aLbSort1.GetSelectEntryPos();
+ USHORT nCurSel2 = aLbSort2.GetSelectEntryPos();
+ USHORT nCurSel3 = aLbSort3.GetSelectEntryPos();
+
+ bHasHeader = pDlg->GetHeaders();
+ bSortByRows = pDlg->GetByRows();
+ FillFieldLists();
+ aLbSort1.SelectEntryPos( nCurSel1 );
+ aLbSort2.SelectEntryPos( nCurSel2 );
+ aLbSort3.SelectEntryPos( nCurSel3 );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int ScTabPageSortFields::DeactivatePage( SfxItemSet* pSetP )
+{
+ if ( pDlg )
+ {
+ if ( bHasHeader != pDlg->GetHeaders() )
+ pDlg->SetHeaders( bHasHeader );
+
+ if ( bSortByRows != pDlg->GetByRows() )
+ pDlg->SetByRows( bSortByRows );
+ }
+
+ if ( pSetP )
+ FillItemSet( *pSetP );
+
+ return SfxTabPage::LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortFields::DisableField( USHORT nField )
+{
+ nField--;
+
+ if ( nField<=2 )
+ {
+ aSortLbArr[nField] ->Disable();
+ aDirBtnArr[nField][0]->Disable();
+ aDirBtnArr[nField][1]->Disable();
+ aFlArr[nField] ->Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortFields::EnableField( USHORT nField )
+{
+ nField--;
+
+ if ( nField<=2 )
+ {
+ aSortLbArr[nField] ->Enable();
+ aDirBtnArr[nField][0]->Enable();
+ aDirBtnArr[nField][1]->Enable();
+ aFlArr[nField] ->Enable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortFields::FillFieldLists()
+{
+ if ( pViewData )
+ {
+ ScDocument* pDoc = pViewData->GetDocument();
+
+ if ( pDoc )
+ {
+ aLbSort1.Clear();
+ aLbSort2.Clear();
+ aLbSort3.Clear();
+ aLbSort1.InsertEntry( aStrUndefined, 0 );
+ aLbSort2.InsertEntry( aStrUndefined, 0 );
+ aLbSort3.InsertEntry( aStrUndefined, 0 );
+
+ SCCOL nFirstSortCol = rSortData.nCol1;
+ SCROW nFirstSortRow = rSortData.nRow1;
+ SCTAB nTab = pViewData->GetTabNo();
+ USHORT i = 1;
+
+ if ( bSortByRows )
+ {
+ String aFieldName;
+ SCCOL nMaxCol = rSortData.nCol2;
+ SCCOL col;
+
+ for ( col=nFirstSortCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )
+ {
+ pDoc->GetString( col, nFirstSortRow, nTab, aFieldName );
+ if ( !bHasHeader || (aFieldName.Len() == 0) )
+ {
+ aFieldName = aStrColumn;
+ aFieldName += ' ';
+ aFieldName += ColToAlpha( col );
+ }
+ nFieldArr[i] = col;
+ aLbSort1.InsertEntry( aFieldName, i );
+ aLbSort2.InsertEntry( aFieldName, i );
+ aLbSort3.InsertEntry( aFieldName, i );
+ i++;
+ }
+ }
+ else
+ {
+ String aFieldName;
+ SCROW nMaxRow = rSortData.nRow2;
+ SCROW row;
+
+ for ( row=nFirstSortRow; row<=nMaxRow && i<SC_MAXFIELDS; row++ )
+ {
+ pDoc->GetString( nFirstSortCol, row, nTab, aFieldName );
+ if ( !bHasHeader || (aFieldName.Len() == 0) )
+ {
+ aFieldName = aStrRow;
+ aFieldName += ' ';
+ aFieldName += String::CreateFromInt32( row+1 );
+ }
+ nFieldArr[i] = row;
+ aLbSort1.InsertEntry( aFieldName, i );
+ aLbSort2.InsertEntry( aFieldName, i );
+ aLbSort3.InsertEntry( aFieldName, i );
+ i++;
+ }
+ }
+ nFieldCount = i;
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+USHORT ScTabPageSortFields::GetFieldSelPos( SCCOLROW nField )
+{
+ USHORT nFieldPos = 0;
+ BOOL bFound = FALSE;
+
+ for ( USHORT n=1; n<nFieldCount && !bFound; n++ )
+ {
+ if ( nFieldArr[n] == nField )
+ {
+ nFieldPos = n;
+ bFound = TRUE;
+ }
+ }
+
+ return nFieldPos;
+}
+
+// -----------------------------------------------------------------------
+// Handler:
+//---------
+
+IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
+{
+ String aSelEntry = pLb->GetSelectEntry();
+
+ if ( pLb == &aLbSort1 )
+ {
+ if ( aSelEntry == aStrUndefined )
+ {
+ aLbSort2.SelectEntryPos( 0 );
+ aLbSort3.SelectEntryPos( 0 );
+
+ if ( aFlSort2.IsEnabled() )
+ DisableField( 2 );
+
+ if ( aFlSort3.IsEnabled() )
+ DisableField( 3 );
+ }
+ else
+ {
+ if ( !aFlSort2.IsEnabled() )
+ EnableField( 2 );
+ }
+ }
+ else if ( pLb == &aLbSort2 )
+ {
+ if ( aSelEntry == aStrUndefined )
+ {
+ aLbSort3.SelectEntryPos( 0 );
+ if ( aFlSort3.IsEnabled() )
+ DisableField( 3 );
+ }
+ else
+ {
+ if ( !aFlSort3.IsEnabled() )
+ EnableField( 3 );
+ }
+ }
+ return 0;
+}
+
+//========================================================================
+// Sortieroptionen-Tabpage:
+//========================================================================
+
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef ScResId
+#define ScResId(x) #x
+#undef SfxTabPage
+#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "sort-options.xml", id, &args )
+#endif /* ENABLE_LAYOUT */
+
+ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent,
+ const SfxItemSet& rArgSet )
+
+ : SfxTabPage ( pParent,
+ ScResId( RID_SCPAGE_SORT_OPTIONS ),
+ rArgSet ),
+ //
+ aBtnCase ( this, ScResId( BTN_CASESENSITIVE ) ),
+ aBtnHeader ( this, ScResId( BTN_LABEL ) ),
+ aBtnFormats ( this, ScResId( BTN_FORMATS ) ),
+ aBtnCopyResult ( this, ScResId( BTN_COPYRESULT ) ),
+ aBtnNaturalSort ( this, ScResId( BTN_NATURALSORT ) ),
+ aLbOutPos ( this, ScResId( LB_OUTAREA ) ),
+ aEdOutPos ( this, ScResId( ED_OUTAREA ) ),
+ aBtnSortUser ( this, ScResId( BTN_SORT_USER ) ),
+ aLbSortUser ( this, ScResId( LB_SORT_USER ) ),
+ aFtLanguage ( this, ScResId( FT_LANGUAGE ) ),
+ aLbLanguage ( this, ScResId( LB_LANGUAGE ) ),
+ aFtAlgorithm ( this, ScResId( FT_ALGORITHM ) ),
+ aLbAlgorithm ( this, ScResId( LB_ALGORITHM ) ),
+ aLineDirection ( this, ScResId( FL_DIRECTION ) ),
+ aBtnTopDown ( this, ScResId( BTN_TOP_DOWN ) ),
+ aBtnLeftRight ( this, ScResId( BTN_LEFT_RIGHT ) ),
+// aFtAreaLabel ( this, ScResId( FT_AREA_LABEL ) ),
+// aFtArea ( this, ScResId( FT_AREA ) ),
+ //
+#if ENABLE_LAYOUT
+#undef this
+#undef ScResId
+#define ScResId(x) this, #x
+#endif /* ENABLE_LAYOUT */
+ aStrRowLabel ( ScResId( STR_ROW_LABEL ) ),
+ aStrColLabel ( ScResId( STR_COL_LABEL ) ),
+ aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ),
+ aStrNoName ( ScGlobal::GetRscString(STR_DB_NONAME) ),
+ //
+#if !TEST_LAYOUT
+ nWhichSort ( rArgSet.GetPool()->GetWhich( SID_SORT ) ),
+ rSortData ( ((const ScSortItem&)
+ rArgSet.Get( nWhichSort )).GetSortData() ),
+#else /* TEST_LAYOUT */
+ nWhichSort ( 0 ),
+ rSortData ( *new ScSortParam() ),
+#endif /* TEST_LAYOUT */
+ pViewData ( NULL ),
+ pDoc ( NULL ),
+ pDlg ( (ScSortDlg*)(GetParent() ? GetParent()->GetParent() : 0 ) ),
+ pColRes ( NULL ),
+ pColWrap ( NULL )
+{
+#if TEST_LAYOUT
+ (void) rArgSet;
+#endif /* TEST_LAYOUT */
+ Init();
+ FreeResource();
+ SetExchangeSupport();
+}
+
+// -----------------------------------------------------------------------
+
+ScTabPageSortOptions::~ScTabPageSortOptions()
+{
+#if !TEST_LAYOUT
+ USHORT nEntries = aLbOutPos.GetEntryCount();
+
+ for ( USHORT i=1; i<nEntries; i++ )
+ delete (String*)aLbOutPos.GetEntryData( i );
+#endif /* !TEST_LAYOUT */
+
+ delete pColRes;
+ delete pColWrap; //! not if from document
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortOptions::Init()
+{
+// aStrAreaLabel = aFtAreaLabel.GetText();
+// aStrAreaLabel.Append( (sal_Unicode) ' ' );
+
+ // CollatorRessource has user-visible names for sort algorithms
+ pColRes = new CollatorRessource();
+
+ //! use CollatorWrapper from document?
+ pColWrap = new CollatorWrapper( comphelper::getProcessServiceFactory() );
+
+#if !TEST_LAYOUT
+ const ScSortItem& rSortItem = (const ScSortItem&)
+ GetItemSet().Get( nWhichSort );
+#endif /* !TEST_LAYOUT */
+
+ aLbOutPos.SetSelectHdl ( LINK( this, ScTabPageSortOptions, SelOutPosHdl ) );
+ aBtnCopyResult.SetClickHdl( LINK( this, ScTabPageSortOptions, EnableHdl ) );
+ aBtnSortUser.SetClickHdl ( LINK( this, ScTabPageSortOptions, EnableHdl ) );
+ aBtnTopDown.SetClickHdl ( LINK( this, ScTabPageSortOptions, SortDirHdl ) );
+ aBtnLeftRight.SetClickHdl ( LINK( this, ScTabPageSortOptions, SortDirHdl ) );
+ aLbLanguage.SetSelectHdl ( LINK( this, ScTabPageSortOptions, FillAlgorHdl ) );
+
+#if !TEST_LAYOUT
+ pViewData = rSortItem.GetViewData();
+#endif /* TEST_LAYOUT */
+ pDoc = pViewData ? pViewData->GetDocument() : NULL;
+
+ DBG_ASSERT( pViewData, "ViewData not found! :-/" );
+
+#if !TEST_LAYOUT
+ if ( pViewData && pDoc )
+ {
+ String theArea;
+ ScDBCollection* pDBColl = pDoc->GetDBCollection();
+ String theDbArea;
+ String theDbName = aStrNoName;
+ const SCTAB nCurTab = pViewData->GetTabNo();
+ const ScAddress::Convention eConv = pDoc->GetAddressConvention();
+#endif /* !TEST_LAYOUT */
+
+ aLbOutPos.Clear();
+ aLbOutPos.InsertEntry( aStrUndefined, 0 );
+ aLbOutPos.Disable();
+
+#if !TEST_LAYOUT
+ ScAreaNameIterator aIter( pDoc );
+ String aName;
+ ScRange aRange;
+ String aRefStr;
+ while ( aIter.Next( aName, aRange ) )
+ {
+ USHORT nInsert = aLbOutPos.InsertEntry( aName );
+
+ aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc, eConv );
+ aLbOutPos.SetEntryData( nInsert, new String( aRefStr ) );
+ }
+#endif /* !TEST_LAYOUT */
+
+ aLbOutPos.SelectEntryPos( 0 );
+ aEdOutPos.SetText( EMPTY_STRING );
+
+#if !TEST_LAYOUT
+ /*
+ * Ueberpruefen, ob es sich bei dem uebergebenen
+ * Bereich um einen Datenbankbereich handelt:
+ */
+
+ ScAddress aScAddress( rSortData.nCol1, rSortData.nRow1, nCurTab );
+ ScRange( aScAddress,
+ ScAddress( rSortData.nCol2, rSortData.nRow2, nCurTab )
+ ).Format( theArea, SCR_ABS, pDoc, eConv );
+
+ if ( pDBColl )
+ {
+ ScDBData* pDBData
+ = pDBColl->GetDBAtArea( nCurTab,
+ rSortData.nCol1, rSortData.nRow1,
+ rSortData.nCol2, rSortData.nRow2 );
+ if ( pDBData )
+ {
+ pDBData->GetName( theDbName );
+ aBtnHeader.Check( pDBData->HasHeader() );
+ }
+ }
+
+ theArea.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" ("));
+ theArea += theDbName;
+ theArea += ')';
+
+ //aFtArea.SetText( theArea );
+ //theArea.Insert( aStrAreaLabel, 0 );
+ //aFtAreaLabel.SetText( theArea );
+
+ aBtnHeader.SetText( aStrColLabel );
+ }
+#endif /* TEST_LAYOUT */
+
+ FillUserSortListBox();
+
+ // get available languages
+
+ aLbLanguage.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, FALSE );
+ aLbLanguage.InsertLanguage( LANGUAGE_SYSTEM );
+}
+
+//------------------------------------------------------------------------
+
+USHORT* ScTabPageSortOptions::GetRanges()
+{
+ return pSortRanges;
+}
+
+// -----------------------------------------------------------------------
+
+#if ENABLE_LAYOUT
+#undef SfxTabPage
+#endif /* ENABLE_LAYOUT */
+SfxTabPage* ScTabPageSortOptions::Create(
+ Window* pParent,
+ const SfxItemSet& rArgSet )
+{
+ return ( new ScTabPageSortOptions( pParent, rArgSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortOptions::Reset( const SfxItemSet& /* rArgSet */ )
+{
+ if ( rSortData.bUserDef )
+ {
+ aBtnSortUser.Check( TRUE );
+ aLbSortUser.Enable();
+ aLbSortUser.SelectEntryPos( rSortData.nUserIndex );
+ }
+ else
+ {
+ aBtnSortUser.Check( FALSE );
+ aLbSortUser.Disable();
+ aLbSortUser.SelectEntryPos( 0 );
+ }
+
+ aBtnCase.Check ( rSortData.bCaseSens );
+ aBtnFormats.Check ( rSortData.bIncludePattern );
+ aBtnHeader.Check ( rSortData.bHasHeader );
+ aBtnNaturalSort.Check ( rSortData.bNaturalSort );
+
+ if ( rSortData.bByRow )
+ {
+ aBtnTopDown.Check();
+ aBtnHeader.SetText( aStrColLabel );
+ }
+ else
+ {
+ aBtnLeftRight.Check();
+ aBtnHeader.SetText( aStrRowLabel );
+ }
+
+ LanguageType eLang = MsLangId::convertLocaleToLanguage( rSortData.aCollatorLocale );
+ if ( eLang == LANGUAGE_DONTKNOW )
+ eLang = LANGUAGE_SYSTEM;
+ aLbLanguage.SelectLanguage( eLang );
+ FillAlgorHdl( &aLbLanguage ); // get algorithms, select default
+ if ( rSortData.aCollatorAlgorithm.Len() )
+ aLbAlgorithm.SelectEntry( pColRes->GetTranslation( rSortData.aCollatorAlgorithm ) );
+
+ if ( pDoc && !rSortData.bInplace )
+ {
+ String aStr;
+ USHORT nFormat = (rSortData.nDestTab != pViewData->GetTabNo())
+ ? SCR_ABS_3D
+ : SCR_ABS;
+
+ theOutPos.Set( rSortData.nDestCol,
+ rSortData.nDestRow,
+ rSortData.nDestTab );
+
+ theOutPos.Format( aStr, nFormat, pDoc, pDoc->GetAddressConvention() );
+ aBtnCopyResult.Check();
+ aLbOutPos.Enable();
+ aEdOutPos.Enable();
+ aEdOutPos.SetText( aStr );
+ EdOutPosModHdl( &aEdOutPos );
+ aEdOutPos.GrabFocus();
+ aEdOutPos.SetSelection( Selection( 0, SELECTION_MAX ) );
+ }
+ else
+ {
+ aBtnCopyResult.Check( FALSE );
+ aLbOutPos.Disable();
+ aEdOutPos.Disable();
+ aEdOutPos.SetText( EMPTY_STRING );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ScTabPageSortOptions::FillItemSet( SfxItemSet& rArgSet )
+{
+ ScSortParam theSortData = rSortData;
+ if (pDlg)
+ {
+ const SfxItemSet* pExample = pDlg->GetExampleSet();
+ const SfxPoolItem* pItem;
+ if ( pExample && pExample->GetItemState( nWhichSort, TRUE, &pItem ) == SFX_ITEM_SET )
+ theSortData = ((const ScSortItem*)pItem)->GetSortData();
+ }
+
+ theSortData.bByRow = aBtnTopDown.IsChecked();
+ theSortData.bHasHeader = aBtnHeader.IsChecked();
+ theSortData.bCaseSens = aBtnCase.IsChecked();
+ theSortData.bNaturalSort = aBtnNaturalSort.IsChecked();
+ theSortData.bIncludePattern = aBtnFormats.IsChecked();
+ theSortData.bInplace = !aBtnCopyResult.IsChecked();
+ theSortData.nDestCol = theOutPos.Col();
+ theSortData.nDestRow = theOutPos.Row();
+ theSortData.nDestTab = theOutPos.Tab();
+ theSortData.bUserDef = aBtnSortUser.IsChecked();
+ theSortData.nUserIndex = (aBtnSortUser.IsChecked())
+ ? aLbSortUser.GetSelectEntryPos()
+ : 0;
+
+ // get locale
+ LanguageType eLang = aLbLanguage.GetSelectLanguage();
+ theSortData.aCollatorLocale = MsLangId::convertLanguageToLocale( eLang, false );
+
+ // get algorithm
+ String sAlg;
+ if ( eLang != LANGUAGE_SYSTEM )
+ {
+ uno::Sequence<rtl::OUString> aAlgos = pColWrap->listCollatorAlgorithms(
+ theSortData.aCollatorLocale );
+ USHORT nSel = aLbAlgorithm.GetSelectEntryPos();
+ if ( nSel < aAlgos.getLength() )
+ sAlg = aAlgos[nSel];
+ }
+ theSortData.aCollatorAlgorithm = sAlg;
+
+#if !TEST_LAYOUT
+ rArgSet.Put( ScSortItem( SCITEM_SORTDATA, &theSortData ) );
+#endif /* TEST_LAYOUT */
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+// fuer Datenaustausch ohne Dialog-Umweg: (! noch zu tun !)
+// void ScTabPageSortOptions::ActivatePage( const SfxItemSet& rSet )
+void ScTabPageSortOptions::ActivatePage()
+{
+ if ( pDlg )
+ {
+ if ( aBtnHeader.IsChecked() != pDlg->GetHeaders() )
+ {
+ aBtnHeader.Check( pDlg->GetHeaders() );
+ }
+
+ if ( aBtnTopDown.IsChecked() != pDlg->GetByRows() )
+ {
+ aBtnTopDown.Check( pDlg->GetByRows() );
+ aBtnLeftRight.Check( !pDlg->GetByRows() );
+ }
+
+ aBtnHeader.SetText( (pDlg->GetByRows())
+ ? aStrColLabel
+ : aStrRowLabel );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int ScTabPageSortOptions::DeactivatePage( SfxItemSet* pSetP )
+{
+ BOOL bPosInputOk = TRUE;
+
+ if ( aBtnCopyResult.IsChecked() )
+ {
+ String thePosStr = aEdOutPos.GetText();
+ ScAddress thePos;
+ xub_StrLen nColonPos = thePosStr.Search( ':' );
+
+ if ( STRING_NOTFOUND != nColonPos )
+ thePosStr.Erase( nColonPos );
+
+ if ( pViewData )
+ {
+ // visible table is default for input without table
+ // must be changed to GetRefTabNo when sorting has RefInput!
+ thePos.SetTab( pViewData->GetTabNo() );
+ }
+
+ USHORT nResult = thePos.Parse( thePosStr, pDoc, pDoc->GetAddressConvention() );
+
+ bPosInputOk = ( SCA_VALID == (nResult & SCA_VALID) );
+
+ if ( !bPosInputOk )
+ {
+#if !ENABLE_LAYOUT
+ ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ),
+ ScGlobal::GetRscString( STR_INVALID_TABREF )
+ ).Execute();
+#endif /* ENABLE_LAYOUT */
+ aEdOutPos.GrabFocus();
+ aEdOutPos.SetSelection( Selection( 0, SELECTION_MAX ) );
+ theOutPos.Set(0,0,0);
+ }
+ else
+ {
+ aEdOutPos.SetText( thePosStr );
+ theOutPos = thePos;
+ }
+ }
+
+ if ( pDlg && bPosInputOk )
+ {
+ pDlg->SetHeaders( aBtnHeader.IsChecked() );
+ pDlg->SetByRows ( aBtnTopDown.IsChecked() );
+ }
+
+ if ( pSetP && bPosInputOk )
+ FillItemSet( *pSetP );
+
+ return bPosInputOk ? SfxTabPage::LEAVE_PAGE : SfxTabPage::KEEP_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortOptions::FillUserSortListBox()
+{
+ ScUserList* pUserLists = ScGlobal::GetUserList();
+
+ aLbSortUser.Clear();
+ if ( pUserLists )
+ {
+ USHORT nCount = pUserLists->GetCount();
+ if ( nCount > 0 )
+ for ( USHORT i=0; i<nCount; i++ )
+ aLbSortUser.InsertEntry( (*pUserLists)[i]->GetString() );
+ }
+}
+
+// -----------------------------------------------------------------------
+// Handler:
+
+IMPL_LINK( ScTabPageSortOptions, EnableHdl, CheckBox *, pBox )
+{
+ if ( pBox == &aBtnCopyResult )
+ {
+ if ( pBox->IsChecked() )
+ {
+ aLbOutPos.Enable();
+ aEdOutPos.Enable();
+ aEdOutPos.GrabFocus();
+ }
+ else
+ {
+ aLbOutPos.Disable();
+ aEdOutPos.Disable();
+ }
+ }
+ else if ( pBox == &aBtnSortUser )
+ {
+ if ( pBox->IsChecked() )
+ {
+ aLbSortUser.Enable();
+ aLbSortUser.GrabFocus();
+ }
+ else
+ aLbSortUser.Disable();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ScTabPageSortOptions, SelOutPosHdl, ListBox *, pLb )
+{
+ if ( pLb == &aLbOutPos )
+ {
+ String aString;
+ USHORT nSelPos = aLbOutPos.GetSelectEntryPos();
+
+ if ( nSelPos > 0 )
+ aString = *(String*)aLbOutPos.GetEntryData( nSelPos );
+
+ aEdOutPos.SetText( aString );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ScTabPageSortOptions, SortDirHdl, RadioButton *, pBtn )
+{
+ if ( pBtn == &aBtnTopDown )
+ {
+ aBtnHeader.SetText( aStrColLabel );
+ }
+ else if ( pBtn == &aBtnLeftRight )
+ {
+ aBtnHeader.SetText( aStrRowLabel );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortOptions::EdOutPosModHdl( Edit* pEd )
+{
+ if ( pEd == &aEdOutPos )
+ {
+ String theCurPosStr = aEdOutPos.GetText();
+ USHORT nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() );
+
+ if ( SCA_VALID == (nResult & SCA_VALID) )
+ {
+ String* pStr = NULL;
+ BOOL bFound = FALSE;
+ USHORT i = 0;
+ USHORT nCount = aLbOutPos.GetEntryCount();
+
+ for ( i=2; i<nCount && !bFound; i++ )
+ {
+ pStr = (String*)aLbOutPos.GetEntryData( i );
+ bFound = (theCurPosStr == *pStr);
+ }
+
+ if ( bFound )
+ aLbOutPos.SelectEntryPos( --i );
+ else
+ aLbOutPos.SelectEntryPos( 0 );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ScTabPageSortOptions, FillAlgorHdl, void *, EMPTYARG )
+{
+ aLbAlgorithm.SetUpdateMode( FALSE );
+ aLbAlgorithm.Clear();
+
+ LanguageType eLang = aLbLanguage.GetSelectLanguage();
+ if ( eLang == LANGUAGE_SYSTEM )
+ {
+ // for LANGUAGE_SYSTEM no algorithm can be selected because
+ // it wouldn't necessarily exist for other languages
+ // -> leave list box empty if LANGUAGE_SYSTEM is selected
+ aFtAlgorithm.Enable( FALSE ); // nothing to select
+ aLbAlgorithm.Enable( FALSE ); // nothing to select
+ }
+ else
+ {
+ lang::Locale aLocale( MsLangId::convertLanguageToLocale( eLang ));
+ uno::Sequence<rtl::OUString> aAlgos = pColWrap->listCollatorAlgorithms( aLocale );
+
+ long nCount = aAlgos.getLength();
+ const rtl::OUString* pArray = aAlgos.getConstArray();
+ for (long i=0; i<nCount; i++)
+ {
+ String sAlg = pArray[i];
+ String sUser = pColRes->GetTranslation( sAlg );
+ aLbAlgorithm.InsertEntry( sUser, LISTBOX_APPEND );
+ }
+ aLbAlgorithm.SelectEntryPos( 0 ); // first entry is default
+ aFtAlgorithm.Enable( nCount > 1 ); // enable only if there is a choice
+ aLbAlgorithm.Enable( nCount > 1 ); // enable only if there is a choice
+ }
+
+ aLbAlgorithm.SetUpdateMode( TRUE );
+ return 0;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/tpsort.hxx b/toolkit/workben/layout/tpsort.hxx
new file mode 100644
index 000000000000..64e4f4b6de42
--- /dev/null
+++ b/toolkit/workben/layout/tpsort.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_TPSORT_HXX
+#define SC_TPSORT_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svx/langbox.hxx>
+
+
+#include "global.hxx"
+#include "address.hxx"
+
+//------------------------------------------------------------------------
+
+// +1 because one field is reserved for the "- undefined -" entry
+#define SC_MAXFIELDS MAXCOLCOUNT+1
+
+class ScViewData;
+class ScSortDlg;
+struct ScSortParam;
+
+//========================================================================
+// Kriterien (Sort Criteria)
+
+class ScTabPageSortFields : public SfxTabPage
+{
+public:
+ ScTabPageSortFields( Window* pParent,
+ const SfxItemSet& rArgSet );
+ ~ScTabPageSortFields();
+
+ static SfxTabPage* Create ( Window* pParent,
+ const SfxItemSet& rArgSet );
+ static USHORT* GetRanges ();
+ virtual BOOL FillItemSet ( SfxItemSet& rArgSet );
+ virtual void Reset ( const SfxItemSet& rArgSet );
+
+protected:
+// fuer Datenaustausch (sollte noch umgestellt werden!)
+// virtual void ActivatePage ( const SfxItemSet& rSet );
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+ virtual void ActivatePage ();
+ virtual int DeactivatePage ( SfxItemSet* pSet = 0);
+
+private:
+ FixedLine aFlSort1;
+ ListBox aLbSort1;
+ RadioButton aBtnUp1;
+ RadioButton aBtnDown1;
+
+ FixedLine aFlSort2;
+ ListBox aLbSort2;
+ RadioButton aBtnUp2;
+ RadioButton aBtnDown2;
+
+ FixedLine aFlSort3;
+ ListBox aLbSort3;
+ RadioButton aBtnUp3;
+ RadioButton aBtnDown3;
+
+ String aStrUndefined;
+ String aStrColumn;
+ String aStrRow;
+
+ const USHORT nWhichSort;
+ ScSortDlg* pDlg;
+ ScViewData* pViewData;
+ const ScSortParam& rSortData;
+ SCCOLROW nFieldArr[SC_MAXFIELDS];
+ USHORT nFieldCount;
+ SCCOL nFirstCol;
+ SCROW nFirstRow;
+ BOOL bHasHeader;
+ BOOL bSortByRows;
+
+ ListBox* aSortLbArr[3];
+ RadioButton* aDirBtnArr[3][2];
+ FixedLine* aFlArr[3];
+
+#ifdef _TPSORT_CXX
+private:
+ void Init ();
+ void DisableField ( USHORT nField );
+ void EnableField ( USHORT nField );
+ void FillFieldLists ();
+ USHORT GetFieldSelPos ( SCCOLROW nField );
+
+ // Handler ------------------------
+ DECL_LINK( SelectHdl, ListBox * );
+#endif
+};
+
+//========================================================================
+// Sortieroptionen (Sort Options)
+
+class ScDocument;
+class ScRangeData;
+class CollatorRessource;
+class CollatorWrapper;
+
+#include <sfx2/layout.hxx>
+#include <layout/layout-pre.hxx>
+
+class ScTabPageSortOptions : public SfxTabPage
+{
+public:
+ ScTabPageSortOptions( Window* pParent,
+ const SfxItemSet& rArgSet );
+ ~ScTabPageSortOptions();
+
+#undef SfxTabPage
+#define SfxTabPage ::SfxTabPage
+ static SfxTabPage* Create ( Window* pParent,
+ const SfxItemSet& rArgSet );
+ static USHORT* GetRanges ();
+ virtual BOOL FillItemSet ( SfxItemSet& rArgSet );
+ virtual void Reset ( const SfxItemSet& rArgSet );
+
+protected:
+// fuer Datenaustausch (sollte noch umgestellt werden!)
+// virtual void ActivatePage ( const SfxItemSet& rSet );
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+ virtual void ActivatePage ();
+ virtual int DeactivatePage ( SfxItemSet* pSet = 0);
+
+private:
+
+ CheckBox aBtnCase;
+ CheckBox aBtnHeader;
+ CheckBox aBtnFormats;
+ CheckBox aBtnCopyResult;
+
+ CheckBox aBtnNaturalSort;
+ ListBox aLbOutPos;
+ Edit aEdOutPos;
+
+ CheckBox aBtnSortUser;
+ ListBox aLbSortUser;
+
+ FixedText aFtLanguage;
+ SvxLanguageBox aLbLanguage;
+ FixedText aFtAlgorithm;
+ ListBox aLbAlgorithm;
+
+ FixedLine aLineDirection;
+ RadioButton aBtnTopDown;
+ RadioButton aBtnLeftRight;
+
+// FixedText aFtAreaLabel;
+// FixedInfo aFtArea;
+ LocalizedString aStrRowLabel;
+ LocalizedString aStrColLabel;
+ LocalizedString aStrUndefined;
+ String aStrNoName;
+ String aStrAreaLabel;
+
+ const USHORT nWhichSort;
+ const ScSortParam& rSortData;
+ ScViewData* pViewData;
+ ScDocument* pDoc;
+ ScSortDlg* pDlg;
+ ScAddress theOutPos;
+
+ CollatorRessource* pColRes;
+ CollatorWrapper* pColWrap;
+
+#ifdef _TPSORT_CXX
+private:
+ void Init ();
+ void FillUserSortListBox ();
+ void FillOutPosList ();
+
+ // Handler ------------------------
+ DECL_LINK( EnableHdl, CheckBox * );
+ DECL_LINK( SelOutPosHdl, ListBox * );
+ void EdOutPosModHdl ( Edit* pEd );
+ DECL_LINK( SortDirHdl, RadioButton * );
+ DECL_LINK( FillAlgorHdl, void * );
+#endif
+};
+
+#include <layout/layout-post.hxx>
+
+#endif // SC_TPSORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/un-test.sh b/toolkit/workben/layout/un-test.sh
new file mode 100644
index 000000000000..ef2518ffa1b8
--- /dev/null
+++ b/toolkit/workben/layout/un-test.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+# un-test.sh: remove TEST_LAYOUT code from OO.o implementation
+
+sed -e 's!^#!@!' < $1\
+ -e 's!$! /*$*/!' \
+ -e 's!^@\(.*TEST_LAYOUT\)!#\1!'\
+ | tee i \
+ | cpp -traditional -C -CC -DNON_LAYOUT_COMPILE_FIXES=1 \
+ | grep -F '/*$*/' \
+ | sed -e 's! /\*\$\*/!!' \
+ -e 's!^@!#!' \
+ -e 's!#define 1 1!#define NON_LAYOUT_COMPILE_FIXES 1!'
+
diff --git a/toolkit/workben/layout/uno.hxx b/toolkit/workben/layout/uno.hxx
new file mode 100644
index 000000000000..94a70e9fdc1e
--- /dev/null
+++ b/toolkit/workben/layout/uno.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _LAYOUT_UNO_HXX
+#define _LAYOUT_UNO_HXX
+
+#include <cstdio>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <layout/core/root.hxx>
+#include <layout/core/factory.hxx>
+
+#if LAYOUT_WEAK
+#include <cppuhelper/implbase1.hxx>
+class UnoBootstrapLayout : public ::cppu::WeakImplHelper1< com::sun::star::lang::XMultiServiceFactory >
+#else /* !LAYOUT_WEAK */
+class UnoBootstrapLayout : public com::sun::star::lang::XMultiServiceFactory
+#endif /* LAYOUT_WEAK */
+{
+public:
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ UnoBootstrapLayout( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xMSF )
+ : mxMSF( xMSF )
+ {
+ fprintf( stderr, "UnoBootstrap Layout\n" );
+ }
+ virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
+ createInstance( const rtl::OUString& aServiceSpecifier ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+ {
+ if ( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.awt.Layout" ) ) )
+ {
+ fprintf( stderr, "UnoBootstrapLayout: create service '%s'\n",
+ rtl::OUStringToOString (aServiceSpecifier, RTL_TEXTENCODING_UTF8 ).getStr() );
+ return com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory >( new ::LayoutFactory( this ) );
+ }
+ else
+ {
+ fprintf( stderr, "UnoBootstrapLayout: create service '%s'\n",
+ rtl::OUStringToOString (aServiceSpecifier, RTL_TEXTENCODING_UTF8 ).getStr() );
+ try
+ {
+ return mxMSF->createInstance( aServiceSpecifier );
+ }
+ catch ( const com::sun::star::uno::Exception &rExc )
+ {
+ rtl::OString aStr( rtl::OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ fprintf( stderr, "service construction exception '%s'\n", aStr.getStr());
+ throw rExc;
+ }
+ }
+ }
+ virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
+ createInstanceWithArguments( const rtl::OUString& ServiceSpecifier, const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& Arguments ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+ {
+ return mxMSF->createInstanceWithArguments( ServiceSpecifier, Arguments );
+ }
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
+ getAvailableServiceNames() throw (com::sun::star::uno::RuntimeException)
+ {
+ return mxMSF->getAvailableServiceNames();
+ }
+
+#if !LAYOUT_WEAK
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ return mxMSF->queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() throw()
+ {
+ mxMSF->acquire();
+ }
+ virtual void SAL_CALL release() throw()
+ {
+ mxMSF->release();
+ }
+#endif /* !LAYOUT_WEAK */
+};
+
+#endif /* _LAYOUT_UNO_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/wordcount-plain.xml b/toolkit/workben/layout/wordcount-plain.xml
new file mode 100644
index 000000000000..5adce42acdbd
--- /dev/null
+++ b/toolkit/workben/layout/wordcount-plain.xml
@@ -0,0 +1,37 @@
+
+
+<modaldialog sizeable="true" height="132" help-id="HID_DLG_WORDCOUNT" moveable="true" output-size="true" id="DLG_WORDCOUNT" sv-look="true" text="Word Count" width="170" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox>
+ <fixedline height="8" id="FL_CURRENT" text="Current selection" width="158" x="6" y="3"/>
+ <hbox>
+ <fixedtext height="8" id="FT_CURRENTWORD" label="Words:" width="80" x="12" y="14"/>
+ <fixedtext height="8" id="FI_CURRENTWORD" right="true" width="50" x="111" y="14"/>
+ </hbox>
+ <hbox>
+ <fixedtext height="8" id="FT_CURRENTCHARACTER" label="Characters:" width="80" x="12" y="26"/>
+ <fixedtext height="8" id="FI_CURRENTCHARACTER" right="true" width="50" x="111" y="26"/>
+ </hbox>
+ <hbox>
+ <fixedtext height="8" id="FT_CURRENTCHARACTEREXCLUDINGSPACES" label="Characters excluding spaces:" width="80" x="12" y="38"/>
+ <fixedtext height="8" id="FI_CURRENTCHARACTEREXCLUDINGSPACES" right="true" width="50" x="111" y="38"/>
+ </hbox>
+ <fixedline height="8" id="FL_DOC" text="Whole document" width="158" x="6" y="52"/>
+ <hbox>
+ <fixedtext height="8" id="FT_DOCWORD" label="Words:" width="80" x="12" y="63"/>
+ <fixedtext height="8" id="FI_DOCWORD" right="true" width="50" x="111" y="63"/>
+ </hbox>
+ <hbox>
+ <fixedtext height="8" id="FT_DOCCHARACTER" label="Characters:" width="80" x="12" y="75"/>
+ <fixedtext height="8" id="FI_DOCCHARACTER" right="true" width="50" x="111" y="75"/>
+ </hbox>
+ <hbox>
+ <fixedtext height="8" id="FT_DOCCHARACTEREXCLUDINGSPACES" label="Characters excluding spaces:" width="80" x="12" y="87"/>
+ <fixedtext height="8" id="FI_DOCCHARACTEREXCLUDINGSPACES" right="true" width="50" x="111" y="87"/>
+ </hbox>
+ <fixedline height="8" id="FL_BOTTOM" width="158" x="6" y="101"/>
+ <hbox>
+ <okbutton defbutton="true" height="14" id="PB_OK" width="50" x="61" y="112"/>
+ <helpbutton height="14" id="PB_HELP" width="50" x="114" y="112"/>
+ </hbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/wordcount-tight.xml b/toolkit/workben/layout/wordcount-tight.xml
new file mode 100644
index 000000000000..bcf6a6d86fca
--- /dev/null
+++ b/toolkit/workben/layout/wordcount-tight.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ help-id="HID_DLG_WORDCOUNT"
+ id="dialog"
+ sizeable="true" moveable="true" optimumsize="true"
+ has_border="true" sv-look="true" title="Word Count">
+ <vbox border="5" spacing="5">
+ <fixedline id="FL_CURRENT" text="Current selection"/>
+ <hbox>
+ <fixedtext id="FT_CURRENTWORD" label="Words:" cnt:padding="13"/>
+ <fixedinfo id="FI_CURRENTWORD" right="true" label="0" cnt:padding="13"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_CURRENTCHARACTER" label="Characters:" cnt:padding="13"/>
+ <fixedinfo id="FI_CURRENTCHARACTER" right="true" label="00" cnt:padding="13"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_CURRENTCHARACTEREXCLUDINGSPACES" label="Characters excluding spaces:" cnt:padding="13"/>
+ <fixedinfo id="FI_CURRENTCHARACTEREXCLUDINGSPACES" right="true" label="000" cnt:padding="13"/>
+ </hbox>
+ <fixedline id="FL_DOC" text="Whole document"/>
+ <hbox>
+ <fixedtext id="FT_DOCWORD" label="Words:" cnt:padding="13"/>
+ <fixedinfo id="FI_DOCWORD" right="true" label="0000" cnt:padding="13"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_DOCCHARACTER" label="Characters:" cnt:padding="13"/>
+ <fixedinfo id="FI_DOCCHARACTER" right="true" label="00000" cnt:padding="13"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_DOCCHARACTEREXCLUDINGSPACES" label="Characters excluding spaces:" cnt:padding="13"/>
+ <fixedinfo id="FI_DOCCHARACTEREXCLUDINGSPACES" right="true" label="000000" cnt:padding="13"/>
+ </hbox>
+ <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ <hbox border="5">
+ <flow homogeneous="true"/>
+ <okbutton id="PB_OK" cnt:expand="false" defbutton="true"/>
+ <helpbutton id="PB_HELP" cnt:expand="false"/>
+ </hbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/wordcount.xml b/toolkit/workben/layout/wordcount.xml
new file mode 100644
index 000000000000..4b4e362e8583
--- /dev/null
+++ b/toolkit/workben/layout/wordcount.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ help-id="HID_DLG_WORDCOUNT"
+ id="DLG_WORDCOUNT"
+ sizeable="true" moveable="true" optimumsize="true" closeable="true"
+ has_border="true" sv-look="true" _title="Word Count">
+ <vbox border="12" spacing="6">
+ <fixedline id="FL_CURRENT" _text="Current selection"/>
+ <hbox>
+ <vbox cnt:padding="12" spacing="6">
+ <hbox>
+ <fixedtext id="FT_CURRENTWORD" _label="Words:"/>
+ <flow cnt:padding="60"/>
+ <fixedtext id="FI_CURRENTWORD" right="true" _label="0"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_CURRENTCHARACTER" _label="Characters:"/>
+ <flow cnt:padding="60"/>
+ <fixedtext id="FI_CURRENTCHARACTER" right="true" _label="00"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_CURRENTCHARACTEREXCLUDINGSPACES" _label="Characters excluding spaces:"/>
+ <flow cnt:padding="60"/>
+ <fixedtext id="FI_CURRENTCHARACTEREXCLUDINGSPACES" right="true" _label="000"/>
+ </hbox>
+ </vbox>
+ </hbox>
+ <!-- if we could do cnt:cnt:padding="-12" here, we would not have to close
+ and reopen the hbox/vbox thing !-->
+ <fixedline id="FL_DOC" _text="Whole document"/>
+ <hbox>
+ <vbox cnt:padding="12" spacing="6">
+ <hbox>
+ <fixedtext id="FT_DOCWORD" _label="Words:"/>
+ <fixedtext id="FI_DOCWORD" right="true" _label="0000"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_DOCCHARACTER" _label="Characters:"/>
+ <fixedtext id="FI_DOCCHARACTER" right="true" _label="00000"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_DOCCHARACTEREXCLUDINGSPACES" _label="Characters excluding spaces:"/>
+ <fixedtext id="FI_DOCCHARACTEREXCLUDINGSPACES" right="true" _label="000000"/>
+ </hbox>
+ </vbox>
+ </hbox>
+ <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ <dialogbuttonhbox spacing="12">
+ <flow/>
+ <okbutton defbutton="true" id="PB_OK"/>
+ <helpbutton id="PB_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/wordcountdialog.cxx b/toolkit/workben/layout/wordcountdialog.cxx
new file mode 100644
index 000000000000..da0083e09456
--- /dev/null
+++ b/toolkit/workben/layout/wordcountdialog.cxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#if !TEST_LAYOUT
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <swtypes.hxx>
+#endif /* !TEST_LAYOUT */
+#include <wordcountdialog.hxx>
+#if !TEST_LAYOUT
+#include <docstat.hxx>
+
+#include <dialog.hrc>
+#endif /* !TEST_LAYOUT */
+#include <layout/layout-pre.hxx>
+#if !TEST_LAYOUT
+#include <wordcountdialog.hrc>
+#endif /* !TEST_LAYOUT */
+
+#if ENABLE_LAYOUT
+#undef SW_RES
+#define SW_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "wordcount.xml", id )
+#define SW_WORDCOUNTDIALOG_HRC
+#include <helpid.h>
+#endif /* ENABLE_LAYOUT */
+
+SwWordCountDialog::SwWordCountDialog(Window* pParent) :
+ SfxModalDialog(pParent, SW_RES(DLG_WORDCOUNT)),
+#if defined _MSC_VER
+#pragma warning (disable : 4355)
+#endif
+ aCurrentFL( this, SW_RES( FL_CURRENT )),
+ aCurrentWordFT( this, SW_RES( FT_CURRENTWORD )),
+ aCurrentWordFI( this, SW_RES( FI_CURRENTWORD )),
+ aCurrentCharacterFT( this, SW_RES( FT_CURRENTCHARACTER )),
+ aCurrentCharacterFI( this, SW_RES( FI_CURRENTCHARACTER )),
+ aCurrentCharacterExcludingSpacesFT( this, SW_RES( FT_CURRENTCHARACTEREXCLUDINGSPACES )),
+ aCurrentCharacterExcludingSpacesFI( this, SW_RES( FI_CURRENTCHARACTEREXCLUDINGSPACES )),
+
+ aDocFL( this, SW_RES( FL_DOC )),
+ aDocWordFT( this, SW_RES( FT_DOCWORD )),
+ aDocWordFI( this, SW_RES( FI_DOCWORD )),
+ aDocCharacterFT( this, SW_RES( FT_DOCCHARACTER )),
+ aDocCharacterFI( this, SW_RES( FI_DOCCHARACTER )),
+ aDocCharacterExcludingSpacesFT( this, SW_RES( FT_DOCCHARACTEREXCLUDINGSPACES )),
+ aDocCharacterExcludingSpacesFI( this, SW_RES( FI_DOCCHARACTEREXCLUDINGSPACES )),
+ aBottomFL(this, SW_RES( FL_BOTTOM )),
+ aOK( this, SW_RES( PB_OK )),
+ aHelp( this, SW_RES( PB_HELP ))
+#if defined _MSC_VER
+#pragma warning (default : 4355)
+#endif
+{
+#if ENABLE_LAYOUT
+ SetHelpId (HID_DLG_WORDCOUNT);
+#endif /* ENABLE_LAYOUT */
+ FreeResource();
+}
+
+SwWordCountDialog::~SwWordCountDialog()
+{
+}
+
+void SwWordCountDialog::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc)
+{
+#if TEST_LAYOUT
+ (void) rCurrent;
+ (void) rDoc;
+#else /* !TEST_LAYOUT */
+ aCurrentWordFI.SetText( String::CreateFromInt32(rCurrent.nWord ));
+ aCurrentCharacterFI.SetText(String::CreateFromInt32(rCurrent.nChar ));
+ aCurrentCharacterExcludingSpacesFI.SetText(String::CreateFromInt32(rCurrent.nCharExcludingSpaces ));
+ aDocWordFI.SetText( String::CreateFromInt32(rDoc.nWord ));
+ aDocCharacterFI.SetText( String::CreateFromInt32(rDoc.nChar ));
+ aDocCharacterExcludingSpacesFI.SetText( String::CreateFromInt32(rDoc.nCharExcludingSpaces ));
+#endif /* !TEST_LAYOUT */
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/wordcountdialog.hxx b/toolkit/workben/layout/wordcountdialog.hxx
new file mode 100644
index 000000000000..5c6dbabea04f
--- /dev/null
+++ b/toolkit/workben/layout/wordcountdialog.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_WORDCOUNTDIALOG_HXX
+#define SW_WORDCOUNTDIALOG_HXX
+#include <sfx2/basedlgs.hxx>
+#include <svtools/stdctrl.hxx>
+#include <vcl/button.hxx>
+#include <layout/layout.hxx>
+#include <layout/layout-pre.hxx>
+struct SwDocStat;
+class SwWordCountDialog : public SfxModalDialog
+{
+ FixedLine aCurrentFL;
+ FixedText aCurrentWordFT;
+ FixedInfo aCurrentWordFI;
+ FixedText aCurrentCharacterFT;
+ FixedInfo aCurrentCharacterFI;
+ FixedText aCurrentCharacterExcludingSpacesFT;
+ FixedInfo aCurrentCharacterExcludingSpacesFI;
+
+ FixedLine aDocFL;
+ FixedText aDocWordFT;
+ FixedInfo aDocWordFI;
+ FixedText aDocCharacterFT;
+ FixedInfo aDocCharacterFI;
+ FixedText aDocCharacterExcludingSpacesFT;
+ FixedInfo aDocCharacterExcludingSpacesFI;
+
+ FixedLine aBottomFL;
+
+ OKButton aOK;
+ HelpButton aHelp;
+
+public:
+ SwWordCountDialog(Window* pParent);
+ ~SwWordCountDialog();
+
+ void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc);
+};
+
+#include <layout/layout-post.hxx>
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/zoom-1.xml b/toolkit/workben/layout/zoom-1.xml
new file mode 100644
index 000000000000..5fe06a3f270e
--- /dev/null
+++ b/toolkit/workben/layout/zoom-1.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" optimumsize="true"
+ help-id="SID_ATTR_ZOOM"
+ has_border="true" sizeable="true" moveable="true">
+ <title id="tit" xml-lang="en-US">Set Zoom</title>
+ <vbox spacing="5" border="5">
+ <fixedline id="FL_ZOOM" cnt:expand="true" xml-lang="en-US">Zoom factor</fixedline>
+ <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" xml-lang="en-US">Whole Page</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" xml-lang="en-US">Page Width</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" xml-lang="en-US">Optimal</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_200" xml-lang="en-US">200 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_150" xml-lang="en-US">15~0 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_100" xml-lang="en-US">100 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_75" xml-lang="en-US">75 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_50" xml-lang="en-US">50 %</radiobutton>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" xml-lang="en-US">Variable</radiobutton>
+ </align>
+ <flow cnt:padding="10" cnt:expand="false"/>
+ <metricfield id="ED_USER" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ text="100%" unit="13" custom-unit-text="%"
+ right="true"
+ cnt:expand="false"/>
+ </hbox>
+ <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton id="BTN_ZOOM_OK"/>
+ <cancelbutton id="BTN_ZOOM_CANCEL"/>
+ <helpbutton id="BTN_ZOOM_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom-2.xml b/toolkit/workben/layout/zoom-2.xml
new file mode 100644
index 000000000000..c74e0c9a9da7
--- /dev/null
+++ b/toolkit/workben/layout/zoom-2.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" optimumsize="true"
+ help-id="SID_ATTR_ZOOM"
+ has_border="true" sizeable="true" moveable="true"
+ xml-lang="en-US">
+ Set Zoom
+ <vbox spacing="5" border="5">
+ <fixedline id="FL_ZOOM" cnt:expand="true" xml-lang="en-US">Zoom factor</fixedline>
+ <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" xml-lang="en-US">Whole Page</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" xml-lang="en-US">Page Width</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" xml-lang="en-US">Optimal</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_200" xml-lang="en-US">200 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_150" xml-lang="en-US">15~0 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_100" xml-lang="en-US">100 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_75" xml-lang="en-US">75 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_50" xml-lang="en-US">50 %</radiobutton>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" xml-lang="en-US">Variable</radiobutton>
+ </align>
+ <flow cnt:padding="10" cnt:expand="false"/>
+ <metricfield id="ED_USER" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ text="100%" unit="13" custom-unit-text="%"
+ right="true"
+ cnt:expand="false"/>
+ </hbox>
+ <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton id="BTN_ZOOM_OK"/>
+ <cancelbutton id="BTN_ZOOM_CANCEL"/>
+ <helpbutton id="BTN_ZOOM_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom-indent.xml b/toolkit/workben/layout/zoom-indent.xml
new file mode 100644
index 000000000000..bd5853acdce4
--- /dev/null
+++ b/toolkit/workben/layout/zoom-indent.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Set Zoom" optimumsize="true"
+ help-id="SID_ATTR_ZOOM"
+ has_border="true" sizeable="true" moveable="true">
+ <hbox border="5" spacing="0">
+ <vbox spacing="0">
+ <fixedline id="FixedLine" text="Zoom factor" cnt:expand="true"/>
+ <hbox> <!-- for left margin !-->
+ <vbox cnt:padding="13" spacing="4" cnt:expand="true">
+ <radiobutton radiogroup="zoom" id="WholePage" label="Whole Page"/>
+ <radiobutton radiogroup="zoom" id="PageWidth" label="Page Width"/>
+ <radiobutton radiogroup="zoom" id="Optimal" label="Optimal"/>
+ <radiobutton radiogroup="zoom" id="Zoom200" label="~200 %"/>
+ <radiobutton radiogroup="zoom" id="Zoom150" label="15~0 %"/>
+ <radiobutton radiogroup="zoom" id="Zoom100" label="~100 %"/>
+ <radiobutton radiogroup="zoom" id="Zoom75" label="~75 %"/>
+ <radiobutton radiogroup="zoom" id="Zoom50" label="~50 %"/>
+ <hbox cnt:expand="false">
+ <align cnt:expand="false">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BtnUser" label="~Variable"/>
+ </align>
+ <flow cnt:padding="10" cnt:expand="false"/>
+ <metricfield id="User" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ text="100%" unit="11" custom-unit-text="%"
+ right="true"/>
+ <flow cnt:padding="10" cnt:expand="true"/>
+ </hbox>
+ </vbox>
+ </hbox>
+ </vbox>
+ <vbox border="6" spacing="4">
+ <okbutton id="OkButton" cnt:expand="false" defbutton="true"/>
+ <cancelbutton id="CancelButton" cnt:expand="false"/>
+ <helpbutton id="HelpButton" cnt:expand="false"/>
+ </vbox>
+ </hbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom-plain.xml b/toolkit/workben/layout/zoom-plain.xml
new file mode 100644
index 000000000000..c8383b8767a7
--- /dev/null
+++ b/toolkit/workben/layout/zoom-plain.xml
@@ -0,0 +1,20 @@
+
+
+<modaldialog sizeable="true" height="142" help-id="SID_ATTR_ZOOM" moveable="true" output-size="true" id="RID_SVXDLG_ZOOM" sv-look="true" text="Zoom" width="160" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox>
+ <fixedline height="8" id="FL_ZOOM" text="Zoom factor" width="92" x="6" y="3"/>
+ <okbutton defbutton="true" height="14" id="BTN_ZOOM_OK" width="50" x="104" y="6"/>
+ <radiobutton height="10" id="BTN_WHOLE_PAGE" width="80" x="12" y="14"/>
+ <cancelbutton height="14" id="BTN_ZOOM_CANCEL" width="50" x="104" y="23"/>
+ <radiobutton height="10" id="BTN_PAGE_WIDTH" width="80" x="12" y="27"/>
+ <radiobutton height="10" id="BTN_OPTIMAL" width="80" x="12" y="40"/>
+ <helpbutton height="14" id="BTN_ZOOM_HELP" width="50" x="104" y="43"/>
+ <radiobutton height="10" id="BTN_200" label="~200 %" width="80" x="12" y="53"/>
+ <radiobutton height="10" id="BTN_150" label="15~0 %" width="80" x="12" y="66"/>
+ <radiobutton height="10" id="BTN_100" label="~100 %" width="80" x="12" y="79"/>
+ <radiobutton height="10" id="BTN_75" label="~75 %" width="80" x="12" y="92"/>
+ <radiobutton height="10" id="BTN_50" label="~50 %" width="80" x="12" y="105"/>
+ <metricfield has_border="true" custom-unit-text="%" group="true" height="12" left="true" repeat="true" id="ED_USER" spin="true" step-size="1" unit="FUNIT_CUSTOM" width="36" x="56" y="120"/>
+ <radiobutton height="10" id="BTN_USER" label="~Variable" width="42" x="12" y="121"/>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom.cxx b/toolkit/workben/layout/zoom.cxx
new file mode 100644
index 000000000000..d05074908475
--- /dev/null
+++ b/toolkit/workben/layout/zoom.cxx
@@ -0,0 +1,614 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#if !TEST_LAYOUT
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#endif /* !TEST_LAYOUT */
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+
+// include ---------------------------------------------------------------
+
+#if TEST_LAYOUT
+#include <cstdio>
+#endif /* TEST_LAYOUT */
+#include <tools/shl.hxx>
+#include <svtools/itemset.hxx>
+#include <svtools/itempool.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+
+#define _SVX_ZOOM_CXX
+
+#include <svx/dialogs.hrc>
+#if !TEST_LAYOUT
+#include "zoom.hrc"
+#endif /* !TEST_LAYOUT */
+
+#include "zoom.hxx"
+#if TEST_LAYOUT
+#define SVX_ZOOM_OPTIMAL "Zoom optimal"
+#define SVX_ZOOM_PAGEWIDTH "Zoom page width"
+#define SVX_ZOOM_WHOLEPAGE "Zoom whole page"
+struct SvxZoomItem
+{
+ void SetType( char const* s )
+ {
+ fputs( s, stderr );
+ }
+
+ void SetValue( int n )
+ {
+ fprintf( stderr, "Zoom factor: %d\n", int( n ) );
+ }
+};
+#define SfxPoolItem LAYOUT_SfxPoolItem
+class LAYOUT_SfxPoolItem
+{
+};
+struct SvxViewLayoutItem : public LAYOUT_SfxPoolItem
+{
+ bool IsBookMode()
+ {
+ return false;
+ }
+ USHORT GetValue()
+ {
+ return 0;
+ }
+
+ void SetValue( int n )
+ {
+ fprintf( stderr, "Zoom factor: %d\n", int( n ) );
+ }
+ void SetBookMode( bool )
+ {
+ }
+};
+#else /* !TEST_LAYOUT */
+#include <svx/zoomitem.hxx>
+#include <svx/viewlayoutitem.hxx>
+#include <svx/dialmgr.hxx>
+#endif /* !TEST_LAYOUT */
+#include "zoom_def.hxx"
+
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "zoom.xml", id )
+#endif /* ENABLE_LAYOUT */
+
+// static ----------------------------------------------------------------
+
+static USHORT pRanges[] =
+{
+ SID_ATTR_ZOOM,
+ SID_ATTR_ZOOM,
+ 0
+};
+
+#define SPECIAL_FACTOR ((USHORT)0xFFFF)
+
+// class SvxZoomDialog ---------------------------------------------------
+
+USHORT SvxZoomDialog::GetFactor() const
+{
+ if ( a100Btn.IsChecked() )
+ return 100;
+ if ( aUserBtn.IsChecked() )
+ return (USHORT)aUserEdit.GetValue();
+ else
+ return SPECIAL_FACTOR;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetFactor( USHORT nNewFactor, USHORT nBtnId )
+{
+#if TEST_LAYOUT
+ printf ("\t\t set factor %d\n", (int)nNewFactor);
+#endif /* !TEST_LAYOUT */
+ aUserEdit.Disable();
+
+ if ( !nBtnId )
+ {
+ if ( nNewFactor == 100 )
+ {
+ a100Btn.Check();
+ a100Btn.GrabFocus();
+ }
+ else
+ {
+ aUserBtn.Check();
+ aUserEdit.Enable();
+ aUserEdit.SetValue( (long)nNewFactor );
+ aUserEdit.GrabFocus();
+ }
+ }
+ else
+ {
+ aUserEdit.SetValue( (long)nNewFactor );
+
+ if ( ZOOMBTN_OPTIMAL == nBtnId )
+ {
+ aOptimalBtn.Check();
+ aOptimalBtn.GrabFocus();
+ }
+ else if ( ZOOMBTN_PAGEWIDTH == nBtnId )
+ {
+ aPageWidthBtn.Check();
+ aPageWidthBtn.GrabFocus();
+ }
+ else if ( ZOOMBTN_WHOLEPAGE == nBtnId )
+ {
+ aWholePageBtn.Check();
+ aWholePageBtn.GrabFocus();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetButtonText( USHORT nBtnId, const String& rNewTxt )
+{
+ switch ( nBtnId )
+ {
+ case ZOOMBTN_OPTIMAL: // Optimal-Button
+ aOptimalBtn.SetText( rNewTxt );
+ break;
+
+ case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button
+ aPageWidthBtn.SetText( rNewTxt );
+ break;
+
+ case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button
+ aWholePageBtn.SetText( rNewTxt );
+ break;
+
+ default:
+ OSL_FAIL( "wrong button number" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::HideButton( USHORT nBtnId )
+{
+ switch ( nBtnId )
+ {
+ case ZOOMBTN_OPTIMAL: // Optimal-Button
+ aOptimalBtn.Hide();
+ break;
+
+ case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button
+ aPageWidthBtn.Hide();
+ break;
+
+ case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button
+ aWholePageBtn.Hide();
+ break;
+
+ default:
+ OSL_FAIL( "Falsche Button-Nummer!!!" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetLimits( USHORT nMin, USHORT nMax )
+{
+ DBG_ASSERT( nMin < nMax, "invalid limits" );
+ aUserEdit.SetMin( nMin );
+ aUserEdit.SetFirst( nMin );
+ aUserEdit.SetMax( nMax );
+ aUserEdit.SetLast( nMax );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetSpinSize( USHORT nNewSpin )
+{
+ aUserEdit.SetSpinSize( nNewSpin );
+}
+
+// -----------------------------------------------------------------------
+
+#if TEST_LAYOUT
+SvxZoomDialog::SvxZoomDialog( Window* pParent ) :
+#else /* !TEST_LAYOUT */
+SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) :
+#endif /* !TEST_LAYOUT */
+
+ SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_ZOOM ) ),
+
+ aZoomFl ( this, SVX_RES( FL_ZOOM ) ),
+ aOptimalBtn ( this, SVX_RES( BTN_OPTIMAL ) ),
+ aWholePageBtn ( this, SVX_RES( BTN_WHOLE_PAGE ) ),
+ aPageWidthBtn ( this, SVX_RES( BTN_PAGE_WIDTH ) ),
+ a100Btn ( this, SVX_RES( BTN_100 ) ),
+ aUserBtn ( this, SVX_RES( BTN_USER ) ),
+ aUserEdit ( this, SVX_RES( ED_USER ) ),
+
+ aViewLayoutFl ( this, SVX_RES( FL_VIEWLAYOUT ) ),
+ aAutomaticBtn ( this, SVX_RES( BTN_AUTOMATIC ) ),
+ aSingleBtn ( this, SVX_RES( BTN_SINGLE ) ),
+ aColumnsBtn ( this, SVX_RES( BTN_COLUMNS ) ),
+ aColumnsEdit ( this, SVX_RES( ED_COLUMNS ) ),
+ aBookModeChk ( this, SVX_RES( CHK_BOOK ) ),
+
+ aBottomFl ( this, SVX_RES( FL_BOTTOM ) ),
+ aOKBtn ( this, SVX_RES( BTN_ZOOM_OK ) ),
+ aCancelBtn ( this, SVX_RES( BTN_ZOOM_CANCEL ) ),
+ aHelpBtn ( this, SVX_RES( BTN_ZOOM_HELP ) ),
+
+#if !TEST_LAYOUT
+ rSet ( rCoreSet ),
+#endif /* !TEST_LAYOUT */
+ pOutSet ( NULL ),
+ bModified ( FALSE )
+
+{
+#if ENABLE_LAYOUT
+ SetHelpId (SID_ATTR_ZOOM);
+#endif /* ENABLE_LAYOUT */
+ Link aLink = LINK( this, SvxZoomDialog, UserHdl );
+ a100Btn.SetClickHdl( aLink );
+ aOptimalBtn.SetClickHdl( aLink );
+ aPageWidthBtn.SetClickHdl( aLink );
+ aWholePageBtn.SetClickHdl( aLink );
+ aUserBtn.SetClickHdl( aLink );
+
+ Link aViewLayoutLink = LINK( this, SvxZoomDialog, ViewLayoutUserHdl );
+ aAutomaticBtn.SetClickHdl( aViewLayoutLink );
+ aSingleBtn.SetClickHdl( aViewLayoutLink );
+ aColumnsBtn.SetClickHdl( aViewLayoutLink );
+
+ Link aViewLayoutSpinLink = LINK( this, SvxZoomDialog, ViewLayoutSpinHdl );
+ aColumnsEdit.SetModifyHdl( aViewLayoutSpinLink );
+
+ Link aViewLayoutCheckLink = LINK( this, SvxZoomDialog, ViewLayoutCheckHdl );
+ aBookModeChk.SetClickHdl( aViewLayoutCheckLink );
+
+ aOKBtn.SetClickHdl( LINK( this, SvxZoomDialog, OKHdl ) );
+ aUserEdit.SetModifyHdl( LINK( this, SvxZoomDialog, SpinHdl ) );
+
+ // Default-Werte
+ USHORT nValue = 100;
+ USHORT nMin = 10;
+ USHORT nMax = 1000;
+
+#if !TEST_LAYOUT
+ // ggf. erst den alten Wert besorgen
+ const SfxUInt16Item* pOldUserItem = 0;
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ pOldUserItem = (const SfxUInt16Item*)pSh->GetItem( SID_ATTR_ZOOM_USER );
+
+ if ( pOldUserItem )
+ nValue = pOldUserItem->GetValue();
+
+ // UserEdit initialisieren
+ if ( nMin > nValue )
+ nMin = nValue;
+ if ( nMax < nValue )
+ nMax = nValue;
+#endif /* !TEST_LAYOUT */
+ aUserEdit.SetMin( nMin );
+ aUserEdit.SetFirst( nMin );
+ aUserEdit.SetMax( nMax );
+ aUserEdit.SetLast( nMax );
+ aUserEdit.SetValue( nValue );
+
+#if TEST_LAYOUT
+ USHORT nZoom = 100;
+ SetFactor( nZoom );
+#else /* !TEST_LAYOUT */
+ const SfxPoolItem& rItem = rSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) );
+
+ if ( rItem.ISA(SvxZoomItem) )
+ {
+ const SvxZoomItem& rZoomItem = (const SvxZoomItem&)rItem;
+ const USHORT nZoom = rZoomItem.GetValue();
+ const SvxZoomType eType = rZoomItem.GetType();
+ const USHORT nValSet = rZoomItem.GetValueSet();
+ USHORT nBtnId = 0;
+
+ switch ( eType )
+ {
+ case SVX_ZOOM_OPTIMAL:
+ nBtnId = ZOOMBTN_OPTIMAL;
+ break;
+ case SVX_ZOOM_PAGEWIDTH:
+ nBtnId = ZOOMBTN_PAGEWIDTH;
+ break;
+ case SVX_ZOOM_WHOLEPAGE:
+ nBtnId = ZOOMBTN_WHOLEPAGE;
+ break;
+ case SVX_ZOOM_PERCENT:
+ break;
+ case SVX_ZOOM_PAGEWIDTH_NOBORDER:
+ break;
+ }
+
+ if ( !(SVX_ZOOM_ENABLE_100 & nValSet) )
+ a100Btn.Disable();
+ if ( !(SVX_ZOOM_ENABLE_OPTIMAL & nValSet) )
+ aOptimalBtn.Disable();
+ if ( !(SVX_ZOOM_ENABLE_PAGEWIDTH & nValSet) )
+ aPageWidthBtn.Disable();
+ if ( !(SVX_ZOOM_ENABLE_WHOLEPAGE & nValSet) )
+ aWholePageBtn.Disable();
+ SetFactor( nZoom, nBtnId );
+ }
+ else
+ {
+ const USHORT nZoom = ( (const SfxUInt16Item&)rItem ).GetValue();
+ SetFactor( nZoom );
+ }
+
+ const SfxPoolItem* pViewLayoutItem = 0;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_VIEWLAYOUT, FALSE, &pViewLayoutItem ) )
+ {
+ const USHORT nColumns = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->GetValue();
+ const bool bBookMode = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->IsBookMode();
+
+ if ( 0 == nColumns )
+ {
+ aAutomaticBtn.Check();
+ aColumnsEdit.SetValue( 2 );
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else if ( 1 == nColumns)
+ {
+ aSingleBtn.Check();
+ aColumnsEdit.SetValue( 2 );
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else
+ {
+ aColumnsBtn.Check();
+ if ( !bBookMode )
+ {
+ aColumnsEdit.SetValue( nColumns );
+ if ( 0 != nColumns % 2 )
+ aBookModeChk.Disable();
+ }
+ else
+ {
+ aColumnsEdit.SetValue( nColumns );
+ aBookModeChk.Check();
+ }
+ }
+ }
+ else
+ {
+ // hide view layout related controls:
+ aViewLayoutFl.Disable();
+ aAutomaticBtn.Disable();
+ aSingleBtn.Disable();
+ aColumnsBtn.Disable();
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+#endif /* !TEST_LAYOUT */
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomDialog::~SvxZoomDialog()
+{
+ delete pOutSet;
+ pOutSet = 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxZoomDialog::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, UserHdl, RadioButton *, pBtn )
+{
+#if TEST_LAYOUT
+ fprintf( stderr, "SvxZoomDialog::UserHdl\n" );
+#endif /* TEST_LAYOUT */
+ bModified |= TRUE;
+
+ if ( pBtn == &aUserBtn )
+ {
+ aUserEdit.Enable();
+ aUserEdit.GrabFocus();
+ }
+ else
+ aUserEdit.Disable();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, SpinHdl, MetricField *, EMPTYARG )
+{
+ if ( !aUserBtn.IsChecked() )
+ return 0;
+ bModified |= TRUE;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutUserHdl, RadioButton *, pBtn )
+{
+ bModified |= TRUE;
+
+ if ( pBtn == &aAutomaticBtn )
+ {
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else if ( pBtn == &aSingleBtn )
+ {
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else if ( pBtn == &aColumnsBtn )
+ {
+ aColumnsEdit.Enable();
+ aColumnsEdit.GrabFocus();
+ if ( 0 == aColumnsEdit.GetValue() % 2 )
+ aBookModeChk.Enable();
+ }
+ else
+ {
+ OSL_FAIL( "Wrong Button" );
+ return 0;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutSpinHdl, MetricField *, pEdt )
+{
+ if ( pEdt == &aColumnsEdit && !aColumnsBtn.IsChecked() )
+ return 0;
+
+ if ( 0 == aColumnsEdit.GetValue() % 2 )
+ aBookModeChk.Enable();
+ else
+ {
+ aBookModeChk.Check( sal_False );
+ aBookModeChk.Disable();
+ }
+
+ bModified |= TRUE;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutCheckHdl, CheckBox *, pChk )
+{
+ if ( pChk == &aBookModeChk && !aColumnsBtn.IsChecked() )
+ return 0;
+
+ bModified |= TRUE;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, OKHdl, Button *, pBtn )
+{
+ if ( bModified || &aOKBtn != pBtn )
+ {
+#if TEST_LAYOUT
+ SvxZoomItem aZoomItem;
+ SvxViewLayoutItem aViewLayoutItem;
+#else /* !TEST_LAYOUT */
+ SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, 0, rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) );
+ SvxViewLayoutItem aViewLayoutItem( 0, false, rSet.GetPool()->GetWhich( SID_ATTR_VIEWLAYOUT ) );
+#endif /* !TEST_LAYOUT */
+
+ if ( &aOKBtn == pBtn )
+ {
+ USHORT nFactor = GetFactor();
+
+ if ( SPECIAL_FACTOR == nFactor )
+ {
+ if ( aOptimalBtn.IsChecked() )
+ aZoomItem.SetType( SVX_ZOOM_OPTIMAL );
+ else if ( aPageWidthBtn.IsChecked() )
+ aZoomItem.SetType( SVX_ZOOM_PAGEWIDTH );
+ else if ( aWholePageBtn.IsChecked() )
+ aZoomItem.SetType( SVX_ZOOM_WHOLEPAGE );
+ }
+ else
+ aZoomItem.SetValue( nFactor );
+
+ if ( aAutomaticBtn.IsChecked() )
+ {
+ aViewLayoutItem.SetValue( 0 );
+ aViewLayoutItem.SetBookMode( false );
+ }
+ if ( aSingleBtn.IsChecked() )
+ {
+ aViewLayoutItem.SetValue( 1 );
+ aViewLayoutItem.SetBookMode( false );
+ }
+ else if ( aColumnsBtn.IsChecked() )
+ {
+ aViewLayoutItem.SetValue( static_cast<USHORT>(aColumnsEdit.GetValue()) );
+ aViewLayoutItem.SetBookMode( aBookModeChk.IsChecked() );
+ }
+ }
+ else
+ {
+ OSL_FAIL( "Wrong Button" );
+ return 0;
+ }
+#if !TEST_LAYOUT
+ pOutSet = new SfxItemSet( rSet );
+ pOutSet->Put( aZoomItem );
+
+ // don't set attribute in case the whole viewlayout stuff is disabled:
+ if ( aViewLayoutFl.IsEnabled() )
+ pOutSet->Put( aViewLayoutItem );
+
+ // Wert aus dem UserEdit "uber den Dialog hinaus merken
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ pSh->PutItem( SfxUInt16Item( SID_ATTR_ZOOM_USER,
+ (UINT16)aUserEdit.GetValue() ) );
+#endif /* !TEST_LAYOUT */
+ EndDialog( RET_OK );
+ }
+ else
+ EndDialog( RET_CANCEL );
+ return 0;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/zoom.hrc b/toolkit/workben/layout/zoom.hrc
new file mode 100644
index 000000000000..49412ad085f0
--- /dev/null
+++ b/toolkit/workben/layout/zoom.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ZOOM_HRC
+#define _SVX_ZOOM_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FL_ZOOM 14
+#define BTN_OPTIMAL 15
+#define BTN_WHOLE_PAGE 16
+#define BTN_PAGE_WIDTH 17
+#define BTN_100 18
+#define BTN_USER 19
+#define ED_USER 20
+
+#define FL_VIEWLAYOUT 21
+#define BTN_AUTOMATIC 22
+#define BTN_SINGLE 23
+#define BTN_COLUMNS 24
+#define ED_COLUMNS 25
+#define CHK_BOOK 26
+
+#define FL_BOTTOM 27
+#define BTN_ZOOM_OK 28
+#define BTN_ZOOM_CANCEL 29
+#define BTN_ZOOM_HELP 30
+
+#endif
+
diff --git a/toolkit/workben/layout/zoom.hxx b/toolkit/workben/layout/zoom.hxx
new file mode 100644
index 000000000000..0fab50eb1ced
--- /dev/null
+++ b/toolkit/workben/layout/zoom.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ZOOM_HXX
+#define _SVX_ZOOM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <layout/layout.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+
+// define ----------------------------------------------------------------
+/* CHINA001
+#define ZOOMBTN_OPTIMAL ((USHORT)0x0001)
+#define ZOOMBTN_PAGEWIDTH ((USHORT)0x0002)
+#define ZOOMBTN_WHOLEPAGE ((USHORT)0x0004)
+*/
+#include "zoom_def.hxx"
+// class SvxZoomDialog ---------------------------------------------------
+/*
+ {k:\svx\prototyp\dialog\zoom.bmp}
+
+ [Beschreibung]
+ Mit diesem Dialog wird ein Zoom-Faktor eingestellt.
+
+ [Items]
+ SvxZoomItem <SID_ATTR_ZOOM>
+*/
+
+#include <layout/layout-pre.hxx>
+
+class SvxZoomDialog : public SfxModalDialog
+{
+private:
+ FixedLine aZoomFl;
+ RadioButton aOptimalBtn;
+ RadioButton aWholePageBtn;
+ RadioButton aPageWidthBtn;
+ RadioButton a100Btn;
+ RadioButton aUserBtn;
+ MetricField aUserEdit;
+
+ FixedLine aViewLayoutFl;
+ RadioButton aAutomaticBtn;
+ RadioButton aSingleBtn;
+ RadioButton aColumnsBtn;
+ MetricField aColumnsEdit;
+ CheckBox aBookModeChk;
+
+ FixedLine aBottomFl;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+#if !TEST_LAYOUT
+ const SfxItemSet& rSet;
+#endif /* !TEST_LAYOUT */
+ SfxItemSet* pOutSet;
+ BOOL bModified;
+
+#ifdef _SVX_ZOOM_CXX
+ DECL_LINK( UserHdl, RadioButton* );
+ DECL_LINK( SpinHdl, MetricField* );
+ DECL_LINK( ViewLayoutUserHdl, RadioButton* );
+ DECL_LINK( ViewLayoutSpinHdl, MetricField* );
+ DECL_LINK( ViewLayoutCheckHdl, CheckBox* );
+ DECL_LINK( OKHdl, Button* );
+#endif
+
+public:
+#if TEST_LAYOUT
+ SvxZoomDialog( Window* pParent );
+#else /* !TEST_LAYOUT */
+ SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet );
+#endif /* !TEST_LAYOUT */
+ ~SvxZoomDialog();
+
+ static USHORT* GetRanges();
+ const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
+
+ USHORT GetFactor() const;
+ void SetFactor( USHORT nNewFactor, USHORT nBtnId = 0 );
+
+ void SetButtonText( USHORT nBtnId, const String& aNewTxt );
+ void HideButton( USHORT nBtnId );
+ void SetLimits( USHORT nMin, USHORT nMax );
+ void SetSpinSize( USHORT nNewSpin );
+};
+
+#include <layout/layout-post.hxx>
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/workben/layout/zoom.xml b/toolkit/workben/layout/zoom.xml
new file mode 100644
index 000000000000..5cc376168a27
--- /dev/null
+++ b/toolkit/workben/layout/zoom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="RID_SVXDLG_ZOOM" _title="Zoom &amp; View Layout" optimumsize="true"
+ help-id="SID_ATTR_ZOOM"
+ has_border="true" sizeable="true" moveable="true" closeable="true">
+ <vbox spacing="0" border="12">
+ <hbox spacing="0" border="0">
+ <vbox spacing="6" border="0">
+ <fixedline id="FL_ZOOM" _text="Zoom factor" cnt:expand="false"/>
+ <radiobutton radiogroup="zoom-factor" id="BTN_OPTIMAL" _label="Optimal"/>
+ <radiobutton radiogroup="zoom-factor" id="BTN_WHOLE_PAGE" _label="Whole Page"/>
+ <radiobutton radiogroup="zoom-factor" id="BTN_PAGE_WIDTH" _label="Page Width"/>
+ <radiobutton radiogroup="zoom-factor" id="BTN_100" _label="100 %"/>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-factor" id="BTN_USER" _label="Variable"/>
+ </align>
+ <flow cnt:padding="12" cnt:expand="false"/>
+ <metricfield id="ED_USER" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ _text="100%" unit="11" custom-unit-text="%"
+ right="true"
+ cnt:expand="false"/>
+ </hbox>
+ </vbox>
+ <flow/>
+ <vbox spacing="6" border="0">
+ <fixedline id="FL_VIEWLAYOUT" _text="View layout" cnt:expand="false"/>
+ <radiobutton radiogroup="zoom-layout" id="BTN_AUTOMATIC" _label="~Automatic"/>
+ <radiobutton radiogroup="zoom-layout" id="BTN_SINGLE" _label="~Single page"/>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-layout" id="BTN_COLUMNS" _label="~Columns"/>
+ </align>
+ <flow cnt:padding="12" cnt:expand="false"/>
+ <metricfield id="ED_COLUMNS" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ _text="100%"
+ right="true"
+ spin-value-min="1"
+ spin-value="1"
+ cnt:expand="false"/>
+ </hbox>
+ <hbox><flow cnt:expand="false" cnt:padding="12"/><checkbox id="CHK_BOOK" _label="~Book mode"/></hbox>
+ </vbox>
+ </hbox>
+ <fixedline cnt:padding="6" id="FL_BOTTOM"/>
+ <dialogbuttonhbox border="0" spacing="12">
+ <flow/>
+ <okbutton defbutton="true" id="BTN_ZOOM_OK"/>
+ <cancelbutton id="BTN_ZOOM_CANCEL"/>
+ <helpbutton id="BTN_ZOOM_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom_def.hxx b/toolkit/workben/layout/zoom_def.hxx
new file mode 100644
index 000000000000..84b2db945a6e
--- /dev/null
+++ b/toolkit/workben/layout/zoom_def.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ZOOM_DEF_HXX
+#define _SVX_ZOOM_DEF_HXX
+
+#define ZOOMBTN_OPTIMAL ((USHORT)0x0001)
+#define ZOOMBTN_PAGEWIDTH ((USHORT)0x0002)
+#define ZOOMBTN_WHOLEPAGE ((USHORT)0x0004)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */