From c1abf016c3be0b43d3205f3f4cec4c802d4ba3ab Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Wed, 16 Jul 2008 16:20:39 +0200
Subject: [PATCH] Cleanup #include <layout*> disaster.

Fixes multiple inclusions of layout-pre, layout-post.
---
 svx/source/dialog/zoom.cxx                 |    7 ++++
 sw/source/ui/dialog/wordcountdialog.cxx    |    8 ++++
 toolkit/inc/layout/layout-post.hxx         |   17 +++------
 toolkit/inc/layout/layout-pre.hxx          |   52 +++------------------------
 toolkit/workben/layout/recover.cxx         |    7 ++++
 toolkit/workben/layout/wordcountdialog.cxx |   10 +++++-
 toolkit/workben/layout/zoom.cxx            |   11 +++++-
 7 files changed, 52 insertions(+), 60 deletions(-)

diff --git a/svx/source/dialog/zoom.cxx b/svx/source/dialog/zoom.cxx
index ef1b8e2..a28021a 100644
--- a/svx/source/dialog/zoom.cxx
+++ b/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[] =
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
index 8639a68..c75ac9a 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -41,6 +41,14 @@
 #include <layout/layout-pre.hxx>
 #include <wordcountdialog.hrc>
 
+#if ENABLE_LAYOUT
+#undef SW_RES
+#define SW_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "wordcount.xml", id )
+#define SW_WORDCOUNTDIALOG_HRC
+#endif /* ENABLE_LAYOUT */
+
 /*-- 06.04.2004 16:05:55---------------------------------------------------
 
   -----------------------------------------------------------------------*/
diff --git a/toolkit/inc/layout/layout-post.hxx b/toolkit/inc/layout/layout-post.hxx
index 09f90bf..b8c86cf 100644
--- a/toolkit/inc/layout/layout-post.hxx
+++ b/toolkit/inc/layout/layout-post.hxx
@@ -38,6 +38,9 @@
 
 #if ENABLE_LAYOUT
 
+/* Allow re-inclusion for cxx file. */
+#undef _LAYOUT_PRE_HXX
+
 #undef AdvancedButton
 #undef ApplyButton
 #undef Box
@@ -61,6 +64,7 @@
 #undef MetricFormatter
 #undef MoreButton
 #undef MultiLineEdit
+#undef MultiListBox
 #undef NoButton
 #undef NumericField
 #undef NumericFormatter
@@ -77,6 +81,7 @@
 #undef VBox
 #undef YesButton
 
+#undef ScExpandedFixedText
 #undef ModalDialog
 #undef ModelessDialog
 #undef SfxModalDialog
@@ -86,18 +91,6 @@
 
 #undef Window
 
-
-#undef SVX_RES
-#define SVX_RES(i)        ResId(i,DIALOG_MGR())
-
-#undef SvtResId
-
-#undef SW_RES
-#define SW_RES(i)               ResId(i,SWDIALOG_MGR())
-
-/* Allow re-inclusion for cxx file. */
-#undef _LAYOUT_PRE_HXX
-
 #endif /* ENABLE_LAYOUT */
 
 #endif /* _LAYOUT_POST_HXX */
diff --git a/toolkit/inc/layout/layout-pre.hxx b/toolkit/inc/layout/layout-pre.hxx
index 327da0b..3c9cf87 100644
--- a/toolkit/inc/layout/layout-pre.hxx
+++ b/toolkit/inc/layout/layout-pre.hxx
@@ -38,15 +38,8 @@
 
 #if ENABLE_LAYOUT
 
-//#if !LAYOUT
-//#define LAYOUT 1
-//#endif
-//#define LAYOUT_NS layout
-
-// TWBN, but find that SfxModalDialog and FixedLine are already defined, eg compiling
-// dlgfact.cxx
-//typedef layout::Dialog SfxModalDialog;
-//typedef layout::FixedLine FixedLine;
+///* Allow re-inclusion for next hxx file. */
+#undef _LAYOUT_POST_HXX
 
 #define AdvancedButton layout::AdvancedButton
 #define ApplyButton layout::ApplyButton
@@ -71,6 +64,7 @@
 #define MetricFormatter layout::MetricFormatter
 #define MoreButton layout::MoreButton
 #define MultiLineEdit layout::MultiLineEdit
+#define MultiListBox layout::MultiListBox
 #define NoButton layout::NoButton
 #define NumericField layout::NumericField
 #define NumericFormatter layout::NumericFormatter
@@ -87,6 +81,7 @@
 #define VBox layout::VBox
 #define YesButton layout::YesButton
 
+#define ScExpandedFixedText FixedText
 #define ModalDialog Dialog
 #define ModelessDialog Dialog
 #define SfxModalDialog Dialog
@@ -99,43 +94,8 @@
 #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
-#define SvtResId(x) #x
-#undef SW_RES
-#define SW_RES(x) #x
-
-/* Hmm.  These hacks make zoom.cxx, wordcountdialog.cxx, ... diffs
- * smaller but 'tis not really scalable. */
-#ifdef _LAYOUT_POST_HXX
-
-#ifdef _SVX_RECOVER_CXX
-#undef SfxModalDialog
-// 3rd parameter must match ID in <modaldialog> "RID_SVXDLG_RECOVER", localize.sdf
-#define SfxModalDialog( pParent, SVX_RES_RID ) Dialog( pParent, "recover.xml", "RID_SVXDLG_RECOVER" )
-#endif /* _SVX_RECOVER_CXX */
-
-#ifdef SW_WORDCOUNTDIALOG_HXX
-#undef SfxModalDialog
-// 3rd parameter must match ID in <modaldialog> "DLG_WORDCOUNT", localize.sdf
-#define SfxModalDialog( pParent, SW_RES_RID ) Dialog( pParent, "wordcount.xml", "DLG_WORDCOUNT" )
-#define SW_WORDCOUNTDIALOG_HRC
-#endif /* SW_WORDCOUNTDIALOG_HXX */
-
-#ifdef _SVX_ZOOM_CXX
-#undef SfxModalDialog
-// 3rd parameter must match ID in <modaldialog> "RID_SVXDLG_ZOOM", localize.sdf
-#define SfxModalDialog( pParent, SVX_RES_RID ) Dialog( pParent, "zoom.xml", "RID_SVXDLG_ZOOM" )
-#define _SVX_ZOOM_HRC
-#endif /* _SVX_ZOOM_CXX */
-
-#endif /* _LAYOUT_POST_HXX */
-
-#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/workben/layout/recover.cxx b/toolkit/workben/layout/recover.cxx
index 76eec92..45cf261 100644
--- a/toolkit/workben/layout/recover.cxx
+++ b/toolkit/workben/layout/recover.cxx
@@ -59,6 +59,13 @@ using namespace com::sun::star;
 
 #include <layout/layout-pre.hxx>
 
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "recover.xml", id )
+#endif /* ENABLE_LAYOUT */
+
 #if TEST_LAYOUT
 SvxRecoverDialog::SvxRecoverDialog( Window* pParent )
 #else /* !TEST_LAYOUT */
diff --git a/toolkit/workben/layout/wordcountdialog.cxx b/toolkit/workben/layout/wordcountdialog.cxx
index 64f1836..4fdf02c 100644
--- a/toolkit/workben/layout/wordcountdialog.cxx
+++ b/toolkit/workben/layout/wordcountdialog.cxx
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: wordcountdialog.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.10 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -47,6 +47,14 @@
 #include <wordcountdialog.hrc>
 #endif /* !TEST_LAYOUT */
 
+#if ENABLE_LAYOUT
+#undef SW_RES
+#define SW_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "wordcount.xml", id )
+#define SW_WORDCOUNTDIALOG_HRC
+#endif /* ENABLE_LAYOUT */
+
 /*-- 06.04.2004 16:05:55---------------------------------------------------
 
   -----------------------------------------------------------------------*/
diff --git a/toolkit/workben/layout/zoom.cxx b/toolkit/workben/layout/zoom.cxx
index 3185c96..d4cb388 100644
--- a/toolkit/workben/layout/zoom.cxx
+++ b/toolkit/workben/layout/zoom.cxx
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: zoom.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.12 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -51,7 +51,9 @@
 #define _SVX_ZOOM_CXX
 
 #include <svx/dialogs.hrc>
+#if !TEST_LAYOUT
 #include "zoom.hrc"
+#endif /* !TEST_LAYOUT */
 
 #include "zoom.hxx"
 #if TEST_LAYOUT
@@ -112,6 +114,13 @@ struct SvxViewLayoutItem : public LAYOUT_SfxPoolItem
 
 #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[] =
-- 
1.5.6.3.317.g5d44c9.dirty


