[Libreoffice-commits] .: basctl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 7 02:21:20 PDT 2012


 basctl/source/accessibility/accessibledialogcontrolshape.cxx |   14 
 basctl/source/accessibility/accessibledialogwindow.cxx       |  146 +----
 basctl/source/basicide/basdoc.cxx                            |   18 
 basctl/source/basicide/basdoc.hxx                            |    4 
 basctl/source/basicide/baside2.cxx                           |   80 +-
 basctl/source/basicide/baside2.hxx                           |   61 --
 basctl/source/basicide/baside2b.cxx                          |  211 +++----
 basctl/source/basicide/baside3.cxx                           |  205 +++----
 basctl/source/basicide/basidectrlr.cxx                       |   14 
 basctl/source/basicide/basides3.cxx                          |    2 
 basctl/source/basicide/basidesh.cxx                          |   13 
 basctl/source/basicide/basobj2.cxx                           |    8 
 basctl/source/basicide/basobj3.cxx                           |    2 
 basctl/source/basicide/bastype2.hxx                          |    9 
 basctl/source/basicide/bastypes.cxx                          |   12 
 basctl/source/basicide/doceventnotifier.cxx                  |   48 -
 basctl/source/basicide/docsignature.cxx                      |   28 
 basctl/source/basicide/localizationmgr.cxx                   |  102 +--
 basctl/source/basicide/macrodlg.cxx                          |  158 ++---
 basctl/source/basicide/macrodlg.hxx                          |   27 
 basctl/source/basicide/moduldl2.cxx                          |   68 +-
 basctl/source/basicide/moduldlg.cxx                          |   20 
 basctl/source/basicide/moduldlg.hxx                          |   28 
 basctl/source/dlged/dlged.cxx                                |  206 +++----
 basctl/source/dlged/dlgedfunc.cxx                            |  272 ++++-----
 basctl/source/dlged/dlgedlist.cxx                            |   16 
 basctl/source/dlged/dlgedobj.cxx                             |  309 ++++-------
 basctl/source/dlged/dlgedpage.cxx                            |   14 
 basctl/source/dlged/dlgedview.cxx                            |   25 
 basctl/source/dlged/propbrw.cxx                              |    7 
 basctl/source/inc/baside3.hxx                                |   14 
 basctl/source/inc/basidesh.hxx                               |    6 
 basctl/source/inc/dlged.hxx                                  |   40 -
 basctl/source/inc/dlgeddef.hxx                               |   98 +--
 basctl/source/inc/dlgedfunc.hxx                              |   14 
 basctl/source/inc/dlgedlist.hxx                              |    8 
 basctl/source/inc/dlgedobj.hxx                               |   13 
 basctl/source/inc/dlgedpage.hxx                              |    1 
 basctl/source/inc/dlgedview.hxx                              |    4 
 basctl/source/inc/doceventnotifier.hxx                       |    9 
 basctl/source/inc/docsignature.hxx                           |    8 
 basctl/source/inc/iderid.hxx                                 |    5 
 basctl/source/inc/localizationmgr.hxx                        |    2 
 43 files changed, 1086 insertions(+), 1263 deletions(-)

New commits:
commit 81f72a3c3a30ef00dfb03bd7fab148d2fcf3e4f8
Author: Uray M. János <uray.janos at gmail.com>
Date:   Sun Sep 2 16:21:08 2012 +0200

    Cleanup in basctl (raw pointers)
    
    Lots of raw pointers have been converted to boost::scoped_ptr to reduce
    the number of 'delete's and the possibility of memory leaks.
    Some pointers have been converted to references, to reduce the needless
    checking for nullptrs, and so simplifying the code.
    Also some #define-s have been converted to C++ constants or enumerations.
    
    Change-Id: Ifbeb78f744bac7a96c8a446ff4db90dedf85fe26

diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
index 4b58550..6e720ea 100644
--- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx
+++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
@@ -84,8 +84,8 @@ bool AccessibleDialogControlShape::IsFocused()
     bool bFocused = false;
     if ( m_pDialogWindow )
     {
-        SdrView* pSdrView = m_pDialogWindow->GetView();
-        if ( pSdrView && pSdrView->IsObjMarked( m_pDlgEdObj ) && pSdrView->GetMarkedObjectList().GetMarkCount() == 1 )
+        SdrView& rView = m_pDialogWindow->GetView();
+        if (rView.IsObjMarked(m_pDlgEdObj) && rView.GetMarkedObjectList().GetMarkCount() == 1)
             bFocused = true;
     }
 
@@ -96,15 +96,9 @@ bool AccessibleDialogControlShape::IsFocused()
 
 bool AccessibleDialogControlShape::IsSelected()
 {
-    bool bSelected = false;
     if ( m_pDialogWindow )
-    {
-        SdrView* pSdrView = m_pDialogWindow->GetView();
-        if ( pSdrView )
-            bSelected = pSdrView->IsObjMarked( m_pDlgEdObj );
-    }
-
-    return bSelected;
+        return m_pDialogWindow->GetView().IsObjMarked(m_pDlgEdObj);
+    return false;
 }
 
 // -----------------------------------------------------------------------------
diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx
index c9b1971..0b12b8d 100644
--- a/basctl/source/accessibility/accessibledialogwindow.cxx
+++ b/basctl/source/accessibility/accessibledialogwindow.cxx
@@ -117,31 +117,25 @@ AccessibleDialogWindow::AccessibleDialogWindow (basctl::DialogWindow* pDialogWin
 
     if ( m_pDialogWindow )
     {
-        SdrPage* pSdrPage = m_pDialogWindow->GetPage();
-        if ( pSdrPage )
-        {
-            sal_uLong nCount = pSdrPage->GetObjCount();
+        SdrPage& rPage = m_pDialogWindow->GetPage();
+        sal_uLong nCount = rPage.GetObjCount();
 
-            for ( sal_uLong i = 0; i < nCount; ++i )
+        for ( sal_uLong i = 0; i < nCount; ++i )
+        {
+            if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(rPage.GetObj(i)))
             {
-                if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrPage->GetObj(i)))
-                {
-                    ChildDescriptor aDesc( pDlgEdObj );
-                    if ( IsChildVisible( aDesc ) )
-                        m_aAccessibleChildren.push_back( aDesc );
-                }
+                ChildDescriptor aDesc( pDlgEdObj );
+                if ( IsChildVisible( aDesc ) )
+                    m_aAccessibleChildren.push_back( aDesc );
             }
         }
 
         m_pDialogWindow->AddEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) );
 
-        m_pDlgEditor = m_pDialogWindow->GetEditor();
-        if ( m_pDlgEditor )
-            StartListening( *m_pDlgEditor );
+        StartListening(m_pDialogWindow->GetEditor());
 
-        m_pDlgEdModel = m_pDialogWindow->GetModel();
-        if ( m_pDlgEdModel )
-            StartListening( *m_pDlgEdModel );
+        m_pDlgEdModel = &m_pDialogWindow->GetModel();
+        StartListening(*m_pDlgEdModel);
     }
 }
 
@@ -222,37 +216,33 @@ bool AccessibleDialogWindow::IsChildVisible( const ChildDescriptor& rDesc )
     if ( m_pDialogWindow )
     {
         // first check, if the shape is in a visible layer
-        SdrModel* pSdrModel = m_pDialogWindow->GetModel();
-        if ( pSdrModel )
+        SdrLayerAdmin& rLayerAdmin = m_pDialogWindow->GetModel().GetLayerAdmin();
+        DlgEdObj* pDlgEdObj = rDesc.pDlgEdObj;
+        if ( pDlgEdObj )
         {
-            SdrLayerAdmin& rLayerAdmin = pSdrModel->GetLayerAdmin();
-            DlgEdObj* pDlgEdObj = rDesc.pDlgEdObj;
-            if ( pDlgEdObj )
+            SdrLayerID nLayerId = pDlgEdObj->GetLayer();
+            const SdrLayer* pSdrLayer = rLayerAdmin.GetLayerPerID( nLayerId );
+            if ( pSdrLayer )
             {
-                SdrLayerID nLayerId = pDlgEdObj->GetLayer();
-                const SdrLayer* pSdrLayer = rLayerAdmin.GetLayerPerID( nLayerId );
-                if ( pSdrLayer )
+                ::rtl::OUString aLayerName = pSdrLayer->GetName();
+                SdrView& rView = m_pDialogWindow->GetView();
+                if (rView.IsLayerVisible(aLayerName))
                 {
-                    ::rtl::OUString aLayerName = pSdrLayer->GetName();
-                    SdrView* pSdrView = m_pDialogWindow->GetView();
-                    if ( pSdrView && pSdrView->IsLayerVisible( aLayerName ) )
-                    {
-                        // get the bounding box of the shape in logic units
-                        Rectangle aRect = pDlgEdObj->GetSnapRect();
-
-                        // transform coordinates relative to the parent
-                        MapMode aMap = m_pDialogWindow->GetMapMode();
-                        Point aOrg = aMap.GetOrigin();
-                        aRect.Move( aOrg.X(), aOrg.Y() );
-
-                        // convert logic units to pixel
-                        aRect = m_pDialogWindow->LogicToPixel( aRect, MapMode(MAP_100TH_MM) );
-
-                        // check, if the shape's bounding box intersects with the bounding box of its parent
-                        Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() );
-                        if ( aParentRect.IsOver( aRect ) )
-                            bVisible = true;
-                    }
+                    // get the bounding box of the shape in logic units
+                    Rectangle aRect = pDlgEdObj->GetSnapRect();
+
+                    // transform coordinates relative to the parent
+                    MapMode aMap = m_pDialogWindow->GetMapMode();
+                    Point aOrg = aMap.GetOrigin();
+                    aRect.Move( aOrg.X(), aOrg.Y() );
+
+                    // convert logic units to pixel
+                    aRect = m_pDialogWindow->LogicToPixel( aRect, MapMode(MAP_100TH_MM) );
+
+                    // check, if the shape's bounding box intersects with the bounding box of its parent
+                    Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() );
+                    if ( aParentRect.IsOver( aRect ) )
+                        bVisible = true;
                 }
             }
         }
@@ -342,12 +332,10 @@ void AccessibleDialogWindow::UpdateChildren()
 {
     if ( m_pDialogWindow )
     {
-        if (SdrPage* pSdrPage = m_pDialogWindow->GetPage())
-        {
-            for ( sal_uLong i = 0, nCount = pSdrPage->GetObjCount(); i < nCount; ++i )
-                if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrPage->GetObj(i)))
-                    UpdateChild( ChildDescriptor( pDlgEdObj ) );
-        }
+        SdrPage& rPage = m_pDialogWindow->GetPage();
+        for ( sal_uLong i = 0, nCount = rPage.GetObjCount(); i < nCount; ++i )
+            if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(rPage.GetObj(i)))
+                UpdateChild( ChildDescriptor( pDlgEdObj ) );
     }
 }
 
@@ -963,16 +951,11 @@ void AccessibleDialogWindow::selectAccessibleChild( sal_Int32 nChildIndex ) thro
 
     if ( m_pDialogWindow )
     {
-        DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj;
-        if ( pDlgEdObj )
+        if (DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj)
         {
-            SdrView* pSdrView = m_pDialogWindow->GetView();
-            if ( pSdrView )
-            {
-                SdrPageView* pPgView = pSdrView->GetSdrPageView();
-                if ( pPgView )
-                    pSdrView->MarkObj( pDlgEdObj, pPgView );
-            }
+            SdrView& rView = m_pDialogWindow->GetView();
+            if (SdrPageView* pPgView = rView.GetSdrPageView())
+                rView.MarkObj(pDlgEdObj, pPgView);
         }
     }
 }
@@ -986,19 +969,10 @@ sal_Bool AccessibleDialogWindow::isAccessibleChildSelected( sal_Int32 nChildInde
     if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
         throw IndexOutOfBoundsException();
 
-    bool bSelected = false;
-    if ( m_pDialogWindow )
-    {
-        DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj;
-        if ( pDlgEdObj )
-        {
-            SdrView* pSdrView = m_pDialogWindow->GetView();
-            if ( pSdrView )
-                bSelected = pSdrView->IsObjMarked( pDlgEdObj );
-        }
-    }
-
-    return bSelected;
+    if (m_pDialogWindow)
+        if (DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj)
+            return m_pDialogWindow->GetView().IsObjMarked(pDlgEdObj);
+    return false;
 }
 
 // -----------------------------------------------------------------------------
@@ -1008,11 +982,7 @@ void AccessibleDialogWindow::clearAccessibleSelection(  ) throw (RuntimeExceptio
     OExternalLockGuard aGuard( this );
 
     if ( m_pDialogWindow )
-    {
-        SdrView* pSdrView = m_pDialogWindow->GetView();
-        if ( pSdrView )
-            pSdrView->UnmarkAll();
-    }
+        m_pDialogWindow->GetView().UnmarkAll();
 }
 
 // -----------------------------------------------------------------------------
@@ -1022,11 +992,7 @@ void AccessibleDialogWindow::selectAllAccessibleChildren(  ) throw (RuntimeExcep
     OExternalLockGuard aGuard( this );
 
     if ( m_pDialogWindow )
-    {
-        SdrView* pSdrView = m_pDialogWindow->GetView();
-        if ( pSdrView )
-            pSdrView->MarkAll();
-    }
+        m_pDialogWindow->GetView().MarkAll();
 }
 
 // -----------------------------------------------------------------------------
@@ -1080,16 +1046,12 @@ void AccessibleDialogWindow::deselectAccessibleChild( sal_Int32 nChildIndex ) th
 
     if ( m_pDialogWindow )
     {
-        DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj;
-        if ( pDlgEdObj )
+        if (DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj)
         {
-            SdrView* pSdrView = m_pDialogWindow->GetView();
-            if ( pSdrView )
-            {
-                SdrPageView* pPgView = pSdrView->GetSdrPageView();
-                if ( pPgView )
-                    pSdrView->MarkObj( pDlgEdObj, pPgView, true );
-            }
+            SdrView& rView = m_pDialogWindow->GetView();
+            SdrPageView* pPgView = rView.GetSdrPageView();
+            if (pPgView)
+                rView.MarkObj( pDlgEdObj, pPgView, true );
         }
     }
 }
diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx
index 67f358c..6f64fbc 100644
--- a/basctl/source/basicide/basdoc.cxx
+++ b/basctl/source/basicide/basdoc.cxx
@@ -48,31 +48,27 @@ SFX_IMPL_INTERFACE( basctl_DocShell, SfxObjectShell, IDEResId( 0 ) )
 DocShell::DocShell()
     :SfxObjectShell( SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | SFXMODEL_DISABLE_DOCUMENT_RECOVERY )
 {
-    pPrinter = 0;
     SetPool( &SFX_APP()->GetPool() );
     SetBaseModel( new SIDEModel(this) );
 }
 
 DocShell::~DocShell()
-{
-    delete pPrinter;
-}
+{ }
 
 SfxPrinter* DocShell::GetPrinter( bool bCreate )
 {
     if ( !pPrinter && bCreate )
-        pPrinter = new SfxPrinter( new SfxItemSet( GetPool(), SID_PRINTER_NOTFOUND_WARN , SID_PRINTER_NOTFOUND_WARN ) );
+        pPrinter.reset(new SfxPrinter(new SfxItemSet(
+            GetPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN
+        )));
 
-    return pPrinter;
+    return pPrinter.get();
 }
 
 void DocShell::SetPrinter( SfxPrinter* pPr )
 {
-    if ( pPr != pPrinter )
-    {
-        delete pPrinter;
-        pPrinter = pPr;
-    }
+    if (pPr != pPrinter.get())
+        pPrinter.reset(pPr);
 }
 
 void DocShell::FillClass( SvGlobalName*, sal_uInt32*, String*, String*, String*, sal_Int32, sal_Bool bTemplate) const
diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx
index 8a302d7..19a0ae6 100644
--- a/basctl/source/basicide/basdoc.hxx
+++ b/basctl/source/basicide/basdoc.hxx
@@ -25,6 +25,8 @@
 #include <sfx2/objsh.hxx>
 #include <svx/ifaceids.hxx>
 
+#include <boost/scoped_ptr.hpp>
+
 class SfxPrinter;
 
 namespace basctl
@@ -32,7 +34,7 @@ namespace basctl
 
 class DocShell: public SfxObjectShell
 {
-    SfxPrinter*         pPrinter;
+    boost::scoped_ptr<SfxPrinter> pPrinter;
 
 protected:
     virtual void    Draw( OutputDevice *, const JobSetup & rSetup,
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 49a88f7..7de663d 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -54,20 +54,28 @@
 namespace basctl
 {
 
-#define LMARGPRN        1700
-#define RMARGPRN         900
-#define TMARGPRN        2000
-#define BMARGPRN        1000
-#define BORDERPRN       300
+namespace
+{
+
+namespace Print
+{
+    int const nLeftMargin = 1700;
+    int const nRightMargin = 900;
+    int const nTopMargin = 2000;
+    int const nBottomMargin = 1000;
+    int const nBorder = 300;
+}
 
-#define VALIDWINDOW     0x1234
+short const ValidWindow = 0x1234;
 
 #if defined(OW) || defined(MTF)
-#define FILTERMASK_ALL "*"
+char const FilterMask_All[] = "*";
 #else
-#define FILTERMASK_ALL "*.*"
+char const FilterMask_All[] = "*.*";
 #endif
 
+} // namespace
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::ui::dialogs;
@@ -84,9 +92,7 @@ namespace
 
 void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, const ::rtl::OUString& rTitle, bool bOutput )
 {
-    short nLeftMargin   = LMARGPRN;
-    Size aSz = pPrinter->GetOutputSize();
-    short nBorder = BORDERPRN;
+    Size const aSz = pPrinter->GetOutputSize();
 
     const Color aOldLineColor( pPrinter->GetLineColor() );
     const Color aOldFillColor( pPrinter->GetFillColor() );
@@ -103,19 +109,20 @@ void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage,
     long nFontHeight = pPrinter->GetTextHeight();
 
     // 1st Border => line, 2+3 Border = free space
-    long nYTop = TMARGPRN-3*nBorder-nFontHeight;
+    long nYTop = Print::nTopMargin - 3*Print::nBorder - nFontHeight;
 
-    long nXLeft = nLeftMargin-nBorder;
-    long nXRight = aSz.Width()-RMARGPRN+nBorder;
+    long nXLeft = Print::nLeftMargin - Print::nBorder;
+    long nXRight = aSz.Width() - Print::nRightMargin + Print::nBorder;
 
     if( bOutput )
-        pPrinter->DrawRect( Rectangle(
-            Point( nXLeft, nYTop ),
-            Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) );
+        pPrinter->DrawRect(Rectangle(
+            Point(nXLeft, nYTop),
+            Size(nXRight - nXLeft, aSz.Height() - nYTop - Print::nBottomMargin + Print::nBorder)
+        ));
 
 
-    long nY = TMARGPRN-2*nBorder;
-    Point aPos( nLeftMargin, nY );
+    long nY = Print::nTopMargin - 2*Print::nBorder;
+    Point aPos(Print::nLeftMargin, nY);
     if( bOutput )
         pPrinter->DrawText( aPos, rTitle );
     if ( nPages != 1 )
@@ -136,7 +143,7 @@ void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage,
         }
     }
 
-    nY = TMARGPRN-nBorder;
+    nY = Print::nTopMargin - Print::nBorder;
 
     if( bOutput )
         pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
@@ -187,7 +194,7 @@ ModulWindow::ModulWindow (
 ) :
     BaseWindow(pParent, rDocument, aLibName, aName),
     rLayout(*pParent),
-    nValid(VALIDWINDOW),
+    nValid(ValidWindow),
     aXEditorWindow(this),
     m_aModule(aModule)
 {
@@ -233,7 +240,7 @@ ModulWindow::~ModulWindow()
 
 void ModulWindow::GetFocus()
 {
-    if ( nValid != VALIDWINDOW  )
+    if (nValid != ValidWindow)
         return;
     DBG_CHKTHIS( ModulWindow, 0 );
     aXEditorWindow.GetEdtWindow().GrabFocus();
@@ -262,9 +269,6 @@ void ModulWindow::Resize()
 }
 
 
-// "Import" of baside4.cxx
-void CreateEngineForBasic( StarBASIC* pBasic );
-
 void ModulWindow::CheckCompileBasic()
 {
     DBG_CHKTHIS( ModulWindow, 0 );
@@ -446,7 +450,7 @@ bool ModulWindow::LoadBasic()
 
     Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
     xFltMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.bas" ) ) );
-    xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
+    xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FilterMask_All ) ) );
     xFltMgr->setCurrentFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) );
 
     if( xFP->execute() == RET_OK )
@@ -506,7 +510,7 @@ bool ModulWindow::SaveBasicSource()
 
     Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
     xFltMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.bas" ) ) );
-    xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
+    xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FilterMask_All ) ) );
     xFltMgr->setCurrentFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) );
 
     if( xFP->execute() == RET_OK )
@@ -535,7 +539,7 @@ bool ModulWindow::SaveBasicSource()
     return bDone;
 }
 
-bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName );
+extern bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName ); // defined in baside3.cxx
 
 bool ModulWindow::ImportDialog()
 {
@@ -704,7 +708,7 @@ long ModulWindow::BasicErrorHdl( StarBASIC * pBasic )
         return false;
 
     if ( bMarkError )
-        aXEditorWindow.GetBrkWindow().SetMarkerPos( MARKER_NOMARKER );
+        aXEditorWindow.GetBrkWindow().SetNoMarker();
     return false;
 }
 
@@ -746,7 +750,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic )
         Application::Yield();
 
     aStatus.bIsInReschedule = false;
-    aXEditorWindow.GetBrkWindow().SetMarkerPos( MARKER_NOMARKER );
+    aXEditorWindow.GetBrkWindow().SetNoMarker();
 
     ClearStatus( BASWIN_INRESCHEDULE );
 
@@ -863,7 +867,7 @@ void ModulWindow::UpdateData()
         if ( GetEditView() )
         {
             TextSelection aSel = GetEditView()->GetSelection();
-            setTextEngineText( GetEditEngine(), xModule->GetSource32() );
+            setTextEngineText(*GetEditEngine(), xModule->GetSource32());
             GetEditView()->SetSelection( aSel );
             GetEditEngine()->SetModified( false );
             MarkDocumentModified( GetDocument() );
@@ -909,8 +913,8 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
     sal_uInt16 nParaSpace = 10;
 
     Size aPaperSz = pPrinter->GetOutputSize();
-    aPaperSz.Width() -= (LMARGPRN+RMARGPRN);
-    aPaperSz.Height() -= (TMARGPRN+BMARGPRN);
+    aPaperSz.Width() -= (Print::nLeftMargin + Print::nRightMargin);
+    aPaperSz.Height() -= (Print::nTopMargin + Print::nBottomMargin);
 
     // nLinepPage is not correct if there's a line break
     sal_uInt16 nLinespPage = (sal_uInt16) (aPaperSz.Height()/nLineHeight);
@@ -921,7 +925,7 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
     sal_uInt16 nCurPage = 1;
 
     lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nPrintPage == 0 );
-    Point aPos( LMARGPRN, TMARGPRN );
+    Point aPos( Print::nLeftMargin, Print::nTopMargin );
     for ( sal_uLong nPara = 0; nPara < nParas; nPara++ )
     {
         String aLine( GetEditEngine()->GetText( nPara ) );
@@ -931,11 +935,11 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
         {
             String aTmpLine( aLine, nLine*nCharspLine, nCharspLine );
             aPos.Y() += nLineHeight;
-            if ( aPos.Y() > ( aPaperSz.Height()+TMARGPRN ) )
+            if ( aPos.Y() > ( aPaperSz.Height() + Print::nTopMargin ) )
             {
                 nCurPage++;
                 lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nCurPage-1 == nPrintPage );
-                aPos = Point( LMARGPRN, TMARGPRN+nLineHeight );
+                aPos = Point(Print::nLeftMargin, Print::nTopMargin + nLineHeight);
             }
             if( nCurPage-1 == nPrintPage )
                 pPrinter->DrawText( aPos, aTmpLine );
@@ -1357,7 +1361,7 @@ void ModulWindow::BasicStarted()
 void ModulWindow::BasicStopped()
 {
     aStatus.bIsRunning = false;
-    GetBreakPointWindow().SetMarkerPos( MARKER_NOMARKER );
+    GetBreakPointWindow().SetNoMarker();
 }
 
 EntryDescriptor ModulWindow::CreateEntryDescriptor()
@@ -1457,7 +1461,7 @@ bool ModulWindow::HasActiveEditor () const
 
 void ModulWindow::UpdateModule ()
 {
-    rtl::OUString const aModule = getTextEngineText(GetEditEngine());
+    rtl::OUString const aModule = getTextEngineText(*GetEditEngine());
 
     // update module in basic
     assert(xModule);
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 297ebd6..489376c 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -21,9 +21,11 @@
 #define BASCTL_BASIDE2_HXX
 
 #include "layout.hxx"
-#include <bastypes.hxx>
-#include <bastype3.hxx>
-#include <basidesh.hxx>
+#include "bastypes.hxx"
+#include "bastype3.hxx"
+#include "basidesh.hxx"
+#include "breakpoint.hxx"
+#include "linenumberwindow.hxx"
 
 #include <svheader.hxx>
 
@@ -37,17 +39,15 @@ class SvxSearchItem;
 #include <basic/sbstar.hxx>
 #include <basic/sbmod.hxx>
 #include <vcl/split.hxx>
-#include "svl/lstner.hxx"
+#include <svl/lstner.hxx>
 #include <svtools/colorcfg.hxx>
 
 #include <sfx2/progress.hxx>
 #include <unotools/options.hxx>
+#include <rtl/ref.hxx>
 
-#include "breakpoint.hxx"
-#include "linenumberwindow.hxx"
 #include <set>
-
-#define MARKER_NOMARKER 0xFFFF
+#include <boost/scoped_ptr.hpp>
 
 namespace com { namespace sun { namespace star { namespace beans {
     class XMultiPropertySet;
@@ -63,40 +63,18 @@ DBG_NAMEEX( ModulWindow )
 // #108672 Helper functions to get/set text in TextEngine
 // using the stream interface (get/setText() only supports
 // tools Strings limited to 64K).
-::rtl::OUString getTextEngineText( ExtTextEngine* pEngine );
-void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr );
-
-class ProgressInfo : public SfxProgress
-{
-private:
-    sal_uLong                   nCurState;
-
-public:
+// defined in baside2b.cxx
+rtl::OUString getTextEngineText (ExtTextEngine&);
+void setTextEngineText (ExtTextEngine&, rtl::OUString const&);
 
-    inline          ProgressInfo( SfxObjectShell* pObjSh, const String& rText, sal_uLong nRange );
-    inline void     StepProgress();
-};
-
-inline ProgressInfo::ProgressInfo( SfxObjectShell* pObjSh, const String& rText, sal_uLong nRange )
-    : SfxProgress( pObjSh, rText, nRange )
-{
-    nCurState = 0;
-}
-
-inline void ProgressInfo::StepProgress()
-{
-    SetState( ++nCurState );
-}
-
-typedef std::set<sal_uInt16> SyntaxLineSet;
 
 class EditorWindow : public Window, public SfxListener
 {
 private:
     class ChangesListener;
 
-    ExtTextView*    pEditView;
-    ExtTextEngine*  pEditEngine;
+    boost::scoped_ptr<ExtTextView> pEditView;
+    boost::scoped_ptr<ExtTextEngine> pEditEngine;
     ModulWindow&    rModulWindow;
 
     rtl::Reference< ChangesListener > listener_;
@@ -108,9 +86,13 @@ private:
 
     SyntaxHighlighter   aHighlighter;
     Timer           aSyntaxIdleTimer;
+    typedef std::set<sal_uInt16> SyntaxLineSet;
     SyntaxLineSet   aSyntaxLineTable;
     DECL_LINK(SyntaxTimerHdl, void *);
-    ProgressInfo*   pProgress;
+
+    // progress bar
+    class ProgressInfo;
+    boost::scoped_ptr<ProgressInfo> pProgress;
 
     virtual void DataChanged(DataChangedEvent const & rDCEvt);
 
@@ -147,9 +129,8 @@ public:
                     EditorWindow (Window* pParent, ModulWindow*);
                     ~EditorWindow();
 
-    ExtTextEngine*  GetEditEngine() const   { return pEditEngine; }
-    ExtTextView*    GetEditView() const     { return pEditView; }
-    ProgressInfo*   GetProgress() const     { return pProgress; }
+    ExtTextEngine*  GetEditEngine() const   { return pEditEngine.get(); }
+    ExtTextView*    GetEditView() const     { return pEditView.get(); }
 
     void            CreateProgress( const String& rText, sal_uLong nRange );
     void            DestroyProgress();
@@ -185,7 +166,6 @@ private:
 
 protected:
     virtual void    Paint( const Rectangle& );
-    virtual void    Resize();
     BreakPoint*     FindBreakPoint( const Point& rMousePos );
     void            ShowMarker( bool bShow );
     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
@@ -198,6 +178,7 @@ public:
                     ~BreakPointWindow();
 
     void            SetMarkerPos( sal_uInt16 nLine, bool bErrorMarker = false );
+    void            SetNoMarker ();
 
     void            DoScroll( long nHorzScroll, long nVertScroll );
     long&           GetCurYOffset()         { return nCurYOffset; }
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index a184d06..fefed79 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -45,6 +45,8 @@
 #include <vcl/taskpanelist.hxx>
 #include <vcl/help.hxx>
 
+#include <vector>
+
 namespace basctl
 {
 
@@ -54,6 +56,8 @@ using namespace ::com::sun::star::uno;
 namespace
 {
 
+sal_uInt16 const NoMarker = 0xFFFF;
+
 long nVirtToolBoxHeight;    // inited in WatchWindow, used in Stackwindow
 long nHeaderBarHeight;
 
@@ -72,13 +76,14 @@ Image GetImage (unsigned nId)
     return aImagesNormal.GetImage(nId);
 }
 
-} // namespace
+int const nScrollLine = 12;
+int const nScrollPage = 60;
+int const DWBORDER = 3;
 
-#define SCROLL_LINE     12
-#define SCROLL_PAGE     60
-#define DWBORDER        3
+char const cSuffixes[] = "%&!#@$";
+
+} // namespace
 
-static const char cSuffixes[] = "%&!#@$";
 
 /**
  * Helper functions to get/set text in TextEngine using
@@ -86,27 +91,27 @@ static const char cSuffixes[] = "%&!#@$";
  *
  * get/setText() only supports tools Strings limited to 64K).
  */
-::rtl::OUString getTextEngineText( ExtTextEngine* pEngine )
+rtl::OUString getTextEngineText (ExtTextEngine& rEngine)
 {
     SvMemoryStream aMemStream;
     aMemStream.SetStreamCharSet( RTL_TEXTENCODING_UTF8 );
     aMemStream.SetLineDelimiter( LINEEND_LF );
-    pEngine->Write( aMemStream );
+    rEngine.Write( aMemStream );
     sal_uLong nSize = aMemStream.Tell();
     ::rtl::OUString aText( (const sal_Char*)aMemStream.GetData(),
         nSize, RTL_TEXTENCODING_UTF8 );
     return aText;
 }
 
-void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr )
+void setTextEngineText (ExtTextEngine& rEngine, rtl::OUString const& aStr)
 {
-    pEngine->SetText( String() );
+    rEngine.SetText(String());
     ::rtl::OString aUTF8Str = ::rtl::OUStringToOString( aStr, RTL_TEXTENCODING_UTF8 );
     SvMemoryStream aMemStream( (void*)aUTF8Str.getStr(), aUTF8Str.getLength(),
         STREAM_READ | STREAM_SEEK_TO_BEGIN );
     aMemStream.SetStreamCharSet( RTL_TEXTENCODING_UTF8 );
     aMemStream.SetLineDelimiter( LINEEND_LF );
-    pEngine->Read( aMemStream );
+    rEngine.Read(aMemStream);
 }
 
 namespace
@@ -193,13 +198,29 @@ private:
     EditorWindow & editor_;
 };
 
+class EditorWindow::ProgressInfo : public SfxProgress
+{
+public:
+    ProgressInfo (SfxObjectShell* pObjSh, String const& rText, sal_uLong nRange) :
+        SfxProgress(pObjSh, rText, nRange),
+        nCurState(0)
+    { }
+
+    void StepProgress ()
+    {
+        SetState(++nCurState);
+    }
+
+private:
+    sal_uLong nCurState;
+};
+
 EditorWindow::EditorWindow (Window* pParent, ModulWindow* pModulWindow) :
     Window(pParent, WB_BORDER),
     pEditView(0),
     pEditEngine(0),
     rModulWindow(*pModulWindow),
     nCurTextWidth(0),
-    pProgress(0),
     bHighlightning(false),
     bDoSyntaxHighlight(true),
     bDelayHighlight(true)
@@ -239,9 +260,7 @@ EditorWindow::~EditorWindow()
     if ( pEditEngine )
     {
         EndListening( *pEditEngine );
-        pEditEngine->RemoveView( pEditView );
-        delete pEditView;
-        delete pEditEngine;
+        pEditEngine->RemoveView(pEditView.get());
     }
 }
 
@@ -558,11 +577,11 @@ void EditorWindow::CreateEditEngine()
     if ( pEditEngine )
         return;
 
-    pEditEngine = new ExtTextEngine;
-    pEditView = new ExtTextView( pEditEngine, this );
+    pEditEngine.reset(new ExtTextEngine);
+    pEditView.reset(new ExtTextView(pEditEngine.get(), this));
     pEditView->SetAutoIndentMode(true);
     pEditEngine->SetUpdateMode(false);
-    pEditEngine->InsertView( pEditView );
+    pEditEngine->InsertView(pEditView.get());
 
     ImplSetFont();
 
@@ -586,12 +605,12 @@ void EditorWindow::CreateEditEngine()
     // nLines*4: SetText+Formatting+DoHighlight+Formatting
     // it could be cut down on one formatting but you would wait even longer
     // for the text then if the source code is long...
-    pProgress = new ProgressInfo(
+    pProgress.reset(new ProgressInfo(
         GetShell()->GetViewFrame()->GetObjectShell(),
         String(IDEResId(RID_STR_GENERATESOURCE)),
         nLines*4
-    );
-    setTextEngineText( pEditEngine, aOUSource );
+    ));
+    setTextEngineText(*pEditEngine, aOUSource);
 
     pEditView->SetStartDocPos( Point( 0, 0 ) );
     pEditView->SetSelection( TextSelection() );
@@ -612,7 +631,7 @@ void EditorWindow::CreateEditEngine()
         aSyntaxLineTable.insert( nLine );
     ForceSyntaxTimeout();
 
-    DELETEZ( pProgress );
+    pProgress.reset();
 
     pEditView->EraseVirtualDevice();
     pEditEngine->SetModified( false );
@@ -924,22 +943,22 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, bool bInserted )
 void EditorWindow::CreateProgress( const String& rText, sal_uLong nRange )
 {
     DBG_ASSERT( !pProgress, "ProgressInfo existiert schon" );
-    pProgress = new ProgressInfo(
+    pProgress.reset(new ProgressInfo(
         GetShell()->GetViewFrame()->GetObjectShell(),
         rText,
         nRange
-    );
+    ));
 }
 
 void EditorWindow::DestroyProgress()
 {
-    DELETEZ( pProgress );
+    pProgress.reset();
 }
 
 void EditorWindow::ForceSyntaxTimeout()
 {
     aSyntaxIdleTimer.Stop();
-    ((Link&)aSyntaxIdleTimer.GetTimeoutHdl()).Call( &aSyntaxIdleTimer );
+    aSyntaxIdleTimer.GetTimeoutHdl().Call(&aSyntaxIdleTimer);
 }
 
 
@@ -952,7 +971,7 @@ BreakPointWindow::BreakPointWindow (Window* pParent, ModulWindow* pModulWindow)
     Window(pParent, WB_BORDER),
     rModulWindow(*pModulWindow),
     nCurYOffset(0), // memorize nCurYOffset and not take it from EditEngine
-    nMarkerPos(MARKER_NOMARKER)
+    nMarkerPos(NoMarker)
 {
     setBackgroundColor(GetSettings().GetStyleSettings().GetFieldColor());
     SetHelpId(HID_BASICIDE_BREAKPOINTWINDOW);
@@ -964,13 +983,6 @@ BreakPointWindow::~BreakPointWindow()
 
 
 
-void BreakPointWindow::Resize()
-{
-/// Invalidate();
-}
-
-
-
 void BreakPointWindow::Paint( const Rectangle& )
 {
     if ( SyncYOffset() )
@@ -1017,9 +1029,14 @@ void BreakPointWindow::SetMarkerPos( sal_uInt16 nLine, bool bError )
     ShowMarker( true );
 }
 
+void BreakPointWindow::SetNoMarker ()
+{
+    SetMarkerPos(NoMarker);
+}
+
 void BreakPointWindow::ShowMarker( bool bShow )
 {
-    if ( nMarkerPos == MARKER_NOMARKER )
+    if ( nMarkerPos == NoMarker )
         return;
 
     Size const aOutSz = GetOutputSize();
@@ -1287,78 +1304,30 @@ void WatchWindow::Resize()
     Invalidate();
 }
 
-struct MemberList
-{
-    String*         mpMemberNames;
-    int             mnMemberCount;
-
-    MemberList( void )
-        : mpMemberNames( NULL )
-        , mnMemberCount( 0 )
-    {}
-    ~MemberList()
-    {
-        clear();
-    }
-
-    void clear( void );
-    void allocList( int nCount );
-};
-
-void MemberList::clear( void )
-{
-    if( mnMemberCount )
-    {
-        delete[] mpMemberNames;
-        mnMemberCount = 0;
-    }
-}
-
-void MemberList::allocList( int nCount )
-{
-    clear();
-    if( nCount > 0 )
-    {
-        mnMemberCount = nCount;
-        mpMemberNames = new String[ mnMemberCount ];
-    }
-}
-
 struct WatchItem
 {
     String          maName;
     String          maDisplayName;
     SbxObjectRef    mpObject;
-    MemberList      maMemberList;
+    std::vector<String> maMemberList;
 
     SbxDimArrayRef  mpArray;
     int             nDimLevel;  // 0 = Root
     int             nDimCount;
-    short*          pIndices;
+    std::vector<short> vIndices;
 
     WatchItem*      mpArrayParentItem;
 
-    WatchItem( void )
-        : nDimLevel( 0 )
-        , nDimCount( 0 )
-        , pIndices( NULL )
-        , mpArrayParentItem( NULL )
-    {}
-    ~WatchItem()
-        { clearWatchItem(); }
+    WatchItem (String const& rName):
+        maName(rName),
+        nDimLevel(0),
+        nDimCount(0),
+        mpArrayParentItem(0)
+    { }
 
-    void clearWatchItem( bool bIncludeArrayData=true )
+    void clearWatchItem ()
     {
-        mpObject = NULL;
         maMemberList.clear();
-        if( bIncludeArrayData )
-        {
-            mpArray = NULL;
-            nDimLevel = 0;
-            nDimCount = 0;
-            delete[] pIndices;
-            pIndices = NULL;
-        }
     }
 
     WatchItem* GetRootItem( void );
@@ -1388,10 +1357,9 @@ SbxDimArray* WatchItem::GetRootArray( void )
 
 void WatchWindow::AddWatch( const String& rVName )
 {
-    WatchItem* pWatchItem = new WatchItem;
     String aVar, aIndex;
     lcl_SeparateNameAndIndex( rVName, aVar, aIndex );
-    pWatchItem->maName = aVar;
+    WatchItem* pWatchItem = new WatchItem(aVar);
 
     String aWatchStr_( aVar );
     aWatchStr_ += String( RTL_CONSTASCII_USTRINGPARAM( "\t\t" ) );
@@ -1652,8 +1620,8 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
     aEdtWindow.Show();
     aBrkWindow.Show();
 
-    aEWVScrollBar.SetLineSize( SCROLL_LINE );
-    aEWVScrollBar.SetPageSize( SCROLL_PAGE );
+    aEWVScrollBar.SetLineSize(nScrollLine);
+    aEWVScrollBar.SetPageSize(nScrollPage);
     aEWVScrollBar.SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) );
     aEWVScrollBar.Show();
 }
@@ -1786,7 +1754,7 @@ void WatchTreeListBox::RequestingChildren( SvLBoxEntry * pParent )
     if( GetChildCount( pParent ) > 0 )
         return;
 
-    SvLBoxEntry * pEntry = pParent;
+    SvLBoxEntry* pEntry = pParent;
     WatchItem* pItem = (WatchItem*)pEntry->GetUserData();
 
     SbxDimArray* pArray = pItem->mpArray;
@@ -1802,20 +1770,18 @@ void WatchTreeListBox::RequestingChildren( SvLBoxEntry * pParent )
     if( pObj )
     {
         createAllObjectProperties( pObj );
-         SbxArray* pProps = pObj->GetProperties();
+        SbxArray* pProps = pObj->GetProperties();
         sal_uInt16 nPropCount = pProps->Count();
-        pItem->maMemberList.allocList( nPropCount );
+        pItem->maMemberList.reserve(nPropCount);
 
         for( sal_uInt16 i = 0 ; i < nPropCount - 3 ; i++ )
         {
             SbxVariable* pVar = pProps->Get( i );
 
-            String aName( pVar->GetName() );
-            pItem->maMemberList.mpMemberNames[i] = aName;
-            SvLBoxEntry* pChildEntry = SvTreeListBox::InsertEntry( aName, pEntry );
-            WatchItem* pChildItem = new WatchItem();
-            pChildItem->maName = aName;
-            pChildEntry->SetUserData( pChildItem );
+            pItem->maMemberList.push_back(String(pVar->GetName()));
+            String const& rName = pItem->maMemberList.back();
+            SvLBoxEntry* pChildEntry = SvTreeListBox::InsertEntry( rName, pEntry );
+            pChildEntry->SetUserData(new WatchItem(rName));
         }
         if( nPropCount > 0 )
         {
@@ -1833,25 +1799,23 @@ void WatchTreeListBox::RequestingChildren( SvLBoxEntry * pParent )
         pArray->GetDim32( nThisLevel, nMin, nMax );
         for( sal_Int32 i = nMin ; i <= nMax ; i++ )
         {
-            WatchItem* pChildItem = new WatchItem();
+            WatchItem* pChildItem = new WatchItem(pItem->maName);
 
             // Copy data and create name
-            String aBaseName( pItem->maName );
-            pChildItem->maName = aBaseName;
 
             String aIndexStr = String( RTL_CONSTASCII_USTRINGPARAM( "(" ) );
             pChildItem->mpArrayParentItem = pItem;
             pChildItem->nDimLevel = nThisLevel;
             pChildItem->nDimCount = pItem->nDimCount;
-            pChildItem->pIndices = new short[ pChildItem->nDimCount ];
+            pChildItem->vIndices.resize(pChildItem->nDimCount);
             sal_uInt16 j;
             for( j = 0 ; j < nParentLevel ; j++ )
             {
-                short n = pChildItem->pIndices[j] = pItem->pIndices[j];
+                short n = pChildItem->vIndices[j] = pItem->vIndices[j];
                 aIndexStr += String::CreateFromInt32( n );
                 aIndexStr += String( RTL_CONSTASCII_USTRINGPARAM( "," ) );
             }
-            pChildItem->pIndices[ nParentLevel ] = sal::static_int_cast<short>( i );
+            pChildItem->vIndices[nParentLevel] = sal::static_int_cast<short>( i );
             aIndexStr += String::CreateFromInt32( i );
             aIndexStr += String( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
 
@@ -1860,7 +1824,7 @@ void WatchTreeListBox::RequestingChildren( SvLBoxEntry * pParent )
             if( pArrayRootItem && pArrayRootItem->mpArrayParentItem )
                 aDisplayName = pItem->maDisplayName;
             else
-                aDisplayName = aBaseName;
+                aDisplayName = pItem->maName;
             aDisplayName += aIndexStr;
             pChildItem->maDisplayName = aDisplayName;
 
@@ -1905,7 +1869,7 @@ SbxBase* WatchTreeListBox::ImplGetSBXForEntry( SvLBoxEntry* pEntry, bool& rbArra
         {
             rbArrayElement = true;
             if( pParentItem->nDimLevel + 1 == pParentItem->nDimCount )
-                pSBX = pArray->Get( pItem->pIndices );
+                pSBX = pArray->Get(pItem->vIndices.empty() ? 0 : &*pItem->vIndices.begin());
         }
     }
     else
@@ -1986,7 +1950,10 @@ bool WatchTreeListBox::ImplBasicEntryEdited( SvLBoxEntry* pEntry, const String&
 }
 
 
-static void implCollapseModifiedObjectEntry( SvLBoxEntry* pParent, WatchTreeListBox* pThis )
+namespace
+{
+
+void implCollapseModifiedObjectEntry( SvLBoxEntry* pParent, WatchTreeListBox* pThis )
 {
     pThis->Collapse( pParent );
 
@@ -1996,13 +1963,12 @@ static void implCollapseModifiedObjectEntry( SvLBoxEntry* pParent, WatchTreeList
     {
         implCollapseModifiedObjectEntry( pDeleteEntry, pThis );
 
-        WatchItem* pItem = (WatchItem*)pDeleteEntry->GetUserData();
-        delete pItem;
+        delete (WatchItem*)pDeleteEntry->GetUserData();
         pModel->Remove( pDeleteEntry );
     }
 }
 
-static String implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eType )
+String implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eType )
 {
     String aRetStr = getBasicTypeName( eType );
 
@@ -2032,7 +1998,6 @@ static String implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eTy
     return aRetStr;
 }
 
-
 void implEnableChildren( SvLBoxEntry* pEntry, bool bEnable )
 {
     if( bEnable )
@@ -2049,6 +2014,8 @@ void implEnableChildren( SvLBoxEntry* pEntry, bool bEnable )
     }
 }
 
+} // namespace
+
 void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
 {
     SbMethod* pCurMethod = StarBASIC::GetActiveMethod();
@@ -2127,7 +2094,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
                         // #i37227 Clear always and replace array
                         if( pNewArray != pOldArray )
                         {
-                            pItem->clearWatchItem( false );
+                            pItem->clearWatchItem();
                             if( pNewArray )
                             {
                                 implEnableChildren( pEntry, true );
@@ -2152,7 +2119,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
                     {
                         // Check if member list has changed
                         bool bObjChanged = false;
-                        if( pItem->mpObject != NULL && pItem->maMemberList.mpMemberNames != NULL )
+                        if (pItem->mpObject && !pItem->maMemberList.empty())
                         {
                             SbxArray* pProps = pObj->GetProperties();
                             sal_uInt16 nPropCount = pProps->Count();
@@ -2160,7 +2127,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
                             {
                                 SbxVariable* pVar_ = pProps->Get( i );
                                 String aName( pVar_->GetName() );
-                                if( pItem->maMemberList.mpMemberNames[i] != aName )
+                                if( pItem->maMemberList[i] != aName )
                                 {
                                     bObjChanged = true;
                                     break;
@@ -2180,7 +2147,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
                         if( pItem->mpObject != NULL )
                         {
                             bCollapse = true;
-                            pItem->clearWatchItem( false );
+                            pItem->clearWatchItem();
 
                             implEnableChildren( pEntry, false );
                         }
@@ -2191,7 +2158,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
                     if( pItem->mpObject != NULL )
                     {
                         bCollapse = true;
-                        pItem->clearWatchItem( false );
+                        pItem->clearWatchItem();
 
                         implEnableChildren( pEntry, false );
                     }
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index ef03686..6b137d2 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -65,9 +65,9 @@ using namespace ::com::sun::star::resource;
 using namespace ::com::sun::star::ui::dialogs;
 
 #if defined(UNX)
-#define FILTERMASK_ALL "*"
+char const FilterMask_All[] = "*";
 #else
-#define FILTERMASK_ALL "*.*"
+char const FilterMask_All[] = "*.*";
 #endif
 
 DBG_NAME( DialogWindow )
@@ -82,20 +82,15 @@ DialogWindow::DialogWindow (
 ) :
     BaseWindow(pParent, rDocument, aLibName, aName),
     rLayout(*pParent),
-    pUndoMgr(0)
+    pEditor(new DlgEditor(*this, rLayout, rDocument.isDocument() ? rDocument.getDocument() : Reference<frame::XModel>(), xDialogModel)),
+    pUndoMgr(new SfxUndoManager)
 {
     InitSettings( true, true, true );
 
-    pEditor = new DlgEditor(rDocument.isDocument() ? rDocument.getDocument() : Reference<frame::XModel>(), rLayout);
-    pEditor->SetWindow( this );
-    pEditor->SetDialog( xDialogModel );
-
-    pUndoMgr = new SfxUndoManager;
-
-    Link aDummyLink;
-    aOldNotifyUndoActionHdl = pEditor->GetModel()->GetNotifyUndoActionHdl();
-    pEditor->GetModel()->SetNotifyUndoActionHdl(
-        LINK(this, DialogWindow, NotifyUndoActionHdl));
+    aOldNotifyUndoActionHdl = pEditor->GetModel().GetNotifyUndoActionHdl();
+    pEditor->GetModel().SetNotifyUndoActionHdl(
+        LINK(this, DialogWindow, NotifyUndoActionHdl)
+    );
 
     SetHelpId( HID_BASICIDE_DIALOGWINDOW );
 
@@ -109,10 +104,7 @@ DialogWindow::DialogWindow (
 }
 
 DialogWindow::~DialogWindow()
-{
-    delete pEditor;
-    delete pUndoMgr;
-}
+{ }
 
 void DialogWindow::LoseFocus()
 {
@@ -209,10 +201,10 @@ void DialogWindow::Command( const CommandEvent& rCEvt )
     {
         if (SfxDispatcher* pDispatcher = GetDispatcher())
         {
-            SdrView* pView = GetView();
-            if( !rCEvt.IsMouseEvent() && pView->AreObjectsMarked() )
+            SdrView& rView = GetView();
+            if( !rCEvt.IsMouseEvent() && rView.AreObjectsMarked() )
             {
-                Rectangle aMarkedRect( pView->GetMarkedRect() );
+                Rectangle aMarkedRect( rView.GetMarkedRect() );
                 Point MarkedCenter( aMarkedRect.Center() );
                 Point PosPixel( LogicToPixel( MarkedCenter ) );
                 pDispatcher->ExecutePopup( IDEResId(RID_POPUP_DLGED), this, &PosPixel );
@@ -285,7 +277,7 @@ void DialogWindow::GetState( SfxItemSet& rSet )
             case SID_COPY:
             {
                 // any object selected?
-                if ( !pEditor->GetView()->AreObjectsMarked() )
+                if ( !pEditor->GetView().AreObjectsMarked() )
                     rSet.DisableItem( nWh );
             }
             break;
@@ -294,7 +286,7 @@ void DialogWindow::GetState( SfxItemSet& rSet )
             case SID_BACKSPACE:
             {
                 // any object selected?
-                if ( !pEditor->GetView()->AreObjectsMarked() )
+                if ( !pEditor->GetView().AreObjectsMarked() )
                     rSet.DisableItem( nWh );
 
                 if ( IsReadOnly() )
@@ -326,7 +318,7 @@ void DialogWindow::GetState( SfxItemSet& rSet )
                 else
                 {
                     SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS );
-                    if ( GetEditor()->GetMode() == DlgEditor::SELECT )
+                    if ( GetEditor().GetMode() == DlgEditor::SELECT )
                         aItem.SetValue( SVX_SNAP_SELECT );
                     else
                     {
@@ -376,7 +368,7 @@ void DialogWindow::GetState( SfxItemSet& rSet )
             {
                 Shell* pShell = GetShell();
                 SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : NULL;
-                if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) && !pEditor->GetView()->AreObjectsMarked() )
+                if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) && !pEditor->GetView().AreObjectsMarked() )
                     rSet.DisableItem( nWh );
 
                 if ( IsReadOnly() )
@@ -415,7 +407,7 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq )
         case SID_CUT:
             if ( !IsReadOnly() )
             {
-                GetEditor()->Cut();
+                GetEditor().Cut();
                 if (SfxBindings* pBindings = GetBindingsPtr())
                     pBindings->Invalidate( SID_DOC_MODIFIED );
             }
@@ -423,49 +415,49 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq )
         case SID_DELETE:
             if ( !IsReadOnly() )
             {
-                GetEditor()->Delete();
+                GetEditor().Delete();
                 if (SfxBindings* pBindings = GetBindingsPtr())
                     pBindings->Invalidate( SID_DOC_MODIFIED );
             }
             break;
         case SID_COPY:
-            GetEditor()->Copy();
+            GetEditor().Copy();
             break;
         case SID_PASTE:
             if ( !IsReadOnly() )
             {
-                GetEditor()->Paste();
+                GetEditor().Paste();
                 if (SfxBindings* pBindings = GetBindingsPtr())
                     pBindings->Invalidate( SID_DOC_MODIFIED );
             }
             break;
         case SID_INSERT_FORM_RADIO:
-            GetEditor()->SetMode( DlgEditor::INSERT );
-            GetEditor()->SetInsertObj( OBJ_DLG_FORMRADIO );
+            GetEditor().SetMode( DlgEditor::INSERT );
+            GetEditor().SetInsertObj( OBJ_DLG_FORMRADIO );
             break;
         case SID_INSERT_FORM_CHECK:
-            GetEditor()->SetMode( DlgEditor::INSERT );
-            GetEditor()->SetInsertObj( OBJ_DLG_FORMCHECK );
+            GetEditor().SetMode( DlgEditor::INSERT );
+            GetEditor().SetInsertObj( OBJ_DLG_FORMCHECK );
             break;
         case SID_INSERT_FORM_LIST:
-            GetEditor()->SetMode( DlgEditor::INSERT );
-            GetEditor()->SetInsertObj( OBJ_DLG_FORMLIST );
+            GetEditor().SetMode( DlgEditor::INSERT );
+            GetEditor().SetInsertObj( OBJ_DLG_FORMLIST );
             break;
         case SID_INSERT_FORM_COMBO:
-            GetEditor()->SetMode( DlgEditor::INSERT );
-            GetEditor()->SetInsertObj( OBJ_DLG_FORMCOMBO );
+            GetEditor().SetMode( DlgEditor::INSERT );
+            GetEditor().SetInsertObj( OBJ_DLG_FORMCOMBO );
             break;
         case SID_INSERT_FORM_SPIN:
-            GetEditor()->SetMode( DlgEditor::INSERT );
-            GetEditor()->SetInsertObj( OBJ_DLG_FORMSPIN );
+            GetEditor().SetMode( DlgEditor::INSERT );
+            GetEditor().SetInsertObj( OBJ_DLG_FORMSPIN );
             break;
         case SID_INSERT_FORM_VSCROLL:
-            GetEditor()->SetMode( DlgEditor::INSERT );
-            GetEditor()->SetInsertObj( OBJ_DLG_FORMVSCROLL );
+            GetEditor().SetMode( DlgEditor::INSERT );
+            GetEditor().SetInsertObj( OBJ_DLG_FORMVSCROLL );
             break;
         case SID_INSERT_FORM_HSCROLL:
-            GetEditor()->SetMode( DlgEditor::INSERT );
-            GetEditor()->SetInsertObj( OBJ_DLG_FORMHSCROLL );
+            GetEditor().SetMode( DlgEditor::INSERT );
+            GetEditor().SetInsertObj( OBJ_DLG_FORMHSCROLL );
             break;
         case SID_CHOOSE_CONTROLS:
         {
@@ -477,154 +469,154 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq )
             {
                 case SVX_SNAP_PUSHBUTTON:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_PUSHBUTTON );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_PUSHBUTTON );
                 }
                 break;
                 case SVX_SNAP_RADIOBUTTON:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_RADIOBUTTON );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_RADIOBUTTON );
                 }
                 break;
                 case SVX_SNAP_CHECKBOX:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_CHECKBOX);
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_CHECKBOX);
                 }
                 break;
                 case SVX_SNAP_LISTBOX:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_LISTBOX );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_LISTBOX );
                 }
                 break;
                 case SVX_SNAP_COMBOBOX:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_COMBOBOX );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_COMBOBOX );
                 }
                 break;
                 case SVX_SNAP_GROUPBOX:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_GROUPBOX );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_GROUPBOX );
                 }
                 break;
                 case SVX_SNAP_EDIT:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_EDIT );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_EDIT );
                 }
                 break;
                 case SVX_SNAP_FIXEDTEXT:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_FIXEDTEXT );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_FIXEDTEXT );
                 }
                 break;
                 case SVX_SNAP_IMAGECONTROL:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_IMAGECONTROL );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_IMAGECONTROL );
                 }
                 break;
                 case SVX_SNAP_PROGRESSBAR:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_PROGRESSBAR );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_PROGRESSBAR );
                 }
                 break;
                 case SVX_SNAP_HSCROLLBAR:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_HSCROLLBAR );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_HSCROLLBAR );
                 }
                 break;
                 case SVX_SNAP_VSCROLLBAR:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_VSCROLLBAR );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_VSCROLLBAR );
                 }
                 break;
                 case SVX_SNAP_HFIXEDLINE:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_HFIXEDLINE );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_HFIXEDLINE );
                 }
                 break;
                 case SVX_SNAP_VFIXEDLINE:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_VFIXEDLINE );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_VFIXEDLINE );
                 }
                 break;
                 case SVX_SNAP_DATEFIELD:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_DATEFIELD );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_DATEFIELD );
                 }
                 break;
                 case SVX_SNAP_TIMEFIELD:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_TIMEFIELD );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_TIMEFIELD );
                 }
                 break;
                 case SVX_SNAP_NUMERICFIELD:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_NUMERICFIELD );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_NUMERICFIELD );
                 }
                 break;
                 case SVX_SNAP_CURRENCYFIELD:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_CURRENCYFIELD );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_CURRENCYFIELD );
                 }
                 break;
                 case SVX_SNAP_FORMATTEDFIELD:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_FORMATTEDFIELD );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_FORMATTEDFIELD );
                 }
                 break;
                 case SVX_SNAP_PATTERNFIELD:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_PATTERNFIELD );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_PATTERNFIELD );
                 }
                 break;
                 case SVX_SNAP_FILECONTROL:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_FILECONTROL );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_FILECONTROL );
                 }
                 break;
                 case SVX_SNAP_SPINBUTTON:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_SPINBUTTON );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_SPINBUTTON );
                 }
                 break;
                 case SVX_SNAP_TREECONTROL:
                 {
-                    GetEditor()->SetMode( DlgEditor::INSERT );
-                    GetEditor()->SetInsertObj( OBJ_DLG_TREECONTROL );
+                    GetEditor().SetMode( DlgEditor::INSERT );
+                    GetEditor().SetInsertObj( OBJ_DLG_TREECONTROL );
                 }
                 break;
 
                 case SVX_SNAP_SELECT:
                 {
-                    GetEditor()->SetMode( DlgEditor::SELECT );
+                    GetEditor().SetMode( DlgEditor::SELECT );
                 }
                 break;
             }
 
             if ( rReq.GetModifier() & KEY_MOD1 )
             {
-                if ( GetEditor()->GetMode() == DlgEditor::INSERT )
-                    GetEditor()->CreateDefaultObject();
+                if ( GetEditor().GetMode() == DlgEditor::INSERT )
+                    GetEditor().CreateDefaultObject();
             }
 
             if (SfxBindings* pBindings = GetBindingsPtr())
@@ -634,9 +626,9 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq )
 
         case SID_DIALOG_TESTMODE:
         {
-            DlgEditor::Mode eOldMode = GetEditor()->GetMode();
-            GetEditor()->SetMode( DlgEditor::TEST );
-            GetEditor()->SetMode( eOldMode );
+            DlgEditor::Mode eOldMode = GetEditor().GetMode();
+            GetEditor().SetMode( DlgEditor::TEST );
+            GetEditor().SetMode( eOldMode );
             rReq.Done();
             if (SfxBindings* pBindings = GetBindingsPtr())
                 pBindings->Invalidate( SID_DIALOG_TESTMODE );
@@ -722,7 +714,7 @@ bool DialogWindow::SaveDialog()
     ::rtl::OUString aDialogStr(IDE_RESSTR(RID_STR_STDDIALOGNAME));
     Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
     xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) );
-    xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
+    xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), String( RTL_CONSTASCII_USTRINGPARAM( FilterMask_All ) ) );
     xFltMgr->setCurrentFilter( aDialogStr );
 
     if( xFP->execute() == RET_OK )
@@ -984,7 +976,7 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri
     ::rtl::OUString aDialogStr(IDE_RESSTR(RID_STR_STDDIALOGNAME));
     Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
     xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) );
-    xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
+    xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), String( RTL_CONSTASCII_USTRINGPARAM( FilterMask_All ) ) );
     xFltMgr->setCurrentFilter( aDialogStr );
 
     if( xFP->execute() == RET_OK )
@@ -1267,19 +1259,19 @@ bool DialogWindow::ImportDialog()
     return implImportDialog( this, aCurPath, rDocument, aLibName );
 }
 
-DlgEdModel* DialogWindow::GetModel() const
+DlgEdModel& DialogWindow::GetModel() const
 {
-    return pEditor ? pEditor->GetModel() : NULL;
+    return pEditor->GetModel();
 }
 
-DlgEdPage* DialogWindow::GetPage() const
+DlgEdPage& DialogWindow::GetPage() const
 {
-    return pEditor ? pEditor->GetPage() : NULL;
+    return pEditor->GetPage();
 }
 
-DlgEdView* DialogWindow::GetView() const
+DlgEdView& DialogWindow::GetView() const
 {
-    return pEditor ? pEditor->GetView() : NULL;
+    return pEditor->GetView();
 }
 
 bool DialogWindow::IsModified()
@@ -1289,7 +1281,7 @@ bool DialogWindow::IsModified()
 
 ::svl::IUndoManager* DialogWindow::GetUndoManager()
 {
-    return pUndoMgr;
+    return pUndoMgr.get();
 }
 
 ::rtl::OUString DialogWindow::GetTitle()
@@ -1308,18 +1300,17 @@ EntryDescriptor DialogWindow::CreateEntryDescriptor()
 
 void DialogWindow::SetReadOnly (bool bReadOnly)
 {
-    if (pEditor)
-        pEditor->SetMode(bReadOnly ? DlgEditor::READONLY : DlgEditor::SELECT);
+    pEditor->SetMode(bReadOnly ? DlgEditor::READONLY : DlgEditor::SELECT);
 }
 
 bool DialogWindow::IsReadOnly ()
 {
-    return pEditor && pEditor->GetMode() == DlgEditor::READONLY;
+    return pEditor->GetMode() == DlgEditor::READONLY;
 }
 
 bool DialogWindow::IsPasteAllowed()
 {
-    return pEditor && pEditor->IsPasteAllowed();
+    return pEditor->IsPasteAllowed();
 }
 
 void DialogWindow::StoreData()
diff --git a/basctl/source/basicide/basidectrlr.cxx b/basctl/source/basicide/basidectrlr.cxx
index 262afb1..6af4587 100644
--- a/basctl/source/basicide/basidectrlr.cxx
+++ b/basctl/source/basicide/basidectrlr.cxx
@@ -34,9 +34,13 @@ using namespace com::sun::star;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::beans;
 
+namespace
+{
+
+int const nPropertyIconId = 1;
+rtl::OUString const sPropertyIconId("IconId");
 
-#define PROPERTY_ID_ICONID      1
-#define PROPERTY_ICONID         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconId" ) )
+}
 
 
 //----------------------------------------------------------------------------
@@ -46,7 +50,11 @@ Controller::Controller (Shell* pViewShell)
     ,SfxBaseController( pViewShell )
     ,m_nIconId( ICON_MACROLIBRARY )
 {
-    registerProperty( PROPERTY_ICONID, PROPERTY_ID_ICONID, PropertyAttribute::READONLY, &m_nIconId, ::getCppuType( &m_nIconId ) );
+    registerProperty(
+        sPropertyIconId, nPropertyIconId,
+        PropertyAttribute::READONLY,
+        &m_nIconId, getCppuType(&m_nIconId)
+    );
 }
 
 //----------------------------------------------------------------------------
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index f7bb0ef..5f6d86b 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -142,7 +142,7 @@ sal_uInt16 Shell::GetWindowId(const BaseWindow* pWin) const
 SdrView* Shell::GetCurDlgView() const
 {
     if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin))
-        return pDCurWin->GetView();
+        return &pDCurWin->GetView();
     else
         return 0;
 }
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index e81b3a6..5b64d24 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -147,13 +147,18 @@ SFX_IMPL_INTERFACE( basctl_Shell, SfxViewShell, IDEResId( RID_STR_IDENAME ) )
 
 
 
-#define IDE_VIEWSHELL_FLAGS     (SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW)
+namespace
+{
+
+unsigned const ShellFlags = SFX_VIEW_CAN_PRINT | SFX_VIEW_NO_NEWWINDOW;
+
+}
 
 
 unsigned Shell::nShellCount = 0;
 
 Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) :
-    SfxViewShell( pFrame_, IDE_VIEWSHELL_FLAGS ),
+    SfxViewShell( pFrame_, ShellFlags ),
     m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
     aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ),
     aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ),
@@ -195,7 +200,7 @@ void Shell::Init()
     m_aCurDocument = ScriptDocument::getApplicationScriptDocument();
     bCreatingWindow = false;
 
-    pTabBar = new TabBar( &GetViewFrame()->GetWindow() );
+    pTabBar.reset(new TabBar(&GetViewFrame()->GetWindow()));
     pTabBar->SetSplitHdl( LINK( this, Shell, TabBarSplitHdl ) );
     bTabBarSplitted = false;
 
@@ -238,8 +243,6 @@ Shell::~Shell()
         delete it->second;
     }
 
-    delete pTabBar;
-
     // Destroy all ContainerListeners for Basic Container.
     if (ContainerListenerImpl* pListener = static_cast<ContainerListenerImpl*>(m_xLibListener.get()))
         pListener->removeContainerListener(m_aCurDocument, m_aCurLibName);
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 7990efb..e7a9b4e 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -273,11 +273,11 @@ namespace
 
     ::std::auto_ptr< MacroChooser > pChooser( new MacroChooser( NULL, true ) );
     if ( bChooseOnly || !SvtModuleOptions().IsBasicIDE() )
-        pChooser->SetMode( MACROCHOOSER_CHOOSEONLY );
+        pChooser->SetMode(MacroChooser::ChooseOnly);
 
     if ( !bChooseOnly && rxLimitToDocument.is() )
         // Hack!
-        pChooser->SetMode( MACROCHOOSER_RECORDING );
+        pChooser->SetMode(MacroChooser::Recording);
 
     short nRetValue = pChooser->Execute();
 
@@ -285,10 +285,10 @@ namespace
 
     switch ( nRetValue )
     {
-        case MACRO_OK_RUN:
+        case Macro_OkRun:
         {
             pMethod = pChooser->GetMacro();
-            if ( !pMethod && pChooser->GetMode() == MACROCHOOSER_RECORDING )
+            if ( !pMethod && pChooser->GetMode() == MacroChooser::Recording )
                 pMethod = pChooser->CreateMacro();
 
             if ( !pMethod )
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index 576ab8b..5da04e9 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -196,7 +196,7 @@ bool RenameDialog (
     DialogWindow* pWin = pShell ? pShell->FindDlgWin(rDocument, rLibName, rOldName) : 0;
     Reference< XNameContainer > xExistingDialog;
     if ( pWin )
-        xExistingDialog = pWin->GetEditor()->GetDialog();
+        xExistingDialog = pWin->GetEditor().GetDialog();
 
     if ( xExistingDialog.is() )
         LocalizationMgr::renameStringResourceIDs( rDocument, rLibName, rNewName, xExistingDialog );
diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx
index 0178fa8..acd531f 100644
--- a/basctl/source/basicide/bastype2.hxx
+++ b/basctl/source/basicide/bastype2.hxx
@@ -51,9 +51,12 @@ enum EntryType
     OBJ_TYPE_CLASS_MODULES
 };
 
-#define BROWSEMODE_MODULES      0x01
-#define BROWSEMODE_SUBS         0x02
-#define BROWSEMODE_DIALOGS      0x04
+enum
+{
+    BROWSEMODE_MODULES  = 0x01,
+    BROWSEMODE_SUBS     = 0x02,
+    BROWSEMODE_DIALOGS  = 0x04,
+};
 
 class Entry
 {
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 1166221..bc4d32b 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -837,19 +837,19 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
     do
     {
         // password dialog
-        SfxPasswordDialog* pDlg = new SfxPasswordDialog( Application::GetDefDialogParent() );
-        pDlg->SetMinLen( 1 );
+        SfxPasswordDialog aDlg(Application::GetDefDialogParent());
+        aDlg.SetMinLen( 1 );
 
         // set new title
         if ( bNewTitle )
         {
             ::rtl::OUString aTitle(IDE_RESSTR(RID_STR_ENTERPASSWORD));
             aTitle = aTitle.replaceAll("XX", rLibName);
-            pDlg->SetText( aTitle );
+            aDlg.SetText( aTitle );
         }
 
         // execute dialog
-        nRet = pDlg->Execute();
+        nRet = aDlg.Execute();
 
         // verify password
         if ( nRet == RET_OK )
@@ -859,7 +859,7 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
                 Reference< script::XLibraryContainerPassword > xPasswd( xLibContainer, UNO_QUERY );
                 if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( rLibName ) && !xPasswd->isLibraryPasswordVerified( rLibName ) )
                 {
-                    rPassword = pDlg->GetPassword();
+                    rPassword = aDlg.GetPassword();
                     //                    ::rtl::OUString aOUPassword( rPassword );
                     bOK = xPasswd->verifyLibraryPassword( rLibName, rPassword );
 
@@ -871,8 +871,6 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
                 }
             }
         }
-
-        delete pDlg;
     }
     while ( bRepeat && !bOK && nRet == RET_OK );
 
diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx
index bc863a2..28133d1 100644
--- a/basctl/source/basicide/doceventnotifier.cxx
+++ b/basctl/source/basicide/doceventnotifier.cxx
@@ -55,7 +55,7 @@ namespace basctl
     namespace csslang = ::com::sun::star::lang;
 
     //====================================================================
-    //= DocumentEventNotifier_Impl
+    //= DocumentEventNotifier::Impl
     //====================================================================
     typedef ::cppu::WeakComponentImplHelper1    <   XEventListener
                                                 >   DocumentEventNotifier_Impl_Base;
@@ -68,12 +68,13 @@ namespace basctl
 
     /** impl class for DocumentEventNotifier
     */
-    class DocumentEventNotifier_Impl    :public ::boost::noncopyable
+    class DocumentEventNotifier::Impl   :public ::boost::noncopyable
                                         ,public ::cppu::BaseMutex
                                         ,public DocumentEventNotifier_Impl_Base
     {
     public:
-        DocumentEventNotifier_Impl( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument );
+        Impl (DocumentEventListener&, Reference<XModel> const& rxDocument);
+        ~Impl ();
 
         // document::XEventListener
         virtual void SAL_CALL notifyEvent( const EventObject& Event ) throw (RuntimeException);
@@ -84,9 +85,6 @@ namespace basctl
         // ComponentHelper
         virtual void SAL_CALL disposing();
 
-    protected:
-        ~DocumentEventNotifier_Impl();
-
     private:
         /// determines whether the instance is already disposed
         bool    impl_isDisposed_nothrow() const { return m_pListener == NULL; }
@@ -103,10 +101,10 @@ namespace basctl
     };
 
     //--------------------------------------------------------------------
-    DocumentEventNotifier_Impl::DocumentEventNotifier_Impl( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument )
-        :DocumentEventNotifier_Impl_Base( m_aMutex )
-        ,m_pListener( &_rListener )
-        ,m_xModel( _rxDocument )
+    DocumentEventNotifier::Impl::Impl (DocumentEventListener& rListener, Reference<XModel> const& rxDocument) :
+        DocumentEventNotifier_Impl_Base(m_aMutex),
+        m_pListener(&rListener),
+        m_xModel(rxDocument)
     {
         osl_incrementInterlockedCount( &m_refCount );
         impl_listenerAction_nothrow( RegisterListener );
@@ -114,7 +112,7 @@ namespace basctl
     }
 
     //--------------------------------------------------------------------
-    DocumentEventNotifier_Impl::~DocumentEventNotifier_Impl()
+    DocumentEventNotifier::Impl::~Impl ()
     {
         if ( !impl_isDisposed_nothrow() )
         {
@@ -124,16 +122,16 @@ namespace basctl
     }
 
     //--------------------------------------------------------------------
-    void SAL_CALL DocumentEventNotifier_Impl::notifyEvent( const EventObject& _rEvent ) throw (RuntimeException)
+    void SAL_CALL DocumentEventNotifier::Impl::notifyEvent( const EventObject& _rEvent ) throw (RuntimeException)
     {
         ::osl::ClearableMutexGuard aGuard( m_aMutex );
 
-        OSL_PRECOND( !impl_isDisposed_nothrow(), "DocumentEventNotifier_Impl::notifyEvent: disposed, but still getting events?" );
+        OSL_PRECOND( !impl_isDisposed_nothrow(), "DocumentEventNotifier::Impl::notifyEvent: disposed, but still getting events?" );
         if ( impl_isDisposed_nothrow() )
             return;
 
         Reference< XModel > xDocument( _rEvent.Source, UNO_QUERY );
-        OSL_ENSURE( xDocument.is(), "DocumentEventNotifier_Impl::notifyEvent: illegal source document!" );
+        OSL_ENSURE( xDocument.is(), "DocumentEventNotifier::Impl::notifyEvent: illegal source document!" );
         if ( !xDocument.is() )
             return;
 
@@ -178,7 +176,7 @@ namespace basctl
     }
 
     //--------------------------------------------------------------------
-    void SAL_CALL DocumentEventNotifier_Impl::disposing( const csslang::EventObject& /*Event*/ ) throw (RuntimeException)
+    void SAL_CALL DocumentEventNotifier::Impl::disposing( const csslang::EventObject& /*Event*/ ) throw (RuntimeException)
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
@@ -188,21 +186,21 @@ namespace basctl
     }
 
     //--------------------------------------------------------------------
-    void SAL_CALL DocumentEventNotifier_Impl::disposing()
+    void SAL_CALL DocumentEventNotifier::Impl::disposing()
     {
         impl_listenerAction_nothrow( RemoveListener );
         impl_dispose_nothrow();
     }
 
     //--------------------------------------------------------------------
-    void DocumentEventNotifier_Impl::impl_dispose_nothrow()
+    void DocumentEventNotifier::Impl::impl_dispose_nothrow()
     {
         m_pListener = NULL;
         m_xModel.clear();
     }
 
     //--------------------------------------------------------------------
-    void DocumentEventNotifier_Impl::impl_listenerAction_nothrow( ListenerAction _eAction )
+    void DocumentEventNotifier::Impl::impl_listenerAction_nothrow( ListenerAction _eAction )
     {
         try
         {
@@ -231,16 +229,14 @@ namespace basctl
     //= DocumentEventNotifier
     //====================================================================
     //--------------------------------------------------------------------
-    DocumentEventNotifier::DocumentEventNotifier( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument )
-        :m_pImpl( new DocumentEventNotifier_Impl( _rListener, _rxDocument ) )
-    {
-    }
+    DocumentEventNotifier::DocumentEventNotifier (DocumentEventListener& rListener, Reference<XModel> const& rxDocument) :
+        m_pImpl(new Impl(rListener, rxDocument))
+    { }
 
     //--------------------------------------------------------------------
-    DocumentEventNotifier::DocumentEventNotifier( DocumentEventListener& _rListener )
-        :m_pImpl( new DocumentEventNotifier_Impl( _rListener, Reference< XModel >() ) )
-    {
-    }
+    DocumentEventNotifier::DocumentEventNotifier (DocumentEventListener& rListener) :
+        m_pImpl(new Impl(rListener, Reference<XModel>()))
+    { }
 
     //--------------------------------------------------------------------
     DocumentEventNotifier::~DocumentEventNotifier()
diff --git a/basctl/source/basicide/docsignature.cxx b/basctl/source/basicide/docsignature.cxx
index 17adaf3..0124f52 100644
--- a/basctl/source/basicide/docsignature.cxx
+++ b/basctl/source/basicide/docsignature.cxx
@@ -38,25 +38,25 @@ namespace basctl
     /** === end UNO using === **/
 
     //====================================================================
-    //= DocumentSignature_Data
+    //= DocumentSignature::Impl
     //====================================================================
-    struct DocumentSignature_Data
+    struct DocumentSignature::Impl
     {
-        SfxObjectShell*   pShell;
+        SfxObjectShell* pShell;
 
-        DocumentSignature_Data() : pShell( NULL ) { }
+        Impl () : pShell(0) { }
     };
 
     //====================================================================
     //= DocumentSignature
     //====================================================================
     //--------------------------------------------------------------------
-    DocumentSignature::DocumentSignature( const ScriptDocument& _rDocument )
-        :m_pData( new DocumentSignature_Data )
+    DocumentSignature::DocumentSignature (ScriptDocument const& rDocument) :
+        m_pImpl(new Impl)
     {
-        if ( _rDocument.isDocument() )
+        if (rDocument.isDocument())
         {
-            Reference< XModel > xDocument( _rDocument.getDocument() );
+            Reference<XModel> xDocument(rDocument.getDocument());
             // find object shell for document
             SfxObjectShell* pShell = SfxObjectShell::GetFirst();
             while ( pShell )
@@ -65,7 +65,7 @@ namespace basctl
                     break;
                 pShell = SfxObjectShell::GetNext( *pShell );
             }
-            m_pData->pShell = pShell;
+            m_pImpl->pShell = pShell;
         }
     }
 
@@ -77,22 +77,22 @@ namespace basctl
     //--------------------------------------------------------------------
     bool DocumentSignature::supportsSignatures() const
     {
-        return ( m_pData->pShell != NULL );
+        return ( m_pImpl->pShell != NULL );
     }
 
     //--------------------------------------------------------------------
     void DocumentSignature::signScriptingContent() const
     {
         OSL_PRECOND( supportsSignatures(), "DocumentSignature::signScriptingContent: signatures not supported by this document!" );
-        if ( m_pData->pShell )
-            m_pData->pShell->SignScriptingContent();
+        if ( m_pImpl->pShell )
+            m_pImpl->pShell->SignScriptingContent();
     }
 
     //--------------------------------------------------------------------
     sal_uInt16 DocumentSignature::getScriptingSignatureState() const
     {
-        if ( m_pData->pShell )
-            return m_pData->pShell->GetScriptingSignatureState();
+        if ( m_pImpl->pShell )
+            return m_pImpl->pShell->GetScriptingSignatureState();
         return SIGNATURESTATE_NOSIGNATURES;
     }
 
diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx
index c4c55b2..62004ad 100644
--- a/basctl/source/basicide/localizationmgr.cxx
+++ b/basctl/source/basicide/localizationmgr.cxx
@@ -38,36 +38,38 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::resource;
 
-static ::rtl::OUString aDot( RTL_CONSTASCII_USTRINGPARAM( "." ));
-static ::rtl::OUString aEsc( RTL_CONSTASCII_USTRINGPARAM( "&" ));
-static ::rtl::OUString aSemi( RTL_CONSTASCII_USTRINGPARAM( ";" ));
-
-
-LocalizationMgr::LocalizationMgr( Shell* pShell,
-    const ScriptDocument& rDocument, ::rtl::OUString aLibName,
-    const Reference< XStringResourceManager >& xStringResourceManager )
-        : m_xStringResourceManager( xStringResourceManager )
-        , m_pShell( pShell )
-        , m_aDocument( rDocument )
-        , m_aLibName( aLibName )
+namespace
 {
-}
 
-bool LocalizationMgr::isLibraryLocalized( void )
+rtl::OUString const aDot(".");
+rtl::OUString const aEsc("&");
+rtl::OUString const aSemi(";");
+
+} // namespace
+
+LocalizationMgr::LocalizationMgr(
+    Shell* pShell,
+    ScriptDocument const& rDocument,
+    rtl::OUString const& aLibName,
+    Reference<XStringResourceManager> const& xStringResourceManager
+) :
+    m_xStringResourceManager(xStringResourceManager),
+    m_pShell(pShell),
+    m_aDocument(rDocument),
+    m_aLibName(aLibName)
+{ }
+
+bool LocalizationMgr::isLibraryLocalized ()
 {
-    bool bRet = false;
-    if( m_xStringResourceManager.is() )
-    {
-        Sequence< Locale > aLocaleSeq = m_xStringResourceManager->getLocales();
-        bRet = ( aLocaleSeq.getLength() > 0 );
-    }
-    return bRet;
+    if (m_xStringResourceManager.is())
+        return m_xStringResourceManager->getLocales().getLength() > 0;
+    return false;
 }
 
-void LocalizationMgr::handleTranslationbar( void )
+void LocalizationMgr::handleTranslationbar ()
 {
-    static ::rtl::OUString aLayoutManagerName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ));
-    static ::rtl::OUString aToolBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/translationbar" ));
+    static rtl::OUString const aLayoutManagerName("LayoutManager");
+    static rtl::OUString const aToolBarResName("private:resource/toolbar/translationbar");
 
     Reference< beans::XPropertySet > xFrameProps
         ( m_pShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
@@ -94,38 +96,34 @@ void LocalizationMgr::handleTranslationbar( void )
 
 // TODO: -> export from toolkit
 
-struct LanguageDependentProp
+namespace
 {
-    const char* pPropName;
-    sal_Int32   nPropNameLength;
-};
 
-static LanguageDependentProp aLanguageDependentProp[] =
-{
-    { "Text",            4 },
-    { "Label",           5 },
-    { "Title",           5 },
-    { "HelpText",        8 },
-    { "CurrencySymbol", 14 },
-    { "StringItemList", 14 },
-    { 0, 0                 }
-};
+
+}
 
 bool isLanguageDependentProperty( ::rtl::OUString aName )
 {
-    bool bRet = false;
-
-    LanguageDependentProp* pLangDepProp = aLanguageDependentProp;
-    while( pLangDepProp->pPropName != 0 )
+    static struct Prop
     {
-        if( aName.equalsAsciiL( pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
-        {
-            bRet = true;
-            break;
-        }
-        pLangDepProp++;
+        const char* sName;
+        sal_Int32 nNameLength;
     }
-    return bRet;
+    const vProp[] =
+    {
+        { "Text",            4 },
+        { "Label",           5 },
+        { "Title",           5 },
+        { "HelpText",        8 },
+        { "CurrencySymbol", 14 },
+        { "StringItemList", 14 },
+        { 0, 0                 }
+    };
+
+    for (Prop const* pProp = vProp; pProp->sName; ++pProp)
+        if (aName.equalsAsciiL(pProp->sName, pProp->nNameLength))
+            return true;
+    return false;
 }
 
 
@@ -779,8 +777,7 @@ void LocalizationMgr::handleSetCurrentLocale( ::com::sun::star::lang::Locale aLo
 
         if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(m_pShell->GetCurWindow()))
             if (!pDlgWin->IsSuspended())
-                if (DlgEditor* pWinEditor = pDlgWin->GetEditor())
-                    pWinEditor->UpdatePropertyBrowserDelayed();
+                pDlgWin->GetEditor().UpdatePropertyBrowserDelayed();
     }
 }
 
@@ -812,8 +809,7 @@ DialogWindow* FindDialogWindowForEditor( DlgEditor* pEditor )
         if (!pWin->IsSuspended())
             if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin))
             {
-                DlgEditor* pWinEditor = pDlgWin->GetEditor();
-                if( pWinEditor == pEditor )
+                if (&pDlgWin->GetEditor() == pEditor)
                     return pDlgWin;
             }
     }
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 6697882..4feb8ff 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -60,34 +60,31 @@ using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
 MacroChooser::MacroChooser( Window* pParnt, bool bCreateEntries ) :
-        SfxModalDialog(     pParnt, IDEResId( RID_MACROCHOOSER ) ),
-        aMacroNameTxt(      this,   IDEResId( RID_TXT_MACRONAME ) ),
-        aMacroNameEdit(     this,   IDEResId( RID_ED_MACRONAME ) ),
-        aMacroFromTxT(      this,   IDEResId( RID_TXT_MACROFROM ) ),
-        aMacrosSaveInTxt(   this,   IDEResId( RID_TXT_SAVEMACRO ) ),
-        aBasicBox(          this,   IDEResId( RID_CTRL_LIB ) ),
-        aMacrosInTxt(       this,   IDEResId( RID_TXT_MACROSIN ) ),
-        aMacroBox(          this,   IDEResId( RID_CTRL_MACRO ) ),
-        aRunButton(         this,   IDEResId( RID_PB_RUN ) ),
-        aCloseButton(       this,   IDEResId( RID_PB_CLOSE ) ),
-        aAssignButton(      this,   IDEResId( RID_PB_ASSIGN ) ),
-        aEditButton(        this,   IDEResId( RID_PB_EDIT ) ),
-        aNewDelButton(      this,   IDEResId( RID_PB_DEL ) ),
-        aOrganizeButton(    this,   IDEResId( RID_PB_ORG ) ),
-        aHelpButton(        this,   IDEResId( RID_PB_HELP ) ),
-        aNewLibButton(      this,   IDEResId( RID_PB_NEWLIB ) ),
-        aNewModButton(      this,   IDEResId( RID_PB_NEWMOD ) )
-{
-    FreeResource();
-
-    nMode = MACROCHOOSER_ALL;
-    bNewDelIsDel = true;
-
+    SfxModalDialog(     pParnt, IDEResId( RID_MACROCHOOSER ) ),
+    aMacroNameTxt(      this,   IDEResId( RID_TXT_MACRONAME ) ),
+    aMacroNameEdit(     this,   IDEResId( RID_ED_MACRONAME ) ),
+    aMacroFromTxT(      this,   IDEResId( RID_TXT_MACROFROM ) ),
+    aMacrosSaveInTxt(   this,   IDEResId( RID_TXT_SAVEMACRO ) ),
+    aBasicBox(          this,   IDEResId( RID_CTRL_LIB ) ),
+    aMacrosInTxt(       this,   IDEResId( RID_TXT_MACROSIN ) ),
+    aMacrosInTxtBaseStr(aMacrosInTxt.GetText()),
+    aMacroBox(          this,   IDEResId( RID_CTRL_MACRO ) ),
+    aRunButton(         this,   IDEResId( RID_PB_RUN ) ),
+    aCloseButton(       this,   IDEResId( RID_PB_CLOSE ) ),
+    aAssignButton(      this,   IDEResId( RID_PB_ASSIGN ) ),
+    aEditButton(        this,   IDEResId( RID_PB_EDIT ) ),
+    aNewDelButton(      this,   IDEResId( RID_PB_DEL ) ),
+    aOrganizeButton(    this,   IDEResId( RID_PB_ORG ) ),
+    aHelpButton(        this,   IDEResId( RID_PB_HELP ) ),
+    aNewLibButton(      this,   IDEResId( RID_PB_NEWLIB ) ),
+    aNewModButton(      this,   IDEResId( RID_PB_NEWMOD ) ),
+    bNewDelIsDel(true),
     // the Sfx doesn't aske the BasicManger whether modified or not
     // => start saving in case of a change without a into the BasicIDE.
-    bForceStoreBasic = false;
-
-    aMacrosInTxtBaseStr = aMacrosInTxt.GetText();
+    bForceStoreBasic(false),
+    nMode(All)
+{
+    FreeResource();
 
     aMacroBox.SetSelectionMode( SINGLE_SELECTION );
     aMacroBox.SetHighlightRange(); // select over the whole width
@@ -99,7 +96,7 @@ MacroChooser::MacroChooser( Window* pParnt, bool bCreateEntries ) :
     aNewDelButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
     aOrganizeButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
 
-    // Buttons only for MACROCHOOSER_RECORDING
+    // Buttons only for MacroChooser::Recording
     aNewLibButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
     aNewModButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
     aNewLibButton.Hide();       // default
@@ -252,7 +249,7 @@ void MacroChooser::EnableButton( Button& rButton, bool bEnable )
 {
     if ( bEnable )
     {
-        if ( nMode == MACROCHOOSER_CHOOSEONLY || nMode == MACROCHOOSER_RECORDING )
+        if (nMode == ChooseOnly || nMode == Recording)
             rButton.Enable(&rButton == &aRunButton);
         else
             rButton.Enable();
@@ -418,11 +415,11 @@ void MacroChooser::CheckButtons()
         }
     }
 
-    if ( nMode != MACROCHOOSER_RECORDING )
+    if (nMode != Recording)
     {
         // Run...
         bool bEnable = pMethod ? true : false;
-        if ( ( nMode != MACROCHOOSER_CHOOSEONLY ) && StarBASIC::IsRunning() )
+        if (nMode != ChooseOnly && StarBASIC::IsRunning())
             bEnable = false;
         EnableButton( aRunButton, bEnable );
     }
@@ -436,22 +433,21 @@ void MacroChooser::CheckButtons()
     EnableButton( aEditButton, pMacroEntry ? true : false );
 
     // aOrganizeButton
-    EnableButton( aOrganizeButton, !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL ));
+    EnableButton( aOrganizeButton, !StarBASIC::IsRunning() && nMode == All );
 
     // aNewDelButton....
     bool bProtected = aBasicBox.IsEntryProtected( pCurEntry );
     bool bShare = ( aDesc.GetLocation() == LIBRARY_LOCATION_SHARE );
-    EnableButton( aNewDelButton,
-        !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL ) && !bProtected && !bReadOnly && !bShare );
+    EnableButton(aNewDelButton, !StarBASIC::IsRunning() && nMode == All && !bProtected && !bReadOnly && !bShare);
     bool bPrev = bNewDelIsDel;
     bNewDelIsDel = pMethod ? true : false;
-    if ( ( bPrev != bNewDelIsDel ) && ( nMode == MACROCHOOSER_ALL ) )
+    if (bPrev != bNewDelIsDel && nMode == All)
     {
         String aBtnText( bNewDelIsDel ? IDEResId( RID_STR_BTNDEL) : IDEResId( RID_STR_BTNNEW ) );
         aNewDelButton.SetText( aBtnText );
     }
 
-    if ( nMode == MACROCHOOSER_RECORDING )
+    if (nMode == Recording)
     {
         // save button
         aRunButton.Enable(!bProtected && !bReadOnly && !bShare);
@@ -467,14 +463,14 @@ void MacroChooser::CheckButtons()
 IMPL_LINK_NOARG_INLINE_START(MacroChooser, MacroDoubleClickHdl)
 {
     StoreMacroDescription();
-    if ( nMode == MACROCHOOSER_RECORDING )
+    if (nMode == Recording)
     {
         SbMethod* pMethod = GetMacro();
         if ( pMethod && !QueryReplaceMacro( pMethod->GetName(), this ) )
             return 0;
     }
 
-    EndDialog( MACRO_OK_RUN );
+    EndDialog(Macro_OkRun);
     return 0;
 }
 IMPL_LINK_NOARG_INLINE_END(MacroChooser, MacroDoubleClickHdl)
@@ -618,7 +614,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
         StoreMacroDescription();
 
         // #116444# check security settings before macro execution
-        if ( nMode == MACROCHOOSER_ALL )
+        if (nMode == All)
         {
             SbMethod* pMethod = GetMacro();
             SbModule* pModule = pMethod ? pMethod->GetModule() : NULL;
@@ -634,7 +630,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
                 }
             }
         }
-        else if ( nMode == MACROCHOOSER_RECORDING )
+        else if (nMode == Recording )
         {
             if ( !IsValidSbxName(aMacroNameEdit.GetText()) )
             {
@@ -649,12 +645,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
                 return 0;
         }
 
-        EndDialog( MACRO_OK_RUN );
+        EndDialog(Macro_OkRun);
     }
     else if ( pButton == &aCloseButton )
     {
         StoreMacroDescription();
-        EndDialog( MACRO_CLOSE );
+        EndDialog(Macro_Close);
     }
     else if ( ( pButton == &aEditButton ) || ( pButton == &aNewDelButton ) )
     {
@@ -687,7 +683,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
 
             if (SfxDispatcher* pDispatcher = GetDispatcher())
                 pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L );
-            EndDialog( MACRO_EDIT );
+            EndDialog(Macro_Edit);
         }
         else
         {
@@ -724,7 +720,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
                     if (SfxDispatcher* pDispatcher = GetDispatcher())
                         pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L );
                     StoreMacroDescription();
-                    EndDialog( MACRO_NEW );
+                    EndDialog(Macro_New);
                 }
             }
         }
@@ -780,7 +776,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
 
         if ( nRet ) // not only closed
         {
-            EndDialog( MACRO_EDIT );
+            EndDialog(Macro_Edit);
             return 0;
         }
 
@@ -805,42 +801,50 @@ void MacroChooser::UpdateFields()
         aMacroNameEdit.SetText( aMacroBox.GetEntryText( pMacroEntry ) );
 }
 
-void MacroChooser::SetMode( sal_uInt16 nM )
+void MacroChooser::SetMode (Mode nM)
 {
     nMode = nM;
-    if ( nMode == MACROCHOOSER_ALL )
+    switch (nMode)
     {
-        aRunButton.SetText( String( IDEResId( RID_STR_RUN ) ) );
-        EnableButton( aNewDelButton, true );
-        EnableButton( aOrganizeButton, true );
-    }
-    else if ( nMode == MACROCHOOSER_CHOOSEONLY )
-    {
-        aRunButton.SetText( String( IDEResId( RID_STR_CHOOSE ) ) );
-        EnableButton( aNewDelButton, false );
-        EnableButton( aOrganizeButton, false );
-    }
-    else if ( nMode == MACROCHOOSER_RECORDING )
-    {
-        aRunButton.SetText( String( IDEResId( RID_STR_RECORD ) ) );
-        EnableButton( aNewDelButton, false );
-        EnableButton( aOrganizeButton, false );
-
-        aAssignButton.Hide();
-        aEditButton.Hide();
-        aNewDelButton.Hide();
-        aOrganizeButton.Hide();
-        aMacroFromTxT.Hide();
-
-        aNewLibButton.Show();
-        aNewModButton.Show();
-        aMacrosSaveInTxt.Show();
-
-        Point aHelpPos = aHelpButton.GetPosPixel();
-        Point aHelpPosLogic = PixelToLogic( aHelpPos, MapMode(MAP_APPFONT) );
-        aHelpPosLogic.Y() -= 34;
-        aHelpPos = LogicToPixel( aHelpPosLogic, MapMode(MAP_APPFONT) );
-        aHelpButton.SetPosPixel( aHelpPos );
+        case All:
+        {
+            aRunButton.SetText( String( IDEResId( RID_STR_RUN ) ) );
+            EnableButton( aNewDelButton, true );
+            EnableButton( aOrganizeButton, true );
+            break;
+        }
+
+        case ChooseOnly:
+        {
+            aRunButton.SetText( String( IDEResId( RID_STR_CHOOSE ) ) );
+            EnableButton( aNewDelButton, false );
+            EnableButton( aOrganizeButton, false );
+            break;
+        }
+
+        case Recording:
+        {
+            aRunButton.SetText( String( IDEResId( RID_STR_RECORD ) ) );
+            EnableButton( aNewDelButton, false );
+            EnableButton( aOrganizeButton, false );
+
+            aAssignButton.Hide();
+            aEditButton.Hide();
+            aNewDelButton.Hide();
+            aOrganizeButton.Hide();
+            aMacroFromTxT.Hide();
+
+            aNewLibButton.Show();
+            aNewModButton.Show();
+            aMacrosSaveInTxt.Show();
+
+            Point aHelpPos = aHelpButton.GetPosPixel();
+            Point aHelpPosLogic = PixelToLogic( aHelpPos, MapMode(MAP_APPFONT) );
+            aHelpPosLogic.Y() -= 34;
+            aHelpPos = LogicToPixel( aHelpPosLogic, MapMode(MAP_APPFONT) );
+            aHelpButton.SetPosPixel( aHelpPos );
+            break;
+        }
     }
     CheckButtons();
 }
diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx
index c771ef9..083cb2e 100644
--- a/basctl/source/basicide/macrodlg.hxx
+++ b/basctl/source/basicide/macrodlg.hxx
@@ -32,17 +32,22 @@
 namespace basctl
 {
 
-#define MACRO_CLOSE         10
-#define MACRO_OK_RUN        11
-#define MACRO_NEW           12
-#define MACRO_EDIT          14
-
-#define MACROCHOOSER_ALL            1
-#define MACROCHOOSER_CHOOSEONLY     2
-#define MACROCHOOSER_RECORDING      3
+enum MacroExitCode {
+    Macro_Close = 10,
+    Macro_OkRun = 11,
+    Macro_New   = 12,
+    Macro_Edit  = 14,
+};
 
 class MacroChooser : public SfxModalDialog
 {
+public:
+    enum Mode {
+        All = 1,
+        ChooseOnly = 2,
+        Recording = 3,
+    };
+
 private:
     FixedText               aMacroNameTxt;
     Edit                    aMacroNameEdit;
@@ -66,7 +71,7 @@ private:
     bool                    bNewDelIsDel;
     bool                    bForceStoreBasic;
 
-    sal_uInt16              nMode;
+    Mode                    nMode;
 
     DECL_LINK( MacroSelectHdl, SvTreeListBox * );
     DECL_LINK(MacroDoubleClickHdl, void *);
@@ -95,8 +100,8 @@ public:
 
     virtual short       Execute();
 
-    void                SetMode( sal_uInt16 nMode );
-    sal_uInt16          GetMode() const { return nMode; }
+    void                SetMode (Mode);
+    Mode                GetMode () const { return nMode; }
 };
 
 } // namespace basctl
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 94cd073..18f6bfd 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -62,6 +62,8 @@
 #include <com/sun/star/util/VetoException.hpp>
 #include <com/sun/star/script/ModuleSizeExceededRequest.hpp>
 
+#include <cassert>
+
 namespace basctl
 {
 
@@ -162,9 +164,9 @@ void LibLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEn
 
 CheckBox::CheckBox( Window* pParent, const ResId& rResId )
     :SvTabListBox( pParent, rResId )
+    ,eMode(ObjectMode::Module)
     ,m_aDocument( ScriptDocument::getApplicationScriptDocument() )
 {
-    nMode = NEWOBJECTMODE_MOD;
     long aTabs_[] = { 1, 12 };  // TabPos needs at least one...
                                 // 12 because of the CheckBox
     SetTabs( aTabs_ );
@@ -192,7 +194,7 @@ void CheckBox::Init()
 {
     pCheckButton = new SvLBoxButtonData(this);
 
-    if ( nMode == LIBMODE_CHOOSER )
+    if (eMode == ObjectMode::Library)
         EnableCheckButton( pCheckButton );
     else
         EnableCheckButton( 0 );
@@ -202,11 +204,11 @@ void CheckBox::Init()
 
 //----------------------------------------------------------------------------
 
-void CheckBox::SetMode( NewObjectMode n )
+void CheckBox::SetMode (ObjectMode::Mode e)
 {
-    nMode = n;
+    eMode = e;
 
-    if ( nMode == LIBMODE_CHOOSER )
+    if (eMode == ObjectMode::Library)
         EnableCheckButton( pCheckButton );
     else
         EnableCheckButton( 0 );
@@ -262,7 +264,7 @@ void CheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const Imag
 {
     SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind );
 
-    if ( nMode == NEWOBJECTMODE_MOD )
+    if (eMode == ObjectMode::Module)
     {
         // initialize all columns with own string class (column 0 == bitmap)
         sal_uInt16 nCount = pEntry->ItemCount();
@@ -279,7 +281,7 @@ void CheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const Imag
 
 sal_Bool CheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& )
 {
-    if ( nMode != NEWOBJECTMODE_MOD )
+    if (eMode != ObjectMode::Module)
         return false;
 
     DBG_ASSERT( pEntry, "Kein Eintrag?" );
@@ -388,7 +390,7 @@ IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler)
     return 0;
 }
 
-NewObjectDialog::NewObjectDialog(Window * pParent, NewObjectMode nMode,
+NewObjectDialog::NewObjectDialog(Window * pParent, ObjectMode::Mode eMode,
                                  bool bCheckName)
     : ModalDialog( pParent, IDEResId( RID_DLG_NEWLIB ) ),
         aText( this, IDEResId( RID_FT_NEWLIB ) ),
@@ -399,20 +401,22 @@ NewObjectDialog::NewObjectDialog(Window * pParent, NewObjectMode nMode,
     FreeResource();
     aEdit.GrabFocus();
 
-    switch (nMode)

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list