vclwidget: convert lots more sites to use VclPtr

seems there was a lot of shared_ptr usage floating around...

Change-Id: Icd05243170eb8493709275fc36bf986fc194b781
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 8646e4d..5ff2f06 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -204,7 +204,9 @@ void MediaWindowImpl::dispose()
    mpEmptyBmpEx = NULL;
    delete mpAudioBmpEx;
    mpAudioBmpEx = NULL;
    mpMediaWindowControl.clear();
    mpMediaWindowControl.disposeAndClear();
    mpChildWindow.disposeAndClear();

    Control::dispose();
}

diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index 40131c3..c56558c 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -172,7 +172,7 @@ namespace avmedia
            ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >   mxEventsIf;
            MediaEventListenersImpl*                                                mpEvents;
            bool                                                                    mbEventTransparent;
            std::unique_ptr<MediaChildWindow>                                       mpChildWindow;
            VclPtr<MediaChildWindow>                                                mpChildWindow;
            VclPtr<MediaWindowControl>                                              mpMediaWindowControl;
            BitmapEx*                                                               mpEmptyBmpEx;
            BitmapEx*                                                               mpAudioBmpEx;
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index addef49..82e2825 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -109,7 +109,7 @@ private:
    ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
    GetComponentInterface(bool bCreate = true) SAL_OVERRIDE;
    CodeCompleteDataCache aCodeCompleteCache;
    boost::scoped_ptr< CodeCompleteWindow > pCodeCompleteWnd;
    VclPtr<CodeCompleteWindow> pCodeCompleteWnd;
    OUString GetActualSubName( sal_uLong nLine ); // gets the actual subroutine name according to line number
    void SetupAndShowCodeCompleteWnd(const std::vector< OUString >& aEntryVect, TextSelection aSel );
    void HandleAutoCorrect();
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index d943cec..66f5349 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -271,6 +271,7 @@ void EditorWindow::dispose()
        EndListening( *pEditEngine );
        pEditEngine->RemoveView(pEditView.get());
    }
    pCodeCompleteWnd.disposeAndClear();
    vcl::Window::dispose();
}

diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
index 366cc7b..fa8399a 100644
--- a/basctl/source/basicide/brkdlg.cxx
+++ b/basctl/source/basicide/brkdlg.cxx
@@ -118,6 +118,7 @@ void BreakPointDialog::dispose()
    m_pNewButton.clear();
    m_pDelButton.clear();
    m_pNumericField.clear();
    m_pCheckBox.clear();
    ModalDialog::dispose();
}

diff --git a/basctl/source/basicide/brkdlg.hxx b/basctl/source/basicide/brkdlg.hxx
index 5c78e7c..50d1854 100644
--- a/basctl/source/basicide/brkdlg.hxx
+++ b/basctl/source/basicide/brkdlg.hxx
@@ -35,7 +35,7 @@ private:
    VclPtr<OKButton>       m_pOKButton;
    VclPtr<PushButton>     m_pNewButton;
    VclPtr<PushButton>     m_pDelButton;
    ::VclPtr<CheckBox>     m_pCheckBox;
    VclPtr<CheckBox>       m_pCheckBox;
    VclPtr<NumericField>   m_pNumericField;

    BreakPointList & m_rOriginalBreakPointList;
diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx
index c475ab4..0c7a40d 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -195,7 +195,7 @@ void Layout::SplittedSide::Add (DockingWindow* pWin, Size const& rSize)
    // splitter
    if (!vItems.empty())
    {
        aItem.pSplit = boost::make_shared<Splitter>(&rLayout, bVertical ? WB_VSCROLL : WB_HSCROLL);
        aItem.pSplit = new Splitter(&rLayout, bVertical ? WB_VSCROLL : WB_HSCROLL);
        aItem.pSplit->SetSplitPosPixel(aItem.nStartPos - nSplitThickness);
        InitSplitter(*aItem.pSplit);
    }
diff --git a/basctl/source/basicide/layout.hxx b/basctl/source/basicide/layout.hxx
index ad19ad93..e25cb11 100644
--- a/basctl/source/basicide/layout.hxx
+++ b/basctl/source/basicide/layout.hxx
@@ -113,7 +113,7 @@ private:
            long nStartPos, nEndPos;
            // splitter line window before the window
            // (the first one is always nullptr)
            boost::shared_ptr<Splitter> pSplit;
            VclPtr<Splitter> pSplit;
        };
        std::vector<Item> vItems;
    private:
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index 0baeb57..2f154e9 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -74,12 +74,12 @@ private:
    VclPtr<ScrollBar>         aHScrollBar;
    VclPtr<ScrollBar>         aVScrollBar;
    VclPtr<ScrollBarBox>      aScrollBarBox;
    boost::scoped_ptr<TabBar> pTabBar; // basctl::TabBar
    VclPtr<TabBar> pTabBar; // basctl::TabBar
    bool                bTabBarSplitted;
    bool                bCreatingWindow;
    // layout windows
    boost::scoped_ptr<ModulWindowLayout> pModulLayout;
    boost::scoped_ptr<DialogWindowLayout> pDialogLayout;
    VclPtr<ModulWindowLayout> pModulLayout;
    VclPtr<DialogWindowLayout> pDialogLayout;
    // the active layout window
    VclPtr<Layout> pLayout;
    // common object catalog window
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index f891593..ce2a54e 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -178,9 +178,9 @@ public:
    bool HasFocus() const;

private:
    ::boost::shared_ptr< FixedImage >        m_spSymbol;
    ::boost::shared_ptr< SeriesHeaderEdit >  m_spSeriesName;
    ::boost::shared_ptr< FixedText >         m_spColorBar;
    VclPtr< FixedImage >        m_spSymbol;
    VclPtr< SeriesHeaderEdit >  m_spSeriesName;
    VclPtr< FixedText >         m_spColorBar;
    OutputDevice *                           m_pDevice;
    Link                                     m_aChangeLink;

diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
index 118d6f7..e3cb545 100644
--- a/chart2/source/controller/dialogs/dlg_DataEditor.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
@@ -107,6 +107,7 @@ void DataEditor::dispose()

    OSL_TRACE( "DataEditor: DTOR" );
    m_pTbxData.clear();
    m_xBrwData.disposeAndClear();
    ModalDialog::dispose();
}

diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 296fb6d..d5eeb35 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -505,8 +505,8 @@ private:
    VclPtr<FixedText>  m_pFT_LineType;
    VclPtr<ListBox>    m_pLB_LineType;
    VclPtr<PushButton> m_pPB_DetailsDialog;
    boost::scoped_ptr< SplinePropertiesDialog > m_pSplinePropertiesDialog;
    boost::scoped_ptr< SteppedPropertiesDialog > m_pSteppedPropertiesDialog;
    VclPtr< SplinePropertiesDialog > m_pSplinePropertiesDialog;
    VclPtr< SteppedPropertiesDialog > m_pSteppedPropertiesDialog;
};

SplineResourceGroup::SplineResourceGroup(VclBuilderContainer* pWindow)
diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx
index cff3f4f..5bfceb1 100644
--- a/chart2/source/controller/inc/dlg_DataEditor.hxx
+++ b/chart2/source/controller/inc/dlg_DataEditor.hxx
@@ -66,8 +66,8 @@ private:
    sal_uInt16 TBI_DATA_SWAP_ROW;

    bool                           m_bReadOnly;
    boost::scoped_ptr<DataBrowser> m_xBrwData;
    VclPtr<ToolBox>                       m_pTbxData;
    VclPtr<DataBrowser>            m_xBrwData;
    VclPtr<ToolBox>                m_pTbxData;
    ::com::sun::star::uno::Reference<
            ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
diff --git a/chart2/source/controller/main/ElementSelector.hxx b/chart2/source/controller/main/ElementSelector.hxx
index cc70f8a..aa9c182 100644
--- a/chart2/source/controller/main/ElementSelector.hxx
+++ b/chart2/source/controller/main/ElementSelector.hxx
@@ -110,7 +110,7 @@ private:

private:
    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>        m_xCC;
    boost::scoped_ptr< SelectorListBox > m_apSelectorListBox;
    VclPtr< SelectorListBox > m_apSelectorListBox;
};

} //namespace chart
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index c71b75e..41fb2d2 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -112,6 +112,10 @@ bool containsWindowSubclass(const Type* pType0) {
    if (pType->isPointerType()) {
        QualType pointeeType = pType->getPointeeType();
        return containsWindowSubclass(pointeeType);
    } else if (pType->isArrayType()) {
        const ArrayType* pArrayType = dyn_cast<ArrayType>(pType);
        QualType elementType = pArrayType->getElementType();
        return containsWindowSubclass(elementType);
    } else {
        return isDerivedFromWindow(pRecordDecl);
    }
@@ -315,6 +319,12 @@ static void findDisposeAndClearStatements2(std::vector<std::string>& aVclPtrFiel
        findDisposeAndClearStatements(aVclPtrFields, dyn_cast<CompoundStmt>(pStmt));
        return;
    }
    if (isa<ForStmt>(pStmt)) {
        const CompoundStmt *pBody = dyn_cast<CompoundStmt>(dyn_cast<ForStmt>(pStmt)->getBody());
        if (pBody)
            findDisposeAndClearStatements(aVclPtrFields, pBody);
        return;
    }
    if (!isa<CallExpr>(pStmt)) return;
    const CallExpr *pCallExpr = dyn_cast<CallExpr>(pStmt);

@@ -404,6 +414,12 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
            return true;
        if (pMethodDecl->getQualifiedNameAsString() == "dbaui::DlgOrderCrit::dispose")
            return true;
        if (pMethodDecl->getQualifiedNameAsString() == "SvxStyleBox_Impl::dispose")
            return true;
        if (pMethodDecl->getQualifiedNameAsString() == "dbaui::OAppDetailPageHelper::dispose")
            return true;
        if (pMethodDecl->getQualifiedNameAsString() == "sd::CustomAnimationCreateDialog::dispose")
            return true;

        std::vector<std::string> aVclPtrFields;
        for(auto fieldDecl : pMethodDecl->getParent()->fields()) {
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 4043f8c..1210b8a 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1595,7 +1595,7 @@ public:

private:
    SfxItemSet                              m_aItems;
    ::std::unique_ptr< SvxMacroAssignDlg >  m_pDialog;
    VclPtr< SvxMacroAssignDlg >             m_pDialog;
};

short SvxMacroAssignDialog::Execute()
diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx
index 85a10de..b9ead63 100644
--- a/cui/source/options/optaboutconfig.hxx
+++ b/cui/source/options/optaboutconfig.hxx
@@ -50,7 +50,7 @@ private:
    VclPtr<Edit> m_pSearchEdit;

    std::vector< boost::shared_ptr< Prop_Impl > > m_vectorOfModified;
    boost::scoped_ptr< SvSimpleTable > m_pPrefBox;
    VclPtr< SvSimpleTable > m_pPrefBox;

     //for search
    ::com::sun::star::util::SearchOptions m_options;
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 5c0189f..bebc01f 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -248,11 +248,9 @@ void OAppDetailPageHelper::dispose()
        {
            m_pLists[i]->clearCurrentSelection();
            m_pLists[i]->Hide();
            boost::scoped_ptr<DBTreeListBox> aTemp(m_pLists[i]);
            m_pLists[i]->clearCurrentSelection();   // why a second time?
            m_pLists[i] = NULL;
            m_pLists[i].disposeAndClear();
        }

    }
    m_aFL.disposeAndClear();
    m_aTBPreview.disposeAndClear();
@@ -369,7 +367,7 @@ void OAppDetailPageHelper::describeCurrentSelectionForControl( const Control& _r
void OAppDetailPageHelper::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
{
    OSL_ENSURE( _eType < E_ELEMENT_TYPE_COUNT, "OAppDetailPageHelper::describeCurrentSelectionForType: invalid type!" );
    DBTreeListBox* pList = ( _eType < E_ELEMENT_TYPE_COUNT ) ? m_pLists[ _eType ] : NULL;
    DBTreeListBox* pList = ( _eType < E_ELEMENT_TYPE_COUNT ) ? m_pLists[ _eType ].get() : NULL;
    OSL_ENSURE( pList, "OAppDetailPageHelper::describeCurrentSelectionForType: "
                       "You really should ensure this type has already been viewed before!" );
    if ( !pList )
@@ -586,7 +584,7 @@ void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xCon
    }
    if ( !m_pLists[E_TABLE]->GetEntryCount() )
    {
        static_cast<OTableTreeListBox*>(m_pLists[E_TABLE])->UpdateTableList(_xConnection);
        static_cast<OTableTreeListBox*>(m_pLists[E_TABLE].get())->UpdateTableList(_xConnection);

        SvTreeListEntry* pEntry = m_pLists[E_TABLE]->First();
        if ( pEntry )
@@ -1226,7 +1224,7 @@ void OAppDetailPageHelper::DataChanged( const DataChangedEvent& rDCEvt )
        ImplInitSettings();
        if ( m_pLists[ E_TABLE ] )
        {
            OTableTreeListBox* pTableTree = dynamic_cast< OTableTreeListBox* >( m_pLists[ E_TABLE ] );
            OTableTreeListBox* pTableTree = dynamic_cast< OTableTreeListBox* >( m_pLists[ E_TABLE ].get() );
            OSL_ENSURE( pTableTree != NULL, "OAppDetailPageHelper::DataChanged: a tree list for tables which is no TableTreeList?" );
            if ( pTableTree )
                pTableTree->notifyHiContrastChanged();
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index 90de8ea..9240fb9 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
@@ -77,7 +77,7 @@ namespace dbaui
    // Combines general functionality.
    class OAppDetailPageHelper : public vcl::Window
    {
        DBTreeListBox*      m_pLists[ELEMENT_COUNT];
        VclPtr<DBTreeListBox>     m_pLists[ELEMENT_COUNT];
        OAppBorderWindow&   m_rBorderWin;
        VclPtr<FixedLine>         m_aFL;
        VclPtr<ToolBox>           m_aTBPreview;
@@ -194,7 +194,7 @@ namespace dbaui
        inline DBTreeListBox* getCurrentView() const
        {
            ElementType eType = getElementType();
            return (eType != E_NONE ) ? m_pLists[static_cast<sal_Int32>(eType)] : NULL;
            return (eType != E_NONE ) ? m_pLists[static_cast<sal_Int32>(eType)].get() : NULL;
        }

        /// select all entries in the visible control
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index 2938126..d5b9cda 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -59,7 +59,7 @@ namespace dbaui
    {
        friend class OTableListBoxControl;

        ::std::unique_ptr< ::svt::ListBoxControl> m_pListCell;
        VclPtr< ::svt::ListBoxControl>          m_pListCell;
        TTableConnectionData::value_type        m_pConnData;
        OTableListBoxControl*                   m_pBoxControl;
        long                                    m_nDataPos;
@@ -101,6 +101,8 @@ namespace dbaui
        void lateInit();

    protected:
        virtual ~ORelationControl() { disposeOnce(); }
        virtual void dispose() SAL_OVERRIDE { m_pListCell.disposeAndClear(); ORelationControl_Base::dispose(); }
        virtual void Resize() SAL_OVERRIDE;
        virtual Size GetOptimalSize() const SAL_OVERRIDE;
        virtual bool PreNotify(NotifyEvent& rNEvt ) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/dlg/textconnectionsettings.cxx b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
index 77c515e..0fd69e9 100644
--- a/dbaccess/source/ui/dlg/textconnectionsettings.cxx
+++ b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
@@ -47,6 +47,7 @@ namespace dbaui
    void TextConnectionSettingsDialog::dispose()
    {
        m_pOK.clear();
        m_pTextConnectionHelper.disposeAndClear();
        ModalDialog::dispose();
    }

diff --git a/dbaccess/source/ui/inc/textconnectionsettings.hxx b/dbaccess/source/ui/inc/textconnectionsettings.hxx
index fdd5a94..89bcfc3 100644
--- a/dbaccess/source/ui/inc/textconnectionsettings.hxx
+++ b/dbaccess/source/ui/inc/textconnectionsettings.hxx
@@ -49,8 +49,8 @@ namespace dbaui
        virtual short   Execute() SAL_OVERRIDE;

    private:
        ::std::unique_ptr< OTextConnectionHelper >    m_pTextConnectionHelper;
        VclPtr<OKButton>                              m_pOK;
        VclPtr<OTextConnectionHelper>               m_pTextConnectionHelper;
        VclPtr<OKButton>                            m_pOK;
        SfxItemSet&                                 m_rItems;

    private:
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index 001576a..c8408c0 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -390,6 +390,7 @@ namespace pcr
        Clear();
        m_aLinesPlayground.disposeAndClear();
        m_aVScroll.disposeAndClear();
        m_pHelpWindow.disposeAndClear();
        Control::dispose();
    }

diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx
index a1ea459..b40f45a 100644
--- a/extensions/source/propctrlr/browserlistbox.hxx
+++ b/extensions/source/propctrlr/browserlistbox.hxx
@@ -95,8 +95,7 @@ namespace pcr
    protected:
        VclPtr<Window>              m_aLinesPlayground;
        VclPtr<ScrollBar>           m_aVScroll;
        ::std::unique_ptr< InspectorHelpWindow >
                                    m_pHelpWindow;
        VclPtr<InspectorHelpWindow> m_pHelpWindow;
        ListBoxLines                m_aLines;
        IPropertyLineListener*      m_pLineListener;
        IPropertyControlObserver*   m_pControlObserver;
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index 91ed73b..fc7b229 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -216,6 +216,12 @@ namespace pcr
        m_pMasterLabel.clear();
        m_pOK.clear();
        m_pSuggest.clear();

        m_aRow1.disposeAndClear();
        m_aRow2.disposeAndClear();
        m_aRow3.disposeAndClear();
        m_aRow4.disposeAndClear();

        ModalDialog::dispose();
    }

diff --git a/extensions/source/propctrlr/formlinkdialog.hxx b/extensions/source/propctrlr/formlinkdialog.hxx
index 7f563a2..e1c250e 100644
--- a/extensions/source/propctrlr/formlinkdialog.hxx
+++ b/extensions/source/propctrlr/formlinkdialog.hxx
@@ -47,10 +47,10 @@ namespace pcr
        VclPtr<FixedText>                      m_pExplanation;
        VclPtr<FixedText>                      m_pDetailLabel;
        VclPtr<FixedText>                      m_pMasterLabel;
        ::std::unique_ptr< FieldLinkRow > m_aRow1;
        ::std::unique_ptr< FieldLinkRow > m_aRow2;
        ::std::unique_ptr< FieldLinkRow > m_aRow3;
        ::std::unique_ptr< FieldLinkRow > m_aRow4;
        VclPtr<FieldLinkRow>                   m_aRow1;
        VclPtr<FieldLinkRow>                   m_aRow2;
        VclPtr<FieldLinkRow>                   m_aRow3;
        VclPtr<FieldLinkRow>                   m_aRow4;
        VclPtr<OKButton>                       m_pOK;
        VclPtr<PushButton>                     m_pSuggest;

diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
index b17ffe4..3eeb707 100644
--- a/include/avmedia/mediawindow.hxx
+++ b/include/avmedia/mediawindow.hxx
@@ -28,6 +28,7 @@
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <vcl/bitmapex.hxx>
#include <vcl/vclptr.hxx>
#include <avmedia/avmediadllapi.h>

#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0
@@ -115,7 +116,7 @@ namespace avmedia
        MediaWindow& operator =( const MediaWindow& ) SAL_DELETED_FUNCTION;

        ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >   mxIFace;
        std::unique_ptr<priv::MediaWindowImpl> mpImpl;
        VclPtr<priv::MediaWindowImpl> mpImpl;
    };
}

diff --git a/include/svx/sidebar/Popup.hxx b/include/svx/sidebar/Popup.hxx
index 063e8e6..bcd0bde 100644
--- a/include/svx/sidebar/Popup.hxx
+++ b/include/svx/sidebar/Popup.hxx
@@ -77,7 +77,7 @@ public :
    void SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback);

protected:
    std::unique_ptr<PopupControl> mxControl;
    VclPtr<PopupControl> mxControl;

    /** Make sure that both PopupContainer and PopupControl objects
        exist.  Calls the maControlCreator functor if necessary.
@@ -94,7 +94,7 @@ private:
    ::boost::function<PopupControl*(PopupContainer*)> maControlCreator;
    ::boost::function<void(void)> maPopupModeEndCallback;
    const ::rtl::OUString msAccessibleName;
    std::unique_ptr<PopupContainer> mxContainer;
    VclPtr<PopupContainer> mxContainer;

    DECL_LINK(PopupModeEndHandler, void*);
};
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
index 7fdfaea..eda091e 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -239,6 +239,7 @@ void OAddFieldWindow::dispose()
    m_aFixedLine.disposeAndClear();
    m_aHelpText.disposeAndClear();
    m_aInsertButton.disposeAndClear();
    m_pListBox.disposeAndClear();
    FloatingWindow::dispose();
}

diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx
index ddd8ea1..7c59a31 100644
--- a/reportdesign/source/ui/dlg/CondFormat.cxx
+++ b/reportdesign/source/ui/dlg/CondFormat.cxx
@@ -192,7 +192,7 @@ namespace rptui
            ::comphelper::copyProperties(m_xCopy.get(),xCond.get());
            m_xCopy->insertByIndex( _nNewCondIndex, makeAny( xCond ) );

            ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) );
            Condition *pCon( new Condition( m_pConditionPlayground, *this, m_rController ) );
            pCon->setCondition( xCond );
            pCon->reorderWithinParent(_nNewCondIndex);
            m_aConditions.insert( m_aConditions.begin() + _nNewCondIndex, pCon );
@@ -273,7 +273,7 @@ namespace rptui

        // do this in two steps, so we don't become inconsistent if any of the UNO actions fails
        Any aMovedCondition;
        ConditionPtr pMovedCondition;
        Condition *pMovedCondition;
        try
        {
            aMovedCondition = m_xCopy->getByIndex( (sal_Int32)nOldConditionIndex );
@@ -351,7 +351,7 @@ namespace rptui
            sal_Int32 nCount = m_xCopy->getCount();
            for ( sal_Int32 i = 0; i < nCount ; ++i )
            {
                ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) );
                Condition *pCon( new Condition( m_pConditionPlayground, *this, m_rController ) );
                Reference< XFormatCondition > xCond( m_xCopy->getByIndex(i), UNO_QUERY );
                pCon->reorderWithinParent(i);
                pCon->setCondition( xCond );
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index fb898fe..f3c745e 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -882,7 +882,7 @@ public:

    uno::Reference< report::XReportDefinition>  m_xReport;
    ::rptui::OReportController&                 m_rController;
    ::std::unique_ptr<NavigatorTree>            m_pNavigatorTree;
    VclPtr<NavigatorTree>                       m_pNavigatorTree;
};

ONavigatorImpl::ONavigatorImpl(OReportController& _rController,ONavigator* _pParent)
diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx
index 76dabea..6a30ee8 100644
--- a/reportdesign/source/ui/inc/AddField.hxx
+++ b/reportdesign/source/ui/inc/AddField.hxx
@@ -56,7 +56,7 @@ class  OAddFieldWindow  :public FloatingWindow

    VclPtr<ToolBox>                                                             m_aActions;

    ::std::unique_ptr<OAddFieldWindowListBox>                                   m_pListBox;
    VclPtr<OAddFieldWindowListBox>                                              m_pListBox;
    VclPtr<FixedLine>                                                           m_aFixedLine;
    VclPtr<FixedText>                                                           m_aHelpText;

diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx
index f8e8332..e0ebc88 100644
--- a/reportdesign/source/ui/inc/CondFormat.hxx
+++ b/reportdesign/source/ui/inc/CondFormat.hxx
@@ -70,8 +70,7 @@ namespace rptui
    class ConditionalFormattingDialog  :public ModalDialog
                                        ,public IConditionalFormatAction
    {
        typedef ::boost::shared_ptr< Condition >    ConditionPtr;
        typedef ::std::vector< ConditionPtr >       Conditions;
        typedef ::std::vector< VclPtr<Condition> >  Conditions;

        OModuleClient             m_aModuleClient;
        VclPtr<vcl::Window>       m_pConditionPlayground;
diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx
index a8b8182..90faf2d 100644
--- a/reportdesign/source/ui/inc/DesignView.hxx
+++ b/reportdesign/source/ui/inc/DesignView.hxx
@@ -213,8 +213,8 @@ namespace rptui
        ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const;

        // IMarkedSection
        ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
        ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
        OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
        OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
        virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;

        /** fills the positions of all collapsed sections.
diff --git a/reportdesign/source/ui/inc/MarkedSection.hxx b/reportdesign/source/ui/inc/MarkedSection.hxx
index 52ee1d3..84f9258 100644
--- a/reportdesign/source/ui/inc/MarkedSection.hxx
+++ b/reportdesign/source/ui/inc/MarkedSection.hxx
@@ -38,7 +38,7 @@ namespace rptui
    public:
        /** returns the section which is currently marked.
        */
        virtual ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa) const =0;
        virtual OSectionWindow* getMarkedSection(NearSectionAccess nsa) const =0;

        /** mark the section on the given position .
        *
diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx
index 7a282f2..6dc7b02 100644
--- a/reportdesign/source/ui/inc/ReportController.hxx
+++ b/reportdesign/source/ui/inc/ReportController.hxx
@@ -457,7 +457,7 @@ namespace rptui
    // cppu::OPropertySetHelper
        virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;

        ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
        OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;

        ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const;
        OUString getColumnLabel_throw(const OUString& i_sColumnName) const;
diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx
index 1e0294d..7c974bd 100644
--- a/reportdesign/source/ui/inc/ReportWindow.hxx
+++ b/reportdesign/source/ui/inc/ReportWindow.hxx
@@ -180,8 +180,8 @@ namespace rptui
        void            setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark);

        // IMarkedSection
        ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
        ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
        OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
        OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
        virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;


diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx
index 5ad8637..e45d9da 100644
--- a/reportdesign/source/ui/inc/ScrollHelper.hxx
+++ b/reportdesign/source/ui/inc/ScrollHelper.hxx
@@ -174,8 +174,8 @@ namespace rptui
        void                    setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark);

        // IMarkedSection
        ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
        ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
        OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
        OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
        virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;


diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx
index e8c1982..f16fd59 100644
--- a/reportdesign/source/ui/inc/ViewsWindow.hxx
+++ b/reportdesign/source/ui/inc/ViewsWindow.hxx
@@ -32,7 +32,6 @@
#include <unotools/options.hxx>
#include <list>
#include <vector>
#include <boost/shared_ptr.hpp>

#include "MarkedSection.hxx"
#include "SectionWindow.hxx"
@@ -108,7 +107,7 @@ namespace rptui
    {
        typedef ::std::multimap<Rectangle,::std::pair<SdrObject*,OSectionView*>,RectangleLess>      TRectangleMap;
    public:
        typedef ::std::vector< ::boost::shared_ptr<OSectionWindow> >                                TSectionsMap;
        typedef ::std::vector< VclPtr<OSectionWindow> >                                TSectionsMap;

        struct TReportPairHelper : public ::std::unary_function< TSectionsMap::value_type, OReportSection >
        {
@@ -182,7 +181,7 @@ namespace rptui
        * \param _nPos
        * \return the section at this pos or an empty section
        */
        ::boost::shared_ptr<OSectionWindow> getSectionWindow(const sal_uInt16 _nPos) const;
        OSectionWindow* getSectionWindow(const sal_uInt16 _nPos) const;

        /** turns the grid on or off
        *
@@ -236,7 +235,7 @@ namespace rptui
        /** returns the report section window for the given xsection
            @param  _xSection   the section
        */
        ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
        OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;

        /** checks if the keycode is known by the child windows
            @param  _rCode  the keycode
@@ -253,7 +252,7 @@ namespace rptui
        void            setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark);

        // IMarkedSection
        ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
        OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
        virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;

        /** align all marked objects in all sections
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index 9d15fa3..9829649 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -405,7 +405,7 @@ void ODesignView::GetFocus()

    if ( !m_bDeleted )
    {
        ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aScrollWindow->getMarkedSection();
        OSectionWindow* pSectionWindow = m_aScrollWindow->getMarkedSection();
        if ( pSectionWindow )
            pSectionWindow->GrabFocus();
    }
@@ -566,12 +566,12 @@ uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel()
    return xModel;
}

::boost::shared_ptr<OSectionWindow> ODesignView::getMarkedSection(NearSectionAccess nsa) const
OSectionWindow* ODesignView::getMarkedSection(NearSectionAccess nsa) const
{
    return  m_aScrollWindow->getMarkedSection(nsa);
}

::boost::shared_ptr<OSectionWindow> ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
OSectionWindow* ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
{
    return  m_aScrollWindow->getSectionWindow(_xSection);
}
@@ -649,7 +649,7 @@ void ODesignView::MouseButtonDown( const MouseEvent& rMEvt )
uno::Any ODesignView::getCurrentlyShownProperty() const
{
    uno::Any aRet;
    ::boost::shared_ptr<OSectionWindow> pSectionWindow = getMarkedSection();
    OSectionWindow* pSectionWindow = getMarkedSection();
    if ( pSectionWindow )
    {
        ::std::vector< uno::Reference< uno::XInterface > > aSelection;
diff --git a/reportdesign/source/ui/report/FixedTextColor.cxx b/reportdesign/source/ui/report/FixedTextColor.cxx
index ca3029b..8ccfc48 100644
--- a/reportdesign/source/ui/report/FixedTextColor.cxx
+++ b/reportdesign/source/ui/report/FixedTextColor.cxx
@@ -172,7 +172,7 @@ namespace rptui
                    OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject);
                    if ( pUnoObj ) // this doesn't need to be done for shapes
                    {
                        ::boost::shared_ptr<OSectionWindow> pSectionWindow = pController->getSectionWindow(xSection);
                        OSectionWindow* pSectionWindow = pController->getSectionWindow(xSection);
                        if (pSectionWindow != 0)
                        {
                            OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice
diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
index a2ca68d..1255d68 100644
--- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
+++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
@@ -173,7 +173,7 @@ namespace rptui
                OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject);
                if ( pUnoObj ) // this doesn't need to be done for shapes
                {
                    ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_rReportController.getSectionWindow(xSection);
                    OSectionWindow* pSectionWindow = m_rReportController.getSectionWindow(xSection);
                    if (pSectionWindow != 0)
                    {
                        OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index c0d7373..520b5be 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -362,7 +362,7 @@ void OReportController::disposing()
    {
        try
        {
            ::boost::shared_ptr<OSectionWindow> pSectionWindow;
            OSectionWindow* pSectionWindow = NULL;
            if ( getDesignView() )
                pSectionWindow = getDesignView()->getMarkedSection();
            if ( pSectionWindow )
@@ -583,7 +583,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const
            aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId);
            if ( aReturn.bEnabled )
            {
                ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
                OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
                if ( pSectionWindow )
                    aReturn.bEnabled = !pSectionWindow->getReportSection().isUiActive();
            }
@@ -1135,7 +1135,7 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
            break;
        case SID_TERMINATE_INPLACEACTIVATION:
            {
                ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection();
                OSectionWindow* pSection = getDesignView()->getMarkedSection();
                if ( pSection )
                    pSection->getReportSection().deactivateOle();
            }
@@ -2791,8 +2791,8 @@ uno::Any SAL_CALL OReportController::getViewData(void) throw( uno::RuntimeExcept
            aViewData.put( "CollapsedSections", aCollapsedSections );
        }

        ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
        if ( pSectionWindow.get() )
        OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
        if ( pSectionWindow )
        {
            aViewData.put( "MarkedSection", (sal_Int32)pSectionWindow->getReportSection().getPage()->GetPageNum() );
        }
@@ -3159,7 +3159,7 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
{
    SequenceAsHashMap aMap(_aArgs);
    getDesignView()->setMarked(_xSection, true);
    ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
    OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
    if ( !pSectionWindow )
        return;

@@ -3337,7 +3337,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
    getDesignView()->unmarkAllObjects(NULL);

    // Anhand des FormatKeys wird festgestellt, welches Feld benoetigt wird
    ::boost::shared_ptr<OSectionWindow> pSectionWindow[2];
    OSectionWindow* pSectionWindow[2];
    pSectionWindow[0] = getDesignView()->getMarkedSection();

    if ( !pSectionWindow[0] )
@@ -3651,8 +3651,8 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
OSectionView* OReportController::getCurrentSectionView() const
{
    OSectionView* pSectionView = NULL;
    ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
    if ( pSectionWindow.get() )
    OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
    if ( pSectionWindow )
        pSectionView = &pSectionWindow->getReportSection().getSectionView();
    return pSectionView;
}
@@ -3966,7 +3966,7 @@ void OReportController::createGroupSection(const bool _bUndo,const bool _bHeader

void OReportController::collapseSection(const bool _bCollapse)
{
    ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection();
    OSectionWindow *pSection = getDesignView()->getMarkedSection();
    if ( pSection )
    {
        pSection->setCollapsed(_bCollapse);
@@ -3975,10 +3975,10 @@ void OReportController::collapseSection(const bool _bCollapse)

void OReportController::markSection(const bool _bNext)
{
    ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection();
    OSectionWindow *pSection = getDesignView()->getMarkedSection();
    if ( pSection )
    {
        ::boost::shared_ptr<OSectionWindow> pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS);
        OSectionWindow *pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS);
        if ( pPrevSection != pSection && pPrevSection )
            select(uno::makeAny(pPrevSection->getReportSection().getSection()));
        else
@@ -4219,16 +4219,15 @@ void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomSh
}


::boost::shared_ptr<OSectionWindow> OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
OSectionWindow* OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
{
    if ( getDesignView() )
    {
        return  getDesignView()->getSectionWindow(_xSection);
        return getDesignView()->getSectionWindow(_xSection);
    }

    // throw NullPointerException?
    ::boost::shared_ptr<OSectionWindow> pEmpty;
    return pEmpty;
    return NULL;
}


diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx
index 25097bf..7d06b779 100644
--- a/reportdesign/source/ui/report/ReportWindow.cxx
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -299,7 +299,7 @@ void OReportWindow::unmarkAllObjects(OSectionView* _pSectionView)

void OReportWindow::showProperties(const uno::Reference< report::XSection>& _xReportComponent)
{
    ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aViewsWindow->getSectionWindow( _xReportComponent );
    OSectionWindow* pSectionWindow = m_aViewsWindow->getSectionWindow( _xReportComponent );
    m_pView->UpdatePropertyBrowserDelayed(pSectionWindow->getReportSection().getSectionView());
}

@@ -326,12 +326,12 @@ void OReportWindow::setMarked(const uno::Sequence< uno::Reference< report::XRepo
    m_aViewsWindow->setMarked(_xShape,_bMark);
}

::boost::shared_ptr<OSectionWindow> OReportWindow::getMarkedSection(NearSectionAccess nsa) const
OSectionWindow* OReportWindow::getMarkedSection(NearSectionAccess nsa) const
{
    return  m_aViewsWindow->getMarkedSection(nsa);
}

::boost::shared_ptr<OSectionWindow> OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
OSectionWindow* OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
{
    return  m_aViewsWindow->getSectionWindow(_xSection);
}
diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx
index 7185223..b05541e 100644
--- a/reportdesign/source/ui/report/ScrollHelper.cxx
+++ b/reportdesign/source/ui/report/ScrollHelper.cxx
@@ -301,12 +301,12 @@ void OScrollWindowHelper::setMarked(const uno::Sequence< uno::Reference< report:
    m_aReportWindow->setMarked(_xShape,_bMark);
}

::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const
OSectionWindow* OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const
{
    return m_aReportWindow->getMarkedSection(nsa);
}

::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
OSectionWindow* OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
{
    return  m_aReportWindow->getSectionWindow(_xSection);
}
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index b8e159fd..543a612 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -226,8 +226,8 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)
    TSectionsMap::iterator aEnd = m_aSections.end();
    for (;aIter != aEnd ; ++aIter)
    {
        const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter);
        if ( pSectionWindow.get() == &_rSectionWindow )
        OSectionWindow* pSectionWindow = (*aIter);
        if ( pSectionWindow == &_rSectionWindow )
        {
            aStartPoint = pSectionWindow->GetPosPixel();
            bSet = true;
@@ -235,7 +235,7 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)

        if ( bSet )
        {
            impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,bSet);
            impl_resizeSectionWindow(*pSectionWindow,aStartPoint,bSet);
            static sal_Int32 nIn = INVALIDATE_UPDATE | INVALIDATE_TRANSPARENT;
            pSectionWindow->getStartMarker().Invalidate( nIn ); // INVALIDATE_NOERASE |INVALIDATE_NOCHILDREN| INVALIDATE_TRANSPARENT
            pSectionWindow->getEndMarker().Invalidate( nIn );
@@ -255,8 +255,8 @@ void OViewsWindow::Resize()
        TSectionsMap::iterator aEnd = m_aSections.end();
        for (;aIter != aEnd ; ++aIter)
        {
            const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter);
            impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,true);
            OSectionWindow* pSectionWindow = (*aIter);
            impl_resizeSectionWindow(*pSectionWindow,aStartPoint,true);
        }
    }
}
@@ -299,7 +299,7 @@ void OViewsWindow::DataChanged( const DataChangedEvent& rDCEvt )

void OViewsWindow::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition)
{
    ::boost::shared_ptr<OSectionWindow> pSectionWindow( new OSectionWindow(this,_xSection,_sColorEntry) );
    OSectionWindow* pSectionWindow( new OSectionWindow(this,_xSection,_sColorEntry) );
    m_aSections.insert(getIteratorAtPos(_nPosition) , TSectionsMap::value_type(pSectionWindow));
    m_pParent->setMarked(&pSectionWindow->getReportSection().getSectionView(),m_aSections.size() == 1);
    Resize();
@@ -399,17 +399,17 @@ void OViewsWindow::Paste()
            ::o3tl::compose1(::boost::bind(&OReportSection::Paste,_1,aCopies,false),TReportPairHelper()));
    else
    {
        ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
        OSectionWindow*  pMarkedSection = getMarkedSection();
        if ( pMarkedSection )
            pMarkedSection->getReportSection().Paste(aCopies,true);
    }
}

::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const
OSectionWindow* OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const
{
    OSL_ENSURE(_xSection.is(),"Section is NULL!");

    ::boost::shared_ptr<OSectionWindow> pSectionWindow;
    OSectionWindow* pSectionWindow = NULL;
    TSectionsMap::const_iterator aIter = m_aSections.begin();
    TSectionsMap::const_iterator aEnd = m_aSections.end();
    for (; aIter != aEnd ; ++aIter)
@@ -425,9 +425,9 @@ void OViewsWindow::Paste()
}


::boost::shared_ptr<OSectionWindow> OViewsWindow::getMarkedSection(NearSectionAccess nsa) const
OSectionWindow* OViewsWindow::getMarkedSection(NearSectionAccess nsa) const
{
    ::boost::shared_ptr<OSectionWindow> pRet;
    OSectionWindow* pRet = NULL;
    TSectionsMap::const_iterator aIter = m_aSections.begin();
    TSectionsMap::const_iterator aEnd = m_aSections.end();
    sal_uInt32 nCurrentPosition = 0;
@@ -631,7 +631,7 @@ void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XRepor
                bFirst = false;
                m_pParent->setMarked(xSection,_bMark);
            }
            ::boost::shared_ptr<OSectionWindow> pSectionWindow = getSectionWindow(xSection);
            OSectionWindow* pSectionWindow = getSectionWindow(xSection);
            if ( pSectionWindow )
            {
                SvxShape* pShape = SvxShape::getImplementation( *pIter );
@@ -888,7 +888,7 @@ void OViewsWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAli

void OViewsWindow::createDefault()
{
    ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
    OSectionWindow* pMarkedSection = getMarkedSection();
    if ( pMarkedSection )
        pMarkedSection->getReportSection().createDefault(m_sShapeType);
}
@@ -929,9 +929,9 @@ sal_uInt16 OViewsWindow::getPosition(const OSectionWindow* _pSectionWindow) cons
    return nPosition;
}

::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const
OSectionWindow* OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const
{
    ::boost::shared_ptr<OSectionWindow> aReturn;
    OSectionWindow* aReturn = NULL;

    if ( _nPos < m_aSections.size() )
        aReturn = m_aSections[_nPos];
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
index 426c612..0fb2b0e 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -514,7 +514,7 @@ void PropBrw::Update( OSectionView* pNewView )
        const sal_uInt16 nSectionCount = pViews->getSectionCount();
        for (sal_uInt16 i = 0; i < nSectionCount; ++i)
        {
            ::boost::shared_ptr<OSectionWindow> pSectionWindow = pViews->getSectionWindow(i);
            OSectionWindow* pSectionWindow = pViews->getSectionWindow(i);
            if ( pSectionWindow )
            {
                const SdrMarkList& rMarkList = pSectionWindow->getReportSection().getSectionView().GetMarkedObjectList();
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index c7c2ba7..4cddaa3 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -292,6 +292,7 @@ void ScInputWindow::dispose()

    pRuntimeWindow.reset();

    pRuntimeWindow.disposeAndClear();
    ToolBox::dispose();
}

diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index b43d19c..1076f7b 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -55,6 +55,7 @@ ScCondFormatList::~ScCondFormatList()
void ScCondFormatList::dispose()
{
    mpDialogParent.clear();
    mpScrollBar.disposeAndClear();
    Control::dispose();
}

@@ -106,7 +107,7 @@ void ScCondFormatList::init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent,
            }
        }
        if(nCount)
            EntrySelectHdl(&maEntries[0]);
            EntrySelectHdl(maEntries[0].get());
    }
    else
    {
@@ -133,7 +134,7 @@ void ScCondFormatList::init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent,
    }
    RecalcAll();
    if (!maEntries.empty())
        maEntries.begin()->SetActive();
        (*maEntries.begin())->SetActive();

    RecalcAll();
}
@@ -169,7 +170,7 @@ ScConditionalFormat* ScCondFormatList::GetConditionalFormat() const
    ScConditionalFormat* pFormat = new ScConditionalFormat(0, mpDoc);
    for(EntryContainer::const_iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
    {
        ScFormatEntry* pEntry = itr->GetEntry();
        ScFormatEntry* pEntry = (*itr)->GetEntry();
        if(pEntry)
            pFormat->AddEntry(pEntry);
    }
@@ -185,8 +186,8 @@ void ScCondFormatList::RecalcAll()
    sal_Int32 nIndex = 1;
    for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
    {
        nTotalHeight += itr->GetSizePixel().Height();
        itr->SetIndex( nIndex );
        nTotalHeight += (*itr)->GetSizePixel().Height();
        (*itr)->SetIndex( nIndex );
        ++nIndex;
    }

@@ -210,15 +211,15 @@ void ScCondFormatList::RecalcAll()
    Point aPoint(0,-1*mpScrollBar->GetThumbPos());
    for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
    {
        itr->SetPosPixel(aPoint);
        Size aSize = itr->GetSizePixel();
        (*itr)->SetPosPixel(aPoint);
        Size aSize = (*itr)->GetSizePixel();
        if(mbHasScrollBar)
            aSize.Width() = aCtrlSize.Width() - nSrcBarSize;
        else
            aSize.Width() = aCtrlSize.Width();
        itr->SetSizePixel(aSize);
        (*itr)->SetSizePixel(aSize);

        aPoint.Y() += itr->GetSizePixel().Height();
        aPoint.Y() += (*itr)->GetSizePixel().Height();
    }
}

@@ -236,7 +237,7 @@ IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, ListBox*, pBox)
    EntryContainer::iterator itr = maEntries.begin();
    for(; itr != maEntries.end(); ++itr)
    {
        if(itr->IsSelected())
        if((*itr)->IsSelected())
            break;
    }
    if(itr == maEntries.end())
@@ -246,34 +247,34 @@ IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, ListBox*, pBox)
    switch(nPos)
    {
        case 0:
            if(itr->GetType() == condformat::entry::COLORSCALE2)
            if((*itr)->GetType() == condformat::entry::COLORSCALE2)
                return 0;

            maEntries.replace( itr, new ScColorScale2FrmtEntry( this, mpDoc, maPos ) );
            *itr = new ScColorScale2FrmtEntry( this, mpDoc, maPos );
            break;
        case 1:
            if(itr->GetType() == condformat::entry::COLORSCALE3)
            if((*itr)->GetType() == condformat::entry::COLORSCALE3)
                return 0;

            maEntries.replace( itr, new ScColorScale3FrmtEntry( this, mpDoc, maPos ) );
            *itr = new ScColorScale3FrmtEntry( this, mpDoc, maPos );
            break;
        case 2:
            if(itr->GetType() == condformat::entry::DATABAR)
            if((*itr)->GetType() == condformat::entry::DATABAR)
                return 0;

            maEntries.replace( itr, new ScDataBarFrmtEntry( this, mpDoc, maPos ) );
            *itr = new ScDataBarFrmtEntry( this, mpDoc, maPos );
            break;
        case 3:
            if(itr->GetType() == condformat::entry::ICONSET)
            if((*itr)->GetType() == condformat::entry::ICONSET)
                return 0;

            maEntries.replace( itr, new ScIconSetFrmtEntry( this, mpDoc, maPos ) );
            *itr = new ScIconSetFrmtEntry( this, mpDoc, maPos );
            break;
        default:
            break;
    }
    mpDialogParent->InvalidateRefData();
    itr->SetActive();
    (*itr)->SetActive();
    RecalcAll();
    return 0;
}
@@ -293,7 +294,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, ListBox*, pBox)
    EntryContainer::iterator itr = maEntries.begin();
    for(; itr != maEntries.end(); ++itr)
    {
        if(itr->IsSelected())
        if((*itr)->IsSelected())
            break;
    }
    if(itr == maEntries.end())
@@ -303,7 +304,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, ListBox*, pBox)
    switch(nPos)
    {
        case 0:
            switch(itr->GetType())
            switch((*itr)->GetType())
            {
                case condformat::entry::FORMULA:
                case condformat::entry::CONDITION:
@@ -315,33 +316,33 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, ListBox*, pBox)
                case condformat::entry::ICONSET:
                    return 0;
            }
            maEntries.replace( itr, new ScColorScale3FrmtEntry(this, mpDoc, maPos));
            *itr = new ScColorScale3FrmtEntry(this, mpDoc, maPos);
            mpDialogParent->InvalidateRefData();
            itr->SetActive();
            (*itr)->SetActive();
            break;
        case 1:
            if(itr->GetType() == condformat::entry::CONDITION)
            if((*itr)->GetType() == condformat::entry::CONDITION)
                return 0;

            maEntries.replace( itr, new ScConditionFrmtEntry(this, mpDoc, mpDialogParent, maPos));
            *itr = new ScConditionFrmtEntry(this, mpDoc, mpDialogParent, maPos);
            mpDialogParent->InvalidateRefData();
            itr->SetActive();
            (*itr)->SetActive();
            break;
        case 2:
            if(itr->GetType() == condformat::entry::FORMULA)
            if((*itr)->GetType() == condformat::entry::FORMULA)
                return 0;

            maEntries.replace( itr, new ScFormulaFrmtEntry(this, mpDoc, mpDialogParent, maPos));
            *itr = new ScFormulaFrmtEntry(this, mpDoc, mpDialogParent, maPos);
            mpDialogParent->InvalidateRefData();
            itr->SetActive();
            (*itr)->SetActive();
            break;
        case 3:
            if(itr->GetType() == condformat::entry::DATE)
            if((*itr)->GetType() == condformat::entry::DATE)
                return 0;

            maEntries.replace( itr, new ScDateFrmtEntry( this, mpDoc ));
            *itr = new ScDateFrmtEntry( this, mpDoc );
            mpDialogParent->InvalidateRefData();
            itr->SetActive();
            (*itr)->SetActive();
            break;

    }
@@ -355,7 +356,7 @@ IMPL_LINK_NOARG( ScCondFormatList, AddBtnHdl )
    maEntries.push_back( pNewEntry );
    for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
    {
        itr->SetInactive();
        (*itr)->SetInactive();
    }
    mpDialogParent->InvalidateRefData();
    pNewEntry->SetActive();
@@ -367,7 +368,7 @@ IMPL_LINK_NOARG( ScCondFormatList, RemoveBtnHdl )
{
    for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
    {
        if(itr->IsSelected())
        if((*itr)->IsSelected())
        {
            maEntries.erase(itr);
            break;
@@ -388,7 +389,7 @@ IMPL_LINK( ScCondFormatList, EntrySelectHdl, ScCondFrmtEntry*, pEntry )
    bool bReGrabFocus = HasChildPathFocus();
    for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
    {
        itr->SetInactive();
        (*itr)->SetInactive();
    }
    mpDialogParent->InvalidateRefData();
    pEntry->SetActive();
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 49db670..f4f760c 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -1578,11 +1578,11 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, 
                i < n; ++i)
        {
            maEntries.push_back( new ScIconSetFrmtDataEntry( this, eType, pDoc, i, &pIconSetFormatData->maEntries[i] ) );
            Point aPos = maEntries[0].GetPosPixel();
            aPos.Y() += maEntries[0].GetSizePixel().Height() * i * 1.2;
            maEntries[i].SetPosPixel( aPos );
            Point aPos = maEntries[0]->GetPosPixel();
            aPos.Y() += maEntries[0]->GetSizePixel().Height() * i * 1.2;
            maEntries[i]->SetPosPixel( aPos );
        }
        maEntries.begin()->SetFirstEntry();
        maEntries[0]->SetFirstEntry();
    }
    else
        IconSetTypeHdl(NULL);
@@ -1620,12 +1620,12 @@ IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl )
    for(size_t i = 0; i < nElements; ++i)
    {
        maEntries.push_back( new ScIconSetFrmtDataEntry( this, static_cast<ScIconSetType>(nPos), mpDoc, i ) );
        Point aPos = maEntries[0].GetPosPixel();
        aPos.Y() += maEntries[0].GetSizePixel().Height() * i * 1.2;
        maEntries[i].SetPosPixel( aPos );
        maEntries[i].Show();
        Point aPos = maEntries[0]->GetPosPixel();
        aPos.Y() += maEntries[0]->GetSizePixel().Height() * i * 1.2;
        maEntries[i]->SetPosPixel( aPos );
        maEntries[i]->Show();
    }
    maEntries.begin()->SetFirstEntry();
    maEntries[0]->SetFirstEntry();

    SetHeight();
    static_cast<ScCondFormatList*>(GetParent())->RecalcAll();
@@ -1645,7 +1645,7 @@ void ScIconSetFrmtEntry::SetActive()
    for(ScIconSetFrmtDataEntriesType::iterator itr = maEntries.begin(),
            itrEnd = maEntries.end(); itr != itrEnd; ++itr)
    {
        itr->Show();
        (*itr)->Show();
    }

    Select();
@@ -1658,7 +1658,7 @@ void ScIconSetFrmtEntry::SetInactive()
    for(ScIconSetFrmtDataEntriesType::iterator itr = maEntries.begin(),
            itrEnd = maEntries.end(); itr != itrEnd; ++itr)
    {
        itr->Hide();
        (*itr)->Hide();
    }

    Deselect();
@@ -1673,7 +1673,7 @@ ScFormatEntry* ScIconSetFrmtEntry::GetEntry() const
    for(ScIconSetFrmtDataEntriesType::const_iterator itr = maEntries.begin(),
            itrEnd = maEntries.end(); itr != itrEnd; ++itr)
    {
        pData->maEntries.push_back(itr->CreateEntry(mpDoc, maPos));
        pData->maEntries.push_back((*itr)->CreateEntry(mpDoc, maPos));
    }
    pFormat->SetIconSetData(pData);

diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
index 080ddb4..11dc8dd 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -149,7 +149,7 @@ private:
        bool            mbSeparator:1;

        ::boost::shared_ptr<Action> mpAction;
        ::boost::shared_ptr<ScMenuFloatingWindow> mpSubMenuWin;
        VclPtr<ScMenuFloatingWindow> mpSubMenuWin;

        MenuItemData();
    };
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index 7bd9c84..eaf90aa 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -22,8 +22,6 @@
#include "rangelst.hxx"
#include "condformathelper.hxx"

#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/scoped_ptr.hpp>
#include "anyrefdg.hxx"

class ScDocument;
@@ -56,11 +54,11 @@ class ScCondFormatDlg;
class ScCondFormatList : public Control
{
private:
    typedef boost::ptr_vector<ScCondFrmtEntry> EntryContainer;
    typedef std::vector<VclPtr<ScCondFrmtEntry>> EntryContainer;
    EntryContainer maEntries;

    bool mbHasScrollBar;
    boost::scoped_ptr<ScrollBar> mpScrollBar;
    VclPtr<ScrollBar> mpScrollBar;

    ScDocument* mpDoc;
    ScAddress maPos;
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx
index 4d7949d..168b692 100644
--- a/sc/source/ui/inc/condformatdlgentry.hxx
+++ b/sc/source/ui/inc/condformatdlgentry.hxx
@@ -295,7 +295,7 @@ class ScIconSetFrmtEntry : public ScCondFrmtEntry
    // icon set ui elements
    VclPtr<ListBox> maLbIconSetType;

    typedef boost::ptr_vector<ScIconSetFrmtDataEntry> ScIconSetFrmtDataEntriesType;
    typedef std::vector<VclPtr<ScIconSetFrmtDataEntry>> ScIconSetFrmtDataEntriesType;
    ScIconSetFrmtDataEntriesType maEntries;

    virtual OUString GetExpressionString() SAL_OVERRIDE;
diff --git a/sc/source/ui/inc/conflictsdlg.hxx b/sc/source/ui/inc/conflictsdlg.hxx
index 94188c2..3c429d1 100644
--- a/sc/source/ui/inc/conflictsdlg.hxx
+++ b/sc/source/ui/inc/conflictsdlg.hxx
@@ -118,7 +118,7 @@ class ScConflictsDlg : public ModalDialog
{
private:
    VclPtr<SvSimpleTableContainer> m_pLbConflictsContainer;
    boost::scoped_ptr<SvxRedlinTable>    m_pLbConflicts;
    VclPtr<SvxRedlinTable>      m_pLbConflicts;
    VclPtr<PushButton>          m_pBtnKeepMine;
    VclPtr<PushButton>          m_pBtnKeepOther;
    VclPtr<PushButton>          m_pBtnKeepAllMine;
diff --git a/sc/source/ui/inc/datafdlg.hxx b/sc/source/ui/inc/datafdlg.hxx
index 736c719..762b0cd 100644
--- a/sc/source/ui/inc/datafdlg.hxx
+++ b/sc/source/ui/inc/datafdlg.hxx
@@ -20,8 +20,6 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>

#include <boost/ptr_container/ptr_vector.hpp>

#define MAX_DATAFORM_COLS   256
#define MAX_DATAFORM_ROWS   32000

@@ -51,8 +49,8 @@ private:
    SCTAB           nTab;
    bool            bNoSelection;

    boost::ptr_vector<boost::nullable<FixedText> > maFixedTexts;
    boost::ptr_vector<boost::nullable<Edit> > maEdits;
    std::vector<VclPtr<FixedText> > maFixedTexts;
    std::vector<VclPtr<Edit> >      maEdits;

public:
    ScDataFormDlg( vcl::Window* pParent, ScTabViewShell* pTabViewShell);
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 8e7d47b..ef9b850 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -136,10 +136,10 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou

    std::unique_ptr<ScNoteMarker> mpNoteMarker;

    VclPtr<ScFilterListBox>        pFilterBox;
    VclPtr<FloatingWindow>         pFilterFloat;
    std::unique_ptr<ScCheckListMenuWindow> mpAutoFilterPopup;
    std::unique_ptr<ScCheckListMenuWindow> mpDPFieldPopup;
    VclPtr<ScFilterListBox>          pFilterBox;
    VclPtr<FloatingWindow>           pFilterFloat;
    VclPtr<ScCheckListMenuWindow>    mpAutoFilterPopup;
    VclPtr<ScCheckListMenuWindow>    mpDPFieldPopup;
    std::unique_ptr<ScDPFieldButton> mpFilterButton;

    sal_uInt16              nCursorHideCount;
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index db96b99..f846d7b 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -289,7 +289,7 @@ protected:
    bool IsPointerAtResizePos();
private:
    VclPtr<ScPosWnd>  aWndPos;
    std::unique_ptr<ScTextWndBase> pRuntimeWindow;
    VclPtr<ScTextWndBase> pRuntimeWindow;
    ScTextWndBase&  aTextWindow;
    ScInputHandler* pInputHdl;
    OUString        aTextOk;
diff --git a/sc/source/ui/inc/optsolver.hxx b/sc/source/ui/inc/optsolver.hxx
index 8a7d1cec..1a9acfa 100644
--- a/sc/source/ui/inc/optsolver.hxx
+++ b/sc/source/ui/inc/optsolver.hxx
@@ -165,12 +165,12 @@ private:
    bool            mbDlgLostFocus;

    static const sal_uInt16 EDIT_ROW_COUNT = 4;
    ScCursorRefEdit* mpLeftEdit[EDIT_ROW_COUNT];
    VclPtr<ScCursorRefEdit>        mpLeftEdit[EDIT_ROW_COUNT];
    VclPtr<formula::RefButton>     mpLeftButton[EDIT_ROW_COUNT];
    ScCursorRefEdit* mpRightEdit[EDIT_ROW_COUNT];
    VclPtr<ScCursorRefEdit>        mpRightEdit[EDIT_ROW_COUNT];
    VclPtr<formula::RefButton>     mpRightButton[EDIT_ROW_COUNT];
    VclPtr<ListBox>         mpOperator[EDIT_ROW_COUNT];
    VclPtr<PushButton>      mpDelButton[EDIT_ROW_COUNT];
    VclPtr<ListBox>                mpOperator[EDIT_ROW_COUNT];
    VclPtr<PushButton>             mpDelButton[EDIT_ROW_COUNT];

    std::vector<ScOptConditionRow> maConditions;
    long            nScrollPos;
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 37aed55..69f5ef7 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -104,11 +104,11 @@ private:
    FuPoor*             pDrawActual;
    FuPoor*             pDrawOld;

    ScGridWindow*       pGridWin[4];
    ScColBar*           pColBar[2];
    ScRowBar*           pRowBar[2];
    ScOutlineWindow*    pColOutline[2];
    ScOutlineWindow*    pRowOutline[2];
    VclPtr<ScGridWindow>        pGridWin[4];
    VclPtr<ScColBar>            pColBar[2];
    VclPtr<ScRowBar>            pRowBar[2];
    VclPtr<ScOutlineWindow>     pColOutline[2];
    VclPtr<ScOutlineWindow>     pRowOutline[2];
    VclPtr<ScTabSplitter>       pHSplitter;
    VclPtr<ScTabSplitter>       pVSplitter;
    VclPtr<ScTabControl>        pTabControl;
@@ -120,7 +120,7 @@ private:
    VclPtr<ScCornerButton>      aTopButton;
    VclPtr<ScrollBarBox>        aScrollBarBox;

    boost::scoped_ptr<ScHintWindow> mpInputHintWindow; // popup window for data validation
    VclPtr<ScHintWindow>        mpInputHintWindow; // popup window for data validation

    ScPageBreakData*    pPageBreakData;
    std::vector<ScHighlightEntry>   maHighlightRanges;
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index a032722..eaff3e1 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -335,7 +335,7 @@ public:
                    DataFormPutData( SCROW nCurrentRow ,
                                     SCROW nStartRow , SCCOL nStartCol ,
                                     SCROW nEndRow , SCCOL nEndCol ,
                                     boost::ptr_vector<boost::nullable<Edit> >& aEdits,
                                     std::vector<VclPtr<Edit> >& aEdits,
                                     sal_uInt16 aColLength );
    void            UpdateSelectionArea( const ScMarkData& rSel, ScPatternAttr* pAttr = NULL );
                                                // Internal helper functions
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index d75dea9..03e269b 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -448,6 +448,7 @@ ScConflictsDlg::~ScConflictsDlg()
void ScConflictsDlg::dispose()
{
    m_pLbConflictsContainer.clear();
    m_pLbConflicts.disposeAndClear();
    m_pBtnKeepMine.clear();
    m_pBtnKeepOther.clear();
    m_pBtnKeepAllMine.clear();
diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx b/sc/source/ui/miscdlgs/datafdlg.cxx
index fc996c9..2029fcd 100644
--- a/sc/source/ui/miscdlgs/datafdlg.cxx
+++ b/sc/source/ui/miscdlgs/datafdlg.cxx
@@ -157,27 +157,27 @@ ScDataFormDlg::ScDataFormDlg(vcl::Window* pParent, ScTabViewShell* pTabViewShell
                maFixedTexts.push_back( new FixedText(m_pGrid) );
                maEdits.push_back( new Edit(m_pGrid, WB_BORDER) );

                maFixedTexts[nIndex].set_grid_left_attach(0);
                maEdits[nIndex].set_grid_left_attach(1);
                maFixedTexts[nIndex].set_grid_top_attach(nGridRow);
                maEdits[nIndex].set_grid_top_attach(nGridRow);
                maFixedTexts[nIndex]->set_grid_left_attach(0);
                maEdits[nIndex]->set_grid_left_attach(1);
                maFixedTexts[nIndex]->set_grid_top_attach(nGridRow);
                maEdits[nIndex]->set_grid_top_attach(nGridRow);

                maEdits[nIndex].SetWidthInChars(32);
                maEdits[nIndex].set_hexpand(true);
                maEdits[nIndex]->SetWidthInChars(32);
                maEdits[nIndex]->set_hexpand(true);

                ++nGridRow;

                maFixedTexts[nIndex].SetText(aFieldName);
                maFixedTexts[nIndex].Show();
                maEdits[nIndex].Show();
                maFixedTexts[nIndex]->SetText(aFieldName);
                maFixedTexts[nIndex]->Show();
                maEdits[nIndex]->Show();
            }
            else
            {
                maFixedTexts.push_back( NULL );
                maEdits.push_back( NULL );
            }
            if (!maEdits.is_null(nIndex))
                maEdits[nIndex].SetModifyHdl( HDL(Impl_DataModifyHdl) );
            if (maEdits[nIndex] != nullptr)
                maEdits[nIndex]->SetModifyHdl( HDL(Impl_DataModifyHdl) );
        }
    }

@@ -225,15 +225,15 @@ void ScDataFormDlg::FillCtrls(SCROW /*nCurrentRow*/)
{
    for (sal_uInt16 i = 0; i < aColLength; ++i)
    {
        if (!maEdits.is_null(i))
        if (maEdits[i] != nullptr)
        {
            if (nCurrentRow<=nEndRow && pDoc)
            {
                OUString  aFieldName(pDoc->GetString(i + nStartCol, nCurrentRow, nTab));
                maEdits[i].SetText(aFieldName);
                maEdits[i]->SetText(aFieldName);
            }
            else
                maEdits[i].SetText(OUString());
                maEdits[i]->SetText(OUString());
        }
    }

@@ -265,10 +265,10 @@ IMPL_LINK_NOARG(ScDataFormDlg, Impl_NewHdl)
    if ( pDoc )
    {
        bool bHasData = false;
        boost::ptr_vector<Edit>::iterator itr = maEdits.begin(), itrEnd = maEdits.end();
        auto itr = maEdits.begin(), itrEnd = maEdits.end();
        for(; itr != itrEnd; ++itr)
            if (!boost::is_null(itr))
                if ( !(*itr).GetText().isEmpty() )
            if ((*itr) != nullptr)
                if ( !(*itr)->GetText().isEmpty() )
                {
                    bHasData = true;
                    break;
@@ -381,8 +381,8 @@ void ScDataFormDlg::SetButtonState()
        m_pBtnPrev->Enable( true );

    m_pBtnRestore->Enable( false );
    if ( maEdits.size()>=1 && !maEdits.is_null(0) )
        maEdits[0].GrabFocus();
    if ( maEdits.size()>=1 && maEdits[0] != nullptr )
        maEdits[0]->GrabFocus();
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index 6b9d272..fdbef2b 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -662,11 +662,11 @@ IMPL_LINK( ScOptSolverDlg, GetFocusHdl, Control*, pCtrl )
    for ( sal_uInt16 nRow = 0; nRow < EDIT_ROW_COUNT; ++nRow )
    {
        if( pCtrl == mpLeftEdit[nRow] || pCtrl == mpLeftButton[nRow] )
            pEdit = mpEdActive = mpLeftEdit[nRow];
            pEdit = mpEdActive = mpLeftEdit[nRow].get();
        else if( pCtrl == mpRightEdit[nRow] || pCtrl == mpRightButton[nRow] )
            pEdit = mpEdActive = mpRightEdit[nRow];
            pEdit = mpEdActive = mpRightEdit[nRow].get();
        else if( pCtrl == mpOperator[nRow] )    // focus on "operator" list box
            mpEdActive = mpRightEdit[nRow];     // use right edit for ref input, but don't change selection
            mpEdActive = mpRightEdit[nRow].get();     // use right edit for ref input, but don't change selection
    }
    if( pCtrl == m_pRbValue )                   // focus on "Value of" radio button
        mpEdActive = m_pEdTargetValue;          // use value edit for ref input, but don't change selection
@@ -702,7 +702,7 @@ IMPL_LINK( ScOptSolverDlg, DelBtnHdl, PushButton*, pBtn )
                    // If the button is disabled, focus would normally move to the next control,
                    // (left edit of the next row). Move it to left edit of this row instead.

                    mpEdActive = mpLeftEdit[nRow];
                    mpEdActive = mpLeftEdit[nRow].get();
                    mpEdActive->GrabFocus();
                }
            }
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 41ec52f..217cbbd 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -545,9 +545,12 @@ void ScGridWindow::dispose()
    // #114409#
    ImpDestroyOverlayObjects();

    pFilterBox.clear();
    pFilterFloat.clear();
    mpFilterBox.disposeAndClear();
    mpFilterFloat.disposeAndClear();
    delete pNoteMarker;
    mpAutoFilterPopup.disposeAndClear();
    mpDPFieldPopup.disposeAndClear();

    vcl::Window::dispose();
}

diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 57536ed..806ac81 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2231,17 +2231,17 @@ void ScTabView::EnableRefInput(bool bFlag)

    if(pTabControl!=nullptr) pTabControl->EnableInput(bFlag,true);

    if(pGridWin[SC_SPLIT_BOTTOMLEFT]!=NULL)
    if(pGridWin[SC_SPLIT_BOTTOMLEFT]!=nullptr)
        pGridWin[SC_SPLIT_BOTTOMLEFT]->EnableInput(bFlag,false);
    if(pGridWin[SC_SPLIT_BOTTOMRIGHT]!=NULL)
    if(pGridWin[SC_SPLIT_BOTTOMRIGHT]!=nullptr)
        pGridWin[SC_SPLIT_BOTTOMRIGHT]->EnableInput(bFlag,false);
    if(pGridWin[SC_SPLIT_TOPLEFT]!=NULL)
    if(pGridWin[SC_SPLIT_TOPLEFT]!=nullptr)
        pGridWin[SC_SPLIT_TOPLEFT]->EnableInput(bFlag,false);
    if(pGridWin[SC_SPLIT_TOPRIGHT]!=NULL)
    if(pGridWin[SC_SPLIT_TOPRIGHT]!=nullptr)
        pGridWin[SC_SPLIT_TOPRIGHT]->EnableInput(bFlag,false);
    if(pColBar[SC_SPLIT_RIGHT]!=NULL)
    if(pColBar[SC_SPLIT_RIGHT]!=nullptr)
        pColBar[SC_SPLIT_RIGHT]->EnableInput(bFlag,false);
    if(pRowBar[SC_SPLIT_TOP]!=NULL)
    if(pRowBar[SC_SPLIT_TOP]!=nullptr)
        pRowBar[SC_SPLIT_TOP]->EnableInput(bFlag,false);
}

diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index e651d9a..0b5638d 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -178,16 +178,16 @@ ScTabView::~ScTabView()
    // Delete this before the grid windows, since it's a child window of one of them.
    mpInputHintWindow.reset();
    for (i=0; i<4; i++)
        delete pGridWin[i];
        pGridWin[i].disposeAndClear();

    delete pHdrSelEng;

    for (i=0; i<2; i++)
    {
        delete pColBar[i];
        delete pRowBar[i];
        delete pColOutline[i];
        delete pRowOutline[i];
        pColBar[i].disposeAndClear();
        pRowBar[i].disposeAndClear();
        pColOutline[i].disposeAndClear();
        pRowOutline[i].disposeAndClear();
    }

    pHSplitter.disposeAndClear();
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 0fa755d..ed38c24 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1910,7 +1910,7 @@ bool ScViewFunc::LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, b
void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
                                  SCROW nStartRow , SCCOL nStartCol ,
                                  SCROW nEndRow , SCCOL nEndCol ,
                                  boost::ptr_vector<boost::nullable<Edit> >& aEdits,
                                  std::vector<VclPtr<Edit> >& aEdits,
                                  sal_uInt16 aColLength )
{
    ScDocument* pDoc = GetViewData().GetDocument();
@@ -1952,9 +1952,9 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,

        for(sal_uInt16 i = 0; i < aColLength; i++)
        {
            if (!aEdits.is_null(i))
            if (aEdits[i] != nullptr)
            {
                OUString  aFieldName=aEdits[i].GetText();
                OUString  aFieldName=aEdits[i]->GetText();
                pDoc->SetString( nStartCol + i, nCurrentRow, nTab, aFieldName );
            }
        }
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
index 9beb864..f499b83 100644
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
@@ -554,11 +554,11 @@ void CustomAnimationCreateDialog::dispose()
    SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
    pOptions->SetPreviewNewEffects( getCurrentPage()->getIsPreview() );

    delete mpTabPages[ENTRANCE];
    delete mpTabPages[EMPHASIS];
    delete mpTabPages[EXIT];
    delete mpTabPages[MOTIONPATH];
    delete mpTabPages[MISCEFFECTS];
    mpTabPages[ENTRANCE].disposeAndClear();
    mpTabPages[EMPHASIS].disposeAndClear();
    mpTabPages[EXIT].disposeAndClear();
    mpTabPages[MOTIONPATH].disposeAndClear();
    mpTabPages[MISCEFFECTS].disposeAndClear();

    mpTabControl.clear();
    mpPane.clear();
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
index 974b3f3..68a5c81 100644
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
@@ -65,7 +65,7 @@ private:

    VclPtr<TabControl> mpTabControl;

    CustomAnimationCreateTabPage* mpTabPages[5];
    VclPtr<CustomAnimationCreateTabPage> mpTabPages[5];
    sal_uInt16 mnEntranceId, mnEmphasisId, mnExitId, mnMPathId, mnMiscId;
};

diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx
index 3464527..d53c544 100644
--- a/sd/source/ui/annotations/annotationtag.hxx
+++ b/sd/source/ui/annotations/annotationtag.hxx
@@ -79,7 +79,7 @@ protected:
private:
    AnnotationManagerImpl& mrManager;
    css::uno::Reference< css::office::XAnnotation > mxAnnotation;
    std::unique_ptr<AnnotationWindow>               mpAnnotationWindow;
    VclPtr<AnnotationWindow>                        mpAnnotationWindow;
    Color                                           maColor;
    int                                             mnIndex;
    const ::vcl::Font&                              mrFont;
diff --git a/sd/source/ui/dlg/assclass.cxx b/sd/source/ui/dlg/assclass.cxx
index e77375b..7049c5b 100644
--- a/sd/source/ui/dlg/assclass.cxx
+++ b/sd/source/ui/dlg/assclass.cxx
@@ -86,8 +86,8 @@ bool Assistent::GotoPage(const int nPageToGo)
    {
        int nIndex=mnCurrentPage-1;

        std::vector<vcl::Window*>::iterator iter = maPages[nIndex].begin();
        std::vector<vcl::Window*>::iterator iterEnd = maPages[nIndex].end();
        auto iter = maPages[nIndex].begin();
        auto iterEnd = maPages[nIndex].end();

        for(; iter != iterEnd; ++iter)
        {
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.hxx b/sd/source/ui/framework/factories/BasicViewFactory.hxx
index fa62d325..d6251eb 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.hxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.hxx
@@ -34,6 +34,7 @@

#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <vcl/vclptr.hxx>

namespace sd {
class ViewShell;
@@ -104,7 +105,7 @@ private:
    FrameView* mpFrameView;

    class ViewCache;
    ::boost::shared_ptr<vcl::Window> mpWindow;
    VclPtr<vcl::Window> mpWindow;
    ::boost::shared_ptr<ViewCache> mpViewCache;

    css::uno::Reference<css::drawing::framework::XPane> mxLocalPane;
diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx
index 7ef05cc..88c8320 100644
--- a/sd/source/ui/framework/factories/FullScreenPane.cxx
+++ b/sd/source/ui/framework/factories/FullScreenPane.cxx
@@ -135,7 +135,7 @@ void SAL_CALL FullScreenPane::setVisible (const sal_Bool bIsVisible)

    if (mpWindow != nullptr)
        mpWindow->Show(bIsVisible);
    if (mpWorkWindow != 0)
    if (mpWorkWindow != nullptr)
        mpWorkWindow->Show(bIsVisible);
}

@@ -144,7 +144,7 @@ Reference<css::accessibility::XAccessible> SAL_CALL FullScreenPane::getAccessibl
{
    ThrowIfDisposed();

    if (mpWorkWindow != 0)
    if (mpWorkWindow != nullptr)
        return mpWorkWindow->GetAccessible(false);
    else
        return NULL;
diff --git a/sd/source/ui/framework/factories/FullScreenPane.hxx b/sd/source/ui/framework/factories/FullScreenPane.hxx
index 1d7c348..c7f4d3e 100644
--- a/sd/source/ui/framework/factories/FullScreenPane.hxx
+++ b/sd/source/ui/framework/factories/FullScreenPane.hxx
@@ -80,7 +80,7 @@ protected:

private:
    css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
    ::boost::scoped_ptr<WorkWindow> mpWorkWindow;
    VclPtr<WorkWindow> mpWorkWindow;

    void ExtractArguments (
        const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
diff --git a/sd/source/ui/inc/SlideSorter.hxx b/sd/source/ui/inc/SlideSorter.hxx
index ff2d662..a95c96c 100644
--- a/sd/source/ui/inc/SlideSorter.hxx
+++ b/sd/source/ui/inc/SlideSorter.hxx
@@ -55,8 +55,6 @@ class SlotManager;
class Properties;
} } }

typedef ::boost::shared_ptr<sd::Window> SharedSdWindow;

namespace sd { namespace slidesorter {

/** Show previews for all the slides in a document and allow the user to
@@ -98,10 +96,10 @@ public:
    */
    static ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
        ViewShell& rViewShell,
        const ::boost::shared_ptr<sd::Window>& rpContentWindow,
        const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
        const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
        const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
        sd::Window* pContentWindow,
        ScrollBar* pHorizontalScrollBar,
        ScrollBar* pVerticalScrollBar,
        ScrollBarBox* pScrollBarBox);

    /** Create a new slide sorter that is losely coupled to the given view
        shell.  The view shell may even be missing.
@@ -120,21 +118,21 @@ public:

    /** Return the control of the vertical scroll bar.
    */
    ::boost::shared_ptr<ScrollBar> GetVerticalScrollBar (void) const { return mpVerticalScrollBar;}
    ScrollBar* GetVerticalScrollBar (void) const { return mpVerticalScrollBar;}

    /** Return the control of the horizontal scroll bar.
    */
    ::boost::shared_ptr<ScrollBar> GetHorizontalScrollBar (void) const { return mpHorizontalScrollBar;}
    ScrollBar* GetHorizontalScrollBar (void) const { return mpHorizontalScrollBar;}

    /** Return the scroll bar filler that paints the little square that is
        enclosed by the two scroll bars.
    */
    ::boost::shared_ptr<ScrollBarBox> GetScrollBarFiller (void) const { return mpScrollBarBox;}
    ScrollBarBox* GetScrollBarFiller (void) const { return mpScrollBarBox;}

    /** Return the content window.  This is a sibling and is geometrically
        enclosed by the scroll bars.
    */
    SharedSdWindow GetContentWindow (void) const { return mpContentWindow;}
    sd::Window* GetContentWindow (void) const { return mpContentWindow;}

    model::SlideSorterModel& GetModel (void) const;

@@ -222,11 +220,11 @@ private:
    ::com::sun::star::uno::WeakReference<com::sun::star::frame::XController> mxControllerWeak;
    ViewShell* mpViewShell;
    ViewShellBase* mpViewShellBase;
    SharedSdWindow mpContentWindow;
    VclPtr<sd::Window> mpContentWindow;
    bool mbOwnesContentWindow;
    ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
    ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
    ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
    VclPtr<ScrollBar> mpHorizontalScrollBar;
    VclPtr<ScrollBar> mpVerticalScrollBar;
    VclPtr<ScrollBarBox> mpScrollBarBox;

    /** Set this flag to <TRUE/> to force a layout before the next paint.
    */
@@ -240,10 +238,10 @@ private:

    SlideSorter (
        ViewShell& rViewShell,
        const ::boost::shared_ptr<sd::Window>& rpContentWindow,
        const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
        const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
        const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
        sd::Window* pContentWindow,
        ScrollBar* pHorizontalScrollBar,
        ScrollBar* pVerticalScrollBar,
        ScrollBarBox* pScrollBarBox);
    SlideSorter (
        ViewShellBase& rBase,
        ViewShell* pViewShell,
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index f0f643e..1e165c8 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -465,20 +465,20 @@ protected:
        document.
    */

    ::boost::shared_ptr<sd::Window> mpContentWindow;
    VclPtr<sd::Window> mpContentWindow;

    /// Horizontal scroll bar for the current slide is displayed when needed.
    ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
    VclPtr<ScrollBar> mpHorizontalScrollBar;
    /// Vertical scroll bar for whole document is always visible.
    ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
    VclPtr<ScrollBar> mpVerticalScrollBar;
    /// Horizontal ruler is not shown by default.
    ::std::unique_ptr<SvxRuler> mpHorizontalRuler;
    VclPtr<SvxRuler> mpHorizontalRuler;
    /// Vertical ruler is not shown by default.
    ::std::unique_ptr<SvxRuler> mpVerticalRuler;
    VclPtr<SvxRuler> mpVerticalRuler;
    /// Filler of the little square enclosed by the two scroll bars.
    ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
    VclPtr<ScrollBarBox> mpScrollBarBox;
    /// Layer tab bar.
    ::std::unique_ptr<LayerTabBar> mpLayerTabBar;
    VclPtr<LayerTabBar> mpLayerTabBar;

    /// This flag controls whether the rulers are visible.
    bool mbHasRulers;
diff --git a/sd/source/ui/inc/ViewTabBar.hxx b/sd/source/ui/inc/ViewTabBar.hxx
index b259f3f..3c73bd9 100644
--- a/sd/source/ui/inc/ViewTabBar.hxx
+++ b/sd/source/ui/inc/ViewTabBar.hxx
@@ -67,7 +67,7 @@ public:

    virtual void SAL_CALL disposing (void) SAL_OVERRIDE;

    ::boost::shared_ptr< ::TabControl> GetTabControl (void) const { return mpTabControl;}
    ::TabControl* GetTabControl (void) const { return mpTabControl;}

    bool ActivatePage (void);

@@ -149,14 +149,14 @@ public:
        GetTabBarButtons (void);

private:
    ::boost::shared_ptr< ::TabControl> mpTabControl;
    VclPtr< ::TabControl> mpTabControl;
    ::com::sun::star::uno::Reference<
        ::com::sun::star::frame::XController> mxController;
    ::com::sun::star::uno::Reference<
        ::com::sun::star::drawing::framework::XConfigurationController> mxConfigurationController;
    typedef ::std::vector<com::sun::star::drawing::framework::TabBarButton> TabBarButtonList;
    TabBarButtonList maTabBarButtons;
    ::boost::scoped_ptr<TabPage> mpTabPage;
    VclPtr<TabPage> mpTabPage;
    ::com::sun::star::uno::Reference<
        ::com::sun::star::drawing::framework::XResourceId> mxViewTabBarId;
    ViewShellBase* mpViewShellBase;
diff --git a/sd/source/ui/inc/assclass.hxx b/sd/source/ui/inc/assclass.hxx
index 3e95415..6a0709d 100644
--- a/sd/source/ui/inc/assclass.hxx
+++ b/sd/source/ui/inc/assclass.hxx
@@ -33,7 +33,7 @@ class SD_DLLPUBLIC Assistent
{
    /** contains for every page the controls, which have to be
        connected? correctly */
    std::vector<vcl::Window*> maPages[MAX_PAGES];
    std::vector<VclPtr<vcl::Window> > maPages[MAX_PAGES];

    /// number of pages
    int mnPages;
diff --git a/sd/source/ui/sidebar/PanelBase.cxx b/sd/source/ui/sidebar/PanelBase.cxx
index 7ee2a89..611c197 100644
--- a/sd/source/ui/sidebar/PanelBase.cxx
+++ b/sd/source/ui/sidebar/PanelBase.cxx
@@ -43,16 +43,14 @@ PanelBase::~PanelBase (void)

void PanelBase::dispose()
{
    OSL_TRACE("deleting wrapped control at %p", mpWrappedControl.get());
    mpWrappedControl.reset();
    OSL_TRACE("deleting PanelBase at %p from parent %p", this, GetParent());
    mpWrappedControl.disposeAndClear();
    Control::dispose();
}

void PanelBase::Dispose (void)
{
    OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %p", mpWrappedControl.get());
    mpWrappedControl.reset();
    mpWrappedControl.disposeAndClear();
}

css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 /*nWidth*/)
@@ -75,7 +73,7 @@ void PanelBase::Resize (void)
void PanelBase::SetSidebar (const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
{
    mxSidebar = rxSidebar;
    if (mxSidebar.is() && mpWrappedControl!=0)
    if (mxSidebar.is() && mpWrappedControl!=nullptr)
        mxSidebar->requestLayout();
}

diff --git a/sd/source/ui/sidebar/PanelBase.hxx b/sd/source/ui/sidebar/PanelBase.hxx
index d14940f..e6ed405 100644
--- a/sd/source/ui/sidebar/PanelBase.hxx
+++ b/sd/source/ui/sidebar/PanelBase.hxx
@@ -59,7 +59,7 @@ public:
    virtual void SetSidebar (const css::uno::Reference<css::ui::XSidebar>& rxSidebar) SAL_OVERRIDE;

protected:
    ::boost::scoped_ptr< vcl::Window> mpWrappedControl;
    VclPtr< vcl::Window> mpWrappedControl;
    virtual vcl::Window* CreateWrappedControl (
        vcl::Window* pParentWindow,
        ViewShellBase& rViewShellBase) = 0;
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index ad76ae7..ed333f6 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -118,7 +118,7 @@ SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter)
      mnPaintEntranceCount(0),
      mbIsContextMenuOpen(false)
{
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    OSL_ASSERT(pWindow);
    if (pWindow)
    {
@@ -502,7 +502,7 @@ void SlideSorterController::PostModelChange (void)
    mbPostModelChangePending = false;
    mrModel.Resync();

    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow)
    {
        GetCurrentSlideManager()->HandleModelChange();
@@ -541,7 +541,7 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)
    if (pEvent != NULL)
    {
        ::vcl::Window* pWindow = pEvent->GetWindow();
        SharedSdWindow pActiveWindow (mrSlideSorter.GetContentWindow());
        sd::Window *pActiveWindow (mrSlideSorter.GetContentWindow());
        switch (pEvent->GetId())
        {
            case VCLEVENT_WINDOW_ACTIVATE:
@@ -557,12 +557,12 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)

            case VCLEVENT_WINDOW_GETFOCUS:
                if (pActiveWindow)
                    if (pWindow == pActiveWindow.get())
                    if (pWindow == pActiveWindow)
                        GetFocusManager().ShowFocus(false);
                break;

            case VCLEVENT_WINDOW_LOSEFOCUS:
                if (pActiveWindow && pWindow == pActiveWindow.get())
                if (pActiveWindow && pWindow == pActiveWindow)
                {
                    GetFocusManager().HideFocus();
                    mrView.GetToolTip().Hide();
@@ -584,7 +584,7 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)
                    : ViewShell::OUTPUT_DRAWMODE_COLOR);
                if (mrSlideSorter.GetViewShell() != NULL)
                    mrSlideSorter.GetViewShell()->GetFrameView()->SetDrawMode(nDrawMode);
                if (pActiveWindow != 0)
                if (pActiveWindow != nullptr)
                    pActiveWindow->SetDrawMode(nDrawMode);
                mrView.HandleDrawModeChange();

@@ -714,7 +714,7 @@ Rectangle  SlideSorterController::Rearrange (bool bForce)
    else
        mbIsForcedRearrangePending = false;

    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow)
    {
        if (bForce)
@@ -864,7 +864,7 @@ void SlideSorterController::PageNameHasChanged (int nPageIndex, const OUString& 

    // Get a pointer to the corresponding accessible object and notify
    // that of the name change.
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if ( ! pWindow)
        return;

diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
index 3338bfe..00dd465 100644
--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
@@ -87,7 +87,7 @@ void DragAndDropContext::UpdatePosition (
    // Convert window coordinates into model coordinates (we need the
    // window coordinates for auto-scrolling because that remains
    // constant while scrolling.)
    SharedSdWindow pWindow (mpTargetSlideSorter->GetContentWindow());
    sd::Window *pWindow (mpTargetSlideSorter->GetContentWindow());
    const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
    ::boost::shared_ptr<InsertionIndicatorHandler> pInsertionIndicatorHandler (
        mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler());
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
index 971c7e7..2d9e298 100644
--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -72,12 +72,12 @@ ScrollBarManager::~ScrollBarManager (void)

void ScrollBarManager::Connect (void)
{
    if (mpVerticalScrollBar != 0)
    if (mpVerticalScrollBar != nullptr)
    {
        mpVerticalScrollBar->SetScrollHdl (
            LINK(this, ScrollBarManager, VerticalScrollBarHandler));
    }
    if (mpHorizontalScrollBar != 0)
    if (mpHorizontalScrollBar != nullptr)
    {
        mpHorizontalScrollBar->SetScrollHdl(
            LINK(this, ScrollBarManager, HorizontalScrollBarHandler));
@@ -86,11 +86,11 @@ void ScrollBarManager::Connect (void)

void ScrollBarManager::Disconnect (void)
{
    if (mpVerticalScrollBar != 0)
    if (mpVerticalScrollBar != nullptr)
    {
        mpVerticalScrollBar->SetScrollHdl (Link());
    }
    if (mpHorizontalScrollBar != 0)
    if (mpHorizontalScrollBar != nullptr)
    {
        mpHorizontalScrollBar->SetScrollHdl (Link());
    }
@@ -117,13 +117,13 @@ Rectangle ScrollBarManager::PlaceScrollBars (
        bIsHorizontalScrollBarAllowed,
        bIsVerticalScrollBarAllowed));

    if (mpHorizontalScrollBar!=0 && mpHorizontalScrollBar->IsVisible())
    if (mpHorizontalScrollBar!=nullptr && mpHorizontalScrollBar->IsVisible())
        PlaceHorizontalScrollBar (rAvailableArea);

    if (mpVerticalScrollBar!=0 && mpVerticalScrollBar->IsVisible())
    if (mpVerticalScrollBar!=nullptr && mpVerticalScrollBar->IsVisible())
        PlaceVerticalScrollBar (rAvailableArea);

    if (mpScrollBarFiller!=0 && mpScrollBarFiller->IsVisible())
    if (mpScrollBarFiller!=nullptr && mpScrollBarFiller->IsVisible())
        PlaceFiller (rAvailableArea);

    return aRemainingSpace;
@@ -177,12 +177,12 @@ void ScrollBarManager::PlaceFiller (const Rectangle& aArea)
void ScrollBarManager::UpdateScrollBars (bool bResetThumbPosition, bool bUseScrolling)
{
    Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea());
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    Size aWindowModelSize (pWindow->PixelToLogic(pWindow->GetSizePixel()));

    // The horizontal scroll bar is only shown when the window is
    // horizontally smaller than the view.
    if (mpHorizontalScrollBar != 0 && mpHorizontalScrollBar->IsVisible())
    if (mpHorizontalScrollBar != nullptr && mpHorizontalScrollBar->IsVisible())
    {
        mpHorizontalScrollBar->Show();
        mpHorizontalScrollBar->SetRange (
@@ -212,7 +212,7 @@ void ScrollBarManager::UpdateScrollBars (bool bResetThumbPosition, bool bUseScro
    }

    // The vertical scroll bar is always shown.
    if (mpVerticalScrollBar != 0 && mpVerticalScrollBar->IsVisible())
    if (mpVerticalScrollBar != nullptr && mpVerticalScrollBar->IsVisible())
    {
        mpVerticalScrollBar->SetRange (
            Range(aModelArea.Top(), aModelArea.Bottom()));
@@ -291,7 +291,7 @@ void ScrollBarManager::SetWindowOrigin (
    mnHorizontalPosition = nHorizontalPosition;
    mnVerticalPosition = nVerticalPosition;

    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    Size aViewSize (pWindow->GetViewSize());
    Point aOrigin (
        (long int) (mnHorizontalPosition * aViewSize.Width()),
@@ -431,7 +431,7 @@ void ScrollBarManager::SetTopLeft(const Point& rNewTopLeft)

int ScrollBarManager::GetVerticalScrollBarWidth (void) const
{
    if (mpVerticalScrollBar != 0 && mpVerticalScrollBar->IsVisible())
    if (mpVerticalScrollBar != nullptr && mpVerticalScrollBar->IsVisible())
        return mpVerticalScrollBar->GetSizePixel().Width();
    else
        return 0;
@@ -439,7 +439,7 @@ int ScrollBarManager::GetVerticalScrollBarWidth (void) const

int ScrollBarManager::GetHorizontalScrollBarHeight (void) const
{
    if (mpHorizontalScrollBar != 0 && mpHorizontalScrollBar->IsVisible())
    if (mpHorizontalScrollBar != nullptr && mpHorizontalScrollBar->IsVisible())
        return mpHorizontalScrollBar->GetSizePixel().Height();
    else
        return 0;
@@ -447,7 +447,7 @@ int ScrollBarManager::GetHorizontalScrollBarHeight (void) const

void ScrollBarManager::CalcAutoScrollOffset (const Point& rMouseWindowPosition)
{
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());

    int nDx = 0;
    int nDy = 0;
@@ -458,7 +458,7 @@ void ScrollBarManager::CalcAutoScrollOffset (const Point& rMouseWindowPosition)
        pWindow->LogicToPixel(mrSlideSorter.GetView().GetModelArea()));

    if (aWindowSize.Width() > maScrollBorder.Width() * 3
        && mpHorizontalScrollBar != 0
        && mpHorizontalScrollBar != nullptr
        && mpHorizontalScrollBar->IsVisible())
    {
        if (rMouseWindowPosition.X() < maScrollBorder.Width()
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 64ee5ef..7b3160a 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -318,7 +318,7 @@ SelectionFunction::SelectionFunction (
    SfxRequest& rRequest)
    : FuPoor (
        rSlideSorter.GetViewShell(),
        rSlideSorter.GetContentWindow().get(),
        rSlideSorter.GetContentWindow(),
        &rSlideSorter.GetView(),
        rSlideSorter.GetModel().GetDocument(),
        rRequest),
@@ -1384,7 +1384,7 @@ void MultiSelectionModeHandler::UpdatePosition (
    // Convert window coordinates into model coordinates (we need the
    // window coordinates for auto-scrolling because that remains
    // constant while scrolling.)
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));

    bool bDoAutoScroll = bAllowAutoScroll && mrSlideSorter.GetController().GetScrollBarManager().AutoScroll(
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 24712a5..84d84c7 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -190,7 +190,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
        case SID_PRESENTATION_DLG:
            FuSlideShowDlg::Create (
                pShell,
                mrSlideSorter.GetContentWindow().get(),
                mrSlideSorter.GetContentWindow(),
                &mrSlideSorter.GetView(),
                pDocument,
                rRequest);
@@ -199,7 +199,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
        case SID_CUSTOMSHOW_DLG:
            FuCustomShowDlg::Create (
                pShell,
                mrSlideSorter.GetContentWindow().get(),
                mrSlideSorter.GetContentWindow(),
                &mrSlideSorter.GetView(),
                pDocument,
                rRequest);
@@ -208,7 +208,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
        case SID_EXPAND_PAGE:
            FuExpandPage::Create (
                pShell,
                mrSlideSorter.GetContentWindow().get(),
                mrSlideSorter.GetContentWindow(),
                &mrSlideSorter.GetView(),
                pDocument,
                rRequest);
@@ -217,7 +217,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
        case SID_SUMMARY_PAGE:
            FuSummaryPage::Create (
                pShell,
                mrSlideSorter.GetContentWindow().get(),
                mrSlideSorter.GetContentWindow(),
                &mrSlideSorter.GetView(),
                pDocument,
                rRequest);
@@ -263,7 +263,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
        {
            SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
            boost::scoped_ptr<VclAbstractDialog> pDlg(pFact ? pFact->CreateSdPhotoAlbumDialog(
                mrSlideSorter.GetContentWindow().get(),
                mrSlideSorter.GetContentWindow(),
                pDocument) : 0);

            if (pDlg)
@@ -280,7 +280,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
#ifdef ENABLE_SDREMOTE
             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
             VclAbstractDialog* pDlg = pFact ?
                 pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow().get() ) :
                 pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow() ) :
                 0;
             if (pDlg)
                 pDlg->Execute();
@@ -905,7 +905,7 @@ void SlotManager::RenameSlide (void)
            SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
            DBG_ASSERT(pFact, "Dialog creation failed!");
            boost::scoped_ptr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(
                mrSlideSorter.GetContentWindow().get(),
                mrSlideSorter.GetContentWindow(),
                aPageName, aDescr));
            DBG_ASSERT(aNameDlg, "Dialog creation failed!");
            aNameDlg->SetText( aTitle );
diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
index 8ccb110..bbbe5f0 100644
--- a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
@@ -104,7 +104,7 @@ void VisibleAreaManager::MakeVisible (void)
    if (maVisibleRequests.empty())
        return;

    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if ( ! pWindow)
        return;
    const Point aCurrentTopLeft (pWindow->PixelToLogic(Point(0,0)));
@@ -148,7 +148,7 @@ void VisibleAreaManager::MakeVisible (void)

::boost::optional<Point> VisibleAreaManager::GetRequestedTopLeft (void) const
{
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if ( ! pWindow)
        return ::boost::optional<Point>();

diff --git a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
index 594a415..51a4b44 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
@@ -25,7 +25,6 @@
#include <tools/link.hxx>
#include <tools/gen.hxx>
#include <vcl/timer.hxx>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>

class ScrollBar;
@@ -179,12 +178,12 @@ private:
    /** The horizontal scroll bar.  Note that is used but not owned by
        objects of this class.  It is given to the constructor.
    */
    ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
    VclPtr<ScrollBar> mpHorizontalScrollBar;

    /** The vertical scroll bar.  Note that is used but not owned by
        objects of this class.  It is given to the constructor.
    */
    ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
    VclPtr<ScrollBar> mpVerticalScrollBar;

    /// Relative horizontal position of the visible area in the view.
    double mnHorizontalPosition;
@@ -200,7 +199,7 @@ private:
        the bottom right corner left by the two scroll bars (when both are
        visible).
    */
    ::boost::shared_ptr<ScrollBarBox> mpScrollBarFiller;
    VclPtr<ScrollBarBox> mpScrollBarFiller;

    /** The auto scroll timer is used for keep scrolling the window when the
        mouse reaches its border while dragging a selection.  When the mouse
@@ -213,7 +212,7 @@ private:
    /** The content window is the one whose view port is controlled by the
        scroll bars.
    */
    SharedSdWindow mpContentWindow;
    VclPtr<sd::Window> mpContentWindow;

    ::boost::function<void(void)> maAutoScrollFunctor;

diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
index e9ac858..4dc40a6 100644
--- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
@@ -227,7 +227,7 @@ public:
        void Dispose (void);
    private:
        view::SlideSorterView& mrView;
        SharedSdWindow mpWindow;
        VclPtr<sd::Window> mpWindow;
    };

    ToolTip& GetToolTip (void) const;
diff --git a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
index 4402129..a1608ae 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
@@ -64,7 +64,7 @@ public:
    enum Orientation { HORIZONTAL, VERTICAL, GRID };

    Layouter (
        const SharedSdWindow& rpWindow,
        sd::Window *rpWindow,
        const ::boost::shared_ptr<Theme>& rpTheme);
    ~Layouter (void);

@@ -192,7 +192,7 @@ public:

private:
    ::boost::scoped_ptr<Implementation> mpImplementation;
    SharedSdWindow mpWindow;
    VclPtr<sd::Window> mpWindow;
};

/** Collect all values concerning the logical and visual properties of the
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
index 56d3803..684c158 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
@@ -48,7 +48,7 @@ public:
    PageObjectLayouter(
        const Size& rPageObjectWindowSize,
        const Size& rPreviewModelSize,
        const SharedSdWindow& rpWindow,
        sd::Window *pWindow,
        const sal_Int32 nPageCount);
    ~PageObjectLayouter(void);

@@ -125,7 +125,7 @@ private:
        const CoordinateSystem eCoordinateSystem);

private:
    SharedSdWindow mpWindow;
    VclPtr<sd::Window> mpWindow;
    Size maPageObjectSize;
    Rectangle maFocusIndicatorBoundingBox;
    Rectangle maPageObjectBoundingBox;
diff --git a/sd/source/ui/slidesorter/shell/SlideSorter.cxx b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
index 9790dbc3..24090e6 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorter.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
@@ -71,18 +71,18 @@ private:

::boost::shared_ptr<SlideSorter> SlideSorter::CreateSlideSorter(
    ViewShell& rViewShell,
    const ::boost::shared_ptr<sd::Window>& rpContentWindow,
    const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
    const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
    const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox)
    sd::Window* pContentWindow,
    ScrollBar* pHorizontalScrollBar,
    ScrollBar* pVerticalScrollBar,
    ScrollBarBox* pScrollBarBox)
{
    ::boost::shared_ptr<SlideSorter> pSlideSorter(
        new SlideSorter(
            rViewShell,
            rpContentWindow,
            rpHorizontalScrollBar,
            rpVerticalScrollBar,
            rpScrollBarBox));
            pContentWindow,
            pHorizontalScrollBar,
            pVerticalScrollBar,
            pScrollBarBox));
    pSlideSorter->Init();
    return pSlideSorter;
}
@@ -103,10 +103,10 @@ private:

SlideSorter::SlideSorter (
    ViewShell& rViewShell,
    const ::boost::shared_ptr<sd::Window>& rpContentWindow,
    const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
    const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
    const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox)
    sd::Window* pContentWindow,
    ScrollBar* pHorizontalScrollBar,
    ScrollBar* pVerticalScrollBar,
    ScrollBarBox* pScrollBarBox)
    : mbIsValid(false),
      mpSlideSorterController(),
      mpSlideSorterModel(),
@@ -114,11 +114,11 @@ SlideSorter::SlideSorter (
      mxControllerWeak(),
      mpViewShell(&rViewShell),
      mpViewShellBase(&rViewShell.GetViewShellBase()),
      mpContentWindow(rpContentWindow),
      mpContentWindow(pContentWindow),
      mbOwnesContentWindow(false),
      mpHorizontalScrollBar(rpHorizontalScrollBar),
      mpVerticalScrollBar(rpVerticalScrollBar),
      mpScrollBarBox(rpScrollBarBox),
      mpHorizontalScrollBar(pHorizontalScrollBar),
      mpVerticalScrollBar(pVerticalScrollBar),
      mpScrollBarBox(pScrollBarBox),
      mbLayoutPending(true),
      mpProperties(new controller::Properties()),
      mpTheme(new view::Theme(mpProperties))
@@ -170,7 +170,7 @@ void SlideSorter::Init (void)
    SetupListeners ();

    // Initialize the window.
    SharedSdWindow pContentWindow (GetContentWindow());
    sd::Window *pContentWindow (GetContentWindow());
    if (pContentWindow)
    {
        ::vcl::Window* pParentWindow = pContentWindow->GetParent();
@@ -211,18 +211,6 @@ SlideSorter::~SlideSorter (void)
    mpHorizontalScrollBar.reset();
    mpVerticalScrollBar.reset();
    mpScrollBarBox.reset();

    if (mbOwnesContentWindow)
    {
        OSL_ASSERT(mpContentWindow.unique());
    }
    else
    {
        // Assume that outside this class only the owner holds a reference
        // to the content window.
        OSL_ASSERT(mpContentWindow.use_count()==2);
    }
    mpContentWindow.reset();
}

model::SlideSorterModel& SlideSorter::GetModel (void) const
@@ -253,7 +241,7 @@ void SlideSorter::Paint (const Rectangle& rRepaintArea)
{
    GetController().Paint(
        rRepaintArea,
        GetContentWindow().get());
        GetContentWindow());
}

void SlideSorter::SetupControls (::vcl::Window* )
@@ -263,7 +251,7 @@ void SlideSorter::SetupControls (::vcl::Window* )

void SlideSorter::SetupListeners (void)
{
    SharedSdWindow pWindow (GetContentWindow());
    sd::Window *pWindow (GetContentWindow());
    if (pWindow)
    {
        ::vcl::Window* pParentWindow = pWindow->GetParent();
@@ -292,7 +280,7 @@ void SlideSorter::ReleaseListeners (void)
{
    mpSlideSorterController->GetScrollBarManager().Disconnect();

    SharedSdWindow pWindow (GetContentWindow());
    sd::Window *pWindow (GetContentWindow());
    if (pWindow)
    {
        pWindow->RemoveEventListener(
@@ -425,7 +413,7 @@ void SlideSorter::SetCurrentFunction (const rtl::Reference<FuPoor>& rpFunction)
    }
    else
    {
        ContentWindow* pWindow = dynamic_cast<ContentWindow*>(GetContentWindow().get());
        ContentWindow* pWindow = dynamic_cast<ContentWindow*>(GetContentWindow());
        if (pWindow != NULL)
            pWindow->SetCurrentFunction(rpFunction);
    }
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 8f74250..751e699 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -181,7 +181,7 @@ void SlideSorterViewShell::Initialize (void)
    // the new view shell.  (One is created earlier while the construtor
    // of the base class is executed.  At that time the correct
    // accessibility object can not be constructed.)
    SharedSdWindow pWindow (mpSlideSorter->GetContentWindow());
    sd::Window *pWindow (mpSlideSorter->GetContentWindow());
    if (pWindow)
    {
        pWindow->Hide();
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index 7b60a29..bde3241 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -131,7 +131,7 @@ TYPEINIT1(SlideSorterView, ::sd::View);
SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
    : ::sd::View (
          *rSlideSorter.GetModel().GetDocument(),
          rSlideSorter.GetContentWindow().get(),
          rSlideSorter.GetContentWindow(),
          rSlideSorter.GetViewShell()),
      mrSlideSorter(rSlideSorter),
      mrModel(rSlideSorter.GetModel()),
@@ -216,7 +216,7 @@ sal_Int32 SlideSorterView::GetPageIndexAtPoint (const Point& rWindowPosition) co
{
    sal_Int32 nIndex (-1);

    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow)
    {
        nIndex = mpLayouter->GetIndexAtPoint(pWindow->PixelToLogic(rWindowPosition), false, false);
@@ -316,7 +316,7 @@ void SlideSorterView::Rearrange (void)
    if (mrModel.GetPageCount() <= 0)
        return;

    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if ( ! pWindow)
        return;
    const Size aWindowSize (pWindow->GetSizePixel());
@@ -347,7 +347,7 @@ void SlideSorterView::UpdateOrientation (void)
    else
    {
        // Get access to the docking window.
        vcl::Window* pWindow = mrSlideSorter.GetContentWindow().get();
        vcl::Window* pWindow = mrSlideSorter.GetContentWindow();
        PaneDockingWindow* pDockingWindow = NULL;
        while (pWindow!=NULL && pDockingWindow==NULL)
        {
@@ -408,7 +408,7 @@ void SlideSorterView::UpdateOrientation (void)

void SlideSorterView::Layout ()
{
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow)
    {
        // Set the model area, i.e. the smallest rectangle that includes all
@@ -450,7 +450,7 @@ void SlideSorterView::InvalidatePageObjectVisibilities (void)

void SlideSorterView::DeterminePageObjectVisibilities (void)
{
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow)
    {
        // Set this flag to true here so that an invalidate during the
@@ -547,7 +547,7 @@ bool SlideSorterView::SetOrientation (const Layouter::Orientation eOrientation)

void SlideSorterView::RequestRepaint (void)
{
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow)
    {
        mpLayeredDevice->InvalidateAllLayers(
@@ -566,7 +566,7 @@ void SlideSorterView::RequestRepaint (const model::SharedPageDescriptor& rpDescr

void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)
{
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow)
    {
        mpLayeredDevice->InvalidateAllLayers(rRepaintBox);
@@ -576,7 +576,7 @@ void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)

void SlideSorterView::RequestRepaint (const vcl::Region& rRepaintRegion)
{
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow)
    {
        mpLayeredDevice->InvalidateAllLayers(rRepaintRegion);
@@ -612,7 +612,7 @@ void SlideSorterView::CompleteRedraw (
        mnLockRedrawSmph ? "locked" : "");
#endif

    if (pDevice == NULL || pDevice!=mrSlideSorter.GetContentWindow().get())
    if (pDevice == NULL || pDevice!=mrSlideSorter.GetContentWindow())
        return;

    // The parent implementation of CompleteRedraw is called only when
@@ -700,7 +700,7 @@ void SlideSorterView::ConfigurationChanged (

::boost::shared_ptr<cache::PageCache> SlideSorterView::GetPreviewCache (void)
{
    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow && mpPreviewCache.get() == NULL)
    {
        mpPreviewCache.reset(
@@ -775,7 +775,7 @@ void SlideSorterView::UpdatePageUnderMouse ()
        return;
    }

    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (pWindow && pWindow->IsVisible() && ! pWindow->IsMouseCaptured())
    {
        const Window::PointerState aPointerState (pWindow->GetPointerState());
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
index 8fb9eba..6a5c7c7 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
@@ -43,7 +43,7 @@ public:
    virtual model::SlideSorterModel& GetModel (void) const = 0;
    virtual view::SlideSorterView& GetView (void) const = 0;
    virtual ::boost::shared_ptr<controller::Animator> GetAnimator (void) = 0;
    virtual SharedSdWindow GetContentWindow (void) = 0;
    virtual sd::Window *GetContentWindow (void) = 0;

protected:
    ~AnimatorAccess() {}
@@ -128,7 +128,7 @@ public:
    virtual model::SlideSorterModel& GetModel (void) const SAL_OVERRIDE { return mrModel; }
    virtual view::SlideSorterView& GetView (void) const SAL_OVERRIDE { return mrView; }
    virtual ::boost::shared_ptr<controller::Animator> GetAnimator (void) SAL_OVERRIDE { return mpAnimator; }
    virtual SharedSdWindow GetContentWindow (void) SAL_OVERRIDE { return mrSlideSorter.GetContentWindow(); }
    virtual sd::Window *GetContentWindow (void) SAL_OVERRIDE { return mrSlideSorter.GetContentWindow(); }

private:
    model::SlideSorterModel& mrModel;
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
index 0916912..9b992ee 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
@@ -38,10 +38,10 @@ class LayerInvalidator : public ILayerInvalidator
public:
    LayerInvalidator (
        const ::boost::shared_ptr<LayeredDevice>& rpLayeredDevice,
        const SharedSdWindow& rpTargetWindow,
        sd::Window *pTargetWindow,
        const int nLayer)
        : mpLayeredDevice(rpLayeredDevice),
          mpTargetWindow(rpTargetWindow),
          mpTargetWindow(pTargetWindow),
          mnLayer(nLayer)
    {
    }
@@ -58,7 +58,7 @@ public:

private:
    const ::boost::shared_ptr<LayeredDevice> mpLayeredDevice;
    SharedSdWindow mpTargetWindow;
    VclPtr<sd::Window> mpTargetWindow;
    const int mnLayer;
};

@@ -107,7 +107,7 @@ public:
    Layer (void);
    ~Layer (void);

    void Initialize (const SharedSdWindow& rpTargetWindow);
    void Initialize (sd::Window *pTargetWindow);
    void InvalidateRectangle (const Rectangle& rInvalidationBox);
    void InvalidateRegion (const vcl::Region& rInvalidationRegion);
    void Validate (const MapMode& rMapMode);
@@ -159,11 +159,11 @@ private:

//===== LayeredDevice =========================================================

LayeredDevice::LayeredDevice (const SharedSdWindow& rpTargetWindow)
    : mpTargetWindow(rpTargetWindow),
LayeredDevice::LayeredDevice (sd::Window* pTargetWindow)
    : mpTargetWindow(pTargetWindow),
      mpLayers(new LayerContainer()),
      mpBackBuffer(new VirtualDevice(*mpTargetWindow)),
      maSavedMapMode(rpTargetWindow->GetMapMode())
      maSavedMapMode(pTargetWindow->GetMapMode())
{
    mpBackBuffer->SetOutputSizePixel(mpTargetWindow->GetSizePixel());
}
@@ -379,15 +379,15 @@ Layer::~Layer (void)
{
}

void Layer::Initialize (const SharedSdWindow& rpTargetWindow)
void Layer::Initialize (sd::Window *pTargetWindow)
{
#if 0
    (void)rpTargetWindow;
    (void)pTargetWindow;
#else
    if ( ! mpLayerDevice)
    {
        mpLayerDevice.reset(new VirtualDevice(*rpTargetWindow));
        mpLayerDevice->SetOutputSizePixel(rpTargetWindow->GetSizePixel());
        mpLayerDevice.reset(new VirtualDevice(*pTargetWindow));
        mpLayerDevice->SetOutputSizePixel(pTargetWindow->GetSizePixel());
    }
#endif
}
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
index 4540743..90156c5 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
@@ -45,7 +45,7 @@ class LayeredDevice

{
public:
    LayeredDevice (const SharedSdWindow& rpTargetWindow);
    LayeredDevice (sd::Window *pTargetWindow);
    ~LayeredDevice (void);

    void Invalidate (
@@ -72,7 +72,7 @@ public:
    void Dispose (void);

private:
    SharedSdWindow mpTargetWindow;
    VclPtr<sd::Window> mpTargetWindow;
    class LayerContainer;
    ::boost::scoped_ptr<LayerContainer> mpLayers;
    ::boost::scoped_ptr<VirtualDevice> mpBackBuffer;
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index 155652f..f5cd055 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -29,7 +29,7 @@ namespace sd { namespace slidesorter { namespace view {
class Layouter::Implementation
{
public:
    SharedSdWindow mpWindow;
    VclPtr<sd::Window> mpWindow;
    sal_Int32 mnRequestedLeftBorder;
    sal_Int32 mnRequestedRightBorder;
    sal_Int32 mnRequestedTopBorder;
@@ -200,7 +200,7 @@ public:

protected:
    Implementation (
        const SharedSdWindow& rpWindow,
        sd::Window *pWindow,
        const ::boost::shared_ptr<view::Theme>& rpTheme);
    Implementation (const Implementation& rImplementation);

@@ -271,7 +271,7 @@ class GridImplementation : public Layouter::Implementation
{
public:
    GridImplementation (
        const SharedSdWindow& rpWindow,
        sd::Window *pWindow,
        const ::boost::shared_ptr<view::Theme>& rpTheme);
    GridImplementation (const Implementation& rImplementation);

@@ -292,10 +292,10 @@ protected:
//===== Layouter ==============================================================

Layouter::Layouter (
    const SharedSdWindow& rpWindow,
    sd::Window *pWindow,
    const ::boost::shared_ptr<Theme>& rpTheme)
    : mpImplementation(new GridImplementation(rpWindow, rpTheme)),
      mpWindow(rpWindow)
    : mpImplementation(new GridImplementation(pWindow, rpTheme)),
      mpWindow(pWindow)
{
}

@@ -427,9 +427,9 @@ Layouter::Implementation* Layouter::Implementation::Create (
}

Layouter::Implementation::Implementation (
    const SharedSdWindow& rpWindow,
    sd::Window *pWindow,
    const ::boost::shared_ptr<view::Theme>& rpTheme)
    : mpWindow(rpWindow),
    : mpWindow(pWindow),
      mnRequestedLeftBorder(5),
      mnRequestedRightBorder(5),
      mnRequestedTopBorder(5),
@@ -1102,9 +1102,9 @@ void VerticalImplementation::CalculateLogicalInsertPosition (
//===== GridImplementation ================================================

GridImplementation::GridImplementation (
    const SharedSdWindow& rpWindow,
    sd::Window *pWindow,
    const ::boost::shared_ptr<view::Theme>& rpTheme)
    : Implementation(rpWindow, rpTheme)
    : Implementation(pWindow, rpTheme)
{
}

diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
index 7d82198..b0a1c5d 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
@@ -38,9 +38,9 @@ const static sal_Int32 gnInfoAreaMinWidth = 26;
PageObjectLayouter::PageObjectLayouter (
    const Size& rPageObjectWindowSize,
    const Size& rPageSize,
    const SharedSdWindow& rpWindow,
    sd::Window *pWindow,
    const sal_Int32 nPageCount)
    : mpWindow(rpWindow),
    : mpWindow(pWindow),
      maPageObjectSize(rPageObjectWindowSize.Width(), rPageObjectWindowSize.Height()),
      maPageObjectBoundingBox(),
      maPageNumberAreaBoundingBox(),
@@ -48,7 +48,7 @@ PageObjectLayouter::PageObjectLayouter (
      maTransitionEffectBoundingBox(),
      maTransitionEffectIcon(IconCache::Instance().GetIcon(BMP_FADE_EFFECT_INDICATOR)),
      maCustomAnimationEffectIcon(IconCache::Instance().GetIcon(BMP_CUSTOM_ANIMATION_INDICATOR)),
      mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *rpWindow))
      mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *pWindow))
{
    const Size aPageNumberAreaSize (GetPageNumberAreaSize(nPageCount));

diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
index 954052c..c86694b 100644
--- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx
+++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
@@ -37,7 +37,7 @@ ToolTip::ToolTip (SlideSorter& rSlideSorter)
      maShowTimer(),
      maHiddenTimer()
{
    SharedSdWindow window = rSlideSorter.GetContentWindow();
    sd::Window *window = rSlideSorter.GetContentWindow();
    const HelpSettings& rHelpSettings = window->GetSettings().GetHelpSettings();
    maShowTimer.SetTimeout(rHelpSettings.GetTipDelay());
    maShowTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger));
@@ -109,7 +109,7 @@ void ToolTip::DoShow (void)
        return;
    }

    SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
    sd::Window *pWindow (mrSlideSorter.GetContentWindow());
    if (!msCurrentHelpText.isEmpty() && pWindow)
    {
        Rectangle aBox (
@@ -124,7 +124,7 @@ void ToolTip::DoShow (void)
        if (aBox.Bottom() >= pWindow->GetSizePixel().Height())
            return;

        vcl::Window* pParent (pWindow.get());
        vcl::Window* pParent (pWindow);
        while (pParent!=NULL && pParent->GetParent()!=NULL)
            pParent = pParent->GetParent();
        const Point aOffset (pWindow->GetWindowExtentsRelative(pParent).TopLeft());
@@ -135,7 +135,7 @@ void ToolTip::DoShow (void)
        // tip at the top of a rectangle that is placed below the preview.
        aBox.Move(aOffset.X(), aOffset.Y() + aBox.GetHeight() + 3);
        mnHelpWindowHandle = Help::ShowTip(
            pWindow.get(),
            pWindow,
            aBox,
            msCurrentHelpText,
            QUICKHELP_CENTER | QUICKHELP_TOP);
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
index ba109d6..fe2dc24 100644
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
@@ -65,7 +65,7 @@ void ViewCacheContext::NotifyPreviewCreation (

bool ViewCacheContext::IsIdle (void)
{
    sal_Int32 nIdleState (tools::IdleDetection::GetIdleState(mrSlideSorter.GetContentWindow().get()));
    sal_Int32 nIdleState (tools::IdleDetection::GetIdleState(mrSlideSorter.GetContentWindow()));
    if (nIdleState == tools::IdleDetection::IDET_IDLE)
        return true;
    else
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 21a9197..bba59e83 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -139,7 +139,7 @@ public:
        the content window.
        It does not include the ViewTabBar.
    */
    ::boost::scoped_ptr< vcl::Window> mpViewWindow;
    VclPtr<vcl::Window> mpViewWindow;
    ::boost::shared_ptr<ToolBarManager> mpToolBarManager;
    ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
    ::boost::shared_ptr<tools::EventMultiplexer> mpEventMultiplexer;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 28e78f7..b1e2917 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -89,6 +89,11 @@ void Deck::dispose()
        maPanels[i]->dispose();

    maPanels.clear();
    mpTitleBar.disposeAndClear();
    mpScrollClipWindow.disposeAndClear();
    mpScrollContainer.disposeAndClear();
    mpFiller.disposeAndClear();
    mpVerticalScrollBar.disposeAndClear();
    vcl::Window::dispose();
}

@@ -105,7 +110,6 @@ void Deck::Dispose (void)
        if (*iPanel)
        {
            (*iPanel)->Dispose();
            OSL_ASSERT(iPanel->unique());
            iPanel->reset();
        }
    }
diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx
index 93623fc..6aaeabe 100644
--- a/sfx2/source/sidebar/Deck.hxx
+++ b/sfx2/source/sidebar/Deck.hxx
@@ -89,11 +89,11 @@ private:
    Image maIcon;
    sal_Int32 mnMinimalWidth;
    SharedPanelContainer maPanels;
    ::boost::scoped_ptr<DeckTitleBar> mpTitleBar;
    ::boost::scoped_ptr<vcl::Window> mpScrollClipWindow;
    ::boost::scoped_ptr<ScrollContainerWindow> mpScrollContainer;
    ::boost::scoped_ptr<vcl::Window> mpFiller;
    ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar;
    VclPtr<DeckTitleBar> mpTitleBar;
    VclPtr<vcl::Window> mpScrollClipWindow;
    VclPtr<ScrollContainerWindow> mpScrollContainer;
    VclPtr<vcl::Window> mpFiller;
    VclPtr<ScrollBar> mpVerticalScrollBar;

    DECL_LINK(HandleVerticalScrollBarChange,void*);
    bool ProcessWheelEvent(CommandEvent* pCommandEvent);
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 984b61b..5146170 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -43,7 +43,7 @@ namespace {
    class LayoutItem
    {
    public:
        SharedPanel mpPanel;
        VclPtr<Panel> mpPanel;
        css::ui::LayoutSize maLayoutSize;
        sal_Int32 mnDistributedHeight;
        sal_Int32 mnWeight;
@@ -348,7 +348,7 @@ void GetRequestedSizes (
    IterateLayoutItems(iItem,rLayoutItems)
    {
        ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0));
        if (iItem->mpPanel != 0)
        if (iItem->mpPanel != nullptr)
        {
            if (rLayoutItems.size() == 1
                && iItem->mpPanel->IsTitleBarOptional())
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index 7d762ea..086999e 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -77,6 +77,7 @@ Panel::~Panel()
void Panel::dispose()
{
    Dispose();
    mpTitleBar.disposeAndClear();
    vcl::Window::dispose();
}

diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx
index dd06ddf..edacf7e 100644
--- a/sfx2/source/sidebar/Panel.hxx
+++ b/sfx2/source/sidebar/Panel.hxx
@@ -68,7 +68,7 @@ public:

private:
    const ::rtl::OUString msPanelId;
    ::boost::scoped_ptr<PanelTitleBar> mpTitleBar;
    VclPtr<PanelTitleBar> mpTitleBar;
    const bool mbIsTitleBarOptional;
    css::uno::Reference<css::ui::XUIElement> mxElement;
    css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
@@ -76,8 +76,7 @@ private:
    const ::boost::function<void(void)> maDeckLayoutTrigger;
    const ::boost::function<Context(void)> maContextAccess;
};
typedef ::boost::shared_ptr<Panel> SharedPanel;
typedef ::std::vector<SharedPanel> SharedPanelContainer;
typedef ::std::vector< VclPtr< Panel > > SharedPanelContainer;

} } // end of namespace sfx2::sidebar

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 8074032..9f78d58 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -292,7 +292,7 @@ void SidebarController::NotifyResize (void)
{
    if (mpTabBar == 0)
    {
        OSL_ASSERT(mpTabBar!=0);
        OSL_ASSERT(mpTabBar!=nullptr);
        return;
    }

@@ -621,10 +621,12 @@ void SidebarController::SwitchToDeck (
        }
        else
        {
            iPanel = ::std::find_if(
                rCurrentPanels.begin(),
                rCurrentPanels.end(),
                ::boost::bind(&Panel::HasIdPredicate, _1, ::boost::cref(rPanelContexDescriptor.msId)));
            for (auto a = rCurrentPanels.begin(); a != rCurrentPanels.end(); ++a)
            {
                iPanel = a;
                if ((*iPanel)->HasIdPredicate(rPanelContexDescriptor.msId))
                    break;
            }
        }
        if (iPanel != rCurrentPanels.end())
        {
@@ -643,7 +645,7 @@ void SidebarController::SwitchToDeck (
                rContext);
            bHasPanelSetChanged = true;
        }
        if (aNewPanels[nWriteIndex] != 0)
        if (aNewPanels[nWriteIndex] != nullptr)
        {
            // Depending on the context we have to change the command
            // for the "more options" dialog.
@@ -684,7 +686,7 @@ void SidebarController::SwitchToDeck (
    UpdateTitleBarIcons();
}

SharedPanel SidebarController::CreatePanel (
Panel* SidebarController::CreatePanel (
    const OUString& rsPanelId,
    vcl::Window* pParentWindow,
    const bool bIsInitiallyExpanded,
@@ -692,15 +694,15 @@ SharedPanel SidebarController::CreatePanel (
{
    const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
    if (pPanelDescriptor == NULL)
        return SharedPanel();
        return NULL;

    // Create the panel which is the parent window of the UIElement.
    SharedPanel pPanel (new Panel(
    Panel *pPanel = new Panel(
        *pPanelDescriptor,
        pParentWindow,
        bIsInitiallyExpanded,
        ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
        ::boost::bind(&SidebarController::GetCurrentContext, this)));
        ::boost::bind(&SidebarController::GetCurrentContext, this));

    // Create the XUIElement.
    Reference<ui::XUIElement> xUIElement (CreateUIElement(
@@ -715,7 +717,7 @@ SharedPanel SidebarController::CreatePanel (
    }
    else
    {
        pPanel.reset();
        pPanel = NULL;
    }

    return pPanel;
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 340aba5..68f634d 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -144,9 +144,9 @@ private:
    > SidebarControllerContainer;
    static SidebarControllerContainer maSidebarControllerContainer;

    ::boost::scoped_ptr<Deck> mpCurrentDeck;
    VclPtr<Deck> mpCurrentDeck;
    VclPtr<SidebarDockingWindow> mpParentWindow;
    ::boost::scoped_ptr<TabBar> mpTabBar;
    VclPtr<TabBar> mpTabBar;
    css::uno::Reference<css::frame::XFrame> mxFrame;
    Context maCurrentContext;
    Context maRequestedContext;
@@ -186,7 +186,7 @@ private:
        to indicate that when the current mouse drag operation ends, the
        sidebar will only show the tab bar.
    */
    ::boost::scoped_ptr<vcl::Window> mpCloseIndicator;
    VclPtr<vcl::Window> mpCloseIndicator;

    DECL_LINK(WindowEventHandler, VclWindowEvent*);
    /** Make maRequestedContext the current context.
@@ -198,7 +198,7 @@ private:
        const ::rtl::OUString& rsImplementationURL,
        const bool bWantsCanvas,
        const Context& rContext);
    SharedPanel CreatePanel (
    Panel* CreatePanel (
        const ::rtl::OUString& rsPanelId,
        vcl::Window* pParentWindow,
        const bool bIsInitiallyExpanded,
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index f765972..795b916 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -71,6 +71,7 @@ void TabBar::dispose()
{
    maItems.clear();
    mpMenuButton.reset();
    mpMenuButton.disposeAndClear();
    vcl::Window::dispose();
}

@@ -184,7 +185,7 @@ void TabBar::Layout (void)
        Theme::GetInteger(Theme::Int_TabItemHeight) * GetDPIScaleFactor());

    // Place the menu button and the separator.
    if (mpMenuButton != 0)
    if (mpMenuButton != nullptr)
    {
        mpMenuButton->SetPosSizePixel(
            Point(nX,nY),
diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx
index 47436dc..31778a5 100644
--- a/sfx2/source/sidebar/TabBar.hxx
+++ b/sfx2/source/sidebar/TabBar.hxx
@@ -94,12 +94,12 @@ public:

private:
    css::uno::Reference<css::frame::XFrame> mxFrame;
    ::boost::scoped_ptr<CheckBox> mpMenuButton;
    VclPtr<CheckBox> mpMenuButton;
    class Item
    {
    public:
        DECL_LINK(HandleClick, Button*);
        ::boost::shared_ptr<RadioButton> mpButton;
        VclPtr<RadioButton> mpButton;
        ::rtl::OUString msDeckId;
        ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
        bool mbIsHidden;
diff --git a/slideshow/source/engine/shapes/viewmediashape.hxx b/slideshow/source/engine/shapes/viewmediashape.hxx
index a512a96..1dc8f32 100644
--- a/slideshow/source/engine/shapes/viewmediashape.hxx
+++ b/slideshow/source/engine/shapes/viewmediashape.hxx
@@ -26,6 +26,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
#include <vcl/vclptr.hxx>

#include "viewlayer.hxx"

@@ -147,8 +148,8 @@ namespace slideshow
                                                     const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams,
                                                     const OUString& rMimeType );
            ViewLayerSharedPtr                    mpViewLayer;
            ::std::unique_ptr< SystemChildWindow >  mpMediaWindow;
            boost::scoped_ptr< ::vcl::Window >    mpEventHandlerParent;
            VclPtr< SystemChildWindow >  mpMediaWindow;
            VclPtr< ::vcl::Window >    mpEventHandlerParent;
            mutable ::com::sun::star::awt::Point  maWindowOffset;
            mutable ::basegfx::B2DRectangle       maBounds;

diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index b075e0d..c29d85c 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -96,7 +96,7 @@ class SmElementsControl : public Control
    SmElementList maElementList;
    Size          maMaxElementDimensions;
    bool          mbVerticalMode;
    std::unique_ptr<ScrollBar> mxScroll;
    VclPtr< ScrollBar > mxScroll;

    void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);

diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 1797c9a..4ead686 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -244,6 +244,7 @@ SmElementsControl::~SmElementsControl()
void SmElementsControl::dispose()
{
    mpDocShell->DoClose();
    mpScroll.disposeAndClear();
    Control::dispose();
}

diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index b71113a..40a6157 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -449,8 +449,8 @@ void AssignmentPersistentData::ImplCommit()

    struct AddressBookSourceDialogData
    {
        FixedText*      pFieldLabels[FIELD_PAIRS_VISIBLE * 2];
        ListBox*        pFields[FIELD_PAIRS_VISIBLE * 2];
        VclPtr<FixedText>      pFieldLabels[FIELD_PAIRS_VISIBLE * 2];
        VclPtr<ListBox>        pFields[FIELD_PAIRS_VISIBLE * 2];

        /// when working transient, we need the data source
        Reference< XDataSource >
@@ -941,34 +941,34 @@ void AssignmentPersistentData::ImplCommit()

        std::vector<OUString>::iterator aInitialSelection = m_pImpl->aFieldAssignments.begin() + m_pImpl->nFieldScrollPos;

        ListBox** pListbox = m_pImpl->pFields;
        OUString sSaveSelection;
        for (sal_Int32 i=0; i<FIELD_CONTROLS_VISIBLE; ++i, ++pListbox, ++aInitialSelection)
        for (sal_Int32 i=0; i<FIELD_CONTROLS_VISIBLE; ++i, ++aInitialSelection)
        {
            sSaveSelection = (*pListbox)->GetSelectEntry();
            VclPtr<ListBox>& pListbox = m_pImpl->pFields[i];
            sSaveSelection = pListbox->GetSelectEntry();

            (*pListbox)->Clear();
            pListbox->Clear();

            // the one entry for "no selection"
            (*pListbox)->InsertEntry(m_sNoFieldSelection, 0);
            pListbox->InsertEntry(m_sNoFieldSelection, 0);
            // as it's entry data, set the index of the list box in our array
            (*pListbox)->SetEntryData(0, reinterpret_cast<void*>(i));
            pListbox->SetEntryData(0, reinterpret_cast<void*>(i));

            // the field names
            for (pColumnNames = aColumnNames.getConstArray(); pColumnNames != pEnd; ++pColumnNames)
                (*pListbox)->InsertEntry(*pColumnNames);
                pListbox->InsertEntry(*pColumnNames);

            if (!aInitialSelection->isEmpty() && (aColumnNameSet.end() != aColumnNameSet.find(*aInitialSelection)))
                // we can select the entry as specified in our field assignment array
                (*pListbox)->SelectEntry(*aInitialSelection);
                pListbox->SelectEntry(*aInitialSelection);
            else
                // try to restore the selection
                if (aColumnNameSet.end() != aColumnNameSet.find(sSaveSelection))
                    // the old selection is a valid column name
                    (*pListbox)->SelectEntry(sSaveSelection);
                    pListbox->SelectEntry(sSaveSelection);
                else
                    // select the <none> entry
                    (*pListbox)->SelectEntryPos(0);
                    pListbox->SelectEntryPos(0);
        }

        // adjust m_pImpl->aFieldAssignments
@@ -1009,14 +1009,14 @@ void AssignmentPersistentData::ImplCommit()

        // loop through our field control rows and do some adjustments
        // for the new texts
        FixedText** pLeftLabelControl = m_pImpl->pFieldLabels;
        FixedText** pRightLabelControl = pLeftLabelControl + 1;
        VclPtr<FixedText>* pLeftLabelControl = m_pImpl->pFieldLabels;
        VclPtr<FixedText>* pRightLabelControl = pLeftLabelControl + 1;
        StringArray::const_iterator pLeftColumnLabel = m_pImpl->aFieldLabels.begin() + 2 * _nPos;
        StringArray::const_iterator pRightColumnLabel = pLeftColumnLabel + 1;

        // for the focus movement and the selection scroll
        ListBox** pLeftListControl = m_pImpl->pFields;
        ListBox** pRightListControl = pLeftListControl + 1;
        VclPtr<ListBox>* pLeftListControl = m_pImpl->pFields;
        VclPtr<ListBox>* pRightListControl = pLeftListControl + 1;

        // for the focus movement
        sal_Int32 nOldFocusRow = -1;
diff --git a/svx/inc/GalleryControl.hxx b/svx/inc/GalleryControl.hxx
index 11445db..e6c7e03 100644
--- a/svx/inc/GalleryControl.hxx
+++ b/svx/inc/GalleryControl.hxx
@@ -48,9 +48,9 @@ public:

private:
    Gallery* mpGallery;
    ::boost::scoped_ptr<GallerySplitter> mpSplitter;
    ::boost::scoped_ptr<GalleryBrowser1> mpBrowser1;
    ::boost::scoped_ptr<GalleryBrowser2> mpBrowser2;
    VclPtr<GallerySplitter> mpSplitter;
    VclPtr<GalleryBrowser1> mpBrowser1;
    VclPtr<GalleryBrowser2> mpBrowser2;
    Size maLastSize;
    bool mbIsInitialResize;

@@ -63,6 +63,8 @@ private:

protected:
    void ThemeSelectionHasChanged (void);
    virtual ~GalleryControl();
    virtual void dispose() SAL_OVERRIDE;
};

} } // end of namespace svx::sidebar
diff --git a/svx/source/gallery2/GalleryControl.cxx b/svx/source/gallery2/GalleryControl.cxx
index 02a5089..6aad331 100644
--- a/svx/source/gallery2/GalleryControl.cxx
+++ b/svx/source/gallery2/GalleryControl.cxx
@@ -65,6 +65,19 @@ GalleryControl::GalleryControl (
    InitSettings();
}

GalleryControl::~GalleryControl()
{
    disposeOnce();
}

void GalleryControl::dispose()
{
    mpSplitter.disposeAndClear();
    mpBrowser1.disposeAndClear();
    mpBrowser2.disposeAndClear();
    vcl::Window::dispose();
}

void GalleryControl::InitSettings (void)
{
    SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 8769b4c..db4067c 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -154,7 +154,7 @@ private:
    OUString                        aMoreKey;
    OUString                        sDefaultStyle;
    bool                            bInSpecialMode;
    MenuButton*                     m_pButtons[MAX_STYLES_ENTRIES];
    VclPtr<MenuButton>              m_pButtons[MAX_STYLES_ENTRIES];
    PopupMenu                       m_aMenu;

    void            ReleaseFocus();
@@ -339,8 +339,7 @@ void SvxStyleBox_Impl::dispose()
{
    for(int i = 0; i < MAX_STYLES_ENTRIES; i++)
    {
        delete m_pButtons[i];
        m_pButtons[i] = NULL;
        m_pButtons[i].disposeAndClear();
    }
    ComboBox::dispose();
}
@@ -720,7 +719,7 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
                    unsigned int nId = (aRect.getY() / aRect.GetSize().Height());
                    if(nId < MAX_STYLES_ENTRIES)
                    {
                        if(m_pButtons[nId] == NULL)
                        if(m_pButtons[nId] == nullptr)
                        {
                            m_pButtons[nId] = new MenuButton(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS);
                            m_pButtons[nId]->SetSizePixel(Size(20, aRect.GetSize().Height()));