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 /sd | |
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 'sd')
212 files changed, 2210 insertions, 1376 deletions
diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx index f4b1a6f64deb..a23fa4463284 100644 --- a/sd/inc/Outliner.hxx +++ b/sd/inc/Outliner.hxx @@ -190,7 +190,7 @@ private: */ ::boost::weak_ptr<ViewShell> mpWeakViewShell; /// This window contains the view. - ::sd::Window* mpWindow; + VclPtr<::sd::Window> mpWindow; /// The document on whose objects and pages this class operates. SdDrawDocument* mpDrawDocument; diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx index 5ad63fd081ee..5dfaf5a96eb9 100644 --- a/sd/inc/sdmod.hxx +++ b/sd/inc/sdmod.hxx @@ -125,7 +125,7 @@ public: // virtual methods for the option dialog virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE; virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE; - virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE; + virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE; SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache; SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache; @@ -144,7 +144,7 @@ protected: in the sense that it does not represent a printer. The pointer may be NULL when the virtual device could not be created. */ - OutputDevice* mpVirtualRefDevice; + VclPtr< OutputDevice > mpVirtualRefDevice; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 33e457b03cc9..58c246f8035a 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -242,8 +242,8 @@ SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium& rMedium) if (!bOK) { - MessageDialog aErrorBox(NULL, SD_RESSTR(STR_READ_DATA_ERROR)); - aErrorBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SD_RESSTR(STR_READ_DATA_ERROR)); + aErrorBox->Execute(); CloseBookmarkDoc(); pBookmarkDoc = NULL; diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx index b012245b4132..e616a0524d38 100644 --- a/sd/source/filter/eppt/epptbase.hxx +++ b/sd/source/filter/eppt/epptbase.hxx @@ -35,6 +35,8 @@ #include <com/sun/star/presentation/XPresentationSupplier.hpp> #include <com/sun/star/presentation/FadeEffect.hpp> #include <com/sun/star/task/XStatusIndicatorSupplier.hpp> +#include <vcl/vclptr.hxx> +#include <vcl/outdev.hxx> #include "grouptable.hxx" @@ -176,7 +178,6 @@ struct FontCollectionEntry void ImplInit( const OUString& rName ); }; -class VirtualDevice; class FontCollection { public : @@ -197,7 +198,7 @@ public : private: - VirtualDevice* pVDev; + VclPtr<VirtualDevice> pVDev; boost::ptr_vector<FontCollectionEntry> maFonts; }; diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 192d4eb31384..a8c3e90ef9a9 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -1396,7 +1396,7 @@ void FontCollectionEntry::ImplInit( const OUString& rName ) FontCollection::~FontCollection() { - delete pVDev; + pVDev.disposeAndClear(); xPPTBreakIter = NULL; } diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 727fba485427..c8ec3ee85e24 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -169,8 +169,8 @@ void SdGRFFilter::HandleGraphicFilterError( sal_uInt16 nFilterError, sal_uLong n ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); else { - MessageDialog aErrorBox(NULL, SD_RESSTR(nId)); - aErrorBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SD_RESSTR(nId)); + aErrorBox->Execute(); } } diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx index fbc76de77900..ab7590f09bee 100644 --- a/sd/source/filter/html/buttonset.cxx +++ b/sd/source/filter/html/buttonset.cxx @@ -197,8 +197,8 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton std::vector< Graphic > aGraphics; - VirtualDevice aDev; - aDev.SetMapMode(MapMode(MAP_PIXEL)); + ScopedVclPtrInstance< VirtualDevice > pDev; + pDev->SetMapMode(MapMode(MAP_PIXEL)); Size aSize; std::vector< OUString >::const_iterator aIter( rButtons.begin() ); @@ -210,7 +210,7 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton aGraphics.push_back(aGraphic); - Size aGraphicSize( aGraphic.GetSizePixel( &aDev ) ); + Size aGraphicSize( aGraphic.GetSizePixel( pDev ) ); aSize.Width() += aGraphicSize.Width(); if( aSize.Height() < aGraphicSize.Height() ) @@ -220,7 +220,7 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton aSize.Width() += 3; } - aDev.SetOutputSizePixel( aSize ); + pDev->SetOutputSizePixel( aSize ); Point aPos; @@ -229,12 +229,12 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton { Graphic aGraphic( (*aGraphIter++) ); - aGraphic.Draw( &aDev, aPos ); + aGraphic.Draw( pDev, aPos ); aPos.X() += aGraphic.GetSizePixel().Width() + 3; } - rImage = Image( aDev.GetBitmapEx( Point(), aSize ) ); + rImage = Image( pDev->GetBitmapEx( Point(), aSize ) ); return true; } return false; diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index d743aeb854f2..d761c2367f1d 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -3113,9 +3113,9 @@ bool HtmlExport::checkForExistingFiles() OUString aSystemPath; osl::FileBase::getSystemPathFromFileURL( maExportPath, aSystemPath ); aMsg = aMsg.replaceFirst( "%FILENAME", aSystemPath ); - WarningBox aWarning( 0, WB_YES_NO | WB_DEF_YES, aMsg ); - aWarning.SetImage( WarningBox::GetStandardImage() ); - bFound = ( RET_NO == aWarning.Execute() ); + ScopedVclPtrInstance< WarningBox > aWarning( nullptr, WB_YES_NO | WB_DEF_YES, aMsg ); + aWarning->SetImage( WarningBox::GetStandardImage() ); + bFound = ( RET_NO == aWarning->Execute() ); delete pResMgr; } diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx index a581a66d82b6..033eeb0fe52b 100644 --- a/sd/source/filter/html/pubdlg.cxx +++ b/sd/source/filter/html/pubdlg.cxx @@ -347,12 +347,13 @@ SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDes class SdDesignNameDlg : public ModalDialog { private: - Edit* m_pEdit; - OKButton* m_pBtnOK; + VclPtr<Edit> m_pEdit; + VclPtr<OKButton> m_pBtnOK; public: SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName ); - + virtual ~SdDesignNameDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetDesignName(); DECL_LINK(ModifyHdl, void *); }; @@ -483,8 +484,97 @@ SdPublishingDlg::SdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType) SdPublishingDlg::~SdPublishingDlg() { + disposeOnce(); +} + +void SdPublishingDlg::dispose() +{ + pPage1.clear(); + pPage1_Titel.clear(); + pPage1_NewDesign.clear(); + pPage1_OldDesign.clear(); + pPage1_Designs.clear(); + pPage1_DelDesign.clear(); + pPage1_Desc.clear(); + pPage2.clear(); + pPage2Frame2.clear(); + pPage2Frame3.clear(); + pPage2Frame4.clear(); + pPage2_Titel.clear(); + pPage2_Standard.clear(); + pPage2_Frames.clear(); + pPage2_SingleDocument.clear(); + pPage2_Kiosk.clear(); + pPage2_WebCast.clear(); + pPage2_Standard_FB.clear(); + pPage2_Frames_FB.clear(); + pPage2_Kiosk_FB.clear(); + pPage2_WebCast_FB.clear(); + pPage2_Titel_Html.clear(); + pPage2_Content.clear(); + pPage2_Notes.clear(); + pPage2_Titel_WebCast.clear(); + pPage2_ASP.clear(); + pPage2_PERL.clear(); + pPage2_URL_txt.clear(); + pPage2_URL.clear(); + pPage2_CGI_txt.clear(); + pPage2_CGI.clear(); + pPage2_Index_txt.clear(); + pPage2_Index.clear(); + pPage2_Titel_Kiosk.clear(); + pPage2_ChgDefault.clear(); + pPage2_ChgAuto.clear(); + pPage2_Duration_txt.clear(); + pPage2_Duration.clear(); + pPage2_Endless.clear(); + pPage3.clear(); + pPage3_Titel1.clear(); + pPage3_Png.clear(); + pPage3_Gif.clear(); + pPage3_Jpg.clear(); + pPage3_Quality_txt.clear(); + pPage3_Quality.clear(); + pPage3_Titel2.clear(); + pPage3_Resolution_1.clear(); + pPage3_Resolution_2.clear(); + pPage3_Resolution_3.clear(); + pPage3_Titel3.clear(); + pPage3_SldSound.clear(); + pPage3_HiddenSlides.clear(); + pPage4.clear(); + pPage4_Titel1.clear(); + pPage4_Author_txt.clear(); + pPage4_Author.clear(); + pPage4_Email_txt.clear(); + pPage4_Email.clear(); + pPage4_WWW_txt.clear(); + pPage4_WWW.clear(); + pPage4_Titel2.clear(); + pPage4_Misc.clear(); + pPage4_Download.clear(); + pPage5.clear(); + pPage5_Titel.clear(); + pPage5_TextOnly.clear(); + pPage5_Buttons.clear(); + pPage6.clear(); + pPage6_Titel.clear(); + pPage6_Default.clear(); + pPage6_User.clear(); + pPage6_Back.clear(); + pPage6_Text.clear(); + pPage6_Link.clear(); + pPage6_VLink.clear(); + pPage6_ALink.clear(); + pPage6_DocColors.clear(); + pPage6_Preview.clear(); + pLastPageButton.clear(); + pNextPageButton.clear(); + pFinishButton.clear(); + ModalDialog::dispose(); } + // Generate dialog controls and embed them in the pages void SdPublishingDlg::CreatePages() { @@ -1072,11 +1162,11 @@ IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl) { bRetry = false; - SdDesignNameDlg aDlg(this, aName ); + ScopedVclPtrInstance< SdDesignNameDlg > aDlg(this, aName ); - if ( aDlg.Execute() == RET_OK ) + if ( aDlg->Execute() == RET_OK ) { - pDesign->m_aDesignName = aDlg.GetDesignName(); + pDesign->m_aDesignName = aDlg->GetDesignName(); boost::ptr_vector<SdPublishingDesign>::iterator iter; for (iter = m_aDesignList.begin(); iter != m_aDesignList.end(); ++iter) @@ -1087,9 +1177,9 @@ IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl) if (iter != m_aDesignList.end()) { - MessageDialog aErrorBox(this, SD_RESSTR(STR_PUBDLG_SAMENAME), + ScopedVclPtrInstance<MessageDialog> aErrorBox(this, SD_RESSTR(STR_PUBDLG_SAMENAME), VCL_MESSAGE_ERROR, VCL_BUTTONS_YES_NO); - bRetry = aErrorBox.Execute() == RET_NO; + bRetry = aErrorBox->Execute() == RET_NO; if(!bRetry) m_aDesignList.erase(iter); @@ -1542,6 +1632,18 @@ SdDesignNameDlg::SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName) m_pBtnOK->Enable(!aName.isEmpty()); } +SdDesignNameDlg::~SdDesignNameDlg() +{ + disposeOnce(); +} + +void SdDesignNameDlg::dispose() +{ + m_pEdit.clear(); + m_pBtnOK.clear(); + ModalDialog::dispose(); +} + OUString SdDesignNameDlg::GetDesignName() { return m_pEdit->GetText(); diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index 6cde28c4d4f1..f2f4f4a9df0c 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -96,7 +96,7 @@ private: sal_Int32 mnFirstVisibleChild; sal_Int32 mnLastVisibleChild; bool mbListeningToDocument; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; sal_Int32 mnFocusedIndex; bool mbModelChangeLocked; ImplSVEvent * mnUpdateChildrenUserEventId; @@ -221,7 +221,7 @@ Reference<XAccessible > SAL_CALL AccessibleSlideSorterView::getAccessibleParent( const SolarMutexGuard aSolarGuard; Reference<XAccessible> xParent; - if (mpContentWindow != NULL) + if (mpContentWindow != nullptr) { vcl::Window* pParent = mpContentWindow->GetAccessibleParentWindow(); if (pParent != NULL) @@ -302,7 +302,7 @@ Reference<XAccessibleStateSet > SAL_CALL pStateSet->AddState(AccessibleStateType::ACTIVE); pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE); pStateSet->AddState(AccessibleStateType::OPAQUE); - if (mpContentWindow!=NULL) + if (mpContentWindow!=nullptr) { if (mpContentWindow->IsVisible()) pStateSet->AddState(AccessibleStateType::VISIBLE); @@ -416,7 +416,7 @@ awt::Rectangle SAL_CALL AccessibleSlideSorterView::getBounds() const SolarMutexGuard aSolarGuard; awt::Rectangle aBBox; - if (mpContentWindow != NULL) + if (mpContentWindow != nullptr) { const Point aPosition (mpContentWindow->GetPosPixel()); const Size aSize (mpContentWindow->GetOutputSizePixel()); @@ -436,7 +436,7 @@ awt::Point SAL_CALL AccessibleSlideSorterView::getLocation() ThrowIfDisposed(); awt::Point aLocation; - if (mpContentWindow != NULL) + if (mpContentWindow != nullptr) { const Point aPosition (mpContentWindow->GetPosPixel()); aLocation.X = aPosition.X(); @@ -478,7 +478,7 @@ awt::Size SAL_CALL AccessibleSlideSorterView::getSize() ThrowIfDisposed(); awt::Size aSize; - if (mpContentWindow != NULL) + if (mpContentWindow != nullptr) { const Size aOutputSize (mpContentWindow->GetOutputSizePixel()); aSize.Width = aOutputSize.Width(); @@ -813,7 +813,7 @@ void AccessibleSlideSorterView::Implementation::ConnectListeners() StartListening (*mrSlideSorter.GetViewShell()); mbListeningToDocument = true; - if (mpWindow != NULL) + if (mpWindow != nullptr) mpWindow->AddEventListener( LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener)); @@ -834,7 +834,7 @@ void AccessibleSlideSorterView::Implementation::ReleaseListeners() mrSlideSorter.GetView().RemoveVisibilityChangeListener( LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener)); - if (mpWindow != NULL) + if (mpWindow != nullptr) mpWindow->RemoveEventListener( LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener)); diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx index 239f19586dd9..59bcdecaceb0 100644 --- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx @@ -165,6 +165,7 @@ class CustomAnimationCreateTabPage : public TabPage public: CustomAnimationCreateTabPage( vcl::Window* pParent, CustomAnimationCreateDialog* pDialogParent, sal_uInt16 nTabId, const PresetCategoryList& rCategoryList, bool bHasText, bool bIsMotionPath = false ); virtual ~CustomAnimationCreateTabPage(); + virtual void dispose() SAL_OVERRIDE; PathKind getCreatePathKind() const; CustomAnimationPresetPtr getSelectedPreset() const; @@ -187,12 +188,12 @@ private: void clearEffects(); private: - CategoryListBox* mpLBEffects; - FixedText* mpFTSpeed; - ListBox* mpCBSpeed; - CheckBox* mpCBXPReview; + VclPtr<CategoryListBox> mpLBEffects; + VclPtr<FixedText> mpFTSpeed; + VclPtr<ListBox> mpCBSpeed; + VclPtr<CheckBox> mpCBXPReview; - CustomAnimationCreateDialog* mpParent; + VclPtr<CustomAnimationCreateDialog> mpParent; sal_uInt16 mnId; @@ -296,7 +297,18 @@ CustomAnimationCreateTabPage::CustomAnimationCreateTabPage( vcl::Window* pParent CustomAnimationCreateTabPage::~CustomAnimationCreateTabPage() { + disposeOnce(); +} + +void CustomAnimationCreateTabPage::dispose() +{ clearEffects(); + mpLBEffects.clear(); + mpFTSpeed.clear(); + mpCBSpeed.clear(); + mpCBXPReview.clear(); + mpParent.clear(); + TabPage::dispose(); } IMPL_LINK( CustomAnimationCreateTabPage, implSelectHdl, Control*, pControl ) @@ -497,15 +509,15 @@ CustomAnimationCreateDialog::CustomAnimationCreateDialog( vcl::Window* pParent, mnMiscId = mpTabControl->GetPageId("misc_effects"); const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets(); - mpTabPages[ENTRANCE] = new CustomAnimationCreateTabPage( mpTabControl, this, mnEntranceId, rPresets.getEntrancePresets(), bHasText ); + mpTabPages[ENTRANCE] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnEntranceId, rPresets.getEntrancePresets(), bHasText ); mpTabControl->SetTabPage( mnEntranceId, mpTabPages[ENTRANCE] ); - mpTabPages[EMPHASIS] = new CustomAnimationCreateTabPage( mpTabControl, this, mnEmphasisId, rPresets.getEmphasisPresets(), bHasText ); + mpTabPages[EMPHASIS] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnEmphasisId, rPresets.getEmphasisPresets(), bHasText ); mpTabControl->SetTabPage( mnEmphasisId, mpTabPages[EMPHASIS] ); - mpTabPages[EXIT] = new CustomAnimationCreateTabPage( mpTabControl, this, mnExitId, rPresets.getExitPresets(), bHasText ); + mpTabPages[EXIT] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnExitId, rPresets.getExitPresets(), bHasText ); mpTabControl->SetTabPage( mnExitId, mpTabPages[EXIT] ); - mpTabPages[MOTIONPATH] = new CustomAnimationCreateTabPage( mpTabControl, this, mnMPathId, rPresets.getMotionPathsPresets(), bHasText, true ); + mpTabPages[MOTIONPATH] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnMPathId, rPresets.getMotionPathsPresets(), bHasText, true ); mpTabControl->SetTabPage( mnMPathId, mpTabPages[MOTIONPATH] ); - mpTabPages[MISCEFFECTS] = new CustomAnimationCreateTabPage( mpTabControl, this, mnMiscId, rPresets.getMiscPresets(), bHasText ); + mpTabPages[MISCEFFECTS] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnMiscId, rPresets.getMiscPresets(), bHasText ); mpTabControl->SetTabPage( mnMiscId, mpTabPages[MISCEFFECTS] ); getCurrentPage()->setDuration( mfDuration ); @@ -532,17 +544,25 @@ CustomAnimationCreateDialog::CustomAnimationCreateDialog( vcl::Window* pParent, CustomAnimationCreateDialog::~CustomAnimationCreateDialog() { + disposeOnce(); +} + +void CustomAnimationCreateDialog::dispose() +{ storePosition(); SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); pOptions->SetPreviewNewEffects( getCurrentPage()->getIsPreview() ); - delete mpTabPages[ENTRANCE]; - delete mpTabPages[EMPHASIS]; - delete mpTabPages[EXIT]; - delete mpTabPages[MOTIONPATH]; - delete mpTabPages[MISCEFFECTS]; + mpTabPages[ENTRANCE].disposeAndClear(); + mpTabPages[EMPHASIS].disposeAndClear(); + mpTabPages[EXIT].disposeAndClear(); + mpTabPages[MOTIONPATH].disposeAndClear(); + mpTabPages[MISCEFFECTS].disposeAndClear(); + mpTabControl.clear(); + mpPane.clear(); + TabDialog::dispose(); } CustomAnimationCreateTabPage* CustomAnimationCreateDialog::getCurrentPage() const diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx index b17be8894781..68a5c811bc87 100644 --- a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx +++ b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx @@ -41,6 +41,7 @@ class CustomAnimationCreateDialog : public TabDialog public: CustomAnimationCreateDialog( vcl::Window* pParent, CustomAnimationPane* pPane, const std::vector< ::com::sun::star::uno::Any >& rTargets, bool bHasText, const OUString& rsPresetId, double fDuration ); virtual ~CustomAnimationCreateDialog(); + virtual void dispose() SAL_OVERRIDE; PathKind getCreatePathKind() const; CustomAnimationPresetPtr getSelectedPreset() const; @@ -56,15 +57,15 @@ private: DECL_LINK(implDeactivatePagekHdl, void *); private: - CustomAnimationPane* mpPane; + VclPtr<CustomAnimationPane> mpPane; const std::vector< ::com::sun::star::uno::Any >& mrTargets; double mfDuration; bool mbIsPreview; - TabControl* mpTabControl; + VclPtr<TabControl> mpTabControl; - CustomAnimationCreateTabPage* mpTabPages[5]; + VclPtr<CustomAnimationCreateTabPage> mpTabPages[5]; sal_uInt16 mnEntranceId, mnEmphasisId, mnExitId, mnMPathId, mnMiscId; }; diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 5a4577aeb74a..c2bd3292e100 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -107,13 +107,13 @@ public: private: std::map< sal_uInt16, OUString > maPropertyValues; - ListBox* mpControl; + VclPtr<ListBox> mpControl; }; PresetPropertyBox::PresetPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const OUString& aPresetId, const Link& rModifyHdl ) : PropertySubControl( nControlType ) { - mpControl = new ListBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); + mpControl = VclPtr<ListBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); mpControl->SetDropDownLineCount( 10 ); mpControl->SetSelectHdl( rModifyHdl ); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX ); @@ -159,7 +159,7 @@ void PresetPropertyBox::setValue( const Any& rValue, const OUString& rPresetId ) PresetPropertyBox::~PresetPropertyBox() { - delete mpControl; + mpControl.disposeAndClear(); } Any PresetPropertyBox::getValue() @@ -183,13 +183,13 @@ public: virtual Control* getControl() SAL_OVERRIDE; private: - ColorListBox* mpControl; + VclPtr<ColorListBox> mpControl; }; ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl ) : PropertySubControl( nControlType ) { - mpControl = new ColorListBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); + mpControl = VclPtr<ColorListBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); mpControl->SetDropDownLineCount( 10 ); mpControl->SetSelectHdl( rModifyHdl ); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX ); @@ -219,7 +219,7 @@ ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent ColorPropertyBox::~ColorPropertyBox() { - delete mpControl; + mpControl.disposeAndClear(); } void ColorPropertyBox::setValue( const Any& rValue, const OUString& ) @@ -256,13 +256,13 @@ public: virtual Control* getControl() SAL_OVERRIDE; private: - FontNameBox* mpControl; + VclPtr<FontNameBox> mpControl; }; FontPropertyBox::FontPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl ) : PropertySubControl( nControlType ) { - mpControl = new FontNameBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); + mpControl = VclPtr<FontNameBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); mpControl->SetDropDownLineCount( 10 ); mpControl->SetSelectHdl( rModifyHdl ); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX ); @@ -303,7 +303,7 @@ void FontPropertyBox::setValue( const Any& rValue, const OUString& ) FontPropertyBox::~FontPropertyBox() { - delete mpControl; + mpControl.disposeAndClear(); } Any FontPropertyBox::getValue() @@ -322,6 +322,7 @@ class DropdownMenuBox : public Edit public: DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu ); virtual ~DropdownMenuBox(); + virtual void dispose() SAL_OVERRIDE; void Resize() SAL_OVERRIDE; bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -329,16 +330,16 @@ public: void SetMenuSelectHdl( const Link& rLink ) { mpDropdownButton->SetSelectHdl( rLink ); } private: - Edit* mpSubControl; - MenuButton* mpDropdownButton; - PopupMenu* mpMenu; + VclPtr<Edit> mpSubControl; + VclPtr<MenuButton> mpDropdownButton; + PopupMenu* mpMenu; }; DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu ) : Edit( pParent, WB_BORDER|WB_TABSTOP| WB_DIALOGCONTROL ), mpSubControl(pSubControl),mpDropdownButton(0),mpMenu(pMenu) { - mpDropdownButton = new MenuButton( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP); + mpDropdownButton = VclPtr<MenuButton>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP); mpDropdownButton->SetSymbol(SymbolType::SPIN_DOWN); mpDropdownButton->Show(); mpDropdownButton->SetPopupMenu( pMenu ); @@ -350,10 +351,16 @@ DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, Popup DropdownMenuBox::~DropdownMenuBox() { - SetSubEdit( 0 ); - delete mpSubControl; - delete mpDropdownButton; + disposeOnce(); +} + +void DropdownMenuBox::dispose() +{ + SetSubEdit(nullptr); + mpDropdownButton.disposeAndClear(); delete mpMenu; + mpSubControl.disposeAndClear(); + Edit::dispose(); } void DropdownMenuBox::Resize() @@ -405,21 +412,21 @@ public: DECL_LINK( implMenuSelectHdl, MenuButton* ); private: - DropdownMenuBox* mpControl; + VclPtr<DropdownMenuBox> mpControl; PopupMenu* mpMenu; - MetricField* mpMetric; + VclPtr<MetricField> mpMetric; }; CharHeightPropertyBox::CharHeightPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl ) : PropertySubControl( nControlType ) { - mpMetric = new MetricField( pParent, WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER); + mpMetric.set( VclPtr<MetricField>::Create( pParent, WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) ); mpMetric->SetUnit( FUNIT_PERCENT ); mpMetric->SetMin( 0 ); mpMetric->SetMax( 1000 ); mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSIZE_POPUP ) ); - mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu ); + mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu ); mpControl->SetMenuSelectHdl( LINK( this, CharHeightPropertyBox, implMenuSelectHdl )); mpControl->SetModifyHdl( rModifyHdl ); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX ); @@ -430,7 +437,7 @@ CharHeightPropertyBox::CharHeightPropertyBox( sal_Int32 nControlType, vcl::Windo CharHeightPropertyBox::~CharHeightPropertyBox() { - delete mpControl; + mpControl.disposeAndClear(); } IMPL_LINK( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb ) @@ -450,7 +457,7 @@ IMPL_LINK( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb ) void CharHeightPropertyBox::setValue( const Any& rValue, const OUString& ) { - if( mpMetric ) + if( mpMetric.get() ) { double fValue = 0.0; rValue >>= fValue; @@ -485,9 +492,9 @@ public: void updateMenu(); private: - DropdownMenuBox* mpControl; + VclPtr<DropdownMenuBox> mpControl; PopupMenu* mpMenu; - MetricField* mpMetric; + VclPtr<MetricField> mpMetric; Link maModifyHdl; }; @@ -495,7 +502,7 @@ TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::W : PropertySubControl( nControlType ) , maModifyHdl( rModifyHdl ) { - mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER); + mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) ); mpMetric->SetUnit( FUNIT_PERCENT ); mpMetric->SetMin( 0 ); mpMetric->SetMax( 100 ); @@ -508,7 +515,7 @@ TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::W mpMenu->InsertItem( i, aStr ); } - mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu ); + mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu ); mpControl->SetMenuSelectHdl( LINK( this, TransparencyPropertyBox, implMenuSelectHdl )); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX ); @@ -521,7 +528,7 @@ TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::W TransparencyPropertyBox::~TransparencyPropertyBox() { - delete mpControl; + mpControl.disposeAndClear(); } void TransparencyPropertyBox::updateMenu() @@ -534,7 +541,7 @@ void TransparencyPropertyBox::updateMenu() IMPL_LINK_NOARG(TransparencyPropertyBox, implModifyHdl) { updateMenu(); - maModifyHdl.Call(mpMetric); + maModifyHdl.Call(mpMetric.get()); return 0; } @@ -552,7 +559,7 @@ IMPL_LINK( TransparencyPropertyBox, implMenuSelectHdl, MenuButton*, pPb ) void TransparencyPropertyBox::setValue( const Any& rValue, const OUString& ) { - if( mpMetric ) + if( mpMetric.get() ) { double fValue = 0.0; rValue >>= fValue; @@ -589,9 +596,9 @@ public: void updateMenu(); private: - DropdownMenuBox* mpControl; + VclPtr<DropdownMenuBox> mpControl; PopupMenu* mpMenu; - MetricField* mpMetric; + VclPtr<MetricField> mpMetric; Link maModifyHdl; }; @@ -599,14 +606,14 @@ RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* p : PropertySubControl( nControlType ) , maModifyHdl( rModifyHdl ) { - mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER); + mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) ); mpMetric->SetUnit( FUNIT_CUSTOM ); mpMetric->SetCustomUnitText( OUString( sal_Unicode(0xb0)) ); // degree sign mpMetric->SetMin( -10000 ); mpMetric->SetMax( 10000 ); mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_ROTATION_POPUP ) ); - mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu ); + mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu ); mpControl->SetMenuSelectHdl( LINK( this, RotationPropertyBox, implMenuSelectHdl )); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX ); @@ -619,7 +626,7 @@ RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* p RotationPropertyBox::~RotationPropertyBox() { - delete mpControl; + mpControl.disposeAndClear(); } void RotationPropertyBox::updateMenu() @@ -640,7 +647,7 @@ void RotationPropertyBox::updateMenu() IMPL_LINK_NOARG(RotationPropertyBox, implModifyHdl) { updateMenu(); - maModifyHdl.Call(mpMetric); + maModifyHdl.Call(mpMetric.get()); return 0; } @@ -677,7 +684,7 @@ IMPL_LINK( RotationPropertyBox, implMenuSelectHdl, MenuButton*, pPb ) void RotationPropertyBox::setValue( const Any& rValue, const OUString& ) { - if( mpMetric ) + if( mpMetric.get() ) { double fValue = 0.0; rValue >>= fValue; @@ -714,9 +721,9 @@ public: void updateMenu(); private: - DropdownMenuBox* mpControl; + VclPtr<DropdownMenuBox> mpControl; PopupMenu* mpMenu; - MetricField* mpMetric; + VclPtr<MetricField> mpMetric; Link maModifyHdl; int mnDirection; }; @@ -725,13 +732,13 @@ ScalePropertyBox::ScalePropertyBox( sal_Int32 nControlType, vcl::Window* pParent : PropertySubControl( nControlType ) , maModifyHdl( rModifyHdl ) { - mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER); + mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) ); mpMetric->SetUnit( FUNIT_PERCENT ); mpMetric->SetMin( 0 ); mpMetric->SetMax( 10000 ); mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_SCALE_POPUP ) ); - mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu ); + mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu ); mpControl->SetMenuSelectHdl( LINK( this, ScalePropertyBox, implMenuSelectHdl )); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX ); @@ -744,7 +751,7 @@ ScalePropertyBox::ScalePropertyBox( sal_Int32 nControlType, vcl::Window* pParent ScalePropertyBox::~ScalePropertyBox() { - delete mpControl; + mpControl.disposeAndClear(); } void ScalePropertyBox::updateMenu() @@ -764,7 +771,7 @@ void ScalePropertyBox::updateMenu() IMPL_LINK_NOARG(ScalePropertyBox, implModifyHdl) { updateMenu(); - maModifyHdl.Call(mpMetric); + maModifyHdl.Call(mpMetric.get()); return 0; } @@ -810,7 +817,7 @@ IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb ) void ScalePropertyBox::setValue( const Any& rValue, const OUString& ) { - if( mpMetric ) + if( mpMetric.get() ) { ValuePair aValues; rValue >>= aValues; @@ -876,9 +883,9 @@ public: void update(); private: - DropdownMenuBox* mpControl; + VclPtr<DropdownMenuBox> mpControl; PopupMenu* mpMenu; - Edit* mpEdit; + VclPtr<Edit> mpEdit; Link maModifyHdl; float mfFontWeight; @@ -890,11 +897,11 @@ FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window* : PropertySubControl( nControlType ) , maModifyHdl( rModifyHdl ) { - mpEdit = new Edit( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY); + mpEdit.set( VclPtr<Edit>::Create( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY) ); mpEdit->SetText( SD_RESSTR(STR_CUSTOMANIMATION_SAMPLE) ); mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSTYLE_POPUP ) ); - mpControl = new DropdownMenuBox( pParent, mpEdit, mpMenu ); + mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpEdit, mpMenu ); mpControl->SetMenuSelectHdl( LINK( this, FontStylePropertyBox, implMenuSelectHdl )); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX ); @@ -904,7 +911,7 @@ FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window* FontStylePropertyBox::~FontStylePropertyBox() { - delete mpControl; + mpControl.disposeAndClear(); } void FontStylePropertyBox::update() @@ -950,7 +957,7 @@ IMPL_LINK( FontStylePropertyBox, implMenuSelectHdl, MenuButton*, pPb ) } update(); - maModifyHdl.Call(mpEdit); + maModifyHdl.Call(mpEdit.get()); return 0; } @@ -986,6 +993,7 @@ class CustomAnimationEffectTabPage : public TabPage public: CustomAnimationEffectTabPage( vcl::Window* pParent, const STLPropertySet* pSet ); virtual ~CustomAnimationEffectTabPage(); + virtual void dispose() SAL_OVERRIDE; void update( STLPropertySet* pSet ); DECL_LINK( implSelectHdl, Control* ); @@ -1003,24 +1011,24 @@ private: bool mbHasText; const STLPropertySet* mpSet; - VclFrame* mpSettings; - FixedText* mpFTProperty1; - PropertyControl* mpLBProperty1; - VclHBox* mpPlaceholderBox; - CheckBox* mpCBSmoothStart; - CheckBox* mpCBSmoothEnd; - - FixedText* mpFTSound; - ListBox* mpLBSound; - PushButton* mpPBSoundPreview; - FixedText* mpFTAfterEffect; - ListBox* mpLBAfterEffect; - FixedText* mpFTDimColor; - ColorListBox* mpCLBDimColor; - FixedText* mpFTTextAnim; - ListBox* mpLBTextAnim; - MetricField* mpMFTextDelay; - FixedText* mpFTTextDelay; + VclPtr<VclFrame> mpSettings; + VclPtr<FixedText> mpFTProperty1; + VclPtr<PropertyControl> mpLBProperty1; + VclPtr<VclHBox> mpPlaceholderBox; + VclPtr<CheckBox> mpCBSmoothStart; + VclPtr<CheckBox> mpCBSmoothEnd; + + VclPtr<FixedText> mpFTSound; + VclPtr<ListBox> mpLBSound; + VclPtr<PushButton> mpPBSoundPreview; + VclPtr<FixedText> mpFTAfterEffect; + VclPtr<ListBox> mpLBAfterEffect; + VclPtr<FixedText> mpFTDimColor; + VclPtr<ColorListBox> mpCLBDimColor; + VclPtr<FixedText> mpFTTextAnim; + VclPtr<ListBox> mpLBTextAnim; + VclPtr<MetricField> mpMFTextDelay; + VclPtr<FixedText> mpFTTextDelay; ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer; }; @@ -1255,7 +1263,30 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent CustomAnimationEffectTabPage::~CustomAnimationEffectTabPage() { + disposeOnce(); +} + +void CustomAnimationEffectTabPage::dispose() +{ clearSoundListBox(); + mpSettings.clear(); + mpFTProperty1.clear(); + mpLBProperty1.clear(); + mpPlaceholderBox.clear(); + mpCBSmoothStart.clear(); + mpCBSmoothEnd.clear(); + mpFTSound.clear(); + mpLBSound.clear(); + mpPBSoundPreview.clear(); + mpFTAfterEffect.clear(); + mpLBAfterEffect.clear(); + mpFTDimColor.clear(); + mpCLBDimColor.clear(); + mpFTTextAnim.clear(); + mpLBTextAnim.clear(); + mpMFTextDelay.clear(); + mpFTTextDelay.clear(); + TabPage::dispose(); } void CustomAnimationEffectTabPage::updateControlStates() @@ -1517,9 +1548,9 @@ void CustomAnimationEffectTabPage::openSoundFileDialog() { OUString aStrWarning(SD_RESSTR(STR_WARNING_NOSOUNDFILE)); aStrWarning = aStrWarning.replaceFirst("%", aFile); - WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning ); - aWarningBox.SetModalInputMode (true); - bQuitLoop = aWarningBox.Execute() != RET_RETRY; + ScopedVclPtrInstance< WarningBox > aWarningBox( nullptr, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning ); + aWarningBox->SetModalInputMode (true); + bQuitLoop = aWarningBox->Execute() != RET_RETRY; bValidSoundFile=false; } @@ -1558,6 +1589,7 @@ class CustomAnimationDurationTabPage : public TabPage public: CustomAnimationDurationTabPage( vcl::Window* pParent, const STLPropertySet* pSet ); virtual ~CustomAnimationDurationTabPage(); + virtual void dispose() SAL_OVERRIDE; void update( STLPropertySet* pSet ); @@ -1566,18 +1598,18 @@ public: private: const STLPropertySet* mpSet; - FixedText* mpFTStart; - ListBox* mpLBStart; - FixedText* mpFTStartDelay; - MetricField* mpMFStartDelay; - FixedText* mpFTDuration; - ListBox* mpCBDuration; - FixedText* mpFTRepeat; - ListBox* mpCBRepeat; - CheckBox* mpCBXRewind; - RadioButton* mpRBClickSequence; - RadioButton* mpRBInteractive; - ListBox* mpLBTrigger; + VclPtr<FixedText> mpFTStart; + VclPtr<ListBox> mpLBStart; + VclPtr<FixedText> mpFTStartDelay; + VclPtr<MetricField> mpMFStartDelay; + VclPtr<FixedText> mpFTDuration; + VclPtr<ListBox> mpCBDuration; + VclPtr<FixedText> mpFTRepeat; + VclPtr<ListBox> mpCBRepeat; + VclPtr<CheckBox> mpCBXRewind; + VclPtr<RadioButton> mpRBClickSequence; + VclPtr<RadioButton> mpRBInteractive; + VclPtr<ListBox> mpLBTrigger; }; CustomAnimationDurationTabPage::CustomAnimationDurationTabPage(vcl::Window* pParent, const STLPropertySet* pSet) @@ -1755,6 +1787,24 @@ CustomAnimationDurationTabPage::CustomAnimationDurationTabPage(vcl::Window* pPar CustomAnimationDurationTabPage::~CustomAnimationDurationTabPage() { + disposeOnce(); +} + +void CustomAnimationDurationTabPage::dispose() +{ + mpFTStart.clear(); + mpLBStart.clear(); + mpFTStartDelay.clear(); + mpMFStartDelay.clear(); + mpFTDuration.clear(); + mpCBDuration.clear(); + mpFTRepeat.clear(); + mpCBRepeat.clear(); + mpCBXRewind.clear(); + mpRBClickSequence.clear(); + mpRBInteractive.clear(); + mpLBTrigger.clear(); + TabPage::dispose(); } IMPL_LINK( CustomAnimationDurationTabPage, implControlHdl, Control*, pControl ) @@ -1924,6 +1974,8 @@ class CustomAnimationTextAnimTabPage : public TabPage { public: CustomAnimationTextAnimTabPage( vcl::Window* pParent, const STLPropertySet* pSet ); + virtual ~CustomAnimationTextAnimTabPage(); + virtual void dispose() SAL_OVERRIDE; void update( STLPropertySet* pSet ); @@ -1931,12 +1983,12 @@ public: DECL_LINK(implSelectHdl, void *); private: - FixedText* maFTGroupText; - ListBox* maLBGroupText; - CheckBox* maCBXGroupAuto; - MetricField* maMFGroupAuto; - CheckBox* maCBXAnimateForm; - CheckBox* maCBXReverse; + VclPtr<FixedText> maFTGroupText; + VclPtr<ListBox> maLBGroupText; + VclPtr<CheckBox> maCBXGroupAuto; + VclPtr<MetricField> maMFGroupAuto; + VclPtr<CheckBox> maCBXAnimateForm; + VclPtr<CheckBox> maCBXReverse; const STLPropertySet* mpSet; @@ -2023,6 +2075,22 @@ CustomAnimationTextAnimTabPage::CustomAnimationTextAnimTabPage(vcl::Window* pPar updateControlStates(); } +CustomAnimationTextAnimTabPage::~CustomAnimationTextAnimTabPage() +{ + disposeOnce(); +} + +void CustomAnimationTextAnimTabPage::dispose() +{ + maFTGroupText.clear(); + maLBGroupText.clear(); + maCBXGroupAuto.clear(); + maMFGroupAuto.clear(); + maCBXAnimateForm.clear(); + maCBXReverse.clear(); + TabPage::dispose(); +} + void CustomAnimationTextAnimTabPage::update( STLPropertySet* pSet ) { sal_Int32 nPos = maLBGroupText->GetSelectEntryPos(); @@ -2113,9 +2181,9 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe sal_uInt16 mnTimingId = mpTabControl->GetPageId("timing"); sal_uInt16 mnTextAnimId = mpTabControl->GetPageId("textanim"); - mpEffectTabPage = new CustomAnimationEffectTabPage( mpTabControl, mpSet ); + mpEffectTabPage = VclPtr<CustomAnimationEffectTabPage>::Create( mpTabControl, mpSet ); mpTabControl->SetTabPage( mnEffectId, mpEffectTabPage ); - mpDurationTabPage = new CustomAnimationDurationTabPage( mpTabControl, mpSet ); + mpDurationTabPage = VclPtr<CustomAnimationDurationTabPage>::Create( mpTabControl, mpSet ); mpTabControl->SetTabPage( mnTimingId, mpDurationTabPage ); bool bHasText = false; @@ -2124,7 +2192,7 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe if( bHasText ) { - mpTextAnimTabPage = new CustomAnimationTextAnimTabPage( mpTabControl, mpSet ); + mpTextAnimTabPage = VclPtr<CustomAnimationTextAnimTabPage>::Create( mpTabControl, mpSet ); mpTabControl->SetTabPage( mnTextAnimId, mpTextAnimTabPage ); } else @@ -2139,12 +2207,20 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe CustomAnimationDialog::~CustomAnimationDialog() { - delete mpEffectTabPage; - delete mpDurationTabPage; - delete mpTextAnimTabPage; + disposeOnce(); +} + +void CustomAnimationDialog::dispose() +{ + mpEffectTabPage.disposeAndClear(); + mpDurationTabPage.disposeAndClear(); + mpTextAnimTabPage.disposeAndClear(); delete mpSet; delete mpResultSet; + + mpTabControl.clear(); + TabDialog::dispose(); } STLPropertySet* CustomAnimationDialog::getResultSet() @@ -2222,8 +2298,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makePropertyControl( vcl:: PropertyControl::~PropertyControl() { + disposeOnce(); +} + +void PropertyControl::dispose() +{ if( mpSubControl ) delete mpSubControl; + ListBox::dispose(); } void PropertyControl::setSubControl( PropertySubControl* pSubControl ) diff --git a/sd/source/ui/animations/CustomAnimationDialog.hxx b/sd/source/ui/animations/CustomAnimationDialog.hxx index 2fcdc742073a..3754d93ffdbf 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.hxx +++ b/sd/source/ui/animations/CustomAnimationDialog.hxx @@ -123,6 +123,7 @@ class PropertyControl : public ListBox public: PropertyControl( vcl::Window* pParent ); virtual ~PropertyControl(); + virtual void dispose() SAL_OVERRIDE; void setSubControl( PropertySubControl* pSubControl ); PropertySubControl* getSubControl() const { return mpSubControl; } @@ -143,6 +144,7 @@ class CustomAnimationDialog : public TabDialog public: CustomAnimationDialog(vcl::Window* pParent, STLPropertySet* pSet, const OString& Page = OString()); virtual ~CustomAnimationDialog(); + virtual void dispose() SAL_OVERRIDE; STLPropertySet* getDefaultSet() { return mpSet; } STLPropertySet* getResultSet(); @@ -154,11 +156,11 @@ private: STLPropertySet* mpResultSet; CustomAnimationEffectPtr mpEffect; - TabControl* mpTabControl; + VclPtr<TabControl> mpTabControl; - CustomAnimationDurationTabPage* mpDurationTabPage; - CustomAnimationEffectTabPage* mpEffectTabPage; - CustomAnimationTextAnimTabPage* mpTextAnimTabPage; + VclPtr<CustomAnimationDurationTabPage> mpDurationTabPage; + VclPtr<CustomAnimationEffectTabPage> mpEffectTabPage; + VclPtr<CustomAnimationTextAnimTabPage> mpTextAnimTabPage; }; } diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index c7f62dad3a59..dd4441aeebfb 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -210,7 +210,7 @@ public: virtual void Paint( const Point&, SvTreeListBox& rDev, const SvViewDataEntry* pView,const SvTreeListEntry* pEntry) SAL_OVERRIDE; private: - CustomAnimationList* mpParent; + VclPtr<CustomAnimationList> mpParent; OUString maDescription; CustomAnimationEffectPtr mpEffect; }; @@ -444,10 +444,16 @@ const Image& CustomAnimationList::getImage( sal_uInt16 nId ) CustomAnimationList::~CustomAnimationList() { + disposeOnce(); +} + +void CustomAnimationList::dispose() +{ if( mpMainSequence.get() ) mpMainSequence->removeListener( this ); clear(); + SvTreeListBox::dispose(); } void CustomAnimationList::KeyInput( const KeyEvent& rKEvt ) diff --git a/sd/source/ui/animations/CustomAnimationList.hxx b/sd/source/ui/animations/CustomAnimationList.hxx index 66301bb6f830..18fde3c2db14 100644 --- a/sd/source/ui/animations/CustomAnimationList.hxx +++ b/sd/source/ui/animations/CustomAnimationList.hxx @@ -48,6 +48,7 @@ class CustomAnimationList : public SvTreeListBox, public ISequenceListener public: CustomAnimationList( vcl::Window* pParent ); virtual ~CustomAnimationList(); + virtual void dispose() SAL_OVERRIDE; // methods diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 6e36b0b64d84..431c75b661f5 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -225,6 +225,11 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase, CustomAnimationPane::~CustomAnimationPane() { + disposeOnce(); +} + +void CustomAnimationPane::dispose() +{ maLateInitTimer.Stop(); removeListener(); @@ -235,6 +240,24 @@ CustomAnimationPane::~CustomAnimationPane() for( aIter = aTags.begin(); aIter != aTags.end(); ++aIter ) (*aIter)->Dispose(); + mpPBAddEffect.clear(); + mpPBChangeEffect.clear(); + mpPBRemoveEffect.clear(); + mpFTEffect.clear(); + mpFTStart.clear(); + mpLBStart.clear(); + mpFTProperty.clear(); + mpPlaceholderBox.clear(); + mpLBProperty.clear(); + mpPBPropertyMore.clear(); + mpFTSpeed.clear(); + mpCBSpeed.clear(); + mpCustomAnimationList.clear(); + mpPBMoveUp.clear(); + mpPBMoveDown.clear(); + mpPBPlay.clear(); + mpCBAutoPreview.clear(); + PanelLayout::dispose(); } void CustomAnimationPane::addUndo() @@ -809,11 +832,11 @@ void CustomAnimationPane::UpdateLook() ::sfx2::sidebar::Theme::GetWallpaper( ::sfx2::sidebar::Theme::Paint_PanelBackground)); SetBackground(aBackground); - if (mpFTStart != NULL) + if (mpFTStart != nullptr) mpFTStart->SetBackground(aBackground); - if (mpFTProperty != NULL) + if (mpFTProperty != nullptr) mpFTProperty->SetBackground(aBackground); - if (mpFTSpeed != NULL) + if (mpFTSpeed != nullptr) mpFTSpeed->SetBackground(aBackground); } @@ -1550,7 +1573,7 @@ void CustomAnimationPane::showOptions(const OString& sPage) { STLPropertySet* pSet = createSelectionSet(); - boost::scoped_ptr<CustomAnimationDialog> pDlg(new CustomAnimationDialog(this, pSet, sPage)); + VclPtrInstance< CustomAnimationDialog > pDlg(this, pSet, sPage); if( pDlg->Execute() ) { addUndo(); @@ -1729,7 +1752,7 @@ void CustomAnimationPane::onChange( bool bCreate ) } } - boost::scoped_ptr<CustomAnimationCreateDialog> pDlg(new CustomAnimationCreateDialog( this, this, aTargets, bHasText, sPresetId, fDuration )); + VclPtrInstance< CustomAnimationCreateDialog > pDlg( this, this, aTargets, bHasText, sPresetId, fDuration ); if( pDlg->Execute() ) { addUndo(); @@ -2263,7 +2286,7 @@ void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< Mot if( pDocSh ) { const Size aMinSize( pParent->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) ); - pWindow = new CustomAnimationPane( pParent, rBase, rxFrame, aMinSize ); + pWindow = VclPtr<CustomAnimationPane>::Create( pParent, rBase, rxFrame, aMinSize ); } return pWindow; diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx index 57d10c613611..0fd6f19a6595 100644 --- a/sd/source/ui/animations/CustomAnimationPane.hxx +++ b/sd/source/ui/animations/CustomAnimationPane.hxx @@ -64,6 +64,7 @@ class CustomAnimationPane : public PanelLayout, public ICustomAnimationListContr public: CustomAnimationPane( vcl::Window* pParent, ViewShellBase& rBase, const css::uno::Reference<css::frame::XFrame>& rxFrame, const Size& rMinSize ); virtual ~CustomAnimationPane(); + virtual void dispose() SAL_OVERRIDE; // callbacks void onSelectionChanged(); @@ -125,23 +126,23 @@ private: const CustomAnimationPresets* mpCustomAnimationPresets; - PushButton* mpPBAddEffect; - PushButton* mpPBChangeEffect; - PushButton* mpPBRemoveEffect; - FixedText* mpFTEffect; - FixedText* mpFTStart; - ListBox* mpLBStart; - FixedText* mpFTProperty; - VclHBox* mpPlaceholderBox; - PropertyControl* mpLBProperty; - PushButton* mpPBPropertyMore; - FixedText* mpFTSpeed; - ListBox* mpCBSpeed; - CustomAnimationList* mpCustomAnimationList; - PushButton* mpPBMoveUp; - PushButton* mpPBMoveDown; - PushButton* mpPBPlay; - CheckBox* mpCBAutoPreview; + VclPtr<PushButton> mpPBAddEffect; + VclPtr<PushButton> mpPBChangeEffect; + VclPtr<PushButton> mpPBRemoveEffect; + VclPtr<FixedText> mpFTEffect; + VclPtr<FixedText> mpFTStart; + VclPtr<ListBox> mpLBStart; + VclPtr<FixedText> mpFTProperty; + VclPtr<VclHBox> mpPlaceholderBox; + VclPtr<PropertyControl> mpLBProperty; + VclPtr<PushButton> mpPBPropertyMore; + VclPtr<FixedText> mpFTSpeed; + VclPtr<ListBox> mpCBSpeed; + VclPtr<CustomAnimationList> mpCustomAnimationList; + VclPtr<PushButton> mpPBMoveUp; + VclPtr<PushButton> mpPBMoveDown; + VclPtr<PushButton> mpPBPlay; + VclPtr<CheckBox> mpCBAutoPreview; OUString maStrModify; OUString maStrProperty; diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index 56bf1437dcb3..917a53e03b77 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -386,7 +386,7 @@ struct lcl_AppendSoundToListBox : public ::std::unary_function< OUString, void > } private: - ListBox* mrListBox; + VclPtr<ListBox> mrListBox; }; void lcl_FillSoundListBox( @@ -483,8 +483,27 @@ SlideTransitionPane::SlideTransitionPane( SlideTransitionPane::~SlideTransitionPane() { + disposeOnce(); +} + +void SlideTransitionPane::dispose() +{ maLateInitTimer.Stop(); removeListener(); + mpLB_SLIDE_TRANSITIONS.clear(); + mpFT_SPEED.clear(); + mpLB_SPEED.clear(); + mpFT_SOUND.clear(); + mpLB_SOUND.clear(); + mpCB_LOOP_SOUND.clear(); + mpRB_ADVANCE_ON_MOUSE.clear(); + mpRB_ADVANCE_AUTO.clear(); + mpMF_ADVANCE_AUTO_AFTER.clear(); + mpPB_APPLY_TO_ALL.clear(); + mpPB_PLAY.clear(); + mpPB_SLIDE_SHOW.clear(); + mpCB_AUTO_PREVIEW.clear(); + PanelLayout::dispose(); } void SlideTransitionPane::DataChanged (const DataChangedEvent& rEvent) @@ -724,9 +743,9 @@ void SlideTransitionPane::openSoundFileDialog() { OUString aStrWarning(SD_RESSTR(STR_WARNING_NOSOUNDFILE)); aStrWarning = aStrWarning.replaceFirst("%", aFile); - WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning ); - aWarningBox.SetModalInputMode (true); - bQuitLoop = (aWarningBox.Execute() != RET_RETRY); + ScopedVclPtrInstance< WarningBox > aWarningBox( nullptr, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning ); + aWarningBox->SetModalInputMode (true); + bQuitLoop = (aWarningBox->Execute() != RET_RETRY); bValidSoundFile = false; } @@ -1082,7 +1101,7 @@ IMPL_LINK_NOARG(SlideTransitionPane, LateInitCallback) if( pDocSh ) { Size aMinSize( pParent->LogicToPixel( Size( 72, 216 ), MAP_APPFONT ) ); - pWindow = new SlideTransitionPane( pParent, rBase, aMinSize, pDocSh->GetDoc(), rxFrame ); + pWindow = VclPtr<SlideTransitionPane>::Create( pParent, rBase, aMinSize, pDocSh->GetDoc(), rxFrame ); } return pWindow; diff --git a/sd/source/ui/animations/SlideTransitionPane.hxx b/sd/source/ui/animations/SlideTransitionPane.hxx index 3bb556d74112..63e76e3d1242 100644 --- a/sd/source/ui/animations/SlideTransitionPane.hxx +++ b/sd/source/ui/animations/SlideTransitionPane.hxx @@ -58,6 +58,7 @@ public: SdDrawDocument* pDoc, const css::uno::Reference<css::frame::XFrame>& rxFrame ); virtual ~SlideTransitionPane(); + virtual void dispose() SAL_OVERRIDE; // Window virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE; @@ -104,19 +105,19 @@ private: SdDrawDocument * mpDrawDoc; Size maMinSize; - ListBox* mpLB_SLIDE_TRANSITIONS; - FixedText* mpFT_SPEED; - ListBox* mpLB_SPEED; - FixedText* mpFT_SOUND; - ListBox* mpLB_SOUND; - CheckBox* mpCB_LOOP_SOUND; - RadioButton* mpRB_ADVANCE_ON_MOUSE; - RadioButton* mpRB_ADVANCE_AUTO; - MetricField* mpMF_ADVANCE_AUTO_AFTER; - PushButton* mpPB_APPLY_TO_ALL; - PushButton* mpPB_PLAY; - PushButton* mpPB_SLIDE_SHOW; - CheckBox* mpCB_AUTO_PREVIEW; + VclPtr<ListBox> mpLB_SLIDE_TRANSITIONS; + VclPtr<FixedText> mpFT_SPEED; + VclPtr<ListBox> mpLB_SPEED; + VclPtr<FixedText> mpFT_SOUND; + VclPtr<ListBox> mpLB_SOUND; + VclPtr<CheckBox> mpCB_LOOP_SOUND; + VclPtr<RadioButton> mpRB_ADVANCE_ON_MOUSE; + VclPtr<RadioButton> mpRB_ADVANCE_AUTO; + VclPtr<MetricField> mpMF_ADVANCE_AUTO_AFTER; + VclPtr<PushButton> mpPB_APPLY_TO_ALL; + VclPtr<PushButton> mpPB_PLAY; + VclPtr<PushButton> mpPB_SLIDE_SHOW; + VclPtr<CheckBox> mpCB_AUTO_PREVIEW; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index b856cb1e0b89..21614cd73662 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -694,10 +694,9 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward) // Pop up question box that asks the user whether to wrap around. // The dialog is made modal with respect to the whole application. - QueryBox aQuestionBox ( NULL, (WB_YES_NO | WB_DEF_YES), SD_RESSTR(nStringId)); - aQuestionBox.SetImage (QueryBox::GetStandardImage()); - short nBoxResult = aQuestionBox.Execute(); - if (nBoxResult != RET_YES) + ScopedVclPtrInstance< QueryBox > aQuestionBox( nullptr, (WB_YES_NO | WB_DEF_YES), SD_RESSTR(nStringId)); + aQuestionBox->SetImage( QueryBox::GetStandardImage() ); + if (aQuestionBox->Execute() != RET_YES) break; } while( true ); diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 610ed613588f..ae9dc833b3fe 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -515,19 +515,19 @@ void AnnotationTag::deselect() BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected ) { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; OUString sAuthor( getInitials( mxAnnotation->getAuthor() ) ); sAuthor += OUString( ' ' ); sAuthor += OUString::number( mnIndex ); - aVDev.SetFont( mrFont ); + pVDev->SetFont( mrFont ); const int BORDER_X = 4; // pixels const int BORDER_Y = 4; // pixels - maSize = Size( aVDev.GetTextWidth( sAuthor ) + 2*BORDER_X, aVDev.GetTextHeight() + 2*BORDER_Y ); - aVDev.SetOutputSizePixel( maSize, false ); + maSize = Size( pVDev->GetTextWidth( sAuthor ) + 2*BORDER_X, pVDev->GetTextHeight() + 2*BORDER_Y ); + pVDev->SetOutputSizePixel( maSize, false ); Color aBorderColor( maColor ); @@ -549,14 +549,14 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected ) Point aPos; Rectangle aBorderRect( aPos, maSize ); - aVDev.SetLineColor(aBorderColor); - aVDev.SetFillColor(maColor); - aVDev.DrawRect( aBorderRect ); + pVDev->SetLineColor(aBorderColor); + pVDev->SetFillColor(maColor); + pVDev->DrawRect( aBorderRect ); - aVDev.SetTextColor( maColor.IsDark() ? COL_WHITE : COL_BLACK ); - aVDev.DrawText( Point( BORDER_X, BORDER_Y ), sAuthor ); + pVDev->SetTextColor( maColor.IsDark() ? COL_WHITE : COL_BLACK ); + pVDev->DrawText( Point( BORDER_X, BORDER_Y ), sAuthor ); - return aVDev.GetBitmapEx( aPos, maSize ); + return pVDev->GetBitmapEx( aPos, maSize ); } void AnnotationTag::OpenPopup( bool bEdit ) @@ -577,7 +577,7 @@ void AnnotationTag::OpenPopup( bool bEdit ) Rectangle aRect( aPos, maSize ); - mpAnnotationWindow.reset( new AnnotationWindow( mrManager, mrView.GetDocSh(), pWindow->GetWindow(WINDOW_FRAME) ) ); + mpAnnotationWindow.reset( VclPtr<AnnotationWindow>::Create( mrManager, mrView.GetDocSh(), pWindow->GetWindow(WINDOW_FRAME) ) ); mpAnnotationWindow->InitControls(); mpAnnotationWindow->setAnnotation(mxAnnotation); diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx index 96085f253fcb..d53c5445f4d7 100644 --- a/sd/source/ui/annotations/annotationtag.hxx +++ b/sd/source/ui/annotations/annotationtag.hxx @@ -79,13 +79,13 @@ protected: private: AnnotationManagerImpl& mrManager; css::uno::Reference< css::office::XAnnotation > mxAnnotation; - std::unique_ptr<AnnotationWindow> mpAnnotationWindow; + VclPtr<AnnotationWindow> mpAnnotationWindow; Color maColor; int mnIndex; const ::vcl::Font& mrFont; Size maSize; ImplSVEvent * mnClosePopupEvent; - vcl::Window* mpListenWindow; + VclPtr<vcl::Window> mpListenWindow; Point maMouseDownPos; }; diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index 9129ca8f952b..830180347e13 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -118,6 +118,13 @@ AnnotationTextWindow::AnnotationTextWindow( AnnotationWindow* pParent, WinBits n AnnotationTextWindow::~AnnotationTextWindow() { + disposeOnce(); +} + +void AnnotationTextWindow::dispose() +{ + mpAnnotationWindow.clear(); + Control::dispose(); } void AnnotationTextWindow::Paint( const Rectangle& rRect) @@ -284,21 +291,27 @@ AnnotationWindow::AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShel AnnotationWindow::~AnnotationWindow() { - delete mpMeta; + disposeOnce(); +} + +void AnnotationWindow::dispose() +{ + mpMeta.disposeAndClear(); delete mpOutlinerView; delete mpOutliner; - delete mpVScrollbar; - delete mpTextWindow; + mpVScrollbar.disposeAndClear(); + mpTextWindow.disposeAndClear(); + FloatingWindow::dispose(); } void AnnotationWindow::InitControls() { // actual window which holds the user text - mpTextWindow = new AnnotationTextWindow(this, WB_NODIALOGCONTROL); + mpTextWindow = VclPtr<AnnotationTextWindow>::Create(this, WB_NODIALOGCONTROL); mpTextWindow->SetPointer(Pointer(POINTER_TEXT)); // window control for author and date - mpMeta = new MultiLineEdit(this,0); + mpMeta = VclPtr<MultiLineEdit>::Create(this,0); mpMeta->SetReadOnly(); mpMeta->SetRightToLeft(AllSettings::GetLayoutRTL()); mpMeta->AlwaysDisableInput(true); @@ -332,7 +345,7 @@ void AnnotationWindow::InitControls() mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) ); //create Scrollbars - mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); + mpVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); mpVScrollbar->EnableNativeWidget(false); mpVScrollbar->EnableRTL( false ); mpVScrollbar->SetScrollHdl(LINK(this, AnnotationWindow, ScrollHdl)); diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx index f8adcdf99a81..766ea975b31f 100644 --- a/sd/source/ui/annotations/annotationwindow.hxx +++ b/sd/source/ui/annotations/annotationwindow.hxx @@ -50,7 +50,7 @@ class AnnotationTextWindow : public Control { private: OutlinerView* mpOutlinerView; - AnnotationWindow* mpAnnotationWindow; + VclPtr<AnnotationWindow> mpAnnotationWindow; protected: virtual void Paint( const Rectangle& rRect) SAL_OVERRIDE; @@ -64,6 +64,7 @@ protected: public: AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits ); virtual ~AnnotationTextWindow(); + virtual void dispose() SAL_OVERRIDE; void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; } @@ -83,13 +84,13 @@ class AnnotationWindow : public FloatingWindow OutlinerView* mpOutlinerView; Outliner* mpOutliner; - ScrollBar* mpVScrollbar; + VclPtr<ScrollBar> mpVScrollbar; ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation; bool mbReadonly; bool mbProtected; bool mbMouseOverButton; - AnnotationTextWindow* mpTextWindow; - MultiLineEdit* mpMeta; + VclPtr<AnnotationTextWindow> mpTextWindow; + VclPtr<MultiLineEdit> mpMeta; Rectangle maRectMetaButton; basegfx::B2DPolygon maPopupTriangle; @@ -102,6 +103,7 @@ class AnnotationWindow : public FloatingWindow public: AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, vcl::Window* pParent ); virtual ~AnnotationWindow(); + virtual void dispose() SAL_OVERRIDE; void StartEdit(); diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index b982264de845..5c3b2dde6ecd 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -119,7 +119,7 @@ SdModule::~SdModule() (*ppShellPointer) = NULL; delete mpErrorHdl; - delete static_cast< VirtualDevice* >( mpVirtualRefDevice ); + mpVirtualRefDevice.disposeAndClear(); } /// get notifications diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 5d36c8f6b7dd..9e8ea11ddae4 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -727,9 +727,9 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) pViewShell->GetViewFrame()->GetBindings().InvalidateAll( true ); } -SfxTabPage* SdModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) +VclPtr<SfxTabPage> SdModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) { - SfxTabPage* pRet = NULL; + VclPtr<SfxTabPage> pRet; SfxAllItemSet aSet(*(rSet.GetPool())); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); if( pFact ) diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 283544f8aa99..ed424d464275 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -141,7 +141,7 @@ SdTransferable::~SdTransferable() delete mpBookmark; delete mpImageMap; - delete mpVDev; + mpVDev.disposeAndClear(); delete mpObjDesc; //call explicitly at end of dtor to be covered by above SolarMutex @@ -262,7 +262,7 @@ void SdTransferable::CreateData() if( 1 == pPage->GetObjCount() ) CreateObjectReplacement( pPage->GetObj( 0 ) ); - mpVDev = new VirtualDevice( *Application::GetDefaultDevice() ); + mpVDev = VclPtr<VirtualDevice>::Create( *Application::GetDefaultDevice() ); mpVDev->SetMapMode( MapMode( mpSdDrawDocumentIntern->GetScaleUnit(), Point(), mpSdDrawDocumentIntern->GetScaleFraction(), mpSdDrawDocumentIntern->GetScaleFraction() ) ); mpSdViewIntern = new ::sd::View( *mpSdDrawDocumentIntern, mpVDev ); mpSdViewIntern->EndListening(*mpSdDrawDocumentIntern ); diff --git a/sd/source/ui/app/tbxww.cxx b/sd/source/ui/app/tbxww.cxx index cbf40156aa4b..2aed6b89c96e 100644 --- a/sd/source/ui/app/tbxww.cxx +++ b/sd/source/ui/app/tbxww.cxx @@ -62,7 +62,7 @@ SfxPopupWindowType SdTbxControl::GetPopupWindowType() const * rItemRect are screen coordinates */ -SfxPopupWindow* SdTbxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SdTbxControl::CreatePopupWindow() { SfxPopupWindow *pWin = NULL; OUString aToolBarResStr; diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index 7c8d02a46819..468428081523 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -67,6 +67,7 @@ class LayoutToolbarMenu : public svtools::ToolbarMenu public: LayoutToolbarMenu( SlideLayoutController& rController, const Reference< XFrame >& xFrame, vcl::Window* pParent, const bool bInsertPage ); virtual ~LayoutToolbarMenu(); + virtual void dispose() SAL_OVERRIDE; protected: DECL_LINK( SelectHdl, void * ); @@ -75,8 +76,8 @@ private: SlideLayoutController& mrController; Reference< XFrame > mxFrame; bool mbInsertPage; - ValueSet* mpLayoutSet1; - ValueSet* mpLayoutSet2; + VclPtr<ValueSet> mpLayoutSet1; + VclPtr<ValueSet> mpLayoutSet2; }; struct snewfoil_value_info @@ -210,7 +211,7 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, const if( bVerticalEnabled && (eMode == DrawViewMode_DRAW) ) { - mpLayoutSet2 = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + mpLayoutSet2 = VclPtr<ValueSet>::Create( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); mpLayoutSet2->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) ); mpLayoutSet2->SetColCount( 4 ); @@ -256,6 +257,14 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, const LayoutToolbarMenu::~LayoutToolbarMenu() { + disposeOnce(); +} + +void LayoutToolbarMenu::dispose() +{ + mpLayoutSet1.clear(); + mpLayoutSet2.clear(); + svtools::ToolbarMenu::dispose(); } IMPL_LINK( LayoutToolbarMenu, SelectHdl, void *, pControl ) @@ -342,9 +351,9 @@ void SAL_CALL SlideLayoutController::initialize( const css::uno::Sequence< css:: } } -::vcl::Window* SlideLayoutController::createPopupWindow( ::vcl::Window* pParent ) +VclPtr<::vcl::Window> SlideLayoutController::createPopupWindow( ::vcl::Window* pParent ) { - return new sd::LayoutToolbarMenu( *this, m_xFrame, pParent, mbInsertPage ); + return VclPtr<sd::LayoutToolbarMenu>::Create( *this, m_xFrame, pParent, mbInsertPage ); } // XServiceInfo diff --git a/sd/source/ui/controller/slidelayoutcontroller.hxx b/sd/source/ui/controller/slidelayoutcontroller.hxx index 0104119dc45d..d97656cef5dc 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.hxx +++ b/sd/source/ui/controller/slidelayoutcontroller.hxx @@ -32,7 +32,7 @@ public: const OUString& sCommandURL, bool bInsertPage ); - virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) diff --git a/sd/source/ui/dlg/AnimationChildWindow.cxx b/sd/source/ui/dlg/AnimationChildWindow.cxx index 7e7ec61574db..d59f0ac2a083 100644 --- a/sd/source/ui/dlg/AnimationChildWindow.cxx +++ b/sd/source/ui/dlg/AnimationChildWindow.cxx @@ -39,7 +39,7 @@ AnimationChildWindow::AnimationChildWindow( SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { - AnimationWindow* pAnimWin = new AnimationWindow(pBindings, this, _pParent); + VclPtr<AnimationWindow> pAnimWin = VclPtr<AnimationWindow>::Create(pBindings, this, _pParent); pWindow = pAnimWin; eChildAlignment = SfxChildAlignment::NOALIGNMENT; diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx index cfc97fd3a543..934c5bbf89f9 100644 --- a/sd/source/ui/dlg/LayerTabBar.cxx +++ b/sd/source/ui/dlg/LayerTabBar.cxx @@ -203,9 +203,9 @@ TabBarAllowRenamingReturnCode LayerTabBar::AllowRenaming() (rLayerAdmin.GetLayer( aNewName, false ) && aLayerName != aNewName) ) { // Name already exists - WarningBox aWarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ), + ScopedVclPtrInstance<WarningBox> aWarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ), SD_RESSTR( STR_WARN_NAME_DUPLICATE ) ); - aWarningBox.Execute(); + aWarningBox->Execute(); bOK = false; } diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx index 480a5f74e0e7..0beb6d1f38e0 100644 --- a/sd/source/ui/dlg/NavigatorChildWindow.cxx +++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx @@ -52,7 +52,8 @@ NavigatorChildWindow::NavigatorChildWindow ( SfxChildWinInfo* ) : SfxChildWindowContext( nId ) { - SdNavigatorWin* pNavWin = new SdNavigatorWin( + VclPtr<SdNavigatorWin> pNavWin = VclPtr<SdNavigatorWin>::Create( + pParent, this, SdResId( FLT_NAVIGATOR ), diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index 364a4dc47b4b..b004e766131a 100644 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -56,13 +56,14 @@ PaneChildWindow::PaneChildWindow ( SfxChildAlignment eAlignment) : SfxChildWindow (pParentWindow, nId) { - pWindow = new PaneDockingWindow( + pWindow = VclPtr<PaneDockingWindow>::Create( + pBindings, this, pParentWindow, SD_RESSTR(nTitleBarResId)); eChildAlignment = eAlignment; - static_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo); + static_cast<SfxDockingWindow*>(pWindow.get())->Initialize(pInfo); SetHideNotDelete(true); ViewShellBase* pBase = ViewShellBase::GetViewShellBase(pBindings->GetDispatcher()->GetFrame()); @@ -75,7 +76,7 @@ PaneChildWindow::PaneChildWindow ( PaneChildWindow::~PaneChildWindow() { ViewShellBase* pBase = NULL; - PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow); + PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow.get()); if (pDockingWindow != NULL) pBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame()); diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index a3da722b97e5..ecf89cf9054f 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -76,6 +76,23 @@ SdPhotoAlbumDialog::SdPhotoAlbumDialog(vcl::Window* pWindow, SdDrawDocument* pAc SdPhotoAlbumDialog::~SdPhotoAlbumDialog() { + disposeOnce(); +} + +void SdPhotoAlbumDialog::dispose() +{ + pCancelBtn.clear(); + pCreateBtn.clear(); + pAddBtn.clear(); + pUpBtn.clear(); + pDownBtn.clear(); + pRemoveBtn.clear(); + pImagesLst.clear(); + pImg.clear(); + pInsTypeCombo.clear(); + pASRCheck.clear(); + pCapCheck.clear(); + ModalDialog::dispose(); } IMPL_LINK_NOARG(SdPhotoAlbumDialog, CancelHdl) @@ -88,8 +105,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) { if (pImagesLst->GetEntryCount() == 0) { - WarningBox aWarning(this, WB_OK, SD_RESSTR(STR_PHOTO_ALBUM_EMPTY_WARNING)); - aWarning.Execute(); + ScopedVclPtrInstance< WarningBox > aWarning(this, WB_OK, SD_RESSTR(STR_PHOTO_ALBUM_EMPTY_WARNING)); + aWarning->Execute(); } else { @@ -445,8 +462,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) } else { - InfoBox aInfo(this, OUString("Function is not implemented!")); - aInfo.Execute(); + ScopedVclPtrInstance< InfoBox > aInfo(this, OUString("Function is not implemented!")); + aInfo->Execute(); } EndDialog(); return 0; diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.hxx b/sd/source/ui/dlg/PhotoAlbumDialog.hxx index c7d12e47bcc8..44b1f5c97a1e 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.hxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.hxx @@ -46,25 +46,27 @@ class SdPhotoAlbumDialog : public ModalDialog public: SdPhotoAlbumDialog(vcl::Window* pWindow, SdDrawDocument* pActDoc); virtual ~SdPhotoAlbumDialog(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; private: static OUString sDirUrl; - CancelButton* pCancelBtn; - PushButton* pCreateBtn; + VclPtr<CancelButton> pCancelBtn; + VclPtr<PushButton> pCreateBtn; - PushButton* pAddBtn; - PushButton* pUpBtn; - PushButton* pDownBtn; - PushButton* pRemoveBtn; + VclPtr<PushButton> pAddBtn; + VclPtr<PushButton> pUpBtn; + VclPtr<PushButton> pDownBtn; + VclPtr<PushButton> pRemoveBtn; - ListBox* pImagesLst; - FixedImage* pImg; + VclPtr<ListBox> pImagesLst; + VclPtr<FixedImage> pImg; + + VclPtr<ListBox> pInsTypeCombo; + VclPtr<CheckBox> pASRCheck; + VclPtr<CheckBox> pCapCheck; - ListBox* pInsTypeCombo; - CheckBox* pASRCheck; - CheckBox* pCapCheck; SdDrawDocument* pDoc; GraphicFilter* mpGraphicFilter; diff --git a/sd/source/ui/dlg/RemoteDialog.cxx b/sd/source/ui/dlg/RemoteDialog.cxx index f9cd67cb8dad..62c9d3eaffe7 100644 --- a/sd/source/ui/dlg/RemoteDialog.cxx +++ b/sd/source/ui/dlg/RemoteDialog.cxx @@ -30,6 +30,19 @@ RemoteDialog::RemoteDialog( vcl::Window *pWindow ) m_pButtonClose->SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) ); } +RemoteDialog::~RemoteDialog() +{ + disposeOnce(); +} + +void RemoteDialog::dispose() +{ + m_pButtonConnect.clear(); + m_pButtonClose.clear(); + m_pClientBox.clear(); + ModalDialog::dispose(); +} + IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton) { // setBusy( true ); diff --git a/sd/source/ui/dlg/RemoteDialog.hxx b/sd/source/ui/dlg/RemoteDialog.hxx index 7334c4bea548..3c936eb10a1a 100644 --- a/sd/source/ui/dlg/RemoteDialog.hxx +++ b/sd/source/ui/dlg/RemoteDialog.hxx @@ -24,14 +24,16 @@ namespace sd class RemoteDialog : public ModalDialog { private: - PushButton* m_pButtonConnect; - CloseButton* m_pButtonClose; - ClientBox* m_pClientBox; + VclPtr<PushButton> m_pButtonConnect; + VclPtr<CloseButton> m_pButtonClose; + VclPtr<ClientBox> m_pClientBox; DECL_DLLPRIVATE_LINK( HandleConnectButton, void * ); DECL_LINK( CloseHdl, void * ); public: RemoteDialog( vcl::Window* pWindow ); + virtual ~RemoteDialog(); + virtual void dispose() SAL_OVERRIDE; }; } diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx b/sd/source/ui/dlg/RemoteDialogClientBox.cxx index c3f4ebafb86b..83abb22a0184 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx @@ -73,16 +73,16 @@ ClientBox::ClientBox( vcl::Window* pParent, WinBits nStyle ) : m_nTopIndex( 0 ), m_nActiveHeight( 0 ), m_nExtraHeight( 2 ), - m_aPinBox( this, 0 ), - m_aDeauthoriseButton( this ), - m_aScrollBar( this, WB_VERT ) + m_aPinBox( VclPtr<NumericBox>::Create( this, 0 ) ), + m_aDeauthoriseButton( VclPtr<PushButton>::Create( this ) ), + m_aScrollBar( VclPtr<ScrollBar>::Create( this, WB_VERT ) ) { - m_aScrollBar.SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) ); - m_aScrollBar.EnableDrag(); + m_aScrollBar->SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) ); + m_aScrollBar->EnableDrag(); - m_aPinBox.SetUseThousandSep(false); - m_aDeauthoriseButton.SetText( SD_RESSTR(STR_DEAUTHORISE_CLIENT) ); - m_aDeauthoriseButton.SetClickHdl( LINK( this, ClientBox, DeauthoriseHdl ) ); + m_aPinBox->SetUseThousandSep(false); + m_aDeauthoriseButton->SetText( SD_RESSTR(STR_DEAUTHORISE_CLIENT) ); + m_aDeauthoriseButton->SetClickHdl( LINK( this, ClientBox, DeauthoriseHdl ) ); SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) ); long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE; @@ -124,6 +124,11 @@ Size ClientBox::GetOptimalSize() const ClientBox::~ClientBox() { + disposeOnce(); +} + +void ClientBox::dispose() +{ if ( ! m_bInDelete ) DeleteRemoved(); @@ -132,6 +137,11 @@ ClientBox::~ClientBox() m_vEntries.clear(); m_xRemoveListener.clear(); + + m_aPinBox.disposeAndClear(); + m_aDeauthoriseButton.disposeAndClear(); + m_aScrollBar.disposeAndClear(); + Control::dispose(); } // Title + description @@ -152,7 +162,7 @@ void ClientBox::CalcActiveHeight( const long nPos ) // Text entry height Size aSize = GetOutputSizePixel(); if ( m_bHasScrollBar ) - aSize.Width() -= m_aScrollBar.GetSizePixel().Width(); + aSize.Width() -= m_aScrollBar->GetSizePixel().Width(); aSize.Width() -= ICON_OFFSET; @@ -173,7 +183,7 @@ Rectangle ClientBox::GetEntryRect( const long nPos ) const Size aSize( GetOutputSizePixel() ); if ( m_bHasScrollBar ) - aSize.Width() -= m_aScrollBar.GetSizePixel().Width(); + aSize.Width() -= m_aScrollBar->GetSizePixel().Width(); if ( m_vEntries[ nPos ]->m_bActive ) aSize.Height() = m_nActiveHeight; @@ -246,7 +256,7 @@ void ClientBox::selectEntry( const long nPos ) // We empty the pin box now too, just in case the user previously // entered a pin, but then changed their selected device. - m_aPinBox.SetText( "" ); + m_aPinBox->SetText( "" ); if ( m_bHasActive ) { bool bAlreadyAuthorised = @@ -254,11 +264,11 @@ void ClientBox::selectEntry( const long nPos ) if ( bAlreadyAuthorised ) { - m_aDeauthoriseButton.GetFocus(); + m_aDeauthoriseButton->GetFocus(); } else { - m_aPinBox.GetFocus(); + m_aPinBox->GetFocus(); } } @@ -350,19 +360,19 @@ void ClientBox::RecalcAll() Size aPBSize = LogicToPixel( Size( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ), MapMode( MAP_APPFONT ) ); - m_aPinBox.SetSizePixel( aPBSize ); - m_aDeauthoriseButton.SetSizePixel( m_aDeauthoriseButton.GetOptimalSize() ); + m_aPinBox->SetSizePixel( aPBSize ); + m_aDeauthoriseButton->SetSizePixel( m_aDeauthoriseButton->GetOptimalSize() ); if ( !m_bHasActive ) { - m_aPinBox.Show( false ); - m_aDeauthoriseButton.Show( false ); + m_aPinBox->Show( false ); + m_aDeauthoriseButton->Show( false ); } else { Rectangle aEntryRect = GetEntryRect( m_nActive ); - Size aPinBoxSize( m_aPinBox.GetSizePixel() ); + Size aPinBoxSize( m_aPinBox->GetSizePixel() ); Point aPos( aEntryRect.Left(), aEntryRect.Bottom() - TOP_OFFSET - aPinBoxSize.Height() ); @@ -378,7 +388,7 @@ void ClientBox::RecalcAll() aPos = Point( aEntryRect.Left() + GetTextWidth( sPinText ), aEntryRect.Bottom() - TOP_OFFSET - aPinBoxSize.Height() ); - m_aPinBox.SetPosPixel( aPos ); + m_aPinBox->SetPosPixel( aPos ); // The text would have it's TOP aligned with the top of // the pin box -- hence we push it down to align baselines. m_sPinTextRect += Point( 0, 4 ); @@ -386,11 +396,11 @@ void ClientBox::RecalcAll() else { aPos += Point( 20, 0 ); - m_aDeauthoriseButton.SetPosPixel( aPos ); + m_aDeauthoriseButton->SetPosPixel( aPos ); } - m_aPinBox.Show( !bAlreadyAuthorised ); - m_aDeauthoriseButton.Show( bAlreadyAuthorised ); + m_aPinBox->Show( !bAlreadyAuthorised ); + m_aDeauthoriseButton->Show( bAlreadyAuthorised ); if ( m_bAdjustActive ) { @@ -424,7 +434,7 @@ void ClientBox::RecalcAll() } if ( m_bHasScrollBar ) - m_aScrollBar.SetThumbPos( m_nTopIndex ); + m_aScrollBar->SetThumbPos( m_nTopIndex ); } } @@ -487,7 +497,7 @@ void ClientBox::Paint( const Rectangle &/*rPaintRect*/ ) Size aSize( GetOutputSizePixel() ); if ( m_bHasScrollBar ) - aSize.Width() -= m_aScrollBar.GetSizePixel().Width(); + aSize.Width() -= m_aScrollBar->GetSizePixel().Width(); const ::osl::MutexGuard aGuard( m_entriesMutex ); @@ -525,20 +535,20 @@ void ClientBox::SetupScrollBar() if ( m_nTopIndex + aSize.Height() > nTotalHeight ) m_nTopIndex = nTotalHeight - aSize.Height(); - m_aScrollBar.SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ), + m_aScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ), Size( nScrBarSize, aSize.Height() ) ); - m_aScrollBar.SetRangeMax( nTotalHeight ); - m_aScrollBar.SetVisibleSize( aSize.Height() ); - m_aScrollBar.SetPageSize( ( aSize.Height() * 4 ) / 5 ); - m_aScrollBar.SetLineSize( m_nStdHeight ); - m_aScrollBar.SetThumbPos( m_nTopIndex ); + m_aScrollBar->SetRangeMax( nTotalHeight ); + m_aScrollBar->SetVisibleSize( aSize.Height() ); + m_aScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 ); + m_aScrollBar->SetLineSize( m_nStdHeight ); + m_aScrollBar->SetThumbPos( m_nTopIndex ); if ( !m_bHasScrollBar ) - m_aScrollBar.Show(); + m_aScrollBar->Show(); } else if ( m_bHasScrollBar ) { - m_aScrollBar.Hide(); + m_aScrollBar->Hide(); m_nTopIndex = 0; } @@ -567,7 +577,7 @@ long ClientBox::PointToPos( const Point& rPos ) OUString ClientBox::getPin() { - return OUString::number( m_aPinBox.GetValue() ); + return OUString::number( m_aPinBox->GetValue() ); } void ClientBox::MouseButtonDown( const MouseEvent& rMEvt ) @@ -608,11 +618,11 @@ bool ClientBox::Notify( NotifyEvent& rNEvt ) const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData(); if ( pData->GetMode() == CommandWheelMode::SCROLL ) { - long nThumbPos = m_aScrollBar.GetThumbPos(); + long nThumbPos = m_aScrollBar->GetThumbPos(); if ( pData->GetDelta() < 0 ) - m_aScrollBar.DoScroll( nThumbPos + m_nStdHeight ); + m_aScrollBar->DoScroll( nThumbPos + m_nStdHeight ); else - m_aScrollBar.DoScroll( nThumbPos - m_nStdHeight ); + m_aScrollBar->DoScroll( nThumbPos - m_nStdHeight ); bHandled = true; } } @@ -702,13 +712,13 @@ void ClientBox::populateEntries() void ClientBox::DoScroll( long nDelta ) { m_nTopIndex += nDelta; - Point aNewSBPt( m_aScrollBar.GetPosPixel() ); + Point aNewSBPt( m_aScrollBar->GetPosPixel() ); Rectangle aScrRect( Point(), GetOutputSizePixel() ); - aScrRect.Right() -= m_aScrollBar.GetSizePixel().Width(); + aScrRect.Right() -= m_aScrollBar->GetSizePixel().Width(); Scroll( 0, -nDelta, aScrRect ); - m_aScrollBar.SetPosPixel( aNewSBPt ); + m_aScrollBar->SetPosPixel( aNewSBPt ); } IMPL_LINK( ClientBox, ScrollHdl, ScrollBar*, pScrBar ) diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx index 1dc481ebd79a..63bf2db5a577 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx @@ -69,7 +69,7 @@ class ClientBox; class ClientRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener > { - ClientBox *m_pParent; + VclPtr<ClientBox> m_pParent; public: @@ -101,11 +101,11 @@ class ClientBox: Link m_aClickHdl; Link m_aDeauthoriseHdl; - NumericBox m_aPinBox; - PushButton m_aDeauthoriseButton; - Rectangle m_sPinTextRect; + VclPtr<NumericBox> m_aPinBox; + VclPtr<PushButton> m_aDeauthoriseButton; + Rectangle m_sPinTextRect; - ScrollBar m_aScrollBar; + VclPtr<ScrollBar> m_aScrollBar; com::sun::star::uno::Reference< ClientRemovedListener > m_xRemoveListener; @@ -136,7 +136,8 @@ class ClientBox: public: ClientBox( vcl::Window* pParent, WinBits nStyle ); - virtual ~ClientBox(); + virtual ~ClientBox(); + virtual void dispose() SAL_OVERRIDE; void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; void Paint( const Rectangle &rPaintRect ) SAL_OVERRIDE; diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 1eaf723dd3bd..272c2f6e16bd 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -158,7 +158,7 @@ AnimationWindow::AnimationWindow(SfxBindings* pInBindings, SfxChildWindow *pCW, get(m_pLbAdjustment, "alignment"); get(m_pBtnCreateGroup, "create"); - m_pCtlDisplay = new SdDisplay(get<Window>("box")); + m_pCtlDisplay = VclPtr<SdDisplay>::Create(get<Window>("box")); m_pCtlDisplay->set_hexpand(true); m_pCtlDisplay->set_vexpand(true); m_pCtlDisplay->Show(); @@ -206,6 +206,11 @@ AnimationWindow::AnimationWindow(SfxBindings* pInBindings, SfxChildWindow *pCW, AnimationWindow::~AnimationWindow() { + disposeOnce(); +} + +void AnimationWindow::dispose() +{ delete pControllerItem; for (size_t i = 0; i < m_FrameList.size(); ++i) @@ -219,7 +224,27 @@ AnimationWindow::~AnimationWindow() // delete the clones delete pMyDoc; - delete m_pCtlDisplay; + m_pCtlDisplay.disposeAndClear(); + m_pBtnFirst.clear(); + m_pBtnReverse.clear(); + m_pBtnStop.clear(); + m_pBtnPlay.clear(); + m_pBtnLast.clear(); + m_pNumFldBitmap.clear(); + m_pTimeField.clear(); + m_pLbLoopCount.clear(); + m_pBtnGetOneObject.clear(); + m_pBtnGetAllObjects.clear(); + m_pBtnRemoveBitmap.clear(); + m_pBtnRemoveAll.clear(); + m_pFiCount.clear(); + m_pRbtGroup.clear(); + m_pRbtBitmap.clear(); + m_pFtAdjustment.clear(); + m_pLbAdjustment.clear(); + m_pBtnCreateGroup.clear(); + pWin.clear(); + SfxDockingWindow::dispose(); } IMPL_LINK_NOARG(AnimationWindow, ClickFirstHdl) @@ -430,8 +455,8 @@ IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn ) } else // delete everything { - WarningBox aWarnBox( this, WB_YES_NO, SD_RESSTR( STR_ASK_DELETE_ALL_PICTURES ) ); - short nReturn = aWarnBox.Execute(); + ScopedVclPtrInstance< WarningBox > aWarnBox( this, WB_YES_NO, SD_RESSTR( STR_ASK_DELETE_ALL_PICTURES ) ); + short nReturn = aWarnBox->Execute(); if( nReturn == RET_YES ) { @@ -523,23 +548,23 @@ void AnimationWindow::UpdateControl(bool const bDisableCtrls) static_cast<SdrObject*>(pPage->GetObj(m_nCurrentFrame)); if( pObject ) { - VirtualDevice aVD; + ScopedVclPtrInstance< VirtualDevice > pVD; Rectangle aObjRect( pObject->GetCurrentBoundRect() ); Size aObjSize( aObjRect.GetSize() ); Point aOrigin( Point( -aObjRect.Left(), -aObjRect.Top() ) ); - MapMode aMap( aVD.GetMapMode() ); + MapMode aMap( pVD->GetMapMode() ); aMap.SetMapUnit( MAP_100TH_MM ); aMap.SetOrigin( aOrigin ); - aVD.SetMapMode( aMap ); - aVD.SetOutputSize( aObjSize ); + pVD->SetMapMode( aMap ); + pVD->SetOutputSize( aObjSize ); const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); - aVD.SetBackground( Wallpaper( rStyles.GetFieldColor() ) ); - aVD.SetDrawMode( rStyles.GetHighContrastMode() + pVD->SetBackground( Wallpaper( rStyles.GetFieldColor() ) ); + pVD->SetDrawMode( rStyles.GetHighContrastMode() ? ViewShell::OUTPUT_DRAWMODE_CONTRAST : ViewShell::OUTPUT_DRAWMODE_COLOR ); - aVD.Erase(); - pObject->SingleObjectPainter( aVD ); - aBmp = BitmapEx( aVD.GetBitmap( aObjRect.TopLeft(), aObjSize ) ); + pVD->Erase(); + pObject->SingleObjectPainter( *pVD.get() ); + aBmp = BitmapEx( pVD->GetBitmap( aObjRect.TopLeft(), aObjSize ) ); } m_pCtlDisplay->SetBitmapEx(&aBmp); diff --git a/sd/source/ui/dlg/assclass.cxx b/sd/source/ui/dlg/assclass.cxx index e77375bb10a0..7049c5b10946 100644 --- a/sd/source/ui/dlg/assclass.cxx +++ b/sd/source/ui/dlg/assclass.cxx @@ -86,8 +86,8 @@ bool Assistent::GotoPage(const int nPageToGo) { int nIndex=mnCurrentPage-1; - std::vector<vcl::Window*>::iterator iter = maPages[nIndex].begin(); - std::vector<vcl::Window*>::iterator iterEnd = maPages[nIndex].end(); + auto iter = maPages[nIndex].begin(); + auto iterEnd = maPages[nIndex].end(); for(; iter != iterEnd; ++iter) { diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx index ce7448d5caa2..eff19c5f365f 100644 --- a/sd/source/ui/dlg/brkdlg.cxx +++ b/sd/source/ui/dlg/brkdlg.cxx @@ -67,8 +67,20 @@ BreakDlg::BreakDlg( BreakDlg::~BreakDlg() { + disposeOnce(); +} + +void BreakDlg::dispose() +{ delete mpProgress; + mpProgress = NULL; delete pProgrInfo; + pProgrInfo = NULL; + m_pFiObjInfo.clear(); + m_pFiActInfo.clear(); + m_pFiInsInfo.clear(); + m_pBtnCancel.clear(); + SfxModalDialog::dispose(); } // Control-Handler for cancel button @@ -93,8 +105,8 @@ IMPL_LINK( BreakDlg, UpDate, void*, nInit ) // update status bar or show a error message? if(nInit == reinterpret_cast<void*>(1L)) { - MessageDialog aErrBox(this, SD_RESSTR(STR_BREAK_FAIL)); - aErrBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrBox(this, SD_RESSTR(STR_BREAK_FAIL)); + aErrBox->Execute(); } else { diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index c0b9b05f0b02..b87f58e0908c 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -84,30 +84,23 @@ CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, CopyDlg::~CopyDlg() { - OUString& rStr = GetExtraData(); - - rStr = OUString::number(m_pNumFldCopies->GetValue()); - rStr += OUString(TOKEN); - - rStr += OUString::number(m_pMtrFldMoveX->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number(m_pMtrFldMoveY->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number(m_pMtrFldAngle->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number(m_pMtrFldWidth->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number(m_pMtrFldHeight->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number( m_pLbStartColor->GetSelectEntryColor().GetColor() ); - rStr += OUString( TOKEN ); + disposeOnce(); +} - rStr += OUString::number( m_pLbEndColor->GetSelectEntryColor().GetColor() ); +void CopyDlg::dispose() +{ + m_pNumFldCopies.clear(); + m_pBtnSetViewData.clear(); + m_pMtrFldMoveX.clear(); + m_pMtrFldMoveY.clear(); + m_pMtrFldAngle.clear(); + m_pMtrFldWidth.clear(); + m_pMtrFldHeight.clear(); + m_pLbStartColor.clear(); + m_pFtEndColor.clear(); + m_pLbEndColor.clear(); + m_pBtnSetDefault.clear(); + SfxModalDialog::dispose(); } /** diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index 45355fee5ad7..8de00aa58c42 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -85,6 +85,21 @@ SdCustomShowDlg::SdCustomShowDlg( vcl::Window* pWindow, SdCustomShowDlg::~SdCustomShowDlg() { + disposeOnce(); +} + +void SdCustomShowDlg::dispose() +{ + m_pLbCustomShows.clear(); + m_pCbxUseCustomShow.clear(); + m_pBtnNew.clear(); + m_pBtnEdit.clear(); + m_pBtnRemove.clear(); + m_pBtnCopy.clear(); + m_pBtnHelp.clear(); + m_pBtnStartShow.clear(); + m_pBtnOK.clear(); + ModalDialog::dispose(); } void SdCustomShowDlg::CheckState() @@ -111,8 +126,8 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) if( p == m_pBtnNew ) { pCustomShow = NULL; - SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow ); - if( aDlg.Execute() == RET_OK ) + ScopedVclPtrInstance< SdDefineCustomShowDlg > aDlg( this, rDoc, pCustomShow ); + if( aDlg->Execute() == RET_OK ) { if( pCustomShow ) { @@ -125,7 +140,7 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) m_pLbCustomShows->SelectEntry( pCustomShow->GetName() ); } - if( aDlg.IsModified() ) + if( aDlg->IsModified() ) bModified = true; } else if( pCustomShow ) @@ -139,9 +154,9 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) { DBG_ASSERT( pCustomShowList, "pCustomShowList does not exist" ); pCustomShow = (*pCustomShowList)[ nPos ]; - SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow ); + ScopedVclPtrInstance< SdDefineCustomShowDlg > aDlg( this, rDoc, pCustomShow ); - if( aDlg.Execute() == RET_OK ) + if( aDlg->Execute() == RET_OK ) { if( pCustomShow ) { @@ -151,7 +166,7 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) m_pLbCustomShows->InsertEntry( pCustomShow->GetName(), nPos ); m_pLbCustomShows->SelectEntryPos( nPos ); } - if( aDlg.IsModified() ) + if( aDlg->IsModified() ) bModified = true; } } @@ -336,6 +351,20 @@ SdDefineCustomShowDlg::SdDefineCustomShowDlg( vcl::Window* pWindow, SdDefineCustomShowDlg::~SdDefineCustomShowDlg() { + disposeOnce(); +} + +void SdDefineCustomShowDlg::dispose() +{ + m_pEdtName.clear(); + m_pLbPages.clear(); + m_pBtnAdd.clear(); + m_pBtnRemove.clear(); + m_pLbCustomPages.clear(); + m_pBtnOK.clear(); + m_pBtnCancel.clear(); + m_pBtnHelp.clear(); + ModalDialog::dispose(); } // CheckState diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx index 41c2754c2a4f..e2307ac7c2c8 100644 --- a/sd/source/ui/dlg/diactrl.cxx +++ b/sd/source/ui/dlg/diactrl.cxx @@ -132,9 +132,9 @@ void SdTbxCtlDiaPages::StateChanged( sal_uInt16, } } -vcl::Window* SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent ) { - return new SdPagesField( pParent, m_xFrame ); + return VclPtrInstance<SdPagesField>( pParent, m_xFrame ).get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx index 98df35d60900..69219b06c354 100644 --- a/sd/source/ui/dlg/dlgass.cxx +++ b/sd/source/ui/dlg/dlgass.cxx @@ -101,8 +101,8 @@ public: void Enable (bool bEnable); private: - PushButton* mpNextButton1; - PushButton* mpNextButton2; + VclPtr<PushButton> mpNextButton1; + VclPtr<PushButton> mpNextButton2; bool mbIsFirstButtonActive; }; @@ -160,7 +160,7 @@ public: */ bool mbPreviewUpdating; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; void SavePassword( SfxObjectShellLock xDoc, const OUString& rPath ); void RestorePassword( SfxItemSet* pSet, const OUString& rPath ); @@ -247,74 +247,74 @@ public: // Common Assistent maAssistentFunc; - CheckBox* mpPreviewFlag; - CheckBox* mpStartWithFlag; - PushButton* mpLastPageButton; - NextButton* mpNextPageButton; - PushButton* mpFinishButton; - SdDocPreviewWin* mpPreview; - VclContainer* mpPage1235; + VclPtr<CheckBox> mpPreviewFlag; + VclPtr<CheckBox> mpStartWithFlag; + VclPtr<PushButton> mpLastPageButton; + NextButton* mpNextPageButton; + VclPtr<PushButton> mpFinishButton; + VclPtr<SdDocPreviewWin> mpPreview; + VclPtr<VclContainer> mpPage1235; // page 1 - VclContainer* mpPage1; - FixedImage* mpPage1FB; - FixedText* mpPage1ArtFL; - RadioButton* mpPage1EmptyRB; - RadioButton* mpPage1TemplateRB; - ListBox* mpPage1RegionLB; - ListBox* mpPage1TemplateLB; - RadioButton* mpPage1OpenRB; - ListBox* mpPage1OpenLB; - PushButton* mpPage1OpenPB; + VclPtr<VclContainer> mpPage1; + VclPtr<FixedImage> mpPage1FB; + VclPtr<FixedText> mpPage1ArtFL; + VclPtr<RadioButton> mpPage1EmptyRB; + VclPtr<RadioButton> mpPage1TemplateRB; + VclPtr<ListBox> mpPage1RegionLB; + VclPtr<ListBox> mpPage1TemplateLB; + VclPtr<RadioButton> mpPage1OpenRB; + VclPtr<ListBox> mpPage1OpenLB; + VclPtr<PushButton> mpPage1OpenPB; // page 2 - VclContainer* mpPage2; - FixedImage* mpPage2FB; - FixedText* mpPage2LayoutFL; - ListBox* mpPage2RegionLB; - ListBox* mpPage2LayoutLB; - FixedText* mpPage2OutTypesFL; - RadioButton* mpPage2Medium1RB; - RadioButton* mpPage2Medium2RB; - RadioButton* mpPage2Medium3RB; - RadioButton* mpPage2Medium4RB; - RadioButton* mpPage2Medium5RB; - RadioButton* mpPage2Medium6RB; + VclPtr<VclContainer> mpPage2; + VclPtr<FixedImage> mpPage2FB; + VclPtr<FixedText> mpPage2LayoutFL; + VclPtr<ListBox> mpPage2RegionLB; + VclPtr<ListBox> mpPage2LayoutLB; + VclPtr<FixedText> mpPage2OutTypesFL; + VclPtr<RadioButton> mpPage2Medium1RB; + VclPtr<RadioButton> mpPage2Medium2RB; + VclPtr<RadioButton> mpPage2Medium3RB; + VclPtr<RadioButton> mpPage2Medium4RB; + VclPtr<RadioButton> mpPage2Medium5RB; + VclPtr<RadioButton> mpPage2Medium6RB; // page 3 - VclContainer* mpPage3; - FixedImage* mpPage3FB; - FixedText* mpPage3EffectFL; - FixedText* mpPage3EffectFT; - FadeEffectLB* mpPage3EffectLB; - FixedText* mpPage3SpeedFT; - ListBox* mpPage3SpeedLB; - FixedText* mpPage3PresTypeFL; - RadioButton* mpPage3PresTypeLiveRB; - RadioButton* mpPage3PresTypeKioskRB; - FixedText* mpPage3PresTimeFT; - TimeField* mpPage3PresTimeTMF; - FixedText* mpPage3BreakFT; - TimeField* mpPage3BreakTMF; - CheckBox* mpPage3LogoCB; + VclPtr<VclContainer> mpPage3; + VclPtr<FixedImage> mpPage3FB; + VclPtr<FixedText> mpPage3EffectFL; + VclPtr<FixedText> mpPage3EffectFT; + VclPtr<FadeEffectLB> mpPage3EffectLB; + VclPtr<FixedText> mpPage3SpeedFT; + VclPtr<ListBox> mpPage3SpeedLB; + VclPtr<FixedText> mpPage3PresTypeFL; + VclPtr<RadioButton> mpPage3PresTypeLiveRB; + VclPtr<RadioButton> mpPage3PresTypeKioskRB; + VclPtr<FixedText> mpPage3PresTimeFT; + VclPtr<TimeField> mpPage3PresTimeTMF; + VclPtr<FixedText> mpPage3BreakFT; + VclPtr<TimeField> mpPage3BreakTMF; + VclPtr<CheckBox> mpPage3LogoCB; // page 4 - VclContainer* mpPage4; - FixedImage* mpPage4FB; - FixedText* mpPage4PersonalFL; - FixedText* mpPage4AskNameFT; - Edit* mpPage4AskNameEDT; - FixedText* mpPage4AskTopicFT; - Edit* mpPage4AskTopicEDT; - FixedText* mpPage4AskInfoFT; - VclMultiLineEdit* mpPage4AskInfoEDT; + VclPtr<VclContainer> mpPage4; + VclPtr<FixedImage> mpPage4FB; + VclPtr<FixedText> mpPage4PersonalFL; + VclPtr<FixedText> mpPage4AskNameFT; + VclPtr<Edit> mpPage4AskNameEDT; + VclPtr<FixedText> mpPage4AskTopicFT; + VclPtr<Edit> mpPage4AskTopicEDT; + VclPtr<FixedText> mpPage4AskInfoFT; + VclPtr<VclMultiLineEdit> mpPage4AskInfoEDT; // page 5 - VclContainer* mpPage5; - FixedImage* mpPage5FB; - FixedText* mpPage5PageListFT; - SdPageListControl* mpPage5PageListCT; - CheckBox* mpPage5SummaryCB; + VclPtr<VclContainer> mpPage5; + VclPtr<FixedImage> mpPage5FB; + VclPtr<FixedText> mpPage5PageListFT; + VclPtr<SdPageListControl> mpPage5PageListCT; + VclPtr<CheckBox> mpPage5SummaryCB; }; @@ -1769,7 +1769,13 @@ IMPL_LINK_NOARG(AssistentDlg, FinishHdl) AssistentDlg::~AssistentDlg() { + disposeOnce(); +} + +void AssistentDlg::dispose() +{ delete mpImpl; + ModalDialog::dispose(); } SfxObjectShellLock AssistentDlg::GetDocument() diff --git a/sd/source/ui/dlg/dlgassim.cxx b/sd/source/ui/dlg/dlgassim.cxx index 5eaab0185c9f..652a2b232c26 100644 --- a/sd/source/ui/dlg/dlgassim.cxx +++ b/sd/source/ui/dlg/dlgassim.cxx @@ -78,7 +78,13 @@ IMPL_LINK_NOARG(SdPageListControl, CheckButtonClickHdl) SdPageListControl::~SdPageListControl() { + disposeOnce(); +} + +void SdPageListControl::dispose() +{ delete m_pCheckButton; + SvTreeListBox::dispose(); } void SdPageListControl::Clear() diff --git a/sd/source/ui/dlg/dlgassim.hxx b/sd/source/ui/dlg/dlgassim.hxx index 8e966f856323..ee39788cb136 100644 --- a/sd/source/ui/dlg/dlgassim.hxx +++ b/sd/source/ui/dlg/dlgassim.hxx @@ -37,6 +37,7 @@ private: public: SdPageListControl( vcl::Window* pParent, const WinBits nStyle ); virtual ~SdPageListControl(); + virtual void dispose() SAL_OVERRIDE; void Fill( SdDrawDocument* pDoc ); void Clear(); diff --git a/sd/source/ui/dlg/dlgctrls.cxx b/sd/source/ui/dlg/dlgctrls.cxx index 10923287ac1b..cb9df95d7261 100644 --- a/sd/source/ui/dlg/dlgctrls.cxx +++ b/sd/source/ui/dlg/dlgctrls.cxx @@ -40,7 +40,13 @@ FadeEffectLB::FadeEffectLB(vcl::Window* pParent, WinBits nStyle) FadeEffectLB::~FadeEffectLB() { + disposeOnce(); +} + +void FadeEffectLB::dispose() +{ delete mpImpl; + ListBox::dispose(); } void FadeEffectLB::Fill() diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx index 64e4d476baa7..7927f4d9f54a 100644 --- a/sd/source/ui/dlg/dlgfield.cxx +++ b/sd/source/ui/dlg/dlgfield.cxx @@ -53,6 +53,21 @@ SdModifyFieldDlg::SdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pI FillControls(); } +SdModifyFieldDlg::~SdModifyFieldDlg() +{ + disposeOnce(); +} + +void SdModifyFieldDlg::dispose() +{ + m_pRbtFix.clear(); + m_pRbtVar.clear(); + m_pLbLanguage.clear(); + m_pLbFormat.clear(); + ModalDialog::dispose(); +} + + /** * Returns the new field, owned by caller. * Returns NULL if nothing has changed. diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx index c3a77103b247..2582ca25c534 100644 --- a/sd/source/ui/dlg/dlgolbul.cxx +++ b/sd/source/ui/dlg/dlgolbul.cxx @@ -138,7 +138,13 @@ OutlineBulletDlg::OutlineBulletDlg( OutlineBulletDlg::~OutlineBulletDlg() { + disposeOnce(); +} + +void OutlineBulletDlg::dispose() +{ delete pOutputSet; + SfxTabDialog::dispose(); } void OutlineBulletDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx index 07d6e2c2886d..aed2a1059f4a 100644 --- a/sd/source/ui/dlg/dlgsnap.cxx +++ b/sd/source/ui/dlg/dlgsnap.cxx @@ -111,6 +111,25 @@ SdSnapLineDlg::SdSnapLineDlg( m_pRbPoint->Check(); } +SdSnapLineDlg::~SdSnapLineDlg() +{ + disposeOnce(); +} + +void SdSnapLineDlg::dispose() +{ + m_pFtX.clear(); + m_pMtrFldX.clear(); + m_pFtY.clear(); + m_pMtrFldY.clear(); + m_pRadioGroup.clear(); + m_pRbPoint.clear(); + m_pRbVert.clear(); + m_pRbHorz.clear(); + m_pBtnDelete.clear(); + ModalDialog::dispose(); +} + /** * fills provided item sets with dialog box attributes */ diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx index e3f9a2a394c5..e0895092d7fb 100644 --- a/sd/source/ui/dlg/docprev.cxx +++ b/sd/source/ui/dlg/docprev.cxx @@ -83,7 +83,13 @@ SdDocPreviewWin::SdDocPreviewWin( vcl::Window* pParent, const WinBits nStyle ) SdDocPreviewWin::~SdDocPreviewWin() { + disposeOnce(); +} + +void SdDocPreviewWin::dispose() +{ delete pMetaFile; + Control::dispose(); } Size SdDocPreviewWin::GetOptimalSize() const @@ -235,17 +241,17 @@ void SdDocPreviewWin::updateViewSettings() pMtf = new GDIMetaFile; - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; const Fraction aFrac( pDoc->GetScaleFraction() ); const MapMode aMap( pDoc->GetScaleUnit(), Point(), aFrac, aFrac ); - aVDev.SetMapMode( aMap ); + pVDev->SetMapMode( aMap ); // Disable output, as we only want to record a metafile - aVDev.EnableOutput( false ); + pVDev->EnableOutput( false ); - pMtf->Record( &aVDev ); + pMtf->Record( pVDev ); ::sd::DrawView* pView = new ::sd::DrawView(pDocShell, this, NULL); @@ -261,18 +267,18 @@ void SdDocPreviewWin::updateViewSettings() const Rectangle aClipRect( aNewOrg, aNewSize ); MapMode aVMap( aMap ); - aVDev.Push(); + pVDev->Push(); aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) ); - aVDev.SetRelativeMapMode( aVMap ); - aVDev.IntersectClipRegion( aClipRect ); + pVDev->SetRelativeMapMode( aVMap ); + pVDev->IntersectClipRegion( aClipRect ); // Use new StandardCheckVisisbilityRedirector StandardCheckVisisbilityRedirector aRedirector; const Rectangle aRedrawRectangle = Rectangle( Point(), aNewSize ); vcl::Region aRedrawRegion(aRedrawRectangle); - pView->SdrPaintView::CompleteRedraw(&aVDev,aRedrawRegion,&aRedirector); + pView->SdrPaintView::CompleteRedraw(pVDev,aRedrawRegion,&aRedirector); - aVDev.Pop(); + pVDev->Pop(); pMtf->Stop(); pMtf->WindStart(); diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx index b21f7104b53c..181dd7af049f 100644 --- a/sd/source/ui/dlg/gluectrl.cxx +++ b/sd/source/ui/dlg/gluectrl.cxx @@ -160,14 +160,12 @@ void SdTbxCtlGlueEscDir::StateChanged( sal_uInt16 nSId, SfxToolBoxControl::StateChanged( nSId, eState, pState ); } -vcl::Window* SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent ) { if( GetSlotId() == SID_GLUE_ESCDIR ) - { - return new GlueEscDirLB( pParent, m_xFrame ); - } + return VclPtr<GlueEscDirLB>::Create( pParent, m_xFrame ).get(); - return NULL; + return VclPtr<vcl::Window>(); } /** diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index e7590357f67e..84d0da17bd27 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -115,29 +115,29 @@ class HeaderFooterTabPage : public TabPage { private: - FixedText* mpFTIncludeOn; + VclPtr<FixedText> mpFTIncludeOn; - CheckBox* mpCBHeader; - VclContainer* mpHeaderBox; - Edit* mpTBHeader; + VclPtr<CheckBox> mpCBHeader; + VclPtr<VclContainer> mpHeaderBox; + VclPtr<Edit> mpTBHeader; - CheckBox* mpCBDateTime; - RadioButton* mpRBDateTimeFixed; - RadioButton* mpRBDateTimeAutomatic; - Edit* mpTBDateTimeFixed; - ListBox* mpCBDateTimeFormat; - FixedText* mpFTDateTimeLanguage; - SvxLanguageBox* mpCBDateTimeLanguage; + VclPtr<CheckBox> mpCBDateTime; + VclPtr<RadioButton> mpRBDateTimeFixed; + VclPtr<RadioButton> mpRBDateTimeAutomatic; + VclPtr<Edit> mpTBDateTimeFixed; + VclPtr<ListBox> mpCBDateTimeFormat; + VclPtr<FixedText> mpFTDateTimeLanguage; + VclPtr<SvxLanguageBox> mpCBDateTimeLanguage; - CheckBox* mpCBFooter; - VclContainer* mpFooterBox; - Edit* mpTBFooter; + VclPtr<CheckBox> mpCBFooter; + VclPtr<VclContainer> mpFooterBox; + VclPtr<Edit> mpTBFooter; - CheckBox* mpCBSlideNumber; + VclPtr<CheckBox> mpCBSlideNumber; - CheckBox* mpCBNotOnTitle; + VclPtr<CheckBox> mpCBNotOnTitle; - PresLayoutPreview* mpCTPreview; + VclPtr<PresLayoutPreview> mpCTPreview; SdDrawDocument* mpDoc; LanguageType meOldLanguage; @@ -155,6 +155,7 @@ private: public: HeaderFooterTabPage( vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); virtual ~HeaderFooterTabPage(); + virtual void dispose() SAL_OVERRIDE; void init( const HeaderFooterSettings& rSettings, bool bNotOnTitle ); void getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle ); @@ -198,7 +199,7 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar mpTabCtrl->Show(); mnSlidesId = mpTabCtrl->GetPageId("slides"); - mpSlideTabPage = new HeaderFooterTabPage( mpTabCtrl, pDoc, pSlide, false ); + mpSlideTabPage = VclPtr<HeaderFooterTabPage>::Create( mpTabCtrl, pDoc, pSlide, false ); mpTabCtrl->SetTabPage( mnSlidesId, mpSlideTabPage ); Size aSiz = mpSlideTabPage->GetSizePixel(); @@ -211,7 +212,7 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar } mnNotesId = mpTabCtrl->GetPageId("notes"); - mpNotesHandoutsTabPage = new HeaderFooterTabPage( mpTabCtrl, pDoc, pNotes, true ); + mpNotesHandoutsTabPage = VclPtr<HeaderFooterTabPage>::Create( mpTabCtrl, pDoc, pNotes, true ); mpTabCtrl->SetTabPage( mnNotesId, mpNotesHandoutsTabPage ); get(maPBApplyToAll, "apply_all" ); @@ -240,8 +241,18 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar HeaderFooterDialog::~HeaderFooterDialog() { - delete mpSlideTabPage; - delete mpNotesHandoutsTabPage; + disposeOnce(); +} + +void HeaderFooterDialog::dispose() +{ + mpSlideTabPage.disposeAndClear(); + mpNotesHandoutsTabPage.disposeAndClear(); + mpTabCtrl.clear(); + maPBApplyToAll.clear(); + maPBApply.clear(); + maPBCancel.clear(); + TabDialog::dispose(); } IMPL_LINK( HeaderFooterDialog, ActivatePageHdl, TabControl *, pTabCtrl ) @@ -451,6 +462,29 @@ HeaderFooterTabPage::HeaderFooterTabPage( vcl::Window* pWindow, SdDrawDocument* HeaderFooterTabPage::~HeaderFooterTabPage() { + disposeOnce(); +} + +void HeaderFooterTabPage::dispose() +{ + mpFTIncludeOn.clear(); + mpCBHeader.clear(); + mpHeaderBox.clear(); + mpTBHeader.clear(); + mpCBDateTime.clear(); + mpRBDateTimeFixed.clear(); + mpRBDateTimeAutomatic.clear(); + mpTBDateTimeFixed.clear(); + mpCBDateTimeFormat.clear(); + mpFTDateTimeLanguage.clear(); + mpCBDateTimeLanguage.clear(); + mpCBFooter.clear(); + mpFooterBox.clear(); + mpTBFooter.clear(); + mpCBSlideNumber.clear(); + mpCBNotOnTitle.clear(); + mpCTPreview.clear(); + TabPage::dispose(); } IMPL_LINK_NOARG(HeaderFooterTabPage, LanguageChangeHdl) diff --git a/sd/source/ui/dlg/ins_paste.cxx b/sd/source/ui/dlg/ins_paste.cxx index a256990697e0..ad9e9821e4e0 100644 --- a/sd/source/ui/dlg/ins_paste.cxx +++ b/sd/source/ui/dlg/ins_paste.cxx @@ -28,6 +28,18 @@ SdInsertPasteDlg::SdInsertPasteDlg(vcl::Window* pWindow) m_pRbAfter->Check( true ); } +SdInsertPasteDlg::~SdInsertPasteDlg() +{ + disposeOnce(); +} + +void SdInsertPasteDlg::dispose() +{ + m_pRbBefore.clear(); + m_pRbAfter.clear(); + ModalDialog::dispose(); +} + bool SdInsertPasteDlg::IsInsertBefore() const { return( m_pRbBefore->IsChecked() ); diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx index 5593562947c1..c77ba67a4c40 100644 --- a/sd/source/ui/dlg/inspagob.cxx +++ b/sd/source/ui/dlg/inspagob.cxx @@ -55,6 +55,15 @@ SdInsertPagesObjsDlg::SdInsertPagesObjsDlg( SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg() { + disposeOnce(); +} + +void SdInsertPagesObjsDlg::dispose() +{ + m_pLbTree.clear(); + m_pCbxLink.clear(); + m_pCbxMasters.clear(); + ModalDialog::dispose(); } /** diff --git a/sd/source/ui/dlg/layeroptionsdlg.cxx b/sd/source/ui/dlg/layeroptionsdlg.cxx index 86df27c22cb1..a1e5d7f1a03b 100644 --- a/sd/source/ui/dlg/layeroptionsdlg.cxx +++ b/sd/source/ui/dlg/layeroptionsdlg.cxx @@ -50,6 +50,22 @@ SdInsertLayerDlg::SdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInA get<VclContainer>("nameframe")->Enable(bDeletable); } +SdInsertLayerDlg::~SdInsertLayerDlg() +{ + disposeOnce(); +} + +void SdInsertLayerDlg::dispose() +{ + m_pEdtName.clear(); + m_pEdtTitle.clear(); + m_pEdtDesc.clear(); + m_pCbxVisible.clear(); + m_pCbxPrintable.clear(); + m_pCbxLocked.clear(); + ModalDialog::dispose(); +} + void SdInsertLayerDlg::GetAttr( SfxItemSet& rAttrs ) { rAttrs.Put( SdAttrLayerName( m_pEdtName->GetText() ) ); diff --git a/sd/source/ui/dlg/masterlayoutdlg.cxx b/sd/source/ui/dlg/masterlayoutdlg.cxx index d10f8224ad8b..e1cce5c63ec6 100644 --- a/sd/source/ui/dlg/masterlayoutdlg.cxx +++ b/sd/source/ui/dlg/masterlayoutdlg.cxx @@ -75,6 +75,21 @@ MasterLayoutDialog::MasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pD mpCBPageNumber->Check( mbOldPageNumber ); } +MasterLayoutDialog::~MasterLayoutDialog() +{ + disposeOnce(); +} + +void MasterLayoutDialog::dispose() +{ + mpCBDate.clear(); + mpCBPageNumber.clear(); + mpCBSlideNumber.clear(); + mpCBHeader.clear(); + mpCBFooter.clear(); + ModalDialog::dispose(); +} + short MasterLayoutDialog::Execute() { if ( ModalDialog::Execute() ) diff --git a/sd/source/ui/dlg/morphdlg.cxx b/sd/source/ui/dlg/morphdlg.cxx index db55129d3f8a..ebd28b18dad1 100644 --- a/sd/source/ui/dlg/morphdlg.cxx +++ b/sd/source/ui/dlg/morphdlg.cxx @@ -66,6 +66,15 @@ MorphDlg::MorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObjec MorphDlg::~MorphDlg() { + disposeOnce(); +} + +void MorphDlg::dispose() +{ + m_pMtfSteps.clear(); + m_pCbxAttributes.clear(); + m_pCbxOrientation.clear(); + ModalDialog::dispose(); } void MorphDlg::LoadSettings() diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index 21fa0d9998d6..a37b13015a77 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -68,9 +68,9 @@ SdNavigatorWin::SdNavigatorWin( SfxBindings* pInBindings, const UpdateRequestFunctor& rUpdateRequest) : vcl::Window( pParent, rSdResId ) - , maToolbox ( this, SdResId( 1 ) ) - , maTlbObjects( this, SdResId( TLB_OBJECTS ) ) - , maLbDocs ( this, SdResId( LB_DOCS ) ) + , maToolbox ( VclPtr<ToolBox>::Create( this, SdResId( 1 ) ) ) + , maTlbObjects( VclPtr<SdPageObjsTLB>::Create( this, SdResId( TLB_OBJECTS ) ) ) + , maLbDocs ( VclPtr<ListBox>::Create( this, SdResId( LB_DOCS ) ) ) , mpChildWinContext( pChWinCtxt ) , mbDocImported ( false ) // On changes of the DragType: adjust SelectionMode of TLB! @@ -78,58 +78,58 @@ SdNavigatorWin::SdNavigatorWin( , mpBindings ( pInBindings ) , maImageList ( SdResId( IL_NAVIGATR ) ) { - maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() ); + maTlbObjects->SetViewFrame( mpBindings->GetDispatcher()->GetFrame() ); FreeResource(); - maTlbObjects.SetAccessibleName(SD_RESSTR(STR_OBJECTS_TREE)); + maTlbObjects->SetAccessibleName(SD_RESSTR(STR_OBJECTS_TREE)); mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest); mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest); ApplyImageList(); // load images *before* calculating sizes to get something useful !!! - Size aTbxSize( maToolbox.CalcWindowSizePixel() ); - maToolbox.SetOutputSizePixel( aTbxSize ); - maToolbox.SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) ); - maToolbox.SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) ); - maToolbox.SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) ); - maToolbox.SetItemBits( TBI_DRAGTYPE, maToolbox.GetItemBits( TBI_DRAGTYPE ) | ToolBoxItemBits::DROPDOWNONLY ); + Size aTbxSize( maToolbox->CalcWindowSizePixel() ); + maToolbox->SetOutputSizePixel( aTbxSize ); + maToolbox->SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) ); + maToolbox->SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) ); + maToolbox->SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) ); + maToolbox->SetItemBits( TBI_DRAGTYPE, maToolbox->GetItemBits( TBI_DRAGTYPE ) | ToolBoxItemBits::DROPDOWNONLY ); // Shape filter drop down menu. - maToolbox.SetItemBits( + maToolbox->SetItemBits( TBI_SHAPE_FILTER, - maToolbox.GetItemBits(TBI_SHAPE_FILTER) | ToolBoxItemBits::DROPDOWNONLY); + maToolbox->GetItemBits(TBI_SHAPE_FILTER) | ToolBoxItemBits::DROPDOWNONLY); // TreeListBox // set position below toolbox - long nListboxYPos = maToolbox.GetPosPixel().Y() + maToolbox.GetSizePixel().Height() + 4; - maTlbObjects.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); - maTlbObjects.SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) ); - maTlbObjects.SetSelectionMode( SINGLE_SELECTION ); + long nListboxYPos = maToolbox->GetPosPixel().Y() + maToolbox->GetSizePixel().Height() + 4; + maTlbObjects->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + maTlbObjects->SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) ); + maTlbObjects->SetSelectionMode( SINGLE_SELECTION ); // set focus to listbox, otherwise it is in the toolbox which is only useful // for keyboard navigation - maTlbObjects.GrabFocus(); - maTlbObjects.SetSdNavigatorWinFlag(true); + maTlbObjects->GrabFocus(); + maTlbObjects->SetSdNavigatorWinFlag(true); // DragTypeListBox - maLbDocs.SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) ); + maLbDocs->SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) ); // set position below treelistbox - nListboxYPos = maTlbObjects.GetPosPixel().Y() + maTlbObjects.GetSizePixel().Height() + 4; - maLbDocs.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + nListboxYPos = maTlbObjects->GetPosPixel().Y() + maTlbObjects->GetSizePixel().Height() + 4; + maLbDocs->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); // assure that tool box is at least as wide as the tree list box { - const Size aTlbSize( maTlbObjects.GetOutputSizePixel() ); + const Size aTlbSize( maTlbObjects->GetOutputSizePixel() ); if ( aTlbSize.Width() > aTbxSize.Width() ) { - maToolbox.setPosSizePixel( 0, 0, aTlbSize.Width(), 0, WINDOW_POSSIZE_WIDTH ); - aTbxSize = maToolbox.GetOutputSizePixel(); + maToolbox->setPosSizePixel( 0, 0, aTlbSize.Width(), 0, WINDOW_POSSIZE_WIDTH ); + aTbxSize = maToolbox->GetOutputSizePixel(); } } // set min outputsize after all sizes are known - const long nFullHeight = nListboxYPos + maLbDocs.GetSizePixel().Height() + 4; + const long nFullHeight = nListboxYPos + maLbDocs->GetSizePixel().Height() + 4; maSize = GetOutputSizePixel(); if( maSize.Height() < nFullHeight ) { @@ -137,7 +137,7 @@ SdNavigatorWin::SdNavigatorWin( SetOutputSizePixel( maSize ); } maMinSize = maSize; - const long nMinWidth = 2*maToolbox.GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox + const long nMinWidth = 2*maToolbox->GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox if( nMinWidth > maMinSize.Width() ) maMinSize.Width() = nMinWidth; maMinSize.Height() -= 40; @@ -152,8 +152,17 @@ SdNavigatorWin::SdNavigatorWin( SdNavigatorWin::~SdNavigatorWin() { + disposeOnce(); +} + +void SdNavigatorWin::dispose() +{ delete mpNavigatorCtrlItem; delete mpPageNameCtrlItem; + maToolbox.disposeAndClear(); + maTlbObjects.disposeAndClear(); + maLbDocs.disposeAndClear(); + vcl::Window::dispose(); } //when object is marked , fresh the corresponding entry tree . @@ -163,17 +172,17 @@ void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc ) sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh(); OUString aDocShName( pDocShell->GetName() ); OUString aDocName = pDocShell->GetMedium()->GetName(); - maTlbObjects.SetSaveTreeItemStateFlag(true); //Added by yanjun for sym2_6385 - maTlbObjects.Clear(); - maTlbObjects.Fill( pDoc, false, aDocName ); // Nur normale Seiten - maTlbObjects.SetSaveTreeItemStateFlag(false); //Added by yanjun for sym2_6385 + maTlbObjects->SetSaveTreeItemStateFlag(true); //Added by yanjun for sym2_6385 + maTlbObjects->Clear(); + maTlbObjects->Fill( pDoc, false, aDocName ); // Nur normale Seiten + maTlbObjects->SetSaveTreeItemStateFlag(false); //Added by yanjun for sym2_6385 RefreshDocumentLB(); - maLbDocs.SelectEntry( aDocShName ); + maLbDocs->SelectEntry( aDocShName ); } void SdNavigatorWin::FreshEntry( ) { - maTlbObjects.FreshCurEntry(); + maTlbObjects->FreshCurEntry(); } void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc ) @@ -189,35 +198,35 @@ void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc ) { ::sd::FrameView* pFrameView = pViewShell->GetFrameView(); if (pFrameView != NULL) - maTlbObjects.SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false); + maTlbObjects->SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false); } // Disable the shape filter drop down menu when there is a running slide // show. if (pViewShell!=NULL && sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() )) - maToolbox.EnableItem(TBI_SHAPE_FILTER, false); + maToolbox->EnableItem(TBI_SHAPE_FILTER, false); else - maToolbox.EnableItem(TBI_SHAPE_FILTER); + maToolbox->EnableItem(TBI_SHAPE_FILTER); - if( !maTlbObjects.IsEqualToDoc( pDoc ) ) + if( !maTlbObjects->IsEqualToDoc( pDoc ) ) { OUString aDocName = pDocShell->GetMedium()->GetName(); - maTlbObjects.Clear(); - maTlbObjects.Fill( pDoc, false, aDocName ); // only normal pages + maTlbObjects->Clear(); + maTlbObjects->Fill( pDoc, false, aDocName ); // only normal pages RefreshDocumentLB(); - maLbDocs.SelectEntry( aDocShName ); + maLbDocs->SelectEntry( aDocShName ); } else { - maLbDocs.SetNoSelection(); - maLbDocs.SelectEntry( aDocShName ); + maLbDocs->SetNoSelection(); + maLbDocs->SelectEntry( aDocShName ); // commented in order to fix 30246 -// if( maLbDocs.GetSelectEntryCount() == 0 ) +// if( maLbDocs->GetSelectEntryCount() == 0 ) { RefreshDocumentLB(); - maLbDocs.SelectEntry( aDocShName ); + maLbDocs->SelectEntry( aDocShName ); } } @@ -235,7 +244,7 @@ NavigatorDragType SdNavigatorWin::GetNavigatorDragType() NavigatorDragType eDT = meDragType; NavDocInfo* pInfo = GetDocInfo(); - if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) ) + if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() ) ) eDT = NAVIGATOR_DRAGTYPE_NONE; return eDT; @@ -252,7 +261,7 @@ sd::DrawDocShell* SdNavigatorWin::GetDrawDocShell( const SdDrawDocument* pDoc ) IMPL_LINK_NOARG(SdNavigatorWin, SelectToolboxHdl) { - sal_uInt16 nId = maToolbox.GetCurItemId(); + sal_uInt16 nId = maToolbox->GetCurItemId(); sal_uInt16 nSId = 0; PageJump ePage = PAGE_NONE; @@ -307,7 +316,7 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickToolboxHdl) IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) { - sal_uInt16 nId = maToolbox.GetCurItemId(); + sal_uInt16 nId = maToolbox->GetCurItemId(); switch( nId ) { @@ -339,7 +348,7 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) } NavDocInfo* pInfo = GetDocInfo(); - if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) + if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() ) { pMenu->EnableItem( NAVIGATOR_DRAGTYPE_LINK, false ); pMenu->EnableItem( NAVIGATOR_DRAGTYPE_URL, false ); @@ -349,7 +358,7 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) pMenu->CheckItem( (sal_uInt16)meDragType ); pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, MenuSelectHdl ) ); - pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); + pMenu->Execute( this, maToolbox->GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); pBox->EndSelection(); delete pMenu; } @@ -366,13 +375,13 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) nShowAllShapesFilter, SD_RESSTR(STR_NAVIGATOR_SHOW_ALL_SHAPES)); - if (maTlbObjects.GetShowAllShapes()) + if (maTlbObjects->GetShowAllShapes()) pMenu->CheckItem(nShowAllShapesFilter); else pMenu->CheckItem(nShowNamedShapesFilter); pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, ShapeFilterCallback ) ); - pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); + pMenu->Execute( this, maToolbox->GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); pBox->EndSelection(); delete pMenu; } @@ -383,14 +392,14 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl) { - if( !mbDocImported || maLbDocs.GetSelectEntryPos() != 0 ) + if( !mbDocImported || maLbDocs->GetSelectEntryPos() != 0 ) { NavDocInfo* pInfo = GetDocInfo(); // if it is the active window, we jump to the page if( pInfo && pInfo->IsActive() ) { - OUString aStr( maTlbObjects.GetSelectEntry() ); + OUString aStr( maTlbObjects->GetSelectEntry() ); if( !aStr.isEmpty() ) { @@ -398,7 +407,7 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl) mpBindings->GetDispatcher()->Execute( SID_NAVIGATOR_OBJECT, SfxCallMode::SLOT | SfxCallMode::RECORD, &aItem, 0L ); //set sign variable - maTlbObjects.MarkCurEntry(aStr); + maTlbObjects->MarkCurEntry(aStr); // moved here from SetGetFocusHdl. Reset the // focus only if something has been selected in the @@ -419,8 +428,8 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl) IMPL_LINK_NOARG(SdNavigatorWin, SelectDocumentHdl) { - OUString aStrLb = maLbDocs.GetSelectEntry(); - long nPos = maLbDocs.GetSelectEntryPos(); + OUString aStrLb = maLbDocs->GetSelectEntry(); + long nPos = maLbDocs->GetSelectEntryPos(); bool bFound = false; ::sd::DrawDocShell* pDocShell = NULL; NavDocInfo* pInfo = GetDocInfo(); @@ -441,18 +450,18 @@ IMPL_LINK_NOARG(SdNavigatorWin, SelectDocumentHdl) if( bFound ) { SdDrawDocument* pDoc = pDocShell->GetDoc(); - if( !maTlbObjects.IsEqualToDoc( pDoc ) ) + if( !maTlbObjects->IsEqualToDoc( pDoc ) ) { SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can... ::sd::DrawDocShell* pNCDocShell = pNonConstDoc->GetDocSh(); OUString aDocName = pNCDocShell->GetMedium()->GetName(); - maTlbObjects.Clear(); - maTlbObjects.Fill( pDoc, false, aDocName ); // only normal pages + maTlbObjects->Clear(); + maTlbObjects->Fill( pDoc, false, aDocName ); // only normal pages } } // check if link or url is possible - if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) ) + if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) ) { meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED; SetDragImage(); @@ -484,13 +493,13 @@ IMPL_LINK( SdNavigatorWin, MenuSelectHdl, Menu *, pMenu ) if( meDragType == NAVIGATOR_DRAGTYPE_URL ) { // patch, prevents endless loop - if( maTlbObjects.GetSelectionCount() > 1 ) - maTlbObjects.SelectAll( false ); + if( maTlbObjects->GetSelectionCount() > 1 ) + maTlbObjects->SelectAll( false ); - maTlbObjects.SetSelectionMode( SINGLE_SELECTION ); + maTlbObjects->SetSelectionMode( SINGLE_SELECTION ); } else - maTlbObjects.SetSelectionMode( MULTIPLE_SELECTION ); + maTlbObjects->SetSelectionMode( MULTIPLE_SELECTION ); } } return 0; @@ -500,7 +509,7 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu ) { if (pMenu != NULL) { - bool bShowAllShapes (maTlbObjects.GetShowAllShapes()); + bool bShowAllShapes (maTlbObjects->GetShowAllShapes()); sal_uInt16 nMenuId (pMenu->GetCurItemId()); switch (nMenuId) { @@ -518,7 +527,7 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu ) break; } - maTlbObjects.SetShowAllShapes(bShowAllShapes, true); + maTlbObjects->SetShowAllShapes(bShowAllShapes, true); // Remember the selection in the FrameView. NavDocInfo* pInfo = GetDocInfo(); @@ -554,26 +563,26 @@ void SdNavigatorWin::Resize() aDiffSize.Height() = aWinSize.Height() - maSize.Height(); // change size of Toolbox - Size aObjSize( maToolbox.GetOutputSizePixel() ); + Size aObjSize( maToolbox->GetOutputSizePixel() ); aObjSize.Width() += aDiffSize.Width(); - maToolbox.SetOutputSizePixel( aObjSize ); + maToolbox->SetOutputSizePixel( aObjSize ); // change size of TreeLB - aObjSize = maTlbObjects.GetSizePixel(); + aObjSize = maTlbObjects->GetSizePixel(); aObjSize.Width() += aDiffSize.Width(); - aObjSize.Height() = maLbDocs.GetPosPixel().Y() + aDiffSize.Height() - - maTlbObjects.GetPosPixel().Y() - 4; - maTlbObjects.SetSizePixel( aObjSize ); + aObjSize.Height() = maLbDocs->GetPosPixel().Y() + aDiffSize.Height() - + maTlbObjects->GetPosPixel().Y() - 4; + maTlbObjects->SetSizePixel( aObjSize ); Point aPt( 0, aDiffSize.Height() ); // move other controls (DocumentLB) - maLbDocs.Hide(); - aObjSize = maLbDocs.GetOutputSizePixel(); + maLbDocs->Hide(); + aObjSize = maLbDocs->GetOutputSizePixel(); aObjSize.Width() += aDiffSize.Width(); - maLbDocs.SetPosPixel( maLbDocs.GetPosPixel() + aPt ); - maLbDocs.SetOutputSizePixel( aObjSize ); - maLbDocs.Show(); + maLbDocs->SetPosPixel( maLbDocs->GetPosPixel() + aPt ); + maLbDocs->SetOutputSizePixel( aObjSize ); + maLbDocs->Show(); maSize = aWinSize; } @@ -623,19 +632,19 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName) if (pMedium->IsStorage()) { // Now depending on mode: - // maTlbObjects.SetSelectionMode(MULTIPLE_SELECTION); + // maTlbObjects->SetSelectionMode(MULTIPLE_SELECTION); // handover of ownership of pMedium; - SdDrawDocument* pDropDoc = maTlbObjects.GetBookmarkDoc(pMedium); + SdDrawDocument* pDropDoc = maTlbObjects->GetBookmarkDoc(pMedium); if (pDropDoc) { - maTlbObjects.Clear(); + maTlbObjects->Clear(); maDropFileName = aFileName; - if( !maTlbObjects.IsEqualToDoc( pDropDoc ) ) + if( !maTlbObjects->IsEqualToDoc( pDropDoc ) ) { // only normal pages - maTlbObjects.Fill(pDropDoc, false, maDropFileName); + maTlbObjects->Fill(pDropDoc, false, maDropFileName); RefreshDocumentLB( &maDropFileName ); } } @@ -662,28 +671,28 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName ) if( pDocName ) { if( mbDocImported ) - maLbDocs.RemoveEntry( 0 ); + maLbDocs->RemoveEntry( 0 ); - maLbDocs.InsertEntry( *pDocName, 0 ); + maLbDocs->InsertEntry( *pDocName, 0 ); mbDocImported = true; } else { - nPos = maLbDocs.GetSelectEntryPos(); + nPos = maLbDocs->GetSelectEntryPos(); if( nPos == LISTBOX_ENTRY_NOTFOUND ) nPos = 0; OUString aStr; if( mbDocImported ) - aStr = maLbDocs.GetEntry( 0 ); + aStr = maLbDocs->GetEntry( 0 ); - maLbDocs.Clear(); + maLbDocs->Clear(); // delete list of DocInfos maDocList.clear(); if( mbDocImported ) - maLbDocs.InsertEntry( aStr, 0 ); + maLbDocs->InsertEntry( aStr, 0 ); ::sd::DrawDocShell* pCurrentDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); @@ -707,7 +716,7 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName ) // is shown in url notation! aStr = pDocShell->GetName(); - maLbDocs.InsertEntry( aStr, LISTBOX_APPEND ); + maLbDocs->InsertEntry( aStr, LISTBOX_APPEND ); if( pDocShell == pCurrentDocShell ) aInfo.SetActive(); @@ -719,7 +728,7 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName ) pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0, false ); } } - maLbDocs.SelectEntryPos( nPos ); + maLbDocs->SelectEntryPos( nPos ); } sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, bool bImage ) @@ -741,7 +750,7 @@ sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, bool bImag NavDocInfo* SdNavigatorWin::GetDocInfo() { - sal_uInt32 nPos = maLbDocs.GetSelectEntryPos(); + sal_uInt32 nPos = maLbDocs->GetSelectEntryPos(); if( mbDocImported ) { @@ -834,14 +843,14 @@ void SdNavigatorWin::DataChanged( const DataChangedEvent& rDCEvt ) void SdNavigatorWin::SetDragImage() { - maToolbox.SetItemImage( TBI_DRAGTYPE, maToolbox.GetImageList().GetImage( GetDragTypeSdResId( meDragType, true ) ) ); + maToolbox->SetItemImage( TBI_DRAGTYPE, maToolbox->GetImageList().GetImage( GetDragTypeSdResId( meDragType, true ) ) ); } void SdNavigatorWin::ApplyImageList() { - maToolbox.SetImageList( maImageList ); - maToolbox.SetItemImage(TBI_SHAPE_FILTER, Image(BitmapEx(SdResId(BMP_GRAPHIC)))); + maToolbox->SetImageList( maImageList ); + maToolbox->SetItemImage(TBI_SHAPE_FILTER, Image(BitmapEx(SdResId(BMP_GRAPHIC)))); SetDragImage(); } @@ -871,17 +880,17 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, // pen if( nState & NAVBTN_PEN_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_PEN ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_PEN ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_PEN ); if( nState & NAVBTN_PEN_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_PEN, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_PEN ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_PEN, false ); if( nState & NAVBTN_PEN_CHECKED && - !pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) ) - pNavigatorWin->maToolbox.CheckItem( TBI_PEN ); + !pNavigatorWin->maToolbox->IsItemChecked( TBI_PEN ) ) + pNavigatorWin->maToolbox->CheckItem( TBI_PEN ); if( nState & NAVBTN_PEN_UNCHECKED && - pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) ) - pNavigatorWin->maToolbox.CheckItem( TBI_PEN, false ); + pNavigatorWin->maToolbox->IsItemChecked( TBI_PEN ) ) + pNavigatorWin->maToolbox->CheckItem( TBI_PEN, false ); // only if doc in LB is the active NavDocInfo* pInfo = pNavigatorWin->GetDocInfo(); @@ -889,35 +898,35 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, { // First if( nState & NAVBTN_FIRST_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_FIRST ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_FIRST ); if( nState & NAVBTN_FIRST_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_FIRST, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_FIRST, false ); // Prev if( nState & NAVBTN_PREV_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS ); if( nState & NAVBTN_PREV_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS, false ); // Last if( nState & NAVBTN_LAST_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_LAST ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_LAST ); if( nState & NAVBTN_LAST_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_LAST, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_LAST, false ); // Next if( nState & NAVBTN_NEXT_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_NEXT ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_NEXT ); if( nState & NAVBTN_NEXT_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_NEXT, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_NEXT, false ); if( nState & NAVTLB_UPDATE ) { @@ -956,14 +965,14 @@ void SdPageNameControllerItem::StateChanged( sal_uInt16 nSId, DBG_ASSERT( pStateItem, "SfxStringItem expected"); OUString aPageName = pStateItem->GetValue(); - if( !pNavigatorWin->maTlbObjects.HasSelectedChildren( aPageName ) ) + if( !pNavigatorWin->maTlbObjects->HasSelectedChildren( aPageName ) ) { - if( pNavigatorWin->maTlbObjects.GetSelectionMode() == MULTIPLE_SELECTION ) + if( pNavigatorWin->maTlbObjects->GetSelectionMode() == MULTIPLE_SELECTION ) { // because otherwise it is always additional select - pNavigatorWin->maTlbObjects.SelectAll( false ); + pNavigatorWin->maTlbObjects->SelectAll( false ); } - pNavigatorWin->maTlbObjects.SelectEntry( aPageName ); + pNavigatorWin->maTlbObjects->SelectEntry( aPageName ); } } } diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx index 53fb0adb873e..29bc961a7e41 100644 --- a/sd/source/ui/dlg/paragr.cxx +++ b/sd/source/ui/dlg/paragr.cxx @@ -39,17 +39,18 @@ class SdParagraphNumTabPage : public SfxTabPage public: SdParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SdParagraphNumTabPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet ); static const sal_uInt16* GetRanges(); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; private: - TriStateBox* m_pNewStartCB; - TriStateBox* m_pNewStartNumberCB; - NumericField* m_pNewStartNF; + VclPtr<TriStateBox> m_pNewStartCB; + VclPtr<TriStateBox> m_pNewStartNumberCB; + VclPtr<NumericField> m_pNewStartNF; bool mbModified; DECL_LINK( ImplNewStartHdl, void* ); @@ -72,11 +73,20 @@ SdParagraphNumTabPage::SdParagraphNumTabPage(vcl::Window* pParent, const SfxItem SdParagraphNumTabPage::~SdParagraphNumTabPage() { + disposeOnce(); } -SfxTabPage* SdParagraphNumTabPage::Create(vcl::Window *pParent, const SfxItemSet * rAttrSet) +void SdParagraphNumTabPage::dispose() { - return new SdParagraphNumTabPage( pParent, *rAttrSet ); + m_pNewStartCB.clear(); + m_pNewStartNumberCB.clear(); + m_pNewStartNF.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SdParagraphNumTabPage::Create(vcl::Window *pParent, const SfxItemSet * rAttrSet) +{ + return VclPtr<SdParagraphNumTabPage>::Create( pParent, *rAttrSet ); } const sal_uInt16* SdParagraphNumTabPage::GetRanges() diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx index c4b95a9d2458..bd635ad96676 100644 --- a/sd/source/ui/dlg/present.cxx +++ b/sd/source/ui/dlg/present.cxx @@ -150,6 +150,39 @@ SdStartPresentationDlg::SdStartPresentationDlg( vcl::Window* pWindow, ChangePauseHdl( NULL ); } +SdStartPresentationDlg::~SdStartPresentationDlg() +{ + disposeOnce(); +} + +void SdStartPresentationDlg::dispose() +{ + aRbtAll.clear(); + aRbtAtDia.clear(); + aRbtCustomshow.clear(); + aLbDias.clear(); + aLbCustomshow.clear(); + aRbtStandard.clear(); + aRbtWindow.clear(); + aRbtAuto.clear(); + aTmfPause.clear(); + aCbxAutoLogo.clear(); + aCbxManuel.clear(); + aCbxMousepointer.clear(); + aCbxPen.clear(); + aCbxNavigator.clear(); + aCbxAnimationAllowed.clear(); + aCbxChangePage.clear(); + aCbxAlwaysOnTop.clear(); + maFtMonitor.clear(); + maLBMonitor.clear(); + msMonitor.clear(); + msAllMonitors.clear(); + msMonitorExternal.clear(); + msExternal.clear(); + ModalDialog::dispose(); +} + OUString SdStartPresentationDlg::GetDisplayName( sal_Int32 nDisplay, DisplayType eType ) { diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx index e2330f9f6b2f..42a02cc15734 100644 --- a/sd/source/ui/dlg/prltempl.cxx +++ b/sd/source/ui/dlg/prltempl.cxx @@ -223,7 +223,13 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, SdPresLayoutTemplateDlg::~SdPresLayoutTemplateDlg() { + disposeOnce(); +} + +void SdPresLayoutTemplateDlg::dispose() +{ delete pOutSet; + SfxTabDialog::dispose(); } void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) diff --git a/sd/source/ui/dlg/prntopts.cxx b/sd/source/ui/dlg/prntopts.cxx index 943144be7a53..3785de353d1f 100644 --- a/sd/source/ui/dlg/prntopts.cxx +++ b/sd/source/ui/dlg/prntopts.cxx @@ -30,7 +30,7 @@ */ SdPrintOptions::SdPrintOptions( vcl::Window* pParent, const SfxItemSet& rInAttrs ) : SfxTabPage ( pParent, "prntopts" , "modules/simpress/ui/prntopts.ui" , &rInAttrs ), - rOutAttrs ( rInAttrs ) + rOutAttrs ( rInAttrs ) { get( m_pFrmContent , "contentframe" ); get( m_pCbxDraw , "drawingcb" ); @@ -74,6 +74,31 @@ SdPrintOptions::SdPrintOptions( vcl::Window* pParent, const SfxItemSet& rInAttrs SdPrintOptions::~SdPrintOptions() { + disposeOnce(); +} + +void SdPrintOptions::dispose() +{ + m_pFrmContent.clear(); + m_pCbxDraw.clear(); + m_pCbxNotes.clear(); + m_pCbxHandout.clear(); + m_pCbxOutline.clear(); + m_pRbtColor.clear(); + m_pRbtGrayscale.clear(); + m_pRbtBlackWhite.clear(); + m_pCbxPagename.clear(); + m_pCbxDate.clear(); + m_pCbxTime.clear(); + m_pCbxHiddenPages.clear(); + m_pRbtDefault.clear(); + m_pRbtPagesize.clear(); + m_pRbtPagetile.clear(); + m_pRbtBooklet.clear(); + m_pCbxFront.clear(); + m_pCbxBack.clear(); + m_pCbxPaperbin.clear(); + SfxTabPage::dispose(); } bool SdPrintOptions::FillItemSet( SfxItemSet* rAttrs ) @@ -182,10 +207,10 @@ void SdPrintOptions::Reset( const SfxItemSet* rAttrs ) ClickBookletHdl( NULL ); } -SfxTabPage* SdPrintOptions::Create( vcl::Window* pWindow, - const SfxItemSet* rOutAttrs ) +VclPtr<SfxTabPage> SdPrintOptions::Create( vcl::Window* pWindow, + const SfxItemSet* rOutAttrs ) { - return( new SdPrintOptions( pWindow, *rOutAttrs ) ); + return VclPtr<SdPrintOptions>::Create( pWindow, *rOutAttrs ); } IMPL_LINK( SdPrintOptions, ClickCheckboxHdl, CheckBox *, pCbx ) diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index 8e5c87a381d3..ad902b933e38 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -121,37 +121,37 @@ OUString SdAbstractTabDialog_Impl::GetText() const void AbstractBulletDialog_Impl::SetCurPageId( sal_uInt16 nId ) { - static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetCurPageId( nId ); + static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetCurPageId( nId ); } void AbstractBulletDialog_Impl::SetCurPageId( const OString& rName ) { - static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetCurPageId( rName ); + static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetCurPageId( rName ); } const SfxItemSet* AbstractBulletDialog_Impl::GetOutputItemSet() const { - return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetOutputItemSet(); + return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetOutputItemSet(); } const sal_uInt16* AbstractBulletDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) { - return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetInputRanges( pItem ); + return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetInputRanges( pItem ); } void AbstractBulletDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) { - static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetInputSet( pInSet ); + static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetInputSet( pInSet ); } void AbstractBulletDialog_Impl::SetText( const OUString& rStr ) { - static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetText( rStr ); + static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetText( rStr ); } OUString AbstractBulletDialog_Impl::GetText() const { - return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetText(); + return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetText(); } void SdPresLayoutTemplateDlg_Impl::SetCurPageId( sal_uInt16 nId ) @@ -391,47 +391,47 @@ AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg( AbstractSdCustomShowDlg * SdAbstractDialogFactory_Impl::CreateSdCustomShowDlg( vcl::Window* pWindow, SdDrawDocument& rDrawDoc ) { - return new AbstractSdCustomShowDlg_Impl( new SdCustomShowDlg( pWindow, rDrawDoc ) ); + return new AbstractSdCustomShowDlg_Impl( VclPtr<SdCustomShowDlg>::Create( pWindow, rDrawDoc ) ); } SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabCharDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell ) { - return new SdAbstractTabDialog_Impl( new SdCharDlg( pParent, pAttr, pDocShell ) ); + return new SdAbstractTabDialog_Impl( VclPtr<SdCharDlg>::Create( pParent, pAttr, pDocShell ) ); } SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabPageDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage ) { - return new SdAbstractTabDialog_Impl( new SdPageDlg( pDocShell, pParent, pAttr, bAreaPage ) ); + return new SdAbstractTabDialog_Impl( VclPtr<SdPageDlg>::Create( pDocShell, pParent, pAttr, bAreaPage ) ); } AbstractAssistentDlg * SdAbstractDialogFactory_Impl::CreateAssistentDlg( vcl::Window* pParent, bool bAutoPilot) { - return new AbstractAssistentDlg_Impl( new AssistentDlg( pParent, bAutoPilot ) ); + return new AbstractAssistentDlg_Impl( VclPtr<AssistentDlg>::Create( pParent, bAutoPilot ) ); } AbstractSdModifyFieldDlg * SdAbstractDialogFactory_Impl::CreateSdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ) { - return new AbstractSdModifyFieldDlg_Impl( new SdModifyFieldDlg( pWindow, pInField, rSet ) ); + return new AbstractSdModifyFieldDlg_Impl( VclPtr<SdModifyFieldDlg>::Create( pWindow, pInField, rSet ) ); } AbstractSdSnapLineDlg * SdAbstractDialogFactory_Impl::CreateSdSnapLineDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView) { - return new AbstractSdSnapLineDlg_Impl( new SdSnapLineDlg( pWindow, rInAttrs, pView ) ); + return new AbstractSdSnapLineDlg_Impl( VclPtr<SdSnapLineDlg>::Create( pWindow, rInAttrs, pView ) ); } AbstractSdInsertLayerDlg * SdAbstractDialogFactory_Impl::CreateSdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr ) { - return new AbstractSdInsertLayerDlg_Impl( new SdInsertLayerDlg( pWindow, rInAttrs, bDeletable, aStr ) ); + return new AbstractSdInsertLayerDlg_Impl( VclPtr<SdInsertLayerDlg>::Create( pWindow, rInAttrs, bDeletable, aStr ) ); } AbstractSdInsertPasteDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPasteDlg( vcl::Window* pWindow ) { - return new AbstractSdInsertPasteDlg_Impl( new SdInsertPasteDlg( pWindow ) ); + return new AbstractSdInsertPasteDlg_Impl( VclPtr<SdInsertPasteDlg>::Create( pWindow ) ); } AbstractSdInsertPagesObjsDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg( vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName ) { - return new AbstractSdInsertPagesObjsDlg_Impl( new SdInsertPagesObjsDlg( pParent, pDoc, pSfxMedium, rFileName ) ); + return new AbstractSdInsertPagesObjsDlg_Impl( VclPtr<SdInsertPagesObjsDlg>::Create( pParent, pDoc, pSfxMedium, rFileName ) ); } AbstractMorphDlg * SdAbstractDialogFactory_Impl::CreateMorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) @@ -446,13 +446,13 @@ SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdOutlineBulletTabDl SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdParagraphTabDlg( vcl::Window* pParent, const SfxItemSet* pAttr ) { - return new SdAbstractTabDialog_Impl( new SdParagraphDlg( pParent, pAttr ) ); + return new SdAbstractTabDialog_Impl( VclPtr<SdParagraphDlg>::Create( pParent, pAttr ) ); } AbstractSdStartPresDlg * SdAbstractDialogFactory_Impl::CreateSdStartPresentationDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, const std::vector<OUString> &rPageNames, SdCustomShowList* pCSList ) { - return new AbstractSdStartPresDlg_Impl( new SdStartPresentationDlg( pWindow, rInAttrs, rPageNames, pCSList ) ); + return new AbstractSdStartPresDlg_Impl( VclPtr<SdStartPresentationDlg>::Create( pWindow, rInAttrs, rPageNames, pCSList ) ); } VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateRemoteDialog( vcl::Window* pWindow ) @@ -462,32 +462,32 @@ VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateRemoteDialog( vcl::Windo SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, vcl::Window* pParent, const SdResId& DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool ) { - return new SdPresLayoutTemplateDlg_Impl( new SdPresLayoutTemplateDlg( pDocSh, pParent, DlgId, rStyleBase, ePO, pSSPool ) ); + return new SdPresLayoutTemplateDlg_Impl( VclPtr<SdPresLayoutTemplateDlg>::Create( pDocSh, pParent, DlgId, rStyleBase, ePO, pSSPool ) ); } AbstractSdPresLayoutDlg * SdAbstractDialogFactory_Impl::CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, vcl::Window* pWindow, const SfxItemSet& rInAttrs) { - return new AbstractSdPresLayoutDlg_Impl( new SdPresLayoutDlg( pDocShell, pWindow, rInAttrs ) ); + return new AbstractSdPresLayoutDlg_Impl( VclPtr<SdPresLayoutDlg>::Create( pDocShell, pWindow, rInAttrs ) ); } SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabTemplateDlg( vcl::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView ) { - return new SdAbstractTabDialog_Impl( new SdTabTemplateDlg( pParent, pDocShell, rStyleBase, pModel, pView ) ); + return new SdAbstractTabDialog_Impl( VclPtr<SdTabTemplateDlg>::Create( pParent, pDocShell, rStyleBase, pModel, pView ) ); } SfxAbstractDialog* SdAbstractDialogFactory_Impl::CreatSdActionDialog( vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ) { - return new SdAbstractSfxDialog_Impl( new SdActionDlg( pParent, pAttr, pView ) ); + return new SdAbstractSfxDialog_Impl( VclPtr<SdActionDlg>::Create( pParent, pAttr, pView ) ); } AbstractSdVectorizeDlg * SdAbstractDialogFactory_Impl::CreateSdVectorizeDlg( vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ) { - return new AbstractSdVectorizeDlg_Impl( new SdVectorizeDlg( pParent, rBmp, pDocShell ) ); + return new AbstractSdVectorizeDlg_Impl( VclPtr<SdVectorizeDlg>::Create( pParent, rBmp, pDocShell ) ); } AbstractSdPublishingDlg * SdAbstractDialogFactory_Impl::CreateSdPublishingDlg( vcl::Window* pWindow, DocumentType eDocType) { - return new AbstractSdPublishingDlg_Impl( new SdPublishingDlg( pWindow, eDocType ) ); + return new AbstractSdPublishingDlg_Impl( VclPtr<SdPublishingDlg>::Create( pWindow, eDocType ) ); } // Factories for TabPages diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index 38d6d1e4c1e7..3ba9b486d787 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -23,7 +23,7 @@ #include <sfx2/basedlgs.hxx> #define DECL_ABSTDLG_BASE(Class,DialogClass) \ - DialogClass* pDlg; \ + ScopedVclPtr<DialogClass> pDlg; \ public: \ Class( DialogClass* p) \ : pDlg(p) \ @@ -34,7 +34,6 @@ public: \ #define IMPL_ABSTDLG_BASE(Class) \ Class::~Class() \ { \ - delete pDlg; \ } \ short Class::Execute() \ { \ diff --git a/sd/source/ui/dlg/sdpreslt.cxx b/sd/source/ui/dlg/sdpreslt.cxx index 21d8a89afb6f..51206936dd07 100644 --- a/sd/source/ui/dlg/sdpreslt.cxx +++ b/sd/source/ui/dlg/sdpreslt.cxx @@ -55,6 +55,16 @@ SdPresLayoutDlg::SdPresLayoutDlg(::sd::DrawDocShell* pDocShell, SdPresLayoutDlg::~SdPresLayoutDlg() { + disposeOnce(); +} + +void SdPresLayoutDlg::dispose() +{ + m_pVS.clear(); + m_pCbxMasterPage.clear(); + m_pCbxCheckMasters.clear(); + m_pBtnLoad.clear(); + ModalDialog::dispose(); } /** @@ -169,7 +179,7 @@ IMPL_LINK_NOARG(SdPresLayoutDlg, ClickLayoutHdl) */ IMPL_LINK_NOARG(SdPresLayoutDlg, ClickLoadHdl) { - boost::scoped_ptr<SfxNewFileDialog> pDlg(new SfxNewFileDialog(this, SFXWB_PREVIEW)); + VclPtrInstance< SfxNewFileDialog > pDlg(this, SFXWB_PREVIEW); pDlg->SetText(SD_RESSTR(STR_LOAD_PRESENTATION_LAYOUT)); if(!IsReallyVisible()) diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 0a96dd736de3..5e358bf35578 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -255,11 +255,19 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle ) SdPageObjsTLB::~SdPageObjsTLB() { + disposeOnce(); +} + +void SdPageObjsTLB::dispose() +{ if ( mpBookmarkDoc ) CloseBookmarkDoc(); else // no document was created from mpMedium, so this object is still the owner of it delete mpMedium; + mpParent.clear(); + mpDropNavWin.clear(); + SvTreeListBox::dispose(); } // helper function for GetEntryAltText and GetEntryLongDescription @@ -1004,8 +1012,8 @@ SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed) if ( !mpBookmarkDoc ) { - MessageDialog aErrorBox(this, SD_RESSTR(STR_READ_DATA_ERROR)); - aErrorBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SD_RESSTR(STR_READ_DATA_ERROR)); + aErrorBox->Execute(); mpMedium = 0; //On failure the SfxMedium is invalid } } @@ -1343,7 +1351,7 @@ sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt ) OUString aFile; if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, aFile ) && - static_cast<SdNavigatorWin*>(mpParent)->InsertFile( aFile ) ) + static_cast<SdNavigatorWin*>(mpParent.get())->InsertFile( aFile ) ) { nRet = rEvt.mnAction; } diff --git a/sd/source/ui/dlg/sduiexp.cxx b/sd/source/ui/dlg/sduiexp.cxx index 3c526380a538..84127950fcd2 100644 --- a/sd/source/ui/dlg/sduiexp.cxx +++ b/sd/source/ui/dlg/sduiexp.cxx @@ -18,6 +18,21 @@ */ #include "sddlgfact.hxx" +#include "morphdlg.hxx" +#include "present.hxx" +#include "inspagob.hxx" +#include "vectdlg.hxx" +#include "sdpreslt.hxx" +#include "headerfooterdlg.hxx" +#include "pubdlg.hxx" +#include "ins_paste.hxx" +#include "layeroptionsdlg.hxx" +#include "dlgsnap.hxx" +#include "dlgfield.hxx" +#include "dlgass.hxx" +#include "prltempl.hxx" +#include "custsdlg.hxx" +#include "copydlg.hxx" #include "sal/types.h" extern "C" diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 253e7142aa34..e038120c6a00 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -83,12 +83,12 @@ SdActionDlg::SdActionDlg ( , rOutAttrs(*pAttr) { // FreeResource(); - SfxTabPage* pNewPage = SdTPAction::Create(get_content_area(), rOutAttrs); + VclPtr<SfxTabPage> pNewPage = SdTPAction::Create(get_content_area(), rOutAttrs); assert(pNewPage); //Unable to create page // formerly in PageCreated - static_cast<SdTPAction*>( pNewPage )->SetView( pView ); - static_cast<SdTPAction*>( pNewPage )->Construct(); + static_cast<SdTPAction*>( pNewPage.get() )->SetView( pView ); + static_cast<SdTPAction*>( pNewPage.get() )->Construct(); SetTabPage( pNewPage ); } @@ -142,6 +142,25 @@ SdTPAction::SdTPAction(vcl::Window* pWindow, const SfxItemSet& rInAttrs) SdTPAction::~SdTPAction() { + disposeOnce(); +} + +void SdTPAction::dispose() +{ + m_pLbAction.clear(); + m_pFtTree.clear(); + m_pLbTree.clear(); + m_pLbTreeDocument.clear(); + m_pLbOLEAction.clear(); + m_pFrame.clear(); + m_pEdtSound.clear(); + m_pEdtBookmark.clear(); + m_pEdtDocument.clear(); + m_pEdtProgram.clear(); + m_pEdtMacro.clear(); + m_pBtnSearch.clear(); + m_pBtnSeek.clear(); + SfxTabPage::dispose(); } void SdTPAction::SetView( const ::sd::View* pSdView ) @@ -359,10 +378,10 @@ SfxTabPage::sfxpg SdTPAction::DeactivatePage( SfxItemSet* pPageSet ) return LEAVE_PAGE; } -SfxTabPage* SdTPAction::Create( vcl::Window* pWindow, - const SfxItemSet& rAttrs ) +VclPtr<SfxTabPage> SdTPAction::Create( vcl::Window* pWindow, + const SfxItemSet& rAttrs ) { - return new SdTPAction( pWindow, rAttrs ); + return VclPtr<SdTPAction>::Create( pWindow, rAttrs ); } void SdTPAction::UpdateTree() diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index cc69f5e8627a..35c5cb3435af 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -99,10 +99,10 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs ) pCbxRotate->GetClickHdl().Call(0); } -SfxTabPage* SdTpOptionsSnap::Create( vcl::Window* pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SdTpOptionsSnap::Create( vcl::Window* pWindow, + const SfxItemSet* rAttrs ) { - return new SdTpOptionsSnap( pWindow, *rAttrs ); + return VclPtr<SdTpOptionsSnap>::Create( pWindow, *rAttrs ); } /************************************************************************* @@ -122,6 +122,16 @@ SdTpOptionsContents::SdTpOptionsContents( vcl::Window* pParent, const SfxItemSet SdTpOptionsContents::~SdTpOptionsContents() { + disposeOnce(); +} + +void SdTpOptionsContents::dispose() +{ + m_pCbxRuler.clear(); + m_pCbxDragStripes.clear(); + m_pCbxHandlesBezier.clear(); + m_pCbxMoveOutline.clear(); + SfxTabPage::dispose(); } bool SdTpOptionsContents::FillItemSet( SfxItemSet* rAttrs ) @@ -165,10 +175,10 @@ void SdTpOptionsContents::Reset( const SfxItemSet* rAttrs ) m_pCbxHandlesBezier->SaveValue(); } -SfxTabPage* SdTpOptionsContents::Create( vcl::Window* pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SdTpOptionsContents::Create( vcl::Window* pWindow, + const SfxItemSet* rAttrs ) { - return new SdTpOptionsContents( pWindow, *rAttrs ); + return VclPtr<SdTpOptionsContents>::Create( pWindow, *rAttrs ); } /************************************************************************* @@ -276,6 +286,38 @@ SdTpOptionsMisc::SdTpOptionsMisc(vcl::Window* pParent, const SfxItemSet& rInAttr SdTpOptionsMisc::~SdTpOptionsMisc() { + disposeOnce(); +} + +void SdTpOptionsMisc::dispose() +{ + m_pCbxQuickEdit.clear(); + m_pCbxPickThrough.clear(); + m_pNewDocumentFrame.clear(); + m_pCbxStartWithTemplate.clear(); + m_pCbxMasterPageCache.clear(); + m_pCbxCopy.clear(); + m_pCbxMarkedHitMovesAlways.clear(); + m_pPresentationFrame.clear(); + m_pLbMetric.clear(); + m_pMtrFldTabstop.clear(); + m_pCbxEnableSdremote.clear(); + m_pCbxEnablePresenterScreen.clear(); + m_pCbxUsePrinterMetrics.clear(); + m_pCbxCompatibility.clear(); + m_pScaleFrame.clear(); + m_pCbScale.clear(); + m_pNewDocLb.clear(); + m_pFiInfo1.clear(); + m_pMtrFldOriginalWidth.clear(); + m_pWidthLb.clear(); + m_pHeightLb.clear(); + m_pFiInfo2.clear(); + m_pMtrFldOriginalHeight.clear(); + m_pCbxDistrot.clear(); + m_pMtrFldInfo1.clear(); + m_pMtrFldInfo2.clear(); + SfxTabPage::dispose(); } void SdTpOptionsMisc::ActivatePage( const SfxItemSet& rSet ) @@ -331,10 +373,9 @@ SfxTabPage::sfxpg SdTpOptionsMisc::DeactivatePage( SfxItemSet* pActiveSet ) FillItemSet( pActiveSet ); return LEAVE_PAGE; } - WarningBox aWarnBox( GetParent(), WB_YES_NO, SD_RESSTR( STR_WARN_SCALE_FAIL ) ); - short nReturn = aWarnBox.Execute(); + ScopedVclPtrInstance< WarningBox > aWarnBox( GetParent(), WB_YES_NO, SD_RESSTR( STR_WARN_SCALE_FAIL ) ); - if( nReturn == RET_YES ) + if( aWarnBox->Execute() == RET_YES ) return KEEP_PAGE; if( pActiveSet ) @@ -488,10 +529,10 @@ void SdTpOptionsMisc::Reset( const SfxItemSet* rAttrs ) UpdateCompatibilityControls (); } -SfxTabPage* SdTpOptionsMisc::Create( vcl::Window* pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SdTpOptionsMisc::Create( vcl::Window* pWindow, + const SfxItemSet* rAttrs ) { - return new SdTpOptionsMisc( pWindow, *rAttrs ); + return VclPtr<SdTpOptionsMisc>::Create( pWindow, *rAttrs ); } IMPL_LINK_NOARG(SdTpOptionsMisc, SelectMetricHdl_Impl) diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index f533073cfe32..d7cde0582f7e 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -72,6 +72,22 @@ SdVectorizeDlg::SdVectorizeDlg(vcl::Window* pParent, const Bitmap& rBmp, ::sd::D SdVectorizeDlg::~SdVectorizeDlg() { + disposeOnce(); +} + +void SdVectorizeDlg::dispose() +{ + m_pNmLayers.clear(); + m_pMtReduce.clear(); + m_pFtFillHoles.clear(); + m_pMtFillHoles.clear(); + m_pCbFillHoles.clear(); + m_pBmpWin.clear(); + m_pMtfWin.clear(); + m_pPrgs.clear(); + m_pBtnOK.clear(); + m_pBtnPreview.clear(); + ModalDialog::dispose(); } Rectangle SdVectorizeDlg::GetRect( const Size& rDispSize, const Size& rBmpSize ) const diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx index 1646ed348244..b4e66d5caf4c 100644 --- a/sd/source/ui/docshell/docshel2.cxx +++ b/sd/source/ui/docshell/docshel2.cxx @@ -193,26 +193,26 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixe MapMode aMapMode( MAP_100TH_MM ); const Size aSize( pPage->GetSize() ); const Point aNullPt; - VirtualDevice aVDev( *Application::GetDefaultDevice() ); + ScopedVclPtrInstance< VirtualDevice > pVDev( *Application::GetDefaultDevice() ); - aVDev.SetMapMode( aMapMode ); + pVDev->SetMapMode( aMapMode ); - const Size aPixSize( aVDev.LogicToPixel( aSize ) ); + const Size aPixSize( pVDev->LogicToPixel( aSize ) ); const sal_uLong nMaxEdgePix = std::max( aPixSize.Width(), aPixSize.Height() ); Fraction aFrac( nMaxEdgePixel, nMaxEdgePix ); aMapMode.SetScaleX( aFrac ); aMapMode.SetScaleY( aFrac ); - aVDev.SetMapMode( aMapMode ); - aVDev.SetOutputSize( aSize ); + pVDev->SetMapMode( aMapMode ); + pVDev->SetOutputSize( aSize ); // that we also get the dark lines at the right and bottom page margin aFrac = Fraction( nMaxEdgePixel - 1, nMaxEdgePix ); aMapMode.SetScaleX( aFrac ); aMapMode.SetScaleY( aFrac ); - aVDev.SetMapMode( aMapMode ); + pVDev->SetMapMode( aMapMode ); - ClientView* pView = new ClientView( this, &aVDev, NULL ); + ClientView* pView = new ClientView( this, pVDev, NULL ); FrameView* pFrameView = GetFrameView(); pView->ShowSdrPage( pPage ); @@ -263,14 +263,14 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixe pView->SetActiveLayer( pFrameView->GetActiveLayer() ); } - pView->CompleteRedraw( &aVDev, vcl::Region(Rectangle(aNullPt, aSize)) ); + pView->CompleteRedraw( pVDev, vcl::Region(Rectangle(aNullPt, aSize)) ); // IsRedrawReady() always gives sal_True while ( !pView->IsRedrawReady() ) {} delete pView; - aVDev.SetMapMode( MapMode() ); + pVDev->SetMapMode( MapMode() ); - Bitmap aPreview( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) ); + Bitmap aPreview( pVDev->GetBitmap( aNullPt, pVDev->GetOutputSizePixel() ) ); DBG_ASSERT(!!aPreview, "Preview-Bitmap could not be generated"); diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 2705eaed58b6..05edd42ed21f 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -109,7 +109,7 @@ SfxPrinter* DrawDocShell::GetPrinter(bool bCreate) pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.GetOptionsPrint().IsWarningPrinter() ) ); pSet->Put( aFlagItem ); - mpPrinter = new SfxPrinter(pSet); + mpPrinter = VclPtr<SfxPrinter>::Create(pSet); mbOwnPrinter = true; // set output quality @@ -144,10 +144,8 @@ void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter) pView->SdrEndTextEdit(); } - if ( mpPrinter && mbOwnPrinter && (mpPrinter != pNewPrinter) ) - { - delete mpPrinter; - } + if ( mpPrinter && mbOwnPrinter && (mpPrinter.get() != pNewPrinter) ) + mpPrinter.disposeAndClear(); mpPrinter = pNewPrinter; mbOwnPrinter = true; @@ -204,11 +202,11 @@ void DrawDocShell::UpdateRefDevice() if( mpDoc ) { // Determine the device for which the output will be formatted. - OutputDevice* pRefDevice = NULL; + VclPtr< OutputDevice > pRefDevice; switch (mpDoc->GetPrinterIndependentLayout()) { case ::com::sun::star::document::PrinterIndependentLayout::DISABLED: - pRefDevice = mpPrinter; + pRefDevice = mpPrinter.get(); break; case ::com::sun::star::document::PrinterIndependentLayout::ENABLED: @@ -221,10 +219,10 @@ void DrawDocShell::UpdateRefDevice() // as a fall-back. DBG_ASSERT(false, "DrawDocShell::UpdateRefDevice(): Unexpected printer layout mode"); - pRefDevice = mpPrinter; + pRefDevice = mpPrinter.get(); break; } - mpDoc->SetRefDevice( pRefDevice ); + mpDoc->SetRefDevice( pRefDevice.get() ); ::sd::Outliner* pOutl = mpDoc->GetOutliner( false ); @@ -1132,9 +1130,9 @@ void DrawDocShell::OpenBookmark( const OUString& rBookmarkURL ) ( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs ); } -SfxDocumentInfoDialog* DrawDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet ) +VclPtr<SfxDocumentInfoDialog> DrawDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet ) { - SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog( pParent, rSet ); + VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create( pParent, rSet ); DrawDocShell* pDocSh = PTR_CAST(DrawDocShell,SfxObjectShell::Current()); if( pDocSh == this ) diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index f49f523eaec5..ca32796f60db 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -185,7 +185,7 @@ DrawDocShell::~DrawDocShell() delete mpUndoManager; if (mbOwnPrinter) - delete mpPrinter; + mpPrinter.disposeAndClear(); if( mbOwnDocument ) delete mpDoc; diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 21be69f667a8..065499bac8e5 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -91,7 +91,7 @@ BasicViewFactory::BasicViewFactory ( mpViewShellContainer(new ViewShellContainer()), mpBase(NULL), mpFrameView(NULL), - mpWindow(new WorkWindow(NULL,WB_STDWORK)), + mpWindow(VclPtr<WorkWindow>::Create(nullptr,WB_STDWORK)), mpViewCache(new ViewCache()), mxLocalPane(new Pane(Reference<XResourceId>(), mpWindow.get())) { diff --git a/sd/source/ui/framework/factories/BasicViewFactory.hxx b/sd/source/ui/framework/factories/BasicViewFactory.hxx index 6d6d89591fa3..1f4cd342bdb9 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.hxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.hxx @@ -34,6 +34,7 @@ #include <boost/shared_ptr.hpp> #include <boost/scoped_ptr.hpp> +#include <vcl/vclptr.hxx> namespace sd { class ViewShell; @@ -104,7 +105,7 @@ private: FrameView* mpFrameView; class ViewCache; - ::boost::shared_ptr<vcl::Window> mpWindow; + VclPtr<vcl::Window> mpWindow; ::boost::shared_ptr<ViewCache> mpViewCache; css::uno::Reference<css::drawing::framework::XPane> mxLocalPane; diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx b/sd/source/ui/framework/factories/ChildWindowPane.cxx index 69e79836ba6f..9f70355fb5f0 100644 --- a/sd/source/ui/framework/factories/ChildWindowPane.cxx +++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx @@ -188,7 +188,7 @@ void SAL_CALL ChildWindowPane::disposing() Reference<awt::XWindow> SAL_CALL ChildWindowPane::getWindow() throw (RuntimeException, std::exception) { - if (mpWindow == NULL || ! mxWindow.is()) + if (mpWindow == nullptr || ! mxWindow.is()) GetWindow(); return Pane::getWindow(); } diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx index 009975465541..ba793b25961c 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.cxx +++ b/sd/source/ui/framework/factories/FullScreenPane.cxx @@ -46,7 +46,8 @@ FullScreenPane::FullScreenPane ( mpWorkWindow(NULL) { vcl::Window* pParent = NULL; - mpWorkWindow.reset(new WorkWindow( + mpWorkWindow.reset(VclPtr<WorkWindow>::Create( + pParent, 0)); // For debugging (non-fullscreen) use WB_BORDER | WB_MOVEABLE | WB_SIZEABLE)); @@ -86,7 +87,7 @@ FullScreenPane::FullScreenPane ( // For some reason the VCL canvas can not paint into a WorkWindow. // Therefore a child window is created that covers the WorkWindow // completely. - mpWindow = new vcl::Window(mpWorkWindow.get()); + mpWindow = VclPtr<vcl::Window>::Create(mpWorkWindow.get()); mpWindow->SetPosSizePixel(Point(0,0), mpWorkWindow->GetSizePixel()); mpWindow->SetBackground(Wallpaper()); mxWindow = VCLUnoHelper::GetInterface(mpWindow); @@ -103,11 +104,7 @@ FullScreenPane::~FullScreenPane() throw() void SAL_CALL FullScreenPane::disposing() { - // We have created the window pointed to by mpWindow, we delete it. - if (mpWindow != NULL) - { - delete mpWindow; - } + mpWindow.disposeAndClear(); if (mpWorkWindow.get() != NULL) { @@ -126,7 +123,7 @@ sal_Bool SAL_CALL FullScreenPane::isVisible() { ThrowIfDisposed(); - if (mpWindow != NULL) + if (mpWindow != nullptr) return mpWindow->IsReallyVisible(); else return false; @@ -137,9 +134,9 @@ void SAL_CALL FullScreenPane::setVisible (const sal_Bool bIsVisible) { ThrowIfDisposed(); - if (mpWindow != NULL) + if (mpWindow != nullptr) mpWindow->Show(bIsVisible); - if (mpWorkWindow != 0) + if (mpWorkWindow != nullptr) mpWorkWindow->Show(bIsVisible); } @@ -148,7 +145,7 @@ Reference<css::accessibility::XAccessible> SAL_CALL FullScreenPane::getAccessibl { ThrowIfDisposed(); - if (mpWorkWindow != 0) + if (mpWorkWindow != nullptr) return mpWorkWindow->GetAccessible(false); else return NULL; @@ -160,7 +157,7 @@ void SAL_CALL FullScreenPane::setAccessible ( { ThrowIfDisposed(); - if (mpWindow != NULL) + if (mpWindow != nullptr) { Reference<lang::XInitialization> xInitializable (rxAccessible, UNO_QUERY); if (xInitializable.is()) diff --git a/sd/source/ui/framework/factories/FullScreenPane.hxx b/sd/source/ui/framework/factories/FullScreenPane.hxx index 0c2e1afac517..7e5e839f647e 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.hxx +++ b/sd/source/ui/framework/factories/FullScreenPane.hxx @@ -80,7 +80,7 @@ protected: private: css::uno::Reference<css::uno::XComponentContext> mxComponentContext; - ::boost::scoped_ptr<WorkWindow> mpWorkWindow; + VclPtr<WorkWindow> mpWorkWindow; void ExtractArguments ( const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx index 0fd14c668bb2..696724e4d863 100644 --- a/sd/source/ui/framework/factories/Pane.cxx +++ b/sd/source/ui/framework/factories/Pane.cxx @@ -175,7 +175,7 @@ Reference<rendering::XCanvas> Pane::CreateCanvas() { Reference<rendering::XCanvas> xCanvas; - if (mpWindow != NULL) + if (mpWindow != nullptr) { ::cppcanvas::SpriteCanvasSharedPtr pCanvas ( cppcanvas::VCLFactory::createSpriteCanvas(*mpWindow)); diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index bd21323f0984..a12d8b2ed52a 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -151,8 +151,8 @@ void FuInsertGraphic::DoExecute( SfxRequest& ) // really store as link only? if( SvtMiscOptions().ShowLinkWarningDialog() ) { - SvxLinkWarningDialog aWarnDlg(mpWindow,aDlg.GetPath()); - if( aWarnDlg.Execute() != RET_OK ) + ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(mpWindow,aDlg.GetPath()); + if( aWarnDlg->Execute() != RET_OK ) return; // don't store as link } diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 7b554d2f74d7..c0bbd9f3deeb 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -317,8 +317,8 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) if( !bInserted ) { - MessageDialog aErrorBox(mpWindow, SD_RESSTR( STR_READ_DATA_ERROR)); - aErrorBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SD_RESSTR( STR_READ_DATA_ERROR)); + aErrorBox->Execute(); delete pMedium; } } @@ -467,8 +467,8 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) if (nErr || pOutliner->GetEditEngine().GetText().isEmpty()) { - MessageDialog aErrorBox(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR)); - aErrorBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR)); + aErrorBox->Execute(); } else { @@ -611,8 +611,8 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) if (nErr || pOutliner->GetEditEngine().GetText().isEmpty()) { - MessageDialog aErrorBox(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR)); - aErrorBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR)); + aErrorBox->Execute(); } else { diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx index e8f441cc7398..b963b06e5cf8 100644 --- a/sd/source/ui/func/fulinend.cxx +++ b/sd/source/ui/func/fulinend.cxx @@ -138,9 +138,9 @@ void FuLineEnd::DoExecute( SfxRequest& ) } else { - WarningBox aWarningBox( mpWindow, WinBits( WB_OK ), + ScopedVclPtrInstance<WarningBox> aWarningBox( mpWindow, WinBits( WB_OK ), SD_RESSTR( STR_WARN_NAME_DUPLICATE ) ); - aWarningBox.Execute(); + aWarningBox->Execute(); } } } diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index bbccfbcaa613..a099da6dc8ed 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -351,13 +351,13 @@ const SfxItemSet* FuPage::ExecuteDialog( ::vcl::Window* pParent ) // notice-masterpage (at the moment) if( ePageKind != PK_NOTES ) { - MessBox aQuestionBox ( + ScopedVclPtrInstance<MessBox> aQuestionBox ( pParent, WB_YES_NO | WB_DEF_YES, SD_RESSTR(STR_PAGE_BACKGROUND_TITLE), SD_RESSTR(STR_PAGE_BACKGROUND_TXT) ); - aQuestionBox.SetImage( QueryBox::GetStandardImage() ); - bSetToAllPages = ( RET_YES == aQuestionBox.Execute() ); + aQuestionBox->SetImage( QueryBox::GetStandardImage() ); + bSetToAllPages = ( RET_YES == aQuestionBox->Execute() ); } if( mbPageBckgrdDeleted ) diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx index f522f6eba3f2..8ea8462ceedc 100644 --- a/sd/source/ui/func/fupoor.cxx +++ b/sd/source/ui/func/fupoor.cxx @@ -100,10 +100,8 @@ FuPoor::~FuPoor() { aDragTimer.Stop(); aScrollTimer.Stop(); - aDelayToScrollTimer.Stop (); - - if (pDialog) - delete pDialog; + aDelayToScrollTimer.Stop(); + pDialog.disposeAndClear(); } void FuPoor::Activate() @@ -130,6 +128,11 @@ void FuPoor::Deactivate() if (mpWindow) mpWindow->ReleaseMouse (); } +void FuPoor::SetWindow(::sd::Window* pWin) +{ + mpWindow = pWin; +} + /** * scroll when approached the border of the window; is called by MouseMove */ diff --git a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx index 8c4977b243c5..674a8c6e7bc4 100644 --- a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx +++ b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx @@ -278,7 +278,7 @@ private: protected: /// The core window that is made accessible. - ::sd::Window* mpWindow; + VclPtr<::sd::Window> mpWindow; /// The API window that is made accessible. ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> diff --git a/sd/source/ui/inc/AccessibleSlideSorterView.hxx b/sd/source/ui/inc/AccessibleSlideSorterView.hxx index 68b044ef2666..f1ac5a189f33 100644 --- a/sd/source/ui/inc/AccessibleSlideSorterView.hxx +++ b/sd/source/ui/inc/AccessibleSlideSorterView.hxx @@ -31,6 +31,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/awt/XFocusListener.hpp> #include <com/sun/star/document/XEventListener.hpp> +#include <vcl/vclptr.hxx> #include <memory> @@ -288,7 +289,7 @@ private: sal_uInt32 mnClientId; - vcl::Window* mpContentWindow; + VclPtr<vcl::Window> mpContentWindow; /** Check whether or not the object has been disposed (or is in the state of being disposed). If that is the case then diff --git a/sd/source/ui/inc/BreakDlg.hxx b/sd/source/ui/inc/BreakDlg.hxx index bddf639c16a3..40c650c5ee7f 100644 --- a/sd/source/ui/inc/BreakDlg.hxx +++ b/sd/source/ui/inc/BreakDlg.hxx @@ -53,14 +53,15 @@ public: sal_uLong nSumActionCount, sal_uLong nObjCount); virtual ~BreakDlg(); + virtual void dispose() SAL_OVERRIDE; short Execute() SAL_OVERRIDE; private: - FixedText* m_pFiObjInfo; - FixedText* m_pFiActInfo; - FixedText* m_pFiInsInfo; - CancelButton* m_pBtnCancel; + VclPtr<FixedText> m_pFiObjInfo; + VclPtr<FixedText> m_pFiActInfo; + VclPtr<FixedText> m_pFiInsInfo; + VclPtr<CancelButton> m_pBtnCancel; DrawView* pDrView; diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index df23e0a35a56..df7e337c1f1b 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -102,7 +102,7 @@ public: virtual Size GetFirstPageSize() SAL_OVERRIDE; virtual void FillClass(SvGlobalName* pClassName, SotClipboardFormatId* pFormat, OUString* pAppName, OUString* pFullTypeName, OUString* pShortTypeName, sal_Int32 nFileFormat, bool bTemplate = false ) const SAL_OVERRIDE; virtual void SetModified( bool = true ) SAL_OVERRIDE; - virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( ::vcl::Window *pParent, + virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( ::vcl::Window *pParent, const SfxItemSet &rSet ) SAL_OVERRIDE; using SfxObjectShell::GetVisArea; @@ -211,7 +211,7 @@ protected: SdDrawDocument* mpDoc; SfxUndoManager* mpUndoManager; - SfxPrinter* mpPrinter; + VclPtr<SfxPrinter> mpPrinter; ::sd::ViewShell* mpViewShell; FontList* mpFontList; rtl::Reference<FuPoor> mxDocShellFunction; diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 0012c2a9d7fd..a54937f2fabf 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -279,7 +279,7 @@ public: void UnlockInput(); bool IsInputLocked() const { return mnLockCount > 0UL; } - sal_uInt16 GetCurPageId() { return( maTabControl.GetCurPageId() ); } + sal_uInt16 GetCurPageId() { return maTabControl->GetCurPageId(); } /** Show controls of the UI or hide them, depending on the given flag. Do not call this method directly. Call the method at ViewShellBase @@ -345,7 +345,7 @@ public: /** Return a pointer to the tab control for pages. */ - TabControl& GetPageTabControl() { return maTabControl;} + TabControl& GetPageTabControl() { return *maTabControl.get(); } /** Return a pointer to the tab control for layers. */ @@ -384,7 +384,7 @@ protected: Rectangle maMarkRect; Point maMousePos; bool mbMousePosFreezed; - TabControl maTabControl; + VclPtr<TabControl> maTabControl; EditMode meEditMode; PageKind mePageKind; bool mbZoomOnPage; diff --git a/sd/source/ui/inc/FormShellManager.hxx b/sd/source/ui/inc/FormShellManager.hxx index ef8a4212dcea..0c9c19660e6c 100644 --- a/sd/source/ui/inc/FormShellManager.hxx +++ b/sd/source/ui/inc/FormShellManager.hxx @@ -24,6 +24,7 @@ #include <tools/link.hxx> #include <svl/lstner.hxx> +#include <vcl/vclptr.hxx> class VclWindowEvent; class FmFormShell; @@ -89,7 +90,7 @@ private: bool mbIsMainViewChangePending; - vcl::Window* mpMainViewShellWindow; + VclPtr<vcl::Window> mpMainViewShellWindow; /** Register at window of center pane and at the form shell that represents the form tool bar. The former informs this manager about diff --git a/sd/source/ui/inc/OutlineBulletDlg.hxx b/sd/source/ui/inc/OutlineBulletDlg.hxx index 19ae1f8cad0e..5a88788bfc73 100644 --- a/sd/source/ui/inc/OutlineBulletDlg.hxx +++ b/sd/source/ui/inc/OutlineBulletDlg.hxx @@ -38,6 +38,7 @@ public: const SfxItemSet* pAttr, ::sd::View* pView ); virtual ~OutlineBulletDlg (); + virtual void dispose() SAL_OVERRIDE; const SfxItemSet* GetOutputItemSet() const; diff --git a/sd/source/ui/inc/PreviewRenderer.hxx b/sd/source/ui/inc/PreviewRenderer.hxx index ec7c5fadcadc..7784b00630c7 100644 --- a/sd/source/ui/inc/PreviewRenderer.hxx +++ b/sd/source/ui/inc/PreviewRenderer.hxx @@ -126,7 +126,7 @@ protected: virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE; private: - ::std::unique_ptr<VirtualDevice> mpPreviewDevice; + ScopedVclPtr<VirtualDevice> mpPreviewDevice; ::std::unique_ptr<DrawView> mpView; DrawDocShell* mpDocShellOfView; const Color maFrameColor; diff --git a/sd/source/ui/inc/Ruler.hxx b/sd/source/ui/inc/Ruler.hxx index 64d214f77420..9186ebdf3f0e 100644 --- a/sd/source/ui/inc/Ruler.hxx +++ b/sd/source/ui/inc/Ruler.hxx @@ -41,6 +41,7 @@ public: SfxBindings& rBindings, WinBits nWinStyle); virtual ~Ruler(); + virtual void dispose() SAL_OVERRIDE; void SetNullOffset(const Point& rOffset); @@ -49,7 +50,7 @@ public: using ::Ruler::SetNullOffset; protected: ::sd::View* pSdView; - ::sd::Window* pSdWin; + VclPtr<::sd::Window> pSdWin; DrawViewShell* pDrViewShell; RulerCtrlItem* pCtrlItem; bool bHorz; diff --git a/sd/source/ui/inc/SlideSorter.hxx b/sd/source/ui/inc/SlideSorter.hxx index 8854e242eee1..940ec902a27d 100644 --- a/sd/source/ui/inc/SlideSorter.hxx +++ b/sd/source/ui/inc/SlideSorter.hxx @@ -29,6 +29,7 @@ #include <boost/shared_ptr.hpp> #include <boost/scoped_ptr.hpp> #include <boost/current_function.hpp> +#include <vcl/scrbar.hxx> class ScrollBar; class ScrollBarBox; @@ -55,8 +56,6 @@ class SlotManager; class Properties; } } } -typedef ::boost::shared_ptr<sd::Window> SharedSdWindow; - namespace sd { namespace slidesorter { /** Show previews for all the slides in a document and allow the user to @@ -98,10 +97,10 @@ public: */ static ::boost::shared_ptr<SlideSorter> CreateSlideSorter ( ViewShell& rViewShell, - const ::boost::shared_ptr<sd::Window>& rpContentWindow, - const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar, - const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar, - const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox); + sd::Window* pContentWindow, + ScrollBar* pHorizontalScrollBar, + ScrollBar* pVerticalScrollBar, + ScrollBarBox* pScrollBarBox); /** Create a new slide sorter that is losely coupled to the given view shell. The view shell may even be missing. @@ -120,21 +119,21 @@ public: /** Return the control of the vertical scroll bar. */ - ::boost::shared_ptr<ScrollBar> GetVerticalScrollBar() const { return mpVerticalScrollBar;} + VclPtr<ScrollBar> GetVerticalScrollBar() const { return mpVerticalScrollBar;} /** Return the control of the horizontal scroll bar. */ - ::boost::shared_ptr<ScrollBar> GetHorizontalScrollBar() const { return mpHorizontalScrollBar;} + VclPtr<ScrollBar> GetHorizontalScrollBar() const { return mpHorizontalScrollBar;} /** Return the scroll bar filler that paints the little square that is enclosed by the two scroll bars. */ - ::boost::shared_ptr<ScrollBarBox> GetScrollBarFiller() const { return mpScrollBarBox;} + VclPtr<ScrollBarBox> GetScrollBarFiller (void) const { return mpScrollBarBox;} /** Return the content window. This is a sibling and is geometrically enclosed by the scroll bars. */ - SharedSdWindow GetContentWindow() const { return mpContentWindow;} + VclPtr<sd::Window> GetContentWindow() const { return mpContentWindow;} model::SlideSorterModel& GetModel() const; @@ -222,11 +221,11 @@ private: ::com::sun::star::uno::WeakReference<com::sun::star::frame::XController> mxControllerWeak; ViewShell* mpViewShell; ViewShellBase* mpViewShellBase; - SharedSdWindow mpContentWindow; + VclPtr<sd::Window> mpContentWindow; bool mbOwnesContentWindow; - ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar; - ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar; - ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox; + VclPtr<ScrollBar> mpHorizontalScrollBar; + VclPtr<ScrollBar> mpVerticalScrollBar; + VclPtr<ScrollBarBox> mpScrollBarBox; /** Set this flag to <TRUE/> to force a layout before the next paint. */ @@ -240,10 +239,10 @@ private: SlideSorter ( ViewShell& rViewShell, - const ::boost::shared_ptr<sd::Window>& rpContentWindow, - const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar, - const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar, - const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox); + sd::Window* pContentWindow, + ScrollBar* pHorizontalScrollBar, + ScrollBar* pVerticalScrollBar, + ScrollBarBox* pScrollBarBox); SlideSorter ( ViewShellBase& rBase, ViewShell* pViewShell, diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index 1b22016d93e2..f4823faa8cdd 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -59,8 +59,8 @@ class ViewClipboard; // SdViewRedrawRec struct SdViewRedrawRec { - OutputDevice* mpOut; - Rectangle aRect; + VclPtr<OutputDevice> mpOut; + Rectangle aRect; }; //For master view we want to force that master diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 1b46129e1087..53ffbfd756f7 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -465,26 +465,26 @@ protected: document. */ - ::boost::shared_ptr<sd::Window> mpContentWindow; + VclPtr<sd::Window> mpContentWindow; /// Horizontal scroll bar for the current slide is displayed when needed. - ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar; + VclPtr<ScrollBar> mpHorizontalScrollBar; /// Vertical scroll bar for whole document is always visible. - ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar; + VclPtr<ScrollBar> mpVerticalScrollBar; /// Horizontal ruler is not shown by default. - ::std::unique_ptr<SvxRuler> mpHorizontalRuler; + VclPtr<SvxRuler> mpHorizontalRuler; /// Vertical ruler is not shown by default. - ::std::unique_ptr<SvxRuler> mpVerticalRuler; + VclPtr<SvxRuler> mpVerticalRuler; /// Filler of the little square enclosed by the two scroll bars. - ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox; + VclPtr<ScrollBarBox> mpScrollBarBox; /// Layer tab bar. - ::std::unique_ptr<LayerTabBar> mpLayerTabBar; + VclPtr<LayerTabBar> mpLayerTabBar; /// This flag controls whether the rulers are visible. bool mbHasRulers; /// The active window. - ::sd::Window* mpActiveWindow; + VclPtr<::sd::Window> mpActiveWindow; ::sd::View* mpView; FrameView* mpFrameView; @@ -568,7 +568,7 @@ protected: void doShow(); private: - ::vcl::Window* mpParentWindow; + VclPtr<::vcl::Window> mpParentWindow; /** This window updater is used to keep all relevant windows up to date with reference to the digit language used to display digits in text shapes. diff --git a/sd/source/ui/inc/ViewTabBar.hxx b/sd/source/ui/inc/ViewTabBar.hxx index f3b40694cc33..82ed1d584df2 100644 --- a/sd/source/ui/inc/ViewTabBar.hxx +++ b/sd/source/ui/inc/ViewTabBar.hxx @@ -67,7 +67,7 @@ public: virtual void SAL_CALL disposing() SAL_OVERRIDE; - ::boost::shared_ptr< ::TabControl> GetTabControl() const { return mpTabControl;} + VclPtr<::TabControl> GetTabControl() const { return mpTabControl;} bool ActivatePage(); @@ -149,14 +149,14 @@ public: GetTabBarButtons(); private: - ::boost::shared_ptr< ::TabControl> mpTabControl; + VclPtr< ::TabControl> mpTabControl; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController> mxController; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XConfigurationController> mxConfigurationController; typedef ::std::vector<com::sun::star::drawing::framework::TabBarButton> TabBarButtonList; TabBarButtonList maTabBarButtons; - ::boost::scoped_ptr<TabPage> mpTabPage; + VclPtr<TabPage> mpTabPage; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId> mxViewTabBarId; ViewShellBase* mpViewShellBase; diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx index 718c17842a5b..bd83e2146491 100644 --- a/sd/source/ui/inc/Window.hxx +++ b/sd/source/ui/inc/Window.hxx @@ -45,7 +45,8 @@ class Window { public: Window (vcl::Window* pParent); - virtual ~Window(); + virtual ~Window (); + virtual void dispose() SAL_OVERRIDE; void SetViewShell (ViewShell* pViewSh); @@ -149,7 +150,7 @@ public: void DropScroll (const Point& rMousePos); virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; protected: - ::sd::Window* mpShareWin; + VclPtr<::sd::Window> mpShareWin; Point maWinPos; Point maViewOrigin; Size maViewSize; diff --git a/sd/source/ui/inc/WindowUpdater.hxx b/sd/source/ui/inc/WindowUpdater.hxx index f7f2a1830a64..626dda1bbe34 100644 --- a/sd/source/ui/inc/WindowUpdater.hxx +++ b/sd/source/ui/inc/WindowUpdater.hxx @@ -22,6 +22,7 @@ #include <svl/lstner.hxx> #include <svl/ctloptions.hxx> +#include <vcl/vclptr.hxx> #include "sddllapi.h" #include <vector> @@ -120,7 +121,7 @@ private: /** Type and data member for a list of devices that have to be kept up-to-date. */ - typedef ::std::vector< vcl::Window*> tWindowList; + typedef ::std::vector< VclPtr<vcl::Window> > tWindowList; tWindowList maWindowList; /** The central method of this class. Update the given output device. diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx index 45a9a3e8d354..20f3ffeccddd 100644 --- a/sd/source/ui/inc/animobjs.hxx +++ b/sd/source/ui/inc/animobjs.hxx @@ -85,6 +85,7 @@ class AnimationWindow : public SfxDockingWindow public: AnimationWindow(SfxBindings* pBindings, SfxChildWindow *pCW, vcl::Window* pParent); virtual ~AnimationWindow(); + virtual void dispose() SAL_OVERRIDE; void AddObj( ::sd::View& rView ); void CreateAnimObj( ::sd::View& rView ); @@ -97,28 +98,28 @@ protected: virtual void FillInfo( SfxChildWinInfo& ) const SAL_OVERRIDE; private: - SdDisplay* m_pCtlDisplay; - PushButton* m_pBtnFirst; - PushButton* m_pBtnReverse; - PushButton* m_pBtnStop; - PushButton* m_pBtnPlay; - PushButton* m_pBtnLast; - NumericField* m_pNumFldBitmap; - TimeField* m_pTimeField; - ListBox* m_pLbLoopCount; - PushButton* m_pBtnGetOneObject; - PushButton* m_pBtnGetAllObjects; - PushButton* m_pBtnRemoveBitmap; - PushButton* m_pBtnRemoveAll; - FixedText* m_pFiCount; - - RadioButton* m_pRbtGroup; - RadioButton* m_pRbtBitmap; - FixedText* m_pFtAdjustment; - ListBox* m_pLbAdjustment; - PushButton* m_pBtnCreateGroup; - - vcl::Window* pWin; + VclPtr<SdDisplay> m_pCtlDisplay; + VclPtr<PushButton> m_pBtnFirst; + VclPtr<PushButton> m_pBtnReverse; + VclPtr<PushButton> m_pBtnStop; + VclPtr<PushButton> m_pBtnPlay; + VclPtr<PushButton> m_pBtnLast; + VclPtr<NumericField> m_pNumFldBitmap; + VclPtr<TimeField> m_pTimeField; + VclPtr<ListBox> m_pLbLoopCount; + VclPtr<PushButton> m_pBtnGetOneObject; + VclPtr<PushButton> m_pBtnGetAllObjects; + VclPtr<PushButton> m_pBtnRemoveBitmap; + VclPtr<PushButton> m_pBtnRemoveAll; + VclPtr<FixedText> m_pFiCount; + + VclPtr<RadioButton> m_pRbtGroup; + VclPtr<RadioButton> m_pRbtBitmap; + VclPtr<FixedText> m_pFtAdjustment; + VclPtr<ListBox> m_pLbAdjustment; + VclPtr<PushButton> m_pBtnCreateGroup; + + VclPtr<vcl::Window> pWin; ::std::vector< ::std::pair<BitmapEx*, ::tools::Time*> > m_FrameList; static const size_t EMPTY_FRAMELIST; size_t m_nCurrentFrame; @@ -163,7 +164,7 @@ protected: virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; private: - AnimationWindow* pAnimationWin; + VclPtr<AnimationWindow> pAnimationWin; }; } // end of namespace sd diff --git a/sd/source/ui/inc/assclass.hxx b/sd/source/ui/inc/assclass.hxx index 3e95415d7a9d..6a0709da717a 100644 --- a/sd/source/ui/inc/assclass.hxx +++ b/sd/source/ui/inc/assclass.hxx @@ -33,7 +33,7 @@ class SD_DLLPUBLIC Assistent { /** contains for every page the controls, which have to be connected? correctly */ - std::vector<vcl::Window*> maPages[MAX_PAGES]; + std::vector<VclPtr<vcl::Window> > maPages[MAX_PAGES]; /// number of pages int mnPages; diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx index 7a9d696f62e1..1da44c927a6c 100644 --- a/sd/source/ui/inc/copydlg.hxx +++ b/sd/source/ui/inc/copydlg.hxx @@ -42,26 +42,27 @@ public: CopyDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, const XColorListRef &pColList, ::sd::View* pView ); virtual ~CopyDlg(); + virtual void dispose() SAL_OVERRIDE; void GetAttr( SfxItemSet& rOutAttrs ); void Reset(); private: - NumericField* m_pNumFldCopies; - Button* m_pBtnSetViewData; + VclPtr<NumericField> m_pNumFldCopies; + VclPtr<Button> m_pBtnSetViewData; - MetricField* m_pMtrFldMoveX; - MetricField* m_pMtrFldMoveY; - MetricField* m_pMtrFldAngle; + VclPtr<MetricField> m_pMtrFldMoveX; + VclPtr<MetricField> m_pMtrFldMoveY; + VclPtr<MetricField> m_pMtrFldAngle; - MetricField* m_pMtrFldWidth; - MetricField* m_pMtrFldHeight; + VclPtr<MetricField> m_pMtrFldWidth; + VclPtr<MetricField> m_pMtrFldHeight; - ColorLB* m_pLbStartColor; - FixedText* m_pFtEndColor; - ColorLB* m_pLbEndColor; + VclPtr<ColorLB> m_pLbStartColor; + VclPtr<FixedText> m_pFtEndColor; + VclPtr<ColorLB> m_pLbEndColor; - PushButton* m_pBtnSetDefault; + VclPtr<PushButton> m_pBtnSetDefault; const SfxItemSet& mrOutAttrs; XColorListRef mpColorList; diff --git a/sd/source/ui/inc/createtabledesignpanel.hxx b/sd/source/ui/inc/createtabledesignpanel.hxx index 2d8f1c36f504..44fc06e19334 100644 --- a/sd/source/ui/inc/createtabledesignpanel.hxx +++ b/sd/source/ui/inc/createtabledesignpanel.hxx @@ -21,10 +21,11 @@ #define INCLUDED_SD_SOURCE_UI_INC_CREATETABLEDESIGNPANEL_HXX #include <sal/config.h> +#include <vcl/vclptr.hxx> namespace sd { -::vcl::Window * createTableDesignPanel (::vcl::Window* pParent, ViewShellBase& rBase); +VclPtr<::vcl::Window> createTableDesignPanel (::vcl::Window* pParent, ViewShellBase& rBase); } diff --git a/sd/source/ui/inc/custsdlg.hxx b/sd/source/ui/inc/custsdlg.hxx index 54f1cfe6b73b..4fcbc7d54c75 100644 --- a/sd/source/ui/inc/custsdlg.hxx +++ b/sd/source/ui/inc/custsdlg.hxx @@ -34,15 +34,15 @@ class SdCustomShowList; class SdCustomShowDlg : public ModalDialog { private: - ListBox* m_pLbCustomShows; - CheckBox* m_pCbxUseCustomShow; - PushButton* m_pBtnNew; - PushButton* m_pBtnEdit; - PushButton* m_pBtnRemove; - PushButton* m_pBtnCopy; - HelpButton* m_pBtnHelp; - PushButton* m_pBtnStartShow; - OKButton* m_pBtnOK; + VclPtr<ListBox> m_pLbCustomShows; + VclPtr<CheckBox> m_pCbxUseCustomShow; + VclPtr<PushButton> m_pBtnNew; + VclPtr<PushButton> m_pBtnEdit; + VclPtr<PushButton> m_pBtnRemove; + VclPtr<PushButton> m_pBtnCopy; + VclPtr<HelpButton> m_pBtnHelp; + VclPtr<PushButton> m_pBtnStartShow; + VclPtr<OKButton> m_pBtnOK; SdDrawDocument& rDoc; SdCustomShowList* pCustomShowList; @@ -57,22 +57,22 @@ private: public: SdCustomShowDlg( vcl::Window* pWindow, SdDrawDocument& rDrawDoc ); virtual ~SdCustomShowDlg(); - - bool IsModified() const { return bModified; } - bool IsCustomShow() const; + virtual void dispose() SAL_OVERRIDE; + bool IsModified() const { return bModified; } + bool IsCustomShow() const; }; class SdDefineCustomShowDlg : public ModalDialog { private: - Edit* m_pEdtName; - ListBox* m_pLbPages; - PushButton* m_pBtnAdd; - PushButton* m_pBtnRemove; - SvTreeListBox* m_pLbCustomPages; - OKButton* m_pBtnOK; - CancelButton* m_pBtnCancel; - HelpButton* m_pBtnHelp; + VclPtr<Edit> m_pEdtName; + VclPtr<ListBox> m_pLbPages; + VclPtr<PushButton> m_pBtnAdd; + VclPtr<PushButton> m_pBtnRemove; + VclPtr<SvTreeListBox> m_pLbCustomPages; + VclPtr<OKButton> m_pBtnOK; + VclPtr<CancelButton> m_pBtnCancel; + VclPtr<HelpButton> m_pBtnHelp; SdDrawDocument& rDoc; SdCustomShow*& rpCustomShow; @@ -90,6 +90,7 @@ public: SdDefineCustomShowDlg( vcl::Window* pWindow, SdDrawDocument& rDrawDoc, SdCustomShow*& rpCS ); virtual ~SdDefineCustomShowDlg(); + virtual void dispose() SAL_OVERRIDE; bool IsModified() const { return bModified; } }; diff --git a/sd/source/ui/inc/diactrl.hxx b/sd/source/ui/inc/diactrl.hxx index fdb61e8dca23..a6f6006445ad 100644 --- a/sd/source/ui/inc/diactrl.hxx +++ b/sd/source/ui/inc/diactrl.hxx @@ -55,7 +55,7 @@ class SdTbxCtlDiaPages : public SfxToolBoxControl public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; SFX_DECL_TOOLBOX_CONTROL(); diff --git a/sd/source/ui/inc/dlgass.hxx b/sd/source/ui/inc/dlgass.hxx index 4ee19ec4abe2..b9f9136e2fd3 100644 --- a/sd/source/ui/inc/dlgass.hxx +++ b/sd/source/ui/inc/dlgass.hxx @@ -43,6 +43,7 @@ private: public: AssistentDlg(vcl::Window* pParent, bool bAutoPilot); virtual ~AssistentDlg(); + virtual void dispose() SAL_OVERRIDE; DECL_LINK( FinishHdl, void * ); diff --git a/sd/source/ui/inc/dlgctrls.hxx b/sd/source/ui/inc/dlgctrls.hxx index daa1ad28ac4f..5cb90587b76b 100644 --- a/sd/source/ui/inc/dlgctrls.hxx +++ b/sd/source/ui/inc/dlgctrls.hxx @@ -37,7 +37,8 @@ class SD_DLLPUBLIC FadeEffectLB : public ListBox public: FadeEffectLB(vcl::Window* pParent, WinBits nStyle); virtual ~FadeEffectLB(); - void Fill(); + virtual void dispose() SAL_OVERRIDE; + void Fill(); /* void selectEffectFromPage( SdPage* pPage ); */ void applySelected( SdPage* pSlide ) const; diff --git a/sd/source/ui/inc/dlgfield.hxx b/sd/source/ui/inc/dlgfield.hxx index b458b8df84b9..fe11b0768b45 100644 --- a/sd/source/ui/inc/dlgfield.hxx +++ b/sd/source/ui/inc/dlgfield.hxx @@ -34,10 +34,10 @@ class SvxFieldData; class SdModifyFieldDlg : public ModalDialog { private: - RadioButton* m_pRbtFix; - RadioButton* m_pRbtVar; - SvxLanguageBox* m_pLbLanguage; - ListBox* m_pLbFormat; + VclPtr<RadioButton> m_pRbtFix; + VclPtr<RadioButton> m_pRbtVar; + VclPtr<SvxLanguageBox> m_pLbLanguage; + VclPtr<ListBox> m_pLbFormat; SfxItemSet maInputSet; const SvxFieldData* pField; @@ -49,7 +49,8 @@ private: public: SdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ); - virtual ~SdModifyFieldDlg() {} + virtual ~SdModifyFieldDlg(); + virtual void dispose() SAL_OVERRIDE; SvxFieldData* GetField(); SfxItemSet GetItemSet(); diff --git a/sd/source/ui/inc/dlgsnap.hxx b/sd/source/ui/inc/dlgsnap.hxx index ab431c856be3..f17a7c5c3413 100644 --- a/sd/source/ui/inc/dlgsnap.hxx +++ b/sd/source/ui/inc/dlgsnap.hxx @@ -41,15 +41,15 @@ namespace sd { class SdSnapLineDlg : public ModalDialog { private: - FixedText* m_pFtX; - MetricField* m_pMtrFldX; - FixedText* m_pFtY; - MetricField* m_pMtrFldY; - VclContainer* m_pRadioGroup; - RadioButton* m_pRbPoint; - RadioButton* m_pRbVert; - RadioButton* m_pRbHorz; - PushButton* m_pBtnDelete; + VclPtr<FixedText> m_pFtX; + VclPtr<MetricField> m_pMtrFldX; + VclPtr<FixedText> m_pFtY; + VclPtr<MetricField> m_pMtrFldY; + VclPtr<VclContainer> m_pRadioGroup; + VclPtr<RadioButton> m_pRbPoint; + VclPtr<RadioButton> m_pRbVert; + VclPtr<RadioButton> m_pRbHorz; + VclPtr<PushButton> m_pBtnDelete; long nXValue; long nYValue; FieldUnit eUIUnit; @@ -59,6 +59,8 @@ private: public: SdSnapLineDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView); + virtual ~SdSnapLineDlg(); + virtual void dispose() SAL_OVERRIDE; void GetAttr(SfxItemSet& rOutAttrs); diff --git a/sd/source/ui/inc/docprev.hxx b/sd/source/ui/inc/docprev.hxx index b4d3b28a8c73..ea1e5876211d 100644 --- a/sd/source/ui/inc/docprev.hxx +++ b/sd/source/ui/inc/docprev.hxx @@ -65,6 +65,7 @@ protected: public: SdDocPreviewWin( vcl::Window* pParent, const WinBits nStyle ); virtual ~SdDocPreviewWin(); + virtual void dispose() SAL_OVERRIDE; void SetObjectShell( SfxObjectShell* pObj, sal_uInt16 nShowPage = 0 ); virtual void Resize() SAL_OVERRIDE; void startPreview(); diff --git a/sd/source/ui/inc/drawview.hxx b/sd/source/ui/inc/drawview.hxx index 7d4ad1c6780a..d9fc8b5b7ec1 100644 --- a/sd/source/ui/inc/drawview.hxx +++ b/sd/source/ui/inc/drawview.hxx @@ -65,7 +65,7 @@ protected: private: DrawDocShell* mpDocShell; DrawViewShell* mpDrawViewShell; - VirtualDevice* mpVDev; + VclPtr<VirtualDevice> mpVDev; sal_uInt16 mnPOCHSmph; ///< for blocking PageOrderChangedHint }; diff --git a/sd/source/ui/inc/framework/Pane.hxx b/sd/source/ui/inc/framework/Pane.hxx index e9c94df151db..a38ae7bb1103 100644 --- a/sd/source/ui/inc/framework/Pane.hxx +++ b/sd/source/ui/inc/framework/Pane.hxx @@ -29,6 +29,7 @@ #include <cppuhelper/compbase3.hxx> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> +#include <vcl/vclptr.hxx> namespace vcl { class Window; } @@ -135,7 +136,7 @@ public: protected: ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow; ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas; diff --git a/sd/source/ui/inc/fupoor.hxx b/sd/source/ui/inc/fupoor.hxx index 9f50c75ed925..f127a167bf8e 100644 --- a/sd/source/ui/inc/fupoor.hxx +++ b/sd/source/ui/inc/fupoor.hxx @@ -82,7 +82,7 @@ public: virtual void Activate(); ///< activates the function virtual void Deactivate(); ///< deactivates the function - void SetWindow(::sd::Window* pWin) { mpWindow = pWin; } + void SetWindow(::sd::Window* pWin); virtual void SelectionHasChanged(); @@ -150,14 +150,14 @@ protected: ::sd::View* mpView; ViewShell* mpViewShell; - ::sd::Window* mpWindow; + VclPtr<::sd::Window> mpWindow; DrawDocShell* mpDocSh; SdDrawDocument* mpDoc; sal_uInt16 nSlotId; sal_uInt16 nSlotValue; - Dialog* pDialog; + VclPtr<Dialog> pDialog; Timer aScrollTimer; ///< for auto-scrolling DECL_LINK( ScrollHdl, void * ); diff --git a/sd/source/ui/inc/gluectrl.hxx b/sd/source/ui/inc/gluectrl.hxx index d3b2e0a8055b..fde273c0aaa3 100644 --- a/sd/source/ui/inc/gluectrl.hxx +++ b/sd/source/ui/inc/gluectrl.hxx @@ -51,7 +51,7 @@ private: public: virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; SFX_DECL_TOOLBOX_CONTROL(); diff --git a/sd/source/ui/inc/headerfooterdlg.hxx b/sd/source/ui/inc/headerfooterdlg.hxx index 6f19a555b962..4206cd4dc62b 100644 --- a/sd/source/ui/inc/headerfooterdlg.hxx +++ b/sd/source/ui/inc/headerfooterdlg.hxx @@ -44,17 +44,17 @@ private: DECL_LINK( ClickApplyHdl, void * ); DECL_LINK( ClickCancelHdl, void * ); - TabControl* mpTabCtrl; + VclPtr<TabControl> mpTabCtrl; - HeaderFooterTabPage* mpSlideTabPage; - HeaderFooterTabPage* mpNotesHandoutsTabPage; + VclPtr<HeaderFooterTabPage> mpSlideTabPage; + VclPtr<HeaderFooterTabPage> mpNotesHandoutsTabPage; sal_uInt16 mnSlidesId; sal_uInt16 mnNotesId; - PushButton* maPBApplyToAll; - PushButton* maPBApply; - CancelButton* maPBCancel; + VclPtr<PushButton> maPBApplyToAll; + VclPtr<PushButton> maPBApply; + VclPtr<CancelButton> maPBCancel; HeaderFooterSettings maSlideSettings; HeaderFooterSettings maNotesHandoutSettings; @@ -69,6 +69,7 @@ private: public: HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage ); virtual ~HeaderFooterDialog(); + virtual void dispose() SAL_OVERRIDE; void ApplyToAll(); void Apply(); diff --git a/sd/source/ui/inc/ins_paste.hxx b/sd/source/ui/inc/ins_paste.hxx index 0cd396f4c31a..78362535242b 100644 --- a/sd/source/ui/inc/ins_paste.hxx +++ b/sd/source/ui/inc/ins_paste.hxx @@ -31,11 +31,13 @@ class SD_DLLPUBLIC SdInsertPasteDlg : public ModalDialog { private: - RadioButton* m_pRbBefore; - RadioButton* m_pRbAfter; + VclPtr<RadioButton> m_pRbBefore; + VclPtr<RadioButton> m_pRbAfter; public: SdInsertPasteDlg( vcl::Window* pWindow ); + virtual ~SdInsertPasteDlg(); + virtual void dispose() SAL_OVERRIDE; bool IsInsertBefore() const; }; diff --git a/sd/source/ui/inc/inspagob.hxx b/sd/source/ui/inc/inspagob.hxx index f7a0e12ae859..7dd1c7541b94 100644 --- a/sd/source/ui/inc/inspagob.hxx +++ b/sd/source/ui/inc/inspagob.hxx @@ -29,9 +29,9 @@ class SdDrawDocument; class SdInsertPagesObjsDlg : public ModalDialog { private: - SdPageObjsTLB* m_pLbTree; - CheckBox* m_pCbxLink; - CheckBox* m_pCbxMasters; + VclPtr<SdPageObjsTLB> m_pLbTree; + VclPtr<CheckBox> m_pCbxLink; + VclPtr<CheckBox> m_pCbxMasters; SfxMedium* pMedium; const SdDrawDocument* mpDoc; @@ -46,6 +46,7 @@ public: SfxMedium* pSfxMedium, const OUString& rFileName ); virtual ~SdInsertPagesObjsDlg(); + virtual void dispose() SAL_OVERRIDE; /** returns the list nType == 0 -> pages diff --git a/sd/source/ui/inc/layeroptionsdlg.hxx b/sd/source/ui/inc/layeroptionsdlg.hxx index e3ad80873223..ec0b1d24ad30 100644 --- a/sd/source/ui/inc/layeroptionsdlg.hxx +++ b/sd/source/ui/inc/layeroptionsdlg.hxx @@ -35,12 +35,12 @@ class SfxItemSet; class SD_DLLPUBLIC SdInsertLayerDlg : public ModalDialog { private: - Edit* m_pEdtName; - Edit* m_pEdtTitle; - VclMultiLineEdit* m_pEdtDesc; - CheckBox* m_pCbxVisible; - CheckBox* m_pCbxPrintable; - CheckBox* m_pCbxLocked; + VclPtr<Edit> m_pEdtName; + VclPtr<Edit> m_pEdtTitle; + VclPtr<VclMultiLineEdit> m_pEdtDesc; + VclPtr<CheckBox> m_pCbxVisible; + VclPtr<CheckBox> m_pCbxPrintable; + VclPtr<CheckBox> m_pCbxLocked; const SfxItemSet& mrOutAttrs; @@ -48,6 +48,9 @@ public: SdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& rStr ); + virtual ~SdInsertLayerDlg(); + virtual void dispose() SAL_OVERRIDE; + void GetAttr( SfxItemSet& rOutAttrs ); }; diff --git a/sd/source/ui/inc/masterlayoutdlg.hxx b/sd/source/ui/inc/masterlayoutdlg.hxx index b6c216944d8b..f6be32bc6ab1 100644 --- a/sd/source/ui/inc/masterlayoutdlg.hxx +++ b/sd/source/ui/inc/masterlayoutdlg.hxx @@ -37,11 +37,11 @@ private: SdDrawDocument* mpDoc; SdPage* mpCurrentPage; - CheckBox* mpCBDate; - CheckBox* mpCBPageNumber; - CheckBox* mpCBSlideNumber; - CheckBox* mpCBHeader; - CheckBox* mpCBFooter; + VclPtr<CheckBox> mpCBDate; + VclPtr<CheckBox> mpCBPageNumber; + VclPtr<CheckBox> mpCBSlideNumber; + VclPtr<CheckBox> mpCBHeader; + VclPtr<CheckBox> mpCBFooter; bool mbOldHeader; bool mbOldFooter; @@ -54,6 +54,8 @@ private: public: MasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage ); + virtual ~MasterLayoutDialog(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; }; diff --git a/sd/source/ui/inc/morphdlg.hxx b/sd/source/ui/inc/morphdlg.hxx index 06b5b3624495..f675535a1ba1 100644 --- a/sd/source/ui/inc/morphdlg.hxx +++ b/sd/source/ui/inc/morphdlg.hxx @@ -39,6 +39,7 @@ public: const SdrObject* pObj1, const SdrObject* pObj2); virtual ~MorphDlg(); + virtual void dispose() SAL_OVERRIDE; void SaveSettings() const; sal_uInt16 GetFadeSteps() const { return (sal_uInt16) m_pMtfSteps->GetValue(); } @@ -46,9 +47,9 @@ public: bool IsOrientationFade() const { return m_pCbxOrientation->IsChecked(); } private: - NumericField* m_pMtfSteps; - CheckBox* m_pCbxAttributes; - CheckBox* m_pCbxOrientation; + VclPtr<NumericField> m_pMtfSteps; + VclPtr<CheckBox> m_pCbxAttributes; + VclPtr<CheckBox> m_pCbxOrientation; void LoadSettings(); }; diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx index b5771f38b92e..e6dff433bc22 100644 --- a/sd/source/ui/inc/navigatr.hxx +++ b/sd/source/ui/inc/navigatr.hxx @@ -98,6 +98,7 @@ public: SfxBindings* pBindings, const UpdateRequestFunctor& rUpdateRequest); virtual ~SdNavigatorWin(); + virtual void dispose() SAL_OVERRIDE; virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; @@ -118,9 +119,9 @@ private: friend class SdNavigatorControllerItem; friend class SdPageNameControllerItem; - ToolBox maToolbox; - SdPageObjsTLB maTlbObjects; - ListBox maLbDocs; + VclPtr<ToolBox> maToolbox; + VclPtr<SdPageObjsTLB> maTlbObjects; + VclPtr<ListBox> maLbDocs; ::sd::NavigatorChildWindow* mpChildWinContext; Size maSize; @@ -177,7 +178,7 @@ protected: const SfxPoolItem* pState ) SAL_OVERRIDE; private: - SdNavigatorWin* pNavigatorWin; + VclPtr<SdNavigatorWin> pNavigatorWin; const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; }; @@ -195,7 +196,7 @@ protected: const SfxPoolItem* pState ) SAL_OVERRIDE; private: - SdNavigatorWin* pNavigatorWin; + VclPtr<SdNavigatorWin> pNavigatorWin; const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; }; diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx index ea2fcde3e25d..0398823c783d 100644 --- a/sd/source/ui/inc/present.hxx +++ b/sd/source/ui/inc/present.hxx @@ -37,37 +37,37 @@ class SdStartPresentationDlg : public ModalDialog { private: - RadioButton* aRbtAll; - RadioButton* aRbtAtDia; - RadioButton* aRbtCustomshow; - ListBox* aLbDias; - ListBox* aLbCustomshow; + VclPtr<RadioButton> aRbtAll; + VclPtr<RadioButton> aRbtAtDia; + VclPtr<RadioButton> aRbtCustomshow; + VclPtr<ListBox> aLbDias; + VclPtr<ListBox> aLbCustomshow; - RadioButton* aRbtStandard; - RadioButton* aRbtWindow; - RadioButton* aRbtAuto; - TimeField* aTmfPause; - CheckBox* aCbxAutoLogo; + VclPtr<RadioButton> aRbtStandard; + VclPtr<RadioButton> aRbtWindow; + VclPtr<RadioButton> aRbtAuto; + VclPtr<TimeField> aTmfPause; + VclPtr<CheckBox> aCbxAutoLogo; - CheckBox* aCbxManuel; - CheckBox* aCbxMousepointer; - CheckBox* aCbxPen; - CheckBox* aCbxNavigator; - CheckBox* aCbxAnimationAllowed; - CheckBox* aCbxChangePage; - CheckBox* aCbxAlwaysOnTop; + VclPtr<CheckBox> aCbxManuel; + VclPtr<CheckBox> aCbxMousepointer; + VclPtr<CheckBox> aCbxPen; + VclPtr<CheckBox> aCbxNavigator; + VclPtr<CheckBox> aCbxAnimationAllowed; + VclPtr<CheckBox> aCbxChangePage; + VclPtr<CheckBox> aCbxAlwaysOnTop; - FixedText* maFtMonitor; - ListBox* maLBMonitor; + VclPtr<FixedText> maFtMonitor; + VclPtr<ListBox> maLBMonitor; SdCustomShowList* pCustomShowList; const SfxItemSet& rOutAttrs; sal_Int32 mnMonitors; - FixedText* msMonitor; - FixedText* msAllMonitors; - FixedText* msMonitorExternal; - FixedText* msExternal; + VclPtr<FixedText> msMonitor; + VclPtr<FixedText> msAllMonitors; + VclPtr<FixedText> msMonitorExternal; + VclPtr<FixedText> msExternal; DECL_LINK( ChangeRangeHdl, void * ); DECL_LINK( ClickWindowPresentationHdl, void * ); @@ -88,6 +88,8 @@ public: const SfxItemSet& rInAttrs, const std::vector<OUString> &rPageNames, SdCustomShowList* pCSList ); + virtual ~SdStartPresentationDlg(); + virtual void dispose() SAL_OVERRIDE; void GetAttr( SfxItemSet& rOutAttrs ); }; diff --git a/sd/source/ui/inc/prltempl.hxx b/sd/source/ui/inc/prltempl.hxx index 71c6c3f9b8ef..a4e5cca4e2e8 100644 --- a/sd/source/ui/inc/prltempl.hxx +++ b/sd/source/ui/inc/prltempl.hxx @@ -86,6 +86,7 @@ private: public: SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, vcl::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool ); virtual ~SdPresLayoutTemplateDlg(); + virtual void dispose() SAL_OVERRIDE; const SfxItemSet* GetOutputItemSet() const; }; diff --git a/sd/source/ui/inc/prntopts.hxx b/sd/source/ui/inc/prntopts.hxx index 9ae6631f435e..4c013ce36db1 100644 --- a/sd/source/ui/inc/prntopts.hxx +++ b/sd/source/ui/inc/prntopts.hxx @@ -32,25 +32,25 @@ class SdPrintOptions : public SfxTabPage friend class SdModule; private: - VclFrame *m_pFrmContent; - CheckBox *m_pCbxDraw; - CheckBox *m_pCbxNotes; - CheckBox *m_pCbxHandout; - CheckBox *m_pCbxOutline; - RadioButton *m_pRbtColor; - RadioButton *m_pRbtGrayscale; - RadioButton *m_pRbtBlackWhite; - CheckBox *m_pCbxPagename; - CheckBox *m_pCbxDate; - CheckBox *m_pCbxTime; - CheckBox *m_pCbxHiddenPages; - RadioButton *m_pRbtDefault; - RadioButton *m_pRbtPagesize; - RadioButton *m_pRbtPagetile; - RadioButton *m_pRbtBooklet; - CheckBox *m_pCbxFront; - CheckBox *m_pCbxBack; - CheckBox *m_pCbxPaperbin; + VclPtr<VclFrame> m_pFrmContent; + VclPtr<CheckBox> m_pCbxDraw; + VclPtr<CheckBox> m_pCbxNotes; + VclPtr<CheckBox> m_pCbxHandout; + VclPtr<CheckBox> m_pCbxOutline; + VclPtr<RadioButton> m_pRbtColor; + VclPtr<RadioButton> m_pRbtGrayscale; + VclPtr<RadioButton> m_pRbtBlackWhite; + VclPtr<CheckBox> m_pCbxPagename; + VclPtr<CheckBox> m_pCbxDate; + VclPtr<CheckBox> m_pCbxTime; + VclPtr<CheckBox> m_pCbxHiddenPages; + VclPtr<RadioButton> m_pRbtDefault; + VclPtr<RadioButton> m_pRbtPagesize; + VclPtr<RadioButton> m_pRbtPagetile; + VclPtr<RadioButton> m_pRbtBooklet; + VclPtr<CheckBox> m_pCbxFront; + VclPtr<CheckBox> m_pCbxBack; + VclPtr<CheckBox> m_pCbxPaperbin; const SfxItemSet& rOutAttrs; @@ -63,8 +63,9 @@ private: public: SdPrintOptions( vcl::Window* pParent, const SfxItemSet& rInAttrs); virtual ~SdPrintOptions(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window*, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* ); virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE; diff --git a/sd/source/ui/inc/pubdlg.hxx b/sd/source/ui/inc/pubdlg.hxx index bbb4f264d8ee..f9670c7b038f 100644 --- a/sd/source/ui/inc/pubdlg.hxx +++ b/sd/source/ui/inc/pubdlg.hxx @@ -53,104 +53,104 @@ class SdPublishingDlg : public ModalDialog { private: // page 1 controls - VclContainer* pPage1; - FixedText* pPage1_Titel; - RadioButton* pPage1_NewDesign; - RadioButton* pPage1_OldDesign; - ListBox* pPage1_Designs; - PushButton* pPage1_DelDesign; - FixedText* pPage1_Desc; + VclPtr<VclContainer> pPage1; + VclPtr<FixedText> pPage1_Titel; + VclPtr<RadioButton> pPage1_NewDesign; + VclPtr<RadioButton> pPage1_OldDesign; + VclPtr<ListBox> pPage1_Designs; + VclPtr<PushButton> pPage1_DelDesign; + VclPtr<FixedText> pPage1_Desc; // page 2 controls - VclContainer* pPage2; - VclContainer* pPage2Frame2; - VclContainer* pPage2Frame3; - VclContainer* pPage2Frame4; - FixedText* pPage2_Titel; - RadioButton* pPage2_Standard; - RadioButton* pPage2_Frames; - RadioButton* pPage2_SingleDocument; - RadioButton* pPage2_Kiosk; - RadioButton* pPage2_WebCast; - FixedImage* pPage2_Standard_FB; - FixedImage* pPage2_Frames_FB; - FixedImage* pPage2_Kiosk_FB; - FixedImage* pPage2_WebCast_FB; - - FixedText* pPage2_Titel_Html; - CheckBox* pPage2_Content; - CheckBox* pPage2_Notes; - - FixedText* pPage2_Titel_WebCast; - RadioButton* pPage2_ASP; - RadioButton* pPage2_PERL; - FixedText* pPage2_URL_txt; - Edit* pPage2_URL; - FixedText* pPage2_CGI_txt; - Edit* pPage2_CGI; - FixedText* pPage2_Index_txt; - Edit* pPage2_Index; - FixedText* pPage2_Titel_Kiosk; - RadioButton* pPage2_ChgDefault; - RadioButton* pPage2_ChgAuto; - FixedText* pPage2_Duration_txt; - TimeField* pPage2_Duration; - CheckBox* pPage2_Endless; + VclPtr<VclContainer> pPage2; + VclPtr<VclContainer> pPage2Frame2; + VclPtr<VclContainer> pPage2Frame3; + VclPtr<VclContainer> pPage2Frame4; + VclPtr<FixedText> pPage2_Titel; + VclPtr<RadioButton> pPage2_Standard; + VclPtr<RadioButton> pPage2_Frames; + VclPtr<RadioButton> pPage2_SingleDocument; + VclPtr<RadioButton> pPage2_Kiosk; + VclPtr<RadioButton> pPage2_WebCast; + VclPtr<FixedImage> pPage2_Standard_FB; + VclPtr<FixedImage> pPage2_Frames_FB; + VclPtr<FixedImage> pPage2_Kiosk_FB; + VclPtr<FixedImage> pPage2_WebCast_FB; + + VclPtr<FixedText> pPage2_Titel_Html; + VclPtr<CheckBox> pPage2_Content; + VclPtr<CheckBox> pPage2_Notes; + + VclPtr<FixedText> pPage2_Titel_WebCast; + VclPtr<RadioButton> pPage2_ASP; + VclPtr<RadioButton> pPage2_PERL; + VclPtr<FixedText> pPage2_URL_txt; + VclPtr<Edit> pPage2_URL; + VclPtr<FixedText> pPage2_CGI_txt; + VclPtr<Edit> pPage2_CGI; + VclPtr<FixedText> pPage2_Index_txt; + VclPtr<Edit> pPage2_Index; + VclPtr<FixedText> pPage2_Titel_Kiosk; + VclPtr<RadioButton> pPage2_ChgDefault; + VclPtr<RadioButton> pPage2_ChgAuto; + VclPtr<FixedText> pPage2_Duration_txt; + VclPtr<TimeField> pPage2_Duration; + VclPtr<CheckBox> pPage2_Endless; // page 3 controls - VclContainer* pPage3; - FixedText* pPage3_Titel1; - RadioButton* pPage3_Png; - RadioButton* pPage3_Gif; - RadioButton* pPage3_Jpg; - FixedText* pPage3_Quality_txt; - ComboBox* pPage3_Quality; - FixedText* pPage3_Titel2; - RadioButton* pPage3_Resolution_1; - RadioButton* pPage3_Resolution_2; - RadioButton* pPage3_Resolution_3; - FixedText* pPage3_Titel3; - CheckBox* pPage3_SldSound; - CheckBox* pPage3_HiddenSlides; + VclPtr<VclContainer> pPage3; + VclPtr<FixedText> pPage3_Titel1; + VclPtr<RadioButton> pPage3_Png; + VclPtr<RadioButton> pPage3_Gif; + VclPtr<RadioButton> pPage3_Jpg; + VclPtr<FixedText> pPage3_Quality_txt; + VclPtr<ComboBox> pPage3_Quality; + VclPtr<FixedText> pPage3_Titel2; + VclPtr<RadioButton> pPage3_Resolution_1; + VclPtr<RadioButton> pPage3_Resolution_2; + VclPtr<RadioButton> pPage3_Resolution_3; + VclPtr<FixedText> pPage3_Titel3; + VclPtr<CheckBox> pPage3_SldSound; + VclPtr<CheckBox> pPage3_HiddenSlides; // page 4 controls - VclContainer* pPage4; - FixedText* pPage4_Titel1; - FixedText* pPage4_Author_txt; - Edit* pPage4_Author; - FixedText* pPage4_Email_txt; - Edit* pPage4_Email; - FixedText* pPage4_WWW_txt; - Edit* pPage4_WWW; - FixedText* pPage4_Titel2; - VclMultiLineEdit* pPage4_Misc; - CheckBox* pPage4_Download; + VclPtr<VclContainer> pPage4; + VclPtr<FixedText> pPage4_Titel1; + VclPtr<FixedText> pPage4_Author_txt; + VclPtr<Edit> pPage4_Author; + VclPtr<FixedText> pPage4_Email_txt; + VclPtr<Edit> pPage4_Email; + VclPtr<FixedText> pPage4_WWW_txt; + VclPtr<Edit> pPage4_WWW; + VclPtr<FixedText> pPage4_Titel2; + VclPtr<VclMultiLineEdit> pPage4_Misc; + VclPtr<CheckBox> pPage4_Download; // page 5 controls - VclContainer* pPage5; - FixedText* pPage5_Titel; - CheckBox* pPage5_TextOnly; - ValueSet* pPage5_Buttons; + VclPtr<VclContainer> pPage5; + VclPtr<FixedText> pPage5_Titel; + VclPtr<CheckBox> pPage5_TextOnly; + VclPtr<ValueSet> pPage5_Buttons; // page 6 controls - VclContainer* pPage6; - FixedText* pPage6_Titel; - RadioButton* pPage6_Default; - RadioButton* pPage6_User; - PushButton* pPage6_Back; - PushButton* pPage6_Text; - PushButton* pPage6_Link; - PushButton* pPage6_VLink; - PushButton* pPage6_ALink; - RadioButton* pPage6_DocColors; - SdHtmlAttrPreview* pPage6_Preview; + VclPtr<VclContainer> pPage6; + VclPtr<FixedText> pPage6_Titel; + VclPtr<RadioButton> pPage6_Default; + VclPtr<RadioButton> pPage6_User; + VclPtr<PushButton> pPage6_Back; + VclPtr<PushButton> pPage6_Text; + VclPtr<PushButton> pPage6_Link; + VclPtr<PushButton> pPage6_VLink; + VclPtr<PushButton> pPage6_ALink; + VclPtr<RadioButton> pPage6_DocColors; + VclPtr<SdHtmlAttrPreview> pPage6_Preview; boost::scoped_ptr< ButtonSet > mpButtonSet; // standard controls - PushButton* pLastPageButton; - PushButton* pNextPageButton; - PushButton* pFinishButton; + VclPtr<PushButton> pLastPageButton; + VclPtr<PushButton> pNextPageButton; + VclPtr<PushButton> pFinishButton; Assistent aAssistentFunc; @@ -197,6 +197,7 @@ public: SdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType); virtual ~SdPublishingDlg(); + virtual void dispose() SAL_OVERRIDE; void GetParameterSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rParams ); }; diff --git a/sd/source/ui/inc/sdpreslt.hxx b/sd/source/ui/inc/sdpreslt.hxx index bef6400329ff..69093c624a8c 100644 --- a/sd/source/ui/inc/sdpreslt.hxx +++ b/sd/source/ui/inc/sdpreslt.hxx @@ -41,8 +41,8 @@ public: ::sd::DrawDocShell* pDocShell, vcl::Window* pWindow, const SfxItemSet& rInAttrs); - virtual ~SdPresLayoutDlg(); + virtual void dispose() SAL_OVERRIDE; void GetAttr(SfxItemSet& rOutAttrs); @@ -51,10 +51,10 @@ public: private: ::sd::DrawDocShell* mpDocSh; - ValueSet* m_pVS; - CheckBox* m_pCbxMasterPage; - CheckBox* m_pCbxCheckMasters; - PushButton* m_pBtnLoad; + VclPtr<ValueSet> m_pVS; + VclPtr<CheckBox> m_pCbxMasterPage; + VclPtr<CheckBox> m_pCbxCheckMasters; + VclPtr<PushButton> m_pBtnLoad; const SfxItemSet& mrOutAttrs; diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index bbbfeed10c68..780b44c34368 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -121,7 +121,7 @@ public: protected: - vcl::Window* mpParent; + VclPtr<vcl::Window> mpParent; const SdDrawDocument* mpDoc; SdDrawDocument* mpBookmarkDoc; SfxMedium* mpMedium; @@ -131,7 +131,7 @@ protected: bool mbLinkableSelected; OUString maDocName; ::sd::DrawDocShellRef mxBookmarkDocShRef; ///< for the loading of bookmarks - SdNavigatorWin* mpDropNavWin; + VclPtr<SdNavigatorWin> mpDropNavWin; SfxViewFrame* mpFrame; std::vector<OUString> maTreeItem; bool mbSaveTreeItemState; @@ -187,6 +187,7 @@ public: SdPageObjsTLB( vcl::Window* pParent, const SdResId& rSdResId ); SdPageObjsTLB( vcl::Window* pParent, WinBits nStyle ); virtual ~SdPageObjsTLB(); + virtual void dispose() SAL_OVERRIDE; // helper function for GetEntryAltText and GetEntryLongDescription OUString getAltLongDescText( SvTreeListEntry* pEntry , bool isAltText) const; diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx index d249a1579e6a..640c20763b6a 100644 --- a/sd/source/ui/inc/sdxfer.hxx +++ b/sd/source/ui/inc/sdxfer.hxx @@ -123,7 +123,7 @@ private: SdDrawDocument* mpSdDrawDocument; SdDrawDocument* mpSdDrawDocumentIntern; SdDrawDocument* mpSourceDoc; - VirtualDevice* mpVDev; + VclPtr<VirtualDevice> mpVDev; INetBookmark* mpBookmark; Graphic* mpGraphic; ImageMap* mpImageMap; diff --git a/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx index a5d1abef8580..d39b8bcfd028 100644 --- a/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx +++ b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx @@ -86,7 +86,7 @@ private: static void AddInstance (const SdDrawDocument* pDocument, SlideSorterCacheDisplay* pControl); static void RemoveInstance (SlideSorterCacheDisplay* pControl); - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; sal_Int32 mnPageCount; sal_Int32 mnColumnCount; sal_Int32 mnRowCount; diff --git a/sd/source/ui/inc/tbx_ww.hxx b/sd/source/ui/inc/tbx_ww.hxx index fb19bb3d6a69..9754107f4ee1 100644 --- a/sd/source/ui/inc/tbx_ww.hxx +++ b/sd/source/ui/inc/tbx_ww.hxx @@ -35,7 +35,7 @@ public: virtual ~SdTbxControl() {} virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; }; diff --git a/sd/source/ui/inc/tpaction.hxx b/sd/source/ui/inc/tpaction.hxx index 08abc0173b67..8865c0579141 100644 --- a/sd/source/ui/inc/tpaction.hxx +++ b/sd/source/ui/inc/tpaction.hxx @@ -53,21 +53,21 @@ public: class SdTPAction : public SfxTabPage { private: - ListBox* m_pLbAction; - - FixedText* m_pFtTree; // jump destination controls - SdPageObjsTLB* m_pLbTree; - SdPageObjsTLB* m_pLbTreeDocument; - ListBox* m_pLbOLEAction; - - VclFrame* m_pFrame; - Edit* m_pEdtSound; - Edit* m_pEdtBookmark; - Edit* m_pEdtDocument; - Edit* m_pEdtProgram; - Edit* m_pEdtMacro; - PushButton* m_pBtnSearch; - PushButton* m_pBtnSeek; + VclPtr<ListBox> m_pLbAction; + + VclPtr<FixedText> m_pFtTree; // jump destination controls + VclPtr<SdPageObjsTLB> m_pLbTree; + VclPtr<SdPageObjsTLB> m_pLbTreeDocument; + VclPtr<ListBox> m_pLbOLEAction; + + VclPtr<VclFrame> m_pFrame; + VclPtr<Edit> m_pEdtSound; + VclPtr<Edit> m_pEdtBookmark; + VclPtr<Edit> m_pEdtDocument; + VclPtr<Edit> m_pEdtProgram; + VclPtr<Edit> m_pEdtMacro; + VclPtr<PushButton> m_pBtnSearch; + VclPtr<PushButton> m_pBtnSeek; const SfxItemSet& rOutAttrs; const ::sd::View* mpView; @@ -97,8 +97,9 @@ private: public: SdTPAction( vcl::Window* pParent, const SfxItemSet& rInAttrs ); virtual ~SdTPAction(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window*, const SfxItemSet& ); + static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet& ); virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE; diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx index 5ef18f4c4452..ffb600ea8f3e 100644 --- a/sd/source/ui/inc/tpoption.hxx +++ b/sd/source/ui/inc/tpoption.hxx @@ -38,7 +38,7 @@ public: SdTpOptionsSnap( vcl::Window* pParent, const SfxItemSet& rInAttrs ); virtual ~SdTpOptionsSnap(); - static SfxTabPage* Create( vcl::Window*, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* ); virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE; @@ -50,16 +50,17 @@ public: class SdTpOptionsContents : public SfxTabPage { private: - CheckBox* m_pCbxRuler; - CheckBox* m_pCbxDragStripes; - CheckBox* m_pCbxHandlesBezier; - CheckBox* m_pCbxMoveOutline; + VclPtr<CheckBox> m_pCbxRuler; + VclPtr<CheckBox> m_pCbxDragStripes; + VclPtr<CheckBox> m_pCbxHandlesBezier; + VclPtr<CheckBox> m_pCbxMoveOutline; public: SdTpOptionsContents( vcl::Window* pParent, const SfxItemSet& rInAttrs ); virtual ~SdTpOptionsContents(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window*, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* ); virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE; }; @@ -73,38 +74,38 @@ class SdTpOptionsMisc : public SfxTabPage friend class SdModule; private: - CheckBox *m_pCbxQuickEdit; - CheckBox *m_pCbxPickThrough; + VclPtr<CheckBox> m_pCbxQuickEdit; + VclPtr<CheckBox> m_pCbxPickThrough; - VclFrame *m_pNewDocumentFrame; - CheckBox *m_pCbxStartWithTemplate; + VclPtr<VclFrame> m_pNewDocumentFrame; + VclPtr<CheckBox> m_pCbxStartWithTemplate; - CheckBox *m_pCbxMasterPageCache; - CheckBox *m_pCbxCopy; - CheckBox *m_pCbxMarkedHitMovesAlways; - VclFrame *m_pPresentationFrame; + VclPtr<CheckBox> m_pCbxMasterPageCache; + VclPtr<CheckBox> m_pCbxCopy; + VclPtr<CheckBox> m_pCbxMarkedHitMovesAlways; + VclPtr<VclFrame> m_pPresentationFrame; - ListBox *m_pLbMetric; - MetricField *m_pMtrFldTabstop; + VclPtr<ListBox> m_pLbMetric; + VclPtr<MetricField> m_pMtrFldTabstop; - CheckBox *m_pCbxEnableSdremote; - CheckBox *m_pCbxEnablePresenterScreen; - CheckBox *m_pCbxUsePrinterMetrics; - CheckBox *m_pCbxCompatibility; + VclPtr<CheckBox> m_pCbxEnableSdremote; + VclPtr<CheckBox> m_pCbxEnablePresenterScreen; + VclPtr<CheckBox> m_pCbxUsePrinterMetrics; + VclPtr<CheckBox> m_pCbxCompatibility; //Scale - VclFrame *m_pScaleFrame; - ComboBox *m_pCbScale; - FixedText *m_pNewDocLb; - FixedText *m_pFiInfo1; - MetricField *m_pMtrFldOriginalWidth; - FixedText *m_pWidthLb; - FixedText *m_pHeightLb; - FixedText *m_pFiInfo2; - MetricField *m_pMtrFldOriginalHeight; - CheckBox *m_pCbxDistrot; - MetricField *m_pMtrFldInfo1; - MetricField *m_pMtrFldInfo2; + VclPtr<VclFrame> m_pScaleFrame; + VclPtr<ComboBox> m_pCbScale; + VclPtr<FixedText> m_pNewDocLb; + VclPtr<FixedText> m_pFiInfo1; + VclPtr<MetricField> m_pMtrFldOriginalWidth; + VclPtr<FixedText> m_pWidthLb; + VclPtr<FixedText> m_pHeightLb; + VclPtr<FixedText> m_pFiInfo2; + VclPtr<MetricField> m_pMtrFldOriginalHeight; + VclPtr<CheckBox> m_pCbxDistrot; + VclPtr<MetricField> m_pMtrFldInfo1; + VclPtr<MetricField> m_pMtrFldInfo2; sal_uInt32 nWidth; sal_uInt32 nHeight; @@ -131,8 +132,9 @@ protected: public: SdTpOptionsMisc( vcl::Window* pParent, const SfxItemSet& rInAttrs ); virtual ~SdTpOptionsMisc(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window*, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* ); virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE; diff --git a/sd/source/ui/inc/vectdlg.hxx b/sd/source/ui/inc/vectdlg.hxx index 153343dae933..fefa8efe82ef 100644 --- a/sd/source/ui/inc/vectdlg.hxx +++ b/sd/source/ui/inc/vectdlg.hxx @@ -42,20 +42,20 @@ class DrawDocShell; class SdVectorizeDlg : public ModalDialog { ::sd::DrawDocShell * mpDocSh; - NumericField* m_pNmLayers; - MetricField* m_pMtReduce; - FixedText* m_pFtFillHoles; - MetricField* m_pMtFillHoles; - CheckBox* m_pCbFillHoles; + VclPtr<NumericField> m_pNmLayers; + VclPtr<MetricField> m_pMtReduce; + VclPtr<FixedText> m_pFtFillHoles; + VclPtr<MetricField> m_pMtFillHoles; + VclPtr<CheckBox> m_pCbFillHoles; - GraphCtrl* m_pBmpWin; + VclPtr<GraphCtrl> m_pBmpWin; - GraphCtrl* m_pMtfWin; + VclPtr<GraphCtrl> m_pMtfWin; - ProgressBar* m_pPrgs; + VclPtr<ProgressBar> m_pPrgs; - OKButton* m_pBtnOK; - PushButton* m_pBtnPreview; + VclPtr<OKButton> m_pBtnOK; + VclPtr<PushButton> m_pBtnPreview; Bitmap aBmp; Bitmap aPreviewBmp; @@ -82,6 +82,7 @@ public: SdVectorizeDlg( vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ); virtual ~SdVectorizeDlg(); + virtual void dispose() SAL_OVERRIDE; const GDIMetaFile& GetGDIMetaFile() const { return aMtf; } }; diff --git a/sd/source/ui/presenter/PresenterHelper.cxx b/sd/source/ui/presenter/PresenterHelper.cxx index 79d9ef48cad2..60b7bcb701de 100644 --- a/sd/source/ui/presenter/PresenterHelper.cxx +++ b/sd/source/ui/presenter/PresenterHelper.cxx @@ -79,11 +79,11 @@ Reference<awt::XWindow> SAL_CALL PresenterHelper::createWindow ( vcl::Window* pWindow = NULL; if (bCreateSystemChildWindow) { - pWindow = new WorkWindow(pParentWindow, WB_SYSTEMCHILDWINDOW); + pWindow = VclPtr<WorkWindow>::Create(pParentWindow, WB_SYSTEMCHILDWINDOW); } else { - pWindow = new vcl::Window(pParentWindow); + pWindow = VclPtr<vcl::Window>::Create(pParentWindow); } Reference<awt::XWindow> xWindow (pWindow->GetComponentInterface(), UNO_QUERY); diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx index 7fde4a4c5e08..0df3b852583a 100644 --- a/sd/source/ui/presenter/PresenterTextView.cxx +++ b/sd/source/ui/presenter/PresenterTextView.cxx @@ -82,7 +82,7 @@ public: private: Reference<rendering::XBitmap> mxBitmap; cppcanvas::CanvasSharedPtr mpCanvas; - VirtualDevice* mpOutputDevice; + VclPtr<VirtualDevice> mpOutputDevice; EditEngine* mpEditEngine; SfxItemPool* mpEditEngineItemPool; Size maSize; @@ -242,7 +242,7 @@ PresenterTextView::Implementation::Implementation() msTotalHeightPropertyName("TotalHeight"), mxBitmap(), mpCanvas(), - mpOutputDevice(new VirtualDevice(*Application::GetDefaultDevice(), 0, 0)), + mpOutputDevice(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), 0, 0)), mpEditEngine(NULL), mpEditEngineItemPool(EditEngine::CreatePool()), maSize(100,100), @@ -261,7 +261,7 @@ PresenterTextView::Implementation::~Implementation() { delete mpEditEngine; SfxItemPool::Free(mpEditEngineItemPool); - delete mpOutputDevice; + mpOutputDevice.disposeAndClear(); } EditEngine * PresenterTextView::Implementation::GetEditEngine() @@ -453,9 +453,8 @@ Reference<rendering::XBitmap> PresenterTextView::Implementation::GetBitmap() if ( ! mxBitmap.is()) { - if (mpOutputDevice != NULL) - delete mpOutputDevice; - mpOutputDevice = new VirtualDevice(*Application::GetDefaultDevice(), 0, 0); + mpOutputDevice.disposeAndClear(); + mpOutputDevice = VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), 0, 0); mpOutputDevice->SetMapMode(MAP_PIXEL); mpOutputDevice->SetOutputSizePixel(maSize, true); mpOutputDevice->SetLineColor(); diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx index 8e40ef1d0471..1ab67e2a63ef 100644 --- a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx @@ -77,7 +77,7 @@ public: SortedMasterPageDescriptorList() {} }; -MasterPagesSelector* AllMasterPagesSelector::Create ( +VclPtr<vcl::Window> AllMasterPagesSelector::Create ( vcl::Window* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) @@ -88,13 +88,14 @@ MasterPagesSelector* AllMasterPagesSelector::Create ( ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); - MasterPagesSelector* pSelector( + VclPtr<MasterPagesSelector> pSelector( new AllMasterPagesSelector ( pParent, *pDocument, rViewShellBase, pContainer, - rxSidebar)); + rxSidebar), + SAL_NO_ACQUIRE); pSelector->LateInit(); pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL); diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx index 11bcb2640f65..58c958517bd6 100644 --- a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx @@ -37,7 +37,7 @@ class AllMasterPagesSelector : public MasterPagesSelector { public: - static MasterPagesSelector* Create ( + static VclPtr<vcl::Window> Create ( vcl::Window* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx index 5e8bdad96b52..de51f263dbf4 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx @@ -42,7 +42,7 @@ using namespace ::com::sun::star; namespace sd { namespace sidebar { -MasterPagesSelector* CurrentMasterPagesSelector::Create ( +VclPtr<vcl::Window> CurrentMasterPagesSelector::Create ( vcl::Window* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) @@ -53,13 +53,14 @@ MasterPagesSelector* CurrentMasterPagesSelector::Create ( ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); - MasterPagesSelector* pSelector( + VclPtr<MasterPagesSelector> pSelector( new CurrentMasterPagesSelector ( pParent, *pDocument, rViewShellBase, pContainer, - rxSidebar)); + rxSidebar), + SAL_NO_ACQUIRE); pSelector->LateInit(); pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT ); @@ -91,6 +92,11 @@ CurrentMasterPagesSelector::CurrentMasterPagesSelector ( CurrentMasterPagesSelector::~CurrentMasterPagesSelector() { + disposeOnce(); +} + +void CurrentMasterPagesSelector::dispose() +{ if (mrDocument.GetDocSh() != NULL) { EndListening(*mrDocument.GetDocSh()); @@ -102,6 +108,8 @@ CurrentMasterPagesSelector::~CurrentMasterPagesSelector() Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener)); mrBase.GetEventMultiplexer()->RemoveEventListener(aLink); + + MasterPagesSelector::dispose(); } void CurrentMasterPagesSelector::LateInit() diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx index e9a3cbe5d7d8..9443b991654c 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx @@ -35,7 +35,7 @@ class CurrentMasterPagesSelector public SfxListener { public: - static MasterPagesSelector* Create ( + static VclPtr<vcl::Window> Create ( vcl::Window* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); @@ -68,6 +68,7 @@ private: const ::boost::shared_ptr<MasterPageContainer>& rpContainer, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); virtual ~CurrentMasterPagesSelector(); + virtual void dispose() SAL_OVERRIDE; virtual void LateInit() SAL_OVERRIDE; diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 1306ffbb8f13..c304b981bc45 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -194,8 +194,14 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) LayoutMenu::~LayoutMenu() { + disposeOnce(); +} + +void LayoutMenu::dispose() +{ SAL_INFO("sd.ui", "destroying LayoutMenu at " << this); Dispose(); + ValueSet::dispose(); } void LayoutMenu::Dispose() diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx index 32c5819f9649..94e16a40ccaa 100644 --- a/sd/source/ui/sidebar/LayoutMenu.hxx +++ b/sd/source/ui/sidebar/LayoutMenu.hxx @@ -73,6 +73,7 @@ public: ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); virtual ~LayoutMenu(); + virtual void dispose() SAL_OVERRIDE; void Dispose(); diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx index 28d3abde2d9a..f17c15aecaee 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx @@ -104,11 +104,17 @@ MasterPagesSelector::MasterPagesSelector ( MasterPagesSelector::~MasterPagesSelector() { + disposeOnce(); +} + +void MasterPagesSelector::dispose() +{ Clear(); UpdateLocks(ItemList()); Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); mpContainer->RemoveChangeListener(aChangeListener); + PreviewValueSet::dispose(); } void MasterPagesSelector::LateInit() diff --git a/sd/source/ui/sidebar/MasterPagesSelector.hxx b/sd/source/ui/sidebar/MasterPagesSelector.hxx index eab38546d57b..e5121791277c 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.hxx @@ -63,6 +63,7 @@ public: const ::boost::shared_ptr<MasterPageContainer>& rpContainer, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); virtual ~MasterPagesSelector(); + virtual void dispose() SAL_OVERRIDE; virtual void LateInit(); diff --git a/sd/source/ui/sidebar/NavigatorWrapper.cxx b/sd/source/ui/sidebar/NavigatorWrapper.cxx index 6df0a2e01aa6..376d22b9152a 100644 --- a/sd/source/ui/sidebar/NavigatorWrapper.cxx +++ b/sd/source/ui/sidebar/NavigatorWrapper.cxx @@ -33,27 +33,34 @@ NavigatorWrapper::NavigatorWrapper ( SfxBindings* pBindings) : Control(pParent, 0), mrViewShellBase(rViewShellBase), - maNavigator( + maNavigator(VclPtr<SdNavigatorWin>::Create( this, - NULL, + (::sd::NavigatorChildWindow*)NULL, SdResId(FLT_NAVIGATOR), pBindings, - ::boost::bind(&NavigatorWrapper::UpdateNavigator, this)) + ::boost::bind(&NavigatorWrapper::UpdateNavigator, this))) { - maNavigator.SetPosSizePixel( + maNavigator->SetPosSizePixel( Point(0,0), GetSizePixel()); - maNavigator.SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); - maNavigator.Show(); + maNavigator->SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + maNavigator->Show(); } NavigatorWrapper::~NavigatorWrapper() { + disposeOnce(); +} + +void NavigatorWrapper::dispose() +{ + maNavigator.disposeAndClear(); + Control::dispose(); } void NavigatorWrapper::Resize() { - maNavigator.SetSizePixel(GetSizePixel()); + maNavigator->SetSizePixel(GetSizePixel()); } css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth) @@ -65,12 +72,12 @@ css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth) void NavigatorWrapper::UpdateNavigator() { - maNavigator.InitTreeLB(mrViewShellBase.GetDocument()); + maNavigator->InitTreeLB(mrViewShellBase.GetDocument()); } void NavigatorWrapper::GetFocus() { - maNavigator.GrabFocus(); + maNavigator->GrabFocus(); } } } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/NavigatorWrapper.hxx b/sd/source/ui/sidebar/NavigatorWrapper.hxx index 98c95aa72426..49ac6d0ee0f7 100644 --- a/sd/source/ui/sidebar/NavigatorWrapper.hxx +++ b/sd/source/ui/sidebar/NavigatorWrapper.hxx @@ -44,8 +44,8 @@ public: vcl::Window* pParent, sd::ViewShellBase& rViewShellBase, SfxBindings* pBindings); - virtual ~NavigatorWrapper(); + virtual void dispose() SAL_OVERRIDE; // Control virtual void Resize() SAL_OVERRIDE; @@ -56,7 +56,7 @@ public: private: ViewShellBase& mrViewShellBase; - SdNavigatorWin maNavigator; + VclPtr<SdNavigatorWin> maNavigator; void UpdateNavigator(); }; diff --git a/sd/source/ui/sidebar/PanelBase.cxx b/sd/source/ui/sidebar/PanelBase.cxx index f0366b7c329d..c7bcde32e36a 100644 --- a/sd/source/ui/sidebar/PanelBase.cxx +++ b/sd/source/ui/sidebar/PanelBase.cxx @@ -38,15 +38,19 @@ PanelBase::PanelBase ( PanelBase::~PanelBase() { - OSL_TRACE("deleting wrapped control at %p", mpWrappedControl.get()); - mpWrappedControl.reset(); - OSL_TRACE("deleting PanelBase at %p from parent %p", this, GetParent()); + disposeOnce(); +} + +void PanelBase::dispose() +{ + mpWrappedControl.disposeAndClear(); + Control::dispose(); } void PanelBase::Dispose() { OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %p", mpWrappedControl.get()); - mpWrappedControl.reset(); + mpWrappedControl.disposeAndClear(); } css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 /*nWidth*/) @@ -69,7 +73,7 @@ void PanelBase::Resize() void PanelBase::SetSidebar (const css::uno::Reference<css::ui::XSidebar>& rxSidebar) { mxSidebar = rxSidebar; - if (mxSidebar.is() && mpWrappedControl!=0) + if (mxSidebar.is() && mpWrappedControl!=nullptr) mxSidebar->requestLayout(); } diff --git a/sd/source/ui/sidebar/PanelBase.hxx b/sd/source/ui/sidebar/PanelBase.hxx index dcef4732e521..b0f4fb0cfb5e 100644 --- a/sd/source/ui/sidebar/PanelBase.hxx +++ b/sd/source/ui/sidebar/PanelBase.hxx @@ -45,6 +45,7 @@ public: vcl::Window* pParentWindow, ViewShellBase& rViewShellBase); virtual ~PanelBase(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -58,7 +59,7 @@ public: virtual void SetSidebar (const css::uno::Reference<css::ui::XSidebar>& rxSidebar) SAL_OVERRIDE; protected: - ::boost::scoped_ptr< vcl::Window> mpWrappedControl; + VclPtr< vcl::Window> mpWrappedControl; virtual vcl::Window* CreateWrappedControl ( vcl::Window* pParentWindow, ViewShellBase& rViewShellBase) = 0; diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx index f10290af8572..73013aa037a5 100644 --- a/sd/source/ui/sidebar/PanelFactory.cxx +++ b/sd/source/ui/sidebar/PanelFactory.cxx @@ -120,14 +120,14 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); // Create a framework view. - vcl::Window* pControl = NULL; + VclPtr<vcl::Window> pControl; css::ui::LayoutSize aLayoutSize (-1,-1,-1); #define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t)) if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations)) - pControl = new CustomAnimationPanel(pParentWindow, *pBase, xFrame); + pControl = VclPtr<vcl::Window>(new CustomAnimationPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE); else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts)) - pControl = new LayoutMenu(pParentWindow, *pBase, xSidebar); + pControl = VclPtr<vcl::Window>(new LayoutMenu(pParentWindow, *pBase, xSidebar), SAL_NO_ACQUIRE); else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages)) pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages)) @@ -135,14 +135,14 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages)) pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions)) - pControl = new SlideTransitionPanel(pParentWindow, *pBase, xFrame); + pControl = VclPtr<vcl::Window>(new SlideTransitionPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE); else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign)) - pControl = new TableDesignPanel(pParentWindow, *pBase); + pControl = VclPtr<vcl::Window>(new TableDesignPanel(pParentWindow, *pBase), SAL_NO_ACQUIRE); else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator)) - pControl = new NavigatorWrapper(pParentWindow, *pBase, pBindings); + pControl = VclPtr<vcl::Window>(new NavigatorWrapper(pParentWindow, *pBase, pBindings), SAL_NO_ACQUIRE); #undef EndsWith - if (pControl == NULL) + if (!pControl) throw lang::IllegalArgumentException(); // Create a wrapper around the control that implements the diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx index 6266e2e25f61..b31e139e22d6 100644 --- a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx @@ -32,7 +32,7 @@ namespace sd { namespace sidebar { -MasterPagesSelector* RecentMasterPagesSelector::Create ( +VclPtr<vcl::Window> RecentMasterPagesSelector::Create ( vcl::Window* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) @@ -43,13 +43,14 @@ MasterPagesSelector* RecentMasterPagesSelector::Create ( ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); - MasterPagesSelector* pSelector( + VclPtr<MasterPagesSelector> pSelector( new RecentMasterPagesSelector ( pParent, *pDocument, rViewShellBase, pContainer, - rxSidebar)); + rxSidebar), + SAL_NO_ACQUIRE); pSelector->LateInit(); pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_RECENT); @@ -68,8 +69,14 @@ RecentMasterPagesSelector::RecentMasterPagesSelector ( RecentMasterPagesSelector::~RecentMasterPagesSelector() { + disposeOnce(); +} + +void RecentMasterPagesSelector::dispose() +{ RecentlyUsedMasterPages::Instance().RemoveEventListener ( LINK(this,RecentMasterPagesSelector,MasterPageListListener)); + MasterPagesSelector::dispose(); } void RecentMasterPagesSelector::LateInit() diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx index f690c7875674..a7f470317989 100644 --- a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx @@ -30,7 +30,7 @@ class RecentMasterPagesSelector : public MasterPagesSelector { public: - static MasterPagesSelector* Create ( + static VclPtr<vcl::Window> Create ( vcl::Window* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); @@ -65,6 +65,7 @@ private: const ::boost::shared_ptr<MasterPageContainer>& rpContainer, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); virtual ~RecentMasterPagesSelector(); + virtual void dispose() SAL_OVERRIDE; virtual void LateInit() SAL_OVERRIDE; }; diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx index 29c4031dc20d..cb49f89227e5 100644 --- a/sd/source/ui/slideshow/showwin.cxx +++ b/sd/source/ui/slideshow/showwin.cxx @@ -79,8 +79,14 @@ ShowWindow::ShowWindow( const ::rtl::Reference< SlideshowImpl >& xController, vc ShowWindow::~ShowWindow() { + disposeOnce(); +} + +void ShowWindow::dispose() +{ maPauseTimer.Stop(); maMouseTimer.Stop(); + ::sd::Window::dispose(); } void ShowWindow::KeyInput(const KeyEvent& rKEvt) @@ -498,18 +504,18 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly ) if( SLIDE_NO_TIMEOUT != mnPauseTimeout ) { MapMode aVMap( rMap ); - VirtualDevice aVDev( *this ); + ScopedVclPtrInstance< VirtualDevice > pVDev( *this ); aVMap.SetOrigin( Point() ); - aVDev.SetMapMode( aVMap ); - aVDev.SetBackground( Wallpaper( Color( COL_BLACK ) ) ); + pVDev->SetMapMode( aVMap ); + pVDev->SetBackground( Wallpaper( Color( COL_BLACK ) ) ); // set font first, to determine real output height - aVDev.SetFont( aFont ); + pVDev->SetFont( aFont ); - const Size aVDevSize( aOutSize.Width(), aVDev.GetTextHeight() ); + const Size aVDevSize( aOutSize.Width(), pVDev->GetTextHeight() ); - if( aVDev.SetOutputSize( aVDevSize ) ) + if( pVDev->SetOutputSize( aVDevSize ) ) { // Note: if performance gets an issue here, we can use NumberFormatter directly SvtSysLocale aSysLocale; @@ -518,8 +524,8 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly ) aText += " ( "; aText += aLocaleData.getDuration( ::tools::Time( 0, 0, mnPauseTimeout ) ); aText += " )"; - aVDev.DrawText( Point( aOffset.Width(), 0 ), aText ); - DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, aVDev ); + pVDev->DrawText( Point( aOffset.Width(), 0 ), aText ); + DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, *pVDev.get() ); bDrawn = true; } } diff --git a/sd/source/ui/slideshow/showwindow.hxx b/sd/source/ui/slideshow/showwindow.hxx index 81bfe0a437c3..827dd1054071 100644 --- a/sd/source/ui/slideshow/showwindow.hxx +++ b/sd/source/ui/slideshow/showwindow.hxx @@ -51,6 +51,7 @@ class ShowWindow public: ShowWindow ( const ::rtl::Reference< ::sd::SlideshowImpl >& xController, vcl::Window* pParent ); virtual ~ShowWindow(); + virtual void dispose() SAL_OVERRIDE; bool SetEndMode(); bool SetPauseMode( sal_Int32 nPageIndexToRestart, sal_Int32 nTimeoutSec = SLIDE_NO_TIMEOUT, Graphic* pLogo = NULL ); diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index d077853dfc65..36ca9d4b5eab 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -927,7 +927,7 @@ bool SlideShow::startPreview( const Reference< XDrawPage >& xDrawPage, const Ref OutputDevice* SlideShow::getShowWindow() { - return mxController.is() ? mxController->mpShowWindow : 0; + return mxController.is() ? mxController->mpShowWindow.get() : 0; } int SlideShow::getAnimationMode() @@ -1159,7 +1159,7 @@ void SlideShow::StartFullscreenPresentation( ) // will be created. This is done here explicitly so that we can make it // fullscreen. const sal_Int32 nDisplay (GetDisplay()); - WorkWindow* pWorkWindow = new FullScreenWorkWindow(this, mpCurrentViewShellBase); + VclPtr<WorkWindow> pWorkWindow = VclPtr<FullScreenWorkWindow>::Create(this, mpCurrentViewShellBase); pWorkWindow->SetBackground(Wallpaper(COL_BLACK)); pWorkWindow->StartPresentationMode( true, mpDoc->getPresentationSettings().mbAlwaysOnTop ? PRESENTATION_HIDEALLAPPS : 0, nDisplay); // pWorkWindow->ShowFullScreenMode(sal_False, nDisplay); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 080f5da12cda..1d45a5b3d362 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -705,14 +705,12 @@ void SAL_CALL SlideshowImpl::disposing() } if( mpTimeButton ) - { mpTimeButton->Hide(); - delete mpTimeButton; - mpTimeButton = 0; - } + mpTimeButton.disposeAndClear(); if( mpShowWindow ) mpShowWindow->Hide(); + mpShowWindow.disposeAndClear(); if ( mpViewShell ) { @@ -743,8 +741,7 @@ void SAL_CALL SlideshowImpl::disposing() if( mpShowWindow ) { - delete mpShowWindow; - mpShowWindow = 0; + mpShowWindow.clear(); } setActiveXToolbarsVisible( true ); @@ -805,7 +802,7 @@ bool SlideshowImpl::startPreview( mpSlideController->insertSlideNumber( nSlideNumber-1 ); mpSlideController->setPreviewNode( xAnimationNode ); - mpShowWindow = new ShowWindow( this, ((pParent == 0) && mpViewShell) ? mpParentWindow : pParent ); + mpShowWindow = VclPtr<ShowWindow>::Create( this, ((pParent == 0) && mpViewShell) ? mpParentWindow.get() : pParent ); if( mpViewShell ) { mpViewShell->SetActiveWindow( mpShowWindow ); @@ -857,7 +854,7 @@ bool SlideshowImpl::startPreview( bRet = startShowImpl( aProperties ); - if( mpShowWindow != 0 && meAnimationMode == ANIMATIONMODE_PREVIEW ) + if( mpShowWindow != nullptr && meAnimationMode == ANIMATIONMODE_PREVIEW ) mpShowWindow->SetPreviewMode(); } @@ -882,8 +879,8 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings ) DBG_ASSERT( !mxShow.is(), "sd::SlideshowImpl::startShow(), called twice!" ); if( mxShow.is() ) return true; - DBG_ASSERT( mpParentWindow!=NULL, "sd::SlideshowImpl::startShow() called without parent window" ); - if (mpParentWindow == NULL) + DBG_ASSERT( mpParentWindow!=nullptr, "sd::SlideshowImpl::startShow() called without parent window" ); + if (mpParentWindow == nullptr) return false; // Autoplay (pps/ppsx) @@ -970,7 +967,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings ) // hide child windows hideChildWindows(); - mpShowWindow = new ShowWindow( this, mpParentWindow ); + mpShowWindow = VclPtr<ShowWindow>::Create( this, mpParentWindow ); mpShowWindow->SetMouseAutoHide( !maPresSettings.mbMouseVisible ); if( mpViewShell ) { @@ -3346,7 +3343,8 @@ void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const Reference< XWindow > xWindow; if( rValue >>= xWindow ) { - mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : 0; + mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) + : VclPtr<vcl::Window>(); return; } } diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index d9ddffb8a07a..a85e3ca526d4 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -92,7 +92,7 @@ struct PresentationSettingsEx : public PresentationSettings { bool mbRehearseTimings; bool mbPreview; - vcl::Window* mpParentWindow; + VclPtr<vcl::Window> mpParentWindow; css::uno::Reference< css::drawing::XDrawPage > mxStartPage; css::uno::Reference< css::animations::XAnimationNode > mxAnimationNode; @@ -332,9 +332,9 @@ private: SdDrawDocument* mpDoc; SfxItemSet* mpNewAttr; - vcl::Window* mpParentWindow; - ShowWindow* mpShowWindow; - PushButton* mpTimeButton; + VclPtr<vcl::Window> mpParentWindow; + VclPtr<ShowWindow> mpShowWindow; + VclPtr<PushButton> mpTimeButton; boost::shared_ptr< AnimationSlideController > mpSlideController; @@ -347,8 +347,8 @@ private: OUString maCharBuffer; Pointer maOldPointer; Pointer maPencil; - std::vector< ::sd::Window* > maDrawModeWindows; - ::sd::Window* mpOldActiveWindow; + std::vector< VclPtr<::sd::Window> > maDrawModeWindows; + VclPtr<::sd::Window> mpOldActiveWindow; Link maStarBASICGlobalErrorHdl; unsigned long mnChildMask; bool mbGridVisible; diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index aae8a7eec2b7..fcb7f44ecd7f 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -118,7 +118,7 @@ SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter) mnPaintEntranceCount(0), mbIsContextMenuOpen(false) { - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); OSL_ASSERT(pWindow); if (pWindow) { @@ -502,7 +502,7 @@ void SlideSorterController::PostModelChange() mbPostModelChangePending = false; mrModel.Resync(); - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow) { GetCurrentSlideManager()->HandleModelChange(); @@ -541,7 +541,7 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent) if (pEvent != NULL) { ::vcl::Window* pWindow = pEvent->GetWindow(); - SharedSdWindow pActiveWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pActiveWindow (mrSlideSorter.GetContentWindow()); switch (pEvent->GetId()) { case VCLEVENT_WINDOW_ACTIVATE: @@ -557,12 +557,12 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent) case VCLEVENT_WINDOW_GETFOCUS: if (pActiveWindow) - if (pWindow == pActiveWindow.get()) + if (pWindow == pActiveWindow) GetFocusManager().ShowFocus(false); break; case VCLEVENT_WINDOW_LOSEFOCUS: - if (pActiveWindow && pWindow == pActiveWindow.get()) + if (pActiveWindow && pWindow == pActiveWindow) { GetFocusManager().HideFocus(); mrView.GetToolTip().Hide(); @@ -584,7 +584,7 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent) : ViewShell::OUTPUT_DRAWMODE_COLOR); if (mrSlideSorter.GetViewShell() != NULL) mrSlideSorter.GetViewShell()->GetFrameView()->SetDrawMode(nDrawMode); - if (pActiveWindow != 0) + if (pActiveWindow != nullptr) pActiveWindow->SetDrawMode(nDrawMode); mrView.HandleDrawModeChange(); @@ -714,7 +714,7 @@ Rectangle SlideSorterController::Rearrange (bool bForce) else mbIsForcedRearrangePending = false; - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow) { if (bForce) @@ -864,7 +864,7 @@ void SlideSorterController::PageNameHasChanged (int nPageIndex, const OUString& // Get a pointer to the corresponding accessible object and notify // that of the name change. - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if ( ! pWindow) return; diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index d7898c1a3d9f..9d6bdb8d0feb 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -287,11 +287,11 @@ sal_Int32 Clipboard::GetInsertionPosition (::vcl::Window* pWindow) else if (mrController.GetFocusManager().IsFocusShowing()) { // Use the focus to determine the insertion position. - SdInsertPasteDlg aDialog (pWindow); - if (aDialog.Execute() == RET_OK) + ScopedVclPtrInstance< SdInsertPasteDlg > aDialog(pWindow); + if (aDialog->Execute() == RET_OK) { nInsertPosition = mrController.GetFocusManager().GetFocusedPageIndex(); - if ( ! aDialog.IsInsertBefore()) + if ( ! aDialog->IsInsertBefore()) nInsertPosition ++; } } diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx index 3faf316f1dda..1ee52e80f1d6 100644 --- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx +++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx @@ -87,7 +87,7 @@ void DragAndDropContext::UpdatePosition ( // Convert window coordinates into model coordinates (we need the // window coordinates for auto-scrolling because that remains // constant while scrolling.) - SharedSdWindow pWindow (mpTargetSlideSorter->GetContentWindow()); + sd::Window *pWindow (mpTargetSlideSorter->GetContentWindow()); const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition)); ::boost::shared_ptr<InsertionIndicatorHandler> pInsertionIndicatorHandler ( mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler()); diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx index 5fcebfb83746..ccf32ce708e5 100644 --- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx @@ -72,12 +72,12 @@ ScrollBarManager::~ScrollBarManager() void ScrollBarManager::Connect() { - if (mpVerticalScrollBar != 0) + if (mpVerticalScrollBar != nullptr) { mpVerticalScrollBar->SetScrollHdl ( LINK(this, ScrollBarManager, VerticalScrollBarHandler)); } - if (mpHorizontalScrollBar != 0) + if (mpHorizontalScrollBar != nullptr) { mpHorizontalScrollBar->SetScrollHdl( LINK(this, ScrollBarManager, HorizontalScrollBarHandler)); @@ -86,11 +86,11 @@ void ScrollBarManager::Connect() void ScrollBarManager::Disconnect() { - if (mpVerticalScrollBar != 0) + if (mpVerticalScrollBar != nullptr) { mpVerticalScrollBar->SetScrollHdl (Link()); } - if (mpHorizontalScrollBar != 0) + if (mpHorizontalScrollBar != nullptr) { mpHorizontalScrollBar->SetScrollHdl (Link()); } @@ -117,13 +117,13 @@ Rectangle ScrollBarManager::PlaceScrollBars ( bIsHorizontalScrollBarAllowed, bIsVerticalScrollBarAllowed)); - if (mpHorizontalScrollBar!=0 && mpHorizontalScrollBar->IsVisible()) + if (mpHorizontalScrollBar!=nullptr && mpHorizontalScrollBar->IsVisible()) PlaceHorizontalScrollBar (rAvailableArea); - if (mpVerticalScrollBar!=0 && mpVerticalScrollBar->IsVisible()) + if (mpVerticalScrollBar!=nullptr && mpVerticalScrollBar->IsVisible()) PlaceVerticalScrollBar (rAvailableArea); - if (mpScrollBarFiller!=0 && mpScrollBarFiller->IsVisible()) + if (mpScrollBarFiller!=nullptr && mpScrollBarFiller->IsVisible()) PlaceFiller (rAvailableArea); return aRemainingSpace; @@ -177,12 +177,12 @@ void ScrollBarManager::PlaceFiller (const Rectangle& aArea) void ScrollBarManager::UpdateScrollBars (bool bResetThumbPosition, bool bUseScrolling) { Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea()); - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); Size aWindowModelSize (pWindow->PixelToLogic(pWindow->GetSizePixel())); // The horizontal scroll bar is only shown when the window is // horizontally smaller than the view. - if (mpHorizontalScrollBar != 0 && mpHorizontalScrollBar->IsVisible()) + if (mpHorizontalScrollBar != nullptr && mpHorizontalScrollBar->IsVisible()) { mpHorizontalScrollBar->Show(); mpHorizontalScrollBar->SetRange ( @@ -212,7 +212,7 @@ void ScrollBarManager::UpdateScrollBars (bool bResetThumbPosition, bool bUseScro } // The vertical scroll bar is always shown. - if (mpVerticalScrollBar != 0 && mpVerticalScrollBar->IsVisible()) + if (mpVerticalScrollBar != nullptr && mpVerticalScrollBar->IsVisible()) { mpVerticalScrollBar->SetRange ( Range(aModelArea.Top(), aModelArea.Bottom())); @@ -257,7 +257,7 @@ IMPL_LINK(ScrollBarManager, VerticalScrollBarHandler, ScrollBar*, pScrollBar) if (pScrollBar!=NULL && pScrollBar==mpVerticalScrollBar.get() && pScrollBar->IsVisible() - && mrSlideSorter.GetContentWindow()!=0) + && mrSlideSorter.GetContentWindow()) { double nRelativePosition = double(pScrollBar->GetThumbPos()) / double(pScrollBar->GetRange().Len()); @@ -273,7 +273,7 @@ IMPL_LINK(ScrollBarManager, HorizontalScrollBarHandler, ScrollBar*, pScrollBar) if (pScrollBar!=NULL && pScrollBar==mpHorizontalScrollBar.get() && pScrollBar->IsVisible() - && mrSlideSorter.GetContentWindow()!=0) + && mrSlideSorter.GetContentWindow()) { double nRelativePosition = double(pScrollBar->GetThumbPos()) / double(pScrollBar->GetRange().Len()); @@ -291,7 +291,7 @@ void ScrollBarManager::SetWindowOrigin ( mnHorizontalPosition = nHorizontalPosition; mnVerticalPosition = nVerticalPosition; - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); Size aViewSize (pWindow->GetViewSize()); Point aOrigin ( (long int) (mnHorizontalPosition * aViewSize.Width()), @@ -431,7 +431,7 @@ void ScrollBarManager::SetTopLeft(const Point& rNewTopLeft) int ScrollBarManager::GetVerticalScrollBarWidth() const { - if (mpVerticalScrollBar != 0 && mpVerticalScrollBar->IsVisible()) + if (mpVerticalScrollBar != nullptr && mpVerticalScrollBar->IsVisible()) return mpVerticalScrollBar->GetSizePixel().Width(); else return 0; @@ -439,7 +439,7 @@ int ScrollBarManager::GetVerticalScrollBarWidth() const int ScrollBarManager::GetHorizontalScrollBarHeight() const { - if (mpHorizontalScrollBar != 0 && mpHorizontalScrollBar->IsVisible()) + if (mpHorizontalScrollBar != nullptr && mpHorizontalScrollBar->IsVisible()) return mpHorizontalScrollBar->GetSizePixel().Height(); else return 0; @@ -447,7 +447,7 @@ int ScrollBarManager::GetHorizontalScrollBarHeight() const void ScrollBarManager::CalcAutoScrollOffset (const Point& rMouseWindowPosition) { - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); int nDx = 0; int nDy = 0; @@ -458,7 +458,7 @@ void ScrollBarManager::CalcAutoScrollOffset (const Point& rMouseWindowPosition) pWindow->LogicToPixel(mrSlideSorter.GetView().GetModelArea())); if (aWindowSize.Width() > maScrollBorder.Width() * 3 - && mpHorizontalScrollBar != 0 + && mpHorizontalScrollBar != nullptr && mpHorizontalScrollBar->IsVisible()) { if (rMouseWindowPosition.X() < maScrollBorder.Width() diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index 8bef190c0ecf..1483befc1217 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -318,7 +318,7 @@ SelectionFunction::SelectionFunction ( SfxRequest& rRequest) : FuPoor ( rSlideSorter.GetViewShell(), - rSlideSorter.GetContentWindow().get(), + rSlideSorter.GetContentWindow(), &rSlideSorter.GetView(), rSlideSorter.GetModel().GetDocument(), rRequest), @@ -1384,7 +1384,7 @@ void MultiSelectionModeHandler::UpdatePosition ( // Convert window coordinates into model coordinates (we need the // window coordinates for auto-scrolling because that remains // constant while scrolling.) - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition)); bool bDoAutoScroll = bAllowAutoScroll && mrSlideSorter.GetController().GetScrollBarManager().AutoScroll( diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 17eaee29fd1a..c2be4751a2f8 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -190,7 +190,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) case SID_PRESENTATION_DLG: FuSlideShowDlg::Create ( pShell, - mrSlideSorter.GetContentWindow().get(), + mrSlideSorter.GetContentWindow(), &mrSlideSorter.GetView(), pDocument, rRequest); @@ -199,7 +199,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) case SID_CUSTOMSHOW_DLG: FuCustomShowDlg::Create ( pShell, - mrSlideSorter.GetContentWindow().get(), + mrSlideSorter.GetContentWindow(), &mrSlideSorter.GetView(), pDocument, rRequest); @@ -208,7 +208,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) case SID_EXPAND_PAGE: FuExpandPage::Create ( pShell, - mrSlideSorter.GetContentWindow().get(), + mrSlideSorter.GetContentWindow(), &mrSlideSorter.GetView(), pDocument, rRequest); @@ -217,7 +217,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) case SID_SUMMARY_PAGE: FuSummaryPage::Create ( pShell, - mrSlideSorter.GetContentWindow().get(), + mrSlideSorter.GetContentWindow(), &mrSlideSorter.GetView(), pDocument, rRequest); @@ -263,7 +263,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); boost::scoped_ptr<VclAbstractDialog> pDlg(pFact ? pFact->CreateSdPhotoAlbumDialog( - mrSlideSorter.GetContentWindow().get(), + mrSlideSorter.GetContentWindow(), pDocument) : 0); if (pDlg) @@ -280,7 +280,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) #ifdef ENABLE_SDREMOTE SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); VclAbstractDialog* pDlg = pFact ? - pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow().get() ) : + pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow() ) : 0; if (pDlg) pDlg->Execute(); @@ -904,7 +904,7 @@ void SlotManager::RenameSlide() SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); boost::scoped_ptr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog( - mrSlideSorter.GetContentWindow().get(), + mrSlideSorter.GetContentWindow(), aPageName, aDescr)); DBG_ASSERT(aNameDlg, "Dialog creation failed!"); aNameDlg->SetText( aTitle ); diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx index 4a29df00b43e..6ccc8afe539a 100644 --- a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx @@ -104,7 +104,7 @@ void VisibleAreaManager::MakeVisible() if (maVisibleRequests.empty()) return; - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if ( ! pWindow) return; const Point aCurrentTopLeft (pWindow->PixelToLogic(Point(0,0))); @@ -148,7 +148,7 @@ void VisibleAreaManager::MakeVisible() ::boost::optional<Point> VisibleAreaManager::GetRequestedTopLeft() const { - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if ( ! pWindow) return ::boost::optional<Point>(); diff --git a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx index ca039c316a4f..d62acead1377 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx @@ -25,7 +25,6 @@ #include <tools/link.hxx> #include <tools/gen.hxx> #include <vcl/timer.hxx> -#include <boost/shared_ptr.hpp> #include <boost/function.hpp> class ScrollBar; @@ -179,12 +178,12 @@ private: /** The horizontal scroll bar. Note that is used but not owned by objects of this class. It is given to the constructor. */ - ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar; + VclPtr<ScrollBar> mpHorizontalScrollBar; /** The vertical scroll bar. Note that is used but not owned by objects of this class. It is given to the constructor. */ - ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar; + VclPtr<ScrollBar> mpVerticalScrollBar; /// Relative horizontal position of the visible area in the view. double mnHorizontalPosition; @@ -200,7 +199,7 @@ private: the bottom right corner left by the two scroll bars (when both are visible). */ - ::boost::shared_ptr<ScrollBarBox> mpScrollBarFiller; + VclPtr<ScrollBarBox> mpScrollBarFiller; /** The auto scroll timer is used for keep scrolling the window when the mouse reaches its border while dragging a selection. When the mouse @@ -213,7 +212,7 @@ private: /** The content window is the one whose view port is controlled by the scroll bars. */ - SharedSdWindow mpContentWindow; + VclPtr<sd::Window> mpContentWindow; ::boost::function<void()> maAutoScrollFunctor; diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx index 88402e727395..38b5d4ac08c4 100644 --- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx @@ -227,7 +227,7 @@ public: void Dispose(); private: view::SlideSorterView& mrView; - SharedSdWindow mpWindow; + VclPtr<sd::Window> mpWindow; }; ToolTip& GetToolTip() const; diff --git a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx index eeba70945715..ff2c2a8d60ae 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx @@ -64,7 +64,7 @@ public: enum Orientation { HORIZONTAL, VERTICAL, GRID }; Layouter ( - const SharedSdWindow& rpWindow, + sd::Window *rpWindow, const ::boost::shared_ptr<Theme>& rpTheme); ~Layouter(); @@ -192,7 +192,7 @@ public: private: ::boost::scoped_ptr<Implementation> mpImplementation; - SharedSdWindow mpWindow; + VclPtr<sd::Window> mpWindow; }; /** Collect all values concerning the logical and visual properties of the diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx index 426e36c830fb..a6bb3345b532 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx @@ -48,7 +48,7 @@ public: PageObjectLayouter( const Size& rPageObjectWindowSize, const Size& rPreviewModelSize, - const SharedSdWindow& rpWindow, + sd::Window *pWindow, const sal_Int32 nPageCount); ~PageObjectLayouter(); @@ -125,7 +125,7 @@ private: const CoordinateSystem eCoordinateSystem); private: - SharedSdWindow mpWindow; + VclPtr<sd::Window> mpWindow; Size maPageObjectSize; Rectangle maFocusIndicatorBoundingBox; Rectangle maPageObjectBoundingBox; diff --git a/sd/source/ui/slidesorter/shell/SlideSorter.cxx b/sd/source/ui/slidesorter/shell/SlideSorter.cxx index a49035773b2b..ed1dd0f235ef 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorter.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorter.cxx @@ -71,18 +71,18 @@ private: ::boost::shared_ptr<SlideSorter> SlideSorter::CreateSlideSorter( ViewShell& rViewShell, - const ::boost::shared_ptr<sd::Window>& rpContentWindow, - const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar, - const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar, - const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox) + sd::Window* pContentWindow, + ScrollBar* pHorizontalScrollBar, + ScrollBar* pVerticalScrollBar, + ScrollBarBox* pScrollBarBox) { ::boost::shared_ptr<SlideSorter> pSlideSorter( new SlideSorter( rViewShell, - rpContentWindow, - rpHorizontalScrollBar, - rpVerticalScrollBar, - rpScrollBarBox)); + pContentWindow, + pHorizontalScrollBar, + pVerticalScrollBar, + pScrollBarBox)); pSlideSorter->Init(); return pSlideSorter; } @@ -103,10 +103,10 @@ private: SlideSorter::SlideSorter ( ViewShell& rViewShell, - const ::boost::shared_ptr<sd::Window>& rpContentWindow, - const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar, - const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar, - const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox) + sd::Window* pContentWindow, + ScrollBar* pHorizontalScrollBar, + ScrollBar* pVerticalScrollBar, + ScrollBarBox* pScrollBarBox) : mbIsValid(false), mpSlideSorterController(), mpSlideSorterModel(), @@ -114,11 +114,11 @@ SlideSorter::SlideSorter ( mxControllerWeak(), mpViewShell(&rViewShell), mpViewShellBase(&rViewShell.GetViewShellBase()), - mpContentWindow(rpContentWindow), + mpContentWindow(pContentWindow), mbOwnesContentWindow(false), - mpHorizontalScrollBar(rpHorizontalScrollBar), - mpVerticalScrollBar(rpVerticalScrollBar), - mpScrollBarBox(rpScrollBarBox), + mpHorizontalScrollBar(pHorizontalScrollBar), + mpVerticalScrollBar(pVerticalScrollBar), + mpScrollBarBox(pScrollBarBox), mbLayoutPending(true), mpProperties(new controller::Properties()), mpTheme(new view::Theme(mpProperties)) @@ -136,11 +136,11 @@ SlideSorter::SlideSorter ( mxControllerWeak(), mpViewShell(pViewShell), mpViewShellBase(&rBase), - mpContentWindow(new ContentWindow(rParentWindow,*this )), + mpContentWindow(VclPtr<ContentWindow>::Create(rParentWindow,*this )), mbOwnesContentWindow(true), - mpHorizontalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_HSCROLL | WB_DRAG))), - mpVerticalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_VSCROLL | WB_DRAG))), - mpScrollBarBox(new ScrollBarBox(&rParentWindow)), + mpHorizontalScrollBar(VclPtr<ScrollBar>::Create(&rParentWindow,WinBits(WB_HSCROLL | WB_DRAG))), + mpVerticalScrollBar(VclPtr<ScrollBar>::Create(&rParentWindow,WinBits(WB_VSCROLL | WB_DRAG))), + mpScrollBarBox(VclPtr<ScrollBarBox>::Create(&rParentWindow)), mbLayoutPending(true), mpProperties(new controller::Properties()), mpTheme(new view::Theme(mpProperties)) @@ -170,7 +170,7 @@ void SlideSorter::Init() SetupListeners (); // Initialize the window. - SharedSdWindow pContentWindow (GetContentWindow()); + sd::Window *pContentWindow (GetContentWindow()); if (pContentWindow) { ::vcl::Window* pParentWindow = pContentWindow->GetParent(); @@ -211,18 +211,6 @@ SlideSorter::~SlideSorter() mpHorizontalScrollBar.reset(); mpVerticalScrollBar.reset(); mpScrollBarBox.reset(); - - if (mbOwnesContentWindow) - { - OSL_ASSERT(mpContentWindow.unique()); - } - else - { - // Assume that outside this class only the owner holds a reference - // to the content window. - OSL_ASSERT(mpContentWindow.use_count()==2); - } - mpContentWindow.reset(); } model::SlideSorterModel& SlideSorter::GetModel() const @@ -253,7 +241,7 @@ void SlideSorter::Paint (const Rectangle& rRepaintArea) { GetController().Paint( rRepaintArea, - GetContentWindow().get()); + GetContentWindow()); } void SlideSorter::SetupControls (::vcl::Window* ) @@ -263,7 +251,7 @@ void SlideSorter::SetupControls (::vcl::Window* ) void SlideSorter::SetupListeners() { - SharedSdWindow pWindow (GetContentWindow()); + sd::Window *pWindow (GetContentWindow()); if (pWindow) { ::vcl::Window* pParentWindow = pWindow->GetParent(); @@ -292,7 +280,7 @@ void SlideSorter::ReleaseListeners() { mpSlideSorterController->GetScrollBarManager().Disconnect(); - SharedSdWindow pWindow (GetContentWindow()); + sd::Window *pWindow (GetContentWindow()); if (pWindow) { pWindow->RemoveEventListener( diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index cbb9c3731875..2f2aa0d73505 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -181,7 +181,7 @@ void SlideSorterViewShell::Initialize() // the new view shell. (One is created earlier while the construtor // of the base class is executed. At that time the correct // accessibility object can not be constructed.) - SharedSdWindow pWindow (mpSlideSorter->GetContentWindow()); + sd::Window *pWindow (mpSlideSorter->GetContentWindow()); if (pWindow) { pWindow->Hide(); diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index d4839971f2cc..33b9643073de 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -131,7 +131,7 @@ TYPEINIT1(SlideSorterView, ::sd::View); SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter) : ::sd::View ( *rSlideSorter.GetModel().GetDocument(), - rSlideSorter.GetContentWindow().get(), + rSlideSorter.GetContentWindow(), rSlideSorter.GetViewShell()), mrSlideSorter(rSlideSorter), mrModel(rSlideSorter.GetModel()), @@ -216,7 +216,7 @@ sal_Int32 SlideSorterView::GetPageIndexAtPoint (const Point& rWindowPosition) co { sal_Int32 nIndex (-1); - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow) { nIndex = mpLayouter->GetIndexAtPoint(pWindow->PixelToLogic(rWindowPosition), false, false); @@ -316,7 +316,7 @@ void SlideSorterView::Rearrange() if (mrModel.GetPageCount() <= 0) return; - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if ( ! pWindow) return; const Size aWindowSize (pWindow->GetSizePixel()); @@ -347,7 +347,7 @@ void SlideSorterView::UpdateOrientation() else { // Get access to the docking window. - vcl::Window* pWindow = mrSlideSorter.GetContentWindow().get(); + vcl::Window* pWindow = mrSlideSorter.GetContentWindow(); PaneDockingWindow* pDockingWindow = NULL; while (pWindow!=NULL && pDockingWindow==NULL) { @@ -408,7 +408,7 @@ void SlideSorterView::UpdateOrientation() void SlideSorterView::Layout () { - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow) { // Set the model area, i.e. the smallest rectangle that includes all @@ -450,7 +450,7 @@ void SlideSorterView::InvalidatePageObjectVisibilities() void SlideSorterView::DeterminePageObjectVisibilities() { - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow) { // Set this flag to true here so that an invalidate during the @@ -547,7 +547,7 @@ bool SlideSorterView::SetOrientation (const Layouter::Orientation eOrientation) void SlideSorterView::RequestRepaint() { - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow) { mpLayeredDevice->InvalidateAllLayers( @@ -566,7 +566,7 @@ void SlideSorterView::RequestRepaint (const model::SharedPageDescriptor& rpDescr void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox) { - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow) { mpLayeredDevice->InvalidateAllLayers(rRepaintBox); @@ -576,7 +576,7 @@ void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox) void SlideSorterView::RequestRepaint (const vcl::Region& rRepaintRegion) { - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow) { mpLayeredDevice->InvalidateAllLayers(rRepaintRegion); @@ -612,7 +612,7 @@ void SlideSorterView::CompleteRedraw ( mnLockRedrawSmph ? "locked" : ""); #endif - if (pDevice == NULL || pDevice!=mrSlideSorter.GetContentWindow().get()) + if (pDevice == NULL || pDevice!=mrSlideSorter.GetContentWindow()) return; // The parent implementation of CompleteRedraw is called only when @@ -700,7 +700,7 @@ void SlideSorterView::ConfigurationChanged ( ::boost::shared_ptr<cache::PageCache> SlideSorterView::GetPreviewCache() { - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow && mpPreviewCache.get() == NULL) { mpPreviewCache.reset( @@ -764,8 +764,8 @@ void SlideSorterView::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint void SlideSorterView::UpdatePageUnderMouse () { - ::boost::shared_ptr<ScrollBar> pVScrollBar (mrSlideSorter.GetVerticalScrollBar()); - ::boost::shared_ptr<ScrollBar> pHScrollBar (mrSlideSorter.GetHorizontalScrollBar()); + VclPtr<ScrollBar> pVScrollBar (mrSlideSorter.GetVerticalScrollBar()); + VclPtr<ScrollBar> pHScrollBar (mrSlideSorter.GetHorizontalScrollBar()); if ((pVScrollBar && pVScrollBar->IsVisible() && pVScrollBar->IsTracking()) || (pHScrollBar && pHScrollBar->IsVisible() && pHScrollBar->IsTracking())) { @@ -775,7 +775,7 @@ void SlideSorterView::UpdatePageUnderMouse () return; } - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (pWindow && pWindow->IsVisible() && ! pWindow->IsMouseCaptured()) { const Window::PointerState aPointerState (pWindow->GetPointerState()); diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx index 980487e7d4e1..ad3a4a9ae83d 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx @@ -40,10 +40,10 @@ class AnimatorAccess public: virtual void AddRun (const ::boost::shared_ptr<PageObjectRun>& rRun) = 0; virtual void RemoveRun (const ::boost::shared_ptr<PageObjectRun>& rRun) = 0; - virtual model::SlideSorterModel& GetModel() const = 0; - virtual view::SlideSorterView& GetView() const = 0; - virtual ::boost::shared_ptr<controller::Animator> GetAnimator() = 0; - virtual SharedSdWindow GetContentWindow() = 0; + virtual model::SlideSorterModel& GetModel (void) const = 0; + virtual view::SlideSorterView& GetView (void) const = 0; + virtual ::boost::shared_ptr<controller::Animator> GetAnimator (void) = 0; + virtual VclPtr<sd::Window> GetContentWindow (void) = 0; protected: ~AnimatorAccess() {} @@ -128,7 +128,7 @@ public: virtual model::SlideSorterModel& GetModel() const SAL_OVERRIDE { return mrModel; } virtual view::SlideSorterView& GetView() const SAL_OVERRIDE { return mrView; } virtual ::boost::shared_ptr<controller::Animator> GetAnimator() SAL_OVERRIDE { return mpAnimator; } - virtual SharedSdWindow GetContentWindow() SAL_OVERRIDE { return mrSlideSorter.GetContentWindow(); } + virtual VclPtr<sd::Window> GetContentWindow() SAL_OVERRIDE { return mrSlideSorter.GetContentWindow(); } private: model::SlideSorterModel& mrModel; diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx index 2675746f4306..2561c90c667c 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx @@ -134,19 +134,17 @@ void InsertionIndicatorOverlay::Create ( // Create virtual devices for bitmap and mask whose bitmaps later be // combined to form the BitmapEx of the icon. - VirtualDevice aContent ( - *mrSlideSorter.GetContentWindow(), - 0, - 0); - aContent.SetOutputSizePixel(aIconSize); + ScopedVclPtrInstance<VirtualDevice> pContent( + *mrSlideSorter.GetContentWindow(), 0, 0); + pContent->SetOutputSizePixel(aIconSize); - aContent.SetFillColor(); - aContent.SetLineColor(pTheme->GetColor(Theme::Color_PreviewBorder)); - const Point aOffset = PaintRepresentatives(aContent, aPreviewSize, nOffset, rRepresentatives); + pContent->SetFillColor(); + pContent->SetLineColor(pTheme->GetColor(Theme::Color_PreviewBorder)); + const Point aOffset = PaintRepresentatives(*pContent.get(), aPreviewSize, nOffset, rRepresentatives); - PaintPageCount(aContent, nSelectionCount, aPreviewSize, aOffset); + PaintPageCount(*pContent.get(), nSelectionCount, aPreviewSize, aOffset); - maIcon = aContent.GetBitmapEx(Point(0,0), aIconSize); + maIcon = pContent->GetBitmapEx(Point(0,0), aIconSize); maIcon.Scale(aIconSize); } diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx index ffbd7d686c64..65086d7dead4 100644 --- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx +++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx @@ -38,10 +38,10 @@ class LayerInvalidator : public ILayerInvalidator public: LayerInvalidator ( const ::boost::shared_ptr<LayeredDevice>& rpLayeredDevice, - const SharedSdWindow& rpTargetWindow, + sd::Window *pTargetWindow, const int nLayer) : mpLayeredDevice(rpLayeredDevice), - mpTargetWindow(rpTargetWindow), + mpTargetWindow(pTargetWindow), mnLayer(nLayer) { } @@ -58,7 +58,7 @@ public: private: const ::boost::shared_ptr<LayeredDevice> mpLayeredDevice; - SharedSdWindow mpTargetWindow; + VclPtr<sd::Window> mpTargetWindow; const int mnLayer; }; @@ -107,7 +107,7 @@ public: Layer(); ~Layer(); - void Initialize (const SharedSdWindow& rpTargetWindow); + void Initialize (sd::Window *pTargetWindow); void InvalidateRectangle (const Rectangle& rInvalidationBox); void InvalidateRegion (const vcl::Region& rInvalidationRegion); void Validate (const MapMode& rMapMode); @@ -121,7 +121,7 @@ public: void Dispose(); private: - ::boost::shared_ptr<VirtualDevice> mpLayerDevice; + ScopedVclPtr<VirtualDevice> mpLayerDevice; ::std::vector<SharedILayerPainter> maPainters; vcl::Region maInvalidationRegion; @@ -159,11 +159,11 @@ private: //===== LayeredDevice ========================================================= -LayeredDevice::LayeredDevice (const SharedSdWindow& rpTargetWindow) - : mpTargetWindow(rpTargetWindow), +LayeredDevice::LayeredDevice (VclPtr<sd::Window> pTargetWindow) + : mpTargetWindow(pTargetWindow), mpLayers(new LayerContainer()), - mpBackBuffer(new VirtualDevice(*mpTargetWindow)), - maSavedMapMode(rpTargetWindow->GetMapMode()) + mpBackBuffer(VclPtr<VirtualDevice>::Create(*mpTargetWindow)), + maSavedMapMode(pTargetWindow->GetMapMode()) { mpBackBuffer->SetOutputSizePixel(mpTargetWindow->GetSizePixel()); } @@ -379,15 +379,15 @@ Layer::~Layer() { } -void Layer::Initialize (const SharedSdWindow& rpTargetWindow) +void Layer::Initialize (sd::Window *pTargetWindow) { #if 0 - (void)rpTargetWindow; + (void)pTargetWindow; #else if ( ! mpLayerDevice) { - mpLayerDevice.reset(new VirtualDevice(*rpTargetWindow)); - mpLayerDevice->SetOutputSizePixel(rpTargetWindow->GetSizePixel()); + mpLayerDevice.reset(VclPtr<VirtualDevice>::Create(*pTargetWindow)); + mpLayerDevice->SetOutputSizePixel(pTargetWindow->GetSizePixel()); } #endif } diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx index 4cbbf5b22d59..f614842afe33 100644 --- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx +++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx @@ -45,8 +45,8 @@ class LayeredDevice { public: - LayeredDevice (const SharedSdWindow& rpTargetWindow); - ~LayeredDevice(); + LayeredDevice (VclPtr<sd::Window> pTargetWindow); + ~LayeredDevice (); void Invalidate ( const Rectangle& rInvalidationBox, @@ -72,10 +72,10 @@ public: void Dispose(); private: - SharedSdWindow mpTargetWindow; + VclPtr<sd::Window> mpTargetWindow; class LayerContainer; ::boost::scoped_ptr<LayerContainer> mpLayers; - ::boost::scoped_ptr<VirtualDevice> mpBackBuffer; + ScopedVclPtr<VirtualDevice> mpBackBuffer; MapMode maSavedMapMode; void RepaintRectangle (const Rectangle& rRepaintRectangle); diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx index fd85c1c61b9f..3d68dec61e4e 100644 --- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx +++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx @@ -29,7 +29,7 @@ namespace sd { namespace slidesorter { namespace view { class Layouter::Implementation { public: - SharedSdWindow mpWindow; + VclPtr<sd::Window> mpWindow; sal_Int32 mnRequestedLeftBorder; sal_Int32 mnRequestedRightBorder; sal_Int32 mnRequestedTopBorder; @@ -200,7 +200,7 @@ public: protected: Implementation ( - const SharedSdWindow& rpWindow, + sd::Window *pWindow, const ::boost::shared_ptr<view::Theme>& rpTheme); Implementation (const Implementation& rImplementation); @@ -271,7 +271,7 @@ class GridImplementation : public Layouter::Implementation { public: GridImplementation ( - const SharedSdWindow& rpWindow, + sd::Window *pWindow, const ::boost::shared_ptr<view::Theme>& rpTheme); GridImplementation (const Implementation& rImplementation); @@ -292,10 +292,10 @@ protected: //===== Layouter ============================================================== Layouter::Layouter ( - const SharedSdWindow& rpWindow, + sd::Window *pWindow, const ::boost::shared_ptr<Theme>& rpTheme) - : mpImplementation(new GridImplementation(rpWindow, rpTheme)), - mpWindow(rpWindow) + : mpImplementation(new GridImplementation(pWindow, rpTheme)), + mpWindow(pWindow) { } @@ -427,9 +427,9 @@ Layouter::Implementation* Layouter::Implementation::Create ( } Layouter::Implementation::Implementation ( - const SharedSdWindow& rpWindow, + sd::Window *pWindow, const ::boost::shared_ptr<view::Theme>& rpTheme) - : mpWindow(rpWindow), + : mpWindow(pWindow), mnRequestedLeftBorder(5), mnRequestedRightBorder(5), mnRequestedTopBorder(5), @@ -1102,9 +1102,9 @@ void VerticalImplementation::CalculateLogicalInsertPosition ( //===== GridImplementation ================================================ GridImplementation::GridImplementation ( - const SharedSdWindow& rpWindow, + sd::Window *pWindow, const ::boost::shared_ptr<view::Theme>& rpTheme) - : Implementation(rpWindow, rpTheme) + : Implementation(pWindow, rpTheme) { } diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx index 7a32476deb43..6940830fd94c 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx @@ -38,9 +38,9 @@ const static sal_Int32 gnInfoAreaMinWidth = 26; PageObjectLayouter::PageObjectLayouter ( const Size& rPageObjectWindowSize, const Size& rPageSize, - const SharedSdWindow& rpWindow, + sd::Window *pWindow, const sal_Int32 nPageCount) - : mpWindow(rpWindow), + : mpWindow(pWindow), maPageObjectSize(rPageObjectWindowSize.Width(), rPageObjectWindowSize.Height()), maPageObjectBoundingBox(), maPageNumberAreaBoundingBox(), @@ -48,7 +48,7 @@ PageObjectLayouter::PageObjectLayouter ( maTransitionEffectBoundingBox(), maTransitionEffectIcon(IconCache::Instance().GetIcon(BMP_FADE_EFFECT_INDICATOR)), maCustomAnimationEffectIcon(IconCache::Instance().GetIcon(BMP_CUSTOM_ANIMATION_INDICATOR)), - mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *rpWindow)) + mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *pWindow)) { const Size aPageNumberAreaSize (GetPageNumberAreaSize(nPageCount)); diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx index d5b9d8a92b36..d7f9393d467f 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx @@ -160,11 +160,11 @@ Bitmap PageObjectPainter::CreateMarkedPreview ( const BitmapEx& rOverlay, const OutputDevice* pReferenceDevice) const { - ::boost::scoped_ptr<VirtualDevice> pDevice; + ScopedVclPtr<VirtualDevice> pDevice; if (pReferenceDevice != NULL) - pDevice.reset(new VirtualDevice(*pReferenceDevice)); + pDevice.reset(VclPtr<VirtualDevice>::Create(*pReferenceDevice)); else - pDevice.reset(new VirtualDevice()); + pDevice.reset(VclPtr<VirtualDevice>::Create()); pDevice->SetOutputSizePixel(rSize); pDevice->DrawBitmap(Point(0,0), rSize, rPreview); diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx index 16ba566729be..97fa698bb7f7 100644 --- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx +++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx @@ -37,7 +37,7 @@ ToolTip::ToolTip (SlideSorter& rSlideSorter) maShowTimer(), maHiddenTimer() { - SharedSdWindow window = rSlideSorter.GetContentWindow(); + sd::Window *window = rSlideSorter.GetContentWindow(); const HelpSettings& rHelpSettings = window->GetSettings().GetHelpSettings(); maShowTimer.SetTimeout(rHelpSettings.GetTipDelay()); maShowTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger)); @@ -109,7 +109,7 @@ void ToolTip::DoShow() return; } - SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + sd::Window *pWindow (mrSlideSorter.GetContentWindow()); if (!msCurrentHelpText.isEmpty() && pWindow) { Rectangle aBox ( @@ -124,7 +124,7 @@ void ToolTip::DoShow() if (aBox.Bottom() >= pWindow->GetSizePixel().Height()) return; - vcl::Window* pParent (pWindow.get()); + vcl::Window* pParent (pWindow); while (pParent!=NULL && pParent->GetParent()!=NULL) pParent = pParent->GetParent(); const Point aOffset (pWindow->GetWindowExtentsRelative(pParent).TopLeft()); @@ -135,7 +135,7 @@ void ToolTip::DoShow() // tip at the top of a rectangle that is placed below the preview. aBox.Move(aOffset.X(), aOffset.Y() + aBox.GetHeight() + 3); mnHelpWindowHandle = Help::ShowTip( - pWindow.get(), + pWindow, aBox, msCurrentHelpText, QUICKHELP_CENTER | QUICKHELP_TOP); diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx index e4f99d20a654..ffd9a825319c 100644 --- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx +++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx @@ -65,7 +65,7 @@ void ViewCacheContext::NotifyPreviewCreation ( bool ViewCacheContext::IsIdle() { - sal_Int32 nIdleState (tools::IdleDetection::GetIdleState(mrSlideSorter.GetContentWindow().get())); + sal_Int32 nIdleState (tools::IdleDetection::GetIdleState(mrSlideSorter.GetContentWindow())); if (nIdleState == tools::IdleDetection::IDET_IDLE) return true; else diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 8e9f65b1a5c7..7d337d17c159 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -806,14 +806,14 @@ short TableDesignDialog::Execute() return RET_CANCEL; } -::vcl::Window * createTableDesignPanel( ::vcl::Window* pParent, ViewShellBase& rBase ) +VclPtr<::vcl::Window> createTableDesignPanel( ::vcl::Window* pParent, ViewShellBase& rBase ) { - return new TableDesignPane( pParent, rBase ); + return VclPtr<TableDesignPane>::Create( pParent, rBase ); } void showTableDesignDialog( ::vcl::Window* pParent, ViewShellBase& rBase ) { - boost::scoped_ptr< TableDesignDialog > xDialog( new TableDesignDialog( pParent, rBase ) ); + ScopedVclPtrInstance< TableDesignDialog > xDialog( pParent, rBase ); xDialog->Execute(); } diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx index 0fb256cc103c..ecf324078546 100644 --- a/sd/source/ui/table/TableDesignPane.hxx +++ b/sd/source/ui/table/TableDesignPane.hxx @@ -92,8 +92,8 @@ private: private: ViewShellBase& mrBase; - TableValueSet* m_pValueSet; - CheckBox* m_aCheckBoxes[CB_COUNT]; + VclPtr<TableValueSet> m_pValueSet; + VclPtr<CheckBox> m_aCheckBoxes[CB_COUNT]; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSelectedTable; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView; diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index bff275971dde..c1c4b2185a7b 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -64,7 +64,7 @@ namespace { PreviewRenderer::PreviewRenderer ( OutputDevice* pTemplate, const bool bHasFrame) - : mpPreviewDevice (new VirtualDevice()), + : mpPreviewDevice (VclPtr<VirtualDevice>::Create()), mpDocShellOfView(NULL), maFrameColor (svtools::ColorConfig().GetColorValue(svtools::DOCBOUNDARIES).nColor), mbHasFrame(bHasFrame) diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 7498fca7ff3f..2e00c231b758 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -730,7 +730,7 @@ throw (UnknownPropertyException, PropertyVetoException, SfxPrinter *pTempPrinter = pDocSh->GetPrinter( true ); if (pTempPrinter) { - SfxPrinter *pNewPrinter = new SfxPrinter( pTempPrinter->GetOptions().Clone(), aPrinterName ); + VclPtr<SfxPrinter> pNewPrinter = VclPtr<SfxPrinter>::Create( pTempPrinter->GetOptions().Clone(), aPrinterName ); pDocSh->SetPrinter( pNewPrinter ); } } diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 369ae83699d7..3425148d3fc7 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1885,8 +1885,8 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) ) ) { - VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); - OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >(); if( pOut ) { diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index b49fffc24a82..d3e44fb3561e 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -256,7 +256,7 @@ namespace { { public: PrintInfo ( - const Printer* pPrinter, + Printer* pPrinter, const bool bPrintMarkedOnly) : mpPrinter(pPrinter), mnDrawMode(DRAWMODE_DEFAULT), @@ -269,7 +269,7 @@ namespace { mbPrintMarkedOnly(bPrintMarkedOnly) {} - const Printer* mpPrinter; + const VclPtr<Printer> mpPrinter; sal_uLong mnDrawMode; OUString msTimeDate; OUString msPageString; @@ -1201,8 +1201,9 @@ public: if (aDev >>= xRenderDevice) { VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice); - OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; - mpPrinter = dynamic_cast<Printer*>(pOut); + VclPtr< OutputDevice > pOut = pDevice ? pDevice->GetOutputDevice() + : VclPtr< OutputDevice >(); + mpPrinter = dynamic_cast<Printer*>(pOut.get()); Size aPageSizePixel = mpPrinter ? mpPrinter->GetPaperSizePixel() : Size(); if( aPageSizePixel != maPrinterPageSizePixel ) { @@ -1300,11 +1301,11 @@ public: // Show warning that the orientation could not be set. if (pViewShell) { - WarningBox aWarnBox( + ScopedVclPtrInstance<WarningBox> aWarnBox( pViewShell->GetActiveWindow(), (WinBits)(WB_OK_CANCEL | WB_DEF_CANCEL), SD_RESSTR(STR_WARN_PRINTFORMAT_FAILURE)); - if (aWarnBox.Execute() != RET_OK) + if (aWarnBox->Execute() != RET_OK) return; } } @@ -1337,7 +1338,7 @@ private: SfxObjectShellRef mxObjectShell; // destroying mpPrintView ViewShellBase& mrBase; bool mbIsDisposed; - Printer* mpPrinter; + VclPtr<Printer> mpPrinter; Size maPrinterPageSizePixel; ::boost::scoped_ptr<PrintOptions> mpOptions; ::std::vector< ::boost::shared_ptr< ::sd::PrinterPage> > maPrinterPages; @@ -1422,7 +1423,7 @@ private: PrintInfo aInfo (mpPrinter, mpOptions->IsPrintMarkedOnly()); - if (aInfo.mpPrinter!=NULL && pShell!=NULL) + if (aInfo.mpPrinter!=nullptr && pShell!=NULL) { MapMode aMap (aInfo.mpPrinter->GetMapMode()); @@ -1879,7 +1880,7 @@ private: const PageKind ePageKind, PrintInfo& rInfo) { - OSL_ASSERT(rInfo.mpPrinter != NULL); + OSL_ASSERT(rInfo.mpPrinter != nullptr); // Fill in page kind specific data. SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc(); diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx index 989790d0fb42..03ac6c7045bd 100644 --- a/sd/source/ui/view/FormShellManager.cxx +++ b/sd/source/ui/view/FormShellManager.cxx @@ -138,7 +138,7 @@ void FormShellManager::RegisterAtCenterPane() return; mpMainViewShellWindow = pShell->GetActiveWindow(); - if (mpMainViewShellWindow == NULL) + if (mpMainViewShellWindow == nullptr) return; // Register at the window to get informed when to move the form @@ -158,7 +158,7 @@ void FormShellManager::RegisterAtCenterPane() void FormShellManager::UnregisterAtCenterPane() { - if (mpMainViewShellWindow != NULL) + if (mpMainViewShellWindow != nullptr) { // Unregister from the window. mpMainViewShellWindow->RemoveEventListener( diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 1a08634b5851..3ec2a1bc92aa 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1068,9 +1068,9 @@ void Outliner::ShowEndOfSearchDialog() // Show the message in an info box that is modal with respect to the // whole application. - MessageDialog aInfoBox(NULL, aString, VCL_MESSAGE_INFO); + ScopedVclPtrInstance< MessageDialog > aInfoBox(nullptr, aString, VCL_MESSAGE_INFO); - ShowModalMessageBox (aInfoBox); + ShowModalMessageBox (*aInfoBox.get()); mbWholeDocumentProcessed = true; } @@ -1109,12 +1109,10 @@ bool Outliner::ShowWrapArroundDialog() // Pop up question box that asks the user whether to wrap around. // The dialog is made modal with respect to the whole application. - QueryBox aQuestionBox ( - NULL, - WB_YES_NO | WB_DEF_YES, - SD_RESSTR(nStringId)); - aQuestionBox.SetImage (QueryBox::GetStandardImage()); - sal_uInt16 nBoxResult = ShowModalMessageBox(aQuestionBox); + ScopedVclPtrInstance<QueryBox> aQuestionBox ( + nullptr, WB_YES_NO | WB_DEF_YES, SD_RESSTR(nStringId)); + aQuestionBox->SetImage (QueryBox::GetStandardImage()); + sal_uInt16 nBoxResult = ShowModalMessageBox(*aQuestionBox.get()); bDoWrapArround = (nBoxResult == RET_YES); } @@ -1157,9 +1155,9 @@ void Outliner::PrepareSpellCheck() { mbError = true; mbEndOfSearch = true; - MessageDialog aErrorBox (NULL, - SD_RESSTR(STR_NOLANGUAGE)); - ShowModalMessageBox (aErrorBox); + ScopedVclPtrInstance<MessageDialog> aErrorBox ( + nullptr, SD_RESSTR(STR_NOLANGUAGE)); + ShowModalMessageBox (*aErrorBox.get()); } else if (eState != EE_SPELL_OK) { @@ -1376,8 +1374,8 @@ bool Outliner::HandleFailedSearch() if (HasNoPreviousMatch ()) { // No match found in the whole presentation. Tell the user. - InfoBox aInfoBox (NULL, SD_RESSTR(STR_SAR_NOT_FOUND)); - ShowModalMessageBox (aInfoBox); + ScopedVclPtrInstance< InfoBox > aInfoBox(nullptr, SD_RESSTR(STR_SAR_NOT_FOUND)); + ShowModalMessageBox (*aInfoBox.get()); } else diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index c95dd452142d..1f1adb72fa89 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -139,7 +139,7 @@ public: the content window. It does not include the ViewTabBar. */ - ::boost::scoped_ptr< vcl::Window> mpViewWindow; + VclPtr<vcl::Window> mpViewWindow; ::boost::shared_ptr<ToolBarManager> mpToolBarManager; ::boost::shared_ptr<ViewShellManager> mpViewShellManager; ::boost::shared_ptr<tools::EventMultiplexer> mpEventMultiplexer; @@ -204,6 +204,7 @@ class FocusForwardingWindow : public vcl::Window public: FocusForwardingWindow (vcl::Window& rParentWindow, ViewShellBase& rBase); virtual ~FocusForwardingWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void KeyInput (const KeyEvent& rEvent) SAL_OVERRIDE; virtual void Command (const CommandEvent& rEvent) SAL_OVERRIDE; @@ -239,7 +240,7 @@ ViewShellBase::ViewShellBase ( mpDocument (NULL) { mpImpl.reset(new Implementation(*this)); - mpImpl->mpViewWindow.reset(new FocusForwardingWindow(_pFrame->GetWindow(),*this)); + mpImpl->mpViewWindow = VclPtr<FocusForwardingWindow>::Create(_pFrame->GetWindow(),*this); mpImpl->mpViewWindow->SetBackground(Wallpaper()); _pFrame->GetWindow().SetBackground(Application::GetSettings().GetStyleSettings().GetLightColor()); @@ -532,11 +533,11 @@ sal_uInt16 ViewShellBase::SetPrinter ( bool bScaleAll = false; if ( bIsAPI ) { - WarningBox aWarnBox ( + ScopedVclPtrInstance<WarningBox> aWarnBox ( GetWindow(), (WinBits)(WB_YES_NO | WB_DEF_YES), SD_RESSTR(STR_SCALE_OBJS_TO_PAGE)); - bScaleAll = (aWarnBox.Execute() == RET_YES); + bScaleAll = (aWarnBox->Execute() == RET_YES); } ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( @@ -1027,7 +1028,7 @@ ViewShellBase::Implementation::~Implementation() { mpController = NULL; mpViewTabBar = NULL; - mpViewWindow.reset(); + mpViewWindow.disposeAndClear(); mpToolBarManager.reset(); } @@ -1385,7 +1386,13 @@ FocusForwardingWindow::FocusForwardingWindow ( FocusForwardingWindow::~FocusForwardingWindow() { + disposeOnce(); +} + +void FocusForwardingWindow::dispose() +{ SAL_INFO("sd.view", "destroyed FocusForwardingWindow at " << this); + vcl::Window::dispose(); } void FocusForwardingWindow::KeyInput (const KeyEvent& rKEvt) diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index f8ca2e57aae2..6fcd11a5f692 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -82,7 +82,7 @@ ViewTabBar::ViewTabBar ( const Reference<XResourceId>& rxViewTabBarId, const Reference<frame::XController>& rxController) : ViewTabBarInterfaceBase(maMutex), - mpTabControl(new TabBarControl(GetAnchorWindow(rxViewTabBarId,rxController), this)), + mpTabControl(VclPtr<TabBarControl>::Create(GetAnchorWindow(rxViewTabBarId,rxController), this)), mxController(rxController), maTabBarButtons(), mpTabPage(NULL), @@ -167,8 +167,8 @@ void ViewTabBar::disposing() // Set all references to the one tab page to NULL and delete the page. for (sal_uInt16 nIndex=0; nIndex<mpTabControl->GetPageCount(); ++nIndex) mpTabControl->SetTabPage(nIndex, NULL); - mpTabPage.reset(); - mpTabControl.reset(); + mpTabPage.disposeAndClear(); + mpTabControl.disposeAndClear(); } mxController = NULL; diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index 55f8872bfb69..179529c4645b 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -91,7 +91,7 @@ DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* DrawView::~DrawView() { - delete mpVDev; + mpVDev.disposeAndClear(); } /** @@ -459,8 +459,7 @@ void DrawView::CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sd { if( mpVDev ) { - delete mpVDev; - mpVDev = NULL; + mpVDev.disposeAndClear(); } bool bStandardPaint = true; diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index d275d61076f9..62b0b46b5c1a 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -105,7 +105,7 @@ void DrawViewShell::UIActivating( SfxInPlaceClient* pCli ) ViewShell::UIActivating(pCli); // Disable own controls - maTabControl.Disable(); + maTabControl->Disable(); if (GetLayerTabControl() != NULL) GetLayerTabControl()->Disable(); } @@ -113,7 +113,7 @@ void DrawViewShell::UIActivating( SfxInPlaceClient* pCli ) void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli ) { // Enable own controls - maTabControl.Enable(); + maTabControl->Enable(); if (GetLayerTabControl() != NULL) GetLayerTabControl()->Enable(); @@ -339,7 +339,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) LayerTabBar* pLayerBar = GetLayerTabControl(); if (pLayerBar != NULL) pLayerBar->EndEditMode(); - maTabControl.EndEditMode(); + maTabControl->EndEditMode(); if (mePageKind == PK_HANDOUT) { @@ -379,7 +379,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) * PAGEMODE ******************************************************************/ - maTabControl.Clear(); + maTabControl->Clear(); SdPage* pPage; sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); @@ -388,7 +388,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) { pPage = GetDoc()->GetSdPage(i, mePageKind); OUString aPageName = pPage->GetName(); - maTabControl.InsertPage(i + 1, aPageName); + maTabControl->InsertPage(i + 1, aPageName); if ( pPage->IsSelected() && nActualPageNum == 0 ) { @@ -396,7 +396,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) } } - maTabControl.SetCurPageId(nActualPageNum + 1); + maTabControl->SetCurPageId(nActualPageNum + 1); SwitchPage(nActualPageNum); } @@ -414,7 +414,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) mpActualPage = GetDoc()->GetSdPage(0, mePageKind); } - maTabControl.Clear(); + maTabControl->Clear(); sal_uInt16 nActualMasterPageNum = 0; sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); @@ -426,7 +426,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) if (nPos != -1) aLayoutName = aLayoutName.copy(0, nPos); - maTabControl.InsertPage(i + 1, aLayoutName); + maTabControl->InsertPage(i + 1, aLayoutName); if (&(mpActualPage->TRG_GetMasterPage()) == pMaster) { @@ -434,7 +434,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) } } - maTabControl.SetCurPageId(nActualMasterPageNum + 1); + maTabControl->SetCurPageId(nActualMasterPageNum + 1); SwitchPage(nActualMasterPageNum); } @@ -451,11 +451,11 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) if ( ! mbIsLayerModeActive) { - maTabControl.Show(); + maTabControl->Show(); // Set the tab control only for draw pages. For master page // this has been done already above. if (meEditMode == EM_PAGE) - maTabControl.SetCurPageId (nActualPageNum + 1); + maTabControl->SetCurPageId (nActualPageNum + 1); } ResetActualLayer(); @@ -526,7 +526,7 @@ SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin) WinBits aWBits = WB_VSCROLL | WB_3DLOOK | WB_BORDER; sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT; - pRuler = new Ruler(*this, GetParentWindow(), pWin, nFlags, + pRuler = VclPtr<Ruler>::Create(*this, GetParentWindow(), pWin, nFlags, GetViewFrame()->GetBindings(), aWBits); pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit()); @@ -590,19 +590,19 @@ void DrawViewShell::SetUIUnit(FieldUnit eUnit) IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab ) { const long int nMax = maViewSize.Width() - maScrBarWH.Width() - - maTabControl.GetPosPixel().X() ; + - maTabControl->GetPosPixel().X() ; - Size aTabSize = maTabControl.GetSizePixel(); + Size aTabSize = maTabControl->GetSizePixel(); aTabSize.Width() = std::min(pTab->GetSplitSize(), (long)(nMax-1)); - maTabControl.SetSizePixel(aTabSize); + maTabControl->SetSizePixel(aTabSize); if(GetLayerTabControl()) // #i87182# { GetLayerTabControl()->SetSizePixel(aTabSize); } - Point aPos = maTabControl.GetPosPixel(); + Point aPos = maTabControl->GetPosPixel(); aPos.X() += aTabSize.Width(); Size aScrSize(nMax - aTabSize.Width(), maScrBarWH.Height()); @@ -618,7 +618,7 @@ SdPage* DrawViewShell::getCurrentPage() const GetDoc()->GetSdPageCount(mePageKind): GetDoc()->GetMasterSdPageCount(mePageKind); - sal_Int32 nCurrentPage = maTabControl.GetCurPageId() - 1; + sal_Int32 nCurrentPage = maTabControl->GetCurPageId() - 1; DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" ); if( (nPageCount < 0) || (nCurrentPage>=nPageCount) ) nCurrentPage = 0; // play safe here @@ -642,7 +642,7 @@ void DrawViewShell::ResetActualPage() if (!GetDoc()) return; - sal_uInt16 nCurrentPage = maTabControl.GetCurPageId() - 1; + sal_uInt16 nCurrentPage = maTabControl->GetCurPageId() - 1; sal_uInt16 nPageCount = (meEditMode == EM_PAGE)?GetDoc()->GetSdPageCount(mePageKind):GetDoc()->GetMasterSdPageCount(mePageKind); if (nPageCount > 0) nCurrentPage = std::min((sal_uInt16)(nPageCount - 1), nCurrentPage); @@ -653,7 +653,7 @@ void DrawViewShell::ResetActualPage() { // Update for TabControl - maTabControl.Clear(); + maTabControl->Clear(); SdPage* pPage = NULL; @@ -661,18 +661,18 @@ void DrawViewShell::ResetActualPage() { pPage = GetDoc()->GetSdPage(i, mePageKind); OUString aPageName = pPage->GetName(); - maTabControl.InsertPage(i + 1, aPageName); + maTabControl->InsertPage(i + 1, aPageName); // correct selection recognition of the pages GetDoc()->SetSelected(pPage, i == nCurrentPage); } - maTabControl.SetCurPageId(nCurrentPage + 1); + maTabControl->SetCurPageId(nCurrentPage + 1); } else // EM_MASTERPAGE { SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind); - maTabControl.Clear(); + maTabControl->Clear(); sal_uInt16 nActualMasterPageNum = 0; sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); @@ -683,13 +683,13 @@ void DrawViewShell::ResetActualPage() sal_Int32 nPos = aLayoutName.indexOf(SD_LT_SEPARATOR); if (nPos != -1) aLayoutName = aLayoutName.copy(0, nPos); - maTabControl.InsertPage(i + 1, aLayoutName); + maTabControl->InsertPage(i + 1, aLayoutName); if (pActualPage == pMaster) nActualMasterPageNum = i; } - maTabControl.SetCurPageId(nActualMasterPageNum + 1); + maTabControl->SetCurPageId(nActualMasterPageNum + 1); SwitchPage(nActualMasterPageNum); } @@ -828,7 +828,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) sPageText = sPageText.copy(0, nPos); if (pPV && pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() ) - && sPageText == maTabControl.GetPageText(nSelectedPage+1)) + && sPageText == maTabControl->GetPageText(nSelectedPage+1)) { // this slide is already visible return true; @@ -850,7 +850,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) SdPage* pCurrentPage = pPV ? dynamic_cast<SdPage*>(pPV->GetPage()) : NULL; if (pCurrentPage && pNewPage == pCurrentPage - && maTabControl.GetPageText(nSelectedPage+1).equals(pNewPage->GetName())) + && maTabControl->GetPageText(nSelectedPage+1).equals(pNewPage->GetName())) { // this slide is already visible return true; @@ -979,12 +979,12 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) } } - maTabControl.SetCurPageId(nSelectedPage+1); + maTabControl->SetCurPageId(nSelectedPage+1); OUString aPageName = mpActualPage->GetName(); - if (maTabControl.GetPageText(nSelectedPage+1) != aPageName) + if (maTabControl->GetPageText(nSelectedPage+1) != aPageName) { - maTabControl.SetPageText(nSelectedPage+1, aPageName); + maTabControl->SetPageText(nSelectedPage+1, aPageName); } } else @@ -1053,11 +1053,11 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) if (nPos != -1) aLayoutName = aLayoutName.copy(0, nPos); - maTabControl.SetCurPageId(nSelectedPage+1); + maTabControl->SetCurPageId(nSelectedPage+1); - if (maTabControl.GetPageText(nSelectedPage+1) != aLayoutName) + if (maTabControl->GetPageText(nSelectedPage+1) != aLayoutName) { - maTabControl.SetPageText(nSelectedPage+1, aLayoutName); + maTabControl->SetPageText(nSelectedPage+1, aLayoutName); } if( mePageKind == PK_HANDOUT ) diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index c1b2096778ae..9647e52c528f 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -373,7 +373,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { mpDrawView->SdrEndTextEdit(); } - sal_uInt16 nPage = maTabControl.GetCurPageId() - 1; + sal_uInt16 nPage = maTabControl->GetCurPageId() - 1; mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind); ::sd::ViewShell::mpImpl->ProcessModifyPageSlot ( rReq, @@ -410,7 +410,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) mpDrawView->SdrEndTextEdit(); } - sal_uInt16 nPageId = maTabControl.GetCurPageId(); + sal_uInt16 nPageId = maTabControl->GetCurPageId(); SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE ) ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() ) : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() ); @@ -456,7 +456,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) mpDrawView->SdrEndTextEdit(); } - maTabControl.StartEditMode( maTabControl.GetCurPageId() ); + maTabControl->StartEditMode( maTabControl->GetCurPageId() ); } Cancel(); @@ -993,10 +993,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj); - CompressGraphicsDialog dialog( GetParentWindow(), pGraphicObj, GetViewFrame()->GetBindings() ); - if ( dialog.Execute() == RET_OK ) + ScopedVclPtrInstance< CompressGraphicsDialog > dialog( GetParentWindow(), pGraphicObj, GetViewFrame()->GetBindings() ); + if ( dialog->Execute() == RET_OK ) { - SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj(); + SdrGrafObj* pNewObject = dialog->GetCompressedSdrGrafObj(); SdrPageView* pPageView = mpDrawView->GetSdrPageView(); OUString aUndoString = mpDrawView->GetDescriptionOfMarkedObjects(); aUndoString += " Compress"; @@ -1422,11 +1422,11 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) || aLayerName.isEmpty() ) { // name already exists - WarningBox aWarningBox ( + ScopedVclPtrInstance<WarningBox> aWarningBox ( GetParentWindow(), WinBits( WB_OK ), SD_RESSTR(STR_WARN_NAME_DUPLICATE)); - aWarningBox.Execute(); + aWarningBox->Execute(); } else bLoop = false; @@ -1591,11 +1591,11 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) aLayerName != aOldLayerName) || aLayerName.isEmpty() ) { // name already exists - WarningBox aWarningBox ( + ScopedVclPtrInstance<WarningBox> aWarningBox ( GetParentWindow(), WinBits( WB_OK ), SD_RESSTR(STR_WARN_NAME_DUPLICATE)); - aWarningBox.Execute(); + aWarningBox->Execute(); } else bLoop = false; diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 0b82950cfb3d..ac9ecbca1f6a 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -142,7 +142,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) if (! pArgs) { - nSelectedPage = maTabControl.GetCurPageId() - 1; + nSelectedPage = maTabControl->GetCurPageId() - 1; } else if (pArgs->Count () == 2) { diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index a4bf08bb6afa..9a6b58553aec 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -74,7 +74,7 @@ using namespace ::com::sun::star::drawing; void DrawViewShell::DeleteActualPage() { - sal_uInt16 nPage = maTabControl.GetCurPageId() - 1; + sal_uInt16 nPage = maTabControl->GetCurPageId() - 1; mpDrawView->SdrEndTextEdit(); diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 9fbdf055e37a..030c676bc3db 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -114,7 +114,7 @@ void DrawViewShell::ArrangeGUIElements() ViewShell::ArrangeGUIElements (); - maTabControl.Hide(); + maTabControl->Hide(); OSL_ASSERT (GetViewShell()!=NULL); Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient()); @@ -352,7 +352,7 @@ void DrawViewShell::WriteFrameViewData() mpFrameView->SetSelectedPage(0); else { - mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 ); + mpFrameView->SetSelectedPage( maTabControl->GetCurPageId() - 1 ); } mpFrameView->SetViewShEditMode(meEditMode, mePageKind); diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index 31c9f08a6831..c6bdfed2a8f0 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -294,9 +294,9 @@ void DrawViewShell::ExecBmpMask( SfxRequest& rReq ) if( pNewObj->IsLinkedGraphic() ) { - MessageDialog aQueryBox( (vcl::Window*) GetActiveWindow(),"QueryUnlinkImageDialog","modules/sdraw/ui/queryunlinkimagedialog.ui"); + ScopedVclPtrInstance< MessageDialog > aQueryBox( (vcl::Window*) GetActiveWindow(),"QueryUnlinkImageDialog","modules/sdraw/ui/queryunlinkimagedialog.ui"); - if (RET_YES == aQueryBox.Execute()) + if (RET_YES == aQueryBox->Execute()) pNewObj->ReleaseGraphicLink(); else { diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 27a6176313f8..4fbf8d725bf8 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -912,7 +912,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) if( SfxItemState::DEFAULT == rSet.GetItemState( SID_DELETE_PAGE ) || SfxItemState::DEFAULT == rSet.GetItemState( SID_DELETE_MASTER_PAGE ) ) { - if (maTabControl.GetPageCount() == 1 || + if (maTabControl->GetPageCount() == 1 || meEditMode == EM_MASTERPAGE || mePageKind == PK_NOTES || mePageKind == PK_HANDOUT || diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index d224c328122f..7b2137113e9c 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -87,11 +87,11 @@ void DrawViewShell::ExecGallery(SfxRequest& rReq) Graphic aGraphic( pGalleryItem->GetGraphic() ); // reduce size if necessary - Window aWindow (GetActiveWindow()); - aWindow.SetMapMode(aGraphic.GetPrefMapMode()); - Size aSizePix = aWindow.LogicToPixel(aGraphic.GetPrefSize()); - aWindow.SetMapMode( MapMode(MAP_100TH_MM) ); - Size aSize = aWindow.PixelToLogic(aSizePix); + ScopedVclPtrInstance< Window > aWindow(GetActiveWindow()); + aWindow->SetMapMode(aGraphic.GetPrefMapMode()); + Size aSizePix = aWindow->LogicToPixel(aGraphic.GetPrefSize()); + aWindow->SetMapMode( MapMode(MAP_100TH_MM) ); + Size aSize = aWindow->PixelToLogic(aSizePix); // constrain size to page size if necessary SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage(); diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 6b66f374e1ae..34fca249cb20 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -109,7 +109,7 @@ void SAL_CALL ScannerEventListener::disposing( const lang::EventObject& rEventOb DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, vcl::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument ) : ViewShell (pFrame, pParentWindow, rViewShellBase) - , maTabControl(this, pParentWindow) + , maTabControl(VclPtr<sd::TabControl>::Create(this, pParentWindow)) , mbIsLayerModeActive(false) , mbIsInSwitchPage(false) , mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( @@ -191,6 +191,8 @@ DrawViewShell::~DrawViewShell() mpFrameView->Disconnect(); delete [] mpSlotArray; + + maTabControl.disposeAndClear(); } /** @@ -288,7 +290,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind) GetDoc()->SetMaxObjSize(aSize); // Split-Handler for TabControls - maTabControl.SetSplitHdl( LINK( this, DrawViewShell, TabSplitHdl ) ); + maTabControl->SetSplitHdl( LINK( this, DrawViewShell, TabSplitHdl ) ); /* In order to set the correct EditMode of the FrameView, we select another one (small trick). */ @@ -702,7 +704,7 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) // Always show the slide/page number. OUString aOUString = (nPageCount == nActivePageCount) ? SD_RESSTR(STR_SD_PAGE_COUNT) : SD_RESSTR(STR_SD_PAGE_COUNT_CUSTOM); - aOUString = aOUString.replaceFirst("%1", OUString::number(maTabControl.GetCurPageId())); + aOUString = aOUString.replaceFirst("%1", OUString::number(maTabControl->GetCurPageId())); aOUString = aOUString.replaceFirst("%2", OUString::number(nPageCount)); if(nPageCount != nActivePageCount) aOUString = aOUString.replaceFirst("%3", OUString::number(nActivePageCount)); diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx index c3485e76ca9e..03c5a49e4cdd 100644 --- a/sd/source/ui/view/drviewsb.cxx +++ b/sd/source/ui/view/drviewsb.cxx @@ -114,7 +114,7 @@ bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const OUString & rName ) if( bSuccess ) { // user edited page names may be changed by the page so update control - maTabControl.SetPageText( nPageId, rName ); + maTabControl->SetPageText( nPageId, rName ); // set document to modified state GetDoc()->SetChanged( true ); @@ -146,7 +146,7 @@ IMPL_LINK( DrawViewShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog ) OUString aNewName; pDialog->GetName( aNewName ); - SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl.GetCurPageId() - 1, GetPageKind() ); + SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl->GetCurPageId() - 1, GetPageKind() ); return long(pCurrentPage && ( aNewName == pCurrentPage->GetName() || GetDocSh()->IsNewPageNameValid( aNewName ) )); } diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 96b7c65adc77..402dbda474f4 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -1721,7 +1721,7 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText, void DrawViewShell::ShowUIControls (bool bVisible) { ViewShell::ShowUIControls (bVisible); - maTabControl.Show (bVisible); + maTabControl->Show (bVisible); } namespace slideshowhelp diff --git a/sd/source/ui/view/drviewsi.cxx b/sd/source/ui/view/drviewsi.cxx index e969c84a3a16..930e9b0305ce 100644 --- a/sd/source/ui/view/drviewsi.cxx +++ b/sd/source/ui/view/drviewsi.cxx @@ -164,10 +164,10 @@ void DrawViewShell::AssignFrom3DWindow() } else { - InfoBox aInfoBox ( + ScopedVclPtrInstance<InfoBox> aInfoBox ( GetActiveWindow(), SD_RESSTR(STR_ACTION_NOTPOSSIBLE)); - aInfoBox.Execute(); + aInfoBox->Execute(); } // get focus back diff --git a/sd/source/ui/view/grviewsh.cxx b/sd/source/ui/view/grviewsh.cxx index 751fb19e92e6..9f17bae6e0a1 100644 --- a/sd/source/ui/view/grviewsh.cxx +++ b/sd/source/ui/view/grviewsh.cxx @@ -52,7 +52,7 @@ void GraphicViewShell::ConstructGraphicViewShell() { meShellType = ST_DRAW; - mpLayerTabBar.reset (new LayerTabBar(this, GetParentWindow())); + mpLayerTabBar.reset (VclPtr<LayerTabBar>::Create(this, GetParentWindow())); // #i67363# no layer tabbar in preview mode if ( !GetObjectShell()->IsPreview() ) diff --git a/sd/source/ui/view/sdruler.cxx b/sd/source/ui/view/sdruler.cxx index ba5c97e66fb0..12e3a6089834 100644 --- a/sd/source/ui/view/sdruler.cxx +++ b/sd/source/ui/view/sdruler.cxx @@ -92,10 +92,17 @@ Ruler::Ruler( DrawViewShell& rViewSh, vcl::Window* pParent, ::sd::Window* pWin, Ruler::~Ruler() { + disposeOnce(); +} + +void Ruler::dispose() +{ SfxBindings& rBindings = pCtrlItem->GetBindings(); rBindings.EnterRegistrations(); delete pCtrlItem; rBindings.LeaveRegistrations(); + pSdWin.clear(); + SvxRuler::dispose(); } void Ruler::MouseButtonDown(const MouseEvent& rMEvt) diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index a229e4df2afa..0803ae9d43c1 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -76,7 +76,7 @@ using namespace ::com::sun::star; struct SdNavigatorDropEvent : public ExecuteDropEvent { DropTargetHelper& mrTargetHelper; - ::sd::Window* mpTargetWindow; + VclPtr<::sd::Window> mpTargetWindow; sal_uInt16 mnPage; sal_uInt16 mnLayer; diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 2165faaa8355..aea13b4434b4 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -94,12 +94,19 @@ Window::Window(vcl::Window* pParent) Window::~Window() { + disposeOnce(); +} + +void Window::dispose() +{ if (mpViewShell != NULL) { WindowUpdater* pWindowUpdater = mpViewShell->GetWindowUpdater(); if (pWindowUpdater != NULL) pWindowUpdater->UnregisterWindow (this); } + mpShareWin.clear(); + vcl::Window::dispose(); } void Window::SetViewShell (ViewShell* pViewSh) diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index ea5e50cd4ee5..7d0bed8e3cde 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -648,7 +648,7 @@ void ViewShell::SetActiveWindow (::sd::Window* pWin) } } - if (mpActiveWindow != pWin) + if (mpActiveWindow.get() != pWin) mpActiveWindow = pWin; // The rest of this function is not guarded anymore against calling this diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index c55978711639..a620624fbd7f 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -151,7 +151,7 @@ ViewShell::~ViewShell() delete mpZoomList; - mpLayerTabBar.reset(); + mpLayerTabBar.disposeAndClear(); if (mpImpl->mpSubShellFactory.get() != NULL) GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory( @@ -163,8 +163,14 @@ ViewShell::~ViewShell() "sd.ui", "destroying mpContentWindow at " << mpContentWindow.get() << " with parent " << mpContentWindow->GetParent()); - mpContentWindow.reset(); + mpContentWindow.disposeAndClear(); } + + mpScrollBarBox.disposeAndClear(); + mpVerticalRuler.disposeAndClear(); + mpHorizontalRuler.disposeAndClear(); + mpVerticalScrollBar.disposeAndClear(); + mpHorizontalScrollBar.disposeAndClear(); } /** @@ -204,16 +210,16 @@ void ViewShell::construct() if ( ! GetDocSh()->IsPreview()) { // Create scroll bars and the filler between the scroll bars. - mpHorizontalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_HSCROLL | WB_DRAG))); + mpHorizontalScrollBar.reset (VclPtr<ScrollBar>::Create(GetParentWindow(), WinBits(WB_HSCROLL | WB_DRAG))); mpHorizontalScrollBar->EnableRTL (false); mpHorizontalScrollBar->SetRange(Range(0, 32000)); mpHorizontalScrollBar->SetScrollHdl(LINK(this, ViewShell, HScrollHdl)); - mpVerticalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_VSCROLL | WB_DRAG))); + mpVerticalScrollBar.reset (VclPtr<ScrollBar>::Create(GetParentWindow(), WinBits(WB_VSCROLL | WB_DRAG))); mpVerticalScrollBar->SetRange(Range(0, 32000)); mpVerticalScrollBar->SetScrollHdl(LINK(this, ViewShell, VScrollHdl)); - mpScrollBarBox.reset(new ScrollBarBox(GetParentWindow(), WB_SIZEABLE)); + mpScrollBarBox.reset(VclPtr<ScrollBarBox>::Create(GetParentWindow(), WB_SIZEABLE)); } OUString aName( "ViewShell" ); @@ -891,7 +897,7 @@ void ViewShell::Resize() { SetupRulers (); - if (mpParentWindow == NULL) + if (mpParentWindow == nullptr) return; // Make sure that the new size is not degenerate. |