vcl: VclPtr conversion in sfx2

Change-Id: I78ea3f4304ace27c6db0e3d0651bd65043dcbc68
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index 5a19603..438a2b5 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -81,6 +81,7 @@ protected:

public:
    virtual ~SfxModalDialog();
    virtual void dispose() SAL_OVERRIDE;
    const SfxItemSet*   GetOutputItemSet() const { return pOutputSet; }
    const SfxItemSet*   GetInputItemSet() const { return pInputSet; }
};
@@ -102,6 +103,7 @@ protected:
    SfxModelessDialog( SfxBindings*, SfxChildWindow*,
        vcl::Window*, const OUString& rID, const OUString& rUIXMLDescription );
    virtual ~SfxModelessDialog();
    virtual void dispose() SAL_OVERRIDE;
    virtual bool            Close() SAL_OVERRIDE;
    virtual void            Resize() SAL_OVERRIDE;
    virtual void            Move() SAL_OVERRIDE;
@@ -140,6 +142,7 @@ protected:
                                              const OString& rID, const OUString& rUIXMLDescription,
                                              const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
                            virtual ~SfxFloatingWindow();
    virtual void            dispose() SAL_OVERRIDE;

    virtual void            StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
    virtual bool            Close() SAL_OVERRIDE;
@@ -187,6 +190,7 @@ public:
        const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"));

    virtual             ~SfxSingleTabDialog();
    virtual void        dispose() SAL_OVERRIDE;

    void                SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0);
    SfxTabPage*         GetTabPage() const { return pImpl->m_pSfxPage; }
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 9179c69d..e5496c0 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -370,33 +370,35 @@ public:
class CustomPropertiesYesNoButton : public Control
{
private:
    RadioButton                     m_aYesButton;
    RadioButton                     m_aNoButton;
    VclPtr<RadioButton>             m_aYesButton;
    VclPtr<RadioButton>             m_aNoButton;

public:
    CustomPropertiesYesNoButton( vcl::Window* pParent, const ResId& rResId );
    virtual ~CustomPropertiesYesNoButton();
    virtual void dispose() SAL_OVERRIDE;

    virtual void    Resize() SAL_OVERRIDE;

    inline void     CheckYes() { m_aYesButton.Check(); }
    inline void     CheckNo() { m_aNoButton.Check(); }
    inline bool     IsYesChecked() const { return m_aYesButton.IsChecked(); }
    inline void     CheckYes() { m_aYesButton->Check(); }
    inline void     CheckNo() { m_aNoButton->Check(); }
    inline bool     IsYesChecked() const { return m_aYesButton->IsChecked(); }
};

// struct CustomPropertyLine ---------------------------------------------

struct CustomPropertyLine
{
    ComboBox                        m_aNameBox;
    CustomPropertiesTypeBox         m_aTypeBox;
    CustomPropertiesEdit            m_aValueEdit;
    CustomPropertiesDateField       m_aDateField;
    CustomPropertiesTimeField       m_aTimeField;
    const OUString                  m_sDurationFormat;
    CustomPropertiesDurationField   m_aDurationField;
    CustomPropertiesEditButton      m_aEditButton;
    CustomPropertiesYesNoButton     m_aYesNoButton;
    CustomPropertiesRemoveButton    m_aRemoveButton;
    VclPtr<ComboBox>                      m_aNameBox;
    VclPtr<CustomPropertiesTypeBox>       m_aTypeBox;
    VclPtr<CustomPropertiesEdit>          m_aValueEdit;
    VclPtr<CustomPropertiesDateField>     m_aDateField;
    VclPtr<CustomPropertiesTimeField>     m_aTimeField;
    const OUString                        m_sDurationFormat;
    VclPtr<CustomPropertiesDurationField> m_aDurationField;
    VclPtr<CustomPropertiesEditButton>    m_aEditButton;
    VclPtr<CustomPropertiesYesNoButton>   m_aYesNoButton;
    VclPtr<CustomPropertiesRemoveButton>  m_aRemoveButton;

    bool                            m_bIsDate;
    bool                            m_bIsRemoved;
@@ -416,15 +418,15 @@ private:
    FixedText*                          m_pHeaderAccType;
    FixedText*                          m_pHeaderAccValue;

    ComboBox                            m_aNameBox;
    ListBox                             m_aTypeBox;
    Edit                                m_aValueEdit;
    DateField                           m_aDateField;
    TimeField                           m_aTimeField;
    Edit                                m_aDurationField;
    PushButton                          m_aEditButton;
    CustomPropertiesYesNoButton         m_aYesNoButton;
    ImageButton                         m_aRemoveButton;
    VclPtr<ComboBox>                    m_aNameBox;
    VclPtr<ListBox>                     m_aTypeBox;
    VclPtr<Edit>                        m_aValueEdit;
    VclPtr<DateField>                   m_aDateField;
    VclPtr<TimeField>                   m_aTimeField;
    VclPtr<Edit>                        m_aDurationField;
    VclPtr<PushButton>                  m_aEditButton;
    VclPtr<CustomPropertiesYesNoButton> m_aYesNoButton;
    VclPtr<ImageButton>                 m_aRemoveButton;

    sal_Int32                           m_nLineHeight;
    sal_Int32                           m_nScrollPos;
@@ -454,6 +456,7 @@ public:
        FixedText *pHeaderAccType,
        FixedText *pHeaderAccValue);
    virtual ~CustomPropertiesWindow();
    virtual void dispose() SAL_OVERRIDE;

    bool                InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
    sal_uInt16          GetVisibleLineCount() const;
@@ -490,6 +493,7 @@ private:
public:
    CustomPropertiesControl(vcl::Window* pParent);
    virtual ~CustomPropertiesControl();
    virtual void dispose() SAL_OVERRIDE;

    void            AddLine( const OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive );

diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx
index 57f2567..e5a5ff8a7 100644
--- a/include/sfx2/dockwin.hxx
+++ b/include/sfx2/dockwin.hxx
@@ -84,6 +84,7 @@ public:
                                          vcl::Window* pParent,
                                          const OString& rID, const OUString& rUIXMLDescription );
                        virtual ~SfxDockingWindow();
    virtual void        dispose() SAL_OVERRIDE;

    void                Initialize (SfxChildWinInfo* pInfo);
    virtual void        FillInfo(SfxChildWinInfo&) const;
diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx
index eb0c4c6..8fe7920 100644
--- a/include/sfx2/infobar.hxx
+++ b/include/sfx2/infobar.hxx
@@ -53,6 +53,7 @@ class SfxInfoBarWindow : public vcl::Window
    public:
        SfxInfoBarWindow(vcl::Window* parent, const OUString& sId, const OUString& sMessage);
        virtual ~SfxInfoBarWindow( );
        virtual void dispose() SAL_OVERRIDE;

        const OUString& getId() const { return m_sId; }
        virtual void Paint( const Rectangle& ) SAL_OVERRIDE;
@@ -77,6 +78,7 @@ class SfxInfoBarContainerWindow : public vcl::Window
    public:
        SfxInfoBarContainerWindow(SfxInfoBarContainerChild* pChildWin);
        virtual ~SfxInfoBarContainerWindow( );
        virtual void dispose() SAL_OVERRIDE;

        SfxInfoBarWindow* appendInfoBar(const OUString& sId, const OUString& sMessage);
        SfxInfoBarWindow* getInfoBar(const OUString& sId);
diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx
index eded8ba..42c2656 100644
--- a/include/sfx2/mgetempl.hxx
+++ b/include/sfx2/mgetempl.hxx
@@ -81,6 +81,7 @@ friend class SfxStyleDialog;

    SfxManageStyleSheetPage(vcl::Window *pParent, const SfxItemSet &rAttrSet );
    virtual ~SfxManageStyleSheetPage();
    virtual void dispose() SAL_OVERRIDE;

    static SfxTabPage*  Create(vcl::Window *pParent, const SfxItemSet *rAttrSet );

diff --git a/include/sfx2/new.hxx b/include/sfx2/new.hxx
index 48b6dab..05482a4 100644
--- a/include/sfx2/new.hxx
+++ b/include/sfx2/new.hxx
@@ -67,6 +67,7 @@ public:

    SfxNewFileDialog(vcl::Window *pParent, sal_uInt16 nFlags = 0);
    virtual ~SfxNewFileDialog();
    virtual void dispose() SAL_OVERRIDE;

    // Returns false, when '- No -' is set as Template
    // Template names can only be obtained when IsTemplate() returns true.
diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx
index f0f47e2..c41744f 100644
--- a/include/sfx2/newstyle.hxx
+++ b/include/sfx2/newstyle.hxx
@@ -36,7 +36,7 @@ private:
    ComboBox* m_pColBox;
    OKButton* m_pOKBtn;

    MessageDialog aQueryOverwriteBox;
    VclPtr<MessageDialog> aQueryOverwriteBox;
    SfxStyleSheetBasePool&  rPool;

    DECL_DLLPRIVATE_LINK( OKHdl, Control * );
@@ -45,6 +45,7 @@ private:
public:
    SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& );
    virtual ~SfxNewStyleDlg();
    virtual void dispose() SAL_OVERRIDE;

    OUString                GetName() const { return comphelper::string::stripStart(m_pColBox->GetText(), ' '); }
};
diff --git a/include/sfx2/printopt.hxx b/include/sfx2/printopt.hxx
index 4857ce4..477e98ef 100644
--- a/include/sfx2/printopt.hxx
+++ b/include/sfx2/printopt.hxx
@@ -94,7 +94,6 @@ protected:
public:

                        SfxCommonPrintOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
                        virtual ~SfxCommonPrintOptionsTabPage();

    virtual bool        FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
    virtual void        Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/include/sfx2/prnmon.hxx b/include/sfx2/prnmon.hxx
index 1468ee8..22378a5 100644
--- a/include/sfx2/prnmon.hxx
+++ b/include/sfx2/prnmon.hxx
@@ -45,6 +45,7 @@ public:
                                                   SfxViewShell *pViewShell,
                                                   const SfxItemSet *rOptions );
    virtual                 ~SfxPrintOptionsDialog();
    virtual void            dispose() SAL_OVERRIDE;

    bool                    Construct();
    virtual short           Execute() SAL_OVERRIDE;
diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx
index 68176cf..1affc2e 100644
--- a/include/sfx2/recentdocsview.hxx
+++ b/include/sfx2/recentdocsview.hxx
@@ -42,7 +42,6 @@ class SFX2_DLLPUBLIC RecentDocsView : public ThumbnailView
{
public:
    RecentDocsView( vcl::Window* pParent );
    virtual ~RecentDocsView();

    void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId);

diff --git a/include/sfx2/securitypage.hxx b/include/sfx2/securitypage.hxx
index 2777088..eaf83e7 100644
--- a/include/sfx2/securitypage.hxx
+++ b/include/sfx2/securitypage.hxx
@@ -34,7 +34,6 @@ class SfxSecurityPage : public SfxTabPage

protected:
    SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& );
    virtual ~SfxSecurityPage();

    virtual bool            FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
    virtual void            Reset( const SfxItemSet* ) SAL_OVERRIDE;
diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx
index 381745d..4bb527a 100644
--- a/include/sfx2/sidebar/SidebarToolBox.hxx
+++ b/include/sfx2/sidebar/SidebarToolBox.hxx
@@ -41,6 +41,7 @@ class SFX2_DLLPUBLIC SidebarToolBox
public:
    SidebarToolBox(vcl::Window* pParentWindow);
    virtual ~SidebarToolBox (void);
    virtual void dispose() SAL_OVERRIDE;

    using ToolBox::InsertItem;
    virtual void InsertItem(const OUString& rCommand,
diff --git a/include/sfx2/styledlg.hxx b/include/sfx2/styledlg.hxx
index 9e9bef9..e837c87 100644
--- a/include/sfx2/styledlg.hxx
+++ b/include/sfx2/styledlg.hxx
@@ -41,6 +41,7 @@ public:
        const OUString& rUIXMLDescription, SfxStyleSheetBase&);

    virtual ~SfxStyleDialog();
    virtual void dispose() SAL_OVERRIDE;

    SfxStyleSheetBase&          GetStyleSheet() { return *pStyle; }
    const SfxStyleSheetBase&    GetStyleSheet() const { return *pStyle; }
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 2465321..e30588f 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -129,6 +129,7 @@ public:
                 const OUString& rID, const OUString& rUIXMLDescription,
                 const SfxItemSet * = 0, bool bEditFmt = false);
    virtual ~SfxTabDialog();
    virtual void dispose() SAL_OVERRIDE;

    sal_uInt16          AddTabPage( const OString& rName,           // Name of the label for the page in the notebook .ui
                                    CreateTabPage pCreateFunc,      // != 0
@@ -249,6 +250,7 @@ protected:

public:
    virtual             ~SfxTabPage();
    virtual void        dispose() SAL_OVERRIDE;

    const SfxItemSet&   GetItemSet() const { return *pSet; }

diff --git a/include/sfx2/taskpane.hxx b/include/sfx2/taskpane.hxx
index dadbdf1..9768716 100644
--- a/include/sfx2/taskpane.hxx
+++ b/include/sfx2/taskpane.hxx
@@ -93,7 +93,6 @@ namespace sfx2
            vcl::Window& i_rParentWindow,
            const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame
        );
        virtual ~ModuleTaskPane();

        /** determines whether a given module has any registered tool panels
        */
@@ -163,6 +162,8 @@ namespace sfx2
    public:
        TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper,
            vcl::Window* i_pParent, WinBits i_nBits );
        virtual ~TaskPaneDockingWindow();
        virtual void dispose() SAL_OVERRIDE;

        // ITaskPaneToolPanelAccess
        virtual void    ActivateToolPanel( const OUString& i_rPanelURL ) SAL_OVERRIDE;
@@ -175,8 +176,8 @@ namespace sfx2
        virtual void onLayoutDone() SAL_OVERRIDE;

    private:
        ModuleTaskPane      m_aTaskPane;
        TaskPaneController  m_aPaneController;
        VclPtr<ModuleTaskPane>  m_aTaskPane;
        TaskPaneController      m_aPaneController;
    };


diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index e6d5388..6061a5b 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -151,6 +151,7 @@ public:
                                            vcl::Window* pParentWindow,
                                            WinBits nBits );
                            virtual ~SfxPopupWindow();
    virtual void            dispose() SAL_OVERRIDE;

    virtual SfxPopupWindow* Clone() const;
    virtual void            MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx
index 5509374..41979ca 100644
--- a/include/sfx2/templateabstractview.hxx
+++ b/include/sfx2/templateabstractview.hxx
@@ -83,7 +83,8 @@ public:
    TemplateAbstractView(vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
    TemplateAbstractView(vcl::Window* pParent);

    virtual ~TemplateAbstractView ();
    virtual ~TemplateAbstractView();
    virtual void dispose() SAL_OVERRIDE;

    void insertItem (const TemplateItemProperties &rTemplate);

@@ -137,8 +138,8 @@ protected:
    sal_uInt16 mnCurRegionId;
    OUString maCurRegionName;

    PushButton maAllButton;
    FixedText  maFTName;
    VclPtr<PushButton> maAllButton;
    VclPtr<FixedText>  maFTName;

    Link maOpenRegionHdl;
    Link maOpenTemplateHdl;
diff --git a/include/sfx2/templatedefaultview.hxx b/include/sfx2/templatedefaultview.hxx
index 005201b..2050835 100644
--- a/include/sfx2/templatedefaultview.hxx
+++ b/include/sfx2/templatedefaultview.hxx
@@ -17,7 +17,6 @@ class SFX2_DLLPUBLIC TemplateDefaultView : public TemplateLocalView
{
public:
    TemplateDefaultView(Window *pParent);
    virtual ~TemplateDefaultView();

    virtual void reload() SAL_OVERRIDE;
protected:
diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx
index 8b133f40..76ea4bd 100644
--- a/include/sfx2/templatedlg.hxx
+++ b/include/sfx2/templatedlg.hxx
@@ -50,7 +50,8 @@ public:

    SfxTemplateManagerDlg(vcl::Window *parent = NULL);

    virtual ~SfxTemplateManagerDlg ();
    virtual ~SfxTemplateManagerDlg();
    virtual void dispose() SAL_OVERRIDE;

    void setSaveMode();

diff --git a/include/sfx2/templateinfodlg.hxx b/include/sfx2/templateinfodlg.hxx
index 9f5d9df..fabd740 100644
--- a/include/sfx2/templateinfodlg.hxx
+++ b/include/sfx2/templateinfodlg.hxx
@@ -27,7 +27,8 @@ public:

    SfxTemplateInfoDlg (vcl::Window *pParent = NULL);

    virtual ~SfxTemplateInfoDlg ();
    virtual ~SfxTemplateInfoDlg();
    virtual void dispose() SAL_OVERRIDE;

    void loadDocument (const OUString &rURL);

diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx
index 6d2e1d0..123a6f6 100644
--- a/include/sfx2/templatelocalview.hxx
+++ b/include/sfx2/templatelocalview.hxx
@@ -32,6 +32,7 @@ public:
    TemplateLocalView ( vcl::Window* pParent );

    virtual ~TemplateLocalView ();
    virtual void dispose() SAL_OVERRIDE;

    // Fill view with template folders thumbnails
    virtual void Populate () SAL_OVERRIDE;
diff --git a/include/sfx2/templateremoteview.hxx b/include/sfx2/templateremoteview.hxx
index 6c64e9a..ada041d 100644
--- a/include/sfx2/templateremoteview.hxx
+++ b/include/sfx2/templateremoteview.hxx
@@ -23,8 +23,6 @@ public:

    TemplateRemoteView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);

    virtual ~TemplateRemoteView ();

    virtual void showRootRegion () SAL_OVERRIDE;

    virtual void showRegion (ThumbnailViewItem *pItem) SAL_OVERRIDE;
diff --git a/include/sfx2/templdlg.hxx b/include/sfx2/templdlg.hxx
index a3237d3..b9eb528 100644
--- a/include/sfx2/templdlg.hxx
+++ b/include/sfx2/templdlg.hxx
@@ -43,6 +43,7 @@ class SFX2_DLLPUBLIC SfxTemplatePanelControl : public DockingWindow
public:
    SfxTemplatePanelControl (SfxBindings* pBindings, vcl::Window* pParentWindow);
    virtual ~SfxTemplatePanelControl();
    virtual void dispose() SAL_OVERRIDE;

    virtual void DataChanged( const DataChangedEvent& _rDCEvt ) SAL_OVERRIDE;
    virtual void Resize() SAL_OVERRIDE;
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
index 2c9967b..2191ef5 100644
--- a/include/sfx2/thumbnailview.hxx
+++ b/include/sfx2/thumbnailview.hxx
@@ -183,6 +183,7 @@ public:
    ThumbnailView(vcl::Window* pParent, WinBits nWinStyle = WB_TABSTOP, bool bDisableTransientChildren = false);

    virtual ~ThumbnailView();
    virtual void dispose() SAL_OVERRIDE;

    virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE;

diff --git a/include/sfx2/titledockwin.hxx b/include/sfx2/titledockwin.hxx
index 97fdebc..6c4b5e9 100644
--- a/include/sfx2/titledockwin.hxx
+++ b/include/sfx2/titledockwin.hxx
@@ -24,6 +24,7 @@
#include <sfx2/dockwin.hxx>

#include <vcl/toolbox.hxx>
#include <vcl/vclptr.hxx>
#include <tools/svborder.hxx>


@@ -43,6 +44,7 @@ namespace sfx2
        );

        virtual ~TitledDockingWindow();
        virtual void dispose() SAL_OVERRIDE;

        /** sets a title to be displayed in the docking window
        */
@@ -77,11 +79,11 @@ namespace sfx2
        /** returns the content window, which is to be used as parent window for any content to be displayed
            in the docking window.
        */
        vcl::Window&       GetContentWindow()          { return m_aContentWindow; }
        const vcl::Window& GetContentWindow() const    { return m_aContentWindow; }
        vcl::Window&       GetContentWindow()          { return *m_aContentWindow.get(); }
        const vcl::Window& GetContentWindow() const    { return *m_aContentWindow.get(); }

        ToolBox&        GetToolBox()        { return m_aToolbox; }
        const ToolBox&  GetToolBox() const  { return m_aToolbox; }
        ToolBox&        GetToolBox()        { return *m_aToolbox.get(); }
        const ToolBox&  GetToolBox() const  { return *m_aToolbox.get(); }

        /** Return the border that is painted around the inner window as
            decoration.
@@ -126,8 +128,8 @@ namespace sfx2

    private:
        OUString            m_sTitle;
        ToolBox             m_aToolbox;
        Window              m_aContentWindow;
        VclPtr<ToolBox>     m_aToolbox;
        VclPtr<Window>      m_aContentWindow;

        Link                m_aEndDockingHdl;

diff --git a/sfx2/inc/srchdlg.hxx b/sfx2/inc/srchdlg.hxx
index 95b7a00..b5abe7b 100644
--- a/sfx2/inc/srchdlg.hxx
+++ b/sfx2/inc/srchdlg.hxx
@@ -59,6 +59,7 @@ private:
public:
    SearchDialog( vcl::Window* pWindow, const OUString& rConfigName );
    virtual ~SearchDialog();
    virtual void dispose() SAL_OVERRIDE;

    void         SetFindHdl( const Link& rLink ) { m_aFindHdl = rLink; }
    void         SetCloseHdl( const Link& rLink ) { m_aCloseHdl = rLink; }
@@ -70,11 +71,11 @@ public:
    bool         IsWrapAround() const { return ( m_pWrapAroundBox->IsChecked() ); }
    bool         IsSearchBackwards() const { return ( m_pBackwardsBox->IsChecked() ); }

    void                SetFocusOnEdit();
    void            SetFocusOnEdit();

    virtual bool    Close() SAL_OVERRIDE;
    virtual void        Move() SAL_OVERRIDE;
    virtual void        StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
    virtual void    Move() SAL_OVERRIDE;
    virtual void    StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
};


diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 3f90d2d..eb800ba 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -303,6 +303,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeContentListBox(vcl::Wi

ContentListBox_Impl::~ContentListBox_Impl()
{
    dispose();
}

void ContentListBox_Impl::dispose()
{
    sal_uInt16 nPos = 0;
    SvTreeListEntry* pEntry = GetEntry( nPos++ );
    while ( pEntry )
@@ -311,6 +316,7 @@ ContentListBox_Impl::~ContentListBox_Impl()
        delete static_cast<ContentEntry_Impl*>(pEntry->GetUserData());
        pEntry = GetEntry( nPos++ );
    }
    SvTreeListBox::dispose();
}

void ContentListBox_Impl::InitRoot()
@@ -545,7 +551,13 @@ IndexTabPage_Impl::IndexTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Im

IndexTabPage_Impl::~IndexTabPage_Impl()
{
    dispose();
}

void IndexTabPage_Impl::dispose()
{
    ClearIndex();
    HelpTabPage_Impl::dispose();
}


@@ -946,6 +958,11 @@ SearchTabPage_Impl::SearchTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_

SearchTabPage_Impl::~SearchTabPage_Impl()
{
   dispose();
}

void SearchTabPage_Impl::dispose()
{
    SvtViewOptions aViewOpt( E_TABPAGE, CONFIGNAME_SEARCHPAGE );
    sal_Int32 nChecked = m_pFullWordsCB->IsChecked() ? 1 : 0;
    OUString aUserData = OUString::number( nChecked );
@@ -967,6 +984,7 @@ SearchTabPage_Impl::~SearchTabPage_Impl()
    aUserData = comphelper::string::stripEnd(aUserData, ';');
    Any aUserItem = makeAny( OUString( aUserData ) );
    aViewOpt.SetUserItem( USERITEM_NAME, aUserItem );
    HelpTabPage_Impl::dispose();
}


@@ -1141,6 +1159,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeBookmarksBox(vcl::Wind

BookmarksBox_Impl::~BookmarksBox_Impl()
{
    dispose();
}

void BookmarksBox_Impl::dispose()
{
    // save bookmarks to configuration
    SvtHistoryOptions aHistOpt;
    aHistOpt.Clear( eHELPBOOKMARKS );
@@ -1153,6 +1176,7 @@ BookmarksBox_Impl::~BookmarksBox_Impl()
        aHistOpt.AppendItem(eHELPBOOKMARKS, *pURL, sEmpty, aTitle, sEmpty, sEmpty);
        delete pURL;
    }
    ListBox::dispose();
}


@@ -1416,6 +1440,11 @@ SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent)

SfxHelpIndexWindow_Impl::~SfxHelpIndexWindow_Impl()
{
    dispose();
}

void SfxHelpIndexWindow_Impl::dispose()
{
    sfx2::RemoveFromTaskPaneList( this );

    DELETEZ( pCPage );
@@ -1428,6 +1457,7 @@ SfxHelpIndexWindow_Impl::~SfxHelpIndexWindow_Impl()

    SvtViewOptions aViewOpt( E_TABDIALOG, CONFIGNAME_INDEXWIN );
    aViewOpt.SetPageID( (sal_Int32)m_pTabCtrl->GetCurPageId() );
    vcl::Window::dispose();
}


@@ -1805,10 +1835,6 @@ TextWin_Impl::TextWin_Impl( vcl::Window* p ) : DockingWindow( p, 0 )
{
}

TextWin_Impl::~TextWin_Impl()
{
}

bool TextWin_Impl::Notify( NotifyEvent& rNEvt )
{
    if( ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) && rNEvt.GetKeyEvent()->GetKeyCode().GetCode() == KEY_TAB )
@@ -1830,8 +1856,8 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :

    Window( pParent, WB_CLIPCHILDREN | WB_TABSTOP | WB_DIALOGCONTROL ),

    aToolBox            ( this, 0 ),
    aOnStartupCB        ( this, SfxResId( RID_HELP_ONSTARTUP_BOX ) ),
    aToolBox            ( new ToolBox(this, 0) ),
    aOnStartupCB        ( new CheckBox(this, SfxResId( RID_HELP_ONSTARTUP_BOX )) ),
    aIndexOnImage       ( SfxResId( IMG_HELP_TOOLBOX_INDEX_ON ) ),
    aIndexOffImage      ( SfxResId( IMG_HELP_TOOLBOX_INDEX_OFF ) ),
    aIndexOnText        ( SfxResId( STR_HELP_BUTTON_INDEX_ON ).toString() ),
@@ -1847,36 +1873,36 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :
    bIsFullWordSearch   ( false )

{
    sfx2::AddToTaskPaneList( &aToolBox );
    sfx2::AddToTaskPaneList( aToolBox.get() );

    xFrame = Frame::create( ::comphelper::getProcessComponentContext() );
    xFrame->initialize( VCLUnoHelper::GetInterface ( pTextWin ) );
    xFrame->setName( "OFFICE_HELP" );
    lcl_disableLayoutOfFrame(xFrame);

    aToolBox.SetHelpId( HID_HELP_TOOLBOX );
    aToolBox->SetHelpId( HID_HELP_TOOLBOX );

    aToolBox.InsertItem( TBI_INDEX, aIndexOffText );
    aToolBox.SetHelpId( TBI_INDEX, HID_HELP_TOOLBOXITEM_INDEX );
    aToolBox.InsertSeparator();
    aToolBox.InsertItem( TBI_BACKWARD, SfxResId( STR_HELP_BUTTON_PREV ).toString() );
    aToolBox.SetHelpId( TBI_BACKWARD, HID_HELP_TOOLBOXITEM_BACKWARD );
    aToolBox.InsertItem( TBI_FORWARD, SfxResId( STR_HELP_BUTTON_NEXT ).toString() );
    aToolBox.SetHelpId( TBI_FORWARD, HID_HELP_TOOLBOXITEM_FORWARD );
    aToolBox.InsertItem( TBI_START, SfxResId( STR_HELP_BUTTON_START ).toString() );
    aToolBox.SetHelpId( TBI_START, HID_HELP_TOOLBOXITEM_START );
    aToolBox.InsertSeparator();
    aToolBox.InsertItem( TBI_PRINT, SfxResId( STR_HELP_BUTTON_PRINT ).toString() );
    aToolBox.SetHelpId( TBI_PRINT, HID_HELP_TOOLBOXITEM_PRINT );
    aToolBox.InsertItem( TBI_BOOKMARKS, SfxResId( STR_HELP_BUTTON_ADDBOOKMARK ).toString() );
    aToolBox.SetHelpId( TBI_BOOKMARKS, HID_HELP_TOOLBOXITEM_BOOKMARKS );
    aToolBox.InsertItem( TBI_SEARCHDIALOG, SfxResId( STR_HELP_BUTTON_SEARCHDIALOG ).toString() );
    aToolBox.SetHelpId( TBI_SEARCHDIALOG, HID_HELP_TOOLBOXITEM_SEARCHDIALOG );
    aToolBox->InsertItem( TBI_INDEX, aIndexOffText );
    aToolBox->SetHelpId( TBI_INDEX, HID_HELP_TOOLBOXITEM_INDEX );
    aToolBox->InsertSeparator();
    aToolBox->InsertItem( TBI_BACKWARD, SfxResId( STR_HELP_BUTTON_PREV ).toString() );
    aToolBox->SetHelpId( TBI_BACKWARD, HID_HELP_TOOLBOXITEM_BACKWARD );
    aToolBox->InsertItem( TBI_FORWARD, SfxResId( STR_HELP_BUTTON_NEXT ).toString() );
    aToolBox->SetHelpId( TBI_FORWARD, HID_HELP_TOOLBOXITEM_FORWARD );
    aToolBox->InsertItem( TBI_START, SfxResId( STR_HELP_BUTTON_START ).toString() );
    aToolBox->SetHelpId( TBI_START, HID_HELP_TOOLBOXITEM_START );
    aToolBox->InsertSeparator();
    aToolBox->InsertItem( TBI_PRINT, SfxResId( STR_HELP_BUTTON_PRINT ).toString() );
    aToolBox->SetHelpId( TBI_PRINT, HID_HELP_TOOLBOXITEM_PRINT );
    aToolBox->InsertItem( TBI_BOOKMARKS, SfxResId( STR_HELP_BUTTON_ADDBOOKMARK ).toString() );
    aToolBox->SetHelpId( TBI_BOOKMARKS, HID_HELP_TOOLBOXITEM_BOOKMARKS );
    aToolBox->InsertItem( TBI_SEARCHDIALOG, SfxResId( STR_HELP_BUTTON_SEARCHDIALOG ).toString() );
    aToolBox->SetHelpId( TBI_SEARCHDIALOG, HID_HELP_TOOLBOXITEM_SEARCHDIALOG );

    InitToolBoxImages();
    aToolBox.Show();
    aToolBox->Show();
    InitOnStartupBox( false );
    aOnStartupCB.SetClickHdl( LINK( this, SfxHelpTextWindow_Impl, CheckHdl ) );
    aOnStartupCB->SetClickHdl( LINK( this, SfxHelpTextWindow_Impl, CheckHdl ) );

    aSelectIdle.SetIdleHdl( LINK( this, SfxHelpTextWindow_Impl, SelectHdl ) );
    aSelectIdle.SetPriority( SchedulerPriority::LOWEST );
@@ -1887,19 +1913,27 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :

    SvtMiscOptions().AddListenerLink( LINK( this, SfxHelpTextWindow_Impl, NotifyHdl ) );

    if ( !aOnStartupCB.GetHelpId().getLength() )
        aOnStartupCB.SetHelpId( HID_HELP_ONSTARTUP_BOX );
    if ( !aOnStartupCB->GetHelpId().getLength() )
        aOnStartupCB->SetHelpId( HID_HELP_ONSTARTUP_BOX );
}



SfxHelpTextWindow_Impl::~SfxHelpTextWindow_Impl()
{
    sfx2::RemoveFromTaskPaneList( &aToolBox );
    dispose();
}

void SfxHelpTextWindow_Impl::dispose()
{
    sfx2::RemoveFromTaskPaneList( aToolBox.get() );

    bIsInClose = true;
    SvtMiscOptions().RemoveListenerLink( LINK( this, SfxHelpTextWindow_Impl, NotifyHdl ) );
    delete pSrchDlg;
    aToolBox.disposeAndClear();
    aOnStartupCB.disposeAndClear();
    vcl::Window::dispose();
}


@@ -1928,39 +1962,39 @@ void SfxHelpTextWindow_Impl::InitToolBoxImages()
    aIndexOnImage  = Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_INDEX_ON  : IMG_HELP_TOOLBOX_INDEX_ON  ) );
    aIndexOffImage = Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_INDEX_OFF : IMG_HELP_TOOLBOX_INDEX_OFF ) );

    aToolBox.SetItemImage( TBI_INDEX, bIsIndexOn ? aIndexOffImage : aIndexOnImage );
    aToolBox->SetItemImage( TBI_INDEX, bIsIndexOn ? aIndexOffImage : aIndexOnImage );

    aToolBox.SetItemImage( TBI_BACKWARD,
    aToolBox->SetItemImage( TBI_BACKWARD,
                           Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_PREV : IMG_HELP_TOOLBOX_PREV ) )
    );

    aToolBox.SetItemImage( TBI_FORWARD,
    aToolBox->SetItemImage( TBI_FORWARD,
                           Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_NEXT : IMG_HELP_TOOLBOX_NEXT ) )
    );

    aToolBox.SetItemImage( TBI_START,
    aToolBox->SetItemImage( TBI_START,
                           Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_START : IMG_HELP_TOOLBOX_START ) )
    );

    aToolBox.SetItemImage( TBI_PRINT,
    aToolBox->SetItemImage( TBI_PRINT,
                           Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_PRINT : IMG_HELP_TOOLBOX_PRINT ) )
    );

    aToolBox.SetItemImage( TBI_BOOKMARKS,
    aToolBox->SetItemImage( TBI_BOOKMARKS,
                           Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_BOOKMARKS : IMG_HELP_TOOLBOX_BOOKMARKS ) )
    );

    aToolBox.SetItemImage( TBI_SEARCHDIALOG,
    aToolBox->SetItemImage( TBI_SEARCHDIALOG,
                           Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_SEARCHDIALOG : IMG_HELP_TOOLBOX_SEARCHDIALOG ) )
    );

    Size aSize = aToolBox.CalcWindowSizePixel();
    Size aSize = aToolBox->CalcWindowSizePixel();
    aSize.Height() += TOOLBOX_OFFSET;
    aToolBox.SetPosSizePixel( Point( 0, TOOLBOX_OFFSET ), aSize );
    aToolBox->SetPosSizePixel( Point( 0, TOOLBOX_OFFSET ), aSize );

    SvtMiscOptions aMiscOptions;
    if ( aMiscOptions.GetToolboxStyle() != aToolBox.GetOutStyle() )
        aToolBox.SetOutStyle( aMiscOptions.GetToolboxStyle() );
    if ( aMiscOptions.GetToolboxStyle() != aToolBox->GetOutStyle() )
        aToolBox->SetOutStyle( aMiscOptions.GetToolboxStyle() );
}


@@ -1998,7 +2032,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
    }

    if ( bHideBox )
        aOnStartupCB.Hide();
        aOnStartupCB->Hide();
    else
    {
        // detect module name
@@ -2025,20 +2059,20 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
            // set module name in checkbox text
            OUString sText( aOnStartupText );
            sText = sText.replaceFirst( "%MODULENAME", sModuleName );
            aOnStartupCB.SetText( sText );
            aOnStartupCB->SetText( sText );
            // and show it
            aOnStartupCB.Show();
            aOnStartupCB->Show();
            // set check state
            aOnStartupCB.Check( bHelpAtStartup );
            aOnStartupCB.SaveValue();
            aOnStartupCB->Check( bHelpAtStartup );
            aOnStartupCB->SaveValue();

            // calculate and set optimal width of the onstartup checkbox
            OUString sCBText( "XXX" );
            sCBText += aOnStartupCB.GetText();
            long nTextWidth = aOnStartupCB.GetTextWidth( sCBText );
            Size aSize = aOnStartupCB.GetSizePixel();
            sCBText += aOnStartupCB->GetText();
            long nTextWidth = aOnStartupCB->GetTextWidth( sCBText );
            Size aSize = aOnStartupCB->GetSizePixel();
            aSize.Width() = nTextWidth;
            aOnStartupCB.SetSizePixel( aSize );
            aOnStartupCB->SetSizePixel( aSize );
            SetOnStartupBoxPosition();
        }

@@ -2046,12 +2080,12 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
        {
            // set position of the checkbox
            Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
            Size aTBSize = aToolBox.GetSizePixel();
            Size aCBSize = aOnStartupCB.GetSizePixel();
            Point aPnt = aToolBox.GetPosPixel();
            Size aTBSize = aToolBox->GetSizePixel();
            Size aCBSize = aOnStartupCB->GetSizePixel();
            Point aPnt = aToolBox->GetPosPixel();
            aPnt.X() += aTBSize.Width() + a3Size.Width();
            aPnt.Y() += ( ( aTBSize.Height() - aCBSize.Height() ) / 2 );
            aOnStartupCB.SetPosPixel( aPnt );
            aOnStartupCB->SetPosPixel( aPnt );
            nMinPos = aPnt.X();
        }
    }
@@ -2061,10 +2095,10 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )

void SfxHelpTextWindow_Impl::SetOnStartupBoxPosition()
{
    long nX = std::max( GetOutputSizePixel().Width() - aOnStartupCB.GetSizePixel().Width(), nMinPos );
    Point aPos = aOnStartupCB.GetPosPixel();
    long nX = std::max( GetOutputSizePixel().Width() - aOnStartupCB->GetSizePixel().Width(), nMinPos );
    Point aPos = aOnStartupCB->GetPosPixel();
    aPos.X() = nX;
    aOnStartupCB.SetPosPixel( aPos );
    aOnStartupCB->SetPosPixel( aPos );
}


@@ -2181,7 +2215,7 @@ IMPL_LINK( SfxHelpTextWindow_Impl, NotifyHdl, SvtMiscOptions*, pOptions )
    (void)pOptions; // unused variable
    InitToolBoxImages();
    Resize();
    aToolBox.Invalidate();
    aToolBox->Invalidate();
    return 0;
}

@@ -2308,7 +2342,7 @@ IMPL_LINK( SfxHelpTextWindow_Impl, CheckHdl, CheckBox*, pBox )
void SfxHelpTextWindow_Impl::Resize()
{
    Size aSize = GetOutputSizePixel();
    long nToolBoxHeight = aToolBox.GetSizePixel().Height() + TOOLBOX_OFFSET;
    long nToolBoxHeight = aToolBox->GetSizePixel().Height() + TOOLBOX_OFFSET;
    aSize.Height() -= nToolBoxHeight;
    pTextWin->SetPosSizePixel( Point( 0, nToolBoxHeight  ), aSize );
    SetOnStartupBoxPosition();
@@ -2325,7 +2359,7 @@ bool SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt )
        const CommandEvent* pCmdEvt = rNEvt.GetCommandEvent();
        vcl::Window* pCmdWin = rNEvt.GetWindow();

        if ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU && pCmdWin != this && pCmdWin != &aToolBox )
        if ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU && pCmdWin != this && pCmdWin != aToolBox.get() )
        {
            Point aPos;
            if ( pCmdEvt->IsMouseEvent() )
@@ -2430,9 +2464,9 @@ bool SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt )
            pHelpWin->CloseWindow();
            nDone = true;
        }
        else if ( KEY_TAB == nKey && aOnStartupCB.HasChildPathFocus() )
        else if ( KEY_TAB == nKey && aOnStartupCB->HasChildPathFocus() )
        {
            aToolBox.GrabFocus();
            aToolBox->GrabFocus();
            nDone = true;
        }
    }
@@ -2484,13 +2518,13 @@ void SfxHelpTextWindow_Impl::ToggleIndex( bool bOn )
    bIsIndexOn = bOn;
    if ( bIsIndexOn )
    {
        aToolBox.SetItemImage( TBI_INDEX, aIndexOffImage );
        aToolBox.SetItemText( TBI_INDEX, aIndexOffText );
        aToolBox->SetItemImage( TBI_INDEX, aIndexOffImage );
        aToolBox->SetItemText( TBI_INDEX, aIndexOffText );
    }
    else
    {
        aToolBox.SetItemImage( TBI_INDEX, aIndexOnImage );
        aToolBox.SetItemText( TBI_INDEX, aIndexOnText );
        aToolBox->SetItemImage( TBI_INDEX, aIndexOnImage );
        aToolBox->SetItemText( TBI_INDEX, aIndexOnText );
    }
}

@@ -2993,6 +3027,11 @@ SfxHelpWindow_Impl::SfxHelpWindow_Impl(

SfxHelpWindow_Impl::~SfxHelpWindow_Impl()
{
    dispose();
}

void SfxHelpWindow_Impl::dispose()
{
    SaveConfig();
    vcl::Window* pDel = pIndexWin;
    pIndexWin = NULL;
@@ -3000,6 +3039,7 @@ SfxHelpWindow_Impl::~SfxHelpWindow_Impl()

    pTextWin->CloseFrame();
    delete pTextWin;
    SplitWindow::dispose();
}

bool SfxHelpWindow_Impl::PreNotify( NotifyEvent& rNEvt )
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index 4ccf236..38d15e8 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -60,7 +60,7 @@ private:
public:
    ContentListBox_Impl(vcl::Window* pParent, WinBits nStyle);
    virtual ~ContentListBox_Impl();

    virtual void dispose() SAL_OVERRIDE;

    virtual void    RequestingChildren( SvTreeListEntry* pParent ) SAL_OVERRIDE;
    virtual bool    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -141,6 +141,7 @@ private:
public:
    IndexTabPage_Impl( vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin );
    virtual ~IndexTabPage_Impl();
    virtual void dispose() SAL_OVERRIDE;

    virtual void        ActivatePage() SAL_OVERRIDE;
    virtual Control*    GetLastFocusControl() SAL_OVERRIDE;
@@ -217,6 +218,7 @@ private:
public:
    SearchTabPage_Impl( vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin );
    virtual ~SearchTabPage_Impl();
    virtual void dispose() SAL_OVERRIDE;

    virtual void        ActivatePage() SAL_OVERRIDE;
    virtual Control*    GetLastFocusControl() SAL_OVERRIDE;
@@ -242,6 +244,7 @@ private:
public:
    BookmarksBox_Impl(vcl::Window* pParent, WinBits nStyle);
    virtual ~BookmarksBox_Impl();
    virtual void dispose() SAL_OVERRIDE;

    virtual bool        Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
};
@@ -312,6 +315,7 @@ private:
public:
    SfxHelpIndexWindow_Impl( SfxHelpWindow_Impl* pParent );
    virtual ~SfxHelpIndexWindow_Impl();
    virtual void dispose() SAL_OVERRIDE;

    virtual void        Resize() SAL_OVERRIDE;
    virtual Size        GetOptimalSize() const SAL_OVERRIDE;
@@ -392,7 +396,6 @@ class TextWin_Impl : public DockingWindow
{
public:
                            TextWin_Impl( vcl::Window* pParent );
    virtual                 ~TextWin_Impl();

    virtual bool            Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
};
@@ -405,8 +408,8 @@ class SfxHelpWindow_Impl;
class SfxHelpTextWindow_Impl : public vcl::Window
{
private:
    ToolBox                 aToolBox;
    CheckBox                aOnStartupCB;
    VclPtr<ToolBox>         aToolBox;
    VclPtr<CheckBox>        aOnStartupCB;
    Idle                    aSelectIdle;
    Image                   aIndexOnImage;
    Image                   aIndexOffImage;
@@ -426,12 +429,12 @@ private:
    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
                            xConfiguration;
    long                    nMinPos;
    bool                bIsDebug;
    bool                bIsIndexOn;
    bool                bIsInClose;
    bool                bIsFullWordSearch;
    bool                    bIsDebug;
    bool                    bIsIndexOn;
    bool                    bIsInClose;
    bool                    bIsFullWordSearch;

    bool                HasSelection() const;
    bool                    HasSelection() const;
    void                    InitToolBoxImages();
    void                    InitOnStartupBox( bool bOnlyText );
    void                    SetOnStartupBoxPosition();
@@ -451,6 +454,7 @@ private:
public:
    SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent );
    virtual ~SfxHelpTextWindow_Impl();
    virtual void dispose() SAL_OVERRIDE;

    virtual void            Resize() SAL_OVERRIDE;
    virtual bool            PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -460,11 +464,11 @@ public:
    inline ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
                            getFrame() const { return xFrame; }

    inline void             SetSelectHdl( const Link& rLink ) { aToolBox.SetSelectHdl( rLink ); }
    inline void             SetSelectHdl( const Link& rLink ) { aToolBox->SetSelectHdl( rLink ); }
    void                    ToggleIndex( bool bOn );
    void                    SelectSearchText( const OUString& rSearchText, bool _bIsFullWordSearch );
    void                    SetPageStyleHeaderOff() const;
    inline ToolBox&         GetToolBox() { return aToolBox; }
    inline ToolBox&         GetToolBox() { return *aToolBox.get(); }
     void                   CloseFrame();
    void                    DoSearch();
};
@@ -519,6 +523,7 @@ public:
    SfxHelpWindow_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >& rFrame,
                        vcl::Window* pParent, WinBits nBits );
    virtual ~SfxHelpWindow_Impl();
    virtual void dispose() SAL_OVERRIDE;

    virtual bool        PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;

diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 9b68a0e..dc22fdd 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -62,10 +62,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRecentDocsView(vcl::Wi
    return new RecentDocsView(pParent);
}

RecentDocsView::~RecentDocsView()
{
}

bool RecentDocsView::typeMatchesExtension(ApplicationType type, const OUString &rExt)
{
    bool bRet = false;
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 51b213d..cfbd886 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -128,29 +128,37 @@ bool ViewFilter_Keyword::operator ()(const ThumbnailViewItem *pItem)
TemplateAbstractView::TemplateAbstractView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren)
    : ThumbnailView(pParent,nWinStyle,bDisableTransientChildren),
      mnCurRegionId(0),
      maAllButton(this, SfxResId(BTN_ALL_TEMPLATES)),
      maFTName(this, SfxResId(FT_NAME))
      maAllButton(new PushButton(this, SfxResId(BTN_ALL_TEMPLATES))),
      maFTName(new FixedText(this, SfxResId(FT_NAME)))
{
    maAllButton.Hide();
    maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON);
    maAllButton.SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
    maFTName.Hide();
    maAllButton->Hide();
    maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
    maAllButton->SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
    maFTName->Hide();
}

TemplateAbstractView::TemplateAbstractView(vcl::Window *pParent)
    : ThumbnailView(pParent),
      mnCurRegionId(0),
      maAllButton(this, SfxResId(BTN_ALL_TEMPLATES)),
      maFTName(this, SfxResId(FT_NAME))
      maAllButton(new PushButton(this, SfxResId(BTN_ALL_TEMPLATES))),
      maFTName(new FixedText(this, SfxResId(FT_NAME)))
{
    maAllButton.Hide();
    maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON);
    maAllButton.SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
    maFTName.Hide();
    maAllButton->Hide();
    maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
    maAllButton->SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
    maFTName->Hide();
}

TemplateAbstractView::~TemplateAbstractView ()
TemplateAbstractView::~TemplateAbstractView()
{
    dispose();
}

void TemplateAbstractView::dispose()
{
    maAllButton.disposeAndClear();
    maFTName.disposeAndClear();
    ThumbnailView::dispose();
}

void TemplateAbstractView::insertItem(const TemplateItemProperties &rTemplate)
@@ -283,7 +291,7 @@ void TemplateAbstractView::OnItemDblClicked (ThumbnailViewItem *pItem)

        mnCurRegionId = pContainerItem->mnRegionId+1;
        maCurRegionName = pContainerItem->maTitle;
        maFTName.SetText(maCurRegionName);
        maFTName->SetText(maCurRegionName);
        showRegion(pItem);
    }
    else
diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx
index 9e2f83a..3c42d29 100644
--- a/sfx2/source/control/templatedefaultview.cxx
+++ b/sfx2/source/control/templatedefaultview.cxx
@@ -28,10 +28,6 @@ TemplateDefaultView::TemplateDefaultView( Window* pParent)
    ThumbnailView::setItemDimensions( mnItemMaxSize, mnItemMaxSize, mnTextHeight, mnItemPadding );
}

TemplateDefaultView::~TemplateDefaultView()
{
}

void TemplateDefaultView::reload()
{
    TemplateLocalView::reload();
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index ad14ae8..022172a 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -45,12 +45,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateLocalView(vcl:

TemplateLocalView::~TemplateLocalView()
{
    dispose();
}

void TemplateLocalView::dispose()
{
    for (size_t i = 0; i < maRegions.size(); ++i)
        delete maRegions[i];

    maRegions.clear();

    delete mpDocTemplates;
    TemplateAbstractView::dispose();
}

void TemplateLocalView::Populate ()
@@ -141,8 +147,8 @@ void TemplateLocalView::showRootRegion()
        items[i] = pItem;
    }

    maAllButton.Show(false);
    maFTName.Show(false);
    maAllButton->Show(false);
    maFTName->Show(false);

    updateItems(items);

@@ -151,12 +157,12 @@ void TemplateLocalView::showRootRegion()

void TemplateLocalView::showRegion(ThumbnailViewItem *pItem)
{
    mnHeaderHeight = maAllButton.GetSizePixel().getHeight() + maAllButton.GetPosPixel().Y() * 2;
    mnHeaderHeight = maAllButton->GetSizePixel().getHeight() + maAllButton->GetPosPixel().Y() * 2;

    mnCurRegionId = static_cast<TemplateContainerItem*>(pItem)->mnRegionId+1;
    maCurRegionName = pItem->maTitle;
    maAllButton.Show(true);
    maFTName.Show(true);
    maAllButton->Show(true);
    maFTName->Show(true);

    insertItems(reinterpret_cast<TemplateContainerItem*>(pItem)->maTemplates);

@@ -169,7 +175,7 @@ void TemplateLocalView::showRegion(const OUString &rName)
    {
        if (maRegions[i]->maTitle == rName)
        {
            maFTName.SetText(rName);
            maFTName->SetText(rName);
            showRegion(maRegions[i]);
            break;
        }
diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx
index 0729a6b..f33407a 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -59,10 +59,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateRemoteView(vcl
    return new TemplateRemoteView(pParent, WB_VSCROLL, false);
}

TemplateRemoteView::~TemplateRemoteView ()
{
}

void TemplateRemoteView::showRootRegion()
{
    //TODO:
@@ -86,7 +82,7 @@ bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefres

    mnCurRegionId = pItem->mnId;
    maCurRegionName = pItem->maTitle;
    maFTName.SetText(maCurRegionName);
    maFTName->SetText(maCurRegionName);

    OUString aURL = pItem->getURL();

diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
index fb21ac6..582dd5a 100644
--- a/sfx2/source/control/templatesearchview.cxx
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -22,10 +22,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateSearchView(vcl
    return new TemplateSearchView(pParent);
}

TemplateSearchView::~TemplateSearchView ()
{
}

void TemplateSearchView::setOpenTemplateHdl(const Link &rLink)
{
    maOpenTemplateHdl = rLink;
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index d855614..c62eeda 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -66,6 +66,11 @@ ThumbnailView::ThumbnailView (vcl::Window *pParent, WinBits nWinStyle, bool bDis

ThumbnailView::~ThumbnailView()
{
    dispose();
}

void ThumbnailView::dispose()
{
    com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>
            xComponent(GetAccessible(false),
                       com::sun::star::uno::UNO_QUERY);
@@ -78,6 +83,7 @@ ThumbnailView::~ThumbnailView()
    delete mpProcessor;

    ImplDeleteItems();
    Control::dispose();
}

void ThumbnailView::MouseMove(const MouseEvent& rMEvt)
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index 040eb18..c866a8f 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -53,7 +53,6 @@ class ResizableMultiLineEdit : public VclMultiLineEdit

    public:
        ResizableMultiLineEdit (vcl::Window* pParent, ThumbnailViewItem* pItem);
        virtual ~ResizableMultiLineEdit ();

        void SetInGrabFocus(bool bInGrabFocus) { mbIsInGrabFocus = bInGrabFocus; }

@@ -68,10 +67,6 @@ ResizableMultiLineEdit::ResizableMultiLineEdit (vcl::Window* pParent, ThumbnailV
{
}

ResizableMultiLineEdit::~ResizableMultiLineEdit ()
{
}

bool ResizableMultiLineEdit::PreNotify(NotifyEvent& rNEvt)
{
    bool nDone = false;
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index d1dc6ea..e157e6e 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -51,11 +51,17 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUStrin

SfxAlienWarningDialog::~SfxAlienWarningDialog()
{
    dispose();
}

void SfxAlienWarningDialog::dispose()
{
    // save value of "warning off" checkbox, if necessary
    SvtSaveOptions aSaveOpt;
    bool bChecked = m_pWarningOnBox->IsChecked();
    if ( aSaveOpt.IsWarnAlienFormat() != bChecked )
        aSaveOpt.SetWarnAlienFormat( bChecked );
    MessageDialog::dispose();
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index ad9f98f..fa3f403 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -195,6 +195,11 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) :

BackingWindow::~BackingWindow()
{
    dispose();
}

void BackingWindow::dispose()
{
    // deregister drag&drop helper
    if (mxDropTargetListener.is())
    {
@@ -212,6 +217,7 @@ BackingWindow::~BackingWindow()
        }
        mxDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >();
    }
    vcl::Window::dispose();
}

void BackingWindow::initControls()
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index aa6e498..023e1cb 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -125,6 +125,7 @@ class BackingWindow
public:
    BackingWindow( vcl::Window* pParent );
    virtual ~BackingWindow();
    virtual void        dispose() SAL_OVERRIDE;

    virtual void        Paint( const Rectangle& rRect ) SAL_OVERRIDE;
    virtual void        Resize() SAL_OVERRIDE;
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 5662278..0637d7d 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -163,15 +163,15 @@ SfxModalDialog::SfxModalDialog(vcl::Window *pParent, const OUString& rID, const 
}

SfxModalDialog::~SfxModalDialog()
{
    dispose();
}

/*  [Description]

    Destructor; writes the Dialog position in the ini-file.
*/

void SfxModalDialog::dispose()
{
    SetDialogData_Impl();
    delete pOutputSet;
    ModalDialog::dispose();
}

void SfxModalDialog::CreateOutputItemSet( SfxItemPool& rPool )
@@ -355,16 +355,16 @@ bool SfxModelessDialog::Notify( NotifyEvent& rEvt )


SfxModelessDialog::~SfxModelessDialog()
{
    dispose();
}

/*  [Description]

    Destructor
*/

void SfxModelessDialog::dispose()
{
    if ( pImp->pMgr->GetFrame().is() && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
        pBindings->SetActiveFrame( NULL );
    delete pImp;
    ModelessDialog::dispose();
}


@@ -505,16 +505,16 @@ bool SfxFloatingWindow::Close()


SfxFloatingWindow::~SfxFloatingWindow()
{
    dispose();
}

/*  [Description]

    Destructor
*/

void SfxFloatingWindow::dispose()
{
    if ( pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
        pBindings->SetActiveFrame( NULL );
    delete pImp;
    FloatingWindow::dispose();
}


@@ -702,9 +702,15 @@ SfxSingleTabDialog::SfxSingleTabDialog(vcl::Window* pParent, const SfxItemSet* p

SfxSingleTabDialog::~SfxSingleTabDialog()
{
    dispose();
}

void SfxSingleTabDialog::dispose()
{
    delete pImpl->m_pSfxPage;
    delete pImpl->m_pLine;
    delete pImpl;
    SfxModalDialog::dispose();
}

void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage,
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 4317295..03b9028e 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1182,16 +1182,29 @@ void SfxDocumentInfoDialog::AddFontTabPage()

CustomPropertiesYesNoButton::CustomPropertiesYesNoButton( vcl::Window* pParent, const ResId& rResId ) :
    Control( pParent, rResId ),
    m_aYesButton( this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() ) ),
    m_aNoButton ( this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() ) )
    m_aYesButton( new RadioButton(this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() )) ),
    m_aNoButton ( new RadioButton(this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() )) )
{
    FreeResource();
    Wallpaper aWall( Color( COL_TRANSPARENT ) );
    SetBackground( aWall );
    SetBorderStyle( WindowBorderStyle::MONO  );
    CheckNo();
    m_aYesButton.SetBackground( aWall );
    m_aNoButton.SetBackground( aWall );
    m_aYesButton->SetBackground( aWall );
    m_aNoButton->SetBackground( aWall );
}


CustomPropertiesYesNoButton::~CustomPropertiesYesNoButton()
{
    dispose();
}

void CustomPropertiesYesNoButton::dispose()
{
    m_aYesButton.disposeAndClear();
    m_aNoButton.disposeAndClear();
    Control::dispose();
}

class DurationDialog_Impl : public ModalDialog
@@ -1259,10 +1272,6 @@ CustomPropertiesDurationField::CustomPropertiesDurationField(vcl::Window* pParen
    SetDuration( util::Duration(false, 0, 0, 0, 0, 0, 0, 0) );
}

CustomPropertiesDurationField::~CustomPropertiesDurationField()
{
}

void CustomPropertiesDurationField::RequestHelp( const HelpEvent& rHEvt )
{
    if ( rHEvt.GetMode() & HelpEventMode::QUICK )
@@ -1299,15 +1308,11 @@ CustomPropertiesEditButton::CustomPropertiesEditButton(vcl::Window* pParent, Win
    SetClickHdl( LINK( this, CustomPropertiesEditButton, ClickHdl ));
}

CustomPropertiesEditButton::~CustomPropertiesEditButton()
{
}

IMPL_LINK_NOARG(CustomPropertiesEditButton, ClickHdl)
{
    boost::scoped_ptr<DurationDialog_Impl> pDurationDlg(new DurationDialog_Impl( this, m_pLine->m_aDurationField.GetDuration() ));
    boost::scoped_ptr<DurationDialog_Impl> pDurationDlg(new DurationDialog_Impl( this, m_pLine->m_aDurationField->GetDuration() ));
    if ( RET_OK == pDurationDlg->Execute() )
        m_pLine->m_aDurationField.SetDuration( pDurationDlg->GetDuration() );
        m_pLine->m_aDurationField->SetDuration( pDurationDlg->GetDuration() );
    return 1;
}

@@ -1316,54 +1321,54 @@ void CustomPropertiesYesNoButton::Resize()
    const long nWidth = GetSizePixel().Width();
    const long n3Width = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ).Width();
    const long nNewWidth = ( nWidth / 2 ) - n3Width - 2;
    Size aSize = m_aYesButton.GetSizePixel();
    Size aSize = m_aYesButton->GetSizePixel();
    const long nDelta = aSize.Width() - nNewWidth;
    aSize.Width() = nNewWidth;
    m_aYesButton.SetSizePixel( aSize );
    Point aPos = m_aNoButton.GetPosPixel();
    m_aYesButton->SetSizePixel( aSize );
    Point aPos = m_aNoButton->GetPosPixel();
    aPos.X() -= nDelta;
    m_aNoButton.SetPosSizePixel( aPos, aSize );
    m_aNoButton->SetPosSizePixel( aPos, aSize );
}

// struct CustomPropertyLine ---------------------------------------------
CustomPropertyLine::CustomPropertyLine( vcl::Window* pParent ) :
    m_aNameBox      ( pParent, SfxResId( SFX_CB_PROPERTY_NAME ) ),
    m_aTypeBox      ( pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this ),
    m_aValueEdit    ( pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ),
    m_aDateField    ( pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ),
    m_aTimeField    ( pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ),
    m_aNameBox      ( new ComboBox(pParent, SfxResId( SFX_CB_PROPERTY_NAME )) ),
    m_aTypeBox      ( new CustomPropertiesTypeBox(pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this) ),
    m_aValueEdit    ( new CustomPropertiesEdit(pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ) ),
    m_aDateField    ( new CustomPropertiesDateField(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
    m_aTimeField    ( new CustomPropertiesTimeField(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
    m_sDurationFormat( SfxResId( SFX_ST_DURATION_FORMAT ).toString() ),
    m_aDurationField( pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ),
    m_aEditButton   ( pParent, WB_TABSTOP, this ),
    m_aYesNoButton  ( pParent, SfxResId( SFX_WIN_PROPERTY_YESNO ) ),
    m_aRemoveButton ( pParent, 0, this ),
    m_aDurationField( new CustomPropertiesDurationField(pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ) ),
    m_aEditButton   ( new CustomPropertiesEditButton(pParent, WB_TABSTOP, this) ),
    m_aYesNoButton  ( new CustomPropertiesYesNoButton(pParent, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
    m_aRemoveButton ( new CustomPropertiesRemoveButton(pParent, 0, this) ),
    m_bIsDate       ( false ),
    m_bIsRemoved    ( false ),
    m_bTypeLostFocus( false )

{
    m_aTimeField.SetExtFormat( EXTTIMEF_24H_LONG );
    m_aDateField.SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY );
    m_aTimeField->SetExtFormat( EXTTIMEF_24H_LONG );
    m_aDateField->SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY );

    m_aRemoveButton.SetModeImage(Image(SfxResId(SFX_IMG_PROPERTY_REMOVE)));
    m_aRemoveButton.SetQuickHelpText(SfxResId(STR_SFX_REMOVE_PROPERTY).toString());
    m_aRemoveButton->SetModeImage(Image(SfxResId(SFX_IMG_PROPERTY_REMOVE)));
    m_aRemoveButton->SetQuickHelpText(SfxResId(STR_SFX_REMOVE_PROPERTY).toString());

    m_aEditButton.SetText(SfxResId(SFX_ST_EDIT).toString());
    m_aEditButton->SetText(SfxResId(SFX_ST_EDIT).toString());
}

void CustomPropertyLine::SetRemoved()
{
    DBG_ASSERT( !m_bIsRemoved, "CustomPropertyLine::SetRemoved(): line already removed" );
    m_bIsRemoved = true;
    m_aNameBox.Hide();
    m_aTypeBox.Hide();
    m_aValueEdit.Hide();
    m_aDateField.Hide();
    m_aTimeField.Hide();
    m_aDurationField.Hide();
    m_aEditButton.Hide();
    m_aYesNoButton.Hide();
    m_aRemoveButton.Hide();
    m_aNameBox->Hide();
    m_aTypeBox->Hide();
    m_aValueEdit->Hide();
    m_aDateField->Hide();
    m_aTimeField->Hide();
    m_aDurationField->Hide();
    m_aEditButton->Hide();
    m_aYesNoButton->Hide();
    m_aRemoveButton->Hide();
}

CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
@@ -1374,15 +1379,15 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
    m_pHeaderAccName(pHeaderAccName),
    m_pHeaderAccType(pHeaderAccType),
    m_pHeaderAccValue(pHeaderAccValue),
    m_aNameBox      ( this, SfxResId( SFX_CB_PROPERTY_NAME ) ),
    m_aTypeBox      ( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ),
    m_aValueEdit    ( this, WB_BORDER|WB_TABSTOP|WB_LEFT ),
    m_aDateField    ( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ),
    m_aTimeField    ( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ),
    m_aDurationField( this, WB_BORDER|WB_TABSTOP|WB_READONLY ),
    m_aEditButton(    this, WB_TABSTOP ),
    m_aYesNoButton  ( this, SfxResId( SFX_WIN_PROPERTY_YESNO ) ),
    m_aRemoveButton ( this, 0 ),
    m_aNameBox      ( new ComboBox( this, SfxResId( SFX_CB_PROPERTY_NAME ) ) ),
    m_aTypeBox      ( new ListBox( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ) ),
    m_aValueEdit    ( new Edit( this, WB_BORDER|WB_TABSTOP|WB_LEFT ) ),
    m_aDateField    ( new DateField( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
    m_aTimeField    ( new TimeField( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
    m_aDurationField( new Edit( this, WB_BORDER|WB_TABSTOP|WB_READONLY ),
    m_aEditButton   ( new PushButton( this, WB_TABSTOP ) ),
    m_aYesNoButton  ( new CustomPropertiesYesNoButton( this, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
    m_aRemoveButton ( new ImageButton( this, 0 ),
    m_nScrollPos (0),
    m_pCurrentLine (NULL),
    m_aNumberFormatter( ::comphelper::getProcessComponentContext(),
@@ -1403,57 +1408,72 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
    m_aBoxLoseFocusIdle.SetPriority( SchedulerPriority::LOWEST );
    m_aBoxLoseFocusIdle.SetIdleHdl( LINK( this, CustomPropertiesWindow, BoxTimeoutHdl ) );

    m_aNameBox.add_mnemonic_label(m_pHeaderAccName);
    m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText());
    m_aTypeBox.add_mnemonic_label(m_pHeaderAccType);
    m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText());
    m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue);
    m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText());
    m_aNameBox->add_mnemonic_label(m_pHeaderAccName);
    m_aNameBox->SetAccessibleName(m_pHeaderAccName->GetText());
    m_aTypeBox->add_mnemonic_label(m_pHeaderAccType);
    m_aTypeBox->SetAccessibleName(m_pHeaderAccType->GetText());
    m_aValueEdit->add_mnemonic_label(m_pHeaderAccValue);
    m_aValueEdit->SetAccessibleName(m_pHeaderAccValue->GetText());

    m_aNameBox.Hide();
    m_aTypeBox.Hide();
    m_aValueEdit.Hide();
    m_aDateField.Hide();
    m_aTimeField.Hide();
    m_aDurationField.Hide();
    m_aEditButton.Hide();
    m_aYesNoButton.Hide();
    m_aRemoveButton.Hide();
    m_aNameBox->Hide();
    m_aTypeBox->Hide();
    m_aValueEdit->Hide();
    m_aDateField->Hide();
    m_aTimeField->Hide();
    m_aDurationField->Hide();
    m_aEditButton->Hide();
    m_aYesNoButton->Hide();
    m_aRemoveButton->Hide();

    m_nLineHeight =
        ( m_aRemoveButton.GetPosPixel().Y() * 2 ) + m_aRemoveButton.GetSizePixel().Height();
        ( m_aRemoveButton->GetPosPixel().Y() * 2 ) + m_aRemoveButton->GetSizePixel().Height();
}

CustomPropertiesWindow::~CustomPropertiesWindow()
{
    dispose();
}

void CustomPropertiesWindow::dispose()
{
    m_aEditLoseFocusIdle.Stop();
    m_aBoxLoseFocusIdle.Stop();
    ClearAllLines();
    m_aNameBox.disposeAndClear();
    m_aTypeBox.disposeAndClear();
    m_aValueEdit.disposeAndClear();
    m_aDateField.disposeAndClear();
    m_aTimeField.disposeAndClear();
    m_aDurationField.disposeAndClear();
    m_aEditButton.disposeAndClear();
    m_aYesNoButton.disposeAndClear();
    m_aRemoveButton.disposeAndClear();
    vcl::Window::dispose();
}

IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox )
{
    long nType = reinterpret_cast<long>( pBox->GetSelectEntryData() );
    CustomPropertyLine* pLine = pBox->GetLine();
    pLine->m_aValueEdit.Show( (CUSTOM_TYPE_TEXT == nType) || (CUSTOM_TYPE_NUMBER  == nType) );
    pLine->m_aDateField.Show( (CUSTOM_TYPE_DATE == nType) || (CUSTOM_TYPE_DATETIME  == nType) );
    pLine->m_aTimeField.Show( CUSTOM_TYPE_DATETIME  == nType );
    pLine->m_aDurationField.Show( CUSTOM_TYPE_DURATION == nType );
    pLine->m_aEditButton.Show( CUSTOM_TYPE_DURATION == nType );
    pLine->m_aYesNoButton.Show( CUSTOM_TYPE_BOOLEAN == nType );
    pLine->m_aValueEdit->Show( (CUSTOM_TYPE_TEXT == nType) || (CUSTOM_TYPE_NUMBER  == nType) );
    pLine->m_aDateField->Show( (CUSTOM_TYPE_DATE == nType) || (CUSTOM_TYPE_DATETIME  == nType) );
    pLine->m_aTimeField->Show( CUSTOM_TYPE_DATETIME  == nType );
    pLine->m_aDurationField->Show( CUSTOM_TYPE_DURATION == nType );
    pLine->m_aEditButton->Show( CUSTOM_TYPE_DURATION == nType );
    pLine->m_aYesNoButton->Show( CUSTOM_TYPE_BOOLEAN == nType );

    //adjust positions of date and time controls
    if ( nType == CUSTOM_TYPE_DATE )
    {
        pLine->m_bIsDate = true;
        pLine->m_aDateField.SetSizePixel( pLine->m_aValueEdit.GetSizePixel() );
        pLine->m_aDateField->SetSizePixel( pLine->m_aValueEdit->GetSizePixel() );
    }
    else if ( nType == CUSTOM_TYPE_DATETIME)
    {
        // because m_aDateField and m_aTimeField have the same size for type "DateTime",
        // we just rely on m_aTimeField here.
        pLine->m_bIsDate = false;
        pLine->m_aDateField.SetSizePixel( pLine->m_aTimeField.GetSizePixel() );
        pLine->m_aDateField->SetSizePixel( pLine->m_aTimeField->GetSizePixel() );
    }

    return 0;
@@ -1476,10 +1496,10 @@ IMPL_LINK( CustomPropertiesWindow, RemoveHdl, CustomPropertiesRemoveButton*, pBu
            if ( pLine->m_bIsRemoved )
                continue;

            vcl::Window* pWindows[] = {  &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit,
                                    &pLine->m_aDateField, &pLine->m_aTimeField,
                                    &pLine->m_aDurationField, &pLine->m_aEditButton,
                                    &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
            vcl::Window* pWindows[] = {  pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(),
                                    pLine->m_aDateField.get(), pLine->m_aTimeField.get(),
                                    pLine->m_aDurationField.get(), pLine->m_aEditButton.get(),
                                    pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), NULL };
            vcl::Window** pCurrent = pWindows;
            while ( *pCurrent )
            {
@@ -1539,8 +1559,8 @@ bool CustomPropertiesWindow::IsLineValid( CustomPropertyLine* pLine ) const
    bool bIsValid = true;
    pLine->m_bTypeLostFocus = false;
    long nType = reinterpret_cast<long>(
                     pLine->m_aTypeBox.GetSelectEntryData() );
    OUString sValue = pLine->m_aValueEdit.GetText();
                     pLine->m_aTypeBox->GetSelectEntryData() );
    OUString sValue = pLine->m_aValueEdit->GetText();
    if ( sValue.isEmpty() )
        return true;

@@ -1574,9 +1594,9 @@ void CustomPropertiesWindow::ValidateLine( CustomPropertyLine* pLine, bool bIsFr
            pLine->m_bTypeLostFocus = true;
        vcl::Window* pParent = GetParent()->GetParent();
        if (MessageDialog(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL).Execute() == RET_OK)
            pLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast<void*>(CUSTOM_TYPE_TEXT) ) );
            pLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast<void*>(CUSTOM_TYPE_TEXT) ) );
        else
            pLine->m_aValueEdit.GrabFocus();
            pLine->m_aValueEdit->GrabFocus();
    }
}

@@ -1589,8 +1609,8 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa

    const long nOffset = 4;
    const long nScrollBarWidth = pScrollBar->GetSizePixel().Width();
    const long nButtonWidth = m_aRemoveButton.GetSizePixel().Width() + nScrollBarWidth + nOffset;
    long nTypeWidth = m_aTypeBox.CalcMinimumSize().Width() + ( 2 * nOffset );
    const long nButtonWidth = m_aRemoveButton->GetSizePixel().Width() + nScrollBarWidth + nOffset;
    long nTypeWidth = m_aTypeBox->CalcMinimumSize().Width() + ( 2 * nOffset );
    long nFullWidth = pHeaderBar->GetSizePixel().Width();
    long nItemWidth = ( nFullWidth - nTypeWidth - nButtonWidth ) / 2;
    pHeaderBar->SetItemSize( HI_NAME, nItemWidth );
@@ -1598,7 +1618,7 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
    pHeaderBar->SetItemSize( HI_VALUE, nItemWidth );
    pHeaderBar->SetItemSize( HI_ACTION, nButtonWidth );

    vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit, &m_aRemoveButton, NULL };
    vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(), m_aRemoveButton.get(), NULL };
    vcl::Window** pCurrent = pWindows;
    sal_uInt16 nPos = 0;
    while ( *pCurrent )
@@ -1609,7 +1629,7 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
        Size aSize(aOrigSize);
        Point aPos(aOrigPos);
        long nWidth = aRect.GetWidth() - nOffset;
        if ( *pCurrent == &m_aRemoveButton )
        if ( *pCurrent == m_aRemoveButton.get() )
            nWidth -= pScrollBar->GetSizePixel().Width();
        aSize.Width() = nWidth;
        aPos.X() = aRect.getX() + ( nOffset / 2 );
@@ -1620,23 +1640,23 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
            bChanged = true;
        }

        if ( *pCurrent == &m_aValueEdit )
        if ( *pCurrent == m_aValueEdit.get() )
        {
            Point aDurationPos( aPos );
            m_aDurationField.SetPosPixel( aDurationPos );
            m_aDurationField->SetPosPixel( aDurationPos );
            Size aDurationSize(aSize);
            aDurationSize.Width() -= (m_aEditButton.GetSizePixel().Width() + 3 );
            m_aDurationField.SetSizePixel(aDurationSize);
            aDurationPos.X() = aPos.X() - m_aEditButton.GetSizePixel().Width() + aSize.Width();
            m_aEditButton.SetPosPixel(aDurationPos);
            aDurationSize.Width() -= (m_aEditButton->GetSizePixel().Width() + 3 );
            m_aDurationField->SetSizePixel(aDurationSize);
            aDurationPos.X() = aPos.X() - m_aEditButton->GetSizePixel().Width() + aSize.Width();
            m_aEditButton->SetPosPixel(aDurationPos);

            m_aYesNoButton.SetPosSizePixel( aPos, aSize );
            m_aYesNoButton->SetPosSizePixel( aPos, aSize );

            aSize.Width() /= 2;
            aSize.Width() -= 2;
            m_aDateField.SetPosSizePixel( aPos, aSize );
            m_aDateField->SetPosSizePixel( aPos, aSize );
            aPos.X() += aSize.Width() + 4;
            m_aTimeField.SetPosSizePixel( aPos, aSize );
            m_aTimeField->SetPosSizePixel( aPos, aSize );
        }

        pCurrent++;
@@ -1660,10 +1680,10 @@ sal_uInt16 CustomPropertiesWindow::GetVisibleLineCount() const

void CustomPropertiesWindow::updateLineWidth()
{
    vcl::Window* pWindows[] = {  &m_aNameBox, &m_aTypeBox, &m_aValueEdit,
                            &m_aDateField, &m_aTimeField,
                            &m_aDurationField, &m_aEditButton,
                            &m_aYesNoButton, &m_aRemoveButton, NULL };
    vcl::Window* pWindows[] = {  m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(),
                            m_aDateField.get(), m_aTimeField.get(),
                            m_aDurationField.get(), m_aEditButton.get(),
                            m_aYesNoButton.get(), m_aRemoveButton.get(), NULL };

    for (std::vector< CustomPropertyLine* >::iterator aI =
        m_aCustomPropertiesLines.begin(), aEnd = m_aCustomPropertiesLines.end();
@@ -1672,10 +1692,10 @@ void CustomPropertiesWindow::updateLineWidth()
        CustomPropertyLine* pNewLine = *aI;

        vcl::Window* pNewWindows[] =
            {   &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit,
                &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
                &pNewLine->m_aDurationField, &pNewLine->m_aEditButton,
                &pNewLine->m_aYesNoButton, &pNewLine->m_aRemoveButton, NULL };
            {   pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(),
                pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(),
                pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(),
                pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), NULL };

        vcl::Window** pCurrent = pWindows;
        vcl::Window** pNewCurrent = pNewWindows;
@@ -1691,38 +1711,38 @@ void CustomPropertiesWindow::updateLineWidth()

        // if we have type "Date", we use the full width, not only the half
        if (pNewLine->m_bIsDate)
            pNewLine->m_aDateField.SetSizePixel( pNewLine->m_aValueEdit.GetSizePixel() );
            pNewLine->m_aDateField->SetSizePixel( pNewLine->m_aValueEdit->GetSizePixel() );
    }
}

void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
{
    CustomPropertyLine* pNewLine = new CustomPropertyLine( this );
    pNewLine->m_aTypeBox.SetSelectHdl( LINK( this, CustomPropertiesWindow, TypeHdl ) );
    pNewLine->m_aRemoveButton.SetClickHdl( LINK( this, CustomPropertiesWindow, RemoveHdl ) );
    pNewLine->m_aValueEdit.SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, EditLoseFocusHdl ) );
    pNewLine->m_aTypeBox->SetSelectHdl( LINK( this, CustomPropertiesWindow, TypeHdl ) );
    pNewLine->m_aRemoveButton->SetClickHdl( LINK( this, CustomPropertiesWindow, RemoveHdl ) );
    pNewLine->m_aValueEdit->SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, EditLoseFocusHdl ) );
    //add lose focus handlers of date/time fields

    pNewLine->m_aTypeBox.SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, BoxLoseFocusHdl ) );
    pNewLine->m_aTypeBox->SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, BoxLoseFocusHdl ) );

    pNewLine->m_aNameBox.add_mnemonic_label(m_pHeaderAccName);
    pNewLine->m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText());
    pNewLine->m_aTypeBox.add_mnemonic_label(m_pHeaderAccType);
    pNewLine->m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText());
    pNewLine->m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue);
    pNewLine->m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText());
    pNewLine->m_aNameBox->add_mnemonic_label(m_pHeaderAccName);
    pNewLine->m_aNameBox->SetAccessibleName(m_pHeaderAccName->GetText());
    pNewLine->m_aTypeBox->add_mnemonic_label(m_pHeaderAccType);
    pNewLine->m_aTypeBox->SetAccessibleName(m_pHeaderAccType->GetText());
    pNewLine->m_aValueEdit->add_mnemonic_label(m_pHeaderAccValue);
    pNewLine->m_aValueEdit->SetAccessibleName(m_pHeaderAccValue->GetText());

    sal_Int32 nPos = GetVisibleLineCount() * GetLineHeight();
    m_aCustomPropertiesLines.push_back( pNewLine );
    vcl::Window* pWindows[] = {  &m_aNameBox, &m_aTypeBox, &m_aValueEdit,
                            &m_aDateField, &m_aTimeField,
                            &m_aDurationField, &m_aEditButton,
                            &m_aYesNoButton, &m_aRemoveButton, NULL };
    vcl::Window* pWindows[] = {  m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(),
                            m_aDateField.get(), m_aTimeField.get(),
                            m_aDurationField.get(), m_aEditButton.get(),
                            m_aYesNoButton.get(), m_aRemoveButton.get(), NULL };
    vcl::Window* pNewWindows[] =
        {   &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit,
            &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
            &pNewLine->m_aDurationField, &pNewLine->m_aEditButton,
            &pNewLine->m_aYesNoButton, &pNewLine->m_aRemoveButton, NULL };
        {   pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(),
            pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(),
            pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(),
            pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), NULL };
    vcl::Window** pCurrent = pWindows;
    vcl::Window** pNewCurrent = pNewWindows;
    while ( *pCurrent )
@@ -1747,7 +1767,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
    util::Duration aTmpDuration;
    SvtSysLocale aSysLocale;
    const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData();
    pNewLine->m_aNameBox.SetText( sName );
    pNewLine->m_aNameBox->SetText( sName );
    sal_IntPtr nType = CUSTOM_TYPE_UNKNOWN;
    OUString sValue;

@@ -1755,7 +1775,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
    {
        sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
        m_aNumberFormatter.GetInputLineString( nTmpValue, nIndex, sValue );
        pNewLine->m_aValueEdit.SetText( sValue );
        pNewLine->m_aValueEdit->SetText( sValue );
        nType = CUSTOM_TYPE_NUMBER;
    }
    else if ( rAny >>= bTmpValue )
@@ -1765,41 +1785,41 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
    }
    else if ( rAny >>= sTmpValue )
    {
        pNewLine->m_aValueEdit.SetText( sTmpValue );
        pNewLine->m_aValueEdit->SetText( sTmpValue );
        nType = CUSTOM_TYPE_TEXT;
    }
    else if ( rAny >>= aTmpDate )
    {
        pNewLine->m_aDateField.SetDate( Date( aTmpDate ) );
        pNewLine->m_aDateField->SetDate( Date( aTmpDate ) );
        nType = CUSTOM_TYPE_DATE;
    }
    else if ( rAny >>= aTmpDateTime )
    {
        pNewLine->m_aDateField.SetDate( Date( aTmpDateTime ) );
        pNewLine->m_aTimeField.SetTime( tools::Time( aTmpDateTime ) );
        pNewLine->m_aTimeField.m_isUTC = aTmpDateTime.IsUTC;
        pNewLine->m_aDateField->SetDate( Date( aTmpDateTime ) );
        pNewLine->m_aTimeField->SetTime( tools::Time( aTmpDateTime ) );
        pNewLine->m_aTimeField->m_isUTC = aTmpDateTime.IsUTC;
        nType = CUSTOM_TYPE_DATETIME;
    }
    else if ( rAny >>= aTmpDateTZ )
    {
        pNewLine->m_aDateField.SetDate( Date( aTmpDateTZ.DateInTZ.Day,
        pNewLine->m_aDateField->SetDate( Date( aTmpDateTZ.DateInTZ.Day,
                    aTmpDateTZ.DateInTZ.Month, aTmpDateTZ.DateInTZ.Year ) );
        pNewLine->m_aDateField.m_TZ = aTmpDateTZ.Timezone;
        pNewLine->m_aDateField->m_TZ = aTmpDateTZ.Timezone;
        nType = CUSTOM_TYPE_DATE;
    }
    else if ( rAny >>= aTmpDateTimeTZ )
    {
        util::DateTime const& rDT(aTmpDateTimeTZ.DateTimeInTZ);
        pNewLine->m_aDateField.SetDate( Date( rDT ) );
        pNewLine->m_aTimeField.SetTime( tools::Time( rDT ) );
        pNewLine->m_aTimeField.m_isUTC = rDT.IsUTC;
        pNewLine->m_aDateField.m_TZ = aTmpDateTimeTZ.Timezone;
        pNewLine->m_aDateField->SetDate( Date( rDT ) );
        pNewLine->m_aTimeField->SetTime( tools::Time( rDT ) );
        pNewLine->m_aTimeField->m_isUTC = rDT.IsUTC;
        pNewLine->m_aDateField->m_TZ = aTmpDateTimeTZ.Timezone;
        nType = CUSTOM_TYPE_DATETIME;
    }
    else if ( rAny >>= aTmpDuration )
    {
        nType = CUSTOM_TYPE_DURATION;
        pNewLine->m_aDurationField.SetDuration( aTmpDuration );
        pNewLine->m_aDurationField->SetDuration( aTmpDuration );
    }

    if ( nType != CUSTOM_TYPE_UNKNOWN )
@@ -1807,15 +1827,15 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
        if ( CUSTOM_TYPE_BOOLEAN == nType )
        {
            if ( bTmpValue )
                pNewLine->m_aYesNoButton.CheckYes();
                pNewLine->m_aYesNoButton->CheckYes();
            else
                pNewLine->m_aYesNoButton.CheckNo();
                pNewLine->m_aYesNoButton->CheckNo();
        }
        pNewLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast<void*>(nType) ) );
        pNewLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast<void*>(nType) ) );
    }

    TypeHdl( &pNewLine->m_aTypeBox );
    pNewLine->m_aNameBox.GrabFocus();
    TypeHdl( pNewLine->m_aTypeBox.get() );
    pNewLine->m_aNameBox->GrabFocus();
}

bool CustomPropertiesWindow::AreAllLinesValid() const
@@ -1861,8 +1881,8 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos )
        if ( pLine->m_bIsRemoved )
            continue;

        vcl::Window* pWindows[] = {  &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, &pLine->m_aTimeField,
                                &pLine->m_aDurationField, &pLine->m_aEditButton, &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
        vcl::Window* pWindows[] = {  pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(), pLine->m_aDateField.get(), pLine->m_aTimeField.get(),
                                pLine->m_aDurationField.get(), pLine->m_aEditButton.get(), pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), NULL };
        vcl::Window** pCurrent = pWindows;
        while ( *pCurrent )
        {
@@ -1886,39 +1906,39 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
        if ( pLine->m_bIsRemoved )
            continue;

        OUString sPropertyName = pLine->m_aNameBox.GetText();
        OUString sPropertyName = pLine->m_aNameBox->GetText();
        if ( !sPropertyName.isEmpty() )
        {
            aPropertiesSeq[i].Name = sPropertyName;
            long nType = reinterpret_cast<long>(
                            pLine->m_aTypeBox.GetSelectEntryData() );
                            pLine->m_aTypeBox->GetSelectEntryData() );
            if ( CUSTOM_TYPE_NUMBER == nType )
            {
                double nValue = 0;
                sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
                    m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
                bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
                    IsNumberFormat( pLine->m_aValueEdit.GetText(), nIndex, nValue );
                    IsNumberFormat( pLine->m_aValueEdit->GetText(), nIndex, nValue );
                if ( bIsNum )
                    aPropertiesSeq[i].Value <<= makeAny( nValue );
            }
            else if ( CUSTOM_TYPE_BOOLEAN == nType )
            {
                bool bValue = pLine->m_aYesNoButton.IsYesChecked();
                bool bValue = pLine->m_aYesNoButton->IsYesChecked();
                aPropertiesSeq[i].Value <<= makeAny( bValue );
            }
            else if ( CUSTOM_TYPE_DATETIME == nType )
            {
                Date aTmpDate = pLine->m_aDateField.GetDate();
                tools::Time aTmpTime = pLine->m_aTimeField.GetTime();
                Date aTmpDate = pLine->m_aDateField->GetDate();
                tools::Time aTmpTime = pLine->m_aTimeField->GetTime();
                util::DateTime const aDateTime(aTmpTime.GetNanoSec(),
                    aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(),
                    aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear(),
                    pLine->m_aTimeField.m_isUTC);
                if (pLine->m_aDateField.m_TZ.is_initialized())
                    pLine->m_aTimeField->m_isUTC);
                if (pLine->m_aDateField->m_TZ.is_initialized())
                {
                    aPropertiesSeq[i].Value <<= util::DateTimeWithTimezone(
                            aDateTime, pLine->m_aDateField.m_TZ.get());
                            aDateTime, pLine->m_aDateField->m_TZ.get());
                }
                else
                {
@@ -1927,13 +1947,13 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
            }
            else if ( CUSTOM_TYPE_DATE == nType )
            {
                Date aTmpDate = pLine->m_aDateField.GetDate();
                Date aTmpDate = pLine->m_aDateField->GetDate();
                util::Date const aDate(aTmpDate.GetDay(), aTmpDate.GetMonth(),
                        aTmpDate.GetYear());
                if (pLine->m_aDateField.m_TZ.is_initialized())
                if (pLine->m_aDateField->m_TZ.is_initialized())
                {
                    aPropertiesSeq[i].Value <<= util::DateWithTimezone(
                            aDate, pLine->m_aDateField.m_TZ.get());
                            aDate, pLine->m_aDateField->m_TZ.get());
                }
                else
                {
@@ -1942,11 +1962,11 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
            }
            else if ( CUSTOM_TYPE_DURATION == nType )
            {
                aPropertiesSeq[i].Value <<= pLine->m_aDurationField.GetDuration();
                aPropertiesSeq[i].Value <<= pLine->m_aDurationField->GetDuration();
            }
            else
            {
                OUString sValue( pLine->m_aValueEdit.GetText() );
                OUString sValue( pLine->m_aValueEdit->GetText() );
                aPropertiesSeq[i].Value <<= makeAny( sValue );
            }
        }
@@ -2055,11 +2075,17 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeCustomPropertiesContro

CustomPropertiesControl::~CustomPropertiesControl()
{
    dispose();
}

void CustomPropertiesControl::dispose()
{
    delete m_pVertScroll;
    delete m_pPropertiesWin;
    delete m_pBody;
    delete m_pHeaderBar;
    delete m_pVBox;
    vcl::Window::dispose();
}

IMPL_LINK( CustomPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar )
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 7118b28..06fe979 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -71,8 +71,9 @@ public:
                            vcl::Window* pParent ,
                            WinBits nBits);
    virtual             ~SfxTitleDockingWindow();
    virtual void        dispose() SAL_OVERRIDE;

    vcl::Window*             GetWrappedWindow() const { return m_pWrappedWindow; }
    vcl::Window*        GetWrappedWindow() const { return m_pWrappedWindow; }
    void                SetWrappedWindow(vcl::Window* const pWindow);

    virtual void        StateChanged( StateChangedType nType ) SAL_OVERRIDE;
@@ -252,7 +253,13 @@ SfxTitleDockingWindow::SfxTitleDockingWindow( SfxBindings* pBind ,

SfxTitleDockingWindow::~SfxTitleDockingWindow()
{
    dispose();
}

void SfxTitleDockingWindow::dispose()
{
    delete m_pWrappedWindow;
    SfxDockingWindow::dispose();
}

void SfxTitleDockingWindow::SetWrappedWindow( vcl::Window* const pWindow )
@@ -1267,8 +1274,14 @@ void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const

SfxDockingWindow::~SfxDockingWindow()
{
    dispose();
}

void SfxDockingWindow::dispose()
{
    ReleaseChildWindow_Impl();
    delete pImp;
    DockingWindow::dispose();
}

void SfxDockingWindow::ReleaseChildWindow_Impl()
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index 6d3924c..777b3fe 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -136,9 +136,6 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId,
    Resize();
}

SfxInfoBarWindow::~SfxInfoBarWindow()
{}

void SfxInfoBarWindow::addButton(PushButton* pButton) {
    pButton->SetParent(this);
    pButton->Show();
@@ -146,6 +143,25 @@ void SfxInfoBarWindow::addButton(PushButton* pButton) {
    Resize();
}

SfxInfoBarWindow::~SfxInfoBarWindow()
{
    dispose();
}

void SfxInfoBarWindow::dispose()
{
    delete m_pMessage;
    delete m_pCloseBtn;

    for ( vector< PushButton* >::iterator it = m_aActionBtns.begin( );
            it != m_aActionBtns.end( ); ++it )
    {
        delete *it;
    }
    m_aActionBtns.clear( );
    vcl::Window::dispose();
}

void SfxInfoBarWindow::Paint(const Rectangle& rPaintRect)
{
    const ViewInformation2D aNewViewInfos;
@@ -233,6 +249,18 @@ SfxInfoBarContainerWindow::SfxInfoBarContainerWindow(SfxInfoBarContainerChild* p

SfxInfoBarContainerWindow::~SfxInfoBarContainerWindow()
{
    dispose();
}

void SfxInfoBarContainerWindow::dispose()
{
    for ( vector< SfxInfoBarWindow* >::iterator it = m_pInfoBars.begin( );
            it != m_pInfoBars.end( ); ++it )
    {
        delete *it;
    }
    m_pInfoBars.clear( );
    Window::dispose();
}

SfxInfoBarWindow* SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, const OUString& sMessage)
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index fc1d7db..91dbe40 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -249,19 +249,18 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx


SfxManageStyleSheetPage::~SfxManageStyleSheetPage()
{
    dispose();
}

/*  [Description]

    Destructor, release of the data
*/

void SfxManageStyleSheetPage::dispose()
{
    m_pNameRw->SetGetFocusHdl( Link() );
    m_pNameRw->SetLoseFocusHdl( Link() );
    delete pFamilies;
    pItem = 0;
    pStyle = 0;

    SfxTabPage::dispose();
}


diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx
index a2f43fb..b8ec5b1 100644
--- a/sfx2/source/dialog/newstyle.cxx
+++ b/sfx2/source/dialog/newstyle.cxx
@@ -41,7 +41,7 @@ IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl )
            return 0;
        }

        if ( RET_YES == aQueryOverwriteBox.Execute() )
        if ( RET_YES == aQueryOverwriteBox->Execute() )
            EndDialog( RET_OK );
    }
    else
@@ -59,8 +59,8 @@ IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox )

SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rInPool )
    : ModalDialog(pParent, "CreateStyleDialog", "sfx/ui/newstyle.ui")
    , aQueryOverwriteBox(this, SfxResId(STR_QUERY_OVERWRITE),
                         VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)
    , aQueryOverwriteBox(new MessageDialog(this, SfxResId(STR_QUERY_OVERWRITE),
                                           VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO))
    , rPool(rInPool)
{
    get(m_pColBox, "stylename");
@@ -82,6 +82,13 @@ SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rIn

SfxNewStyleDlg::~SfxNewStyleDlg()
{
    dispose();
}

void SfxNewStyleDlg::dispose()
{
    aQueryOverwriteBox.disposeAndClear();
    ModalDialog::dispose();
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx
index 0a168d8..40fabdb 100644
--- a/sfx2/source/dialog/partwnd.cxx
+++ b/sfx2/source/dialog/partwnd.cxx
@@ -140,12 +140,6 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl



SfxPartDockWnd_Impl::~SfxPartDockWnd_Impl()
{
}



void SfxPartDockWnd_Impl::Resize()

/*  [Description]
diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx
index fbd6340..0daebad 100644
--- a/sfx2/source/dialog/printopt.cxx
+++ b/sfx2/source/dialog/printopt.cxx
@@ -85,10 +85,6 @@ SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( vcl::Window* pParent
    m_pReduceBitmapsResolutionRB->SetToggleHdl( LINK( this, SfxCommonPrintOptionsTabPage, ToggleReduceBitmapsResolutionRBHdl ) );
}

SfxCommonPrintOptionsTabPage::~SfxCommonPrintOptionsTabPage()
{
}

SfxTabPage* SfxCommonPrintOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
    return( new SfxCommonPrintOptionsTabPage( pParent, *rAttrSet ) );
diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx
index d051bb3..8760a08 100644
--- a/sfx2/source/dialog/recfloat.cxx
+++ b/sfx2/source/dialog/recfloat.cxx
@@ -200,6 +200,11 @@ SfxRecordingFloat_Impl::SfxRecordingFloat_Impl(

SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl()
{
    dispose();
}

void SfxRecordingFloat_Impl::dispose()
{
    try
    {
        if ( xStopRecTbxCtrl.is() )
@@ -211,6 +216,7 @@ SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl()
    catch ( uno::Exception& )
    {
    }
    SfxFloatingWindow::dispose();
}

bool SfxRecordingFloat_Impl::Close()
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
index b3fcb3d..2ddf168 100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -433,10 +433,6 @@ SfxSecurityPage::SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& rItemS
}


SfxSecurityPage::~SfxSecurityPage()
{
}


bool SfxSecurityPage::FillItemSet( SfxItemSet * rItemSet )
{
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index 250d6e5..036a578 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -115,8 +115,11 @@ friend class SfxSplitWindow;
                        }

                        virtual ~SfxEmptySplitWin_Impl()
                        { dispose(); }
   virtual void         dispose() SAL_OVERRIDE
                        {
                            aTimer.Stop();
                            SplitWindow::dispose();
                        }

    virtual void        MouseMove( const MouseEvent& ) SAL_OVERRIDE;
@@ -299,6 +302,11 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl,

SfxSplitWindow::~SfxSplitWindow()
{
    dispose();
}

void SfxSplitWindow::dispose()
{
    if ( !pWorkWin->GetParent_Impl() )
        SaveConfig_Impl();

@@ -311,6 +319,7 @@ SfxSplitWindow::~SfxSplitWindow()
    }

    delete pDockArr;
    SplitWindow::dispose();
}

void SfxSplitWindow::SaveConfig_Impl()
diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx
index efc3c78..d933c02 100644
--- a/sfx2/source/dialog/srchdlg.cxx
+++ b/sfx2/source/dialog/srchdlg.cxx
@@ -62,8 +62,14 @@ SearchDialog::SearchDialog(vcl::Window* pWindow, const OUString& rConfigName)

SearchDialog::~SearchDialog()
{
    dispose();
}

void SearchDialog::dispose()
{
    SaveConfig();
    m_aCloseHdl.Call( NULL );
    ModelessDialog::dispose();
}

void SearchDialog::LoadConfig()
diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx
index dc0d5f0..5fc0c4c 100644
--- a/sfx2/source/dialog/styledlg.cxx
+++ b/sfx2/source/dialog/styledlg.cxx
@@ -71,6 +71,9 @@ SfxStyleDialog::SfxStyleDialog


SfxStyleDialog::~SfxStyleDialog()
{
    dispose();
}

/*  [Description]

@@ -78,9 +81,11 @@ SfxStyleDialog::~SfxStyleDialog()
    the Set from Style.
*/

void SfxStyleDialog::dispose()
{
    pExampleSet = 0;
    pStyle = 0;
    SfxTabDialog::dispose();
}


diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 55c0556..1af6478 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -171,12 +171,14 @@ SfxTabPage::SfxTabPage(vcl::Window *pParent, const OString& rID, const OUString&
}

SfxTabPage::~SfxTabPage()
/*  [Description]
{
    dispose();
}

    Destructor
*/
void SfxTabPage::dispose()
{
    delete pImpl;
    TabPage::dispose();
}

bool SfxTabPage::FillItemSet( SfxItemSet* rSet )
@@ -363,6 +365,11 @@ SfxTabDialog::SfxTabDialog

SfxTabDialog::~SfxTabDialog()
{
    dispose();
}

void SfxTabDialog::dispose()
{
    SavePosAndId();

    for ( SfxTabDlgData_Impl::const_iterator it = pImpl->aData.begin(); it != pImpl->aData.end(); ++it )
@@ -412,6 +419,7 @@ SfxTabDialog::~SfxTabDialog()
        delete m_pCancelBtn;
    if (m_bOwnsOKBtn)
        delete m_pOKBtn;
    TabDialog::dispose();
}

void SfxTabDialog::Init_Impl(bool bFmtFlag)
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
index c5273b4..b092808 100644
--- a/sfx2/source/dialog/taskpane.cxx
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -202,13 +202,24 @@ namespace sfx2

    TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, vcl::Window* i_pParent, WinBits i_nBits )
        :TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits )
        ,m_aTaskPane( GetContentWindow(), lcl_getFrame( i_pBindings ) )
        ,m_aPaneController( m_aTaskPane, *this )
        ,m_aTaskPane( new ModuleTaskPane(GetContentWindow(), lcl_getFrame( i_pBindings )) )
        ,m_aPaneController( *m_aTaskPane.get(), *this )
    {
        m_aTaskPane.Show();
        m_aTaskPane->Show();
        SetText( SfxResId( SID_TASKPANE ).toString() );
    }

    TaskPaneDockingWindow::~TaskPaneDockingWindow()
    {
        dispose();
    }

    void TaskPaneDockingWindow::dispose()
    {
        m_aTaskPane.disposeAndClear();
        TitledDockingWindow::dispose();
    }


    void TaskPaneDockingWindow::ActivateToolPanel( const OUString& i_rPanelURL )
    {
@@ -219,13 +230,13 @@ namespace sfx2
    void TaskPaneDockingWindow::GetFocus()
    {
        TitledDockingWindow::GetFocus();
        m_aTaskPane.GrabFocus();
        m_aTaskPane->GrabFocus();
    }


    void TaskPaneDockingWindow::onLayoutDone()
    {
        m_aTaskPane.SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() );
        m_aTaskPane->SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() );
    }


@@ -507,9 +518,9 @@ namespace sfx2
            :m_rAntiImpl( i_rAntiImpl )
            ,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) )
            ,m_xFrame( i_rDocumentFrame )
            ,m_aPanelDeck( i_rAntiImpl )
            ,m_aPanelDeck( new ::svt::ToolPanelDeck(i_rAntiImpl) )
        {
            m_aPanelDeck.Show();
            m_aPanelDeck->Show();
            OnResize();
            impl_initFromConfiguration();
        }
@@ -523,7 +534,7 @@ namespace sfx2

        static bool ModuleHasToolPanels( const OUString& i_rModuleIdentifier );

              ::svt::ToolPanelDeck& GetPanelDeck()          { return m_aPanelDeck; }
        ::svt::ToolPanelDeck& GetPanelDeck()          { return *m_aPanelDeck.get(); }

        ::boost::optional< size_t >
                    GetPanelPos( const OUString& i_rResourceURL );
@@ -540,28 +551,28 @@ namespace sfx2
        DECL_LINK( OnActivatePanel, void* );

    private:
        ModuleTaskPane&             m_rAntiImpl;
        const OUString       m_sModuleIdentifier;
        const Reference< XFrame >   m_xFrame;
        ::svt::ToolPanelDeck        m_aPanelDeck;
        ModuleTaskPane&              m_rAntiImpl;
        const OUString               m_sModuleIdentifier;
        const Reference< XFrame >    m_xFrame;
        VclPtr<::svt::ToolPanelDeck> m_aPanelDeck;
    };


    void ModuleTaskPane_Impl::OnResize()
    {
        m_aPanelDeck.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() );
        m_aPanelDeck->SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() );
    }


    void ModuleTaskPane_Impl::OnGetFocus()
    {
        m_aPanelDeck.GrabFocus();
        m_aPanelDeck->GrabFocus();
    }


    IMPL_LINK( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg )
    {
        m_aPanelDeck.ActivatePanel( reinterpret_cast< size_t >( i_pArg ) );
        m_aPanelDeck->ActivatePanel( reinterpret_cast< size_t >( i_pArg ) );
        return 1L;
    }

@@ -595,8 +606,8 @@ namespace sfx2
            ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) );
            ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) );

            size_t nPanelPos = m_aPanelDeck.GetPanelCount();
            nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, nPanelPos );
            size_t nPanelPos = m_aPanelDeck->GetPanelCount();
            nPanelPos = m_aPanelDeck->InsertPanel( pCustomPanel, nPanelPos );

            if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) )
                sFirstVisiblePanelResource = *resource;
@@ -637,9 +648,9 @@ namespace sfx2
    ::boost::optional< size_t > ModuleTaskPane_Impl::GetPanelPos( const OUString& i_rResourceURL )
    {
        ::boost::optional< size_t > aPanelPos;
        for ( size_t i = 0; i < m_aPanelDeck.GetPanelCount(); ++i )
        for ( size_t i = 0; i < m_aPanelDeck->GetPanelCount(); ++i )
        {
            const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i ) );
            const ::svt::PToolPanel pPanel( m_aPanelDeck->GetPanel( i ) );
            const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() );
            if ( !pCustomPanel )
            {
@@ -656,21 +667,20 @@ namespace sfx2
        return aPanelPos;
    }


    void ModuleTaskPane_Impl::SetDrawersLayout()
    {
        const ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() );
        const ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() );
        const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() );
        if ( pDrawerLayouter != NULL )
            // already have the proper layout
            return;
        m_aPanelDeck.SetLayouter( new ::svt::DrawerDeckLayouter( m_aPanelDeck, m_aPanelDeck ) );
        m_aPanelDeck->SetLayouter( new ::svt::DrawerDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get() ) );
    }


    void ModuleTaskPane_Impl::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent )
    {
        ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() );
        ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() );
        ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() );
        if  (   ( pTabLayouter != NULL )
            &&  ( pTabLayouter->GetTabAlignment() == i_eTabAlignment )
@@ -686,7 +696,7 @@ namespace sfx2
            return;
        }

        m_aPanelDeck.SetLayouter( new ::svt::TabDeckLayouter( m_aPanelDeck, m_aPanelDeck, i_eTabAlignment, i_eTabContent ) );
        m_aPanelDeck->SetLayouter( new ::svt::TabDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get(), i_eTabAlignment, i_eTabContent ) );
    }


@@ -700,11 +710,6 @@ namespace sfx2
    }


    ModuleTaskPane::~ModuleTaskPane()
    {
    }


    bool ModuleTaskPane::ModuleHasToolPanels( const Reference< XFrame >& i_rDocumentFrame )
    {
        return ModuleTaskPane_Impl::ModuleHasToolPanels( lcl_identifyModule( i_rDocumentFrame ) );
diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx
index 1f6f993..a1779d6 100644
--- a/sfx2/source/dialog/templateinfodlg.cxx
+++ b/sfx2/source/dialog/templateinfodlg.cxx
@@ -54,7 +54,13 @@ SfxTemplateInfoDlg::SfxTemplateInfoDlg (vcl::Window *pParent)

SfxTemplateInfoDlg::~SfxTemplateInfoDlg()
{
    dispose();
}

void SfxTemplateInfoDlg::dispose()
{
    m_xFrame->dispose();
    ModalDialog::dispose();
}

void SfxTemplateInfoDlg::loadDocument(const OUString &rURL)
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index cc726c4d..c10a822 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -251,8 +251,15 @@ SfxTemplatePanelControl::SfxTemplatePanelControl(SfxBindings* pBindings, vcl::Wi
    SetStyle(GetStyle() & ~WB_DOCKABLE);
}

SfxTemplatePanelControl::~SfxTemplatePanelControl (void)
SfxTemplatePanelControl::~SfxTemplatePanelControl()
{
    dispose();
}

void SfxTemplatePanelControl::dispose()
{
    pImpl.reset();
    DockingWindow::dispose();
}

void SfxTemplatePanelControl::DataChanged( const DataChangedEvent& _rDCEvt )
@@ -539,8 +546,8 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl
    , xModuleManager(frame::ModuleManager::create(::comphelper::getProcessComponentContext()))
    , m_pDeletionWatcher(NULL)

    , aFmtLb(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH)
    , aFilterLb(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
    , aFmtLb( new SfxActionListBox(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH) ),
    , aFilterLb( new ListBox(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP) ),

    , nActFamily(0xffff)
    , nActFilter(0)
@@ -564,13 +571,13 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl
    , m_bWantHierarchical(false)
    , bBindingUpdate(true)
{
    aFmtLb.SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString());
    aFmtLb.SetHelpId( HID_TEMPLATE_FMT );
    aFilterLb.SetHelpId( HID_TEMPLATE_FILTER );
    aFmtLb.SetStyle( aFmtLb.GetStyle() | WB_SORT | WB_HIDESELECTION );
    vcl::Font aFont = aFmtLb.GetFont();
    aFmtLb->SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString());
    aFmtLb->SetHelpId( HID_TEMPLATE_FMT );
    aFilterLb->SetHelpId( HID_TEMPLATE_FILTER );
    aFmtLb->SetStyle( aFmtLb->GetStyle() | WB_SORT | WB_HIDESELECTION );
    vcl::Font aFont = aFmtLb->GetFont();
    aFont.SetWeight( WEIGHT_NORMAL );
    aFmtLb.SetFont( aFont );
    aFmtLb->SetFont( aFont );

    memset(pBoundItems, 0, sizeof(pBoundItems));
    memset(pFamilyState, 0, sizeof(pFamilyState));
@@ -732,15 +739,15 @@ void SfxCommonTemplateDialog_Impl::Initialize()

    Update_Impl();

    aFilterLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FilterSelectHdl ) );
    aFmtLb.SetDoubleClickHdl( LINK( this, SfxCommonTemplateDialog_Impl, ApplyHdl ) );
    aFmtLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FmtSelectHdl ) );
    aFmtLb.SetSelectionMode(MULTIPLE_SELECTION);
    aFilterLb->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FilterSelectHdl ) );
    aFmtLb->SetDoubleClickHdl( LINK( this, SfxCommonTemplateDialog_Impl, ApplyHdl ) );
    aFmtLb->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FmtSelectHdl ) );
    aFmtLb->SetSelectionMode(MULTIPLE_SELECTION);


    aFilterLb.Show();
    aFilterLb->Show();
    if (!bHierarchical)
        aFmtLb.Show();
        aFmtLb->Show();
}

SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl()
@@ -861,19 +868,19 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr)
        bool bSelect = ! rStr.isEmpty();
        if ( bSelect )
        {
            SvTreeListEntry* pEntry = (SvTreeListEntry*)aFmtLb.FirstVisible();
            while ( pEntry && aFmtLb.GetEntryText( pEntry ) != rStr )
                pEntry = (SvTreeListEntry*)aFmtLb.NextVisible( pEntry );
            SvTreeListEntry* pEntry = (SvTreeListEntry*)aFmtLb->FirstVisible();
            while ( pEntry && aFmtLb->GetEntryText( pEntry ) != rStr )
                pEntry = (SvTreeListEntry*)aFmtLb->NextVisible( pEntry );
            if ( !pEntry )
                bSelect = false;
            else
            {
                if (!aFmtLb.IsSelected(pEntry))
                if (!aFmtLb->IsSelected(pEntry))
                {
                    aFmtLb.MakeVisible( pEntry );
                    aFmtLb.SelectAll(false);
                    aFmtLb.Select( pEntry );
                    bWaterDisabled = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? sal_False : sal_True;
                    aFmtLb->MakeVisible( pEntry );
                    aFmtLb->SelectAll(false);
                    aFmtLb->Select( pEntry );
                    bWaterDisabled = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? sal_False : sal_True;
                    FmtSelectHdl( NULL );
                }
            }
@@ -881,7 +888,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr)

        if ( !bSelect )
        {
            aFmtLb.SelectAll( false );
            aFmtLb->SelectAll( false );
            EnableEdit(false);
            EnableHide( false );
            EnableShow( false );
@@ -900,9 +907,9 @@ OUString SfxCommonTemplateDialog_Impl::GetSelectedEntry() const
    }
    else
    {
        SvTreeListEntry* pEntry = aFmtLb.FirstSelected();
        SvTreeListEntry* pEntry = aFmtLb->FirstSelected();
        if ( pEntry )
            aRet = aFmtLb.GetEntryText( pEntry );
            aRet = aFmtLb->GetEntryText( pEntry );
    }
    return aRet;
}
@@ -979,7 +986,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
bool SfxCommonTemplateDialog_Impl::HasSelectedStyle() const
{
    return pTreeBox? pTreeBox->FirstSelected() != 0:
            aFmtLb.GetSelectionCount() != 0;
            aFmtLb->GetSelectionCount() != 0;
}

// internal: Refresh the display
@@ -1020,24 +1027,24 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
        if((nFlags & UPDATE_FAMILY) == UPDATE_FAMILY)   // Update view type list (Hierarchical, All, etc.
        {
            CheckItem(nActFamily, true);    // check Button in Toolbox
            aFilterLb.SetUpdateMode(false);
            aFilterLb.Clear();
            aFilterLb->SetUpdateMode(false);
            aFilterLb->Clear();
            //insert hierarchical at the beginning
            sal_uInt16 nPos = aFilterLb.InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0);
            aFilterLb.SetEntryData( nPos, reinterpret_cast<void*>(SFXSTYLEBIT_ALL) );
            sal_uInt16 nPos = aFilterLb->InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0);
            aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(SFXSTYLEBIT_ALL) );
            const SfxStyleFilter& rFilter = pItem->GetFilterList();
            for( size_t i = 0; i < rFilter.size(); ++i)
            {
                sal_uIntPtr nFilterFlags = rFilter[ i ]->nFlags;
                nPos = aFilterLb.InsertEntry( rFilter[ i ]->aName );
                aFilterLb.SetEntryData( nPos, reinterpret_cast<void*>(nFilterFlags) );
                nPos = aFilterLb->InsertEntry( rFilter[ i ]->aName );
                aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(nFilterFlags) );
            }
            if(nActFilter < aFilterLb.GetEntryCount() - 1)
                aFilterLb.SelectEntryPos(nActFilter + 1);
            if(nActFilter < aFilterLb->GetEntryCount() - 1)
                aFilterLb->SelectEntryPos(nActFilter + 1);
            else
            {
                nActFilter = 0;
                aFilterLb.SelectEntryPos(1);
                aFilterLb->SelectEntryPos(1);
                SfxFilterTupel* pActT = ( nActFilter < rFilter.size() ) ? rFilter[ nActFilter ] : NULL;
                sal_uInt16 nFilterFlags = pActT ? pActT->nFlags : 0;
                pStyleSheetPool->SetSearchMask(eFam, nFilterFlags);
@@ -1046,22 +1053,22 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
            // if the tree view again, select family hierarchy
            if (pTreeBox || m_bWantHierarchical)
            {
                aFilterLb.SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString());
                aFilterLb->SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString());
                EnableHierarchical(true);
            }

            // show maximum 14 entries
            aFilterLb.SetDropDownLineCount( MAX_FILTER_ENTRIES );
            aFilterLb.SetUpdateMode(true);
            aFilterLb->SetDropDownLineCount( MAX_FILTER_ENTRIES );
            aFilterLb->SetUpdateMode(true);
        }
        else
        {
            if (nActFilter < aFilterLb.GetEntryCount() - 1)
                aFilterLb.SelectEntryPos(nActFilter + 1);
            if (nActFilter < aFilterLb->GetEntryCount() - 1)
                aFilterLb->SelectEntryPos(nActFilter + 1);
            else
            {
                nActFilter = 0;
                aFilterLb.SelectEntryPos(1);
                aFilterLb->SelectEntryPos(1);
            }
        }

@@ -1070,7 +1077,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
            EnableItem(SID_STYLE_WATERCAN,false);

            SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
            SvTreeListEntry* pEntry = aFmtLb.First();
            SvTreeListEntry* pEntry = aFmtLb->First();
            std::vector<OUString> aStrings;

            comphelper::string::NaturalStringSorter aSorter(
@@ -1090,22 +1097,22 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
            size_t nCount = aStrings.size();
            size_t nPos = 0;
            while(nPos < nCount && pEntry &&
                  aStrings[nPos] == aFmtLb.GetEntryText(pEntry))
                  aStrings[nPos] == aFmtLb->GetEntryText(pEntry))
            {
                ++nPos;
                pEntry = aFmtLb.Next( pEntry );
                pEntry = aFmtLb->Next( pEntry );
            }

            if( nPos < nCount || pEntry )
            {
                // Fills the display box
                aFmtLb.SetUpdateMode(false);
                aFmtLb.Clear();
                aFmtLb->SetUpdateMode(false);
                aFmtLb->Clear();

                for(nPos = 0; nPos < nCount; ++nPos)
                    aFmtLb.InsertEntry(aStrings[nPos], 0, false, nPos);
                    aFmtLb->InsertEntry(aStrings[nPos], 0, false, nPos);

                aFmtLb.SetUpdateMode(true);
                aFmtLb->SetUpdateMode(true);
            }
            // Selects the current style if any
            SfxTemplateItem *pState = pFamilyState[nActFamily-1];
@@ -1132,7 +1139,7 @@ void SfxCommonTemplateDialog_Impl::SetWaterCanState(const SfxBoolItem *pItem)

    if(!bWaterDisabled)
        //make sure the watercan is only activated when there is (only) one selection
        bWaterDisabled = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? sal_False : sal_True;
        bWaterDisabled = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? sal_False : sal_True;

    if(pItem && !bWaterDisabled)
    {
@@ -1467,7 +1474,7 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl(
    if ( !pItem || aDeleted )
        return false;

    if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb.GetSelectionCount() <= 1) )
    if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb->GetSelectionCount() <= 1) )
    {
        const SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem);
        OSL_ENSURE(pFilterItem, "SfxUINT16Item expected");
@@ -1501,15 +1508,15 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable)
            m_bWantHierarchical = true;
            SaveSelection(); // fdo#61429 store "hierarchical"
            const OUString aSelectEntry( GetSelectedEntry());
            aFmtLb.Hide();
            aFmtLb->Hide();

            pTreeBox = new StyleTreeListBox_Impl(
                    this, WB_HASBUTTONS | WB_HASLINES |
                    WB_BORDER | WB_TABSTOP | WB_HASLINESATROOT |
                    WB_HASBUTTONSATROOT | WB_HIDESELECTION | WB_QUICK_SEARCH );
            pTreeBox->SetFont( aFmtLb.GetFont() );
            pTreeBox->SetFont( aFmtLb->GetFont() );

            pTreeBox->SetPosSizePixel(aFmtLb.GetPosPixel(), aFmtLb.GetSizePixel());
            pTreeBox->SetPosSizePixel(aFmtLb->GetPosPixel(), aFmtLb->GetSizePixel());
            pTreeBox->SetNodeDefaultImages();
            pTreeBox->SetSelectHdl(
                LINK(this, SfxCommonTemplateDialog_Impl, FmtSelectHdl));
@@ -1526,11 +1533,11 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable)
    else
    {
        DELETEZ(pTreeBox);
        aFmtLb.Show();
        aFmtLb->Show();
        // If bHierarchical, then the family can have changed
        // minus one since hierarchical is inserted at the start
        m_bWantHierarchical = false; // before FilterSelect
        FilterSelect(aFilterLb.GetSelectEntryPos() - 1, bHierarchical );
        FilterSelect(aFilterLb->GetSelectEntryPos() - 1, bHierarchical );
        bHierarchical=false;
    }
}
@@ -1717,7 +1724,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, DropHdl, StyleTreeListBox_Impl *, pBox 
void SfxCommonTemplateDialog_Impl::NewHdl(void *)
{
    OUString aEmpty;
    if ( nActFamily != 0xffff && (pTreeBox || aFmtLb.GetSelectionCount() <= 1))
    if ( nActFamily != 0xffff && (pTreeBox || aFmtLb->GetSelectionCount() <= 1))
    {
        vcl::Window* pTmp;
        pTmp = Application::GetDefDialogParent();
@@ -1780,7 +1787,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
        bool bUsedStyle = false;     // one of the selected styles are used in the document?

        std::vector<SvTreeListEntry*> aList;
        SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected();
        SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();
        const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl();

        OUString aMsg = SfxResId(STR_DELETE_STYLE_USED).toString();
@@ -1790,7 +1797,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
        {
            aList.push_back( pEntry );
            // check the style is used or not
            const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry));
            const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry));

            SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( aTemplName, pItem->GetFamily(), SFXSTYLEBIT_ALL );

@@ -1802,7 +1809,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
                bUsedStyle = true;
            }

            pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry);
            pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
        }

        bool aApproved = false;
@@ -1827,7 +1834,8 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)

            for (; it != itEnd; ++it)
            {
                const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb.GetEntryText(*it));
                const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb->GetEntryText(*it));
                PrepareDeleteAction();
                bDontUpdate = true; // To prevent the Treelistbox to shut down while deleting
                Execute_Impl( SID_STYLE_DELETE, aTemplName,
                              OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
@@ -1848,16 +1856,16 @@ void SfxCommonTemplateDialog_Impl::HideHdl(void *)
{
    if ( IsInitialized() && HasSelectedStyle() )
    {
        SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected();
        SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();

        while (pEntry)
        {
            OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry);
            OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry);

            Execute_Impl( SID_STYLE_HIDE, aTemplName,
                          OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );

            pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry);
            pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
        }
    }
}
@@ -1867,16 +1875,16 @@ void SfxCommonTemplateDialog_Impl::ShowHdl(void *)

    if ( IsInitialized() && HasSelectedStyle() )
    {
        SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected();
        SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();

        while (pEntry)
        {
            OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry);
            OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry);

            Execute_Impl( SID_STYLE_SHOW, aTemplName,
                          OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );

            pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry);
            pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
        }
    }
}
@@ -1934,7 +1942,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, ApplyHdl, Control *, pControl )
    if ( IsInitialized() && 0 != pFamilyState[nActFamily-1] &&
         !GetSelectedEntry().isEmpty() )
    {
        sal_uInt16 nModifier = aFmtLb.GetModifier();
        sal_uInt16 nModifier = aFmtLb->GetModifier();
        Execute_Impl(SID_STYLE_APPLY,
                     GetSelectedEntry(), OUString(),
                     ( sal_uInt16 )GetFamilyItem_Impl()->GetFamily(),
@@ -1954,7 +1962,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox
        if ( IsInitialized() &&
             IsCheckedItem(SID_STYLE_WATERCAN) &&
             // only if that region is allowed
             0 != pFamilyState[nActFamily-1] && (pTreeBox || aFmtLb.GetSelectionCount() <= 1) )
             0 != pFamilyState[nActFamily-1] && (pTreeBox || aFmtLb->GetSelectionCount() <= 1) )
        {
            OUString aEmpty;
            Execute_Impl(SID_STYLE_WATERCAN,
@@ -1970,7 +1978,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox
    {
        SelectStyle( pListBox->GetEntryText( pListBox->GetHdlEntry() ));
#if defined STYLESPREVIEW
        sal_uInt16 nModifier = aFmtLb.GetModifier();
        sal_uInt16 nModifier = aFmtLb->GetModifier();
        if ( mbIgnoreSelect )
        {
            Execute_Impl(SID_STYLE_END_PREVIEW,
@@ -2025,10 +2033,10 @@ void SfxCommonTemplateDialog_Impl::EnableExample_Impl(sal_uInt16 nId, bool bEnab
{
    if( nId == SID_STYLE_NEW_BY_EXAMPLE )
    {
        bNewByExampleDisabled = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? !bEnable : sal_True;
        bNewByExampleDisabled = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? !bEnable : sal_True;
    }
    else if( nId == SID_STYLE_UPDATE_BY_EXAMPLE )
        bUpdateByExampleDisabled = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? !bEnable : sal_True;
        bUpdateByExampleDisabled = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? !bEnable : sal_True;

    EnableItem(nId, bEnable);
}
@@ -2057,8 +2065,8 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(
    : SfxCommonTemplateDialog_Impl( pB, pDlgWindow, true ),
      m_pFloat          ( pDlgWindow ),
      m_bZoomIn         ( false ),
      m_aActionTbL        ( pDlgWindow, this ),
      m_aActionTbR      ( pDlgWindow, SfxResId( TB_ACTION ) )
      m_aActionTbL      ( new DropToolBox_Impl(pDlgWindow, this) ),
      m_aActionTbR      ( new ToolBox(pDlgWindow, SfxResId( TB_ACTION )) )
{
    pDlgWindow->FreeResource();
    Initialize();
@@ -2068,20 +2076,20 @@ void SfxTemplateDialog_Impl::Initialize (void)
{
    SfxCommonTemplateDialog_Impl::Initialize();

    m_aActionTbL.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect));
    m_aActionTbR.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect));
    m_aActionTbR.SetDropdownClickHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRClick));
    m_aActionTbL.Show();
    m_aActionTbR.Show();
    vcl::Font aFont = aFilterLb.GetFont();
    m_aActionTbL->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect));
    m_aActionTbR->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect));
    m_aActionTbR->SetDropdownClickHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRClick));
    m_aActionTbL->Show();
    m_aActionTbR->Show();
    vcl::Font aFont = aFilterLb->GetFont();
    aFont.SetWeight( WEIGHT_NORMAL );
    aFilterLb.SetFont( aFont );
    m_aActionTbL.SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT );
    aFilterLb->SetFont( aFont );
    m_aActionTbL->SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT );
}

void SfxTemplateDialog_Impl::EnableFamilyItem( sal_uInt16 nId, bool bEnable )
{
    m_aActionTbL.EnableItem( nId, bEnable );
    m_aActionTbL->EnableItem( nId, bEnable );
}

// Insert element into dropdown filter "Frame Styles", "List Styles", etc.
@@ -2097,15 +2105,15 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId,const SfxStyleFamil
        case SFX_STYLE_FAMILY_PSEUDO:   sHelpId = ".uno:ListStyle"; break;
        default: OSL_FAIL("unknown StyleFamily"); break;
    }
    m_aActionTbL.InsertItem( nId, pItem->GetImage(), pItem->GetText(), ToolBoxItemBits::NONE, 0);
    m_aActionTbL.SetHelpId( nId, sHelpId );
    m_aActionTbL->InsertItem( nId, pItem->GetImage(), pItem->GetText(), ToolBoxItemBits::NONE, 0);
    m_aActionTbL->SetHelpId( nId, sHelpId );
}

void SfxTemplateDialog_Impl::ReplaceUpdateButtonByMenu()
{
    m_aActionTbR.HideItem(SID_STYLE_UPDATE_BY_EXAMPLE);
    m_aActionTbR.SetItemBits( SID_STYLE_NEW_BY_EXAMPLE,
            ToolBoxItemBits::DROPDOWNONLY|m_aActionTbR.GetItemBits( SID_STYLE_NEW_BY_EXAMPLE ));
    m_aActionTbR->HideItem(SID_STYLE_UPDATE_BY_EXAMPLE);
    m_aActionTbR->SetItemBits( SID_STYLE_NEW_BY_EXAMPLE,
            ToolBoxItemBits::DROPDOWNONLY|m_aActionTbR->GetItemBits( SID_STYLE_NEW_BY_EXAMPLE ));
}

void SfxTemplateDialog_Impl::updateFamilyImages()
@@ -2123,18 +2131,18 @@ void SfxTemplateDialog_Impl::updateFamilyImages()
    {
        const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nLoop );
        sal_uInt16 nId = SfxTemplate::SfxFamilyIdToNId( pItem->GetFamily() );
        m_aActionTbL.SetItemImage( nId, pItem->GetImage() );
        m_aActionTbL->SetItemImage( nId, pItem->GetImage() );
    }
}

void SfxTemplateDialog_Impl::updateNonFamilyImages()
{
    m_aActionTbR.SetImageList( ImageList( SfxResId( DLG_STYLE_DESIGNER ) ) );
    m_aActionTbR->SetImageList( ImageList( SfxResId( DLG_STYLE_DESIGNER ) ) );
}

void SfxTemplateDialog_Impl::ClearFamilyList()
{
    m_aActionTbL.Clear();
    m_aActionTbL->Clear();
}

void SfxCommonTemplateDialog_Impl::InvalidateBindings()
@@ -2177,27 +2185,27 @@ void SfxTemplateDialog_Impl::Resize()
    if (m_pFloat == NULL)
        return;
    Size aDlgSize=m_pFloat->PixelToLogic(m_pFloat->GetOutputSizePixel());
    Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel());
    Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel());
    Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL->CalcWindowSizePixel());
    Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR->CalcWindowSizePixel());
    Size aMinSize = GetMinOutputSizePixel();

    long nListHeight = m_pFloat->PixelToLogic( aFilterLb.GetSizePixel() ).Height();
    long nListHeight = m_pFloat->PixelToLogic( aFilterLb->GetSizePixel() ).Height();
    long nWidth = aDlgSize.Width()- 2 * SFX_TEMPLDLG_HFRAME;

    m_aActionTbL.SetPosSizePixel(m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,SFX_TEMPLDLG_VTOPFRAME)),
    m_aActionTbL->SetPosSizePixel(m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,SFX_TEMPLDLG_VTOPFRAME)),
                                 m_pFloat->LogicToPixel(aSizeATL));

    // only change the position of the right toolbox, when the window is wide
    // enough
    Point aPosATR(aDlgSize.Width()-SFX_TEMPLDLG_HFRAME-aSizeATR.Width(),SFX_TEMPLDLG_VTOPFRAME);
    if(aDlgSize.Width() >= aMinSize.Width())
        m_aActionTbR.SetPosPixel(m_pFloat->LogicToPixel(aPosATR));
        m_aActionTbR->SetPosPixel(m_pFloat->LogicToPixel(aPosATR));
    else
        m_aActionTbR.SetPosPixel( m_pFloat->LogicToPixel(
        m_aActionTbR->SetPosPixel( m_pFloat->LogicToPixel(
            Point( SFX_TEMPLDLG_HFRAME + aSizeATL.Width() + SFX_TEMPLDLG_MIDHSPACE,
                   SFX_TEMPLDLG_VTOPFRAME ) ) );

    m_aActionTbR.SetSizePixel(m_pFloat->LogicToPixel(aSizeATR));
    m_aActionTbR->SetSizePixel(m_pFloat->LogicToPixel(aSizeATR));

    Point aFilterPos(
        m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,
@@ -2218,16 +2226,16 @@ void SfxTemplateDialog_Impl::Resize()
    // only change the position of the listbox, when the window is high enough
    if(aDlgSize.Height() >= aMinSize.Height())
    {
        aFilterLb.SetPosPixel(aFilterPos);
        aFmtLb.SetPosPixel( aFmtPos );
        aFilterLb->SetPosPixel(aFilterPos);
        aFmtLb->SetPosPixel( aFmtPos );
        if(pTreeBox)
            pTreeBox->SetPosPixel(aFmtPos);
    }
    else
        aFmtSize.Height() += aFilterSize.Height();

    aFilterLb.SetSizePixel(aFilterSize);
    aFmtLb.SetSizePixel( aFmtSize );
    aFilterLb->SetSizePixel(aFilterSize);
    aFmtLb->SetSizePixel( aFmtSize );
    if(pTreeBox)
        pTreeBox->SetSizePixel(aFmtSize);
}
@@ -2236,8 +2244,8 @@ Size SfxTemplateDialog_Impl::GetMinOutputSizePixel()
{
    if (m_pFloat != NULL)
    {
        Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel());
        Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel());
        Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL->CalcWindowSizePixel());
        Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR->CalcWindowSizePixel());
        Size aMinSize=Size(
            aSizeATL.Width()+aSizeATR.Width()+
                2*SFX_TEMPLDLG_HFRAME + SFX_TEMPLDLG_MIDHSPACE,
@@ -2259,7 +2267,7 @@ void SfxTemplateDialog_Impl::EnableItem(sal_uInt16 nMesId, bool bCheck)
            //fall-through
        case SID_STYLE_NEW_BY_EXAMPLE:
        case SID_STYLE_UPDATE_BY_EXAMPLE:
            m_aActionTbR.EnableItem(nMesId,bCheck);
            m_aActionTbR->EnableItem(nMesId,bCheck);
            break;
    }
}
@@ -2270,10 +2278,10 @@ void SfxTemplateDialog_Impl::CheckItem(sal_uInt16 nMesId, bool bCheck)
    {
        case SID_STYLE_WATERCAN :
            bIsWater=bCheck;
            m_aActionTbR.CheckItem(SID_STYLE_WATERCAN,bCheck);
            m_aActionTbR->CheckItem(SID_STYLE_WATERCAN,bCheck);
            break;
        default:
            m_aActionTbL.CheckItem(nMesId,bCheck); break;
            m_aActionTbL->CheckItem(nMesId,bCheck); break;
    }
}

@@ -2282,9 +2290,9 @@ bool SfxTemplateDialog_Impl::IsCheckedItem(sal_uInt16 nMesId)
    switch(nMesId)
    {
        case SID_STYLE_WATERCAN :
            return m_aActionTbR.GetItemState(SID_STYLE_WATERCAN)==TRISTATE_TRUE;
            return m_aActionTbR->GetItemState(SID_STYLE_WATERCAN)==TRISTATE_TRUE;
        default:
            return m_aActionTbL.GetItemState(nMesId)==TRISTATE_TRUE;
            return m_aActionTbL->GetItemState(nMesId)==TRISTATE_TRUE;
    }
}

@@ -2413,7 +2421,7 @@ void SfxCommonTemplateDialog_Impl::UpdateFamily_Impl()
    }

    bWaterDisabled = false;
    bCanNew = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? sal_True : sal_False;
    bCanNew = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? sal_True : sal_False;
    bTreeDrag = true;
    bUpdateByExampleDisabled = false;

@@ -2449,10 +2457,6 @@ DropToolBox_Impl::DropToolBox_Impl(vcl::Window* pParent, SfxTemplateDialog_Impl*
{
}

DropToolBox_Impl::~DropToolBox_Impl()
{
}

sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )
{
    sal_Int8 nReturn = DND_ACTION_NONE;
@@ -2475,7 +2479,7 @@ sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )

sal_Int8 DropToolBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
     return rParent.aFmtLb.ExecuteDrop(rEvt);
     return rParent.aFmtLb->ExecuteDrop(rEvt);
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx
index 66aa91b..5f2a99f 100644
--- a/sfx2/source/dialog/titledockwin.cxx
+++ b/sfx2/source/dialog/titledockwin.cxx
@@ -35,8 +35,8 @@ namespace sfx2
            WinBits i_nStyle )
        :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_nStyle )
        ,m_sTitle()
        ,m_aToolbox( this )
        ,m_aContentWindow( this, WB_DIALOGCONTROL )
        ,m_aToolbox( new ToolBox(this) )
        ,m_aContentWindow( new vcl::Window(this, WB_DIALOGCONTROL) )
        ,m_aBorder( 3, 1, 3, 3 )
        ,m_bLayoutPending( false )
        ,m_nTitleBarHeight(0)
@@ -48,19 +48,26 @@ namespace sfx2
    {
        SetBackground( Wallpaper() );

        m_aToolbox.SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) );
        m_aToolbox.SetOutStyle( TOOLBOX_STYLE_FLAT );
        m_aToolbox.SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) );
        m_aToolbox.Show();
        m_aToolbox->SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) );
        m_aToolbox->SetOutStyle( TOOLBOX_STYLE_FLAT );
        m_aToolbox->SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) );
        m_aToolbox->Show();
        impl_resetToolBox();

        m_aContentWindow.Show();
        m_aContentWindow->Show();
    }

    TitledDockingWindow::~TitledDockingWindow()
    {
        dispose();
    }

    void TitledDockingWindow::dispose()
    {
        m_aToolbox.disposeAndClear();
        m_aContentWindow.disposeAndClear();
        SfxDockingWindow::dispose();
    }

    void TitledDockingWindow::SetTitle( const OUString& i_rTitle )
    {
@@ -101,16 +108,16 @@ namespace sfx2
    {
        m_bLayoutPending = false;

        m_aToolbox.ShowItem( 1, !IsFloatingMode() );
        m_aToolbox->ShowItem( 1, !IsFloatingMode() );

        const Size aToolBoxSize( m_aToolbox.CalcWindowSizePixel() );
        const Size aToolBoxSize( m_aToolbox->CalcWindowSizePixel() );
        Size aWindowSize( GetOutputSizePixel() );

        // position the tool box
        m_nTitleBarHeight = GetSettings().GetStyleSettings().GetTitleHeight();
        if ( aToolBoxSize.Height() > m_nTitleBarHeight )
            m_nTitleBarHeight = aToolBoxSize.Height();
        m_aToolbox.SetPosSizePixel(
        m_aToolbox->SetPosSizePixel(
            Point(
                aWindowSize.Width() - aToolBoxSize.Width(),
                ( m_nTitleBarHeight - aToolBoxSize.Height() ) / 2
@@ -122,7 +129,7 @@ namespace sfx2
        if ( m_nTitleBarHeight < aToolBoxSize.Height() )
            m_nTitleBarHeight = aToolBoxSize.Height();
        aWindowSize.Height() -= m_nTitleBarHeight;
        m_aContentWindow.SetPosSizePixel(
        m_aContentWindow->SetPosSizePixel(
            Point( m_aBorder.Left(), m_nTitleBarHeight + m_aBorder.Top() ),
            Size(
                aWindowSize.Width() - m_aBorder.Left() - m_aBorder.Right(),
@@ -209,24 +216,24 @@ namespace sfx2

    void TitledDockingWindow::impl_resetToolBox()
    {
        m_aToolbox.Clear();
        m_aToolbox->Clear();

        // Get the closer bitmap and set it as right most button.
        Image aImage( SfxResId( SFX_IMG_CLOSE_DOC ) );
        m_aToolbox.InsertItem( 1, aImage );
        m_aToolbox.ShowItem( 1 );
        m_aToolbox->InsertItem( 1, aImage );
        m_aToolbox->ShowItem( 1 );
    }


    sal_uInt16 TitledDockingWindow::impl_addDropDownToolBoxItem( const OUString& i_rItemText, const OString& i_nHelpId, const Link& i_rCallback )
    {
        // Add the menu before the closer button.
        const sal_uInt16 nItemCount( m_aToolbox.GetItemCount() );
        const sal_uInt16 nItemCount( m_aToolbox->GetItemCount() );
        const sal_uInt16 nItemId( nItemCount + 1 );
        m_aToolbox.InsertItem( nItemId, i_rItemText, ToolBoxItemBits::DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND );
        m_aToolbox.SetHelpId( nItemId, i_nHelpId );
        m_aToolbox.SetClickHdl( i_rCallback );
        m_aToolbox.SetDropdownClickHdl( i_rCallback );
        m_aToolbox->InsertItem( nItemId, i_rItemText, ToolBoxItemBits::DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND );
        m_aToolbox->SetHelpId( nItemId, i_nHelpId );
        m_aToolbox->SetClickHdl( i_rCallback );
        m_aToolbox->SetDropdownClickHdl( i_rCallback );

        // The tool box has likely changed its size. The title bar has to be
        // resized.
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index 403f581..797c893 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -329,8 +329,14 @@ void SfxVersionDialog::Init_Impl()

SfxVersionDialog::~SfxVersionDialog()
{
    dispose();
}

void SfxVersionDialog::dispose()
{
    delete m_pTable;
    delete m_pVersionBox;
    SfxModalDialog::dispose();
}

void SfxVersionDialog::Open_Impl()
@@ -557,8 +563,14 @@ SfxCmisVersionsDialog::SfxCmisVersionsDialog ( SfxViewFrame* pVwFrame, bool bIsS

SfxCmisVersionsDialog::~SfxCmisVersionsDialog()
{
    dispose();
}

void SfxCmisVersionsDialog::dispose()
{
    delete m_pTable;
    delete m_pVersionBox;
    SfxModalDialog::dispose();
}

void SfxCmisVersionsDialog::LoadVersions()
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 346dd0d..629a6ef 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -138,7 +138,8 @@ class WaitWindow_Impl : public WorkWindow

    public:
                     WaitWindow_Impl();
                    virtual ~WaitWindow_Impl();
    virtual          ~WaitWindow_Impl();
    virtual void     dispose() SAL_OVERRIDE;
    virtual void     Paint( const Rectangle& rRect ) SAL_OVERRIDE;
};

@@ -2449,7 +2450,13 @@ WaitWindow_Impl::WaitWindow_Impl()

WaitWindow_Impl::~WaitWindow_Impl()
{
    dispose();
}

void  WaitWindow_Impl::dispose()
{
    Hide();
    WorkWindow::dispose();
}


diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx
index e62676b..e120cf2 100644
--- a/sfx2/source/doc/new.cxx
+++ b/sfx2/source/doc/new.cxx
@@ -454,7 +454,13 @@ SfxNewFileDialog::SfxNewFileDialog(vcl::Window *pParent, sal_uInt16 nFlags)

SfxNewFileDialog::~SfxNewFileDialog()
{
    dispose();
}

void SfxNewFileDialog::dispose()
{
    delete pImpl;
    SfxModalDialog::dispose();
}

bool SfxNewFileDialog::IsTemplate() const
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index fee3db0..3d40de2 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -296,7 +296,12 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent)
    mpLocalView->Show();
}

SfxTemplateManagerDlg::~SfxTemplateManagerDlg ()
SfxTemplateManagerDlg::~SfxTemplateManagerDlg()
{
    dispose();
}

void SfxTemplateManagerDlg::dispose()
{
    writeSettings();

@@ -316,6 +321,7 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg ()

    mpSearchView->setItemStateHdl(Link());
    mpSearchView->setOpenTemplateHdl(Link());
    ModalDialog::dispose();
}

void SfxTemplateManagerDlg::setSaveMode()
diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx
index 8609f68..a21473d 100644
--- a/sfx2/source/inc/alienwarn.hxx
+++ b/sfx2/source/inc/alienwarn.hxx
@@ -31,6 +31,7 @@ private:
public:
    SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName);
    virtual ~SfxAlienWarningDialog();
    virtual void dispose() SAL_OVERRIDE;
};

#endif // INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX
diff --git a/sfx2/source/inc/partwnd.hxx b/sfx2/source/inc/partwnd.hxx
index a065593..b81a88f 100644
--- a/sfx2/source/inc/partwnd.hxx
+++ b/sfx2/source/inc/partwnd.hxx
@@ -69,7 +69,6 @@ public:
                                  vcl::Window* pParent,
                                  WinBits nBits );

                            virtual ~SfxPartDockWnd_Impl();
    bool                    QueryClose();
    virtual void            FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE;
    ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > ForgetFrame();
diff --git a/sfx2/source/inc/recfloat.hxx b/sfx2/source/inc/recfloat.hxx
index 06fc314..df32b12 100644
--- a/sfx2/source/inc/recfloat.hxx
+++ b/sfx2/source/inc/recfloat.hxx
@@ -46,6 +46,7 @@ public:
                            SfxChildWindow* pChildWin ,
                            vcl::Window* pParent );
    virtual             ~SfxRecordingFloat_Impl();
    virtual void        dispose() SAL_OVERRIDE;
    virtual bool        Close() SAL_OVERRIDE;
    virtual void        FillInfo( SfxChildWinInfo& rInfo ) const SAL_OVERRIDE;
    virtual void        StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/sfx2/source/inc/splitwin.hxx b/sfx2/source/inc/splitwin.hxx
index 1a332e8..9dfa27d 100644
--- a/sfx2/source/inc/splitwin.hxx
+++ b/sfx2/source/inc/splitwin.hxx
@@ -79,6 +79,7 @@ public:
                            WinBits nBits = WB_BORDER | WB_SIZEABLE | WB_3DLOOK );

                        virtual ~SfxSplitWindow();
    virtual void        dispose() SAL_OVERRIDE;

    void                ReleaseWindow_Impl(SfxDockingWindow *pWin, bool bSaveConfig=true);

diff --git a/sfx2/source/inc/templatesearchview.hxx b/sfx2/source/inc/templatesearchview.hxx
index 2845c40..e49ef3f 100644
--- a/sfx2/source/inc/templatesearchview.hxx
+++ b/sfx2/source/inc/templatesearchview.hxx
@@ -18,8 +18,6 @@ public:

    TemplateSearchView ( vcl::Window* pParent, WinBits nWinStyle = WB_TABSTOP | WB_VSCROLL);

    virtual ~TemplateSearchView();

    void setOpenTemplateHdl (const Link &rLink);

    void AppendItem(sal_uInt16 nAssocItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx,
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index a983a7f..f50de2e 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -182,8 +182,8 @@ protected:
    css::uno::Reference<css::frame::XModuleManager2> xModuleManager;
    DeletionWatcher* m_pDeletionWatcher;

    SfxActionListBox aFmtLb;
    ListBox aFilterLb;
    VclPtr<SfxActionListBox> aFmtLb;
    VclPtr<ListBox> aFilterLb;
    Size aSize;

    sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
@@ -360,7 +360,6 @@ protected:
    virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
public:
    DropToolBox_Impl(vcl::Window* pParent, SfxTemplateDialog_Impl* pTemplateDialog);
    virtual ~DropToolBox_Impl();
};

class SfxTemplateDialog_Impl :  public SfxCommonTemplateDialog_Impl
@@ -370,10 +369,10 @@ private:
    friend class DropToolBox_Impl;
    friend class SfxTemplatePanelControl;

    vcl::Window* m_pFloat;
    bool m_bZoomIn;
    DropToolBox_Impl m_aActionTbL;
    ToolBox m_aActionTbR;
    vcl::Window*        m_pFloat;
    bool                m_bZoomIn;
    VclPtr<DropToolBox_Impl>    m_aActionTbL;
    VclPtr<ToolBox>     m_aActionTbR;

    DECL_LINK( ToolBoxLSelect, ToolBox* );
    DECL_LINK( ToolBoxRSelect, ToolBox* );
diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx
index 3204e2d..0079e0f 100644
--- a/sfx2/source/inc/versdlg.hxx
+++ b/sfx2/source/inc/versdlg.hxx
@@ -66,6 +66,7 @@ class SfxVersionDialog : public SfxModalDialog
public:
                                SfxVersionDialog ( SfxViewFrame* pFrame, bool );
    virtual                     ~SfxVersionDialog ();
    virtual void                dispose() SAL_OVERRIDE;
    bool                        IsSaveVersionOnClose() const { return m_bIsSaveVersionOnClose; }
};

@@ -104,6 +105,7 @@ class SfxCmisVersionsDialog : public SfxModalDialog
public:
                                SfxCmisVersionsDialog ( SfxViewFrame* pFrame, bool );
    virtual                     ~SfxCmisVersionsDialog ();
    virtual void                dispose() SAL_OVERRIDE;
};

#endif
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 1013f9d..cbc5de7 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -73,7 +73,12 @@ Deck::Deck (
#endif
}

Deck::~Deck (void)
Deck::~Deck()
{
    dispose();
}

void Deck::dispose()
{
    Dispose();

@@ -81,6 +86,7 @@ Deck::~Deck (void)
    // Otherwise that is done by one of our base class destructors
    // without updating maPanels.
    maPanels.clear();
    vcl::Window::dispose();
}

void Deck::Dispose (void)
@@ -323,10 +329,6 @@ Deck::ScrollContainerWindow::ScrollContainerWindow (vcl::Window* pParentWindow)
#endif
}

Deck::ScrollContainerWindow::~ScrollContainerWindow (void)
{
}

void Deck::ScrollContainerWindow::Paint (const Rectangle& rUpdateArea)
{
    (void)rUpdateArea;
diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx
index 215bb3b..93623fc 100644
--- a/sfx2/source/sidebar/Deck.hxx
+++ b/sfx2/source/sidebar/Deck.hxx
@@ -47,6 +47,7 @@ public:
        vcl::Window* pParentWindow,
        const ::boost::function<void(void)>& rCloserAction);
    virtual ~Deck (void);
    virtual void dispose() SAL_OVERRIDE;

    void Dispose (void);

@@ -77,7 +78,6 @@ public:
    {
    public:
        ScrollContainerWindow (vcl::Window* pParentWindow);
        virtual ~ScrollContainerWindow (void);
        virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
        void SetSeparators (const ::std::vector<sal_Int32>& rSeparators);
    private:
diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx
index 0294ce9..ac7393d 100644
--- a/sfx2/source/sidebar/DeckTitleBar.cxx
+++ b/sfx2/source/sidebar/DeckTitleBar.cxx
@@ -52,10 +52,6 @@ DeckTitleBar::DeckTitleBar (
#endif
}

DeckTitleBar::~DeckTitleBar (void)
{
}

void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible)
{
    if (mbIsCloserVisible != bIsCloserVisible)
@@ -64,16 +60,16 @@ void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible)

        if (mbIsCloserVisible)
        {
            maToolBox.InsertItem(
            maToolBox->InsertItem(
                mnCloserItemIndex,
                Theme::GetImage(Theme::Image_Closer));
            maToolBox.SetQuickHelpText(
            maToolBox->SetQuickHelpText(
                mnCloserItemIndex,
                SFX2_RESSTR(SFX_STR_SIDEBAR_CLOSE_DECK));
        }
        else
            maToolBox.RemoveItem(
                maToolBox.GetItemPos(mnCloserItemIndex));
            maToolBox->RemoveItem(
                maToolBox->GetItemPos(mnCloserItemIndex));
    }
}

@@ -119,7 +115,7 @@ css::uno::Reference<css::accessibility::XAccessible> DeckTitleBar::CreateAccessi

void DeckTitleBar::DataChanged (const DataChangedEvent& rEvent)
{
    maToolBox.SetItemImage(
    maToolBox->SetItemImage(
        mnCloserItemIndex,
        Theme::GetImage(Theme::Image_Closer));
    TitleBar::DataChanged(rEvent);
diff --git a/sfx2/source/sidebar/DeckTitleBar.hxx b/sfx2/source/sidebar/DeckTitleBar.hxx
index 5f163ca..9cb100f 100644
--- a/sfx2/source/sidebar/DeckTitleBar.hxx
+++ b/sfx2/source/sidebar/DeckTitleBar.hxx
@@ -33,7 +33,6 @@ public:
        const ::rtl::OUString& rsTitle,
        vcl::Window* pParentWindow,
        const ::boost::function<void(void)>& rCloserAction);
    virtual ~DeckTitleBar (void);

    void SetCloserVisible (const bool bIsCloserVisible);

diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx
index 36d5a4c..c0e1311 100644
--- a/sfx2/source/sidebar/MenuButton.cxx
+++ b/sfx2/source/sidebar/MenuButton.cxx
@@ -39,10 +39,6 @@ MenuButton::MenuButton (vcl::Window* pParentWindow)
#endif
}

MenuButton::~MenuButton (void)
{
}

void MenuButton::Paint (const Rectangle& rUpdateArea)
{
    switch(mePaintType)
diff --git a/sfx2/source/sidebar/MenuButton.hxx b/sfx2/source/sidebar/MenuButton.hxx
index 1be374e..1d09e14 100644
--- a/sfx2/source/sidebar/MenuButton.hxx
+++ b/sfx2/source/sidebar/MenuButton.hxx
@@ -28,7 +28,6 @@ class MenuButton
{
public:
    MenuButton (vcl::Window* pParentWindow);
    virtual ~MenuButton (void);

    virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
    virtual void MouseMove (const MouseEvent& rEvent) SAL_OVERRIDE;
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index f7666e7..456642f 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -69,9 +69,15 @@ Panel::Panel (
#endif
}

Panel::~Panel (void)
Panel::~Panel()
{
    dispose();
}

void Panel::dispose()
{
    Dispose();
    vcl::Window::dispose();
}

void Panel::Dispose (void)
diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx
index 219943c..dd06ddf 100644
--- a/sfx2/source/sidebar/Panel.hxx
+++ b/sfx2/source/sidebar/Panel.hxx
@@ -47,6 +47,7 @@ public:
        const ::boost::function<void(void)>& rDeckLayoutTrigger,
        const ::boost::function<Context(void)>& rContextAccess);
    virtual ~Panel (void);
    virtual void dispose() SAL_OVERRIDE;

    void Dispose (void);

diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index 5437c53..0f840e3 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -58,10 +58,6 @@ PanelTitleBar::PanelTitleBar (
#endif
}

PanelTitleBar::~PanelTitleBar (void)
{
}

void PanelTitleBar::SetMoreOptionsCommand (
    const ::rtl::OUString& rsCommandName,
    const css::uno::Reference<css::frame::XFrame>& rxFrame)
@@ -69,27 +65,27 @@ void PanelTitleBar::SetMoreOptionsCommand (
    if ( ! rsCommandName.equals(msMoreOptionsCommand))
    {
        if (msMoreOptionsCommand.getLength() > 0)
            maToolBox.RemoveItem(maToolBox.GetItemPos(mnMenuItemIndex));
            maToolBox->RemoveItem(maToolBox->GetItemPos(mnMenuItemIndex));

        msMoreOptionsCommand = rsCommandName;
        mxFrame = rxFrame;

        if (msMoreOptionsCommand.getLength() > 0)
        {
            maToolBox.InsertItem(
            maToolBox->InsertItem(
                mnMenuItemIndex,
                Theme::GetImage(Theme::Image_PanelMenu));
            Reference<frame::XToolbarController> xController (
                ControllerFactory::CreateToolBoxController(
                    &maToolBox,
                    maToolBox.get(),
                    mnMenuItemIndex,
                    msMoreOptionsCommand,
                    rxFrame,
                    VCLUnoHelper::GetInterface(&maToolBox),
                    VCLUnoHelper::GetInterface(maToolBox.get()),
                    0));
            maToolBox.SetController(mnMenuItemIndex, xController, msMoreOptionsCommand);
            maToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT);
            maToolBox.SetQuickHelpText(
            maToolBox->SetController(mnMenuItemIndex, xController, msMoreOptionsCommand);
            maToolBox->SetOutStyle(TOOLBOX_STYLE_FLAT);
            maToolBox->SetQuickHelpText(
                mnMenuItemIndex,
                SFX2_RESSTR(SFX_STR_SIDEBAR_MORE_OPTIONS));
        }
@@ -198,7 +194,7 @@ void PanelTitleBar::MouseButtonUp (const MouseEvent& rMouseEvent)

void PanelTitleBar::DataChanged (const DataChangedEvent& rEvent)
{
    maToolBox.SetItemImage(
    maToolBox->SetItemImage(
        mnMenuItemIndex,
        Theme::GetImage(Theme::Image_PanelMenu));
    TitleBar::DataChanged(rEvent);
diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx
index 51af11d..1fc3eb3 100644
--- a/sfx2/source/sidebar/PanelTitleBar.hxx
+++ b/sfx2/source/sidebar/PanelTitleBar.hxx
@@ -36,7 +36,6 @@ public:
        const ::rtl::OUString& rsTitle,
        vcl::Window* pParentWindow,
        Panel* pPanel );
    virtual ~PanelTitleBar (void);

    void SetMoreOptionsCommand (
        const ::rtl::OUString& rsCommandName,
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 5ccf6fe..047b218 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -53,7 +53,13 @@ SidebarDockingWindow::SidebarDockingWindow(

SidebarDockingWindow::~SidebarDockingWindow (void)
{
    dispose();
}

void SidebarDockingWindow::dispose()
{
    DoDispose();
    SfxDockingWindow::dispose();
}

void SidebarDockingWindow::DoDispose (void)
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/sfx2/source/sidebar/SidebarDockingWindow.hxx
index c154226..64f606f6 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.hxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.hxx
@@ -39,6 +39,7 @@ public:
        vcl::Window* pParent,
        WinBits nBits);
    virtual ~SidebarDockingWindow (void);
    virtual void dispose() SAL_OVERRIDE;

    virtual bool Close (void) SAL_OVERRIDE;

diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index 023919f..f5a7643 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -55,7 +55,12 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSidebarToolBox(vcl::Wi
    return new SidebarToolBox(pParent);
}

SidebarToolBox::~SidebarToolBox (void)
SidebarToolBox::~SidebarToolBox()
{
    dispose();
}

void SidebarToolBox::dispose()
{
    ControllerContainer aControllers;
    aControllers.swap(maControllers);
@@ -77,6 +82,7 @@ SidebarToolBox::~SidebarToolBox (void)
        SetActivateHdl(Link());
        SetDeactivateHdl(Link());
    }
    ToolBox::dispose();
}

void SidebarToolBox::InsertItem(const OUString& rCommand,
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index d5196da..eff5d6e 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -62,8 +62,14 @@ TabBar::TabBar (
#endif
}

TabBar::~TabBar (void)
TabBar::~TabBar()
{
    dispose();
}

void TabBar::dispose()
{
    vcl::Window::dispose();
}

void TabBar::Paint (const Rectangle& rUpdateArea)
diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx
index 9777274..47436dc 100644
--- a/sfx2/source/sidebar/TabBar.hxx
+++ b/sfx2/source/sidebar/TabBar.hxx
@@ -68,6 +68,7 @@ public:
        const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor,
        const PopupMenuProvider& rPopupMenuProvider);
    virtual ~TabBar (void);
    virtual void dispose() SAL_OVERRIDE;

    virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
    virtual void DataChanged (const DataChangedEvent& rDataChangedEvent) SAL_OVERRIDE;
diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx
index ec763a0..678e1f0 100644
--- a/sfx2/source/sidebar/TabItem.cxx
+++ b/sfx2/source/sidebar/TabItem.cxx
@@ -42,10 +42,6 @@ TabItem::TabItem (vcl::Window* pParentWindow)
#endif
}

TabItem::~TabItem (void)
{
}

void TabItem::Paint (const Rectangle& rUpdateArea)
{
    switch(mePaintType)
diff --git a/sfx2/source/sidebar/TabItem.hxx b/sfx2/source/sidebar/TabItem.hxx
index 4d95211..818a38b 100644
--- a/sfx2/source/sidebar/TabItem.hxx
+++ b/sfx2/source/sidebar/TabItem.hxx
@@ -34,7 +34,6 @@ class TabItem
{
public:
    TabItem (vcl::Window* pParentWindow);
    virtual ~TabItem (void);

    virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
    virtual void MouseMove (const MouseEvent& rEvent) SAL_OVERRIDE;
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index fa9b8c2..0e0e495 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -41,17 +41,24 @@ TitleBar::TitleBar (
    vcl::Window* pParentWindow,
    const sidebar::Paint& rInitialBackgroundPaint)
    : Window(pParentWindow),
      maToolBox(this),
      maToolBox(new SidebarToolBox(this)),
      msTitle(rsTitle),
      maIcon()
{
    SetBackground(rInitialBackgroundPaint.GetWallpaper());

    maToolBox.SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
    maToolBox->SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
}

TitleBar::~TitleBar (void)
TitleBar::~TitleBar()
{
    dispose();
}

void TitleBar::dispose()
{
    maToolBox.disposeAndClear();
    vcl::Window::dispose();
}

void TitleBar::SetTitle (const ::rtl::OUString& rsTitle)
@@ -102,9 +109,9 @@ void TitleBar::setPosSizePixel (
    Window::setPosSizePixel(nX,nY,nWidth,nHeight,nFlags);

    // Place the toolbox.
    const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth());
    maToolBox.setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE);
    maToolBox.Show();
    const sal_Int32 nToolBoxWidth (maToolBox->GetItemPosRect(0).GetWidth());
    maToolBox->setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE);
    maToolBox->Show();
}

void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
@@ -181,8 +188,8 @@ void TitleBar::PaintFocus (const Rectangle& rFocusBox)
IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox)
{
    (void)pToolBox;
    OSL_ASSERT(&maToolBox==pToolBox);
    const sal_uInt16 nItemId (maToolBox.GetHighlightItemId());
    OSL_ASSERT(maToolBox.get()==pToolBox);
    const sal_uInt16 nItemId (maToolBox->GetHighlightItemId());

    HandleToolBoxItemClick(nItemId);

diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx
index cf50dfe..df61a02 100644
--- a/sfx2/source/sidebar/TitleBar.hxx
+++ b/sfx2/source/sidebar/TitleBar.hxx
@@ -35,6 +35,7 @@ public:
        vcl::Window* pParentWindow,
        const sidebar::Paint& rInitialBackgroundPaint);
    virtual ~TitleBar (void);
    virtual void dispose() SAL_OVERRIDE;

    void SetTitle (const ::rtl::OUString& rsTitle);
    void SetIcon (const Image& rIcon);
@@ -48,11 +49,11 @@ public:
        long nHeight,
        sal_uInt16 nFlags = WINDOW_POSSIZE_ALL) SAL_OVERRIDE;

    ToolBox& GetToolBox (void) { return maToolBox;}
    const ToolBox& GetToolBox (void) const { return maToolBox;}
    ToolBox& GetToolBox (void) { return *maToolBox.get();}
    const ToolBox& GetToolBox (void) const { return *maToolBox.get();}

protected:
    SidebarToolBox maToolBox;
    VclPtr<SidebarToolBox> maToolBox;
    ::rtl::OUString msTitle;

    virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 0643e78..ca0694d 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -1204,6 +1204,11 @@ SfxPopupWindow::SfxPopupWindow(

SfxPopupWindow::~SfxPopupWindow()
{
    dispose();
}

void SfxPopupWindow::dispose()
{
    if ( m_xStatusListener.is() )
    {
        m_xStatusListener->dispose();
@@ -1213,6 +1218,7 @@ SfxPopupWindow::~SfxPopupWindow()
    vcl::Window* pWindow = GetTopMostParentSystemWindow( this );
    if ( pWindow )
        static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->RemoveWindow( this );
    FloatingWindow::dispose();
}


diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 037d7ea..0c21681 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -69,7 +69,6 @@ public:
    SfxFrame*           pFrame;

    SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& i_rContainerWindow );
    virtual ~SfxFrameWindow_Impl( );

    virtual void        DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
    virtual void        StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
@@ -86,10 +85,6 @@ SfxFrameWindow_Impl::SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& i_rContaine
{
}

SfxFrameWindow_Impl::~SfxFrameWindow_Impl( )
{
}

void SfxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
{
    Window::DataChanged( rDCEvt );
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index e5de62c..2f68673 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -229,9 +229,15 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog(vcl::Window *pParent,

SfxPrintOptionsDialog::~SfxPrintOptionsDialog()
{
    dispose();
}

void SfxPrintOptionsDialog::dispose()
{
    delete pDlgImpl;
    delete pPage;
    delete pOptions;
    ModalDialog::dispose();
}