diff options
author | Noel Grandin <noel@peralex.com> | 2015-01-26 13:23:37 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-09 22:02:04 +0100 |
commit | 584e6c6051d8a8371941d61603672891a8aa3013 (patch) | |
tree | b1f050db216c528ac8a68521b045b39a051ecdfc /sw | |
parent | 45515c06d26d8a37e683f939b60198ee55343e55 (diff) |
vcl: VclPtr conversion in sw
Change-Id: Ie084a4b14f8371ff81fe6a95e73660e38cd376f2
Diffstat (limited to 'sw')
126 files changed, 1052 insertions, 476 deletions
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index b0c527af522f..8533cfe92a1a 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -37,6 +37,7 @@ class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin SwSidebarItem& rSidebarItem, SwFmtFld* aField ); virtual ~SwAnnotationWin(); + virtual void dispose() SAL_OVERRIDE; virtual void UpdateData() SAL_OVERRIDE; virtual void SetPostItText() SAL_OVERRIDE; diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx index 4df4582bd941..5d3dcda36137 100644 --- a/sw/inc/SidebarWin.hxx +++ b/sw/inc/SidebarWin.hxx @@ -66,6 +66,7 @@ class SwSidebarWin : public vcl::Window SwPostItBits aBits, SwSidebarItem& rSidebarItem ); virtual ~SwSidebarWin(); + virtual void dispose() SAL_OVERRIDE; void SetSize( const Size& rNewSize ); void SetPosSizePixelRect( long nX, diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 7ef726f89087..688ea18dd6ab 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -185,7 +185,13 @@ SwCharURLPage::SwCharURLPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) SwCharURLPage::~SwCharURLPage() { + dispose(); +} + +void SwCharURLPage::dispose() +{ delete pINetItem; + SfxTabPage::dispose(); } void SwCharURLPage::Reset(const SfxItemSet* rSet) diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index e10da98f811b..d06e0d662629 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -117,6 +117,7 @@ public: void SetDropCapsPage(SwDropCapsPage* pPage) { mpPage = pPage; } virtual ~SwDropCapsPict(); + virtual void dispose() SAL_OVERRIDE; void UpdatePaintSettings( void ); // also invalidates control! @@ -202,8 +203,14 @@ static void calcFontHeightAnyAscent( OutputDevice* _pWin, vcl::Font& _rFont, lon SwDropCapsPict::~SwDropCapsPict() { + dispose(); +} + +void SwDropCapsPict::dispose() +{ if( mbDelPrinter ) delete mpPrinter; + Control::dispose(); } /// Get the details of the first script change. diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index 610fc9f6305c..bc1346861bcf 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -124,9 +124,15 @@ SwCondCollPage::SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet) SwCondCollPage::~SwCondCollPage() { + dispose(); +} + +void SwCondCollPage::dispose() +{ for(sal_Int32 i = 0; i < m_pFilterLB->GetEntryCount(); ++i) delete static_cast<sal_uInt16*>(m_pFilterLB->GetEntryData(i)); + SfxTabPage::dispose(); } int SwCondCollPage::DeactivatePage(SfxItemSet * _pSet) diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index 37da1bffff9a..7a70e375a4c7 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -135,7 +135,13 @@ SwMailConfigPage::SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet SwMailConfigPage::~SwMailConfigPage() { + dispose(); +} + +void SwMailConfigPage::dispose() +{ delete m_pConfigItem; + SfxTabPage::dispose(); } SfxTabPage* SwMailConfigPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index daa523e1b87f..a826fd02cb6d 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -128,7 +128,13 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxIt SwCompatibilityOptPage::~SwCompatibilityOptPage() { + dispose(); +} + +void SwCompatibilityOptPage::dispose() +{ delete m_pImpl; + SfxTabPage::dispose(); } sal_uLong convertBools2Ulong_Impl diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 05adb529f089..643e6437dd78 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -517,8 +517,14 @@ SwCaptionOptPage::SwCaptionOptPage( vcl::Window* pParent, const SfxItemSet& rSet SwCaptionOptPage::~SwCaptionOptPage() { + dispose(); +} + +void SwCaptionOptPage::dispose() +{ DelUserData(); delete pMgr; + SfxTabPage::dispose(); } SfxTabPage* SwCaptionOptPage::Create( vcl::Window* pParent, diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 30fcf862002c..5d7bafc7a834 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -573,11 +573,17 @@ SwStdFontTabPage::SwStdFontTabPage( vcl::Window* pParent, SwStdFontTabPage::~SwStdFontTabPage() { + dispose(); +} + +void SwStdFontTabPage::dispose() +{ delete pFontList; if (bDeletePrinter) { delete pPrt; } + SfxTabPage::dispose(); } SfxTabPage* SwStdFontTabPage::Create( vcl::Window* pParent, diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 63bcbca4c579..3a469aca6ac6 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -265,6 +265,11 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) SwAddressListDialog::~SwAddressListDialog() { + dispose(); +} + +void SwAddressListDialog::dispose() +{ SvTreeListEntry* pEntry = m_pListLB->First(); while(pEntry) { @@ -273,6 +278,7 @@ SwAddressListDialog::~SwAddressListDialog() pEntry = m_pListLB->Next( pEntry ); } delete m_pListLB; + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl) diff --git a/sw/source/ui/dbui/addresslistdialog.hxx b/sw/source/ui/dbui/addresslistdialog.hxx index 50812efef486..59d2c4051e3c 100644 --- a/sw/source/ui/dbui/addresslistdialog.hxx +++ b/sw/source/ui/dbui/addresslistdialog.hxx @@ -87,6 +87,7 @@ class SwAddressListDialog : public SfxModalDialog public: SwAddressListDialog(SwMailMergeAddressBlockPage* pParent); virtual ~SwAddressListDialog(); + virtual void dispose() SAL_OVERRIDE; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> GetSource(); diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 347ce0a4a5dc..2806672bba9a 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -74,6 +74,7 @@ class SwAddressControl_Impl : public Control public: SwAddressControl_Impl(vcl::Window* pParent , WinBits nBits ); virtual ~SwAddressControl_Impl(); + virtual void dispose() SAL_OVERRIDE; void SetData(SwCSVData& rDBData); @@ -113,6 +114,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressControlImpl(v SwAddressControl_Impl::~SwAddressControl_Impl() { + dispose(); +} + +void SwAddressControl_Impl::dispose() +{ ::std::vector<FixedText*>::iterator aTextIter; for(aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) delete *aTextIter; @@ -121,6 +127,7 @@ SwAddressControl_Impl::~SwAddressControl_Impl() delete *aEditIter; delete m_pScrollBar; delete m_pWindow; + Control::dispose(); } void SwAddressControl_Impl::SetData(SwCSVData& rDBData) @@ -495,8 +502,14 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( SwCreateAddressListDialog::~SwCreateAddressListDialog() { + dispose(); +} + +void SwCreateAddressListDialog::dispose() +{ delete m_pCSVData; delete m_pFindDlg; + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwCreateAddressListDialog, NewHdl_Impl) diff --git a/sw/source/ui/dbui/createaddresslistdialog.hxx b/sw/source/ui/dbui/createaddresslistdialog.hxx index 393c5a79b71e..dec027a5514f 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.hxx +++ b/sw/source/ui/dbui/createaddresslistdialog.hxx @@ -76,6 +76,7 @@ public: SwCreateAddressListDialog( vcl::Window* pParent, const OUString& rURL, SwMailMergeConfigItem& rConfig); virtual ~SwCreateAddressListDialog(); + virtual void dispose() SAL_OVERRIDE; const OUString& GetURL() const { return m_sURL; } void Find( const OUString& rSearch, sal_Int32 nColumn); diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index daf8855fd5b6..247a531a73ce 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -412,10 +412,16 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView, SwInsertDBColAutoPilot::~SwInsertDBColAutoPilot() { + dispose(); +} + +void SwInsertDBColAutoPilot::dispose() +{ delete pTblSet; delete pRep; delete pTAutoFmt; + SfxModalDialog::dispose(); } IMPL_LINK( SwInsertDBColAutoPilot, PageHdl, Button*, pButton ) diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.cxx b/sw/source/ui/dbui/dbtablepreviewdialog.cxx index 4eb019abf21e..76c66c7b7449 100644 --- a/sw/source/ui/dbui/dbtablepreviewdialog.cxx +++ b/sw/source/ui/dbui/dbtablepreviewdialog.cxx @@ -81,11 +81,17 @@ SwDBTablePreviewDialog::SwDBTablePreviewDialog(vcl::Window* pParent, uno::Sequen SwDBTablePreviewDialog::~SwDBTablePreviewDialog() { + dispose(); +} + +void SwDBTablePreviewDialog::dispose() +{ if(m_xFrame.is()) { m_xFrame->setComponent(NULL, NULL); m_xFrame->dispose(); } + SfxModalDialog::dispose(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.hxx b/sw/source/ui/dbui/dbtablepreviewdialog.hxx index e99b7f457525..a1d9dcefe802 100644 --- a/sw/source/ui/dbui/dbtablepreviewdialog.hxx +++ b/sw/source/ui/dbui/dbtablepreviewdialog.hxx @@ -39,6 +39,7 @@ public: SwDBTablePreviewDialog(vcl::Window* pParent, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rValues ); virtual ~SwDBTablePreviewDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index f0868a7f4179..4698f3d77104 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -746,9 +746,9 @@ OUString SwCustomizeAddressBlockDialog::GetAddress() class SwAssignFieldsControl : public Control { friend class SwAssignFieldsDialog; - ScrollBar m_aVScroll; - HeaderBar m_aHeaderHB; - Window m_aWindow; + VclPtr<ScrollBar> m_aVScroll; + VclPtr<HeaderBar> m_aHeaderHB; + VclPtr<Window> m_aWindow; ::std::vector<FixedText*> m_aFieldNames; ::std::vector<ListBox*> m_aMatches; @@ -773,6 +773,7 @@ class SwAssignFieldsControl : public Control public: SwAssignFieldsControl(vcl::Window* pParent, WinBits nBits); virtual ~SwAssignFieldsControl(); + virtual void dispose() SAL_OVERRIDE; void Init(SwMailMergeConfigItem& rConfigItem); void SetModifyHdl(const Link& rModifyHdl) @@ -791,23 +792,23 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAssignFieldsControl( SwAssignFieldsControl::SwAssignFieldsControl(vcl::Window* pParent, WinBits nBits) : Control(pParent, nBits | WB_DIALOGCONTROL | WB_TABSTOP | WB_DIALOGCONTROL), - m_aVScroll(this), - m_aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER), - m_aWindow(this, WB_BORDER | WB_DIALOGCONTROL), + m_aVScroll(new ScrollBar(this)), + m_aHeaderHB(new HeaderBar(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER)), + m_aWindow(new vcl::Window(this, WB_BORDER | WB_DIALOGCONTROL)), m_rConfigItem(NULL), m_nLBStartTopPos(0), m_nYOffset(0), m_nFirstYPos(0) { - long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height(); + long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height(); Size aOutputSize(GetOutputSize()); - m_aVScroll.Show(); - m_aHeaderHB.SetSizePixel( + m_aVScroll->Show(); + m_aHeaderHB->SetSizePixel( Size(aOutputSize.Width(), nHBHeight)); - m_aHeaderHB.Show(); - m_aWindow.SetPosPixel(Point( 0, nHBHeight) ); - m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); - m_aWindow.Show(); + m_aHeaderHB->Show(); + m_aWindow->SetPosPixel(Point( 0, nHBHeight) ); + m_aWindow->SetSizePixel(Size(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aWindow->Show(); } Size SwAssignFieldsControl::GetOptimalSize() const @@ -819,7 +820,7 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) { m_rConfigItem = &rConfigItem; Size aOutputSize(GetOutputSize()); - long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height(); + long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height(); //get the name of the default headers const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders(); @@ -845,9 +846,9 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) for(sal_uInt32 i = 0; i < rHeaders.Count(); ++i) { const OUString rHeader = rHeaders.GetString( i ); - FixedText* pNewText = new FixedText(&m_aWindow, WB_VCENTER); + FixedText* pNewText = new FixedText(m_aWindow.get(), WB_VCENTER); pNewText->SetText("<" + rHeader + ">"); - ListBox* pNewLB = new ListBox(&m_aWindow, WB_DROPDOWN | WB_VCENTER | WB_TABSTOP); + ListBox* pNewLB = new ListBox(m_aWindow.get(), WB_DROPDOWN | WB_VCENTER | WB_TABSTOP); pNewText->set_mnemonic_widget(pNewLB); pNewLB->InsertEntry(SW_RESSTR(SW_STR_NONE)); pNewLB->SelectEntryPos(0); @@ -861,7 +862,7 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) for(sal_Int32 nField = 0; nField < aFields.getLength(); ++nField) pNewLB->InsertEntry(pFields[nField]); - FixedText* pNewPreview = new FixedText(&m_aWindow, WB_VCENTER); + FixedText* pNewPreview = new FixedText(m_aWindow.get(), WB_VCENTER); pNewText->SetSizePixel(Size(nControlWidth - 6, nControlHeight)); pNewLB->SetSizePixel(Size(nControlWidth - 6, nControlHeight)); pNewPreview->SetSizePixel(Size(aOutputSize.Width() - 2 * nControlWidth, nControlHeight)); @@ -911,18 +912,23 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) pNewPreview->Show(); pNewPreview->SetPosPixel(Point(2 * nControlWidth + 6, nMove)); } - m_aVScroll.SetRange(Range(0, rHeaders.Count())); - m_aVScroll.SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); - m_aVScroll.EnableDrag(); - m_aVScroll.SetVisibleSize(m_aVScroll.GetPageSize()); - m_aVScroll.SetScrollHdl(LINK(this, SwAssignFieldsControl, ScrollHdl_Impl)); + m_aVScroll->SetRange(Range(0, rHeaders.Count())); + m_aVScroll->SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); + m_aVScroll->EnableDrag(); + m_aVScroll->SetVisibleSize(m_aVScroll->GetPageSize()); + m_aVScroll->SetScrollHdl(LINK(this, SwAssignFieldsControl, ScrollHdl_Impl)); - m_aVScroll.SetPosPixel(Point(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), nHBHeight)); - m_aVScroll.SetSizePixel(Size(m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aVScroll->SetPosPixel(Point(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), nHBHeight)); + m_aVScroll->SetSizePixel(Size(m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); } SwAssignFieldsControl::~SwAssignFieldsControl() { + dispose(); +} + +void SwAssignFieldsControl::dispose() +{ ::std::vector<FixedText*>::iterator aFIIter; for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) delete *aFIIter; @@ -931,6 +937,11 @@ SwAssignFieldsControl::~SwAssignFieldsControl() delete *aLBIter; for(aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) delete *aFIIter; + + m_aVScroll.disposeAndClear(); + m_aHeaderHB.disposeAndClear(); + m_aWindow.disposeAndClear(); + Control::dispose(); } void SwAssignFieldsControl::Resize() @@ -938,22 +949,22 @@ void SwAssignFieldsControl::Resize() Window::Resize(); Size aOutputSize = GetOutputSize(); - long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height(); + long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height(); - m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aWindow->SetSizePixel(Size(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); - m_aVScroll.SetPosPixel(Point(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), nHBHeight)); - m_aVScroll.SetSizePixel(Size(m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aVScroll->SetPosPixel(Point(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), nHBHeight)); + m_aVScroll->SetSizePixel(Size(m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); if(m_nYOffset) - m_aVScroll.SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); - m_aVScroll.SetVisibleSize(m_aVScroll.GetPageSize()); - m_aVScroll.DoScroll(0); + m_aVScroll->SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); + m_aVScroll->SetVisibleSize(m_aVScroll->GetPageSize()); + m_aVScroll->DoScroll(0); sal_Int32 nColWidth = aOutputSize.Width() / 3; - m_aHeaderHB.SetSizePixel(Size(aOutputSize.Width(), nHBHeight)); - m_aHeaderHB.SetItemSize(1, nColWidth); - m_aHeaderHB.SetItemSize(2, nColWidth); - m_aHeaderHB.SetItemSize(3, nColWidth); + m_aHeaderHB->SetSizePixel(Size(aOutputSize.Width(), nHBHeight)); + m_aHeaderHB->SetItemSize(1, nColWidth); + m_aHeaderHB->SetItemSize(2, nColWidth); + m_aHeaderHB->SetItemSize(3, nColWidth); if (m_aFieldNames.empty() || m_aMatches.empty()) return; @@ -988,7 +999,7 @@ void SwAssignFieldsControl::Command( const CommandEvent& rCEvt ) const CommandWheelData* pWheelData = rCEvt.GetWheelData(); if(pWheelData && !pWheelData->IsHorz() && CommandWheelMode::ZOOM != pWheelData->GetMode()) { - HandleScrollCommand( rCEvt, 0, &m_aVScroll ); + HandleScrollCommand( rCEvt, 0, m_aVScroll.get() ); } } break; @@ -1014,15 +1025,15 @@ bool SwAssignFieldsControl::PreNotify( NotifyEvent& rNEvt ) void SwAssignFieldsControl::MakeVisible( sal_Int32 nIndex ) { - long nThumb = m_aVScroll.GetThumbPos(); - long nPage = m_aVScroll.GetPageSize(); + long nThumb = m_aVScroll->GetThumbPos(); + long nPage = m_aVScroll->GetPageSize(); if(nThumb > nIndex) - m_aVScroll.SetThumbPos( nIndex ); + m_aVScroll->SetThumbPos( nIndex ); else if( (nThumb + nPage) < nIndex) - m_aVScroll.SetThumbPos( nIndex - nPage ); + m_aVScroll->SetThumbPos( nIndex - nPage ); else return; - ScrollHdl_Impl( &m_aVScroll ); + ScrollHdl_Impl( m_aVScroll.get() ); } IMPL_LINK(SwAssignFieldsControl, ScrollHdl_Impl, ScrollBar*, pScroll) @@ -1132,13 +1143,13 @@ SwAssignFieldsDialog::SwAssignFieldsDialog( sAddressElement = SW_RESSTR(ST_SALUTATIONELEMENT); } - Size aOutputSize(m_pFieldsControl->m_aHeaderHB.GetSizePixel()); + Size aOutputSize(m_pFieldsControl->m_aHeaderHB->GetSizePixel()); sal_Int32 nFirstWidth; sal_Int32 nSecondWidth = nFirstWidth = aOutputSize.Width() / 3; const WinBits nHeadBits = HIB_VCENTER | HIB_FIXED| HIB_FIXEDPOS; - m_pFieldsControl->m_aHeaderHB.InsertItem( 1, sAddressElement, nFirstWidth, nHeadBits|HIB_LEFT); - m_pFieldsControl->m_aHeaderHB.InsertItem( 2, sMatchesTo, nSecondWidth, nHeadBits|HIB_LEFT); - m_pFieldsControl->m_aHeaderHB.InsertItem( 3, sPreview, + m_pFieldsControl->m_aHeaderHB->InsertItem( 1, sAddressElement, nFirstWidth, nHeadBits|HIB_LEFT); + m_pFieldsControl->m_aHeaderHB->InsertItem( 2, sMatchesTo, nSecondWidth, nHeadBits|HIB_LEFT); + m_pFieldsControl->m_aHeaderHB->InsertItem( 3, sPreview, aOutputSize.Width() - nFirstWidth - nSecondWidth, nHeadBits|HIB_LEFT); m_pFieldsControl->SetModifyHdl(LINK(this, SwAssignFieldsDialog, AssignmentModifyHdl_Impl )); diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index a89ed65b32c5..67b12453ddc0 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -155,9 +155,14 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) : SwMailMergeLayoutPage::~SwMailMergeLayoutPage() { + dispose(); +} + +void SwMailMergeLayoutPage::dispose() +{ delete m_pExampleFrame; File::remove( m_sExampleURL ); - + svt::OWizardPage::dispose(); } void SwMailMergeLayoutPage::ActivatePage() diff --git a/sw/source/ui/dbui/mmlayoutpage.hxx b/sw/source/ui/dbui/mmlayoutpage.hxx index c770705dccc5..69e534b002bb 100644 --- a/sw/source/ui/dbui/mmlayoutpage.hxx +++ b/sw/source/ui/dbui/mmlayoutpage.hxx @@ -84,6 +84,7 @@ class SwMailMergeLayoutPage : public svt::OWizardPage public: SwMailMergeLayoutPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeLayoutPage(); + virtual void dispose() SAL_OVERRIDE; static SwFrmFmt* InsertAddressAndGreeting(SwView* pView, SwMailMergeConfigItem& rConfigItem, diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index dfcdbba79a5b..a08e1033a36d 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -300,7 +300,13 @@ SwMailMergeOutputPage::SwMailMergeOutputPage(SwMailMergeWizard* _pParent) SwMailMergeOutputPage::~SwMailMergeOutputPage() { + dispose(); +} + +void SwMailMergeOutputPage::dispose() +{ delete m_pTempPrinter; + svt::OWizardPage::dispose(); } void SwMailMergeOutputPage::ActivatePage() diff --git a/sw/source/ui/dbui/mmoutputpage.hxx b/sw/source/ui/dbui/mmoutputpage.hxx index a31ddeaa3564..37cc92c34ee2 100644 --- a/sw/source/ui/dbui/mmoutputpage.hxx +++ b/sw/source/ui/dbui/mmoutputpage.hxx @@ -126,6 +126,7 @@ protected: public: SwMailMergeOutputPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeOutputPage(); + virtual void dispose() SAL_OVERRIDE; }; @@ -192,6 +193,7 @@ class SwSendMailDialog : public ModelessDialog //SfxModalDialog public: SwSendMailDialog( vcl::Window* pParent, SwMailMergeConfigItem& ); virtual ~SwSendMailDialog(); + virtual void dispose() SAL_OVERRIDE; void AddDocument( SwMailDescriptor& rDesc ); void SetDocumentCount( sal_Int32 nAllDocuments ); diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index 466620225925..cc4f519cd7f1 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -283,6 +283,11 @@ SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, SwMailMergeConfigItem& SwSendMailDialog::~SwSendMailDialog() { + dispose(); +} + +void SwSendMailDialog::dispose() +{ if(m_pImpl->xMailDispatcher.is()) { try @@ -308,6 +313,7 @@ SwSendMailDialog::~SwSendMailDialog() } delete m_pStatus; delete m_pImpl; + ModelessDialog::dispose(); } void SwSendMailDialog::AddDocument( SwMailDescriptor& rDesc ) diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx index 1b8ca4eec2dc..ec74985f0875 100644 --- a/sw/source/ui/dbui/selectdbtabledialog.cxx +++ b/sw/source/ui/dbui/selectdbtabledialog.cxx @@ -147,7 +147,13 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(vcl::Window* pParent, SwSelectDBTableDialog::~SwSelectDBTableDialog() { + dispose(); +} + +void SwSelectDBTableDialog::dispose() +{ delete m_pTable; + SfxModalDialog::dispose(); } IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton) diff --git a/sw/source/ui/dbui/selectdbtabledialog.hxx b/sw/source/ui/dbui/selectdbtabledialog.hxx index 729675e831b9..52c8c055fe0d 100644 --- a/sw/source/ui/dbui/selectdbtabledialog.hxx +++ b/sw/source/ui/dbui/selectdbtabledialog.hxx @@ -50,6 +50,7 @@ public: SwSelectDBTableDialog(vcl::Window* pParent, const css::uno::Reference<css::sdbc::XConnection>& xConnection); virtual ~SwSelectDBTableDialog(); + virtual void dispose() SAL_OVERRIDE; OUString GetSelectedTable(bool& bIsTable); void SetSelectedTable(const OUString& rTable, bool bIsTable); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index fbe660f9fedc..68ece3831ec5 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -516,6 +516,11 @@ sal_uInt16 SwEditRegionDlg::FindArrPos(const SwSectionFmt* pFmt ) SwEditRegionDlg::~SwEditRegionDlg( ) { + dispose(); +} + +void SwEditRegionDlg::dispose() +{ SvTreeListEntry* pEntry = m_pTree->First(); while( pEntry ) { @@ -524,6 +529,7 @@ SwEditRegionDlg::~SwEditRegionDlg( ) } delete m_pDocInserter; + SfxModalDialog::dispose(); } void SwEditRegionDlg::SelectSection(const OUString& rSectionName) @@ -1533,7 +1539,13 @@ SwInsertSectionTabPage::SwInsertSectionTabPage( SwInsertSectionTabPage::~SwInsertSectionTabPage() { + dispose(); +} + +void SwInsertSectionTabPage::dispose() +{ delete m_pDocInserter; + SfxTabPage::dispose(); } void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh) diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx index 2a7392eee793..9f5f562c3990 100644 --- a/sw/source/ui/dialog/wordcountdialog.cxx +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -46,7 +46,13 @@ IMPL_LINK_NOARG(SwWordCountFloatDlg, CloseHdl) SwWordCountFloatDlg::~SwWordCountFloatDlg() { + dispose(); +} + +void SwWordCountFloatDlg::dispose() +{ SwViewShell::SetCareWin( 0 ); + SfxModelessDialog::dispose(); } namespace diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index 9369b79660b1..edaab64b424d 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -153,8 +153,14 @@ SwEnvDlg::SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwEnvDlg::~SwEnvDlg() { + dispose(); +} + +void SwEnvDlg::dispose() +{ delete pAddresseeSet; delete pSenderSet; + SfxTabDialog::dispose(); } void SwEnvDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 363775d54d69..e5cc7dd7c72b 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -170,7 +170,13 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwLabDlg::~SwLabDlg() { + dispose(); +} + +void SwLabDlg::dispose() +{ delete pRecs; + SfxTabDialog::dispose(); } void SwLabDlg::GetLabItem(SwLabItem &rItem) @@ -586,12 +592,18 @@ SwVisitingCardPage::SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& r SwVisitingCardPage::~SwVisitingCardPage() { + dispose(); +} + +void SwVisitingCardPage::dispose() +{ for(sal_Int32 i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); ++i) delete static_cast<OUString*>(m_pAutoTextGroupLB->GetEntryData( i )); m_xAutoText = 0; ClearUserData(); delete pExampleFrame; + SfxTabPage::dispose(); } SfxTabPage* SwVisitingCardPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx index 469085fb968a..dab2e8ac8e42 100644 --- a/sw/source/ui/envelp/labprt.cxx +++ b/sw/source/ui/envelp/labprt.cxx @@ -62,7 +62,13 @@ SwLabPrtPage::SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet) SwLabPrtPage::~SwLabPrtPage() { + dispose(); +} + +void SwLabPrtPage::dispose() +{ delete pPrinter; + SfxTabPage::dispose(); } IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) diff --git a/sw/source/ui/envelp/labprt.hxx b/sw/source/ui/envelp/labprt.hxx index 90d421cbd2b7..ee0bf43f1602 100644 --- a/sw/source/ui/envelp/labprt.hxx +++ b/sw/source/ui/envelp/labprt.hxx @@ -46,6 +46,7 @@ class SwLabPrtPage : public SfxTabPage SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwLabPrtPage(); + virtual void dispose() SAL_OVERRIDE; DECL_LINK( CountHdl, Button * ); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 00da8162d562..315f0965c65c 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -389,6 +389,11 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, SwMailMergeDlg::~SwMailMergeDlg() { + dispose(); +} + +void SwMailMergeDlg::dispose() +{ if(m_xFrame.is()) { m_xFrame->setComponent(NULL, NULL); @@ -401,6 +406,7 @@ SwMailMergeDlg::~SwMailMergeDlg() delete pData; } delete pImpl; + SvxStandardDialog::dispose(); } void SwMailMergeDlg::Apply() diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx index d7b3a5da2591..126c1a752793 100644 --- a/sw/source/ui/envelp/swuilabimp.hxx +++ b/sw/source/ui/envelp/swuilabimp.hxx @@ -110,6 +110,7 @@ class SwVisitingCardPage : public SfxTabPage SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwVisitingCardPage(); + virtual void dispose() SAL_OVERRIDE; using TabPage::ActivatePage; using TabPage::DeactivatePage; diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index d5a171d3b0af..a2a9c7c1e6b6 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -164,8 +164,15 @@ SvTreeListEntry* SwChangeDBDlg::Insert(const OUString& rDBName) // destroy dialog SwChangeDBDlg::~SwChangeDBDlg() { + dispose(); +} + +void SwChangeDBDlg::dispose() +{ delete pMgr; + SvxStandardDialog::dispose(); } + // close void SwChangeDBDlg::Apply() { diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index 32dd26eebaff..fc40ec580b7c 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -214,8 +214,14 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) SwFldEditDlg::~SwFldEditDlg() { + dispose(); +} + +void SwFldEditDlg::dispose() +{ SwViewShell::SetCareWin(NULL); pSh->EnterStdMode(); + SfxSingleTabDialog::dispose(); } void SwFldEditDlg::EnableInsert(bool bEnable) diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx index 8bf330418207..8a7cf86638a6 100644 --- a/sw/source/ui/fldui/javaedit.cxx +++ b/sw/source/ui/fldui/javaedit.cxx @@ -88,10 +88,16 @@ SwJavaEditDialog::SwJavaEditDialog(vcl::Window* pParent, SwWrtShell* pWrtSh) : SwJavaEditDialog::~SwJavaEditDialog() { + dispose(); +} + +void SwJavaEditDialog::dispose() +{ pSh->EnterStdMode(); delete pMgr; delete pFileDlg; Application::SetDefDialogParent( pOldDefDlgParent ); + SvxStandardDialog::dispose(); } IMPL_LINK_NOARG_INLINE_START(SwJavaEditDialog, PrevHdl) diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index a779e47ee61c..bf0ca5f19e57 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -214,10 +214,16 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) SwColumnDlg::~SwColumnDlg() { + dispose(); +} + +void SwColumnDlg::dispose() +{ delete pTabPage; delete pPageSet; delete pSectionSet; delete pSelectionSet; + SfxModalDialog::dispose(); } IMPL_LINK(SwColumnDlg, ObjectHdl, ListBox*, pBox) @@ -542,7 +548,13 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) SwColumnPage::~SwColumnPage() { + dispose(); +} + +void SwColumnPage::dispose() +{ delete pColMgr; + SfxTabPage::dispose(); } void SwColumnPage::SetPageWidth(long nPageWidth) diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 22709debcdce..b30f2be25e94 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -411,7 +411,13 @@ void SwCaptionDialog::DrawSample() SwCaptionDialog::~SwCaptionDialog() { + dispose(); +} + +void SwCaptionDialog::dispose() +{ delete pMgr; + SvxStandardDialog::dispose(); } SwSequenceOptionDialog::SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV, diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 9fade37ddb7e..dfa735d06136 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -2364,7 +2364,13 @@ SwGrfExtPage::SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet) SwGrfExtPage::~SwGrfExtPage() { + dispose(); +} + +void SwGrfExtPage::dispose() +{ delete pGrfDlg; + SfxTabPage::dispose(); } SfxTabPage* SwGrfExtPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 6f99aa25cebd..89db59c34d24 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -140,8 +140,8 @@ typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base; class SwEntryBrowseBox : public SwEntryBrowseBox_Base { - Edit aCellEdit; - ::svt::CheckBoxControl aCellCheckBox; + VclPtr<Edit> aCellEdit; + VclPtr<::svt::CheckBoxControl> aCellCheckBox; OUString sSearch; OUString sAlternative; @@ -174,6 +174,8 @@ protected: public: SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pBuilder); + virtual ~SwEntryBrowseBox(); + virtual void dispose() SAL_OVERRIDE; void ReadEntries(SvStream& rInStr); void WriteEntries(SvStream& rOutStr); @@ -199,6 +201,7 @@ public: SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAutoMarkURL, bool bCreate); virtual ~SwAutoMarkDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; }; @@ -319,6 +322,11 @@ SwMultiTOXTabDialog::SwMultiTOXTabDialog(vcl::Window* pParent, const SfxItemSet& SwMultiTOXTabDialog::~SwMultiTOXTabDialog() { + dispose(); +} + +void SwMultiTOXTabDialog::dispose() +{ SW_MOD()->GetModuleConfig()->SetShowIndexPreview(m_pShowExampleCB->IsChecked()); // fdo#38515 Avoid setting focus on deleted controls in the destructors @@ -336,6 +344,7 @@ SwMultiTOXTabDialog::~SwMultiTOXTabDialog() delete[] pDescArr; delete pMgr; delete pExampleFrame; + SfxTabDialog::dispose(); } void SwMultiTOXTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) @@ -632,6 +641,7 @@ class SwAddStylesDlg_Impl : public SfxModalDialog public: SwAddStylesDlg_Impl(vcl::Window* pParent, SwWrtShell& rWrtSh, OUString rStringArr[]); virtual ~SwAddStylesDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; }; SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent, @@ -706,7 +716,13 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent, SwAddStylesDlg_Impl::~SwAddStylesDlg_Impl() { + dispose(); +} + +void SwAddStylesDlg_Impl::dispose() +{ delete m_pHeaderTree; + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl) @@ -881,8 +897,14 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(vcl::Window* pParent, const SfxItemSet& r SwTOXSelectTabPage::~SwTOXSelectTabPage() { + dispose(); +} + +void SwTOXSelectTabPage::dispose() +{ delete pIndexRes; delete pIndexEntryWrapper; + SfxTabPage::dispose(); } void SwTOXSelectTabPage::SetWrtShell(SwWrtShell& rSh) @@ -2624,6 +2646,11 @@ void SwTokenWindow::setAllocation(const Size &rAllocation) SwTokenWindow::~SwTokenWindow() { + dispose(); +} + +void SwTokenWindow::dispose() +{ for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it) { Control* pControl = (*it); @@ -2631,6 +2658,7 @@ SwTokenWindow::~SwTokenWindow() pControl->SetLoseFocusHdl( Link() ); delete pControl; } + VclHBox::dispose(); } void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL) @@ -3505,7 +3533,13 @@ SwTOXStylesTabPage::SwTOXStylesTabPage(vcl::Window* pParent, const SfxItemSet& r SwTOXStylesTabPage::~SwTOXStylesTabPage() { + dispose(); +} + +void SwTOXStylesTabPage::dispose() +{ delete m_pCurrentForm; + SfxTabPage::dispose(); } bool SwTOXStylesTabPage::FillItemSet( SfxItemSet* ) @@ -3705,8 +3739,8 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB BROWSER_VLINESFULL | BROWSER_AUTO_VSCROLL| BROWSER_HIDECURSOR ) - , aCellEdit(&GetDataWindow(), 0) - , aCellCheckBox(&GetDataWindow()) + , aCellEdit(new Edit(&GetDataWindow(), 0)) + , aCellCheckBox(new ::svt::CheckBoxControl(&GetDataWindow())) , nCurrentRow(0) , bModified(false) { @@ -3720,9 +3754,9 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB sYes = pBuilder->get<vcl::Window>("yes")->GetText(); sNo = pBuilder->get<vcl::Window>("no")->GetText(); - aCellCheckBox.GetBox().EnableTriState(false); - xController = new ::svt::EditCellController(&aCellEdit); - xCheckController = new ::svt::CheckBoxCellController(&aCellCheckBox); + aCellCheckBox->GetBox().EnableTriState(false); + xController = new ::svt::EditCellController(aCellEdit.get()); + xCheckController = new ::svt::CheckBoxCellController(aCellCheckBox.get()); // HACK: BrowseBox doesn't invalidate its children, how it should be. // That's why WB_CLIPCHILDREN is reset in order to enforce the @@ -3753,6 +3787,18 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB HIB_STDSTYLE, HEADERBAR_APPEND ); } +SwEntryBrowseBox::~SwEntryBrowseBox() +{ + dispose(); +} + +void SwEntryBrowseBox::dispose() +{ + aCellEdit.disposeAndClear(); + aCellCheckBox.disposeAndClear(); + SwEntryBrowseBox_Base::dispose(); +} + void SwEntryBrowseBox::Resize() { SwEntryBrowseBox_Base::Resize(); @@ -4042,7 +4088,13 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAu SwAutoMarkDlg_Impl::~SwAutoMarkDlg_Impl() { + dispose(); +} + +void SwAutoMarkDlg_Impl::dispose() +{ delete m_pEntriesBB; + ModalDialog::dispose(); } IMPL_LINK_NOARG(SwAutoMarkDlg_Impl, OkHdl) diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index b68938cb3709..701c6aee6250 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -1007,6 +1007,7 @@ public: bool bNewEntry, bool bCreate); virtual ~SwCreateAuthEntryDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; OUString GetEntryText(ToxAuthorityField eField) const; @@ -1519,6 +1520,11 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl() { + dispose(); +} + +void SwCreateAuthEntryDlg_Impl::dispose() +{ for(int i = 0; i < AUTH_FIELD_END; i++) { delete pFixedTexts[i]; @@ -1526,6 +1532,7 @@ SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl() } delete pTypeListBox; delete pIdentifierBox; + ModalDialog::dispose(); } OUString SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 0c2960398514..75db8cd62a1e 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -232,8 +232,14 @@ SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryDlg::~SwGlossaryDlg() { + dispose(); +} + +void SwGlossaryDlg::dispose() +{ m_pCategoryBox->Clear(); delete pExampleFrame; + SvxStandardDialog::dispose(); } // select new group diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index fb45db53321d..dd403bcb0b78 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -204,10 +204,17 @@ SwInsFootNoteDlg::SwInsFootNoteDlg(vcl::Window *pParent, SwWrtShell &rShell, boo SwInsFootNoteDlg::~SwInsFootNoteDlg() { + dispose(); +} + +void SwInsFootNoteDlg::dispose() +{ SwViewShell::SetCareWin(0); if (bEdit) rSh.ResetSelect(0, false); + + SvxStandardDialog::dispose(); } void SwInsFootNoteDlg::Init() diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index ae35a0012cbf..87b535d482b5 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -163,7 +163,13 @@ SwNumPositionTabPage::SwNumPositionTabPage(vcl::Window* pParent, SwNumPositionTabPage::~SwNumPositionTabPage() { + dispose(); +} + +void SwNumPositionTabPage::dispose() +{ delete pActNum; + SfxTabPage::dispose(); } void SwNumPositionTabPage::InitControls() diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 930c73726911..0230c94e4e2e 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -193,7 +193,13 @@ SwOutlineTabDialog::SwOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* p SwOutlineTabDialog::~SwOutlineTabDialog() { + dispose(); +} + +void SwOutlineTabDialog::dispose() +{ delete pNumRule; + SfxTabDialog::dispose(); } void SwOutlineTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 3c58114764b1..90904c54bc06 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -250,10 +250,16 @@ SwSortDlg::SwSortDlg(vcl::Window* pParent, SwWrtShell &rShell) SwSortDlg::~SwSortDlg() { + dispose(); +} + +void SwSortDlg::dispose() +{ ::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB1); ::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB2); ::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB3); delete pColRes; + SvxStandardDialog::dispose(); } sal_Unicode SwSortDlg::GetDelimChar() const diff --git a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx index 153bbc1a27f7..cb8a89e92eba 100644 --- a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx +++ b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx @@ -55,10 +55,16 @@ SwModalRedlineAcceptDlg::SwModalRedlineAcceptDlg(vcl::Window *pParent) SwModalRedlineAcceptDlg::~SwModalRedlineAcceptDlg() { + dispose(); +} + +void SwModalRedlineAcceptDlg::dispose() +{ AcceptAll(false); // refuse everything remaining pImplDlg->FillInfo(GetExtraData()); delete pImplDlg; + SfxModalDialog::dispose(); } void SwModalRedlineAcceptDlg::Activate() diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index 2dbd5ec742c6..76fe927955f8 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -270,7 +270,13 @@ IMPL_LINK_NOARG(SwTitlePageDlg, StartPageHdl) SwTitlePageDlg::~SwTitlePageDlg() { + dispose(); +} + +void SwTitlePageDlg::dispose() +{ delete mpPageFmtDesc; + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwTitlePageDlg, EditHdl) diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx index cb31042c14de..5d0567df4ed0 100644 --- a/sw/source/ui/table/convert.cxx +++ b/sw/source/ui/table/convert.cxx @@ -174,7 +174,13 @@ SwConvertTableDlg::SwConvertTableDlg( SwView& rView, bool bToTable ) SwConvertTableDlg:: ~SwConvertTableDlg() { + dispose(); +} + +void SwConvertTableDlg::dispose() +{ delete pTAutoFmt; + SfxModalDialog::dispose(); } IMPL_LINK( SwConvertTableDlg, AutoFmtHdl, PushButton*, pButton ) diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 56e6c02f36c7..817667f020d9 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -137,7 +137,13 @@ IMPL_LINK_NOARG(SwInsTableDlg, OKHdl) SwInsTableDlg::~SwInsTableDlg() { + dispose(); +} + +void SwInsTableDlg::dispose() +{ delete pTAutoFmt; + SfxModalDialog::dispose(); } IMPL_LINK_INLINE_START( SwInsTableDlg, ModifyName, Edit *, pEdit ) diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index 8a8c02aa56f0..49107998bec0 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -49,6 +49,7 @@ class AutoFmtPreview : public vcl::Window public: AutoFmtPreview(vcl::Window* pParent, WinBits nStyle); virtual ~AutoFmtPreview(); + virtual void dispose() SAL_OVERRIDE; void NotifyChange( const SwTableAutoFmt& rNewData ); @@ -174,9 +175,15 @@ SwAutoFormatDlg::SwAutoFormatDlg( vcl::Window* pParent, SwWrtShell* pWrtShell, SwAutoFormatDlg::~SwAutoFormatDlg() { + dispose(); +} + +void SwAutoFormatDlg::dispose() +{ if (bCoreDataChanged) pTableTbl->Save(); delete pTableTbl; + SfxModalDialog::dispose(); } void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt ) @@ -537,7 +544,13 @@ void AutoFmtPreview::DetectRTL(SwWrtShell* pWrtShell) AutoFmtPreview::~AutoFmtPreview() { + dispose(); +} + +void AutoFmtPreview::dispose() +{ delete pNumFmt; + vcl::Window::dispose(); } static void lcl_SetFontProperties( diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx index 2ad207ce04f3..0227a58ffff3 100644 --- a/sw/source/uibase/dbui/dbtree.cxx +++ b/sw/source/uibase/dbui/dbtree.cxx @@ -196,7 +196,13 @@ Size SwDBTreeList::GetOptimalSize() const SwDBTreeList::~SwDBTreeList() { + dispose(); +} + +void SwDBTreeList::dispose() +{ delete pImpl; + SvTreeListBox::dispose(); } void SwDBTreeList::InitTreeList() diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index 91992fbf08db..18125366392f 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -187,14 +187,25 @@ struct SwAddressPreview_Impl SwAddressPreview::SwAddressPreview(vcl::Window* pParent, WinBits nStyle) : Window( pParent, nStyle ) - , aVScrollBar(this, WB_VSCROLL) + , aVScrollBar(new ScrollBar(this, WB_VSCROLL)) , pImpl(new SwAddressPreview_Impl()) { - aVScrollBar.SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl)); + aVScrollBar->SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl)); positionScrollBar(); Show(); } +SwAddressPreview::~SwAddressPreview() +{ + dispose(); +} + +void SwAddressPreview::dispose() +{ + aVScrollBar.disposeAndClear(); + vcl::Window::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressPreview(vcl::Window *pParent, VclBuilder::stringmap &rMap) { WinBits nWinStyle = WB_DIALOGCONTROL; @@ -207,10 +218,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressPreview(vcl:: void SwAddressPreview::positionScrollBar() { Size aSize(GetOutputSizePixel()); - Size aScrollSize(aVScrollBar.get_preferred_size().Width(), aSize.Height()); - aVScrollBar.SetSizePixel(aScrollSize); + Size aScrollSize(aVScrollBar->get_preferred_size().Width(), aSize.Height()); + aVScrollBar->SetSizePixel(aScrollSize); Point aSrollPos(aSize.Width() - aScrollSize.Width(), 0); - aVScrollBar.SetPosPixel(aSrollPos); + aVScrollBar->SetPosPixel(aSrollPos); } void SwAddressPreview::Resize() @@ -235,7 +246,7 @@ void SwAddressPreview::SetAddress(const OUString& rAddress) { pImpl->aAddresses.clear(); pImpl->aAddresses.push_back(rAddress); - aVScrollBar.Show(false); + aVScrollBar->Show(false); Invalidate(); } @@ -251,9 +262,9 @@ void SwAddressPreview::SelectAddress(sal_uInt16 nSelect) pImpl->nSelectedAddress = nSelect; // now make it visible.. sal_uInt16 nSelectRow = nSelect / pImpl->nColumns; - sal_uInt16 nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos(); + sal_uInt16 nStartRow = (sal_uInt16)aVScrollBar->GetThumbPos(); if( (nSelectRow < nStartRow) || (nSelectRow >= (nStartRow + pImpl->nRows) )) - aVScrollBar.SetThumbPos( nSelectRow ); + aVScrollBar->SetThumbPos( nSelectRow ); } void SwAddressPreview::Clear() @@ -294,13 +305,13 @@ void SwAddressPreview::UpdateScrollBar() { if(pImpl->nColumns) { - aVScrollBar.SetVisibleSize(pImpl->nRows); + aVScrollBar->SetVisibleSize(pImpl->nRows); sal_uInt16 nResultingRows = (sal_uInt16)(pImpl->aAddresses.size() + pImpl->nColumns - 1) / pImpl->nColumns; ++nResultingRows; - aVScrollBar.Show(pImpl->bEnableScrollBar && nResultingRows > pImpl->nRows); - aVScrollBar.SetRange(Range(0, nResultingRows)); - if(aVScrollBar.GetThumbPos() > nResultingRows) - aVScrollBar.SetThumbPos(nResultingRows); + aVScrollBar->Show(pImpl->bEnableScrollBar && nResultingRows > pImpl->nRows); + aVScrollBar->SetRange(Range(0, nResultingRows)); + if(aVScrollBar->GetThumbPos() > nResultingRows) + aVScrollBar->SetThumbPos(nResultingRows); } } @@ -318,10 +329,10 @@ void SwAddressPreview::Paint(const Rectangle&) Size aSize = GetOutputSizePixel(); sal_uInt16 nStartRow = 0; - if(aVScrollBar.IsVisible()) + if(aVScrollBar->IsVisible()) { - aSize.Width() -= aVScrollBar.GetSizePixel().Width(); - nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos(); + aSize.Width() -= aVScrollBar->GetSizePixel().Width(); + nStartRow = (sal_uInt16)aVScrollBar->GetThumbPos(); } Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows ); aPartSize.Width() -= 2; @@ -358,9 +369,9 @@ void SwAddressPreview::MouseButtonDown( const MouseEvent& rMEvt ) Size aSize(GetOutputSizePixel()); Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows ); sal_uInt32 nRow = rMousePos.Y() / aPartSize.Height() ; - if(aVScrollBar.IsVisible()) + if(aVScrollBar->IsVisible()) { - nRow += (sal_uInt16)aVScrollBar.GetThumbPos(); + nRow += (sal_uInt16)aVScrollBar->GetThumbPos(); } sal_uInt32 nCol = rMousePos.X() / aPartSize.Width(); sal_uInt32 nSelect = nRow * pImpl->nColumns + nCol; diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 539b5bab2177..372fa81aef1f 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -70,7 +70,13 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin, SwAnnotationWin::~SwAnnotationWin() { + dispose(); +} + +void SwAnnotationWin::dispose() +{ delete mpButtonPopup; + sw::sidebarwindows::SwSidebarWin::dispose(); } void SwAnnotationWin::SetPostItText() diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 43dc81dac543..5474731df15d 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -169,8 +169,14 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag SwHeaderFooterWin::~SwHeaderFooterWin( ) { + dispose(); +} + +void SwHeaderFooterWin::dispose() +{ delete m_pPopupMenu; delete m_pLine; + MenuButton::dispose(); } const SwPageFrm* SwHeaderFooterWin::GetPageFrame( ) diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 42027fbea9ed..d13b4b130e81 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -116,12 +116,18 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm ) SwPageBreakWin::~SwPageBreakWin( ) { + dispose(); +} + +void SwPageBreakWin::dispose() +{ m_bDestroyed = true; m_aFadeTimer.Stop(); delete m_pPopupMenu; delete m_pLine; delete m_pMousePt; + MenuButton::dispose(); } void SwPageBreakWin::Paint( const Rectangle& ) diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 3832f7c5c60a..a7a7371ccb8b 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -137,6 +137,11 @@ SwSidebarWin::SwSidebarWin( SwEditWin& rEditWin, SwSidebarWin::~SwSidebarWin() { + dispose(); +} + +void SwSidebarWin::dispose() +{ mrMgr.DisconnectSidebarWinFromFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm), *this ); @@ -201,6 +206,7 @@ SwSidebarWin::~SwSidebarWin() if (mnEventId) Application::RemoveUserEvent( mnEventId ); + vcl::Window::dispose(); } void SwSidebarWin::Paint( const Rectangle& rRect) diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 42c41f368086..7502abf0d600 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -4968,6 +4968,11 @@ SwEditWin::SwEditWin(vcl::Window *pParent, SwView &rMyView): SwEditWin::~SwEditWin() { + dispose(); +} + +void SwEditWin::dispose() +{ m_aKeyInputTimer.Stop(); delete m_pShadCrsr; delete m_pRowColumnSelectionStart; @@ -4979,6 +4984,7 @@ SwEditWin::~SwEditWin() delete m_pUserMarker; delete m_pAnchorMarker; + vcl::Window::dispose(); } /** diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index c4042d812873..013fb24355ce 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -268,7 +268,12 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView ) n->addPropertiesChangeListener(s, listener_.get()); } - SwSrcEditWindow::~SwSrcEditWindow() +SwSrcEditWindow::~SwSrcEditWindow() +{ + dispose(); +} + +void SwSrcEditWindow::dispose() { css::uno::Reference< css::beans::XMultiPropertySet > n; { @@ -291,6 +296,7 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView ) delete pTextEngine; } delete pOutWin; + vcl::Window::dispose(); } void SwSrcEditWindow::DataChanged( const DataChangedEvent& rDCEvt ) diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 89038314a97d..ec49c3599724 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -487,7 +487,13 @@ Size SwColumnOnlyExample::GetOptimalSize() const SwPageGridExample::~SwPageGridExample() { + dispose(); +} + +void SwPageGridExample::dispose() +{ delete pGridItem; + SwPageExample::dispose(); } void SwPageGridExample::DrawPage( const Point& rOrg, diff --git a/sw/source/uibase/inc/HeaderFooterWin.hxx b/sw/source/uibase/inc/HeaderFooterWin.hxx index 6f151fd8ec69..78005bdb5777 100644 --- a/sw/source/uibase/inc/HeaderFooterWin.hxx +++ b/sw/source/uibase/inc/HeaderFooterWin.hxx @@ -31,6 +31,7 @@ class SwHeaderFooterWin : public MenuButton, public SwFrameControl public: SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm, bool bHeader ); virtual ~SwHeaderFooterWin( ); + virtual void dispose() SAL_OVERRIDE; void SetOffset( Point aOffset, long nXLineStart, long nXLineEnd ); diff --git a/sw/source/uibase/inc/PageBreakWin.hxx b/sw/source/uibase/inc/PageBreakWin.hxx index ff28df16ca3f..1c6987b5dec5 100644 --- a/sw/source/uibase/inc/PageBreakWin.hxx +++ b/sw/source/uibase/inc/PageBreakWin.hxx @@ -35,6 +35,7 @@ class SwPageBreakWin : public MenuButton, public SwFrameControl public: SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm ); virtual ~SwPageBreakWin( ); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Select( ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/changedb.hxx b/sw/source/uibase/inc/changedb.hxx index 128d7aa8338d..558ea2f2d9e9 100644 --- a/sw/source/uibase/inc/changedb.hxx +++ b/sw/source/uibase/inc/changedb.hxx @@ -59,6 +59,7 @@ class SwChangeDBDlg: public SvxStandardDialog public: SwChangeDBDlg(SwView& rVw); virtual ~SwChangeDBDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/chrdlg.hxx b/sw/source/uibase/inc/chrdlg.hxx index 7c0520ade242..27e394ce5529 100644 --- a/sw/source/uibase/inc/chrdlg.hxx +++ b/sw/source/uibase/inc/chrdlg.hxx @@ -82,6 +82,7 @@ public: const SfxItemSet& rSet ); virtual ~SwCharURLPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx index ce03ddce93b2..638b3c78ab2a 100644 --- a/sw/source/uibase/inc/colex.hxx +++ b/sw/source/uibase/inc/colex.hxx @@ -57,6 +57,7 @@ public: m_bVertical(false){} virtual ~SwPageGridExample(); + virtual void dispose() SAL_OVERRIDE; void UpdateExample( const SfxItemSet& rSet ); }; diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx index 5ff460d8962d..548784e3ee46 100644 --- a/sw/source/uibase/inc/column.hxx +++ b/sw/source/uibase/inc/column.hxx @@ -66,6 +66,7 @@ class SwColumnDlg : public SfxModalDialog public: SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh); virtual ~SwColumnDlg(); + virtual void dispose() SAL_OVERRIDE; SwWrtShell& GetWrtShell() { return rWrtShell; } }; @@ -173,6 +174,7 @@ class SwColumnPage : public SfxTabPage public: virtual ~SwColumnPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); static const sal_uInt16* GetRanges() { return aPageRg; } diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 7867f957c8a8..1d955ad5d851 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -144,6 +144,7 @@ protected: public: SwContentTree(vcl::Window* pParent, const ResId& rResId); virtual ~SwContentTree(); + virtual void dispose() SAL_OVERRIDE; OUString GetEntryAltText( SvTreeListEntry* pEntry ) const SAL_OVERRIDE; OUString GetEntryLongDescription( SvTreeListEntry* pEntry ) const SAL_OVERRIDE; SdrObject* GetDrawingObjectsByContent(const SwContent *pCnt); @@ -313,6 +314,7 @@ protected: public: SwGlobalTree(vcl::Window* pParent, const ResId& rResId); virtual ~SwGlobalTree(); + virtual void dispose() SAL_OVERRIDE; void TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox); void InsertRegion( const SwGlblDocContent* pCont, diff --git a/sw/source/uibase/inc/convert.hxx b/sw/source/uibase/inc/convert.hxx index 8b803bfee2db..083103728c8c 100644 --- a/sw/source/uibase/inc/convert.hxx +++ b/sw/source/uibase/inc/convert.hxx @@ -63,6 +63,7 @@ class SwConvertTableDlg: public SfxModalDialog public: SwConvertTableDlg( SwView& rView, bool bToTable ); virtual ~SwConvertTableDlg(); + virtual void dispose() SAL_OVERRIDE; void GetValues( sal_Unicode& rDelim, SwInsertTableOptions& rInsTblOpts, diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx index 98ed59d65c0d..4fef9bbbabe9 100644 --- a/sw/source/uibase/inc/cption.hxx +++ b/sw/source/uibase/inc/cption.hxx @@ -109,6 +109,7 @@ class SwCaptionDialog : public SvxStandardDialog public: SwCaptionDialog( vcl::Window *pParent, SwView &rV ); virtual ~SwCaptionDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/dbinsdlg.hxx b/sw/source/uibase/inc/dbinsdlg.hxx index e48f422fed9a..4d6471536ff7 100644 --- a/sw/source/uibase/inc/dbinsdlg.hxx +++ b/sw/source/uibase/inc/dbinsdlg.hxx @@ -158,6 +158,7 @@ public: const SwDBData& rData ); virtual ~SwInsertDBColAutoPilot(); + virtual void dispose() SAL_OVERRIDE; void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection, ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource, diff --git a/sw/source/uibase/inc/dbtree.hxx b/sw/source/uibase/inc/dbtree.hxx index e41d911bf141..94179d40e062 100644 --- a/sw/source/uibase/inc/dbtree.hxx +++ b/sw/source/uibase/inc/dbtree.hxx @@ -54,6 +54,7 @@ class SW_DLLPUBLIC SwDBTreeList : public SvTreeListBox public: SwDBTreeList(vcl::Window* pParent, WinBits nStyle); virtual ~SwDBTreeList(); + virtual void dispose() SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE; OUString GetDBName( OUString& rTableName, OUString& rColumnName, sal_Bool* pbIsTable = 0); diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index e8c2e5e99d17..026ea34462d2 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -296,6 +296,8 @@ public: SwEditWin(vcl::Window *pParent, SwView &); virtual ~SwEditWin(); + virtual void dispose() SAL_OVERRIDE; + /// @see OutputDevice::LogicInvalidate(). void LogicInvalidate(const Rectangle* pRectangle) SAL_OVERRIDE; /// Same as MouseButtonDown(), but coordinates are in logic unit. diff --git a/sw/source/uibase/inc/envlop.hxx b/sw/source/uibase/inc/envlop.hxx index 466ca759f26c..9245e9ec5c49 100644 --- a/sw/source/uibase/inc/envlop.hxx +++ b/sw/source/uibase/inc/envlop.hxx @@ -73,6 +73,7 @@ friend class SwEnvPreview; public: SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert); virtual ~SwEnvDlg(); + virtual void dispose() SAL_OVERRIDE; }; class SwEnvPage : public SfxTabPage diff --git a/sw/source/uibase/inc/fldedt.hxx b/sw/source/uibase/inc/fldedt.hxx index 26dc320e0a04..23f0685f6270 100644 --- a/sw/source/uibase/inc/fldedt.hxx +++ b/sw/source/uibase/inc/fldedt.hxx @@ -43,6 +43,7 @@ public: SwFldEditDlg(SwView& rVw); virtual ~SwFldEditDlg(); + virtual void dispose() SAL_OVERRIDE; DECL_LINK(OKHdl, void *); diff --git a/sw/source/uibase/inc/formedt.hxx b/sw/source/uibase/inc/formedt.hxx index 118869e93e74..32f6d8e7de8d 100644 --- a/sw/source/uibase/inc/formedt.hxx +++ b/sw/source/uibase/inc/formedt.hxx @@ -50,23 +50,23 @@ class SwIdxFormDlg : public SvxStandardDialog void UpdatePattern(); void Apply() SAL_OVERRIDE; - ListBox aEntryLB; - OKButton aOKBtn; - CancelButton aCancelBT; - FixedText aLevelFT; - Edit aEntryED; - PushButton aEntryBT; - PushButton aTabBT; - PushButton aPageBT; - PushButton aJumpBT; - FixedLine aEntryFL; - FixedText aLevelFT2; - ListBox aLevelLB; - FixedText aTemplateFT; - ListBox aParaLayLB; - PushButton aStdBT; - PushButton aAssignBT; - FixedLine aFormatFL; + VclPtr<ListBox> aEntryLB; + VclPtr<OKButton> aOKBtn; + VclPtr<CancelButton> aCancelBT; + VclPtr<FixedText> aLevelFT; + VclPtr<Edit> aEntryED; + VclPtr<PushButton> aEntryBT; + VclPtr<PushButton> aTabBT; + VclPtr<PushButton> aPageBT; + VclPtr<PushButton> aJumpBT; + VclPtr<FixedLine> aEntryFL; + VclPtr<FixedText> aLevelFT2; + VclPtr<ListBox> aLevelLB; + VclPtr<FixedText> aTemplateFT; + VclPtr<ListBox> aParaLayLB; + VclPtr<PushButton> aStdBT; + VclPtr<PushButton> aAssignBT; + VclPtr<FixedLine> aFormatFL; SwWrtShell &rSh; SwForm *pForm; @@ -76,6 +76,7 @@ class SwIdxFormDlg : public SvxStandardDialog public: SwIdxFormDlg( vcl::Window* pParent, SwWrtShell &rShell, const SwForm& rForm ); virtual ~SwIdxFormDlg(); + virtual void dispose() SAL_OVERRIDE; const SwForm& GetTOXForm(); }; diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx index f4b55a91bd64..6a3b396eb776 100644 --- a/sw/source/uibase/inc/frmpage.hxx +++ b/sw/source/uibase/inc/frmpage.hxx @@ -227,6 +227,7 @@ class SwGrfExtPage: public SfxTabPage virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet); virtual ~SwGrfExtPage(); + virtual void dispose() SAL_OVERRIDE; using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; diff --git a/sw/source/uibase/inc/glossary.hxx b/sw/source/uibase/inc/glossary.hxx index 7fad065d8bb9..53b1d5c32d74 100644 --- a/sw/source/uibase/inc/glossary.hxx +++ b/sw/source/uibase/inc/glossary.hxx @@ -149,6 +149,7 @@ class SwGlossaryDlg : public SvxStandardDialog public: SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell); virtual ~SwGlossaryDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetCurrGrpName() const; OUString GetCurrLongName() const { diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx index f5a9e28d050b..c4af0b0f8fc0 100644 --- a/sw/source/uibase/inc/inputwin.hxx +++ b/sw/source/uibase/inc/inputwin.hxx @@ -47,8 +47,8 @@ class SwInputWindow : public ToolBox { friend class InputEdit; - Edit aPos; - InputEdit aEdit; + VclPtr<Edit> aPos; + VclPtr<InputEdit> aEdit; PopupMenu aPopMenu; SwFldMgr* pMgr; SwWrtShell* pWrtShell; @@ -82,6 +82,7 @@ protected: public: SwInputWindow( vcl::Window* pParent, SfxBindings* pBindings ); virtual ~SwInputWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/insfnote.hxx b/sw/source/uibase/inc/insfnote.hxx index 39747588a997..05aace768913 100644 --- a/sw/source/uibase/inc/insfnote.hxx +++ b/sw/source/uibase/inc/insfnote.hxx @@ -67,6 +67,7 @@ class SwInsFootNoteDlg: public SvxStandardDialog public: SwInsFootNoteDlg(vcl::Window * pParent, SwWrtShell &rSh, bool bEd = false); virtual ~SwInsFootNoteDlg(); + virtual void dispose() SAL_OVERRIDE; rtl_TextEncoding GetCharSet() { return eCharSet; } bool IsExtCharAvailable() { return bExtCharAvailable; } diff --git a/sw/source/uibase/inc/instable.hxx b/sw/source/uibase/inc/instable.hxx index d61de339f2b8..99659247baa6 100644 --- a/sw/source/uibase/inc/instable.hxx +++ b/sw/source/uibase/inc/instable.hxx @@ -66,6 +66,7 @@ class SwInsTableDlg : public SfxModalDialog public: SwInsTableDlg( SwView& rView ); virtual ~SwInsTableDlg(); + virtual void dispose() SAL_OVERRIDE; void GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol, SwInsertTableOptions& rInsTblOpts, OUString& rTableAutoFmtName, diff --git a/sw/source/uibase/inc/javaedit.hxx b/sw/source/uibase/inc/javaedit.hxx index 5649e5ea1e42..9768f41af15a 100644 --- a/sw/source/uibase/inc/javaedit.hxx +++ b/sw/source/uibase/inc/javaedit.hxx @@ -71,6 +71,7 @@ private: public: SwJavaEditDialog(vcl::Window* pParent, SwWrtShell* pWrtSh); virtual ~SwJavaEditDialog(); + virtual void dispose() SAL_OVERRIDE; OUString GetScriptText() const { return aText; } diff --git a/sw/source/uibase/inc/label.hxx b/sw/source/uibase/inc/label.hxx index 61b452d245d4..8369daa4e6c8 100644 --- a/sw/source/uibase/inc/label.hxx +++ b/sw/source/uibase/inc/label.hxx @@ -56,6 +56,7 @@ public: SwLabDlg( vcl::Window* pParent, const SfxItemSet& rSet, SwDBManager* pDBManager, bool bLabel); virtual ~SwLabDlg(); + virtual void dispose() SAL_OVERRIDE; SwLabRec* GetRecord(const OUString &rRecName, bool bCont); void GetLabItem(SwLabItem &rItem); diff --git a/sw/source/uibase/inc/mailconfigpage.hxx b/sw/source/uibase/inc/mailconfigpage.hxx index a343c30bf5eb..3e98da59dad1 100644 --- a/sw/source/uibase/inc/mailconfigpage.hxx +++ b/sw/source/uibase/inc/mailconfigpage.hxx @@ -57,6 +57,7 @@ class SwMailConfigPage : public SfxTabPage public: SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwMailConfigPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); diff --git a/sw/source/uibase/inc/mailmergehelper.hxx b/sw/source/uibase/inc/mailmergehelper.hxx index c6691af3dcc1..5b4321bb2840 100644 --- a/sw/source/uibase/inc/mailmergehelper.hxx +++ b/sw/source/uibase/inc/mailmergehelper.hxx @@ -60,7 +60,7 @@ struct SwAddressPreview_Impl; // and also the resulting address filled with database data class SW_DLLPUBLIC SwAddressPreview : public vcl::Window { - ScrollBar aVScrollBar; + VclPtr<ScrollBar> aVScrollBar; SwAddressPreview_Impl* pImpl; Link m_aSelectHdl; @@ -77,6 +77,8 @@ class SW_DLLPUBLIC SwAddressPreview : public vcl::Window public: SwAddressPreview(vcl::Window* pParent, WinBits nStyle=WB_BORDER); + virtual ~SwAddressPreview(); + virtual void dispose() SAL_OVERRIDE; void positionScrollBar(); diff --git a/sw/source/uibase/inc/mailmrge.hxx b/sw/source/uibase/inc/mailmrge.hxx index f3d67eeb831f..615fb035553f 100644 --- a/sw/source/uibase/inc/mailmrge.hxx +++ b/sw/source/uibase/inc/mailmrge.hxx @@ -122,6 +122,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& xConnection, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >* pSelection = 0); virtual ~SwMailMergeDlg(); + virtual void dispose() SAL_OVERRIDE; inline DBManagerOptions GetMergeType() { return nMergeType; } diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index 074888e6f0ce..8b5b59565caa 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -55,12 +55,12 @@ class SwNavigationPI : public vcl::Window, friend class SwContentTree; friend class SwGlobalTree; - SwNavHelpToolBox aContentToolBox; - SwHelpToolBox aGlobalToolBox; - ImageList aContentImageList; - SwContentTree aContentTree; - SwGlobalTree aGlobalTree; - ListBox aDocListBox; + VclPtr<SwNavHelpToolBox> aContentToolBox; + VclPtr<SwHelpToolBox> aGlobalToolBox; + ImageList aContentImageList; + VclPtr<SwContentTree> aContentTree; + VclPtr<SwGlobalTree> aGlobalTree; + VclPtr<ListBox> aDocListBox; Idle aPageChgIdle; OUString sContentFileName; OUString aContextArr[3]; @@ -137,6 +137,7 @@ public: SwNavigationPI(SfxBindings*, SfxChildWindowContext*, vcl::Window*); virtual ~SwNavigationPI(); + virtual void dispose() SAL_OVERRIDE; void GotoPage(); // jump to page; bindable function diff --git a/sw/source/uibase/inc/num.hxx b/sw/source/uibase/inc/num.hxx index 91ed4d39929b..c4719c46ca4a 100644 --- a/sw/source/uibase/inc/num.hxx +++ b/sw/source/uibase/inc/num.hxx @@ -117,6 +117,7 @@ public: SwNumPositionTabPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwNumPositionTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual int DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/numberingtypelistbox.hxx b/sw/source/uibase/inc/numberingtypelistbox.hxx index bedbc7225f69..b1968d7f6857 100644 --- a/sw/source/uibase/inc/numberingtypelistbox.hxx +++ b/sw/source/uibase/inc/numberingtypelistbox.hxx @@ -37,6 +37,7 @@ class SW_DLLPUBLIC SwNumberingTypeListBox : public ListBox public: SwNumberingTypeListBox( vcl::Window* pWin, WinBits nStyle = WB_BORDER ); virtual ~SwNumberingTypeListBox(); + virtual void dispose() SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/numfmtlb.hxx b/sw/source/uibase/inc/numfmtlb.hxx index 8dd0394575a1..ede07317deb4 100644 --- a/sw/source/uibase/inc/numfmtlb.hxx +++ b/sw/source/uibase/inc/numfmtlb.hxx @@ -48,6 +48,7 @@ public: NumFormatListBox(vcl::Window* pWin, WinBits nStyle); virtual ~NumFormatListBox(); + virtual void dispose() SAL_OVERRIDE; void Clear(); diff --git a/sw/source/uibase/inc/optcomp.hxx b/sw/source/uibase/inc/optcomp.hxx index 8a1675176575..d33d22222fd4 100644 --- a/sw/source/uibase/inc/optcomp.hxx +++ b/sw/source/uibase/inc/optcomp.hxx @@ -62,6 +62,7 @@ private: public: SwCompatibilityOptPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwCompatibilityOptPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); diff --git a/sw/source/uibase/inc/optload.hxx b/sw/source/uibase/inc/optload.hxx index 451b30c6b9b5..71c1759a1bea 100644 --- a/sw/source/uibase/inc/optload.hxx +++ b/sw/source/uibase/inc/optload.hxx @@ -165,6 +165,7 @@ public: SwCaptionOptPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwCaptionOptPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx index 05789ce0cb9a..63ebf50dd8e3 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -188,6 +188,7 @@ class SwStdFontTabPage : public SfxTabPage SwStdFontTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwStdFontTabPage(); + virtual void dispose() SAL_OVERRIDE; public: static SfxTabPage* Create( vcl::Window* pParent, diff --git a/sw/source/uibase/inc/outline.hxx b/sw/source/uibase/inc/outline.hxx index 1581918966bf..45317fba3fc2 100644 --- a/sw/source/uibase/inc/outline.hxx +++ b/sw/source/uibase/inc/outline.hxx @@ -58,7 +58,7 @@ class SwOutlineTabDialog : public SfxTabDialog bool bModified : 1; - protected: +protected: DECL_LINK(CancelHdl, void *); DECL_LINK( FormHdl, Button * ); DECL_LINK( MenuSelectHdl, Menu * ); @@ -66,17 +66,18 @@ class SwOutlineTabDialog : public SfxTabDialog virtual void PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) SAL_OVERRIDE; virtual short Ok() SAL_OVERRIDE; - public: +public: SwOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &); virtual ~SwOutlineTabDialog(); + virtual void dispose() SAL_OVERRIDE; SwNumRule* GetNumRule() {return pNumRule;} - sal_uInt16 GetLevel(const OUString &rFmtName) const; + sal_uInt16 GetLevel(const OUString &rFmtName) const; OUString* GetCollNames() {return aCollNames;} - static sal_uInt16 GetActNumLevel() {return nNumLevel;} + static sal_uInt16 GetActNumLevel() {return nNumLevel;} static void SetActNumLevel(sal_uInt16 nSet) {nNumLevel = nSet;} }; diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index 7cffc0bb366a..39cfa7f47567 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -71,7 +71,7 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg SwRedlineDataParentArr aRedlineParents; SwRedlineDataChildArr aRedlineChildren; SwRedlineDataParentSortArr aUsedSeqNo; - SvxAcceptChgCtr aTabPagesCTRL; + VclPtr<SvxAcceptChgCtr> aTabPagesCTRL; PopupMenu aPopup; Timer aDeselectTimer; Timer aSelectTimer; @@ -120,7 +120,7 @@ public: DECL_LINK( FilterChangedHdl, void *pDummy = 0 ); - inline SvxAcceptChgCtr& GetChgCtrl() { return aTabPagesCTRL; } + inline SvxAcceptChgCtr& GetChgCtrl() { return *aTabPagesCTRL.get(); } inline bool HasRedlineAutoFmt() const { return bRedlnAutoFmt; } void Init(sal_uInt16 nStart = 0); @@ -140,6 +140,7 @@ class SwModelessRedlineAcceptDlg : public SfxModelessDialog public: SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, vcl::Window *pParent); virtual ~SwModelessRedlineAcceptDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void Activate() SAL_OVERRIDE; virtual void FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE; @@ -166,6 +167,7 @@ class SwRedlineAcceptPanel : public PanelLayout, public SfxListener public: SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame); virtual ~SwRedlineAcceptPanel(); + virtual void dispose() SAL_OVERRIDE; /// We need to be a SfxListener to be able to update the list of changes when we get SFX_HINT_DOCCHANGED. using Control::Notify; diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx index e50a6d84cfbe..21e444057659 100644 --- a/sw/source/uibase/inc/regionsw.hxx +++ b/sw/source/uibase/inc/regionsw.hxx @@ -131,6 +131,7 @@ class SwEditRegionDlg : public SfxModalDialog public: SwEditRegionDlg( vcl::Window* pParent, SwWrtShell& rWrtSh ); virtual ~SwEditRegionDlg(); + virtual void dispose() SAL_OVERRIDE; void SelectSection(const OUString& rSectionName); @@ -184,6 +185,7 @@ class SwInsertSectionTabPage : public SfxTabPage public: SwInsertSectionTabPage(vcl::Window *pParent, const SfxItemSet &rAttrSet); virtual ~SwInsertSectionTabPage(); + virtual void dispose() SAL_OVERRIDE; void SetWrtShell(SwWrtShell& rSh); diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx index 153d9e17d09d..0ead065a48d2 100644 --- a/sw/source/uibase/inc/srcedtw.hxx +++ b/sw/source/uibase/inc/srcedtw.hxx @@ -118,6 +118,7 @@ protected: public: SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView ); virtual ~SwSrcEditWindow(); + virtual void dispose() SAL_OVERRIDE; void SetScrollBarRanges(); void InitScrollBars(); diff --git a/sw/source/uibase/inc/srcview.hxx b/sw/source/uibase/inc/srcview.hxx index ab37058fb371..5e0c4e5a5839 100644 --- a/sw/source/uibase/inc/srcview.hxx +++ b/sw/source/uibase/inc/srcview.hxx @@ -32,7 +32,7 @@ class SfxMedium; class SwSrcView: public SfxViewShell { - SwSrcEditWindow aEditWin; + VclPtr<SwSrcEditWindow> aEditWin; SvxSearchItem* pSearchItem; @@ -64,11 +64,11 @@ public: virtual ~SwSrcView(); SwDocShell* GetDocShell(); - SwSrcEditWindow& GetEditWin() {return aEditWin;} + SwSrcEditWindow& GetEditWin() { return *aEditWin.get(); } void SaveContent(const OUString& rTmpFile); void SaveContentTo(SfxMedium& rMed); - bool IsModified() {return aEditWin.IsModified();} + bool IsModified() {return aEditWin->IsModified();} void Execute(SfxRequest&); void GetState(SfxItemSet&); diff --git a/sw/source/uibase/inc/srtdlg.hxx b/sw/source/uibase/inc/srtdlg.hxx index a20fdeb6f04a..592e1007b2b1 100644 --- a/sw/source/uibase/inc/srtdlg.hxx +++ b/sw/source/uibase/inc/srtdlg.hxx @@ -85,6 +85,7 @@ class SwSortDlg : public SvxStandardDialog public: SwSortDlg(vcl::Window * pParent, SwWrtShell &rSh); virtual ~SwSortDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx index 06ccac71cff0..2a4728a689e1 100644 --- a/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx +++ b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx @@ -30,6 +30,7 @@ class SwModalRedlineAcceptDlg : public SfxModalDialog public: SwModalRedlineAcceptDlg(vcl::Window *pParent); virtual ~SwModalRedlineAcceptDlg(); + virtual void dispose() SAL_OVERRIDE; void AcceptAll( bool bAccept ); virtual void Activate() SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/swuiccoll.hxx b/sw/source/uibase/inc/swuiccoll.hxx index b4bcbcf1ad7b..a36b10853ba0 100644 --- a/sw/source/uibase/inc/swuiccoll.hxx +++ b/sw/source/uibase/inc/swuiccoll.hxx @@ -49,6 +49,7 @@ class SwCondCollPage : public SfxTabPage SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet); virtual ~SwCondCollPage(); + virtual void dispose() SAL_OVERRIDE; virtual int DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/swuicnttab.hxx b/sw/source/uibase/inc/swuicnttab.hxx index 3a230b940bc5..47cfee668785 100644 --- a/sw/source/uibase/inc/swuicnttab.hxx +++ b/sw/source/uibase/inc/swuicnttab.hxx @@ -102,6 +102,7 @@ public: SwTOXBase* pCurTOX, sal_uInt16 nToxType = USHRT_MAX, bool bGlobal = false); virtual ~SwMultiTOXTabDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SAL_OVERRIDE; @@ -221,6 +222,7 @@ class SwTOXSelectTabPage : public SfxTabPage public: SwTOXSelectTabPage(vcl::Window* pParent, const SfxItemSet& rAttrSet); virtual ~SwTOXSelectTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; @@ -283,6 +285,7 @@ class SwTokenWindow : public VclHBox, public VclBuilderContainer public: SwTokenWindow(vcl::Window* pParent); virtual ~SwTokenWindow(); + virtual void dispose() SAL_OVERRIDE; void SetTabPage(SwTOXEntryTabPage *pParent) { m_pParent = pParent; } @@ -480,6 +483,7 @@ class SwTOXStylesTabPage : public SfxTabPage public: SwTOXStylesTabPage(vcl::Window* pParent, const SfxItemSet& rAttrSet); virtual ~SwTOXStylesTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/tautofmt.hxx b/sw/source/uibase/inc/tautofmt.hxx index 603301b94ba4..019de4103b9c 100644 --- a/sw/source/uibase/inc/tautofmt.hxx +++ b/sw/source/uibase/inc/tautofmt.hxx @@ -82,6 +82,7 @@ public: bool bSetAutoFmt = true, const SwTableAutoFmt* pSelFmt = 0 ); virtual ~SwAutoFormatDlg(); + virtual void dispose() SAL_OVERRIDE; void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const; }; diff --git a/sw/source/uibase/inc/titlepage.hxx b/sw/source/uibase/inc/titlepage.hxx index 598b5821d173..59ee2e180fab 100644 --- a/sw/source/uibase/inc/titlepage.hxx +++ b/sw/source/uibase/inc/titlepage.hxx @@ -63,6 +63,7 @@ private: public: SwTitlePageDlg( vcl::Window *pParent ); virtual ~SwTitlePageDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/unotools.hxx b/sw/source/uibase/inc/unotools.hxx index 8d4220f20ffe..d4cd7078b685 100644 --- a/sw/source/uibase/inc/unotools.hxx +++ b/sw/source/uibase/inc/unotools.hxx @@ -73,7 +73,7 @@ class SW_DLLPUBLIC SwOneExampleFrame ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > _xController; ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > _xCursor; - SwFrmCtrlWindow aTopWindow; + VclPtr<SwFrmCtrlWindow> aTopWindow; Idle aLoadedIdle; Link aInitializedLink; diff --git a/sw/source/uibase/inc/wordcountdialog.hxx b/sw/source/uibase/inc/wordcountdialog.hxx index 6048a83d86be..faf67d4240b9 100644 --- a/sw/source/uibase/inc/wordcountdialog.hxx +++ b/sw/source/uibase/inc/wordcountdialog.hxx @@ -57,6 +57,7 @@ public: vcl::Window *pParent, SfxChildWinInfo* pInfo); virtual ~SwWordCountFloatDlg(); + virtual void dispose() SAL_OVERRIDE; void UpdateCounts(); void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat); diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx index 6bb9c1f5377c..bac81d6750e7 100644 --- a/sw/source/uibase/inc/workctrl.hxx +++ b/sw/source/uibase/inc/workctrl.hxx @@ -146,6 +146,7 @@ protected: public: SwScrollNaviPopup( sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, vcl::Window *pParent ); virtual ~SwScrollNaviPopup(); + virtual void dispose() SAL_OVERRIDE; static OUString GetQuickHelpText(bool bNext); diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx index e6eb6a82b6e7..14c81b675dfe 100644 --- a/sw/source/uibase/misc/numberingtypelistbox.cxx +++ b/sw/source/uibase/misc/numberingtypelistbox.cxx @@ -63,7 +63,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwNumberingTypeListBox SwNumberingTypeListBox::~SwNumberingTypeListBox() { + dispose(); +} + +void SwNumberingTypeListBox::dispose() +{ delete pImpl; + ListBox::dispose(); } void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags) diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 63847a49c35f..a0cd1e257498 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -137,13 +137,19 @@ void SwModelessRedlineAcceptDlg::FillInfo(SfxChildWinInfo& rInfo) const SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg() { + dispose(); +} + +void SwModelessRedlineAcceptDlg::dispose() +{ delete pImplDlg; + SfxModelessDialog::dispose(); } SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer *pBuilder, vcl::Window *pContentArea, bool bAutoFmt) : pParentDlg (pParent), - aTabPagesCTRL (pContentArea, pBuilder), + aTabPagesCTRL (new SvxAcceptChgCtr(pContentArea, pBuilder)), aPopup (SW_RES(MN_REDLINE_POPUP)), sInserted (SW_RES(STR_REDLINE_INSERTED)), sDeleted (SW_RES(STR_REDLINE_DELETED)), @@ -156,8 +162,8 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer bRedlnAutoFmt (bAutoFmt), bInhibitActivate( false ) { - aTabPagesCTRL.SetHelpId(HID_REDLINE_CTRL); - pTPView = aTabPagesCTRL.GetViewPage(); + aTabPagesCTRL->SetHelpId(HID_REDLINE_CTRL); + pTPView = aTabPagesCTRL->GetViewPage(); pTable = pTPView->GetTableControl(); @@ -173,9 +179,9 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer pTPView->EnableAcceptAll(false); pTPView->EnableRejectAll(false); - aTabPagesCTRL.GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl)); + aTabPagesCTRL->GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl)); - ListBox *pActLB = aTabPagesCTRL.GetFilterPage()->GetLbAction(); + ListBox *pActLB = aTabPagesCTRL->GetFilterPage()->GetLbAction(); pActLB->InsertEntry(sInserted); pActLB->InsertEntry(sDeleted); pActLB->InsertEntry(sFormated); @@ -247,7 +253,7 @@ void SwRedlineAcceptDlg::InitAuthors() { SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - SvxTPFilter *pFilterPage = aTabPagesCTRL.GetFilterPage(); + SvxTPFilter *pFilterPage = aTabPagesCTRL->GetFilterPage(); std::vector<OUString> aStrings; OUString sOldAuthor(pFilterPage->GetSelectedAuthor()); @@ -911,7 +917,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, UndoHdl) IMPL_LINK_NOARG(SwRedlineAcceptDlg, FilterChangedHdl) { - SvxTPFilter *pFilterTP = aTabPagesCTRL.GetFilterPage(); + SvxTPFilter *pFilterTP = aTabPagesCTRL->GetFilterPage(); if (pFilterTP->IsAction()) sFilterAction = pFilterTP->GetLbAction()->GetSelectEntry(); @@ -1242,7 +1248,13 @@ SwRedlineAcceptPanel::SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno: SwRedlineAcceptPanel::~SwRedlineAcceptPanel() { + dispose(); +} + +void SwRedlineAcceptPanel::dispose() +{ delete mpImplDlg; + PanelLayout::dispose(); } void SwRedlineAcceptPanel::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index 981fc7660cdb..2303c3dad6b9 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -58,8 +58,8 @@ SFX_IMPL_POS_CHILDWINDOW_WITHID( SwInputChild, FN_EDIT_FORMULA, SFX_OBJECTBAR_OB SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : ToolBox( pParent , SW_RES( RID_TBX_FORMULA )), - aPos( this, SW_RES(ED_POS)), - aEdit( this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION), + aPos( new Edit(this, SW_RES(ED_POS))), + aEdit( new InputEdit(this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION)), aPopMenu( SW_RES(MN_CALC_POPUP)), pMgr(0), pWrtShell(0), @@ -75,7 +75,7 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) FreeResource(); - aEdit.SetSizePixel( aEdit.CalcMinimumSize() ); + aEdit->SetSizePixel( aEdit->CalcMinimumSize() ); SfxImageManager* pManager = SfxImageManager::GetImageManager( *SW_MOD() ); pManager->RegisterToolBox(this); @@ -83,15 +83,15 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) pView = ::GetActiveView(); pWrtShell = pView ? pView->GetWrtShellPtr() : 0; - InsertWindow( ED_POS, &aPos, ToolBoxItemBits::NONE, 0); + InsertWindow( ED_POS, aPos.get(), ToolBoxItemBits::NONE, 0); SetItemText(ED_POS, SW_RESSTR(STR_ACCESS_FORMULA_TYPE)); - aPos.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TYPE)); + aPos->SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TYPE)); SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TOOLBAR)); InsertSeparator ( 1 ); InsertSeparator (); - InsertWindow( ED_FORMULA, &aEdit); + InsertWindow( ED_FORMULA, aEdit.get()); SetItemText(ED_FORMULA, SW_RESSTR(STR_ACCESS_FORMULA_TEXT)); - aEdit.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TEXT)); + aEdit->SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TEXT)); SetHelpId(ED_FORMULA, HID_EDIT_FORMULA); SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC )); @@ -102,7 +102,7 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) SetDropdownClickHdl( LINK( this, SwInputWindow, DropdownClickHdl )); Size aSizeTbx = CalcWindowSizePixel(); - Size aEditSize = aEdit.GetSizePixel(); + Size aEditSize = aEdit->GetSizePixel(); Rectangle aItemRect( GetItemRect(FN_FORMULA_CALC) ); long nMaxHeight = (aEditSize.Height() > aItemRect.GetHeight()) ? aEditSize.Height() : aItemRect.GetHeight(); if( nMaxHeight+2 > aSizeTbx.Height() ) @@ -112,21 +112,26 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) SetSizePixel( aSize ); // align edit and item vcentered - Size aPosSize = aPos.GetSizePixel(); + Size aPosSize = aPos->GetSizePixel(); aPosSize.Height() = nMaxHeight; aEditSize.Height() = nMaxHeight; - Point aPosPos = aPos.GetPosPixel(); - Point aEditPos = aEdit.GetPosPixel(); + Point aPosPos = aPos->GetPosPixel(); + Point aEditPos = aEdit->GetPosPixel(); aPosPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1; aEditPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1; - aPos.SetPosSizePixel( aPosPos, aPosSize ); - aEdit.SetPosSizePixel( aEditPos, aEditSize ); + aPos->SetPosSizePixel( aPosPos, aPosSize ); + aEdit->SetPosSizePixel( aEditPos, aEditSize ); aPopMenu.SetSelectHdl(LINK( this, SwInputWindow, MenuHdl )); } SwInputWindow::~SwInputWindow() { + dispose(); +} + +void SwInputWindow::dispose() +{ SfxImageManager::GetImageManager( *SW_MOD() )->ReleaseToolBox(this); // wake rulers @@ -140,6 +145,10 @@ SwInputWindow::~SwInputWindow() pWrtShell->EndSelTblCells(); CleanupUglyHackWithUndo(); + + aPos.disposeAndClear(); + aEdit.disposeAndClear(); + ToolBox::dispose(); } void SwInputWindow::CleanupUglyHackWithUndo() @@ -179,12 +188,12 @@ void SwInputWindow::Resize() ToolBox::Resize(); long nWidth = GetSizePixel().Width(); - long nLeft = aEdit.GetPosPixel().X(); - Size aEditSize = aEdit.GetSizePixel(); + long nLeft = aEdit->GetPosPixel().X(); + Size aEditSize = aEdit->GetSizePixel(); aEditSize.Width() = std::max( ((long)(nWidth - nLeft - 5)), (long)0 ); - aEdit.SetSizePixel( aEditSize ); - aEdit.Invalidate(); + aEdit->SetSizePixel( aEditSize ); + aEdit->Invalidate(); } void SwInputWindow::ShowWin() @@ -210,11 +219,11 @@ void SwInputWindow::ShowWin() short nSrch = -1; while( (nPos = rPos.indexOf( ':',nPos + 1 ) ) != -1 ) nSrch = (short) nPos; - aPos.SetText( rPos.copy( ++nSrch ) ); + aPos->SetText( rPos.copy( ++nSrch ) ); aAktTableName = pWrtShell->GetTableFmt()->GetName(); } else - aPos.SetText(SW_RESSTR(STR_TBL_FORMULA)); + aPos->SetText(SW_RESSTR(STR_TBL_FORMULA)); // Edit current field OSL_ENSURE(pMgr == 0, "FieldManager not deleted"); @@ -273,15 +282,15 @@ void SwInputWindow::ShowWin() bFirst = false; - aEdit.SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl )); + aEdit->SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl )); - aEdit.SetText( sEdit ); - aEdit.SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); + aEdit->SetText( sEdit ); + aEdit->SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); sOldFml = sEdit; - aEdit.Invalidate(); - aEdit.Update(); - aEdit.GrabFocus(); + aEdit->Invalidate(); + aEdit->Update(); + aEdit->GrabFocus(); // For input cut the UserInterface pView->GetEditWin().LockKeyInput(true); @@ -326,7 +335,7 @@ static const char * const aStrArr[] = { { OUString aTmp( OUString::createFromAscii(aStrArr[nId - 1]) ); aTmp += " "; - aEdit.ReplaceSelected( aTmp ); + aEdit->ReplaceSelected( aTmp ); } return 0; } @@ -376,7 +385,7 @@ void SwInputWindow::ApplyFormula() pWrtShell->Pop( false ); // Formular should always begin with "=", so remove it here again - OUString sEdit(comphelper::string::strip(aEdit.GetText(), ' ')); + OUString sEdit(comphelper::string::strip(aEdit->GetText(), ' ')); if( !sEdit.isEmpty() && '=' == sEdit[0] ) sEdit = sEdit.copy( 1 ); SfxStringItem aParam(FN_EDIT_FORMULA, sEdit); @@ -422,11 +431,11 @@ IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller ) if( pTblFmt && aAktTableName != pTblFmt->GetName() ) sTblNm = pTblFmt->GetName(); - aEdit.UpdateRange( sBoxNms, sTblNm ); + aEdit->UpdateRange( sBoxNms, sTblNm ); OUString sNew; sNew += OUString(CH_LRE); - sNew += aEdit.GetText(); + sNew += aEdit->GetText(); sNew += OUString(CH_PDF); if( sNew != sOldFml ) @@ -449,7 +458,7 @@ IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller ) } } else - aEdit.GrabFocus(); + aEdit->GrabFocus(); return 0; } @@ -463,9 +472,9 @@ void SwInputWindow::SetFormula( const OUString& rFormula, bool bDelFlag ) else sEdit += rFormula; } - aEdit.SetText( sEdit ); - aEdit.SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); - aEdit.Invalidate(); + aEdit->SetText( sEdit ); + aEdit->SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); + aEdit->Invalidate(); bDelSel = bDelFlag; } @@ -477,7 +486,7 @@ IMPL_LINK_NOARG(SwInputWindow, ModifyHdl) DelBoxCntnt(); OUString sNew; sNew += OUString(CH_LRE); - sNew += aEdit.GetText(); + sNew += aEdit->GetText(); sNew += OUString(CH_PDF); pWrtShell->SwEditShell::Insert2( sNew ); pWrtShell->EndAllAction(); diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index b04dd47f240e..58d0e32a051f 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -448,7 +448,13 @@ SwScrollNaviPopup::SwScrollNaviPopup(sal_uInt16 nId, const Reference< XFrame >& SwScrollNaviPopup::~SwScrollNaviPopup() { + dispose(); +} + +void SwScrollNaviPopup::dispose() +{ delete m_pToolBox; + SfxPopupWindow::dispose(); } void SwScrollNaviPopup::DataChanged( const DataChangedEvent& rDCEvt ) diff --git a/sw/source/uibase/sidebar/PageColumnControl.cxx b/sw/source/uibase/sidebar/PageColumnControl.cxx index eaec7905f221..703b4cee03f4 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.cxx +++ b/sw/source/uibase/sidebar/PageColumnControl.cxx @@ -38,7 +38,7 @@ PageColumnControl::PageColumnControl( const bool bLandscape ) : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) ) , mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) ) - , maMoreButton( this, SW_RES(CB_COLUMN_MORE) ) + , maMoreButton( new PushButton( this, SW_RES(CB_COLUMN_MORE) ) ) , mnColumnType( nColumnType ) , mrPagePropPanel(rPanel) { @@ -69,15 +69,22 @@ PageColumnControl::PageColumnControl( mpColumnValueSet->Format(); mpColumnValueSet->StartSelection(); - maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); - maMoreButton.GrabFocus(); + maMoreButton->SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); + maMoreButton->GrabFocus(); FreeResource(); } PageColumnControl::~PageColumnControl(void) { + dispose(); +} + +void PageColumnControl::dispose() +{ delete mpColumnValueSet; + maMoreButton.disposeAndClear(); + ::svx::sidebar::PopupControl::dispose(); } IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl) diff --git a/sw/source/uibase/sidebar/PageColumnControl.hxx b/sw/source/uibase/sidebar/PageColumnControl.hxx index a5ddcda8ed1b..ef81b4d1dbb8 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.hxx +++ b/sw/source/uibase/sidebar/PageColumnControl.hxx @@ -44,11 +44,12 @@ public: const sal_uInt16 nColumnType, const bool bLandscape ); - virtual ~PageColumnControl(void); + virtual ~PageColumnControl(); + virtual void dispose() SAL_OVERRIDE; private: ::svx::sidebar::ValueSetWithTextControl* mpColumnValueSet; - PushButton maMoreButton; + VclPtr<PushButton> maMoreButton; sal_uInt16 mnColumnType; diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx index 7cb842960b2f..d0f71e6c4055 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.cxx +++ b/sw/source/uibase/sidebar/PageMarginControl.cxx @@ -50,18 +50,18 @@ PageMarginControl::PageMarginControl( const SfxMapUnit eUnit ) : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_MARGIN) ) , mpMarginValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) ) - , maCustom(this, SW_RES(FT_CUSTOM)) - , maLeft(this, SW_RES(FT_LEFT)) - , maInner(this, SW_RES(FT_INNER)) - , maLeftMarginEdit(this, SW_RES(MF_SWLEFT_MARGIN)) - , maRight(this, SW_RES(FT_RIGHT)) - , maOuter(this, SW_RES(FT_OUTER)) - , maRightMarginEdit(this, SW_RES(MF_SWRIGHT_MARGIN)) - , maTop(this, SW_RES(FT_TOP)) - , maTopMarginEdit(this, SW_RES(MF_SWTOP_MARGIN)) - , maBottom(this, SW_RES(FT_BOTTOM)) - , maBottomMarginEdit(this, SW_RES(MF_SWBOTTOM_MARGIN)) - , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) ) + , maCustom(new FixedText(this, SW_RES(FT_CUSTOM))) + , maLeft(new FixedText(this, SW_RES(FT_LEFT))) + , maInner(new FixedText(this, SW_RES(FT_INNER))) + , maLeftMarginEdit(new MetricField(this, SW_RES(MF_SWLEFT_MARGIN))) + , maRight(new FixedText(this, SW_RES(FT_RIGHT))) + , maOuter(new FixedText(this, SW_RES(FT_OUTER))) + , maRightMarginEdit(new MetricField(this, SW_RES(MF_SWRIGHT_MARGIN))) + , maTop(new FixedText(this, SW_RES(FT_TOP))) + , maTopMarginEdit(new MetricField(this, SW_RES(MF_SWTOP_MARGIN))) + , maBottom(new FixedText(this, SW_RES(FT_BOTTOM))) + , maBottomMarginEdit(new MetricField(this, SW_RES(MF_SWBOTTOM_MARGIN))) + , maWidthHeightField(new MetricField( this, SW_RES(FLD_WIDTH_HEIGHT) ) ) , mnPageLeftMargin( aPageLRMargin.GetLeft() ) , mnPageRightMargin( aPageLRMargin.GetRight() ) , mnPageTopMargin( aPageULMargin.GetUpper() ) @@ -77,8 +77,8 @@ PageMarginControl::PageMarginControl( , mbCustomValuesUsed( false ) , mrPagePropPanel(rPanel) { - maWidthHeightField.Hide(); - SetFieldUnit( maWidthHeightField, eFUnit ); + maWidthHeightField->Hide(); + SetFieldUnit( *maWidthHeightField.get(), eFUnit ); mbUserCustomValuesAvailable = GetUserCustomValues(); @@ -93,76 +93,95 @@ PageMarginControl::PageMarginControl( SelectValueSetItem(); - SetFieldUnit( maLeftMarginEdit, eFUnit ); + SetFieldUnit( *maLeftMarginEdit.get(), eFUnit ); Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl ); - maLeftMarginEdit.SetModifyHdl( aLinkLR ); - SetMetricValue( maLeftMarginEdit, mnPageLeftMargin, meUnit ); + maLeftMarginEdit->SetModifyHdl( aLinkLR ); + SetMetricValue( *maLeftMarginEdit.get(), mnPageLeftMargin, meUnit ); - SetFieldUnit( maRightMarginEdit, eFUnit ); - maRightMarginEdit.SetModifyHdl( aLinkLR ); - SetMetricValue( maRightMarginEdit, mnPageRightMargin, meUnit ); + SetFieldUnit( *maRightMarginEdit.get(), eFUnit ); + maRightMarginEdit->SetModifyHdl( aLinkLR ); + SetMetricValue( *maRightMarginEdit.get(), mnPageRightMargin, meUnit ); Link aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl ); - SetFieldUnit( maTopMarginEdit, eFUnit ); - maTopMarginEdit.SetModifyHdl( aLinkUL ); - SetMetricValue( maTopMarginEdit, mnPageTopMargin, meUnit ); + SetFieldUnit( *maTopMarginEdit.get(), eFUnit ); + maTopMarginEdit->SetModifyHdl( aLinkUL ); + SetMetricValue( *maTopMarginEdit.get(), mnPageTopMargin, meUnit ); - SetFieldUnit( maBottomMarginEdit, eFUnit ); - maBottomMarginEdit.SetModifyHdl( aLinkUL ); - SetMetricValue( maBottomMarginEdit, mnPageBottomMargin, meUnit ); + SetFieldUnit( *maBottomMarginEdit.get(), eFUnit ); + maBottomMarginEdit->SetModifyHdl( aLinkUL ); + SetMetricValue( *maBottomMarginEdit.get(), mnPageBottomMargin, meUnit ); SetMetricFieldMaxValues(rPageSize); if ( mbMirrored ) { - maLeft.Hide(); - maRight.Hide(); - maInner.Show(); - maOuter.Show(); + maLeft->Hide(); + maRight->Hide(); + maInner->Show(); + maOuter->Show(); } else { - maLeft.Show(); - maRight.Show(); - maInner.Hide(); - maOuter.Hide(); + maLeft->Show(); + maRight->Show(); + maInner->Hide(); + maOuter->Hide(); } FreeResource(); } -PageMarginControl::~PageMarginControl(void) +PageMarginControl::~PageMarginControl() +{ + dispose(); +} + +void PageMarginControl::dispose() { delete mpMarginValueSet; StoreUserCustomValues(); + + maCustom.disposeAndClear(); + maLeft.disposeAndClear(); + maInner.disposeAndClear(); + maLeftMarginEdit.disposeAndClear(); + maRight.disposeAndClear(); + maOuter.disposeAndClear(); + maRightMarginEdit.disposeAndClear(); + maTop.disposeAndClear(); + maTopMarginEdit.disposeAndClear(); + maBottom.disposeAndClear(); + maBottomMarginEdit.disposeAndClear(); + maWidthHeightField.disposeAndClear(); + ::svx::sidebar::PopupControl::dispose(); } void PageMarginControl::SetMetricFieldMaxValues(const Size& rPageSize) { - const long nML = maLeftMarginEdit.Denormalize( maLeftMarginEdit.GetValue(FUNIT_TWIP) ); - const long nMR = maRightMarginEdit.Denormalize( maRightMarginEdit.GetValue(FUNIT_TWIP) ); - const long nMT = maTopMarginEdit.Denormalize(maTopMarginEdit.GetValue(FUNIT_TWIP) ); - const long nMB = maBottomMarginEdit.Denormalize( maBottomMarginEdit.GetValue(FUNIT_TWIP) ); + const long nML = maLeftMarginEdit->Denormalize( maLeftMarginEdit->GetValue(FUNIT_TWIP) ); + const long nMR = maRightMarginEdit->Denormalize( maRightMarginEdit->GetValue(FUNIT_TWIP) ); + const long nMT = maTopMarginEdit->Denormalize(maTopMarginEdit->GetValue(FUNIT_TWIP) ); + const long nMB = maBottomMarginEdit->Denormalize( maBottomMarginEdit->GetValue(FUNIT_TWIP) ); const long nPH = LogicToLogic( rPageSize.Height(), (MapUnit)meUnit, MAP_TWIP ); const long nPW = LogicToLogic( rPageSize.Width(), (MapUnit)meUnit, MAP_TWIP ); // Left long nMax = nPW - nMR - MINBODY; - maLeftMarginEdit.SetMax(maLeftMarginEdit.Normalize(nMax), FUNIT_TWIP); + maLeftMarginEdit->SetMax(maLeftMarginEdit->Normalize(nMax), FUNIT_TWIP); // Right nMax = nPW - nML - MINBODY; - maRightMarginEdit.SetMax(maRightMarginEdit.Normalize(nMax), FUNIT_TWIP); + maRightMarginEdit->SetMax(maRightMarginEdit->Normalize(nMax), FUNIT_TWIP); //Top nMax = nPH - nMB - MINBODY; - maTopMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP); + maTopMarginEdit->SetMax(maTopMarginEdit->Normalize(nMax), FUNIT_TWIP); //Bottom nMax = nPH - nMT - MINBODY; - maBottomMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP); + maBottomMarginEdit->SetMax(maTopMarginEdit->Normalize(nMax), FUNIT_TWIP); } void PageMarginControl::FillValueSet( @@ -174,8 +193,8 @@ void PageMarginControl::FillValueSet( const OUString aTop = SW_RESSTR(STR_MARGIN_TOOLTIP_TOP); const OUString aBottom = SW_RESSTR(STR_MARGIN_TOOLTIP_BOT); - SetMetricValue( maWidthHeightField, SWPAGE_NARROW_VALUE, meUnit ); - const OUString aNarrowValText = maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_NARROW_VALUE, meUnit ); + const OUString aNarrowValText = maWidthHeightField->GetText(); OUString aHelpText = aLeft; aHelpText += aNarrowValText; aHelpText += aRight; @@ -188,8 +207,8 @@ void PageMarginControl::FillValueSet( Image((bLandscape) ? SW_RES(IMG_NARROW_L) : SW_RES(IMG_NARROW)), 0, SW_RESSTR(STR_NARROW), &aHelpText ); - SetMetricValue( maWidthHeightField, SWPAGE_NORMAL_VALUE, meUnit ); - const OUString aNormalValText = maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_NORMAL_VALUE, meUnit ); + const OUString aNormalValText = maWidthHeightField->GetText(); aHelpText = aLeft; aHelpText += aNormalValText; aHelpText += aRight; @@ -202,10 +221,10 @@ void PageMarginControl::FillValueSet( Image((bLandscape) ? SW_RES(IMG_NORMAL_L) : SW_RES(IMG_NORMAL)), 0, SW_RESSTR(STR_NORMAL), &aHelpText ); - SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE1, meUnit ); - const OUString aWide1ValText = maWidthHeightField.GetText(); - SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE2, meUnit ); - const OUString aWide2ValText = maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE1, meUnit ); + const OUString aWide1ValText = maWidthHeightField->GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE2, meUnit ); + const OUString aWide2ValText = maWidthHeightField->GetText(); aHelpText = aLeft; aHelpText += aWide2ValText; aHelpText += aRight; @@ -221,8 +240,8 @@ void PageMarginControl::FillValueSet( const OUString aInner = SW_RESSTR(STR_MARGIN_TOOLTIP_INNER); const OUString aOuter = SW_RESSTR(STR_MARGIN_TOOLTIP_OUTER); - SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE3, meUnit ); - const OUString aWide3ValText = maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE3, meUnit ); + const OUString aWide3ValText = maWidthHeightField->GetText(); aHelpText = aInner; aHelpText += aWide3ValText; aHelpText += aOuter; @@ -238,17 +257,17 @@ void PageMarginControl::FillValueSet( if ( bUserCustomValuesAvailable ) { aHelpText = mbUserCustomMirrored ? aInner : aLeft; - SetMetricValue( maWidthHeightField, mnUserCustomPageLeftMargin, meUnit ); - aHelpText += maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageLeftMargin, meUnit ); + aHelpText += maWidthHeightField->GetText(); aHelpText += mbUserCustomMirrored ? aOuter : aRight; - SetMetricValue( maWidthHeightField, mnUserCustomPageRightMargin, meUnit ); - aHelpText += maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageRightMargin, meUnit ); + aHelpText += maWidthHeightField->GetText(); aHelpText += aTop; - SetMetricValue( maWidthHeightField, mnUserCustomPageTopMargin, meUnit ); - aHelpText += maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageTopMargin, meUnit ); + aHelpText += maWidthHeightField->GetText(); aHelpText += aBottom; - SetMetricValue( maWidthHeightField, mnUserCustomPageBottomMargin, meUnit ); - aHelpText += maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageBottomMargin, meUnit ); + aHelpText += maWidthHeightField->GetText(); } else { @@ -389,8 +408,8 @@ IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG ) mpMarginValueSet->Format(); mpMarginValueSet->StartSelection(); - mnPageLeftMargin = GetCoreValue( maLeftMarginEdit, meUnit ); - mnPageRightMargin = GetCoreValue( maRightMarginEdit, meUnit ); + mnPageLeftMargin = GetCoreValue( *maLeftMarginEdit.get(), meUnit ); + mnPageRightMargin = GetCoreValue( *maRightMarginEdit.get(), meUnit ); mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin ); mbCustomValuesUsed = true; return 0; @@ -403,8 +422,8 @@ IMPL_LINK( PageMarginControl, ModifyULMarginHdl, MetricField *, EMPTYARG ) mpMarginValueSet->Format(); mpMarginValueSet->StartSelection(); - mnPageTopMargin = GetCoreValue( maTopMarginEdit, meUnit ); - mnPageBottomMargin = GetCoreValue( maBottomMarginEdit, meUnit ); + mnPageTopMargin = GetCoreValue( *maTopMarginEdit.get(), meUnit ); + mnPageBottomMargin = GetCoreValue( *maBottomMarginEdit.get(), meUnit ); mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin ); mbCustomValuesUsed = true; return 0; diff --git a/sw/source/uibase/sidebar/PageMarginControl.hxx b/sw/source/uibase/sidebar/PageMarginControl.hxx index 908b1c6ba180..8ab4c1b34917 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.hxx +++ b/sw/source/uibase/sidebar/PageMarginControl.hxx @@ -60,25 +60,26 @@ public: const bool bLandscape, const FieldUnit eFUnit, const SfxMapUnit eUnit ); - virtual ~PageMarginControl(void); + virtual ~PageMarginControl(); + virtual void dispose() SAL_OVERRIDE; private: ::svx::sidebar::ValueSetWithTextControl* mpMarginValueSet; - FixedText maCustom; - FixedText maLeft; - FixedText maInner; - MetricField maLeftMarginEdit; - FixedText maRight; - FixedText maOuter; - MetricField maRightMarginEdit; - FixedText maTop; - MetricField maTopMarginEdit; - FixedText maBottom; - MetricField maBottomMarginEdit; + VclPtr<FixedText> maCustom; + VclPtr<FixedText> maLeft; + VclPtr<FixedText> maInner; + VclPtr<MetricField> maLeftMarginEdit; + VclPtr<FixedText> maRight; + VclPtr<FixedText> maOuter; + VclPtr<MetricField> maRightMarginEdit; + VclPtr<FixedText> maTop; + VclPtr<MetricField> maTopMarginEdit; + VclPtr<FixedText> maBottom; + VclPtr<MetricField> maBottomMarginEdit; // hidden metric field - MetricField maWidthHeightField; + VclPtr<MetricField> maWidthHeightField; long mnPageLeftMargin; long mnPageRightMargin; diff --git a/sw/source/uibase/sidebar/PageOrientationControl.cxx b/sw/source/uibase/sidebar/PageOrientationControl.cxx index 1d7e5a225cc8..96494e601220 100644 --- a/sw/source/uibase/sidebar/PageOrientationControl.cxx +++ b/sw/source/uibase/sidebar/PageOrientationControl.cxx @@ -63,7 +63,13 @@ PageOrientationControl::PageOrientationControl( PageOrientationControl::~PageOrientationControl(void) { + dispose(); +} + +void PageOrientationControl::dispose() +{ delete mpOrientationValueSet; + ::svx::sidebar::PopupControl::dispose(); } IMPL_LINK(PageOrientationControl, ImplOrientationHdl, void *, pControl) diff --git a/sw/source/uibase/sidebar/PageOrientationControl.hxx b/sw/source/uibase/sidebar/PageOrientationControl.hxx index b829cc47e61d..2f86a48df859 100644 --- a/sw/source/uibase/sidebar/PageOrientationControl.hxx +++ b/sw/source/uibase/sidebar/PageOrientationControl.hxx @@ -37,7 +37,8 @@ public: vcl::Window* pParent, PagePropertyPanel& rPanel, const bool bLandscape ); - virtual ~PageOrientationControl(void); + virtual ~PageOrientationControl(); + virtual void dispose() SAL_OVERRIDE; private: ::svx::sidebar::ValueSetWithTextControl* mpOrientationValueSet; diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.cxx b/sw/source/uibase/sidebar/PagePropertyPanel.cxx index ed4a66aeb3b1..dd2fac9cd309 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.cxx +++ b/sw/source/uibase/sidebar/PagePropertyPanel.cxx @@ -200,8 +200,14 @@ PagePropertyPanel::PagePropertyPanel( PagePropertyPanel::~PagePropertyPanel() { + dispose(); +} + +void PagePropertyPanel::dispose() +{ delete[] maImgSize; delete[] maImgSize_L; + PanelLayout::dispose(); } void PagePropertyPanel::Initialize() diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.hxx b/sw/source/uibase/sidebar/PagePropertyPanel.hxx index 76a9a0f7cb2c..b2c0d6c16eed 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.hxx +++ b/sw/source/uibase/sidebar/PagePropertyPanel.hxx @@ -102,7 +102,8 @@ namespace sw { namespace sidebar { vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame, SfxBindings* pBindings ); - virtual ~PagePropertyPanel(void); + virtual ~PagePropertyPanel(); + virtual void dispose() SAL_OVERRIDE; SfxBindings* mpBindings; diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index 84c8db420239..576350850aab 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -43,14 +43,14 @@ PageSizeControl::PageSizeControl( const FieldUnit eFUnit ) : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_SIZE) ) , mpSizeValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::TEXT_TEXT, this, SW_RES(VS_SIZE) ) ) - , maMoreButton( this, SW_RES(CB_SIZE_MORE) ) - , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) ) + , maMoreButton( new PushButton( this, SW_RES(CB_SIZE_MORE) ) ) + , maWidthHeightField( new MetricField( this, SW_RES(FLD_WIDTH_HEIGHT) ) ) , mePaper( ePaper ) , maPaperList() , mrPagePropPanel(rPanel) { - maWidthHeightField.Hide(); - SetFieldUnit( maWidthHeightField, eFUnit ); + maWidthHeightField->Hide(); + SetFieldUnit( *maWidthHeightField.get(), eFUnit ); maPaperList.push_back( PAPER_A3 ); maPaperList.push_back( PAPER_A4 ); @@ -68,7 +68,7 @@ PageSizeControl::PageSizeControl( { OUString aMetricStr; { - const OUString aText = maWidthHeightField.GetText(); + const OUString aText = maWidthHeightField->GetText(); for (short i = aText.getLength() - 1; i >= 0; i--) { sal_Unicode c = aText[i]; @@ -86,7 +86,7 @@ PageSizeControl::PageSizeControl( } } - const LocaleDataWrapper& localeDataWrapper = maWidthHeightField.GetLocaleDataWrapper(); + const LocaleDataWrapper& localeDataWrapper = maWidthHeightField->GetLocaleDataWrapper(); OUString aWidthStr; OUString aHeightStr; OUString aItemText2; @@ -99,19 +99,19 @@ PageSizeControl::PageSizeControl( { Swap( aPaperSize ); } - maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Width() ), FUNIT_TWIP ); + maWidthHeightField->SetValue( maWidthHeightField->Normalize( aPaperSize.Width() ), FUNIT_TWIP ); aWidthStr = localeDataWrapper.getNum( - maWidthHeightField.GetValue(), - maWidthHeightField.GetDecimalDigits(), - maWidthHeightField.IsUseThousandSep(), - maWidthHeightField.IsShowTrailingZeros() ); + maWidthHeightField->GetValue(), + maWidthHeightField->GetDecimalDigits(), + maWidthHeightField->IsUseThousandSep(), + maWidthHeightField->IsShowTrailingZeros() ); - maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Height() ), FUNIT_TWIP); + maWidthHeightField->SetValue( maWidthHeightField->Normalize( aPaperSize.Height() ), FUNIT_TWIP); aHeightStr = localeDataWrapper.getNum( - maWidthHeightField.GetValue(), - maWidthHeightField.GetDecimalDigits(), - maWidthHeightField.IsUseThousandSep(), - maWidthHeightField.IsShowTrailingZeros() ); + maWidthHeightField->GetValue(), + maWidthHeightField->GetDecimalDigits(), + maWidthHeightField->IsUseThousandSep(), + maWidthHeightField->IsShowTrailingZeros() ); aItemText2 = aWidthStr + " x " + aHeightStr + " " + aMetricStr; @@ -135,15 +135,23 @@ PageSizeControl::PageSizeControl( mpSizeValueSet->Format(); mpSizeValueSet->StartSelection(); - maMoreButton.SetClickHdl( LINK( this, PageSizeControl, MoreButtonClickHdl_Impl ) ); - maMoreButton.GrabFocus(); + maMoreButton->SetClickHdl( LINK( this, PageSizeControl, MoreButtonClickHdl_Impl ) ); + maMoreButton->GrabFocus(); FreeResource(); } -PageSizeControl::~PageSizeControl(void) +PageSizeControl::~PageSizeControl() +{ + dispose(); +} + +void PageSizeControl::dispose() { delete mpSizeValueSet; + maMoreButton.disposeAndClear(); + maWidthHeightField.disposeAndClear(); + ::svx::sidebar::PopupControl::dispose(); } IMPL_LINK(PageSizeControl, ImplSizeHdl, void *, pControl) diff --git a/sw/source/uibase/sidebar/PageSizeControl.hxx b/sw/source/uibase/sidebar/PageSizeControl.hxx index 2fba0461ae7b..5377655b556b 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.hxx +++ b/sw/source/uibase/sidebar/PageSizeControl.hxx @@ -47,13 +47,14 @@ public: const Paper ePaper, const bool bLandscape, const FieldUnit eFUnit ); - virtual ~PageSizeControl(void); + virtual ~PageSizeControl(); + virtual void dispose() SAL_OVERRIDE; private: ::svx::sidebar::ValueSetWithTextControl* mpSizeValueSet; - PushButton maMoreButton; + VclPtr<PushButton> maMoreButton; // hidden metric field - MetricField maWidthHeightField; + VclPtr<MetricField> maWidthHeightField; Paper mePaper; ::std::vector< Paper > maPaperList; diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 558210728968..b1a1c7e22300 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -219,7 +219,7 @@ static OUString lcl_ConvertTabsToSpaces( const OUString& sLine ) SwSrcView::SwSrcView(SfxViewFrame* pViewFrame, SfxViewShell*) : SfxViewShell( pViewFrame, SWSRCVIEWFLAGS ), - aEditWin( &pViewFrame->GetWindow(), this ), + aEditWin( new SwSrcEditWindow( &pViewFrame->GetWindow(), this ) ), pSearchItem(0), bSourceSaved(false), eLoadEncoding(RTL_TEXTENCODING_DONTKNOW) @@ -231,7 +231,7 @@ SwSrcView::~SwSrcView() { SwDocShell* pDocShell = GetDocShell(); OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?"); - const TextSelection& rSel = aEditWin.GetTextView()->GetSelection(); + const TextSelection& rSel = aEditWin->GetTextView()->GetSelection(); static_cast<SwWebDocShell*>(pDocShell)->SetSourcePara( static_cast< sal_uInt16 >( rSel.GetStart().GetPara() ) ); uno::Reference<document::XDocumentPropertiesSupplier> xDPS( @@ -250,14 +250,14 @@ void SwSrcView::SaveContentTo(SfxMedium& rMed) { SvStream* pOutStream = rMed.GetOutStream(); pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding)); - aEditWin.Write( *pOutStream ); + aEditWin->Write( *pOutStream ); } void SwSrcView::Init() { SetHelpId(SW_SRC_VIEWSHELL); SetName(OUString("Source")); - SetWindow( &aEditWin ); + SetWindow( aEditWin.get() ); SwDocShell* pDocShell = GetDocShell(); // If the doc is still loading, then the DocShell must fire up // the Load if the loading is completed. @@ -265,7 +265,7 @@ void SwSrcView::Init() Load(pDocShell); else { - aEditWin.SetReadonly(true); + aEditWin->SetReadonly(true); } SetNewWindowAllowed( false ); @@ -283,13 +283,13 @@ void SwSrcView::SaveContent(const OUString& rTmpFile) SfxMedium aMedium( rTmpFile, StreamMode::WRITE); SvStream* pOutStream = aMedium.GetOutStream(); pOutStream->SetStreamCharSet( lcl_GetStreamCharSet(eLoadEncoding) ); - aEditWin.Write(*pOutStream); + aEditWin->Write(*pOutStream); aMedium.Commit(); } void SwSrcView::Execute(SfxRequest& rReq) { - TextView* pTextView = aEditWin.GetTextView(); + TextView* pTextView = aEditWin->GetTextView(); switch( rReq.GetSlot() ) { case SID_SAVEACOPY: @@ -329,7 +329,7 @@ void SwSrcView::Execute(SfxRequest& rReq) StreamMode::WRITE | StreamMode::SHARE_DENYNONE ); SvStream* pOutStream = aMedium.GetOutStream(); pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding)); - aEditWin.Write( *pOutStream ); + aEditWin->Write( *pOutStream ); aMedium.Commit(); } } @@ -352,12 +352,12 @@ void SwSrcView::Execute(SfxRequest& rReq) pOutStream->Seek(0); pOutStream->SetStreamSize(0); pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding)); - aEditWin.Write( *pOutStream ); + aEditWin->Write( *pOutStream ); pMed->CloseOutStream(); pMed->Commit(); pDocShell->GetDoc()->getIDocumentState().ResetModified(); SourceSaved(); - aEditWin.ClearModifyFlag(); + aEditWin->ClearModifyFlag(); } } break; @@ -370,7 +370,7 @@ void SwSrcView::Execute(SfxRequest& rReq) const SfxPoolItem& rItem = pTmpArgs->Get( nWhich ); SetSearchItem( static_cast<const SvxSearchItem&>(rItem)); StartSearchAndReplace( static_cast<const SvxSearchItem&>(rItem), false, rReq.IsAPI() ); - if(aEditWin.IsModified()) + if(aEditWin->IsModified()) GetDocShell()->GetDoc()->getIDocumentState().SetModified(); } break; @@ -380,7 +380,7 @@ void SwSrcView::Execute(SfxRequest& rReq) if(pSrchItem) { StartSearchAndReplace( *pSrchItem, false, rReq.IsAPI() ); - if(aEditWin.IsModified()) + if(aEditWin->IsModified()) GetDocShell()->GetDoc()->getIDocumentState().SetModified(); } } @@ -416,14 +416,14 @@ void SwSrcView::Execute(SfxRequest& rReq) pTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) ); break; } - aEditWin.Invalidate(); + aEditWin->Invalidate(); } void SwSrcView::GetState(SfxItemSet& rSet) { SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); - TextView* pTextView = aEditWin.GetTextView(); + TextView* pTextView = aEditWin->GetTextView(); while(nWhich) { @@ -472,7 +472,7 @@ void SwSrcView::GetState(SfxItemSet& rSet) if ( !pTextView->HasSelection() ) { const TextSelection& rSel = pTextView->GetSelection(); - sSelected = aEditWin.GetTextEngine()->GetWord( rSel.GetStart()); + sSelected = aEditWin->GetTextEngine()->GetWord( rSel.GetStart()); } else { @@ -539,7 +539,7 @@ void SwSrcView::GetState(SfxItemSet& rSet) { TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( - &aEditWin) ); + aEditWin.get()) ); bool bDisable = !aDataHelper.GetXTransferable().is() || 0 == aDataHelper.GetFormatCount(); if( bDisable ) @@ -571,7 +571,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, bool bApi, bool bRecursive) { - ExtTextView* pTextView = aEditWin.GetTextView(); + ExtTextView* pTextView = aEditWin->GetTextView(); TextSelection aSel; TextPaM aPaM; @@ -702,11 +702,11 @@ sal_Int32 SwSrcView::PrintSource( pOutDev->Push(); - TextEngine* pTextEngine = aEditWin.GetTextEngine(); + TextEngine* pTextEngine = aEditWin->GetTextEngine(); pOutDev->SetMapMode( MAP_100TH_MM ); - vcl::Font aFont( aEditWin.GetOutWin()->GetFont() ); + vcl::Font aFont( aEditWin->GetOutWin()->GetFont() ); Size aSize( aFont.GetSize() ); - aSize = aEditWin.GetOutWin()->PixelToLogic( aSize, MAP_100TH_MM ); + aSize = aEditWin->GetOutWin()->PixelToLogic( aSize, MAP_100TH_MM ); aFont.SetSize( aSize ); aFont.SetColor( COL_BLACK ); pOutDev->SetFont( aFont ); @@ -773,7 +773,7 @@ void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) pSimpleHint->GetId() == SFX_HINT_MODECHANGED || ( pSimpleHint->GetId() == SFX_HINT_TITLECHANGED && - !GetDocShell()->IsReadOnly() && aEditWin.IsReadonly() + !GetDocShell()->IsReadOnly() && aEditWin->IsReadonly() ) ) ) @@ -781,7 +781,7 @@ void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // Broadcast only comes once! const SwDocShell* pDocSh = GetDocShell(); const bool bReadonly = pDocSh->IsReadOnly(); - aEditWin.SetReadonly(bReadonly); + aEditWin->SetReadonly(bReadonly); } SfxViewShell::Notify(rBC, rHint); } @@ -793,8 +793,8 @@ void SwSrcView::Load(SwDocShell* pDocShell) rtl_getBestMimeCharsetFromTextEncoding( rHtmlOptions.GetTextEncoding() ); rtl_TextEncoding eDestEnc = rtl_getTextEncodingFromMimeCharset( pCharSet ); - aEditWin.SetReadonly(pDocShell->IsReadOnly()); - aEditWin.SetTextEncoding(eDestEnc); + aEditWin->SetReadonly(pDocShell->IsReadOnly()); + aEditWin->SetTextEncoding(eDestEnc); SfxMedium* pMedium = pDocShell->GetMedium(); const SfxFilter* pFilter = pMedium->GetFilter(); @@ -818,13 +818,13 @@ void SwSrcView::Load(SwDocShell* pDocShell) eDestEnc != eHeaderEnc ) { eDestEnc = eHeaderEnc; - aEditWin.SetTextEncoding(eDestEnc); + aEditWin->SetTextEncoding(eDestEnc); } pStream->SetStreamCharSet( eDestEnc ); pStream->Seek(0); - TextEngine* pTextEngine = aEditWin.GetTextEngine(); + TextEngine* pTextEngine = aEditWin->GetTextEngine(); pTextEngine->EnableUndo(false); - aEditWin.Read(*pStream); + aEditWin->Read(*pStream); pTextEngine->EnableUndo(true); } else @@ -852,17 +852,17 @@ void SwSrcView::Load(SwDocShell* pDocShell) if(nRes) { ErrorHandler::HandleError(ErrCode(nRes)); - aEditWin.SetReadonly(true); + aEditWin->SetReadonly(true); } aMedium.Commit(); SvStream* pInStream = aMedium.GetInStream(); pInStream->Seek(0); pInStream->SetStreamCharSet( eDestEnc ); - aEditWin.Read(*pInStream); + aEditWin->Read(*pInStream); } } - aEditWin.ClearModifyFlag(); + aEditWin->ClearModifyFlag(); eLoadEncoding = eDestEnc; @@ -872,9 +872,9 @@ void SwSrcView::Load(SwDocShell* pDocShell) pDocShell->SetAutoLoad(INetURLObject(), 0, false); OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?"); sal_uInt16 nLine = static_cast<SwWebDocShell*>(pDocShell)->GetSourcePara(); - aEditWin.SetStartLine(nLine); - aEditWin.GetTextEngine()->ResetUndo(); - aEditWin.GetOutWin()->GrabFocus(); + aEditWin->SetStartLine(nLine); + aEditWin->GetTextEngine()->ResetUndo(); + aEditWin->GetOutWin()->GrabFocus(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index b0142b985c58..7b3c95d25f2d 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -799,18 +799,20 @@ bool SwView::ExecSmartTagPopup( const Point& rPt ) class SwFieldDialog : public FloatingWindow { private: - ListBox aListBox; + VclPtr<ListBox> aListBox; IFieldmark *pFieldmark; DECL_LINK( MyListBoxHandler, ListBox * ); public: SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ); + virtual ~SwFieldDialog(); + virtual void dispose() SAL_OVERRIDE; }; SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) : FloatingWindow( parent, WB_BORDER | WB_SYSTEMWINDOW ), - aListBox(this), + aListBox(new ListBox(this)), pFieldmark( fieldBM ) { if ( fieldBM != NULL ) @@ -827,7 +829,7 @@ SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) : pCurrent != vListEntries.getArray() + vListEntries.getLength(); ++pCurrent) { - aListBox.InsertEntry(*pCurrent); + aListBox->InsertEntry(*pCurrent); } } @@ -838,20 +840,31 @@ SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) : { sal_Int32 nSelection = -1; pResult->second >>= nSelection; - aListBox.SelectEntryPos( nSelection ); + aListBox->SelectEntryPos( nSelection ); } } - Size lbSize(aListBox.GetOptimalSize()); + Size lbSize(aListBox->GetOptimalSize()); lbSize.Width()+=50; lbSize.Height()+=20; - aListBox.SetSizePixel(lbSize); - aListBox.SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) ); - aListBox.Show(); + aListBox->SetSizePixel(lbSize); + aListBox->SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) ); + aListBox->Show(); SetSizePixel( lbSize ); } +SwFieldDialog::~SwFieldDialog() +{ + dispose(); +} + +void SwFieldDialog::dispose() +{ + aListBox.disposeAndClear(); + FloatingWindow::dispose(); +} + IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox ) { short res = 0; diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 35e099df659b..7a589c022710 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -842,8 +842,14 @@ SwContentTree::SwContentTree(vcl::Window* pParent, const ResId& rResId) SwContentTree::~SwContentTree() { + dispose(); +} + +void SwContentTree::dispose() +{ Clear(); // If applicable erase content types previously. bIsInDrag = false; + SvTreeListBox::dispose(); } OUString SwContentTree::GetEntryAltText( SvTreeListEntry* pEntry ) const @@ -1600,11 +1606,11 @@ void SwContentTree::Display( bool bActive ) bIsLastReadOnly = bReadOnly; bool bDisable = pShell == 0 || bReadOnly; SwNavigationPI* pNavi = GetParentWindow(); - pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , !bDisable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, !bDisable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, !bDisable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT, !bDisable); - pNavi->aContentToolBox.EnableItem(FN_SELECT_SET_AUTO_BOOKMARK, !bDisable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_UP , !bDisable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_DOWN, !bDisable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_LEFT, !bDisable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_RIGHT, !bDisable); + pNavi->aContentToolBox->EnableItem(FN_SELECT_SET_AUTO_BOOKMARK, !bDisable); } if(pShell) { @@ -1933,7 +1939,7 @@ bool SwContentTree::ToggleToRoot() } } pConfig->SetRootType( nRootType ); - GetParentWindow()->aContentToolBox.CheckItem(FN_SHOW_ROOT, bIsRoot); + GetParentWindow()->aContentToolBox->CheckItem(FN_SHOW_ROOT, bIsRoot); return bIsRoot; } @@ -3052,10 +3058,10 @@ bool SwContentTree::Select( SvTreeListEntry* pEntry, bool bSelect ) } } SwNavigationPI* pNavi = GetParentWindow(); - pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , bEnable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, bEnable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, bEnable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT,bEnable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_UP , bEnable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_DOWN, bEnable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_LEFT, bEnable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_RIGHT,bEnable); return SvTreeListBox::Select(pEntry, bSelect); } diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index e794c98b3687..718fa2cd4cc8 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -180,8 +180,14 @@ SwGlobalTree::SwGlobalTree(vcl::Window* pParent, const ResId& rResId) : SwGlobalTree::~SwGlobalTree() { + dispose(); +} + +void SwGlobalTree::dispose() +{ delete pSwGlblDocContents; delete pDocInserter; + SvTreeListBox::dispose(); } sal_Int8 SwGlobalTree::ExecuteDrop( const ExecuteDropEvent& rEvt ) @@ -505,12 +511,12 @@ void SwGlobalTree::SelectHdl() SwNavigationPI* pNavi = GetParentWindow(); bool bReadonly = !pActiveShell || pActiveShell->GetView().GetDocShell()->IsReadOnly(); - pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_EDIT, nSelCount == 1 && !bReadonly); - pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_OPEN, nSelCount <= 1 && !bReadonly); - pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_UPDATE, GetEntryCount() > 0 && !bReadonly); - pNavi->aGlobalToolBox.EnableItem(FN_ITEM_UP, + pNavi->aGlobalToolBox->EnableItem(FN_GLOBAL_EDIT, nSelCount == 1 && !bReadonly); + pNavi->aGlobalToolBox->EnableItem(FN_GLOBAL_OPEN, nSelCount <= 1 && !bReadonly); + pNavi->aGlobalToolBox->EnableItem(FN_GLOBAL_UPDATE, GetEntryCount() > 0 && !bReadonly); + pNavi->aGlobalToolBox->EnableItem(FN_ITEM_UP, nSelCount == 1 && nAbsPos && !bReadonly); - pNavi->aGlobalToolBox.EnableItem(FN_ITEM_DOWN, + pNavi->aGlobalToolBox->EnableItem(FN_ITEM_DOWN, nSelCount == 1 && nAbsPos < GetEntryCount() - 1 && !bReadonly); } diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index c89a0628ade0..504e3928d688 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -135,13 +135,13 @@ IMPL_LINK( SwNavigationPI, DocListBoxSelectHdl, ListBox *, pBox ) if(!pView) { nEntryIdx == 0 ? - aContentTree.ShowHiddenShell(): - aContentTree.ShowActualView(); + aContentTree->ShowHiddenShell(): + aContentTree->ShowActualView(); } else { - aContentTree.SetConstantShell(pView->GetWrtShellPtr()); + aContentTree->SetConstantShell(pView->GetWrtShellPtr()); } return 0; } @@ -153,23 +153,23 @@ void SwNavigationPI::FillBox() { if(pContentWrtShell) { - aContentTree.SetHiddenShell( pContentWrtShell ); - aContentTree.Display( false ); + aContentTree->SetHiddenShell( pContentWrtShell ); + aContentTree->Display( false ); } else { SwView *pView = GetCreateView(); if(!pView) { - aContentTree.SetActiveShell(0); + aContentTree->SetActiveShell(0); } else if( pView != pActContView) { SwWrtShell* pWrtShell = pView->GetWrtShellPtr(); - aContentTree.SetActiveShell(pWrtShell); + aContentTree->SetActiveShell(pWrtShell); } else - aContentTree.Display( true ); + aContentTree->Display( true ); pActContView = pView; } } @@ -222,7 +222,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) break; case FN_SHOW_ROOT: { - aContentTree.ToggleToRoot(); + aContentTree->ToggleToRoot(); } break; case FN_SHOW_CONTENT_BOX: @@ -305,9 +305,9 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) case FN_GLOBAL_EDIT: { if(IsGlobalMode()) - aGlobalTree.ExecCommand(nCurrItemId); + aGlobalTree->ExecCommand(nCurrItemId); else - aContentTree.ExecCommand(nCurrItemId, bOutlineWithChildren); + aContentTree->ExecCommand(nCurrItemId, bOutlineWithChildren); } break; case FN_GLOBAL_SWITCH: @@ -343,7 +343,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxClickHdl, ToolBox *, pBox ) case FN_GLOBAL_UPDATE: case FN_GLOBAL_OPEN: { - aGlobalTree.TbxMenuHdl(nCurrItemId, pBox); + aGlobalTree->TbxMenuHdl(nCurrItemId, pBox); } break; } @@ -396,7 +396,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox ) pMenu->InsertItem( i, OUString::number(i - 100) ); pMenu->SetHelpId( i, HID_NAVI_OUTLINES ); } - pMenu->CheckItem( aContentTree.GetOutlineLevel() + 100 ); + pMenu->CheckItem( aContentTree->GetOutlineLevel() + 100 ); pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl)); pBox->SetItemDown( nCurrItemId, true ); pMenu->Execute( pBox, @@ -435,7 +435,7 @@ void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, bool bSetFocus Rectangle aRect(rRect); Point aT1 = aRect.TopLeft(); - aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox.OutputToAbsoluteScreenPixel(aT1))); + aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox->OutputToAbsoluteScreenPixel(aT1))); aRect.SetPos(aT1); pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_RIGHT|FLOATWIN_POPUPMODE_ALLOWTEAROFF); SetPopupWindow( pPopup ); @@ -544,18 +544,18 @@ void SwNavigationPI::_ZoomOut() FillBox(); if(IsGlobalMode()) { - aGlobalTree.ShowTree(); + aGlobalTree->ShowTree(); } else { - aContentTree.ShowTree(); - aDocListBox.Show(); + aContentTree->ShowTree(); + aDocListBox->Show(); } - SvTreeListEntry* pFirst = aContentTree.FirstSelected(); + SvTreeListEntry* pFirst = aContentTree->FirstSelected(); if(pFirst) - aContentTree.Select(pFirst, true); // Enable toolbox + aContentTree->Select(pFirst, true); // Enable toolbox pConfig->SetSmall( false ); - aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX); + aContentToolBox->CheckItem(FN_SHOW_CONTENT_BOX); } } @@ -567,9 +567,9 @@ void SwNavigationPI::_ZoomIn() if (pFloat && (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp()))) { - aContentTree.HideTree(); - aDocListBox.Hide(); - aGlobalTree.HideTree(); + aContentTree->HideTree(); + aDocListBox->Hide(); + aGlobalTree->HideTree(); bIsZoomedIn = true; Size aSz(GetOutputSizePixel()); if( aSz.Height() > nZoomIn ) @@ -580,11 +580,11 @@ void SwNavigationPI::_ZoomIn() static_cast<SfxDockingWindow*>(GetParent())->SetMinOutputSizePixel(Size( aMinOutSizePixel.Width(), aSz.Height())); pFloat->SetOutputSizePixel(aSz); - SvTreeListEntry* pFirst = aContentTree.FirstSelected(); + SvTreeListEntry* pFirst = aContentTree->FirstSelected(); if(pFirst) - aContentTree.Select(pFirst, true); // Enable toolbox + aContentTree->Select(pFirst, true); // Enable toolbox pConfig->SetSmall( true ); - aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, false); + aContentToolBox->CheckItem(FN_SHOW_CONTENT_BOX, false); } } } @@ -616,25 +616,25 @@ void SwNavigationPI::Resize() pDockingParent->SetMinOutputSizePixel(aMinOutSizePixel); } - const Point aPos = aContentTree.GetPosPixel(); - Point aLBPos = aDocListBox.GetPosPixel(); + const Point aPos = aContentTree->GetPosPixel(); + Point aLBPos = aDocListBox->GetPosPixel(); long nDist = aPos.X(); aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist); aNewSize.Width() -= 2 * nDist; aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist; - aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() ); + aDocListBox->Show(!aGlobalTree->IsVisible() && aLBPos.Y() > aPos.Y() ); - Size aDocLBSz = aDocListBox.GetSizePixel(); + Size aDocLBSz = aDocListBox->GetSizePixel(); aDocLBSz.Width() = aNewSize.Width(); if(aNewSize.Height() < 0) aDocLBSz.Height() = 0; else aDocLBSz.Height() = nDocLBIniHeight; - aContentTree.SetSizePixel(aNewSize); + aContentTree->SetSizePixel(aNewSize); // GlobalTree starts on to the top and goes all the way down. - aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y()); - aGlobalTree.SetSizePixel(aNewSize); - aDocListBox.setPosSizePixel( aLBPos.X(), aLBPos.Y(), + aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree->GetPosPixel().Y()); + aGlobalTree->SetSizePixel(aNewSize); + aDocListBox->setPosSizePixel( aLBPos.X(), aLBPos.Y(), aDocLBSz.Width(), aDocLBSz.Height(), WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH); } @@ -647,12 +647,12 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, Window( pParent, SW_RES(DLG_NAVIGATION_PI)), SfxControllerItem( SID_DOCFULLNAME, *_pBindings ), - aContentToolBox(this, SW_RES(TB_CONTENT)), - aGlobalToolBox(this, SW_RES(TB_GLOBAL)), + aContentToolBox(new SwNavHelpToolBox(this, SW_RES(TB_CONTENT))), + aGlobalToolBox(new SwHelpToolBox(this, SW_RES(TB_GLOBAL))), aContentImageList(SW_RES(IL_CONTENT)), - aContentTree(this, SW_RES(TL_CONTENT)), - aGlobalTree(this, SW_RES(TL_GLOBAL)), - aDocListBox(this, SW_RES(LB_DOCS)), + aContentTree(new SwContentTree(this, SW_RES(TL_CONTENT))), + aGlobalTree(new SwGlobalTree(this, SW_RES(TL_GLOBAL))), + aDocListBox(new ListBox(this, SW_RES(LB_DOCS))), pxObjectShell(0), pContentView(0), @@ -679,17 +679,17 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, GetCreateView(); InitImageList(); - aContentToolBox.SetHelpId(HID_NAVIGATOR_TOOLBOX ); - aGlobalToolBox.SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX); - aDocListBox.SetHelpId(HID_NAVIGATOR_LISTBOX ); - aDocListBox.SetDropDownLineCount(9); + aContentToolBox->SetHelpId(HID_NAVIGATOR_TOOLBOX ); + aGlobalToolBox->SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX); + aDocListBox->SetHelpId(HID_NAVIGATOR_LISTBOX ); + aDocListBox->SetDropDownLineCount(9); - nDocLBIniHeight = aDocListBox.GetSizePixel().Height(); + nDocLBIniHeight = aDocListBox->GetSizePixel().Height(); nZoomOutInit = nZoomOut = Resource::ReadShortRes(); // Insert the numeric field in the toolbox. NumEditAction* pEdit = new NumEditAction( - &aContentToolBox, SW_RES(NF_PAGE )); + aContentToolBox.get(), SW_RES(NF_PAGE )); pEdit->SetActionHdl(LINK(this, SwNavigationPI, EditAction)); pEdit->SetGetFocusHdl(LINK(this, SwNavigationPI, EditGetFocus)); pEdit->SetAccessibleName(pEdit->GetQuickHelpText()); @@ -700,16 +700,16 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, // Double separators are not allowed, so you have to // determine the suitable size differently. - Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SELECT_FOOTNOTE); - Rectangle aSecondRect = aContentToolBox.GetItemRect(FN_SELECT_HEADER); + Rectangle aFirstRect = aContentToolBox->GetItemRect(FN_SELECT_FOOTNOTE); + Rectangle aSecondRect = aContentToolBox->GetItemRect(FN_SELECT_HEADER); Size aItemWinSize( aFirstRect.Left() - aSecondRect.Left(), aFirstRect.Bottom() - aFirstRect.Top() ); pEdit->SetSizePixel(aItemWinSize); - aContentToolBox.InsertSeparator(4); - aContentToolBox.InsertWindow( FN_PAGENUMBER, pEdit, ToolBoxItemBits::NONE, 4); - aContentToolBox.InsertSeparator(4); - aContentToolBox.SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16); - aContentToolBox.ShowItem( FN_PAGENUMBER ); + aContentToolBox->InsertSeparator(4); + aContentToolBox->InsertWindow( FN_PAGENUMBER, pEdit, ToolBoxItemBits::NONE, 4); + aContentToolBox->InsertSeparator(4); + aContentToolBox->SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16); + aContentToolBox->ShowItem( FN_PAGENUMBER ); for( sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++ ) { @@ -724,15 +724,15 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, nZoomIn = (short)rOutSize.Height(); // Make sure the toolbox has a size that fits all its contents - Size aContentToolboxSize( aContentToolBox.CalcWindowSizePixel() ); - aContentToolBox.SetOutputSizePixel( aContentToolboxSize ); + Size aContentToolboxSize( aContentToolBox->CalcWindowSizePixel() ); + aContentToolBox->SetOutputSizePixel( aContentToolboxSize ); // position listbox below toolbar and add some space - long nListboxYPos = aContentToolBox.GetPosPixel().Y() + aContentToolboxSize.Height() + 4; + long nListboxYPos = aContentToolBox->GetPosPixel().Y() + aContentToolboxSize.Height() + 4; // The left and right margins around the toolboxes should be equal. nWishWidth = aContentToolboxSize.Width(); - nWishWidth += 2 * aContentToolBox.GetPosPixel().X(); + nWishWidth += 2 * aContentToolBox->GetPosPixel().X(); DockingWindow* pDockingParent = dynamic_cast<DockingWindow*>(pParent); if (pDockingParent != NULL) @@ -758,76 +758,76 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, } } - aContentTree.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); - aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| + aContentTree->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + aContentTree->SetStyle( aContentTree->GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); - aContentTree.SetSpaceBetweenEntries(3); - aContentTree.SetSelectionMode( SINGLE_SELECTION ); - aContentTree.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE | + aContentTree->SetSpaceBetweenEntries(3); + aContentTree->SetSelectionMode( SINGLE_SELECTION ); + aContentTree->SetDragDropMode( SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY | SV_DRAGDROP_ENABLE_TOP ); - aContentTree.EnableAsyncDrag(true); - aContentTree.ShowTree(); - aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, true); + aContentTree->EnableAsyncDrag(true); + aContentTree->ShowTree(); + aContentToolBox->CheckItem(FN_SHOW_CONTENT_BOX, true); // TreeListBox for global document - aGlobalTree.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); - aGlobalTree.SetSelectionMode( MULTIPLE_SELECTION ); - aGlobalTree.SetStyle( aGlobalTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| + aGlobalTree->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + aGlobalTree->SetSelectionMode( MULTIPLE_SELECTION ); + aGlobalTree->SetStyle( aGlobalTree->GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| WB_CLIPCHILDREN|WB_HSCROLL ); - Size aGlblSize(aGlobalToolBox.CalcWindowSizePixel()); - aGlobalToolBox.SetSizePixel(aGlblSize); + Size aGlblSize(aGlobalToolBox->CalcWindowSizePixel()); + aGlobalToolBox->SetSizePixel(aGlblSize); // Handler Link aLk = LINK(this, SwNavigationPI, ToolBoxSelectHdl); - aContentToolBox.SetSelectHdl( aLk ); - aGlobalToolBox.SetSelectHdl( aLk ); - aDocListBox.SetSelectHdl(LINK(this, SwNavigationPI, + aContentToolBox->SetSelectHdl( aLk ); + aGlobalToolBox->SetSelectHdl( aLk ); + aDocListBox->SetSelectHdl(LINK(this, SwNavigationPI, DocListBoxSelectHdl)); - aContentToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); - aContentToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); - aGlobalToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); - aGlobalToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); - aGlobalToolBox.CheckItem(FN_GLOBAL_SWITCH, true); + aContentToolBox->SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); + aContentToolBox->SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); + aGlobalToolBox->SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); + aGlobalToolBox->SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); + aGlobalToolBox->CheckItem(FN_GLOBAL_SWITCH, true); vcl::Font aFont(GetFont()); aFont.SetWeight(WEIGHT_NORMAL); GetPageEdit().SetFont(aFont); - aFont = aContentTree.GetFont(); + aFont = aContentTree->GetFont(); aFont.SetWeight(WEIGHT_NORMAL); - aContentTree.SetFont(aFont); - aGlobalTree.SetFont(aFont); + aContentTree->SetFont(aFont); + aGlobalTree->SetFont(aFont); StartListening(*SfxGetpApp()); if ( pCreateView ) StartListening(*pCreateView); SfxImageManager* pImgMan = SfxImageManager::GetImageManager(*SW_MOD()); - pImgMan->RegisterToolBox(&aContentToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE); - pImgMan->RegisterToolBox(&aGlobalToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE); + pImgMan->RegisterToolBox(aContentToolBox.get(), SFX_TOOLBOX_CHANGEOUTSTYLE); + pImgMan->RegisterToolBox(aGlobalToolBox.get(), SFX_TOOLBOX_CHANGEOUTSTYLE); - aContentToolBox.SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox.GetItemBits( FN_CREATE_NAVIGATION ) | ToolBoxItemBits::DROPDOWNONLY ); - aContentToolBox.SetItemBits( FN_DROP_REGION, aContentToolBox.GetItemBits( FN_DROP_REGION ) | ToolBoxItemBits::DROPDOWNONLY ); - aContentToolBox.SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox.GetItemBits( FN_OUTLINE_LEVEL ) | ToolBoxItemBits::DROPDOWNONLY ); + aContentToolBox->SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox->GetItemBits( FN_CREATE_NAVIGATION ) | ToolBoxItemBits::DROPDOWNONLY ); + aContentToolBox->SetItemBits( FN_DROP_REGION, aContentToolBox->GetItemBits( FN_DROP_REGION ) | ToolBoxItemBits::DROPDOWNONLY ); + aContentToolBox->SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox->GetItemBits( FN_OUTLINE_LEVEL ) | ToolBoxItemBits::DROPDOWNONLY ); if(IsGlobalDoc()) { SwView *pActView = GetCreateView(); - aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, + aGlobalToolBox->CheckItem(FN_GLOBAL_SAVE_CONTENT, pActView->GetWrtShellPtr()->IsGlblDocSaveLinks()); if(pConfig->IsGlobalActive()) ToggleTree(); - aGlobalTree.GrabFocus(); + aGlobalTree->GrabFocus(); } else - aContentTree.GrabFocus(); + aContentTree->GrabFocus(); UsePage(0); aPageChgIdle.SetIdleHdl(LINK(this, SwNavigationPI, ChangePageHdl)); aPageChgIdle.SetPriority(SchedulerPriority::LOWEST); - aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT)); - aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL)); - aDocListBox.SetAccessibleName(aStatusArr[3]); + aContentTree->SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT)); + aGlobalTree->SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL)); + aDocListBox->SetAccessibleName(aStatusArr[3]); if (pContextWin == NULL) { @@ -835,12 +835,17 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, // displayed in the sidebar. While the navigator could change // its size, the sidebar can not, and the navigator would just // waste space. Therefore hide this button. - aContentToolBox.RemoveItem(aContentToolBox.GetItemPos(FN_SHOW_CONTENT_BOX)); + aContentToolBox->RemoveItem(aContentToolBox->GetItemPos(FN_SHOW_CONTENT_BOX)); } } SwNavigationPI::~SwNavigationPI() { + dispose(); +} + +void SwNavigationPI::dispose() +{ if(IsGlobalDoc() && !IsGlobalMode()) { SwView *pView = GetCreateView(); @@ -852,10 +857,10 @@ SwNavigationPI::~SwNavigationPI() EndListening(*SfxGetpApp()); SfxImageManager* pImgMan = SfxImageManager::GetImageManager(*SW_MOD()); - pImgMan->ReleaseToolBox(&aContentToolBox); - pImgMan->ReleaseToolBox(&aGlobalToolBox); - delete aContentToolBox.GetItemWindow(FN_PAGENUMBER); - aContentToolBox.Clear(); + pImgMan->ReleaseToolBox(aContentToolBox.get()); + pImgMan->ReleaseToolBox(aGlobalToolBox.get()); + delete aContentToolBox->GetItemWindow(FN_PAGENUMBER); + aContentToolBox->Clear(); if(pxObjectShell) { if(pxObjectShell->Is()) @@ -867,6 +872,13 @@ SwNavigationPI::~SwNavigationPI() if ( IsBound() ) rBindings.Release(*this); + + aContentToolBox.disposeAndClear(); + aGlobalToolBox.disposeAndClear(); + aContentTree.disposeAndClear(); + aGlobalTree.disposeAndClear(); + aDocListBox.disposeAndClear(); + vcl::Window::dispose(); } void SwNavigationPI::SetPopupWindow( SfxPopupWindow* pWindow ) @@ -915,9 +927,9 @@ void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, if(pActView) { SwWrtShell* pWrtShell = pActView->GetWrtShellPtr(); - aContentTree.SetActiveShell(pWrtShell); + aContentTree->SetActiveShell(pWrtShell); bool bGlobal = IsGlobalDoc(); - aContentToolBox.EnableItem(FN_GLOBAL_SWITCH, bGlobal); + aContentToolBox->EnableItem(FN_GLOBAL_SWITCH, bGlobal); if( (!bGlobal && IsGlobalMode()) || (!IsGlobalMode() && pConfig->IsGlobalActive()) ) { @@ -925,12 +937,12 @@ void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, } if(bGlobal) { - aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks()); + aGlobalToolBox->CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks()); } } else { - aContentTree.SetActiveShell(0); + aContentTree->SetActiveShell(0); } UpdateListBox(); } @@ -940,7 +952,7 @@ void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, NumEditAction& SwNavigationPI::GetPageEdit() { - return *static_cast<NumEditAction*>(aContentToolBox.GetItemWindow(FN_PAGENUMBER)); + return *static_cast<NumEditAction*>(aContentToolBox->GetItemWindow(FN_PAGENUMBER)); } // Notification on modified DocInfo @@ -969,15 +981,15 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint ) if(pActView) { SwWrtShell* pWrtShell = pActView->GetWrtShellPtr(); - aContentTree.SetActiveShell(pWrtShell); - if(aGlobalTree.IsVisible()) + aContentTree->SetActiveShell(pWrtShell); + if(aGlobalTree->IsVisible()) { - if(aGlobalTree.Update( false )) - aGlobalTree.Display(); + if(aGlobalTree->Update( false )) + aGlobalTree->Display(); else // If no update is needed, then paint at least, // because of the red entries for the broken links. - aGlobalTree.Invalidate(); + aGlobalTree->Invalidate(); } } } @@ -993,24 +1005,24 @@ IMPL_LINK( SwNavigationPI, MenuSelectHdl, Menu *, pMenu ) if(nMenuId < 100) SetRegionDropMode( --nMenuId); else - aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) ); + aContentTree->SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) ); } return 0; } void SwNavigationPI::UpdateListBox() { - aDocListBox.SetUpdateMode(false); - aDocListBox.Clear(); + aDocListBox->SetUpdateMode(false); + aDocListBox->Clear(); SwView *pActView = GetCreateView(); bool bDisable = pActView == 0; SwView *pView = SwModule::GetFirstView(); sal_Int32 nCount = 0; sal_Int32 nAct = 0; sal_Int32 nConstPos = 0; - const SwView* pConstView = aContentTree.IsConstantView() && - aContentTree.GetActiveWrtShell() ? - &aContentTree.GetActiveWrtShell()->GetView(): + const SwView* pConstView = aContentTree->IsConstantView() && + aContentTree->GetActiveWrtShell() ? + &aContentTree->GetActiveWrtShell()->GetView(): 0; while (pView) { @@ -1028,7 +1040,7 @@ void SwNavigationPI::UpdateListBox() else sEntry += aStatusArr[ST_INACTIVE - ST_STATUS_FIRST]; sEntry += ")"; - aDocListBox.InsertEntry(sEntry); + aDocListBox->InsertEntry(sEntry); if (pConstView && pView == pConstView) nConstPos = nCount; @@ -1037,33 +1049,33 @@ void SwNavigationPI::UpdateListBox() } pView = SwModule::GetNextView(pView); } - aDocListBox.InsertEntry(aStatusArr[3]); // "Active Window" + aDocListBox->InsertEntry(aStatusArr[3]); // "Active Window" nCount++; - if(aContentTree.GetHiddenWrtShell()) + if(aContentTree->GetHiddenWrtShell()) { - OUString sEntry = aContentTree.GetHiddenWrtShell()->GetView(). + OUString sEntry = aContentTree->GetHiddenWrtShell()->GetView(). GetDocShell()->GetTitle(); sEntry += " ("; sEntry += aStatusArr[ST_HIDDEN - ST_STATUS_FIRST]; sEntry += ")"; - aDocListBox.InsertEntry(sEntry); + aDocListBox->InsertEntry(sEntry); bDisable = false; } - if(aContentTree.IsActiveView()) + if(aContentTree->IsActiveView()) { //Either the name of the current Document or "Active Document". - aDocListBox.SelectEntryPos( pActView ? nAct : --nCount ); + aDocListBox->SelectEntryPos( pActView ? nAct : --nCount ); } - else if(aContentTree.IsHiddenView()) + else if(aContentTree->IsHiddenView()) { - aDocListBox.SelectEntryPos(nCount); + aDocListBox->SelectEntryPos(nCount); } else - aDocListBox.SelectEntryPos(nConstPos); + aDocListBox->SelectEntryPos(nConstPos); - aDocListBox.Enable( !bDisable ); - aDocListBox.SetUpdateMode(true); + aDocListBox->Enable( !bDisable ); + aDocListBox->SetUpdateMode(true); } IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem) @@ -1074,7 +1086,7 @@ IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem) SfxViewFrame* pFrame = pFrameItem->GetFrame(); if(pFrame) { - aContentTree.Clear(); + aContentTree->Clear(); pContentView = PTR_CAST(SwView, pFrame->GetViewShell()); OSL_ENSURE(pContentView, "no SwView"); if(pContentView) @@ -1083,7 +1095,7 @@ IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem) pContentWrtShell = 0; pxObjectShell = new SfxObjectShellLock(pFrame->GetObjectShell()); FillBox(); - aContentTree.Update(); + aContentTree->Update(); } } return 0; @@ -1125,14 +1137,14 @@ OUString SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData ) sal_Int8 SwNavigationPI::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) { return ( !SwContentTree::IsInDrag() && - ( aContentTree.IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::STRING ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::SOLK ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK )|| - aContentTree.IsDropFormatSupported( SotClipboardFormatId::FILECONTENT ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::FILEGRPDESCRIPTOR ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::FILENAME ))) + ( aContentTree->IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::STRING ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::SOLK ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK )|| + aContentTree->IsDropFormatSupported( SotClipboardFormatId::FILECONTENT ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::FILEGRPDESCRIPTOR ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::FILENAME ))) ? DND_ACTION_COPY : DND_ACTION_NONE; } @@ -1157,7 +1169,7 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt ) sContentFileName = sFileName; if(pxObjectShell) { - aContentTree.SetHiddenShell( 0 ); + aContentTree->SetHiddenShell( 0 ); (*pxObjectShell)->DoClose(); DELETEZ( pxObjectShell); } @@ -1187,7 +1199,7 @@ void SwNavigationPI::SetRegionDropMode(sal_uInt16 nNewMode) ImageList& rImgLst = aContentImageList; - aContentToolBox.SetItemImage( FN_DROP_REGION, rImgLst.GetImage(nDropId)); + aContentToolBox->SetItemImage( FN_DROP_REGION, rImgLst.GetImage(nDropId)); } bool SwNavigationPI::ToggleTree() @@ -1199,23 +1211,23 @@ bool SwNavigationPI::ToggleTree() SetUpdateMode(false); if(_IsZoomedIn()) _ZoomOut(); - aGlobalTree.ShowTree(); - aGlobalToolBox.Show(); - aContentTree.HideTree(); - aContentToolBox.Hide(); - aDocListBox.Hide(); + aGlobalTree->ShowTree(); + aGlobalToolBox->Show(); + aContentTree->HideTree(); + aContentToolBox->Hide(); + aDocListBox->Hide(); SetGlobalMode(true); SetUpdateMode(true); } else { - aGlobalTree.HideTree(); - aGlobalToolBox.Hide(); + aGlobalTree->HideTree(); + aGlobalToolBox->Hide(); if(!_IsZoomedIn()) { - aContentTree.ShowTree(); - aContentToolBox.Show(); - aDocListBox.Show(); + aContentTree->ShowTree(); + aContentToolBox->Show(); + aDocListBox->Show(); } bRet = false; SetGlobalMode(false); @@ -1284,10 +1296,10 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent, const sal_uInt16 nRootType = static_cast< sal_uInt16 >( pNaviConfig->GetRootType() ); if( nRootType < CONTENT_TYPE_MAX ) { - pNavi->aContentTree.SetRootType(nRootType); - pNavi->aContentToolBox.CheckItem(FN_SHOW_ROOT, true); + pNavi->aContentTree->SetRootType(nRootType); + pNavi->aContentToolBox->CheckItem(FN_SHOW_ROOT, true); } - pNavi->aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) ); + pNavi->aContentTree->SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) ); pNavi->SetRegionDropMode( static_cast< sal_uInt16 >( pNaviConfig->GetRegionMode() ) ); if(GetFloatingWindow() && pNaviConfig->IsSmall()) @@ -1313,20 +1325,20 @@ void SwNavigationPI::DataChanged( const DataChangedEvent& rDCEvt ) void SwNavigationPI::InitImageList() { ImageList& rImgLst = aContentImageList; - for( sal_uInt16 k = 0; k < aContentToolBox.GetItemCount(); k++) - aContentToolBox.SetItemImage(aContentToolBox.GetItemId(k), - rImgLst.GetImage(aContentToolBox.GetItemId(k))); + for( sal_uInt16 k = 0; k < aContentToolBox->GetItemCount(); k++) + aContentToolBox->SetItemImage(aContentToolBox->GetItemId(k), + rImgLst.GetImage(aContentToolBox->GetItemId(k))); - for( sal_uInt16 k = 0; k < aGlobalToolBox.GetItemCount(); k++) - aGlobalToolBox.SetItemImage(aGlobalToolBox.GetItemId(k), - rImgLst.GetImage(aGlobalToolBox.GetItemId(k))); + for( sal_uInt16 k = 0; k < aGlobalToolBox->GetItemCount(); k++) + aGlobalToolBox->SetItemImage(aGlobalToolBox->GetItemId(k), + rImgLst.GetImage(aGlobalToolBox->GetItemId(k))); sal_uInt16 nDropId = FN_DROP_REGION; if(nRegionMode == REGION_MODE_LINK) nDropId = FN_DROP_REGION_LINK; else if(nRegionMode == REGION_MODE_EMBEDDED) nDropId = FN_DROP_REGION_COPY; - aContentToolBox.SetItemImage( FN_DROP_REGION, + aContentToolBox->SetItemImage( FN_DROP_REGION, rImgLst.GetImage(nDropId)); } diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx index 1b9aa58bf62c..a473498afc1a 100644 --- a/sw/source/uibase/utlui/numfmtlb.cxx +++ b/sw/source/uibase/utlui/numfmtlb.cxx @@ -109,7 +109,13 @@ void NumFormatListBox::Init(short nFormatType, bool bUsrFmts) NumFormatListBox::~NumFormatListBox() { + dispose(); +} + +void NumFormatListBox::dispose() +{ delete pOwnFormatter; + ListBox::dispose(); } SwView* NumFormatListBox::GetView() diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index 707f361d5020..227771f2b359 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -66,7 +66,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin, sal_uInt32 nFlags, const Link* pInitializedLink, const OUString* pURL ) : - aTopWindow(&rWin, this), + aTopWindow(new SwFrmCtrlWindow(&rWin, this)), aMenuRes(SW_RES(RES_FRMEX_MENU)), pModuleView(SW_MOD()->GetView()), nStyleFlags(nFlags), @@ -76,7 +76,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin, if (pURL && !pURL->isEmpty()) sArgumentURL = *pURL; - aTopWindow.SetPosSizePixel(Point(0, 0), rWin.GetSizePixel()); + aTopWindow->SetPosSizePixel(Point(0, 0), rWin.GetSizePixel()); if( pInitializedLink ) aInitializedLink = *pInitializedLink; @@ -87,7 +87,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin, CreateControl(); - aTopWindow.Show(); + aTopWindow->Show(); } void SwOneExampleFrame::CreateErrorMessage(vcl::Window* pParent) @@ -117,7 +117,7 @@ void SwOneExampleFrame::CreateControl() _xControl = uno::Reference< awt::XControl >(xInst, uno::UNO_QUERY); if(_xControl.is()) { - uno::Reference< awt::XWindowPeer > xParent( aTopWindow.GetComponentInterface() ); + uno::Reference< awt::XWindowPeer > xParent( aTopWindow->GetComponentInterface() ); uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW ); @@ -125,7 +125,7 @@ void SwOneExampleFrame::CreateControl() uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY ); xWin->setVisible(sal_False); - Size aWinSize(aTopWindow.GetOutputSizePixel()); + Size aWinSize(aTopWindow->GetOutputSizePixel()); xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE ); uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY); @@ -361,7 +361,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) } uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY ); - Size aWinSize(aTopWindow.GetOutputSizePixel()); + Size aWinSize(aTopWindow->GetOutputSizePixel()); xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE ); // can only be done here - the SFX changes the ScrollBar values @@ -376,7 +376,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) xScrCrsr->screenUp(); xWin->setVisible( sal_True ); - aTopWindow.Show(); + aTopWindow->Show(); if( xTunnel.is() ) { @@ -482,7 +482,7 @@ void SwOneExampleFrame::CreatePopup(const Point& rPt) aPop.SetPopupMenu( ITEM_ZOOM, &aSubPop1 ); aSubPop1.SetSelectHdl(aSelLk); } - aPop.Execute( &aTopWindow, rPt ); + aPop.Execute( aTopWindow.get(), rPt ); } |