summaryrefslogtreecommitdiff
path: root/cui/source/customize
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/customize')
-rw-r--r--cui/source/customize/acccfg.cxx31
-rw-r--r--cui/source/customize/cfg.cxx250
-rw-r--r--cui/source/customize/cfgutil.cxx13
-rw-r--r--cui/source/customize/eventdlg.cxx7
-rw-r--r--cui/source/customize/eventdlg.hxx3
-rw-r--r--cui/source/customize/macropg.cxx82
-rw-r--r--cui/source/customize/macropg_impl.hxx13
-rw-r--r--cui/source/customize/selector.cxx25
8 files changed, 312 insertions, 112 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 05aa1343d5c8..40360a67a398 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -672,6 +672,17 @@ void SfxAccCfgTabListBox_Impl::InitEntry(SvTreeListEntry* pEntry,
SvTabListBox::InitEntry(pEntry, rText, rImage1, rImage2, eButtonKind);
}
+SfxAccCfgTabListBox_Impl::~SfxAccCfgTabListBox_Impl()
+{
+ disposeOnce();
+}
+
+void SfxAccCfgTabListBox_Impl::dispose()
+{
+ m_pAccelConfigPage.clear();
+ SvTabListBox::dispose();
+}
+
/** select the entry, which match the current key input ... excepting
keys, which are used for the dialog itself.
*/
@@ -800,6 +811,11 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( vcl::Window* pParent, const
SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
{
+ disposeOnce();
+}
+
+void SfxAcceleratorConfigPage::dispose()
+{
// free memory - remove all dynamic user data
SvTreeListEntry* pEntry = m_pEntriesBox->First();
while (pEntry)
@@ -823,6 +839,21 @@ SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
m_pKeyBox->Clear();
delete m_pFileDlg;
+ m_pFileDlg = NULL;
+
+ m_pEntriesBox.clear();
+ m_pOfficeButton.clear();
+ m_pModuleButton.clear();
+ m_pChangeButton.clear();
+ m_pRemoveButton.clear();
+ m_pGroupLBox.clear();
+ m_pFunctionBox.clear();
+ m_pKeyBox.clear();
+ m_pLoadButton.clear();
+ m_pSaveButton.clear();
+ m_pResetButton.clear();
+
+ SfxTabPage::dispose();
}
void SfxAcceleratorConfigPage::InitAccCfg()
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index aa1cd010af66..96ed1acc96b5 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -735,24 +735,24 @@ ConvertToolbarEntry(
return aPropSeq;
}
-SfxTabPage *CreateSvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> CreateSvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
{
- return new SvxMenuConfigPage( pParent, *rSet );
+ return VclPtr<SvxMenuConfigPage>::Create( pParent, *rSet );
}
-SfxTabPage *CreateKeyboardConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> CreateKeyboardConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
{
- return new SfxAcceleratorConfigPage( pParent, *rSet );
+ return VclPtr<SfxAcceleratorConfigPage>::Create( pParent, *rSet );
}
-SfxTabPage *CreateSvxToolbarConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> CreateSvxToolbarConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
{
- return new SvxToolbarConfigPage( pParent, *rSet );
+ return VclPtr<SvxToolbarConfigPage>::Create( pParent, *rSet );
}
-SfxTabPage *CreateSvxEventConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> CreateSvxEventConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
{
- return new SvxEventConfigPage( pParent, *rSet, SvxEventConfigPage::EarlyInit() );
+ return VclPtr<SvxEventConfigPage>::Create( pParent, *rSet, SvxEventConfigPage::EarlyInit() );
}
namespace {
@@ -1397,7 +1397,13 @@ SvxMenuEntriesListBox::SvxMenuEntriesListBox(vcl::Window* pParent, SvxConfigPage
SvxMenuEntriesListBox::~SvxMenuEntriesListBox()
{
- // do nothing
+ disposeOnce();
+}
+
+void SvxMenuEntriesListBox::dispose()
+{
+ pPage.clear();
+ SvTreeListBox::dispose();
}
// drag and drop support
@@ -1547,6 +1553,32 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
m_pDescriptionField->EnableCursor( false );
}
+SvxConfigPage::~SvxConfigPage()
+{
+ disposeOnce();
+}
+
+void SvxConfigPage::dispose()
+{
+ m_pTopLevel.clear();
+ m_pTopLevelLabel.clear();
+ m_pTopLevelListBox.clear();
+ m_pNewTopLevelButton.clear();
+ m_pModifyTopLevelButton.clear();
+ m_pContents.clear();
+ m_pContentsLabel.clear();
+ m_pEntries.clear();
+ m_pContentsListBox.disposeAndClear();
+ m_pAddCommandsButton.clear();
+ m_pModifyCommandButton.clear();
+ m_pMoveUpButton.clear();
+ m_pMoveDownButton.clear();
+ m_pSaveInListBox.clear();
+ m_pDescriptionField.clear();
+ m_pSelectorDlg.disposeAndClear();
+ SfxTabPage::dispose();
+}
+
void SvxConfigPage::Reset( const SfxItemSet* )
{
// If we haven't initialised our XMultiServiceFactory reference
@@ -2174,7 +2206,7 @@ bool SvxConfigPage::MoveEntryData(
SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
: SvxConfigPage(pParent, rSet)
{
- m_pContentsListBox = new SvxMenuEntriesListBox(m_pEntries, this);
+ m_pContentsListBox = VclPtr<SvxMenuEntriesListBox>::Create(m_pEntries, this);
m_pContentsListBox->set_grid_left_attach(0);
m_pContentsListBox->set_grid_top_attach(0);
m_pContentsListBox->set_hexpand(true);
@@ -2211,6 +2243,11 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe
LINK( this, SvxMenuConfigPage, EntrySelectHdl ) );
}
+SvxMenuConfigPage::~SvxMenuConfigPage()
+{
+ disposeOnce();
+}
+
// Populates the Menu combo box
void SvxMenuConfigPage::Init()
{
@@ -2224,7 +2261,7 @@ void SvxMenuConfigPage::Init()
m_pTopLevelListBox->GetSelectHdl().Call(this);
}
-SvxMenuConfigPage::~SvxMenuConfigPage()
+void SvxMenuConfigPage::dispose()
{
for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
{
@@ -2233,9 +2270,11 @@ SvxMenuConfigPage::~SvxMenuConfigPage()
delete pData;
}
+ m_pSaveInListBox->Clear();
- delete m_pSelectorDlg;
- delete m_pContentsListBox;
+ m_pSelectorDlg.clear();
+ m_pContentsListBox.clear();
+ SvxConfigPage::dispose();
}
IMPL_LINK( SvxMenuConfigPage, SelectMenuEntry, Control *, pBox )
@@ -2354,9 +2393,9 @@ short SvxMenuConfigPage::QueryReset()
OUString label = replaceSaveInName( msg, saveInName );
- QueryBox qbox( this, WB_YES_NO, label );
+ ScopedVclPtrInstance<QueryBox> qbox( this, WB_YES_NO, label );
- return qbox.Execute();
+ return qbox->Execute();
}
IMPL_LINK( SvxMenuConfigPage, SelectMenu, ListBox *, pBox )
@@ -2404,7 +2443,7 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
OUString aNewName( stripHotKey( pMenuData->GetName() ) );
OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_MENU ) );
@@ -2421,8 +2460,8 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
- boost::scoped_ptr<SvxMainMenuOrganizerDialog> pDialog(
- new SvxMainMenuOrganizerDialog( this,
+ VclPtr<SvxMainMenuOrganizerDialog> pDialog(
+ VclPtr<SvxMainMenuOrganizerDialog>::Create( this,
GetSaveInData()->GetEntries(), pMenuData ));
if ( pDialog->Execute() == RET_OK )
@@ -2447,7 +2486,7 @@ IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton )
OUString aNewName;
OUString aDesc = CUI_RESSTR( RID_SVXSTR_SUBMENU_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_NAME_SUBMENU );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_ADD_SUBMENU ) );
@@ -2484,7 +2523,7 @@ IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton )
OUString aNewName( stripHotKey( pEntry->GetName() ) );
OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU_ITEM );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_MENU ) );
@@ -2524,9 +2563,8 @@ IMPL_LINK( SvxMenuConfigPage, NewMenuHdl, Button *, pButton )
{
(void)pButton;
- boost::scoped_ptr<SvxMainMenuOrganizerDialog> pDialog(
- new SvxMainMenuOrganizerDialog( 0,
- GetSaveInData()->GetEntries(), NULL, true ));
+ VclPtrInstance<SvxMainMenuOrganizerDialog> pDialog(
+ nullptr, GetSaveInData()->GetEntries(), nullptr, true );
if ( pDialog->Execute() == RET_OK )
{
@@ -2542,10 +2580,10 @@ IMPL_LINK( SvxMenuConfigPage, AddCommandsHdl, Button *, pButton )
{
(void)pButton;
- if ( m_pSelectorDlg == NULL )
+ if ( m_pSelectorDlg == nullptr )
{
// Create Script Selector which also shows builtin commands
- m_pSelectorDlg = new SvxScriptSelectorDialog( this, true, m_xFrame );
+ m_pSelectorDlg = VclPtr<SvxScriptSelectorDialog>::Create( this, true, m_xFrame );
m_pSelectorDlg->SetAddHdl(
LINK( this, SvxMenuConfigPage, AddFunctionHdl ) );
@@ -2655,6 +2693,21 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) );
}
+SvxMainMenuOrganizerDialog::~SvxMainMenuOrganizerDialog()
+{
+ disposeOnce();
+}
+
+void SvxMainMenuOrganizerDialog::dispose()
+{
+ m_pMenuBox.clear();
+ m_pMenuNameEdit.clear();
+ m_pMenuListBox.clear();
+ m_pMoveUpButton.clear();
+ m_pMoveDownButton.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
{
(void)pEdit;
@@ -2675,10 +2728,6 @@ IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
return 0;
}
-SvxMainMenuOrganizerDialog::~SvxMainMenuOrganizerDialog()
-{
-}
-
IMPL_LINK( SvxMainMenuOrganizerDialog, SelectHdl, Control*, pCtrl )
{
(void)pCtrl;
@@ -2838,7 +2887,7 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
{
SetHelpId( HID_SVX_CONFIG_TOOLBAR );
- m_pContentsListBox = new SvxToolbarEntriesListBox(m_pEntries, this);
+ m_pContentsListBox = VclPtr<SvxToolbarEntriesListBox>::Create(m_pEntries, this);
m_pContentsListBox->set_grid_left_attach(0);
m_pContentsListBox->set_grid_top_attach(0);
m_pContentsListBox->set_hexpand(true);
@@ -2916,6 +2965,11 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
SvxToolbarConfigPage::~SvxToolbarConfigPage()
{
+ disposeOnce();
+}
+
+void SvxToolbarConfigPage::dispose()
+{
for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
{
ToolbarSaveInData* pData =
@@ -2923,14 +2977,11 @@ SvxToolbarConfigPage::~SvxToolbarConfigPage()
delete pData;
}
+ m_pSaveInListBox->Clear();
- if ( m_pSelectorDlg != NULL )
- {
- delete m_pSelectorDlg;
- }
-
-
- delete m_pContentsListBox;
+ m_pSelectorDlg.disposeAndClear();
+ m_pContentsListBox.disposeAndClear();
+ SvxConfigPage::dispose();
}
void SvxToolbarConfigPage::DeleteSelectedTopLevel()
@@ -2993,10 +3044,10 @@ bool SvxToolbarConfigPage::DeleteSelectedContent()
if ( m_pContentsListBox->GetEntryCount() == 0 &&
GetTopLevelSelection()->IsDeletable() )
{
- MessageDialog qbox(this,
+ ScopedVclPtrInstance<MessageDialog> qbox(this,
CUI_RES(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( qbox.Execute() == RET_YES )
+ if ( qbox->Execute() == RET_YES )
{
DeleteSelectedTopLevel();
}
@@ -3051,7 +3102,7 @@ IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton )
OUString aNewName( stripHotKey( pToolbar->GetName() ) );
OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) );
@@ -3073,10 +3124,10 @@ IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton )
}
case ID_DEFAULT_STYLE:
{
- MessageDialog qbox(this,
+ ScopedVclPtrInstance<MessageDialog> qbox(this,
CUI_RES(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( qbox.Execute() == RET_YES )
+ if ( qbox->Execute() == RET_YES )
{
ToolbarSaveInData* pSaveInData_ =
static_cast<ToolbarSaveInData*>(GetSaveInData());
@@ -3137,7 +3188,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
OUString aNewName( stripHotKey( pEntry->GetName() ) );
OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) );
@@ -3267,8 +3318,8 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
}
}
- boost::scoped_ptr<SvxIconSelectorDialog> pIconDialog(
- new SvxIconSelectorDialog( 0,
+ VclPtr<SvxIconSelectorDialog> pIconDialog(
+ VclPtr<SvxIconSelectorDialog>::Create( nullptr,
GetSaveInData()->GetImageManager(),
GetSaveInData()->GetParentImageManager() ));
@@ -4304,9 +4355,9 @@ short SvxToolbarConfigPage::QueryReset()
OUString label = replaceSaveInName( msg, saveInName );
- QueryBox qbox( this, WB_YES_NO, label );
+ ScopedVclPtrInstance< QueryBox > qbox( this, WB_YES_NO, label );
- return qbox.Execute();
+ return qbox->Execute();
}
IMPL_LINK( SvxToolbarConfigPage, SelectToolbar, ListBox *, pBox )
@@ -4395,7 +4446,7 @@ IMPL_LINK( SvxToolbarConfigPage, NewToolbarHdl, Button *, pButton )
OUString aNewURL =
generateCustomURL( GetSaveInData()->GetEntries() );
- boost::scoped_ptr<SvxNewToolbarDialog> pNameDialog(new SvxNewToolbarDialog( 0, aNewName ));
+ VclPtrInstance< SvxNewToolbarDialog > pNameDialog( nullptr, aNewName );
sal_uInt16 nInsertPos;
for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
@@ -4450,10 +4501,10 @@ IMPL_LINK( SvxToolbarConfigPage, AddCommandsHdl, Button *, pButton )
{
(void)pButton;
- if ( m_pSelectorDlg == NULL )
+ if ( m_pSelectorDlg == nullptr )
{
// Create Script Selector which shows slot commands
- m_pSelectorDlg = new SvxScriptSelectorDialog( this, true, m_xFrame );
+ m_pSelectorDlg = VclPtr<SvxScriptSelectorDialog>::Create( this, true, m_xFrame );
// Position the Script Selector over the Add button so it is
// beside the menu contents list and does not obscure it
@@ -4522,7 +4573,16 @@ SvxToolbarEntriesListBox::SvxToolbarEntriesListBox(vcl::Window* pParent, SvxTool
SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox()
{
+ disposeOnce();
+}
+
+void SvxToolbarEntriesListBox::dispose()
+{
delete m_pButtonData;
+ m_pButtonData = NULL;
+
+ pPage.clear();
+ SvxMenuEntriesListBox::dispose();
}
void SvxToolbarEntriesListBox::BuildCheckBoxButtonImages( SvLBoxButtonData* pData )
@@ -4532,28 +4592,28 @@ void SvxToolbarEntriesListBox::BuildCheckBoxButtonImages( SvLBoxButtonData* pDat
// in all color modes, like high contrast.
const AllSettings& rSettings = Application::GetSettings();
- VirtualDevice aDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
Size aSize( 26, 20 );
- aDev.SetOutputSizePixel( aSize );
+ pVDev->SetOutputSizePixel( aSize );
- Image aImage = GetSizedImage( aDev, aSize,
+ Image aImage = GetSizedImage( *pVDev.get(), aSize,
CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT ));
// Fill button data struct with new images
pData->SetImage(SvBmp::UNCHECKED, aImage);
- pData->SetImage(SvBmp::CHECKED, GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED )) );
- pData->SetImage(SvBmp::HICHECKED, GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED )) );
- pData->SetImage(SvBmp::HIUNCHECKED, GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED)) );
- pData->SetImage(SvBmp::TRISTATE, GetSizedImage( aDev, aSize, Image() ) ); // Use tristate bitmaps to have no checkbox for separator entries
- pData->SetImage(SvBmp::HITRISTATE, GetSizedImage( aDev, aSize, Image() ) );
+ pData->SetImage(SvBmp::CHECKED, GetSizedImage( *pVDev.get(), aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED )) );
+ pData->SetImage(SvBmp::HICHECKED, GetSizedImage( *pVDev.get(), aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED )) );
+ pData->SetImage(SvBmp::HIUNCHECKED, GetSizedImage( *pVDev.get(), aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED)) );
+ pData->SetImage(SvBmp::TRISTATE, GetSizedImage( *pVDev.get(), aSize, Image() ) ); // Use tristate bitmaps to have no checkbox for separator entries
+ pData->SetImage(SvBmp::HITRISTATE, GetSizedImage( *pVDev.get(), aSize, Image() ) );
// Get image size
m_aCheckBoxImageSizePixel = aImage.GetSizePixel();
}
Image SvxToolbarEntriesListBox::GetSizedImage(
- VirtualDevice& aDev, const Size& aNewSize, const Image& aImage )
+ VirtualDevice& rVDev, const Size& aNewSize, const Image& aImage )
{
// Create new checkbox images for treelistbox. They must have a
// decent width to have a clear column for the visibility checkbox.
@@ -4567,18 +4627,18 @@ Image SvxToolbarEntriesListBox::GetSizedImage(
sal_uInt16 nPosX = std::max( (sal_uInt16) (((( aNewSize.Width() - 2 ) - aImage.GetSizePixel().Width() ) / 2 ) - 1), (sal_uInt16) 0 );
sal_uInt16 nPosY = std::max( (sal_uInt16) (((( aNewSize.Height() - 2 ) - aImage.GetSizePixel().Height() ) / 2 ) + 1), (sal_uInt16) 0 );
Point aPos( nPosX > 0 ? nPosX : 0, nPosY > 0 ? nPosY : 0 );
- aDev.SetFillColor( aFillColor );
- aDev.SetLineColor( aFillColor );
- aDev.DrawRect( Rectangle( Point(), aNewSize ));
- aDev.DrawImage( aPos, aImage );
+ rVDev.SetFillColor( aFillColor );
+ rVDev.SetLineColor( aFillColor );
+ rVDev.DrawRect( Rectangle( Point(), aNewSize ));
+ rVDev.DrawImage( aPos, aImage );
// Draw separator line 2 pixels left from the right border
Color aLineColor = GetDisplayBackground().GetColor().IsDark() ? Color( COL_WHITE ) : Color( COL_BLACK );
- aDev.SetLineColor( aLineColor );
- aDev.DrawLine( Point( aNewSize.Width()-3, 0 ), Point( aNewSize.Width()-3, aNewSize.Height()-1 ));
+ rVDev.SetLineColor( aLineColor );
+ rVDev.DrawLine( Point( aNewSize.Width()-3, 0 ), Point( aNewSize.Width()-3, aNewSize.Height()-1 ));
// Create new image that uses the fillcolor as transparent
- return Image( aDev.GetBitmap( Point(), aNewSize ), aFillColor );
+ return Image( rVDev.GetBitmap( Point(), aNewSize ), aFillColor );
}
void SvxToolbarEntriesListBox::DataChanged( const DataChangedEvent& rDCEvt )
@@ -4673,7 +4733,7 @@ TriState SvxToolbarEntriesListBox::NotifyCopying(
if ( !m_bIsInternalDrag )
{
// if the target is NULL then add function to the start of the list
- static_cast<SvxToolbarConfigPage*>(pPage)->AddFunction( pTarget, pTarget == NULL );
+ static_cast<SvxToolbarConfigPage*>(pPage.get())->AddFunction( pTarget, pTarget == NULL );
// Instant Apply changes to UI
SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection();
@@ -4705,6 +4765,20 @@ SvxNewToolbarDialog::SvxNewToolbarDialog(vcl::Window* pWindow, const OUString& r
m_pEdtName->SetModifyHdl(LINK(this, SvxNewToolbarDialog, ModifyHdl));
}
+SvxNewToolbarDialog::~SvxNewToolbarDialog()
+{
+ disposeOnce();
+}
+
+void SvxNewToolbarDialog::dispose()
+{
+ m_pEdtName.clear();
+ m_pBtnOK.clear();
+ m_pSaveInListBox.clear();
+ ModalDialog::dispose();
+}
+
+
IMPL_LINK(SvxNewToolbarDialog, ModifyHdl, Edit*, pEdit)
{
(void)pEdit;
@@ -4906,20 +4980,32 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
SvxIconSelectorDialog::~SvxIconSelectorDialog()
{
- sal_uInt16 nCount = pTbSymbol->GetItemCount();
+ disposeOnce();
+}
- for (sal_uInt16 n = 0; n < nCount; ++n )
+void SvxIconSelectorDialog::dispose()
+{
+ if (pTbSymbol)
{
- sal_uInt16 nId = pTbSymbol->GetItemId(n);
-
- uno::XInterface* xi = static_cast< uno::XInterface* >(
- pTbSymbol->GetItemData( nId ) );
+ sal_uInt16 nCount = pTbSymbol->GetItemCount();
- if ( xi != NULL )
+ for (sal_uInt16 n = 0; n < nCount; ++n )
{
+ sal_uInt16 nId = pTbSymbol->GetItemId(n);
+
+ uno::XInterface* xi = static_cast< uno::XInterface* >(
+ pTbSymbol->GetItemData( nId ) );
+
+ if ( xi != NULL )
xi->release();
}
}
+
+ pTbSymbol.clear();
+ pFtNote.clear();
+ pBtnImport.clear();
+ pBtnDelete.clear();
+ ModalDialog::dispose();
}
uno::Reference< graphic::XGraphic> SvxIconSelectorDialog::GetSelectedIcon()
@@ -5211,8 +5297,8 @@ void SvxIconSelectorDialog::ImportGraphics(
message += newLine;
}
- SvxIconChangeDialog aDialog(this, message);
- aDialog.Execute();
+ ScopedVclPtrInstance< SvxIconChangeDialog > aDialog(this, message);
+ aDialog->Execute();
}
}
@@ -5364,4 +5450,16 @@ SvxIconChangeDialog::SvxIconChangeDialog(
pLineEditDescription->SetText(aMessage);
}
+SvxIconChangeDialog::~SvxIconChangeDialog()
+{
+ disposeOnce();
+}
+
+void SvxIconChangeDialog::dispose()
+{
+ pFImageInfo.clear();
+ pLineEditDescription.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 53c954415098..875b71b57fe3 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -276,7 +276,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSfxConfigFunctionListB
SfxConfigFunctionListBox::~SfxConfigFunctionListBox()
{
+ disposeOnce();
+}
+
+void SfxConfigFunctionListBox::dispose()
+{
ClearAll();
+ SvTreeListBox::dispose();
}
void SfxConfigFunctionListBox::MouseMove( const MouseEvent& )
@@ -423,7 +429,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSfxConfigGroupListBox(
SfxConfigGroupListBox::~SfxConfigGroupListBox()
{
+ disposeOnce();
+}
+
+void SfxConfigGroupListBox::dispose()
+{
ClearAll();
+ pFunctionListBox.clear();
+ SvTreeListBox::dispose();
}
void SfxConfigGroupListBox::ClearAll()
diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx
index e466d526a747..20e00dedd7a1 100644
--- a/cui/source/customize/eventdlg.cxx
+++ b/cui/source/customize/eventdlg.cxx
@@ -103,6 +103,11 @@ void SvxEventConfigPage::LateInit( const uno::Reference< frame::XFrame >& _rxFra
SvxEventConfigPage::~SvxEventConfigPage()
{
+ disposeOnce();
+}
+
+void SvxEventConfigPage::dispose()
+{
// need to delete the user data
SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
SvTreeListEntry* pE = rListBox.GetEntry( 0 );
@@ -113,6 +118,8 @@ SvxEventConfigPage::~SvxEventConfigPage()
pE->SetUserData((void*)0);
pE = SvTreeListBox::NextSibling( pE );
}
+ m_pSaveInListBox.clear();
+ _SvxMacroTabPage::dispose();
}
void SvxEventConfigPage::ImplInitDocument()
diff --git a/cui/source/customize/eventdlg.hxx b/cui/source/customize/eventdlg.hxx
index 06d5433fa67b..385df86d1bbb 100644
--- a/cui/source/customize/eventdlg.hxx
+++ b/cui/source/customize/eventdlg.hxx
@@ -29,7 +29,7 @@
class SvxEventConfigPage : public _SvxMacroTabPage
{
- ListBox* m_pSaveInListBox;
+ VclPtr<ListBox> m_pSaveInListBox;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocumentEvents;
@@ -48,6 +48,7 @@ public:
struct EarlyInit { };
SvxEventConfigPage( vcl::Window *pParent, const SfxItemSet& rSet, EarlyInit );
virtual ~SvxEventConfigPage();
+ virtual void dispose() SAL_OVERRIDE;
void LateInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame );
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 )
{
diff --git a/cui/source/customize/macropg_impl.hxx b/cui/source/customize/macropg_impl.hxx
index dd7909275085..f80697fb5783 100644
--- a/cui/source/customize/macropg_impl.hxx
+++ b/cui/source/customize/macropg_impl.hxx
@@ -25,14 +25,14 @@ class _SvxMacroTabPage_Impl
public:
_SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet );
- PushButton* pAssignPB;
- PushButton* pAssignComponentPB;
- PushButton* pDeletePB;
+ VclPtr<PushButton> pAssignPB;
+ VclPtr<PushButton> pAssignComponentPB;
+ VclPtr<PushButton> pDeletePB;
Image aMacroImg;
Image aComponentImg;
OUString sStrEvent;
OUString sAssignedMacro;
- MacroEventListBox* pEventLB;
+ VclPtr<MacroEventListBox> pEventLB;
bool bReadOnly;
bool bIDEDialogMode;
};
@@ -40,8 +40,8 @@ public:
class AssignComponentDialog : public ModalDialog
{
private:
- Edit* mpMethodEdit;
- OKButton* mpOKButton;
+ VclPtr<Edit> mpMethodEdit;
+ VclPtr<OKButton> mpOKButton;
OUString maURL;
@@ -50,6 +50,7 @@ private:
public:
AssignComponentDialog( vcl::Window * pParent, const OUString& rURL );
virtual ~AssignComponentDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString getURL() const
{ return maURL; }
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
index ee962883068e..7477032f1567 100644
--- a/cui/source/customize/selector.cxx
+++ b/cui/source/customize/selector.cxx
@@ -99,7 +99,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxConfigFunctionListB
SvxConfigFunctionListBox::~SvxConfigFunctionListBox()
{
+ disposeOnce();
+}
+
+void SvxConfigFunctionListBox::dispose()
+{
ClearAll();
+ SvTreeListBox::dispose();
}
SvTreeListEntry* SvxConfigFunctionListBox::GetLastSelectedEntry()
@@ -227,7 +233,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxConfigGroupListBox(
SvxConfigGroupListBox::~SvxConfigGroupListBox()
{
+ disposeOnce();
+}
+
+void SvxConfigGroupListBox::dispose()
+{
ClearAll();
+ pFunctionListBox.clear();
+ SvTreeListBox::dispose();
}
void SvxConfigGroupListBox::ClearAll()
@@ -908,6 +921,18 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
{
+ disposeOnce();
+}
+
+void SvxScriptSelectorDialog::dispose()
+{
+ m_pDialogDescription.clear();
+ m_pCategories.clear();
+ m_pCommands.clear();
+ m_pOKButton.clear();
+ m_pCancelButton.clear();
+ m_pDescriptionText.clear();
+ ModelessDialog::dispose();
}
IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, Control*, pCtrl )