diff options
Diffstat (limited to 'reportdesign/source/ui/dlg')
-rw-r--r-- | reportdesign/source/ui/dlg/AddField.cxx | 89 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/CondFormat.cxx | 15 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Condition.cxx | 75 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Condition.hxx | 33 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/DateTime.cxx | 13 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Formula.cxx | 13 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/GroupsSorting.cxx | 91 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Navigator.cxx | 13 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/PageNumber.cxx | 12 |
9 files changed, 253 insertions, 101 deletions
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx index d9c6e05b8608..7a7c03b0b331 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -62,11 +62,12 @@ using namespace ::svx; class OAddFieldWindowListBox: public SvTreeListBox { - OAddFieldWindow* m_pTabWin; + VclPtr<OAddFieldWindow> m_pTabWin; public: OAddFieldWindowListBox( OAddFieldWindow* _pParent ); virtual ~OAddFieldWindowListBox(); + virtual void dispose() SAL_OVERRIDE; sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE; sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE; @@ -113,8 +114,14 @@ OAddFieldWindowListBox::OAddFieldWindowListBox( OAddFieldWindow* _pParent ) OAddFieldWindowListBox::~OAddFieldWindowListBox() { + disposeOnce(); } +void OAddFieldWindowListBox::dispose() +{ + m_pTabWin.clear(); + SvTreeListBox::dispose(); +} sal_Int8 OAddFieldWindowListBox::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) { @@ -151,11 +158,11 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent ,::comphelper::OPropertyChangeListener(m_aMutex) ,::comphelper::OContainerListener(m_aMutex) ,m_xRowSet(_xRowSet) - ,m_aActions(this,ModuleRes(RID_TB_SORTING)) - ,m_pListBox(new OAddFieldWindowListBox( this )) - ,m_aFixedLine(this, ModuleRes(ADDFIELD_FL_HELP_SEPARATOR) ) - ,m_aHelpText(this, ModuleRes(ADDFIELD_HELP_FIELD) ) - ,m_aInsertButton(this, WB_TABSTOP|WB_CENTER) + ,m_aActions(VclPtr<ToolBox>::Create(this,ModuleRes(RID_TB_SORTING))) + ,m_pListBox(VclPtr<OAddFieldWindowListBox>::Create( this )) + ,m_aFixedLine(VclPtr<FixedLine>::Create(this, ModuleRes(ADDFIELD_FL_HELP_SEPARATOR) )) + ,m_aHelpText(VclPtr<FixedText>::Create(this, ModuleRes(ADDFIELD_HELP_FIELD) )) + ,m_aInsertButton(VclPtr<PushButton>::Create(this, WB_TABSTOP|WB_CENTER)) ,m_nCommandType(0) ,m_bEscapeProcessing(false) ,m_pChangeListener(NULL) @@ -165,13 +172,13 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) ); SetMinOutputSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y)); - m_aActions.SetStyle(m_aActions.GetStyle()|WB_LINESPACING); - m_aActions.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) ); + m_aActions->SetStyle(m_aActions->GetStyle()|WB_LINESPACING); + m_aActions->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) ); - m_aActions.SetSelectHdl(LINK(this, OAddFieldWindow, OnSortAction)); - setToolBox(&m_aActions); - m_aActions.CheckItem(SID_FM_SORTUP); - m_aActions.EnableItem(SID_ADD_CONTROL_PAIR, false); + m_aActions->SetSelectHdl(LINK(this, OAddFieldWindow, OnSortAction)); + setToolBox(m_aActions.get()); + m_aActions->CheckItem(SID_FM_SORTUP); + m_aActions->EnableItem(SID_ADD_CONTROL_PAIR, false); m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) ); m_pListBox->SetSelectHdl(LINK( this, OAddFieldWindow, OnSelectHdl ) ); @@ -179,12 +186,12 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) ); m_pListBox->Show(); const OUString sTitle(ModuleRes(RID_STR_INSERT)); - m_aInsertButton.SetText(sTitle); - m_aInsertButton.SetClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) ); - m_aInsertButton.Show(); + m_aInsertButton->SetText(sTitle); + m_aInsertButton->SetClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) ); + m_aInsertButton->Show(); - m_aFixedLine.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() ); - m_aHelpText.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() ); + m_aFixedLine->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() ); + m_aHelpText->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() ); SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y)); @@ -209,6 +216,11 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent OAddFieldWindow::~OAddFieldWindow() { + disposeOnce(); +} + +void OAddFieldWindow::dispose() +{ if ( m_pListBox.get() ) { SvTreeList* pModel = m_pListBox->GetModel(); @@ -222,6 +234,13 @@ OAddFieldWindow::~OAddFieldWindow() m_pChangeListener->dispose(); if ( m_pContainerListener.is() ) m_pContainerListener->dispose(); + + m_aActions.disposeAndClear(); + m_aFixedLine.disposeAndClear(); + m_aHelpText.disposeAndClear(); + m_aInsertButton.disposeAndClear(); + m_pListBox.disposeAndClear(); + FloatingWindow::dispose(); } @@ -307,10 +326,10 @@ void OAddFieldWindow::Update() { // ListBox loeschen m_pListBox->Clear(); - const sal_uInt16 nItemCount = m_aActions.GetItemCount(); + const sal_uInt16 nItemCount = m_aActions->GetItemCount(); for (sal_uInt16 j = 0; j< nItemCount; ++j) { - m_aActions.EnableItem(m_aActions.GetItemId(j),false); + m_aActions->EnableItem(m_aActions->GetItemId(j),false); } OUString aTitle(ModuleRes(RID_STR_FIELDSELECTION)); @@ -356,7 +375,7 @@ void OAddFieldWindow::Update() { for (sal_uInt16 i = 0; i < nItemCount; ++i) { - m_aActions.EnableItem(m_aActions.GetItemId(i)); + m_aActions->EnableItem(m_aActions->GetItemId(i)); } } OnSelectHdl(NULL); @@ -380,15 +399,15 @@ void OAddFieldWindow::Resize() const Size aFixedTextSize(LogicToPixel( Size( FIXEDTEXT_WIDTH, FIXEDTEXT_HEIGHT ), MAP_APPFONT )); // ToolBar - Size aToolbarSize( m_aActions.GetSizePixel() ); + Size aToolbarSize( m_aActions->GetSizePixel() ); Point aToolbarPos( aRelated.Width(), aRelated.Height()); - m_aActions.SetPosPixel(Point(aToolbarPos.X(), aToolbarPos.Y())); + m_aActions->SetPosPixel(Point(aToolbarPos.X(), aToolbarPos.Y())); Size aLBSize( aWindowSize ); aLBSize.Width() -= ( 2 * aRelated.Width() ); // help text - const Size aHelpTextSize = m_aHelpText.CalcMinimumSize(aLBSize.Width()); + const Size aHelpTextSize = m_aHelpText->CalcMinimumSize(aLBSize.Width()); // ListBox Point aLBPos( aRelated.Width(), aRelated.Height() + aToolbarSize.Height() + aRelated.Height() ); @@ -402,11 +421,11 @@ void OAddFieldWindow::Resize() // FixedLine Size aFLSize( aLBSize.Width(),aFixedTextSize.Height() ); Point aFLPos( aRelated.Width(), aLBPos.Y() + aLBSize.Height() + aRelated.Height()); - m_aFixedLine.SetPosSizePixel( aFLPos, aFLSize ); + m_aFixedLine->SetPosSizePixel( aFLPos, aFLSize ); // Help text Point aFTPos( aRelated.Width(), aFLPos.Y() + aFLSize.Height() + aRelated.Height() ); - m_aHelpText.SetPosSizePixel( aFTPos, aHelpTextSize ); + m_aHelpText->SetPosSizePixel( aFTPos, aHelpTextSize ); } uno::Reference< sdbc::XConnection> OAddFieldWindow::getConnection() const @@ -477,7 +496,7 @@ void OAddFieldWindow::_elementReplaced( const container::ContainerEvent& /*_rEve IMPL_LINK( OAddFieldWindow, OnSelectHdl, void* ,/*_pAddFieldDlg*/) { - m_aActions.EnableItem(SID_ADD_CONTROL_PAIR, ( m_pListBox.get() && m_pListBox->GetSelectionCount() > 0 )); + m_aActions->EnableItem(SID_ADD_CONTROL_PAIR, ( m_pListBox.get() && m_pListBox->GetSelectionCount() > 0 )); return 0L; } @@ -495,7 +514,7 @@ void OAddFieldWindow::setImageList(sal_Int16 _eBitmapSet) sal_Int16 nN = IMG_ADDFIELD_DLG_SC; if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE ) nN = IMG_ADDFIELD_DLG_LC; - m_aActions.SetImageList(ImageList(ModuleRes(nN))); + m_aActions->SetImageList(ImageList(ModuleRes(nN))); } void OAddFieldWindow::resizeControls(const Size& _rDiff) @@ -509,27 +528,27 @@ void OAddFieldWindow::resizeControls(const Size& _rDiff) IMPL_LINK( OAddFieldWindow, OnSortAction, ToolBox*, /*NOTINTERESTEDIN*/ ) { - const sal_uInt16 nCurItem = m_aActions.GetCurItemId(); + const sal_uInt16 nCurItem = m_aActions->GetCurItemId(); if ( SID_ADD_CONTROL_PAIR == nCurItem ) OnDoubleClickHdl(NULL); else { - if ( SID_FM_REMOVE_FILTER_SORT == nCurItem || !m_aActions.IsItemChecked(nCurItem) ) + if ( SID_FM_REMOVE_FILTER_SORT == nCurItem || !m_aActions->IsItemChecked(nCurItem) ) { - const sal_uInt16 nItemCount = m_aActions.GetItemCount(); + const sal_uInt16 nItemCount = m_aActions->GetItemCount(); for (sal_uInt16 j = 0; j< nItemCount; ++j) { - const sal_uInt16 nItemId = m_aActions.GetItemId(j); + const sal_uInt16 nItemId = m_aActions->GetItemId(j); if ( nCurItem != nItemId ) - m_aActions.CheckItem(nItemId,false); + m_aActions->CheckItem(nItemId,false); } SvSortMode eSortMode = SortNone; if ( SID_FM_REMOVE_FILTER_SORT != nCurItem ) { - m_aActions.CheckItem(nCurItem,!m_aActions.IsItemChecked(nCurItem)); - if ( m_aActions.IsItemChecked(SID_FM_SORTUP) ) + m_aActions->CheckItem(nCurItem,!m_aActions->IsItemChecked(nCurItem)); + if ( m_aActions->IsItemChecked(SID_FM_SORTUP) ) eSortMode = SortAscending; - else if ( m_aActions.IsItemChecked(SID_FM_SORTDOWN) ) + else if ( m_aActions->IsItemChecked(SID_FM_SORTDOWN) ) eSortMode = SortDescending; } diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx index 16aa8a31120e..24e2bce7782f 100644 --- a/reportdesign/source/ui/dlg/CondFormat.cxx +++ b/reportdesign/source/ui/dlg/CondFormat.cxx @@ -130,7 +130,16 @@ namespace rptui ConditionalFormattingDialog::~ConditionalFormattingDialog() { + disposeOnce(); + } + + void ConditionalFormattingDialog::dispose() + { m_aConditions.clear(); + m_pConditionPlayground.clear(); + m_pScrollWindow.clear(); + m_pCondScroll.clear(); + ModalDialog::dispose(); } void ConditionalFormattingDialog::impl_updateConditionIndicies() @@ -183,7 +192,7 @@ namespace rptui ::comphelper::copyProperties(m_xCopy.get(),xCond.get()); m_xCopy->insertByIndex( _nNewCondIndex, makeAny( xCond ) ); - ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) ); + VclPtrInstance<Condition> pCon( m_pConditionPlayground, *this, m_rController ); pCon->setCondition( xCond ); pCon->reorderWithinParent(_nNewCondIndex); m_aConditions.insert( m_aConditions.begin() + _nNewCondIndex, pCon ); @@ -264,7 +273,7 @@ namespace rptui // do this in two steps, so we don't become inconsistent if any of the UNO actions fails Any aMovedCondition; - ConditionPtr pMovedCondition; + Condition *pMovedCondition; try { aMovedCondition = m_xCopy->getByIndex( (sal_Int32)nOldConditionIndex ); @@ -342,7 +351,7 @@ namespace rptui sal_Int32 nCount = m_xCopy->getCount(); for ( sal_Int32 i = 0; i < nCount ; ++i ) { - ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) ); + VclPtrInstance<Condition> pCon( m_pConditionPlayground, *this, m_rController ); Reference< XFormatCondition > xCond( m_xCopy->getByIndex(i), UNO_QUERY ); pCon->reorderWithinParent(i); pCon->setCondition( xCond ); diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index 26e5989dce07..1ef8d1e7bf90 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -97,11 +97,13 @@ IMPL_LINK( ConditionField, OnFormula, Button*, _pClickedButton ) class OColorPopup : public FloatingWindow { DECL_LINK( SelectHdl, void * ); - Condition* m_pCondition; + VclPtr<Condition> m_pCondition; sal_uInt16 m_nSlotId; public: OColorPopup(vcl::Window* _pParent,Condition* _pCondition); - ValueSet m_aColorSet; + virtual ~OColorPopup(); + virtual void dispose() SAL_OVERRIDE; + VclPtr<ValueSet> m_aColorSet; virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -114,9 +116,9 @@ OColorPopup::OColorPopup(vcl::Window* _pParent,Condition* _pCondition) :FloatingWindow(_pParent, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK|WB_DIALOGCONTROL )) ,m_pCondition(_pCondition) ,m_nSlotId(0) -,m_aColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ) +,m_aColorSet( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT)) ) { - m_aColorSet.SetHelpId( HID_RPT_POPUP_COLOR_CTRL ); + m_aColorSet->SetHelpId( HID_RPT_POPUP_COLOR_CTRL ); SetHelpId( HID_RPT_POPUP_COLOR ); const Size aSize12( 13, 13 ); short i = 0; @@ -127,34 +129,47 @@ OColorPopup::OColorPopup(vcl::Window* _pParent,Condition* _pCondition) if ( nCount > PALETTE_SIZE ) // Show scrollbar if more than PALLETTE_SIZE colors are available - m_aColorSet.SetStyle( m_aColorSet.GetStyle() | WB_VSCROLL ); + m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_VSCROLL ); for ( i = 0; i < nCount; i++ ) { XColorEntry* pEntry = pColorList->GetColor(i); - m_aColorSet.InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() ); + m_aColorSet->InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() ); } while ( i < PALETTE_SIZE ) { // fill empty elements if less then PALLETTE_SIZE colors are available - m_aColorSet.InsertItem( i+1, aColWhite, aStrWhite ); + m_aColorSet->InsertItem( i+1, aColWhite, aStrWhite ); i++; } - m_aColorSet.SetSelectHdl( LINK( this, OColorPopup, SelectHdl ) ); - m_aColorSet.SetColCount( PALETTE_X ); - m_aColorSet.SetLineCount( PALETTE_Y ); - Size aSize = m_aColorSet.CalcWindowSizePixel( aSize12 ); + m_aColorSet->SetSelectHdl( LINK( this, OColorPopup, SelectHdl ) ); + m_aColorSet->SetColCount( PALETTE_X ); + m_aColorSet->SetLineCount( PALETTE_Y ); + Size aSize = m_aColorSet->CalcWindowSizePixel( aSize12 ); aSize.Width() += 4; aSize.Height() += 4; SetOutputSizePixel( aSize ); - m_aColorSet.Show(); + m_aColorSet->Show(); +} + +OColorPopup::~OColorPopup() +{ + disposeOnce(); +} + +void OColorPopup::dispose() +{ + disposeBuilder(); + m_aColorSet.clear(); + m_pCondition.clear(); + FloatingWindow::dispose(); } void OColorPopup::KeyInput( const KeyEvent& rKEvt ) { - m_aColorSet.KeyInput(rKEvt); + m_aColorSet->KeyInput(rKEvt); } void OColorPopup::Resize() @@ -162,12 +177,12 @@ void OColorPopup::Resize() Size aSize = GetOutputSizePixel(); aSize.Width() -= 4; aSize.Height() -= 4; - m_aColorSet.SetPosSizePixel( Point(2,2), aSize ); + m_aColorSet->SetPosSizePixel( Point(2,2), aSize ); } void OColorPopup::StartSelection() { - m_aColorSet.StartSelection(); + m_aColorSet->StartSelection(); } void OColorPopup::SetSlotId(sal_uInt16 _nSlotId) @@ -175,20 +190,20 @@ void OColorPopup::SetSlotId(sal_uInt16 _nSlotId) m_nSlotId = _nSlotId; if ( SID_ATTR_CHAR_COLOR_BACKGROUND == _nSlotId || SID_BACKGROUND_COLOR == _nSlotId ) { - m_aColorSet.SetStyle( m_aColorSet.GetStyle() | WB_NONEFIELD ); - m_aColorSet.SetText( OUString(ModuleRes( STR_TRANSPARENT )) ); + m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_NONEFIELD ); + m_aColorSet->SetText( OUString(ModuleRes( STR_TRANSPARENT )) ); } } IMPL_LINK_NOARG(OColorPopup, SelectHdl) { - sal_uInt16 nItemId = m_aColorSet.GetSelectItemId(); - Color aColor( nItemId == 0 ? Color( COL_TRANSPARENT ) : m_aColorSet.GetItemColor( nItemId ) ); + sal_uInt16 nItemId = m_aColorSet->GetSelectItemId(); + Color aColor( nItemId == 0 ? Color( COL_TRANSPARENT ) : m_aColorSet->GetItemColor( nItemId ) ); /* #i33380# Moved the following line above the Dispatch() calls. This instance may be deleted in the meantime (i.e. when a dialog is opened while in Dispatch()), accessing members will crash in this case. */ - m_aColorSet.SetNoSelection(); + m_aColorSet->SetNoSelection(); if ( IsInPopupMode() ) EndPopupMode(); @@ -294,20 +309,36 @@ sal_uInt16 Condition::mapToolbarItemToSlotId(sal_uInt16 nItemId) const Condition::~Condition() { + disposeOnce(); +} + +void Condition::dispose() +{ m_bInDestruction = true; - delete m_pColorFloat; delete m_pBtnUpdaterFontColor; delete m_pCondLHS; delete m_pCondRHS; delete m_pBtnUpdaterBackgroundColor; + m_pHeader.clear(); + m_pConditionType.clear(); + m_pOperationList.clear(); + m_pOperandGlue.clear(); + m_pActions.clear(); + m_pPreview.clear(); + m_pMoveUp.clear(); + m_pMoveDown.clear(); + m_pAddCondition.clear(); + m_pRemoveCondition.clear(); + m_pColorFloat.disposeAndClear(); + VclHBox::dispose(); } IMPL_LINK( Condition, DropdownClick, ToolBox*, /*pToolBar*/ ) { sal_uInt16 nId( m_pActions->GetCurItemId() ); if ( !m_pColorFloat ) - m_pColorFloat = new OColorPopup(m_pActions,this); + m_pColorFloat = VclPtr<OColorPopup>::Create(m_pActions,this); sal_uInt16 nTextId = 0; if (nId == m_nFontColorId) diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx index 14fa15fba7cc..01a3b8cb29cf 100644 --- a/reportdesign/source/ui/dlg/Condition.hxx +++ b/reportdesign/source/ui/dlg/Condition.hxx @@ -49,9 +49,9 @@ namespace rptui class ConditionField { - Condition* m_pParent; - Edit* m_pSubEdit; - PushButton* m_pFormula; + VclPtr<Condition> m_pParent; + VclPtr<Edit> m_pSubEdit; + VclPtr<PushButton> m_pFormula; DECL_LINK( OnFormula, Button* ); public: @@ -77,19 +77,19 @@ namespace rptui ::rptui::OReportController& m_rController; IConditionalFormatAction& m_rAction; - FixedText* m_pHeader; - ListBox* m_pConditionType; - ListBox* m_pOperationList; - ConditionField* m_pCondLHS; - FixedText* m_pOperandGlue; - ConditionField* m_pCondRHS; - ToolBox* m_pActions; - SvxFontPrevWindow* m_pPreview; - PushButton* m_pMoveUp; - PushButton* m_pMoveDown; - PushButton* m_pAddCondition; - PushButton* m_pRemoveCondition; - OColorPopup* m_pColorFloat; + VclPtr<FixedText> m_pHeader; + VclPtr<ListBox> m_pConditionType; + VclPtr<ListBox> m_pOperationList; + ConditionField* m_pCondLHS; + VclPtr<FixedText> m_pOperandGlue; + ConditionField* m_pCondRHS; + VclPtr<ToolBox> m_pActions; + VclPtr<SvxFontPrevWindow> m_pPreview; + VclPtr<PushButton> m_pMoveUp; + VclPtr<PushButton> m_pMoveDown; + VclPtr<PushButton> m_pAddCondition; + VclPtr<PushButton> m_pRemoveCondition; + VclPtr<OColorPopup> m_pColorFloat; ::svx::ToolboxButtonColorUpdater* m_pBtnUpdaterFontColor; // updates the color below the toolbar icon ::svx::ToolboxButtonColorUpdater* m_pBtnUpdaterBackgroundColor; @@ -107,6 +107,7 @@ namespace rptui public: Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController ); virtual ~Condition(); + virtual void dispose() SAL_OVERRIDE; /** will be called when the id of the image list needs to change. @param _eBitmapSet diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx index eaba66735718..caad1e3bf1aa 100644 --- a/reportdesign/source/ui/dlg/DateTime.cxx +++ b/reportdesign/source/ui/dlg/DateTime.cxx @@ -113,6 +113,19 @@ ODateTimeDialog::ODateTimeDialog( vcl::Window* _pParent ODateTimeDialog::~ODateTimeDialog() { + disposeOnce(); +} + +void ODateTimeDialog::dispose() +{ + m_pDate.clear(); + m_pFTDateFormat.clear(); + m_pDateListBox.clear(); + m_pTime.clear(); + m_pFTTimeFormat.clear(); + m_pTimeListBox.clear(); + m_pPB_OK.clear(); + ModalDialog::dispose(); } short ODateTimeDialog::Execute() diff --git a/reportdesign/source/ui/dlg/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx index 4d7746303d45..0854653fb21c 100644 --- a/reportdesign/source/ui/dlg/Formula.cxx +++ b/reportdesign/source/ui/dlg/Formula.cxx @@ -87,16 +87,21 @@ void FormulaDialog::fill() FormulaDialog::~FormulaDialog() { + disposeOnce(); +} + +void FormulaDialog::dispose() +{ if ( m_pAddField ) { SvtViewOptions aDlgOpt( E_WINDOW, OUString( HID_RPT_FIELD_SEL_WIN ) ); aDlgOpt.SetWindowState(OStringToOUString(m_pAddField->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)), RTL_TEXTENCODING_ASCII_US)); - - boost::scoped_ptr<vcl::Window> aTemp2(m_pAddField); - m_pAddField = NULL; } StoreFormEditData( m_pFormulaData ); + m_pEdit.clear(); + m_pAddField.clear(); + formula::FormulaModalDialog::dispose(); } @@ -199,7 +204,7 @@ void FormulaDialog::ToggleCollapsed( RefEdit* _pEdit, RefButton* _pButton) if ( !m_pAddField ) { - m_pAddField = new OAddFieldWindow(this,m_xRowSet); + m_pAddField = VclPtr<OAddFieldWindow>::Create(this,m_xRowSet); m_pAddField->SetCreateHdl(LINK( this, FormulaDialog, OnClickHdl ) ); SvtViewOptions aDlgOpt( E_WINDOW, OUString( HID_RPT_FIELD_SEL_WIN ) ); if ( aDlgOpt.Exists() ) diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index d420b3611531..5b65fc96568c 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -76,34 +76,51 @@ using namespace ::comphelper; } } -typedef ::svt::EditBrowseBox OFieldExpressionControl_Base; -typedef ::cppu::WeakImplHelper1< container::XContainerListener > TContainerListenerBase; -class OFieldExpressionControl : public TContainerListenerBase - ,public OFieldExpressionControl_Base +/** + * Separated out from OFieldExpressionControl to prevent collision of ref-counted base classes + */ +class OFieldExpressionControl; +class OFieldExpressionControlContainerListener : public ::cppu::WeakImplHelper1< container::XContainerListener > +{ + VclPtr<OFieldExpressionControl> mpParent; +public: + OFieldExpressionControlContainerListener(OFieldExpressionControl* pParent) : mpParent(pParent) {} + + // XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + // XContainerListener + virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; +}; + +class OFieldExpressionControl : public ::svt::EditBrowseBox { ::osl::Mutex m_aMutex; ::std::vector<sal_Int32> m_aGroupPositions; ::std::vector<ColumnInfo> m_aColumnInfo; - ::svt::ComboBoxControl* m_pComboCell; + VclPtr<::svt::ComboBoxControl> m_pComboCell; sal_Int32 m_nDataPos; sal_Int32 m_nCurrentPos; ImplSVEvent * m_nPasteEvent; ImplSVEvent * m_nDeleteEvent; - OGroupsSortingDialog* m_pParent; + VclPtr<OGroupsSortingDialog> m_pParent; bool m_bIgnoreEvent; + OFieldExpressionControlContainerListener aContainerListener; bool SaveModified(bool _bAppend); public: OFieldExpressionControl(OGroupsSortingDialog* _pParentDialog, vcl::Window *_pParent); virtual ~OFieldExpressionControl(); + virtual void dispose() SAL_OVERRIDE; // XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ); // XContainerListener - virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception); + void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception); + void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception); virtual Size GetOptimalSize() const SAL_OVERRIDE; @@ -128,7 +145,7 @@ public: void moveGroups(const uno::Sequence<uno::Any>& _aGroups,sal_Int32 _nRow,bool _bSelect = true); virtual bool CursorMoving(long nNewRow, sal_uInt16 nNewCol) SAL_OVERRIDE; - using OFieldExpressionControl_Base::GetRowCount; + using ::svt::EditBrowseBox::GetRowCount; protected: virtual bool IsTabAllowed(bool bForward) const SAL_OVERRIDE; @@ -163,6 +180,20 @@ public: }; + +void OFieldExpressionControlContainerListener::disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ) +{ mpParent->disposing(Source); } + +void OFieldExpressionControlContainerListener::elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) +{ mpParent->elementInserted(rEvent); } + +void OFieldExpressionControlContainerListener::elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) +{ mpParent->elementReplaced(rEvent); } + +void OFieldExpressionControlContainerListener::elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) +{ mpParent->elementRemoved(rEvent); } + + // class OFieldExpressionControl OFieldExpressionControl::OFieldExpressionControl(OGroupsSortingDialog* _pParentDialog, vcl::Window *_pParent) :EditBrowseBox( _pParent, EditBrowseBoxFlags::NONE, WB_TABSTOP, @@ -176,6 +207,7 @@ OFieldExpressionControl::OFieldExpressionControl(OGroupsSortingDialog* _pParentD ,m_nDeleteEvent(0) ,m_pParent(_pParentDialog) ,m_bIgnoreEvent(false) + ,aContainerListener(this) { SetBorderStyle(WindowBorderStyle::MONO); } @@ -183,9 +215,15 @@ OFieldExpressionControl::OFieldExpressionControl(OGroupsSortingDialog* _pParentD OFieldExpressionControl::~OFieldExpressionControl() { - WeakImplHelper1::acquire(); + disposeOnce(); +} + + +void OFieldExpressionControl::dispose() +{ + aContainerListener.WeakImplHelper1::acquire(); uno::Reference< report::XGroups > xGroups = m_pParent->getGroups(); - xGroups->removeContainerListener(this); + xGroups->removeContainerListener(&aContainerListener); // delete events from queue if( m_nPasteEvent ) @@ -193,7 +231,9 @@ OFieldExpressionControl::~OFieldExpressionControl() if( m_nDeleteEvent ) Application::RemoveUserEvent( m_nDeleteEvent ); - delete m_pComboCell; + m_pComboCell.disposeAndClear(); + m_pParent.clear(); + ::svt::EditBrowseBox::dispose(); } uno::Sequence<uno::Any> OFieldExpressionControl::fillSelectedGroups() @@ -352,7 +392,7 @@ void OFieldExpressionControl::lateInit() InsertHandleColumn(static_cast<sal_uInt16>(GetTextWidth(OUString('0')) * 4)/*, sal_True */); InsertDataColumn( FIELD_EXPRESSION, OUString(ModuleRes(STR_RPT_EXPRESSION)), 100); - m_pComboCell = new ComboBoxControl( &GetDataWindow() ); + m_pComboCell = VclPtr<ComboBoxControl>::Create( &GetDataWindow() ); m_pComboCell->SetSelectHdl(LINK(this,OFieldExpressionControl,CBChangeHdl)); m_pComboCell->SetHelpId(HID_RPT_FIELDEXPRESSION); @@ -370,7 +410,7 @@ void OFieldExpressionControl::lateInit() if( m_pParent->isReadOnly() ) nMode |= BrowserMode::HIDECURSOR; SetMode(nMode); - xGroups->addContainerListener(this); + xGroups->addContainerListener(&aContainerListener); } else // not the first call @@ -936,7 +976,7 @@ OGroupsSortingDialog::OGroupsSortingDialog(vcl::Window* _pParent, bool _bReadOnl get(m_pHelpWindow, "helptext"); m_pHelpWindow->set_height_request(GetTextHeight() * 4); get(m_pProperties, "properties"); - m_pFieldExpression = new OFieldExpressionControl(this, get<vcl::Window>("box")); + m_pFieldExpression = VclPtr<OFieldExpressionControl>::Create(this, get<vcl::Window>("box")); m_pFieldExpression->set_hexpand(true); m_pFieldExpression->set_vexpand(true); @@ -971,11 +1011,26 @@ OGroupsSortingDialog::OGroupsSortingDialog(vcl::Window* _pParent, bool _bReadOnl OGroupsSortingDialog::~OGroupsSortingDialog() { - delete m_pFieldExpression; + disposeOnce(); +} + +void OGroupsSortingDialog::dispose() +{ m_xColumns.clear(); m_pReportListener->dispose(); if ( m_pCurrentGroupListener.is() ) m_pCurrentGroupListener->dispose(); + m_pToolBox.clear(); + m_pProperties.clear(); + m_pOrderLst.clear(); + m_pHeaderLst.clear(); + m_pFooterLst.clear(); + m_pGroupOnLst.clear(); + m_pGroupIntervalEd.clear(); + m_pKeepTogetherLst.clear(); + m_pHelpWindow.clear(); + m_pFieldExpression.disposeAndClear(); + FloatingWindow::dispose(); } void OGroupsSortingDialog::UpdateData( ) diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index a85071eebd3f..dd4185ddab20 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -121,7 +121,7 @@ class NavigatorTree : public ::cppu::BaseMutex uno::Reference< uno::XInterface > m_xContent; ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pListener; ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener; - NavigatorTree* m_pTree; + VclPtr<NavigatorTree> m_pTree; public: UserData(NavigatorTree* _pTree,const uno::Reference<uno::XInterface>& _xContent); virtual ~UserData(); @@ -182,6 +182,7 @@ protected: public: NavigatorTree(vcl::Window* pParent,OReportController& _rController ); virtual ~NavigatorTree(); + virtual void dispose() SAL_OVERRIDE; DECL_LINK(OnEntrySelDesel, NavigatorTree*); DECL_LINK( OnDropActionTimer, void* ); @@ -255,6 +256,11 @@ NavigatorTree::NavigatorTree( vcl::Window* pParent,OReportController& _rControll NavigatorTree::~NavigatorTree() { + disposeOnce(); +} + +void NavigatorTree::dispose() +{ SvTreeListEntry* pCurrent = First(); while ( pCurrent ) { @@ -263,6 +269,7 @@ NavigatorTree::~NavigatorTree() } m_pReportListener->dispose(); m_pSelectionListener->dispose(); + SvTreeListBox::dispose(); } void NavigatorTree::Command( const CommandEvent& rEvt ) @@ -875,13 +882,13 @@ public: uno::Reference< report::XReportDefinition> m_xReport; ::rptui::OReportController& m_rController; - ::std::unique_ptr<NavigatorTree> m_pNavigatorTree; + VclPtr<NavigatorTree> m_pNavigatorTree; }; ONavigatorImpl::ONavigatorImpl(OReportController& _rController,ONavigator* _pParent) :m_xReport(_rController.getReportDefinition()) ,m_rController(_rController) - ,m_pNavigatorTree(new NavigatorTree(_pParent->get<vcl::Window>("box"),_rController)) + ,m_pNavigatorTree(VclPtr<NavigatorTree>::Create(_pParent->get<vcl::Window>("box"),_rController)) { reportdesign::OReportVisitor aVisitor(m_pNavigatorTree.get()); aVisitor.start(m_xReport); diff --git a/reportdesign/source/ui/dlg/PageNumber.cxx b/reportdesign/source/ui/dlg/PageNumber.cxx index bc2419b412f2..f7a799a53832 100644 --- a/reportdesign/source/ui/dlg/PageNumber.cxx +++ b/reportdesign/source/ui/dlg/PageNumber.cxx @@ -63,6 +63,18 @@ OPageNumberDialog::OPageNumberDialog( vcl::Window* _pParent OPageNumberDialog::~OPageNumberDialog() { + disposeOnce(); +} + +void OPageNumberDialog::dispose() +{ + m_pPageN.clear(); + m_pPageNofM.clear(); + m_pTopPage.clear(); + m_pBottomPage.clear(); + m_pAlignmentLst.clear(); + m_pShowNumberOnFirstPage.clear(); + ModalDialog::dispose(); } short OPageNumberDialog::Execute() |