diff options
author | Noel Grandin <noel@peralex.com> | 2015-01-26 13:16:18 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-09 21:52:08 +0100 |
commit | e10b12842eb15b3b9bf577b4da036313fa830786 (patch) | |
tree | 20f22f1e6c950f9d4aff347be40f81d888ed0ad6 | |
parent | vcl: VclPtr conversion in reportdesign (diff) | |
download | core-e10b12842eb15b3b9bf577b4da036313fa830786.tar.gz core-e10b12842eb15b3b9bf577b4da036313fa830786.zip |
vcl: VclPtr conversion in sc
Change-Id: I9cbc8beff7172c1ec69ae1124b16de0c0d722334
Conflicts:
sc/source/ui/view/gridwin.cxx
sc/source/ui/view/tabview.cxx
90 files changed, 1599 insertions, 1070 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index a70b0697404c..a5b8c88ebc1f 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -173,9 +173,9 @@ static ScTextWndBase* lcl_chooseRuntimeImpl( vcl::Window* pParent, SfxBindings* ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : // With WB_CLIPCHILDREN otherwise we get flickering ToolBox ( pParent, WinBits(WB_CLIPCHILDREN) ), - aWndPos ( this ), - pRuntimeWindow ( lcl_chooseRuntimeImpl( this, pBind ) ), - aTextWindow ( *pRuntimeWindow ), + aWndPos ( new ScPosWnd(this) ), + pRuntimeWindow ( lcl_chooseRuntimeImpl( this, pBind ) ), + aTextWindow ( *pRuntimeWindow ), pInputHdl ( NULL ), aTextOk ( ScResId( SCSTR_QHELP_BTNOK ) ), // Not always new as a Resource aTextCancel ( ScResId( SCSTR_QHELP_BTNCANCEL ) ), @@ -202,7 +202,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : OSL_ENSURE( pViewSh, "no view shell for input window" ); // Position window, 3 buttons, input window - InsertWindow ( 1, &aWndPos, ToolBoxItemBits::NONE, 0 ); + InsertWindow ( 1, aWndPos.get(), ToolBoxItemBits::NONE, 0 ); InsertSeparator ( 1 ); InsertItem ( SID_INPUT_FUNCTION, IMAGE( SID_INPUT_FUNCTION ), ToolBoxItemBits::NONE, 2 ); InsertItem ( SID_INPUT_SUM, IMAGE( SID_INPUT_SUM ), ToolBoxItemBits::NONE, 3 ); @@ -210,8 +210,8 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : InsertSeparator ( 5 ); InsertWindow ( 7, &aTextWindow, ToolBoxItemBits::NONE, 6 ); - aWndPos .SetQuickHelpText( ScResId( SCSTR_QHELP_POSWND ) ); - aWndPos .SetHelpId ( HID_INSWIN_POS ); + aWndPos ->SetQuickHelpText( ScResId( SCSTR_QHELP_POSWND ) ); + aWndPos ->SetHelpId ( HID_INSWIN_POS ); aTextWindow.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); aTextWindow.SetHelpId ( HID_INSWIN_INPUT ); @@ -227,7 +227,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : SetHelpId( HID_SC_INPUTWIN ); // For the whole input row - aWndPos .Show(); + aWndPos ->Show(); aTextWindow.Show(); pInputHdl = SC_MOD()->GetInputHdl( pViewSh, false ); // use own handler even if ref-handler is set @@ -259,6 +259,11 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : ScInputWindow::~ScInputWindow() { + dispose(); +} + +void ScInputWindow::dispose() +{ bool bDown = ( ScGlobal::pSysLocale == NULL ); // after Clear? // if any view's input handler has a pointer to this input window, reset it @@ -282,6 +287,9 @@ ScInputWindow::~ScInputWindow() } SfxImageManager::GetImageManager( *SC_MOD() )->ReleaseToolBox( this ); + + aWndPos.disposeAndClear(); + ToolBox::dispose(); } void ScInputWindow::SetInputHandler( ScInputHandler* pNew ) @@ -630,7 +638,7 @@ void ScInputWindow::SetFuncString( const OUString& rString, bool bDoEdit ) void ScInputWindow::SetPosString( const OUString& rStr ) { - aWndPos.SetPos( rStr ); + aWndPos->SetPos( rStr ); } void ScInputWindow::SetTextString( const OUString& rString ) @@ -690,7 +698,7 @@ void ScInputWindow::SetSumAssignMode() void ScInputWindow::SetFormulaMode( bool bSet ) { - aWndPos.SetFormulaMode(bSet); + aWndPos->SetFormulaMode(bSet); aTextWindow.SetFormulaMode(bSet); } @@ -755,7 +763,7 @@ void ScInputWindow::SwitchToTextWin() void ScInputWindow::PosGrabFocus() { - aWndPos.GrabFocus(); + aWndPos->GrabFocus(); } void ScInputWindow::EnableButtons( bool bEnable ) @@ -897,54 +905,62 @@ void ScInputWindow::MouseButtonUp( const MouseEvent& rMEvt ) ScInputBarGroup::ScInputBarGroup(vcl::Window* pParent, ScTabViewShell* pViewSh) : ScTextWndBase ( pParent, WinBits(WB_HIDE | WB_TABSTOP ) ), - aMultiTextWnd ( this, pViewSh ), - aButton ( this, WB_TABSTOP | WB_RECTSTYLE | WB_SMALLSTYLE ), - aScrollBar ( this, WB_TABSTOP | WB_VERT | WB_DRAG ), + aMultiTextWnd ( new ScMultiTextWnd(this, pViewSh) ), + aButton ( new ImageButton(this, WB_TABSTOP | WB_RECTSTYLE | WB_SMALLSTYLE) ), + aScrollBar ( new ScrollBar(this, WB_TABSTOP | WB_VERT | WB_DRAG) ), nVertOffset ( 0 ) { - aMultiTextWnd.Show(); - aMultiTextWnd.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); - aMultiTextWnd.SetHelpId( HID_INSWIN_INPUT ); + aMultiTextWnd->Show(); + aMultiTextWnd->SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); + aMultiTextWnd->SetHelpId( HID_INSWIN_INPUT ); - Size aSize( GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd.GetPixelHeightForLines(1) ); + Size aSize( GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd->GetPixelHeightForLines(1) ); - aButton.SetClickHdl( LINK( this, ScInputBarGroup, ClickHdl ) ); - aButton.SetSizePixel( aSize ); - aButton.Enable(); - aButton.SetSymbol( SymbolType::SPIN_DOWN ); - aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); - aButton.Show(); + aButton->SetClickHdl( LINK( this, ScInputBarGroup, ClickHdl ) ); + aButton->SetSizePixel( aSize ); + aButton->Enable(); + aButton->SetSymbol( SymbolType::SPIN_DOWN ); + aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); + aButton->Show(); - aScrollBar.SetSizePixel( aSize ); - aScrollBar.SetScrollHdl( LINK( this, ScInputBarGroup, Impl_ScrollHdl ) ); + aScrollBar->SetSizePixel( aSize ); + aScrollBar->SetScrollHdl( LINK( this, ScInputBarGroup, Impl_ScrollHdl ) ); } ScInputBarGroup::~ScInputBarGroup() { + dispose(); +} +void ScInputBarGroup::dispose() +{ + aMultiTextWnd.disposeAndClear(); + aButton.disposeAndClear(); + aScrollBar.disposeAndClear(); + ScTextWndBase::dispose(); } void ScInputBarGroup::InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) { - aMultiTextWnd.InsertAccessibleTextData( rTextData ); + aMultiTextWnd->InsertAccessibleTextData( rTextData ); } void ScInputBarGroup::RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) { - aMultiTextWnd.RemoveAccessibleTextData( rTextData ); + aMultiTextWnd->RemoveAccessibleTextData( rTextData ); } const OUString& ScInputBarGroup::GetTextString() const { - return aMultiTextWnd.GetTextString(); + return aMultiTextWnd->GetTextString(); } void ScInputBarGroup::SetTextString( const OUString& rString ) { - aMultiTextWnd.SetTextString(rString); + aMultiTextWnd->SetTextString(rString); } void ScInputBarGroup::Resize() @@ -965,89 +981,89 @@ void ScInputBarGroup::Resize() Size aSize = GetSizePixel(); aSize.Width() = std::max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 ); - aScrollBar.SetPosPixel(Point( aSize.Width() - aButton.GetSizePixel().Width(), aButton.GetSizePixel().Height() ) ); + aScrollBar->SetPosPixel(Point( aSize.Width() - aButton->GetSizePixel().Width(), aButton->GetSizePixel().Height() ) ); Size aTmpSize( aSize ); - aTmpSize.Width() = aTmpSize.Width() - aButton.GetSizePixel().Width() - BUTTON_OFFSET; - aMultiTextWnd.SetSizePixel(aTmpSize); + aTmpSize.Width() = aTmpSize.Width() - aButton->GetSizePixel().Width() - BUTTON_OFFSET; + aMultiTextWnd->SetSizePixel(aTmpSize); - aMultiTextWnd.Resize(); + aMultiTextWnd->Resize(); - aSize.Height() = aMultiTextWnd.GetSizePixel().Height(); + aSize.Height() = aMultiTextWnd->GetSizePixel().Height(); SetSizePixel(aSize); - if( aMultiTextWnd.GetNumLines() > 1 ) + if( aMultiTextWnd->GetNumLines() > 1 ) { - aButton.SetSymbol( SymbolType::SPIN_UP ); - aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_COLLAPSE_FORMULA ) ); - Size scrollSize = aButton.GetSizePixel(); - scrollSize.Height() = aMultiTextWnd.GetSizePixel().Height() - aButton.GetSizePixel().Height(); - aScrollBar.SetSizePixel( scrollSize ); + aButton->SetSymbol( SymbolType::SPIN_UP ); + aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_COLLAPSE_FORMULA ) ); + Size scrollSize = aButton->GetSizePixel(); + scrollSize.Height() = aMultiTextWnd->GetSizePixel().Height() - aButton->GetSizePixel().Height(); + aScrollBar->SetSizePixel( scrollSize ); - Size aOutSz = aMultiTextWnd.GetOutputSize(); + Size aOutSz = aMultiTextWnd->GetOutputSize(); - aScrollBar.SetVisibleSize( aOutSz.Height() ); - aScrollBar.SetPageSize( aOutSz.Height() ); - aScrollBar.SetLineSize( aMultiTextWnd.GetTextHeight() ); - aScrollBar.SetRange( Range( 0, aMultiTextWnd.GetEditEngTxtHeight() ) ); + aScrollBar->SetVisibleSize( aOutSz.Height() ); + aScrollBar->SetPageSize( aOutSz.Height() ); + aScrollBar->SetLineSize( aMultiTextWnd->GetTextHeight() ); + aScrollBar->SetRange( Range( 0, aMultiTextWnd->GetEditEngTxtHeight() ) ); - aScrollBar.Resize(); - aScrollBar.Show(); + aScrollBar->Resize(); + aScrollBar->Show(); } else { - aButton.SetSymbol( SymbolType::SPIN_DOWN ); - aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); - aScrollBar.Hide(); + aButton->SetSymbol( SymbolType::SPIN_DOWN ); + aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); + aScrollBar->Hide(); } - aButton.SetPosPixel(Point(aSize.Width() - aButton.GetSizePixel().Width(), 0)); + aButton->SetPosPixel(Point(aSize.Width() - aButton->GetSizePixel().Width(), 0)); Invalidate(); } void ScInputBarGroup::StopEditEngine( bool bAll ) { - aMultiTextWnd.StopEditEngine( bAll ); + aMultiTextWnd->StopEditEngine( bAll ); } void ScInputBarGroup::StartEditEngine() { - aMultiTextWnd.StartEditEngine(); + aMultiTextWnd->StartEditEngine(); } void ScInputBarGroup::MakeDialogEditView() { - aMultiTextWnd.MakeDialogEditView(); + aMultiTextWnd->MakeDialogEditView(); } EditView* ScInputBarGroup::GetEditView() { - return aMultiTextWnd.GetEditView(); + return aMultiTextWnd->GetEditView(); } bool ScInputBarGroup::IsInputActive() { - return aMultiTextWnd.IsInputActive(); + return aMultiTextWnd->IsInputActive(); } void ScInputBarGroup::SetFormulaMode(bool bSet) { - aMultiTextWnd.SetFormulaMode(bSet); + aMultiTextWnd->SetFormulaMode(bSet); } void ScInputBarGroup::IncrementVerticalSize() { - aMultiTextWnd.SetNumLines( aMultiTextWnd.GetNumLines() + 1 ); + aMultiTextWnd->SetNumLines( aMultiTextWnd->GetNumLines() + 1 ); TriggerToolboxLayout(); } void ScInputBarGroup::DecrementVerticalSize() { - if ( aMultiTextWnd.GetNumLines() > 1 ) + if ( aMultiTextWnd->GetNumLines() > 1 ) { - aMultiTextWnd.SetNumLines( aMultiTextWnd.GetNumLines() - 1 ); + aMultiTextWnd->SetNumLines( aMultiTextWnd->GetNumLines() - 1 ); TriggerToolboxLayout(); } } @@ -1063,19 +1079,19 @@ IMPL_LINK_NOARG(ScInputBarGroup, ClickHdl) OSL_FAIL("The parent window pointer pParent is null"); return 1; } - if( aMultiTextWnd.GetNumLines() > 1 ) + if( aMultiTextWnd->GetNumLines() > 1 ) { - aMultiTextWnd.SetNumLines( 1 ); + aMultiTextWnd->SetNumLines( 1 ); } else { - aMultiTextWnd.SetNumLines( aMultiTextWnd.GetLastNumExpandedLines() ); + aMultiTextWnd->SetNumLines( aMultiTextWnd->GetLastNumExpandedLines() ); } TriggerToolboxLayout(); // Restore focus to input line(s) if necessary if ( SC_MOD()->GetInputHdl()->IsTopMode() ) - aMultiTextWnd.GrabFocus(); + aMultiTextWnd->GrabFocus(); return 0; } @@ -1104,7 +1120,7 @@ void ScInputBarGroup::TriggerToolboxLayout() if ( xLayoutManager.is() ) { - if ( aMultiTextWnd.GetNumLines() > 1) + if ( aMultiTextWnd->GetNumLines() > 1) rParent.SetToolbarLayoutMode( TBX_LAYOUT_LOCKVERT ); else rParent.SetToolbarLayoutMode( TBX_LAYOUT_NORMAL ); @@ -1132,13 +1148,13 @@ void ScInputBarGroup::TriggerToolboxLayout() IMPL_LINK_NOARG(ScInputBarGroup, Impl_ScrollHdl) { - aMultiTextWnd.DoScroll(); + aMultiTextWnd->DoScroll(); return 0; } void ScInputBarGroup::TextGrabFocus() { - aMultiTextWnd.TextGrabFocus(); + aMultiTextWnd->TextGrabFocus(); } ScMultiTextWnd::ScMultiTextWnd( ScInputBarGroup* pParen, ScTabViewShell* pViewSh ) @@ -1480,11 +1496,17 @@ ScTextWnd::ScTextWnd( vcl::Window* pParent, ScTabViewShell* pViewSh ) ScTextWnd::~ScTextWnd() { + dispose(); +} + +void ScTextWnd::dispose() +{ while (!maAccTextDatas.empty()) { maAccTextDatas.back()->Dispose(); } delete pEditView; delete pEditEngine; + ScTextWndBase::dispose(); } void ScTextWnd::Paint( const Rectangle& rRect ) @@ -2068,11 +2090,17 @@ ScPosWnd::ScPosWnd( vcl::Window* pParent ) : ScPosWnd::~ScPosWnd() { + dispose(); +} + +void ScPosWnd::dispose() +{ EndListening( *SfxGetpApp() ); HideTip(); delete pAccel; + ComboBox::dispose(); } void ScPosWnd::SetFormulaMode( bool bSet ) diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 4e73d9ef5e77..df4cda835fc1 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -856,13 +856,13 @@ void ScCheckListMenuWindow::CancelButton::Click() ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc) : ScMenuFloatingWindow(pParent, pDoc), - maEdSearch(this), - maChecks(this, WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ), - maChkToggleAll(this, 0), - maBtnSelectSingle (this, 0), - maBtnUnselectSingle(this, 0), - maBtnOk(this), - maBtnCancel(this), + maEdSearch(new Edit (this)), + maChecks(new ScCheckListBox(this, WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT) ), + maChkToggleAll(new TriStateBox(this, 0)), + maBtnSelectSingle(new ImageButton(this, 0)), + maBtnUnselectSingle(new ImageButton(this, 0)), + maBtnOk(new OKButton(this)), + maBtnCancel(new CancelButton(this)), mnCurTabStop(0), mpExtendedData(NULL), mpOKAction(NULL), @@ -876,20 +876,32 @@ ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* p maTabStopCtrls.reserve(8); maTabStopCtrls.push_back(this); - maTabStopCtrls.push_back(&maEdSearch); - maTabStopCtrls.push_back(&maChecks); - maTabStopCtrls.push_back(&maChkToggleAll); - maTabStopCtrls.push_back(&maBtnSelectSingle); - maTabStopCtrls.push_back(&maBtnUnselectSingle); - maTabStopCtrls.push_back(&maBtnOk); - maTabStopCtrls.push_back(&maBtnCancel); + maTabStopCtrls.push_back(maEdSearch.get()); + maTabStopCtrls.push_back(maChecks.get()); + maTabStopCtrls.push_back(maChkToggleAll.get()); + maTabStopCtrls.push_back(maBtnSelectSingle.get()); + maTabStopCtrls.push_back(maBtnUnselectSingle.get()); + maTabStopCtrls.push_back(maBtnOk.get()); + maTabStopCtrls.push_back(maBtnCancel.get()); // Enable type-ahead search in the check list box. - maChecks.SetStyle(maChecks.GetStyle() | WB_QUICK_SEARCH); + maChecks->SetStyle(maChecks->GetStyle() | WB_QUICK_SEARCH); } ScCheckListMenuWindow::~ScCheckListMenuWindow() { + dispose(); +} + +void ScCheckListMenuWindow::dispose() +{ + maChecks.disposeAndClear(); + maChkToggleAll.disposeAndClear(); + maBtnSelectSingle.disposeAndClear(); + maBtnUnselectSingle.disposeAndClear(); + maBtnOk.disposeAndClear(); + maBtnCancel.disposeAndClear(); + ScMenuFloatingWindow::dispose(); } void ScCheckListMenuWindow::getSectionPosSize( @@ -958,7 +970,7 @@ void ScCheckListMenuWindow::getSectionPosSize( break; case CHECK_TOGGLE_ALL: { - long h = std::min(maChkToggleAll.CalcMinimumSize().Height(), 26L); + long h = std::min(maChkToggleAll->CalcMinimumSize().Height(), 26L); rPos = Point(nListBoxMargin, nSingleBtnAreaY); rPos.X() += 5; rPos.Y() += (nSingleItemBtnAreaHeight - h)/2; @@ -1029,38 +1041,38 @@ void ScCheckListMenuWindow::packWindow() SetOutputSizePixel(aSize); getSectionPosSize(aPos, aSize, BTN_OK); - maBtnOk.SetPosSizePixel(aPos, aSize); - maBtnOk.SetFont(getLabelFont()); - maBtnOk.SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); - maBtnOk.Show(); + maBtnOk->SetPosSizePixel(aPos, aSize); + maBtnOk->SetFont(getLabelFont()); + maBtnOk->SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); + maBtnOk->Show(); getSectionPosSize(aPos, aSize, BTN_CANCEL); - maBtnCancel.SetPosSizePixel(aPos, aSize); - maBtnCancel.SetFont(getLabelFont()); - maBtnCancel.Show(); + maBtnCancel->SetPosSizePixel(aPos, aSize); + maBtnCancel->SetFont(getLabelFont()); + maBtnCancel->Show(); getSectionPosSize(aPos, aSize, EDIT_SEARCH); - maEdSearch.SetPosSizePixel(aPos, aSize); - maEdSearch.SetFont(getLabelFont()); - maEdSearch.SetControlBackground(rStyle.GetFieldColor()); - maEdSearch.SetPlaceholderText(SC_STRLOAD(RID_POPUP_FILTER, STR_EDIT_SEARCH_ITEMS)); - maEdSearch.SetModifyHdl( LINK(this, ScCheckListMenuWindow, EdModifyHdl) ); - maEdSearch.Show(); + maEdSearch->SetPosSizePixel(aPos, aSize); + maEdSearch->SetFont(getLabelFont()); + maEdSearch->SetControlBackground(rStyle.GetFieldColor()); + maEdSearch->SetPlaceholderText(SC_STRLOAD(RID_POPUP_FILTER, STR_EDIT_SEARCH_ITEMS)); + maEdSearch->SetModifyHdl( LINK(this, ScCheckListMenuWindow, EdModifyHdl) ); + maEdSearch->Show(); getSectionPosSize(aPos, aSize, LISTBOX_AREA_INNER); - maChecks.SetPosSizePixel(aPos, aSize); - maChecks.SetFont(getLabelFont()); - maChecks.SetCheckButtonHdl( LINK(this, ScCheckListMenuWindow, CheckHdl) ); - maChecks.Show(); + maChecks->SetPosSizePixel(aPos, aSize); + maChecks->SetFont(getLabelFont()); + maChecks->SetCheckButtonHdl( LINK(this, ScCheckListMenuWindow, CheckHdl) ); + maChecks->Show(); getSectionPosSize(aPos, aSize, CHECK_TOGGLE_ALL); - maChkToggleAll.SetPosSizePixel(aPos, aSize); - maChkToggleAll.SetFont(getLabelFont()); - maChkToggleAll.SetText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_TOGGLE_ALL)); - maChkToggleAll.SetTextColor(rStyle.GetMenuTextColor()); - maChkToggleAll.SetControlBackground(rStyle.GetMenuColor()); - maChkToggleAll.SetClickHdl( LINK(this, ScCheckListMenuWindow, TriStateHdl) ); - maChkToggleAll.Show(); + maChkToggleAll->SetPosSizePixel(aPos, aSize); + maChkToggleAll->SetFont(getLabelFont()); + maChkToggleAll->SetText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_TOGGLE_ALL)); + maChkToggleAll->SetTextColor(rStyle.GetMenuTextColor()); + maChkToggleAll->SetControlBackground(rStyle.GetMenuColor()); + maChkToggleAll->SetClickHdl( LINK(this, ScCheckListMenuWindow, TriStateHdl) ); + maChkToggleAll->Show(); sal_Int32 nScaleFactor = GetDPIScaleFactor(); @@ -1073,11 +1085,11 @@ void ScCheckListMenuWindow::packWindow() } getSectionPosSize(aPos, aSize, BTN_SINGLE_SELECT); - maBtnSelectSingle.SetPosSizePixel(aPos, aSize); - maBtnSelectSingle.SetQuickHelpText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_SELECT_CURRENT)); - maBtnSelectSingle.SetModeImage(aSingleSelect); - maBtnSelectSingle.SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); - maBtnSelectSingle.Show(); + maBtnSelectSingle->SetPosSizePixel(aPos, aSize); + maBtnSelectSingle->SetQuickHelpText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_SELECT_CURRENT)); + maBtnSelectSingle->SetModeImage(aSingleSelect); + maBtnSelectSingle->SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); + maBtnSelectSingle->Show(); Image aSingleUnselect(ScResId(RID_IMG_UNSELECT_CURRENT)); if (nScaleFactor != 1) @@ -1088,11 +1100,11 @@ void ScCheckListMenuWindow::packWindow() } getSectionPosSize(aPos, aSize, BTN_SINGLE_UNSELECT); - maBtnUnselectSingle.SetPosSizePixel(aPos, aSize); - maBtnUnselectSingle.SetQuickHelpText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_UNSELECT_CURRENT)); - maBtnUnselectSingle.SetModeImage(aSingleUnselect); - maBtnUnselectSingle.SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); - maBtnUnselectSingle.Show(); + maBtnUnselectSingle->SetPosSizePixel(aPos, aSize); + maBtnUnselectSingle->SetQuickHelpText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_UNSELECT_CURRENT)); + maBtnUnselectSingle->SetModeImage(aSingleUnselect); + maBtnUnselectSingle->SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); + maBtnUnselectSingle->Show(); } void ScCheckListMenuWindow::setAllMemberState(bool bSet) @@ -1103,21 +1115,21 @@ void ScCheckListMenuWindow::setAllMemberState(bool bSet) aLabel = maMembers[i].maName; if (aLabel.isEmpty()) aLabel = ScGlobal::GetRscString(STR_EMPTYDATA); - maChecks.ShowCheckEntry( aLabel, maMembers[i].mpParent, true, bSet); + maChecks->ShowCheckEntry( aLabel, maMembers[i].mpParent, true, bSet); } if (!maConfig.mbAllowEmptySet) // We need to have at least one member selected. - maBtnOk.Enable(maChecks.GetCheckedEntryCount() != 0); + maBtnOk->Enable(maChecks->GetCheckedEntryCount() != 0); } void ScCheckListMenuWindow::selectCurrentMemberOnly(bool bSet) { setAllMemberState(!bSet); - SvTreeListEntry* pEntry = maChecks.GetCurEntry(); + SvTreeListEntry* pEntry = maChecks->GetCurEntry(); if (!pEntry) return; - maChecks.CheckEntry(pEntry, bSet ); + maChecks->CheckEntry(pEntry, bSet ); } void ScCheckListMenuWindow::cycleFocus(bool bReverse) @@ -1146,17 +1158,17 @@ void ScCheckListMenuWindow::cycleFocus(bool bReverse) IMPL_LINK( ScCheckListMenuWindow, ButtonHdl, Button*, pBtn ) { - if (pBtn == &maBtnOk) + if (pBtn == maBtnOk.get()) close(true); - else if (pBtn == &maBtnSelectSingle) + else if (pBtn == maBtnSelectSingle->get()) { selectCurrentMemberOnly(true); - CheckHdl(&maChecks); + CheckHdl(maChecks.get()); } - else if (pBtn == &maBtnUnselectSingle) + else if (pBtn == maBtnUnselectSingle->get()) { selectCurrentMemberOnly(false); - CheckHdl(&maChecks); + CheckHdl(maChecks.get()); } return 0; } @@ -1166,27 +1178,27 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, TriStateHdl) switch (mePrevToggleAllState) { case TRISTATE_FALSE: - maChkToggleAll.SetState(TRISTATE_TRUE); + maChkToggleAll->SetState(TRISTATE_TRUE); setAllMemberState(true); break; case TRISTATE_TRUE: - maChkToggleAll.SetState(TRISTATE_FALSE); + maChkToggleAll->SetState(TRISTATE_FALSE); setAllMemberState(false); break; case TRISTATE_INDET: default: - maChkToggleAll.SetState(TRISTATE_TRUE); + maChkToggleAll->SetState(TRISTATE_TRUE); setAllMemberState(true); break; } - mePrevToggleAllState = maChkToggleAll.GetState(); + mePrevToggleAllState = maChkToggleAll->GetState(); return 0; } IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl) { - OUString aSearchText = maEdSearch.GetText(); + OUString aSearchText = maEdSearch->GetText(); aSearchText = aSearchText.toAsciiLowerCase(); bool bSearchTextEmpty = aSearchText.isEmpty(); size_t n = maMembers.size(); @@ -1229,26 +1241,26 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl) IMPL_LINK( ScCheckListMenuWindow, CheckHdl, SvTreeListBox*, pChecks ) { - if (pChecks != &maChecks) + if (pChecks != maChecks.get()) return 0; SvTreeListEntry* pEntry = pChecks->GetHdlEntry(); if ( pEntry ) - maChecks.CheckEntry( pEntry, ( pChecks->GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) ); - size_t nNumChecked = maChecks.GetCheckedEntryCount(); + maChecks->CheckEntry( pEntry, ( pChecks->GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) ); + size_t nNumChecked = maChecks->GetCheckedEntryCount(); if (nNumChecked == maMembers.size()) // all members visible - maChkToggleAll.SetState(TRISTATE_TRUE); + maChkToggleAll->SetState(TRISTATE_TRUE); else if (nNumChecked == 0) // no members visible - maChkToggleAll.SetState(TRISTATE_FALSE); + maChkToggleAll->SetState(TRISTATE_FALSE); else - maChkToggleAll.SetState(TRISTATE_INDET); + maChkToggleAll->SetState(TRISTATE_INDET); if (!maConfig.mbAllowEmptySet) // We need to have at least one member selected. - maBtnOk.Enable(nNumChecked != 0); + maBtnOk->Enable(nNumChecked != 0); - mePrevToggleAllState = maChkToggleAll.GetState(); + mePrevToggleAllState = maChkToggleAll->GetState(); return 0; } @@ -1315,19 +1327,19 @@ Reference<XAccessible> ScCheckListMenuWindow::CreateAccessible() fillMenuItemsToAccessible(pAccTop); pAccTop->setAccessibleChild( - maEdSearch.CreateAccessible(), ScAccessibleFilterTopWindow::EDIT_SEARCH_BOX); + maEdSearch->CreateAccessible(), ScAccessibleFilterTopWindow::EDIT_SEARCH_BOX); pAccTop->setAccessibleChild( - maChecks.CreateAccessible(), ScAccessibleFilterTopWindow::LISTBOX); + maChecks->CreateAccessible(), ScAccessibleFilterTopWindow::LISTBOX); pAccTop->setAccessibleChild( - maChkToggleAll.CreateAccessible(), ScAccessibleFilterTopWindow::TOGGLE_ALL); + maChkToggleAll->CreateAccessible(), ScAccessibleFilterTopWindow::TOGGLE_ALL); pAccTop->setAccessibleChild( - maBtnSelectSingle.CreateAccessible(), ScAccessibleFilterTopWindow::SINGLE_ON_BTN); + maBtnSelectSingle->CreateAccessible(), ScAccessibleFilterTopWindow::SINGLE_ON_BTN); pAccTop->setAccessibleChild( - maBtnUnselectSingle.CreateAccessible(), ScAccessibleFilterTopWindow::SINGLE_OFF_BTN); + maBtnUnselectSingle->CreateAccessible(), ScAccessibleFilterTopWindow::SINGLE_OFF_BTN); pAccTop->setAccessibleChild( - maBtnOk.CreateAccessible(), ScAccessibleFilterTopWindow::OK_BTN); + maBtnOk->CreateAccessible(), ScAccessibleFilterTopWindow::OK_BTN); pAccTop->setAccessibleChild( - maBtnCancel.CreateAccessible(), ScAccessibleFilterTopWindow::CANCEL_BTN); + maBtnCancel->CreateAccessible(), ScAccessibleFilterTopWindow::CANCEL_BTN); } return mxAccessible; @@ -1361,12 +1373,12 @@ void ScCheckListMenuWindow::addDateMember(const OUString& rsName, double nVal, b OUString aMonthName = aMonths[nMonth-1].FullName; OUString aDayName = OUString::number(nDay); - maChecks.SetUpdateMode(false); + maChecks->SetUpdateMode(false); - SvTreeListEntry* pYearEntry = maChecks.FindEntry(NULL, aYearName); + SvTreeListEntry* pYearEntry = maChecks->FindEntry(NULL, aYearName); if (!pYearEntry) { - pYearEntry = maChecks.InsertEntry(aYearName, NULL, true); + pYearEntry = maChecks->InsertEntry(aYearName, NULL, true); Member aMemYear; aMemYear.maName = aYearName; aMemYear.maRealName = rsName; @@ -1377,10 +1389,10 @@ void ScCheckListMenuWindow::addDateMember(const OUString& rsName, double nVal, b maMembers.push_back(aMemYear); } - SvTreeListEntry* pMonthEntry = maChecks.FindEntry(pYearEntry, aMonthName); + SvTreeListEntry* pMonthEntry = maChecks->FindEntry(pYearEntry, aMonthName); if (!pMonthEntry) { - pMonthEntry = maChecks.InsertEntry(aMonthName, pYearEntry, true); + pMonthEntry = maChecks->InsertEntry(aMonthName, pYearEntry, true); Member aMemMonth; aMemMonth.maName = aMonthName; aMemMonth.maRealName = rsName; @@ -1391,10 +1403,10 @@ void ScCheckListMenuWindow::addDateMember(const OUString& rsName, double nVal, b maMembers.push_back(aMemMonth); } - SvTreeListEntry* pDayEntry = maChecks.FindEntry(pMonthEntry, aDayName); + SvTreeListEntry* pDayEntry = maChecks->FindEntry(pMonthEntry, aDayName); if (!pDayEntry) { - maChecks.InsertEntry(aDayName, pMonthEntry, false); + maChecks->InsertEntry(aDayName, pMonthEntry, false); Member aMemDay; aMemDay.maName = aDayName; aMemDay.maRealName = rsName; @@ -1405,7 +1417,7 @@ void ScCheckListMenuWindow::addDateMember(const OUString& rsName, double nVal, b maMembers.push_back(aMemDay); } - maChecks.SetUpdateMode(true); + maChecks->SetUpdateMode(true); } void ScCheckListMenuWindow::addMember(const OUString& rName, bool bVisible) @@ -1591,20 +1603,20 @@ void ScCheckListMenuWindow::initMembers() size_t n = maMembers.size(); size_t nVisMemCount = 0; - maChecks.SetUpdateMode(false); - maChecks.GetModel()->EnableInvalidate(false); + maChecks->SetUpdateMode(false); + maChecks->GetModel()->EnableInvalidate(false); for (size_t i = 0; i < n; ++i) { if (maMembers[i].mbDate) { - maChecks.CheckEntry(maMembers[i].maName, maMembers[i].mpParent, maMembers[i].mbVisible); + maChecks->CheckEntry(maMembers[i].maName, maMembers[i].mpParent, maMembers[i].mbVisible); // Expand first node of checked dates - if (!maMembers[i].mpParent && maChecks.IsChecked(maMembers[i].maName, maMembers[i].mpParent)) + if (!maMembers[i].mpParent && maChecks->IsChecked(maMembers[i].maName, maMembers[i].mpParent)) { - SvTreeListEntry* pEntry = maChecks.FindEntry(NULL, maMembers[i].maName); + SvTreeListEntry* pEntry = maChecks->FindEntry(NULL, maMembers[i].maName); if (pEntry) - maChecks.Expand(pEntry); + maChecks->Expand(pEntry); } } else @@ -1612,11 +1624,11 @@ void ScCheckListMenuWindow::initMembers() OUString aLabel = maMembers[i].maName; if (aLabel.isEmpty()) aLabel = ScGlobal::GetRscString(STR_EMPTYDATA); - SvTreeListEntry* pEntry = maChecks.InsertEntry( + SvTreeListEntry* pEntry = maChecks->InsertEntry( aLabel, NULL, false, TREELIST_APPEND, NULL, SvLBoxButtonKind_enabledCheckbox); - maChecks.SetCheckButtonState( + maChecks->SetCheckButtonState( pEntry, maMembers[i].mbVisible ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED); } @@ -1626,23 +1638,23 @@ void ScCheckListMenuWindow::initMembers() if (nVisMemCount == n) { // all members visible - maChkToggleAll.SetState(TRISTATE_TRUE); + maChkToggleAll->SetState(TRISTATE_TRUE); mePrevToggleAllState = TRISTATE_TRUE; } else if (nVisMemCount == 0) { // no members visible - maChkToggleAll.SetState(TRISTATE_FALSE); + maChkToggleAll->SetState(TRISTATE_FALSE); mePrevToggleAllState = TRISTATE_FALSE; } else { - maChkToggleAll.SetState(TRISTATE_INDET); + maChkToggleAll->SetState(TRISTATE_INDET); mePrevToggleAllState = TRISTATE_INDET; } - maChecks.GetModel()->EnableInvalidate(true); - maChecks.SetUpdateMode(true); + maChecks->GetModel()->EnableInvalidate(true); + maChecks->SetUpdateMode(true); } void ScCheckListMenuWindow::setConfig(const Config& rConfig) @@ -1652,7 +1664,7 @@ void ScCheckListMenuWindow::setConfig(const Config& rConfig) bool ScCheckListMenuWindow::isAllSelected() const { - return maChkToggleAll.IsChecked(); + return maChkToggleAll->IsChecked(); } void ScCheckListMenuWindow::getResult(ResultType& rResult) @@ -1666,7 +1678,7 @@ void ScCheckListMenuWindow::getResult(ResultType& rResult) OUString aLabel = maMembers[i].maName; if (aLabel.isEmpty()) aLabel = ScGlobal::GetRscString(STR_EMPTYDATA); - bool bState = maChecks.IsChecked( aLabel, maMembers[i].mpParent ); + bool bState = maChecks->IsChecked( aLabel, maMembers[i].mpParent ); OUString sName; if ( maMembers[i].mbDate ) sName = maMembers[i].maRealName; @@ -1683,7 +1695,7 @@ void ScCheckListMenuWindow::launch(const Rectangle& rRect) packWindow(); if (!maConfig.mbAllowEmptySet) // We need to have at least one member selected. - maBtnOk.Enable(maChecks.GetCheckedEntryCount() != 0); + maBtnOk->Enable(maChecks->GetCheckedEntryCount() != 0); Rectangle aRect(rRect); if (maConfig.mbRTL) diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx index 3a3bcd769c76..3b8cf87e3232 100644 --- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx +++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx @@ -233,7 +233,13 @@ ScZoomSliderWnd::ScZoomSliderWnd( vcl::Window* pParent, const ::com::sun::star:: ScZoomSliderWnd::~ScZoomSliderWnd() { + dispose(); +} + +void ScZoomSliderWnd::dispose() +{ delete mpImpl; + vcl::Window::dispose(); } void ScZoomSliderWnd::MouseButtonDown( const MouseEvent& rMEvt ) diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index b89b3b0d6c36..2b18941bfeb5 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -38,11 +38,11 @@ ScCondFrmtEntry::ScCondFrmtEntry(vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos): Control(pParent, ScResId( RID_COND_ENTRY ) ), mbActive(false), - maFtCondNr( this, ScResId( FT_COND_NR ) ), - maFtCondition( this, ScResId( FT_CONDITION ) ), + maFtCondNr( new FixedText( this, ScResId( FT_COND_NR ) ) ), + maFtCondition( new FixedText( this, ScResId( FT_CONDITION ) ) ), mnIndex(0), maStrCondition(ScResId( STR_CONDITION ).toString()), - maLbType( this, ScResId( LB_TYPE ) ), + maLbType( new ListBox( this, ScResId( LB_TYPE ) ) ), mpDoc(pDoc), maPos(rPos) { @@ -51,18 +51,27 @@ ScCondFrmtEntry::ScCondFrmtEntry(vcl::Window* pParent, ScDocument* pDoc, const S SetControlBackground(aBack); SetBackground(GetControlBackground()); - maFtCondNr.SetControlBackground(aBack); - maFtCondNr.SetBackground(maFtCondNr.GetControlBackground()); + maFtCondNr->SetControlBackground(aBack); + maFtCondNr->SetBackground(maFtCondNr->GetControlBackground()); - maFtCondition.SetControlBackground(aBack); - maFtCondition.SetBackground(maFtCondition.GetControlBackground()); + maFtCondition->SetControlBackground(aBack); + maFtCondition->SetBackground(maFtCondition->GetControlBackground()); - maLbType.SetSelectHdl( LINK( pParent, ScCondFormatList, TypeListHdl ) ); + maLbType->SetSelectHdl( LINK( pParent, ScCondFormatList, TypeListHdl ) ); maClickHdl = LINK( pParent, ScCondFormatList, EntrySelectHdl ); } ScCondFrmtEntry::~ScCondFrmtEntry() { + dispose(); +} + +void ScCondFrmtEntry::dispose() +{ + maFtCondNr.disposeAndClear(); + maFtCondition.disposeAndClear(); + maLbType.disposeAndClear(); + Control::dispose(); } bool ScCondFrmtEntry::Notify( NotifyEvent& rNEvt ) @@ -79,7 +88,7 @@ void ScCondFrmtEntry::SetIndex(sal_Int32 nIndex) mnIndex = nIndex; OUStringBuffer aBuffer(maStrCondition); aBuffer.append(OUString::number(nIndex)); - maFtCondNr.SetText(aBuffer.makeStringAndClear()); + maFtCondNr->SetText(aBuffer.makeStringAndClear()); } void ScCondFrmtEntry::SetHeight() @@ -109,9 +118,9 @@ void ScCondFrmtEntry::SetHeight() void ScCondFrmtEntry::Select() { - maFtCondition.SetText(OUString()); - maFtCondition.Hide(); - maLbType.Show(); + maFtCondition->SetText(OUString()); + maFtCondition->Hide(); + maLbType->Show(); mbActive = true; SetHeight(); } @@ -119,9 +128,9 @@ void ScCondFrmtEntry::Select() void ScCondFrmtEntry::Deselect() { OUString maCondText = GetExpressionString(); - maFtCondition.SetText(maCondText); - maFtCondition.Show(); - maLbType.Hide(); + maFtCondition->SetText(maCondText); + maFtCondition->Show(); + maLbType->Hide(); mbActive = false; SetHeight(); } @@ -179,18 +188,18 @@ const ScConditionMode ScConditionFrmtEntry::mpEntryToCond[ScConditionFrmtEntry:: ScConditionFrmtEntry::ScConditionFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbCondType( this, ScResId( LB_CELLIS_TYPE ) ), - maEdVal1( this, NULL, NULL, ScResId( ED_VAL1 ) ), - maEdVal2( this, NULL, NULL, ScResId( ED_VAL2 ) ), - maFtVal( this, ScResId( FT_VAL ) ), - maFtStyle( this, ScResId( FT_STYLE ) ), - maLbStyle( this, ScResId( LB_STYLE ) ), - maWdPreview( this, ScResId( WD_PREVIEW ) ), + maLbCondType( new ListBox( this, ScResId( LB_CELLIS_TYPE ) ) ), + maEdVal1( new formula::RefEdit( this, NULL, NULL, ScResId( ED_VAL1 ) ) ), + maEdVal2( new formula::RefEdit( this, NULL, NULL, ScResId( ED_VAL2 ) ) ), + maFtVal( new FixedText( this, ScResId( FT_VAL ) ) ), + maFtStyle( new FixedText( this, ScResId( FT_STYLE ) ) ), + maLbStyle( new ListBox( this, ScResId( LB_STYLE ) ) ), + maWdPreview( new SvxFontPrevWindow( this, ScResId( WD_PREVIEW ) ) ), mbIsInStyleCreate(false) { FreeResource(); - maLbType.SelectEntryPos(1); + maLbType->SelectEntryPos(1); Init(pDialogParent); @@ -199,76 +208,93 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( vcl::Window* pParent, ScDocument* pD if(pFormatEntry) { OUString aStyleName = pFormatEntry->GetStyle(); - maLbStyle.SelectEntry(aStyleName); + maLbStyle->SelectEntry(aStyleName); StyleSelectHdl(NULL); ScConditionMode eMode = pFormatEntry->GetOperation(); - maLbCondType.SelectEntryPos(ConditionModeToEntryPos(eMode)); + maLbCondType->SelectEntryPos(ConditionModeToEntryPos(eMode)); switch(GetNumberEditFields(eMode)) { case 0: - maEdVal1.Hide(); - maEdVal2.Hide(); + maEdVal1->Hide(); + maEdVal2->Hide(); break; case 1: - maEdVal1.Show(); - maEdVal1.SetText(pFormatEntry->GetExpression(maPos, 0)); - maEdVal2.Hide(); + maEdVal1->Show(); + maEdVal1->SetText(pFormatEntry->GetExpression(maPos, 0)); + maEdVal2->Hide(); OnEdChanged(&maEdVal1); break; case 2: - maEdVal1.Show(); - maEdVal1.SetText(pFormatEntry->GetExpression(maPos, 0)); + maEdVal1->Show(); + maEdVal1->SetText(pFormatEntry->GetExpression(maPos, 0)); OnEdChanged(&maEdVal1); - maEdVal2.Show(); - maEdVal2.SetText(pFormatEntry->GetExpression(maPos, 1)); + maEdVal2->Show(); + maEdVal2->SetText(pFormatEntry->GetExpression(maPos, 1)); OnEdChanged(&maEdVal2); break; } } else { - maLbCondType.SelectEntryPos(0); - maEdVal2.Hide(); - maLbStyle.SelectEntryPos(1); + maLbCondType->SelectEntryPos(0); + maEdVal2->Hide(); + maLbStyle->SelectEntryPos(1); } } +ScConditionFrmtEntry::~ScConditionFrmtEntry() +{ + dispose(); +} + +void ScConditionFrmtEntry::dispose() +{ + maLbCondType.disposeAndClear(); + maEdVal1.disposeAndClear(); + maEdVal2.disposeAndClear(); + maFtVal.disposeAndClear(); + maFtStyle.disposeAndClear(); + maLbStyle.disposeAndClear(); + maWdPreview.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + void ScConditionFrmtEntry::Init(ScCondFormatDlg* pDialogParent) { - maEdVal1.SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); - maEdVal2.SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); - maEdVal1.SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); - maEdVal2.SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); + maEdVal1->SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdVal2->SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdVal1->SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); + maEdVal2->SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); - maEdVal1.SetStyle( maEdVal1.GetStyle() | WB_FORCECTRLBACKGROUND ); - maEdVal2.SetStyle( maEdVal2.GetStyle() | WB_FORCECTRLBACKGROUND ); + maEdVal1->SetStyle( maEdVal1->GetStyle() | WB_FORCECTRLBACKGROUND ); + maEdVal2->SetStyle( maEdVal2->GetStyle() | WB_FORCECTRLBACKGROUND ); - maEdVal1.SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); - maEdVal2.SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); + maEdVal1->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); + maEdVal2->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); - FillStyleListBox( mpDoc, maLbStyle ); - maLbStyle.SetSelectHdl( LINK( this, ScConditionFrmtEntry, StyleSelectHdl ) ); + FillStyleListBox( mpDoc, *maLbStyle.get() ); + maLbStyle->SetSelectHdl( LINK( this, ScConditionFrmtEntry, StyleSelectHdl ) ); - maLbCondType.SetSelectHdl( LINK( this, ScConditionFrmtEntry, ConditionTypeSelectHdl ) ); + maLbCondType->SetSelectHdl( LINK( this, ScConditionFrmtEntry, ConditionTypeSelectHdl ) ); } ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const { - ScConditionMode eMode = EntryPosToConditionMode(maLbCondType.GetSelectEntryPos()); - OUString aExpr1 = maEdVal1.GetText(); + ScConditionMode eMode = EntryPosToConditionMode(maLbCondType->GetSelectEntryPos()); + OUString aExpr1 = maEdVal1->GetText(); OUString aExpr2; if (GetNumberEditFields(eMode) == 2) { - aExpr2 = maEdVal2.GetText(); + aExpr2 = maEdVal2->GetText(); if (aExpr2.isEmpty()) { return NULL; } } - ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aExpr1, aExpr2, mpDoc, maPos, maLbStyle.GetSelectEntry()); + ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aExpr1, aExpr2, mpDoc, maPos, maLbStyle->GetSelectEntry()); return pEntry; } @@ -416,7 +442,7 @@ sal_Int32 ScConditionFrmtEntry::GetNumberEditFields( ScConditionMode eMode ) con OUString ScConditionFrmtEntry::GetExpressionString() { - return ScCondFormatHelper::GetExpression(CONDITION, maLbCondType.GetSelectEntryPos(), maEdVal1.GetText(), maEdVal2.GetText()); + return ScCondFormatHelper::GetExpression(CONDITION, maLbCondType->GetSelectEntryPos(), maEdVal1->GetText(), maEdVal2->GetText()); } ScFormatEntry* ScConditionFrmtEntry::GetEntry() const @@ -426,33 +452,33 @@ ScFormatEntry* ScConditionFrmtEntry::GetEntry() const void ScConditionFrmtEntry::SetActive() { - ScConditionMode eMode = EntryPosToConditionMode(maLbCondType.GetSelectEntryPos()); - maLbCondType.Show(); + ScConditionMode eMode = EntryPosToConditionMode(maLbCondType->GetSelectEntryPos()); + maLbCondType->Show(); switch(GetNumberEditFields(eMode)) { case 1: - maEdVal1.Show(); + maEdVal1->Show(); break; case 2: - maEdVal1.Show(); - maEdVal2.Show(); + maEdVal1->Show(); + maEdVal2->Show(); break; } - maFtStyle.Show(); - maLbStyle.Show(); - maWdPreview.Show(); + maFtStyle->Show(); + maLbStyle->Show(); + maWdPreview->Show(); Select(); } void ScConditionFrmtEntry::SetInactive() { - maLbCondType.Hide(); - maEdVal1.Hide(); - maEdVal2.Hide(); - maFtStyle.Hide(); - maLbStyle.Hide(); - maWdPreview.Hide(); + maLbCondType->Hide(); + maEdVal1->Hide(); + maEdVal2->Hide(); + maFtStyle->Hide(); + maLbStyle->Hide(); + maWdPreview->Hide(); Deselect(); } @@ -482,7 +508,7 @@ void ScConditionFrmtEntry::Notify(SfxBroadcaster&, const SfxHint& rHint) if(nHint == SFX_STYLESHEET_MODIFIED) { if(!mbIsInStyleCreate) - UpdateStyleList(maLbStyle, mpDoc); + UpdateStyleList(*maLbStyle.get(), mpDoc); } } @@ -556,7 +582,7 @@ void StyleSelect( ListBox& rLbStyle, ScDocument* pDoc, SvxFontPrevWindow& rWdPre IMPL_LINK_NOARG(ScConditionFrmtEntry, StyleSelectHdl) { mbIsInStyleCreate = true; - StyleSelect( maLbStyle, mpDoc, maWdPreview ); + StyleSelect( *maLbStyle.get(), mpDoc, *maWdPreview.get() ); mbIsInStyleCreate = false; return 0; } @@ -565,41 +591,55 @@ IMPL_LINK_NOARG(ScConditionFrmtEntry, StyleSelectHdl) ScFormulaFrmtEntry::ScFormulaFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maFtStyle( this, ScResId( FT_STYLE ) ), - maLbStyle( this, ScResId( LB_STYLE ) ), - maWdPreview( this, ScResId( WD_PREVIEW ) ), - maEdFormula( this, NULL, NULL, ScResId( ED_FORMULA ) ) + maFtStyle( new FixedText( this, ScResId( FT_STYLE ) ) ), + maLbStyle( new ListBox( this, ScResId( LB_STYLE ) ) ), + maWdPreview( new SvxFontPrevWindow( this, ScResId( WD_PREVIEW ) ) ), + maEdFormula( new formula::RefEdit(this, NULL, NULL, ScResId( ED_FORMULA ) ) ) { Init(pDialogParent); FreeResource(); - maLbType.SelectEntryPos(2); + maLbType->SelectEntryPos(2); if(pFormat) { - maEdFormula.SetText(pFormat->GetExpression(rPos, 0, 0, pDoc->GetGrammar())); - maLbStyle.SelectEntry(pFormat->GetStyle()); + maEdFormula->SetText(pFormat->GetExpression(rPos, 0, 0, pDoc->GetGrammar())); + maLbStyle->SelectEntry(pFormat->GetStyle()); } else { - maLbStyle.SelectEntryPos(1); + maLbStyle->SelectEntryPos(1); } StyleSelectHdl(NULL); } +ScFormulaFrmtEntry::~ScFormulaFrmtEntry() +{ + dispose(); +} + +void ScFormulaFrmtEntry::dispose() +{ + maFtStyle.disposeAndClear(); + maLbStyle.disposeAndClear(); + maWdPreview.disposeAndClear(); + maEdFormula.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + void ScFormulaFrmtEntry::Init(ScCondFormatDlg* pDialogParent) { - maEdFormula.SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); - maEdFormula.SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); + maEdFormula->SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdFormula->SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); - FillStyleListBox( mpDoc, maLbStyle ); - maLbStyle.SetSelectHdl( LINK( this, ScFormulaFrmtEntry, StyleSelectHdl ) ); + FillStyleListBox( mpDoc, *maLbStyle.get() ); + maLbStyle->SetSelectHdl( LINK( this, ScFormulaFrmtEntry, StyleSelectHdl ) ); } IMPL_LINK_NOARG(ScFormulaFrmtEntry, StyleSelectHdl) { - StyleSelect( maLbStyle, mpDoc, maWdPreview ); + StyleSelect( *maLbStyle.get(), mpDoc, *maWdPreview.get() ); return 0; } @@ -607,12 +647,12 @@ IMPL_LINK_NOARG(ScFormulaFrmtEntry, StyleSelectHdl) ScFormatEntry* ScFormulaFrmtEntry::createFormulaEntry() const { ScConditionMode eMode = SC_COND_DIRECT; - OUString aFormula = maEdFormula.GetText(); + OUString aFormula = maEdFormula->GetText(); if(aFormula.isEmpty()) return NULL; OUString aExpr2; - ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aFormula, aExpr2, mpDoc, maPos, maLbStyle.GetSelectEntry()); + ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aFormula, aExpr2, mpDoc, maPos, maLbStyle->GetSelectEntry()); return pEntry; } @@ -623,25 +663,25 @@ ScFormatEntry* ScFormulaFrmtEntry::GetEntry() const OUString ScFormulaFrmtEntry::GetExpressionString() { - return ScCondFormatHelper::GetExpression(FORMULA, 0, maEdFormula.GetText()); + return ScCondFormatHelper::GetExpression(FORMULA, 0, maEdFormula->GetText()); } void ScFormulaFrmtEntry::SetActive() { - maWdPreview.Show(); - maFtStyle.Show(); - maLbStyle.Show(); - maEdFormula.Show(); + maWdPreview->Show(); + maFtStyle->Show(); + maLbStyle->Show(); + maEdFormula->Show(); Select(); } void ScFormulaFrmtEntry::SetInactive() { - maWdPreview.Hide(); - maFtStyle.Hide(); - maLbStyle.Hide(); - maEdFormula.Hide(); + maWdPreview->Hide(); + maFtStyle->Hide(); + maLbStyle->Hide(); + maEdFormula->Hide(); Deselect(); } @@ -735,45 +775,62 @@ ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const ColorListB ScColorScale2FrmtEntry::ScColorScale2FrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ), - maLbEntryTypeMin( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ), - maLbEntryTypeMax( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ), - maEdMin( this, ScResId( ED_COL_SCALE_MIN ) ), - maEdMax( this, ScResId( ED_COL_SCALE_MAX ) ), - maLbColMin( this, ScResId( LB_COL_MIN ) ), - maLbColMax( this, ScResId( LB_COL_MAX ) ) + maLbColorFormat( new ListBox( this, ScResId( LB_COLOR_FORMAT ) ) ), + maLbEntryTypeMin( new ListBox( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ) ), + maLbEntryTypeMax( new ListBox( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ) ), + maEdMin( new Edit( this, ScResId( ED_COL_SCALE_MIN ) ) ), + maEdMax( new Edit( this, ScResId( ED_COL_SCALE_MAX ) ) ), + maLbColMin( new ColorListBox( this, ScResId( LB_COL_MIN ) ) ), + maLbColMax( new ColorListBox( this, ScResId( LB_COL_MAX ) ) ) { // remove the automatic entry from color scales - maLbEntryTypeMin.RemoveEntry(0); - maLbEntryTypeMax.RemoveEntry(0); + maLbEntryTypeMin->RemoveEntry(0); + maLbEntryTypeMax->RemoveEntry(0); - maLbType.SelectEntryPos(0); - maLbColorFormat.SelectEntryPos(0); + maLbType->SelectEntryPos(0); + maLbColorFormat->SelectEntryPos(0); Init(); if(pFormat) { ScColorScaleFormat::const_iterator itr = pFormat->begin(); - SetColorScaleEntryTypes(*itr, maLbEntryTypeMin, maEdMin, maLbColMin, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMin.get(), *maEdMin.get(), *maLbColMin.get(), pDoc); ++itr; - SetColorScaleEntryTypes(*itr, maLbEntryTypeMax, maEdMax, maLbColMax, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMax.get(), *maEdMax.get(), *maLbColMax.get(), pDoc); } else { - maLbEntryTypeMin.SelectEntryPos(0); - maLbEntryTypeMax.SelectEntryPos(1); + maLbEntryTypeMin->SelectEntryPos(0); + maLbEntryTypeMax->SelectEntryPos(1); } FreeResource(); - maLbColorFormat.SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); + maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); - EntryTypeHdl(&maLbEntryTypeMin); - EntryTypeHdl(&maLbEntryTypeMax); + EntryTypeHdl(maLbEntryTypeMin.get()); + EntryTypeHdl(maLbEntryTypeMax.get()); +} + +ScColorScale2FrmtEntry::~ScColorScale2FrmtEntry() +{ + dispose(); +} + +void ScColorScale2FrmtEntry::dispose() +{ + maLbColorFormat.disposeAndClear(); + maLbEntryTypeMin.disposeAndClear(); + maLbEntryTypeMax.disposeAndClear(); + maEdMin.disposeAndClear(); + maEdMax.disposeAndClear(); + maLbColMin.disposeAndClear(); + maLbColMax.disposeAndClear(); + ScCondFrmtEntry::dispose(); } void ScColorScale2FrmtEntry::Init() { - maLbEntryTypeMin.SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); - maLbEntryTypeMax.SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); SfxObjectShell* pDocSh = SfxObjectShell::Current(); XColorListRef pColorTable; @@ -789,30 +846,30 @@ void ScColorScale2FrmtEntry::Init() if ( pColorTable.is() ) { // filling the line color box - maLbColMin.SetUpdateMode( false ); - maLbColMax.SetUpdateMode( false ); + maLbColMin->SetUpdateMode( false ); + maLbColMax->SetUpdateMode( false ); for ( long i = 0; i < pColorTable->Count(); ++i ) { XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin.SelectEntryPos(i); + maLbColMin->SelectEntryPos(i); if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - maLbColMax.SelectEntryPos(i); + maLbColMax->SelectEntryPos(i); } - maLbColMin.SetUpdateMode( true ); - maLbColMax.SetUpdateMode( true ); + maLbColMin->SetUpdateMode( true ); + maLbColMax->SetUpdateMode( true ); } } ScFormatEntry* ScColorScale2FrmtEntry::createColorscaleEntry() const { ScColorScaleFormat* pColorScale = new ScColorScaleFormat(mpDoc); - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMin, maLbColMin, maEdMin, mpDoc, maPos)); - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMax, maLbColMax, maEdMax, mpDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMin.get(), *maLbColMin.get(), *maEdMin.get(), mpDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMax.get(), *maLbColMax.get(), *maEdMax.get(), mpDoc, maPos)); return pColorScale; } @@ -828,32 +885,32 @@ ScFormatEntry* ScColorScale2FrmtEntry::GetEntry() const void ScColorScale2FrmtEntry::SetActive() { - maLbColorFormat.Show(); + maLbColorFormat->Show(); - maLbEntryTypeMin.Show(); - maLbEntryTypeMax.Show(); + maLbEntryTypeMin->Show(); + maLbEntryTypeMax->Show(); - maEdMin.Show(); - maEdMax.Show(); + maEdMin->Show(); + maEdMax->Show(); - maLbColMin.Show(); - maLbColMax.Show(); + maLbColMin->Show(); + maLbColMax->Show(); Select(); } void ScColorScale2FrmtEntry::SetInactive() { - maLbColorFormat.Hide(); + maLbColorFormat->Hide(); - maLbEntryTypeMin.Hide(); - maLbEntryTypeMax.Hide(); + maLbEntryTypeMin->Hide(); + maLbEntryTypeMax->Hide(); - maEdMin.Hide(); - maEdMax.Hide(); + maEdMin->Hide(); + maEdMax->Hide(); - maLbColMin.Hide(); - maLbColMax.Hide(); + maLbColMin->Hide(); + maLbColMax->Hide(); Deselect(); } @@ -861,10 +918,10 @@ void ScColorScale2FrmtEntry::SetInactive() IMPL_LINK( ScColorScale2FrmtEntry, EntryTypeHdl, ListBox*, pBox ) { Edit* pEd = NULL; - if (pBox == &maLbEntryTypeMin) - pEd = &maEdMin; - else if (pBox == &maLbEntryTypeMax) - pEd = &maEdMax; + if (pBox == maLbEntryTypeMin.get()) + pEd = maEdMin; + else if (pBox == maLbEntryTypeMax.get()) + pEd = maEdMax.get(); if (!pEd) return 0; @@ -886,56 +943,76 @@ IMPL_LINK( ScColorScale2FrmtEntry, EntryTypeHdl, ListBox*, pBox ) ScColorScale3FrmtEntry::ScColorScale3FrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ), - maLbEntryTypeMin( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ), - maLbEntryTypeMiddle( this, ScResId( LB_TYPE_COL_SCALE_MIDDLE ) ), - maLbEntryTypeMax( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ), - maEdMin( this, ScResId( ED_COL_SCALE_MIN ) ), - maEdMiddle( this, ScResId( ED_COL_SCALE_MIDDLE ) ), - maEdMax( this, ScResId( ED_COL_SCALE_MAX ) ), - maLbColMin( this, ScResId( LB_COL_MIN ) ), - maLbColMiddle( this, ScResId( LB_COL_MIDDLE ) ), - maLbColMax( this, ScResId( LB_COL_MAX ) ) + maLbColorFormat( new ListBox( this, ScResId( LB_COLOR_FORMAT ) ) ), + maLbEntryTypeMin( new ListBox( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ) ), + maLbEntryTypeMiddle( new ListBox( this, ScResId( LB_TYPE_COL_SCALE_MIDDLE ) ) ), + maLbEntryTypeMax( new ListBox( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ) ), + maEdMin( new Edit( this, ScResId( ED_COL_SCALE_MIN ) ) ), + maEdMiddle( new Edit( this, ScResId( ED_COL_SCALE_MIDDLE ) ) ), + maEdMax( new Edit( this, ScResId( ED_COL_SCALE_MAX ) ) ), + maLbColMin( new ColorListBox( this, ScResId( LB_COL_MIN ) ) ), + maLbColMiddle( new ColorListBox( this, ScResId( LB_COL_MIDDLE ) ) ), + maLbColMax( new ColorListBox( this, ScResId( LB_COL_MAX ) ) ) { // remove the automatic entry from color scales - maLbEntryTypeMin.RemoveEntry(0); - maLbEntryTypeMiddle.RemoveEntry(0); - maLbEntryTypeMax.RemoveEntry(0); - maLbColorFormat.SelectEntryPos(1); + maLbEntryTypeMin->RemoveEntry(0); + maLbEntryTypeMiddle->RemoveEntry(0); + maLbEntryTypeMax->RemoveEntry(0); + maLbColorFormat->SelectEntryPos(1); Init(); - maLbType.SelectEntryPos(0); + maLbType->SelectEntryPos(0); if(pFormat) { ScColorScaleFormat::const_iterator itr = pFormat->begin(); - SetColorScaleEntryTypes(*itr, maLbEntryTypeMin, maEdMin, maLbColMin, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMin.get(), *maEdMin.get(), *maLbColMin.get(), pDoc); assert(pFormat->size() == 3); ++itr; - SetColorScaleEntryTypes(*itr, maLbEntryTypeMiddle, maEdMiddle, maLbColMiddle, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMiddle.get(), *maEdMiddle.get(), *maLbColMiddle.get(), pDoc); ++itr; - SetColorScaleEntryTypes(*itr, maLbEntryTypeMax, maEdMax, maLbColMax, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMax.get(), *maEdMax.get(), *maLbColMax.get(), pDoc); } else { - maLbColorFormat.SelectEntryPos(1); - maLbEntryTypeMin.SelectEntryPos(0); - maLbEntryTypeMiddle.SelectEntryPos(2); - maLbEntryTypeMax.SelectEntryPos(1); - maEdMiddle.SetText(OUString::number(50)); + maLbColorFormat->SelectEntryPos(1); + maLbEntryTypeMin->SelectEntryPos(0); + maLbEntryTypeMiddle->SelectEntryPos(2); + maLbEntryTypeMax->SelectEntryPos(1); + maEdMiddle->SetText(OUString::number(50)); } FreeResource(); - maLbColorFormat.SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); - EntryTypeHdl(&maLbEntryTypeMin); - EntryTypeHdl(&maLbEntryTypeMiddle); - EntryTypeHdl(&maLbEntryTypeMax); + maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); + EntryTypeHdl(maLbEntryTypeMin.get()); + EntryTypeHdl(maLbEntryTypeMiddle.get()); + EntryTypeHdl(maLbEntryTypeMax.get()); +} + +ScColorScale3FrmtEntry::~ScColorScale3FrmtEntry() +{ + dispose(); +} + +void ScColorScale3FrmtEntry::dispose() +{ + maLbColorFormat.disposeAndClear(); + maLbEntryTypeMin.disposeAndClear(); + maLbEntryTypeMiddle.disposeAndClear(); + maLbEntryTypeMax.disposeAndClear(); + maEdMin.disposeAndClear(); + maEdMiddle.disposeAndClear(); + maEdMax.disposeAndClear(); + maLbColMin.disposeAndClear(); + maLbColMiddle.disposeAndClear(); + maLbColMax.disposeAndClear(); + ScCondFrmtEntry::dispose(); } void ScColorScale3FrmtEntry::Init() { - maLbEntryTypeMin.SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); - maLbEntryTypeMax.SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); - maLbEntryTypeMiddle.SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMiddle->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); SfxObjectShell* pDocSh = SfxObjectShell::Current(); XColorListRef pColorTable; @@ -951,37 +1028,37 @@ void ScColorScale3FrmtEntry::Init() if ( pColorTable.is() ) { // filling the line color box - maLbColMin.SetUpdateMode( false ); - maLbColMiddle.SetUpdateMode( false ); - maLbColMax.SetUpdateMode( false ); + maLbColMin->SetUpdateMode( false ); + maLbColMiddle->SetUpdateMode( false ); + maLbColMax->SetUpdateMode( false ); for ( long i = 0; i < pColorTable->Count(); ++i ) { XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMiddle.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMiddle->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin.SelectEntryPos(i); + maLbColMin->SelectEntryPos(i); if(pEntry->GetColor() == Color(COL_GREEN)) - maLbColMiddle.SelectEntryPos(i); + maLbColMiddle->SelectEntryPos(i); if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - maLbColMax.SelectEntryPos(i); + maLbColMax->SelectEntryPos(i); } - maLbColMin.SetUpdateMode( true ); - maLbColMiddle.SetUpdateMode( true ); - maLbColMax.SetUpdateMode( true ); + maLbColMin->SetUpdateMode( true ); + maLbColMiddle->SetUpdateMode( true ); + maLbColMax->SetUpdateMode( true ); } } ScFormatEntry* ScColorScale3FrmtEntry::createColorscaleEntry() const { ScColorScaleFormat* pColorScale = new ScColorScaleFormat(mpDoc); - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMin, maLbColMin, maEdMin, mpDoc, maPos)); - if(maLbColorFormat.GetSelectEntryPos() == 1) - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMiddle, maLbColMiddle, maEdMiddle, mpDoc, maPos)); - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMax, maLbColMax, maEdMax, mpDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMin.get(), *maLbColMin.get(), *maEdMin.get(), mpDoc, maPos)); + if(maLbColorFormat->GetSelectEntryPos() == 1) + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMiddle.get(), *maLbColMiddle.get(), *maEdMiddle.get(), mpDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMax.get(), *maLbColMax.get(), *maEdMax.get(), mpDoc, maPos)); return pColorScale; } @@ -997,37 +1074,37 @@ ScFormatEntry* ScColorScale3FrmtEntry::GetEntry() const void ScColorScale3FrmtEntry::SetActive() { - maLbColorFormat.Show(); - maLbEntryTypeMin.Show(); - maLbEntryTypeMiddle.Show(); - maLbEntryTypeMax.Show(); + maLbColorFormat->Show(); + maLbEntryTypeMin->Show(); + maLbEntryTypeMiddle->Show(); + maLbEntryTypeMax->Show(); - maEdMin.Show(); - maEdMiddle.Show(); - maEdMax.Show(); + maEdMin->Show(); + maEdMiddle->Show(); + maEdMax->Show(); - maLbColMin.Show(); - maLbColMiddle.Show(); - maLbColMax.Show(); + maLbColMin->Show(); + maLbColMiddle->Show(); + maLbColMax->Show(); Select(); } void ScColorScale3FrmtEntry::SetInactive() { - maLbColorFormat.Hide(); + maLbColorFormat->Hide(); - maLbEntryTypeMin.Hide(); - maLbEntryTypeMiddle.Hide(); - maLbEntryTypeMax.Hide(); + maLbEntryTypeMin->Hide(); + maLbEntryTypeMiddle->Hide(); + maLbEntryTypeMax->Hide(); - maEdMin.Hide(); - maEdMiddle.Hide(); - maEdMax.Hide(); + maEdMin->Hide(); + maEdMiddle->Hide(); + maEdMax->Hide(); - maLbColMin.Hide(); - maLbColMiddle.Hide(); - maLbColMax.Hide(); + maLbColMin->Hide(); + maLbColMiddle->Hide(); + maLbColMax->Hide(); Deselect(); } @@ -1035,12 +1112,12 @@ void ScColorScale3FrmtEntry::SetInactive() IMPL_LINK( ScColorScale3FrmtEntry, EntryTypeHdl, ListBox*, pBox ) { Edit* pEd = NULL; - if(pBox == &maLbEntryTypeMin) - pEd = &maEdMin; - else if(pBox == &maLbEntryTypeMiddle) - pEd = &maEdMiddle; - else if(pBox == &maLbEntryTypeMax) - pEd = &maEdMax; + if(pBox == maLbEntryTypeMin.get()) + pEd = maEdMin.get(); + else if(pBox == maLbEntryTypeMiddle.get()) + pEd = maEdMiddle.get(); + else if(pBox == maLbEntryTypeMax.get()) + pEd = maEdMax.get(); if (!pEd) return 0; @@ -1062,24 +1139,24 @@ IMPL_LINK( ScColorScale3FrmtEntry, EntryTypeHdl, ListBox*, pBox ) IMPL_LINK_NOARG( ScConditionFrmtEntry, ConditionTypeSelectHdl ) { - sal_Int32 nSelectPos = maLbCondType.GetSelectEntryPos(); + sal_Int32 nSelectPos = maLbCondType->GetSelectEntryPos(); ScConditionMode eMode = EntryPosToConditionMode(nSelectPos); switch(GetNumberEditFields(eMode)) { case 0: - maEdVal1.Hide(); - maEdVal2.Hide(); - maFtVal.Hide(); + maEdVal1->Hide(); + maEdVal2->Hide(); + maFtVal->Hide(); break; case 1: - maEdVal1.Show(); - maEdVal2.Hide(); - maFtVal.Show(); + maEdVal1->Show(); + maEdVal2->Hide(); + maFtVal->Show(); break; case 2: - maEdVal1.Show(); - maEdVal2.Show(); - maFtVal.Show(); + maEdVal1->Show(); + maEdVal2->Show(); + maFtVal->Show(); break; } @@ -1120,35 +1197,51 @@ void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Ed ScDataBarFrmtEntry::ScDataBarFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ), - maLbDataBarMinType( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ), - maLbDataBarMaxType( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ), - maEdDataBarMin( this, ScResId( ED_COL_SCALE_MIN ) ), - maEdDataBarMax( this, ScResId( ED_COL_SCALE_MAX ) ), - maBtOptions( this, ScResId( BTN_OPTIONS ) ) -{ - maLbColorFormat.SelectEntryPos(2); - maLbType.SelectEntryPos(0); + maLbColorFormat( new ListBox( this, ScResId( LB_COLOR_FORMAT ) ) ), + maLbDataBarMinType( new ListBox( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ) ), + maLbDataBarMaxType( new ListBox( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ) ), + maEdDataBarMin( new Edit( this, ScResId( ED_COL_SCALE_MIN ) ) ), + maEdDataBarMax( new Edit( this, ScResId( ED_COL_SCALE_MAX ) ) ), + maBtOptions( new PushButton( this, ScResId( BTN_OPTIONS ) ) ) +{ + maLbColorFormat->SelectEntryPos(2); + maLbType->SelectEntryPos(0); if(pFormat) { mpDataBarData.reset(new ScDataBarFormatData(*pFormat->GetDataBarData())); - SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, maLbDataBarMinType, maEdDataBarMin, pDoc); - SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, maLbDataBarMaxType, maEdDataBarMax, pDoc); + SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, *maLbDataBarMinType.get(), *maEdDataBarMin.get(), pDoc); + SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, *maLbDataBarMaxType.get(), *maEdDataBarMax.get(), pDoc); DataBarTypeSelectHdl(NULL); } else { - maLbDataBarMinType.SelectEntryPos(0); - maLbDataBarMaxType.SelectEntryPos(0); + maLbDataBarMinType->SelectEntryPos(0); + maLbDataBarMaxType->SelectEntryPos(0); DataBarTypeSelectHdl(NULL); } Init(); - maLbColorFormat.SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); + maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); FreeResource(); } +ScDataBarFrmtEntry::~ScDataBarFrmtEntry() +{ + dispose(); +} + +void ScDataBarFrmtEntry::dispose() +{ + maLbColorFormat.disposeAndClear(); + maLbDataBarMinType.disposeAndClear(); + maLbDataBarMaxType.disposeAndClear(); + maEdDataBarMin.disposeAndClear(); + maEdDataBarMax.disposeAndClear(); + maBtOptions.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + ScFormatEntry* ScDataBarFrmtEntry::GetEntry() const { return createDatabarEntry(); @@ -1156,10 +1249,10 @@ ScFormatEntry* ScDataBarFrmtEntry::GetEntry() const void ScDataBarFrmtEntry::Init() { - maLbDataBarMinType.SetSelectHdl( LINK( this, ScDataBarFrmtEntry, DataBarTypeSelectHdl ) ); - maLbDataBarMaxType.SetSelectHdl( LINK( this, ScDataBarFrmtEntry, DataBarTypeSelectHdl ) ); + maLbDataBarMinType->SetSelectHdl( LINK( this, ScDataBarFrmtEntry, DataBarTypeSelectHdl ) ); + maLbDataBarMaxType->SetSelectHdl( LINK( this, ScDataBarFrmtEntry, DataBarTypeSelectHdl ) ); - maBtOptions.SetClickHdl( LINK( this, ScDataBarFrmtEntry, OptionBtnHdl ) ); + maBtOptions->SetClickHdl( LINK( this, ScDataBarFrmtEntry, OptionBtnHdl ) ); if(!mpDataBarData) { @@ -1174,8 +1267,8 @@ void ScDataBarFrmtEntry::Init() ScFormatEntry* ScDataBarFrmtEntry::createDatabarEntry() const { - SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos, true); - SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos, true); + SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), *maLbDataBarMinType.get(), *maEdDataBarMin.get(), mpDoc, maPos, true); + SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), *maLbDataBarMaxType.get(), *maEdDataBarMax.get(), mpDoc, maPos, true); ScDataBarFormat* pDataBar = new ScDataBarFormat(mpDoc); pDataBar->SetDataBarData(new ScDataBarFormatData(*mpDataBarData.get())); return pDataBar; @@ -1188,57 +1281,57 @@ OUString ScDataBarFrmtEntry::GetExpressionString() void ScDataBarFrmtEntry::SetActive() { - maLbColorFormat.Show(); + maLbColorFormat->Show(); - maLbDataBarMinType.Show(); - maLbDataBarMaxType.Show(); - maEdDataBarMin.Show(); - maEdDataBarMax.Show(); - maBtOptions.Show(); + maLbDataBarMinType->Show(); + maLbDataBarMaxType->Show(); + maEdDataBarMin->Show(); + maEdDataBarMax->Show(); + maBtOptions->Show(); Select(); } void ScDataBarFrmtEntry::SetInactive() { - maLbColorFormat.Hide(); + maLbColorFormat->Hide(); - maLbDataBarMinType.Hide(); - maLbDataBarMaxType.Hide(); - maEdDataBarMin.Hide(); - maEdDataBarMax.Hide(); - maBtOptions.Hide(); + maLbDataBarMinType->Hide(); + maLbDataBarMaxType->Hide(); + maEdDataBarMin->Hide(); + maEdDataBarMax->Hide(); + maBtOptions->Hide(); Deselect(); } IMPL_LINK_NOARG( ScDataBarFrmtEntry, DataBarTypeSelectHdl ) { - sal_Int32 nSelectPos = maLbDataBarMinType.GetSelectEntryPos(); + sal_Int32 nSelectPos = maLbDataBarMinType->GetSelectEntryPos(); if(nSelectPos <= COLORSCALE_MAX) - maEdDataBarMin.Disable(); + maEdDataBarMin->Disable(); else - maEdDataBarMin.Enable(); + maEdDataBarMin->Enable(); - nSelectPos = maLbDataBarMaxType.GetSelectEntryPos(); + nSelectPos = maLbDataBarMaxType->GetSelectEntryPos(); if(nSelectPos <= COLORSCALE_MAX) - maEdDataBarMax.Disable(); + maEdDataBarMax->Disable(); else - maEdDataBarMax.Enable(); + maEdDataBarMax->Enable(); return 0; } IMPL_LINK_NOARG( ScDataBarFrmtEntry, OptionBtnHdl ) { - SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos, true); - SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos, true); + SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), *maLbDataBarMinType.get(), *maEdDataBarMin.get(), mpDoc, maPos, true); + SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), *maLbDataBarMaxType.get(), *maEdDataBarMax.get(), mpDoc, maPos, true); ScDataBarSettingsDlg* pDlg = new ScDataBarSettingsDlg(this, *mpDataBarData, mpDoc, maPos); if( pDlg->Execute() == RET_OK) { mpDataBarData.reset(pDlg->GetData()); - SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, maLbDataBarMinType, maEdDataBarMin, mpDoc); - SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, maLbDataBarMaxType, maEdDataBarMax, mpDoc); + SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, *maLbDataBarMinType, *maEdDataBarMin.get(), mpDoc); + SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, *maLbDataBarMaxType.get(), *maEdDataBarMax.get(), mpDoc); DataBarTypeSelectHdl(NULL); } return 0; @@ -1246,10 +1339,10 @@ IMPL_LINK_NOARG( ScDataBarFrmtEntry, OptionBtnHdl ) ScDateFrmtEntry::ScDateFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat ): ScCondFrmtEntry( pParent, pDoc, ScAddress() ), - maLbDateEntry( this, ScResId( LB_DATE_TYPE ) ), - maFtStyle( this, ScResId( FT_STYLE ) ), - maLbStyle( this, ScResId( LB_STYLE ) ), - maWdPreview( this, ScResId( WD_PREVIEW ) ), + maLbDateEntry( new ListBox( this, ScResId( LB_DATE_TYPE ) ) ), + maFtStyle( new FixedText( this, ScResId( FT_STYLE ) ) ), + maLbStyle( new ListBox( this, ScResId( LB_STYLE ) ) ), + maWdPreview( new SvxFontPrevWindow( this, ScResId( WD_PREVIEW ) ) ), mbIsInStyleCreate(false) { Init(); @@ -1260,41 +1353,55 @@ ScDateFrmtEntry::ScDateFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const if(pFormat) { sal_Int32 nPos = static_cast<sal_Int32>(pFormat->GetDateType()); - maLbDateEntry.SelectEntryPos(nPos); + maLbDateEntry->SelectEntryPos(nPos); OUString aStyleName = pFormat->GetStyleName(); - maLbStyle.SelectEntry(aStyleName); + maLbStyle->SelectEntry(aStyleName); } StyleSelectHdl(NULL); } +ScDateFrmtEntry::~ScDateFrmtEntry() +{ + dispose(); +} + +void ScDateFrmtEntry::dispose() +{ + maLbDateEntry.disposeAndClear(); + maFtStyle.disposeAndClear(); + maLbStyle.disposeAndClear(); + maWdPreview.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + void ScDateFrmtEntry::Init() { - maLbDateEntry.SelectEntryPos(0); - maLbType.SelectEntryPos(3); + maLbDateEntry->SelectEntryPos(0); + maLbType->SelectEntryPos(3); - FillStyleListBox( mpDoc, maLbStyle ); - maLbStyle.SetSelectHdl( LINK( this, ScDateFrmtEntry, StyleSelectHdl ) ); - maLbStyle.SelectEntryPos(1); + FillStyleListBox( mpDoc, *maLbStyle.get() ); + maLbStyle->SetSelectHdl( LINK( this, ScDateFrmtEntry, StyleSelectHdl ) ); + maLbStyle->SelectEntryPos(1); } void ScDateFrmtEntry::SetActive() { - maLbDateEntry.Show(); - maFtStyle.Show(); - maWdPreview.Show(); - maLbStyle.Show(); + maLbDateEntry->Show(); + maFtStyle->Show(); + maWdPreview->Show(); + maLbStyle->Show(); Select(); } void ScDateFrmtEntry::SetInactive() { - maLbDateEntry.Hide(); - maFtStyle.Hide(); - maWdPreview.Hide(); - maLbStyle.Hide(); + maLbDateEntry->Hide(); + maFtStyle->Hide(); + maWdPreview->Hide(); + maLbStyle->Hide(); Deselect(); } @@ -1309,16 +1416,16 @@ void ScDateFrmtEntry::Notify( SfxBroadcaster&, const SfxHint& rHint ) if(nHint == SFX_STYLESHEET_MODIFIED) { if(!mbIsInStyleCreate) - UpdateStyleList(maLbStyle, mpDoc); + UpdateStyleList(*maLbStyle.get(), mpDoc); } } ScFormatEntry* ScDateFrmtEntry::GetEntry() const { ScCondDateFormatEntry* pNewEntry = new ScCondDateFormatEntry(mpDoc); - condformat::ScCondFormatDateType eType = static_cast<condformat::ScCondFormatDateType>(maLbDateEntry.GetSelectEntryPos()); + condformat::ScCondFormatDateType eType = static_cast<condformat::ScCondFormatDateType>(maLbDateEntry->GetSelectEntryPos()); pNewEntry->SetDateType(eType); - pNewEntry->SetStyleName(maLbStyle.GetSelectEntry()); + pNewEntry->SetStyleName(maLbStyle->GetSelectEntry()); return pNewEntry; } @@ -1330,7 +1437,7 @@ OUString ScDateFrmtEntry::GetExpressionString() IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl ) { mbIsInStyleCreate = true; - StyleSelect( maLbStyle, mpDoc, maWdPreview ); + StyleSelect( *maLbStyle.get(), mpDoc, *maWdPreview.get() ); mbIsInStyleCreate = false; return 0; @@ -1339,14 +1446,16 @@ IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl ) class ScIconSetFrmtDataEntry : public Control { private: - FixedImage maImgIcon; - FixedText maFtEntry; - Edit maEdEntry; - ListBox maLbEntryType; + VclPtr<FixedImage> maImgIcon; + VclPtr<FixedText> maFtEntry; + VclPtr<Edit> maEdEntry; + VclPtr<ListBox> maLbEntryType; public: ScIconSetFrmtDataEntry( vcl::Window* pParent, ScIconSetType eType, ScDocument* pDoc, sal_Int32 i, const ScColorScaleEntry* pEntry = NULL ); + virtual ~ScIconSetFrmtDataEntry(); + virtual void dispose() SAL_OVERRIDE; ScColorScaleEntry* CreateEntry(ScDocument* pDoc, const ScAddress& rPos) const; @@ -1355,31 +1464,31 @@ class ScIconSetFrmtDataEntry : public Control ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry( vcl::Window* pParent, ScIconSetType eType, ScDocument* pDoc, sal_Int32 i, const ScColorScaleEntry* pEntry ): Control( pParent, ScResId( RID_ICON_SET_ENTRY ) ), - maImgIcon( this, ScResId( IMG_ICON ) ), - maFtEntry( this, ScResId( FT_ICON_SET_ENTRY_TEXT ) ), - maEdEntry( this, ScResId( ED_ICON_SET_ENTRY_VALUE ) ), - maLbEntryType( this, ScResId( LB_ICON_SET_ENTRY_TYPE ) ) + maImgIcon( new FixedImage( this, ScResId( IMG_ICON ) ) ), + maFtEntry( new FixedText( this, ScResId( FT_ICON_SET_ENTRY_TEXT ) ) ), + maEdEntry( new Edit( this, ScResId( ED_ICON_SET_ENTRY_VALUE ) ) ), + maLbEntryType( new ListBox( this, ScResId( LB_ICON_SET_ENTRY_TYPE ) ) ) { - maImgIcon.SetImage(Image(ScIconSetFormat::getBitmap(eType, i))); + maImgIcon->SetImage(Image(ScIconSetFormat::getBitmap(eType, i))); if(pEntry) { switch(pEntry->GetType()) { case COLORSCALE_VALUE: - maLbEntryType.SelectEntryPos(0); - maEdEntry.SetText(convertNumberToString(pEntry->GetValue(), pDoc)); + maLbEntryType->SelectEntryPos(0); + maEdEntry->SetText(convertNumberToString(pEntry->GetValue(), pDoc)); break; case COLORSCALE_PERCENTILE: - maLbEntryType.SelectEntryPos(2); - maEdEntry.SetText(convertNumberToString(pEntry->GetValue(), pDoc)); + maLbEntryType->SelectEntryPos(2); + maEdEntry->SetText(convertNumberToString(pEntry->GetValue(), pDoc)); break; case COLORSCALE_PERCENT: - maLbEntryType.SelectEntryPos(1); - maEdEntry.SetText(convertNumberToString(pEntry->GetValue(), pDoc)); + maLbEntryType->SelectEntryPos(1); + maEdEntry->SetText(convertNumberToString(pEntry->GetValue(), pDoc)); break; case COLORSCALE_FORMULA: - maLbEntryType.SelectEntryPos(3); - maEdEntry.SetText(pEntry->GetFormula(formula::FormulaGrammar::GRAM_DEFAULT)); + maLbEntryType->SelectEntryPos(3); + maEdEntry->SetText(pEntry->GetFormula(formula::FormulaGrammar::GRAM_DEFAULT)); break; default: assert(false); @@ -1387,15 +1496,29 @@ ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry( vcl::Window* pParent, ScIconSetT } else { - maLbEntryType.SelectEntryPos(1); + maLbEntryType->SelectEntryPos(1); } FreeResource(); } +ScIconSetFrmtDataEntry::~ScIconSetFrmtDataEntry() +{ + dispose(); +} + +void ScIconSetFrmtDataEntry::dispose() +{ + maImgIcon.disposeAndClear(); + maFtEntry.disposeAndClear(); + maEdEntry.disposeAndClear(); + maLbEntryType.disposeAndClear(); + Control::dispose(); +} + ScColorScaleEntry* ScIconSetFrmtDataEntry::CreateEntry(ScDocument* pDoc, const ScAddress& rPos) const { - sal_Int32 nPos = maLbEntryType.GetSelectEntryPos(); - OUString aText = maEdEntry.GetText(); + sal_Int32 nPos = maLbEntryType->GetSelectEntryPos(); + OUString aText = maEdEntry->GetText(); ScColorScaleEntry* pEntry = new ScColorScaleEntry(); sal_uInt32 nIndex = 0; @@ -1428,28 +1551,28 @@ ScColorScaleEntry* ScIconSetFrmtDataEntry::CreateEntry(ScDocument* pDoc, const S void ScIconSetFrmtDataEntry::SetFirstEntry() { - maEdEntry.Hide(); - maLbEntryType.Hide(); - maFtEntry.Hide(); - maEdEntry.SetText(OUString("0")); - maLbEntryType.SelectEntryPos(1); + maEdEntry->Hide(); + maLbEntryType->Hide(); + maFtEntry->Hide(); + maEdEntry->SetText(OUString("0")); + maLbEntryType->SelectEntryPos(1); } ScIconSetFrmtEntry::ScIconSetFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ), - maLbIconSetType( this, ScResId( LB_ICONSET_TYPE ) ) + maLbColorFormat( new ListBox( this, ScResId( LB_COLOR_FORMAT ) ) ), + maLbIconSetType( new ListBox( this, ScResId( LB_ICONSET_TYPE ) ) ) { Init(); FreeResource(); - maLbColorFormat.SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); + maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); if(pFormat) { const ScIconSetFormatData* pIconSetFormatData = pFormat->GetIconSetData(); ScIconSetType eType = pIconSetFormatData->eIconSetType; sal_Int32 nType = static_cast<sal_Int32>(eType); - maLbIconSetType.SelectEntryPos(nType); + maLbIconSetType->SelectEntryPos(nType); for(size_t i = 0, n = pIconSetFormatData->maEntries.size(); i < n; ++i) @@ -1465,20 +1588,32 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, IconSetTypeHdl(NULL); } +ScIconSetFrmtEntry::~ScIconSetFrmtEntry() +{ + dispose(); +} + +void ScIconSetFrmtEntry::dispose() +{ + maLbColorFormat.disposeAndClear(); + maLbIconSetType.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + void ScIconSetFrmtEntry::Init() { - maLbColorFormat.SelectEntryPos(3); - maLbType.SelectEntryPos(0); - maLbIconSetType.SelectEntryPos(0); + maLbColorFormat->SelectEntryPos(3); + maLbType->SelectEntryPos(0); + maLbIconSetType->SelectEntryPos(0); - maLbIconSetType.SetSelectHdl( LINK( this, ScIconSetFrmtEntry, IconSetTypeHdl ) ); + maLbIconSetType->SetSelectHdl( LINK( this, ScIconSetFrmtEntry, IconSetTypeHdl ) ); } IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl ) { ScIconSetMap* pMap = ScIconSetFormat::getIconSetMap(); - sal_Int32 nPos = maLbIconSetType.GetSelectEntryPos(); + sal_Int32 nPos = maLbIconSetType->GetSelectEntryPos(); sal_uInt32 nElements = pMap[nPos].nElements; maEntries.clear(); @@ -1505,8 +1640,8 @@ OUString ScIconSetFrmtEntry::GetExpressionString() void ScIconSetFrmtEntry::SetActive() { - maLbColorFormat.Show(); - maLbIconSetType.Show(); + maLbColorFormat->Show(); + maLbIconSetType->Show(); for(ScIconSetFrmtDataEntriesType::iterator itr = maEntries.begin(), itrEnd = maEntries.end(); itr != itrEnd; ++itr) { @@ -1518,8 +1653,8 @@ void ScIconSetFrmtEntry::SetActive() void ScIconSetFrmtEntry::SetInactive() { - maLbColorFormat.Hide(); - maLbIconSetType.Hide(); + maLbColorFormat->Hide(); + maLbIconSetType->Hide(); for(ScIconSetFrmtDataEntriesType::iterator itr = maEntries.begin(), itrEnd = maEntries.end(); itr != itrEnd; ++itr) { @@ -1534,7 +1669,7 @@ ScFormatEntry* ScIconSetFrmtEntry::GetEntry() const ScIconSetFormat* pFormat = new ScIconSetFormat(mpDoc); ScIconSetFormatData* pData = new ScIconSetFormatData; - pData->eIconSetType = static_cast<ScIconSetType>(maLbIconSetType.GetSelectEntryPos()); + pData->eIconSetType = static_cast<ScIconSetType>(maLbIconSetType->GetSelectEntryPos()); for(ScIconSetFrmtDataEntriesType::const_iterator itr = maEntries.begin(), itrEnd = maEntries.end(); itr != itrEnd; ++itr) { diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 2a6ff24bc5b3..bbdba3b5d7e1 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -133,8 +133,14 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument* ScCondFormatManagerDlg::~ScCondFormatManagerDlg() { + dispose(); +} + +void ScCondFormatManagerDlg::dispose() +{ delete m_pCtrlManager; delete mpFormatList; + ModalDialog::dispose(); } diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx index a8b6c737d010..835dadafa614 100644 --- a/sc/source/ui/dbgui/consdlg.cxx +++ b/sc/source/ui/dbgui/consdlg.cxx @@ -105,8 +105,14 @@ ScConsolidateDlg::ScConsolidateDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::W ScConsolidateDlg::~ScConsolidateDlg() { + dispose(); +} + +void ScConsolidateDlg::dispose() +{ delete [] pAreaData; delete pRangeUtil; + ScAnyRefDlg::dispose(); } void ScConsolidateDlg::Init() diff --git a/sc/source/ui/dbgui/csvcontrol.cxx b/sc/source/ui/dbgui/csvcontrol.cxx index ac0b16c91122..49855777c9c0 100644 --- a/sc/source/ui/dbgui/csvcontrol.cxx +++ b/sc/source/ui/dbgui/csvcontrol.cxx @@ -74,8 +74,14 @@ ScCsvControl::ScCsvControl( vcl::Window* pParent, const ScCsvLayoutData& rData, ScCsvControl::~ScCsvControl() { + dispose(); +} + +void ScCsvControl::dispose() +{ if( mpAccessible ) mpAccessible->dispose(); + Control::dispose(); } // event handling ------------------------------------------------------------- diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index f99a609ea52a..03ad25d90668 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -85,9 +85,15 @@ ScCsvGrid::ScCsvGrid( ScCsvControl& rParent ) : ScCsvGrid::~ScCsvGrid() { + dispose(); +} + +void ScCsvGrid::dispose() +{ OSL_ENSURE(mpColorConfig, "the object hasn't been initialized properly"); if (mpColorConfig) mpColorConfig->RemoveListener(this); + ScCsvControl::dispose(); } void diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index 71a1ce4f4c84..1d2187fb8441 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -101,7 +101,13 @@ ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) : ScCsvRuler::~ScCsvRuler() { + dispose(); +} + +void ScCsvRuler::dispose() +{ save_FixedWidthList( maSplits ); + ScCsvControl::dispose(); } // common ruler handling ------------------------------------------------------ diff --git a/sc/source/ui/dbgui/csvtablebox.cxx b/sc/source/ui/dbgui/csvtablebox.cxx index 424bcc0b6dd7..c44b33170ae4 100644 --- a/sc/source/ui/dbgui/csvtablebox.cxx +++ b/sc/source/ui/dbgui/csvtablebox.cxx @@ -25,35 +25,50 @@ ScCsvTableBox::ScCsvTableBox( vcl::Window* pParent, WinBits nBits ) : ScCsvControl( pParent, maData, nBits ), - maRuler( *this ), - maGrid( *this ), - maHScroll( this, WB_HORZ | WB_DRAG ), - maVScroll( this, WB_VERT | WB_DRAG ), - maScrollBox( this ) + maRuler( new ScCsvRuler(*this) ), + maGrid( new ScCsvGrid(*this) ), + maHScroll( new ScrollBar( this, WB_HORZ | WB_DRAG ) ), + maVScroll( new ScrollBar( this, WB_VERT | WB_DRAG ) ), + maScrollBox( new ScrollBarBox(this) ) { mbFixedMode = false; mnFixedWidth = 1; - maHScroll.EnableRTL( false ); // RTL - maHScroll.SetLineSize( 1 ); - maVScroll.SetLineSize( 1 ); + maHScroll->EnableRTL( false ); // RTL + maHScroll->SetLineSize( 1 ); + maVScroll->SetLineSize( 1 ); Link aLink = LINK( this, ScCsvTableBox, CsvCmdHdl ); SetCmdHdl( aLink ); - maRuler.SetCmdHdl( aLink ); - maGrid.SetCmdHdl( aLink ); + maRuler->SetCmdHdl( aLink ); + maGrid->SetCmdHdl( aLink ); aLink = LINK( this, ScCsvTableBox, ScrollHdl ); - maHScroll.SetScrollHdl( aLink ); - maVScroll.SetScrollHdl( aLink ); + maHScroll->SetScrollHdl( aLink ); + maVScroll->SetScrollHdl( aLink ); aLink = LINK( this, ScCsvTableBox, ScrollEndHdl ); - maHScroll.SetEndScrollHdl( aLink ); - maVScroll.SetEndScrollHdl( aLink ); + maHScroll->SetEndScrollHdl( aLink ); + maVScroll->SetEndScrollHdl( aLink ); InitControls(); } +ScCsvTableBox::~ScCsvTableBox() +{ + dispose(); +} + +void ScCsvTableBox::dispose() +{ + maRuler.disposeAndClear(); + maGrid.disposeAndClear(); + maHScroll.disposeAndClear(); + maVScroll.disposeAndClear(); + maScrollBox.disposeAndClear(); + ScCsvControl::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScCsvTableBox(vcl::Window *pParent, VclBuilder::stringmap &) { return new ScCsvTableBox(pParent, WB_BORDER); @@ -73,7 +88,7 @@ void ScCsvTableBox::SetSeparatorsMode() { // rescue data for fixed width mode mnFixedWidth = GetPosCount(); - maFixColStates = maGrid.GetColumnStates(); + maFixColStates = maGrid->GetColumnStates(); // switch to separators mode mbFixedMode = false; // reset and reinitialize controls @@ -81,7 +96,7 @@ void ScCsvTableBox::SetSeparatorsMode() Execute( CSVCMD_SETLINEOFFSET, 0 ); Execute( CSVCMD_SETPOSCOUNT, 1 ); Execute( CSVCMD_NEWCELLTEXTS ); - maGrid.SetColumnStates( maSepColStates ); + maGrid->SetColumnStates( maSepColStates ); InitControls(); EnableRepaint(); } @@ -92,15 +107,15 @@ void ScCsvTableBox::SetFixedWidthMode() if( !mbFixedMode ) { // rescue data for separators mode - maSepColStates = maGrid.GetColumnStates(); + maSepColStates = maGrid->GetColumnStates(); // switch to fixed width mode mbFixedMode = true; // reset and reinitialize controls DisableRepaint(); Execute( CSVCMD_SETLINEOFFSET, 0 ); Execute( CSVCMD_SETPOSCOUNT, mnFixedWidth ); - maGrid.SetSplits( maRuler.GetSplits() ); - maGrid.SetColumnStates( maFixColStates ); + maGrid->SetSplits( maRuler->GetSplits() ); + maGrid->SetColumnStates( maFixColStates ); InitControls(); EnableRepaint(); } @@ -108,12 +123,12 @@ void ScCsvTableBox::SetFixedWidthMode() void ScCsvTableBox::Init() { - maGrid.Init(); + maGrid->Init(); } void ScCsvTableBox::InitControls() { - maGrid.UpdateLayoutData(); + maGrid->UpdateLayoutData(); long nScrollBarSize = GetSettings().GetStyleSettings().GetScrollBarSize(); Size aWinSize = CalcOutputSize( GetSizePixel() ); @@ -126,30 +141,30 @@ void ScCsvTableBox::InitControls() if( mbFixedMode ) { // ruler sets height internally - maRuler.setPosSizePixel( 0, 0, nDataWidth, 0 ); - sal_Int32 nY = maRuler.GetSizePixel().Height(); + maRuler->setPosSizePixel( 0, 0, nDataWidth, 0 ); + sal_Int32 nY = maRuler->GetSizePixel().Height(); maData.mnWinHeight -= nY; - maGrid.setPosSizePixel( 0, nY, nDataWidth, maData.mnWinHeight ); + maGrid->setPosSizePixel( 0, nY, nDataWidth, maData.mnWinHeight ); } else - maGrid.setPosSizePixel( 0, 0, nDataWidth, nDataHeight ); - maGrid.Show(); - maRuler.Show( mbFixedMode ); + maGrid->setPosSizePixel( 0, 0, nDataWidth, nDataHeight ); + maGrid->Show(); + maRuler->Show( mbFixedMode ); // scrollbars always visible - maHScroll.setPosSizePixel( 0, nDataHeight, nDataWidth, nScrollBarSize ); + maHScroll->setPosSizePixel( 0, nDataHeight, nDataWidth, nScrollBarSize ); InitHScrollBar(); - maHScroll.Show(); + maHScroll->Show(); // scrollbars always visible - maVScroll.setPosSizePixel( nDataWidth, 0, nScrollBarSize, nDataHeight ); + maVScroll->setPosSizePixel( nDataWidth, 0, nScrollBarSize, nDataHeight ); InitVScrollBar(); - maVScroll.Show(); + maVScroll->Show(); - bool bScrBox = maHScroll.IsVisible() && maVScroll.IsVisible(); + bool bScrBox = maHScroll->IsVisible() && maVScroll->IsVisible(); if( bScrBox ) - maScrollBox.setPosSizePixel( nDataWidth, nDataHeight, nScrollBarSize, nScrollBarSize ); - maScrollBox.Show( bScrBox ); + maScrollBox->setPosSizePixel( nDataWidth, nDataHeight, nScrollBarSize, nScrollBarSize ); + maScrollBox->Show( bScrBox ); // let the controls self-adjust to visible area Execute( CSVCMD_SETPOSOFFSET, GetFirstVisPos() ); @@ -158,18 +173,18 @@ void ScCsvTableBox::InitControls() void ScCsvTableBox::InitHScrollBar() { - maHScroll.SetRange( Range( 0, GetPosCount() + 2 ) ); - maHScroll.SetVisibleSize( GetVisPosCount() ); - maHScroll.SetPageSize( GetVisPosCount() * 3 / 4 ); - maHScroll.SetThumbPos( GetFirstVisPos() ); + maHScroll->SetRange( Range( 0, GetPosCount() + 2 ) ); + maHScroll->SetVisibleSize( GetVisPosCount() ); + maHScroll->SetPageSize( GetVisPosCount() * 3 / 4 ); + maHScroll->SetThumbPos( GetFirstVisPos() ); } void ScCsvTableBox::InitVScrollBar() { - maVScroll.SetRange( Range( 0, GetLineCount() + 1 ) ); - maVScroll.SetVisibleSize( GetVisLineCount() ); - maVScroll.SetPageSize( GetVisLineCount() - 2 ); - maVScroll.SetThumbPos( GetFirstVisLine() ); + maVScroll->SetRange( Range( 0, GetLineCount() + 1 ) ); + maVScroll->SetVisibleSize( GetVisLineCount() ); + maVScroll->SetPageSize( GetVisLineCount() - 2 ); + maVScroll->SetThumbPos( GetFirstVisLine() ); } void ScCsvTableBox::MakePosVisible( sal_Int32 nPos ) @@ -197,9 +212,9 @@ void ScCsvTableBox::SetUniStrings( for( sal_Int32 nLine = GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString ) { if( mbFixedMode ) - maGrid.ImplSetTextLineFix( nLine, *pString ); + maGrid->ImplSetTextLineFix( nLine, *pString ); else - maGrid.ImplSetTextLineSep( nLine, *pString, rSepChars, cTextSep, bMergeSep ); + maGrid->ImplSetTextLineSep( nLine, *pString, rSepChars, cTextSep, bMergeSep ); } EnableRepaint(); } @@ -212,15 +227,15 @@ void ScCsvTableBox::InitTypes( const ListBox& rListBox ) StringVec aTypeNames( nTypeCount ); for( sal_uInt16 nIndex = 0; nIndex < nTypeCount; ++nIndex ) aTypeNames[ nIndex ] = rListBox.GetEntry( nIndex ); - maGrid.SetTypeNames( aTypeNames ); + maGrid->SetTypeNames( aTypeNames ); } void ScCsvTableBox::FillColumnData( ScAsciiOptions& rOptions ) const { if( mbFixedMode ) - maGrid.FillColumnDataFix( rOptions ); + maGrid->FillColumnDataFix( rOptions ); else - maGrid.FillColumnDataSep( rOptions ); + maGrid->FillColumnDataSep( rOptions ); } // event handling ------------------------------------------------------------- @@ -253,8 +268,8 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl*, pCtrl ) case CSVCMD_REPAINT: if( !IsNoRepaint() ) { - maGrid.ImplRedraw(); - maRuler.ImplRedraw(); + maGrid->ImplRedraw(); + maRuler->ImplRedraw(); InitHScrollBar(); InitVScrollBar(); } @@ -269,12 +284,12 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl*, pCtrl ) else { DisableRepaint(); - ScCsvColStateVec aStates( maGrid.GetColumnStates() ); + ScCsvColStateVec aStates( maGrid->GetColumnStates() ); sal_Int32 nPos = GetFirstVisPos(); Execute( CSVCMD_SETPOSCOUNT, 1 ); Execute( CSVCMD_UPDATECELLTEXTS ); Execute( CSVCMD_SETPOSOFFSET, nPos ); - maGrid.SetColumnStates( aStates ); + maGrid->SetColumnStates( aStates ); EnableRepaint(); } break; @@ -282,40 +297,40 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl*, pCtrl ) maUpdateTextHdl.Call( this ); break; case CSVCMD_SETCOLUMNTYPE: - maGrid.SetSelColumnType( nParam1 ); + maGrid->SetSelColumnType( nParam1 ); break; case CSVCMD_EXPORTCOLUMNTYPE: maColTypeHdl.Call( this ); break; case CSVCMD_SETFIRSTIMPORTLINE: - maGrid.SetFirstImportedLine( nParam1 ); + maGrid->SetFirstImportedLine( nParam1 ); break; case CSVCMD_INSERTSPLIT: OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::InsertSplit - invalid call" ); - if( maRuler.GetSplitCount() + 1 < sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT) ) + if( maRuler->GetSplitCount() + 1 < sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT) ) { - maRuler.InsertSplit( nParam1 ); - maGrid.InsertSplit( nParam1 ); + maRuler->InsertSplit( nParam1 ); + maGrid->InsertSplit( nParam1 ); } break; case CSVCMD_REMOVESPLIT: OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::RemoveSplit - invalid call" ); - maRuler.RemoveSplit( nParam1 ); - maGrid.RemoveSplit( nParam1 ); + maRuler->RemoveSplit( nParam1 ); + maGrid->RemoveSplit( nParam1 ); break; case CSVCMD_TOGGLESPLIT: - Execute( maRuler.HasSplit( nParam1 ) ? CSVCMD_REMOVESPLIT : CSVCMD_INSERTSPLIT, nParam1 ); + Execute( maRuler->HasSplit( nParam1 ) ? CSVCMD_REMOVESPLIT : CSVCMD_INSERTSPLIT, nParam1 ); break; case CSVCMD_MOVESPLIT: OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::MoveSplit - invalid call" ); - maRuler.MoveSplit( nParam1, nParam2 ); - maGrid.MoveSplit( nParam1, nParam2 ); + maRuler->MoveSplit( nParam1, nParam2 ); + maGrid->MoveSplit( nParam1, nParam2 ); break; case CSVCMD_REMOVEALLSPLITS: OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::RemoveAllSplits - invalid call" ); - maRuler.RemoveAllSplits(); - maGrid.RemoveAllSplits(); + maRuler->RemoveAllSplits(); + maGrid->RemoveAllSplits(); break; default: bFound = false; @@ -371,8 +386,8 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl*, pCtrl ) if( maData != aOldData ) { DisableRepaint(); - maRuler.ApplyLayout( aOldData ); - maGrid.ApplyLayout( aOldData ); + maRuler->ApplyLayout( aOldData ); + maGrid->ApplyLayout( aOldData ); EnableRepaint(); } @@ -383,9 +398,9 @@ IMPL_LINK( ScCsvTableBox, ScrollHdl, ScrollBar*, pScrollBar ) { OSL_ENSURE( pScrollBar, "ScCsvTableBox::ScrollHdl - missing sender" ); - if( pScrollBar == &maHScroll ) + if( pScrollBar == maHScroll.get() ) Execute( CSVCMD_SETPOSOFFSET, pScrollBar->GetThumbPos() ); - else if( pScrollBar == &maVScroll ) + else if( pScrollBar == maVScroll.get() ) Execute( CSVCMD_SETLINEOFFSET, pScrollBar->GetThumbPos() ); return 0; @@ -395,12 +410,12 @@ IMPL_LINK( ScCsvTableBox, ScrollEndHdl, ScrollBar*, pScrollBar ) { OSL_ENSURE( pScrollBar, "ScCsvTableBox::ScrollEndHdl - missing sender" ); - if( pScrollBar == &maHScroll ) + if( pScrollBar == maHScroll.get() ) { if( GetRulerCursorPos() != CSV_POS_INVALID ) - Execute( CSVCMD_MOVERULERCURSOR, maRuler.GetNoScrollPos( GetRulerCursorPos() ) ); + Execute( CSVCMD_MOVERULERCURSOR, maRuler->GetNoScrollPos( GetRulerCursorPos() ) ); if( GetGridCursorPos() != CSV_POS_INVALID ) - Execute( CSVCMD_MOVEGRIDCURSOR, maGrid.GetNoScrollCol( GetGridCursorPos() ) ); + Execute( CSVCMD_MOVEGRIDCURSOR, maGrid->GetNoScrollCol( GetGridCursorPos() ) ); } return 0; diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index fef3575368ba..8313dfaa2ac4 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -158,7 +158,13 @@ ScDbNameDlg::ScDbNameDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pPar ScDbNameDlg::~ScDbNameDlg() { + dispose(); +} + +void ScDbNameDlg::dispose() +{ DELETEZ( pSaveObj ); + ScAnyRefDlg::dispose(); } void ScDbNameDlg::Init() diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 5de6d53668fd..40375c8422eb 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -160,12 +160,18 @@ ScFilterDlg::ScFilterDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pPar ScFilterDlg::~ScFilterDlg() { + dispose(); +} + +void ScFilterDlg::dispose() +{ delete pOptionsMgr; delete pOutItem; // Hack: RefInput control pTimer->Stop(); delete pTimer; + ScAnyRefDlg::dispose(); } void ScFilterDlg::Init( const SfxItemSet& rArgSet ) diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index 096c9c2e17dd..6c566bc57172 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -83,10 +83,16 @@ ScPivotFilterDlg::ScPivotFilterDlg(vcl::Window* pParent, const SfxItemSet& rArgS ScPivotFilterDlg::~ScPivotFilterDlg() { + dispose(); +} + +void ScPivotFilterDlg::dispose() +{ for (sal_uInt16 i=0; i<=MAXCOL; i++) delete pEntryLists[i]; delete pOutItem; + ModalDialog::dispose(); } void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index a3b73879b266..2abde832f035 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -464,7 +464,13 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa ScImportAsciiDlg::~ScImportAsciiDlg() { + dispose(); +} + +void ScImportAsciiDlg::dispose() +{ delete[] mpRowPosArray; + ModalDialog::dispose(); } bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString &rText ) diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx index 98ee9d90c898..1cbb4243f297 100644 --- a/sc/source/ui/dbgui/scuiimoptdlg.cxx +++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx @@ -240,8 +240,14 @@ ScImportOptionsDlg::ScImportOptionsDlg( ScImportOptionsDlg::~ScImportOptionsDlg() { + dispose(); +} + +void ScImportOptionsDlg::dispose() +{ delete pFieldSepTab; delete pTextSepTab; + ModalDialog::dispose(); } void ScImportOptionsDlg::GetImportOptions( ScImportOptions& rOptions ) const diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index 380278b8c8b8..c872bb8257f6 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -97,6 +97,11 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc ScSpecialFilterDlg::~ScSpecialFilterDlg() { + dispose(); +} + +void ScSpecialFilterDlg::dispose() +{ sal_uInt16 nEntries = pLbFilterArea->GetEntryCount(); sal_uInt16 i; @@ -111,6 +116,7 @@ ScSpecialFilterDlg::~ScSpecialFilterDlg() // Hack: RefInput-Kontrolle pIdle->Stop(); delete pIdle; + ScAnyRefDlg::dispose(); } void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index 9dbc06600955..8083c0e3a13a 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -516,6 +516,11 @@ ScTabPageSortOptions::ScTabPageSortOptions( vcl::Window* pParent, ScTabPageSortOptions::~ScTabPageSortOptions() { + dispose(); +} + +void ScTabPageSortOptions::dispose() +{ sal_uInt16 nEntries = m_pLbOutPos->GetEntryCount(); for ( sal_uInt16 i=1; i<nEntries; i++ ) @@ -523,6 +528,7 @@ ScTabPageSortOptions::~ScTabPageSortOptions() delete pColRes; delete pColWrap; //! not if from document + SfxTabPage::dispose(); } void ScTabPageSortOptions::Init() diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index 12643fc22c61..a8b4c14e58d0 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -67,6 +67,11 @@ ScTpSubTotalGroup::ScTpSubTotalGroup( vcl::Window* pParent, ScTpSubTotalGroup::~ScTpSubTotalGroup() { + dispose(); +} + +void ScTpSubTotalGroup::dispose() +{ sal_uLong nCount = mpLbColumns->GetEntryCount(); if ( nCount > 0 ) @@ -79,6 +84,7 @@ ScTpSubTotalGroup::~ScTpSubTotalGroup() delete pData; } } + SfxTabPage::dispose(); } void ScTpSubTotalGroup::Init() diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx index f9384ac281e0..b5be34b77d62 100644 --- a/sc/source/ui/dialogs/searchresults.cxx +++ b/sc/source/ui/dialogs/searchresults.cxx @@ -41,7 +41,13 @@ SearchResultsDlg::SearchResultsDlg( SfxBindings* _pBindings, vcl::Window* pParen SearchResultsDlg::~SearchResultsDlg() { + dispose(); +} + +void SearchResultsDlg::dispose() +{ delete mpList; + ModelessDialog::dispose(); } void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatchedRanges ) diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 65604ad60cac..aac3e3c6a476 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -90,12 +90,12 @@ ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP, SfxChildWindow *pCW, vcl::Window* pParent, const ResId& rResId ) : SfxDockingWindow( pBindingsP, pCW, pParent, rResId ), - aPrivatSplit ( this, ResId( FT_SPLIT, *rResId.GetResMgr() ),SC_SPLIT_VERT), - aCatBox ( this, ResId( CB_CAT, *rResId.GetResMgr() ) ), - aFuncList ( this, ResId( LB_FUNC, *rResId.GetResMgr() ) ), - aDDFuncList ( this, ResId( DDLB_FUNC, *rResId.GetResMgr() ) ), - aInsertButton ( this, ResId( IMB_INSERT, *rResId.GetResMgr() ) ), - aFiFuncDesc ( this, ResId( FI_FUNCDESC, *rResId.GetResMgr() ) ), + aPrivatSplit ( new ScPrivatSplit( this, ResId( FT_SPLIT, *rResId.GetResMgr() ),SC_SPLIT_VERT) ), + aCatBox ( new ListBox( this, ResId( CB_CAT, *rResId.GetResMgr() ) ) ), + aFuncList ( new ListBox( this, ResId( LB_FUNC, *rResId.GetResMgr() ) ) ), + aDDFuncList ( new ListBox( this, ResId( DDLB_FUNC, *rResId.GetResMgr() ) ) ), + aInsertButton ( new ImageButton( this, ResId( IMB_INSERT, *rResId.GetResMgr() ) ) ), + aFiFuncDesc ( new FixedText( this, ResId( FI_FUNCDESC, *rResId.GetResMgr() ) ) ), aOldSize (0,0), pFuncDesc (NULL) { @@ -111,45 +111,45 @@ ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP, else eSfxNewAlignment=SfxChildAlignment::RIGHT; eSfxOldAlignment=eSfxNewAlignment; - aFiFuncDesc.SetUpdateMode(true); - pAllFuncList=&aFuncList; - aDDFuncList.Disable(); - aDDFuncList.Hide(); + aFiFuncDesc->SetUpdateMode(true); + pAllFuncList=aFuncList.get(); + aDDFuncList->Disable(); + aDDFuncList->Hide(); nArgs=0; nDockMode=0; bSizeFlag=false; - aCatBox.SetDropDownLineCount(9); - vcl::Font aFont=aFiFuncDesc.GetFont(); + aCatBox->SetDropDownLineCount(9); + vcl::Font aFont=aFiFuncDesc->GetFont(); aFont.SetColor(Color(COL_BLACK)); - aFiFuncDesc.SetFont(aFont); - aFiFuncDesc.SetBackground( GetBackground() ); //! never transparent? + aFiFuncDesc->SetFont(aFont); + aFiFuncDesc->SetBackground( GetBackground() ); //! never transparent? Link aLink=LINK( this, ScFunctionDockWin, SelHdl); - aCatBox.SetSelectHdl(aLink); - aFuncList.SetSelectHdl(aLink); - aDDFuncList.SetSelectHdl(aLink); + aCatBox->SetSelectHdl(aLink); + aFuncList->SetSelectHdl(aLink); + aDDFuncList->SetSelectHdl(aLink); Link a2Link=LINK( this, ScFunctionDockWin, SetSelectionHdl); - aFuncList.SetDoubleClickHdl(a2Link); - aDDFuncList.SetSelectHdl(aLink); - aInsertButton.SetClickHdl(a2Link); + aFuncList->SetDoubleClickHdl(a2Link); + aDDFuncList->SetSelectHdl(aLink); + aInsertButton->SetClickHdl(a2Link); Link a3Link=LINK( this, ScFunctionDockWin, SetSplitHdl); - aPrivatSplit.SetCtrModifiedHdl(a3Link); + aPrivatSplit->SetCtrModifiedHdl(a3Link); StartListening( *pBindingsP, true ); - Point aTopLeft=aCatBox.GetPosPixel(); + Point aTopLeft=aCatBox->GetPosPixel(); OUString aString("ww"); - Size aTxtSize( aFiFuncDesc.GetTextWidth(aString), aFiFuncDesc.GetTextHeight() ); + Size aTxtSize( aFiFuncDesc->GetTextWidth(aString), aFiFuncDesc->GetTextHeight() ); nMinWidth=aTxtSize.Width()+aTopLeft.X() - +2*aFuncList.GetPosPixel().X(); + +2*aFuncList->GetPosPixel().X(); nMinHeight=19*aTxtSize.Height(); - aCatBox.SelectEntryPos(0); + aCatBox->SelectEntryPos(0); - Range aYRange(3*aTxtSize.Height()+aFuncList.GetPosPixel().Y(), + Range aYRange(3*aTxtSize.Height()+aFuncList->GetPosPixel().Y(), GetOutputSizePixel().Height()-2*aTxtSize.Height()); - aPrivatSplit.SetYRange(aYRange); - SelHdl(&aCatBox); + aPrivatSplit->SetYRange(aYRange); + SelHdl(aCatBox.get()); bInit = true; } @@ -169,7 +169,19 @@ ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP, ScFunctionDockWin::~ScFunctionDockWin() { + dispose(); +} + +void ScFunctionDockWin::dispose() +{ EndListening( GetBindings() ); + aPrivatSplit.disposeAndClear(); + aCatBox.disposeAndClear(); + aFuncList.disposeAndClear(); + aDDFuncList.disposeAndClear(); + aInsertButton.disposeAndClear(); + aFiFuncDesc.disposeAndClear(); + SfxDockingWindow::dispose(); } /************************************************************************* @@ -192,7 +204,7 @@ void ScFunctionDockWin::InitLRUList() ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr(); pFuncMgr->fillLastRecentlyUsedFunctions(aLRUList); - sal_Int32 nSelPos = aCatBox.GetSelectEntryPos(); + sal_Int32 nSelPos = aCatBox->GetSelectEntryPos(); if(nSelPos == 0) UpdateFunctionList(); @@ -254,18 +266,18 @@ void ScFunctionDockWin::SetSize() if(nDockMode!=nNewDockMode) { nDockMode=nNewDockMode; - nSelEntry=aFuncList.GetSelectEntryPos(); - aFuncList.Clear(); - aFiFuncDesc.SetPosPixel(aFuncList.GetPosPixel()); - aDDFuncList.Enable(); - aDDFuncList.Show(); - aPrivatSplit.Disable(); - aPrivatSplit.Hide(); - aFuncList.Disable(); - aFuncList.Hide(); - pAllFuncList=&aDDFuncList; - SelHdl(&aCatBox); - aDDFuncList.SelectEntryPos(nSelEntry); + nSelEntry=aFuncList->GetSelectEntryPos(); + aFuncList->Clear(); + aFiFuncDesc->SetPosPixel(aFuncList->GetPosPixel()); + aDDFuncList->Enable(); + aDDFuncList->Show(); + aPrivatSplit->Disable(); + aPrivatSplit->Hide(); + aFuncList->Disable(); + aFuncList->Hide(); + pAllFuncList=aDDFuncList.get(); + SelHdl(aCatBox.get()); + aDDFuncList->SelectEntryPos(nSelEntry); } break; @@ -273,17 +285,17 @@ void ScFunctionDockWin::SetSize() if(nDockMode!=nNewDockMode) { nDockMode=nNewDockMode; - nSelEntry=aDDFuncList.GetSelectEntryPos(); - aDDFuncList.Clear(); - aDDFuncList.Disable(); - aDDFuncList.Hide(); - aPrivatSplit.Enable(); - aPrivatSplit.Show(); - aFuncList.Enable(); - aFuncList.Show(); - pAllFuncList=&aFuncList; - SelHdl(&aCatBox); - aFuncList.SelectEntryPos(nSelEntry); + nSelEntry=aDDFuncList->GetSelectEntryPos(); + aDDFuncList->Clear(); + aDDFuncList->Disable(); + aDDFuncList->Hide(); + aPrivatSplit->Enable(); + aPrivatSplit->Show(); + aFuncList->Enable(); + aFuncList->Show(); + pAllFuncList=aFuncList.get(); + SelHdl(aCatBox.get()); + aFuncList->SelectEntryPos(nSelEntry); } break; } @@ -324,11 +336,11 @@ void ScFunctionDockWin::SetLeftRightSize() aDiffSize.Height()-=aNewSize.Height(); OUString aString("ww"); - Size aTxtSize( aFuncList.GetTextWidth(aString), aFuncList.GetTextHeight() ); + Size aTxtSize( aFuncList->GetTextWidth(aString), aFuncList->GetTextHeight() ); - Range aYRange(3*aTxtSize.Height()+aFuncList.GetPosPixel().Y(), + Range aYRange(3*aTxtSize.Height()+aFuncList->GetPosPixel().Y(), GetOutputSizePixel().Height()-2*aTxtSize.Height()); - aPrivatSplit.SetYRange(aYRange); + aPrivatSplit->SetYRange(aYRange); if(aOldSize.Width()!=aNewSize.Width()) SetMyWidthLeRi(aNewSize); @@ -396,23 +408,23 @@ void ScFunctionDockWin::SetMyWidthLeRi(Size &aNewSize) { if((sal_uLong)aNewSize.Width()<nMinWidth) aNewSize.Width()=nMinWidth; - Size aCDSize=aCatBox.GetSizePixel(); - Size aFLSize=aFuncList.GetSizePixel(); - Size aSplitterSize=aPrivatSplit.GetSizePixel(); - Size aFDSize=aFiFuncDesc.GetSizePixel(); + Size aCDSize=aCatBox->GetSizePixel(); + Size aFLSize=aFuncList->GetSizePixel(); + Size aSplitterSize=aPrivatSplit->GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); - Point aCDTopLeft=aCatBox.GetPosPixel(); - Point aFLTopLeft=aFuncList.GetPosPixel(); + Point aCDTopLeft=aCatBox->GetPosPixel(); + Point aFLTopLeft=aFuncList->GetPosPixel(); aCDSize.Width()=aNewSize.Width()-aCDTopLeft.X()-aFLTopLeft.X(); aFLSize.Width()=aNewSize.Width()-2*aFLTopLeft.X(); aFDSize.Width()=aFLSize.Width(); aSplitterSize.Width()=aFLSize.Width(); - aCatBox.SetSizePixel(aCDSize); - aFuncList.SetSizePixel(aFLSize); - aPrivatSplit.SetSizePixel(aSplitterSize); - aFiFuncDesc.SetSizePixel(aFDSize); + aCatBox->SetSizePixel(aCDSize); + aFuncList->SetSizePixel(aFLSize); + aPrivatSplit->SetSizePixel(aSplitterSize); + aFiFuncDesc->SetSizePixel(aFDSize); } /************************************************************************* @@ -434,18 +446,18 @@ void ScFunctionDockWin::SetMyHeightLeRi(Size &aNewSize) { if((sal_uLong)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight; - Size aFLSize=aFuncList.GetSizePixel(); - Size aSplitterSize=aPrivatSplit.GetSizePixel(); - Size aFDSize=aFiFuncDesc.GetSizePixel(); + Size aFLSize=aFuncList->GetSizePixel(); + Size aSplitterSize=aPrivatSplit->GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); - Point aFLTopLeft=aFuncList.GetPosPixel(); - Point aSplitterTopLeft=aPrivatSplit.GetPosPixel(); - Point aFDTopLeft=aFiFuncDesc.GetPosPixel(); + Point aFLTopLeft=aFuncList->GetPosPixel(); + Point aSplitterTopLeft=aPrivatSplit->GetPosPixel(); + Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); - long nTxtHeight = aFuncList.GetTextHeight(); + long nTxtHeight = aFuncList->GetTextHeight(); short nY=(short)(3*nTxtHeight+ - aFuncList.GetPosPixel().Y()+aSplitterSize.Height()); + aFuncList->GetPosPixel().Y()+aSplitterSize.Height()); aFDTopLeft.Y()=aNewSize.Height()-aFDSize.Height()-4; if(nY>aFDTopLeft.Y()) @@ -456,10 +468,10 @@ void ScFunctionDockWin::SetMyHeightLeRi(Size &aNewSize) aSplitterTopLeft.Y()=aFDTopLeft.Y()-aSplitterSize.Height()-1; aFLSize.Height()=aSplitterTopLeft.Y()-aFLTopLeft.Y()-1; - aFuncList.SetSizePixel(aFLSize); - aPrivatSplit.SetPosPixel(aSplitterTopLeft); - aFiFuncDesc.SetPosPixel(aFDTopLeft); - aFiFuncDesc.SetSizePixel(aFDSize); + aFuncList->SetSizePixel(aFLSize); + aPrivatSplit->SetPosPixel(aSplitterTopLeft); + aFiFuncDesc->SetPosPixel(aFDTopLeft); + aFiFuncDesc->SetSizePixel(aFDSize); } @@ -483,13 +495,13 @@ void ScFunctionDockWin::SetMyWidthToBo(Size &aNewSize) { if((sal_uLong)aNewSize.Width()<nMinWidth) aNewSize.Width()=nMinWidth; - Size aCDSize=aCatBox.GetSizePixel(); - Size aDdFLSize=aDDFuncList.GetSizePixel(); - Size aFDSize=aFiFuncDesc.GetSizePixel(); + Size aCDSize=aCatBox->GetSizePixel(); + Size aDdFLSize=aDDFuncList->GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); - Point aCDTopLeft=aCatBox.GetPosPixel(); - Point aDdFLTopLeft=aDDFuncList.GetPosPixel(); - Point aFDTopLeft=aFiFuncDesc.GetPosPixel(); + Point aCDTopLeft=aCatBox->GetPosPixel(); + Point aDdFLTopLeft=aDDFuncList->GetPosPixel(); + Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); aCDSize.Width()=aDdFLTopLeft.X()-aFDTopLeft.X()-aCDTopLeft.X(); aDdFLTopLeft.X()=aCDSize.Width()+aCDTopLeft.X()+aFDTopLeft.X(); @@ -498,10 +510,10 @@ void ScFunctionDockWin::SetMyWidthToBo(Size &aNewSize) aFDSize.Width()=aNewSize.Width()-2*aFDTopLeft.X(); - aDDFuncList.SetPosPixel(aDdFLTopLeft); - aDDFuncList.SetSizePixel(aDdFLSize); - aCatBox.SetSizePixel(aCDSize); - aFiFuncDesc.SetSizePixel(aFDSize); + aDDFuncList->SetPosPixel(aDdFLTopLeft); + aDDFuncList->SetSizePixel(aDdFLSize); + aCatBox->SetSizePixel(aCDSize); + aFiFuncDesc->SetSizePixel(aFDSize); } /************************************************************************* @@ -524,12 +536,12 @@ void ScFunctionDockWin::SetMyHeightToBo(Size &aNewSize) { if((sal_uLong)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight; - Size aFDSize=aFiFuncDesc.GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); - Point aFDTopLeft=aFiFuncDesc.GetPosPixel(); - Point aCBTopLeft=aCatBox.GetPosPixel(); + Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); + Point aCBTopLeft=aCatBox->GetPosPixel(); aFDSize.Height()=aNewSize.Height()-aFDTopLeft.Y()-aCBTopLeft.Y(); - aFiFuncDesc.SetSizePixel(aFDSize); + aFiFuncDesc->SetSizePixel(aFDSize); } @@ -549,7 +561,7 @@ void ScFunctionDockWin::SetMyHeightToBo(Size &aNewSize) void ScFunctionDockWin::SetDescription() { - aFiFuncDesc.SetText( EMPTY_OUSTRING ); + aFiFuncDesc->SetText( EMPTY_OUSTRING ); const ScFuncDesc* pDesc = static_cast<const ScFuncDesc*>(pAllFuncList->GetEntryData( pAllFuncList->GetSelectEntryPos() )); @@ -580,10 +592,10 @@ void ScFunctionDockWin::SetDescription() aBuf.append(*pDesc->pFuncDesc); - aFiFuncDesc.SetText(aBuf.makeStringAndClear()); - aFiFuncDesc.StateChanged(StateChangedType::TEXT); - aFiFuncDesc.Invalidate(); - aFiFuncDesc.Update(); + aFiFuncDesc->SetText(aBuf.makeStringAndClear()); + aFiFuncDesc->StateChanged(StateChangedType::TEXT); + aFiFuncDesc->Invalidate(); + aFiFuncDesc->Update(); } } @@ -641,7 +653,7 @@ SfxChildAlignment ScFunctionDockWin::CheckAlignment(SfxChildAlignment /* abla */ SfxChildAlignment aChildAlign) { OUString aString("ww"); - Size aTxtSize( aFiFuncDesc.GetTextWidth(aString), aFiFuncDesc.GetTextHeight() ); + Size aTxtSize( aFiFuncDesc->GetTextWidth(aString), aFiFuncDesc->GetTextHeight() ); if(!bInit) { eSfxOldAlignment=eSfxNewAlignment; @@ -671,14 +683,14 @@ SfxChildAlignment ScFunctionDockWin::CheckAlignment(SfxChildAlignment /* abla */ case SfxChildAlignment::NOALIGNMENT: - aString = aCatBox.GetEntry(0); + aString = aCatBox->GetEntry(0); aString += "www"; - aTxtSize = Size( aFiFuncDesc.GetTextWidth(aString), - aFiFuncDesc.GetTextHeight() ); + aTxtSize = Size( aFiFuncDesc->GetTextWidth(aString), + aFiFuncDesc->GetTextHeight() ); // fall-through - default: Point aTopLeft=aCatBox.GetPosPixel(); + default: Point aTopLeft=aCatBox->GetPosPixel(); nMinWidth=aTxtSize.Width()+aTopLeft.X() - +2*aFuncList.GetPosPixel().X(); + +2*aFuncList->GetPosPixel().X(); nMinHeight=19*aTxtSize.Height(); break; @@ -733,7 +745,7 @@ void ScFunctionDockWin::Resize() void ScFunctionDockWin::UpdateFunctionList() { - sal_Int32 nSelPos = aCatBox.GetSelectEntryPos(); + sal_Int32 nSelPos = aCatBox->GetSelectEntryPos(); sal_Int32 nCategory = ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) ? (nSelPos-1) : 0; @@ -912,13 +924,13 @@ void ScFunctionDockWin::DoEnter() IMPL_LINK( ScFunctionDockWin, SelHdl, ListBox*, pLb ) { - if ( pLb == &aCatBox) + if ( pLb == aCatBox.get() ) { UpdateFunctionList(); SetDescription(); } - if ( pLb == &aFuncList||pLb == &aDDFuncList) + if ( pLb == aFuncList.get() || pLb == aDDFuncList.get() ) { SetDescription(); } @@ -944,8 +956,8 @@ IMPL_LINK( ScFunctionDockWin, SelHdl, ListBox*, pLb ) IMPL_LINK( ScFunctionDockWin, SetSelectionHdl, void*, pCtrl ) { - if (static_cast<ImageButton *>(pCtrl) == &aInsertButton || - static_cast<ListBox *>(pCtrl) == &aFuncList) + if (static_cast<ImageButton *>(pCtrl) == aInsertButton.get() || + static_cast<ListBox *>(pCtrl) == aFuncList.get()) { DoEnter(); // Uebernimmt die Eingabe } @@ -970,19 +982,19 @@ IMPL_LINK( ScFunctionDockWin, SetSelectionHdl, void*, pCtrl ) IMPL_LINK( ScFunctionDockWin, SetSplitHdl, ScPrivatSplit*, pCtrl ) { - if (pCtrl == &aPrivatSplit) + if (pCtrl == aPrivatSplit.get()) { - short nDeltaY=aPrivatSplit.GetDeltaY(); - Size aFLSize=aFuncList.GetSizePixel(); - Size aFDSize=aFiFuncDesc.GetSizePixel(); - Point aFDTopLeft=aFiFuncDesc.GetPosPixel(); + short nDeltaY=aPrivatSplit->GetDeltaY(); + Size aFLSize=aFuncList->GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); + Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); aFLSize.Height()+=nDeltaY; aFDSize.Height()-=nDeltaY; aFDTopLeft.Y()+=nDeltaY; - aFuncList.SetSizePixel(aFLSize); - aFiFuncDesc.SetPosPixel(aFDTopLeft); - aFiFuncDesc.SetSizePixel(aFDSize); + aFuncList->SetSizePixel(aFLSize); + aFiFuncDesc->SetPosPixel(aFDTopLeft); + aFiFuncDesc->SetSizePixel(aFDSize); } return 0; @@ -1040,13 +1052,13 @@ void ScFunctionDockWin::Initialize(SfxChildWinInfo *pInfo) if ( !aStr.isEmpty()) { - aSplitterInitPos = aPrivatSplit.GetPosPixel(); + aSplitterInitPos = aPrivatSplit->GetPosPixel(); aSplitterInitPos.Y() = (sal_uInt16) aStr.toInt32(); sal_Int32 n1 = aStr.indexOf(';'); aStr = aStr.copy( n1+1 ); sal_Int32 nSelPos = aStr.toInt32(); - aCatBox.SelectEntryPos(nSelPos); - SelHdl(&aCatBox); + aCatBox->SelectEntryPos(nSelPos); + SelHdl(aCatBox.get()); // if the window has already been shown (from SfxDockingWindow::Initialize if docked), // set the splitter position now, otherwise it is set in StateChanged with type INITSHOW @@ -1058,17 +1070,17 @@ void ScFunctionDockWin::Initialize(SfxChildWinInfo *pInfo) void ScFunctionDockWin::FillInfo(SfxChildWinInfo& rInfo) const { SfxDockingWindow::FillInfo(rInfo); - Point aPoint=aPrivatSplit.GetPosPixel(); + Point aPoint=aPrivatSplit->GetPosPixel(); rInfo.aExtraString += "ScFuncList:(" + OUString::number(aPoint.Y()) + ";" + - OUString::number(aCatBox.GetSelectEntryPos()) + ")"; + OUString::number(aCatBox->GetSelectEntryPos()) + ")"; } void ScFunctionDockWin::UseSplitterInitPos() { - if ( IsVisible() && aPrivatSplit.IsEnabled() && aSplitterInitPos != Point() ) + if ( IsVisible() && aPrivatSplit->IsEnabled() && aSplitterInitPos != Point() ) { - aPrivatSplit.MoveSplitTo(aSplitterInitPos); + aPrivatSplit->MoveSplitTo(aSplitterInitPos); aSplitterInitPos = Point(); // use only once } } diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index 5909f3bf7dfe..8867fadb585a 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -241,6 +241,11 @@ void ScFormulaDlg::fill() ScFormulaDlg::~ScFormulaDlg() { + dispose(); +} + +void ScFormulaDlg::dispose() +{ ScModule* pScMod = SC_MOD(); ScFormEditData* pData = pScMod->GetFormEditData(); @@ -250,6 +255,7 @@ ScFormulaDlg::~ScFormulaDlg() pScMod->SetRefInputHdl(NULL); StoreFormEditData(pData); } + formula::FormulaDlg::dispose(); } bool ScFormulaDlg::IsInputHdl(ScInputHandler* pHdl) diff --git a/sc/source/ui/inc/acredlin.hxx b/sc/source/ui/inc/acredlin.hxx index 5f10898ba278..0dd82d8569c0 100644 --- a/sc/source/ui/inc/acredlin.hxx +++ b/sc/source/ui/inc/acredlin.hxx @@ -206,6 +206,7 @@ public: ScViewData* ptrViewData); virtual ~ScAcceptChgDlg(); + virtual void dispose() SAL_OVERRIDE; void ReInit(ScViewData* ptrViewData); diff --git a/sc/source/ui/inc/areasdlg.hxx b/sc/source/ui/inc/areasdlg.hxx index dab930898c55..4798db7de246 100644 --- a/sc/source/ui/inc/areasdlg.hxx +++ b/sc/source/ui/inc/areasdlg.hxx @@ -1,4 +1,3 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * @@ -35,6 +34,7 @@ class ScPrintAreasDlg : public ScAnyRefDlg public: ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent ); virtual ~ScPrintAreasDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual void AddRefEntry() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/autofmt.hxx b/sc/source/ui/inc/autofmt.hxx index 59879825d07b..070ef9f586f7 100644 --- a/sc/source/ui/inc/autofmt.hxx +++ b/sc/source/ui/inc/autofmt.hxx @@ -46,6 +46,7 @@ public: ScAutoFmtPreview(vcl::Window* pParent); void DetectRTL(ScViewData *pViewData); virtual ~ScAutoFmtPreview(); + virtual void dispose() SAL_OVERRIDE; void NotifyChange( ScAutoFormatData* pNewData ); diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index aea85074aba1..73fc1bd33efc 100644 --- a/sc/source/ui/inc/checklistmenu.hxx +++ b/sc/source/ui/inc/checklistmenu.hxx @@ -196,7 +196,8 @@ class ScCheckListBox : public SvTreeListBox public: ScCheckListBox( vcl::Window* pParent, WinBits nWinStyle = 0 ); - virtual ~ScCheckListBox() { delete mpCheckButton; } + virtual ~ScCheckListBox() { dispose(); } + virtual void dispose() SAL_OVERRIDE { delete mpCheckButton; SvTreeListBox::dispose(); } void Init(); void CheckEntry( const OUString& sName, SvTreeListEntry* pParent, bool bCheck = true ); void CheckEntry( SvTreeListEntry* pEntry, bool bCheck = true ); @@ -238,6 +239,7 @@ public: explicit ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc); virtual ~ScCheckListMenuWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE; virtual bool Notify(NotifyEvent& rNEvt) SAL_OVERRIDE; @@ -329,16 +331,15 @@ private: private: SvTreeListEntry* findEntry( SvTreeListEntry* pParent, const OUString& rText ); - Edit maEdSearch; + VclPtr<Edit> maEdSearch; + VclPtr<ScCheckListBox> maChecks; - ScCheckListBox maChecks; + VclPtr<TriStateBox> maChkToggleAll; + VclPtr<ImageButton> maBtnSelectSingle; + VclPtr<ImageButton> maBtnUnselectSingle; - TriStateBox maChkToggleAll; - ImageButton maBtnSelectSingle; - ImageButton maBtnUnselectSingle; - - OKButton maBtnOk; - CancelButton maBtnCancel; + VclPtr<OKButton> maBtnOk; + VclPtr<CancelButton> maBtnCancel; ::std::vector<vcl::Window*> maTabStopCtrls; size_t mnCurTabStop; diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index 0ed7a5b40717..4d7949da66a9 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -46,13 +46,13 @@ private: Link maClickHdl; //general ui elements - FixedText maFtCondNr; - FixedText maFtCondition; + VclPtr<FixedText> maFtCondNr; + VclPtr<FixedText> maFtCondition; sal_Int32 mnIndex; OUString maStrCondition; protected: - ListBox maLbType; + VclPtr<ListBox> maLbType; ScDocument* mpDoc; ScAddress maPos; @@ -67,6 +67,7 @@ protected: public: ScCondFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos ); virtual ~ScCondFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -85,13 +86,13 @@ public: class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener { //cond format ui elements - ListBox maLbCondType; - formula::RefEdit maEdVal1; - formula::RefEdit maEdVal2; - FixedText maFtVal; - FixedText maFtStyle; - ListBox maLbStyle; - SvxFontPrevWindow maWdPreview; + VclPtr<ListBox> maLbCondType; + VclPtr<formula::RefEdit> maEdVal1; + VclPtr<formula::RefEdit> maEdVal2; + VclPtr<FixedText> maFtVal; + VclPtr<FixedText> maFtStyle; + VclPtr<ListBox> maLbStyle; + VclPtr<SvxFontPrevWindow> maWdPreview; bool mbIsInStyleCreate; static const sal_Int32 NUM_COND_ENTRIES = 24; @@ -120,6 +121,8 @@ protected: public: ScConditionFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL ); + virtual ~ScConditionFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; @@ -133,10 +136,10 @@ public: class ScFormulaFrmtEntry : public ScCondFrmtEntry { - FixedText maFtStyle; - ListBox maLbStyle; - SvxFontPrevWindow maWdPreview; - formula::RefEdit maEdFormula; + VclPtr<FixedText> maFtStyle; + VclPtr<ListBox> maLbStyle; + VclPtr<SvxFontPrevWindow> maWdPreview; + VclPtr<formula::RefEdit> maEdFormula; ScFormatEntry* createFormulaEntry() const; virtual OUString GetExpressionString() SAL_OVERRIDE; @@ -146,6 +149,8 @@ class ScFormulaFrmtEntry : public ScCondFrmtEntry public: ScFormulaFrmtEntry( vcl::Window* pParent, ScDocument* PDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL ); + virtual ~ScFormulaFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; @@ -157,17 +162,17 @@ class ScColorScale2FrmtEntry : public ScCondFrmtEntry { //color format ui elements - ListBox maLbColorFormat; + VclPtr<ListBox> maLbColorFormat; //color scale ui elements - ListBox maLbEntryTypeMin; - ListBox maLbEntryTypeMax; + VclPtr<ListBox> maLbEntryTypeMin; + VclPtr<ListBox> maLbEntryTypeMax; - Edit maEdMin; - Edit maEdMax; + VclPtr<Edit> maEdMin; + VclPtr<Edit> maEdMax; - ColorListBox maLbColMin; - ColorListBox maLbColMax; + VclPtr<ColorListBox> maLbColMin; + VclPtr<ColorListBox> maLbColMax; ScFormatEntry* createColorscaleEntry() const; @@ -177,6 +182,8 @@ class ScColorScale2FrmtEntry : public ScCondFrmtEntry DECL_LINK( EntryTypeHdl, ListBox* ); public: ScColorScale2FrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = NULL ); + virtual ~ScColorScale2FrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; @@ -187,20 +194,20 @@ class ScColorScale3FrmtEntry : public ScCondFrmtEntry { //color format ui elements - ListBox maLbColorFormat; + VclPtr<ListBox> maLbColorFormat; //color scale ui elements - ListBox maLbEntryTypeMin; - ListBox maLbEntryTypeMiddle; - ListBox maLbEntryTypeMax; + VclPtr<ListBox> maLbEntryTypeMin; + VclPtr<ListBox> maLbEntryTypeMiddle; + VclPtr<ListBox> maLbEntryTypeMax; - Edit maEdMin; - Edit maEdMiddle; - Edit maEdMax; + VclPtr<Edit> maEdMin; + VclPtr<Edit> maEdMiddle; + VclPtr<Edit> maEdMax; - ColorListBox maLbColMin; - ColorListBox maLbColMiddle; - ColorListBox maLbColMax; + VclPtr<ColorListBox> maLbColMin; + VclPtr<ColorListBox> maLbColMiddle; + VclPtr<ColorListBox> maLbColMax; ScFormatEntry* createColorscaleEntry() const; @@ -210,6 +217,8 @@ class ScColorScale3FrmtEntry : public ScCondFrmtEntry DECL_LINK( EntryTypeHdl, ListBox* ); public: ScColorScale3FrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = NULL ); + virtual ~ScColorScale3FrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; @@ -219,15 +228,15 @@ public: class ScDataBarFrmtEntry : public ScCondFrmtEntry { //color format ui elements - ListBox maLbColorFormat; + VclPtr<ListBox> maLbColorFormat; //data bar ui elements - ListBox maLbDataBarMinType; - ListBox maLbDataBarMaxType; - Edit maEdDataBarMin; - Edit maEdDataBarMax; + VclPtr<ListBox> maLbDataBarMinType; + VclPtr<ListBox> maLbDataBarMaxType; + VclPtr<Edit> maEdDataBarMin; + VclPtr<Edit> maEdDataBarMax; - PushButton maBtOptions; + VclPtr<PushButton> maBtOptions; boost::scoped_ptr<ScDataBarFormatData> mpDataBarData; @@ -240,6 +249,8 @@ class ScDataBarFrmtEntry : public ScCondFrmtEntry DECL_LINK( DataBarTypeSelectHdl, void* ); public: ScDataBarFrmtEntry( vcl::Window* pParemt, ScDocument* pDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat = NULL ); + virtual ~ScDataBarFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; @@ -251,6 +262,8 @@ class ScDateFrmtEntry : public ScCondFrmtEntry, public SfxListener { public: ScDateFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat = NULL ); + virtual ~ScDateFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; @@ -266,10 +279,10 @@ private: DECL_LINK( StyleSelectHdl, void* ); - ListBox maLbDateEntry; - FixedText maFtStyle; - ListBox maLbStyle; - SvxFontPrevWindow maWdPreview; + VclPtr<ListBox> maLbDateEntry; + VclPtr<FixedText> maFtStyle; + VclPtr<ListBox> maLbStyle; + VclPtr<SvxFontPrevWindow> maWdPreview; bool mbIsInStyleCreate; }; @@ -277,10 +290,10 @@ private: class ScIconSetFrmtEntry : public ScCondFrmtEntry { //color format ui elements - ListBox maLbColorFormat; + VclPtr<ListBox> maLbColorFormat; // icon set ui elements - ListBox maLbIconSetType; + VclPtr<ListBox> maLbIconSetType; typedef boost::ptr_vector<ScIconSetFrmtDataEntry> ScIconSetFrmtDataEntriesType; ScIconSetFrmtDataEntriesType maEntries; @@ -293,6 +306,8 @@ class ScIconSetFrmtEntry : public ScCondFrmtEntry public: ScIconSetFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat = NULL ); + virtual ~ScIconSetFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 6f577e4cf5b1..31338a4d02f7 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -50,6 +50,7 @@ class ScCondFormatManagerDlg : public ModalDialog public: ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScAddress& rPos); virtual ~ScCondFormatManagerDlg(); + virtual void dispose() SAL_OVERRIDE; ScConditionalFormatList* GetConditionalFormatList(); diff --git a/sc/source/ui/inc/consdlg.hxx b/sc/source/ui/inc/consdlg.hxx index 0f3c60c69781..c7f49fe6389a 100644 --- a/sc/source/ui/inc/consdlg.hxx +++ b/sc/source/ui/inc/consdlg.hxx @@ -39,6 +39,7 @@ public: ScConsolidateDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScConsolidateDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/csvcontrol.hxx b/sc/source/ui/inc/csvcontrol.hxx index c66bac55d988..fee07ecba715 100644 --- a/sc/source/ui/inc/csvcontrol.hxx +++ b/sc/source/ui/inc/csvcontrol.hxx @@ -241,6 +241,7 @@ public: explicit ScCsvControl( ScCsvControl& rParent ); explicit ScCsvControl( vcl::Window* pParent, const ScCsvLayoutData& rData, WinBits nBits ); virtual ~ScCsvControl(); + virtual void dispose() SAL_OVERRIDE; // event handling --------------------------------------------------------- diff --git a/sc/source/ui/inc/csvgrid.hxx b/sc/source/ui/inc/csvgrid.hxx index bab6dda53287..3229eae657aa 100644 --- a/sc/source/ui/inc/csvgrid.hxx +++ b/sc/source/ui/inc/csvgrid.hxx @@ -109,6 +109,7 @@ private: public: explicit ScCsvGrid( ScCsvControl& rParent ); virtual ~ScCsvGrid(); + virtual void dispose() SAL_OVERRIDE; /** Finishes initialization. Must be called after constructing a new object. */ void Init(); diff --git a/sc/source/ui/inc/csvruler.hxx b/sc/source/ui/inc/csvruler.hxx index ef73cae674c4..d789a38c9f61 100644 --- a/sc/source/ui/inc/csvruler.hxx +++ b/sc/source/ui/inc/csvruler.hxx @@ -55,6 +55,7 @@ private: public: explicit ScCsvRuler( ScCsvControl& rParent ); virtual ~ScCsvRuler(); + virtual void dispose() SAL_OVERRIDE; // common ruler handling -------------------------------------------------- public: diff --git a/sc/source/ui/inc/csvtablebox.hxx b/sc/source/ui/inc/csvtablebox.hxx index cda528abf86c..2c5b458b5fcc 100644 --- a/sc/source/ui/inc/csvtablebox.hxx +++ b/sc/source/ui/inc/csvtablebox.hxx @@ -22,6 +22,7 @@ #include <vcl/ctrl.hxx> #include <vcl/scrbar.hxx> +#include <vcl/vclptr.hxx> #include "scdllapi.h" #include "csvcontrol.hxx" #include "csvruler.hxx" @@ -44,11 +45,11 @@ class SC_DLLPUBLIC ScCsvTableBox : public ScCsvControl private: ScCsvLayoutData maData; /// Current layout data of the controls. - ScCsvRuler maRuler; /// The ruler for fixed width mode. - ScCsvGrid maGrid; /// Calc-like data table for fixed width mode. - ScrollBar maHScroll; /// Horizontal scroll bar. - ScrollBar maVScroll; /// Vertical scroll bar. - ScrollBarBox maScrollBox; /// For the bottom right edge. + VclPtr<ScCsvRuler> maRuler; /// The ruler for fixed width mode. + VclPtr<ScCsvGrid> maGrid; /// Calc-like data table for fixed width mode. + VclPtr<ScrollBar> maHScroll; /// Horizontal scroll bar. + VclPtr<ScrollBar> maVScroll; /// Vertical scroll bar. + VclPtr<ScrollBarBox> maScrollBox; /// For the bottom right edge. Link maUpdateTextHdl; /// Updates all cell texts. Link maColTypeHdl; /// Handler for exporting the column type. @@ -62,6 +63,8 @@ private: public: explicit ScCsvTableBox( vcl::Window* pParent, WinBits nBits ); + virtual ~ScCsvTableBox(); + virtual void dispose() SAL_OVERRIDE; /** Finishes initialization. Must be called after constructing a new object. */ void Init(); @@ -102,7 +105,7 @@ public: /** Reads UI strings for data types from the list box. */ void InitTypes( const ListBox& rListBox ); /** Returns the data type of the selected columns. */ - inline sal_Int32 GetSelColumnType() const { return maGrid.GetSelColumnType(); } + inline sal_Int32 GetSelColumnType() const { return maGrid->GetSelColumnType(); } /** Fills the options object with current column data. */ void FillColumnData( ScAsciiOptions& rOptions ) const; diff --git a/sc/source/ui/inc/dbnamdlg.hxx b/sc/source/ui/inc/dbnamdlg.hxx index 6b6d68384a0a..ec2dfd665339 100644 --- a/sc/source/ui/inc/dbnamdlg.hxx +++ b/sc/source/ui/inc/dbnamdlg.hxx @@ -38,6 +38,7 @@ public: ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScViewData* ptrViewData ); virtual ~ScDbNameDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx index 07b532f58718..28e85803df07 100644 --- a/sc/source/ui/inc/dwfunctr.hxx +++ b/sc/source/ui/inc/dwfunctr.hxx @@ -47,16 +47,16 @@ class ScFunctionDockWin : public SfxDockingWindow, public SfxListener private: Idle aIdle; - ScPrivatSplit aPrivatSplit; - ListBox aCatBox; - ListBox aFuncList; - ListBox aDDFuncList; + VclPtr<ScPrivatSplit> aPrivatSplit; + VclPtr<ListBox> aCatBox; + VclPtr<ListBox> aFuncList; + VclPtr<ListBox> aDDFuncList; ListBox* pAllFuncList; SfxChildAlignment eSfxNewAlignment; SfxChildAlignment eSfxOldAlignment; - ImageButton aInsertButton; - FixedText aFiFuncDesc; + VclPtr<ImageButton> aInsertButton; + VclPtr<FixedText> aFiFuncDesc; sal_uLong nMinWidth; sal_uLong nMinHeight; Size aOldSize; @@ -105,6 +105,7 @@ public: const ResId& rResId ); virtual ~ScFunctionDockWin(); + virtual void dispose() SAL_OVERRIDE; using SfxDockingWindow::Notify; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx index e7e89cc9fcab..30b5399e7e60 100644 --- a/sc/source/ui/inc/filtdlg.hxx +++ b/sc/source/ui/inc/filtdlg.hxx @@ -56,6 +56,7 @@ public: ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScFilterDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; @@ -163,6 +164,7 @@ public: ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScSpecialFilterDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/formula.hxx b/sc/source/ui/inc/formula.hxx index 66db8807c815..b525b189c18f 100644 --- a/sc/source/ui/inc/formula.hxx +++ b/sc/source/ui/inc/formula.hxx @@ -55,6 +55,7 @@ public: ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScViewData* pViewData ,formula::IFunctionManager* _pFunctionMgr); virtual ~ScFormulaDlg(); + virtual void dispose() SAL_OVERRIDE; // IFormulaEditorHelper virtual void notifyChange() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 259844ebfd35..f889098bdaee 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -302,6 +302,7 @@ public: ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos eWhichPos ); virtual ~ScGridWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; // #i70788# flush and get overlay diff --git a/sc/source/ui/inc/highred.hxx b/sc/source/ui/inc/highred.hxx index 0b0039dd9ca6..b80a3b8eff7e 100644 --- a/sc/source/ui/inc/highred.hxx +++ b/sc/source/ui/inc/highred.hxx @@ -81,6 +81,7 @@ public: ScViewData* ptrViewData); virtual ~ScHighlightChgDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx index a1c9478ff104..db96b997049a 100644 --- a/sc/source/ui/inc/inputwin.hxx +++ b/sc/source/ui/inc/inputwin.hxx @@ -62,6 +62,7 @@ class ScTextWnd : public ScTextWndBase, public DragSourceHelper // edit wind public: ScTextWnd( vcl::Window* pParent, ScTabViewShell* pViewSh ); virtual ~ScTextWnd(); + virtual void dispose() SAL_OVERRIDE; virtual void SetTextString( const OUString& rString ) SAL_OVERRIDE; virtual const OUString& GetTextString() const SAL_OVERRIDE; @@ -139,6 +140,7 @@ private: public: ScPosWnd( vcl::Window* pParent ); virtual ~ScPosWnd(); + virtual void dispose() SAL_OVERRIDE; void SetPos( const OUString& rPosStr ); // Displayed Text void SetFormulaMode( bool bSet ); @@ -201,8 +203,9 @@ class ScInputBarGroup : public ScTextWndBase public: ScInputBarGroup( vcl::Window* Parent, ScTabViewShell* pViewSh ); virtual ~ScInputBarGroup(); - virtual void InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) SAL_OVERRIDE; - virtual void RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) SAL_OVERRIDE; + virtual void dispose() SAL_OVERRIDE; + virtual void InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) SAL_OVERRIDE; + virtual void RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) SAL_OVERRIDE; // virtual void Paint(const Rectangle& rRect ); void SetTextString( const OUString& rString ) SAL_OVERRIDE; void StartEditEngine() SAL_OVERRIDE; @@ -217,16 +220,16 @@ public: bool IsFocus(); void MakeDialogEditView() SAL_OVERRIDE; bool IsInputActive() SAL_OVERRIDE; - ScrollBar& GetScrollBar() { return aScrollBar; } + ScrollBar& GetScrollBar() { return *aScrollBar.get(); } void IncrementVerticalSize(); void DecrementVerticalSize(); - long GetNumLines() { return aMultiTextWnd.GetNumLines(); } + long GetNumLines() { return aMultiTextWnd->GetNumLines(); } long GetVertOffset() { return nVertOffset; } private: void TriggerToolboxLayout(); - ScMultiTextWnd aMultiTextWnd; - ImageButton aButton; - ScrollBar aScrollBar; + VclPtr<ScMultiTextWnd> aMultiTextWnd; + VclPtr<ImageButton> aButton; + VclPtr<ScrollBar> aScrollBar; long nVertOffset; DECL_LINK( ClickHdl, void* ); DECL_LINK( Impl_ScrollHdl, void* ); @@ -238,6 +241,7 @@ class ScInputWindow : public ToolBox // Parent toolbox public: ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ); virtual ~ScInputWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -284,7 +288,7 @@ protected: bool UseSubTotal( ScRangeList* pRangeList ) const; bool IsPointerAtResizePos(); private: - ScPosWnd aWndPos; + VclPtr<ScPosWnd> aWndPos; std::unique_ptr<ScTextWndBase> pRuntimeWindow; ScTextWndBase& aTextWindow; ScInputHandler* pInputHdl; diff --git a/sc/source/ui/inc/inscodlg.hxx b/sc/source/ui/inc/inscodlg.hxx index 30f89fe35eda..255cfac02c03 100644 --- a/sc/source/ui/inc/inscodlg.hxx +++ b/sc/source/ui/inc/inscodlg.hxx @@ -34,6 +34,7 @@ public: InsertDeleteFlags nCheckDefaults = IDF_NONE, const OUString* pStrTitle = NULL ); virtual ~ScInsertContentsDlg(); + virtual void dispose() SAL_OVERRIDE; InsertDeleteFlags GetInsContentsCmdBits() const; sal_uInt16 GetFormulaCmdBits() const; diff --git a/sc/source/ui/inc/instbdlg.hxx b/sc/source/ui/inc/instbdlg.hxx index 7bc1dd590b7f..ad03e94aa5c1 100644 --- a/sc/source/ui/inc/instbdlg.hxx +++ b/sc/source/ui/inc/instbdlg.hxx @@ -44,6 +44,7 @@ class ScInsertTableDlg : public ModalDialog public: ScInsertTableDlg( vcl::Window* pParent, ScViewData& rViewData, SCTAB nTabCount, bool bFromFile ); virtual ~ScInsertTableDlg(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; // override to set parent dialog diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index cb586b928554..fa3316f21dae 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -123,6 +123,7 @@ public: ScViewData* ptrViewData, const ScAddress& aCursorPos, boost::ptr_map<OUString, ScRangeName>* pRangeMap = NULL ); virtual ~ScNameDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual bool IsRefInputMode() const SAL_OVERRIDE; diff --git a/sc/source/ui/inc/namepast.hxx b/sc/source/ui/inc/namepast.hxx index 866ffc79ee04..0ee6fa6db115 100644 --- a/sc/source/ui/inc/namepast.hxx +++ b/sc/source/ui/inc/namepast.hxx @@ -49,6 +49,7 @@ public: ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool bInsList=true ); virtual ~ScNamePasteDlg(); + virtual void dispose() SAL_OVERRIDE; std::vector<OUString> GetSelectedNames() const; }; diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index f966fba1b9ff..7e7fb9265ae4 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -97,10 +97,11 @@ class ScScenarioWindow : public vcl::Window public: ScScenarioWindow( vcl::Window* pParent, const OUString& aQH_List, const OUString& aQH_Comment); virtual ~ScScenarioWindow(); + virtual void dispose() SAL_OVERRIDE; void NotifyState( const SfxPoolItem* pState ); void SetComment( const OUString& rComment ) - { aEdComment.SetText( rComment ); } + { aEdComment->SetText( rComment ); } void SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE; @@ -109,8 +110,8 @@ protected: virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; private: - ScScenarioListBox aLbScenario; - MultiLineEdit aEdComment; + VclPtr<ScScenarioListBox> aLbScenario; + VclPtr<MultiLineEdit> aEdComment; }; // class ColumnEdit @@ -220,14 +221,14 @@ private: SfxBindings& rBindings; // must be first member ImageList aCmdImageList; // must be before aTbxCmd - FixedInfo aFtCol; - ColumnEdit aEdCol; - FixedInfo aFtRow; - RowEdit aEdRow; - CommandToolBox aTbxCmd; - ScContentTree aLbEntries; - ScScenarioWindow aWndScenarios; - ScDocListBox aLbDocuments; + VclPtr<FixedInfo> aFtCol; + VclPtr<ColumnEdit> aEdCol; + VclPtr<FixedInfo> aFtRow; + VclPtr<RowEdit> aEdRow; + VclPtr<CommandToolBox> aTbxCmd; + VclPtr<ScContentTree> aLbEntries; + VclPtr<ScScenarioWindow> aWndScenarios; + VclPtr<ScDocListBox> aLbDocuments; Idle aContentIdle; @@ -309,6 +310,7 @@ public: ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl::Window* pParent, const bool bUseStyleSettingsBackground); virtual ~ScNavigatorDlg(); + virtual void dispose() SAL_OVERRIDE; using Window::Notify; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/olinewin.hxx b/sc/source/ui/inc/olinewin.hxx index 107447d8529e..c95dffef4229 100644 --- a/sc/source/ui/inc/olinewin.hxx +++ b/sc/source/ui/inc/olinewin.hxx @@ -62,6 +62,7 @@ public: ScViewData* pViewData, ScSplitPos eWhich ); virtual ~ScOutlineWindow(); + virtual void dispose() SAL_OVERRIDE; /** Sets the size of the header area (width/height dep. on window type). */ void SetHeaderSize( long nNewSize ); diff --git a/sc/source/ui/inc/pfiltdlg.hxx b/sc/source/ui/inc/pfiltdlg.hxx index 55b3fa8625c2..4253fa83a720 100644 --- a/sc/source/ui/inc/pfiltdlg.hxx +++ b/sc/source/ui/inc/pfiltdlg.hxx @@ -40,6 +40,7 @@ class ScPivotFilterDlg : public ModalDialog public: ScPivotFilterDlg(vcl::Window* pParent, const SfxItemSet& rArgSet, SCTAB nSourceTab); virtual ~ScPivotFilterDlg(); + virtual void dispose() SAL_OVERRIDE; const ScQueryItem& GetOutputItem(); diff --git a/sc/source/ui/inc/preview.hxx b/sc/source/ui/inc/preview.hxx index bcf4fbc66d15..7be36eeca8a3 100644 --- a/sc/source/ui/inc/preview.hxx +++ b/sc/source/ui/inc/preview.hxx @@ -118,6 +118,7 @@ protected: public: ScPreview( vcl::Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pViewSh ); virtual ~ScPreview(); + virtual void dispose() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx index 646e4ef4bf77..ed01e23b6955 100644 --- a/sc/source/ui/inc/scuiasciiopt.hxx +++ b/sc/source/ui/inc/scuiasciiopt.hxx @@ -80,6 +80,7 @@ public: vcl::Window* pParent, const OUString& aDatName, SvStream* pInStream, ScImportAsciiCall eCall ); virtual ~ScImportAsciiDlg(); + virtual void dispose() SAL_OVERRIDE; void GetOptions( ScAsciiOptions& rOpt ); void SaveParameters(); diff --git a/sc/source/ui/inc/scuiimoptdlg.hxx b/sc/source/ui/inc/scuiimoptdlg.hxx index adb8f2032725..95ca0cf94fd9 100644 --- a/sc/source/ui/inc/scuiimoptdlg.hxx +++ b/sc/source/ui/inc/scuiimoptdlg.hxx @@ -37,6 +37,7 @@ public: bool bImport = true ); virtual ~ScImportOptionsDlg(); + virtual void dispose() SAL_OVERRIDE; void GetImportOptions( ScImportOptions& rOptions ) const; diff --git a/sc/source/ui/inc/searchresults.hxx b/sc/source/ui/inc/searchresults.hxx index 437d90a3adc8..5c69ab7e63ed 100644 --- a/sc/source/ui/inc/searchresults.hxx +++ b/sc/source/ui/inc/searchresults.hxx @@ -29,6 +29,7 @@ class SearchResultsDlg : public ModelessDialog public: SearchResultsDlg( SfxBindings* _pBindings, vcl::Window* pParent, sal_uInt16 nId ); virtual ~SearchResultsDlg(); + virtual void dispose() SAL_OVERRIDE; void FillResults( ScDocument* pDoc, const ScRangeList& rMatchedRanges ); diff --git a/sc/source/ui/inc/sharedocdlg.hxx b/sc/source/ui/inc/sharedocdlg.hxx index f8d746fd4cc9..8356d0e6b8e8 100644 --- a/sc/source/ui/inc/sharedocdlg.hxx +++ b/sc/source/ui/inc/sharedocdlg.hxx @@ -49,6 +49,7 @@ private: public: ScShareDocumentDlg( vcl::Window* pParent, ScViewData* pViewData ); virtual ~ScShareDocumentDlg(); + virtual void dispose() SAL_OVERRIDE; bool IsShareDocumentChecked() const; void UpdateView(); diff --git a/sc/source/ui/inc/solveroptions.hxx b/sc/source/ui/inc/solveroptions.hxx index eb03c6e61e5f..31607f4e3c55 100644 --- a/sc/source/ui/inc/solveroptions.hxx +++ b/sc/source/ui/inc/solveroptions.hxx @@ -61,6 +61,7 @@ public: const OUString& rEngine, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProperties ); virtual ~ScSolverOptionsDialog(); + virtual void dispose() SAL_OVERRIDE; // already updated in selection handler const OUString& GetEngine() const { return maEngine; } diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 8d6010ab2cdf..4de0a1fdec8f 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -112,13 +112,13 @@ private: ScTabSplitter* pHSplitter; ScTabSplitter* pVSplitter; ScTabControl* pTabControl; - ScrollBar aVScrollTop; - ScrollBar aVScrollBottom; // initially visible - ScrollBar aHScrollLeft; // initially visible - ScrollBar aHScrollRight; - ScCornerButton aCornerButton; - ScCornerButton aTopButton; - ScrollBarBox aScrollBarBox; + VclPtr<ScrollBar> aVScrollTop; + VclPtr<ScrollBar> aVScrollBottom; // initially visible + VclPtr<ScrollBar> aHScrollLeft; // initially visible + VclPtr<ScrollBar> aHScrollRight; + VclPtr<ScCornerButton> aCornerButton; + VclPtr<ScCornerButton> aTopButton; + VclPtr<ScrollBarBox> aScrollBarBox; boost::scoped_ptr<ScHintWindow> mpInputHintWindow; // popup window for data validation diff --git a/sc/source/ui/inc/tbzoomsliderctrl.hxx b/sc/source/ui/inc/tbzoomsliderctrl.hxx index d2c6cbccaaaf..442202ddff60 100644 --- a/sc/source/ui/inc/tbzoomsliderctrl.hxx +++ b/sc/source/ui/inc/tbzoomsliderctrl.hxx @@ -54,6 +54,7 @@ public: ScZoomSliderWnd( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame , sal_uInt16 nCurrentZoom ); virtual ~ScZoomSliderWnd(); + virtual void dispose() SAL_OVERRIDE; void UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem ); protected: diff --git a/sc/source/ui/inc/tpcalc.hxx b/sc/source/ui/inc/tpcalc.hxx index 629eb735c7be..9727b1c39a5d 100644 --- a/sc/source/ui/inc/tpcalc.hxx +++ b/sc/source/ui/inc/tpcalc.hxx @@ -43,6 +43,7 @@ private: ScTpCalcOptions( vcl::Window* pParent, const SfxItemSet& rCoreSet ); virtual ~ScTpCalcOptions(); + virtual void dispose() SAL_OVERRIDE; private: CheckBox* m_pBtnIterate; diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx index f6c218162537..8a392d1a5b3a 100644 --- a/sc/source/ui/inc/tphfedit.hxx +++ b/sc/source/ui/inc/tphfedit.hxx @@ -55,6 +55,7 @@ class SC_DLLPUBLIC ScEditWindow : public Control public: ScEditWindow( vcl::Window* pParent, WinBits nBits , ScEditWindowLocation eLoc ); virtual ~ScEditWindow(); + virtual void dispose() SAL_OVERRIDE; using Control::SetFont; void SetFont( const ScPatternAttr& rPattern ); diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx index 8eaf1ec057da..699443960eb6 100644 --- a/sc/source/ui/inc/tpsort.hxx +++ b/sc/source/ui/inc/tpsort.hxx @@ -109,6 +109,7 @@ public: ScTabPageSortOptions( vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScTabPageSortOptions(); + virtual void dispose() SAL_OVERRIDE; #undef SfxTabPage #define SfxTabPage ::SfxTabPage diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx index ffff1e061ba3..daf0f532a9a7 100644 --- a/sc/source/ui/inc/tpsubt.hxx +++ b/sc/source/ui/inc/tpsubt.hxx @@ -41,6 +41,7 @@ protected: public: virtual ~ScTpSubTotalGroup(); + virtual void dispose() SAL_OVERRIDE; bool DoReset ( sal_uInt16 nGroupNo, const SfxItemSet& rArgSet ); diff --git a/sc/source/ui/inc/tpusrlst.hxx b/sc/source/ui/inc/tpusrlst.hxx index 5e84d88a0beb..fa0a15453e17 100644 --- a/sc/source/ui/inc/tpusrlst.hxx +++ b/sc/source/ui/inc/tpusrlst.hxx @@ -44,6 +44,7 @@ private: ScTpUserLists( vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScTpUserLists(); + virtual void dispose() SAL_OVERRIDE; private: FixedText* mpFtLists; diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx index e426d9c742a9..50981d1a3a8d 100644 --- a/sc/source/ui/inc/tpview.hxx +++ b/sc/source/ui/inc/tpview.hxx @@ -67,6 +67,7 @@ class ScTpContentOptions : public SfxTabPage ScTpContentOptions( vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScTpContentOptions(); + virtual void dispose() SAL_OVERRIDE; public: static SfxTabPage* Create ( vcl::Window* pParent, diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index ebc6d92ffa37..4da82e82d1c9 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -185,10 +185,12 @@ class ScValidationDlg public: explicit ScValidationDlg( vcl::Window* pParent, const SfxItemSet* pArgSet, ScTabViewShell * pTabViewSh, SfxBindings *pB = NULL ); - virtual ~ScValidationDlg() + virtual ~ScValidationDlg() { dispose(); } + virtual void dispose() SAL_OVERRIDE { if( m_bOwnRefHdlr ) RemoveRefDlg( false ); + ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false>::dispose(); } static ScValidationDlg * Find1AliveObject( vcl::Window *pAncestor ) { diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 76363796d8de..1e6b481cd9b5 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -154,6 +154,11 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window ScAcceptChgDlg::~ScAcceptChgDlg() { + dispose(); +} + +void ScAcceptChgDlg::dispose() +{ ClearView(); ScChangeTrack* pChanges=pDoc->GetChangeTrack(); @@ -164,6 +169,7 @@ ScAcceptChgDlg::~ScAcceptChgDlg() } delete m_pAcceptChgCtr; + SfxModelessDialog::dispose(); } void ScAcceptChgDlg::ReInit(ScViewData* ptrViewData) diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index ffd54c8547c8..5d2899e8870a 100644 --- a/sc/source/ui/miscdlgs/autofmt.cxx +++ b/sc/source/ui/miscdlgs/autofmt.cxx @@ -90,7 +90,13 @@ void ScAutoFmtPreview::Resize() ScAutoFmtPreview::~ScAutoFmtPreview() { + dispose(); +} + +void ScAutoFmtPreview::dispose() +{ delete pNumFmt; + vcl::Window::dispose(); } static void lcl_SetFontProperties( diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx index bddfdef57fc0..c0b7094686fa 100644 --- a/sc/source/ui/miscdlgs/highred.cxx +++ b/sc/source/ui/miscdlgs/highred.cxx @@ -69,8 +69,14 @@ ScHighlightChgDlg::ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl: ScHighlightChgDlg::~ScHighlightChgDlg() { + dispose(); +} + +void ScHighlightChgDlg::dispose() +{ SetDispatcherLock( false ); delete m_pFilterCtr; + ScAnyRefDlg::dispose(); } void ScHighlightChgDlg::Init() diff --git a/sc/source/ui/miscdlgs/inscodlg.cxx b/sc/source/ui/miscdlgs/inscodlg.cxx index 75e5bac2574f..30ec89410251 100644 --- a/sc/source/ui/miscdlgs/inscodlg.cxx +++ b/sc/source/ui/miscdlgs/inscodlg.cxx @@ -361,6 +361,11 @@ IMPL_LINK_NOARG(ScInsertContentsDlg, LinkBtnHdl) ScInsertContentsDlg::~ScInsertContentsDlg() { + dispose(); +} + +void ScInsertContentsDlg::dispose() +{ ScInsertContentsDlg::nPreviousChecks2 = 0; if(mpBtnSkipEmptyCells->IsChecked()) ScInsertContentsDlg::nPreviousChecks2 |= INS_CONT_NOEMPTY; @@ -378,6 +383,7 @@ ScInsertContentsDlg::~ScInsertContentsDlg() else if ( mpRbMoveRight->IsChecked() ) ScInsertContentsDlg::nPreviousMoveMode = INS_CELLSRIGHT; } + ModalDialog::dispose(); } sal_uInt16 ScInsertContentsDlg::GetFormulaCmdBits() const diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index eda2e79bb4dd..a59638546433 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -64,9 +64,15 @@ ScInsertTableDlg::ScInsertTableDlg( vcl::Window* pParent, ScViewData& rData, SCT ScInsertTableDlg::~ScInsertTableDlg() { + dispose(); +} + +void ScInsertTableDlg::dispose() +{ if (pDocShTables) pDocShTables->DoClose(); delete pDocInserter; + ModalDialog::dispose(); } void ScInsertTableDlg::Init_Impl( bool bFromFile ) diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index d934ff77ea27..3bfb5d9c30e3 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -108,7 +108,13 @@ ScShareDocumentDlg::ScShareDocumentDlg( vcl::Window* pParent, ScViewData* pViewD ScShareDocumentDlg::~ScShareDocumentDlg() { + dispose(); +} + +void ScShareDocumentDlg::dispose() +{ delete m_pLbUsers; + ModalDialog::dispose(); } IMPL_LINK_NOARG(ScShareDocumentDlg, ToggleHandle) diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 307bc6734974..b23c275b7c81 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -159,7 +159,13 @@ ScSolverOptionsDialog::ScSolverOptionsDialog( vcl::Window* pParent, ScSolverOptionsDialog::~ScSolverOptionsDialog() { + dispose(); +} + +void ScSolverOptionsDialog::dispose() +{ delete mpCheckButtonData; + ModalDialog::dispose(); } const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties() diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 6cc2afc689d9..abf323d3f0ed 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -102,7 +102,13 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent ScNameDlg::~ScNameDlg() { + dispose(); +} + +void ScNameDlg::dispose() +{ delete m_pRangeManagerTable; + ScAnyRefDlg::dispose(); } void ScNameDlg::Init() diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx index 841781575ed4..f508d32eebda 100644 --- a/sc/source/ui/namedlg/namepast.cxx +++ b/sc/source/ui/namedlg/namepast.cxx @@ -65,7 +65,13 @@ ScNamePasteDlg::ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool ScNamePasteDlg::~ScNamePasteDlg() { + dispose(); +} + +void ScNamePasteDlg::dispose() +{ delete mpTable; + ModalDialog::dispose(); } IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton ) diff --git a/sc/source/ui/navipi/navcitem.cxx b/sc/source/ui/navipi/navcitem.cxx index 5b64b02115f4..ef981c99aaea 100644 --- a/sc/source/ui/navipi/navcitem.cxx +++ b/sc/source/ui/navipi/navcitem.cxx @@ -88,7 +88,7 @@ void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemStat break; case SID_SELECT_SCENARIO: - rNavigatorDlg.aWndScenarios.NotifyState( pItem ); + rNavigatorDlg.aWndScenarios->NotifyState( pItem ); break; default: diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 1a6178319f82..8861741e6118 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -174,7 +174,7 @@ void ColumnEdit::EvalText() void ColumnEdit::ExecuteCol() { - SCROW nRow = rDlg.aEdRow.GetRow(); + SCROW nRow = rDlg.aEdRow->GetRow(); EvalText(); // setzt nCol @@ -285,7 +285,7 @@ void RowEdit::LoseFocus() void RowEdit::ExecuteRow() { - SCCOL nCol = rDlg.aEdCol.GetCol(); + SCCOL nCol = rDlg.aEdCol->GetCol(); SCROW nRow = (SCROW)GetValue(); if ( (nCol > 0) && (nRow > 0) ) @@ -309,7 +309,7 @@ void ScDocListBox::Select() ScNavigatorDlg::ReleaseFocus(); OUString aDocName = GetSelectEntry(); - rDlg.aLbEntries.SelectDoc( aDocName ); + rDlg.aLbEntries->SelectDoc( aDocName ); } // class CommandToolBox @@ -368,7 +368,7 @@ void CommandToolBox::Select( sal_uInt16 nSelId ) rDlg.EndOfDataArea(); break; case IID_CHANGEROOT: - rDlg.aLbEntries.ToggleRoot(); + rDlg.aLbEntries->ToggleRoot(); UpdateButtons(); break; } @@ -424,7 +424,7 @@ void CommandToolBox::UpdateButtons() else { EnableItem( IID_CHANGEROOT, true ); - bool bRootSet = rDlg.aLbEntries.GetRootType() != SC_CONTENT_ROOT; + bool bRootSet = rDlg.aLbEntries->GetRootType() != SC_CONTENT_ROOT; CheckItem( IID_CHANGEROOT, bRootSet ); } @@ -531,7 +531,7 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper( } if (nCmdId) { - pNavigator->aTbxCmd.CheckItem( nCmdId ); + pNavigator->aTbxCmd->CheckItem( nCmdId ); pNavigator->DoResize(); } @@ -555,14 +555,14 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl Window( pParent, ScResId(RID_SCDLG_NAVIGATOR) ), rBindings ( *pB ), // is used in CommandToolBox ctor aCmdImageList( ScResId( IL_CMD ) ), - aFtCol ( this, ScResId( FT_COL ) ), - aEdCol ( this, ScResId( ED_COL ) ), - aFtRow ( this, ScResId( FT_ROW ) ), - aEdRow ( this, ScResId( ED_ROW ) ), - aTbxCmd ( this, ScResId( TBX_CMD ) ), - aLbEntries ( this, ScResId( LB_ENTRIES ) ), - aWndScenarios( this,ScResId( STR_QHLP_SCEN_LISTBOX), ScResId(STR_QHLP_SCEN_COMMENT)), - aLbDocuments( this, ScResId( LB_DOCUMENTS ) ), + aFtCol ( new FixedInfo( this, ScResId( FT_COL ) ) ), + aEdCol ( new ColumnEdit( this, ScResId( ED_COL ) ) ), + aFtRow ( new FixedInfo( this, ScResId( FT_ROW ) ) ), + aEdRow ( new RowEdit( this, ScResId( ED_ROW ) ) ), + aTbxCmd ( new CommandToolBox( this, ScResId( TBX_CMD ) ) ), + aLbEntries ( new ScContentTree( this, ScResId( LB_ENTRIES ) ) ), + aWndScenarios( new ScScenarioWindow( this,ScResId( STR_QHLP_SCEN_LISTBOX), ScResId(STR_QHLP_SCEN_COMMENT)) ), + aLbDocuments( new ScDocListBox( this, ScResId( LB_DOCUMENTS ) ) ), aStrDragMode ( ScResId( STR_DRAGMODE ) ), aStrDisplay ( ScResId( STR_DISPLAY ) ), aStrActiveWin( ScResId( STR_ACTIVEWIN ) ), @@ -583,7 +583,7 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl nDropMode = rCfg.GetDragMode(); // eListMode is set from outside, Root further below - aLbDocuments.SetDropDownLineCount(9); + aLbDocuments->SetDropDownLineCount(9); OUString aOpen(" ("); aStrActive = aOpen; aStrActive += OUString( ScResId( STR_ACTIVE ) ); @@ -599,19 +599,19 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl const long nListboxYPos = ::std::max( - (aTbxCmd.GetPosPixel().Y() + aTbxCmd.GetSizePixel().Height()), - (aEdRow.GetPosPixel().Y() + aEdRow.GetSizePixel().Height()) ) + (aTbxCmd->GetPosPixel().Y() + aTbxCmd->GetSizePixel().Height()), + (aEdRow->GetPosPixel().Y() + aEdRow->GetSizePixel().Height()) ) + 4; - aLbEntries.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y); + aLbEntries->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y); - nBorderOffset = aLbEntries.GetPosPixel().X(); + nBorderOffset = aLbEntries->GetPosPixel().X(); - aInitSize.Width() = aTbxCmd.GetPosPixel().X() - + aTbxCmd.GetSizePixel().Width() + aInitSize.Width() = aTbxCmd->GetPosPixel().X() + + aTbxCmd->GetSizePixel().Width() + nBorderOffset; - aInitSize.Height() = aLbEntries.GetPosPixel().Y(); + aInitSize.Height() = aLbEntries->GetPosPixel().Y(); - nInitListHeight = aLbEntries.GetSizePixel().Height(); + nInitListHeight = aLbEntries->GetSizePixel().Height(); nListModeHeight = aInitSize.Height() + nInitListHeight; @@ -629,41 +629,41 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl StartListening( *(SfxGetpApp()) ); StartListening( rBindings ); - aLbDocuments.Hide(); // does not exist at NAV_LMODE_NONE + aLbDocuments->Hide(); // does not exist at NAV_LMODE_NONE - aLbEntries.InitWindowBits(true); + aLbEntries->InitWindowBits(true); - aLbEntries.SetSpaceBetweenEntries(0); - aLbEntries.SetSelectionMode( SINGLE_SELECTION ); - aLbEntries.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE | + aLbEntries->SetSpaceBetweenEntries(0); + aLbEntries->SetSelectionMode( SINGLE_SELECTION ); + aLbEntries->SetDragDropMode( SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY | SV_DRAGDROP_ENABLE_TOP ); // was a category chosen as root? sal_uInt16 nLastRoot = rCfg.GetRootType(); if ( nLastRoot ) - aLbEntries.SetRootType( nLastRoot ); + aLbEntries->SetRootType( nLastRoot ); - aLbEntries.Refresh(); + aLbEntries->Refresh(); GetDocNames(); - aTbxCmd.UpdateButtons(); + aTbxCmd->UpdateButtons(); UpdateColumn(); UpdateRow(); UpdateTable(); - aLbEntries.Hide(); - aWndScenarios.Hide(); - aWndScenarios.SetPosPixel( aLbEntries.GetPosPixel() ); + aLbEntries->Hide(); + aWndScenarios->Hide(); + aWndScenarios->SetPosPixel( aLbEntries->GetPosPixel() ); aContentIdle.SetIdleHdl( LINK( this, ScNavigatorDlg, TimeHdl ) ); aContentIdle.SetPriority( SchedulerPriority::LOWEST ); FreeResource(); - aLbEntries.SetAccessibleRelationLabeledBy(&aLbEntries); - aTbxCmd.SetAccessibleRelationLabeledBy(&aTbxCmd); - aLbDocuments.SetAccessibleName(aStrActiveWin); + aLbEntries->SetAccessibleRelationLabeledBy(aLbEntries.get()); + aTbxCmd->SetAccessibleRelationLabeledBy(aTbxCmd.get()); + aLbDocuments->SetAccessibleName(aStrActiveWin); if (pContextWin == NULL) { @@ -671,14 +671,19 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl // displayed in the sidebar and has the whole deck to fill. // Therefore hide the button that hides all controls below the // top two rows of buttons. - aTbxCmd.Select(IID_ZOOMOUT); - aTbxCmd.RemoveItem(aTbxCmd.GetItemPos(IID_ZOOMOUT)); + aTbxCmd->Select(IID_ZOOMOUT); + aTbxCmd->RemoveItem(aTbxCmd->GetItemPos(IID_ZOOMOUT)); } - aLbEntries.SetNavigatorDlgFlag(true); + aLbEntries->SetNavigatorDlgFlag(true); } ScNavigatorDlg::~ScNavigatorDlg() { + dispose(); +} + +void ScNavigatorDlg::dispose() +{ aContentIdle.Stop(); sal_uInt16 i; @@ -690,6 +695,16 @@ ScNavigatorDlg::~ScNavigatorDlg() EndListening( *(SfxGetpApp()) ); EndListening( rBindings ); + + aFtCol.disposeAndClear(); + aEdCol.disposeAndClear(); + aFtRow.disposeAndClear(); + aEdRow.disposeAndClear(); + aTbxCmd.disposeAndClear(); + aLbEntries.disposeAndClear(); + aWndScenarios.disposeAndClear(); + aLbDocuments.disposeAndClear(); + vcl::Window::dispose(); } void ScNavigatorDlg::Resizing( Size& rNewSize ) // Size = Outputsize? @@ -721,13 +736,13 @@ void ScNavigatorDlg::Paint( const Rectangle& rRect ) Wallpaper aBack( aBgColor ); SetBackground( aBack ); - aFtCol.SetBackground( aBack ); - aFtRow.SetBackground( aBack ); + aFtCol->SetBackground( aBack ); + aFtRow->SetBackground( aBack ); } else { - aFtCol.SetBackground(Wallpaper()); - aFtRow.SetBackground(Wallpaper()); + aFtCol->SetBackground(Wallpaper()); + aFtRow->SetBackground(Wallpaper()); } Window::Paint( rRect ); @@ -774,28 +789,28 @@ void ScNavigatorDlg::DoResize() // even if the content is not visible, adapt the size, // so the width fit - Point aEntryPos = aLbEntries.GetPosPixel(); - Point aListPos = aLbDocuments.GetPosPixel(); + Point aEntryPos = aLbEntries->GetPosPixel(); + Point aListPos = aLbDocuments->GetPosPixel(); aNewSize.Width() -= 2*nBorderOffset; - Size aDocSize = aLbDocuments.GetSizePixel(); + Size aDocSize = aLbDocuments->GetSizePixel(); aDocSize.Width() = aNewSize.Width(); if(!bSmall) { - long nListHeight = aLbDocuments.GetSizePixel().Height(); + long nListHeight = aLbDocuments->GetSizePixel().Height(); aNewSize.Height() -= ( aEntryPos.Y() + nListHeight + 2*nBorderOffset ); if(aNewSize.Height()<0) aNewSize.Height()=0; aListPos.Y() = aEntryPos.Y() + aNewSize.Height() + nBorderOffset; - if(aListPos.Y() > aLbEntries.GetPosPixel().Y()) - aLbDocuments.SetPosPixel( aListPos ); + if(aListPos.Y() > aLbEntries->GetPosPixel().Y()) + aLbDocuments->SetPosPixel( aListPos ); } - aLbEntries.SetSizePixel( aNewSize ); - aWndScenarios.SetSizePixel( aNewSize ); - aLbDocuments.SetSizePixel( aDocSize ); + aLbEntries->SetSizePixel( aNewSize ); + aWndScenarios->SetSizePixel( aNewSize ); + aLbDocuments->SetSizePixel( aDocSize ); bool bListMode = (eListMode != NAV_LMODE_NONE); if (pContextWin != NULL) @@ -815,7 +830,7 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) if ( nHintId == SC_HINT_DOCNAME_CHANGED ) { - aLbEntries.ActiveDocChanged(); + aLbEntries->ActiveDocChanged(); } else if ( NAV_LMODE_NONE == eListMode ) { @@ -826,25 +841,25 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) switch ( nHintId ) { case SC_HINT_TABLES_CHANGED: - aLbEntries.Refresh( SC_CONTENT_TABLE ); + aLbEntries->Refresh( SC_CONTENT_TABLE ); break; case SC_HINT_DBAREAS_CHANGED: - aLbEntries.Refresh( SC_CONTENT_DBAREA ); + aLbEntries->Refresh( SC_CONTENT_DBAREA ); break; case SC_HINT_AREAS_CHANGED: - aLbEntries.Refresh( SC_CONTENT_RANGENAME ); + aLbEntries->Refresh( SC_CONTENT_RANGENAME ); break; case SC_HINT_DRAW_CHANGED: - aLbEntries.Refresh( SC_CONTENT_GRAPHIC ); - aLbEntries.Refresh( SC_CONTENT_OLEOBJECT ); - aLbEntries.Refresh( SC_CONTENT_DRAWING ); + aLbEntries->Refresh( SC_CONTENT_GRAPHIC ); + aLbEntries->Refresh( SC_CONTENT_OLEOBJECT ); + aLbEntries->Refresh( SC_CONTENT_DRAWING ); break; case SC_HINT_AREALINKS_CHANGED: - aLbEntries.Refresh( SC_CONTENT_AREALINK ); + aLbEntries->Refresh( SC_CONTENT_AREALINK ); break; // SFX_HINT_DOCCHANGED not only at document change @@ -858,9 +873,9 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) aContentIdle.Start(); // Do not search notes immediately break; case FID_KILLEDITVIEW: - aLbEntries.ObjectFresh( SC_CONTENT_OLEOBJECT ); - aLbEntries.ObjectFresh( SC_CONTENT_DRAWING ); - aLbEntries.ObjectFresh( SC_CONTENT_GRAPHIC ); + aLbEntries->ObjectFresh( SC_CONTENT_OLEOBJECT ); + aLbEntries->ObjectFresh( SC_CONTENT_DRAWING ); + aLbEntries->ObjectFresh( SC_CONTENT_GRAPHIC ); break; default: break; @@ -872,7 +887,7 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) sal_uLong nEventId = static_cast<const SfxEventHint&>(rHint).GetEventId(); if ( nEventId == SFX_EVENT_ACTIVATEDOC ) { - aLbEntries.ActiveDocChanged(); + aLbEntries->ActiveDocChanged(); UpdateAll(); } } @@ -883,14 +898,14 @@ IMPL_LINK( ScNavigatorDlg, TimeHdl, Idle*, pIdle ) if ( pIdle != &aContentIdle ) return 0; - aLbEntries.Refresh( SC_CONTENT_NOTE ); + aLbEntries->Refresh( SC_CONTENT_NOTE ); return 0; } void ScNavigatorDlg::SetDropMode(sal_uInt16 nNew) { nDropMode = nNew; - aTbxCmd.UpdateButtons(); + aTbxCmd->UpdateButtons(); ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); rCfg.SetDragMode(nDropMode); @@ -1008,7 +1023,7 @@ void ScNavigatorDlg::UpdateColumn( const SCCOL* pCol ) else if ( GetViewData() ) nCurCol = pViewData->GetCurX() + 1; - aEdCol.SetCol( nCurCol ); + aEdCol->SetCol( nCurCol ); CheckDataArea(); } @@ -1019,7 +1034,7 @@ void ScNavigatorDlg::UpdateRow( const SCROW* pRow ) else if ( GetViewData() ) nCurRow = pViewData->GetCurY() + 1; - aEdRow.SetRow( nCurRow ); + aEdRow->SetRow( nCurRow ); CheckDataArea(); } @@ -1040,7 +1055,7 @@ void ScNavigatorDlg::UpdateAll() case NAV_LMODE_DOCS: case NAV_LMODE_DBAREAS: case NAV_LMODE_AREAS: - aLbEntries.Refresh(); + aLbEntries->Refresh(); break; case NAV_LMODE_NONE: @@ -1072,7 +1087,7 @@ void ScNavigatorDlg::SetListMode( NavListMode eMode, bool bSetSize ) case NAV_LMODE_AREAS: case NAV_LMODE_DBAREAS: case NAV_LMODE_DOCS: - aLbEntries.Refresh(); + aLbEntries->Refresh(); ShowList( true, bSetSize ); break; @@ -1081,7 +1096,7 @@ void ScNavigatorDlg::SetListMode( NavListMode eMode, bool bSetSize ) break; } - aTbxCmd.UpdateButtons(); + aTbxCmd->UpdateButtons(); if ( eMode != NAV_LMODE_NONE ) { @@ -1107,8 +1122,8 @@ void ScNavigatorDlg::ShowList( bool bShow, bool bSetSize ) if ( pFloat ) pFloat->SetMinOutputSizePixel( aMinSize ); aSize.Height() = nListModeHeight; - aLbEntries.Show(); - aLbDocuments.Show(); + aLbEntries->Show(); + aLbDocuments->Show(); } else { @@ -1118,10 +1133,10 @@ void ScNavigatorDlg::ShowList( bool bShow, bool bSetSize ) nListModeHeight = aSize.Height(); } aSize.Height() = aInitSize.Height(); - aLbEntries.Hide(); - aLbDocuments.Hide(); + aLbEntries->Hide(); + aLbDocuments->Hide(); } - aWndScenarios.Hide(); + aWndScenarios->Hide(); if ( pFloat ) { @@ -1156,8 +1171,8 @@ void ScNavigatorDlg::ShowScenarios( bool bShow, bool bSetSize ) rBindings.Invalidate( SID_SELECT_SCENARIO ); rBindings.Update( SID_SELECT_SCENARIO ); - aWndScenarios.Show(); - aLbDocuments.Show(); + aWndScenarios->Show(); + aLbDocuments->Show(); } else { @@ -1167,10 +1182,10 @@ void ScNavigatorDlg::ShowScenarios( bool bShow, bool bSetSize ) nListModeHeight = aSize.Height(); } aSize.Height() = aInitSize.Height(); - aWndScenarios.Hide(); - aLbDocuments.Hide(); + aWndScenarios->Hide(); + aLbDocuments->Hide(); } - aLbEntries.Hide(); + aLbEntries->Hide(); if ( pFloat ) { @@ -1190,8 +1205,8 @@ void ScNavigatorDlg::ShowScenarios( bool bShow, bool bSetSize ) void ScNavigatorDlg::GetDocNames( const OUString* pManualSel ) { - aLbDocuments.Clear(); - aLbDocuments.SetUpdateMode( false ); + aLbDocuments->Clear(); + aLbDocuments->SetUpdateMode( false ); ScDocShell* pCurrentSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); @@ -1207,7 +1222,7 @@ void ScNavigatorDlg::GetDocNames( const OUString* pManualSel ) aEntry += aStrActive; else aEntry += aStrNotActive; - aLbDocuments.InsertEntry( aEntry ); + aLbDocuments->InsertEntry( aEntry ); if ( pManualSel ? ( aName == *pManualSel ) : ( pSh == pCurrentSh ) ) @@ -1217,22 +1232,22 @@ void ScNavigatorDlg::GetDocNames( const OUString* pManualSel ) pSh = SfxObjectShell::GetNext( *pSh ); } - aLbDocuments.InsertEntry( aStrActiveWin ); + aLbDocuments->InsertEntry( aStrActiveWin ); - OUString aHidden = aLbEntries.GetHiddenTitle(); + OUString aHidden = aLbEntries->GetHiddenTitle(); if (!aHidden.isEmpty()) { OUString aEntry = aHidden; aEntry += aStrHidden; - aLbDocuments.InsertEntry( aEntry ); + aLbDocuments->InsertEntry( aEntry ); if ( pManualSel && aHidden == *pManualSel ) aSelEntry = aEntry; } - aLbDocuments.SetUpdateMode( true ); + aLbDocuments->SetUpdateMode( true ); - aLbDocuments.SelectEntry( aSelEntry ); + aLbDocuments->SelectEntry( aSelEntry ); } void ScNavigatorDlg::MarkDataArea() @@ -1268,7 +1283,7 @@ void ScNavigatorDlg::UnmarkDataArea() void ScNavigatorDlg::CheckDataArea() { - if ( aTbxCmd.IsItemChecked( IID_DATA ) && pMarkArea ) + if ( aTbxCmd->IsItemChecked( IID_DATA ) && pMarkArea ) { if ( nCurTab != pMarkArea->nTab || nCurCol < pMarkArea->nColStart+1 @@ -1276,8 +1291,8 @@ void ScNavigatorDlg::CheckDataArea() || nCurRow < pMarkArea->nRowStart+1 || nCurRow > pMarkArea->nRowEnd+1 ) { - aTbxCmd.SetItemState( IID_DATA, TriState(TRISTATE_TRUE) ); - aTbxCmd.Select( IID_DATA ); + aTbxCmd->SetItemState( IID_DATA, TriState(TRISTATE_TRUE) ); + aTbxCmd->Select( IID_DATA ); } } } @@ -1295,7 +1310,7 @@ void ScNavigatorDlg::StartOfDataArea() SCCOL nCol = aMarkRange.aStart.Col(); SCROW nRow = aMarkRange.aStart.Row(); - if ( (nCol+1 != aEdCol.GetCol()) || (nRow+1 != aEdRow.GetRow()) ) + if ( (nCol+1 != aEdCol->GetCol()) || (nRow+1 != aEdRow->GetRow()) ) SetCurrentCell( nCol, nRow ); } } @@ -1313,7 +1328,7 @@ void ScNavigatorDlg::EndOfDataArea() SCCOL nCol = aMarkRange.aEnd.Col(); SCROW nRow = aMarkRange.aEnd.Row(); - if ( (nCol+1 != aEdCol.GetCol()) || (nRow+1 != aEdRow.GetRow()) ) + if ( (nCol+1 != aEdCol->GetCol()) || (nRow+1 != aEdRow->GetRow()) ) SetCurrentCell( nCol, nRow ); } } diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx index 96b37d81602d..c9fb51fc619e 100644 --- a/sc/source/ui/navipi/scenwnd.cxx +++ b/sc/source/ui/navipi/scenwnd.cxx @@ -197,23 +197,23 @@ void ScScenarioListBox::DeleteScenario( bool bQueryBox ) ScScenarioWindow::ScScenarioWindow( vcl::Window* pParent, const OUString& aQH_List, const OUString& aQH_Comment) : Window ( pParent, WB_TABSTOP | WB_DIALOGCONTROL ), - aLbScenario ( *this ), - aEdComment ( this, WB_BORDER | WB_LEFT | WB_READONLY | WB_VSCROLL | WB_TABSTOP ) + aLbScenario ( new ScScenarioListBox(*this) ), + aEdComment ( new MultiLineEdit(this, WB_BORDER | WB_LEFT | WB_READONLY | WB_VSCROLL | WB_TABSTOP) ) { vcl::Font aFont( GetFont() ); aFont.SetTransparent( true ); aFont.SetWeight( WEIGHT_LIGHT ); - aEdComment.SetFont( aFont ); - aEdComment.SetMaxTextLen( 512 ); - aLbScenario.SetPosPixel( Point(0,0) ); - aLbScenario.SetHelpId(HID_SC_SCENWIN_TOP); - aEdComment.SetHelpId(HID_SC_SCENWIN_BOTTOM); - aLbScenario.Show(); - aEdComment.Show(); - - aLbScenario.SetQuickHelpText(aQH_List); - aEdComment.SetQuickHelpText(aQH_Comment); - aEdComment.SetBackground( Color( COL_LIGHTGRAY ) ); + aEdComment->SetFont( aFont ); + aEdComment->SetMaxTextLen( 512 ); + aLbScenario->SetPosPixel( Point(0,0) ); + aLbScenario->SetHelpId(HID_SC_SCENWIN_TOP); + aEdComment->SetHelpId(HID_SC_SCENWIN_BOTTOM); + aLbScenario->Show(); + aEdComment->Show(); + + aLbScenario->SetQuickHelpText(aQH_List); + aEdComment->SetQuickHelpText(aQH_Comment); + aEdComment->SetBackground( Color( COL_LIGHTGRAY ) ); SfxViewFrame* pViewFrm = SfxViewFrame::Current(); if (pViewFrm) @@ -226,6 +226,14 @@ ScScenarioWindow::ScScenarioWindow( vcl::Window* pParent, const OUString& aQH_Li ScScenarioWindow::~ScScenarioWindow() { + dispose(); +} + +void ScScenarioWindow::dispose() +{ + aLbScenario.disposeAndClear(); + aEdComment.disposeAndClear(); + vcl::Window::dispose(); } void ScScenarioWindow::Paint( const Rectangle& rRect ) @@ -242,26 +250,26 @@ void ScScenarioWindow::NotifyState( const SfxPoolItem* pState ) { if( pState ) { - aLbScenario.Enable(); + aLbScenario->Enable(); if ( pState->ISA(SfxStringItem) ) { OUString aNewEntry( static_cast<const SfxStringItem*>(pState)->GetValue() ); if ( !aNewEntry.isEmpty() ) - aLbScenario.SelectEntry( aNewEntry ); + aLbScenario->SelectEntry( aNewEntry ); else - aLbScenario.SetNoSelection(); + aLbScenario->SetNoSelection(); } else if ( pState->ISA(SfxStringListItem) ) { - aLbScenario.UpdateEntries( static_cast<const SfxStringListItem*>(pState)->GetList() ); + aLbScenario->UpdateEntries( static_cast<const SfxStringListItem*>(pState)->GetList() ); } } else { - aLbScenario.Disable(); - aLbScenario.SetNoSelection(); + aLbScenario->Disable(); + aLbScenario->SetNoSelection(); } } @@ -273,10 +281,10 @@ void ScScenarioWindow::SetSizePixel( const Size& rNewSize ) Window::SetSizePixel( aSize ); aSize.Height() = nHeight; - aLbScenario.SetSizePixel( aSize ); + aLbScenario->SetSizePixel( aSize ); aSize.Height() -= 4; - aEdComment.SetPosSizePixel( Point( 0, nHeight+4 ), aSize ); + aEdComment->SetPosSizePixel( Point( 0, nHeight+4 ), aSize ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx index 110953960262..eaa0d3786afa 100644 --- a/sc/source/ui/optdlg/tpcalc.cxx +++ b/sc/source/ui/optdlg/tpcalc.cxx @@ -66,8 +66,14 @@ ScTpCalcOptions::ScTpCalcOptions(vcl::Window* pParent, const SfxItemSet& rCoreAt ScTpCalcOptions::~ScTpCalcOptions() { + dispose(); +} + +void ScTpCalcOptions::dispose() +{ delete pOldOptions; delete pLocalOptions; + SfxTabPage::dispose(); } void ScTpCalcOptions::Init() diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index dcc38d38f9d4..490a2fc956ad 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -84,8 +84,14 @@ ScTpUserLists::ScTpUserLists( vcl::Window* pParent, ScTpUserLists::~ScTpUserLists() { + dispose(); +} + +void ScTpUserLists::dispose() +{ delete pUserLists; delete pRangeUtil; + SfxTabPage::dispose(); } void ScTpUserLists::Init() diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index 2308812e170b..82cf00b1c0b3 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -95,7 +95,13 @@ ScTpContentOptions::ScTpContentOptions( vcl::Window* pParent, ScTpContentOptions::~ScTpContentOptions() { + dispose(); +} + +void ScTpContentOptions::dispose() +{ delete pLocalOptions; + SfxTabPage::dispose(); } SfxTabPage* ScTpContentOptions::Create( vcl::Window* pParent, diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index c95aa13cc69b..36471e61c5a0 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -136,6 +136,11 @@ ScPrintAreasDlg::ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Win ScPrintAreasDlg::~ScPrintAreasDlg() { + dispose(); +} + +void ScPrintAreasDlg::dispose() +{ // Extra-Data an ListBox-Entries abraeumen ListBox* aLb[3] = { pLbPrintArea, pLbRepeatRow, pLbRepeatCol }; @@ -145,6 +150,7 @@ ScPrintAreasDlg::~ScPrintAreasDlg() for ( sal_uInt16 j=0; j<nCount; j++ ) delete static_cast<OUString*>(aLb[i]->GetEntryData(j)); } + ScAnyRefDlg::dispose(); } bool ScPrintAreasDlg::Close() diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx index 8f0a1b4a578b..7b842edb257e 100644 --- a/sc/source/ui/pagedlg/tphfedit.cxx +++ b/sc/source/ui/pagedlg/tphfedit.cxx @@ -118,6 +118,11 @@ void ScEditWindow::Resize() ScEditWindow::~ScEditWindow() { + dispose(); +} + +void ScEditWindow::dispose() +{ // delete Accessible object before deleting EditEngine and EditView if (pAcc) { @@ -127,6 +132,7 @@ ScEditWindow::~ScEditWindow() } delete pEdEngine; delete pEdView; + Control::dispose(); } extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScEditWindow(vcl::Window *pParent, VclBuilder::stringmap &) diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.cxx b/sc/source/ui/sidebar/CellBorderStyleControl.cxx index 08f7417bea08..72bd59eae8bc 100644 --- a/sc/source/ui/sidebar/CellBorderStyleControl.cxx +++ b/sc/source/ui/sidebar/CellBorderStyleControl.cxx @@ -45,11 +45,11 @@ namespace sc { namespace sidebar { CellBorderStyleControl::CellBorderStyleControl(vcl::Window* pParent, CellAppearancePropertyPanel& rPanel) : svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE)), mrCellAppearancePropertyPanel(rPanel), - maTBBorder1(this, ScResId(TB_BORDER1)), - maTBBorder2(this, ScResId(TB_BORDER2)), - maTBBorder3(this, ScResId(TB_BORDER3)), - maFL1(this, ScResId(FL_1)), - maFL2(this, ScResId(FL_2)), + maTBBorder1(new ToolBox(this, ScResId(TB_BORDER1))), + maTBBorder2(new ToolBox(this, ScResId(TB_BORDER2))), + maTBBorder3(new ToolBox(this, ScResId(TB_BORDER3))), + maFL1(new FixedLine(this, ScResId(FL_1))), + maFL2(new FixedLine(this, ScResId(FL_2))), mpImageList(0) { Initialize(); @@ -58,7 +58,18 @@ CellBorderStyleControl::CellBorderStyleControl(vcl::Window* pParent, CellAppeara CellBorderStyleControl::~CellBorderStyleControl(void) { + dispose(); +} + +void CellBorderStyleControl::dispose() +{ delete[] mpImageList; + maTBBorder1.disposeAndClear(); + maTBBorder2.disposeAndClear(); + maTBBorder3.disposeAndClear(); + maFL1.disposeAndClear(); + maFL2.disposeAndClear(); + svx::sidebar::PopupControl::dispose(); } void CellBorderStyleControl::Initialize() @@ -81,60 +92,60 @@ void CellBorderStyleControl::Initialize() mpImageList[14] = Image(ScResId(IMG_BORDER15)); mpImageList[15] = Image(ScResId(IMG_BORDER16)); - maTBBorder1.SetItemImage(TBI_BORDER1_NONE, mpImageList[0]); - maTBBorder1.SetItemImage(TBI_BORDER1_ALL, mpImageList[1]); - maTBBorder1.SetItemImage(TBI_BORDER1_OUTER, mpImageList[2]); - maTBBorder1.SetItemImage(TBI_BORDER1_OUTERBOLD, mpImageList[3]); - maTBBorder1.SetBackground(Wallpaper()); - maTBBorder1.SetPaintTransparent(true); - Size aTbxSize( maTBBorder1.CalcWindowSizePixel() ); - maTBBorder1.SetOutputSizePixel( aTbxSize ); + maTBBorder1->SetItemImage(TBI_BORDER1_NONE, mpImageList[0]); + maTBBorder1->SetItemImage(TBI_BORDER1_ALL, mpImageList[1]); + maTBBorder1->SetItemImage(TBI_BORDER1_OUTER, mpImageList[2]); + maTBBorder1->SetItemImage(TBI_BORDER1_OUTERBOLD, mpImageList[3]); + maTBBorder1->SetBackground(Wallpaper()); + maTBBorder1->SetPaintTransparent(true); + Size aTbxSize( maTBBorder1->CalcWindowSizePixel() ); + maTBBorder1->SetOutputSizePixel( aTbxSize ); Link aLink = LINK(this, CellBorderStyleControl, TB1SelectHdl); - maTBBorder1.SetSelectHdl ( aLink ); + maTBBorder1->SetSelectHdl ( aLink ); - maTBBorder2.SetLineCount(2); - maTBBorder2.InsertItem(TBI_BORDER2_LEFT, mpImageList[4]); - maTBBorder2.InsertItem(TBI_BORDER2_RIGHT, mpImageList[5]); - maTBBorder2.InsertItem(TBI_BORDER2_TOP, mpImageList[6]); - maTBBorder2.InsertItem(TBI_BORDER2_BOT, mpImageList[7]); - maTBBorder2.InsertBreak(); - maTBBorder2.InsertItem(TBI_BORDER2_BLTR, mpImageList[8]); - maTBBorder2.InsertItem(TBI_BORDER2_TLBR, mpImageList[9]); - maTBBorder2.InsertItem(TBI_BORDER2_TOPBOT, mpImageList[10]); - maTBBorder2.InsertItem(TBI_BORDER2_LEFTRIGHT, mpImageList[11]); - maTBBorder2.SetBackground(Wallpaper()); - maTBBorder2.SetPaintTransparent(true); - aTbxSize = maTBBorder2.CalcWindowSizePixel() ; - maTBBorder2.SetOutputSizePixel( aTbxSize ); - maTBBorder2.SetHelpId(TBI_BORDER2_LEFT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT); - maTBBorder2.SetHelpId(TBI_BORDER2_RIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT); - maTBBorder2.SetHelpId(TBI_BORDER2_TOP, HID_PROPERTYPANEL_SC_BORDER_TBI_TOP); - maTBBorder2.SetHelpId(TBI_BORDER2_BOT, HID_PROPERTYPANEL_SC_BORDER_TBI_BOT); - maTBBorder2.SetHelpId(TBI_BORDER2_BLTR, HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR); - maTBBorder2.SetHelpId(TBI_BORDER2_TLBR, HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR); - maTBBorder2.SetHelpId(TBI_BORDER2_TOPBOT, HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT); - maTBBorder2.SetHelpId(TBI_BORDER2_LEFTRIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT); - maTBBorder2.SetItemText(TBI_BORDER2_LEFT, ScResId(STR_BORDER_1)); - maTBBorder2.SetItemText(TBI_BORDER2_RIGHT, ScResId(STR_BORDER_2)); - maTBBorder2.SetItemText(TBI_BORDER2_TOP, ScResId(STR_BORDER_3)); - maTBBorder2.SetItemText(TBI_BORDER2_BOT, ScResId(STR_BORDER_4)); - maTBBorder2.SetItemText(TBI_BORDER2_BLTR, ScResId(STR_BORDER_5)); - maTBBorder2.SetItemText(TBI_BORDER2_TLBR, ScResId(STR_BORDER_6)); - maTBBorder2.SetItemText(TBI_BORDER2_TOPBOT, ScResId(STR_BORDER_7)); - maTBBorder2.SetItemText(TBI_BORDER2_LEFTRIGHT, ScResId(STR_BORDER_8)); + maTBBorder2->SetLineCount(2); + maTBBorder2->InsertItem(TBI_BORDER2_LEFT, mpImageList[4]); + maTBBorder2->InsertItem(TBI_BORDER2_RIGHT, mpImageList[5]); + maTBBorder2->InsertItem(TBI_BORDER2_TOP, mpImageList[6]); + maTBBorder2->InsertItem(TBI_BORDER2_BOT, mpImageList[7]); + maTBBorder2->InsertBreak(); + maTBBorder2->InsertItem(TBI_BORDER2_BLTR, mpImageList[8]); + maTBBorder2->InsertItem(TBI_BORDER2_TLBR, mpImageList[9]); + maTBBorder2->InsertItem(TBI_BORDER2_TOPBOT, mpImageList[10]); + maTBBorder2->InsertItem(TBI_BORDER2_LEFTRIGHT, mpImageList[11]); + maTBBorder2->SetBackground(Wallpaper()); + maTBBorder2->SetPaintTransparent(true); + aTbxSize = maTBBorder2->CalcWindowSizePixel() ; + maTBBorder2->SetOutputSizePixel( aTbxSize ); + maTBBorder2->SetHelpId(TBI_BORDER2_LEFT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT); + maTBBorder2->SetHelpId(TBI_BORDER2_RIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT); + maTBBorder2->SetHelpId(TBI_BORDER2_TOP, HID_PROPERTYPANEL_SC_BORDER_TBI_TOP); + maTBBorder2->SetHelpId(TBI_BORDER2_BOT, HID_PROPERTYPANEL_SC_BORDER_TBI_BOT); + maTBBorder2->SetHelpId(TBI_BORDER2_BLTR, HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR); + maTBBorder2->SetHelpId(TBI_BORDER2_TLBR, HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR); + maTBBorder2->SetHelpId(TBI_BORDER2_TOPBOT, HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT); + maTBBorder2->SetHelpId(TBI_BORDER2_LEFTRIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT); + maTBBorder2->SetItemText(TBI_BORDER2_LEFT, ScResId(STR_BORDER_1)); + maTBBorder2->SetItemText(TBI_BORDER2_RIGHT, ScResId(STR_BORDER_2)); + maTBBorder2->SetItemText(TBI_BORDER2_TOP, ScResId(STR_BORDER_3)); + maTBBorder2->SetItemText(TBI_BORDER2_BOT, ScResId(STR_BORDER_4)); + maTBBorder2->SetItemText(TBI_BORDER2_BLTR, ScResId(STR_BORDER_5)); + maTBBorder2->SetItemText(TBI_BORDER2_TLBR, ScResId(STR_BORDER_6)); + maTBBorder2->SetItemText(TBI_BORDER2_TOPBOT, ScResId(STR_BORDER_7)); + maTBBorder2->SetItemText(TBI_BORDER2_LEFTRIGHT, ScResId(STR_BORDER_8)); aLink = LINK(this, CellBorderStyleControl, TB2SelectHdl); - maTBBorder2.SetSelectHdl ( aLink ); + maTBBorder2->SetSelectHdl ( aLink ); - maTBBorder3.SetItemImage(TBI_BORDER3_S1, mpImageList[12]); - maTBBorder3.SetItemImage(TBI_BORDER3_S2, mpImageList[13]); - maTBBorder3.SetItemImage(TBI_BORDER3_S3, mpImageList[14]); - maTBBorder3.SetItemImage(TBI_BORDER3_S4, mpImageList[15]); - maTBBorder3.SetBackground(Wallpaper()); - maTBBorder3.SetPaintTransparent(true); - aTbxSize = maTBBorder3.CalcWindowSizePixel() ; - maTBBorder3.SetOutputSizePixel( aTbxSize ); + maTBBorder3->SetItemImage(TBI_BORDER3_S1, mpImageList[12]); + maTBBorder3->SetItemImage(TBI_BORDER3_S2, mpImageList[13]); + maTBBorder3->SetItemImage(TBI_BORDER3_S3, mpImageList[14]); + maTBBorder3->SetItemImage(TBI_BORDER3_S4, mpImageList[15]); + maTBBorder3->SetBackground(Wallpaper()); + maTBBorder3->SetPaintTransparent(true); + aTbxSize = maTBBorder3->CalcWindowSizePixel() ; + maTBBorder3->SetOutputSizePixel( aTbxSize ); aLink = LINK(this, CellBorderStyleControl, TB3SelectHdl); - maTBBorder3.SetSelectHdl ( aLink ); + maTBBorder3->SetSelectHdl ( aLink ); } IMPL_LINK(CellBorderStyleControl, TB1SelectHdl, ToolBox*, pToolBox) diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.hxx b/sc/source/ui/sidebar/CellBorderStyleControl.hxx index 7cf04e2d68fd..706d10e7b11c 100644 --- a/sc/source/ui/sidebar/CellBorderStyleControl.hxx +++ b/sc/source/ui/sidebar/CellBorderStyleControl.hxx @@ -32,11 +32,11 @@ class CellBorderStyleControl : public svx::sidebar::PopupControl { private: CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; - ToolBox maTBBorder1; - ToolBox maTBBorder2; - ToolBox maTBBorder3; - FixedLine maFL1; - FixedLine maFL2; + VclPtr<ToolBox> maTBBorder1; + VclPtr<ToolBox> maTBBorder2; + VclPtr<ToolBox> maTBBorder3; + VclPtr<FixedLine> maFL1; + VclPtr<FixedLine> maFL2; Image* mpImageList; void Initialize(); @@ -47,7 +47,8 @@ private: public: CellBorderStyleControl(vcl::Window* pParent, CellAppearancePropertyPanel& rPanel); - virtual ~CellBorderStyleControl(void); + virtual ~CellBorderStyleControl(); + virtual void dispose() SAL_OVERRIDE; }; } } // end of namespace svx::sidebar diff --git a/sc/source/ui/sidebar/CellLineStyleControl.cxx b/sc/source/ui/sidebar/CellLineStyleControl.cxx index ac4d3467327b..187cbed1111d 100644 --- a/sc/source/ui/sidebar/CellLineStyleControl.cxx +++ b/sc/source/ui/sidebar/CellLineStyleControl.cxx @@ -36,27 +36,39 @@ namespace sc { namespace sidebar { CellLineStyleControl::CellLineStyleControl(vcl::Window* pParent, CellAppearancePropertyPanel& rPanel) : svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE)), mrCellAppearancePropertyPanel(rPanel), - maPushButtonMoreOptions(this, ScResId(PB_OPTIONS)), - maCellLineStyleValueSet(this, ScResId(VS_STYLE)), + maPushButtonMoreOptions(new PushButton(this, ScResId(PB_OPTIONS))), + maCellLineStyleValueSet(new sc::sidebar::CellLineStyleValueSet(this, ScResId(VS_STYLE))), mbVSfocus(true) { Initialize(); FreeResource(); } +CellLineStyleControl::~CellLineStyleControl() +{ + dispose(); +} + +void CellLineStyleControl::dispose() +{ + maPushButtonMoreOptions.disposeAndClear(); + maCellLineStyleValueSet.disposeAndClear(); + svx::sidebar::PopupControl::dispose(); +} + void CellLineStyleControl::Initialize() { - //maPushButtonMoreOptions.SetIcoPosX(2); + //maPushButtonMoreOptions->SetIcoPosX(2); Link aLink = LINK(this, CellLineStyleControl, PBClickHdl); - maPushButtonMoreOptions.SetClickHdl(aLink); + maPushButtonMoreOptions->SetClickHdl(aLink); - maCellLineStyleValueSet.SetStyle(maCellLineStyleValueSet.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT); - maCellLineStyleValueSet.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); - maCellLineStyleValueSet.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + maCellLineStyleValueSet->SetStyle(maCellLineStyleValueSet->GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT); + maCellLineStyleValueSet->SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); + maCellLineStyleValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor()); for(sal_uInt16 i = 1 ; i <= 9 ; i++) { - maCellLineStyleValueSet.InsertItem(i); + maCellLineStyleValueSet->InsertItem(i); } maStr[0] = GetSettings().GetLocaleI18nHelper().GetNum( 5, 2 ) + "pt"; @@ -68,46 +80,46 @@ void CellLineStyleControl::Initialize() maStr[6] = GetSettings().GetLocaleI18nHelper().GetNum( 450, 2 ) + "pt"; maStr[7] = GetSettings().GetLocaleI18nHelper().GetNum( 505, 2 ) + "pt"; maStr[8] = GetSettings().GetLocaleI18nHelper().GetNum( 750, 2 ) + "pt"; - maCellLineStyleValueSet.SetUnit(&maStr[0]); + maCellLineStyleValueSet->SetUnit(&maStr[0]); for (sal_uInt16 i = 1; i <= CELL_LINE_STYLE_ENTRIES; ++i) { - maCellLineStyleValueSet.SetItemText(i, maStr[i-1]); + maCellLineStyleValueSet->SetItemText(i, maStr[i-1]); } SetAllNoSel(); aLink = LINK(this, CellLineStyleControl, VSSelectHdl); - maCellLineStyleValueSet.SetSelectHdl(aLink); - maCellLineStyleValueSet.StartSelection(); - maCellLineStyleValueSet.Show(); + maCellLineStyleValueSet->SetSelectHdl(aLink); + maCellLineStyleValueSet->StartSelection(); + maCellLineStyleValueSet->Show(); } void CellLineStyleControl::GetFocus() { if(!mbVSfocus) { - maPushButtonMoreOptions.GrabFocus(); + maPushButtonMoreOptions->GrabFocus(); } else { - maCellLineStyleValueSet.GrabFocus(); + maCellLineStyleValueSet->GrabFocus(); } } void CellLineStyleControl::SetAllNoSel() { - maCellLineStyleValueSet.SelectItem(0); - maCellLineStyleValueSet.SetNoSelection(); - maCellLineStyleValueSet.Format(); + maCellLineStyleValueSet->SelectItem(0); + maCellLineStyleValueSet->SetNoSelection(); + maCellLineStyleValueSet->Format(); Invalidate(); - maCellLineStyleValueSet.StartSelection(); + maCellLineStyleValueSet->StartSelection(); } IMPL_LINK(CellLineStyleControl, VSSelectHdl, void *, pControl) { if(pControl == &maCellLineStyleValueSet) { - const sal_uInt16 iPos(maCellLineStyleValueSet.GetSelectItemId()); + const sal_uInt16 iPos(maCellLineStyleValueSet->GetSelectItemId()); SvxLineItem aLineItem(SID_FRAME_LINESTYLE); using namespace ::com::sun::star::table::BorderLineStyle; editeng::SvxBorderStyle nStyle = SOLID; @@ -178,7 +190,7 @@ IMPL_LINK(CellLineStyleControl, VSSelectHdl, void *, pControl) IMPL_LINK(CellLineStyleControl, PBClickHdl, PushButton *, pPBtn) { - if(pPBtn == &maPushButtonMoreOptions) + if(pPBtn == maPushButtonMoreOptions.get()) { if(mrCellAppearancePropertyPanel.GetBindings()) { @@ -200,48 +212,48 @@ void CellLineStyleControl::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal if(out == DEF_LINE_WIDTH_0 && in == 0 && dis == 0) //1 { - maCellLineStyleValueSet.SetSelItem(1); + maCellLineStyleValueSet->SetSelItem(1); } else if(out == DEF_LINE_WIDTH_2 && in == 0 && dis == 0) //2 { - maCellLineStyleValueSet.SetSelItem(2); + maCellLineStyleValueSet->SetSelItem(2); } else if(out == DEF_LINE_WIDTH_3 && in == 0 && dis == 0) //3 { - maCellLineStyleValueSet.SetSelItem(3); + maCellLineStyleValueSet->SetSelItem(3); } else if(out == DEF_LINE_WIDTH_4 && in == 0 && dis == 0) //4 { - maCellLineStyleValueSet.SetSelItem(4); + maCellLineStyleValueSet->SetSelItem(4); } else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_1) //5 { - maCellLineStyleValueSet.SetSelItem(5); + maCellLineStyleValueSet->SetSelItem(5); } else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //6 { - maCellLineStyleValueSet.SetSelItem(6); + maCellLineStyleValueSet->SetSelItem(6); } else if(out == DEF_LINE_WIDTH_1 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_1) //7 { - maCellLineStyleValueSet.SetSelItem(7); + maCellLineStyleValueSet->SetSelItem(7); } else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //8 { - maCellLineStyleValueSet.SetSelItem(8); + maCellLineStyleValueSet->SetSelItem(8); } else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_2) //9 { - maCellLineStyleValueSet.SetSelItem(9); + maCellLineStyleValueSet->SetSelItem(9); } else { - maCellLineStyleValueSet.SetSelItem(0); + maCellLineStyleValueSet->SetSelItem(0); mbVSfocus = false; } - maCellLineStyleValueSet.Format(); - maCellLineStyleValueSet.StartSelection(); + maCellLineStyleValueSet->Format(); + maCellLineStyleValueSet->StartSelection(); } } } // end of namespace svx::sidebar diff --git a/sc/source/ui/sidebar/CellLineStyleControl.hxx b/sc/source/ui/sidebar/CellLineStyleControl.hxx index a00079ac8dbd..3b772db89fd9 100644 --- a/sc/source/ui/sidebar/CellLineStyleControl.hxx +++ b/sc/source/ui/sidebar/CellLineStyleControl.hxx @@ -31,8 +31,8 @@ class CellLineStyleControl : public svx::sidebar::PopupControl { private: CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; - PushButton maPushButtonMoreOptions; - CellLineStyleValueSet maCellLineStyleValueSet; + VclPtr<PushButton> maPushButtonMoreOptions; + VclPtr<CellLineStyleValueSet> maCellLineStyleValueSet; OUString maStr[CELL_LINE_STYLE_ENTRIES]; /// bitfield @@ -46,18 +46,20 @@ private: public: CellLineStyleControl(vcl::Window* pParent, CellAppearancePropertyPanel& rPanel); + virtual ~CellLineStyleControl(); + virtual void dispose() SAL_OVERRIDE; void GetFocus() SAL_OVERRIDE; void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis); ValueSet& GetValueSet() { - return maCellLineStyleValueSet; + return *maCellLineStyleValueSet.get(); } Control& GetPushButton() { - return maPushButtonMoreOptions; + return *maPushButtonMoreOptions.get(); } }; diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx index eae59d67fa17..d928903d2041 100644 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx @@ -34,7 +34,13 @@ CellLineStyleValueSet::CellLineStyleValueSet( vcl::Window* pParent, const ResId& CellLineStyleValueSet::~CellLineStyleValueSet() { + dispose(); +} + +void CellLineStyleValueSet::dispose() +{ delete pVDev; + ValueSet::dispose(); } void CellLineStyleValueSet::SetUnit(const OUString* str) diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx index 969f346005d4..65b390a4e4fa 100644 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx @@ -35,6 +35,7 @@ private: public: CellLineStyleValueSet( vcl::Window* pParent, const ResId& rResId); virtual ~CellLineStyleValueSet(); + virtual void dispose() SAL_OVERRIDE; void SetUnit(const OUString* str); void SetSelItem(sal_uInt16 nSel); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 2b0ca4c85717..ea3a10b19060 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -224,6 +224,7 @@ public: ScFilterListBox( vcl::Window* pParent, ScGridWindow* pGrid, SCCOL nNewCol, SCROW nNewRow, ScFilterBoxMode eNewMode ); virtual ~ScFilterListBox(); + virtual void dispose() SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual void Select() SAL_OVERRIDE; @@ -258,8 +259,14 @@ ScFilterListBox::ScFilterListBox( vcl::Window* pParent, ScGridWindow* pGrid, ScFilterListBox::~ScFilterListBox() { + dispose(); +} + +void ScFilterListBox::dispose() +{ if (IsMouseCaptured()) ReleaseMouse(); + ListBox::dispose(); } void ScFilterListBox::EndInit() @@ -522,6 +529,18 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos ScGridWindow::~ScGridWindow() { + dispose(); +} + +void ScGridWindow::dispose() +{ + // #114409# + ImpDestroyOverlayObjects(); + + delete pFilterBox; + delete pFilterFloat; + delete pNoteMarker; + vcl::Window::dispose(); } void ScGridWindow::ClickExtern() diff --git a/sc/source/ui/view/olinewin.cxx b/sc/source/ui/view/olinewin.cxx index 4752e567f4de..18a137598ebf 100644 --- a/sc/source/ui/view/olinewin.cxx +++ b/sc/source/ui/view/olinewin.cxx @@ -71,10 +71,16 @@ ScOutlineWindow::ScOutlineWindow( vcl::Window* pParent, ScOutlineMode eMode, ScV ScOutlineWindow::~ScOutlineWindow() { + dispose(); +} + +void ScOutlineWindow::dispose() +{ // remove the window from task pane list if( SystemWindow* pSysWin = GetSystemWindow() ) if( TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList() ) pTaskPaneList->RemoveWindow( this ); + vcl::Window::dispose(); } void ScOutlineWindow::SetHeaderSize( long nNewSize ) diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 14e16b366e41..15da7750e594 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -143,8 +143,14 @@ ScPreview::ScPreview( vcl::Window* pParent, ScDocShell* pDocSh, ScPreviewShell* ScPreview::~ScPreview() { + dispose(); +} + +void ScPreview::dispose() +{ delete pDrawView; delete pLocationData; + vcl::Window::dispose(); } void ScPreview::UpdateDrawView() // nTab must be right diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 706856f4cfe0..9cf9fb3ceb12 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -199,13 +199,13 @@ ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pHdrSelEng( NULL ), aHdrFunc( &aViewData ), pDrawView( NULL ), - aVScrollTop( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ), - aVScrollBottom( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ), - aHScrollLeft( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ), - aHScrollRight( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ), - aCornerButton( pFrameWin, &aViewData, false ), - aTopButton( pFrameWin, &aViewData, true ), - aScrollBarBox( pFrameWin, WB_SIZEABLE ), + aVScrollTop( new ScrollBar( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ) ), + aVScrollBottom( new ScrollBar( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ) ), + aHScrollLeft( new ScrollBar( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ) ), + aHScrollRight( new ScrollBar( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ) ), + aCornerButton( new ScCornerButton( pFrameWin, &aViewData, false ) ), + aTopButton( new ScCornerButton( pFrameWin, &aViewData, true ) ), + aScrollBarBox( new ScrollBarBox( pFrameWin, WB_SIZEABLE ) ), mpInputHintWindow( NULL ), pPageBreakData( NULL ), pBrushDocument( NULL ), @@ -394,7 +394,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) } // window at the bottom right - lcl_SetPosSize( aScrollBarBox, Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ), + lcl_SetPosSize( *aScrollBarBox.get(), Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ), nTotalWidth, bLayoutRTL ); if (bHScroll) // Scrollbars horizontal @@ -458,39 +458,39 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) { Point aTabPoint(nPosX, nPosY + nSizeY); Size aTabSize(nTabSize, nBarY); - lcl_SetPosSize(*pTabControl, aTabPoint, aTabSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*pTabControl.get(), aTabPoint, aTabSize, nTotalWidth, bLayoutRTL); pTabControl->SetSheetLayoutRTL(bLayoutRTL); Point aHScrollLeftPoint(nPosX + nTabSize, nPosY + nSizeY); Size aHScrollLeftSize(nSizeLt, nBarY); - lcl_SetPosSize(aHScrollLeft, aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*aHScrollLeft.get(), aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL); Point aHSplitterPoint(nPosX + nTabSize + nSizeLt, nPosY + nSizeY); Size aHSplitterSize(nSizeSp, nBarY); - lcl_SetPosSize(*pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL); Point aHScrollRightPoint(nPosX + nTabSize + nSizeLt + nSizeSp, nPosY + nSizeY); Size aHScrollRightSize(nSizeRt, nBarY); - lcl_SetPosSize(aHScrollRight, aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*aHScrollRight.get(), aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL); } else { Point aTabPoint(nPosX, nPosY + nSizeY + nScrollBarSize); Size aTabSize(nSizeX, nTabWidth); - lcl_SetPosSize(*pTabControl, aTabPoint, aTabSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*pTabControl.get(), aTabPoint, aTabSize, nTotalWidth, bLayoutRTL); pTabControl->SetSheetLayoutRTL(bLayoutRTL); Point aHScrollLeftPoint(nPosX, nPosY + nSizeY); Size aHScrollLeftSize(nSizeLt, nScrollBarSize); - lcl_SetPosSize(aHScrollLeft, aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*aHScrollLeft.get(), aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL); Point aHSplitterPoint(nPosX + nSizeLt, nPosY + nSizeY); Size aHSplitterSize(nSizeSp, nScrollBarSize); - lcl_SetPosSize(*pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL); Point aHScrollRightPoint(nPosX + nSizeLt + nSizeSp, nPosY + nSizeY); Size aHScrollRightSize(nSizeRt, nScrollBarSize); - lcl_SetPosSize(aHScrollRight, aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*aHScrollRight.get(), aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL); } // SetDragRectPixel is done below } @@ -518,11 +518,11 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) } nSizeDn = nSizeY - nSizeUp - nSizeSp; - lcl_SetPosSize( aVScrollTop, Point(nPosX + nSizeX, nPosY), + lcl_SetPosSize( *aVScrollTop.get(), Point(nPosX + nSizeX, nPosY), Size(nBarX, nSizeUp), nTotalWidth, bLayoutRTL ); lcl_SetPosSize( *pVSplitter, Point( nPosX + nSizeX, nPosY+nSizeUp ), Size( nBarX, nSizeSp ), nTotalWidth, bLayoutRTL ); - lcl_SetPosSize( aVScrollBottom, Point(nPosX + nSizeX, + lcl_SetPosSize( *aVScrollBottom.get(), Point(nPosX + nSizeX, nPosY + nSizeUp + nSizeSp), Size(nBarX, nSizeDn), nTotalWidth, bLayoutRTL ); @@ -540,25 +540,25 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) if (bTabControl && ! bHScroll ) { - nBarY = aHScrollLeft.GetSizePixel().Height(); - nBarX = aVScrollBottom.GetSizePixel().Width(); + nBarY = aHScrollLeft->GetSizePixel().Height(); + nBarX = aVScrollBottom->GetSizePixel().Width(); long nSize1 = nSizeX; long nTabSize = nSize1; if (nTabSize < 0) nTabSize = 0; - lcl_SetPosSize( *pTabControl, Point(nPosX, nPosY+nSizeY-nBarY), + lcl_SetPosSize( *pTabControl.get(), Point(nPosX, nPosY+nSizeY-nBarY), Size(nTabSize, nBarY), nTotalWidth, bLayoutRTL ); nSizeY -= nBarY; - lcl_SetPosSize( aScrollBarBox, Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ), + lcl_SetPosSize( *aScrollBarBox.get(), Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ), nTotalWidth, bLayoutRTL ); if( bVScroll ) { - Size aVScrSize = aVScrollBottom.GetSizePixel(); + Size aVScrSize = aVScrollBottom->GetSizePixel(); aVScrSize.Height() -= nBarY; - aVScrollBottom.SetSizePixel( aVScrSize ); + aVScrollBottom->SetSizePixel( aVScrSize ); } } @@ -607,7 +607,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) { // Fixier-Splitter nicht mit Scrollbar/TabBar ueberlappen lassen if ( bHScroll ) - nSplitHeight -= aHScrollLeft.GetSizePixel().Height(); + nSplitHeight -= aHScrollLeft->GetSizePixel().Height(); else if ( bTabControl && pTabControl ) nSplitHeight -= pTabControl->GetSizePixel().Height(); } @@ -623,7 +623,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) { long nSplitWidth = rSize.Width(); if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX && bVScroll ) - nSplitWidth -= aVScrollBottom.GetSizePixel().Width(); + nSplitWidth -= aVScrollBottom->GetSizePixel().Width(); nSplitPosY = aViewData.GetVSplitPos(); lcl_SetPosSize( *pVSplitter, Point( nOutPosX, nSplitPosY ), Size( nSplitWidth, nSplitSizeY ), nTotalWidth, bLayoutRTL ); @@ -672,11 +672,11 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) } if (bHOutline && bVOutline) { - lcl_SetPosSize( aTopButton, Point(nOutPosX,nOutPosY), Size(nOutlineX,nOutlineY), nTotalWidth, bLayoutRTL ); - aTopButton.Show(); + lcl_SetPosSize( *aTopButton.get(), Point(nOutPosX,nOutPosY), Size(nOutlineX,nOutlineY), nTotalWidth, bLayoutRTL ); + aTopButton->Show(); } else - aTopButton.Hide(); + aTopButton->Hide(); if (bHeaders) // Spalten/Zeilen-Header { @@ -692,14 +692,14 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) lcl_SetPosSize( *pRowBar[SC_SPLIT_BOTTOM], Point(nPosX-nBarX,nSplitPosY), Size(nBarX,nBottomSize), nTotalWidth, bLayoutRTL ); - lcl_SetPosSize( aCornerButton, Point(nPosX-nBarX,nPosY-nBarY), Size(nBarX,nBarY), nTotalWidth, bLayoutRTL ); - aCornerButton.Show(); + lcl_SetPosSize( *aCornerButton.get(), Point(nPosX-nBarX,nPosY-nBarY), Size(nBarX,nBarY), nTotalWidth, bLayoutRTL ); + aCornerButton->Show(); pColBar[SC_SPLIT_LEFT]->Show(); pRowBar[SC_SPLIT_BOTTOM]->Show(); } else { - aCornerButton.Hide(); + aCornerButton->Hide(); pColBar[SC_SPLIT_LEFT]->Hide(); // immer da pRowBar[SC_SPLIT_BOTTOM]->Hide(); } @@ -822,8 +822,8 @@ void ScTabView::GetBorderSize( SvBorder& rBorder, const Size& /* rSize */ ) if (bScrollBars) // Scrollbars horizontal oder vertikal { - rBorder.Right() += aVScrollBottom.GetSizePixel().Width(); - rBorder.Bottom() += aHScrollLeft.GetSizePixel().Height(); + rBorder.Right() += aVScrollBottom->GetSizePixel().Width(); + rBorder.Bottom() += aHScrollLeft->GetSizePixel().Height(); } // Outline-Controls @@ -1015,8 +1015,8 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos ) { ScHSplitPos eHPos = WhichH(ePos); ScVSplitPos eVPos = WhichV(ePos); - ScrollBar* pHScroll = ( eHPos == SC_SPLIT_LEFT ) ? &aHScrollLeft : &aHScrollRight; - ScrollBar* pVScroll = ( eVPos == SC_SPLIT_TOP ) ? &aVScrollTop : &aVScrollBottom; + ScrollBar* pHScroll = ( eHPos == SC_SPLIT_LEFT ) ? aHScrollLeft.get() : aHScrollRight.get(); + ScrollBar* pVScroll = ( eVPos == SC_SPLIT_TOP ) ? aVScrollTop.get() : aVScrollBottom.get(); if ( pGridWin[ePos] ) bDone = pGridWin[ePos]->HandleScrollCommand( rCEvt, pHScroll, pVScroll ); } @@ -1035,13 +1035,13 @@ IMPL_LINK_NOARG(ScTabView, EndScrollHdl) IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) { - bool bHoriz = ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight ); + bool bHoriz = ( pScroll == aHScrollLeft.get() || pScroll == aHScrollRight.get() ); long nViewPos; if ( bHoriz ) - nViewPos = aViewData.GetPosX( (pScroll == &aHScrollLeft) ? + nViewPos = aViewData.GetPosX( (pScroll == aHScrollLeft.get()) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT ); else - nViewPos = aViewData.GetPosY( (pScroll == &aVScrollTop) ? + nViewPos = aViewData.GetPosY( (pScroll == aVScrollTop.get()) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM ); bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ); @@ -1078,9 +1078,9 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) // get scrollbar scroll position for help text (row number/column name) long nScrollMin = 0; // RangeMin simulieren - if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight ) + if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == aHScrollRight.get() ) nScrollMin = aViewData.GetFixPosX(); - if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom ) + if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == aVScrollBottom.get() ) nScrollMin = aViewData.GetFixPosY(); long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin; @@ -1123,17 +1123,17 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) nDelta = 1; break; case SCROLL_PAGEUP: - if ( pScroll == &aHScrollLeft ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT ); - if ( pScroll == &aHScrollRight ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT ); - if ( pScroll == &aVScrollTop ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP ); - if ( pScroll == &aVScrollBottom ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM ); + if ( pScroll == aHScrollLeft.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT ); + if ( pScroll == aHScrollRight.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT ); + if ( pScroll == aVScrollTop.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP ); + if ( pScroll == aVScrollBottom.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM ); if (nDelta==0) nDelta=-1; break; case SCROLL_PAGEDOWN: - if ( pScroll == &aHScrollLeft ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_LEFT ); - if ( pScroll == &aHScrollRight ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_RIGHT ); - if ( pScroll == &aVScrollTop ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_TOP ); - if ( pScroll == &aVScrollBottom ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); + if ( pScroll == aHScrollLeft.get() ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_LEFT ); + if ( pScroll == aHScrollRight.get() ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_RIGHT ); + if ( pScroll == aVScrollTop.get() ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_TOP ); + if ( pScroll == aVScrollBottom.get() ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); if (nDelta==0) nDelta=1; break; case SCROLL_DRAG: @@ -1142,9 +1142,9 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) // Bereiche herumzittern long nScrollMin = 0; // RangeMin simulieren - if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight ) + if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == aHScrollRight.get() ) nScrollMin = aViewData.GetFixPosX(); - if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom ) + if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == aVScrollBottom.get() ) nScrollMin = aViewData.GetFixPosY(); long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin; @@ -1172,9 +1172,9 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) { bool bUpdate = ( eType != SCROLL_DRAG ); // bei Drag die Ranges nicht aendern if ( bHoriz ) - ScrollX( nDelta, (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT, bUpdate ); + ScrollX( nDelta, (pScroll == aHScrollLeft.get()) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT, bUpdate ); else - ScrollY( nDelta, (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM, bUpdate ); + ScrollY( nDelta, (pScroll == aVScrollTop.get()) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM, bUpdate ); } return 0; @@ -1433,7 +1433,7 @@ void ScTabView::UpdateHeaderWidth( const ScVSplitPos* pWhich, const SCROW* pPosY RepeatResize(); // auf VCL gibt's Update ohne Ende (jedes Update gilt fuer alle Fenster) - //aCornerButton.Update(); // der bekommt sonst nie ein Update + //aCornerButton->Update(); // der bekommt sonst nie ein Update bInUpdateHeader = false; } @@ -1499,11 +1499,11 @@ void ScTabView::UpdateShow() // Windows anzeigen - ShowHide( &aHScrollLeft, bHScrollMode ); - ShowHide( &aHScrollRight, bShowH && bHScrollMode ); - ShowHide( &aVScrollBottom, bVScrollMode ); - ShowHide( &aVScrollTop, bShowV && bVScrollMode ); - ShowHide( &aScrollBarBox, bVScrollMode || bHScrollMode ); + ShowHide( aHScrollLeft.get(), bHScrollMode ); + ShowHide( aHScrollRight.get(), bShowH && bHScrollMode ); + ShowHide( aVScrollBottom.get(), bVScrollMode ); + ShowHide( aVScrollTop.get(), bShowV && bVScrollMode ); + ShowHide( aScrollBarBox.get(), bVScrollMode || bHScrollMode ); ShowHide( pHSplitter, bHScrollMode || bShowH ); // immer angelegt ShowHide( pVSplitter, bVScrollMode || bShowV ); @@ -2221,11 +2221,11 @@ void ScTabView::StartDataSelect() void ScTabView::EnableRefInput(bool bFlag) { - aHScrollLeft.EnableInput(bFlag); - aHScrollRight.EnableInput(bFlag); - aVScrollBottom.EnableInput(bFlag); - aVScrollTop.EnableInput(bFlag); - aScrollBarBox.EnableInput(bFlag); + aHScrollLeft->EnableInput(bFlag); + aHScrollRight->EnableInput(bFlag); + aVScrollBottom->EnableInput(bFlag); + aVScrollTop->EnableInput(bFlag); + aScrollBarBox->EnableInput(bFlag); // ab hier dynamisch angelegte diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index fba9ede166a2..8d21f9cd66bc 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -382,41 +382,41 @@ void ScTabView::UpdateScrollBars() nVisXL = aViewData.VisibleCellsX( SC_SPLIT_LEFT ); long nMaxXL = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_LEFT), nVisXL, MAXCOL, 0 ); - SetScrollBar( aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bLayoutRTL ); + SetScrollBar( *aHScrollLeft.get(), nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bLayoutRTL ); nVisYB = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); long nMaxYB = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_BOTTOM), nVisYB, MAXROW, nStartY ); - SetScrollBar( aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, bLayoutRTL ); + SetScrollBar( *aVScrollBottom.get(), nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, bLayoutRTL ); if (bRight) { nVisXR = aViewData.VisibleCellsX( SC_SPLIT_RIGHT ); long nMaxXR = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_RIGHT), nVisXR, MAXCOL, nStartX ); - SetScrollBar( aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bLayoutRTL ); + SetScrollBar( *aHScrollRight.get(), nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bLayoutRTL ); } if (bTop) { nVisYT = aViewData.VisibleCellsY( SC_SPLIT_TOP ); long nMaxYT = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_TOP), nVisYT, MAXROW, 0 ); - SetScrollBar( aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), bLayoutRTL ); + SetScrollBar( *aVScrollTop.get(), nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), bLayoutRTL ); } // Bereich testen - nDiff = lcl_UpdateBar( aHScrollLeft, nVisXL ); + nDiff = lcl_UpdateBar( *aHScrollLeft.get(), nVisXL ); if (nDiff) ScrollX( nDiff, SC_SPLIT_LEFT ); if (bRight) { - nDiff = lcl_UpdateBar( aHScrollRight, nVisXR ); + nDiff = lcl_UpdateBar( *aHScrollRight.get(), nVisXR ); if (nDiff) ScrollX( nDiff, SC_SPLIT_RIGHT ); } - nDiff = lcl_UpdateBar( aVScrollBottom, nVisYB ); + nDiff = lcl_UpdateBar( *aVScrollBottom.get(), nVisYB ); if (nDiff) ScrollY( nDiff, SC_SPLIT_BOTTOM ); if (bTop) { - nDiff = lcl_UpdateBar( aVScrollTop, nVisYT ); + nDiff = lcl_UpdateBar( *aVScrollTop.get(), nVisYT ); if (nDiff) ScrollY( nDiff, SC_SPLIT_TOP ); } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 21694cbf3c8e..19ff7e61a141 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -108,10 +108,10 @@ void ScTabView::Init() explicitly because the parent frame window is already RTL disabled. */ pTabControl->EnableRTL( AllSettings::GetLayoutRTL() ); - InitScrollBar( aHScrollLeft, MAXCOL+1 ); - InitScrollBar( aHScrollRight, MAXCOL+1 ); - InitScrollBar( aVScrollTop, MAXROW+1 ); - InitScrollBar( aVScrollBottom, MAXROW+1 ); + InitScrollBar( *aHScrollLeft.get(), MAXCOL+1 ); + InitScrollBar( *aHScrollRight.get(), MAXCOL+1 ); + InitScrollBar( *aVScrollTop.get(), MAXROW+1 ); + InitScrollBar( *aVScrollBottom.get(), MAXROW+1 ); /* #i97900# scrollbars remain in correct RTL mode, needed mirroring etc. is now handled correctly at the respective places. */ |