[Libreoffice-commits] core.git: Branch 'feature/vclptr' - toolkit/source UnoControls/source uui/source xmlsecurity/source

Michael Meeks michael.meeks at collabora.com
Thu Apr 16 14:17:01 PDT 2015


 UnoControls/source/controls/progressmonitor.cxx        |    2 
 UnoControls/source/controls/statusindicator.cxx        |    2 
 UnoControls/source/inc/progressbar.hxx                 |    2 
 toolkit/source/awt/scrollabledialog.cxx                |    4 
 toolkit/source/awt/vclxdevice.cxx                      |    2 
 toolkit/source/awt/vclxtoolkit.cxx                     |  130 ++++++++---------
 toolkit/source/awt/vclxwindows.cxx                     |    2 
 uui/source/iahndl-authentication.cxx                   |   12 -
 uui/source/iahndl-errorhandler.cxx                     |   10 -
 uui/source/iahndl-locking.cxx                          |    6 
 xmlsecurity/source/dialogs/certificatechooser.cxx      |    2 
 xmlsecurity/source/dialogs/certificateviewer.cxx       |    8 -
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |    2 
 xmlsecurity/source/dialogs/macrosecurity.cxx           |    6 
 14 files changed, 96 insertions(+), 94 deletions(-)

New commits:
commit 5d5f447e738f159297b3d7bf10220c3cdfe7e2fa
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Apr 16 22:18:45 2015 +0100

    UnoControls, toolkit, uuoi, xmlsecurity: convert new to ::Create.
    
    Change-Id: I7b8c7ece656589c50fb066e9fa1565fd59f930da

diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx
index e752b00..709ea0f 100644
--- a/UnoControls/source/controls/progressmonitor.cxx
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -57,7 +57,7 @@ ProgressMonitor::ProgressMonitor( const css::uno::Reference< XComponentContext >
     m_xTopic_Bottom = css::uno::Reference< XFixedText >   ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY );
     m_xText_Bottom  = css::uno::Reference< XFixedText >   ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY );
     m_xButton       = css::uno::Reference< XButton >      ( rxContext->getServiceManager()->createInstanceWithContext( BUTTON_SERVICENAME, rxContext ), UNO_QUERY );
-    m_xProgressBar = new ProgressBar(rxContext);
+    m_xProgressBar = VclPtr<ProgressBar>::Create(rxContext);
 
     // ... cast controls to Reference< XControl >  (for "setModel"!) ...
     css::uno::Reference< XControl >   xRef_Topic_Top      ( m_xTopic_Top    , UNO_QUERY );
diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx
index 240d148..f4e5457 100644
--- a/UnoControls/source/controls/statusindicator.cxx
+++ b/UnoControls/source/controls/statusindicator.cxx
@@ -47,7 +47,7 @@ StatusIndicator::StatusIndicator( const css::uno::Reference< XComponentContext >
 
     // Create instances for fixedtext and progress ...
     m_xText         = css::uno::Reference< XFixedText >   ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY );
-    m_xProgressBar = new ProgressBar(rxContext);
+    m_xProgressBar = VclPtr<ProgressBar>::Create(rxContext);
     // ... cast controls to css::uno::Reference< XControl > and set model ...
     // ( ProgressBar has no model !!! )
     css::uno::Reference< XControl > xTextControl      ( m_xText       , UNO_QUERY );
diff --git a/UnoControls/source/inc/progressbar.hxx b/UnoControls/source/inc/progressbar.hxx
index 1199453..2b1dee2 100644
--- a/UnoControls/source/inc/progressbar.hxx
+++ b/UnoControls/source/inc/progressbar.hxx
@@ -23,6 +23,8 @@
 #include <com/sun/star/lang/XServiceName.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
+#include <vcl/vclptr.hxx>
+
 #include "basecontrol.hxx"
 
 //  namespaces
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index 71525b1..bcb508c 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -33,8 +33,8 @@ namespace toolkit
 template< class T>
 ScrollableWrapper<T>::ScrollableWrapper( vcl::Window* pParent, WinBits nStyle )
     : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) ),
-      maHScrollBar( new ScrollBar(this, WB_HSCROLL | WB_DRAG) ),
-      maVScrollBar( new ScrollBar(this, WB_VSCROLL | WB_DRAG) ),
+      maHScrollBar( VclPtr<ScrollBar>::Create(this, WB_HSCROLL | WB_DRAG) ),
+      maVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_DRAG) ),
       mbHasHoriBar( false ),
       mbHasVertBar( false ),
       maScrollVis( None )
diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx
index e464d72..da7ad04 100644
--- a/toolkit/source/awt/vclxdevice.cxx
+++ b/toolkit/source/awt/vclxdevice.cxx
@@ -102,7 +102,7 @@ IMPL_XTYPEPROVIDER_END
     if ( GetOutputDevice() )
     {
         VCLXVirtualDevice* pVDev = new VCLXVirtualDevice;
-        VirtualDevice* pVclVDev = new VirtualDevice( *GetOutputDevice() );
+        VclPtrInstance<VirtualDevice> pVclVDev( *GetOutputDevice() );
         pVclVDev->SetOutputSizePixel( Size( nWidth, nHeight ) );
         pVDev->SetVirtualDevice( pVclVDev );
         xRef = pVDev;
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 22ce651..50106d8 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -800,67 +800,67 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
         switch ( (WindowType)nType )
         {
             case WINDOW_CANCELBUTTON:
-                pNewWindow = new CancelButton( pParent, nWinBits );
+                pNewWindow = VclPtr<CancelButton>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXButton;
             break;
             case WINDOW_CHECKBOX:
-                 pNewWindow = new CheckBox( pParent, nWinBits );
+                 pNewWindow = VclPtr<CheckBox>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXCheckBox;
             break;
             case WINDOW_COMBOBOX:
-                pNewWindow = new ComboBox( pParent, nWinBits|WB_AUTOHSCROLL );
+                pNewWindow = VclPtr<ComboBox>::Create( pParent, nWinBits|WB_AUTOHSCROLL );
                 static_cast<ComboBox*>(pNewWindow)->EnableAutoSize( false );
                 *ppNewComp = new VCLXComboBox;
             break;
             case WINDOW_CURRENCYBOX:
-                pNewWindow = new CurrencyBox( pParent, nWinBits );
+                pNewWindow = VclPtr<CurrencyBox>::Create( pParent, nWinBits );
             break;
             case WINDOW_CURRENCYFIELD:
-                pNewWindow = new CurrencyField( pParent, nWinBits );
+                pNewWindow = VclPtr<CurrencyField>::Create( pParent, nWinBits );
                 static_cast<CurrencyField*>(pNewWindow)->EnableEmptyFieldValue( true );
                 *ppNewComp = new VCLXNumericField;
                 static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<CurrencyField*>(pNewWindow) );
             break;
             case WINDOW_DATEBOX:
-                pNewWindow = new DateBox( pParent, nWinBits );
+                pNewWindow = VclPtr<DateBox>::Create( pParent, nWinBits );
             break;
             case WINDOW_DATEFIELD:
-                pNewWindow = new DateField( pParent, nWinBits );
+                pNewWindow = VclPtr<DateField>::Create( pParent, nWinBits );
                 static_cast<DateField*>(pNewWindow)->EnableEmptyFieldValue( true );
                 *ppNewComp = new VCLXDateField;
                 static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<DateField*>(pNewWindow) );
             break;
             case WINDOW_DOCKINGAREA:
-                pNewWindow = new DockingAreaWindow( pParent );
+                pNewWindow = VclPtr<DockingAreaWindow>::Create( pParent );
             break;
             case WINDOW_MULTILINEEDIT:
             case WINDOW_EDIT:
-                pNewWindow = new Edit( pParent, nWinBits );
+                pNewWindow = VclPtr<Edit>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXEdit;
             break;
             case WINDOW_ERRORBOX:
-                pNewWindow = new ErrorBox( pParent, nWinBits, OUString() );
+                pNewWindow = VclPtr<ErrorBox>::Create( pParent, nWinBits, OUString() );
                 *ppNewComp = new VCLXMessageBox;
             break;
             case WINDOW_FIXEDBITMAP:
-                pNewWindow = new FixedBitmap( pParent, nWinBits );
+                pNewWindow = VclPtr<FixedBitmap>::Create( pParent, nWinBits );
             break;
             case WINDOW_FIXEDIMAGE:
-                pNewWindow = new ImageControl( pParent, nWinBits );
+                pNewWindow = VclPtr<ImageControl>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXImageControl;
             break;
             case WINDOW_FIXEDLINE:
-                pNewWindow = new FixedLine( pParent, nWinBits );
+                pNewWindow = VclPtr<FixedLine>::Create( pParent, nWinBits );
             break;
             case WINDOW_FIXEDTEXT:
-                pNewWindow = new FixedText( pParent, nWinBits );
+                pNewWindow = VclPtr<FixedText>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXFixedText;
             break;
             case WINDOW_FLOATINGWINDOW:
-                pNewWindow = new FloatingWindow( pParent, nWinBits );
+                pNewWindow = VclPtr<FloatingWindow>::Create( pParent, nWinBits );
             break;
             case WINDOW_GROUPBOX:
-                pNewWindow = new GroupBox( pParent, nWinBits );
+                pNewWindow = VclPtr<GroupBox>::Create( pParent, nWinBits );
                 if ( bFrameControl )
                 {
                     GroupBox* pGroupBox =  static_cast< GroupBox* >( pNewWindow );
@@ -871,43 +871,43 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
                 }
             break;
             case WINDOW_HELPBUTTON:
-                pNewWindow = new HelpButton( pParent, nWinBits );
+                pNewWindow = VclPtr<HelpButton>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXButton;
             break;
             case WINDOW_IMAGEBUTTON:
-                 pNewWindow = new ImageButton( pParent, nWinBits );
+                 pNewWindow = VclPtr<ImageButton>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXButton;
             break;
             case WINDOW_INFOBOX:
-                pNewWindow = new InfoBox( pParent, OUString() );
+                pNewWindow = VclPtr<InfoBox>::Create( pParent, OUString() );
                 *ppNewComp = new VCLXMessageBox;
             break;
             case WINDOW_LISTBOX:
-                pNewWindow = new ListBox( pParent, nWinBits|WB_SIMPLEMODE|WB_AUTOHSCROLL );
+                pNewWindow = VclPtr<ListBox>::Create( pParent, nWinBits|WB_SIMPLEMODE|WB_AUTOHSCROLL );
                 static_cast<ListBox*>(pNewWindow)->EnableAutoSize( false );
                 *ppNewComp = new VCLXListBox;
             break;
             case WINDOW_LONGCURRENCYBOX:
-                pNewWindow = new LongCurrencyBox( pParent, nWinBits );
+                pNewWindow = VclPtr<LongCurrencyBox>::Create( pParent, nWinBits );
             break;
             case WINDOW_LONGCURRENCYFIELD:
-                pNewWindow = new LongCurrencyField( pParent, nWinBits );
+                pNewWindow = VclPtr<LongCurrencyField>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXCurrencyField;
                 static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<LongCurrencyField*>(pNewWindow) );
             break;
             case WINDOW_MENUBUTTON:
-                pNewWindow = new MenuButton( pParent, nWinBits );
+                pNewWindow = VclPtr<MenuButton>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXButton;
             break;
             case WINDOW_MESSBOX:
-                pNewWindow = new MessBox( pParent, nWinBits, OUString(), OUString() );
+                pNewWindow = VclPtr<MessBox>::Create( pParent, nWinBits, OUString(), OUString() );
                 *ppNewComp = new VCLXMessageBox;
             break;
             case WINDOW_METRICBOX:
-                pNewWindow = new MetricBox( pParent, nWinBits );
+                pNewWindow = VclPtr<MetricBox>::Create( pParent, nWinBits );
             break;
             case WINDOW_METRICFIELD:
-                pNewWindow = new MetricField( pParent, nWinBits );
+                pNewWindow = VclPtr<MetricField>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXMetricField;
                 static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<MetricField*>(pNewWindow) );
             break;
@@ -930,44 +930,44 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
             }
             break;
             case WINDOW_MOREBUTTON:
-                pNewWindow = new MoreButton( pParent, nWinBits );
+                pNewWindow = VclPtr<MoreButton>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXButton;
             break;
             case WINDOW_MULTILISTBOX:
-                pNewWindow = new MultiListBox( pParent, nWinBits );
+                pNewWindow = VclPtr<MultiListBox>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXListBox;
             break;
             case WINDOW_NUMERICBOX:
-                pNewWindow = new NumericBox( pParent, nWinBits );
+                pNewWindow = VclPtr<NumericBox>::Create( pParent, nWinBits );
             break;
             case WINDOW_NUMERICFIELD:
-                pNewWindow = new NumericField( pParent, nWinBits );
+                pNewWindow = VclPtr<NumericField>::Create( pParent, nWinBits );
                 static_cast<NumericField*>(pNewWindow)->EnableEmptyFieldValue( true );
                 *ppNewComp = new VCLXNumericField;
                 static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<NumericField*>(pNewWindow) );
             break;
             case WINDOW_OKBUTTON:
-                pNewWindow = new OKButton( pParent, nWinBits );
+                pNewWindow = VclPtr<OKButton>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXButton;
             break;
             case WINDOW_PATTERNBOX:
-                pNewWindow = new PatternBox( pParent, nWinBits );
+                pNewWindow = VclPtr<PatternBox>::Create( pParent, nWinBits );
             break;
             case WINDOW_PATTERNFIELD:
-                pNewWindow = new PatternField( pParent, nWinBits );
+                pNewWindow = VclPtr<PatternField>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXPatternField;
                 static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<PatternField*>(pNewWindow) );
             break;
             case WINDOW_PUSHBUTTON:
-                pNewWindow = new PushButton( pParent, nWinBits );
+                pNewWindow = VclPtr<PushButton>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXButton;
             break;
             case WINDOW_QUERYBOX:
-                pNewWindow = new QueryBox( pParent, nWinBits, OUString() );
+                pNewWindow = VclPtr<QueryBox>::Create( pParent, nWinBits, OUString() );
                 *ppNewComp = new VCLXMessageBox;
             break;
             case WINDOW_RADIOBUTTON:
-                pNewWindow = new RadioButton( pParent, nWinBits );
+                pNewWindow = VclPtr<RadioButton>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXRadioButton;
 
                 // by default, disable RadioCheck
@@ -982,64 +982,64 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
                 static_cast<RadioButton*>(pNewWindow)->EnableRadioCheck( false );
             break;
             case WINDOW_SCROLLBAR:
-                pNewWindow = new ScrollBar( pParent, nWinBits );
+                pNewWindow = VclPtr<ScrollBar>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXScrollBar;
             break;
             case WINDOW_SCROLLBARBOX:
-                pNewWindow = new ScrollBarBox( pParent, nWinBits );
+                pNewWindow = VclPtr<ScrollBarBox>::Create( pParent, nWinBits );
             break;
             case WINDOW_SPINBUTTON:
-                pNewWindow = new SpinButton( pParent, nWinBits );
+                pNewWindow = VclPtr<SpinButton>::Create( pParent, nWinBits );
                 *ppNewComp = new ::toolkit::VCLXSpinButton;
             break;
             case WINDOW_SPINFIELD:
-                pNewWindow = new SpinField( pParent, nWinBits );
+                pNewWindow = VclPtr<SpinField>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXNumericField;
             break;
             case WINDOW_SPLITTER:
-                pNewWindow = new Splitter( pParent, nWinBits );
+                pNewWindow = VclPtr<Splitter>::Create( pParent, nWinBits );
             break;
             case WINDOW_SPLITWINDOW:
-                pNewWindow = new SplitWindow( pParent, nWinBits );
+                pNewWindow = VclPtr<SplitWindow>::Create( pParent, nWinBits );
             break;
             case WINDOW_STATUSBAR:
-                pNewWindow = new StatusBar( pParent, nWinBits );
+                pNewWindow = VclPtr<StatusBar>::Create( pParent, nWinBits );
             break;
             case VCLWINDOW_SYSTEMCHILDWINDOW:
-                pNewWindow = new SystemChildWindow( pParent, nWinBits );
+                pNewWindow = VclPtr<SystemChildWindow>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXSystemDependentWindow();
             break;
             case WINDOW_TABCONTROL:
-                pNewWindow = new TabControl( pParent, nWinBits );
+                pNewWindow = VclPtr<TabControl>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXMultiPage;
             break;
             case WINDOW_TABDIALOG:
-                pNewWindow = new TabDialog( pParent, nWinBits );
+                pNewWindow = VclPtr<TabDialog>::Create( pParent, nWinBits );
             break;
             case WINDOW_TABPAGE:
                 {
-                    pNewWindow = new TabPage( pParent, nWinBits );
+                    pNewWindow = VclPtr<TabPage>::Create( pParent, nWinBits );
                     *ppNewComp = new VCLXTabPage;
                 }
             break;
             case WINDOW_TIMEBOX:
-                pNewWindow = new TimeBox( pParent, nWinBits );
+                pNewWindow = VclPtr<TimeBox>::Create( pParent, nWinBits );
             break;
             case WINDOW_TIMEFIELD:
-                pNewWindow = new TimeField( pParent, nWinBits );
+                pNewWindow = VclPtr<TimeField>::Create( pParent, nWinBits );
                 static_cast<TimeField*>(pNewWindow)->EnableEmptyFieldValue( true );
                 *ppNewComp = new VCLXTimeField;
                 static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<TimeField*>(pNewWindow) );
             break;
             case WINDOW_TOOLBOX:
-                pNewWindow = new ToolBox( pParent, nWinBits );
+                pNewWindow = VclPtr<ToolBox>::Create( pParent, nWinBits );
                 *ppNewComp = new VCLXToolBox;
             break;
             case WINDOW_TRISTATEBOX:
-                pNewWindow = new TriStateBox( pParent, nWinBits );
+                pNewWindow = VclPtr<TriStateBox>::Create( pParent, nWinBits );
             break;
             case WINDOW_WARNINGBOX:
-                pNewWindow = new WarningBox( pParent, nWinBits, OUString() );
+                pNewWindow = VclPtr<WarningBox>::Create( pParent, nWinBits, OUString() );
                 *ppNewComp = new VCLXMessageBox;
             break;
             case WINDOW_WORKWINDOW:
@@ -1049,7 +1049,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
                 if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP )
                 {
                     if (nType == WINDOW_DOCKINGWINDOW )
-                        pNewWindow = new DockingWindow( pParent, nWinBits );
+                        pNewWindow = VclPtr<DockingWindow>::Create( pParent, nWinBits );
                     else
                     {
                         if ((pParent == NULL) && rDescriptor.Parent.is())
@@ -1108,13 +1108,13 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
                                     #elif defined WNT
                                     aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle);
                                     #endif
-                                    pNewWindow = new WorkWindow( &aParentData );
+                                    pNewWindow = VclPtr<WorkWindow>::Create( &aParentData );
                                 }
                             }
                         }
 
                         if (!pNewWindow)
-                            pNewWindow = new WorkWindow( pParent, nWinBits );
+                            pNewWindow = VclPtr<WorkWindow>::Create( pParent, nWinBits );
                     }
 
                     *ppNewComp = new VCLXTopWindow( pNewWindow->GetType() == WINDOW_WORKWINDOW );
@@ -1122,17 +1122,17 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
                 else if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_CONTAINER )
                 {
                     if (nType == WINDOW_DOCKINGWINDOW )
-                        pNewWindow = new DockingWindow( pParent, nWinBits );
+                        pNewWindow = VclPtr<DockingWindow>::Create( pParent, nWinBits );
                     else
-                        pNewWindow = new vcl::Window( pParent, nWinBits );
+                        pNewWindow = VclPtr<vcl::Window>::Create( pParent, nWinBits );
                     *ppNewComp = new VCLXContainer;
                 }
                 else
                 {
                     if (nType == WINDOW_DOCKINGWINDOW )
-                        pNewWindow = new DockingWindow( pParent, nWinBits );
+                        pNewWindow = VclPtr<DockingWindow>::Create( pParent, nWinBits );
                     else
-                        pNewWindow = new vcl::Window( pParent, nWinBits );
+                        pNewWindow = VclPtr<vcl::Window>::Create( pParent, nWinBits );
                     *ppNewComp = new VCLXWindow;
                 }
             break;
@@ -1140,12 +1140,12 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
                 if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
                         "tabpagecontainer" ) )
                 {
-                    pNewWindow = new TabControl( pParent, nWinBits );
+                    pNewWindow = VclPtr<TabControl>::Create( pParent, nWinBits );
                     *ppNewComp = new VCLXTabPageContainer;
                 }
                 else if ( aServiceName == "animatedimages" )
                 {
-                    pNewWindow = new Throbber( pParent, nWinBits );
+                    pNewWindow = VclPtr<Throbber>::Create( pParent, nWinBits );
                     *ppNewComp = new ::toolkit::AnimatedImagesPeer;
                 }
             break;
@@ -1293,7 +1293,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
 // ::com::sun::star::awt::XSystemChildFactory
 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createSystemChild( const ::com::sun::star::uno::Any& Parent, const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 nSystemType ) throw(::com::sun::star::uno::RuntimeException, std::exception)
 {
-    vcl::Window* pChildWindow = NULL;
+    VclPtr<vcl::Window> pChildWindow;
     if ( nSystemType == SYSTEM_DEPENDENT_TYPE )
     {
         // use sal_Int64 here to accommodate all int types
@@ -1340,7 +1340,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
             SolarMutexGuard aGuard;
             try
             {
-                pChildWindow = new WorkWindow( &aParentData );
+                pChildWindow.reset( VclPtr<WorkWindow>::Create( &aParentData ) );
             }
             catch ( const ::com::sun::star::uno::RuntimeException & rEx )
             {
@@ -1349,14 +1349,14 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
                     "VCLXToolkit::createSystemChild: caught %s\n",
                     OUStringToOString(
                         rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
-                pChildWindow = NULL;
+                pChildWindow.clear();
             }
         }
     }
     else if (nSystemType == com::sun::star::lang::SystemDependent::SYSTEM_JAVA)
     {
         SolarMutexGuard aGuard;
-        pChildWindow = new WorkWindow(0, Parent);
+        pChildWindow.reset(VclPtr<WorkWindow>::Create(nullptr, Parent));
     }
 
     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer;
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index e2814d2..ca90846 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -2595,7 +2595,7 @@ TabControl *VCLXMultiPage::getTabControl() const throw (uno::RuntimeException)
 sal_Int32 SAL_CALL VCLXMultiPage::insertTab() throw (uno::RuntimeException, std::exception)
 {
     TabControl *pTabControl = getTabControl();
-    TabPage* pTab = new TabPage( pTabControl );
+    VclPtrInstance<TabPage> pTab( pTabControl );
     OUString title ("");
     return static_cast< sal_Int32 >( insertTab( pTab, title ) );
 }
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index 89847aa..43f0f29 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -89,7 +89,7 @@ executeLoginDialog(
             nFlags |= LF_NO_USESYSCREDS;
 
         VclPtr< LoginDialog > xDialog(
-                new LoginDialog(pParent, nFlags, rInfo.GetServer(), rRealm));
+                VclPtr<LoginDialog>::Create(pParent, nFlags, rInfo.GetServer(), rRealm));
         if (!rInfo.GetErrorText().isEmpty())
             xDialog->SetErrorText(rInfo.GetErrorText());
         xDialog->SetName(rInfo.GetUserName());
@@ -418,7 +418,7 @@ executeMasterPasswordDialog(
         if( nMode == task::PasswordRequestMode_PASSWORD_CREATE )
         {
             VclPtr< MasterPasswordCreateDialog > xDialog(
-                new MasterPasswordCreateDialog(pParent, xManager.get()));
+                VclPtr<MasterPasswordCreateDialog>::Create(pParent, xManager.get()));
             rInfo.SetResult(xDialog->Execute()
                 == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
             aMaster = OUStringToOString(
@@ -427,7 +427,7 @@ executeMasterPasswordDialog(
         else
         {
             VclPtr< MasterPasswordDialog > xDialog(
-                new MasterPasswordDialog(pParent, nMode, xManager.get()));
+                VclPtr<MasterPasswordDialog>::Create(pParent, nMode, xManager.get()));
             rInfo.SetResult(xDialog->Execute()
                 == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
             aMaster = OUStringToOString(
@@ -518,7 +518,7 @@ executePasswordDialog(
             if (bIsSimplePasswordRequest)
             {
                 VclPtr< PasswordDialog > pDialog(
-                    new PasswordDialog( pParent, nMode, xManager.get(), aDocName,
+                    VclPtr<PasswordDialog>::Create( pParent, nMode, xManager.get(), aDocName,
                     bIsPasswordToModify, bIsSimplePasswordRequest ) );
                 pDialog->SetMinLen(0);
 
@@ -542,7 +542,7 @@ executePasswordDialog(
         else // enter password or reenter password
         {
             VclPtr< PasswordDialog > pDialog(
-                new PasswordDialog( pParent, nMode, xManager.get(), aDocName,
+                VclPtr<PasswordDialog>::Create( pParent, nMode, xManager.get(), aDocName,
                 bIsPasswordToModify, bIsSimplePasswordRequest ) );
             pDialog->SetMinLen(0);
 
@@ -752,7 +752,7 @@ UUIInteractionHelper::handleAuthFallbackRequest( OUString & instructions,
         uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations )
 {
     vcl::Window * pParent = getParentProperty( );
-    AuthFallbackDlg *dlg = new AuthFallbackDlg( pParent, instructions, url );
+    VclPtrInstance<AuthFallbackDlg> dlg( pParent, instructions, url );
     int retCode = dlg->Execute( );
     uno::Reference< task::XInteractionAbort > xAbort;
     uno::Reference< ucb::XInteractionAuthFallback > xAuthFallback;
diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx
index db209cb..3b12c7b 100644
--- a/uui/source/iahndl-errorhandler.cxx
+++ b/uui/source/iahndl-errorhandler.cxx
@@ -61,13 +61,13 @@ executeErrorDialog(
         switch (eClassification)
         {
         case task::InteractionClassification_ERROR:
-            xBox.reset(new ErrorBox(pParent,
+            xBox.reset(VclPtr<ErrorBox>::Create(pParent,
                                     nButtonMask,
                                     aText.makeStringAndClear()));
             break;
 
         case task::InteractionClassification_WARNING:
-            xBox.reset(new WarningBox(pParent,
+            xBox.reset(VclPtr<WarningBox>::Create(pParent,
                                       nButtonMask,
                                       aText.makeStringAndClear()));
             break;
@@ -76,16 +76,16 @@ executeErrorDialog(
 #           define WB_DEF_BUTTONS (WB_DEF_OK | WB_DEF_CANCEL | WB_DEF_RETRY)
             //(want to ignore any default button settings)...
             if ((nButtonMask & WB_DEF_BUTTONS) == WB_DEF_OK)
-                xBox.reset(new InfoBox(pParent,
+                xBox.reset(VclPtr<InfoBox>::Create(pParent,
                                        aText.makeStringAndClear()));
             else
-                xBox.reset(new ErrorBox(pParent,
+                xBox.reset(VclPtr<ErrorBox>::Create(pParent,
                                         nButtonMask,
                                         aText.makeStringAndClear()));
             break;
 
         case task::InteractionClassification_QUERY:
-            xBox.reset(new QueryBox(pParent,
+            xBox.reset(VclPtr<QueryBox>::Create(pParent,
                                     nButtonMask,
                                     aText.makeStringAndClear()));
             break;
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
index aac4cd8..0b7c5cf 100644
--- a/uui/source/iahndl-locking.cxx
+++ b/uui/source/iahndl-locking.cxx
@@ -121,7 +121,7 @@ handleLockedDocumentRequest_(
                 aMessage, aArguments );
 
             VclPtr< AlreadyOpenQueryBox > xDialog(
-                new AlreadyOpenQueryBox( pParent,
+                VclPtr<AlreadyOpenQueryBox>::Create( pParent,
                                          xManager.get(),
                                          aMessage,
                                          nMode == UUI_DOC_OWN_SAVE_LOCK ) );
@@ -162,7 +162,7 @@ handleChangedByOthersRequest_(
             return;
 
         VclPtr< FileChangedQueryBox > xDialog(
-            new FileChangedQueryBox( pParent, xManager.get() ) );
+            VclPtr<FileChangedQueryBox>::Create( pParent, xManager.get() ) );
         sal_Int32 nResult = xDialog->Execute();
 
         if ( nResult == RET_YES )
@@ -197,7 +197,7 @@ handleLockFileIgnoreRequest_(
             return;
 
         VclPtr< LockFailedQueryBox > xDialog(
-            new LockFailedQueryBox( pParent, xManager.get() ) );
+            VclPtr<LockFailedQueryBox>::Create( pParent, xManager.get() ) );
         sal_Int32 nResult = xDialog->Execute();
 
         if ( nResult == RET_OK )
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 4d1f11a..1c85bb7 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -62,7 +62,7 @@ CertificateChooser::CertificateChooser( vcl::Window* _pParent, uno::Reference< u
     pSignatures->set_width_request(aControlSize.Width());
     pSignatures->set_height_request(aControlSize.Height());
 
-    m_pCertLB = new SvSimpleTable(*pSignatures);
+    m_pCertLB = VclPtr<SvSimpleTable>::Create(*pSignatures);
     static long nTabs[] = { 3, 0, 30*nControlWidth/100, 60*nControlWidth/100 };
     m_pCertLB->SetTabs( &nTabs[0] );
     m_pCertLB->InsertHeaderEntry(get<FixedText>("issuedto")->GetText() + "\t" + get<FixedText>("issuedby")->GetText()
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 58bf309..6d8bb8d 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -53,9 +53,9 @@ CertificateViewer::CertificateViewer(
     mnDetailsId = mpTabCtrl->GetPageId("details");
     mnPathId = mpTabCtrl->GetPageId("path");
 
-    mpTabCtrl->SetTabPage(mnGeneralId, new CertificateViewerGeneralTP( mpTabCtrl, this));
-    mpTabCtrl->SetTabPage(mnDetailsId, new CertificateViewerDetailsTP( mpTabCtrl, this));
-    mpTabCtrl->SetTabPage(mnPathId, new CertificateViewerCertPathTP( mpTabCtrl, this));
+    mpTabCtrl->SetTabPage(mnGeneralId, VclPtr<CertificateViewerGeneralTP>::Create( mpTabCtrl, this));
+    mpTabCtrl->SetTabPage(mnDetailsId, VclPtr<CertificateViewerDetailsTP>::Create( mpTabCtrl, this));
+    mpTabCtrl->SetTabPage(mnPathId, VclPtr<CertificateViewerCertPathTP>::Create( mpTabCtrl, this));
     mpTabCtrl->SetCurPageId(mnGeneralId);
 }
 
@@ -217,7 +217,7 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
 {
     get( m_pValueDetails, "valuedetails" );
     get( m_pElementsLBContainer, "tablecontainer" );
-    m_pElementsLB = new SvSimpleTable( *m_pElementsLBContainer );
+    m_pElementsLB = VclPtr<SvSimpleTable>::Create( *m_pElementsLBContainer );
 
     m_aStdFont = m_pValueDetails->GetControlFont();
     WinBits nStyle = m_pElementsLB->GetStyle();
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index ecd9507..9673a3c 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -198,7 +198,7 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
     pSignatures->set_width_request(aControlSize.Width());
     pSignatures->set_height_request(aControlSize.Height());
 
-    m_pSignaturesLB = new SvSimpleTable(*pSignatures);
+    m_pSignaturesLB = VclPtr<SvSimpleTable>::Create(*pSignatures);
     // #i48253# the tablistbox needs its own unique id
     m_pSignaturesLB->Window::SetUniqueId( HID_XMLSEC_TREE_SIGNATURESDLG );
     static long aTabs[] = { 4, 0, 6*nControlWidth/100, 36*nControlWidth/100, 74*nControlWidth/100 };
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index ab3ac51..33cead5 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -69,8 +69,8 @@ MacroSecurity::MacroSecurity( vcl::Window* _pParent,
     get(m_pResetBtn, "reset");
     get(m_pOkBtn, "ok");
 
-    mpLevelTP = new MacroSecurityLevelTP(m_pTabCtrl, this);
-    mpTrustSrcTP = new MacroSecurityTrustedSourcesTP(m_pTabCtrl, this);
+    mpLevelTP.reset(VclPtr<MacroSecurityLevelTP>::Create(m_pTabCtrl, this));
+    mpTrustSrcTP.reset(VclPtr<MacroSecurityTrustedSourcesTP>::Create(m_pTabCtrl, this));
 
     m_nSecLevelId = m_pTabCtrl->GetPageId("SecurityLevelPage");
     m_nSecTrustId = m_pTabCtrl->GetPageId("SecurityTrustPage");
@@ -388,7 +388,7 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(vcl::Window* _pPare
     get(m_pRemoveLocPB, "removefile");
 
     SvSimpleTableContainer *pCertificates = get<SvSimpleTableContainer>("certificates");
-    m_pTrustCertLB = new TrustCertLB(*pCertificates);
+    m_pTrustCertLB.reset(VclPtr<TrustCertLB>::Create(*pCertificates));
     static long aTabs[] = { 3, 0, 0, 0 };
     m_pTrustCertLB->SetTabs( aTabs );
 


More information about the Libreoffice-commits mailing list