diff options
Diffstat (limited to 'cui/source/customize/macropg.cxx')
-rw-r--r-- | cui/source/customize/macropg.cxx | 82 |
1 files changed, 53 insertions, 29 deletions
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index dec5a9fb3e6b..fc5194af6567 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -83,32 +83,32 @@ static long nTabs[] = IMPL_LINK( MacroEventListBox, HeaderEndDrag_Impl, HeaderBar*, pBar ) { - DBG_ASSERT( pBar == &maHeaderBar, "*MacroEventListBox::HeaderEndDrag_Impl: something is wrong here..." ); + DBG_ASSERT( pBar == maHeaderBar.get(), "*MacroEventListBox::HeaderEndDrag_Impl: something is wrong here..." ); (void)pBar; - if( !maHeaderBar.GetCurItemId() ) + if( !maHeaderBar->GetCurItemId() ) return 0; - if( !maHeaderBar.IsItemMode() ) + if( !maHeaderBar->IsItemMode() ) { Size aSz; - sal_uInt16 _nTabs = maHeaderBar.GetItemCount(); - long nWidth = maHeaderBar.GetItemSize( ITEMID_EVENT ); - long nBarWidth = maHeaderBar.GetSizePixel().Width(); + sal_uInt16 _nTabs = maHeaderBar->GetItemCount(); + long nWidth = maHeaderBar->GetItemSize( ITEMID_EVENT ); + long nBarWidth = maHeaderBar->GetSizePixel().Width(); if( nWidth < TAB_WIDTH_MIN ) - maHeaderBar.SetItemSize( ITEMID_EVENT, TAB_WIDTH_MIN ); + maHeaderBar->SetItemSize( ITEMID_EVENT, TAB_WIDTH_MIN ); else if( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN ) - maHeaderBar.SetItemSize( ITEMID_EVENT, nBarWidth - TAB_WIDTH_MIN ); + maHeaderBar->SetItemSize( ITEMID_EVENT, nBarWidth - TAB_WIDTH_MIN ); { long nTmpSz = 0; for( sal_uInt16 i = 1 ; i < _nTabs ; ++i ) { - long _nWidth = maHeaderBar.GetItemSize( i ); + long _nWidth = maHeaderBar->GetItemSize( i ); aSz.Width() = _nWidth + nTmpSz; nTmpSz += _nWidth; - maListBox.SetTab( i, PixelToLogic( aSz, MapMode( MAP_APPFONT ) ).Width(), MAP_APPFONT ); + maListBox->SetTab( i, PixelToLogic( aSz, MapMode( MAP_APPFONT ) ).Width(), MAP_APPFONT ); } } } @@ -121,8 +121,8 @@ bool MacroEventListBox::Notify( NotifyEvent& rNEvt ) if( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS ) { - if ( rNEvt.GetWindow() != &maListBox ) - maListBox.GrabFocus(); + if ( rNEvt.GetWindow() != maListBox.get() ) + maListBox->GrabFocus(); } return nRet; @@ -130,13 +130,25 @@ bool MacroEventListBox::Notify( NotifyEvent& rNEvt ) MacroEventListBox::MacroEventListBox( vcl::Window* pParent, WinBits nStyle ) : Control( pParent, nStyle ) - , maHeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER ) - , maListBox( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ) + , maHeaderBar( VclPtr<HeaderBar>::Create( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER ) ) + , maListBox( VclPtr<SvHeaderTabListBox>::Create( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ) ) { - maListBox.SetHelpId( HID_MACRO_HEADERTABLISTBOX ); + maListBox->SetHelpId( HID_MACRO_HEADERTABLISTBOX ); // enable the cell focus to show visible focus - maListBox.EnableCellFocus(); + maListBox->EnableCellFocus(); +} + +MacroEventListBox::~MacroEventListBox() +{ + disposeOnce(); +} + +void MacroEventListBox::dispose() +{ + maHeaderBar.disposeAndClear(); + maListBox.disposeAndClear(); + Control::dispose(); } extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeMacroEventListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap) @@ -161,15 +173,15 @@ void MacroEventListBox::Resize() // calc pos and size of header bar Point aPnt( 0, 0 ); - Size aSize( maHeaderBar.CalcWindowSizePixel() ); + Size aSize( maHeaderBar->CalcWindowSizePixel() ); Size aCtrlSize( GetOutputSizePixel() ); aSize.Width() = aCtrlSize.Width(); - maHeaderBar.SetPosSizePixel( aPnt, aSize ); + maHeaderBar->SetPosSizePixel( aPnt, aSize ); // calc pos and size of ListBox aPnt.Y() += aSize.Height(); aSize.Height() = aCtrlSize.Height() - aSize.Height(); - maListBox.SetPosSizePixel( aPnt, aSize ); + maListBox->SetPosSizePixel( aPnt, aSize ); } void MacroEventListBox::ConnectElements() @@ -177,21 +189,21 @@ void MacroEventListBox::ConnectElements() Resize(); // set handler - maHeaderBar.SetEndDragHdl( LINK( this, MacroEventListBox, HeaderEndDrag_Impl ) ); + maHeaderBar->SetEndDragHdl( LINK( this, MacroEventListBox, HeaderEndDrag_Impl ) ); - maListBox.InitHeaderBar( &maHeaderBar ); + maListBox->InitHeaderBar( maHeaderBar.get() ); } void MacroEventListBox::Show( bool bVisible, sal_uInt16 nFlags ) { - maListBox.Show( bVisible, nFlags ); - maHeaderBar.Show( bVisible, nFlags ); + maListBox->Show( bVisible, nFlags ); + maHeaderBar->Show( bVisible, nFlags ); } void MacroEventListBox::Enable( bool bEnable, bool bChild ) { - maListBox.Enable( bEnable, bChild ); - maHeaderBar.Enable( bEnable, bChild ); + maListBox->Enable( bEnable, bChild ); + maHeaderBar->Enable( bEnable, bChild ); } // assign button ("Add Command") is enabled only if it is not read only @@ -226,7 +238,13 @@ _SvxMacroTabPage::_SvxMacroTabPage(vcl::Window* pParent, const OString& rID, _SvxMacroTabPage::~_SvxMacroTabPage() { + disposeOnce(); +} + +void _SvxMacroTabPage::dispose() +{ DELETEZ( mpImpl ); + SfxTabPage::dispose(); } void _SvxMacroTabPage::InitResources() @@ -640,7 +658,7 @@ long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* ) ) { - boost::scoped_ptr<AssignComponentDialog> pAssignDlg(new AssignComponentDialog( pThis, sEventURL )); + VclPtrInstance< AssignComponentDialog > pAssignDlg( pThis, sEventURL ); short ret = pAssignDlg->Execute(); if( ret ) @@ -654,7 +672,7 @@ long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* else if( bAssEnabled ) { // assign pressed - boost::scoped_ptr<SvxScriptSelectorDialog> pDlg(new SvxScriptSelectorDialog( pThis, false, pThis->GetFrame() )); + VclPtrInstance< SvxScriptSelectorDialog > pDlg( pThis, false, pThis->GetFrame() ); if( pDlg ) { short ret = pDlg->Execute(); @@ -836,7 +854,7 @@ SvxMacroAssignDlg::SvxMacroAssignDlg( vcl::Window* pParent, const Reference< fra const Reference< container::XNameReplace >& xNameReplace, sal_uInt16 nSelectedIndex ) : SvxMacroAssignSingleTabDialog(pParent, rSet) { - SetTabPage(new SvxMacroTabPage(get_content_area(), _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex)); + SetTabPage(VclPtr<SvxMacroTabPage>::Create(get_content_area(), _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex)); } @@ -872,9 +890,15 @@ AssignComponentDialog::AssignComponentDialog( vcl::Window * pParent, const OUStr AssignComponentDialog::~AssignComponentDialog() { + disposeOnce(); } - +void AssignComponentDialog::dispose() +{ + mpMethodEdit.clear(); + mpOKButton.clear(); + ModalDialog::dispose(); +} IMPL_LINK( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, pButton ) { |