summaryrefslogtreecommitdiff
path: root/cui/source/customize/macropg.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-04-28 15:14:11 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-04-28 15:14:11 +0100
commitce82146a6be87b239a0bde0b59fddf8865290b99 (patch)
treebdce5bc3ccd342e87b8e7416cdf2b426d3b80ecf /cui/source/customize/macropg.cxx
parenta31991c4188e91326941fbe510ce70129d1ccde8 (diff)
parente8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (diff)
Merge remote-tracking branch 'origin/feature/vclptrmerge2'
Diffstat (limited to 'cui/source/customize/macropg.cxx')
-rw-r--r--cui/source/customize/macropg.cxx82
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 )
{