From fbe6619a34b617a04a5135e40c70a172a44eefef Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 13 Jan 2015 14:50:19 +0200 Subject: vcl: VclPtr conversion in sfx2 Change-Id: I78ea3f4304ace27c6db0e3d0651bd65043dcbc68 --- sfx2/source/dialog/alienwarn.cxx | 6 + sfx2/source/dialog/backingwindow.cxx | 6 + sfx2/source/dialog/backingwindow.hxx | 1 + sfx2/source/dialog/basedlgs.cxx | 36 ++-- sfx2/source/dialog/dinfdlg.cxx | 342 ++++++++++++++++++--------------- sfx2/source/dialog/dockwin.cxx | 15 +- sfx2/source/dialog/infobar.cxx | 34 +++- sfx2/source/dialog/mgetempl.cxx | 11 +- sfx2/source/dialog/newstyle.cxx | 13 +- sfx2/source/dialog/partwnd.cxx | 6 - sfx2/source/dialog/printopt.cxx | 4 - sfx2/source/dialog/recfloat.cxx | 6 + sfx2/source/dialog/securitypage.cxx | 4 - sfx2/source/dialog/splitwin.cxx | 9 + sfx2/source/dialog/srchdlg.cxx | 6 + sfx2/source/dialog/styledlg.cxx | 5 + sfx2/source/dialog/tabdlg.cxx | 14 +- sfx2/source/dialog/taskpane.cxx | 63 +++--- sfx2/source/dialog/templateinfodlg.cxx | 6 + sfx2/source/dialog/templdlg.cxx | 234 +++++++++++----------- sfx2/source/dialog/titledockwin.cxx | 45 +++-- sfx2/source/dialog/versdlg.cxx | 12 ++ 22 files changed, 512 insertions(+), 366 deletions(-) (limited to 'sfx2/source/dialog') diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx index d1dc6ea1c136..e157e6ebfd85 100644 --- a/sfx2/source/dialog/alienwarn.cxx +++ b/sfx2/source/dialog/alienwarn.cxx @@ -50,12 +50,18 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUStrin } SfxAlienWarningDialog::~SfxAlienWarningDialog() +{ + dispose(); +} + +void SfxAlienWarningDialog::dispose() { // save value of "warning off" checkbox, if necessary SvtSaveOptions aSaveOpt; bool bChecked = m_pWarningOnBox->IsChecked(); if ( aSaveOpt.IsWarnAlienFormat() != bChecked ) aSaveOpt.SetWarnAlienFormat( bChecked ); + MessageDialog::dispose(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index ad9f98f769c2..fa3f40338cbc 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -194,6 +194,11 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) : BackingWindow::~BackingWindow() +{ + dispose(); +} + +void BackingWindow::dispose() { // deregister drag&drop helper if (mxDropTargetListener.is()) @@ -212,6 +217,7 @@ BackingWindow::~BackingWindow() } mxDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >(); } + vcl::Window::dispose(); } void BackingWindow::initControls() diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index aa6e498a281d..023e1cb7e88b 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -125,6 +125,7 @@ class BackingWindow public: BackingWindow( vcl::Window* pParent ); virtual ~BackingWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 566227863f72..0637d7d4a73b 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -163,15 +163,15 @@ SfxModalDialog::SfxModalDialog(vcl::Window *pParent, const OUString& rID, const } SfxModalDialog::~SfxModalDialog() +{ + dispose(); +} -/* [Description] - - Destructor; writes the Dialog position in the ini-file. -*/ - +void SfxModalDialog::dispose() { SetDialogData_Impl(); delete pOutputSet; + ModalDialog::dispose(); } void SfxModalDialog::CreateOutputItemSet( SfxItemPool& rPool ) @@ -355,16 +355,16 @@ bool SfxModelessDialog::Notify( NotifyEvent& rEvt ) SfxModelessDialog::~SfxModelessDialog() +{ + dispose(); +} -/* [Description] - - Destructor -*/ - +void SfxModelessDialog::dispose() { if ( pImp->pMgr->GetFrame().is() && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() ) pBindings->SetActiveFrame( NULL ); delete pImp; + ModelessDialog::dispose(); } @@ -505,16 +505,16 @@ bool SfxFloatingWindow::Close() SfxFloatingWindow::~SfxFloatingWindow() +{ + dispose(); +} -/* [Description] - - Destructor -*/ - +void SfxFloatingWindow::dispose() { if ( pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() ) pBindings->SetActiveFrame( NULL ); delete pImp; + FloatingWindow::dispose(); } @@ -701,10 +701,16 @@ SfxSingleTabDialog::SfxSingleTabDialog(vcl::Window* pParent, const SfxItemSet* p } SfxSingleTabDialog::~SfxSingleTabDialog() +{ + dispose(); +} + +void SfxSingleTabDialog::dispose() { delete pImpl->m_pSfxPage; delete pImpl->m_pLine; delete pImpl; + SfxModalDialog::dispose(); } void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage, diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 4317295fd248..03b9028ea4ba 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1182,16 +1182,29 @@ void SfxDocumentInfoDialog::AddFontTabPage() CustomPropertiesYesNoButton::CustomPropertiesYesNoButton( vcl::Window* pParent, const ResId& rResId ) : Control( pParent, rResId ), - m_aYesButton( this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() ) ), - m_aNoButton ( this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() ) ) + m_aYesButton( new RadioButton(this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() )) ), + m_aNoButton ( new RadioButton(this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() )) ) { FreeResource(); Wallpaper aWall( Color( COL_TRANSPARENT ) ); SetBackground( aWall ); SetBorderStyle( WindowBorderStyle::MONO ); CheckNo(); - m_aYesButton.SetBackground( aWall ); - m_aNoButton.SetBackground( aWall ); + m_aYesButton->SetBackground( aWall ); + m_aNoButton->SetBackground( aWall ); +} + + +CustomPropertiesYesNoButton::~CustomPropertiesYesNoButton() +{ + dispose(); +} + +void CustomPropertiesYesNoButton::dispose() +{ + m_aYesButton.disposeAndClear(); + m_aNoButton.disposeAndClear(); + Control::dispose(); } class DurationDialog_Impl : public ModalDialog @@ -1259,10 +1272,6 @@ CustomPropertiesDurationField::CustomPropertiesDurationField(vcl::Window* pParen SetDuration( util::Duration(false, 0, 0, 0, 0, 0, 0, 0) ); } -CustomPropertiesDurationField::~CustomPropertiesDurationField() -{ -} - void CustomPropertiesDurationField::RequestHelp( const HelpEvent& rHEvt ) { if ( rHEvt.GetMode() & HelpEventMode::QUICK ) @@ -1299,15 +1308,11 @@ CustomPropertiesEditButton::CustomPropertiesEditButton(vcl::Window* pParent, Win SetClickHdl( LINK( this, CustomPropertiesEditButton, ClickHdl )); } -CustomPropertiesEditButton::~CustomPropertiesEditButton() -{ -} - IMPL_LINK_NOARG(CustomPropertiesEditButton, ClickHdl) { - boost::scoped_ptr pDurationDlg(new DurationDialog_Impl( this, m_pLine->m_aDurationField.GetDuration() )); + boost::scoped_ptr pDurationDlg(new DurationDialog_Impl( this, m_pLine->m_aDurationField->GetDuration() )); if ( RET_OK == pDurationDlg->Execute() ) - m_pLine->m_aDurationField.SetDuration( pDurationDlg->GetDuration() ); + m_pLine->m_aDurationField->SetDuration( pDurationDlg->GetDuration() ); return 1; } @@ -1316,54 +1321,54 @@ void CustomPropertiesYesNoButton::Resize() const long nWidth = GetSizePixel().Width(); const long n3Width = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ).Width(); const long nNewWidth = ( nWidth / 2 ) - n3Width - 2; - Size aSize = m_aYesButton.GetSizePixel(); + Size aSize = m_aYesButton->GetSizePixel(); const long nDelta = aSize.Width() - nNewWidth; aSize.Width() = nNewWidth; - m_aYesButton.SetSizePixel( aSize ); - Point aPos = m_aNoButton.GetPosPixel(); + m_aYesButton->SetSizePixel( aSize ); + Point aPos = m_aNoButton->GetPosPixel(); aPos.X() -= nDelta; - m_aNoButton.SetPosSizePixel( aPos, aSize ); + m_aNoButton->SetPosSizePixel( aPos, aSize ); } // struct CustomPropertyLine --------------------------------------------- CustomPropertyLine::CustomPropertyLine( vcl::Window* pParent ) : - m_aNameBox ( pParent, SfxResId( SFX_CB_PROPERTY_NAME ) ), - m_aTypeBox ( pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this ), - m_aValueEdit ( pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ), - m_aDateField ( pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ), - m_aTimeField ( pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ), + m_aNameBox ( new ComboBox(pParent, SfxResId( SFX_CB_PROPERTY_NAME )) ), + m_aTypeBox ( new CustomPropertiesTypeBox(pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this) ), + m_aValueEdit ( new CustomPropertiesEdit(pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ) ), + m_aDateField ( new CustomPropertiesDateField(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ), + m_aTimeField ( new CustomPropertiesTimeField(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ), m_sDurationFormat( SfxResId( SFX_ST_DURATION_FORMAT ).toString() ), - m_aDurationField( pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ), - m_aEditButton ( pParent, WB_TABSTOP, this ), - m_aYesNoButton ( pParent, SfxResId( SFX_WIN_PROPERTY_YESNO ) ), - m_aRemoveButton ( pParent, 0, this ), + m_aDurationField( new CustomPropertiesDurationField(pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ) ), + m_aEditButton ( new CustomPropertiesEditButton(pParent, WB_TABSTOP, this) ), + m_aYesNoButton ( new CustomPropertiesYesNoButton(pParent, SfxResId( SFX_WIN_PROPERTY_YESNO )) ), + m_aRemoveButton ( new CustomPropertiesRemoveButton(pParent, 0, this) ), m_bIsDate ( false ), m_bIsRemoved ( false ), m_bTypeLostFocus( false ) { - m_aTimeField.SetExtFormat( EXTTIMEF_24H_LONG ); - m_aDateField.SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY ); + m_aTimeField->SetExtFormat( EXTTIMEF_24H_LONG ); + m_aDateField->SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY ); - m_aRemoveButton.SetModeImage(Image(SfxResId(SFX_IMG_PROPERTY_REMOVE))); - m_aRemoveButton.SetQuickHelpText(SfxResId(STR_SFX_REMOVE_PROPERTY).toString()); + m_aRemoveButton->SetModeImage(Image(SfxResId(SFX_IMG_PROPERTY_REMOVE))); + m_aRemoveButton->SetQuickHelpText(SfxResId(STR_SFX_REMOVE_PROPERTY).toString()); - m_aEditButton.SetText(SfxResId(SFX_ST_EDIT).toString()); + m_aEditButton->SetText(SfxResId(SFX_ST_EDIT).toString()); } void CustomPropertyLine::SetRemoved() { DBG_ASSERT( !m_bIsRemoved, "CustomPropertyLine::SetRemoved(): line already removed" ); m_bIsRemoved = true; - m_aNameBox.Hide(); - m_aTypeBox.Hide(); - m_aValueEdit.Hide(); - m_aDateField.Hide(); - m_aTimeField.Hide(); - m_aDurationField.Hide(); - m_aEditButton.Hide(); - m_aYesNoButton.Hide(); - m_aRemoveButton.Hide(); + m_aNameBox->Hide(); + m_aTypeBox->Hide(); + m_aValueEdit->Hide(); + m_aDateField->Hide(); + m_aTimeField->Hide(); + m_aDurationField->Hide(); + m_aEditButton->Hide(); + m_aYesNoButton->Hide(); + m_aRemoveButton->Hide(); } CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent, @@ -1374,15 +1379,15 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent, m_pHeaderAccName(pHeaderAccName), m_pHeaderAccType(pHeaderAccType), m_pHeaderAccValue(pHeaderAccValue), - m_aNameBox ( this, SfxResId( SFX_CB_PROPERTY_NAME ) ), - m_aTypeBox ( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ), - m_aValueEdit ( this, WB_BORDER|WB_TABSTOP|WB_LEFT ), - m_aDateField ( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ), - m_aTimeField ( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ), - m_aDurationField( this, WB_BORDER|WB_TABSTOP|WB_READONLY ), - m_aEditButton( this, WB_TABSTOP ), - m_aYesNoButton ( this, SfxResId( SFX_WIN_PROPERTY_YESNO ) ), - m_aRemoveButton ( this, 0 ), + m_aNameBox ( new ComboBox( this, SfxResId( SFX_CB_PROPERTY_NAME ) ) ), + m_aTypeBox ( new ListBox( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ) ), + m_aValueEdit ( new Edit( this, WB_BORDER|WB_TABSTOP|WB_LEFT ) ), + m_aDateField ( new DateField( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ), + m_aTimeField ( new TimeField( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ), + m_aDurationField( new Edit( this, WB_BORDER|WB_TABSTOP|WB_READONLY ), + m_aEditButton ( new PushButton( this, WB_TABSTOP ) ), + m_aYesNoButton ( new CustomPropertiesYesNoButton( this, SfxResId( SFX_WIN_PROPERTY_YESNO )) ), + m_aRemoveButton ( new ImageButton( this, 0 ), m_nScrollPos (0), m_pCurrentLine (NULL), m_aNumberFormatter( ::comphelper::getProcessComponentContext(), @@ -1403,57 +1408,72 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent, m_aBoxLoseFocusIdle.SetPriority( SchedulerPriority::LOWEST ); m_aBoxLoseFocusIdle.SetIdleHdl( LINK( this, CustomPropertiesWindow, BoxTimeoutHdl ) ); - m_aNameBox.add_mnemonic_label(m_pHeaderAccName); - m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText()); - m_aTypeBox.add_mnemonic_label(m_pHeaderAccType); - m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText()); - m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue); - m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText()); - - m_aNameBox.Hide(); - m_aTypeBox.Hide(); - m_aValueEdit.Hide(); - m_aDateField.Hide(); - m_aTimeField.Hide(); - m_aDurationField.Hide(); - m_aEditButton.Hide(); - m_aYesNoButton.Hide(); - m_aRemoveButton.Hide(); + m_aNameBox->add_mnemonic_label(m_pHeaderAccName); + m_aNameBox->SetAccessibleName(m_pHeaderAccName->GetText()); + m_aTypeBox->add_mnemonic_label(m_pHeaderAccType); + m_aTypeBox->SetAccessibleName(m_pHeaderAccType->GetText()); + m_aValueEdit->add_mnemonic_label(m_pHeaderAccValue); + m_aValueEdit->SetAccessibleName(m_pHeaderAccValue->GetText()); + + m_aNameBox->Hide(); + m_aTypeBox->Hide(); + m_aValueEdit->Hide(); + m_aDateField->Hide(); + m_aTimeField->Hide(); + m_aDurationField->Hide(); + m_aEditButton->Hide(); + m_aYesNoButton->Hide(); + m_aRemoveButton->Hide(); m_nLineHeight = - ( m_aRemoveButton.GetPosPixel().Y() * 2 ) + m_aRemoveButton.GetSizePixel().Height(); + ( m_aRemoveButton->GetPosPixel().Y() * 2 ) + m_aRemoveButton->GetSizePixel().Height(); } CustomPropertiesWindow::~CustomPropertiesWindow() +{ + dispose(); +} + +void CustomPropertiesWindow::dispose() { m_aEditLoseFocusIdle.Stop(); m_aBoxLoseFocusIdle.Stop(); ClearAllLines(); + m_aNameBox.disposeAndClear(); + m_aTypeBox.disposeAndClear(); + m_aValueEdit.disposeAndClear(); + m_aDateField.disposeAndClear(); + m_aTimeField.disposeAndClear(); + m_aDurationField.disposeAndClear(); + m_aEditButton.disposeAndClear(); + m_aYesNoButton.disposeAndClear(); + m_aRemoveButton.disposeAndClear(); + vcl::Window::dispose(); } IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox ) { long nType = reinterpret_cast( pBox->GetSelectEntryData() ); CustomPropertyLine* pLine = pBox->GetLine(); - pLine->m_aValueEdit.Show( (CUSTOM_TYPE_TEXT == nType) || (CUSTOM_TYPE_NUMBER == nType) ); - pLine->m_aDateField.Show( (CUSTOM_TYPE_DATE == nType) || (CUSTOM_TYPE_DATETIME == nType) ); - pLine->m_aTimeField.Show( CUSTOM_TYPE_DATETIME == nType ); - pLine->m_aDurationField.Show( CUSTOM_TYPE_DURATION == nType ); - pLine->m_aEditButton.Show( CUSTOM_TYPE_DURATION == nType ); - pLine->m_aYesNoButton.Show( CUSTOM_TYPE_BOOLEAN == nType ); + pLine->m_aValueEdit->Show( (CUSTOM_TYPE_TEXT == nType) || (CUSTOM_TYPE_NUMBER == nType) ); + pLine->m_aDateField->Show( (CUSTOM_TYPE_DATE == nType) || (CUSTOM_TYPE_DATETIME == nType) ); + pLine->m_aTimeField->Show( CUSTOM_TYPE_DATETIME == nType ); + pLine->m_aDurationField->Show( CUSTOM_TYPE_DURATION == nType ); + pLine->m_aEditButton->Show( CUSTOM_TYPE_DURATION == nType ); + pLine->m_aYesNoButton->Show( CUSTOM_TYPE_BOOLEAN == nType ); //adjust positions of date and time controls if ( nType == CUSTOM_TYPE_DATE ) { pLine->m_bIsDate = true; - pLine->m_aDateField.SetSizePixel( pLine->m_aValueEdit.GetSizePixel() ); + pLine->m_aDateField->SetSizePixel( pLine->m_aValueEdit->GetSizePixel() ); } else if ( nType == CUSTOM_TYPE_DATETIME) { // because m_aDateField and m_aTimeField have the same size for type "DateTime", // we just rely on m_aTimeField here. pLine->m_bIsDate = false; - pLine->m_aDateField.SetSizePixel( pLine->m_aTimeField.GetSizePixel() ); + pLine->m_aDateField->SetSizePixel( pLine->m_aTimeField->GetSizePixel() ); } return 0; @@ -1476,10 +1496,10 @@ IMPL_LINK( CustomPropertiesWindow, RemoveHdl, CustomPropertiesRemoveButton*, pBu if ( pLine->m_bIsRemoved ) continue; - vcl::Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, - &pLine->m_aDateField, &pLine->m_aTimeField, - &pLine->m_aDurationField, &pLine->m_aEditButton, - &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL }; + vcl::Window* pWindows[] = { pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(), + pLine->m_aDateField.get(), pLine->m_aTimeField.get(), + pLine->m_aDurationField.get(), pLine->m_aEditButton.get(), + pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), NULL }; vcl::Window** pCurrent = pWindows; while ( *pCurrent ) { @@ -1539,8 +1559,8 @@ bool CustomPropertiesWindow::IsLineValid( CustomPropertyLine* pLine ) const bool bIsValid = true; pLine->m_bTypeLostFocus = false; long nType = reinterpret_cast( - pLine->m_aTypeBox.GetSelectEntryData() ); - OUString sValue = pLine->m_aValueEdit.GetText(); + pLine->m_aTypeBox->GetSelectEntryData() ); + OUString sValue = pLine->m_aValueEdit->GetText(); if ( sValue.isEmpty() ) return true; @@ -1574,9 +1594,9 @@ void CustomPropertiesWindow::ValidateLine( CustomPropertyLine* pLine, bool bIsFr pLine->m_bTypeLostFocus = true; vcl::Window* pParent = GetParent()->GetParent(); if (MessageDialog(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL).Execute() == RET_OK) - pLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast(CUSTOM_TYPE_TEXT) ) ); + pLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast(CUSTOM_TYPE_TEXT) ) ); else - pLine->m_aValueEdit.GrabFocus(); + pLine->m_aValueEdit->GrabFocus(); } } @@ -1589,8 +1609,8 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa const long nOffset = 4; const long nScrollBarWidth = pScrollBar->GetSizePixel().Width(); - const long nButtonWidth = m_aRemoveButton.GetSizePixel().Width() + nScrollBarWidth + nOffset; - long nTypeWidth = m_aTypeBox.CalcMinimumSize().Width() + ( 2 * nOffset ); + const long nButtonWidth = m_aRemoveButton->GetSizePixel().Width() + nScrollBarWidth + nOffset; + long nTypeWidth = m_aTypeBox->CalcMinimumSize().Width() + ( 2 * nOffset ); long nFullWidth = pHeaderBar->GetSizePixel().Width(); long nItemWidth = ( nFullWidth - nTypeWidth - nButtonWidth ) / 2; pHeaderBar->SetItemSize( HI_NAME, nItemWidth ); @@ -1598,7 +1618,7 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa pHeaderBar->SetItemSize( HI_VALUE, nItemWidth ); pHeaderBar->SetItemSize( HI_ACTION, nButtonWidth ); - vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit, &m_aRemoveButton, NULL }; + vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(), m_aRemoveButton.get(), NULL }; vcl::Window** pCurrent = pWindows; sal_uInt16 nPos = 0; while ( *pCurrent ) @@ -1609,7 +1629,7 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa Size aSize(aOrigSize); Point aPos(aOrigPos); long nWidth = aRect.GetWidth() - nOffset; - if ( *pCurrent == &m_aRemoveButton ) + if ( *pCurrent == m_aRemoveButton.get() ) nWidth -= pScrollBar->GetSizePixel().Width(); aSize.Width() = nWidth; aPos.X() = aRect.getX() + ( nOffset / 2 ); @@ -1620,23 +1640,23 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa bChanged = true; } - if ( *pCurrent == &m_aValueEdit ) + if ( *pCurrent == m_aValueEdit.get() ) { Point aDurationPos( aPos ); - m_aDurationField.SetPosPixel( aDurationPos ); + m_aDurationField->SetPosPixel( aDurationPos ); Size aDurationSize(aSize); - aDurationSize.Width() -= (m_aEditButton.GetSizePixel().Width() + 3 ); - m_aDurationField.SetSizePixel(aDurationSize); - aDurationPos.X() = aPos.X() - m_aEditButton.GetSizePixel().Width() + aSize.Width(); - m_aEditButton.SetPosPixel(aDurationPos); + aDurationSize.Width() -= (m_aEditButton->GetSizePixel().Width() + 3 ); + m_aDurationField->SetSizePixel(aDurationSize); + aDurationPos.X() = aPos.X() - m_aEditButton->GetSizePixel().Width() + aSize.Width(); + m_aEditButton->SetPosPixel(aDurationPos); - m_aYesNoButton.SetPosSizePixel( aPos, aSize ); + m_aYesNoButton->SetPosSizePixel( aPos, aSize ); aSize.Width() /= 2; aSize.Width() -= 2; - m_aDateField.SetPosSizePixel( aPos, aSize ); + m_aDateField->SetPosSizePixel( aPos, aSize ); aPos.X() += aSize.Width() + 4; - m_aTimeField.SetPosSizePixel( aPos, aSize ); + m_aTimeField->SetPosSizePixel( aPos, aSize ); } pCurrent++; @@ -1660,10 +1680,10 @@ sal_uInt16 CustomPropertiesWindow::GetVisibleLineCount() const void CustomPropertiesWindow::updateLineWidth() { - vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit, - &m_aDateField, &m_aTimeField, - &m_aDurationField, &m_aEditButton, - &m_aYesNoButton, &m_aRemoveButton, NULL }; + vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(), + m_aDateField.get(), m_aTimeField.get(), + m_aDurationField.get(), m_aEditButton.get(), + m_aYesNoButton.get(), m_aRemoveButton.get(), NULL }; for (std::vector< CustomPropertyLine* >::iterator aI = m_aCustomPropertiesLines.begin(), aEnd = m_aCustomPropertiesLines.end(); @@ -1672,10 +1692,10 @@ void CustomPropertiesWindow::updateLineWidth() CustomPropertyLine* pNewLine = *aI; vcl::Window* pNewWindows[] = - { &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit, - &pNewLine->m_aDateField, &pNewLine->m_aTimeField, - &pNewLine->m_aDurationField, &pNewLine->m_aEditButton, - &pNewLine->m_aYesNoButton, &pNewLine->m_aRemoveButton, NULL }; + { pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(), + pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(), + pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(), + pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), NULL }; vcl::Window** pCurrent = pWindows; vcl::Window** pNewCurrent = pNewWindows; @@ -1691,38 +1711,38 @@ void CustomPropertiesWindow::updateLineWidth() // if we have type "Date", we use the full width, not only the half if (pNewLine->m_bIsDate) - pNewLine->m_aDateField.SetSizePixel( pNewLine->m_aValueEdit.GetSizePixel() ); + pNewLine->m_aDateField->SetSizePixel( pNewLine->m_aValueEdit->GetSizePixel() ); } } void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny ) { CustomPropertyLine* pNewLine = new CustomPropertyLine( this ); - pNewLine->m_aTypeBox.SetSelectHdl( LINK( this, CustomPropertiesWindow, TypeHdl ) ); - pNewLine->m_aRemoveButton.SetClickHdl( LINK( this, CustomPropertiesWindow, RemoveHdl ) ); - pNewLine->m_aValueEdit.SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, EditLoseFocusHdl ) ); + pNewLine->m_aTypeBox->SetSelectHdl( LINK( this, CustomPropertiesWindow, TypeHdl ) ); + pNewLine->m_aRemoveButton->SetClickHdl( LINK( this, CustomPropertiesWindow, RemoveHdl ) ); + pNewLine->m_aValueEdit->SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, EditLoseFocusHdl ) ); //add lose focus handlers of date/time fields - pNewLine->m_aTypeBox.SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, BoxLoseFocusHdl ) ); + pNewLine->m_aTypeBox->SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, BoxLoseFocusHdl ) ); - pNewLine->m_aNameBox.add_mnemonic_label(m_pHeaderAccName); - pNewLine->m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText()); - pNewLine->m_aTypeBox.add_mnemonic_label(m_pHeaderAccType); - pNewLine->m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText()); - pNewLine->m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue); - pNewLine->m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText()); + pNewLine->m_aNameBox->add_mnemonic_label(m_pHeaderAccName); + pNewLine->m_aNameBox->SetAccessibleName(m_pHeaderAccName->GetText()); + pNewLine->m_aTypeBox->add_mnemonic_label(m_pHeaderAccType); + pNewLine->m_aTypeBox->SetAccessibleName(m_pHeaderAccType->GetText()); + pNewLine->m_aValueEdit->add_mnemonic_label(m_pHeaderAccValue); + pNewLine->m_aValueEdit->SetAccessibleName(m_pHeaderAccValue->GetText()); sal_Int32 nPos = GetVisibleLineCount() * GetLineHeight(); m_aCustomPropertiesLines.push_back( pNewLine ); - vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit, - &m_aDateField, &m_aTimeField, - &m_aDurationField, &m_aEditButton, - &m_aYesNoButton, &m_aRemoveButton, NULL }; + vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(), + m_aDateField.get(), m_aTimeField.get(), + m_aDurationField.get(), m_aEditButton.get(), + m_aYesNoButton.get(), m_aRemoveButton.get(), NULL }; vcl::Window* pNewWindows[] = - { &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit, - &pNewLine->m_aDateField, &pNewLine->m_aTimeField, - &pNewLine->m_aDurationField, &pNewLine->m_aEditButton, - &pNewLine->m_aYesNoButton, &pNewLine->m_aRemoveButton, NULL }; + { pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(), + pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(), + pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(), + pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), NULL }; vcl::Window** pCurrent = pWindows; vcl::Window** pNewCurrent = pNewWindows; while ( *pCurrent ) @@ -1747,7 +1767,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny ) util::Duration aTmpDuration; SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData(); - pNewLine->m_aNameBox.SetText( sName ); + pNewLine->m_aNameBox->SetText( sName ); sal_IntPtr nType = CUSTOM_TYPE_UNKNOWN; OUString sValue; @@ -1755,7 +1775,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny ) { sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM ); m_aNumberFormatter.GetInputLineString( nTmpValue, nIndex, sValue ); - pNewLine->m_aValueEdit.SetText( sValue ); + pNewLine->m_aValueEdit->SetText( sValue ); nType = CUSTOM_TYPE_NUMBER; } else if ( rAny >>= bTmpValue ) @@ -1765,41 +1785,41 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny ) } else if ( rAny >>= sTmpValue ) { - pNewLine->m_aValueEdit.SetText( sTmpValue ); + pNewLine->m_aValueEdit->SetText( sTmpValue ); nType = CUSTOM_TYPE_TEXT; } else if ( rAny >>= aTmpDate ) { - pNewLine->m_aDateField.SetDate( Date( aTmpDate ) ); + pNewLine->m_aDateField->SetDate( Date( aTmpDate ) ); nType = CUSTOM_TYPE_DATE; } else if ( rAny >>= aTmpDateTime ) { - pNewLine->m_aDateField.SetDate( Date( aTmpDateTime ) ); - pNewLine->m_aTimeField.SetTime( tools::Time( aTmpDateTime ) ); - pNewLine->m_aTimeField.m_isUTC = aTmpDateTime.IsUTC; + pNewLine->m_aDateField->SetDate( Date( aTmpDateTime ) ); + pNewLine->m_aTimeField->SetTime( tools::Time( aTmpDateTime ) ); + pNewLine->m_aTimeField->m_isUTC = aTmpDateTime.IsUTC; nType = CUSTOM_TYPE_DATETIME; } else if ( rAny >>= aTmpDateTZ ) { - pNewLine->m_aDateField.SetDate( Date( aTmpDateTZ.DateInTZ.Day, + pNewLine->m_aDateField->SetDate( Date( aTmpDateTZ.DateInTZ.Day, aTmpDateTZ.DateInTZ.Month, aTmpDateTZ.DateInTZ.Year ) ); - pNewLine->m_aDateField.m_TZ = aTmpDateTZ.Timezone; + pNewLine->m_aDateField->m_TZ = aTmpDateTZ.Timezone; nType = CUSTOM_TYPE_DATE; } else if ( rAny >>= aTmpDateTimeTZ ) { util::DateTime const& rDT(aTmpDateTimeTZ.DateTimeInTZ); - pNewLine->m_aDateField.SetDate( Date( rDT ) ); - pNewLine->m_aTimeField.SetTime( tools::Time( rDT ) ); - pNewLine->m_aTimeField.m_isUTC = rDT.IsUTC; - pNewLine->m_aDateField.m_TZ = aTmpDateTimeTZ.Timezone; + pNewLine->m_aDateField->SetDate( Date( rDT ) ); + pNewLine->m_aTimeField->SetTime( tools::Time( rDT ) ); + pNewLine->m_aTimeField->m_isUTC = rDT.IsUTC; + pNewLine->m_aDateField->m_TZ = aTmpDateTimeTZ.Timezone; nType = CUSTOM_TYPE_DATETIME; } else if ( rAny >>= aTmpDuration ) { nType = CUSTOM_TYPE_DURATION; - pNewLine->m_aDurationField.SetDuration( aTmpDuration ); + pNewLine->m_aDurationField->SetDuration( aTmpDuration ); } if ( nType != CUSTOM_TYPE_UNKNOWN ) @@ -1807,15 +1827,15 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny ) if ( CUSTOM_TYPE_BOOLEAN == nType ) { if ( bTmpValue ) - pNewLine->m_aYesNoButton.CheckYes(); + pNewLine->m_aYesNoButton->CheckYes(); else - pNewLine->m_aYesNoButton.CheckNo(); + pNewLine->m_aYesNoButton->CheckNo(); } - pNewLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast(nType) ) ); + pNewLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast(nType) ) ); } - TypeHdl( &pNewLine->m_aTypeBox ); - pNewLine->m_aNameBox.GrabFocus(); + TypeHdl( pNewLine->m_aTypeBox.get() ); + pNewLine->m_aNameBox->GrabFocus(); } bool CustomPropertiesWindow::AreAllLinesValid() const @@ -1861,8 +1881,8 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos ) if ( pLine->m_bIsRemoved ) continue; - vcl::Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, &pLine->m_aTimeField, - &pLine->m_aDurationField, &pLine->m_aEditButton, &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL }; + vcl::Window* pWindows[] = { pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(), pLine->m_aDateField.get(), pLine->m_aTimeField.get(), + pLine->m_aDurationField.get(), pLine->m_aEditButton.get(), pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), NULL }; vcl::Window** pCurrent = pWindows; while ( *pCurrent ) { @@ -1886,39 +1906,39 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c if ( pLine->m_bIsRemoved ) continue; - OUString sPropertyName = pLine->m_aNameBox.GetText(); + OUString sPropertyName = pLine->m_aNameBox->GetText(); if ( !sPropertyName.isEmpty() ) { aPropertiesSeq[i].Name = sPropertyName; long nType = reinterpret_cast( - pLine->m_aTypeBox.GetSelectEntryData() ); + pLine->m_aTypeBox->GetSelectEntryData() ); if ( CUSTOM_TYPE_NUMBER == nType ) { double nValue = 0; sal_uInt32 nIndex = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM ); bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ). - IsNumberFormat( pLine->m_aValueEdit.GetText(), nIndex, nValue ); + IsNumberFormat( pLine->m_aValueEdit->GetText(), nIndex, nValue ); if ( bIsNum ) aPropertiesSeq[i].Value <<= makeAny( nValue ); } else if ( CUSTOM_TYPE_BOOLEAN == nType ) { - bool bValue = pLine->m_aYesNoButton.IsYesChecked(); + bool bValue = pLine->m_aYesNoButton->IsYesChecked(); aPropertiesSeq[i].Value <<= makeAny( bValue ); } else if ( CUSTOM_TYPE_DATETIME == nType ) { - Date aTmpDate = pLine->m_aDateField.GetDate(); - tools::Time aTmpTime = pLine->m_aTimeField.GetTime(); + Date aTmpDate = pLine->m_aDateField->GetDate(); + tools::Time aTmpTime = pLine->m_aTimeField->GetTime(); util::DateTime const aDateTime(aTmpTime.GetNanoSec(), aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(), aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear(), - pLine->m_aTimeField.m_isUTC); - if (pLine->m_aDateField.m_TZ.is_initialized()) + pLine->m_aTimeField->m_isUTC); + if (pLine->m_aDateField->m_TZ.is_initialized()) { aPropertiesSeq[i].Value <<= util::DateTimeWithTimezone( - aDateTime, pLine->m_aDateField.m_TZ.get()); + aDateTime, pLine->m_aDateField->m_TZ.get()); } else { @@ -1927,13 +1947,13 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c } else if ( CUSTOM_TYPE_DATE == nType ) { - Date aTmpDate = pLine->m_aDateField.GetDate(); + Date aTmpDate = pLine->m_aDateField->GetDate(); util::Date const aDate(aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear()); - if (pLine->m_aDateField.m_TZ.is_initialized()) + if (pLine->m_aDateField->m_TZ.is_initialized()) { aPropertiesSeq[i].Value <<= util::DateWithTimezone( - aDate, pLine->m_aDateField.m_TZ.get()); + aDate, pLine->m_aDateField->m_TZ.get()); } else { @@ -1942,11 +1962,11 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c } else if ( CUSTOM_TYPE_DURATION == nType ) { - aPropertiesSeq[i].Value <<= pLine->m_aDurationField.GetDuration(); + aPropertiesSeq[i].Value <<= pLine->m_aDurationField->GetDuration(); } else { - OUString sValue( pLine->m_aValueEdit.GetText() ); + OUString sValue( pLine->m_aValueEdit->GetText() ); aPropertiesSeq[i].Value <<= makeAny( sValue ); } } @@ -2054,12 +2074,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeCustomPropertiesContro } CustomPropertiesControl::~CustomPropertiesControl() +{ + dispose(); +} + +void CustomPropertiesControl::dispose() { delete m_pVertScroll; delete m_pPropertiesWin; delete m_pBody; delete m_pHeaderBar; delete m_pVBox; + vcl::Window::dispose(); } IMPL_LINK( CustomPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar ) diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 7118b2824e74..06fe979d582e 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -71,8 +71,9 @@ public: vcl::Window* pParent , WinBits nBits); virtual ~SfxTitleDockingWindow(); + virtual void dispose() SAL_OVERRIDE; - vcl::Window* GetWrappedWindow() const { return m_pWrappedWindow; } + vcl::Window* GetWrappedWindow() const { return m_pWrappedWindow; } void SetWrappedWindow(vcl::Window* const pWindow); virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE; @@ -251,8 +252,14 @@ SfxTitleDockingWindow::SfxTitleDockingWindow( SfxBindings* pBind , } SfxTitleDockingWindow::~SfxTitleDockingWindow() +{ + dispose(); +} + +void SfxTitleDockingWindow::dispose() { delete m_pWrappedWindow; + SfxDockingWindow::dispose(); } void SfxTitleDockingWindow::SetWrappedWindow( vcl::Window* const pWindow ) @@ -1266,9 +1273,15 @@ void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const SfxDockingWindow::~SfxDockingWindow() +{ + dispose(); +} + +void SfxDockingWindow::dispose() { ReleaseChildWindow_Impl(); delete pImp; + DockingWindow::dispose(); } void SfxDockingWindow::ReleaseChildWindow_Impl() diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 6d3924ce5459..777b3fec6cc8 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -136,9 +136,6 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId, Resize(); } -SfxInfoBarWindow::~SfxInfoBarWindow() -{} - void SfxInfoBarWindow::addButton(PushButton* pButton) { pButton->SetParent(this); pButton->Show(); @@ -146,6 +143,25 @@ void SfxInfoBarWindow::addButton(PushButton* pButton) { Resize(); } +SfxInfoBarWindow::~SfxInfoBarWindow() +{ + dispose(); +} + +void SfxInfoBarWindow::dispose() +{ + delete m_pMessage; + delete m_pCloseBtn; + + for ( vector< PushButton* >::iterator it = m_aActionBtns.begin( ); + it != m_aActionBtns.end( ); ++it ) + { + delete *it; + } + m_aActionBtns.clear( ); + vcl::Window::dispose(); +} + void SfxInfoBarWindow::Paint(const Rectangle& rPaintRect) { const ViewInformation2D aNewViewInfos; @@ -233,6 +249,18 @@ SfxInfoBarContainerWindow::SfxInfoBarContainerWindow(SfxInfoBarContainerChild* p SfxInfoBarContainerWindow::~SfxInfoBarContainerWindow() { + dispose(); +} + +void SfxInfoBarContainerWindow::dispose() +{ + for ( vector< SfxInfoBarWindow* >::iterator it = m_pInfoBars.begin( ); + it != m_pInfoBars.end( ); ++it ) + { + delete *it; + } + m_pInfoBars.clear( ); + Window::dispose(); } SfxInfoBarWindow* SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, const OUString& sMessage) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index fc1d7dbb9246..91dbe4096b0d 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -249,19 +249,18 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx SfxManageStyleSheetPage::~SfxManageStyleSheetPage() +{ + dispose(); +} -/* [Description] - - Destructor, release of the data -*/ - +void SfxManageStyleSheetPage::dispose() { m_pNameRw->SetGetFocusHdl( Link() ); m_pNameRw->SetLoseFocusHdl( Link() ); delete pFamilies; pItem = 0; pStyle = 0; - + SfxTabPage::dispose(); } diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx index a2f43fb10ab3..b8ec5b1a83e5 100644 --- a/sfx2/source/dialog/newstyle.cxx +++ b/sfx2/source/dialog/newstyle.cxx @@ -41,7 +41,7 @@ IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl ) return 0; } - if ( RET_YES == aQueryOverwriteBox.Execute() ) + if ( RET_YES == aQueryOverwriteBox->Execute() ) EndDialog( RET_OK ); } else @@ -59,8 +59,8 @@ IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox ) SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rInPool ) : ModalDialog(pParent, "CreateStyleDialog", "sfx/ui/newstyle.ui") - , aQueryOverwriteBox(this, SfxResId(STR_QUERY_OVERWRITE), - VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO) + , aQueryOverwriteBox(new MessageDialog(this, SfxResId(STR_QUERY_OVERWRITE), + VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)) , rPool(rInPool) { get(m_pColBox, "stylename"); @@ -82,6 +82,13 @@ SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rIn SfxNewStyleDlg::~SfxNewStyleDlg() { + dispose(); +} + +void SfxNewStyleDlg::dispose() +{ + aQueryOverwriteBox.disposeAndClear(); + ModalDialog::dispose(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx index 0a168d8305b1..40fabdb1f624 100644 --- a/sfx2/source/dialog/partwnd.cxx +++ b/sfx2/source/dialog/partwnd.cxx @@ -140,12 +140,6 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl -SfxPartDockWnd_Impl::~SfxPartDockWnd_Impl() -{ -} - - - void SfxPartDockWnd_Impl::Resize() /* [Description] diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx index fbd63402f0d8..0daebad48a52 100644 --- a/sfx2/source/dialog/printopt.cxx +++ b/sfx2/source/dialog/printopt.cxx @@ -85,10 +85,6 @@ SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( vcl::Window* pParent m_pReduceBitmapsResolutionRB->SetToggleHdl( LINK( this, SfxCommonPrintOptionsTabPage, ToggleReduceBitmapsResolutionRBHdl ) ); } -SfxCommonPrintOptionsTabPage::~SfxCommonPrintOptionsTabPage() -{ -} - SfxTabPage* SfxCommonPrintOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { return( new SfxCommonPrintOptionsTabPage( pParent, *rAttrSet ) ); diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index d051bb3fa055..8760a0863d94 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -199,6 +199,11 @@ SfxRecordingFloat_Impl::SfxRecordingFloat_Impl( } SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl() +{ + dispose(); +} + +void SfxRecordingFloat_Impl::dispose() { try { @@ -211,6 +216,7 @@ SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl() catch ( uno::Exception& ) { } + SfxFloatingWindow::dispose(); } bool SfxRecordingFloat_Impl::Close() diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index b3fcb3dd50ca..2ddf168ad892 100644 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -433,10 +433,6 @@ SfxSecurityPage::SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& rItemS } -SfxSecurityPage::~SfxSecurityPage() -{ -} - bool SfxSecurityPage::FillItemSet( SfxItemSet * rItemSet ) { diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 250d6e56ad5f..036a578c166d 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -115,8 +115,11 @@ friend class SfxSplitWindow; } virtual ~SfxEmptySplitWin_Impl() + { dispose(); } + virtual void dispose() SAL_OVERRIDE { aTimer.Stop(); + SplitWindow::dispose(); } virtual void MouseMove( const MouseEvent& ) SAL_OVERRIDE; @@ -298,6 +301,11 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl, SfxSplitWindow::~SfxSplitWindow() +{ + dispose(); +} + +void SfxSplitWindow::dispose() { if ( !pWorkWin->GetParent_Impl() ) SaveConfig_Impl(); @@ -311,6 +319,7 @@ SfxSplitWindow::~SfxSplitWindow() } delete pDockArr; + SplitWindow::dispose(); } void SfxSplitWindow::SaveConfig_Impl() diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx index efc3c78009db..d933c0224f26 100644 --- a/sfx2/source/dialog/srchdlg.cxx +++ b/sfx2/source/dialog/srchdlg.cxx @@ -61,9 +61,15 @@ SearchDialog::SearchDialog(vcl::Window* pWindow, const OUString& rConfigName) } SearchDialog::~SearchDialog() +{ + dispose(); +} + +void SearchDialog::dispose() { SaveConfig(); m_aCloseHdl.Call( NULL ); + ModelessDialog::dispose(); } void SearchDialog::LoadConfig() diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx index dc0d5f00d774..5fc0c4c8d047 100644 --- a/sfx2/source/dialog/styledlg.cxx +++ b/sfx2/source/dialog/styledlg.cxx @@ -71,6 +71,9 @@ SfxStyleDialog::SfxStyleDialog SfxStyleDialog::~SfxStyleDialog() +{ + dispose(); +} /* [Description] @@ -78,9 +81,11 @@ SfxStyleDialog::~SfxStyleDialog() the Set from Style. */ +void SfxStyleDialog::dispose() { pExampleSet = 0; pStyle = 0; + SfxTabDialog::dispose(); } diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 55c0556231aa..1af64784fe14 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -171,12 +171,14 @@ SfxTabPage::SfxTabPage(vcl::Window *pParent, const OString& rID, const OUString& } SfxTabPage::~SfxTabPage() -/* [Description] +{ + dispose(); +} - Destructor -*/ +void SfxTabPage::dispose() { delete pImpl; + TabPage::dispose(); } bool SfxTabPage::FillItemSet( SfxItemSet* rSet ) @@ -362,6 +364,11 @@ SfxTabDialog::SfxTabDialog SfxTabDialog::~SfxTabDialog() +{ + dispose(); +} + +void SfxTabDialog::dispose() { SavePosAndId(); @@ -412,6 +419,7 @@ SfxTabDialog::~SfxTabDialog() delete m_pCancelBtn; if (m_bOwnsOKBtn) delete m_pOKBtn; + TabDialog::dispose(); } void SfxTabDialog::Init_Impl(bool bFmtFlag) diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index c5273b485fab..b092808feb93 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -202,13 +202,24 @@ namespace sfx2 TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, vcl::Window* i_pParent, WinBits i_nBits ) :TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) - ,m_aTaskPane( GetContentWindow(), lcl_getFrame( i_pBindings ) ) - ,m_aPaneController( m_aTaskPane, *this ) + ,m_aTaskPane( new ModuleTaskPane(GetContentWindow(), lcl_getFrame( i_pBindings )) ) + ,m_aPaneController( *m_aTaskPane.get(), *this ) { - m_aTaskPane.Show(); + m_aTaskPane->Show(); SetText( SfxResId( SID_TASKPANE ).toString() ); } + TaskPaneDockingWindow::~TaskPaneDockingWindow() + { + dispose(); + } + + void TaskPaneDockingWindow::dispose() + { + m_aTaskPane.disposeAndClear(); + TitledDockingWindow::dispose(); + } + void TaskPaneDockingWindow::ActivateToolPanel( const OUString& i_rPanelURL ) { @@ -219,13 +230,13 @@ namespace sfx2 void TaskPaneDockingWindow::GetFocus() { TitledDockingWindow::GetFocus(); - m_aTaskPane.GrabFocus(); + m_aTaskPane->GrabFocus(); } void TaskPaneDockingWindow::onLayoutDone() { - m_aTaskPane.SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() ); + m_aTaskPane->SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() ); } @@ -507,9 +518,9 @@ namespace sfx2 :m_rAntiImpl( i_rAntiImpl ) ,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) ) ,m_xFrame( i_rDocumentFrame ) - ,m_aPanelDeck( i_rAntiImpl ) + ,m_aPanelDeck( new ::svt::ToolPanelDeck(i_rAntiImpl) ) { - m_aPanelDeck.Show(); + m_aPanelDeck->Show(); OnResize(); impl_initFromConfiguration(); } @@ -523,7 +534,7 @@ namespace sfx2 static bool ModuleHasToolPanels( const OUString& i_rModuleIdentifier ); - ::svt::ToolPanelDeck& GetPanelDeck() { return m_aPanelDeck; } + ::svt::ToolPanelDeck& GetPanelDeck() { return *m_aPanelDeck.get(); } ::boost::optional< size_t > GetPanelPos( const OUString& i_rResourceURL ); @@ -540,28 +551,28 @@ namespace sfx2 DECL_LINK( OnActivatePanel, void* ); private: - ModuleTaskPane& m_rAntiImpl; - const OUString m_sModuleIdentifier; - const Reference< XFrame > m_xFrame; - ::svt::ToolPanelDeck m_aPanelDeck; + ModuleTaskPane& m_rAntiImpl; + const OUString m_sModuleIdentifier; + const Reference< XFrame > m_xFrame; + VclPtr<::svt::ToolPanelDeck> m_aPanelDeck; }; void ModuleTaskPane_Impl::OnResize() { - m_aPanelDeck.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); + m_aPanelDeck->SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); } void ModuleTaskPane_Impl::OnGetFocus() { - m_aPanelDeck.GrabFocus(); + m_aPanelDeck->GrabFocus(); } IMPL_LINK( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg ) { - m_aPanelDeck.ActivatePanel( reinterpret_cast< size_t >( i_pArg ) ); + m_aPanelDeck->ActivatePanel( reinterpret_cast< size_t >( i_pArg ) ); return 1L; } @@ -595,8 +606,8 @@ namespace sfx2 ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) ); - size_t nPanelPos = m_aPanelDeck.GetPanelCount(); - nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, nPanelPos ); + size_t nPanelPos = m_aPanelDeck->GetPanelCount(); + nPanelPos = m_aPanelDeck->InsertPanel( pCustomPanel, nPanelPos ); if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) ) sFirstVisiblePanelResource = *resource; @@ -637,9 +648,9 @@ namespace sfx2 ::boost::optional< size_t > ModuleTaskPane_Impl::GetPanelPos( const OUString& i_rResourceURL ) { ::boost::optional< size_t > aPanelPos; - for ( size_t i = 0; i < m_aPanelDeck.GetPanelCount(); ++i ) + for ( size_t i = 0; i < m_aPanelDeck->GetPanelCount(); ++i ) { - const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i ) ); + const ::svt::PToolPanel pPanel( m_aPanelDeck->GetPanel( i ) ); const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() ); if ( !pCustomPanel ) { @@ -656,21 +667,20 @@ namespace sfx2 return aPanelPos; } - void ModuleTaskPane_Impl::SetDrawersLayout() { - const ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() ); + const ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() ); const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() ); if ( pDrawerLayouter != NULL ) // already have the proper layout return; - m_aPanelDeck.SetLayouter( new ::svt::DrawerDeckLayouter( m_aPanelDeck, m_aPanelDeck ) ); + m_aPanelDeck->SetLayouter( new ::svt::DrawerDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get() ) ); } void ModuleTaskPane_Impl::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) { - ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() ); + ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() ); ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() ); if ( ( pTabLayouter != NULL ) && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) @@ -686,7 +696,7 @@ namespace sfx2 return; } - m_aPanelDeck.SetLayouter( new ::svt::TabDeckLayouter( m_aPanelDeck, m_aPanelDeck, i_eTabAlignment, i_eTabContent ) ); + m_aPanelDeck->SetLayouter( new ::svt::TabDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get(), i_eTabAlignment, i_eTabContent ) ); } @@ -700,11 +710,6 @@ namespace sfx2 } - ModuleTaskPane::~ModuleTaskPane() - { - } - - bool ModuleTaskPane::ModuleHasToolPanels( const Reference< XFrame >& i_rDocumentFrame ) { return ModuleTaskPane_Impl::ModuleHasToolPanels( lcl_identifyModule( i_rDocumentFrame ) ); diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx index 1f6f9935aaf8..a1779d6fefc9 100644 --- a/sfx2/source/dialog/templateinfodlg.cxx +++ b/sfx2/source/dialog/templateinfodlg.cxx @@ -53,8 +53,14 @@ SfxTemplateInfoDlg::SfxTemplateInfoDlg (vcl::Window *pParent) } SfxTemplateInfoDlg::~SfxTemplateInfoDlg() +{ + dispose(); +} + +void SfxTemplateInfoDlg::dispose() { m_xFrame->dispose(); + ModalDialog::dispose(); } void SfxTemplateInfoDlg::loadDocument(const OUString &rURL) diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index cc726c4d1cb9..c10a822af5e2 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -251,8 +251,15 @@ SfxTemplatePanelControl::SfxTemplatePanelControl(SfxBindings* pBindings, vcl::Wi SetStyle(GetStyle() & ~WB_DOCKABLE); } -SfxTemplatePanelControl::~SfxTemplatePanelControl (void) +SfxTemplatePanelControl::~SfxTemplatePanelControl() { + dispose(); +} + +void SfxTemplatePanelControl::dispose() +{ + pImpl.reset(); + DockingWindow::dispose(); } void SfxTemplatePanelControl::DataChanged( const DataChangedEvent& _rDCEvt ) @@ -539,8 +546,8 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl , xModuleManager(frame::ModuleManager::create(::comphelper::getProcessComponentContext())) , m_pDeletionWatcher(NULL) - , aFmtLb(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH) - , aFilterLb(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP) + , aFmtLb( new SfxActionListBox(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH) ), + , aFilterLb( new ListBox(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP) ), , nActFamily(0xffff) , nActFilter(0) @@ -564,13 +571,13 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl , m_bWantHierarchical(false) , bBindingUpdate(true) { - aFmtLb.SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString()); - aFmtLb.SetHelpId( HID_TEMPLATE_FMT ); - aFilterLb.SetHelpId( HID_TEMPLATE_FILTER ); - aFmtLb.SetStyle( aFmtLb.GetStyle() | WB_SORT | WB_HIDESELECTION ); - vcl::Font aFont = aFmtLb.GetFont(); + aFmtLb->SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString()); + aFmtLb->SetHelpId( HID_TEMPLATE_FMT ); + aFilterLb->SetHelpId( HID_TEMPLATE_FILTER ); + aFmtLb->SetStyle( aFmtLb->GetStyle() | WB_SORT | WB_HIDESELECTION ); + vcl::Font aFont = aFmtLb->GetFont(); aFont.SetWeight( WEIGHT_NORMAL ); - aFmtLb.SetFont( aFont ); + aFmtLb->SetFont( aFont ); memset(pBoundItems, 0, sizeof(pBoundItems)); memset(pFamilyState, 0, sizeof(pFamilyState)); @@ -732,15 +739,15 @@ void SfxCommonTemplateDialog_Impl::Initialize() Update_Impl(); - aFilterLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FilterSelectHdl ) ); - aFmtLb.SetDoubleClickHdl( LINK( this, SfxCommonTemplateDialog_Impl, ApplyHdl ) ); - aFmtLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FmtSelectHdl ) ); - aFmtLb.SetSelectionMode(MULTIPLE_SELECTION); + aFilterLb->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FilterSelectHdl ) ); + aFmtLb->SetDoubleClickHdl( LINK( this, SfxCommonTemplateDialog_Impl, ApplyHdl ) ); + aFmtLb->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FmtSelectHdl ) ); + aFmtLb->SetSelectionMode(MULTIPLE_SELECTION); - aFilterLb.Show(); + aFilterLb->Show(); if (!bHierarchical) - aFmtLb.Show(); + aFmtLb->Show(); } SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl() @@ -861,19 +868,19 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr) bool bSelect = ! rStr.isEmpty(); if ( bSelect ) { - SvTreeListEntry* pEntry = (SvTreeListEntry*)aFmtLb.FirstVisible(); - while ( pEntry && aFmtLb.GetEntryText( pEntry ) != rStr ) - pEntry = (SvTreeListEntry*)aFmtLb.NextVisible( pEntry ); + SvTreeListEntry* pEntry = (SvTreeListEntry*)aFmtLb->FirstVisible(); + while ( pEntry && aFmtLb->GetEntryText( pEntry ) != rStr ) + pEntry = (SvTreeListEntry*)aFmtLb->NextVisible( pEntry ); if ( !pEntry ) bSelect = false; else { - if (!aFmtLb.IsSelected(pEntry)) + if (!aFmtLb->IsSelected(pEntry)) { - aFmtLb.MakeVisible( pEntry ); - aFmtLb.SelectAll(false); - aFmtLb.Select( pEntry ); - bWaterDisabled = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? sal_False : sal_True; + aFmtLb->MakeVisible( pEntry ); + aFmtLb->SelectAll(false); + aFmtLb->Select( pEntry ); + bWaterDisabled = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? sal_False : sal_True; FmtSelectHdl( NULL ); } } @@ -881,7 +888,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr) if ( !bSelect ) { - aFmtLb.SelectAll( false ); + aFmtLb->SelectAll( false ); EnableEdit(false); EnableHide( false ); EnableShow( false ); @@ -900,9 +907,9 @@ OUString SfxCommonTemplateDialog_Impl::GetSelectedEntry() const } else { - SvTreeListEntry* pEntry = aFmtLb.FirstSelected(); + SvTreeListEntry* pEntry = aFmtLb->FirstSelected(); if ( pEntry ) - aRet = aFmtLb.GetEntryText( pEntry ); + aRet = aFmtLb->GetEntryText( pEntry ); } return aRet; } @@ -979,7 +986,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox() bool SfxCommonTemplateDialog_Impl::HasSelectedStyle() const { return pTreeBox? pTreeBox->FirstSelected() != 0: - aFmtLb.GetSelectionCount() != 0; + aFmtLb->GetSelectionCount() != 0; } // internal: Refresh the display @@ -1020,24 +1027,24 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) if((nFlags & UPDATE_FAMILY) == UPDATE_FAMILY) // Update view type list (Hierarchical, All, etc. { CheckItem(nActFamily, true); // check Button in Toolbox - aFilterLb.SetUpdateMode(false); - aFilterLb.Clear(); + aFilterLb->SetUpdateMode(false); + aFilterLb->Clear(); //insert hierarchical at the beginning - sal_uInt16 nPos = aFilterLb.InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0); - aFilterLb.SetEntryData( nPos, reinterpret_cast(SFXSTYLEBIT_ALL) ); + sal_uInt16 nPos = aFilterLb->InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0); + aFilterLb->SetEntryData( nPos, reinterpret_cast(SFXSTYLEBIT_ALL) ); const SfxStyleFilter& rFilter = pItem->GetFilterList(); for( size_t i = 0; i < rFilter.size(); ++i) { sal_uIntPtr nFilterFlags = rFilter[ i ]->nFlags; - nPos = aFilterLb.InsertEntry( rFilter[ i ]->aName ); - aFilterLb.SetEntryData( nPos, reinterpret_cast(nFilterFlags) ); + nPos = aFilterLb->InsertEntry( rFilter[ i ]->aName ); + aFilterLb->SetEntryData( nPos, reinterpret_cast(nFilterFlags) ); } - if(nActFilter < aFilterLb.GetEntryCount() - 1) - aFilterLb.SelectEntryPos(nActFilter + 1); + if(nActFilter < aFilterLb->GetEntryCount() - 1) + aFilterLb->SelectEntryPos(nActFilter + 1); else { nActFilter = 0; - aFilterLb.SelectEntryPos(1); + aFilterLb->SelectEntryPos(1); SfxFilterTupel* pActT = ( nActFilter < rFilter.size() ) ? rFilter[ nActFilter ] : NULL; sal_uInt16 nFilterFlags = pActT ? pActT->nFlags : 0; pStyleSheetPool->SetSearchMask(eFam, nFilterFlags); @@ -1046,22 +1053,22 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) // if the tree view again, select family hierarchy if (pTreeBox || m_bWantHierarchical) { - aFilterLb.SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString()); + aFilterLb->SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString()); EnableHierarchical(true); } // show maximum 14 entries - aFilterLb.SetDropDownLineCount( MAX_FILTER_ENTRIES ); - aFilterLb.SetUpdateMode(true); + aFilterLb->SetDropDownLineCount( MAX_FILTER_ENTRIES ); + aFilterLb->SetUpdateMode(true); } else { - if (nActFilter < aFilterLb.GetEntryCount() - 1) - aFilterLb.SelectEntryPos(nActFilter + 1); + if (nActFilter < aFilterLb->GetEntryCount() - 1) + aFilterLb->SelectEntryPos(nActFilter + 1); else { nActFilter = 0; - aFilterLb.SelectEntryPos(1); + aFilterLb->SelectEntryPos(1); } } @@ -1070,7 +1077,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) EnableItem(SID_STYLE_WATERCAN,false); SfxStyleSheetBase *pStyle = pStyleSheetPool->First(); - SvTreeListEntry* pEntry = aFmtLb.First(); + SvTreeListEntry* pEntry = aFmtLb->First(); std::vector aStrings; comphelper::string::NaturalStringSorter aSorter( @@ -1090,22 +1097,22 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) size_t nCount = aStrings.size(); size_t nPos = 0; while(nPos < nCount && pEntry && - aStrings[nPos] == aFmtLb.GetEntryText(pEntry)) + aStrings[nPos] == aFmtLb->GetEntryText(pEntry)) { ++nPos; - pEntry = aFmtLb.Next( pEntry ); + pEntry = aFmtLb->Next( pEntry ); } if( nPos < nCount || pEntry ) { // Fills the display box - aFmtLb.SetUpdateMode(false); - aFmtLb.Clear(); + aFmtLb->SetUpdateMode(false); + aFmtLb->Clear(); for(nPos = 0; nPos < nCount; ++nPos) - aFmtLb.InsertEntry(aStrings[nPos], 0, false, nPos); + aFmtLb->InsertEntry(aStrings[nPos], 0, false, nPos); - aFmtLb.SetUpdateMode(true); + aFmtLb->SetUpdateMode(true); } // Selects the current style if any SfxTemplateItem *pState = pFamilyState[nActFamily-1]; @@ -1132,7 +1139,7 @@ void SfxCommonTemplateDialog_Impl::SetWaterCanState(const SfxBoolItem *pItem) if(!bWaterDisabled) //make sure the watercan is only activated when there is (only) one selection - bWaterDisabled = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? sal_False : sal_True; + bWaterDisabled = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? sal_False : sal_True; if(pItem && !bWaterDisabled) { @@ -1467,7 +1474,7 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl( if ( !pItem || aDeleted ) return false; - if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ) + if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ) { const SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem); OSL_ENSURE(pFilterItem, "SfxUINT16Item expected"); @@ -1501,15 +1508,15 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable) m_bWantHierarchical = true; SaveSelection(); // fdo#61429 store "hierarchical" const OUString aSelectEntry( GetSelectedEntry()); - aFmtLb.Hide(); + aFmtLb->Hide(); pTreeBox = new StyleTreeListBox_Impl( this, WB_HASBUTTONS | WB_HASLINES | WB_BORDER | WB_TABSTOP | WB_HASLINESATROOT | WB_HASBUTTONSATROOT | WB_HIDESELECTION | WB_QUICK_SEARCH ); - pTreeBox->SetFont( aFmtLb.GetFont() ); + pTreeBox->SetFont( aFmtLb->GetFont() ); - pTreeBox->SetPosSizePixel(aFmtLb.GetPosPixel(), aFmtLb.GetSizePixel()); + pTreeBox->SetPosSizePixel(aFmtLb->GetPosPixel(), aFmtLb->GetSizePixel()); pTreeBox->SetNodeDefaultImages(); pTreeBox->SetSelectHdl( LINK(this, SfxCommonTemplateDialog_Impl, FmtSelectHdl)); @@ -1526,11 +1533,11 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable) else { DELETEZ(pTreeBox); - aFmtLb.Show(); + aFmtLb->Show(); // If bHierarchical, then the family can have changed // minus one since hierarchical is inserted at the start m_bWantHierarchical = false; // before FilterSelect - FilterSelect(aFilterLb.GetSelectEntryPos() - 1, bHierarchical ); + FilterSelect(aFilterLb->GetSelectEntryPos() - 1, bHierarchical ); bHierarchical=false; } } @@ -1717,7 +1724,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, DropHdl, StyleTreeListBox_Impl *, pBox void SfxCommonTemplateDialog_Impl::NewHdl(void *) { OUString aEmpty; - if ( nActFamily != 0xffff && (pTreeBox || aFmtLb.GetSelectionCount() <= 1)) + if ( nActFamily != 0xffff && (pTreeBox || aFmtLb->GetSelectionCount() <= 1)) { vcl::Window* pTmp; pTmp = Application::GetDefDialogParent(); @@ -1780,7 +1787,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) bool bUsedStyle = false; // one of the selected styles are used in the document? std::vector aList; - SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected(); + SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected(); const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl(); OUString aMsg = SfxResId(STR_DELETE_STYLE_USED).toString(); @@ -1790,7 +1797,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) { aList.push_back( pEntry ); // check the style is used or not - const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry)); + const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry)); SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( aTemplName, pItem->GetFamily(), SFXSTYLEBIT_ALL ); @@ -1802,7 +1809,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) bUsedStyle = true; } - pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry); + pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry); } bool aApproved = false; @@ -1827,7 +1834,8 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) for (; it != itEnd; ++it) { - const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb.GetEntryText(*it)); + const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb->GetEntryText(*it)); + PrepareDeleteAction(); bDontUpdate = true; // To prevent the Treelistbox to shut down while deleting Execute_Impl( SID_STYLE_DELETE, aTemplName, OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() ); @@ -1848,16 +1856,16 @@ void SfxCommonTemplateDialog_Impl::HideHdl(void *) { if ( IsInitialized() && HasSelectedStyle() ) { - SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected(); + SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected(); while (pEntry) { - OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry); + OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry); Execute_Impl( SID_STYLE_HIDE, aTemplName, OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() ); - pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry); + pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry); } } } @@ -1867,16 +1875,16 @@ void SfxCommonTemplateDialog_Impl::ShowHdl(void *) if ( IsInitialized() && HasSelectedStyle() ) { - SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected(); + SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected(); while (pEntry) { - OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry); + OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry); Execute_Impl( SID_STYLE_SHOW, aTemplName, OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() ); - pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry); + pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry); } } } @@ -1934,7 +1942,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, ApplyHdl, Control *, pControl ) if ( IsInitialized() && 0 != pFamilyState[nActFamily-1] && !GetSelectedEntry().isEmpty() ) { - sal_uInt16 nModifier = aFmtLb.GetModifier(); + sal_uInt16 nModifier = aFmtLb->GetModifier(); Execute_Impl(SID_STYLE_APPLY, GetSelectedEntry(), OUString(), ( sal_uInt16 )GetFamilyItem_Impl()->GetFamily(), @@ -1954,7 +1962,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox if ( IsInitialized() && IsCheckedItem(SID_STYLE_WATERCAN) && // only if that region is allowed - 0 != pFamilyState[nActFamily-1] && (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ) + 0 != pFamilyState[nActFamily-1] && (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ) { OUString aEmpty; Execute_Impl(SID_STYLE_WATERCAN, @@ -1970,7 +1978,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox { SelectStyle( pListBox->GetEntryText( pListBox->GetHdlEntry() )); #if defined STYLESPREVIEW - sal_uInt16 nModifier = aFmtLb.GetModifier(); + sal_uInt16 nModifier = aFmtLb->GetModifier(); if ( mbIgnoreSelect ) { Execute_Impl(SID_STYLE_END_PREVIEW, @@ -2025,10 +2033,10 @@ void SfxCommonTemplateDialog_Impl::EnableExample_Impl(sal_uInt16 nId, bool bEnab { if( nId == SID_STYLE_NEW_BY_EXAMPLE ) { - bNewByExampleDisabled = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? !bEnable : sal_True; + bNewByExampleDisabled = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? !bEnable : sal_True; } else if( nId == SID_STYLE_UPDATE_BY_EXAMPLE ) - bUpdateByExampleDisabled = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? !bEnable : sal_True; + bUpdateByExampleDisabled = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? !bEnable : sal_True; EnableItem(nId, bEnable); } @@ -2057,8 +2065,8 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl( : SfxCommonTemplateDialog_Impl( pB, pDlgWindow, true ), m_pFloat ( pDlgWindow ), m_bZoomIn ( false ), - m_aActionTbL ( pDlgWindow, this ), - m_aActionTbR ( pDlgWindow, SfxResId( TB_ACTION ) ) + m_aActionTbL ( new DropToolBox_Impl(pDlgWindow, this) ), + m_aActionTbR ( new ToolBox(pDlgWindow, SfxResId( TB_ACTION )) ) { pDlgWindow->FreeResource(); Initialize(); @@ -2068,20 +2076,20 @@ void SfxTemplateDialog_Impl::Initialize (void) { SfxCommonTemplateDialog_Impl::Initialize(); - m_aActionTbL.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect)); - m_aActionTbR.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect)); - m_aActionTbR.SetDropdownClickHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRClick)); - m_aActionTbL.Show(); - m_aActionTbR.Show(); - vcl::Font aFont = aFilterLb.GetFont(); + m_aActionTbL->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect)); + m_aActionTbR->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect)); + m_aActionTbR->SetDropdownClickHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRClick)); + m_aActionTbL->Show(); + m_aActionTbR->Show(); + vcl::Font aFont = aFilterLb->GetFont(); aFont.SetWeight( WEIGHT_NORMAL ); - aFilterLb.SetFont( aFont ); - m_aActionTbL.SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT ); + aFilterLb->SetFont( aFont ); + m_aActionTbL->SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT ); } void SfxTemplateDialog_Impl::EnableFamilyItem( sal_uInt16 nId, bool bEnable ) { - m_aActionTbL.EnableItem( nId, bEnable ); + m_aActionTbL->EnableItem( nId, bEnable ); } // Insert element into dropdown filter "Frame Styles", "List Styles", etc. @@ -2097,15 +2105,15 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId,const SfxStyleFamil case SFX_STYLE_FAMILY_PSEUDO: sHelpId = ".uno:ListStyle"; break; default: OSL_FAIL("unknown StyleFamily"); break; } - m_aActionTbL.InsertItem( nId, pItem->GetImage(), pItem->GetText(), ToolBoxItemBits::NONE, 0); - m_aActionTbL.SetHelpId( nId, sHelpId ); + m_aActionTbL->InsertItem( nId, pItem->GetImage(), pItem->GetText(), ToolBoxItemBits::NONE, 0); + m_aActionTbL->SetHelpId( nId, sHelpId ); } void SfxTemplateDialog_Impl::ReplaceUpdateButtonByMenu() { - m_aActionTbR.HideItem(SID_STYLE_UPDATE_BY_EXAMPLE); - m_aActionTbR.SetItemBits( SID_STYLE_NEW_BY_EXAMPLE, - ToolBoxItemBits::DROPDOWNONLY|m_aActionTbR.GetItemBits( SID_STYLE_NEW_BY_EXAMPLE )); + m_aActionTbR->HideItem(SID_STYLE_UPDATE_BY_EXAMPLE); + m_aActionTbR->SetItemBits( SID_STYLE_NEW_BY_EXAMPLE, + ToolBoxItemBits::DROPDOWNONLY|m_aActionTbR->GetItemBits( SID_STYLE_NEW_BY_EXAMPLE )); } void SfxTemplateDialog_Impl::updateFamilyImages() @@ -2123,18 +2131,18 @@ void SfxTemplateDialog_Impl::updateFamilyImages() { const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nLoop ); sal_uInt16 nId = SfxTemplate::SfxFamilyIdToNId( pItem->GetFamily() ); - m_aActionTbL.SetItemImage( nId, pItem->GetImage() ); + m_aActionTbL->SetItemImage( nId, pItem->GetImage() ); } } void SfxTemplateDialog_Impl::updateNonFamilyImages() { - m_aActionTbR.SetImageList( ImageList( SfxResId( DLG_STYLE_DESIGNER ) ) ); + m_aActionTbR->SetImageList( ImageList( SfxResId( DLG_STYLE_DESIGNER ) ) ); } void SfxTemplateDialog_Impl::ClearFamilyList() { - m_aActionTbL.Clear(); + m_aActionTbL->Clear(); } void SfxCommonTemplateDialog_Impl::InvalidateBindings() @@ -2177,27 +2185,27 @@ void SfxTemplateDialog_Impl::Resize() if (m_pFloat == NULL) return; Size aDlgSize=m_pFloat->PixelToLogic(m_pFloat->GetOutputSizePixel()); - Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel()); - Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel()); + Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL->CalcWindowSizePixel()); + Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR->CalcWindowSizePixel()); Size aMinSize = GetMinOutputSizePixel(); - long nListHeight = m_pFloat->PixelToLogic( aFilterLb.GetSizePixel() ).Height(); + long nListHeight = m_pFloat->PixelToLogic( aFilterLb->GetSizePixel() ).Height(); long nWidth = aDlgSize.Width()- 2 * SFX_TEMPLDLG_HFRAME; - m_aActionTbL.SetPosSizePixel(m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,SFX_TEMPLDLG_VTOPFRAME)), + m_aActionTbL->SetPosSizePixel(m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,SFX_TEMPLDLG_VTOPFRAME)), m_pFloat->LogicToPixel(aSizeATL)); // only change the position of the right toolbox, when the window is wide // enough Point aPosATR(aDlgSize.Width()-SFX_TEMPLDLG_HFRAME-aSizeATR.Width(),SFX_TEMPLDLG_VTOPFRAME); if(aDlgSize.Width() >= aMinSize.Width()) - m_aActionTbR.SetPosPixel(m_pFloat->LogicToPixel(aPosATR)); + m_aActionTbR->SetPosPixel(m_pFloat->LogicToPixel(aPosATR)); else - m_aActionTbR.SetPosPixel( m_pFloat->LogicToPixel( + m_aActionTbR->SetPosPixel( m_pFloat->LogicToPixel( Point( SFX_TEMPLDLG_HFRAME + aSizeATL.Width() + SFX_TEMPLDLG_MIDHSPACE, SFX_TEMPLDLG_VTOPFRAME ) ) ); - m_aActionTbR.SetSizePixel(m_pFloat->LogicToPixel(aSizeATR)); + m_aActionTbR->SetSizePixel(m_pFloat->LogicToPixel(aSizeATR)); Point aFilterPos( m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME, @@ -2218,16 +2226,16 @@ void SfxTemplateDialog_Impl::Resize() // only change the position of the listbox, when the window is high enough if(aDlgSize.Height() >= aMinSize.Height()) { - aFilterLb.SetPosPixel(aFilterPos); - aFmtLb.SetPosPixel( aFmtPos ); + aFilterLb->SetPosPixel(aFilterPos); + aFmtLb->SetPosPixel( aFmtPos ); if(pTreeBox) pTreeBox->SetPosPixel(aFmtPos); } else aFmtSize.Height() += aFilterSize.Height(); - aFilterLb.SetSizePixel(aFilterSize); - aFmtLb.SetSizePixel( aFmtSize ); + aFilterLb->SetSizePixel(aFilterSize); + aFmtLb->SetSizePixel( aFmtSize ); if(pTreeBox) pTreeBox->SetSizePixel(aFmtSize); } @@ -2236,8 +2244,8 @@ Size SfxTemplateDialog_Impl::GetMinOutputSizePixel() { if (m_pFloat != NULL) { - Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel()); - Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel()); + Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL->CalcWindowSizePixel()); + Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR->CalcWindowSizePixel()); Size aMinSize=Size( aSizeATL.Width()+aSizeATR.Width()+ 2*SFX_TEMPLDLG_HFRAME + SFX_TEMPLDLG_MIDHSPACE, @@ -2259,7 +2267,7 @@ void SfxTemplateDialog_Impl::EnableItem(sal_uInt16 nMesId, bool bCheck) //fall-through case SID_STYLE_NEW_BY_EXAMPLE: case SID_STYLE_UPDATE_BY_EXAMPLE: - m_aActionTbR.EnableItem(nMesId,bCheck); + m_aActionTbR->EnableItem(nMesId,bCheck); break; } } @@ -2270,10 +2278,10 @@ void SfxTemplateDialog_Impl::CheckItem(sal_uInt16 nMesId, bool bCheck) { case SID_STYLE_WATERCAN : bIsWater=bCheck; - m_aActionTbR.CheckItem(SID_STYLE_WATERCAN,bCheck); + m_aActionTbR->CheckItem(SID_STYLE_WATERCAN,bCheck); break; default: - m_aActionTbL.CheckItem(nMesId,bCheck); break; + m_aActionTbL->CheckItem(nMesId,bCheck); break; } } @@ -2282,9 +2290,9 @@ bool SfxTemplateDialog_Impl::IsCheckedItem(sal_uInt16 nMesId) switch(nMesId) { case SID_STYLE_WATERCAN : - return m_aActionTbR.GetItemState(SID_STYLE_WATERCAN)==TRISTATE_TRUE; + return m_aActionTbR->GetItemState(SID_STYLE_WATERCAN)==TRISTATE_TRUE; default: - return m_aActionTbL.GetItemState(nMesId)==TRISTATE_TRUE; + return m_aActionTbL->GetItemState(nMesId)==TRISTATE_TRUE; } } @@ -2413,7 +2421,7 @@ void SfxCommonTemplateDialog_Impl::UpdateFamily_Impl() } bWaterDisabled = false; - bCanNew = (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ? sal_True : sal_False; + bCanNew = (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ? sal_True : sal_False; bTreeDrag = true; bUpdateByExampleDisabled = false; @@ -2449,10 +2457,6 @@ DropToolBox_Impl::DropToolBox_Impl(vcl::Window* pParent, SfxTemplateDialog_Impl* { } -DropToolBox_Impl::~DropToolBox_Impl() -{ -} - sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt ) { sal_Int8 nReturn = DND_ACTION_NONE; @@ -2475,7 +2479,7 @@ sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt ) sal_Int8 DropToolBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt ) { - return rParent.aFmtLb.ExecuteDrop(rEvt); + return rParent.aFmtLb->ExecuteDrop(rEvt); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx index 66aa91b1f218..5f2a99ff6997 100644 --- a/sfx2/source/dialog/titledockwin.cxx +++ b/sfx2/source/dialog/titledockwin.cxx @@ -35,8 +35,8 @@ namespace sfx2 WinBits i_nStyle ) :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_nStyle ) ,m_sTitle() - ,m_aToolbox( this ) - ,m_aContentWindow( this, WB_DIALOGCONTROL ) + ,m_aToolbox( new ToolBox(this) ) + ,m_aContentWindow( new vcl::Window(this, WB_DIALOGCONTROL) ) ,m_aBorder( 3, 1, 3, 3 ) ,m_bLayoutPending( false ) ,m_nTitleBarHeight(0) @@ -48,19 +48,26 @@ namespace sfx2 { SetBackground( Wallpaper() ); - m_aToolbox.SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) ); - m_aToolbox.SetOutStyle( TOOLBOX_STYLE_FLAT ); - m_aToolbox.SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) ); - m_aToolbox.Show(); + m_aToolbox->SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) ); + m_aToolbox->SetOutStyle( TOOLBOX_STYLE_FLAT ); + m_aToolbox->SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) ); + m_aToolbox->Show(); impl_resetToolBox(); - m_aContentWindow.Show(); + m_aContentWindow->Show(); } TitledDockingWindow::~TitledDockingWindow() { + dispose(); } + void TitledDockingWindow::dispose() + { + m_aToolbox.disposeAndClear(); + m_aContentWindow.disposeAndClear(); + SfxDockingWindow::dispose(); + } void TitledDockingWindow::SetTitle( const OUString& i_rTitle ) { @@ -101,16 +108,16 @@ namespace sfx2 { m_bLayoutPending = false; - m_aToolbox.ShowItem( 1, !IsFloatingMode() ); + m_aToolbox->ShowItem( 1, !IsFloatingMode() ); - const Size aToolBoxSize( m_aToolbox.CalcWindowSizePixel() ); + const Size aToolBoxSize( m_aToolbox->CalcWindowSizePixel() ); Size aWindowSize( GetOutputSizePixel() ); // position the tool box m_nTitleBarHeight = GetSettings().GetStyleSettings().GetTitleHeight(); if ( aToolBoxSize.Height() > m_nTitleBarHeight ) m_nTitleBarHeight = aToolBoxSize.Height(); - m_aToolbox.SetPosSizePixel( + m_aToolbox->SetPosSizePixel( Point( aWindowSize.Width() - aToolBoxSize.Width(), ( m_nTitleBarHeight - aToolBoxSize.Height() ) / 2 @@ -122,7 +129,7 @@ namespace sfx2 if ( m_nTitleBarHeight < aToolBoxSize.Height() ) m_nTitleBarHeight = aToolBoxSize.Height(); aWindowSize.Height() -= m_nTitleBarHeight; - m_aContentWindow.SetPosSizePixel( + m_aContentWindow->SetPosSizePixel( Point( m_aBorder.Left(), m_nTitleBarHeight + m_aBorder.Top() ), Size( aWindowSize.Width() - m_aBorder.Left() - m_aBorder.Right(), @@ -209,24 +216,24 @@ namespace sfx2 void TitledDockingWindow::impl_resetToolBox() { - m_aToolbox.Clear(); + m_aToolbox->Clear(); // Get the closer bitmap and set it as right most button. Image aImage( SfxResId( SFX_IMG_CLOSE_DOC ) ); - m_aToolbox.InsertItem( 1, aImage ); - m_aToolbox.ShowItem( 1 ); + m_aToolbox->InsertItem( 1, aImage ); + m_aToolbox->ShowItem( 1 ); } sal_uInt16 TitledDockingWindow::impl_addDropDownToolBoxItem( const OUString& i_rItemText, const OString& i_nHelpId, const Link& i_rCallback ) { // Add the menu before the closer button. - const sal_uInt16 nItemCount( m_aToolbox.GetItemCount() ); + const sal_uInt16 nItemCount( m_aToolbox->GetItemCount() ); const sal_uInt16 nItemId( nItemCount + 1 ); - m_aToolbox.InsertItem( nItemId, i_rItemText, ToolBoxItemBits::DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND ); - m_aToolbox.SetHelpId( nItemId, i_nHelpId ); - m_aToolbox.SetClickHdl( i_rCallback ); - m_aToolbox.SetDropdownClickHdl( i_rCallback ); + m_aToolbox->InsertItem( nItemId, i_rItemText, ToolBoxItemBits::DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND ); + m_aToolbox->SetHelpId( nItemId, i_nHelpId ); + m_aToolbox->SetClickHdl( i_rCallback ); + m_aToolbox->SetDropdownClickHdl( i_rCallback ); // The tool box has likely changed its size. The title bar has to be // resized. diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index 403f581efd34..797c89342f28 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -328,9 +328,15 @@ void SfxVersionDialog::Init_Impl() } SfxVersionDialog::~SfxVersionDialog() +{ + dispose(); +} + +void SfxVersionDialog::dispose() { delete m_pTable; delete m_pVersionBox; + SfxModalDialog::dispose(); } void SfxVersionDialog::Open_Impl() @@ -556,9 +562,15 @@ SfxCmisVersionsDialog::SfxCmisVersionsDialog ( SfxViewFrame* pVwFrame, bool bIsS } SfxCmisVersionsDialog::~SfxCmisVersionsDialog() +{ + dispose(); +} + +void SfxCmisVersionsDialog::dispose() { delete m_pTable; delete m_pVersionBox; + SfxModalDialog::dispose(); } void SfxCmisVersionsDialog::LoadVersions() -- cgit