diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 11:41:31 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 15:08:48 +0100 |
commit | e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch) | |
tree | b322529f4a54a6427862cb20cb4cf87fb6a5d065 /filter/source | |
parent | 2b0be6c0e9d23f1b8535ba7033732ae2e3bfb5c9 (diff) | |
parent | 0cde74f788a054fa2b65107a030dd463b8d11c7a (diff) |
Merge remote-tracking branch 'origin/feature/vclptr'
Resolve several thousand lines of conflicts.
Conflicts:
accessibility/source/extended/accessiblelistbox.cxx
accessibility/source/standard/vclxaccessiblecombobox.cxx
accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
accessibility/source/standard/vclxaccessiblelistbox.cxx
accessibility/source/standard/vclxaccessibletextfield.cxx
basctl/source/basicide/basidesh.cxx
cui/source/inc/chardlg.hxx
cui/source/tabpages/tpbitmap.cxx
dbaccess/source/ui/dlg/UserAdmin.cxx
dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
extensions/source/propctrlr/propertyeditor.hxx
extensions/source/scanner/sanedlg.cxx
filter/source/pdf/impdialog.cxx
include/sfx2/mgetempl.hxx
include/sfx2/sidebar/SidebarToolBox.hxx
include/sfx2/viewsh.hxx
include/svtools/brwbox.hxx
include/svtools/filectrl.hxx
include/svtools/scrwin.hxx
include/svx/dlgctrl.hxx
include/svx/sidebar/Popup.hxx
include/svx/sidebar/PopupContainer.hxx
include/svx/sidebar/PopupControl.hxx
include/svx/sidebar/SidebarDialControl.hxx
include/svx/sidebar/ValueSetWithTextControl.hxx
sc/source/ui/condformat/condformatdlgentry.cxx
sc/source/ui/navipi/navipi.cxx
sc/source/ui/sidebar/CellBorderStyleControl.hxx
sd/source/ui/animations/CustomAnimationDialog.cxx
sd/source/ui/inc/DrawViewShell.hxx
sd/source/ui/inc/Ruler.hxx
sd/source/ui/inc/SlideSorter.hxx
sd/source/ui/inc/ViewTabBar.hxx
sd/source/ui/inc/Window.hxx
sd/source/ui/inc/morphdlg.hxx
sd/source/ui/inc/sdpreslt.hxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
sd/source/ui/sidebar/LayoutMenu.hxx
sd/source/ui/sidebar/MasterPagesSelector.hxx
sd/source/ui/sidebar/NavigatorWrapper.hxx
sd/source/ui/sidebar/PanelBase.hxx
sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
sd/source/ui/slideshow/showwindow.hxx
sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
sd/source/ui/view/ViewShellBase.cxx
sd/source/ui/view/drviewsa.cxx
sfx2/source/appl/fileobj.hxx
sfx2/source/appl/opengrf.cxx
sfx2/source/control/thumbnailviewacc.hxx
sfx2/source/dialog/securitypage.cxx
sfx2/source/dialog/templdlg.cxx
sfx2/source/doc/docinsert.cxx
sfx2/source/doc/guisaveas.cxx
sfx2/source/inc/alienwarn.hxx
sfx2/source/sidebar/Deck.cxx
sfx2/source/sidebar/Deck.hxx
sfx2/source/sidebar/DeckTitleBar.cxx
sfx2/source/sidebar/DeckTitleBar.hxx
sfx2/source/sidebar/MenuButton.cxx
sfx2/source/sidebar/MenuButton.hxx
sfx2/source/sidebar/Panel.cxx
sfx2/source/sidebar/Panel.hxx
sfx2/source/sidebar/PanelTitleBar.hxx
sfx2/source/sidebar/SidebarDockingWindow.hxx
sfx2/source/sidebar/SidebarToolBox.cxx
sfx2/source/sidebar/TabBar.hxx
sfx2/source/sidebar/TabItem.cxx
sfx2/source/sidebar/TabItem.hxx
sfx2/source/sidebar/TitleBar.hxx
sfx2/source/toolbox/imgmgr.cxx
starmath/inc/edit.hxx
starmath/inc/smmod.hxx
starmath/qa/cppunit/test_starmath.cxx
starmath/source/edit.cxx
starmath/source/smmod.cxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/simptabl.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/valueimp.hxx
svx/inc/GalleryControl.hxx
svx/source/dialog/dlgctrl.cxx
svx/source/dialog/swframeexample.cxx
svx/source/fmcomp/fmgridif.cxx
svx/source/gallery2/GalleryControl.cxx
svx/source/sidebar/EmptyPanel.hxx
svx/source/sidebar/area/AreaPropertyPanel.hxx
svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
svx/source/sidebar/insert/InsertPropertyPanel.cxx
svx/source/sidebar/insert/InsertPropertyPanel.hxx
svx/source/sidebar/line/LinePropertyPanel.hxx
svx/source/sidebar/line/LineWidthControl.cxx
svx/source/sidebar/line/LineWidthControl.hxx
svx/source/sidebar/line/LineWidthValueSet.hxx
svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
svx/source/sidebar/possize/SidebarDialControl.cxx
svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
svx/source/sidebar/text/TextPropertyPanel.hxx
svx/source/sidebar/tools/PopupContainer.cxx
svx/source/sidebar/tools/PopupControl.cxx
svx/source/sidebar/tools/ValueSetWithTextControl.cxx
svx/source/svdraw/svdfmtf.hxx
svx/source/svdraw/svdibrow.cxx
svx/source/tbxctrls/colrctrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
sw/source/ui/dbui/mmaddressblockpage.cxx
sw/source/ui/dialog/uiregionsw.cxx
sw/source/ui/index/cnttab.cxx
sw/source/uibase/inc/drpcps.hxx
sw/source/uibase/sidebar/PageColumnControl.hxx
sw/source/uibase/sidebar/PageMarginControl.hxx
sw/source/uibase/sidebar/PageOrientationControl.hxx
sw/source/uibase/sidebar/PagePropertyPanel.hxx
sw/source/uibase/sidebar/PageSizeControl.hxx
sw/source/uibase/uiview/view2.cxx
sw/source/uibase/utlui/navipi.cxx
vcl/inc/svdata.hxx
vcl/source/control/combobox.cxx
vcl/source/control/lstbox.cxx
vcl/source/window/dockwin.cxx
vcl/source/window/winproc.cxx
Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
Diffstat (limited to 'filter/source')
43 files changed, 669 insertions, 414 deletions
diff --git a/filter/source/flash/impswfdialog.cxx b/filter/source/flash/impswfdialog.cxx index fe6b7fe7c485..bbe0bfbb7f98 100644 --- a/filter/source/flash/impswfdialog.cxx +++ b/filter/source/flash/impswfdialog.cxx @@ -60,8 +60,21 @@ ImpSWFDialog::ImpSWFDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFi ImpSWFDialog::~ImpSWFDialog() { + disposeOnce(); } +void ImpSWFDialog::dispose() +{ + mpNumFldQuality.clear(); + mpCheckExportAll.clear(); + mpCheckExportBackgrounds.clear(); + mpCheckExportBackgroundObjects.clear(); + mpCheckExportSlideContents.clear(); + mpCheckExportSound.clear(); + mpCheckExportOLEAsJPEG.clear(); + mpCheckExportMultipleFiles.clear(); + ModalDialog::dispose(); +} Sequence< PropertyValue > ImpSWFDialog::GetFilterData() diff --git a/filter/source/flash/impswfdialog.hxx b/filter/source/flash/impswfdialog.hxx index cb128448112e..aae9ecf7f1c2 100644 --- a/filter/source/flash/impswfdialog.hxx +++ b/filter/source/flash/impswfdialog.hxx @@ -41,14 +41,14 @@ namespace vcl { class Window; } class ImpSWFDialog : public ModalDialog { private: - NumericField * mpNumFldQuality; - CheckBox * mpCheckExportAll; - CheckBox * mpCheckExportBackgrounds; - CheckBox * mpCheckExportBackgroundObjects; - CheckBox * mpCheckExportSlideContents; - CheckBox * mpCheckExportSound; - CheckBox * mpCheckExportOLEAsJPEG; - CheckBox * mpCheckExportMultipleFiles; + VclPtr<NumericField> mpNumFldQuality; + VclPtr<CheckBox> mpCheckExportAll; + VclPtr<CheckBox> mpCheckExportBackgrounds; + VclPtr<CheckBox> mpCheckExportBackgroundObjects; + VclPtr<CheckBox> mpCheckExportSlideContents; + VclPtr<CheckBox> mpCheckExportSound; + VclPtr<CheckBox> mpCheckExportOLEAsJPEG; + VclPtr<CheckBox> mpCheckExportMultipleFiles; FilterConfigItem maConfigItem; @@ -58,6 +58,7 @@ public: ImpSWFDialog( vcl::Window* pParent, com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rFilterData ); virtual ~ImpSWFDialog(); + virtual void dispose() SAL_OVERRIDE; com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetFilterData(); }; diff --git a/filter/source/flash/swfdialog.cxx b/filter/source/flash/swfdialog.cxx index 64a182f47db3..dcfac419788c 100644 --- a/filter/source/flash/swfdialog.cxx +++ b/filter/source/flash/swfdialog.cxx @@ -146,9 +146,9 @@ Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames() -Dialog* SWFDialog::createDialog( vcl::Window* pParent ) +VclPtr<Dialog> SWFDialog::createDialog( vcl::Window* pParent ) { - Dialog* pRet = NULL; + VclPtr<Dialog> pRet; if (mxSrcDoc.is()) { @@ -172,8 +172,7 @@ Dialog* SWFDialog::createDialog( vcl::Window* pParent ) { } */ - ImpSWFDialog* pDlg = new ImpSWFDialog( pParent, maFilterData ); - pRet = pDlg; + pRet.reset( VclPtr<ImpSWFDialog>::Create( pParent, maFilterData ) ); } return pRet; @@ -184,7 +183,7 @@ Dialog* SWFDialog::createDialog( vcl::Window* pParent ) void SWFDialog::executedDialog( sal_Int16 nExecutionResult ) { if( nExecutionResult && m_pDialog ) - maFilterData = static_cast< ImpSWFDialog* >( m_pDialog )->GetFilterData(); + maFilterData = static_cast< ImpSWFDialog* >( m_pDialog.get() )->GetFilterData(); destroyDialog(); } diff --git a/filter/source/flash/swfdialog.hxx b/filter/source/flash/swfdialog.hxx index 931432e33c4c..2130f79f38b2 100644 --- a/filter/source/flash/swfdialog.hxx +++ b/filter/source/flash/swfdialog.hxx @@ -54,7 +54,7 @@ protected: virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual Dialog* createDialog( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<Dialog> createDialog( vcl::Window* pParent ) SAL_OVERRIDE; virtual void executedDialog( sal_Int16 nExecutionResult ) SAL_OVERRIDE; virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE; diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx index 4e2021264605..9f80ca9afaeb 100644 --- a/filter/source/flash/swfwriter.cxx +++ b/filter/source/flash/swfwriter.cxx @@ -49,7 +49,6 @@ Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int mnGlobalTransparency(0), mnJPEGCompressMode(nJPEGcompressMode) { - mpVDev = new VirtualDevice; mpVDev->EnableOutput( false ); maMovieTempFile.EnableKillingFile(); @@ -100,7 +99,7 @@ Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int Writer::~Writer() { - delete mpVDev; + mpVDev.disposeAndClear(); delete mpSprite; delete mpTag; } diff --git a/filter/source/flash/swfwriter.hxx b/filter/source/flash/swfwriter.hxx index 218459b00f6e..786410259559 100644 --- a/filter/source/flash/swfwriter.hxx +++ b/filter/source/flash/swfwriter.hxx @@ -25,6 +25,7 @@ #include <com/sun/star/i18n/XBreakIterator.hpp> #include <vcl/font.hxx> #include <vcl/gradient.hxx> +#include <vcl/vclptr.hxx> #include <unotools/tempfile.hxx> #include <tools/color.hxx> #include <tools/poly.hxx> @@ -395,7 +396,7 @@ private: sal_uInt16 mnWhiteBackgroundShapeId; sal_uInt16 mnPageButtonId; - VirtualDevice* mpVDev; + VclPtrInstance<VirtualDevice> mpVDev; const tools::PolyPolygon* mpClipPolyPolygon; diff --git a/filter/source/graphic/GraphicExportDialog.cxx b/filter/source/graphic/GraphicExportDialog.cxx index ca98685e20ab..94f02c58e62d 100644 --- a/filter/source/graphic/GraphicExportDialog.cxx +++ b/filter/source/graphic/GraphicExportDialog.cxx @@ -107,10 +107,10 @@ void GraphicExportDialog::setTitle( const OUString& aTitle ) sal_Int16 GraphicExportDialog::execute() throw ( RuntimeException, std::exception ) { sal_Int16 nReturn = ui::dialogs::ExecutableDialogResults::CANCEL; - GraphicExportOptionsDialog graphicExportOptionsDialog( Application::GetDefDialogParent(), mxSourceDocument ); - if (graphicExportOptionsDialog.Execute() == RET_OK ) + ScopedVclPtrInstance< GraphicExportOptionsDialog > graphicExportOptionsDialog( Application::GetDefDialogParent(), mxSourceDocument ); + if (graphicExportOptionsDialog->Execute() == RET_OK ) { - maFilterDataSequence = graphicExportOptionsDialog.getFilterData(); + maFilterDataSequence = graphicExportOptionsDialog->getFilterData(); nReturn = ui::dialogs::ExecutableDialogResults::OK; } return nReturn; diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx index 501a9a8ac31d..ef7b1307e1bf 100644 --- a/filter/source/graphicfilter/eos2met/eos2met.cxx +++ b/filter/source/graphicfilter/eos2met/eos2met.cxx @@ -156,8 +156,8 @@ private: sal_uInt32 nWrittenBitmaps; // number of already written Bitmaps sal_uInt32 nActBitmapPercent; // percentage of the next bitmap that's already written - ::std::unique_ptr< VirtualDevice > apDummyVDev; - OutputDevice* pCompDev; + ScopedVclPtr<VirtualDevice> apDummyVDev; + VclPtr<OutputDevice> pCompDev; com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; @@ -261,6 +261,7 @@ public: pCompDev = reinterpret_cast< OutputDevice* >( Application::GetAppWindow() ); if( !pCompDev ) { + apDummyVDev.disposeAndClear(); apDummyVDev.reset( new VirtualDevice ); pCompDev = apDummyVDev.get(); } @@ -1850,12 +1851,12 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) if( aGDIFont.GetAlign() != ALIGN_BASELINE) { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; if( aGDIFont.GetAlign()==ALIGN_TOP ) - aPt.Y()+=(long)aVDev.GetFontMetric( aGDIFont ).GetAscent(); + aPt.Y()+=(long)pVDev->GetFontMetric( aGDIFont ).GetAscent(); else - aPt.Y()-=(long)aVDev.GetFontMetric( aGDIFont ).GetDescent(); + aPt.Y()-=(long)pVDev->GetFontMetric( aGDIFont ).GetDescent(); } METSetMix(eGDIRasterOp); @@ -1879,11 +1880,11 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) if( aGDIFont.GetAlign() != ALIGN_BASELINE ) { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; if( aGDIFont.GetAlign() == ALIGN_TOP ) - aPt.Y()+=(long)aVDev.GetFontMetric(aGDIFont).GetAscent(); + aPt.Y()+=(long)pVDev->GetFontMetric(aGDIFont).GetAscent(); else - aPt.Y()-=(long)aVDev.GetFontMetric(aGDIFont).GetDescent(); + aPt.Y()-=(long)pVDev->GetFontMetric(aGDIFont).GetDescent(); } METSetMix(eGDIRasterOp); @@ -1922,7 +1923,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) case META_STRETCHTEXT_ACTION: { const MetaStretchTextAction* pA = static_cast<const MetaStretchTextAction*>(pMA); - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; sal_uInt16 i; sal_Int32 nNormSize; OUString aStr; @@ -1931,14 +1932,14 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) Point aPt( pA->GetPoint() ); Point aPt2; - aVDev.SetFont( aGDIFont ); + pVDev->SetFont( aGDIFont ); if( aGDIFont.GetAlign() != ALIGN_BASELINE) { if( aGDIFont.GetAlign() == ALIGN_TOP ) - aPt.Y()+=(long)aVDev.GetFontMetric().GetAscent(); + aPt.Y()+=(long)pVDev->GetFontMetric().GetAscent(); else - aPt.Y()-=(long)aVDev.GetFontMetric().GetDescent(); + aPt.Y()-=(long)pVDev->GetFontMetric().GetDescent(); } METSetMix(eGDIRasterOp); @@ -1949,7 +1950,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) METSetChrSet(FindChrSet(aGDIFont)); aStr = pA->GetText().copy(pA->GetIndex(),pA->GetLen()); boost::scoped_array<long> pDXAry(new long[aStr.getLength()]); - nNormSize = aVDev.GetTextArray( aStr, pDXAry.get() ); + nNormSize = pVDev->GetTextArray( aStr, pDXAry.get() ); for ( i = 0; i < aStr.getLength(); i++ ) { @@ -2067,24 +2068,24 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) case META_GRADIENT_ACTION: { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; GDIMetaFile aTmpMtf; const MetaGradientAction* pA = static_cast<const MetaGradientAction*>(pMA); - aVDev.SetMapMode( aTargetMapMode ); - aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf ); + pVDev->SetMapMode( aTargetMapMode ); + pVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf ); WriteOrders( &aTmpMtf ); } break; case META_HATCH_ACTION: { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; GDIMetaFile aTmpMtf; const MetaHatchAction* pA = static_cast<const MetaHatchAction*>(pMA); - aVDev.SetMapMode( aTargetMapMode ); - aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf ); + pVDev->SetMapMode( aTargetMapMode ); + pVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf ); WriteOrders( &aTmpMtf ); } break; diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx index 6631bdfc3671..9bf395375689 100644 --- a/filter/source/graphicfilter/epict/epict.cxx +++ b/filter/source/graphicfilter/epict/epict.cxx @@ -1699,12 +1699,11 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) if ( aSrcFont.GetAlign() != ALIGN_BASELINE ) { - VirtualDevice aVirDev; - + ScopedVclPtrInstance< VirtualDevice > pVirDev; if (aSrcFont.GetAlign()==ALIGN_TOP) - aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent(); + aPt.Y()+=(long)pVirDev->GetFontMetric(aSrcFont).GetAscent(); else - aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent(); + aPt.Y()-=(long)pVirDev->GetFontMetric(aSrcFont).GetDescent(); } SetAttrForText(); @@ -1720,12 +1719,12 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) if (aSrcFont.GetAlign()!=ALIGN_BASELINE) { - VirtualDevice aVirDev; + ScopedVclPtrInstance< VirtualDevice > pVirDev; if (aSrcFont.GetAlign()==ALIGN_TOP) - aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent(); + aPt.Y()+=(long)pVirDev->GetFontMetric(aSrcFont).GetAscent(); else - aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent(); + aPt.Y()-=(long)pVirDev->GetFontMetric(aSrcFont).GetDescent(); } SetAttrForText(); OUString aStr = pA->GetText().copy( pA->GetIndex(),pA->GetLen() ); @@ -1738,16 +1737,16 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) const MetaStretchTextAction* pA = static_cast<const MetaStretchTextAction*>(pMA); Point aPt( pA->GetPoint() ); OUString aStr = pA->GetText().copy( pA->GetIndex(),pA->GetLen() ); - VirtualDevice aVirDev; + ScopedVclPtrInstance< VirtualDevice > pVirDev; boost::scoped_array<long> pDXAry(new long[ aStr.getLength() ]); - sal_Int32 nNormSize( aVirDev.GetTextArray( aStr,pDXAry.get() ) ); + sal_Int32 nNormSize( pVirDev->GetTextArray( aStr,pDXAry.get() ) ); if (aSrcFont.GetAlign()!=ALIGN_BASELINE) { if (aSrcFont.GetAlign()==ALIGN_TOP) - aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent(); + aPt.Y()+=(long)pVirDev->GetFontMetric(aSrcFont).GetAscent(); else - aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent(); + aPt.Y()-=(long)pVirDev->GetFontMetric(aSrcFont).GetDescent(); } sal_Int32 nLength = aStr.getLength() - 1; @@ -1774,9 +1773,9 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) { const MetaBmpAction* pA = static_cast<const MetaBmpAction*>(pMA); const Bitmap aBmp( pA->GetBitmap() ); - VirtualDevice aVirDev; + ScopedVclPtrInstance< VirtualDevice > pVirDev; - WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp ); + WriteOpcode_BitsRect( pA->GetPoint(), pVirDev->PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp ); } break; @@ -1801,9 +1800,9 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) { const MetaBmpExAction* pA = static_cast<const MetaBmpExAction*>(pMA); const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); - VirtualDevice aVirDev; + ScopedVclPtrInstance< VirtualDevice > pVirDev; - WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp ); + WriteOpcode_BitsRect( pA->GetPoint(), pVirDev->PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp ); } break; @@ -1855,24 +1854,24 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) case META_GRADIENT_ACTION: { - VirtualDevice aVDev; + ScopedVclPtrInstance<VirtualDevice> aVDev; GDIMetaFile aTmpMtf; const MetaGradientAction* pA = static_cast<const MetaGradientAction*>(pMA); - aVDev.SetMapMode( aTargetMapMode ); - aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf ); + aVDev->SetMapMode( aTargetMapMode ); + aVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf ); WriteOpcodes( aTmpMtf ); } break; case META_HATCH_ACTION: { - VirtualDevice aVDev; + ScopedVclPtrInstance<VirtualDevice> aVDev; GDIMetaFile aTmpMtf; const MetaHatchAction* pA = static_cast<const MetaHatchAction*>(pMA); - aVDev.SetMapMode( aTargetMapMode ); - aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf ); + aVDev->SetMapMode( aTargetMapMode ); + aVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf ); WriteOpcodes( aTmpMtf ); } break; diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index cfe790a290f3..20f6a2f9d1d3 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -116,7 +116,7 @@ private: SvStream* mpPS; const GDIMetaFile* pMTF; GDIMetaFile* pAMTF; // only created if Graphics is not a Metafile - VirtualDevice aVDev; + ScopedVclPtr<VirtualDevice> pVDev; double nBoundingX1; // this represents the bounding box double nBoundingY1; @@ -257,7 +257,7 @@ PSWriter::PSWriter() , mpPS(NULL) , pMTF(NULL) , pAMTF(NULL) - , aVDev() + , pVDev() , nBoundingX1(0) , nBoundingY1(0) , nBoundingX2(0) @@ -418,14 +418,14 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter { Bitmap aBmp( rGraphic.GetBitmap() ); pAMTF = new GDIMetaFile(); - VirtualDevice aTmpVDev; - pAMTF->Record( &aTmpVDev ); - aTmpVDev.DrawBitmap( Point(), aBmp ); + ScopedVclPtrInstance< VirtualDevice > pTmpVDev; + pAMTF->Record( pTmpVDev ); + pTmpVDev->DrawBitmap( Point(), aBmp ); pAMTF->Stop(); pAMTF->SetPrefSize( aBmp.GetSizePixel() ); pMTF = pAMTF; } - aVDev.SetMapMode( pMTF->GetPrefMapMode() ); + pVDev->SetMapMode( pMTF->GetPrefMapMode() ); nBoundingX1 = nBoundingY1 = 0; nBoundingX2 = pMTF->GetPrefSize().Width(); nBoundingY2 = pMTF->GetPrefSize().Height(); @@ -454,7 +454,7 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter { ImplWriteProlog( ( mnPreview & EPS_PREVIEW_EPSI ) ? &rGraphic : NULL ); mnCursorPos = 0; - ImplWriteActions( *pMTF, aVDev ); + ImplWriteActions( *pMTF, *pVDev.get() ); ImplWriteEpilog(); if ( mnPreview & EPS_PREVIEW_TIFF ) { @@ -486,8 +486,8 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter pResMgr = ResMgr::CreateResMgr( "eps", Application::GetSettings().GetUILanguageTag() ); if( pResMgr ) { - InfoBox aInfoBox( NULL, ResId(KEY_VERSION_CHECK, *pResMgr).toString() ); - aInfoBox.Execute(); + ScopedVclPtrInstance< InfoBox > aInfoBox( nullptr, ResId(KEY_VERSION_CHECK, *pResMgr).toString() ); + aInfoBox->Execute(); delete pResMgr; } } @@ -940,12 +940,12 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) case META_HATCH_ACTION : { - VirtualDevice l_aVDev; + ScopedVclPtrInstance< VirtualDevice > l_pVirDev; GDIMetaFile aTmpMtf; - l_aVDev.SetMapMode( rVDev.GetMapMode() ); - l_aVDev.AddHatchActions( static_cast<const MetaHatchAction*>(pMA)->GetPolyPolygon(), - static_cast<const MetaHatchAction*>(pMA)->GetHatch(), aTmpMtf ); + l_pVirDev->SetMapMode( rVDev.GetMapMode() ); + l_pVirDev->AddHatchActions( static_cast<const MetaHatchAction*>(pMA)->GetPolyPolygon(), + static_cast<const MetaHatchAction*>(pMA)->GetHatch(), aTmpMtf ); ImplWriteActions( aTmpMtf, rVDev ); } break; @@ -1608,10 +1608,10 @@ void PSWriter::ImplIntersect( const tools::PolyPolygon& rPolyPoly ) void PSWriter::ImplWriteGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rVDev ) { - VirtualDevice l_aVDev; + ScopedVclPtrInstance< VirtualDevice > l_pVDev; GDIMetaFile aTmpMtf; - l_aVDev.SetMapMode( rVDev.GetMapMode() ); - l_aVDev.AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf ); + l_pVDev->SetMapMode( rVDev.GetMapMode() ); + l_pVDev->AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf ); ImplWriteActions( aTmpMtf, rVDev ); } @@ -2141,10 +2141,10 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const lo vcl::Font aNotRotatedFont( maFont ); aNotRotatedFont.SetOrientation( 0 ); - VirtualDevice aVirDev( 1 ); - aVirDev.SetMapMode( rVDev.GetMapMode() ); - aVirDev.SetFont( aNotRotatedFont ); - aVirDev.SetTextAlign( eTextAlign ); + ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 ); + pVirDev->SetMapMode( rVDev.GetMapMode() ); + pVirDev->SetFont( aNotRotatedFont ); + pVirDev->SetTextAlign( eTextAlign ); sal_Int16 nRotation = maFont.GetOrientation(); Polygon aPolyDummy( 1 ); @@ -2159,7 +2159,7 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const lo bool bOldLineColor = bLineColor; bLineColor = false; std::vector<tools::PolyPolygon> aPolyPolyVec; - if ( aVirDev.GetTextOutlines( aPolyPolyVec, rUniString, 0, 0, -1, true, nWidth, pDXArry ) ) + if ( pVirDev->GetTextOutlines( aPolyPolyVec, rUniString, 0, 0, -1, true, nWidth, pDXArry ) ) { // always adjust text position to match baseline alignment ImplWriteLine( "pum" ); diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index 55a6158e8b46..30c8c474f7ee 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -80,7 +80,7 @@ CGM::~CGM() mpGDIMetaFile->Stop(); mpGDIMetaFile->SetPrefMapMode( MapMode() ); mpGDIMetaFile->SetPrefSize( Size( static_cast< long >( mnOutdx ), static_cast< long >( mnOutdy ) ) ); - delete mpVirDev; + mpVirDev.disposeAndClear(); *mpGraphic = Graphic( *mpGDIMetaFile ); } for( size_t i = 0, n = maDefRepList.size(); i < n; ++i ) diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx index 1ee13eaf9a6b..f9e6fa455325 100644 --- a/filter/source/graphicfilter/icgm/cgm.hxx +++ b/filter/source/graphicfilter/icgm/cgm.hxx @@ -28,6 +28,7 @@ #include <rtl/ustring.hxx> #include <vector> +#include <vcl/vclptr.hxx> #include "cgmtypes.hxx" class Graphic; @@ -138,7 +139,7 @@ class CGM ~CGM(); CGM( sal_uInt32 nMode, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > const & rModel ); - VirtualDevice* mpVirDev; + VclPtr<VirtualDevice> mpVirDev; GDIMetaFile* mpGDIMetaFile; sal_uInt32 GetBackGroundColor(); bool IsValid() const { return mbStatus; }; diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx index bacd08189425..ffca879871cb 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx @@ -885,7 +885,7 @@ bool DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF rMTF.SetPrefMapMode( MapMode( MAP_100TH_MM ) ); } - delete pVirDev; + pVirDev.disposeAndClear(); return bStatus; } diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.hxx b/filter/source/graphicfilter/idxf/dxf2mtf.hxx index 3adc4eee9aff..e88fcc3c9f27 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.hxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.hxx @@ -34,7 +34,7 @@ enum BrushStyle { BRUSH_NULL, BRUSH_SOLID, BRUSH_HORZ, BRUSH_VERT, class DXF2GDIMetaFile { private: - VirtualDevice * pVirDev; + VclPtr<VirtualDevice> pVirDev; const DXFRepresentation * pDXF; bool bStatus; diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index b933574f4ed8..503606dd4977 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -125,7 +125,7 @@ static int ImplGetLen( sal_uInt8* pBuf, int nMax ) static void MakeAsMeta(Graphic &rGraphic) { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; GDIMetaFile aMtf; Bitmap aBmp( rGraphic.GetBitmap() ); Size aSize = aBmp.GetPrefSize(); @@ -137,9 +137,9 @@ static void MakeAsMeta(Graphic &rGraphic) aSize = OutputDevice::LogicToLogic( aSize, aBmp.GetPrefMapMode(), MAP_100TH_MM ); - aVDev.EnableOutput( false ); - aMtf.Record( &aVDev ); - aVDev.DrawBitmap( Point(), aSize, rGraphic.GetBitmap() ); + pVDev->EnableOutput( false ); + aMtf.Record( pVDev ); + pVDev->DrawBitmap( Point(), aSize, rGraphic.GetBitmap() ); aMtf.Stop(); aMtf.WindStart(); aMtf.SetPrefMapMode( MAP_100TH_MM ); @@ -442,22 +442,22 @@ void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead, long nWidth, long nHeight, Graphic &rGraphic) { GDIMetaFile aMtf; - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; vcl::Font aFont; - aVDev.EnableOutput( false ); - aMtf.Record( &aVDev ); - aVDev.SetLineColor( Color( COL_RED ) ); - aVDev.SetFillColor(); + pVDev->EnableOutput( false ); + aMtf.Record( pVDev ); + pVDev->SetLineColor( Color( COL_RED ) ); + pVDev->SetFillColor(); aFont.SetColor( COL_LIGHTRED ); // aFont.SetSize( Size( 0, 32 ) ); - aVDev.Push( PushFlags::FONT ); - aVDev.SetFont( aFont ); + pVDev->Push( PushFlags::FONT ); + pVDev->SetFont( aFont ); Rectangle aRect( Point( 1, 1 ), Size( nWidth - 2, nHeight - 2 ) ); - aVDev.DrawRect( aRect ); + pVDev->DrawRect( aRect ); OUString aString; int nLen; @@ -511,8 +511,8 @@ void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead, aString += " LanguageLevel:" + OUString::number( nNumber ); } } - aVDev.DrawText( aRect, aString, TEXT_DRAW_CLIP | TEXT_DRAW_MULTILINE ); - aVDev.Pop(); + pVDev->DrawText( aRect, aString, TEXT_DRAW_CLIP | TEXT_DRAW_MULTILINE ); + pVDev->Pop(); aMtf.Stop(); aMtf.WindStart(); aMtf.SetPrefMapMode( MAP_POINT ); @@ -679,17 +679,17 @@ GraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* ) } if ( bIsValid ) { - VirtualDevice aVDev; + ScopedVclPtrInstance<VirtualDevice> pVDev; GDIMetaFile aMtf; Size aSize; - aVDev.EnableOutput( false ); - aMtf.Record( &aVDev ); + pVDev->EnableOutput( false ); + aMtf.Record( pVDev ); aSize = aBitmap.GetPrefSize(); if( !aSize.Width() || !aSize.Height() ) aSize = Application::GetDefaultDevice()->PixelToLogic( aBitmap.GetSizePixel(), MAP_100TH_MM ); else aSize = OutputDevice::LogicToLogic( aSize, aBitmap.GetPrefMapMode(), MAP_100TH_MM ); - aVDev.DrawBitmap( Point(), aSize, aBitmap ); + pVDev->DrawBitmap( Point(), aSize, aBitmap ); aMtf.Stop(); aMtf.WindStart(); aMtf.SetPrefMapMode( MAP_100TH_MM ); diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index 435a6e164597..7b024ae84eb3 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -345,7 +345,7 @@ private: long ErrorCode; SvStream * pOS2MET; // the OS2MET file to be read - VirtualDevice * pVirDev; // here the drawing methods are being called + VclPtr<VirtualDevice> pVirDev; // here the drawing methods are being called // While doing this a recording in the GDIMetaFile // will take place. sal_uLong nOrigPos; // initial position in pOS2MET @@ -2601,7 +2601,7 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaF pOrdFile=NULL; - pVirDev = new VirtualDevice(); + pVirDev = VclPtr<VirtualDevice>::Create(); pVirDev->EnableOutput(false); rGDIMetaFile.Record(pVirDev); @@ -2657,7 +2657,7 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaF } rGDIMetaFile.Stop(); - delete pVirDev; + pVirDev.disposeAndClear(); rGDIMetaFile.SetPrefMapMode( aGlobMapMode ); diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index badebaf82c3a..6621eddd3c60 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -146,7 +146,7 @@ class PictReader { private: SvStream * pPict; // The Pict file to read. - VirtualDevice * pVirDev; // Here the drawing methos will be called. + VclPtr<VirtualDevice> pVirDev; // Here the drawing methos will be called. // A recording into the GDIMetaFile will take place. sal_uLong nOrigPos; // Initial position in pPict. @@ -1881,7 +1881,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ) aHRes = aVRes = Fraction( 1, 1 ); - pVirDev = new VirtualDevice(); + pVirDev = VclPtr<VirtualDevice>::Create(); pVirDev->EnableOutput(false); rGDIMetaFile.Record(pVirDev); @@ -1942,7 +1942,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ) pVirDev->SetClipRegion(); rGDIMetaFile.Stop(); - delete pVirDev; + pVirDev.disposeAndClear(); rGDIMetaFile.SetPrefMapMode( MapMode( MAP_INCH, Point(), aHRes, aVRes ) ); rGDIMetaFile.SetPrefSize( aBoundingRect.GetSize() ); diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index c7444bfceb1e..dc1e3705d72e 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1387,18 +1387,18 @@ GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, cons // do not create a bitmap in page size, that would explode file sizes (and have no good quality). // Better use a MetaFile graphic in page size; thus we have good quality due to vector format and // no bit file sizes. - VirtualDevice aOut; + ScopedVclPtrInstance< VirtualDevice > pVDev; GDIMetaFile aMtf; - aOut.SetOutputSizePixel(Size(2, 2)); - aOut.EnableOutput(false); - aOut.SetMapMode(MapMode(MAP_100TH_MM)); + pVDev->SetOutputSizePixel(Size(2, 2)); + pVDev->EnableOutput(false); + pVDev->SetMapMode(MapMode(MAP_100TH_MM)); aMtf.Clear(); - aMtf.Record(&aOut); - aOut.SetLineColor(); - aOut.SetFillColor(bFillBackground ? rBackColor : Color(COL_TRANSPARENT)); - aOut.DrawRect(rRect); - aOut.DrawHatch(tools::PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, (sal_uInt16)rHatch.Angle)); + aMtf.Record(pVDev); + pVDev->SetLineColor(); + pVDev->SetFillColor(bFillBackground ? rBackColor : Color(COL_TRANSPARENT)); + pVDev->DrawRect(rRect); + pVDev->DrawHatch(tools::PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, (sal_uInt16)rHatch.Angle)); aMtf.Stop(); aMtf.WindStart(); aMtf.SetPrefMapMode(MapMode(MAP_100TH_MM)); diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 0dce7915648e..6dfba0986eee 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4397,8 +4397,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r rOutliner.SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(pModel->GetStyleSheetPool()) ); rOutliner.SetUpdateMode( false ); rOutliner.SetText( *pParaObj ); - VirtualDevice aVirDev( 1 ); - aVirDev.SetMapMode( MAP_100TH_MM ); + ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 ); + pVirDev->SetMapMode( MAP_100TH_MM ); sal_Int32 i, nParagraphs = rOutliner.GetParagraphCount(); if ( nParagraphs ) { @@ -4406,7 +4406,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r for ( i = 0; i < nParagraphs; i++ ) { OUString aString(rOutliner.GetText(rOutliner.GetParagraph(i))); - bool bIsRTL = aVirDev.GetTextIsRTL(aString, 0, aString.getLength()); + bool bIsRTL = pVirDev->GetTextIsRTL(aString, 0, aString.getLength()); if ( bIsRTL ) { SfxItemSet aSet2( rOutliner.GetParaAttribs( i ) ); diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 9851aa811a7c..af2e7e7c8a73 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -312,6 +312,11 @@ IMPL_LINK_NOARG(ImpPDFTabDialog, CancelHdl) ImpPDFTabDialog::~ImpPDFTabDialog() { + disposeOnce(); +} + +void ImpPDFTabDialog::dispose() +{ //delete the pages, needed because otherwise the child tab pages //don't get destroyed RemoveTabPage(mnGeneralPageId); @@ -320,6 +325,7 @@ ImpPDFTabDialog::~ImpPDFTabDialog() RemoveTabPage(mnLinksPage); RemoveTabPage(mnSecurityPageId); RemoveTabPage(mnSigningPageId); + SfxTabDialog::dispose(); } @@ -546,10 +552,42 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe ImpPDFTabGeneralPage::~ImpPDFTabGeneralPage() { + disposeOnce(); } +void ImpPDFTabGeneralPage::dispose() +{ + mpRbAll.clear(); + mpRbRange.clear(); + mpRbSelection.clear(); + mpEdPages.clear(); + mpRbLosslessCompression.clear(); + mpRbJPEGCompression.clear(); + mpQualityFrame.clear(); + mpNfQuality.clear(); + mpCbReduceImageResolution.clear(); + mpCoReduceImageResolution.clear(); + mpCbPDFA1b.clear(); + mpCbTaggedPDF.clear(); + mpCbExportFormFields.clear(); + mpFormsFrame.clear(); + mpLbFormsFormat.clear(); + mpCbAllowDuplicateFieldNames.clear(); + mpCbExportBookmarks.clear(); + mpCbExportHiddenSlides.clear(); + mpCbExportNotes.clear(); + mpCbViewPDF.clear(); + mpCbExportNotesPages.clear(); + mpCbExportEmptyPages.clear(); + mpCbAddStream.clear(); + mpCbWatermark.clear(); + mpFtWatermark.clear(); + mpEdWatermark.clear(); + mpaParent.clear(); + SfxTabPage::dispose(); +} -void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) +void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent ) { mpaParent = paParent; @@ -696,10 +734,10 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) } -SfxTabPage* ImpPDFTabGeneralPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> ImpPDFTabGeneralPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return ( new ImpPDFTabGeneralPage( pParent, *rAttrSet ) ); + return VclPtr<ImpPDFTabGeneralPage>::Create( pParent, *rAttrSet ); } @@ -806,8 +844,8 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl) // if a password was set, inform the user that this will not be used in PDF/A case if( mpCbPDFA1b->IsChecked() && pSecPage && pSecPage->hasPassword() ) { - MessageDialog aBox(this, PDFFilterResId(STR_WARN_PASSWORD_PDFA), VCL_MESSAGE_WARNING); - aBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aBox(this, PDFFilterResId(STR_WARN_PASSWORD_PDFA), VCL_MESSAGE_WARNING); + aBox->Execute(); } return 0; @@ -844,13 +882,33 @@ ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage(vcl::Window* pParent, const SfxItemSet& ImpPDFTabOpnFtrPage::~ImpPDFTabOpnFtrPage() { + disposeOnce(); } +void ImpPDFTabOpnFtrPage::dispose() +{ + mpRbOpnPageOnly.clear(); + mpRbOpnOutline.clear(); + mpRbOpnThumbs.clear(); + mpNumInitialPage.clear(); + mpRbMagnDefault.clear(); + mpRbMagnFitWin.clear(); + mpRbMagnFitWidth.clear(); + mpRbMagnFitVisible.clear(); + mpRbMagnZoom.clear(); + mpNumZoom.clear(); + mpRbPgLyDefault.clear(); + mpRbPgLySinglePage.clear(); + mpRbPgLyContinue.clear(); + mpRbPgLyContinueFacing.clear(); + mpCbPgLyFirstOnLeft.clear(); + SfxTabPage::dispose(); +} -SfxTabPage* ImpPDFTabOpnFtrPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> ImpPDFTabOpnFtrPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return ( new ImpPDFTabOpnFtrPage( pParent, *rAttrSet ) ); + return VclPtr<ImpPDFTabOpnFtrPage>::Create( pParent, *rAttrSet ); } @@ -999,6 +1057,23 @@ ImpPDFTabViewerPage::ImpPDFTabViewerPage( vcl::Window* pParent, ImpPDFTabViewerPage::~ImpPDFTabViewerPage() { + disposeOnce(); +} + +void ImpPDFTabViewerPage::dispose() +{ + m_pCbResWinInit.clear(); + m_pCbCenterWindow.clear(); + m_pCbOpenFullScreen.clear(); + m_pCbDispDocTitle.clear(); + m_pCbHideViewerMenubar.clear(); + m_pCbHideViewerToolbar.clear(); + m_pCbHideViewerWindowControls.clear(); + m_pCbTransitionEffects.clear(); + m_pRbAllBookmarkLevels.clear(); + m_pRbVisibleBookmarkLevels.clear(); + m_pNumBookmarkLevels.clear(); + SfxTabPage::dispose(); } IMPL_LINK( ImpPDFTabViewerPage, ToggleRbBookmarksHdl, void*, ) @@ -1007,10 +1082,10 @@ IMPL_LINK( ImpPDFTabViewerPage, ToggleRbBookmarksHdl, void*, ) return 0; } -SfxTabPage* ImpPDFTabViewerPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> ImpPDFTabViewerPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return ( new ImpPDFTabViewerPage( pParent, *rAttrSet ) ); + return VclPtr<ImpPDFTabViewerPage>::Create( pParent, *rAttrSet ); } @@ -1096,13 +1171,38 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(vcl::Window* i_pParent, const SfxIt ImpPDFTabSecurityPage::~ImpPDFTabSecurityPage() { + disposeOnce(); } +void ImpPDFTabSecurityPage::dispose() +{ + mpPbSetPwd.clear(); + mpUserPwdSet.clear(); + mpUserPwdUnset.clear(); + mpUserPwdPdfa.clear(); + mpOwnerPwdSet.clear(); + mpOwnerPwdUnset.clear(); + mpOwnerPwdPdfa.clear(); + mpPrintPermissions.clear(); + mpRbPrintNone.clear(); + mpRbPrintLowRes.clear(); + mpRbPrintHighRes.clear(); + mpChangesAllowed.clear(); + mpRbChangesNone.clear(); + mpRbChangesInsDel.clear(); + mpRbChangesFillForm.clear(); + mpRbChangesComment.clear(); + mpRbChangesAnyNoCopy.clear(); + mpContent.clear(); + mpCbEnableCopy.clear(); + mpCbEnableAccessibility.clear(); + SfxTabPage::dispose(); +} -SfxTabPage* ImpPDFTabSecurityPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> ImpPDFTabSecurityPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return ( new ImpPDFTabSecurityPage( pParent, *rAttrSet ) ); + return VclPtr<ImpPDFTabSecurityPage>::Create( pParent, *rAttrSet ); } @@ -1191,17 +1291,17 @@ void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParen IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl) { - SfxPasswordDialog aPwdDialog( this, &msUserPwdTitle ); - aPwdDialog.SetMinLen( 0 ); - aPwdDialog.ShowMinLengthText(false); - aPwdDialog.ShowExtras( SfxShowExtras::CONFIRM | SfxShowExtras::PASSWORD2 | SfxShowExtras::CONFIRM2 ); - aPwdDialog.SetText(msStrSetPwd); - aPwdDialog.SetGroup2Text(msOwnerPwdTitle); - aPwdDialog.AllowAsciiOnly(); - if( aPwdDialog.Execute() == RET_OK ) //OK issued get password and set it + ScopedVclPtrInstance< SfxPasswordDialog > aPwdDialog( this, &msUserPwdTitle ); + aPwdDialog->SetMinLen( 0 ); + aPwdDialog->ShowMinLengthText(false); + aPwdDialog->ShowExtras( SfxShowExtras::CONFIRM | SfxShowExtras::PASSWORD2 | SfxShowExtras::CONFIRM2 ); + aPwdDialog->SetText(msStrSetPwd); + aPwdDialog->SetGroup2Text(msOwnerPwdTitle); + aPwdDialog->AllowAsciiOnly(); + if( aPwdDialog->Execute() == RET_OK ) //OK issued get password and set it { - OUString aUserPW( aPwdDialog.GetPassword() ); - OUString aOwnerPW( aPwdDialog.GetPassword2() ); + OUString aUserPW( aPwdDialog->GetPassword() ); + OUString aOwnerPW( aPwdDialog->GetPassword2() ); mbHaveUserPassword = !aUserPW.isEmpty(); mbHaveOwnerPassword = !aOwnerPW.isEmpty(); @@ -1317,13 +1417,24 @@ ImpPDFTabLinksPage::ImpPDFTabLinksPage( vcl::Window* pParent, ImpPDFTabLinksPage::~ImpPDFTabLinksPage() { + disposeOnce(); } +void ImpPDFTabLinksPage::dispose() +{ + m_pCbExprtBmkrToNmDst.clear(); + m_pCbOOoToPDFTargets.clear(); + m_pCbExportRelativeFsysLinks.clear(); + m_pRbOpnLnksDefault.clear(); + m_pRbOpnLnksLaunch.clear(); + m_pRbOpnLnksBrowser.clear(); + SfxTabPage::dispose(); +} -SfxTabPage* ImpPDFTabLinksPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> ImpPDFTabLinksPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return ( new ImpPDFTabLinksPage( pParent, *rAttrSet ) ); + return VclPtr<ImpPDFTabLinksPage>::Create( pParent, *rAttrSet ); } @@ -1511,9 +1622,17 @@ ImplErrorDialog::ImplErrorDialog(const std::set< vcl::PDFWriter::ErrorCode >& rE ImplErrorDialog::~ImplErrorDialog() { + disposeOnce(); +} + +void ImplErrorDialog::dispose() +{ // free strings again for( sal_uInt16 n = 0; n < m_pErrors->GetEntryCount(); n++ ) delete static_cast<OUString*>(m_pErrors->GetEntryData( n )); + m_pErrors.clear(); + m_pExplanation.clear(); + MessageDialog::dispose(); } IMPL_LINK_NOARG(ImplErrorDialog, SelectHdl) @@ -1548,6 +1667,19 @@ ImpPDFTabSigningPage::ImpPDFTabSigningPage(vcl::Window* pParent, const SfxItemSe ImpPDFTabSigningPage::~ImpPDFTabSigningPage() { + disposeOnce(); +} + +void ImpPDFTabSigningPage::dispose() +{ + mpEdSignCert.clear(); + mpPbSignCertSelect.clear(); + mpPbSignCertClear.clear(); + mpEdSignPassword.clear(); + mpEdSignLocation.clear(); + mpEdSignContactInfo.clear(); + mpEdSignReason.clear(); + SfxTabPage::dispose(); } IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect ) @@ -1610,10 +1742,10 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, SelectLBSignTSA ) return 0; } -SfxTabPage* ImpPDFTabSigningPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> ImpPDFTabSigningPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return ( new ImpPDFTabSigningPage( pParent, *rAttrSet ) ); + return VclPtr<ImpPDFTabSigningPage>::Create( pParent, *rAttrSet ); } diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index dc4a78789ce3..dc2f9d35d0fa 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -56,13 +56,14 @@ public: class ImplErrorDialog : public MessageDialog { - ListBox* m_pErrors; - FixedText* m_pExplanation; + VclPtr<ListBox> m_pErrors; + VclPtr<FixedText> m_pExplanation; DECL_LINK(SelectHdl, void *); public: ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& ); virtual ~ImplErrorDialog(); + virtual void dispose() SAL_OVERRIDE; }; class ImpPDFTabSecurityPage; @@ -171,6 +172,7 @@ public: const css::uno::Reference< XComponent >& rDoc ); virtual ~ImpPDFTabDialog(); + virtual void dispose() SAL_OVERRIDE; Sequence< PropertyValue > GetFilterData(); @@ -189,45 +191,45 @@ class ImpPDFTabGeneralPage : public SfxTabPage { friend class ImpPDFTabLinksPage; - RadioButton* mpRbAll; - RadioButton* mpRbRange; - RadioButton* mpRbSelection; - Edit* mpEdPages; + VclPtr<RadioButton> mpRbAll; + VclPtr<RadioButton> mpRbRange; + VclPtr<RadioButton> mpRbSelection; + VclPtr<Edit> mpEdPages; - RadioButton* mpRbLosslessCompression; - RadioButton* mpRbJPEGCompression; - VclContainer* mpQualityFrame; - MetricField* mpNfQuality; - CheckBox* mpCbReduceImageResolution; - ComboBox* mpCoReduceImageResolution; + VclPtr<RadioButton> mpRbLosslessCompression; + VclPtr<RadioButton> mpRbJPEGCompression; + VclPtr<VclContainer> mpQualityFrame; + VclPtr<MetricField> mpNfQuality; + VclPtr<CheckBox> mpCbReduceImageResolution; + VclPtr<ComboBox> mpCoReduceImageResolution; - CheckBox* mpCbPDFA1b; - CheckBox* mpCbTaggedPDF; + VclPtr<CheckBox> mpCbPDFA1b; + VclPtr<CheckBox> mpCbTaggedPDF; bool mbTaggedPDFUserSelection; - CheckBox* mpCbExportFormFields; + VclPtr<CheckBox> mpCbExportFormFields; bool mbExportFormFieldsUserSelection; - VclContainer* mpFormsFrame; - ListBox* mpLbFormsFormat; - CheckBox* mpCbAllowDuplicateFieldNames; + VclPtr<VclContainer> mpFormsFrame; + VclPtr<ListBox> mpLbFormsFormat; + VclPtr<CheckBox> mpCbAllowDuplicateFieldNames; - CheckBox* mpCbExportBookmarks; - CheckBox* mpCbExportHiddenSlides; - CheckBox* mpCbExportNotes; - CheckBox* mpCbViewPDF; - CheckBox* mpCbExportNotesPages; + VclPtr<CheckBox> mpCbExportBookmarks; + VclPtr<CheckBox> mpCbExportHiddenSlides; + VclPtr<CheckBox> mpCbExportNotes; + VclPtr<CheckBox> mpCbViewPDF; + VclPtr<CheckBox> mpCbExportNotesPages; - CheckBox* mpCbExportEmptyPages; - CheckBox* mpCbAddStream; + VclPtr<CheckBox> mpCbExportEmptyPages; + VclPtr<CheckBox> mpCbAddStream; - CheckBox* mpCbWatermark; - FixedText* mpFtWatermark; - Edit* mpEdWatermark; + VclPtr<CheckBox> mpCbWatermark; + VclPtr<FixedText> mpFtWatermark; + VclPtr<Edit> mpEdWatermark; bool mbIsPresentation; bool mbIsWriter; - const ImpPDFTabDialog* mpaParent; + VclPtr<ImpPDFTabDialog> mpaParent; DECL_LINK( TogglePagesHdl, void* ); DECL_LINK( ToggleCompressionHdl, void* ); @@ -241,36 +243,37 @@ public: ImpPDFTabGeneralPage( vcl::Window* pParent, const SfxItemSet& rSet ); - virtual ~ImpPDFTabGeneralPage(); - static SfxTabPage* Create( vcl::Window* pParent, + virtual void dispose() SAL_OVERRIDE; + + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); void GetFilterConfigItem(ImpPDFTabDialog* paParent); - void SetFilterConfigItem(const ImpPDFTabDialog* paParent); + void SetFilterConfigItem(ImpPDFTabDialog* paParent); bool IsPdfaSelected() const { return mpCbPDFA1b->IsChecked(); } }; //class tab page viewer class ImpPDFTabOpnFtrPage : public SfxTabPage { - RadioButton* mpRbOpnPageOnly; - RadioButton* mpRbOpnOutline; - RadioButton* mpRbOpnThumbs; - NumericField* mpNumInitialPage; - - RadioButton* mpRbMagnDefault; - RadioButton* mpRbMagnFitWin; - RadioButton* mpRbMagnFitWidth; - RadioButton* mpRbMagnFitVisible; - RadioButton* mpRbMagnZoom; - NumericField* mpNumZoom; - - RadioButton* mpRbPgLyDefault; - RadioButton* mpRbPgLySinglePage; - RadioButton* mpRbPgLyContinue; - RadioButton* mpRbPgLyContinueFacing; - CheckBox* mpCbPgLyFirstOnLeft; + VclPtr<RadioButton> mpRbOpnPageOnly; + VclPtr<RadioButton> mpRbOpnOutline; + VclPtr<RadioButton> mpRbOpnThumbs; + VclPtr<NumericField> mpNumInitialPage; + + VclPtr<RadioButton> mpRbMagnDefault; + VclPtr<RadioButton> mpRbMagnFitWin; + VclPtr<RadioButton> mpRbMagnFitWidth; + VclPtr<RadioButton> mpRbMagnFitVisible; + VclPtr<RadioButton> mpRbMagnZoom; + VclPtr<NumericField> mpNumZoom; + + VclPtr<RadioButton> mpRbPgLyDefault; + VclPtr<RadioButton> mpRbPgLySinglePage; + VclPtr<RadioButton> mpRbPgLyContinue; + VclPtr<RadioButton> mpRbPgLyContinueFacing; + VclPtr<CheckBox> mpCbPgLyFirstOnLeft; bool mbUseCTLFont; @@ -282,7 +285,8 @@ public: const SfxItemSet& rSet ); virtual ~ImpPDFTabOpnFtrPage(); - static SfxTabPage* Create( vcl::Window* pParent, + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); void GetFilterConfigItem( ImpPDFTabDialog* paParent); @@ -292,22 +296,22 @@ public: //class tab page viewer class ImpPDFTabViewerPage : public SfxTabPage { - CheckBox* m_pCbResWinInit; - CheckBox* m_pCbCenterWindow; - CheckBox* m_pCbOpenFullScreen; - CheckBox* m_pCbDispDocTitle; + VclPtr<CheckBox> m_pCbResWinInit; + VclPtr<CheckBox> m_pCbCenterWindow; + VclPtr<CheckBox> m_pCbOpenFullScreen; + VclPtr<CheckBox> m_pCbDispDocTitle; - CheckBox* m_pCbHideViewerMenubar; - CheckBox* m_pCbHideViewerToolbar; - CheckBox* m_pCbHideViewerWindowControls; + VclPtr<CheckBox> m_pCbHideViewerMenubar; + VclPtr<CheckBox> m_pCbHideViewerToolbar; + VclPtr<CheckBox> m_pCbHideViewerWindowControls; - CheckBox* m_pCbTransitionEffects; + VclPtr<CheckBox> m_pCbTransitionEffects; bool mbIsPresentation; - RadioButton* m_pRbAllBookmarkLevels; - RadioButton* m_pRbVisibleBookmarkLevels; - NumericField* m_pNumBookmarkLevels; + VclPtr<RadioButton> m_pRbAllBookmarkLevels; + VclPtr<RadioButton> m_pRbVisibleBookmarkLevels; + VclPtr<NumericField> m_pNumBookmarkLevels; DECL_LINK( ToggleRbBookmarksHdl, void* ); public: @@ -315,7 +319,8 @@ public: const SfxItemSet& rSet ); virtual ~ImpPDFTabViewerPage(); - static SfxTabPage* Create( vcl::Window* pParent, + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); void GetFilterConfigItem( ImpPDFTabDialog* paParent); @@ -325,32 +330,32 @@ public: //class security tab page class ImpPDFTabSecurityPage : public SfxTabPage { - PushButton* mpPbSetPwd; + VclPtr<PushButton> mpPbSetPwd; OUString msStrSetPwd; - VclContainer* mpUserPwdSet; - VclContainer* mpUserPwdUnset; - VclContainer* mpUserPwdPdfa; + VclPtr<VclContainer> mpUserPwdSet; + VclPtr<VclContainer> mpUserPwdUnset; + VclPtr<VclContainer> mpUserPwdPdfa; - VclContainer* mpOwnerPwdSet; - VclContainer* mpOwnerPwdUnset; - VclContainer* mpOwnerPwdPdfa; + VclPtr<VclContainer> mpOwnerPwdSet; + VclPtr<VclContainer> mpOwnerPwdUnset; + VclPtr<VclContainer> mpOwnerPwdPdfa; - VclContainer* mpPrintPermissions; - RadioButton* mpRbPrintNone; - RadioButton* mpRbPrintLowRes; - RadioButton* mpRbPrintHighRes; + VclPtr<VclContainer> mpPrintPermissions; + VclPtr<RadioButton> mpRbPrintNone; + VclPtr<RadioButton> mpRbPrintLowRes; + VclPtr<RadioButton> mpRbPrintHighRes; - VclContainer* mpChangesAllowed; - RadioButton* mpRbChangesNone; - RadioButton* mpRbChangesInsDel; - RadioButton* mpRbChangesFillForm; - RadioButton* mpRbChangesComment; - RadioButton* mpRbChangesAnyNoCopy; + VclPtr<VclContainer> mpChangesAllowed; + VclPtr<RadioButton> mpRbChangesNone; + VclPtr<RadioButton> mpRbChangesInsDel; + VclPtr<RadioButton> mpRbChangesFillForm; + VclPtr<RadioButton> mpRbChangesComment; + VclPtr<RadioButton> mpRbChangesAnyNoCopy; - VclContainer* mpContent; - CheckBox* mpCbEnableCopy; - CheckBox* mpCbEnableAccessibility; + VclPtr<VclContainer> mpContent; + VclPtr<CheckBox> mpCbEnableCopy; + VclPtr<CheckBox> mpCbEnableAccessibility; OUString msUserPwdTitle; @@ -370,7 +375,8 @@ public: const SfxItemSet& rSet ); virtual ~ImpPDFTabSecurityPage(); - static SfxTabPage* Create( vcl::Window* pParent, + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); void GetFilterConfigItem( ImpPDFTabDialog* paParent); @@ -382,15 +388,15 @@ public: //class to implement the relative link stuff class ImpPDFTabLinksPage : public SfxTabPage { - CheckBox* m_pCbExprtBmkrToNmDst; - CheckBox* m_pCbOOoToPDFTargets; - CheckBox* m_pCbExportRelativeFsysLinks; + VclPtr<CheckBox> m_pCbExprtBmkrToNmDst; + VclPtr<CheckBox> m_pCbOOoToPDFTargets; + VclPtr<CheckBox> m_pCbExportRelativeFsysLinks; - RadioButton* m_pRbOpnLnksDefault; + VclPtr<RadioButton> m_pRbOpnLnksDefault; bool mbOpnLnksDefaultUserState; - RadioButton* m_pRbOpnLnksLaunch; + VclPtr<RadioButton> m_pRbOpnLnksLaunch; bool mbOpnLnksLaunchUserState; - RadioButton* m_pRbOpnLnksBrowser; + VclPtr<RadioButton> m_pRbOpnLnksBrowser; bool mbOpnLnksBrowserUserState; DECL_LINK( ClickRbOpnLnksDefaultHdl, void* ); @@ -401,7 +407,8 @@ public: const SfxItemSet& rSet ); virtual ~ImpPDFTabLinksPage(); - static SfxTabPage* Create( vcl::Window* pParent, + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); void GetFilterConfigItem( ImpPDFTabDialog* paParent); @@ -413,14 +420,14 @@ public: //class to implement the digital signing class ImpPDFTabSigningPage : public SfxTabPage { - Edit* mpEdSignCert; - PushButton* mpPbSignCertSelect; - PushButton* mpPbSignCertClear; - Edit* mpEdSignPassword; - Edit* mpEdSignLocation; - Edit* mpEdSignContactInfo; - Edit* mpEdSignReason; - ListBox* mpLBSignTSA; + VclPtr<Edit> mpEdSignCert; + VclPtr<PushButton> mpPbSignCertSelect; + VclPtr<PushButton> mpPbSignCertClear; + VclPtr<Edit> mpEdSignPassword; + VclPtr<Edit> mpEdSignLocation; + VclPtr<Edit> mpEdSignContactInfo; + VclPtr<Edit> mpEdSignReason; + VclPtr<ListBox> mpLBSignTSA; com::sun::star::uno::Reference< com::sun::star::security::XCertificate > maSignCertificate; DECL_LINK( ClickmaPbSignCertSelect, void* ); @@ -432,7 +439,8 @@ public: const SfxItemSet& rSet ); virtual ~ImpPDFTabSigningPage(); - static SfxTabPage* Create( vcl::Window* pParent, + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); void GetFilterConfigItem( ImpPDFTabDialog* paParent); diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx index 93de5b4e9bc7..02042739e549 100644 --- a/filter/source/pdf/pdfdialog.cxx +++ b/filter/source/pdf/pdfdialog.cxx @@ -107,17 +107,11 @@ Sequence< OUString > SAL_CALL PDFDialog::getSupportedServiceNames() -Dialog* PDFDialog::createDialog( vcl::Window* pParent ) +VclPtr<Dialog> PDFDialog::createDialog( vcl::Window* pParent ) { - Dialog* pRet = NULL; - if( mxSrcDoc.is() ) - { - ImpPDFTabDialog* pDlg = new ImpPDFTabDialog( pParent, maFilterData, mxSrcDoc ); - pRet = pDlg; - } - - return pRet; + return VclPtr<ImpPDFTabDialog>::Create( pParent, maFilterData, mxSrcDoc ); + return VclPtr<Dialog>(); } @@ -125,7 +119,7 @@ Dialog* PDFDialog::createDialog( vcl::Window* pParent ) void PDFDialog::executedDialog( sal_Int16 nExecutionResult ) { if( nExecutionResult && m_pDialog ) - maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog )->GetFilterData(); + maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog.get() )->GetFilterData(); destroyDialog(); } diff --git a/filter/source/pdf/pdfdialog.hxx b/filter/source/pdf/pdfdialog.hxx index 85135fa24079..e343902e2481 100644 --- a/filter/source/pdf/pdfdialog.hxx +++ b/filter/source/pdf/pdfdialog.hxx @@ -51,7 +51,7 @@ protected: virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException, std::exception) SAL_OVERRIDE; virtual OUString SAL_CALL getImplementationName() throw (RuntimeException, std::exception) SAL_OVERRIDE; virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException, std::exception) SAL_OVERRIDE; - virtual Dialog* createDialog( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<Dialog> createDialog( vcl::Window* pParent ) SAL_OVERRIDE; virtual void executedDialog( sal_Int16 nExecutionResult ) SAL_OVERRIDE; virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(RuntimeException, std::exception) SAL_OVERRIDE; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE; diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx index 3e1349bf54f2..9605032b0981 100644 --- a/filter/source/pdf/pdffilter.cxx +++ b/filter/source/pdf/pdffilter.cxx @@ -131,8 +131,8 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) class FocusWindowWaitCursor { - vcl::Window* m_pFocusWindow; - public: + VclPtr<vcl::Window> m_pFocusWindow; +public: FocusWindowWaitCursor() : m_pFocusWindow( Application::GetFocusWindow() ) { diff --git a/filter/source/pdf/pdfinteract.cxx b/filter/source/pdf/pdfinteract.cxx index 579d9ef3fb40..d01281211ebf 100644 --- a/filter/source/pdf/pdfinteract.cxx +++ b/filter/source/pdf/pdfinteract.cxx @@ -53,8 +53,8 @@ sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Referen sal_Int32 nCodes = aExc.ErrorCodes.getLength(); for( sal_Int32 i = 0; i < nCodes; i++ ) aCodes.insert( (vcl::PDFWriter::ErrorCode)aExc.ErrorCodes.getConstArray()[i] ); - ImplErrorDialog aDlg( aCodes ); - aDlg.Execute(); + ScopedVclPtrInstance< ImplErrorDialog > aDlg( aCodes ); + aDlg->Execute(); bHandled = true; } return bHandled; diff --git a/filter/source/svg/impsvgdialog.cxx b/filter/source/svg/impsvgdialog.cxx index 5fd3e6d218b4..2e70390f4890 100644 --- a/filter/source/svg/impsvgdialog.cxx +++ b/filter/source/svg/impsvgdialog.cxx @@ -36,73 +36,86 @@ inline sal_Int32 implMap( vcl::Window& /*rWnd*/, sal_Int32 nVal ) ImpSVGDialog::ImpSVGDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFilterData ) : ModalDialog( pParent ), - maFI( this ), - maCBTinyProfile( this ), - maCBEmbedFonts( this ), - maCBUseNativeDecoration( this ), - maBTOK( this, WB_DEF_OK ), - maBTCancel( this ), - maBTHelp( this ), + maFI( VclPtr<FixedLine>::Create(this) ), + maCBTinyProfile( VclPtr<CheckBox>::Create(this) ), + maCBEmbedFonts( VclPtr<CheckBox>::Create(this) ), + maCBUseNativeDecoration( VclPtr<CheckBox>::Create(this) ), + maBTOK( VclPtr<OKButton>::Create(this, WB_DEF_OK) ), + maBTCancel( VclPtr<CancelButton>::Create(this) ), + maBTHelp( VclPtr<HelpButton>::Create(this) ), maConfigItem( SVG_EXPORTFILTER_CONFIGPATH, &rFilterData ), mbOldNativeDecoration( false ) { SetText( "SVG Export Options" ); SetOutputSizePixel( Size( implMap( *this, 177 ), implMap( *this, 77 ) ) ); - maFI.SetText( "Export" ); - maFI.SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ), + maFI->SetText( "Export" ); + maFI->SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ), Size( implMap( *this, 165 ), implMap( *this, 8 ) ) ); - maCBTinyProfile.SetText( "Use SVG Tiny profile" ); - maCBTinyProfile.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ), + maCBTinyProfile->SetText( "Use SVG Tiny profile" ); + maCBTinyProfile->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ), Size( implMap( *this, 142 ), implMap( *this, 10 ) ) ); - maCBEmbedFonts.SetText( "Embed fonts" ); - maCBEmbedFonts.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ), + maCBEmbedFonts->SetText( "Embed fonts" ); + maCBEmbedFonts->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ), Size( implMap( *this, 142 ), implMap( *this, 10 ) ) ); - maCBUseNativeDecoration.SetText( "Use SVG native text decoration" ); - maCBUseNativeDecoration.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ), + maCBUseNativeDecoration->SetText( "Use SVG native text decoration" ); + maCBUseNativeDecoration->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ), Size( implMap( *this, 142 ), implMap( *this, 10 ) ) ); - maCBTinyProfile.Check( maConfigItem.ReadBool( OUString( SVG_PROP_TINYPROFILE ), false ) ); - maCBEmbedFonts.Check( maConfigItem.ReadBool( OUString( SVG_PROP_EMBEDFONTS ), true ) ); - maCBUseNativeDecoration.Check( maConfigItem.ReadBool( OUString( SVG_PROP_NATIVEDECORATION ), true ) ); + maCBTinyProfile->Check( maConfigItem.ReadBool( OUString( SVG_PROP_TINYPROFILE ), false ) ); + maCBEmbedFonts->Check( maConfigItem.ReadBool( OUString( SVG_PROP_EMBEDFONTS ), true ) ); + maCBUseNativeDecoration->Check( maConfigItem.ReadBool( OUString( SVG_PROP_NATIVEDECORATION ), true ) ); - maBTOK.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ), + maBTOK->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ), Size( implMap( *this, 50 ), implMap( *this, 14 ) ) ); - maBTCancel.SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ), + maBTCancel->SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ), Size( implMap( *this, 50 ), implMap( *this, 14 ) ) ); - maBTHelp.SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ), + maBTHelp->SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ), Size( implMap( *this, 50 ), implMap( *this, 14 ) ) ); - maCBTinyProfile.SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) ); - OnToggleCheckbox( &maCBTinyProfile ); + maCBTinyProfile->SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) ); + OnToggleCheckbox( maCBTinyProfile.get() ); - maFI.Show(); + maFI->Show(); - maCBTinyProfile.Show(); - maCBEmbedFonts.Show(); - maCBUseNativeDecoration.Show(); + maCBTinyProfile->Show(); + maCBEmbedFonts->Show(); + maCBUseNativeDecoration->Show(); - maBTOK.Show(); - maBTCancel.Show(); - maBTHelp.Show(); + maBTOK->Show(); + maBTCancel->Show(); + maBTHelp->Show(); } ImpSVGDialog::~ImpSVGDialog() { + disposeOnce(); +} + +void ImpSVGDialog::dispose() +{ + maFI.disposeAndClear(); + maCBTinyProfile.disposeAndClear(); + maCBEmbedFonts.disposeAndClear(); + maCBUseNativeDecoration.disposeAndClear(); + maBTOK.disposeAndClear(); + maBTCancel.disposeAndClear(); + maBTHelp.disposeAndClear(); + ModalDialog::dispose(); } Sequence< PropertyValue > ImpSVGDialog::GetFilterData() { - maConfigItem.WriteBool( OUString( SVG_PROP_TINYPROFILE ), maCBTinyProfile.IsChecked() ); - maConfigItem.WriteBool( OUString( SVG_PROP_EMBEDFONTS ), maCBEmbedFonts.IsChecked() ); - maConfigItem.WriteBool( OUString( SVG_PROP_NATIVEDECORATION ), maCBUseNativeDecoration.IsChecked() ); + maConfigItem.WriteBool( OUString( SVG_PROP_TINYPROFILE ), maCBTinyProfile->IsChecked() ); + maConfigItem.WriteBool( OUString( SVG_PROP_EMBEDFONTS ), maCBEmbedFonts->IsChecked() ); + maConfigItem.WriteBool( OUString( SVG_PROP_NATIVEDECORATION ), maCBUseNativeDecoration->IsChecked() ); return( maConfigItem.GetFilterData() ); } @@ -111,19 +124,19 @@ Sequence< PropertyValue > ImpSVGDialog::GetFilterData() IMPL_LINK( ImpSVGDialog, OnToggleCheckbox, CheckBox*, pBox ) { - if( pBox == &maCBTinyProfile ) + if( pBox == maCBTinyProfile.get() ) { if( pBox->IsChecked() ) { - mbOldNativeDecoration = maCBUseNativeDecoration.IsChecked(); + mbOldNativeDecoration = maCBUseNativeDecoration->IsChecked(); - maCBUseNativeDecoration.Check( false ); - maCBUseNativeDecoration.Disable(); + maCBUseNativeDecoration->Check( false ); + maCBUseNativeDecoration->Disable(); } else { - maCBUseNativeDecoration.Enable(); - maCBUseNativeDecoration.Check( mbOldNativeDecoration ); + maCBUseNativeDecoration->Enable(); + maCBUseNativeDecoration->Check( mbOldNativeDecoration ); } } diff --git a/filter/source/svg/impsvgdialog.hxx b/filter/source/svg/impsvgdialog.hxx index 657cd9a47bb9..ada5b71df1e3 100644 --- a/filter/source/svg/impsvgdialog.hxx +++ b/filter/source/svg/impsvgdialog.hxx @@ -48,17 +48,17 @@ class ImpSVGDialog : public ModalDialog { private: - FixedLine maFI; - CheckBox maCBTinyProfile; - CheckBox maCBEmbedFonts; - CheckBox maCBUseNativeDecoration; + VclPtr<FixedLine> maFI; + VclPtr<CheckBox> maCBTinyProfile; + VclPtr<CheckBox> maCBEmbedFonts; + VclPtr<CheckBox> maCBUseNativeDecoration; - OKButton maBTOK; - CancelButton maBTCancel; - HelpButton maBTHelp; + VclPtr<OKButton> maBTOK; + VclPtr<CancelButton> maBTCancel; + VclPtr<HelpButton> maBTHelp; - FilterConfigItem maConfigItem; - bool mbOldNativeDecoration; + FilterConfigItem maConfigItem; + bool mbOldNativeDecoration; DECL_LINK( OnToggleCheckbox, CheckBox* ); @@ -67,6 +67,7 @@ public: ImpSVGDialog( vcl::Window* pParent, /*ResMgr& rResMgr,*/ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rFilterData ); virtual ~ImpSVGDialog(); + virtual void dispose() SAL_OVERRIDE; com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetFilterData(); }; diff --git a/filter/source/svg/svgdialog.cxx b/filter/source/svg/svgdialog.cxx index ccc9b45ee653..764fc89c99bb 100644 --- a/filter/source/svg/svgdialog.cxx +++ b/filter/source/svg/svgdialog.cxx @@ -143,11 +143,12 @@ Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames() -Dialog* SVGDialog::createDialog( vcl::Window* pParent ) +VclPtr<Dialog> SVGDialog::createDialog( vcl::Window* pParent ) { - return( ( /*KA: *mapResMgr.get() &&*/ mxSrcDoc.is() ) ? - new ImpSVGDialog( pParent/*KA: , *mapResMgr*/, maFilterData ) : - NULL ); + if( mxSrcDoc.is() ) + return VclPtr<ImpSVGDialog>::Create( pParent, maFilterData ); + else + return VclPtr<Dialog>(); } @@ -155,7 +156,7 @@ Dialog* SVGDialog::createDialog( vcl::Window* pParent ) void SVGDialog::executedDialog( sal_Int16 nExecutionResult ) { if( nExecutionResult && m_pDialog ) - maFilterData = static_cast< ImpSVGDialog* >( m_pDialog )->GetFilterData(); + maFilterData = static_cast< ImpSVGDialog* >( m_pDialog.get() )->GetFilterData(); destroyDialog(); } diff --git a/filter/source/svg/svgdialog.hxx b/filter/source/svg/svgdialog.hxx index 064240ff49c7..7c87789c2438 100644 --- a/filter/source/svg/svgdialog.hxx +++ b/filter/source/svg/svgdialog.hxx @@ -56,7 +56,7 @@ protected: virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual Dialog* createDialog( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<Dialog> createDialog( vcl::Window* pParent ) SAL_OVERRIDE; virtual void executedDialog( sal_Int16 nExecutionResult ) SAL_OVERRIDE; virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE; diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx index b65370a423cb..231639aac3c3 100644 --- a/filter/source/svg/svgfontexport.cxx +++ b/filter/source/svg/svgfontexport.cxx @@ -78,10 +78,10 @@ SVGFontExport::GlyphSet& SVGFontExport::implGetGlyphSet( const vcl::Font& rFont void SVGFontExport::implCollectGlyphs() { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; ObjectVector::const_iterator aIter( maObjects.begin() ); - aVDev.EnableOutput( false ); + pVDev->EnableOutput( false ); while( aIter != maObjects.end() ) { @@ -89,7 +89,7 @@ void SVGFontExport::implCollectGlyphs() { const GDIMetaFile& rMtf = (*aIter).GetRepresentation(); - aVDev.Push(); + pVDev->Push(); for( size_t i = 0, nCount = rMtf.GetActionSize(); i < nCount; ++i ) { @@ -131,13 +131,13 @@ void SVGFontExport::implCollectGlyphs() break; default: - pAction->Execute( &aVDev ); + pAction->Execute( pVDev ); break; } if( !aText.isEmpty() ) { - GlyphSet& rGlyphSet = implGetGlyphSet( aVDev.GetFont() ); + GlyphSet& rGlyphSet = implGetGlyphSet( pVDev->GetFont() ); ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBI( ::vcl::unohelper::CreateBreakIterator() ); @@ -168,7 +168,7 @@ void SVGFontExport::implCollectGlyphs() } } - aVDev.Pop(); + pVDev->Pop(); } ++aIter; @@ -192,14 +192,14 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, "defs", true, true ); OUString aCurIdStr( aEmbeddedFontStr ); OUString aUnitsPerEM( OUString::number( nFontEM ) ); - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; vcl::Font aFont( rFont ); aFont.SetSize( Size( 0, nFontEM ) ); aFont.SetAlign( ALIGN_BASELINE ); - aVDev.SetMapMode( MAP_100TH_MM ); - aVDev.SetFont( aFont ); + pVDev->SetMapMode( MAP_100TH_MM ); + pVDev->SetFont( aFont ); mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", aCurIdStr += OUString::number( ++mnCurFontId ) ); mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", aUnitsPerEM ); @@ -226,8 +226,8 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) mrExport.AddAttribute( XML_NAMESPACE_NONE, "units-per-em", aUnitsPerEM ); mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-weight", aFontWeight ); mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-style", aFontStyle ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, "ascent", OUString::number( aVDev.GetFontMetric().GetAscent() ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, "descent", OUString::number( aVDev.GetFontMetric().GetDescent() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, "ascent", OUString::number( pVDev->GetFontMetric().GetAscent() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, "descent", OUString::number( pVDev->GetFontMetric().GetDescent() ) ); { SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "font-face", true, true ); @@ -248,7 +248,7 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) while( aIter != rGlyphSet.end() ) { - implEmbedGlyph( aVDev, *aIter ); + implEmbedGlyph( *pVDev.get(), *aIter ); ++aIter; } } diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 5774dfda9f04..59437328cd73 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1658,7 +1658,7 @@ SVGActionWriter::SVGActionWriter( SVGExport& rExport, SVGFontExport& rFontExport SVGActionWriter::~SVGActionWriter() { DBG_ASSERT( !mpContext, "Not all contexts are closed" ); - delete mpVDev; + mpVDev.disposeAndClear(); } long SVGActionWriter::ImplMap( sal_Int32 nVal ) const diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx index a74ca3032de4..2de237a268b2 100644 --- a/filter/source/svg/svgwriter.hxx +++ b/filter/source/svg/svgwriter.hxx @@ -178,7 +178,7 @@ class SVGTextWriter private: SVGExport& mrExport; SVGAttributeWriter* mpContext; - VirtualDevice* mpVDev; + VclPtr<VirtualDevice> mpVDev; bool mbIsTextShapeStarted; Reference<XText> mrTextShape; OUString msShapeId; @@ -303,7 +303,7 @@ private: SVGFontExport& mrFontExport; SVGAttributeWriter* mpContext; SVGTextWriter maTextWriter; - VirtualDevice* mpVDev; + VclPtr<VirtualDevice> mpVDev; MapMode maTargetMapMode; sal_uInt32 mnInnerMtfCount; bool mbClipAttrChanged; diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 4ca2d999d1b6..5d710e5b8e5d 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -107,7 +107,7 @@ private: com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxParent; /// parent window com::sun::star::uno::Reference< XComponentContext > mxContext; - XMLFilterSettingsDialog* mpDialog; + VclPtr<XMLFilterSettingsDialog> mpDialog; }; @@ -266,11 +266,7 @@ void SAL_CALL XMLFilterDialogComponent::disposing() { ::SolarMutexGuard aGuard; - if( mpDialog ) - { - delete mpDialog; - mpDialog = NULL; - } + mpDialog.disposeAndClear(); if (pXSLTResMgr) { @@ -328,14 +324,14 @@ sal_Int16 SAL_CALL XMLFilterDialogComponent::execute( ) throw(RuntimeException, pXSLTResMgr = ResMgr::CreateResMgr( "xsltdlg", Application::GetSettings().GetUILanguageTag() ); } - if( NULL == mpDialog ) + if( nullptr == mpDialog ) { vcl::Window* pParent = DIALOG_NO_PARENT; if (mxParent.is()) pParent = VCLUnoHelper::GetWindow(mxParent); Reference< XComponent > xComp( this ); - mpDialog = new XMLFilterSettingsDialog(pParent, mxContext); + mpDialog = VclPtr<XMLFilterSettingsDialog>::Create(pParent, mxContext); mpDialog->Execute(); } else if( !mpDialog->IsVisible() ) diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index ba832bfea60b..5865d812f555 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -103,7 +103,24 @@ XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent, } } +XMLFilterSettingsDialog::~XMLFilterSettingsDialog() +{ + disposeOnce(); +} +void XMLFilterSettingsDialog::dispose() +{ + m_pFilterListBox.clear(); + m_pCtrlFilterList.clear(); + m_pPBNew.clear(); + m_pPBEdit.clear(); + m_pPBTest.clear(); + m_pPBDelete.clear(); + m_pPBSave.clear(); + m_pPBOpen.clear(); + m_pPBClose.clear(); + ModelessDialog::dispose(); +} IMPL_LINK(XMLFilterSettingsDialog, ClickHdl_Impl, PushButton *, pButton ) { @@ -225,11 +242,11 @@ void XMLFilterSettingsDialog::onNew() aTempInfo.maDocumentService = "com.sun.star.text.TextDocument"; // execute XML Filter Dialog - XMLFilterTabDialog aDlg( this, *getXSLTDialogResMgr(), mxContext, &aTempInfo ); - if ( aDlg.Execute() == RET_OK ) + ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr(), mxContext, &aTempInfo ); + if ( aDlg->Execute() == RET_OK ) { // insert the new filter - insertOrEdit( aDlg.getNewFilterInfo() ); + insertOrEdit( aDlg->getNewFilterInfo() ); } } @@ -246,10 +263,10 @@ void XMLFilterSettingsDialog::onEdit() filter_info_impl* pOldInfo = static_cast<filter_info_impl*>(pEntry->GetUserData()); // execute XML Filter Dialog - XMLFilterTabDialog aDlg( this, *getXSLTDialogResMgr(), mxContext, pOldInfo ); - if ( aDlg.Execute() == RET_OK ) + ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr(), mxContext, pOldInfo ); + if ( aDlg->Execute() == RET_OK ) { - filter_info_impl* pNewInfo = aDlg.getNewFilterInfo(); + filter_info_impl* pNewInfo = aDlg->getNewFilterInfo(); if( !(*pOldInfo == *pNewInfo) ) { @@ -771,8 +788,8 @@ void XMLFilterSettingsDialog::onTest() { filter_info_impl* pInfo = static_cast<filter_info_impl*>(pEntry->GetUserData()); - XMLFilterTestDialog aDlg(this, mxContext); - aDlg.test( *pInfo ); + ScopedVclPtrInstance< XMLFilterTestDialog > aDlg(this, mxContext); + aDlg->test( *pInfo ); } } @@ -789,8 +806,8 @@ void XMLFilterSettingsDialog::onDelete() OUString aMessage(RESIDSTR(STR_WARN_DELETE)); aMessage = aMessage.replaceFirst( aPlaceHolder, pInfo->maFilterName ); - WarningBox aWarnBox(this, (WinBits)(WB_YES_NO | WB_DEF_YES), aMessage ); - if( aWarnBox.Execute() == RET_YES ) + ScopedVclPtrInstance< WarningBox > aWarnBox(this, (WinBits)(WB_YES_NO | WB_DEF_YES), aMessage ); + if( aWarnBox->Execute() == RET_YES ) { try { @@ -919,8 +936,8 @@ void XMLFilterSettingsDialog::onSave() aMsg = aMsg.replaceFirst( sPlaceholder, aURL.GetName() ); } - InfoBox aBox(this, aMsg ); - aBox.Execute(); + ScopedVclPtrInstance< InfoBox > aBox(this, aMsg ); + aBox->Execute(); } } @@ -985,8 +1002,8 @@ void XMLFilterSettingsDialog::onOpen() aMsg = aMsg.replaceFirst( sPlaceholder, OUString::number( nFilters ) ); } - InfoBox aBox(this, aMsg ); - aBox.Execute(); + ScopedVclPtrInstance< InfoBox > aBox(this, aMsg ); + aBox->Execute(); } } @@ -1339,12 +1356,12 @@ SvxPathControl::SvxPathControl(vcl::Window* pParent) : Window(pParent, WB_HIDE | WB_CLIPCHILDREN | WB_TABSTOP | WB_DIALOGCONTROL | WB_BORDER) , bHasBeenShown(false) { - m_pVBox = new VclVBox(this); + m_pVBox = VclPtr<VclVBox>::Create(this); - m_pHeaderBar = new HeaderBar(m_pVBox, WB_BOTTOMBORDER); + m_pHeaderBar = VclPtr<HeaderBar>::Create(m_pVBox, WB_BOTTOMBORDER); m_pHeaderBar->set_height_request(GetTextHeight() + 6); - m_pFocusCtrl = new XMLFilterListBox(m_pVBox, this); + m_pFocusCtrl = VclPtr<XMLFilterListBox>::Create(m_pVBox, this); m_pFocusCtrl->set_fill(true); m_pFocusCtrl->set_expand(true); @@ -1399,8 +1416,15 @@ Size SvxPathControl::GetOptimalSize() const SvxPathControl::~SvxPathControl() { - delete m_pFocusCtrl; - delete m_pHeaderBar; + disposeOnce(); +} + +void SvxPathControl::dispose() +{ + m_pFocusCtrl.disposeAndClear(); + m_pHeaderBar.disposeAndClear(); + m_pVBox.disposeAndClear(); + vcl::Window::dispose(); } extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxPathControl(vcl::Window *pParent, VclBuilder::stringmap &) @@ -1446,7 +1470,16 @@ XMLFilterListBox::XMLFilterListBox(Window* pParent, SvxPathControl* pPathControl m_pHeaderBar->Show(); } +XMLFilterListBox::~XMLFilterListBox() +{ + disposeOnce(); +} +void XMLFilterListBox::dispose() +{ + m_pHeaderBar.clear(); + SvTabListBox::dispose(); +} void XMLFilterListBox::Paint( const Rectangle& rRect ) { diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx index 85bb4d79094a..df26aaf95685 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx @@ -39,9 +39,9 @@ class SvxPathControl : public vcl::Window { private: bool bHasBeenShown; - VclVBox* m_pVBox; - HeaderBar* m_pHeaderBar; - XMLFilterListBox* m_pFocusCtrl; + VclPtr<VclVBox> m_pVBox; + VclPtr<HeaderBar> m_pHeaderBar; + VclPtr<XMLFilterListBox> m_pFocusCtrl; protected: virtual void Resize() SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE; @@ -50,6 +50,7 @@ public: HeaderBar* getHeaderBar() { return m_pHeaderBar; } XMLFilterListBox* getListBox() { return m_pFocusCtrl; } virtual ~SvxPathControl(); + virtual void dispose() SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; }; @@ -59,7 +60,7 @@ class HeaderBar; class XMLFilterListBox : public SvTabListBox { private: - HeaderBar* m_pHeaderBar; + VclPtr<HeaderBar> m_pHeaderBar; DECL_LINK( TabBoxScrollHdl_Impl, SvTabListBox* ); DECL_LINK( HeaderEndDrag_Impl, HeaderBar* ); @@ -68,6 +69,8 @@ private: public: XMLFilterListBox(Window* pParent, SvxPathControl* pPathControl); + virtual ~XMLFilterListBox(); + virtual void dispose() SAL_OVERRIDE; /** adds a new filter info entry to the ui filter list */ void addFilterEntry( const filter_info_impl* pInfo ); @@ -84,6 +87,8 @@ class XMLFilterSettingsDialog : public ModelessDialog public: XMLFilterSettingsDialog(vcl::Window* pParent, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext); + virtual ~XMLFilterSettingsDialog(); + virtual void dispose() SAL_OVERRIDE; DECL_LINK(ClickHdl_Impl, PushButton * ); DECL_LINK(SelectionChangedHdl_Impl, void * ); @@ -124,15 +129,15 @@ private: std::vector< filter_info_impl* > maFilterVector; - XMLFilterListBox* m_pFilterListBox; - SvxPathControl* m_pCtrlFilterList; - PushButton* m_pPBNew; - PushButton* m_pPBEdit; - PushButton* m_pPBTest; - PushButton* m_pPBDelete; - PushButton* m_pPBSave; - PushButton* m_pPBOpen; - CloseButton* m_pPBClose; + VclPtr<XMLFilterListBox> m_pFilterListBox; + VclPtr<SvxPathControl> m_pCtrlFilterList; + VclPtr<PushButton> m_pPBNew; + VclPtr<PushButton> m_pPBEdit; + VclPtr<PushButton> m_pPBTest; + VclPtr<PushButton> m_pPBDelete; + VclPtr<PushButton> m_pPBSave; + VclPtr<PushButton> m_pPBOpen; + VclPtr<CloseButton> m_pPBClose; bool m_bIsClosable; diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index 4494a74ba799..ff725cc040fe 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -56,13 +56,13 @@ XMLFilterTabDialog::XMLFilterTabDialog(vcl::Window *pParent, ResMgr& rResMgr, m_pTabCtrl->SetActivatePageHdl( LINK( this, XMLFilterTabDialog, ActivatePageHdl ) ); m_pTabCtrl->SetDeactivatePageHdl( LINK( this, XMLFilterTabDialog, DeactivatePageHdl ) ); - mpBasicPage = new XMLFilterTabPageBasic(m_pTabCtrl); + mpBasicPage = VclPtr<XMLFilterTabPageBasic>::Create(m_pTabCtrl); mpBasicPage->SetInfo( mpNewInfo ); m_nBasicPageId = m_pTabCtrl->GetPageId("general"); m_pTabCtrl->SetTabPage(m_nBasicPageId, mpBasicPage); - mpXSLTPage = new XMLFilterTabPageXSLT(m_pTabCtrl); + mpXSLTPage = VclPtr<XMLFilterTabPageXSLT>::Create(m_pTabCtrl); mpXSLTPage->SetInfo( mpNewInfo ); m_nXSLTPageId = m_pTabCtrl->GetPageId("transformation"); @@ -75,9 +75,17 @@ XMLFilterTabDialog::XMLFilterTabDialog(vcl::Window *pParent, ResMgr& rResMgr, XMLFilterTabDialog::~XMLFilterTabDialog() { - delete mpBasicPage; - delete mpXSLTPage; + disposeOnce(); +} + +void XMLFilterTabDialog::dispose() +{ + mpBasicPage.disposeAndClear(); + mpXSLTPage.disposeAndClear(); delete mpNewInfo; + m_pTabCtrl.clear(); + m_pOKBtn.clear(); + TabDialog::dispose(); } @@ -257,8 +265,8 @@ bool XMLFilterTabDialog::onOk() aMessage = aMessage.replaceAll( "%s", aReplace1 ); } - MessageDialog aBox(this, aMessage); - aBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aBox(this, aMessage); + aBox->Execute(); if( pFocusWindow ) pFocusWindow->GrabFocus(); diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.hxx b/filter/source/xsltdialog/xmlfiltertabdialog.hxx index 1ec8594ceac4..221b704bb050 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.hxx @@ -36,6 +36,7 @@ class XMLFilterTabDialog: public TabDialog public: XMLFilterTabDialog(vcl::Window *pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo); virtual ~XMLFilterTabDialog(); + virtual void dispose() SAL_OVERRIDE; bool onOk(); @@ -53,14 +54,14 @@ private: const filter_info_impl* mpOldInfo; filter_info_impl* mpNewInfo; - TabControl* m_pTabCtrl; - OKButton* m_pOKBtn; + VclPtr<TabControl> m_pTabCtrl; + VclPtr<OKButton> m_pOKBtn; sal_Int16 m_nBasicPageId; sal_Int16 m_nXSLTPageId; - XMLFilterTabPageBasic* mpBasicPage; - XMLFilterTabPageXSLT* mpXSLTPage; + VclPtr<XMLFilterTabPageBasic> mpBasicPage; + VclPtr<XMLFilterTabPageXSLT> mpXSLTPage; }; diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx index fb1d35ac2599..3f4d285a71a3 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx @@ -44,7 +44,19 @@ XMLFilterTabPageBasic::XMLFilterTabPageBasic(vcl::Window* pParent) XMLFilterTabPageBasic::~XMLFilterTabPageBasic() { + disposeOnce(); } + +void XMLFilterTabPageBasic::dispose() +{ + m_pEDFilterName.clear(); + m_pCBApplication.clear(); + m_pEDInterfaceName.clear(); + m_pEDExtension.clear(); + m_pEDDescription.clear(); + TabPage::dispose(); +} + static OUString checkExtensions( const OUString& rExtensions ) { const sal_Unicode* pSource = rExtensions.getStr(); diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx index 13d38d11e046..ac3876c868b8 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx +++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx @@ -34,6 +34,7 @@ class XMLFilterTabPageBasic : public TabPage public: XMLFilterTabPageBasic(vcl::Window* pParent); virtual ~XMLFilterTabPageBasic(); + virtual void dispose() SAL_OVERRIDE; bool FillInfo( filter_info_impl* pInfo ); void SetInfo(const filter_info_impl* pInfo); @@ -41,11 +42,11 @@ public: static OUString decodeComment( const OUString& rComment ); static OUString encodeComment( const OUString& rComment ); - Edit* m_pEDFilterName; - ComboBox* m_pCBApplication; - Edit* m_pEDInterfaceName; - Edit* m_pEDExtension; - VclMultiLineEdit* m_pEDDescription; + VclPtr<Edit> m_pEDFilterName; + VclPtr<ComboBox> m_pCBApplication; + VclPtr<Edit> m_pEDInterfaceName; + VclPtr<Edit> m_pEDExtension; + VclPtr<VclMultiLineEdit> m_pEDDescription; }; #endif diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx index a9d1cae94360..717463bc5bc5 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx @@ -58,6 +58,20 @@ XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( vcl::Window* pParent) : XMLFilterTabPageXSLT::~XMLFilterTabPageXSLT() { + disposeOnce(); +} + +void XMLFilterTabPageXSLT::dispose() +{ + m_pEDDocType.clear(); + m_pEDExportXSLT.clear(); + m_pPBExprotXSLT.clear(); + m_pEDImportXSLT.clear(); + m_pPBImportXSLT.clear(); + m_pEDImportTemplate.clear(); + m_pPBImportTemplate.clear(); + m_pCBNeedsXSLT2.clear(); + TabPage::dispose(); } bool XMLFilterTabPageXSLT::FillInfo( filter_info_impl* pInfo ) diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx index 01f36d518a7e..09c110fdb504 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx @@ -35,6 +35,7 @@ class XMLFilterTabPageXSLT : public TabPage public: XMLFilterTabPageXSLT( vcl::Window* pParent); virtual ~XMLFilterTabPageXSLT(); + virtual void dispose() SAL_OVERRIDE; bool FillInfo( filter_info_impl* pInfo ); void SetInfo(const filter_info_impl* pInfo); @@ -42,18 +43,18 @@ public: DECL_LINK( ClickBrowseHdl_Impl, PushButton * ); - Edit* m_pEDDocType; + VclPtr<Edit> m_pEDDocType; - SvtURLBox* m_pEDExportXSLT; - PushButton* m_pPBExprotXSLT; + VclPtr<SvtURLBox> m_pEDExportXSLT; + VclPtr<PushButton> m_pPBExprotXSLT; - SvtURLBox* m_pEDImportXSLT; - PushButton* m_pPBImportXSLT; + VclPtr<SvtURLBox> m_pEDImportXSLT; + VclPtr<PushButton> m_pPBImportXSLT; - SvtURLBox* m_pEDImportTemplate; - PushButton* m_pPBImportTemplate; + VclPtr<SvtURLBox> m_pEDImportTemplate; + VclPtr<PushButton> m_pPBImportTemplate; - CheckBox* m_pCBNeedsXSLT2; + VclPtr<CheckBox> m_pCBNeedsXSLT2; private: void SetURL( SvtURLBox *rURLBox, const OUString& rURL ); diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 359300e31ea9..2563cadada86 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -79,7 +79,7 @@ public: // lang::XEventListener virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw (RuntimeException, std::exception) SAL_OVERRIDE; private: - XMLFilterTestDialog* mpDialog; + VclPtr<XMLFilterTestDialog> mpDialog; }; GlobalEventListenerImpl::GlobalEventListenerImpl( XMLFilterTestDialog* pDialog ) @@ -178,6 +178,11 @@ XMLFilterTestDialog::XMLFilterTestDialog(vcl::Window* pParent, XMLFilterTestDialog::~XMLFilterTestDialog() { + disposeOnce(); +} + +void XMLFilterTestDialog::dispose() +{ try { if( mxGlobalBroadcaster.is() ) @@ -189,6 +194,21 @@ XMLFilterTestDialog::~XMLFilterTestDialog() } delete m_pFilterInfo; + m_pExport.clear(); + m_pFTExportXSLTFile.clear(); + m_pPBExportBrowse.clear(); + m_pPBCurrentDocument.clear(); + m_pFTNameOfCurrentFile.clear(); + m_pImport.clear(); + m_pFTImportXSLTFile.clear(); + m_pFTImportTemplate.clear(); + m_pFTImportTemplateFile.clear(); + m_pCBXDisplaySource.clear(); + m_pPBImportBrowse.clear(); + m_pPBRecentFile.clear(); + m_pFTNameOfRecentFile.clear(); + m_pPBClose.clear(); + ModalDialog::dispose(); } void XMLFilterTestDialog::test( const filter_info_impl& rFilterInfo ) diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.hxx b/filter/source/xsltdialog/xmlfiltertestdialog.hxx index 45953483b43a..3d69341fec30 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.hxx @@ -37,6 +37,7 @@ public: XMLFilterTestDialog(vcl::Window* pParent, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext); virtual ~XMLFilterTestDialog(); + virtual void dispose() SAL_OVERRIDE; void test( const filter_info_impl& rFilterInfo ); @@ -65,21 +66,21 @@ private: OUString m_sImportRecentFile; OUString m_sExportRecentFile; - VclContainer* m_pExport; - FixedText* m_pFTExportXSLTFile; - PushButton* m_pPBExportBrowse; - PushButton* m_pPBCurrentDocument; - FixedText* m_pFTNameOfCurrentFile; - - VclContainer* m_pImport; - FixedText* m_pFTImportXSLTFile; - FixedText* m_pFTImportTemplate; - FixedText* m_pFTImportTemplateFile; - CheckBox* m_pCBXDisplaySource; - PushButton* m_pPBImportBrowse; - PushButton* m_pPBRecentFile; - FixedText* m_pFTNameOfRecentFile; - CloseButton* m_pPBClose; + VclPtr<VclContainer> m_pExport; + VclPtr<FixedText> m_pFTExportXSLTFile; + VclPtr<PushButton> m_pPBExportBrowse; + VclPtr<PushButton> m_pPBCurrentDocument; + VclPtr<FixedText> m_pFTNameOfCurrentFile; + + VclPtr<VclContainer> m_pImport; + VclPtr<FixedText> m_pFTImportXSLTFile; + VclPtr<FixedText> m_pFTImportTemplate; + VclPtr<FixedText> m_pFTImportTemplateFile; + VclPtr<CheckBox> m_pCBXDisplaySource; + VclPtr<PushButton> m_pPBImportBrowse; + VclPtr<PushButton> m_pPBRecentFile; + VclPtr<FixedText> m_pFTNameOfRecentFile; + VclPtr<CloseButton> m_pPBClose; filter_info_impl* m_pFilterInfo; |