[Libreoffice-commits] .: cui/source sd/source vcl/inc vcl/source

Michael Meeks michael at kemper.freedesktop.org
Tue Sep 27 07:06:54 PDT 2011


 cui/source/inc/cuitabarea.hxx    |    6 ++---
 cui/source/tabpages/tabarea.cxx  |    8 -------
 cui/source/tabpages/tabline.cxx  |   12 -----------
 cui/source/tabpages/tparea.cxx   |    9 +++-----
 cui/source/tabpages/tpbitmap.cxx |   36 +++++++++++++----------------------
 cui/source/tabpages/tpcolor.cxx  |   40 ++++++++++++---------------------------
 cui/source/tabpages/tpgradnt.cxx |   33 ++++++++++----------------------
 cui/source/tabpages/tphatch.cxx  |   33 ++++++++++----------------------
 cui/source/tabpages/tpline.cxx   |   21 +++-----------------
 cui/source/tabpages/tplnedef.cxx |   30 +++++++++--------------------
 cui/source/tabpages/tplneend.cxx |   30 +++++++++--------------------
 cui/source/tabpages/tpshadow.cxx |   14 +------------
 sd/source/ui/dlg/tpoption.cxx    |    8 -------
 vcl/inc/vcl/window.hxx           |    2 +
 vcl/source/window/window2.cxx    |   16 +++++++++++++++
 15 files changed, 100 insertions(+), 198 deletions(-)

New commits:
commit 642553238cc531f39049150ff52cf4e152b5abe6
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Sep 27 12:37:00 2011 +0100

    add GetParentDialog to VCL's Window, and remove DLGWIN & cut/paste

diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 69102ba..64801ca 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -653,9 +653,9 @@ class SvxLoadSaveEmbed {
     DECL_LINK( ClickLoadHdl_Impl, void * );
     DECL_LINK( ClickSaveHdl_Impl, void * );
 public:
-    SvxLoadSaveEmbed( Window *pParent, const ResId &aLoad,
-                      const ResId &aSave, const ResId &aEmbed,
-                      const ResId &aTableName,
+    SvxLoadSaveEmbed( Window *pParent, Window *pDialog,
+                      const ResId &aLoad, const ResId &aSave,
+                      const ResId &aEmbed, const ResId &aTableName,
                       XPropertyListType t, XOutdevItemPool* mpXPool );
     XPropertyListRef GetList();
     void HideLoadSaveEmbed();
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx
index f4634c0..cda945a 100644
--- a/cui/source/tabpages/tabarea.cxx
+++ b/cui/source/tabpages/tabarea.cxx
@@ -48,14 +48,6 @@
 #include "dlgname.hxx"
 #include <dialmgr.hxx>
 
-#define DLGWIN this->GetParent()->GetParent()
-
-/*************************************************************************
-|*
-|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
-|*
-|************************************************************************/
-
 SvxAreaTabDialog::SvxAreaTabDialog
 (
     Window* pParent,
diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx
index 3620265..1e14d9d 100644
--- a/cui/source/tabpages/tabline.cxx
+++ b/cui/source/tabpages/tabline.cxx
@@ -45,18 +45,6 @@
 #include <svx/xtable.hxx>
 #include "svx/drawitem.hxx"
 
-#define DLGWIN this->GetParent()->GetParent()
-
-#define BITMAP_WIDTH   32
-#define BITMAP_HEIGHT  12
-#define XOUT_WIDTH    150
-
-/*************************************************************************
-|*
-|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
-|*
-\************************************************************************/
-
 SvxLineTabDialog::SvxLineTabDialog
 (
     Window* pParent,
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index c675255..93244a3 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -54,7 +54,6 @@
 #include <svl/intitem.hxx>
 #include <sfx2/request.hxx>
 #include "paragrph.hrc"
-#define DLGWIN this->GetParent()->GetParent()
 
 // static ----------------------------------------------------------------
 
@@ -812,7 +811,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
             if( *pnBitmapListState )
             {
                 if( *pnBitmapListState & CT_CHANGED )
-                    pBitmapList = ( (SvxAreaTabDialog*) DLGWIN )->
+                    pBitmapList = ( (SvxAreaTabDialog*) GetParentDialog() )->
                                             GetNewBitmapList();
 
                 _nPos = aLbBitmap.GetSelectEntryPos();
@@ -832,7 +831,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
             if( *pnHatchingListState )
             {
                 if( *pnHatchingListState & CT_CHANGED )
-                    pHatchingList = ( (SvxAreaTabDialog*) DLGWIN )->
+                    pHatchingList = ( (SvxAreaTabDialog*) GetParentDialog() )->
                                             GetNewHatchingList();
 
                 _nPos = aLbHatching.GetSelectEntryPos();
@@ -854,7 +853,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
             if( *pnGradientListState )
             {
                 if( *pnGradientListState & CT_CHANGED )
-                    pGradientList = ( (SvxAreaTabDialog*) DLGWIN )->
+                    pGradientList = ( (SvxAreaTabDialog*) GetParentDialog() )->
                                             GetNewGradientList();
 
                 _nPos = aLbGradient.GetSelectEntryPos();
@@ -874,7 +873,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
             if( *pnColorListState )
             {
                 if( *pnColorListState & CT_CHANGED )
-                    pColorList = ( (SvxAreaTabDialog*) DLGWIN )->
+                    pColorList = ( (SvxAreaTabDialog*) GetParentDialog() )->
                                             GetNewColorList();
                 // aLbColor
                 _nPos = aLbColor.GetSelectEntryPos();
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index c15680e..b0877be 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -68,14 +68,6 @@
 #include "sfx2/opengrf.hxx"
 #include "paragrph.hrc"
 
-#define DLGWIN this->GetParent()->GetParent()
-
-/*************************************************************************
-|*
-|*  Dialog zum Aendern und Definieren der Bitmaps
-|*
-\************************************************************************/
-
 SvxBitmapTabPage::SvxBitmapTabPage
 (
     Window* pParent,
@@ -180,7 +172,7 @@ void SvxBitmapTabPage::ActivatePage( const SfxItemSet&  )
                 *pnColorListState & CT_MODIFIED )
             {
                 if( *pnColorListState & CT_CHANGED )
-                    pColorList = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorList();
+                    pColorList = ( (SvxAreaTabDialog*) GetParentDialog() )->GetNewColorList();
 
                 // LbColor
                 nPos = aLbColor.GetSelectEntryPos();
@@ -544,7 +536,7 @@ long SvxBitmapTabPage::CheckChanges_Impl()
             Image aWarningBoxImage = WarningBox::GetStandardImage();
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
             DBG_ASSERT(pFact, "Dialogdiet fail!");
-            AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+            AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( GetParentDialog(), RID_SVXDLG_MESSBOX,
                                                         String( SVX_RES( RID_SVXSTR_BITMAP ) ),
                                                         String( CUI_RES( RID_SVXSTR_ASK_CHANGE_BITMAP ) ),
                                                         &aWarningBoxImage  );
@@ -610,7 +602,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     DBG_ASSERT(pFact, "Dialogdiet fail!");
-    AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+    AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
     DBG_ASSERT(pDlg, "Dialogdiet fail!");
     WarningBox*    pWarnBox = NULL;
     sal_uInt16         nError   = RID_SVXSTR_WARN_NAME_DUPLICATE;
@@ -632,7 +624,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
 
         if( !pWarnBox )
         {
-            pWarnBox = new WarningBox( DLGWIN,
+            pWarnBox = new WarningBox( GetParentDialog(),
                                        WinBits( WB_OK_CANCEL ),
                                        String( ResId( nError, rMgr ) ) );
             pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE );
@@ -739,7 +731,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickImportHdl_Impl, void *, EMPTYARG )
             INetURLObject   aURL( aDlg.GetPath() );
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
             DBG_ASSERT(pFact, "Dialogdiet fail!");
-            AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, String(aURL.GetName()).GetToken( 0, '.' ), aDesc );
+            AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), String(aURL.GetName()).GetToken( 0, '.' ), aDesc );
             DBG_ASSERT(pDlg, "Dialogdiet fail!");
             nError = RID_SVXSTR_WARN_NAME_DUPLICATE;
 
@@ -761,7 +753,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickImportHdl_Impl, void *, EMPTYARG )
 
                 if( !pWarnBox )
                 {
-                    pWarnBox = new WarningBox( DLGWIN,
+                    pWarnBox = new WarningBox( GetParentDialog(),
                                                WinBits( WB_OK_CANCEL ),
                                                String( ResId( nError, rMgr ) ) );
                     pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE );
@@ -801,7 +793,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickImportHdl_Impl, void *, EMPTYARG )
         }
         else
             // Graphik konnte nicht geladen werden
-            ErrorBox( DLGWIN,
+            ErrorBox( GetParentDialog(),
                       WinBits( WB_OK ),
                       String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
     }
@@ -829,7 +821,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");
-        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
         DBG_ASSERT(pDlg, "Dialogdiet fail!");
 
         long nCount = pBitmapList->Count();
@@ -873,7 +865,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
             }
             else
             {
-                WarningBox aBox( DLGWIN, WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+                WarningBox aBox( GetParentDialog(), WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
                 aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
                 aBox.Execute();
             }
@@ -891,7 +883,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+        QueryBox aQueryBox( GetParentDialog(), WinBits( WB_YES_NO | WB_DEF_NO ),
             String( CUI_RES( RID_SVXSTR_ASK_DEL_BITMAP ) ) );
 
         if( aQueryBox.Execute() == RET_YES )
@@ -928,7 +920,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
 
     if ( *pnBitmapListState & CT_MODIFIED )
     {
-        nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+        nReturn = WarningBox( GetParentDialog(), WinBits( WB_YES_NO_CANCEL ),
             String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
 
         if ( nReturn == RET_YES )
@@ -961,7 +953,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
             if( pBmpList->Load() )
             {
                 pBitmapList = pBmpList;
-                ( (SvxAreaTabDialog*) DLGWIN )->SetNewBitmapList( pBitmapList );
+                ( (SvxAreaTabDialog*) GetParentDialog() )->SetNewBitmapList( pBitmapList );
 
                 aLbBitmaps.Clear();
                 aLbBitmaps.Fill( pBitmapList );
@@ -991,7 +983,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
             else
             {
                 LeaveWait();
-                ErrorBox( DLGWIN, WinBits( WB_OK ),
+                ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                     String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
             }
         }
@@ -1067,7 +1059,7 @@ IMPL_LINK( SvxBitmapTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
         }
         else
         {
-            ErrorBox( DLGWIN, WinBits( WB_OK ),
+            ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                 String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
         }
     }
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index ce1febf..0626e35 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -55,29 +55,15 @@
 
 namespace css = ::com::sun::star;
 
-#define DLGWIN GetParentDialog( this )
-
-static Window* GetParentDialog( Window* pWindow )
-{
-    while( pWindow )
-    {
-        if( pWindow->IsDialog() )
-            break;
-
-        pWindow = pWindow->GetParent();
-    }
-
-    return pWindow;
-}
 
 // Load save embed functionality
-SvxLoadSaveEmbed::SvxLoadSaveEmbed( Window *pParent, const ResId &rLoad,
-                                    const ResId &rSave, const ResId &rEmbed,
-                                    const ResId &rTableName,
+SvxLoadSaveEmbed::SvxLoadSaveEmbed( Window *pParent, Window *pDialog,
+                                    const ResId &rLoad, const ResId &rSave,
+                                    const ResId &rEmbed, const ResId &rTableName,
                                     XPropertyListType t, XOutdevItemPool* pXPool )
     : meType( t )
     , mpXPool( pXPool )
-    , mpTopDlg( GetParentDialog( pParent ) )
+    , mpTopDlg( pDialog )
     , maBoxEmbed( pParent, rEmbed )
     , maBtnLoad( pParent, rLoad )
     , maBtnSave( pParent, rSave )
@@ -326,7 +312,8 @@ SvxColorTabPage::SvxColorTabPage
 ) :
 
     SfxTabPage          ( pParent, CUI_RES( RID_SVXPAGE_COLOR ), rInAttrs ),
-    SvxLoadSaveEmbed    ( this, CUI_RES( BTN_LOAD ), CUI_RES( BTN_SAVE ),
+    SvxLoadSaveEmbed    ( this, GetParentDialog(),
+                          CUI_RES( BTN_LOAD ), CUI_RES( BTN_SAVE ),
                           CUI_RES( BTN_EMBED ), CUI_RES( FT_TABLE_NAME ),
                           XCOLOR_LIST, (XOutdevItemPool*) rInAttrs.GetPool() ),
 
@@ -514,7 +501,7 @@ long SvxColorTabPage::CheckChanges_Impl()
             Image aWarningBoxImage = WarningBox::GetStandardImage();
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
             DBG_ASSERT(pFact, "Dialogdiet fail!");
-            AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+            AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( GetParentDialog(), RID_SVXDLG_MESSBOX,
                                                         SVX_RESSTR( RID_SVXSTR_COLOR ),
                                                         String( ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ) ),
                                                         &aWarningBoxImage );
@@ -681,14 +668,14 @@ IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
     // Wenn ja, wird wiederholt ein neuer Name angefordert
     if ( !bDifferent )
     {
-        WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ),
+        WarningBox aWarningBox( GetParentDialog(), WinBits( WB_OK ),
             String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
         aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
         aWarningBox.Execute();
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");
-        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
         DBG_ASSERT(pDlg, "Dialogdiet fail!");
         sal_Bool bLoop = sal_True;
 
@@ -758,14 +745,14 @@ IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
         // Wenn ja, wird wiederholt ein neuer Name angefordert
         if ( !bDifferent )
         {
-            WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ),
+            WarningBox aWarningBox( GetParentDialog(), WinBits( WB_OK ),
                 String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
             aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
             aWarningBox.Execute();
 
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
             DBG_ASSERT(pFact, "Dialogdiet fail!");
-            AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+            AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
             DBG_ASSERT(pDlg, "Dialogdiet fail!");
             sal_Bool bLoop = sal_True;
 
@@ -818,7 +805,7 @@ IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
 
 IMPL_LINK( SvxColorTabPage, ClickWorkOnHdl_Impl, void *, EMPTYARG )
 {
-    SvColorDialog* pColorDlg = new SvColorDialog( DLGWIN );
+    SvColorDialog* pColorDlg = new SvColorDialog( GetParentDialog() );
 
     Color aTmpColor (aAktuellColor);
     if (eCM != CM_RGB)
@@ -860,7 +847,7 @@ IMPL_LINK( SvxColorTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+        QueryBox aQueryBox( GetParentDialog(), WinBits( WB_YES_NO | WB_DEF_NO ),
             String( CUI_RES( RID_SVXSTR_ASK_DEL_COLOR ) ) );
 
         if( aQueryBox.Execute() == RET_YES )
@@ -1230,5 +1217,4 @@ void SvxColorTabPage::FillUserData()
     SetUserData( UniString::CreateFromInt32( eCM ) );
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index fd7f1a9..99448b8 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -52,17 +52,6 @@
 #include <svx/dialogs.hrc>
 #include "paragrph.hrc"
 
-#define DLGWIN this->GetParent()->GetParent()
-
-#define BITMAP_WIDTH  32
-#define BITMAP_HEIGHT 12
-
-/*************************************************************************
-|*
-|*  Dialog zum Aendern und Definieren der Farbverlaeufe
-|*
-\************************************************************************/
-
 SvxGradientTabPage::SvxGradientTabPage
 (
     Window* pParent,
@@ -186,7 +175,7 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet&  )
                 *pnColorListState & CT_MODIFIED )
             {
                 if( *pnColorListState & CT_CHANGED )
-                    pColorList = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorList();
+                    pColorList = ( (SvxAreaTabDialog*) GetParentDialog() )->GetNewColorList();
 
                 // LbColorFrom
                 nPos = aLbColorFrom.GetSelectEntryPos();
@@ -284,7 +273,7 @@ long SvxGradientTabPage::CheckChanges_Impl()
             Image aWarningBoxImage = WarningBox::GetStandardImage();
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
             DBG_ASSERT(pFact, "Dialogdiet fail!");
-            AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+            AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( GetParentDialog(), RID_SVXDLG_MESSBOX,
                                                         SVX_RESSTR( RID_SVXSTR_GRADIENT ),
                                                         CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_GRADIENT ),
                                                         &aWarningBoxImage );
@@ -452,7 +441,7 @@ IMPL_LINK( SvxGradientTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     DBG_ASSERT(pFact, "Dialogdiet fail!");
-    AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+    AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
     DBG_ASSERT(pDlg, "Dialogdiet fail!");
     WarningBox*    pWarnBox = NULL;
     sal_uInt16         nError   = RID_SVXSTR_WARN_NAME_DUPLICATE;
@@ -475,7 +464,7 @@ IMPL_LINK( SvxGradientTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
 
         if( !pWarnBox )
         {
-            pWarnBox = new WarningBox( DLGWIN,
+            pWarnBox = new WarningBox( GetParentDialog(),
                                        WinBits( WB_OK_CANCEL ),
                                        String( ResId( nError, rMgr ) ) );
             pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE );
@@ -547,7 +536,7 @@ IMPL_LINK( SvxGradientTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");
-        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
         DBG_ASSERT(pDlg, "Dialogdiet fail!");
 
         long nCount = pGradientList->Count();
@@ -592,7 +581,7 @@ IMPL_LINK( SvxGradientTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
             }
             else
             {
-                WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+                WarningBox aBox( GetParentDialog(), WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
                 aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
                 aBox.Execute();
             }
@@ -611,7 +600,7 @@ IMPL_LINK( SvxGradientTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+        QueryBox aQueryBox( GetParentDialog(), WinBits( WB_YES_NO | WB_DEF_NO ),
             String( CUI_RES( RID_SVXSTR_ASK_DEL_GRADIENT ) ) );
 
         if ( aQueryBox.Execute() == RET_YES )
@@ -647,7 +636,7 @@ IMPL_LINK( SvxGradientTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
 
     if ( *pnGradientListState & CT_MODIFIED )
     {
-        nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+        nReturn = WarningBox( GetParentDialog(), WinBits( WB_YES_NO_CANCEL ),
             String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
 
         if ( nReturn == RET_YES )
@@ -682,7 +671,7 @@ IMPL_LINK( SvxGradientTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
             if ( pGrdList->Load() )
             {
                 pGradientList = pGrdList;
-                ( (SvxAreaTabDialog*) DLGWIN )->
+                ( (SvxAreaTabDialog*) GetParentDialog() )->
                     SetNewGradientList( pGradientList );
 
                 aLbGradients.Clear();
@@ -713,7 +702,7 @@ IMPL_LINK( SvxGradientTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
             else
             {
                 LeaveWait();
-                ErrorBox( DLGWIN, WinBits( WB_OK ),
+                ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                     String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
             }
         }
@@ -789,7 +778,7 @@ IMPL_LINK( SvxGradientTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
         }
         else
         {
-            ErrorBox( DLGWIN, WinBits( WB_OK ),
+            ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                 String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
         }
     }
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 31b606d..febb0d3 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -53,17 +53,6 @@
 #include "paragrph.hrc"
 #include <svx/dialogs.hrc>
 
-#define DLGWIN this->GetParent()->GetParent()
-
-#define BITMAP_WIDTH  32
-#define BITMAP_HEIGHT 12
-
-/*************************************************************************
-|*
-|*  Dialog zum Aendern und Definieren der Schraffuren
-|*
-\************************************************************************/
-
 SvxHatchTabPage::SvxHatchTabPage
 (
     Window* pParent,
@@ -185,7 +174,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet )
                 *pnColorListState & CT_MODIFIED )
             {
                 if( *pnColorListState & CT_CHANGED )
-                    pColorList = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorList();
+                    pColorList = ( (SvxAreaTabDialog*) GetParentDialog() )->GetNewColorList();
 
                 // LbLineColor
                 nPos = aLbLineColor.GetSelectEntryPos();
@@ -263,7 +252,7 @@ long SvxHatchTabPage::CheckChanges_Impl()
         Image aWarningBoxImage = WarningBox::GetStandardImage();
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");
-        AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+        AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( GetParentDialog(), RID_SVXDLG_MESSBOX,
                                                         SVX_RESSTR( RID_SVXSTR_HATCH ),
                                                         CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_HATCH ),
                                                         &aWarningBoxImage );
@@ -506,7 +495,7 @@ IMPL_LINK( SvxHatchTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     DBG_ASSERT(pFact, "Dialogdiet fail!");
-    AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+    AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
     DBG_ASSERT(pDlg, "Dialogdiet fail!");
     WarningBox*    pWarnBox = NULL;
     sal_uInt16         nError   = RID_SVXSTR_WARN_NAME_DUPLICATE;
@@ -528,7 +517,7 @@ IMPL_LINK( SvxHatchTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
 
         if( !pWarnBox )
         {
-            pWarnBox = new WarningBox( DLGWIN,
+            pWarnBox = new WarningBox( GetParentDialog(),
                                        WinBits( WB_OK_CANCEL ),
                                        String( ResId( nError, rMgr ) ) );
             pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE );
@@ -595,7 +584,7 @@ IMPL_LINK( SvxHatchTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");
-        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
         DBG_ASSERT(pDlg, "Dialogdiet fail!");
 
         long nCount = pHatchingList->Count();
@@ -641,7 +630,7 @@ IMPL_LINK( SvxHatchTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
             }
             else
             {
-                WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+                WarningBox aBox( GetParentDialog(), WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
                 aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
                 aBox.Execute();
             }
@@ -659,7 +648,7 @@ IMPL_LINK( SvxHatchTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+        QueryBox aQueryBox( GetParentDialog(), WinBits( WB_YES_NO | WB_DEF_NO ),
             String( CUI_RES( RID_SVXSTR_ASK_DEL_HATCH ) ) );
 
         if( aQueryBox.Execute() == RET_YES )
@@ -695,7 +684,7 @@ IMPL_LINK( SvxHatchTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
 
     if ( *pnHatchingListState & CT_MODIFIED )
     {
-        nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+        nReturn = WarningBox( GetParentDialog(), WinBits( WB_YES_NO_CANCEL ),
             String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
 
         if ( nReturn == RET_YES )
@@ -726,7 +715,7 @@ IMPL_LINK( SvxHatchTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
             if( pHatchList->Load() )
             {
                 pHatchingList = pHatchList;
-                ( (SvxAreaTabDialog*) DLGWIN )->SetNewHatchingList( pHatchingList );
+                ( (SvxAreaTabDialog*) GetParentDialog() )->SetNewHatchingList( pHatchingList );
 
                 aLbHatchings.Clear();
                 aLbHatchings.Fill( pHatchingList );
@@ -753,7 +742,7 @@ IMPL_LINK( SvxHatchTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
                 *pnHatchingListState &= ~CT_MODIFIED;
             }
             else
-                ErrorBox( DLGWIN, WinBits( WB_OK ),
+                ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                     String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
         }
     }
@@ -828,7 +817,7 @@ IMPL_LINK( SvxHatchTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
         }
         else
         {
-            ErrorBox( DLGWIN, WinBits( WB_OK ),
+            ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                 String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
         }
     }
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 013f94a..3a27eaa 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -68,13 +68,6 @@
 
 #define MAX_BMP_WIDTH   16
 #define MAX_BMP_HEIGHT  16
-// define ----------------------------------------------------------------
-
-#define DLGWIN this->GetParent()->GetParent()
-
-#define BITMAP_WIDTH   32
-#define BITMAP_HEIGHT  12
-#define XOUT_WIDTH    150
 
 // static ----------------------------------------------------------------
 
@@ -87,12 +80,6 @@ static sal_uInt16 pLineRanges[] =
     0
 };
 
-/*************************************************************************
-|*
-|*  Dialog zum Aendern der Linien
-|*
-\************************************************************************/
-
 SvxLineTabPage::SvxLineTabPage
 (
     Window* pParent,
@@ -316,7 +303,7 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
             ( *pnDashListState & CT_CHANGED ) )
         {
             if( *pnDashListState & CT_CHANGED )
-                pDashList = ( (SvxLineTabDialog*) DLGWIN )->
+                pDashList = ( (SvxLineTabDialog*) GetParentDialog() )->
                                         GetNewDashList();
             *pnDashListState = CT_NONE;
 
@@ -349,7 +336,7 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
             ( *pnLineEndListState & CT_CHANGED ) )
         {
             if( *pnLineEndListState & CT_CHANGED )
-                pLineEndList = ( (SvxLineTabDialog*) DLGWIN )->
+                pLineEndList = ( (SvxLineTabDialog*) GetParentDialog() )->
                                         GetNewLineEndList();
             *pnLineEndListState = CT_NONE;
 
@@ -404,7 +391,7 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
             if( *pnColorListState )
             {
                 if( *pnColorListState & CT_CHANGED )
-                    pColorList = ( (SvxLineTabDialog*) DLGWIN )->GetNewColorList();
+                    pColorList = ( (SvxLineTabDialog*) GetParentDialog() )->GetNewColorList();
                 // aLbColor
                 sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos();
                 aLbColor.Clear();
@@ -1254,7 +1241,7 @@ SfxTabPage* SvxLineTabPage::Create( Window* pWindow,
 
 sal_uInt16* SvxLineTabPage::GetRanges()
 {
-    return( pLineRanges );
+    return pLineRanges;
 }
 
 //------------------------------------------------------------------------
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index 6dfe68a..96d6cb4 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -54,18 +54,8 @@
 #include <svx/dialmgr.hxx>
 #include <svx/dialogs.hrc>
 
-#define DLGWIN this->GetParent()->GetParent()
-
-#define BITMAP_WIDTH   32
-#define BITMAP_HEIGHT  12
 #define XOUT_WIDTH    150
 
-/*************************************************************************
-|*
-|*  Dialog zum Definieren von Linienstilen
-|*
-\************************************************************************/
-
 SvxLineDefTabPage::SvxLineDefTabPage
 (
     Window* pParent,
@@ -254,7 +244,7 @@ void SvxLineDefTabPage::CheckChanges_Impl()
         Image aWarningBoxImage = WarningBox::GetStandardImage();
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");
-        AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+        AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( GetParentDialog(), RID_SVXDLG_MESSBOX,
                                                     SVX_RESSTR( RID_SVXSTR_LINESTYLE ),
                                                     String( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ),
                                                     &aWarningBoxImage );
@@ -583,7 +573,7 @@ IMPL_LINK( SvxLineDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     DBG_ASSERT(pFact, "Dialogdiet fail!");
-    AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+    AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
     DBG_ASSERT(pDlg, "Dialogdiet fail!");
     sal_Bool bLoop = sal_True;
 
@@ -628,7 +618,7 @@ IMPL_LINK( SvxLineDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
         }
         else
         {
-            WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+            WarningBox aBox( GetParentDialog(), WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
             aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
             aBox.Execute();
         }
@@ -661,7 +651,7 @@ IMPL_LINK( SvxLineDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");
-        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
         DBG_ASSERT(pDlg, "Dialogdiet fail!");
 
         long nCount = pDashList->Count();
@@ -709,7 +699,7 @@ IMPL_LINK( SvxLineDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
             }
             else
             {
-                WarningBox aBox( DLGWIN, WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+                WarningBox aBox( GetParentDialog(), WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
                 aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
                 aBox.Execute();
             }
@@ -727,7 +717,7 @@ IMPL_LINK( SvxLineDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
 
     if ( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+        QueryBox aQueryBox( GetParentDialog(), WinBits( WB_YES_NO | WB_DEF_NO ),
             String( CUI_RES( RID_SVXSTR_ASK_DEL_LINESTYLE ) ) );
 
         if ( aQueryBox.Execute() == RET_YES )
@@ -765,7 +755,7 @@ IMPL_LINK( SvxLineDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
 
     if ( *pnDashListState & CT_MODIFIED )
     {
-        nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+        nReturn = WarningBox( GetParentDialog(), WinBits( WB_YES_NO_CANCEL ),
             String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
 
         if ( nReturn == RET_YES )
@@ -797,7 +787,7 @@ IMPL_LINK( SvxLineDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
             if( pDshLst->Load() )
             {
                 pDashList = pDshLst;
-                ( (SvxLineTabDialog*) DLGWIN )->SetNewDashList( pDashList );
+                ( (SvxLineTabDialog*) GetParentDialog() )->SetNewDashList( pDashList );
 
                 aLbLineStyles.Clear();
                 aLbLineStyles.Fill( pDashList );
@@ -812,7 +802,7 @@ IMPL_LINK( SvxLineDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
             }
             else
                 //aIStream.Close();
-                ErrorBox( DLGWIN, WinBits( WB_OK ),
+                ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                     String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
         }
     }
@@ -874,7 +864,7 @@ IMPL_LINK( SvxLineDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
         }
         else
         {
-            ErrorBox( DLGWIN, WinBits( WB_OK ),
+            ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                 String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
         }
     }
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index 572b0af..6b253ad 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -58,18 +58,8 @@
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <svx/dialogs.hrc>
 
-#define DLGWIN this->GetParent()->GetParent()
-
-#define BITMAP_WIDTH   32
-#define BITMAP_HEIGHT  12
 #define XOUT_WIDTH    150
 
-/*************************************************************************
-|*
-|*  Dialog zum Definieren von Linienenden-Stilen
-|*
-\************************************************************************/
-
 SvxLineEndDefTabPage::SvxLineEndDefTabPage
 (
     Window* pParent,
@@ -217,7 +207,7 @@ void SvxLineEndDefTabPage::CheckChanges_Impl()
 
         if( aString != aLbLineEnds.GetSelectEntry() )
         {
-            QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+            QueryBox aQueryBox( GetParentDialog(), WinBits( WB_YES_NO | WB_DEF_NO ),
                 CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_LINEEND ) );
 
             if ( aQueryBox.Execute() == RET_YES )
@@ -354,14 +344,14 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
         // Wenn ja, wird wiederholt ein neuer Name angefordert
         if ( !bDifferent )
         {
-            WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ),
+            WarningBox aWarningBox( GetParentDialog(), WinBits( WB_OK ),
                 String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
             aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
             aWarningBox.Execute();
 
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
             DBG_ASSERT(pFact, "Dialogdiet fail!");
-            AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+            AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
             DBG_ASSERT(pDlg, "Dialogdiet fail!");
             sal_Bool bLoop = sal_True;
 
@@ -468,7 +458,7 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");
-        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
+        AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
         DBG_ASSERT(pDlg, "Dialogdiet fail!");
         sal_Bool bLoop = sal_True;
 
@@ -503,7 +493,7 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
             }
             else
             {
-                WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+                WarningBox aBox( GetParentDialog(), WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
                 aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
                 aBox.Execute();
             }
@@ -531,7 +521,7 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+        QueryBox aQueryBox( GetParentDialog(), WinBits( WB_YES_NO | WB_DEF_NO ),
             String( CUI_RES( RID_SVXSTR_ASK_DEL_LINEEND ) ) );
 
         if ( aQueryBox.Execute() == RET_YES )
@@ -568,7 +558,7 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
 
     if ( *pnLineEndListState & CT_MODIFIED )
     {
-        nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+        nReturn = WarningBox( GetParentDialog(), WinBits( WB_YES_NO_CANCEL ),
             String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
 
         if ( nReturn == RET_YES )
@@ -599,7 +589,7 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
             if( pLeList->Load() )
             {
                 pLineEndList = pLeList;
-                ( (SvxLineTabDialog*) DLGWIN )->SetNewLineEndList( pLineEndList );
+                ( (SvxLineTabDialog*) GetParentDialog() )->SetNewLineEndList( pLineEndList );
                 aLbLineEnds.Clear();
                 aLbLineEnds.Fill( pLineEndList );
                 Reset( rOutAttrs );
@@ -612,7 +602,7 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
                 *pnLineEndListState &= ~CT_MODIFIED;
             }
             else
-                ErrorBox( DLGWIN, WinBits( WB_OK ),
+                ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                     String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
         }
     }
@@ -674,7 +664,7 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
         }
         else
         {
-            ErrorBox( DLGWIN, WinBits( WB_OK ),
+            ErrorBox( GetParentDialog(), WinBits( WB_OK ),
                 String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
         }
     }
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
index ea334b5..bada2c2 100644
--- a/cui/source/tabpages/tpshadow.cxx
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -48,10 +48,6 @@
 #include <svx/xlineit0.hxx>
 #include <sfx2/request.hxx>
 
-#define DLGWIN this->GetParent()->GetParent()
-
-// static ----------------------------------------------------------------
-
 static sal_uInt16 pShadowRanges[] =
 {
     SDRATTR_SHADOWCOLOR,
@@ -61,12 +57,6 @@ static sal_uInt16 pShadowRanges[] =
     0
 };
 
-/*************************************************************************
-|*
-|*  Dialog zum Aendern des Schattens
-|*
-\************************************************************************/
-
 SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
 
     SvxTabPage          ( pParent, CUI_RES( RID_SVXPAGE_SHADOW ), rInAttrs ),
@@ -231,14 +221,14 @@ void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet )
             {
                 if( *pnColorListState & CT_CHANGED )
                 {
-                    SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN );
+                    SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( GetParentDialog() );
                     if( pArea )
                     {
                         pColorList = pArea->GetNewColorList();
                     }
                     else
                     {
-                        SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN );
+                        SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( GetParentDialog() );
                         if( pLine )
                             pColorList = pLine->GetNewColorList();
                     }
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index ca7790e..c3c32d5 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -33,7 +33,6 @@
 #undef SD_DLLIMPLEMENTATION
 #endif
 
-
 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/frame/XDesktop.hpp>
@@ -59,17 +58,10 @@
 #include "app.hrc"
 #include <svl/intitem.hxx>
 #include <sfx2/request.hxx>
-#define DLGWIN this->GetParent()->GetParent()
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
-/*************************************************************************
-|*
-|*  TabPage zum Einstellen der Fang-Optionen
-|*
-\************************************************************************/
-
 SdTpOptionsSnap::SdTpOptionsSnap( Window* pParent, const SfxItemSet& rInAttrs  ) :
         SvxGridTabPage(pParent, rInAttrs)
 {
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index bc93404..ba52258 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -731,6 +731,8 @@ public:
 
     void                SetParent( Window* pNewParent );
     Window*             GetParent() const;
+    // return the dialog we are contained in or NULL if un-contained
+    Window*             GetParentDialog() const;
 
     void                Show( sal_Bool bVisible = sal_True, sal_uInt16 nFlags = 0 );
     void                Hide( sal_uInt16 nFlags = 0 ) { Show( sal_False, nFlags ); }
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index ee607c4..47492db 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1478,6 +1478,22 @@ WindowType Window::GetType() const
 {
     return mpWindowImpl->mnType;
 }
+
+Window* Window::GetParentDialog() const
+{
+    const Window *pWindow = this;
+
+    while( pWindow )
+    {
+        if( pWindow->IsDialog() )
+            break;
+
+        pWindow = pWindow->GetParent();
+    }
+
+    return const_cast<Window *>(pWindow);
+}
+
 sal_Bool Window::IsSystemWindow() const
 {
     return mpWindowImpl->mbSysWin;


More information about the Libreoffice-commits mailing list