sfx2: convert new to ::Create.

Change-Id: I53f95a65702c144ba4c4b0caac1e172015fec0fa
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 3cd5893..a89065d 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -215,7 +215,6 @@ private:
    void                ImplCheckPasswordState();

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

@@ -223,6 +222,7 @@ protected:
    virtual void        Reset( const SfxItemSet* ) SAL_OVERRIDE;

public:
    SfxDocumentPage( vcl::Window* pParent, const SfxItemSet& );
    static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* );

    void                EnableUseUserData();
@@ -240,7 +240,6 @@ private:
    SfxDocumentInfoItem*      m_pInfoItem;

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

@@ -248,6 +247,7 @@ protected:
    virtual void            Reset( const SfxItemSet* ) SAL_OVERRIDE;

public:
    SfxDocumentDescPage( vcl::Window* pParent, const SfxItemSet& );
    static SfxTabPage*      Create( vcl::Window* pParent, const SfxItemSet* );
};

@@ -520,7 +520,6 @@ private:
    using TabPage::DeactivatePage;

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

@@ -529,6 +528,7 @@ protected:
    virtual int         DeactivatePage( SfxItemSet* pSet = NULL ) SAL_OVERRIDE;

public:
    SfxCustomPropertiesPage( vcl::Window* pParent, const SfxItemSet& );
    static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* );
};

@@ -644,13 +644,12 @@ private:
    DECL_LINK(UpdateHdl, void *);

protected:
    SfxCmisPropertiesPage( vcl::Window* pParent, const SfxItemSet& );

    virtual bool        FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
    virtual void        Reset( const SfxItemSet* ) SAL_OVERRIDE;
    virtual int         DeactivatePage( SfxItemSet* pSet = NULL ) SAL_OVERRIDE;

public:
    SfxCmisPropertiesPage( vcl::Window* pParent, const SfxItemSet& );
    static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* );
};

diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx
index 00b8309..a47cac9 100644
--- a/include/sfx2/mgetempl.hxx
+++ b/include/sfx2/mgetempl.hxx
@@ -79,7 +79,6 @@ friend class SfxStyleDialog;
    void    UpdateName_Impl(ListBox *, const OUString &rNew);
    void    SetDescriptionText_Impl();

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

@@ -96,6 +95,8 @@ protected:
        virtual void        ActivatePage(const SfxItemSet &) SAL_OVERRIDE;
        using TabPage::DeactivatePage;
    virtual int     DeactivatePage(SfxItemSet * = 0) SAL_OVERRIDE;
public:
    SfxManageStyleSheetPage(vcl::Window *pParent, const SfxItemSet &rAttrSet );
};

#endif
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 423e0fb..67e134f 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/document/CmisVersion.hpp>

#include <vcl/timer.hxx>
#include <vcl/vclptr.hxx>
#include <svl/poolitem.hxx>
#include <vcl/bitmap.hxx>
#include <sot/storage.hxx>
@@ -341,7 +342,7 @@ public:
    sal_uInt16                  GetScriptingSignatureState();
    void                        SignScriptingContent();

    virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
    virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(
                                        vcl::Window *pParent, const SfxItemSet& );

    ErrCode                     CallBasic( const OUString& rMacro, const OUString& rBasicName,
diff --git a/include/sfx2/printer.hxx b/include/sfx2/printer.hxx
index 694e2e8..d419b35 100644
--- a/include/sfx2/printer.hxx
+++ b/include/sfx2/printer.hxx
@@ -53,9 +53,9 @@ public:
                            virtual ~SfxPrinter();
    virtual void            dispose() SAL_OVERRIDE;

    SfxPrinter*             Clone() const;
    VclPtr<SfxPrinter>      Clone() const;

    static SfxPrinter*      Create( SvStream &rStream, SfxItemSet *pOptions );
    static VclPtr<SfxPrinter> Create( SvStream &rStream, SfxItemSet *pOptions );
    SvStream&               Store( SvStream &rStream ) const;

    const JobSetup&         GetOrigJobSetup() const { return aOrigJobSetup; }
diff --git a/include/sfx2/securitypage.hxx b/include/sfx2/securitypage.hxx
index eaf83e7..a96bd93 100644
--- a/include/sfx2/securitypage.hxx
+++ b/include/sfx2/securitypage.hxx
@@ -33,12 +33,11 @@ class SfxSecurityPage : public SfxTabPage
    std::unique_ptr< SfxSecurityPage_Impl > m_pImpl;

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

    virtual bool            FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
    virtual void            Reset( const SfxItemSet* ) SAL_OVERRIDE;

public:
    SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& );
    static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* );
};

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 191a284..457411d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2883,7 +2883,7 @@ void ScDocShell::GetDocStat( ScDocStat& rDocStat )
                (sal_uInt16) ScPrintFunc( this, pPrinter, i ).GetTotalPages() );
}

SfxDocumentInfoDialog* ScDocShell::CreateDocumentInfoDialog(
VclPtr<SfxDocumentInfoDialog> ScDocShell::CreateDocumentInfoDialog(
                                         vcl::Window *pParent, const SfxItemSet &rSet )
{
    SfxDocumentInfoDialog* pDlg   = new SfxDocumentInfoDialog( pParent, rSet );
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 990ecce..2355c0f 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -224,7 +224,7 @@ public:

    void            SetVisAreaOrSize( const Rectangle& rVisArea, bool bModifyStart );

    virtual SfxDocumentInfoDialog*  CreateDocumentInfoDialog( vcl::Window *pParent,
    virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( vcl::Window *pParent,
                                                              const SfxItemSet &rSet ) SAL_OVERRIDE;

    void    GetDocStat( ScDocStat& rDocStat );
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index ffb8f4f..1fc11db 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -1130,7 +1130,7 @@ void DrawDocShell::OpenBookmark( const OUString& rBookmarkURL )
    ( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs );
}

SfxDocumentInfoDialog* DrawDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet )
VclPtr<SfxDocumentInfoDialog> DrawDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet )
{
    SfxDocumentInfoDialog* pDlg   = new SfxDocumentInfoDialog( pParent, rSet );
    DrawDocShell*          pDocSh = PTR_CAST(DrawDocShell,SfxObjectShell::Current());
diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx
index 71e9022..ed75bce 100644
--- a/sd/source/ui/inc/DrawDocShell.hxx
+++ b/sd/source/ui/inc/DrawDocShell.hxx
@@ -102,7 +102,7 @@ public:
    virtual Size            GetFirstPageSize() SAL_OVERRIDE;
    virtual void            FillClass(SvGlobalName* pClassName, SotClipboardFormatId* pFormat, OUString* pAppName, OUString* pFullTypeName, OUString* pShortTypeName, sal_Int32 nFileFormat, bool bTemplate = false ) const SAL_OVERRIDE;
    virtual void            SetModified( bool = true ) SAL_OVERRIDE;
    virtual SfxDocumentInfoDialog*  CreateDocumentInfoDialog( ::vcl::Window *pParent,
    virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( ::vcl::Window *pParent,
                                                              const SfxItemSet &rSet ) SAL_OVERRIDE;

    using SfxObjectShell::GetVisArea;
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 2c6d161..1f25c87 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1903,15 +1903,15 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :

    Window( pParent, WB_CLIPCHILDREN | WB_TABSTOP | WB_DIALOGCONTROL ),

    aToolBox            ( new ToolBox(this, 0) ),
    aOnStartupCB        ( new CheckBox(this, SfxResId( RID_HELP_ONSTARTUP_BOX )) ),
    aToolBox            ( VclPtr<ToolBox>::Create(this, 0) ),
    aOnStartupCB        ( VclPtr<CheckBox>::Create(this, SfxResId( RID_HELP_ONSTARTUP_BOX )) ),
    aIndexOnImage       ( SfxResId( IMG_HELP_TOOLBOX_INDEX_ON ) ),
    aIndexOffImage      ( SfxResId( IMG_HELP_TOOLBOX_INDEX_OFF ) ),
    aIndexOnText        ( SfxResId( STR_HELP_BUTTON_INDEX_ON ).toString() ),
    aIndexOffText       ( SfxResId( STR_HELP_BUTTON_INDEX_OFF ).toString() ),
    aOnStartupText      ( SfxResId( RID_HELP_ONSTARTUP_TEXT ).toString() ),
    pHelpWin            ( pParent ),
    pTextWin            ( new TextWin_Impl( this ) ),
    pTextWin            ( VclPtr<TextWin_Impl>::Create( this ) ),
    pSrchDlg            ( NULL ),
    nMinPos             ( 0 ),
    bIsDebug            ( false ),
@@ -2668,7 +2668,7 @@ void SfxHelpTextWindow_Impl::DoSearch()
    if ( !pSrchDlg )
    {
        // create the search dialog
        pSrchDlg = new sfx2::SearchDialog( pTextWin, "HelpSearchDialog" );
        pSrchDlg = VclPtr<sfx2::SearchDialog>::Create( pTextWin, "HelpSearchDialog" );
        // set handler
        pSrchDlg->SetFindHdl( LINK( this, SfxHelpTextWindow_Impl, FindHdl ) );
        pSrchDlg->SetCloseHdl( LINK( this, SfxHelpTextWindow_Impl, CloseHdl ) );
@@ -3055,12 +3055,12 @@ SfxHelpWindow_Impl::SfxHelpWindow_Impl(
    SetStyle( GetStyle() | WB_DIALOGCONTROL );

    pHelpInterceptor->InitWaiter( this );
    pIndexWin = new SfxHelpIndexWindow_Impl( this );
    pIndexWin = VclPtr<SfxHelpIndexWindow_Impl>::Create( this );
    pIndexWin->SetDoubleClickHdl( LINK( this, SfxHelpWindow_Impl, OpenHdl ) );
    pIndexWin->SetSelectFactoryHdl( LINK( this, SfxHelpWindow_Impl, SelectFactoryHdl ) );
    pIndexWin->SetSizePixel(LogicToPixel(Size(120, 200), MAP_APPFONT));
    pIndexWin->Show();
    pTextWin = new SfxHelpTextWindow_Impl( this );
    pTextWin = VclPtr<SfxHelpTextWindow_Impl>::Create( this );
    Reference < XFrames > xFrames = rFrame->getFrames();
    xFrames->append( Reference<XFrame>(pTextWin->getFrame(), UNO_QUERY_THROW) );
    pTextWin->SetSelectHdl( LINK( this, SfxHelpWindow_Impl, SelectHdl ) );
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index 45ceb30..add82d1 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -353,7 +353,7 @@ ContentTabPage_Impl* SfxHelpIndexWindow_Impl::GetContentPage()
{
    if ( !pCPage )
    {
        pCPage = new ContentTabPage_Impl( m_pTabCtrl, this );
        pCPage = VclPtr<ContentTabPage_Impl>::Create( m_pTabCtrl, this );
        pCPage->SetOpenHdl( aPageDoubleClickLink );
    }
    return pCPage;
@@ -362,7 +362,7 @@ IndexTabPage_Impl* SfxHelpIndexWindow_Impl::GetIndexPage()
{
    if ( !pIPage )
    {
        pIPage = new IndexTabPage_Impl( m_pTabCtrl, this );
        pIPage = VclPtr<IndexTabPage_Impl>::Create( m_pTabCtrl, this );
        pIPage->SetDoubleClickHdl( aPageDoubleClickLink );
        pIPage->SetKeywordHdl( aIndexKeywordLink );
    }
@@ -373,7 +373,7 @@ SearchTabPage_Impl* SfxHelpIndexWindow_Impl::GetSearchPage()
{
    if ( !pSPage )
    {
        pSPage = new SearchTabPage_Impl( m_pTabCtrl, this );
        pSPage = VclPtr<SearchTabPage_Impl>::Create( m_pTabCtrl, this );
        pSPage->SetDoubleClickHdl( aPageDoubleClickLink );
    }
    return pSPage;
@@ -383,7 +383,7 @@ BookmarksTabPage_Impl* SfxHelpIndexWindow_Impl::GetBookmarksPage()
{
    if ( !pBPage )
    {
        pBPage = new BookmarksTabPage_Impl( m_pTabCtrl, this );
        pBPage = VclPtr<BookmarksTabPage_Impl>::Create( m_pTabCtrl, this );
        pBPage->SetDoubleClickHdl( aPageDoubleClickLink );
    }
    return pBPage;
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 2298469..d6ec61c 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -569,7 +569,7 @@ SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( vcl::Window *pWin, SfxFrame *pFrm, S
                            n == SFX_SPLITWINDOWS_RIGHT ? SfxChildAlignment::RIGHT :
                            n == SFX_SPLITWINDOWS_TOP ? SfxChildAlignment::TOP :
                                SfxChildAlignment::BOTTOM );
        SfxSplitWindow *pSplitWin = new SfxSplitWindow(pWorkWin, eAlign, this, pParent==0 );
        VclPtr<SfxSplitWindow> pSplitWin = VclPtr<SfxSplitWindow>::Create(pWorkWin, eAlign, this, pParent==0 );
        pSplit[n] = pSplitWin;
    }

diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 2452f72..408fccb 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -128,8 +128,8 @@ bool ViewFilter_Keyword::operator ()(const ThumbnailViewItem *pItem)
TemplateAbstractView::TemplateAbstractView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren)
    : ThumbnailView(pParent,nWinStyle,bDisableTransientChildren),
      mnCurRegionId(0),
      maAllButton(new PushButton(this, SfxResId(BTN_ALL_TEMPLATES))),
      maFTName(new FixedText(this, SfxResId(FT_NAME)))
      maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
      maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
{
    maAllButton->Hide();
    maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
@@ -140,8 +140,8 @@ TemplateAbstractView::TemplateAbstractView (vcl::Window *pParent, WinBits nWinSt
TemplateAbstractView::TemplateAbstractView(vcl::Window *pParent)
    : ThumbnailView(pParent),
      mnCurRegionId(0),
      maAllButton(new PushButton(this, SfxResId(BTN_ALL_TEMPLATES))),
      maFTName(new FixedText(this, SfxResId(FT_NAME)))
      maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
      maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
{
    maAllButton->Hide();
    maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index ad20376..8c6a30e 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -236,7 +236,7 @@ void ThumbnailView::ImplInitScrollBar()
    {
        if ( !mpScrBar )
        {
            mpScrBar = new ScrollBar( this, WB_VSCROLL | WB_DRAG );
            mpScrBar = VclPtr<ScrollBar>::Create( this, WB_VSCROLL | WB_DRAG );
            mpScrBar->SetScrollHdl( LINK( this, ThumbnailView, ImplScrollHdl ) );
        }
        else
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index ccaebb1..c654390 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -112,7 +112,7 @@ ThumbnailViewItem::ThumbnailViewItem(ThumbnailView &rView, sal_uInt16 nId)
    , mpTitleED(NULL)
    , maTextEditMaxArea()
{
    mpTitleED = new ResizableMultiLineEdit(&rView, this);
    mpTitleED = VclPtr<ResizableMultiLineEdit>::Create(&rView, this);
}

ThumbnailViewItem::~ThumbnailViewItem()
diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx
index ff6b506..f11d9ff 100644
--- a/sfx2/source/dialog/backingcomp.cxx
+++ b/sfx2/source/dialog/backingcomp.cxx
@@ -719,8 +719,8 @@ void SAL_CALL BackingComp::initialize( /*IN*/ const css::uno::Sequence< css::uno

    // create the component window
    vcl::Window* pParent   = VCLUnoHelper::GetWindow(xParentWindow);
    vcl::Window* pWindow   = new BackingWindow(pParent);
            m_xWindow = VCLUnoHelper::GetInterface(pWindow);
    VclPtr<vcl::Window> pWindow = VclPtr<BackingWindow>::Create(pParent);
    m_xWindow = VCLUnoHelper::GetInterface(pWindow);

    if (!m_xWindow.is())
        throw css::uno::RuntimeException(
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 0122bbd..a40f652 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -642,7 +642,7 @@ void SfxDocumentDescPage::dispose()

SfxTabPage *SfxDocumentDescPage::Create(vcl::Window *pParent, const SfxItemSet *rItemSet)
{
     return new SfxDocumentDescPage(pParent, *rItemSet);
     return VclPtr<SfxDocumentDescPage>::Create(pParent, *rItemSet);
}


@@ -945,7 +945,7 @@ void SfxDocumentPage::ImplCheckPasswordState()

SfxTabPage* SfxDocumentPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
{
     return new SfxDocumentPage( pParent, *rItemSet );
     return VclPtr<SfxDocumentPage>::Create( pParent, *rItemSet );
}

void SfxDocumentPage::EnableUseUserData()
@@ -1222,8 +1222,8 @@ void SfxDocumentInfoDialog::AddFontTabPage()

CustomPropertiesYesNoButton::CustomPropertiesYesNoButton( vcl::Window* pParent, const ResId& rResId ) :
    Control( pParent, rResId ),
    m_aYesButton( new RadioButton(this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() )) ),
    m_aNoButton ( new RadioButton(this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() )) )
    m_aYesButton( VclPtr<RadioButton>::Create(this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() )) ),
    m_aNoButton ( VclPtr<RadioButton>::Create(this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() )) )
{
    FreeResource();
    Wallpaper aWall( Color( COL_TRANSPARENT ) );
@@ -1391,16 +1391,16 @@ void CustomPropertiesYesNoButton::Resize()

// struct CustomPropertyLine ---------------------------------------------
CustomPropertyLine::CustomPropertyLine( vcl::Window* pParent ) :
    m_aNameBox      ( new ComboBox(pParent, SfxResId( SFX_CB_PROPERTY_NAME )) ),
    m_aTypeBox      ( new CustomPropertiesTypeBox(pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this) ),
    m_aValueEdit    ( new CustomPropertiesEdit(pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ) ),
    m_aDateField    ( new CustomPropertiesDateField(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
    m_aTimeField    ( new CustomPropertiesTimeField(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
    m_aNameBox      ( VclPtr<ComboBox>::Create(pParent, SfxResId( SFX_CB_PROPERTY_NAME )) ),
    m_aTypeBox      ( VclPtr<CustomPropertiesTypeBox>::Create(pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this) ),
    m_aValueEdit    ( VclPtr<CustomPropertiesEdit>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ) ),
    m_aDateField    ( VclPtr<CustomPropertiesDateField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
    m_aTimeField    ( VclPtr<CustomPropertiesTimeField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
    m_sDurationFormat( SfxResId( SFX_ST_DURATION_FORMAT ).toString() ),
    m_aDurationField( new CustomPropertiesDurationField(pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ) ),
    m_aEditButton   ( new CustomPropertiesEditButton(pParent, WB_TABSTOP, this) ),
    m_aYesNoButton  ( new CustomPropertiesYesNoButton(pParent, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
    m_aRemoveButton ( new CustomPropertiesRemoveButton(pParent, 0, this) ),
    m_aDurationField( VclPtr<CustomPropertiesDurationField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ) ),
    m_aEditButton   ( VclPtr<CustomPropertiesEditButton>::Create(pParent, WB_TABSTOP, this) ),
    m_aYesNoButton  ( VclPtr<CustomPropertiesYesNoButton>::Create(pParent, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
    m_aRemoveButton ( VclPtr<CustomPropertiesRemoveButton>::Create(pParent, 0, this) ),
    m_bIsDate       ( false ),
    m_bIsRemoved    ( false ),
    m_bTypeLostFocus( false )
@@ -1438,15 +1438,15 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
    m_pHeaderAccName(pHeaderAccName),
    m_pHeaderAccType(pHeaderAccType),
    m_pHeaderAccValue(pHeaderAccValue),
    m_aNameBox      ( new ComboBox( this, SfxResId( SFX_CB_PROPERTY_NAME ) ) ),
    m_aTypeBox      ( new ListBox( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ) ),
    m_aValueEdit    ( new Edit( this, WB_BORDER|WB_TABSTOP|WB_LEFT ) ),
    m_aDateField    ( new DateField( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
    m_aTimeField    ( new TimeField( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
    m_aDurationField( new Edit( this, WB_BORDER|WB_TABSTOP|WB_READONLY ) ),
    m_aEditButton   ( new PushButton( this, WB_TABSTOP ) ),
    m_aYesNoButton  ( new CustomPropertiesYesNoButton( this, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
    m_aRemoveButton ( new ImageButton( this, 0 ) ),
    m_aNameBox      ( VclPtr<ComboBox>::Create( this, SfxResId( SFX_CB_PROPERTY_NAME ) ) ),
    m_aTypeBox      ( VclPtr<ListBox>::Create( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ) ),
    m_aValueEdit    ( VclPtr<Edit>::Create( this, WB_BORDER|WB_TABSTOP|WB_LEFT ) ),
    m_aDateField    ( VclPtr<DateField>::Create( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
    m_aTimeField    ( VclPtr<TimeField>::Create( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
    m_aDurationField( VclPtr<Edit>::Create( this, WB_BORDER|WB_TABSTOP|WB_READONLY ) ),
    m_aEditButton   ( VclPtr<PushButton>::Create( this, WB_TABSTOP ) ),
    m_aYesNoButton  ( VclPtr<CustomPropertiesYesNoButton>::Create( this, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
    m_aRemoveButton ( VclPtr<ImageButton>::Create( this, 0 ) ),
    m_nScrollPos (0),
    m_pCurrentLine (NULL),
    m_aNumberFormatter( ::comphelper::getProcessComponentContext(),
@@ -2050,17 +2050,17 @@ CustomPropertiesControl::CustomPropertiesControl(vcl::Window* pParent)

void CustomPropertiesControl::Init(VclBuilderContainer& rBuilder)
{
    m_pVBox = new VclVBox(this);
    m_pHeaderBar = new HeaderBar(m_pVBox, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
    m_pBody = new VclHBox(m_pVBox);
    m_pVBox = VclPtr<VclVBox>::Create(this);
    m_pHeaderBar = VclPtr<HeaderBar>::Create(m_pVBox, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
    m_pBody = VclPtr<VclHBox>::Create(m_pVBox);
    FixedText* pName = rBuilder.get<FixedText>("name");
    FixedText* pType = rBuilder.get<FixedText>("type");
    FixedText* pValue = rBuilder.get<FixedText>("value");
    OUString sName = pName->GetText();
    OUString sType = pType->GetText();
    OUString sValue = pValue->GetText();
    m_pPropertiesWin = new CustomPropertiesWindow(m_pBody, pName, pType, pValue);
    m_pVertScroll = new ScrollBar(m_pBody, WB_VERT);
    m_pPropertiesWin = VclPtr<CustomPropertiesWindow>::Create(m_pBody, pName, pType, pValue);
    m_pVertScroll = VclPtr<ScrollBar>::Create(m_pBody, WB_VERT);

    set_hexpand(true);
    set_vexpand(true);
@@ -2276,7 +2276,7 @@ int SfxCustomPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ )

SfxTabPage* SfxCustomPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
{
    return new SfxCustomPropertiesPage( pParent, *rItemSet );
    return VclPtr<SfxCustomPropertiesPage>::Create( pParent, *rItemSet );
}

CmisValue::CmisValue( vcl::Window* pParent, const OUString& aStr )
@@ -2772,7 +2772,7 @@ int SfxCmisPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ )

SfxTabPage* SfxCmisPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
{
    return new SfxCmisPropertiesPage( pParent, *rItemSet );
    return VclPtr<SfxCmisPropertiesPage>::Create( pParent, *rItemSet );
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index a69ac5b..0ad3e75 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -130,7 +130,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd ,
    uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
    const OUString aDockWindowResourceURL( "private:resource/dockingwindow/" );

    SfxTitleDockingWindow* pTitleDockWindow = new SfxTitleDockingWindow( pBindings, this, pParentWnd,
    VclPtr<SfxTitleDockingWindow> pTitleDockWindow = VclPtr<SfxTitleDockingWindow>::Create( pBindings, this, pParentWnd,
        WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
    pWindow = pTitleDockWindow;
    eChildAlignment = SfxChildAlignment::NOALIGNMENT;
diff --git a/sfx2/source/dialog/documentfontsdialog.cxx b/sfx2/source/dialog/documentfontsdialog.cxx
index c326e11..dc434a3a 100644
--- a/sfx2/source/dialog/documentfontsdialog.cxx
+++ b/sfx2/source/dialog/documentfontsdialog.cxx
@@ -25,7 +25,7 @@ using namespace ::com::sun::star;

SfxTabPage* SfxDocumentFontsPage::Create( vcl::Window* parent, const SfxItemSet* set )
{
    return new SfxDocumentFontsPage( parent, *set );
    return VclPtr<SfxDocumentFontsPage>::Create( parent, *set );
}

SfxDocumentFontsPage::SfxDocumentFontsPage( vcl::Window* parent, const SfxItemSet& set )
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index a9ce3ee..2bf4341 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -118,8 +118,8 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId,
       const OUString& sMessage) :
    Window(pParent, 0),
    m_sId(sId),
    m_pMessage(new FixedText(this, 0)),
    m_pCloseBtn(new SfxCloseButton(this)),
    m_pMessage(VclPtr<FixedText>::Create(this, 0)),
    m_pCloseBtn(VclPtr<SfxCloseButton>::Create(this)),
    m_aActionBtns()
{
    sal_Int32 nScaleFactor = GetDPIScaleFactor();
@@ -327,7 +327,7 @@ SfxInfoBarContainerChild::SfxInfoBarContainerChild( vcl::Window* _pParent, sal_u
    SfxChildWindow(_pParent, nId),
    m_pBindings(pBindings)
{
    pWindow = new SfxInfoBarContainerWindow(this);
    pWindow = VclPtr<SfxInfoBarContainerWindow>::Create(this);
    pWindow->SetPosSizePixel(Point(0, 0), Size(_pParent->GetSizePixel().getWidth(), 0));
    pWindow->Show();

diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index fa98cff..6db9e8e 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -582,7 +582,7 @@ SfxTabPage* SfxManageStyleSheetPage::Create( vcl::Window* pParent,
*/

{
    return new SfxManageStyleSheetPage( pParent, *rAttrSet );
    return VclPtr<SfxManageStyleSheetPage>::Create( pParent, *rAttrSet );
}


diff --git a/sfx2/source/dialog/navigat.cxx b/sfx2/source/dialog/navigat.cxx
index 48a3020..98870a6 100644
--- a/sfx2/source/dialog/navigat.cxx
+++ b/sfx2/source/dialog/navigat.cxx
@@ -34,7 +34,7 @@ SfxNavigatorWrapper::SfxNavigatorWrapper( vcl::Window* pParentWnd ,
                                                SfxChildWinInfo* pInfo )
                    : SfxChildWindow( pParentWnd , nId )
{
    pWindow = new SfxNavigator( pBindings, this, pParentWnd,
    pWindow = VclPtr<SfxNavigator>::Create( pBindings, this, pParentWnd,
        WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
    eChildAlignment = SfxChildAlignment::NOALIGNMENT;

diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx
index e4aa3bce..d3f26dc 100644
--- a/sfx2/source/dialog/newstyle.cxx
+++ b/sfx2/source/dialog/newstyle.cxx
@@ -59,7 +59,7 @@ IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox )

SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rInPool )
    : ModalDialog(pParent, "CreateStyleDialog", "sfx/ui/newstyle.ui")
    , aQueryOverwriteBox(new MessageDialog(this, SfxResId(STR_QUERY_OVERWRITE),
    , aQueryOverwriteBox(VclPtr<MessageDialog>::Create(this, SfxResId(STR_QUERY_OVERWRITE),
                                           VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO))
    , rPool(rInPool)
{
diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx
index 0292b83..f16288d 100644
--- a/sfx2/source/dialog/partwnd.cxx
+++ b/sfx2/source/dialog/partwnd.cxx
@@ -59,7 +59,7 @@ SfxPartChildWnd_Impl::SfxPartChildWnd_Impl
    : SfxChildWindow( pParentWnd, nId )
{
    // Create Window
    pWindow = new SfxPartDockWnd_Impl( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK );
    pWindow = VclPtr<SfxPartDockWnd_Impl>::Create( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK );
    eChildAlignment = SfxChildAlignment::TOP;

    assert(pInfo);
diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx
index 0c00b34..da1a477 100644
--- a/sfx2/source/dialog/printopt.cxx
+++ b/sfx2/source/dialog/printopt.cxx
@@ -117,7 +117,7 @@ void SfxCommonPrintOptionsTabPage::dispose()

SfxTabPage* SfxCommonPrintOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
    return( new SfxCommonPrintOptionsTabPage( pParent, *rAttrSet ) );
    return( VclPtr<SfxCommonPrintOptionsTabPage>::Create( pParent, *rAttrSet ) );
}

vcl::Window* SfxCommonPrintOptionsTabPage::GetParentLabeledBy( const vcl::Window* pWindow ) const
diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx
index 7ba862e..742aa88 100644
--- a/sfx2/source/dialog/recfloat.cxx
+++ b/sfx2/source/dialog/recfloat.cxx
@@ -131,7 +131,7 @@ SfxRecordingFloatWrapper_Impl::SfxRecordingFloatWrapper_Impl( vcl::Window* pPare
                    : SfxChildWindow( pParentWnd, nId )
                    , pBindings( pBind )
{
    pWindow = new SfxRecordingFloat_Impl( pBindings, this, pParentWnd );
    pWindow = VclPtr<SfxRecordingFloat_Impl>::Create( pBindings, this, pParentWnd );
    SetWantsFocus( false );
    eChildAlignment = SfxChildAlignment::NOALIGNMENT;
    static_cast<SfxFloatingWindow*>(pWindow.get())->Initialize( pInfo );
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
index e80212d..897b201 100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -422,7 +422,7 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, ChangeProtectionPBHdl)

SfxTabPage* SfxSecurityPage::Create( vcl::Window * pParent, const SfxItemSet * rItemSet )
{
    return new SfxSecurityPage( pParent, *rItemSet );
    return VclPtr<SfxSecurityPage>::Create( pParent, *rItemSet );
}


diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index 7372a8c..a8c75ba 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -237,7 +237,7 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl,
    }

    SetAlign (eTbxAlign);
    pEmptyWin = new SfxEmptySplitWin_Impl( this );
    pEmptyWin = VclPtr<SfxEmptySplitWin_Impl>::Create( this );
    if ( bPinned )
    {
        pEmptyWin->bFadeIn = true;
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index cba8049..9e1846d 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -450,31 +450,31 @@ void SfxTabDialog::Init_Impl(bool bFmtFlag)
    m_pOKBtn = m_pUIBuilder->get<PushButton>("ok");
    m_bOwnsOKBtn = m_pOKBtn == nullptr;
    if (m_bOwnsOKBtn)
        m_pOKBtn = new OKButton(m_pActionArea);
        m_pOKBtn = VclPtr<OKButton>::Create(m_pActionArea);

    m_pApplyBtn = m_pUIBuilder->get<PushButton>("apply");
    m_pUserBtn = m_pUIBuilder->get<PushButton>("user");
    m_pCancelBtn = m_pUIBuilder->get<CancelButton>("cancel");
    m_bOwnsCancelBtn = m_pCancelBtn == nullptr;
    if (m_bOwnsCancelBtn)
        m_pCancelBtn = new CancelButton(m_pActionArea);
        m_pCancelBtn = VclPtr<CancelButton>::Create(m_pActionArea);

    m_pHelpBtn = m_pUIBuilder->get<HelpButton>("help");
    m_bOwnsHelpBtn = m_pHelpBtn == nullptr;
    if (m_bOwnsHelpBtn)
        m_pHelpBtn = new HelpButton(m_pActionArea);
        m_pHelpBtn = VclPtr<HelpButton>::Create(m_pActionArea);

    m_pResetBtn = m_pUIBuilder->get<PushButton>("reset");
    m_bOwnsResetBtn = m_pResetBtn == nullptr;
    if (m_bOwnsResetBtn)
        m_pResetBtn = new PushButton(m_pActionArea.get());
        m_pResetBtn = VclPtr<PushButton>::Create(m_pActionArea.get());
    else
        pImpl->bHideResetBtn = !m_pResetBtn->IsVisible();

    m_pBaseFmtBtn = m_pUIBuilder->get<PushButton>("standard");
    m_bOwnsBaseFmtBtn = m_pBaseFmtBtn == nullptr;
    if (m_bOwnsBaseFmtBtn)
        m_pBaseFmtBtn = new PushButton(m_pActionArea.get());
        m_pBaseFmtBtn = VclPtr<PushButton>::Create(m_pActionArea.get());

    m_pOKBtn->SetClickHdl( LINK( this, SfxTabDialog, OkHdl ) );
    m_pCancelBtn->SetClickHdl( LINK( this, SfxTabDialog, CancelHdl ) );
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
index 9750f6c..e782af1 100644
--- a/sfx2/source/dialog/taskpane.cxx
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -202,7 +202,7 @@ namespace sfx2

    TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, vcl::Window* i_pParent, WinBits i_nBits )
        :TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits )
        ,m_aTaskPane( new ModuleTaskPane(GetContentWindow(), lcl_getFrame( i_pBindings )) )
        ,m_aTaskPane( VclPtr<ModuleTaskPane>::Create(GetContentWindow(), lcl_getFrame( i_pBindings )) )
        ,m_aPaneController( *m_aTaskPane.get(), *this )
    {
        m_aTaskPane->Show();
@@ -249,7 +249,7 @@ namespace sfx2
    TaskPaneWrapper::TaskPaneWrapper( vcl::Window* i_pParent, sal_uInt16 i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo )
        :SfxChildWindow( i_pParent, i_nId )
    {
        pWindow = new TaskPaneDockingWindow( i_pBindings, *this, i_pParent,
        pWindow = VclPtr<TaskPaneDockingWindow>::Create( i_pBindings, *this, i_pParent,
            WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
        eChildAlignment = SfxChildAlignment::RIGHT;

diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx
index 68c52d3..df195c8 100644
--- a/sfx2/source/dialog/templateinfodlg.cxx
+++ b/sfx2/source/dialog/templateinfodlg.cxx
@@ -38,7 +38,7 @@ SfxTemplateInfoDlg::SfxTemplateInfoDlg (vcl::Window *pParent)
    get(mpBtnClose, "close");
    get(mpBox, "box");
    get(mpInfoView, "infoDrawingArea");
    mpPreviewView = new vcl::Window(mpBox.get());
    mpPreviewView = VclPtr<vcl::Window>::Create(mpBox.get());

    Size aSize(LogicToPixel(Size(250, 160), MAP_APPFONT));
    mpBox->set_width_request(aSize.Width());
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index b5cd56c..6f533f8 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -546,8 +546,8 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl
    , xModuleManager(frame::ModuleManager::create(::comphelper::getProcessComponentContext()))
    , m_pDeletionWatcher(NULL)

    , aFmtLb( new SfxActionListBox(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH) )
    , aFilterLb( new ListBox(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP) )
    , aFmtLb( VclPtr<SfxActionListBox>::Create(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH) )
    , aFilterLb( VclPtr<ListBox>::Create(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP) )

    , nActFamily(0xffff)
    , nActFilter(0)
@@ -1512,7 +1512,8 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable)
            const OUString aSelectEntry( GetSelectedEntry());
            aFmtLb->Hide();

            pTreeBox = new StyleTreeListBox_Impl(
            pTreeBox = VclPtr<StyleTreeListBox_Impl>::Create(

                    this, WB_HASBUTTONS | WB_HASLINES |
                    WB_BORDER | WB_TABSTOP | WB_HASLINESATROOT |
                    WB_HASBUTTONSATROOT | WB_HIDESELECTION | WB_QUICK_SEARCH );
diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx
index a176cc1..6b3c989 100644
--- a/sfx2/source/dialog/titledockwin.cxx
+++ b/sfx2/source/dialog/titledockwin.cxx
@@ -35,8 +35,8 @@ namespace sfx2
            WinBits i_nStyle )
        :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_nStyle )
        ,m_sTitle()
        ,m_aToolbox( new ToolBox(this) )
        ,m_aContentWindow( new vcl::Window(this, WB_DIALOGCONTROL) )
        ,m_aToolbox( VclPtr<ToolBox>::Create(this) )
        ,m_aContentWindow( VclPtr<vcl::Window>::Create(this, WB_DIALOGCONTROL) )
        ,m_aBorder( 3, 1, 3, 3 )
        ,m_bLayoutPending( false )
        ,m_nTitleBarHeight(0)
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index 11fb35f..81b72cf 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -213,7 +213,7 @@ SfxVersionDialog::SfxVersionDialog ( SfxViewFrame* pVwFrame, bool bIsSaveVersion
    pContainer->set_width_request(aControlSize.Width());
    pContainer->set_height_request(aControlSize.Height());

    m_pVersionBox = new SfxVersionsTabListBox_Impl(*pContainer, WB_TABSTOP);
    m_pVersionBox = VclPtr<SfxVersionsTabListBox_Impl>::Create(*pContainer, WB_TABSTOP);

    Link aClickLink = LINK( this, SfxVersionDialog, ButtonHdl_Impl );
    m_pViewButton->SetClickHdl ( aClickLink );
@@ -548,7 +548,7 @@ SfxCmisVersionsDialog::SfxCmisVersionsDialog ( SfxViewFrame* pVwFrame, bool bIsS
    pContainer->set_width_request(aControlSize.Width());
    pContainer->set_height_request(aControlSize.Height());

    m_pVersionBox = new SfxVersionsTabListBox_Impl(*pContainer, WB_TABSTOP);
    m_pVersionBox = VclPtr<SfxVersionsTabListBox_Impl>::Create(*pContainer, WB_TABSTOP);

    m_pVersionBox->GrabFocus();
    m_pVersionBox->SetStyle( m_pVersionBox->GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN );
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index a3dc009..0564141 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -174,7 +174,7 @@ throw( uno::RuntimeException, std::exception )
    {
        DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
        vcl::Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
        IFrameWindow_Impl* pWin = new IFrameWindow_Impl( pParent, maFrmDescr.IsFrameBorderOn() );
        VclPtr<IFrameWindow_Impl> pWin = VclPtr<IFrameWindow_Impl>::Create( pParent, maFrmDescr.IsFrameBorderOn() );
        pWin->SetSizePixel( pParent->GetOutputSizePixel() );
        pWin->SetBackground();
        pWin->Show();
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index e94470c..0b5d7f6 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -282,13 +282,13 @@ void SfxObjectShell::UpdateTime_Impl(



SfxDocumentInfoDialog* SfxObjectShell::CreateDocumentInfoDialog
VclPtr<SfxDocumentInfoDialog> SfxObjectShell::CreateDocumentInfoDialog
(
    vcl::Window*             pParent,
    const SfxItemSet&   rSet
)
{
    return new SfxDocumentInfoDialog(pParent, rSet);
    return VclPtr<SfxDocumentInfoDialog>::Create(pParent, rSet);
}


diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx
index ca30f45..7c5d715 100644
--- a/sfx2/source/doc/plugin.cxx
+++ b/sfx2/source/doc/plugin.cxx
@@ -152,7 +152,7 @@ throw( uno::RuntimeException, std::exception )
    if ( SvtMiscOptions().IsPluginsEnabled() )
    {
        vcl::Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
        PluginWindow_Impl* pWin = new PluginWindow_Impl( pParent );
        VclPtr<PluginWindow_Impl> pWin = VclPtr<PluginWindow_Impl>::Create( pParent );
        pWin->SetSizePixel( pParent->GetOutputSizePixel() );
        pWin->SetBackground();
        pWin->Show();
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index e5f6b15..452f414 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -346,7 +346,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >

            if ( aPrinterName != pPrinter->GetName() )
            {
                pPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aPrinterName );
                pPrinter = VclPtr<SfxPrinter>::Create( pPrinter->GetOptions().Clone(), aPrinterName );
                nChangeFlags = SfxPrinterChangeFlags::PRINTER;
            }
            break;
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index 2a78dfa..876b373 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -41,7 +41,7 @@ TitleBar::TitleBar (
    vcl::Window* pParentWindow,
    const sidebar::Paint& rInitialBackgroundPaint)
    : Window(pParentWindow),
      maToolBox(new SidebarToolBox(this)),
      maToolBox(VclPtr<SidebarToolBox>::Create(this)),
      msTitle(rsTitle),
      maIcon()
{
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index f03d12e..390a9c52 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -304,7 +304,7 @@ SfxFrame::SfxFrame( vcl::Window& i_rContainerWindow, bool i_bHidden )
    InsertTopFrame_Impl( this );
    pImp->pExternalContainerWindow = &i_rContainerWindow;

    pWindow = new SfxFrameWindow_Impl( this, i_rContainerWindow );
    pWindow = VclPtr<SfxFrameWindow_Impl>::Create( this, i_rContainerWindow );

    // always show pWindow, which is the ComponentWindow of the XFrame we live in
    // nowadays, since SfxFrames can be created with an XFrame only, hiding or showing the complete XFrame
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index 47f3005..ee07c78 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -60,7 +60,7 @@ struct SfxPrintOptDlg_Impl

// class SfxPrinter ------------------------------------------------------

SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
VclPtr<SfxPrinter> SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )

/*  [Description]

@@ -79,7 +79,7 @@ SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
    ReadJobSetup( rStream, aFileJobSetup );

    // Get printers
    SfxPrinter *pPrinter = new SfxPrinter( pOptions, aFileJobSetup );
    VclPtr<SfxPrinter> pPrinter = VclPtr<SfxPrinter>::Create( pOptions, aFileJobSetup );
    return pPrinter;
}

@@ -166,12 +166,11 @@ SfxPrinter::SfxPrinter( const SfxPrinter& rPrinter ) :



SfxPrinter* SfxPrinter::Clone() const
VclPtr<SfxPrinter> SfxPrinter::Clone() const
{
    if ( IsDefPrinter() )
    {
        SfxPrinter *pNewPrinter;
        pNewPrinter = new SfxPrinter( GetOptions().Clone() );
        VclPtr<SfxPrinter> pNewPrinter = VclPtr<SfxPrinter>::Create( GetOptions().Clone() );
        pNewPrinter->SetJobSetup( GetJobSetup() );
        pNewPrinter->SetPrinterProps( this );
        pNewPrinter->SetMapMode( GetMapMode() );
@@ -182,7 +181,7 @@ SfxPrinter* SfxPrinter::Clone() const
        return pNewPrinter;
    }
    else
        return new SfxPrinter( *this );
        return VclPtr<SfxPrinter>::Create( *this );
}


diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index ca5002a..e3110e7 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1468,7 +1468,7 @@ SfxViewFrame::SfxViewFrame
    rFrame.SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE );
    Construct_Impl( pObjShell );

    pImp->pWindow = new SfxFrameViewWindow_Impl( this, rFrame.GetWindow() );
    pImp->pWindow = VclPtr<SfxFrameViewWindow_Impl>::Create( this, rFrame.GetWindow() );
    pImp->pWindow->SetSizePixel( rFrame.GetWindow().GetOutputSizePixel() );
    rFrame.SetOwnsBindings_Impl( true );
    rFrame.CreateWorkWindow_Impl();
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index c440014..2d6f99b 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -384,7 +384,7 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
                    pDocPrt->SetJobSetup( getPrinter()->GetJobSetup() );
                else
                {
                    SfxPrinter* pNewPrt = new SfxPrinter( pDocPrt->GetOptions().Clone(), getPrinter()->GetName() );
                    VclPtr<SfxPrinter> pNewPrt = VclPtr<SfxPrinter>::Create( pDocPrt->GetOptions().Clone(), getPrinter()->GetName() );
                    pNewPrt->SetJobSetup( getPrinter()->GetJobSetup() );
                    mpViewShell->SetPrinter( pNewPrt, SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP );
                }
@@ -591,7 +591,7 @@ void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rPr
        {
            OUString aPrinterName;
            pVal[i].Value >>= aPrinterName;
            aPrt.reset( new Printer( aPrinterName ) );
            aPrt.reset( VclPtr<Printer>::Create( aPrinterName ) );
            break;
        }
    }
@@ -770,7 +770,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
            if ( pPrinterItem )
            {
                // use PrinterName parameter to create a printer
                pPrinter = new SfxPrinter( pDocPrinter->GetOptions().Clone(), ((const SfxStringItem*) pPrinterItem)->GetValue() );
                pPrinter = VclPtr<SfxPrinter>::Create( pDocPrinter->GetOptions().Clone(), ((const SfxStringItem*) pPrinterItem)->GetValue() );

                // if printer is unknown, it can't be used - now printer from document will be used
                if ( !pPrinter->IsKnown() )
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 1193638..c603c4a 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -104,7 +104,7 @@ class SW_DLLPUBLIC SwDocShell
        SAL_OVERRIDE;

    /// Make DocInfo known to the Doc.
    SAL_DLLPRIVATE virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
    SAL_DLLPRIVATE virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(
                                    vcl::Window *pParent, const SfxItemSet &) SAL_OVERRIDE;
    /// OLE-stuff
    SAL_DLLPRIVATE virtual void          Draw( OutputDevice*, const JobSetup&, sal_uInt16) SAL_OVERRIDE;
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index b9397f4..7071ef6 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -133,7 +133,7 @@ using namespace ::com::sun::star;
using namespace ::sfx2;

// create DocInfo (virtual)
SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog(
VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(
                                vcl::Window *pParent, const SfxItemSet &rSet)
{
    VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create(pParent, rSet);