ooo-build r13867 - in trunk: . patches/dev300



Author: jannieuw
Date: Wed Sep 10 14:58:03 2008
New Revision: 13867
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13867&view=rev

Log:
2008-09-10  Jan Nieuwenhuizen  <janneke gnu org>

	* patches/dev300/layout-simple-dialogs-sd.diff:
	* patches/dev300/layout-simple-dialogs-sfx2.diff:
	* patches/dev300/layout-simple-dialogs-svx.diff.orig:
	* patches/dev300/layout-simple-dialogs-scripting.diff:
	* patches/dev300/layout-simple-dialogs-starmath.diff:
	* patches/dev300/layout-simple-dialogs-vcl.diff: New file.

	* patches/dev300/apply (LayoutDialogs): Add them.

	* patches/dev300/layout-simple-dialogs-solenv.diff:
	* patches/dev300/layout-simple-dialogs-sc.diff:
	* patches/dev300/layout-simple-dialogs-offapi.diff:
	* patches/dev300/layout-simple-dialogs-sw.diff:
	* patches/dev300/layout-simple-dialogs-toolkit.diff:
	* patches/dev300/layout-simple-dialogs-svx.diff: Implement
	layout::TabControl, allowing layout style buttons and layouting
	for tabbed dialogs [still problematic].  Convert Find&Replace
	dialog to layout.


Added:
   trunk/patches/dev300/layout-simple-dialogs-scripting.diff
   trunk/patches/dev300/layout-simple-dialogs-sd.diff
   trunk/patches/dev300/layout-simple-dialogs-sfx2.diff
   trunk/patches/dev300/layout-simple-dialogs-starmath.diff
   trunk/patches/dev300/layout-simple-dialogs-svx.diff.orig
   trunk/patches/dev300/layout-simple-dialogs-vcl.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply
   trunk/patches/dev300/layout-simple-dialogs-sc.diff
   trunk/patches/dev300/layout-simple-dialogs-solenv.diff
   trunk/patches/dev300/layout-simple-dialogs-svx.diff
   trunk/patches/dev300/layout-simple-dialogs-sw.diff
   trunk/patches/dev300/layout-simple-dialogs-toolkit.diff

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Wed Sep 10 14:58:03 2008
@@ -2045,10 +2045,15 @@
 layout-simple-dialogs-sc-localize.diff
 layout-simple-dialogs-sc.diff
 layout-simple-dialogs-scp2.diff
+layout-simple-dialogs-scripting.diff
+layout-simple-dialogs-sd.diff
+layout-simple-dialogs-sfx2.diff
 layout-simple-dialogs-solenv.diff
+layout-simple-dialogs-starmath.diff
 layout-simple-dialogs-svx.diff
 layout-simple-dialogs-sw.diff
 layout-simple-dialogs-toolkit.diff
+layout-simple-dialogs-vcl.diff
 
 # FIXME: hack to avoid internal copiler error with gcc (SUSE Linux) 4.3.2 20080613 (prerelease)
 #        on openSUSE-11.1-alpha0; pmladek is discussing it with the gcc team

Modified: trunk/patches/dev300/layout-simple-dialogs-sc.diff
==============================================================================
--- trunk/patches/dev300/layout-simple-dialogs-sc.diff	(original)
+++ trunk/patches/dev300/layout-simple-dialogs-sc.diff	Wed Sep 10 14:58:03 2008
@@ -13,6 +13,117 @@
  # --- Files --------------------------------------------------------
  
  CXXFILES =  attrdlg.cxx		\
+diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
+index de9b284..29c2053 100644
+--- sc/source/ui/attrdlg/scdlgfact.cxx
++++ sc/source/ui/attrdlg/scdlgfact.cxx
+@@ -81,6 +81,7 @@
+ 
+ // ause
+ #include "editutil.hxx"
++#include <sfx2/layout.hxx>
+ 
+ IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl); //add for ScColOrRowDlg
+ IMPL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl);//CHINA001 add for ScImportAsciiDlg
+@@ -116,6 +117,40 @@ IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl); //add for ScStringInputDlg
+ IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); //add for ScImportOptionsDlg
+ IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
+ 
++// AbstractTabDialog_Impl begin
++void AbstractTabDialog_Impl::SetCurPageId( USHORT nId )
++{
++	pDlg->SetCurPageId( nId );
++}
++
++const SfxItemSet* AbstractTabDialog_Impl::GetOutputItemSet() const
++{
++	return pDlg->GetOutputItemSet();
++}
++//add by CHINA001
++const USHORT* AbstractTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
++{
++	return pDlg->GetInputRanges( pItem );
++}
++//add by CHINA001
++void AbstractTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
++{
++	 pDlg->SetInputSet( pInSet );
++}
++//From class Window.
++void AbstractTabDialog_Impl::SetText( const XubString& rStr )
++{
++	pDlg->SetText( rStr );
++}
++String AbstractTabDialog_Impl::GetText() const
++{
++	return pDlg->GetText();
++}
++
++#if ENABLE_LAYOUT
++namespace layout
++{
++IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
+ 
+ // AbstractTabDialog_Impl begin
+ void AbstractTabDialog_Impl::SetCurPageId( USHORT nId )
+@@ -146,6 +181,8 @@ String AbstractTabDialog_Impl::GetText() const
+ {
+ 	return pDlg->GetText();
+ }
++}
++#endif /* ENABLE_LAYOUT */
+ 
+ //add for AbstractTabDialog_Impl end
+ // AbstractScImportAsciiDlg_Impl begin
+@@ -1402,6 +1439,10 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScValidationDlg( Wind
+ }
+ //add for ScValidationDlg end
+ 
++#if ENABLE_LAYOUT && !LAYOUT_SFX_TABDIALOG_BROKEN
++#define SfxTabDialog layout::SfxTabDialog
++#define AbstractTabDialog_Impl layout::AbstractTabDialog_Impl
++#endif /* ENABLE_LAYOUT */
+ //add for ScSortDlg begin
+ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSortDlg( Window*			 pParent,
+ 													const SfxItemSet* pArgSet,int nId )
+@@ -1420,6 +1461,9 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSortDlg( Window*
+ 		return new AbstractTabDialog_Impl( pDlg );
+ 	return 0;
+ }
++#undef SfxTabDialog
++#undef AbstractTabDialog_Impl
++
+ //add for ScSortDlg end
+ //------------------ Factories for TabPages--------------------
+ CreateTabPage ScAbstractDialogFactory_Impl::GetTabPageCreatorFunc( USHORT nId )
+diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
+index 526a1ec..05864d1 100644
+--- sc/source/ui/attrdlg/scdlgfact.hxx
++++ sc/source/ui/attrdlg/scdlgfact.hxx
+@@ -361,6 +361,23 @@ class AbstractTabDialog_Impl : public SfxAbstractTabDialog
+     virtual void		SetText( const XubString& rStr ); //add by CHINA001
+     virtual String   	GetText() const; //add by CHINA001
+ };
++#if ENABLE_LAYOUT
++namespace layout
++{
++//add for ScAttrDlg , ScHFEditDlg, ScStyleDlg, ScSubTotalDlg, ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
++class AbstractTabDialog_Impl : public SfxAbstractTabDialog
++{
++	DECL_ABSTDLG_BASE( AbstractTabDialog_Impl,SfxTabDialog )
++	virtual void				SetCurPageId( USHORT nId );
++	virtual const SfxItemSet* 	GetOutputItemSet() const;
++	virtual const USHORT*		GetInputRanges( const SfxItemPool& pItem );	//add by CHINA001
++	virtual void				SetInputSet( const SfxItemSet* pInSet );   //add by CHINA001
++		//From class Window.
++    virtual void		SetText( const XubString& rStr ); //add by CHINA001
++    virtual String   	GetText() const; //add by CHINA001
++};
++} // end namespace layout
++#endif /* ENABLE_LAYOUT */
+ //------------------------------------------------------------------------
+ //AbstractDialogFactory_Impl implementations
+ class ScAbstractDialogFactory_Impl : public ScAbstractDialogFactory
 diff --git a/sc/source/ui/dbgui/makefile.mk b/sc/source/ui/dbgui/makefile.mk
 index f42f46c..0a95138 100644
 --- sc/source/ui/dbgui/makefile.mk
@@ -28,6 +139,67 @@
  # --- Files --------------------------------------------------------
  
  SLOFILES =	\
+diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx
+index e57eba6..576f910 100644
+--- sc/source/ui/dbgui/sortdlg.cxx
++++ sc/source/ui/dbgui/sortdlg.cxx
+@@ -40,8 +40,9 @@
+ #include "scresid.hxx"
+ #include "sortdlg.hrc"
+ 
+-
+-//==================================================================
++#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
++#include <layout/layout-pre.hxx>
++#endif
+ 
+ ScSortDlg::ScSortDlg( Window*			pParent,
+ 					  const SfxItemSet* pArgSet ) :
+@@ -52,8 +53,15 @@ ScSortDlg::ScSortDlg( Window*			pParent,
+ 		bIsByRows	( FALSE )
+ 
+ {
++#ifdef LAYOUT_SFX_TABDIALOG_BROKEN
+ 	AddTabPage( TP_FIELDS,	ScTabPageSortFields::Create,  0 );
+ 	AddTabPage( TP_OPTIONS,	ScTabPageSortOptions::Create, 0 );
++#else
++    String fields = rtl::OUString::createFromAscii ("fields");
++	AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, FALSE, TAB_APPEND);
++    String options = rtl::OUString::createFromAscii ("options");
++	AddTabPage( TP_OPTIONS,	options, ScTabPageSortOptions::Create, 0, FALSE, TAB_APPEND);
++#endif    
+ 	FreeResource();
+ }
+ 
+diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
+index f3f7e64..ead9819 100644
+--- sc/source/ui/dbgui/tpsort.cxx
++++ sc/source/ui/dbgui/tpsort.cxx
+@@ -542,7 +542,7 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
+ #undef ScResId
+ #define ScResId(x) #x
+ #undef SfxTabPage
+-#define SfxTabPage( parent, id, args ) TabPage( parent, "sort-options.xml", id, 0, &args )
++#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "sort-options.xml", id, &args )
+ #endif /* ENABLE_LAYOUT */
+ 
+ ScTabPageSortOptions::ScTabPageSortOptions( Window* 			pParent,
+@@ -572,6 +572,7 @@ ScTabPageSortOptions::ScTabPageSortOptions( Window* 			pParent,
+ //		aFtArea 		( this, ScResId( FT_AREA ) ),
+ 		//
+ #if ENABLE_LAYOUT
++#undef this
+ #undef ScResId
+ #define ScResId(x) this, #x
+ #endif /* ENABLE_LAYOUT */
+@@ -716,7 +717,6 @@ USHORT* __EXPORT ScTabPageSortOptions::GetRanges()
+ 
+ #if ENABLE_LAYOUT
+ #undef SfxTabPage
+-#define SfxTabPage TabPage
+ #endif /* ENABLE_LAYOUT */
+ SfxTabPage* __EXPORT ScTabPageSortOptions::Create(
+ 											Window*				pParent,
 diff --git a/sc/source/ui/inc/instbdlg.hxx b/sc/source/ui/inc/instbdlg.hxx
 index 3e2b6de..563b253 100644
 --- sc/source/ui/inc/instbdlg.hxx
@@ -72,6 +244,37 @@
  
  #endif // SC_MVTABDLG_HXX
  
+diff --git a/sc/source/ui/inc/sortdlg.hxx b/sc/source/ui/inc/sortdlg.hxx
+index d2ea7ed..54a676e 100644
+--- sc/source/ui/inc/sortdlg.hxx
++++ sc/source/ui/inc/sortdlg.hxx
+@@ -33,10 +33,12 @@
+ 
+ #include <sfx2/tabdlg.hxx>
+ 
+-#ifndef _SFX_HXX
+-#endif
++#define LAYOUT_SFX_TABDIALOG_BROKEN 1
+ 
+-//==================================================================
++#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
++#include <sfx2/layout.hxx>
++#include <layout/layout-pre.hxx>
++#endif
+ 
+ class ScSortDlg : public SfxTabDialog
+ {
+@@ -61,7 +63,8 @@ inline void ScSortDlg::SetByRows ( BOOL bByRows  )	{ bIsByRows = bByRows; }
+ inline BOOL ScSortDlg::GetHeaders() const 			{ return bIsHeaders; }
+ inline BOOL ScSortDlg::GetByRows () const 			{ return bIsByRows; }
+ 
++#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
++#include <layout/layout-post.hxx>
++#endif
+ 
+ #endif // SC_SORTDLG_HXX
+-
+-
 diff --git a/sc/source/ui/inc/strindlg.hxx b/sc/source/ui/inc/strindlg.hxx
 index 7ec9bc1..5cc06c6 100644
 --- sc/source/ui/inc/strindlg.hxx
@@ -94,6 +297,34 @@
  
  #endif // SC_STRINDLG_HXX
  
+diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
+index ed6bdc8..ea1b28d 100644
+--- sc/source/ui/inc/tpsort.hxx
++++ sc/source/ui/inc/tpsort.hxx
+@@ -132,7 +132,7 @@ class ScRangeData;
+ class CollatorRessource;
+ class CollatorWrapper;
+ 
+-#include <layout/layout.hxx>
++#include <sfx2/layout.hxx>
+ #include <layout/layout-pre.hxx>
+ 
+ class ScTabPageSortOptions : public SfxTabPage
+@@ -142,12 +142,10 @@ public:
+ 									  const SfxItemSet&	 rArgSet );
+ 				~ScTabPageSortOptions();
+ 
+-#if !ENABLE_LAYOUT
++#undef SfxTabPage
++#define SfxTabPage ::SfxTabPage
+ 	static	SfxTabPage*	Create		( Window*				pParent,
+ 									  const SfxItemSet& 	rArgSet );
+-#else /* ENABLE_LAYOUT */
+-    static TabPage*	Create ( Window* parent, SfxItemSet const& set );
+-#endif /* ENABLE_LAYOUT */
+ 	static	USHORT*		GetRanges	();
+ 	virtual	BOOL		FillItemSet	( SfxItemSet& rArgSet );
+ 	virtual	void		Reset		( const SfxItemSet& rArgSet );
 diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx
 index 60b49e8..f772631 100644
 --- sc/source/ui/miscdlgs/instbdlg.cxx
@@ -402,6 +633,21 @@
 +	</dialogbuttonhbox>
 +    </vbox>
 +</modaldialog>
+diff --git a/sc/uiconfig/layout/sort-options.xml b/sc/uiconfig/layout/sort-options.xml
+index e2e01f0..43144c1 100644
+--- sc/uiconfig/layout/sort-options.xml
++++ sc/uiconfig/layout/sort-options.xml
+@@ -33,8 +33,8 @@
+ 		<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)"/>
++            <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/sc/uiconfig/layout/string-input.xml b/sc/uiconfig/layout/string-input.xml
 new file mode 100644
 index 0000000..0a59899
@@ -424,24 +670,3 @@
 +	</dialogbuttonhbox>
 +    </vbox>
 +</modaldialog>
-commit 716fa99059c4ca3aa1ae4d85f94c80e19ff6ab43
-Author: Jan Nieuwenhuizen <janneke gnu org>
-Date:   Fri Aug 1 21:20:10 2008 +0200
-
-    Add radiogroup to sort-options. Fixes crasher.
-
-diff --git sc/uiconfig/layout/sort-options.xml sc/uiconfig/layout/sort-options.xml
-index e2e01f0..43144c1 100644
---- sc/uiconfig/layout/sort-options.xml
-+++ sc/uiconfig/layout/sort-options.xml
-@@ -33,8 +33,8 @@
- 		<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)"/>
-+            <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>

Added: trunk/patches/dev300/layout-simple-dialogs-scripting.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/layout-simple-dialogs-scripting.diff	Wed Sep 10 14:58:03 2008
@@ -0,0 +1,28 @@
+diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
+index 46c8bca..56a5315 100644
+--- scripting/source/protocolhandler/scripthandler.cxx
++++ scripting/source/protocolhandler/scripthandler.cxx
+@@ -539,6 +539,9 @@ const Reference< XMultiServiceFactory >& xServiceManager )
+ extern "C"
+ {
+ 
++#undef css
++#define css ::com::sun::star
++    
+     void SAL_CALL component_getImplementationEnvironment( 
+         const sal_Char** ppEnvironmentTypeName, uno_Environment** ppEnvironment )
+     {
+diff --git a/scripting/source/protocolhandler/scripthandler.hxx b/scripting/source/protocolhandler/scripthandler.hxx
+index 3f00fa4..61ba5b4 100644
+--- scripting/source/protocolhandler/scripthandler.hxx
++++ scripting/source/protocolhandler/scripthandler.hxx
+@@ -75,8 +75,7 @@ namespace com { namespace sun { namespace star {
+ namespace scripting_protocolhandler
+ {
+ 
+-// for simplification
+-#define css ::com::sun::star
++namespace css = ::com::sun::star;
+ 
+ class ScriptProtocolHandler : 
+ public ::cppu::WeakImplHelper4< css::frame::XDispatchProvider,

Added: trunk/patches/dev300/layout-simple-dialogs-sd.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/layout-simple-dialogs-sd.diff	Wed Sep 10 14:58:03 2008
@@ -0,0 +1,23 @@
+diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
+index 0906ad7..5391c52 100644
+--- sd/source/ui/view/Outliner.cxx
++++ sd/source/ui/view/Outliner.cxx
+@@ -1472,7 +1472,9 @@ bool Outliner::HandleFailedSearch (void)
+ }
+ 
+ 
+-
++#if ENABLE_LAYOUT
++#define SvxSearchDialog Window
++#endif
+ 
+ /** See task #95227# for discussion about correct parent for dialogs/info boxes.
+ */
+@@ -1495,6 +1497,7 @@ bool Outliner::HandleFailedSearch (void)
+     return pParent;
+ }
+ 
++#undef SvxSearchDialog Window
+ 
+ 
+ 

Added: trunk/patches/dev300/layout-simple-dialogs-sfx2.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/layout-simple-dialogs-sfx2.diff	Wed Sep 10 14:58:03 2008
@@ -0,0 +1,1007 @@
+diff --git a/sfx2/inc/sfx2/layout-tabdlg.hxx b/sfx2/inc/sfx2/layout-tabdlg.hxx
+new file mode 100644
+index 0000000..4b84083
+--- /dev/null
++++ sfx2/inc/sfx2/layout-tabdlg.hxx
+@@ -0,0 +1,49 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: tabdlg.hxx,v $
++ * $Revision: 1.4 $
++ *
++ * 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_SFX_TABDLG_HXX
++#define _LAYOUT_SFX_TABDLG_HXX
++
++#undef ENABLE_LAYOUT_SFX_TABDIALOG
++#define ENABLE_LAYOUT_SFX_TABDIALOG 1
++
++#undef NAMESPACE_LAYOUT_SFX_TABDIALOG
++#define NAMESPACE_LAYOUT_SFX_TABDIALOG namespace layout {
++
++#undef END_NAMESPACE_LAYOUT_SFX_TABDIALOG
++#define END_NAMESPACE_LAYOUT_SFX_TABDIALOG } //end namespace layout
++
++#undef LAYOUT_NS_SFX_TABDIALOG
++#define LAYOUT_NS_SFX_TABDIALOG layout::
++
++#undef _SFXTABDLG_HXX
++#include <sfx2/tabdlg.hxx>
++
++#endif /* _LAYOUT_SFX_TABDLG_HXX */
++
+diff --git a/sfx2/inc/sfx2/layout.hxx b/sfx2/inc/sfx2/layout.hxx
+new file mode 100644
+index 0000000..a279656
+--- /dev/null
++++ sfx2/inc/sfx2/layout.hxx
+@@ -0,0 +1,68 @@
++/*************************************************************************
++* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++* 
++* Copyright 2008 by Sun Microsystems, Inc.
++*
++* OpenOffice.org - a multi-platform office productivity suite
++*
++* $RCSfile: code,v $
++*
++* $Revision: 1.3 $
++*
++* 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 _SFX2_LAYOUT_HXX
++#define _SFX2_LAYOUT_HXX
++
++#include <layout/layout.hxx>
++#include <sfx2/tabdlg.hxx>
++#undef ENABLE_LAYOUT_SFX_TABDIALOG
++#define ENABLE_LAYOUT_SFX_TABDIALOG 1
++#include <sfx2/layout-tabdlg.hxx>
++
++namespace layout
++{
++
++namespace css = ::com::sun::star;
++#if 0
++class SFX2_DLLPUBLIC SfxTabDialog
++    : public ::SfxTabDialog
++    , public InPlug
++{
++public:
++    SfxTabDialog (::Window *parent, char const* xml_file, char const* id, ResId const& res_id, SfxItemSet const* set=0);
++    ::Window* GetParent () const;
++    void FreeResource ();
++};
++#endif
++
++class SFX2_DLLPUBLIC SfxTabPage
++    : public ::SfxTabPage
++    , public InPlug
++{
++public:
++    SfxTabPage (::Window *parent, char const* xml_file, char const* id, SfxItemSet const* set=0);
++    ::Window* GetParent () const;
++    Size GetOptimalSize (WindowSizeType eType) const;
++    void FreeResource ();
++};
++
++} // end namespace layout
++
++#endif /* _SFX2_LAYOUT_HXX */
+diff --git a/sfx2/inc/sfx2/sfxdlg.hxx b/sfx2/inc/sfx2/sfxdlg.hxx
+index a13c5a8..9e47ca1 100644
+--- sfx2/inc/sfx2/sfxdlg.hxx
++++ sfx2/inc/sfx2/sfxdlg.hxx
+@@ -55,8 +55,9 @@ class SvObjectServerList;
+ class TransferableDataHelper;
+ struct TransferableObjectDescriptor;
+ 
+-typedef SfxTabPage* (*CreateTabPage)(Window *pParent, const SfxItemSet &rAttrSet);
+-typedef USHORT*		(*GetTabPageRanges)();
++#include <sfx2/tabdlg.hxx>
++//typedef SfxTabPage* (*CreateTabPage)(Window *pParent, const SfxItemSet &rAttrSet);
++//typedef USHORT*		(*GetTabPageRanges)();
+ 
+ namespace sfx2
+ {
+diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx
+index b3eb789..b02bd15 100644
+--- sfx2/inc/sfx2/tabdlg.hxx
++++ sfx2/inc/sfx2/tabdlg.hxx
+@@ -34,17 +34,17 @@
+ #include "sfx2/dllapi.h"
+ #include "sal/types.h"
+ #include <vcl/tabdlg.hxx>
+-#ifndef _SV_BUTTON_HXX //autogen
+ #include <vcl/button.hxx>
+-#endif
+ #include <vcl/tabctrl.hxx>
+ #include <vcl/tabpage.hxx>
+ #include <svtools/itempool.hxx>
+ #include <svtools/itemset.hxx>
+ #include <com/sun/star/frame/XFrame.hpp>
+ 
+-#include <map>
+-namespace layout { class TabPage; }
++#if ENABLE_LAYOUT
++#include <layout/layout.hxx>
++namespace layout { class SfxTabDialog; }
++#endif /* ENABLE_LAYOUT */
+ 
+ class SfxPoolItem;
+ class SfxTabDialog;
+@@ -52,21 +52,27 @@ class SfxViewFrame;
+ class SfxTabPage;
+ class SfxBindings;
+ 
+-// typedefs --------------------------------------------------------------
++#ifndef ENABLE_LAYOUT_SFX_TABDIALOG
++#define ENABLE_LAYOUT_SFX_TABDIALOG 0
++#define NAMESPACE_LAYOUT_SFX_TABDIALOG
++#define END_NAMESPACE_LAYOUT_SFX_TABDIALOG
++#define LAYOUT_NS_SFX_TABDIALOG
++#endif /* !ENABLE_LAYOUT_SFX_TABDIALOG*/
+ 
+ typedef SfxTabPage* (*CreateTabPage)(Window *pParent, const SfxItemSet &rAttrSet);
+-namespace layout
+-{
+-class TabPage;
+-typedef TabPage* (*CreateTabPage)(::Window *pParent, ::SfxItemSet const& set );
+-}
+ typedef USHORT*		(*GetTabPageRanges)(); // liefert internationale Which-Wert
+-
+-struct TabDlg_Impl;
+ struct TabPageImpl;
+ class SfxUs_Impl;
+ 
+-// class SfxTabDialog ----------------------------------------------------
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++#include <layout/layout-pre.hxx>
++#undef SfxTabDialog
++#undef SfxTabPage
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
++
++NAMESPACE_LAYOUT_SFX_TABDIALOG
++
++class TabDlg_Impl;
+ 
+ #define ID_TABCONTROL	1
+ #define RET_USER 		100
+@@ -106,8 +112,6 @@ friend class SfxTabDialogController;
+ 	USHORT				nAppPageId;
+ 	BOOL				bItemsReset;
+ 	BOOL				bFmt;
+-    std::map<int, layout::TabPage*> layoutPages;
+-    std::map<int, layout::CreateTabPage> layoutPageFuncs;
+ 
+ //#if 0 // _SOLAR__PRIVATE
+ 	DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * );
+@@ -178,8 +182,6 @@ public:
+ 									BOOL bItemsOnDemand = FALSE,
+ 									USHORT nPos = TAB_APPEND);
+ 
+-    void AddTabPage( int id, layout::TabPage* page, bool=false );
+-    void AddTabPage( int id, layout::CreateTabPage, bool=false );
+ 	void				RemoveTabPage( USHORT nId );
+ 
+ 	void				SetCurPageId( USHORT nId ) { nAppPageId = nId; }
+@@ -215,7 +217,11 @@ public:
+     void                StartExecuteModal( const Link& rEndDialogHdl );
+ 	void				Start( BOOL bShow = TRUE );
+ 
++#if !ENABLE_LAYOUT_SFX_TABDIALOG
+ 	const SfxItemSet*	GetExampleSet() const { return pExampleSet; }
++#else /* ENABLE_LAYOUT_SFX_TABDIALOG */
++    SfxItemSet*	GetExampleSet() const { return 0; }
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
+ 	SfxViewFrame*		GetViewFrame() const { return pFrame; }
+ 
+ 	void				EnableApplyButton(BOOL bEnable = TRUE);
+@@ -229,13 +235,20 @@ public:
+ //#endif
+ };
+ 
+-// class SfxTabPage ------------------------------------------------------
++END_NAMESPACE_LAYOUT_SFX_TABDIALOG
++
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++#include <layout/layout-post.hxx>
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
++
++#if !ENABLE_LAYOUT_SFX_TABDIALOG
+ 
+ namespace sfx { class ItemConnectionBase; }
+ 
+ class SFX2_DLLPUBLIC SfxTabPage: public TabPage
+ {
+ friend class SfxTabDialog;
++friend class layout::SfxTabDialog;
+ 
+ private:
+ 	const SfxItemSet*	pSet;
+@@ -300,5 +313,7 @@ public:
+     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame();
+ };
+ 
++#endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */
++
+ #endif
+ 
+diff --git a/sfx2/prj/build.lst b/sfx2/prj/build.lst
+index d762a1d..72ba4ac 100644
+--- sfx2/prj/build.lst
++++ sfx2/prj/build.lst
+@@ -13,10 +13,11 @@ sf	sfx2\source\config						nmake	-	all	sf_cnfg sf_sdi sf_inc NULL
+ sf	sfx2\source\control						nmake	-	all	sf_ctrl sf_sdi sf_inc NULL
+ sf	sfx2\source\dialog						nmake	-	all	sf_dlg sf_sdi sf_inc NULL
+ sf	sfx2\source\doc							nmake	-	all	sf_doc sf_sdi sf_inc NULL
++sf	sfx2\source\layout						nmake	-	all	sf_layout sf_sdi sf_inc NULL
+ sf	sfx2\source\menu						nmake	-	all	sf_menu sf_sdi sf_inc NULL
+ sf	sfx2\source\notify						nmake	-	all	sf_noti sf_sdi sf_inc NULL
+ sf	sfx2\source\statbar						nmake	-	all	sf_sbar sf_sdi sf_inc NULL
+ sf	sfx2\source\toolbox						nmake	-	all	sf_tbox sf_sdi sf_inc NULL
+ sf	sfx2\source\inet						nmake	-	all	sf_inet sf_sdi sf_inc NULL
+ sf	sfx2\source\explorer					nmake	-	all	sf_expl sf_sdi sf_inc NULL
+-sf      sfx2\util                                                               nmake   -       all     sf_util sf_appl sf_bast sf_cnfg sf_ctrl sf_dlg sf_doc sf_expl sf_inet sf_menu sf_noti sf_sbar sf_tbox sf_view NULL
++sf      sfx2\util                                                               nmake   -       all     sf_util sf_appl sf_bast sf_cnfg sf_ctrl sf_dlg sf_doc sf_expl sf_inet sf_menu sf_layout sf_noti sf_sbar sf_tbox sf_view NULL
+diff --git a/sfx2/prj/d.lst b/sfx2/prj/d.lst
+index 03d2c01..692b8e3 100644
+--- sfx2/prj/d.lst
++++ sfx2/prj/d.lst
+@@ -126,3 +126,5 @@ mkdir: %_DEST%\inc%_EXT%\sfx2
+ ..\inc\QuerySaveDocument.hxx %_DEST%\inc%_EXT%\sfx2\QuerySaveDocument.hxx
+ ..\inc\mailmodelapi.hxx %_DEST%\inc%_EXT%\sfx2\mailmodelapi.hxx
+ ..\inc\docinsert.hxx %_DEST%\inc%_EXT%\sfx2\docinsert.hxx
++..\inc\sfx2\layout.hxx %_DEST%\inc%_EXT%\sfx2\layout.hxx
++..\inc\sfx2\layout-tabdlg.hxx %_DEST%\inc%_EXT%\sfx2\layout-tabdlg.hxx
+diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
+index d3254ed..fb35c4f 100644
+--- sfx2/source/dialog/tabdlg.cxx
++++ sfx2/source/dialog/tabdlg.cxx
+@@ -31,19 +31,14 @@
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+ #include "precompiled_sfx2.hxx"
+ 
+-// include ---------------------------------------------------------------
+-
+ #include <limits.h>
+ #include <stdlib.h>
+ #include <vcl/msgbox.hxx>
+ #include <svtools/viewoptions.hxx>
+-#ifndef GCC
+-#endif
+ 
+ #define _SVSTDARR_USHORTS
+ #include <svtools/svstdarr.hxx>
+ 
+-// wg. nAutoPageID
+ #include "appdata.hxx"
+ #include "sfxtypes.hxx"
+ #include <sfx2/minarray.hxx>
+@@ -56,20 +51,35 @@
+ #include <sfx2/bindings.hxx>
+ #include <sfx2/sfxdlg.hxx>
+ #include <sfx2/itemconnect.hxx>
+-#include <layout/layout.hxx>
+ 
+ #include "dialog.hrc"
+ #include "helpid.hrc"
+ 
+-// for OUString and Any
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++#undef TabPage
++#undef SfxTabPage
++#define SfxTabPage ::SfxTabPage
++#undef SfxTabDialog
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
++
+ using namespace ::com::sun::star::uno;
+ using namespace ::rtl;
+ 
+ #define USERITEM_NAME			OUString::createFromAscii( "UserItem" )
+ 
+-/*	-----------------------------------------------------------------
+-	Verwaltungsdatenstruktur f"ur jede Seite
+-	----------------------------------------------------------------- */
++TYPEINIT1(LAYOUT_NS_SFX_TABDIALOG SfxTabDialogItem,SfxSetItem);
++
++struct TabPageImpl
++{
++    BOOL                        mbStandard;
++    sfx::ItemConnectionArray    maItemConn;
++    ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
++
++    TabPageImpl() : mbStandard( FALSE ) {}
++};
++
++NAMESPACE_LAYOUT_SFX_TABDIALOG
++
+ struct Data_Impl
+ {
+ 	USHORT nId;					 // Die ID
+@@ -102,8 +112,6 @@ struct Data_Impl
+ 	}
+ };
+ 
+-TYPEINIT1(SfxTabDialogItem,SfxSetItem);
+-
+ SfxTabDialogItem::SfxTabDialogItem( const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool )
+     : SfxSetItem( rAttr, pItemPool )
+ {
+@@ -172,13 +180,7 @@ void SfxTabDialogController::StateChanged( USHORT /*nSID*/, SfxItemState /*eStat
+         for ( USHORT n=0; n<pDialog->aTabCtrl.GetPageCount(); n++ )
+         {
+             USHORT nPageId = pDialog->aTabCtrl.GetPageId( n );
+-            if ( layout::TabPage* page = pDialog->layoutPages[nPageId] )
+-            {
+-                page->Reset( pSetItem->GetItemSet() );
+-                bDialogStarted = TRUE;
+-            }
+-
+-            SfxTabPage* pTabPage = (SfxTabPage*) pDialog->aTabCtrl.GetTabPage( nPageId );
++            SfxTabPage* pTabPage = dynamic_cast<SfxTabPage*> (pDialog->aTabCtrl.GetTabPage( nPageId ));
+             if ( pTabPage )
+             {
+                 pTabPage->Reset( pSetItem->GetItemSet() );
+@@ -218,32 +220,6 @@ struct TabDlg_Impl
+ 	{}
+ };
+ 
+-struct TabPageImpl
+-{
+-    BOOL                        mbStandard;
+-    sfx::ItemConnectionArray    maItemConn;
+-    ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+-
+-    TabPageImpl() : mbStandard( FALSE ) {}
+-};
+-
+-void SfxTabPage::SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame)
+-{
+-    if (pImpl)
+-        pImpl->mxFrame = xFrame;
+-}
+-
+-::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxTabPage::GetFrame()
+-{
+-    if (pImpl)
+-        return pImpl->mxFrame;
+-    return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >();
+-}
+-
+-
+-/*	-----------------------------------------------------------------
+-	Hilfsfunktion: Finden einer Page anhand seiner Id
+-	----------------------------------------------------------------- */
+ Data_Impl* Find( SfxTabDlgData_Impl& rArr, USHORT nId, USHORT* pPos = 0 );
+ 
+ Data_Impl* Find( SfxTabDlgData_Impl& rArr, USHORT nId, USHORT* pPos )
+@@ -264,8 +240,21 @@ Data_Impl* Find( SfxTabDlgData_Impl& rArr, USHORT nId, USHORT* pPos )
+ 	return 0;
+ }
+ 
+-// class SfxTabPage-------------------------------------------------------
++#if !ENABLE_LAYOUT_SFX_TABDIALOG
++
++void SfxTabPage::SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame)
++{
++    if (pImpl)
++        pImpl->mxFrame = xFrame;
++}
+ 
++::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxTabPage::GetFrame()
++{
++    if (pImpl)
++        return pImpl->mxFrame;
++    return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >();
++}
++          
+ SfxTabPage::SfxTabPage( Window *pParent,
+ 						const ResId &rResId, const SfxItemSet &rAttrSet ) :
+ 
+@@ -474,7 +463,22 @@ void SfxTabPage::AddItemConnection( sfx::ItemConnectionBase* pConnection )
+     pImpl->maItemConn.AddConnection( pConnection );
+ }
+ 
+-// class SfxTabDialog ----------------------------------------------------
++#endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */
++
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++#undef ResId
++#define ResId(id, foo) #id
++#undef TabDialog
++#define TabDialog(parent, res_id) Dialog (parent, "tab-dialog.xml", "tab-dialog")
++
++#define aOKBtn(this) aOKBtn (this, "BTN_OK")
++#undef PushButton
++#define PushButton(this) layout::PushButton (this, "BTN_USER")
++#define aCancelBtn(this) aCancelBtn (this, "BTN_CANCEL")
++#define aHelpBtn(this) aHelpBtn (this, "BTN_HELP")
++#define aResetBtn(this) aResetBtn (this, "BTN_RESET")
++#define aBaseFmtBtn(this) aBaseFmtBtn (this, "BTN_BASEFMT")
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
+ 
+ #define INI_LIST(ItemSetPtr) \
+ 	aTabCtrl	( this, ResId(ID_TABCONTROL,*rResId.GetResMgr() ) ),\
+@@ -585,11 +589,24 @@ SfxTabDialog::SfxTabDialog
+ 
+ // -----------------------------------------------------------------------
+ 
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++#undef ResId
++#undef TabDialog
++#undef aOKBtn
++#undef PushButton
++#undef aCancelBtn
++#undef aHelpBtn
++#undef aResetBtn
++#undef aBaseFmtBtn
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
++
+ SfxTabDialog::~SfxTabDialog()
+ {
+ 	// save settings (screen position and current page)
+ 	SvtViewOptions aDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) );
++#if !ENABLE_LAYOUT_SFX_TABDIALOG
+ 	aDlgOpt.SetWindowState( OUString::createFromAscii( GetWindowState( WINDOWSTATE_MASK_POS ).GetBuffer() ) );
++#endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */
+ 	aDlgOpt.SetPageID( aTabCtrl.GetCurPageId() );
+ 
+ 	const USHORT nCount = pImpl->pData->Count();
+@@ -624,10 +641,6 @@ SfxTabDialog::~SfxTabDialog()
+ 	delete pOutSet;
+ 	delete pExampleSet;
+ 	delete [] pRanges;
+-
+-    for ( size_t i = 0; i < layoutPages.size(); i++ )
+-        if (layout::TabPage *page = layoutPages[i])
+-            delete page;
+ }
+ 
+ // -----------------------------------------------------------------------
+@@ -697,6 +710,11 @@ void SfxTabDialog::RemoveResetButton()
+ 
+ // -----------------------------------------------------------------------
+ 
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++#undef TabDialog
++#define TabDialog Dialog
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
++
+ short SfxTabDialog::Execute()
+ {
+ 	if ( !aTabCtrl.GetPageCount() )
+@@ -709,10 +727,12 @@ short SfxTabDialog::Execute()
+ 
+ void SfxTabDialog::StartExecuteModal( const Link& rEndDialogHdl )
+ {
++#if !ENABLE_LAYOUT_SFX_TABDIALOG
+     if ( !aTabCtrl.GetPageCount() )
+         return;
+     Start_Impl();
+     TabDialog::StartExecuteModal( rEndDialogHdl );
++#endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */
+ }
+ 
+ // -----------------------------------------------------------------------
+@@ -759,9 +779,10 @@ void SfxTabDialog::EnableApplyButton(BOOL bEnable)
+ 	if ( bEnable )
+ 	{
+ 		pImpl->pApplyButton = new PushButton( this );
++#if !ENABLE_LAYOUT_SFX_TABDIALOG
+ 		// in the z-order, the apply button should be behind the ok button, thus appearing at the right side of it
+ 		pImpl->pApplyButton->SetZOrder(&aOKBtn, WINDOW_ZORDER_BEHIND);
+-
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
+ 		pImpl->pApplyButton->SetText( String( SfxResId( STR_APPLY ) ) );
+ 		pImpl->pApplyButton->Show();
+ 
+@@ -773,9 +794,11 @@ void SfxTabDialog::EnableApplyButton(BOOL bEnable)
+ 		pImpl->pApplyButton = NULL;
+ 	}
+ 
++#if !ENABLE_LAYOUT_SFX_TABDIALOG
+ 	// adjust the layout
+ 	if (IsReallyShown())
+ 		AdjustLayout();
++#endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */
+ }
+ 
+ // -----------------------------------------------------------------------
+@@ -810,7 +833,9 @@ void SfxTabDialog::Start_Impl()
+ 	SvtViewOptions aDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) );
+ 	if ( aDlgOpt.Exists() )
+ 	{
++#if !ENABLE_LAYOUT_SFX_TABDIALOG
+ 		SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
++#endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */
+ 
+ 		// initiale TabPage aus Programm/Hilfe/Konfig
+ 		nActPage = (USHORT)aDlgOpt.GetPageID();
+@@ -933,16 +958,6 @@ void SfxTabDialog::AddTabPage
+ }
+ #endif
+ 
+-void SfxTabDialog::AddTabPage( int id, layout::TabPage* page, bool )
+-{
+-    layoutPages[id] = page;
+-}
+-
+-void SfxTabDialog::AddTabPage( int id, layout::CreateTabPage func, bool )
+-{
+-    layoutPageFuncs[id] = func;
+-}
+-
+ // -----------------------------------------------------------------------
+ 
+ void SfxTabDialog::RemoveTabPage( USHORT nId )
+@@ -1188,28 +1203,7 @@ IMPL_LINK( SfxTabDialog, OkHdl, Button *, EMPTYARG )
+ bool SfxTabDialog::PrepareLeaveCurrentPage()
+ {
+ 	USHORT const nId = aTabCtrl.GetCurPageId();
+-
+-    if ( layout::TabPage* page = layoutPages[nId] )
+-    {
+-		if ( !pSet )
+-			return page->DeactivatePage( 0 );
+-
+-        SfxItemSet set( *pSet->GetPool(), pSet->GetRanges() );
+-
+-        if ( page->HasExchangeSupport() )
+-            return page->DeactivatePage( &set );
+-
+-		int result = page->DeactivatePage( 0 );
+-        if ( result & layout::TabPage::LEAVE_PAGE && set.Count() )
+-        {
+-            pExampleSet->Put( set );
+-            pOutSet->Put( set );
+-		}
+-		return result;
+-    }
+-
+-	SfxTabPage* pPage = (SfxTabPage*)aTabCtrl.GetTabPage( nId );
+-
++	SfxTabPage* pPage = dynamic_cast<SfxTabPage*> (aTabCtrl.GetTabPage( nId ));
+ 	bool bEnd = !pPage;
+ 
+ 	if ( pPage )
+@@ -1281,12 +1275,6 @@ IMPL_LINK( SfxTabDialog, ResetHdl, Button *, EMPTYARG )
+ 
+ {
+     int const nId = aTabCtrl.GetCurPageId();
+-    if ( layout::TabPage* page = layoutPages[nId] )
+-    {
+-        page->Reset( *pSet );
+-        return 0;
+-    }
+-
+ 	Data_Impl* pDataObject = Find( *pImpl->pData, nId );
+ 	DBG_ASSERT( pDataObject, "Id nicht bekannt" );
+ 
+@@ -1381,6 +1369,11 @@ IMPL_LINK( SfxTabDialog, BaseFmtHdl, Button *, EMPTYARG )
+ 
+ // -----------------------------------------------------------------------
+ 
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++#define tabControlWindow pTabCtrl->GetWindow ()
++#else /* !ENABLE_LAYOUT_SFX_TABDIALOG */
++#define tabControlWindow pTabCtrl
++#endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */
+ 
+ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl )
+ 
+@@ -1397,42 +1390,22 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl )
+ 
+ {
+ 	int const nId = pTabCtrl->GetCurPageId();
+-    OSL_TRACE ("%s: page: %d", __FUNCTION__, nId );
+-    if ( !layoutPages[nId] )
+-        if ( layout::CreateTabPage func = layoutPageFuncs[nId] )
+-        {
+-            layout::TabPage::global_parent = pTabCtrl;
+-            layout::TabPage* page = (func) (pTabCtrl, *pSet);
+-            AddTabPage( nId, page );
+-        }
+-    if ( layout::TabPage* page = layoutPages[nId] )
+-    {
+-        TabPage *vclPage = page->GetTabPage();
+-        TabControl *dialog = pTabCtrl;
+-        page->Reset( page->GetItemSet() );
+-        page->ActivatePage();
+-        dialog->SetTabPage( nId, vclPage );
+-
+-        Size tabSize = vclPage->GetSizePixel();
+-        Size dialogSize = dialog->GetTabPageSizePixel();
+-        OSL_TRACE ("%s: tabSize: %d, %d", __FUNCTION__, tabSize.Width(), tabSize.Height() );
+-        OSL_TRACE ("%s: dialogSize: %d, %d", __FUNCTION__, dialogSize.Width(), dialogSize.Height() );
+-
+-        dialog->SetTabPageSizePixel( dialogSize );
+-        return 0;
+-    }
+     
+ 	DBG_ASSERT( pImpl->pData->Count(), "keine Pages angemeldet" );
+ 	SFX_APP();
+ 
+ 	// Tab Page schon da?
+-	SfxTabPage* pTabPage = (SfxTabPage *)pTabCtrl->GetTabPage( nId );
++	SfxTabPage* pTabPage = dynamic_cast<SfxTabPage*> (pTabCtrl->GetTabPage( nId ));
+ 	Data_Impl* pDataObject = Find( *pImpl->pData, nId );
+ 	DBG_ASSERT( pDataObject, "Id nicht bekannt" );
+ 
+ 	// ggf. TabPage erzeugen:
+ 	if ( !pTabPage )
+ 	{
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++        if (layout SfxTabPage* inplug = dynamic_cast<layout SfxTabPage*> (pTabPage))
++            layout::TabPage::global_parent = pTabCtrl->GetWindow ();
++#endif
+ 		const SfxItemSet* pTmpSet = 0;
+ 
+ 		if ( pSet )
+@@ -1444,13 +1417,16 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl )
+ 		}
+ 
+ 		if ( pTmpSet && !pDataObject->bOnDemand )
+-			pTabPage = (pDataObject->fnCreatePage)( pTabCtrl, *pTmpSet );
++			pTabPage = (pDataObject->fnCreatePage)( tabControlWindow, *pTmpSet );
+ 		else
+ 			pTabPage = (pDataObject->fnCreatePage)
+-							( pTabCtrl, *CreateInputItemSet( nId ) );
++							( tabControlWindow, *CreateInputItemSet( nId ) );
+ 		DBG_ASSERT( NULL == pDataObject->pTabPage, "create TabPage more than once" );
+ 		pDataObject->pTabPage = pTabPage;
++
++#if !ENABLE_LAYOUT_SFX_TABDIALOG
+ 		pDataObject->pTabPage->SetTabDialog( this );
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
+ 		SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( pDataObject->nId ) );
+ 		String sUserData;
+ 		Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME );
+@@ -1459,23 +1435,48 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl )
+ 			sUserData = String( aTemp );
+ 		pTabPage->SetUserData( sUserData );
+ 		Size aSiz = pTabPage->GetSizePixel();
++
++#if ENABLE_LAYOUT
++		Size optimalSize = pTabPage->GetOptimalSize (WINDOWSIZE_MINIMUM);
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++        if (layout SfxTabPage* inplug = dynamic_cast<layout SfxTabPage*> (pTabPage))
++        {
++            if (optimalSize.Height () && optimalSize.Width ())
++            {
++                optimalSize.Width () = optimalSize.Width ();
++                optimalSize.Height () = optimalSize.Height () + 40;
++            }
++        }
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
++        if (optimalSize.Height () > 0 && optimalSize.Width () > 0 )
++            aSiz = optimalSize;
++#endif /* ENABLE_LAYOUT */
++
+ 		Size aCtrlSiz = pTabCtrl->GetTabPageSizePixel();
+ 		// Gr"o/se am TabControl nur dann setzen, wenn < als TabPage
+ 		if ( aCtrlSiz.Width() < aSiz.Width() ||
+ 			 aCtrlSiz.Height() < aSiz.Height() )
++        {
+ 			pTabCtrl->SetTabPageSizePixel( aSiz );
++        }
++
+ 		PageCreated( nId, *pTabPage );
+ 
+ 		if ( pDataObject->bOnDemand )
+ 			pTabPage->Reset( (SfxItemSet &)pTabPage->GetItemSet() );
+ 		else
+ 			pTabPage->Reset( *pSet );
++
+ 		pTabCtrl->SetTabPage( nId, pTabPage );
+ 	}
+ 	else if ( pDataObject->bRefresh )
+ 		pTabPage->Reset( *pSet );
+ 	pDataObject->bRefresh = FALSE;
+ 
++#if ENABLE_LAYOUT_SFX_TABDIALOG
++    pTabCtrl->GetPagePos (nId);
++#endif /* ENABLE_LAYOUT_SFX_TABDIALOG */
++
+ 	if ( pExampleSet )
+ 		pTabPage->ActivatePage( *pExampleSet );
+ 	BOOL bReadOnly = pTabPage->IsReadOnly();
+@@ -1497,12 +1498,9 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl )
+ */
+ 
+ {
+-    if ( /* layout::TabPage* p = */ layoutPages[pTabCtrl->GetCurPageId()] )
+-        return SfxTabPage::LEAVE_PAGE;
+-
+ 	USHORT nId = pTabCtrl->GetCurPageId();
+ 	SFX_APP();
+-	SfxTabPage *pPage = (SfxTabPage*)pTabCtrl->GetTabPage( nId );
++	SfxTabPage *pPage = dynamic_cast<SfxTabPage*> (pTabCtrl->GetTabPage( nId ));
+ 	DBG_ASSERT( pPage, "keine aktive Page" );
+ #ifdef DBG_UTIL
+ 	Data_Impl* pDataObject = Find( *pImpl->pData, pTabCtrl->GetCurPageId() );
+@@ -1796,3 +1794,4 @@ long SfxTabDialog::Notify( NotifyEvent& rNEvt )
+     return TabDialog::Notify( rNEvt );
+ }
+ 
++END_NAMESPACE_LAYOUT_SFX_TABDIALOG
+diff --git a/sfx2/source/layout/makefile.mk b/sfx2/source/layout/makefile.mk
+new file mode 100644
+index 0000000..2ef1231
+--- /dev/null
++++ sfx2/source/layout/makefile.mk
+@@ -0,0 +1,55 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.7 $
++#
++# 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.
++#
++#*************************************************************************
++
++PRJ=..$/..
++
++PRJNAME=sfx2
++TARGET=layout
++ENABLE_EXCEPTIONS=true
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++.INCLUDE :  $(PRJ)$/util$/makefile.pmk
++
++CFLAGS += -I../$(PRJ)/toolkit/source/vclcompat
++
++# --- Files --------------------------------------------------------
++
++SLOFILES = \
++	$(SLO)$/sfxtabpage.obj \
++	$(SLO)$/sfxtabdialog.obj \
++#
++
++# --- Tagets -------------------------------------------------------
++
++.INCLUDE :  target.mk
++
+diff --git a/sfx2/source/layout/sfxtabdialog.cxx b/sfx2/source/layout/sfxtabdialog.cxx
+new file mode 100644
+index 0000000..bf7c521
+--- /dev/null
++++ sfx2/source/layout/sfxtabdialog.cxx
+@@ -0,0 +1,75 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: tabdlg.cxx,v $
++ * $Revision: 1.38 $
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_sfx2.hxx"
++
++#include <limits.h>
++#include <stdlib.h>
++#include <vcl/msgbox.hxx>
++#include <svtools/viewoptions.hxx>
++
++#define _SVSTDARR_USHORTS
++#include <svtools/svstdarr.hxx>
++
++#include "appdata.hxx"
++#include "sfxtypes.hxx"
++#include <sfx2/minarray.hxx>
++#include <sfx2/tabdlg.hxx>
++#include <sfx2/viewfrm.hxx>
++#include <sfx2/app.hxx>
++#include "sfxresid.hxx"
++#include "sfxhelp.hxx"
++#include <sfx2/ctrlitem.hxx>
++#include <sfx2/bindings.hxx>
++#include <sfx2/sfxdlg.hxx>
++#include <sfx2/itemconnect.hxx>
++#include <layout/layout.hxx>
++
++//FIXME
++#include <toolkit/awt/vclxwindow.hxx>
++#include <com/sun/star/awt/PosSize.hpp>
++
++using namespace ::com::sun::star;
++namespace layout
++{
++using namespace ::com::sun::star;
++}
++
++#include <sfx2/layout.hxx>
++#include <layout/layout-pre.hxx>
++
++#undef TabPage
++#undef SfxTabPage
++#undef SfxTabDialog
++
++#define TabDlgCmpUS_Impl layout__TabDlgCmpUS_Impl
++
++#include "../dialog/tabdlg.cxx"
+diff --git a/sfx2/source/layout/sfxtabpage.cxx b/sfx2/source/layout/sfxtabpage.cxx
+new file mode 100644
+index 0000000..6b7806d
+--- /dev/null
++++ sfx2/source/layout/sfxtabpage.cxx
+@@ -0,0 +1,81 @@
++/*************************************************************************
++* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++* 
++* Copyright 2008 by Sun Microsystems, Inc.
++*
++* OpenOffice.org - a multi-platform office productivity suite
++*
++* $RCSfile: code,v $
++*
++* $Revision: 1.3 $
++*
++* 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 <sfx2/layout.hxx>
++
++#include <com/sun/star/awt/PosSize.hpp>
++#include <toolkit/awt/vclxwindow.hxx>
++
++namespace layout
++{
++
++using namespace ::com::sun::star;
++
++#if 0
++SfxTabDialog::SfxTabDialog (::Window *parent, char const* xml_file, char const* id, ResId const& res_id, SfxItemSet const* set)
++    : ::SfxTabDialog (parent, res_id, set)
++    , InPlug (parent, xml_file, id)
++{
++}
++
++::Window* SfxTabDialog::GetParent () const
++{
++    return Window::GetParent ();
++}
++
++void SfxTabDialog::FreeResource ()
++{
++    //::Window::FreeResource ();
++}
++#endif
++
++SfxTabPage::SfxTabPage (::Window *parent, char const* xml_file, char const* id, SfxItemSet const* set)
++    : ::SfxTabPage (parent, 0, *set)
++    , InPlug (parent, xml_file, id)
++{
++    dynamic_cast< ::Window* > (this)->SetComponentInterface (GetVCLXWindow ());
++}
++
++::Window* SfxTabPage::GetParent () const
++{
++    return Window::GetParent ();
++}
++
++void SfxTabPage::FreeResource ()
++{
++    //::Window::FreeResource ();
++}
++
++Size SfxTabPage::GetOptimalSize (WindowSizeType) const
++{
++    awt::Size s = GetVCLXWindow()->getMinimumSize ();
++    return Size (s.Width, s.Height);
++}
++
++} // end namespace layout
+diff --git a/sfx2/util/makefile.mk b/sfx2/util/makefile.mk
+index 3e08460..ec85e9e 100644
+--- sfx2/util/makefile.mk
++++ sfx2/util/makefile.mk
+@@ -53,6 +53,7 @@ LIB1FILES=  $(SLB)$/appl.lib		\
+             $(SLB)$/view.lib		\
+             $(SLB)$/control.lib		\
+             $(SLB)$/notify.lib		\
++            $(SLB)$/layout.lib		\
+             $(SLB)$/menu.lib		\
+             $(SLB)$/inet.lib		\
+             $(SLB)$/toolbox.lib		\

Modified: trunk/patches/dev300/layout-simple-dialogs-solenv.diff
==============================================================================
--- trunk/patches/dev300/layout-simple-dialogs-solenv.diff	(original)
+++ trunk/patches/dev300/layout-simple-dialogs-solenv.diff	Wed Sep 10 14:58:03 2008
@@ -1,5 +1,5 @@
 diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm
-index c199345..64d82e5 100644
+index a06edb6..521c35e 100644
 --- solenv/bin/modules/installer/worker.pm
 +++ solenv/bin/modules/installer/worker.pm
 @@ -797,7 +797,7 @@ sub install_simple ($$$$$$)
@@ -13,7 +13,7 @@
  		chmod (oct($unixrights), "$destdir$destination") || die "Can't change permissions: $!";
 diff --git a/solenv/inc/layout.mk b/solenv/inc/layout.mk
 new file mode 100644
-index 0000000..1da2eec
+index 0000000..28e6cc0
 --- /dev/null
 +++ solenv/inc/layout.mk
 @@ -0,0 +1,30 @@
@@ -21,7 +21,7 @@
 +XML_DEST=$(DLLDEST)
 +XML_LANGS=$(alllangiso)
 +
-+ALL_XMLS=$(foreach,i,$(XML_FILES) $(XML_DEST)/$i) $(foreach,i,$(XML_LANGS) $(foreach,j,$(XML_FILES) $(XML_DEST)/$i/$j))
++ALL_XMLS=$(foreach,i,$(XML_FILES) "$(XML_DEST)/$i") $(foreach,i,$(XML_LANGS) $(foreach,j,$(XML_FILES) "$(XML_DEST)/$i/$j"))
 +
 +# Must remove the -j (no duplicate base file names) flag
 +ZIPUPDATE=-u
@@ -38,20 +38,69 @@
 +$(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml
 +	-$(MKDIR) $(@:d)
 +	@echo $(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml
-+	$(TRALAY) -m localize.sdf -o $(XML_DEST) -l $(XML_LANGS:f:t" -l ") $<
++	$(TRALAY) -m localize.sdf -o "$(XML_DEST)" -l $(XML_LANGS:f:t" -l ") "$<"
 +
 +$(XML_DEST)/%.xml: %.xml
 +	-$(MKDIR) $(@:d)
-+	$(COPY) $< $@
++	$(COPY) "$<" "$@"
 +
 +# Don't want to overwrite filled localize.sdf with empty template
 +template.sdf:
-+	$(foreach,i,$(XML_FILES) $(TRALAY) -l en-US $i) > $@
++	$(foreach,i,$(XML_FILES) $(TRALAY) -l en-US "$i") > $@
+diff --git a/solenv/inc/rules.mk b/solenv/inc/rules.mk
+index 626ef87..693faa2 100644
+--- solenv/inc/rules.mk
++++ solenv/inc/rules.mk
+@@ -33,7 +33,7 @@ MKFILENAME:=RULES.MK
+ 
+ $(OBJ)$/%.obj : %.cxx
+ 	@echo ------------------------------
+-	@echo Making: $@
++	@echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$<
+ .IF "$(GUI)"=="UNX"
+ 	@$(RM) $@ $(@:s/.obj/.o/)
+ 	$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXOBJ) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $(CFLAGSINCXX)$(PWD)$/$*.cxx
+@@ -58,7 +58,7 @@ $(OBJ)$/%.obj : %.cxx
+ 
+ $(OBJ)$/%.obj : %.cpp
+ 	@echo ------------------------------
+-	@echo Making: $@
++	@echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$<
+ .IF "$(GUI)"=="UNX"
+ 	@$(RM) $@ $(@:s/.obj/.o/)
+ 	$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXOBJ) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $(CFLAGSINCXX)$(PWD)$/$*.cpp
+@@ -81,7 +81,7 @@ $(OBJ)$/%.obj : %.cpp
+ 
+ $(OBJ)$/%.obj : %.cc
+ 	@echo ------------------------------
+-	@echo Making: $@
++	@echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$<
+ .IF "$(GUI)"=="UNX"
+ 	@$(RM) $@ $(@:s/.obj/.o/)
+ 	$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXOBJ) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $(CFLAGSINCXX)$(PWD)$/$*.cc
+@@ -165,7 +165,7 @@ $(SLO)$/%.obj : %.cxx
+ .IF "$(QUIET_BUILD)"==""
+ 	@echo ------------------------------
+ .ENDIF
+-	@echo Making: $@
++	@echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$<
+ .IF "$(ENABLE_PCH)"!="" && ( "$(PRJNAME)"!="sw" || "$(BUILD_SPECIAL)"!="TRUE" )
+ # just a helper var	
+ 	@noop $(assign used_exc_switches=$(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)))
+@@ -205,7 +205,7 @@ $(SLO)$/%.obj : %.cxx
+ 
+ $(SLO)$/%.obj : %.cpp
+ 	@echo ------------------------------
+-	@echo Making: $@
++	@echo Making $@
+ .IF "$(GUI)"=="UNX"
+ .IF "$(TEST)"!=""
+ 	$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXSLO) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) -E  $(CFLAGSINCXX)$(PWD)$/$*.cpp
 diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk
-index 9cf78b0..5d2a632 100644
+index 72eb170..60e9bca 100644
 --- solenv/inc/settings.mk
 +++ solenv/inc/settings.mk
-@@ -1092,6 +1092,12 @@ LOCAL_EXCEPTIONS_FLAGS+=-DEXCEPTIONS_ON
+@@ -1141,6 +1141,12 @@ LOCAL_EXCEPTIONS_FLAGS+=-DEXCEPTIONS_ON
  CDEFS+=-DGSTREAMER
  .ENDIF
  

Added: trunk/patches/dev300/layout-simple-dialogs-starmath.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/layout-simple-dialogs-starmath.diff	Wed Sep 10 14:58:03 2008
@@ -0,0 +1,13 @@
+diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx
+index 6f9968d..dae3ae5 100644
+--- starmath/source/accessibility.hxx
++++ starmath/source/accessibility.hxx
+@@ -68,8 +68,6 @@ namespace com { namespace sun { namespace star { namespace accessibility {
+ struct AccessibleEventObject;
+ }}}}
+ 
+-#define css     com::sun::star
+-
+ //////////////////////////////////////////////////////////////////////
+ //
+ // classes and helper-classes used for accessibility in the graphic-window

Modified: trunk/patches/dev300/layout-simple-dialogs-svx.diff
==============================================================================
--- trunk/patches/dev300/layout-simple-dialogs-svx.diff	(original)
+++ trunk/patches/dev300/layout-simple-dialogs-svx.diff	Wed Sep 10 14:58:03 2008
@@ -1,18 +1,327 @@
+diff --git a/svx/inc/srchdlg.hxx b/svx/inc/srchdlg.hxx
+index a62b23d..f39441e 100644
+--- svx/inc/srchdlg.hxx
++++ svx/inc/srchdlg.hxx
+@@ -116,12 +116,19 @@ public:
+ 
+ // class SvxSearchDialogWrapper ------------------------------------------
+ 
++#include <layout/layout.hxx>
++#include <layout/layout-pre.hxx>
++
++class SvxSearchDialog;
+ class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow
+ {
++    SvxSearchDialog *dialog;
+ public:
+ 	SvxSearchDialogWrapper( Window*pParent, USHORT nId,
+ 							SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+ 
++    ~SvxSearchDialogWrapper ();
++    SvxSearchDialog *getDialog ();
+ 	SFX_DECL_CHILDWINDOW(SvxSearchDialogWrapper);
+ };
+ 
+@@ -285,6 +292,8 @@ private:
+ #endif
+ };
+ 
++#include <layout/layout-post.hxx>
++
+ inline BOOL SvxSearchDialog::HasSearchAttributes() const
+ {
+ 	int bLen = aSearchAttrText.GetText().Len();
 diff --git a/svx/source/dialog/makefile.mk b/svx/source/dialog/makefile.mk
-index 06aaa90..247f726 100644
+index a7f7051..75926eb 100644
 --- svx/source/dialog/makefile.mk
 +++ svx/source/dialog/makefile.mk
-@@ -39,10 +39,6 @@ ENABLE_EXCEPTIONS=TRUE
- 
+@@ -39,6 +39,3 @@ ENABLE_EXCEPTIONS=TRUE
++
  .INCLUDE :  settings.mk
  .INCLUDE :  $(PRJ)$/util$/makefile.pmk
--
+- 
 -.IF "$(ENABLE_LAYOUT)" == "TRUE"
 -CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
 -.ENDIF # ENABLE_LAYOUT == TRUE
- 
+
  .IF "$(ENABLE_GTK)" != ""
  CFLAGS+=-DENABLE_GTK
+ .ENDIF
+diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
+index 4e9d1ca..40b41eb 100644
+--- svx/source/dialog/srchdlg.cxx
++++ svx/source/dialog/srchdlg.cxx
+@@ -78,6 +78,8 @@
+ 
+ #include <svx/svxdlg.hxx> //CHINA001
+ 
++#include <layout/layout-pre.hxx>
++
+ using namespace com::sun::star::i18n;
+ using namespace com::sun::star;
+ using namespace comphelper;
+@@ -109,6 +111,11 @@ SV_IMPL_VARARR(SrchAttrItemList, SearchAttrItem);
+ #define GetCheckBoxValue( rBox )								\
+ 	rBox.IsEnabled() ? rBox.IsChecked() : FALSE
+ 
++#if ENABLE_LAYOUT
++#undef SVX_RES
++#define SVX_RES(x) #x
++#endif /* ENABLE_LAYOUT */
++
+ struct SearchDlg_Impl
+ {
+ 	FixedText	aSearchFormats;
+@@ -126,7 +133,11 @@ struct SearchDlg_Impl
+     util::URL   aCommand1URL;
+     util::URL   aCommand2URL;
+ 
+-    SearchDlg_Impl( Window* pParent ) :
++#if ENABLE_LAYOUT
++    SearchDlg_Impl( layout::Context* pParent ) :
++#else /* !ENABLE_LAYOUT */
++        SearchDlg_Impl( Window* pParent ) :
++#endif /* !ENABLE_LAYOUT */
+         aSearchFormats  ( pParent, SVX_RES( FT_SEARCH_FORMATS ) ),
+         aReplaceFormats ( pParent, SVX_RES( FT_REPLACE_FORMATS ) ),
+         bMultiLineEdit  ( FALSE ),
+@@ -316,9 +327,16 @@ void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings )
+ 	pPage->SetTransliterationFlags( nSettings );
+ }
+ */ //CHINA001
+-#ifdef INI_LIST
++
++#if ENABLE_LAYOUT
++#undef SfxModelessDialog
++#define SfxModelessDialog(sfx_bindings, child, parent, id) Dialog( parent, "find-&-replace.xml", id )
++#define SVX_RES_PLAIN(x) ResId (x, DIALOG_MGR ())
++#else /* !ENABLE_LAYOUT */
++#define SVX_RES_PLAIN SVX_RES
++#endif /* !ENABLE_LAYOUT */
++
+ #undef INI_LIST
+-#endif
+ #define INI_LIST() \
+ 	aSearchText 	( this, SVX_RES( FT_SEARCH ) ),							\
+ 	aSearchLB		( this, SVX_RES( ED_SEARCH ) ),							\
+@@ -371,7 +389,7 @@ void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings )
+ 	bReadOnly		( FALSE ),												\
+ 	bConstruct		( TRUE ),												\
+ 	nModifyFlag		( 0 ),													\
+-    aCalcStr        ( SVX_RES( STR_WORDCALC ) ),                              \
++    aCalcStr        ( SVX_RES_PLAIN( STR_WORDCALC ) ),                      \
+     pImpl           ( NULL ),                                               \
+ 	pSearchList 	( NULL ),												\
+ 	pReplaceList	( NULL ),												\
+@@ -408,6 +426,10 @@ SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, Sf
+ }
+ 
+ #undef INI_LIST
++#if ENABLE_LAYOUT
++#undef SVX_RES
++#define SVX_RES(x) ResId (x, DIALOG_MGR ())
++#endif
+ 
+ // -----------------------------------------------------------------------
+ 
+@@ -431,6 +453,11 @@ SvxSearchDialog::~SvxSearchDialog()
+ }
+ 
+ // -----------------------------------------------------------------------
++#if ENABLE_LAYOUT
++#undef Window
++#define Window layout::Window
++#endif /* !ENABLE_LAYOUT */
++
+ void lcl_MoveDown( Window& rWindow, sal_Int32 nOffset )
+ {
+     Point aPos(rWindow.GetPosPixel());
+@@ -440,12 +467,17 @@ void lcl_MoveDown( Window& rWindow, sal_Int32 nOffset )
+ 
+ void SvxSearchDialog::Construct_Impl()
+ {
++#if ENABLE_LAYOUT
++    SetHelpId (SID_SEARCH_DLG);
++#endif /* ENABLE_LAYOUT */
++
+ 	// temporary to avoid incompatibility
+ 	pImpl = new SearchDlg_Impl( this );
++#if !ENABLE_LAYOUT
+ 	pImpl->aSelectionTimer.SetTimeout( 500 );
+ 	pImpl->aSelectionTimer.SetTimeoutHdl(
+ 		LINK( this, SvxSearchDialog, TimeoutHdl_Impl ) );
+-
++#endif /* !ENABLE_LAYOUT */
+ 	EnableControls_Impl( 0 );
+ 
+ 	// alten Text des aWordBtn's merken
+@@ -572,6 +604,7 @@ void SvxSearchDialog::Construct_Impl()
+             aSearchComponentFL.Show();
+             aSearchComponent2PB.Show();
+         }
++#if 1// !ENABLE_LAYOUT
+         if( aSearchComponentFL.IsVisible() && aSearchComponent1PB.IsVisible() )
+         {        
+         
+@@ -618,6 +651,7 @@ void SvxSearchDialog::Construct_Impl()
+ 
+             SetSizePixel(aDlgSize);
+         }
++#endif /* !ENABLE_LAYOUT */
+     }
+ }
+ 
+@@ -715,6 +749,7 @@ void SvxSearchDialog::InitControls_Impl()
+ 	aLink = LINK( this, SvxSearchDialog, LoseFocusHdl_Impl );
+ 	aSearchLB.SetLoseFocusHdl( aLink );
+ 	aReplaceLB.SetLoseFocusHdl( aLink );
++
+ 	aSearchTmplLB.SetLoseFocusHdl( aLink );
+ 	aReplaceTmplLB.SetLoseFocusHdl( aLink );
+ 
+@@ -886,6 +921,8 @@ void SvxSearchDialog::CalculateDelta_Impl()
+     pMoreBtn->Enable();
+ }
+ 
++#undef Window
++
+ // -----------------------------------------------------------------------
+ 
+ void SvxSearchDialog::Init_Impl( int bSearchPattern )
+@@ -893,6 +930,11 @@ void SvxSearchDialog::Init_Impl( int bSearchPattern )
+ 	DBG_ASSERT( pSearchItem, "SearchItem == 0" );
+ 	bWriter = ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_WRITER );
+ 
++#if 0 //ENABLE_LAYOUT
++    if (!pImpl)
++        pImpl = new SearchDlg_Impl( this );
++#endif /* ENABLE_LAYOUT */
++
+ 	pImpl->bMultiLineEdit = FALSE;
+ 
+ 	if ( !pImpl->bMultiLineEdit )
+@@ -1456,6 +1498,11 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+ 				Remember_Impl( aStr, FALSE );
+ 		}
+ 		SaveToModule_Impl();
++#if 0 //ENABLE_LAYOUT
++        aJapOptionsCB.Show ();
++        delete pImpl;
++        pImpl = 0;
++#endif /* ENABLE_LAYOUT */
+ 		Close();
+ 	}
+ 	else if ( pBtn == &aSimilarityBtn )
+@@ -1469,7 +1516,7 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+ 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ 		if(pFact)
+ 		{
+-			AbstractSvxSearchSimilarityDialog* pDlg = pFact->CreateSvxSearchSimilarityDialog( this,
++			AbstractSvxSearchSimilarityDialog* pDlg = pFact->CreateSvxSearchSimilarityDialog( LAYOUT_THIS_WINDOW (this),
+ 																		pSearchItem->IsLEVRelaxed(),
+ 																		pSearchItem->GetLEVOther(),
+ 																		pSearchItem->GetLEVShorter(),
+@@ -1495,7 +1542,7 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ 		if(pFact)
+ 		{
+-			AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( this, aSet, RID_SVXPAGE_JSEARCH_OPTIONS, pSearchItem->GetTransliterationFlags(), RID_SVXPAGE_JSEARCH_OPTIONS );
++			AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( LAYOUT_THIS_WINDOW (this), aSet, RID_SVXPAGE_JSEARCH_OPTIONS, pSearchItem->GetTransliterationFlags(), RID_SVXPAGE_JSEARCH_OPTIONS );
+ 			DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ 			int nRet = aDlg->Execute(); //CHINA001 int nRet = aDlg.Execute();
+ 			if (RET_OK == nRet) //! true only if FillItemSet of SvxJSearchOptionsPage returns true
+@@ -1514,7 +1561,7 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+         pArgs[0].Name = ::rtl::OUString::createFromAscii("SearchString");
+         pArgs[0].Value <<= ::rtl::OUString(aSearchLB.GetText());
+         pArgs[1].Name = ::rtl::OUString::createFromAscii("ParentWindow");
+-        pArgs[1].Value <<= VCLUnoHelper::GetInterface( this );
++        pArgs[1].Value <<= VCLUnoHelper::GetInterface( LAYOUT_THIS_WINDOW (this) );
+         if(pBtn == &aSearchComponent1PB)
+         {
+             if ( pImpl->xCommand1Dispatch.is() )
+@@ -2018,6 +2065,7 @@ IMPL_LINK( SvxSearchDialog, FocusHdl_Impl, Control *, pCtrl )
+ 	aSearchLB.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+ 
+ 	ModifyHdl_Impl( (ComboBox*)pCtrl );
++
+ 	aLayoutBtn.SetText( bFormat && nTxtLen ? aLayoutStr : aStylesStr );
+ 	return 0;
+ }
+@@ -2091,7 +2139,7 @@ IMPL_LINK( SvxSearchDialog, FormatHdl_Impl, Button *, EMPTYARG )
+ 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ 	if(pFact)
+ 	{
+-		SfxAbstractTabDialog* pDlg = pFact->CreateTabItemDialog( this, aSet, RID_SVXDLG_SEARCHFORMAT );
++		SfxAbstractTabDialog* pDlg = pFact->CreateTabItemDialog( LAYOUT_THIS_WINDOW (this), aSet, RID_SVXDLG_SEARCHFORMAT );
+ 		DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ 		aTxt.Insert( pDlg->GetText(), 0 );
+ 		pDlg->SetText( aTxt );
+@@ -2168,7 +2216,7 @@ IMPL_LINK( SvxSearchDialog, AttributeHdl_Impl, Button *, EMPTYARG )
+ 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ 	if(pFact)
+ 	{
+-		VclAbstractDialog* pDlg = pFact->CreateSvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges, RID_SVXDLG_SEARCHATTR );
++		VclAbstractDialog* pDlg = pFact->CreateSvxSearchAttributeDialog( LAYOUT_THIS_WINDOW (this), *pSearchList, pImpl->pRanges, RID_SVXDLG_SEARCHATTR );
+ 		DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ 		pDlg->Execute();
+ 		delete pDlg;
+@@ -2327,7 +2375,9 @@ void SvxSearchDialog::PaintAttrText_Impl()
+ 
+ void SvxSearchDialog::SetModifyFlag_Impl( const Control* pCtrl )
+ {
+-	if ( &aSearchLB == (ComboBox*)pCtrl )
++    if (0)
++        ;
++	else if ( &aSearchLB == (ComboBox*)pCtrl )
+ 		nModifyFlag |= MODIFY_SEARCH;
+ 	else if ( &aReplaceLB == (ComboBox*)pCtrl )
+ 		nModifyFlag |= MODIFY_REPLACE;
+@@ -2414,25 +2464,38 @@ void SvxSearchDialog::SaveToModule_Impl()
+ 
+ // class SvxSearchDialogWrapper ------------------------------------------
+ 
+-SFX_IMPL_CHILDWINDOW(SvxSearchDialogWrapper, SID_SEARCH_DLG)
++SFX_IMPL_CHILDWINDOW(SvxSearchDialogWrapper, SID_SEARCH_DLG);
+ 
+ // -----------------------------------------------------------------------
+ 
+ SvxSearchDialogWrapper::SvxSearchDialogWrapper( Window* _pParent, USHORT nId,
+ 												SfxBindings* pBindings,
+-												SfxChildWinInfo* pInfo ) :
+-    SfxChildWindow( _pParent, nId )
+-
++												SfxChildWinInfo* pInfo )
++    : SfxChildWindow( _pParent, nId )
++    , dialog (new SvxSearchDialog (_pParent, this, *pBindings))
+ {
+-    pWindow = new SvxSearchDialog( _pParent, this, *pBindings );
+-	( (SvxSearchDialog*)pWindow )->Initialize( pInfo );
++    pWindow = LAYOUT_THIS_WINDOW (dialog);
++	dialog->Initialize( pInfo );
+ 
+ 	pBindings->Update( SID_SEARCH_ITEM );
+ 	pBindings->Update( SID_SEARCH_OPTIONS );
+ 	pBindings->Update( SID_SEARCH_SEARCHSET );
+ 	pBindings->Update( SID_SEARCH_REPLACESET );
+ 	eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+-	( (SvxSearchDialog*)pWindow )->bConstruct = FALSE;
++	dialog->bConstruct = FALSE;
++}
++
++SvxSearchDialogWrapper::~SvxSearchDialogWrapper ()
++{
++#if ENABLE_LAYOUT
++    delete dialog;
++    pWindow = 0;
++#endif /* ENABLE_LAYOUT */
++}
++
++SvxSearchDialog *SvxSearchDialogWrapper::getDialog ()
++{
++    return dialog;
+ }
+ 
+ // -----------------------------------------------------------------------
 diff --git a/svx/source/dialog/zoom.cxx b/svx/source/dialog/zoom.cxx
 index ef1b8e2..50dc336 100644
 --- svx/source/dialog/zoom.cxx
@@ -41,6 +350,130 @@
  	Link aLink = LINK( this, SvxZoomDialog, UserHdl );
      a100Btn.SetClickHdl( aLink );
      aOptimalBtn.SetClickHdl( aLink );
+diff --git a/svx/source/table/localize.sdf b/svx/source/table/localize.sdf
+new file mode 100644
+index 0000000..8b13789
+--- /dev/null
++++ svx/source/table/localize.sdf
+@@ -0,0 +1 @@
++
+diff --git a/svx/uiconfig/layout/find-&-replace.xml b/svx/uiconfig/layout/find-&-replace.xml
+new file mode 100644
+index 0000000..78d8006
+--- /dev/null
++++ svx/uiconfig/layout/find-&-replace.xml
+@@ -0,0 +1,111 @@
++<?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.  !-->
++
++<modelessdialog _title="Find &amp; Replace" help-id="SID_SEARCH_DLG" show="false" sizeable="true" moveable="true" output-size="true" id="RID_SVXDLG_SEARCH" sv-look="true" _text="Find &amp; Replace" xmlns="http://openoffice.org/2007/layout"; xmlns:cnt="http://openoffice.org/2007/layout/container";>
++    <vbox spacing="5" border="5">
++	<string id="RID_SVXSTR_SEARCH_STYLES" _text="Including Styles"/>
++	<string id="RID_SVXSTR_SEARCH" _text="(Search)"/>
++	<string id="RID_SVXSTR_REPLACE" _text="(Replace)"/>
++	<string id="STR_WORDCALC" _text="~Entire cells"/>
++	<string id="STR_MORE_BTN" _text="More ~Options"/>
++	<string id="STR_LESS_BTN" _text="Less ~Options"/>
++	<hbox homogeneous="false" spacing="5" border="0">
++	    <vbox spacing="5" border="0">
++		<fixedtext id="FT_SEARCH" _label="~Search for"/>
++		<combobox dropdown="true" id="ED_SEARCH" tabstop="true" cnt:expand="false"/>
++		<listbox has_border="true" dropdown="true" show="false" id="LB_SEARCH" sort="true" tabstop="true"/>
++		<fixedtext show="false" id="FT_SEARCH_ATTR" word-break="true"/>
++		<fixedtext show="false" id="FT_SEARCH_FORMATS" word-break="true"/>
++		<flow/>
++		<flow/>
++		<flow/>
++	    </vbox>
++	    <vbox cnt:expand="false" spacing="5" border="0">
++		<min-size min-width="100" cnt:expand="false"/>
++		<pushbutton default="true" id="BTN_SEARCH" tabstop="true" _label="~Find" cnt:expand="false"/>
++		<pushbutton id="BTN_SEARCH_ALL" tabstop="true" _label="Find ~All" cnt:expand="false"/>
++	    </vbox>
++	</hbox>
++        <hbox spacing="5" border="0">
++	    <flow/>
++	    <vbox cnt:expand="false" spacing="5" border="0">
++		<min-size min-width="100" cnt:expand="false"/>
++		<fixedline id="FL_SEARCH_COMMAND"/>
++	    </vbox>
++	</hbox>
++	<hbox homogeneous="false" spacing="5" border="0">
++	    <vbox spacing="5" border="0">
++		<fixedtext id="FT_REPLACE" _label="Re~place with"/>
++		<combobox dropdown="true" id="ED_REPLACE" tabstop="true" cnt:expand="false"/>
++		<listbox has_border="true" dropdown="true" show="false" id="LB_REPLACE" sort="true" tabstop="true"/>
++		<fixedtext show="false" id="FT_REPLACE_ATTR" word-break="true"/>
++		<fixedtext show="false" id="FT_REPLACE_FORMATS" word-break="true"/>
++		<fixedline show="false" id="FL_SEARCH_COMPONENT"/>
++		<flow/>
++		<flow/>
++		<flow/>
++	    </vbox>
++	    <vbox cnt:expand="false" spacing="5" border="0">
++		<min-size min-width="100" cnt:expand="false"/>
++		<pushbutton id="BTN_REPLACE" tabstop="true" _label="~Replace" cnt:expand="false"/>
++		<pushbutton id="BTN_REPLACE_ALL" tabstop="true" _label="Replace A~ll" cnt:expand="false"/>
++	    </vbox>
++	</hbox>
++        <checkbox id="CB_MATCH_CASE" tabstop="true" _label="Ma~tch case"/>
++        <pushbutton show="false" id="BTN_COMPONENT_1" tabstop="true" cnt:expand="false"/>
++        <checkbox id="CB_WHOLE_WORDS" tabstop="true" _label="Whole wor~ds only"/>
++        <pushbutton show="false" id="BTN_COMPONENT_2" tabstop="true" cnt:expand="false"/>
++        <fixedline id="FL_BUTTONS"/>
++	<hbox>
++            <morebutton delta="174" map-unit="MAP_APPFONT" id="BTN_MORE" state="false" tabstop="true"/>
++            <dialogbuttonhbox>
++		<helpbutton id="BTN_HELP" tabstop="true" cnt:expand="false"/>
++		<cancelbutton id="BTN_CLOSE" tabstop="true" _text="~Close" cnt:expand="false"/>
++            </dialogbuttonhbox>
++	</hbox>
++        <fixedline show="false" id="FL_OPTIONS"/>
++	<hbox homogeneous="false" spacing="5" border="0">
++	    <vbox spacing="5" border="0">
++		<checkbox show="false" id="CB_SELECTIONS" tabstop="true" _label="Current selection ~only"/>
++		<checkbox show="false" id="CB_BACKWARDS" tabstop="true" _label="Bac~kwards"/>
++		<checkbox show="false" id="CB_REGEXP" tabstop="true" _label="Regular e~xpressions"/>
++		<hbox>
++		    <checkbox show="false" id="CB_SIMILARITY" tabstop="true" _label="S~imilarity search"/>
++		    <flow/>
++		    <pushbutton show="false" id="PB_SIMILARITY" tabstop="true" _label="~..." cnt:expand="false"/>
++		    <flow/>
++		</hbox>
++		<checkbox show="false" id="CB_LAYOUTS" tabstop="true" _label="Search for St~yles"/>
++		<checkbox show="false" id="CB_JAP_MATCH_FULL_HALF_WIDTH" tabstop="true" _label="Match character width"/>
++		<hbox>
++		    <checkbox show="false" id="CB_JAP_SOUNDS_LIKE" tabstop="true" _label="Sounds like (Japanese)"/>
++		    <flow/>
++		    <pushbutton show="false" id="PB_JAP_OPTIONS" tabstop="true" _label="..." cnt:expand="false"/>
++		    <flow/>
++		</hbox>
++
++		<fixedline show="false" id="FL_CALC"/>
++		<hbox spacing="5" border="0">
++		    <fixedtext show="false" id="FT_CALC_SEARCHIN" _label="~Search in"/>
++		    <listbox has_border="true" dropdown="true" show="false" id="LB_CALC_SEARCHIN" tabstop="true"/>
++		</hbox>
++		<hbox spacing="5" border="0">
++		    <fixedtext show="false" id="FT_CALC_SEARCHDIR" _label="~Search direction"/>
++		    <vbox spacing="5" border="5">
++			<radiobutton show="false" id="RB_CALC_ROWS" _label="Ro~ws"/>
++			<radiobutton show="false" id="RB_CALC_COLUMNS" _label="Col~umns"/>
++		    </vbox>
++		</hbox>
++		<checkbox show="false" id="CB_ALL_SHEETS" _label="Search in all sheets"/>
++	    </vbox>
++	    <vbox cnt:expand="false" spacing="5" border="0">
++		<min-size min-width="100" cnt:expand="false"/>
++		<pushbutton show="false" id="BTN_ATTRIBUTE" tabstop="true" _label="Attri~butes..." cnt:expand="false"/>
++		<pushbutton show="false" id="BTN_FORMAT" tabstop="true" _label="For~mat..." cnt:expand="false"/>
++		<pushbutton show="false" id="BTN_NOFORMAT" tabstop="true" _label="~No Format" cnt:expand="false"/>
++	    </vbox>
++	</hbox>
++    </vbox>
++</modelessdialog>
 diff --git a/svx/uiconfig/layout/layout.mk b/svx/uiconfig/layout/layout.mk
 deleted file mode 100644
 index 8c939b0..0000000
@@ -80,6 +513,22 @@
 -# Don't want to overwrite filled localize.sdf with empty template
 -template.sdf:
 -	$(foreach,i,$(XML_FILES) $(TRALAY) -l en-US $i) > $@
+diff --git a/svx/uiconfig/layout/makefile.mk b/svx/uiconfig/layout/makefile.mk
+index 2c8ccc8..a700b01 100644
+--- svx/uiconfig/layout/makefile.mk
++++ svx/uiconfig/layout/makefile.mk
+@@ -39,7 +39,10 @@ TARGET=layout
+ 
+ all: ALLTAR
+ 
+-XML_FILES=zoom.xml
++XML_FILES=\
++ "find-&-replace.xml"\
++ zoom.xml\
++#
+ 
+ .INCLUDE : layout.mk
+ 
 diff --git a/svx/uiconfig/layout/zoom.xml b/svx/uiconfig/layout/zoom.xml
 index abed333..f6a76a4 100644
 --- svx/uiconfig/layout/zoom.xml

Added: trunk/patches/dev300/layout-simple-dialogs-svx.diff.orig
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/layout-simple-dialogs-svx.diff.orig	Wed Sep 10 14:58:03 2008
@@ -0,0 +1,594 @@
+diff --git a/svx/inc/srchdlg.hxx b/svx/inc/srchdlg.hxx
+index a62b23d..f39441e 100644
+--- svx/inc/srchdlg.hxx
++++ svx/inc/srchdlg.hxx
+@@ -116,12 +116,19 @@ public:
+ 
+ // class SvxSearchDialogWrapper ------------------------------------------
+ 
++#include <layout/layout.hxx>
++#include <layout/layout-pre.hxx>
++
++class SvxSearchDialog;
+ class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow
+ {
++    SvxSearchDialog *dialog;
+ public:
+ 	SvxSearchDialogWrapper( Window*pParent, USHORT nId,
+ 							SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+ 
++    ~SvxSearchDialogWrapper ();
++    SvxSearchDialog *getDialog ();
+ 	SFX_DECL_CHILDWINDOW(SvxSearchDialogWrapper);
+ };
+ 
+@@ -285,6 +292,8 @@ private:
+ #endif
+ };
+ 
++#include <layout/layout-post.hxx>
++
+ inline BOOL SvxSearchDialog::HasSearchAttributes() const
+ {
+ 	int bLen = aSearchAttrText.GetText().Len();
+diff --git a/svx/source/dialog/makefile.mk b/svx/source/dialog/makefile.mk
+index a7f7051..75926eb 100644
+--- svx/source/dialog/makefile.mk
++++ svx/source/dialog/makefile.mk
+@@ -39,10 +39,6 @@ ENABLE_EXCEPTIONS=TRUE
+ .INCLUDE :  settings.mk
+ .INCLUDE :  $(PRJ)$/util$/makefile.pmk
+ 
+-.IF "$(ENABLE_LAYOUT)" == "TRUE"
+-CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
+-.ENDIF # ENABLE_LAYOUT == TRUE
+-
+ .IF "$(ENABLE_GTK)" != ""
+ CFLAGS+=-DENABLE_GTK
+ .ENDIF
+diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
+index 4e9d1ca..40b41eb 100644
+--- svx/source/dialog/srchdlg.cxx
++++ svx/source/dialog/srchdlg.cxx
+@@ -78,6 +78,8 @@
+ 
+ #include <svx/svxdlg.hxx> //CHINA001
+ 
++#include <layout/layout-pre.hxx>
++
+ using namespace com::sun::star::i18n;
+ using namespace com::sun::star;
+ using namespace comphelper;
+@@ -109,6 +111,11 @@ SV_IMPL_VARARR(SrchAttrItemList, SearchAttrItem);
+ #define GetCheckBoxValue( rBox )								\
+ 	rBox.IsEnabled() ? rBox.IsChecked() : FALSE
+ 
++#if ENABLE_LAYOUT
++#undef SVX_RES
++#define SVX_RES(x) #x
++#endif /* ENABLE_LAYOUT */
++
+ struct SearchDlg_Impl
+ {
+ 	FixedText	aSearchFormats;
+@@ -126,7 +133,11 @@ struct SearchDlg_Impl
+     util::URL   aCommand1URL;
+     util::URL   aCommand2URL;
+ 
+-    SearchDlg_Impl( Window* pParent ) :
++#if ENABLE_LAYOUT
++    SearchDlg_Impl( layout::Context* pParent ) :
++#else /* !ENABLE_LAYOUT */
++        SearchDlg_Impl( Window* pParent ) :
++#endif /* !ENABLE_LAYOUT */
+         aSearchFormats  ( pParent, SVX_RES( FT_SEARCH_FORMATS ) ),
+         aReplaceFormats ( pParent, SVX_RES( FT_REPLACE_FORMATS ) ),
+         bMultiLineEdit  ( FALSE ),
+@@ -316,9 +327,16 @@ void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings )
+ 	pPage->SetTransliterationFlags( nSettings );
+ }
+ */ //CHINA001
+-#ifdef INI_LIST
++
++#if ENABLE_LAYOUT
++#undef SfxModelessDialog
++#define SfxModelessDialog(sfx_bindings, child, parent, id) Dialog( parent, "find-&-replace.xml", id )
++#define SVX_RES_PLAIN(x) ResId (x, DIALOG_MGR ())
++#else /* !ENABLE_LAYOUT */
++#define SVX_RES_PLAIN SVX_RES
++#endif /* !ENABLE_LAYOUT */
++
+ #undef INI_LIST
+-#endif
+ #define INI_LIST() \
+ 	aSearchText 	( this, SVX_RES( FT_SEARCH ) ),							\
+ 	aSearchLB		( this, SVX_RES( ED_SEARCH ) ),							\
+@@ -371,7 +389,7 @@ void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings )
+ 	bReadOnly		( FALSE ),												\
+ 	bConstruct		( TRUE ),												\
+ 	nModifyFlag		( 0 ),													\
+-    aCalcStr        ( SVX_RES( STR_WORDCALC ) ),                              \
++    aCalcStr        ( SVX_RES_PLAIN( STR_WORDCALC ) ),                      \
+     pImpl           ( NULL ),                                               \
+ 	pSearchList 	( NULL ),												\
+ 	pReplaceList	( NULL ),												\
+@@ -408,6 +426,10 @@ SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, Sf
+ }
+ 
+ #undef INI_LIST
++#if ENABLE_LAYOUT
++#undef SVX_RES
++#define SVX_RES(x) ResId (x, DIALOG_MGR ())
++#endif
+ 
+ // -----------------------------------------------------------------------
+ 
+@@ -431,6 +453,11 @@ SvxSearchDialog::~SvxSearchDialog()
+ }
+ 
+ // -----------------------------------------------------------------------
++#if ENABLE_LAYOUT
++#undef Window
++#define Window layout::Window
++#endif /* !ENABLE_LAYOUT */
++
+ void lcl_MoveDown( Window& rWindow, sal_Int32 nOffset )
+ {
+     Point aPos(rWindow.GetPosPixel());
+@@ -440,12 +467,17 @@ void lcl_MoveDown( Window& rWindow, sal_Int32 nOffset )
+ 
+ void SvxSearchDialog::Construct_Impl()
+ {
++#if ENABLE_LAYOUT
++    SetHelpId (SID_SEARCH_DLG);
++#endif /* ENABLE_LAYOUT */
++
+ 	// temporary to avoid incompatibility
+ 	pImpl = new SearchDlg_Impl( this );
++#if !ENABLE_LAYOUT
+ 	pImpl->aSelectionTimer.SetTimeout( 500 );
+ 	pImpl->aSelectionTimer.SetTimeoutHdl(
+ 		LINK( this, SvxSearchDialog, TimeoutHdl_Impl ) );
+-
++#endif /* !ENABLE_LAYOUT */
+ 	EnableControls_Impl( 0 );
+ 
+ 	// alten Text des aWordBtn's merken
+@@ -572,6 +604,7 @@ void SvxSearchDialog::Construct_Impl()
+             aSearchComponentFL.Show();
+             aSearchComponent2PB.Show();
+         }
++#if 1// !ENABLE_LAYOUT
+         if( aSearchComponentFL.IsVisible() && aSearchComponent1PB.IsVisible() )
+         {        
+         
+@@ -618,6 +651,7 @@ void SvxSearchDialog::Construct_Impl()
+ 
+             SetSizePixel(aDlgSize);
+         }
++#endif /* !ENABLE_LAYOUT */
+     }
+ }
+ 
+@@ -715,6 +749,7 @@ void SvxSearchDialog::InitControls_Impl()
+ 	aLink = LINK( this, SvxSearchDialog, LoseFocusHdl_Impl );
+ 	aSearchLB.SetLoseFocusHdl( aLink );
+ 	aReplaceLB.SetLoseFocusHdl( aLink );
++
+ 	aSearchTmplLB.SetLoseFocusHdl( aLink );
+ 	aReplaceTmplLB.SetLoseFocusHdl( aLink );
+ 
+@@ -886,6 +921,8 @@ void SvxSearchDialog::CalculateDelta_Impl()
+     pMoreBtn->Enable();
+ }
+ 
++#undef Window
++
+ // -----------------------------------------------------------------------
+ 
+ void SvxSearchDialog::Init_Impl( int bSearchPattern )
+@@ -893,6 +930,11 @@ void SvxSearchDialog::Init_Impl( int bSearchPattern )
+ 	DBG_ASSERT( pSearchItem, "SearchItem == 0" );
+ 	bWriter = ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_WRITER );
+ 
++#if 0 //ENABLE_LAYOUT
++    if (!pImpl)
++        pImpl = new SearchDlg_Impl( this );
++#endif /* ENABLE_LAYOUT */
++
+ 	pImpl->bMultiLineEdit = FALSE;
+ 
+ 	if ( !pImpl->bMultiLineEdit )
+@@ -1456,6 +1498,11 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+ 				Remember_Impl( aStr, FALSE );
+ 		}
+ 		SaveToModule_Impl();
++#if 0 //ENABLE_LAYOUT
++        aJapOptionsCB.Show ();
++        delete pImpl;
++        pImpl = 0;
++#endif /* ENABLE_LAYOUT */
+ 		Close();
+ 	}
+ 	else if ( pBtn == &aSimilarityBtn )
+@@ -1469,7 +1516,7 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+ 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ 		if(pFact)
+ 		{
+-			AbstractSvxSearchSimilarityDialog* pDlg = pFact->CreateSvxSearchSimilarityDialog( this,
++			AbstractSvxSearchSimilarityDialog* pDlg = pFact->CreateSvxSearchSimilarityDialog( LAYOUT_THIS_WINDOW (this),
+ 																		pSearchItem->IsLEVRelaxed(),
+ 																		pSearchItem->GetLEVOther(),
+ 																		pSearchItem->GetLEVShorter(),
+@@ -1495,7 +1542,7 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ 		if(pFact)
+ 		{
+-			AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( this, aSet, RID_SVXPAGE_JSEARCH_OPTIONS, pSearchItem->GetTransliterationFlags(), RID_SVXPAGE_JSEARCH_OPTIONS );
++			AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( LAYOUT_THIS_WINDOW (this), aSet, RID_SVXPAGE_JSEARCH_OPTIONS, pSearchItem->GetTransliterationFlags(), RID_SVXPAGE_JSEARCH_OPTIONS );
+ 			DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ 			int nRet = aDlg->Execute(); //CHINA001 int nRet = aDlg.Execute();
+ 			if (RET_OK == nRet) //! true only if FillItemSet of SvxJSearchOptionsPage returns true
+@@ -1514,7 +1561,7 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+         pArgs[0].Name = ::rtl::OUString::createFromAscii("SearchString");
+         pArgs[0].Value <<= ::rtl::OUString(aSearchLB.GetText());
+         pArgs[1].Name = ::rtl::OUString::createFromAscii("ParentWindow");
+-        pArgs[1].Value <<= VCLUnoHelper::GetInterface( this );
++        pArgs[1].Value <<= VCLUnoHelper::GetInterface( LAYOUT_THIS_WINDOW (this) );
+         if(pBtn == &aSearchComponent1PB)
+         {
+             if ( pImpl->xCommand1Dispatch.is() )
+@@ -2018,6 +2065,7 @@ IMPL_LINK( SvxSearchDialog, FocusHdl_Impl, Control *, pCtrl )
+ 	aSearchLB.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+ 
+ 	ModifyHdl_Impl( (ComboBox*)pCtrl );
++
+ 	aLayoutBtn.SetText( bFormat && nTxtLen ? aLayoutStr : aStylesStr );
+ 	return 0;
+ }
+@@ -2091,7 +2139,7 @@ IMPL_LINK( SvxSearchDialog, FormatHdl_Impl, Button *, EMPTYARG )
+ 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ 	if(pFact)
+ 	{
+-		SfxAbstractTabDialog* pDlg = pFact->CreateTabItemDialog( this, aSet, RID_SVXDLG_SEARCHFORMAT );
++		SfxAbstractTabDialog* pDlg = pFact->CreateTabItemDialog( LAYOUT_THIS_WINDOW (this), aSet, RID_SVXDLG_SEARCHFORMAT );
+ 		DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ 		aTxt.Insert( pDlg->GetText(), 0 );
+ 		pDlg->SetText( aTxt );
+@@ -2168,7 +2216,7 @@ IMPL_LINK( SvxSearchDialog, AttributeHdl_Impl, Button *, EMPTYARG )
+ 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ 	if(pFact)
+ 	{
+-		VclAbstractDialog* pDlg = pFact->CreateSvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges, RID_SVXDLG_SEARCHATTR );
++		VclAbstractDialog* pDlg = pFact->CreateSvxSearchAttributeDialog( LAYOUT_THIS_WINDOW (this), *pSearchList, pImpl->pRanges, RID_SVXDLG_SEARCHATTR );
+ 		DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ 		pDlg->Execute();
+ 		delete pDlg;
+@@ -2327,7 +2375,9 @@ void SvxSearchDialog::PaintAttrText_Impl()
+ 
+ void SvxSearchDialog::SetModifyFlag_Impl( const Control* pCtrl )
+ {
+-	if ( &aSearchLB == (ComboBox*)pCtrl )
++    if (0)
++        ;
++	else if ( &aSearchLB == (ComboBox*)pCtrl )
+ 		nModifyFlag |= MODIFY_SEARCH;
+ 	else if ( &aReplaceLB == (ComboBox*)pCtrl )
+ 		nModifyFlag |= MODIFY_REPLACE;
+@@ -2414,25 +2464,38 @@ void SvxSearchDialog::SaveToModule_Impl()
+ 
+ // class SvxSearchDialogWrapper ------------------------------------------
+ 
+-SFX_IMPL_CHILDWINDOW(SvxSearchDialogWrapper, SID_SEARCH_DLG)
++SFX_IMPL_CHILDWINDOW(SvxSearchDialogWrapper, SID_SEARCH_DLG);
+ 
+ // -----------------------------------------------------------------------
+ 
+ SvxSearchDialogWrapper::SvxSearchDialogWrapper( Window* _pParent, USHORT nId,
+ 												SfxBindings* pBindings,
+-												SfxChildWinInfo* pInfo ) :
+-    SfxChildWindow( _pParent, nId )
+-
++												SfxChildWinInfo* pInfo )
++    : SfxChildWindow( _pParent, nId )
++    , dialog (new SvxSearchDialog (_pParent, this, *pBindings))
+ {
+-    pWindow = new SvxSearchDialog( _pParent, this, *pBindings );
+-	( (SvxSearchDialog*)pWindow )->Initialize( pInfo );
++    pWindow = LAYOUT_THIS_WINDOW (dialog);
++	dialog->Initialize( pInfo );
+ 
+ 	pBindings->Update( SID_SEARCH_ITEM );
+ 	pBindings->Update( SID_SEARCH_OPTIONS );
+ 	pBindings->Update( SID_SEARCH_SEARCHSET );
+ 	pBindings->Update( SID_SEARCH_REPLACESET );
+ 	eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+-	( (SvxSearchDialog*)pWindow )->bConstruct = FALSE;
++	dialog->bConstruct = FALSE;
++}
++
++SvxSearchDialogWrapper::~SvxSearchDialogWrapper ()
++{
++#if ENABLE_LAYOUT
++    delete dialog;
++    pWindow = 0;
++#endif /* ENABLE_LAYOUT */
++}
++
++SvxSearchDialog *SvxSearchDialogWrapper::getDialog ()
++{
++    return dialog;
+ }
+ 
+ // -----------------------------------------------------------------------
+diff --git a/svx/source/dialog/zoom.cxx b/svx/source/dialog/zoom.cxx
+index ef1b8e2..50dc336 100644
+--- svx/source/dialog/zoom.cxx
++++ svx/source/dialog/zoom.cxx
+@@ -56,6 +56,13 @@
+ 
+ #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[] =
+@@ -217,6 +224,9 @@ SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) :
+ 	bModified	( FALSE )
+ 
+ {
++#if ENABLE_LAYOUT
++    SetHelpId (SID_ATTR_ZOOM);
++#endif /* ENABLE_LAYOUT */
+ 	Link aLink = LINK( this, SvxZoomDialog, UserHdl );
+     a100Btn.SetClickHdl( aLink );
+     aOptimalBtn.SetClickHdl( aLink );
+diff --git a/svx/source/table/localize.sdf b/svx/source/table/localize.sdf
+new file mode 100644
+index 0000000..8b13789
+--- /dev/null
++++ svx/source/table/localize.sdf
+@@ -0,0 +1 @@
++
+diff --git a/svx/uiconfig/layout/find-&-replace.xml b/svx/uiconfig/layout/find-&-replace.xml
+new file mode 100644
+index 0000000..78d8006
+--- /dev/null
++++ svx/uiconfig/layout/find-&-replace.xml
+@@ -0,0 +1,111 @@
++<?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.  !-->
++
++<modelessdialog _title="Find &amp; Replace" help-id="SID_SEARCH_DLG" show="false" sizeable="true" moveable="true" output-size="true" id="RID_SVXDLG_SEARCH" sv-look="true" _text="Find &amp; Replace" xmlns="http://openoffice.org/2007/layout"; xmlns:cnt="http://openoffice.org/2007/layout/container";>
++    <vbox spacing="5" border="5">
++	<string id="RID_SVXSTR_SEARCH_STYLES" _text="Including Styles"/>
++	<string id="RID_SVXSTR_SEARCH" _text="(Search)"/>
++	<string id="RID_SVXSTR_REPLACE" _text="(Replace)"/>
++	<string id="STR_WORDCALC" _text="~Entire cells"/>
++	<string id="STR_MORE_BTN" _text="More ~Options"/>
++	<string id="STR_LESS_BTN" _text="Less ~Options"/>
++	<hbox homogeneous="false" spacing="5" border="0">
++	    <vbox spacing="5" border="0">
++		<fixedtext id="FT_SEARCH" _label="~Search for"/>
++		<combobox dropdown="true" id="ED_SEARCH" tabstop="true" cnt:expand="false"/>
++		<listbox has_border="true" dropdown="true" show="false" id="LB_SEARCH" sort="true" tabstop="true"/>
++		<fixedtext show="false" id="FT_SEARCH_ATTR" word-break="true"/>
++		<fixedtext show="false" id="FT_SEARCH_FORMATS" word-break="true"/>
++		<flow/>
++		<flow/>
++		<flow/>
++	    </vbox>
++	    <vbox cnt:expand="false" spacing="5" border="0">
++		<min-size min-width="100" cnt:expand="false"/>
++		<pushbutton default="true" id="BTN_SEARCH" tabstop="true" _label="~Find" cnt:expand="false"/>
++		<pushbutton id="BTN_SEARCH_ALL" tabstop="true" _label="Find ~All" cnt:expand="false"/>
++	    </vbox>
++	</hbox>
++        <hbox spacing="5" border="0">
++	    <flow/>
++	    <vbox cnt:expand="false" spacing="5" border="0">
++		<min-size min-width="100" cnt:expand="false"/>
++		<fixedline id="FL_SEARCH_COMMAND"/>
++	    </vbox>
++	</hbox>
++	<hbox homogeneous="false" spacing="5" border="0">
++	    <vbox spacing="5" border="0">
++		<fixedtext id="FT_REPLACE" _label="Re~place with"/>
++		<combobox dropdown="true" id="ED_REPLACE" tabstop="true" cnt:expand="false"/>
++		<listbox has_border="true" dropdown="true" show="false" id="LB_REPLACE" sort="true" tabstop="true"/>
++		<fixedtext show="false" id="FT_REPLACE_ATTR" word-break="true"/>
++		<fixedtext show="false" id="FT_REPLACE_FORMATS" word-break="true"/>
++		<fixedline show="false" id="FL_SEARCH_COMPONENT"/>
++		<flow/>
++		<flow/>
++		<flow/>
++	    </vbox>
++	    <vbox cnt:expand="false" spacing="5" border="0">
++		<min-size min-width="100" cnt:expand="false"/>
++		<pushbutton id="BTN_REPLACE" tabstop="true" _label="~Replace" cnt:expand="false"/>
++		<pushbutton id="BTN_REPLACE_ALL" tabstop="true" _label="Replace A~ll" cnt:expand="false"/>
++	    </vbox>
++	</hbox>
++        <checkbox id="CB_MATCH_CASE" tabstop="true" _label="Ma~tch case"/>
++        <pushbutton show="false" id="BTN_COMPONENT_1" tabstop="true" cnt:expand="false"/>
++        <checkbox id="CB_WHOLE_WORDS" tabstop="true" _label="Whole wor~ds only"/>
++        <pushbutton show="false" id="BTN_COMPONENT_2" tabstop="true" cnt:expand="false"/>
++        <fixedline id="FL_BUTTONS"/>
++	<hbox>
++            <morebutton delta="174" map-unit="MAP_APPFONT" id="BTN_MORE" state="false" tabstop="true"/>
++            <dialogbuttonhbox>
++		<helpbutton id="BTN_HELP" tabstop="true" cnt:expand="false"/>
++		<cancelbutton id="BTN_CLOSE" tabstop="true" _text="~Close" cnt:expand="false"/>
++            </dialogbuttonhbox>
++	</hbox>
++        <fixedline show="false" id="FL_OPTIONS"/>
++	<hbox homogeneous="false" spacing="5" border="0">
++	    <vbox spacing="5" border="0">
++		<checkbox show="false" id="CB_SELECTIONS" tabstop="true" _label="Current selection ~only"/>
++		<checkbox show="false" id="CB_BACKWARDS" tabstop="true" _label="Bac~kwards"/>
++		<checkbox show="false" id="CB_REGEXP" tabstop="true" _label="Regular e~xpressions"/>
++		<hbox>
++		    <checkbox show="false" id="CB_SIMILARITY" tabstop="true" _label="S~imilarity search"/>
++		    <flow/>
++		    <pushbutton show="false" id="PB_SIMILARITY" tabstop="true" _label="~..." cnt:expand="false"/>
++		    <flow/>
++		</hbox>
++		<checkbox show="false" id="CB_LAYOUTS" tabstop="true" _label="Search for St~yles"/>
++		<checkbox show="false" id="CB_JAP_MATCH_FULL_HALF_WIDTH" tabstop="true" _label="Match character width"/>
++		<hbox>
++		    <checkbox show="false" id="CB_JAP_SOUNDS_LIKE" tabstop="true" _label="Sounds like (Japanese)"/>
++		    <flow/>
++		    <pushbutton show="false" id="PB_JAP_OPTIONS" tabstop="true" _label="..." cnt:expand="false"/>
++		    <flow/>
++		</hbox>
++
++		<fixedline show="false" id="FL_CALC"/>
++		<hbox spacing="5" border="0">
++		    <fixedtext show="false" id="FT_CALC_SEARCHIN" _label="~Search in"/>
++		    <listbox has_border="true" dropdown="true" show="false" id="LB_CALC_SEARCHIN" tabstop="true"/>
++		</hbox>
++		<hbox spacing="5" border="0">
++		    <fixedtext show="false" id="FT_CALC_SEARCHDIR" _label="~Search direction"/>
++		    <vbox spacing="5" border="5">
++			<radiobutton show="false" id="RB_CALC_ROWS" _label="Ro~ws"/>
++			<radiobutton show="false" id="RB_CALC_COLUMNS" _label="Col~umns"/>
++		    </vbox>
++		</hbox>
++		<checkbox show="false" id="CB_ALL_SHEETS" _label="Search in all sheets"/>
++	    </vbox>
++	    <vbox cnt:expand="false" spacing="5" border="0">
++		<min-size min-width="100" cnt:expand="false"/>
++		<pushbutton show="false" id="BTN_ATTRIBUTE" tabstop="true" _label="Attri~butes..." cnt:expand="false"/>
++		<pushbutton show="false" id="BTN_FORMAT" tabstop="true" _label="For~mat..." cnt:expand="false"/>
++		<pushbutton show="false" id="BTN_NOFORMAT" tabstop="true" _label="~No Format" cnt:expand="false"/>
++	    </vbox>
++	</hbox>
++    </vbox>
++</modelessdialog>
+diff --git a/svx/uiconfig/layout/layout.mk b/svx/uiconfig/layout/layout.mk
+deleted file mode 100644
+index 8c939b0..0000000
+--- svx/uiconfig/layout/layout.mk
++++ /dev/null
+@@ -1,33 +0,0 @@
+-# TODO: move to solenv/inc
+-# copies: sc/uiconfig/layout svx/uiconfig/layout sw/uiconfig/layout
+-
+-TRALAY=tralay
+-XML_DEST=$(DLLDEST)
+-XML_LANGS=$(alllangiso)
+-
+-ALL_XMLS=$(foreach,i,$(XML_FILES) $(XML_DEST)/$i) $(foreach,i,$(XML_LANGS) $(foreach,j,$(XML_FILES) $(XML_DEST)/$i/$j))
+-
+-# Must remove the -j (no duplicate base file names) flag
+-ZIPUPDATE=-u
+-XML_ZIP = $(PRJNAME)-layout
+-
+-ALLTAR: $(XML_ZIP)
+-
+-$(XML_ZIP): $(ALL_XMLS)
+-
+-ZIP1DIR=$(XML_DEST)
+-ZIP1TARGET=$(XML_ZIP)
+-ZIP1LIST=$(ALL_XMLS:s $(XML_DEST)/@@)
+-
+-$(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml
+-	-$(MKDIR) $(@:d)
+-	@echo $(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml
+-	$(TRALAY) -m localize.sdf -o $(XML_DEST) -l $(XML_LANGS:f:t" -l ") $<
+-
+-$(XML_DEST)/%.xml: %.xml
+-	-$(MKDIR) $(@:d)
+-	$(COPY) $< $@
+-
+-# Don't want to overwrite filled localize.sdf with empty template
+-template.sdf:
+-	$(foreach,i,$(XML_FILES) $(TRALAY) -l en-US $i) > $@
+diff --git a/svx/uiconfig/layout/makefile.mk b/svx/uiconfig/layout/makefile.mk
+index 2c8ccc8..a700b01 100644
+--- svx/uiconfig/layout/makefile.mk
++++ svx/uiconfig/layout/makefile.mk
+@@ -39,7 +39,10 @@ TARGET=layout
+ 
+ all: ALLTAR
+ 
+-XML_FILES=zoom.xml
++XML_FILES=\
++ "find-&-replace.xml"\
++ zoom.xml\
++#
+ 
+ .INCLUDE : layout.mk
+ 
+diff --git a/svx/uiconfig/layout/zoom.xml b/svx/uiconfig/layout/zoom.xml
+index abed333..f6a76a4 100644
+--- svx/uiconfig/layout/zoom.xml
++++ svx/uiconfig/layout/zoom.xml
+@@ -12,13 +12,13 @@
+ 	<hbox spacing="0" border="0">
+ 	    <vbox spacing="5" border="5">
+ 		<fixedline id="FL_ZOOM" _text="Zoom factor" cnt:expand="true"/>
+-		<radiobutton radiogroup="zoom" id="BTN_OPTIMAL"   _label="Optimal"/>
+-		<radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" _label="Whole Page"/>
+-		<radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" _label="Page Width"/>
+-		<radiobutton radiogroup="zoom" id="BTN_100"   _label="100 %"/>
++		<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" id="BTN_USER" _label="Variable"/>
++			<radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-factor" id="BTN_USER" _label="Variable"/>
+ 		    </align>
+ 		    <flow cnt:padding="10" cnt:expand="false"/>
+ 		    <metricfield id="ED_USER" value-step="1"
+@@ -30,11 +30,11 @@
+ 	    </vbox>
+ 	    <vbox spacing="5" border="5">
+ 		<fixedline id="FL_VIEWLAYOUT" _text="View layout" cnt:expand="true"/>
+-		<radiobutton radiogroup="zoom" id="BTN_AUTOMATIC" _label="~Automatic"/>
+-		<radiobutton radiogroup="zoom" id="BTN_SINGLE"    _label="~Single page"/>
++		<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" id="BTN_COLUMNS" _label="~Columns"/>
++			<radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-layout" id="BTN_COLUMNS" _label="~Columns"/>
+ 		    </align>
+ 		    <flow cnt:padding="10" cnt:expand="false"/>
+ 		    <metricfield id="ED_COLUMNS" value-step="1"
+@@ -48,7 +48,7 @@
+ 		<hbox><flow cnt:expand="false" cnt:padding="10"/><checkbox id="CHK_BOOK" _label="~Book mode"/></hbox>
+ 	    </vbox>
+ 	</hbox>
+-	<fixedline cnt:padding="1" id="FL_BOTTOM"/>
++        <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ 	<dialogbuttonhbox border="5" spacing="5">
+ 	    <flow/>
+ 	    <okbutton     id="BTN_ZOOM_OK"/>
+diff --git a/svx/util/makefile.pmk b/svx/util/makefile.pmk
+index 028a32e..4831744 100644
+--- svx/util/makefile.pmk
++++ svx/util/makefile.pmk
+@@ -36,12 +36,6 @@ CDEFS += -DSVX_DLLIMPLEMENTATION
+ CFLAGS+=-DENABLE_GTK
+ .ENDIF
+ 
+-.IF "$(ENABLE_LAYOUT)" == "TRUE"
+-CFLAGS+=-DENABLE_LAYOUT=1
+-.ELSE
+-CFLAGS+=-DENABLE_LAYOUT=0
+-.ENDIF # ENABLE_LAYOUT == TRUE
+-
+ # set default symbol visibility / scope to hidden
+ .IF "$(COMNAME)" == "gcc3"
+ .IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"

Modified: trunk/patches/dev300/layout-simple-dialogs-sw.diff
==============================================================================
--- trunk/patches/dev300/layout-simple-dialogs-sw.diff	(original)
+++ trunk/patches/dev300/layout-simple-dialogs-sw.diff	Wed Sep 10 14:58:03 2008
@@ -1,3 +1,38 @@
+diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx
+index de00672..1ccca23 100644
+--- sw/inc/mdiexp.hxx
++++ sw/inc/mdiexp.hxx
+@@ -32,6 +32,8 @@
+ 
+ #include <tools/solar.h>
+ #include <tblenum.hxx>
++#include <layout/layout.hxx>
++
+ class UniString;
+ class SwRect;
+ class Size;
+@@ -61,7 +63,7 @@ void RescheduleProgress( SwDocShell *pDocShell );
+ 
+ void EnableCmdInterface(BOOL bEnable = TRUE);
+ 
+-Dialog* GetSearchDialog();
++LAYOUT_NS Dialog* GetSearchDialog();
+ 
+ void RepaintPagePreview( ViewShell* pVwSh, const SwRect& rRect );
+ 
+diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
+index dbd0a1b..c2add0d 100644
+--- sw/source/core/crsr/viscrs.cxx
++++ sw/source/core/crsr/viscrs.cxx
+@@ -1126,7 +1126,7 @@ SwCursor* SwShellCrsr::Create( SwPaM* pRing ) const
+ short SwShellCrsr::MaxReplaceArived()
+ {
+     short nRet = RET_YES;
+-	Window* pDlg = ::GetSearchDialog();
++	Window* pDlg = LAYOUT_THIS_WINDOW (::GetSearchDialog());
+ 	if( pDlg )
+ 	{
+ 		// alte Actions beenden; die Tabellen-Frames werden angelegt und
 diff --git a/sw/source/ui/dialog/makefile.mk b/sw/source/ui/dialog/makefile.mk
 index 1f16883..17ca965 100644
 --- sw/source/ui/dialog/makefile.mk
@@ -43,6 +78,132 @@
      FreeResource();
  }
  /*-- 06.04.2004 16:05:56---------------------------------------------------
+diff --git a/sw/source/ui/docvw/edtwin3.cxx b/sw/source/ui/docvw/edtwin3.cxx
+index af37a99..fbe37b1 100644
+--- sw/source/ui/docvw/edtwin3.cxx
++++ sw/source/ui/docvw/edtwin3.cxx
+@@ -150,7 +150,7 @@ BOOL SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt,
+ }
+ // <--
+ 
+-Dialog* GetSearchDialog()
++LAYOUT_NS Dialog* GetSearchDialog()
+ {
+ 	return SwView::GetSearchDialog();
+ }
+diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
+index 1fe66b1..db9f5c3 100644
+--- sw/source/ui/inc/view.hxx
++++ sw/source/ui/inc/view.hxx
+@@ -41,6 +41,7 @@
+ #include "swdllapi.h"
+ #include <swtypes.hxx>
+ #include <shellid.hxx>
++#include <layout/layout.hxx>
+ 
+ class SwBaseShell;
+ class Button;
+@@ -490,7 +491,7 @@ public:
+ 			void	SetVisArea( const Point&, BOOL bUpdateScrollbar = TRUE);
+ 			void	CheckVisArea();
+ 
+-	static Dialog* 	GetSearchDialog();
++    static LAYOUT_NS Dialog* GetSearchDialog();
+ 
+ 	static USHORT	GetMoveType();
+ 	static void		SetMoveType(USHORT nSet);
+diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx
+index 2a6f89a..db053a4 100644
+--- sw/source/ui/uiview/srcview.cxx
++++ sw/source/ui/uiview/srcview.cxx
+@@ -128,7 +128,6 @@
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::i18n;
+ using namespace ::com::sun::star::lang;
+-using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::ui::dialogs;
+ using namespace ::com::sun::star::i18n;
+@@ -181,7 +180,7 @@ void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const S
+ 	Size aSz = pPrinter->GetOutputSize();
+ 	short nBorder = BORDERPRN;
+ 
+-	Color aOldFillColor( pPrinter->GetFillColor() );
++    Color aOldFillColor( pPrinter->GetFillColor() );
+ 	Font aOldFont( pPrinter->GetFont() );
+ 
+ 	pPrinter->SetFillColor( Color(COL_TRANSPARENT) );
+@@ -690,7 +689,7 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
+ 		pTextView->SetSelection( TextSelection( aPaM, aPaM ));
+ 	}
+ 
+-	SearchOptions aSearchOpt( rSearchItem.GetSearchOptions() );
++    util::SearchOptions aSearchOpt( rSearchItem.GetSearchOptions() );
+ 	aSearchOpt.Locale = SvxCreateLocale(
+ 		static_cast< LanguageType >( GetAppLanguage() ) );
+ 
+diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
+index b09c566..e19915e 100644
+--- sw/source/ui/uiview/viewsrch.cxx
++++ sw/source/ui/uiview/viewsrch.cxx
+@@ -106,7 +106,7 @@ inline Window* GetParentWindow( SvxSearchDialog* pSrchDlg )
+ {
+ 	Window* pWin;
+ 	if( pSrchDlg && pSrchDlg->IsVisible() )
+-		pWin = pSrchDlg;
++		pWin = LAYOUT_THIS_WINDOW (pSrchDlg);
+ 	else
+ 		pWin = 0;
+ 	return pWin;
+@@ -168,7 +168,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage)
+ 
+ 			if ( pWrp )
+ 			{
+-				pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow());
++                pSrchDlg = static_cast <SvxSearchDialog*> (pWrp->getDialog ());
+ 				// die Search / Replace -Items merken wir uns
+ 				const SearchAttrItemList* pList = pSrchDlg->GetSearchItemList();
+ 				if( pList && pList->Count() )
+@@ -189,7 +189,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage)
+ 					SwView::SetMoveType(NID_SRCH_REP);
+ 				if ( pWrp )
+ 				{
+-					pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow());
++                    pSrchDlg = static_cast <SvxSearchDialog*> (pWrp->getDialog ());
+ 				}
+ 				else
+ 					pSrchDlg = 0;
+@@ -494,7 +494,7 @@ BOOL SwView::SearchAndWrap(BOOL bApi)
+ 
+ 	const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId();
+ 	SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId);
+-	pSrchDlg = pWrp ? (SvxSearchDialog*)(pWrp->GetWindow()) : 0;
++	pSrchDlg = pWrp ? static_cast <SvxSearchDialog*> (pWrp->getDialog ()) : 0;
+ 
+ 		// falls Startposition am Dokumentende / -anfang
+ 	if (aOpts.bDontWrap)
+@@ -727,19 +727,17 @@ ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions )
+ 	return nFound;
+ }
+ 
+-
+-Dialog* SwView::GetSearchDialog()
++LAYOUT_NS Dialog* SwView::GetSearchDialog()
+ {
+ 	const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId();
+ 	SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)SfxViewFrame::Current()->GetChildWindow(nId);
+ 	if ( pWrp )
+-		pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow());
++		pSrchDlg = pWrp->getDialog ();
+ 	else
+ 		pSrchDlg = 0;
+ 	return pSrchDlg;
+ }
+ 
+-
+ void SwView::StateSearch(SfxItemSet &rSet)
+ {
+ 	SfxWhichIter aIter(rSet);
 diff --git a/sw/uiconfig/layout/layout.mk b/sw/uiconfig/layout/layout.mk
 deleted file mode 100644
 index 88164bb..0000000

Modified: trunk/patches/dev300/layout-simple-dialogs-toolkit.diff
==============================================================================
--- trunk/patches/dev300/layout-simple-dialogs-toolkit.diff	(original)
+++ trunk/patches/dev300/layout-simple-dialogs-toolkit.diff	Wed Sep 10 14:58:03 2008
@@ -1,6 +1,6 @@
 diff --git a/toolkit/doc/layout/TODO b/toolkit/doc/layout/TODO
 index abd717c..fbc2c85 100644
---- a/toolkit/doc/layout/TODO
+--- toolkit/doc/layout/TODO
 +++ toolkit/doc/layout/TODO
 @@ -4,6 +4,11 @@
  ** Move everything & development into new layout-dialogs CWS
@@ -35,8 +35,8 @@
  
  * i18n
 diff --git a/toolkit/inc/layout/layout-post.hxx b/toolkit/inc/layout/layout-post.hxx
-index 54ed610..bf41277 100644
---- a/toolkit/inc/layout/layout-post.hxx
+index 54ed610..1d3d955 100644
+--- toolkit/inc/layout/layout-post.hxx
 +++ toolkit/inc/layout/layout-post.hxx
 @@ -34,6 +34,10 @@
  
@@ -73,7 +73,7 @@
  #undef NoButton
  #undef NumericField
  #undef NumericFormatter
-@@ -64,17 +73,20 @@
+@@ -64,36 +73,31 @@
  #undef Plugin
  #undef ProgressBar
  #undef PushButton
@@ -81,8 +81,12 @@
  #undef RadioButton
  #undef ResetButton
  #undef RetryButton
++#undef SfxTabPage
++#undef SfxTabDialog
  #undef SpinField
 -#undef Table
++#undef TabDialog
++#undef TabControl
  #undef TabPage
 +#undef Table
  #undef VBox
@@ -93,9 +97,10 @@
  #undef ModelessDialog
 +#undef ScExpandedFixedText
  #undef SfxModalDialog
- #undef SfxTabPage
+-#undef SfxTabPage
++#undef SfxModelessDialog
  
-@@ -82,18 +94,6 @@
+ #undef SvxLanguageBox
  
  #undef Window
  
@@ -115,8 +120,8 @@
  
  #endif /* _LAYOUT_POST_HXX */
 diff --git a/toolkit/inc/layout/layout-pre.hxx b/toolkit/inc/layout/layout-pre.hxx
-index fbbc1df..702470c 100644
---- a/toolkit/inc/layout/layout-pre.hxx
+index fbbc1df..b628708 100644
+--- toolkit/inc/layout/layout-pre.hxx
 +++ toolkit/inc/layout/layout-pre.hxx
 @@ -34,15 +34,8 @@
  
@@ -160,7 +165,7 @@
  #define NoButton layout::NoButton
  #define NumericField layout::NumericField
  #define NumericFormatter layout::NumericFormatter
-@@ -74,17 +72,20 @@
+@@ -74,64 +72,31 @@
  #define Plugin layout::Plugin
  #define ProgressBar layout::ProgressBar
  #define PushButton layout::PushButton
@@ -168,8 +173,11 @@
  #define RadioButton layout::RadioButton
  #define ResetButton layout::ResetButton
  #define RetryButton layout::RetryButton
++#define SfxTabDialog layout::SfxTabDialog
++#define SfxTabPage layout::SfxTabPage
  #define SpinField layout::SpinField
 -#define Table layout::Table
++#define TabControl layout::TabControl
  #define TabPage layout::TabPage
 +#define Table layout::Table
  #define VBox layout::VBox
@@ -180,12 +188,17 @@
  #define ModelessDialog Dialog
 +#define ScExpandedFixedText FixedText
  #define SfxModalDialog Dialog
- #define SfxTabPage TabPage
+-#define SfxTabPage TabPage
++#define SfxModelessDialog Dialog
++#define TabDialog Dialog
+ 
+ #define SvxLanguageBox ListBox
  
-@@ -95,43 +96,8 @@
- #define LAYOUT_DIALOG_PARENT\
-     VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ) )->GetWindow()
+ #define Window ::Window
  
+-#define LAYOUT_DIALOG_PARENT\
+-    VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ) )->GetWindow()
+-
 -#undef SVX_RES
 -#define SVX_RES(x) #x
 -#undef SvtResId
@@ -222,17 +235,16 @@
 -#else /* !ENABLE_LAYOUT */
 -
 -#define LAYOUT_PRE_POST 1
-+#define LAYOUT_THIS_WINDOW( this ) this->GetWindow ()
- 
+-
 -#endif /* !ENABLE_LAYOUT */
 +#endif /* ENABLE_LAYOUT */
  
  #endif /* _LAYOUT_PRE_HXX */
 diff --git a/toolkit/inc/layout/layout.hxx b/toolkit/inc/layout/layout.hxx
-index 62b7ffa..ee831f3 100644
---- a/toolkit/inc/layout/layout.hxx
+index 62b7ffa..8b138ea 100644
+--- toolkit/inc/layout/layout.hxx
 +++ toolkit/inc/layout/layout.hxx
-@@ -32,28 +32,32 @@
+@@ -32,28 +32,46 @@
  #ifndef _LAYOUT_HXX
  #define _LAYOUT_HXX
  
@@ -256,24 +268,39 @@
  
 -#include <toolkit/dllapi.h>
 -
++class Button;
++class ComboBox;
  class Control;
++class Dialog;
  class Image;
 -class SfxPoolItem;
+-class SfxItemSet;
 +class ListBox;
++class MapMode;
 +class MultiListBox;
++class NotifyEvent;
 +class Pointer;
++class PushButton;
 +class RadioButton;
- class SfxItemSet;
-+class SfxPoolItem;
++class ResId;
++class SfxChildWinInfo;
++class TabControl;
 +class TabPage;
 +class VCLXRadioButton;
  class VCLXWindow;
  class Window;
 -class TabPage;
++
++namespace layoutimpl
++{
++class VCLXTabControl;
++}
++
++class VCLXTabControl;
  
  namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } }
  
-@@ -70,7 +74,7 @@ class TOOLKIT_DLLPUBLIC Context
+@@ -70,7 +88,7 @@ class TOOLKIT_DLLPUBLIC Context
  public:
      Context( char const* pPath );
      virtual ~Context();
@@ -282,13 +309,15 @@
      void setToplevel( PeerHandle xToplevel );
      PeerHandle getToplevel();
      PeerHandle getRoot();
-@@ -83,11 +87,17 @@ public:
+@@ -83,46 +101,88 @@ public:
              par( pImpl ) {} \
          char const* GetUnoName() const; \
      public: \
 -        t( Context *pCtx, char const* pId, sal_uInt32 nId = 0 ); \
-+        t( Context *pCtx, char const* id, sal_uInt32 nId = 0 ); \
-         t( Window *pParent, WinBits nStyle = defaultWinBit )
+-        t( Window *pParent, WinBits nStyle = defaultWinBit )
++        t( Context *context, char const* id, sal_uInt32 nId = 0 ); \
++        t( Window *parent, WinBits nStyle = defaultWinBit ); \
++        t (Window *parent, ResId const &res)
  #define DECL_GET_IMPL(t) \
          inline t##Impl &getImpl() const
  
@@ -298,10 +327,25 @@
 +#define DECL_GET_VCLXWINDOW( cls ) ::VCLX##cls* GetVCLX##cls() const
 +#define IMPL_GET_VCLXWINDOW( cls ) ::VCLX##cls* cls::Get##VCLX##cls() const { return reinterpret_cast< ::VCLX##cls*>( GetVCLXWindow() ); }
 +
++#define DECL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* GetVCLX##cls() const
++#define IMPL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* cls::Get##VCLX##cls() const { return reinterpret_cast< ::layoutimpl::VCLX##cls*>( GetVCLXWindow() ); }
++
  // follows the VCL inheritance hierarchy ...
  
  class WindowImpl;
-@@ -102,27 +112,35 @@ public:
+ class TOOLKIT_DLLPUBLIC Window
+ {
+ protected:
++    friend class WindowImpl;
+     WindowImpl *mpImpl;
+-    static PeerHandle CreatePeer( Window *pParent, WinBits nStyle,
++    static PeerHandle CreatePeer( Window *parent, WinBits nStyle,
+                                   char const* pName);
++
++    virtual void setRes (ResId const& res);
++
+ public:
+     DECL_GET_IMPL( Window );
      explicit Window( WindowImpl *pImpl );
      virtual ~Window();
  
@@ -318,8 +362,11 @@
      void GrabFocus();
      void FreeResource() {}
  
-     void SetParent( Window *pParent );
-     void SetParent( ::Window *pParent );
+-    void SetParent( Window *pParent );
+-    void SetParent( ::Window *pParent );
++    void SetParent( ::Window *parent );
++    virtual void ParentSet (Window *window);
++    void SetParent( Window *parent );
  
 -    css::uno::Reference<css::awt::XWindow> GetRef();
 -    VCLXWindow* GetVCLXWindow();
@@ -343,13 +390,69 @@
 +    sal_uIntPtr GetHelpId() const;
 +    void SetSmartHelpId( SmartId const&, SmartIdUpdateMode mode=SMART_SET_SMART );
 +    SmartId GetSmartHelpId() const;
++    void EnterWait ();
++    void LeaveWait ();
++    bool IsWait () const;
++    //void Enable (bool enable=true, bool child=true);
++    //void Disable (bool child=true);
++    bool IsEnabled () const;
++    void EnableInput (bool enable=true, bool child=true);
++    bool IsInputEnabled () const;
++
++    bool IsVisible () const;
++    bool HasChildPathFocus (bool systemWindow=false) const;
++    void SetPosPixel (Point const&);
++    Point GetPosPixel () const;
++    void SetSizePixel (Size const&);
++    Size GetSizePixel () const;
++    sal_Int32 GetCtrlTextWidth (String const& str) const;
++    sal_Int32 GetTextHeight () const;
++
++    Size LogicToPixel( Size const& size, MapMode const& mapMode=(MapMode const&)*(MapMode*)0 ) const;
  };
  
  class ControlImpl;
-@@ -184,8 +202,9 @@ class TOOLKIT_DLLPUBLIC Button : public Control
+@@ -130,8 +190,13 @@ class TOOLKIT_DLLPUBLIC Control : public Window
+ {
+     DECL_GET_IMPL( Control );
+     DECL_CONSTRUCTORS( Control, Window, 0 );
++
+ public:
+-// void SetText( String const& rStr ); - can't do this here ...
++    ~Control ();
++    void SetGetFocusHdl (Link const& link);
++    Link& GetGetFocusHdl ();
++    void SetLoseFocusHdl (Link const& link);
++    Link& GetLoseFocusHdl ();
+ };
+ 
+ class FixedLineImpl;
+@@ -139,6 +204,7 @@ class TOOLKIT_DLLPUBLIC FixedLine : public Control
+ {
+     DECL_GET_IMPL( FixedLine );
+     DECL_CONSTRUCTORS( FixedLine, Control, WB_HORZ );
++
+ public:
+     bool IsEnabled();
+ };
+@@ -148,7 +214,9 @@ class TOOLKIT_DLLPUBLIC FixedText : public Control
+ {
+     DECL_GET_IMPL( FixedText );
+     DECL_CONSTRUCTORS( FixedText, Control, 0 );
++
+ public:
++    ~FixedText ();
+     void SetText( String const& rStr );
+ };
+ 
+@@ -183,13 +251,18 @@ class TOOLKIT_DLLPUBLIC Button : public Control
+ {
      DECL_GET_IMPL( Button );
      DECL_CONSTRUCTORS( Button, Control, 0 );
++    DECL_GET_WINDOW (Button);
++
  public:
++    ~Button ();
 +    static String GetStandardText (sal_uInt16 button_type);
      void SetText( String const& rStr );
 -    BOOL SetModeImage( const Image& rImage );
@@ -357,18 +460,52 @@
      void SetImageAlign( ImageAlign eAlign );
  
      void SetClickHdl( Link const& rLink );
-@@ -198,8 +217,8 @@ class TOOLKIT_DLLPUBLIC PushButton : public Button
+     virtual void Click() /* pure virtual? */;
++    Link& GetClickHdl ();
+ };
+ 
+ class PushButtonImpl;
+@@ -197,9 +270,12 @@ class TOOLKIT_DLLPUBLIC PushButton : public Button
+ {
      DECL_GET_IMPL( PushButton );
      DECL_CONSTRUCTORS( PushButton, Button, 0 );
++    DECL_GET_WINDOW (PushButton);
++
  public:
 -    void Check( BOOL bCheck = TRUE );
 -    BOOL IsChecked() const;
-+    void Check( bool bCheck = true );
++    ~PushButton ();
++    void Check( bool bCheck=true );
 +    bool IsChecked() const;
  
      void Toggle();
      void SetToggleHdl( Link const& rLink );
-@@ -268,9 +287,11 @@ class TOOLKIT_DLLPUBLIC RadioButton : public Button
+@@ -252,6 +328,12 @@ class TOOLKIT_DLLPUBLIC AdvancedButton : public PushButton
+     void AddSimple( Window* w );
+     void RemoveAdvanced( Window* w );
+     void RemoveSimple( Window* w );
++
++    void SetAdvancedText (rtl::OUString const& text);
++    void SetSimpleText (rtl::OUString const& text);
++    rtl::OUString GetAdvancedText () const;
++    rtl::OUString GetSimpleText () const;
++    void SetDelta (int);
+ };
+ 
+ class MoreButtonImpl;
+@@ -261,6 +343,11 @@ class TOOLKIT_DLLPUBLIC MoreButton : public AdvancedButton
+     DECL_GET_IMPL( MoreButton );
+     void AddWindow( Window* w );
+     void RemoveWindow( Window* w );
++
++    void SetMoreText (rtl::OUString const& text);
++    void SetLessText (rtl::OUString const& text);
++    rtl::OUString GetMoreText () const;
++    rtl::OUString GetLessText () const;
+ };
+ 
+ class RadioButtonImpl;
+@@ -268,9 +355,12 @@ class TOOLKIT_DLLPUBLIC RadioButton : public Button
  {
      DECL_GET_IMPL( RadioButton );
      DECL_CONSTRUCTORS( RadioButton, Button, 0 );
@@ -377,49 +514,78 @@
  public:
 -    void Check( BOOL bCheck = TRUE );
 -    BOOL IsChecked() const;
-+    void Check( bool bCheck = true );
++    ~RadioButton ();
++    void Check( bool bCheck=true );
 +    bool IsChecked() const;
  
      void Toggle();
      void SetToggleHdl( Link const& rLink );
-@@ -282,8 +303,8 @@ class TOOLKIT_DLLPUBLIC CheckBox : public Button
+@@ -281,9 +371,11 @@ class TOOLKIT_DLLPUBLIC CheckBox : public Button
+ {
      DECL_GET_IMPL( CheckBox );
      DECL_CONSTRUCTORS( CheckBox, Button, 0 );
++
  public:
 -    void Check( BOOL bCheck = TRUE );
 -    BOOL IsChecked() const;
-+    void Check( bool bCheck = true );
++    ~CheckBox ();
++    void Check( bool bCheck=true );
 +    bool IsChecked() const;
  
      void Toggle();
      void SetToggleHdl( Link const& rLink );
-@@ -295,8 +316,8 @@ class TOOLKIT_DLLPUBLIC Edit : public Control
+@@ -294,9 +386,11 @@ class TOOLKIT_DLLPUBLIC Edit : public Control
+ {
      DECL_GET_IMPL( Edit );
      DECL_CONSTRUCTORS( Edit, Control, WB_BORDER );
++
  public:
 -    void SetText( XubString const& rStr ) const;
 -    XubString GetText() const;
++    ~Edit ();
 +    void SetText( String const& rStr ) const;
 +    String GetText() const;
      void SetModifyHdl( Link const& rLink );
      void SetSelection( Selection const& rSelection );
  };
-@@ -346,7 +367,7 @@ class TOOLKIT_DLLPUBLIC NumericField : public SpinField, public NumericFormatter
+@@ -346,8 +440,8 @@ class TOOLKIT_DLLPUBLIC NumericField : public SpinField, public NumericFormatter
  {
      DECL_GET_IMPL( NumericField );
  public:
 -    NumericField( Context *pCtx, char const* pId, sal_uInt32 nId = 0 );
-+    NumericField( Context *pCtx, char const* id, sal_uInt32 nId = 0 );
-     NumericField( Window *pParent, WinBits nStyle );
+-    NumericField( Window *pParent, WinBits nStyle );
++    NumericField( Context *context, char const* id, sal_uInt32 nId=0 );
++    NumericField( Window *parent, WinBits nStyle );
  };
  
-@@ -373,12 +394,10 @@ class TOOLKIT_DLLPUBLIC MetricField : public SpinField, public MetricFormatter
+ class MetricFormatterImpl;
+@@ -358,12 +452,12 @@ class TOOLKIT_DLLPUBLIC MetricFormatter : public FormatterBase
+     explicit MetricFormatter( FormatterBaseImpl *pImpl );
+     MetricFormatterImpl &getFormatImpl() const;
+ public:
+-    void SetMin( sal_Int64 nNewMin, FieldUnit nUnit = FUNIT_NONE );
+-    void SetMax( sal_Int64 nNewMax, FieldUnit nUnit = FUNIT_NONE );
+-    void SetFirst( sal_Int64 nNewFirst, FieldUnit nUnit = FUNIT_NONE );
+-    void SetLast( sal_Int64 nNewLast, FieldUnit nUnit = FUNIT_NONE );
+-    void SetValue( sal_Int64 nNewValue, FieldUnit nUnit = FUNIT_NONE );
+-    sal_Int64 GetValue( FieldUnit nUnit = FUNIT_NONE ) const;
++    void SetMin( sal_Int64 nNewMin, FieldUnit nUnit=FUNIT_NONE );
++    void SetMax( sal_Int64 nNewMax, FieldUnit nUnit=FUNIT_NONE );
++    void SetFirst( sal_Int64 nNewFirst, FieldUnit nUnit=FUNIT_NONE );
++    void SetLast( sal_Int64 nNewLast, FieldUnit nUnit=FUNIT_NONE );
++    void SetValue( sal_Int64 nNewValue, FieldUnit nUnit=FUNIT_NONE );
++    sal_Int64 GetValue( FieldUnit nUnit=FUNIT_NONE ) const;
+ 
+     void SetSpinSize( sal_Int64 nNewSize );
+ };
+@@ -373,124 +467,209 @@ class TOOLKIT_DLLPUBLIC MetricField : public SpinField, public MetricFormatter
  {
      DECL_GET_IMPL( MetricField );
  public:
 -    MetricField( Context *pCtx, char const* pId, sal_uInt32 nId = 0 );
-+    MetricField( Context *pCtx, char const* id, sal_uInt32 nId = 0 );
-     MetricField( Window *pParent, WinBits nStyle );
+-    MetricField( Window *pParent, WinBits nStyle );
++    MetricField( Context *context, char const* id, sal_uInt32 nId=0 );
++    MetricField( Window *parent, WinBits nStyle );
  };
  
 -#define COMBOBOX_APPEND            ((USHORT)0xFFFF)
@@ -427,11 +593,13 @@
  class ComboBoxImpl;
  class TOOLKIT_DLLPUBLIC ComboBox : public Edit
  {
-@@ -386,59 +405,66 @@ class TOOLKIT_DLLPUBLIC ComboBox : public Edit
+     DECL_GET_IMPL( ComboBox );
++    DECL_GET_WINDOW (ComboBox );
      DECL_CONSTRUCTORS( ComboBox, Edit, 0 );
  
  public:
 -    USHORT InsertEntry( XubString const& rStr, USHORT nPos = COMBOBOX_APPEND );
++    ~ComboBox ();
 +    sal_uInt16 InsertEntry( XubString const& rStr, sal_uInt16 nPos=COMBOBOX_APPEND );
      void RemoveEntry( XubString const& rStr );
 -    void RemoveEntry( USHORT nPos );
@@ -447,6 +615,7 @@
  
      void SetClickHdl( Link const& rLink );
      void SetSelectHdl( Link const& rLink );
++    void EnableAutocomplete (bool enable, bool matchCase=false );
  };
  
 -#define LISTBOX_APPEND               ((USHORT)0xFFFF)
@@ -457,9 +626,11 @@
      DECL_GET_IMPL( ListBox );
      DECL_CONSTRUCTORS( ListBox, Control, WB_BORDER );
 +    DECL_GET_WINDOW (ListBox);
++
  public:
 -    USHORT InsertEntry( XubString const& rStr, USHORT nPos = LISTBOX_APPEND );
-+    sal_uInt16 InsertEntry( XubString const& rStr, sal_uInt16 nPos = LISTBOX_APPEND );
++    ~ListBox ();
++    sal_uInt16 InsertEntry( XubString const& rStr, sal_uInt16 nPos=LISTBOX_APPEND );
  
      void RemoveEntry( XubString const& rStr );
 -    void RemoveEntry( USHORT nPos );
@@ -475,15 +646,15 @@
  
 -    void SelectEntry( XubString const& rStr, BOOL bSelect = TRUE );
 -    void SelectEntryPos( USHORT nPos, BOOL bSelect = TRUE );
-+    void SelectEntry( XubString const& rStr, bool bSelect = true );
-+    void SelectEntryPos( sal_uInt16 nPos, bool bSelect = true );
++    void SelectEntry( XubString const& rStr, bool bSelect=true );
++    void SelectEntryPos( sal_uInt16 nPos, bool bSelect=true );
  
 -    USHORT GetSelectEntryCount() const;
 -    XubString GetSelectEntry( USHORT nSelIndex = 0 ) const;
 -    USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const;
 +    sal_uInt16 GetSelectEntryCount() const;
-+    XubString GetSelectEntry( sal_uInt16 nSelIndex = 0 ) const;
-+    sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const;
++    XubString GetSelectEntry( sal_uInt16 nSelIndex=0 ) const;
++    sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex=0 ) const;
  
      void SetSelectHdl( Link const& rLink );
      void SetClickHdl( Link const& rLink );
@@ -520,19 +691,30 @@
  };
  
  class DialogImpl;
-@@ -446,15 +472,72 @@ class TOOLKIT_DLLPUBLIC Dialog : public Context, public Window
+ class TOOLKIT_DLLPUBLIC Dialog : public Context, public Window
  {
-     DECL_GET_IMPL( Dialog );
+-    DECL_GET_IMPL( Dialog );
++    DECL_GET_WINDOW (Dialog);
++
  public:
 -    Dialog( Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0 );
 -    Dialog( ::Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0 );
-+    Dialog( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId = 0 );
-+    Dialog( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId = 0 );
-     short Execute();
-     void EndDialog( long nResult = 0 );
+-    short Execute();
+-    void EndDialog( long nResult = 0 );
++    DECL_GET_IMPL (Dialog);
++    Dialog( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
++    Dialog( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
++    ~Dialog ();
++    virtual short Execute();
++    void EndDialog( long nResult=0 );
      void SetText( String const& rStr );
--};
 +    void SetTitle (String const& rStr );
++    bool Close ();
++    long Notify (NotifyEvent & event);
++
++    // Sxf*Dialog
++    bool bConstruct;
++	void Initialize (SfxChildWinInfo*) {};
 +};
 +
 +#define DECL_MESSAGE_BOX_CTORS(Name)\
@@ -592,122 +774,182 @@
 +CLASS_MESSAGE_BOX (Warning);
 +
 +#undef CLASS_MESSAGE_BOX
++
++#ifndef TAB_APPEND
++#define TAB_APPEND -1
++#endif /* !TAB_APPEND */
++
++class TabControlImpl;
++class TOOLKIT_DLLPUBLIC TabControl : public Control
++{
++    DECL_GET_IMPL (TabControl);
++    DECL_CONSTRUCTORS (TabControl, Control, 0);
++    DECL_GET_WINDOW (TabControl);
++    DECL_GET_LAYOUT_VCLXWINDOW (TabControl);
++
++public:
++    ~TabControl ();
++    void InsertPage (sal_uInt16 id, String const& title, sal_uInt16 pos=TAB_APPEND);
++    void RemovePage (sal_uInt16 id);
++    sal_uInt16 GetPageCount () const;
++    sal_uInt16 GetPageId (sal_uInt16 pos) const;
++    sal_uInt16 GetPagePos (sal_uInt16 id) const;
++    void SetCurPageId (sal_uInt16 id);
++    sal_uInt16 GetCurPageId () const;
++    void SetTabPage (sal_uInt16 id, ::TabPage* page);
++    ::TabPage* GetTabPage (sal_uInt16 id) const;
++    void SetActivatePageHdl (Link const& link);
++    Link& GetActivatePageHdl () const;
++    void SetDeactivatePageHdl (Link const& link);
++    Link& GetDeactivatePageHdl () const;
++    void SetTabPageSizePixel (Size const& size);
++    Size GetTabPageSizePixel () const;
+ };
  
 -#define DECL_GET_WINDOW( cls ) ::cls* Get##cls()
 -#define IMPL_GET_WINDOW( cls ) ::cls* cls::Get##cls() { return reinterpret_cast< ::cls*>( GetWindow() ); }
  class TabPageImpl;
  class TOOLKIT_DLLPUBLIC TabPage : public Context, public Window
  {
-@@ -462,11 +545,10 @@ class TOOLKIT_DLLPUBLIC TabPage : public Context, public Window
+     DECL_GET_IMPL( TabPage );
  public:
      static ::Window* global_parent;
++    static TabControl* global_tabcontrol;
      
 -    TabPage( Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
 -    TabPage( ::Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
-+    TabPage( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
-+    TabPage( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
++    TabPage( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
++    TabPage( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
      ~TabPage();
 -    //DECL_GET_WINDOW( TabPage );
 -    ::TabPage* GetTabPage();
 +    DECL_GET_WINDOW( TabPage );
      virtual void ActivatePage();
      virtual void DeactivatePage();
- #if 0
-@@ -476,8 +558,8 @@ public:
- class TOOLKIT_DLLPUBLIC SfxTabPage : public TabPage
- {
- public:
+-#if 0
+-};
+-
+-//FIXME: move to sfx2 or svtools layout.hxx
+-class TOOLKIT_DLLPUBLIC SfxTabPage : public TabPage
+-{
+-public:
 -    SfxTabPage( Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
 -    SfxTabPage( ::Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
-+    SfxTabPage( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
-+    SfxTabPage( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
- #endif
-     // SfxTabPage...
-     enum PageAction { KEEP_PAGE, LEAVE_PAGE, REFRESH_SET };
-@@ -488,7 +570,7 @@ public:
-     SfxItemSet const& GetItemSet() const { return *pSet; }
-     virtual void Reset( SfxItemSet const& r );
-     void SetExchangeSupport( bool exchangeSupport = true ) { bHasExchangeSupport = exchangeSupport; }
+-#endif
+-    // SfxTabPage...
+-    enum PageAction { KEEP_PAGE, LEAVE_PAGE, REFRESH_SET };
+-
+-    bool bHasExchangeSupport;
+-    bool HasExchangeSupport() { return bHasExchangeSupport; }
+-    SfxItemSet const* pSet;
+-    SfxItemSet const& GetItemSet() const { return *pSet; }
+-    virtual void Reset( SfxItemSet const& r );
+-    void SetExchangeSupport( bool exchangeSupport = true ) { bHasExchangeSupport = exchangeSupport; }
 -    //static const SfxPoolItem* GetItem( const SfxItemSet& rSet, USHORT nSlot );
-+    //static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot );
- 	virtual void ActivatePage( SfxItemSet const& ) { }
- 	virtual int DeactivatePage( SfxItemSet* ) { return LEAVE_PAGE; }
+-	virtual void ActivatePage( SfxItemSet const& ) { }
+-	virtual int DeactivatePage( SfxItemSet* ) { return LEAVE_PAGE; }
  };
-@@ -516,7 +598,7 @@ protected:
+ 
+ class ProgressBarImpl;
+@@ -516,7 +695,7 @@ protected:
      css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
      Container( rtl::OUString const& rName, sal_Int32 nBorder );
  public:
 -    Container( Context const* pCtx, char const* pId );
-+    Container( Context const* pCtx, char const* id );
++    Container( Context const* context, char const* id );
  
      void Add( Window *pWindow );
      void Add( Container *pContainer );
-@@ -540,7 +622,7 @@ class TOOLKIT_DLLPUBLIC Table : public Container
+@@ -540,11 +719,11 @@ class TOOLKIT_DLLPUBLIC Table : public Container
  protected:
      Table( sal_Int32 nBorder, sal_Int32 nColumns );
  public:
 -    Table( Context const* pCtx, char const* pId );
-+    Table( Context const* pCtx, char const* id );
++    Table( Context const* context, char const* id );
      void Add( Window *pWindow, bool bXExpand, bool bYExpand,
-               sal_Int32 nXSpan = 1, sal_Int32 nYSpan = 1 );
+-              sal_Int32 nXSpan = 1, sal_Int32 nYSpan = 1 );
++              sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 );
      void Add( Container *pContainer, bool bXExpand, bool bYExpand,
-@@ -556,7 +638,7 @@ class TOOLKIT_DLLPUBLIC Box : public Container
+-              sal_Int32 nXSpan = 1, sal_Int32 nYSpan = 1 );
++              sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 );
+ 
+ private:
+     void setProps( css::uno::Reference< css::awt::XLayoutConstrains > xChild,
+@@ -556,7 +735,7 @@ class TOOLKIT_DLLPUBLIC Box : public Container
  protected:
      Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous );
  public:
 -    Box( Context const* pCtx, char const* pId );
-+    Box( Context const* pCtx, char const* id );
++    Box( Context const* context, char const* id );
      void Add( Window *pWindow, bool bExpand, bool bFill, sal_Int32 nPadding);
      void Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding);
  
-@@ -568,13 +650,13 @@ private:
+@@ -568,13 +747,13 @@ private:
  class TOOLKIT_DLLPUBLIC HBox : public Box
  {
  public:
 -    HBox( Context const* pCtx, char const* pId );
-+    HBox( Context const* pCtx, char const* id );
++    HBox( Context const* context, char const* id );
      HBox( sal_Int32 nBorder, bool bHomogeneous );
  };
  class TOOLKIT_DLLPUBLIC VBox : public Box
  {
  public:
 -    VBox( Context const* pCtx, char const* pId );
-+    VBox( Context const* pCtx, char const* id );
++    VBox( Context const* context, char const* id );
      VBox( sal_Int32 nBorder, bool bHomogeneous );
  };
  
-@@ -585,7 +667,7 @@ class TOOLKIT_DLLPUBLIC Plugin : public Control
+@@ -585,7 +764,7 @@ class TOOLKIT_DLLPUBLIC Plugin : public Control
      //DECL_CONSTRUCTORS( Plugin, Control, 0 );
  public:
      ::Control *mpPlugin;
 -    Plugin( Context *pCtx, char const* pId, ::Control *plugin );
-+    Plugin( Context *pCtx, char const* id, ::Control *plugin );
++    Plugin( Context *context, char const* id, ::Control *plugin );
  };
  
  class LocalizedStringImpl;
-@@ -593,7 +675,7 @@ class TOOLKIT_DLLPUBLIC LocalizedString : public Window
+@@ -593,13 +772,36 @@ class TOOLKIT_DLLPUBLIC LocalizedString : public Window
  {
      DECL_GET_IMPL( LocalizedString );
  public:
 -    LocalizedString( Context *pCtx, char const* pId );
-+    LocalizedString( Context *pCtx, char const* id );
++    LocalizedString( Context *context, char const* id );
  
      String operator =( String const& );
      operator String();
-@@ -602,4 +684,10 @@ public:
+ //    operator String const&() const;
+ };
  
++class InPlugImpl;
++class TOOLKIT_DLLPUBLIC InPlug : public Context, public Window
++{
++    DECL_GET_IMPL (InPlug);
++
++public:
++    InPlug ( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0);
++    InPlug ( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0);
++
++    void ParentSet (Window *window);
++};
++
  } // end namespace layout
  
 +#if ENABLE_LAYOUT
 +#define LAYOUT_NS layout::
++#define LAYOUT_DIALOG_PARENT\
++    VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ) )->GetWindow()
++#define LAYOUT_THIS_WINDOW( this ) this->GetWindow ()
 +#else /* !ENABLE_LAYOUT */
 +#define LAYOUT_NS
-+#endif
++#define LAYOUT_DIALOG_PARENT this
++#define LAYOUT_THIS_WINDOW( this ) this
++#endif /* !ENABLE_LAYOUT */
 +
  #endif /* _LAYOUT_HXX */
 diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
 index 4c250ba..41176fc 100644
---- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+--- toolkit/inc/toolkit/awt/vclxwindows.hxx
 +++ toolkit/inc/toolkit/awt/vclxwindows.hxx
 @@ -346,6 +346,8 @@ public:
  
@@ -720,7 +962,7 @@
  //	----------------------------------------------------
 diff --git a/toolkit/prj/build.lst b/toolkit/prj/build.lst
 index 8b7ac22..1448f0d 100644
---- a/toolkit/prj/build.lst
+--- toolkit/prj/build.lst
 +++ toolkit/prj/build.lst
 @@ -2,6 +2,7 @@ ti	toolkit	:	vcl NULL
  ti	toolkit									usr1	-	all	ti_mkout NULL
@@ -732,7 +974,7 @@
  ti	toolkit\source\controls					nmake	-	all	ti_controls  ti_inc NULL
 diff --git a/toolkit/prj/d.lst b/toolkit/prj/d.lst
 index 88ee9c8..743e2d6 100644
---- a/toolkit/prj/d.lst
+--- toolkit/prj/d.lst
 +++ toolkit/prj/d.lst
 @@ -52,3 +52,5 @@ mkdir: %_DEST%\inc%_EXT%\layout
  ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
@@ -740,10 +982,35 @@
  ..\inc\layout\*.hxx %_DEST%\inc%_EXT%\layout\*.hxx
 +
 +..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.*
+diff --git a/toolkit/source/awt/forward.hxx b/toolkit/source/awt/forward.hxx
+index c3f5f24..7dc9278 100644
+--- toolkit/source/awt/forward.hxx
++++ toolkit/source/awt/forward.hxx
+@@ -67,4 +67,11 @@
+         return aReturn; \
+     }
+ 
++#if defined (_MSC_VER) && (_MSC_VER <= 1310)
++// Windows .Net2003 build fix
++#define W3K_EXPLICIT_CAST(x) static_cast <XWindow2*> (&x)
++#else // !(defined (_MSC_VER) && (_MSC_VER <= 1310))
++#define W3K_EXPLICIT_CAST(x) x
++#endif // !(defined (_MSC_VER) && (_MSC_VER <= 1310))
++
+ #endif /*AWT_FORWARD_HXX*/
 diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx
-index 98de970..02d02fc 100644
---- a/toolkit/source/awt/vclxdialog.cxx
+index 98de970..76e3993 100644
+--- toolkit/source/awt/vclxdialog.cxx
 +++ toolkit/source/awt/vclxdialog.cxx
+@@ -109,7 +109,7 @@ void SAL_CALL VCLXDialog::dispose() throw(::com::sun::star::uno::RuntimeExceptio
+         ::vos::OGuard aGuard( GetMutex() );
+ 
+         ::com::sun::star::lang::EventObject aDisposeEvent;
+-        aDisposeEvent.Source = *this;
++        aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+ //            maTabListeners.disposeAndClear( aDisposeEvent );
+     }
+ 
 @@ -211,6 +211,15 @@ void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star
          pWindow->SetText( Title );
  }
@@ -762,7 +1029,7 @@
      ::vos::OGuard aGuard( GetMutex() );
 diff --git a/toolkit/source/awt/vclxdialog.hxx b/toolkit/source/awt/vclxdialog.hxx
 index 7f45718..337d780 100644
---- a/toolkit/source/awt/vclxdialog.hxx
+--- toolkit/source/awt/vclxdialog.hxx
 +++ toolkit/source/awt/vclxdialog.hxx
 @@ -102,6 +102,7 @@ public:
  
@@ -772,138 +1039,921 @@
  
  };
  
-diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
-index ec4c268..e9ae5d8 100644
---- a/toolkit/source/awt/vclxwindows.cxx
-+++ toolkit/source/awt/vclxwindows.cxx
-@@ -1336,6 +1336,13 @@ void VCLXRadioButton::ImplClickedOrToggled( BOOL bToggled )
- 	}
- }
+diff --git a/toolkit/source/awt/vclxfixedline.cxx b/toolkit/source/awt/vclxfixedline.cxx
+index 10c631d..68385ed 100644
+--- toolkit/source/awt/vclxfixedline.cxx
++++ toolkit/source/awt/vclxfixedline.cxx
+@@ -69,7 +69,7 @@ void SAL_CALL VCLXFixedLine::dispose( ) throw(RuntimeException)
+         ::vos::OGuard aGuard( GetMutex() );
+ 
+         EventObject aDisposeEvent;
+-        aDisposeEvent.Source = *this;
++        aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+     }
  
-+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > VCLXRadioButton::getFirstActionListener ()
+     VCLXWindow::dispose();
+diff --git a/toolkit/source/awt/vclxplugin.cxx b/toolkit/source/awt/vclxplugin.cxx
+index f17552a..8145174 100644
+--- toolkit/source/awt/vclxplugin.cxx
++++ toolkit/source/awt/vclxplugin.cxx
+@@ -40,6 +40,8 @@
+ #include <toolkit/helper/property.hxx>
+ #include <vcl/ctrl.hxx>
+ 
++#include "forward.hxx"
++
+ namespace layoutimpl
+ {
+ 
+@@ -63,7 +65,7 @@ void SAL_CALL VCLXPlugin::dispose() throw(uno::RuntimeException)
+         ::vos::OGuard aGuard( GetMutex() );
+         
+         lang::EventObject aDisposeEvent;
+-        aDisposeEvent.Source = *this;
++        aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+     }
+     
+     VCLXWindow::dispose();
+diff --git a/toolkit/source/awt/vclxscroller.cxx b/toolkit/source/awt/vclxscroller.cxx
+index 9e5674e..b532161 100644
+--- toolkit/source/awt/vclxscroller.cxx
++++ toolkit/source/awt/vclxscroller.cxx
+@@ -75,7 +75,7 @@ void SAL_CALL VCLXScroller::dispose( ) throw(RuntimeException)
+         ::vos::OGuard aGuard( GetMutex() );
+ 
+         EventObject aDisposeEvent;
+-        aDisposeEvent.Source = *this;
++        aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+ //            maTabListeners.disposeAndClear( aDisposeEvent );
+     }
+ 
+diff --git a/toolkit/source/awt/vclxsplitter.cxx b/toolkit/source/awt/vclxsplitter.cxx
+index f2efbb3..5530e46 100644
+--- toolkit/source/awt/vclxsplitter.cxx
++++ toolkit/source/awt/vclxsplitter.cxx
+@@ -113,7 +113,7 @@ void SAL_CALL VCLXSplitter::dispose( ) throw(RuntimeException)
+         ::vos::OGuard aGuard( GetMutex() );
+ 
+         EventObject aDisposeEvent;
+-        aDisposeEvent.Source = *this;
++        aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+ //            maTabListeners.disposeAndClear( aDisposeEvent );
+     }
+ 
+diff --git a/toolkit/source/awt/vclxtabcontrol.cxx b/toolkit/source/awt/vclxtabcontrol.cxx
+index 9ef31ca..782b3a8 100644
+--- toolkit/source/awt/vclxtabcontrol.cxx
++++ toolkit/source/awt/vclxtabcontrol.cxx
+@@ -43,16 +43,14 @@
+ namespace layoutimpl
+ {
+ 
+-using namespace ::com::sun::star::uno;
+-using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star;
+ 
+ VCLXTabControl::ChildProps::ChildProps( VCLXTabControl::ChildData *pData )
+-    {
+-        addProp( RTL_CONSTASCII_USTRINGPARAM( "Title" ),
+-                 ::getCppuType( static_cast< const rtl::OUString* >( NULL ) ),
 +{
-+    if (!maItemListeners.getLength ())
-+        return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ();
-+    return maActionListeners.getElements()[0];
++    addProp( RTL_CONSTASCII_USTRINGPARAM( "Title" ),
++             ::getCppuType( static_cast< const rtl::OUString* >( NULL ) ),
+              &(pData->maTitle) );
+ }
+ 
+@@ -66,7 +64,7 @@ VCLXTabControl::ChildData*
+ VCLXTabControl::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
+ {
+     return new ChildData( xChild );
+-    }
 +}
-+
- //	----------------------------------------------------
- //	class VCLXSpinField
- //	----------------------------------------------------
-diff --git a/toolkit/source/layout/helper.cxx b/toolkit/source/layout/helper.cxx
-index 1e96643..920c6d6 100644
---- a/toolkit/source/layout/helper.cxx
-+++ toolkit/source/layout/helper.cxx
-@@ -378,6 +378,9 @@ PropHelper::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::
- #include <vcl/tabctrl.hxx>
- #include <vcl/tabpage.hxx>
  
-+#include <toolkit/awt/vclxwindows.hxx>
-+#include <vcl/lstbox.hxx>
+ VCLXTabControl::ChildProps*
+ VCLXTabControl::createChildProps( Box_Base::ChildData *pData )
+@@ -76,12 +74,19 @@ VCLXTabControl::createChildProps( Box_Base::ChildData *pData )
+ 
+ DBG_NAME( VCLXTabControl );
+ 
++#if !defined (__GNUC__)
++#define __PRETTY_FUNCTION__ __FUNCTION__
++#endif /* !__GNUC__ */
 +
- #include <typeinfo>
+ VCLXTabControl::VCLXTabControl()
+-: VCLXWindow()
+-    , VCLXTabControl_Base()
++  : VCLXWindow()
++  , VCLXTabControl_Base()
+   , Box_Base()
+-  , mnNextTabId( 1 )
++  , mTabId (1)
++  , bRealized (false)
+ {
++    OSL_TRACE ("\n********%s:%x", __PRETTY_FUNCTION__, this);
++
+     DBG_CTOR( VCLXTabControl, NULL );
+ }
  
- namespace layoutimpl
-@@ -530,13 +533,23 @@ uno::Reference< awt::XLayoutConstrains > ImplCreateWindow(
-         pNewWindow = new Window( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
-         pNewComp = new layoutimpl::LocalizedString();
-     }
-+#if 0 // parent paranoia
-+    else if ( aName.equalsAscii( "listbox" ) )
-+    {
-+        WindowAttributes |= awt::VclWindowPeerAttribute::DROPDOWN;
-+        WinBits nStyle = ImplGetWinBits( WindowAttributes, 0 );
-+        nStyle |= WB_DROPDOWN;
-+        pNewWindow = new ListBox( pParent, nStyle );
-+        pNewComp = new VCLXListBox ();
-+    }
-+#endif
+@@ -94,13 +99,13 @@ IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXTabControl, VCLXWindow, Container, VCLXTabC
  
-     if ( !pNewWindow )
-         return xRef;
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXTabControl, VCLXWindow, VCLXTabControl_Base );
  
-     pNewWindow->SetCreatedWithToolkit( sal_True );
-     if ( pNewComp )
--        pNewComp->SetCreatedWithToolkit( TRUE );
-+        pNewComp->SetCreatedWithToolkit( true );
-     xRef = pNewComp;
-     pNewWindow->SetComponentInterface( pNewComp );
-     if ( WindowAttributes & awt::WindowAttribute::SHOW )
-diff --git a/toolkit/source/layout/import.cxx b/toolkit/source/layout/import.cxx
-index 47857e6..60cf33b 100644
---- a/toolkit/source/layout/import.cxx
-+++ toolkit/source/layout/import.cxx
-@@ -99,7 +99,16 @@ SAL_THROW (())
-     {
-         OUString aTitle;
-         if ( findAndRemove( "title", aProps, aTitle ) )
-+        {
-+            OSL_TRACE("Setting title: %s", OUSTRING_CSTR( aTitle ) );
-             xDialog->setTitle( aTitle );
-+        }
-+        OUString aHelpId;
-+        if ( findAndRemove( "help-id", aProps, aHelpId ) )
-+        {
-+            OSL_TRACE("Setting help-id: %s", OUSTRING_CSTR( aHelpId ) );
-+            xDialog->setHelpId( aHelpId.toInt32 () );
-+        }
-     } // DEBUG:
-     else if ( pParent == NULL )
+-void SAL_CALL VCLXTabControl::dispose( ) throw(RuntimeException)
++void SAL_CALL VCLXTabControl::dispose( ) throw(uno::RuntimeException)
+ {
      {
-@@ -122,13 +131,11 @@ SAL_THROW (())
-         if ( DialogButtonHBox *b = dynamic_cast<DialogButtonHBox *> ( mpWidget->getPeer().get() ) )
-             b->setOrdering ( aOrdering );
+         ::vos::OGuard aGuard( GetMutex() );
  
--#ifdef IMPORT_RADIOGROUP
--    bool bSetRadioGroup, bSetTitle;
--    OUString aRadioGroup, aTitle;
-+    bool bSetRadioGroup;
-+    OUString aRadioGroup;
-     bSetRadioGroup = findAndRemove( "radiogroup", aProps, aRadioGroup );
--    bSetTitle = findAndRemove( "title", aProps, aTitle );
+         EventObject aDisposeEvent;
+-        aDisposeEvent.Source = *this;
++        aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+ //            maTabListeners.disposeAndClear( aDisposeEvent );
+     }
  
--    setProperties( mxPeer, aProps );
-+    mpWidget->setProperties( aProps );
+@@ -108,38 +113,38 @@ void SAL_CALL VCLXTabControl::dispose( ) throw(RuntimeException)
+ }
  
-     // we need to add radio buttons to the group after their properties are
-     // set, so we can check if they should be the one selected by default or not.
-@@ -137,17 +144,10 @@ SAL_THROW (())
+ #if 0
+-void SAL_CALL VCLXTabControl::addTabListener( const Reference< XTabListener >& listener ) throw (RuntimeException)
++void SAL_CALL VCLXTabControl::addTabListener( const Reference< XTabListener >& listener ) throw (uno::RuntimeException)
+ {
+ if ( listener.is() )
+ maTabListeners.addInterface( listener );
+ }
+ 
+-void SAL_CALL VCLXTabControl::removeTabListener( const Reference< XTabListener >& listener ) throw (RuntimeException)
++void SAL_CALL VCLXTabControl::removeTabListener( const Reference< XTabListener >& listener ) throw (uno::RuntimeException)
+ {
+ if ( listener.is() )
+ maTabListeners.removeInterface( listener );
+ }
+ #endif
+ 
+-TabControl *VCLXTabControl::getTabControl() const throw (RuntimeException)
++TabControl *VCLXTabControl::getTabControl() const throw (uno::RuntimeException)
+ {
+     TabControl *pTabControl = static_cast< TabControl* >( GetWindow() );
+     if ( pTabControl )
+         return pTabControl;
+-    throw RuntimeException();
++    throw uno::RuntimeException();
+ }
+ 
+-sal_Int32 SAL_CALL VCLXTabControl::insertTab() throw (RuntimeException)
++sal_Int32 SAL_CALL VCLXTabControl::insertTab() throw (uno::RuntimeException)
+ {
+     TabControl *pTabControl = getTabControl();
+-    USHORT id = sal::static_int_cast< USHORT >( mnNextTabId++ );
++    USHORT id = sal::static_int_cast< USHORT >( mTabId++ );
+     rtl::OUString title (RTL_CONSTASCII_USTRINGPARAM( "" ) );
+     pTabControl->InsertPage( id, title.getStr(), TAB_APPEND );
+     pTabControl->SetTabPage( id, new TabPage( pTabControl ) );
+     return id;
+ }
+ 
+-void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (RuntimeException, IndexOutOfBoundsException)
++void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException)
+ {
+     TabControl *pTabControl = getTabControl();
+     if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+@@ -147,7 +152,7 @@ void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (RuntimeException,
+     pTabControl->RemovePage( sal::static_int_cast< USHORT >( ID ) );
+ }
+ 
+-void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (RuntimeException, IndexOutOfBoundsException)
++void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException)
+ {
+     TabControl *pTabControl = getTabControl();
+     if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+@@ -155,15 +160,15 @@ void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (RuntimeExceptio
+     pTabControl->SelectTabPage( sal::static_int_cast< USHORT >( ID ) );
+ }
+ 
+-sal_Int32 SAL_CALL VCLXTabControl::getActiveTabID() throw (RuntimeException)
++sal_Int32 SAL_CALL VCLXTabControl::getActiveTabID() throw (uno::RuntimeException)
+ {
+     return getTabControl()->GetCurPageId( );
+ }
+ 
+-void SAL_CALL VCLXTabControl::addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
++void SAL_CALL VCLXTabControl::addTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
+ {
+-    for ( std::list< ::com::sun::star::uno::Reference
+-              < ::com::sun::star::awt::XTabListener > >::const_iterator it
++    for ( std::list< uno::Reference
++              < awt::XTabListener > >::const_iterator it
+               = mxTabListeners.begin(); it != mxTabListeners.end(); it++ )
      {
-         static int i = 0;
-         i++;
--        uno::Reference< awt::XRadioButton > xRadio( mxPeer, uno::UNO_QUERY );
-+        uno::Reference< awt::XRadioButton > xRadio( mpWidget->getPeer(), uno::UNO_QUERY );
-         if ( xRadio.is() )
-             pImport->mxRadioGroups.addItem( aRadioGroup, xRadio );
+         if ( *it == xListener )
+@@ -173,10 +178,10 @@ void SAL_CALL VCLXTabControl::addTabListener( const ::com::sun::star::uno::Refer
+     mxTabListeners.push_back( xListener );
+ }
+ 
+-void SAL_CALL VCLXTabControl::removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
++void SAL_CALL VCLXTabControl::removeTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
+ {
+-    for ( std::list< ::com::sun::star::uno::Reference
+-              < ::com::sun::star::awt::XTabListener > >::iterator it
++    for ( std::list< uno::Reference
++              < awt::XTabListener > >::iterator it
+               = mxTabListeners.begin(); it != mxTabListeners.end(); it++ )
+     {
+         if ( *it == xListener )
+@@ -187,7 +192,7 @@ void SAL_CALL VCLXTabControl::removeTabListener( const ::com::sun::star::uno::Re
      }
--    if ( bSetTitle )
--    {
--        uno::Reference< awt::XDialog2 > xDialog( mxPeer, uno::UNO_QUERY );
--        if ( xDialog.is() )
--            xDialog->setTitle( aTitle );
--    }
--#endif
  }
  
- WidgetElement::~WidgetElement()
-@@ -181,7 +181,7 @@ WidgetElement::startChildElement ( sal_Int32 nUid, OUString const &name,
- // transex3 hack.
- void SAL_CALL
- WidgetElement::characters( OUString const& rChars )
--    throw (css::xml::sax::SAXException, css::uno::RuntimeException)
-+    throw (xml::sax::SAXException, uno::RuntimeException)
+-void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const Sequence< NamedValue >& Properties ) throw (RuntimeException, IndexOutOfBoundsException)
++void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const uno::Sequence< NamedValue >& Properties ) throw (uno::RuntimeException, IndexOutOfBoundsException)
  {
-     if ( mpWidget && rChars.trim().getLength() )
+     TabControl *pTabControl = getTabControl();
+     if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+@@ -196,7 +201,7 @@ void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const Sequence< NamedVa
+     for( int i = 0; i < Properties.getLength(); i++ )
      {
-@@ -246,4 +246,97 @@ uno::Reference< xml::input::XElement > ImportContext::startRootElement(
-         return new ToplevelElement( rLocalName, xAttributes, this );
+         const rtl::OUString &name = Properties[i].Name;
+-        const Any &value = Properties[i].Value;
++        const uno::Any &value = Properties[i].Value;
+ 
+         if ( name  == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) )
+         {
+@@ -206,8 +211,8 @@ void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const Sequence< NamedVa
+     }
  }
  
-+RadioGroups::RadioGroups()
+-Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID )
+-    throw (IndexOutOfBoundsException, RuntimeException)
++uno::Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID )
++    throw (IndexOutOfBoundsException, uno::RuntimeException)
+ {
+     TabControl *pTabControl = getTabControl();
+     if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+@@ -216,11 +221,11 @@ Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID )
+ #define ADD_PROP( seq, i, name, val ) {                                \
+         NamedValue value;                                                  \
+         value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \
+-        value.Value = makeAny( val );                                      \
++        value.Value = uno::makeAny( val );                                      \
+         seq[i] = value;                                                    \
+     }
+ 
+-    Sequence< NamedValue > props( 2 );
++    uno::Sequence< NamedValue > props( 2 );
+     ADD_PROP( props, 0, "Title", rtl::OUString( pTabControl->GetPageText( sal::static_int_cast< USHORT >( ID ) ) ) );
+     ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< USHORT >( ID ) ) );
+ #undef ADD_PROP
+@@ -228,7 +233,7 @@ Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID )
+ }
+ 
+ // TODO: draw tab border here
+-void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
++void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(uno::RuntimeException)
+ {
+     ::vos::OGuard aGuard( GetMutex() );
+ 
+@@ -249,16 +254,25 @@ void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::su
+     VCLXWindow::draw( nX, nY );
+ }
+ 
++void VCLXTabControl::AddChild (uno::Reference< awt::XLayoutConstrains > const& xChild)
++
 +{
++    OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ());
++    mIdMap[ xChild ] = mTabId++;
++    Box_Base::AddChild( xChild );
++    OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ());
 +}
 +
-+void RadioGroups::addItem( rtl::OUString id, uno::Reference< awt::XRadioButton > xRadio )
+ void SAL_CALL VCLXTabControl::addChild(
+-    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > &xChild )
+-    throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException)
++    const uno::Reference< awt::XLayoutConstrains > &xChild )
++    throw (uno::RuntimeException, awt::MaxChildrenException)
+ {
+     mIdMap[ xChild ] = insertTab();
+     Box_Base::addChild( xChild );
+-    }
++}
+ 
+-void SAL_CALL VCLXTabControl::removeChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > &xChild )
+-    throw (::com::sun::star::uno::RuntimeException)
++void SAL_CALL VCLXTabControl::removeChild( const uno::Reference< awt::XLayoutConstrains > &xChild )
++    throw (uno::RuntimeException)
+ {
+     removeTab( mIdMap[xChild] );
+     mIdMap[ xChild ] = -1;
+@@ -284,22 +298,87 @@ static void setChildrenVisible( uno::Reference < awt::XLayoutConstrains > xChild
+     }
+ }
+ 
+-void SAL_CALL VCLXTabControl::allocateArea(
+-    const ::com::sun::star::awt::Rectangle &rArea )
+-    throw (::com::sun::star::uno::RuntimeException)
++void SAL_CALL VCLXTabControl::allocateArea (awt::Rectangle const &area)
++    throw (uno::RuntimeException)
+ {
+-    maAllocation = rArea;
++    OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
++    maAllocation = area;
+ 
+     TabControl *pTabControl = getTabControl();
+ 
+-// FIXME: this is wrong. We just want to set tab controls pos/size for the tabs menu,
+-// otherwise, it gets events that should go to children (I guess we could solve this
+-// by making the tabcontrol as the actual XWindow parent of its children, when importing...)
+-// Not sure about TabPage drawing... That doesn't work on gtk+; just ignoring that.
+-// LATER: Nah, the proper fix is to get the XWindow hierarchy straight.
+-
+-    setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height, PosSize::POSSIZE );
++// FIXME: this is wrong. We just want to set tab controls pos/size for
++// the tabs menu, otherwise, it gets events that should go to children
++// (I guess we could solve this by making the tabcontrol as the actual
++// XWindow parent of its children, when importing...)  Not sure about
++// TabPage drawing... That doesn't work on gtk+; just ignoring that.
++// LATER: Nah, the proper fix is to get the XWindow hierarchy
++// straight.
+ 
++#if 0
++    setPosSize( area.X, area.Y, area.Width, area.Height, awt::PosSize::POSSIZE );
++#else
++    awt::Size currentSize = getSize();
++    awt::Size requestedSize (area.Width, area.Height);
++//    requestedSize.Height = getHeightForWidth( area.Width );
++
++    awt::Size minimumSize = getMinimumSize();
++    if (requestedSize.Width < minimumSize.Width)
++        requestedSize.Width = minimumSize.Width;
++    if (requestedSize.Height < minimumSize.Height)
++        requestedSize.Height = minimumSize.Height;
++
++    Size pageSize = static_cast<TabControl*> (GetWindow ())->GetTabPageSizePixel ();
++    awt::Size pageBasedSize (0, 0);
++    pageBasedSize.Width = pageSize.Width ();
++    pageBasedSize.Height = pageSize.Height ();
++
++    const int wc = 0;
++    const int hc = 20;
++    static int pwc = 0;
++    static int phc = 40;
++    
++    if (requestedSize.Width < pageBasedSize.Width)
++        requestedSize.Width = pageBasedSize.Width + wc;
++    if (requestedSize.Height < pageBasedSize.Height)
++        requestedSize.Height = pageBasedSize.Height + hc;
++
++    Size windowSize = GetWindow()->GetSizePixel();
++    Window *parent = GetWindow()->GetParent();
++    Size parentSize = parent->GetSizePixel();
++
++#ifdef GCC_MAJOR
++    OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
++#endif /* GCC_MAJOR */
++    OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height );
++    OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height );
++    OSL_TRACE ("%s: minimum: %d, %d", __FUNCTION__, minimumSize.Width, minimumSize.Height );
++    OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height );
++    OSL_TRACE ("%s: pageBasedSize: %d, %d", __FUNCTION__, pageBasedSize.Width, pageBasedSize.Height );
++
++    //OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parentSize.Width(), parentSize.Height() );
++    //OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, windowSize.Width(), windowSize.Height() );
++
++    //bRealized = false;
++    if (!bRealized)
++    {
++        setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::POSSIZE );
++        bRealized = true;
++    }
++    else
++    {
++        if ( requestedSize.Width > currentSize.Width + 10)
++            setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH );
++        if ( requestedSize.Height > currentSize.Height + 10)
++            setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT );
++    }
++#endif
++    
++    if (pageBasedSize.Width > parentSize.Width ()
++        || pageBasedSize.Height > parentSize.Height ())
++        //parent->SetSizePixel ( Size (pageBasedSize.Width, pageBasedSize.Height));
++        //parent->SetSizePixel ( Size (pageBasedSize.Width + pwc, pageBasedSize.Height + phc));
++        parent->SetSizePixel ( Size (requestedSize.Width + pwc, requestedSize.Height + phc));
++    
+     // FIXME: we can save cycles by setting visibility more sensibly. Having
+     // it here does makes it easier when changing tabs (just needs a recalc())
+     unsigned i = 0;
+@@ -307,8 +386,8 @@ void SAL_CALL VCLXTabControl::allocateArea(
+               = maChildren.begin(); it != maChildren.end(); it++, i++ )
+     {
+         ChildData *child = static_cast<VCLXTabControl::ChildData*> ( *it );
+-        ::com::sun::star::uno::Reference
+-              < ::com::sun::star::awt::XLayoutConstrains > xChild( child->mxChild );
++        uno::Reference
++              < awt::XLayoutConstrains > xChild( child->mxChild );
+         if ( xChild.is() )
+         {
+             uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY );
+@@ -340,15 +419,15 @@ void SAL_CALL VCLXTabControl::allocateArea(
+     }
+ }
+ 
+-::com::sun::star::awt::Size SAL_CALL VCLXTabControl::getMinimumSize()
+-    throw(::com::sun::star::uno::RuntimeException)
++awt::Size SAL_CALL VCLXTabControl::getMinimumSize()
++    throw(uno::RuntimeException)
+ {
+-    awt::Size size = VCLXWindow::getMinimumSize();
++    awt::Size requestedSize = VCLXWindow::getMinimumSize();
+     awt::Size childrenSize( 0, 0 );
+ 
+     TabControl* pTabControl = static_cast< TabControl* >( GetWindow() );
+     if ( !pTabControl )
+-        return size;
++        return requestedSize;
+ 
+     // calculate size to accomodate all children
+     unsigned i = 0;
+@@ -367,10 +446,17 @@ void SAL_CALL VCLXTabControl::allocateArea(
+         }
+     }
+ 
+-    size.Width += childrenSize.Width;
+-    size.Height += childrenSize.Height + 20;
+-    maRequisition = size;
+-    return size;
++#ifdef GCC_MAJOR
++    OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
++#endif /* GCC_MAJOR */
++    OSL_TRACE ("%s: children: %d", __FUNCTION__, i);
++    OSL_TRACE ("%s: childrenSize: %d, %d", __FUNCTION__, childrenSize.Width, childrenSize.Height );
++
++    requestedSize.Width += childrenSize.Width;
++    requestedSize.Height += childrenSize.Height + 20;
++
++    maRequisition = requestedSize;
++    return requestedSize;
+ }
+ 
+ void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+@@ -391,12 +477,12 @@ void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent
+         case VCLEVENT_TABPAGE_PAGETEXTCHANGED:
+         {
+             ULONG page = (ULONG) _rVclWindowEvent.GetData();
+-            for ( std::list< ::com::sun::star::uno::Reference
+-                      < ::com::sun::star::awt::XTabListener > >::iterator it
++            for ( std::list< uno::Reference
++                      < awt::XTabListener > >::iterator it
+                       = mxTabListeners.begin(); it != mxTabListeners.end(); it++)
+             {
+-                ::com::sun::star::uno::Reference
+-                    < ::com::sun::star::awt::XTabListener > listener = *it;
++                uno::Reference
++                    < awt::XTabListener > listener = *it;
+ 
+                 switch ( _rVclWindowEvent.GetId() )
+                 {
+@@ -414,7 +500,7 @@ void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent
+                         listener->removed( page );
+                         break;
+                     case VCLEVENT_TABPAGE_REMOVEDALL:
+-                        for( int i = 1; i < mnNextTabId; i++)
++                        for ( int i = 1; i < mTabId; i++)
+                         {
+                             if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( i ) ) )
+                                 listener->removed( i );
+@@ -434,12 +520,12 @@ void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent
+     }
+ }
+ 
+-void SAL_CALL VCLXTabControl::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException)
++void SAL_CALL VCLXTabControl::setProperty( const ::rtl::OUString& PropertyName, const uno::Any &Value ) throw(uno::RuntimeException)
+ {
+-                VCLXWindow::setProperty( PropertyName, Value );
+-        }
++    VCLXWindow::setProperty( PropertyName, Value );
++}
+ 
+-Any SAL_CALL VCLXTabControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
++uno::Any SAL_CALL VCLXTabControl::getProperty( const ::rtl::OUString& PropertyName ) throw(uno::RuntimeException)
+ {
+     return VCLXWindow::getProperty( PropertyName );
+ }
+diff --git a/toolkit/source/awt/vclxtabcontrol.hxx b/toolkit/source/awt/vclxtabcontrol.hxx
+index 432e464..8ea8296 100644
+--- toolkit/source/awt/vclxtabcontrol.hxx
++++ toolkit/source/awt/vclxtabcontrol.hxx
+@@ -50,9 +50,14 @@ class VCLXTabControl :public VCLXWindow
+                      ,public VCLXTabControl_Base
+                      ,public Box_Base
+ {
++    int mTabId;
++    bool bRealized;
++
+ public:
+     VCLXTabControl();
+ 
++    void AddChild (css::uno::Reference <css::awt::XLayoutConstrains> const &);
++
+ protected:
+     ~VCLXTabControl( );
+ 
+@@ -65,7 +70,7 @@ protected:
+     // XComponent
+     void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ 
+-    virtual void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw        (::com::sun::star::uno::RuntimeException);
++    virtual void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw (::com::sun::star::uno::RuntimeException);
+ 
+     // XSimpleTabController
+     virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
+@@ -108,10 +113,6 @@ protected:
+     // VCLXWindow
+     void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+ 
+-
+-    // Each tab page needs an unique id.
+-    int mnNextTabId;
+-
+ public:
+     // Maps page ids to child references
+     struct ChildData : public Box_Base::ChildData
+diff --git a/toolkit/source/awt/vclxtabpage.cxx b/toolkit/source/awt/vclxtabpage.cxx
+index 4a1c127..1abad26 100644
+--- toolkit/source/awt/vclxtabpage.cxx
++++ toolkit/source/awt/vclxtabpage.cxx
+@@ -41,6 +41,10 @@
+ #include <vcl/tabpage.hxx>
+ #include <vcl/tabctrl.hxx>
+ 
++#if !defined (__GNUC__)
++#define __PRETTY_FUNCTION__ __FUNCTION__
++#endif /* !__GNUC__ */
++
+ namespace layoutimpl
+ {
+ 
+@@ -72,7 +76,7 @@ void SAL_CALL VCLXTabPage::dispose() throw(uno::RuntimeException)
+         ::vos::OGuard aGuard( GetMutex() );
+         
+         lang::EventObject aDisposeEvent;
+-        aDisposeEvent.Source = *this;
++        aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+     }
+     
+     VCLXWindow::dispose();
+@@ -81,44 +85,58 @@ void SAL_CALL VCLXTabPage::dispose() throw(uno::RuntimeException)
+ void SAL_CALL VCLXTabPage::allocateArea( awt::Rectangle const& area )
+     throw (uno::RuntimeException)
+ {
+-    awt::Size curSize = getSize();
+-    awt::Size reqSize = getMinimumSize();
+-    reqSize.Height = getHeightForWidth( area.Width );
++    awt::Size currentSize = getSize();
++    awt::Size requestedSize = getMinimumSize();
++    requestedSize.Height = getHeightForWidth( area.Width );
+ 
+-    if ( curSize.Width > 0 && curSize.Height > 0
+-         && reqSize.Width > curSize.Width )
+-        reqSize.Width = curSize.Width;
+-    if ( curSize.Width > 0 && curSize.Height > 0
+-         && reqSize.Height > curSize.Height )
+-        reqSize.Height = curSize.Height;
++    if ( currentSize.Width > 0 && currentSize.Height > 0
++         && requestedSize.Width > currentSize.Width )
++        requestedSize.Width = currentSize.Width;
++    if ( currentSize.Width > 0 && currentSize.Height > 0
++         && requestedSize.Height > currentSize.Height )
++        requestedSize.Height = currentSize.Height;
+ 
+     // FIXME: missing destructor?
+     if ( !GetWindow() )
+         return;
+ 
+-    Size window = GetWindow()->GetSizePixel();
+-    Size parent = GetWindow()->GetParent()->GetSizePixel();
++    Size windowSize = GetWindow()->GetSizePixel();
++    Window *parent = GetWindow()->GetParent();
++    Size parentSize = parent->GetSizePixel();
+ 
+     Point pos = GetWindow()->GetPosPixel();
++    OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
+     OSL_TRACE ("%s: curpos: %d ,%d", __FUNCTION__, pos.X(), pos.Y() );
+ 
+-    OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, curSize.Width, curSize.Height );
++    OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height );
+     OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height );
+-    OSL_TRACE ("%s: reqSize: %d, %d", __FUNCTION__, reqSize.Width, reqSize.Height );
+-    OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parent.Width(), parent.Height() );
+-    OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, window.Width(), window.Height() );
++    OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height );
++    OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parentSize.Width(), parentSize.Height() );
++    OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, windowSize.Width(), windowSize.Height() );
++
++#if 0
++    if (requestedSize.Width > parentSize.Width ()
++        || requestedSize.Height > parentSize.Height ())
++    {
++        OSL_TRACE ("%s: ***setting parent: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height );
++        parent->SetSizePixel ( Size (requestedSize.Width, requestedSize.Height) );
++
++        if (Window *grand_parent = parent->GetParent ())
++            grand_parent->SetSizePixel ( Size (requestedSize.Width, requestedSize.Height) );
++    }
++#endif
+ 
+     if ( !bRealized )
+     {
+-        setPosSize( 0, 0, reqSize.Width, reqSize.Height, awt::PosSize::SIZE );
++        setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::SIZE );
+         bRealized = true;
+     }
+     else
+     {
+-        if ( reqSize.Width > curSize.Width )
+-            setPosSize( 0, 0, reqSize.Width, 0, awt::PosSize::WIDTH );
+-        if ( reqSize.Height > curSize.Height )
+-            setPosSize( 0, 0, 0, reqSize.Height, awt::PosSize::HEIGHT );
++        if ( requestedSize.Width > currentSize.Width + 10)
++            setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH );
++        if ( requestedSize.Height > currentSize.Height + 10)
++            setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT );
+     }
+ 
+     awt::Size newSize = getSize();
+diff --git a/toolkit/source/awt/vclxtabpage.hxx b/toolkit/source/awt/vclxtabpage.hxx
+index d6e3032..b83e6b1 100644
+--- toolkit/source/awt/vclxtabpage.hxx
++++ toolkit/source/awt/vclxtabpage.hxx
+@@ -49,6 +49,7 @@ class VCLXTabPage : public VCLXWindow
+                   , public Bin
+ {
+     bool bRealized;
++
+ public:
+     VCLXTabPage( Window *p );
+ 
+diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
+index 2f31115..1bb9fd8 100644
+--- toolkit/source/awt/vclxwindow.cxx
++++ toolkit/source/awt/vclxwindow.cxx
+@@ -1135,6 +1135,10 @@ void VCLXWindow::dispose(  ) throw(::com::sun::star::uno::RuntimeException)
+ 		aObj.Source = static_cast< ::cppu::OWeakObject* >( this );
+ 
+ 		maEventListeners.disposeAndClear( aObj );
++#if 0 // ENABLE_LAYOUT
++        /* FIXME: see layout::~ComboBox () */
++        if (!dynamic_cast<VCLXComboBox*> (this))
++#endif /* 0 ENABLE_LAYOUT */
+ 		maFocusListeners.disposeAndClear( aObj );
+ 		maWindowListeners.disposeAndClear( aObj );
+ 		maKeyListeners.disposeAndClear( aObj );
+diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
+index ec4c268..e9ae5d8 100644
+--- toolkit/source/awt/vclxwindows.cxx
++++ toolkit/source/awt/vclxwindows.cxx
+@@ -1336,6 +1336,13 @@ void VCLXRadioButton::ImplClickedOrToggled( BOOL bToggled )
+ 	}
+ }
+ 
++::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > VCLXRadioButton::getFirstActionListener ()
++{
++    if (!maItemListeners.getLength ())
++        return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ();
++    return maActionListeners.getElements()[0];
++}
++
+ //	----------------------------------------------------
+ //	class VCLXSpinField
+ //	----------------------------------------------------
+diff --git a/toolkit/source/layout/box-base.cxx b/toolkit/source/layout/box-base.cxx
+index aad69f7..f0b7a42 100644
+--- toolkit/source/layout/box-base.cxx
++++ toolkit/source/layout/box-base.cxx
+@@ -88,16 +88,22 @@ bool Box_Base::ChildData::isVisible()
+     return layoutimpl::isVisible( mxChild );
+ }
+ 
++void
++Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
++{
++    ChildData *pData = createChild (xChild);
++    maChildren.push_back (pData);
++    queueResize ();
++}
++
+ void SAL_CALL
+-Box_Base::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
++Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
+     throw (uno::RuntimeException, awt::MaxChildrenException)
+ {
+-    if ( xChild.is() )
++    if (xChild.is ())
+     {
+-        ChildData *pData = createChild( xChild );
+-        maChildren.push_back( pData );
+-        setChildParent( xChild );
+-        queueResize();
++        AddChild (xChild);
++        setChildParent (xChild);
+     }
+ }
+ 
+diff --git a/toolkit/source/layout/box-base.hxx b/toolkit/source/layout/box-base.hxx
+index 44e0434..14db44c 100644
+--- toolkit/source/layout/box-base.hxx
++++ toolkit/source/layout/box-base.hxx
+@@ -70,8 +70,10 @@ protected:
+     ChildData *removeChildData( std::list< ChildData *>, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
+     
+ public:
++    void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child);
++
+     // css::awt::XLayoutContainer
+-    virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
++    virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child)
+         throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
+     virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+         throw (css::uno::RuntimeException);
+diff --git a/toolkit/source/layout/helper.cxx b/toolkit/source/layout/helper.cxx
+index 1e96643..c1430b3 100644
+--- toolkit/source/layout/helper.cxx
++++ toolkit/source/layout/helper.cxx
+@@ -207,6 +207,9 @@ createToolkitWidget( uno::Reference< awt::XToolkit > xToolkit,
+         return uno::Reference< awt::XLayoutConstrains >();
+     }
+ 
++#if 0 // This shadows the show="false" property and seems otherwise
++      // unnecessary
++
+     // default to visible, let then people change it on properties
+     if ( ! bToplevel )
+     {
+@@ -214,6 +217,8 @@ createToolkitWidget( uno::Reference< awt::XToolkit > xToolkit,
+         if ( xWindow.is() )
+             xWindow->setVisible( true );
+     }
++#endif
++
+     return xPeer;
+ }
+ 
+@@ -378,13 +383,14 @@ PropHelper::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::
+ #include <vcl/tabctrl.hxx>
+ #include <vcl/tabpage.hxx>
+ 
++#include <toolkit/awt/vclxwindows.hxx>
++#include <vcl/lstbox.hxx>
++
+ #include <typeinfo>
+ 
+ namespace layoutimpl
+ {
+ 
+-TOOLKIT_DLLPUBLIC Window* global_parent;
+-
+ uno::Reference< awt::XLayoutConstrains > ImplCreateWindow(
+     uno::Reference< uno::XInterface > xParent,
+     OUString aName, long WindowAttributes )
+@@ -408,6 +414,16 @@ uno::Reference< awt::XLayoutConstrains > ImplCreateWindow(
+ 
+         WindowAttributes ^= awt::WindowAttribute::SHOW;
+     }
++    else if ( aName.equalsAscii( "modelessdialog" ) )
++    {
++        if ( pParent == NULL )
++            pParent = DIALOG_NO_PARENT;
++        pNewWindow = new ModelessDialog( pParent,
++                                         ImplGetWinBits( WindowAttributes, 0 ) );
++        pNewComp = new layoutimpl::VCLXDialog();
++
++        WindowAttributes ^= awt::WindowAttribute::SHOW;
++    }
+     else if ( aName.equalsAscii( "modaldialog" ) )
+     {
+         if ( pParent == NULL )
+@@ -509,9 +525,14 @@ uno::Reference< awt::XLayoutConstrains > ImplCreateWindow(
+     }
+     else if ( aName.equalsAscii( "tabpage" ) )
+     {
++#if 0
+         if ( !pParent )
+             pParent = layout::TabPage::global_parent;
+-
++#else
++        if (layout::TabPage::global_parent)
++            pParent = layout::TabPage::global_parent;
++        layout::TabPage::global_parent = 0;
++#endif        
+         //pNewWindow = new TabPage( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
+         WindowAttributes ^= awt::WindowAttribute::SHOW;
+         WinBits nStyle = ImplGetWinBits( WindowAttributes, 0 );
+@@ -530,13 +551,23 @@ uno::Reference< awt::XLayoutConstrains > ImplCreateWindow(
+         pNewWindow = new Window( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
+         pNewComp = new layoutimpl::LocalizedString();
+     }
++#if 0 // parent paranoia
++    else if ( aName.equalsAscii( "listbox" ) )
++    {
++        WindowAttributes |= awt::VclWindowPeerAttribute::DROPDOWN;
++        WinBits nStyle = ImplGetWinBits( WindowAttributes, 0 );
++        nStyle |= WB_DROPDOWN;
++        pNewWindow = new ListBox( pParent, nStyle );
++        pNewComp = new VCLXListBox ();
++    }
++#endif
+ 
+     if ( !pNewWindow )
+         return xRef;
+ 
+     pNewWindow->SetCreatedWithToolkit( sal_True );
+     if ( pNewComp )
+-        pNewComp->SetCreatedWithToolkit( TRUE );
++        pNewComp->SetCreatedWithToolkit( true );
+     xRef = pNewComp;
+     pNewWindow->SetComponentInterface( pNewComp );
+     if ( WindowAttributes & awt::WindowAttribute::SHOW )
+diff --git a/toolkit/source/layout/import.cxx b/toolkit/source/layout/import.cxx
+index 47857e6..500b69e 100644
+--- toolkit/source/layout/import.cxx
++++ toolkit/source/layout/import.cxx
+@@ -99,7 +99,16 @@ SAL_THROW (())
+     {
+         OUString aTitle;
+         if ( findAndRemove( "title", aProps, aTitle ) )
++        {
++            OSL_TRACE("Setting title: %s", OUSTRING_CSTR( aTitle ) );
+             xDialog->setTitle( aTitle );
++        }
++        OUString aHelpId;
++        if ( findAndRemove( "help-id", aProps, aHelpId ) )
++        {
++            OSL_TRACE("Setting help-id: %s", OUSTRING_CSTR( aHelpId ) );
++            xDialog->setHelpId( aHelpId.toInt32 () );
++        }
+     } // DEBUG:
+     else if ( pParent == NULL )
+     {
+@@ -122,32 +131,23 @@ SAL_THROW (())
+         if ( DialogButtonHBox *b = dynamic_cast<DialogButtonHBox *> ( mpWidget->getPeer().get() ) )
+             b->setOrdering ( aOrdering );
+ 
+-#ifdef IMPORT_RADIOGROUP
+-    bool bSetRadioGroup, bSetTitle;
+-    OUString aRadioGroup, aTitle;
++    bool bSetRadioGroup;
++    OUString aRadioGroup;
+     bSetRadioGroup = findAndRemove( "radiogroup", aProps, aRadioGroup );
+-    bSetTitle = findAndRemove( "title", aProps, aTitle );
+ 
+-    setProperties( mxPeer, aProps );
++    mpWidget->setProperties( aProps );
+ 
+     // we need to add radio buttons to the group after their properties are
+     // set, so we can check if they should be the one selected by default or not.
+     // And the state changed event isn't fired when changing properties.
+-    if ( bSetRadioGroup )
+-    {
+-        static int i = 0;
+-        i++;
+-        uno::Reference< awt::XRadioButton > xRadio( mxPeer, uno::UNO_QUERY );
+-        if ( xRadio.is() )
+-            pImport->mxRadioGroups.addItem( aRadioGroup, xRadio );
+-    }
+-    if ( bSetTitle )
++
++    uno::Reference< awt::XRadioButton > xRadio( mpWidget->getPeer(), uno::UNO_QUERY );
++    if ( xRadio.is() )
+     {
+-        uno::Reference< awt::XDialog2 > xDialog( mxPeer, uno::UNO_QUERY );
+-        if ( xDialog.is() )
+-            xDialog->setTitle( aTitle );
++        if (!bSetRadioGroup)
++            aRadioGroup = OUString::createFromAscii ("default");
++        pImport->mxRadioGroups.addItem( aRadioGroup, xRadio );
+     }
+-#endif
+ }
+ 
+ WidgetElement::~WidgetElement()
+@@ -181,7 +181,7 @@ WidgetElement::startChildElement ( sal_Int32 nUid, OUString const &name,
+ // transex3 hack.
+ void SAL_CALL
+ WidgetElement::characters( OUString const& rChars )
+-    throw (css::xml::sax::SAXException, css::uno::RuntimeException)
++    throw (xml::sax::SAXException, uno::RuntimeException)
+ {
+     if ( mpWidget && rChars.trim().getLength() )
+     {
+@@ -246,4 +246,97 @@ uno::Reference< xml::input::XElement > ImportContext::startRootElement(
+         return new ToplevelElement( rLocalName, xAttributes, this );
+ }
+ 
++RadioGroups::RadioGroups()
++{
++}
++
++void RadioGroups::addItem( rtl::OUString id, uno::Reference< awt::XRadioButton > xRadio )
 +    throw (uno::RuntimeException)
 +{
 +    if ( ! xRadio.is() )
@@ -994,8 +2044,8 @@
 +
  } // namespace layoutimpl
 diff --git a/toolkit/source/layout/import.hxx b/toolkit/source/layout/import.hxx
-index e6d7e51..44e4dcf 100644
---- a/toolkit/source/layout/import.hxx
+index e6d7e51..4e36a19 100644
+--- toolkit/source/layout/import.hxx
 +++ toolkit/source/layout/import.hxx
 @@ -37,8 +37,11 @@
  #define _BACKWARD_BACKWARD_WARNING_H 1
@@ -1139,7 +2189,7 @@
          : mrRoot( rRoot ) {}
 diff --git a/toolkit/source/layout/proplist.cxx b/toolkit/source/layout/proplist.cxx
 index c16d979..f63fba1 100644
---- a/toolkit/source/layout/proplist.cxx
+--- toolkit/source/layout/proplist.cxx
 +++ toolkit/source/layout/proplist.cxx
 @@ -404,7 +404,8 @@ findAndRemove( const char *pAttr, PropList &rProps, OUString &rValue )
  
@@ -1151,9 +2201,24 @@
          {
              rValue = it->second;
              rProps.erase( it );
+diff --git a/toolkit/source/vclcompat/makefile.mk b/toolkit/source/vclcompat/makefile.mk
+index 26b414e..a95d39f 100644
+--- toolkit/source/vclcompat/makefile.mk
++++ toolkit/source/vclcompat/makefile.mk
+@@ -39,6 +39,10 @@ ENABLE_EXCEPTIONS=true
+ .INCLUDE : settings.mk
+ .INCLUDE : $(PRJ)$/util$/makefile.pmk
+ 
++.IF "$(COMNAME)" == "gcc3"
++CFLAGS+=-Wall -fno-default-inline
++.ENDIF
++
+ # --- Files --------------------------------------------------------
+ 
+ # FIXME: This is bad, hmkay
 diff --git a/toolkit/source/vclcompat/wbutton.cxx b/toolkit/source/vclcompat/wbutton.cxx
-index 5617f4f..f08a7f9 100644
---- a/toolkit/source/vclcompat/wbutton.cxx
+index 5617f4f..759dd10 100644
+--- toolkit/source/vclcompat/wbutton.cxx
 +++ toolkit/source/vclcompat/wbutton.cxx
 @@ -39,6 +39,7 @@
  #include <com/sun/star/graphic/XGraphic.hpp>
@@ -1163,7 +2228,7 @@
  #include <toolkit/helper/convert.hxx>
  #include <vcl/button.hxx>
  #include <vcl/event.hxx>
-@@ -49,6 +50,7 @@
+@@ -49,16 +50,19 @@
  #include <list>
  
  #include "layout/layoutcore.hxx"
@@ -1171,62 +2236,105 @@
  
  using namespace ::com::sun::star;
  
-@@ -84,10 +86,10 @@ class ButtonImpl : public ControlImpl
-                  , public ::cppu::WeakImplHelper1< awt::XItemListener >
++using rtl::OUString;
++
+ namespace layout
+ {
+ 
+ class ImageImpl
+ {
+   public:
+-    css::uno::Reference< css::graphic::XGraphic > mxGraphic;
++    uno::Reference< graphic::XGraphic > mxGraphic;
+     ImageImpl( const char *pName )
+         : mxGraphic( layoutimpl::loadGraphic( pName ) )
+     {
+@@ -81,18 +85,16 @@ Image::~Image()
+ 
+ class ButtonImpl : public ControlImpl
+                  , public ::cppu::WeakImplHelper1< awt::XActionListener >
+-                 , public ::cppu::WeakImplHelper1< awt::XItemListener >
  {
      Link maClickHdl;
 -  protected:
-+protected:
-     // we add toggle hooks here to cut on code
-     Link maToggleHdl;
+-    // we add toggle hooks here to cut on code
+-    Link maToggleHdl;
 -  public:
++
 +public:
      uno::Reference< awt::XButton > mxButton;
-     ButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
-         : ControlImpl( pCtx, xPeer, pWindow )
-@@ -102,7 +104,7 @@ class ButtonImpl : public ControlImpl
+-    ButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : ControlImpl( pCtx, xPeer, pWindow )
+-        , mxButton( xPeer, uno::UNO_QUERY )
++    ButtonImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ControlImpl( context, peer, window )
++        , mxButton( peer, uno::UNO_QUERY )
+     {
++        /* We have default action when clicked, always listen. */
+         mxButton->addActionListener( this );
+     }
+ 
+@@ -102,21 +104,26 @@ class ButtonImpl : public ControlImpl
  
      virtual void Click() { /* make me pure virtual? */ };
  
 -    void SetClickHdl( const Link& rLink )
-+    virtual void SetClickHdl( const Link& rLink )
++    Link& GetClickHdl ()
      {
-         maClickHdl = rLink;
-         if ( !rLink )
-@@ -113,9 +115,11 @@ class ButtonImpl : public ControlImpl
+-        maClickHdl = rLink;
+-        if ( !rLink )
+-            mxButton->removeActionListener( this );
+-        else
+-            mxButton->addActionListener( this );
++        return maClickHdl;
+     }
  
-     virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
-         throw (css::uno::RuntimeException)
+-    virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
+-        throw (css::uno::RuntimeException)
 -    { mxButton.clear(); }
++    virtual void SetClickHdl( Link const& link )
++    {
++        maClickHdl = link;
++    }
++
++    void SAL_CALL disposing( lang::EventObject const& e )
++        throw (uno::RuntimeException)
 +    {
-+        mxButton.clear();
++        mxButton->removeActionListener( this );
++        ControlImpl::disposing (e);
++        mxButton.clear ();
 +    }
  
 -    virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ )
-+    virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& e )
-         throw (css::uno::RuntimeException)
+-        throw (css::uno::RuntimeException)
++    virtual void SAL_CALL actionPerformed( const awt::ActionEvent& )
++        throw (uno::RuntimeException)
      {
          if ( !maClickHdl )
-@@ -124,20 +128,25 @@ class ButtonImpl : public ControlImpl
+             Click();
+@@ -124,20 +131,22 @@ class ButtonImpl : public ControlImpl
              maClickHdl.Call( static_cast<Window *>( mpWindow ) );
      }
  
 -    virtual  // HACK: doesn't need to be virtual... remove in future...
-+    virtual
-     void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ )
-         throw (css::uno::RuntimeException)
-     {
-         maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
-     }
- 
+-    void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ )
+-        throw (css::uno::RuntimeException)
+-    {
+-        maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
+-    }
+-
 -    BOOL SetModeImage( css::uno::Reference< css::graphic::XGraphic > xGraph )
-+    bool SetModeImage( css::uno::Reference< css::graphic::XGraphic > xGraph )
++    bool SetModeImage( uno::Reference< graphic::XGraphic > xGraph )
      {
          setProperty( "Graphic", uno::Any( xGraph ) );
          return true;
      }
  };
  
++Button::~Button ()
++{
++}
++
 +String Button::GetStandardText (sal_uInt16 button_type)
 +{
 +    return ::Button::GetStandardText (button_type);
@@ -1235,8 +2343,20 @@
  void Button::SetText( String const& rStr )
  {
      if ( !getImpl().mxButton.is() )
-@@ -150,7 +159,7 @@ void Button::SetClickHdl( const Link& rLink )
-     getImpl().SetClickHdl( rLink );
+@@ -145,12 +154,17 @@ void Button::SetText( String const& rStr )
+     getImpl().mxButton->setLabel( rStr );
+ }
+ 
+-void Button::SetClickHdl( const Link& rLink )
++void Button::SetClickHdl( const Link& link )
++{
++    getImpl().SetClickHdl( link );
++}
++
++Link& Button::GetClickHdl ()
+ {
+-    getImpl().SetClickHdl( rLink );
++    return getImpl().GetClickHdl ();
  }
  
 -BOOL Button::SetModeImage( const Image& rImage )
@@ -1244,11 +2364,74 @@
  {
      return getImpl().SetModeImage( rImage.getImpl().mxGraphic );
  }
-@@ -197,14 +206,14 @@ class PushButtonImpl : public ButtonImpl
+@@ -166,45 +180,64 @@ void Button::Click()
+ 
+ IMPL_GET_IMPL( Button );
+ IMPL_CONSTRUCTORS( Button, Control, "button" );
++IMPL_GET_WINDOW (Button);
+ 
+ class PushButtonImpl : public ButtonImpl
++                 , public ::cppu::WeakImplHelper1< awt::XItemListener >
+ {
+-  public:
+-    PushButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : ButtonImpl( pCtx, xPeer, pWindow ) {}
++    Link maToggleHdl;
++public:
++    PushButtonImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ButtonImpl( context, peer, window )
++    {
++    }
+ 
+-    void SetToggleHdl( const Link& rLink )
++    void SetToggleHdl( const Link& link )
+     {
+         // XButton doesn't have an explicit event for Toggle. Anyway, it is a
+         // superset of the clicks: all clicks, and explicit toggles
+-        maToggleHdl = rLink;
+-        if ( !rLink )
++        if (!link && !!maToggleHdl)
+             mxButton->removeActionListener( this );
+-        else
++        else if (!!link && !maToggleHdl)
+             mxButton->addActionListener( this );
++        maToggleHdl = link;
+     }
+-
+-    virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& rEvent )
+-        throw (css::uno::RuntimeException)
++    void SAL_CALL disposing( lang::EventObject const& e )
++        throw (uno::RuntimeException)
+     {
+-        ButtonImpl::actionPerformed( rEvent );
++        ButtonImpl::disposing (e);
++    }
++    virtual void SAL_CALL actionPerformed( awt::ActionEvent const& e )
++        throw (uno::RuntimeException)
++    {
++        ButtonImpl::actionPerformed( e );
+         fireToggle();
+     }
+-
+-    inline void fireToggle()
++    virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
++        throw (uno::RuntimeException)
++    {
++        maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
++    }
++    void fireToggle()
+     {
+         maToggleHdl.Call(  static_cast<Window *>( mpWindow ) );
      }
++
  };
  
 -void PushButton::Check( BOOL bCheck )
++PushButton::~PushButton ()
++{
++    SetToggleHdl (Link ());
++}
++
 +void PushButton::Check( bool bCheck )
  {
      getImpl().setProperty( "State", uno::Any( (sal_Int16) !!bCheck ) );
@@ -1261,19 +2444,36 @@
  {
      return !!( getImpl().getProperty( "State" ).get< sal_Int16 >() );
  }
-@@ -222,9 +231,6 @@ void PushButton::SetToggleHdl( const Link& rLink )
+@@ -214,74 +247,60 @@ void PushButton::Toggle()
+     Check( true );
+ }
+ 
+-void PushButton::SetToggleHdl( const Link& rLink )
++void PushButton::SetToggleHdl( const Link& link )
+ {
+-    getImpl().SetToggleHdl( rLink );
++    getImpl().SetToggleHdl( link );
+ }
+ 
  IMPL_GET_IMPL( PushButton );
  IMPL_CONSTRUCTORS( PushButton, Button, "pushbutton" );
- 
+-
 - // HACK: put every radio button into a group :/
 -static std::list< RadioButtonImpl*> mpRadioGroup;
--
++IMPL_GET_WINDOW (PushButton);
+ 
  class RadioButtonImpl : public ButtonImpl
++                      , public ::cppu::WeakImplHelper1< awt::XItemListener >
  {
++    Link maToggleHdl;
  public:
-@@ -233,55 +239,41 @@ public:
-         : ButtonImpl( pCtx, xPeer, pWindow )
-         , mxRadioButton( xPeer, uno::UNO_QUERY )
+     uno::Reference< awt::XRadioButton > mxRadioButton;
+-    RadioButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : ButtonImpl( pCtx, xPeer, pWindow )
+-        , mxRadioButton( xPeer, uno::UNO_QUERY )
++    RadioButtonImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ButtonImpl( context, peer, window )
++        , mxRadioButton( peer, uno::UNO_QUERY )
      {
 -        // TEMP:
 -        mpRadioGroup.push_back( this );
@@ -1319,7 +2519,8 @@
      }
  
 -    static void unsetOthersGroup( RadioButtonImpl* current )
--    {
++    void SetToggleHdl( const Link& link )
+     {
 -        // set all others to false
 -        for ( std::list< RadioButtonImpl*>::iterator i = mpRadioGroup.begin();
 -              i != mpRadioGroup.end(); i++ )
@@ -1329,29 +2530,30 @@
 -        }
 -    }
 -
-     void SetToggleHdl( const Link& rLink )
-     {
-         maToggleHdl = rLink;
+-    void SetToggleHdl( const Link& rLink )
+-    {
+-        maToggleHdl = rLink;
 -#if 0
-         if ( !rLink )
+-        if ( !rLink )
++        if (!link && !!maToggleHdl)
              mxRadioButton->removeItemListener( this );
-         else
+-        else
++        else if (!!link && !maToggleHdl)
              mxRadioButton->addItemListener( this );
 -#endif
++        maToggleHdl = link;
      }
  
      inline void fireToggle()
-@@ -289,24 +281,37 @@ public:
+@@ -289,84 +308,115 @@ public:
          maToggleHdl.Call(  static_cast<Window *>( mpWindow ) );
      }
  
 -//HACK: temp
 -    virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent )
 -        throw (css::uno::RuntimeException)
-+    virtual void SetClickHdl( const Link& rLink )
-     {
--        if ( !!maToggleHdl )
--        ButtonImpl::itemStateChanged( rEvent );
++    virtual void SetClickHdl( const Link& link )
++    {
 +        // Keep RadioGroups::RadioGroup's actionListener at HEAD
 +        // of list.  This way, it can handle RadioGroup's button
 +        // states before all other callbacks and make sure the
@@ -1363,21 +2565,33 @@
 +        uno::Reference< uno::XInterface > x = static_cast<VCLXRadioButton*> (mpWindow->GetVCLXWindow ())->getFirstActionListener ();
 +        uno::Reference< awt::XActionListener > a = uno::Reference< awt::XActionListener> (x ,uno::UNO_QUERY );
 +        mxButton->removeActionListener (a);
-+        ButtonImpl::SetClickHdl (rLink);
++        ButtonImpl::SetClickHdl (link);
 +        mxButton->addActionListener (a);
 +    }
++
++    void SAL_CALL disposing( lang::EventObject const& e )
++        throw (uno::RuntimeException)
+     {
+-        if ( !!maToggleHdl )
+-        ButtonImpl::itemStateChanged( rEvent );
++        ButtonImpl::disposing (e);
++    }
  
 -        if ( IsChecked() )
 -            unsetOthersGroup( this );
-+    virtual
-+    void SAL_CALL itemStateChanged( const css::awt::ItemEvent& e )
-+        throw (css::uno::RuntimeException)
++    virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
++        throw (uno::RuntimeException)
 +    {
 +        maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
      }
  };
  
 -void RadioButton::Check( BOOL bCheck )
++RadioButton::~RadioButton ()
++{
++    SetToggleHdl (Link ());
++}
++
 +void RadioButton::Check( bool bCheck )
  {
      getImpl().Check( bCheck );
@@ -1388,7 +2602,12 @@
  {
      return getImpl().IsChecked();
  }
-@@ -317,20 +322,9 @@ void RadioButton::SetToggleHdl( const Link& rLink )
+ 
+-void RadioButton::SetToggleHdl( const Link& rLink )
++void RadioButton::SetToggleHdl( const Link& link )
+ {
+-    getImpl().SetToggleHdl( rLink );
++    getImpl().SetToggleHdl( link );
  }
  
  IMPL_GET_IMPL( RadioButton );
@@ -1410,12 +2629,50 @@
 -#endif
  
  class CheckBoxImpl : public ButtonImpl
++                 , public ::cppu::WeakImplHelper1< awt::XItemListener >
  {
-@@ -350,17 +344,17 @@ class CheckBoxImpl : public ButtonImpl
++    Link maToggleHdl;
+   public:
+     uno::Reference< awt::XCheckBox > mxCheckBox;
+-    CheckBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : ButtonImpl( pCtx, xPeer, pWindow )
+-        , mxCheckBox( xPeer, uno::UNO_QUERY ) {}
++    CheckBoxImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ButtonImpl( context, peer, window )
++        , mxCheckBox( peer, uno::UNO_QUERY )
++    {
++    }
+ 
+-    void SetToggleHdl( const Link& rLink )
++    void SetToggleHdl( const Link& link )
+     {
+-        maToggleHdl = rLink;
+-        if ( !rLink )
++        if (!link && !!maToggleHdl)
+             mxCheckBox->removeItemListener( this );
+-        else
++        else if (!!link && !maToggleHdl)
+             mxCheckBox->addItemListener( this );
++        maToggleHdl = link;
++    }
++    void SAL_CALL disposing( lang::EventObject const& e )
++        throw (uno::RuntimeException)
++    {
++        ButtonImpl::disposing (e);
++    }
++    virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
++        throw (uno::RuntimeException)
++    {
++        maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
      }
  };
  
 -void CheckBox::Check( BOOL bCheck )
++CheckBox::~CheckBox ()
++{
++    SetToggleHdl (Link ());
++}
++
 +void CheckBox::Check( bool bCheck )
  {
      if ( !getImpl().mxCheckBox.is() )
@@ -1432,22 +2689,331 @@
      return getImpl().mxCheckBox->getState() != 0;
  }
  
-@@ -557,8 +551,8 @@ public:
-     MoreButtonImpl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow )
-         : AdvancedButtonImpl( pCtx, xPeer, pWindow)
+-void CheckBox::SetToggleHdl( const Link& rLink )
++void CheckBox::SetToggleHdl( const Link& link )
+ {
+-    getImpl().SetToggleHdl( rLink );
++    getImpl().SetToggleHdl( link );
+ }
+ 
+ IMPL_GET_IMPL( CheckBox );
+@@ -376,14 +426,14 @@ IMPL_CONSTRUCTORS( CheckBox, Button, "checkbox" );
+     class t##Impl : public parent##Impl \
+     { \
+     public: \
+-        t##Impl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow ) \
+-            : parent##Impl( pCtx, xPeer, pWindow ) \
++        t##Impl( Context *context, PeerHandle const& peer, Window *window ) \
++            : parent##Impl( context, peer, window ) \
+         { \
+         } \
+         void Click() \
+         { \
+-            Dialog *d = static_cast<Dialog *>( mpCtx ); \
+-            d->EndDialog( response ); \
++            if (Dialog *d = static_cast<Dialog *> (mpCtx)) \
++                d->EndDialog( response ); \
+         } \
+     }
+ 
+@@ -422,45 +472,35 @@ protected:
+     bool bAdvancedMode;
+     std::list< Window*> maAdvanced;
+     std::list< Window*> maSimple;
+-    rtl::OUString mSimpleLabel;
+-    rtl::OUString mAdvancedLabel;
+ 
++public:
++    OUString mAdvancedLabel;
++    OUString mSimpleLabel;
++
++protected:
+     Window* Remove( std::list< Window*> lst, Window* w )
+-{
++    {
+         for ( std::list< Window*>::iterator it = maAdvanced.begin();
+               it != maAdvanced.end(); it++ )
+             if ( *it == w )
+-    {
++            {
+                 lst.erase( it );
+                 return *it;
+             }
+         return 0;
+     }
+-    void redraw()
+-    {
+-        uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY );
+-        ::Window* window = VCLXWindow::GetImplementation( ref )->GetWindow();
+-        ::Window* parent = window->GetParent();
+-
+-        ::Rectangle r = Rectangle( parent->GetPosPixel(),
+-                                   parent->GetSizePixel() );
+-
+-        parent->Invalidate( r, INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN );
+-        parent->SetPosSizePixel( 0, 0, r.nRight - r.nLeft, r.nBottom - r.nTop,
+-                                 awt::PosSize::SIZE );
+-    }
+-
++    
+ public:
+-    AdvancedButtonImpl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow )
+-        : PushButtonImpl( pCtx, xPeer, pWindow )
++    AdvancedButtonImpl( Context *context, PeerHandle const& peer, Window *window )
++        : PushButtonImpl( context, peer, window )
+         , bAdvancedMode( false )
+           // TODO: i18n
+           // Button::GetStandardText( BUTTON_ADVANCED );
+           // Button::GetStandardText( BUTTON_SIMPLE );
+-        , mSimpleLabel( rtl::OUString::createFromAscii( "Advanced..." ) )
+-        , mAdvancedLabel( rtl::OUString::createFromAscii( "Simple..." ) )
+-{
+-}
++        , mAdvancedLabel( OUString::createFromAscii( "Advanced..." ) )
++        , mSimpleLabel( OUString::createFromAscii( "Simple..." ) )
++    {
++    }
+     void Click()
+     {
+         bAdvancedMode = !bAdvancedMode;
+@@ -469,20 +509,20 @@ public:
+         else
+             simpleMode();
+     }
++    void setAlign ()
++    {
++        ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
++        b->SetSymbolAlign (SYMBOLALIGN_RIGHT);
++        b->SetSmallSymbol ();
++        //mpWindow->SetStyle (mpWindow->GetStyle() | WB_CENTER);
++    }
+     void advancedMode()
+     {
+-        // TODO: set symbol/image?
+-        // SYMBOL_PAGEUP, SYMBOL_PAGEDOWN
+-#if 0
+-        // How to set images from here?
+-        // XImageConsumer looks like a disaster
+-        // Should move all this switching functionality to VCLXAdvancedButton?
+-        /biek/home/janneke/vc/layout-cws/default_images/res/commandimagelist/
+-            sc_arrowshapes_down.png
+-            sch_flowchartshapes.flowchart-extract.png
+-            sch_flowchartshapes.flowchart-merge.png
+-#endif        
+-        mxButton->setLabel( mAdvancedLabel );
++        ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
++        b->SetSymbol (SYMBOL_PAGEUP);
++        setAlign ();
++        if (mSimpleLabel.getLength ())
++            b->SetText (mSimpleLabel);
+         for ( std::list< Window*>::iterator it = maAdvanced.begin();
+               it != maAdvanced.end(); it++ )
+             ( *it )->Show();
+@@ -490,12 +530,16 @@ public:
+               it != maSimple.end(); it++ )
+             ( *it )->Hide();
+ 
+-        redraw();
++        redraw ();
+     }
+-
+     void simpleMode()
+-{
+-        mxButton->setLabel( mSimpleLabel );
++    {
++        //mxButton->setLabel( mSimpleLabel );
++        ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
++        b->SetSymbol (SYMBOL_PAGEDOWN);
++        if (mAdvancedLabel.getLength ())
++            b->SetText (mAdvancedLabel);
++        setAlign ();
+         for ( std::list< Window*>::iterator it = maAdvanced.begin();
+               it != maAdvanced.end(); it++ )
+             ( *it )->Hide();
+@@ -503,7 +547,7 @@ public:
+               it != maSimple.end(); it++ )
+             ( *it )->Show();
+ 
+-        redraw();
++        redraw (true);
+     }
+     void AddAdvanced( Window* w )
+     {
+@@ -547,18 +591,44 @@ void AdvancedButton::RemoveSimple( Window* w )
+     getImpl().RemoveSimple( w );
+ }
+ 
+-IMPL_CONSTRUCTORS( AdvancedButton, PushButton, "advancedbutton" );
++void AdvancedButton::SetAdvancedText (OUString const& text)
++{
++    if (text.getLength ())
++        getImpl ().mAdvancedLabel = text;
++}
++
++void AdvancedButton::SetSimpleText (OUString const& text)
++{
++    if (text.getLength ())
++        getImpl ().mSimpleLabel = text;
++}
++
++OUString AdvancedButton::GetAdvancedText () const
++{
++    return getImpl ().mAdvancedLabel;
++}
++
++OUString AdvancedButton::GetSimpleText () const
++{
++    return getImpl ().mSimpleLabel;
++}
++
++void AdvancedButton::SetDelta (int)
++{
++}
++
++IMPL_CONSTRUCTORS_BODY( AdvancedButton, PushButton, "advancedbutton", getImpl().simpleMode () );
+ IMPL_GET_IMPL( AdvancedButton );
+ 
+ 
+ class MoreButtonImpl : public AdvancedButtonImpl
+ {
+ public:
+-    MoreButtonImpl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow )
+-        : AdvancedButtonImpl( pCtx, xPeer, pWindow)
++    MoreButtonImpl( Context *context, PeerHandle const& peer, Window *window )
++        : AdvancedButtonImpl( context, peer, window)
      {
 -        mAdvancedLabel = ::Button::GetStandardText( BUTTON_LESS );
 -        mSimpleLabel = ::Button::GetStandardText( BUTTON_MORE );
-+        mAdvancedLabel = Button::GetStandardText( BUTTON_LESS );
 +        mSimpleLabel = Button::GetStandardText( BUTTON_MORE );
++        mAdvancedLabel = Button::GetStandardText( BUTTON_LESS );
      }
      void AddWindow( Window* w ) { AddAdvanced( w ); }
      void RemoveWindow( Window* w ) { RemoveAdvanced( w ); }
+@@ -566,7 +636,7 @@ public:
+ 
+ // TODO
+ //BUTTON_IMPL( MoreButton, PushButton, 0 );
+-IMPL_CONSTRUCTORS( MoreButton, AdvancedButton, "morebutton" );
++IMPL_CONSTRUCTORS_BODY( MoreButton, AdvancedButton, "morebutton", getImpl().simpleMode () );
+ IMPL_GET_IMPL( MoreButton );
+ 
+ void MoreButton::AddWindow( Window* w )
+@@ -579,4 +649,24 @@ void MoreButton::RemoveWindow( Window* w )
+     getImpl().RemoveWindow( w );
+ }
+ 
++void MoreButton::SetMoreText (OUString const& text)
++{
++    SetAdvancedText (text);
++}
++
++void MoreButton::SetLessText (OUString const& text)
++{
++    SetSimpleText (text);
++}
++
++OUString MoreButton::GetMoreText () const
++{
++    return GetAdvancedText ();
++}
++
++OUString MoreButton::GetLessText () const
++{
++    return GetSimpleText ();
++}
++
+ } // namespace layout
+diff --git a/toolkit/source/vclcompat/wcontainer.cxx b/toolkit/source/vclcompat/wcontainer.cxx
+index ba49195..9783cb9 100644
+--- toolkit/source/vclcompat/wcontainer.cxx
++++ toolkit/source/vclcompat/wcontainer.cxx
+@@ -44,8 +44,8 @@ using namespace ::com::sun::star;
+ namespace layout
+ {
+ 
+-Container::Container( Context const* pCtx, char const* pId )
+-    : mxContainer( pCtx->GetPeerHandle( pId ), uno::UNO_QUERY )
++Container::Container( Context const* context, char const* pId )
++    : mxContainer( context->GetPeerHandle( pId ), uno::UNO_QUERY )
+ {
+     if ( !mxContainer.is() )
+     {
+@@ -154,12 +154,12 @@ Table::Table( sal_Int32 nBorder, sal_Int32 nColumns )
+                               uno::Any( nColumns ) );
+ }
+ 
+-void Table::Add( Window *pWindow, bool bXExpand, bool bYExpand,
++void Table::Add( Window *window, bool bXExpand, bool bYExpand,
+                  sal_Int32 nXSpan, sal_Int32 nYSpan )
+ {
+-    if ( !pWindow )
++    if ( !window )
+         return;
+-    WindowImpl &rImpl = pWindow->getImpl();
++    WindowImpl &rImpl = window->getImpl();
+     uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
+                                                      uno::UNO_QUERY );
+     mxContainer->addChild( xChild );
+@@ -200,11 +200,11 @@ Box::Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous )
+                               uno::Any( bHomogeneous ) );
+ }
+ 
+-void Box::Add( Window *pWindow, bool bExpand, bool bFill, sal_Int32 nPadding)
++void Box::Add( Window *window, bool bExpand, bool bFill, sal_Int32 nPadding)
+ {
+-    if ( !pWindow )
++    if ( !window )
+         return;
+-    WindowImpl &rImpl = pWindow->getImpl();
++    WindowImpl &rImpl = window->getImpl();
+     uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
+                                                      uno::UNO_QUERY );
+ 
+@@ -237,13 +237,13 @@ void Box::setProps( uno::Reference< awt::XLayoutConstrains > xChild,
+                               uno::Any( nPadding ) );
+ }
+ 
+-Table::Table( Context const* pCtx, char const* pId )
+-    : Container( pCtx, pId )
++Table::Table( Context const* context, char const* pId )
++    : Container( context, pId )
+ {
+ }
+ 
+-Box::Box( Context const* pCtx, char const* pId )
+-    : Container( pCtx, pId )
++Box::Box( Context const* context, char const* pId )
++    : Container( context, pId )
+ {
+ }
+ 
+@@ -253,8 +253,8 @@ HBox::HBox( sal_Int32 nBorder, bool bHomogeneous )
+ {
+ }
+ 
+-HBox::HBox( Context const* pCtx, char const* pId )
+-    : Box( pCtx, pId )
++HBox::HBox( Context const* context, char const* pId )
++    : Box( context, pId )
+ {
+ }
+ 
+@@ -264,8 +264,8 @@ VBox::VBox( sal_Int32 nBorder, bool bHomogeneous )
+ {
+ }
+ 
+-VBox::VBox( Context const* pCtx, char const* pId )
+-    : Box( pCtx, pId )
++VBox::VBox( Context const* context, char const* pId )
++    : Box( context, pId )
+ {
+ }
+ 
 diff --git a/toolkit/source/vclcompat/wfield.cxx b/toolkit/source/vclcompat/wfield.cxx
-index 015cf63..9c86730 100644
---- a/toolkit/source/vclcompat/wfield.cxx
+index 015cf63..45a8021 100644
+--- toolkit/source/vclcompat/wfield.cxx
 +++ toolkit/source/vclcompat/wfield.cxx
-@@ -33,7 +33,7 @@
+@@ -33,48 +33,40 @@
  
  #include <comphelper/processfactory.hxx>
  #include <com/sun/star/awt/XMetricField.hpp>
@@ -1456,77 +3022,345 @@
  #include <com/sun/star/awt/XTextComponent.hpp>
  #include <com/sun/star/awt/XListBox.hpp>
  #include <com/sun/star/awt/XComboBox.hpp>
-@@ -40,6 +40,7 @@
  #include <cppuhelper/implbase1.hxx>
  #include <com/sun/star/awt/XActionListener.hpp>
  #include <com/sun/star/awt/XItemListener.hpp>
++#include <vcl/combobox.hxx>
 +#include <vcl/lstbox.hxx>
  
  using namespace ::com::sun::star;
  
-@@ -177,7 +177,7 @@ class FormatterBaseImpl
- class NumericFormatterImpl : public FormatterBaseImpl
+ namespace layout
  {
-   public:
--    uno::Reference< awt::XCurrencyField > mxField;
-+    uno::Reference< awt::XNumericField > mxField;
-     explicit NumericFormatterImpl( const PeerHandle &xPeer )
-         : FormatterBaseImpl( xPeer )
-         , mxField( xPeer, uno::UNO_QUERY )
-@@ -308,7 +309,7 @@ public:
-     {
-     }
  
--    USHORT InsertEntry( XubString const& rStr, USHORT nPos )
-+    sal_uInt16 InsertEntry( XubString const& rStr, sal_uInt16 nPos )
-     {
-         if ( nPos == COMBOBOX_APPEND )
-             nPos = GetEntryCount();
-@@ -316,29 +317,29 @@ public:
-         return nPos;
-     }
- 
--    void RemoveEntry( USHORT nPos )
-+    void RemoveEntry( sal_uInt16 nPos )
+-class EditImpl : public ControlImpl,
+-                 public ::cppu::WeakImplHelper1< awt::XTextListener >
++class EditImpl : public ControlImpl
++               , public ::cppu::WeakImplHelper1< awt::XTextListener >
+ {
++public:
+     Link maModifyHdl;
+-  public:
++
+     uno::Reference< awt::XTextComponent > mxEdit;
+-    EditImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : ControlImpl( pCtx, xPeer, pWindow )
+-        ,  mxEdit( xPeer, uno::UNO_QUERY )
++    EditImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ControlImpl( context, peer, window )
++        ,  mxEdit( peer, uno::UNO_QUERY )
      {
-         mxComboBox->removeItems( nPos, 1 );
      }
  
--    USHORT GetEntryPos( const XubString& rStr ) const
-+    sal_uInt16 GetEntryPos( const XubString& rStr ) const
-     {
-         uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() );
-         rtl::OUString rKey( rStr );
-         for( unsigned int i = 0; aItems.getLength(); i++ )
-         {
-             if ( aItems[ i ] == rKey )
--                return sal::static_int_cast< USHORT >( i );
-+                return sal::static_int_cast< sal_uInt16 >( i );
-         }
-         return COMBOBOX_ENTRY_NOTFOUND;
-     }
+-    virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
+-        throw (css::uno::RuntimeException)
+-    {
+-        SetModifyHdl( Link() );
+-        mxEdit.clear();
+-    }
++    ~EditImpl ();
  
--    XubString GetEntry( USHORT nPos ) const
-+    XubString GetEntry( sal_uInt16 nPos ) const
-     {
-         return XubString( mxComboBox->getItem( nPos ) );
-     }
+-    void SetModifyHdl( const Link& rLink )
+-    {
+-        if ( !mxEdit.is() )
+-            return;
+-        maModifyHdl = rLink;
+-        if ( !rLink )
+-            mxEdit->removeTextListener( this );
+-        else
+-            mxEdit->addTextListener( this );
+-    }
++    virtual void SAL_CALL disposing( lang::EventObject const& e )
++        throw (css::uno::RuntimeException);
++
++    virtual void SetModifyHdl( Link const& link );
  
--    USHORT GetEntryCount() const
-+    sal_uInt16 GetEntryCount() const
-     {
-         return mxComboBox->getItemCount();
-     }
-@@ -386,7 +387,7 @@ public:
+     void SAL_CALL textChanged( const css::awt::TextEvent& /* rEvent */ )
+         throw (css::uno::RuntimeException)
+@@ -83,6 +75,31 @@ class EditImpl : public ControlImpl,
      }
  };
  
--USHORT ComboBox::InsertEntry( const XubString &rStr, USHORT nPos )
++EditImpl::~EditImpl ()
++{
++}
++
++void SAL_CALL EditImpl::disposing( lang::EventObject const& e )
++    throw (css::uno::RuntimeException)
++{
++    ControlImpl::disposing (e);
++    mxEdit.clear ();
++}
++
++void EditImpl::SetModifyHdl( Link const& link )
++{
++    if (!link && !!maModifyHdl)
++        mxEdit->removeTextListener( this );
++    else if (!!link && !maModifyHdl)
++        mxEdit->addTextListener( this );
++    maModifyHdl = link;
++}
++
++Edit::~Edit ()
++{
++    SetModifyHdl (Link ());
++}
++
+ void Edit::SetSelection( Selection const& rSelection )
+ {
+     if ( !getImpl().mxEdit.is() )
+@@ -104,9 +121,10 @@ XubString Edit::GetText() const
+     return XubString( getImpl().mxEdit->getText());
+ }
+ 
+-void Edit::SetModifyHdl( const Link& rLink )
++void Edit::SetModifyHdl( const Link& link )
+ {
+-    getImpl().SetModifyHdl( rLink );
++    if (&getImpl () && getImpl().mxWindow.is ())
++        getImpl().SetModifyHdl( link );
+ }
+ 
+ IMPL_CONSTRUCTORS( Edit, Control, "edit" );
+@@ -116,8 +134,8 @@ IMPL_GET_IMPL( Edit );
+ class MultiLineEditImpl : public EditImpl
+ {
+ public:
+-    MultiLineEditImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : EditImpl( pCtx, xPeer, pWindow )
++    MultiLineEditImpl( Context *context, const PeerHandle &peer, Window *window )
++        : EditImpl( context, peer, window )
+     {
+     }
+ };
+@@ -129,8 +147,8 @@ IMPL_GET_IMPL( MultiLineEdit );
+ class SpinFieldImpl : public EditImpl
+ {
+   public:
+-    SpinFieldImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : EditImpl( pCtx, xPeer, pWindow )
++    SpinFieldImpl( Context *context, const PeerHandle &peer, Window *window )
++        : EditImpl( context, peer, window )
+     {
+     }
+ };
+@@ -141,8 +159,8 @@ IMPL_CONSTRUCTORS( SpinField, Edit, "spinfield" );
+ class NumericFieldImpl : public SpinFieldImpl
+ {
+   public:
+-    NumericFieldImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : SpinFieldImpl( pCtx, xPeer, pWindow )
++    NumericFieldImpl( Context *context, const PeerHandle &peer, Window *window )
++        : SpinFieldImpl( context, peer, window )
+     {
+     }
+ };
+@@ -151,8 +169,8 @@ class NumericFieldImpl : public SpinFieldImpl
+ class MetricFieldImpl : public SpinFieldImpl
+ {
+   public:
+-    MetricFieldImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : SpinFieldImpl( pCtx, xPeer, pWindow )
++    MetricFieldImpl( Context *context, const PeerHandle &peer, Window *window )
++        : SpinFieldImpl( context, peer, window )
+     {
+     }
+ };
+@@ -165,10 +183,10 @@ IMPL_GET_IMPL( MetricField );
+ class FormatterBaseImpl
+ {
+   protected:
+-    PeerHandle mxPeer;
++    PeerHandle mpeer;
+   public:
+-    explicit FormatterBaseImpl( const PeerHandle &xPeer )
+-        : mxPeer( xPeer )
++    explicit FormatterBaseImpl( const PeerHandle &peer )
++        : mpeer( peer )
+     {
+     };
+ };
+@@ -176,10 +194,10 @@ class FormatterBaseImpl
+ class NumericFormatterImpl : public FormatterBaseImpl
+ {
+   public:
+-    uno::Reference< awt::XCurrencyField > mxField;
+-    explicit NumericFormatterImpl( const PeerHandle &xPeer )
+-        : FormatterBaseImpl( xPeer )
+-        , mxField( xPeer, uno::UNO_QUERY )
++    uno::Reference< awt::XNumericField > mxField;
++    explicit NumericFormatterImpl( const PeerHandle &peer )
++        : FormatterBaseImpl( peer )
++        , mxField( peer, uno::UNO_QUERY )
+     {
+     }
+ 
+@@ -206,9 +224,9 @@ class MetricFormatterImpl : public FormatterBaseImpl
+ {
+   public:
+     uno::Reference< awt::XMetricField > mxField;
+-    explicit MetricFormatterImpl( const PeerHandle &xPeer )
+-        : FormatterBaseImpl( xPeer )
+-        , mxField( xPeer, uno::UNO_QUERY )
++    explicit MetricFormatterImpl( const PeerHandle &peer )
++        : FormatterBaseImpl( peer )
++        , mxField( peer, uno::UNO_QUERY )
+     {
+     }
+ };
+@@ -295,20 +313,27 @@ sal_Int64 MetricFormatter::GetValue( FieldUnit nUnit ) const
+ IMPL_CONSTRUCTORS_2( MetricField, SpinField, MetricFormatter, "metricfield" );
+ 
+ // Window/Control/Edit/ComboBox
+-class ComboBoxImpl : public EditImpl,
+-                     public ::cppu::WeakImplHelper1< awt::XActionListener >,
+-                     public ::cppu::WeakImplHelper1< awt::XItemListener >
++class ComboBoxImpl : public EditImpl
++                   , public ::cppu::WeakImplHelper1< awt::XActionListener >
++                   , public ::cppu::WeakImplHelper1< awt::XItemListener >
+ {
+-    Link maClickHdl, maSelectHdl;
+ public:
+     uno::Reference< awt::XComboBox > mxComboBox;
+-    ComboBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : EditImpl( pCtx, xPeer, pWindow ),
+-        mxComboBox( xPeer, uno::UNO_QUERY )
++
++    Link maClickHdl;
++    Link maSelectHdl;
++
++    Window *parent;
++    
++    ComboBoxImpl( Context *context, const PeerHandle &peer, Window *window )
++        : EditImpl( context, peer, window )
++        , mxComboBox( peer, uno::UNO_QUERY )
+     {
+     }
+ 
+-    USHORT InsertEntry( XubString const& rStr, USHORT nPos )
++    ~ComboBoxImpl ();
++
++    sal_uInt16 InsertEntry( XubString const& rStr, sal_uInt16 nPos )
+     {
+         if ( nPos == COMBOBOX_APPEND )
+             nPos = GetEntryCount();
+@@ -316,56 +341,53 @@ public:
+         return nPos;
+     }
+ 
+-    void RemoveEntry( USHORT nPos )
++    void RemoveEntry( sal_uInt16 nPos )
+     {
+         mxComboBox->removeItems( nPos, 1 );
+     }
+ 
+-    USHORT GetEntryPos( const XubString& rStr ) const
++    sal_uInt16 GetEntryPos( const XubString& rStr ) const
+     {
+         uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() );
+         rtl::OUString rKey( rStr );
+         for( unsigned int i = 0; aItems.getLength(); i++ )
+         {
+             if ( aItems[ i ] == rKey )
+-                return sal::static_int_cast< USHORT >( i );
++                return sal::static_int_cast< sal_uInt16 >( i );
+         }
+         return COMBOBOX_ENTRY_NOTFOUND;
+     }
+ 
+-    XubString GetEntry( USHORT nPos ) const
++    XubString GetEntry( sal_uInt16 nPos ) const
+     {
+         return XubString( mxComboBox->getItem( nPos ) );
+     }
+ 
+-    USHORT GetEntryCount() const
++    sal_uInt16 GetEntryCount() const
+     {
+         return mxComboBox->getItemCount();
+     }
+ 
+-    void SetClickHdl( const Link& rLink )
++    void SetClickHdl( Link const& link )
+     {
+-        maClickHdl = rLink;
+-        if ( !rLink )
++        if (!link && !!maClickHdl)
+             mxComboBox->removeActionListener( this );
+-        else
++        else if (!!link && !maClickHdl)
+             mxComboBox->addActionListener( this );
++        maClickHdl = link;
+     }
+ 
+-    void SetSelectHdl( const Link& rLink )
++    void SetSelectHdl( Link const& link )
+     {
+-        maSelectHdl = rLink;
+-        if ( !rLink )
++        if (!link && !!maSelectHdl)
+             mxComboBox->removeItemListener( this );
+-        else
++        else if (!!link && !maSelectHdl)
+             mxComboBox->addItemListener( this );
++        maSelectHdl = link;
+     }
+ 
+-    virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
+-        throw (css::uno::RuntimeException)
+-    {
+-        mxComboBox.clear();
+-    }
++    virtual void SAL_CALL disposing( lang::EventObject const& e )
++        throw (css::uno::RuntimeException);
+ 
+     virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ )
+         throw (css::uno::RuntimeException)
+@@ -386,7 +408,42 @@ public:
+     }
+ };
+ 
+-USHORT ComboBox::InsertEntry( const XubString &rStr, USHORT nPos )
++// inlined, need to redefine
++IMPL_GET_IMPL (Dialog);
++
++ComboBox::~ComboBox ()
++{
++    /* FIXME: hack to fix Find & Replace dialog crasher disposing us
++       twice.  What also works is to comment-out VCLXWindow::dispose
++       ():maFocusListeners.disposeAndClear ().
++
++       It seems VCLX* does not allow an object to be in different
++       listener groups: it will be disposed multiple times?
++    */
++    if (!!getImpl ().mGetFocusHdl || !!getImpl ().mLoseFocusHdl)
++    {
++        OSL_TRACE ("%s: FIXME: prevent duplicate disposal hack", __FUNCTION__);
++        if (getImpl ().mxWindow.is ())
++            getImpl ().mxWindow.clear ();
++        if (Dialog *d = dynamic_cast<Dialog*> (getImpl ().parent))
++            if (WindowImpl *i = dynamic_cast <WindowImpl*> (&d->getImpl()))
++                if (i->mxWindow.is ())
++                    i->mxWindow.clear ();
++    }
++}
++
++ComboBoxImpl::~ComboBoxImpl ()
++{
++}
++
++void ComboBoxImpl::disposing( lang::EventObject const& e )
++    throw (css::uno::RuntimeException)
++{
++    EditImpl::disposing (e);
++    mxComboBox.clear ();
++}
++
 +sal_uInt16 ComboBox::InsertEntry( const XubString &rStr, sal_uInt16 nPos )
  {
      return getImpl().InsertEntry( rStr, nPos );
  }
-@@ -396,7 +397,7 @@ void ComboBox::RemoveEntry( const XubString& rStr )
+@@ -396,7 +450,7 @@ void ComboBox::RemoveEntry( const XubString& rStr )
      getImpl().RemoveEntry( GetEntryPos( rStr ) );
  }
  
@@ -1535,7 +3369,7 @@
  {
      getImpl().RemoveEntry( nPos );
  }
-@@ -407,18 +408,18 @@ void ComboBox::Clear()
+@@ -407,51 +461,68 @@ void ComboBox::Clear()
      getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
  }
  
@@ -1557,7 +3391,62 @@
  {
      return getImpl().GetEntryCount();
  }
-@@ -451,7 +452,7 @@ public:
+ 
+-void ComboBox::SetClickHdl( const Link& rLink )
++void ComboBox::SetClickHdl( const Link& link )
+ {
+-    getImpl().SetClickHdl( rLink );
++    getImpl().SetClickHdl( link );
+ }
+ 
+-void ComboBox::SetSelectHdl( const Link& rLink )
++void ComboBox::SetSelectHdl( const Link& link )
+ {
+-    getImpl().SetSelectHdl( rLink );
++    getImpl().SetSelectHdl( link );
++}
++
++void ComboBox::EnableAutocomplete (bool enable, bool matchCase)
++{
++    GetComboBox ()->EnableAutocomplete (enable, matchCase);
++}
++
++IMPL_CONSTRUCTORS_BODY( ComboBox, Edit, "combobox", getImpl().parent = parent; );
++IMPL_GET_WINDOW (ComboBox);
++/// IMPL_GET_IMPL( ComboBox );
++
++static ComboBoxImpl& null_combobox_impl = (ComboBoxImpl&)*(ComboBoxImpl*)0;
++
++ComboBoxImpl &ComboBox::getImpl () const
++{
++    if (ComboBoxImpl* c = static_cast<ComboBoxImpl *>(mpImpl))
++        return *c;
++    return null_combobox_impl;
+ }
+ 
+-IMPL_CONSTRUCTORS( ComboBox, Edit, "combobox" );
+-IMPL_GET_IMPL( ComboBox );
+ 
+ // Window/Control/ListBox
+-class ListBoxImpl : public ControlImpl,
+-                    public ::cppu::WeakImplHelper1< awt::XActionListener >,
+-                    public ::cppu::WeakImplHelper1< awt::XItemListener >
++class ListBoxImpl : public ControlImpl
++                  , public ::cppu::WeakImplHelper1< awt::XActionListener >
++                  , public ::cppu::WeakImplHelper1< awt::XItemListener >
+ {
+-    Link maClickHdl, maSelectHdl;
++    Link maClickHdl;
++    Link maSelectHdl;
+ public:
+     uno::Reference< awt::XListBox > mxListBox;
+-    ListBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : ControlImpl( pCtx, xPeer, pWindow ),
+-        mxListBox( xPeer, uno::UNO_QUERY )
++    ListBoxImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ControlImpl( context, peer, window ),
++        mxListBox( peer, uno::UNO_QUERY )
+     {
          SelectEntryPos( 0, true );
      }
  
@@ -1566,7 +3455,7 @@
      {
          if ( nPos == LISTBOX_APPEND )
              nPos = mxListBox->getItemCount();
-@@ -459,12 +460,12 @@ public:
+@@ -459,12 +530,12 @@ public:
          return nPos;
      }
  
@@ -1581,7 +3470,7 @@
      {
          if ( nPos == LISTBOX_APPEND )
              nPos = mxListBox->getItemCount();
-@@ -472,41 +473,41 @@ public:
+@@ -472,41 +543,41 @@ public:
          return nPos;
      }
  
@@ -1632,11 +3521,55 @@
          if ( mxListBox->isMutipleMode() )
          {
              uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() );
-@@ -558,12 +559,12 @@ public:
+@@ -518,28 +589,29 @@ public:
+         return nSelected;
+     }
+ 
+-    void SetClickHdl( const Link& rLink )
++    void SetClickHdl( Link const& link )
+     {
+-        maClickHdl = rLink;
+-        if ( !rLink )
++        if (!link && !!maClickHdl)
+             mxListBox->removeActionListener( this );
+-        else
++        else if (!!link && !maClickHdl)
+             mxListBox->addActionListener( this );
++        maClickHdl = link;
+     }
+ 
+-    void SetSelectHdl( const Link& rLink )
++    void SetSelectHdl( Link const& link )
+     {
+-        maSelectHdl = rLink;
+-        if ( !rLink )
++        if (!link && !!maSelectHdl)
+             mxListBox->removeItemListener( this );
+-        else
++        else if (!!link && !maSelectHdl)
+             mxListBox->addItemListener( this );
++        maSelectHdl = link;
+     }
+ 
+-    virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
++    virtual void SAL_CALL disposing( lang::EventObject const& e )
+         throw (css::uno::RuntimeException)
+     {
+-        mxListBox.clear();
++        ControlImpl::disposing (e);
++        mxListBox.clear ();
+     }
+ 
+     void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ )
+@@ -558,12 +630,16 @@ public:
      }
  };
  
 -USHORT ListBox::InsertEntry(const XubString& rStr, USHORT nPos)
++ListBox::~ListBox ()
++{
++}
++
 +sal_uInt16 ListBox::InsertEntry(const XubString& rStr, sal_uInt16 nPos)
  {
      return getImpl().InsertEntry(rStr, nPos);
@@ -1647,7 +3580,7 @@
  {
      return getImpl().RemoveEntry( nPos );
  }
-@@ -579,42 +580,42 @@ void ListBox::Clear()
+@@ -579,57 +655,111 @@ void ListBox::Clear()
      getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
  }
  
@@ -1698,10 +3631,18 @@
  {
      return GetEntry( GetSelectEntryPos( nSelIndex ) );
  }
-@@ -629,7 +630,62 @@ void ListBox::SetClickHdl( const Link& rLink )
-     getImpl().SetClickHdl( rLink );
- }
  
+-void ListBox::SetSelectHdl( const Link& rLink )
++void ListBox::SetSelectHdl( const Link& link )
++{
++    getImpl().SetSelectHdl( link );
++}
++
++void ListBox::SetClickHdl( const Link& link )
++{
++    getImpl().SetClickHdl( link );
++}
++
 +
 +void ListBox::SetEntryData( sal_uInt16 pos, void* data)
 +{
@@ -1715,15 +3656,18 @@
 +
 +// SvxLanguageBox
 +void ListBox::SetLanguageList( sal_Int16/*list*/, bool/*hasLangNone*/, bool /*langNoneIsLangAll*/, bool /*checkSpellAvail*/)
-+{
-+}
-+
+ {
+-    getImpl().SetSelectHdl( rLink );
+ }
+ 
+-void ListBox::SetClickHdl( const Link& rLink )
 +sal_uInt16 ListBox::InsertLanguage( const LanguageType/*type*/, sal_uInt16/*pos*/)
 +{
 +    return 0;
 +}
 +sal_uInt16 ListBox::InsertLanguage( const LanguageType/*type*/, bool/*checkEntry*/, sal_uInt16 /*pos*/)
-+{
+ {
+-    getImpl().SetClickHdl( rLink );
 +    return 0;
 +}
 +void ListBox::RemoveLanguage( const LanguageType/*type*/)
@@ -1739,10 +3683,10 @@
 +bool ListBox::IsLanguageSelected( const LanguageType/*type*/) const
 +{
 +    return true;
-+}
-+
-+
- IMPL_CONSTRUCTORS( ListBox, Control, "listbox" );
+ }
+ 
+-IMPL_CONSTRUCTORS( ListBox, Control, "listbox" );
++IMPL_CONSTRUCTORS ( ListBox, Control, "listbox" );
  IMPL_GET_IMPL( ListBox );
 +IMPL_GET_WINDOW (ListBox);
 +
@@ -1750,8 +3694,8 @@
 +class MultiListBoxImpl : public ListBoxImpl
 +{
 +public:
-+    MultiListBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
-+        : ListBoxImpl( pCtx, xPeer, pWindow )
++    MultiListBoxImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ListBoxImpl( context, peer, window )
 +    {
 +    }
 +};
@@ -1762,10 +3706,93 @@
  
  } // namespace layout
 diff --git a/toolkit/source/vclcompat/wrapper.cxx b/toolkit/source/vclcompat/wrapper.cxx
-index 93f3a5f..c33e407 100644
---- a/toolkit/source/vclcompat/wrapper.cxx
+index 38db3f4..fe81412 100644
+--- toolkit/source/vclcompat/wrapper.cxx
 +++ toolkit/source/vclcompat/wrapper.cxx
-@@ -131,16 +131,16 @@ PeerHandle Context::getToplevel()
+@@ -1,7 +1,7 @@
+ /*************************************************************************
+  *
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- * 
++ *
+  * Copyright 2008 by Sun Microsystems, Inc.
+  *
+  * OpenOffice.org - a multi-platform office productivity suite
+@@ -29,35 +29,41 @@
+  *
+  ************************************************************************/
+ 
++#include <tools/rc.h>
++//#define RESOURCE_PUBLISH_PROTECTED 1
++#if RESOURCE_PUBLISH_PROTECTED
++// ugh, override non-helpful proctection
++#define protected public
++#endif /* RESOURCE_PUBLISH_PROTECTED */
++#include <tools/rc.hxx>
++#undef protected
++
++
+ #include "wrapper.hxx"
+ 
+ #include <awt/vclxplugin.hxx>
++#include <awt/vclxtabcontrol.hxx>
+ #include <com/sun/star/awt/PosSize.hpp>
+ #include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+ #include <com/sun/star/awt/WindowAttribute.hpp>
+ #include <com/sun/star/awt/XDialog2.hpp>
+ #include <com/sun/star/awt/XProgressBar.hpp>
++#include <com/sun/star/awt/XSimpleTabController.hpp>
++#include <com/sun/star/awt/XTabListener.hpp>
+ #include <com/sun/star/graphic/XGraphic.hpp>
+ #include <comphelper/processfactory.hxx>
+-#include <cstdio>
+ #include <layout/factory.hxx>
+ #include <layout/layoutcore.hxx>
+-#include <layout/root.hxx>
+ #include <layout/localized-string.hxx>
++#include <layout/root.hxx>
+ #include <toolkit/awt/vclxwindow.hxx>
+ #include <vcl/ctrl.hxx>
++#include <vcl/dialog.hxx>
+ #include <vcl/image.hxx>
++#include <vcl/tabctrl.hxx>
+ #include <vcl/tabpage.hxx>
+ #include <vcl/window.hxx>
+ 
+- 
+-#if 0
+-/* FIXME: move to sfx2 or svtools/layout.hxx */
+-#include <svtools/itempool.hxx>
+-#include <svtools/itemset.hxx>
+-#include <svtools/poolitem.hxx>
+-#endif
+- 
+ using namespace ::com::sun::star;
+ using rtl::OUString;
+ 
+@@ -105,9 +111,18 @@ public:
+         val >>= xRet;
+         return xRet;
+     }
+-    PeerHandle getTopLevel()                 { return mxTopLevel; }
+-    void setTopLevel( PeerHandle xToplevel ) { mxTopLevel = xToplevel; }
+-    PeerHandle getRoot()                     { return mxRoot; }
++    PeerHandle getTopLevel()
++    {
++        return mxTopLevel;
++    }
++    void setTopLevel( PeerHandle xToplevel )
++    {
++        mxTopLevel = xToplevel;
++    }
++    PeerHandle getRoot()
++    {
++        return mxRoot;
++    }
+ };
+ 
+ Context::Context( const char *pPath )
+@@ -131,16 +146,16 @@ PeerHandle Context::getToplevel()
  }
  PeerHandle Context::getRoot()
  {
@@ -1786,66 +3813,329 @@
      }
  
      if ( nId != 0 )
-@@ -184,33 +184,53 @@ Context *Window::getContext()
-     return this && mpImpl ? mpImpl->mpCtx : NULL;
- }
- 
--PeerHandle Window::GetPeer()
-+PeerHandle Window::GetPeer() const
- {
-     if ( !mpImpl )
-         return PeerHandle();
-     return mpImpl->mxWindow;
- }
- 
--uno::Reference<awt::XWindow> Window::GetRef()
-+uno::Reference<awt::XWindow> Window::GetRef() const
- {
-     return uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY );
- }
- 
--VCLXWindow* Window::GetVCLXWindow()
-+VCLXWindow* Window::GetVCLXWindow() const
- {
-     return VCLXWindow::GetImplementation( GetRef() );
- }
- 
--::Window* Window::GetWindow()
-+::Window* Window::GetWindow() const
- {
-     return GetVCLXWindow()->GetWindow();
+@@ -151,7 +166,72 @@ PeerHandle Context::GetPeerHandle( const char *pId, sal_uInt32 nId ) const
+     return xHandle;
  }
  
--::Window* Window::GetParent()
-+::Window* Window::GetParent() const
- {
-     return GetWindow()->GetParent();
- }
- 
-+void Window::SetHelpId( sal_uIntPtr id )
+-IMPL_GET_IMPL( Control );
++WindowImpl::WindowImpl (Context *context, const PeerHandle &peer, Window *window)
++    : mpWindow (window)
++    , mpCtx (context)
++    , mxWindow (peer, uno::UNO_QUERY)
++    , mxVclPeer (peer, uno::UNO_QUERY)
++    , bFirstTimeVisible (true)
 +{
-+    GetWindow()->SetHelpId( id );
 +}
 +
-+sal_uIntPtr Window::GetHelpId() const
++WindowImpl::~WindowImpl ()
 +{
-+    return GetWindow()->GetHelpId();
++    if (mpWindow)
++        mpWindow->mpImpl = 0;
 +}
 +
-+void Window::SetSmartHelpId( SmartId const& id, SmartIdUpdateMode mode )
++void SAL_CALL WindowImpl::disposing (lang::EventObject const&)
++    throw (uno::RuntimeException)
 +{
-+    GetWindow()->SetSmartHelpId( id, mode );
++///    mxWindow.clear ();
 +}
 +
-+SmartId Window::GetSmartHelpId() const
++void WindowImpl::wrapperGone ()
 +{
-+    return GetWindow()->GetSmartHelpId();
-+}
++    if (mpWindow)
++        mpWindow->mpImpl = 0;
++    mpWindow = 0;
++    mpCtx = 0;
++    if ( mxWindow.is() )
++    {
++        uno::Reference< lang::XComponent > xComp( mxWindow, uno::UNO_QUERY );
++        mxWindow.clear ();
++        if ( xComp.is() )
++            xComp->dispose();
++    }
++}
++
++uno::Any WindowImpl::getProperty (char const* name)
++{
++    if ( !this || !mxVclPeer.is() )
++        return css::uno::Any();
++    return mxVclPeer->getProperty
++        ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ) );
++}
++
++void WindowImpl::setProperty (char const *name, uno::Any any)
++{
++    if ( !this || !mxVclPeer.is() )
++        return;
++    mxVclPeer->setProperty
++        ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ), any );
++}
++
++void WindowImpl::redraw (bool resize)
++{
++    uno::Reference <awt::XWindow> ref (mxWindow, uno::UNO_QUERY);
++    ::Window* window = VCLXWindow::GetImplementation (ref)->GetWindow ();
++    ::Window* parent = window->GetParent();
++    ::Rectangle r = Rectangle (parent->GetPosPixel (),
++                               parent->GetSizePixel ());
++    parent->Invalidate (r, INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN );
++    if (resize)
++        parent->SetPosSizePixel (0, 0, 1, 1, awt::PosSize::SIZE);
++    else
++        parent->SetPosSizePixel (0, 0, r.nRight - r.nLeft, r.nBottom - r.nTop,
++                                 awt::PosSize::SIZE);
++}
+ 
+ Window::Window( WindowImpl *pImpl )
+     : mpImpl( pImpl )
+@@ -161,22 +241,90 @@ Window::Window( WindowImpl *pImpl )
+ Window::~Window()
+ {
+     /* likely to be an UNO object - with floating references */
+-    mpImpl->wrapperGone();
+-    mpImpl = NULL;
++    if (mpImpl)
++        mpImpl->wrapperGone ();
++    mpImpl = 0;
+ }
+ 
+-void Window::SetParent( ::Window *pParent )
++///IMPL_GET_IMPL( Control );
++
++static ControlImpl& null_control_impl = (ControlImpl&)*(ControlImpl*)0;
++
++ControlImpl &Control::getImpl () const
++{
++    if (ControlImpl* c = static_cast<ControlImpl *>(mpImpl))
++        return *c;
++    return null_control_impl;
++}
++
++Control::~Control ()
++{
++    SetGetFocusHdl (Link ());
++    SetLoseFocusHdl (Link ());
++}
++
++void Window::setRes (ResId const& res)
++{
++#if RESOURCE_PUBLISH_PROTECTED
++    // Resources are shut-off from use.  Is that really necessary?
++    Resource &r = *GetWindow ();
++    r.GetRes (res);
++#else /* !RESOURCE_PUBLISH_PROTECTED */
++    //We *must* derive.  Is this also really necessary?
++    //Resource r (res);
++
++    // ugh, I wonder which solution is cleaner...
++    class Resource_open_up : public Resource
++    {
++    public:
++        Resource_open_up (ResId const& r)
++            : Resource (r)
++        {
++        }
++        static sal_Int32 GetLongRes (void *p)
++        {
++            return Resource::GetLongRes (p);
++        }
++        void* GetClassRes ()
++        {
++            return Resource::GetClassRes ();
++        }
++        sal_Int32 ReadLongRes ()
++        {
++            return Resource::ReadLongRes ();
++        }
++        UniString ReadStringRes ()
++        {
++            return Resource::ReadStringRes ();
++        }
++    };
++
++    Resource_open_up r (res);
++#endif /* !RESOURCE_PUBLISH_PROTECTED */
++    if (sal_uInt32 help_id = (sal_uInt32)r.GetLongRes (static_cast<char *> (r.GetClassRes ()) + 12))
++        SetHelpId (help_id);
++    sal_uInt32 mask = r.ReadLongRes ();
++    if ( mask & WINDOW_TEXT )
++        SetText( r.ReadStringRes ());
++}
++
++void Window::SetParent( ::Window *parent )
+ {
+     uno::Reference <awt::XWindow> ref( GetPeer(), uno::UNO_QUERY );
+-    ::Window *window = VCLXWindow::GetImplementation( ref )->GetWindow();
+-    window->SetParent( pParent );
++    if (VCLXWindow *vcl = VCLXWindow::GetImplementation( ref ))
++        if (::Window *window = vcl->GetWindow())
++            window->SetParent( parent );
+ }
+ 
+-void Window::SetParent( Window *pParent )
++void Window::SetParent( Window *parent )
+ {
+-    uno::Reference <awt::XWindow> parentRef( pParent->GetPeer(), uno::UNO_QUERY );
+-    ::Window *parentWindow = VCLXWindow::GetImplementation( parentRef )->GetWindow();
+-    SetParent( parentWindow );
++    /* Let's hear it for C++: poor man's dynamic binding.  */
++    parent->ParentSet (this);
++}
++
++void Window::ParentSet (Window *window)
++{
++    window->SetParent (GetWindow ());
+ }
+ 
+ Context *Window::getContext()
+@@ -184,33 +332,124 @@ Context *Window::getContext()
+     return this && mpImpl ? mpImpl->mpCtx : NULL;
+ }
+ 
+-PeerHandle Window::GetPeer()
++PeerHandle Window::GetPeer() const
+ {
+     if ( !mpImpl )
+         return PeerHandle();
+     return mpImpl->mxWindow;
+ }
+ 
+-uno::Reference<awt::XWindow> Window::GetRef()
++uno::Reference<awt::XWindow> Window::GetRef() const
+ {
+     return uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY );
+ }
+ 
+-VCLXWindow* Window::GetVCLXWindow()
++VCLXWindow* Window::GetVCLXWindow() const
+ {
+     return VCLXWindow::GetImplementation( GetRef() );
+ }
+ 
+-::Window* Window::GetWindow()
++::Window* Window::GetWindow() const
+ {
+     return GetVCLXWindow()->GetWindow();
+ }
+ 
+-::Window* Window::GetParent()
++::Window* Window::GetParent() const
+ {
+     return GetWindow()->GetParent();
+ }
+ 
++void Window::SetHelpId( sal_uIntPtr id )
++{
++    GetWindow()->SetHelpId( id );
++}
++
++sal_uIntPtr Window::GetHelpId() const
++{
++    return GetWindow()->GetHelpId();
++}
++
++void Window::SetSmartHelpId( SmartId const& id, SmartIdUpdateMode mode )
++{
++    GetWindow()->SetSmartHelpId( id, mode );
++}
++
++SmartId Window::GetSmartHelpId() const
++{
++    return GetWindow()->GetSmartHelpId();
++}
++
++void Window::EnterWait ()
++{
++    GetWindow()->EnterWait ();
++}
++void Window::LeaveWait ()
++{
++    GetWindow()->LeaveWait ();
++}
++bool Window::IsWait () const
++{
++    return GetWindow()->IsWait ();
++}
++
++bool Window::IsVisible () const
++{
++    if (GetWindow ())
++        return GetWindow()->IsVisible ();
++    return false;
++}
++
++bool Window::HasChildPathFocus (bool systemWindow) const
++{
++    return GetWindow()->HasChildPathFocus (systemWindow);
++}
++
++void Window::SetPosPixel (Point const&)
++{
++}
++
++Point Window::GetPosPixel () const
++{
++    return Point ();
++}
++
++void Window::SetSizePixel (Size const&)
++{
++}
++
++Size Window::GetSizePixel () const
++{
++    return Size ();
++}
++
++// void Window::Enable (bool enable, bool child);
++// {
++//     GetWindow ()->Enable (enable, child);
++// }
++
++// void Window::Disable (bool child)
++// {
++//     GetWindow ()->Disable (child);
++// }
++
++bool Window::IsEnabled () const
++{
++    return GetWindow ()->IsEnabled ();
++//     if (getImpl().mxWindow.is ())
++//         return getImpl ().mxWindow->isEnabled ();
++//     return false;
++}
++
++void Window::EnableInput (bool enable, bool child)
++{
++    GetWindow ()->EnableInput (enable, child);
++}
++
++bool Window::IsInputEnabled () const
++{
++    return GetWindow ()->IsInputEnabled ();
++}
 +
  struct ToolkitVclPropsMap
  {
      WinBits vclStyle;
-@@ -360,7 +380,7 @@ void Window::Enable( bool bEnable )
+@@ -341,7 +580,7 @@ uno::Reference< awt::XToolkit > getToolkit()
+     return xToolkit;
+ }
+ 
+-PeerHandle Window::CreatePeer( Window *pParent, WinBits nStyle, const char *pName)
++PeerHandle Window::CreatePeer( Window *parent, WinBits nStyle, const char *pName)
+ {
+ 
+     long nWinAttrbs = 0;
+@@ -349,7 +588,7 @@ PeerHandle Window::CreatePeer( Window *pParent, WinBits nStyle, const char *pNam
+         if ( nStyle & toolkitVclPropsMap[ i ].vclStyle )
+             nWinAttrbs |= toolkitVclPropsMap[ i ].initAttr;
+ 
+-    return layoutimpl::createWidget( getToolkit(), pParent->GetPeer(),
++    return layoutimpl::createWidget( getToolkit(), parent->GetPeer(),
+                                      OUString::createFromAscii( pName ), nWinAttrbs );
+ }
+ 
+@@ -360,11 +599,16 @@ void Window::Enable( bool bEnable )
      getImpl().mxWindow->setEnable( bEnable );
  }
  
@@ -1854,15 +4144,34 @@
  {
      if ( !getImpl().mxWindow.is() )
          return;
-@@ -374,6 +394,31 @@ void Window::GrabFocus()
+     getImpl().mxWindow->setVisible( bVisible );
++    if (bVisible && getImpl().bFirstTimeVisible)
++    {
++        getImpl().redraw ();
++        getImpl().bFirstTimeVisible = false;
++    }
+ }
+ 
+ void Window::GrabFocus()
+@@ -374,158 +618,637 @@ void Window::GrabFocus()
      getImpl().mxWindow->setFocus();
  }
  
+-class DialogImpl : public WindowImpl
 +void Window::SetUpdateMode(bool mode)
-+{
+ {
+-public:
+-    uno::Reference< awt::XDialog2 > mxDialog;
+-    DialogImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : WindowImpl( pCtx, xPeer, pWindow )
+-        , mxDialog( xPeer, uno::UNO_QUERY )
+-    {
+-    }
+-};
 +    GetWindow()->SetUpdateMode( mode );
 +}
-+
+ 
+-IMPL_GET_IMPL( Dialog )
 +void Window::SetPointer( Pointer const& pointer )
 +{
 +    GetWindow()->SetPointer( pointer );
@@ -1882,48 +4191,205 @@
 +{
 +    return GetWindow()->GetText();
 +}
-+
- class DialogImpl : public WindowImpl
- {
- public:
-@@ -387,17 +432,17 @@ public:
- 
- IMPL_GET_IMPL( Dialog )
  
 -Dialog::Dialog( Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId )
 -    : Context( pXMLPath )
 -    , Window( new DialogImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
-+Dialog::Dialog( Window *pParent, const char *xml_file, const char *id, sal_uInt32 nId )
-+: Context( xml_file )
-+    , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) )
++sal_Int32 Window::GetCtrlTextWidth (String const&) const
  {
-     if ( pParent )
-         SetParent( pParent );
+-    if ( pParent )
+-        SetParent( pParent );
++    return 0;
  }
  
 -Dialog::Dialog( ::Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId )
 -    : Context( pXMLPath )
 -    , Window( new DialogImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
-+Dialog::Dialog( ::Window *pParent, const char *xml_file, const char *id, sal_uInt32 nId )
++sal_Int32 Window::GetTextHeight () const
+ {
+-    if ( pParent )
+-        SetParent( pParent );
++    return 0;
+ }
+ 
++Size Window::LogicToPixel( Size const& size, MapMode const&) const
++{
++    return size;
++}
++
++ControlImpl::ControlImpl (Context *context, const PeerHandle &peer, Window *window)
++    : WindowImpl( context, peer, window )
++{
++}
++
++ControlImpl::~ControlImpl ()
++{
++    if ((!!mGetFocusHdl || !!mLoseFocusHdl) && mxWindow.is ())
++        /* Disposing will be done @ VCLXWindow::dispose () maFocusListeners.disposeAndClear()
++           don't do it twice */
++        mxWindow.clear ();
++}
++
++void ControlImpl::SetGetFocusHdl (Link const& link)
++{
++    if (!mLoseFocusHdl || !link)
++        UpdateListening (link);
++    mGetFocusHdl = link;
++}
++
++Link& ControlImpl::GetGetFocusHdl ()
++{
++    return mGetFocusHdl;
++}
++
++void ControlImpl::SetLoseFocusHdl (Link const& link)
++{
++    if (!mGetFocusHdl || !link)
++        UpdateListening (link);
++    mLoseFocusHdl = link;
++}
++
++Link& ControlImpl::GetLoseFocusHdl ()
++{
++    return mGetFocusHdl;
++}
++
++void ControlImpl::UpdateListening (Link const& link)
++{
++    if (!link && (!!mGetFocusHdl || !!mLoseFocusHdl)
++        && (!mGetFocusHdl || !mLoseFocusHdl))
++        mxWindow->removeFocusListener (this);
++    else if (!!link && !mGetFocusHdl && !mLoseFocusHdl)
++        mxWindow->addFocusListener (this);
++}
++
++void SAL_CALL ControlImpl::disposing (lang::EventObject const&)
++    throw (uno::RuntimeException)
++{
++    mxWindow.clear ();
++}
++
++void ControlImpl::SAL_CALL focusGained (awt::FocusEvent const&)
++    throw (uno::RuntimeException)
++{
++    mGetFocusHdl.Call (mpWindow);
++}
++
++void ControlImpl::SAL_CALL focusLost (awt::FocusEvent const&)
++    throw (uno::RuntimeException)
++{
++    mLoseFocusHdl.Call (mpWindow);
++}
++
++Link& Control::GetGetFocusHdl ()
++{
++    return getImpl ().GetGetFocusHdl ();
++}
++
++void Control::SetGetFocusHdl (Link const& link)
++{
++    if (&getImpl () && getImpl().mxWindow.is ())
++        getImpl ().SetGetFocusHdl (link);
++}
++
++Link& Control::GetLoseFocusHdl ()
++{
++    return getImpl ().GetLoseFocusHdl ();
++}
++
++void Control::SetLoseFocusHdl (Link const& link)
++{
++    if (&getImpl () && getImpl().mxWindow.is ())
++        getImpl ().SetLoseFocusHdl (link);
++}
++
++DialogImpl::DialogImpl( Context *context, const PeerHandle &peer, Window *window )
++    : WindowImpl( context, peer, window )
++    , mxDialog( peer, uno::UNO_QUERY )
++{
++}
++
++Dialog::Dialog( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId )
 +    : Context( xml_file )
 +    , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) )
++    , bConstruct (true)
++{
++    if ( parent )
++        SetParent( parent );
++}
++
++Dialog::Dialog( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId )
++    : Context( xml_file )
++    , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) )
++{
++    if ( parent )
++        SetParent( parent );
++}
++
++Dialog::~Dialog ()
++{
++}
++
++IMPL_GET_WINDOW (Dialog);
++IMPL_GET_IMPL (Dialog);
++
++#define MX_DIALOG if (getImpl ().mxDialog.is ()) getImpl ().mxDialog
++#define RETURN_MX_DIALOG if (getImpl ().mxDialog.is ()) return getImpl ().mxDialog
++
+ short Dialog::Execute()
  {
-     if ( pParent )
-         SetParent( pParent );
-@@ -419,11 +464,165 @@ void Dialog::EndDialog( long nResult )
+-    if ( !getImpl().mxDialog.is() )
+-        return -1;
+-    return getImpl().mxDialog->execute();
++    RETURN_MX_DIALOG->execute ();
++    return -1;
+ }
+ 
+-void Dialog::EndDialog( long nResult )
++void Dialog::EndDialog( long result )
+ {
+-    if ( !getImpl().mxDialog.is() )
+-        return;
+-    getImpl().mxDialog->endDialog( nResult );
++    MX_DIALOG->endDialog (result);
+ }
  
- void Dialog::SetText( String const& rStr )
+-void Dialog::SetText( String const& rStr )
++void Dialog::SetText( String const& str )
  {
-+    SetTitle (rStr);
+-    if ( !getImpl().mxDialog.is() )
+-        return;
+-    getImpl().mxDialog->setTitle( rStr );
++    SetTitle (str);
+ }
+ 
+-class TabPageImpl : public WindowImpl
++void Dialog::SetTitle( String const& str )
+ {
+-public:
+-    uno::Reference< awt::XWindow > mxTabPage;
+-    TabPageImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : WindowImpl( pCtx, xPeer, pWindow )
+-        , mxTabPage( xPeer, uno::UNO_QUERY )
+-    {
+-    }
+-};
++    MX_DIALOG->setTitle (str);
++}
+ 
+-::Window* TabPage::global_parent = 0;
++bool Dialog::Close ()
++{
++    EndDialog (false);
++    return true;
 +}
 +
-+void Dialog::SetTitle( String const& rStr )
++long Dialog::Notify (NotifyEvent& event)
 +{
-     if ( !getImpl().mxDialog.is() )
-         return;
-     getImpl().mxDialog->setTitle( rStr );
- }
++    return GetDialog ()->Notify (event);
++}
  
+-IMPL_GET_IMPL( TabPage )
 +#define MESSAGE_BOX_MEMBER_INIT\
 +    Dialog (parent, xml_file, id)\
 +        , imageError (this, "FI_ERROR")\
@@ -1947,39 +4413,60 @@
 +    retryButton.Hide ();
 +    init (message, yes, no, help_id);
 +}
-+
+ 
+-TabPage::TabPage( Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
+-    : Context( pXMLPath )
+-    , Window( new TabPageImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
+-    , bHasExchangeSupport( false )
+-    , pSet( set )
 +MessageBox::MessageBox (::Window *parent, OUString const& message,
 +                        OUString yes, OUString no, sal_uIntPtr help_id,
 +                        char const* xml_file, char const* id)
 +    : MESSAGE_BOX_MEMBER_INIT
-+{
+ {
+-    if ( pParent )
+-        SetParent( pParent );
 +    ignoreButton.Hide ();
 +    retryButton.Hide ();
 +    init (message, yes, no, help_id);
-+}
+ }
+ 
+-TabPage::TabPage( ::Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
+-    : Context( pXMLPath )
+-    , Window( new TabPageImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
+-    , bHasExchangeSupport( false )
+-    , pSet( set )
++#if !defined (__GNUC__)
++#define __PRETTY_FUNCTION__ __FUNCTION__
++#endif /* !__GNUC__ */
 +
 +MessageBox::MessageBox (::Window *parent, WinBits bits, char const* message,
 +                        char const* yes, char const* no, sal_uIntPtr help_id,
 +                        char const* xml_file, char const* id)
 +    : MESSAGE_BOX_MEMBER_INIT
-+{
+ {
+-    if ( pParent )
+-        SetParent( pParent );
 +    // HIG suggests using verbs instead of yes/no/retry etc.
 +    // This constructor provides client-code compatibility: Client code should be fixed.
-+    OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __FUNCTION__);
++    OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__);
 +    bits_init (bits, OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id);
-+}
-+
+ }
+ 
+-TabPage::~TabPage()
 +MessageBox::MessageBox (::Window *parent, WinBits bits, OUString const& message,
 +                        OUString yes, OUString no, sal_uIntPtr help_id,
 +                        char const* xml_file, char const* id)
 +    : MESSAGE_BOX_MEMBER_INIT
-+{
+ {
+-    delete GetTabPage();
 +    // HIG suggests using verbs instead of yes/no/retry etc.
 +    // This constructor provides client-code compatibility: Client code should be fixed.
-+    OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __FUNCTION__);
++    OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__);
 +    bits_init (bits, message, yes, no, help_id);
-+}
-+
+ }
+ 
+-IMPL_GET_WINDOW( TabPage );
 +void MessageBox::bits_init (WinBits bits, OUString const& message,
 +                            OUString yes, OUString no, sal_uIntPtr help_id)
 +{
@@ -2002,17 +4489,19 @@
 +        yesButton.Hide ();
 +	if ( !(bits & ( WB_YES_NO | WB_YES_NO_CANCEL)))
 +        noButton.Hide ();
-+    
++
 +    init (message, yes, no, help_id);
 +}
-+
+ 
+-void TabPage::ActivatePage()
 +void MessageBox::init (char const* message, char const* yes, char const* no, sal_uIntPtr help_id)
-+{
+ {
 +    init ( OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id);
-+}
-+
+ }
+ 
+-void TabPage::DeactivatePage()
 +void MessageBox::init (OUString const& message, OUString const& yes, OUString const& no, sal_uIntPtr help_id)
-+{
+ {
 +    imageError.Hide ();
 +    imageInfo.Hide ();
 +    imageQuery.Hide ();
@@ -2034,8 +4523,8 @@
 +        SetHelpId (help_id);
 +    else
 +        helpButton.Hide ();
-+}
-+
+ }
+ 
 +#undef MESSAGE_BOX_IMPL
 +#define MESSAGE_BOX_IMPL(Name)\
 +    Name##Box::Name##Box (::Window *parent, char const* message,\
@@ -2072,77 +4561,426 @@
 +MESSAGE_BOX_IMPL (Query);
 +MESSAGE_BOX_IMPL (Warning);
 +
++class TabControlImpl
++    : public ControlImpl
++    , public ::cppu::WeakImplHelper1 <awt::XTabListener>
++{
++    Link mActivatePageHdl;
++    Link mDeactivatePageHdl;
++
++public:
++    uno::Reference <awt::XSimpleTabController> mxTabControl;
++    TabControlImpl (Context *context, const PeerHandle &peer, Window *window)
++        : ControlImpl (context, peer, window)
++        ,  mxTabControl (peer, uno::UNO_QUERY)
++    {
++    }
++
++    virtual void SAL_CALL disposing (lang::EventObject const& e)
++        throw (uno::RuntimeException)
++    {
++        ControlImpl::disposing (e);
++        mxTabControl.clear ();
++    }
++
++    Link& GetActivatePageHdl ()
++    {
++        return mActivatePageHdl;
++    }
++
++    void SetActivatePageHdl (Link const& link)
++    {
++        if (!mDeactivatePageHdl || !link)
++            UpdateListening (link);
++        mActivatePageHdl = link;
++    }
++
++    Link& GetDeactivatePageHdl ()
++    {
++        return mDeactivatePageHdl;
++    }
++
++    void SetDeactivatePageHdl (Link const& link)
++    {
++        if (!mActivatePageHdl || !link)
++            UpdateListening (link);
++        mDeactivatePageHdl = link;
++    }
++
++    void UpdateListening (Link const& link)
++    {
++        if (!link && (!!mActivatePageHdl || !!mDeactivatePageHdl))
++            mxTabControl->removeTabListener (this);
++        else if (!!link && !mActivatePageHdl && !mDeactivatePageHdl)
++            mxTabControl->addTabListener (this);
++    }
++
++    void SAL_CALL activated (sal_Int32)
++        throw (uno::RuntimeException)
++    {
++        mActivatePageHdl.Call (mpWindow);
++    }
++
++    void SAL_CALL deactivated (sal_Int32)
++        throw (uno::RuntimeException)
++    {
++        mDeactivatePageHdl.Call (mpWindow);
++    }
++
++    void SAL_CALL inserted (sal_Int32)
++        throw (uno::RuntimeException)
++    {
++    }
++
++    void SAL_CALL removed (sal_Int32)
++        throw (uno::RuntimeException)
++    {
++    }
++
++    void SAL_CALL changed (sal_Int32, uno::Sequence <beans::NamedValue> const&)
++        throw (uno::RuntimeException)
++    {
++    }
++};
++
++IMPL_GET_WINDOW (TabControl);
++IMPL_GET_LAYOUT_VCLXWINDOW (TabControl);
++
++#define MX_TABCONTROL if (getImpl ().mxTabControl.is ()) getImpl ().mxTabControl
++#define RETURN_MX_TABCONTROL if (getImpl ().mxTabControl.is ()) return getImpl ().mxTabControl
++
++TabControl::~TabControl ()
++{
++    SetActivatePageHdl (Link ());
++    SetDeactivatePageHdl (Link ());
++}
++
++void TabControl::InsertPage (sal_uInt16 id, String const& title, sal_uInt16 pos)
++{
++    (void) pos;
++//    GetTabControl ()->InsertPage (id, title, pos);
++//    GetTabControl ()->SetTabPage (id, new ::TabPage (GetTabControl ()));
++
++    MX_TABCONTROL->insertTab ();
++    SetCurPageId (id);
++
++#if 1 // colour me loc productive -- NOT
++#define ADD_PROP( seq, i, name, val )\
++    { \
++        beans::NamedValue value; \
++        value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \
++        value.Value = uno::makeAny( val ); \
++        seq[i] = value; \
++    }
++
++    uno::Sequence< beans::NamedValue > seq (1);
++    ADD_PROP ( seq, 0, "Title", OUString (title) );
++    MX_TABCONTROL->setTabProps (id, seq);
++#else
++    GetTabPage (id)->SetText (title);
++#endif
++
+ #if 0
+-SfxTabPage::SfxTabPage( Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
+-    : TabPage( pParent, pXMLPath, pId, nId )
+-    , bHasExchangeSupport( false )
+-    , pSet( set )
++    /// This so seems the right solution, but it makes the buttons of the
++    /// tabdialog move up
++    
++    ::TabPage *page = GetTabPage (id);
++    if (Window *w = dynamic_cast <Window*> (page))
++    {
++        w->SetParent (this);
++        //GetVCLXTabControl ()->Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
++        //GetVCLXTabControl ()->Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
++        //GetVCLXTabControl ()->AddChild (w);
++        //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
++        //uno::Reference <uno::XInterface> x (page->GetWindowPeer());
++        //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->::Window::GetWindowPeer (), uno::UNO_QUERY));
++        //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetComponentInterface (), uno::UNO_QUERY));
++    }
++    getImpl ().redraw ();
++#endif
++}
++void TabControl::RemovePage (sal_uInt16 id)
++{
++    GetTabControl ()->RemovePage (id);
++}
++sal_uInt16 TabControl::GetPageCount () const
++{
++    return GetTabControl ()->GetPageCount ();
++}
++sal_uInt16 TabControl::GetPageId (sal_uInt16 pos) const
++{
++    return GetTabControl ()->GetPageId (pos);
++}
++sal_uInt16 TabControl::GetPagePos (sal_uInt16 id) const
+ {
++    getImpl ().redraw ();
++    return GetTabControl ()->GetPagePos (id);
+ }
++void TabControl::SetCurPageId (sal_uInt16 id)
++{
++    getImpl ().redraw ();
++    GetTabControl ()->SetCurPageId (id);
++}
++sal_uInt16 TabControl::GetCurPageId () const
++{
++    return GetTabControl ()->GetCurPageId ();
++}
++void TabControl::SetTabPage (sal_uInt16 id, ::TabPage* page)
++{
++    GetTabControl ()->SetTabPage (id, page);
+ 
+-SfxTabPage::SfxTabPage( ::Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
+-    : TabPage( pParent, pXMLPath, pId, nId )
++#if 0
++    /// This so seems the right solution, but it makes the buttons of the
++    /// tabdialog move up
++    if (Window *w = dynamic_cast <Window*> (page))
++    {
++        w->SetParent (this);
++        //GetVCLXTabControl ()->Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
++        //GetVCLXTabControl ()->Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
++        //GetVCLXTabControl ()->AddChild (w);
++        //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
++        //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetWindowPeer (), uno::UNO_QUERY));
++        //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetComponentInterface (), uno::UNO_QUERY));
++    }
++#endif
++    getImpl ().redraw ();
++}
++::TabPage* TabControl::GetTabPage (sal_uInt16 id) const
++{
++    return GetTabControl ()->GetTabPage (id);
++}
++void TabControl::SetActivatePageHdl (Link const& link)
+ {
++    getImpl ().SetActivatePageHdl (link);
++}
++Link& TabControl::GetActivatePageHdl () const
++{
++    return getImpl ().GetActivatePageHdl ();
++}
++void TabControl::SetDeactivatePageHdl (Link const& link)
++{
++    getImpl ().SetDeactivatePageHdl (link);
++}
++Link& TabControl::GetDeactivatePageHdl () const
++{
++    return getImpl ().GetDeactivatePageHdl ();
++}
++void TabControl::SetTabPageSizePixel (Size const& size)
++{
++    GetTabControl ()->SetTabPageSizePixel (size);
++//    GetParent()->SetSizePixel (size);
++//    GetWindow()->SetSizePixel (size);
++    //GetVCLXTabControl->SetTabSize (size);
++}
++Size TabControl::GetTabPageSizePixel () const
++{
++#if 0
++    //return GetTabControl ()->GetTabPageSizePixel ();
++    static size_t const tab_page_first_index = 1;
++    for (size_t i = 0; i < GetPageCount (); i++)
++    {
++        ::TabPage *p = GetTabPage (i + tab_page_first_index);
++        //if (dynamic_cast<Windowt*> (p))
++        if (i) // URG
++            return p->GetOptimalSize (WINDOWSIZE_MINIMUM);
++    }
++#endif
++    return GetTabControl ()->GetTabPageSizePixel ();
+ }
+ 
+-/* FIXME: static method, full c&p from sfx2/source/dialog/tabdlg.cxx */
+-//const SfxPoolItem* TabPage::GetItem( const SfxItemSet& rSet, USHORT nSlot )
+-const SfxPoolItem* SfxTabPage::GetItem( const SfxItemSet& rSet, USHORT nSlot )
++IMPL_CONSTRUCTORS (TabControl, Control, "tabcontrol");
++IMPL_GET_IMPL (TabControl);
+ 
++class TabPageImpl : public WindowImpl
+ {
+-	const SfxItemPool* pPool = rSet.GetPool();
+-	USHORT nWh = pPool->GetWhich( nSlot );
+-	const SfxPoolItem* pItem = 0;
+-#ifdef DEBUG
+-	SfxItemState eState;
+-    eState =
+-#endif
+-			rSet.GetItemState( nWh, TRUE, &pItem );  // -Wall required??
++public:
++    uno::Reference< awt::XWindow > mxTabPage;
++    TabPageImpl( Context *context, const PeerHandle &peer, Window *window )
++        : WindowImpl( context, peer, window )
++        , mxTabPage( peer, uno::UNO_QUERY )
++    {
++    }
++};
++
++::Window* TabPage::global_parent = 0;
++TabControl* TabPage::global_tabcontrol = 0;
 +
- class TabPageImpl : public WindowImpl
- {
- public:
-@@ -439,9 +638,9 @@ public:
++IMPL_GET_IMPL( TabPage );
  
- IMPL_GET_IMPL( TabPage )
- 
--TabPage::TabPage( Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
--    : Context( pXMLPath )
--    , Window( new TabPageImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
-+TabPage::TabPage( Window *pParent, const char *xml_file, const char *id, sal_uInt32 nId, SfxItemSet const* set )
-+: Context( xml_file )
+-	if ( !pItem && nWh != nSlot )
+-		pItem = &pPool->GetDefaultItem( nWh );
+-	return pItem;
++TabPage::TabPage( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId)
++    : Context( xml_file )
 +    , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) )
-     , bHasExchangeSupport( false )
-     , pSet( set )
- {
-@@ -449,9 +648,9 @@ TabPage::TabPage( Window *pParent, const char *pXMLPath, const char *pId, sal_uI
-         SetParent( pParent );
++{
++    if ( parent )
++        SetParent( parent );
  }
+-#else 
  
--TabPage::TabPage( ::Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
--    : Context( pXMLPath )
--    , Window( new TabPageImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
-+TabPage::TabPage( ::Window *pParent, const char *xml_file, const char *id, sal_uInt32 nId, SfxItemSet const* set )
+-#define SfxTabPage TabPage
++TabPage::TabPage( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId)
 +    : Context( xml_file )
 +    , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) )
-     , bHasExchangeSupport( false )
-     , pSet( set )
++{
++    if ( parent )
++        SetParent( parent );
++}
+ 
+-#endif
++TabPage::~TabPage()
++{
++    delete GetTabPage();
++}
+ 
+-void SfxTabPage::Reset( SfxItemSet const& )
++IMPL_GET_WINDOW( TabPage );
++
++void TabPage::ActivatePage()
++{
++}
++
++void TabPage::DeactivatePage()
  {
-@@ -475,31 +674,31 @@ void TabPage::DeactivatePage()
  }
  
- #if 0
--SfxTabPage::SfxTabPage( Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
--    : TabPage( pParent, pXMLPath, pId, nId )
-+SfxTabPage::SfxTabPage( Window *pParent, const char *xml_file, const char *id, sal_uInt32 nId, SfxItemSet const* set )
-+    : TabPage( pParent, xml_file, id, nId )
-     , bHasExchangeSupport( false )
-     , pSet( set )
+ class FixedLineImpl : public ControlImpl
  {
- }
+ public:
+-    FixedLineImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : ControlImpl( pCtx, xPeer, pWindow )
++    FixedLineImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ControlImpl( context, peer, window )
+     {
+     }
+ };
  
--SfxTabPage::SfxTabPage( ::Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
--    : TabPage( pParent, pXMLPath, pId, nId )
-+SfxTabPage::SfxTabPage( ::Window *pParent, const char *xml_file, const char *id, sal_uInt32 nId, SfxItemSet const* set )
-+    : TabPage( pParent, xml_file, id, nId )
+ IMPL_CONSTRUCTORS( FixedLine, Control, "hfixedline" );
+-IMPL_GET_IMPL( FixedLine )
++IMPL_GET_IMPL( FixedLine );
+ 
+ bool FixedLine::IsEnabled()
  {
- }
+@@ -537,21 +1260,35 @@ class FixedTextImpl : public ControlImpl
+ {
+ public:
+     uno::Reference< awt::XFixedText > mxFixedText;
+-    FixedTextImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : ControlImpl( pCtx, xPeer, pWindow )
+-        , mxFixedText( xPeer, uno::UNO_QUERY )
++    FixedTextImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ControlImpl( context, peer, window )
++        , mxFixedText( peer, uno::UNO_QUERY )
+     {
+     }
  
- /* FIXME: static method, full c&p from sfx2/source/dialog/tabdlg.cxx */
--//const SfxPoolItem* TabPage::GetItem( const SfxItemSet& rSet, USHORT nSlot )
--const SfxPoolItem* SfxTabPage::GetItem( const SfxItemSet& rSet, USHORT nSlot )
-+//const SfxPoolItem* TabPage::GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot )
-+const SfxPoolItem* SfxTabPage::GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot )
+-    virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
+-        throw (css::uno::RuntimeException)
+-    {
+-        mxFixedText.clear();
+-    }
++    ~FixedTextImpl ();
++
++    virtual void SAL_CALL disposing( lang::EventObject const& e )
++        throw (uno::RuntimeException);
+ };
  
++FixedTextImpl::~FixedTextImpl ()
++{
++}
++
++void SAL_CALL FixedTextImpl::disposing( lang::EventObject const& e )
++    throw (uno::RuntimeException)
++{
++    ControlImpl::disposing (e);
++    mxFixedText.clear ();
++}
++
++FixedText::~FixedText ()
++{
++}
++
+ IMPL_CONSTRUCTORS( FixedText, Control, "fixedtext" );
+-IMPL_GET_IMPL( FixedText )
++IMPL_GET_IMPL( FixedText );
+ 
+ void FixedText::SetText( String const& rStr )
  {
- 	const SfxItemPool* pPool = rSet.GetPool();
--	USHORT nWh = pPool->GetWhich( nSlot );
-+	sal_uInt16 nWh = pPool->GetWhich( nSlot );
- 	const SfxPoolItem* pItem = 0;
- #ifdef DEBUG
- 	SfxItemState eState;
-     eState =
- #endif
--			rSet.GetItemState( nWh, TRUE, &pItem );  // -Wall required??
-+        rSet.GetItemState( nWh, true, &pItem );  // -Wall required??
+@@ -563,8 +1300,8 @@ void FixedText::SetText( String const& rStr )
+ class FixedInfoImpl : public FixedTextImpl
+ {
+ public:
+-    FixedInfoImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : FixedTextImpl( pCtx, xPeer, pWindow )
++    FixedInfoImpl( Context *context, const PeerHandle &peer, Window *window )
++        : FixedTextImpl( context, peer, window )
+     {
+     }
+ };
+@@ -576,16 +1313,17 @@ class ProgressBarImpl : public ControlImpl
+ {
+ public:
+     uno::Reference< awt::XProgressBar > mxProgressBar;
+-    ProgressBarImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : ControlImpl( pCtx, xPeer, pWindow )
+-        , mxProgressBar( xPeer, uno::UNO_QUERY )
++    ProgressBarImpl( Context *context, const PeerHandle &peer, Window *window )
++        : ControlImpl( context, peer, window )
++        , mxProgressBar( peer, uno::UNO_QUERY )
+     {
+     }
+ 
+-    virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
+-        throw (css::uno::RuntimeException)
++    virtual void SAL_CALL disposing( lang::EventObject const& e )
++        throw (uno::RuntimeException)
+     {
+-        mxProgressBar.clear();
++        ControlImpl::disposing (e);
++        mxProgressBar.clear ();
+     }
+ };
  
- 	if ( !pItem && nWh != nSlot )
- 		pItem = &pPool->GetDefaultItem( nWh );
-@@ -625,7 +824,7 @@ void FixedImage::setImage( ::Image const& i )
+@@ -594,11 +1332,11 @@ class FixedImageImpl: public ControlImpl
+ {
+ public:
+     uno::Reference< graphic::XGraphic > mxGraphic;
+-    FixedImageImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow)
++    FixedImageImpl( Context *context, const PeerHandle &peer, Window *window)
+ //                    const char *pName )
+-        : ControlImpl( pCtx, xPeer, pWindow )
++        : ControlImpl( context, peer, window )
+           //, mxGraphic( layoutimpl::loadGraphic( pName ) )
+-        , mxGraphic( xPeer, uno::UNO_QUERY )
++        , mxGraphic( peer, uno::UNO_QUERY )
+     {
+         if ( !mxGraphic.is() )
+         {
+@@ -620,12 +1358,12 @@ void FixedImage::setImage( ::Image const& i )
+     if ( !getImpl().mxGraphic.is() )
+         return;
+     //FIXME: hack moved to proplist
+-    //getImpl().mxGraphic = 
++    //getImpl().mxGraphic =
+ }
  
  #if 0
  
@@ -2151,18 +4989,53 @@
      : pImpl( new FixedImageImpl( pName ) )
  {
  }
-@@ -640,8 +839,8 @@ FixedImage::~FixedImage()
-     
- IMPL_CONSTRUCTORS( ProgressBar, Control, "ProgressBar" );
- #if 0
+@@ -637,31 +1375,18 @@ FixedImage::~FixedImage()
+ 
+ #endif
+ 
+-    
+-IMPL_CONSTRUCTORS( ProgressBar, Control, "ProgressBar" );
+-#if 0
 -ProgressBar::ProgressBar( Context *pCtx, const char *pId, sal_uInt32 nId )
 -    : Control( new ProgressBarImpl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) )
-+ProgressBar::ProgressBar( Context *pCtx, const char *id, sal_uInt32 nId )
-+    : Control( new ProgressBarImpl( pCtx, pCtx->GetPeerHandle( id, nId ), this ) )
+-{
+-}
+-ProgressBar::ProgressBar( Window *pParent, WinBits nBits)
+-//    : Control( new ProgressBarImpl( pParent->getContext(), Window::CreatePeer( pParent, nBits, "ProgressBar" ), this ) )
+-    : Control( new ProgressBarImpl( pParent->getContext(), Window::CreatePeer( pParent, nBits, "progressbar" ), this ) )
+-{
+-}
+-#endif
+ 
++IMPL_CONSTRUCTORS( ProgressBar, Control, "ProgressBar" );
+ IMPL_GET_IMPL( ProgressBar );
+ 
+-
+-void ProgressBar::SetForegroundColor( css::util::Color color )
++void ProgressBar::SetForegroundColor( util::Color color )
  {
+     if ( !getImpl().mxProgressBar.is() )
+         return;
+     getImpl().mxProgressBar->setForegroundColor( color );
  }
- ProgressBar::ProgressBar( Window *pParent, WinBits nBits)
-@@ -706,14 +905,14 @@ public:
+ 
+-void ProgressBar::SetBackgroundColor( css::util::Color color )
++void ProgressBar::SetBackgroundColor( util::Color color )
+ {
+     if ( !getImpl().mxProgressBar.is() )
+         return;
+@@ -694,8 +1419,8 @@ class PluginImpl: public ControlImpl
+ public:
+     ::Control *mpPlugin;
+ 
+-    PluginImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow, :: Control *plugin )
+-        : ControlImpl( pCtx, xPeer, pWindow )
++    PluginImpl( Context *context, const PeerHandle &peer, Window *window, :: Control *plugin )
++        : ControlImpl( context, peer, window )
+         , mpPlugin( plugin )
+     {
+         uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY );
+@@ -706,14 +1431,14 @@ public:
          vcl->SetPlugin( mpPlugin );
          plugin->SetParent( parent );
          plugin->SetStyle( vcl->mStyle );
@@ -2175,50 +5048,315 @@
  
 -Plugin::Plugin( Context *pCtx, char const *pId, ::Control *plugin )
 -    : Control( new PluginImpl( pCtx, pCtx->GetPeerHandle( pId, 0 ), this, plugin ) )
-+Plugin::Plugin( Context *pCtx, char const *id, ::Control *plugin )
-+    : Control( new PluginImpl( pCtx, pCtx->GetPeerHandle( id, 0 ), this, plugin ) )
++Plugin::Plugin( Context *context, char const *id, ::Control *plugin )
++    : Control( new PluginImpl( context, context->GetPeerHandle( id, 0 ), this, plugin ) )
      , mpPlugin( plugin )
  {
  }
-@@ -776,8 +943,8 @@ public:
+@@ -724,8 +1449,8 @@ class LocalizedStringImpl : public WindowImpl
+ {
+ public:
+     layoutimpl::LocalizedString *mpString;
+-    LocalizedStringImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : WindowImpl( pCtx, xPeer, pWindow )
++    LocalizedStringImpl( Context *context, const PeerHandle &peer, Window *window )
++        : WindowImpl( context, peer, window )
+         , mpString( static_cast<layoutimpl::LocalizedString*>( VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( mxWindow, uno::UNO_QUERY ) ) ) )
+     {
+     }
+@@ -744,8 +1469,8 @@ public:
  
  IMPL_GET_IMPL( LocalizedString );
  
 -LocalizedString::LocalizedString( Context *pCtx, char const* pId )
 -    : Window( new LocalizedStringImpl( pCtx, pCtx->GetPeerHandle( pId, 0 ), this ) )
-+LocalizedString::LocalizedString( Context *pCtx, char const* id )
-+    : Window( new LocalizedStringImpl( pCtx, pCtx->GetPeerHandle( id, 0 ), this ) )
++LocalizedString::LocalizedString( Context *context, char const* id )
++    : Window( new LocalizedStringImpl( context, context->GetPeerHandle( id, 0 ), this ) )
  {
  }
  
+@@ -760,4 +1485,49 @@ String LocalizedString::operator= (String const& s)
+     return getImpl().getText();
+ }
+ 
++class InPlugImpl : public WindowImpl
++{
++public:
++    InPlugImpl (Context *context, const PeerHandle &peer, Window *window)
++        : WindowImpl (context, peer, window)
++    {
++    }
++};
++
++IMPL_GET_IMPL (InPlug);
++
++static char const *FIXME_set_parent (::Window *parent, char const *xml_file)
++{
++    layout::TabPage::global_parent = parent;
++    return xml_file;
++}
++
++InPlug::InPlug (Window *parent, char const* xml_file, char const* id, sal_uInt32 nId)
++    : Context (FIXME_set_parent (parent ? parent->GetWindow () : 0, xml_file))
++    , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this))
++{
++    if (parent)
++        SetParent (parent);
++    if (::Window *w = dynamic_cast< ::Window* > (this))
++        w->SetComponentInterface (GetVCLXWindow ());
++}
++
++InPlug::InPlug (::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId)
++    : Context (FIXME_set_parent (parent, xml_file))
++    , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this))
++{
++    if (parent)
++        layout::Window::SetParent (parent);
++    if (::Window *w = dynamic_cast< ::Window* > (this))
++        w->SetComponentInterface (GetVCLXWindow ());
++}
++
++void InPlug::ParentSet (Window *window)
++{
++    window->SetParent (dynamic_cast< ::Window* > (this));
++
++    /// FIXME: for standalone run of layout::SfxTabDialog
++    SetParent (window->GetParent ());
++}
++
+ } // namespace layout
 diff --git a/toolkit/source/vclcompat/wrapper.hxx b/toolkit/source/vclcompat/wrapper.hxx
-index 25dbd90..36a491f 100644
---- a/toolkit/source/vclcompat/wrapper.hxx
+index 25dbd90..5305b05 100644
+--- toolkit/source/vclcompat/wrapper.hxx
 +++ toolkit/source/vclcompat/wrapper.hxx
-@@ -112,15 +112,22 @@ inline WindowImpl &Window::getImpl() const
+@@ -34,8 +34,11 @@
+ 
+ #include <layout/layout.hxx>
+ #include <com/sun/star/uno/Reference.hxx>
++#include <com/sun/star/awt/XDialog2.hpp>
++#include <com/sun/star/awt/XFocusListener.hpp>
+ #include <com/sun/star/awt/XWindow.hpp>
+ #include <com/sun/star/awt/XVclWindowPeer.hpp>
++#include <cppuhelper/implbase1.hxx>
+ 
+ #include <cstring>
+ 
+@@ -46,64 +49,55 @@ namespace css = com::sun::star;
+ 
+ class WindowImpl
+ {
+-  public:
++public:
+     Window *mpWindow;
+     Context *mpCtx;
+     css::uno::Reference< css::awt::XWindow > mxWindow;
+     css::uno::Reference< css::awt::XVclWindowPeer > mxVclPeer;
++    bool bFirstTimeVisible;
+ 
+-    WindowImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : mpWindow( pWindow )
+-        , mpCtx( pCtx )
+-        , mxWindow( xPeer, css::uno::UNO_QUERY )
+-        , mxVclPeer( xPeer, css::uno::UNO_QUERY )
+-    {
+-    }
+-
+-    virtual ~WindowImpl()
+-    {
+-    }
++    WindowImpl (Context *context, PeerHandle const &peer, Window *window);
++    virtual ~WindowImpl ();
+ 
+-    void wrapperGone()
+-    {
+-        mpWindow = NULL;
+-        mpCtx = NULL;
+-        if ( mxWindow.is() )
+-        {
+-            css::uno::Reference< css::lang::XComponent > xComp( mxWindow, css::uno::UNO_QUERY );
+-            mxWindow.clear();
+-            if ( xComp.is() )
+-                xComp->dispose();
+-        }
+-    }
++    void wrapperGone();
++    css::uno::Any getProperty (char const *name);
++    void setProperty (char const *name, css::uno::Any any);
++    void redraw (bool resize=false);
+ 
+-    css::uno::Any getProperty( const char *pName )
+-    {
+-        if ( !this || !mxVclPeer.is() )
+-            return css::uno::Any();
+-        return mxVclPeer->getProperty
+-            ( rtl::OUString( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US ) );
+-    }
+-    void setProperty( const char *pName, css::uno::Any aAny )
+-    {
+-        if ( !this || !mxVclPeer.is() )
+-            return;
+-        mxVclPeer->setProperty
+-            ( rtl::OUString( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US ), aAny );
+-    }
++    // XFocusListener
++    virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException);
+ };
+ 
+ class ControlImpl : public WindowImpl
++                  , public ::cppu::WeakImplHelper1 <css::awt::XFocusListener>
+ {
+-  public:
+-    ControlImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
+-        : WindowImpl( pCtx, xPeer, pWindow )
+-    {
+-    }
++public:
++    Link mGetFocusHdl;
++    Link mLoseFocusHdl;
++
++    ControlImpl( Context *context, PeerHandle const& peer, Window *window );
++    ~ControlImpl ();
++
++    virtual void SetGetFocusHdl (Link const& link);
++    Link& GetGetFocusHdl ();
++    virtual void SetLoseFocusHdl (Link const& link);
++    Link& GetLoseFocusHdl ();
++    virtual void UpdateListening (Link const& link);
++
++    // XFocusListener
++    virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException);
++    void SAL_CALL focusGained (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException);
++    void SAL_CALL focusLost (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException);
+ };
+ 
+-inline WindowImpl &Window::getImpl() const
+-{ return *(static_cast< WindowImpl * >( mpImpl )); }
++class DialogImpl : public WindowImpl
++{
++public:
++    css::uno::Reference< css::awt::XDialog2 > mxDialog;
++    DialogImpl( Context *context, PeerHandle const &peer, Window *window );
++};
++
++inline WindowImpl &Window::getImpl() const{ return *(static_cast< WindowImpl * >( mpImpl )); }
+ 
+ // Helpers for defining boiler-plate constructors ...
+ // Could in-line in top-level but not with safe static_casts.
+@@ -112,23 +106,39 @@ inline WindowImpl &Window::getImpl() const
      { \
          return *(static_cast<t##Impl *>(mpImpl)); \
      }
 -#define IMPL_CONSTRUCTORS(t,par,unoName) \
+-    t::t( Context *pCtx, const char *pId, sal_uInt32 nId ) \
+-        : par( new t##Impl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) \
 +#define IMPL_CONSTRUCTORS_BODY(t,par,unoName,body) \
-     t::t( Context *pCtx, const char *pId, sal_uInt32 nId ) \
-         : par( new t##Impl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) \
++    t::t( Context *context, const char *pId, sal_uInt32 nId ) \
++        : par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \
++    { \
++        Window *parent = dynamic_cast<Window*> (context);\
++        body;\
++        if (parent)\
++            SetParent (parent);\
++    } \
++    t::t( Window *parent, WinBits bits) \
++        : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \
      { \
-+      body\
-+      if (Window *w = dynamic_cast<Window*> (pCtx))\
-+          SetParent (w);\
++        body;\
++        if ( parent )\
++            SetParent (parent);\
      } \
-     t::t( Window *pParent, WinBits nBits) \
-         : par( new t##Impl( pParent->getContext(), Window::CreatePeer( pParent, nBits, unoName ), this ) ) \
+-    t::t( Window *pParent, WinBits nBits) \
+-        : par( new t##Impl( pParent->getContext(), Window::CreatePeer( pParent, nBits, unoName ), this ) ) \
++    t::t( Window *parent, ResId const& res) \
++        : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, 0, unoName ), this ) ) \
      { \
-+      body\
-+      if ( pParent )\
-+          SetParent (pParent);\
++        body;\
++        setRes (res);\
++        if (parent)\
++            SetParent (parent);\
      }
 +#define IMPL_CONSTRUCTORS(t,par,unoName) IMPL_CONSTRUCTORS_BODY(t, par, unoName, )
  #define IMPL_CONSTRUCTORS_2(t,win_par,other_par,unoName) \
-     t::t( Context *pCtx, const char *pId, sal_uInt32 nId ) \
-         : win_par( new t##Impl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) \
+-    t::t( Context *pCtx, const char *pId, sal_uInt32 nId ) \
+-        : win_par( new t##Impl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) \
++    t::t( Context *context, const char *pId, sal_uInt32 nId ) \
++        : win_par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \
+         , other_par( new other_par##Impl( Window::GetPeer() ) ) \
+     { \
+     } \
+-    t::t( Window *pParent, WinBits nBits) \
+-        : win_par( new t##Impl( pParent->getContext(), Window::CreatePeer( pParent, nBits, unoName ), this ) ) \
++    t::t( Window *parent, WinBits bits) \
++        : win_par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \
+         , other_par( new other_par##Impl( Window::GetPeer() ) ) \
+     { \
+     }
+diff --git a/toolkit/src2xml/source/boxer.py b/toolkit/src2xml/source/boxer.py
+index c697ec8..1b716d7 100644
+--- toolkit/src2xml/source/boxer.py
++++ toolkit/src2xml/source/boxer.py
+@@ -9,11 +9,11 @@ class DlgLayoutBuilder(object):
+ 
+     def addWidget (self, elem):
+         x, y = int(elem.getAttr('x')), int(elem.getAttr('y'))
+-        if self.rows.has_key(y):
+-            self.rows[y][x] = elem
+-        else:
+-            self.rows[y] = {}
+-            self.rows[y][x] = elem
++        self.rows[y] = self.rows.get (y, {})
++        while self.rows[y].has_key(x):
++            y += 1
++            self.rows[y] = self.rows.get (y, {})
++        self.rows[y][x] = elem
+ 
+     def build (self):
+         root = Element('vbox')
+@@ -53,6 +53,8 @@ class Boxer(object):
+ 
+         newnode = Element(dlgnode.name)
+         newnode.clone(dlgnode)
++        if dlgnode.name == 'string':
++            return newnode
+         newnode.setAttr("xmlns", "http://openoffice.org/2007/layout";)
+         newnode.setAttr("xmlns:cnt", "http://openoffice.org/2007/layout/container";)
+         mx = DlgLayoutBuilder(newnode)
+diff --git a/toolkit/src2xml/source/src2xml.py b/toolkit/src2xml/source/src2xml.py
+index fdcc0fb..128cfa1 100644
+--- toolkit/src2xml/source/src2xml.py
++++ toolkit/src2xml/source/src2xml.py
+@@ -127,7 +127,6 @@ def convert (file_name, options):
+     lexer.includeDirs = options.include_path
+     lexer.stopOnHeader = options.stopOnHeader
+     lexer.debugMacro = options.debug_macro
+-#     lexer.debug = True
+     if options.debug_lexer:
+         lexer.debug = True
+         lexer.tokenize()
+@@ -145,8 +144,8 @@ def convert (file_name, options):
+     if options.debug_parser:
+         parser.debug = True
+         root = parser.parse()
+-        print root.dump()
+-        return
++        s = root.dump()
++        return s
+ 
+     # Parse the tokens.
+     root = parser.parse()
+@@ -174,9 +173,11 @@ def post_process (s):
+     """Make output directly usable by layout module."""
+     s = re.sub ('(</?)([a-z]+)-([a-z]+)-([a-z]+)', r'\1\2\3\4', s)
+     s = re.sub ('(</?)([a-z]+)-([a-z]+)', r'\1\2\3', s)
+-    s = re.sub ('(<(checkbox|radiobutton|(fixed(info|text)))[^>]*) text=', r'\1 label=', s)
++    s = re.sub ('(<(checkbox|(cancel|help|ignore|ok|push|more|no|radio|reset|retry|yes)button|(fixed(info|text)))[^>]*) text=', r'\1 label=', s)
+     s = re.sub (' (height|width|x|y)="[0-9]*"', '', s)
+     s = re.sub (' (label|text|title)="', r' _\1="', s)
++    s = re.sub ('&([^m][^p]*[^;]*)', r'&amp;\1', s)
++    s = re.sub (' hide="(TRUE|true|1)"', ' show="false"', s)
+ 
+     s = s.replace ('<modaldialog', '<modaldialog sizeable="true"')
+     s = s.replace (' rid=', ' id=')
 diff --git a/toolkit/uiconfig/layout/delzip b/toolkit/uiconfig/layout/delzip
 new file mode 100644
 index 0000000..7b4d68d
@@ -2236,10 +5374,10 @@
 +#empty
 diff --git a/toolkit/uiconfig/layout/makefile.mk b/toolkit/uiconfig/layout/makefile.mk
 new file mode 100644
-index 0000000..2cc6d95
+index 0000000..c3d1e5a
 --- /dev/null
 +++ toolkit/uiconfig/layout/makefile.mk
-@@ -0,0 +1,57 @@
+@@ -0,0 +1,58 @@
 +#*************************************************************************
 +#
 +#   OpenOffice.org - a multi-platform office productivity suite
@@ -2287,6 +5425,7 @@
 +
 +XML_FILES=\
 +  message-box.xml\
++  tab-dialog.xml\
 +
 +#
 +
@@ -2344,9 +5483,35 @@
 +	</dialogbuttonhbox>
 +    </vbox>
 +</modaldialog>
+diff --git a/toolkit/uiconfig/layout/tab-dialog.xml b/toolkit/uiconfig/layout/tab-dialog.xml
+new file mode 100644
+index 0000000..1d631e9
+--- /dev/null
++++ toolkit/uiconfig/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 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/util/makefile.pmk b/toolkit/util/makefile.pmk
 index f88a240..acf6ba4 100644
---- a/toolkit/util/makefile.pmk
+--- toolkit/util/makefile.pmk
 +++ toolkit/util/makefile.pmk
 @@ -41,7 +41,5 @@ CFLAGS += -xldscope=hidden
  
@@ -2430,8 +5595,8 @@
 +    </vbox>
 +</modaldialog>
 diff --git a/toolkit/workben/layout/makefile.mk b/toolkit/workben/layout/makefile.mk
-index e82e1c9..4f2a2e1 100644
---- a/toolkit/workben/layout/makefile.mk
+index e82e1c9..cd0f327 100644
+--- toolkit/workben/layout/makefile.mk
 +++ toolkit/workben/layout/makefile.mk
 @@ -43,12 +43,10 @@ ENABLE_EXCEPTIONS=TRUE
  CFLAGS += -I$(PRJ)/source/layout
@@ -2447,7 +5612,7 @@
  .IF "$(COMNAME)" == "gcc3"
  CFLAGS+=-Wall -Wno-non-virtual-dtor
  .ENDIF
-@@ -92,8 +90,12 @@ default: ALLTAR
+@@ -92,8 +90,13 @@ default: ALLTAR
  .INCLUDE : target.mk
  
  XML_FILES=\
@@ -2457,14 +5622,16 @@
  	recover.xml\
  	sort-options.xml\
 +	string-input.xml\
++	tab-dialog.xml\
  	wordcount.xml\
  	zoom.xml\
  
-@@ -119,12 +121,15 @@ $(svtools):
+@@ -119,12 +122,16 @@ $(svtools):
  	ln -sf ..$/$(PRJ)$/svtools$/inc $(INCCOM)$/svtools
  
  dist .PHONY :
 +	cp -pv message-box.xml $(PRJ)/uiconfig/layout
++	cp -pv tab-dialog.xml $(PRJ)/uiconfig/layout
  	$(SHELL) ./un-test.sh zoom.cxx > ../$(PRJ)/svx/source/dialog/zoom.cxx
  	$(SHELL) ./un-test.sh zoom.hxx > ../$(PRJ)/svx/source/dialog/zoom.hxx
  	touch ../$(PRJ)/svx/source/dialog/dlgfact.cxx
@@ -2476,7 +5643,7 @@
  	# FIXME: broken setup
  	ln -sf ../inc/wordcountdialog.hxx ../$(PRJ)/sw/source/ui/dialog/wordcountdialog.hxx 
  	$(SHELL) ./un-test.sh tpsort.cxx > ../$(PRJ)/sc/source/ui/dbgui/tpsort.cxx
-@@ -133,6 +138,10 @@ dist .PHONY :
+@@ -133,6 +140,10 @@ dist .PHONY :
  	$(SHELL) ./un-test.sh sortdlg.hxx > ../$(PRJ)/sc/source/ui/inc/sortdlg.hxx
  	touch ../$(PRJ)/sc/source/ui/attrdlg/scdlgfact.cxx
  	touch ../$(PRJ)/sc/source/ui/view/cellsh2.cxx
@@ -2563,7 +5730,7 @@
 +</modaldialog>
 diff --git a/toolkit/workben/layout/recover.cxx b/toolkit/workben/layout/recover.cxx
 index 706ee21..a0cc56b 100644
---- a/toolkit/workben/layout/recover.cxx
+--- toolkit/workben/layout/recover.cxx
 +++ toolkit/workben/layout/recover.cxx
 @@ -55,6 +55,13 @@ using namespace com::sun::star;
  
@@ -2579,6 +5746,86 @@
  #if TEST_LAYOUT
  SvxRecoverDialog::SvxRecoverDialog( Window* pParent )
  #else /* !TEST_LAYOUT */
+diff --git a/toolkit/workben/layout/sort-options.xml b/toolkit/workben/layout/sort-options.xml
+index e2e01f0..43144c1 100644
+--- toolkit/workben/layout/sort-options.xml
++++ toolkit/workben/layout/sort-options.xml
+@@ -33,8 +33,8 @@
+ 		<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)"/>
++            <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
+index e7731ef..3a6a243 100644
+--- toolkit/workben/layout/sortdlg.cxx
++++ toolkit/workben/layout/sortdlg.cxx
+@@ -42,8 +42,9 @@
+ #include "scresid.hxx"
+ #include "sortdlg.hrc"
+ 
+-
+-//==================================================================
++#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
++#include <layout/layout-pre.hxx>
++#endif
+ 
+ ScSortDlg::ScSortDlg( Window*			pParent,
+ 					  const SfxItemSet* pArgSet ) :
+@@ -54,8 +55,15 @@ ScSortDlg::ScSortDlg( Window*			pParent,
+ 		bIsByRows	( FALSE )
+ 
+ {
++#ifdef LAYOUT_SFX_TABDIALOG_BROKEN
+ 	AddTabPage( TP_FIELDS,	ScTabPageSortFields::Create,  0 );
+ 	AddTabPage( TP_OPTIONS,	ScTabPageSortOptions::Create, 0 );
++#else
++    String fields = rtl::OUString::createFromAscii ("fields");
++	AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, FALSE, TAB_APPEND);
++    String options = rtl::OUString::createFromAscii ("options");
++	AddTabPage( TP_OPTIONS,	options, ScTabPageSortOptions::Create, 0, FALSE, TAB_APPEND);
++#endif    
+ 	FreeResource();
+ }
+ 
+diff --git a/toolkit/workben/layout/sortdlg.hxx b/toolkit/workben/layout/sortdlg.hxx
+index d2ea7ed..a950d97 100644
+--- toolkit/workben/layout/sortdlg.hxx
++++ toolkit/workben/layout/sortdlg.hxx
+@@ -33,10 +33,14 @@
+ 
+ #include <sfx2/tabdlg.hxx>
+ 
+-#ifndef _SFX_HXX
+-#endif
++#if !TEST_LAYOUT
++#define LAYOUT_SFX_TABDIALOG_BROKEN 1
++#endif /* !TEST_LAYOUT */
+ 
+-//==================================================================
++#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
++#include <sfx2/layout.hxx>
++#include <layout/layout-pre.hxx>
++#endif
+ 
+ class ScSortDlg : public SfxTabDialog
+ {
+@@ -61,7 +65,8 @@ inline void ScSortDlg::SetByRows ( BOOL bByRows  )	{ bIsByRows = bByRows; }
+ inline BOOL ScSortDlg::GetHeaders() const 			{ return bIsHeaders; }
+ inline BOOL ScSortDlg::GetByRows () const 			{ return bIsByRows; }
+ 
++#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
++#include <layout/layout-post.hxx>
++#endif
+ 
+ #endif // SC_SORTDLG_HXX
+-
+-
 diff --git a/toolkit/workben/layout/string-input.xml b/toolkit/workben/layout/string-input.xml
 new file mode 100644
 index 0000000..0a59899
@@ -2601,9 +5848,72 @@
 +	</dialogbuttonhbox>
 +    </vbox>
 +</modaldialog>
+diff --git a/toolkit/workben/layout/tab-dialog.xml b/toolkit/workben/layout/tab-dialog.xml
+new file mode 100644
+index 0000000..1d631e9
+--- /dev/null
++++ 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 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
+index 6a423f5..b11973b 100644
+--- toolkit/workben/layout/tabcontrol.xml
++++ toolkit/workben/layout/tabcontrol.xml
+@@ -1,18 +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>
++	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/test.cxx b/toolkit/workben/layout/test.cxx
-index 159cbc9..cba8245 100644
---- a/toolkit/workben/layout/test.cxx
+index 159cbc9..86a0b1c 100644
+--- toolkit/workben/layout/test.cxx
 +++ toolkit/workben/layout/test.cxx
 @@ -237,19 +237,21 @@ void LayoutTest::RunEditor()
      editor.Execute();
@@ -2653,9 +5963,18 @@
      else if ( name.equalsAscii( "recover" ) )
      {
          SvxRecoverDialog recover ( 0 );
+@@ -279,7 +294,7 @@ void TestDialog( OUString const& name )
+     else if ( name.equalsAscii( "sort" ) )
+     {
+         LoadSC();
+-        ScSortDlg sort ( 0, 0 );
++        ScSortDlg sort (0, 0);
+         RunDialog( sort );
+     }
+ #endif /* SORT_DLG */
 diff --git a/toolkit/workben/layout/tpsort.cxx b/toolkit/workben/layout/tpsort.cxx
-index 9468c5d..4d4dfd1 100644
---- a/toolkit/workben/layout/tpsort.cxx
+index 9468c5d..6770232 100644
+--- toolkit/workben/layout/tpsort.cxx
 +++ toolkit/workben/layout/tpsort.cxx
 @@ -7,7 +7,7 @@
   * OpenOffice.org - a multi-platform office productivity suite
@@ -2666,9 +5985,62 @@
   *
   * This file is part of OpenOffice.org.
   *
+@@ -554,7 +554,7 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
+ #undef ScResId
+ #define ScResId(x) #x
+ #undef SfxTabPage
+-#define SfxTabPage( parent, id, args ) TabPage( parent, "sort-options.xml", id, 0, &args )
++#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "sort-options.xml", id, &args )
+ #endif /* ENABLE_LAYOUT */
+ 
+ ScTabPageSortOptions::ScTabPageSortOptions( Window* 			pParent,
+@@ -584,6 +584,7 @@ ScTabPageSortOptions::ScTabPageSortOptions( Window* 			pParent,
+ //		aFtArea 		( this, ScResId( FT_AREA ) ),
+ 		//
+ #if ENABLE_LAYOUT
++#undef this
+ #undef ScResId
+ #define ScResId(x) this, #x
+ #endif /* ENABLE_LAYOUT */
+@@ -748,7 +749,6 @@ USHORT* __EXPORT ScTabPageSortOptions::GetRanges()
+ 
+ #if ENABLE_LAYOUT
+ #undef SfxTabPage
+-#define SfxTabPage TabPage
+ #endif /* ENABLE_LAYOUT */
+ SfxTabPage* __EXPORT ScTabPageSortOptions::Create(
+ 											Window*				pParent,
+diff --git a/toolkit/workben/layout/tpsort.hxx b/toolkit/workben/layout/tpsort.hxx
+index ed6bdc8..ea1b28d 100644
+--- toolkit/workben/layout/tpsort.hxx
++++ toolkit/workben/layout/tpsort.hxx
+@@ -132,7 +132,7 @@ class ScRangeData;
+ class CollatorRessource;
+ class CollatorWrapper;
+ 
+-#include <layout/layout.hxx>
++#include <sfx2/layout.hxx>
+ #include <layout/layout-pre.hxx>
+ 
+ class ScTabPageSortOptions : public SfxTabPage
+@@ -142,12 +142,10 @@ public:
+ 									  const SfxItemSet&	 rArgSet );
+ 				~ScTabPageSortOptions();
+ 
+-#if !ENABLE_LAYOUT
++#undef SfxTabPage
++#define SfxTabPage ::SfxTabPage
+ 	static	SfxTabPage*	Create		( Window*				pParent,
+ 									  const SfxItemSet& 	rArgSet );
+-#else /* ENABLE_LAYOUT */
+-    static TabPage*	Create ( Window* parent, SfxItemSet const& set );
+-#endif /* ENABLE_LAYOUT */
+ 	static	USHORT*		GetRanges	();
+ 	virtual	BOOL		FillItemSet	( SfxItemSet& rArgSet );
+ 	virtual	void		Reset		( const SfxItemSet& rArgSet );
 diff --git a/toolkit/workben/layout/wordcountdialog.cxx b/toolkit/workben/layout/wordcountdialog.cxx
 index 64f1836..1eebbe5 100644
---- a/toolkit/workben/layout/wordcountdialog.cxx
+--- toolkit/workben/layout/wordcountdialog.cxx
 +++ toolkit/workben/layout/wordcountdialog.cxx
 @@ -7,7 +7,7 @@
   * OpenOffice.org - a multi-platform office productivity suite
@@ -2707,7 +6079,7 @@
  /*-- 06.04.2004 16:05:56---------------------------------------------------
 diff --git a/toolkit/workben/layout/wordcountdialog.hxx b/toolkit/workben/layout/wordcountdialog.hxx
 index 62e97bb..b0674e2 100644
---- a/toolkit/workben/layout/wordcountdialog.hxx
+--- toolkit/workben/layout/wordcountdialog.hxx
 +++ toolkit/workben/layout/wordcountdialog.hxx
 @@ -7,7 +7,7 @@
   * OpenOffice.org - a multi-platform office productivity suite
@@ -2720,7 +6092,7 @@
   *
 diff --git a/toolkit/workben/layout/zoom.cxx b/toolkit/workben/layout/zoom.cxx
 index 3185c96..6d7ade8 100644
---- a/toolkit/workben/layout/zoom.cxx
+--- toolkit/workben/layout/zoom.cxx
 +++ toolkit/workben/layout/zoom.cxx
 @@ -7,7 +7,7 @@
   * OpenOffice.org - a multi-platform office productivity suite
@@ -2767,7 +6139,7 @@
      aOptimalBtn.SetClickHdl( aLink );
 diff --git a/toolkit/workben/layout/zoom.hxx b/toolkit/workben/layout/zoom.hxx
 index 7dc09dc..461cd5a 100644
---- a/toolkit/workben/layout/zoom.hxx
+--- toolkit/workben/layout/zoom.hxx
 +++ toolkit/workben/layout/zoom.hxx
 @@ -7,7 +7,7 @@
   * OpenOffice.org - a multi-platform office productivity suite
@@ -2780,7 +6152,7 @@
   *
 diff --git a/toolkit/workben/layout/zoom.xml b/toolkit/workben/layout/zoom.xml
 index 5ad8fcf..f6a76a4 100644
---- a/toolkit/workben/layout/zoom.xml
+--- toolkit/workben/layout/zoom.xml
 +++ toolkit/workben/layout/zoom.xml
 @@ -11,30 +11,30 @@
      <vbox spacing="5" border="5">
@@ -2832,24 +6204,3 @@
  		    </align>
  		    <flow cnt:padding="10" cnt:expand="false"/>
  		    <metricfield id="ED_COLUMNS" value-step="1"
-commit 716fa99059c4ca3aa1ae4d85f94c80e19ff6ab43
-Author: Jan Nieuwenhuizen <janneke gnu org>
-Date:   Fri Aug 1 21:20:10 2008 +0200
-
-    Add radiogroup to sort-options. Fixes crasher.
-
-diff --git toolkit/workben/layout/sort-options.xml toolkit/workben/layout/sort-options.xml
-index e2e01f0..43144c1 100644
---- toolkit/workben/layout/sort-options.xml
-+++ toolkit/workben/layout/sort-options.xml
-@@ -33,8 +33,8 @@
- 		<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)"/>
-+            <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>

Added: trunk/patches/dev300/layout-simple-dialogs-vcl.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/layout-simple-dialogs-vcl.diff	Wed Sep 10 14:58:03 2008
@@ -0,0 +1,62 @@
+diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
+index 1155c5e..db27ba4 100644
+--- vcl/inc/vcl/button.hxx
++++ vcl/inc/vcl/button.hxx
+@@ -103,6 +103,8 @@ public:
+ 
+     void                SetFocusRect( const Rectangle& rFocusRect );
+     const Rectangle&    GetFocusRect() const;
++    void SetSmallSymbol (bool small=true);
++    bool IsSmallSymbol () const;
+ };
+ 
+ // --------------------
+diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx
+index 2b1d49a..83e83a6 100644
+--- vcl/inc/vcl/tabctrl.hxx
++++ vcl/inc/vcl/tabctrl.hxx
+@@ -45,8 +45,10 @@ class PushButton;
+ // - TabControl-Types -
+ // --------------------
+ 
++#ifndef TAB_APPEND
+ #define TAB_APPEND          ((USHORT)0xFFFF)
+ #define TAB_PAGE_NOTFOUND   ((USHORT)0xFFFF)
++#endif /* !TAB_APPEND */
+ 
+ // --------------
+ // - TabControl -
+diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
+index 32f3149..d7b6922 100644
+--- vcl/source/control/button.cxx
++++ vcl/source/control/button.cxx
+@@ -796,6 +796,15 @@ void Button::DataChanged( const DataChangedEvent& rDCEvt )
+ 	}
+ }
+ 
++void Button::SetSmallSymbol (bool small)
++{
++    ImplSetSmallSymbol (small);
++}
++
++bool Button::IsSmallSymbol () const
++{
++    return mpButtonData->mbSmallSymbol;
++}
+ 
+ // =======================================================================
+ 
+@@ -1966,7 +1975,12 @@ Size PushButton::CalcMinimumSize( long nMaxWidth ) const
+ 	Size aSize;
+ 
+ 	if ( IsSymbol() )
+-		aSize = Size( 12, 12 );
++    {
++        if ( IsSmallSymbol ())
++            aSize = Size( 16, 12 );
++        else
++            aSize = Size( 26, 24 );
++    }
+ 	else if ( IsImage() && ! (ImplGetButtonState() & BUTTON_DRAW_NOIMAGE) )
+ 		aSize = GetModeImage().GetSizePixel();
+ 	if ( PushButton::GetText().Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) )



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]